@xzzpig/pi-subagents 0.8.0 → 0.9.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 +443 -0
- package/README.md +2 -2
- package/agents/claude-code-writer.md +15 -0
- package/agents/claude-code.md +15 -0
- package/agents/codex-exec-writer.md +15 -0
- package/agents/codex-exec.md +15 -0
- package/agents/cursor-agent-writer.md +14 -0
- package/agents/cursor-agent.md +14 -0
- package/agents/reviewer.md +1 -1
- package/agents/scout.md +1 -1
- package/docs/agents.md +151 -39
- package/docs/configuration.md +81 -22
- package/docs/extension-api.md +69 -14
- package/docs/missions.md +2 -0
- package/docs/models.md +32 -9
- package/docs/observability.md +22 -20
- package/docs/tool-reference.md +123 -14
- package/docs/watchdog.md +92 -114
- package/docs/workflows.md +142 -4
- package/install.mjs +1 -1
- package/package.json +5 -4
- package/prompts/review-loop.md +2 -2
- package/skills/council-mode/SKILL.md +48 -243
- package/skills/council-mode/references/pass-contracts.md +150 -0
- package/skills/pi-subagents/SKILL.md +89 -35
- package/skills/pi-subagents/references/constraints-and-recipes.md +30 -234
- package/skills/pi-subagents/references/execution-controls.md +91 -15
- package/skills/pi-subagents/references/management-authoring-rpc.md +5 -5
- package/skills/pi-subagents/references/multi-lane-orchestration.md +13 -1
- package/skills/pi-subagents/references/prompting-and-roles.md +59 -31
- package/skills/pi-subagents/references/review-and-validation.md +73 -0
- package/src/agents/agent-management.ts +370 -114
- package/src/agents/agent-refinements.ts +4 -4
- package/src/agents/agent-serializer.ts +12 -2
- package/src/agents/agents.ts +919 -372
- package/src/agents/builtin-names.ts +6 -0
- package/src/agents/runtime-agent-events.ts +70 -0
- package/src/agents/runtime-agent-registry.ts +31 -20
- package/src/api/agents.ts +10 -5
- package/src/api/background-work.ts +12 -3
- package/src/api/capability-ceiling.ts +0 -1
- package/src/api/{pi-args.ts → child-tool-plan.ts} +1 -1
- package/src/api/delegation.ts +0 -7
- package/src/api/external-runs.ts +67 -4
- package/src/api/preflight.ts +48 -18
- package/src/api/shared-types.ts +6 -0
- package/src/extension/config.ts +90 -0
- package/src/extension/doctor.ts +5 -13
- package/src/extension/fanout-child.ts +14 -14
- package/src/extension/index.ts +115 -37
- package/src/extension/public-execution.ts +103 -15
- package/src/extension/rpc.ts +120 -25
- package/src/extension/schemas.ts +57 -21
- package/src/extension/tool-description.ts +48 -26
- package/src/inspectors/herdr/actions.ts +2 -1
- package/src/inspectors/herdr/inspector-runner.ts +21 -23
- package/src/inspectors/herdr/session-roots-codec.ts +42 -0
- package/src/integrations/herdr-status.ts +51 -3
- package/src/intercom/native-supervisor-channel.ts +138 -60
- package/src/intercom/result-intercom.ts +2 -0
- package/src/intercom/supervisor-ui.ts +243 -0
- package/src/profiles/profiles.ts +5 -6
- package/src/runs/background/active-async-capacity.ts +103 -18
- package/src/runs/background/async-execution.ts +366 -128
- package/src/runs/background/async-job-tracker.ts +95 -15
- package/src/runs/background/async-resume.ts +45 -28
- package/src/runs/background/async-retention.ts +20 -3
- package/src/runs/background/async-status-snapshot.ts +23 -261
- package/src/runs/background/async-status.ts +189 -14
- package/src/runs/background/auto-drain.ts +1 -1
- package/src/runs/background/chain-append.ts +8 -3
- package/src/runs/background/chain-root-attachment.ts +74 -8
- package/src/runs/background/control-channel.ts +4 -205
- package/src/runs/background/fleet-view.ts +38 -22
- package/src/runs/background/inspect-rpc.ts +8 -8
- package/src/runs/background/notify.ts +238 -12
- package/src/runs/background/process-terminal.ts +16 -0
- package/src/runs/background/result-delivery-ownership.ts +45 -0
- package/src/runs/background/result-files.ts +28 -14
- package/src/runs/background/result-watcher.ts +39 -16
- package/src/runs/background/resume-guidance.ts +2 -2
- package/src/runs/background/retained-children.ts +1 -1
- package/src/runs/background/run-child-session.ts +613 -0
- package/src/runs/background/run-status.ts +84 -17
- package/src/runs/background/runner-aliases.ts +125 -0
- package/src/runs/background/runner-child-sessions.ts +31 -0
- package/src/runs/background/scheduled-runs.ts +174 -18
- package/src/runs/background/stale-run-reconciler.ts +10 -4
- package/src/runs/background/steering.ts +8 -15
- package/src/runs/background/subagent-runner.ts +676 -1161
- package/src/runs/background/subagent-wait.ts +86 -31
- package/src/runs/background/terminal-run-index.ts +1 -1
- package/src/runs/background/wait-completions.ts +43 -2
- package/src/runs/background/wait-config.ts +23 -9
- package/src/runs/background/wait-tool.ts +26 -19
- package/src/runs/foreground/async-steering-action.ts +3 -19
- package/src/runs/foreground/execution.ts +468 -499
- package/src/runs/foreground/foreground-control.ts +13 -0
- package/src/runs/foreground/foreground-history.ts +23 -1
- package/src/runs/foreground/subagent-executor.ts +1172 -400
- package/src/runs/foreground/workflow-detach-reconcile.ts +140 -115
- package/src/runs/foreground/workflow-foreground-steering.ts +24 -98
- package/src/runs/shared/abort-recovery.ts +119 -0
- package/src/runs/shared/acceptance.ts +138 -36
- package/src/runs/shared/async-status-projection.ts +565 -0
- package/src/runs/shared/background-process-options.ts +9 -0
- package/src/runs/shared/capability-ceiling.ts +2 -2
- package/src/runs/shared/child-hooks.ts +25 -0
- package/src/runs/shared/child-identity.ts +32 -6
- package/src/runs/shared/child-launch-plan.ts +151 -0
- package/src/runs/shared/child-launch.ts +314 -0
- package/src/runs/shared/child-lifecycle.ts +25 -0
- package/src/runs/shared/child-runtime-config.ts +126 -0
- package/src/runs/shared/child-session.ts +342 -0
- package/src/runs/shared/child-tool-plan.ts +540 -0
- package/src/runs/shared/claude-code-adapter.ts +133 -0
- package/src/runs/shared/codex-exec-adapter.ts +129 -0
- package/src/runs/shared/completion-evidence.ts +89 -0
- package/src/runs/shared/completion-guard.ts +6 -5
- package/src/runs/shared/cursor-agent-adapter.ts +114 -0
- package/src/runs/shared/dynamic-fanout.ts +3 -3
- package/src/runs/shared/external-cli-contract.ts +167 -0
- package/src/runs/shared/external-cli-preflight.ts +138 -0
- package/src/runs/shared/external-cli-runner.ts +348 -55
- package/src/runs/shared/fast-mode-extension.ts +5 -5
- package/src/runs/shared/host-step-status.ts +231 -0
- package/src/runs/shared/lane-metadata.ts +126 -0
- package/src/runs/shared/launch-cwd.ts +16 -0
- package/src/runs/shared/long-running-guard.ts +2 -1
- package/src/runs/shared/mcp-config-sources.ts +422 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +222 -158
- package/src/runs/shared/mcp-direct-tool-grant.ts +194 -0
- package/src/runs/shared/model-exclusions.ts +139 -9
- package/src/runs/shared/model-fallback.ts +142 -14
- package/src/runs/shared/mutation-evidence.ts +57 -3
- package/src/runs/shared/nested-events.ts +38 -48
- package/src/runs/shared/nested-path.ts +0 -14
- package/src/runs/shared/nested-render.ts +9 -5
- package/src/runs/shared/orca-progress-tabs.ts +12 -7
- package/src/runs/shared/parallel-handoff.ts +423 -7
- package/src/runs/shared/parallel-utils.ts +15 -7
- package/src/runs/shared/permissions.ts +1 -14
- package/src/runs/shared/pi-spawn.ts +69 -35
- package/src/runs/shared/process-signal.ts +16 -0
- package/src/runs/shared/run-fanout-budget.ts +0 -13
- package/src/runs/shared/run-history.ts +21 -1
- package/src/runs/shared/runtime-acknowledged-extensions.ts +0 -27
- package/src/runs/shared/single-output.ts +89 -22
- package/src/runs/shared/structured-output.ts +49 -9
- package/src/runs/shared/subagent-control.ts +6 -2
- package/src/runs/shared/subagent-prompt-runtime.ts +188 -365
- package/src/runs/shared/task-intent.ts +21 -7
- package/src/runs/shared/tool-availability.ts +18 -62
- package/src/runs/shared/tool-budget.ts +0 -14
- package/src/runs/shared/tool-timeout.ts +1 -1
- package/src/runs/shared/workflow-graph.ts +16 -0
- package/src/runs/shared/worktree-cleanup-plan.ts +866 -0
- package/src/runs/shared/worktree.ts +571 -62
- package/src/shared/atomic-json.ts +3 -1
- package/src/shared/child-session-name.ts +46 -0
- package/src/shared/extension-context.ts +24 -0
- package/src/shared/fork-context.ts +21 -12
- package/src/shared/fork-session-cwd.ts +27 -0
- package/src/shared/formatters.ts +18 -3
- package/src/shared/jsonl-writer.ts +11 -0
- package/src/shared/launch-contract.ts +8 -1
- package/src/shared/pruned-fork.ts +450 -0
- package/src/shared/session-file-trust.ts +19 -0
- package/src/shared/session-tokens.ts +14 -3
- package/src/shared/settings.ts +19 -105
- package/src/shared/shortcuts.ts +17 -0
- package/src/shared/thinking-ceiling.ts +0 -6
- package/src/shared/types.ts +524 -70
- package/src/shared/utils.ts +60 -93
- package/src/shared/workflow-child-permit.ts +207 -0
- package/src/slash/delegation-adapters.ts +1 -9
- package/src/slash/delegation-request.ts +0 -4
- package/src/slash/prompt-template-bridge.ts +37 -1
- package/src/slash/slash-bridge.ts +1 -2
- package/src/slash/slash-commands.ts +383 -116
- package/src/slash/slash-live-state.ts +22 -11
- package/src/slash/subagents-admin.ts +29 -12
- package/src/tui/fleet-native-transcript.ts +4 -0
- package/src/tui/fleet-status.ts +217 -82
- package/src/tui/fleet-transcript.ts +11 -5
- package/src/tui/fleet.ts +54 -28
- package/src/tui/render-helpers.ts +31 -0
- package/src/tui/render.ts +1429 -163
- package/src/watchdog/change-signature.ts +40 -1
- package/src/watchdog/child-status.ts +54 -34
- package/src/watchdog/diff-tool.ts +77 -0
- package/src/watchdog/emission-guard.ts +5 -3
- package/src/watchdog/guidance.ts +20 -0
- package/src/watchdog/register-child.ts +28 -25
- package/src/watchdog/register-main.ts +10 -9
- package/src/watchdog/render.ts +4 -5
- package/src/watchdog/review.ts +15 -4
- package/src/watchdog/rules.ts +70 -0
- package/src/watchdog/runtime.ts +75 -92
- package/src/watchdog/scope.ts +0 -11
- package/src/watchdog/settings.ts +48 -104
- package/src/watchdog/turn-delta.ts +1 -1
- package/src/watchdog/types.ts +18 -32
- package/src/watchdog/warning-format.ts +0 -1
- package/src/workflows/chat-progress.ts +7 -3
- package/src/workflows/host-command.ts +235 -0
- package/src/workflows/scripted-workflow.ts +988 -59
- package/src/workflows/workflow-checklist.ts +439 -0
- package/src/workflows/workflow-child-summary.ts +121 -0
- package/src/workflows/workflow-preflight.ts +297 -0
- package/src/workflows/workflow-receipt.ts +232 -6
- package/src/workflows/workflow-resources.ts +150 -0
- package/src/workflows/workflow-settlement.ts +246 -0
- package/src/runs/shared/child-protocol.ts +0 -401
- package/src/runs/shared/pi-args.ts +0 -935
- package/src/runs/shared/subagent-startup-retry.ts +0 -116
- package/src/runs/shared/turn-budget.ts +0 -98
- package/src/shared/post-exit-stdio-guard.ts +0 -85
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { formatDuration, formatModelThinking, formatTokens, shortenPath } from "../../shared/formatters.ts";
|
|
4
|
+
import { previewDisplayText } from "../../shared/display-text.ts";
|
|
4
5
|
import { formatActivityLabel, formatParallelOutcome } from "../../shared/status-format.ts";
|
|
5
|
-
import { type ActivityState, type AsyncJobStep, type AsyncParallelGroupStatus, type AsyncStatus, type CostSummary, type Details, type LaunchResolvedChildExtensionsV1, type RuntimeAcknowledgedChildExtensionsV1, type NestedRunSummary, type SteeringStatus, type SubagentRunMode, type TokenUsage, type TurnBudgetState, type UsageBudgetState } from "../../shared/types.ts";
|
|
6
|
+
import { type ActivityState, type AsyncJobStep, type AsyncParallelGroupStatus, type AsyncStatus, type CostSummary, type Details, type HostStepNodeV1, type HostStepState, type LaunchResolvedChildExtensionsV1, type RuntimeAcknowledgedChildExtensionsV1, type NestedRunSummary, type SteeringStatus, type SubagentRunMode, type TimeoutRecoveryProjection, type TokenUsage, type TurnBudgetState, type UsageBudgetState, type WorktreeNaming, type WorkflowPreflightV1, type WorkflowGraphSnapshot } from "../../shared/types.ts";
|
|
6
7
|
import type { ResolvedSubagentCapabilityCeiling, SubagentCapabilityAudit } from "../shared/capability-ceiling.ts";
|
|
7
8
|
import { readStatus } from "../../shared/utils.ts";
|
|
8
9
|
import { attachRootChildrenToSteps, buildNestedRouteIndex, findNestedRouteForRootId, type NestedRoute, projectNestedEvents } from "../shared/nested-events.ts";
|
|
@@ -16,16 +17,31 @@ import { ACTIVE_RUN_INDEX_DIR, DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS, activeRu
|
|
|
16
17
|
import { readRecentTerminalRunIndex, TERMINAL_RUN_INDEX_DIR } from "./terminal-run-index.ts";
|
|
17
18
|
import { canScanAsyncRunPrefix } from "./run-id-query.ts";
|
|
18
19
|
import { asyncStatusChildIdentity } from "../shared/child-identity.ts";
|
|
20
|
+
import { parseWorkflowChildSummary } from "../../workflows/workflow-child-summary.ts";
|
|
21
|
+
import { assertWorkflowGraphHostSteps, hostStepReportName, hostStepVerdictLabel, validHostStepNodes } from "../shared/host-step-status.ts";
|
|
22
|
+
import { projectAsyncWorkflowRows } from "../shared/async-status-projection.ts";
|
|
23
|
+
import { validateAsyncStatusLaneMetadata } from "../shared/lane-metadata.ts";
|
|
24
|
+
import { formatWorkflowPreflightPlanSummary, formatWorkflowPreflightWarningSummary } from "../../workflows/workflow-preflight.ts";
|
|
25
|
+
import { workflowGraphStageNodes } from "../shared/workflow-graph.ts";
|
|
26
|
+
import { formatTimeoutRecoveryLines, projectTimeoutRecovery } from "../shared/mutation-evidence.ts";
|
|
27
|
+
import { formatWorkflowChecklistText, projectWorkflowChecklist } from "../../workflows/workflow-checklist.ts";
|
|
19
28
|
|
|
20
29
|
interface AsyncRunStepSummary {
|
|
21
30
|
index: number;
|
|
22
31
|
childId?: string;
|
|
23
32
|
agent: string;
|
|
33
|
+
/** Human-readable display name for the child session, when derived at launch. */
|
|
34
|
+
sessionName?: string;
|
|
24
35
|
context?: ContextMode;
|
|
25
36
|
label?: string;
|
|
26
37
|
description?: string;
|
|
27
38
|
phase?: string;
|
|
28
39
|
workflowKey?: string;
|
|
40
|
+
lane?: AsyncJobStep["lane"];
|
|
41
|
+
worktreePath?: string;
|
|
42
|
+
branch?: string;
|
|
43
|
+
provider?: "native" | "worktrunk";
|
|
44
|
+
naming?: WorktreeNaming;
|
|
29
45
|
runId?: string;
|
|
30
46
|
outputName?: string;
|
|
31
47
|
structured?: boolean;
|
|
@@ -47,6 +63,7 @@ interface AsyncRunStepSummary {
|
|
|
47
63
|
totalCost?: CostSummary;
|
|
48
64
|
skills?: string[];
|
|
49
65
|
model?: string;
|
|
66
|
+
contextLimit?: number;
|
|
50
67
|
thinking?: string;
|
|
51
68
|
attemptedModels?: string[];
|
|
52
69
|
sessionFile?: string;
|
|
@@ -56,6 +73,7 @@ interface AsyncRunStepSummary {
|
|
|
56
73
|
stopped?: boolean;
|
|
57
74
|
turnBudget?: TurnBudgetState;
|
|
58
75
|
turnBudgetExceeded?: boolean;
|
|
76
|
+
toolBudgetBlocked?: boolean;
|
|
59
77
|
wrapUpRequested?: boolean;
|
|
60
78
|
acceptance?: AsyncJobStep["acceptance"];
|
|
61
79
|
agentContract?: AsyncJobStep["agentContract"];
|
|
@@ -63,6 +81,7 @@ interface AsyncRunStepSummary {
|
|
|
63
81
|
review?: AsyncJobStep["review"];
|
|
64
82
|
effects?: AsyncJobStep["effects"];
|
|
65
83
|
processTerminal?: AsyncJobStep["processTerminal"];
|
|
84
|
+
timeoutRecovery?: TimeoutRecoveryProjection;
|
|
66
85
|
launchResolvedExtensions?: LaunchResolvedChildExtensionsV1;
|
|
67
86
|
runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensionsV1;
|
|
68
87
|
capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
|
|
@@ -75,7 +94,7 @@ export interface AsyncRunSummary {
|
|
|
75
94
|
asyncDir: string;
|
|
76
95
|
toolCallId?: string;
|
|
77
96
|
sessionId?: string;
|
|
78
|
-
state: "queued" | "running" | "complete" | "failed" | "paused" | "stopped" | "rejected";
|
|
97
|
+
state: "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
|
|
79
98
|
error?: string;
|
|
80
99
|
activityState?: ActivityState;
|
|
81
100
|
lastActivityAt?: number;
|
|
@@ -103,6 +122,8 @@ export interface AsyncRunSummary {
|
|
|
103
122
|
chainStepCount?: number;
|
|
104
123
|
pendingAppends?: number;
|
|
105
124
|
parallelGroups?: AsyncParallelGroupStatus[];
|
|
125
|
+
hostSteps?: HostStepNodeV1[];
|
|
126
|
+
workflowGraph?: AsyncStatus["workflowGraph"];
|
|
106
127
|
steps: AsyncRunStepSummary[];
|
|
107
128
|
sessionDir?: string;
|
|
108
129
|
outputFile?: string;
|
|
@@ -120,7 +141,10 @@ export interface AsyncRunSummary {
|
|
|
120
141
|
capabilityAudit?: SubagentCapabilityAudit;
|
|
121
142
|
parentWorkflowRunId?: string;
|
|
122
143
|
workflowKey?: string;
|
|
144
|
+
lane?: AsyncStatus["lane"];
|
|
123
145
|
workflow?: Details["workflow"];
|
|
146
|
+
workflowChildren?: Details["workflowChildren"];
|
|
147
|
+
preflight?: WorkflowPreflightV1;
|
|
124
148
|
}
|
|
125
149
|
|
|
126
150
|
interface AsyncRunListOptions {
|
|
@@ -145,6 +169,40 @@ function getErrorMessage(error: unknown): string {
|
|
|
145
169
|
return error instanceof Error ? error.message : String(error);
|
|
146
170
|
}
|
|
147
171
|
|
|
172
|
+
function isAsyncStatusIsolationError(asyncDir: string, error: unknown): boolean {
|
|
173
|
+
const statusPath = path.join(asyncDir, "status.json");
|
|
174
|
+
const message = getErrorMessage(error);
|
|
175
|
+
return /^(?:Failed to (?:inspect|read|parse|validate) async status file|Invalid async status file) '/.test(message)
|
|
176
|
+
|| message.startsWith(`Invalid async status '${statusPath}'`)
|
|
177
|
+
|| message.startsWith(`Invalid host step '${statusPath}`)
|
|
178
|
+
|| /^(workflowChildren|Invalid workflowChildren)/.test(message);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function isolateCorruptActiveRun(asyncDir: string, runId: string, error: unknown, now?: () => number): void {
|
|
182
|
+
const statusPath = path.join(asyncDir, "status.json");
|
|
183
|
+
const processTerminal = readProcessTerminal(asyncDir, { runId });
|
|
184
|
+
let markerAge: number | undefined;
|
|
185
|
+
try {
|
|
186
|
+
markerAge = activeRunMarkerAgeMs(asyncDir, now?.());
|
|
187
|
+
} catch (markerError) {
|
|
188
|
+
console.error(`Failed to inspect corrupt async active-run marker for '${runId}':`, markerError);
|
|
189
|
+
}
|
|
190
|
+
const markerCanBeReleased = processTerminal?.state === "observed"
|
|
191
|
+
|| (markerAge !== undefined && markerAge > DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS);
|
|
192
|
+
let markerAction = "active marker retained because runner liveness is unknown";
|
|
193
|
+
if (markerCanBeReleased) {
|
|
194
|
+
try {
|
|
195
|
+
releaseActiveRunIndex(asyncDir);
|
|
196
|
+
markerAction = processTerminal?.state === "observed"
|
|
197
|
+
? "active marker released after observed process-terminal proof"
|
|
198
|
+
: "stale active marker released";
|
|
199
|
+
} catch (releaseError) {
|
|
200
|
+
markerAction = `failed to release active marker: ${getErrorMessage(releaseError)}`;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
console.error(`[pi-subagents] Skipping corrupt active async run '${runId}' at '${statusPath}': ${getErrorMessage(error)}; ${markerAction}.`);
|
|
204
|
+
}
|
|
205
|
+
|
|
148
206
|
function isNotFoundError(error: unknown): boolean {
|
|
149
207
|
return typeof error === "object"
|
|
150
208
|
&& error !== null
|
|
@@ -229,19 +287,34 @@ function deriveAsyncActivityState(asyncDir: string, status: AsyncStatus): { acti
|
|
|
229
287
|
}
|
|
230
288
|
|
|
231
289
|
function statusToSummary(asyncDir: string, status: AsyncStatus & { cwd?: string }, nestedWarnings: string[] = [], nestedRoute?: NestedRoute): AsyncRunSummary {
|
|
290
|
+
const statusPath = path.join(asyncDir, "status.json");
|
|
291
|
+
validateAsyncStatusLaneMetadata(status, `Invalid async status '${statusPath}'`);
|
|
292
|
+
const workflowChildren = parseWorkflowChildSummary(status.workflowChildren);
|
|
293
|
+
if (workflowChildren && workflowChildren.workflowRunId !== status.runId) throw new Error(`Invalid async status '${statusPath}': workflowChildren.workflowRunId does not match.`);
|
|
294
|
+
assertWorkflowGraphHostSteps(status.workflowGraph, statusPath, status.runId);
|
|
295
|
+
const hostSteps = validHostStepNodes(status.workflowGraph);
|
|
232
296
|
if (status.sessionId !== undefined && typeof status.sessionId !== "string") {
|
|
233
|
-
throw new Error(`Invalid async status '${
|
|
297
|
+
throw new Error(`Invalid async status '${statusPath}': sessionId must be a string.`);
|
|
234
298
|
}
|
|
299
|
+
if (status.outputFile !== undefined && typeof status.outputFile !== "string") throw new Error(`Invalid async status '${statusPath}': outputFile must be a string.`);
|
|
235
300
|
const { activityState, lastActivityAt } = deriveAsyncActivityState(asyncDir, status);
|
|
236
301
|
const processTerminal = readProcessTerminal(asyncDir, { runId: status.runId, runnerProcessInstanceId: status.processTerminal?.runnerProcessInstanceId })
|
|
237
302
|
?? sanitizeProcessTerminal(status.processTerminal, { runId: status.runId, runnerProcessInstanceId: status.processTerminal?.runnerProcessInstanceId }, path.join(asyncDir, "status.json"));
|
|
238
|
-
const
|
|
239
|
-
|
|
303
|
+
const nestedProjectionAllowed = nestedWarnings.length === 0;
|
|
304
|
+
// Degrade to the status-stored snapshot when the persisted budget is unavailable (e.g. removed
|
|
305
|
+
// by OS temp cleanup) instead of failing the whole run list; admission paths stay strict.
|
|
306
|
+
let runFanoutBudget: AsyncStatus["runFanoutBudget"] = status.runFanoutBudget;
|
|
307
|
+
try {
|
|
308
|
+
const runFanoutBudgetDescriptor = readRunFanoutBudgetDescriptor(asyncDir);
|
|
309
|
+
if (runFanoutBudgetDescriptor) runFanoutBudget = getRunFanoutBudgetSnapshot(runFanoutBudgetDescriptor);
|
|
310
|
+
} catch (error) {
|
|
311
|
+
nestedWarnings.push(`Run fan-out status unavailable: ${getErrorMessage(error)}`);
|
|
312
|
+
}
|
|
240
313
|
const steps = status.steps ?? [];
|
|
241
314
|
const chainStepCount = status.chainStepCount ?? steps.length;
|
|
242
315
|
const parallelGroups = normalizeParallelGroups(status.parallelGroups, steps.length, chainStepCount);
|
|
243
316
|
let nestedChildren: NestedRunSummary[] = [];
|
|
244
|
-
if (
|
|
317
|
+
if (nestedProjectionAllowed && nestedRoute) {
|
|
245
318
|
try {
|
|
246
319
|
// The route is resolved by the caller via buildNestedRouteIndex, so this
|
|
247
320
|
// avoids a fresh scan of the nested-events directory per run.
|
|
@@ -253,15 +326,22 @@ function statusToSummary(asyncDir: string, status: AsyncStatus & { cwd?: string
|
|
|
253
326
|
const summarizedSteps = steps.map((step, index) => {
|
|
254
327
|
const stepActivityState = step.activityState;
|
|
255
328
|
const stepLastActivityAt = step.lastActivityAt;
|
|
329
|
+
const timeoutRecovery = projectTimeoutRecovery(step.timeoutRecovery);
|
|
256
330
|
return {
|
|
257
331
|
index,
|
|
258
332
|
childId: asyncStatusChildIdentity(step, index),
|
|
259
333
|
agent: step.agent,
|
|
334
|
+
...(step.sessionName ? { sessionName: step.sessionName } : {}),
|
|
260
335
|
...(step.context ? { context: step.context } : {}),
|
|
261
336
|
...(step.label ? { label: step.label } : {}),
|
|
262
337
|
...(step.description ? { description: step.description } : {}),
|
|
263
338
|
...(step.phase ? { phase: step.phase } : {}),
|
|
264
339
|
...(step.workflowKey ? { workflowKey: step.workflowKey } : {}),
|
|
340
|
+
...(step.lane ? { lane: step.lane } : {}),
|
|
341
|
+
...(step.worktreePath ? { worktreePath: step.worktreePath } : {}),
|
|
342
|
+
...(step.branch ? { branch: step.branch } : {}),
|
|
343
|
+
...(step.provider ? { provider: step.provider } : {}),
|
|
344
|
+
...(step.naming ? { naming: step.naming } : {}),
|
|
265
345
|
...(step.runId ? { runId: step.runId } : {}),
|
|
266
346
|
...(step.outputName ? { outputName: step.outputName } : {}),
|
|
267
347
|
...(step.structured ? { structured: step.structured } : {}),
|
|
@@ -283,6 +363,7 @@ function statusToSummary(asyncDir: string, status: AsyncStatus & { cwd?: string
|
|
|
283
363
|
...(step.totalCost ? { totalCost: step.totalCost } : {}),
|
|
284
364
|
...(step.skills ? { skills: step.skills } : {}),
|
|
285
365
|
...(step.model ? { model: step.model } : {}),
|
|
366
|
+
...(step.contextLimit !== undefined ? { contextLimit: step.contextLimit } : {}),
|
|
286
367
|
...(step.thinking ? { thinking: step.thinking } : {}),
|
|
287
368
|
...(step.thinkingCeiling ? { thinkingCeiling: step.thinkingCeiling } : {}),
|
|
288
369
|
...(step.attemptedModels ? { attemptedModels: step.attemptedModels } : {}),
|
|
@@ -295,6 +376,7 @@ function statusToSummary(asyncDir: string, status: AsyncStatus & { cwd?: string
|
|
|
295
376
|
...(step.stopRequestedAt !== undefined ? { stopRequestedAt: step.stopRequestedAt } : {}),
|
|
296
377
|
...(step.turnBudget ? { turnBudget: step.turnBudget } : {}),
|
|
297
378
|
...(step.turnBudgetExceeded !== undefined ? { turnBudgetExceeded: step.turnBudgetExceeded } : {}),
|
|
379
|
+
...(step.toolBudgetBlocked !== undefined ? { toolBudgetBlocked: step.toolBudgetBlocked } : {}),
|
|
298
380
|
...(step.wrapUpRequested !== undefined ? { wrapUpRequested: step.wrapUpRequested } : {}),
|
|
299
381
|
...(step.acceptance ? { acceptance: step.acceptance } : {}),
|
|
300
382
|
...(step.agentContract ? { agentContract: step.agentContract } : {}),
|
|
@@ -304,7 +386,9 @@ function statusToSummary(asyncDir: string, status: AsyncStatus & { cwd?: string
|
|
|
304
386
|
...(step.execution ? { execution: step.execution } : {}),
|
|
305
387
|
...(step.review ? { review: step.review } : {}),
|
|
306
388
|
...(step.effects ? { effects: step.effects } : {}),
|
|
389
|
+
...(step.watchdog ? { watchdog: step.watchdog } : {}),
|
|
307
390
|
...(step.processTerminal ? { processTerminal: sanitizeProcessTerminal(step.processTerminal, { runId: status.runId, runnerProcessInstanceId: step.processTerminal.runnerProcessInstanceId }, `${path.join(asyncDir, "status.json")} step ${index}`) } : {}),
|
|
391
|
+
...(timeoutRecovery ? { timeoutRecovery } : {}),
|
|
308
392
|
...(step.capabilityCeiling ? { capabilityCeiling: step.capabilityCeiling } : {}),
|
|
309
393
|
...(step.capabilityAudit ? { capabilityAudit: step.capabilityAudit } : {}),
|
|
310
394
|
...(step.children?.length ? { children: step.children } : {}),
|
|
@@ -344,6 +428,8 @@ function statusToSummary(asyncDir: string, status: AsyncStatus & { cwd?: string
|
|
|
344
428
|
...(status.chainStepCount !== undefined ? { chainStepCount: status.chainStepCount } : {}),
|
|
345
429
|
...(status.pendingAppends !== undefined ? { pendingAppends: status.pendingAppends } : {}),
|
|
346
430
|
...(parallelGroups.length ? { parallelGroups } : {}),
|
|
431
|
+
...(hostSteps.length ? { hostSteps } : {}),
|
|
432
|
+
...(status.mode === "workflow" && status.workflowGraph ? { workflowGraph: status.workflowGraph } : {}),
|
|
347
433
|
steps: summarizedSteps,
|
|
348
434
|
...(nestedChildren.length ? { nestedChildren } : {}),
|
|
349
435
|
...(nestedWarnings.length ? { nestedWarnings } : {}),
|
|
@@ -356,7 +442,10 @@ function statusToSummary(asyncDir: string, status: AsyncStatus & { cwd?: string
|
|
|
356
442
|
...(status.capabilityAudit ? { capabilityAudit: status.capabilityAudit } : {}),
|
|
357
443
|
...(status.parentWorkflowRunId ? { parentWorkflowRunId: status.parentWorkflowRunId } : {}),
|
|
358
444
|
...(status.workflowKey ? { workflowKey: status.workflowKey } : {}),
|
|
445
|
+
...(status.lane ? { lane: status.lane } : {}),
|
|
359
446
|
...(status.workflow ? { workflow: status.workflow } : {}),
|
|
447
|
+
...(workflowChildren ? { workflowChildren } : {}),
|
|
448
|
+
...(status.preflight ? { preflight: status.preflight } : {}),
|
|
360
449
|
...(status.sessionDir ? { sessionDir: status.sessionDir } : {}),
|
|
361
450
|
...(status.outputFile ? { outputFile: status.outputFile } : {}),
|
|
362
451
|
...(status.totalTokens ? { totalTokens: status.totalTokens } : {}),
|
|
@@ -376,6 +465,7 @@ function sortRuns(runs: AsyncRunSummary[]): AsyncRunSummary[] {
|
|
|
376
465
|
case "running": return 0;
|
|
377
466
|
case "queued": return 1;
|
|
378
467
|
case "failed": return 2;
|
|
468
|
+
case "partial": return 2;
|
|
379
469
|
case "stopped": return 2;
|
|
380
470
|
case "paused": return 2;
|
|
381
471
|
case "complete": return 3;
|
|
@@ -450,10 +540,17 @@ export function listAsyncRuns(asyncDirRoot: string, options: AsyncRunListOptions
|
|
|
450
540
|
};
|
|
451
541
|
for (const entry of entries) {
|
|
452
542
|
const asyncDir = path.join(asyncDirRoot, entry);
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
543
|
+
let status: (AsyncStatus & { cwd?: string }) | null;
|
|
544
|
+
try {
|
|
545
|
+
const reconciliation = options.reconcile === false
|
|
546
|
+
? undefined
|
|
547
|
+
: reconcileAsyncRun(asyncDir, { resultsDir: options.resultsDir, kill: options.kill, now: options.now });
|
|
548
|
+
status = (reconciliation?.status ?? readStatus(asyncDir)) as (AsyncStatus & { cwd?: string }) | null;
|
|
549
|
+
} catch (error) {
|
|
550
|
+
if (!activeEntries.has(entry) || !isAsyncStatusIsolationError(asyncDir, error)) throw error;
|
|
551
|
+
isolateCorruptActiveRun(asyncDir, entry, error, options.now);
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
457
554
|
if (!status) {
|
|
458
555
|
if (activeEntries.has(entry)) updateActiveRunIndex(asyncDir, "failed");
|
|
459
556
|
continue;
|
|
@@ -479,7 +576,14 @@ export function listAsyncRuns(asyncDirRoot: string, options: AsyncRunListOptions
|
|
|
479
576
|
nestedWarnings.push(`Nested status unavailable: ${getErrorMessage(error)}`);
|
|
480
577
|
}
|
|
481
578
|
}
|
|
482
|
-
|
|
579
|
+
let summary: AsyncRunSummary;
|
|
580
|
+
try {
|
|
581
|
+
summary = statusToSummary(asyncDir, status, nestedWarnings, nestedRoute);
|
|
582
|
+
} catch (error) {
|
|
583
|
+
if (!activeEntries.has(entry) || !isAsyncStatusIsolationError(asyncDir, error)) throw error;
|
|
584
|
+
isolateCorruptActiveRun(asyncDir, entry, error, options.now);
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
483
587
|
runs.push(summary);
|
|
484
588
|
}
|
|
485
589
|
|
|
@@ -504,7 +608,7 @@ function formatActivityFacts(input: { activityState?: ActivityState; lastActivit
|
|
|
504
608
|
}
|
|
505
609
|
|
|
506
610
|
function formatStepLine(step: AsyncRunStepSummary): string {
|
|
507
|
-
const display = step.label ? `${step.label} (${step.agent})` : step.agent;
|
|
611
|
+
const display = step.sessionName?.trim() || (step.label ? `${step.label} (${step.agent})` : step.agent);
|
|
508
612
|
const context = contextModeLabel(step.context);
|
|
509
613
|
const phase = step.phase ? `[${step.phase}] ` : "";
|
|
510
614
|
const parts = [`${step.index + 1}. ${phase}${display}${context ? ` ${context}` : ""}`, step.status];
|
|
@@ -514,15 +618,61 @@ function formatStepLine(step: AsyncRunStepSummary): string {
|
|
|
514
618
|
if (modelThinking) parts.push(modelThinking);
|
|
515
619
|
if (step.durationMs !== undefined) parts.push(formatDuration(step.durationMs));
|
|
516
620
|
if (step.tokens) parts.push(`${formatTokens(step.tokens.total)} tok`);
|
|
621
|
+
if (step.lane) parts.push(`lane ${step.lane.key}`);
|
|
622
|
+
if (step.worktreePath) parts.push(`worktree ${shortenPath(step.worktreePath)} · branch ${step.branch ?? "unknown"}${step.provider ? ` · provider ${step.provider}` : ""}`);
|
|
517
623
|
return parts.join(" | ");
|
|
518
624
|
}
|
|
519
625
|
|
|
626
|
+
function formatHostStepLine(row: ReturnType<typeof projectAsyncWorkflowRows>[number]): string {
|
|
627
|
+
if (!row.kind) return "";
|
|
628
|
+
const state = hostStepVerdictLabel(row.state as HostStepState, row.verdict);
|
|
629
|
+
const details = [
|
|
630
|
+
row.provider ? `provider:${row.provider}` : undefined,
|
|
631
|
+
row.role ? `role:${row.role}` : undefined,
|
|
632
|
+
row.target,
|
|
633
|
+
row.detail,
|
|
634
|
+
row.reasonCode ? `reason:${row.reasonCode}` : undefined,
|
|
635
|
+
row.freshness?.stale ? "stale" : row.freshness?.observedRef ? `ref:${row.freshness.observedRef}` : undefined,
|
|
636
|
+
row.reportPath ? `out:${hostStepReportName(row.reportPath)}` : undefined,
|
|
637
|
+
].filter((value): value is string => Boolean(value));
|
|
638
|
+
return `host ${row.kind}: ${row.name} | ${state}${details.length ? ` | ${details.join(" | ")}` : ""}`;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function workflowStageStateLabel(status: WorkflowGraphSnapshot["nodes"][number]["status"]): string {
|
|
642
|
+
switch (status) {
|
|
643
|
+
case "completed":
|
|
644
|
+
return "complete";
|
|
645
|
+
case "detached":
|
|
646
|
+
return "paused";
|
|
647
|
+
default:
|
|
648
|
+
return status;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
export function formatWorkflowStageLine(node: WorkflowGraphSnapshot["nodes"][number], index: number, total: number): string {
|
|
653
|
+
const state = workflowStageStateLabel(node.status);
|
|
654
|
+
const id = previewDisplayText(node.id, 160);
|
|
655
|
+
const label = node.label ? previewDisplayText(node.label, 160) : "";
|
|
656
|
+
const display = label && label !== id ? ` | ${label}` : "";
|
|
657
|
+
const agent = node.agent ? ` | ${previewDisplayText(node.agent, 80)}` : "";
|
|
658
|
+
const error = node.error ? ` | ${previewDisplayText(node.error, 240)}` : "";
|
|
659
|
+
return `stage ${index + 1}/${total}: ${id}${display}${agent} | ${state}${error}`;
|
|
660
|
+
}
|
|
661
|
+
|
|
520
662
|
export function formatAsyncRunOutputPath(run: Pick<AsyncRunSummary, "asyncDir" | "outputFile">): string | undefined {
|
|
521
663
|
if (!run.outputFile) return undefined;
|
|
522
664
|
return path.isAbsolute(run.outputFile) ? run.outputFile : path.join(run.asyncDir, run.outputFile);
|
|
523
665
|
}
|
|
524
666
|
|
|
525
|
-
export function formatAsyncRunProgressLabel(run: Pick<AsyncRunSummary, "mode" | "state" | "currentStep" | "chainStepCount" | "parallelGroups" | "steps">): string {
|
|
667
|
+
export function formatAsyncRunProgressLabel(run: Pick<AsyncRunSummary, "mode" | "state" | "currentStep" | "chainStepCount" | "parallelGroups" | "steps"> & { workflowGraph?: WorkflowGraphSnapshot }): string {
|
|
668
|
+
const graphStages = run.mode === "workflow" ? workflowGraphStageNodes(run.workflowGraph) : [];
|
|
669
|
+
if (graphStages.length > 0) {
|
|
670
|
+
const currentNode = graphStages.find((node) => node.id === run.workflowGraph?.currentNodeId);
|
|
671
|
+
if (currentNode && currentNode.status !== "completed") return `stage ${graphStages.indexOf(currentNode) + 1}/${graphStages.length}`;
|
|
672
|
+
const activeNode = graphStages.find((node) => node.status === "running") ?? graphStages.find((node) => node.status !== "completed");
|
|
673
|
+
if (activeNode) return `stage ${graphStages.indexOf(activeNode) + 1}/${graphStages.length}`;
|
|
674
|
+
return `stage ${graphStages.length}/${graphStages.length}`;
|
|
675
|
+
}
|
|
526
676
|
const stepCount = run.steps.length || 1;
|
|
527
677
|
const chainStepCount = run.chainStepCount ?? stepCount;
|
|
528
678
|
const groups = normalizeParallelGroups(run.parallelGroups, run.steps.length, chainStepCount);
|
|
@@ -549,7 +699,8 @@ function formatRunHeader(run: AsyncRunSummary): string {
|
|
|
549
699
|
const activity = formatActivityFacts(run);
|
|
550
700
|
const pending = run.pendingAppends ? ` | ${run.pendingAppends} pending append${run.pendingAppends === 1 ? "" : "s"}` : "";
|
|
551
701
|
const context = contextModeLabel(run.context);
|
|
552
|
-
|
|
702
|
+
const lane = run.lane ? ` | lane ${run.lane.key}` : "";
|
|
703
|
+
return `${run.id} | ${run.state}${activity ? ` | ${activity}` : ""} | ${run.mode}${context ? ` ${context}` : ""} | ${stepLabel}${pending}${lane} | ${cwd}`;
|
|
553
704
|
}
|
|
554
705
|
|
|
555
706
|
export function formatAsyncRunList(runs: AsyncRunSummary[], heading = "Active async runs"): string {
|
|
@@ -558,10 +709,34 @@ export function formatAsyncRunList(runs: AsyncRunSummary[], heading = "Active as
|
|
|
558
709
|
const lines = [`${heading}: ${runs.length}`, ""];
|
|
559
710
|
for (const run of runs) {
|
|
560
711
|
lines.push(`- ${formatRunHeader(run)}`);
|
|
712
|
+
if (run.preflight) lines.push(formatWorkflowPreflightPlanSummary(run.preflight, { indent: " " }));
|
|
713
|
+
const preflightWarning = formatWorkflowPreflightWarningSummary(run.workflow?.preflightWarnings, { indent: " " });
|
|
714
|
+
if (preflightWarning) lines.push(preflightWarning);
|
|
715
|
+
if (run.mode === "workflow") {
|
|
716
|
+
const checklist = projectWorkflowChecklist({
|
|
717
|
+
graph: run.workflowGraph,
|
|
718
|
+
steps: run.steps,
|
|
719
|
+
hostSteps: run.hostSteps,
|
|
720
|
+
preflight: run.preflight,
|
|
721
|
+
trace: run.workflow?.trace,
|
|
722
|
+
now: run.lastUpdate ?? run.endedAt ?? Date.now(),
|
|
723
|
+
});
|
|
724
|
+
lines.push(...formatWorkflowChecklistText(checklist, " ", { includeItems: false }));
|
|
725
|
+
}
|
|
561
726
|
for (const step of run.steps) {
|
|
562
727
|
lines.push(` ${formatStepLine(step)}`);
|
|
728
|
+
lines.push(...formatTimeoutRecoveryLines(step.timeoutRecovery, " "));
|
|
563
729
|
lines.push(...formatNestedRunStatusLines(step.children, { indent: " ", maxLines: 12 }));
|
|
564
730
|
}
|
|
731
|
+
const loadedWorkflowKeys = new Set(run.steps.flatMap((step) => step.workflowKey ? [step.workflowKey] : []));
|
|
732
|
+
const graphStages = run.mode === "workflow" ? workflowGraphStageNodes(run.workflowGraph) : [];
|
|
733
|
+
for (const [index, node] of graphStages.entries()) {
|
|
734
|
+
if (!loadedWorkflowKeys.has(node.id)) lines.push(` ${formatWorkflowStageLine(node, index, graphStages.length)}`);
|
|
735
|
+
}
|
|
736
|
+
for (const row of projectAsyncWorkflowRows([], run.hostSteps)) {
|
|
737
|
+
const line = formatHostStepLine(row);
|
|
738
|
+
if (line) lines.push(` ${line}`);
|
|
739
|
+
}
|
|
565
740
|
const attached = new Set(run.steps.flatMap((step) => step.children?.map((child) => child.id) ?? []));
|
|
566
741
|
const unattached = run.nestedChildren?.filter((child) => !attached.has(child.id)) ?? [];
|
|
567
742
|
lines.push(...formatNestedRunStatusLines(unattached, { indent: " ", maxLines: 12 }));
|
|
@@ -62,7 +62,7 @@ export async function drainOutstandingWork(deps: AutoDrainDeps): Promise<void> {
|
|
|
62
62
|
},
|
|
63
63
|
);
|
|
64
64
|
if (waitResult.isError) {
|
|
65
|
-
throw new Error(`Auto-drain failed for session '${sessionId}': ${resultText(waitResult) || "
|
|
65
|
+
throw new Error(`Auto-drain failed for session '${sessionId}': ${resultText(waitResult) || "bg_wait returned an error without details"}.`);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -3,8 +3,9 @@ import * as fs from "node:fs";
|
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { writeAtomicJson } from "../../shared/atomic-json.ts";
|
|
5
5
|
import { appendJsonl } from "../../shared/artifacts.ts";
|
|
6
|
-
import type {
|
|
6
|
+
import type { AsyncStatus, WorkflowGraphNode, WorkflowGraphSnapshot } from "../../shared/types.ts";
|
|
7
7
|
import { PROMPT_REDACTED, readStatus } from "../../shared/utils.ts";
|
|
8
|
+
import { deriveChildSessionName } from "../../shared/child-session-name.ts";
|
|
8
9
|
import type { DynamicRunnerGroup, ParallelStepGroup, RunnerStep, RunnerSubagentStep } from "../shared/parallel-utils.ts";
|
|
9
10
|
import { isDynamicRunnerGroup, isParallelGroup } from "../shared/parallel-utils.ts";
|
|
10
11
|
|
|
@@ -160,8 +161,10 @@ export function statusStepDescription(task: string | undefined): string | undefi
|
|
|
160
161
|
|
|
161
162
|
function statusStepForTask(task: RunnerSubagentStep): StatusStep {
|
|
162
163
|
const description = statusStepDescription(task.task);
|
|
164
|
+
const sessionName = task.sessionName ?? deriveChildSessionName({ agent: task.agent, task: task.task, label: task.label });
|
|
163
165
|
return {
|
|
164
166
|
agent: task.agent,
|
|
167
|
+
...(sessionName ? { sessionName } : {}),
|
|
165
168
|
...(description ? { description } : {}),
|
|
166
169
|
...(task.context ? { context: task.context } : {}),
|
|
167
170
|
phase: task.phase,
|
|
@@ -172,6 +175,7 @@ function statusStepForTask(task: RunnerSubagentStep): StatusStep {
|
|
|
172
175
|
...(task.sessionFile ? { sessionFile: task.sessionFile } : {}),
|
|
173
176
|
skills: task.skills,
|
|
174
177
|
model: task.model,
|
|
178
|
+
...(task.contextLimit !== undefined ? { contextLimit: task.contextLimit } : {}),
|
|
175
179
|
thinking: task.thinking,
|
|
176
180
|
attemptedModels: task.modelCandidates && task.modelCandidates.length > 0 ? task.modelCandidates : task.model ? [task.model] : undefined,
|
|
177
181
|
recentTools: [],
|
|
@@ -179,7 +183,7 @@ function statusStepForTask(task: RunnerSubagentStep): StatusStep {
|
|
|
179
183
|
};
|
|
180
184
|
}
|
|
181
185
|
|
|
182
|
-
function statusStepsForRunnerStep(step: RunnerStep
|
|
186
|
+
function statusStepsForRunnerStep(step: RunnerStep): StatusStep[] {
|
|
183
187
|
if (isParallelGroup(step)) return step.parallel.map(statusStepForTask);
|
|
184
188
|
if (isDynamicRunnerGroup(step)) {
|
|
185
189
|
return [{
|
|
@@ -189,6 +193,7 @@ function statusStepsForRunnerStep(step: RunnerStep, stepIndex: number): StatusSt
|
|
|
189
193
|
label: step.label ?? step.parallel.label ?? `Dynamic fanout (${step.collect.as})`,
|
|
190
194
|
outputName: step.collect.as,
|
|
191
195
|
structured: Boolean(step.collect.outputSchema),
|
|
196
|
+
...(step.parallel.contextLimit !== undefined ? { contextLimit: step.parallel.contextLimit } : {}),
|
|
192
197
|
status: "pending",
|
|
193
198
|
recentTools: [],
|
|
194
199
|
recentOutput: [],
|
|
@@ -295,7 +300,7 @@ export function appendRunnerStepsToStatus(input: {
|
|
|
295
300
|
for (const step of input.steps) {
|
|
296
301
|
const stepIndex = input.status.chainStepCount ?? input.status.steps?.length ?? 0;
|
|
297
302
|
const flatIndex = input.status.steps?.length ?? 0;
|
|
298
|
-
const statusSteps = statusStepsForRunnerStep(step
|
|
303
|
+
const statusSteps = statusStepsForRunnerStep(step);
|
|
299
304
|
input.status.steps ??= [];
|
|
300
305
|
input.status.steps.push(...statusSteps);
|
|
301
306
|
if (isParallelGroup(step)) {
|