pi-subagents 0.83.1 → 0.85.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 (206) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-5YIITCPD.js → chunk-3UZ5FVVJ.js} +322 -110
  5. package/bundle/{chunk-F4ASL6OV.js → chunk-7MAE3DJV.js} +1 -1
  6. package/bundle/{chunk-YXFJVCOL.js → chunk-CS4O36CZ.js} +11 -156
  7. package/bundle/{chunk-AHIFYGR3.js → chunk-DV2NCNPR.js} +22 -11
  8. package/bundle/{chunk-G2Z6ZH26.js → chunk-GCSLVFCX.js} +1 -1
  9. package/bundle/{chunk-2S4K53MV.js → chunk-H2NLFTC5.js} +1 -1
  10. package/bundle/{chunk-MABL3FUM.js → chunk-HFTBF7SG.js} +2 -1
  11. package/bundle/chunk-HXRB42AF.js +108 -0
  12. package/bundle/{chunk-UFL7IYCW.js → chunk-IQIWF2VX.js} +190 -1177
  13. package/bundle/{chunk-NPIYWVOD.js → chunk-JNXT3MPI.js} +15 -6
  14. package/bundle/{chunk-C7JMPU5F.js → chunk-JO67XSKD.js} +59 -27
  15. package/bundle/{chunk-UUP372DR.js → chunk-JWYG26RE.js} +223 -93
  16. package/bundle/{chunk-C5P5CHYK.js → chunk-KDMFBYFM.js} +1 -1
  17. package/bundle/{chunk-V2BZYLEP.js → chunk-KEY3UQMQ.js} +7 -2
  18. package/bundle/{chunk-VLFZIN6D.js → chunk-KZ34KQQH.js} +9 -6
  19. package/bundle/{chunk-ZVOAMTUQ.js → chunk-L2ENOFVZ.js} +76 -58
  20. package/bundle/{chunk-RNIZLSEA.js → chunk-LGMILZNE.js} +323 -18
  21. package/bundle/{chunk-UYK5MZWE.js → chunk-LTPH2DXH.js} +247 -153
  22. package/bundle/{chunk-2D52JFLF.js → chunk-N7B2KD74.js} +41 -117
  23. package/bundle/{chunk-IPGZMQXV.js → chunk-O7CPL6H4.js} +183 -28
  24. package/bundle/{chunk-D3JAFGMO.js → chunk-PHZP3KHB.js} +1 -1
  25. package/bundle/{chunk-2DHZTCOL.js → chunk-PVIVCDG2.js} +2 -2
  26. package/bundle/{chunk-LFDBD4PW.js → chunk-QO75KJBT.js} +2 -2
  27. package/bundle/{chunk-SSG7IEP5.js → chunk-RQAUNAWG.js} +2 -2
  28. package/bundle/{chunk-QP5ZWNIS.js → chunk-RV5OGHLO.js} +6 -3
  29. package/bundle/chunk-T5V5BRCL.js +1067 -0
  30. package/bundle/{chunk-LNRJCP2Y.js → chunk-UX4SCV5N.js} +337 -207
  31. package/bundle/{chunk-F5DBXJ2G.js → chunk-WOVMHDES.js} +234 -182
  32. package/bundle/control-channel.js +2 -2
  33. package/bundle/index.js +1 -1
  34. package/bundle/intercom-bridge.js +2 -2
  35. package/bundle/preflight.js +8 -8
  36. package/bundle/project-panes.js +3 -3
  37. package/docs/agents.md +17 -2
  38. package/docs/configuration.md +2 -2
  39. package/docs/extension-api.md +16 -1
  40. package/docs/workflows.md +30 -2
  41. package/package.json +1 -1
  42. package/src/agents/agent-management.js +27 -11
  43. package/src/agents/agent-memory.d.ts +1 -4
  44. package/src/agents/agent-memory.js +1 -4
  45. package/src/agents/agents.d.ts +1 -3
  46. package/src/agents/agents.js +7 -6
  47. package/src/agents/frontmatter.js +1 -8
  48. package/src/agents/global-npm-root.d.ts +1 -0
  49. package/src/agents/global-npm-root.js +11 -3
  50. package/src/agents/skills.d.ts +0 -3
  51. package/src/agents/skills.js +0 -3
  52. package/src/extension/config.js +7 -1
  53. package/src/extension/herdr-pi-bridge.js +10 -2
  54. package/src/extension/index.d.ts +0 -13
  55. package/src/extension/index.js +43 -32
  56. package/src/extension/public-execution.d.ts +1 -0
  57. package/src/extension/public-execution.js +4 -0
  58. package/src/extension/reply-workflow-script.js +24 -4
  59. package/src/extension/schemas.d.ts +8 -3
  60. package/src/extension/schemas.js +5 -3
  61. package/src/extension/session-switch.d.ts +25 -0
  62. package/src/extension/session-switch.js +138 -0
  63. package/src/extension/subagent-guide.d.ts +1 -1
  64. package/src/extension/subagent-guide.js +1 -1
  65. package/src/extension/subagent-launch-tool.d.ts +25 -0
  66. package/src/extension/subagent-launch-tool.js +48 -0
  67. package/src/extension/tool-activation.js +25 -11
  68. package/src/extension/tool-description.js +6 -0
  69. package/src/inspectors/herdr/actions.d.ts +0 -1
  70. package/src/inspectors/herdr/actions.js +0 -1
  71. package/src/inspectors/session-roots-codec.d.ts +0 -1
  72. package/src/inspectors/session-roots-codec.js +0 -1
  73. package/src/inspectors/tmux/actions.d.ts +0 -1
  74. package/src/inspectors/tmux/actions.js +0 -1
  75. package/src/integrations/herdr-status.js +3 -8
  76. package/src/intercom/native-supervisor-channel.js +65 -9
  77. package/src/runs/background/async-execution.d.ts +8 -9
  78. package/src/runs/background/async-execution.js +77 -27
  79. package/src/runs/background/async-job-tracker.js +12 -0
  80. package/src/runs/background/async-resume.d.ts +2 -1
  81. package/src/runs/background/async-resume.js +112 -39
  82. package/src/runs/background/async-retention.d.ts +1 -0
  83. package/src/runs/background/async-retention.js +22 -11
  84. package/src/runs/background/auto-drain.js +2 -1
  85. package/src/runs/background/boot-id.d.ts +1 -3
  86. package/src/runs/background/boot-id.js +1 -3
  87. package/src/runs/background/completion-batcher.d.ts +3 -4
  88. package/src/runs/background/completion-batcher.js +2 -3
  89. package/src/runs/background/control-channel.d.ts +0 -6
  90. package/src/runs/background/control-channel.js +0 -6
  91. package/src/runs/background/fleet-view.js +2 -3
  92. package/src/runs/background/notify.d.ts +0 -2
  93. package/src/runs/background/notify.js +0 -2
  94. package/src/runs/background/result-watcher.d.ts +1 -0
  95. package/src/runs/background/result-watcher.js +59 -29
  96. package/src/runs/background/resume-guidance.js +4 -2
  97. package/src/runs/background/retained-children.js +2 -1
  98. package/src/runs/background/run-child-session.d.ts +2 -1
  99. package/src/runs/background/run-child-session.js +10 -2
  100. package/src/runs/background/run-status.js +4 -3
  101. package/src/runs/background/scheduled-runs.d.ts +3 -1
  102. package/src/runs/background/scheduled-runs.js +13 -16
  103. package/src/runs/background/subagent-runner.d.ts +2 -4
  104. package/src/runs/background/subagent-runner.js +10 -6
  105. package/src/runs/background/subagent-wait.js +12 -15
  106. package/src/runs/background/wait-config.d.ts +2 -0
  107. package/src/runs/background/wait-config.js +17 -3
  108. package/src/runs/background/wait-tool.js +4 -2
  109. package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
  110. package/src/runs/background/workflow-terminal-proof.js +0 -1
  111. package/src/runs/foreground/execution.d.ts +0 -3
  112. package/src/runs/foreground/execution.js +17 -9
  113. package/src/runs/foreground/subagent-executor.d.ts +3 -2
  114. package/src/runs/foreground/subagent-executor.js +112 -26
  115. package/src/runs/shared/child-commands.js +15 -2
  116. package/src/runs/shared/child-hooks.d.ts +1 -7
  117. package/src/runs/shared/child-hooks.js +13 -5
  118. package/src/runs/shared/child-launch.js +6 -2
  119. package/src/runs/shared/child-runtime-config.d.ts +0 -1
  120. package/src/runs/shared/child-session.d.ts +3 -1
  121. package/src/runs/shared/child-session.js +22 -2
  122. package/src/runs/shared/child-tool-plan.d.ts +0 -1
  123. package/src/runs/shared/child-tool-plan.js +0 -1
  124. package/src/runs/shared/claude-code-adapter.js +11 -0
  125. package/src/runs/shared/external-cli-runner.js +26 -6
  126. package/src/runs/shared/herdr-connection.js +2 -1
  127. package/src/runs/shared/herdr-pane-host.d.ts +2 -2
  128. package/src/runs/shared/herdr-pane-host.js +17 -1
  129. package/src/runs/shared/herdr-placed-run.js +48 -22
  130. package/src/runs/shared/lane-metadata.d.ts +0 -1
  131. package/src/runs/shared/lane-metadata.js +0 -1
  132. package/src/runs/shared/mcp-direct-tool-grant.js +8 -1
  133. package/src/runs/shared/model-resolution-diagnostic.d.ts +11 -1
  134. package/src/runs/shared/model-resolution-diagnostic.js +25 -0
  135. package/src/runs/shared/model-resolution.d.ts +2 -2
  136. package/src/runs/shared/model-resolution.js +7 -1
  137. package/src/runs/shared/model-scope.d.ts +1 -5
  138. package/src/runs/shared/model-scope.js +1 -5
  139. package/src/runs/shared/mutation-evidence.d.ts +1 -1
  140. package/src/runs/shared/mutation-evidence.js +52 -7
  141. package/src/runs/shared/nested-events.d.ts +1 -0
  142. package/src/runs/shared/nested-events.js +1 -1
  143. package/src/runs/shared/parallel-utils.d.ts +2 -1
  144. package/src/runs/shared/permissions.js +5 -3
  145. package/src/runs/shared/placement-host.d.ts +5 -1
  146. package/src/runs/shared/rex-pane-host.d.ts +0 -1
  147. package/src/runs/shared/rex-pane-host.js +0 -2
  148. package/src/runs/shared/run-launch-folder.d.ts +12 -0
  149. package/src/runs/shared/run-launch-folder.js +21 -0
  150. package/src/runs/shared/runner-launcher.d.ts +12 -1
  151. package/src/runs/shared/runner-launcher.js +16 -0
  152. package/src/runs/shared/single-output.d.ts +3 -3
  153. package/src/runs/shared/single-output.js +5 -3
  154. package/src/runs/shared/structured-output.d.ts +8 -0
  155. package/src/runs/shared/structured-output.js +30 -2
  156. package/src/runs/shared/subagent-prompt-runtime.d.ts +0 -1
  157. package/src/runs/shared/subagent-prompt-runtime.js +4 -2
  158. package/src/runs/shared/tool-timeout.js +2 -1
  159. package/src/runs/shared/worktree-cleanup-plan.d.ts +0 -1
  160. package/src/runs/shared/worktree-cleanup-plan.js +0 -1
  161. package/src/runs/shared/worktree.d.ts +3 -0
  162. package/src/runs/shared/worktree.js +20 -0
  163. package/src/shared/capacity-resilient-json.d.ts +1 -1
  164. package/src/shared/child-cache-retention.d.ts +1 -2
  165. package/src/shared/child-cache-retention.js +1 -2
  166. package/src/shared/fleet-transcript-reader.d.ts +51 -0
  167. package/src/shared/fleet-transcript-reader.js +333 -0
  168. package/src/shared/formatters.d.ts +0 -18
  169. package/src/shared/formatters.js +0 -18
  170. package/src/shared/session-succession.d.ts +16 -1
  171. package/src/shared/session-succession.js +41 -2
  172. package/src/shared/session-warnings.d.ts +7 -0
  173. package/src/shared/session-warnings.js +26 -0
  174. package/src/shared/settings.d.ts +0 -23
  175. package/src/shared/settings.js +3 -35
  176. package/src/shared/types.d.ts +28 -11
  177. package/src/shared/types.js +0 -12
  178. package/src/shared/utils.d.ts +0 -14
  179. package/src/shared/utils.js +0 -22
  180. package/src/shared/wait-tool-name.d.ts +8 -0
  181. package/src/shared/wait-tool-name.js +13 -0
  182. package/src/slash/slash-commands.js +2 -1
  183. package/src/slash/subagent-cost.d.ts +3 -2
  184. package/src/slash/subagent-cost.js +22 -3
  185. package/src/slash/subagents-admin.js +0 -1
  186. package/src/tui/fleet-status.d.ts +0 -5
  187. package/src/tui/fleet-status.js +4 -24
  188. package/src/tui/fleet-transcript.d.ts +1 -44
  189. package/src/tui/fleet-transcript.js +1 -327
  190. package/src/tui/fleet.js +6 -4
  191. package/src/tui/render.d.ts +0 -9
  192. package/src/tui/render.js +81 -47
  193. package/src/tui/subagent-messages.js +3 -2
  194. package/src/watchdog/register-child.d.ts +2 -3
  195. package/src/watchdog/register-child.js +2 -3
  196. package/src/watchdog/turn-delta.js +2 -1
  197. package/src/workflows/scripted-workflow.js +243 -20
  198. package/src/workflows/workflow-launch-record.d.ts +15 -6
  199. package/src/workflows/workflow-launch-record.js +30 -12
  200. package/src/workflows/workflow-resume-claim.js +2 -2
  201. package/src/workflows/workflow-resume.d.ts +1 -1
  202. package/src/workflows/workflow-resume.js +11 -8
  203. package/src/workflows/workflow-script-worker.d.ts +13 -0
  204. package/src/workflows/workflow-script-worker.js +79 -0
  205. package/workflow-script-process.cjs +36 -0
  206. package/workflow-script-worker.cjs +453 -176
