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