@ashx-j/lunr-dev 0.2.19-dev.10.1 → 0.2.25-dev.13.1

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 (690) hide show
  1. package/CHANGELOG.md +60 -2
  2. package/README.md +2 -2
  3. package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
  4. package/dist/builtin-extensions/ashxj-tui.js +2 -2
  5. package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
  6. package/dist/builtin-extensions/index.d.ts.map +1 -1
  7. package/dist/builtin-extensions/index.js +1 -2
  8. package/dist/builtin-extensions/index.js.map +1 -1
  9. package/dist/builtin-extensions/lunr-browser.d.ts +9 -0
  10. package/dist/builtin-extensions/lunr-browser.d.ts.map +1 -0
  11. package/dist/builtin-extensions/lunr-browser.js +169 -0
  12. package/dist/builtin-extensions/lunr-browser.js.map +1 -0
  13. package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -1
  14. package/dist/builtin-extensions/lunr-computer-use.js +15 -14
  15. package/dist/builtin-extensions/lunr-computer-use.js.map +1 -1
  16. package/dist/builtin-extensions/lunr-plan-tools.d.ts +7 -7
  17. package/dist/builtin-extensions/lunr-plan-tools.d.ts.map +1 -1
  18. package/dist/builtin-extensions/lunr-plan-tools.js +12 -12
  19. package/dist/builtin-extensions/lunr-plan-tools.js.map +1 -1
  20. package/dist/builtin-extensions/lunr-todos.d.ts +6 -5
  21. package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -1
  22. package/dist/builtin-extensions/lunr-todos.js +24 -7
  23. package/dist/builtin-extensions/lunr-todos.js.map +1 -1
  24. package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts +6 -4
  25. package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts.map +1 -1
  26. package/dist/builtin-extensions/pi-intercom/broker/spawn.js +114 -61
  27. package/dist/builtin-extensions/pi-intercom/broker/spawn.js.map +1 -1
  28. package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
  29. package/dist/builtin-extensions/pi-intercom/index.js +365 -351
  30. package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
  31. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
  32. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +1 -0
  33. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
  34. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  35. package/dist/builtin-extensions/pi-mcp-adapter/index.js +1 -1
  36. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  37. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts +1 -1
  38. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts.map +1 -1
  39. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js +5 -1
  40. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js.map +1 -1
  41. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.d.ts.map +1 -1
  42. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js +2 -2
  43. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js.map +1 -1
  44. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +9 -7
  45. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  46. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +143 -59
  47. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  48. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts +18 -8
  49. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
  50. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +39 -14
  51. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +5 -3
  53. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
  54. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +32 -17
  55. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
  56. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts +17 -0
  57. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts.map +1 -0
  58. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js +45 -0
  59. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js.map +1 -0
  60. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts +2 -0
  61. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js +10 -14
  63. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
  64. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +12 -2
  65. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
  66. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +401 -58
  67. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
  68. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts +1 -0
  69. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts.map +1 -1
  70. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js +1 -1
  71. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js.map +1 -1
  72. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts +29 -0
  73. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts.map +1 -0
  74. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js +184 -0
  75. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js.map +1 -0
  76. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts +91 -0
  77. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts.map +1 -0
  78. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js +542 -0
  79. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js.map +1 -0
  80. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +13 -1
  81. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
  82. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +42 -12
  83. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
  84. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.d.ts.map +1 -1
  85. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js +3 -2
  86. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js.map +1 -1
  87. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts +2 -1
  88. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
  89. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +35 -8
  90. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -1
  91. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts +1 -0
  92. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts.map +1 -1
  93. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js +2 -1
  94. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js.map +1 -1
  95. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts +7 -3
  96. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts.map +1 -1
  97. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js +26 -4
  98. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js.map +1 -1
  99. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts +1 -0
  100. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -1
  101. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js +55 -38
  102. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js.map +1 -1
  103. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts +100 -0
  104. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
  105. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +47 -32
  106. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
  107. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +6 -6
  108. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
  109. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +75 -5
  110. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
  111. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts +15 -2
  112. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts.map +1 -1
  113. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js +14 -4
  114. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js.map +1 -1
  115. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  116. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +43 -4
  117. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  118. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts +1 -0
  119. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
  120. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +26 -9
  121. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
  122. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
  123. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +4 -3
  124. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
  125. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +0 -1
  126. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  127. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +94 -25
  128. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  129. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts +2 -0
  130. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -1
  131. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js +75 -18
  132. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js.map +1 -1
  133. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
  134. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
  135. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +1 -1
  136. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
  137. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts +1 -1
  138. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts.map +1 -1
  139. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js +1 -1
  140. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js.map +1 -1
  141. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts +13 -1
  142. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -1
  143. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +67 -11
  144. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -1
  145. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +1 -0
  146. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
  147. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
  148. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +5 -0
  149. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
  150. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +25 -15
  151. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
  152. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts +1 -0
  153. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts.map +1 -1
  154. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js +3 -0
  155. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js.map +1 -1
  156. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  157. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +17 -5
  158. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  159. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts +2 -2
  160. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts.map +1 -1
  161. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js +5 -10
  162. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js.map +1 -1
  163. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.d.ts +2 -0
  164. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.d.ts.map +1 -0
  165. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js +3 -0
  166. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js.map +1 -0
  167. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts +3 -0
  168. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
  169. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +70 -13
  170. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
  171. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts +12 -1
  172. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts.map +1 -1
  173. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js +21 -2
  174. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js.map +1 -1
  175. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +23 -4
  176. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  177. package/dist/builtin-extensions/pi-subagents/src/shared/types.js +1 -1
  178. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  179. package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.d.ts.map +1 -1
  180. package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.js.map +1 -1
  181. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts +7 -0
  182. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
  183. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +11 -7
  184. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
  185. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +6 -0
  186. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
  187. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +46 -29
  188. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
  189. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts +18 -0
  190. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -0
  191. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +48 -0
  192. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -0
  193. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +46 -4
  194. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  195. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +407 -450
  196. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  197. package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.d.ts.map +1 -1
  198. package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js +1 -1
  199. package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js.map +1 -1
  200. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts +2 -13
  201. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts.map +1 -1
  202. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js +5 -91
  203. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js.map +1 -1
  204. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  205. package/dist/builtin-extensions/pi-web-access/index.js +11 -7
  206. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  207. package/dist/cli/args.d.ts.map +1 -1
  208. package/dist/cli/args.js +2 -1
  209. package/dist/cli/args.js.map +1 -1
  210. package/dist/cli/install-cli.d.ts.map +1 -1
  211. package/dist/cli/install-cli.js +15 -45
  212. package/dist/cli/install-cli.js.map +1 -1
  213. package/dist/core/agent-session-runtime.d.ts +9 -0
  214. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  215. package/dist/core/agent-session-runtime.js +126 -29
  216. package/dist/core/agent-session-runtime.js.map +1 -1
  217. package/dist/core/agent-session.d.ts +23 -1
  218. package/dist/core/agent-session.d.ts.map +1 -1
  219. package/dist/core/agent-session.js +255 -109
  220. package/dist/core/agent-session.js.map +1 -1
  221. package/dist/core/browser/network.d.ts +9 -0
  222. package/dist/core/browser/network.d.ts.map +1 -0
  223. package/dist/core/browser/network.js +146 -0
  224. package/dist/core/browser/network.js.map +1 -0
  225. package/dist/core/browser/runtime.d.ts +24 -0
  226. package/dist/core/browser/runtime.d.ts.map +1 -0
  227. package/dist/core/browser/runtime.js +289 -0
  228. package/dist/core/browser/runtime.js.map +1 -0
  229. package/dist/core/browser/schema.d.ts +16 -0
  230. package/dist/core/browser/schema.d.ts.map +1 -0
  231. package/dist/core/browser/schema.js +36 -0
  232. package/dist/core/browser/schema.js.map +1 -0
  233. package/dist/core/browser/settings.d.ts +8 -0
  234. package/dist/core/browser/settings.d.ts.map +1 -0
  235. package/dist/core/browser/settings.js +30 -0
  236. package/dist/core/browser/settings.js.map +1 -0
  237. package/dist/core/browser/setup.d.ts +2 -0
  238. package/dist/core/browser/setup.d.ts.map +1 -0
  239. package/dist/core/browser/setup.js +16 -0
  240. package/dist/core/browser/setup.js.map +1 -0
  241. package/dist/core/catalog-cache-scope.d.ts.map +1 -1
  242. package/dist/core/catalog-cache-scope.js +3 -1
  243. package/dist/core/catalog-cache-scope.js.map +1 -1
  244. package/dist/core/computer-use/image.d.ts +27 -0
  245. package/dist/core/computer-use/image.d.ts.map +1 -0
  246. package/dist/core/computer-use/image.js +72 -0
  247. package/dist/core/computer-use/image.js.map +1 -0
  248. package/dist/core/computer-use/policy.d.ts.map +1 -1
  249. package/dist/core/computer-use/policy.js +2 -6
  250. package/dist/core/computer-use/policy.js.map +1 -1
  251. package/dist/core/computer-use/schemas.d.ts +14 -10
  252. package/dist/core/computer-use/schemas.d.ts.map +1 -1
  253. package/dist/core/computer-use/schemas.js +27 -35
  254. package/dist/core/computer-use/schemas.js.map +1 -1
  255. package/dist/core/computer-use/workflow.d.ts +16 -8
  256. package/dist/core/computer-use/workflow.d.ts.map +1 -1
  257. package/dist/core/computer-use/workflow.js +337 -260
  258. package/dist/core/computer-use/workflow.js.map +1 -1
  259. package/dist/core/customize.d.ts +2 -0
  260. package/dist/core/customize.d.ts.map +1 -1
  261. package/dist/core/customize.js +17 -13
  262. package/dist/core/customize.js.map +1 -1
  263. package/dist/core/export-html/index.d.ts.map +1 -1
  264. package/dist/core/export-html/index.js +1 -1
  265. package/dist/core/export-html/index.js.map +1 -1
  266. package/dist/core/extensions/loader.d.ts.map +1 -1
  267. package/dist/core/extensions/loader.js +4 -0
  268. package/dist/core/extensions/loader.js.map +1 -1
  269. package/dist/core/extensions/runner.d.ts +1 -0
  270. package/dist/core/extensions/runner.d.ts.map +1 -1
  271. package/dist/core/extensions/runner.js +1 -1
  272. package/dist/core/extensions/runner.js.map +1 -1
  273. package/dist/core/extensions/types.d.ts +1 -1
  274. package/dist/core/extensions/types.d.ts.map +1 -1
  275. package/dist/core/extensions/types.js.map +1 -1
  276. package/dist/core/install-features.d.ts.map +1 -1
  277. package/dist/core/install-features.js +10 -8
  278. package/dist/core/install-features.js.map +1 -1
  279. package/dist/core/memory-cap.d.ts.map +1 -1
  280. package/dist/core/memory-cap.js +5 -3
  281. package/dist/core/memory-cap.js.map +1 -1
  282. package/dist/core/model-runtime.d.ts.map +1 -1
  283. package/dist/core/model-runtime.js +3 -2
  284. package/dist/core/model-runtime.js.map +1 -1
  285. package/dist/core/model-tiers.d.ts.map +1 -1
  286. package/dist/core/model-tiers.js +9 -6
  287. package/dist/core/model-tiers.js.map +1 -1
  288. package/dist/core/permissions.d.ts +17 -23
  289. package/dist/core/permissions.d.ts.map +1 -1
  290. package/dist/core/permissions.js +79 -146
  291. package/dist/core/permissions.js.map +1 -1
  292. package/dist/core/plan-mode.d.ts +10 -12
  293. package/dist/core/plan-mode.d.ts.map +1 -1
  294. package/dist/core/plan-mode.js +20 -24
  295. package/dist/core/plan-mode.js.map +1 -1
  296. package/dist/core/process-registry.d.ts.map +1 -1
  297. package/dist/core/process-registry.js +6 -4
  298. package/dist/core/process-registry.js.map +1 -1
  299. package/dist/core/runtime-bridges.d.ts.map +1 -1
  300. package/dist/core/runtime-bridges.js +2 -2
  301. package/dist/core/runtime-bridges.js.map +1 -1
  302. package/dist/core/runtime-scope.d.ts +11 -0
  303. package/dist/core/runtime-scope.d.ts.map +1 -0
  304. package/dist/core/runtime-scope.js +3 -0
  305. package/dist/core/runtime-scope.js.map +1 -0
  306. package/dist/core/sdk.d.ts.map +1 -1
  307. package/dist/core/sdk.js +26 -6
  308. package/dist/core/sdk.js.map +1 -1
  309. package/dist/core/session-handoff.d.ts +35 -0
  310. package/dist/core/session-handoff.d.ts.map +1 -0
  311. package/dist/core/session-handoff.js +214 -0
  312. package/dist/core/session-handoff.js.map +1 -0
  313. package/dist/core/session-manager.d.ts +20 -0
  314. package/dist/core/session-manager.d.ts.map +1 -1
  315. package/dist/core/session-manager.js +191 -22
  316. package/dist/core/session-manager.js.map +1 -1
  317. package/dist/core/session-ownership.d.ts +28 -0
  318. package/dist/core/session-ownership.d.ts.map +1 -0
  319. package/dist/core/session-ownership.js +138 -0
  320. package/dist/core/session-ownership.js.map +1 -0
  321. package/dist/core/session-retention.d.ts.map +1 -1
  322. package/dist/core/session-retention.js +11 -2
  323. package/dist/core/session-retention.js.map +1 -1
  324. package/dist/core/settings-manager.d.ts +24 -1
  325. package/dist/core/settings-manager.d.ts.map +1 -1
  326. package/dist/core/settings-manager.js +78 -1
  327. package/dist/core/settings-manager.js.map +1 -1
  328. package/dist/core/slash-commands.d.ts.map +1 -1
  329. package/dist/core/slash-commands.js +6 -4
  330. package/dist/core/slash-commands.js.map +1 -1
  331. package/dist/core/subagent-cancellation.d.ts +21 -0
  332. package/dist/core/subagent-cancellation.d.ts.map +1 -0
  333. package/dist/core/subagent-cancellation.js +53 -0
  334. package/dist/core/subagent-cancellation.js.map +1 -0
  335. package/dist/core/subagent-permission-inherit.d.ts +6 -10
  336. package/dist/core/subagent-permission-inherit.d.ts.map +1 -1
  337. package/dist/core/subagent-permission-inherit.js +14 -14
  338. package/dist/core/subagent-permission-inherit.js.map +1 -1
  339. package/dist/core/subagent-spinner-setting.d.ts +6 -0
  340. package/dist/core/subagent-spinner-setting.d.ts.map +1 -0
  341. package/dist/core/subagent-spinner-setting.js +12 -0
  342. package/dist/core/subagent-spinner-setting.js.map +1 -0
  343. package/dist/core/subagent-spinner.d.ts +4 -0
  344. package/dist/core/subagent-spinner.d.ts.map +1 -0
  345. package/dist/core/subagent-spinner.js +6 -0
  346. package/dist/core/subagent-spinner.js.map +1 -0
  347. package/dist/core/subagent-wait-interruption.d.ts +11 -0
  348. package/dist/core/subagent-wait-interruption.d.ts.map +1 -0
  349. package/dist/core/subagent-wait-interruption.js +19 -0
  350. package/dist/core/subagent-wait-interruption.js.map +1 -0
  351. package/dist/core/system-prompt.d.ts +2 -0
  352. package/dist/core/system-prompt.d.ts.map +1 -1
  353. package/dist/core/system-prompt.js +14 -4
  354. package/dist/core/system-prompt.js.map +1 -1
  355. package/dist/core/todo-settings.d.ts +5 -0
  356. package/dist/core/todo-settings.d.ts.map +1 -0
  357. package/dist/core/todo-settings.js +7 -0
  358. package/dist/core/todo-settings.js.map +1 -0
  359. package/dist/core/tools/bash.d.ts.map +1 -1
  360. package/dist/core/tools/bash.js +4 -4
  361. package/dist/core/tools/bash.js.map +1 -1
  362. package/dist/core/tools/edit.d.ts.map +1 -1
  363. package/dist/core/tools/edit.js +5 -3
  364. package/dist/core/tools/edit.js.map +1 -1
  365. package/dist/core/tools/find.d.ts.map +1 -1
  366. package/dist/core/tools/find.js +4 -4
  367. package/dist/core/tools/find.js.map +1 -1
  368. package/dist/core/tools/grep.d.ts.map +1 -1
  369. package/dist/core/tools/grep.js +4 -4
  370. package/dist/core/tools/grep.js.map +1 -1
  371. package/dist/core/tools/ls.d.ts.map +1 -1
  372. package/dist/core/tools/ls.js +4 -4
  373. package/dist/core/tools/ls.js.map +1 -1
  374. package/dist/core/tools/read.d.ts.map +1 -1
  375. package/dist/core/tools/read.js +4 -4
  376. package/dist/core/tools/read.js.map +1 -1
  377. package/dist/core/tools/render-utils.d.ts +14 -5
  378. package/dist/core/tools/render-utils.d.ts.map +1 -1
  379. package/dist/core/tools/render-utils.js +34 -7
  380. package/dist/core/tools/render-utils.js.map +1 -1
  381. package/dist/core/tools/write.d.ts.map +1 -1
  382. package/dist/core/tools/write.js +4 -4
  383. package/dist/core/tools/write.js.map +1 -1
  384. package/dist/core/usage-service.d.ts.map +1 -1
  385. package/dist/core/usage-service.js +5 -3
  386. package/dist/core/usage-service.js.map +1 -1
  387. package/dist/gateway/adapters/discord.d.ts +12 -1
  388. package/dist/gateway/adapters/discord.d.ts.map +1 -1
  389. package/dist/gateway/adapters/discord.js +114 -24
  390. package/dist/gateway/adapters/discord.js.map +1 -1
  391. package/dist/gateway/adapters/telegram.d.ts +4 -2
  392. package/dist/gateway/adapters/telegram.d.ts.map +1 -1
  393. package/dist/gateway/adapters/telegram.js +41 -11
  394. package/dist/gateway/adapters/telegram.js.map +1 -1
  395. package/dist/gateway/agent-bridge.d.ts +18 -4
  396. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  397. package/dist/gateway/agent-bridge.js +305 -73
  398. package/dist/gateway/agent-bridge.js.map +1 -1
  399. package/dist/gateway/approval.d.ts +3 -6
  400. package/dist/gateway/approval.d.ts.map +1 -1
  401. package/dist/gateway/approval.js +62 -24
  402. package/dist/gateway/approval.js.map +1 -1
  403. package/dist/gateway/authz.d.ts +2 -0
  404. package/dist/gateway/authz.d.ts.map +1 -1
  405. package/dist/gateway/authz.js +13 -0
  406. package/dist/gateway/authz.js.map +1 -1
  407. package/dist/gateway/buttons.d.ts +3 -1
  408. package/dist/gateway/buttons.d.ts.map +1 -1
  409. package/dist/gateway/buttons.js +45 -20
  410. package/dist/gateway/buttons.js.map +1 -1
  411. package/dist/gateway/command.d.ts.map +1 -1
  412. package/dist/gateway/command.js +49 -4
  413. package/dist/gateway/command.js.map +1 -1
  414. package/dist/gateway/commands.d.ts +2 -0
  415. package/dist/gateway/commands.d.ts.map +1 -1
  416. package/dist/gateway/commands.js +52 -16
  417. package/dist/gateway/commands.js.map +1 -1
  418. package/dist/gateway/config.d.ts +6 -0
  419. package/dist/gateway/config.d.ts.map +1 -1
  420. package/dist/gateway/config.js +7 -0
  421. package/dist/gateway/config.js.map +1 -1
  422. package/dist/gateway/conversations.d.ts +14 -0
  423. package/dist/gateway/conversations.d.ts.map +1 -0
  424. package/dist/gateway/conversations.js +30 -0
  425. package/dist/gateway/conversations.js.map +1 -0
  426. package/dist/gateway/cron.d.ts +1 -1
  427. package/dist/gateway/cron.d.ts.map +1 -1
  428. package/dist/gateway/cron.js +2 -2
  429. package/dist/gateway/cron.js.map +1 -1
  430. package/dist/gateway/download.d.ts +2 -0
  431. package/dist/gateway/download.d.ts.map +1 -0
  432. package/dist/gateway/download.js +36 -0
  433. package/dist/gateway/download.js.map +1 -0
  434. package/dist/gateway/index.d.ts.map +1 -1
  435. package/dist/gateway/index.js +106 -47
  436. package/dist/gateway/index.js.map +1 -1
  437. package/dist/gateway/mobile-commands.d.ts +24 -0
  438. package/dist/gateway/mobile-commands.d.ts.map +1 -0
  439. package/dist/gateway/mobile-commands.js +423 -0
  440. package/dist/gateway/mobile-commands.js.map +1 -0
  441. package/dist/gateway/presenter.d.ts +27 -0
  442. package/dist/gateway/presenter.d.ts.map +1 -0
  443. package/dist/gateway/presenter.js +308 -0
  444. package/dist/gateway/presenter.js.map +1 -0
  445. package/dist/gateway/router.d.ts +6 -5
  446. package/dist/gateway/router.d.ts.map +1 -1
  447. package/dist/gateway/router.js +126 -43
  448. package/dist/gateway/router.js.map +1 -1
  449. package/dist/gateway/service.d.ts +46 -0
  450. package/dist/gateway/service.d.ts.map +1 -0
  451. package/dist/gateway/service.js +404 -0
  452. package/dist/gateway/service.js.map +1 -0
  453. package/dist/gateway/setup.d.ts +9 -0
  454. package/dist/gateway/setup.d.ts.map +1 -0
  455. package/dist/gateway/setup.js +202 -0
  456. package/dist/gateway/setup.js.map +1 -0
  457. package/dist/gateway/stream.d.ts +6 -5
  458. package/dist/gateway/stream.d.ts.map +1 -1
  459. package/dist/gateway/stream.js +24 -11
  460. package/dist/gateway/stream.js.map +1 -1
  461. package/dist/gateway/types.d.ts +4 -2
  462. package/dist/gateway/types.d.ts.map +1 -1
  463. package/dist/gateway/types.js.map +1 -1
  464. package/dist/index.d.ts +2 -0
  465. package/dist/index.d.ts.map +1 -1
  466. package/dist/index.js +2 -0
  467. package/dist/index.js.map +1 -1
  468. package/dist/main.d.ts.map +1 -1
  469. package/dist/main.js +3 -3
  470. package/dist/main.js.map +1 -1
  471. package/dist/modes/interactive/components/assistant-message.d.ts +19 -2
  472. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  473. package/dist/modes/interactive/components/assistant-message.js +90 -35
  474. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  475. package/dist/modes/interactive/components/copyable-text.d.ts +27 -0
  476. package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -0
  477. package/dist/modes/interactive/components/copyable-text.js +156 -0
  478. package/dist/modes/interactive/components/copyable-text.js.map +1 -0
  479. package/dist/modes/interactive/components/custom-entry.d.ts +1 -0
  480. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  481. package/dist/modes/interactive/components/custom-entry.js +8 -0
  482. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  483. package/dist/modes/interactive/components/custom-message.d.ts +1 -0
  484. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  485. package/dist/modes/interactive/components/custom-message.js +8 -0
  486. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  487. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  488. package/dist/modes/interactive/components/session-selector.js +16 -0
  489. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  490. package/dist/modes/interactive/components/settings-selector.d.ts +16 -1
  491. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  492. package/dist/modes/interactive/components/settings-selector.js +147 -4
  493. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  494. package/dist/modes/interactive/components/thinking-tail.d.ts +9 -2
  495. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  496. package/dist/modes/interactive/components/thinking-tail.js +43 -1
  497. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  498. package/dist/modes/interactive/components/tool-execution.d.ts +5 -3
  499. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  500. package/dist/modes/interactive/components/tool-execution.js +55 -44
  501. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  502. package/dist/modes/interactive/extension-widget-order.d.ts +8 -0
  503. package/dist/modes/interactive/extension-widget-order.d.ts.map +1 -0
  504. package/dist/modes/interactive/extension-widget-order.js +37 -0
  505. package/dist/modes/interactive/extension-widget-order.js.map +1 -0
  506. package/dist/modes/interactive/interactive-mode.d.ts +11 -2
  507. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  508. package/dist/modes/interactive/interactive-mode.js +386 -155
  509. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  510. package/dist/modes/interactive/theme/theme.d.ts +1 -0
  511. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  512. package/dist/modes/interactive/theme/theme.js +23 -0
  513. package/dist/modes/interactive/theme/theme.js.map +1 -1
  514. package/dist/node-runtime/agent-session-services-MQUPZSIN.js +51 -0
  515. package/dist/node-runtime/{builtin-extensions-7STLFW3A.js → builtin-extensions-4GNDR6U3.js} +8 -6
  516. package/dist/node-runtime/{chunk-LTXUQJI4.js → chunk-24C5IAJ4.js} +1 -6
  517. package/dist/node-runtime/chunk-2BLXLDJR.js +144 -0
  518. package/dist/node-runtime/{chunk-RQ5DNUNG.js → chunk-2CMV4L24.js} +21 -124
  519. package/dist/node-runtime/{chunk-OTT6JMPU.js → chunk-2MI5OPMN.js} +17 -370
  520. package/dist/node-runtime/{chunk-W3CVH5RX.js → chunk-2TKODGBZ.js} +11 -6
  521. package/dist/node-runtime/{chunk-K72NVGUB.js → chunk-33SIKK3Y.js} +38 -164
  522. package/dist/node-runtime/{chunk-GZQHMEWL.js → chunk-3DKIWPKN.js} +19 -4
  523. package/dist/node-runtime/{chunk-5OLJGVCB.js → chunk-3ONQTOMR.js} +2 -2
  524. package/dist/node-runtime/{chunk-3GHXVUAK.js → chunk-3VEY2IYY.js} +1 -1
  525. package/dist/node-runtime/chunk-4ER2ZV4Z.js +537 -0
  526. package/dist/node-runtime/chunk-4EULYYR4.js +62 -0
  527. package/dist/node-runtime/{chunk-BKAZ6BKX.js → chunk-4SBQAI4T.js} +31 -31
  528. package/dist/node-runtime/{chunk-W7S2REEG.js → chunk-53ARRUHA.js} +785 -285
  529. package/dist/node-runtime/{chunk-ZSEZY3II.js → chunk-5Q4A37RB.js} +10 -4
  530. package/dist/node-runtime/{chunk-SWSN6HAB.js → chunk-5UZOPGE3.js} +1 -1
  531. package/dist/node-runtime/{chunk-LCACDWHJ.js → chunk-5Z5PCXGY.js} +263 -222
  532. package/dist/node-runtime/chunk-5ZH3ZFIZ.js +308 -0
  533. package/dist/node-runtime/chunk-7JIYPIQU.js +356 -0
  534. package/dist/node-runtime/{chunk-ZRDIMBEQ.js → chunk-AJ6R5VTV.js} +66 -91
  535. package/dist/node-runtime/chunk-ATIF3RX5.js +352 -0
  536. package/dist/node-runtime/chunk-BBUVIEZB.js +51 -0
  537. package/dist/node-runtime/chunk-CCCN2UCX.js +14 -0
  538. package/dist/node-runtime/chunk-CJS4KQFI.js +3412 -0
  539. package/dist/node-runtime/chunk-DO6PALE2.js +205 -0
  540. package/dist/node-runtime/{chunk-MUMMMTW4.js → chunk-DRJI7ZSC.js} +572 -401
  541. package/dist/node-runtime/{chunk-6SPPH4FY.js → chunk-E75WFZ33.js} +4 -4
  542. package/dist/node-runtime/{chunk-MJQDX3BA.js → chunk-EBB4BJW4.js} +3 -3
  543. package/dist/node-runtime/{chunk-5NWQCSKR.js → chunk-EOEAQIJV.js} +70 -3
  544. package/dist/node-runtime/chunk-EOPL2HMM.js +117 -0
  545. package/dist/node-runtime/chunk-H4K3JDRB.js +47 -0
  546. package/dist/node-runtime/{chunk-HRS4HMDX.js → chunk-HT2XEJNP.js} +19 -3
  547. package/dist/node-runtime/chunk-IMLCWLPI.js +9 -0
  548. package/dist/node-runtime/{chunk-FLYMHKCS.js → chunk-JJWZB7S3.js} +60 -48
  549. package/dist/node-runtime/chunk-KFFOQR4G.js +672 -0
  550. package/dist/node-runtime/chunk-L5LZUGT7.js +40 -0
  551. package/dist/node-runtime/chunk-LV6CEFW2.js +97 -0
  552. package/dist/node-runtime/{chunk-EHMBW7FA.js → chunk-LWYIVUGV.js} +5 -4
  553. package/dist/node-runtime/{chunk-T5GM5BFH.js → chunk-MFV2LOOX.js} +186 -2194
  554. package/dist/node-runtime/{chunk-5SQDLSZJ.js → chunk-MNRO3UCV.js} +2 -2
  555. package/dist/node-runtime/{chunk-JHYKXIMM.js → chunk-MPKSOJBT.js} +1 -1
  556. package/dist/node-runtime/{chunk-C4O2RSQQ.js → chunk-N4TUWAGA.js} +1 -1
  557. package/dist/node-runtime/{chunk-4SJWFTUP.js → chunk-NAY6UUQZ.js} +1 -1
  558. package/dist/node-runtime/chunk-NKH2QBKF.js +773 -0
  559. package/dist/node-runtime/chunk-O2AT4MEU.js +124 -0
  560. package/dist/node-runtime/chunk-OAR4TYZE.js +146 -0
  561. package/dist/node-runtime/{chunk-DDGMHUOW.js → chunk-OGJN3OZV.js} +2 -1
  562. package/dist/node-runtime/{chunk-MX3GJNXJ.js → chunk-PLGA743X.js} +23 -0
  563. package/dist/node-runtime/chunk-Q3FEOEDA.js +1364 -0
  564. package/dist/node-runtime/chunk-QFADHUQV.js +74 -0
  565. package/dist/node-runtime/chunk-RBZQU6TJ.js +27 -0
  566. package/dist/node-runtime/{chunk-MGSB2C3M.js → chunk-RVOQBXTA.js} +10 -6
  567. package/dist/node-runtime/{chunk-ISQDQIZN.js → chunk-RW4PYFNE.js} +14 -94
  568. package/dist/node-runtime/chunk-TP7K7YWS.js +2830 -0
  569. package/dist/node-runtime/{chunk-TAP7QTUT.js → chunk-TVLBDVTR.js} +46 -436
  570. package/dist/node-runtime/chunk-UAEOTO52.js +119 -0
  571. package/dist/node-runtime/{chunk-MGWCVY6Y.js → chunk-UDKX3PFN.js} +3 -3
  572. package/dist/node-runtime/{chunk-AY6CAJSL.js → chunk-UJOCPOMX.js} +6 -3
  573. package/dist/node-runtime/{chunk-J7QGQD45.js → chunk-UQUCFAJ3.js} +1 -1
  574. package/dist/node-runtime/chunk-US544NN6.js +13 -0
  575. package/dist/node-runtime/{chunk-7AFOFSDY.js → chunk-V3HK3FE7.js} +1 -1
  576. package/dist/node-runtime/{chunk-6UB6NKA3.js → chunk-VIVYOI7C.js} +130 -27
  577. package/dist/node-runtime/{chunk-5Q45AVQG.js → chunk-XHIRAZ26.js} +1 -1
  578. package/dist/node-runtime/chunk-YPHAIRZT.js +10 -0
  579. package/dist/node-runtime/{chunk-3RCWXWAY.js → chunk-YRUY57IN.js} +1 -1
  580. package/dist/node-runtime/cli-runtime.js +2 -2
  581. package/dist/node-runtime/command-PYBNGLPP.js +45 -0
  582. package/dist/node-runtime/{commands-LGR5VT5X.js → commands-EMBQQVVT.js} +13 -13
  583. package/dist/node-runtime/commands-Y2OUC2T7.js +37 -0
  584. package/dist/node-runtime/config-7DYMNJUO.js +20 -0
  585. package/dist/node-runtime/{customize-XEXL2DGQ.js → customize-VFJV3U6A.js} +2 -1
  586. package/dist/node-runtime/{direct-tool-executor-TDJS7TBD.js → direct-tool-executor-4D7UXYU4.js} +10 -10
  587. package/dist/node-runtime/{export-html-E4DT6ZJQ.js → export-html-ETFOKW3M.js} +4 -3
  588. package/dist/node-runtime/{extension-input-RV5N6APL.js → extension-input-7QODTFAS.js} +4 -4
  589. package/dist/node-runtime/{extension-selector-CPD5LWDD.js → extension-selector-T65JEDJ5.js} +4 -4
  590. package/dist/node-runtime/{extract-IUCVZCWC.js → extract-EQJE7FZZ.js} +2 -2
  591. package/dist/node-runtime/gateway-QENRQA5X.js +1476 -0
  592. package/dist/node-runtime/{gemini-search-NCIDF7NE.js → gemini-search-35OCRFLN.js} +1 -1
  593. package/dist/node-runtime/{gemini-url-context-OKIN7AIP.js → gemini-url-context-UQY3PHHW.js} +2 -2
  594. package/dist/node-runtime/index.js +120 -77
  595. package/dist/node-runtime/{init-EKE277AG.js → init-P5AUV77I.js} +5 -5
  596. package/dist/node-runtime/{install-cli-TH7IJJQQ.js → install-cli-KHAXYBOO.js} +21 -82
  597. package/dist/node-runtime/interactive-mode-IN77GQGX.js +74 -0
  598. package/dist/node-runtime/{interactive-view-N6F4KUIT.js → interactive-view-OMWDFGUQ.js} +10 -10
  599. package/dist/node-runtime/lunr-browser-VVPRWC3F.js +174 -0
  600. package/dist/node-runtime/lunr-computer-use-IAUNXSXH.js +138 -0
  601. package/dist/node-runtime/{lunr-cron-KKBOGAEF.js → lunr-cron-P6ZJGVEF.js} +22 -8
  602. package/dist/node-runtime/main.js +50 -35
  603. package/dist/node-runtime/{mcp-auth-flow-YL6RWPYG.js → mcp-auth-flow-QVLFVLEO.js} +2 -2
  604. package/dist/node-runtime/{memory-cap-3S4XRLNP.js → memory-cap-EL3KL4JJ.js} +2 -1
  605. package/dist/node-runtime/mobile-commands-WKFSFACZ.js +33 -0
  606. package/dist/node-runtime/model-runtime-YXGJS5OJ.js +16 -0
  607. package/dist/node-runtime/{model-tiers-NJLHUEGK.js → model-tiers-OU3U5CZG.js} +2 -1
  608. package/dist/node-runtime/{package-manager-cli-C4EJOO5Q.js → package-manager-cli-J337RKTI.js} +28 -19
  609. package/dist/node-runtime/{pi-intercom-EEMBGQID.js → pi-intercom-QM53RLTS.js} +114 -88
  610. package/dist/node-runtime/{pi-mcp-adapter-DPTJGAAL.js → pi-mcp-adapter-3PHF4KZ4.js} +9 -8
  611. package/dist/node-runtime/{pi-subagents-VKCLYIBY.js → pi-subagents-RCHPB6UK.js} +1476 -646
  612. package/dist/node-runtime/{pi-web-access-BV6DSZOP.js → pi-web-access-PNG35XW7.js} +11 -11
  613. package/dist/node-runtime/process-registry-PVJ44F7H.js +31 -0
  614. package/dist/node-runtime/{proxy-modes-R64LU6WZ.js → proxy-modes-5FAPSZEZ.js} +14 -14
  615. package/dist/node-runtime/rpc-entry.js +50 -35
  616. package/dist/node-runtime/{rpc-mode-SJNSOA4G.js → rpc-mode-SH7VB4RH.js} +2 -2
  617. package/dist/node-runtime/runtime-4VA6JKNF.js +373 -0
  618. package/dist/node-runtime/runtime-bridges-3CQHWVVY.js +21 -0
  619. package/dist/node-runtime/service-HGGU3STY.js +36 -0
  620. package/dist/node-runtime/session-handoff-IAFIK7QP.js +33 -0
  621. package/dist/node-runtime/{session-manager-QEMZBMTM.js → session-manager-TCEFDKBL.js} +2 -1
  622. package/dist/node-runtime/{session-selector-URVJLOTK.js → session-selector-HG5J4BDZ.js} +5 -4
  623. package/dist/node-runtime/{settings-manager-K6IPIQTI.js → settings-manager-HIBIUNBK.js} +13 -5
  624. package/dist/node-runtime/setup-JBKOLJ6F.js +18 -0
  625. package/dist/node-runtime/setup-YU5LKRL3.js +215 -0
  626. package/dist/node-runtime/{subagent-executor-EFLTO32A.js → subagent-executor-2BH76MMS.js} +242 -314
  627. package/dist/node-runtime/theme-WTJWZSGD.js +68 -0
  628. package/dist/node-runtime/trust-manager-6ZQANSBX.js +17 -0
  629. package/dist/node-runtime/{update-cli-I6OVDRPL.js → update-cli-TVTPVUNM.js} +7 -3
  630. package/dist/node-runtime/usage-service-LFB2SWYV.js +37 -0
  631. package/dist/node-runtime/{video-extract-ETA5RA7U.js → video-extract-OOZHR7SU.js} +2 -2
  632. package/dist/node-runtime/workflow-TVJNKKQP.js +509 -0
  633. package/dist/node-runtime/{youtube-extract-SRVGNN26.js → youtube-extract-FNPAUNHU.js} +6 -6
  634. package/dist/startup/interactive-view.d.ts.map +1 -1
  635. package/dist/startup/interactive-view.js +5 -1
  636. package/dist/startup/interactive-view.js.map +1 -1
  637. package/dist/utils/image-resize-core.d.ts +2 -0
  638. package/dist/utils/image-resize-core.d.ts.map +1 -1
  639. package/dist/utils/image-resize-core.js +10 -0
  640. package/dist/utils/image-resize-core.js.map +1 -1
  641. package/docs/browser.md +86 -0
  642. package/docs/computer-use.md +319 -268
  643. package/docs/extensions.md +2 -0
  644. package/docs/features.md +129 -30
  645. package/docs/index.md +1 -1
  646. package/docs/interactive-startup.md +2 -1
  647. package/docs/keybindings.md +4 -2
  648. package/docs/providers.md +6 -2
  649. package/docs/quickstart.md +2 -2
  650. package/docs/sessions.md +10 -0
  651. package/docs/settings.md +6 -3
  652. package/docs/tui.md +2 -0
  653. package/docs/usage.md +20 -4
  654. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  655. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  656. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  657. package/examples/extensions/gondolin/package-lock.json +2 -2
  658. package/examples/extensions/gondolin/package.json +1 -1
  659. package/examples/extensions/plan-mode/README.md +1 -1
  660. package/examples/extensions/sandbox/package-lock.json +2 -2
  661. package/examples/extensions/sandbox/package.json +1 -1
  662. package/examples/extensions/with-deps/package-lock.json +2 -2
  663. package/examples/extensions/with-deps/package.json +1 -1
  664. package/install-lock/package-lock.json +39 -25
  665. package/install-lock/package.json +2 -2
  666. package/npm-shrinkwrap.json +36 -22
  667. package/package.json +10 -7
  668. package/scripts/install-browser.mjs +20 -0
  669. package/dist/builtin-extensions/lunr-settings-tools.d.ts +0 -4
  670. package/dist/builtin-extensions/lunr-settings-tools.d.ts.map +0 -1
  671. package/dist/builtin-extensions/lunr-settings-tools.js +0 -120
  672. package/dist/builtin-extensions/lunr-settings-tools.js.map +0 -1
  673. package/dist/core/settings-tools-bridge.d.ts +0 -35
  674. package/dist/core/settings-tools-bridge.d.ts.map +0 -1
  675. package/dist/core/settings-tools-bridge.js +0 -56
  676. package/dist/core/settings-tools-bridge.js.map +0 -1
  677. package/dist/node-runtime/agent-session-services-RSGP5GDN.js +0 -39
  678. package/dist/node-runtime/chunk-EH2LJQPM.js +0 -64
  679. package/dist/node-runtime/chunk-HQCKFM2O.js +0 -56
  680. package/dist/node-runtime/chunk-JT6YCS5B.js +0 -5648
  681. package/dist/node-runtime/command-6UXQ6XZN.js +0 -13
  682. package/dist/node-runtime/gateway-3OLC4GQN.js +0 -2139
  683. package/dist/node-runtime/image-resize-6ZPBFMWW.js +0 -11
  684. package/dist/node-runtime/interactive-mode-S5M26CQ7.js +0 -59
  685. package/dist/node-runtime/lunr-computer-use-4X3KUNF4.js +0 -206
  686. package/dist/node-runtime/runtime-bridges-UJ5WJJLN.js +0 -14
  687. package/dist/node-runtime/workflow-SA34S4VX.js +0 -325
  688. package/dist/node-runtime/{chunk-U6C7VTR5.js → chunk-7IQGBKBJ.js} +3 -3
  689. package/dist/node-runtime/{mcp-panel-IIGMXQGP.js → mcp-panel-KTTFXJZ4.js} +3 -3
  690. package/dist/node-runtime/{src-GPFAU3N6.js → src-IVPNZ2BX.js} +6 -6