@@ -1,6 +1,3 @@
1
- /**
2
- * Chain behavior, template resolution, and directory management
3
- */
4
1
  import * as fs from "node:fs";
5
2
  import * as os from "node:os";
6
3
  import * as path from "node:path";
@@ -8,19 +5,15 @@ import { discoverAgents, formatUnknownAgentError, unknownAgentDiagnosticContext
8
5
  import { normalizeSkillInput } from "../agents/skills.js";
9
6
  import { normalizeOutputOverride } from "../runs/shared/child-launch-plan.js";
10
7
  import { CHAIN_RUNS_DIR } from "./types.js";
11
- const CHAIN_DIR_MAX_AGE_MS = 24 * 60 * 60 * 1000; // 24 hours
8
+ const CHAIN_DIR_MAX_AGE_MS = 24 * 60 * 60 * 1000;
12
9
  const INITIAL_PROGRESS_CONTENT = "# Progress\n\n## Status\nIn Progress\n\n## Tasks\n\n## Files Changed\n\n## Notes\n";
13
10
  export { planChildLaunch, resolveStepBehavior, resolveTaskTextForFileUpdatePolicy, suppressProgressForReadOnlyTask, taskDisallowsFileUpdates, } from "../runs/shared/child-launch-plan.js";
14
- // =============================================================================
15
- // Type Guards
16
- // =============================================================================
17
11
  export function isParallelStep(step) {
18
12
  return "parallel" in step && Array.isArray(step.parallel);
19
13
  }
20
14
  export function isDynamicParallelStep(step) {
21
15
  return "expand" in step && "collect" in step && "parallel" in step && !Array.isArray(step.parallel);
22
16
  }
23
- /** Get all agent names in a step (single for sequential, multiple for parallel) */
24
17
  export function getStepAgents(step) {
25
18
  if (isParallelStep(step)) {
26
19
  return step.parallel.map((t) => t.agent);
@@ -30,9 +23,6 @@ export function getStepAgents(step) {
30
23
  }
31
24
  return [step.agent];
32
25
  }
33
- // =============================================================================
34
- // Chain Directory Management
35
- // =============================================================================
36
26
  export function createChainDir(runId, baseDir) {
37
27
  const chainDir = path.join(baseDir ? path.resolve(baseDir) : CHAIN_RUNS_DIR, runId);
38
28
  fs.mkdirSync(chainDir, { recursive: true });
@@ -72,35 +62,24 @@ export function cleanupOldChainDirs() {
72
62
  }
73
63
  }
74
64
  }
75
- /**
76
- * Resolve templates for a chain with parallel step support.
77
- * Returns string for sequential steps, string[] for parallel steps.
78
- */
79
65
  export function resolveChainTemplates(steps) {
80
66
  return steps.map((step, i) => {
81
67
  if (isParallelStep(step)) {
82
- // Parallel step: resolve each task's template
83
68
  return step.parallel.map((task) => {
84
69
  if (task.task)
85
70
  return task.task;
86
- // Default for parallel tasks is {previous}
87
71
  return "{previous}";
88
72
  });
89
73
  }
90
74
  if (isDynamicParallelStep(step)) {
91
75
  return step.parallel.task ?? "{previous}";
92
76
  }
93
- // Sequential step: existing logic
94
77
  const seq = step;
95
78
  if (seq.task)
96
79
  return seq.task;
97
- // Default: first step uses {task}, others use {previous}
98
80
  return i === 0 ? "{task}" : "{previous}";
99
81
  });
100
82
  }
101
- // =============================================================================
102
- // Chain Instruction Injection
103
- // =============================================================================
104
83
  /**
105
84
  * Expand a leading `~`/`~/` to the user's home directory. Other forms (relative,
106
85
  * absolute, `~user/`) pass through unchanged.
@@ -130,10 +109,6 @@ export function resolveExistingReadInstructionPaths(reads, instructionCwd, exist
130
109
  export function resolveExistingReadPaths(reads, cwd) {
131
110
  return resolveExistingReadInstructionPaths(reads, cwd);
132
111
  }
133
- /**
134
- * Build chain instructions from resolved behavior.
135
- * These are appended to the task to tell the agent what to read/write.
136
- */
137
112
  export function writeInitialProgressFile(progressDir) {
138
113
  fs.mkdirSync(progressDir, { recursive: true });
139
114
  fs.writeFileSync(path.join(progressDir, "progress.md"), INITIAL_PROGRESS_CONTENT);
@@ -162,7 +137,6 @@ export function buildChainInstructions(behavior, chainDir, isFirstProgressAgent,
162
137
  suffixParts.push(`Update progress at: ${progressPath}`);
163
138
  }
164
139
  }
165
- // Include previous step's summary in suffix if available
166
140
  if (previousSummary && previousSummary.trim()) {
167
141
  suffixParts.push(`Previous step output:\n${previousSummary.trim()}`);
168
142
  }
@@ -185,7 +159,6 @@ export function resolveParallelBehaviors(tasks, agentConfigs, stepIndex, chainSk
185
159
  : unknownAgentDiagnosticContext(discoverAgents(path.resolve(diagnostics.cwd), diagnostics.scope ?? "both"));
186
160
  throw new Error(formatUnknownAgentError(task.agent, context));
187
161
  }
188
- // Build subdirectory path for this parallel task
189
162
  const subdir = path.join(`parallel-${stepIndex}`, `${taskIndex}-${task.agent}`);
190
163
  // Output: task override > agent default (namespaced) > false
191
164
  // Absolute paths pass through unchanged; relative paths get namespaced under subdir
@@ -197,19 +170,17 @@ export function resolveParallelBehaviors(tasks, agentConfigs, stepIndex, chainSk
197
170
  output = false;
198
171
  }
199
172
  else if (path.isAbsolute(taskOutput)) {
200
- output = taskOutput; // Absolute path: use as-is
173
+ output = taskOutput;
201
174
  }
202
175
  else {
203
- output = path.join(subdir, taskOutput); // Relative: namespace under subdir
176
+ output = path.join(subdir, taskOutput);
204
177
  }
205
178
  }
