@esso0428/pi-subagents 0.17.5 → 0.17.7

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 (263) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/CONTRIBUTING.md +4 -0
  3. package/README.md +1 -1
  4. package/dist/abortable.d.ts +13 -0
  5. package/dist/abortable.d.ts.map +1 -0
  6. package/dist/abortable.js +43 -0
  7. package/dist/abortable.js.map +1 -0
  8. package/dist/agent-color.d.ts +36 -0
  9. package/dist/agent-color.d.ts.map +1 -0
  10. package/dist/agent-color.js +124 -0
  11. package/dist/agent-color.js.map +1 -0
  12. package/dist/agent-file-toggle.d.ts +126 -0
  13. package/dist/agent-file-toggle.d.ts.map +1 -0
  14. package/dist/agent-file-toggle.js +259 -0
  15. package/dist/agent-file-toggle.js.map +1 -0
  16. package/dist/agent-history.d.ts +4 -0
  17. package/dist/agent-history.d.ts.map +1 -1
  18. package/dist/agent-history.js +47 -1
  19. package/dist/agent-history.js.map +1 -1
  20. package/dist/agent-manager.d.ts +370 -56
  21. package/dist/agent-manager.d.ts.map +1 -1
  22. package/dist/agent-manager.js +1123 -409
  23. package/dist/agent-manager.js.map +1 -1
  24. package/dist/agent-runner.d.ts +100 -10
  25. package/dist/agent-runner.d.ts.map +1 -1
  26. package/dist/agent-runner.js +166 -21
  27. package/dist/agent-runner.js.map +1 -1
  28. package/dist/agent-types.d.ts +57 -5
  29. package/dist/agent-types.d.ts.map +1 -1
  30. package/dist/agent-types.js +164 -32
  31. package/dist/agent-types.js.map +1 -1
  32. package/dist/child-context.d.ts +3 -0
  33. package/dist/child-context.d.ts.map +1 -0
  34. package/dist/child-context.js +13 -0
  35. package/dist/child-context.js.map +1 -0
  36. package/dist/cross-extension-rpc.d.ts +23 -3
  37. package/dist/cross-extension-rpc.d.ts.map +1 -1
  38. package/dist/cross-extension-rpc.js +79 -17
  39. package/dist/cross-extension-rpc.js.map +1 -1
  40. package/dist/custom-agents.d.ts +38 -1
  41. package/dist/custom-agents.d.ts.map +1 -1
  42. package/dist/custom-agents.js +164 -12
  43. package/dist/custom-agents.js.map +1 -1
  44. package/dist/index.d.ts +34 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +1908 -495
  47. package/dist/index.js.map +1 -1
  48. package/dist/invocation-config.d.ts +87 -2
  49. package/dist/invocation-config.d.ts.map +1 -1
  50. package/dist/invocation-config.js +71 -3
  51. package/dist/invocation-config.js.map +1 -1
  52. package/dist/mention-clone.d.ts +88 -0
  53. package/dist/mention-clone.d.ts.map +1 -0
  54. package/dist/mention-clone.js +154 -0
  55. package/dist/mention-clone.js.map +1 -0
  56. package/dist/mention.d.ts +82 -0
  57. package/dist/mention.d.ts.map +1 -0
  58. package/dist/mention.js +132 -0
  59. package/dist/mention.js.map +1 -0
  60. package/dist/model-resolver.d.ts +17 -0
  61. package/dist/model-resolver.d.ts.map +1 -1
  62. package/dist/model-resolver.js +15 -0
  63. package/dist/model-resolver.js.map +1 -1
  64. package/dist/model-scope.d.ts +50 -0
  65. package/dist/model-scope.d.ts.map +1 -0
  66. package/dist/model-scope.js +49 -0
  67. package/dist/model-scope.js.map +1 -0
  68. package/dist/nested-tools.d.ts +57 -0
  69. package/dist/nested-tools.d.ts.map +1 -0
  70. package/dist/nested-tools.js +301 -0
  71. package/dist/nested-tools.js.map +1 -0
  72. package/dist/output-file.d.ts +22 -3
  73. package/dist/output-file.d.ts.map +1 -1
  74. package/dist/output-file.js +58 -7
  75. package/dist/output-file.js.map +1 -1
  76. package/dist/prompts.d.ts +23 -0
  77. package/dist/prompts.d.ts.map +1 -1
  78. package/dist/prompts.js +20 -2
  79. package/dist/prompts.js.map +1 -1
  80. package/dist/schedule.d.ts.map +1 -1
  81. package/dist/schedule.js +36 -15
  82. package/dist/schedule.js.map +1 -1
  83. package/dist/settings.d.ts +228 -2
  84. package/dist/settings.d.ts.map +1 -1
  85. package/dist/settings.js +94 -0
  86. package/dist/settings.js.map +1 -1
  87. package/dist/status-note.d.ts +49 -1
  88. package/dist/status-note.d.ts.map +1 -1
  89. package/dist/status-note.js +62 -1
  90. package/dist/status-note.js.map +1 -1
  91. package/dist/structured-output.d.ts +62 -0
  92. package/dist/structured-output.d.ts.map +1 -0
  93. package/dist/structured-output.js +113 -0
  94. package/dist/structured-output.js.map +1 -0
  95. package/dist/types.d.ts +176 -10
  96. package/dist/types.d.ts.map +1 -1
  97. package/dist/ui/agent-mention.d.ts +83 -0
  98. package/dist/ui/agent-mention.d.ts.map +1 -0
  99. package/dist/ui/agent-mention.js +188 -0
  100. package/dist/ui/agent-mention.js.map +1 -0
  101. package/dist/ui/agent-widget.d.ts +96 -75
  102. package/dist/ui/agent-widget.d.ts.map +1 -1
  103. package/dist/ui/agent-widget.js +397 -420
  104. package/dist/ui/agent-widget.js.map +1 -1
  105. package/dist/ui/conversation-blocks.d.ts.map +1 -1
  106. package/dist/ui/conversation-blocks.js +6 -0
  107. package/dist/ui/conversation-blocks.js.map +1 -1
  108. package/dist/ui/conversation-timeline.d.ts +10 -2
  109. package/dist/ui/conversation-timeline.d.ts.map +1 -1
  110. package/dist/ui/conversation-timeline.js +130 -23
  111. package/dist/ui/conversation-timeline.js.map +1 -1
  112. package/dist/ui/conversation-viewer.d.ts +20 -5
  113. package/dist/ui/conversation-viewer.d.ts.map +1 -1
  114. package/dist/ui/conversation-viewer.js +274 -73
  115. package/dist/ui/conversation-viewer.js.map +1 -1
  116. package/dist/ui/fleet-list.d.ts +198 -0
  117. package/dist/ui/fleet-list.d.ts.map +1 -0
  118. package/dist/ui/fleet-list.js +487 -0
  119. package/dist/ui/fleet-list.js.map +1 -0
  120. package/dist/ui/schedule-menu.d.ts.map +1 -1
  121. package/dist/ui/schedule-menu.js +6 -7
  122. package/dist/ui/schedule-menu.js.map +1 -1
  123. package/dist/ui/select-item.d.ts +28 -0
  124. package/dist/ui/select-item.d.ts.map +1 -0
  125. package/dist/ui/select-item.js +35 -0
  126. package/dist/ui/select-item.js.map +1 -0
  127. package/dist/ui/workflow-card.d.ts +176 -0
  128. package/dist/ui/workflow-card.d.ts.map +1 -0
  129. package/dist/ui/workflow-card.js +333 -0
  130. package/dist/ui/workflow-card.js.map +1 -0
  131. package/dist/ui/workflow-dialog.d.ts +306 -0
  132. package/dist/ui/workflow-dialog.d.ts.map +1 -0
  133. package/dist/ui/workflow-dialog.js +844 -0
  134. package/dist/ui/workflow-dialog.js.map +1 -0
  135. package/dist/ui/workflow-menu.d.ts +61 -0
  136. package/dist/ui/workflow-menu.d.ts.map +1 -0
  137. package/dist/ui/workflow-menu.js +148 -0
  138. package/dist/ui/workflow-menu.js.map +1 -0
  139. package/dist/usage.d.ts +86 -1
  140. package/dist/usage.d.ts.map +1 -1
  141. package/dist/usage.js +72 -1
  142. package/dist/usage.js.map +1 -1
  143. package/dist/workflow/collisions.d.ts +96 -0
  144. package/dist/workflow/collisions.d.ts.map +1 -0
  145. package/dist/workflow/collisions.js +89 -0
  146. package/dist/workflow/collisions.js.map +1 -0
  147. package/dist/workflow/entry.d.ts +33 -0
  148. package/dist/workflow/entry.d.ts.map +1 -0
  149. package/dist/workflow/entry.js +30 -0
  150. package/dist/workflow/entry.js.map +1 -0
  151. package/dist/workflow/host.d.ts +63 -0
  152. package/dist/workflow/host.d.ts.map +1 -0
  153. package/dist/workflow/host.js +363 -0
  154. package/dist/workflow/host.js.map +1 -0
  155. package/dist/workflow/journal.d.ts +98 -0
  156. package/dist/workflow/journal.d.ts.map +1 -0
  157. package/dist/workflow/journal.js +121 -0
  158. package/dist/workflow/journal.js.map +1 -0
  159. package/dist/workflow/json-schema.d.ts +52 -0
  160. package/dist/workflow/json-schema.d.ts.map +1 -0
  161. package/dist/workflow/json-schema.js +112 -0
  162. package/dist/workflow/json-schema.js.map +1 -0
  163. package/dist/workflow/meta.d.ts +68 -0
  164. package/dist/workflow/meta.d.ts.map +1 -0
  165. package/dist/workflow/meta.js +318 -0
  166. package/dist/workflow/meta.js.map +1 -0
  167. package/dist/workflow/progress.d.ts +225 -0
  168. package/dist/workflow/progress.d.ts.map +1 -0
  169. package/dist/workflow/progress.js +362 -0
  170. package/dist/workflow/progress.js.map +1 -0
  171. package/dist/workflow/runtime.d.ts +335 -0
  172. package/dist/workflow/runtime.d.ts.map +1 -0
  173. package/dist/workflow/runtime.js +831 -0
  174. package/dist/workflow/runtime.js.map +1 -0
  175. package/dist/workflow/saved.d.ts +91 -0
  176. package/dist/workflow/saved.d.ts.map +1 -0
  177. package/dist/workflow/saved.js +204 -0
  178. package/dist/workflow/saved.js.map +1 -0
  179. package/dist/workflow/task.d.ts +137 -0
  180. package/dist/workflow/task.d.ts.map +1 -0
  181. package/dist/workflow/task.js +208 -0
  182. package/dist/workflow/task.js.map +1 -0
  183. package/dist/workflow/tool-description.d.ts +39 -0
  184. package/dist/workflow/tool-description.d.ts.map +1 -0
  185. package/dist/workflow/tool-description.js +200 -0
  186. package/dist/workflow/tool-description.js.map +1 -0
  187. package/dist/workflow/worker-source.d.ts +48 -0
  188. package/dist/workflow/worker-source.d.ts.map +1 -0
  189. package/dist/workflow/worker-source.js +779 -0
  190. package/dist/workflow/worker-source.js.map +1 -0
  191. package/dist/worktree.d.ts +10 -3
  192. package/dist/worktree.d.ts.map +1 -1
  193. package/dist/worktree.js +58 -54
  194. package/dist/worktree.js.map +1 -1
  195. package/dist/xml.d.ts +11 -0
  196. package/dist/xml.d.ts.map +1 -0
  197. package/dist/xml.js +13 -0
  198. package/dist/xml.js.map +1 -0
  199. package/docs/rpc.md +183 -0
  200. package/docs/superpowers/plans/2026-09-30-conversation-viewer-scrollbar.md +216 -0
  201. package/docs/superpowers/plans/2026-09-30-upstream-event-workflow-partial-history.md +195 -0
  202. package/docs/superpowers/specs/2026-09-30-conversation-viewer-scrollbar-design.md +82 -0
  203. package/docs/superpowers/specs/2026-09-30-upstream-event-workflow-partial-history-design.md +49 -0
  204. package/docs/workflows.md +437 -0
  205. package/examples/agent-tool-description.md +7 -7
  206. package/examples/workflows/compose.js +51 -0
  207. package/examples/workflows/fan-out-audit.js +47 -0
  208. package/examples/workflows/gated-fix.js +60 -0
  209. package/examples/workflows/lib/count-child.js +27 -0
  210. package/examples/workflows/review-panel.js +63 -0
  211. package/examples/workflows/structured-findings.js +78 -0
  212. package/package.json +1 -1
  213. package/src/abortable.ts +43 -0
  214. package/src/agent-color.ts +161 -0
  215. package/src/agent-file-toggle.ts +269 -0
  216. package/src/agent-history.ts +54 -2
  217. package/src/agent-manager.ts +1263 -402
  218. package/src/agent-runner.ts +251 -27
  219. package/src/agent-types.ts +188 -32
  220. package/src/child-context.ts +15 -0
  221. package/src/cross-extension-rpc.ts +96 -20
  222. package/src/custom-agents.ts +170 -13
  223. package/src/index.ts +2024 -537
  224. package/src/invocation-config.ts +118 -3
  225. package/src/mention-clone.ts +196 -0
  226. package/src/mention.ts +141 -0
  227. package/src/model-resolver.ts +18 -0
  228. package/src/model-scope.ts +70 -0
  229. package/src/nested-tools.ts +424 -0
  230. package/src/output-file.ts +61 -6
  231. package/src/prompts.ts +45 -2
  232. package/src/schedule.ts +35 -14
  233. package/src/settings.ts +312 -2
  234. package/src/status-note.ts +66 -1
  235. package/src/structured-output.ts +130 -0
  236. package/src/types.ts +177 -10
  237. package/src/ui/agent-mention.ts +216 -0
  238. package/src/ui/agent-widget.ts +389 -441
  239. package/src/ui/conversation-blocks.ts +6 -0
  240. package/src/ui/conversation-timeline.ts +139 -25
  241. package/src/ui/conversation-viewer.ts +284 -69
  242. package/src/ui/fleet-list.ts +558 -0
  243. package/src/ui/schedule-menu.ts +9 -8
  244. package/src/ui/select-item.ts +45 -0
  245. package/src/ui/workflow-card.ts +470 -0
  246. package/src/ui/workflow-dialog.ts +1115 -0
  247. package/src/ui/workflow-menu.ts +193 -0
  248. package/src/usage.ts +109 -2
  249. package/src/workflow/collisions.ts +123 -0
  250. package/src/workflow/entry.ts +47 -0
  251. package/src/workflow/host.ts +403 -0
  252. package/src/workflow/journal.ts +164 -0
  253. package/src/workflow/json-schema.ts +128 -0
  254. package/src/workflow/meta.ts +325 -0
  255. package/src/workflow/progress.ts +550 -0
  256. package/src/workflow/runtime.ts +1219 -0
  257. package/src/workflow/saved.ts +217 -0
  258. package/src/workflow/task.ts +302 -0
  259. package/src/workflow/tool-description.ts +200 -0
  260. package/src/workflow/worker-source.ts +781 -0
  261. package/src/worktree.ts +69 -55
  262. package/src/xml.ts +13 -0
  263. package/vitest.config.ts +0 -18
