@selesai/code 0.6.2 → 0.7.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 (997) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +1 -1
  3. package/dist/bun/cli.d.ts +0 -1
  4. package/dist/bun/cli.js +0 -1
  5. package/dist/bun/register-bedrock.d.ts +0 -1
  6. package/dist/bun/register-bedrock.js +0 -1
  7. package/dist/bun/restore-sandbox-env.d.ts +0 -1
  8. package/dist/bun/restore-sandbox-env.js +0 -1
  9. package/dist/cli/args.d.ts +0 -1
  10. package/dist/cli/args.js +0 -1
  11. package/dist/cli/config-selector.d.ts +0 -1
  12. package/dist/cli/config-selector.js +0 -1
  13. package/dist/cli/credential-print.d.ts +0 -1
  14. package/dist/cli/credential-print.js +0 -1
  15. package/dist/cli/file-processor.d.ts +0 -1
  16. package/dist/cli/file-processor.js +0 -1
  17. package/dist/cli/initial-message.d.ts +0 -1
  18. package/dist/cli/initial-message.js +0 -1
  19. package/dist/cli/list-models.d.ts +0 -1
  20. package/dist/cli/list-models.js +0 -1
  21. package/dist/cli/project-trust.d.ts +0 -1
  22. package/dist/cli/project-trust.js +0 -1
  23. package/dist/cli/session-picker.d.ts +0 -1
  24. package/dist/cli/session-picker.js +0 -1
  25. package/dist/cli/startup-ui.d.ts +0 -1
  26. package/dist/cli/startup-ui.js +0 -1
  27. package/dist/cli.d.ts +0 -1
  28. package/dist/cli.js +0 -1
  29. package/dist/config.d.ts +0 -1
  30. package/dist/config.js +0 -1
  31. package/dist/core/agent-session-auto-handoff.test.d.ts +0 -1
  32. package/dist/core/agent-session-auto-handoff.test.js +0 -1
  33. package/dist/core/agent-session-runtime.d.ts +0 -1
  34. package/dist/core/agent-session-runtime.js +0 -1
  35. package/dist/core/agent-session-services.d.ts +0 -1
  36. package/dist/core/agent-session-services.js +0 -1
  37. package/dist/core/agent-session-skill-block.test.d.ts +0 -1
  38. package/dist/core/agent-session-skill-block.test.js +0 -1
  39. package/dist/core/agent-session.d.ts +0 -1
  40. package/dist/core/agent-session.js +0 -1
  41. package/dist/core/agents.d.ts +0 -1
  42. package/dist/core/agents.js +0 -1
  43. package/dist/core/auth-guidance.d.ts +0 -1
  44. package/dist/core/auth-guidance.js +0 -1
  45. package/dist/core/auth-storage.d.ts +0 -1
  46. package/dist/core/auth-storage.js +0 -1
  47. package/dist/core/bash-executor.d.ts +0 -1
  48. package/dist/core/bash-executor.js +0 -1
  49. package/dist/core/built-in-extensions.d.ts +0 -1
  50. package/dist/core/built-in-extensions.js +0 -1
  51. package/dist/core/cache-stats.d.ts +0 -1
  52. package/dist/core/cache-stats.js +0 -1
  53. package/dist/core/compaction/branch-summarization.d.ts +0 -1
  54. package/dist/core/compaction/branch-summarization.js +0 -1
  55. package/dist/core/compaction/compaction.d.ts +0 -1
  56. package/dist/core/compaction/compaction.js +0 -1
  57. package/dist/core/compaction/index.d.ts +0 -1
  58. package/dist/core/compaction/index.js +0 -1
  59. package/dist/core/compaction/utils.d.ts +0 -1
  60. package/dist/core/compaction/utils.js +0 -1
  61. package/dist/core/defaults.d.ts +0 -1
  62. package/dist/core/defaults.js +0 -1
  63. package/dist/core/diagnostics.d.ts +0 -1
  64. package/dist/core/diagnostics.js +0 -1
  65. package/dist/core/event-bus.d.ts +0 -1
  66. package/dist/core/event-bus.js +0 -1
  67. package/dist/core/exec.d.ts +0 -1
  68. package/dist/core/exec.js +0 -1
  69. package/dist/core/experimental.d.ts +0 -1
  70. package/dist/core/experimental.js +0 -1
  71. package/dist/core/export-html/ansi-to-html.d.ts +0 -1
  72. package/dist/core/export-html/ansi-to-html.js +0 -1
  73. package/dist/core/export-html/index.d.ts +0 -1
  74. package/dist/core/export-html/index.js +0 -1
  75. package/dist/core/export-html/tool-renderer.d.ts +0 -1
  76. package/dist/core/export-html/tool-renderer.js +0 -1
  77. package/dist/core/extensions/index.d.ts +0 -1
  78. package/dist/core/extensions/index.js +0 -1
  79. package/dist/core/extensions/loader.d.ts +0 -1
  80. package/dist/core/extensions/loader.js +0 -1
  81. package/dist/core/extensions/runner.d.ts +0 -1
  82. package/dist/core/extensions/runner.js +0 -1
  83. package/dist/core/extensions/types.d.ts +0 -1
  84. package/dist/core/extensions/types.js +0 -1
  85. package/dist/core/extensions/wrapper.d.ts +0 -1
  86. package/dist/core/extensions/wrapper.js +0 -1
  87. package/dist/core/footer-data-provider.d.ts +0 -1
  88. package/dist/core/footer-data-provider.js +0 -1
  89. package/dist/core/git-command.d.ts +0 -1
  90. package/dist/core/git-command.js +0 -1
  91. package/dist/core/http-dispatcher.d.ts +0 -1
  92. package/dist/core/http-dispatcher.js +0 -1
  93. package/dist/core/index.d.ts +0 -1
  94. package/dist/core/index.js +0 -1
  95. package/dist/core/keybindings.d.ts +0 -1
  96. package/dist/core/keybindings.js +0 -1
  97. package/dist/core/llama/client.d.ts +0 -1
  98. package/dist/core/llama/client.js +0 -1
  99. package/dist/core/llama/huggingface.d.ts +0 -1
  100. package/dist/core/llama/huggingface.js +0 -1
  101. package/dist/core/llama/index.d.ts +0 -1
  102. package/dist/core/llama/index.js +0 -1
  103. package/dist/core/llama/provider.d.ts +0 -1
  104. package/dist/core/llama/provider.js +0 -1
  105. package/dist/core/llama/ui.d.ts +0 -1
  106. package/dist/core/llama/ui.js +0 -1
  107. package/dist/core/messages.d.ts +0 -1
  108. package/dist/core/messages.js +0 -1
  109. package/dist/core/model-config.d.ts +0 -1
  110. package/dist/core/model-config.js +0 -1
  111. package/dist/core/model-registry.d.ts +0 -1
  112. package/dist/core/model-registry.js +0 -1
  113. package/dist/core/model-resolver.d.ts +0 -1
  114. package/dist/core/model-resolver.js +0 -1
  115. package/dist/core/model-runtime.d.ts +0 -1
  116. package/dist/core/model-runtime.js +0 -1
  117. package/dist/core/models-store.d.ts +0 -1
  118. package/dist/core/models-store.js +0 -1
  119. package/dist/core/output-guard.d.ts +0 -1
  120. package/dist/core/output-guard.js +0 -1
  121. package/dist/core/package-manager.d.ts +0 -1
  122. package/dist/core/package-manager.js +0 -1
  123. package/dist/core/package-manager.test.d.ts +0 -1
  124. package/dist/core/package-manager.test.js +0 -1
  125. package/dist/core/project-trust.d.ts +0 -1
  126. package/dist/core/project-trust.js +0 -1
  127. package/dist/core/prompt-templates.d.ts +0 -1
  128. package/dist/core/prompt-templates.js +0 -1
  129. package/dist/core/provider-attribution.d.ts +0 -1
  130. package/dist/core/provider-attribution.js +0 -1
  131. package/dist/core/provider-composer.d.ts +0 -1
  132. package/dist/core/provider-composer.js +0 -1
  133. package/dist/core/radius.d.ts +0 -1
  134. package/dist/core/radius.js +0 -1
  135. package/dist/core/remote-catalog-provider.d.ts +0 -1
  136. package/dist/core/remote-catalog-provider.js +0 -1
  137. package/dist/core/resolve-config-value.d.ts +0 -1
  138. package/dist/core/resolve-config-value.js +0 -1
  139. package/dist/core/resource-loader.d.ts +0 -1
  140. package/dist/core/resource-loader.js +0 -1
  141. package/dist/core/runtime-credentials.d.ts +0 -1
  142. package/dist/core/runtime-credentials.js +0 -1
  143. package/dist/core/sdk.d.ts +0 -1
  144. package/dist/core/sdk.js +0 -1
  145. package/dist/core/session-cwd.d.ts +0 -1
  146. package/dist/core/session-cwd.js +0 -1
  147. package/dist/core/session-manager.d.ts +0 -1
  148. package/dist/core/session-manager.js +0 -1
  149. package/dist/core/settings-manager-auto-handoff.test.d.ts +0 -1
  150. package/dist/core/settings-manager-auto-handoff.test.js +0 -1
  151. package/dist/core/settings-manager.d.ts +0 -4
  152. package/dist/core/settings-manager.js +0 -12
  153. package/dist/core/skills.d.ts +0 -1
  154. package/dist/core/skills.js +0 -1
  155. package/dist/core/slash-commands.d.ts +0 -1
  156. package/dist/core/slash-commands.js +0 -1
  157. package/dist/core/source-info.d.ts +0 -1
  158. package/dist/core/source-info.js +0 -1
  159. package/dist/core/system-prompt.d.ts +0 -1
  160. package/dist/core/system-prompt.js +0 -1
  161. package/dist/core/system-prompt.test.d.ts +0 -1
  162. package/dist/core/system-prompt.test.js +0 -1
  163. package/dist/core/telemetry.d.ts +0 -1
  164. package/dist/core/telemetry.js +0 -1
  165. package/dist/core/timings.d.ts +0 -1
  166. package/dist/core/timings.js +0 -1
  167. package/dist/core/tools/bash.d.ts +0 -1
  168. package/dist/core/tools/bash.js +0 -1
  169. package/dist/core/tools/edit-diff.d.ts +0 -1
  170. package/dist/core/tools/edit-diff.js +0 -1
  171. package/dist/core/tools/edit.d.ts +0 -1
  172. package/dist/core/tools/edit.js +0 -1
  173. package/dist/core/tools/file-mutation-queue.d.ts +0 -1
  174. package/dist/core/tools/file-mutation-queue.js +0 -1
  175. package/dist/core/tools/find.d.ts +0 -1
  176. package/dist/core/tools/find.js +0 -1
  177. package/dist/core/tools/grep.d.ts +0 -1
  178. package/dist/core/tools/grep.js +0 -1
  179. package/dist/core/tools/index.d.ts +0 -1
  180. package/dist/core/tools/index.js +0 -1
  181. package/dist/core/tools/ls.d.ts +0 -1
  182. package/dist/core/tools/ls.js +0 -1
  183. package/dist/core/tools/output-accumulator.d.ts +0 -1
  184. package/dist/core/tools/output-accumulator.js +0 -1
  185. package/dist/core/tools/path-utils.d.ts +0 -1
  186. package/dist/core/tools/path-utils.js +0 -1
  187. package/dist/core/tools/read.d.ts +0 -1
  188. package/dist/core/tools/read.js +0 -1
  189. package/dist/core/tools/render-utils.d.ts +0 -1
  190. package/dist/core/tools/render-utils.js +0 -1
  191. package/dist/core/tools/tool-definition-wrapper.d.ts +0 -1
  192. package/dist/core/tools/tool-definition-wrapper.js +0 -1
  193. package/dist/core/tools/truncate.d.ts +0 -1
  194. package/dist/core/tools/truncate.js +0 -1
  195. package/dist/core/tools/write.d.ts +0 -1
  196. package/dist/core/tools/write.js +0 -1
  197. package/dist/core/trust-manager.d.ts +0 -1
  198. package/dist/core/trust-manager.js +0 -1
  199. package/dist/core/usage-totals.d.ts +0 -1
  200. package/dist/core/usage-totals.js +0 -1
  201. package/dist/defaults/models.json +8 -0
  202. package/dist/defaults/settings.json +6 -7
  203. package/dist/extensions/inline-skills.test.ts +13 -13
  204. package/dist/extensions/inline-skills.ts +6 -6
  205. package/dist/extensions/pi-subagents/CHANGELOG.md +89 -12
  206. package/dist/extensions/pi-subagents/README.md +339 -604
  207. package/dist/extensions/pi-subagents/package-lock.json +190 -2079
  208. package/dist/extensions/pi-subagents/package.json +13 -5
  209. package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +1 -1
  210. package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +1 -1
  211. package/dist/extensions/pi-subagents/prompts/review-loop.md +1 -1
  212. package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +10 -10
  213. package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +32 -43
  214. package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +106 -105
  215. package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +3 -3
  216. package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +28 -35
  217. package/dist/extensions/pi-subagents/src/agents/agent-management.ts +167 -124
  218. package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +19 -0
  219. package/dist/extensions/pi-subagents/src/agents/agents.ts +163 -75
  220. package/dist/extensions/pi-subagents/src/agents/chain-serializer.ts +10 -7
  221. package/dist/extensions/pi-subagents/src/agents/frontmatter.ts +5 -3
  222. package/dist/extensions/pi-subagents/src/agents/identity.ts +1 -1
  223. package/dist/extensions/pi-subagents/src/agents/proactive-skills.ts +14 -11
  224. package/dist/extensions/pi-subagents/src/agents/skills.ts +23 -6
  225. package/dist/extensions/pi-subagents/src/agents/task-aware-routing.ts +8 -1
  226. package/dist/extensions/pi-subagents/src/api/control-channel.ts +4 -0
  227. package/dist/extensions/pi-subagents/src/api/delegation.ts +26 -194
  228. package/dist/extensions/pi-subagents/src/api/external-runs.ts +129 -0
  229. package/dist/extensions/pi-subagents/src/api/intercom-bridge.ts +3 -0
  230. package/dist/extensions/pi-subagents/src/api/pi-args.ts +5 -0
  231. package/dist/extensions/pi-subagents/src/api/preflight.ts +4 -4
  232. package/dist/extensions/pi-subagents/src/api/shared-types.ts +19 -0
  233. package/dist/extensions/pi-subagents/src/extension/config.ts +10 -0
  234. package/dist/extensions/pi-subagents/src/extension/control-notices.ts +5 -39
  235. package/dist/extensions/pi-subagents/src/extension/doctor.ts +10 -9
  236. package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +7 -4
  237. package/dist/extensions/pi-subagents/src/extension/index.ts +243 -77
  238. package/dist/extensions/pi-subagents/src/extension/rpc.ts +18 -6
  239. package/dist/extensions/pi-subagents/src/extension/schemas.ts +50 -39
  240. package/dist/extensions/pi-subagents/src/extension/tool-description.ts +36 -103
  241. package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +229 -0
  242. package/dist/extensions/pi-subagents/src/inspectors/herdr/client.ts +130 -0
  243. package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +141 -0
  244. package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +154 -0
  245. package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +330 -0
  246. package/dist/extensions/pi-subagents/src/intercom/intercom-bridge.ts +3 -2
  247. package/dist/extensions/pi-subagents/src/intercom/result-intercom.ts +5 -1
  248. package/dist/extensions/pi-subagents/src/missions/actions.ts +372 -0
  249. package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +314 -0
  250. package/dist/extensions/pi-subagents/src/missions/store.ts +442 -0
  251. package/dist/extensions/pi-subagents/src/missions/types.ts +135 -0
  252. package/dist/extensions/pi-subagents/src/policy/authority.ts +46 -0
  253. package/dist/extensions/pi-subagents/src/profiles/profiles.ts +32 -6
  254. package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +103 -72
  255. package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +10 -2
  256. package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +6 -6
  257. package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +29 -1
  258. package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +3 -3
  259. package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +3 -2
  260. package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +9 -7
  261. package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +3 -4
  262. package/dist/extensions/pi-subagents/src/runs/background/notify.ts +3 -28
  263. package/dist/extensions/pi-subagents/src/runs/background/process-terminal.ts +5 -5
  264. package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +18 -68
  265. package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +3 -3
  266. package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +35 -8
  267. package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +602 -375
  268. package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +3 -3
  269. package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +612 -464
  270. package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +50 -9
  271. package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +253 -0
  272. package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +12 -4
  273. package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +3 -3
  274. package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +8 -4
  275. package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +74 -102
  276. package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +21 -22
  277. package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +1050 -396
  278. package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +44 -18
  279. package/dist/extensions/pi-subagents/src/runs/shared/capability-ceiling.ts +0 -1
  280. package/dist/extensions/pi-subagents/src/runs/shared/child-protocol.ts +302 -22
  281. package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
  282. package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +130 -0
  283. package/dist/extensions/pi-subagents/src/runs/shared/long-running-guard.ts +42 -1
  284. package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +1 -1
  285. package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +59 -5
  286. package/dist/extensions/pi-subagents/src/runs/shared/nested-render.ts +9 -4
  287. package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +86 -2
  288. package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +11 -2
  289. package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +95 -0
  290. package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +11 -1
  291. package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +15 -6
  292. package/dist/extensions/pi-subagents/src/runs/shared/run-history.ts +1 -1
  293. package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +9 -63
  294. package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +37 -6
  295. package/dist/extensions/pi-subagents/src/runs/shared/subagent-startup-retry.ts +5 -2
  296. package/dist/extensions/pi-subagents/src/runs/shared/task-intent.ts +2 -23
  297. package/dist/extensions/pi-subagents/src/runs/shared/turn-budget.ts +6 -6
  298. package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +124 -13
  299. package/dist/extensions/pi-subagents/src/shared/accessible-dir.ts +29 -7
  300. package/dist/extensions/pi-subagents/src/shared/artifacts.ts +18 -1
  301. package/dist/extensions/pi-subagents/src/shared/fork-context.ts +3 -2
  302. package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +1 -0
  303. package/dist/extensions/pi-subagents/src/shared/settings.ts +10 -0
  304. package/dist/extensions/pi-subagents/src/shared/types.ts +158 -55
  305. package/dist/extensions/pi-subagents/src/shared/utils.ts +16 -66
  306. package/dist/extensions/pi-subagents/src/slash/delegation-adapters.ts +33 -199
  307. package/dist/extensions/pi-subagents/src/slash/delegation-request.ts +43 -126
  308. package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +103 -0
  309. package/dist/extensions/pi-subagents/src/slash/prompt-template-bridge.ts +158 -205
  310. package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +22 -58
  311. package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +14 -0
  312. package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +44 -642
  313. package/dist/extensions/pi-subagents/src/slash/subagents-admin.ts +18 -14
  314. package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +156 -21
  315. package/dist/extensions/pi-subagents/src/tui/fleet-transcript.ts +110 -5
  316. package/dist/extensions/pi-subagents/src/tui/fleet.ts +60 -24
  317. package/dist/extensions/pi-subagents/src/tui/render.ts +296 -140
  318. package/dist/extensions/pi-subagents/src/types/pi-runtime-compat.d.ts +14 -0
  319. package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +1 -1
  320. package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +13 -7
  321. package/dist/extensions/pi-subagents/src/watchdog/model-selection.ts +2 -2
  322. package/dist/extensions/pi-subagents/src/watchdog/permission-arbiter.ts +145 -0
  323. package/dist/extensions/pi-subagents/src/watchdog/register-child.ts +1 -1
  324. package/dist/extensions/pi-subagents/src/watchdog/register-main.ts +1 -1
  325. package/dist/extensions/pi-subagents/src/watchdog/review.ts +4 -1
  326. package/dist/extensions/pi-subagents/src/watchdog/runtime.ts +3 -2
  327. package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +140 -0
  328. package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +415 -0
  329. package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +41 -144
  330. package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +16 -16
  331. package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +415 -298
  332. package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +149 -82
  333. package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +40 -40
  334. package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +15 -15
  335. package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +193 -133
  336. package/dist/extensions/pi-subagents/test/integration/detect-error.test.ts +1 -49
  337. package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +62 -0
  338. package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +56 -58
  339. package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +81 -68
  340. package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +20 -25
  341. package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +425 -317
  342. package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +73 -73
  343. package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +123 -98
  344. package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +653 -240
  345. package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +20 -1661
  346. package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +9 -9
  347. package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +3 -3
  348. package/dist/extensions/pi-subagents/test/integration/top-level-async.test.ts +2 -2
  349. package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +8 -5
  350. package/dist/extensions/pi-subagents/test/support/mock-pi.ts +6 -6
  351. package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +4 -20
  352. package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +25 -4
  353. package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +1 -1
  354. package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +280 -295
  355. package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +47 -207
  356. package/dist/extensions/pi-subagents/test/unit/agent-memory.test.ts +26 -26
  357. package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +89 -89
  358. package/dist/extensions/pi-subagents/test/unit/agent-selection.test.ts +9 -9
  359. package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +10 -0
  360. package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +33 -9
  361. package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +24 -2
  362. package/dist/extensions/pi-subagents/test/unit/async-permission-session.test.ts +11 -9
  363. package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +2 -2
  364. package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +40 -40
  365. package/dist/extensions/pi-subagents/test/unit/authority-policy.test.ts +22 -0
  366. package/dist/extensions/pi-subagents/test/unit/background-work.test.ts +1 -1
  367. package/dist/extensions/pi-subagents/test/unit/capability-ceiling-agent-allowlist.test.ts +5 -39
  368. package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +19 -19
  369. package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +9 -9
  370. package/dist/extensions/pi-subagents/test/unit/chain-serializer.test.ts +20 -20
  371. package/dist/extensions/pi-subagents/test/unit/child-protocol.test.ts +99 -0
  372. package/dist/extensions/pi-subagents/test/unit/child-transcript.test.ts +9 -9
  373. package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +41 -0
  374. package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +2 -2
  375. package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +35 -5
  376. package/dist/extensions/pi-subagents/test/unit/config-dir-runtime.test.ts +7 -0
  377. package/dist/extensions/pi-subagents/test/unit/control-notices.test.ts +16 -82
  378. package/dist/extensions/pi-subagents/test/unit/delegation-api.test.ts +162 -620
  379. package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +1 -1
  380. package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +25 -25
  381. package/dist/extensions/pi-subagents/test/unit/ensure-accessible-dir.test.ts +125 -0
  382. package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +94 -0
  383. package/dist/extensions/pi-subagents/test/unit/external-runs.test.ts +66 -0
  384. package/dist/extensions/pi-subagents/test/unit/extra-agent-dirs.test.ts +3 -3
  385. package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +242 -52
  386. package/dist/extensions/pi-subagents/test/unit/fleet-transcript.test.ts +127 -0
  387. package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +197 -36
  388. package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +4 -4
  389. package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +245 -0
  390. package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +494 -0
  391. package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +261 -31
  392. package/dist/extensions/pi-subagents/test/unit/inline-subagents.test.ts +52 -0
  393. package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +6 -6
  394. package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +217 -0
  395. package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +182 -0
  396. package/dist/extensions/pi-subagents/test/unit/mock-pi.test.ts +22 -0
  397. package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +1 -1
  398. package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +10 -10
  399. package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +20 -12
  400. package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +47 -5
  401. package/dist/extensions/pi-subagents/test/unit/notify.test.ts +49 -55
  402. package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +20 -3
  403. package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +37 -7
  404. package/dist/extensions/pi-subagents/test/unit/parallel-utils.test.ts +10 -10
  405. package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +3 -3
  406. package/dist/extensions/pi-subagents/test/unit/permissions.test.ts +46 -0
  407. package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +31 -10
  408. package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +40 -16
  409. package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +42 -44
  410. package/dist/extensions/pi-subagents/test/unit/proactive-skills.test.ts +13 -13
  411. package/dist/extensions/pi-subagents/test/unit/process-terminal.test.ts +4 -4
  412. package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +75 -9
  413. package/dist/extensions/pi-subagents/test/unit/prompt-template-bridge.test.ts +20 -84
  414. package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +15 -16
  415. package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +28 -28
  416. package/dist/extensions/pi-subagents/test/unit/result-intercom.test.ts +19 -12
  417. package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +37 -21
  418. package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +1 -1
  419. package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +50 -50
  420. package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +396 -433
  421. package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +76 -153
  422. package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +411 -0
  423. package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +1 -91
  424. package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +139 -0
  425. package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +29 -0
  426. package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +13 -13
  427. package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +2 -2
  428. package/dist/extensions/pi-subagents/test/unit/steering.test.ts +2 -2
  429. package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +35 -35
  430. package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +53 -18
  431. package/dist/extensions/pi-subagents/test/unit/subagent-startup-retry.test.ts +13 -1
  432. package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +44 -11
  433. package/dist/extensions/pi-subagents/test/unit/task-intent.test.ts +2 -26
  434. package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +24 -148
  435. package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +11 -9
  436. package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +351 -0
  437. package/dist/extensions/pi-subagents/test/unit/watchdog-child-status.test.ts +13 -13
  438. package/dist/extensions/pi-subagents/test/unit/watchdog-lsp-diagnostics.test.ts +1 -1
  439. package/dist/extensions/pi-subagents/test/unit/watchdog-permission-arbiter.test.ts +79 -0
  440. package/dist/extensions/pi-subagents/test/unit/watchdog-runtime.test.ts +1 -1
  441. package/dist/extensions/pi-subagents/test/unit/watchdog-settings.test.ts +8 -8
  442. package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +45 -9
  443. package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +197 -0
  444. package/dist/extensions/pi-subagents/test/unit/workflow-graph.test.ts +8 -8
  445. package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +142 -12
  446. package/dist/extensions/pi-subagents/tsconfig.json +15 -0
  447. package/dist/extensions/pi-web-agent/package.json +1 -1
  448. package/dist/extensions/rtk.test.ts +126 -0
  449. package/dist/extensions/rtk.ts +56 -20
  450. package/dist/index.d.ts +1 -1
  451. package/dist/index.js +1 -1
  452. package/dist/main.d.ts +0 -1
  453. package/dist/main.js +0 -1
  454. package/dist/migrations.d.ts +0 -1
  455. package/dist/migrations.js +0 -1
  456. package/dist/modes/index.d.ts +0 -1
  457. package/dist/modes/index.js +0 -1
  458. package/dist/modes/interactive/components/armin.d.ts +0 -1
  459. package/dist/modes/interactive/components/armin.js +0 -1
  460. package/dist/modes/interactive/components/assistant-message.d.ts +0 -1
  461. package/dist/modes/interactive/components/assistant-message.js +0 -1
  462. package/dist/modes/interactive/components/bash-execution.d.ts +0 -1
  463. package/dist/modes/interactive/components/bash-execution.js +0 -1
  464. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -1
  465. package/dist/modes/interactive/components/bordered-loader.js +0 -1
  466. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -1
  467. package/dist/modes/interactive/components/branch-summary-message.js +0 -1
  468. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -1
  469. package/dist/modes/interactive/components/compaction-summary-message.js +0 -1
  470. package/dist/modes/interactive/components/config-selector.d.ts +0 -1
  471. package/dist/modes/interactive/components/config-selector.js +0 -1
  472. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -1
  473. package/dist/modes/interactive/components/countdown-timer.js +0 -1
  474. package/dist/modes/interactive/components/custom-editor.d.ts +0 -1
  475. package/dist/modes/interactive/components/custom-editor.js +0 -1
  476. package/dist/modes/interactive/components/custom-entry.d.ts +0 -1
  477. package/dist/modes/interactive/components/custom-entry.js +0 -1
  478. package/dist/modes/interactive/components/custom-message.d.ts +0 -1
  479. package/dist/modes/interactive/components/custom-message.js +0 -1
  480. package/dist/modes/interactive/components/daxnuts.d.ts +0 -1
  481. package/dist/modes/interactive/components/daxnuts.js +0 -1
  482. package/dist/modes/interactive/components/diff.d.ts +0 -1
  483. package/dist/modes/interactive/components/diff.js +0 -1
  484. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -1
  485. package/dist/modes/interactive/components/dynamic-border.js +0 -1
  486. package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -1
  487. package/dist/modes/interactive/components/earendil-announcement.js +0 -1
  488. package/dist/modes/interactive/components/extension-editor.d.ts +0 -1
  489. package/dist/modes/interactive/components/extension-editor.js +0 -1
  490. package/dist/modes/interactive/components/extension-input.d.ts +0 -1
  491. package/dist/modes/interactive/components/extension-input.js +0 -1
  492. package/dist/modes/interactive/components/extension-selector.d.ts +0 -1
  493. package/dist/modes/interactive/components/extension-selector.js +0 -1
  494. package/dist/modes/interactive/components/first-time-setup.d.ts +0 -1
  495. package/dist/modes/interactive/components/first-time-setup.js +0 -1
  496. package/dist/modes/interactive/components/footer.d.ts +0 -1
  497. package/dist/modes/interactive/components/footer.js +0 -1
  498. package/dist/modes/interactive/components/index.d.ts +0 -1
  499. package/dist/modes/interactive/components/index.js +0 -1
  500. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -1
  501. package/dist/modes/interactive/components/keybinding-hints.js +0 -1
  502. package/dist/modes/interactive/components/login-dialog.d.ts +0 -1
  503. package/dist/modes/interactive/components/login-dialog.js +0 -1
  504. package/dist/modes/interactive/components/model-selector.d.ts +0 -1
  505. package/dist/modes/interactive/components/model-selector.js +0 -1
  506. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -1
  507. package/dist/modes/interactive/components/oauth-selector.js +0 -1
  508. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -1
  509. package/dist/modes/interactive/components/scoped-models-selector.js +0 -1
  510. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -1
  511. package/dist/modes/interactive/components/session-selector-search.js +0 -1
  512. package/dist/modes/interactive/components/session-selector.d.ts +0 -1
  513. package/dist/modes/interactive/components/session-selector.js +0 -1
  514. package/dist/modes/interactive/components/settings-selector.d.ts +0 -3
  515. package/dist/modes/interactive/components/settings-selector.js +1 -14
  516. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -1
  517. package/dist/modes/interactive/components/show-images-selector.js +0 -1
  518. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -1
  519. package/dist/modes/interactive/components/skill-invocation-message.js +0 -1
  520. package/dist/modes/interactive/components/status-indicator.d.ts +0 -1
  521. package/dist/modes/interactive/components/status-indicator.js +0 -1
  522. package/dist/modes/interactive/components/theme-selector.d.ts +0 -1
  523. package/dist/modes/interactive/components/theme-selector.js +0 -1
  524. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -1
  525. package/dist/modes/interactive/components/thinking-selector.js +0 -1
  526. package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
  527. package/dist/modes/interactive/components/tool-execution.js +0 -1
  528. package/dist/modes/interactive/components/tree-selector.d.ts +0 -1
  529. package/dist/modes/interactive/components/tree-selector.js +0 -1
  530. package/dist/modes/interactive/components/trust-selector.d.ts +0 -1
  531. package/dist/modes/interactive/components/trust-selector.js +0 -1
  532. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -1
  533. package/dist/modes/interactive/components/user-message-selector.js +0 -1
  534. package/dist/modes/interactive/components/user-message.d.ts +0 -1
  535. package/dist/modes/interactive/components/user-message.js +0 -1
  536. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -1
  537. package/dist/modes/interactive/components/visual-truncate.js +0 -1
  538. package/dist/modes/interactive/external-editor.d.ts +0 -1
  539. package/dist/modes/interactive/external-editor.js +0 -1
  540. package/dist/modes/interactive/interactive-mode.d.ts +0 -2
  541. package/dist/modes/interactive/interactive-mode.js +1 -22
  542. package/dist/modes/interactive/model-search.d.ts +0 -1
  543. package/dist/modes/interactive/model-search.js +0 -1
  544. package/dist/modes/interactive/theme/theme-controller.d.ts +0 -1
  545. package/dist/modes/interactive/theme/theme-controller.js +0 -1
  546. package/dist/modes/interactive/theme/theme.d.ts +0 -1
  547. package/dist/modes/interactive/theme/theme.js +0 -1
  548. package/dist/modes/print-mode.d.ts +0 -1
  549. package/dist/modes/print-mode.js +0 -1
  550. package/dist/modes/rpc/jsonl.d.ts +0 -1
  551. package/dist/modes/rpc/jsonl.js +0 -1
  552. package/dist/modes/rpc/rpc-client.d.ts +1 -2
  553. package/dist/modes/rpc/rpc-client.js +1 -2
  554. package/dist/modes/rpc/rpc-mode.d.ts +0 -1
  555. package/dist/modes/rpc/rpc-mode.js +0 -9
  556. package/dist/modes/rpc/rpc-types.d.ts +0 -1
  557. package/dist/modes/rpc/rpc-types.js +0 -1
  558. package/dist/package-manager-cli.d.ts +0 -1
  559. package/dist/package-manager-cli.js +0 -1
  560. package/dist/rpc-entry.d.ts +0 -1
  561. package/dist/rpc-entry.js +0 -1
  562. package/dist/utils/ansi.d.ts +0 -1
  563. package/dist/utils/ansi.js +0 -1
  564. package/dist/utils/changelog.d.ts +0 -1
  565. package/dist/utils/changelog.js +0 -1
  566. package/dist/utils/child-process.d.ts +0 -1
  567. package/dist/utils/child-process.js +0 -1
  568. package/dist/utils/clipboard-image.d.ts +0 -1
  569. package/dist/utils/clipboard-image.js +0 -1
  570. package/dist/utils/clipboard-native.d.ts +0 -1
  571. package/dist/utils/clipboard-native.js +0 -1
  572. package/dist/utils/clipboard.d.ts +0 -1
  573. package/dist/utils/clipboard.js +0 -1
  574. package/dist/utils/deprecation.d.ts +0 -1
  575. package/dist/utils/deprecation.js +0 -1
  576. package/dist/utils/exif-orientation.d.ts +0 -1
  577. package/dist/utils/exif-orientation.js +0 -1
  578. package/dist/utils/frontmatter.d.ts +0 -1
  579. package/dist/utils/frontmatter.js +0 -1
  580. package/dist/utils/fs-watch.d.ts +0 -1
  581. package/dist/utils/fs-watch.js +0 -1
  582. package/dist/utils/git.d.ts +0 -1
  583. package/dist/utils/git.js +0 -1
  584. package/dist/utils/html.d.ts +0 -1
  585. package/dist/utils/html.js +0 -1
  586. package/dist/utils/image-convert.d.ts +0 -1
  587. package/dist/utils/image-convert.js +0 -1
  588. package/dist/utils/image-process.d.ts +0 -1
  589. package/dist/utils/image-process.js +0 -1
  590. package/dist/utils/image-resize-core.d.ts +0 -1
  591. package/dist/utils/image-resize-core.js +0 -1
  592. package/dist/utils/image-resize-worker.d.ts +0 -1
  593. package/dist/utils/image-resize-worker.js +0 -1
  594. package/dist/utils/image-resize.d.ts +0 -1
  595. package/dist/utils/image-resize.js +0 -1
  596. package/dist/utils/json.d.ts +0 -1
  597. package/dist/utils/json.js +0 -1
  598. package/dist/utils/mime.d.ts +0 -1
  599. package/dist/utils/mime.js +0 -1
  600. package/dist/utils/open-browser.d.ts +0 -1
  601. package/dist/utils/open-browser.js +0 -1
  602. package/dist/utils/paths.d.ts +0 -1
  603. package/dist/utils/paths.js +0 -1
  604. package/dist/utils/photon.d.ts +0 -1
  605. package/dist/utils/photon.js +0 -1
  606. package/dist/utils/pi-user-agent.d.ts +0 -1
  607. package/dist/utils/pi-user-agent.js +0 -1
  608. package/dist/utils/shell.d.ts +0 -1
  609. package/dist/utils/shell.js +0 -1
  610. package/dist/utils/sleep.d.ts +0 -1
  611. package/dist/utils/sleep.js +0 -1
  612. package/dist/utils/syntax-highlight.d.ts +0 -1
  613. package/dist/utils/syntax-highlight.js +0 -1
  614. package/dist/utils/thinking-tags.d.ts +0 -1
  615. package/dist/utils/thinking-tags.js +0 -1
  616. package/dist/utils/tools-manager.d.ts +3 -3
  617. package/dist/utils/tools-manager.js +125 -42
  618. package/dist/utils/version-check.d.ts +0 -1
  619. package/dist/utils/version-check.js +0 -1
  620. package/dist/utils/windows-self-update.d.ts +0 -1
  621. package/dist/utils/windows-self-update.js +0 -1
  622. package/docs/rpc.md +1 -2
  623. package/docs/settings.md +0 -1
  624. package/docs/skills.md +10 -18
  625. package/package.json +4 -3
  626. package/dist/bun/cli.d.ts.map +0 -1
  627. package/dist/bun/cli.js.map +0 -1
  628. package/dist/bun/register-bedrock.d.ts.map +0 -1
  629. package/dist/bun/register-bedrock.js.map +0 -1
  630. package/dist/bun/restore-sandbox-env.d.ts.map +0 -1
  631. package/dist/bun/restore-sandbox-env.js.map +0 -1
  632. package/dist/cli/args.d.ts.map +0 -1
  633. package/dist/cli/args.js.map +0 -1
  634. package/dist/cli/config-selector.d.ts.map +0 -1
  635. package/dist/cli/config-selector.js.map +0 -1
  636. package/dist/cli/credential-print.d.ts.map +0 -1
  637. package/dist/cli/credential-print.js.map +0 -1
  638. package/dist/cli/file-processor.d.ts.map +0 -1
  639. package/dist/cli/file-processor.js.map +0 -1
  640. package/dist/cli/initial-message.d.ts.map +0 -1
  641. package/dist/cli/initial-message.js.map +0 -1
  642. package/dist/cli/list-models.d.ts.map +0 -1
  643. package/dist/cli/list-models.js.map +0 -1
  644. package/dist/cli/project-trust.d.ts.map +0 -1
  645. package/dist/cli/project-trust.js.map +0 -1
  646. package/dist/cli/session-picker.d.ts.map +0 -1
  647. package/dist/cli/session-picker.js.map +0 -1
  648. package/dist/cli/startup-ui.d.ts.map +0 -1
  649. package/dist/cli/startup-ui.js.map +0 -1
  650. package/dist/cli.d.ts.map +0 -1
  651. package/dist/cli.js.map +0 -1
  652. package/dist/config.d.ts.map +0 -1
  653. package/dist/config.js.map +0 -1
  654. package/dist/core/agent-session-auto-handoff.test.d.ts.map +0 -1
  655. package/dist/core/agent-session-auto-handoff.test.js.map +0 -1
  656. package/dist/core/agent-session-runtime.d.ts.map +0 -1
  657. package/dist/core/agent-session-runtime.js.map +0 -1
  658. package/dist/core/agent-session-services.d.ts.map +0 -1
  659. package/dist/core/agent-session-services.js.map +0 -1
  660. package/dist/core/agent-session-skill-block.test.d.ts.map +0 -1
  661. package/dist/core/agent-session-skill-block.test.js.map +0 -1
  662. package/dist/core/agent-session.d.ts.map +0 -1
  663. package/dist/core/agent-session.js.map +0 -1
  664. package/dist/core/agents.d.ts.map +0 -1
  665. package/dist/core/agents.js.map +0 -1
  666. package/dist/core/auth-guidance.d.ts.map +0 -1
  667. package/dist/core/auth-guidance.js.map +0 -1
  668. package/dist/core/auth-storage.d.ts.map +0 -1
  669. package/dist/core/auth-storage.js.map +0 -1
  670. package/dist/core/bash-executor.d.ts.map +0 -1
  671. package/dist/core/bash-executor.js.map +0 -1
  672. package/dist/core/built-in-extensions.d.ts.map +0 -1
  673. package/dist/core/built-in-extensions.js.map +0 -1
  674. package/dist/core/cache-stats.d.ts.map +0 -1
  675. package/dist/core/cache-stats.js.map +0 -1
  676. package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  677. package/dist/core/compaction/branch-summarization.js.map +0 -1
  678. package/dist/core/compaction/compaction.d.ts.map +0 -1
  679. package/dist/core/compaction/compaction.js.map +0 -1
  680. package/dist/core/compaction/index.d.ts.map +0 -1
  681. package/dist/core/compaction/index.js.map +0 -1
  682. package/dist/core/compaction/utils.d.ts.map +0 -1
  683. package/dist/core/compaction/utils.js.map +0 -1
  684. package/dist/core/defaults.d.ts.map +0 -1
  685. package/dist/core/defaults.js.map +0 -1
  686. package/dist/core/diagnostics.d.ts.map +0 -1
  687. package/dist/core/diagnostics.js.map +0 -1
  688. package/dist/core/event-bus.d.ts.map +0 -1
  689. package/dist/core/event-bus.js.map +0 -1
  690. package/dist/core/exec.d.ts.map +0 -1
  691. package/dist/core/exec.js.map +0 -1
  692. package/dist/core/experimental.d.ts.map +0 -1
  693. package/dist/core/experimental.js.map +0 -1
  694. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  695. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  696. package/dist/core/export-html/index.d.ts.map +0 -1
  697. package/dist/core/export-html/index.js.map +0 -1
  698. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  699. package/dist/core/export-html/tool-renderer.js.map +0 -1
  700. package/dist/core/extensions/index.d.ts.map +0 -1
  701. package/dist/core/extensions/index.js.map +0 -1
  702. package/dist/core/extensions/loader.d.ts.map +0 -1
  703. package/dist/core/extensions/loader.js.map +0 -1
  704. package/dist/core/extensions/runner.d.ts.map +0 -1
  705. package/dist/core/extensions/runner.js.map +0 -1
  706. package/dist/core/extensions/types.d.ts.map +0 -1
  707. package/dist/core/extensions/types.js.map +0 -1
  708. package/dist/core/extensions/wrapper.d.ts.map +0 -1
  709. package/dist/core/extensions/wrapper.js.map +0 -1
  710. package/dist/core/footer-data-provider.d.ts.map +0 -1
  711. package/dist/core/footer-data-provider.js.map +0 -1
  712. package/dist/core/git-command.d.ts.map +0 -1
  713. package/dist/core/git-command.js.map +0 -1
  714. package/dist/core/http-dispatcher.d.ts.map +0 -1
  715. package/dist/core/http-dispatcher.js.map +0 -1
  716. package/dist/core/index.d.ts.map +0 -1
  717. package/dist/core/index.js.map +0 -1
  718. package/dist/core/keybindings.d.ts.map +0 -1
  719. package/dist/core/keybindings.js.map +0 -1
  720. package/dist/core/llama/client.d.ts.map +0 -1
  721. package/dist/core/llama/client.js.map +0 -1
  722. package/dist/core/llama/huggingface.d.ts.map +0 -1
  723. package/dist/core/llama/huggingface.js.map +0 -1
  724. package/dist/core/llama/index.d.ts.map +0 -1
  725. package/dist/core/llama/index.js.map +0 -1
  726. package/dist/core/llama/provider.d.ts.map +0 -1
  727. package/dist/core/llama/provider.js.map +0 -1
  728. package/dist/core/llama/ui.d.ts.map +0 -1
  729. package/dist/core/llama/ui.js.map +0 -1
  730. package/dist/core/messages.d.ts.map +0 -1
  731. package/dist/core/messages.js.map +0 -1
  732. package/dist/core/model-config.d.ts.map +0 -1
  733. package/dist/core/model-config.js.map +0 -1
  734. package/dist/core/model-registry.d.ts.map +0 -1
  735. package/dist/core/model-registry.js.map +0 -1
  736. package/dist/core/model-resolver.d.ts.map +0 -1
  737. package/dist/core/model-resolver.js.map +0 -1
  738. package/dist/core/model-runtime.d.ts.map +0 -1
  739. package/dist/core/model-runtime.js.map +0 -1
  740. package/dist/core/models-store.d.ts.map +0 -1
  741. package/dist/core/models-store.js.map +0 -1
  742. package/dist/core/output-guard.d.ts.map +0 -1
  743. package/dist/core/output-guard.js.map +0 -1
  744. package/dist/core/package-manager.d.ts.map +0 -1
  745. package/dist/core/package-manager.js.map +0 -1
  746. package/dist/core/package-manager.test.d.ts.map +0 -1
  747. package/dist/core/package-manager.test.js.map +0 -1
  748. package/dist/core/project-trust.d.ts.map +0 -1
  749. package/dist/core/project-trust.js.map +0 -1
  750. package/dist/core/prompt-templates.d.ts.map +0 -1
  751. package/dist/core/prompt-templates.js.map +0 -1
  752. package/dist/core/provider-attribution.d.ts.map +0 -1
  753. package/dist/core/provider-attribution.js.map +0 -1
  754. package/dist/core/provider-composer.d.ts.map +0 -1
  755. package/dist/core/provider-composer.js.map +0 -1
  756. package/dist/core/radius.d.ts.map +0 -1
  757. package/dist/core/radius.js.map +0 -1
  758. package/dist/core/remote-catalog-provider.d.ts.map +0 -1
  759. package/dist/core/remote-catalog-provider.js.map +0 -1
  760. package/dist/core/resolve-config-value.d.ts.map +0 -1
  761. package/dist/core/resolve-config-value.js.map +0 -1
  762. package/dist/core/resource-loader.d.ts.map +0 -1
  763. package/dist/core/resource-loader.js.map +0 -1
  764. package/dist/core/runtime-credentials.d.ts.map +0 -1
  765. package/dist/core/runtime-credentials.js.map +0 -1
  766. package/dist/core/sdk.d.ts.map +0 -1
  767. package/dist/core/sdk.js.map +0 -1
  768. package/dist/core/session-cwd.d.ts.map +0 -1
  769. package/dist/core/session-cwd.js.map +0 -1
  770. package/dist/core/session-manager.d.ts.map +0 -1
  771. package/dist/core/session-manager.js.map +0 -1
  772. package/dist/core/settings-manager-auto-handoff.test.d.ts.map +0 -1
  773. package/dist/core/settings-manager-auto-handoff.test.js.map +0 -1
  774. package/dist/core/settings-manager.d.ts.map +0 -1
  775. package/dist/core/settings-manager.js.map +0 -1
  776. package/dist/core/skills.d.ts.map +0 -1
  777. package/dist/core/skills.js.map +0 -1
  778. package/dist/core/slash-commands.d.ts.map +0 -1
  779. package/dist/core/slash-commands.js.map +0 -1
  780. package/dist/core/source-info.d.ts.map +0 -1
  781. package/dist/core/source-info.js.map +0 -1
  782. package/dist/core/system-prompt.d.ts.map +0 -1
  783. package/dist/core/system-prompt.js.map +0 -1
  784. package/dist/core/system-prompt.test.d.ts.map +0 -1
  785. package/dist/core/system-prompt.test.js.map +0 -1
  786. package/dist/core/telemetry.d.ts.map +0 -1
  787. package/dist/core/telemetry.js.map +0 -1
  788. package/dist/core/timings.d.ts.map +0 -1
  789. package/dist/core/timings.js.map +0 -1
  790. package/dist/core/tools/bash.d.ts.map +0 -1
  791. package/dist/core/tools/bash.js.map +0 -1
  792. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  793. package/dist/core/tools/edit-diff.js.map +0 -1
  794. package/dist/core/tools/edit.d.ts.map +0 -1
  795. package/dist/core/tools/edit.js.map +0 -1
  796. package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  797. package/dist/core/tools/file-mutation-queue.js.map +0 -1
  798. package/dist/core/tools/find.d.ts.map +0 -1
  799. package/dist/core/tools/find.js.map +0 -1
  800. package/dist/core/tools/grep.d.ts.map +0 -1
  801. package/dist/core/tools/grep.js.map +0 -1
  802. package/dist/core/tools/index.d.ts.map +0 -1
  803. package/dist/core/tools/index.js.map +0 -1
  804. package/dist/core/tools/ls.d.ts.map +0 -1
  805. package/dist/core/tools/ls.js.map +0 -1
  806. package/dist/core/tools/output-accumulator.d.ts.map +0 -1
  807. package/dist/core/tools/output-accumulator.js.map +0 -1
  808. package/dist/core/tools/path-utils.d.ts.map +0 -1
  809. package/dist/core/tools/path-utils.js.map +0 -1
  810. package/dist/core/tools/read.d.ts.map +0 -1
  811. package/dist/core/tools/read.js.map +0 -1
  812. package/dist/core/tools/render-utils.d.ts.map +0 -1
  813. package/dist/core/tools/render-utils.js.map +0 -1
  814. package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  815. package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  816. package/dist/core/tools/truncate.d.ts.map +0 -1
  817. package/dist/core/tools/truncate.js.map +0 -1
  818. package/dist/core/tools/write.d.ts.map +0 -1
  819. package/dist/core/tools/write.js.map +0 -1
  820. package/dist/core/trust-manager.d.ts.map +0 -1
  821. package/dist/core/trust-manager.js.map +0 -1
  822. package/dist/core/usage-totals.d.ts.map +0 -1
  823. package/dist/core/usage-totals.js.map +0 -1
  824. package/dist/extensions/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  825. package/dist/extensions/pi-subagents/test/unit/slash-chain-groups.test.ts +0 -464
  826. package/dist/index.d.ts.map +0 -1
  827. package/dist/index.js.map +0 -1
  828. package/dist/main.d.ts.map +0 -1
  829. package/dist/main.js.map +0 -1
  830. package/dist/migrations.d.ts.map +0 -1
  831. package/dist/migrations.js.map +0 -1
  832. package/dist/modes/index.d.ts.map +0 -1
  833. package/dist/modes/index.js.map +0 -1
  834. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  835. package/dist/modes/interactive/components/armin.js.map +0 -1
  836. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  837. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  838. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  839. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  840. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  841. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  842. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  843. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  844. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  845. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  846. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  847. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  848. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  849. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  850. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  851. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  852. package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
  853. package/dist/modes/interactive/components/custom-entry.js.map +0 -1
  854. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  855. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  856. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  857. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
  858. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  859. package/dist/modes/interactive/components/diff.js.map +0 -1
  860. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  861. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  862. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
  863. package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
  864. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  865. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  866. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  867. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  868. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  869. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  870. package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
  871. package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
  872. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  873. package/dist/modes/interactive/components/footer.js.map +0 -1
  874. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  875. package/dist/modes/interactive/components/index.js.map +0 -1
  876. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  877. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  878. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  879. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  880. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  881. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  882. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  883. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  884. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  885. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  886. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  887. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  888. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  889. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  890. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  891. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  892. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  893. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  894. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  895. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  896. package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
  897. package/dist/modes/interactive/components/status-indicator.js.map +0 -1
  898. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  899. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  900. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  901. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  902. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  903. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  904. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  905. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  906. package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
  907. package/dist/modes/interactive/components/trust-selector.js.map +0 -1
  908. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  909. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  910. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  911. package/dist/modes/interactive/components/user-message.js.map +0 -1
  912. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  913. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  914. package/dist/modes/interactive/external-editor.d.ts.map +0 -1
  915. package/dist/modes/interactive/external-editor.js.map +0 -1
  916. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  917. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  918. package/dist/modes/interactive/model-search.d.ts.map +0 -1
  919. package/dist/modes/interactive/model-search.js.map +0 -1
  920. package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
  921. package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
  922. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  923. package/dist/modes/interactive/theme/theme.js.map +0 -1
  924. package/dist/modes/print-mode.d.ts.map +0 -1
  925. package/dist/modes/print-mode.js.map +0 -1
  926. package/dist/modes/rpc/jsonl.d.ts.map +0 -1
  927. package/dist/modes/rpc/jsonl.js.map +0 -1
  928. package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  929. package/dist/modes/rpc/rpc-client.js.map +0 -1
  930. package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  931. package/dist/modes/rpc/rpc-mode.js.map +0 -1
  932. package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  933. package/dist/modes/rpc/rpc-types.js.map +0 -1
  934. package/dist/package-manager-cli.d.ts.map +0 -1
  935. package/dist/package-manager-cli.js.map +0 -1
  936. package/dist/rpc-entry.d.ts.map +0 -1
  937. package/dist/rpc-entry.js.map +0 -1
  938. package/dist/utils/ansi.d.ts.map +0 -1
  939. package/dist/utils/ansi.js.map +0 -1
  940. package/dist/utils/changelog.d.ts.map +0 -1
  941. package/dist/utils/changelog.js.map +0 -1
  942. package/dist/utils/child-process.d.ts.map +0 -1
  943. package/dist/utils/child-process.js.map +0 -1
  944. package/dist/utils/clipboard-image.d.ts.map +0 -1
  945. package/dist/utils/clipboard-image.js.map +0 -1
  946. package/dist/utils/clipboard-native.d.ts.map +0 -1
  947. package/dist/utils/clipboard-native.js.map +0 -1
  948. package/dist/utils/clipboard.d.ts.map +0 -1
  949. package/dist/utils/clipboard.js.map +0 -1
  950. package/dist/utils/deprecation.d.ts.map +0 -1
  951. package/dist/utils/deprecation.js.map +0 -1
  952. package/dist/utils/exif-orientation.d.ts.map +0 -1
  953. package/dist/utils/exif-orientation.js.map +0 -1
  954. package/dist/utils/frontmatter.d.ts.map +0 -1
  955. package/dist/utils/frontmatter.js.map +0 -1
  956. package/dist/utils/fs-watch.d.ts.map +0 -1
  957. package/dist/utils/fs-watch.js.map +0 -1
  958. package/dist/utils/git.d.ts.map +0 -1
  959. package/dist/utils/git.js.map +0 -1
  960. package/dist/utils/html.d.ts.map +0 -1
  961. package/dist/utils/html.js.map +0 -1
  962. package/dist/utils/image-convert.d.ts.map +0 -1
  963. package/dist/utils/image-convert.js.map +0 -1
  964. package/dist/utils/image-process.d.ts.map +0 -1
  965. package/dist/utils/image-process.js.map +0 -1
  966. package/dist/utils/image-resize-core.d.ts.map +0 -1
  967. package/dist/utils/image-resize-core.js.map +0 -1
  968. package/dist/utils/image-resize-worker.d.ts.map +0 -1
  969. package/dist/utils/image-resize-worker.js.map +0 -1
  970. package/dist/utils/image-resize.d.ts.map +0 -1
  971. package/dist/utils/image-resize.js.map +0 -1
  972. package/dist/utils/json.d.ts.map +0 -1
  973. package/dist/utils/json.js.map +0 -1
  974. package/dist/utils/mime.d.ts.map +0 -1
  975. package/dist/utils/mime.js.map +0 -1
  976. package/dist/utils/open-browser.d.ts.map +0 -1
  977. package/dist/utils/open-browser.js.map +0 -1
  978. package/dist/utils/paths.d.ts.map +0 -1
  979. package/dist/utils/paths.js.map +0 -1
  980. package/dist/utils/photon.d.ts.map +0 -1
  981. package/dist/utils/photon.js.map +0 -1
  982. package/dist/utils/pi-user-agent.d.ts.map +0 -1
  983. package/dist/utils/pi-user-agent.js.map +0 -1
  984. package/dist/utils/shell.d.ts.map +0 -1
  985. package/dist/utils/shell.js.map +0 -1
  986. package/dist/utils/sleep.d.ts.map +0 -1
  987. package/dist/utils/sleep.js.map +0 -1
  988. package/dist/utils/syntax-highlight.d.ts.map +0 -1
  989. package/dist/utils/syntax-highlight.js.map +0 -1
  990. package/dist/utils/thinking-tags.d.ts.map +0 -1
  991. package/dist/utils/thinking-tags.js.map +0 -1
  992. package/dist/utils/tools-manager.d.ts.map +0 -1
  993. package/dist/utils/tools-manager.js.map +0 -1
  994. package/dist/utils/version-check.d.ts.map +0 -1
  995. package/dist/utils/version-check.js.map +0 -1
  996. package/dist/utils/windows-self-update.d.ts.map +0 -1
  997. package/dist/utils/windows-self-update.js.map +0 -1
