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