pi-subagents 0.84.0 → 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-235AWJUQ.js → chunk-3UZ5FVVJ.js} +310 -101
- package/bundle/{chunk-F4ASL6OV.js → chunk-7MAE3DJV.js} +1 -1
- package/bundle/{chunk-4E7BKDTX.js → chunk-CS4O36CZ.js} +11 -156
- package/bundle/{chunk-VQVVHSY6.js → chunk-DV2NCNPR.js} +22 -11
- package/bundle/{chunk-G2Z6ZH26.js → chunk-GCSLVFCX.js} +1 -1
- package/bundle/{chunk-2S4K53MV.js → chunk-H2NLFTC5.js} +1 -1
- package/bundle/{chunk-NKQ6JNAS.js → chunk-HFTBF7SG.js} +2 -1
- package/bundle/chunk-HXRB42AF.js +108 -0
- package/bundle/{chunk-7BWGNDNK.js → chunk-IQIWF2VX.js} +190 -1177
- package/bundle/{chunk-XDQORLZ5.js → chunk-JNXT3MPI.js} +15 -6
- package/bundle/{chunk-J5YL7LYR.js → chunk-JO67XSKD.js} +59 -27
- package/bundle/{chunk-JG4QKI5M.js → chunk-JWYG26RE.js} +209 -93
- 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-SSG7IEP5.js → chunk-RQAUNAWG.js} +2 -2
- 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-DZDETGRJ.js → chunk-WOVMHDES.js} +231 -182
- 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 +1 -1
- 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
|
@@ -10,22 +10,27 @@ import {
|
|
|
10
10
|
drainOutstandingWork,
|
|
11
11
|
evaluateChildToolDiagnostic,
|
|
12
12
|
formatWatchdogCwdSection,
|
|
13
|
-
registerNativeSupervisorClient,
|
|
14
13
|
registerWaitTool,
|
|
15
14
|
resolveCurrentSessionId,
|
|
16
15
|
resolveWatchdogReviewModel,
|
|
17
16
|
startWatchdogDiffBaselineCapture
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IQIWF2VX.js";
|
|
19
18
|
import {
|
|
20
|
-
MODEL_ONLY_TOOL,
|
|
21
19
|
agentStreamOptions,
|
|
22
20
|
opencodeSessionHeaders
|
|
23
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-LTPH2DXH.js";
|
|
22
|
+
import {
|
|
23
|
+
registerNativeSupervisorClient
|
|
24
|
+
} from "./chunk-T5V5BRCL.js";
|
|
25
|
+
import {
|
|
26
|
+
MODEL_ONLY_TOOL
|
|
27
|
+
} from "./chunk-HXRB42AF.js";
|
|
24
28
|
import {
|
|
25
29
|
inheritedNestedRouteOf
|
|
26
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-LGMILZNE.js";
|
|
27
31
|
import {
|
|
28
32
|
CHILD_WATCHDOG_STATUS_EVENT,
|
|
33
|
+
DEFAULT_WAIT_TOOL_NAME,
|
|
29
34
|
MISSING_STRUCTURED_ACCEPTANCE_REPORT_ERROR,
|
|
30
35
|
SUBAGENT_WATCHDOG_WARNING_TYPE,
|
|
31
36
|
appendPermissionAudit,
|
|
@@ -34,12 +39,14 @@ import {
|
|
|
34
39
|
getAgentDir,
|
|
35
40
|
permissionArgsPreview,
|
|
36
41
|
permissionDecision,
|
|
42
|
+
prepareStructuredOutputArguments,
|
|
43
|
+
setWaitToolName,
|
|
37
44
|
shouldBlockToolForBudget,
|
|
38
45
|
toolBudgetBlockedMessage,
|
|
39
46
|
toolBudgetSoftNudge,
|
|
40
47
|
validateAcceptanceReport,
|
|
41
48
|
validateStructuredOutputValue
|
|
42
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-UX4SCV5N.js";
|
|
43
50
|
import {
|
|
44
51
|
INTERCOM_SESSION_IDENTITY_EVENT
|
|
45
52
|
} from "./chunk-JEZOSEWG.js";
|
|
@@ -786,6 +793,7 @@ function registerStructuredOutputTool(pi, structured) {
|
|
|
786
793
|
label: "Structured Output",
|
|
787
794
|
description: "Submit the required final structured output for this subagent step. This terminates the step.",
|
|
788
795
|
parameters,
|
|
796
|
+
prepareArguments: (args) => prepareStructuredOutputArguments(structured.schema, args),
|
|
789
797
|
async execute(_id, params) {
|
|
790
798
|
const validation = await validateStructuredOutputValue(structured.schema, params.value);
|
|
791
799
|
if (validation.status === "invalid") {
|
|
@@ -839,6 +847,7 @@ function registerSubagentPromptRuntime(pi, config, drainObservation) {
|
|
|
839
847
|
} }
|
|
840
848
|
};
|
|
841
849
|
const nestedRootRunId = inheritedNestedRouteOf(config)?.rootRunId;
|
|
850
|
+
setWaitToolName(config.waitTool.name ?? DEFAULT_WAIT_TOOL_NAME);
|
|
842
851
|
if (typeof pi.registerTool === "function") registerWaitTool(pi, waitState, config.waitTool.enabled, void 0, config.waitTool.defaultTimeoutMs, { nestedRootRunId }, () => config.hasPendingSupervisorRequest?.() === true);
|
|
843
852
|
const supervisorMetadata = childSupervisorMetadata(config);
|
|
844
853
|
let nativeSupervisorClientRegistered = false;
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PLACED_RESTORE_UNSUPPORTED,
|
|
3
|
-
REX_BUNDLE_BIN,
|
|
4
|
-
REX_CALL_TIMEOUT_MS,
|
|
5
|
-
REX_EXIT_GONE,
|
|
6
|
-
REX_EXIT_UNREACHABLE,
|
|
7
|
-
REX_MAX_OUTPUT,
|
|
8
3
|
connectHerdrMachine,
|
|
9
|
-
isRexLocalMachine,
|
|
10
4
|
remoteShellCommand,
|
|
11
|
-
resolveRexBinary,
|
|
12
|
-
rexCommandEnv,
|
|
13
|
-
rexGlobalArgs,
|
|
14
5
|
runBoundedCommand,
|
|
15
6
|
sshMachineAccess
|
|
16
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-N7B2KD74.js";
|
|
17
8
|
import {
|
|
18
9
|
package_default
|
|
19
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HFTBF7SG.js";
|
|
11
|
+
import {
|
|
12
|
+
ensureSupervisorChannelDir
|
|
13
|
+
} from "./chunk-T5V5BRCL.js";
|
|
14
|
+
import "./chunk-HXRB42AF.js";
|
|
15
|
+
import "./chunk-NIXWDZZV.js";
|
|
20
16
|
import {
|
|
21
17
|
HERDR_PI_MODE_ENV,
|
|
22
18
|
HERDR_PI_PROTOCOL,
|
|
@@ -27,9 +23,18 @@ import {
|
|
|
27
23
|
validateHerdrPiRunId
|
|
28
24
|
} from "./chunk-4QFZZV3O.js";
|
|
29
25
|
import {
|
|
26
|
+
REX_BUNDLE_BIN,
|
|
27
|
+
REX_CALL_TIMEOUT_MS,
|
|
28
|
+
REX_EXIT_GONE,
|
|
29
|
+
REX_EXIT_UNREACHABLE,
|
|
30
|
+
REX_MAX_OUTPUT,
|
|
30
31
|
getAgentDir,
|
|
31
|
-
getPiSpawnCommand
|
|
32
|
-
|
|
32
|
+
getPiSpawnCommand,
|
|
33
|
+
isRexLocalMachine,
|
|
34
|
+
resolveRexBinary,
|
|
35
|
+
rexCommandEnv,
|
|
36
|
+
rexGlobalArgs
|
|
37
|
+
} from "./chunk-UX4SCV5N.js";
|
|
33
38
|
import "./chunk-JEZOSEWG.js";
|
|
34
39
|
import "./chunk-YFCK7H2S.js";
|
|
35
40
|
import "./chunk-QXASAHIA.js";
|
|
@@ -459,8 +464,18 @@ var herdrPaneHost = {
|
|
|
459
464
|
const { terminalId } = await startHerdrAgent(connection, owned, request.kind, request.name, request.args, options);
|
|
460
465
|
return { owned, terminalId };
|
|
461
466
|
},
|
|
462
|
-
async prompt(connection, identity, text) {
|
|
463
|
-
|
|
467
|
+
async prompt(connection, identity, text, options = {}) {
|
|
468
|
+
const clock = options.clock ?? { now: () => Date.now(), wait: (ms) => new Promise((resolve) => setTimeout(resolve, ms)) }, deadline = clock.now() + (options.timeoutMs ?? 5e3), pollMs = options.pollMs ?? 100;
|
|
469
|
+
for (; ; ) {
|
|
470
|
+
try {
|
|
471
|
+
await connection.client.call("agent.prompt", { target: identity.agentName, text });
|
|
472
|
+
return;
|
|
473
|
+
} catch (error) {
|
|
474
|
+
if (!(error instanceof Error) || !error.message.includes("is not an active named agent") || clock.now() >= deadline) throw error;
|
|
475
|
+
await clock.wait(Math.min(pollMs, deadline - clock.now()));
|
|
476
|
+
if (options.stopped?.()) throw new Error("Remote Pi prompt was not sent because the run was stopped.", { cause: error });
|
|
477
|
+
}
|
|
478
|
+
}
|
|
464
479
|
},
|
|
465
480
|
subscribe(connection, paneId, listener, onDisconnect) {
|
|
466
481
|
return connection.client.subscribe(herdrStatusSubscriptions(paneId), listener, onDisconnect);
|
|
@@ -964,6 +979,7 @@ var HerdrPiSession = class {
|
|
|
964
979
|
#reconnectFactory;
|
|
965
980
|
#reconnectFailure;
|
|
966
981
|
#replyTimer;
|
|
982
|
+
#repliesInFlight = /* @__PURE__ */ new Set();
|
|
967
983
|
supervisorDir;
|
|
968
984
|
runtime;
|
|
969
985
|
owner;
|
|
@@ -978,20 +994,35 @@ var HerdrPiSession = class {
|
|
|
978
994
|
this.#initialGit = initialGit;
|
|
979
995
|
bridge.adopt((frame) => this.#frame(frame));
|
|
980
996
|
if (this.supervisorDir) {
|
|
981
|
-
this.#replyTimer = setInterval(() =>
|
|
982
|
-
const replies = path5.join(this.supervisorDir, "replies");
|
|
983
|
-
for (const name of fs3.existsSync(replies) ? fs3.readdirSync(replies) : []) {
|
|
984
|
-
const file = path5.join(replies, name);
|
|
985
|
-
try {
|
|
986
|
-
const value = JSON.parse(fs3.readFileSync(file, "utf8"));
|
|
987
|
-
if (typeof value.message === "string" && typeof value.requestId === "string") void this.#operation("supervisor-reply", value.message, value.requestId, typeof value.error === "string" ? value.error : void 0).then(() => fs3.rmSync(file, { force: true }));
|
|
988
|
-
} catch {
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
}, 50);
|
|
997
|
+
this.#replyTimer = setInterval(() => this.#deliverSupervisorReplies(this.supervisorDir), 50);
|
|
992
998
|
this.#replyTimer.unref?.();
|
|
993
999
|
}
|
|
994
1000
|
}
|
|
1001
|
+
// Runs on a timer, where a throw or an unhandled rejection exits Pi. A reply that can't be read or delivered stays
|
|
1002
|
+
// on disk for the next tick, once its earlier delivery has settled; a lost transport reaches the session through the
|
|
1003
|
+
// bridge failure.
|
|
1004
|
+
#deliverSupervisorReplies(supervisorDir) {
|
|
1005
|
+
const replies = path5.join(supervisorDir, "replies");
|
|
1006
|
+
let names;
|
|
1007
|
+
try {
|
|
1008
|
+
names = fs3.existsSync(replies) ? fs3.readdirSync(replies) : [];
|
|
1009
|
+
} catch {
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
for (const name of names) {
|
|
1013
|
+
const file = path5.join(replies, name);
|
|
1014
|
+
if (this.#repliesInFlight.has(file)) continue;
|
|
1015
|
+
try {
|
|
1016
|
+
const value = JSON.parse(fs3.readFileSync(file, "utf8"));
|
|
1017
|
+
if (typeof value.message === "string" && typeof value.requestId === "string") {
|
|
1018
|
+
this.#repliesInFlight.add(file);
|
|
1019
|
+
void this.#operation("supervisor-reply", value.message, value.requestId, typeof value.error === "string" ? value.error : void 0).then(() => fs3.rmSync(file, { force: true })).catch(() => {
|
|
1020
|
+
}).finally(() => this.#repliesInFlight.delete(file));
|
|
1021
|
+
}
|
|
1022
|
+
} catch {
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
995
1026
|
get host() {
|
|
996
1027
|
return this.owner.host;
|
|
997
1028
|
}
|
|
@@ -1102,6 +1133,7 @@ var HerdrPiSession = class {
|
|
|
1102
1133
|
const createdAt = Date.now();
|
|
1103
1134
|
const file = path5.join(this.supervisorDir, "requests", `${path5.basename(frame.requestId)}.json`);
|
|
1104
1135
|
const request = { type: "subagent.supervisor.request", id: frame.requestId, createdAt, ...reason !== "progress_update" ? { expiresAt: createdAt + 10 * 6e4 } : {}, reason, message: typeof frame.message === "string" ? frame.message : "", ...frame.interview && typeof frame.interview === "object" ? { interview: frame.interview } : {}, expectsReply: reason !== "progress_update", runId: this.runtime.runId ?? this.identity.runId, agent: this.runtime.agent ?? "remote", childIndex: this.runtime.childIndex ?? 0, orchestratorSessionId: this.runtime.orchestratorSessionId };
|
|
1136
|
+
ensureSupervisorChannelDir(this.supervisorDir);
|
|
1105
1137
|
try {
|
|
1106
1138
|
fs3.writeFileSync(file, JSON.stringify(request), { mode: 384, flag: "wx" });
|
|
1107
1139
|
} catch (error) {
|
|
@@ -1117,7 +1149,7 @@ var HerdrPiSession = class {
|
|
|
1117
1149
|
if (operation === "prompt") completion = new Promise((resolve, reject) => this.#operations.set(requestId, { resolve, reject, accepted: false, settled: false }));
|
|
1118
1150
|
try {
|
|
1119
1151
|
await Promise.race([this.bridge.prepare(requestId, operation, text, supervisorId, supervisorError), this.bridge.failure]);
|
|
1120
|
-
await this.host.prompt(this.connection, this.identity, `/pi-subagents-bridge ${requestId}
|
|
1152
|
+
await this.host.prompt(this.connection, this.identity, `/pi-subagents-bridge ${requestId}`, operation === "abort" ? {} : { stopped: () => this.#aborted || this.#disposed });
|
|
1121
1153
|
await completion;
|
|
1122
1154
|
} catch (error) {
|
|
1123
1155
|
if (operation === "prompt" && this.bridge.failed) {
|