@xzzpig/pi-subagents 0.16.0 → 0.19.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 (166) hide show
  1. package/CHANGELOG.md +233 -1
  2. package/README.md +5 -3
  3. package/agents/claude-code-writer.md +1 -0
  4. package/agents/codex-exec-writer.md +1 -0
  5. package/agents/cursor-agent-writer.md +1 -0
  6. package/agents/reviewer.md +3 -2
  7. package/agents/worker.md +3 -2
  8. package/docs/agents.md +34 -21
  9. package/docs/configuration.md +82 -7
  10. package/docs/extension-api.md +75 -8
  11. package/docs/missions.md +13 -13
  12. package/docs/models.md +7 -5
  13. package/docs/observability.md +23 -13
  14. package/docs/standalone-background.md +5 -5
  15. package/docs/tool-reference.md +98 -100
  16. package/docs/watchdog.md +2 -0
  17. package/docs/workflows.md +214 -162
  18. package/inspector-runner.mjs +1 -1
  19. package/node_modules/@xzzpig/pi-components/package.json +4 -4
  20. package/package.json +15 -9
  21. package/prompts/council.md +6 -3
  22. package/prompts/review-loop.md +1 -1
  23. package/runner-peer-loader.mjs +4 -7
  24. package/runner-peer-preload.mjs +5 -7
  25. package/skills/council-mode/SKILL.md +1 -1
  26. package/skills/pi-subagents/SKILL.md +13 -5
  27. package/skills/pi-subagents/references/constraints-and-recipes.md +8 -5
  28. package/skills/pi-subagents/references/execution-controls.md +72 -69
  29. package/skills/pi-subagents/references/management-authoring-rpc.md +4 -4
  30. package/skills/pi-subagents/references/multi-lane-orchestration.md +9 -1
  31. package/skills/pi-subagents/references/prompting-and-roles.md +52 -54
  32. package/src/agents/advertised-agent-prompt.ts +21 -41
  33. package/src/agents/agent-eject.ts +3 -3
  34. package/src/agents/agent-management.ts +63 -54
  35. package/src/agents/agent-memory.ts +90 -3
  36. package/src/agents/agent-serializer.ts +4 -4
  37. package/src/agents/agents.ts +132 -51
  38. package/src/agents/global-npm-root.ts +58 -0
  39. package/src/agents/proactive-skills.ts +4 -1
  40. package/src/agents/runtime-agent-registry.ts +14 -11
  41. package/src/agents/skills.ts +42 -9
  42. package/src/api/delegation.ts +15 -0
  43. package/src/api/inspectors.ts +27 -0
  44. package/src/api/preflight.ts +7 -2
  45. package/src/extension/config.ts +12 -4
  46. package/src/extension/control-notices.ts +3 -0
  47. package/src/extension/doctor.ts +10 -4
  48. package/src/extension/fanout-child.ts +20 -3
  49. package/src/extension/herdr-pi-bridge.ts +2 -0
  50. package/src/extension/index.ts +168 -206
  51. package/src/extension/public-execution.ts +69 -35
  52. package/src/extension/reply-workflow-script.ts +58 -0
  53. package/src/extension/rpc.ts +39 -11
  54. package/src/extension/schemas.ts +47 -138
  55. package/src/extension/subagent-guide.ts +12 -4
  56. package/src/extension/tool-activation.ts +146 -0
  57. package/src/extension/tool-description.ts +62 -27
  58. package/src/extension/upgrade-notice.ts +40 -0
  59. package/src/inspectors/ghostty/plugin.ts +13 -1
  60. package/src/inspectors/plugins.ts +70 -3
  61. package/src/integrations/herdr-status.ts +19 -3
  62. package/src/intercom/intercom-bridge.ts +2 -0
  63. package/src/intercom/native-supervisor-channel.ts +26 -16
  64. package/src/intercom/result-intercom.ts +4 -0
  65. package/src/runs/background/active-async-capacity.ts +3 -25
  66. package/src/runs/background/async-execution.ts +60 -95
  67. package/src/runs/background/async-job-tracker.ts +91 -56
  68. package/src/runs/background/async-resume.ts +16 -8
  69. package/src/runs/background/async-retention.ts +46 -16
  70. package/src/runs/background/async-status.ts +2 -0
  71. package/src/runs/background/await-async-run.ts +76 -0
  72. package/src/runs/background/binary-bootstrap.ts +34 -6
  73. package/src/runs/background/chain-root-attachment.ts +4 -4
  74. package/src/runs/background/control-channel.ts +18 -2
  75. package/src/runs/background/fleet-view.ts +51 -7
  76. package/src/runs/background/notify.ts +98 -7
  77. package/src/runs/background/pid-namespace.ts +18 -0
  78. package/src/runs/background/process-terminal-candidate.ts +98 -0
  79. package/src/runs/background/process-terminal.ts +17 -96
  80. package/src/runs/background/result-watcher.ts +1 -1
  81. package/src/runs/background/retained-children.ts +3 -2
  82. package/src/runs/background/run-child-session.ts +20 -6
  83. package/src/runs/background/run-id-resolver.ts +10 -5
  84. package/src/runs/background/run-status.ts +16 -4
  85. package/src/runs/background/runner-aliases.ts +54 -16
  86. package/src/runs/background/runner-child-launch.ts +4 -2
  87. package/src/runs/background/runner-startup-failure.ts +56 -0
  88. package/src/runs/background/scheduled-runs.ts +5 -5
  89. package/src/runs/background/stale-run-reconciler.ts +19 -3
  90. package/src/runs/background/subagent-runner-bootstrap.ts +276 -0
  91. package/src/runs/background/subagent-runner.ts +111 -288
  92. package/src/runs/background/wait-tool.ts +2 -0
  93. package/src/runs/background/workflow-terminal-proof.ts +68 -0
  94. package/src/runs/foreground/async-stop-action.ts +17 -3
  95. package/src/runs/foreground/execution.ts +111 -139
  96. package/src/runs/foreground/prompt-audit.ts +3 -9
  97. package/src/runs/foreground/subagent-executor.ts +715 -258
  98. package/src/runs/shared/acceptance.ts +167 -68
  99. package/src/runs/shared/async-status-projection.ts +5 -0
  100. package/src/runs/shared/capability-ceiling.ts +4 -1
  101. package/src/runs/shared/child-hooks.ts +1 -16
  102. package/src/runs/shared/child-launch.ts +37 -16
  103. package/src/runs/shared/child-runtime-config.ts +3 -0
  104. package/src/runs/shared/child-session.ts +144 -8
  105. package/src/runs/shared/child-tool-plan.ts +38 -116
  106. package/src/runs/shared/dynamic-fanout.ts +1 -1
  107. package/src/runs/shared/external-cli-runner.ts +3 -1
  108. package/src/runs/shared/external-job-bridge.ts +54 -0
  109. package/src/runs/shared/git-environment.ts +29 -0
  110. package/src/runs/shared/mcp-config-sources.ts +5 -1
  111. package/src/runs/shared/mcp-direct-tool-allowlist.ts +104 -12
  112. package/src/runs/shared/mcp-direct-tool-grant.ts +22 -6
  113. package/src/runs/shared/model-resolution.ts +35 -10
  114. package/src/runs/shared/model-scope.ts +28 -9
  115. package/src/runs/shared/nested-events.ts +12 -0
  116. package/src/runs/shared/orca-progress-tabs.ts +3 -2
  117. package/src/runs/shared/parallel-utils.ts +4 -1
  118. package/src/runs/shared/pi-spawn.ts +1 -3
  119. package/src/runs/shared/single-output.ts +11 -2
  120. package/src/runs/shared/structured-output.ts +227 -7
  121. package/src/runs/shared/subagent-control.ts +2 -16
  122. package/src/runs/shared/subagent-prompt-runtime.ts +29 -5
  123. package/src/runs/shared/tool-availability.ts +2 -2
  124. package/src/runs/shared/tool-budget.ts +21 -0
  125. package/src/runs/shared/usage-reconciliation.ts +73 -0
  126. package/src/runs/shared/worktree.ts +36 -9
  127. package/src/shared/child-session-name.ts +4 -2
  128. package/src/shared/disabled-features.ts +123 -0
  129. package/src/shared/extension-context.ts +13 -0
  130. package/src/shared/fork-context.ts +11 -4
  131. package/src/shared/launch-contract.ts +1 -1
  132. package/src/shared/model-info.ts +9 -0
  133. package/src/shared/pruned-fork.ts +69 -56
  134. package/src/shared/settings.ts +1 -1
  135. package/src/shared/types.ts +73 -16
  136. package/src/slash/delegation-adapters.ts +25 -1
  137. package/src/slash/prompt-template-bridge.ts +18 -3
  138. package/src/slash/prompt-workflows.ts +12 -1
  139. package/src/slash/slash-commands.ts +17 -246
  140. package/src/slash/subagent-cost.ts +313 -0
  141. package/src/slash/subagents-admin.ts +4 -5
  142. package/src/tui/fleet-status.ts +38 -8
  143. package/src/tui/fleet.ts +21 -6
  144. package/src/tui/render.ts +166 -71
  145. package/src/tui/running-tone.ts +28 -0
  146. package/src/watchdog/diff-tool.ts +47 -12
  147. package/src/watchdog/permission-arbiter.ts +13 -15
  148. package/src/watchdog/register-child.ts +13 -5
  149. package/src/watchdog/register-main.ts +3 -3
  150. package/src/watchdog/review.ts +16 -16
  151. package/src/watchdog/runtime.ts +2 -1
  152. package/src/watchdog/turn-delta.ts +12 -6
  153. package/src/workflows/chat-progress.ts +2 -2
  154. package/src/workflows/scripted-workflow.ts +225 -59
  155. package/src/workflows/structured-workflow-scripts.ts +177 -0
  156. package/src/workflows/workflow-checklist.ts +6 -0
  157. package/src/workflows/workflow-child-summary.ts +4 -2
  158. package/src/workflows/workflow-receipt.ts +8 -2
  159. package/src/workflows/workflow-resources.ts +37 -12
  160. package/src/workflows/workflow-reuse.ts +120 -0
  161. package/src/workflows/workflow-revival.ts +123 -0
  162. package/src/workflows/workflow-settlement.ts +4 -1
  163. package/src/runs/shared/completion-evidence.ts +0 -89
  164. package/src/runs/shared/completion-guard.ts +0 -255
  165. package/src/runs/shared/llm-intent-arbiter.ts +0 -321
  166. package/src/runs/shared/task-intent.ts +0 -244
