pi-subagents 0.58.0 → 0.60.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 (116) hide show
  1. package/CHANGELOG.md +102 -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 +93 -5
  8. package/docs/workflows.md +94 -3
  9. package/package.json +3 -1
  10. package/prompts/review-loop.md +2 -2
  11. package/skills/council-mode/SKILL.md +48 -243
  12. package/skills/council-mode/references/pass-contracts.md +150 -0
  13. package/skills/pi-subagents/SKILL.md +87 -37
  14. package/skills/pi-subagents/references/constraints-and-recipes.md +29 -233
  15. package/skills/pi-subagents/references/execution-controls.md +52 -7
  16. package/skills/pi-subagents/references/management-authoring-rpc.md +3 -4
  17. package/skills/pi-subagents/references/multi-lane-orchestration.md +13 -1
  18. package/skills/pi-subagents/references/prompting-and-roles.md +54 -26
  19. package/skills/pi-subagents/references/review-and-validation.md +73 -0
  20. package/src/agents/agent-management.ts +159 -42
  21. package/src/agents/agent-serializer.ts +4 -2
  22. package/src/agents/agents.ts +67 -26
  23. package/src/agents/runtime-agent-registry.ts +9 -16
  24. package/src/api/background-work.ts +5 -1
  25. package/src/api/delegation.ts +0 -7
  26. package/src/api/preflight.ts +6 -9
  27. package/src/api/shared-types.ts +2 -0
  28. package/src/extension/fanout-child.ts +5 -3
  29. package/src/extension/index.ts +51 -23
  30. package/src/extension/public-execution.ts +16 -2
  31. package/src/extension/schemas.ts +36 -10
  32. package/src/extension/tool-description.ts +24 -5
  33. package/src/intercom/result-intercom.ts +2 -0
  34. package/src/profiles/profiles.ts +5 -6
  35. package/src/runs/background/active-async-capacity.ts +2 -2
  36. package/src/runs/background/async-execution.ts +52 -37
  37. package/src/runs/background/async-job-tracker.ts +17 -12
  38. package/src/runs/background/async-resume.ts +23 -25
  39. package/src/runs/background/async-status-snapshot.ts +23 -261
  40. package/src/runs/background/async-status.ts +110 -8
  41. package/src/runs/background/chain-append.ts +6 -3
  42. package/src/runs/background/chain-root-attachment.ts +60 -8
  43. package/src/runs/background/control-channel.ts +3 -2
  44. package/src/runs/background/fleet-view.ts +21 -11
  45. package/src/runs/background/notify.ts +158 -6
  46. package/src/runs/background/result-files.ts +2 -1
  47. package/src/runs/background/result-watcher.ts +2 -0
  48. package/src/runs/background/resume-guidance.ts +1 -1
  49. package/src/runs/background/retained-children.ts +1 -1
  50. package/src/runs/background/run-status.ts +30 -9
  51. package/src/runs/background/scheduled-runs.ts +86 -7
  52. package/src/runs/background/stale-run-reconciler.ts +10 -4
  53. package/src/runs/background/steering.ts +4 -14
  54. package/src/runs/background/subagent-runner.ts +351 -358
  55. package/src/runs/background/subagent-wait.ts +68 -12
  56. package/src/runs/background/terminal-run-index.ts +1 -1
  57. package/src/runs/background/wait-completions.ts +25 -1
  58. package/src/runs/background/wait-config.ts +23 -9
  59. package/src/runs/background/wait-tool.ts +9 -2
  60. package/src/runs/foreground/async-steering-action.ts +2 -2
  61. package/src/runs/foreground/execution.ts +125 -122
  62. package/src/runs/foreground/foreground-control.ts +3 -0
  63. package/src/runs/foreground/foreground-history.ts +1 -0
  64. package/src/runs/foreground/subagent-executor.ts +576 -240
  65. package/src/runs/foreground/workflow-detach-reconcile.ts +99 -200
  66. package/src/runs/shared/abort-recovery.ts +119 -0
  67. package/src/runs/shared/async-status-projection.ts +597 -0
  68. package/src/runs/shared/background-process-options.ts +9 -0
  69. package/src/runs/shared/child-identity.ts +19 -4
  70. package/src/runs/shared/child-launch-plan.ts +151 -0
  71. package/src/runs/shared/completion-evidence.ts +89 -0
  72. package/src/runs/shared/completion-guard.ts +1 -1
  73. package/src/runs/shared/dynamic-fanout.ts +2 -2
  74. package/src/runs/shared/host-step-status.ts +230 -0
  75. package/src/runs/shared/lane-metadata.ts +105 -0
  76. package/src/runs/shared/mcp-config-sources.ts +42 -6
  77. package/src/runs/shared/mcp-direct-tool-allowlist.ts +93 -143
  78. package/src/runs/shared/mcp-direct-tool-grant.ts +194 -0
  79. package/src/runs/shared/model-fallback.ts +9 -2
  80. package/src/runs/shared/mutation-evidence.ts +52 -3
  81. package/src/runs/shared/nested-events.ts +6 -2
  82. package/src/runs/shared/nested-render.ts +7 -3
  83. package/src/runs/shared/parallel-handoff.ts +419 -7
  84. package/src/runs/shared/parallel-utils.ts +7 -0
  85. package/src/runs/shared/pi-args.ts +67 -3
  86. package/src/runs/shared/single-output.ts +72 -22
  87. package/src/runs/shared/subagent-prompt-runtime.ts +33 -6
  88. package/src/runs/shared/workflow-graph.ts +15 -0
  89. package/src/runs/shared/worktree-cleanup-plan.ts +847 -0
  90. package/src/runs/shared/worktree.ts +18 -0
  91. package/src/shared/child-session-name.ts +46 -0
  92. package/src/shared/extension-context.ts +24 -0
  93. package/src/shared/formatters.ts +5 -2
  94. package/src/shared/launch-contract.ts +1 -1
  95. package/src/shared/settings.ts +9 -103
  96. package/src/shared/types.ts +232 -30
  97. package/src/shared/utils.ts +35 -55
  98. package/src/slash/delegation-adapters.ts +1 -8
  99. package/src/slash/delegation-request.ts +0 -4
  100. package/src/slash/slash-bridge.ts +1 -2
  101. package/src/slash/slash-commands.ts +369 -90
  102. package/src/slash/slash-live-state.ts +22 -11
  103. package/src/tui/fleet-status.ts +134 -75
  104. package/src/tui/fleet.ts +11 -5
  105. package/src/tui/render-helpers.ts +31 -0
  106. package/src/tui/render.ts +895 -121
  107. package/src/watchdog/change-signature.ts +40 -1
  108. package/src/watchdog/turn-delta.ts +1 -1
  109. package/src/workflows/chat-progress.ts +6 -3
  110. package/src/workflows/host-command.ts +235 -0
  111. package/src/workflows/scripted-workflow.ts +503 -38
  112. package/src/workflows/workflow-child-summary.ts +9 -5
  113. package/src/workflows/workflow-preflight.ts +270 -0
  114. package/src/workflows/workflow-receipt.ts +43 -4
  115. package/src/workflows/workflow-settlement.ts +246 -0
  116. 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;