@@ -1,43 +1,81 @@
1
1
  /**
2
2
  * agent-manager.ts — Tracks agents, background execution, resume support.
3
3
  *
4
- * Background agents are subject to a configurable concurrency limit (default: 4).
5
- * Excess agents are queued and auto-started as running agents complete.
6
- * Foreground agents bypass the queue (they block the parent anyway).
4
+ * There are two independent concurrency pools, never one:
5
+ *
6
+ * - Background (`maxConcurrent`, default 10) bounds detached agents.
7
+ * - Foreground (`maxConcurrentForeground`, default 0 = unlimited) bounds
8
+ * agents a caller is blocking on inline — `spawnAndWait`.
9
+ *
10
+ * Independent by design: a foreground agent blocks the parent anyway, so
11
+ * charging it to the background pool would let a saturated pool starve the main
12
+ * session of work it could have done itself. Excess agents in either pool are
13
+ * queued and auto-started as slots free up. Nested children take no slot in
14
+ * either — see `occupiesPoolSlot` / `occupiesForegroundSlot`.
7
15
  */
8
16
  import type { Model } from "@earendil-works/pi-ai";
9
17
  import type { AgentSession, ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
10
18
  import { type ToolActivity } from "./agent-runner.js";
11
- import type { AgentInvocation, AgentRecord, IsolationMode, SubagentType, ThinkingLevel } from "./types.js";
19
+ import type { AgentInvocation, AgentRecord, AgentTombstone, IsolationMode, MentionResolution, SubagentType, ThinkingLevel } from "./types.js";
20
+ import { type LifetimeUsage } from "./usage.js";
21
+ import type { CompiledSchema } from "./workflow/json-schema.js";
12
22
  export type OnAgentComplete = (record: AgentRecord) => void;
13
23
  export type OnAgentStart = (record: AgentRecord) => void;
14
24
  export type OnAgentCompact = (record: AgentRecord, info: CompactionInfo) => void;
25
+ /**
26
+ * Fired once per assistant `message_end`, for EVERY agent this manager owns —
27
+ * top-level and nested alike, spawns and resumes. The one place where each
28
+ * message is seen exactly once: `AgentRecord.lifetimeUsage` is deliberately
29
+ * double-booked into ancestors (see `nested-tools.ts`) so a hidden child's spend
30
+ * shows up on the record a human can see, which makes those records useless as
31
+ * a basis for anything that must not count a message twice — parent-session
32
+ * accounting above all.
33
+ */
34
+ export type OnAgentUsage = (record: AgentRecord, usage: LifetimeUsage) => void;
15
35
  export type CompactionInfo = {
16
36
  reason: "manual" | "threshold" | "overflow";
17
37
  tokensBefore: number;
18
38
  };
19
- type RestorableAgentStatus = "completed" | "steered" | "stopped" | "aborted" | "error";
20
- /** Validate one persisted terminal record without constructing runtime handles. */
21
- export declare function isRestorableAgentRecord(value: unknown): value is {
22
- id: string;
23
- type: string;
24
- description: string;
25
- status: RestorableAgentStatus;
26
- startedAt: number;
27
- completedAt: number;
28
- result?: string;
29
- error?: string;
30
- toolUses?: number;
31
- lifetimeUsage?: {
32
- input: number;
33
- output: number;
34
- cacheWrite: number;
35
- };
36
- transcriptPath?: string;
37
- invocation?: AgentInvocation;
38
- };
39
+ /**
40
+ * Whether a record is one of the session's own agents, rather than something
41
+ * another agent or a workflow owns.
42
+ *
43
+ * The single definition behind every user-facing surface — the fleet list, the
44
+ * widget, the `/agents` menus, `@handle` resolution, and the completion events
45
+ * and session entries. An owned child reports through its owner, so surfacing
46
+ * it separately would double-count the same work in the places a person reads.
47
+ */
48
+ export declare function isTopLevelAgent(record: Pick<AgentRecord, "parentAgentId" | "workflowId">): boolean;
39
49
  interface SpawnOptions {
40
50
  description: string;
51
+ /**
52
+ * Optional memorable name for this instance, becoming a second handle
53
+ * (`@auth-audit`) alongside the type-derived one. Slugged, not validated —
54
+ * anything unusable degrades via `handleBase` rather than failing the spawn.
55
+ */
56
+ name?: string;
57
+ /**
58
+ * Reopen this pi session file instead of starting a fresh conversation, so a
59
+ * mention of an evicted agent continues where it left off. The agent's
60
+ * definition is still resolved from its type, so the continuation runs under
61
+ * the type's CURRENT config.
62
+ */
63
+ resumeSessionFile?: string;
64
+ /**
65
+ * Take an evicted agent's names back verbatim instead of allocating fresh
66
+ * ones, so a resumed conversation keeps the handle the user just typed —
67
+ * `handleBase(type)` cannot reproduce a numbered `explore-2`. Safe without an
68
+ * `assignHandle` pass because tombstoned names are excluded from allocation
69
+ * (`takenHandles`), so nothing live can be holding them.
70
+ *
71
+ * Internal capability, like `resumeSessionFile`: a forged handle would
72
+ * duplicate a live agent's name and make `resolveMention` ambiguous, so
73
+ * `spawnTopLevel` strips it from anything a caller sends.
74
+ */
75
+ reclaim?: {
76
+ handle: string;
77
+ alias?: string;
78
+ };
41
79
  model?: Model<any>;
42
80
  maxTurns?: number;
43
81
  isolated?: boolean;
@@ -45,11 +83,38 @@ interface SpawnOptions {
45
83
  thinkingLevel?: ThinkingLevel;
46
84
  isBackground?: boolean;
47
85
  /**
48
- * Skip the maxConcurrent queue check for this spawn — start immediately even
49
- * if the configured concurrency limit would otherwise queue it. Used by the
50
- * scheduler so a fired job can't be deferred past its trigger window.
86
+ * Skip whichever pool's queue check applies to this spawn — start immediately
87
+ * even if the configured concurrency limit would otherwise queue it. The slot
88
+ * is still COUNTED once the run starts, so a bypassing spawn transiently
89
+ * exceeds the limit rather than being invisible to it.
90
+ *
91
+ * Used by the scheduler, so a fired job can't be deferred past its trigger
92
+ * window, and by the `/agents` agent-file generator, which has no way to
93
+ * cancel a wait (see its call site).
51
94
  */
52
95
  bypassQueue?: boolean;
96
+ /**
97
+ * A caller is awaiting this record inline (`spawnAndWait`) — what
98
+ * `maxConcurrentForeground` bounds. Set only by `spawnAndWait`; stripped from
99
+ * caller-supplied options by `spawnTopLevel`, since a forged `blocking` would
100
+ * defer a detached start behind a queue its caller cannot see or release.
101
+ */
102
+ blocking?: boolean;
103
+ /**
104
+ * The workflow run this child belongs to, when a workflow spawned it.
105
+ *
106
+ * Ownership, not decoration. A workflow's children are the workflow's — they
107
+ * report through its card, its notification and its dialog, so they are
108
+ * filtered out of every top-level surface exactly as nested children are, and
109
+ * they take no `maxConcurrent` slot: the run has its own concurrency cap, and
110
+ * counting them twice would let one workflow starve the whole session.
111
+ */
112
+ workflowId?: string;
113
+ /**
114
+ * Make the child report through a `StructuredOutput` tool built from this
115
+ * compiled schema. Set only by the workflow host, for `agent({ schema })`.
116
+ */
117
+ structuredOutput?: CompiledSchema;
53
118
  /** Isolation mode — "worktree" creates a temp git worktree for the agent. */
54
119
  isolation?: IsolationMode;
55
120
  /**
@@ -61,10 +126,44 @@ interface SpawnOptions {
61
126
  * branch lands in that repo.
62
127
  */
63
128
  cwd?: string;
129
+ /**
130
+ * Last chance to look at an isolated agent's worktree, awaited immediately
131
+ * before it is committed to a branch and removed.
132
+ *
133
+ * Exists because that removal happens inside the settle path, before
134
+ * `spawnAndWait` resolves: by the time a caller has the finished record, the
135
+ * directory the child actually wrote in is gone. Anything that must inspect
136
+ * or verify that tree — a workflow `gate` is the motivating case — has to run
137
+ * here or it silently inspects the main tree instead.
138
+ *
139
+ * Fires only on the normal settle path, and only when a worktree was created.
140
+ * Not on the error path and not on the stop-during-copy guard: those are
141
+ * already failing, and delaying cleanup there would leak a copy for no gain.
142
+ * A rejection is swallowed — the hook can never keep the worktree alive.
143
+ */
144
+ onBeforeWorktreeCleanup?: (worktreePath: string) => Promise<void>;
64
145
  /** Resolved invocation snapshot captured for UI display. */
65
146
  invocation?: AgentInvocation;
147
+ /** Whether the optional `.output` transcript is enabled for this run. */
148
+ outputTranscript?: boolean;
66
149
  /** Parent abort signal — when aborted, the subagent is also stopped. */
67
150
  signal?: AbortSignal;
151
+ /**
152
+ * Called synchronously once the record is in the map and its promise is set,
153
+ * before `onSessionCreated` fires — where callers attach the output file.
154
+ *
155
+ * Carried on the options rather than parked on the manager for the duration
156
+ * of a spawn: with a foreground queue, `startAgent` can run at drain time,
157
+ * long after any such field would have been restored, and the callback would
158
+ * silently never fire (or fire into an unrelated caller's closure).
159
+ */
160
+ onSpawned?: (id: string) => void;
161
+ /**
162
+ * Called synchronously when the spawn is queued instead of started, with how
163
+ * many entries in its own pool are ahead of it. The foreground UI uses it to
164
+ * say so while it waits; nothing else needs it.
165
+ */
166
+ onQueued?: (id: string, ahead: number) => void;
68
167
  /** Called on tool start/end with activity info (for streaming progress to UI). */
69
168
  onToolActivity?: (activity: ToolActivity) => void;
70
169
  /** Called on streaming text deltas from the assistant response. */
@@ -81,8 +180,45 @@ interface SpawnOptions {
81
180
  }) => void;
82
181
  /** Called when the session successfully compacts. */
83
182
  onCompaction?: (info: CompactionInfo) => void;
84
- /** Called synchronously after the record exists, before it is queued or started. */
85
- onSpawned?: (id: string) => void;
183
+ /** Nesting depth: top-level subagent = 1. */
184
+ depth?: number;
185
+ /** Parent agent ID for ownership-scoped nested controls. */
186
+ parentAgentId?: string;
187
+ /** Effective inherited nesting cap for this branch. */
188
+ maxSubagentDepth?: number;
189
+ /** Config-discovery root inherited by nested launches when it differs from the working directory. */
190
+ configCwd?: string;
191
+ /** Root session id, inherited by nested launches so transcripts stay grouped. */
192
+ rootSessionId?: string;
193
+ }
194
+ interface ResumeOptions {
195
+ /**
196
+ * Run the resumed turn detached in the background: return immediately with
197
+ * the record still "running" (or "queued" at the concurrency limit) and
198
+ * notify on completion via onComplete, exactly like a background spawn.
199
+ * Default (false/undefined) runs the resume inline and returns the settled
200
+ * record — the historical behavior.
201
+ */
202
+ isBackground?: boolean;
203
+ /** Called on tool start/end with activity info (for streaming progress to UI). */
204
+ onToolActivity?: (activity: ToolActivity) => void;
205
+ /** Called once per assistant message_end with that message's usage delta. */
206
+ onAssistantUsage?: (usage: {
207
+ input: number;
208
+ output: number;
209
+ cacheWrite: number;
210
+ }) => void;
211
+ /** Called when the session successfully compacts. */
212
+ onCompaction?: (info: CompactionInfo) => void;
213
+ /**
214
+ * Background resume only: called synchronously when the run actually starts —
215
+ * immediately, or later from drainQueue. Callers wire per-run side effects
216
+ * (output-file streaming) here rather than at the call site, so a resume that
217
+ * is stopped while still queued never leaves a subscription behind: `abort()`
218
+ * drops a queued record without reaching `settle()`, which is what would have
219
+ * torn that subscription down.
220
+ */
221
+ onStarted?: () => void;
86
222
  }
87
223
  export declare class AgentManager {
88
224
  private agents;
@@ -90,55 +226,195 @@ export declare class AgentManager {
90
226
  private onComplete?;
91
227
  private onStart?;
92
228
  private onCompact?;
229
+ private onUsage?;
93
230
  private maxConcurrent;
231
+ private maxConcurrentForeground;
94
232
  /** Base repos worktrees were created from — so dispose() can prune them all,
95
233
  * not just the parent repo (caller-supplied cwd can target other repos). */
96
234
  private worktreeRepos;
97
235
  /** Project cwd for each record's durable checkpoint. */
98
236
  private recoveryCwds;
99
- /** Queue of background agents waiting to start. */
237
+ /**
238
+ * Startup phases, keyed by agent id. `spawn()` still returns synchronously,
239
+ * but an agent using worktree isolation is not running yet when it does —
240
+ * copying the repo is an awaited git call. This is what `awaitStartup` hands
241
+ * callers that must fail their tool call on a startup failure, and what
242
+ * `waitForAll` waits on while a record is "running" with no `promise` yet.
243
+ * Entries are dropped once the run is underway, and kept (rejected) after a
244
+ * startup failure so a late `awaitStartup` still sees it.
245
+ */
246
+ private startups;
247
+ /**
248
+ * Evicted agents that can still be reached by name, keyed by handle. Outlives
249
+ * the 10-minute record cleanup — that timer exists to bound memory, not to
250
+ * expire a conversation the user might still want — and is cleared alongside
251
+ * completed records on session start/switch.
252
+ */
253
+ private tombstones;
254
+ /**
255
+ * Agents waiting to start, tagged with the pool they wait on. One queue for
256
+ * both pools: `drainQueue` picks the earliest entry whose own pool has room,
257
+ * so neither can head-of-line-block the other, and every removal path
258
+ * (`abort`, `abortAll`, `dispose`) stays a single filter.
259
+ *
260
+ * `release` wakes a caller blocked in `spawnAndWait`, and is fired once the
261
+ * entry's `start` has SETTLED rather than at drain time: startup is async
262
+ * now, so releasing earlier would wake the caller before `record.promise`
263
+ * exists and it would read a still-starting agent as one that never ran.
264
+ * Removing an entry from this array MUST release it — a queued record has no
265
+ * promise to await, and pi has no tool-execution timeout to bail the caller
266
+ * out.
267
+ */
100
268
  private queue;
101
269
  /** Number of currently running background agents. */
102
270
  private runningBackground;
103
- /** Prevent late promise settlement from decrementing a replacement run. */
104
- private runningBackgroundIds;
105
- constructor(onComplete?: OnAgentComplete, maxConcurrent?: number, onStart?: OnAgentStart, onCompact?: OnAgentCompact);
271
+ /** Number of currently running foreground (blocking) agents. */
272
+ private runningForeground;
273
+ constructor(onComplete?: OnAgentComplete, maxConcurrent?: number, onStart?: OnAgentStart, onCompact?: OnAgentCompact, onUsage?: OnAgentUsage);
106
274
  /** Update the max concurrent background agents limit. */
107
275
  setMaxConcurrent(n: number): void;
108
276
  getMaxConcurrent(): number;
109
- private finishBackground;
277
+ /** Update the max concurrent foreground (blocking) agents limit. 0 = unlimited. */
278
+ setMaxConcurrentForeground(n: number): void;
279
+ getMaxConcurrentForeground(): number;
280
+ /**
281
+ * Which pool a spawn is charged to, or undefined for one that is charged to
282
+ * neither (nested children, detached non-background spawns).
283
+ *
284
+ * Nothing here queues when the limit is unset — `poolHasRoom` reports an
285
+ * unlimited pool as always having room, so that alone is what keeps the
286
+ * default path identical. The `> 0` guard is belt and braces on top: it also
287
+ * keeps the counter from churning and the settle path from calling a drain
288
+ * that would find nothing to do. Both are unobservable, which is why no test
289
+ * pins them; the observable half — that the default start stays synchronous —
290
+ * is pinned in `test/foreground-concurrency.test.ts`.
291
+ */
292
+ private poolFor;
293
+ private poolHasRoom;
294
+ /**
295
+ * Spawn an agent and return its ID immediately (for background use).
296
+ * If the concurrency limit is reached, the agent is queued.
297
+ *
298
+ * The id comes back synchronously, but with `isolation: "worktree"` the agent
299
+ * is not running yet when it does — the repo copy is an awaited git call.
300
+ * Callers that must fail a tool call on a startup failure await
301
+ * `awaitStartup(id)`; everyone else sees it on the record (status "error").
302
+ */
303
+ spawn(pi: ExtensionAPI, ctx: ExtensionContext, type: SubagentType, prompt: string, options: SpawnOptions): string;
304
+ /**
305
+ * Attach the project-local transcript once for a newly-created record.
306
+ * Repeated calls are harmless: deterministic paths and an existing file keep
307
+ * the initial user entry intact, which is important for resume and retries.
308
+ */
309
+ private attachDurableTranscript;
110
310
  private checkpointStatus;
111
311
  private makeCheckpoint;
112
312
  private checkpoint;
113
- private flushOutput;
114
- /** Set the durable transcript locator and checkpoint the current state. */
115
- setTranscript(id: string, historyFile: string, transcriptPath: string, cwd?: string): void;
116
- /** Checkpoint one record explicitly (used after transcript setup). */
313
+ /** Checkpoint a record after external transcript wiring. */
117
314
  checkpointRecord(id: string): void;
315
+ /** Register durable transcript metadata for compatibility with callers that
316
+ * attach a pre-existing history (for example a restored session). */
317
+ setTranscript(id: string, historyFile: string, transcriptPath: string, cwd?: string): void;
318
+ /** Restore active checkpoints as stopped partial history after a restart. */
319
+ restoreRecovered(cwd: string): void;
118
320
  /**
119
- * Reload durable records from this project's checkpoint directory. A
120
- * running/queued checkpoint means the process was killed before it could
121
- * write its stopped state; treat it as stopped and retain its transcript.
122
- * SIGKILL cannot run a final flush/checkpoint, so this active snapshot is
123
- * necessarily the last recoverable state.
321
+ * Restore terminal records from durable history without creating sessions.
322
+ * Invalid and live records are ignored so recovery cannot replace active work.
124
323
  */
125
- restoreRecovered(cwd: string): void;
324
+ restoreCompleted(records: readonly Partial<AgentRecord>[]): void;
126
325
  /**
127
- * Spawn an agent and return its ID immediately (for background use).
128
- * If the concurrency limit is reached, the agent is queued.
326
+ * Wire a parent abort signal for a record that is about to be QUEUED.
327
+ * `startAgent` does this for running agents, and a queued record never gets
328
+ * there, so without this Esc could not release a queue position.
329
+ *
330
+ * Returns false when the signal is ALREADY aborted, in which case the record
331
+ * is stopped here and must not be enqueued: `addEventListener` never fires on
332
+ * an aborted signal, so a `spawnAndWait` on it would wait forever — pi has no
333
+ * tool-execution timeout to bail it out.
334
+ *
335
+ * The listener is left in place when the agent starts. `startAgent` adds its
336
+ * own, so both fire on a later abort, but `abort()` on an already-stopped
337
+ * record is a no-op — so detaching would only be tidiness, and tidiness the
338
+ * `abortAll`/`dispose` paths could not offer anyway.
129
339
  */
130
- spawn(pi: ExtensionAPI, ctx: ExtensionContext, type: SubagentType, prompt: string, options: SpawnOptions): string;
340
+ private armQueuedAbort;
341
+ /**
342
+ * Kick off an agent's startup and register it under `startups`. The returned
343
+ * promise never rejects — the failure is delivered through `awaitStartup`,
344
+ * and to the record.
345
+ *
346
+ * @param queuedPool - The pool this start was QUEUED on, or undefined for an
347
+ * immediate start. A queue drain can be minutes after `spawn()` returned,
348
+ * and nobody is awaiting `awaitStartup` by then, so a failure has to live
349
+ * on the record as status "error" — what drainQueue did when the throw was
350
+ * still synchronous. An immediate start instead drops the record, exactly
351
+ * as the throw out of `spawn()` did: no orphan in `listAgents()`, and the
352
+ * handle goes back.
353
+ */
354
+ private launch;
355
+ /**
356
+ * Resolves once the agent is actually running, and rejects with the startup
357
+ * failure (strict worktree isolation) that `spawn()` used to throw before the
358
+ * repo copy became async. Resolves immediately for an agent that is already
359
+ * running, still queued, or unknown — so callers can await it unconditionally.
360
+ *
361
+ * Call it in the same tick as the `spawn()` it belongs to: a failed startup
362
+ * takes its record (and this entry) with it, exactly as the throw did.
363
+ */
364
+ awaitStartup(id: string): Promise<void>;
131
365
  /** Actually start an agent (called immediately or from queue drain). */
132
366
  private startAgent;
133
- /** Start queued agents up to the concurrency limit. */
367
+ /**
368
+ * The shared tail of both settle paths: release whatever pool slot the run
369
+ * held, notify, and let the queue drain into the freed slot.
370
+ *
371
+ * The decrement lives HERE and nowhere else. `abort()` on a running record
372
+ * only fires its controller and leaves the run to settle normally, so
373
+ * decrementing there too would double-free — permanently lifting the limit.
374
+ *
375
+ * Foreground agents fire `onComplete` for lifecycle symmetry, with
376
+ * `resultConsumed` set so the callback skips notifications the inline result
377
+ * already delivered.
378
+ *
379
+ * @param guardCallback swallow a throwing `onComplete` (the success path does;
380
+ * the error path historically did not, and keeps not doing so).
381
+ * @param pool the pool this run was CHARGED TO at start time — passed in, not
382
+ * recomputed, so a mid-run change to `maxConcurrentForeground` can't make
383
+ * the release disagree with the acquire.
384
+ */
385
+ private settleRun;
386
+ private flushOutput;
387
+ /**
388
+ * Stop the nested children a settled parent owns. Nested records are hidden
389
+ * from the UI and only their owner can consume them, so a child outliving its
390
+ * parent would burn tokens unseen with no way to reach it. Grandchildren are
391
+ * covered transitively — each abort lands in that child's own settle path.
392
+ */
393
+ private abortOwnedChildren;
394
+ /**
395
+ * Start queued agents up to each pool's concurrency limit.
396
+ *
397
+ * `findIndex` on the entry's OWN pool rather than `shift`: with one queue
398
+ * serving two independent limits, a saturated foreground pool at the head
399
+ * would otherwise stall every background agent behind it. Taking the earliest
400
+ * eligible entry keeps FIFO within each pool, which is what callers see.
401
+ */
134
402
  private drainQueue;
403
+ /**
404
+ * Remove queued entries and wake anyone blocked on them. The single point
405
+ * that enforces "leaving the queue releases the waiter" — a missed release is
406
+ * an unbounded hang, not a failed call.
407
+ */
408
+ private dequeue;
135
409
  /**
136
410
  * Spawn an agent and wait for completion (foreground use).
137
- * Foreground agents bypass the concurrency queue.
411
+ * Charged to the foreground pool (`maxConcurrentForeground`), which is
412
+ * unlimited by default; never to the background one.
138
413
  * Returns { id, record } so callers can access the agent ID.
139
414
  *
140
- * @param onSpawned - Called synchronously after spawn(), before onSessionCreated fires.
141
- * Use this to set record.outputFile so streamToOutputFile can pick it up.
415
+ * @param onSpawned - Called synchronously once the run is kicked off, before
416
+ * onSessionCreated fires. Use this to set record.outputFile so
417
+ * streamToOutputFile can pick it up.
142
418
  */
143
419
  spawnAndWait(pi: ExtensionAPI, ctx: ExtensionContext, type: SubagentType, prompt: string, options: Omit<SpawnOptions, "isBackground">, onSpawned?: (id: string) => void): Promise<{
144
420
  id: string;
@@ -147,7 +423,15 @@ export declare class AgentManager {
147
423
  /**
148
424
  * Resume an existing agent session with a new prompt.
149
425
  */
150
- resume(id: string, prompt: string, signal?: AbortSignal): Promise<AgentRecord | undefined>;
426
+ resume(id: string, prompt: string, signal?: AbortSignal, options?: ResumeOptions): Promise<AgentRecord | undefined>;
427
+ /**
428
+ * Start a background resume run: detached, settling and notifying like
429
+ * startAgent's background path. Invoked immediately, or from drainQueue when
430
+ * a concurrency slot frees. The session already exists (resume reuses it), so
431
+ * there is no onSessionCreated to hang per-run wiring off — callers use
432
+ * `options.onStarted`, which fires on both the immediate and the drained path.
433
+ */
434
+ private startResume;
151
435
  /**
152
436
  * Send a steering message to an agent from the UI (mirrors the steer_subagent
153
437
  * tool). A live session delivers it now — it interrupts the agent after its
@@ -158,13 +442,38 @@ export declare class AgentManager {
158
442
  */
159
443
  steer(id: string, message: string): boolean;
160
444
  getRecord(id: string): AgentRecord | undefined;
445
+ /** Handles already in use, so a fresh spawn can pick an unclaimed one. */
446
+ private takenHandles;
447
+ /**
448
+ * Resolve an `@name` from the prompt. Matches a top-level agent's handle
449
+ * case-insensitively, preferring one that can still be steered and otherwise
450
+ * the most recently started (which is the one a resume should continue), then
451
+ * falls back to an exact agent id so `@<agentId>` works too.
452
+ */
453
+ resolveMention(name: string): MentionResolution | undefined;
454
+ /**
455
+ * Forget an evicted agent, by handle. For the case where its session file has
456
+ * gone: the entry can then only ever fail, while still holding the name
457
+ * against the type that would otherwise start a fresh agent under it.
458
+ *
459
+ * A *successful* resume does not drop its tombstone — the live record it
460
+ * creates already wins in `resolveMention`, and overwrites the entry in place
461
+ * when it is itself evicted.
462
+ */
463
+ dropTombstone(handle: string): void;
464
+ /** Evicted agents whose conversation can still be reopened, newest first. */
465
+ listTombstones(): AgentTombstone[];
161
466
  listAgents(): AgentRecord[];
162
- /** Restore terminal records persisted by a parent branch without runtime handles. */
163
- restoreCompleted(records: readonly unknown[]): void;
164
- private createRestoredRecord;
165
467
  abort(id: string): boolean;
166
468
  /** Dispose a record's session and remove it from the map. */
167
469
  private removeRecord;
470
+ /**
471
+ * Preserve enough of a departing record for `@handle` to reopen its
472
+ * conversation later. Nothing to keep unless it has both a handle to be
473
+ * addressed by and a session file to reopen — an in-memory session leaves no
474
+ * transcript, so the mention would have nothing to continue from.
475
+ */
476
+ private tombstone;
168
477
  private cleanup;
169
478
  /**
170
479
  * Remove all completed/stopped/errored records immediately.
@@ -179,7 +488,12 @@ export declare class AgentManager {
179
488
  abortAll(): number;
180
489
  /** Wait for all running and queued agents to complete (including queued ones). */
181
490
  waitForAll(): Promise<void>;
182
- dispose(): void;
491
+ /**
492
+ * @param pi - Needed to run `git worktree prune`, which is async now and so
493
+ * cannot be reached through a stored spawn argument at shutdown. Omitting
494
+ * it (tests, teardown of a manager that never spawned) skips the prune.
495
+ */
496
+ dispose(pi?: ExtensionAPI): Promise<void>;
183
497
  }
184
498
  export {};
185
499
  //# sourceMappingURL=agent-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-manager.d.ts","sourceRoot":"","sources":["../src/agent-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AASpG,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAI3G,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;AAC5D,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;AACzD,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;AACjF,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAOnG,KAAK,qBAAqB,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,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