@@ -1,14 +1,22 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
- PLAN_MODE_WRITE_SPAWN_ERROR,
3
+ controlNotificationKey,
4
+ formatControlNoticeMessage,
5
+ isDiagnosticControlEvent
6
+ } from "./chunk-OAR4TYZE.js";
7
+ import {
8
+ READ_ONLY_WRITE_SPAWN_ERROR,
4
9
  resolveChildPermissions
5
- } from "./chunk-MGSB2C3M.js";
10
+ } from "./chunk-RVOQBXTA.js";
6
11
  import {
7
12
  createReadOnlyTools
8
- } from "./chunk-K72NVGUB.js";
13
+ } from "./chunk-33SIKK3Y.js";
14
+ import {
15
+ subagentCommunicationEnabled
16
+ } from "./chunk-EOEAQIJV.js";
9
17
  import {
10
18
  COMPUTER_TOOLS
11
- } from "./chunk-5OLJGVCB.js";
19
+ } from "./chunk-3ONQTOMR.js";
12
20
  import {
13
21
  convertToLlm
14
22
  } from "./chunk-FVDOXRUD.js";
@@ -66,7 +74,8 @@ function resolveTempScopeId(options) {
66
74
  }
67
75
  return "shared";
68
76
  }
69
- var MAX_PARALLEL = Number.MAX_SAFE_INTEGER, MAX_CONCURRENCY = Number.MAX_SAFE_INTEGER, TEMP_ROOT_DIR = path.join(os.tmpdir(), `pi-subagents-${resolveTempScopeId()}`), RESULTS_DIR = path.join(TEMP_ROOT_DIR, "async-subagent-results"), ASYNC_DIR = path.join(TEMP_ROOT_DIR, "async-subagent-runs"), CHAIN_RUNS_DIR = path.join(TEMP_ROOT_DIR, "chain-runs"), TEMP_ARTIFACTS_DIR = path.join(TEMP_ROOT_DIR, "artifacts"), WIDGET_KEY = "subagent-async", SLASH_RESULT_TYPE = "subagent-slash-result", SLASH_TEXT_RESULT_TYPE = "subagent-slash-text-result", SLASH_SUBAGENT_REQUEST_EVENT = "subagent:slash:request", SLASH_SUBAGENT_STARTED_EVENT = "subagent:slash:started", SLASH_SUBAGENT_RESPONSE_EVENT = "subagent:slash:response", SLASH_SUBAGENT_UPDATE_EVENT = "subagent:slash:update", SLASH_SUBAGENT_CANCEL_EVENT = "subagent:slash:cancel", POLL_INTERVAL_MS = 250, MAX_WIDGET_JOBS = 4, DEFAULT_SUBAGENT_MAX_DEPTH = 2, SUBAGENT_ACTIONS = ["status", "interrupt", "resume", "steer", "stop", "append-step", "doctor", "watchdog.status", "watchdog.check", "watchdog.configure", "watchdog.recommend-model", "schedule", "schedule-list", "schedule-status", "schedule-cancel"];
77
+ var MAX_PARALLEL = Number.MAX_SAFE_INTEGER, MAX_CONCURRENCY = Number.MAX_SAFE_INTEGER, TEMP_ROOT_DIR = path.join(os.tmpdir(), `pi-subagents-${resolveTempScopeId()}`), RESULTS_DIR = path.join(TEMP_ROOT_DIR, "async-subagent-results"), ASYNC_DIR = path.join(TEMP_ROOT_DIR, "async-subagent-runs"), CHAIN_RUNS_DIR = path.join(TEMP_ROOT_DIR, "chain-runs"), TEMP_ARTIFACTS_DIR = path.join(TEMP_ROOT_DIR, "artifacts"), WIDGET_KEY = "subagent-async", SLASH_RESULT_TYPE = "subagent-slash-result", SLASH_TEXT_RESULT_TYPE = "subagent-slash-text-result", SLASH_SUBAGENT_REQUEST_EVENT = "subagent:slash:request", SLASH_SUBAGENT_STARTED_EVENT = "subagent:slash:started", SLASH_SUBAGENT_RESPONSE_EVENT = "subagent:slash:response", SLASH_SUBAGENT_UPDATE_EVENT = "subagent:slash:update", SLASH_SUBAGENT_CANCEL_EVENT = "subagent:slash:cancel", POLL_INTERVAL_MS = 250;
78
+ var DEFAULT_SUBAGENT_MAX_DEPTH = 2, SUBAGENT_ACTIONS = ["status", "interrupt", "resume", "steer", "stop", "append-step", "doctor", "watchdog.status", "watchdog.check", "watchdog.recommend-model", "schedule", "schedule-list", "schedule-status", "schedule-cancel"];
70
79
  var DEFAULT_FORK_PREAMBLE = "You are a delegated subagent running from a fork of the parent session. Treat the inherited conversation as reference-only context, not a live thread to continue. Do not continue or answer prior messages as if they are waiting for a reply. Your sole job is to execute the task below and return a focused result for that task using your tools.";
