pi-subagents 0.87.0 → 0.88.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 +32 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/{chunk-3CVOAS77.js → chunk-2DIEL4WG.js} +2 -2
- package/bundle/{chunk-PGU4TZV3.js → chunk-3DT5X2QC.js} +406 -447
- package/bundle/{chunk-SIAQXPJ4.js → chunk-3MFYKBKI.js} +18 -6
- package/bundle/{chunk-AIL46SZU.js → chunk-47GJDBIK.js} +6 -4
- package/bundle/{chunk-ESWW6XSX.js → chunk-47ZN7NKR.js} +1 -1
- package/bundle/{chunk-C3KWLXDH.js → chunk-4MVDMA5C.js} +9 -1
- package/bundle/{chunk-DGTZKYIE.js → chunk-4PM6RDE5.js} +42 -29
- package/bundle/{chunk-EYGBK6CE.js → chunk-4UGWHREQ.js} +45 -15
- package/bundle/{chunk-HDICKROY.js → chunk-6EUQPQY7.js} +31 -14
- package/bundle/{chunk-LFKMM3UH.js → chunk-6OWNDN7R.js} +2 -2
- package/bundle/{chunk-M2VBGET6.js → chunk-6PR44R7E.js} +7 -2
- package/bundle/{chunk-OOE3R7IQ.js → chunk-CKLZ5FGU.js} +2 -2
- package/bundle/{chunk-W52LJANO.js → chunk-CYKNHFXB.js} +1 -1
- package/bundle/{chunk-6O7YH2QV.js → chunk-GDR2ILWY.js} +1 -1
- package/bundle/{chunk-2D2DQGC2.js → chunk-IZEKQEY4.js} +9 -9
- package/bundle/{chunk-C5QWQSSM.js → chunk-KXW62VBU.js} +1 -1
- package/bundle/{chunk-BFF6YDK6.js → chunk-L4YY2TOE.js} +1 -1
- package/bundle/{chunk-JLDQ6YUR.js → chunk-MTPICU4A.js} +11 -11
- package/bundle/{chunk-YEXKJJVS.js → chunk-PJSOS2Q4.js} +4 -4
- package/bundle/{chunk-2NY5PCKQ.js → chunk-RHYVKQQL.js} +4 -4
- package/bundle/{chunk-XV7RTWTS.js → chunk-SVIXQDIV.js} +20 -5
- package/bundle/{chunk-OTLDAYEQ.js → chunk-UVDLJXL6.js} +14 -5
- package/bundle/{chunk-VFUFOZBU.js → chunk-W6HIYD2Z.js} +1 -1
- package/bundle/{chunk-OZCPYJEY.js → chunk-XAOHLFJO.js} +118 -42
- package/bundle/{chunk-USRX7QXD.js → chunk-XIA5GSEU.js} +2 -2
- package/bundle/chunk-YDZ7BZD5.js +523 -0
- package/bundle/{chunk-LZKVUWIY.js → chunk-YZPVALSQ.js} +30 -5
- 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 +1 -1
- package/docs/configuration.md +7 -3
- package/docs/observability.md +2 -0
- package/docs/tool-reference.md +4 -1
- package/package.json +2 -2
- package/skills/pi-subagents/SKILL.md +8 -2
- package/src/agents/agent-management.d.ts +1 -0
- package/src/agents/agent-management.js +12 -4
- package/src/agents/agents.d.ts +1 -0
- package/src/agents/agents.js +2 -2
- package/src/extension/config.d.ts +1 -0
- package/src/extension/config.js +6 -0
- package/src/extension/index.js +4 -3
- package/src/extension/schemas.d.ts +2 -0
- package/src/extension/schemas.js +1 -0
- package/src/extension/tool-activation.js +20 -3
- package/src/runs/background/async-resume.js +2 -1
- package/src/runs/background/async-retention.d.ts +0 -2
- package/src/runs/background/async-retention.js +11 -5
- package/src/runs/background/async-status.d.ts +2 -0
- package/src/runs/background/async-status.js +4 -0
- package/src/runs/background/run-child-session.d.ts +2 -2
- package/src/runs/background/run-child-session.js +4 -7
- package/src/runs/background/steering.d.ts +2 -11
- package/src/runs/background/steering.js +11 -6
- package/src/runs/background/subagent-runner.d.ts +0 -2
- package/src/runs/background/subagent-runner.js +73 -58
- package/src/runs/foreground/async-steering-action.js +24 -9
- package/src/runs/foreground/execution.js +32 -15
- package/src/runs/foreground/prompt-audit.js +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +1 -8
- package/src/runs/foreground/subagent-executor.js +6 -15
- package/src/runs/shared/async-status-projection.d.ts +2 -0
- package/src/runs/shared/async-status-projection.js +10 -0
- package/src/runs/shared/child-session.js +21 -3
- package/src/runs/shared/mcp-config-sources.d.ts +2 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -2
- package/src/runs/shared/mcp-direct-tool-allowlist.js +21 -11
- package/src/runs/shared/subagent-prompt-runtime.js +14 -2
- package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
- package/src/runs/shared/supervisor-wait-timer.js +61 -0
- package/src/shared/artifacts.d.ts +1 -0
- package/src/shared/artifacts.js +107 -9
- package/src/shared/reported-progress.d.ts +1 -0
- package/src/shared/reported-progress.js +12 -0
- package/src/shared/status-format.d.ts +1 -0
- package/src/shared/status-format.js +1 -1
- package/src/shared/types.d.ts +9 -0
- package/src/shared/utils.d.ts +3 -1
- package/src/shared/utils.js +4 -0
- package/src/tui/render.js +33 -2
- package/src/watchdog/permission-arbiter.js +1 -0
- package/src/watchdog/review.d.ts +0 -5
- package/src/watchdog/review.js +2 -1
- package/src/workflows/workflow-script-worker.js +3 -1
- package/bundle/chunk-XSDYTXHF.js +0 -242
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isTrustedRecordedSessionFile,
|
|
3
3
|
resolveSubagentRunId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RHYVKQQL.js";
|
|
5
5
|
import {
|
|
6
6
|
agentStreamOptions,
|
|
7
7
|
opencodeSessionHeaders,
|
|
8
8
|
resolveAsyncResumeTarget
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SVIXQDIV.js";
|
|
10
10
|
import {
|
|
11
11
|
ownsRun
|
|
12
12
|
} from "./chunk-HXRB42AF.js";
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
reconcileAsyncRun,
|
|
19
19
|
resolveAuthorityDecision,
|
|
20
20
|
resolveMissionStoreLocation
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3DT5X2QC.js";
|
|
22
22
|
import {
|
|
23
23
|
deliverInterruptRequest,
|
|
24
24
|
queueRevivalBrief,
|
|
25
25
|
requestAsyncSteer
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-W6HIYD2Z.js";
|
|
27
27
|
import {
|
|
28
28
|
formatShellCommand
|
|
29
29
|
} from "./chunk-7J4ZXMY7.js";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
tryLease,
|
|
35
35
|
writeAtomicJson,
|
|
36
36
|
writePrivateAtomicJson
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4MVDMA5C.js";
|
|
38
38
|
import {
|
|
39
39
|
DIRS
|
|
40
40
|
} from "./chunk-JEZOSEWG.js";
|
|
@@ -76,7 +76,7 @@ function recordSteeringRequest(status, input) {
|
|
|
76
76
|
requestedAt: input.requestedAt,
|
|
77
77
|
...input.source ? { source: input.source } : {},
|
|
78
78
|
messagePreview: steeringMessagePreview(input.message),
|
|
79
|
-
targets: input.targets.map((target) => ({ index: target.index, state: target.state, ...target.reason ? { reason: target.reason } : {} }))
|
|
79
|
+
targets: input.targets.map((target) => ({ index: target.index, state: target.state, ...target.reason ? { reason: target.reason } : {}, ...target.failureKind ? { failureKind: target.failureKind } : {} }))
|
|
80
80
|
};
|
|
81
81
|
status.requested++;
|
|
82
82
|
status.lastRequestedAt = input.requestedAt;
|
|
@@ -95,6 +95,8 @@ function updateSteeringTarget(status, requestId, index, state, now, fields = {})
|
|
|
95
95
|
const request = status.recent.find((candidate) => candidate.id === requestId);
|
|
96
96
|
const target = request?.targets.find((candidate) => candidate.index === index);
|
|
97
97
|
if (!target) return void 0;
|
|
98
|
+
if (state !== "failed") delete target.failureKind;
|
|
99
|
+
else if (fields.failureKind) target.failureKind = fields.failureKind;
|
|
98
100
|
if (state === "late" && target.state === "recovered") {
|
|
99
101
|
if (target.lateDeliveredAt === void 0) {
|
|
100
102
|
target.lateDeliveredAt = now;
|
|
@@ -144,6 +146,7 @@ function actionResultFromSteeringStatus(status, sourceRunId, requestId, replacem
|
|
|
144
146
|
...target.deliveredAt !== void 0 ? { deliveredAt: target.deliveredAt } : {},
|
|
145
147
|
...target.lateDeliveredAt !== void 0 ? { lateDeliveredAt: target.lateDeliveredAt } : {},
|
|
146
148
|
...target.reason ? { reason: target.reason } : {},
|
|
149
|
+
...target.failureKind ? { failureKind: target.failureKind } : {},
|
|
147
150
|
...target.replacementRunId ? { replacementRunId: target.replacementRunId } : {}
|
|
148
151
|
}));
|
|
149
152
|
const states = targets.map((target) => target.state);
|
|
@@ -240,6 +243,9 @@ function steerTargetsAccepted(result2) {
|
|
|
240
243
|
const targets = result2?.targets ?? [];
|
|
241
244
|
return targets.length > 0 && targets.every((target) => target.state === "queued" || target.state === "delivered");
|
|
242
245
|
}
|
|
246
|
+
function steerTargetsRejected(result2) {
|
|
247
|
+
return result2?.targets.some((target) => target.state === "failed" && target.failureKind === "rejected") === true;
|
|
248
|
+
}
|
|
243
249
|
function canQueueRetainedAsyncFollowUp(status, index) {
|
|
244
250
|
const steps = status.steps ?? [];
|
|
245
251
|
return status.state === "complete" && Boolean(status.parentWorkflowRunId) && steps.length === 1 && (steps[0]?.status === "complete" || steps[0]?.status === "completed") && Boolean(steps[0]?.sessionFile ?? status.sessionFile) && (index === void 0 || index === 0);
|
|
@@ -377,8 +383,10 @@ ${replies}` }],
|
|
|
377
383
|
if (input.signal?.aborted) {
|
|
378
384
|
return { content: [{ type: "text", text: steeringReceipt(input.message, `Steering pending for async run ${status.runId} (request ${requestId}); caller aborted before recovery.`) }], details: { mode: "management", results: [], steering: result2 } };
|
|
379
385
|
}
|
|
386
|
+
const projected = (current) => current?.steering ? actionResultFromSteeringStatus(current.steering, status.runId, requestId) : void 0;
|
|
387
|
+
const rejected = () => new Error(`Child rejected the guidance; continue it with action "resume" and id "${status.runId}".`);
|
|
380
388
|
const finalStatus = readStatus(asyncDir);
|
|
381
|
-
const finalResult =
|
|
389
|
+
const finalResult = projected(finalStatus);
|
|
382
390
|
const acceptedReply = (accepted) => {
|
|
383
391
|
const acceptedState = accepted.state === "delivered" ? "delivered" : "queued";
|
|
384
392
|
return { content: [{ type: "text", text: steeringReceipt(input.message, `Steering ${acceptedState} for async run ${status.runId} (request ${requestId}).`) }], details: { mode: "management", results: [], steering: accepted } };
|
|
@@ -386,7 +394,7 @@ ${replies}` }],
|
|
|
386
394
|
if (finalResult && steerTargetsAccepted(finalResult)) return acceptedReply(finalResult);
|
|
387
395
|
const running = (finalStatus?.steps ?? status.steps ?? []).filter((step) => step.status === "running");
|
|
388
396
|
const recoveryAllowed = (input.mode ?? "steer") === "steer" && status.mode === "single" && status.isNested !== true && running.length === 1 && Boolean(finalStatus?.steering) && (input.index === void 0 || input.index === 0);
|
|
389
|
-
if (recoveryAllowed && finalResult?.state !== "scheduled" && input.recover) {
|
|
397
|
+
if (recoveryAllowed && finalResult?.state !== "scheduled" && !steerTargetsRejected(finalResult) && input.recover) {
|
|
390
398
|
const appendSteeringNotice = (state, message) => {
|
|
391
399
|
try {
|
|
392
400
|
fs2.appendFileSync(path2.join(asyncDir, "events.jsonl"), `${JSON.stringify({ type: "subagent.steering.notice", ts: Date.now(), runId: status.runId, requestId, state, message, ...status.sessionId ? { currentSessionId: status.sessionId } : {} })}
|
|
@@ -395,18 +403,18 @@ ${replies}` }],
|
|
|
395
403
|
}
|
|
396
404
|
};
|
|
397
405
|
try {
|
|
398
|
-
const
|
|
399
|
-
const latestResult = latest?.steering ? actionResultFromSteeringStatus(latest.steering, status.runId, requestId) : void 0;
|
|
406
|
+
const latestResult = projected(readStatus(asyncDir));
|
|
400
407
|
if (latestResult && steerTargetsAccepted(latestResult)) return acceptedReply(latestResult);
|
|
408
|
+
if (steerTargetsRejected(latestResult)) throw rejected();
|
|
401
409
|
const committedAt = Date.now();
|
|
402
410
|
input.onBeforeRecoveryClaim?.(requestId, committedAt);
|
|
403
411
|
const { claimPath, markerPath } = claimSteeringRecovery(asyncDir, { requestId, sourceRunId: status.runId, committedAt });
|
|
404
412
|
input.onRecoveryCommitted?.(requestId, committedAt);
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
if (preCommitResult && preCommitResult.targets.length > 0 && preCommitResult.targets.every((target) => target.state === "queued" || target.deliveredAt !== void 0 && target.deliveredAt <= committedAt)) {
|
|
413
|
+
const preCommitResult = projected(readStatus(asyncDir));
|
|
414
|
+
if (preCommitResult && (steerTargetsRejected(preCommitResult) || preCommitResult.targets.length > 0 && preCommitResult.targets.every((target) => target.state === "queued" || target.deliveredAt !== void 0 && target.deliveredAt <= committedAt))) {
|
|
408
415
|
fs2.rmSync(markerPath, { force: true });
|
|
409
416
|
fs2.rmSync(claimPath, { force: true });
|
|
417
|
+
if (steerTargetsRejected(preCommitResult)) throw rejected();
|
|
410
418
|
return acceptedReply(preCommitResult);
|
|
411
419
|
}
|
|
412
420
|
try {
|
|
@@ -424,6 +432,10 @@ ${replies}` }],
|
|
|
424
432
|
if (input.signal?.aborted) break;
|
|
425
433
|
const candidate = readStatus(asyncDir);
|
|
426
434
|
lastObservedState = candidate?.state;
|
|
435
|
+
if (steerTargetsRejected(projected(candidate))) {
|
|
436
|
+
fs2.rmSync(claimPath, { force: true });
|
|
437
|
+
throw rejected();
|
|
438
|
+
}
|
|
427
439
|
if (candidate?.state === "paused" && candidate.endedAt !== void 0) {
|
|
428
440
|
paused = candidate;
|
|
429
441
|
break;
|
|
@@ -447,6 +459,10 @@ ${replies}` }],
|
|
|
447
459
|
if (recoveryTarget.kind !== "revive" || !recoveryTarget.sessionFile) throw new Error("Source run has no valid persisted child session; it remains paused and requires a new run.");
|
|
448
460
|
if (!recoveryTarget.recoveryDescriptor) throw new Error("Source run has no private recovery descriptor; it remains paused and is not safely resumable.");
|
|
449
461
|
const limits = remainingSteeringRecoveryLimits(recoveryTarget.recoveryDescriptor, paused);
|
|
462
|
+
if (steerTargetsRejected(projected(readStatus(asyncDir)))) {
|
|
463
|
+
fs2.rmSync(claimPath, { force: true });
|
|
464
|
+
throw rejected();
|
|
465
|
+
}
|
|
450
466
|
const revived = await input.recover(limits);
|
|
451
467
|
if (revived.isError || !revived.details.asyncId) throw new Error(revived.content[0]?.type === "text" ? revived.content[0].text : "Replacement launch failed; source run remains paused.");
|
|
452
468
|
const targetIndex = input.index ?? paused.steering?.recent.find((request) => request.id === requestId)?.targets[0]?.index ?? status.steps?.findIndex((step) => step.status === "running") ?? -1;
|
|
@@ -470,7 +486,7 @@ ${replies}` }],
|
|
|
470
486
|
failedStatus.activityState = "needs_attention";
|
|
471
487
|
writeAtomicJson(path2.join(asyncDir, "status.json"), failedStatus);
|
|
472
488
|
}
|
|
473
|
-
const failed =
|
|
489
|
+
const failed = projected(failedStatus);
|
|
474
490
|
appendSteeringNotice("failed", `Steering failed for run ${status.runId}: ${reason}`);
|
|
475
491
|
return { content: [{ type: "text", text: steeringReceipt(input.message, `Steering failed for async run ${status.runId} (request ${requestId}): ${reason}`) }], isError: true, details: { mode: "management", results: [], steering: failed ?? { requestId, state: "failed", sourceRunId: status.runId, deliveryStatus: "queued", targets: [{ index: input.index ?? 0, state: "failed", reason }] } } };
|
|
476
492
|
}
|
|
@@ -1085,6 +1101,7 @@ async function rewritePromptWithGuidance(input) {
|
|
|
1085
1101
|
});
|
|
1086
1102
|
const ctxThinking = input.ctx.getThinkingLevel?.();
|
|
1087
1103
|
const agent = new Agent({
|
|
1104
|
+
sessionId,
|
|
1088
1105
|
initialState: {
|
|
1089
1106
|
systemPrompt: [
|
|
1090
1107
|
"Rewrite one subagent authored task from Prompt Audit context.",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appendAgentRefinementOverlay
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XIA5GSEU.js";
|
|
4
4
|
import {
|
|
5
5
|
buildAgentMemoryInjection,
|
|
6
6
|
buildSkillInjection
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4MVDMA5C.js";
|
|
8
8
|
|
|
9
9
|
// src/runs/shared/effective-system-prompt.ts
|
|
10
10
|
function appendSection(prompt, section) {
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
validateAuthorityPolicy,
|
|
12
12
|
validateMissionStoreConfig,
|
|
13
13
|
validateModelResponseAliases
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3DT5X2QC.js";
|
|
15
15
|
import {
|
|
16
16
|
getAgentDir,
|
|
17
17
|
readStatus,
|
|
18
18
|
validatePermissionConfig,
|
|
19
19
|
writePrivateAtomicJson
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-4MVDMA5C.js";
|
|
21
21
|
import {
|
|
22
22
|
FLEET_KEYBINDING_ACTIONS,
|
|
23
23
|
RUNNER_LAUNCHER_NAME_PATTERN,
|
|
@@ -702,6 +702,10 @@ function validateConfig(config) {
|
|
|
702
702
|
validateOrcaProgressTabsConfig(config.orcaProgressTabs);
|
|
703
703
|
validateRunnerLaunchersConfig(config.runnerLaunchers);
|
|
704
704
|
}
|
|
705
|
+
function resolveConfigDefaultTimeoutMs(raw) {
|
|
706
|
+
if (typeof raw !== "number" || !Number.isInteger(raw) || raw <= 0 || raw > 2147483647) return void 0;
|
|
707
|
+
return raw;
|
|
708
|
+
}
|
|
705
709
|
function getConfigPath() {
|
|
706
710
|
return path2.join(getAgentDir(), "extensions", "subagent", "config.json");
|
|
707
711
|
}
|
|
@@ -747,6 +751,7 @@ export {
|
|
|
747
751
|
acquireActiveAsyncCapacity,
|
|
748
752
|
transferActiveAsyncCapacity,
|
|
749
753
|
resolveScheduledStoreRoot,
|
|
754
|
+
resolveConfigDefaultTimeoutMs,
|
|
750
755
|
resolveAsyncByDefault,
|
|
751
756
|
loadConfig
|
|
752
757
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "pi-subagents",
|
|
4
|
-
version: "0.
|
|
4
|
+
version: "0.88.0",
|
|
5
5
|
private: true,
|
|
6
6
|
description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
|
|
7
7
|
author: "Nico Bailon",
|
|
@@ -108,7 +108,7 @@ var package_default = {
|
|
|
108
108
|
"@js-temporal/polyfill": "0.5.1",
|
|
109
109
|
acorn: "8.18.0",
|
|
110
110
|
jiti: "2.7.0",
|
|
111
|
-
undici: "8.12.
|
|
111
|
+
undici: "8.12.4",
|
|
112
112
|
yaml: "2.8.3"
|
|
113
113
|
},
|
|
114
114
|
devDependencies: {
|
|
@@ -7,37 +7,37 @@ import {
|
|
|
7
7
|
safeTranscriptEvent,
|
|
8
8
|
steerAsyncRun,
|
|
9
9
|
steerWorkflowForegroundTarget
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6EUQPQY7.js";
|
|
11
11
|
import {
|
|
12
12
|
FLEET_STATUS_WIDGET_KEY,
|
|
13
13
|
runningTone,
|
|
14
14
|
stepTaskSummary
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YZPVALSQ.js";
|
|
16
16
|
import {
|
|
17
17
|
foregroundChildStateLabel,
|
|
18
18
|
formatAsyncRunTranscript,
|
|
19
19
|
stopAsyncRun
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-RHYVKQQL.js";
|
|
21
21
|
import {
|
|
22
22
|
contextModeBadge,
|
|
23
23
|
contextModeLabel,
|
|
24
24
|
decodeUtf8Tail,
|
|
25
25
|
listAsyncRuns
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SVIXQDIV.js";
|
|
27
27
|
import {
|
|
28
28
|
reportSessionWarning
|
|
29
29
|
} from "./chunk-HXRB42AF.js";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-3DT5X2QC.js";
|
|
31
|
+
import "./chunk-W6HIYD2Z.js";
|
|
32
32
|
import "./chunk-NIXWDZZV.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-47ZN7NKR.js";
|
|
34
34
|
import "./chunk-7F6RKT6W.js";
|
|
35
35
|
import "./chunk-CTPAE36Y.js";
|
|
36
36
|
import "./chunk-7J4ZXMY7.js";
|
|
37
37
|
import {
|
|
38
38
|
getArtifactPaths,
|
|
39
39
|
getArtifactsDir
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-YDZ7BZD5.js";
|
|
41
41
|
import {
|
|
42
42
|
snapshotExternalRuns
|
|
43
43
|
} from "./chunk-UKG4V45O.js";
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
formatTokens,
|
|
50
50
|
readStatus,
|
|
51
51
|
shortenPath
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-4MVDMA5C.js";
|
|
53
53
|
import {
|
|
54
54
|
DIRS
|
|
55
55
|
} from "./chunk-JEZOSEWG.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
validateCodeOwnedProfileRunner,
|
|
9
9
|
validatePermissionRules,
|
|
10
10
|
validateToolBudgetConfig
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4MVDMA5C.js";
|
|
12
12
|
|
|
13
13
|
// src/agents/runtime-agent-registry.ts
|
|
14
14
|
var RUNTIME_AGENT_REGISTRY_KEY = "pi-subagents.runtime-agents.v1";
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rewriteSubagentPrompt
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UVDLJXL6.js";
|
|
4
4
|
import {
|
|
5
5
|
package_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CKLZ5FGU.js";
|
|
7
7
|
import {
|
|
8
8
|
WATCHDOG_DIFF_TOOL_NAME,
|
|
9
9
|
captureWatchdogDiffBaseline,
|
|
10
10
|
createWatchdogDiffTool
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-47GJDBIK.js";
|
|
12
|
+
import "./chunk-SVIXQDIV.js";
|
|
13
|
+
import "./chunk-CYKNHFXB.js";
|
|
14
14
|
import {
|
|
15
15
|
MODEL_ONLY_TOOL
|
|
16
16
|
} from "./chunk-HXRB42AF.js";
|
|
17
17
|
import "./chunk-W2BZS6UC.js";
|
|
18
18
|
import {
|
|
19
19
|
appendAgentRefinementOverlay
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-XIA5GSEU.js";
|
|
21
|
+
import "./chunk-3DT5X2QC.js";
|
|
22
22
|
import "./chunk-NIXWDZZV.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-47ZN7NKR.js";
|
|
24
24
|
import "./chunk-7F6RKT6W.js";
|
|
25
25
|
import {
|
|
26
26
|
assertNoToolModifierEntries
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-3MFYKBKI.js";
|
|
28
28
|
import "./chunk-CTPAE36Y.js";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-YDZ7BZD5.js";
|
|
30
30
|
import {
|
|
31
31
|
HERDR_PI_MAX_FRAME_BYTES,
|
|
32
32
|
HERDR_PI_PROTOCOL,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
discoverAgents,
|
|
44
44
|
resolveExistingReadPaths,
|
|
45
45
|
resolveSkills
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-4MVDMA5C.js";
|
|
47
47
|
import "./chunk-JEZOSEWG.js";
|
|
48
48
|
import "./chunk-YFCK7H2S.js";
|
|
49
49
|
import "./chunk-QXASAHIA.js";
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
remoteShellCommand,
|
|
5
5
|
runBoundedCommand,
|
|
6
6
|
sshMachineAccess
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GDR2ILWY.js";
|
|
8
8
|
import {
|
|
9
9
|
package_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CKLZ5FGU.js";
|
|
11
11
|
import {
|
|
12
12
|
ensureSupervisorChannelDir
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CYKNHFXB.js";
|
|
14
14
|
import "./chunk-HXRB42AF.js";
|
|
15
15
|
import "./chunk-NIXWDZZV.js";
|
|
16
16
|
import {
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
resolveRexBinary,
|
|
35
35
|
rexCommandEnv,
|
|
36
36
|
rexGlobalArgs
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4MVDMA5C.js";
|
|
38
38
|
import "./chunk-JEZOSEWG.js";
|
|
39
39
|
import "./chunk-YFCK7H2S.js";
|
|
40
40
|
import "./chunk-QXASAHIA.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
summarizeContextModes,
|
|
13
13
|
utf8Tail,
|
|
14
14
|
workflowPreflightLaneForRuntimeKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SVIXQDIV.js";
|
|
16
16
|
import {
|
|
17
17
|
ownsRun
|
|
18
18
|
} from "./chunk-HXRB42AF.js";
|
|
@@ -34,11 +34,11 @@ import {
|
|
|
34
34
|
updateActiveRunIndex,
|
|
35
35
|
validateModelResponseAliases,
|
|
36
36
|
writeAsyncResultFile
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-3DT5X2QC.js";
|
|
38
38
|
import {
|
|
39
39
|
deliverStopRequest,
|
|
40
40
|
stopInboxClosedPath
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-W6HIYD2Z.js";
|
|
42
42
|
import {
|
|
43
43
|
SUBAGENT_STOPPED_MESSAGE,
|
|
44
44
|
formatDuration,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
waitToolName,
|
|
51
51
|
writeAtomicJson,
|
|
52
52
|
writePrivateAtomicJson
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-4MVDMA5C.js";
|
|
54
54
|
import {
|
|
55
55
|
DIRS
|
|
56
56
|
} from "./chunk-JEZOSEWG.js";
|
|
@@ -46,16 +46,19 @@ import {
|
|
|
46
46
|
validateModelResponseAliases,
|
|
47
47
|
withWorkflowChildRunModel,
|
|
48
48
|
withWorktreeTransaction
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-3DT5X2QC.js";
|
|
50
50
|
import {
|
|
51
51
|
validateIntercomBridgeConfig
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-47ZN7NKR.js";
|
|
53
53
|
import {
|
|
54
54
|
stableJsonDigest
|
|
55
55
|
} from "./chunk-7F6RKT6W.js";
|
|
56
56
|
import {
|
|
57
57
|
snapshotRequiredChildExtensions
|
|
58
58
|
} from "./chunk-CTPAE36Y.js";
|
|
59
|
+
import {
|
|
60
|
+
missingForkCopyNote
|
|
61
|
+
} from "./chunk-YDZ7BZD5.js";
|
|
59
62
|
import {
|
|
60
63
|
DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
|
|
61
64
|
assertWorkflowLaneKey,
|
|
@@ -80,7 +83,7 @@ import {
|
|
|
80
83
|
validateToolBudgetConfig,
|
|
81
84
|
waitForFileSystemRetry,
|
|
82
85
|
writeAtomicJson
|
|
83
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-4MVDMA5C.js";
|
|
84
87
|
import {
|
|
85
88
|
DIRS,
|
|
86
89
|
RUNNER_LAUNCHER_NAME_PATTERN,
|
|
@@ -1241,6 +1244,8 @@ function projectStep(step, index, depth, ctx) {
|
|
|
1241
1244
|
const activity = activityFor(step, ctx);
|
|
1242
1245
|
const { id, label } = stepIdentity(step, index, ctx);
|
|
1243
1246
|
const agent = publicOptionalText(step.agent, ctx.caps.maxStringLength);
|
|
1247
|
+
const progressText = publicOptionalText(step.progressText, ctx.caps.maxStringLength);
|
|
1248
|
+
const progressUpdatedAt = publicTime(step.progressUpdatedAt);
|
|
1244
1249
|
const node = {
|
|
1245
1250
|
id,
|
|
1246
1251
|
kind: "step",
|
|
@@ -1249,7 +1254,9 @@ function projectStep(step, index, depth, ctx) {
|
|
|
1249
1254
|
...startedAt !== void 0 ? { startedAt } : {},
|
|
1250
1255
|
...updatedAt !== void 0 ? { updatedAt } : {},
|
|
1251
1256
|
...terminalState(state) && endedAt !== void 0 ? { endedAt } : {},
|
|
1252
|
-
...activity ? { activity } : {}
|
|
1257
|
+
...activity ? { activity } : {},
|
|
1258
|
+
...progressText ? { progressText } : {},
|
|
1259
|
+
...progressUpdatedAt !== void 0 ? { progressUpdatedAt } : {}
|
|
1253
1260
|
};
|
|
1254
1261
|
if (agent) node.agent = agent;
|
|
1255
1262
|
setStepModel(node, ctx, step);
|
|
@@ -1392,6 +1399,10 @@ function projectMaterializedStep(step, index, child, depth, ctx, childrenByParen
|
|
|
1392
1399
|
const selfActivity = selfStep ? activityFor(selfStep, ctx) : void 0;
|
|
1393
1400
|
const activity = laneActivity || selfActivity || live.activity ? { ...laneActivity, ...selfActivity, ...live.activity } : void 0;
|
|
1394
1401
|
const node = { ...live, id, kind: "step", label };
|
|
1402
|
+
const progressText = publicOptionalText(selfStep?.progressText ?? step.progressText, ctx.caps.maxStringLength);
|
|
1403
|
+
const progressUpdatedAt = publicTime(selfStep?.progressUpdatedAt ?? step.progressUpdatedAt);
|
|
1404
|
+
if (progressText) node.progressText = progressText;
|
|
1405
|
+
if (progressUpdatedAt !== void 0) node.progressUpdatedAt = progressUpdatedAt;
|
|
1395
1406
|
const agent = publicOptionalText(selfStep?.agent || step.agent, ctx.caps.maxStringLength);
|
|
1396
1407
|
if (agent) node.agent = agent;
|
|
1397
1408
|
if (activity) node.activity = activity;
|
|
@@ -2291,6 +2302,8 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
|
|
|
2291
2302
|
...step.currentPath ? { currentPath: step.currentPath } : {},
|
|
2292
2303
|
...step.recentTools ? { recentTools: step.recentTools.map((tool) => ({ ...tool })) } : {},
|
|
2293
2304
|
...step.recentOutput ? { recentOutput: [...step.recentOutput] } : {},
|
|
2305
|
+
...step.progressText ? { progressText: step.progressText } : {},
|
|
2306
|
+
...step.progressUpdatedAt !== void 0 ? { progressUpdatedAt: step.progressUpdatedAt } : {},
|
|
2294
2307
|
...step.turnCount !== void 0 ? { turnCount: step.turnCount } : {},
|
|
2295
2308
|
...step.toolCount !== void 0 ? { toolCount: step.toolCount } : {},
|
|
2296
2309
|
...step.steering ? { steering: step.steering } : {},
|
|
@@ -2556,6 +2569,7 @@ function formatStepLine(step) {
|
|
|
2556
2569
|
const modelThinking = formatModelThinking(step.model, step.thinking);
|
|
2557
2570
|
if (modelThinking) parts.push(modelThinking);
|
|
2558
2571
|
if (step.durationMs !== void 0) parts.push(formatDuration(step.durationMs));
|
|
2572
|
+
if (step.progressText && step.status === "running") parts.push(`progress: ${step.progressText}`);
|
|
2559
2573
|
if (step.tokens) parts.push(`${formatTokens(step.tokens.total)} tok`);
|
|
2560
2574
|
if (step.lane) parts.push(`lane ${step.lane.key}`);
|
|
2561
2575
|
if (step.worktreePath) parts.push(`worktree ${shortenPath(step.worktreePath)} \xB7 branch ${step.branch ?? "unknown"}${step.provider ? ` \xB7 provider ${step.provider}` : ""}`);
|
|
@@ -3883,7 +3897,7 @@ function launchedWorktreeCwdWithoutHandoff(runId, launchCwd, launched) {
|
|
|
3883
3897
|
function validateResumeSessionFile(runId, sessionFile) {
|
|
3884
3898
|
if (path8.extname(sessionFile) !== ".jsonl") throw new Error(`Async run '${runId}' session file must be a .jsonl file: ${sessionFile}`);
|
|
3885
3899
|
const resolved = path8.resolve(sessionFile);
|
|
3886
|
-
if (!fs7.existsSync(resolved)) throw new Error(`Async run '${runId}' session file does not exist: ${sessionFile}`);
|
|
3900
|
+
if (!fs7.existsSync(resolved)) throw new Error(`Async run '${runId}' session file does not exist: ${sessionFile}${missingForkCopyNote(resolved)}`);
|
|
3887
3901
|
return resolved;
|
|
3888
3902
|
}
|
|
3889
3903
|
function validateResumeCwd(runId, cwd) {
|
|
@@ -4109,6 +4123,7 @@ function opencodeSessionHeaders(model, sessionId) {
|
|
|
4109
4123
|
export {
|
|
4110
4124
|
agentStreamOptions,
|
|
4111
4125
|
opencodeSessionHeaders,
|
|
4126
|
+
formatActivityAge,
|
|
4112
4127
|
formatActivityLabel,
|
|
4113
4128
|
aggregateStepStatus,
|
|
4114
4129
|
formatAgentRunningLabel,
|
|
@@ -14,20 +14,20 @@ import {
|
|
|
14
14
|
resolveCurrentSessionId,
|
|
15
15
|
resolveWatchdogReviewModel,
|
|
16
16
|
startWatchdogDiffBaselineCapture
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-47GJDBIK.js";
|
|
18
18
|
import {
|
|
19
19
|
agentStreamOptions,
|
|
20
20
|
opencodeSessionHeaders
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-SVIXQDIV.js";
|
|
22
22
|
import {
|
|
23
23
|
registerNativeSupervisorClient
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-CYKNHFXB.js";
|
|
25
25
|
import {
|
|
26
26
|
MODEL_ONLY_TOOL
|
|
27
27
|
} from "./chunk-HXRB42AF.js";
|
|
28
28
|
import {
|
|
29
29
|
inheritedNestedRouteOf
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-3DT5X2QC.js";
|
|
31
31
|
import {
|
|
32
32
|
CHILD_WATCHDOG_STATUS_EVENT,
|
|
33
33
|
DEFAULT_WAIT_TOOL_NAME,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
toolBudgetSoftNudge,
|
|
47
47
|
validateAcceptanceReport,
|
|
48
48
|
validateStructuredOutputValue
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-4MVDMA5C.js";
|
|
50
50
|
import {
|
|
51
51
|
INTERCOM_SESSION_IDENTITY_EVENT
|
|
52
52
|
} from "./chunk-JEZOSEWG.js";
|
|
@@ -295,6 +295,7 @@ function createWatchdogPermissionArbiter(options = {}) {
|
|
|
295
295
|
].join("\n");
|
|
296
296
|
const tools = [tool];
|
|
297
297
|
agent = new Agent({
|
|
298
|
+
sessionId,
|
|
298
299
|
initialState: {
|
|
299
300
|
systemPrompt,
|
|
300
301
|
model: selection.model,
|
|
@@ -584,6 +585,11 @@ function modelBefore(messages, forkedAt) {
|
|
|
584
585
|
return void 0;
|
|
585
586
|
}
|
|
586
587
|
var LOADOUT_SECTIONS = /* @__PURE__ */ new Set(["tools", "rules", "docs", "skills", "advertised_subagents", "mcp_servers", "project_context"]);
|
|
588
|
+
function projectInstructionBlocks(section) {
|
|
589
|
+
const blocks = /* @__PURE__ */ new Map();
|
|
590
|
+
for (const match of (section ?? "").matchAll(/<project_instructions\s+path=(["'])(.*?)\1\s*>[\s\S]*?<\/project_instructions>/gi)) blocks.set(match[2], match[0]);
|
|
591
|
+
return blocks;
|
|
592
|
+
}
|
|
587
593
|
function forkInstructions(input) {
|
|
588
594
|
const parent = getCurrentSystemMessage(input.parent);
|
|
589
595
|
const child = getCurrentSystemMessage(input.child);
|
|
@@ -596,6 +602,9 @@ function forkInstructions(input) {
|
|
|
596
602
|
for (const [name, value] of Object.entries(child?.sections ?? {})) {
|
|
597
603
|
if (!LOADOUT_SECTIONS.has(name) && value && parent?.sections?.[name] !== value) parts.push(value);
|
|
598
604
|
}
|
|
605
|
+
const parentFiles = projectInstructionBlocks(parent?.sections?.project_context);
|
|
606
|
+
const missingFiles = [...projectInstructionBlocks(child?.sections?.project_context)].filter(([filePath]) => !parentFiles.has(filePath)).map(([, block]) => block);
|
|
607
|
+
if (missingFiles.length > 0) parts.push(["Project instructions for your working folder, which the parent's prompt does not include:", ...missingFiles].join("\n\n"));
|
|
599
608
|
if (input.boundary) parts.push(input.boundary);
|
|
600
609
|
return `<subagent_instructions>
|
|
601
610
|
${parts.join("\n\n")}
|