@workit-dev/pi 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/workit.js
CHANGED
|
@@ -20151,7 +20151,7 @@ function workitCheckTail(words) {
|
|
|
20151
20151
|
} else if (!/^workit(?:\.exe|\.cmd)?$/.test(commandName(words[0])))
|
|
20152
20152
|
return null;
|
|
20153
20153
|
const { rest: args, cwd } = skipWorkitGlobals(words.slice(at + 1));
|
|
20154
|
-
if (args[0] !== "check" && !(args[0] === "lock" && args[1] === "run"))
|
|
20154
|
+
if (args[0] !== "check" && args[0] !== "run" && !(args[0] === "lock" && args[1] === "run"))
|
|
20155
20155
|
return null;
|
|
20156
20156
|
const split = args.indexOf("--");
|
|
20157
20157
|
const tail = split < 0 ? [] : args.slice(split + 1);
|
|
@@ -24894,7 +24894,9 @@ var WORKIT_ALLOWED_VERBS = [
|
|
|
24894
24894
|
"verify-delivery",
|
|
24895
24895
|
"policy",
|
|
24896
24896
|
"doctor",
|
|
24897
|
-
"help"
|
|
24897
|
+
"help",
|
|
24898
|
+
"ps",
|
|
24899
|
+
"stop"
|
|
24898
24900
|
];
|
|
24899
24901
|
var WORKIT_BYPASS_FLAGS = ["--unverified", "--overwrite-unintegrated"];
|
|
24900
24902
|
var WORKIT_USER_ONLY = [
|
|
@@ -25568,6 +25570,95 @@ function builtIn(words, depth = 0) {
|
|
|
25568
25570
|
const command = words.slice(1).find((word) => !word.startsWith("-") && !word.startsWith("+") || rule.has(word));
|
|
25569
25571
|
return command !== undefined && rule.has(command) ? label() : null;
|
|
25570
25572
|
}
|
|
25573
|
+
var SERVER_SCRIPT = /(?:^|[:_.-])(?:dev|serve|start|storybook)(?:$|[:_.-])/iu;
|
|
25574
|
+
var serverScript = (script = "") => SERVER_SCRIPT.test(script) && !HEAVY_SCRIPT.test(script);
|
|
25575
|
+
var NUXT = sub("dev", "preview", "start");
|
|
25576
|
+
var WEBPACK = sub("serve", "s", "server");
|
|
25577
|
+
var SERVER_TOOLS = {
|
|
25578
|
+
ng: sub("serve", "s"),
|
|
25579
|
+
next: sub("dev", "start"),
|
|
25580
|
+
nuxt: NUXT,
|
|
25581
|
+
nuxi: NUXT,
|
|
25582
|
+
astro: sub("dev", "preview"),
|
|
25583
|
+
"react-scripts": sub("start"),
|
|
25584
|
+
webpack: WEBPACK,
|
|
25585
|
+
"webpack-cli": WEBPACK,
|
|
25586
|
+
storybook: sub("dev", "start"),
|
|
25587
|
+
rails: sub("server", "s"),
|
|
25588
|
+
mix: sub("phx.server")
|
|
25589
|
+
};
|
|
25590
|
+
var COMPOSE_VALUES = new Set([
|
|
25591
|
+
"-f",
|
|
25592
|
+
"--file",
|
|
25593
|
+
"-p",
|
|
25594
|
+
"-H",
|
|
25595
|
+
"--host",
|
|
25596
|
+
"--context",
|
|
25597
|
+
"-c",
|
|
25598
|
+
"--config"
|
|
25599
|
+
]);
|
|
25600
|
+
function serverBuiltIn(words, depth = 0) {
|
|
25601
|
+
const name = baseName2(words[0]);
|
|
25602
|
+
if (depth > 6 || WORKIT.test(name) || words.some((word) => /^(?:-h|--help|--version)$/u.test(word)))
|
|
25603
|
+
return null;
|
|
25604
|
+
const compose = /^(?:docker|podman|nerdctl|docker-compose)$/u.test(name);
|
|
25605
|
+
const at = positional2(words, 1, compose ? COMPOSE_VALUES : PM_VALUES);
|
|
25606
|
+
const command = words[at];
|
|
25607
|
+
const yes = words.slice(0, 3).join(" ");
|
|
25608
|
+
const inner = (from) => serverBuiltIn(words.slice(from), depth + 1);
|
|
25609
|
+
const up = (from) => words[from] === "up" && !words.some((word) => /^(?:-d|--detach|--wait)$/u.test(word));
|
|
25610
|
+
if (name === "npx" || name === "bunx" || name === "pnpx")
|
|
25611
|
+
return inner(at);
|
|
25612
|
+
if (name === "corepack")
|
|
25613
|
+
return inner(1);
|
|
25614
|
+
if (command === undefined)
|
|
25615
|
+
return name === "vite" ? yes : null;
|
|
25616
|
+
if (name === "npm" || name === "pnpm" || name === "yarn" || name === "bun" || name === "deno") {
|
|
25617
|
+
if (EXEC.has(command))
|
|
25618
|
+
return inner(positional2(words, at + 1));
|
|
25619
|
+
if (command === "start")
|
|
25620
|
+
return yes;
|
|
25621
|
+
if (name === "yarn" && command === "workspace")
|
|
25622
|
+
return serverScript(words[at + 2]) ? yes : inner(at + 2);
|
|
25623
|
+
if (NPM_RUN.has(command) || name === "deno" && command === "task") {
|
|
25624
|
+
if (serverScript(words[positional2(words, at + 1)]))
|
|
25625
|
+
return yes;
|
|
25626
|
+
return name === "bun" && command !== "task" ? inner(positional2(words, at + 1)) : null;
|
|
25627
|
+
}
|
|
25628
|
+
if (name === "npm" || name === "deno")
|
|
25629
|
+
return null;
|
|
25630
|
+
return serverScript(command) ? yes : inner(at);
|
|
25631
|
+
}
|
|
25632
|
+
if (PYTHONS.test(name)) {
|
|
25633
|
+
const m = words.indexOf("-m");
|
|
25634
|
+
if (words[m + 1] === "http.server" || command.endsWith("manage.py")) {
|
|
25635
|
+
return m > 0 || words[at + 1] === "runserver" ? yes : null;
|
|
25636
|
+
}
|
|
25637
|
+
return m > 0 && words[m + 1] ? inner(m + 1) : null;
|
|
25638
|
+
}
|
|
25639
|
+
if (["uv", "poetry", "pdm", "pipenv", "hatch", "rye", "bundle"].includes(name))
|
|
25640
|
+
return command === "run" || command === "exec" ? inner(positional2(words, at + 1)) : null;
|
|
25641
|
+
if (name === "make" || name === "gmake")
|
|
25642
|
+
return words.slice(1).some((word) => !/^-|=/u.test(word) && serverScript(word)) ? yes : null;
|
|
25643
|
+
if (name === "nx")
|
|
25644
|
+
return serverScript(command === "run" ? words[at + 1]?.split(":")[1] : command) ? yes : null;
|
|
25645
|
+
if (name === "docker-compose")
|
|
25646
|
+
return up(at) ? yes : null;
|
|
25647
|
+
if (compose)
|
|
25648
|
+
return command === "compose" && up(positional2(words, at + 1, COMPOSE_VALUES)) ? yes : null;
|
|
25649
|
+
if (name === "vite")
|
|
25650
|
+
return command === "build" || command === "optimize" ? null : yes;
|
|
25651
|
+
const rule = SERVER_TOOLS[name];
|
|
25652
|
+
return rule && rule !== "any" && rule.has(command) ? yes : null;
|
|
25653
|
+
}
|
|
25654
|
+
function serverCommand(command, dialect = "posix") {
|
|
25655
|
+
for (const line of linesOf(command, dialect) ?? []) {
|
|
25656
|
+
const reason = serverBuiltIn(line);
|
|
25657
|
+
if (reason)
|
|
25658
|
+
return { line, reason };
|
|
25659
|
+
}
|
|
25660
|
+
return null;
|
|
25661
|
+
}
|
|
25571
25662
|
var globWord = (word) => new RegExp(`^${word.replace(/[.+?^${}()|[\]\\]/gu, "\\$&").replaceAll("*", ".*")}$`, "u");
|
|
25572
25663
|
function parsePattern(pattern) {
|
|
25573
25664
|
const words = pattern.trim().split(/\s+/u).filter(Boolean);
|
|
@@ -25664,6 +25755,28 @@ function heavyPlan(command, options) {
|
|
|
25664
25755
|
unblock: parts[0] ?? null
|
|
25665
25756
|
};
|
|
25666
25757
|
}
|
|
25758
|
+
function serverPlan(command, options) {
|
|
25759
|
+
const dialect = options.dialect ?? "posix";
|
|
25760
|
+
if (dialect !== "posix" || !gitTop(options.cwd))
|
|
25761
|
+
return { kind: "none" };
|
|
25762
|
+
const found = serverCommand(command, dialect);
|
|
25763
|
+
if (!found)
|
|
25764
|
+
return { kind: "none" };
|
|
25765
|
+
const simple = simpleCommand(command, dialect, 0, true);
|
|
25766
|
+
const single = simple && serverBuiltIn(simple);
|
|
25767
|
+
if (options.rules !== null && !wrapAllowed(options.rules, single ? (linesOf(command, dialect) ?? []).flat() : found.line, single ? command : found.line.join(" "), options).ok)
|
|
25768
|
+
return { kind: "passthrough", note: "" };
|
|
25769
|
+
if (single) {
|
|
25770
|
+
const rewrite = leaseRewrite(command)?.replace("workit check --heavy --", "workit run --bg --");
|
|
25771
|
+
return rewrite ? { kind: "rewrite", command: rewrite, reason: single, server: true } : { kind: "none" };
|
|
25772
|
+
}
|
|
25773
|
+
const start = `workit run --bg -- ${found.line.map(quoteWord).join(" ")}`;
|
|
25774
|
+
return {
|
|
25775
|
+
kind: "split",
|
|
25776
|
+
reason: `dev_server: \`${command.trim()}\` chains a dev server (${found.reason}) with other commands. Start it alone, now: \`${start}\`; then run the other parts as their own commands.`,
|
|
25777
|
+
unblock: start
|
|
25778
|
+
};
|
|
25779
|
+
}
|
|
25667
25780
|
function workitOnPath2(env = process.env) {
|
|
25668
25781
|
const names = process.platform === "win32" ? ["workit.exe", "workit.cmd", "workit"] : ["workit"];
|
|
25669
25782
|
for (const dir of (env.PATH ?? "").split(path38.delimiter))
|
|
@@ -25761,21 +25874,26 @@ function heavyGate(cwd, command, options) {
|
|
|
25761
25874
|
const single = dialect === "posix" ? simpleCommand(command, dialect, 0, true) : null;
|
|
25762
25875
|
if (single && lightCommand(single, cwd))
|
|
25763
25876
|
return { kind: "none" };
|
|
25764
|
-
|
|
25877
|
+
const plan = {
|
|
25765
25878
|
cwd,
|
|
25766
25879
|
env,
|
|
25767
25880
|
dialect,
|
|
25768
25881
|
rules: rulesFor(options.host, cwd, env),
|
|
25769
25882
|
bypass: options.permissionMode === "bypassPermissions"
|
|
25770
|
-
}
|
|
25883
|
+
};
|
|
25884
|
+
const server = serverPlan(command, plan);
|
|
25885
|
+
if (server.kind === "rewrite")
|
|
25886
|
+
return server;
|
|
25887
|
+
const heavy = heavyPlan(command, plan);
|
|
25888
|
+
return heavy.kind === "none" ? server : heavy;
|
|
25771
25889
|
} catch {
|
|
25772
25890
|
return { kind: "none" };
|
|
25773
25891
|
}
|
|
25774
25892
|
}
|
|
25775
|
-
var rewriteNote = (plan) => `workit: this heavy command (${plan.reason}) runs under the machine-wide heavy-check lease as \`${plan.command}\`: it waits while another heavy check holds the lease (\`workit lock status\` shows who). Run heavy commands that way yourself; \`workit help lock\` explains the lease.`;
|
|
25893
|
+
var rewriteNote = (plan) => plan.server ? `workit: this dev server (${plan.reason}) runs in the background as \`${plan.command}\`, owned by this session; \`workit stop <id>\` stops it when your work is done.` : `workit: this heavy command (${plan.reason}) runs under the machine-wide heavy-check lease as \`${plan.command}\`: it waits while another heavy check holds the lease (\`workit lock status\` shows who). Run heavy commands that way yourself; \`workit help lock\` explains the lease.`;
|
|
25776
25894
|
var heavyDenial = (original, plan) => ({
|
|
25777
25895
|
kind: "deny",
|
|
25778
|
-
reason: `heavy_command: \`${original.trim()}\` is heavy (${plan.reason}) and must run under the machine-wide heavy-check lease, so parallel agents cannot exhaust this machine's memory and CPU. Run exactly: ${plan.command}`,
|
|
25896
|
+
reason: plan.server ? `dev_server: \`${original.trim()}\` starts a dev server (${plan.reason}), which never returns. Start it in the background, owned by this session; run exactly: ${plan.command}` : `heavy_command: \`${original.trim()}\` is heavy (${plan.reason}) and must run under the machine-wide heavy-check lease, so parallel agents cannot exhaust this machine's memory and CPU. Run exactly: ${plan.command}`,
|
|
25779
25897
|
unblock: plan.command
|
|
25780
25898
|
});
|
|
25781
25899
|
var splitDenial = (plan) => ({
|
|
@@ -30348,6 +30466,44 @@ var spawnDecision = (descriptor, cwd, tool, permissionMode = null) => {
|
|
|
30348
30466
|
return agentModelDecision(cwd, checked.input, { change: checked.change, permissionMode });
|
|
30349
30467
|
};
|
|
30350
30468
|
|
|
30469
|
+
// packages/workit-core/src/hooks/server-gate.ts
|
|
30470
|
+
import fs31 from "node:fs";
|
|
30471
|
+
import path50 from "node:path";
|
|
30472
|
+
var procNoticeFile = (env, session) => path50.join(stateDir(env), "procs", "notices", `${session.replace(/[^A-Za-z0-9_.@+-]/gu, "-").slice(0, 120) || "none"}.json`);
|
|
30473
|
+
var mb = (bytes) => `${Math.round(Number(bytes) / 1048576)} MB`;
|
|
30474
|
+
function takeProcNotice(session, env = process.env) {
|
|
30475
|
+
if (!session)
|
|
30476
|
+
return null;
|
|
30477
|
+
const file = procNoticeFile(env, session);
|
|
30478
|
+
const taken = `${file}.${process.pid}.taken`;
|
|
30479
|
+
try {
|
|
30480
|
+
fs31.renameSync(file, taken);
|
|
30481
|
+
} catch {
|
|
30482
|
+
return null;
|
|
30483
|
+
}
|
|
30484
|
+
try {
|
|
30485
|
+
const { notices } = JSON.parse(fs31.readFileSync(taken, "utf8"));
|
|
30486
|
+
const lines = (Array.isArray(notices) ? notices : []).flatMap((notice) => {
|
|
30487
|
+
if (!notice || typeof notice !== "object")
|
|
30488
|
+
return [];
|
|
30489
|
+
const { id, cmd, cwd, rssBytes, ceilingBytes } = notice;
|
|
30490
|
+
if (typeof id !== "string")
|
|
30491
|
+
return [];
|
|
30492
|
+
return [
|
|
30493
|
+
`- ${id} \`${String(cmd)}\` in ${String(cwd)}: ${mb(rssBytes)} (ceiling ${mb(ceilingBytes)}). Restart it: \`workit run --bg --restart ${id}\`, or \`workit stop ${id}\`.`
|
|
30494
|
+
];
|
|
30495
|
+
});
|
|
30496
|
+
return lines.length ? ["Workit: a background process you started is past the memory ceiling:", ...lines].join(`
|
|
30497
|
+
`) : null;
|
|
30498
|
+
} catch {
|
|
30499
|
+
return null;
|
|
30500
|
+
} finally {
|
|
30501
|
+
try {
|
|
30502
|
+
fs31.rmSync(taken, { force: true });
|
|
30503
|
+
} catch {}
|
|
30504
|
+
}
|
|
30505
|
+
}
|
|
30506
|
+
|
|
30351
30507
|
// packages/workit-core/src/hooks/ytrack-word.ts
|
|
30352
30508
|
var YTRACK_WORD = /ytrack(?![\w/-]|\.(?!exe|cmd))/i;
|
|
30353
30509
|
var namesYtrack = (text) => {
|
|
@@ -30896,7 +31052,7 @@ function handleHook(input, deps) {
|
|
|
30896
31052
|
const decision = decide(input, deps);
|
|
30897
31053
|
if (deps.descriptor.transport !== "hook-process" || !PRE_TOOL.has(input.event.kind) || decision.kind === "deny" || decision.kind === "ask")
|
|
30898
31054
|
return decision;
|
|
30899
|
-
const delta = [standingDelta(input), deps.budget?.line(input) ?? null].filter(Boolean).join(`
|
|
31055
|
+
const delta = [standingDelta(input), takeProcNotice(input.session.id), deps.budget?.line(input) ?? null].filter(Boolean).join(`
|
|
30900
31056
|
`) || null;
|
|
30901
31057
|
if (!delta)
|
|
30902
31058
|
return decision;
|
|
@@ -31126,11 +31282,11 @@ var modelKey = (model) => {
|
|
|
31126
31282
|
|
|
31127
31283
|
// packages/workit-core/src/hooks/budget-signal.ts
|
|
31128
31284
|
import { createHash as createHash23 } from "node:crypto";
|
|
31129
|
-
import
|
|
31130
|
-
import
|
|
31285
|
+
import fs32 from "node:fs";
|
|
31286
|
+
import path51 from "node:path";
|
|
31131
31287
|
var hash2 = (text) => createHash23("sha256").update(text).digest("hex").slice(0, 32);
|
|
31132
|
-
var budgetDir = (store) =>
|
|
31133
|
-
var agentBase = (store, session, agentId) =>
|
|
31288
|
+
var budgetDir = (store) => path51.join(store, "budget");
|
|
31289
|
+
var agentBase = (store, session, agentId) => path51.join(budgetDir(store), hash2(`${session}\x00${agentId ?? ""}`));
|
|
31134
31290
|
var spawnBudget = (prompt) => {
|
|
31135
31291
|
const found = /^TIMEBOX:[^\n]*?\b(\d+)\s+tool calls\b/mu.exec(prompt);
|
|
31136
31292
|
const n = found ? Number(found[1]) : NaN;
|
|
@@ -31138,7 +31294,7 @@ var spawnBudget = (prompt) => {
|
|
|
31138
31294
|
};
|
|
31139
31295
|
var readBudget = (file) => {
|
|
31140
31296
|
try {
|
|
31141
|
-
const { limit, told } = JSON.parse(
|
|
31297
|
+
const { limit, told } = JSON.parse(fs32.readFileSync(file, "utf8"));
|
|
31142
31298
|
return typeof limit === "number" && limit > 0 ? { limit, told: Number(told) || 0 } : null;
|
|
31143
31299
|
} catch {
|
|
31144
31300
|
return null;
|
|
@@ -31146,16 +31302,16 @@ var readBudget = (file) => {
|
|
|
31146
31302
|
};
|
|
31147
31303
|
var startBudget = (store, session, agentId, n) => {
|
|
31148
31304
|
const dir = budgetDir(store);
|
|
31149
|
-
|
|
31305
|
+
fs32.mkdirSync(dir, { recursive: true });
|
|
31150
31306
|
const cutoff = Date.now() - 604800000;
|
|
31151
|
-
for (const name of
|
|
31307
|
+
for (const name of fs32.readdirSync(dir))
|
|
31152
31308
|
try {
|
|
31153
|
-
if (
|
|
31154
|
-
|
|
31309
|
+
if (fs32.statSync(path51.join(dir, name)).mtimeMs < cutoff)
|
|
31310
|
+
fs32.rmSync(path51.join(dir, name));
|
|
31155
31311
|
} catch {}
|
|
31156
31312
|
const base = agentBase(store, session, agentId);
|
|
31157
|
-
|
|
31158
|
-
|
|
31313
|
+
fs32.writeFileSync(`${base}.json`, JSON.stringify({ limit: n, told: 0 }));
|
|
31314
|
+
fs32.rmSync(`${base}.calls`, { force: true });
|
|
31159
31315
|
};
|
|
31160
31316
|
var bindBudget = (cwd, session, agentId, prompt) => {
|
|
31161
31317
|
try {
|
|
@@ -31178,8 +31334,8 @@ var tickBudget = (cwd, session, agentId) => {
|
|
|
31178
31334
|
const budget = readBudget(`${base}.json`);
|
|
31179
31335
|
if (!budget)
|
|
31180
31336
|
return false;
|
|
31181
|
-
|
|
31182
|
-
return
|
|
31337
|
+
fs32.appendFileSync(`${base}.calls`, ".");
|
|
31338
|
+
return fs32.statSync(`${base}.calls`).size >= budget.limit * (budget.told + 1);
|
|
31183
31339
|
} catch {
|
|
31184
31340
|
return false;
|
|
31185
31341
|
}
|
|
@@ -31191,14 +31347,14 @@ var reachedOf = (cwd, session, agentId) => {
|
|
|
31191
31347
|
const budget = base && readBudget(`${base}.json`);
|
|
31192
31348
|
if (!budget)
|
|
31193
31349
|
return null;
|
|
31194
|
-
return { base, budget, reached: Math.floor(
|
|
31350
|
+
return { base, budget, reached: Math.floor(fs32.statSync(`${base}.calls`).size / budget.limit) };
|
|
31195
31351
|
};
|
|
31196
31352
|
var budgetLine = (cwd, session, agentId) => {
|
|
31197
31353
|
try {
|
|
31198
31354
|
const at = reachedOf(cwd, session, agentId);
|
|
31199
31355
|
if (!at || at.reached <= at.budget.told)
|
|
31200
31356
|
return null;
|
|
31201
|
-
|
|
31357
|
+
fs32.writeFileSync(`${at.base}.json`, JSON.stringify({ ...at.budget, told: at.reached }));
|
|
31202
31358
|
return lineFor(at.budget.limit * at.reached);
|
|
31203
31359
|
} catch {
|
|
31204
31360
|
return null;
|
|
@@ -31606,12 +31762,12 @@ var skillPromptNudge = (prompt, ctx) => process.env.WORKIT_PI_WORKER_SESSION ? n
|
|
|
31606
31762
|
// packages/workit-pi/src/launches.ts
|
|
31607
31763
|
import { mkdirSync as mkdirSync7, readFileSync as readFileSync16, readdirSync as readdirSync8, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "node:fs";
|
|
31608
31764
|
import os12 from "node:os";
|
|
31609
|
-
import
|
|
31765
|
+
import path52 from "node:path";
|
|
31610
31766
|
var launchDir = (root) => {
|
|
31611
31767
|
const location = resolveStore(root);
|
|
31612
|
-
return location instanceof Error ? null :
|
|
31768
|
+
return location instanceof Error ? null : path52.join(location.dir, "pi-launches");
|
|
31613
31769
|
};
|
|
31614
|
-
var fileFor = (dir, workerId) =>
|
|
31770
|
+
var fileFor = (dir, workerId) => path52.join(dir, `${workerId.replace(/[^A-Za-z0-9-]/g, "_")}.json`);
|
|
31615
31771
|
var recordLaunch = (root, attempt) => {
|
|
31616
31772
|
const dir = launchDir(root);
|
|
31617
31773
|
if (!dir)
|
|
@@ -31657,7 +31813,7 @@ var abandonedLaunches = (root) => {
|
|
|
31657
31813
|
const found = [];
|
|
31658
31814
|
for (const name of names) {
|
|
31659
31815
|
try {
|
|
31660
|
-
const attempt = JSON.parse(readFileSync16(
|
|
31816
|
+
const attempt = JSON.parse(readFileSync16(path52.join(dir, name), "utf8"));
|
|
31661
31817
|
if (typeof attempt.workerId === "string" && typeof attempt.session === "string") {
|
|
31662
31818
|
if (!alive(attempt))
|
|
31663
31819
|
found.push(attempt);
|
|
@@ -31670,17 +31826,17 @@ var cancelHint = (workerId) => `cancel it first: workit_worker {"action":"cancel
|
|
|
31670
31826
|
|
|
31671
31827
|
// packages/workit-core/src/core/cli-locate.ts
|
|
31672
31828
|
import { closeSync as closeSync4, existsSync as existsSync16, openSync as openSync4, readSync as readSync2 } from "node:fs";
|
|
31673
|
-
import
|
|
31829
|
+
import path53 from "node:path";
|
|
31674
31830
|
var LAUNCHER_MARKER = "workit-owned-launcher";
|
|
31675
31831
|
var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
|
|
31676
31832
|
var installRoot = (env, platform = process.platform) => {
|
|
31677
31833
|
if (env.WORKIT_INSTALL_ROOT)
|
|
31678
31834
|
return env.WORKIT_INSTALL_ROOT;
|
|
31679
31835
|
const data = dataDir(env, platform);
|
|
31680
|
-
return platform === "win32" ?
|
|
31836
|
+
return platform === "win32" ? path53.join(data, "install") : data;
|
|
31681
31837
|
};
|
|
31682
|
-
var ownedLauncherPath = (env, platform = process.platform) =>
|
|
31683
|
-
var ownedCurrentEntry = (env, platform = process.platform) =>
|
|
31838
|
+
var ownedLauncherPath = (env, platform = process.platform) => path53.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
|
|
31839
|
+
var ownedCurrentEntry = (env, platform = process.platform) => path53.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
|
|
31684
31840
|
var head = (file) => {
|
|
31685
31841
|
let fd;
|
|
31686
31842
|
try {
|
|
@@ -31707,7 +31863,7 @@ var locateWorkitCli = (options = {}) => {
|
|
|
31707
31863
|
source: "owned-launcher",
|
|
31708
31864
|
command: launcher,
|
|
31709
31865
|
args: [],
|
|
31710
|
-
binDir:
|
|
31866
|
+
binDir: path53.dirname(launcher)
|
|
31711
31867
|
};
|
|
31712
31868
|
const current = ownedCurrentEntry(env, platform);
|
|
31713
31869
|
if (exists(current))
|
|
@@ -31736,7 +31892,7 @@ var workitCliEnv = (located, env = process.env, platform = process.platform) =>
|
|
|
31736
31892
|
if (located.binDir) {
|
|
31737
31893
|
const key = pathKey(env);
|
|
31738
31894
|
const delimiter = platform === "win32" ? ";" : ":";
|
|
31739
|
-
const same = (dir) => platform === "win32" ?
|
|
31895
|
+
const same = (dir) => platform === "win32" ? path53.win32.normalize(dir).toLowerCase() === path53.win32.normalize(located.binDir).toLowerCase() : path53.posix.normalize(dir) === path53.posix.normalize(located.binDir);
|
|
31740
31896
|
const rest = (env[key] ?? "").split(delimiter).filter((dir) => dir && !same(dir));
|
|
31741
31897
|
patch[key] = [located.binDir, ...rest].join(delimiter);
|
|
31742
31898
|
}
|
|
@@ -32607,6 +32763,14 @@ function extension(pi) {
|
|
|
32607
32763
|
sessions.delete(ctx.sessionManager.getSessionId());
|
|
32608
32764
|
reconcileLostWorkers(ctx);
|
|
32609
32765
|
});
|
|
32766
|
+
const procNotice = (ctx) => {
|
|
32767
|
+
if (!ctx.isProjectTrusted())
|
|
32768
|
+
return null;
|
|
32769
|
+
const worker = process.env.WORKIT_PI_WORKER_SESSION && process.env.WORKIT_SESSION_ID?.trim();
|
|
32770
|
+
const own = takeProcNotice(ctx.sessionManager.getSessionId());
|
|
32771
|
+
return [worker ? takeProcNotice(worker) : null, own].filter(Boolean).join(`
|
|
32772
|
+
`) || null;
|
|
32773
|
+
};
|
|
32610
32774
|
pi.on("model_select", (event, ctx) => noteModelSelect(event, ctx));
|
|
32611
32775
|
pi.on("before_agent_start", (event, ctx) => {
|
|
32612
32776
|
if (event.messageType !== "user")
|
|
@@ -32633,6 +32797,11 @@ ${offer}` : ""}`;
|
|
|
32633
32797
|
if (contract && !firstTurn)
|
|
32634
32798
|
content = content ? `${contract}
|
|
32635
32799
|
${content}` : contract;
|
|
32800
|
+
const notice = procNotice(ctx);
|
|
32801
|
+
if (notice)
|
|
32802
|
+
content = content ? `${content}
|
|
32803
|
+
|
|
32804
|
+
${notice}` : notice;
|
|
32636
32805
|
if (content)
|
|
32637
32806
|
return { message: contextMessage(ctx, nudge ? `${content}
|
|
32638
32807
|
|
|
@@ -32684,7 +32853,7 @@ ${nudge}` : content) };
|
|
|
32684
32853
|
const observed = observeResult(event, ctx);
|
|
32685
32854
|
let standing = null;
|
|
32686
32855
|
try {
|
|
32687
|
-
standing = [standingNotice(ctx), budgetNotice(ctx)].filter(Boolean).join(`
|
|
32856
|
+
standing = [standingNotice(ctx), procNotice(ctx), budgetNotice(ctx)].filter(Boolean).join(`
|
|
32688
32857
|
`) || null;
|
|
32689
32858
|
} catch {}
|
|
32690
32859
|
if (!standing)
|
package/package.json
CHANGED
|
@@ -22,7 +22,8 @@ way a user would.
|
|
|
22
22
|
already has a project skills directory, use it:
|
|
23
23
|
- **Launch:** one command, its ready signal (log line, port, exit 0), a timeout.
|
|
24
24
|
Builds, installs and e2e suites run under the heavy-check lease
|
|
25
|
-
(`workit check --heavy -- <cmd>`)
|
|
25
|
+
(`workit check --heavy -- <cmd>`). A dev server starts in the background
|
|
26
|
+
through `workit run --bg -- <cmd>`, which prints its id, port and log.
|
|
26
27
|
- **Doctor:** each precondition and its fix (deps, env vars, ports, services).
|
|
27
28
|
- **Drive:** how to exercise it: CLI invocations, `curl` against routes, a
|
|
28
29
|
browser tool for UI, with fixture data.
|
|
@@ -31,7 +32,7 @@ way a user would.
|
|
|
31
32
|
agent-browser, with a screenshot or console/network observation; an API
|
|
32
33
|
with a real call, response quoted. The report carries the observation.
|
|
33
34
|
App not runnable? Say so plainly, never claim success.
|
|
34
|
-
- **Cleanup:** stop
|
|
35
|
+
- **Cleanup:** `workit stop <id>` for each server it started, remove temp data.
|
|
35
36
|
- **Feature map:** feature, how to drive it, expected observation.
|
|
36
37
|
3. **Prove it end-to-end once:** launch, drive one feature, capture evidence,
|
|
37
38
|
clean up. Fix the skill until that run is clean. A generated skill that was
|
|
@@ -56,10 +57,11 @@ report `clean`, `changed` (what) or `blocked` (why).
|
|
|
56
57
|
|
|
57
58
|
Bad: "Verify by running the tests." (that is not the real surface)
|
|
58
59
|
|
|
59
|
-
Good: "Launch `bun run dev` (ready: `listening on :5173`,
|
|
60
|
-
`curl -s localhost:5173/api/health` returned `{"ok":true}`;
|
|
61
|
-
/settings at .workit-scratch/settings.png. Evidence:
|
|
62
|
-
`workit check --name verify-web -- bun scripts/smoke.ts` exit 0.
|
|
60
|
+
Good: "Launch `workit run --bg -- bun run dev` (ready: `listening on :5173`,
|
|
61
|
+
30 s). Drive: `curl -s localhost:5173/api/health` returned `{"ok":true}`;
|
|
62
|
+
screenshot of /settings at .workit-scratch/settings.png. Evidence:
|
|
63
|
+
`workit check --name verify-web -- bun scripts/smoke.ts` exit 0. Cleanup:
|
|
64
|
+
`workit stop p1abc2def3`."
|
|
63
65
|
|
|
64
66
|
## Check
|
|
65
67
|
|
|
@@ -14,6 +14,7 @@ description: Launch, drive and observe <app> on its real surface (<cli|web|api>)
|
|
|
14
14
|
|
|
15
15
|
## Launch
|
|
16
16
|
`<command>` - ready when `<log line | port open | exit 0>`, timeout <n> s.
|
|
17
|
+
A server: `workit run --bg -- <command>` (prints its id, port and log).
|
|
17
18
|
|
|
18
19
|
## Doctor
|
|
19
20
|
| Precondition | Check | Fix |
|
|
@@ -34,7 +35,7 @@ UI: also report a console or network observation. API: quote the real response.
|
|
|
34
35
|
If the app cannot be run, say so plainly instead of claiming success.
|
|
35
36
|
|
|
36
37
|
## Cleanup
|
|
37
|
-
|
|
38
|
+
`workit stop <id>` for each server Launch started; remove `<tmp dir>`.
|
|
38
39
|
|
|
39
40
|
## Feature map
|
|
40
41
|
| Feature | Drive | Expect |
|