71
80
  function normalizeTopLevelParallelValue(value) {
72
81
  let parsed = typeof value == "number" ? value : typeof value == "string" ? Number(value) : NaN;
@@ -423,7 +432,22 @@ function formatModelThinking(model, thinking) {
423
432
  return [displayModel, formatThinkingLabel(model, thinking)].filter(Boolean).join(" \xB7 ");
424
433
  }
425
434
  function formatModelSelection(selection, resolvedModel, thinking) {
426
- return selection?.kind === "tier" && selection.tier ? [selection.tier, formatThinkingLabel(resolvedModel, thinking)].filter(Boolean).join(" \xB7 ") : formatModelThinking(resolvedModel, thinking);
435
+ if (selection?.kind === "tier" && selection.tier)
436
+ return [selection.tier, formatThinkingLabel(resolvedModel, thinking)].filter(Boolean).join(" \xB7 ");
437
+ let selectedModel = selection?.kind === "model" ? selection.model : void 0;
438
+ return formatModelThinking(selectedModel || resolvedModel, thinking);
439
+ }
440
+ function formatModelId(model) {
441
+ if (!model)
442
+ return "";
443
+ let displayModel = splitKnownThinkingSuffix(model).baseModel, slashIdx = displayModel.lastIndexOf("/");
444
+ return slashIdx !== -1 && (displayModel = displayModel.slice(slashIdx + 1)), displayModel;
445
+ }
446
+ function formatCompactModelBadge(selection, resolvedModel) {
447
+ if (selection?.kind === "tier" && selection.tier)
448
+ return selection.tier;
449
+ let explicit = selection?.kind === "model" && typeof selection.model == "string" && selection.model.trim() ? selection.model : void 0;
450
+ return formatModelId(explicit ?? resolvedModel);
427
451
  }
428
452
  function formatUsage(u, model) {
429
453
  let parts = [];
@@ -1908,13 +1932,37 @@ function resolveWaitToolConfig(config, env = process.env) {
1908
1932
  };
1909
1933
  }
1910
1934
 
1935
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/intercom/communication.js
1936
+ var SUPERVISOR_PROTOCOL_ENV = "PI_SUBAGENT_SUPERVISOR_PROTOCOL", CHILD_DESCRIPTION_ENV = "PI_SUBAGENT_CHILD_DESCRIPTION";
1937
+ var SUPERVISOR_REQUEST_TYPE = "subagent_supervisor_request", SUPERVISOR_PROGRESS_TYPE = "subagent_supervisor_progress";
1938
+ function readCommunication(value) {
1939
+ if (!value || typeof value != "object")
1940
+ return;
1941
+ let input = value;
1942
+ if (!(input.direction !== "from" && input.direction !== "to") && !(typeof input.peer != "string" || typeof input.message != "string") && ["request", "interview", "progress", "handoff", "question", "reply", "answer", "steer"].includes(input.kind ?? ""))
1943
+ return input;
1944
+ }
1945
+ function resolveCommunicationPeer(state, runId, childIndex, childId, fallback) {
1946
+ let job = state.asyncJobs.get(runId) ?? state.fleetJobs?.get(runId), step = job?.steps?.find((candidate, index) => (candidate.index ?? index) === childIndex && (!childId || (candidate.childId ?? candidate.agent) === childId)), label = step?.description ?? (step?.agent !== childId ? step?.agent : void 0);
1947
+ if (label)
1948
+ return (job?.steps?.filter((candidate) => (candidate.description ?? candidate.agent) === label).length ?? 0) > 1 ? `${label} \xB7 ${childIndex + 1}` : label;
1949
+ let foreground = state.foregroundControls.get(runId);
1950
+ if (foreground?.currentIndex === childIndex && (!childId || foreground.currentChildId === childId) && foreground.currentAgent && foreground.currentAgent !== childId)
1951
+ return foreground.currentAgent;
1952
+ let remembered = state.foregroundRuns?.get(runId)?.children.find((child) => child.index === childIndex);
1953
+ return remembered?.agent && remembered.agent !== childId ? remembered.agent : fallback?.trim() || `Subagent ${childIndex + 1}`;
1954
+ }
1955
+ function legacySupervisorBody(content) {
1956
+ return content.replace(/^Subagent (?:progress update\.|needs a supervisor decision\.|requests a structured supervisor interview\.)\r?\nRun: [^\n]*\r?\nAgent: [^\n]*\r?\nChild index: [^\n]*\r?\n(?:Child intercom target: [^\n]*\r?\n)?\r?\n/, "").replace(/^Subagent answer \([^\n]*\)\r?\nRun: [^\n]*\r?\nChild: [^\n]*\r?\nDecision: [^\n]*\r?\n\r?\n/, "").replace(/\r?\n\r?\nReply with: subagent_supervisor\([^\n]*\)\s*$/, "");
1957
+ }
1958
+
1911
1959
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js
1912
1960
  var TASK_ARG_LIMIT = 8e3;
1913
1961
  function resolveRuntimeScriptPath(basePathWithoutExt) {
1914
1962
  let tsPath = `${basePathWithoutExt}.ts`;
1915
1963
  return fs9.existsSync(tsPath) ? tsPath : `${basePathWithoutExt}.js`;
1916
1964
  }
1917
- var PROMPT_RUNTIME_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "subagent-prompt-runtime")), FANOUT_CHILD_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "..", "..", "extension", "fanout-child")), SUBAGENT_CHILD_ENV = "PI_SUBAGENT_CHILD", SUBAGENT_ORCHESTRATOR_TARGET_ENV = "PI_SUBAGENT_ORCHESTRATOR_TARGET", SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV = "PI_SUBAGENT_ORCHESTRATOR_SESSION_ID", SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV = "PI_SUBAGENT_SUPERVISOR_CHANNEL_DIR", SUBAGENT_RUN_ID_ENV = "PI_SUBAGENT_RUN_ID", SUBAGENT_CHILD_AGENT_ENV = "PI_SUBAGENT_CHILD_AGENT", SUBAGENT_CHILD_INDEX_ENV = "PI_SUBAGENT_CHILD_INDEX", SUBAGENT_FANOUT_CHILD_ENV = "PI_SUBAGENT_FANOUT_CHILD", SUBAGENT_PARENT_EVENT_SINK_ENV = "PI_SUBAGENT_PARENT_EVENT_SINK", SUBAGENT_PARENT_CONTROL_INBOX_ENV = "PI_SUBAGENT_PARENT_CONTROL_INBOX", SUBAGENT_PARENT_ROOT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_ROOT_RUN_ID", SUBAGENT_PARENT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_RUN_ID", SUBAGENT_PARENT_CHILD_INDEX_ENV = "PI_SUBAGENT_PARENT_CHILD_INDEX", SUBAGENT_PARENT_DEPTH_ENV = "PI_SUBAGENT_PARENT_DEPTH", SUBAGENT_PARENT_PATH_ENV = "PI_SUBAGENT_PARENT_PATH", SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV = "PI_SUBAGENT_PARENT_CAPABILITY_TOKEN", SUBAGENT_PARENT_SESSION_ENV = "PI_SUBAGENT_PARENT_SESSION", SUBAGENT_PARENT_PERMISSION_MODE_ENV = "PI_SUBAGENT_PARENT_PERMISSION_MODE", SUBAGENT_CHILD_PERMISSION_ENV = "PI_SUBAGENT_CHILD_PERMISSION", SUBAGENT_STEER_INBOX_ENV = "PI_SUBAGENT_STEER_INBOX", SUBAGENT_STEER_CAPABILITY_ENV = "PI_SUBAGENT_STEER_CAPABILITY", SUBAGENT_STEER_ACK_DIR_ENV = "PI_SUBAGENT_STEER_ACK_DIR";
1965
+ var PROMPT_RUNTIME_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "subagent-prompt-runtime")), FANOUT_CHILD_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "..", "..", "extension", "fanout-child")), SUBAGENT_COMMUNICATION_ENV = "PI_SUBAGENT_COMMUNICATION_ENABLED", SUBAGENT_CHILD_ENV = "PI_SUBAGENT_CHILD", SUBAGENT_ORCHESTRATOR_TARGET_ENV = "PI_SUBAGENT_ORCHESTRATOR_TARGET", SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV = "PI_SUBAGENT_ORCHESTRATOR_SESSION_ID", SUBAGENT_SUPERVISOR_SESSION_ID_ENV = "PI_SUBAGENT_SUPERVISOR_SESSION_ID", SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV = "PI_SUBAGENT_SUPERVISOR_CHANNEL_DIR", SUBAGENT_RUN_ID_ENV = "PI_SUBAGENT_RUN_ID", SUBAGENT_CHILD_AGENT_ENV = "PI_SUBAGENT_CHILD_AGENT", SUBAGENT_CHILD_INDEX_ENV = "PI_SUBAGENT_CHILD_INDEX", SUBAGENT_FANOUT_CHILD_ENV = "PI_SUBAGENT_FANOUT_CHILD", SUBAGENT_PARENT_EVENT_SINK_ENV = "PI_SUBAGENT_PARENT_EVENT_SINK", SUBAGENT_PARENT_CONTROL_INBOX_ENV = "PI_SUBAGENT_PARENT_CONTROL_INBOX", SUBAGENT_PARENT_ROOT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_ROOT_RUN_ID", SUBAGENT_PARENT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_RUN_ID", SUBAGENT_PARENT_CHILD_INDEX_ENV = "PI_SUBAGENT_PARENT_CHILD_INDEX", SUBAGENT_PARENT_DEPTH_ENV = "PI_SUBAGENT_PARENT_DEPTH", SUBAGENT_PARENT_PATH_ENV = "PI_SUBAGENT_PARENT_PATH", SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV = "PI_SUBAGENT_PARENT_CAPABILITY_TOKEN", SUBAGENT_PARENT_SESSION_ENV = "PI_SUBAGENT_PARENT_SESSION", SUBAGENT_PARENT_PERMISSION_MODE_ENV = "PI_SUBAGENT_PARENT_PERMISSION_MODE", SUBAGENT_CHILD_PERMISSION_ENV = "PI_SUBAGENT_CHILD_PERMISSION", SUBAGENT_STEER_INBOX_ENV = "PI_SUBAGENT_STEER_INBOX", SUBAGENT_STEER_CAPABILITY_ENV = "PI_SUBAGENT_STEER_CAPABILITY", SUBAGENT_STEER_ACK_DIR_ENV = "PI_SUBAGENT_STEER_ACK_DIR";
1918
1966
  function sanitizeSupervisorChannelSegment(value) {
1919
1967
  return value.trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "unknown";
1920
1968
  }
@@ -1928,18 +1976,19 @@ function applyThinkingSuffix(model, thinking, replaceExisting = !1) {
1928
1976
  return colonIdx !== -1 && THINKING_LEVELS.some((level) => level === model.substring(colonIdx + 1)) ? replaceExisting ? `${model.slice(0, colonIdx)}:${thinking}` : model : `${model}:${thinking}`;
1929
1977
  }
1930
1978
  function buildPiArgs(input) {
1931
- let args = [...input.baseArgs];
1979
+ let communicationEnabled = input.communicationEnabled ?? subagentCommunicationEnabled(input.cwd ?? process.cwd(), getAgentDir()), args = [...input.baseArgs];
1932
1980
  input.sessionFile ? (fs9.mkdirSync(path10.dirname(input.sessionFile), { recursive: !0 }), args.push("--session", input.sessionFile)) : (input.sessionEnabled || args.push("--no-session"), input.sessionDir && (fs9.mkdirSync(input.sessionDir, { recursive: !0 }), args.push("--session-dir", input.sessionDir)));
1933
1981
  let modelArg = applyThinkingSuffix(input.model, input.thinking);
1934
1982
  modelArg && args.push("--model", modelArg);
1935
- let declaredBuiltinToolsBase = input.tools?.filter((tool) => !(tool.includes("/") || tool.endsWith(".ts") || tool.endsWith(".js"))) ?? [], declaredBuiltinTools = input.requireReadTool && input.tools?.length && !declaredBuiltinToolsBase.includes("read") ? ["read", ...declaredBuiltinToolsBase] : declaredBuiltinToolsBase, fanoutAuthorized = declaredBuiltinTools.includes("subagent"), toolExtensionPaths = [], requiredChildTools = [];
1983
+ let declaredBuiltinToolsBase = input.tools?.filter((tool) => !(tool.includes("/") || tool.endsWith(".ts") || tool.endsWith(".js")) && (communicationEnabled || tool !== "contact_supervisor" && tool !== "intercom")) ?? [], declaredBuiltinTools = input.requireReadTool && input.tools?.length && !declaredBuiltinToolsBase.includes("read") ? ["read", ...declaredBuiltinToolsBase] : declaredBuiltinToolsBase, fanoutAuthorized = declaredBuiltinTools.includes("subagent"), toolExtensionPaths = [], requiredChildTools = [];
1936
1984
  if (input.tools?.length) {
1937
1985
  let allowedTools = [...declaredBuiltinTools];
1938
1986
  for (let tool of input.tools)
1939
1987
  !declaredBuiltinTools.includes(tool) && (tool.includes("/") || tool.endsWith(".ts") || tool.endsWith(".js")) && toolExtensionPaths.push(tool);
1940
1988
  allowedTools.length > 0 && (input.mcpDirectTools?.length && allowedTools.push(...resolveMcpDirectToolNames(input.mcpDirectTools, input.cwd)), input.structuredOutput && allowedTools.push("structured_output"), requiredChildTools = [...new Set(allowedTools)], args.push("--tools", requiredChildTools.join(",")));
1941
1989
  }
1942
- input.excludeTools?.length && args.push("--exclude-tools", [...new Set(input.excludeTools)].join(","));
1990
+ let excludedTools = [...input.excludeTools ?? [], ...communicationEnabled ? [] : ["contact_supervisor", "intercom"]];
1991
+ excludedTools.length && args.push("--exclude-tools", [...new Set(excludedTools)].join(","));
1943
1992
  let runtimeExtensions = fanoutAuthorized ? [PROMPT_RUNTIME_EXTENSION_PATH, FANOUT_CHILD_EXTENSION_PATH] : [PROMPT_RUNTIME_EXTENSION_PATH];
1944
1993
  if (input.extensions !== void 0) {
1945
1994
  args.push("--no-extensions");
@@ -1962,7 +2011,7 @@ function buildPiArgs(input) {
1962
2011
  } else
1963
2012
  args.push(`Task: ${input.task}`);
1964
2013
  let env = {}, toolDiagnosticPath;
1965
- requiredChildTools.length > 0 && (tempDir || (tempDir = fs9.mkdtempSync(path10.join(os6.tmpdir(), "pi-subagent-"))), toolDiagnosticPath = path10.join(tempDir, "tool-diagnostic.json"), env[REQUIRED_CHILD_TOOLS_ENV] = JSON.stringify(requiredChildTools), env[CHILD_TOOL_DIAGNOSTIC_PATH_ENV] = toolDiagnosticPath), env[SUBAGENT_CHILD_ENV] = "1", env[SUBAGENT_CHILD_PERMISSION_ENV] = input.childPermission ?? (input.parentPermissionMode === "plan" ? "read-only" : "full"), env[SUBAGENT_PARENT_PERMISSION_MODE_ENV] = "", env[SUBAGENT_FANOUT_CHILD_ENV] = fanoutAuthorized ? "1" : "0", input.waitToolEnabled !== void 0 && (env[WAIT_TOOL_ENABLED_ENV] = input.waitToolEnabled ? "true" : "false");
2014
+ requiredChildTools.length > 0 && (tempDir || (tempDir = fs9.mkdtempSync(path10.join(os6.tmpdir(), "pi-subagent-"))), toolDiagnosticPath = path10.join(tempDir, "tool-diagnostic.json"), env[REQUIRED_CHILD_TOOLS_ENV] = JSON.stringify(requiredChildTools), env[CHILD_TOOL_DIAGNOSTIC_PATH_ENV] = toolDiagnosticPath), env[SUBAGENT_CHILD_ENV] = "1", env[SUBAGENT_COMMUNICATION_ENV] = communicationEnabled ? "1" : "0", env[SUBAGENT_CHILD_PERMISSION_ENV] = input.childPermission ?? (input.parentPermissionMode === "read-only" ? "read-only" : "full"), env[SUBAGENT_PARENT_PERMISSION_MODE_ENV] = "", env[SUBAGENT_FANOUT_CHILD_ENV] = fanoutAuthorized ? "1" : "0", input.waitToolEnabled !== void 0 && (env[WAIT_TOOL_ENABLED_ENV] = input.waitToolEnabled ? "true" : "false");
1966
2015
  let inheritedNestedRoute = !!(process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] && process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] && process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV]), parentRunId = input.parentRunId ?? input.runId ?? (inheritedNestedRoute ? process.env[SUBAGENT_RUN_ID_ENV] : void 0) ?? process.env[SUBAGENT_PARENT_RUN_ID_ENV] ?? "", parentChildIndex = input.parentChildIndex !== void 0 ? String(input.parentChildIndex) : input.childIndex !== void 0 ? String(input.childIndex) : process.env[SUBAGENT_PARENT_CHILD_INDEX_ENV] ?? "", inheritedDepth = Number(process.env[SUBAGENT_PARENT_DEPTH_ENV]), parentDepth = input.parentDepth ?? (inheritedNestedRoute && Number.isFinite(inheritedDepth) ? inheritedDepth + 1 : 1), parentPath = input.parentPath ?? [
1967
2016
  ...parseNestedPathEnv(process.env[SUBAGENT_PARENT_PATH_ENV]),
1968
2017
  ...parentRunId ? [{
@@ -1971,9 +2020,9 @@ function buildPiArgs(input) {
1971
2020
  ...input.childAgentName ? { agent: input.childAgentName } : {}
1972
2021
  }] : []
1973
2022
  ];
1974
- if (env[SUBAGENT_PARENT_EVENT_SINK_ENV] = fanoutAuthorized ? input.parentEventSink ?? process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] ?? "" : "", env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] = fanoutAuthorized ? input.parentControlInbox ?? process.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] ?? "" : "", env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] = fanoutAuthorized ? input.parentRootRunId ?? process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] ?? input.runId ?? "" : "", env[SUBAGENT_PARENT_RUN_ID_ENV] = fanoutAuthorized ? parentRunId : "", env[SUBAGENT_PARENT_CHILD_INDEX_ENV] = fanoutAuthorized ? parentChildIndex : "", env[SUBAGENT_PARENT_DEPTH_ENV] = fanoutAuthorized ? String(parentDepth) : "", env[SUBAGENT_PARENT_PATH_ENV] = fanoutAuthorized ? encodeNestedPathEnv(parentPath) : "", env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] = fanoutAuthorized ? input.parentCapabilityToken ?? process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] ?? "" : "", env.PI_SUBAGENT_INHERIT_PROJECT_CONTEXT = input.inheritProjectContext ? "1" : "0", env.PI_SUBAGENT_INHERIT_SKILLS = input.inheritSkills ? "1" : "0", input.intercomSessionName && (env.PI_SUBAGENT_INTERCOM_SESSION_NAME = input.intercomSessionName), input.orchestratorIntercomTarget && (env[SUBAGENT_ORCHESTRATOR_TARGET_ENV] = input.orchestratorIntercomTarget), input.parentSessionId && (env[SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV] = input.parentSessionId), input.orchestratorIntercomTarget && input.parentSessionId && input.runId && input.childAgentName) {
1975
- let childIndex = input.childIndex ?? 0, channelDir = supervisorChannelDir(input.runId, input.childAgentName, childIndex);
1976
- fs9.mkdirSync(path10.join(channelDir, "requests"), { recursive: !0 }), fs9.mkdirSync(path10.join(channelDir, "replies"), { recursive: !0 }), env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV] = channelDir;
2023
+ if (env[SUBAGENT_PARENT_EVENT_SINK_ENV] = fanoutAuthorized ? input.parentEventSink ?? process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] ?? "" : "", env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] = fanoutAuthorized ? input.parentControlInbox ?? process.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] ?? "" : "", env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] = fanoutAuthorized ? input.parentRootRunId ?? process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] ?? input.runId ?? "" : "", env[SUBAGENT_PARENT_RUN_ID_ENV] = fanoutAuthorized ? parentRunId : "", env[SUBAGENT_PARENT_CHILD_INDEX_ENV] = fanoutAuthorized ? parentChildIndex : "", env[SUBAGENT_PARENT_DEPTH_ENV] = fanoutAuthorized ? String(parentDepth) : "", env[SUBAGENT_PARENT_PATH_ENV] = fanoutAuthorized ? encodeNestedPathEnv(parentPath) : "", env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] = fanoutAuthorized ? input.parentCapabilityToken ?? process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] ?? "" : "", env.PI_SUBAGENT_INHERIT_PROJECT_CONTEXT = input.inheritProjectContext ? "1" : "0", env.PI_SUBAGENT_INHERIT_SKILLS = input.inheritSkills ? "1" : "0", env.PI_SUBAGENT_INTERCOM_SESSION_NAME = communicationEnabled ? input.intercomSessionName ?? "" : "", env[SUBAGENT_ORCHESTRATOR_TARGET_ENV] = communicationEnabled ? input.orchestratorIntercomTarget ?? "" : "", env[SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV] = communicationEnabled ? input.parentSessionId ?? "" : "", env[SUBAGENT_SUPERVISOR_SESSION_ID_ENV] = communicationEnabled ? input.supervisorSessionId ?? "" : "", env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV] = "", env[SUPERVISOR_PROTOCOL_ENV] = String(2), env[CHILD_DESCRIPTION_ENV] = input.childDescription ?? input.childAgentName ?? "", communicationEnabled && input.parentSessionId && input.runId && (input.childId || input.childAgentName)) {
2024
+ let childIndex = input.childIndex ?? 0, channelAgent = input.childId ?? input.childAgentName, channelDir = supervisorChannelDir(input.runId, channelAgent, childIndex);
2025
+ fs9.mkdirSync(path10.join(channelDir, "requests"), { recursive: !0 }), fs9.mkdirSync(path10.join(channelDir, "replies"), { recursive: !0 }), fs9.mkdirSync(path10.join(channelDir, "questions"), { recursive: !0 }), env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV] = channelDir, env[SUBAGENT_CHILD_INDEX_ENV] = String(childIndex);
1977
2026
  }
1978
2027
  input.runId && (env[SUBAGENT_RUN_ID_ENV] = input.runId), (input.childId || input.childAgentName) && (env[SUBAGENT_CHILD_AGENT_ENV] = input.childId ?? input.childAgentName), input.childIndex !== void 0 && (env[SUBAGENT_CHILD_INDEX_ENV] = String(input.childIndex)), input.mcpDirectTools?.length ? env.MCP_DIRECT_TOOLS = input.mcpDirectTools.join(",") : env.MCP_DIRECT_TOOLS = "__none__", input.structuredOutput && (env[STRUCTURED_OUTPUT_CAPTURE_ENV] = input.structuredOutput.outputPath, env[STRUCTURED_OUTPUT_SCHEMA_ENV] = input.structuredOutput.schemaPath), input.steerInboxDir && (env[SUBAGENT_STEER_INBOX_ENV] = input.steerInboxDir), input.steerCapabilityPath && (env[SUBAGENT_STEER_CAPABILITY_ENV] = input.steerCapabilityPath), input.steerAckDir && (env[SUBAGENT_STEER_ACK_DIR_ENV] = input.steerAckDir);
1979
2028
  let encodedToolBudget = encodeToolBudgetEnv(input.toolBudget);