@@ -38,12 +38,12 @@ function sourceRank(source: AgentConfig["source"]): number {
38
38
  return 3;
39
39
  }
40
40
 
41
- function allVisibleAgents(pi: RuntimeAgentOwner, cwd: string): AgentConfig[] {
42
- const d = discoverAgentsAll(cwd);
41
+ function allVisibleAgents(pi: RuntimeAgentOwner, cwd: string, preferredModelProvider?: string): AgentConfig[] {
42
+ const d = discoverAgentsAll(cwd, preferredModelProvider);
43
43
  const allConfigured = [...d.project, ...d.user, ...d.package, ...d.builtin];
44
44
  const visibleConfigured = allConfigured.filter((agent) => !agent.disabled);
45
45
  // Disabled definitions remain in collision checks even though the panel hides them.
46
- const agents = mergeRuntimeAgents(pi, { agents: visibleConfigured }, allConfigured).agents;
46
+ const agents = mergeRuntimeAgents(pi, { agents: visibleConfigured }, allConfigured, { cwd, scope: "both", preferredModelProvider }).agents;
47
47
  return agents.sort((a, b) => a.name.localeCompare(b.name) || sourceRank(a.source) - sourceRank(b.source));
48
48
  }
49
49
 
@@ -125,7 +125,6 @@ function buildBuiltinBase(agent: AgentConfig): BuiltinAgentOverrideBase {
125
125
  ...(agent.mcpDirectTools !== undefined ? { mcpDirectTools: [...agent.mcpDirectTools] } : {}),
126
126
  ...(agent.subagentOnlyExtensions !== undefined ? { subagentOnlyExtensions: [...agent.subagentOnlyExtensions] } : {}),
127
127
  ...(agent.mutationTools !== undefined ? { mutationTools: [...agent.mutationTools] } : {}),
128
- ...(agent.completionGuard !== undefined ? { completionGuard: agent.completionGuard } : {}),
129
128
  ...(agent.toolBudget !== undefined ? { toolBudget: agent.toolBudget } : {}),
130
129
  };
131
130
  }