206
179
  else if (configOutput) {
207
180
  // Agent defaults are always relative, so namespace them
208
181
  output = path.join(subdir, configOutput);
209
182
  }
210
- // Reads: task override > agent default > false
211
183
  const reads = task.reads !== undefined ? task.reads : config.defaultReads ?? false;
212
- // Progress: task override > agent default > false
213
184
  const progress = task.progress !== undefined
214
185
  ? task.progress
215
186
  : config.defaultProgress ?? false;
@@ -235,9 +206,6 @@ export function resolveParallelBehaviors(tasks, agentConfigs, stepIndex, chainSk
235
206
  return { output, outputMode, reads, progress, skills, model };
236
207
  });
237
208
  }
238
- /**
239
- * Create subdirectories for parallel step outputs
240
- */
241
209
  export function createParallelDirs(chainDir, stepIndex, taskCount, agentNames) {
242
210
  for (let i = 0; i < taskCount; i++) {
243
211
  const subdir = path.join(chainDir, `parallel-${stepIndex}`, `${i}-${agentNames[i]}`);
@@ -1,6 +1,3 @@
1
- /**
2
- * Type definitions for the subagent extension
3
- */
4
1
  import type { Message } from "@earendil-works/pi-ai";
5
2
  import type { SubagentDelegationProviderDiagnostics } from "../api/delegation.ts";
6
3
  import type { AgentConfig } from "../agents/agents.ts";
@@ -340,6 +337,8 @@ export interface WaitToolConfigObject {
340
337
  enabled?: boolean;
341
338
  /** Default blocking window for bg_wait calls that omit timeoutMs. */
342
339
  defaultTimeoutMs?: number;
340
+ /** Registers the wait tool under this name instead of bg_wait, e.g. when another extension uses bg_wait. */
341
+ name?: string;
343
342
  }
344
343
  export type WaitToolConfig = boolean | WaitToolConfigObject;
345
344
  export interface ControlEvent {
@@ -749,13 +748,29 @@ export interface SteeringRecoveryDescriptor {
749
748
  requiredExtensions?: RequiredChildExtensionSnapshot;
750
749
  runFanoutBudget: RunFanoutBudgetDescriptor;
751
750
  sourceRunId: string;
751
+ /** The session that launched the run; only it, or a session that replaced it, may resume the run. */
752
+ sessionId?: string;
752
753
  agentContract?: AgentContract;
753
754
  agent: string;
754
755
  sessionFile?: string;
756
+ /**
757
+ * The managed worktree the launch chose, so a resume never takes its cwd from the run's own
758
+ * handoff.json alone: the native cwd the parent computed, or the Worktrunk branch it requested.
759
+ */
760
+ managedWorktree?: {
761
+ provider: "native";
762
+ cwd: string;
763
+ } | {
764
+ provider: "worktrunk";
765
+ branch: string;
766
+ };
755
767
  /** Git ref used to allocate managed worktrees for this run. */
756
768
  baseRef?: string;
757
- /** Launcher name the run was wrapped with; resume re-reads its argv from current user config. Absence means unwrapped. */
758
- launcher?: string;
769
+ /** Launcher name the run was wrapped with, or null when it ran unwrapped; resume re-reads its argv from current user config.
770
+ * Absence (descriptors written before null was recorded) means unknown: resume uses the agent file's current launcher. */
771
+ launcher?: string | null;
772
+ /** The launcher and agent definition digest the launch required; a resume refuses unless both still hold. */
773
+ requiredLauncher?: RequiredRunnerLauncher;
759
774
  cwd: string;
760
775
  model?: string;
761
776
  modelProvider?: string;
@@ -789,7 +804,6 @@ export interface SteeringRecoveryDescriptor {
789
804
  structuredOutputSchema?: JsonSchemaObject;
790
805
  acceptance?: AcceptanceInput;
791
806
  controlConfig?: ResolvedControlConfig;
792
- /** Resolved launch context for this async child. */
793
807
  context?: "fresh" | "fork";
794
808
  /** Raw per-run bridge override. Omitted descriptors continue to use global config. */
795
809
  intercomBridge?: IntercomBridgeConfig;
@@ -1147,7 +1161,6 @@ export interface SingleResult {
1147
1161
  /** Human-readable display name for the child's own session (agent + task
1148
1162
  * excerpt), when the launcher derived one. Display metadata only. */
1149
1163
  sessionName?: string;
1150
- /** Resolved launch context for this child. */
1151
1164
  context?: "fresh" | "fork";
1152
1165
  exitCode: number;
1153
1166
  processSignal?: string | null;
@@ -1247,7 +1260,6 @@ export interface WaitCompletionChild {
1247
1260
  runId?: string;
1248
1261
  /** Bounded accounting projection used by /subagent-cost after async completion. */
1249
1262
  usage?: Usage;
1250
- /** Persisted Pi child session when available. */
1251
1263
  sessionFile?: string;
1252
1264
  success?: boolean;
1253
1265
  outputState?: SubagentOutputState;
@@ -1315,6 +1327,7 @@ export interface AgentCapabilityRow {
1315
1327
  model?: {
1316
1328
  value?: string;
1317
1329
  thinking?: string | false;
1330
+ unavailable?: true;
1318
1331
  };
1319
1332
  execution?: {
1320
1333
  defaultAsync?: boolean;
@@ -1928,7 +1941,6 @@ export interface AsyncStatus {
1928
1941
  runner?: ExternalCliRunnerStatus | ExternalJobRunnerStatus;
1929
1942
  externalProcess?: ExternalProcessStatus;
1930
1943
  externalJob?: ExternalJobStatus;
1931
- /** Resolved launch context for this child step. */
1932
1944
  context?: "fresh" | "fork";
1933
1945
  /** Short caller-facing task/goal shown in fleet surfaces when available. */
1934
1946
  description?: string;
@@ -2403,6 +2415,11 @@ export interface RunnerLauncher {
2403
2415
  name: string;
2404
2416
  argv: string[];
2405
2417
  }
2418
+ /** A call's requirement that its agent runs under this launcher with this agent definition digest. */
2419
+ export interface RequiredRunnerLauncher {
2420
+ name: string;
2421
+ definitionDigest: string;
2422
+ }
2406
2423
  export declare const SUBAGENT_ASYNC_COMPLETE_EVENT = "subagent:async-complete";
2407
2424
  export declare const SUBAGENT_PROCESS_TERMINAL_EVENT = "subagent:process-terminal";
2408
2425
  export declare const SUBAGENT_FOREGROUND_COMPLETE_EVENT = "subagent:foreground-complete";
@@ -2457,7 +2474,6 @@ export interface RunSyncOptions {
2457
2474
  parentSessionId?: string;
2458
2475
  /** The parent session's file, recorded as a new child session's `parentSession` header. */
2459
2476
  parentSessionFile?: string;
2460
- /** Resolved launch context for this child. */
2461
2477
  context?: "fresh" | "fork";
2462
2478
  cwd?: string;
2463
2479
  /** Resolved pane-native saved-machine placement. */
@@ -2485,6 +2501,8 @@ export interface RunSyncOptions {
2485
2501
  /** Internal structured-delegation transport optimization: skip unchanged live snapshots. */
2486
2502
  suppressUnchangedDelegationUpdates?: boolean;
2487
2503
  onControlEvent?: (event: ControlEvent) => void;
2504
+ /** Reports a problem found by a timer callback, with a stable key to de-duplicate it; without it the message goes to stderr. */
2505
+ onWarning?: (message: string, key: string) => void;
2488
2506
  /** Exposes a non-terminating detach callback while the child is active. */
2489
2507
  onDetachReady?: (detach: (reason?: string) => boolean) => void;
2490
2508
  /** Internal foreground receipt proposal; returns true only when the outer waiter accepted it. */
@@ -2540,7 +2558,6 @@ export interface RunSyncOptions {
2540
2558
  preferredModelProvider?: string;
2541
2559
  /** Parent Pi event host used to snapshot runtime-registered MCP servers before child launch. */
2542
2560
  runtimeSnapshotHost?: import("../runs/shared/mcp-direct-tool-allowlist.ts").McpRuntimeSnapshotHost;
2543
- /** Optional subagent model-scope enforcement. */
2544
2561
  modelScope?: ModelScopeRule | ModelScopeRule[];
2545
2562
  /** Skills to make available (overrides agent default if provided) */
2546
2563
  skills?: string[];
@@ -1,6 +1,3 @@
1
- /**
2
- * Type definitions for the subagent extension
3
- */
4
1
  import * as os from "node:os";
5
2
  import * as path from "node:path";
6
3
  export const SUBAGENT_LIFECYCLE_ARTIFACT_VERSION = 3;
@@ -39,9 +36,6 @@ export const FLEET_KEYBINDING_ACTIONS = [
39
36
  "stop",
40
37
  "toggleTools",
41
38
  ];
42
- // ============================================================================
43
- // Constants
44
- // ============================================================================
45
39
  export const DEFAULT_MAX_OUTPUT = {
46
40
  bytes: 200 * 1024,
47
41
  lines: 5000,
@@ -165,9 +159,6 @@ export function wrapForkTask(task, preamble) {
165
159
  return task;
166
160
  return `${wrappedPrefix}${task}`;
167
161
  }
168
- // ============================================================================
169
- // Recursion Depth Guard
170
- // ============================================================================
171
162
  function normalizeNonNegativeInteger(value) {
172
163
  const parsed = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
173
164
  if (!Number.isInteger(parsed) || parsed < 0)
@@ -227,9 +218,6 @@ export function resolveMaxSubagentSpawnsPerRun(configMaxSpawns) {
227
218
  ?? normalizeMaxSubagentSpawnsPerRun(configMaxSpawns)
228
219
  ?? DEFAULT_MAX_SUBAGENT_SPAWNS_PER_RUN;
229
220
  }
230
- // ============================================================================
231
- // Utility Functions
232
- // ============================================================================
233
221
  function formatBytes(bytes) {
234
222
  if (bytes < 1024)
235
223
  return `${bytes}B`;
@@ -11,9 +11,6 @@ export declare function getProjectConfigDir(projectRoot: string): string;
11
11
  export declare function getAgentDir(): string;
12
12
  export declare function pruneStatusCacheForAsyncRoot(asyncDirRoot: string, runIds: Iterable<string>): number;
13
13
  export declare function resolveChildCwd(baseCwd: string, childCwd: string | undefined): string;
14
- /**
15
- * Read async job status from disk (with mtime-based caching)
16
- */
17
14
  export declare function readStatus(asyncDir: string): AsyncStatus | null;
18
15
  export declare function getLastActivity(outputFile: string | undefined): string;
19
16
  export declare function findLatestSessionFile(sessionDir: string): string | null;
@@ -30,13 +27,9 @@ export declare function assistantMessageError(message: {
30
27
  }): string | undefined;
31
28
  export declare function getFinalOutput(messages: Message[]): string;
32
29
  export declare function getSingleResultOutput(result: Pick<SingleResult, "finalOutput" | "messages">): string;
33
- /**
34
- * Extract display items (text and tool calls) from messages
35
- */
36
30
  export declare function getDisplayItems(messages: Message[] | undefined): DisplayItem[];
37
31
  export declare function sumResultsUsage(results: SingleResult[]): Usage;
38
32
  export declare function toAgentToolUsage(usage: Usage): PiUsage;
39
- /** Sum input tokens, output tokens, and cost across a set of SingleResults. */
40
33
  export declare function sumResultsCost(results: SingleResult[]): NonNullable<Details["totalCost"]>;
41
34
  export declare function compactForegroundResult(result: SingleResult): SingleResult;
42
35
  export declare function compactForegroundDetails(details: Details): Details;
@@ -56,7 +49,6 @@ export declare function compactForegroundDetails(details: Details): Details;
56
49
  export declare const MAX_STREAMED_RECENT_TOOLS = 32;
57
50
  export declare const MAX_STREAMED_TOOL_CALLS = 64;
58
51
  export declare const MAX_STREAMED_OUTPUT_LINE_CHARS = 2000;
59
- /** Keep only the most recent tool-history entries in a streamed snapshot. */
60
52
  export declare function boundStreamedRecentTools(recentTools: AgentProgress["recentTools"]): AgentProgress["recentTools"];
61
53
  /** Cap per-line length of recent output so one long line can't inflate a snapshot. */
62
54
  export declare function boundStreamedRecentOutput(recentOutput: string[]): string[];
@@ -72,12 +64,6 @@ export declare function formatEmptyTerminalAssistantResponseError(messages: Mess
72
64
  * Detect errors in subagent execution from messages (only errors with no subsequent success)
73
65
  */
74
66
  export declare function detectSubagentError(messages: Message[]): ErrorInfo;
75
- /**
76
- * Extract a preview of tool arguments for display
77
- */
78
67
  export declare function extractToolArgsPreview(args: Record<string, unknown>): string;
79
- /**
80
- * Extract text content from various message content formats
81
- */
82
68
  export declare function extractTextFromContent(content: unknown): string;
83
69
  export { mapConcurrent } from "../runs/shared/parallel-utils.ts";
@@ -119,9 +119,6 @@ function isNotFoundError(error) {
119
119
  && "code" in error
120
120
  && error.code === "ENOENT";
121
121
  }
122
- /**
123
- * Read async job status from disk (with mtime-based caching)
124
- */
125
122
  export function readStatus(asyncDir) {
126
123
  if (Buffer.byteLength(path.basename(asyncDir), "utf-8") > 255) {
127
124
  return null;
@@ -291,9 +288,6 @@ export function getFinalOutput(messages) {
291
288
  export function getSingleResultOutput(result) {
292
289
  return result.finalOutput ?? getFinalOutput(result.messages ?? []);
293
290
  }
294
- /**
295
- * Extract display items (text and tool calls) from messages
296
- */
297
291
  export function getDisplayItems(messages) {
298
292
  if (!messages || messages.length === 0)
299
293
  return [];
@@ -387,7 +381,6 @@ function addNestedCost(total, children) {
387
381
  addNestedCost(total, step.children);
388
382
  }
389
383
  }
390
- /** Sum input tokens, output tokens, and cost across a set of SingleResults. */
391
384
  export function sumResultsCost(results) {
392
385
  const total = { inputTokens: 0, outputTokens: 0, costUsd: 0 };
393
386
  for (const result of results) {
@@ -435,7 +428,6 @@ export function compactForegroundDetails(details) {
435
428
  export const MAX_STREAMED_RECENT_TOOLS = 32;
436
429
  export const MAX_STREAMED_TOOL_CALLS = 64;
437
430
  export const MAX_STREAMED_OUTPUT_LINE_CHARS = 2000;
438
- /** Keep only the most recent tool-history entries in a streamed snapshot. */
439
431
  export function boundStreamedRecentTools(recentTools) {
440
432
  return recentTools.slice(-MAX_STREAMED_RECENT_TOOLS).map((tool) => ({ ...tool }));
441
433
  }
@@ -519,9 +511,6 @@ export function detectSubagentError(messages) {
519
511
  }
520
512
  return { hasError: false };
521
513
  }
522
- /**
523
- * Extract a preview of tool arguments for display
524
- */
525
514
  export function extractToolArgsPreview(args) {
526
515
  const stringifyPreviewValue = (value) => {
527
516
  if (typeof value === "string" && value.trim().length > 0)
@@ -573,32 +562,24 @@ export function extractToolArgsPreview(args) {
573
562
  }
574
563
  return "";
575
564
  }
576
- /**
577
- * Extract text content from various message content formats
578
- */
579
565
  export function extractTextFromContent(content) {
580
566
  if (!content)
581
567
  return "";
582
- // Handle string content directly
583
568
  if (typeof content === "string")
584
569
  return content;
585
- // Handle array content
586
570
  if (!Array.isArray(content))
587
571
  return "";
588
572
  const texts = [];
589
573
  for (const part of content) {
590
574
  if (part && typeof part === "object") {
591
- // Handle { type: "text", text: "..." }
592
575
  if ("type" in part && part.type === "text" && "text" in part) {
593
576
  texts.push(String(part.text));
594
577
  }
595
- // Handle { type: "tool_result", content: "..." }
596
578
  else if ("type" in part && part.type === "tool_result" && "content" in part) {
597
579
  const inner = extractTextFromContent(part.content);
598
580
  if (inner)
599
581
  texts.push(inner);
600
582
  }
601
- // Handle { text: "..." } without type
602
583
  else if ("text" in part) {
603
584
  texts.push(String(part.text));
604
585
  }
@@ -606,7 +587,4 @@ export function extractTextFromContent(content) {
606
587
  }
607
588
  return texts.join("\n");
608
589
  }
609
- // ============================================================================
610
- // Concurrency Utilities
611
- // ============================================================================
612
590
  export { mapConcurrent } from "../runs/shared/parallel-utils.js";
@@ -0,0 +1,8 @@
1
+ export declare const DEFAULT_WAIT_TOOL_NAME = "bg_wait";
2
+ /**
3
+ * The name pi-subagents registers its wait tool under (`config.waitTool.name`). One value per process: the parent
4
+ * sets it from config, a child runtime from its launch config, and an async runner from its runner config, because
5
+ * every runtime in a process descends from the same parent setting.
6
+ */
7
+ export declare function waitToolName(): string;
8
+ export declare function setWaitToolName(name: string): void;
@@ -0,0 +1,13 @@
1
+ export const DEFAULT_WAIT_TOOL_NAME = "bg_wait";
2
+ let current = DEFAULT_WAIT_TOOL_NAME;
3
+ /**
4
+ * The name pi-subagents registers its wait tool under (`config.waitTool.name`). One value per process: the parent
5
+ * sets it from config, a child runtime from its launch config, and an async runner from its runner config, because
6
+ * every runtime in a process descends from the same parent setting.
7
+ */
8
+ export function waitToolName() {
9
+ return current;
10
+ }
11
+ export function setWaitToolName(name) {
12
+ current = name;
13
+ }
@@ -22,6 +22,7 @@ import { SUBAGENT_GUIDE_TOPICS } from "../extension/subagent-guide.js";
22
22
  import { getInspectorPlugins } from "../inspectors/plugins.js";
23
23
  import { applySlashUpdate, buildSlashInitialResult, failSlashResult, finalizeSlashResult, } from "./slash-live-state.js";
24
24
  import { SLASH_RESULT_TYPE, SLASH_TEXT_RESULT_TYPE, SLASH_TEXT_VIEW_ONLY_DETAILS, SLASH_SUBAGENT_CANCEL_EVENT, SLASH_SUBAGENT_REQUEST_EVENT, SLASH_SUBAGENT_RESPONSE_EVENT, SLASH_SUBAGENT_STARTED_EVENT, SLASH_SUBAGENT_UPDATE_EVENT, DIRS, } from "../shared/types.js";
25
+ import { waitToolName } from "../shared/wait-tool-name.js";
25
26
  const parseInlineConfig = (raw) => {
26
27
  const config = {};
27
28
  for (const part of raw.split(",")) {
@@ -729,7 +730,7 @@ export function registerSlashCommands(pi, state, options = {}) {
729
730
  ctx.ui.notify(`Foreground run ${control.runId} is not currently detachable.`, "info");
730
731
  return;
731
732
  }
732
- sendSlashText(pi, `Detached foreground run ${control.runId} without terminating its child. Use subagent({ action: "status", id: ${JSON.stringify(control.runId)} }) or bg_wait({ id: ${JSON.stringify(control.runId)} }) to recover the eventual result. This does not daemonize the process or guarantee survival across Pi reload/restart.`);
733
+ sendSlashText(pi, `Detached foreground run ${control.runId} without terminating its child. Use subagent({ action: "status", id: ${JSON.stringify(control.runId)} }) or ${waitToolName()}({ id: ${JSON.stringify(control.runId)} }) to recover the eventual result. This does not daemonize the process or guarantee survival across Pi reload/restart.`);
733
734
  };
734
735
  pi.registerCommand("subagents-detach", {
735
736
  description: "Detach the active foreground single-subagent run without terminating it",
@@ -21,8 +21,9 @@ export declare const SUBAGENT_COST_REPORT_VERSION: 1;
21
21
  /**
22
22
  * Collect parent and child usage for the current session branch. Foreground
23
23
  * children come from persisted `subagent`/`bg_wait` tool-result details; async
24
- * workflow children are resolved through receipts, and other async runs through
25
- * their status steps, then artifact metadata.
24
+ * runs come from those results and `subagent-notify` completions. Async workflow
25
+ * children are resolved through receipts, and other async runs through their
26
+ * status steps, then artifact metadata.
26
27
  */
27
28
  export declare function collectSubagentCost(ctx: ExtensionContext, state: Pick<SubagentState, "baseCwd" | "artifactDirPreference">): SubagentCostReport;
28
29
  /** The `/subagent-cost` text rendering of a collected report. */
@@ -6,6 +6,7 @@ import { DIRS, SLASH_RESULT_TYPE } from "../shared/types.js";
6
6
  import { readStatus } from "../shared/utils.js";
7
7
  import { readWorkflowReceipt } from "../workflows/workflow-receipt.js";
8
8
  import { resolveSlashMessageDetails } from "./slash-live-state.js";
9
+ import { DEFAULT_WAIT_TOOL_NAME, waitToolName } from "../shared/wait-tool-name.js";
9
10
  export const SUBAGENT_COST_REPORT_VERSION = 1;
10
11
  function emptyUsage() {
11
12
  return { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 };
@@ -95,10 +96,25 @@ function detailsFromSessionEntry(entry) {
95
96
  if (record.type !== "message" || !record.message || typeof record.message !== "object")
96
97
  return undefined;
97
98
  const message = record.message;
98
- if (message.role !== "toolResult" || (message.toolName !== "subagent" && message.toolName !== "bg_wait"))
99
+ // Results saved before a waitTool.name rename carry bg_wait; another extension's bg_wait results fail isSubagentDetails.
100
+ if (message.role !== "toolResult" || (message.toolName !== "subagent" && message.toolName !== waitToolName() && message.toolName !== DEFAULT_WAIT_TOOL_NAME))
99
101
  return undefined;
100
102
  return isSubagentDetails(message.details) ? message.details : undefined;
101
103
  }
104
+ /** Background runs a `subagent-notify` completion reports; an RPC `spawn` launch has no tool result, so this is its only record. */
105
+ function notifiedAsyncRuns(entry) {
106
+ if (!entry || typeof entry !== "object")
107
+ return [];
108
+ const record = entry;
109
+ if (record.type !== "custom_message" || record.customType !== "subagent-notify")
110
+ return [];
111
+ const runs = record.details?.runs;
112
+ if (!Array.isArray(runs))
113
+ return [];
114
+ return runs.flatMap((run) =>
115
+ // A detached foreground task keeps no async status directory to read usage from.
116
+ run && typeof run.runId === "string" && run.source !== "foreground" ? [{ runId: run.runId, workflow: run.workflowRunId === run.runId }] : []);
117
+ }
102
118
  function metadataUsage(artifactsDirs, input, indexes = [0, undefined]) {
103
119
  if (!/^[A-Za-z0-9._-]+$/.test(input.runId))
104
120
  return undefined;
@@ -126,8 +142,9 @@ function metadataUsage(artifactsDirs, input, indexes = [0, undefined]) {
126
142
  /**
127
143
  * Collect parent and child usage for the current session branch. Foreground
128
144
  * children come from persisted `subagent`/`bg_wait` tool-result details; async
129
- * workflow children are resolved through receipts, and other async runs through
130
- * their status steps, then artifact metadata.
145
+ * runs come from those results and `subagent-notify` completions. Async workflow
146
+ * children are resolved through receipts, and other async runs through their
147
+ * status steps, then artifact metadata.
131
148
  */
132
149
  export function collectSubagentCost(ctx, state) {
133
150
  const parent = emptyUsage();
@@ -163,6 +180,8 @@ export function collectSubagentCost(ctx, state) {
163
180
  const parentUsage = assistantUsageFromMessage(message) ?? compactionUsageFromEntry(entry);
164
181
  if (parentUsage)
165
182
  addUsage(parent, parentUsage);
183
+ for (const run of notifiedAsyncRuns(entry))
184
+ (run.workflow ? workflowRunIds : asyncRunIds).add(run.runId);
166
185
  const details = detailsFromSessionEntry(entry);
167
186
  if (!details)
168
187
  continue;
@@ -442,7 +442,6 @@ export async function openSubagentsAdmin(pi, ctx, args = "") {
442
442
  sendAdminMessage(pi, message);
443
443
  }
444
444
  else if (action === "Show details") {
445
- // Full metadata is now opt-in (previously always posted to the thread).
446
445
  sendAdminMessage(pi, metadataFor(agent));
447
446
  }
448
447
  }
@@ -34,11 +34,6 @@ export interface FleetStatusOptions {
34
34
  export declare function resolveFleetViewPlacement(value: unknown): FleetViewPlacement;
35
35
  export declare function formatFleetElapsed(ms: number): string;
36
36
  export declare function formatFleetTokens(count: number, window?: number, windowCount?: number): string;
37
- /**
38
- * Reports a Fleet problem once per process. Fleet refreshes on a timer, and console output while the TUI owns
39
- * the terminal is drawn over the editor, so an interactive session gets one TUI warning instead.
40
- */
41
- export declare function reportFleetWarning(state: SubagentState, message: string): void;
42
37
  export declare function collectFleetStatusEntries(state: SubagentState): FleetStatusEntry[];
43
38
  export declare class SubagentFleetStatus {
44
39
  private ctx;
@@ -5,7 +5,8 @@ import { projectAsyncWorkflowRows } from "../runs/shared/async-status-projection
5
5
  import { contextModeLabel } from "../runs/shared/context-mode.js";
6
6
  import { formatWorkflowJsonPreview } from "../workflows/scripted-workflow.js";
7
7
  import { hostStepReportName, hostStepVerdictLabel } from "../runs/shared/host-step-status.js";
8
- import { isStaleExtensionContextError, withCachedUiContext } from "../shared/extension-context.js";
8
+ import { isStaleExtensionContextError } from "../shared/extension-context.js";
9
+ import { reportSessionWarning } from "../shared/session-warnings.js";
9
10
  import { inlineWorkflowRenderKey } from "./render.js";
10
11
  import { runningTone } from "./running-tone.js";
11
12
  import { childThinkingLevel } from "../shared/model-info.js";
@@ -318,27 +319,6 @@ function projectPaneEntries(state) {
318
319
  projectPane: pane,
319
320
  }));
320
321
  }
321
- const reportedFleetWarnings = new Set();
322
- /**
323
- * Reports a Fleet problem once per process. Fleet refreshes on a timer, and console output while the TUI owns
324
- * the terminal is drawn over the editor, so an interactive session gets one TUI warning instead.
325
- */
326
- export function reportFleetWarning(state, message) {
327
- if (reportedFleetWarnings.has(message))
328
- return;
329
- reportedFleetWarnings.add(message);
330
- const text = `[pi-subagents] ${message}`;
331
- const cached = state.lastUiContext;
332
- const notified = withCachedUiContext(cached, () => {
333
- if (state.lastUiContext === cached)
334
- state.lastUiContext = null;
335
- }, (ctx) => {
336
- ctx.ui.notify(text, "warning");
337
- return true;
338
- });
339
- if (!notified)
340
- console.warn(text);
341
- }
342
322
  export function collectFleetStatusEntries(state) {
343
323
  const now = Date.now();
344
324
  const entries = [];
@@ -486,7 +466,7 @@ export function collectFleetStatusEntries(state) {
486
466
  }
487
467
  if (state.currentSessionId) {
488
468
  try {
489
- for (const run of snapshotExternalRuns(state.currentSessionId, { ignoreMalformed: true, onMalformedRecord: (message) => reportFleetWarning(state, `Removed ${message}`) })) {
469
+ for (const run of snapshotExternalRuns(state.currentSessionId, { ignoreMalformed: true, onMalformedRecord: (message) => reportSessionWarning(state, `Removed ${message}`) })) {
490
470
  if (!isActiveState(run.state))
491
471
  continue;
492
472
  entries.push({
@@ -501,7 +481,7 @@ export function collectFleetStatusEntries(state) {
501
481
  }
502
482
  }
503
483
  catch (cause) {
504
- reportFleetWarning(state, `Failed to inspect external jobs: ${cause instanceof Error ? cause.message : String(cause)}`);
484
+ reportSessionWarning(state, `Failed to inspect external jobs: ${cause instanceof Error ? cause.message : String(cause)}`);
505
485
  }
506
486
  }
507
487
  entries.push(...projectPaneEntries(state));
@@ -1,50 +1,7 @@
1
1
  import { type ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import { type MarkdownTheme } from "@earendil-works/pi-tui";
3
+ import { type FleetTranscript } from "../shared/fleet-transcript-reader.ts";
3
4
  type Theme = ExtensionContext["ui"]["theme"];
4
- export type FleetTranscriptEvent = {
5
- kind: "assistant";
6
- text: string;
7
- model?: string;
8
- timestamp?: number;
9
- } | {
10
- kind: "user";
11
- text: string;
12
- timestamp?: number;
13
- } | {
14
- kind: "tool";
15
- toolCallId?: string;
16
- name: string;
17
- args?: string;
18
- argsPayload?: string;
19
- output?: string;
20
- outputTruncated?: boolean;
21
- status: "running" | "complete" | "error";
22
- error?: string;
23
- startedAt?: number;
24
- endedAt?: number;
25
- timestamp?: number;
26
- } | {
27
- kind: "notice";
28
- text: string;
29
- tone: "muted" | "warning" | "error";
30
- timestamp?: number;
31
- };
32
- export interface FleetTranscript {
33
- path: string;
34
- events: FleetTranscriptEvent[];
35
- truncated: boolean;
36
- warning?: string;
37
- /** The path was refused or the file could not be read, as opposed to a read that only skipped records. */
38
- readFailed?: true;
39
- }
40
- interface FleetTranscriptReadOptions {
41
- trustedRoots: string[];
42
- trustedFiles?: string[];
43
- trustedFileRoot?: string;
44
- maxRecords?: number;
45
- maxBytes?: number;
46
- }
47
- export declare function readFleetTranscript(filePath: string, options: FleetTranscriptReadOptions): FleetTranscript;
48
5
  export declare function renderFleetTranscript(transcript: FleetTranscript, width: number, theme: Theme, markdownTheme: MarkdownTheme, options?: {
49
6
  expandedTools?: boolean;
50
7
  }): string[];