@agimon-ai/doompi-team 0.0.1-alpha.2 → 0.0.1-alpha.21

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 (727) hide show
  1. package/README.md +33 -17
  2. package/dist/adapters/asyncJobTracker.cjs +2 -0
  3. package/dist/adapters/asyncJobTracker.cjs.map +1 -0
  4. package/dist/adapters/asyncJobTracker.mjs +2 -0
  5. package/dist/adapters/asyncJobTracker.mjs.map +1 -0
  6. package/dist/adapters/atomicJson.cjs +2 -0
  7. package/dist/adapters/atomicJson.cjs.map +1 -0
  8. package/dist/adapters/atomicJson.mjs +2 -0
  9. package/dist/adapters/atomicJson.mjs.map +1 -0
  10. package/dist/adapters/pi/extension.cjs +2 -0
  11. package/dist/adapters/pi/extension.cjs.map +1 -0
  12. package/dist/adapters/pi/extension.mjs +2 -0
  13. package/dist/adapters/pi/extension.mjs.map +1 -0
  14. package/dist/adapters/pollScheduler.cjs +2 -0
  15. package/dist/adapters/pollScheduler.cjs.map +1 -0
  16. package/dist/adapters/pollScheduler.mjs +2 -0
  17. package/dist/adapters/pollScheduler.mjs.map +1 -0
  18. package/dist/adapters/process/childTranscript.cjs +5 -0
  19. package/dist/adapters/process/childTranscript.cjs.map +1 -0
  20. package/dist/adapters/process/childTranscript.mjs +5 -0
  21. package/dist/adapters/process/childTranscript.mjs.map +1 -0
  22. package/dist/adapters/process/env.cjs +2 -0
  23. package/dist/adapters/process/env.cjs.map +1 -0
  24. package/dist/adapters/process/env.d.cts +69 -0
  25. package/dist/adapters/process/env.d.cts.map +1 -0
  26. package/dist/adapters/process/env.d.mts +69 -0
  27. package/dist/adapters/process/env.d.mts.map +1 -0
  28. package/dist/adapters/process/env.mjs +2 -0
  29. package/dist/adapters/process/env.mjs.map +1 -0
  30. package/dist/adapters/process/sdkRunnerEntry.cjs +2 -0
  31. package/dist/adapters/process/sdkRunnerEntry.cjs.map +1 -0
  32. package/dist/adapters/process/sdkRunnerEntry.d.cts +5 -0
  33. package/dist/adapters/process/sdkRunnerEntry.d.cts.map +1 -0
  34. package/dist/adapters/process/sdkRunnerEntry.d.mts +5 -0
  35. package/dist/adapters/process/sdkRunnerEntry.d.mts.map +1 -0
  36. package/dist/adapters/process/sdkRunnerEntry.mjs +2 -0
  37. package/dist/adapters/process/sdkRunnerEntry.mjs.map +1 -0
  38. package/dist/adapters/processTerminal.cjs +2 -0
  39. package/dist/adapters/processTerminal.cjs.map +1 -0
  40. package/dist/adapters/processTerminal.mjs +2 -0
  41. package/dist/adapters/processTerminal.mjs.map +1 -0
  42. package/dist/adapters/resultWatcher.cjs +2 -0
  43. package/dist/adapters/resultWatcher.cjs.map +1 -0
  44. package/dist/adapters/resultWatcher.mjs +2 -0
  45. package/dist/adapters/resultWatcher.mjs.map +1 -0
  46. package/dist/adapters/runIdResolver.cjs +2 -0
  47. package/dist/adapters/runIdResolver.cjs.map +1 -0
  48. package/dist/adapters/runIdResolver.mjs +2 -0
  49. package/dist/adapters/runIdResolver.mjs.map +1 -0
  50. package/dist/adapters/runRegistry.cjs +2 -0
  51. package/dist/adapters/runRegistry.cjs.map +1 -0
  52. package/dist/adapters/runRegistry.mjs +2 -0
  53. package/dist/adapters/runRegistry.mjs.map +1 -0
  54. package/dist/adapters/scopeOwner.cjs +2 -0
  55. package/dist/adapters/scopeOwner.cjs.map +1 -0
  56. package/dist/adapters/scopeOwner.mjs +2 -0
  57. package/dist/adapters/scopeOwner.mjs.map +1 -0
  58. package/dist/adapters/staleRunReconciler.cjs +2 -0
  59. package/dist/adapters/staleRunReconciler.cjs.map +1 -0
  60. package/dist/adapters/staleRunReconciler.mjs +2 -0
  61. package/dist/adapters/staleRunReconciler.mjs.map +1 -0
  62. package/dist/adapters/statusReader.cjs +2 -0
  63. package/dist/adapters/statusReader.cjs.map +1 -0
  64. package/dist/adapters/statusReader.mjs +2 -0
  65. package/dist/adapters/statusReader.mjs.map +1 -0
  66. package/dist/adapters/suspendedRuns.cjs +6 -0
  67. package/dist/adapters/suspendedRuns.cjs.map +1 -0
  68. package/dist/adapters/suspendedRuns.mjs +6 -0
  69. package/dist/adapters/suspendedRuns.mjs.map +1 -0
  70. package/dist/api/backgroundWork.cjs +1 -1
  71. package/dist/api/backgroundWork.d.cts +2 -2
  72. package/dist/api/backgroundWork.d.mts +2 -2
  73. package/dist/api/backgroundWork.mjs +1 -1
  74. package/dist/api/capabilityCeiling.cjs +1 -1
  75. package/dist/api/capabilityCeiling.d.cts +3 -3
  76. package/dist/api/capabilityCeiling.d.mts +3 -3
  77. package/dist/api/capabilityCeiling.mjs +1 -2
  78. package/dist/api/delegation.cjs +1 -1
  79. package/dist/api/delegation.d.cts +1 -1
  80. package/dist/api/delegation.d.mts +1 -1
  81. package/dist/api/delegation.mjs +1 -1
  82. package/dist/api/teamSnapshot.cjs +1 -1
  83. package/dist/api/teamSnapshot.d.cts +2 -2
  84. package/dist/api/teamSnapshot.d.mts +2 -2
  85. package/dist/api/teamSnapshot.mjs +1 -2
  86. package/dist/commands/slash/chainExpression.cjs.map +1 -0
  87. package/dist/commands/slash/chainExpression.mjs.map +1 -0
  88. package/dist/commands/slash/doctor.cjs +5 -0
  89. package/dist/commands/slash/doctor.cjs.map +1 -0
  90. package/dist/commands/slash/doctor.mjs +5 -0
  91. package/dist/{slash/doctor.cjs.map → commands/slash/doctor.mjs.map} +1 -1
  92. package/dist/{slash → commands/slash}/slashCommands.cjs +1 -1
  93. package/dist/commands/slash/slashCommands.cjs.map +1 -0
  94. package/dist/{slash → commands/slash}/slashCommands.mjs +2 -2
  95. package/dist/commands/slash/slashCommands.mjs.map +1 -0
  96. package/dist/commands/slash/spawnRequestMapping.cjs.map +1 -0
  97. package/dist/commands/slash/spawnRequestMapping.mjs.map +1 -0
  98. package/dist/commands/slash/subagentLaunch.cjs +2 -0
  99. package/dist/commands/slash/subagentLaunch.cjs.map +1 -0
  100. package/dist/commands/slash/subagentLaunch.mjs +2 -0
  101. package/dist/commands/slash/subagentLaunch.mjs.map +1 -0
  102. package/dist/container/globalBridge.cjs.map +1 -1
  103. package/dist/container/globalBridge.d.cts +1 -1
  104. package/dist/container/globalBridge.d.mts +1 -1
  105. package/dist/container/globalBridge.mjs.map +1 -1
  106. package/dist/container/index.cjs +1 -1
  107. package/dist/container/index.cjs.map +1 -1
  108. package/dist/container/index.d.cts +2 -1
  109. package/dist/container/index.d.cts.map +1 -1
  110. package/dist/container/index.d.mts +2 -1
  111. package/dist/container/index.d.mts.map +1 -1
  112. package/dist/container/index.mjs +1 -1
  113. package/dist/container/index.mjs.map +1 -1
  114. package/dist/container/modules/agents.cjs +1 -1
  115. package/dist/container/modules/agents.cjs.map +1 -1
  116. package/dist/container/modules/agents.mjs +1 -1
  117. package/dist/container/modules/agents.mjs.map +1 -1
  118. package/dist/container/modules/core.cjs +1 -1
  119. package/dist/container/modules/core.cjs.map +1 -1
  120. package/dist/container/modules/core.mjs +1 -1
  121. package/dist/container/modules/core.mjs.map +1 -1
  122. package/dist/container/modules/extensions.cjs +1 -1
  123. package/dist/container/modules/extensions.cjs.map +1 -1
  124. package/dist/container/modules/extensions.mjs +1 -1
  125. package/dist/container/modules/extensions.mjs.map +1 -1
  126. package/dist/container/modules/intercom.cjs +1 -1
  127. package/dist/container/modules/intercom.cjs.map +1 -1
  128. package/dist/container/modules/intercom.mjs +1 -1
  129. package/dist/container/modules/intercom.mjs.map +1 -1
  130. package/dist/container/modules/runs.cjs +1 -1
  131. package/dist/container/modules/runs.cjs.map +1 -1
  132. package/dist/container/modules/runs.mjs +1 -1
  133. package/dist/container/modules/runs.mjs.map +1 -1
  134. package/dist/container/types.cjs +1 -1
  135. package/dist/container/types.cjs.map +1 -1
  136. package/dist/container/types.d.cts +1 -0
  137. package/dist/container/types.d.cts.map +1 -1
  138. package/dist/container/types.d.mts +1 -0
  139. package/dist/container/types.d.mts.map +1 -1
  140. package/dist/container/types.mjs +1 -1
  141. package/dist/container/types.mjs.map +1 -1
  142. package/dist/env.cjs +1 -2
  143. package/dist/env.d.cts +2 -65
  144. package/dist/env.d.mts +2 -65
  145. package/dist/env.mjs +1 -1
  146. package/dist/env.mjs.map +1 -1
  147. package/dist/extensions/config.cjs.map +1 -1
  148. package/dist/extensions/config.mjs.map +1 -1
  149. package/dist/extensions/delegationBridge.cjs.map +1 -1
  150. package/dist/extensions/delegationBridge.mjs.map +1 -1
  151. package/dist/extensions/doom.cjs +1 -1
  152. package/dist/extensions/doom.cjs.map +1 -1
  153. package/dist/extensions/doom.mjs +1 -1
  154. package/dist/extensions/doom.mjs.map +1 -1
  155. package/dist/extensions/fablePlanBridge.cjs +1 -1
  156. package/dist/extensions/fablePlanBridge.cjs.map +1 -1
  157. package/dist/extensions/fablePlanBridge.mjs +1 -1
  158. package/dist/extensions/fablePlanBridge.mjs.map +1 -1
  159. package/dist/extensions/managementActions.cjs +1 -1
  160. package/dist/extensions/managementActions.cjs.map +1 -1
  161. package/dist/extensions/managementActions.mjs +1 -1
  162. package/dist/extensions/managementActions.mjs.map +1 -1
  163. package/dist/extensions/operationJournal.cjs +1 -1
  164. package/dist/extensions/operationJournal.cjs.map +1 -1
  165. package/dist/extensions/operationJournal.mjs +1 -1
  166. package/dist/extensions/operationJournal.mjs.map +1 -1
  167. package/dist/extensions/orchestratorPrompt.cjs +5 -6
  168. package/dist/extensions/orchestratorPrompt.cjs.map +1 -1
  169. package/dist/extensions/orchestratorPrompt.mjs +5 -6
  170. package/dist/extensions/orchestratorPrompt.mjs.map +1 -1
  171. package/dist/extensions/schemas.mjs.map +1 -1
  172. package/dist/extensions/spawnPlan.cjs +3 -2
  173. package/dist/extensions/spawnPlan.cjs.map +1 -1
  174. package/dist/extensions/spawnPlan.mjs +3 -2
  175. package/dist/extensions/spawnPlan.mjs.map +1 -1
  176. package/dist/extensions/standard.cjs +1 -1
  177. package/dist/extensions/standard.cjs.map +1 -1
  178. package/dist/extensions/standard.mjs +1 -1
  179. package/dist/extensions/standard.mjs.map +1 -1
  180. package/dist/extensions/statusViews.cjs +1 -1
  181. package/dist/extensions/statusViews.cjs.map +1 -1
  182. package/dist/extensions/statusViews.mjs +2 -2
  183. package/dist/extensions/statusViews.mjs.map +1 -1
  184. package/dist/extensions/subagentPromptRuntime.cjs +11 -11
  185. package/dist/extensions/subagentPromptRuntime.cjs.map +1 -1
  186. package/dist/extensions/subagentPromptRuntime.d.cts.map +1 -1
  187. package/dist/extensions/subagentPromptRuntime.d.mts.map +1 -1
  188. package/dist/extensions/subagentPromptRuntime.mjs +5 -5
  189. package/dist/extensions/subagentPromptRuntime.mjs.map +1 -1
  190. package/dist/extensions/subagentTool.cjs +5 -6
  191. package/dist/extensions/subagentTool.cjs.map +1 -1
  192. package/dist/extensions/subagentTool.mjs +5 -6
  193. package/dist/extensions/subagentTool.mjs.map +1 -1
  194. package/dist/extensions/toolDescription.cjs +1 -1
  195. package/dist/extensions/toolDescription.cjs.map +1 -1
  196. package/dist/extensions/toolDescription.mjs +1 -1
  197. package/dist/extensions/toolDescription.mjs.map +1 -1
  198. package/dist/index.cjs +1 -1
  199. package/dist/index.cjs.map +1 -1
  200. package/dist/index.d.cts +2 -2
  201. package/dist/index.d.cts.map +1 -1
  202. package/dist/index.d.mts +2 -2
  203. package/dist/index.d.mts.map +1 -1
  204. package/dist/index.mjs +1 -1
  205. package/dist/index.mjs.map +1 -1
  206. package/dist/runs/background/cliRunnerEntry.cjs +1 -2
  207. package/dist/runs/background/cliRunnerEntry.mjs +1 -2
  208. package/dist/runs/sdkRunnerEntry.cjs +1 -2
  209. package/dist/runs/sdkRunnerEntry.d.cts +2 -1
  210. package/dist/runs/sdkRunnerEntry.d.mts +2 -1
  211. package/dist/runs/sdkRunnerEntry.mjs +1 -2
  212. package/dist/schemas/team/backgroundWork.cjs +2 -0
  213. package/dist/schemas/team/backgroundWork.cjs.map +1 -0
  214. package/dist/{protocol → schemas/team}/backgroundWork.d.cts +2 -2
  215. package/dist/schemas/team/backgroundWork.d.cts.map +1 -0
  216. package/dist/{protocol → schemas/team}/backgroundWork.d.mts +2 -2
  217. package/dist/schemas/team/backgroundWork.d.mts.map +1 -0
  218. package/dist/schemas/team/backgroundWork.mjs +2 -0
  219. package/dist/{protocol/backgroundWork.cjs.map → schemas/team/backgroundWork.mjs.map} +1 -1
  220. package/dist/schemas/team/capabilityCeiling.cjs +2 -0
  221. package/dist/schemas/team/capabilityCeiling.cjs.map +1 -0
  222. package/dist/{protocol → schemas/team}/capabilityCeiling.d.cts +3 -3
  223. package/dist/schemas/team/capabilityCeiling.d.cts.map +1 -0
  224. package/dist/{protocol → schemas/team}/capabilityCeiling.d.mts +3 -3
  225. package/dist/schemas/team/capabilityCeiling.d.mts.map +1 -0
  226. package/dist/schemas/team/capabilityCeiling.mjs +2 -0
  227. package/dist/schemas/team/capabilityCeiling.mjs.map +1 -0
  228. package/dist/schemas/team/delegation.cjs.map +1 -0
  229. package/dist/{protocol → schemas/team}/delegation.d.cts +1 -1
  230. package/dist/schemas/team/delegation.d.cts.map +1 -0
  231. package/dist/{protocol → schemas/team}/delegation.d.mts +1 -1
  232. package/dist/schemas/team/delegation.d.mts.map +1 -0
  233. package/dist/schemas/team/delegation.mjs.map +1 -0
  234. package/dist/schemas/team/packageConfig.cjs +2 -0
  235. package/dist/schemas/team/packageConfig.cjs.map +1 -0
  236. package/dist/schemas/team/packageConfig.mjs +2 -0
  237. package/dist/schemas/team/packageConfig.mjs.map +1 -0
  238. package/dist/services/agents/discovery.cjs +2 -0
  239. package/dist/services/agents/discovery.cjs.map +1 -0
  240. package/dist/services/agents/discovery.mjs +2 -0
  241. package/dist/services/agents/discovery.mjs.map +1 -0
  242. package/dist/services/agents/frontmatter.cjs.map +1 -0
  243. package/dist/{agents → services/agents}/frontmatter.mjs +1 -1
  244. package/dist/services/agents/frontmatter.mjs.map +1 -0
  245. package/dist/services/agents/loader.cjs +2 -0
  246. package/dist/services/agents/loader.cjs.map +1 -0
  247. package/dist/services/agents/loader.mjs +2 -0
  248. package/dist/services/agents/loader.mjs.map +1 -0
  249. package/dist/services/agents/memory.cjs +3 -0
  250. package/dist/services/agents/memory.cjs.map +1 -0
  251. package/dist/{agents → services/agents}/memory.mjs +1 -1
  252. package/dist/services/agents/memory.mjs.map +1 -0
  253. package/dist/services/agents/projectRoot.cjs +2 -0
  254. package/dist/services/agents/projectRoot.cjs.map +1 -0
  255. package/dist/services/agents/projectRoot.mjs +2 -0
  256. package/dist/services/agents/projectRoot.mjs.map +1 -0
  257. package/dist/services/agents/settings.cjs +2 -0
  258. package/dist/services/agents/settings.cjs.map +1 -0
  259. package/dist/services/agents/settings.mjs +2 -0
  260. package/dist/services/agents/settings.mjs.map +1 -0
  261. package/dist/services/agents/skills.cjs +0 -0
  262. package/dist/services/agents/skills.cjs.map +1 -0
  263. package/dist/services/agents/skills.mjs +5 -0
  264. package/dist/services/agents/skills.mjs.map +1 -0
  265. package/dist/{agents → services/agents}/types.d.cts +4 -4
  266. package/dist/services/agents/types.d.cts.map +1 -0
  267. package/dist/{agents → services/agents}/types.d.mts +4 -4
  268. package/dist/services/agents/types.d.mts.map +1 -0
  269. package/dist/services/api/backgroundWork.cjs +1 -0
  270. package/dist/services/api/backgroundWork.d.cts +1 -0
  271. package/dist/services/api/backgroundWork.d.mts +1 -0
  272. package/dist/services/api/backgroundWork.mjs +1 -0
  273. package/dist/services/api/capabilityCeiling.cjs +1 -0
  274. package/dist/services/api/capabilityCeiling.d.cts +2 -0
  275. package/dist/services/api/capabilityCeiling.d.mts +2 -0
  276. package/dist/services/api/capabilityCeiling.mjs +2 -0
  277. package/dist/services/api/capabilityCeiling.mjs.map +1 -0
  278. package/dist/services/api/teamSnapshot.cjs +1 -0
  279. package/dist/services/api/teamSnapshot.d.cts +1 -0
  280. package/dist/services/api/teamSnapshot.d.mts +1 -0
  281. package/dist/services/api/teamSnapshot.mjs +2 -0
  282. package/dist/services/api/teamSnapshot.mjs.map +1 -0
  283. package/dist/services/intercom/intercomBridge.cjs.map +1 -0
  284. package/dist/services/intercom/intercomBridge.mjs.map +1 -0
  285. package/dist/services/intercom/nativeTeamChannel.cjs +5 -0
  286. package/dist/services/intercom/nativeTeamChannel.cjs.map +1 -0
  287. package/dist/{intercom → services/intercom}/nativeTeamChannel.d.cts +1 -1
  288. package/dist/services/intercom/nativeTeamChannel.d.cts.map +1 -0
  289. package/dist/{intercom → services/intercom}/nativeTeamChannel.d.mts +1 -1
  290. package/dist/services/intercom/nativeTeamChannel.d.mts.map +1 -0
  291. package/dist/services/intercom/nativeTeamChannel.mjs +5 -0
  292. package/dist/services/intercom/nativeTeamChannel.mjs.map +1 -0
  293. package/dist/services/intercom/supervisorControlChannel.cjs +2 -0
  294. package/dist/services/intercom/supervisorControlChannel.cjs.map +1 -0
  295. package/dist/{intercom → services/intercom}/supervisorControlChannel.mjs +1 -1
  296. package/dist/services/intercom/supervisorControlChannel.mjs.map +1 -0
  297. package/dist/services/runs/background/asyncExecution.cjs +2 -0
  298. package/dist/services/runs/background/asyncExecution.cjs.map +1 -0
  299. package/dist/services/runs/background/asyncExecution.mjs +2 -0
  300. package/dist/services/runs/background/asyncExecution.mjs.map +1 -0
  301. package/dist/services/runs/background/asyncJobTracker.cjs +1 -0
  302. package/dist/services/runs/background/asyncJobTracker.mjs +2 -0
  303. package/dist/services/runs/background/asyncJobTracker.mjs.map +1 -0
  304. package/dist/services/runs/background/cliRunnerEntry.cjs +2 -0
  305. package/dist/services/runs/background/cliRunnerEntry.cjs.map +1 -0
  306. package/dist/services/runs/background/cliRunnerEntry.mjs +2 -0
  307. package/dist/services/runs/background/cliRunnerEntry.mjs.map +1 -0
  308. package/dist/services/runs/background/completionBatcher.cjs.map +1 -0
  309. package/dist/services/runs/background/completionBatcher.mjs +2 -0
  310. package/dist/services/runs/background/completionBatcher.mjs.map +1 -0
  311. package/dist/{runs → services/runs}/background/notify.cjs +1 -1
  312. package/dist/services/runs/background/notify.cjs.map +1 -0
  313. package/dist/{runs → services/runs}/background/notify.mjs +1 -1
  314. package/dist/services/runs/background/notify.mjs.map +1 -0
  315. package/dist/services/runs/background/parentWatchdog.cjs.map +1 -0
  316. package/dist/services/runs/background/parentWatchdog.mjs.map +1 -0
  317. package/dist/services/runs/background/processTerminal.cjs +1 -0
  318. package/dist/services/runs/background/processTerminal.mjs +2 -0
  319. package/dist/services/runs/background/processTerminal.mjs.map +1 -0
  320. package/dist/services/runs/background/resultWatcher.cjs +1 -0
  321. package/dist/services/runs/background/resultWatcher.mjs +2 -0
  322. package/dist/services/runs/background/resultWatcher.mjs.map +1 -0
  323. package/dist/services/runs/background/runIdResolver.cjs +1 -0
  324. package/dist/services/runs/background/runIdResolver.mjs +2 -0
  325. package/dist/services/runs/background/runIdResolver.mjs.map +1 -0
  326. package/dist/services/runs/background/runnerBootstrap.cjs +2 -0
  327. package/dist/services/runs/background/runnerBootstrap.cjs.map +1 -0
  328. package/dist/services/runs/background/runnerBootstrap.mjs +2 -0
  329. package/dist/services/runs/background/runnerBootstrap.mjs.map +1 -0
  330. package/dist/services/runs/background/runnerExecution.cjs +2 -0
  331. package/dist/services/runs/background/runnerExecution.cjs.map +1 -0
  332. package/dist/services/runs/background/runnerExecution.mjs +2 -0
  333. package/dist/services/runs/background/runnerExecution.mjs.map +1 -0
  334. package/dist/{runs → services/runs}/background/runnerReporting.cjs +2 -2
  335. package/dist/services/runs/background/runnerReporting.cjs.map +1 -0
  336. package/dist/{runs → services/runs}/background/runnerReporting.mjs +2 -2
  337. package/dist/services/runs/background/runnerReporting.mjs.map +1 -0
  338. package/dist/services/runs/background/runnerTeamMembership.cjs +2 -0
  339. package/dist/services/runs/background/runnerTeamMembership.cjs.map +1 -0
  340. package/dist/services/runs/background/runnerTeamMembership.mjs +2 -0
  341. package/dist/services/runs/background/runnerTeamMembership.mjs.map +1 -0
  342. package/dist/services/runs/background/spawnHandshake.cjs +2 -0
  343. package/dist/services/runs/background/spawnHandshake.cjs.map +1 -0
  344. package/dist/services/runs/background/spawnHandshake.mjs +2 -0
  345. package/dist/services/runs/background/spawnHandshake.mjs.map +1 -0
  346. package/dist/services/runs/background/staleRunReconciler.cjs +1 -0
  347. package/dist/services/runs/background/staleRunReconciler.mjs +2 -0
  348. package/dist/services/runs/background/staleRunReconciler.mjs.map +1 -0
  349. package/dist/services/runs/background/statusReader.cjs +1 -0
  350. package/dist/services/runs/background/statusReader.mjs +2 -0
  351. package/dist/services/runs/background/statusReader.mjs.map +1 -0
  352. package/dist/services/runs/background/statusWriter.cjs +2 -0
  353. package/dist/services/runs/background/statusWriter.cjs.map +1 -0
  354. package/dist/services/runs/background/statusWriter.mjs +2 -0
  355. package/dist/services/runs/background/statusWriter.mjs.map +1 -0
  356. package/dist/services/runs/background/subagentWait.cjs +2 -0
  357. package/dist/services/runs/background/subagentWait.cjs.map +1 -0
  358. package/dist/services/runs/background/subagentWait.mjs +2 -0
  359. package/dist/services/runs/background/subagentWait.mjs.map +1 -0
  360. package/dist/{runs/background/terminalPersistence.mjs → services/runs/background/terminalPersistence.cjs} +2 -2
  361. package/dist/services/runs/background/terminalPersistence.cjs.map +1 -0
  362. package/dist/services/runs/background/terminalPersistence.mjs +2 -0
  363. package/dist/services/runs/background/terminalPersistence.mjs.map +1 -0
  364. package/dist/services/runs/extensionErrorTelemetry.cjs +2 -0
  365. package/dist/services/runs/extensionErrorTelemetry.cjs.map +1 -0
  366. package/dist/services/runs/extensionErrorTelemetry.mjs +2 -0
  367. package/dist/services/runs/extensionErrorTelemetry.mjs.map +1 -0
  368. package/dist/services/runs/registry/processGroup.cjs.map +1 -0
  369. package/dist/services/runs/registry/processGroup.mjs.map +1 -0
  370. package/dist/services/runs/registry/runRegistry.cjs +1 -0
  371. package/dist/services/runs/registry/runRegistry.mjs +2 -0
  372. package/dist/services/runs/registry/runRegistry.mjs.map +1 -0
  373. package/dist/services/runs/registry/sessionLifecycle.cjs +2 -0
  374. package/dist/services/runs/registry/sessionLifecycle.cjs.map +1 -0
  375. package/dist/services/runs/registry/sessionLifecycle.mjs +2 -0
  376. package/dist/services/runs/registry/sessionLifecycle.mjs.map +1 -0
  377. package/dist/services/runs/registry/suspendedRuns.cjs +1 -0
  378. package/dist/services/runs/registry/suspendedRuns.mjs +2 -0
  379. package/dist/services/runs/registry/suspendedRuns.mjs.map +1 -0
  380. package/dist/services/runs/sdkRunnerEntry.cjs +1 -0
  381. package/dist/services/runs/sdkRunnerEntry.mjs +1 -0
  382. package/dist/services/runs/shared/claudeFableProfile.cjs +4 -0
  383. package/dist/services/runs/shared/claudeFableProfile.cjs.map +1 -0
  384. package/dist/services/runs/shared/claudeFableProfile.mjs +4 -0
  385. package/dist/services/runs/shared/claudeFableProfile.mjs.map +1 -0
  386. package/dist/services/runs/shared/depthGuard.cjs +2 -0
  387. package/dist/services/runs/shared/depthGuard.cjs.map +1 -0
  388. package/dist/services/runs/shared/depthGuard.mjs +2 -0
  389. package/dist/services/runs/shared/depthGuard.mjs.map +1 -0
  390. package/dist/services/runs/shared/mcpDirectToolAllowlist.cjs +2 -0
  391. package/dist/services/runs/shared/mcpDirectToolAllowlist.cjs.map +1 -0
  392. package/dist/services/runs/shared/mcpDirectToolAllowlist.mjs +2 -0
  393. package/dist/services/runs/shared/mcpDirectToolAllowlist.mjs.map +1 -0
  394. package/dist/services/runs/shared/modelFallback.cjs +2 -0
  395. package/dist/services/runs/shared/modelFallback.cjs.map +1 -0
  396. package/dist/services/runs/shared/modelFallback.mjs +2 -0
  397. package/dist/services/runs/shared/modelFallback.mjs.map +1 -0
  398. package/dist/services/runs/shared/modelScope.cjs +2 -0
  399. package/dist/services/runs/shared/modelScope.cjs.map +1 -0
  400. package/dist/services/runs/shared/modelScope.mjs +2 -0
  401. package/dist/services/runs/shared/modelScope.mjs.map +1 -0
  402. package/dist/services/runs/shared/nestedPath.cjs +2 -0
  403. package/dist/services/runs/shared/nestedPath.cjs.map +1 -0
  404. package/dist/services/runs/shared/nestedPath.mjs +2 -0
  405. package/dist/services/runs/shared/nestedPath.mjs.map +1 -0
  406. package/dist/services/runs/shared/piArgs.cjs +2 -0
  407. package/dist/services/runs/shared/piArgs.cjs.map +1 -0
  408. package/dist/services/runs/shared/piArgs.mjs +2 -0
  409. package/dist/services/runs/shared/piArgs.mjs.map +1 -0
  410. package/dist/services/runs/shared/piSpawn.cjs +2 -0
  411. package/dist/services/runs/shared/piSpawn.cjs.map +1 -0
  412. package/dist/services/runs/shared/piSpawn.mjs +2 -0
  413. package/dist/services/runs/shared/piSpawn.mjs.map +1 -0
  414. package/dist/services/runs/shared/runWithConcurrency.cjs +2 -0
  415. package/dist/services/runs/shared/runWithConcurrency.cjs.map +1 -0
  416. package/dist/services/runs/shared/runWithConcurrency.d.cts +25 -0
  417. package/dist/services/runs/shared/runWithConcurrency.d.cts.map +1 -0
  418. package/dist/services/runs/shared/runWithConcurrency.d.mts +25 -0
  419. package/dist/services/runs/shared/runWithConcurrency.d.mts.map +1 -0
  420. package/dist/services/runs/shared/runWithConcurrency.mjs +2 -0
  421. package/dist/services/runs/shared/runWithConcurrency.mjs.map +1 -0
  422. package/dist/services/runs/shared/runtimeRegistry.cjs +2 -0
  423. package/dist/services/runs/shared/runtimeRegistry.cjs.map +1 -0
  424. package/dist/services/runs/shared/runtimeRegistry.mjs +2 -0
  425. package/dist/services/runs/shared/runtimeRegistry.mjs.map +1 -0
  426. package/dist/services/runs/shared/structuredOutput.cjs +2 -0
  427. package/dist/{runs → services/runs}/shared/structuredOutput.cjs.map +1 -1
  428. package/dist/services/runs/shared/structuredOutput.mjs +2 -0
  429. package/dist/{runs → services/runs}/shared/structuredOutput.mjs.map +1 -1
  430. package/dist/services/runs/shared/toolAvailability.cjs +2 -0
  431. package/dist/services/runs/shared/toolAvailability.cjs.map +1 -0
  432. package/dist/services/runs/shared/toolAvailability.mjs +2 -0
  433. package/dist/services/runs/shared/toolAvailability.mjs.map +1 -0
  434. package/dist/services/runs/shared/toolBudget.cjs +2 -0
  435. package/dist/services/runs/shared/toolBudget.cjs.map +1 -0
  436. package/dist/services/runs/shared/toolBudget.mjs +2 -0
  437. package/dist/services/runs/shared/toolBudget.mjs.map +1 -0
  438. package/dist/shared/artifacts.cjs.map +1 -1
  439. package/dist/shared/artifacts.mjs.map +1 -1
  440. package/dist/shared/atomicJson.cjs +1 -2
  441. package/dist/shared/atomicJson.mjs +1 -1
  442. package/dist/shared/atomicJson.mjs.map +1 -1
  443. package/dist/shared/childTranscript.cjs +1 -5
  444. package/dist/shared/childTranscript.mjs +1 -4
  445. package/dist/shared/childTranscript.mjs.map +1 -1
  446. package/dist/shared/fileSystemRetry.cjs +1 -1
  447. package/dist/shared/fileSystemRetry.cjs.map +1 -1
  448. package/dist/shared/fileSystemRetry.mjs +1 -1
  449. package/dist/shared/fileSystemRetry.mjs.map +1 -1
  450. package/dist/shared/formatters.cjs.map +1 -1
  451. package/dist/shared/formatters.mjs.map +1 -1
  452. package/dist/shared/paths.cjs +1 -1
  453. package/dist/shared/paths.cjs.map +1 -1
  454. package/dist/shared/paths.mjs +1 -1
  455. package/dist/shared/paths.mjs.map +1 -1
  456. package/dist/shared/pollScheduler.cjs +1 -2
  457. package/dist/shared/pollScheduler.mjs +1 -1
  458. package/dist/shared/pollScheduler.mjs.map +1 -1
  459. package/dist/shared/scopeOwner.cjs +1 -2
  460. package/dist/shared/scopeOwner.mjs +1 -1
  461. package/dist/shared/scopeOwner.mjs.map +1 -1
  462. package/dist/tui/agentCatalog.cjs +1 -1
  463. package/dist/tui/agentCatalog.cjs.map +1 -1
  464. package/dist/tui/agentCatalog.mjs +1 -1
  465. package/dist/tui/agentCatalog.mjs.map +1 -1
  466. package/dist/tui/agentResourceProjection.cjs +1 -1
  467. package/dist/tui/agentResourceProjection.cjs.map +1 -1
  468. package/dist/tui/agentResourceProjection.mjs +1 -1
  469. package/dist/tui/agentResourceProjection.mjs.map +1 -1
  470. package/dist/tui/completionNotice.cjs +1 -1
  471. package/dist/tui/completionNotice.cjs.map +1 -1
  472. package/dist/tui/completionNotice.mjs +1 -1
  473. package/dist/tui/completionNotice.mjs.map +1 -1
  474. package/dist/tui/fleet.cjs +2 -2
  475. package/dist/tui/fleet.cjs.map +1 -1
  476. package/dist/tui/fleet.mjs +2 -2
  477. package/dist/tui/fleet.mjs.map +1 -1
  478. package/dist/tui/fleetAgentView.cjs.map +1 -1
  479. package/dist/tui/fleetAgentView.mjs.map +1 -1
  480. package/dist/tui/fleetStatus.cjs +1 -1
  481. package/dist/tui/fleetStatus.cjs.map +1 -1
  482. package/dist/tui/fleetStatus.mjs +1 -1
  483. package/dist/tui/fleetStatus.mjs.map +1 -1
  484. package/dist/tui/fleetTranscript.cjs +1 -1
  485. package/dist/tui/fleetTranscript.cjs.map +1 -1
  486. package/dist/tui/fleetTranscript.mjs +1 -1
  487. package/dist/tui/fleetTranscript.mjs.map +1 -1
  488. package/dist/tui/register.cjs +1 -1
  489. package/dist/tui/register.cjs.map +1 -1
  490. package/dist/tui/register.mjs +1 -1
  491. package/dist/tui/register.mjs.map +1 -1
  492. package/dist/tui/subagentToolRender.cjs +3 -0
  493. package/dist/tui/subagentToolRender.cjs.map +1 -0
  494. package/dist/tui/subagentToolRender.mjs +3 -0
  495. package/dist/tui/subagentToolRender.mjs.map +1 -0
  496. package/dist/{types.d.cts → types/index.d.cts} +2 -2
  497. package/dist/types/index.d.cts.map +1 -0
  498. package/dist/{types.d.mts → types/index.d.mts} +2 -2
  499. package/dist/types/index.d.mts.map +1 -0
  500. package/package.json +23 -16
  501. package/dist/agents/discovery.cjs +0 -2
  502. package/dist/agents/discovery.cjs.map +0 -1
  503. package/dist/agents/discovery.mjs +0 -2
  504. package/dist/agents/discovery.mjs.map +0 -1
  505. package/dist/agents/frontmatter.cjs.map +0 -1
  506. package/dist/agents/frontmatter.mjs.map +0 -1
  507. package/dist/agents/loader.cjs +0 -2
  508. package/dist/agents/loader.cjs.map +0 -1
  509. package/dist/agents/loader.mjs +0 -2
  510. package/dist/agents/loader.mjs.map +0 -1
  511. package/dist/agents/memory.cjs +0 -3
  512. package/dist/agents/memory.cjs.map +0 -1
  513. package/dist/agents/memory.mjs.map +0 -1
  514. package/dist/agents/projectRoot.cjs +0 -2
  515. package/dist/agents/projectRoot.cjs.map +0 -1
  516. package/dist/agents/projectRoot.mjs +0 -2
  517. package/dist/agents/projectRoot.mjs.map +0 -1
  518. package/dist/agents/settings.cjs +0 -2
  519. package/dist/agents/settings.cjs.map +0 -1
  520. package/dist/agents/settings.mjs +0 -2
  521. package/dist/agents/settings.mjs.map +0 -1
  522. package/dist/agents/skills.cjs +0 -0
  523. package/dist/agents/skills.cjs.map +0 -1
  524. package/dist/agents/skills.mjs +0 -5
  525. package/dist/agents/skills.mjs.map +0 -1
  526. package/dist/agents/types.d.cts.map +0 -1
  527. package/dist/agents/types.d.mts.map +0 -1
  528. package/dist/api/capabilityCeiling.mjs.map +0 -1
  529. package/dist/api/teamSnapshot.mjs.map +0 -1
  530. package/dist/env.cjs.map +0 -1
  531. package/dist/env.d.cts.map +0 -1
  532. package/dist/env.d.mts.map +0 -1
  533. package/dist/extension.cjs +0 -2
  534. package/dist/extension.cjs.map +0 -1
  535. package/dist/extension.mjs +0 -2
  536. package/dist/extension.mjs.map +0 -1
  537. package/dist/intercom/intercomBridge.cjs.map +0 -1
  538. package/dist/intercom/intercomBridge.mjs.map +0 -1
  539. package/dist/intercom/nativeTeamChannel.cjs +0 -5
  540. package/dist/intercom/nativeTeamChannel.cjs.map +0 -1
  541. package/dist/intercom/nativeTeamChannel.d.cts.map +0 -1
  542. package/dist/intercom/nativeTeamChannel.d.mts.map +0 -1
  543. package/dist/intercom/nativeTeamChannel.mjs +0 -5
  544. package/dist/intercom/nativeTeamChannel.mjs.map +0 -1
  545. package/dist/intercom/supervisorControlChannel.cjs +0 -2
  546. package/dist/intercom/supervisorControlChannel.cjs.map +0 -1
  547. package/dist/intercom/supervisorControlChannel.mjs.map +0 -1
  548. package/dist/protocol/backgroundWork.cjs +0 -2
  549. package/dist/protocol/backgroundWork.d.cts.map +0 -1
  550. package/dist/protocol/backgroundWork.d.mts.map +0 -1
  551. package/dist/protocol/backgroundWork.mjs +0 -2
  552. package/dist/protocol/backgroundWork.mjs.map +0 -1
  553. package/dist/protocol/capabilityCeiling.cjs +0 -2
  554. package/dist/protocol/capabilityCeiling.cjs.map +0 -1
  555. package/dist/protocol/capabilityCeiling.d.cts.map +0 -1
  556. package/dist/protocol/capabilityCeiling.d.mts.map +0 -1
  557. package/dist/protocol/capabilityCeiling.mjs +0 -2
  558. package/dist/protocol/capabilityCeiling.mjs.map +0 -1
  559. package/dist/protocol/delegation.cjs.map +0 -1
  560. package/dist/protocol/delegation.d.cts.map +0 -1
  561. package/dist/protocol/delegation.d.mts.map +0 -1
  562. package/dist/protocol/delegation.mjs.map +0 -1
  563. package/dist/runs/background/asyncExecution.cjs +0 -2
  564. package/dist/runs/background/asyncExecution.cjs.map +0 -1
  565. package/dist/runs/background/asyncExecution.mjs +0 -2
  566. package/dist/runs/background/asyncExecution.mjs.map +0 -1
  567. package/dist/runs/background/asyncJobTracker.cjs +0 -2
  568. package/dist/runs/background/asyncJobTracker.cjs.map +0 -1
  569. package/dist/runs/background/asyncJobTracker.mjs +0 -2
  570. package/dist/runs/background/asyncJobTracker.mjs.map +0 -1
  571. package/dist/runs/background/cliRunnerEntry.cjs.map +0 -1
  572. package/dist/runs/background/cliRunnerEntry.mjs.map +0 -1
  573. package/dist/runs/background/completionBatcher.cjs.map +0 -1
  574. package/dist/runs/background/completionBatcher.mjs +0 -2
  575. package/dist/runs/background/completionBatcher.mjs.map +0 -1
  576. package/dist/runs/background/notify.cjs.map +0 -1
  577. package/dist/runs/background/notify.mjs.map +0 -1
  578. package/dist/runs/background/parentWatchdog.cjs.map +0 -1
  579. package/dist/runs/background/parentWatchdog.mjs.map +0 -1
  580. package/dist/runs/background/processTerminal.cjs +0 -2
  581. package/dist/runs/background/processTerminal.cjs.map +0 -1
  582. package/dist/runs/background/processTerminal.mjs +0 -2
  583. package/dist/runs/background/processTerminal.mjs.map +0 -1
  584. package/dist/runs/background/resultWatcher.cjs +0 -2
  585. package/dist/runs/background/resultWatcher.cjs.map +0 -1
  586. package/dist/runs/background/resultWatcher.mjs +0 -2
  587. package/dist/runs/background/resultWatcher.mjs.map +0 -1
  588. package/dist/runs/background/runIdResolver.cjs +0 -2
  589. package/dist/runs/background/runIdResolver.cjs.map +0 -1
  590. package/dist/runs/background/runIdResolver.mjs +0 -2
  591. package/dist/runs/background/runIdResolver.mjs.map +0 -1
  592. package/dist/runs/background/runnerBootstrap.cjs +0 -2
  593. package/dist/runs/background/runnerBootstrap.cjs.map +0 -1
  594. package/dist/runs/background/runnerBootstrap.mjs +0 -2
  595. package/dist/runs/background/runnerBootstrap.mjs.map +0 -1
  596. package/dist/runs/background/runnerExecution.cjs +0 -2
  597. package/dist/runs/background/runnerExecution.cjs.map +0 -1
  598. package/dist/runs/background/runnerExecution.mjs +0 -2
  599. package/dist/runs/background/runnerExecution.mjs.map +0 -1
  600. package/dist/runs/background/runnerReporting.cjs.map +0 -1
  601. package/dist/runs/background/runnerReporting.mjs.map +0 -1
  602. package/dist/runs/background/runnerTeamMembership.cjs +0 -2
  603. package/dist/runs/background/runnerTeamMembership.cjs.map +0 -1
  604. package/dist/runs/background/runnerTeamMembership.mjs +0 -2
  605. package/dist/runs/background/runnerTeamMembership.mjs.map +0 -1
  606. package/dist/runs/background/spawnHandshake.cjs +0 -2
  607. package/dist/runs/background/spawnHandshake.cjs.map +0 -1
  608. package/dist/runs/background/spawnHandshake.mjs +0 -2
  609. package/dist/runs/background/spawnHandshake.mjs.map +0 -1
  610. package/dist/runs/background/staleRunReconciler.cjs +0 -2
  611. package/dist/runs/background/staleRunReconciler.cjs.map +0 -1
  612. package/dist/runs/background/staleRunReconciler.mjs +0 -2
  613. package/dist/runs/background/staleRunReconciler.mjs.map +0 -1
  614. package/dist/runs/background/statusReader.cjs +0 -2
  615. package/dist/runs/background/statusReader.cjs.map +0 -1
  616. package/dist/runs/background/statusReader.mjs +0 -2
  617. package/dist/runs/background/statusReader.mjs.map +0 -1
  618. package/dist/runs/background/statusWriter.cjs +0 -2
  619. package/dist/runs/background/statusWriter.cjs.map +0 -1
  620. package/dist/runs/background/statusWriter.mjs +0 -2
  621. package/dist/runs/background/statusWriter.mjs.map +0 -1
  622. package/dist/runs/background/subagentWait.cjs +0 -2
  623. package/dist/runs/background/subagentWait.cjs.map +0 -1
  624. package/dist/runs/background/subagentWait.mjs +0 -2
  625. package/dist/runs/background/subagentWait.mjs.map +0 -1
  626. package/dist/runs/background/terminalPersistence.cjs +0 -2
  627. package/dist/runs/background/terminalPersistence.cjs.map +0 -1
  628. package/dist/runs/background/terminalPersistence.mjs.map +0 -1
  629. package/dist/runs/registry/processGroup.cjs.map +0 -1
  630. package/dist/runs/registry/processGroup.mjs.map +0 -1
  631. package/dist/runs/registry/runRegistry.cjs +0 -2
  632. package/dist/runs/registry/runRegistry.cjs.map +0 -1
  633. package/dist/runs/registry/runRegistry.mjs +0 -2
  634. package/dist/runs/registry/runRegistry.mjs.map +0 -1
  635. package/dist/runs/registry/sessionLifecycle.cjs +0 -2
  636. package/dist/runs/registry/sessionLifecycle.cjs.map +0 -1
  637. package/dist/runs/registry/sessionLifecycle.mjs +0 -2
  638. package/dist/runs/registry/sessionLifecycle.mjs.map +0 -1
  639. package/dist/runs/registry/suspendedRuns.cjs +0 -4
  640. package/dist/runs/registry/suspendedRuns.cjs.map +0 -1
  641. package/dist/runs/registry/suspendedRuns.mjs +0 -4
  642. package/dist/runs/registry/suspendedRuns.mjs.map +0 -1
  643. package/dist/runs/sdkRunnerEntry.cjs.map +0 -1
  644. package/dist/runs/sdkRunnerEntry.mjs.map +0 -1
  645. package/dist/runs/shared/claudeFableProfile.cjs +0 -4
  646. package/dist/runs/shared/claudeFableProfile.cjs.map +0 -1
  647. package/dist/runs/shared/claudeFableProfile.mjs +0 -4
  648. package/dist/runs/shared/claudeFableProfile.mjs.map +0 -1
  649. package/dist/runs/shared/depthGuard.cjs +0 -2
  650. package/dist/runs/shared/depthGuard.cjs.map +0 -1
  651. package/dist/runs/shared/depthGuard.mjs +0 -2
  652. package/dist/runs/shared/depthGuard.mjs.map +0 -1
  653. package/dist/runs/shared/mcpDirectToolAllowlist.cjs +0 -2
  654. package/dist/runs/shared/mcpDirectToolAllowlist.cjs.map +0 -1
  655. package/dist/runs/shared/mcpDirectToolAllowlist.mjs +0 -2
  656. package/dist/runs/shared/mcpDirectToolAllowlist.mjs.map +0 -1
  657. package/dist/runs/shared/modelFallback.cjs +0 -2
  658. package/dist/runs/shared/modelFallback.cjs.map +0 -1
  659. package/dist/runs/shared/modelFallback.mjs +0 -2
  660. package/dist/runs/shared/modelFallback.mjs.map +0 -1
  661. package/dist/runs/shared/modelScope.cjs +0 -2
  662. package/dist/runs/shared/modelScope.cjs.map +0 -1
  663. package/dist/runs/shared/modelScope.mjs +0 -2
  664. package/dist/runs/shared/modelScope.mjs.map +0 -1
  665. package/dist/runs/shared/nestedPath.cjs +0 -2
  666. package/dist/runs/shared/nestedPath.cjs.map +0 -1
  667. package/dist/runs/shared/nestedPath.mjs +0 -2
  668. package/dist/runs/shared/nestedPath.mjs.map +0 -1
  669. package/dist/runs/shared/piArgs.cjs +0 -2
  670. package/dist/runs/shared/piArgs.cjs.map +0 -1
  671. package/dist/runs/shared/piArgs.mjs +0 -2
  672. package/dist/runs/shared/piArgs.mjs.map +0 -1
  673. package/dist/runs/shared/piSpawn.cjs +0 -2
  674. package/dist/runs/shared/piSpawn.cjs.map +0 -1
  675. package/dist/runs/shared/piSpawn.mjs +0 -2
  676. package/dist/runs/shared/piSpawn.mjs.map +0 -1
  677. package/dist/runs/shared/runWithConcurrency.cjs +0 -2
  678. package/dist/runs/shared/runWithConcurrency.cjs.map +0 -1
  679. package/dist/runs/shared/runWithConcurrency.mjs +0 -2
  680. package/dist/runs/shared/runWithConcurrency.mjs.map +0 -1
  681. package/dist/runs/shared/runtimeRegistry.cjs +0 -2
  682. package/dist/runs/shared/runtimeRegistry.cjs.map +0 -1
  683. package/dist/runs/shared/runtimeRegistry.mjs +0 -2
  684. package/dist/runs/shared/runtimeRegistry.mjs.map +0 -1
  685. package/dist/runs/shared/structuredOutput.cjs +0 -2
  686. package/dist/runs/shared/structuredOutput.mjs +0 -2
  687. package/dist/runs/shared/toolAvailability.cjs +0 -2
  688. package/dist/runs/shared/toolAvailability.cjs.map +0 -1
  689. package/dist/runs/shared/toolAvailability.mjs +0 -2
  690. package/dist/runs/shared/toolAvailability.mjs.map +0 -1
  691. package/dist/runs/shared/toolBudget.cjs +0 -2
  692. package/dist/runs/shared/toolBudget.cjs.map +0 -1
  693. package/dist/runs/shared/toolBudget.mjs +0 -2
  694. package/dist/runs/shared/toolBudget.mjs.map +0 -1
  695. package/dist/shared/atomicJson.cjs.map +0 -1
  696. package/dist/shared/childTranscript.cjs.map +0 -1
  697. package/dist/shared/pollScheduler.cjs.map +0 -1
  698. package/dist/shared/scopeOwner.cjs.map +0 -1
  699. package/dist/slash/chainExpression.cjs.map +0 -1
  700. package/dist/slash/chainExpression.mjs.map +0 -1
  701. package/dist/slash/doctor.cjs +0 -5
  702. package/dist/slash/doctor.mjs +0 -5
  703. package/dist/slash/doctor.mjs.map +0 -1
  704. package/dist/slash/slashCommands.cjs.map +0 -1
  705. package/dist/slash/slashCommands.mjs.map +0 -1
  706. package/dist/slash/spawnRequestMapping.cjs.map +0 -1
  707. package/dist/slash/spawnRequestMapping.mjs.map +0 -1
  708. package/dist/slash/subagentLaunch.cjs +0 -2
  709. package/dist/slash/subagentLaunch.cjs.map +0 -1
  710. package/dist/slash/subagentLaunch.mjs +0 -2
  711. package/dist/slash/subagentLaunch.mjs.map +0 -1
  712. package/dist/types.d.cts.map +0 -1
  713. package/dist/types.d.mts.map +0 -1
  714. /package/dist/{slash → commands/slash}/chainExpression.cjs +0 -0
  715. /package/dist/{slash → commands/slash}/chainExpression.mjs +0 -0
  716. /package/dist/{slash → commands/slash}/spawnRequestMapping.cjs +0 -0
  717. /package/dist/{slash → commands/slash}/spawnRequestMapping.mjs +0 -0
  718. /package/dist/{protocol → schemas/team}/delegation.cjs +0 -0
  719. /package/dist/{protocol → schemas/team}/delegation.mjs +0 -0
  720. /package/dist/{agents → services/agents}/frontmatter.cjs +0 -0
  721. /package/dist/{intercom → services/intercom}/intercomBridge.cjs +0 -0
  722. /package/dist/{intercom → services/intercom}/intercomBridge.mjs +0 -0
  723. /package/dist/{runs → services/runs}/background/completionBatcher.cjs +0 -0
  724. /package/dist/{runs → services/runs}/background/parentWatchdog.cjs +0 -0
  725. /package/dist/{runs → services/runs}/background/parentWatchdog.mjs +0 -0
  726. /package/dist/{runs → services/runs}/registry/processGroup.cjs +0 -0
  727. /package/dist/{runs → services/runs}/registry/processGroup.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"spawnPlan.mjs","names":[],"sources":["../../src/extensions/spawnPlan.ts"],"sourcesContent":["/**\n * Turns `subagent` tool params into a resolved sequence of\n * `AsyncSubagentSpawner.spawn()` calls: SINGLE (one child), PARALLEL (N\n * children, bounded by `concurrency`).\n *\n * WHY THIS IS NEW LOGIC, NOT COMPOSITION:\n * `AsyncSubagentSpawner` is deliberately a per-child primitive -\n * `childIndex`/`fanout` arrive as inputs it does not derive (see that\n * module's header). Nothing else in this package decides \"how many\n * children, in what order, at what `childIndex`\" from a `subagent` tool\n * call. That decision is this file's job.\n *\n * PREFLIGHT, ALL-OR-NOTHING:\n * `resolveCurrentSubagentDepth`/`preflightSubagentDepth` run once, before\n * anything spawns. A depth refusal throws - a declared plan that cannot run\n * at all should produce one clear refusal, not a partial fan-out.\n * `AgentDiscoveryService.find` resolves and validates every child's agent\n * name up front too, for the same reason: a typo'd agent name is a\n * preflight failure named at the tool boundary, not a spawn error surfacing\n * deep inside one child while its siblings are already running.\n *\n * ONCE THE BATCH HAS STARTED, PER-CHILD FAILURE IS A RESULT, NOT AN\n * EXCEPTION:\n * `runWithConcurrency` never lets one child's rejection abort its siblings,\n * matching `failFast` being opt-in in the schema, not the default. Every\n * child gets an outcome - `{runId, pid}` on success, `{error}` on failure -\n * and the caller (`subagentTool.ts`) decides how to report a mixed batch.\n *\n * WHAT THIS DOES NOT WIRE YET, AND WHY - FLAGGED, NOT SILENTLY GUESSED:\n * - `maxSubagentSpawnsPerSession` (`spawn-budget.ts`) is NOT enforced here.\n * `preflightSpawnBudget` needs a durable, session-scoped `SpawnBudgetStore`\n * that accumulates spend ACROSS separate tool calls in the same session;\n * inventing a fresh store per call would never track real spend and would\n * be worse than not checking at all (false confidence). Wiring this needs\n * a real session-scoped store (`GlobalStateBridge`'s `protocolSlot`\n * pattern, used by `capabilityCeiling.ts`, is the likely shape) - a\n * follow-up, not guessed here.\n * - Fork context is resolved here and requires a captured persisted Pi source;\n * unavailable or non-Pi fork requests fail closed rather than becoming fresh\n * launches.\n * - Per-task overrides with no direct `BuildPiArgsInput` field confirmed yet\n * (`skill`, `toolBudget`, `turnBudget`, `outputSchema`/structured output,\n * `acceptance`, `output`/`outputMode`) are not mapped into `piArgs` for\n * v1. Each child still gets its resolved `AgentConfig`'s own defaults\n * (`systemPromptMode`, `inheritProjectContext`, `inheritSkills`,\n * `systemPrompt`) - not nothing, just not every param override yet.\n *\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport type { InlineAgent } from '@agimon-ai/doompi-extension-contracts/subagent-tool';\nimport { SessionManager } from '@earendil-works/pi-coding-agent';\nimport { inject, injectable } from 'inversify';\nimport { DOOM_TEAM_TYPES } from '../container/types.ts';\nimport { resolveActiveLayerSubagentConfig } from '../agents/discovery.ts';\nimport { buildSkillInjection, SkillDiscoveryService, type ISkillDiscoveryService } from '../agents/skills.ts';\nimport type { AgentConfig, IAgentDiscoveryService, AgentScope } from '../agents/types.ts';\nimport type {\n AsyncSubagentSpawnInput,\n AsyncSubagentSpawnResult,\n IAsyncSubagentSpawner,\n} from '../runs/background/asyncExecution.ts';\nimport { preflightSubagentDepth, resolveCurrentSubagentDepth } from '../runs/shared/depthGuard.ts';\nimport {\n SubagentCapabilityPolicyStore,\n type ResolvedSubagentCapabilityCeiling,\n} from '../protocol/capabilityCeiling.ts';\nimport { runWithConcurrency } from '../runs/shared/runWithConcurrency.ts';\nimport {\n isPiRuntime,\n resolveRuntimeLaunch,\n resolveRuntimeTable,\n type RuntimeTable,\n} from '../runs/shared/runtimeRegistry.ts';\nimport { PI_RUNTIME_NAME } from '../env.ts';\nimport { selectAvailableModel, type AvailableModelInfo, type ParentModel } from '../runs/shared/modelFallback.ts';\nimport type { ExtensionConfig } from './config.ts';\nimport { DoomTeamExpectedError } from '../shared/errors.ts';\n\nconst CONTEXT_FRESH = 'fresh' as const;\nconst PI_RUNTIME_REQUIREMENT = `runtime \"${PI_RUNTIME_NAME}\"`;\n\ntype SessionForkCaptureMode = 'tool' | 'settled';\n\nexport interface SessionForkSource {\n sessionFile: string;\n leafId: string;\n}\n\nexport type SessionForkSourceManager = Pick<SessionManager, 'getSessionFile' | 'getLeafId' | 'getLeafEntry'>;\n\nfunction readableSessionFile(sessionFile: string | undefined): sessionFile is string {\n if (!sessionFile?.trim()) return false;\n try {\n fs.accessSync(sessionFile, fs.constants.R_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/** Capture the parent branch while excluding an assistant turn whose tool is still executing. */\nexport function captureSessionForkSource(\n manager: SessionForkSourceManager,\n mode: SessionForkCaptureMode,\n): SessionForkSource | undefined {\n const sessionFile = manager.getSessionFile();\n if (!readableSessionFile(sessionFile)) return undefined;\n\n const leaf = manager.getLeafEntry();\n const leafId =\n mode === 'tool' && leaf?.type === 'message' && leaf.message.role === 'assistant'\n ? leaf.parentId\n : (leaf?.id ?? manager.getLeafId());\n return leafId ? { sessionFile, leafId } : undefined;\n}\n\nfunction isSessionForkSourceAvailable(source: SessionForkSource): boolean {\n return Boolean(source.leafId.trim()) && readableSessionFile(source.sessionFile);\n}\n\nexport interface SpawnPlanTaskInput {\n agent: string;\n inlineAgent?: InlineAgent;\n task?: string;\n cwd?: string;\n model?: string;\n runtime?: string;\n context?: typeof CONTEXT_FRESH | 'fork';\n /**\n * An existing child transcript to continue instead of starting fresh.\n *\n * Set only by a restore. `sdkRunnerEntry.ts` opens it through\n * `SessionManager.open`, which is what makes a restored run pick up where it\n * was suspended rather than redo the task.\n */\n sessionFile?: string;\n}\n\ntype ExecutableAgentConfig = Pick<\n AgentConfig,\n | 'name'\n | 'defaultContext'\n | 'extensions'\n | 'fallbackModels'\n | 'inheritProjectContext'\n | 'inheritSkills'\n | 'mcpDirectTools'\n | 'model'\n | 'runtime'\n | 'skills'\n | 'skillPath'\n | 'subagentOnlyExtensions'\n | 'systemPrompt'\n | 'systemPromptMode'\n | 'thinking'\n | 'tools'\n>;\n\nfunction resolveEffectiveContext(\n taskInput: SpawnPlanTaskInput,\n agent: Pick<ExecutableAgentConfig, 'defaultContext'>,\n): typeof CONTEXT_FRESH | 'fork' {\n return taskInput.sessionFile ? CONTEXT_FRESH : (taskInput.context ?? agent.defaultContext ?? CONTEXT_FRESH);\n}\n\nexport interface SpawnPlanRequest {\n /** SINGLE mode: exactly one child. Mutually exclusive with `tasks`. */\n single?: SpawnPlanTaskInput;\n /** PARALLEL mode: N children, fanned out. Mutually exclusive with `single`. */\n tasks?: SpawnPlanTaskInput[];\n /** Max children in flight at once for PARALLEL mode. Ignored for SINGLE. Defaults to `config.parallel.concurrency` or 4. */\n concurrency?: number;\n /** Fallback cwd for any task that omits its own. */\n cwd: string;\n agentScope: AgentScope;\n /** Legacy session identity retained for delegation correlation. */\n parentSessionId?: string;\n /** Persisted parent transcript used for true Pi forks. */\n parentSessionFile?: string;\n /** Settled parent leaf used for true Pi forks. */\n parentLeafId?: string;\n artifacts?: boolean;\n /** Authenticated models reported by the live parent host. Undefined for callers without a host context. */\n availableModels?: AvailableModelInfo[];\n /** The live parent model, forwarded only for Pi child selection. */\n parentModel?: ParentModel;\n /** Overrides `resolveCurrentSubagentDepth()`'s own env read - a test seam, not a runtime path. */\n currentDepth?: number;\n /** Which runtime executes every child of this request. Defaults per agent, then to `pi`. */\n runtime?: string;\n /** Stable Pi tool-call identity used to correlate this batch. */\n operationId?: string;\n /** Run ids persisted by the operation journal before any process starts. */\n preallocatedRunIds?: string[];\n}\n\n/** Everything one child spawn needs. An object because this reached ten positional parameters. */\ninterface SpawnOneChildInput {\n runId: string;\n operationId?: string;\n agentConfig: ExecutableAgentConfig;\n excludeTools?: string[];\n capabilityCeiling?: ResolvedSubagentCapabilityCeiling;\n taskInput: SpawnPlanTaskInput;\n childIndex: number;\n fanout: boolean;\n fallbackCwd: string;\n parentSessionId: string | undefined;\n parentSessionFile: string | undefined;\n preparedSessionFile: string | undefined;\n handshakeTimeoutMs: number | undefined;\n artifacts: boolean | undefined;\n artifactDir: ExtensionConfig['artifactDir'];\n availableModels: AvailableModelInfo[] | undefined;\n parentModel: ParentModel | undefined;\n runtime: string | undefined;\n runtimes: RuntimeTable;\n}\n\nexport interface SpawnPlanChildOutcome {\n agent: string;\n task: string;\n /** This spawn's position among its siblings. Always 0 for SINGLE mode. */\n childIndex: number;\n runId?: string;\n pid?: number;\n error?: string;\n warning?: string;\n}\n\nexport interface SpawnPlanResult {\n outcomes: SpawnPlanChildOutcome[];\n}\n\nconst DEFAULT_PARALLEL_CONCURRENCY = 4;\n/**\n * Hard ceiling on how many children one PARALLEL call may launch.\n *\n * `concurrency` does NOT bound this, and cannot: `spawnOneChild` resolves as\n * soon as its child confirms it started, and the child then runs detached. So\n * `runWithConcurrency` throttles how fast children are STARTED, not how many\n * are running - `{tasks: [8], concurrency: 4}` ends up with eight live model\n * processes, not four. Until a launch queue exists that drains as runs go\n * terminal, a width cap is the only thing standing between a fan-out and the\n * machine. 8 matches the sibling implementation's `PI_TEAM_MATE_MAX_PARALLEL`.\n */\nconst DEFAULT_PARALLEL_MAX_TASKS = 8;\nconst INLINE_AGENT_TOOLS = ['read', 'grep', 'find', 'ls'] as const;\n\nfunction appendPromptSection(prompt: string, section: string): string {\n if (!section) return prompt;\n return prompt ? `${prompt}\\n\\n${section}` : section;\n}\n\nfunction bestEffortRuntimeWarnings(\n runtime: string,\n agentConfig: ExecutableAgentConfig,\n excludeTools: string[] | undefined,\n): string[] {\n if (isPiRuntime(runtime)) return [];\n\n const warnings = [`Runtime '${runtime}' does not load Pi child extensions or hooks; launched best effort.`];\n const unsupportedResources = [\n ...(agentConfig.tools !== undefined || agentConfig.mcpDirectTools?.length ? ['tools'] : []),\n ...(agentConfig.skills?.length || agentConfig.skillPath?.length ? ['skills'] : []),\n ...(agentConfig.extensions !== undefined || agentConfig.subagentOnlyExtensions?.length ? ['extensions'] : []),\n ];\n if (unsupportedResources.length > 0) {\n warnings.push(\n `Doom Team cannot project or enforce configured Pi ${unsupportedResources.join(', ')} on runtime '${runtime}'.`,\n );\n }\n if (agentConfig.skills?.length) {\n warnings.push(`Configured skills were not injected: ${agentConfig.skills.join(', ')}.`);\n }\n if (excludeTools?.length) {\n warnings.push(\n `Runtime '${runtime}' cannot enforce layer subagent tool exclusions; launched best effort for: ${excludeTools.join(', ')}.`,\n );\n }\n return warnings;\n}\n\ninterface ChildSkillProjection {\n systemPrompt: string;\n requireReadTool: boolean;\n warnings: string[];\n}\n\ninterface ResolvedModelSelection {\n primaryModel: string | undefined;\n fallbackModels: string[];\n model: string | undefined;\n}\n\nfunction resolvedModelSelection(\n taskInput: SpawnPlanTaskInput,\n agentConfig: Pick<ExecutableAgentConfig, 'model' | 'fallbackModels'>,\n runtime: string,\n parentModel: ParentModel | undefined,\n availableModels: AvailableModelInfo[] | undefined,\n): ResolvedModelSelection {\n const parentModelId =\n isPiRuntime(runtime) && parentModel && availableModels !== undefined\n ? `${parentModel.provider}/${parentModel.id}`\n : undefined;\n const ordered = isPiRuntime(runtime)\n ? [taskInput.model, parentModelId, agentConfig.model, ...(agentConfig.fallbackModels ?? [])]\n : [taskInput.model ?? agentConfig.model, ...(agentConfig.fallbackModels ?? [])];\n const candidates = ordered.filter((candidate): candidate is string => Boolean(candidate?.trim()));\n const [primaryModel, ...fallbackModels] = candidates;\n return {\n primaryModel,\n fallbackModels,\n model: selectAvailableModel(primaryModel, fallbackModels, availableModels),\n };\n}\n\nexport interface ISpawnPlanner {\n /**\n * Resolves the plan and spawns every child. Throws on any PREFLIGHT\n * failure (bad request shape, depth exceeded, unknown agent) before\n * anything spawns. Never throws for an individual child's spawn failure\n * once the batch has started - that is a `{error}` outcome instead.\n */\n spawn(request: SpawnPlanRequest, config: ExtensionConfig): Promise<SpawnPlanResult>;\n}\n\nconst ERROR_CODE_AGENT_NOT_FOUND = 'agent_not_found' as const;\nconst ERROR_CODE_INVALID_REQUEST = 'invalid_request' as const;\nconst ERROR_CODE_MODEL_UNAVAILABLE = 'model_unavailable' as const;\nconst ERROR_CODE_OPERATION_CONFLICT = 'operation_conflict' as const;\nconst ERROR_CODE_RUNTIME_UNAVAILABLE = 'runtime_unavailable' as const;\nconst ERROR_CODE_UNSUPPORTED_CONTEXT = 'unsupported_context' as const;\nconst ERROR_CODE_UNSUPPORTED_OPERATION = 'unsupported_operation' as const;\n\n@injectable()\nexport class SpawnPlanner implements ISpawnPlanner {\n constructor(\n @inject(DOOM_TEAM_TYPES.AgentDiscoveryService) private readonly agents: IAgentDiscoveryService,\n @inject(DOOM_TEAM_TYPES.AsyncSubagentSpawner) private readonly spawner: IAsyncSubagentSpawner,\n @inject(DOOM_TEAM_TYPES.SubagentCapabilityPolicyStore)\n private readonly policies: SubagentCapabilityPolicyStore = new SubagentCapabilityPolicyStore(),\n @inject(DOOM_TEAM_TYPES.SkillDiscoveryService)\n private readonly skills: ISkillDiscoveryService = new SkillDiscoveryService(),\n ) {}\n\n protected generateRunId(): string {\n return crypto.randomUUID();\n }\n\n protected createForkSessionFile(source: SessionForkSource, cwd: string): string {\n const sessionManager = SessionManager.open(source.sessionFile, undefined, cwd);\n const sessionFile = sessionManager.createBranchedSession(source.leafId);\n if (!sessionFile) throw new Error(`Could not create a branched Pi session from '${source.sessionFile}'.`);\n\n // Pi defers writing user-only branches until an assistant response. A tool-safe\n // fork usually ends at the user message immediately before the active tool call,\n // so materialize that valid child transcript before the runner opens it.\n if (!fs.existsSync(sessionFile)) {\n const header = sessionManager.getHeader();\n if (!header) throw new Error(`Forked Pi session '${sessionFile}' has no header.`);\n const records = [header, ...sessionManager.getEntries()];\n fs.writeFileSync(sessionFile, `${records.map((record) => JSON.stringify(record)).join('\\n')}\\n`, { flag: 'wx' });\n }\n return sessionFile;\n }\n\n protected removePreparedSessionFile(sessionFile: string): void {\n fs.rmSync(sessionFile, { force: true });\n }\n\n protected validateCwd(cwd: string): void {\n let stat: fs.Stats;\n try {\n stat = fs.statSync(cwd);\n } catch {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n `Working directory '${cwd}' does not exist.`,\n false,\n 'Retry with an existing directory.',\n );\n }\n if (!stat.isDirectory()) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n `Working directory '${cwd}' is not a directory.`,\n false,\n 'Retry with an existing directory.',\n );\n }\n }\n\n protected resolveLayerExcludeTools(): string[] | undefined {\n return resolveActiveLayerSubagentConfig()?.config.excludeTools;\n }\n\n protected executableAvailable(command: string): boolean {\n if (path.isAbsolute(command) || command.includes(path.sep)) {\n try {\n fs.accessSync(command, fs.constants.X_OK);\n return true;\n } catch {\n return false;\n }\n }\n return (process.env.PATH ?? '')\n .split(path.delimiter)\n .filter(Boolean)\n .some((directory) => {\n try {\n fs.accessSync(path.join(directory, command), fs.constants.X_OK);\n return true;\n } catch {\n return false;\n }\n });\n }\n\n private resolveTaskList(request: SpawnPlanRequest): SpawnPlanTaskInput[] {\n const hasSingle = request.single !== undefined;\n const hasTasks = request.tasks !== undefined;\n if (hasSingle === hasTasks) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n 'A run requires exactly one of internal single or tasks representations.',\n false,\n 'Submit a non-empty requests array.',\n );\n }\n if (hasSingle) return [request.single!];\n if (!request.tasks || request.tasks.length === 0) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n 'A run requires at least one entry in its requests collection.',\n false,\n 'Submit a non-empty requests array.',\n );\n }\n return request.tasks;\n }\n\n private resolveAgentOrThrow(name: string, cwd: string, scope: AgentScope) {\n const resolved = this.agents.find(cwd, scope, name);\n if (!resolved) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_AGENT_NOT_FOUND,\n `Unknown agent '${name}'.`,\n false,\n 'Call subagent({\"action\":\"agents\"}) and retry with an exact name.',\n );\n }\n return resolved;\n }\n\n private resolveExecutableAgent(taskInput: SpawnPlanTaskInput, cwd: string, scope: AgentScope): ExecutableAgentConfig {\n if (!taskInput.inlineAgent) return this.resolveAgentOrThrow(taskInput.agent, cwd, scope);\n return {\n name: taskInput.agent.trim(),\n systemPromptMode: 'append',\n inheritProjectContext: true,\n inheritSkills: false,\n systemPrompt: taskInput.inlineAgent.systemPrompt.trim(),\n tools: [...INLINE_AGENT_TOOLS],\n defaultContext: CONTEXT_FRESH,\n runtime: PI_RUNTIME_NAME,\n };\n }\n\n private projectConfiguredSkills(\n agentConfig: ExecutableAgentConfig,\n childCwd: string,\n requestCwd: string,\n runtime: string,\n ): ChildSkillProjection {\n if (!isPiRuntime(runtime) || !agentConfig.skills?.length) {\n return { systemPrompt: agentConfig.systemPrompt, requireReadTool: false, warnings: [] };\n }\n\n const resolution = this.skills.resolveSkillsWithFallback(\n agentConfig.skills,\n childCwd,\n requestCwd,\n agentConfig.skillPath,\n requestCwd,\n );\n const injection = buildSkillInjection(resolution.resolved);\n return {\n systemPrompt: appendPromptSection(agentConfig.systemPrompt, injection),\n requireReadTool: injection.length > 0,\n warnings:\n resolution.missing.length > 0\n ? [\n `Agent '${agentConfig.name}' could not resolve configured skills: ${resolution.missing.join(', ')}; launched with resolved skills only.`,\n ]\n : [],\n };\n }\n\n /**\n * Spawns exactly one child and returns its outcome. Shared by `spawn()`\n * (SINGLE/PARALLEL) and `spawnChain()`'s per-step/per-parallel-group-child\n * calls, so the `AsyncSubagentSpawnInput` mapping exists in exactly one\n * place. Never throws - a spawn failure becomes an `{error}` outcome, per\n * the \"preflight throws, per-child failure does not\" split documented in\n * the module header.\n */\n private async spawnOneChild(input: SpawnOneChildInput): Promise<SpawnPlanChildOutcome> {\n const {\n runId,\n operationId,\n agentConfig,\n capabilityCeiling,\n excludeTools,\n taskInput,\n childIndex,\n fanout,\n fallbackCwd,\n parentSessionId,\n parentSessionFile,\n preparedSessionFile,\n handshakeTimeoutMs,\n artifacts,\n artifactDir,\n availableModels,\n parentModel,\n runtime,\n runtimes,\n } = input;\n const cwd = taskInput.cwd ?? fallbackCwd;\n const task = taskInput.task ?? '';\n const effectiveContext = resolveEffectiveContext(taskInput, agentConfig);\n const effectiveRuntime = taskInput.runtime ?? runtime ?? agentConfig.runtime ?? PI_RUNTIME_NAME;\n const modelSelection = resolvedModelSelection(\n taskInput,\n agentConfig,\n effectiveRuntime,\n parentModel,\n availableModels,\n );\n if (modelSelection.primaryModel && availableModels !== undefined && !modelSelection.model) {\n return {\n agent: agentConfig.name,\n task,\n childIndex,\n error: `No authenticated model is available for '${agentConfig.name}'. Checked: ${[\n modelSelection.primaryModel,\n ...modelSelection.fallbackModels,\n ].join(', ')}.`,\n };\n }\n\n let skillProjection: ChildSkillProjection;\n try {\n skillProjection = this.projectConfiguredSkills(agentConfig, cwd, fallbackCwd, effectiveRuntime);\n } catch (error) {\n return {\n agent: agentConfig.name,\n task,\n childIndex,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n const warnings = [\n ...skillProjection.warnings,\n ...bestEffortRuntimeWarnings(effectiveRuntime, agentConfig, excludeTools),\n ];\n const warning = warnings.length > 0 ? warnings.join(' ') : undefined;\n\n // Persist every Pi child's own transcript so a later explicit restore can\n // continue it. External runtimes retain their existing session behavior.\n const spawnInput: AsyncSubagentSpawnInput = {\n runId,\n ...(operationId ? { operationId } : {}),\n agent: agentConfig.name,\n ...(taskInput.inlineAgent ? { inlineAgent: taskInput.inlineAgent } : {}),\n task,\n cwd,\n childIndex,\n fanout,\n ...(parentSessionFile ? { parentSessionFile } : {}),\n piArgs: {\n baseArgs: [],\n sessionEnabled: isPiRuntime(effectiveRuntime),\n ...(taskInput.sessionFile\n ? { sessionFile: taskInput.sessionFile }\n : preparedSessionFile\n ? { sessionFile: preparedSessionFile }\n : {}),\n inheritProjectContext: agentConfig.inheritProjectContext,\n inheritSkills: agentConfig.inheritSkills,\n systemPromptMode: agentConfig.systemPromptMode,\n systemPrompt: skillProjection.systemPrompt,\n requireReadTool: skillProjection.requireReadTool,\n model: modelSelection.model,\n thinking: agentConfig.thinking,\n tools: agentConfig.tools,\n extensions: agentConfig.extensions,\n subagentOnlyExtensions: agentConfig.subagentOnlyExtensions,\n mcpDirectTools: agentConfig.mcpDirectTools,\n excludeTools,\n capabilityCeiling,\n cwd,\n ...(effectiveContext === 'fork' && parentSessionId ? { parentSessionId } : {}),\n },\n ...(handshakeTimeoutMs !== undefined ? { handshakeTimeoutMs } : {}),\n ...(artifacts !== undefined ? { artifacts } : {}),\n ...(artifactDir !== undefined ? { artifactDir } : {}),\n // Per-call `runtime` wins over the agent's own default, matching how\n // `model` and `context` already resolve.\n runtime: effectiveRuntime,\n runtimes,\n };\n\n try {\n const result: AsyncSubagentSpawnResult = await this.spawner.spawn(spawnInput);\n return {\n agent: agentConfig.name,\n task,\n childIndex,\n runId: result.runId,\n pid: result.pid,\n ...(warning ? { warning } : {}),\n };\n } catch (error) {\n return {\n agent: agentConfig.name,\n task,\n childIndex,\n error: error instanceof Error ? error.message : String(error),\n ...(warning ? { warning } : {}),\n };\n }\n }\n\n async spawn(request: SpawnPlanRequest, config: ExtensionConfig): Promise<SpawnPlanResult> {\n const tasks = this.resolveTaskList(request);\n const fanout = tasks.length > 1;\n const layerExcludeTools = this.resolveLayerExcludeTools();\n const capabilityCeiling = this.policies.resolve();\n\n // PREFLIGHT - all before any spawn call, so a declared plan that cannot\n // run at all produces one refusal, not a partial fan-out.\n const currentDepth = request.currentDepth ?? resolveCurrentSubagentDepth();\n const depthCheck = preflightSubagentDepth(currentDepth, config);\n if (depthCheck.error) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_OPERATION,\n depthCheck.error,\n false,\n 'Give each child a self-contained task within the selected layer policy.',\n );\n }\n\n const maxTasks = config.parallel?.maxTasks ?? DEFAULT_PARALLEL_MAX_TASKS;\n if (tasks.length > maxTasks) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n `Run requested ${tasks.length} tasks, but at most ${maxTasks} may run at once. Concurrency throttles how fast they start, not how many run.`,\n false,\n 'Split the requests into smaller explicit run calls.',\n );\n }\n\n for (const taskInput of tasks) {\n if (!taskInput.task?.trim()) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n `Run request for '${taskInput.agent}' requires a nonblank task.`,\n false,\n 'Provide a self-contained nonblank task.',\n );\n }\n if (taskInput.inlineAgent && !taskInput.inlineAgent.systemPrompt.trim()) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n `Inline agent '${taskInput.agent}' requires a nonblank system prompt.`,\n false,\n 'Provide a focused read-only exploration role.',\n );\n }\n }\n\n const resolvedAgents = tasks.map((taskInput) =>\n this.resolveExecutableAgent(taskInput, taskInput.cwd ?? request.cwd, request.agentScope),\n );\n for (const [index, taskInput] of tasks.entries()) {\n const effectiveContext = resolveEffectiveContext(taskInput, resolvedAgents[index]!);\n const runtime = taskInput.runtime ?? request.runtime ?? resolvedAgents[index]!.runtime ?? PI_RUNTIME_NAME;\n if (effectiveContext === 'fork') {\n if (!isPiRuntime(runtime)) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_CONTEXT,\n `Fork context requires ${PI_RUNTIME_REQUIREMENT} for '${taskInput.agent}'.`,\n false,\n 'Use a Pi agent for fork context or explicitly request a fresh run.',\n );\n }\n const source =\n request.parentSessionFile && request.parentLeafId\n ? { sessionFile: request.parentSessionFile, leafId: request.parentLeafId }\n : undefined;\n if (!source || !isSessionForkSourceAvailable(source)) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_CONTEXT,\n `Fork context is unavailable for '${taskInput.agent}': the parent Pi session has no readable source.`,\n false,\n 'Use an active persisted Pi session or explicitly request a fresh run.',\n );\n }\n }\n }\n\n if (request.preallocatedRunIds && request.preallocatedRunIds.length !== tasks.length) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_OPERATION_CONFLICT,\n 'The operation journal run-id count does not match the request count.',\n false,\n 'Submit the run as a new tool call.',\n );\n }\n const runIds = request.preallocatedRunIds ?? tasks.map(() => this.generateRunId());\n const runtimes = resolveRuntimeTable(config.runtimes);\n for (const [index, taskInput] of tasks.entries()) {\n const agent = resolvedAgents[index]!;\n const cwd = taskInput.cwd ?? request.cwd;\n this.validateCwd(cwd);\n const runtime = taskInput.runtime ?? request.runtime ?? agent.runtime ?? PI_RUNTIME_NAME;\n const modelSelection = resolvedModelSelection(\n taskInput,\n agent,\n runtime,\n request.parentModel,\n request.availableModels,\n );\n if (modelSelection.primaryModel && request.availableModels !== undefined && !modelSelection.model) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_MODEL_UNAVAILABLE,\n `No authenticated model is available for '${agent.name}'.`,\n false,\n 'Authenticate the requested model or choose an available model.',\n );\n }\n if (taskInput.inlineAgent && !isPiRuntime(runtime)) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_OPERATION,\n `Inline agent '${taskInput.agent}' requires ${PI_RUNTIME_REQUIREMENT} to enforce its read-only tools.`,\n false,\n 'Remove the runtime override or use a discovered external-runtime agent without inlineAgent.',\n );\n }\n if (capabilityCeiling && !isPiRuntime(runtime)) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_OPERATION,\n `Runtime '${runtime}' cannot enforce the active capability ceiling.`,\n false,\n `Use ${PI_RUNTIME_REQUIREMENT} while plan mode or another capability ceiling is active.`,\n );\n }\n if (!isPiRuntime(runtime)) {\n let command: string;\n try {\n command = resolveRuntimeLaunch(runtime, runtimes, { prompt: taskInput.task ?? '', cwd }).command;\n } catch (error) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_RUNTIME_UNAVAILABLE,\n error instanceof Error ? error.message : String(error),\n false,\n `Configure a valid external runtime or use ${PI_RUNTIME_REQUIREMENT}.`,\n );\n }\n if (!this.executableAvailable(command)) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_RUNTIME_UNAVAILABLE,\n `Executable '${command}' for runtime '${runtime}' is unavailable.`,\n false,\n `Install the executable, configure its absolute path, or use ${PI_RUNTIME_REQUIREMENT}.`,\n );\n }\n }\n }\n const forkSource =\n request.parentSessionFile && request.parentLeafId\n ? { sessionFile: request.parentSessionFile, leafId: request.parentLeafId }\n : undefined;\n const preparedSessionFiles: Array<string | undefined> = [];\n try {\n for (const [index, taskInput] of tasks.entries()) {\n preparedSessionFiles.push(\n resolveEffectiveContext(taskInput, resolvedAgents[index]!) === 'fork'\n ? this.createForkSessionFile(forkSource!, taskInput.cwd ?? request.cwd)\n : undefined,\n );\n }\n } catch (error) {\n for (const sessionFile of preparedSessionFiles) {\n if (sessionFile) this.removePreparedSessionFile(sessionFile);\n }\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_CONTEXT,\n error instanceof Error ? error.message : String(error),\n false,\n 'Retry from an active persisted Pi session or explicitly request a fresh run.',\n );\n }\n\n const concurrency = fanout\n ? (request.concurrency ?? config.parallel?.concurrency ?? DEFAULT_PARALLEL_CONCURRENCY)\n : 1;\n\n const factories = tasks.map(\n (taskInput, childIndex) => () =>\n this.spawnOneChild({\n runId: runIds[childIndex]!,\n operationId: request.operationId,\n agentConfig: resolvedAgents[childIndex]!,\n excludeTools: layerExcludeTools,\n capabilityCeiling,\n taskInput,\n childIndex,\n fanout,\n fallbackCwd: request.cwd,\n parentSessionId: request.parentSessionId,\n parentSessionFile: request.parentSessionFile,\n preparedSessionFile: preparedSessionFiles[childIndex],\n handshakeTimeoutMs: config.handshakeTimeoutMs,\n artifacts: request.artifacts,\n artifactDir: config.artifactDir,\n availableModels: request.availableModels,\n parentModel: request.parentModel,\n runtime: request.runtime,\n runtimes,\n }),\n );\n\n const settled = await runWithConcurrency(factories, concurrency);\n // `spawnOneChild` never rejects (it catches its own spawn failure into\n // an `{error}` outcome), so `runWithConcurrency` never sees a rejection\n // here - this unwrap is defensive, not a real branch.\n const outcomes = settled.map((outcome, index) =>\n outcome.status === 'fulfilled'\n ? outcome.value\n : {\n agent: resolvedAgents[index]!.name,\n task: tasks[index]!.task ?? '',\n childIndex: index,\n error: outcome.reason instanceof Error ? outcome.reason.message : String(outcome.reason),\n },\n );\n\n return { outcomes };\n }\n}\n"],"mappings":"+hDA4FA,SAAS,EAAoB,EAAwD,CACnF,GAAI,CAAC,GAAa,MAAM,CAAE,MAAO,GACjC,GAAI,CAEF,OADA,EAAG,WAAW,EAAa,EAAG,UAAU,KAAK,CACtC,QACD,CACN,MAAO,IAKX,SAAgB,EACd,EACA,EAC+B,CAC/B,IAAM,EAAc,EAAQ,gBAAgB,CAC5C,GAAI,CAAC,EAAoB,EAAY,CAAE,OAEvC,IAAM,EAAO,EAAQ,cAAc,CAC7B,EACJ,IAAS,QAAU,GAAM,OAAS,WAAa,EAAK,QAAQ,OAAS,YACjE,EAAK,SACJ,GAAM,IAAM,EAAQ,WAAW,CACtC,OAAO,EAAS,CAAE,cAAa,SAAQ,CAAG,IAAA,GAG5C,SAAS,GAA6B,EAAoC,CACxE,MAAO,EAAQ,EAAO,OAAO,MAAM,EAAK,EAAoB,EAAO,YAAY,CAyCjF,SAAS,EACP,EACA,EAC+B,CAC/B,OAAO,EAAU,YAAc,EAAiB,EAAU,SAAW,EAAM,gBAAkB,EAuF/F,SAAS,GAAoB,EAAgB,EAAyB,CAEpE,OADK,EACE,EAAS,GAAG,EAAO,MAAM,IAAY,EADvB,EAIvB,SAAS,GACP,EACA,EACA,EACU,CACV,GAAI,EAAY,EAAQ,CAAE,MAAO,EAAE,CAEnC,IAAM,EAAW,CAAC,YAAY,EAAQ,qEAAqE,CACrG,EAAuB,CAC3B,GAAI,EAAY,QAAU,IAAA,IAAa,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,IAAI,CACrE,IAAA,GACL,OAEI,EAAO,CACd,IAAK,IAAM,KAAe,EACpB,GAAa,KAAK,0BAA0B,EAAY,CAE9D,MAAM,IAAI,EACR,EACA,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CACtD,GACA,+EACD,CAGH,IAAM,EAAc,EACf,EAAQ,aAAe,EAAO,UAAU,aAAe,EACxD,EA0CJ,MAAO,CAAE,UAXQ,MAJK,EAzBJ,EAAM,KACrB,EAAW,QACV,KAAK,cAAc,CACjB,MAAO,EAAO,GACd,YAAa,EAAQ,YACrB,YAAa,EAAe,GAC5B,aAAc,EACd,oBACA,YACA,aACA,SACA,YAAa,EAAQ,IACrB,gBAAiB,EAAQ,gBACzB,kBAAmB,EAAQ,kBAC3B,oBAAqB,EAAqB,GAC1C,mBAAoB,EAAO,mBAC3B,UAAW,EAAQ,UACnB,YAAa,EAAO,YACpB,gBAAiB,EAAQ,gBACzB,YAAa,EAAQ,YACrB,QAAS,EAAQ,QACjB,WACD,CAAC,CAG4C,CAAE,EAAY,EAIvC,KAAK,EAAS,IACrC,EAAQ,SAAW,YACf,EAAQ,MACR,CACE,MAAO,EAAe,GAAQ,KAC9B,KAAM,EAAM,GAAQ,MAAQ,GAC5B,WAAY,EACZ,MAAO,EAAQ,kBAAkB,MAAQ,EAAQ,OAAO,QAAU,OAAO,EAAQ,OAAO,CACzF,CAGU,CAAE,QAngBtB,GAAY,KAGR,EAAO,EAAgB,sBAAsB,CAAA,KAC7C,EAAO,EAAgB,qBAAqB,CAAA,KAC5C,EAAO,EAAgB,8BAA8B,CAAA,KAErD,EAAO,EAAgB,sBAAsB,CAAA"}