@@ -176,7 +175,7 @@ function readOnlyAgentMessage(agent: AgentConfig, field: EditableOverrideField):
176
175
  }
177
176
 
178
177
  async function selectAgent(pi: RuntimeAgentOwner, ctx: ExtensionContext, args: string): Promise<AgentSelection> {
179
- const agents = allVisibleAgents(pi, ctx.cwd);
178
+ const agents = allVisibleAgents(pi, ctx.cwd, ctx.model?.provider);
180
179
  const requestedName = args.trim().split(/\s+/)[0] ?? "";
181
180
  if (agents.length === 0) return { kind: "not-found", agents, requestedName: requestedName || undefined };
182
181
 
@@ -9,6 +9,8 @@ import { formatWorkflowJsonPreview } from "../workflows/scripted-workflow.ts";
9
9
  import { hostStepReportName, hostStepVerdictLabel } from "../runs/shared/host-step-status.ts";
10
10
  import { isStaleExtensionContextError } from "../shared/extension-context.ts";
11
11
  import { inlineWorkflowRenderKey } from "./render.ts";
12
+ import { runningTone } from "./running-tone.ts";
13
+ import { childThinkingLevel, type ThinkingLevel } from "../shared/model-info.ts";
12
14
  import { formatWorkflowChecklistBottleneck, formatWorkflowChecklistPhase, formatWorkflowChecklistSummary, projectWorkflowChecklist, type WorkflowChecklistPhase, type WorkflowChecklistProjection } from "../workflows/workflow-checklist.ts";
13
15
 
14
16
  export const FLEET_STATUS_WIDGET_KEY = "subagent-fleet-status";
@@ -75,6 +77,8 @@ type FleetNestedRow = {
75
77
  agentIdentity?: string;
76
78
  state: NestedRunSummary["state"] | NestedStepSummary["status"];
77
79
  modelThinking?: string;
80
+ /** Thinking level of the child this row stands for; it colors the running glyph. */
81
+ thinking?: ThinkingLevel;
78
82
  activity?: string;
79
83
  startedAt?: number;
80
84
  endedAt?: number;
@@ -178,8 +182,8 @@ function isWorkflowRowTerminal(row: AsyncStatusWorkflowRow): boolean {
178
182
  return row.state === "complete" || row.state === "completed";
179
183
  }
180
184
 
181
- function nestedStatusGlyph(state: FleetNestedRow["state"] | "planned", theme: Theme): string {
182
- if (state === "running") return theme.fg("accent", "●");
185
+ function nestedStatusGlyph(state: FleetNestedRow["state"] | "planned", theme: Theme, thinking?: ThinkingLevel): string {
186
+ if (state === "running") return runningTone(theme, thinking)("●");
183
187
  if (state === "queued" || state === "pending" || state === "planned") return theme.fg("muted", "◦");
184
188
  if (state === "complete" || state === "completed") return theme.fg("success", "✓");
185
189
  if (state === "failed" || state === "rejected") return theme.fg("error", "✗");
@@ -222,6 +226,7 @@ function nestedFleetRows(children: NestedRunSummary[] | undefined, visibleLimit:
222
226
  }
223
227
  const step = steps[stepIndex]!;
224
228
  const modelThinking = formatModelThinking(step.model, step.thinking) || undefined;
229
+ const thinking = childThinkingLevel(step);
225
230
  const activity = nestedActivity(step);
226
231
  rows.push({
227
232
  name: step.agent,
@@ -229,6 +234,7 @@ function nestedFleetRows(children: NestedRunSummary[] | undefined, visibleLimit:
229
234
  state: step.status,
230
235
  depth,
231
236
  ...(modelThinking ? { modelThinking } : {}),
237
+ ...(thinking ? { thinking } : {}),
232
238
  ...(activity ? { activity } : {}),
233
239
  ...(step.startedAt !== undefined ? { startedAt: step.startedAt } : {}),
234
240
  ...(step.endedAt !== undefined ? { endedAt: step.endedAt } : {}),
@@ -246,6 +252,7 @@ function nestedFleetRows(children: NestedRunSummary[] | undefined, visibleLimit:
246
252
  return false;
247
253
  }
248
254
  const modelThinking = formatModelThinking(child.model, child.thinking) || undefined;
255
+ const thinking = childThinkingLevel(child);
249
256
  const activity = nestedActivity(child);
250
257
  rows.push({
251
258
  name: nestedRunLabel(child),
@@ -253,6 +260,7 @@ function nestedFleetRows(children: NestedRunSummary[] | undefined, visibleLimit:
253
260
  state: child.state,
254
261
  depth,
255
262
  ...(modelThinking ? { modelThinking } : {}),
263
+ ...(thinking ? { thinking } : {}),
256
264
  ...(activity ? { activity } : {}),
257
265
  ...(child.startedAt !== undefined ? { startedAt: child.startedAt } : {}),
258
266
  ...(child.endedAt !== undefined ? { endedAt: child.endedAt } : {}),
@@ -538,6 +546,8 @@ export class SubagentFleetStatus {
538
546
  private selectedKey = "main";
539
547
  private inspectorOpen = false;
540
548
  private lastRenderKey = "";
549
+ private lastPaint: { width: number; theme: Theme } | undefined;
550
+ private prepaint: { key: string; width: number; theme: Theme; lines: string[] } | undefined;
541
551
  private entries: FleetStatusEntry[] = [];
542
552
  private workflowSnapshots = new Map<string, { snapshot: string; childRows: Set<string> }>();
543
553
  private readonly onWorkflowCoverageChange: FleetStatusOptions["onWorkflowCoverageChange"];
@@ -594,6 +604,7 @@ export class SubagentFleetStatus {
594
604
  }
595
605
 
596
606
  refresh(): void {
607
+ this.prepaint = undefined;
597
608
  const ctx = this.getActiveUiContext();
598
609
  if (!ctx) return;
599
610
  if (this.state.widgetsSuspended) {
@@ -662,17 +673,34 @@ export class SubagentFleetStatus {
662
673
  }
663
674
 
664
675
  const renderKey = this.getRenderKey();
665
- if (!this.active || renderKey !== this.lastRenderKey) this.clearWorkflowCoverage();
676
+ if (!this.active) this.clearWorkflowCoverage();
677
+ // The async widget paints above the roster, so recompute coverage (structure and row fit) now.
678
+ // Clearing it instead would flash the full workflow tree on every live-stat tick.
679
+ else if (renderKey !== this.lastRenderKey && this.lastPaint) {
680
+ const { width, theme } = this.lastPaint;
681
+ this.prepaint = { key: renderKey, width, theme, lines: this.render(width, theme) };
682
+ }
666
683
  if (!this.widgetRegistered) {
667
684
  ctx.ui.setWidget(FLEET_STATUS_WIDGET_KEY, (tui, theme) => {
668
685
  this.tui = tui;
669
686
  return {
670
- render: (width: number) => this.render(width, theme),
687
+ render: (width: number) => {
688
+ this.lastPaint = { width, theme };
689
+ const prepaint = this.prepaint;
690
+ this.prepaint = undefined;
691
+ if (prepaint && prepaint.key === this.lastRenderKey && prepaint.key === this.getRenderKey()
692
+ && prepaint.width === width && prepaint.theme === theme && !this.state.widgetsSuspended
693
+ && !this.inspectorOpen && !this.state.fleetInspectorOpen) return prepaint.lines;
694
+ return this.render(width, theme);
695
+ },
671
696
  invalidate: () => {
672
697
  this.lastRenderKey = "";
698
+ this.prepaint = undefined;
673
699
  },
674
700
  dispose: () => {
675
701
  if (this.tui !== tui) return;
702
+ this.prepaint = undefined;
703
+ this.lastPaint = undefined;
676
704
  this.clearWorkflowCoverage();
677
705
  this.widgetRegistered = false;
678
706
  this.tui = undefined;
@@ -876,13 +904,13 @@ export class SubagentFleetStatus {
876
904
  if (row.overflow !== undefined) return truncateToWidth(`${indent}${marker} ${theme.fg("dim", `+${row.overflow} nested leaves`)}`, width);
877
905
  const modelThinking = row.modelThinking ? ` (${row.modelThinking})` : "";
878
906
  const activity = row.activity ? ` · ${row.activity}` : "";
879
- const left = `${indent}${marker} ${nestedStatusGlyph(row.state, theme)} ${theme.fg(fleetAgentIdentityColor(row.agentIdentity ?? row.name), `${row.name}${modelThinking}`)} · ${row.state}${activity}`;
907
+ const left = `${indent}${marker} ${nestedStatusGlyph(row.state, theme, row.thinking)} ${theme.fg(fleetAgentIdentityColor(row.agentIdentity ?? row.name), `${row.name}${modelThinking}`)} · ${row.state}${activity}`;
880
908
  const elapsed = detailElapsed(row);
881
909
  return truncateToWidth(`${left}${elapsed !== undefined ? theme.fg("dim", ` · ${elapsed}`) : ""}`, width);
882
910
  }
883
911
 
884
912
  private workflowRowGlyph(row: AsyncStatusWorkflowRow, theme: Theme): string {
885
- if (!row.kind) return nestedStatusGlyph(row.state as FleetNestedRow["state"], theme);
913
+ if (!row.kind) return nestedStatusGlyph(row.state as FleetNestedRow["state"], theme, row.thinking);
886
914
  const state = row.state as HostStepState;
887
915
  if (state === "pending") return theme.fg("muted", "◦");
888
916
  if (state === "running") return theme.fg("accent", "●");
@@ -893,7 +921,7 @@ export class SubagentFleetStatus {
893
921
 
894
922
  private workflowRowStateLabel(row: AsyncStatusWorkflowRow, theme: Theme): string {
895
923
  const state = row.kind ? hostStepVerdictLabel(row.state as HostStepState, row.verdict as HostStepVerdict | undefined) : row.state;
896
- if (state === "running") return theme.fg("accent", state);
924
+ if (state === "running") return row.kind ? theme.fg("accent", state) : runningTone(theme, row.thinking)(state);
897
925
  if (state === "pending" || state === "queued") return theme.fg("muted", state);
898
926
  if (state === "pass" || state === "complete" || state === "completed") return theme.fg("success", state === "pass" ? "pass" : "complete");
899
927
  if (state === "fail" || state === "failed" || state === "error") return theme.fg("error", state === "fail" ? "fail" : state);
@@ -905,7 +933,7 @@ export class SubagentFleetStatus {
905
933
  const glyph = phase.state === "complete"
906
934
  ? theme.fg("success", "✓")
907
935
  : phase.state === "running"
908
- ? theme.fg("accent", "●")
936
+ ? runningTone(theme)("●")
909
937
  : phase.state === "blocked" || phase.state === "failed"
910
938
  ? theme.fg("error", phase.state === "blocked" ? "!" : "✗")
911
939
  : phase.state === "queued"
@@ -1057,6 +1085,7 @@ export class SubagentFleetStatus {
1057
1085
  }
1058
1086
 
1059
1087
  private clearWidget(): void {
1088
+ this.prepaint = undefined;
1060
1089
  this.clearWorkflowCoverage();
1061
1090
  if (!this.widgetRegistered) return;
1062
1091
  try {
@@ -1071,6 +1100,7 @@ export class SubagentFleetStatus {
1071
1100
  }
1072
1101
 
1073
1102
  private clearUiRegistration(): void {
1103
+ this.prepaint = undefined;
1074
1104
  this.clearWorkflowCoverage();
1075
1105
  if (this.timer) clearInterval(this.timer);
1076
1106
  this.timer = undefined;
package/src/tui/fleet.ts CHANGED
@@ -23,8 +23,10 @@ import { stopAsyncRun } from "../runs/foreground/async-stop-action.ts";
23
23
  import { resolveWorkflowForegroundSteeringTarget, steerWorkflowForegroundTarget } from "../runs/foreground/workflow-foreground-steering.ts";
24
24
  import { contextModeBadge, contextModeLabel } from "../runs/shared/context-mode.ts";
25
25
  import { FLEET_STATUS_WIDGET_KEY } from "./fleet-status.ts";
26
- import { readFleetTranscript, renderFleetTranscript } from "./fleet-transcript.ts";
26
+ import { readFleetTranscript, renderFleetTranscript, type FleetTranscript } from "./fleet-transcript.ts";
27
27
  import { buildNativeFleetTranscript, loadNativeTranscriptSupport, type NativeTranscriptModule } from "./fleet-native-transcript.ts";
28
+ import { runningTone } from "./running-tone.ts";
29
+ import { childThinkingLevel, type ThinkingLevel } from "../shared/model-info.ts";
28
30
  import { handleInspectorAction } from "../inspectors/actions.ts";
29
31
  import type { InspectorPlugin } from "../inspectors/types.ts";
30
32
  import { getLivePromptAudit, type LivePromptAudit, type PromptAuditView } from "../runs/foreground/prompt-audit.ts";
@@ -120,7 +122,7 @@ export interface FleetViewOptions {
120
122
  fleetKeybindings?: FleetKeybindingsConfig;
121
123
  actions?: FleetActionHandlers;
122
124
  copyText?: (text: string) => Promise<void> | void;
123
- inspectorPlugins?: readonly InspectorPlugin[];
125
+ inspectorPlugins?: () => readonly InspectorPlugin[];
124
126
  inspectorEnv?: NodeJS.ProcessEnv;
125
127
  /** Event bus used to claim the fleet dialog as a silent span. */
126
128
  events?: UiSpanSilentEvents;
@@ -360,8 +362,18 @@ function visibleWorkflowParentKeyForForegroundKey(state: SubagentState, key: str
360
362
  return undefined;
361
363
  }
362
364
 
365
+ /** The recorded level of the one child a running Fleet row stands for; a whole run or an external run has none. */
366
+ function fleetItemThinkingLevel(item: FleetItem): ThinkingLevel | undefined {
367
+ switch (item.kind) {
368
+ case "foreground-active": return childThinkingLevel(item.activeChild ?? item.control);
369
+ case "foreground-recent": return childThinkingLevel(item.child);
370
+ case "async": return childThinkingLevel(item.step);
371
+ case "external": return undefined;
372
+ }
373
+ }
374
+
363
375
  function statusGlyph(item: FleetItem, theme: Theme): string {
364
- if (item.state === "running") return theme.fg("accent", "●");
376
+ if (item.state === "running") return runningTone(theme, fleetItemThinkingLevel(item))("●");
365
377
  if (item.state === "queued" || item.state === "pending") return theme.fg("muted", "◦");
366
378
  if (item.state === "complete" || item.state === "completed") return theme.fg("success", "✓");
367
379
  if (item.state === "paused" || item.state === "stopped" || item.state === "detached") return theme.fg("warning", "■");
@@ -679,6 +691,9 @@ function transcriptTarget(item: FleetItem, state: SubagentState): { path: string
679
691
  };
680
692
  }
681
693
  const step = item.step ?? (item.run.steps.length === 1 ? item.run.steps[0] : undefined);
694
+ // External CLI logs are plain text, not structured session JSONL. Let the
695
+ // bounded async detail formatter select final output/stderr/stdout instead.
696
+ if (step?.runner?.type === "external-cli") return undefined;
682
697
  const recordedSessionFile = step?.sessionFile ?? item.run.sessionFile;
683
698
  const recordedPath = step?.transcriptPath ?? recordedSessionFile;
684
699
  if (!recordedPath) return undefined;
@@ -1544,7 +1559,7 @@ export async function openSubagentFleet(ctx: ExtensionContext, state: SubagentSt
1544
1559
  cwd: state.baseCwd,
1545
1560
  ...(state.authorityPolicy ? { authorityPolicy: state.authorityPolicy } : {}),
1546
1561
  ...(state.missionStoreConfig ? { missions: state.missionStoreConfig } : {}),
1547
- ...(options.inspectorPlugins ? { plugins: options.inspectorPlugins } : {}),
1562
+ plugins: options.inspectorPlugins?.(),
1548
1563
  ...(options.inspectorEnv ? { env: options.inspectorEnv } : {}),
1549
1564
  }), `Failed to open inspector for async run ${input.runId}.`),
1550
1565
  redoPrompt: async (input: { runId: string; index: number; guidance: string; control?: ForegroundRunControl }) => {
@@ -1574,8 +1589,8 @@ export interface OpenFleetFromStatusOptions {
1574
1589
  asyncDirRoot: string;
1575
1590
  resultsDir: string;
1576
1591
  fleetKeybindings?: FleetKeybindingsConfig;
1577
- /** Built-in inspector plugins, when the caller hosts inspector integration. */
1578
- inspectorPlugins?: readonly InspectorPlugin[];
1592
+ /** Lazy inspector plugins, when the caller hosts inspector integration. */
1593
+ inspectorPlugins?: () => readonly InspectorPlugin[];
1579
1594
  }
1580
1595
 
1581
1596
  /**