pi-subagents 0.84.0 → 0.86.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 +83 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/{chunk-JG4QKI5M.js → chunk-2IYBCYFU.js} +214 -97
- package/bundle/{chunk-V2BZYLEP.js → chunk-374MZFF4.js} +7 -2
- package/bundle/{chunk-4E7BKDTX.js → chunk-3RKFH2UZ.js} +11 -156
- package/bundle/{chunk-F4ASL6OV.js → chunk-5H4BICQZ.js} +1 -1
- package/bundle/{chunk-PALJGGYC.js → chunk-6VD7BGIC.js} +6 -3
- package/bundle/{chunk-C5P5CHYK.js → chunk-77ASNIEM.js} +1 -1
- package/bundle/{chunk-XDQORLZ5.js → chunk-7ADDXUGF.js} +15 -6
- package/bundle/{chunk-PV63UFUR.js → chunk-7QA7ZA46.js} +183 -28
- package/bundle/{chunk-NKQ6JNAS.js → chunk-7ZUFN6ME.js} +2 -1
- package/bundle/{chunk-SSG7IEP5.js → chunk-A637IMAO.js} +2 -2
- package/bundle/{chunk-L3WFKBEI.js → chunk-BGXEAYUM.js} +247 -153
- package/bundle/{chunk-J5YL7LYR.js → chunk-BU6PFPVX.js} +59 -27
- package/bundle/{chunk-DZDETGRJ.js → chunk-BWC2LVII.js} +259 -216
- package/bundle/{chunk-CGN2TVE7.js → chunk-GJGTMLPE.js} +322 -18
- package/bundle/{chunk-D3JAFGMO.js → chunk-GRJHIXYF.js} +1 -1
- package/bundle/chunk-HXRB42AF.js +108 -0
- package/bundle/{chunk-LFDBD4PW.js → chunk-LGINOOY5.js} +2 -2
- package/bundle/{chunk-G2Z6ZH26.js → chunk-NAFLUJ26.js} +1 -1
- package/bundle/{chunk-235AWJUQ.js → chunk-O3YH7XIY.js} +324 -111
- package/bundle/{chunk-2DHZTCOL.js → chunk-PYOAIN3V.js} +2 -2
- package/bundle/{chunk-LNRJCP2Y.js → chunk-QGO6HXHG.js} +417 -242
- package/bundle/{chunk-VQVVHSY6.js → chunk-QM3JGE4W.js} +22 -11
- package/bundle/{chunk-2S4K53MV.js → chunk-S2Q75LP3.js} +1 -1
- package/bundle/{chunk-NENDSQUY.js → chunk-UR7OW5S7.js} +9 -6
- package/bundle/{chunk-AKOIVLA5.js → chunk-WN2E5XHN.js} +135 -77
- package/bundle/{chunk-2D52JFLF.js → chunk-YK3QYNLE.js} +41 -117
- package/bundle/{chunk-7BWGNDNK.js → chunk-ZJJCPV3L.js} +190 -1177
- package/bundle/chunk-ZPY5QZCS.js +1067 -0
- 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 +23 -2
- package/docs/configuration.md +4 -4
- package/docs/extension-api.md +16 -1
- package/docs/tool-reference.md +2 -0
- 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 +35 -12
- package/src/extension/tool-description.d.ts +1 -1
- package/src/extension/tool-description.js +14 -8
- 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 +9 -7
- 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 +15 -12
- 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/acceptance.js +69 -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-contract.d.ts +49 -0
- package/src/runs/shared/external-cli-contract.js +18 -13
- 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 +40 -5
- 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 +85 -59
- 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 +161 -66
- 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-receipt.js +36 -53
- 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
|
@@ -11,6 +11,7 @@ import { FileLeaseBusyError } from "../../shared/file-lease.js";
|
|
|
11
11
|
import { recordWaitCompletion } from "./wait-completions.js";
|
|
12
12
|
import { syncMissionFromAsyncCompletion } from "../../missions/lifecycle.js";
|
|
13
13
|
import { acknowledgeMissionObserverSnapshot, missionObserverIndexPath, missionObserverResultCandidateFiles, promotePendingResultFile, readResultPayload, resultCandidateFilesForSession, resultPayloadPathForIndexedRun, resultPayloadPathForMissionObserverRun, resultPayloadPathForSessionRun, resultSnapshotReplaced, retireResultSnapshot, withResultRunLease, writeAsyncResultFile, writeResultIndexForData } from "./result-files.js";
|
|
14
|
+
import { reportSessionWarning } from "../../shared/session-warnings.js";
|
|
14
15
|
const WATCHER_RESTART_DELAY_MS = 3000;
|
|
15
16
|
const POLL_INTERVAL_MS = 3000;
|
|
16
17
|
const HEALTHY_SCAN_INTERVAL_MS = 60_000;
|
|
@@ -47,16 +48,20 @@ function resultFileIdentity(raw, file) {
|
|
|
47
48
|
runId: file.replace(/\.json$/i, ""),
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function reportResultWatcherWarning(state, message, error, key = message) {
|
|
52
|
+
const detail = error === undefined ? "" : `: ${error instanceof Error ? error.message : String(error)}`;
|
|
53
|
+
reportSessionWarning(state, `${message}${detail}`, key);
|
|
54
|
+
}
|
|
55
|
+
function sanitizeNestedResultChildren(state, value, resultPath, label) {
|
|
51
56
|
if (value === undefined)
|
|
52
57
|
return undefined;
|
|
53
58
|
if (!Array.isArray(value)) {
|
|
54
|
-
|
|
59
|
+
reportResultWatcherWarning(state, `Ignoring invalid nested children in subagent result file '${resultPath}' at ${label}: expected an array.`);
|
|
55
60
|
return undefined;
|
|
56
61
|
}
|
|
57
62
|
const children = value.map((child) => sanitizeSummary(child)).filter((child) => Boolean(child));
|
|
58
63
|
if (children.length !== value.length) {
|
|
59
|
-
|
|
64
|
+
reportResultWatcherWarning(state, `Ignoring ${value.length - children.length} invalid nested child record(s) in subagent result file '${resultPath}' at ${label}.`, undefined, `result-nested-records-invalid:${resultPath}:${label}`);
|
|
60
65
|
}
|
|
61
66
|
return children.length ? children : undefined;
|
|
62
67
|
}
|
|
@@ -114,6 +119,8 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
114
119
|
// Result file -> last logged mission-sync error. A failed sync is retried
|
|
115
120
|
// every pass, so the same error is logged once per result file.
|
|
116
121
|
const reportedMissionSyncFailures = new Map();
|
|
122
|
+
// reportedMissionSyncFailures decides when to report; each report gets its own key so the session warning dedupe never hides it.
|
|
123
|
+
let missionSyncReports = 0;
|
|
117
124
|
let deliveryActive = true;
|
|
118
125
|
let deliveryEpoch = 0;
|
|
119
126
|
let resultScanTimer = null;
|
|
@@ -145,7 +152,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
145
152
|
}
|
|
146
153
|
catch (error) {
|
|
147
154
|
if (!isAbsentResultCandidate(error))
|
|
148
|
-
|
|
155
|
+
reportResultWatcherWarning(state, `Failed to inspect subagent result file '${publicResultPath(file)}'`, error);
|
|
149
156
|
return false;
|
|
150
157
|
}
|
|
151
158
|
};
|
|
@@ -187,7 +194,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
187
194
|
if (isAccessDenied(error))
|
|
188
195
|
throw error;
|
|
189
196
|
if (!isAbsentResultCandidate(error))
|
|
190
|
-
|
|
197
|
+
reportResultWatcherWarning(state, `Failed to inspect subagent result file '${resultPath}'`, error);
|
|
191
198
|
return undefined;
|
|
192
199
|
}
|
|
193
200
|
};
|
|
@@ -211,7 +218,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
211
218
|
if (isAccessDenied(error))
|
|
212
219
|
throw error;
|
|
213
220
|
if (!isAbsentResultCandidate(error))
|
|
214
|
-
|
|
221
|
+
reportResultWatcherWarning(state, `Failed to inspect subagent result file '${resultPath}'`, error);
|
|
215
222
|
return undefined;
|
|
216
223
|
}
|
|
217
224
|
};
|
|
@@ -220,7 +227,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
220
227
|
return new Set(deps.observedCompletionRunIds?.() ?? []);
|
|
221
228
|
}
|
|
222
229
|
catch (error) {
|
|
223
|
-
|
|
230
|
+
reportResultWatcherWarning(state, "Failed to inspect observed subagent completion ids", error);
|
|
224
231
|
return new Set();
|
|
225
232
|
}
|
|
226
233
|
};
|
|
@@ -253,7 +260,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
253
260
|
if (isAbsentResultCandidate(error))
|
|
254
261
|
return;
|
|
255
262
|
if (!(error instanceof FileLeaseBusyError))
|
|
256
|
-
|
|
263
|
+
reportResultWatcherWarning(state, `Failed to remove delivered subagent result '${publicResultPath(file)}'; will retry`, error);
|
|
257
264
|
scheduleResult(file, triggerTurn, RETRY_DELAY_MS);
|
|
258
265
|
}
|
|
259
266
|
};
|
|
@@ -272,7 +279,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
272
279
|
catch (error) {
|
|
273
280
|
if (!isAccessDenied(error))
|
|
274
281
|
throw error;
|
|
275
|
-
|
|
282
|
+
reportResultWatcherWarning(state, `Failed to inspect subagent result file '${publicResultPath(file)}'; will retry`, error);
|
|
276
283
|
scheduleResult(file, triggerTurn, RETRY_DELAY_MS);
|
|
277
284
|
return;
|
|
278
285
|
}
|
|
@@ -330,7 +337,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
330
337
|
catch (error) {
|
|
331
338
|
if (isAccessDenied(error))
|
|
332
339
|
throw error;
|
|
333
|
-
|
|
340
|
+
reportResultWatcherWarning(state, `Failed to re-read subagent result file '${publicResultPath(file)}'`, error);
|
|
334
341
|
}
|
|
335
342
|
identityCache.delete(file);
|
|
336
343
|
rereadReplacedPayload = true;
|
|
@@ -346,7 +353,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
346
353
|
const message = error instanceof Error ? error.message : String(error);
|
|
347
354
|
if (reportedMissionSyncFailures.get(file) !== message) {
|
|
348
355
|
reportedMissionSyncFailures.set(file, message);
|
|
349
|
-
|
|
356
|
+
reportResultWatcherWarning(state, `Mission completion sync failed for '${resultPath}'`, error, `result-mission-sync-failed:${++missionSyncReports}`);
|
|
350
357
|
}
|
|
351
358
|
}
|
|
352
359
|
try {
|
|
@@ -354,7 +361,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
354
361
|
}
|
|
355
362
|
catch (error) {
|
|
356
363
|
observerSucceeded = false;
|
|
357
|
-
|
|
364
|
+
reportResultWatcherWarning(state, `Completion observer failed for '${resultPath}'`, error);
|
|
358
365
|
}
|
|
359
366
|
if (observerSucceeded) {
|
|
360
367
|
try {
|
|
@@ -364,7 +371,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
364
371
|
catch (error) {
|
|
365
372
|
observerSucceeded = false;
|
|
366
373
|
if (!(error instanceof FileLeaseBusyError))
|
|
367
|
-
|
|
374
|
+
reportResultWatcherWarning(state, `Failed to acknowledge the mission observer for '${resultPath}'; will retry`, error);
|
|
368
375
|
}
|
|
369
376
|
}
|
|
370
377
|
const epoch = deliveryEpoch;
|
|
@@ -377,13 +384,13 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
377
384
|
sessionId,
|
|
378
385
|
});
|
|
379
386
|
const hasExplicitNestedChildren = data.nestedChildren !== undefined;
|
|
380
|
-
let nestedChildren = compactNestedResultChildren(sanitizeNestedResultChildren(data.nestedChildren, resultPath, "nestedChildren"));
|
|
387
|
+
let nestedChildren = compactNestedResultChildren(sanitizeNestedResultChildren(state, data.nestedChildren, resultPath, "nestedChildren"));
|
|
381
388
|
if (!nestedChildren?.length && !hasExplicitNestedChildren) {
|
|
382
389
|
try {
|
|
383
390
|
nestedChildren = compactNestedResultChildren(projectNestedRegistryForRoot(runId)?.children);
|
|
384
391
|
}
|
|
385
392
|
catch (error) {
|
|
386
|
-
|
|
393
|
+
reportResultWatcherWarning(state, `Failed to enrich subagent result file '${resultPath}' with nested registry children; will retry later`, error);
|
|
387
394
|
scheduleResult(file, triggerTurn, RETRY_DELAY_MS);
|
|
388
395
|
return;
|
|
389
396
|
}
|
|
@@ -424,7 +431,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
424
431
|
? `${result.error}${hasRealOutput ? `\n\nOutput:\n${baseOutput}` : ""}`
|
|
425
432
|
: output;
|
|
426
433
|
const sessionPath = result.sessionFile ?? (resultChildren.length === 1 ? data.sessionFile : undefined);
|
|
427
|
-
const childNestedChildren = sanitizeNestedResultChildren(result.children, resultPath, `results[${index}].children`);
|
|
434
|
+
const childNestedChildren = sanitizeNestedResultChildren(state, result.children, resultPath, `results[${index}].children`);
|
|
428
435
|
const childState = result.state === "running" || result.state === "queued" || result.state === "paused" || result.state === "stopped"
|
|
429
436
|
? result.state
|
|
430
437
|
: result.stopped === true
|
|
@@ -493,7 +500,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
493
500
|
if (!ownsCompletion(sessionId, completionOwnerId, epoch))
|
|
494
501
|
return;
|
|
495
502
|
if (!intercomDelivered)
|
|
496
|
-
|
|
503
|
+
reportResultWatcherWarning(state, `Subagent async grouped result intercom delivery was not acknowledged for '${resultPath}'.`);
|
|
497
504
|
}
|
|
498
505
|
const delivery = notifier.deliver({
|
|
499
506
|
...data,
|
|
@@ -539,7 +546,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
539
546
|
({ data, read } = marked);
|
|
540
547
|
}
|
|
541
548
|
catch (error) {
|
|
542
|
-
|
|
549
|
+
reportResultWatcherWarning(state, `Failed to mark subagent result notification delivered for '${resultPath}'; will retry`, error);
|
|
543
550
|
scheduleResult(file, triggerTurn, RETRY_DELAY_MS);
|
|
544
551
|
return;
|
|
545
552
|
}
|
|
@@ -566,7 +573,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
566
573
|
});
|
|
567
574
|
}
|
|
568
575
|
catch (error) {
|
|
569
|
-
|
|
576
|
+
reportResultWatcherWarning(state, `Completion observer failed for '${resultPath}'`, error);
|
|
570
577
|
}
|
|
571
578
|
if (!observerSucceeded) {
|
|
572
579
|
scheduleResult(file, triggerTurn, RETRY_DELAY_MS);
|
|
@@ -582,11 +589,11 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
582
589
|
}
|
|
583
590
|
catch (error) {
|
|
584
591
|
if (isAccessDenied(error)) {
|
|
585
|
-
|
|
592
|
+
reportResultWatcherWarning(state, `Failed to process subagent result file '${resultPath}'; will retry`, error);
|
|
586
593
|
scheduleResult(file, triggerTurn, RETRY_DELAY_MS);
|
|
587
594
|
}
|
|
588
595
|
else if (!isNotFound(error))
|
|
589
|
-
|
|
596
|
+
reportResultWatcherWarning(state, `Failed to process subagent result file '${resultPath}'`, error);
|
|
590
597
|
}
|
|
591
598
|
finally {
|
|
592
599
|
processing.delete(file);
|
|
@@ -615,7 +622,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
615
622
|
// session transcript.
|
|
616
623
|
if (resultScanLogging === "activity" && stats.files === 0 && stats.scheduled === 0)
|
|
617
624
|
return;
|
|
618
|
-
|
|
625
|
+
reportSessionWarning(state, `Subagent result scan inspected ${stats.files} indexed result file(s), scheduled ${stats.scheduled} in ${elapsed}ms (${resultsDir}).`, "slow-result-scan");
|
|
619
626
|
};
|
|
620
627
|
const indexedResultCandidates = (observed) => {
|
|
621
628
|
const files = new Set();
|
|
@@ -652,10 +659,33 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
652
659
|
}
|
|
653
660
|
catch (error) {
|
|
654
661
|
if (!isNotFound(error))
|
|
655
|
-
|
|
662
|
+
reportResultWatcherWarning(state, `Failed to scan subagent result index in '${resultsDir}'`, error);
|
|
656
663
|
}
|
|
657
664
|
return files;
|
|
658
665
|
};
|
|
666
|
+
const hasPendingResults = () => eligibleResultFiles().some((file) => {
|
|
667
|
+
const payloadPath = resultPayloadPath(file);
|
|
668
|
+
if (!payloadPath)
|
|
669
|
+
return false;
|
|
670
|
+
let raw;
|
|
671
|
+
try {
|
|
672
|
+
raw = fsApi.readFileSync(payloadPath, "utf-8");
|
|
673
|
+
}
|
|
674
|
+
catch (error) {
|
|
675
|
+
// Removed since the scan means delivered; an unreadable file is still owed to someone, so the switch asks.
|
|
676
|
+
return !isNotFound(error);
|
|
677
|
+
}
|
|
678
|
+
const identity = resultFileIdentity(raw, file);
|
|
679
|
+
if (!identity.sessionId || !ownsResult(identity.sessionId, deliveryOwnerId(identity.sessionId, identity.completionOwnerId, identity.completionOwnerProcess, identity.parentWorkflowRunId)))
|
|
680
|
+
return false;
|
|
681
|
+
try {
|
|
682
|
+
return !hasDeliveredNotification(parseResult(raw));
|
|
683
|
+
}
|
|
684
|
+
catch {
|
|
685
|
+
// A partial write is retried by the watcher; until then it counts as undelivered.
|
|
686
|
+
return true;
|
|
687
|
+
}
|
|
688
|
+
});
|
|
659
689
|
const primeExistingResults = (options = {}) => {
|
|
660
690
|
const triggerTurn = options.triggerTurn !== false;
|
|
661
691
|
for (const file of eligibleResultFiles())
|
|
@@ -689,7 +719,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
689
719
|
return deps.hasDeliveryDemand?.() === true;
|
|
690
720
|
}
|
|
691
721
|
catch (error) {
|
|
692
|
-
|
|
722
|
+
reportResultWatcherWarning(state, "Failed to inspect subagent result delivery demand", error);
|
|
693
723
|
return false;
|
|
694
724
|
}
|
|
695
725
|
};
|
|
@@ -718,7 +748,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
718
748
|
clearResultScan();
|
|
719
749
|
if (state.watcherRestartTimer)
|
|
720
750
|
return;
|
|
721
|
-
|
|
751
|
+
reportResultWatcherWarning(state, `Subagent result watcher for '${resultsDir}' fell back to polling because native fs.watch is unavailable (${errorCode(reason) ?? "unknown error"}).`, undefined, `result-poll-fallback:${resultsDir}`);
|
|
722
752
|
primeExistingResults();
|
|
723
753
|
state.watcherRestartTimer = timers.setInterval(primeExistingResults, POLL_INTERVAL_MS);
|
|
724
754
|
state.watcherRestartTimer.unref?.();
|
|
@@ -736,7 +766,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
736
766
|
catch (error) {
|
|
737
767
|
if (shouldPoll(error))
|
|
738
768
|
return startPolling(error);
|
|
739
|
-
|
|
769
|
+
reportResultWatcherWarning(state, `Failed to restart subagent result watcher for '${resultsDir}'`, error);
|
|
740
770
|
scheduleRestart();
|
|
741
771
|
}
|
|
742
772
|
}, WATCHER_RESTART_DELAY_MS);
|
|
@@ -779,7 +809,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
779
809
|
state.watcher.on("error", (error) => {
|
|
780
810
|
if (shouldPoll(error))
|
|
781
811
|
return startPolling(error);
|
|
782
|
-
|
|
812
|
+
reportResultWatcherWarning(state, `Subagent result watcher failed for '${resultsDir}'`, error);
|
|
783
813
|
state.watcher?.close();
|
|
784
814
|
state.watcher = null;
|
|
785
815
|
scheduleRestart();
|
|
@@ -791,7 +821,7 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
791
821
|
catch (error) {
|
|
792
822
|
if (shouldPoll(error))
|
|
793
823
|
return startPolling(error);
|
|
794
|
-
|
|
824
|
+
reportResultWatcherWarning(state, `Failed to start subagent result watcher for '${resultsDir}'`, error);
|
|
795
825
|
state.watcher = null;
|
|
796
826
|
scheduleRestart();
|
|
797
827
|
}
|
|
@@ -815,5 +845,5 @@ export function createResultWatcher(pi, state, resultsDir, completionTtlMs, deps
|
|
|
815
845
|
processing.clear();
|
|
816
846
|
identityCache.clear();
|
|
817
847
|
};
|
|
818
|
-
return { startResultWatcher, transitionResultDelivery, primeExistingResults, deliverPendingResults, stopResultWatcher, refreshResultDelivery: () => { primeExistingResults(); startDemandPolling(); } };
|
|
848
|
+
return { startResultWatcher, transitionResultDelivery, primeExistingResults, deliverPendingResults, hasPendingResults, stopResultWatcher, refreshResultDelivery: () => { primeExistingResults(); startDemandPolling(); } };
|
|
819
849
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
2
3
|
import { readAsyncRecoveryDescriptor } from "./async-resume.js";
|
|
3
4
|
import { errorWithoutReplyText } from "../shared/model-resolution.js";
|
|
5
|
+
import { waitToolName } from "../../shared/wait-tool-name.js";
|
|
4
6
|
const INTERCOM_DETACH_ERROR = "detached for intercom coordination";
|
|
5
7
|
function isIntercomDetached(run) {
|
|
6
8
|
return run.steps.some((step) => step.execution?.status === "detached"
|
|
@@ -10,7 +12,7 @@ function isIntercomDetached(run) {
|
|
|
10
12
|
function formatIntercomDetachGuidance(run) {
|
|
11
13
|
if (!isIntercomDetached(run))
|
|
12
14
|
return undefined;
|
|
13
|
-
return `Run "${run.id}" detached for intercom coordination. Reply to the supervisor request first, then wait with
|
|
15
|
+
return `Run "${run.id}" detached for intercom coordination. Reply to the supervisor request first, then wait with ${waitToolName()}({ id: "${run.id}" }). Use subagent({ action: "status", id: "${run.id}" }) to recover the result; do not resume or launch a replacement while it remains detached.`;
|
|
14
16
|
}
|
|
15
17
|
export function formatAsyncReviveCommand(run) {
|
|
16
18
|
const step = run.steps.find((candidate) => candidate.status === "failed");
|
|
@@ -18,7 +20,7 @@ export function formatAsyncReviveCommand(run) {
|
|
|
18
20
|
if (!step || !sessionFile || !fs.existsSync(sessionFile))
|
|
19
21
|
return undefined;
|
|
20
22
|
try {
|
|
21
|
-
const descriptor = readAsyncRecoveryDescriptor(run.asyncDir);
|
|
23
|
+
const descriptor = readAsyncRecoveryDescriptor(path.dirname(run.asyncDir), path.basename(run.asyncDir));
|
|
22
24
|
if (!descriptor || descriptor.sourceRunId !== run.id || descriptor.agent !== step.agent)
|
|
23
25
|
return undefined;
|
|
24
26
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
2
3
|
import { listAsyncRuns } from "./async-status.js";
|
|
3
4
|
import { readAsyncRecoveryDescriptor } from "./async-resume.js";
|
|
4
5
|
import { parallelHandoffPath, resolveRetainedWorktreeCwd } from "../shared/parallel-handoff.js";
|
|
@@ -39,7 +40,7 @@ function childResumability(run, step) {
|
|
|
39
40
|
return session;
|
|
40
41
|
let recoveryDescriptor;
|
|
41
42
|
try {
|
|
42
|
-
recoveryDescriptor = readAsyncRecoveryDescriptor(run.asyncDir);
|
|
43
|
+
recoveryDescriptor = readAsyncRecoveryDescriptor(path.dirname(run.asyncDir), path.basename(run.asyncDir));
|
|
43
44
|
if (!recoveryDescriptor)
|
|
44
45
|
return { state: "not-resumable", reason: "missing recovery descriptor" };
|
|
45
46
|
if (recoveryDescriptor.sourceRunId !== run.id)
|
|
@@ -42,7 +42,6 @@ export interface ChildEvent {
|
|
|
42
42
|
args?: Record<string, unknown>;
|
|
43
43
|
willRetry?: unknown;
|
|
44
44
|
}
|
|
45
|
-
/** Outcome of handing a steer request to a live child session. */
|
|
46
45
|
export interface SteerDelivery {
|
|
47
46
|
state: "delivered" | "queued" | "failed";
|
|
48
47
|
deliveryStatus?: SteerDeliveryStatus;
|
|
@@ -480,12 +480,12 @@ export function runChildSession(input) {
|
|
|
480
480
|
await Promise.resolve().then(() => session?.dispose()).catch(() => undefined);
|
|
481
481
|
return commandError;
|
|
482
482
|
};
|
|
483
|
-
/** The child run ended (or was forced to end); fold in the outcome once the child's shutdown work is done. */
|
|
484
483
|
const failUnconsumedSteers = () => {
|
|
485
484
|
for (const entry of acceptedSteers.splice(0)) {
|
|
486
485
|
input.onSteerOutcome?.(entry.request, { state: "failed", message: unconsumedSteerReason(entry.request.mode) });
|
|
487
486
|
}
|
|
488
487
|
};
|
|
488
|
+
/** The child run ended (or was forced to end); fold in the outcome once the child's shutdown work is done. */
|
|
489
489
|
const settle = (promptError, forced = false) => {
|
|
490
490
|
if (settled)
|
|
491
491
|
return;
|
|
@@ -2,7 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { safeTerminalText } from "../../shared/display-text.js";
|
|
4
4
|
import { getArtifactPaths, getArtifactsDir } from "../../shared/artifacts.js";
|
|
5
|
-
import { readFleetTranscript } from "../../
|
|
5
|
+
import { readFleetTranscript } from "../../shared/fleet-transcript-reader.js";
|
|
6
6
|
import { formatAsyncRunList, formatAsyncRunOutputPath, formatAsyncRunProgressLabel, formatWorkflowStageLine, listAsyncRuns } from "./async-status.js";
|
|
7
7
|
import { formatAsyncResultTranscript, formatAsyncRunTranscript, formatNestedRunTranscript, inspectSubagentFleet } from "./fleet-view.js";
|
|
8
8
|
import { formatNestedRunStatusLines } from "../shared/nested-render.js";
|
|
@@ -37,6 +37,7 @@ import { formatWorkflowKeyRevival, projectWorkflowKeyRevival } from "../../workf
|
|
|
37
37
|
import { capSummaryOutputs } from "../shared/single-output.js";
|
|
38
38
|
import { ownsRun } from "../shared/run-ownership.js";
|
|
39
39
|
import { foregroundChildStateLabel } from "../foreground/foreground-history.js";
|
|
40
|
+
import { waitToolName } from "../../shared/wait-tool-name.js";
|
|
40
41
|
/** A step whose structured output has a path line needs only a short inline preview. */
|
|
41
42
|
const STRUCTURED_PREVIEW_WITH_PATH_CHARS = 500;
|
|
42
43
|
function formatProcessTerminal(value) {
|
|
@@ -119,7 +120,7 @@ function formatResumeGuidance(runId, children, fallbackSessionFile, options = {}
|
|
|
119
120
|
const resumableWorkflowChildren = workflowChildren.filter(({ child }) => !(child.status === "paused" && child.activityState === "needs_attention"));
|
|
120
121
|
if (workflowChildren.length > 0) {
|
|
121
122
|
return [
|
|
122
|
-
...supervisorDetachedWorkflowChildren.map(({ child }) => `Recovery workflow child${typeof child.workflowKey === "string" && child.workflowKey.trim() ? ` '${child.workflowKey}'` : ""}: reply to the supervisor request first, then wait with
|
|
123
|
+
...supervisorDetachedWorkflowChildren.map(({ child }) => `Recovery workflow child${typeof child.workflowKey === "string" && child.workflowKey.trim() ? ` '${child.workflowKey}'` : ""}: reply to the supervisor request first, then wait with ${waitToolName()}({ id: "${child.runId}" }). Use subagent({ action: "status", id: "${child.runId}" }) to recover the result; do not resume or launch a replacement while it remains detached.`),
|
|
123
124
|
...resumableWorkflowChildren.map(({ child }) => `Revive workflow child${typeof child.workflowKey === "string" && child.workflowKey.trim() ? ` '${child.workflowKey}'` : ""}: subagent({ action: "resume", id: "${child.runId}", message: "..." })`),
|
|
124
125
|
].join("\n");
|
|
125
126
|
}
|
|
@@ -230,7 +231,7 @@ function formatRememberedForegroundStatus(run) {
|
|
|
230
231
|
const detached = run.children.some((child) => child.status === "detached");
|
|
231
232
|
const resumable = run.children.find((child) => hasExistingSessionFile(child.sessionFile));
|
|
232
233
|
if (detached) {
|
|
233
|
-
lines.push(`Recovery: reply to the supervisor request first, then wait with
|
|
234
|
+
lines.push(`Recovery: reply to the supervisor request first, then wait with ${waitToolName()}({ id: "${run.runId}" }); do not resume or launch a replacement while any child remains detached.`);
|
|
234
235
|
}
|
|
235
236
|
else if (resumable) {
|
|
236
237
|
lines.push(run.children.length === 1
|
|
@@ -673,14 +674,15 @@ export function inspectSubagentStatus(params, deps = {}) {
|
|
|
673
674
|
lines.push(` Runner: external-cli (${runner.command}${runner.args.length ? ` ${runner.args.join(" ")}` : ""})`);
|
|
674
675
|
lines.push(` Adapter: ${runner.adapter.id} v${runner.adapter.version} (${runner.adapter.executionMode})`);
|
|
675
676
|
if (runner.safety) {
|
|
677
|
+
const safetyLabel = " Safety (adapter profile, not measured):";
|
|
676
678
|
if ("approvalPolicy" in runner.safety)
|
|
677
|
-
lines.push(
|
|
679
|
+
lines.push(`${safetyLabel} ${"access" in runner.safety ? `access=${runner.safety.access}, ` : ""}sandbox=${runner.safety.sandbox}, approval=${runner.safety.approvalPolicy}, ephemeral=${runner.safety.ephemeral}`);
|
|
678
680
|
else if ("mode" in runner.safety)
|
|
679
|
-
lines.push(
|
|
681
|
+
lines.push(`${safetyLabel} access=${runner.safety.access}, auth=${runner.safety.authentication}, mode=${runner.safety.mode}, sandbox=${runner.safety.sandbox}, workspaceTrust=${runner.safety.workspaceTrust}, sessionReuse=${runner.safety.sessionReuse}`);
|
|
680
682
|
else if ("authentication" in runner.safety)
|
|
681
|
-
lines.push(
|
|
683
|
+
lines.push(`${safetyLabel} access=${runner.safety.access}, auth=${runner.safety.authentication}, permission=${runner.safety.permissionMode}, tools=${runner.safety.tools}, mcp=${runner.safety.mcp}, settings=${runner.safety.settingSources}, settingsTrust=${runner.safety.userSettingsTrust}, persistence=${runner.safety.sessionPersistence}`);
|
|
682
684
|
else
|
|
683
|
-
lines.push(
|
|
685
|
+
lines.push(`${safetyLabel} access=read-only, permission=${runner.safety.permissionMode}, tools=${runner.safety.tools}, mcp=${runner.safety.mcp}, settings=${runner.safety.settingSources}, persistence=${runner.safety.sessionPersistence}`);
|
|
684
686
|
}
|
|
685
687
|
lines.push(` Capabilities: stop=${runner.capabilities.stop}, steer=false, resume=false, structuredOutput=false, toolEvents=false, supervisor=unsupported, forkContext=false, extensionBindings=false`);
|
|
686
688
|
lines.push(` Unsupported steer: ${runner.unsupportedReasons.steer}`);
|
|
@@ -17,7 +17,7 @@ export type ScheduleTrigger = {
|
|
|
17
17
|
every: string;
|
|
18
18
|
everyMs: number;
|
|
19
19
|
anchorAt: string;
|
|
20
|
-
nextRunAt
|
|
20
|
+
nextRunAt?: string;
|
|
21
21
|
} | CalendarTrigger;
|
|
22
22
|
export type ScheduleTarget = {
|
|
23
23
|
workflowScript: string;
|
|
@@ -66,6 +66,8 @@ type ScheduledRunManagerDeps = {
|
|
|
66
66
|
resolveCapabilityCeiling?: (sessionId: string) => ResolvedSubagentCapabilityCeiling | undefined;
|
|
67
67
|
timers?: ScheduledRunTimers;
|
|
68
68
|
kill?: (pid: number, signal?: NodeJS.Signals | 0) => boolean;
|
|
69
|
+
/** Shows a warning once per key without drawing over the editor. */
|
|
70
|
+
reportWarning?: (message: string, key: string) => void;
|
|
69
71
|
};
|
|
70
72
|
export declare function isScheduledRunAction(action: unknown): action is ScheduledRunAction;
|
|
71
73
|
export declare function scheduledRunsEnabled(config: ExtensionConfig): boolean;
|
|
@@ -93,6 +93,10 @@ export function parseScheduleInterval(every) {
|
|
|
93
93
|
function timestamp(value) {
|
|
94
94
|
return new Date(value).toISOString();
|
|
95
95
|
}
|
|
96
|
+
/** One-line message for a caught value; a stack trace is never useful in a session warning. */
|
|
97
|
+
function errorText(error) {
|
|
98
|
+
return error instanceof Error ? error.message : String(error);
|
|
99
|
+
}
|
|
96
100
|
function validateScheduleId(id) {
|
|
97
101
|
if (!SCHEDULE_ID.test(id))
|
|
98
102
|
throw new Error("Schedule id must be 1-64 characters and contain only letters, numbers, '.', '_', or '-'.");
|
|
@@ -311,7 +315,8 @@ function parseSchedule(value, file) {
|
|
|
311
315
|
throw new Error(`Schedule record '${file}' has an invalid one-shot trigger.`);
|
|
312
316
|
}
|
|
313
317
|
else if (record.trigger.kind === "interval") {
|
|
314
|
-
|
|
318
|
+
// A paused interval record may omit nextRunAt; resuming it supplies one.
|
|
319
|
+
if (typeof record.trigger.every !== "string" || typeof record.trigger.everyMs !== "number" || typeof record.trigger.anchorAt !== "string" || ((!record.paused || record.trigger.nextRunAt !== undefined) && typeof record.trigger.nextRunAt !== "string"))
|
|
315
320
|
throw new Error(`Schedule record '${file}' has an invalid interval trigger.`);
|
|
316
321
|
}
|
|
317
322
|
else if (record.trigger.kind === "calendar") {
|
|
@@ -524,25 +529,12 @@ function snapshotContext(ctx, cwd) {
|
|
|
524
529
|
});
|
|
525
530
|
return { ...ctx, cwd, sessionManager };
|
|
526
531
|
}
|
|
527
|
-
/**
|
|
528
|
-
* 规范化会话文件路径, 兼容 Windows 路径大小写差异.
|
|
529
|
-
*
|
|
530
|
-
* @param value 会话文件路径
|
|
531
|
-
* @returns 规范化后的路径, 空值时返回 undefined
|
|
532
|
-
*/
|
|
533
532
|
function normalizedSessionFile(value) {
|
|
534
533
|
if (!value || !value.trim())
|
|
535
534
|
return undefined;
|
|
536
535
|
const normalized = path.normalize(path.resolve(value));
|
|
537
536
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
538
537
|
}
|
|
539
|
-
/**
|
|
540
|
-
* 判断 Schedule 是否属于当前 Pi 会话.
|
|
541
|
-
*
|
|
542
|
-
* @param schedule Schedule 记录
|
|
543
|
-
* @param ctx 当前 Pi 会话上下文
|
|
544
|
-
* @returns 是否允许当前会话执行该 Schedule
|
|
545
|
-
*/
|
|
546
538
|
function scheduleBelongsToSession(schedule, ctx) {
|
|
547
539
|
if (schedule.sessionOnly !== true)
|
|
548
540
|
return true;
|
|
@@ -631,7 +623,7 @@ export class ScheduledRunManager {
|
|
|
631
623
|
ids = store.ids();
|
|
632
624
|
}
|
|
633
625
|
catch (error) {
|
|
634
|
-
|
|
626
|
+
this.deps.reportWarning?.(`Failed to inspect schedule store '${store.root}': ${errorText(error)}`, `schedule-store:${store.root}:${errorText(error)}`);
|
|
635
627
|
continue;
|
|
636
628
|
}
|
|
637
629
|
for (const id of ids) {
|
|
@@ -646,7 +638,8 @@ export class ScheduledRunManager {
|
|
|
646
638
|
return;
|
|
647
639
|
}
|
|
648
640
|
catch (error) {
|
|
649
|
-
|
|
641
|
+
// Runs on every async completion, so the key holds no error text: one warning per record.
|
|
642
|
+
this.deps.reportWarning?.(`Failed to inspect schedule '${id}' in '${store.root}': ${errorText(error)}`, `schedule-record:${store.root}:${id}`);
|
|
650
643
|
}
|
|
651
644
|
}
|
|
652
645
|
}
|
|
@@ -748,6 +741,10 @@ export class ScheduledRunManager {
|
|
|
748
741
|
if (schedule.paused === paused)
|
|
749
742
|
return textResult(`Schedule ${schedule.id} is already ${paused ? "paused" : "active"}.`, [schedule]);
|
|
750
743
|
schedule.paused = paused;
|
|
744
|
+
// A record paused without a next run must get one back here, or resuming would leave a
|
|
745
|
+
// schedule that is active and never fires.
|
|
746
|
+
if (!paused && schedule.trigger.kind === "interval" && schedule.trigger.nextRunAt === undefined)
|
|
747
|
+
schedule.trigger.nextRunAt = timestamp(this.now() + schedule.trigger.everyMs);
|
|
751
748
|
schedule.updatedAt = timestamp(this.now());
|
|
752
749
|
this.requireStore().write(schedule);
|
|
753
750
|
this.requireStore().appendEvent(schedule, paused ? "schedule.paused" : "schedule.resumed");
|
|
@@ -70,9 +70,10 @@ export interface SubagentRunConfig {
|
|
|
70
70
|
revivalLeaseToken?: string;
|
|
71
71
|
/** Global cap on simultaneously-running subagent tasks within this run. */
|
|
72
72
|
globalConcurrencyLimit?: number;
|
|
73
|
+
/** The parent's config.waitTool.name, when not bg_wait; this process and its children use it. */
|
|
74
|
+
waitToolName?: string;
|
|
73
75
|
capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
|
|
74
76
|
runFanoutBudget?: RunFanoutBudgetDescriptor;
|
|
75
|
-
/** Builtin tool names the host runtime provides; used to intersect agent-declared tools. */
|
|
76
77
|
launchContractDigest?: string;
|
|
77
78
|
launchResolvedExtensions?: LaunchResolvedChildExtensions;
|
|
78
79
|
runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensions;
|
|
@@ -117,7 +118,6 @@ interface StepResult {
|
|
|
117
118
|
nativeMachine?: import("../../shared/types.ts").SingleResult["nativeMachine"];
|
|
118
119
|
thinking?: string;
|
|
119
120
|
requestedModel?: string;
|
|
120
|
-
/** True when the dispatch failed because the input exceeded the model's context window. */
|
|
121
121
|
contextOverflow?: boolean;
|
|
122
122
|
totalCost?: CostSummary;
|
|
123
123
|
artifactPaths?: ArtifactPaths;
|
|
@@ -142,7 +142,6 @@ interface StepResult {
|
|
|
142
142
|
externalProcess?: ExternalProcessStatus;
|
|
143
143
|
externalJob?: ExternalJobStatus;
|
|
144
144
|
}
|
|
145
|
-
/** Context for running a single step */
|
|
146
145
|
interface SingleStepContext {
|
|
147
146
|
previousOutput: string;
|
|
148
147
|
outputs?: ChainOutputMap;
|
|
@@ -158,7 +157,6 @@ interface SingleStepContext {
|
|
|
158
157
|
outputFile: string;
|
|
159
158
|
transcriptPath?: string;
|
|
160
159
|
piPackageRoot?: string;
|
|
161
|
-
/** Factory the runner creates this step's child session through. */
|
|
162
160
|
childSessions: ChildSessionFactory;
|
|
163
161
|
/** The launching executor's own child runtime; nested route, depth, and ceilings come from here. */
|
|
164
162
|
inheritedChildRuntime?: InheritedChildRuntime;
|