@xzzpig/pi-subagents 0.22.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1133) hide show
  1. package/CHANGELOG.md +346 -0
  2. package/README.md +2 -2
  3. package/agents/evidence-auditor.md +1 -0
  4. package/agents/oracle.md +1 -0
  5. package/agents/reviewer.md +1 -0
  6. package/bundle/agent-management.js +16 -0
  7. package/bundle/agents.js +41 -0
  8. package/bundle/background-work.js +16 -0
  9. package/bundle/capability-ceiling.js +22 -0
  10. package/bundle/child-tool-plan.js +11 -0
  11. package/bundle/chunk-355ECEP2.js +1321 -0
  12. package/bundle/chunk-35GII5EF.js +637 -0
  13. package/bundle/chunk-3G4JXNZ4.js +4130 -0
  14. package/bundle/chunk-3U633XDZ.js +749 -0
  15. package/bundle/chunk-4QFZZV3O.js +57 -0
  16. package/bundle/chunk-62OCY2S4.js +14 -0
  17. package/bundle/chunk-7J4ZXMY7.js +18 -0
  18. package/bundle/chunk-7K3Z6DM7.js +276 -0
  19. package/bundle/chunk-BGIYHF2W.js +138 -0
  20. package/bundle/chunk-CTPAE36Y.js +94 -0
  21. package/bundle/chunk-D4EHT5SJ.js +14 -0
  22. package/bundle/chunk-ED55MIC2.js +1681 -0
  23. package/bundle/chunk-F3NSN7UH.js +7331 -0
  24. package/bundle/chunk-FJWI64H7.js +490 -0
  25. package/bundle/chunk-H36HBZB2.js +753 -0
  26. package/bundle/chunk-ICNYIALB.js +7347 -0
  27. package/bundle/chunk-KD2IMFN4.js +1310 -0
  28. package/bundle/chunk-LCDJWBVM.js +57 -0
  29. package/bundle/chunk-LPVUHUZ7.js +5503 -0
  30. package/bundle/chunk-MYCL5QEJ.js +1372 -0
  31. package/bundle/chunk-NCWCVJLT.js +1768 -0
  32. package/bundle/chunk-NIXWDZZV.js +9 -0
  33. package/bundle/chunk-NTRJDXBC.js +4175 -0
  34. package/bundle/chunk-OFGSZBHP.js +16924 -0
  35. package/bundle/chunk-OTLRAB22.js +143 -0
  36. package/bundle/chunk-QXASAHIA.js +173 -0
  37. package/bundle/chunk-RB4GELQA.js +458 -0
  38. package/bundle/chunk-RK2HDPLK.js +1234 -0
  39. package/bundle/chunk-SW2VMNIU.js +526 -0
  40. package/bundle/chunk-T65XRVVM.js +940 -0
  41. package/bundle/chunk-U4ODUYAG.js +235 -0
  42. package/bundle/chunk-UFNSLL5D.js +9796 -0
  43. package/bundle/chunk-UKG4V45O.js +228 -0
  44. package/bundle/chunk-UQDHXMUG.js +264 -0
  45. package/bundle/chunk-V2KFIGFH.js +8774 -0
  46. package/bundle/chunk-VO3G7HI3.js +85 -0
  47. package/bundle/chunk-WPW4V6HM.js +227 -0
  48. package/bundle/chunk-WW76JRIX.js +175 -0
  49. package/bundle/chunk-XA3DY6UG.js +161 -0
  50. package/bundle/chunk-YFCK7H2S.js +129 -0
  51. package/bundle/chunk-YYREO77V.js +137 -0
  52. package/bundle/chunk-Z6TFJ6BR.js +400 -0
  53. package/bundle/control-channel.js +11 -0
  54. package/bundle/delegation.js +14 -0
  55. package/bundle/external-job-provider.js +20 -0
  56. package/bundle/external-runs.js +21 -0
  57. package/bundle/index.js +30 -0
  58. package/bundle/inspectors.js +8 -0
  59. package/bundle/intercom-bridge.js +11 -0
  60. package/bundle/preflight.js +468 -0
  61. package/bundle/project-panes.js +28 -0
  62. package/bundle/required-child-extensions.js +6 -0
  63. package/bundle/shared-types.js +8 -0
  64. package/bundle/supervisor-routing.js +12 -0
  65. package/bundle/workflow-resources.js +7 -0
  66. package/docs/agents.md +42 -10
  67. package/docs/configuration.md +59 -14
  68. package/docs/extension-api.md +61 -9
  69. package/docs/missions.md +2 -0
  70. package/docs/observability.md +20 -5
  71. package/docs/standalone-background.md +8 -6
  72. package/docs/tool-reference.md +18 -5
  73. package/docs/workflows.md +25 -7
  74. package/index.d.ts +3 -0
  75. package/index.js +14 -0
  76. package/node_modules/@xzzpig/pi-components/package.json +1 -2
  77. package/package.json +107 -87
  78. package/skills/council-mode/SKILL.md +1 -4
  79. package/skills/pi-subagents/SKILL.md +130 -106
  80. package/skills/pi-subagents/references/orchestration.md +124 -0
  81. package/skills/pi-subagents/references/prompting-and-roles.md +96 -291
  82. package/src/agents/advertised-agent-prompt.d.ts +13 -0
  83. package/src/agents/advertised-agent-prompt.js +68 -0
  84. package/src/agents/agent-eject.d.ts +39 -0
  85. package/src/agents/agent-eject.js +263 -0
  86. package/src/agents/agent-management.d.ts +33 -0
  87. package/src/agents/agent-management.js +1541 -0
  88. package/src/agents/agent-memory.d.ts +48 -0
  89. package/src/agents/agent-memory.js +350 -0
  90. package/src/agents/agent-refinements.d.ts +99 -0
  91. package/src/agents/agent-refinements.js +568 -0
  92. package/src/agents/agent-scope.d.ts +3 -0
  93. package/src/agents/agent-scope.js +8 -0
  94. package/src/agents/agent-selection.d.ts +2 -0
  95. package/src/agents/agent-selection.js +22 -0
  96. package/src/agents/agent-serializer.d.ts +7 -0
  97. package/src/agents/agent-serializer.js +213 -0
  98. package/src/agents/agents.d.ts +352 -0
  99. package/src/agents/agents.js +2817 -0
  100. package/src/agents/builtin-names.d.ts +1 -0
  101. package/src/agents/builtin-names.js +16 -0
  102. package/src/agents/chain-serializer.d.ts +6 -0
  103. package/src/agents/chain-serializer.js +318 -0
  104. package/src/agents/frontmatter.d.ts +19 -0
  105. package/src/agents/frontmatter.js +166 -0
  106. package/src/agents/global-npm-root.d.ts +6 -0
  107. package/src/agents/global-npm-root.js +57 -0
  108. package/src/agents/identity.d.ts +7 -0
  109. package/src/agents/identity.js +29 -0
  110. package/src/agents/proactive-skills.d.ts +35 -0
  111. package/src/agents/proactive-skills.js +155 -0
  112. package/src/agents/runtime-agent-events.d.ts +26 -0
  113. package/src/agents/runtime-agent-events.js +52 -0
  114. package/src/agents/runtime-agent-registry.d.ts +66 -0
  115. package/src/agents/runtime-agent-registry.js +415 -0
  116. package/src/agents/runtime-discovery.d.ts +13 -0
  117. package/src/agents/runtime-discovery.js +27 -0
  118. package/src/agents/skills.d.ts +34 -0
  119. package/src/agents/skills.js +718 -0
  120. package/src/api/agent-management.d.ts +2 -0
  121. package/src/api/agent-management.js +2 -0
  122. package/src/api/agents.d.ts +6 -0
  123. package/src/api/agents.js +3 -0
  124. package/src/api/background-work.d.ts +41 -0
  125. package/src/api/background-work.js +171 -0
  126. package/src/api/capability-ceiling.d.ts +1 -0
  127. package/src/api/capability-ceiling.js +1 -0
  128. package/src/api/child-tool-plan.d.ts +1 -0
  129. package/src/api/child-tool-plan.js +1 -0
  130. package/src/api/control-channel.d.ts +1 -0
  131. package/src/api/control-channel.js +1 -0
  132. package/src/api/delegation.d.ts +132 -0
  133. package/src/api/delegation.js +8 -0
  134. package/src/api/external-job-provider.d.ts +57 -0
  135. package/src/api/external-job-provider.js +139 -0
  136. package/src/api/external-runs.d.ts +47 -0
  137. package/src/api/external-runs.js +245 -0
  138. package/src/api/inspectors.d.ts +20 -0
  139. package/src/api/inspectors.js +11 -0
  140. package/src/api/intercom-bridge.d.ts +1 -0
  141. package/src/api/intercom-bridge.js +1 -0
  142. package/src/api/preflight.d.ts +183 -0
  143. package/src/api/preflight.js +455 -0
  144. package/src/api/project-panes.d.ts +7 -0
  145. package/src/api/project-panes.js +7 -0
  146. package/src/api/required-child-extensions.d.ts +1 -0
  147. package/src/api/required-child-extensions.js +1 -0
  148. package/src/api/shared-types.d.ts +1 -0
  149. package/src/api/shared-types.js +1 -0
  150. package/src/api/supervisor-routing.d.ts +110 -0
  151. package/src/api/supervisor-routing.js +95 -0
  152. package/src/api/workflow-resources.d.ts +2 -0
  153. package/src/api/workflow-resources.js +1 -0
  154. package/src/extension/active-runs-prompt.d.ts +7 -0
  155. package/src/extension/active-runs-prompt.js +29 -0
  156. package/src/extension/config.d.ts +7 -0
  157. package/src/extension/config.js +290 -0
  158. package/src/extension/context-injection.d.ts +52 -0
  159. package/src/extension/context-injection.js +102 -0
  160. package/src/extension/control-notices.d.ts +18 -0
  161. package/src/extension/control-notices.js +29 -0
  162. package/src/extension/declaration-pinning.d.ts +18 -0
  163. package/src/extension/declaration-pinning.js +167 -0
  164. package/src/extension/doctor.d.ts +34 -0
  165. package/src/extension/doctor.js +236 -0
  166. package/src/extension/fanout-child.d.ts +6 -0
  167. package/src/extension/fanout-child.js +278 -0
  168. package/src/extension/herdr-pi-bridge.d.ts +16 -0
  169. package/src/extension/herdr-pi-bridge.js +261 -0
  170. package/src/extension/index.d.ts +18 -0
  171. package/src/extension/index.js +1288 -0
  172. package/src/extension/public-execution.d.ts +71 -0
  173. package/src/extension/public-execution.js +214 -0
  174. package/src/extension/reply-workflow-script.d.ts +11 -0
  175. package/src/extension/reply-workflow-script.js +71 -0
  176. package/src/extension/rpc.d.ts +84 -0
  177. package/src/extension/rpc.js +729 -0
  178. package/src/extension/schemas.d.ts +276 -0
  179. package/src/extension/schemas.js +311 -0
  180. package/src/extension/steering-notices.d.ts +14 -0
  181. package/src/extension/steering-notices.js +22 -0
  182. package/src/extension/subagent-guide.d.ts +4 -0
  183. package/src/extension/subagent-guide.js +114 -0
  184. package/src/extension/subagent-options.d.ts +7 -0
  185. package/src/extension/subagent-options.js +64 -0
  186. package/src/extension/tool-activation.d.ts +7 -0
  187. package/src/extension/tool-activation.js +185 -0
  188. package/src/extension/tool-description.d.ts +19 -0
  189. package/src/extension/tool-description.js +169 -0
  190. package/src/extension/tool-result.d.ts +9 -0
  191. package/src/extension/tool-result.js +16 -0
  192. package/src/extension/upgrade-notice.d.ts +6 -0
  193. package/src/extension/upgrade-notice.js +42 -0
  194. package/src/inspectors/actions.d.ts +24 -0
  195. package/src/inspectors/actions.js +182 -0
  196. package/src/inspectors/ghostty/actions.d.ts +11 -0
  197. package/src/inspectors/ghostty/actions.js +62 -0
  198. package/src/inspectors/ghostty/plugin.d.ts +7 -0
  199. package/src/inspectors/ghostty/plugin.js +23 -0
  200. package/src/inspectors/herdr/actions.d.ts +25 -0
  201. package/src/inspectors/herdr/actions.js +133 -0
  202. package/src/inspectors/herdr/client.d.ts +41 -0
  203. package/src/inspectors/herdr/client.js +129 -0
  204. package/src/inspectors/herdr/focus.d.ts +24 -0
  205. package/src/inspectors/herdr/focus.js +49 -0
  206. package/src/inspectors/herdr/plugin.d.ts +6 -0
  207. package/src/inspectors/herdr/plugin.js +14 -0
  208. package/src/inspectors/herdr/project-panes.d.ts +136 -0
  209. package/src/inspectors/herdr/project-panes.js +610 -0
  210. package/src/inspectors/inspector-runner.d.ts +23 -0
  211. package/src/inspectors/inspector-runner.js +161 -0
  212. package/src/inspectors/plugins.d.ts +8 -0
  213. package/src/inspectors/plugins.js +82 -0
  214. package/src/inspectors/session-roots-codec.d.ts +15 -0
  215. package/src/inspectors/session-roots-codec.js +32 -0
  216. package/src/inspectors/shell-command.d.ts +1 -0
  217. package/src/inspectors/shell-command.js +16 -0
  218. package/src/inspectors/tmux/actions.d.ts +25 -0
  219. package/src/inspectors/tmux/actions.js +181 -0
  220. package/src/inspectors/tmux/client.d.ts +27 -0
  221. package/src/inspectors/tmux/client.js +64 -0
  222. package/src/inspectors/tmux/plugin.d.ts +7 -0
  223. package/src/inspectors/tmux/plugin.js +14 -0
  224. package/src/inspectors/types.d.ts +48 -0
  225. package/src/inspectors/types.js +1 -0
  226. package/src/integrations/herdr-status.d.ts +47 -0
  227. package/src/integrations/herdr-status.js +350 -0
  228. package/src/integrations/pi-web-session-liveness.d.ts +19 -0
  229. package/src/integrations/pi-web-session-liveness.js +53 -0
  230. package/src/integrations/program-status.d.ts +30 -0
  231. package/src/integrations/program-status.js +188 -0
  232. package/src/intercom/fork-supervisor-routing.d.ts +90 -0
  233. package/src/intercom/fork-supervisor-routing.js +392 -0
  234. package/src/intercom/intercom-bridge.d.ts +58 -0
  235. package/src/intercom/intercom-bridge.js +193 -0
  236. package/src/intercom/native-supervisor-channel.d.ts +97 -0
  237. package/src/intercom/native-supervisor-channel.js +1184 -0
  238. package/src/intercom/result-intercom.d.ts +35 -0
  239. package/src/intercom/result-intercom.js +376 -0
  240. package/src/intercom/supervisor-ui.d.ts +29 -0
  241. package/src/intercom/supervisor-ui.js +49 -0
  242. package/src/missions/actions.d.ts +54 -0
  243. package/src/missions/actions.js +400 -0
  244. package/src/missions/goal-driver.d.ts +16 -0
  245. package/src/missions/goal-driver.js +171 -0
  246. package/src/missions/lifecycle.d.ts +50 -0
  247. package/src/missions/lifecycle.js +388 -0
  248. package/src/missions/store.d.ts +21 -0
  249. package/src/missions/store.js +605 -0
  250. package/src/missions/types.d.ts +169 -0
  251. package/src/missions/types.js +9 -0
  252. package/src/missions/workflow-state.d.ts +14 -0
  253. package/src/missions/workflow-state.js +273 -0
  254. package/src/policy/authority.d.ts +9 -0
  255. package/src/policy/authority.js +41 -0
  256. package/src/profiles/profiles.d.ts +134 -0
  257. package/src/profiles/profiles.js +526 -0
  258. package/src/runs/background/active-async-capacity.d.ts +115 -0
  259. package/src/runs/background/active-async-capacity.js +517 -0
  260. package/src/runs/background/active-run-index.d.ts +12 -0
  261. package/src/runs/background/active-run-index.js +157 -0
  262. package/src/runs/background/async-execution.d.ts +304 -0
  263. package/src/runs/background/async-execution.js +2206 -0
  264. package/src/runs/background/async-job-tracker.d.ts +37 -0
  265. package/src/runs/background/async-job-tracker.js +921 -0
  266. package/src/runs/background/async-resume.d.ts +60 -0
  267. package/src/runs/background/async-resume.js +707 -0
  268. package/src/runs/background/async-retention.d.ts +45 -0
  269. package/src/runs/background/async-retention.js +932 -0
  270. package/src/runs/background/async-status-snapshot.d.ts +9 -0
  271. package/src/runs/background/async-status-snapshot.js +26 -0
  272. package/src/runs/background/async-status.d.ts +177 -0
  273. package/src/runs/background/async-status.js +710 -0
  274. package/src/runs/background/auto-drain.d.ts +16 -0
  275. package/src/runs/background/auto-drain.js +71 -0
  276. package/src/runs/background/await-async-run.d.ts +26 -0
  277. package/src/runs/background/await-async-run.js +83 -0
  278. package/src/runs/background/binary-bootstrap.d.ts +8 -0
  279. package/src/runs/background/binary-bootstrap.js +69 -0
  280. package/src/runs/background/boot-id.d.ts +12 -0
  281. package/src/runs/background/boot-id.js +47 -0
  282. package/src/runs/background/calendar-schedule.d.ts +26 -0
  283. package/src/runs/background/calendar-schedule.js +93 -0
  284. package/src/runs/background/chain-append.d.ts +34 -0
  285. package/src/runs/background/chain-append.js +299 -0
  286. package/src/runs/background/chain-root-attachment.d.ts +51 -0
  287. package/src/runs/background/chain-root-attachment.js +186 -0
  288. package/src/runs/background/completion-batcher.d.ts +51 -0
  289. package/src/runs/background/completion-batcher.js +119 -0
  290. package/src/runs/background/completion-dedupe.d.ts +13 -0
  291. package/src/runs/background/completion-dedupe.js +48 -0
  292. package/src/runs/background/completion-replay.d.ts +47 -0
  293. package/src/runs/background/completion-replay.js +266 -0
  294. package/src/runs/background/control-channel.d.ts +170 -0
  295. package/src/runs/background/control-channel.js +610 -0
  296. package/src/runs/background/fleet-view.d.ts +63 -0
  297. package/src/runs/background/fleet-view.js +666 -0
  298. package/src/runs/background/index-segment.d.ts +16 -0
  299. package/src/runs/background/index-segment.js +58 -0
  300. package/src/runs/background/inspect-rpc.d.ts +64 -0
  301. package/src/runs/background/inspect-rpc.js +422 -0
  302. package/src/runs/background/interrupted-elsewhere.d.ts +22 -0
  303. package/src/runs/background/interrupted-elsewhere.js +68 -0
  304. package/src/runs/background/notify.d.ts +214 -0
  305. package/src/runs/background/notify.js +1001 -0
  306. package/src/runs/background/owned-process-tree.d.ts +10 -0
  307. package/src/runs/background/owned-process-tree.js +116 -0
  308. package/src/runs/background/parallel-groups.d.ts +3 -0
  309. package/src/runs/background/parallel-groups.js +46 -0
  310. package/src/runs/background/pid-namespace.d.ts +2 -0
  311. package/src/runs/background/pid-namespace.js +19 -0
  312. package/src/runs/background/process-terminal-candidate.d.ts +17 -0
  313. package/src/runs/background/process-terminal-candidate.js +96 -0
  314. package/src/runs/background/process-terminal.d.ts +21 -0
  315. package/src/runs/background/process-terminal.js +227 -0
  316. package/src/runs/background/result-delivery-ownership.d.ts +14 -0
  317. package/src/runs/background/result-delivery-ownership.js +38 -0
  318. package/src/runs/background/result-files.d.ts +63 -0
  319. package/src/runs/background/result-files.js +629 -0
  320. package/src/runs/background/result-watcher.d.ts +92 -0
  321. package/src/runs/background/result-watcher.js +819 -0
  322. package/src/runs/background/resume-guidance.d.ts +4 -0
  323. package/src/runs/background/resume-guidance.js +57 -0
  324. package/src/runs/background/retained-children.d.ts +24 -0
  325. package/src/runs/background/retained-children.js +128 -0
  326. package/src/runs/background/retained-nested-route-tracker.d.ts +12 -0
  327. package/src/runs/background/retained-nested-route-tracker.js +90 -0
  328. package/src/runs/background/run-child-session.d.ts +123 -0
  329. package/src/runs/background/run-child-session.js +670 -0
  330. package/src/runs/background/run-id-query.d.ts +3 -0
  331. package/src/runs/background/run-id-query.js +6 -0
  332. package/src/runs/background/run-id-resolver.d.ts +22 -0
  333. package/src/runs/background/run-id-resolver.js +172 -0
  334. package/src/runs/background/run-status.d.ts +25 -0
  335. package/src/runs/background/run-status.js +850 -0
  336. package/src/runs/background/runner-aliases.d.ts +17 -0
  337. package/src/runs/background/runner-aliases.js +191 -0
  338. package/src/runs/background/runner-child-launch.d.ts +24 -0
  339. package/src/runs/background/runner-child-launch.js +72 -0
  340. package/src/runs/background/runner-child-sessions.d.ts +6 -0
  341. package/src/runs/background/runner-child-sessions.js +34 -0
  342. package/src/runs/background/runner-http-dispatcher.d.ts +45 -0
  343. package/src/runs/background/runner-http-dispatcher.js +115 -0
  344. package/src/runs/background/runner-startup-failure.d.ts +13 -0
  345. package/src/runs/background/runner-startup-failure.js +46 -0
  346. package/src/runs/background/scheduled-runs.d.ts +127 -0
  347. package/src/runs/background/scheduled-runs.js +1265 -0
  348. package/src/runs/background/stale-run-reconciler.d.ts +62 -0
  349. package/src/runs/background/stale-run-reconciler.js +509 -0
  350. package/src/runs/background/steering.d.ts +51 -0
  351. package/src/runs/background/steering.js +246 -0
  352. package/src/runs/background/subagent-runner-bootstrap.d.ts +13 -0
  353. package/src/runs/background/subagent-runner-bootstrap.js +283 -0
  354. package/src/runs/background/subagent-runner.d.ts +210 -0
  355. package/src/runs/background/subagent-runner.js +4963 -0
  356. package/src/runs/background/subagent-wait.d.ts +124 -0
  357. package/src/runs/background/subagent-wait.js +756 -0
  358. package/src/runs/background/terminal-run-index.d.ts +10 -0
  359. package/src/runs/background/terminal-run-index.js +209 -0
  360. package/src/runs/background/top-level-async.d.ts +7 -0
  361. package/src/runs/background/top-level-async.js +5 -0
  362. package/src/runs/background/wait-completions.d.ts +28 -0
  363. package/src/runs/background/wait-completions.js +264 -0
  364. package/src/runs/background/wait-config.d.ts +8 -0
  365. package/src/runs/background/wait-config.js +46 -0
  366. package/src/runs/background/wait-subscriptions.d.ts +26 -0
  367. package/src/runs/background/wait-subscriptions.js +339 -0
  368. package/src/runs/background/wait-tool.d.ts +6 -0
  369. package/src/runs/background/wait-tool.js +48 -0
  370. package/src/runs/background/workflow-terminal-proof.d.ts +47 -0
  371. package/src/runs/background/workflow-terminal-proof.js +116 -0
  372. package/src/runs/foreground/async-dismiss-action.d.ts +6 -0
  373. package/src/runs/foreground/async-dismiss-action.js +82 -0
  374. package/src/runs/foreground/async-steering-action.d.ts +31 -0
  375. package/src/runs/foreground/async-steering-action.js +294 -0
  376. package/src/runs/foreground/async-stop-action.d.ts +13 -0
  377. package/src/runs/foreground/async-stop-action.js +213 -0
  378. package/src/runs/foreground/command-action.d.ts +12 -0
  379. package/src/runs/foreground/command-action.js +38 -0
  380. package/src/runs/foreground/execution.d.ts +10 -0
  381. package/src/runs/foreground/execution.js +2322 -0
  382. package/src/runs/foreground/foreground-control.d.ts +24 -0
  383. package/src/runs/foreground/foreground-control.js +138 -0
  384. package/src/runs/foreground/foreground-history.d.ts +25 -0
  385. package/src/runs/foreground/foreground-history.js +267 -0
  386. package/src/runs/foreground/prompt-audit.d.ts +32 -0
  387. package/src/runs/foreground/prompt-audit.js +138 -0
  388. package/src/runs/foreground/subagent-executor.d.ts +316 -0
  389. package/src/runs/foreground/subagent-executor.js +7986 -0
  390. package/src/runs/foreground/workflow-detach-reconcile.d.ts +15 -0
  391. package/src/runs/foreground/workflow-detach-reconcile.js +283 -0
  392. package/src/runs/foreground/workflow-foreground-steering.d.ts +43 -0
  393. package/src/runs/foreground/workflow-foreground-steering.js +148 -0
  394. package/src/runs/shared/abort-recovery.d.ts +26 -0
  395. package/src/runs/shared/abort-recovery.js +108 -0
  396. package/src/runs/shared/acceptance.d.ts +144 -0
  397. package/src/runs/shared/acceptance.js +1616 -0
  398. package/src/runs/shared/agent-contract.d.ts +5 -0
  399. package/src/runs/shared/agent-contract.js +35 -0
  400. package/src/runs/shared/async-status-projection.d.ts +100 -0
  401. package/src/runs/shared/async-status-projection.js +566 -0
  402. package/src/runs/shared/background-process-options.d.ts +4 -0
  403. package/src/runs/shared/background-process-options.js +6 -0
  404. package/src/runs/shared/capability-ceiling.d.ts +58 -0
  405. package/src/runs/shared/capability-ceiling.js +179 -0
  406. package/src/runs/shared/chain-outputs.d.ts +18 -0
  407. package/src/runs/shared/chain-outputs.js +104 -0
  408. package/src/runs/shared/child-commands.d.ts +29 -0
  409. package/src/runs/shared/child-commands.js +254 -0
  410. package/src/runs/shared/child-hooks.d.ts +31 -0
  411. package/src/runs/shared/child-hooks.js +173 -0
  412. package/src/runs/shared/child-identity.d.ts +23 -0
  413. package/src/runs/shared/child-identity.js +40 -0
  414. package/src/runs/shared/child-launch-plan.d.ts +70 -0
  415. package/src/runs/shared/child-launch-plan.js +88 -0
  416. package/src/runs/shared/child-launch.d.ts +128 -0
  417. package/src/runs/shared/child-launch.js +262 -0
  418. package/src/runs/shared/child-lifecycle.d.ts +13 -0
  419. package/src/runs/shared/child-lifecycle.js +22 -0
  420. package/src/runs/shared/child-runtime-config.d.ts +111 -0
  421. package/src/runs/shared/child-runtime-config.js +44 -0
  422. package/src/runs/shared/child-session.d.ts +178 -0
  423. package/src/runs/shared/child-session.js +726 -0
  424. package/src/runs/shared/child-tool-plan.d.ts +101 -0
  425. package/src/runs/shared/child-tool-plan.js +430 -0
  426. package/src/runs/shared/claude-code-adapter.d.ts +80 -0
  427. package/src/runs/shared/claude-code-adapter.js +255 -0
  428. package/src/runs/shared/codex-exec-adapter.d.ts +25 -0
  429. package/src/runs/shared/codex-exec-adapter.js +127 -0
  430. package/src/runs/shared/context-mode.d.ts +12 -0
  431. package/src/runs/shared/context-mode.js +38 -0
  432. package/src/runs/shared/cursor-agent-adapter.d.ts +26 -0
  433. package/src/runs/shared/cursor-agent-adapter.js +99 -0
  434. package/src/runs/shared/dynamic-fanout.d.ts +49 -0
  435. package/src/runs/shared/dynamic-fanout.js +273 -0
  436. package/src/runs/shared/effective-system-prompt.d.ts +17 -0
  437. package/src/runs/shared/effective-system-prompt.js +23 -0
  438. package/src/runs/shared/extension-bindings.d.ts +25 -0
  439. package/src/runs/shared/extension-bindings.js +96 -0
  440. package/src/runs/shared/external-cli-contract.d.ts +29 -0
  441. package/src/runs/shared/external-cli-contract.js +145 -0
  442. package/src/runs/shared/external-cli-preflight.d.ts +41 -0
  443. package/src/runs/shared/external-cli-preflight.js +159 -0
  444. package/src/runs/shared/external-cli-runner.d.ts +65 -0
  445. package/src/runs/shared/external-cli-runner.js +425 -0
  446. package/src/runs/shared/external-job-bridge.d.ts +24 -0
  447. package/src/runs/shared/external-job-bridge.js +486 -0
  448. package/src/runs/shared/external-job-runner.d.ts +44 -0
  449. package/src/runs/shared/external-job-runner.js +352 -0
  450. package/src/runs/shared/fast-mode-extension.d.ts +3 -0
  451. package/src/runs/shared/fast-mode-extension.js +8 -0
  452. package/src/runs/shared/fork-placed-env.d.ts +4 -0
  453. package/src/runs/shared/fork-placed-env.js +13 -0
  454. package/src/runs/shared/git-environment.d.ts +2 -0
  455. package/src/runs/shared/git-environment.js +27 -0
  456. package/src/runs/shared/herdr-connection.d.ts +79 -0
  457. package/src/runs/shared/herdr-connection.js +269 -0
  458. package/src/runs/shared/herdr-external-adapters.d.ts +148 -0
  459. package/src/runs/shared/herdr-external-adapters.js +404 -0
  460. package/src/runs/shared/herdr-machine.d.ts +59 -0
  461. package/src/runs/shared/herdr-machine.js +294 -0
  462. package/src/runs/shared/herdr-pane-host.d.ts +88 -0
  463. package/src/runs/shared/herdr-pane-host.js +155 -0
  464. package/src/runs/shared/herdr-pi-protocol.d.ts +21 -0
  465. package/src/runs/shared/herdr-pi-protocol.js +57 -0
  466. package/src/runs/shared/herdr-placed-run.d.ts +144 -0
  467. package/src/runs/shared/herdr-placed-run.js +380 -0
  468. package/src/runs/shared/host-step-status.d.ts +33 -0
  469. package/src/runs/shared/host-step-status.js +244 -0
  470. package/src/runs/shared/lane-metadata.d.ts +23 -0
  471. package/src/runs/shared/lane-metadata.js +126 -0
  472. package/src/runs/shared/launch-cwd.d.ts +1 -0
  473. package/src/runs/shared/launch-cwd.js +16 -0
  474. package/src/runs/shared/local-machine-access.d.ts +5 -0
  475. package/src/runs/shared/local-machine-access.js +28 -0
  476. package/src/runs/shared/long-running-guard.d.ts +34 -0
  477. package/src/runs/shared/long-running-guard.js +256 -0
  478. package/src/runs/shared/mcp-config-sources.d.ts +33 -0
  479. package/src/runs/shared/mcp-config-sources.js +418 -0
  480. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +86 -0
  481. package/src/runs/shared/mcp-direct-tool-allowlist.js +477 -0
  482. package/src/runs/shared/mcp-direct-tool-grant.d.ts +42 -0
  483. package/src/runs/shared/mcp-direct-tool-grant.js +159 -0
  484. package/src/runs/shared/model-resolution-diagnostic.d.ts +44 -0
  485. package/src/runs/shared/model-resolution-diagnostic.js +116 -0
  486. package/src/runs/shared/model-resolution.d.ts +109 -0
  487. package/src/runs/shared/model-resolution.js +411 -0
  488. package/src/runs/shared/model-scope.d.ts +68 -0
  489. package/src/runs/shared/model-scope.js +171 -0
  490. package/src/runs/shared/mutation-evidence.d.ts +18 -0
  491. package/src/runs/shared/mutation-evidence.js +198 -0
  492. package/src/runs/shared/nested-events.d.ts +135 -0
  493. package/src/runs/shared/nested-events.js +1090 -0
  494. package/src/runs/shared/nested-path.d.ts +8 -0
  495. package/src/runs/shared/nested-path.js +34 -0
  496. package/src/runs/shared/nested-render.d.ts +20 -0
  497. package/src/runs/shared/nested-render.js +115 -0
  498. package/src/runs/shared/orca-progress-tabs.d.ts +31 -0
  499. package/src/runs/shared/orca-progress-tabs.js +503 -0
  500. package/src/runs/shared/parallel-handoff.d.ts +78 -0
  501. package/src/runs/shared/parallel-handoff.js +783 -0
  502. package/src/runs/shared/parallel-utils.d.ts +177 -0
  503. package/src/runs/shared/parallel-utils.js +125 -0
  504. package/src/runs/shared/partial-output.d.ts +24 -0
  505. package/src/runs/shared/partial-output.js +35 -0
  506. package/src/runs/shared/permissions.d.ts +12 -0
  507. package/src/runs/shared/permissions.js +92 -0
  508. package/src/runs/shared/pi-spawn.d.ts +31 -0
  509. package/src/runs/shared/pi-spawn.js +211 -0
  510. package/src/runs/shared/placed-run-owner.d.ts +49 -0
  511. package/src/runs/shared/placed-run-owner.js +93 -0
  512. package/src/runs/shared/placement-host.d.ts +99 -0
  513. package/src/runs/shared/placement-host.js +157 -0
  514. package/src/runs/shared/process-signal.d.ts +15 -0
  515. package/src/runs/shared/process-signal.js +21 -0
  516. package/src/runs/shared/profile-extensions.d.ts +21 -0
  517. package/src/runs/shared/profile-extensions.js +122 -0
  518. package/src/runs/shared/profile-launch-env.d.ts +26 -0
  519. package/src/runs/shared/profile-launch-env.js +90 -0
  520. package/src/runs/shared/readonly-drain-observation.d.ts +25 -0
  521. package/src/runs/shared/readonly-drain-observation.js +50 -0
  522. package/src/runs/shared/rex-machine.d.ts +25 -0
  523. package/src/runs/shared/rex-machine.js +83 -0
  524. package/src/runs/shared/rex-pane-host.d.ts +62 -0
  525. package/src/runs/shared/rex-pane-host.js +327 -0
  526. package/src/runs/shared/run-fanout-budget.d.ts +14 -0
  527. package/src/runs/shared/run-fanout-budget.js +258 -0
  528. package/src/runs/shared/run-ownership.d.ts +3 -0
  529. package/src/runs/shared/run-ownership.js +8 -0
  530. package/src/runs/shared/runner-launcher.d.ts +11 -0
  531. package/src/runs/shared/runner-launcher.js +24 -0
  532. package/src/runs/shared/runtime-acknowledged-extensions.d.ts +7 -0
  533. package/src/runs/shared/runtime-acknowledged-extensions.js +44 -0
  534. package/src/runs/shared/sandbox-profile-guard.d.ts +23 -0
  535. package/src/runs/shared/sandbox-profile-guard.js +106 -0
  536. package/src/runs/shared/sandbox-startup-diagnostics.d.ts +21 -0
  537. package/src/runs/shared/sandbox-startup-diagnostics.js +51 -0
  538. package/src/runs/shared/session-lease.d.ts +69 -0
  539. package/src/runs/shared/session-lease.js +250 -0
  540. package/src/runs/shared/single-output.d.ts +90 -0
  541. package/src/runs/shared/single-output.js +349 -0
  542. package/src/runs/shared/spawn-budget.d.ts +20 -0
  543. package/src/runs/shared/spawn-budget.js +93 -0
  544. package/src/runs/shared/structured-output.d.ts +66 -0
  545. package/src/runs/shared/structured-output.js +483 -0
  546. package/src/runs/shared/subagent-control.d.ts +50 -0
  547. package/src/runs/shared/subagent-control.js +247 -0
  548. package/src/runs/shared/subagent-prompt-runtime.d.ts +90 -0
  549. package/src/runs/shared/subagent-prompt-runtime.js +776 -0
  550. package/src/runs/shared/tool-availability.d.ts +16 -0
  551. package/src/runs/shared/tool-availability.js +29 -0
  552. package/src/runs/shared/tool-budget.d.ts +21 -0
  553. package/src/runs/shared/tool-budget.js +78 -0
  554. package/src/runs/shared/tool-timeout.d.ts +31 -0
  555. package/src/runs/shared/tool-timeout.js +73 -0
  556. package/src/runs/shared/usage-budget.d.ts +7 -0
  557. package/src/runs/shared/usage-budget.js +74 -0
  558. package/src/runs/shared/usage-reconciliation.d.ts +8 -0
  559. package/src/runs/shared/usage-reconciliation.js +71 -0
  560. package/src/runs/shared/workflow-async-child-guidance.d.ts +3 -0
  561. package/src/runs/shared/workflow-async-child-guidance.js +17 -0
  562. package/src/runs/shared/workflow-graph.d.ts +31 -0
  563. package/src/runs/shared/workflow-graph.js +221 -0
  564. package/src/runs/shared/worktree-cleanup-apply.d.ts +36 -0
  565. package/src/runs/shared/worktree-cleanup-apply.js +178 -0
  566. package/src/runs/shared/worktree-cleanup-plan.d.ts +84 -0
  567. package/src/runs/shared/worktree-cleanup-plan.js +803 -0
  568. package/src/runs/shared/worktree-lock.d.ts +5 -0
  569. package/src/runs/shared/worktree-lock.js +40 -0
  570. package/src/runs/shared/worktree-setup-command.d.ts +38 -0
  571. package/src/runs/shared/worktree-setup-command.js +200 -0
  572. package/src/runs/shared/worktree.d.ts +181 -0
  573. package/src/runs/shared/worktree.js +1346 -0
  574. package/src/shared/accessible-dir.d.ts +11 -0
  575. package/src/shared/accessible-dir.js +39 -0
  576. package/src/shared/agent-stream-options.d.ts +5 -0
  577. package/src/shared/agent-stream-options.js +3 -0
  578. package/src/shared/artifacts.d.ts +22 -0
  579. package/src/shared/artifacts.js +272 -0
  580. package/src/shared/atomic-json.d.ts +19 -0
  581. package/src/shared/atomic-json.js +61 -0
  582. package/src/shared/capacity-resilient-json.d.ts +26 -0
  583. package/src/shared/capacity-resilient-json.js +86 -0
  584. package/src/shared/child-cache-retention.d.ts +29 -0
  585. package/src/shared/child-cache-retention.js +40 -0
  586. package/src/shared/child-session-name.d.ts +8 -0
  587. package/src/shared/child-session-name.js +40 -0
  588. package/src/shared/child-transcript.d.ts +37 -0
  589. package/src/shared/child-transcript.js +225 -0
  590. package/src/shared/completion-owner.d.ts +7 -0
  591. package/src/shared/completion-owner.js +13 -0
  592. package/src/shared/disabled-features.d.ts +93 -0
  593. package/src/shared/disabled-features.js +120 -0
  594. package/src/shared/display-text.d.ts +5 -0
  595. package/src/shared/display-text.js +154 -0
  596. package/src/shared/edit-distance.d.ts +4 -0
  597. package/src/shared/edit-distance.js +32 -0
  598. package/src/shared/extension-context.d.ts +21 -0
  599. package/src/shared/extension-context.js +39 -0
  600. package/src/shared/file-coalescer.d.ts +11 -0
  601. package/src/shared/file-coalescer.js +34 -0
  602. package/src/shared/file-lease.d.ts +10 -0
  603. package/src/shared/file-lease.js +106 -0
  604. package/src/shared/file-system-retry.d.ts +31 -0
  605. package/src/shared/file-system-retry.js +84 -0
  606. package/src/shared/fork-context.d.ts +64 -0
  607. package/src/shared/fork-context.js +185 -0
  608. package/src/shared/fork-session-cwd.d.ts +2 -0
  609. package/src/shared/fork-session-cwd.js +23 -0
  610. package/src/shared/formatters.d.ts +35 -0
  611. package/src/shared/formatters.js +137 -0
  612. package/src/shared/jsonl-writer.d.ts +20 -0
  613. package/src/shared/jsonl-writer.js +67 -0
  614. package/src/shared/launch-contract.d.ts +65 -0
  615. package/src/shared/launch-contract.js +145 -0
  616. package/src/shared/model-info.d.ts +55 -0
  617. package/src/shared/model-info.js +103 -0
  618. package/src/shared/model-response-aliases.d.ts +1 -0
  619. package/src/shared/model-response-aliases.js +15 -0
  620. package/src/shared/node-executable.d.ts +1 -0
  621. package/src/shared/node-executable.js +20 -0
  622. package/src/shared/opencode-session-headers.d.ts +12 -0
  623. package/src/shared/opencode-session-headers.js +26 -0
  624. package/src/shared/package-version.d.ts +2 -0
  625. package/src/shared/package-version.js +14 -0
  626. package/src/shared/parent-wake.d.ts +26 -0
  627. package/src/shared/parent-wake.js +68 -0
  628. package/src/shared/permission-profile.d.ts +26 -0
  629. package/src/shared/permission-profile.js +49 -0
  630. package/src/shared/prompt-resources.d.ts +5 -0
  631. package/src/shared/prompt-resources.js +10 -0
  632. package/src/shared/provider-diagnostics.d.ts +9 -0
  633. package/src/shared/provider-diagnostics.js +75 -0
  634. package/src/shared/pruned-fork.d.ts +34 -0
  635. package/src/shared/pruned-fork.js +434 -0
  636. package/src/shared/required-child-extensions.d.ts +34 -0
  637. package/src/shared/required-child-extensions.js +105 -0
  638. package/src/shared/runtime-module-path.d.ts +10 -0
  639. package/src/shared/runtime-module-path.js +16 -0
  640. package/src/shared/sandbox-profile.d.ts +12 -0
  641. package/src/shared/sandbox-profile.js +35 -0
  642. package/src/shared/session-file-trust.d.ts +1 -0
  643. package/src/shared/session-file-trust.js +20 -0
  644. package/src/shared/session-identity.d.ts +8 -0
  645. package/src/shared/session-identity.js +32 -0
  646. package/src/shared/session-succession.d.ts +4 -0
  647. package/src/shared/session-succession.js +24 -0
  648. package/src/shared/session-tokens.d.ts +2 -0
  649. package/src/shared/session-tokens.js +58 -0
  650. package/src/shared/settings-file-lease.d.ts +4 -0
  651. package/src/shared/settings-file-lease.js +38 -0
  652. package/src/shared/settings.d.ts +146 -0
  653. package/src/shared/settings.js +247 -0
  654. package/src/shared/shortcuts.d.ts +1 -0
  655. package/src/shared/shortcuts.js +17 -0
  656. package/src/shared/status-format.d.ts +9 -0
  657. package/src/shared/status-format.js +60 -0
  658. package/src/shared/thinking-ceiling.d.ts +13 -0
  659. package/src/shared/thinking-ceiling.js +37 -0
  660. package/src/shared/types.d.ts +2840 -0
  661. package/src/shared/types.js +276 -0
  662. package/src/shared/utf8.d.ts +5 -0
  663. package/src/shared/utf8.js +12 -0
  664. package/src/shared/utils.d.ts +83 -0
  665. package/src/shared/utils.js +612 -0
  666. package/src/shared/watch-strategy.d.ts +2 -0
  667. package/src/shared/watch-strategy.js +5 -0
  668. package/src/shared/workflow-child-permit.d.ts +58 -0
  669. package/src/shared/workflow-child-permit.js +159 -0
  670. package/src/slash/delegation-adapters.d.ts +154 -0
  671. package/src/slash/delegation-adapters.js +316 -0
  672. package/src/slash/delegation-json.d.ts +10 -0
  673. package/src/slash/delegation-json.js +117 -0
  674. package/src/slash/delegation-request.d.ts +12 -0
  675. package/src/slash/delegation-request.js +174 -0
  676. package/src/slash/prompt-template-bridge.d.ts +29 -0
  677. package/src/slash/prompt-template-bridge.js +399 -0
  678. package/src/slash/prompt-workflows.d.ts +21 -0
  679. package/src/slash/prompt-workflows.js +274 -0
  680. package/src/slash/selector.d.ts +47 -0
  681. package/src/slash/selector.js +117 -0
  682. package/src/slash/slash-bridge.d.ts +30 -0
  683. package/src/slash/slash-bridge.js +132 -0
  684. package/src/slash/slash-commands.d.ts +10 -0
  685. package/src/slash/slash-commands.js +1059 -0
  686. package/src/slash/slash-live-state.d.ts +21 -0
  687. package/src/slash/slash-live-state.js +263 -0
  688. package/src/slash/subagent-cost.d.ts +29 -0
  689. package/src/slash/subagent-cost.js +310 -0
  690. package/src/slash/subagents-admin.d.ts +3 -0
  691. package/src/slash/subagents-admin.js +481 -0
  692. package/src/tui/fleet-layout.d.ts +20 -0
  693. package/src/tui/fleet-layout.js +17 -0
  694. package/src/tui/fleet-native-transcript.d.ts +53 -0
  695. package/src/tui/fleet-native-transcript.js +339 -0
  696. package/src/tui/fleet-status.d.ts +92 -0
  697. package/src/tui/fleet-status.js +1132 -0
  698. package/src/tui/fleet-transcript.d.ts +64 -0
  699. package/src/tui/fleet-transcript.js +544 -0
  700. package/src/tui/fleet-viewport.d.ts +12 -0
  701. package/src/tui/fleet-viewport.js +35 -0
  702. package/src/tui/fleet.d.ts +196 -0
  703. package/src/tui/fleet.js +1588 -0
  704. package/src/tui/mouse-events.d.ts +21 -0
  705. package/src/tui/mouse-events.js +26 -0
  706. package/src/tui/render-helpers.d.ts +23 -0
  707. package/src/tui/render-helpers.js +100 -0
  708. package/src/tui/render.d.ts +66 -0
  709. package/src/tui/render.js +3707 -0
  710. package/src/tui/running-tone.d.ts +10 -0
  711. package/src/tui/running-tone.js +22 -0
  712. package/src/tui/subagent-messages.d.ts +22 -0
  713. package/src/tui/subagent-messages.js +270 -0
  714. package/src/ui-silent-marker.d.ts +20 -0
  715. package/src/ui-silent-marker.js +25 -0
  716. package/src/watchdog/change-signature.d.ts +7 -0
  717. package/src/watchdog/change-signature.js +243 -0
  718. package/src/watchdog/child-status.d.ts +53 -0
  719. package/src/watchdog/child-status.js +187 -0
  720. package/src/watchdog/diff-tool.d.ts +25 -0
  721. package/src/watchdog/diff-tool.js +104 -0
  722. package/src/watchdog/emission-guard.d.ts +36 -0
  723. package/src/watchdog/emission-guard.js +97 -0
  724. package/src/watchdog/guidance.d.ts +3 -0
  725. package/src/watchdog/guidance.js +19 -0
  726. package/src/watchdog/lsp-diagnostics.d.ts +17 -0
  727. package/src/watchdog/lsp-diagnostics.js +489 -0
  728. package/src/watchdog/model-selection.d.ts +24 -0
  729. package/src/watchdog/model-selection.js +167 -0
  730. package/src/watchdog/permission-arbiter.d.ts +20 -0
  731. package/src/watchdog/permission-arbiter.js +135 -0
  732. package/src/watchdog/register-child.d.ts +13 -0
  733. package/src/watchdog/register-child.js +128 -0
  734. package/src/watchdog/register-main.d.ts +11 -0
  735. package/src/watchdog/register-main.js +400 -0
  736. package/src/watchdog/render.d.ts +3 -0
  737. package/src/watchdog/render.js +33 -0
  738. package/src/watchdog/review.d.ts +36 -0
  739. package/src/watchdog/review.js +319 -0
  740. package/src/watchdog/rules.d.ts +21 -0
  741. package/src/watchdog/rules.js +58 -0
  742. package/src/watchdog/runtime.d.ts +195 -0
  743. package/src/watchdog/runtime.js +864 -0
  744. package/src/watchdog/scope.d.ts +14 -0
  745. package/src/watchdog/scope.js +44 -0
  746. package/src/watchdog/settings.d.ts +29 -0
  747. package/src/watchdog/settings.js +480 -0
  748. package/src/watchdog/tool-actions.d.ts +17 -0
  749. package/src/watchdog/tool-actions.js +150 -0
  750. package/src/watchdog/turn-delta.d.ts +15 -0
  751. package/src/watchdog/turn-delta.js +188 -0
  752. package/src/watchdog/types.d.ts +141 -0
  753. package/src/watchdog/types.js +27 -0
  754. package/src/watchdog/warning-format.d.ts +7 -0
  755. package/src/watchdog/warning-format.js +59 -0
  756. package/src/workflows/chat-progress.d.ts +37 -0
  757. package/src/workflows/chat-progress.js +129 -0
  758. package/src/workflows/host-command.d.ts +30 -0
  759. package/src/workflows/host-command.js +227 -0
  760. package/src/workflows/scripted-workflow.d.ts +204 -0
  761. package/src/workflows/scripted-workflow.js +1673 -0
  762. package/src/workflows/structured-workflow-scripts.d.ts +10 -0
  763. package/src/workflows/structured-workflow-scripts.js +179 -0
  764. package/src/workflows/workflow-auto-resume.d.ts +32 -0
  765. package/src/workflows/workflow-auto-resume.js +102 -0
  766. package/src/workflows/workflow-checklist.d.ts +127 -0
  767. package/src/workflows/workflow-checklist.js +314 -0
  768. package/src/workflows/workflow-child-summary.d.ts +24 -0
  769. package/src/workflows/workflow-child-summary.js +195 -0
  770. package/src/workflows/workflow-launch-record.d.ts +27 -0
  771. package/src/workflows/workflow-launch-record.js +48 -0
  772. package/src/workflows/workflow-preflight.d.ts +58 -0
  773. package/src/workflows/workflow-preflight.js +288 -0
  774. package/src/workflows/workflow-receipt.d.ts +34 -0
  775. package/src/workflows/workflow-receipt.js +454 -0
  776. package/src/workflows/workflow-resources.d.ts +55 -0
  777. package/src/workflows/workflow-resources.js +271 -0
  778. package/src/workflows/workflow-resume-claim.d.ts +82 -0
  779. package/src/workflows/workflow-resume-claim.js +210 -0
  780. package/src/workflows/workflow-resume.d.ts +56 -0
  781. package/src/workflows/workflow-resume.js +106 -0
  782. package/src/workflows/workflow-reuse.d.ts +61 -0
  783. package/src/workflows/workflow-reuse.js +186 -0
  784. package/src/workflows/workflow-revival.d.ts +33 -0
  785. package/src/workflows/workflow-revival.js +111 -0
  786. package/src/workflows/workflow-settlement.d.ts +84 -0
  787. package/src/workflows/workflow-settlement.js +203 -0
  788. package/src/workflows/workflow-stop-cause.d.ts +6 -0
  789. package/src/workflows/workflow-stop-cause.js +8 -0
  790. package/workflow-script-worker.cjs +1342 -0
  791. package/index.ts +0 -18
  792. package/node_modules/@xzzpig/pi-components/src/transcript.ts +0 -1878
  793. package/skills/pi-subagents/references/constraints-and-recipes.md +0 -74
  794. package/skills/pi-subagents/references/execution-controls.md +0 -561
  795. package/skills/pi-subagents/references/management-authoring-rpc.md +0 -165
  796. package/skills/pi-subagents/references/multi-lane-orchestration.md +0 -61
  797. package/skills/pi-subagents/references/review-and-validation.md +0 -73
  798. package/src/agents/advertised-agent-prompt.ts +0 -82
  799. package/src/agents/agent-eject.ts +0 -339
  800. package/src/agents/agent-management.ts +0 -1442
  801. package/src/agents/agent-memory.ts +0 -341
  802. package/src/agents/agent-refinements.ts +0 -624
  803. package/src/agents/agent-scope.ts +0 -10
  804. package/src/agents/agent-selection.ts +0 -25
  805. package/src/agents/agent-serializer.ts +0 -195
  806. package/src/agents/agents.ts +0 -3169
  807. package/src/agents/builtin-names.ts +0 -16
  808. package/src/agents/chain-serializer.ts +0 -285
  809. package/src/agents/frontmatter.ts +0 -153
  810. package/src/agents/global-npm-root.ts +0 -58
  811. package/src/agents/identity.ts +0 -30
  812. package/src/agents/proactive-skills.ts +0 -197
  813. package/src/agents/runtime-agent-events.ts +0 -70
  814. package/src/agents/runtime-agent-registry.ts +0 -457
  815. package/src/agents/runtime-discovery.ts +0 -39
  816. package/src/agents/skills.ts +0 -787
  817. package/src/api/agent-management.ts +0 -9
  818. package/src/api/agents.ts +0 -19
  819. package/src/api/background-work.ts +0 -206
  820. package/src/api/capability-ceiling.ts +0 -16
  821. package/src/api/child-tool-plan.ts +0 -5
  822. package/src/api/control-channel.ts +0 -4
  823. package/src/api/delegation.ts +0 -131
  824. package/src/api/external-job-provider.ts +0 -195
  825. package/src/api/external-runs.ts +0 -282
  826. package/src/api/inspectors.ts +0 -27
  827. package/src/api/intercom-bridge.ts +0 -3
  828. package/src/api/preflight.ts +0 -641
  829. package/src/api/project-panes.ts +0 -32
  830. package/src/api/required-child-extensions.ts +0 -6
  831. package/src/api/shared-types.ts +0 -29
  832. package/src/api/supervisor-routing.ts +0 -196
  833. package/src/api/workflow-resources.ts +0 -6
  834. package/src/extension/config.ts +0 -262
  835. package/src/extension/context-injection.ts +0 -123
  836. package/src/extension/control-notices.ts +0 -53
  837. package/src/extension/declaration-pinning.ts +0 -164
  838. package/src/extension/doctor.ts +0 -284
  839. package/src/extension/fanout-child.ts +0 -282
  840. package/src/extension/herdr-pi-bridge.ts +0 -166
  841. package/src/extension/index.ts +0 -1212
  842. package/src/extension/public-execution.ts +0 -262
  843. package/src/extension/reply-workflow-script.ts +0 -67
  844. package/src/extension/rpc.ts +0 -881
  845. package/src/extension/schemas.ts +0 -337
  846. package/src/extension/steering-notices.ts +0 -35
  847. package/src/extension/subagent-guide.ts +0 -127
  848. package/src/extension/subagent-options.ts +0 -47
  849. package/src/extension/tool-activation.ts +0 -147
  850. package/src/extension/tool-description.ts +0 -193
  851. package/src/extension/tool-result.ts +0 -19
  852. package/src/extension/upgrade-notice.ts +0 -40
  853. package/src/inspectors/actions.ts +0 -174
  854. package/src/inspectors/ghostty/actions.ts +0 -74
  855. package/src/inspectors/ghostty/plugin.ts +0 -29
  856. package/src/inspectors/herdr/actions.ts +0 -155
  857. package/src/inspectors/herdr/client.ts +0 -130
  858. package/src/inspectors/herdr/focus.ts +0 -55
  859. package/src/inspectors/herdr/plugin.ts +0 -20
  860. package/src/inspectors/herdr/project-panes.ts +0 -733
  861. package/src/inspectors/inspector-runner.ts +0 -153
  862. package/src/inspectors/plugins.ts +0 -76
  863. package/src/inspectors/session-roots-codec.ts +0 -31
  864. package/src/inspectors/shell-command.ts +0 -16
  865. package/src/inspectors/tmux/actions.ts +0 -204
  866. package/src/inspectors/tmux/client.ts +0 -85
  867. package/src/inspectors/tmux/plugin.ts +0 -21
  868. package/src/inspectors/types.ts +0 -51
  869. package/src/integrations/herdr-status.ts +0 -385
  870. package/src/integrations/pi-web-session-liveness.ts +0 -73
  871. package/src/integrations/program-status.ts +0 -215
  872. package/src/intercom/fork-supervisor-routing.ts +0 -533
  873. package/src/intercom/intercom-bridge.ts +0 -235
  874. package/src/intercom/native-supervisor-channel.ts +0 -1066
  875. package/src/intercom/result-intercom.ts +0 -433
  876. package/src/intercom/supervisor-ui.ts +0 -72
  877. package/src/missions/actions.ts +0 -433
  878. package/src/missions/goal-driver.ts +0 -177
  879. package/src/missions/lifecycle.ts +0 -367
  880. package/src/missions/store.ts +0 -613
  881. package/src/missions/types.ts +0 -190
  882. package/src/missions/workflow-state.ts +0 -281
  883. package/src/policy/authority.ts +0 -50
  884. package/src/profiles/profiles.ts +0 -674
  885. package/src/runs/background/active-async-capacity.ts +0 -548
  886. package/src/runs/background/active-run-index.ts +0 -155
  887. package/src/runs/background/async-execution.ts +0 -2479
  888. package/src/runs/background/async-job-tracker.ts +0 -869
  889. package/src/runs/background/async-resume.ts +0 -686
  890. package/src/runs/background/async-retention.ts +0 -953
  891. package/src/runs/background/async-status-snapshot.ts +0 -46
  892. package/src/runs/background/async-status.ts +0 -787
  893. package/src/runs/background/auto-drain.ts +0 -92
  894. package/src/runs/background/await-async-run.ts +0 -83
  895. package/src/runs/background/binary-bootstrap.ts +0 -67
  896. package/src/runs/background/calendar-schedule.ts +0 -90
  897. package/src/runs/background/chain-append.ts +0 -321
  898. package/src/runs/background/chain-root-attachment.ts +0 -263
  899. package/src/runs/background/completion-batcher.ts +0 -168
  900. package/src/runs/background/completion-dedupe.ts +0 -58
  901. package/src/runs/background/completion-replay.ts +0 -287
  902. package/src/runs/background/control-channel.ts +0 -659
  903. package/src/runs/background/fleet-view.ts +0 -692
  904. package/src/runs/background/index-segment.ts +0 -59
  905. package/src/runs/background/inspect-rpc.ts +0 -443
  906. package/src/runs/background/notify.ts +0 -1083
  907. package/src/runs/background/owned-process-tree.ts +0 -131
  908. package/src/runs/background/parallel-groups.ts +0 -45
  909. package/src/runs/background/pid-namespace.ts +0 -18
  910. package/src/runs/background/process-terminal-candidate.ts +0 -98
  911. package/src/runs/background/process-terminal.ts +0 -231
  912. package/src/runs/background/result-delivery-ownership.ts +0 -45
  913. package/src/runs/background/result-files.ts +0 -634
  914. package/src/runs/background/result-watcher.ts +0 -842
  915. package/src/runs/background/resume-guidance.ts +0 -56
  916. package/src/runs/background/retained-children.ts +0 -136
  917. package/src/runs/background/retained-nested-route-tracker.ts +0 -96
  918. package/src/runs/background/run-child-session.ts +0 -725
  919. package/src/runs/background/run-id-query.ts +0 -7
  920. package/src/runs/background/run-id-resolver.ts +0 -183
  921. package/src/runs/background/run-status.ts +0 -803
  922. package/src/runs/background/runner-aliases.ts +0 -183
  923. package/src/runs/background/runner-child-launch.ts +0 -96
  924. package/src/runs/background/runner-child-sessions.ts +0 -32
  925. package/src/runs/background/runner-http-dispatcher.ts +0 -122
  926. package/src/runs/background/runner-startup-failure.ts +0 -56
  927. package/src/runs/background/scheduled-runs.ts +0 -1222
  928. package/src/runs/background/stale-run-reconciler.ts +0 -463
  929. package/src/runs/background/steering.ts +0 -260
  930. package/src/runs/background/subagent-runner-bootstrap.ts +0 -279
  931. package/src/runs/background/subagent-runner.ts +0 -5251
  932. package/src/runs/background/subagent-wait.ts +0 -895
  933. package/src/runs/background/terminal-run-index.ts +0 -183
  934. package/src/runs/background/top-level-async.ts +0 -14
  935. package/src/runs/background/wait-completions.ts +0 -262
  936. package/src/runs/background/wait-config.ts +0 -50
  937. package/src/runs/background/wait-subscriptions.ts +0 -354
  938. package/src/runs/background/wait-tool.ts +0 -57
  939. package/src/runs/background/workflow-terminal-proof.ts +0 -85
  940. package/src/runs/foreground/async-dismiss-action.ts +0 -86
  941. package/src/runs/foreground/async-steering-action.ts +0 -276
  942. package/src/runs/foreground/async-stop-action.ts +0 -216
  943. package/src/runs/foreground/command-action.ts +0 -41
  944. package/src/runs/foreground/execution.ts +0 -2315
  945. package/src/runs/foreground/foreground-control.ts +0 -157
  946. package/src/runs/foreground/foreground-history.ts +0 -164
  947. package/src/runs/foreground/prompt-audit.ts +0 -172
  948. package/src/runs/foreground/subagent-executor.ts +0 -8252
  949. package/src/runs/foreground/workflow-detach-reconcile.ts +0 -304
  950. package/src/runs/foreground/workflow-foreground-steering.ts +0 -169
  951. package/src/runs/shared/abort-recovery.ts +0 -119
  952. package/src/runs/shared/acceptance.ts +0 -1664
  953. package/src/runs/shared/agent-contract.ts +0 -38
  954. package/src/runs/shared/async-status-projection.ts +0 -664
  955. package/src/runs/shared/background-process-options.ts +0 -9
  956. package/src/runs/shared/capability-ceiling.ts +0 -214
  957. package/src/runs/shared/chain-outputs.ts +0 -116
  958. package/src/runs/shared/child-commands.ts +0 -229
  959. package/src/runs/shared/child-hooks.ts +0 -175
  960. package/src/runs/shared/child-identity.ts +0 -62
  961. package/src/runs/shared/child-launch-plan.ts +0 -163
  962. package/src/runs/shared/child-launch.ts +0 -389
  963. package/src/runs/shared/child-lifecycle.ts +0 -28
  964. package/src/runs/shared/child-runtime-config.ts +0 -136
  965. package/src/runs/shared/child-session.ts +0 -699
  966. package/src/runs/shared/child-tool-plan.ts +0 -599
  967. package/src/runs/shared/claude-code-adapter.ts +0 -288
  968. package/src/runs/shared/codex-exec-adapter.ts +0 -129
  969. package/src/runs/shared/context-mode.ts +0 -44
  970. package/src/runs/shared/cursor-agent-adapter.ts +0 -114
  971. package/src/runs/shared/dynamic-fanout.ts +0 -297
  972. package/src/runs/shared/effective-system-prompt.ts +0 -33
  973. package/src/runs/shared/extension-bindings.ts +0 -103
  974. package/src/runs/shared/external-cli-contract.ts +0 -177
  975. package/src/runs/shared/external-cli-preflight.ts +0 -190
  976. package/src/runs/shared/external-cli-runner.ts +0 -437
  977. package/src/runs/shared/external-job-bridge.ts +0 -514
  978. package/src/runs/shared/external-job-runner.ts +0 -389
  979. package/src/runs/shared/fast-mode-extension.ts +0 -10
  980. package/src/runs/shared/fork-command-result.ts +0 -10
  981. package/src/runs/shared/git-environment.ts +0 -29
  982. package/src/runs/shared/herdr-connection.ts +0 -134
  983. package/src/runs/shared/herdr-external-adapters.ts +0 -169
  984. package/src/runs/shared/herdr-machine.ts +0 -279
  985. package/src/runs/shared/herdr-pi-protocol.ts +0 -59
  986. package/src/runs/shared/herdr-placed-run.ts +0 -264
  987. package/src/runs/shared/host-step-status.ts +0 -231
  988. package/src/runs/shared/lane-metadata.ts +0 -126
  989. package/src/runs/shared/launch-cwd.ts +0 -16
  990. package/src/runs/shared/long-running-guard.ts +0 -221
  991. package/src/runs/shared/mcp-config-sources.ts +0 -426
  992. package/src/runs/shared/mcp-direct-tool-allowlist.ts +0 -579
  993. package/src/runs/shared/mcp-direct-tool-grant.ts +0 -210
  994. package/src/runs/shared/model-resolution-diagnostic.ts +0 -101
  995. package/src/runs/shared/model-resolution.ts +0 -503
  996. package/src/runs/shared/model-scope.ts +0 -224
  997. package/src/runs/shared/mutation-evidence.ts +0 -199
  998. package/src/runs/shared/nested-events.ts +0 -1125
  999. package/src/runs/shared/nested-path.ts +0 -38
  1000. package/src/runs/shared/nested-render.ts +0 -127
  1001. package/src/runs/shared/orca-progress-tabs.ts +0 -511
  1002. package/src/runs/shared/parallel-handoff.ts +0 -789
  1003. package/src/runs/shared/parallel-utils.ts +0 -292
  1004. package/src/runs/shared/partial-output.ts +0 -48
  1005. package/src/runs/shared/permissions.ts +0 -86
  1006. package/src/runs/shared/pi-spawn.ts +0 -205
  1007. package/src/runs/shared/process-signal.ts +0 -35
  1008. package/src/runs/shared/profile-extensions.ts +0 -134
  1009. package/src/runs/shared/profile-launch-env.ts +0 -121
  1010. package/src/runs/shared/readonly-drain-observation.ts +0 -42
  1011. package/src/runs/shared/run-fanout-budget.ts +0 -267
  1012. package/src/runs/shared/run-history.ts +0 -288
  1013. package/src/runs/shared/runner-launcher.ts +0 -25
  1014. package/src/runs/shared/runtime-acknowledged-extensions.ts +0 -44
  1015. package/src/runs/shared/sandbox-profile-guard.ts +0 -119
  1016. package/src/runs/shared/sandbox-startup-diagnostics.ts +0 -54
  1017. package/src/runs/shared/session-lease.ts +0 -293
  1018. package/src/runs/shared/single-output.ts +0 -366
  1019. package/src/runs/shared/spawn-budget.ts +0 -128
  1020. package/src/runs/shared/structured-output.ts +0 -463
  1021. package/src/runs/shared/subagent-control.ts +0 -295
  1022. package/src/runs/shared/subagent-prompt-runtime.ts +0 -598
  1023. package/src/runs/shared/tool-availability.ts +0 -37
  1024. package/src/runs/shared/tool-budget.ts +0 -87
  1025. package/src/runs/shared/tool-timeout.ts +0 -93
  1026. package/src/runs/shared/usage-budget.ts +0 -65
  1027. package/src/runs/shared/usage-reconciliation.ts +0 -73
  1028. package/src/runs/shared/workflow-async-child-guidance.ts +0 -18
  1029. package/src/runs/shared/workflow-graph.ts +0 -225
  1030. package/src/runs/shared/worktree-cleanup-apply.ts +0 -160
  1031. package/src/runs/shared/worktree-cleanup-plan.ts +0 -891
  1032. package/src/runs/shared/worktree-lock.ts +0 -29
  1033. package/src/runs/shared/worktree-setup-command.ts +0 -213
  1034. package/src/runs/shared/worktree.ts +0 -1554
  1035. package/src/shared/accessible-dir.ts +0 -47
  1036. package/src/shared/agent-stream-options.ts +0 -5
  1037. package/src/shared/artifacts.ts +0 -281
  1038. package/src/shared/atomic-json.ts +0 -85
  1039. package/src/shared/capacity-resilient-json.ts +0 -102
  1040. package/src/shared/child-cache-retention.ts +0 -43
  1041. package/src/shared/child-session-name.ts +0 -48
  1042. package/src/shared/child-transcript.ts +0 -264
  1043. package/src/shared/completion-owner.ts +0 -14
  1044. package/src/shared/disabled-features.ts +0 -123
  1045. package/src/shared/display-text.ts +0 -150
  1046. package/src/shared/edit-distance.ts +0 -33
  1047. package/src/shared/extension-context.ts +0 -37
  1048. package/src/shared/file-coalescer.ts +0 -49
  1049. package/src/shared/file-lease.ts +0 -74
  1050. package/src/shared/file-system-retry.ts +0 -95
  1051. package/src/shared/fork-context.ts +0 -243
  1052. package/src/shared/fork-session-cwd.ts +0 -27
  1053. package/src/shared/formatters.ts +0 -142
  1054. package/src/shared/jsonl-writer.ts +0 -92
  1055. package/src/shared/launch-contract.ts +0 -206
  1056. package/src/shared/model-info.ts +0 -132
  1057. package/src/shared/model-response-aliases.ts +0 -13
  1058. package/src/shared/node-executable.ts +0 -21
  1059. package/src/shared/opencode-session-headers.ts +0 -30
  1060. package/src/shared/package-version.ts +0 -17
  1061. package/src/shared/parent-wake.ts +0 -79
  1062. package/src/shared/permission-profile.ts +0 -56
  1063. package/src/shared/prompt-resources.ts +0 -11
  1064. package/src/shared/pruned-fork.ts +0 -469
  1065. package/src/shared/required-child-extensions.ts +0 -115
  1066. package/src/shared/runtime-module-path.ts +0 -19
  1067. package/src/shared/sandbox-profile.ts +0 -37
  1068. package/src/shared/session-file-trust.ts +0 -19
  1069. package/src/shared/session-identity.ts +0 -10
  1070. package/src/shared/session-tokens.ts +0 -55
  1071. package/src/shared/settings-file-lease.ts +0 -36
  1072. package/src/shared/settings.ts +0 -412
  1073. package/src/shared/shortcuts.ts +0 -13
  1074. package/src/shared/status-format.ts +0 -55
  1075. package/src/shared/thinking-ceiling.ts +0 -46
  1076. package/src/shared/types.ts +0 -3105
  1077. package/src/shared/utf8.ts +0 -11
  1078. package/src/shared/utils.ts +0 -610
  1079. package/src/shared/watch-strategy.ts +0 -12
  1080. package/src/shared/workflow-child-permit.ts +0 -212
  1081. package/src/slash/delegation-adapters.ts +0 -452
  1082. package/src/slash/delegation-json.ts +0 -108
  1083. package/src/slash/delegation-request.ts +0 -176
  1084. package/src/slash/prompt-template-bridge.ts +0 -435
  1085. package/src/slash/prompt-workflows.ts +0 -298
  1086. package/src/slash/selector.ts +0 -147
  1087. package/src/slash/slash-bridge.ts +0 -192
  1088. package/src/slash/slash-commands.ts +0 -1096
  1089. package/src/slash/slash-live-state.ts +0 -310
  1090. package/src/slash/subagent-cost.ts +0 -317
  1091. package/src/slash/subagents-admin.ts +0 -489
  1092. package/src/tui/fleet-native-transcript.ts +0 -424
  1093. package/src/tui/fleet-status.ts +0 -1139
  1094. package/src/tui/fleet-transcript.ts +0 -591
  1095. package/src/tui/fleet.ts +0 -1618
  1096. package/src/tui/mouse-events.ts +0 -42
  1097. package/src/tui/render-helpers.ts +0 -111
  1098. package/src/tui/render.ts +0 -3824
  1099. package/src/tui/running-tone.ts +0 -28
  1100. package/src/tui/subagent-messages.ts +0 -305
  1101. package/src/ui-silent-marker.ts +0 -32
  1102. package/src/watchdog/change-signature.ts +0 -260
  1103. package/src/watchdog/child-status.ts +0 -225
  1104. package/src/watchdog/diff-tool.ts +0 -112
  1105. package/src/watchdog/emission-guard.ts +0 -125
  1106. package/src/watchdog/guidance.ts +0 -20
  1107. package/src/watchdog/lsp-diagnostics.ts +0 -538
  1108. package/src/watchdog/model-selection.ts +0 -187
  1109. package/src/watchdog/permission-arbiter.ts +0 -154
  1110. package/src/watchdog/register-child.ts +0 -136
  1111. package/src/watchdog/register-main.ts +0 -425
  1112. package/src/watchdog/render.ts +0 -31
  1113. package/src/watchdog/review.ts +0 -362
  1114. package/src/watchdog/rules.ts +0 -70
  1115. package/src/watchdog/runtime.ts +0 -927
  1116. package/src/watchdog/scope.ts +0 -51
  1117. package/src/watchdog/settings.ts +0 -520
  1118. package/src/watchdog/tool-actions.ts +0 -156
  1119. package/src/watchdog/turn-delta.ts +0 -190
  1120. package/src/watchdog/types.ts +0 -186
  1121. package/src/watchdog/warning-format.ts +0 -72
  1122. package/src/workflows/chat-progress.ts +0 -152
  1123. package/src/workflows/host-command.ts +0 -235
  1124. package/src/workflows/scripted-workflow.ts +0 -2733
  1125. package/src/workflows/structured-workflow-scripts.ts +0 -177
  1126. package/src/workflows/workflow-checklist.ts +0 -442
  1127. package/src/workflows/workflow-child-summary.ts +0 -172
  1128. package/src/workflows/workflow-preflight.ts +0 -297
  1129. package/src/workflows/workflow-receipt.ts +0 -390
  1130. package/src/workflows/workflow-resources.ts +0 -275
  1131. package/src/workflows/workflow-reuse.ts +0 -120
  1132. package/src/workflows/workflow-revival.ts +0 -123
  1133. package/src/workflows/workflow-settlement.ts +0 -252
