@vicary/pi-subagents 0.84.0-1 → 0.85.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/CHANGELOG.md +62 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/{chunk-F4ASL6OV.js → chunk-7MAE3DJV.js} +1 -1
- package/bundle/{chunk-4MDR6V46.js → chunk-A7VJ5XXE.js} +190 -1177
- package/bundle/{chunk-LGLEH7B6.js → chunk-B3OOJJA6.js} +231 -182
- package/bundle/{chunk-4E7BKDTX.js → chunk-CS4O36CZ.js} +11 -156
- package/bundle/{chunk-G2Z6ZH26.js → chunk-GCSLVFCX.js} +1 -1
- package/bundle/{chunk-2S4K53MV.js → chunk-H2NLFTC5.js} +1 -1
- package/bundle/{chunk-T44HVL5U.js → chunk-HFTBF7SG.js} +2 -1
- package/bundle/{chunk-F4AMYP5N.js → chunk-HS4WPO6B.js} +15 -6
- package/bundle/chunk-HXRB42AF.js +108 -0
- package/bundle/{chunk-4NIY3BE6.js → chunk-JHBQ7N2L.js} +2 -2
- package/bundle/{chunk-HKJLSMXV.js → chunk-JO67XSKD.js} +59 -27
- package/bundle/{chunk-C5P5CHYK.js → chunk-KDMFBYFM.js} +1 -1
- package/bundle/{chunk-V2BZYLEP.js → chunk-KEY3UQMQ.js} +7 -2
- package/bundle/{chunk-NENDSQUY.js → chunk-KZ34KQQH.js} +9 -6
- package/bundle/{chunk-AKOIVLA5.js → chunk-L2ENOFVZ.js} +76 -58
- package/bundle/{chunk-CGN2TVE7.js → chunk-LGMILZNE.js} +322 -18
- package/bundle/{chunk-L3WFKBEI.js → chunk-LTPH2DXH.js} +247 -153
- package/bundle/{chunk-2D52JFLF.js → chunk-N7B2KD74.js} +41 -117
- package/bundle/{chunk-PV63UFUR.js → chunk-O7CPL6H4.js} +183 -28
- package/bundle/{chunk-D3JAFGMO.js → chunk-PHZP3KHB.js} +1 -1
- package/bundle/{chunk-2DHZTCOL.js → chunk-PVIVCDG2.js} +2 -2
- package/bundle/{chunk-LFDBD4PW.js → chunk-QO75KJBT.js} +2 -2
- package/bundle/{chunk-67ENPDDA.js → chunk-QZL2ZZPM.js} +22 -11
- package/bundle/{chunk-PALJGGYC.js → chunk-RV5OGHLO.js} +6 -3
- package/bundle/chunk-T5V5BRCL.js +1067 -0
- package/bundle/{chunk-LNRJCP2Y.js → chunk-UX4SCV5N.js} +337 -207
- package/bundle/{chunk-TE4LHYHN.js → chunk-VEZMZDTW.js} +209 -93
- package/bundle/{chunk-X2MXCSA5.js → chunk-YZBCREP5.js} +310 -101
- package/bundle/control-channel.js +2 -2
- package/bundle/index.js +1 -1
- package/bundle/intercom-bridge.js +2 -2
- package/bundle/preflight.js +8 -8
- package/bundle/project-panes.js +3 -3
- package/docs/agents.md +17 -2
- package/docs/configuration.md +2 -2
- package/docs/extension-api.md +16 -1
- package/docs/workflows.md +30 -2
- package/package.json +2 -2
- package/src/agents/agent-management.js +27 -11
- package/src/agents/agent-memory.d.ts +1 -4
- package/src/agents/agent-memory.js +1 -4
- package/src/agents/agents.d.ts +1 -3
- package/src/agents/agents.js +7 -6
- package/src/agents/frontmatter.js +1 -8
- package/src/agents/global-npm-root.d.ts +1 -0
- package/src/agents/global-npm-root.js +11 -3
- package/src/agents/skills.d.ts +0 -3
- package/src/agents/skills.js +0 -3
- package/src/extension/config.js +7 -1
- package/src/extension/herdr-pi-bridge.js +10 -2
- package/src/extension/index.d.ts +0 -13
- package/src/extension/index.js +43 -32
- package/src/extension/public-execution.d.ts +1 -0
- package/src/extension/public-execution.js +4 -0
- package/src/extension/reply-workflow-script.js +24 -4
- package/src/extension/schemas.d.ts +8 -3
- package/src/extension/schemas.js +5 -3
- package/src/extension/session-switch.d.ts +25 -0
- package/src/extension/session-switch.js +138 -0
- package/src/extension/subagent-guide.d.ts +1 -1
- package/src/extension/subagent-guide.js +1 -1
- package/src/extension/subagent-launch-tool.d.ts +25 -0
- package/src/extension/subagent-launch-tool.js +48 -0
- package/src/extension/tool-activation.js +25 -11
- package/src/extension/tool-description.js +6 -0
- package/src/inspectors/herdr/actions.d.ts +0 -1
- package/src/inspectors/herdr/actions.js +0 -1
- package/src/inspectors/session-roots-codec.d.ts +0 -1
- package/src/inspectors/session-roots-codec.js +0 -1
- package/src/inspectors/tmux/actions.d.ts +0 -1
- package/src/inspectors/tmux/actions.js +0 -1
- package/src/integrations/herdr-status.js +3 -8
- package/src/intercom/native-supervisor-channel.js +65 -9
- package/src/runs/background/async-execution.d.ts +5 -9
- package/src/runs/background/async-execution.js +62 -27
- package/src/runs/background/async-job-tracker.js +12 -0
- package/src/runs/background/async-resume.d.ts +2 -1
- package/src/runs/background/async-resume.js +112 -39
- package/src/runs/background/async-retention.js +6 -1
- package/src/runs/background/auto-drain.js +2 -1
- package/src/runs/background/boot-id.d.ts +1 -3
- package/src/runs/background/boot-id.js +1 -3
- package/src/runs/background/completion-batcher.d.ts +3 -4
- package/src/runs/background/completion-batcher.js +2 -3
- package/src/runs/background/control-channel.d.ts +0 -6
- package/src/runs/background/control-channel.js +0 -6
- package/src/runs/background/fleet-view.js +2 -3
- package/src/runs/background/notify.d.ts +0 -2
- package/src/runs/background/notify.js +0 -2
- package/src/runs/background/result-watcher.d.ts +1 -0
- package/src/runs/background/result-watcher.js +59 -29
- package/src/runs/background/resume-guidance.js +4 -2
- package/src/runs/background/retained-children.js +2 -1
- package/src/runs/background/run-child-session.d.ts +0 -1
- package/src/runs/background/run-child-session.js +1 -1
- package/src/runs/background/run-status.js +4 -3
- package/src/runs/background/scheduled-runs.d.ts +3 -1
- package/src/runs/background/scheduled-runs.js +13 -16
- package/src/runs/background/subagent-runner.d.ts +2 -4
- package/src/runs/background/subagent-runner.js +9 -6
- package/src/runs/background/subagent-wait.js +12 -15
- package/src/runs/background/wait-config.d.ts +2 -0
- package/src/runs/background/wait-config.js +17 -3
- package/src/runs/background/wait-tool.js +4 -2
- package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
- package/src/runs/background/workflow-terminal-proof.js +0 -1
- package/src/runs/foreground/execution.d.ts +0 -3
- package/src/runs/foreground/execution.js +17 -9
- package/src/runs/foreground/subagent-executor.d.ts +3 -2
- package/src/runs/foreground/subagent-executor.js +107 -26
- package/src/runs/shared/child-commands.js +15 -2
- package/src/runs/shared/child-hooks.d.ts +1 -7
- package/src/runs/shared/child-hooks.js +13 -5
- package/src/runs/shared/child-launch.js +6 -2
- package/src/runs/shared/child-runtime-config.d.ts +0 -1
- package/src/runs/shared/child-session.d.ts +1 -1
- package/src/runs/shared/child-session.js +21 -2
- package/src/runs/shared/child-tool-plan.d.ts +0 -1
- package/src/runs/shared/child-tool-plan.js +0 -1
- package/src/runs/shared/claude-code-adapter.js +11 -0
- package/src/runs/shared/external-cli-runner.js +26 -6
- package/src/runs/shared/herdr-connection.js +2 -1
- package/src/runs/shared/herdr-pane-host.d.ts +2 -2
- package/src/runs/shared/herdr-pane-host.js +17 -1
- package/src/runs/shared/herdr-placed-run.js +48 -22
- package/src/runs/shared/lane-metadata.d.ts +0 -1
- package/src/runs/shared/lane-metadata.js +0 -1
- package/src/runs/shared/mcp-direct-tool-grant.js +8 -1
- package/src/runs/shared/model-resolution-diagnostic.d.ts +0 -1
- package/src/runs/shared/model-resolution.d.ts +2 -2
- package/src/runs/shared/model-resolution.js +7 -1
- package/src/runs/shared/model-scope.d.ts +1 -5
- package/src/runs/shared/model-scope.js +1 -5
- package/src/runs/shared/mutation-evidence.d.ts +1 -1
- package/src/runs/shared/mutation-evidence.js +52 -7
- package/src/runs/shared/nested-events.d.ts +1 -0
- package/src/runs/shared/nested-events.js +1 -1
- package/src/runs/shared/parallel-utils.d.ts +0 -1
- package/src/runs/shared/permissions.js +5 -3
- package/src/runs/shared/placement-host.d.ts +5 -1
- package/src/runs/shared/rex-pane-host.d.ts +0 -1
- package/src/runs/shared/rex-pane-host.js +0 -2
- package/src/runs/shared/run-launch-folder.d.ts +12 -0
- package/src/runs/shared/run-launch-folder.js +21 -0
- package/src/runs/shared/runner-launcher.d.ts +12 -1
- package/src/runs/shared/runner-launcher.js +16 -0
- package/src/runs/shared/single-output.d.ts +3 -3
- package/src/runs/shared/single-output.js +5 -3
- package/src/runs/shared/structured-output.d.ts +8 -0
- package/src/runs/shared/structured-output.js +30 -2
- package/src/runs/shared/subagent-prompt-runtime.d.ts +0 -1
- package/src/runs/shared/subagent-prompt-runtime.js +4 -2
- package/src/runs/shared/tool-timeout.js +2 -1
- package/src/runs/shared/worktree-cleanup-plan.d.ts +0 -1
- package/src/runs/shared/worktree-cleanup-plan.js +0 -1
- package/src/runs/shared/worktree.d.ts +3 -0
- package/src/runs/shared/worktree.js +20 -0
- package/src/shared/capacity-resilient-json.d.ts +1 -1
- package/src/shared/child-cache-retention.d.ts +1 -2
- package/src/shared/child-cache-retention.js +1 -2
- package/src/shared/fleet-transcript-reader.d.ts +51 -0
- package/src/shared/fleet-transcript-reader.js +333 -0
- package/src/shared/formatters.d.ts +0 -18
- package/src/shared/formatters.js +0 -18
- package/src/shared/session-succession.d.ts +16 -1
- package/src/shared/session-succession.js +41 -2
- package/src/shared/session-warnings.d.ts +7 -0
- package/src/shared/session-warnings.js +26 -0
- package/src/shared/settings.d.ts +0 -23
- package/src/shared/settings.js +3 -35
- package/src/shared/types.d.ts +28 -11
- package/src/shared/types.js +0 -12
- package/src/shared/utils.d.ts +0 -14
- package/src/shared/utils.js +0 -22
- package/src/shared/wait-tool-name.d.ts +8 -0
- package/src/shared/wait-tool-name.js +13 -0
- package/src/slash/slash-commands.js +2 -1
- package/src/slash/subagent-cost.d.ts +3 -2
- package/src/slash/subagent-cost.js +22 -3
- package/src/slash/subagents-admin.js +0 -1
- package/src/tui/fleet-status.d.ts +0 -5
- package/src/tui/fleet-status.js +4 -24
- package/src/tui/fleet-transcript.d.ts +1 -44
- package/src/tui/fleet-transcript.js +1 -327
- package/src/tui/fleet.js +6 -4
- package/src/tui/render.d.ts +0 -9
- package/src/tui/render.js +81 -47
- package/src/tui/subagent-messages.js +3 -2
- package/src/watchdog/register-child.d.ts +2 -3
- package/src/watchdog/register-child.js +2 -3
- package/src/watchdog/turn-delta.js +2 -1
- package/src/workflows/scripted-workflow.js +241 -20
- package/src/workflows/workflow-launch-record.d.ts +15 -6
- package/src/workflows/workflow-launch-record.js +30 -12
- package/src/workflows/workflow-resume-claim.js +2 -2
- package/src/workflows/workflow-resume.d.ts +1 -1
- package/src/workflows/workflow-resume.js +11 -8
- package/src/workflows/workflow-script-worker.d.ts +13 -0
- package/src/workflows/workflow-script-worker.js +79 -0
- package/workflow-script-process.cjs +36 -0
- package/workflow-script-worker.cjs +4 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { fork } from "node:child_process";
|
|
2
|
+
import { EventEmitter } from "node:events";
|
|
3
|
+
import { realpathSync } from "node:fs";
|
|
4
|
+
import { dirname } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { Worker } from "node:worker_threads";
|
|
7
|
+
const WORKFLOW_WORKER_URL = new URL("../../workflow-script-worker.cjs", import.meta.url);
|
|
8
|
+
const WORKFLOW_PROCESS_URL = new URL("../../workflow-script-process.cjs", import.meta.url);
|
|
9
|
+
export class WorkflowScriptProcess extends EventEmitter {
|
|
10
|
+
child;
|
|
11
|
+
exitCode;
|
|
12
|
+
stopping = false;
|
|
13
|
+
stderr = "";
|
|
14
|
+
constructor(acornPath) {
|
|
15
|
+
super();
|
|
16
|
+
const acorn = realpathSync(acornPath);
|
|
17
|
+
this.child = fork(WORKFLOW_PROCESS_URL, [acorn], {
|
|
18
|
+
// Under --permission, Node lets worker threads read everything under the process cwd, so the cwd must
|
|
19
|
+
// hold only public files: acorn's own directory. It also never holds a caller's cwd open on Windows.
|
|
20
|
+
cwd: dirname(acorn),
|
|
21
|
+
// No inherited execArgv or NODE_OPTIONS. Only the supervisor may create a worker.
|
|
22
|
+
execArgv: [
|
|
23
|
+
"--permission", "--allow-worker",
|
|
24
|
+
`--allow-fs-read=${realpathSync(fileURLToPath(WORKFLOW_PROCESS_URL))}`,
|
|
25
|
+
`--allow-fs-read=${realpathSync(fileURLToPath(WORKFLOW_WORKER_URL))}`,
|
|
26
|
+
`--allow-fs-read=${acorn}`,
|
|
27
|
+
],
|
|
28
|
+
env: process.platform === "win32" && process.env.SystemRoot ? { SystemRoot: process.env.SystemRoot } : {},
|
|
29
|
+
stdio: ["ignore", "ignore", "pipe", "ipc"],
|
|
30
|
+
});
|
|
31
|
+
this.child.stderr.on("data", (chunk) => { this.stderr = (this.stderr + chunk.toString("utf8")).slice(-4096); });
|
|
32
|
+
this.child.on("error", (error) => this.emit("error", error));
|
|
33
|
+
this.child.on("message", (json) => {
|
|
34
|
+
if (this.stopping)
|
|
35
|
+
return;
|
|
36
|
+
try {
|
|
37
|
+
if (typeof json !== "string")
|
|
38
|
+
throw new Error("Workflow process sent a non-string IPC message.");
|
|
39
|
+
const message = JSON.parse(json);
|
|
40
|
+
if (!message || typeof message !== "object" || Array.isArray(message))
|
|
41
|
+
throw new Error("Workflow process sent an invalid IPC message.");
|
|
42
|
+
this.emit("message", message);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
this.emit("error", error);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
this.child.on("exit", (code) => {
|
|
49
|
+
this.exitCode = code ?? 1;
|
|
50
|
+
this.child.stderr.destroy();
|
|
51
|
+
if (!this.stopping && code !== 0 && this.stderr.trim())
|
|
52
|
+
this.emit("error", new Error(this.stderr.trim()));
|
|
53
|
+
this.emit("exit", this.exitCode);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
postMessage(message) {
|
|
57
|
+
if (this.stopping || !this.child.connected)
|
|
58
|
+
return;
|
|
59
|
+
this.child.send(JSON.stringify(message), (error) => {
|
|
60
|
+
if (error && !this.stopping)
|
|
61
|
+
this.emit("error", error);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async terminate() {
|
|
65
|
+
if (this.exitCode !== undefined)
|
|
66
|
+
return this.exitCode;
|
|
67
|
+
this.stopping = true;
|
|
68
|
+
return await new Promise((resolve) => {
|
|
69
|
+
this.once("exit", resolve);
|
|
70
|
+
this.child.kill("SIGKILL");
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function createWorkflowScriptWorker(acornPath) {
|
|
75
|
+
// Bun has no permission model. Keep its existing file worker; do not claim process isolation there.
|
|
76
|
+
return typeof process.versions.bun === "string"
|
|
77
|
+
? new Worker(WORKFLOW_WORKER_URL, { workerData: { acornPath } })
|
|
78
|
+
: new WorkflowScriptProcess(acornPath);
|
|
79
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { Worker } = require("node:worker_threads");
|
|
4
|
+
const { join } = require("node:path");
|
|
5
|
+
|
|
6
|
+
// Windows process creation adds a standard environment even when fork receives an empty one.
|
|
7
|
+
for (const key of Object.keys(process.env)) {
|
|
8
|
+
if (process.platform !== "win32" || key.toLowerCase() !== "systemroot") delete process.env[key];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Keep IPC on this thread: a busy workflow must not prevent parent-disconnect cleanup.
|
|
12
|
+
// The script thread has no worker permission; filesystem grants are inherited from the process.
|
|
13
|
+
const worker = new Worker(join(__dirname, "workflow-script-worker.cjs"), {
|
|
14
|
+
workerData: { acornPath: process.argv[2] },
|
|
15
|
+
execArgv: process.execArgv.filter((arg) => arg !== "--allow-worker"),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
function fail(error) {
|
|
19
|
+
if (!process.connected) return process.exit(1);
|
|
20
|
+
process.send(JSON.stringify({ type: "error", errorKind: "runtime", error: String(error?.message ?? error) }), () => process.exit(1));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
process.on("disconnect", () => process.exit(0));
|
|
24
|
+
process.on("message", (json) => {
|
|
25
|
+
try {
|
|
26
|
+
if (typeof json !== "string") throw new Error("Workflow process received a non-string IPC message.");
|
|
27
|
+
worker.postMessage(JSON.parse(json));
|
|
28
|
+
} catch (error) { fail(error); }
|
|
29
|
+
});
|
|
30
|
+
worker.on("message", (message) => {
|
|
31
|
+
try {
|
|
32
|
+
process.send(JSON.stringify(message), (error) => { if (error) process.exit(1); });
|
|
33
|
+
} catch (error) { fail(error); }
|
|
34
|
+
});
|
|
35
|
+
worker.on("error", fail);
|
|
36
|
+
worker.on("exit", (code) => fail(new Error(`Workflow script thread exited before returning a result (code ${code}).`)));
|
|
@@ -703,7 +703,10 @@ function describeGateAcceptanceConflict(gate, acceptance) {
|
|
|
703
703
|
}
|
|
704
704
|
|
|
705
705
|
function validateRunCall(key, params, label, fingerprints) {
|
|
706
|
-
if (typeof key !== "string" || !runKeyPattern.test(key))
|
|
706
|
+
if (typeof key !== "string" || !runKeyPattern.test(key)) {
|
|
707
|
+
const problem = key === undefined ? " has no key" : typeof key === "string" ? " has an invalid key '" + (key.length > 80 ? key.slice(0, 80) + "..." : key) + "'" : " has a key of type " + (key === null ? "null" : typeof key);
|
|
708
|
+
throw new Error(label + problem + "; keys must be 1-128 characters using letters, numbers, '.', '_' or '-', and start with a letter or number.");
|
|
709
|
+
}
|
|
707
710
|
if (hostKeys.has(key)) throw new Error("Workflow key '" + key + "' is already used by runs.host.");
|
|
708
711
|
if (!params || typeof params !== "object" || Array.isArray(params)) throw new Error(label + " requires a params object.");
|
|
709
712
|
if (Object.prototype.hasOwnProperty.call(params, "action") || Object.prototype.hasOwnProperty.call(params, "workflowScript") || Object.prototype.hasOwnProperty.call(params, "globalConcurrencyLimit") || Object.prototype.hasOwnProperty.call(params, "maxSubagentSpawnsPerRun") || Object.prototype.hasOwnProperty.call(params, "tasks") || Object.prototype.hasOwnProperty.call(params, "chain") || Object.prototype.hasOwnProperty.call(params, "parallel") || Object.prototype.hasOwnProperty.call(params, "concurrency") || Object.prototype.hasOwnProperty.call(params, "chainDir")) {
|