1
+ {"version":3,"file":"spawnPlan.mjs","names":[],"sources":["../../src/extensions/spawnPlan.ts"],"sourcesContent":["/**\n * Turns `subagent` tool params into a resolved sequence of\n * `AsyncSubagentSpawner.spawn()` calls: SINGLE (one child), PARALLEL (N\n * children, bounded by `concurrency`).\n *\n * WHY THIS IS NEW LOGIC, NOT COMPOSITION:\n * `AsyncSubagentSpawner` is deliberately a per-child primitive -\n * `childIndex`/`fanout` arrive as inputs it does not derive (see that\n * module's header). Nothing else in this package decides \"how many\n * children, in what order, at what `childIndex`\" from a `subagent` tool\n * call. That decision is this file's job.\n *\n * PREFLIGHT, ALL-OR-NOTHING:\n * `resolveCurrentSubagentDepth`/`preflightSubagentDepth` run once, before\n * anything spawns. A depth refusal throws - a declared plan that cannot run\n * at all should produce one clear refusal, not a partial fan-out.\n * `AgentDiscoveryService.find` resolves and validates every child's agent\n * name up front too, for the same reason: a typo'd agent name is a\n * preflight failure named at the tool boundary, not a spawn error surfacing\n * deep inside one child while its siblings are already running.\n *\n * ONCE THE BATCH HAS STARTED, PER-CHILD FAILURE IS A RESULT, NOT AN\n * EXCEPTION:\n * `runWithConcurrency` never lets one child's rejection abort its siblings,\n * matching `failFast` being opt-in in the schema, not the default. Every\n * child gets an outcome - `{runId, pid}` on success, `{error}` on failure -\n * and the caller (`subagentTool.ts`) decides how to report a mixed batch.\n *\n * WHAT THIS DOES NOT WIRE YET, AND WHY - FLAGGED, NOT SILENTLY GUESSED:\n * - `maxSubagentSpawnsPerSession` (`spawn-budget.ts`) is NOT enforced here.\n * `preflightSpawnBudget` needs a durable, session-scoped `SpawnBudgetStore`\n * that accumulates spend ACROSS separate tool calls in the same session;\n * inventing a fresh store per call would never track real spend and would\n * be worse than not checking at all (false confidence). Wiring this needs\n * a real session-scoped store (`GlobalStateBridge`'s `protocolSlot`\n * pattern, used by `capabilityCeiling.ts`, is the likely shape) - a\n * follow-up, not guessed here.\n * - Fork context is resolved here and requires a captured persisted Pi source;\n * unavailable or non-Pi fork requests fail closed rather than becoming fresh\n * launches.\n * - Per-task overrides with no direct `BuildPiArgsInput` field confirmed yet\n * (`skill`, `toolBudget`, `turnBudget`, `outputSchema`/structured output,\n * `acceptance`, `output`/`outputMode`) are not mapped into `piArgs` for\n * v1. Each child still gets its resolved `AgentConfig`'s own defaults\n * (`systemPromptMode`, `inheritProjectContext`, `inheritSkills`,\n * `systemPrompt`) - not nothing, just not every param override yet.\n *\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport type { InlineAgent } from '@agimon-ai/doompi-extension-contracts/subagent-tool';\nimport { SessionManager } from '@earendil-works/pi-coding-agent';\nimport { inject, injectable, optional } from 'inversify';\nimport { PI_RUNTIME_NAME } from '../adapters/process/env.ts';\nimport { DOOM_TEAM_TYPES } from '../container/types.ts';\nimport {\n type ResolvedSubagentCapabilityCeiling,\n SubagentCapabilityPolicyStore,\n} from '../schemas/team/capabilityCeiling.ts';\nimport { resolveActiveTeamModelSpecs, resolveActiveTeamPackageConfig } from '../services/agents/discovery.ts';\nimport { canonicalizeDiscoveryCwd } from '../services/agents/projectRoot.ts';\nimport { buildSkillInjection, type ISkillDiscoveryService } from '../services/agents/skills.ts';\nimport type { AgentConfig, AgentScope, IAgentDiscoveryService } from '../services/agents/types.ts';\nimport type {\n AsyncSubagentSpawnInput,\n AsyncSubagentSpawnResult,\n IAsyncSubagentSpawner,\n} from '../services/runs/background/asyncExecution.ts';\nimport { preflightSubagentDepth, resolveCurrentSubagentDepth } from '../services/runs/shared/depthGuard.ts';\nimport {\n type AvailableModelInfo,\n type ParentModel,\n selectAvailableModel,\n} from '../services/runs/shared/modelFallback.ts';\nimport {\n isPiRuntime,\n type RuntimeTable,\n resolveRuntimeLaunch,\n resolveRuntimeTable,\n} from '../services/runs/shared/runtimeRegistry.ts';\nimport { type ConcurrencyEventReporter, runWithConcurrency } from '../services/runs/shared/runWithConcurrency.ts';\nimport { DoomTeamExpectedError } from '../shared/errors.ts';\nimport type { ExtensionConfig } from './config.ts';\n\nconst CONTEXT_FRESH = 'fresh' as const;\nconst CONTEXT_FORK = 'fork' as const;\nconst PI_RUNTIME_REQUIREMENT = `runtime \"${PI_RUNTIME_NAME}\"`;\n\ntype SessionForkCaptureMode = 'tool' | 'settled';\n\nexport interface SessionForkSource {\n sessionFile: string;\n leafId: string;\n}\n\nexport type SessionForkSourceManager = Pick<SessionManager, 'getSessionFile' | 'getLeafId' | 'getLeafEntry'>;\n\nfunction readableSessionFile(sessionFile: string | undefined): sessionFile is string {\n if (!sessionFile?.trim()) return false;\n try {\n fs.accessSync(sessionFile, fs.constants.R_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/** Capture the parent branch while excluding an assistant turn whose tool is still executing. */\nexport function captureSessionForkSource(\n manager: SessionForkSourceManager,\n mode: SessionForkCaptureMode,\n): SessionForkSource | undefined {\n const sessionFile = manager.getSessionFile();\n if (!readableSessionFile(sessionFile)) return undefined;\n\n const leaf = manager.getLeafEntry();\n const leafId =\n mode === 'tool' && leaf?.type === 'message' && leaf.message.role === 'assistant'\n ? leaf.parentId\n : (leaf?.id ?? manager.getLeafId());\n return leafId ? { sessionFile, leafId } : undefined;\n}\n\nfunction isSessionForkSourceAvailable(source: SessionForkSource): boolean {\n return Boolean(source.leafId.trim()) && readableSessionFile(source.sessionFile);\n}\n\nexport interface SpawnPlanTaskInput {\n agent: string;\n inlineAgent?: InlineAgent;\n task?: string;\n cwd?: string;\n model?: string;\n runtime?: string;\n context?: typeof CONTEXT_FRESH | typeof CONTEXT_FORK;\n /**\n * An existing child transcript to continue instead of starting fresh.\n *\n * Set only by a restore. `sdkRunnerEntry.ts` opens it through\n * `SessionManager.open`, which is what makes a restored run pick up where it\n * was suspended rather than redo the task.\n */\n sessionFile?: string;\n}\n\ntype ExecutableAgentConfig = Pick<\n AgentConfig,\n | 'name'\n | 'defaultContext'\n | 'defaultReads'\n | 'extensions'\n | 'fallbackModels'\n | 'inheritProjectContext'\n | 'inheritSkills'\n | 'mcpDirectTools'\n | 'model'\n | 'modelSource'\n | 'runtime'\n | 'skills'\n | 'skillPath'\n | 'subagentOnlyExtensions'\n | 'systemPrompt'\n | 'systemPromptMode'\n | 'thinking'\n | 'tools'\n>;\n\nfunction resolveEffectiveContext(\n taskInput: SpawnPlanTaskInput,\n agent: Pick<ExecutableAgentConfig, 'defaultContext'>,\n): typeof CONTEXT_FRESH | typeof CONTEXT_FORK {\n return taskInput.sessionFile ? CONTEXT_FRESH : (taskInput.context ?? agent.defaultContext ?? CONTEXT_FRESH);\n}\n\nexport interface SpawnPlanRequest {\n /** SINGLE mode: exactly one child. Mutually exclusive with `tasks`. */\n single?: SpawnPlanTaskInput;\n /** PARALLEL mode: N children, fanned out. Mutually exclusive with `single`. */\n tasks?: SpawnPlanTaskInput[];\n /** Max children in flight at once for PARALLEL mode. Ignored for SINGLE. Defaults to `config.parallel.concurrency` or 4. */\n concurrency?: number;\n /** Fallback cwd for any task that omits its own. */\n cwd: string;\n agentScope: AgentScope;\n /** Legacy session identity retained for delegation correlation. */\n parentSessionId?: string;\n /** Persisted parent transcript used for true Pi forks. */\n parentSessionFile?: string;\n /** Settled parent leaf used for true Pi forks. */\n parentLeafId?: string;\n artifacts?: boolean;\n /** Authenticated models reported by the live parent host. Undefined for callers without a host context. */\n availableModels?: AvailableModelInfo[];\n /** The live parent model, forwarded only for Pi child selection. */\n parentModel?: ParentModel;\n /** Overrides `resolveCurrentSubagentDepth()`'s own env read - a test seam, not a runtime path. */\n currentDepth?: number;\n /** Which runtime executes every child of this request. Defaults per agent, then to `pi`. */\n runtime?: string;\n /** Stable Pi tool-call identity used to correlate this batch. */\n operationId?: string;\n /** Run ids persisted by the operation journal before any process starts. */\n preallocatedRunIds?: string[];\n}\n\n/** Everything one child spawn needs. An object because this reached ten positional parameters. */\ninterface SpawnOneChildInput {\n runId: string;\n operationId?: string;\n agentConfig: ExecutableAgentConfig;\n excludeTools?: string[];\n teamPackageModels?: string[];\n capabilityCeiling?: ResolvedSubagentCapabilityCeiling;\n taskInput: SpawnPlanTaskInput;\n childIndex: number;\n fanout: boolean;\n fallbackCwd: string;\n parentSessionId: string | undefined;\n parentSessionFile: string | undefined;\n preparedSessionFile: string | undefined;\n handshakeTimeoutMs: number | undefined;\n artifacts: boolean | undefined;\n artifactDir: ExtensionConfig['artifactDir'];\n availableModels: AvailableModelInfo[] | undefined;\n parentModel: ParentModel | undefined;\n runtime: string | undefined;\n runtimes: RuntimeTable;\n skillProjectionCache: Map<string, ChildSkillProjection>;\n}\n\nexport interface SpawnPlanChildOutcome {\n agent: string;\n task: string;\n /** This spawn's position among its siblings. Always 0 for SINGLE mode. */\n childIndex: number;\n runId?: string;\n pid?: number;\n error?: string;\n warning?: string;\n}\n\nexport interface SpawnPlanResult {\n outcomes: SpawnPlanChildOutcome[];\n}\n\nconst DEFAULT_PARALLEL_CONCURRENCY = 4;\n/**\n * Hard ceiling on how many children one PARALLEL call may launch.\n *\n * `concurrency` does NOT bound this, and cannot: `spawnOneChild` resolves as\n * soon as its child confirms it started, and the child then runs detached. So\n * `runWithConcurrency` throttles how fast children are STARTED, not how many\n * are running - `{tasks: [8], concurrency: 4}` ends up with eight live model\n * processes, not four. Until a launch queue exists that drains as runs go\n * terminal, a width cap is the only thing standing between a fan-out and the\n * machine. 8 matches the sibling implementation's `PI_TEAM_MATE_MAX_PARALLEL`.\n */\nconst DEFAULT_PARALLEL_MAX_TASKS = 8;\nconst INLINE_AGENT_TOOLS = ['read', 'grep', 'find', 'ls'] as const;\n\nfunction appendPromptSection(prompt: string, section: string): string {\n if (!section) return prompt;\n return prompt ? `${prompt}\\n\\n${section}` : section;\n}\n\nfunction bestEffortRuntimeWarnings(\n runtime: string,\n agentConfig: ExecutableAgentConfig,\n excludeTools: string[] | undefined,\n): string[] {\n if (isPiRuntime(runtime)) return [];\n\n const warnings = [`Runtime '${runtime}' does not load Pi child extensions or hooks; launched best effort.`];\n const unsupportedResources = [\n ...(agentConfig.tools !== undefined || agentConfig.mcpDirectTools?.length ? ['tools'] : []),\n ...(agentConfig.skills?.length || agentConfig.skillPath?.length ? ['skills'] : []),\n ...(agentConfig.extensions !== undefined || agentConfig.subagentOnlyExtensions?.length ? ['extensions'] : []),\n ];\n if (unsupportedResources.length > 0) {\n warnings.push(\n `Doom Team cannot project or enforce configured Pi ${unsupportedResources.join(', ')} on runtime '${runtime}'.`,\n );\n }\n if (agentConfig.skills?.length) {\n warnings.push(`Configured skills were not injected: ${agentConfig.skills.join(', ')}.`);\n }\n if (excludeTools?.length) {\n warnings.push(\n `Runtime '${runtime}' cannot enforce Team package tool exclusions; launched best effort for: ${excludeTools.join(', ')}.`,\n );\n }\n return warnings;\n}\n\ninterface ChildSkillProjection {\n systemPrompt: string;\n requireReadTool: boolean;\n warnings: string[];\n}\n\ninterface ResolvedModelSelection {\n primaryModel: string | undefined;\n fallbackModels: string[];\n model: string | undefined;\n}\n\nfunction resolvedModelSelection(\n taskInput: SpawnPlanTaskInput,\n agentConfig: Pick<ExecutableAgentConfig, 'model' | 'modelSource' | 'fallbackModels'>,\n runtime: string,\n parentModel: ParentModel | undefined,\n availableModels: AvailableModelInfo[] | undefined,\n teamPackageModels: string[] | undefined,\n): ResolvedModelSelection {\n const parentModelId =\n isPiRuntime(runtime) && parentModel && availableModels !== undefined\n ? `${parentModel.provider}/${parentModel.id}`\n : undefined;\n const agentModels = [\n ...(agentConfig.modelSource?.scope === 'package' ? [] : [agentConfig.model]),\n ...(agentConfig.fallbackModels ?? []),\n ];\n const ordered = isPiRuntime(runtime)\n ? [taskInput.model, ...agentModels, ...(teamPackageModels ?? []), parentModelId]\n : [taskInput.model, ...agentModels, ...(teamPackageModels ?? [])];\n const candidates = ordered.filter((candidate): candidate is string => Boolean(candidate?.trim()));\n const [primaryModel, ...fallbackModels] = candidates;\n return {\n primaryModel,\n fallbackModels,\n model: selectAvailableModel(primaryModel, fallbackModels, availableModels),\n };\n}\n\nexport interface ISpawnPlanner {\n /**\n * Resolves the plan and spawns every child. Throws on any PREFLIGHT\n * failure (bad request shape, depth exceeded, unknown agent) before\n * anything spawns. Never throws for an individual child's spawn failure\n * once the batch has started - that is a `{error}` outcome instead.\n */\n spawn(request: SpawnPlanRequest, config: ExtensionConfig): Promise<SpawnPlanResult>;\n}\n\nconst ERROR_CODE_AGENT_NOT_FOUND = 'agent_not_found' as const;\nconst ERROR_CODE_INVALID_REQUEST = 'invalid_request' as const;\nconst ERROR_CODE_MODEL_UNAVAILABLE = 'model_unavailable' as const;\nconst ERROR_CODE_OPERATION_CONFLICT = 'operation_conflict' as const;\nconst ERROR_CODE_RUNTIME_UNAVAILABLE = 'runtime_unavailable' as const;\nconst ERROR_CODE_UNSUPPORTED_CONTEXT = 'unsupported_context' as const;\nconst ERROR_CODE_UNSUPPORTED_OPERATION = 'unsupported_operation' as const;\n\n@injectable()\nexport class SpawnPlanner implements ISpawnPlanner {\n constructor(\n @inject(DOOM_TEAM_TYPES.AgentDiscoveryService) private readonly agents: IAgentDiscoveryService,\n @inject(DOOM_TEAM_TYPES.AsyncSubagentSpawner) private readonly spawner: IAsyncSubagentSpawner,\n @inject(DOOM_TEAM_TYPES.SubagentCapabilityPolicyStore)\n private readonly policies: SubagentCapabilityPolicyStore = new SubagentCapabilityPolicyStore(),\n @inject(DOOM_TEAM_TYPES.SkillDiscoveryService)\n @optional()\n private readonly skills?: ISkillDiscoveryService,\n @inject(DOOM_TEAM_TYPES.ConcurrencyEventReporter)\n @optional()\n private readonly reportConcurrencyEvent?: ConcurrencyEventReporter,\n ) {}\n\n protected generateRunId(): string {\n return crypto.randomUUID();\n }\n\n protected createForkSessionFile(source: SessionForkSource, cwd: string): string {\n const sessionManager = SessionManager.open(source.sessionFile, undefined, cwd);\n const sessionFile = sessionManager.createBranchedSession(source.leafId);\n if (!sessionFile) throw new Error(`Could not create a branched Pi session from '${source.sessionFile}'.`);\n\n // Pi defers writing user-only branches until an assistant response. A tool-safe\n // fork usually ends at the user message immediately before the active tool call,\n // so materialize that valid child transcript before the runner opens it.\n if (!fs.existsSync(sessionFile)) {\n const header = sessionManager.getHeader();\n if (!header) throw new Error(`Forked Pi session '${sessionFile}' has no header.`);\n const records = [header, ...sessionManager.getEntries()];\n fs.writeFileSync(sessionFile, `${records.map((record) => JSON.stringify(record)).join('\\n')}\\n`, { flag: 'wx' });\n }\n return sessionFile;\n }\n\n protected removePreparedSessionFile(sessionFile: string): void {\n fs.rmSync(sessionFile, { force: true });\n }\n\n protected validateCwd(cwd: string): void {\n let stat: fs.Stats;\n try {\n stat = fs.statSync(cwd);\n } catch {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n `Working directory '${cwd}' does not exist.`,\n false,\n 'Retry with an existing directory.',\n );\n }\n if (!stat.isDirectory()) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n `Working directory '${cwd}' is not a directory.`,\n false,\n 'Retry with an existing directory.',\n );\n }\n }\n\n protected resolveTeamPackageExcludeTools(): string[] | undefined {\n return resolveActiveTeamPackageConfig()?.config.excludeTools;\n }\n\n protected resolveTeamPackageModels(): string[] | undefined {\n return resolveActiveTeamModelSpecs();\n }\n\n protected executableAvailable(command: string): boolean {\n if (path.isAbsolute(command) || command.includes(path.sep)) {\n try {\n fs.accessSync(command, fs.constants.X_OK);\n return true;\n } catch {\n return false;\n }\n }\n return (process.env.PATH ?? '')\n .split(path.delimiter)\n .filter(Boolean)\n .some((directory) => {\n try {\n fs.accessSync(path.join(directory, command), fs.constants.X_OK);\n return true;\n } catch {\n return false;\n }\n });\n }\n\n private resolveTaskList(request: SpawnPlanRequest): SpawnPlanTaskInput[] {\n const hasSingle = request.single !== undefined;\n const hasTasks = request.tasks !== undefined;\n if (hasSingle === hasTasks) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n 'A run requires exactly one of internal single or tasks representations.',\n false,\n 'Submit a non-empty requests array.',\n );\n }\n if (hasSingle) return [request.single!];\n if (!request.tasks || request.tasks.length === 0) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n 'A run requires at least one entry in its requests collection.',\n false,\n 'Submit a non-empty requests array.',\n );\n }\n return request.tasks;\n }\n\n private resolveAgentOrThrow(name: string, cwd: string, scope: AgentScope) {\n const resolved = this.agents.find(cwd, scope, name);\n if (!resolved) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_AGENT_NOT_FOUND,\n `Unknown agent '${name}'.`,\n false,\n 'Call subagent({\"action\":\"agents\"}) and retry with an exact name.',\n );\n }\n return resolved;\n }\n\n private resolveExecutableAgent(taskInput: SpawnPlanTaskInput, cwd: string, scope: AgentScope): ExecutableAgentConfig {\n if (!taskInput.inlineAgent) return this.resolveAgentOrThrow(taskInput.agent, cwd, scope);\n return {\n name: taskInput.agent.trim(),\n systemPromptMode: 'append',\n inheritProjectContext: true,\n inheritSkills: false,\n systemPrompt: taskInput.inlineAgent.systemPrompt.trim(),\n tools: [...INLINE_AGENT_TOOLS],\n defaultContext: CONTEXT_FRESH,\n runtime: PI_RUNTIME_NAME,\n };\n }\n\n private projectDefaultReads(\n defaultReads: string[] | undefined,\n childCwd: string,\n agentName: string,\n ): ChildSkillProjection {\n if (!defaultReads?.length) return { systemPrompt: '', requireReadTool: false, warnings: [] };\n\n const seen = new Set<string>();\n const readablePaths: string[] = [];\n const missingPaths: string[] = [];\n for (const configuredPath of defaultReads) {\n const trimmed = configuredPath.trim();\n if (!trimmed) continue;\n const resolvedPath = path.isAbsolute(trimmed) ? path.normalize(trimmed) : path.resolve(childCwd, trimmed);\n const identity = canonicalizeDiscoveryCwd(resolvedPath);\n if (seen.has(identity)) continue;\n seen.add(identity);\n try {\n if (fs.statSync(resolvedPath).isFile()) readablePaths.push(resolvedPath);\n else missingPaths.push(resolvedPath);\n } catch {\n missingPaths.push(resolvedPath);\n }\n }\n\n const systemPrompt =\n readablePaths.length > 0\n ? [\n 'Read these configured paths before broad repository discovery:',\n ...readablePaths.map((readPath) => `- ${readPath}`),\n 'If a listed path does not provide enough context, name the concrete missing dependency before searching narrowly for it.',\n ].join('\\n')\n : '';\n return {\n systemPrompt,\n requireReadTool: readablePaths.length > 0,\n warnings:\n missingPaths.length > 0\n ? [`Agent '${agentName}' could not read optional default paths: ${missingPaths.join(', ')}.`]\n : [],\n };\n }\n\n private projectConfiguredSkills(\n agentConfig: ExecutableAgentConfig,\n childCwd: string,\n requestCwd: string,\n runtime: string,\n cache: Map<string, ChildSkillProjection>,\n ): ChildSkillProjection {\n const cacheKey = JSON.stringify([\n canonicalizeDiscoveryCwd(childCwd),\n canonicalizeDiscoveryCwd(requestCwd),\n runtime,\n agentConfig.name,\n agentConfig.systemPrompt,\n agentConfig.skills ?? [],\n agentConfig.skillPath ?? [],\n agentConfig.defaultReads ?? [],\n ]);\n const cached = cache.get(cacheKey);\n if (cached) return cached;\n\n if (!isPiRuntime(runtime)) {\n const projection = { systemPrompt: agentConfig.systemPrompt, requireReadTool: false, warnings: [] };\n cache.set(cacheKey, projection);\n return projection;\n }\n\n const defaultReads = this.projectDefaultReads(agentConfig.defaultReads, childCwd, agentConfig.name);\n let skillInjection = '';\n let skillWarnings: string[] = [];\n if (agentConfig.skills?.length) {\n if (!this.skills) throw new Error('Skill discovery is unavailable for configured child skills.');\n const resolution = this.skills.resolveSkillsWithFallback(\n agentConfig.skills,\n childCwd,\n requestCwd,\n agentConfig.skillPath,\n requestCwd,\n );\n skillInjection = buildSkillInjection(resolution.resolved);\n skillWarnings =\n resolution.missing.length > 0\n ? [\n `Agent '${agentConfig.name}' could not resolve configured skills: ${resolution.missing.join(', ')}; launched with resolved skills only.`,\n ]\n : [];\n }\n\n const projection = {\n systemPrompt: appendPromptSection(\n appendPromptSection(agentConfig.systemPrompt, skillInjection),\n defaultReads.systemPrompt,\n ),\n requireReadTool: skillInjection.length > 0 || defaultReads.requireReadTool,\n warnings: [...skillWarnings, ...defaultReads.warnings],\n };\n cache.set(cacheKey, projection);\n return projection;\n }\n\n /**\n * Spawns exactly one child and returns its outcome. Shared by `spawn()`\n * (SINGLE/PARALLEL) and `spawnChain()`'s per-step/per-parallel-group-child\n * calls, so the `AsyncSubagentSpawnInput` mapping exists in exactly one\n * place. Never throws - a spawn failure becomes an `{error}` outcome, per\n * the \"preflight throws, per-child failure does not\" split documented in\n * the module header.\n */\n private async spawnOneChild(input: SpawnOneChildInput): Promise<SpawnPlanChildOutcome> {\n const {\n runId,\n operationId,\n agentConfig,\n capabilityCeiling,\n excludeTools,\n teamPackageModels,\n taskInput,\n childIndex,\n fanout,\n fallbackCwd,\n parentSessionId,\n parentSessionFile,\n preparedSessionFile,\n handshakeTimeoutMs,\n artifacts,\n artifactDir,\n availableModels,\n parentModel,\n runtime,\n runtimes,\n skillProjectionCache,\n } = input;\n const cwd = taskInput.cwd ?? fallbackCwd;\n const task = taskInput.task ?? '';\n const effectiveContext = resolveEffectiveContext(taskInput, agentConfig);\n const effectiveRuntime = taskInput.runtime ?? runtime ?? agentConfig.runtime ?? PI_RUNTIME_NAME;\n const modelSelection = resolvedModelSelection(\n taskInput,\n agentConfig,\n effectiveRuntime,\n parentModel,\n availableModels,\n teamPackageModels,\n );\n if (modelSelection.primaryModel && availableModels !== undefined && !modelSelection.model) {\n return {\n agent: agentConfig.name,\n task,\n childIndex,\n error: `No authenticated model is available for '${agentConfig.name}'. Checked: ${[\n modelSelection.primaryModel,\n ...modelSelection.fallbackModels,\n ].join(', ')}.`,\n };\n }\n\n let skillProjection: ChildSkillProjection;\n try {\n skillProjection = this.projectConfiguredSkills(\n agentConfig,\n cwd,\n fallbackCwd,\n effectiveRuntime,\n skillProjectionCache,\n );\n } catch (error) {\n return {\n agent: agentConfig.name,\n task,\n childIndex,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n const warnings = [\n ...skillProjection.warnings,\n ...bestEffortRuntimeWarnings(effectiveRuntime, agentConfig, excludeTools),\n ];\n const warning = warnings.length > 0 ? warnings.join(' ') : undefined;\n\n // Persist every Pi child's own transcript so a later explicit restore can\n // continue it. External runtimes retain their existing session behavior.\n const spawnInput: AsyncSubagentSpawnInput = {\n runId,\n ...(operationId ? { operationId } : {}),\n agent: agentConfig.name,\n ...(taskInput.inlineAgent ? { inlineAgent: taskInput.inlineAgent } : {}),\n task,\n cwd,\n childIndex,\n fanout,\n ...(parentSessionFile ? { parentSessionFile } : {}),\n piArgs: {\n baseArgs: [],\n sessionEnabled: isPiRuntime(effectiveRuntime),\n ...(taskInput.sessionFile\n ? { sessionFile: taskInput.sessionFile }\n : preparedSessionFile\n ? { sessionFile: preparedSessionFile }\n : {}),\n inheritProjectContext: agentConfig.inheritProjectContext,\n inheritSkills: agentConfig.inheritSkills,\n systemPromptMode: agentConfig.systemPromptMode,\n systemPrompt: skillProjection.systemPrompt,\n requireReadTool: skillProjection.requireReadTool,\n model: modelSelection.model,\n thinking: agentConfig.thinking,\n tools: agentConfig.tools,\n extensions: agentConfig.extensions,\n subagentOnlyExtensions: agentConfig.subagentOnlyExtensions,\n mcpDirectTools: agentConfig.mcpDirectTools,\n excludeTools,\n capabilityCeiling,\n cwd,\n ...(effectiveContext === CONTEXT_FORK && parentSessionId ? { parentSessionId } : {}),\n },\n ...(handshakeTimeoutMs !== undefined ? { handshakeTimeoutMs } : {}),\n ...(artifacts !== undefined ? { artifacts } : {}),\n ...(artifactDir !== undefined ? { artifactDir } : {}),\n // Per-call `runtime` wins over the agent's own default, matching how\n // `model` and `context` already resolve.\n runtime: effectiveRuntime,\n runtimes,\n };\n\n try {\n const result: AsyncSubagentSpawnResult = await this.spawner.spawn(spawnInput);\n return {\n agent: agentConfig.name,\n task,\n childIndex,\n runId: result.runId,\n pid: result.pid,\n ...(warning ? { warning } : {}),\n };\n } catch (error) {\n return {\n agent: agentConfig.name,\n task,\n childIndex,\n error: error instanceof Error ? error.message : String(error),\n ...(warning ? { warning } : {}),\n };\n }\n }\n\n async spawn(request: SpawnPlanRequest, config: ExtensionConfig): Promise<SpawnPlanResult> {\n const tasks = this.resolveTaskList(request);\n const fanout = tasks.length > 1;\n const teamPackageExcludeTools = this.resolveTeamPackageExcludeTools();\n const teamPackageModels = this.resolveTeamPackageModels();\n const capabilityCeiling = this.policies.resolve();\n\n // PREFLIGHT - all before any spawn call, so a declared plan that cannot\n // run at all produces one refusal, not a partial fan-out.\n const currentDepth = request.currentDepth ?? resolveCurrentSubagentDepth();\n const depthCheck = preflightSubagentDepth(currentDepth, config);\n if (depthCheck.error) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_OPERATION,\n depthCheck.error,\n false,\n 'Give each child a self-contained task within the Team package policy.',\n );\n }\n\n const maxTasks = config.parallel?.maxTasks ?? DEFAULT_PARALLEL_MAX_TASKS;\n if (tasks.length > maxTasks) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n `Run requested ${tasks.length} tasks, but at most ${maxTasks} may run at once. Concurrency throttles how fast they start, not how many run.`,\n false,\n 'Split the requests into smaller explicit run calls.',\n );\n }\n\n for (const taskInput of tasks) {\n if (!taskInput.task?.trim()) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n `Run request for '${taskInput.agent}' requires a nonblank task.`,\n false,\n 'Provide a self-contained nonblank task.',\n );\n }\n if (taskInput.inlineAgent && !taskInput.inlineAgent.systemPrompt.trim()) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_INVALID_REQUEST,\n `Inline agent '${taskInput.agent}' requires a nonblank system prompt.`,\n false,\n 'Provide a focused read-only exploration role.',\n );\n }\n }\n\n const resolvedAgentCache = new Map<string, ExecutableAgentConfig>();\n const resolvedAgents = tasks.map((taskInput) => {\n if (taskInput.inlineAgent) {\n return this.resolveExecutableAgent(taskInput, taskInput.cwd ?? request.cwd, request.agentScope);\n }\n const cacheKey = [\n request.agentScope,\n canonicalizeDiscoveryCwd(taskInput.cwd ?? request.cwd),\n taskInput.agent,\n ].join('\\0');\n const cached = resolvedAgentCache.get(cacheKey);\n if (cached) return cached;\n const resolved = this.resolveExecutableAgent(taskInput, taskInput.cwd ?? request.cwd, request.agentScope);\n resolvedAgentCache.set(cacheKey, resolved);\n return resolved;\n });\n for (const [index, taskInput] of tasks.entries()) {\n const effectiveContext = resolveEffectiveContext(taskInput, resolvedAgents[index]!);\n const runtime = taskInput.runtime ?? request.runtime ?? resolvedAgents[index]!.runtime ?? PI_RUNTIME_NAME;\n if (effectiveContext === CONTEXT_FORK) {\n if (!isPiRuntime(runtime)) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_CONTEXT,\n `Fork context requires ${PI_RUNTIME_REQUIREMENT} for '${taskInput.agent}'.`,\n false,\n 'Use a Pi agent for fork context or explicitly request a fresh run.',\n );\n }\n const source =\n request.parentSessionFile && request.parentLeafId\n ? { sessionFile: request.parentSessionFile, leafId: request.parentLeafId }\n : undefined;\n if (!source || !isSessionForkSourceAvailable(source)) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_CONTEXT,\n `Fork context is unavailable for '${taskInput.agent}': the parent Pi session has no readable source.`,\n false,\n 'Use an active persisted Pi session or explicitly request a fresh run.',\n );\n }\n }\n }\n\n if (request.preallocatedRunIds && request.preallocatedRunIds.length !== tasks.length) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_OPERATION_CONFLICT,\n 'The operation journal run-id count does not match the request count.',\n false,\n 'Submit the run as a new tool call.',\n );\n }\n const runIds = request.preallocatedRunIds ?? tasks.map(() => this.generateRunId());\n const runtimes = resolveRuntimeTable(config.runtimes);\n for (const [index, taskInput] of tasks.entries()) {\n const agent = resolvedAgents[index]!;\n const cwd = taskInput.cwd ?? request.cwd;\n this.validateCwd(cwd);\n const runtime = taskInput.runtime ?? request.runtime ?? agent.runtime ?? PI_RUNTIME_NAME;\n const modelSelection = resolvedModelSelection(\n taskInput,\n agent,\n runtime,\n request.parentModel,\n request.availableModels,\n teamPackageModels,\n );\n if (modelSelection.primaryModel && request.availableModels !== undefined && !modelSelection.model) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_MODEL_UNAVAILABLE,\n `No authenticated model is available for '${agent.name}'.`,\n false,\n 'Authenticate the requested model or choose an available model.',\n );\n }\n if (taskInput.inlineAgent && !isPiRuntime(runtime)) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_OPERATION,\n `Inline agent '${taskInput.agent}' requires ${PI_RUNTIME_REQUIREMENT} to enforce its read-only tools.`,\n false,\n 'Remove the runtime override or use a discovered external-runtime agent without inlineAgent.',\n );\n }\n if (capabilityCeiling && !isPiRuntime(runtime)) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_OPERATION,\n `Runtime '${runtime}' cannot enforce the active capability ceiling.`,\n false,\n `Use ${PI_RUNTIME_REQUIREMENT} while plan mode or another capability ceiling is active.`,\n );\n }\n if (!isPiRuntime(runtime)) {\n let command: string;\n try {\n command = resolveRuntimeLaunch(runtime, runtimes, { prompt: taskInput.task ?? '', cwd }).command;\n } catch (error) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_RUNTIME_UNAVAILABLE,\n error instanceof Error ? error.message : String(error),\n false,\n `Configure a valid external runtime or use ${PI_RUNTIME_REQUIREMENT}.`,\n );\n }\n if (!this.executableAvailable(command)) {\n throw new DoomTeamExpectedError(\n ERROR_CODE_RUNTIME_UNAVAILABLE,\n `Executable '${command}' for runtime '${runtime}' is unavailable.`,\n false,\n `Install the executable, configure its absolute path, or use ${PI_RUNTIME_REQUIREMENT}.`,\n );\n }\n }\n }\n const forkSource =\n request.parentSessionFile && request.parentLeafId\n ? { sessionFile: request.parentSessionFile, leafId: request.parentLeafId }\n : undefined;\n const preparedSessionFiles: Array<string | undefined> = [];\n try {\n for (const [index, taskInput] of tasks.entries()) {\n preparedSessionFiles.push(\n resolveEffectiveContext(taskInput, resolvedAgents[index]!) === CONTEXT_FORK\n ? this.createForkSessionFile(forkSource!, taskInput.cwd ?? request.cwd)\n : undefined,\n );\n }\n } catch (error) {\n for (const sessionFile of preparedSessionFiles) {\n if (sessionFile) this.removePreparedSessionFile(sessionFile);\n }\n throw new DoomTeamExpectedError(\n ERROR_CODE_UNSUPPORTED_CONTEXT,\n error instanceof Error ? error.message : String(error),\n false,\n 'Retry from an active persisted Pi session or explicitly request a fresh run.',\n );\n }\n\n const concurrency = fanout\n ? (request.concurrency ?? config.parallel?.concurrency ?? DEFAULT_PARALLEL_CONCURRENCY)\n : 1;\n\n const skillProjectionCache = new Map<string, ChildSkillProjection>();\n const factories = tasks.map(\n (taskInput, childIndex) => () =>\n this.spawnOneChild({\n runId: runIds[childIndex]!,\n operationId: request.operationId,\n agentConfig: resolvedAgents[childIndex]!,\n excludeTools: teamPackageExcludeTools,\n teamPackageModels,\n capabilityCeiling,\n taskInput,\n childIndex,\n fanout,\n fallbackCwd: request.cwd,\n parentSessionId: request.parentSessionId,\n parentSessionFile: request.parentSessionFile,\n preparedSessionFile: preparedSessionFiles[childIndex],\n handshakeTimeoutMs: config.handshakeTimeoutMs,\n artifacts: request.artifacts,\n artifactDir: config.artifactDir,\n availableModels: request.availableModels,\n parentModel: request.parentModel,\n runtime: request.runtime,\n runtimes,\n skillProjectionCache,\n }),\n );\n\n const settled = await runWithConcurrency(factories, concurrency, this.reportConcurrencyEvent);\n // `spawnOneChild` never rejects (it catches its own spawn failure into\n // an `{error}` outcome), so `runWithConcurrency` never sees a rejection\n // here - this unwrap is defensive, not a real branch.\n const outcomes = settled.map((outcome, index) =>\n outcome.status === 'fulfilled'\n ? outcome.value\n : {\n agent: resolvedAgents[index]!.name,\n task: tasks[index]!.task ?? '',\n childIndex: index,\n error: outcome.reason instanceof Error ? outcome.reason.message : String(outcome.reason),\n },\n );\n\n return { outcomes };\n }\n}\n"],"mappings":"kuDAkGA,SAAS,GAAoB,EAAwD,CACnF,GAAI,CAAC,GAAa,MAAM,CAAE,MAAO,GACjC,GAAI,CAEF,OADA,EAAG,WAAW,EAAa,EAAG,UAAU,KAAK,CACtC,QACD,CACN,MAAO,IAKX,SAAgB,GACd,EACA,EAC+B,CAC/B,IAAM,EAAc,EAAQ,gBAAgB,CAC5C,GAAI,CAAC,GAAoB,EAAY,CAAE,OAEvC,IAAM,EAAO,EAAQ,cAAc,CAC7B,EACJ,IAAS,QAAU,GAAM,OAAS,WAAa,EAAK,QAAQ,OAAS,YACjE,EAAK,SACJ,GAAM,IAAM,EAAQ,WAAW,CACtC,OAAO,EAAS,CAAE,cAAa,SAAQ,CAAG,IAAA,GAG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BAA0B,EAAY,CAE9D,MAAM,IAAI,EACR,EACA,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CACtD,GACA,+EACD,CAGH,IAAM,EAAc,EACf,EAAQ,aAAe,EAAO,UAAU,aAAe,EACxD,EAEE,EAAuB,IAAI,IA2CjC,MAAO,CAAE,UAXQ,MAJK,EA3BJ,EAAM,KACrB,EAAW,QACV,KAAK,cAAc,CACjB,MAAO,EAAO,GACd,YAAa,EAAQ,YACrB,YAAa,EAAe,GAC5B,aAAc,EACd,oBACA,oBACA,YACA,aACA,SACA,YAAa,EAAQ,IACrB,gBAAiB,EAAQ,gBACzB,kBAAmB,EAAQ,kBAC3B,oBAAqB,EAAqB,GAC1C,mBAAoB,EAAO,mBAC3B,UAAW,EAAQ,UACnB,YAAa,EAAO,YACpB,gBAAiB,EAAQ,gBACzB,YAAa,EAAQ,YACrB,QAAS,EAAQ,QACjB,WACA,uBACD,CAAC,CAG4C,CAAE,EAAa,KAAK,uBAAuB,EAIpE,KAAK,EAAS,IACrC,EAAQ,SAAW,YACf,EAAQ,MACR,CACE,MAAO,EAAe,GAAQ,KAC9B,KAAM,EAAM,GAAQ,MAAQ,GAC5B,WAAY,EACZ,MAAO,EAAQ,kBAAkB,MAAQ,EAAQ,OAAO,QAAU,OAAO,EAAQ,OAAO,CACzF,CAGU,CAAE,QA9mBtB,IAAY,KAGR,EAAO,EAAgB,sBAAsB,CAAA,KAC7C,EAAO,EAAgB,qBAAqB,CAAA,KAC5C,EAAO,EAAgB,8BAA8B,CAAA,KAErD,EAAO,EAAgB,sBAAsB,CAAA,KAC7C,GAAU,CAAA,KAEV,EAAO,EAAgB,yBAAyB,CAAA,KAChD,GAAU,CAAA"}
@@ -1,2 +1,2 @@
1
- const e=require(`../extension.cjs`);function t(t){e.activateDoomTeamExtension(t,{doomIntegrations:!1})}exports.activateStandardTeamExtension=t;
1
+ const e=require(`../adapters/pi/extension.cjs`);function t(t){e.activateDoomTeamExtension(t,{doomIntegrations:!1})}exports.activateStandardTeamExtension=t;
2
2
  //# sourceMappingURL=standard.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard.cjs","names":[],"sources":["../../src/extensions/standard.ts"],"sourcesContent":["import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\n\nimport { activateDoomTeamExtension } from '../extension.ts';\n\n/** Standard Pi composition, with Doom-only leader contributions disabled. */\nexport function activateStandardTeamExtension(pi: ExtensionAPI): void {\n activateDoomTeamExtension(pi, { doomIntegrations: false });\n}\n"],"mappings":"oCAKA,SAAgB,EAA8B,EAAwB,CACpE,EAAA,0BAA0B,EAAI,CAAE,iBAAkB,GAAO,CAAC"}
