@vicary/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-ESWW6XSX.js → chunk-47ZN7NKR.js} +1 -1
- package/bundle/{chunk-C3KWLXDH.js → chunk-4MVDMA5C.js} +9 -1
- package/bundle/{chunk-HDICKROY.js → chunk-6EUQPQY7.js} +31 -14
- package/bundle/{chunk-M2VBGET6.js → chunk-6PR44R7E.js} +7 -2
- package/bundle/{chunk-75LVXBSA.js → chunk-AOSILI5R.js} +45 -15
- package/bundle/{chunk-PUSTU4Q7.js → chunk-BW5JLKIU.js} +118 -42
- 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-O7A26O6B.js → chunk-JYHTDTOZ.js} +6 -4
- package/bundle/{chunk-C5QWQSSM.js → chunk-KXW62VBU.js} +1 -1
- package/bundle/{chunk-BFF6YDK6.js → chunk-L4YY2TOE.js} +1 -1
- package/bundle/{chunk-NJTSXIMG.js → chunk-NVGQE2H2.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-Z4TR7MK6.js → chunk-TDJKY2NE.js} +14 -5
- package/bundle/{chunk-HTI7DD5D.js → chunk-V7SZMS6W.js} +2 -2
- package/bundle/{chunk-VFUFOZBU.js → chunk-W6HIYD2Z.js} +1 -1
- package/bundle/{chunk-USRX7QXD.js → chunk-XIA5GSEU.js} +2 -2
- package/bundle/{chunk-NMYBVCGP.js → chunk-XZXYPZUT.js} +42 -29
- 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 +4 -2
- package/docs/observability.md +2 -0
- package/docs/tool-reference.md +4 -1
- package/package.json +3 -3
- 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 +9 -0
- package/src/extension/config.js +13 -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
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getAgentDir,
|
|
8
8
|
getConfigDirName,
|
|
9
9
|
getProjectConfigDir
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4MVDMA5C.js";
|
|
11
11
|
import {
|
|
12
12
|
TEMP_ROOT_DIR
|
|
13
13
|
} from "./chunk-JEZOSEWG.js";
|
|
@@ -509,17 +509,20 @@ function resolveMcpDirectToolResolution(mcpDirectTools, cwd = process.cwd(), run
|
|
|
509
509
|
const runtimeSelectionServers = /* @__PURE__ */ new Set([...selectedServers, ...selectedTools.keys()]);
|
|
510
510
|
const runtimeServers = resolveRuntimeMcpServers(config, runtimeSelectionServers, runtimeSnapshotHost);
|
|
511
511
|
const resolvedConfig = Object.keys(runtimeServers).length > 0 ? mergeConfigs(config, { mcpServers: runtimeServers }) : config;
|
|
512
|
-
|
|
512
|
+
const enabledSelectors = selectors.filter((selector) => resolvedConfig.mcpServers[selector.split("/", 1)[0]]?.disabled !== true);
|
|
513
|
+
validateSelectedServerDefinitions(resolvedConfig, enabledSelectors);
|
|
513
514
|
const runtime = Object.keys(runtimeServers).length > 0 ? { mcpConfig: resolvedConfig, runtimeServerNames: Object.keys(runtimeServers) } : {};
|
|
515
|
+
if (enabledSelectors.length === 0) return { selections: [], unresolvedSelectors: [], ...runtime };
|
|
514
516
|
const cache = loadMetadataCache();
|
|
515
|
-
if (!cache) return { selections: [], unresolvedSelectors:
|
|
517
|
+
if (!cache) return { selections: [], unresolvedSelectors: enabledSelectors, ...runtime };
|
|
516
518
|
const validMetadata = {};
|
|
517
519
|
for (const [serverName, definition] of Object.entries(resolvedConfig.mcpServers)) {
|
|
520
|
+
if (definition.disabled === true) continue;
|
|
518
521
|
const serverCache = cache.servers[serverName];
|
|
519
522
|
if (isServerCacheValid(serverCache, definition)) validMetadata[serverName] = serverCache;
|
|
520
523
|
}
|
|
521
524
|
const grant = planMcpDirectToolGrant({
|
|
522
|
-
selectors,
|
|
525
|
+
selectors: enabledSelectors,
|
|
523
526
|
servers: resolvedConfig.mcpServers,
|
|
524
527
|
metadata: validMetadata,
|
|
525
528
|
toolPrefix: resolvedConfig.settings?.toolPrefix
|
|
@@ -714,11 +717,20 @@ function parseSettings(value) {
|
|
|
714
717
|
function mergeConfigs(base, next) {
|
|
715
718
|
const imports = [...base.imports ?? [], ...next.imports ?? []];
|
|
716
719
|
return {
|
|
717
|
-
mcpServers:
|
|
720
|
+
mcpServers: mergeServerDefinitions(base.mcpServers, next.mcpServers),
|
|
718
721
|
imports: imports.length ? [...new Set(imports)] : void 0,
|
|
719
722
|
settings: next.settings ? { ...base.settings, ...next.settings } : base.settings
|
|
720
723
|
};
|
|
721
724
|
}
|
|
725
|
+
function mergeServerDefinitions(base, next) {
|
|
726
|
+
const servers = { ...base };
|
|
727
|
+
for (const [name, definition] of Object.entries(next)) {
|
|
728
|
+
const previous = base[name];
|
|
729
|
+
if (previous && Object.keys(definition).every((key) => key === "disabled")) servers[name] = { ...previous, ...definition };
|
|
730
|
+
else servers[name] = previous?.disabled === void 0 ? definition : { disabled: previous.disabled, ...definition };
|
|
731
|
+
}
|
|
732
|
+
return servers;
|
|
733
|
+
}
|
|
722
734
|
function expandImports(config, cwd) {
|
|
723
735
|
if (!config.imports?.length) return config;
|
|
724
736
|
const importedServers = {};
|
|
@@ -738,7 +750,7 @@ function expandImports(config, cwd) {
|
|
|
738
750
|
return {
|
|
739
751
|
imports: config.imports,
|
|
740
752
|
settings: config.settings,
|
|
741
|
-
mcpServers:
|
|
753
|
+
mcpServers: mergeServerDefinitions(importedServers, config.mcpServers)
|
|
742
754
|
};
|
|
743
755
|
}
|
|
744
756
|
function resolveImportPath(importKind, cwd) {
|
|
@@ -4382,7 +4382,7 @@ function formatAvailableAgentLines(agents) {
|
|
|
4382
4382
|
const short = description.length > MAX_LISTED_DESCRIPTION_CHARS ? `${description.slice(0, MAX_LISTED_DESCRIPTION_CHARS - 1).trimEnd()}\u2026` : description;
|
|
4383
4383
|
return `- ${agent.name} (${agent.source})${short ? ` \u2014 ${short}` : ""}`;
|
|
4384
4384
|
});
|
|
4385
|
-
if (sorted.length > MAX_LISTED_AGENTS) lines.push(`+${sorted.length - MAX_LISTED_AGENTS} more; {action:"list"}`);
|
|
4385
|
+
if (sorted.length > MAX_LISTED_AGENTS) lines.push(`+${sorted.length - MAX_LISTED_AGENTS} more; {action:"list", options:{search:"<term>"}}`);
|
|
4386
4386
|
return lines.length ? lines : ["- (none)"];
|
|
4387
4387
|
}
|
|
4388
4388
|
function suggestAgentName(name, agents) {
|
|
@@ -7781,6 +7781,10 @@ function getFinalOutput(messages) {
|
|
|
7781
7781
|
function getSingleResultOutput(result) {
|
|
7782
7782
|
return result.finalOutput ?? getFinalOutput(result.messages ?? []);
|
|
7783
7783
|
}
|
|
7784
|
+
var TRUNCATED_RESPONSE_ERROR = "Response was truncated: the model reached its maximum output length.";
|
|
7785
|
+
function getTerminalAssistantStopReason(messages) {
|
|
7786
|
+
return messages.findLast((message) => message.role === "assistant")?.stopReason;
|
|
7787
|
+
}
|
|
7784
7788
|
function getDisplayItems(messages) {
|
|
7785
7789
|
if (!messages || messages.length === 0) return [];
|
|
7786
7790
|
const items = [];
|
|
@@ -8715,6 +8719,8 @@ export {
|
|
|
8715
8719
|
assistantMessageError,
|
|
8716
8720
|
getFinalOutput,
|
|
8717
8721
|
getSingleResultOutput,
|
|
8722
|
+
TRUNCATED_RESPONSE_ERROR,
|
|
8723
|
+
getTerminalAssistantStopReason,
|
|
8718
8724
|
getDisplayItems,
|
|
8719
8725
|
sumResultsUsage,
|
|
8720
8726
|
toAgentToolUsage,
|
|
@@ -8793,6 +8799,7 @@ export {
|
|
|
8793
8799
|
resolveEffectiveAcceptance,
|
|
8794
8800
|
formatReviewGateLabel,
|
|
8795
8801
|
formatAcceptancePrompt,
|
|
8802
|
+
parseAcceptanceReport,
|
|
8796
8803
|
stripAcceptanceReport,
|
|
8797
8804
|
validateAcceptanceReport,
|
|
8798
8805
|
captureStagedIndexBaseline,
|
|
@@ -8828,6 +8835,7 @@ export {
|
|
|
8828
8835
|
defaultInheritSkills,
|
|
8829
8836
|
findBlockingAgentDiagnostic,
|
|
8830
8837
|
unknownAgentDiagnosticContext,
|
|
8838
|
+
MAX_LISTED_AGENTS,
|
|
8831
8839
|
formatAvailableAgentLines,
|
|
8832
8840
|
suggestAgentName,
|
|
8833
8841
|
formatUnknownAgentError,
|
|
@@ -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.",
|
|
@@ -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
|
};
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
startWatchdogDiffBaselineCapture,
|
|
12
12
|
writeUserWatchdogEnabled,
|
|
13
13
|
writeWatchdogModelSettings
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JYHTDTOZ.js";
|
|
15
15
|
import {
|
|
16
16
|
resolveGitRepositoryIdentity
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-RHYVKQQL.js";
|
|
18
18
|
import {
|
|
19
19
|
listAsyncRuns,
|
|
20
20
|
parallelHandoffPath,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
readAsyncRecoveryDescriptor,
|
|
23
23
|
readWorkflowLaunchRecord,
|
|
24
24
|
resolveRetainedWorktreeCwd
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-SVIXQDIV.js";
|
|
26
26
|
import {
|
|
27
27
|
ownsRun
|
|
28
28
|
} from "./chunk-HXRB42AF.js";
|
|
@@ -54,21 +54,21 @@ import {
|
|
|
54
54
|
resolveMissionStoreLocation,
|
|
55
55
|
validateMissionId,
|
|
56
56
|
workflowRunParamsFingerprint
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-3DT5X2QC.js";
|
|
58
58
|
import {
|
|
59
59
|
requestAsyncCommand,
|
|
60
60
|
watchAsyncControlInbox
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-W6HIYD2Z.js";
|
|
62
62
|
import {
|
|
63
63
|
supervisorChannelDir
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-3MFYKBKI.js";
|
|
65
65
|
import {
|
|
66
66
|
createHerdrClient,
|
|
67
67
|
detectHerdr
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-2DIEL4WG.js";
|
|
69
69
|
import {
|
|
70
70
|
getProjectSubagentsDir
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-YDZ7BZD5.js";
|
|
72
72
|
import {
|
|
73
73
|
ExternalJobProviderError,
|
|
74
74
|
getExternalJobProvider,
|
|
@@ -78,10 +78,11 @@ import {
|
|
|
78
78
|
} from "./chunk-YYREO77V.js";
|
|
79
79
|
import {
|
|
80
80
|
mergeRuntimeAgents
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-KXW62VBU.js";
|
|
82
82
|
import {
|
|
83
83
|
CODE_OWNED_EXTERNAL_CLI_ADAPTER_LABEL,
|
|
84
84
|
EXTERNAL_CLI_ADAPTER_SAFETY,
|
|
85
|
+
MAX_LISTED_AGENTS,
|
|
85
86
|
PI_CODING_AGENT_PACKAGE,
|
|
86
87
|
PI_CODING_AGENT_PACKAGE_ROOT_ENV,
|
|
87
88
|
PROMPT_REDACTED,
|
|
@@ -111,6 +112,7 @@ import {
|
|
|
111
112
|
mergeBuiltinAgentOverride,
|
|
112
113
|
normalizeModelSegment,
|
|
113
114
|
normalizeWorkflowLaneMetadata,
|
|
115
|
+
parseAcceptanceReport,
|
|
114
116
|
parseFrontmatter,
|
|
115
117
|
parsePackageName,
|
|
116
118
|
parseUnquotedList,
|
|
@@ -137,7 +139,7 @@ import {
|
|
|
137
139
|
withFileLease,
|
|
138
140
|
writeAtomicJson,
|
|
139
141
|
writePrivateAtomicJson
|
|
140
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-4MVDMA5C.js";
|
|
141
143
|
import {
|
|
142
144
|
DIRS,
|
|
143
145
|
INTERCOM_DETACH_REQUEST_EVENT,
|
|
@@ -3767,7 +3769,8 @@ function handleList(params, ctx) {
|
|
|
3767
3769
|
let scopedAgents = effectiveAgentsForScope(scope, d, ctx.runtimeAgentOwner, ctx.model?.provider);
|
|
3768
3770
|
scopedAgents = scopedAgents.sort((a, b) => a.name.localeCompare(b.name));
|
|
3769
3771
|
const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.piSessionId);
|
|
3770
|
-
const
|
|
3772
|
+
const search = typeof params.search === "string" ? params.search.trim().toLowerCase() : "";
|
|
3773
|
+
const visibleAgents = scopedAgents.filter((a) => !a.disabled && (!search || [a.name, a.description, ...a.aliases ?? []].some((text2) => text2.toLowerCase().includes(search))));
|
|
3771
3774
|
const agents = visibleAgents.filter((a) => isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
|
|
3772
3775
|
const restrictedAgents = visibleAgents.filter((a) => !isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
|
|
3773
3776
|
const restrictedSources = capabilityCeilingAgentRestrictionSources(capabilityCeiling);
|
|
@@ -3784,11 +3787,15 @@ function handleList(params, ctx) {
|
|
|
3784
3787
|
const knownProviders = knownModelProviders(ctx.modelRegistry);
|
|
3785
3788
|
const unavailableModels = new Set([...agents, ...restrictedAgents].filter((agent) => (agent.runner?.type ?? "pi") === "pi" && isUnavailableSubagentModel(agent.model, availableModels, agent.modelProvider ?? ctx.model?.provider, knownProviders)));
|
|
3786
3789
|
const formatLine = capabilityMode ? (agent, names) => formatAgentCapabilitiesLine(agent, names, externalCliAvailability, unavailableModels) : formatAgentListLine;
|
|
3790
|
+
const shownAgents = agents.slice(0, MAX_LISTED_AGENTS);
|
|
3791
|
+
const shownRestrictedAgents = restrictedAgents.slice(0, MAX_LISTED_AGENTS - shownAgents.length);
|
|
3792
|
+
const omittedCount = Math.max(0, agents.length + restrictedAgents.length - MAX_LISTED_AGENTS);
|
|
3787
3793
|
const lines = [
|
|
3788
3794
|
capabilityMode ? "Executable agents (capabilities):" : "Executable agents:",
|
|
3789
|
-
...formatAgentListSections(
|
|
3795
|
+
...formatAgentListSections(shownAgents, providerNameSet, formatLine)
|
|
3790
3796
|
];
|
|
3791
|
-
appendRestrictedAgentLines({ lines, agents:
|
|
3797
|
+
appendRestrictedAgentLines({ lines, agents: shownRestrictedAgents, sources: restrictedSources, providerNames: providerNameSet, formatLine });
|
|
3798
|
+
if (omittedCount > 0) lines.push("", `+${omittedCount} more; narrow with {action:"list", options:{search:"<term>"}}`);
|
|
3792
3799
|
appendExternalJobRegistryLine(lines, [...agents, ...restrictedAgents], providerStatus);
|
|
3793
3800
|
appendAgentDiagnosticLines(lines, d.agentDiagnostics);
|
|
3794
3801
|
if (proactiveSuggestions.length) lines.push("", ...proactiveSuggestions);
|
|
@@ -7756,14 +7763,37 @@ function createDefaultChildSessionFactory(options = {}) {
|
|
|
7756
7763
|
mcpWaits.delete(cancel);
|
|
7757
7764
|
}
|
|
7758
7765
|
}
|
|
7766
|
+
let reportCompleted = false;
|
|
7767
|
+
const guidanceClosed = "Child completed its acceptance report; resume it for further guidance.";
|
|
7768
|
+
const assertAcceptsGuidance = () => {
|
|
7769
|
+
if (reportCompleted) throw new Error(guidanceClosed);
|
|
7770
|
+
};
|
|
7771
|
+
const rejectQueuedGuidance = () => {
|
|
7772
|
+
session.clearQueue();
|
|
7773
|
+
throw new Error(guidanceClosed);
|
|
7774
|
+
};
|
|
7759
7775
|
const child = {
|
|
7760
|
-
subscribe: (listener) => session.subscribe((event) =>
|
|
7776
|
+
subscribe: (listener) => session.subscribe((event) => {
|
|
7777
|
+
if (event.type === "message_end" && event.message.role === "assistant" && event.message.stopReason === "stop") {
|
|
7778
|
+
const text2 = event.message.content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
|
|
7779
|
+
const report = parseAcceptanceReport(text2);
|
|
7780
|
+
if (report.report || report.malformed) {
|
|
7781
|
+
reportCompleted = true;
|
|
7782
|
+
session.clearQueue();
|
|
7783
|
+
session.agent.steer = rejectQueuedGuidance;
|
|
7784
|
+
session.agent.followUp = rejectQueuedGuidance;
|
|
7785
|
+
}
|
|
7786
|
+
}
|
|
7787
|
+
listener(event);
|
|
7788
|
+
}),
|
|
7761
7789
|
prompt: (text2) => session.prompt(text2),
|
|
7762
7790
|
...commands ? { finishCommands: () => commands.finish() } : {},
|
|
7763
7791
|
steer: async (text2) => {
|
|
7792
|
+
assertAcceptsGuidance();
|
|
7764
7793
|
await session.steer(text2);
|
|
7765
7794
|
},
|
|
7766
7795
|
followUp: async (text2) => {
|
|
7796
|
+
assertAcceptsGuidance();
|
|
7767
7797
|
await session.followUp(text2);
|
|
7768
7798
|
},
|
|
7769
7799
|
abort: () => session.abort(),
|
|
@@ -7824,7 +7854,7 @@ function childSessionFactory() {
|
|
|
7824
7854
|
}
|
|
7825
7855
|
function createLazyPlacementFactory(local) {
|
|
7826
7856
|
let placed;
|
|
7827
|
-
const factory = async () => placed ??= (await import("./chunk-
|
|
7857
|
+
const factory = async () => placed ??= (await import("./chunk-PJSOS2Q4.js")).createPlacementAwareChildSessionFactory(local);
|
|
7828
7858
|
return {
|
|
7829
7859
|
async create(launch) {
|
|
7830
7860
|
return launch.machine ? (await factory()).create(launch) : local.create(launch);
|