pi-subagents 0.58.0 → 0.59.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/docs/agents.md +5 -3
  3. package/docs/configuration.md +4 -4
  4. package/docs/extension-api.md +1 -1
  5. package/docs/models.md +24 -1
  6. package/docs/observability.md +1 -1
  7. package/docs/tool-reference.md +89 -4
  8. package/docs/workflows.md +93 -2
  9. package/package.json +3 -1
  10. package/prompts/review-loop.md +2 -2
  11. package/skills/council-mode/SKILL.md +1 -1
  12. package/skills/pi-subagents/SKILL.md +1 -1
  13. package/skills/pi-subagents/references/execution-controls.md +5 -1
  14. package/skills/pi-subagents/references/management-authoring-rpc.md +1 -2
  15. package/skills/pi-subagents/references/prompting-and-roles.md +24 -3
  16. package/src/agents/agent-management.ts +5 -17
  17. package/src/agents/agent-serializer.ts +4 -2
  18. package/src/agents/agents.ts +67 -26
  19. package/src/agents/runtime-agent-registry.ts +9 -16
  20. package/src/api/background-work.ts +5 -1
  21. package/src/api/delegation.ts +0 -7
  22. package/src/api/preflight.ts +6 -9
  23. package/src/extension/fanout-child.ts +5 -3
  24. package/src/extension/index.ts +51 -23
  25. package/src/extension/public-execution.ts +15 -2
  26. package/src/extension/schemas.ts +35 -10
  27. package/src/extension/tool-description.ts +18 -3
  28. package/src/intercom/result-intercom.ts +2 -0
  29. package/src/profiles/profiles.ts +5 -6
  30. package/src/runs/background/active-async-capacity.ts +2 -2
  31. package/src/runs/background/async-execution.ts +50 -35
  32. package/src/runs/background/async-job-tracker.ts +14 -12
  33. package/src/runs/background/async-resume.ts +23 -25
  34. package/src/runs/background/async-status-snapshot.ts +23 -261
  35. package/src/runs/background/async-status.ts +66 -7
  36. package/src/runs/background/chain-append.ts +6 -3
  37. package/src/runs/background/chain-root-attachment.ts +60 -8
  38. package/src/runs/background/fleet-view.ts +21 -11
  39. package/src/runs/background/notify.ts +158 -6
  40. package/src/runs/background/result-files.ts +2 -1
  41. package/src/runs/background/result-watcher.ts +2 -0
  42. package/src/runs/background/resume-guidance.ts +1 -1
  43. package/src/runs/background/retained-children.ts +1 -1
  44. package/src/runs/background/run-status.ts +18 -8
  45. package/src/runs/background/scheduled-runs.ts +86 -7
  46. package/src/runs/background/stale-run-reconciler.ts +10 -4
  47. package/src/runs/background/steering.ts +4 -14
  48. package/src/runs/background/subagent-runner.ts +346 -357
  49. package/src/runs/background/subagent-wait.ts +58 -10
  50. package/src/runs/background/terminal-run-index.ts +1 -1
  51. package/src/runs/background/wait-completions.ts +22 -1
  52. package/src/runs/background/wait-config.ts +23 -9
  53. package/src/runs/background/wait-tool.ts +9 -2
  54. package/src/runs/foreground/async-steering-action.ts +2 -2
  55. package/src/runs/foreground/execution.ts +114 -120
  56. package/src/runs/foreground/foreground-control.ts +3 -0
  57. package/src/runs/foreground/foreground-history.ts +1 -0
  58. package/src/runs/foreground/subagent-executor.ts +478 -239
  59. package/src/runs/foreground/workflow-detach-reconcile.ts +99 -200
  60. package/src/runs/shared/abort-recovery.ts +119 -0
  61. package/src/runs/shared/async-status-projection.ts +463 -0
  62. package/src/runs/shared/child-identity.ts +19 -4
  63. package/src/runs/shared/child-launch-plan.ts +151 -0
  64. package/src/runs/shared/completion-evidence.ts +89 -0
  65. package/src/runs/shared/completion-guard.ts +1 -1
  66. package/src/runs/shared/dynamic-fanout.ts +2 -2
  67. package/src/runs/shared/host-step-status.ts +230 -0
  68. package/src/runs/shared/lane-metadata.ts +105 -0
  69. package/src/runs/shared/mcp-config-sources.ts +42 -6
  70. package/src/runs/shared/mcp-direct-tool-allowlist.ts +93 -143
  71. package/src/runs/shared/mcp-direct-tool-grant.ts +197 -0
  72. package/src/runs/shared/model-fallback.ts +9 -2
  73. package/src/runs/shared/nested-events.ts +6 -2
  74. package/src/runs/shared/nested-render.ts +7 -3
  75. package/src/runs/shared/parallel-handoff.ts +419 -7
  76. package/src/runs/shared/parallel-utils.ts +7 -0
  77. package/src/runs/shared/pi-args.ts +20 -2
  78. package/src/runs/shared/single-output.ts +27 -4
  79. package/src/runs/shared/subagent-prompt-runtime.ts +13 -4
  80. package/src/runs/shared/worktree-cleanup-plan.ts +847 -0
  81. package/src/runs/shared/worktree.ts +18 -0
  82. package/src/shared/child-session-name.ts +46 -0
  83. package/src/shared/extension-context.ts +24 -0
  84. package/src/shared/formatters.ts +5 -2
  85. package/src/shared/launch-contract.ts +1 -1
  86. package/src/shared/settings.ts +9 -103
  87. package/src/shared/types.ts +198 -29
  88. package/src/shared/utils.ts +35 -55
  89. package/src/slash/delegation-adapters.ts +1 -8
  90. package/src/slash/delegation-request.ts +0 -4
  91. package/src/slash/slash-bridge.ts +1 -2
  92. package/src/slash/slash-commands.ts +369 -90
  93. package/src/slash/slash-live-state.ts +22 -11
  94. package/src/tui/fleet-status.ts +125 -74
  95. package/src/tui/fleet.ts +11 -5
  96. package/src/tui/render.ts +316 -27
  97. package/src/watchdog/turn-delta.ts +1 -1
  98. package/src/workflows/chat-progress.ts +6 -3
  99. package/src/workflows/host-command.ts +230 -0
  100. package/src/workflows/scripted-workflow.ts +452 -38
  101. package/src/workflows/workflow-child-summary.ts +9 -5
  102. package/src/workflows/workflow-preflight.ts +270 -0
  103. package/src/workflows/workflow-receipt.ts +43 -4
  104. package/src/workflows/workflow-settlement.ts +246 -0
  105. package/src/runs/shared/turn-budget.ts +0 -98