1
+ {"version":3,"file":"standard.cjs","names":[],"sources":["../../src/extensions/standard.ts"],"sourcesContent":["import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\n\nimport { activateDoomTeamExtension } from '../adapters/pi/extension.ts';\n\n/** Standard Pi composition, with Doom-only leader contributions disabled. */\nexport function activateStandardTeamExtension(pi: ExtensionAPI): void {\n activateDoomTeamExtension(pi, { doomIntegrations: false });\n}\n"],"mappings":"gDAKA,SAAgB,EAA8B,EAAwB,CACpE,EAAA,0BAA0B,EAAI,CAAE,iBAAkB,GAAO,CAAC"}
@@ -1,2 +1,2 @@
1
- import{activateDoomTeamExtension as e}from"../extension.mjs";function t(t){e(t,{doomIntegrations:!1})}export{t as activateStandardTeamExtension};
1
+ import{activateDoomTeamExtension as e}from"../adapters/pi/extension.mjs";function t(t){e(t,{doomIntegrations:!1})}export{t as activateStandardTeamExtension};
2
2
  //# sourceMappingURL=standard.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard.mjs","names":[],"sources":["../../src/extensions/standard.ts"],"sourcesContent":["import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\n\nimport { activateDoomTeamExtension } from '../extension.ts';\n\n/** Standard Pi composition, with Doom-only leader contributions disabled. */\nexport function activateStandardTeamExtension(pi: ExtensionAPI): void {\n activateDoomTeamExtension(pi, { doomIntegrations: false });\n}\n"],"mappings":"6DAKA,SAAgB,EAA8B,EAAwB,CACpE,EAA0B,EAAI,CAAE,iBAAkB,GAAO,CAAC"}