@@ -439,6 +559,10 @@ export interface TimeoutRecoverySummary {
439
559
  termination: "timed-out" | "stopped";
440
560
  changedFiles: string[];
441
561
  truncated?: boolean;
562
+ /** True only when a timed-out child left tracked changes without its requested report. */
563
+ recoveryNeeded?: boolean;
564
+ reason?: "timed-out-with-dirty-worktree";
565
+ reportStatus?: "missing" | "written" | "not-requested" | "unknown";
442
566
  currentTool?: string;
443
567
  currentToolArgs?: string;
444
568
  currentPath?: string;
@@ -449,6 +573,9 @@ export interface TimeoutRecoverySummary {
449
573
  message: string;
450
574
  }
451
575
 
576
+ /** Safe parent-facing subset of a timeout recovery summary. */
577
+ export type TimeoutRecoveryProjection = Pick<TimeoutRecoverySummary, "termination" | "changedFiles" | "truncated" | "recoveryNeeded" | "reason" | "reportStatus">;
578
+
452
579
  export const SUBAGENT_LIFECYCLE_ARTIFACT_VERSION = 3;
453
580
  export type SubagentLifecycleArtifactVersion = typeof SUBAGENT_LIFECYCLE_ARTIFACT_VERSION;
454
581
 
@@ -636,6 +763,7 @@ export interface SteeringRecoveryDescriptor {
636
763
  thinking?: string;
637
764
  thinkingCeiling?: ThinkingLevel;
638
765
  tools?: string[];
766
+ allowNestedSubagents?: boolean;
639
767
  extensions?: string[];
640
768
  subagentOnlyExtensions?: string[];
641
769
  mcpDirectTools?: string[];
@@ -659,8 +787,8 @@ export interface SteeringRecoveryDescriptor {
659
787
  context?: "fresh" | "fork";
660
788
  /** Raw per-run bridge override. Omitted descriptors continue to use global config. */
661
789
  intercomBridge?: IntercomBridgeConfig;
790
+ lane?: WorkflowLaneMetadata;
662
791
  absoluteDeadlineAt?: number;
663
- initialTurnBudget?: ResolvedTurnBudget;
664
792
  initialToolBudget?: ResolvedToolBudget;
665
793
  maxSubagentDepth: number;
666
794
  maxOutput?: MaxOutputConfig;
@@ -674,7 +802,7 @@ export interface SteeringRecoveryDescriptor {
674
802
 
675
803
  export type PublicNestedStepSummary = Pick<
676
804
  NestedStepSummary,
677
- "agent" | "status" | "model" | "thinking" | "sessionFile" | "transcriptPath" | "transcriptError" | "activityState" | "lastActivityAt" | "currentTool" | "currentToolStartedAt" | "currentPath" | "turnCount" | "toolCount" | "toolBudget" | "toolBudgetBlocked" | "startedAt" | "endedAt" | "error" | "timedOut" | "stopped"
805
+ "agent" | "sessionName" | "status" | "model" | "thinking" | "sessionFile" | "transcriptPath" | "transcriptError" | "activityState" | "lastActivityAt" | "currentTool" | "currentToolStartedAt" | "currentPath" | "turnCount" | "toolCount" | "toolBudget" | "toolBudgetBlocked" | "startedAt" | "endedAt" | "error" | "timedOut" | "stopped"
678
806
  > & {
679
807
  children?: PublicNestedRunSummary[];
680
808
  };
@@ -687,7 +815,7 @@ export type CostSummary = {
687
815
 
688
816
  export type PublicNestedRunSummary = Pick<
689
817
  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"
818
+ "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
819
  > & {
692
820
  steps?: PublicNestedStepSummary[];
693
821
  children?: PublicNestedRunSummary[];
@@ -695,6 +823,8 @@ export type PublicNestedRunSummary = Pick<
695
823
 
696
824
  export interface SubagentResultIntercomChild {
697
825
  agent: string;
826
+ /** Human-readable display name for the child session, when derived at launch. */
827
+ sessionName?: string;
698
828
  /** Process/lifecycle status. It does not establish semantic task completion. */
699
829
  status: SubagentResultStatus;
700
830
  /** Whether the child produced substantive output before its process ended. */
@@ -743,6 +873,8 @@ export interface ChildWatchdogProgress {
743
873
  export interface AgentProgress {
744
874
  index: number;
745
875
  agent: string;
876
+ /** Human-readable display name for the child's session, when derived at launch. */
877
+ sessionName?: string;
746
878
  status: "pending" | "running" | "completed" | "failed" | "detached";
747
879
  activityState?: ActivityState;
748
880
  task: string;
@@ -778,6 +910,8 @@ export interface ToolCallSummary {
778
910
  interface ProgressSummary {
779
911
  index?: number;
780
912
  agent?: string;
913
+ /** Human-readable display name for the child's session, when derived at launch. */
914
+ sessionName?: string;
781
915
  status?: AgentProgress["status"];
782
916
  activityState?: ActivityState;
783
917
  skills?: string[];
@@ -1038,6 +1172,9 @@ export interface SingleResult {
1038
1172
  index: number;
1039
1173
  agent: string;
1040
1174
  task: string;
1175
+ /** Human-readable display name for the child's own session (agent + task
1176
+ * excerpt), when the launcher derived one. Display metadata only. */
1177
+ sessionName?: string;
1041
1178
  /** Resolved launch context for this child. */
1042
1179
  context?: "fresh" | "fork";
1043
1180
  exitCode: number;
@@ -1132,12 +1269,17 @@ export interface WaitCompletionChild {
1132
1269
  agent?: string;
1133
1270
  /** Child run identity where the producer records one (workflow children); artifact files are keyed by it. */
1134
1271
  runId?: string;
1272
+ /** Bounded accounting projection used by /subagent-cost after async completion. */
1273
+ usage?: Usage;
1274
+ /** Persisted Pi child session when available. */
1275
+ sessionFile?: string;
1135
1276
  success?: boolean;
1136
1277
  outputState?: SubagentOutputState;
1137
1278
  error?: string;
1138
1279
  model?: string;
1139
1280
  contextOverflow?: boolean;
1140
1281
  artifactPaths?: Partial<ArtifactPaths>;
1282
+ timeoutRecovery?: TimeoutRecoveryProjection;
1141
1283
  }
1142
1284
 
1143
1285
  /**
@@ -1156,6 +1298,27 @@ export interface WaitCompletion {
1156
1298
  workflowChildren?: WorkflowChildSummaryV1;
1157
1299
  }
1158
1300
 
1301
+ export interface AgentCapabilitiesSnapshot {
1302
+ agents: AgentCapabilityRow[];
1303
+ restrictedCount: number;
1304
+ capabilityCeilingSources?: string[];
1305
+ }
1306
+
1307
+ export interface AgentCapabilityRow {
1308
+ name: string;
1309
+ description: string;
1310
+ source: "builtin" | "package" | "user" | "project" | "runtime";
1311
+ executable: boolean;
1312
+ restrictionSources?: string[];
1313
+ aliases?: string[];
1314
+ runner: { type: "pi" } | { type: "external-cli"; adapter?: string; capabilities: ExternalCliCapabilities } | { type: "external-job"; provider: string; available?: boolean; capabilities: ExternalJobRunnerStatus["capabilities"] };
1315
+ tools: { ambient: boolean; names: string[]; mcpDirectTools: string[]; mutationTools?: string[] };
1316
+ model?: { value?: string; fallbackModels?: string[]; thinking?: string | false };
1317
+ execution?: { defaultAsync?: boolean; timeoutMs?: number };
1318
+ output?: { path?: string; mode?: OutputMode };
1319
+ extensions?: { names?: string[]; subagentOnly?: string[]; skills?: string[] };
1320
+ }
1321
+
1159
1322
  export interface Details {
1160
1323
  mode: SubagentResultMode | "management";
1161
1324
  runId?: string;
@@ -1172,6 +1335,12 @@ export interface Details {
1172
1335
  * identity never reaches tool_result details.
1173
1336
  */
1174
1337
  completions?: WaitCompletion[];
1338
+ wait?: {
1339
+ reason: "window_elapsed";
1340
+ timedOut: true;
1341
+ activeRunIds: string[];
1342
+ activeProviderItems: Array<{ provider: string; id: string }>;
1343
+ };
1175
1344
  controlEvents?: ControlEvent[];
1176
1345
  steering?: SteerActionResult;
1177
1346
  asyncId?: string;
@@ -1181,7 +1350,6 @@ export interface Details {
1181
1350
  deadlineAt?: number;
1182
1351
  timedOut?: boolean;
1183
1352
  stopped?: boolean;
1184
- turnBudget?: ResolvedTurnBudget;
1185
1353
  toolBudget?: ResolvedToolBudget;
1186
1354
  usageBudget?: UsageBudgetState;
1187
1355
  progress?: AgentProgress[];
@@ -1201,6 +1369,9 @@ export interface Details {
1201
1369
  totalSteps?: number; // Total steps in chain
1202
1370
  currentStepIndex?: number; // 0-indexed current step (for running chains)
1203
1371
  workflowGraph?: WorkflowGraphSnapshot;
1372
+ /** Validated, display-only fanout plan supplied with a workflow launch. */
1373
+ preflight?: WorkflowPreflightV1;
1374
+ preflightWarnings?: string[];
1204
1375
  outputs?: ChainOutputMap;
1205
1376
  // Aggregated child usage across all agents in the run
1206
1377
  totalChildUsage?: Usage;
@@ -1210,6 +1381,7 @@ export interface Details {
1210
1381
  runFanoutBudget?: RunFanoutBudgetSnapshot;
1211
1382
  runFanoutRejection?: RunFanoutRejection;
1212
1383
  activeAsyncCapacity?: ActiveAsyncCapacitySnapshot;
1384
+ agentCapabilities?: AgentCapabilitiesSnapshot;
1213
1385
  capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
1214
1386
  capabilityAudit?: SubagentCapabilityAudit;
1215
1387
  parallelHandoff?: ParallelHandoffReference;
@@ -1229,8 +1401,9 @@ export interface Details {
1229
1401
  mission?: MissionRecord;
1230
1402
  workflow?: {
1231
1403
  value?: unknown;
1404
+ preflightWarnings?: string[];
1232
1405
  trace: Array<{
1233
- operation: "run" | "status" | "steer";
1406
+ operation: "run" | "status" | "steer" | "host";
1234
1407
  key: string;
1235
1408
  state: "started" | "completed" | "failed" | "detached" | "stopped" | "reused" | "queued" | "delivered" | "missed";
1236
1409
  agent?: string;
@@ -1238,6 +1411,9 @@ export interface Details {
1238
1411
  phase?: string;
1239
1412
  label?: string;
1240
1413
  durationMs?: number;
1414
+ /** Internal provenance for a generated runs.lanes child key. */
1415
+ generatedLaneKey?: string;
1416
+ warning?: string;
1241
1417
  error?: string;
1242
1418
  }>;
1243
1419
  emits: unknown[];
@@ -1297,7 +1473,7 @@ export interface AsyncParallelGroupStatus {
1297
1473
  stepIndex: number;
1298
1474
  }
1299
1475
 
1300
- export type NestedRunState = "queued" | "running" | "complete" | "failed" | "paused" | "stopped" | "rejected";
1476
+ export type NestedRunState = "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1301
1477
  export type NestedOwnerState = "live" | "gone" | "unknown";
1302
1478
 
1303
1479
  export interface NestedRunAddress {
@@ -1311,7 +1487,9 @@ export interface NestedRunAddress {
1311
1487
 
1312
1488
  export interface NestedStepSummary {
1313
1489
  agent: string;
1314
- status: "pending" | "running" | "complete" | "completed" | "failed" | "paused" | "stopped" | "rejected";
1490
+ /** Human-readable display name for the child session, when derived at launch. */
1491
+ sessionName?: string;
1492
+ status: "pending" | "running" | "complete" | "completed" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1315
1493
  model?: string;
1316
1494
  thinking?: string;
1317
1495
  sessionFile?: string;
@@ -1362,6 +1540,8 @@ export interface NestedRunSummary extends NestedRunAddress {
1362
1540
  capabilityAudit?: SubagentCapabilityAudit;
1363
1541
  state: NestedRunState;
1364
1542
  agent?: string;
1543
+ /** Human-readable display name for the child session, when derived at launch. */
1544
+ sessionName?: string;
1365
1545
  agents?: string[];
1366
1546
  model?: string;
1367
1547
  thinking?: string;
@@ -1423,6 +1603,7 @@ export interface AsyncStartedEvent {
1423
1603
  chainStepCount?: number;
1424
1604
  parallelGroups?: AsyncParallelGroupStatus[];
1425
1605
  workflowGraph?: WorkflowGraphSnapshot;
1606
+ preflight?: WorkflowPreflightV1;
1426
1607
  launchContractDigest?: string;
1427
1608
  launchResolvedExtensions?: LaunchResolvedChildExtensionsV1;
1428
1609
  runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensionsV1;
@@ -1556,7 +1737,7 @@ export interface AsyncStatus {
1556
1737
  mode: SubagentRunMode;
1557
1738
  context?: "fresh" | "fork" | "mixed";
1558
1739
  isNested?: boolean;
1559
- state: "queued" | "running" | "complete" | "failed" | "paused" | "stopped" | "rejected";
1740
+ state: "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1560
1741
  /** Display-only dismissal marker for a reload-orphaned workflow. */
1561
1742
  displayDismissedAt?: number;
1562
1743
  error?: string;
@@ -1590,6 +1771,7 @@ export interface AsyncStatus {
1590
1771
  pendingAppends?: number;
1591
1772
  parallelGroups?: AsyncParallelGroupStatus[];
1592
1773
  workflowGraph?: WorkflowGraphSnapshot;
1774
+ preflight?: WorkflowPreflightV1;
1593
1775
  processTerminal?: ProcessTerminalV1;
1594
1776
  runFanoutBudget?: RunFanoutBudgetSnapshot;
1595
1777
  runFanoutBudgetDescriptor?: RunFanoutBudgetDescriptor;
@@ -1602,12 +1784,15 @@ export interface AsyncStatus {
1602
1784
  workflowChildren?: WorkflowChildSummaryV1;
1603
1785
  parentWorkflowRunId?: string;
1604
1786
  workflowKey?: string;
1787
+ lane?: WorkflowLaneMetadata;
1605
1788
  /** Set when a durable schedule launched this run, so completions can name their origin. */
1606
1789
  scheduleOrigin?: ScheduleOrigin;
1607
1790
  steps?: Array<{
1608
1791
  /** Stable caller-facing child identity for inspect/status/stop. */
1609
1792
  childId?: string;
1610
1793
  agent: string;
1794
+ /** Human-readable display name for the child session, when derived at launch. */
1795
+ sessionName?: string;
1611
1796
  runner?: ExternalCliRunnerStatus | ExternalJobRunnerStatus;
1612
1797
  externalProcess?: ExternalProcessStatus;
1613
1798
  externalJob?: ExternalJobStatus;
@@ -1618,6 +1803,11 @@ export interface AsyncStatus {
1618
1803
  phase?: string;
1619
1804
  label?: string;
1620
1805
  workflowKey?: string;
1806
+ lane?: WorkflowLaneMetadata;
1807
+ /** Display-only worktree path copied at launch; handoff remains authoritative. */
1808
+ worktreePath?: string;
1809
+ /** Display-only branch copied at launch; handoff remains authoritative. */
1810
+ branch?: string;
1621
1811
  /** Child run identity for workflow capacity reconciliation. */
1622
1812
  runId?: string;
1623
1813
  /** True only when this workflow child owns a detached async runner. */
@@ -1625,7 +1815,7 @@ export interface AsyncStatus {
1625
1815
  parentWorkflowRunId?: string;
1626
1816
  outputName?: string;
1627
1817
  structured?: boolean;
1628
- status: "pending" | "running" | "complete" | "completed" | "failed" | "paused" | "stopped" | "rejected";
1818
+ status: "pending" | "running" | "complete" | "completed" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1629
1819
  stopRequested?: boolean;
1630
1820
  stopRequestedAt?: number;
1631
1821
  children?: NestedRunSummary[];
@@ -1692,9 +1882,10 @@ export interface AsyncStatus {
1692
1882
  parallelHandoff?: ParallelHandoffReference;
1693
1883
  }
1694
1884
 
1695
- export type AsyncJobStep = NonNullable<AsyncStatus["steps"]>[number] & {
1885
+ export type AsyncJobStep = Omit<NonNullable<AsyncStatus["steps"]>[number], "timeoutRecovery"> & {
1696
1886
  index?: number;
1697
1887
  description?: string;
1888
+ timeoutRecovery?: TimeoutRecoveryProjection;
1698
1889
  };
1699
1890
 
1700
1891
  export interface AsyncJobState {
@@ -1706,7 +1897,7 @@ export interface AsyncJobState {
1706
1897
  cwd?: string;
1707
1898
  /** Parent-resolved child session root retained for trusted live transcript lookup. */
1708
1899
  sessionRoot?: string;
1709
- status: "queued" | "running" | "complete" | "failed" | "paused" | "stopped" | "rejected";
1900
+ status: "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1710
1901
  /** Short caller-facing task/goal shown in fleet surfaces when available. */
1711
1902
  description?: string;
1712
1903
  pid?: number;
@@ -1727,7 +1918,12 @@ export interface AsyncJobState {
1727
1918
  currentStep?: number;
1728
1919
  chainStepCount?: number;
1729
1920
  parallelGroups?: AsyncParallelGroupStatus[];
1921
+ /** Bounded host-owned CI/gate nodes loaded from the workflow status graph. */
1922
+ hostSteps?: HostStepNodeV1[];
1923
+ /** Full bounded workflow plan, including not-yet-materialized stages. */
1924
+ workflowGraph?: WorkflowGraphSnapshot;
1730
1925
  steps?: AsyncJobStep[];
1926
+ preflight?: WorkflowPreflightV1;
1731
1927
  stepsTotal?: number;
1732
1928
  runningSteps?: number;
1733
1929
  completedSteps?: number;
@@ -1757,10 +1953,13 @@ export interface AsyncJobState {
1757
1953
  workflowKey?: string;
1758
1954
  workflow?: Details["workflow"];
1759
1955
  workflowChildren?: WorkflowChildSummaryV1;
1956
+ lane?: WorkflowLaneMetadata;
1760
1957
  }
1761
1958
 
1762
1959
  export interface ForegroundResumeChild {
1763
1960
  agent: string;
1961
+ /** Human-readable display name for the child session, when derived at launch. */
1962
+ sessionName?: string;
1764
1963
  index: number;
1765
1964
  context?: "fresh" | "fork";
1766
1965
  sessionFile?: string;
@@ -1824,6 +2023,8 @@ export interface ForegroundResumeRun {
1824
2023
  export interface ForegroundChildControl {
1825
2024
  index: number;
1826
2025
  agent: string;
2026
+ /** Human-readable display name for the child's session, when derived at launch. */
2027
+ sessionName?: string;
1827
2028
  description?: string;
1828
2029
  startedAt: number;
1829
2030
  updatedAt: number;
@@ -1861,6 +2062,8 @@ export interface ForegroundRunControl {
1861
2062
  /** Effective working directory used to resolve live transcript artifacts. */
1862
2063
  cwd?: string;
1863
2064
  currentAgent?: string;
2065
+ /** Human-readable display name for the current child session, when derived at launch. */
2066
+ sessionName?: string;
1864
2067
  currentIndex?: number;
1865
2068
  /** Short caller-facing task/goal shown in fleet surfaces when available. */
1866
2069
  description?: string;
@@ -2074,10 +2277,7 @@ export interface RunSyncOptions {
2074
2277
  toolTimeoutMs?: number;
2075
2278
  /** Raw global config.toolTimeoutMs, used by the per-child resolver. */
2076
2279
  configToolTimeoutMs?: number;
2077
- turnBudget?: ResolvedTurnBudget;
2078
2280
  usageBudget?: UsageBudgetConfig;
2079
- /** Enforce maxTurns + graceTurns as a hard model-turn boundary. */
2080
- enforceHardTurnLimit?: boolean;
2081
2281
  toolBudget?: ResolvedToolBudget;
2082
2282
  allowZeroToolBudget?: boolean;
2083
2283
  allowIntercomDetach?: boolean;
@@ -2102,10 +2302,13 @@ export interface RunSyncOptions {
2102
2302
  sessionFile?: string;
2103
2303
  share?: boolean;
2104
2304
  outputPath?: string;
2305
+ outputClaimPath?: string;
2105
2306
  outputMode?: OutputMode;
2106
2307
  maxSubagentDepth?: number;
2107
2308
  /** Effective parent wait-tool setting propagated to the child runtime. */
2108
2309
  waitToolEnabled?: boolean;
2310
+ /** Effective parent default wait window propagated to the child runtime. */
2311
+ waitToolDefaultTimeoutMs?: number;
2109
2312
  capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
2110
2313
  runFanoutBudget?: RunFanoutBudgetDescriptor;
2111
2314
  nestedRoute?: NestedRouteInfo;
@@ -2303,7 +2506,6 @@ export interface ExtensionConfig {
2303
2506
  toolTimeoutMs?: number;
2304
2507
  control?: ControlConfig;
2305
2508
  completionBatch?: CompletionBatchConfig;
2306
- turnBudget?: TurnBudgetConfig;
2307
2509
  toolBudget?: ToolBudgetConfig;
2308
2510
  /** Opt-in native tool permissions. Bash remains outside this policy. */
2309
2511
  permissions?: import("../runs/shared/permissions.ts").PermissionConfig;
@@ -2435,7 +2637,7 @@ export const POLL_INTERVAL_MS = 250;
2435
2637
  export const WIDGET_ANIMATION_INTERVAL_MS = 1000;
2436
2638
  export const MAX_WIDGET_JOBS = 4;
2437
2639
  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;
2640
+ 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
2641
 
2440
2642
  export const DEFAULT_FORK_PREAMBLE =
2441
2643
  "You are a delegated subagent running from a fork of the parent session. " +