@@ -40,11 +40,43 @@ export interface ChainOutputMapEntry {
40
40
 
41
41
  export type ChainOutputMap = Record<string, ChainOutputMapEntry>;
42
42
 
43
- export type WorkflowNodeStatus = "pending" | "running" | "completed" | "failed" | "paused" | "stopped" | "detached" | "rejected";
43
+ export type WorkflowNodeStatus = "pending" | "running" | "completed" | "failed" | "partial" | "paused" | "stopped" | "detached" | "rejected";
44
+
45
+ export type HostStepMonitorKind = "command" | "ci" | "gate";
46
+ export type HostStepState = "pending" | "running" | "done" | "cancelled" | "error";
47
+ export type HostStepVerdict = "pass" | "fail" | "inconclusive";
48
+
49
+ export interface HostStepFreshnessV1 {
50
+ expectedRef: string;
51
+ observedRef?: string;
52
+ stale?: boolean;
53
+ }
54
+
55
+ /** Bounded, provider-agnostic status for a host-owned workflow monitor. */
56
+ export interface HostStepNodeV1 {
57
+ version: 1;
58
+ kind: "host-step";
59
+ /** Explicit monitor category; never inferred from labels or commands. */
60
+ monitorKind: HostStepMonitorKind;
61
+ id: string;
62
+ label: string;
63
+ role?: string;
64
+ provider?: string;
65
+ state: HostStepState;
66
+ verdict?: HostStepVerdict;
67
+ reasonCode?: string;
68
+ detail?: string;
69
+ target?: string;
70
+ freshness?: HostStepFreshnessV1;
71
+ reportPath?: string;
72
+ exitCode?: number | null;
73
+ updatedAt: number;
74
+ deadlineAt?: number;
75
+ }
44
76
 
45
77
  export interface WorkflowGraphNode {
46
78
  id: string;
47
- kind: "step" | "parallel-group" | "dynamic-parallel-group" | "agent";
79
+ kind: "step" | "parallel-group" | "dynamic-parallel-group" | "agent" | "host-step";
48
80
  agent?: string;
49
81
  phase?: string;
50
82
  label: string;
@@ -64,6 +96,7 @@ export interface WorkflowGraphNode {
64
96
  structured?: boolean;
65
97
  acceptanceStatus?: AcceptanceLedgerStatus;
66
98
  error?: string;
99
+ hostStep?: HostStepNodeV1;
67
100
  }
68
101
 
69
102
  export interface WorkflowGraphSnapshot {
@@ -74,6 +107,26 @@ export interface WorkflowGraphSnapshot {
74
107
  currentNodeId?: string;
75
108
  }
76
109
 
110
+ export type WorkflowPreflightCoverage = "complete" | "partial";
111
+ export type WorkflowPreflightMode = "mutation" | "review" | "scout" | "gate";
112
+
113
+ /** Bounded, display-only lane hints supplied alongside a workflowScript launch. */
114
+ export interface WorkflowPreflightLaneV1 {
115
+ key: string;
116
+ mode?: WorkflowPreflightMode;
117
+ decision?: string;
118
+ claims?: string[];
119
+ expectedOutput?: string;
120
+ independence?: string;
121
+ }
122
+
123
+ /** Versioned, display-only workflow launch plan; it never grants launch authority. */
124
+ export interface WorkflowPreflightV1 {
125
+ version: 1;
126
+ coverage: WorkflowPreflightCoverage;
127
+ lanes: WorkflowPreflightLaneV1[];
128
+ }
129
+
77
130
  export type WorkflowReceiptState = "complete" | "failed" | "paused" | "stopped";
78
131
 
79
132
  export type WorkflowTerminalResolution = "settled-awaiting-resume" | "failed-child" | "interrupted-child";
@@ -90,6 +143,22 @@ export interface WorkflowRecoveryAction {
90
143
  taskRequired: true;
91
144
  }
92
145
 
146
+ /**
147
+ * Bounded, launch-declared workflow lane metadata. This is display and
148
+ * triage information only; capability ceilings, authorization, and cleanup
149
+ * safety remain owned by their existing enforcement and handoff paths.
150
+ */
151
+ export type WorkflowLaneMode = "mutation" | "review" | "scout" | "gate";
152
+
153
+ export interface WorkflowLaneMetadata {
154
+ version: 1;
155
+ key: string;
156
+ mode?: WorkflowLaneMode;
157
+ sourceRef?: string;
158
+ claims?: string[];
159
+ outputPaths?: string[];
160
+ }
161
+
93
162
  export interface WorkflowChildSummaryV1 {
94
163
  version: 1;
95
164
  parentToolCallId: string;
@@ -100,6 +169,8 @@ export interface WorkflowChildSummaryV1 {
100
169
  childId: string;
101
170
  runId?: string;
102
171
  agent?: string;
172
+ /** Human-readable display name for the child session, when derived at launch. */
173
+ sessionName?: string;
103
174
  model?: string;
104
175
  thinking?: string;
105
176
  state: "pending" | "running" | "completed" | "failed" | "paused" | "stopped" | "rejected" | "detached";
@@ -112,6 +183,7 @@ type WorkflowReceiptEntryResumability =
112
183
 
113
184
  export type WorkflowReceiptEntry = WorkflowReceiptEntryResumability & {
114
185
  key: string;
186
+ lane?: WorkflowLaneMetadata;
115
187
  terminalOutcome?: WorkflowTerminalOutcome;
116
188
  agent?: string;
117
189
  requestedContext?: "fresh" | "fork";
@@ -127,6 +199,7 @@ export interface WorkflowReceipt {
127
199
  state: WorkflowReceiptState;
128
200
  createdAt: number;
129
201
  entries: Record<string, WorkflowReceiptEntry>;
202
+ hostSteps?: HostStepNodeV1[];
130
203
  workflowChildren?: WorkflowChildSummaryV1;
131
204
  workflowResolution?: WorkflowTerminalResolution;
132
205
  terminalOutcome?: WorkflowTerminalOutcome;
@@ -157,16 +230,6 @@ export interface Usage {
157
230
  turns: number;
158
231
  }
159
232
 
160
- export interface TurnBudgetConfig {
161
- maxTurns: number;
162
- graceTurns?: number;
163
- }
164
-
165
- export interface ResolvedTurnBudget {
166
- maxTurns: number;
167
- graceTurns: number;
168
- }
169
-
170
233
  export interface ToolBudgetConfig {
171
234
  soft?: number;
172
235
  hard: number;
@@ -189,9 +252,19 @@ export interface ToolBudgetState extends ResolvedToolBudget {
189
252
  blockedTool?: string;
190
253
  }
191
254
 
255
+ /**
256
+ * @deprecated Turn budgets are no longer accepted as launch configuration or
257
+ * enforced. Retained only to decode historical persisted status and result data.
258
+ */
192
259
  export type TurnBudgetOutcome = "within-budget" | "wrap-up-requested" | "termination-deferred" | "exceeded";
193
260
 
194
- export interface TurnBudgetState extends ResolvedTurnBudget {
261
+ /**
262
+ * @deprecated Historical persisted turn-budget state. New runs do not produce
263
+ * this field, but status readers retain it for backwards compatibility.
264
+ */
265
+ export interface TurnBudgetState {
266
+ maxTurns: number;
267
+ graceTurns: number;
195
268
  outcome: TurnBudgetOutcome;
196
269
  turnCount: number;
197
270
  wrapUpRequestedAtTurn?: number;
@@ -257,6 +330,8 @@ export interface CompletionBatchConfig {
257
330
 
258
331
  export interface WaitToolConfigObject {
259
332
  enabled?: boolean;
333
+ /** Default blocking window for subagent_wait calls that omit timeoutMs. */
334
+ defaultTimeoutMs?: number;
260
335
  }
261
336
 
262
337
  export type WaitToolConfig = boolean | WaitToolConfigObject;
@@ -307,6 +382,11 @@ export interface ParallelHandoffChild {
307
382
  index: number;
308
383
  taskIndex: number;
309
384
  agent: string;
385
+ /** Stable workflow identity used to join status/receipt metadata. */
386
+ workflowKey?: string;
387
+ /** Child run id when the worktree belongs to a workflow child. */
388
+ runId?: string;
389
+ lane?: WorkflowLaneMetadata;
310
390
  status: SubagentResultStatus;
311
391
  summary: string;
312
392
  outputPath?: string;
@@ -316,6 +396,15 @@ export interface ParallelHandoffChild {
316
396
  patch: ParallelHandoffPatch;
317
397
  }
318
398
 
399
+ /** Launch-time identity retained while a handoff group has no terminal child rows yet. */
400
+ export interface ParallelHandoffLaneBinding {
401
+ index: number;
402
+ taskIndex: number;
403
+ workflowKey?: string;
404
+ runId?: string;
405
+ lane?: WorkflowLaneMetadata;
406
+ }
407
+
319
408
  export interface ParallelHandoffCleanupTask {
320
409
  index: number;
321
410
  path: string;
@@ -327,11 +416,38 @@ export interface ParallelHandoffCleanupTask {
327
416
  errors?: string[];
328
417
  }
329
418
 
419
+ export type CleanupEligibility =
420
+ | { state: "active" }
421
+ | { state: "terminal-eligible" }
422
+ | { state: "terminal-blocked"; reason: string }
423
+ | { state: "superseded-eligible" }
424
+ | { state: "unknown" };
425
+
426
+ export interface ParallelHandoffMergeEvidence {
427
+ prNumber: number;
428
+ reviewedHead: string;
429
+ mergeCommit: string;
430
+ treeEquivalent: boolean | "unknown";
431
+ postMergeChecks: "recorded" | "unknown";
432
+ attestedBy: string;
433
+ attestedAt: string;
434
+ manifestDigest?: string;
435
+ }
436
+
437
+ export interface ParallelHandoffSupersessionEvidence {
438
+ supersededBy: string;
439
+ attestedBy: string;
440
+ attestedAt: string;
441
+ manifestDigest?: string;
442
+ }
443
+
330
444
  export interface ParallelHandoffGroup {
331
445
  stepIndex: number;
332
446
  baseCommit: string;
333
447
  repoRoot: string;
334
448
  children: ParallelHandoffChild[];
449
+ /** Optional launch identities for pending groups before child results settle. */
450
+ laneBindings?: ParallelHandoffLaneBinding[];
335
451
  cleanup: {
336
452
  state: "complete" | "partial";
337
453
  tasks: ParallelHandoffCleanupTask[];
@@ -349,6 +465,9 @@ export interface ParallelHandoffManifest {
349
465
  createdAt: number;
350
466
  updatedAt: number;
351
467
  groups: ParallelHandoffGroup[];
468
+ merge?: ParallelHandoffMergeEvidence;
469
+ supersession?: ParallelHandoffSupersessionEvidence;
470
+ cleanupEligibility?: CleanupEligibility;
352
471
  }
353
472
 
354
473
  export interface ParallelHandoffReference {
@@ -358,6 +477,7 @@ export interface ParallelHandoffReference {
358
477
  childCount: number;
359
478
  changedPatches: number;
360
479
  cleanupState: "complete" | "partial";
480
+ cleanupEligibility?: CleanupEligibility;
361
481
  }
362
482
 
363
483
  export interface AgentContract {
@@ -366,7 +486,7 @@ export interface AgentContract {
366
486
 
367
487
  export type ChainGateLayer = "execution" | "acceptance";
368
488
 
369
- export type ExecutionProjectionStatus = "completed" | "failed" | "paused" | "stopped" | "detached";
489
+ export type ExecutionProjectionStatus = "completed" | "failed" | "partial" | "paused" | "stopped" | "detached";
370
490
 
371
491
  export interface ExecutionProjection {
372
492
  status: ExecutionProjectionStatus;
@@ -636,6 +756,7 @@ export interface SteeringRecoveryDescriptor {
636
756
  thinking?: string;
637
757
  thinkingCeiling?: ThinkingLevel;
638
758
  tools?: string[];
759
+ allowNestedSubagents?: boolean;
639
760
  extensions?: string[];
640
761
  subagentOnlyExtensions?: string[];
641
762
  mcpDirectTools?: string[];
@@ -659,8 +780,8 @@ export interface SteeringRecoveryDescriptor {
659
780
  context?: "fresh" | "fork";
660
781
  /** Raw per-run bridge override. Omitted descriptors continue to use global config. */
661
782
  intercomBridge?: IntercomBridgeConfig;
783
+ lane?: WorkflowLaneMetadata;
662
784
  absoluteDeadlineAt?: number;
663
- initialTurnBudget?: ResolvedTurnBudget;
664
785
  initialToolBudget?: ResolvedToolBudget;
665
786
  maxSubagentDepth: number;
666
787
  maxOutput?: MaxOutputConfig;
@@ -674,7 +795,7 @@ export interface SteeringRecoveryDescriptor {
674
795
 
675
796
  export type PublicNestedStepSummary = Pick<
676
797
  NestedStepSummary,
677
- "agent" | "status" | "model" | "thinking" | "sessionFile" | "transcriptPath" | "transcriptError" | "activityState" | "lastActivityAt" | "currentTool" | "currentToolStartedAt" | "currentPath" | "turnCount" | "toolCount" | "toolBudget" | "toolBudgetBlocked" | "startedAt" | "endedAt" | "error" | "timedOut" | "stopped"
798
+ "agent" | "sessionName" | "status" | "model" | "thinking" | "sessionFile" | "transcriptPath" | "transcriptError" | "activityState" | "lastActivityAt" | "currentTool" | "currentToolStartedAt" | "currentPath" | "turnCount" | "toolCount" | "toolBudget" | "toolBudgetBlocked" | "startedAt" | "endedAt" | "error" | "timedOut" | "stopped"
678
799
  > & {
679
800
  children?: PublicNestedRunSummary[];
680
801
  };
@@ -687,7 +808,7 @@ export type CostSummary = {
687
808
 
688
809
  export type PublicNestedRunSummary = Pick<
689
810
  NestedRunSummary,
690
- "id" | "parentRunId" | "parentStepIndex" | "parentAgent" | "depth" | "path" | "asyncDir" | "sessionId" | "sessionFile" | "intercomTarget" | "ownerIntercomTarget" | "leafIntercomTarget" | "ownerState" | "mode" | "state" | "agent" | "agents" | "model" | "thinking" | "currentStep" | "chainStepCount" | "parallelGroups" | "activityState" | "lastActivityAt" | "currentTool" | "currentToolStartedAt" | "currentPath" | "turnCount" | "toolCount" | "toolBudget" | "toolBudgetBlocked" | "totalTokens" | "totalCost" | "startedAt" | "endedAt" | "lastUpdate" | "error" | "timeoutMs" | "deadlineAt" | "timedOut" | "stopped" | "turnBudget" | "turnBudgetExceeded" | "wrapUpRequested"
811
+ "id" | "parentRunId" | "parentStepIndex" | "parentAgent" | "depth" | "path" | "asyncDir" | "sessionId" | "sessionFile" | "intercomTarget" | "ownerIntercomTarget" | "leafIntercomTarget" | "ownerState" | "mode" | "state" | "agent" | "sessionName" | "agents" | "model" | "thinking" | "currentStep" | "chainStepCount" | "parallelGroups" | "activityState" | "lastActivityAt" | "currentTool" | "currentToolStartedAt" | "currentPath" | "turnCount" | "toolCount" | "toolBudget" | "toolBudgetBlocked" | "totalTokens" | "totalCost" | "startedAt" | "endedAt" | "lastUpdate" | "error" | "timeoutMs" | "deadlineAt" | "timedOut" | "stopped" | "turnBudget" | "turnBudgetExceeded" | "wrapUpRequested"
691
812
  > & {
692
813
  steps?: PublicNestedStepSummary[];
693
814
  children?: PublicNestedRunSummary[];
@@ -695,6 +816,8 @@ export type PublicNestedRunSummary = Pick<
695
816
 
696
817
  export interface SubagentResultIntercomChild {
697
818
  agent: string;
819
+ /** Human-readable display name for the child session, when derived at launch. */
820
+ sessionName?: string;
698
821
  /** Process/lifecycle status. It does not establish semantic task completion. */
699
822
  status: SubagentResultStatus;
700
823
  /** Whether the child produced substantive output before its process ended. */
@@ -743,6 +866,8 @@ export interface ChildWatchdogProgress {
743
866
  export interface AgentProgress {
744
867
  index: number;
745
868
  agent: string;
869
+ /** Human-readable display name for the child's session, when derived at launch. */
870
+ sessionName?: string;
746
871
  status: "pending" | "running" | "completed" | "failed" | "detached";
747
872
  activityState?: ActivityState;
748
873
  task: string;
@@ -778,6 +903,8 @@ export interface ToolCallSummary {
778
903
  interface ProgressSummary {
779
904
  index?: number;
780
905
  agent?: string;
906
+ /** Human-readable display name for the child's session, when derived at launch. */
907
+ sessionName?: string;
781
908
  status?: AgentProgress["status"];
782
909
  activityState?: ActivityState;
783
910
  skills?: string[];
@@ -1038,6 +1165,9 @@ export interface SingleResult {
1038
1165
  index: number;
1039
1166
  agent: string;
1040
1167
  task: string;
1168
+ /** Human-readable display name for the child's own session (agent + task
1169
+ * excerpt), when the launcher derived one. Display metadata only. */
1170
+ sessionName?: string;
1041
1171
  /** Resolved launch context for this child. */
1042
1172
  context?: "fresh" | "fork";
1043
1173
  exitCode: number;
@@ -1132,6 +1262,10 @@ export interface WaitCompletionChild {
1132
1262
  agent?: string;
1133
1263
  /** Child run identity where the producer records one (workflow children); artifact files are keyed by it. */
1134
1264
  runId?: string;
1265
+ /** Bounded accounting projection used by /subagent-cost after async completion. */
1266
+ usage?: Usage;
1267
+ /** Persisted Pi child session when available. */
1268
+ sessionFile?: string;
1135
1269
  success?: boolean;
1136
1270
  outputState?: SubagentOutputState;
1137
1271
  error?: string;
@@ -1172,6 +1306,12 @@ export interface Details {
1172
1306
  * identity never reaches tool_result details.
1173
1307
  */
1174
1308
  completions?: WaitCompletion[];
1309
+ wait?: {
1310
+ reason: "window_elapsed";
1311
+ timedOut: true;
1312
+ activeRunIds: string[];
1313
+ activeProviderItems: Array<{ provider: string; id: string }>;
1314
+ };
1175
1315
  controlEvents?: ControlEvent[];
1176
1316
  steering?: SteerActionResult;
1177
1317
  asyncId?: string;
@@ -1181,7 +1321,6 @@ export interface Details {
1181
1321
  deadlineAt?: number;
1182
1322
  timedOut?: boolean;
1183
1323
  stopped?: boolean;
1184
- turnBudget?: ResolvedTurnBudget;
1185
1324
  toolBudget?: ResolvedToolBudget;
1186
1325
  usageBudget?: UsageBudgetState;
1187
1326
  progress?: AgentProgress[];
@@ -1201,6 +1340,9 @@ export interface Details {
1201
1340
  totalSteps?: number; // Total steps in chain
1202
1341
  currentStepIndex?: number; // 0-indexed current step (for running chains)
1203
1342
  workflowGraph?: WorkflowGraphSnapshot;
1343
+ /** Validated, display-only fanout plan supplied with a workflow launch. */
1344
+ preflight?: WorkflowPreflightV1;
1345
+ preflightWarnings?: string[];
1204
1346
  outputs?: ChainOutputMap;
1205
1347
  // Aggregated child usage across all agents in the run
1206
1348
  totalChildUsage?: Usage;
@@ -1229,8 +1371,9 @@ export interface Details {
1229
1371
  mission?: MissionRecord;
1230
1372
  workflow?: {
1231
1373
  value?: unknown;
1374
+ preflightWarnings?: string[];
1232
1375
  trace: Array<{
1233
- operation: "run" | "status" | "steer";
1376
+ operation: "run" | "status" | "steer" | "host";
1234
1377
  key: string;
1235
1378
  state: "started" | "completed" | "failed" | "detached" | "stopped" | "reused" | "queued" | "delivered" | "missed";
1236
1379
  agent?: string;
@@ -1238,6 +1381,9 @@ export interface Details {
1238
1381
  phase?: string;
1239
1382
  label?: string;
1240
1383
  durationMs?: number;
1384
+ /** Internal provenance for a generated runs.lanes child key. */
1385
+ generatedLaneKey?: string;
1386
+ warning?: string;
1241
1387
  error?: string;
1242
1388
  }>;
1243
1389
  emits: unknown[];
@@ -1297,7 +1443,7 @@ export interface AsyncParallelGroupStatus {
1297
1443
  stepIndex: number;
1298
1444
  }
1299
1445
 
1300
- export type NestedRunState = "queued" | "running" | "complete" | "failed" | "paused" | "stopped" | "rejected";
1446
+ export type NestedRunState = "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1301
1447
  export type NestedOwnerState = "live" | "gone" | "unknown";
1302
1448
 
1303
1449
  export interface NestedRunAddress {
@@ -1311,7 +1457,9 @@ export interface NestedRunAddress {
1311
1457
 
1312
1458
  export interface NestedStepSummary {
1313
1459
  agent: string;
1314
- status: "pending" | "running" | "complete" | "completed" | "failed" | "paused" | "stopped" | "rejected";
1460
+ /** Human-readable display name for the child session, when derived at launch. */
1461
+ sessionName?: string;
1462
+ status: "pending" | "running" | "complete" | "completed" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1315
1463
  model?: string;
1316
1464
  thinking?: string;
1317
1465
  sessionFile?: string;
@@ -1362,6 +1510,8 @@ export interface NestedRunSummary extends NestedRunAddress {
1362
1510
  capabilityAudit?: SubagentCapabilityAudit;
1363
1511
  state: NestedRunState;
1364
1512
  agent?: string;
1513
+ /** Human-readable display name for the child session, when derived at launch. */
1514
+ sessionName?: string;
1365
1515
  agents?: string[];
1366
1516
  model?: string;
1367
1517
  thinking?: string;
@@ -1423,6 +1573,7 @@ export interface AsyncStartedEvent {
1423
1573
  chainStepCount?: number;
1424
1574
  parallelGroups?: AsyncParallelGroupStatus[];
1425
1575
  workflowGraph?: WorkflowGraphSnapshot;
1576
+ preflight?: WorkflowPreflightV1;
1426
1577
  launchContractDigest?: string;
1427
1578
  launchResolvedExtensions?: LaunchResolvedChildExtensionsV1;
1428
1579
  runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensionsV1;
@@ -1556,7 +1707,7 @@ export interface AsyncStatus {
1556
1707
  mode: SubagentRunMode;
1557
1708
  context?: "fresh" | "fork" | "mixed";
1558
1709
  isNested?: boolean;
1559
- state: "queued" | "running" | "complete" | "failed" | "paused" | "stopped" | "rejected";
1710
+ state: "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1560
1711
  /** Display-only dismissal marker for a reload-orphaned workflow. */
1561
1712
  displayDismissedAt?: number;
1562
1713
  error?: string;
@@ -1590,6 +1741,7 @@ export interface AsyncStatus {
1590
1741
  pendingAppends?: number;
1591
1742
  parallelGroups?: AsyncParallelGroupStatus[];
1592
1743
  workflowGraph?: WorkflowGraphSnapshot;
1744
+ preflight?: WorkflowPreflightV1;
1593
1745
  processTerminal?: ProcessTerminalV1;
1594
1746
  runFanoutBudget?: RunFanoutBudgetSnapshot;
1595
1747
  runFanoutBudgetDescriptor?: RunFanoutBudgetDescriptor;
@@ -1602,12 +1754,15 @@ export interface AsyncStatus {
1602
1754
  workflowChildren?: WorkflowChildSummaryV1;
1603
1755
  parentWorkflowRunId?: string;
1604
1756
  workflowKey?: string;
1757
+ lane?: WorkflowLaneMetadata;
1605
1758
  /** Set when a durable schedule launched this run, so completions can name their origin. */
1606
1759
  scheduleOrigin?: ScheduleOrigin;
1607
1760
  steps?: Array<{
1608
1761
  /** Stable caller-facing child identity for inspect/status/stop. */
1609
1762
  childId?: string;
1610
1763
  agent: string;
1764
+ /** Human-readable display name for the child session, when derived at launch. */
1765
+ sessionName?: string;
1611
1766
  runner?: ExternalCliRunnerStatus | ExternalJobRunnerStatus;
1612
1767
  externalProcess?: ExternalProcessStatus;
1613
1768
  externalJob?: ExternalJobStatus;
@@ -1618,6 +1773,11 @@ export interface AsyncStatus {
1618
1773
  phase?: string;
1619
1774
  label?: string;
1620
1775
  workflowKey?: string;
1776
+ lane?: WorkflowLaneMetadata;
1777
+ /** Display-only worktree path copied at launch; handoff remains authoritative. */
1778
+ worktreePath?: string;
1779
+ /** Display-only branch copied at launch; handoff remains authoritative. */
1780
+ branch?: string;
1621
1781
  /** Child run identity for workflow capacity reconciliation. */
1622
1782
  runId?: string;
1623
1783
  /** True only when this workflow child owns a detached async runner. */
@@ -1625,7 +1785,7 @@ export interface AsyncStatus {
1625
1785
  parentWorkflowRunId?: string;
1626
1786
  outputName?: string;
1627
1787
  structured?: boolean;
1628
- status: "pending" | "running" | "complete" | "completed" | "failed" | "paused" | "stopped" | "rejected";
1788
+ status: "pending" | "running" | "complete" | "completed" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1629
1789
  stopRequested?: boolean;
1630
1790
  stopRequestedAt?: number;
1631
1791
  children?: NestedRunSummary[];
@@ -1706,7 +1866,7 @@ export interface AsyncJobState {
1706
1866
  cwd?: string;
1707
1867
  /** Parent-resolved child session root retained for trusted live transcript lookup. */
1708
1868
  sessionRoot?: string;
1709
- status: "queued" | "running" | "complete" | "failed" | "paused" | "stopped" | "rejected";
1869
+ status: "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1710
1870
  /** Short caller-facing task/goal shown in fleet surfaces when available. */
1711
1871
  description?: string;
1712
1872
  pid?: number;
@@ -1727,7 +1887,10 @@ export interface AsyncJobState {
1727
1887
  currentStep?: number;
1728
1888
  chainStepCount?: number;
1729
1889
  parallelGroups?: AsyncParallelGroupStatus[];
1890
+ /** Bounded host-owned CI/gate nodes loaded from the workflow status graph. */
1891
+ hostSteps?: HostStepNodeV1[];
1730
1892
  steps?: AsyncJobStep[];
1893
+ preflight?: WorkflowPreflightV1;
1731
1894
  stepsTotal?: number;
1732
1895
  runningSteps?: number;
1733
1896
  completedSteps?: number;
@@ -1757,10 +1920,13 @@ export interface AsyncJobState {
1757
1920
  workflowKey?: string;
1758
1921
  workflow?: Details["workflow"];
1759
1922
  workflowChildren?: WorkflowChildSummaryV1;
1923
+ lane?: WorkflowLaneMetadata;
1760
1924
  }
1761
1925
 
1762
1926
  export interface ForegroundResumeChild {
1763
1927
  agent: string;
1928
+ /** Human-readable display name for the child session, when derived at launch. */
1929
+ sessionName?: string;
1764
1930
  index: number;
1765
1931
  context?: "fresh" | "fork";
1766
1932
  sessionFile?: string;
@@ -1824,6 +1990,8 @@ export interface ForegroundResumeRun {
1824
1990
  export interface ForegroundChildControl {
1825
1991
  index: number;
1826
1992
  agent: string;
1993
+ /** Human-readable display name for the child's session, when derived at launch. */
1994
+ sessionName?: string;
1827
1995
  description?: string;
1828
1996
  startedAt: number;
1829
1997
  updatedAt: number;
@@ -1861,6 +2029,8 @@ export interface ForegroundRunControl {
1861
2029
  /** Effective working directory used to resolve live transcript artifacts. */
1862
2030
  cwd?: string;
1863
2031
  currentAgent?: string;
2032
+ /** Human-readable display name for the current child session, when derived at launch. */
2033
+ sessionName?: string;
1864
2034
  currentIndex?: number;
1865
2035
  /** Short caller-facing task/goal shown in fleet surfaces when available. */
1866
2036
  description?: string;
@@ -2074,10 +2244,7 @@ export interface RunSyncOptions {
2074
2244
  toolTimeoutMs?: number;
2075
2245
  /** Raw global config.toolTimeoutMs, used by the per-child resolver. */
2076
2246
  configToolTimeoutMs?: number;
2077
- turnBudget?: ResolvedTurnBudget;
2078
2247
  usageBudget?: UsageBudgetConfig;
2079
- /** Enforce maxTurns + graceTurns as a hard model-turn boundary. */
2080
- enforceHardTurnLimit?: boolean;
2081
2248
  toolBudget?: ResolvedToolBudget;
2082
2249
  allowZeroToolBudget?: boolean;
2083
2250
  allowIntercomDetach?: boolean;
@@ -2102,10 +2269,13 @@ export interface RunSyncOptions {
2102
2269
  sessionFile?: string;
2103
2270
  share?: boolean;
2104
2271
  outputPath?: string;
2272
+ outputClaimPath?: string;
2105
2273
  outputMode?: OutputMode;
2106
2274
  maxSubagentDepth?: number;
2107
2275
  /** Effective parent wait-tool setting propagated to the child runtime. */
2108
2276
  waitToolEnabled?: boolean;
2277
+ /** Effective parent default wait window propagated to the child runtime. */
2278
+ waitToolDefaultTimeoutMs?: number;
2109
2279
  capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
2110
2280
  runFanoutBudget?: RunFanoutBudgetDescriptor;
2111
2281
  nestedRoute?: NestedRouteInfo;
@@ -2303,7 +2473,6 @@ export interface ExtensionConfig {
2303
2473
  toolTimeoutMs?: number;
2304
2474
  control?: ControlConfig;
2305
2475
  completionBatch?: CompletionBatchConfig;
2306
- turnBudget?: TurnBudgetConfig;
2307
2476
  toolBudget?: ToolBudgetConfig;
2308
2477
  /** Opt-in native tool permissions. Bash remains outside this policy. */
2309
2478
  permissions?: import("../runs/shared/permissions.ts").PermissionConfig;
@@ -2435,7 +2604,7 @@ export const POLL_INTERVAL_MS = 250;
2435
2604
  export const WIDGET_ANIMATION_INTERVAL_MS = 1000;
2436
2605
  export const MAX_WIDGET_JOBS = 4;
2437
2606
  export const DEFAULT_SUBAGENT_MAX_DEPTH = 2;
2438
- export const SUBAGENT_ACTIONS = ["list", "get", "models", "children.list", "guide", "validate", "create", "update", "delete", "eject", "disable", "enable", "reset", "mission.create", "mission.list", "mission.show", "mission.update", "mission.resolve-decision", "mission.attach-run", "mission.close", "worktree.discard", "refine", "refine.show", "refine.rollback", "inspector.open", "inspector.status", "inspector.close", "project.open", "project.status", "project.close", "status", "debug.run", "grant-spawn-budget", "interrupt", "resume", "steer", "stop", "dismiss", "doctor", "watchdog.status", "watchdog.check", "watchdog.configure", "watchdog.recommend-model", "schedule.create", "schedule.list", "schedule.show", "schedule.history", "schedule.pause", "schedule.resume", "schedule.run", "schedule.run-due", "schedule.delete"] as const;
2607
+ export const SUBAGENT_ACTIONS = ["list", "get", "models", "children.list", "guide", "validate", "create", "update", "delete", "eject", "disable", "enable", "reset", "mission.create", "mission.list", "mission.show", "mission.update", "mission.resolve-decision", "mission.attach-run", "mission.close", "worktree.discard", "worktree.cleanup", "lane.status", "lane.recordMerge", "lane.recordSupersession", "refine", "refine.show", "refine.rollback", "inspector.open", "inspector.status", "inspector.close", "project.open", "project.status", "project.close", "status", "debug.run", "grant-spawn-budget", "interrupt", "resume", "steer", "stop", "dismiss", "doctor", "watchdog.status", "watchdog.check", "watchdog.configure", "watchdog.recommend-model", "schedule.create", "schedule.list", "schedule.show", "schedule.history", "schedule.pause", "schedule.resume", "schedule.run", "schedule.run-due", "schedule.delete"] as const;
2439
2608
 
2440
2609
  export const DEFAULT_FORK_PREAMBLE =
2441
2610
  "You are a delegated subagent running from a fork of the parent session. " +