1
+ {"version":3,"file":"standard.mjs","names":[],"sources":["../../src/extensions/standard.ts"],"sourcesContent":["import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\n\nimport { activateDoomTeamExtension } from '../adapters/pi/extension.ts';\n\n/** Standard Pi composition, with Doom-only leader contributions disabled. */\nexport function activateStandardTeamExtension(pi: ExtensionAPI): void {\n activateDoomTeamExtension(pi, { doomIntegrations: false });\n}\n"],"mappings":"yEAKA,SAAgB,EAA8B,EAAwB,CACpE,EAA0B,EAAI,CAAE,iBAAkB,GAAO,CAAC"}
@@ -1,4 +1,4 @@
1
- const e=require(`../runs/registry/suspendedRuns.cjs`),t=require(`../shared/formatters.cjs`),n=require(`../tui/fleetTranscript.cjs`);function r(e,n){return e.startedAt?t.formatDuration(Math.max(0,n-e.startedAt)):`unknown`}function i(t,n=Date.now(),i=[]){if(t.length===0&&i.length===0)return`No runs tracked in this session. A run appears here once it has been launched from this session.`;let a=[`${t.length} active run${t.length===1?``:`s`}:`];for(let e of t){let t=[`- ${e.runId}`,e.status??`starting`,r(e,n)];e.activityState&&t.push(e.activityState),e.attentionReason&&t.push(e.attentionReason),e.error&&t.push(`error: ${e.error}`),a.push(t.join(` · `))}if(i.length>0){a.push(``,`${i.length} suspended run${i.length===1?``:`s`}:`);for(let t of i){let n=e.isSuspendedRunResumable(t)?`restore with { action: "restore", id: "${t.runId}" }`:`not resumable; submit a new explicit run`;a.push(`- ${t.runId} (${t.agent}, ${t.runtime}): ${n}`)}}return t.length>0&&(a.push(``),a.push(`Inspect one with { action: "status", id: "<run id>", transcriptLines: 80 }.`)),a.join(`
1
+ const e=require(`../adapters/suspendedRuns.cjs`);require(`../services/runs/registry/suspendedRuns.cjs`);const t=require(`../shared/formatters.cjs`),n=require(`../tui/fleetTranscript.cjs`);function r(e,n){return e.startedAt?t.formatDuration(Math.max(0,n-e.startedAt)):`unknown`}function i(t,n=Date.now(),i=[]){if(t.length===0&&i.length===0)return`No runs tracked in this session. A run appears here once it has been launched from this session.`;let a=[`${t.length} active run${t.length===1?``:`s`}:`];for(let e of t){let t=[`- ${e.runId}`,e.status??`starting`,r(e,n)];e.activityState&&t.push(e.activityState),e.attentionReason&&t.push(e.attentionReason),e.error&&t.push(`error: ${e.error}`),a.push(t.join(` · `))}if(i.length>0){a.push(``,`${i.length} suspended run${i.length===1?``:`s`}:`);for(let t of i){let n=e.isSuspendedRunResumable(t)?`restore with { action: "restore", id: "${t.runId}" }`:`not resumable; submit a new explicit run`;a.push(`- ${t.runId} (${t.agent}, ${t.runtime}): ${n}`)}}return t.length>0&&(a.push(``),a.push(`Inspect one with { action: "status", id: "<run id>", transcriptLines: 80 }.`)),a.join(`
2
2
  `)}function a(e){if(e.kind===`tool`){let t=e.status===`running`?`…`:e.status===`error`?`error`:`ok`,n=e.args?JSON.stringify(e.args):e.text,r=`[tool ${t}] ${e.name??`tool`}${n?` ${n}`:``}`,i=e.result?.trimEnd();if(!i)return r;let a=i.split(`
3
3
  `),o=a.slice(0,5),s=a.length-o.length;return[r,...o.map(e=>` ${e}`),s>0?` … +${s} lines`:void 0].filter(e=>e!==void 0).join(`
4
4
  `)}return`[${e.kind}] ${e.text}`}function o(e,t){let r=e?.transcriptPath;if(!r)return e?`This run has no transcript. Artifacts were disabled for it (artifacts: false), so nothing was recorded.`:`No status found for this run, so there is no transcript to read.`;let i=n.readFleetTranscript(r);if(i.warning)return`Transcript at '${r}' could not be read: ${i.warning}`;if(i.events.length===0)return`Transcript at '${r}' is empty. The run has not written anything yet.`;let o=i.events.flatMap(e=>a(e).split(`
@@ -1 +1 @@
1
- {"version":3,"file":"statusViews.cjs","names":["formatDuration","isSuspendedRunResumable","readFleetTranscript"],"sources":["../../src/extensions/statusViews.ts"],"sourcesContent":["/**\n * Plain-text renderings of `action: 'status'`'s optional `view` modes, for the\n * MODEL rather than for a terminal.\n *\n * WHY THIS IS NOT `tui/fleet.ts` OR `renderFleetTranscript`:\n * Those exist, they are correct, and they are wired to the `/fleet` slash\n * command - but every one of them takes a `Theme` and emits ANSI escapes,\n * because their reader is a human looking at a TUI overlay. A tool result is\n * read by a model, where escape sequences are noise it pays tokens for and\n * cannot act on. So this module reuses the transcript READER\n * (`readFleetTranscript`, which is pure parsing) and does its own formatting,\n * rather than reusing a renderer whose whole job is the part that does not\n * transfer.\n *\n * WHY THESE VIEWS ARE WIRED AT ALL RATHER THAN DELETED FROM THE DESCRIPTION:\n * `view: 'fleet'` and `view: 'transcript'` were already documented on the\n * `subagent` tool, and neither worked - `status` read `id` first and threw\n * before ever looking at `view`, so the documented `{action:'status',\n * view:'fleet'}` call could not succeed at all. Between deleting the promise\n * and honouring it, honouring it is worth more: reading a running child's\n * output is the one coordinator capability the sibling implementation has\n * (`task_output`) that this package otherwise lacks, and the pieces to build\n * it were already here.\n *\n * DELIBERATELY NOT SUPPORTED: `index`.\n * A chain or fan-out child is its own run with its own id, not an index into\n * this run's transcript, and nothing in this package maps \"child N of run X\"\n * to a run id (see `asyncExecution.ts`'s CHILD INDEX section - the index is\n * an input the caller already knows, never something resolved back). Accepting\n * `index` here and ignoring it would be the same false affordance this whole\n * pass exists to remove, so `status` does not document it; `steer` and\n * `append-step`, which really do use it, still do.\n */\n\nimport type { TrackedAsyncJob } from '../runs/background/asyncJobTracker.ts';\nimport type { AsyncRunStatus } from '../runs/background/asyncExecution.ts';\nimport { isSuspendedRunResumable, type SuspendedRun } from '../runs/registry/suspendedRuns.ts';\nimport { readFleetTranscript, type FleetTranscriptEvent } from '../tui/fleetTranscript.ts';\nimport { formatDuration } from '../shared/formatters.ts';\n\n/** Default transcript tail length. Matches the value the tool description has always advertised. */\nexport const DEFAULT_TRANSCRIPT_LINES = 80;\n\nfunction age(job: TrackedAsyncJob, now: number): string {\n return job.startedAt ? formatDuration(Math.max(0, now - job.startedAt)) : 'unknown';\n}\n\n/**\n * The active-fleet overview: every run this session is tracking, one per line.\n *\n * Takes `now` rather than calling `Date.now()` so a test asserting rendered\n * ages does not have to freeze global time.\n */\nexport function formatFleetView(\n jobs: TrackedAsyncJob[],\n now: number = Date.now(),\n suspended: SuspendedRun[] = [],\n): string {\n if (jobs.length === 0 && suspended.length === 0) {\n return 'No runs tracked in this session. A run appears here once it has been launched from this session.';\n }\n\n const lines = [`${jobs.length} active run${jobs.length === 1 ? '' : 's'}:`];\n for (const job of jobs) {\n const parts = [`- ${job.runId}`, job.status ?? 'starting', age(job, now)];\n if (job.activityState) parts.push(job.activityState);\n if (job.attentionReason) parts.push(job.attentionReason);\n if (job.error) parts.push(`error: ${job.error}`);\n lines.push(parts.join(' · '));\n }\n if (suspended.length > 0) {\n lines.push('', `${suspended.length} suspended run${suspended.length === 1 ? '' : 's'}:`);\n for (const run of suspended) {\n const recovery = isSuspendedRunResumable(run)\n ? `restore with { action: \"restore\", id: \"${run.runId}\" }`\n : 'not resumable; submit a new explicit run';\n lines.push(`- ${run.runId} (${run.agent}, ${run.runtime}): ${recovery}`);\n }\n }\n if (jobs.length > 0) {\n lines.push('');\n lines.push(`Inspect one with { action: \"status\", id: \"<run id>\", transcriptLines: ${DEFAULT_TRANSCRIPT_LINES} }.`);\n }\n return lines.join('\\n');\n}\n\n/** Tool output shown to the model, bounded so one long result cannot crowd out the rest of the tail. */\nconst TOOL_RESULT_PREVIEW_LINES = 5;\n\nfunction formatEvent(event: FleetTranscriptEvent): string {\n if (event.kind === 'tool') {\n const status = event.status === 'running' ? '…' : event.status === 'error' ? 'error' : 'ok';\n const args = event.args ? JSON.stringify(event.args) : event.text;\n const header = `[tool ${status}] ${event.name ?? 'tool'}${args ? ` ${args}` : ''}`;\n const result = event.result?.trimEnd();\n if (!result) return header;\n // The result is the half the model most needs: it is what the call\n // actually learned, and it used to be dropped entirely.\n const body = result.split('\\n');\n const shown = body.slice(0, TOOL_RESULT_PREVIEW_LINES);\n const hidden = body.length - shown.length;\n return [header, ...shown.map((line) => ` ${line}`), hidden > 0 ? ` … +${hidden} lines` : undefined]\n .filter((line): line is string => line !== undefined)\n .join('\\n');\n }\n return `[${event.kind}] ${event.text}`;\n}\n\n/**\n * A run's transcript tail.\n *\n * Bounded from the END, not the start: a caller asking for 80 lines of a\n * long-running child wants the most recent 80, not the first 80 of its\n * startup. When the window drops anything, the fact that it did is stated,\n * so a reader never mistakes a tail for the whole run.\n */\nexport function formatRunTranscript(status: AsyncRunStatus | undefined, maxLines: number): string {\n const transcriptPath = status?.transcriptPath;\n if (!transcriptPath) {\n return status\n ? 'This run has no transcript. Artifacts were disabled for it (artifacts: false), so nothing was recorded.'\n : 'No status found for this run, so there is no transcript to read.';\n }\n\n const transcript = readFleetTranscript(transcriptPath);\n if (transcript.warning) {\n return `Transcript at '${transcriptPath}' could not be read: ${transcript.warning}`;\n }\n if (transcript.events.length === 0) {\n return `Transcript at '${transcriptPath}' is empty. The run has not written anything yet.`;\n }\n\n const rendered = transcript.events.flatMap((event) => formatEvent(event).split('\\n'));\n const kept = rendered.slice(-maxLines);\n const dropped = rendered.length - kept.length;\n const header =\n dropped > 0\n ? `Last ${kept.length} of ${rendered.length} transcript lines (${dropped} earlier line(s) not shown):`\n : `Transcript (${kept.length} line(s)):`;\n return [header, '', ...kept].join('\\n');\n}\n"],"mappings":"oIA2CA,SAAS,EAAI,EAAsB,EAAqB,CACtD,OAAO,EAAI,UAAYA,EAAAA,eAAe,KAAK,IAAI,EAAG,EAAM,EAAI,UAAU,CAAC,CAAG,UAS5E,SAAgB,EACd,EACA,EAAc,KAAK,KAAK,CACxB,EAA4B,EAAE,CACtB,CACR,GAAI,EAAK,SAAW,GAAK,EAAU,SAAW,EAC5C,MAAO,mGAGT,IAAM,EAAQ,CAAC,GAAG,EAAK,OAAO,aAAa,EAAK,SAAW,EAAI,GAAK,IAAI,GAAG,CAC3E,IAAK,IAAM,KAAO,EAAM,CACtB,IAAM,EAAQ,CAAC,KAAK,EAAI,QAAS,EAAI,QAAU,WAAY,EAA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,EAAM,OAWlC,SAAgB,EAAoB,EAAoC,EAA0B,CAChG,IAAM,EAAiB,GAAQ,eAC/B,GAAI,CAAC,EACH,OAAO,EACH,0GACA,mEAGN,IAAM,EAAaC,EAAAA,oBAAoB,EAAe,CACtD,GAAI,EAAW,QACb,MAAO,kBAAkB,EAAe,uBAAuB,EAAW,UAE5E,GAAI,EAAW,OAAO,SAAW,EAC/B,MAAO,kBAAkB,EAAe,mDAG1C,IAAM,EAAW,EAAW,OAAO,QAAS,GAAU,EAAY,EAAM,CAAC,MAAM;EAAK,CAAC,CAC/E,EAAO,EAAS,MAAM,CAAC,EAAS,CAChC,EAAU,EAAS,OAAS,EAAK,OAKvC,MAAO,CAHL,EAAU,EACN,QAAQ,EAAK,OAAO,MAAM,EAAS,OAAO,qBAAqB,EAAQ,8BACvE,eAAe,EAAK,OAAO,YACjB,GAAI,GAAG,EAAK,CAAC,KAAK;EAAK"}
1
+ {"version":3,"file":"statusViews.cjs","names":["formatDuration","isSuspendedRunResumable","readFleetTranscript"],"sources":["../../src/extensions/statusViews.ts"],"sourcesContent":["/**\n * Plain-text renderings of `action: 'status'`'s optional `view` modes, for the\n * MODEL rather than for a terminal.\n *\n * WHY THIS IS NOT `tui/fleet.ts` OR `renderFleetTranscript`:\n * Those exist, they are correct, and they are wired to the `/fleet` slash\n * command - but every one of them takes a `Theme` and emits ANSI escapes,\n * because their reader is a human looking at a TUI overlay. A tool result is\n * read by a model, where escape sequences are noise it pays tokens for and\n * cannot act on. So this module reuses the transcript READER\n * (`readFleetTranscript`, which is pure parsing) and does its own formatting,\n * rather than reusing a renderer whose whole job is the part that does not\n * transfer.\n *\n * WHY THESE VIEWS ARE WIRED AT ALL RATHER THAN DELETED FROM THE DESCRIPTION:\n * `view: 'fleet'` and `view: 'transcript'` were already documented on the\n * `subagent` tool, and neither worked - `status` read `id` first and threw\n * before ever looking at `view`, so the documented `{action:'status',\n * view:'fleet'}` call could not succeed at all. Between deleting the promise\n * and honouring it, honouring it is worth more: reading a running child's\n * output is the one coordinator capability the sibling implementation has\n * (`task_output`) that this package otherwise lacks, and the pieces to build\n * it were already here.\n *\n * DELIBERATELY NOT SUPPORTED: `index`.\n * A chain or fan-out child is its own run with its own id, not an index into\n * this run's transcript, and nothing in this package maps \"child N of run X\"\n * to a run id (see `asyncExecution.ts`'s CHILD INDEX section - the index is\n * an input the caller already knows, never something resolved back). Accepting\n * `index` here and ignoring it would be the same false affordance this whole\n * pass exists to remove, so `status` does not document it; `steer` and\n * `append-step`, which really do use it, still do.\n */\n\nimport type { AsyncRunStatus } from '../services/runs/background/asyncExecution.ts';\nimport type { TrackedAsyncJob } from '../services/runs/background/asyncJobTracker.ts';\nimport { isSuspendedRunResumable, type SuspendedRun } from '../services/runs/registry/suspendedRuns.ts';\nimport { formatDuration } from '../shared/formatters.ts';\nimport { type FleetTranscriptEvent, readFleetTranscript } from '../tui/fleetTranscript.ts';\n\n/** Default transcript tail length. Matches the value the tool description has always advertised. */\nexport const DEFAULT_TRANSCRIPT_LINES = 80;\n\nfunction age(job: TrackedAsyncJob, now: number): string {\n return job.startedAt ? formatDuration(Math.max(0, now - job.startedAt)) : 'unknown';\n}\n\n/**\n * The active-fleet overview: every run this session is tracking, one per line.\n *\n * Takes `now` rather than calling `Date.now()` so a test asserting rendered\n * ages does not have to freeze global time.\n */\nexport function formatFleetView(\n jobs: TrackedAsyncJob[],\n now: number = Date.now(),\n suspended: SuspendedRun[] = [],\n): string {\n if (jobs.length === 0 && suspended.length === 0) {\n return 'No runs tracked in this session. A run appears here once it has been launched from this session.';\n }\n\n const lines = [`${jobs.length} active run${jobs.length === 1 ? '' : 's'}:`];\n for (const job of jobs) {\n const parts = [`- ${job.runId}`, job.status ?? 'starting', age(job, now)];\n if (job.activityState) parts.push(job.activityState);\n if (job.attentionReason) parts.push(job.attentionReason);\n if (job.error) parts.push(`error: ${job.error}`);\n lines.push(parts.join(' · '));\n }\n if (suspended.length > 0) {\n lines.push('', `${suspended.length} suspended run${suspended.length === 1 ? '' : 's'}:`);\n for (const run of suspended) {\n const recovery = isSuspendedRunResumable(run)\n ? `restore with { action: \"restore\", id: \"${run.runId}\" }`\n : 'not resumable; submit a new explicit run';\n lines.push(`- ${run.runId} (${run.agent}, ${run.runtime}): ${recovery}`);\n }\n }\n if (jobs.length > 0) {\n lines.push('');\n lines.push(`Inspect one with { action: \"status\", id: \"<run id>\", transcriptLines: ${DEFAULT_TRANSCRIPT_LINES} }.`);\n }\n return lines.join('\\n');\n}\n\n/** Tool output shown to the model, bounded so one long result cannot crowd out the rest of the tail. */\nconst TOOL_RESULT_PREVIEW_LINES = 5;\n\nfunction formatEvent(event: FleetTranscriptEvent): string {\n if (event.kind === 'tool') {\n const status = event.status === 'running' ? '…' : event.status === 'error' ? 'error' : 'ok';\n const args = event.args ? JSON.stringify(event.args) : event.text;\n const header = `[tool ${status}] ${event.name ?? 'tool'}${args ? ` ${args}` : ''}`;\n const result = event.result?.trimEnd();\n if (!result) return header;\n // The result is the half the model most needs: it is what the call\n // actually learned, and it used to be dropped entirely.\n const body = result.split('\\n');\n const shown = body.slice(0, TOOL_RESULT_PREVIEW_LINES);\n const hidden = body.length - shown.length;\n return [header, ...shown.map((line) => ` ${line}`), hidden > 0 ? ` … +${hidden} lines` : undefined]\n .filter((line): line is string => line !== undefined)\n .join('\\n');\n }\n return `[${event.kind}] ${event.text}`;\n}\n\n/**\n * A run's transcript tail.\n *\n * Bounded from the END, not the start: a caller asking for 80 lines of a\n * long-running child wants the most recent 80, not the first 80 of its\n * startup. When the window drops anything, the fact that it did is stated,\n * so a reader never mistakes a tail for the whole run.\n */\nexport function formatRunTranscript(status: AsyncRunStatus | undefined, maxLines: number): string {\n const transcriptPath = status?.transcriptPath;\n if (!transcriptPath) {\n return status\n ? 'This run has no transcript. Artifacts were disabled for it (artifacts: false), so nothing was recorded.'\n : 'No status found for this run, so there is no transcript to read.';\n }\n\n const transcript = readFleetTranscript(transcriptPath);\n if (transcript.warning) {\n return `Transcript at '${transcriptPath}' could not be read: ${transcript.warning}`;\n }\n if (transcript.events.length === 0) {\n return `Transcript at '${transcriptPath}' is empty. The run has not written anything yet.`;\n }\n\n const rendered = transcript.events.flatMap((event) => formatEvent(event).split('\\n'));\n const kept = rendered.slice(-maxLines);\n const dropped = rendered.length - kept.length;\n const header =\n dropped > 0\n ? `Last ${kept.length} of ${rendered.length} transcript lines (${dropped} earlier line(s) not shown):`\n : `Transcript (${kept.length} line(s)):`;\n return [header, '', ...kept].join('\\n');\n}\n"],"mappings":"4LA2CA,SAAS,EAAI,EAAsB,EAAqB,CACtD,OAAO,EAAI,UAAYA,EAAAA,eAAe,KAAK,IAAI,EAAG,EAAM,EAAI,UAAU,CAAC,CAAG,UAS5E,SAAgB,EACd,EACA,EAAc,KAAK,KAAK,CACxB,EAA4B,EAAE,CACtB,CACR,GAAI,EAAK,SAAW,GAAK,EAAU,SAAW,EAC5C,MAAO,mGAGT,IAAM,EAAQ,CAAC,GAAG,EAAK,OAAO,aAAa,EAAK,SAAW,EAAI,GAAK,IAAI,GAAG,CAC3E,IAAK,IAAM,KAAO,EAAM,CACtB,IAAM,EAAQ,CAAC,KAAK,EAAI,QAAS,EAAI,QAAU,WAAY,EAAI,EAAK,EAAI,CAAC,CACrE,EAAI,eAAe,EAAM,KAAK,EAAI,cAAc,CAChD,EAAI,iBAAiB,EAAM,KAAK,EAAI,gBAAgB,CACpD,EAAI,OAAO,EAAM,KAAK,UAAU,EAAI,QAAQ,CAChD,EAAM,KAAK,EAAM,KAAK,MAAM,CAAC,CAE/B,GAAI,EAAU,OAAS,EAAG,CACxB,EAAM,KAAK,GAAI,GAAG,EAAU,OAAO,gBAAgB,EAAU,SAAW,EAAI,GAAK,IAAI,GAAG,CACxF,IAAK,IAAM,KAAO,EAAW,CAC3B,IAAM,EAAWC,EAAAA,wBAAwB,EAAI,CACzC,0CAA0C,EAAI,MAAM,KACpD,2CACJ,EAAM,KAAK,KAAK,EAAI,MAAM,IAAI,EAAI,MAAM,IAAI,EAAI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qB,EAAQ,8BACvE,eAAe,EAAK,OAAO,YACjB,GAAI,GAAG,EAAK,CAAC,KAAK;EAAK"}
@@ -1,7 +1,7 @@
1
- import{__esmMin as e}from"../_virtual/_rolldown/runtime.mjs";import{init_suspendedRuns as t,isSuspendedRunResumable as n}from"../runs/registry/suspendedRuns.mjs";import{formatDuration as r,init_formatters as i}from"../shared/formatters.mjs";import{init_fleetTranscript as a,readFleetTranscript as o}from"../tui/fleetTranscript.mjs";function s(e,t){return e.startedAt?r(Math.max(0,t-e.startedAt)):`unknown`}function c(e,t=Date.now(),r=[]){if(e.length===0&&r.length===0)return`No runs tracked in this session. A run appears here once it has been launched from this session.`;let i=[`${e.length} active run${e.length===1?``:`s`}:`];for(let n of e){let e=[`- ${n.runId}`,n.status??`starting`,s(n,t)];n.activityState&&e.push(n.activityState),n.attentionReason&&e.push(n.attentionReason),n.error&&e.push(`error: ${n.error}`),i.push(e.join(` · `))}if(r.length>0){i.push(``,`${r.length} suspended run${r.length===1?``:`s`}:`);for(let e of r){let t=n(e)?`restore with { action: "restore", id: "${e.runId}" }`:`not resumable; submit a new explicit run`;i.push(`- ${e.runId} (${e.agent}, ${e.runtime}): ${t}`)}}return e.length>0&&(i.push(``),i.push(`Inspect one with { action: "status", id: "<run id>", transcriptLines: 80 }.`)),i.join(`
1
+ import{__esmMin as e}from"../_virtual/_rolldown/runtime.mjs";import{isSuspendedRunResumable as t}from"../adapters/suspendedRuns.mjs";import{init_suspendedRuns as n}from"../services/runs/registry/suspendedRuns.mjs";import{formatDuration as r,init_formatters as i}from"../shared/formatters.mjs";import{init_fleetTranscript as a,readFleetTranscript as o}from"../tui/fleetTranscript.mjs";function s(e,t){return e.startedAt?r(Math.max(0,t-e.startedAt)):`unknown`}function c(e,n=Date.now(),r=[]){if(e.length===0&&r.length===0)return`No runs tracked in this session. A run appears here once it has been launched from this session.`;let i=[`${e.length} active run${e.length===1?``:`s`}:`];for(let t of e){let e=[`- ${t.runId}`,t.status??`starting`,s(t,n)];t.activityState&&e.push(t.activityState),t.attentionReason&&e.push(t.attentionReason),t.error&&e.push(`error: ${t.error}`),i.push(e.join(` · `))}if(r.length>0){i.push(``,`${r.length} suspended run${r.length===1?``:`s`}:`);for(let e of r){let n=t(e)?`restore with { action: "restore", id: "${e.runId}" }`:`not resumable; submit a new explicit run`;i.push(`- ${e.runId} (${e.agent}, ${e.runtime}): ${n}`)}}return e.length>0&&(i.push(``),i.push(`Inspect one with { action: "status", id: "<run id>", transcriptLines: 80 }.`)),i.join(`
2
2
  `)}function l(e){if(e.kind===`tool`){let t=e.status===`running`?`…`:e.status===`error`?`error`:`ok`,n=e.args?JSON.stringify(e.args):e.text,r=`[tool ${t}] ${e.name??`tool`}${n?` ${n}`:``}`,i=e.result?.trimEnd();if(!i)return r;let a=i.split(`
3
3
  `),o=a.slice(0,d),s=a.length-o.length;return[r,...o.map(e=>` ${e}`),s>0?` … +${s} lines`:void 0].filter(e=>e!==void 0).join(`
4
4
  `)}return`[${e.kind}] ${e.text}`}function u(e,t){let n=e?.transcriptPath;if(!n)return e?`This run has no transcript. Artifacts were disabled for it (artifacts: false), so nothing was recorded.`:`No status found for this run, so there is no transcript to read.`;let r=o(n);if(r.warning)return`Transcript at '${n}' could not be read: ${r.warning}`;if(r.events.length===0)return`Transcript at '${n}' is empty. The run has not written anything yet.`;let i=r.events.flatMap(e=>l(e).split(`
5
5
  `)),a=i.slice(-t),s=i.length-a.length;return[s>0?`Last ${a.length} of ${i.length} transcript lines (${s} earlier line(s) not shown):`:`Transcript (${a.length} line(s)):`,``,...a].join(`
6
- `)}var d,f=e((()=>{t(),a(),i(),d=5}));f();export{c as formatFleetView,u as formatRunTranscript,f as init_statusViews};
6
+ `)}var d,f=e((()=>{n(),i(),a(),d=5}));f();export{c as formatFleetView,u as formatRunTranscript,f as init_statusViews};
7
7
  //# sourceMappingURL=statusViews.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"statusViews.mjs","names":[],"sources":["../../src/extensions/statusViews.ts"],"sourcesContent":["/**\n * Plain-text renderings of `action: 'status'`'s optional `view` modes, for the\n * MODEL rather than for a terminal.\n *\n * WHY THIS IS NOT `tui/fleet.ts` OR `renderFleetTranscript`:\n * Those exist, they are correct, and they are wired to the `/fleet` slash\n * command - but every one of them takes a `Theme` and emits ANSI escapes,\n * because their reader is a human looking at a TUI overlay. A tool result is\n * read by a model, where escape sequences are noise it pays tokens for and\n * cannot act on. So this module reuses the transcript READER\n * (`readFleetTranscript`, which is pure parsing) and does its own formatting,\n * rather than reusing a renderer whose whole job is the part that does not\n * transfer.\n *\n * WHY THESE VIEWS ARE WIRED AT ALL RATHER THAN DELETED FROM THE DESCRIPTION:\n * `view: 'fleet'` and `view: 'transcript'` were already documented on the\n * `subagent` tool, and neither worked - `status` read `id` first and threw\n * before ever looking at `view`, so the documented `{action:'status',\n * view:'fleet'}` call could not succeed at all. Between deleting the promise\n * and honouring it, honouring it is worth more: reading a running child's\n * output is the one coordinator capability the sibling implementation has\n * (`task_output`) that this package otherwise lacks, and the pieces to build\n * it were already here.\n *\n * DELIBERATELY NOT SUPPORTED: `index`.\n * A chain or fan-out child is its own run with its own id, not an index into\n * this run's transcript, and nothing in this package maps \"child N of run X\"\n * to a run id (see `asyncExecution.ts`'s CHILD INDEX section - the index is\n * an input the caller already knows, never something resolved back). Accepting\n * `index` here and ignoring it would be the same false affordance this whole\n * pass exists to remove, so `status` does not document it; `steer` and\n * `append-step`, which really do use it, still do.\n */\n\nimport type { TrackedAsyncJob } from '../runs/background/asyncJobTracker.ts';\nimport type { AsyncRunStatus } from '../runs/background/asyncExecution.ts';\nimport { isSuspendedRunResumable, type SuspendedRun } from '../runs/registry/suspendedRuns.ts';\nimport { readFleetTranscript, type FleetTranscriptEvent } from '../tui/fleetTranscript.ts';\nimport { formatDuration } from '../shared/formatters.ts';\n\n/** Default transcript tail length. Matches the value the tool description has always advertised. */\nexport const DEFAULT_TRANSCRIPT_LINES = 80;\n\nfunction age(job: TrackedAsyncJob, now: number): string {\n return job.startedAt ? formatDuration(Math.max(0, now - job.startedAt)) : 'unknown';\n}\n\n/**\n * The active-fleet overview: every run this session is tracking, one per line.\n *\n * Takes `now` rather than calling `Date.now()` so a test asserting rendered\n * ages does not have to freeze global time.\n */\nexport function formatFleetView(\n jobs: TrackedAsyncJob[],\n now: number = Date.now(),\n suspended: SuspendedRun[] = [],\n): string {\n if (jobs.length === 0 && suspended.length === 0) {\n return 'No runs tracked in this session. A run appears here once it has been launched from this session.';\n }\n\n const lines = [`${jobs.length} active run${jobs.length === 1 ? '' : 's'}:`];\n for (const job of jobs) {\n const parts = [`- ${job.runId}`, job.status ?? 'starting', age(job, now)];\n if (job.activityState) parts.push(job.activityState);\n if (job.attentionReason) parts.push(job.attentionReason);\n if (job.error) parts.push(`error: ${job.error}`);\n lines.push(parts.join(' · '));\n }\n if (suspended.length > 0) {\n lines.push('', `${suspended.length} suspended run${suspended.length === 1 ? '' : 's'}:`);\n for (const run of suspended) {\n const recovery = isSuspendedRunResumable(run)\n ? `restore with { action: \"restore\", id: \"${run.runId}\" }`\n : 'not resumable; submit a new explicit run';\n lines.push(`- ${run.runId} (${run.agent}, ${run.runtime}): ${recovery}`);\n }\n }\n if (jobs.length > 0) {\n lines.push('');\n lines.push(`Inspect one with { action: \"status\", id: \"<run id>\", transcriptLines: ${DEFAULT_TRANSCRIPT_LINES} }.`);\n }\n return lines.join('\\n');\n}\n\n/** Tool output shown to the model, bounded so one long result cannot crowd out the rest of the tail. */\nconst TOOL_RESULT_PREVIEW_LINES = 5;\n\nfunction formatEvent(event: FleetTranscriptEvent): string {\n if (event.kind === 'tool') {\n const status = event.status === 'running' ? '…' : event.status === 'error' ? 'error' : 'ok';\n const args = event.args ? JSON.stringify(event.args) : event.text;\n const header = `[tool ${status}] ${event.name ?? 'tool'}${args ? ` ${args}` : ''}`;\n const result = event.result?.trimEnd();\n if (!result) return header;\n // The result is the half the model most needs: it is what the call\n // actually learned, and it used to be dropped entirely.\n const body = result.split('\\n');\n const shown = body.slice(0, TOOL_RESULT_PREVIEW_LINES);\n const hidden = body.length - shown.length;\n return [header, ...shown.map((line) => ` ${line}`), hidden > 0 ? ` … +${hidden} lines` : undefined]\n .filter((line): line is string => line !== undefined)\n .join('\\n');\n }\n return `[${event.kind}] ${event.text}`;\n}\n\n/**\n * A run's transcript tail.\n *\n * Bounded from the END, not the start: a caller asking for 80 lines of a\n * long-running child wants the most recent 80, not the first 80 of its\n * startup. When the window drops anything, the fact that it did is stated,\n * so a reader never mistakes a tail for the whole run.\n */\nexport function formatRunTranscript(status: AsyncRunStatus | undefined, maxLines: number): string {\n const transcriptPath = status?.transcriptPath;\n if (!transcriptPath) {\n return status\n ? 'This run has no transcript. Artifacts were disabled for it (artifacts: false), so nothing was recorded.'\n : 'No status found for this run, so there is no transcript to read.';\n }\n\n const transcript = readFleetTranscript(transcriptPath);\n if (transcript.warning) {\n return `Transcript at '${transcriptPath}' could not be read: ${transcript.warning}`;\n }\n if (transcript.events.length === 0) {\n return `Transcript at '${transcriptPath}' is empty. The run has not written anything yet.`;\n }\n\n const rendered = transcript.events.flatMap((event) => formatEvent(event).split('\\n'));\n const kept = rendered.slice(-maxLines);\n const dropped = rendered.length - kept.length;\n const header =\n dropped > 0\n ? `Last ${kept.length} of ${rendered.length} transcript lines (${dropped} earlier line(s) not shown):`\n : `Transcript (${kept.length} line(s)):`;\n return [header, '', ...kept].join('\\n');\n}\n"],"mappings":"4UA2CA,SAAS,EAAI,EAAsB,EAAqB,CACtD,OAAO,EAAI,UAAY,EAAe,KAAK,IAAI,EAAG,EAAM,EAAI,UAAU,CAAC,CAAG,UAS5E,SAAgB,EACd,EACA,EAAc,KAAK,KAAK,CACxB,EAA4B,EAAE,CACtB,CACR,GAAI,EAAK,SAAW,GAAK,EAAU,SAAW,EAC5C,MAAO,mGAGT,IAAM,EAAQ,CAAC,GAAG,EAAK,OAAO,aAAa,EAAK,SAAW,EAAI,GAAK,IAAI,GAAG,CAC3E,IAAK,IAAM,KAAO,EAAM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AU,CACpD,KAAK;EAAK,CAEf,MAAO,IAAI,EAAM,KAAK,IAAI,EAAM,OAWlC,SAAgB,EAAoB,EAAoC,EAA0B,CAChG,IAAM,EAAiB,GAAQ,eAC/B,GAAI,CAAC,EACH,OAAO,EACH,0GACA,mEAGN,IAAM,EAAa,EAAoB,EAAe,CACtD,GAAI,EAAW,QACb,MAAO,kBAAkB,EAAe,uBAAuB,EAAW,UAE5E,GAAI,EAAW,OAAO,SAAW,EAC/B,MAAO,kBAAkB,EAAe,mDAG1C,IAAM,EAAW,EAAW,OAAO,QAAS,GAAU,EAAY,EAAM,CAAC,MAAM;EAAK,CAAC,CAC/E,EAAO,EAAS,MAAM,CAAC,EAAS,CAChC,EAAU,EAAS,OAAS,EAAK,OAKvC,MAAO,CAHL,EAAU,EACN,QAAQ,EAAK,OAAO,MAAM,EAAS,OAAO,qBAAqB,EAAQ,8BACvE,eAAe,EAAK,OAAO,YACjB,GAAI,GAAG,EAAK,CAAC,KAAK;EAAK,oBAvGsD,IACJ,IAClC,CAiDnD,EAA4B"}
1
+ {"version":3,"file":"statusViews.mjs","names":[],"sources":["../../src/extensions/statusViews.ts"],"sourcesContent":["/**\n * Plain-text renderings of `action: 'status'`'s optional `view` modes, for the\n * MODEL rather than for a terminal.\n *\n * WHY THIS IS NOT `tui/fleet.ts` OR `renderFleetTranscript`:\n * Those exist, they are correct, and they are wired to the `/fleet` slash\n * command - but every one of them takes a `Theme` and emits ANSI escapes,\n * because their reader is a human looking at a TUI overlay. A tool result is\n * read by a model, where escape sequences are noise it pays tokens for and\n * cannot act on. So this module reuses the transcript READER\n * (`readFleetTranscript`, which is pure parsing) and does its own formatting,\n * rather than reusing a renderer whose whole job is the part that does not\n * transfer.\n *\n * WHY THESE VIEWS ARE WIRED AT ALL RATHER THAN DELETED FROM THE DESCRIPTION:\n * `view: 'fleet'` and `view: 'transcript'` were already documented on the\n * `subagent` tool, and neither worked - `status` read `id` first and threw\n * before ever looking at `view`, so the documented `{action:'status',\n * view:'fleet'}` call could not succeed at all. Between deleting the promise\n * and honouring it, honouring it is worth more: reading a running child's\n * output is the one coordinator capability the sibling implementation has\n * (`task_output`) that this package otherwise lacks, and the pieces to build\n * it were already here.\n *\n * DELIBERATELY NOT SUPPORTED: `index`.\n * A chain or fan-out child is its own run with its own id, not an index into\n * this run's transcript, and nothing in this package maps \"child N of run X\"\n * to a run id (see `asyncExecution.ts`'s CHILD INDEX section - the index is\n * an input the caller already knows, never something resolved back). Accepting\n * `index` here and ignoring it would be the same false affordance this whole\n * pass exists to remove, so `status` does not document it; `steer` and\n * `append-step`, which really do use it, still do.\n */\n\nimport type { AsyncRunStatus } from '../services/runs/background/asyncExecution.ts';\nimport type { TrackedAsyncJob } from '../services/runs/background/asyncJobTracker.ts';\nimport { isSuspendedRunResumable, type SuspendedRun } from '../services/runs/registry/suspendedRuns.ts';\nimport { formatDuration } from '../shared/formatters.ts';\nimport { type FleetTranscriptEvent, readFleetTranscript } from '../tui/fleetTranscript.ts';\n\n/** Default transcript tail length. Matches the value the tool description has always advertised. */\nexport const DEFAULT_TRANSCRIPT_LINES = 80;\n\nfunction age(job: TrackedAsyncJob, now: number): string {\n return job.startedAt ? formatDuration(Math.max(0, now - job.startedAt)) : 'unknown';\n}\n\n/**\n * The active-fleet overview: every run this session is tracking, one per line.\n *\n * Takes `now` rather than calling `Date.now()` so a test asserting rendered\n * ages does not have to freeze global time.\n */\nexport function formatFleetView(\n jobs: TrackedAsyncJob[],\n now: number = Date.now(),\n suspended: SuspendedRun[] = [],\n): string {\n if (jobs.length === 0 && suspended.length === 0) {\n return 'No runs tracked in this session. A run appears here once it has been launched from this session.';\n }\n\n const lines = [`${jobs.length} active run${jobs.length === 1 ? '' : 's'}:`];\n for (const job of jobs) {\n const parts = [`- ${job.runId}`, job.status ?? 'starting', age(job, now)];\n if (job.activityState) parts.push(job.activityState);\n if (job.attentionReason) parts.push(job.attentionReason);\n if (job.error) parts.push(`error: ${job.error}`);\n lines.push(parts.join(' · '));\n }\n if (suspended.length > 0) {\n lines.push('', `${suspended.length} suspended run${suspended.length === 1 ? '' : 's'}:`);\n for (const run of suspended) {\n const recovery = isSuspendedRunResumable(run)\n ? `restore with { action: \"restore\", id: \"${run.runId}\" }`\n : 'not resumable; submit a new explicit run';\n lines.push(`- ${run.runId} (${run.agent}, ${run.runtime}): ${recovery}`);\n }\n }\n if (jobs.length > 0) {\n lines.push('');\n lines.push(`Inspect one with { action: \"status\", id: \"<run id>\", transcriptLines: ${DEFAULT_TRANSCRIPT_LINES} }.`);\n }\n return lines.join('\\n');\n}\n\n/** Tool output shown to the model, bounded so one long result cannot crowd out the rest of the tail. */\nconst TOOL_RESULT_PREVIEW_LINES = 5;\n\nfunction formatEvent(event: FleetTranscriptEvent): string {\n if (event.kind === 'tool') {\n const status = event.status === 'running' ? '…' : event.status === 'error' ? 'error' : 'ok';\n const args = event.args ? JSON.stringify(event.args) : event.text;\n const header = `[tool ${status}] ${event.name ?? 'tool'}${args ? ` ${args}` : ''}`;\n const result = event.result?.trimEnd();\n if (!result) return header;\n // The result is the half the model most needs: it is what the call\n // actually learned, and it used to be dropped entirely.\n const body = result.split('\\n');\n const shown = body.slice(0, TOOL_RESULT_PREVIEW_LINES);\n const hidden = body.length - shown.length;\n return [header, ...shown.map((line) => ` ${line}`), hidden > 0 ? ` … +${hidden} lines` : undefined]\n .filter((line): line is string => line !== undefined)\n .join('\\n');\n }\n return `[${event.kind}] ${event.text}`;\n}\n\n/**\n * A run's transcript tail.\n *\n * Bounded from the END, not the start: a caller asking for 80 lines of a\n * long-running child wants the most recent 80, not the first 80 of its\n * startup. When the window drops anything, the fact that it did is stated,\n * so a reader never mistakes a tail for the whole run.\n */\nexport function formatRunTranscript(status: AsyncRunStatus | undefined, maxLines: number): string {\n const transcriptPath = status?.transcriptPath;\n if (!transcriptPath) {\n return status\n ? 'This run has no transcript. Artifacts were disabled for it (artifacts: false), so nothing was recorded.'\n : 'No status found for this run, so there is no transcript to read.';\n }\n\n const transcript = readFleetTranscript(transcriptPath);\n if (transcript.warning) {\n return `Transcript at '${transcriptPath}' could not be read: ${transcript.warning}`;\n }\n if (transcript.events.length === 0) {\n return `Transcript at '${transcriptPath}' is empty. The run has not written anything yet.`;\n }\n\n const rendered = transcript.events.flatMap((event) => formatEvent(event).split('\\n'));\n const kept = rendered.slice(-maxLines);\n const dropped = rendered.length - kept.length;\n const header =\n dropped > 0\n ? `Last ${kept.length} of ${rendered.length} transcript lines (${dropped} earlier line(s) not shown):`\n : `Transcript (${kept.length} line(s)):`;\n return [header, '', ...kept].join('\\n');\n}\n"],"mappings":"gYA2CA,SAAS,EAAI,EAAsB,EAAqB,CACtD,OAAO,EAAI,UAAY,EAAe,KAAK,IAAI,EAAG,EAAM,EAAI,UAAU,CAAC,CAAG,UAS5E,SAAgB,EACd,EACA,EAAc,KAAK,KAAK,CACxB,EAA4B,EAAE,CACtB,CACR,GAAI,EAAK,SAAW,GAAK,EAAU,SAAW,EAC5C,MAAO,mGAGT,IAAM,EAAQ,CAAC,GAAG,EAAK,OAAO,aAAa,EAAK,SAAW,EAAI,GAAK,IAAI,GAAG,CAC3E,IAAK,IAAM,KAAO,EAAM,CACtB,IAAM,EAAQ,CAAC,KAAK,EAAI,QAAS,EAAI,QAAU,WAAY,EAAI,EAAK,EAAI,CAAC,CACrE,EAAI,eAAe,EAAM,KAAK,EAAI,cAAc,CAChD,EAAI,iBAAiB,EAAM,KAAK,EAAI,gBAAgB,CACpD,EAAI,OAAO,EAAM,KAAK,UAAU,EAAI,QAAQ,CAChD,EAAM,KAAK,EAAM,KAAK,MAAM,CAAC,CAE/B,GAAI,EAAU,OAAS,EAAG,CACxB,EAAM,KAAK,GAAI,GAAG,EAAU,OAAO,gBAAgB,EAAU,SAAW,EAAI,GAAK,IAAI,GAAG,CACxF,IAAK,IAAM,KAAO,EAAW,CAC3B,IAAM,EAAW,EAAwB,EAAI,CACzC,0CAA0C,EAAI,MAAM,KACpD,2CACJ,EAAM,KAAK,KAAK,EAAI,M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,MAAM,EAAS,OAAO,qBAAqB,EAAQ,8BACvE,eAAe,EAAK,OAAO,YACjB,GAAI,GAAG,EAAK,CAAC,KAAK;EAAK,oBAvG+D,IAC/C,IACkC,CAiDrF,EAA4B"}
@@ -1,19 +1,19 @@
1
- const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../shared/configDir.cjs`),n=require(`../env.cjs`),r=require(`../container/types.cjs`),i=require(`../intercom/supervisorControlChannel.cjs`),a=require(`../shared/paths.cjs`),o=require(`../intercom/nativeTeamChannel.cjs`),s=require(`../runs/shared/toolBudget.cjs`),c=require(`../container/index.cjs`),l=require(`../shared/childTranscript.cjs`),u=require(`../runs/shared/structuredOutput.cjs`),d=require(`../runs/shared/toolAvailability.cjs`);let f=require(`node:fs`);f=e.__toESM(f,1);let p=require(`node:path`);p=e.__toESM(p,1);function m(){return{steerNudgeFailures:0,watchErrors:0,watchCloseFailures:0}}const h=[`This subagent step has a strict structured output contract.`,"Your final action must be to call the `structured_output` tool with JSON matching the provided schema.","Do not rely on prose-only completion; if you do not call `structured_output`, the parent will fail this step."].join(`
2
- `),g=[`When the assigned task includes a parent context pack, treat it as the authoritative starting point.`,`That pack satisfies generic instructions to explore or understand repository context first.`,`Read its listed paths directly before broad discovery, and do not re-derive established facts unless direct evidence contradicts them.`,`Do not begin with repository-wide listing, find, or grep. Expand only after consuming the pack and naming a concrete missing dependency or invalid path; search narrowly for that item and state why.`].join(`
3
- `),_=[`You are a child subagent, not the parent orchestrator.`,`The parent session owns delegation, orchestration, review fanout, and follow-up worker launches.`,`Ignore prior parent-only orchestration instructions in inherited conversation history.`,`Do not propose or run subagents. Complete only your assigned role-specific task with the tools available to you.`,`If you need to edit files, use the available editing tools. Do not print tool-call syntax, patches, or pseudo-tool calls as text.`,g].join(`
4
- `),v=[`You are a child subagent with explicit fanout responsibility for this assigned task.`,`The parent session owns final orchestration, acceptance, and follow-up implementation launches.`,"You may use the `subagent` tool only for the fanout work explicitly requested in this task.",`Do not broaden yourself into general parent orchestration. Do not launch follow-up workers unless the task explicitly asks for that.`,`The maxSubagentDepth cap still applies and may block further fanout.`,`If you need to edit files, use the available editing tools. Do not print tool-call syntax, patches, or pseudo-tool calls as text.`,g].join(`
5
- `);function y(e,t,n){e.on.call(e,t,n)}function b(e){return typeof e==`object`&&!!e&&e.type===`text`&&typeof e.text==`string`}function x(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n?.role!==`assistant`||!Array.isArray(n.content))continue;let r=n.content.filter(b).map(e=>e.text).join(`
6
- `).trim();if(r)return r}return``}function S(e,t=c.createPromptRuntimeContainer()){let i=process.env[n.SUBAGENT_RUN_ID_ENV]?.trim();if(!i)return;let a=t.get(r.DOOM_TEAM_TYPES.PollScheduler),s=t.get(r.DOOM_TEAM_TYPES.RunnerBootstrap),u=t.get(r.DOOM_TEAM_TYPES.RunnerExecution),d=t.get(r.DOOM_TEAM_TYPES.RunnerReporting),f,p,m=0,h=new WeakSet;y(e,`session_start`,(t,n)=>{if(f)return;a.start();let r=n.sessionManager.getSessionFile(),c=r?d.recordSessionFile(r):void 0,l=s.bootstrap(i,c);l.teamContext&&Object.assign(process.env,o.nativeTeamMemberEnvironment(l.teamContext)),u.start(i,{onSteer:t=>{let n=e.sendUserMessage;if(!n){U(t,`failed`,`Child Pi session does not support sendUserMessage steering.`);return}try{n(H(t),{deliverAs:`steer`}),U(t,`delivered`,`Pi accepted the correlated steering input.`)}catch(e){throw U(t,`failed`,e instanceof Error?e.message:String(e)),e}}}),f={teamContext:l.teamContext},u.setActivity(`working`)}),y(e,`agent_start`,()=>{f&&u.setActivity(`working`)}),y(e,`message_end`,e=>{if(!f||!e.message||typeof e.message!=`object`||h.has(e.message))return;h.add(e.message);let t=l.getMessageUsageTokens(e.message);t!==void 0&&(p=(p??0)+t,u.setProgress({tokens:p}))}),y(e,`tool_execution_start`,e=>{if(!f)return;let t=e.toolName??e.tool?.name;m+=1,u.setProgress({toolCount:m,...typeof t==`string`&&t.length>0?{currentTool:t}:{}}),u.setActivity(t===`intercom`&&e.args?.action===`ask`?`waiting_for_reply`:`tool`)}),y(e,`tool_execution_end`,()=>{f&&u.setActivity(`working`)}),y(e,`agent_end`,e=>{if(!f)return;u.setActivity(`finalizing`);let t=x(e.messages);u.complete(!0,t)})}const C=new Set([`subagent-orchestration-instructions`,`subagent-slash-result`,`subagent-slash-text-result`,`subagent-notify`,`subagent_control_notice`,`subagent-control`,`subagent-control-notice`]),w=/<name>\s*pi-subagents\s*<\/name>/,T=`
1
+ const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../container/types.cjs`),n=require(`../shared/configDir.cjs`),r=require(`../adapters/process/env.cjs`),i=require(`../services/intercom/supervisorControlChannel.cjs`),a=require(`../shared/paths.cjs`),o=require(`../services/intercom/nativeTeamChannel.cjs`),s=require(`../services/runs/shared/toolBudget.cjs`),c=require(`../container/index.cjs`),l=require(`../services/runs/shared/structuredOutput.cjs`),u=require(`../services/runs/shared/toolAvailability.cjs`),d=require(`../adapters/process/childTranscript.cjs`);require(`../shared/childTranscript.cjs`);let f=require(`node:fs`);f=e.__toESM(f,1);let p=require(`node:path`);p=e.__toESM(p,1);let m=require(`@agimon-ai/doompi-extension-contracts/child-process`);const h=/\bkill(?:pg)?\b/i,g=/(?:^|[^\w.-])(?:pkill|killall|shutdown|reboot|poweroff|halt)(?=$|[^\w.-])/i,_=/\b(?:tmux|cmux)\b[\s\S]*\b(?:kill-server|kill-session|close|quit)\b/i,v=/\$(?:PPID|\{PPID\})|\bprocess\.ppid\b|\bgetppid\s*\(|\bppid\b/i,y=/\$\(|`|\$(?:\{[^}]+\}|[A-Za-z_][A-Za-z0-9_]*)/,b=/(?:^|[\s"'`])-1(?=$|[\s"'`;|&])/,x=`Blocked: subagents may use Bash, but cannot signal parent or workflow processes. Ask the parent to perform that process cleanup.`,S=new Set([`openai-responses`,`azure-openai-responses`,`openai-codex-responses`]);function C(e,t,n=process.env){if(typeof t!=`string`||!S.has(t))return;let r=n[m.SUBAGENT_ROOT_SESSION_ENV]?.trim();if(!r||typeof e!=`object`||!e||Array.isArray(e))return;let i=e,a=i.prompt_cache_key;if(!(typeof a!=`string`||!a.trim()))return{...i,prompt_cache_key:r}}function w(){return{steerNudgeFailures:0,watchErrors:0,watchCloseFailures:0}}const T=[`This subagent step has a strict structured output contract.`,"Your final action must be to call the `structured_output` tool with JSON matching the provided schema.","Do not rely on prose-only completion; if you do not call `structured_output`, the parent will fail this step."].join(`
2
+ `),E=[`When the assigned task includes a parent context pack, treat it as the authoritative starting point.`,`That pack satisfies generic instructions to explore or understand repository context first.`,`Read its listed paths directly before broad discovery, and do not re-derive established facts unless direct evidence contradicts them.`,`Do not begin with repository-wide listing, find, or grep. Expand only after consuming the pack and naming a concrete missing dependency or invalid path; search narrowly for that item and state why.`].join(`
3
+ `),D=[`You are a child subagent, not the parent orchestrator.`,`The parent session owns delegation, orchestration, review fanout, and follow-up worker launches.`,`Ignore prior parent-only orchestration instructions in inherited conversation history.`,`Do not propose or run subagents. Complete only your assigned role-specific task with the tools available to you.`,`If you need to edit files, use the available editing tools. Do not print tool-call syntax, patches, or pseudo-tool calls as text.`,E].join(`
4
+ `),O=[`You are a child subagent with explicit fanout responsibility for this assigned task.`,`The parent session owns final orchestration, acceptance, and follow-up implementation launches.`,"You may use the `subagent` tool only for the fanout work explicitly requested in this task.",`Do not broaden yourself into general parent orchestration. Do not launch follow-up workers unless the task explicitly asks for that.`,`The maxSubagentDepth cap still applies and may block further fanout.`,`If you need to edit files, use the available editing tools. Do not print tool-call syntax, patches, or pseudo-tool calls as text.`,E].join(`
5
+ `);function k(e,t,n){e.on.call(e,t,n)}function A(e,t){return RegExp(`(?:^|\\D)-?${t}(?!\\d)`).test(e)}function j(e,t){if(g.test(e)||_.test(e))return x;if(h.test(e))return v.test(e)||y.test(e)||b.test(e)||/\bxargs\s+(?:[^;&|\n]+\s+)?kill(?:pg)?\b/i.test(e)||t.some(t=>A(e,t))?x:void 0}function M(e,t={}){let n=[...new Set(t.protectedProcessIds??[...r.decodeProtectedParentProcessIds(process.env.PI_SUBAGENT_PROTECTED_PARENT_PIDS),process.pid,process.ppid])].filter(e=>Number.isSafeInteger(e)&&e>1);k(e,`tool_call`,e=>{if(e.toolName!==`bash`||!e.input||typeof e.input!=`object`)return;let t=e.input.command;if(typeof t!=`string`)return;let r=j(t,n);return r?{block:!0,reason:r}:void 0})}function N(e){return typeof e==`object`&&!!e&&e.type===`text`&&typeof e.text==`string`}function ee(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n?.role!==`assistant`||!Array.isArray(n.content))continue;let r=n.content.filter(N).map(e=>e.text).join(`
6
+ `).trim();if(r)return r}return``}function te(e,n=c.createPromptRuntimeContainer()){let i=process.env[r.SUBAGENT_RUN_ID_ENV]?.trim();if(!i)return;let a=n.get(t.DOOM_TEAM_TYPES.PollScheduler),s=n.get(t.DOOM_TEAM_TYPES.RunnerBootstrap),l=n.get(t.DOOM_TEAM_TYPES.RunnerExecution),u=n.get(t.DOOM_TEAM_TYPES.RunnerReporting),f,p,m=0,h=new WeakSet;k(e,`session_start`,(t,n)=>{if(f)return;a.start();let r=n.sessionManager.getSessionFile(),c=r?u.recordSessionFile(r):void 0,d=s.bootstrap(i,c);d.teamContext&&Object.assign(process.env,o.nativeTeamMemberEnvironment(d.teamContext)),l.start(i,{onSteer:t=>{let n=e.sendUserMessage;if(!n){$(t,`failed`,`Child Pi session does not support sendUserMessage steering.`);return}try{n(Q(t),{deliverAs:`steer`}),$(t,`delivered`,`Pi accepted the correlated steering input.`)}catch(e){throw $(t,`failed`,e instanceof Error?e.message:String(e)),e}}}),f={teamContext:d.teamContext},l.setActivity(`working`)}),k(e,`agent_start`,()=>{f&&l.setActivity(`working`)}),k(e,`message_update`,e=>{if(!f||!e.message)return;let t=d.getMessageActivity(e.message);t&&l.setProgress({currentTool:t})}),k(e,`message_end`,e=>{if(!f||!e.message||typeof e.message!=`object`||h.has(e.message))return;h.add(e.message);let t=d.getMessageUsageTokens(e.message);t!==void 0&&(p=(p??0)+t,l.setProgress({tokens:p}))}),k(e,`tool_execution_start`,e=>{if(!f)return;let t=e.toolName??e.tool?.name;m+=1,l.setProgress({toolCount:m,...typeof t==`string`&&t.length>0?{currentTool:d.formatToolActivity(t,e.args)}:{}}),l.setActivity(t===`intercom`&&e.args?.action===`ask`?`waiting_for_reply`:`tool`)}),k(e,`tool_execution_end`,()=>{f&&(l.setProgress({currentTool:`working`}),l.setActivity(`working`))}),k(e,`agent_end`,e=>{if(!f)return;l.setActivity(`finalizing`);let t=ee(e.messages);l.complete(!0,t)})}const P=new Set([`subagent-orchestration-instructions`,`subagent-slash-result`,`subagent-slash-text-result`,`subagent-notify`,`subagent_control_notice`,`subagent-control`,`subagent-control-notice`]),F=/<name>\s*pi-subagents\s*<\/name>/,I=`
7
7
 
8
- The following skills provide specialized instructions for specific tasks.`,E=`
9
- Current date:`;function D(e){let t=process.env[e];if(t!==void 0)return t!==`0`}function O(){let e=process.env[n.REQUIRED_CHILD_TOOLS_ENV]?.trim();if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t)||t.some(e=>typeof e!=`string`||!e))throw Error(`Invalid ${n.REQUIRED_CHILD_TOOLS_ENV} payload.`);return t}function k(){let e=process.env[n.MCP_DIRECT_CHILD_TOOLS_ENV]?.trim();if(e)try{let t=JSON.parse(e);return!Array.isArray(t)||t.some(e=>typeof e!=`string`||!e)?void 0:t}catch{return}}function A(e){let t=process.env[n.CHILD_TOOL_DIAGNOSTIC_PATH_ENV]?.trim(),r=O();if(!(!t||!r))return d.writeChildToolDiagnostic(t,r,e.getAllTools().map(e=>e.name),process.env[n.SUBAGENT_CHILD_AGENT_ENV]?.trim(),k())}function j(e,t,n){let r=e.length;for(let i of n){let n=e.indexOf(i,t);n!==-1&&n<r&&(r=n)}return r}function M(e){let t=e.indexOf(`
8
+ The following skills provide specialized instructions for specific tasks.`,L=`
9
+ Current date:`;function R(e){let t=process.env[e];if(t!==void 0)return t!==`0`}function z(){let e=process.env[r.REQUIRED_CHILD_TOOLS_ENV]?.trim();if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t)||t.some(e=>typeof e!=`string`||!e))throw Error(`Invalid ${r.REQUIRED_CHILD_TOOLS_ENV} payload.`);return t}function B(){let e=process.env[r.MCP_DIRECT_CHILD_TOOLS_ENV]?.trim();if(e)try{let t=JSON.parse(e);return!Array.isArray(t)||t.some(e=>typeof e!=`string`||!e)?void 0:t}catch{return}}function V(e){let t=process.env[r.CHILD_TOOL_DIAGNOSTIC_PATH_ENV]?.trim(),n=z();if(!(!t||!n))return u.writeChildToolDiagnostic(t,n,e.getAllTools().map(e=>e.name),process.env[r.SUBAGENT_CHILD_AGENT_ENV]?.trim(),B())}function H(e,t,n){let r=e.length;for(let i of n){let n=e.indexOf(i,t);n!==-1&&n<r&&(r=n)}return r}function U(e){let t=e.indexOf(`
10
10
 
11
11
  # Project Context
12
12
 
13
13
  Project-specific instructions and guidelines:
14
14
 
15
- `);if(t===-1)return e;let n=j(e,t+68,[T,E]);return`${e.slice(0,t)}${e.slice(n)}`}function N(e){let t=e.indexOf(T);if(t===-1)return e;let n=j(e,t+75,[E]);return`${e.slice(0,t)}${e.slice(n)}`}function P(e){return e.replace(/\n{0,2}<skill\s+name=["']pi-subagents["'][^>]*>[\s\S]*?<\/skill>\n{0,2}/g,`
15
+ `);if(t===-1)return e;let n=H(e,t+68,[I,L]);return`${e.slice(0,t)}${e.slice(n)}`}function W(e){let t=e.indexOf(I);if(t===-1)return e;let n=H(e,t+75,[L]);return`${e.slice(0,t)}${e.slice(n)}`}function G(e){return e.replace(/\n{0,2}<skill\s+name=["']pi-subagents["'][^>]*>[\s\S]*?<\/skill>\n{0,2}/g,`
16
16
 
17
- `).replace(/[ \t]*<skill>\s*[\s\S]*?<\/skill>\s*/g,e=>w.test(e)?``:e)}function F(e){let t=e;for(let e of[_,v,h])t=t.split(e).join(``);return t.replace(/^(?:[ \t]*\r?\n)+/,``)}function I(e,t){let n=e;return t.inheritProjectContext||(n=M(n)),t.inheritSkills||(n=N(n)),n=P(n),n=F(n),`${t.fanoutChild?v:_}${process.env.PI_SUBAGENT_STRUCTURED_OUTPUT_CAPTURE?`\n\n${h}`:``}\n\n${n}`}function L(e){let t=e;return t?.role!==`custom`||typeof t.customType!=`string`?!1:C.has(t.customType)}function R(e){let t=e;return t?.role===`toolResult`&&t.toolName===`subagent`}function z(e){let t=e;return t?.type===`toolCall`&&t.name===`subagent`}function B(e){let t=e;if(t?.role!==`assistant`||!Array.isArray(t.content))return e;let n=t.content.filter(e=>!z(e));if(n.length===t.content.length)return e;if(n.length!==0)return{...t,content:n}}function V(e){let t=process.env[n.SUBAGENT_FANOUT_CHILD_ENV]===`1`,r=!1,i=[];for(let n of e){if(L(n)||!t&&R(n)){r=!0;continue}let e=t?n:B(n);if(e===void 0){r=!0;continue}e!==n&&(r=!0),i.push(e)}return r?i:e}function H(e){return[`Mid-run steering from the parent orchestrator:`,``,e.message,``,`Incorporate this guidance at the next safe point. Do not restart the task unless the guidance explicitly asks you to.`].join(`
18
- `)}function U(e,t,r){let a=process.env[n.SUBAGENT_STEER_ACK_DIR_ENV]?.trim(),o=Number(process.env[n.SUBAGENT_CHILD_INDEX_ENV]);!a||!Number.isInteger(o)||o<0||i.writeSteerAckAt(i.steerAckPathFromDir(a,e.id),{requestId:e.id,index:o,ts:Date.now(),state:t,message:r})}function W(e,t,n){if(!t)return;let r=0,i=!1,a=e.sendUserMessage;y(e,`tool_call`,e=>{let o=typeof e.toolName==`string`?e.toolName:`tool`;if(r++,t.soft!==void 0&&r>=t.soft&&!i){i=!0;try{a?.(s.toolBudgetSoftNudge(t,r),{deliverAs:`steer`})}catch(e){n.steerNudgeFailures+=1,n.lastError=e}}if(s.shouldBlockToolForBudget(t,o,r))return{block:!0,reason:s.toolBudgetBlockedMessage(t,o,r)}})}function G(e,r={}){let a=r.diagnostics??m(),o=process.env[n.SUBAGENT_STEER_INBOX_ENV]?.trim();if(!o)return;let s=process.env[n.SUBAGENT_STEER_CAPABILITY_ENV]?.trim(),c=process.env[n.SUBAGENT_STEER_ACK_DIR_ENV]?.trim(),l=e.sendUserMessage,u=Number(process.env[n.SUBAGENT_CHILD_INDEX_ENV]),d=new Map,p=!1,h=!1,g=!1,_=typeof l==`function`,v,b,x=(e,t,n)=>{!c||!Number.isInteger(u)||u<0||i.writeSteerAckAt(i.steerAckPathFromDir(c,e.id),{requestId:e.id,index:u,ts:Date.now(),state:t,message:n})},S=()=>{!s||!Number.isInteger(u)||u<0||i.writeSteerCapabilityAt(s,{index:u,pid:process.pid,readyAt:Date.now(),supported:_})},C=()=>{if(!(p||h)){h=!0;try{for(let e of i.claimSteerRequestsFromDir(o)){if(!_||typeof l!=`function`){x(e.request,`failed`,`Child Pi session does not support sendUserMessage steering.`),e.commit();continue}let t=H(e.request),n=d.get(t)??[];n.push(e.request.id),d.set(t,n);try{l(t,{deliverAs:`steer`}),e.commit()}catch(r){n.pop(),n.length===0&&d.delete(t),e.release(),x(e.request,`failed`,r instanceof Error?r.message:String(r))}}}finally{h=!1}}},w=e=>{if(p||!e||typeof e!=`object`)return;let t=e;if(t.source!==`extension`||t.streamingBehavior!==`steer`)return;let n=typeof t.text==`string`?t.text:typeof t.content==`string`?t.content:void 0;if(!n)return;let r=d.get(n),i=r?.shift();i&&(r?.length===0&&d.delete(n),x({type:`steer`,id:i,ts:Date.now(),message:n},`delivered`,`Pi accepted the correlated steering input.`))},T=()=>{if(!(g||p)){try{f.mkdirSync(o,{recursive:!0}),S()}catch{return}g=!0;try{v=(r.watch??f.watch)(t.resolveWatchPath(o,r.nativeRealpath),()=>C()),v.on(`error`,e=>{a.watchErrors+=1,a.lastError=e})}catch{v=void 0}b=setInterval(C,250),b.unref?.()}},E=()=>{T(),C()};y(e,`input`,w),y(e,`session_start`,()=>T());for(let t of[`message_start`,`message_update`,`message_end`,`tool_execution_start`,`tool_execution_end`,`turn_end`])y(e,t,E);y(e,`session_shutdown`,()=>{p=!0;try{v?.close()}catch(e){a.watchCloseFailures+=1,a.lastError=e}b&&clearInterval(b)})}function K(e,t=m()){a.adoptSessionScopeFromEnv(),G(e,{diagnostics:t}),W(e,s.decodeToolBudgetEnv(process.env[n.TOOL_BUDGET_ENV],{allowZero:process.env[n.TOOL_BUDGET_ZERO_AUTH_ENV]===`1`}),t);let i=c.createPromptRuntimeContainer();S(e,i);let o=i.get(r.DOOM_TEAM_TYPES.NativeTeamChannelService);y(e,`session_start`,()=>{o.createRuntime(e).bindChildFromEnvironment()}),y(e,`agent_start`,()=>{A(e)});let l=process.env[n.STRUCTURED_OUTPUT_CAPTURE_ENV],d=process.env[n.STRUCTURED_OUTPUT_SCHEMA_ENV];if(l&&d){let t=JSON.parse(f.readFileSync(d,`utf-8`)),n=u.createStructuredOutputToolParameters(t),r=new u.StructuredOutputValidator;e.registerTool.bind(e)({name:`structured_output`,label:`Structured Output`,description:`Submit the required final structured output for this subagent step. This terminates the step.`,parameters:n,async execute(e,n){let i=await r.validateValue(t,n.value);if(i.status===`invalid`)throw Error(`Structured output validation failed: ${i.message}`);return f.mkdirSync(p.dirname(l),{recursive:!0}),f.writeFileSync(l,JSON.stringify(n.value),{mode:384}),{content:[{type:`text`,text:`Structured output captured.`}],details:{path:l},terminate:!0}}})}y(e,`context`,e=>{let t=V(e.messages);if(t!==e.messages)return{messages:t}}),y(e,`before_agent_start`,async t=>{let r=process.env[n.SUBAGENT_INTERCOM_SESSION_NAME_ENV]?.trim();r&&typeof e.setSessionName==`function`&&e.setSessionName(r);let i=D(n.INHERIT_PROJECT_CONTEXT_ENV),a=D(n.INHERIT_SKILLS_ENV),o=D(n.SUBAGENT_FANOUT_CHILD_ENV),s=t.systemPrompt;if((i!==void 0||a!==void 0||o!==void 0)&&(s=I(t.systemPrompt,{inheritProjectContext:i??!0,inheritSkills:a??!0,fanoutChild:o===!0})),s!==t.systemPrompt)return{systemPrompt:s}})}exports.registerSubagentPromptRuntime=K;
17
+ `).replace(/[ \t]*<skill>\s*[\s\S]*?<\/skill>\s*/g,e=>F.test(e)?``:e)}function K(e){let t=e;for(let e of[D,O,T])t=t.split(e).join(``);return t.replace(/^(?:[ \t]*\r?\n)+/,``)}function q(e,t){let n=e;return t.inheritProjectContext||(n=U(n)),t.inheritSkills||(n=W(n)),n=G(n),n=K(n),`${t.fanoutChild?O:D}${process.env.PI_SUBAGENT_STRUCTURED_OUTPUT_CAPTURE?`\n\n${T}`:``}\n\n${n}`}function J(e){let t=e;return t?.role!==`custom`||typeof t.customType!=`string`?!1:P.has(t.customType)}function Y(e){let t=e;return t?.role===`toolResult`&&t.toolName===`subagent`}function X(e){let t=e;return t?.type===`toolCall`&&t.name===`subagent`}function Z(e){let t=e;if(t?.role!==`assistant`||!Array.isArray(t.content))return e;let n=t.content.filter(e=>!X(e));if(n.length===t.content.length)return e;if(n.length!==0)return{...t,content:n}}function ne(e){let t=process.env[r.SUBAGENT_FANOUT_CHILD_ENV]===`1`,n=!1,i=[];for(let r of e){if(J(r)||!t&&Y(r)){n=!0;continue}let e=t?r:Z(r);if(e===void 0){n=!0;continue}e!==r&&(n=!0),i.push(e)}return n?i:e}function Q(e){return[`Mid-run steering from the parent orchestrator:`,``,e.message,``,`Incorporate this guidance at the next safe point. Do not restart the task unless the guidance explicitly asks you to.`].join(`
18
+ `)}function $(e,t,n){let a=process.env[r.SUBAGENT_STEER_ACK_DIR_ENV]?.trim(),o=Number(process.env[r.SUBAGENT_CHILD_INDEX_ENV]);!a||!Number.isInteger(o)||o<0||i.writeSteerAckAt(i.steerAckPathFromDir(a,e.id),{requestId:e.id,index:o,ts:Date.now(),state:t,message:n})}function re(e,t,n){if(!t)return;let r=0,i=!1,a=e.sendUserMessage;k(e,`tool_call`,e=>{let o=typeof e.toolName==`string`?e.toolName:`tool`;if(r++,t.soft!==void 0&&r>=t.soft&&!i){i=!0;try{a?.(s.toolBudgetSoftNudge(t,r),{deliverAs:`steer`})}catch(e){n.steerNudgeFailures+=1,n.lastError=e}}if(s.shouldBlockToolForBudget(t,o,r))return{block:!0,reason:s.toolBudgetBlockedMessage(t,o,r)}})}function ie(e,t={}){let a=t.diagnostics??w(),o=process.env[r.SUBAGENT_STEER_INBOX_ENV]?.trim();if(!o)return;let s=process.env[r.SUBAGENT_STEER_CAPABILITY_ENV]?.trim(),c=process.env[r.SUBAGENT_STEER_ACK_DIR_ENV]?.trim(),l=e.sendUserMessage,u=Number(process.env[r.SUBAGENT_CHILD_INDEX_ENV]),d=new Map,p=!1,m=!1,h=!1,g=typeof l==`function`,_,v,y=(e,t,n)=>{!c||!Number.isInteger(u)||u<0||i.writeSteerAckAt(i.steerAckPathFromDir(c,e.id),{requestId:e.id,index:u,ts:Date.now(),state:t,message:n})},b=()=>{!s||!Number.isInteger(u)||u<0||i.writeSteerCapabilityAt(s,{index:u,pid:process.pid,readyAt:Date.now(),supported:g})},x=()=>{if(!(p||m)){m=!0;try{for(let e of i.claimSteerRequestsFromDir(o)){if(!g||typeof l!=`function`){y(e.request,`failed`,`Child Pi session does not support sendUserMessage steering.`),e.commit();continue}let t=Q(e.request),n=d.get(t)??[];n.push(e.request.id),d.set(t,n);try{l(t,{deliverAs:`steer`}),e.commit()}catch(r){n.pop(),n.length===0&&d.delete(t),e.release(),y(e.request,`failed`,r instanceof Error?r.message:String(r))}}}finally{m=!1}}},S=e=>{if(p||!e||typeof e!=`object`)return;let t=e;if(t.source!==`extension`||t.streamingBehavior!==`steer`)return;let n=typeof t.text==`string`?t.text:typeof t.content==`string`?t.content:void 0;if(!n)return;let r=d.get(n),i=r?.shift();i&&(r?.length===0&&d.delete(n),y({type:`steer`,id:i,ts:Date.now(),message:n},`delivered`,`Pi accepted the correlated steering input.`))},C=()=>{if(!(h||p)){try{f.mkdirSync(o,{recursive:!0}),b()}catch{return}h=!0;try{_=(t.watch??f.watch)(n.resolveWatchPath(o,t.nativeRealpath),()=>x()),_.on(`error`,e=>{a.watchErrors+=1,a.lastError=e})}catch{_=void 0}v=setInterval(x,250),v.unref?.()}},T=()=>{C(),x()};k(e,`input`,S),k(e,`session_start`,()=>C());for(let t of[`message_start`,`message_update`,`message_end`,`tool_execution_start`,`tool_execution_end`,`turn_end`])k(e,t,T);k(e,`session_shutdown`,()=>{p=!0;try{_?.close()}catch(e){a.watchCloseFailures+=1,a.lastError=e}v&&clearInterval(v)})}function ae(e,n=w()){a.adoptSessionScopeFromEnv(),M(e),ie(e,{diagnostics:n}),k(e,`before_provider_request`,(e,t)=>C(e.payload,t.model?.api)),re(e,s.decodeToolBudgetEnv(process.env[r.TOOL_BUDGET_ENV],{allowZero:process.env[r.TOOL_BUDGET_ZERO_AUTH_ENV]===`1`}),n);let i=c.createPromptRuntimeContainer();te(e,i);let o=i.get(t.DOOM_TEAM_TYPES.NativeTeamChannelService);k(e,`session_start`,()=>{o.createRuntime(e).bindChildFromEnvironment()}),k(e,`agent_start`,()=>{V(e)});let u=process.env[r.STRUCTURED_OUTPUT_CAPTURE_ENV],d=process.env[r.STRUCTURED_OUTPUT_SCHEMA_ENV];if(u&&d){let t=JSON.parse(f.readFileSync(d,`utf-8`)),n=l.createStructuredOutputToolParameters(t),r=new l.StructuredOutputValidator;e.registerTool.bind(e)({name:`structured_output`,label:`Structured Output`,description:`Submit the required final structured output for this subagent step. This terminates the step.`,parameters:n,async execute(e,n){let i=await r.validateValue(t,n.value);if(i.status===`invalid`)throw Error(`Structured output validation failed: ${i.message}`);return f.mkdirSync(p.dirname(u),{recursive:!0}),f.writeFileSync(u,JSON.stringify(n.value),{mode:384}),{content:[{type:`text`,text:`Structured output captured.`}],details:{path:u},terminate:!0}}})}k(e,`context`,e=>{let t=ne(e.messages);if(t!==e.messages)return{messages:t}}),k(e,`before_agent_start`,async t=>{let n=process.env[r.SUBAGENT_INTERCOM_SESSION_NAME_ENV]?.trim();n&&typeof e.setSessionName==`function`&&e.setSessionName(n);let i=R(r.INHERIT_PROJECT_CONTEXT_ENV),a=R(r.INHERIT_SKILLS_ENV),o=R(r.SUBAGENT_FANOUT_CHILD_ENV),s=t.systemPrompt;if((i!==void 0||a!==void 0||o!==void 0)&&(s=q(t.systemPrompt,{inheritProjectContext:i??!0,inheritSkills:a??!0,fanoutChild:o===!0})),s!==t.systemPrompt)return{systemPrompt:s}})}exports.registerSubagentPromptRuntime=ae;
19
19
  //# sourceMappingURL=subagentPromptRuntime.cjs.map