@@ -9,10 +9,8 @@ import {
9
9
  buildSubagentToolDescription,
10
10
  COMPACT_SUBAGENT_TOOL_DESCRIPTION,
11
11
  FULL_SUBAGENT_TOOL_DESCRIPTION,
12
- SUBAGENT_PARENT_ROUTING_GUIDANCE,
13
12
  SUBAGENT_SAFETY_GUIDANCE,
14
13
  } from "../../src/extension/tool-description.ts";
15
- import { BUILTIN_AGENT_NAMES } from "../../src/agents/agents.ts";
16
14
  import { SUBAGENT_CHILD_ENV, SUBAGENT_FANOUT_CHILD_ENV } from "../../src/runs/shared/pi-args.ts";
17
15
 
18
16
  const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
@@ -30,132 +28,30 @@ function parentToolEnv(agentDir?: string): NodeJS.ProcessEnv {
30
28
  }
31
29
 
32
30
  describe("registered subagent tool description", () => {
33
- it("keeps full mode safe and free of hardcoded builtin agent names", () => {
31
+ it("describes workflowScript as the sole public orchestration surface", () => {
34
32
  const description = buildSubagentToolDescription();
35
-
36
- for (const builtinName of BUILTIN_AGENT_NAMES) {
37
- assert.doesNotMatch(description, new RegExp(`\\b${builtinName}\\b`));
38
- }
39
- for (const legacyName of ["scout", "worker", "planner"]) {
40
- assert.doesNotMatch(description, new RegExp(`\\b${legacyName}\\b`));
41
- }
42
- assert.match(description, /^To delegate work, call with \{ agent, task \}, \{ tasks \}, or \{ chain \}; omit action\./i);
43
- assert.match(description, /Use action only for management\/control actions listed below/i);
44
- assert.match(description, /use \{ action: "list" \} to inspect configured agents\/chains/i);
45
- assert.match(description, /executable\/non-disabled/i);
46
- assert.match(description, /proactive skill subagent suggestions/i);
47
- assert.doesNotMatch(description, /disabled builtins/i);
48
- assert.match(description, /output\?,reads\?,progress\?/i);
49
- assert.match(description, /timeoutMs/i);
50
- assert.match(description, /maxRuntimeMs/i);
51
- assert.match(description, /foreground and async\/background runs/i);
52
- assert.match(description, /omit acceptance for reviewer\/read-only calls/i);
53
- assert.match(description, /acceptance\.review\.required/i);
54
- assert.match(description, /reviewed is achieved only after an independent reviewer result/i);
55
- assert.doesNotMatch(description, /only for foreground runs/i);
56
- assert.doesNotMatch(description, /omit for async\/background runs/i);
33
+ assert.match(description, /^Delegate one child with \{ agent, task \} or compose work with \{ workflowScript \}/i);
34
+ assert.match(description, /workflowScript is the sole public orchestration surface/i);
35
+ assert.match(description, /runs\.run for one child and runs\.all for parallel children/i);
36
+ assert.match(description, /repository mutation lanes.*worktree:true.*direct single child.*runs\.run\/runs\.all.*managed isolation.*manual Git worktrees/i);
37
+ assert.match(description, /Sequential replacement/i);
38
+ assert.match(description, /Parallel replacement/i);
39
+ assert.doesNotMatch(description, /Compatibility tasks\[\]|CHAIN EXAMPLES|PARALLEL \(compatibility\)/i);
40
+ assert.match(description, /append-step.*step:/i);
41
+ assert.match(description, /cannot access filesystem, shell, arbitrary Pi tools, or host globals/i);
57
42
  assert.match(description, /SAFETY-CRITICAL SUBAGENT GUIDANCE/);
58
- assert.match(description, /PARENT-ONLY SUBAGENT ROUTING/);
59
- assert.match(description, /call \{ action: "list" \} and select only an executable entry using its current role, context, and tool metadata/i);
60
- assert.match(description, /Keep tiny targeted reads and simple answers local/i);
61
- assert.match(description, /broad local investigation, external research, and mutation\/implementation work/i);
62
- assert.match(description, /parent remains the decision-maker and normally the sole writer/i);
63
- assert.match(description, /Do not sleep or poll status just to wait/i);
64
- assert.match(description, /use subagent_wait/i);
65
- assert.match(description, /interactive session.*normally return control/i);
66
- assert.match(description, /Headless sessions auto-drain current-session work at agent_end/i);
67
- assert.doesNotMatch(description, /MUST call subagent_wait/i);
68
- assert.match(description, /ordinary child subagents are not orchestrators/i);
69
- assert.match(description, /keep one writer/i);
70
- assert.match(description, /view: "fleet"/);
71
- assert.match(description, /view: "transcript"/);
72
- assert.match(description, /action: "steer"/);
73
- assert.match(description, /schedule-list/);
74
- assert.match(description, /action: "eject"/);
75
- assert.match(description, /action: "eject", agent: "agent-name"/);
76
- assert.match(description, /action: "disable", agent: "agent-name"/);
77
- assert.match(description, /action: "enable", agent: "agent-name"/);
78
- assert.match(description, /action: "reset", agent: "agent-name"/);
79
- assert.match(description, /action: "disable"/);
80
- assert.match(description, /action: "grant-spawn-budget"/);
81
- assert.match(description, /root interactive parent/i);
82
- assert.match(description, /cumulative grants cannot exceed the original configured cap/i);
83
- assert.match(description, /acceptanceRole affects inferred acceptance only/i);
84
- assert.match(description, /Explicit task mutation\/no-edit intent wins/i);
85
- assert.match(description, /omission preserves name heuristics/i);
86
- assert.match(description, /false or an empty string to clear it/i);
87
43
  assert.match(description, /status\.json/);
88
- assert.match(description, /events\.jsonl/);
89
- // Chain quick-reference: both sequential and parallel fan-out examples (#417)
90
- assert.match(description, /CHAIN EXAMPLES/i);
91
- assert.match(
92
- description,
93
- /chain:\s*\[\s*\{\s*agent:\s*"[\w-]+",\s*task:\s*"[^"]*"\s*\}\s*,\s*\{\s*agent:\s*"[\w-]+",\s*task:\s*"[^"]*\{previous\}[^"]*"\s*\}\s*\]/,
94
- "full mode should show a sequential chain example using {previous}",
95
- );
96
- assert.match(
97
- description,
98
- /\{\s*parallel:\s*\[\s*\{\s*agent:\s*"[\w-]+",\s*task:\s*"[^"]*",\s*count:\s*\d+\s*\}\s*\]\s*\}/,
99
- "full mode should show a parallel fan-out chain example with count",
100
- );
101
44
  });
102
45
 
103
- it("offers a compact mode that keeps safety-critical guidance", () => {
46
+ it("offers a compact mode that keeps the cutover and safety guidance", () => {
104
47
  const description = buildSubagentToolDescription({ toolDescriptionMode: "compact" });
105
-
106
48
  assert.equal(description, COMPACT_SUBAGENT_TOOL_DESCRIPTION);
107
- assert.match(description, /^To delegate work, call with \{ agent, task \}, \{ tasks \}, or \{ chain \}; omit action\./i);
108
- assert.match(description, /Use action only for management\/control actions listed below/i);
109
- assert.ok(description.length < FULL_SUBAGENT_TOOL_DESCRIPTION.length * 0.8, "compact mode should be materially shorter than full mode");
110
- assert.match(description, /SINGLE/);
111
- assert.match(description, /PARALLEL/);
112
- assert.match(description, /CHAIN/);
113
- assert.match(description, /action without execution fields/i);
114
- assert.match(description, /Parent-only routing/);
115
- assert.match(description, /select only an executable entry using its current role, context, and tool metadata/i);
116
- assert.match(description, /Keep tiny targeted reads and simple answers local/i);
117
- assert.match(description, /broad local investigation, external research, and mutation\/implementation work/i);
118
- assert.match(description, /parent remains the decision-maker and normally the sole writer/i);
119
- for (const builtinName of BUILTIN_AGENT_NAMES) {
120
- assert.doesNotMatch(description, new RegExp(`\\b${builtinName}\\b`));
121
- }
49
+ assert.match(description, /workflowScript is the sole public orchestration surface/i);
50
+ assert.match(description, /runs\.run for one child and runs\.all for parallel work/i);
51
+ assert.match(description, /repository mutation lanes.*worktree:true.*direct single child.*runs\.run\/runs\.all.*managed isolation.*manual Git worktrees/i);
52
+ assert.doesNotMatch(description, /tasks\[\]|chain\[\]/i);
122
53
  assert.match(description, /subagent_wait/i);
123
- assert.match(description, /interactive session.*normally return control/i);
124
- assert.match(description, /Non-interactive runs.*auto-drain current-session work at agent_end/i);
125
- assert.doesNotMatch(description, /MUST call subagent_wait/i);
126
- assert.match(description, /Do not sleep or poll/i);
127
- assert.match(description, /ordinary child subagents are not orchestrators/i);
128
- assert.match(description, /one writer/i);
129
- assert.match(description, /omit acceptance for reviewer\/read-only calls/i);
130
- assert.match(description, /acceptance\.review\.required/i);
131
- assert.match(description, /reviewed is an achieved status/i);
132
- assert.match(description, /view:"fleet"/);
133
- assert.match(description, /view:"transcript"/);
134
- assert.match(description, /steer/);
135
- assert.match(description, /schedule-list/);
136
- assert.match(description, /eject/);
137
- assert.match(description, /disable/);
138
- assert.match(description, /grant-spawn-budget/);
139
- assert.match(description, /acceptanceRole.*affects inferred acceptance only/i);
140
- assert.match(description, /Explicit task intent wins/i);
141
- assert.match(description, /omission keeps name heuristics/i);
142
- assert.match(description, /false or an empty string to clear it/i);
143
- assert.match(description, /status\.json/);
144
- assert.match(description, /events\.jsonl/);
145
- // Compact mode keeps a chain quick-reference too (#417)
146
- assert.match(description, /chain example/i);
147
- assert.match(description, /\{previous\}/);
148
- assert.match(description, /parallel:/);
149
- assert.match(description, /count:/);
150
- });
151
-
152
- it("documents task-aware list advice as explicit-only in both modes", () => {
153
- for (const description of [FULL_SUBAGENT_TOOL_DESCRIPTION, COMPACT_SUBAGENT_TOOL_DESCRIPTION]) {
154
- assert.match(description, /\{ action: "list", task: "\.\.\." \}/);
155
- assert.match(description, /advisory/i);
156
- assert.match(description, /never launches/i);
157
- assert.match(description, /explicitly call subagent|execute the recommended agent explicitly/i);
158
- }
54
+ assert.ok(description.length < FULL_SUBAGENT_TOOL_DESCRIPTION.length);
159
55
  });
160
56
 
161
57
  it("renders a custom project description with placeholders and mandatory safety guidance", () => {
@@ -179,8 +75,6 @@ describe("registered subagent tool description", () => {
179
75
  assert.match(description, new RegExp(escapeRegex(agentDir)));
180
76
  assert.match(description, new RegExp(escapeRegex(projectConfigDir)));
181
77
  assert.match(description, /SAFETY-CRITICAL SUBAGENT GUIDANCE/);
182
- assert.match(description, /PARENT-ONLY SUBAGENT ROUTING/);
183
- assert.match(description, /select only an executable entry using its current role, context, and tool metadata/i);
184
78
  assert.equal(warnings.length, 0);
185
79
  });
186
80
 
@@ -246,7 +140,7 @@ describe("registered subagent tool description", () => {
246
140
  assert.ok(warnings.some((message) => message.includes("Ignoring invalid toolDescriptionMode")));
247
141
  });
248
142
 
249
- function readRegisteredTool(agentDir: string): { description: string; promptGuidelines?: string[] } {
143
+ function readRegisteredDescription(agentDir: string): string {
250
144
  const script = String.raw`
251
145
  import registerSubagentExtension from "./src/extension/index.ts";
252
146
  const events = { on() { return () => {}; }, emit() {} };
@@ -267,10 +161,7 @@ describe("registered subagent tool description", () => {
267
161
  });
268
162
  registerSubagentExtension(fakePi);
269
163
  if (!registeredTool) throw new Error("tool not registered");
270
- process.stdout.write(JSON.stringify({
271
- description: registeredTool.description,
272
- promptGuidelines: registeredTool.promptGuidelines ?? null,
273
- }));
164
+ process.stdout.write(JSON.stringify(registeredTool.description));
274
165
  `;
275
166
  const output = execFileSync(
276
167
  process.execPath,
@@ -284,7 +175,7 @@ describe("registered subagent tool description", () => {
284
175
  ],
285
176
  { cwd: projectRoot, env: parentToolEnv(agentDir), encoding: "utf-8" },
286
177
  );
287
- return JSON.parse(output) as { description: string; promptGuidelines?: string[] };
178
+ return JSON.parse(output) as string;
288
179
  }
289
180
 
290
181
  function writeExtensionConfig(agentDir: string, config: Record<string, unknown>): void {
@@ -295,40 +186,25 @@ describe("registered subagent tool description", () => {
295
186
 
296
187
  it("registers full, compact, custom, and fallback descriptions from extension config", () => {
297
188
  const defaultAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-default-"));
298
- assert.equal(readRegisteredTool(defaultAgentDir).description, FULL_SUBAGENT_TOOL_DESCRIPTION);
189
+ assert.equal(readRegisteredDescription(defaultAgentDir), FULL_SUBAGENT_TOOL_DESCRIPTION);
299
190
 
300
191
  const compactAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-compact-"));
301
192
  writeExtensionConfig(compactAgentDir, { toolDescriptionMode: "compact" });
302
- assert.equal(readRegisteredTool(compactAgentDir).description, COMPACT_SUBAGENT_TOOL_DESCRIPTION);
193
+ assert.equal(readRegisteredDescription(compactAgentDir), COMPACT_SUBAGENT_TOOL_DESCRIPTION);
303
194
 
304
195
  const customAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-custom-"));
305
196
  writeExtensionConfig(customAgentDir, { toolDescriptionMode: "custom" });
306
197
  fs.writeFileSync(path.join(customAgentDir, "subagent-tool-description.md"), "Registered custom description.", "utf-8");
307
- const customDescription = readRegisteredTool(customAgentDir).description;
198
+ const customDescription = readRegisteredDescription(customAgentDir);
308
199
  assert.match(customDescription, /Registered custom description/);
309
200
  assert.match(customDescription, /SAFETY-CRITICAL SUBAGENT GUIDANCE/);
310
201
 
311
202
  const missingCustomAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-missing-"));
312
203
  writeExtensionConfig(missingCustomAgentDir, { toolDescriptionMode: "custom" });
313
- assert.equal(readRegisteredTool(missingCustomAgentDir).description, FULL_SUBAGENT_TOOL_DESCRIPTION);
204
+ assert.equal(readRegisteredDescription(missingCustomAgentDir), FULL_SUBAGENT_TOOL_DESCRIPTION);
314
205
 
315
206
  const invalidAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-invalid-"));
316
207
  writeExtensionConfig(invalidAgentDir, { toolDescriptionMode: "tiny" });
317
- assert.equal(readRegisteredTool(invalidAgentDir).description, FULL_SUBAGENT_TOOL_DESCRIPTION);
318
- });
319
-
320
- it("registers parent-only routing guidance as promptGuidelines on the parent tool", () => {
321
- const defaultAgentDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-subagents-tool-desc-guidelines-"));
322
- const registered = readRegisteredTool(defaultAgentDir);
323
-
324
- assert.ok(Array.isArray(registered.promptGuidelines), "parent subagent tool must expose promptGuidelines");
325
- assert.equal(registered.promptGuidelines!.length, 1);
326
- assert.equal(registered.promptGuidelines![0], SUBAGENT_PARENT_ROUTING_GUIDANCE);
327
- assert.doesNotMatch(SUBAGENT_PARENT_ROUTING_GUIDANCE, new RegExp(BUILTIN_AGENT_NAMES.join("|")));
328
- assert.match(SUBAGENT_PARENT_ROUTING_GUIDANCE, /\{ action: "list" \}/);
329
- assert.match(SUBAGENT_PARENT_ROUTING_GUIDANCE, /executable entry/i);
330
- assert.match(SUBAGENT_PARENT_ROUTING_GUIDANCE, /tiny targeted reads and simple answers local/i);
331
- assert.match(SUBAGENT_PARENT_ROUTING_GUIDANCE, /broad local investigation, external research, and mutation\/implementation work/i);
332
- assert.match(SUBAGENT_PARENT_ROUTING_GUIDANCE, /decision-maker and normally the sole writer/i);
208
+ assert.equal(readRegisteredDescription(invalidAgentDir), FULL_SUBAGENT_TOOL_DESCRIPTION);
333
209
  });
334
210
  });
@@ -50,13 +50,13 @@ describe("turn-budget module", () => {
50
50
 
51
51
  describe("appendTurnBudgetSystemPrompt", () => {
52
52
  it("returns the system prompt unchanged when no budget is configured", () => {
53
- assert.equal(appendTurnBudgetSystemPrompt("You are a reviewer.", undefined), "You are a reviewer.");
53
+ assert.equal(appendTurnBudgetSystemPrompt("You are a commentator.", undefined), "You are a commentator.");
54
54
  assert.equal(appendTurnBudgetSystemPrompt("", undefined), "");
55
55
  });
56
56
 
57
57
  it("appends a turn-budget block after an existing system prompt", () => {
58
- const result = appendTurnBudgetSystemPrompt("You are a reviewer.", budget({ maxTurns: 5, graceTurns: 2 }));
59
- assert.ok(result.startsWith("You are a reviewer.\n\n## Turn budget\n"), result);
58
+ const result = appendTurnBudgetSystemPrompt("You are a commentator.", budget({ maxTurns: 5, graceTurns: 2 }));
59
+ assert.ok(result.startsWith("You are a commentator.\n\n## Turn budget\n"), result);
60
60
  assert.match(result, /soft budget of 5 assistant turns/);
61
61
  assert.match(result, /2 additional assistant turns/);
62
62
  });
@@ -68,8 +68,8 @@ describe("turn-budget module", () => {
68
68
  });
69
69
 
70
70
  it("trims surrounding whitespace from the existing system prompt before joining", () => {
71
- const result = appendTurnBudgetSystemPrompt("\nYou are a reviewer.\n\n", budget());
72
- assert.ok(result.startsWith("You are a reviewer.\n\n## Turn budget\n"), result);
71
+ const result = appendTurnBudgetSystemPrompt("\nYou are a commentator.\n\n", budget());
72
+ assert.ok(result.startsWith("You are a commentator.\n\n## Turn budget\n"), result);
73
73
  assert.equal(result.startsWith("\n"), false);
74
74
  });
75
75
 
@@ -178,9 +178,10 @@ describe("turn-budget module", () => {
178
178
  });
179
179
 
180
180
  describe("turnBudgetDecision", () => {
181
- it("continues below the hard limit and for a terminal response on the final grace turn", () => {
181
+ it("continues for a clean terminal response even after the hard limit", () => {
182
182
  assert.equal(turnBudgetDecision(budget({ maxTurns: 3, graceTurns: 1 }), 3, false, false), "continue");
183
183
  assert.equal(turnBudgetDecision(budget({ maxTurns: 3, graceTurns: 1 }), 4, true, false), "continue");
184
+ assert.equal(turnBudgetDecision(budget({ maxTurns: 3, graceTurns: 1 }), 5, true, false), "continue");
184
185
  });
185
186
 
186
187
  it("defers termination when the hard-limit assistant response starts tool work", () => {
@@ -188,14 +189,15 @@ describe("turn-budget module", () => {
188
189
  assert.equal(turnBudgetDecision(budget({ maxTurns: 3, graceTurns: 1 }), 5, false, true), "defer");
189
190
  });
190
191
 
191
- it("enforces the hard limit for strict foreground delegation but allows the exact terminal boundary", () => {
192
+ it("enforces the hard limit for strict foreground delegation but allows terminal completion", () => {
192
193
  assert.equal(turnBudgetDecision(budget({ maxTurns: 3, graceTurns: 1 }), 4, false, true, true), "abort");
193
194
  assert.equal(turnBudgetDecision(budget({ maxTurns: 3, graceTurns: 1 }), 4, true, true, true), "continue");
195
+ assert.equal(turnBudgetDecision(budget({ maxTurns: 3, graceTurns: 1 }), 5, true, true, true), "continue");
194
196
  });
195
197
 
196
- it("aborts at the next safe assistant boundary", () => {
198
+ it("aborts non-terminal work at the next safe assistant boundary", () => {
197
199
  assert.equal(turnBudgetDecision(budget({ maxTurns: 3, graceTurns: 1 }), 4, false, false), "abort");
198
- assert.equal(turnBudgetDecision(budget({ maxTurns: 3, graceTurns: 1 }), 5, true, false), "abort");
200
+ assert.equal(turnBudgetDecision(budget({ maxTurns: 3, graceTurns: 1 }), 5, false, false), "abort");
199
201
  });
200
202
 
201
203
  it("allows a terminal response at the soft limit when grace turns are zero", () => {
@@ -0,0 +1,351 @@
1
+ import assert from "node:assert/strict";
2
+ import * as fs from "node:fs";
3
+ import * as os from "node:os";
4
+ import * as path from "node:path";
5
+ import { describe, it } from "node:test";
6
+ import { waitForSubagents } from "../../src/runs/background/subagent-wait.ts";
7
+ import { registerWaitTool } from "../../src/runs/background/wait-tool.ts";
8
+ import { createWaitSubscriptionManager } from "../../src/runs/background/wait-subscriptions.ts";
9
+ import { inspectSubagentStatus } from "../../src/runs/background/run-status.ts";
10
+ import { SUBAGENT_ASYNC_COMPLETE_EVENT, type IntercomEventBus, type SubagentState } from "../../src/shared/types.ts";
11
+
12
+ function writeStatus(asyncRoot: string, runId: string, state: string, extra: object = {}): void {
13
+ const dir = path.join(asyncRoot, runId);
14
+ fs.mkdirSync(dir, { recursive: true });
15
+ const now = Date.now();
16
+ fs.writeFileSync(path.join(dir, "status.json"), JSON.stringify({
17
+ runId,
18
+ mode: "single",
19
+ state,
20
+ startedAt: now,
21
+ lastUpdate: now,
22
+ steps: [{ agent: "builder", status: state }],
23
+ ...extra,
24
+ }), "utf-8");
25
+ }
26
+
27
+ function makeState(sessionId = "session-a"): SubagentState {
28
+ return {
29
+ baseCwd: "",
30
+ currentSessionId: sessionId,
31
+ asyncJobs: new Map(),
32
+ foregroundControls: new Map(),
33
+ lastForegroundControlId: null,
34
+ cleanupTimers: new Map(),
35
+ lastUiContext: null,
36
+ poller: null,
37
+ completionSeen: new Map(),
38
+ watcher: null,
39
+ watcherRestartTimer: null,
40
+ resultFileCoalescer: { schedule: () => false, clear: () => {} },
41
+ } as SubagentState;
42
+ }
43
+
44
+ class TestBus implements IntercomEventBus {
45
+ private handlers = new Map<string, Set<(data: unknown) => void>>();
46
+
47
+ on(channel: string, handler: (data: unknown) => void): () => void {
48
+ const handlers = this.handlers.get(channel) ?? new Set();
49
+ handlers.add(handler);
50
+ this.handlers.set(channel, handlers);
51
+ return () => handlers.delete(handler);
52
+ }
53
+
54
+ emit(channel: string, data: unknown): void {
55
+ for (const handler of this.handlers.get(channel) ?? []) handler(data);
56
+ }
57
+ }
58
+
59
+ function textOf(result: { content: Array<{ type: string; text?: string }> }): string {
60
+ return result.content.map((entry) => entry.text ?? "").join("");
61
+ }
62
+
63
+ describe("non-blocking wait subscriptions", () => {
64
+ it("returns immediately and binds an id prefix to one exact run", async () => {
65
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-subscribe-arm-"));
66
+ try {
67
+ const asyncRoot = path.join(root, "runs");
68
+ writeStatus(asyncRoot, "run-alpha", "running", { sessionId: "session-a", pid: 999_999 });
69
+ let armed: { targetKind: "async" | "foreground"; runId: string; requestedId: string; timeoutMs: number } | undefined;
70
+ const result = await waitForSubagents({ id: "run-al", nonBlocking: true, timeoutMs: 5_000 }, undefined, {
71
+ state: makeState(),
72
+ asyncDirRoot: asyncRoot,
73
+ resultsDir: path.join(root, "results"),
74
+ kill: () => true,
75
+ sleep: async () => { throw new Error("non-blocking wait must not sleep"); },
76
+ subscribe: (input) => {
77
+ armed = input;
78
+ return { token: "wait-token", expiresAt: 6_000 };
79
+ },
80
+ });
81
+
82
+ assert.equal(result.isError, undefined);
83
+ assert.match(textOf(result), /Armed wait subscription wait-token/);
84
+ assert.deepEqual(armed, { targetKind: "async", runId: "run-alpha", requestedId: "run-al", timeoutMs: 5_000 });
85
+ } finally {
86
+ fs.rmSync(root, { recursive: true, force: true });
87
+ }
88
+ });
89
+
90
+ it("rejects non-blocking subscriptions from headless tool calls", async () => {
91
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-subscribe-headless-"));
92
+ try {
93
+ const state = makeState();
94
+ state.foregroundRuns = new Map([["run-headless", {
95
+ runId: "run-headless",
96
+ mode: "single",
97
+ cwd: root,
98
+ sessionId: "session-a",
99
+ updatedAt: Date.now(),
100
+ children: [{ agent: "builder", index: 0, status: "detached" }],
101
+ }]]);
102
+ let tool: { execute: (...args: unknown[]) => Promise<{ content: Array<{ text?: string }>; isError?: boolean }> } | undefined;
103
+ registerWaitTool({
104
+ events: new TestBus(),
105
+ registerTool(value: unknown) { tool = value as typeof tool; },
106
+ } as never, state, true, {
107
+ arm() { throw new Error("headless calls must not arm subscriptions"); },
108
+ });
109
+ const result = await tool!.execute("wait", { id: "run-headless", nonBlocking: true }, undefined, undefined, { hasUI: false });
110
+ assert.equal(result.isError, true);
111
+ assert.match(textOf(result), /long-lived interactive subagent runtime/);
112
+ } finally {
113
+ fs.rmSync(root, { recursive: true, force: true });
114
+ }
115
+ });
116
+
117
+ it("restores durable registrations and wakes on exact completion", () => {
118
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-subscribe-restore-"));
119
+ const asyncRoot = path.join(root, "runs");
120
+ const resultsDir = path.join(root, "results");
121
+ const subscriptionsDir = path.join(root, "subscriptions");
122
+ const bus = new TestBus();
123
+ const sent: Array<{ message: { content?: unknown }; options?: { triggerTurn?: boolean } }> = [];
124
+ const pi = {
125
+ events: bus,
126
+ sendMessage(message: { content?: unknown }, options?: { triggerTurn?: boolean }) { sent.push({ message, options }); },
127
+ };
128
+ try {
129
+ writeStatus(asyncRoot, "run-exact", "running", { sessionId: "session-a", pid: 999_999 });
130
+ const firstState = makeState();
131
+ const first = createWaitSubscriptionManager(pi as never, firstState, { asyncDirRoot: asyncRoot, resultsDir, subscriptionsDir, pollIntervalMs: 60_000, kill: () => true });
132
+ const registration = first.arm({ targetKind: "async", runId: "run-exact", requestedId: "run-ex", timeoutMs: 30_000 });
133
+ assert.equal(fs.existsSync(path.join(subscriptionsDir, `${registration.token}.json`)), true);
134
+ first.dispose();
135
+
136
+ const restoredState = makeState();
137
+ const restored = createWaitSubscriptionManager(pi as never, restoredState, { asyncDirRoot: asyncRoot, resultsDir, subscriptionsDir, pollIntervalMs: 60_000, kill: () => true });
138
+ restored.restore();
139
+ assert.equal(restoredState.waitSubscriptions?.has(registration.token), true);
140
+ const status = inspectSubagentStatus({}, { state: restoredState, asyncDirRoot: asyncRoot, resultsDir, kill: () => true });
141
+ assert.match(textOf(status), new RegExp(`Armed wait subscriptions.*${registration.token}`, "s"));
142
+
143
+ writeStatus(asyncRoot, "unrelated-run", "complete", { sessionId: "session-a" });
144
+ restored.reconcile();
145
+ assert.equal(sent.length, 0, "an unrelated exact run must not satisfy the subscription");
146
+
147
+ writeStatus(asyncRoot, "run-exact", "complete", { sessionId: "session-a" });
148
+ bus.emit(SUBAGENT_ASYNC_COMPLETE_EVENT, { runId: "run-exact" });
149
+ assert.equal(sent.length, 1);
150
+ assert.match(String(sent[0]?.message.content), /run run-exact: completed/);
151
+ assert.equal(sent[0]?.options?.triggerTurn, true);
152
+ assert.equal(restoredState.waitSubscriptions?.has(registration.token), false);
153
+ assert.equal(fs.existsSync(path.join(subscriptionsDir, `${registration.token}.json`)), false);
154
+ restored.dispose();
155
+ } finally {
156
+ fs.rmSync(root, { recursive: true, force: true });
157
+ }
158
+ });
159
+
160
+ it("keeps subscriptions active across a session restart", () => {
161
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-subscribe-restart-"));
162
+ const asyncRoot = path.join(root, "runs");
163
+ const subscriptionsDir = path.join(root, "subscriptions");
164
+ const bus = new TestBus();
165
+ const sent: string[] = [];
166
+ const state = makeState();
167
+ const manager = createWaitSubscriptionManager({
168
+ events: bus,
169
+ sendMessage(message: { content?: unknown }) { sent.push(String(message.content)); },
170
+ } as never, state, { asyncDirRoot: asyncRoot, subscriptionsDir, pollIntervalMs: 60_000, kill: () => true });
171
+ try {
172
+ writeStatus(asyncRoot, "run-restart", "running", { sessionId: "session-a", pid: 999_999 });
173
+ const registration = manager.arm({ targetKind: "async", runId: "run-restart", requestedId: "run-restart", timeoutMs: 30_000 });
174
+
175
+ state.currentSessionId = null;
176
+ manager.restore();
177
+ state.currentSessionId = "session-a";
178
+ writeStatus(asyncRoot, "run-restart", "complete", { sessionId: "session-a" });
179
+ manager.restore();
180
+
181
+ assert.match(sent[0] ?? "", /run run-restart: completed/);
182
+ assert.equal(state.waitSubscriptions?.has(registration.token), false);
183
+ } finally {
184
+ manager.dispose();
185
+ fs.rmSync(root, { recursive: true, force: true });
186
+ }
187
+ });
188
+
189
+ it("waits for foreground run restoration before reconciling a restored subscription", () => {
190
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-subscribe-foreground-restore-"));
191
+ const subscriptionsDir = path.join(root, "subscriptions");
192
+ const bus = new TestBus();
193
+ const sent: string[] = [];
194
+ const firstState = makeState();
195
+ firstState.foregroundRuns = new Map([["run-foreground", {
196
+ runId: "run-foreground",
197
+ mode: "single",
198
+ cwd: root,
199
+ sessionId: "session-a",
200
+ updatedAt: Date.now(),
201
+ children: [{ agent: "builder", index: 0, status: "detached" }],
202
+ }]]);
203
+ const pi = {
204
+ events: bus,
205
+ sendMessage(message: { content?: unknown }) { sent.push(String(message.content)); },
206
+ };
207
+ const first = createWaitSubscriptionManager(pi as never, firstState, { subscriptionsDir, pollIntervalMs: 60_000 });
208
+ try {
209
+ const registration = first.arm({ targetKind: "foreground", runId: "run-foreground", requestedId: "run-foreground", timeoutMs: 30_000 });
210
+ first.dispose();
211
+
212
+ const restoredState = makeState();
213
+ restoredState.foregroundRuns = new Map();
214
+ const restored = createWaitSubscriptionManager(pi as never, restoredState, { subscriptionsDir, pollIntervalMs: 60_000 });
215
+ try {
216
+ restored.restore();
217
+ assert.equal(sent.length, 0);
218
+ assert.equal(restoredState.waitSubscriptions?.has(registration.token), true);
219
+
220
+ restoredState.foregroundRuns = new Map([["run-foreground", {
221
+ runId: "run-foreground",
222
+ mode: "single",
223
+ cwd: root,
224
+ sessionId: "session-a",
225
+ updatedAt: Date.now(),
226
+ children: [],
227
+ }]]);
228
+ restored.reconcile();
229
+ assert.match(sent[0] ?? "", /run run-foreground: completed/);
230
+ assert.equal(restoredState.waitSubscriptions?.has(registration.token), false);
231
+ } finally {
232
+ restored.dispose();
233
+ }
234
+ } finally {
235
+ first.dispose();
236
+ fs.rmSync(root, { recursive: true, force: true });
237
+ }
238
+ });
239
+
240
+ it("settles a missing live foreground run as unreconcilable", () => {
241
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-subscribe-foreground-missing-"));
242
+ const state = makeState();
243
+ state.foregroundRuns = new Map();
244
+ const sent: string[] = [];
245
+ const manager = createWaitSubscriptionManager({
246
+ events: new TestBus(),
247
+ sendMessage(message: { content?: unknown }) { sent.push(String(message.content)); },
248
+ } as never, state, { subscriptionsDir: path.join(root, "subscriptions"), pollIntervalMs: 60_000 });
249
+ try {
250
+ manager.arm({ targetKind: "foreground", runId: "run-missing", requestedId: "run-missing", timeoutMs: 30_000 });
251
+ manager.reconcile();
252
+ assert.match(sent[0] ?? "", /could not be reconciled/);
253
+ } finally {
254
+ manager.dispose();
255
+ fs.rmSync(root, { recursive: true, force: true });
256
+ }
257
+ });
258
+
259
+ it("keeps a subscription armed when cleanup fails before delivery", () => {
260
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-subscribe-cleanup-failure-"));
261
+ const asyncRoot = path.join(root, "runs");
262
+ const subscriptionsDir = path.join(root, "subscriptions");
263
+ const sent: string[] = [];
264
+ const state = makeState();
265
+ const manager = createWaitSubscriptionManager({
266
+ events: new TestBus(),
267
+ sendMessage(message: { content?: unknown }) { sent.push(String(message.content)); },
268
+ } as never, state, { asyncDirRoot: asyncRoot, subscriptionsDir, pollIntervalMs: 60_000 });
269
+ try {
270
+ const registration = manager.arm({ targetKind: "async", runId: "run-missing", requestedId: "run-missing", timeoutMs: 30_000 });
271
+ const file = path.join(subscriptionsDir, `${registration.token}.json`);
272
+ fs.unlinkSync(file);
273
+ fs.mkdirSync(file);
274
+
275
+ manager.reconcile();
276
+ assert.equal(sent.length, 0);
277
+ assert.equal(state.waitSubscriptions?.has(registration.token), true);
278
+
279
+ fs.rmdirSync(file);
280
+ manager.reconcile();
281
+ assert.match(sent[0] ?? "", /could not be reconciled/);
282
+ assert.equal(sent.length, 1);
283
+ assert.equal(state.waitSubscriptions?.has(registration.token), false);
284
+ } finally {
285
+ manager.dispose();
286
+ fs.rmSync(root, { recursive: true, force: true });
287
+ }
288
+ });
289
+
290
+ it("wakes when async reconciliation throws", () => {
291
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-subscribe-reconcile-error-"));
292
+ const asyncRoot = path.join(root, "not-a-directory");
293
+ const subscriptionsDir = path.join(root, "subscriptions");
294
+ const bus = new TestBus();
295
+ const sent: string[] = [];
296
+ const state = makeState();
297
+ fs.writeFileSync(asyncRoot, "not a directory", "utf-8");
298
+ const manager = createWaitSubscriptionManager({
299
+ events: bus,
300
+ sendMessage(message: { content?: unknown }) { sent.push(String(message.content)); },
301
+ } as never, state, { asyncDirRoot: asyncRoot, subscriptionsDir, pollIntervalMs: 60_000 });
302
+ try {
303
+ const registration = manager.arm({ targetKind: "async", runId: "run-error", requestedId: "run-error", timeoutMs: 30_000 });
304
+ manager.reconcile();
305
+ assert.match(sent[0] ?? "", /reconciliation failed/);
306
+ assert.equal(state.waitSubscriptions?.has(registration.token), false);
307
+ assert.equal(fs.existsSync(path.join(subscriptionsDir, `${registration.token}.json`)), false);
308
+ } finally {
309
+ manager.dispose();
310
+ fs.rmSync(root, { recursive: true, force: true });
311
+ }
312
+ });
313
+
314
+ it("wakes for attention and timeout without treating subscriptions as child work", () => {
315
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-wait-subscribe-outcomes-"));
316
+ const asyncRoot = path.join(root, "runs");
317
+ const resultsDir = path.join(root, "results");
318
+ const subscriptionsDir = path.join(root, "subscriptions");
319
+ const bus = new TestBus();
320
+ const sent: string[] = [];
321
+ let now = 1_000;
322
+ const state = makeState();
323
+ const manager = createWaitSubscriptionManager({
324
+ events: bus,
325
+ sendMessage(message: { content?: unknown }) { sent.push(String(message.content)); },
326
+ } as never, state, { asyncDirRoot: asyncRoot, resultsDir, subscriptionsDir, pollIntervalMs: 60_000, now: () => now, kill: () => true });
327
+ try {
328
+ writeStatus(asyncRoot, "run-attention", "running", { sessionId: "session-a", pid: 999_999 });
329
+ manager.arm({ targetKind: "async", runId: "run-attention", requestedId: "run-attention", timeoutMs: 5_000 });
330
+ writeStatus(asyncRoot, "run-attention", "running", {
331
+ sessionId: "session-a",
332
+ pid: 999_999,
333
+ activityState: "needs_attention",
334
+ steps: [{ agent: "builder", status: "running", activityState: "needs_attention" }],
335
+ });
336
+ manager.reconcile();
337
+ assert.match(sent.shift() ?? "", /needs attention/);
338
+
339
+ writeStatus(asyncRoot, "run-timeout", "running", { sessionId: "session-a", pid: 999_998 });
340
+ manager.arm({ targetKind: "async", runId: "run-timeout", requestedId: "run-timeout", timeoutMs: 100 });
341
+ now = 1_101;
342
+ manager.reconcile();
343
+ assert.match(sent.shift() ?? "", /timed out/);
344
+ assert.equal(state.asyncJobs.size, 0);
345
+ assert.equal(state.waitSubscriptions?.size, 0);
346
+ } finally {
347
+ manager.dispose();
348
+ fs.rmSync(root, { recursive: true, force: true });
349
+ }
350
+ });
351
+ });