@@ -0,0 +1,2840 @@
1
+ /**
2
+ * Type definitions for the subagent extension
3
+ */
4
+ import type { Message } from "@earendil-works/pi-ai";
5
+ import type { SubagentDelegationProviderDiagnostics } from "../api/delegation.ts";
6
+ import type { AgentConfig } from "../agents/agents.ts";
7
+ import type { FSWatcher } from "node:fs";
8
+ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
9
+ import type { ModelScopeRule } from "../runs/shared/model-scope.ts";
10
+ import type { ResolvedSubagentCapabilityCeiling, SubagentCapabilityAudit } from "../runs/shared/capability-ceiling.ts";
11
+ import type { AuthorityPolicyConfig } from "../policy/authority.ts";
12
+ import type { ThinkingLevel } from "./model-info.ts";
13
+ import type { SubagentFeature } from "./disabled-features.ts";
14
+ import type { GlobalMissionIndexRecord, MissionRecord, MissionStoreConfig } from "../missions/types.ts";
15
+ import type { ExtensionBindings } from "../runs/shared/extension-bindings.ts";
16
+ import type { WorkflowChildPermitContext } from "./workflow-child-permit.ts";
17
+ import type { WatchdogWarningDetails } from "../watchdog/types.ts";
18
+ import type { RequiredChildExtensionSnapshot } from "./required-child-extensions.ts";
19
+ import type { RecordedPid } from "../runs/background/stale-run-reconciler.ts";
20
+ import type { WorkflowStopCause } from "../workflows/workflow-stop-cause.ts";
21
+ export interface MaxOutputConfig {
22
+ bytes?: number;
23
+ lines?: number;
24
+ }
25
+ export type OutputMode = "inline" | "file-only";
26
+ export type AcceptanceRole = "read-only" | "writer";
27
+ export type JsonSchemaObject = Record<string, unknown>;
28
+ export interface ChainOutputMapEntry {
29
+ text: string;
30
+ structured?: unknown;
31
+ agent: string;
32
+ stepIndex: number;
33
+ }
34
+ export type ChainOutputMap = Record<string, ChainOutputMapEntry>;
35
+ export type WorkflowNodeStatus = "pending" | "running" | "completed" | "failed" | "partial" | "paused" | "stopped" | "detached" | "rejected";
36
+ export type HostStepMonitorKind = "command" | "ci" | "gate";
37
+ export type HostStepState = "pending" | "running" | "done" | "cancelled" | "error";
38
+ export type HostStepVerdict = "pass" | "fail" | "inconclusive";
39
+ export interface HostStepFreshness {
40
+ expectedRef: string;
41
+ observedRef?: string;
42
+ stale?: boolean;
43
+ }
44
+ /** Bounded, provider-agnostic status for a host-owned workflow monitor. */
45
+ export interface HostStepNode {
46
+ version: 1;
47
+ kind: "host-step";
48
+ /** Explicit monitor category; never inferred from labels or commands. */
49
+ monitorKind: HostStepMonitorKind;
50
+ id: string;
51
+ label: string;
52
+ role?: string;
53
+ provider?: string;
54
+ state: HostStepState;
55
+ verdict?: HostStepVerdict;
56
+ reasonCode?: string;
57
+ detail?: string;
58
+ target?: string;
59
+ freshness?: HostStepFreshness;
60
+ reportPath?: string;
61
+ exitCode?: number | null;
62
+ updatedAt: number;
63
+ deadlineAt?: number;
64
+ }
65
+ export interface WorkflowGraphNode {
66
+ id: string;
67
+ kind: "step" | "parallel-group" | "dynamic-parallel-group" | "agent" | "host-step";
68
+ agent?: string;
69
+ phase?: string;
70
+ label: string;
71
+ status: WorkflowNodeStatus;
72
+ flatIndex?: number;
73
+ stepIndex?: number;
74
+ children?: WorkflowGraphNode[];
75
+ dynamic?: {
76
+ sourceOutput: string;
77
+ sourcePath: string;
78
+ itemName: string;
79
+ maxItems?: number;
80
+ collectAs?: string;
81
+ };
82
+ itemKey?: string;
83
+ outputName?: string;
84
+ structured?: boolean;
85
+ acceptanceStatus?: AcceptanceLedgerStatus;
86
+ error?: string;
87
+ hostStep?: HostStepNode;
88
+ }
89
+ export interface WorkflowGraphSnapshot {
90
+ runId: string;
91
+ mode: SubagentRunMode;
92
+ phases: Array<{
93
+ title: string;
94
+ nodeIds: string[];
95
+ }>;
96
+ nodes: WorkflowGraphNode[];
97
+ currentNodeId?: string;
98
+ }
99
+ export type WorkflowPreflightCoverage = "complete" | "partial";
100
+ export type WorkflowPreflightMode = "mutation" | "review" | "scout" | "gate";
101
+ /** Bounded, display-only lane hints supplied alongside a workflowScript launch. */
102
+ export interface WorkflowPreflightLane {
103
+ key: string;
104
+ mode?: WorkflowPreflightMode;
105
+ decision?: string;
106
+ claims?: string[];
107
+ expectedOutput?: string;
108
+ independence?: string;
109
+ }
110
+ /** Versioned, display-only workflow launch plan; it never grants launch authority. */
111
+ export interface WorkflowPreflight {
112
+ version: 1;
113
+ coverage: WorkflowPreflightCoverage;
114
+ lanes: WorkflowPreflightLane[];
115
+ }
116
+ export type WorkflowReceiptState = "complete" | "failed" | "paused" | "stopped";
117
+ export type WorkflowScriptFailureKind = "validation" | "script" | "child" | "return-serialization" | "timeout" | "detached-child" | "runtime";
118
+ export type WorkflowTerminalResolution = "settled-awaiting-resume" | "failed-child" | "interrupted-child";
119
+ export interface WorkflowTerminalOutcome {
120
+ state: "partial";
121
+ reason: "budget_exhausted" | "timeout";
122
+ }
123
+ export interface WorkflowRecoveryAction {
124
+ key: string;
125
+ call: "runs.run";
126
+ resume: {
127
+ workflowRunId: string;
128
+ key: string;
129
+ latest: true;
130
+ };
131
+ taskRequired: true;
132
+ }
133
+ /**
134
+ * Bounded, host-generated identity for a resolved pi-subagents workflow resource.
135
+ * Permission/policy extensions can use it to distinguish resolved content from
136
+ * raw workflow scripts. This audit projection never grants execution authority.
137
+ */
138
+ export interface WorkflowResourceProvenance {
139
+ kind: "workflow";
140
+ name: string;
141
+ version: number;
142
+ invocation: "named";
143
+ expansion: "resolved";
144
+ id: string;
145
+ }
146
+ /**
147
+ * Bounded, launch-declared workflow lane metadata. This is display and
148
+ * triage information only; capability ceilings, authorization, and cleanup
149
+ * safety remain owned by their existing enforcement and handoff paths.
150
+ */
151
+ export type WorkflowLaneMode = "mutation" | "review" | "scout" | "gate";
152
+ export interface WorkflowLaneMetadata {
153
+ version: 1;
154
+ key: string;
155
+ mode?: WorkflowLaneMode;
156
+ sourceRef?: string;
157
+ claims?: string[];
158
+ outputPaths?: string[];
159
+ }
160
+ /** Bounded foreground activity; excludes tool arguments and transcript content. */
161
+ export interface WorkflowChildActivity {
162
+ currentTool?: string;
163
+ currentToolStartedAt?: number;
164
+ lastActivityAt?: number;
165
+ durationMs?: number;
166
+ toolCount?: number;
167
+ turnCount?: number;
168
+ tokens?: number;
169
+ inputTokens?: number;
170
+ outputTokens?: number;
171
+ }
172
+ export interface WorkflowChildSummary {
173
+ version: 1;
174
+ parentToolCallId: string;
175
+ workflowRunId: string;
176
+ inventoryComplete: boolean;
177
+ workflowState: "queued" | "running" | "completed" | "failed" | "paused" | "stopped";
178
+ children: Array<{
179
+ childId: string;
180
+ runId?: string;
181
+ agent?: string;
182
+ /** Human-readable display name for the child session, when derived at launch. */
183
+ sessionName?: string;
184
+ model?: string;
185
+ thinking?: string;
186
+ /** Present only while a synchronous foreground child is running. */
187
+ activity?: WorkflowChildActivity;
188
+ state: "pending" | "running" | "completed" | "failed" | "paused" | "stopped" | "rejected" | "detached";
189
+ }>;
190
+ }
191
+ type WorkflowReceiptEntryResumability = {
192
+ latestRunId: string;
193
+ resumability: {
194
+ state: "resumable";
195
+ };
196
+ } | {
197
+ latestRunId?: string;
198
+ resumability: {
199
+ state: "not-resumable";
200
+ reason: string;
201
+ };
202
+ };
203
+ export type WorkflowReceiptEntry = WorkflowReceiptEntryResumability & {
204
+ key: string;
205
+ lane?: WorkflowLaneMetadata;
206
+ terminalOutcome?: WorkflowTerminalOutcome;
207
+ agent?: string;
208
+ requestedContext?: "fresh" | "fork";
209
+ resolvedContext?: "fresh" | "fork" | "mixed";
210
+ outputReference?: string;
211
+ acceptanceRecovery?: AcceptanceRecoveryMetadata;
212
+ externalAdapter?: ExternalCliReceiptMetadata;
213
+ continuation: {
214
+ runIds: string[];
215
+ };
216
+ };
217
+ export interface WorkflowReceipt {
218
+ version: 1;
219
+ workflowRunId: string;
220
+ state: WorkflowReceiptState;
221
+ createdAt: number;
222
+ entries: Record<string, WorkflowReceiptEntry>;
223
+ argsDigest?: string;
224
+ resource?: WorkflowResourceProvenance;
225
+ hostSteps?: HostStepNode[];
226
+ workflowChildren?: WorkflowChildSummary;
227
+ workflowResolution?: WorkflowTerminalResolution;
228
+ terminalOutcome?: WorkflowTerminalOutcome;
229
+ recovery?: WorkflowRecoveryAction[];
230
+ }
231
+ export interface SavedOutputReference {
232
+ path: string;
233
+ bytes: number;
234
+ lines: number;
235
+ message: string;
236
+ }
237
+ interface TruncationResult {
238
+ text: string;
239
+ truncated: boolean;
240
+ originalBytes?: number;
241
+ originalLines?: number;
242
+ artifactPath?: string;
243
+ }
244
+ export interface Usage {
245
+ input: number;
246
+ output: number;
247
+ cacheRead: number;
248
+ cacheWrite: number;
249
+ cost: number;
250
+ turns: number;
251
+ }
252
+ export interface ToolBudgetConfig {
253
+ soft?: number;
254
+ hard: number;
255
+ block?: string[] | "*";
256
+ }
257
+ export interface ResolvedToolBudget {
258
+ soft?: number;
259
+ hard: number;
260
+ block: string[] | "*";
261
+ }
262
+ export type ToolBudgetOutcome = "within-budget" | "soft-reached" | "hard-reached" | "hard-blocked";
263
+ export interface ToolBudgetState extends ResolvedToolBudget {
264
+ outcome: ToolBudgetOutcome;
265
+ toolCount: number;
266
+ softReachedAt?: number;
267
+ hardReachedAt?: number;
268
+ blockedTool?: string;
269
+ }
270
+ /**
271
+ * @deprecated Turn budgets are no longer accepted as launch configuration or
272
+ * enforced. Retained only to decode historical persisted status and result data.
273
+ */
274
+ export type TurnBudgetOutcome = "within-budget" | "wrap-up-requested" | "termination-deferred" | "exceeded";
275
+ /**
276
+ * @deprecated Historical persisted turn-budget state. New runs do not produce
277
+ * this field, but status readers retain it for backwards compatibility.
278
+ */
279
+ export interface TurnBudgetState {
280
+ maxTurns: number;
281
+ graceTurns: number;
282
+ outcome: TurnBudgetOutcome;
283
+ turnCount: number;
284
+ wrapUpRequestedAtTurn?: number;
285
+ terminationDeferredAtTurn?: number;
286
+ exceededAtTurn?: number;
287
+ }
288
+ export interface TokenUsage {
289
+ input: number;
290
+ output: number;
291
+ total: number;
292
+ /** Input plus cache-read tokens for the latest assistant turn. */
293
+ window?: number;
294
+ /** Largest window observed in this usage scope. */
295
+ windowPeak?: number;
296
+ }
297
+ export type ActivityState = "active_long_running" | "needs_attention";
298
+ export type ControlEventType = "active_long_running" | "needs_attention";
299
+ export type ControlNotificationChannel = "event" | "async" | "intercom";
300
+ export interface ControlConfig {
301
+ enabled?: boolean;
302
+ needsAttentionAfterMs?: number;
303
+ activeNoticeAfterMs?: number;
304
+ activeNoticeAfterTurns?: number;
305
+ activeNoticeAfterTokens?: number;
306
+ failedToolAttemptsBeforeAttention?: number;
307
+ notifyOn?: ControlEventType[];
308
+ notifyChannels?: ControlNotificationChannel[];
309
+ }
310
+ export interface ResolvedControlConfig {
311
+ enabled: boolean;
312
+ needsAttentionAfterMs: number;
313
+ needsAttentionAfterMsIsExplicit?: boolean;
314
+ activeNoticeAfterMs: number;
315
+ activeNoticeAfterTurns?: number;
316
+ activeNoticeAfterTokens?: number;
317
+ failedToolAttemptsBeforeAttention: number;
318
+ notifyOn: ControlEventType[];
319
+ notifyChannels: ControlNotificationChannel[];
320
+ }
321
+ /**
322
+ * Smart completion batching for async-completion notifications. Successful
323
+ * sibling completions are held briefly so they arrive as one grouped message;
324
+ * failure and attention signals bypass grouping and always fire immediately.
325
+ */
326
+ export interface CompletionBatchConfig {
327
+ enabled?: boolean;
328
+ /** Idle window after each arrival; resets on every new item. */
329
+ debounceMs?: number;
330
+ /** Hard cap measured from the first item in a group. */
331
+ maxWaitMs?: number;
332
+ /** Shorter idle window for straggler groups. */
333
+ stragglerDebounceMs?: number;
334
+ /** Shorter hard cap for straggler groups. */
335
+ stragglerMaxWaitMs?: number;
336
+ /** Arrivals within this window after an emit join a straggler group. */
337
+ stragglerWindowMs?: number;
338
+ }
339
+ export interface WaitToolConfigObject {
340
+ enabled?: boolean;
341
+ /** Default blocking window for bg_wait calls that omit timeoutMs. */
342
+ defaultTimeoutMs?: number;
343
+ }
344
+ export type WaitToolConfig = boolean | WaitToolConfigObject;
345
+ export interface ControlEvent {
346
+ type: ControlEventType;
347
+ from?: ActivityState;
348
+ to: ActivityState;
349
+ ts: number;
350
+ agent: string;
351
+ index?: number;
352
+ runId: string;
353
+ nestedRunId?: string;
354
+ nestingPath?: NestedRunAddress["path"];
355
+ message: string;
356
+ reason?: "idle" | "active_long_running" | "tool_failures" | "supervisor_request" | "time_threshold" | "turn_threshold" | "token_threshold" | "tool_open_threshold";
357
+ turns?: number;
358
+ tokens?: number;
359
+ toolCount?: number;
360
+ currentTool?: string;
361
+ toolCallId?: string;
362
+ /** True only when the child's native command controller manages `toolCallId`; gates command-control suggestions in notices. */
363
+ hasCommandController?: boolean;
364
+ currentToolDurationMs?: number;
365
+ currentPath?: string;
366
+ elapsedMs?: number;
367
+ recentFailureSummary?: string;
368
+ workflowKey?: string;
369
+ phase?: string;
370
+ label?: string;
371
+ taskPreview?: string;
372
+ }
373
+ export type SubagentResultStatus = "running" | "completed" | "failed" | "paused" | "stopped" | "detached";
374
+ export type SubagentOutputState = "present" | "absent" | "unknown";
375
+ export type SubagentRunMode = "single" | "parallel" | "chain" | "workflow";
376
+ export type SubagentResultMode = SubagentRunMode;
377
+ export type WorktreeProvider = "auto" | "native" | "worktrunk";
378
+ export type ManagedWorktreeProvider = Exclude<WorktreeProvider, "auto">;
379
+ export interface WorktreeNaming {
380
+ requestedBranch: string;
381
+ branchPrefix: string;
382
+ label: string;
383
+ sanitizedPathComponent: string;
384
+ collision?: "branch" | "path" | "both";
385
+ collisionSuffix?: string;
386
+ }
387
+ export interface ParallelHandoffPatch {
388
+ path: string;
389
+ branch: string;
390
+ changed: boolean;
391
+ diffStat: string;
392
+ filesChanged: number;
393
+ insertions: number;
394
+ deletions: number;
395
+ error?: string;
396
+ }
397
+ export interface ParallelHandoffChild {
398
+ index: number;
399
+ taskIndex: number;
400
+ agent: string;
401
+ /** Stable workflow identity used to join status/receipt metadata. */
402
+ workflowKey?: string;
403
+ /** Child run id when the worktree belongs to a workflow child. */
404
+ runId?: string;
405
+ lane?: WorkflowLaneMetadata;
406
+ status: SubagentResultStatus;
407
+ summary: string;
408
+ outputPath?: string;
409
+ structuredOutput?: unknown;
410
+ structuredOutputPath?: string;
411
+ sessionPath?: string;
412
+ patch: ParallelHandoffPatch;
413
+ }
414
+ /** Launch-time identity retained while a handoff group has no terminal child rows yet. */
415
+ export interface ParallelHandoffLaneBinding {
416
+ index: number;
417
+ taskIndex: number;
418
+ workflowKey?: string;
419
+ runId?: string;
420
+ lane?: WorkflowLaneMetadata;
421
+ }
422
+ export interface ParallelHandoffCleanupTask {
423
+ /** Canonical parent recorded when the worktree was created; missing proof keeps old trees. */
424
+ recordedBaseDir?: string;
425
+ index: number;
426
+ path: string;
427
+ branch: string;
428
+ /** Provider that allocated this worktree; omitted in old manifests. */
429
+ provider?: ManagedWorktreeProvider;
430
+ /** Branch/path naming evidence retained with the cleanup authority. */
431
+ naming?: WorktreeNaming;
432
+ worktreeRemoved: boolean;
433
+ branchRemoved: boolean;
434
+ preserved?: boolean;
435
+ reason?: string;
436
+ errors?: string[];
437
+ }
438
+ export type CleanupEligibility = {
439
+ state: "active";
440
+ } | {
441
+ state: "terminal-eligible";
442
+ } | {
443
+ state: "terminal-blocked";
444
+ reason: string;
445
+ } | {
446
+ state: "superseded-eligible";
447
+ } | {
448
+ state: "unknown";
449
+ };
450
+ export interface ParallelHandoffMergeEvidence {
451
+ prNumber: number;
452
+ reviewedHead: string;
453
+ mergeCommit: string;
454
+ treeEquivalent: boolean | "unknown";
455
+ postMergeChecks: "recorded" | "unknown";
456
+ attestedBy: string;
457
+ attestedAt: string;
458
+ manifestDigest?: string;
459
+ }
460
+ export interface ParallelHandoffSupersessionEvidence {
461
+ supersededBy: string;
462
+ attestedBy: string;
463
+ attestedAt: string;
464
+ manifestDigest?: string;
465
+ }
466
+ export interface ParallelHandoffGroup {
467
+ stepIndex: number;
468
+ baseCommit: string;
469
+ repoRoot: string;
470
+ children: ParallelHandoffChild[];
471
+ /** Optional launch identities for pending groups before child results settle. */
472
+ laneBindings?: ParallelHandoffLaneBinding[];
473
+ cleanup: {
474
+ state: "complete" | "partial";
475
+ tasks: ParallelHandoffCleanupTask[];
476
+ pruned: boolean;
477
+ errors?: string[];
478
+ };
479
+ }
480
+ export interface ParallelHandoffManifest {
481
+ version: 1;
482
+ runId: string;
483
+ mode: "single" | "parallel" | "chain";
484
+ source: "foreground" | "async";
485
+ cwd: string;
486
+ createdAt: number;
487
+ updatedAt: number;
488
+ groups: ParallelHandoffGroup[];
489
+ merge?: ParallelHandoffMergeEvidence;
490
+ supersession?: ParallelHandoffSupersessionEvidence;
491
+ cleanupEligibility?: CleanupEligibility;
492
+ }
493
+ export interface ParallelHandoffReference {
494
+ version: 1;
495
+ path: string;
496
+ groupCount: number;
497
+ childCount: number;
498
+ changedPatches: number;
499
+ cleanupState: "complete" | "partial";
500
+ cleanupEligibility?: CleanupEligibility;
501
+ }
502
+ export interface AgentContract {
503
+ version: 1;
504
+ }
505
+ export type ChainGateLayer = "execution" | "acceptance";
506
+ export type ExecutionProjectionStatus = "completed" | "failed" | "partial" | "paused" | "stopped" | "detached";
507
+ export interface ExecutionProjection {
508
+ status: ExecutionProjectionStatus;
509
+ success: boolean;
510
+ exitCode: number;
511
+ error?: string;
512
+ interrupted?: boolean;
513
+ timedOut?: boolean;
514
+ stopped?: boolean;
515
+ detached?: boolean;
516
+ }
517
+ export interface ReviewProjection {
518
+ status: "not-requested" | "review-required" | "reviewed" | "blockers";
519
+ findings?: AcceptanceReviewResult["findings"];
520
+ }
521
+ export interface FileMutationEffect {
522
+ status: "observed";
523
+ attempted: true;
524
+ evidence?: TrackedMutationEvidence;
525
+ }
526
+ export interface SettlementDiagnostic {
527
+ finalTextPresent: boolean;
528
+ mutation: {
529
+ attempted: boolean;
530
+ observed: boolean;
531
+ };
532
+ requiredOutput?: {
533
+ kind: "file-only" | "structured";
534
+ path: string;
535
+ missing: boolean;
536
+ };
537
+ afterCompactionSettlement?: boolean;
538
+ }
539
+ export interface EffectsProjection {
540
+ fileMutation?: FileMutationEffect;
541
+ settlementDiagnostic?: SettlementDiagnostic;
542
+ }
543
+ export interface TrackedMutationSnapshot {
544
+ source: "tracked-files";
545
+ trackedOnly: true;
546
+ cwd: string;
547
+ gitRoot?: string;
548
+ dirtyFiles: string[];
549
+ fingerprints: Record<string, TrackedMutationFingerprint>;
550
+ truncated?: boolean;
551
+ unavailable?: string;
552
+ }
553
+ export type TrackedMutationFingerprint = {
554
+ kind: "diff";
555
+ digest: string;
556
+ };
557
+ export interface TrackedMutationEvidence {
558
+ source: "tracked-files";
559
+ trackedOnly: true;
560
+ changedFiles: string[];
561
+ attemptedMutation: boolean;
562
+ truncated?: boolean;
563
+ unavailable?: string;
564
+ }
565
+ export interface TimeoutRecoverySummary {
566
+ termination: "timed-out" | "stopped";
567
+ changedFiles: string[];
568
+ truncated?: boolean;
569
+ /** True only when a timed-out child left tracked changes without its requested report. */
570
+ recoveryNeeded?: boolean;
571
+ reason?: "timed-out-with-dirty-worktree";
572
+ reportStatus?: "missing" | "written" | "not-requested" | "unknown";
573
+ currentTool?: string;
574
+ currentToolArgs?: string;
575
+ currentPath?: string;
576
+ sessionFile?: string;
577
+ transcriptPath?: string;
578
+ artifactPaths?: ArtifactPaths;
579
+ warning: string;
580
+ message: string;
581
+ }
582
+ /** Safe parent-facing subset of a timeout recovery summary. */
583
+ export type TimeoutRecoveryProjection = Pick<TimeoutRecoverySummary, "termination" | "changedFiles" | "truncated" | "recoveryNeeded" | "reason" | "reportStatus">;
584
+ export declare const SUBAGENT_LIFECYCLE_ARTIFACT_VERSION = 3;
585
+ export type SubagentLifecycleArtifactVersion = typeof SUBAGENT_LIFECYCLE_ARTIFACT_VERSION;
586
+ export type ProcessTerminalReason = "observer-unavailable" | "runner-candidate-missing" | "runner-instance-mismatch" | "writer-close-unverified" | "process-tree-unverified" | "canonical-session-unavailable" | "canonical-session-lease-active" | "canonical-session-release-unverified" | "proof-write-failed" | "stale-repair";
587
+ export interface RunnerProcessInstanceExit {
588
+ processInstanceId: string;
589
+ kind: "runner";
590
+ closeObservedAt: number;
591
+ exitCode: number | null;
592
+ signal: string | null;
593
+ }
594
+ export type ProcessTreeTerminal = {
595
+ state: "observed";
596
+ mechanism: "posix-process-group";
597
+ processGroupId: number;
598
+ verifiedAt: number;
599
+ } | {
600
+ state: "observed";
601
+ mechanism: "windows-taskkill";
602
+ pid: number;
603
+ verifiedAt: number;
604
+ } | {
605
+ state: "unknown";
606
+ reason: "unsupported-platform" | "signal-failed" | "verification-failed";
607
+ diagnostic?: string;
608
+ };
609
+ export interface PiWriterProcessInstanceExit {
610
+ processInstanceId: string;
611
+ kind: "pi-writer";
612
+ attempt: number;
613
+ closeObservedAt: number;
614
+ exitCode: number | null;
615
+ signal: string | null;
616
+ processTree: ProcessTreeTerminal;
617
+ }
618
+ export type ProcessInstanceExit = RunnerProcessInstanceExit | PiWriterProcessInstanceExit;
619
+ export interface CanonicalSessionTerminal {
620
+ canonicalSessionId: string;
621
+ leaseDisposition: "released" | "not-held";
622
+ freeAtObservation: true;
623
+ canonicalSessionLeaseReleased?: true;
624
+ }
625
+ interface ProcessTerminalBase {
626
+ version: 1;
627
+ runId: string;
628
+ childIndex?: number;
629
+ runnerProcessInstanceId: string;
630
+ observedAt?: number;
631
+ reason?: ProcessTerminalReason;
632
+ resumeDisposition?: "resumable" | "non-resumable" | "unavailable";
633
+ }
634
+ export type ProcessTerminal = (ProcessTerminalBase & {
635
+ state: "pending" | "not-started";
636
+ }) | (ProcessTerminalBase & {
637
+ state: "observed";
638
+ observedAt: number;
639
+ instances: ProcessInstanceExit[];
640
+ canonicalSession?: CanonicalSessionTerminal;
641
+ }) | (ProcessTerminalBase & {
642
+ state: "unknown";
643
+ reason: ProcessTerminalReason;
644
+ diagnostic?: string;
645
+ /** The runner's own exit, when observed even though the process tree could not be verified. */
646
+ instances?: RunnerProcessInstanceExit[];
647
+ });
648
+ export type WorkflowTerminalProof = {
649
+ version: 1;
650
+ kind: "workflow";
651
+ runId: string;
652
+ state: "observed";
653
+ dispatchClosed: true;
654
+ observedAt: number;
655
+ children: ProcessTerminal[];
656
+ } | {
657
+ version: 1;
658
+ kind: "workflow";
659
+ runId: string;
660
+ state: "pending" | "unknown";
661
+ dispatchClosed: boolean;
662
+ reason: string;
663
+ };
664
+ /** Identifies the durable schedule that launched a run, so its completion is attributable. */
665
+ export interface ScheduleOrigin {
666
+ id: string;
667
+ name?: string;
668
+ quiet?: boolean;
669
+ }
670
+ export type SteeringActionState = "delivered" | "scheduled" | "pending" | "partial" | "recovered" | "failed";
671
+ export type SteeringTargetState = "scheduled" | "pending" | "routed" | "queued" | "delivered" | "late" | "failed" | "recovered";
672
+ export interface SteeringTargetStatus {
673
+ index: number;
674
+ state: SteeringTargetState;
675
+ routedAt?: number;
676
+ deliveredAt?: number;
677
+ lateDeliveredAt?: number;
678
+ failedAt?: number;
679
+ recoveredAt?: number;
680
+ reason?: string;
681
+ replacementRunId?: string;
682
+ }
683
+ export interface SteeringRequestStatus {
684
+ id: string;
685
+ requestedAt: number;
686
+ source?: string;
687
+ messagePreview: string;
688
+ targets: SteeringTargetStatus[];
689
+ }
690
+ export interface SteeringStatus {
691
+ requested: number;
692
+ scheduled: number;
693
+ pending: number;
694
+ delivered: number;
695
+ failed: number;
696
+ recovered: number;
697
+ lastRequestedAt?: number;
698
+ lastDeliveredAt?: number;
699
+ recent: SteeringRequestStatus[];
700
+ }
701
+ export interface SteerActionTarget {
702
+ index: number;
703
+ state: SteeringTargetState;
704
+ deliveredAt?: number;
705
+ lateDeliveredAt?: number;
706
+ reason?: string;
707
+ replacementRunId?: string;
708
+ }
709
+ export interface SteerActionResult {
710
+ requestId: string;
711
+ state: SteeringActionState;
712
+ deliveryStatus: "delivered" | "queued";
713
+ sourceRunId: string;
714
+ replacementRunId?: string;
715
+ targets: SteerActionTarget[];
716
+ }
717
+ export interface SteeringNotice {
718
+ type: "subagent.steering.notice";
719
+ ts: number;
720
+ runId: string;
721
+ requestId: string;
722
+ state: "failed" | "partial" | "recovered";
723
+ message: string;
724
+ currentSessionId?: string;
725
+ }
726
+ export interface RunFanoutBudgetDescriptor {
727
+ version: 1;
728
+ rootRunId: string;
729
+ directory: string;
730
+ limit: number;
731
+ parentPath?: string;
732
+ }
733
+ export interface RunFanoutBudgetSnapshot {
734
+ used: number;
735
+ limit: number;
736
+ remaining: number;
737
+ }
738
+ export interface RunFanoutRejection extends RunFanoutBudgetSnapshot {
739
+ code: "RUN_FANOUT_LIMIT";
740
+ path: string;
741
+ requested: number;
742
+ }
743
+ export interface SteeringRecoveryDescriptor {
744
+ /** Captured response identity authority; absence means no declared aliases on revival. */
745
+ modelResponseAliases?: Record<string, string[]>;
746
+ version: 1;
747
+ launchContractDigest?: string;
748
+ extensionBindings?: ExtensionBindings;
749
+ requiredExtensions?: RequiredChildExtensionSnapshot;
750
+ runFanoutBudget: RunFanoutBudgetDescriptor;
751
+ sourceRunId: string;
752
+ agentContract?: AgentContract;
753
+ agent: string;
754
+ sandbox?: string;
755
+ permissionProfile?: string;
756
+ sessionFile?: string;
757
+ /** Git ref used to allocate managed worktrees for this run. */
758
+ baseRef?: string;
759
+ /** Launcher name the run was wrapped with; resume re-reads its argv from current user config. Absence means unwrapped. */
760
+ launcher?: string;
761
+ cwd: string;
762
+ model?: string;
763
+ modelProvider?: string;
764
+ modelOverrideFromParent?: boolean;
765
+ modelOrigin?: "explicit" | "inherited" | "configured";
766
+ fast?: boolean;
767
+ thinking?: string;
768
+ thinkingCeiling?: ThinkingLevel;
769
+ tools?: string[];
770
+ excludeTools?: string[];
771
+ allowNestedSubagents?: boolean;
772
+ allowedAgents?: string[];
773
+ extensions?: string[];
774
+ subagentOnlyExtensions?: string[];
775
+ mcpDirectTools?: string[];
776
+ mutationTools?: string[];
777
+ systemPrompt?: string;
778
+ systemPromptMode: "append" | "replace";
779
+ inheritProjectContext: boolean;
780
+ inheritGlobalContext: boolean;
781
+ inheritSkills: boolean;
782
+ skills?: string[];
783
+ skillPath?: string[];
784
+ agentFilePath?: string;
785
+ memory?: {
786
+ scope: "project" | "user";
787
+ path: string;
788
+ };
789
+ outputPath?: string;
790
+ outputMode: "inline" | "file-only";
791
+ structuredOutputSchema?: JsonSchemaObject;
792
+ acceptance?: AcceptanceInput;
793
+ controlConfig?: ResolvedControlConfig;
794
+ /** Resolved launch context for this async child. */
795
+ context?: "fresh" | "fork";
796
+ /** Raw per-run bridge override. Omitted descriptors continue to use global config. */
797
+ intercomBridge?: IntercomBridgeConfig;
798
+ lane?: WorkflowLaneMetadata;
799
+ absoluteDeadlineAt?: number;
800
+ initialToolBudget?: ResolvedToolBudget;
801
+ maxSubagentDepth: number;
802
+ maxOutput?: MaxOutputConfig;
803
+ capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
804
+ launchResolvedExtensions?: LaunchResolvedChildExtensions;
805
+ share: boolean;
806
+ sessionDir?: string;
807
+ artifactsDir?: string;
808
+ artifactConfig?: ArtifactConfig;
809
+ }
810
+ export type PublicNestedStepSummary = Pick<NestedStepSummary, "agent" | "sessionName" | "status" | "model" | "thinking" | "sandbox" | "sessionFile" | "transcriptPath" | "transcriptError" | "activityState" | "lastActivityAt" | "currentTool" | "currentToolStartedAt" | "currentPath" | "turnCount" | "toolCount" | "toolBudget" | "toolBudgetBlocked" | "startedAt" | "endedAt" | "error" | "timedOut" | "stopped"> & {
811
+ children?: PublicNestedRunSummary[];
812
+ };
813
+ export type CostSummary = {
814
+ inputTokens: number;
815
+ outputTokens: number;
816
+ costUsd: number;
817
+ };
818
+ export type PublicNestedRunSummary = Pick<NestedRunSummary, "id" | "parentRunId" | "parentStepIndex" | "parentAgent" | "depth" | "path" | "asyncDir" | "sessionId" | "sessionFile" | "intercomTarget" | "ownerIntercomTarget" | "leafIntercomTarget" | "ownerState" | "mode" | "state" | "agent" | "sessionName" | "agents" | "model" | "thinking" | "sandbox" | "currentStep" | "chainStepCount" | "parallelGroups" | "activityState" | "lastActivityAt" | "currentTool" | "currentToolStartedAt" | "currentPath" | "turnCount" | "toolCount" | "toolBudget" | "toolBudgetBlocked" | "totalTokens" | "totalCost" | "startedAt" | "endedAt" | "lastUpdate" | "error" | "timeoutMs" | "deadlineAt" | "timedOut" | "stopped" | "turnBudget" | "turnBudgetExceeded" | "wrapUpRequested"> & {
819
+ steps?: PublicNestedStepSummary[];
820
+ children?: PublicNestedRunSummary[];
821
+ };
822
+ export interface SubagentResultIntercomChild {
823
+ agent: string;
824
+ /** Human-readable display name for the child session, when derived at launch. */
825
+ sessionName?: string;
826
+ /** Process/lifecycle status. It does not establish semantic task completion. */
827
+ status: SubagentResultStatus;
828
+ /** Whether the child produced substantive output before its process ended. */
829
+ outputState?: SubagentOutputState;
830
+ /** True when the output is unfinished streamed text recovered after a timeout or child error. */
831
+ outputPartial?: boolean;
832
+ summary: string;
833
+ index?: number;
834
+ artifactPath?: string;
835
+ sessionPath?: string;
836
+ intercomTarget?: string;
837
+ children?: PublicNestedRunSummary[];
838
+ }
839
+ export interface SubagentResultIntercomPayload {
840
+ to: string;
841
+ message: string;
842
+ requestId?: string;
843
+ runId: string;
844
+ mode: SubagentRunMode;
845
+ status: SubagentResultStatus;
846
+ summary: string;
847
+ source: "foreground" | "async";
848
+ children: SubagentResultIntercomChild[];
849
+ asyncId?: string;
850
+ asyncDir?: string;
851
+ chainSteps?: number;
852
+ agent?: string;
853
+ index?: number;
854
+ artifactPath?: string;
855
+ sessionPath?: string;
856
+ parallelHandoff?: ParallelHandoffReference;
857
+ }
858
+ export interface ChildWatchdogWarningSummary extends Pick<WatchdogWarningDetails, "severity" | "importance" | "category" | "summary" | "evidence" | "recommendedAction" | "displayedAt"> {
859
+ /** True when a later assistant turn in the child followed the warning. */
860
+ addressed: boolean;
861
+ stalemate: boolean;
862
+ }
863
+ export interface ChildWatchdogProgress {
864
+ phase: "idle" | "reviewing" | "stale" | "failed";
865
+ seq: number;
866
+ lastUpdate: number;
867
+ reason?: string;
868
+ timedOut?: boolean;
869
+ warnings?: ChildWatchdogWarningSummary[];
870
+ }
871
+ export interface AgentProgress {
872
+ providerDiagnostics?: SubagentDelegationProviderDiagnostics;
873
+ index: number;
874
+ agent: string;
875
+ /** Human-readable display name for the child's session, when derived at launch. */
876
+ sessionName?: string;
877
+ status: "pending" | "running" | "completed" | "failed" | "detached";
878
+ activityState?: ActivityState;
879
+ task: string;
880
+ skills?: string[];
881
+ lastActivityAt?: number;
882
+ currentTool?: string;
883
+ currentToolArgs?: string;
884
+ currentToolStartedAt?: number;
885
+ currentPath?: string;
886
+ recentTools: Array<{
887
+ tool: string;
888
+ args: string;
889
+ endMs: number;
890
+ }>;
891
+ recentOutput: string[];
892
+ toolCount: number;
893
+ turnCount?: number;
894
+ tokens: number;
895
+ /** Resolved launch model/effort and split usage for public live projections. */
896
+ model?: string;
897
+ thinking?: string;
898
+ inputTokens?: number;
899
+ outputTokens?: number;
900
+ /** Cumulative cache-read/cache-write tokens for the current attempt, alongside inputTokens/outputTokens. */
901
+ cacheRead?: number;
902
+ cacheWrite?: number;
903
+ window?: number;
904
+ windowPeak?: number;
905
+ durationMs: number;
906
+ error?: string;
907
+ failedTool?: string;
908
+ watchdog?: ChildWatchdogProgress;
909
+ }
910
+ export interface ToolCallSummary {
911
+ text: string;
912
+ expandedText: string;
913
+ }
914
+ interface ProgressSummary {
915
+ index?: number;
916
+ agent?: string;
917
+ /** Human-readable display name for the child's session, when derived at launch. */
918
+ sessionName?: string;
919
+ status?: AgentProgress["status"];
920
+ activityState?: ActivityState;
921
+ skills?: string[];
922
+ lastActivityAt?: number;
923
+ currentTool?: string;
924
+ currentToolArgs?: string;
925
+ currentToolStartedAt?: number;
926
+ recentTools?: Array<{
927
+ tool: string;
928
+ args: string;
929
+ endMs: number;
930
+ }>;
931
+ recentOutput?: string[];
932
+ toolCount: number;
933
+ tokens: number;
934
+ model?: string;
935
+ thinking?: string;
936
+ durationMs: number;
937
+ }
938
+ export type AcceptanceLevel = "auto" | "none" | "attested" | "checked" | "verified";
939
+ export type AcceptanceEvidenceKind = "changed-files" | "tests-added" | "commands-run" | "validation-output" | "residual-risks" | "no-staged-files" | "diff-summary" | "review-findings" | "manual-notes";
940
+ export interface AcceptanceGate {
941
+ id: string;
942
+ must: string;
943
+ evidence?: AcceptanceEvidenceKind[];
944
+ severity?: "required" | "recommended";
945
+ }
946
+ export interface AcceptanceVerifyCommand {
947
+ id: string;
948
+ command: string;
949
+ timeoutMs?: number;
950
+ cwd?: string;
951
+ env?: Record<string, string>;
952
+ allowFailure?: boolean;
953
+ /** When "json", a passing command's stdout is parsed and becomes the run's structured output. */
954
+ output?: "json";
955
+ /** Optional JSON Schema the parsed stdout must satisfy; only meaningful with `output: "json"`. */
956
+ schema?: JsonSchemaObject;
957
+ }
958
+ export interface AcceptanceReviewGate {
959
+ agent?: string;
960
+ focus?: string;
961
+ required?: boolean;
962
+ }
963
+ export interface AcceptanceConfig {
964
+ level?: AcceptanceLevel;
965
+ report?: "on" | "off";
966
+ /** Preserve an intentional launch-time staged index, while rejecting any terminal index change. */
967
+ preserveStagedIndex?: true;
968
+ criteria?: Array<string | AcceptanceGate>;
969
+ evidence?: AcceptanceEvidenceKind[];
970
+ verify?: AcceptanceVerifyCommand[];
971
+ review?: AcceptanceReviewGate | false;
972
+ stopRules?: string[];
973
+ reason?: string;
974
+ }
975
+ /** Bare "none" and "verified" are not accepted; verified policies require object form with runtime commands. */
976
+ export type AcceptanceInput = Exclude<AcceptanceLevel, "none" | "verified"> | false | AcceptanceConfig;
977
+ export interface ResolvedAcceptanceGate extends AcceptanceGate {
978
+ id: string;
979
+ must: string;
980
+ evidence: AcceptanceEvidenceKind[];
981
+ severity: "required" | "recommended";
982
+ }
983
+ export interface ResolvedAcceptanceConfig {
984
+ level: Exclude<AcceptanceLevel, "auto">;
985
+ explicit: boolean;
986
+ inferredReason: string[];
987
+ criteria: ResolvedAcceptanceGate[];
988
+ evidence: AcceptanceEvidenceKind[];
989
+ preserveStagedIndex?: true;
990
+ verify: AcceptanceVerifyCommand[];
991
+ review?: AcceptanceReviewGate | false;
992
+ stopRules: string[];
993
+ reason?: string;
994
+ }
995
+ export interface AcceptanceReport {
996
+ criteriaSatisfied?: Array<{
997
+ id?: string;
998
+ status: "satisfied" | "not-satisfied" | "not-applicable";
999
+ evidence: string;
1000
+ }>;
1001
+ changedFiles?: string[];
1002
+ testsAddedOrUpdated?: string[];
1003
+ commandsRun?: Array<{
1004
+ command: string;
1005
+ result: "passed" | "failed" | "not-run";
1006
+ summary: string;
1007
+ }>;
1008
+ validationOutput?: string[];
1009
+ residualRisks?: string[];
1010
+ noStagedFiles?: boolean;
1011
+ diffSummary?: string;
1012
+ reviewFindings?: string[];
1013
+ manualNotes?: string;
1014
+ notes?: string;
1015
+ }
1016
+ export type AcceptanceRuntimeCheckStatus = "passed" | "failed" | "not-applicable";
1017
+ export interface AcceptanceRuntimeCheck {
1018
+ id: string;
1019
+ status: AcceptanceRuntimeCheckStatus;
1020
+ message: string;
1021
+ }
1022
+ export interface AcceptanceVerifyResult {
1023
+ id: string;
1024
+ command: string;
1025
+ cwd?: string;
1026
+ exitCode: number | null;
1027
+ status: "passed" | "failed" | "timed-out" | "allowed-failure";
1028
+ stdout?: string;
1029
+ stderr?: string;
1030
+ durationMs: number;
1031
+ artifactPath?: string;
1032
+ cacheKey?: string;
1033
+ memoized?: boolean;
1034
+ envKeys?: string[];
1035
+ envHash?: string;
1036
+ workspaceState?: {
1037
+ kind: "git-tracked";
1038
+ repoRoot: string;
1039
+ cwdRelative: string;
1040
+ head: string;
1041
+ diffHash: string;
1042
+ };
1043
+ artifactError?: string;
1044
+ /** Parsed stdout of a passing `output: "json"` command. */
1045
+ structuredOutput?: unknown;
1046
+ /** Why a passing `output: "json"` command still failed: invalid JSON, truncated stdout, or schema mismatch. */
1047
+ structuredOutputError?: string;
1048
+ }
1049
+ export interface AcceptanceReviewResult {
1050
+ status: "review-required" | "reviewed" | "blockers";
1051
+ findings: Array<{
1052
+ severity: "blocker" | "non-blocking";
1053
+ file?: string;
1054
+ issue: string;
1055
+ rationale: string;
1056
+ }>;
1057
+ }
1058
+ export type AcceptanceEvidenceStatus = "pending" | "not-required" | "claimed" | "attested" | "checked" | "verified" | "rejected";
1059
+ export type AcceptanceLedgerStatus = AcceptanceEvidenceStatus | "review-required" | "reviewed" | "accepted";
1060
+ /**
1061
+ * Durable child evidence that can be handed to a read-only review after the
1062
+ * acceptance envelope itself was rejected. This never upgrades acceptance;
1063
+ * the enclosing ledger remains rejected and the child remains unsuccessful.
1064
+ */
1065
+ export interface AcceptanceRecoveryMetadata {
1066
+ status: "available-for-review";
1067
+ reason: "acceptance-metadata-rejected";
1068
+ reportPath: string;
1069
+ reportHash: string;
1070
+ }
1071
+ export interface AcceptanceLedger {
1072
+ status: AcceptanceLedgerStatus;
1073
+ evidenceStatus: AcceptanceEvidenceStatus;
1074
+ explicit: boolean;
1075
+ effectiveAcceptance: ResolvedAcceptanceConfig;
1076
+ inferredReason: string[];
1077
+ criteria: ResolvedAcceptanceGate[];
1078
+ childReport?: AcceptanceReport;
1079
+ childReportParseError?: string;
1080
+ recovery?: AcceptanceRecoveryMetadata;
1081
+ runtimeChecks: AcceptanceRuntimeCheck[];
1082
+ verifyRuns: AcceptanceVerifyResult[];
1083
+ reviewResult?: AcceptanceReviewResult;
1084
+ parentDecision?: {
1085
+ status: "accepted" | "rejected";
1086
+ at: string;
1087
+ reason?: string;
1088
+ };
1089
+ }
1090
+ export interface LaunchResolvedChildExtensions {
1091
+ version: 1;
1092
+ /** This is parent-resolved launch intent, not child-runtime acknowledgement that extensions loaded. */
1093
+ source: "launch-resolved";
1094
+ disableAmbientExtensions: boolean;
1095
+ runtime: string[];
1096
+ configured: string[];
1097
+ /** Bounded host-supplied identities; paths are intentionally not exposed. */
1098
+ required: string[];
1099
+ effective: string[];
1100
+ omitted: {
1101
+ runtime: number;
1102
+ configured: number;
1103
+ required: number;
1104
+ effective: number;
1105
+ };
1106
+ }
1107
+ export interface RuntimeAcknowledgedChildExtensions {
1108
+ version: 1;
1109
+ /** Best-effort child-runtime registration acknowledgement, not extension health. */
1110
+ source: "child-runtime";
1111
+ ids: string[];
1112
+ omitted: number;
1113
+ }
1114
+ export interface UsageBudgetLimitConfig {
1115
+ soft?: number;
1116
+ hard: number;
1117
+ }
1118
+ export interface UsageBudgetConfig {
1119
+ tokens?: UsageBudgetLimitConfig;
1120
+ costUsd?: UsageBudgetLimitConfig;
1121
+ }
1122
+ export interface UsageBudgetMetricState extends UsageBudgetLimitConfig {
1123
+ used: number;
1124
+ outcome: "within-budget" | "soft-exceeded" | "hard-exceeded";
1125
+ }
1126
+ export interface UsageBudgetState {
1127
+ version: 1;
1128
+ /** Enforced from usage reported by completed or streaming child runs; no reservation estimates. */
1129
+ source: "reported";
1130
+ tokens?: UsageBudgetMetricState;
1131
+ costUsd?: UsageBudgetMetricState;
1132
+ exhausted: boolean;
1133
+ reason?: "tokens" | "costUsd";
1134
+ }
1135
+ export interface SingleResult {
1136
+ /**
1137
+ * Stable child identity within the foreground run. Pair with Details.runId for
1138
+ * cross-run correlation. This is assigned in launch order, remains stable across
1139
+ * partial progress snapshots and the final result, and is independent of the
1140
+ * result row's array position.
1141
+ */
1142
+ index: number;
1143
+ /** Workflow child key that owns this result when returned from workflow details. */
1144
+ workflowKey?: string;
1145
+ /** Workflow child run id that produced this result; resumed rounds share a session file but not a run id. */
1146
+ runId?: string;
1147
+ agent: string;
1148
+ task: string;
1149
+ /** Human-readable display name for the child's own session (agent + task
1150
+ * excerpt), when the launcher derived one. Display metadata only. */
1151
+ sessionName?: string;
1152
+ /** Resolved launch context for this child. */
1153
+ context?: "fresh" | "fork";
1154
+ exitCode: number;
1155
+ processSignal?: string | null;
1156
+ timeoutRecovery?: TimeoutRecoverySummary;
1157
+ detached?: boolean;
1158
+ detachedReason?: string;
1159
+ interrupted?: boolean;
1160
+ timedOut?: boolean;
1161
+ stopped?: boolean;
1162
+ turnBudget?: TurnBudgetState;
1163
+ turnBudgetExceeded?: boolean;
1164
+ wrapUpRequested?: boolean;
1165
+ toolBudget?: ToolBudgetState;
1166
+ toolBudgetBlocked?: boolean;
1167
+ sandbox?: string;
1168
+ permissionProfile?: string;
1169
+ messages?: Message[];
1170
+ providerDiagnostics?: SubagentDelegationProviderDiagnostics;
1171
+ usage: Usage;
1172
+ model?: string;
1173
+ /** Authoritative before/after Git evidence captured by a pane-native remote machine. */
1174
+ nativeMachine?: {
1175
+ provider: PlacementMachineReference["provider"];
1176
+ machineId: string;
1177
+ initialGit?: HerdrRemoteGitStatus;
1178
+ finalGit?: HerdrRemoteGitStatus;
1179
+ };
1180
+ /** Effective thinking level used by this foreground child, when known. */
1181
+ thinking?: string;
1182
+ requestedModel?: string;
1183
+ controlEvents?: ControlEvent[];
1184
+ error?: string;
1185
+ /**
1186
+ * True when the dispatch failed because the input exceeded the model's
1187
+ * context window. Callers should treat this as
1188
+ * a signal to reduce input size or re-decompose the task.
1189
+ */
1190
+ contextOverflow?: boolean;
1191
+ /**
1192
+ * True when the child never reached its first model turn because a startup
1193
+ * guard blocked it (for example a required sandbox profile that failed to
1194
+ * initialize). Retrying another model cannot succeed, and the failure must
1195
+ * not be recorded as a model exclusion.
1196
+ */
1197
+ startupBlocked?: boolean;
1198
+ sessionFile?: string;
1199
+ skills?: string[];
1200
+ skillsWarning?: string;
1201
+ progress?: AgentProgress;
1202
+ progressSummary?: ProgressSummary;
1203
+ toolCalls?: ToolCallSummary[];
1204
+ artifactPaths?: ArtifactPaths;
1205
+ truncation?: TruncationResult;
1206
+ finalOutput?: string;
1207
+ /** Provenance-aware state for substantive child output, excluding synthetic lifecycle messages. */
1208
+ outputState?: SubagentOutputState;
1209
+ /** True when the output is unfinished streamed text recovered after a timeout or child error. */
1210
+ outputPartial?: boolean;
1211
+ outputMode?: OutputMode;
1212
+ savedOutputPath?: string;
1213
+ outputReference?: SavedOutputReference;
1214
+ outputSaveError?: string;
1215
+ /** Best-effort metadata persistence failure; execution and receipt publication continue. */
1216
+ metadataSaveError?: string;
1217
+ structuredOutput?: unknown;
1218
+ structuredOutputFailed?: boolean;
1219
+ structuredOutputPath?: string;
1220
+ structuredOutputSchemaPath?: string;
1221
+ acceptance?: AcceptanceLedger;
1222
+ agentContract?: AgentContract;
1223
+ launchContractDigest?: string;
1224
+ launchResolvedExtensions?: LaunchResolvedChildExtensions;
1225
+ runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensions;
1226
+ execution?: ExecutionProjection;
1227
+ review?: ReviewProjection;
1228
+ effects?: EffectsProjection;
1229
+ transcriptPath?: string;
1230
+ transcriptError?: string;
1231
+ children?: NestedRunSummary[];
1232
+ watchdog?: ChildWatchdogProgress;
1233
+ capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
1234
+ capabilityAudit?: SubagentCapabilityAudit;
1235
+ runner?: ExternalCliRunnerStatus | ExternalJobRunnerStatus;
1236
+ externalProcess?: ExternalProcessStatus;
1237
+ }
1238
+ export interface SpawnBudgetGrant {
1239
+ sessionId: string;
1240
+ amount: number;
1241
+ grantedAt: number;
1242
+ previousLimit: number;
1243
+ limit: number;
1244
+ }
1245
+ export interface SpawnBudgetSnapshot {
1246
+ used: number;
1247
+ configuredLimit: number | null;
1248
+ granted: number;
1249
+ limit: number | null;
1250
+ remaining: number | null;
1251
+ grantRemaining: number | null;
1252
+ grantHistory: SpawnBudgetGrant[];
1253
+ }
1254
+ /** Slim per-child projection of a terminal result payload, safe to surface in tool_result details. */
1255
+ export interface WaitCompletionChild {
1256
+ agent?: string;
1257
+ /** Child run identity where the producer records one (workflow children); artifact files are keyed by it. */
1258
+ runId?: string;
1259
+ /** Bounded accounting projection used by /subagent-cost after async completion. */
1260
+ usage?: Usage;
1261
+ /** Persisted Pi child session when available. */
1262
+ sessionFile?: string;
1263
+ success?: boolean;
1264
+ outputState?: SubagentOutputState;
1265
+ /** True when the output is unfinished streamed text recovered after a timeout or child error. */
1266
+ outputPartial?: boolean;
1267
+ structuredOutput?: unknown;
1268
+ structuredOutputPath?: string;
1269
+ error?: string;
1270
+ model?: string;
1271
+ contextOverflow?: boolean;
1272
+ artifactPaths?: Partial<ArtifactPaths>;
1273
+ timeoutRecovery?: TimeoutRecoveryProjection;
1274
+ }
1275
+ /**
1276
+ * Terminal completion observed for a run a bg_wait call covered. Carries run
1277
+ * identity and the artifact trail; output text stays in the tool result content.
1278
+ */
1279
+ export interface WaitCompletion {
1280
+ runId: string;
1281
+ workflowReceiptPath?: string;
1282
+ agent?: string;
1283
+ mode?: string;
1284
+ state?: string;
1285
+ success?: boolean;
1286
+ /** Versioned bounded output archive retained with the durable completion replay. */
1287
+ archivePath?: string;
1288
+ results?: WaitCompletionChild[];
1289
+ workflowChildren?: WorkflowChildSummary;
1290
+ }
1291
+ export interface AgentCapabilitiesSnapshot {
1292
+ agents: AgentCapabilityRow[];
1293
+ restrictedCount: number;
1294
+ capabilityCeilingSources?: string[];
1295
+ }
1296
+ export interface AgentCapabilityRow {
1297
+ name: string;
1298
+ description: string;
1299
+ source: "builtin" | "package" | "user" | "project" | "runtime";
1300
+ executable: boolean;
1301
+ restrictionSources?: string[];
1302
+ aliases?: string[];
1303
+ runner: {
1304
+ type: "pi";
1305
+ } | {
1306
+ type: "external-cli";
1307
+ adapter?: string;
1308
+ command: string;
1309
+ machine?: string;
1310
+ available: boolean;
1311
+ unavailableReason?: string;
1312
+ capabilities: ExternalCliCapabilities;
1313
+ } | {
1314
+ type: "external-job";
1315
+ provider: string;
1316
+ available?: boolean;
1317
+ capabilities: ExternalJobRunnerStatus["capabilities"];
1318
+ };
1319
+ tools: {
1320
+ ambient: boolean;
1321
+ names: string[];
1322
+ excludeTools?: string[];
1323
+ mcpDirectTools: string[];
1324
+ mutationTools?: string[];
1325
+ };
1326
+ model?: {
1327
+ value?: string;
1328
+ thinking?: string | false;
1329
+ };
1330
+ execution?: {
1331
+ defaultAsync?: boolean;
1332
+ timeoutMs?: number;
1333
+ };
1334
+ acceptance?: {
1335
+ policy?: AcceptanceInput;
1336
+ role?: AcceptanceRole;
1337
+ };
1338
+ output?: {
1339
+ path?: string;
1340
+ mode?: OutputMode;
1341
+ };
1342
+ extensions?: {
1343
+ names?: string[];
1344
+ subagentOnly?: string[];
1345
+ skills?: string[];
1346
+ };
1347
+ }
1348
+ export interface Details {
1349
+ commands?: import("../runs/shared/child-commands.ts").ChildCommandSnapshot[];
1350
+ mode: SubagentResultMode | "management";
1351
+ workflowReceiptPath?: string;
1352
+ runId?: string;
1353
+ /** Host tool-call id retained when it differs from the internal run id. */
1354
+ toolCallId?: string;
1355
+ /** Run-level context summary. "mixed" when children resolved to different modes. */
1356
+ context?: "fresh" | "fork" | "mixed";
1357
+ results: SingleResult[];
1358
+ workflowChildren?: WorkflowChildSummary;
1359
+ workflowTerminalProof?: WorkflowTerminalProof;
1360
+ /**
1361
+ * Terminal completion payloads for runs this bg_wait call observed
1362
+ * finishing. Async completions travel as result files that are consumed and
1363
+ * deleted after text delivery, so without this field their run and artifact
1364
+ * identity never reaches tool_result details.
1365
+ */
1366
+ completions?: WaitCompletion[];
1367
+ wait?: {
1368
+ reason: "window_elapsed";
1369
+ timedOut: true;
1370
+ activeRunIds: string[];
1371
+ activeProviderItems: Array<{
1372
+ provider: string;
1373
+ id: string;
1374
+ }>;
1375
+ } | {
1376
+ /** Non-terminal yield for a supervisor request or a user message; tracked work remains active. */
1377
+ reason: "supervisor_request" | "user_input";
1378
+ timedOut: false;
1379
+ activeRunIds: string[];
1380
+ activeProviderItems: Array<{
1381
+ provider: string;
1382
+ id: string;
1383
+ }>;
1384
+ };
1385
+ controlEvents?: ControlEvent[];
1386
+ steering?: SteerActionResult;
1387
+ asyncId?: string;
1388
+ background?: boolean;
1389
+ asyncDir?: string;
1390
+ timeoutMs?: number;
1391
+ deadlineAt?: number;
1392
+ timedOut?: boolean;
1393
+ stopped?: boolean;
1394
+ toolBudget?: ResolvedToolBudget;
1395
+ usageBudget?: UsageBudgetState;
1396
+ progress?: AgentProgress[];
1397
+ progressSummary?: ProgressSummary;
1398
+ artifacts?: {
1399
+ dir: string;
1400
+ files: ArtifactPaths[];
1401
+ };
1402
+ truncation?: {
1403
+ truncated: boolean;
1404
+ originalBytes?: number;
1405
+ originalLines?: number;
1406
+ artifactPath?: string;
1407
+ };
1408
+ chainAgents?: string[];
1409
+ totalSteps?: number;
1410
+ currentStepIndex?: number;
1411
+ workflowGraph?: WorkflowGraphSnapshot;
1412
+ /** Validated, display-only fanout plan supplied with a workflow launch. */
1413
+ preflight?: WorkflowPreflight;
1414
+ preflightWarnings?: string[];
1415
+ outputs?: ChainOutputMap;
1416
+ totalChildUsage?: Usage;
1417
+ totalCost?: CostSummary;
1418
+ spawnBudget?: SpawnBudgetSnapshot;
1419
+ runFanoutBudget?: RunFanoutBudgetSnapshot;
1420
+ runFanoutRejection?: RunFanoutRejection;
1421
+ activeAsyncCapacity?: ActiveAsyncCapacitySnapshot;
1422
+ agentCapabilities?: AgentCapabilitiesSnapshot;
1423
+ capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
1424
+ capabilityAudit?: SubagentCapabilityAudit;
1425
+ parallelHandoff?: ParallelHandoffReference;
1426
+ lifecycleStatus?: {
1427
+ processTerminal?: ProcessTerminal;
1428
+ };
1429
+ launchContractDigest?: string;
1430
+ launchResolvedExtensions?: LaunchResolvedChildExtensions;
1431
+ runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensions;
1432
+ /** Original launch contract whose persisted session is being revived. */
1433
+ sourceLaunchContractDigest?: string;
1434
+ /** Durable mission attached to this run, when mission mode was explicitly used. */
1435
+ missionId?: string;
1436
+ missionPath?: string;
1437
+ /** Non-fatal automatic mission persistence failure. */
1438
+ missionWarning?: string;
1439
+ mission?: MissionRecord;
1440
+ workflow?: {
1441
+ value?: unknown;
1442
+ failureKind?: WorkflowScriptFailureKind;
1443
+ args?: Record<string, unknown>;
1444
+ argsDigest?: string;
1445
+ /** SHA-256 of the workflow script source (async workflows). */
1446
+ scriptDigest?: string;
1447
+ /** Structured stop cause: `runtime-replaced` when the owning extension runtime was replaced; `owner-exited` when stale-run reconciliation found the owning Pi process dead. */
1448
+ stopCause?: WorkflowStopCause;
1449
+ /** Interrupted workflow run whose finished children this run reused. */
1450
+ reusedFrom?: string;
1451
+ /** Owner-exited runs: the last time the dead Pi process updated the run (epoch ms), not the repair time. */
1452
+ ownerExitedAt?: number;
1453
+ /** Set on a run that resumes an interrupted one; `attempt` counts resumes that followed Pi exits. */
1454
+ resumeOrigin?: {
1455
+ sourceRunId: string;
1456
+ attempt: number;
1457
+ };
1458
+ resource?: WorkflowResourceProvenance;
1459
+ preflightWarnings?: string[];
1460
+ trace: Array<{
1461
+ operation: "run" | "status" | "steer" | "host";
1462
+ key: string;
1463
+ state: "started" | "completed" | "failed" | "detached" | "stopped" | "reused" | "queued" | "delivered" | "missed";
1464
+ agent?: string;
1465
+ runId?: string;
1466
+ phase?: string;
1467
+ label?: string;
1468
+ durationMs?: number;
1469
+ /** Internal provenance for a generated runs.lanes child key. */
1470
+ generatedLaneKey?: string;
1471
+ warning?: string;
1472
+ error?: string;
1473
+ /** Came from a previous runtime-replaced or owner-exited run of the same script (and args, unless named by options.reuseFrom); this run launched nothing. */
1474
+ reused?: boolean;
1475
+ }>;
1476
+ emits: unknown[];
1477
+ console: Array<{
1478
+ level: "log" | "info" | "warn" | "error";
1479
+ text: string;
1480
+ }>;
1481
+ /** Terminal keyed child receipt. Async workflows also persist it beside status.json. */
1482
+ receipt?: WorkflowReceipt;
1483
+ };
1484
+ chatProgress?: {
1485
+ mode: "off" | "live-card";
1486
+ repoRelation: "same" | "other";
1487
+ repoLabel?: string;
1488
+ };
1489
+ missions?: {
1490
+ records?: MissionRecord[];
1491
+ globalEntries?: GlobalMissionIndexRecord[];
1492
+ warnings: string[];
1493
+ };
1494
+ /** Project-scoped recurring schedule records and run history for management actions. */
1495
+ schedules?: {
1496
+ records?: unknown[];
1497
+ runs?: unknown[];
1498
+ };
1499
+ }
1500
+ export interface ArtifactPaths {
1501
+ inputPath: string;
1502
+ outputPath: string;
1503
+ jsonlPath: string;
1504
+ transcriptPath: string;
1505
+ metadataPath: string;
1506
+ }
1507
+ export type ArtifactDirPreference = "project" | "session" | "temp";
1508
+ export interface ArtifactConfig {
1509
+ enabled: boolean;
1510
+ dir?: ArtifactDirPreference;
1511
+ includeInput: boolean;
1512
+ includeOutput: boolean;
1513
+ includeJsonl: boolean;
1514
+ includeTranscript?: boolean;
1515
+ includeMetadata: boolean;
1516
+ cleanupDays: number;
1517
+ }
1518
+ export interface AsyncParallelGroupStatus {
1519
+ start: number;
1520
+ count: number;
1521
+ stepIndex: number;
1522
+ }
1523
+ export type NestedRunState = "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1524
+ export type NestedOwnerState = "live" | "gone" | "unknown";
1525
+ export interface NestedRunAddress {
1526
+ id: string;
1527
+ parentRunId: string;
1528
+ parentStepIndex?: number;
1529
+ parentAgent?: string;
1530
+ depth: number;
1531
+ path: Array<{
1532
+ runId: string;
1533
+ stepIndex?: number;
1534
+ agent?: string;
1535
+ }>;
1536
+ }
1537
+ export interface NestedStepSummary {
1538
+ agent: string;
1539
+ /** Human-readable display name for the child session, when derived at launch. */
1540
+ sessionName?: string;
1541
+ status: "pending" | "running" | "complete" | "completed" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1542
+ model?: string;
1543
+ thinking?: string;
1544
+ sessionFile?: string;
1545
+ transcriptPath?: string;
1546
+ transcriptError?: string;
1547
+ activityState?: ActivityState;
1548
+ lastActivityAt?: number;
1549
+ currentTool?: string;
1550
+ currentToolStartedAt?: number;
1551
+ currentPath?: string;
1552
+ turnCount?: number;
1553
+ toolCount?: number;
1554
+ startedAt?: number;
1555
+ endedAt?: number;
1556
+ error?: string;
1557
+ watchdog?: ChildWatchdogProgress;
1558
+ timedOut?: boolean;
1559
+ stopped?: boolean;
1560
+ turnBudget?: TurnBudgetState;
1561
+ turnBudgetExceeded?: boolean;
1562
+ wrapUpRequested?: boolean;
1563
+ toolBudget?: ToolBudgetState;
1564
+ toolBudgetBlocked?: boolean;
1565
+ sandbox?: string;
1566
+ permissionProfile?: string;
1567
+ processTerminal?: ProcessTerminal;
1568
+ launchResolvedExtensions?: LaunchResolvedChildExtensions;
1569
+ runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensions;
1570
+ capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
1571
+ capabilityAudit?: SubagentCapabilityAudit;
1572
+ children?: NestedRunSummary[];
1573
+ }
1574
+ export interface NestedRunSummary extends NestedRunAddress {
1575
+ asyncDir?: string;
1576
+ pid?: number;
1577
+ sessionId?: string;
1578
+ sessionFile?: string;
1579
+ /** Run whose session this resume replacement continues. */
1580
+ revivedFrom?: string;
1581
+ intercomTarget?: string;
1582
+ ownerIntercomTarget?: string;
1583
+ leafIntercomTarget?: string;
1584
+ ownerState?: NestedOwnerState;
1585
+ controlInbox?: string;
1586
+ capabilityToken?: string;
1587
+ mode?: SubagentRunMode;
1588
+ processTerminal?: ProcessTerminal;
1589
+ launchResolvedExtensions?: LaunchResolvedChildExtensions;
1590
+ runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensions;
1591
+ capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
1592
+ capabilityAudit?: SubagentCapabilityAudit;
1593
+ state: NestedRunState;
1594
+ agent?: string;
1595
+ /** Human-readable display name for the child session, when derived at launch. */
1596
+ sessionName?: string;
1597
+ sandbox?: string;
1598
+ permissionProfile?: string;
1599
+ agents?: string[];
1600
+ model?: string;
1601
+ thinking?: string;
1602
+ currentStep?: number;
1603
+ chainStepCount?: number;
1604
+ parallelGroups?: AsyncParallelGroupStatus[];
1605
+ steps?: NestedStepSummary[];
1606
+ children?: NestedRunSummary[];
1607
+ activityState?: ActivityState;
1608
+ lastActivityAt?: number;
1609
+ currentTool?: string;
1610
+ currentToolStartedAt?: number;
1611
+ currentPath?: string;
1612
+ turnCount?: number;
1613
+ toolCount?: number;
1614
+ totalTokens?: TokenUsage;
1615
+ totalCost?: CostSummary;
1616
+ startedAt?: number;
1617
+ endedAt?: number;
1618
+ lastUpdate?: number;
1619
+ timeoutMs?: number;
1620
+ deadlineAt?: number;
1621
+ timedOut?: boolean;
1622
+ stopped?: boolean;
1623
+ turnBudget?: TurnBudgetState;
1624
+ turnBudgetExceeded?: boolean;
1625
+ wrapUpRequested?: boolean;
1626
+ toolBudget?: ToolBudgetState;
1627
+ toolBudgetBlocked?: boolean;
1628
+ error?: string;
1629
+ }
1630
+ export interface NestedRouteInfo {
1631
+ rootRunId: string;
1632
+ eventSink: string;
1633
+ controlInbox: string;
1634
+ capabilityToken: string;
1635
+ }
1636
+ export interface AsyncStartedEvent {
1637
+ lifecycleArtifactVersion?: SubagentLifecycleArtifactVersion;
1638
+ id?: string;
1639
+ asyncDir?: string;
1640
+ /** Parent-resolved launch directory, used as a trusted artifact root while this session is live. */
1641
+ cwd?: string;
1642
+ /** Parent-resolved child session root, used only while this session owns the live run. */
1643
+ sessionRoot?: string;
1644
+ pid?: number;
1645
+ sessionId?: string;
1646
+ completionOwnerId?: string;
1647
+ mode?: SubagentRunMode;
1648
+ agent?: string;
1649
+ agents?: string[];
1650
+ /** Redacted prompt marker for the first child task; workflow roots may omit this field. */
1651
+ task?: string;
1652
+ /** Redacted prompt marker for the workflow-level caller task or first-child fallback. */
1653
+ goal?: string;
1654
+ chain?: string[];
1655
+ chainStepCount?: number;
1656
+ parallelGroups?: AsyncParallelGroupStatus[];
1657
+ workflowGraph?: WorkflowGraphSnapshot;
1658
+ preflight?: WorkflowPreflight;
1659
+ launchContractDigest?: string;
1660
+ sandbox?: string;
1661
+ permissionProfile?: string;
1662
+ launchResolvedExtensions?: LaunchResolvedChildExtensions;
1663
+ runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensions;
1664
+ usageBudget?: UsageBudgetState;
1665
+ timeoutMs?: number;
1666
+ deadlineAt?: number;
1667
+ turnBudget?: TurnBudgetState;
1668
+ nestedRoute?: NestedRouteInfo;
1669
+ capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
1670
+ parentWorkflowRunId?: string;
1671
+ workflowKey?: string;
1672
+ }
1673
+ export type AgentRunnerConfig = {
1674
+ type: "pi";
1675
+ } | {
1676
+ type: "external-cli";
1677
+ adapter?: "codex-exec" | "codex-exec-writer" | "claude-code" | "claude-code-writer" | "cursor-agent" | "cursor-agent-writer";
1678
+ command: string;
1679
+ args?: string[];
1680
+ promptDelivery?: "stdin";
1681
+ capabilities?: ExternalCliCapabilityNarrowing;
1682
+ } | {
1683
+ type: "external-job";
1684
+ provider: string;
1685
+ options?: Record<string, unknown>;
1686
+ };
1687
+ export type ExternalCliCapabilityNarrowing = Partial<Record<"steer" | "resume" | "structuredOutput" | "toolEvents" | "supervisor" | "forkContext" | "extensionBindings", false>>;
1688
+ export interface HerdrRemoteGitStatus {
1689
+ head?: string;
1690
+ branch?: string;
1691
+ dirty?: boolean;
1692
+ }
1693
+ /** A Herdr saved SSH machine resolved for one launch. `cwd` is the directory on that machine. */
1694
+ export interface HerdrMachineReference {
1695
+ provider: "herdr";
1696
+ id: string;
1697
+ label?: string;
1698
+ target: string;
1699
+ session?: string;
1700
+ cwd: string;
1701
+ }
1702
+ /** `machine: "local"`: a Rex pane in the parent's own Rex session on this machine. `session` is the Rex session id and `server` the Rex server address, both recorded in the parent at resolution time; `cwd` is the local launch directory. */
1703
+ export interface RexLocalMachineReference {
1704
+ provider: "rex";
1705
+ id: "local";
1706
+ session: string;
1707
+ server?: string;
1708
+ cwd: string;
1709
+ }
1710
+ /** A Rex machine reached over SSH, named in user settings (`subagents.machines.<id>.rex.ssh`). The pane opens in that machine's Rex session labeled `subagents`, found or created at launch and recorded with the run; `cwd` is the directory on that machine. */
1711
+ export interface RexSshMachineReference {
1712
+ provider: "rex";
1713
+ id: string;
1714
+ target: string;
1715
+ cwd: string;
1716
+ }
1717
+ export type RexMachineReference = RexLocalMachineReference | RexSshMachineReference;
1718
+ /** Where a placed native Pi child runs. */
1719
+ export type PlacementMachineReference = HerdrMachineReference | RexMachineReference;
1720
+ export interface ExternalCliMachineStatus extends HerdrMachineReference {
1721
+ remoteGit?: HerdrRemoteGitStatus;
1722
+ }
1723
+ export interface ExternalCliCapabilities {
1724
+ stop: true;
1725
+ steer: false;
1726
+ resume: false;
1727
+ structuredOutput: false;
1728
+ toolEvents: false;
1729
+ supervisor: "unsupported";
1730
+ forkContext: false;
1731
+ extensionBindings: false;
1732
+ }
1733
+ export interface ExternalCliReceiptMetadata {
1734
+ adapter: {
1735
+ id: "external-cli" | "codex-exec" | "codex-exec-writer" | "claude-code" | "claude-code-writer" | "cursor-agent" | "cursor-agent-writer" | "grok-build";
1736
+ version: 1;
1737
+ executionMode: "one-shot-stdin" | "one-shot-prompt-file";
1738
+ };
1739
+ capabilities: ExternalCliCapabilities;
1740
+ machine?: ExternalCliMachineStatus;
1741
+ safety?: {
1742
+ sandbox: "read-only";
1743
+ approvalPolicy: "never";
1744
+ ephemeral: true;
1745
+ } | {
1746
+ access: "workspace-write";
1747
+ sandbox: "workspace-write";
1748
+ approvalPolicy: "never";
1749
+ ephemeral: true;
1750
+ } | {
1751
+ permissionMode: "plan";
1752
+ tools: "none";
1753
+ mcp: "empty-strict";
1754
+ settingSources: "none";
1755
+ sessionPersistence: false;
1756
+ } | {
1757
+ access: "read-only";
1758
+ authentication: "existing-cli-required";
1759
+ permissionMode: "plan";
1760
+ tools: "none";
1761
+ mcp: "empty-strict";
1762
+ settingSources: "user";
1763
+ userSettingsTrust: "required";
1764
+ sessionPersistence: false;
1765
+ } | {
1766
+ access: "workspace-write";
1767
+ authentication: "existing-cli-required";
1768
+ permissionMode: "acceptEdits";
1769
+ tools: "Read,Write,Edit,Glob,Grep";
1770
+ mcp: "empty-strict";
1771
+ settingSources: "user";
1772
+ userSettingsTrust: "required";
1773
+ sessionPersistence: false;
1774
+ } | {
1775
+ access: "read-only";
1776
+ authentication: "cursor-api-key-or-existing-login";
1777
+ mode: "ask";
1778
+ sandbox: "enabled";
1779
+ workspaceTrust: "existing-required";
1780
+ sessionReuse: false;
1781
+ } | {
1782
+ access: "workspace-write";
1783
+ authentication: "cursor-api-key-or-existing-login";
1784
+ mode: "print";
1785
+ sandbox: "enabled";
1786
+ workspaceTrust: "existing-required";
1787
+ sessionReuse: false;
1788
+ };
1789
+ outputArtifacts?: {
1790
+ stdoutPath?: string;
1791
+ stderrPath?: string;
1792
+ finalOutputPath?: string;
1793
+ };
1794
+ handoff: {
1795
+ mode: "fresh";
1796
+ };
1797
+ supervisor: {
1798
+ mode: "unsupported";
1799
+ reason: string;
1800
+ };
1801
+ nonResumableReason: string;
1802
+ }
1803
+ export interface ExternalCliRunnerStatus {
1804
+ type: "external-cli";
1805
+ command: string;
1806
+ args: string[];
1807
+ promptDelivery: "stdin" | "prompt-file";
1808
+ adapter: ExternalCliReceiptMetadata["adapter"];
1809
+ safety?: ExternalCliReceiptMetadata["safety"];
1810
+ capabilities: ExternalCliCapabilities;
1811
+ unsupportedReasons: Record<Exclude<keyof ExternalCliCapabilities, "stop">, string>;
1812
+ nonResumableReason: string;
1813
+ machine?: HerdrMachineReference;
1814
+ }
1815
+ export interface ExternalJobRunnerStatus {
1816
+ type: "external-job";
1817
+ provider: string;
1818
+ options: Record<string, unknown>;
1819
+ capabilities: {
1820
+ stop: false;
1821
+ steer: false;
1822
+ resume: false;
1823
+ structuredOutput: false;
1824
+ toolEvents: false;
1825
+ };
1826
+ }
1827
+ export interface ExternalJobStatus {
1828
+ provider: string;
1829
+ providerJobId?: string;
1830
+ promptDigest: string;
1831
+ operation?: "start" | "follow-up";
1832
+ sourceRunId?: string;
1833
+ sourceStepIndex?: number;
1834
+ parentProviderJobId?: string;
1835
+ requestId?: string;
1836
+ requestDigest?: string;
1837
+ options: Record<string, unknown>;
1838
+ handleUrl?: string;
1839
+ conversationUrl?: string;
1840
+ resultArtifactPath?: string;
1841
+ state: "queued" | "running" | "completed" | "failed" | "stopped" | "blocked";
1842
+ failureCode?: string;
1843
+ failureMessage?: string;
1844
+ blockingJobId?: string;
1845
+ startedAt?: number;
1846
+ updatedAt?: number;
1847
+ }
1848
+ export interface ExternalProcessStatus {
1849
+ pid?: number;
1850
+ startedAt: number;
1851
+ endedAt?: number;
1852
+ durationMs?: number;
1853
+ exitCode?: number | null;
1854
+ processSignal?: string | null;
1855
+ stdoutPath: string;
1856
+ stderrPath: string;
1857
+ finalOutputPath?: string;
1858
+ stdoutBytes?: number;
1859
+ stderrBytes?: number;
1860
+ stdoutTruncated?: boolean;
1861
+ stderrTruncated?: boolean;
1862
+ machine?: ExternalCliMachineStatus;
1863
+ }
1864
+ export interface AsyncStatus {
1865
+ /** Exact reference returned by successful current workflow receipt publication. */
1866
+ workflowReceiptPath?: string;
1867
+ lifecycleArtifactVersion?: SubagentLifecycleArtifactVersion;
1868
+ runId: string;
1869
+ /** Parent Pi process/window that owns local completion delivery. */
1870
+ completionOwnerId?: string;
1871
+ /** The Pi process behind `completionOwnerId`; once it is dead, the session that owns the run delivers it. */
1872
+ completionOwnerProcess?: RecordedPid;
1873
+ /** Host tool-call id retained when it differs from the internal run id. */
1874
+ toolCallId?: string;
1875
+ sessionId?: string;
1876
+ mode: SubagentRunMode;
1877
+ context?: "fresh" | "fork" | "mixed";
1878
+ /** Run whose session this resume replacement continues. */
1879
+ revivedFrom?: string;
1880
+ isNested?: boolean;
1881
+ state: "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1882
+ /** Display-only dismissal marker for a reload-orphaned workflow. */
1883
+ displayDismissedAt?: number;
1884
+ error?: string;
1885
+ activityState?: ActivityState;
1886
+ lastActivityAt?: number;
1887
+ currentTool?: string;
1888
+ currentToolStartedAt?: number;
1889
+ currentPath?: string;
1890
+ turnCount?: number;
1891
+ toolCount?: number;
1892
+ steering?: SteeringStatus;
1893
+ startedAt: number;
1894
+ endedAt?: number;
1895
+ lastUpdate?: number;
1896
+ timeoutMs?: number;
1897
+ deadlineAt?: number;
1898
+ timedOut?: boolean;
1899
+ stopped?: boolean;
1900
+ turnBudget?: TurnBudgetState;
1901
+ turnBudgetExceeded?: boolean;
1902
+ wrapUpRequested?: boolean;
1903
+ toolBudget?: ToolBudgetState;
1904
+ toolBudgetBlocked?: boolean;
1905
+ usageBudget?: UsageBudgetState;
1906
+ pid?: number;
1907
+ /** Linux PID namespace identity used to scope liveness probes. */
1908
+ pidNamespaceScope?: string;
1909
+ /** Boot id of the machine when `pid` was recorded; a different current boot id proves the pid dead. */
1910
+ bootId?: string;
1911
+ cwd?: string;
1912
+ /** User-configured launcher that wrapped the background runner (argv only, never environment). */
1913
+ launcher?: RunnerLauncher;
1914
+ /** Parent-resolved child session root retained for trusted restored transcript lookup. */
1915
+ sessionRoot?: string;
1916
+ currentStep?: number;
1917
+ chainStepCount?: number;
1918
+ pendingAppends?: number;
1919
+ parallelGroups?: AsyncParallelGroupStatus[];
1920
+ workflowGraph?: WorkflowGraphSnapshot;
1921
+ preflight?: WorkflowPreflight;
1922
+ processTerminal?: ProcessTerminal;
1923
+ runFanoutBudget?: RunFanoutBudgetSnapshot;
1924
+ runFanoutBudgetDescriptor?: RunFanoutBudgetDescriptor;
1925
+ launchContractDigest?: string;
1926
+ sandbox?: string;
1927
+ permissionProfile?: string;
1928
+ launchResolvedExtensions?: LaunchResolvedChildExtensions;
1929
+ runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensions;
1930
+ capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
1931
+ /** Parent admission authority before the selected workflow child's descendant restrictions. */
1932
+ admissionCapabilityCeiling?: ResolvedSubagentCapabilityCeiling;
1933
+ capabilityAudit?: SubagentCapabilityAudit;
1934
+ workflow?: Details["workflow"];
1935
+ workflowChildren?: WorkflowChildSummary;
1936
+ parentWorkflowRunId?: string;
1937
+ workflowKey?: string;
1938
+ lane?: WorkflowLaneMetadata;
1939
+ /** Set when a durable schedule launched this run, so completions can name their origin. */
1940
+ scheduleOrigin?: ScheduleOrigin;
1941
+ steps?: Array<{
1942
+ /** Stable caller-facing child identity for inspect/status/stop. */
1943
+ childId?: string;
1944
+ agent: string;
1945
+ /** Human-readable display name for the child session, when derived at launch. */
1946
+ sessionName?: string;
1947
+ runner?: ExternalCliRunnerStatus | ExternalJobRunnerStatus;
1948
+ externalProcess?: ExternalProcessStatus;
1949
+ externalJob?: ExternalJobStatus;
1950
+ /** Resolved launch context for this child step. */
1951
+ context?: "fresh" | "fork";
1952
+ /** Short caller-facing task/goal shown in fleet surfaces when available. */
1953
+ description?: string;
1954
+ phase?: string;
1955
+ label?: string;
1956
+ workflowKey?: string;
1957
+ lane?: WorkflowLaneMetadata;
1958
+ /** Worktree path copied at setup; the handoff stays authoritative for the cwd. */
1959
+ worktreePath?: string;
1960
+ /** Display-only branch copied at launch; handoff remains authoritative. */
1961
+ branch?: string;
1962
+ /** Display-only provisioning provider copied at launch; handoff remains authoritative. */
1963
+ provider?: ManagedWorktreeProvider;
1964
+ /** Display-only naming evidence copied at launch; handoff remains authoritative. */
1965
+ naming?: WorktreeNaming;
1966
+ /** Child run identity for workflow capacity reconciliation. */
1967
+ runId?: string;
1968
+ /** True only when this workflow child owns a detached async runner. */
1969
+ async?: boolean;
1970
+ parentWorkflowRunId?: string;
1971
+ outputName?: string;
1972
+ structured?: boolean;
1973
+ status: "pending" | "running" | "complete" | "completed" | "failed" | "partial" | "paused" | "stopped" | "rejected";
1974
+ /** Workflow child result reused from a previous runtime-replaced run; the child was not re-run. */
1975
+ reused?: boolean;
1976
+ stopRequested?: boolean;
1977
+ stopRequestedAt?: number;
1978
+ children?: NestedRunSummary[];
1979
+ sessionFile?: string;
1980
+ transcriptPath?: string;
1981
+ transcriptError?: string;
1982
+ activityState?: ActivityState;
1983
+ lastActivityAt?: number;
1984
+ currentTool?: string;
1985
+ currentToolArgs?: string;
1986
+ currentToolStartedAt?: number;
1987
+ currentPath?: string;
1988
+ recentTools?: Array<{
1989
+ tool: string;
1990
+ args: string;
1991
+ endMs: number;
1992
+ }>;
1993
+ recentOutput?: string[];
1994
+ turnCount?: number;
1995
+ toolCount?: number;
1996
+ startedAt?: number;
1997
+ endedAt?: number;
1998
+ durationMs?: number;
1999
+ exitCode?: number | null;
2000
+ timedOut?: boolean;
2001
+ timeoutRecovery?: TimeoutRecoverySummary;
2002
+ stopped?: boolean;
2003
+ turnBudget?: TurnBudgetState;
2004
+ turnBudgetExceeded?: boolean;
2005
+ wrapUpRequested?: boolean;
2006
+ toolBudget?: ToolBudgetState;
2007
+ toolBudgetBlocked?: boolean;
2008
+ tokens?: TokenUsage;
2009
+ skills?: string[];
2010
+ model?: string;
2011
+ /** Model the child was launched on, recorded when its replies reported a different `model`; revival uses it. */
2012
+ launchModel?: string;
2013
+ /** Provider and model recorded on this child's latest own live assistant reply; never the requested model. */
2014
+ resolvedModel?: {
2015
+ provider: string;
2016
+ model: string;
2017
+ };
2018
+ thinking?: string;
2019
+ contextLimit?: number;
2020
+ thinkingCeiling?: ThinkingLevel;
2021
+ requestedModel?: string;
2022
+ /** True when the child input exceeded the model context window. */
2023
+ contextOverflow?: boolean;
2024
+ totalCost?: CostSummary;
2025
+ steering?: SteeringStatus;
2026
+ error?: string;
2027
+ structuredOutput?: unknown;
2028
+ structuredOutputPath?: string;
2029
+ structuredOutputSchemaPath?: string;
2030
+ acceptance?: AcceptanceLedger;
2031
+ agentContract?: AgentContract;
2032
+ launchContractDigest?: string;
2033
+ sandbox?: string;
2034
+ permissionProfile?: string;
2035
+ launchResolvedExtensions?: LaunchResolvedChildExtensions;
2036
+ runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensions;
2037
+ execution?: ExecutionProjection;
2038
+ review?: ReviewProjection;
2039
+ effects?: EffectsProjection;
2040
+ watchdog?: ChildWatchdogProgress;
2041
+ processTerminal?: ProcessTerminal;
2042
+ capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
2043
+ capabilityAudit?: SubagentCapabilityAudit;
2044
+ }>;
2045
+ sessionDir?: string;
2046
+ outputFile?: string;
2047
+ totalTokens?: TokenUsage;
2048
+ totalCost?: CostSummary;
2049
+ sessionFile?: string;
2050
+ outputs?: ChainOutputMap;
2051
+ parallelHandoff?: ParallelHandoffReference;
2052
+ }
2053
+ export type AsyncJobStep = Omit<NonNullable<AsyncStatus["steps"]>[number], "timeoutRecovery"> & {
2054
+ index?: number;
2055
+ description?: string;
2056
+ timeoutRecovery?: TimeoutRecoveryProjection;
2057
+ };
2058
+ export interface AsyncJobState {
2059
+ asyncId: string;
2060
+ asyncDir: string;
2061
+ /** Host tool-call id retained when it differs from the internal run id. */
2062
+ toolCallId?: string;
2063
+ /** Parent-resolved launch directory retained for trusted live artifact lookup. */
2064
+ cwd?: string;
2065
+ /** Parent-resolved child session root retained for trusted live transcript lookup. */
2066
+ sessionRoot?: string;
2067
+ status: "queued" | "running" | "complete" | "failed" | "partial" | "paused" | "stopped" | "rejected";
2068
+ /** Short caller-facing task/goal shown in fleet surfaces when available. */
2069
+ description?: string;
2070
+ pid?: number;
2071
+ sessionId?: string;
2072
+ completionOwnerId?: string;
2073
+ activityState?: ActivityState;
2074
+ lastActivityAt?: number;
2075
+ currentTool?: string;
2076
+ currentToolStartedAt?: number;
2077
+ currentPath?: string;
2078
+ turnCount?: number;
2079
+ toolCount?: number;
2080
+ steering?: SteeringStatus;
2081
+ mode?: SubagentRunMode;
2082
+ /** Run-level context summary derived from step contexts. */
2083
+ context?: "fresh" | "fork" | "mixed";
2084
+ agents?: string[];
2085
+ currentStep?: number;
2086
+ chainStepCount?: number;
2087
+ parallelGroups?: AsyncParallelGroupStatus[];
2088
+ /** Bounded host-owned CI/gate nodes loaded from the workflow status graph. */
2089
+ hostSteps?: HostStepNode[];
2090
+ /** Full bounded workflow plan, including not-yet-materialized stages. */
2091
+ workflowGraph?: WorkflowGraphSnapshot;
2092
+ steps?: AsyncJobStep[];
2093
+ preflight?: WorkflowPreflight;
2094
+ stepsTotal?: number;
2095
+ runningSteps?: number;
2096
+ completedSteps?: number;
2097
+ hasParallelGroups?: boolean;
2098
+ activeParallelGroup?: boolean;
2099
+ startedAt?: number;
2100
+ updatedAt?: number;
2101
+ timeoutMs?: number;
2102
+ deadlineAt?: number;
2103
+ timedOut?: boolean;
2104
+ stopped?: boolean;
2105
+ turnBudget?: TurnBudgetState;
2106
+ turnBudgetExceeded?: boolean;
2107
+ wrapUpRequested?: boolean;
2108
+ toolBudget?: ToolBudgetState;
2109
+ toolBudgetBlocked?: boolean;
2110
+ sessionDir?: string;
2111
+ outputFile?: string;
2112
+ totalTokens?: TokenUsage;
2113
+ totalCost?: CostSummary;
2114
+ usageBudget?: UsageBudgetState;
2115
+ sessionFile?: string;
2116
+ controlEventCursor?: number;
2117
+ nestedRoute?: NestedRouteInfo;
2118
+ nestedChildren?: NestedRunSummary[];
2119
+ parentWorkflowRunId?: string;
2120
+ workflowKey?: string;
2121
+ workflow?: Details["workflow"];
2122
+ workflowChildren?: WorkflowChildSummary;
2123
+ lane?: WorkflowLaneMetadata;
2124
+ }
2125
+ export interface ForegroundResumeChild {
2126
+ agent: string;
2127
+ /** Human-readable display name for the child session, when derived at launch. */
2128
+ sessionName?: string;
2129
+ index: number;
2130
+ context?: "fresh" | "fork";
2131
+ sessionFile?: string;
2132
+ model?: string;
2133
+ thinking?: string;
2134
+ status: SubagentResultStatus;
2135
+ activityState?: ActivityState;
2136
+ lastActivityAt?: number;
2137
+ currentTool?: string;
2138
+ currentToolStartedAt?: number;
2139
+ currentPath?: string;
2140
+ turnCount?: number;
2141
+ tokens?: number;
2142
+ window?: number;
2143
+ windowPeak?: number;
2144
+ toolCount?: number;
2145
+ exitCode?: number;
2146
+ error?: string;
2147
+ finalOutput?: string;
2148
+ outputState?: SubagentOutputState;
2149
+ /** True when the output is unfinished streamed text recovered after a timeout or child error. */
2150
+ outputPartial?: boolean;
2151
+ outputMode?: OutputMode;
2152
+ savedOutputPath?: string;
2153
+ outputSaveError?: string;
2154
+ artifactPaths?: ArtifactPaths;
2155
+ transcriptPath?: string;
2156
+ transcriptError?: string;
2157
+ detachedReason?: string;
2158
+ acceptance?: AcceptanceLedger;
2159
+ agentContract?: AgentContract;
2160
+ /** Private bounded launch fields needed to preserve the child contract on resume. */
2161
+ resumeContract?: {
2162
+ modelResponseAliases?: Record<string, string[]>;
2163
+ outputSchema?: JsonSchemaObject | false;
2164
+ agentContract?: AgentContract;
2165
+ acceptance?: AcceptanceInput;
2166
+ output?: string | boolean;
2167
+ outputMode?: OutputMode;
2168
+ };
2169
+ launchContractDigest?: string;
2170
+ sandbox?: string;
2171
+ permissionProfile?: string;
2172
+ /** Private retained launch authority. Never project into status or result output. */
2173
+ extensionBindings?: ExtensionBindings;
2174
+ requiredExtensions?: RequiredChildExtensionSnapshot;
2175
+ launchResolvedExtensions?: LaunchResolvedChildExtensions;
2176
+ runtimeAcknowledgedExtensions?: RuntimeAcknowledgedChildExtensions;
2177
+ execution?: ExecutionProjection;
2178
+ review?: ReviewProjection;
2179
+ effects?: EffectsProjection;
2180
+ capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
2181
+ capabilityAudit?: SubagentCapabilityAudit;
2182
+ updatedAt?: number;
2183
+ }
2184
+ export interface ForegroundResumeRun {
2185
+ runId: string;
2186
+ mode: SubagentRunMode;
2187
+ cwd: string;
2188
+ /** Originating parent session. Detached exits can outlive the active session. */
2189
+ sessionId?: string;
2190
+ updatedAt: number;
2191
+ children: ForegroundResumeChild[];
2192
+ /** Pi process running this run; only on records whose child is `running`. */
2193
+ owner?: RecordedPid;
2194
+ /** Workflow that launched this foreground child. */
2195
+ parentWorkflowRunId?: string;
2196
+ }
2197
+ export interface ForegroundChildControl {
2198
+ index: number;
2199
+ agent: string;
2200
+ /** Human-readable display name for the child's session, when derived at launch. */
2201
+ sessionName?: string;
2202
+ description?: string;
2203
+ startedAt: number;
2204
+ updatedAt: number;
2205
+ currentActivityState?: ActivityState;
2206
+ lastActivityAt?: number;
2207
+ currentTool?: string;
2208
+ currentToolStartedAt?: number;
2209
+ currentPath?: string;
2210
+ turnCount?: number;
2211
+ tokens?: number;
2212
+ inputTokens?: number;
2213
+ outputTokens?: number;
2214
+ window?: number;
2215
+ windowPeak?: number;
2216
+ model?: string;
2217
+ thinking?: string;
2218
+ toolCount?: number;
2219
+ interrupt?: () => boolean;
2220
+ detach?: () => boolean;
2221
+ /** Steer the live in-process child session; undefined until the session exists. */
2222
+ steer?: (input: ForegroundSteerInput) => Promise<ForegroundSteerOutcome>;
2223
+ }
2224
+ export interface ForegroundSteerInput {
2225
+ message: string;
2226
+ mode?: "steer" | "follow_up" | "auto";
2227
+ }
2228
+ export interface ForegroundSteerOutcome {
2229
+ state: "delivered" | "queued" | "failed";
2230
+ reason?: string;
2231
+ }
2232
+ export interface ForegroundRunControl {
2233
+ runId: string;
2234
+ /** Workflow shell that owns this live foreground child, when applicable. */
2235
+ parentWorkflowRunId?: string;
2236
+ /** Stable workflow lane key for this live foreground child. */
2237
+ workflowKey?: string;
2238
+ /** Originating parent session; required for public fleet projection. */
2239
+ sessionId?: string;
2240
+ mode: SubagentRunMode;
2241
+ startedAt: number;
2242
+ updatedAt: number;
2243
+ /** Effective working directory used to resolve live transcript artifacts. */
2244
+ cwd?: string;
2245
+ currentAgent?: string;
2246
+ /** Human-readable display name for the current child session, when derived at launch. */
2247
+ sessionName?: string;
2248
+ currentIndex?: number;
2249
+ /** Short caller-facing task/goal shown in fleet surfaces when available. */
2250
+ description?: string;
2251
+ currentActivityState?: ActivityState;
2252
+ lastActivityAt?: number;
2253
+ currentTool?: string;
2254
+ currentToolStartedAt?: number;
2255
+ currentPath?: string;
2256
+ turnCount?: number;
2257
+ tokens?: number;
2258
+ inputTokens?: number;
2259
+ outputTokens?: number;
2260
+ window?: number;
2261
+ windowPeak?: number;
2262
+ model?: string;
2263
+ thinking?: string;
2264
+ toolCount?: number;
2265
+ /** Independently tracked children for foreground parallel work and fleet inspection. */
2266
+ activeChildren?: Map<number, ForegroundChildControl>;
2267
+ /** Live Prompt Audit redo callback. It is current-session memory only. */
2268
+ promptAuditRedo?: (index: number, guidance: string) => Promise<{
2269
+ text: string;
2270
+ isError?: boolean;
2271
+ }>;
2272
+ /** Memory-only source run for Prompt Audit redo. */
2273
+ sourceRunId?: string;
2274
+ /** Memory-only replacement run started by Prompt Audit redo. */
2275
+ supersededByRunId?: string;
2276
+ /** Scheduling owners that may still launch another child. Removal is safe only at zero. */
2277
+ schedulingOwners?: number;
2278
+ nestedRoute?: NestedRouteInfo;
2279
+ nestedChildren?: NestedRunSummary[];
2280
+ interrupt?: () => boolean;
2281
+ detach?: () => boolean;
2282
+ steer?: ForegroundChildControl["steer"];
2283
+ /** Set while a detached child runs: records it as stopped, then aborts it, when this runtime is replaced. */
2284
+ stopForRuntimeReplacement?: () => void;
2285
+ }
2286
+ export interface WaitSubscriptionRecord {
2287
+ version: 1;
2288
+ token: string;
2289
+ sessionId: string;
2290
+ targetKind: "async" | "foreground";
2291
+ runId: string;
2292
+ requestedId: string;
2293
+ createdAt: number;
2294
+ expiresAt: number;
2295
+ }
2296
+ export interface ActiveAsyncCapacitySnapshot {
2297
+ used: number;
2298
+ /** Zero means the opt-in cap is disabled. */
2299
+ limit: number;
2300
+ }
2301
+ export interface SubagentState {
2302
+ baseCwd: string;
2303
+ currentSessionId: string | null;
2304
+ /** Exact SDK runtime session ID (`getSessionId()`) for supervisor ownership and background-work matching; never a session file path. */
2305
+ supervisorOwnerSessionId?: string | null;
2306
+ /** Session for which active status projections were restored successfully. */
2307
+ statusProjectionSessionId?: string | null;
2308
+ /** Reload-stable identity for this parent Pi process/window. */
2309
+ completionOwnerId?: string;
2310
+ /** Runtime-owned artifact resolution inputs used by Fleet transcript targeting. */
2311
+ artifactDirPreference?: ArtifactDirPreference;
2312
+ /** Runtime authority snapshot used by optional inspector controls. */
2313
+ authorityPolicy?: AuthorityPolicyConfig;
2314
+ /** Runtime mission-store snapshot used by optional inspector context. */
2315
+ missionStoreConfig?: MissionStoreConfig;
2316
+ parentSessionFile?: string | null;
2317
+ /** Extension-owned roots trusted for child session transcript reads. */
2318
+ trustedSessionRoots?: string[];
2319
+ /** Pi sessions base that caps exact runtime-recorded session file trust. */
2320
+ trustedSessionFileRoot?: string;
2321
+ /** Live async session roots created by this parent executor, keyed by run id. */
2322
+ liveAsyncSessionRoots?: Map<string, string>;
2323
+ /** Foreground nested routes retained after their direct parent settles, keyed by root run id. */
2324
+ retainedForegroundNestedRoutes?: Map<string, NestedRouteInfo>;
2325
+ /** Lookup authority outlives live controls, but never crosses the owning session. */
2326
+ retainedNestedLookupRoutes?: {
2327
+ sessionId: string;
2328
+ routes: Map<string, NestedRouteInfo>;
2329
+ };
2330
+ /** Last valid parent session model observed for this session; used when continuation contexts omit ctx.model. */
2331
+ lastParentModel?: {
2332
+ provider: string;
2333
+ id: string;
2334
+ };
2335
+ subagentInProgress?: boolean;
2336
+ subagentSpawns?: {
2337
+ sessionId: string | null;
2338
+ count: number;
2339
+ configuredLimit?: number | null;
2340
+ granted?: number;
2341
+ grantHistory?: SpawnBudgetGrant[];
2342
+ };
2343
+ /** Current-session top-level async capacity projection. */
2344
+ activeAsyncCapacity?: ActiveAsyncCapacitySnapshot;
2345
+ /** Herdr project panes opened by this Pi session, keyed by project root. */
2346
+ herdrProjectPanes?: Map<string, HerdrProjectPaneSnapshot>;
2347
+ asyncJobs: Map<string, AsyncJobState>;
2348
+ /** Current-session active and recent async runs for the native fleet inspector. */
2349
+ fleetJobs?: Map<string, AsyncJobState>;
2350
+ /** Suppress dynamic status widgets while the fleet overlay owns the viewport. */
2351
+ fleetInspectorOpen?: boolean;
2352
+ /** Temporarily suppress dynamic widgets while Pi compacts the session. */
2353
+ widgetsSuspended?: boolean;
2354
+ foregroundRuns?: Map<string, ForegroundResumeRun>;
2355
+ foregroundControls: Map<string, ForegroundRunControl>;
2356
+ lastForegroundControlId: string | null;
2357
+ cleanupTimers: Map<string, ReturnType<typeof setTimeout>>;
2358
+ lastUiContext: ExtensionContext | null;
2359
+ poller: NodeJS.Timeout | null;
2360
+ completionSeen: Map<string, number>;
2361
+ /** Session-owned terminal result payloads observed by the result watcher, keyed by run id and pruned by the completion TTL. */
2362
+ completedResults?: Map<string, {
2363
+ sessionId: string;
2364
+ seenAt: number;
2365
+ completion: WaitCompletion;
2366
+ }>;
2367
+ watcher: FSWatcher | null;
2368
+ watcherRestartTimer: ReturnType<typeof setTimeout> | null;
2369
+ resultFileCoalescer: {
2370
+ schedule(file: string, delayMs?: number): boolean;
2371
+ clear(): void;
2372
+ };
2373
+ /** Current-session durable non-blocking wait registrations. */
2374
+ waitSubscriptions?: Map<string, WaitSubscriptionRecord>;
2375
+ /** Live in-process workflow controllers. Durable status remains on disk after settlement. */
2376
+ workflowControllers?: Map<string, AbortController>;
2377
+ /** Live in-process workflow child stoppers keyed by parent workflow run id. */
2378
+ workflowChildStops?: Map<string, (childId: string, message?: string) => boolean>;
2379
+ /** Session-snapshot `<available_subagents>` block appended to the parent system prompt; empty when nothing is advertised. */
2380
+ contextInjectionBlock?: string;
2381
+ /** `subagents.injectAgents` entries that matched no discovered agent at snapshot time. */
2382
+ contextInjectionUnknownNames?: string[];
2383
+ /** Background children awaited by a blocking workflow call: their parent cannot answer supervisor asks. */
2384
+ blockingWorkflowChildren?: Set<string>;
2385
+ }
2386
+ export interface HerdrProjectPaneSnapshot {
2387
+ projectRoot: string;
2388
+ bindingPath: string;
2389
+ paneId: string;
2390
+ openedAt: string;
2391
+ lastFocusedAt?: string;
2392
+ state: "open" | "stale";
2393
+ agentStatus: string;
2394
+ ownership: "verified" | "unknown" | "mismatch";
2395
+ safeToClose: boolean;
2396
+ refreshedAt: number;
2397
+ summary?: string;
2398
+ tabId?: string;
2399
+ workspaceId?: string;
2400
+ terminalTitle?: string;
2401
+ staleReason?: string;
2402
+ }
2403
+ export type DisplayItem = {
2404
+ type: "text";
2405
+ text: string;
2406
+ } | {
2407
+ type: "tool";
2408
+ name: string;
2409
+ args: Record<string, unknown>;
2410
+ };
2411
+ export interface ErrorInfo {
2412
+ hasError: boolean;
2413
+ exitCode?: number;
2414
+ errorType?: string;
2415
+ details?: string;
2416
+ }
2417
+ export interface IntercomEventBus {
2418
+ on(channel: string, handler: (data: unknown) => void): () => void;
2419
+ emit(channel: string, data: unknown): void;
2420
+ }
2421
+ export declare const INTERCOM_DETACH_REQUEST_EVENT = "pi-intercom:detach-request";
2422
+ export declare const INTERCOM_DETACH_RESPONSE_EVENT = "pi-intercom:detach-response";
2423
+ /** pi-intercom asks each session for a fixed intercom ID at session start; `claim(id)` answers synchronously. */
2424
+ export declare const INTERCOM_SESSION_IDENTITY_EVENT = "intercom:session-identity";
2425
+ export declare const SUBAGENT_ASYNC_STARTED_EVENT = "subagent:async-started";
2426
+ /** Launcher names are plain identifiers so they survive frontmatter rewrites without quoting. */
2427
+ export declare const RUNNER_LAUNCHER_NAME_PATTERN: RegExp;
2428
+ export declare const RUNNER_LAUNCHER_NAME_RULE = "must start with a letter or digit and use only letters, digits, '.', '_' or '-' (at most 128 characters)";
2429
+ export interface RunnerLauncher {
2430
+ name: string;
2431
+ argv: string[];
2432
+ }
2433
+ export declare const SUBAGENT_ASYNC_COMPLETE_EVENT = "subagent:async-complete";
2434
+ export declare const SUBAGENT_PROCESS_TERMINAL_EVENT = "subagent:process-terminal";
2435
+ export declare const SUBAGENT_FOREGROUND_COMPLETE_EVENT = "subagent:foreground-complete";
2436
+ export declare const SUBAGENT_CONTROL_EVENT = "subagent:control-event";
2437
+ export declare const SUBAGENT_CONTROL_INTERCOM_EVENT = "subagent:control-intercom";
2438
+ export declare const SUBAGENT_STEERING_NOTICE_EVENT = "subagent:steering-notice";
2439
+ export declare const SUBAGENT_CHILD_STATUS_EVENT = "subagent:child-status";
2440
+ /** Payload is only `{ version: 1 }`: a hint for hosts to read `status` again, not a description of the change. */
2441
+ export declare const SUBAGENT_JOBS_CHANGED_EVENT = "subagent:jobs-changed";
2442
+ export declare const SUBAGENT_RESULT_INTERCOM_EVENT = "subagent:result-intercom";
2443
+ export declare const SUBAGENT_RESULT_INTERCOM_DELIVERY_EVENT = "subagent:result-intercom-delivery";
2444
+ export interface SubagentChildStatusEvent {
2445
+ type: "subagent.child-status";
2446
+ version: 1;
2447
+ runId: string;
2448
+ childId: string;
2449
+ status: "started" | "stopping" | "stopped";
2450
+ ts: number;
2451
+ reason?: string;
2452
+ source?: "rpc" | "async";
2453
+ asyncDir?: string;
2454
+ stepIndex?: number;
2455
+ agent?: string;
2456
+ childRunId?: string;
2457
+ workflowKey?: string;
2458
+ phase?: string;
2459
+ label?: string;
2460
+ }
2461
+ /** Live controls for one in-process foreground child session. */
2462
+ export interface ForegroundChildSessionControls {
2463
+ steer: (text: string) => Promise<void>;
2464
+ followUp: (text: string) => Promise<void>;
2465
+ /** Abort the live child and report the run as stopped with `reason`. */
2466
+ stop: (reason: string) => void;
2467
+ }
2468
+ export interface RunSyncOptions {
2469
+ /** Exact discovery provenance for an unknown-agent error; omission uses defensive fallback discovery. */
2470
+ unknownAgentDiagnosticContext?: import("../agents/agents.ts").UnknownAgentDiagnosticContext;
2471
+ /** Session factory for the in-process child; defaults to the process-wide factory. */
2472
+ childSessionFactory?: import("../runs/shared/child-session.ts").ChildSessionFactory;
2473
+ /** Invoking parent registry inherited only by its local foreground launch. */
2474
+ parentProviderRegistry?: import("../runs/shared/child-session.ts").ParentProviderRegistry;
2475
+ /** The launching executor's own child runtime when it is itself an in-process child. */
2476
+ childRuntime?: import("../runs/shared/child-runtime-config.ts").ChildRuntimeConfig;
2477
+ /** Fires once the child session exists and can be steered. */
2478
+ onChildSession?: (controls: ForegroundChildSessionControls) => void;
2479
+ /** Opt-in global permission rules; missing tools remain allowed. */
2480
+ permissions?: import("../runs/shared/permissions.ts").PermissionConfig;
2481
+ /** Session id of the direct parent session for permission-system ask forwarding. */
2482
+ parentSessionId?: string;
2483
+ /** The parent session's file, recorded as a new child session's `parentSession` header. */
2484
+ parentSessionFile?: string;
2485
+ /** Resolved launch context for this child. */
2486
+ context?: "fresh" | "fork";
2487
+ cwd?: string;
2488
+ /** Resolved pane-native saved-machine placement. */
2489
+ machine?: PlacementMachineReference;
2490
+ /** Explicit read override resolved by the remote ambient agent profile. */
2491
+ remoteReads?: string[] | false;
2492
+ /** Original cwd input retained for launch diagnostics. */
2493
+ requestedCwd?: string;
2494
+ signal?: AbortSignal;
2495
+ /** Report a child ended by `signal` as stopped; set for workflow children, whose signal is the workflow's. */
2496
+ abortedAsStopped?: boolean;
2497
+ interruptSignal?: AbortSignal;
2498
+ timeoutMs?: number;
2499
+ deadlineAt?: number;
2500
+ /** Per-call per-tool timeout (ms), resolved with the agent/config/environment ladder at execution. */
2501
+ toolTimeoutMs?: number;
2502
+ /** Raw global config.toolTimeoutMs, used by the per-child resolver. */
2503
+ configToolTimeoutMs?: number;
2504
+ usageBudget?: UsageBudgetConfig;
2505
+ toolBudget?: ResolvedToolBudget;
2506
+ /** Selected global sandbox profile, when this child requested one. */
2507
+ sandbox?: string;
2508
+ /** Selected global pi-permission-system profile, when this child requested one. */
2509
+ permissionProfile?: string;
2510
+ allowZeroToolBudget?: boolean;
2511
+ allowIntercomDetach?: boolean;
2512
+ intercomEvents?: IntercomEventBus;
2513
+ onUpdate?: (r: import("@earendil-works/pi-agent-core").AgentToolResult<Details>) => void;
2514
+ /** Internal structured-delegation transport optimization: skip unchanged live snapshots. */
2515
+ suppressUnchangedDelegationUpdates?: boolean;
2516
+ onControlEvent?: (event: ControlEvent) => void;
2517
+ /** Exposes a non-terminating detach callback while the child is active. */
2518
+ onDetachReady?: (detach: (reason?: string) => boolean) => void;
2519
+ /** Internal foreground receipt proposal; returns true only when the outer waiter accepted it. */
2520
+ onDetachReceipt?: (result: SingleResult) => boolean;
2521
+ /** Authoritative terminal result, emitted only after the full detached run finalizes. */
2522
+ onDetachedExit?: (result: SingleResult) => void | Promise<void>;
2523
+ controlConfig?: ResolvedControlConfig;
2524
+ intercomSessionName?: string;
2525
+ orchestratorIntercomTarget?: string;
2526
+ maxOutput?: MaxOutputConfig;
2527
+ artifactsDir?: string;
2528
+ artifactConfig?: ArtifactConfig;
2529
+ runId: string;
2530
+ index?: number;
2531
+ sessionDir?: string;
2532
+ sessionFile?: string;
2533
+ share?: boolean;
2534
+ outputPath?: string;
2535
+ outputClaimPath?: string;
2536
+ outputMode?: OutputMode;
2537
+ maxSubagentDepth?: number;
2538
+ /** Effective parent wait-tool setting propagated to the child runtime. */
2539
+ waitToolEnabled?: boolean;
2540
+ /** Effective parent default wait window propagated to the child runtime. */
2541
+ waitToolDefaultTimeoutMs?: number;
2542
+ capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
2543
+ /** Whether project-scoped agent/config inputs were trusted by the host. */
2544
+ projectTrusted?: boolean;
2545
+ /** Exact trusted parent cwd; project config applies only when it matches this child cwd. */
2546
+ trustedProjectCwd?: string;
2547
+ runFanoutBudget?: RunFanoutBudgetDescriptor;
2548
+ nestedRoute?: NestedRouteInfo;
2549
+ /** Override the agent's default model (format: "provider/id" or just "id") */
2550
+ modelOverride?: string;
2551
+ /** Opt into priority service tier for supported native OpenAI-Codex launches. */
2552
+ fast?: boolean;
2553
+ /** The override came from the running parent session, not configuration. */
2554
+ modelOverrideFromParent?: boolean;
2555
+ /** How the launch model was selected: explicit per-call, configured agent primary, or inherited parent. */
2556
+ modelOrigin?: "explicit" | "inherited" | "configured";
2557
+ /** Override the agent's default thinking level for this run */
2558
+ thinkingOverride?: AgentConfig["thinking"];
2559
+ thinkingCeiling?: ThinkingLevel;
2560
+ requiredExtensions?: RequiredChildExtensionSnapshot;
2561
+ extensionBindings?: ExtensionBindings;
2562
+ /** Package-internal one-use authorization for one foreground workflow child. */
2563
+ workflowChildPermitLaunch?: WorkflowChildPermitContext;
2564
+ /** Registry models available for heuristic bare-model resolution */
2565
+ availableModels?: Array<{
2566
+ provider: string;
2567
+ id: string;
2568
+ fullId: string;
2569
+ contextWindow?: number;
2570
+ }>;
2571
+ modelResponseAliases?: Record<string, string[]>;
2572
+ /** Current parent-session provider to prefer for ambiguous bare model ids */
2573
+ preferredModelProvider?: string;
2574
+ /** Parent Pi event host used to snapshot runtime-registered MCP servers before child launch. */
2575
+ runtimeSnapshotHost?: import("../runs/shared/mcp-direct-tool-allowlist.ts").McpRuntimeSnapshotHost;
2576
+ /** Optional subagent model-scope enforcement. */
2577
+ modelScope?: ModelScopeRule | ModelScopeRule[];
2578
+ /** Skills to make available (overrides agent default if provided) */
2579
+ skills?: string[];
2580
+ structuredOutput?: {
2581
+ schema: JsonSchemaObject;
2582
+ schemaPath: string;
2583
+ outputPath: string;
2584
+ acceptanceReportPath?: string;
2585
+ acceptanceReportRequired?: boolean;
2586
+ };
2587
+ agentContract?: AgentContract;
2588
+ acceptance?: AcceptanceInput;
2589
+ acceptanceContext?: {
2590
+ mode?: SubagentRunMode;
2591
+ async?: boolean;
2592
+ dynamic?: boolean;
2593
+ dynamicGroup?: boolean;
2594
+ };
2595
+ /** Private live callback for the exact child prompt after runtime acceptance injection. */
2596
+ onEffectivePrompt?: (prompt: string) => void;
2597
+ /** Internal lifecycle hook for the observer shared across retries of one logical child. */
2598
+ onOrcaProgressTabCreated?: (tab: import("../runs/shared/orca-progress-tabs.ts").OrcaProgressTab) => void;
2599
+ }
2600
+ export type IntercomBridgeMode = "off" | "fork-only" | "always";
2601
+ export interface IntercomBridgeConfig {
2602
+ mode?: IntercomBridgeMode;
2603
+ instructionFile?: string;
2604
+ /** Deliver grouped completion messages through an external acknowledged intercom listener. */
2605
+ resultDelivery?: boolean;
2606
+ }
2607
+ interface TopLevelParallelConfig {
2608
+ maxTasks?: number;
2609
+ concurrency?: number;
2610
+ }
2611
+ interface ExtensionChainConfig {
2612
+ dynamicFanout?: {
2613
+ maxItems?: number;
2614
+ };
2615
+ }
2616
+ export interface ProactiveSkillSubagentsConfig {
2617
+ enabled?: boolean;
2618
+ minReferences?: number;
2619
+ maxRecommendations?: number;
2620
+ preferredAgent?: string;
2621
+ }
2622
+ export type ToolDescriptionMode = "full" | "compact" | "custom";
2623
+ export type ToolActivationMode = "auto" | "dynamic" | "eager";
2624
+ export type InlineToolDisplay = "rich" | "summary";
2625
+ export interface ScheduledRunsConfig {
2626
+ enabled?: boolean;
2627
+ maxPending?: number;
2628
+ /** Absolute or `~/` root for per-project durable schedules. */
2629
+ storeRoot?: string;
2630
+ }
2631
+ export type FleetViewPlacement = "aboveEditor" | "belowEditor";
2632
+ export type AsyncWidgetLayout = "adaptive" | "rows";
2633
+ export declare const FLEET_KEYBINDING_ACTIONS: readonly ["close", "scrollUp", "scrollDown", "selectUp", "selectDown", "selectFirst", "selectLast", "pageUp", "pageDown", "refresh", "steer", "inspect", "stop", "toggleTools", "toggleThinking", "toggleRenderer"];
2634
+ export type FleetKeybindingAction = typeof FLEET_KEYBINDING_ACTIONS[number];
2635
+ export type FleetKeybindingsConfig = Partial<Record<FleetKeybindingAction, string[]>>;
2636
+ export interface OrcaProgressTabsConfig {
2637
+ /** Create one Orca observer tab per top-level subagent call. Experimental and opt-in. */
2638
+ enabled?: boolean;
2639
+ }
2640
+ export interface MainWindowRendererConfig {
2641
+ /** Unit of horizontal space in main chat subagent call/result rows. Omit to preserve current spacing. Set 0 for no extra padding. */
2642
+ horizontalSpacing?: number;
2643
+ /** Maximum collapsed rich-result rows. Expanded output is not capped. */
2644
+ compactResultMaxLines?: number;
2645
+ }
2646
+ export interface ForkContextConfig {
2647
+ /** Keep the complete fork by default, or summarize large text-only tool results before launch. */
2648
+ mode?: "full" | "pruned";
2649
+ /** Required pruning model when mode is "pruned". */
2650
+ model?: string;
2651
+ }
2652
+ export interface ActiveAsyncCapacityConfig {
2653
+ /** Reclaim failed runner slots after this age when process proof is unknown; false keeps strict retention. */
2654
+ abandonedSlotReleaseAfterMs?: number | false;
2655
+ }
2656
+ export interface ExtensionConfig {
2657
+ asyncByDefault?: boolean;
2658
+ /** Relaunch this session's interrupted async workflows when the session is reopened or reloaded (default true). */
2659
+ autoResume?: boolean;
2660
+ /** Set the context for launches that omit an explicit context. */
2661
+ defaultSubagentContext?: "fresh" | "fork";
2662
+ /** Configure how every resolved fork session is prepared before child spawn. */
2663
+ forkContext?: ForkContextConfig;
2664
+ /** Optional shortcut that detaches the active foreground single-subagent run. */
2665
+ foregroundDetachShortcut?: string;
2666
+ /** Show the Claude Code-style navigable fleet. Defaults to true. */
2667
+ fleetView?: boolean;
2668
+ /** Place the persistent FleetView above or below the editor. Defaults to belowEditor. */
2669
+ fleetViewPlacement?: FleetViewPlacement;
2670
+ /** Local keybindings for the full Fleet inspector. */
2671
+ fleetKeybindings?: FleetKeybindingsConfig;
2672
+ /** Show the under-editor async runs widget. Defaults to true, including when FleetView is enabled. */
2673
+ asyncWidget?: boolean;
2674
+ /** Start the under-editor async runs widget folded. Defaults to false. */
2675
+ asyncWidgetCollapsed?: boolean;
2676
+ /** Unfolded async runs widget layout: "adaptive" fits run details to the terminal height, "rows" shows one line per run. Defaults to "adaptive". */
2677
+ asyncWidgetLayout?: AsyncWidgetLayout;
2678
+ /** Report subagent run state to the terminal with OSC 7501. Defaults to true. */
2679
+ programStatus?: boolean;
2680
+ /** Add a short `active_subagents` system prompt section listing this session's active background runs. Defaults to false. */
2681
+ activeRunsPrompt?: boolean;
2682
+ /** Exact provider/model candidates mapped to operator-declared equivalent response IDs. Empty arrays add no accepted IDs. */
2683
+ modelResponseAliases?: Record<string, string[]>;
2684
+ /** Named argv prefixes for background runners; agents select one with `launcher: <name>`. User config only. */
2685
+ runnerLaunchers?: Record<string, string[]>;
2686
+ /** Tool description variant registered for the parent-facing subagent tool. Defaults to split metadata. */
2687
+ toolDescriptionMode?: ToolDescriptionMode;
2688
+ /** How a new parent session offers the subagent tool. Defaults to auto. */
2689
+ toolActivation?: ToolActivationMode;
2690
+ /** Keep a resumed session on the pi-subagents tool definitions and prompt text it already declared. Defaults to true. */
2691
+ pinToolDeclarations?: boolean;
2692
+ /** Register the pi-subagents slash commands and the foreground-detach shortcut. Defaults to true. */
2693
+ enableSlashCommands?: boolean;
2694
+ /** Opt-in feature groups removed from the subagent tool schema and rejected at every execution boundary. */
2695
+ disabledFeatures?: SubagentFeature[];
2696
+ /** Inline chat rendering for the subagent tool. Defaults to rich. */
2697
+ inlineToolDisplay?: InlineToolDisplay;
2698
+ /** Density controls for the main chat subagent call/result renderer. */
2699
+ mainWindowRenderer?: MainWindowRendererConfig;
2700
+ /** Experimental observer: mirror each native subagent's progress into a new Orca tab. */
2701
+ orcaProgressTabs?: OrcaProgressTabsConfig;
2702
+ forceTopLevelAsync?: boolean;
2703
+ waitTool?: WaitToolConfig;
2704
+ defaultSessionDir?: string;
2705
+ singleRunOutputBaseDir?: string;
2706
+ maxSubagentDepth?: number;
2707
+ /** Optional cumulative session cap. Unset or 0 means unlimited. */
2708
+ maxSubagentSpawnsPerSession?: number;
2709
+ /** Cumulative logical-child cap for one top-level run tree. Defaults to 64. */
2710
+ maxSubagentSpawnsPerRun?: number;
2711
+ /** Optional active top-level async run cap per parent session. Unset or 0 means unlimited. */
2712
+ maxActiveAsyncRunsPerSession?: number;
2713
+ /** Active-capacity cleanup policy. */
2714
+ capacity?: ActiveAsyncCapacityConfig;
2715
+ /** Global cap on simultaneously-running subagent tasks within a single run. Defaults to 20. */
2716
+ globalConcurrencyLimit?: number;
2717
+ /**
2718
+ * Global default runtime deadline in milliseconds. It replaces the built-in
2719
+ * 30-minute backstop for single, parallel, and chain launches (foreground, plus
2720
+ * plain single-agent async runs) when neither the call (`timeoutMs`/`maxRuntimeMs`)
2721
+ * nor the selected agent provides a timeout. Explicit call values and agent
2722
+ * frontmatter defaults still win. Composite async runs (chain/parallel/workflow)
2723
+ * stay unbounded at the top level by design — their children are bounded individually.
2724
+ * Must be a positive integer; invalid values are ignored.
2725
+ */
2726
+ timeoutMs?: number;
2727
+ /**
2728
+ * Optional hard per-tool-call timeout in milliseconds. Bounds a single
2729
+ * subagent tool call inside the child; the run-level timeout remains
2730
+ * authoritative. Known-fast built-in tools have a five-minute default when
2731
+ * this is undefined. Precedence: call param > agent frontmatter > this config >
2732
+ * PI_SUBAGENT_TOOL_TIMEOUT_MS. Must be a positive integer; invalid values
2733
+ * are rejected with an error.
2734
+ */
2735
+ toolTimeoutMs?: number;
2736
+ /**
2737
+ * Global default for the async single-agent `checkpointBeforeDeadlineMs` launch option: the runner requests that
2738
+ * the child checkpoint and stop this many milliseconds before its run deadline (best-effort). The call param wins; values that
2739
+ * leave no run time before the checkpoint disarm it.
2740
+ */
2741
+ checkpointBeforeDeadlineMs?: number;
2742
+ control?: ControlConfig;
2743
+ completionBatch?: CompletionBatchConfig;
2744
+ toolBudget?: ToolBudgetConfig;
2745
+ /** Opt-in native tool permissions. Bash remains outside this policy. */
2746
+ permissions?: import("../runs/shared/permissions.ts").PermissionConfig;
2747
+ usageBudget?: UsageBudgetConfig;
2748
+ parallel?: TopLevelParallelConfig;
2749
+ chain?: ExtensionChainConfig;
2750
+ worktreeSetupHook?: string;
2751
+ worktreeSetupHookTimeoutMs?: number;
2752
+ worktreeBaseDir?: string;
2753
+ /** Enable managed worktrees when a launch does not provide an explicit value. */
2754
+ worktree?: boolean;
2755
+ /** Worktree allocator selection. Defaults to auto. */
2756
+ worktreeProvider?: WorktreeProvider;
2757
+ /** Namespace used by managed worktree branches. Defaults to pi-subagents/. */
2758
+ worktreeBranchPrefix?: string;
2759
+ /** Where to store subagent artifact files. Defaults to "session" (the pi session directory, or OS temp when unavailable). Set to "project" for cwd/.pi/subagents. */
2760
+ artifactDir?: ArtifactDirPreference;
2761
+ /** Artifact cleanup retention. Set cleanupDays to 0 to disable cleanup. */
2762
+ artifactConfig?: Pick<ArtifactConfig, "cleanupDays">;
2763
+ intercomBridge?: IntercomBridgeConfig;
2764
+ /** Control how slow result-index scans are logged. Defaults to \"activity\".
2765
+ * - \"all\": log every slow scan, including scans that find nothing.
2766
+ * - \"activity\": log only slow scans that found or scheduled work. Silences
2767
+ * the periodic healthy rescan that inspects zero files while no async runs
2768
+ * are pending, which otherwise spams the session transcript.
2769
+ * - \"off\": never log slow result-index scans. */
2770
+ resultScanLogging?: "all" | "activity" | "off";
2771
+ proactiveSkillSubagents?: ProactiveSkillSubagentsConfig | false;
2772
+ scheduledRuns?: ScheduledRunsConfig;
2773
+ /** Durable mission behavior. Missions are automatic by default; set enabled:false to disable auto-create. Explicit mission actions/fields still work. */
2774
+ missions?: MissionStoreConfig;
2775
+ /** Small fixed authority policy for the supported operational actions. */
2776
+ authorityPolicy?: AuthorityPolicyConfig;
2777
+ }
2778
+ export declare const DEFAULT_MAX_OUTPUT: Required<MaxOutputConfig>;
2779
+ export declare const DEFAULT_ARTIFACT_CONFIG: ArtifactConfig;
2780
+ export declare function resolveTempScopeId(options?: {
2781
+ env?: NodeJS.ProcessEnv;
2782
+ getuid?: (() => number) | undefined;
2783
+ userInfo?: (() => {
2784
+ username?: string | null;
2785
+ }) | undefined;
2786
+ homedir?: (() => string) | undefined;
2787
+ }): string;
2788
+ export declare const TEMP_ROOT_DIR: string;
2789
+ export declare const RESULTS_DIR: string;
2790
+ export declare const ASYNC_DIR: string;
2791
+ export declare const CHAIN_RUNS_DIR: string;
2792
+ export declare const TEMP_ARTIFACTS_DIR: string;
2793
+ export declare const DIRS: {
2794
+ results: string;
2795
+ async: string;
2796
+ chain: string;
2797
+ artifacts: string;
2798
+ };
2799
+ export declare const WIDGET_KEY = "subagent-async";
2800
+ export declare const SLASH_RESULT_TYPE = "subagent-slash-result";
2801
+ export declare const SLASH_TEXT_RESULT_TYPE = "subagent-slash-text-result";
2802
+ export declare const SLASH_TEXT_VIEW_ONLY_DETAILS: {
2803
+ readonly viewOnly: true;
2804
+ };
2805
+ export declare const SLASH_SUBAGENT_REQUEST_EVENT = "subagent:slash:request";
2806
+ export declare const SLASH_SUBAGENT_STARTED_EVENT = "subagent:slash:started";
2807
+ export declare const SLASH_SUBAGENT_RESPONSE_EVENT = "subagent:slash:response";
2808
+ export declare const SLASH_SUBAGENT_UPDATE_EVENT = "subagent:slash:update";
2809
+ export declare const SLASH_SUBAGENT_CANCEL_EVENT = "subagent:slash:cancel";
2810
+ export declare const POLL_INTERVAL_MS = 250;
2811
+ export declare const WIDGET_ANIMATION_INTERVAL_MS = 1000;
2812
+ export declare const MAX_WIDGET_JOBS = 4;
2813
+ export declare const DEFAULT_SUBAGENT_MAX_DEPTH = 2;
2814
+ export declare const SUBAGENT_ACTIONS: readonly ["list", "get", "models", "children.list", "guide", "validate", "create", "update", "delete", "eject", "disable", "enable", "reset", "mission.create", "mission.list", "mission.show", "mission.update", "mission.resolve-decision", "mission.attach-run", "mission.close", "worktree.discard", "worktree.cleanup", "lane.status", "lane.recordMerge", "lane.recordSupersession", "refine", "refine.show", "refine.rollback", "inspector.open", "inspector.command", "inspector.status", "inspector.close", "project.open", "project.status", "project.close", "status", "debug.run", "grant-spawn-budget", "interrupt", "resume", "steer", "stop", "command.status", "command.yield", "command.cancel", "dismiss", "doctor", "watchdog.status", "watchdog.check", "watchdog.configure", "watchdog.recommend-model", "schedule.create", "schedule.list", "schedule.show", "schedule.history", "schedule.pause", "schedule.resume", "schedule.run", "schedule.run-due", "schedule.delete"];
2815
+ export declare const DEFAULT_FORK_PREAMBLE: string;
2816
+ export declare function resolveTopLevelParallelMaxTasks(value: unknown): number;
2817
+ export declare function resolveTopLevelParallelConcurrency(override: unknown, configValue: unknown): number;
2818
+ export declare function getAsyncConfigPath(suffix: string): string;
2819
+ export declare function wrapForkTask(task: string, preamble?: string | false): string;
2820
+ export declare function normalizeMaxSubagentDepth(value: unknown): number | undefined;
2821
+ /** Depth context of the executor's own child runtime, when it runs as an in-process child. */
2822
+ export interface SubagentDepthContext {
2823
+ depth: number;
2824
+ maxDepth?: number;
2825
+ }
2826
+ export declare function resolveCurrentMaxSubagentDepth(configMaxDepth?: number, runtime?: SubagentDepthContext): number;
2827
+ export declare function resolveChildMaxSubagentDepth(parentMaxDepth: number, agentMaxDepth?: number): number;
2828
+ export declare function checkSubagentDepth(configMaxDepth?: number, runtime?: SubagentDepthContext): {
2829
+ blocked: boolean;
2830
+ depth: number;
2831
+ maxDepth: number;
2832
+ };
2833
+ /** Depth context handed to a child launched by an executor at `runtime` (undefined for a top-level parent). */
2834
+ export declare function resolveChildDepth(maxDepth?: number, runtime?: SubagentDepthContext): Required<SubagentDepthContext>;
2835
+ export declare function normalizeMaxSubagentSpawnsPerSession(value: unknown): number | undefined;
2836
+ export declare function resolveMaxSubagentSpawnsPerSession(configMaxSpawns?: number): number | undefined;
2837
+ export declare function normalizeMaxSubagentSpawnsPerRun(value: unknown): number | undefined;
2838
+ export declare function resolveMaxSubagentSpawnsPerRun(configMaxSpawns?: number): number;
2839
+ export declare function truncateOutput(output: string, config: Required<MaxOutputConfig>, artifactPath?: string): TruncationResult;
2840
+ export {};