@@ -1991,11 +2040,7 @@ function cleanupTempDir(tempDir) {
1991
2040
 
1992
2041
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js
1993
2042
  function splitThinkingSuffix(model) {
1994
- let colonIdx = model.lastIndexOf(":");
1995
- return colonIdx === -1 ? { baseModel: model, thinkingSuffix: "" } : {
1996
- baseModel: model.substring(0, colonIdx),
1997
- thinkingSuffix: model.substring(colonIdx)
1998
- };
2043
+ return splitKnownThinkingSuffix(model);
1999
2044
  }
2000
2045
  var INHERIT_MODEL = "inherit";
2001
2046
  function normalizeModelSegment(segment) {
@@ -2123,14 +2168,61 @@ function resolveRequiredTierModel(tier, availableModels, preferredProvider) {
2123
2168
  throw new Error(`Model tier '${String(tier)}' resolves to '${baseModel}', but that model is unavailable or unauthenticated. Configure an available model in /settings.`);
2124
2169
  return `${resolvedBase}${thinkingSuffix}`;
2125
2170
  }
2171
+ function requestedModelString(model) {
2172
+ return typeof model == "string" && model.trim() && model.trim() !== INHERIT_MODEL ? model.trim() : void 0;
2173
+ }
2126
2174
  function requestedTier(tier) {
2127
2175
  return tier === "light" || tier === "standard" || tier === "heavy" ? tier : void 0;
2128
2176
  }
2177
+ function parseExplicitThinking(value, pathLabel = "thinking") {
2178
+ if (value !== void 0) {
2179
+ if (value === !1 || value === "off")
2180
+ return "off";
2181
+ if (typeof value != "string" || !THINKING_LEVELS.includes(value))
2182
+ throw new Error(`${pathLabel} must be one of ${THINKING_LEVELS.join(", ")}.`);
2183
+ return value;
2184
+ }
2185
+ }
2129
2186
  function captureModelSelection(input) {
2130
- let tier = requestedTier(input.tier);
2131
- if (!tier)
2132
- throw new Error('Every subagent execution requires tier: "light", "standard", or "heavy".');
2133
- return { kind: "tier", tier };
2187
+ let model = typeof input.model == "string" ? input.model.trim() : "", hasModel = !!model, tier = requestedTier(input.tier);
2188
+ if (hasModel && model === INHERIT_MODEL)
2189
+ throw new Error('model "inherit" is not supported; choose tier: "light", "standard", or "heavy", or an explicit provider/model.');
2190
+ if (hasModel && tier)
2191
+ throw new Error("Choose exactly one of tier or model; do not pass both.");
2192
+ if (hasModel)
2193
+ return { kind: "model", model };
2194
+ if (tier)
2195
+ return { kind: "tier", tier };
2196
+ throw new Error('Every executable child requires tier: "light", "standard", or "heavy", or an explicit model when the user names one.');
2197
+ }
2198
+ function resolveRequiredExplicitModel(model, availableModels, preferredProvider, thinking) {
2199
+ let requested = requestedModelString(model);
2200
+ if (!requested)
2201
+ throw new Error('Explicit model selection requires model as "provider/id".');
2202
+ if (!availableModels?.length)
2203
+ throw new Error(`Model '${requested}' cannot launch because no authenticated models are available.`);
2204
+ let { baseModel, thinkingSuffix } = splitThinkingSuffix(requested), resolvedBase = resolveBaseModelCandidate(baseModel, availableModels, preferredProvider);
2205
+ if (!resolvedBase)
2206
+ throw new Error(`Model '${baseModel}' is unavailable or unauthenticated. Choose an available provider/model or a configured tier.`);
2207
+ let fromSuffix = thinkingSuffix ? thinkingSuffix.slice(1) : void 0, fromParam = parseExplicitThinking(thinking);
2208
+ if (fromSuffix && fromParam && fromSuffix !== fromParam)
2209
+ throw new Error(`Conflicting thinking levels '${fromSuffix}' and '${fromParam}' for model '${requested}'.`);
2210
+ let level = fromParam ?? fromSuffix;
2211
+ if (!level)
2212
+ return resolvedBase;
2213
+ let info = availableModels.find((entry) => entry.fullId === resolvedBase), supported = getSupportedThinkingLevels(info);
2214
+ if (!supported.includes(level))
2215
+ throw new Error(`Thinking level '${level}' is not supported by '${resolvedBase}'. Supported: ${supported.join(", ") || "none"}.`);
2216
+ return applyThinkingSuffix(resolvedBase, level, !0) ?? resolvedBase;
2217
+ }
2218
+ function resolveExecutableChildModel(input) {
2219
+ let selection = input.modelSelection ?? captureModelSelection({ model: input.model, tier: input.tier });
2220
+ if (selection.kind === "tier") {
2221
+ if (input.thinking !== void 0)
2222
+ throw new Error("thinking is only valid with an explicit model; tier children use the configured tier thinking level.");
2223
+ return resolveRequiredTierModel(selection.tier, input.availableModels, input.preferredProvider);
2224
+ }
2225
+ return resolveRequiredExplicitModel(input.model, input.availableModels, input.preferredProvider, input.thinking);
2134
2226
  }
2135
2227
  function buildModelCandidates(primaryModel, fallbackModels, availableModels, preferredProvider, options) {
2136
2228
  let seen = /* @__PURE__ */ new Set(), candidates = [], rawCandidates = [primaryModel, ...fallbackModels ?? []];
@@ -2276,34 +2368,65 @@ function optionalCount(value) {
2276
2368
  function isModelSelection(value) {
2277
2369
  if (!value || typeof value != "object")
2278
2370
  return !1;
2279
- if (value.kind === "tier") {
2371
+ let kind = value.kind;
2372
+ if (kind === "model")
2373
+ return !0;
2374
+ if (kind === "tier") {
2280
2375
  let tier = value.tier;
2281
2376
  return tier === "light" || tier === "standard" || tier === "heavy";
2282
2377
  }
2283
2378
  return !1;
2284
2379
  }
2380
+ function parseThinking(value, pathLabel) {
2381
+ if (value !== void 0) {
2382
+ if (value === !1)
2383
+ return "off";
2384
+ if (typeof value == "string" && THINKING_LEVELS.includes(value))
2385
+ return value;
2386
+ throw new Error(`${pathLabel}.thinking must be one of ${THINKING_LEVELS.join(", ")}.`);
2387
+ }
2388
+ }
2285
2389
  function normalizeChildSpec(input, options) {
2286
2390
  let pathLabel = options.pathLabel ?? "task", description = validateChildDescription(input.description, `${pathLabel}.description`), task = typeof input.task == "string" && input.task.trim() ? input.task : options.defaultTask;
2287
2391
  if (typeof task != "string" || !task.trim())
2288
2392
  throw new Error(`${pathLabel}.task is required.`);
2289
2393
  let requested = parseChildPermissionsInput(input.permissions, `${pathLabel}.permissions`), resolved = resolveChildPermissions(options.parentMode, requested);
2290
2394
  if (!resolved.ok)
2291
- throw new Error(resolved.error || PLAN_MODE_WRITE_SPAWN_ERROR);
2292
- if (input.model !== void 0 && !isModelSelection(input.modelSelection))
2293
- throw new Error(`${pathLabel}.model is not supported for executable children; choose tier: "light", "standard", or "heavy".`);
2294
- let selectedTier = isModelSelection(input.modelSelection) ? input.modelSelection.tier : input.tier;
2295
- if (selectedTier !== "light" && selectedTier !== "standard" && selectedTier !== "heavy")
2296
- throw new Error(`${pathLabel}.tier is required and must be "light", "standard", or "heavy".`);
2297
- let tier = selectedTier, outputMode = input.outputMode === "inline" || input.outputMode === "file-only" ? input.outputMode : void 0, modelSelection = isModelSelection(input.modelSelection) ? input.modelSelection : captureModelSelection({ tier });
2395
+ throw new Error(resolved.error || READ_ONLY_WRITE_SPAWN_ERROR);
2396
+ let preservedSelection = isModelSelection(input.modelSelection) ? input.modelSelection : void 0, rawModel = optionalString(input.model);
2397
+ if (rawModel === INHERIT_MODEL)
2398
+ throw new Error(`${pathLabel}.model "inherit" is not supported; choose tier or an explicit provider/model.`);
2399
+ let modelSelection, tier, model, thinking;
2400
+ if (preservedSelection)
2401
+ if (modelSelection = preservedSelection, modelSelection.kind === "tier") {
2402
+ if (tier = modelSelection.tier, model = void 0, input.thinking !== void 0)
2403
+ throw new Error(`${pathLabel}.thinking is only valid with an explicit model selection.`);
2404
+ } else {
2405
+ if (model = rawModel ?? optionalString(modelSelection.model), !model)
2406
+ throw new Error(`${pathLabel}.model is required when modelSelection.kind is "model".`);
2407
+ modelSelection.model || (modelSelection = { kind: "model", model }), thinking = parseThinking(input.thinking, pathLabel);
2408
+ }
2409
+ else if (options.resolvedModelIsRuntime) {
2410
+ let selectedTier = input.tier === "light" || input.tier === "standard" || input.tier === "heavy" ? input.tier : void 0;
2411
+ if (!selectedTier)
2412
+ throw new Error(`${pathLabel}.tier is required to resume a child without a stored modelSelection.`);
2413
+ modelSelection = { kind: "tier", tier: selectedTier }, tier = selectedTier, model = void 0;
2414
+ } else if (modelSelection = captureModelSelection({ model: input.model, tier: input.tier }), modelSelection.kind === "tier") {
2415
+ if (tier = modelSelection.tier, model = void 0, input.thinking !== void 0)
2416
+ throw new Error(`${pathLabel}.thinking is only valid with an explicit model selection.`);
2417
+ } else
2418
+ model = rawModel, !modelSelection.model && model && (modelSelection = { kind: "model", model }), thinking = parseThinking(input.thinking, pathLabel);
2419
+ let outputMode = input.outputMode === "inline" || input.outputMode === "file-only" ? input.outputMode : void 0;
2298
2420
  return {
2299
2421
  childId: options.childId ?? allocateChildId(options.runId, options.index),
2300
2422
  task,
2301
2423
  description,
2302
2424
  requestedPermissions: resolved.requested,
2303
2425
  effectivePermissions: resolved.effective,
2304
- model: optionalString(input.model),
2426
+ model,
2305
2427
  tier,
2306
2428
  modelSelection,
2429
+ thinking,
2307
2430
  skill: optionalSkill(input.skill),
2308
2431
  cwd: optionalString(input.cwd),
2309
2432
  output: optionalOutput(input.output),
@@ -2334,9 +2457,6 @@ function formatActivityLabel(lastActivityAt, activityState, now = Date.now()) {
2334
2457
  function isCompletedStepStatus(status) {
2335
2458
  return status === "complete" || status === "completed";
2336
2459
  }
2337
- function aggregateStepStatus(steps) {
2338
- return steps.some((step) => step.status === "running") ? "running" : steps.some((step) => step.status === "failed") ? "failed" : steps.some((step) => step.status === "stopped") ? "stopped" : steps.some((step) => step.status === "paused") ? "paused" : steps.length > 0 && steps.every((step) => isCompletedStepStatus(step.status)) ? "complete" : "pending";
2339
- }
2340
2460
  function formatAgentRunningLabel(count) {
2341
2461
  return count === 1 ? "1 agent running" : `${count} agents running`;
2342
2462
  }
@@ -2420,133 +2540,32 @@ function formatNestedRunStatusLines(children, options = {}) {
2420
2540
  });
2421
2541
  }
2422
2542
 
2423
- // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js
2424
- var CONTROL_EVENT_TYPES = ["active_long_running", "needs_attention"], CONTROL_NOTIFICATION_CHANNELS = ["event", "async", "intercom"], DEFAULT_NOTIFY_ON = ["active_long_running", "needs_attention"], DEFAULT_CONTROL_CONFIG = {
2425
- enabled: !0,
2426
- needsAttentionAfterMs: 6e4,
2427
- activeNoticeAfterMs: 24e4,
2428
- failedToolAttemptsBeforeAttention: 3,
2429
- notifyOn: DEFAULT_NOTIFY_ON,
2430
- notifyChannels: CONTROL_NOTIFICATION_CHANNELS
2431
- };
2432
- function parsePositiveInt(value) {
2433
- if (typeof value == "number" && !(!Number.isFinite(value) || !Number.isInteger(value) || value < 1))
2434
- return value;
2435
- }
2436
- function parseControlList(value, allowed) {
2437
- if (!Array.isArray(value))
2438
- return;
2439
- if (value.length === 0)
2440
- return [];
2441
- let allowedSet = new Set(allowed), parsed = value.filter((entry) => typeof entry == "string" && allowedSet.has(entry));
2442
- return parsed.length > 0 ? Array.from(new Set(parsed)) : void 0;
2443
- }
2444
- function resolveControlConfig(globalConfig, override) {
2445
- let enabled = override?.enabled ?? globalConfig?.enabled ?? DEFAULT_CONTROL_CONFIG.enabled, needsAttentionAfterMs = parsePositiveInt(override?.needsAttentionAfterMs) ?? parsePositiveInt(globalConfig?.needsAttentionAfterMs) ?? DEFAULT_CONTROL_CONFIG.needsAttentionAfterMs, activeNoticeAfterMs = parsePositiveInt(override?.activeNoticeAfterMs) ?? parsePositiveInt(globalConfig?.activeNoticeAfterMs) ?? DEFAULT_CONTROL_CONFIG.activeNoticeAfterMs, activeNoticeAfterTurns = parsePositiveInt(override?.activeNoticeAfterTurns) ?? parsePositiveInt(globalConfig?.activeNoticeAfterTurns), activeNoticeAfterTokens = parsePositiveInt(override?.activeNoticeAfterTokens) ?? parsePositiveInt(globalConfig?.activeNoticeAfterTokens), failedToolAttemptsBeforeAttention = parsePositiveInt(override?.failedToolAttemptsBeforeAttention) ?? parsePositiveInt(globalConfig?.failedToolAttemptsBeforeAttention) ?? DEFAULT_CONTROL_CONFIG.failedToolAttemptsBeforeAttention, notifyOn = parseControlList(override?.notifyOn, CONTROL_EVENT_TYPES) ?? parseControlList(globalConfig?.notifyOn, CONTROL_EVENT_TYPES) ?? DEFAULT_CONTROL_CONFIG.notifyOn, notifyChannels = parseControlList(override?.notifyChannels, CONTROL_NOTIFICATION_CHANNELS) ?? parseControlList(globalConfig?.notifyChannels, CONTROL_NOTIFICATION_CHANNELS) ?? DEFAULT_CONTROL_CONFIG.notifyChannels;
2446
- return {
2447
- enabled,
2448
- needsAttentionAfterMs,
2449
- activeNoticeAfterMs,
2450
- activeNoticeAfterTurns,
2451
- activeNoticeAfterTokens,
2452
- failedToolAttemptsBeforeAttention,
2453
- notifyOn: [...notifyOn],
2454
- notifyChannels: [...notifyChannels]
2455
- };
2456
- }
2457
- function deriveActivityState(input) {
2458
- if (!input.config.enabled)
2459
- return;
2460
- let now = input.now ?? Date.now(), lastActivity = input.lastActivityAt ?? input.startedAt;
2461
- return Math.max(0, now - lastActivity) > input.config.needsAttentionAfterMs ? "needs_attention" : void 0;
2462
- }
2463
- function buildControlEvent(input) {
2464
- let ts = input.ts ?? Date.now(), type = input.type ?? (input.to === "active_long_running" ? "active_long_running" : "needs_attention"), elapsedMs = input.elapsedMs ?? (input.lastActivityAt ? Math.max(0, ts - input.lastActivityAt) : void 0), elapsedSeconds = elapsedMs !== void 0 ? Math.floor(elapsedMs / 1e3) : void 0, message = input.message ?? (type === "active_long_running" ? `${input.agent} is still active but long-running` : elapsedSeconds !== void 0 ? `${input.agent} needs attention (no observed activity for ${elapsedSeconds}s)` : `${input.agent} needs attention`);
2465
- return {
2466
- type,
2467
- ...input.from ? { from: input.from } : {},
2468
- to: input.to,
2469
- ts,
2470
- runId: input.runId,
2471
- agent: input.agent,
2472
- ...input.index !== void 0 ? { index: input.index } : {},
2473
- message,
2474
- reason: input.reason ?? (type === "active_long_running" ? "active_long_running" : "idle"),
2475
- ...input.turns !== void 0 ? { turns: input.turns } : {},
2476
- ...input.tokens !== void 0 ? { tokens: input.tokens } : {},
2477
- ...input.toolCount !== void 0 ? { toolCount: input.toolCount } : {},
2478
- ...input.currentTool ? { currentTool: input.currentTool } : {},
2479
- ...input.currentToolDurationMs !== void 0 ? { currentToolDurationMs: input.currentToolDurationMs } : {},
2480
- ...input.currentPath ? { currentPath: input.currentPath } : {},
2481
- ...elapsedMs !== void 0 ? { elapsedMs } : {},
2482
- ...input.recentFailureSummary ? { recentFailureSummary: input.recentFailureSummary } : {}
2483
- };
2484
- }
2485
- function shouldNotifyControlEvent(config, event) {
2486
- return config.enabled && config.notifyOn.includes(event.type);
2543
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js
2544
+ var LAUNCH_COMPATIBLE_ACTIONS = /* @__PURE__ */ new Set(["schedule", "append-step", "resume", "steer"]);
2545
+ function omitExecutionModeActionAlias(params) {
2546
+ let action = params.action?.toLowerCase();
2547
+ if (action === "single" && params.task !== void 0) {
2548
+ let rest = { ...params };
2549
+ return delete rest.action, rest;
2550
+ }
2551
+ if ((action === "parallel" || action === "tasks") && (params.tasks?.length ?? 0) > 0) {
2552
+ let rest = { ...params };
2553
+ return delete rest.action, rest;
2554
+ }
2555
+ return params;
2487
2556
  }
2488
- function controlNotificationKey(event, childIntercomTarget) {
2489
- return `${childIntercomTarget ?? (event.index !== void 0 ? `${event.runId}:${event.index}` : event.runId)}:${event.type}:${event.reason ?? "idle"}`;
2557
+ function hasLaunchFields(params) {
2558
+ return params.task !== void 0 || Array.isArray(params.tasks) && params.tasks.length > 0 || Array.isArray(params.chain) && params.chain.length > 0;
2490
2559
  }
2491
- function claimControlNotification(config, event, seenKeys, childIntercomTarget) {
2492
- if (!shouldNotifyControlEvent(config, event))
2493
- return !1;
2494
- let key = controlNotificationKey(event, childIntercomTarget);
2495
- return seenKeys.has(key) ? !1 : (seenKeys.add(key), !0);
2496
- }
2497
- function formatLongRunningFacts(event) {
2498
- let facts = [];
2499
- return event.elapsedMs !== void 0 && facts.push(`elapsed ${Math.floor(Math.max(0, event.elapsedMs) / 1e3)}s`), event.turns !== void 0 && facts.push(`${event.turns} turns`), event.tokens !== void 0 && facts.push(`${event.tokens} tokens`), event.toolCount !== void 0 && facts.push(`${event.toolCount} tools`), event.currentTool && facts.push(`tool ${event.currentTool}${event.currentToolDurationMs !== void 0 ? ` ${Math.floor(Math.max(0, event.currentToolDurationMs) / 1e3)}s` : ""}`), event.currentPath && facts.push(`path ${event.currentPath}`), facts.length > 0 ? facts.join(" | ") : void 0;
2500
- }
2501
- function formatControlNoticeMessage(event, childIntercomTarget) {
2502
- let runTarget = event.runId;
2503
- if (event.reason === "completion_guard")
2504
- return [
2505
- `Subagent failed: ${event.agent}`,
2506
- `Run: ${runTarget}${event.index !== void 0 ? ` step ${event.index + 1}` : ""}`,
2507
- `Signal: ${event.message}`,
2508
- "Next: read the output artifact or session from the subagent result, then retry with a more explicit implementation prompt or handle the fix directly.",
2509
- childIntercomTarget ? `Run intercom target (may be inactive): ${childIntercomTarget}` : void 0
2510
- ].filter((line) => !!line).join(`
2511
- `);
2512
- let nudgeCommand = `subagent({ action: "resume", id: "${runTarget}", ${event.index !== void 0 ? `index: ${event.index}, ` : ""}message: "What are you blocked on? Reply with the smallest next step or ask for a decision." })`;
2513
- if (event.type === "active_long_running") {
2514
- let facts = formatLongRunningFacts(event);
2515
- return [
2516
- `Subagent active but long-running: ${event.agent}`,
2517
- `Run: ${runTarget}${event.index !== void 0 ? ` step ${event.index + 1}` : ""}`,
2518
- `Signal: ${event.message}`,
2519
- facts ? `Facts: ${facts}` : void 0,
2520
- "Hint: Inspect status, then nudge if the work seems stuck. Live async nudges interrupt the child before sending the follow-up.",
2521
- `Nudge: ${nudgeCommand}`,
2522
- childIntercomTarget ? `Direct intercom target: ${childIntercomTarget}` : void 0,
2523
- `Status: subagent({ action: "status", id: "${runTarget}" })`,
2524
- `Interrupt: subagent({ action: "interrupt", id: "${runTarget}" })`
2525
- ].filter((line) => !!line).join(`
2526
- `);
2527
- }
2528
- return [
2529
- `Subagent needs attention: ${event.agent}`,
2530
- `Run: ${runTarget}${event.index !== void 0 ? ` step ${event.index + 1}` : ""}`,
2531
- `Signal: ${event.message}`,
2532
- event.recentFailureSummary ? `Recent failures: ${event.recentFailureSummary}` : void 0,
2533
- "Hint: Inspect status first unless the run is clearly blocked. Live async nudges interrupt the child before sending the follow-up.",
2534
- `Nudge: ${nudgeCommand}`,
2535
- childIntercomTarget ? `Direct intercom target: ${childIntercomTarget}` : void 0,
2536
- `Status: subagent({ action: "status", id: "${runTarget}" })`,
2537
- `Interrupt: subagent({ action: "interrupt", id: "${runTarget}" })`
2538
- ].filter((line) => !!line).join(`
2539
- `);
2560
+ function omitConflictingControlAction(params) {
2561
+ let action = params.action?.toLowerCase();
2562
+ if (!action || LAUNCH_COMPATIBLE_ACTIONS.has(action) || !hasLaunchFields(params))
2563
+ return params;
2564
+ let rest = { ...params };
2565
+ return delete rest.action, typeof rest.task == "string" && rest.task.length > 0 && (delete rest.tasks, delete rest.chain), rest;
2540
2566
  }
2541
- function formatControlIntercomMessage(event, childIntercomTarget) {
2542
- return [
2543
- event.reason === "completion_guard" ? "subagent failed" : event.type === "active_long_running" ? "subagent active but long-running" : "subagent needs attention",
2544
- "",
2545
- event.reason === "completion_guard" ? `${event.agent} failed in run ${event.runId}.` : event.type === "active_long_running" ? `${event.agent} is still active but long-running in run ${event.runId}.` : `${event.agent} needs attention in run ${event.runId}.`,
2546
- "",
2547
- formatControlNoticeMessage(event, childIntercomTarget)
2548
- ].join(`
2549
- `);
2567
+ function resolveSubagentRequestParams(params) {
2568
+ return omitConflictingControlAction(omitExecutionModeActionAlias(params));
2550
2569
  }
2551
2570
 
2552
2571
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-events.js
@@ -3808,7 +3827,7 @@ var REVIEW_ONLY_PATTERNS = [
3808
3827
  /\balways\s+(?:edit|modify|change|fix|patch|apply)\b/i,
3809
3828
  /\bapply\s+(?:the\s+)?fix(?:es)?\s+directly\b/i,
3810
3829
  /\bmake\s+(?:the\s+)?code\s+changes\b/i
3811
- ], NO_EDIT_PROHIBITION_PATTERN = /\b(?:do not|don't|must not)\s+(?:edit|modify|write(?:\s+to)?|touch|change)\b((?:(?!\b(?:but|and|then)\b)[^.;,:!?\n–—-])*)/gi, GENERIC_PROHIBITION_OBJECT = /^\s*(?:(?:any|all|the|these|those|your|our|existing|project|source|sources|repo|repository)[\s/,-]*)*(?:files?|code|codebase|sources?|anything|repo(?:sitory)?)?\s*$/i, SCOPED_NO_EDIT_CONSTRAINT_PATTERNS = [
3830
+ ], NO_EDIT_PROHIBITION_PATTERN = /\b(?:do not|don't|must not)\s+(?:implement|edit|modify|write(?:\s+to)?|touch|change)\b((?:(?!\b(?:but|and|then)\b)[^.;,:!?\n–—-])*)/gi, GENERIC_PROHIBITION_OBJECT = /^\s*(?:(?:any|all|the|these|those|your|our|existing|project|source|sources|repo|repository)[\s/,-]*)*(?:files?|code|codebase|sources?|anything|repo(?:sitory)?)?\s*$/i, SCOPED_NO_EDIT_CONSTRAINT_PATTERNS = [
3812
3831
  /\bdo not edit files?\s+outside\b/i,
3813
3832
  /\bdo not edit\s+outside\b/i,
3814
3833
  /\bdo not edit\s+unrelated files?\b/i,
@@ -3865,17 +3884,14 @@ function taskHasReadOnlyDeliverable(taskText) {
3865
3884
  function hasImplementationIntent(taskText) {
3866
3885
  return GENERAL_IMPLEMENTATION_PATTERNS.some((pattern) => pattern.test(taskText)) || WORKER_IMPLEMENTATION_PATTERNS.some((pattern) => pattern.test(taskText)) || REVIEWER_REQUIRED_EDIT_PATTERNS.some((pattern) => pattern.test(taskText));
3867
3886
  }
3868
- function isReadOnlyPermission(permissionsOrLegacyName) {
3869
- return permissionsOrLegacyName === "read-only";
3870
- }
3871
- function classifyTaskMutationIntent(permissionsOrLegacyName, task) {
3872
- if (isReadOnlyPermission(permissionsOrLegacyName))
3887
+ function classifyTaskMutationIntent(permissions, task) {
3888
+ if (permissions === "read-only")
3873
3889
  return { kind: "read-only" };
3874
3890
  let taskText = stripFrameworkInstructions(task), taskTextWithoutScopedConstraints = stripPatterns(taskText, SCOPED_NO_EDIT_CONSTRAINT_PATTERNS), prohibitions = analyzeNoEditProhibitions(taskTextWithoutScopedConstraints);
3875
3891
  return prohibitions.present ? prohibitions.blanket ? { kind: "read-only" } : hasImplementationIntent(prohibitions.strippedText) ? { kind: "implementation" } : { kind: "read-only" } : hasImplementationIntent(taskText) ? { kind: "implementation" } : RESEARCH_TASK_PATTERNS.some((pattern) => pattern.test(taskText)) && !hasImplementationIntent(taskText) ? { kind: "read-only" } : taskHasReadOnlyDeliverable(taskTextWithoutScopedConstraints) ? { kind: "read-only" } : { kind: "unknown" };
3876
3892
  }
3877
- function expectsImplementationMutation(permissionsOrLegacyName, task) {
3878
- return isReadOnlyPermission(permissionsOrLegacyName) ? !1 : classifyTaskMutationIntent(permissionsOrLegacyName, task).kind === "implementation";
3893
+ function expectsImplementationMutation(permissions, task) {
3894
+ return classifyTaskMutationIntent(permissions, task).kind === "implementation";
3879
3895
  }
3880
3896
  var MAY_MUTATE_VERB_PATTERN = /\b(?:fix|implement|update|write|edit|modify|migrate|delete|remove|refactor|commit)\b/i;
3881
3897
  function taskMayMutate(task) {
@@ -3900,7 +3916,7 @@ var LEVEL_RANK = {
3900
3916
  "diff-summary",
3901
3917
  "review-findings",
3902
3918
  "manual-notes"
3903
- ]), ACCEPTANCE_CONFIG_KEYS = /* @__PURE__ */ new Set(["level", "criteria", "evidence", "verify", "review", "stopRules", "reason"]), ACCEPTANCE_GATE_KEYS = /* @__PURE__ */ new Set(["id", "must", "evidence", "severity"]), ACCEPTANCE_VERIFY_KEYS = /* @__PURE__ */ new Set(["id", "command", "timeoutMs", "cwd", "env", "allowFailure"]), ACCEPTANCE_REVIEW_KEYS = /* @__PURE__ */ new Set(["agent", "focus", "required"]), EXPLICIT_REVIEWED_UNAVAILABLE = "cannot be requested explicitly because this run cannot supply an independent reviewer result; use checked/verified and orchestrate the reviewer separately, or omit acceptance for read-only review tasks.";
3919
+ ]), ACCEPTANCE_CONFIG_KEYS = /* @__PURE__ */ new Set(["level", "criteria", "evidence", "verify", "review", "stopRules", "reason"]), PERSISTED_ACCEPTANCE_KEYS = /* @__PURE__ */ new Set([...ACCEPTANCE_CONFIG_KEYS, "explicit", "inferredReason"]), ACCEPTANCE_GATE_KEYS = /* @__PURE__ */ new Set(["id", "must", "evidence", "severity"]), ACCEPTANCE_VERIFY_KEYS = /* @__PURE__ */ new Set(["id", "command", "timeoutMs", "cwd", "env", "allowFailure"]), ACCEPTANCE_REVIEW_KEYS = /* @__PURE__ */ new Set(["agent", "focus", "required"]), EXPLICIT_REVIEWED_UNAVAILABLE = "cannot be requested explicitly because this run cannot supply an independent reviewer result; use checked/verified and orchestrate the reviewer separately, or omit acceptance for read-only review tasks.", RESOLVED_LEVELS = /* @__PURE__ */ new Set(["none", "attested", "checked", "verified", "reviewed"]);
3904
3920
  function normalizeLevel(level) {
3905
3921
  return level ?? "auto";
3906
3922
  }
@@ -3950,18 +3966,25 @@ function normalizeAcceptanceInput(input) {
3950
3966
  function explicitAcceptanceCanDisable(explicit) {
3951
3967
  return explicit.level === "none" && typeof explicit.reason == "string" && explicit.reason.trim().length > 0;
3952
3968
  }
3953
- function validateAcceptanceInput(input, pathLabel = "acceptance") {
3969
+ function validateAcceptanceValue(input, pathLabel, mode) {
3954
3970
  let errors = [];
3955
- if (input === void 0 || input === !1)
3971
+ if (input === void 0)
3956
3972
  return errors;
3957
- if (typeof input == "string")
3958
- return VALID_LEVELS.has(input) ? input === "none" ? errors.push(`${pathLabel} level "none" requires a reason; use { level: "none", reason: "..." }.`) : input === "reviewed" && errors.push(`${pathLabel} ${EXPLICIT_REVIEWED_UNAVAILABLE}`) : errors.push(`${pathLabel} has invalid level '${input}'.`), errors;
3959
- if (!input || typeof input != "object" || Array.isArray(input))
3960
- return errors.push(`${pathLabel} must be a string level, false, or an object.`), errors;
3961
- let value = input;
3973
+ if (mode === "persisted") {
3974
+ if (!input || typeof input != "object" || Array.isArray(input))
3975
+ return errors.push(`${pathLabel} must be a resolved acceptance object.`), errors;
3976
+ } else {
3977
+ if (input === !1)
3978
+ return errors;
3979
+ if (typeof input == "string")
3980
+ return VALID_LEVELS.has(input) ? input === "none" ? errors.push(`${pathLabel} level "none" requires a reason; use { level: "none", reason: "..." }.`) : input === "reviewed" && errors.push(`${pathLabel} ${EXPLICIT_REVIEWED_UNAVAILABLE}`) : errors.push(`${pathLabel} has invalid level '${input}'.`), errors;
3981
+ if (!input || typeof input != "object" || Array.isArray(input))
3982
+ return errors.push(`${pathLabel} must be a string level, false, or an object.`), errors;
3983
+ }
3984
+ let value = input, allowedKeys = mode === "persisted" ? PERSISTED_ACCEPTANCE_KEYS : ACCEPTANCE_CONFIG_KEYS;
3962
3985
  for (let key of Object.keys(value))
3963
- ACCEPTANCE_CONFIG_KEYS.has(key) || errors.push(`${pathLabel}.${key} is not supported.`);
3964
- if (value.level !== void 0 && (typeof value.level != "string" || !VALID_LEVELS.has(value.level)) && errors.push(`${pathLabel}.level must be one of auto, none, attested, checked, verified, reviewed.`), value.level === "none" && (typeof value.reason != "string" || !value.reason.trim()) && errors.push(`${pathLabel}.reason is required when level is none.`), value.level === "reviewed" && errors.push(`${pathLabel}.level ${EXPLICIT_REVIEWED_UNAVAILABLE}`), value.reason !== void 0 && typeof value.reason != "string" && errors.push(`${pathLabel}.reason must be a string.`), value.criteria !== void 0 && !Array.isArray(value.criteria) && errors.push(`${pathLabel}.criteria must be an array.`), Array.isArray(value.criteria)) {
3986
+ allowedKeys.has(key) || errors.push(`${pathLabel}.${key} is not supported.`);
3987
+ if (mode === "persisted" ? (typeof value.level != "string" || !RESOLVED_LEVELS.has(value.level)) && errors.push(`${pathLabel}.level must be one of none, attested, checked, verified, reviewed.`) : value.level !== void 0 && (typeof value.level != "string" || !VALID_LEVELS.has(value.level)) && errors.push(`${pathLabel}.level must be one of auto, none, attested, checked, verified, reviewed.`), value.level === "none" && (typeof value.reason != "string" || !value.reason.trim()) && errors.push(`${pathLabel}.reason is required when level is none.`), mode === "launch" && value.level === "reviewed" && errors.push(`${pathLabel}.level ${EXPLICIT_REVIEWED_UNAVAILABLE}`), mode === "persisted" && (value.explicit !== void 0 && typeof value.explicit != "boolean" && errors.push(`${pathLabel}.explicit must be a boolean.`), value.inferredReason !== void 0 && (!Array.isArray(value.inferredReason) || value.inferredReason.some((item) => typeof item != "string")) && errors.push(`${pathLabel}.inferredReason must be an array of strings.`)), value.reason !== void 0 && typeof value.reason != "string" && errors.push(`${pathLabel}.reason must be a string.`), value.criteria !== void 0 && !Array.isArray(value.criteria) && errors.push(`${pathLabel}.criteria must be an array.`), Array.isArray(value.criteria)) {
3965
3988
  let criterionIds = /* @__PURE__ */ new Set();
3966
3989
  for (let [index, criterion] of value.criteria.entries()) {
3967
3990
  if (typeof criterion == "string")
@@ -4021,6 +4044,29 @@ function validateAcceptanceInput(input, pathLabel = "acceptance") {
4021
4044
  typeof item != "string" && errors.push(`${pathLabel}.stopRules[${index}] must be a string.`);
4022
4045
  return errors;
4023
4046
  }
4047
+ function validateAcceptanceInput(input, pathLabel = "acceptance") {
4048
+ return validateAcceptanceValue(input, pathLabel, "launch");
4049
+ }
4050
+ function validatePersistedAcceptance(input, pathLabel = "acceptance") {
4051
+ return validateAcceptanceValue(input, pathLabel, "persisted");
4052
+ }
4053
+ function restorePersistedAcceptance(input, pathLabel = "acceptance") {
4054
+ let errors = validatePersistedAcceptance(input, pathLabel);
4055
+ if (errors.length > 0)
4056
+ throw new Error(errors.join(" "));
4057
+ let value = input, evidence = Array.isArray(value.evidence) ? unique(value.evidence.filter((item) => VALID_EVIDENCE.has(item))) : [];
4058
+ return {
4059
+ level: value.level,
4060
+ explicit: value.explicit === !0,
4061
+ inferredReason: Array.isArray(value.inferredReason) ? value.inferredReason.filter((item) => typeof item == "string") : [],
4062
+ criteria: normalizeCriteria(value.criteria, evidence),
4063
+ evidence,
4064
+ verify: Array.isArray(value.verify) ? value.verify : [],
4065
+ review: value.review,
4066
+ stopRules: Array.isArray(value.stopRules) ? value.stopRules.filter((item) => typeof item == "string") : [],
4067
+ ...typeof value.reason == "string" ? { reason: value.reason } : {}
4068
+ };
4069
+ }
4024
4070
  function validateExecutionAcceptance(input) {
4025
4071
  let errors = validateAcceptanceInput(input.acceptance, "acceptance");
4026
4072
  for (let [index, task] of (input.tasks ?? []).entries())
@@ -4042,9 +4088,11 @@ function normalizeCriteria(criteria, evidence) {
4042
4088
  }
4043
4089
  function resolveEffectiveAcceptance(input) {
4044
4090
  let explicit = normalizeAcceptanceInput(input.explicit), inferred = inferLevel(input), explicitLevel = normalizeLevel(explicit.level), level = explicitAcceptanceCanDisable(explicit) ? "none" : explicitLevel === "auto" ? inferred.level : LEVEL_RANK[explicitLevel] >= LEVEL_RANK[inferred.level] ? explicitLevel : inferred.level, evidence = unique([...level === inferred.level ? inferred.evidence : requiredEvidenceForLevel(level), ...explicit.evidence ?? []]), criteria = normalizeCriteria(explicit.criteria?.length ? explicit.criteria : inferred.criteria, evidence), review = explicit.review !== void 0 ? explicit.review : inferred.review;
4045
- return level === "reviewed" && input.explicit !== void 0 && explicitLevel !== "reviewed" && explicit.review === void 0 && review && review !== !1 && (review = { ...review, required: !1 }), {
4091
+ level === "reviewed" && input.explicit !== void 0 && explicitLevel !== "reviewed" && explicit.review === void 0 && review && review !== !1 && (review = { ...review, required: !1 });
4092
+ let parentRequestedLevel = input.explicit === void 0 || explicitLevel === "auto" ? void 0 : explicitLevel;
4093
+ return {
4046
4094
  level,
4047
- explicit: input.explicit !== void 0,
4095
+ explicit: parentRequestedLevel === level,
4048
4096
  inferredReason: inferred.reasons,
4049
4097
  criteria,
4050
4098
  evidence,
@@ -4607,6 +4655,17 @@ function acceptanceFailureMessage(ledger) {
4607
4655
  return failedVerify ? `Acceptance verification '${failedVerify.id}' ${failedVerify.status}.` : ledger.reviewResult?.status === "needs-parent-decision" ? "Acceptance review required but no automatic reviewer result is available." : ledger.reviewResult?.status === "blockers" ? "Acceptance review found blockers." : "Acceptance rejected.";
4608
4656
  }
4609
4657
 
4658
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js
4659
+ function normalizeAsyncLaunchConfig(config) {
4660
+ return { ...config, asyncByDefault: !0, forceTopLevelAsync: !1 };
4661
+ }
4662
+ function subagentLaunchRunsAsync(params) {
4663
+ return !(params.foregroundOnly === !0 || params.clarify === !0 || params.async === !1);
4664
+ }
4665
+ function isAsyncSubagentExecution(params) {
4666
+ return params.action || !params.task && !params.tasks?.length && !params.chain?.length ? !1 : subagentLaunchRunsAsync(params);
4667
+ }
4668
+
4610
4669
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/turn-budget.js
4611
4670
  function resolveTurnBudgetConfig(raw, label = "turnBudget") {
4612
4671
  if (raw === void 0)
@@ -4667,132 +4726,36 @@ function shouldAbortForTurnBudget(budget, turnCount, terminalAssistantStop) {
4667
4726
  return turnCount < hardLimit ? !1 : turnCount > hardLimit ? !0 : !terminalAssistantStop;
4668
4727
  }
4669
4728
 
4670
- // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js
4671
- import * as fs14 from "node:fs";
4672
- import * as os7 from "node:os";
4673
- import * as path15 from "node:path";
4674
- var NATIVE_INTERCOM_EXTENSION_DIR = "native:pi-subagents-supervisor-channel";
4675
- function defaultAgentDir() {
4676
- return getAgentDir();
4677
- }
4678
- function defaultSubagentConfigDir(agentDir = defaultAgentDir()) {
4679
- return path15.join(agentDir, "extensions", "subagent");
4680
- }
4681
- var DEFAULT_INTERCOM_TARGET_PREFIX = "subagent-chat", INTERCOM_BRIDGE_MARKER = "Intercom orchestration channel:", DEFAULT_INTERCOM_BRIDGE_TEMPLATE = `The inherited thread is reference-only. Do not continue that conversation or send questions, status updates, or completion handoffs to the supervisor in normal assistant text.
4682
-
4683
- Use contact_supervisor first. It resolves the supervisor session "{orchestratorTarget}" and run metadata automatically.
4684
- - Need a decision, blocked, approval, or product/API/scope ambiguity: contact_supervisor({ reason: "need_decision", message: "<question>" })
4685
- - Need structured supervisor input rather than a freeform reply: contact_supervisor({ reason: "interview_request", message: "<what input is needed>", interview: { title: "...", questions: [] } })
4686
- - After contact_supervisor with reason "need_decision" or "interview_request", stay alive and continue only after the reply arrives. Do not finish your final response with a choose-one question.
4687
- - Do not ask for clarification when the only conflict is review-only/no-edit versus progress-writing or artifact-writing instructions. If an output path is configured but no write-capable tool is available, return the complete artifact in your final response; the runtime will persist it. Do not contact the supervisor merely because you cannot write that output path directly.
4688
- - Meaningful progress or unexpected discoveries that change the plan: contact_supervisor({ reason: "progress_update", message: "UPDATE: <summary>" })
4689
- - Generic intercom is lower-level plumbing/fallback only: intercom({ action: "ask", to: "{orchestratorTarget}", message: "<question>" })
4690
-
4691
- Do not use contact_supervisor or intercom for routine completion handoffs. If no coordination is needed, return a focused task result.`;
4692
- function resolveIntercomSessionTarget(sessionName, sessionId) {
4693
- let trimmedName = sessionName?.trim();
4694
- if (trimmedName)
4695
- return trimmedName;
4696
- let normalizedSessionId = sessionId.startsWith("session-") ? sessionId.slice(8) : sessionId;
4697
- return `${DEFAULT_INTERCOM_TARGET_PREFIX}-${normalizedSessionId.slice(0, 8)}`;
4698
- }
4699
- function sanitizeIntercomTargetPart(value) {
4700
- return value.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "agent";
4701
- }
4702
- function resolveSubagentIntercomTarget(runId, agent, index) {
4703
- let stepSuffix = index !== void 0 ? `-${index + 1}` : "";
4704
- return `subagent-${sanitizeIntercomTargetPart(agent)}-${sanitizeIntercomTargetPart(runId)}${stepSuffix}`;
4705
- }
4706
- function resolveIntercomBridgeMode(value) {
4707
- return value === "off" || value === "always" || value === "fork-only" ? value : "always";
4708
- }
4709
- function resolveIntercomBridgeConfig(value) {
4710
- return !value || typeof value != "object" || Array.isArray(value) ? { mode: "always", instructionFile: "" } : {
4711
- mode: resolveIntercomBridgeMode(value.mode),
4712
- instructionFile: typeof value.instructionFile == "string" ? value.instructionFile : ""
4713
- };
4714
- }
4715
- function expandTilde(filePath) {
4716
- return filePath.startsWith("~/") ? path15.join(os7.homedir(), filePath.slice(2)) : filePath;
4717
- }
4718
- function resolveInstructionTemplate(instructionFile, settingsDir) {
4719
- if (!instructionFile)
4720
- return DEFAULT_INTERCOM_BRIDGE_TEMPLATE;
4721
- let expandedPath = expandTilde(instructionFile), resolvedPath = path15.isAbsolute(expandedPath) ? expandedPath : path15.resolve(settingsDir, expandedPath);
4722
- try {
4723
- return fs14.readFileSync(resolvedPath, "utf-8");
4724
- } catch (error) {
4725
- return console.warn(`Failed to read intercom bridge instructionFile at '${resolvedPath}'. Using default instructions.`, error), DEFAULT_INTERCOM_BRIDGE_TEMPLATE;
4726
- }
4727
- }
4728
- function buildIntercomBridgeInstruction(orchestratorTarget, template) {
4729
- let instruction = template.replaceAll("{orchestratorTarget}", orchestratorTarget).trim();
4730
- return instruction.startsWith(INTERCOM_BRIDGE_MARKER) ? instruction : `${INTERCOM_BRIDGE_MARKER}
4731
- ${instruction}`;
4732
- }
4733
- function inactiveReason(mode, context, orchestratorTarget) {
4734
- if (mode === "off")
4735
- return "bridge mode is off";
4736
- if (mode === "fork-only" && context !== "fork")
4737
- return "bridge mode is fork-only and context is not fork";
4738
- if (!orchestratorTarget)
4739
- return "orchestrator target is not available";
4740
- }
4741
- function diagnoseIntercomBridge(input) {
4742
- let mode = resolveIntercomBridgeConfig(input.config).mode, orchestratorTarget = input.orchestratorTarget?.trim(), wantsIntercom = mode !== "off" && !(mode === "fork-only" && input.context !== "fork"), reason = inactiveReason(mode, input.context, orchestratorTarget);
4743
- return {
4744
- active: reason === void 0,
4745
- mode,
4746
- wantsIntercom,
4747
- supervisorChannelAvailable: !0,
4748
- extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
4749
- ...orchestratorTarget ? { orchestratorTarget } : {},
4750
- ...reason ? { reason } : {}
4751
- };
4752
- }
4753
- function resolveIntercomBridge(input) {
4754
- let config = resolveIntercomBridgeConfig(input.config), mode = config.mode, orchestratorTarget = input.orchestratorTarget?.trim(), agentDir = path15.resolve(input.agentDir ?? defaultAgentDir()), settingsDir = path15.resolve(input.settingsDir ?? defaultSubagentConfigDir(agentDir)), defaultInstruction = buildIntercomBridgeInstruction(orchestratorTarget || "{orchestratorTarget}", DEFAULT_INTERCOM_BRIDGE_TEMPLATE);
4755
- return inactiveReason(mode, input.context, orchestratorTarget) || !orchestratorTarget ? { active: !1, mode, extensionDir: NATIVE_INTERCOM_EXTENSION_DIR, instruction: defaultInstruction } : {
4756
- active: !0,
4757
- mode,
4758
- orchestratorTarget,
4759
- extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
4760
- instruction: buildIntercomBridgeInstruction(orchestratorTarget, resolveInstructionTemplate(config.instructionFile, settingsDir))
4761
- };
4762
- }
4763
- function applyIntercomBridgeToAgent(agent, bridge) {
4764
- if (!bridge.active || !bridge.orchestratorTarget)
4765
- return agent;
4766
- let bridgeTools = ["intercom", "contact_supervisor"], tools = agent.tools ? [...agent.tools, ...bridgeTools.filter((tool) => !agent.tools?.includes(tool))] : agent.tools, instruction = bridge.instruction, trimmedPrompt = agent.systemPrompt?.trim() || "", systemPrompt = trimmedPrompt.includes(INTERCOM_BRIDGE_MARKER) ? trimmedPrompt : trimmedPrompt ? `${trimmedPrompt}
4767
-
4768
- ${instruction}` : instruction;
4769
- return tools === agent.tools && systemPrompt === agent.systemPrompt ? agent : {
4770
- ...agent,
4771
- tools,
4772
- systemPrompt
4773
- };
4774
- }
4775
-
4776
4729
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/control-channel.js
4777
4730
  import { randomUUID as randomUUID3 } from "node:crypto";
4778
- import * as fs15 from "node:fs";
4779
- import * as path16 from "node:path";
4731
+ import * as fs14 from "node:fs";
4732
+ import * as path15 from "node:path";
4780
4733
  var INTERRUPT_SIGNAL = process.platform === "win32" ? "SIGBREAK" : "SIGUSR2", STEER_REQUESTS_DIR = "steer-requests";
4781
- var STEER_ACKS_DIR = "steer-acks", STEER_INBOX_CLOSED_FILE = "steer-inbox-closed.json", MAX_STEER_MESSAGE_BYTES = 128 * 1024, MAX_STEER_REQUEST_ID_LENGTH = 256;
4734
+ var STEER_CAPABILITIES_DIR = "steer-capabilities", STEER_ACKS_DIR = "steer-acks", STEER_INBOX_CLOSED_FILE = "steer-inbox-closed.json", MAX_STEER_MESSAGE_BYTES = 128 * 1024, MAX_STEER_REQUEST_ID_LENGTH = 256;
4782
4735
  function controlInboxDir(asyncDir) {
4783
- return path16.join(asyncDir, "control");
4736
+ return path15.join(asyncDir, "control");
4784
4737
  }
4785
4738
  function interruptRequestPath(asyncDir) {
4786
- return path16.join(controlInboxDir(asyncDir), "interrupt.json");
4739
+ return path15.join(controlInboxDir(asyncDir), "interrupt.json");
4787
4740
  }
4788
4741
  function stopRequestPath(asyncDir) {
4789
- return path16.join(controlInboxDir(asyncDir), "stop.json");
4742
+ return path15.join(controlInboxDir(asyncDir), "stop.json");
4790
4743
  }
4791
4744
  function steerRequestsDir(asyncDir) {
4792
- return path16.join(controlInboxDir(asyncDir), STEER_REQUESTS_DIR);
4745
+ return path15.join(controlInboxDir(asyncDir), STEER_REQUESTS_DIR);
4793
4746
  }
4794
4747
  function steerInboxClosedPath(asyncDir) {
4795
- return path16.join(controlInboxDir(asyncDir), STEER_INBOX_CLOSED_FILE);
4748
+ return path15.join(controlInboxDir(asyncDir), STEER_INBOX_CLOSED_FILE);
4749
+ }
4750
+ function steerCapabilitiesDir(asyncDir) {
4751
+ return path15.join(controlInboxDir(asyncDir), STEER_CAPABILITIES_DIR);
4752
+ }
4753
+ function steerCapabilityPath(asyncDir, index) {
4754
+ return assertChildIndex(index), path15.join(steerCapabilitiesDir(asyncDir), `${index}.json`);
4755
+ }
4756
+ function assertChildIndex(index) {
4757
+ if (!Number.isInteger(index) || index < 0 || index > 1e6)
4758
+ throw new Error("steer child index must be a non-negative integer.");
4796
4759
  }
4797
4760
  function steerRequestFileName(request) {
4798
4761
  return `${String(request.ts).padStart(13, "0")}-${Buffer.from(request.id).toString("base64url")}.json`;
@@ -4803,7 +4766,7 @@ function validSteerRequest(request) {
4803
4766
  function writeSteerRequestToDir(dir, request) {
4804
4767
  if (!validSteerRequest(request))
4805
4768
  throw new Error("steer request is malformed or exceeds transport limits.");
4806
- let requestPath = path16.join(dir, steerRequestFileName(request));
4769
+ let requestPath = path15.join(dir, steerRequestFileName(request));
4807
4770
  return writeAtomicJson(requestPath, request), requestPath;
4808
4771
  }
4809
4772
  function requestAsyncInterrupt(asyncDir, payload = {}, deps = {}) {
@@ -4825,7 +4788,7 @@ function requestAsyncSteer(asyncDir, payload, deps = {}) {
4825
4788
  if (payload.targetIndexes !== void 0 && (!Array.isArray(payload.targetIndexes) || payload.targetIndex !== void 0 || payload.targetIndexes.length === 0 || payload.targetIndexes.length > 1e3 || payload.targetIndexes.some((index) => !Number.isInteger(index) || index < 0 || index > 1e6) || new Set(payload.targetIndexes).size !== payload.targetIndexes.length))
4826
4789
  throw new Error("steer targetIndexes must contain 1-1000 unique non-negative integers and cannot be combined with targetIndex.");
4827
4790
  let closedPath = steerInboxClosedPath(asyncDir);
4828
- if (fs15.existsSync(closedPath))
4791
+ if (fs14.existsSync(closedPath))
4829
4792
  throw new Error("Async run no longer accepts steering requests.");
4830
4793
  let request = {
4831
4794
  type: "steer",
@@ -4836,10 +4799,17 @@ function requestAsyncSteer(asyncDir, payload, deps = {}) {
4836
4799
  ...payload.targetIndexes !== void 0 ? { targetIndexes: [...payload.targetIndexes] } : {},
4837
4800
  ...payload.source ? { source: payload.source } : {}
4838
4801
  }, requestPath = writeSteerRequestToDir(steerRequestsDir(asyncDir), request);
4839
- if (fs15.existsSync(closedPath))
4840
- throw fs15.rmSync(requestPath, { force: !0 }), new Error("Async run stopped accepting steering before the request was committed.");
4802
+ if (fs14.existsSync(closedPath))
4803
+ throw fs14.rmSync(requestPath, { force: !0 }), new Error("Async run stopped accepting steering before the request was committed.");
4841
4804
  return requestPath;
4842
4805
  }
4806
+ function parseSteerCapability(raw) {
4807
+ if (!raw || typeof raw != "object" || Array.isArray(raw))
4808
+ return;
4809
+ let input = raw;
4810
+ if (!(input.type !== "steer-capability" || input.protocolVersion !== 1) && !(!Number.isInteger(input.index) || input.index < 0 || input.index > 1e6) && !(!Number.isInteger(input.pid) || input.pid <= 0 || !Number.isFinite(input.readyAt) || input.readyAt <= 0 || typeof input.supported != "boolean"))
4811
+ return { type: "steer-capability", protocolVersion: 1, index: input.index, pid: input.pid, readyAt: input.readyAt, supported: input.supported };
4812
+ }
4843
4813
  function parseSteerAck(raw) {
4844
4814
  if (!raw || typeof raw != "object" || Array.isArray(raw))
4845
4815
  return;
@@ -4847,8 +4817,15 @@ function parseSteerAck(raw) {
4847
4817
  if (!(input.type !== "steer-ack" || input.protocolVersion !== 1 || typeof input.requestId != "string" || !/^[^\s]+$/.test(input.requestId) || input.requestId.length > 256) && !(!Number.isInteger(input.index) || input.index < 0 || input.index > 1e6 || !Number.isFinite(input.ts) || input.ts <= 0) && !(input.state !== "delivered" && input.state !== "failed") && !(typeof input.message != "string" || !input.message.trim() || input.message.length > 1e3))
4848
4818
  return { type: "steer-ack", protocolVersion: 1, requestId: input.requestId, index: input.index, ts: input.ts, state: input.state, message: input.message.trim() };
4849
4819
  }
4850
- function consumeSteerAcks(asyncDir, fsImpl = fs15) {
4851
- let root = path16.join(controlInboxDir(asyncDir), STEER_ACKS_DIR);
4820
+ function readSteerCapability(asyncDir, index) {
4821
+ try {
4822
+ return parseSteerCapability(JSON.parse(fs14.readFileSync(steerCapabilityPath(asyncDir, index), "utf-8")));
4823
+ } catch {
4824
+ return;
4825
+ }
4826
+ }
4827
+ function consumeSteerAcks(asyncDir, fsImpl = fs14) {
4828
+ let root = path15.join(controlInboxDir(asyncDir), STEER_ACKS_DIR);
4852
4829
  if (!fsImpl.existsSync(root))
4853
4830
  return [];
4854
4831
  let acks = [], indexNames;
@@ -4858,14 +4835,14 @@ function consumeSteerAcks(asyncDir, fsImpl = fs15) {
4858
4835
  return [];
4859
4836
  }
4860
4837
  for (let indexName of indexNames) {
4861
- let dir = path16.join(root, indexName), entries;
4838
+ let dir = path15.join(root, indexName), entries;
4862
4839
  try {
4863
4840
  entries = fsImpl.readdirSync(dir).filter((name) => name.endsWith(".json")).sort();
4864
4841
  } catch {
4865
4842
  continue;
4866
4843
  }
4867
4844
  for (let entry of entries) {
4868
- let target = path16.join(dir, entry), ack;
4845
+ let target = path15.join(dir, entry), ack;
4869
4846
  try {
4870
4847
  ack = parseSteerAck(JSON.parse(fsImpl.readFileSync(target, "utf-8")));
4871
4848
  } catch {
@@ -4890,7 +4867,7 @@ function deliverInterruptRequest(input) {
4890
4867
  if (error?.code === "ENOSYS")
4891
4868
  return;
4892
4869
  try {
4893
- fs15.rmSync(requestPath, { force: !0 });
4870
+ fs14.rmSync(requestPath, { force: !0 });
4894
4871
  } catch {
4895
4872
  }
4896
4873
  throw error;
@@ -4900,6 +4877,106 @@ function deliverStopRequest(input) {
4900
4877
  requestAsyncStop(input.asyncDir, input.source ? { source: input.source } : {}, { now: input.now });
4901
4878
  }
4902
4879
 
4880
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js
4881
+ import * as fs15 from "node:fs";
4882
+ import * as os7 from "node:os";
4883
+ import * as path16 from "node:path";
4884
+ var NATIVE_INTERCOM_EXTENSION_DIR = "native:pi-subagents-supervisor-channel";
4885
+ function defaultAgentDir() {
4886
+ return getAgentDir();
4887
+ }
4888
+ function defaultSubagentConfigDir(agentDir = defaultAgentDir()) {
4889
+ return path16.join(agentDir, "extensions", "subagent");
4890
+ }
4891
+ var DEFAULT_INTERCOM_TARGET_PREFIX = "subagent-chat", INTERCOM_BRIDGE_MARKER = "Intercom orchestration channel:", DEFAULT_INTERCOM_BRIDGE_TEMPLATE = `You own reversible implementation decisions within your assigned scope. Use contact_supervisor for coordination with "{orchestratorTarget}"; its tool description defines delivery and reply behavior.
4892
+ Consolidate dependency findings into one handoff when another task needs them before completion. Escalate permission, safety, scope changes, or a blocked decision with evidence and your recommended choice. Continue independent work before opening a blocking request.
4893
+ Native intercom reaches only the supervisor, not siblings. Use the supplied contracts and artifacts instead of discovering sibling sessions.
4894
+ Return one self-contained final result; the runtime delivers it. If you cannot write a configured output artifact with your available tools, return its complete contents for the runtime to persist.`;
4895
+ function resolveIntercomSessionTarget(sessionName, sessionId) {
4896
+ let trimmedName = sessionName?.trim();
4897
+ if (trimmedName)
4898
+ return trimmedName;
4899
+ let normalizedSessionId = sessionId.startsWith("session-") ? sessionId.slice(8) : sessionId;
4900
+ return `${DEFAULT_INTERCOM_TARGET_PREFIX}-${normalizedSessionId.slice(0, 8)}`;
4901
+ }
4902
+ function sanitizeIntercomTargetPart(value) {
4903
+ return value.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "agent";
4904
+ }
4905
+ function resolveSubagentIntercomTarget(runId, agent, index) {
4906
+ let stepSuffix = index !== void 0 ? `-${index + 1}` : "";
4907
+ return `subagent-${sanitizeIntercomTargetPart(agent)}-${sanitizeIntercomTargetPart(runId)}${stepSuffix}`;
4908
+ }
4909
+ function resolveIntercomBridgeMode(value) {
4910
+ return value === "off" || value === "always" || value === "fork-only" ? value : "always";
4911
+ }
4912
+ function resolveIntercomBridgeConfig(value) {
4913
+ return !value || typeof value != "object" || Array.isArray(value) ? { mode: "always", instructionFile: "" } : {
4914
+ mode: resolveIntercomBridgeMode(value.mode),
4915
+ instructionFile: typeof value.instructionFile == "string" ? value.instructionFile : ""
4916
+ };
4917
+ }
4918
+ function expandTilde(filePath) {
4919
+ return filePath.startsWith("~/") ? path16.join(os7.homedir(), filePath.slice(2)) : filePath;
4920
+ }
4921
+ function resolveInstructionTemplate(instructionFile, settingsDir) {
4922
+ if (!instructionFile)
4923
+ return DEFAULT_INTERCOM_BRIDGE_TEMPLATE;
4924
+ let expandedPath = expandTilde(instructionFile), resolvedPath = path16.isAbsolute(expandedPath) ? expandedPath : path16.resolve(settingsDir, expandedPath);
4925
+ try {
4926
+ return fs15.readFileSync(resolvedPath, "utf-8");
4927
+ } catch (error) {
4928
+ return console.warn(`Failed to read intercom bridge instructionFile at '${resolvedPath}'. Using default instructions.`, error), DEFAULT_INTERCOM_BRIDGE_TEMPLATE;
4929
+ }
4930
+ }
4931
+ function buildIntercomBridgeInstruction(orchestratorTarget, template) {
4932
+ let instruction = template.replaceAll("{orchestratorTarget}", orchestratorTarget).trim();
4933
+ return instruction.startsWith(INTERCOM_BRIDGE_MARKER) ? instruction : `${INTERCOM_BRIDGE_MARKER}
4934
+ ${instruction}`;
4935
+ }
4936
+ function inactiveReason(mode, context, orchestratorTarget) {
4937
+ if (mode === "off")
4938
+ return "bridge mode is off";
4939
+ if (mode === "fork-only" && context !== "fork")
4940
+ return "bridge mode is fork-only and context is not fork";
4941
+ if (!orchestratorTarget)
4942
+ return "orchestrator target is not available";
4943
+ }
4944
+ function diagnoseIntercomBridge(input) {
4945
+ let config = resolveIntercomBridgeConfig(input.config), mode = subagentCommunicationEnabled(input.cwd ?? process.cwd(), input.agentDir ?? defaultAgentDir()) ? config.mode : "off", orchestratorTarget = input.orchestratorTarget?.trim(), wantsIntercom = mode !== "off" && !(mode === "fork-only" && input.context !== "fork"), reason = inactiveReason(mode, input.context, orchestratorTarget);
4946
+ return {
4947
+ active: reason === void 0,
4948
+ mode,
4949
+ wantsIntercom,
4950
+ supervisorChannelAvailable: !0,
4951
+ extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
4952
+ ...orchestratorTarget ? { orchestratorTarget } : {},
4953
+ ...reason ? { reason } : {}
4954
+ };
4955
+ }
4956
+ function resolveIntercomBridge(input) {
4957
+ let config = resolveIntercomBridgeConfig(input.config), communicationEnabled = subagentCommunicationEnabled(input.cwd ?? process.cwd(), input.agentDir ?? defaultAgentDir()), mode = communicationEnabled ? config.mode : "off", orchestratorTarget = input.orchestratorTarget?.trim(), agentDir = path16.resolve(input.agentDir ?? defaultAgentDir()), settingsDir = path16.resolve(input.settingsDir ?? defaultSubagentConfigDir(agentDir)), defaultInstruction = buildIntercomBridgeInstruction(orchestratorTarget || "{orchestratorTarget}", DEFAULT_INTERCOM_BRIDGE_TEMPLATE);
4958
+ return inactiveReason(mode, input.context, orchestratorTarget) || !orchestratorTarget ? { active: !1, communicationEnabled, mode, extensionDir: NATIVE_INTERCOM_EXTENSION_DIR, instruction: defaultInstruction } : {
4959
+ active: !0,
4960
+ communicationEnabled,
4961
+ mode,
4962
+ orchestratorTarget,
4963
+ extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
4964
+ instruction: buildIntercomBridgeInstruction(orchestratorTarget, resolveInstructionTemplate(config.instructionFile, settingsDir))
4965
+ };
4966
+ }
4967
+ function applyIntercomBridgeToAgent(agent, bridge) {
4968
+ if (!bridge.active || !bridge.orchestratorTarget)
4969
+ return agent;
4970
+ let bridgeTools = ["intercom", "contact_supervisor"], tools = agent.tools ? [...agent.tools, ...bridgeTools.filter((tool) => !agent.tools?.includes(tool))] : agent.tools, instruction = bridge.instruction, trimmedPrompt = agent.systemPrompt?.trim() || "", systemPrompt = trimmedPrompt.includes(INTERCOM_BRIDGE_MARKER) ? trimmedPrompt : trimmedPrompt ? `${trimmedPrompt}
4971
+
4972
+ ${instruction}` : instruction;
4973
+ return tools === agent.tools && systemPrompt === agent.systemPrompt ? agent : {
4974
+ ...agent,
4975
+ tools,
4976
+ systemPrompt
4977
+ };
4978
+ }
4979
+
4903
4980
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js
4904
4981
  import * as fs16 from "node:fs";
4905
4982
  import * as path17 from "node:path";
@@ -4930,6 +5007,15 @@ function interruptLiveAsyncResumeTarget(input) {
4930
5007
  function getErrorMessage3(error) {
4931
5008
  return error instanceof Error ? error.message : String(error);
4932
5009
  }
5010
+ var TURN_BUDGET_RUNTIME_KEYS = /* @__PURE__ */ new Set(["outcome", "turnCount", "wrapUpRequestedAtTurn", "exceededAtTurn"]);
5011
+ function persistedTurnBudgetConfig(raw) {
5012
+ if (!raw || typeof raw != "object" || Array.isArray(raw))
5013
+ return raw;
5014
+ let config = {};
5015
+ for (let [key, value] of Object.entries(raw))
5016
+ TURN_BUDGET_RUNTIME_KEYS.has(key) || (config[key] = value);
5017
+ return config;
5018
+ }
4933
5019
  function ensureObject(value, source) {
4934
5020
  if (!value || typeof value != "object" || Array.isArray(value))
4935
5021
  throw new Error(`Async result file '${source}' must contain a JSON object.`);
@@ -5153,7 +5239,7 @@ function readAsyncRecoveryDescriptor(asyncDir) {
5153
5239
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': ${field} must be a non-empty string.`);
5154
5240
  if (parsed.permissions !== "full" && parsed.permissions !== "read-only")
5155
5241
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': permissions must be full or read-only.`);
5156
- if (parsed.tier !== "light" && parsed.tier !== "standard" && parsed.tier !== "heavy")
5242
+ if (parsed.tier !== void 0 && parsed.tier !== "light" && parsed.tier !== "standard" && parsed.tier !== "heavy")
5157
5243
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': tier must be light, standard, or heavy.`);
5158
5244
  if (validateChildDescription(parsed.description, `Async recovery descriptor '${descriptorPath}' description`), parsed.outputMode !== "inline" && parsed.outputMode !== "file-only")
5159
5245
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': outputMode is invalid.`);
@@ -5174,17 +5260,23 @@ function readAsyncRecoveryDescriptor(asyncDir) {
5174
5260
  let selection = parsed.modelSelection;
5175
5261
  if (!selection || typeof selection != "object")
5176
5262
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection must be an object.`);
5177
- if (selection.kind !== "tier")
5263
+ if (selection.kind === "tier") {
5264
+ if (selection.tier !== "light" && selection.tier !== "standard" && selection.tier !== "heavy")
5265
+ throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection.tier is invalid.`);
5266
+ } else if (selection.kind === "model") {
5267
+ if (selection.model !== void 0 && (typeof selection.model != "string" || !selection.model.trim()))
5268
+ throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection.model must be a non-empty string.`);
5269
+ } else
5178
5270
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection.kind is invalid.`);
5179
- if (selection.kind === "tier" && selection.tier !== "light" && selection.tier !== "standard" && selection.tier !== "heavy")
5180
- throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection.tier is invalid.`);
5181
- }
5271
+ } else if (parsed.tier === void 0)
5272
+ throw new Error(`Invalid async recovery descriptor '${descriptorPath}': tier or modelSelection is required.`);
5182
5273
  if (parsed.absoluteDeadlineAt !== void 0 && (!Number.isFinite(parsed.absoluteDeadlineAt) || parsed.absoluteDeadlineAt <= 0))
5183
5274
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': absoluteDeadlineAt must be a positive timestamp.`);
5184
5275
  if (parsed.initialTurnBudget !== void 0) {
5185
- let result = resolveTurnBudgetConfig(parsed.initialTurnBudget, "recoveryDescriptor.initialTurnBudget");
5276
+ let result = resolveTurnBudgetConfig(persistedTurnBudgetConfig(parsed.initialTurnBudget), "recoveryDescriptor.initialTurnBudget");
5186
5277
  if (result.error)
5187
5278
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': ${result.error}`);
5279
+ result.turnBudget && (parsed.initialTurnBudget = result.turnBudget);
5188
5280
  }
5189
5281
  if (parsed.initialToolBudget !== void 0) {
5190
5282
  let result = validateToolBudgetConfig(parsed.initialToolBudget, "recoveryDescriptor.initialToolBudget");
@@ -5230,7 +5322,7 @@ function readAsyncRecoveryDescriptor(asyncDir) {
5230
5322
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': controlConfig.notifyChannels is invalid.`);
5231
5323
  }
5232
5324
  if (parsed.acceptance !== void 0) {
5233
- let errors = validateAcceptanceInput(parsed.acceptance, "recoveryDescriptor.acceptance");
5325
+ let errors = validatePersistedAcceptance(parsed.acceptance, "recoveryDescriptor.acceptance");
5234
5326
  if (errors.length)
5235
5327
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': ${errors.join(" ")}`);
5236
5328
  }
@@ -5283,6 +5375,7 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
5283
5375
  sessionFile: selectedStep.sessionFile ?? status?.sessionFile ?? result?.sessionFile,
5284
5376
  model: selectedStep.model,
5285
5377
  thinking: selectedStep.thinking,
5378
+ modelSelection: selectedStep.modelSelection,
5286
5379
  ...recoveryDescriptor ? { recoveryDescriptor } : {}
5287
5380
  };
5288
5381
  if (selectedStep?.status === "pending")
@@ -5308,6 +5401,7 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
5308
5401
  sessionFile: selected.step.sessionFile ?? status?.sessionFile ?? result?.sessionFile,
5309
5402
  model: selected.step.model,
5310
5403
  thinking: selected.step.thinking,
5404
+ modelSelection: selected.step.modelSelection,
5311
5405
  ...recoveryDescriptor ? { recoveryDescriptor } : {}
5312
5406
  };
5313
5407
  }
@@ -5340,6 +5434,7 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
5340
5434
  intercomTarget: resolveSubagentIntercomTarget(runId, childId ?? agent, index),
5341
5435
  cwd: status?.cwd ?? result?.cwd,
5342
5436
  ...resolvedSessionFile ? { sessionFile: resolvedSessionFile } : {},
5437
+ modelSelection: statusSteps[index]?.modelSelection,
5343
5438
  ...stepModel ? { model: stepModel } : {},
5344
5439
  ...stepThinking ? { thinking: stepThinking } : {},
5345
5440
  ...recoveryDescriptor ? { recoveryDescriptor } : {}
@@ -5361,6 +5456,76 @@ function buildRevivedAsyncTask(target, message) {
5361
5456
  `);
5362
5457
  }
5363
5458
 
5459
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/run-id-resolver.js
5460
+ import * as fs17 from "node:fs";
5461
+ import * as path18 from "node:path";
5462
+ function exactAsyncLocation(id, asyncDirRoot, resultsDir) {
5463
+ let asyncDir = path18.join(asyncDirRoot, id), resultPath = path18.join(resultsDir, `${id}.json`);
5464
+ if (!(!fs17.existsSync(asyncDir) && !fs17.existsSync(resultPath)))
5465
+ return {
5466
+ asyncDir: fs17.existsSync(asyncDir) ? asyncDir : null,
5467
+ resultPath: fs17.existsSync(resultPath) ? resultPath : null,
5468
+ resolvedId: id
5469
+ };
5470
+ }
5471
+ function foregroundIds(state) {
5472
+ if (!state)
5473
+ return [];
5474
+ let remembered = state.currentSessionId ? [...state.foregroundRuns?.values() ?? []].filter((run) => run.sessionId === state.currentSessionId).map((run) => run.runId) : [];
5475
+ return [.../* @__PURE__ */ new Set([...state.foregroundControls.keys(), ...remembered])];
5476
+ }
5477
+ function hasExactForegroundId(state, id) {
5478
+ if (!state)
5479
+ return !1;
5480
+ if (state.foregroundControls.has(id))
5481
+ return !0;
5482
+ let remembered = state.foregroundRuns?.get(id);
5483
+ return !!(remembered && state.currentSessionId && remembered.sessionId === state.currentSessionId);
5484
+ }
5485
+ function nestedScopeFromState(state) {
5486
+ if (!state)
5487
+ return;
5488
+ let routes = [], seen = /* @__PURE__ */ new Set(), add = (route) => {
5489
+ if (!route)
5490
+ return;
5491
+ let key = `${route.rootRunId}:${route.eventSink}:${route.controlInbox}`;
5492
+ seen.has(key) || (seen.add(key), routes.push(route));
5493
+ };
5494
+ for (let control of state.foregroundControls.values())
5495
+ add(control.nestedRoute);
5496
+ for (let job of state.asyncJobs.values())
5497
+ add(job.nestedRoute);
5498
+ return { routes };
5499
+ }
5500
+ function asyncPrefixMatches(prefix, asyncDirRoot, resultsDir) {
5501
+ return findAsyncRunPrefixMatches(prefix, asyncDirRoot, resultsDir);
5502
+ }
5503
+ function resolveSubagentRunId(id, deps = {}) {
5504
+ assertSafeNestedId("id", id);
5505
+ let asyncDirRoot = deps.asyncDirRoot ?? ASYNC_DIR, resultsDir = deps.resultsDir ?? RESULTS_DIR, nestedScope = deps.nested ?? nestedScopeFromState(deps.state);
5506
+ if (hasExactForegroundId(deps.state, id))
5507
+ return { kind: "foreground", id };
5508
+ let exactAsync = exactAsyncLocation(id, asyncDirRoot, resultsDir);
5509
+ if (exactAsync)
5510
+ return { kind: "async", id, location: exactAsync };
5511
+ let exactNested = findNestedRunMatchesById(id, nestedScope ? { scope: nestedScope } : {});
5512
+ if (exactNested.length > 1)
5513
+ throw new Error(`Nested run id '${id}' is ambiguous across authorized registries. Provide the full id after stale registries are cleaned up.`);
5514
+ if (exactNested[0])
5515
+ return { kind: "nested", id, match: exactNested[0] };
5516
+ let matches = [];
5517
+ for (let foregroundId of foregroundIds(deps.state).filter((candidate) => candidate.startsWith(id)))
5518
+ matches.push({ kind: "foreground", id: foregroundId });
5519
+ for (let match of asyncPrefixMatches(id, asyncDirRoot, resultsDir))
5520
+ matches.push({ kind: "async", id: match.id, location: match.location });
5521
+ for (let match of findNestedRunMatchesById(id, nestedScope ? { prefix: !0, scope: nestedScope } : { prefix: !0 }))
5522
+ matches.push({ kind: "nested", id: match.run.id, match });
5523
+ let values = [...new Map(matches.map((match) => [`${match.kind}:${match.id}`, match])).values()];
5524
+ if (values.length > 1)
5525
+ throw new Error(`Ambiguous subagent run id prefix '${id}' matched: ${values.map((match) => `${match.kind}:${match.id}`).join(", ")}. Provide a longer id.`);
5526
+ return values[0];
5527
+ }
5528
+
5364
5529
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js
5365
5530
  var SUBAGENT_CONTROL_MESSAGE_TYPE = "subagent_control_notice";
5366
5531
  function controlNoticeTarget(details) {
@@ -5382,6 +5547,10 @@ function deliverControlNotice(input) {
5382
5547
  return;
5383
5548
  input.visibleControlNotices.add(key);
5384
5549
  let noticeText = input.details.noticeText ?? formatControlNoticeMessage(input.details.event, childIntercomTarget);
5550
+ if (isDiagnosticControlEvent(input.details.event)) {
5551
+ input.pi.appendEntry(SUBAGENT_CONTROL_MESSAGE_TYPE, { ...input.details, childIntercomTarget, noticeText });
5552
+ return;
5553
+ }
5385
5554
  input.pi.sendMessage({
5386
5555
  customType: SUBAGENT_CONTROL_MESSAGE_TYPE,
5387
5556
  content: noticeText,
@@ -5411,8 +5580,8 @@ function handleSubagentControlNotice(input) {
5411
5580
  }
5412
5581
 
5413
5582
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/async-status.js
5414
- import * as fs17 from "node:fs";
5415
- import * as path18 from "node:path";
5583
+ import * as fs18 from "node:fs";
5584
+ import * as path19 from "node:path";
5416
5585
  function getErrorMessage4(error) {
5417
5586
  return error instanceof Error ? error.message : String(error);
5418
5587
  }
@@ -5420,9 +5589,9 @@ function isNotFoundError3(error) {
5420
5589
  return typeof error == "object" && error !== null && "code" in error && error.code === "ENOENT";
5421
5590
  }
5422
5591
  function isAsyncRunDir(root, entry) {
5423
- let entryPath = path18.join(root, entry);
5592
+ let entryPath = path19.join(root, entry);
5424
5593
  try {
5425
- return fs17.statSync(entryPath).isDirectory();
5594
+ return fs18.statSync(entryPath).isDirectory();
5426
5595
  } catch (error) {
5427
5596
  if (isNotFoundError3(error))
5428
5597
  return !1;
@@ -5434,7 +5603,7 @@ function isAsyncRunDir(root, entry) {
5434
5603
  function outputFileMtime(outputFile) {
5435
5604
  if (outputFile)
5436
5605
  try {
5437
- return fs17.statSync(outputFile).mtimeMs;
5606
+ return fs18.statSync(outputFile).mtimeMs;
5438
5607
  } catch (error) {
5439
5608
  if (isNotFoundError3(error))
5440
5609
  return;
@@ -5446,7 +5615,7 @@ function outputFileMtime(outputFile) {
5446
5615
  function deriveAsyncActivityState(asyncDir, status) {
5447
5616
  if (status.state !== "running")
5448
5617
  return { activityState: status.activityState, lastActivityAt: status.lastActivityAt };
5449
- let outputPath = status.outputFile ? path18.isAbsolute(status.outputFile) ? status.outputFile : path18.join(asyncDir, status.outputFile) : void 0, currentStep = typeof status.currentStep == "number" ? status.steps?.[status.currentStep] : void 0;
5618
+ let outputPath = status.outputFile ? path19.isAbsolute(status.outputFile) ? status.outputFile : path19.join(asyncDir, status.outputFile) : void 0, currentStep = typeof status.currentStep == "number" ? status.steps?.[status.currentStep] : void 0;
5450
5619
  return {
5451
5620
  activityState: status.activityState,
5452
5621
  lastActivityAt: status.lastActivityAt ?? outputFileMtime(outputPath) ?? currentStep?.lastActivityAt ?? currentStep?.startedAt ?? status.startedAt
@@ -5454,7 +5623,7 @@ function deriveAsyncActivityState(asyncDir, status) {
5454
5623
  }
5455
5624
  function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
5456
5625
  if (status.sessionId !== void 0 && typeof status.sessionId != "string")
5457
- throw new Error(`Invalid async status '${path18.join(asyncDir, "status.json")}': sessionId must be a string.`);
5626
+ throw new Error(`Invalid async status '${path19.join(asyncDir, "status.json")}': sessionId must be a string.`);
5458
5627
  let { activityState, lastActivityAt } = deriveAsyncActivityState(asyncDir, status), steps = status.steps ?? [], chainStepCount = status.chainStepCount ?? steps.length, parallelGroups = normalizeParallelGroups(status.parallelGroups, steps.length, chainStepCount), nestedChildren = [];
5459
5628
  if (nestedWarnings.length === 0 && nestedRoute)
5460
5629
  try {
@@ -5500,8 +5669,8 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
5500
5669
  ...step.children?.length ? { children: step.children } : {}
5501
5670
  };
5502
5671
  });
5503
- return attachRootChildrenToSteps(status.runId || path18.basename(asyncDir), summarizedSteps, nestedChildren), {
5504
- id: status.runId || path18.basename(asyncDir),
5672
+ return attachRootChildrenToSteps(status.runId || path19.basename(asyncDir), summarizedSteps, nestedChildren), {
5673
+ id: status.runId || path19.basename(asyncDir),
5505
5674
  asyncDir,
5506
5675
  ...status.sessionId ? { sessionId: status.sessionId } : {},
5507
5676
  state: status.state,
@@ -5571,7 +5740,7 @@ function sortRuns(runs) {
5571
5740
  function listAsyncRuns(asyncDirRoot, options = {}) {
5572
5741
  let entries;
5573
5742
  try {
5574
- entries = fs17.readdirSync(asyncDirRoot).filter((entry) => isAsyncRunDir(asyncDirRoot, entry));
5743
+ entries = fs18.readdirSync(asyncDirRoot).filter((entry) => isAsyncRunDir(asyncDirRoot, entry));
5575
5744
  } catch (error) {
5576
5745
  if (isNotFoundError3(error))
5577
5746
  return [];
@@ -5581,13 +5750,13 @@ function listAsyncRuns(asyncDirRoot, options = {}) {
5581
5750
  }
5582
5751
  let allowedStates = options.states ? new Set(options.states) : void 0, runs = [], nestedRouteIndex, resolveNestedRoute = (rootRunId) => (nestedRouteIndex || (nestedRouteIndex = buildNestedRouteIndex()), nestedRouteIndex.get(rootRunId));
5583
5752
  for (let entry of entries) {
5584
- let asyncDir = path18.join(asyncDirRoot, entry), status = (options.reconcile === !1 ? void 0 : reconcileAsyncRun(asyncDir, { resultsDir: options.resultsDir, kill: options.kill, now: options.now }))?.status ?? readStatus(asyncDir);
5753
+ let asyncDir = path19.join(asyncDirRoot, entry), status = (options.reconcile === !1 ? void 0 : reconcileAsyncRun(asyncDir, { resultsDir: options.resultsDir, kill: options.kill, now: options.now }))?.status ?? readStatus(asyncDir);
5585
5754
  if (!status || allowedStates && !allowedStates.has(status.state) || options.sessionId && status.sessionId !== options.sessionId)
5586
5755
  continue;
5587
5756
  let nestedWarnings = [], nestedRoute;
5588
5757
  if (options.reconcile !== !1)
5589
5758
  try {
5590
- nestedRoute = resolveNestedRoute(status.runId || path18.basename(asyncDir)), nestedRoute && reconcileNestedAsyncDescendants(nestedRoute, { resultsDir: options.resultsDir, kill: options.kill, now: options.now });
5759
+ nestedRoute = resolveNestedRoute(status.runId || path19.basename(asyncDir)), nestedRoute && reconcileNestedAsyncDescendants(nestedRoute, { resultsDir: options.resultsDir, kill: options.kill, now: options.now });
5591
5760
  } catch (error) {
5592
5761
  nestedWarnings.push(`Nested status unavailable: ${getErrorMessage4(error)}`);
5593
5762
  }
@@ -5615,7 +5784,7 @@ function formatStepLine(step) {
5615
5784
  }
5616
5785
  function formatAsyncRunOutputPath(run) {
5617
5786
  if (run.outputFile)
5618
- return path18.isAbsolute(run.outputFile) ? run.outputFile : path18.join(run.asyncDir, run.outputFile);
5787
+ return path19.isAbsolute(run.outputFile) ? run.outputFile : path19.join(run.asyncDir, run.outputFile);
5619
5788
  }
5620
5789
  function formatAsyncRunProgressLabel(run) {
5621
5790
  let stepCount = run.steps.length || 1, chainStepCount = run.chainStepCount ?? stepCount, groups = normalizeParallelGroups(run.parallelGroups, run.steps.length, chainStepCount), activeGroup = run.currentStep !== void 0 ? groups.find((group) => run.currentStep >= group.start && run.currentStep < group.start + group.count) : void 0;
@@ -5649,8 +5818,8 @@ function formatAsyncRunList(runs, heading = "Active async runs") {
5649
5818
  }
5650
5819
 
5651
5820
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/fleet-view.js
5652
- import * as fs18 from "node:fs";
5653
- import * as path19 from "node:path";
5821
+ import * as fs19 from "node:fs";
5822
+ import * as path20 from "node:path";
5654
5823
  var DEFAULT_TRANSCRIPT_LINES = 80, MAX_TRANSCRIPT_LINES = 500, TRANSCRIPT_TAIL_BYTES = 256 * 1024;
5655
5824
  function transcriptLineLimit(value) {
5656
5825
  return value === void 0 || !Number.isFinite(value) ? DEFAULT_TRANSCRIPT_LINES : Math.max(1, Math.min(MAX_TRANSCRIPT_LINES, Math.trunc(value)));
@@ -5663,11 +5832,11 @@ function uniqueStrings2(values) {
5663
5832
  }
5664
5833
  function resolveMaybeRelative(asyncDir, filePath) {
5665
5834
  if (filePath)
5666
- return path19.resolve(asyncDir, filePath);
5835
+ return path20.resolve(asyncDir, filePath);
5667
5836
  }
5668
5837
  function pathWithin(base, candidate) {
5669
- let resolvedBase = path19.resolve(base), resolvedCandidate = path19.resolve(candidate);
5670
- return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${path19.sep}`);
5838
+ let resolvedBase = path20.resolve(base), resolvedCandidate = path20.resolve(candidate);
5839
+ return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${path20.sep}`);
5671
5840
  }
5672
5841
  function getErrorMessage5(error) {
5673
5842
  return error instanceof Error ? error.message : String(error);
@@ -5678,7 +5847,7 @@ function isNotFoundError4(error) {
5678
5847
  function readTextTail(filePath, maxLines) {
5679
5848
  let stat;
5680
5849
  try {
5681
- stat = fs18.statSync(filePath);
5850
+ stat = fs19.statSync(filePath);
5682
5851
  } catch (error) {
5683
5852
  return isNotFoundError4(error) ? { path: filePath, lines: [], truncated: !1 } : { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
5684
5853
  }
@@ -5687,24 +5856,24 @@ function readTextTail(filePath, maxLines) {
5687
5856
  let fd;
5688
5857
  try {
5689
5858
  let bytesToRead = Math.min(stat.size, TRANSCRIPT_TAIL_BYTES), start = stat.size - bytesToRead, buffer = Buffer.alloc(bytesToRead);
5690
- fd = fs18.openSync(filePath, "r");
5691
- let bytesRead = fs18.readSync(fd, buffer, 0, bytesToRead, start), lines = buffer.subarray(0, bytesRead).toString("utf-8").split(/\r?\n/);
5859
+ fd = fs19.openSync(filePath, "r");
5860
+ let bytesRead = fs19.readSync(fd, buffer, 0, bytesToRead, start), lines = buffer.subarray(0, bytesRead).toString("utf-8").split(/\r?\n/);
5692
5861
  return start > 0 && lines.length > 0 && (lines = lines.slice(1)), lines.at(-1) === "" && (lines = lines.slice(0, -1)), { path: filePath, lines: lines.slice(-maxLines), truncated: start > 0 || lines.length > maxLines };
5693
5862
  } catch (error) {
5694
5863
  return { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
5695
5864
  } finally {
5696
- fd !== void 0 && fs18.closeSync(fd);
5865
+ fd !== void 0 && fs19.closeSync(fd);
5697
5866
  }
5698
5867
  }
5699
5868
  function readContainedTextTail(filePath, maxLines, trustedRoots, label) {
5700
5869
  if (trustedRoots.length === 0)
5701
5870
  return { path: filePath, lines: [], truncated: !1, error: `Refusing to read ${label} transcript path without a trusted root: ${filePath}` };
5702
- let resolvedPath = path19.resolve(filePath);
5871
+ let resolvedPath = path20.resolve(filePath);
5703
5872
  if (!trustedRoots.some((root) => pathWithin(root, resolvedPath)))
5704
5873
  return { path: filePath, lines: [], truncated: !1, error: `Refusing to read ${label} transcript path outside trusted roots: ${filePath}` };
5705
5874
  let lstat;
5706
5875
  try {
5707
- lstat = fs18.lstatSync(resolvedPath);
5876
+ lstat = fs19.lstatSync(resolvedPath);
5708
5877
  } catch (error) {
5709
5878
  return isNotFoundError4(error) ? { path: filePath, lines: [], truncated: !1 } : { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
5710
5879
  }
@@ -5714,7 +5883,7 @@ function readContainedTextTail(filePath, maxLines, trustedRoots, label) {
5714
5883
  return { path: filePath, lines: [], truncated: !1, error: `Refusing to read non-file ${label} transcript path: ${filePath}` };
5715
5884
  let realPath, realRoots;
5716
5885
  try {
5717
- realPath = fs18.realpathSync(resolvedPath), realRoots = trustedRoots.filter((root) => fs18.existsSync(root)).map((root) => fs18.realpathSync(root));
5886
+ realPath = fs19.realpathSync(resolvedPath), realRoots = trustedRoots.filter((root) => fs19.existsSync(root)).map((root) => fs19.realpathSync(root));
5718
5887
  } catch (error) {
5719
5888
  return { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
5720
5889
  }
@@ -5805,8 +5974,8 @@ function formatAsyncFleetLines(runs) {
5805
5974
  for (let step of run.steps) {
5806
5975
  let display = step.label ? `${step.label} (${step.agent})` : step.agent, phase = step.phase ? `[${step.phase}] ` : "", stepActivity = formatActivityFacts2(step), modelThinking = formatModelSelection(step.modelSelection, step.model, step.thinking), parts = [`${step.index}. ${phase}${display}`, step.status, stepActivity, modelThinking].filter(Boolean);
5807
5976
  lines.push(` ${parts.join(" | ")}`);
5808
- let output = path19.join(run.asyncDir, `output-${step.index}.log`);
5809
- fs18.existsSync(output) && lines.push(` output: ${shortenPath(output)}`), step.sessionFile && lines.push(` session: ${shortenPath(step.sessionFile)}`), (step.status === "running" || step.recentOutput?.length || fs18.existsSync(output)) && lines.push(` transcript: subagent({ action: "status", id: "${run.id}", index: ${step.index}, view: "transcript" })`), lines.push(...formatNestedRunStatusLines(step.children, { indent: " ", commandHints: !0, maxLines: 12 }));
5977
+ let output = path20.join(run.asyncDir, `output-${step.index}.log`);
5978
+ fs19.existsSync(output) && lines.push(` output: ${shortenPath(output)}`), step.sessionFile && lines.push(` session: ${shortenPath(step.sessionFile)}`), (step.status === "running" || step.recentOutput?.length || fs19.existsSync(output)) && lines.push(` transcript: subagent({ action: "status", id: "${run.id}", index: ${step.index}, view: "transcript" })`), lines.push(...formatNestedRunStatusLines(step.children, { indent: " ", commandHints: !0, maxLines: 12 }));
5810
5979
  }
5811
5980
  let attached = new Set(run.steps.flatMap((step) => step.children?.map((child) => child.id) ?? [])), unattached = run.nestedChildren?.filter((child) => !attached.has(child.id)) ?? [];
5812
5981
  lines.push(...formatNestedRunStatusLines(unattached, { indent: " ", commandHints: !0, maxLines: 12 })), run.error && lines.push(` error: ${run.error}`);
@@ -5896,14 +6065,14 @@ function appendTranscriptBody(lines, sourceLabel, sourceLines, truncated) {
5896
6065
  lines.push(` ${line}`);
5897
6066
  }
5898
6067
  function formatAsyncRunTranscript(status, asyncDir, options = {}) {
5899
- let lineLimit = transcriptLineLimit(options.lines), selected = selectTranscriptStep(status, options), stepOutputPath = selected.index !== void 0 ? path19.join(asyncDir, `output-${selected.index}.log`) : void 0, runOutputPath = resolveMaybeRelative(asyncDir, status.outputFile), logPath = path19.join(asyncDir, `subagent-log-${status.runId}.md`), outputPaths = selected.index !== void 0 ? uniqueStrings2([stepOutputPath, runOutputPath && stepOutputPath && path19.resolve(runOutputPath) === path19.resolve(stepOutputPath) ? runOutputPath : void 0]) : uniqueStrings2([runOutputPath]), sessionFile = selected.index !== void 0 ? selected.step?.sessionFile : status.sessionFile, eventsPath = path19.join(asyncDir, "events.jsonl"), lines = [
6068
+ let lineLimit = transcriptLineLimit(options.lines), selected = selectTranscriptStep(status, options), stepOutputPath = selected.index !== void 0 ? path20.join(asyncDir, `output-${selected.index}.log`) : void 0, runOutputPath = resolveMaybeRelative(asyncDir, status.outputFile), logPath = path20.join(asyncDir, `subagent-log-${status.runId}.md`), outputPaths = selected.index !== void 0 ? uniqueStrings2([stepOutputPath, runOutputPath && stepOutputPath && path20.resolve(runOutputPath) === path20.resolve(stepOutputPath) ? runOutputPath : void 0]) : uniqueStrings2([runOutputPath]), sessionFile = selected.index !== void 0 ? selected.step?.sessionFile : status.sessionFile, eventsPath = path20.join(asyncDir, "events.jsonl"), lines = [
5900
6069
  `Run: ${status.runId}`,
5901
6070
  `State: ${status.state}`,
5902
6071
  `Mode: ${status.mode}`,
5903
6072
  stepStateLine(status.mode, selected.index, selected.step),
5904
6073
  selected.hint
5905
6074
  ].filter((line) => !!line);
5906
- appendKnownArtifacts(lines, { outputPaths, sessionFile, eventsPath: fs18.existsSync(eventsPath) ? eventsPath : void 0, logPath: fs18.existsSync(logPath) ? logPath : void 0 });
6075
+ appendKnownArtifacts(lines, { outputPaths, sessionFile, eventsPath: fs19.existsSync(eventsPath) ? eventsPath : void 0, logPath: fs19.existsSync(logPath) ? logPath : void 0 });
5907
6076
  let warnings = [], transcriptLines = [], transcriptSource = "Transcript tail", truncated = !1;
5908
6077
  for (let outputPath of outputPaths) {
5909
6078
  let tail = readContainedTextTail(outputPath, lineLimit, [asyncDir], "output");
@@ -5949,7 +6118,7 @@ function formatNestedRunTranscript(run, options = {}) {
5949
6118
  `);
5950
6119
  }
5951
6120
  function formatAsyncResultTranscript(data, resultPath, options = {}) {
5952
- let lineLimit = transcriptLineLimit(options.lines), runId = data.runId ?? data.id ?? path19.basename(resultPath, ".json"), children = Array.isArray(data.results) ? data.results : data.agent ? [{ agent: data.agent, output: data.output, summary: data.summary, sessionFile: data.sessionFile, state: data.state, success: data.success, exitCode: data.exitCode }] : [], index = options.index;
6121
+ let lineLimit = transcriptLineLimit(options.lines), runId = data.runId ?? data.id ?? path20.basename(resultPath, ".json"), children = Array.isArray(data.results) ? data.results : data.agent ? [{ agent: data.agent, output: data.output, summary: data.summary, sessionFile: data.sessionFile, state: data.state, success: data.success, exitCode: data.exitCode }] : [], index = options.index;
5953
6122
  if (index !== void 0 && !Number.isInteger(index))
5954
6123
  throw new Error("Transcript index must be an integer.");
5955
6124
  if (index === void 0 && children.length === 1 && (index = 0), index !== void 0 && (index < 0 || index >= children.length))
@@ -6087,8 +6256,8 @@ function recommendStrongWatchdogModel(ctx) {
6087
6256
  }
6088
6257
 
6089
6258
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/settings.js
6090
- import * as fs19 from "node:fs";
6091
- import * as path20 from "node:path";
6259
+ import * as fs20 from "node:fs";
6260
+ import * as path21 from "node:path";
6092
6261
 
6093
6262
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/types.js
6094
6263
  var SUBAGENT_WATCHDOG_WARNING_TYPE = "subagent_watchdog_warning", WATCHDOG_WARNING_SEVERITIES = ["concern", "blocker"], WATCHDOG_WARNING_CATEGORIES = [
@@ -6214,7 +6383,7 @@ function parseNonEmptyString(value, field, meta) {
6214
6383
  return value.trim();
6215
6384
  throw invalid(meta, field, "a non-empty string");
6216
6385
  }
6217
- function parseThinking(value, field, meta) {
6386
+ function parseThinking2(value, field, meta) {
6218
6387
  if (value === !1)
6219
6388
  return !1;
6220
6389
  if (typeof value == "string" && THINKING_LEVELS.includes(value))
@@ -6253,19 +6422,19 @@ function parseEndpointPatch(value, field, meta) {
6253
6422
  let input = parseObject(value, field, meta);
6254
6423
  assertKnownFields(input, ENDPOINT_FIELDS, field, meta);
6255
6424
  let patch = {};
6256
- return "enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking = parseThinking(input.thinking, `${field}.thinking`, meta)), patch;
6425
+ return "enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking = parseThinking2(input.thinking, `${field}.thinking`, meta)), patch;
6257
6426
  }
6258
6427
  function parseChildOverridePatch(value, field, meta) {
6259
6428
  let input = parseObject(value, field, meta);
6260
6429
  assertKnownFields(input, CHILD_OVERRIDE_FIELDS, field, meta);
6261
6430
  let patch = {};
6262
- return "enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking = parseThinking(input.thinking, `${field}.thinking`, meta)), patch;
6431
+ return "enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking = parseThinking2(input.thinking, `${field}.thinking`, meta)), patch;
6263
6432
  }
6264
6433
  function parseChildrenPatch(value, field, meta) {
6265
6434
  let input = parseObject(value, field, meta);
6266
6435
  assertKnownFields(input, CHILDREN_FIELDS, field, meta);
6267
6436
  let patch = {};
6268
- if ("enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking = parseThinking(input.thinking, `${field}.thinking`, meta)), "watchdogTailTimeoutMs" in input && (patch.watchdogTailTimeoutMs = parseInteger(input.watchdogTailTimeoutMs, `${field}.watchdogTailTimeoutMs`, meta, "a positive integer", (candidate) => candidate >= 1)), "autoFollow" in input && (patch.autoFollow = parseAutoFollowPatch(input.autoFollow, `${field}.autoFollow`, meta)), "overrides" in input) {
6437
+ if ("enabled" in input && (patch.enabled = parseBoolean(input.enabled, `${field}.enabled`, meta)), "model" in input && (patch.model = parseNonEmptyString(input.model, `${field}.model`, meta)), "thinking" in input && (patch.thinking = parseThinking2(input.thinking, `${field}.thinking`, meta)), "watchdogTailTimeoutMs" in input && (patch.watchdogTailTimeoutMs = parseInteger(input.watchdogTailTimeoutMs, `${field}.watchdogTailTimeoutMs`, meta, "a positive integer", (candidate) => candidate >= 1)), "autoFollow" in input && (patch.autoFollow = parseAutoFollowPatch(input.autoFollow, `${field}.autoFollow`, meta)), "overrides" in input) {
6269
6438
  let overrides = parseObject(input.overrides, `${field}.overrides`, meta);
6270
6439
  patch.overrides = {};
6271
6440
  for (let [agent, override] of Object.entries(overrides)) {
@@ -6301,11 +6470,11 @@ function parseSettingsObject(settings, meta) {
6301
6470
  return "watchdog" in subagents ? parseWatchdogPatch(subagents.watchdog, "subagents.watchdog", meta) : {};
6302
6471
  }
6303
6472
  function readSettingsFileStrict(filePath) {
6304
- if (!fs19.existsSync(filePath))
6473
+ if (!fs20.existsSync(filePath))
6305
6474
  return {};
6306
6475
  let raw;
6307
6476
  try {
6308
- raw = fs19.readFileSync(filePath, "utf-8");
6477
+ raw = fs20.readFileSync(filePath, "utf-8");
6309
6478
  } catch (error) {
6310
6479
  let message = error instanceof Error ? error.message : String(error);
6311
6480
  throw new Error(`Failed to read settings file '${filePath}': ${message}`, { cause: error });
@@ -6323,13 +6492,13 @@ function readSettingsFileStrict(filePath) {
6323
6492
  }
6324
6493
  function isDirectory(dir) {
6325
6494
  try {
6326
- return fs19.statSync(dir).isDirectory();
6495
+ return fs20.statSync(dir).isDirectory();
6327
6496
  } catch {
6328
6497
  return !1;
6329
6498
  }
6330
6499
  }
6331
6500
  function getUserSettingsPath() {
6332
- return path20.join(getAgentDir(), "settings.json");
6501
+ return path21.join(getAgentDir(), "settings.json");
6333
6502
  }
6334
6503
  function getWatchdogUserSettingsPath() {
6335
6504
  return getUserSettingsPath();
@@ -6337,16 +6506,16 @@ function getWatchdogUserSettingsPath() {
6337
6506
  function getProjectSettingsPath(cwd) {
6338
6507
  let currentDir = cwd;
6339
6508
  for (; ; ) {
6340
- if (isDirectory(getProjectConfigDir(currentDir)) || isDirectory(path20.join(currentDir, ".agents")))
6341
- return path20.join(getProjectConfigDir(currentDir), "settings.json");
6342
- let parentDir = path20.dirname(currentDir);
6509
+ if (isDirectory(getProjectConfigDir(currentDir)) || isDirectory(path21.join(currentDir, ".agents")))
6510
+ return path21.join(getProjectConfigDir(currentDir), "settings.json");
6511
+ let parentDir = path21.dirname(currentDir);
6343
6512
  if (parentDir === currentDir)
6344
6513
  return;
6345
6514
  currentDir = parentDir;
6346
6515
  }
6347
6516
  }
6348
6517
  function getWatchdogProjectSettingsPath(cwd) {
6349
- return path20.join(getProjectConfigDir(cwd), "settings.json");
6518
+ return path21.join(getProjectConfigDir(cwd), "settings.json");
6350
6519
  }
6351
6520
  function deepMerge(base, patch) {
6352
6521
  let next = { ...base };
@@ -6390,7 +6559,7 @@ function targetSettingsObject(watchdog, target, meta) {
6390
6559
  return ensureObjectField(overrides, target.agent.trim(), `subagents.watchdog.children.overrides.${target.agent.trim()}`, meta);
6391
6560
  }
6392
6561
  function writeSettingsFile(settingsPath, settings) {
6393
- return fs19.mkdirSync(path20.dirname(settingsPath), { recursive: !0 }), fs19.writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}
6562
+ return fs20.mkdirSync(path21.dirname(settingsPath), { recursive: !0 }), fs20.writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}
6394
6563
  `, "utf-8"), settingsPath;
6395
6564
  }
6396
6565
  function writeUserWatchdogEnabled(enabled) {
@@ -6408,7 +6577,7 @@ function resolveWatchdogConfig(cwd, options = {}) {
6408
6577
  ];
6409
6578
  for (let source of sourceSpecs)
6410
6579
  if (source.path) {
6411
- sources.push({ scope: source.scope, path: source.path, exists: fs19.existsSync(source.path) });
6580
+ sources.push({ scope: source.scope, path: source.path, exists: fs20.existsSync(source.path) });
6412
6581
  try {
6413
6582
  patch = deepMerge(patch, parseSourceFile(source.path, source.scope));
6414
6583
  } catch (error) {
@@ -6682,8 +6851,8 @@ import { createHash as createHash4 } from "node:crypto";
6682
6851
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/change-signature.js
6683
6852
  import { spawnSync as spawnSync2 } from "node:child_process";
6684
6853
  import { createHash as createHash2 } from "node:crypto";
6685
- import * as fs20 from "node:fs";
6686
- import * as path21 from "node:path";
6854
+ import * as fs21 from "node:fs";
6855
+ import * as path22 from "node:path";
6687
6856
  var IGNORED_CHANGE_PREFIXES = [".pi-subagents/", "tmp/", "node_modules/"], IGNORED_CHANGE_PATHS = /* @__PURE__ */ new Set([".pi-subagents", "tmp", "node_modules"]);
6688
6857
  function git(cwd, args) {
6689
6858
  let result = spawnSync2("git", ["-C", cwd, ...args], { encoding: "utf-8", maxBuffer: 10485760 });
@@ -6691,28 +6860,28 @@ function git(cwd, args) {
6691
6860
  return result.stdout;
6692
6861
  }
6693
6862
  function normalizeRelPath(value) {
6694
- return value.replaceAll(path21.sep, "/").replace(/^\.\//, "");
6863
+ return value.replaceAll(path22.sep, "/").replace(/^\.\//, "");
6695
6864
  }
6696
6865
  function ignoredRelPath(relPath) {
6697
6866
  let normalized = normalizeRelPath(relPath);
6698
6867
  return IGNORED_CHANGE_PATHS.has(normalized) || IGNORED_CHANGE_PREFIXES.some((prefix) => normalized.startsWith(prefix));
6699
6868
  }
6700
6869
  function hashFile(filePath) {
6701
- return createHash2("sha256").update(fs20.readFileSync(filePath)).digest("hex");
6870
+ return createHash2("sha256").update(fs21.readFileSync(filePath)).digest("hex");
6702
6871
  }
6703
6872
  function hashPath(root, relPath) {
6704
- let normalized = normalizeRelPath(relPath), fullPath = path21.join(root, normalized), stat;
6873
+ let normalized = normalizeRelPath(relPath), fullPath = path22.join(root, normalized), stat;
6705
6874
  try {
6706
- stat = fs20.lstatSync(fullPath);
6875
+ stat = fs21.lstatSync(fullPath);
6707
6876
  } catch (error) {
6708
6877
  if (error.code === "ENOENT")
6709
6878
  return { path: normalized, state: "deleted" };
6710
6879
  throw error;
6711
6880
  }
6712
6881
  if (stat.isSymbolicLink())
6713
- return { path: normalized, state: "symlink", target: fs20.readlinkSync(fullPath) };
6882
+ return { path: normalized, state: "symlink", target: fs21.readlinkSync(fullPath) };
6714
6883
  if (stat.isDirectory()) {
6715
- let entries = fs20.readdirSync(fullPath).map((entry) => normalizeRelPath(path21.posix.join(normalized, entry))).filter((entry) => !ignoredRelPath(entry)).sort();
6884
+ let entries = fs21.readdirSync(fullPath).map((entry) => normalizeRelPath(path22.posix.join(normalized, entry))).filter((entry) => !ignoredRelPath(entry)).sort();
6716
6885
  return { path: normalized, state: "dir", entries: entries.map((entry) => hashPath(root, entry)) };
6717
6886
  }
6718
6887
  return stat.isFile() ? { path: normalized, state: "file", mode: stat.mode & 511, size: stat.size, hash: hashFile(fullPath) } : { path: normalized, state: "other", mode: stat.mode };
@@ -6845,8 +7014,8 @@ var WatchdogEmissionGuard = class {
6845
7014
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/lsp-diagnostics.js
6846
7015
  import { spawn as spawn2 } from "node:child_process";
6847
7016
  import { createHash as createHash3 } from "node:crypto";
6848
- import * as fs21 from "node:fs";
6849
- import * as path22 from "node:path";
7017
+ import * as fs22 from "node:fs";
7018
+ import * as path23 from "node:path";
6850
7019
  import { pathToFileURL } from "node:url";
6851
7020
  var TS_JS_EXTENSIONS = /* @__PURE__ */ new Map([
6852
7021
  [".ts", "typescript"],
@@ -6859,14 +7028,14 @@ var TS_JS_EXTENSIONS = /* @__PURE__ */ new Map([
6859
7028
  [".cjs", "javascript"]
6860
7029
  ]), PROVIDER_NAME = "typescript-language-server", MAX_MESSAGE_LENGTH = 500, MAX_STDERR_LENGTH = 2e3, SHUTDOWN_TIMEOUT_MS = 250;
6861
7030
  function normalizeRelPath2(value) {
6862
- return value.replaceAll(path22.sep, "/").replace(/^\.\//, "");
7031
+ return value.replaceAll(path23.sep, "/").replace(/^\.\//, "");
6863
7032
  }
6864
7033
  function isPathInsideRoot(absPath, root) {
6865
- let rel = path22.relative(root, absPath);
6866
- return rel === "" || !rel.startsWith("..") && !path22.isAbsolute(rel);
7034
+ let rel = path23.relative(root, absPath);
7035
+ return rel === "" || !rel.startsWith("..") && !path23.isAbsolute(rel);
6867
7036
  }
6868
7037
  function languageIdForPath(filePath) {
6869
- return TS_JS_EXTENSIONS.get(path22.extname(filePath).toLowerCase());
7038
+ return TS_JS_EXTENSIONS.get(path23.extname(filePath).toLowerCase());
6870
7039
  }
6871
7040
  function trimDiagnosticMessage(message) {
6872
7041
  let normalized = message.replace(/\s+/g, " ").trim();
@@ -6877,7 +7046,7 @@ function severityFromLsp(value) {
6877
7046
  }
6878
7047
  function pathExecutable(filePath) {
6879
7048
  try {
6880
- return fs21.statSync(filePath).isFile() ? (process.platform === "win32" || fs21.accessSync(filePath, fs21.constants.X_OK), !0) : !1;
7049
+ return fs22.statSync(filePath).isFile() ? (process.platform === "win32" || fs22.accessSync(filePath, fs22.constants.X_OK), !0) : !1;
6881
7050
  } catch {
6882
7051
  return !1;
6883
7052
  }
@@ -6890,13 +7059,13 @@ function pathExecutableNames(name) {
6890
7059
  }
6891
7060
  function resolveTypeScriptLanguageServer(root) {
6892
7061
  for (let name of pathExecutableNames(PROVIDER_NAME)) {
6893
- let local = path22.join(root, "node_modules", ".bin", name);
7062
+ let local = path23.join(root, "node_modules", ".bin", name);
6894
7063
  if (pathExecutable(local))
6895
7064
  return { command: local, args: ["--stdio"], label: `${PROVIDER_NAME} (project)` };
6896
7065
  }
6897
- for (let dir of (process.env.PATH ?? "").split(path22.delimiter).filter(Boolean))
7066
+ for (let dir of (process.env.PATH ?? "").split(path23.delimiter).filter(Boolean))
6898
7067
  for (let name of pathExecutableNames(PROVIDER_NAME)) {
6899
- let candidate = path22.join(dir, name);
7068
+ let candidate = path23.join(dir, name);
6900
7069
  if (pathExecutable(candidate))
6901
7070
  return { command: candidate, args: ["--stdio"], label: PROVIDER_NAME };
6902
7071
  }
@@ -6904,14 +7073,14 @@ function resolveTypeScriptLanguageServer(root) {
6904
7073
  function collectTargetFiles(root, changedPaths, maxFiles) {
6905
7074
  let targets = [], skippedPaths = [];
6906
7075
  for (let changedPath of changedPaths) {
6907
- let relPath = normalizeRelPath2(changedPath), absPath = path22.resolve(root, relPath), languageId = languageIdForPath(absPath);
7076
+ let relPath = normalizeRelPath2(changedPath), absPath = path23.resolve(root, relPath), languageId = languageIdForPath(absPath);
6908
7077
  if (!languageId || !isPathInsideRoot(absPath, root)) {
6909
7078
  skippedPaths.push(relPath);
6910
7079
  continue;
6911
7080
  }
6912
7081
  let stat;
6913
7082
  try {
6914
- stat = fs21.statSync(absPath);
7083
+ stat = fs22.statSync(absPath);
6915
7084
  } catch (error) {
6916
7085
  if (error.code === "ENOENT") {
6917
7086
  skippedPaths.push(relPath);
@@ -7138,7 +7307,7 @@ function initializeParams(root) {
7138
7307
  },
7139
7308
  workspace: { configuration: !1, workspaceFolders: !0 }
7140
7309
  },
7141
- workspaceFolders: [{ uri: rootUri, name: path22.basename(root) || "workspace" }]
7310
+ workspaceFolders: [{ uri: rootUri, name: path23.basename(root) || "workspace" }]
7142
7311
  };
7143
7312
  }
7144
7313
  async function waitForDiagnostics(client, targets, timeoutMs, signal) {
@@ -7161,7 +7330,7 @@ async function collectWithTypeScriptLanguageServer(input) {
7161
7330
  try {
7162
7331
  await client.request("initialize", initializeParams(input.root), remaining(), input.signal), client.notify("initialized", {});
7163
7332
  for (let target of input.targets) {
7164
- let text = fs21.readFileSync(target.absPath, "utf-8");
7333
+ let text = fs22.readFileSync(target.absPath, "utf-8");
7165
7334
  client.notify("textDocument/didOpen", {
7166
7335
  textDocument: { uri: target.uri, languageId: target.languageId, version: 1, text }
7167
7336
  }), client.notify("textDocument/didSave", {
@@ -7195,7 +7364,7 @@ async function collectWithTypeScriptLanguageServer(input) {
7195
7364
  async function collectWatchdogLspDiagnostics(request) {
7196
7365
  if (!request.config.enabled)
7197
7366
  return { status: "disabled", checkedPaths: [], skippedPaths: [], diagnostics: [] };
7198
- let root = path22.resolve(request.root || request.cwd), { targets, skippedPaths } = collectTargetFiles(root, request.changedPaths, request.config.maxFiles);
7367
+ let root = path23.resolve(request.root || request.cwd), { targets, skippedPaths } = collectTargetFiles(root, request.changedPaths, request.config.maxFiles);
7199
7368
  if (!targets.length)
7200
7369
  return {
7201
7370
  status: "skipped",
@@ -7904,7 +8073,7 @@ function buildWatchdogStatus(snapshot, ctx) {
7904
8073
  `Auto-follow: not implemented${snapshot.autoFollowQueued ? " (queued)" : ""}`,
7905
8074
  `Review model call: ${snapshot.reviewDescription}`
7906
8075
  ];
7907
- return snapshot.failedReviews > 0 && lines.push(`Failed reviews: ${snapshot.failedReviews}`), snapshot.staleReviews > 0 && lines.push(`Stale reviews: ${snapshot.staleReviews}`), snapshot.changedPaths?.length && lines.push(`Changed paths: ${snapshot.changedPaths.slice(0, 8).join(", ")}${snapshot.changedPaths.length > 8 ? `, +${snapshot.changedPaths.length - 8} more` : ""}`), snapshot.lastWarning && lines.push(`Last warning: ${snapshot.lastWarning.severity} \xB7 ${snapshot.lastWarning.state ?? "candidate"} \xB7 ${snapshot.lastWarning.summary}`), snapshot.lastError && lines.push(`Last error: ${snapshot.lastError}`), snapshot.configOk ? lines.push("", "Config: ok") : lines.push("", "Config errors:", ...snapshot.errors.map((error) => `- ${error.message}`), "Watchdog is disabled until the config is fixed."), lines.push("Sources:", ...snapshot.sources.map(sourceLine), "", "Model commands:", "- /subagents-watchdog recommend-model", "- /subagents-watchdog model recommended", "- /subagents-watchdog model <provider/model[:thinking]>", "- /subagents-watchdog model inherit", "- /subagents-watchdog session model recommended", 'Agent action: subagent({ action: "watchdog.configure", model: "recommended", scope: "session" })'), lines.join(`
8076
+ return snapshot.failedReviews > 0 && lines.push(`Failed reviews: ${snapshot.failedReviews}`), snapshot.staleReviews > 0 && lines.push(`Stale reviews: ${snapshot.staleReviews}`), snapshot.changedPaths?.length && lines.push(`Changed paths: ${snapshot.changedPaths.slice(0, 8).join(", ")}${snapshot.changedPaths.length > 8 ? `, +${snapshot.changedPaths.length - 8} more` : ""}`), snapshot.lastWarning && lines.push(`Last warning: ${snapshot.lastWarning.severity} \xB7 ${snapshot.lastWarning.state ?? "candidate"} \xB7 ${snapshot.lastWarning.summary}`), snapshot.lastError && lines.push(`Last error: ${snapshot.lastError}`), snapshot.configOk ? lines.push("", "Config: ok") : lines.push("", "Config errors:", ...snapshot.errors.map((error) => `- ${error.message}`), "Watchdog is disabled until the config is fixed."), lines.push("Sources:", ...snapshot.sources.map(sourceLine), "", "Model commands:", "- /subagents-watchdog recommend-model", "- /subagents-watchdog model recommended", "- /subagents-watchdog model <provider/model[:thinking]>", "- /subagents-watchdog model inherit", "- /subagents-watchdog session model recommended", "Configure via /subagents-watchdog or /settings; agent watchdog.configure is not available."), lines.join(`
7908
8077
  `);
7909
8078
  }
7910
8079
  function parseTestCommand(input) {
@@ -8157,6 +8326,9 @@ function registerMainWatchdog(pi, options = {}) {
8157
8326
  }), runtime;
8158
8327
  }
8159
8328
 
8329
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js
8330
+ var SUBAGENT_ASYNC_GUIDANCE = "Subagents run async by default. Set async:false when you need the result immediately and have no independent work to do, or need an interactive preview. Otherwise continue independent work or yield for normal interactive completion. Use subagent_wait for same-turn or skill completion. Headless sessions auto-drain current-session work. Use status for one-time inspection. Do not poll or sleep to wait.";
8331
+
8160
8332
  export {
8161
8333
  childRowLabel,
8162
8334
  SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
@@ -8185,7 +8357,6 @@ export {
8185
8357
  SLASH_SUBAGENT_UPDATE_EVENT,
8186
8358
  SLASH_SUBAGENT_CANCEL_EVENT,
8187
8359
  POLL_INTERVAL_MS,
8188
- MAX_WIDGET_JOBS,
8189
8360
  SUBAGENT_ACTIONS,
8190
8361
  DEFAULT_FORK_PREAMBLE,
8191
8362
  resolveTopLevelParallelMaxTasks,
@@ -8222,7 +8393,6 @@ export {
8222
8393
  buildChainInstructions,
8223
8394
  resolveParallelBehaviors,
8224
8395
  createParallelDirs,
8225
- THINKING_LEVELS,
8226
8396
  toModelInfo,
8227
8397
  resolveEffectiveThinking,
8228
8398
  splitKnownThinkingSuffix,
@@ -8230,6 +8400,7 @@ export {
8230
8400
  getSupportedThinkingLevels,
8231
8401
  formatTokens,
8232
8402
  formatModelSelection,
8403
+ formatCompactModelBadge,
8233
8404
  formatUsage,
8234
8405
  formatDuration,
8235
8406
  buildChainSummary,
@@ -8275,6 +8446,11 @@ export {
8275
8446
  childWatchdogIsActive,
8276
8447
  acceptChildWatchdogEvent,
8277
8448
  resolveWaitToolConfig,
8449
+ SUPERVISOR_REQUEST_TYPE,
8450
+ SUPERVISOR_PROGRESS_TYPE,
8451
+ readCommunication,
8452
+ resolveCommunicationPeer,
8453
+ legacySupervisorBody,
8278
8454
  SUBAGENT_CHILD_ENV,
8279
8455
  SUBAGENT_FANOUT_CHILD_ENV,
8280
8456
  SUBAGENT_PARENT_SESSION_ENV,
@@ -8284,8 +8460,8 @@ export {
8284
8460
  splitThinkingSuffix,
8285
8461
  resolveModelCandidate,
8286
8462
  resolveEffectiveSubagentModel,
8287
- resolveRequiredTierModel,
8288
8463
  captureModelSelection,
8464
+ resolveExecutableChildModel,
8289
8465
  buildModelCandidates,
8290
8466
  isRetryableModelFailure,
8291
8467
  formatModelAttemptNote,
@@ -8295,22 +8471,12 @@ export {
8295
8471
  normalizeParallelGroups,
8296
8472
  flatToLogicalStepIndex,
8297
8473
  formatActivityLabel,
8298
- aggregateStepStatus,
8299
8474
  formatAgentRunningLabel,
8300
- formatParallelOutcome,
8301
8475
  formatNestedAggregate,
8302
8476
  formatNestedRunStatusLines,
8303
- DEFAULT_CONTROL_CONFIG,
8304
- resolveControlConfig,
8305
- deriveActivityState,
8306
- buildControlEvent,
8307
- shouldNotifyControlEvent,
8308
- claimControlNotification,
8309
- formatControlNoticeMessage,
8310
- formatControlIntercomMessage,
8477
+ resolveSubagentRequestParams,
8311
8478
  writeAtomicJson,
8312
8479
  writePrivateAtomicJson,
8313
- assertSafeNestedId,
8314
8480
  createNestedRoute,
8315
8481
  resolveInheritedNestedRouteFromEnv,
8316
8482
  resolveNestedParentAddressFromEnv,
@@ -8318,7 +8484,6 @@ export {
8318
8484
  sanitizeSummary,
8319
8485
  findNestedRouteForRootId,
8320
8486
  projectNestedRegistryForRoot,
8321
- findNestedRunMatchesById,
8322
8487
  writeNestedEvent,
8323
8488
  writeNestedControlRequest,
8324
8489
  readNestedControlResults,
@@ -8337,6 +8502,7 @@ export {
8337
8502
  resolveSubagentResultStatus,
8338
8503
  compactNestedResultChildren,
8339
8504
  attachNestedChildrenToResultChildren,
8505
+ formatNestedResultLines,
8340
8506
  buildSubagentResultIntercomPayload,
8341
8507
  deliverSubagentResultIntercomEvent,
8342
8508
  deliverSubagentIntercomMessageEvent,
@@ -8344,6 +8510,7 @@ export {
8344
8510
  formatSubagentResultReceipt,
8345
8511
  expectsImplementationMutation,
8346
8512
  validateAcceptanceInput,
8513
+ restorePersistedAcceptance,
8347
8514
  validateExecutionAcceptance,
8348
8515
  resolveEffectiveAcceptance,
8349
8516
  formatAcceptancePrompt,
@@ -8352,6 +8519,9 @@ export {
8352
8519
  evaluateAcceptance,
8353
8520
  buildSkippedAcceptanceLedger,
8354
8521
  acceptanceFailureMessage,
8522
+ normalizeAsyncLaunchConfig,
8523
+ subagentLaunchRunsAsync,
8524
+ isAsyncSubagentExecution,
8355
8525
  inspectSubagentFleet,
8356
8526
  formatAsyncRunTranscript,
8357
8527
  formatNestedRunTranscript,
@@ -8364,28 +8534,29 @@ export {
8364
8534
  initialTurnBudgetState,
8365
8535
  turnBudgetState,
8366
8536
  shouldAbortForTurnBudget,
8367
- parseWatchdogThinkingInput,
8368
8537
  resolveWatchdogModelInput,
8369
8538
  recommendStrongWatchdogModel,
8370
- writeWatchdogModelSettings,
8371
8539
  resolveWatchdogConfig,
8372
8540
  buildWatchdogStatus,
8373
8541
  registerMainWatchdog,
8542
+ stopRequestPath,
8543
+ requestAsyncSteer,
8544
+ readSteerCapability,
8545
+ consumeSteerAcks,
8546
+ deliverInterruptRequest,
8547
+ deliverStopRequest,
8374
8548
  INTERCOM_BRIDGE_MARKER,
8375
8549
  resolveIntercomSessionTarget,
8376
8550
  resolveSubagentIntercomTarget,
8377
8551
  diagnoseIntercomBridge,
8378
8552
  resolveIntercomBridge,
8379
8553
  applyIntercomBridgeToAgent,
8380
- requestAsyncSteer,
8381
- consumeSteerAcks,
8382
- deliverInterruptRequest,
8383
- deliverStopRequest,
8384
8554
  interruptLiveAsyncResumeTarget,
8385
- findAsyncRunPrefixMatches,
8386
8555
  resolveAsyncRunLocation,
8387
8556
  resolveAsyncResumeTarget,
8388
8557
  buildRevivedAsyncTask,
8558
+ resolveSubagentRunId,
8559
+ SUBAGENT_ASYNC_GUIDANCE,
8389
8560
  SUBAGENT_CONTROL_MESSAGE_TYPE,
8390
8561
  clearPendingForegroundControlNotices,
8391
8562
  handleSubagentControlNotice