@ashx-j/lunr-dev 0.2.19-dev.10.1 → 0.2.21-dev.12.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 (307) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/README.md +2 -2
  3. package/dist/builtin-extensions/index.d.ts.map +1 -1
  4. package/dist/builtin-extensions/index.js +0 -2
  5. package/dist/builtin-extensions/index.js.map +1 -1
  6. package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -1
  7. package/dist/builtin-extensions/lunr-computer-use.js +15 -14
  8. package/dist/builtin-extensions/lunr-computer-use.js.map +1 -1
  9. package/dist/builtin-extensions/lunr-todos.d.ts +6 -5
  10. package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -1
  11. package/dist/builtin-extensions/lunr-todos.js +9 -7
  12. package/dist/builtin-extensions/lunr-todos.js.map +1 -1
  13. package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts +6 -4
  14. package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts.map +1 -1
  15. package/dist/builtin-extensions/pi-intercom/broker/spawn.js +114 -61
  16. package/dist/builtin-extensions/pi-intercom/broker/spawn.js.map +1 -1
  17. package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
  18. package/dist/builtin-extensions/pi-intercom/index.js +360 -351
  19. package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
  20. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.d.ts.map +1 -1
  21. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js +2 -2
  22. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js.map +1 -1
  23. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +8 -6
  24. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  25. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +128 -57
  26. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  27. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts +18 -8
  28. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
  29. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +38 -13
  30. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
  31. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -3
  32. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
  33. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +24 -14
  34. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
  35. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +8 -1
  36. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
  37. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +247 -18
  38. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
  39. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts +1 -0
  40. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts.map +1 -1
  41. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js +1 -1
  42. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js.map +1 -1
  43. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts +29 -0
  44. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts.map +1 -0
  45. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js +179 -0
  46. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js.map +1 -0
  47. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts +89 -0
  48. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts.map +1 -0
  49. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js +541 -0
  50. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js.map +1 -0
  51. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +11 -1
  52. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
  53. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +38 -12
  54. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
  55. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.d.ts.map +1 -1
  56. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js +3 -2
  57. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js.map +1 -1
  58. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts +2 -1
  59. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
  60. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +35 -8
  61. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts +7 -3
  63. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts.map +1 -1
  64. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js +26 -4
  65. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js.map +1 -1
  66. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts +1 -0
  67. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -1
  68. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js +55 -38
  69. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js.map +1 -1
  70. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts +100 -0
  71. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
  72. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +46 -31
  73. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
  74. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +3 -6
  75. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
  76. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +64 -5
  77. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
  78. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts +15 -2
  79. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts.map +1 -1
  80. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js +14 -4
  81. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js.map +1 -1
  82. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  83. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +2 -1
  84. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  85. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
  86. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +21 -8
  87. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
  88. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
  89. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +1 -1
  90. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
  91. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +0 -1
  92. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  93. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +71 -25
  94. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  95. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts +2 -0
  96. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -1
  97. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js +75 -18
  98. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js.map +1 -1
  99. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts +1 -1
  100. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts.map +1 -1
  101. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js +1 -1
  102. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js.map +1 -1
  103. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts +13 -1
  104. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -1
  105. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +67 -11
  106. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -1
  107. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +1 -0
  108. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
  109. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
  110. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +3 -0
  111. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
  112. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +7 -2
  113. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
  114. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  115. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +13 -3
  116. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  117. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts +2 -2
  118. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts.map +1 -1
  119. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js +5 -10
  120. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js.map +1 -1
  121. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.d.ts +2 -0
  122. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.d.ts.map +1 -0
  123. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js +3 -0
  124. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js.map +1 -0
  125. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts +3 -0
  126. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
  127. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +68 -11
  128. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
  129. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts +12 -1
  130. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts.map +1 -1
  131. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js +21 -2
  132. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js.map +1 -1
  133. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +21 -4
  134. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  135. package/dist/builtin-extensions/pi-subagents/src/shared/types.js +1 -1
  136. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  137. package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.d.ts.map +1 -1
  138. package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.js.map +1 -1
  139. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts +7 -0
  140. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
  141. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +11 -7
  142. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
  143. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +6 -0
  144. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
  145. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +46 -29
  146. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
  147. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +46 -4
  148. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  149. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +407 -450
  150. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  151. package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.d.ts.map +1 -1
  152. package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js +1 -1
  153. package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js.map +1 -1
  154. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts +2 -13
  155. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts.map +1 -1
  156. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js +5 -91
  157. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js.map +1 -1
  158. package/dist/core/computer-use/image.d.ts +26 -0
  159. package/dist/core/computer-use/image.d.ts.map +1 -0
  160. package/dist/core/computer-use/image.js +64 -0
  161. package/dist/core/computer-use/image.js.map +1 -0
  162. package/dist/core/computer-use/policy.d.ts.map +1 -1
  163. package/dist/core/computer-use/policy.js +2 -6
  164. package/dist/core/computer-use/policy.js.map +1 -1
  165. package/dist/core/computer-use/schemas.d.ts +13 -10
  166. package/dist/core/computer-use/schemas.d.ts.map +1 -1
  167. package/dist/core/computer-use/schemas.js +26 -35
  168. package/dist/core/computer-use/schemas.js.map +1 -1
  169. package/dist/core/computer-use/workflow.d.ts +16 -8
  170. package/dist/core/computer-use/workflow.d.ts.map +1 -1
  171. package/dist/core/computer-use/workflow.js +271 -260
  172. package/dist/core/computer-use/workflow.js.map +1 -1
  173. package/dist/core/customize.d.ts +2 -0
  174. package/dist/core/customize.d.ts.map +1 -1
  175. package/dist/core/customize.js +3 -0
  176. package/dist/core/customize.js.map +1 -1
  177. package/dist/core/permissions.d.ts +1 -0
  178. package/dist/core/permissions.d.ts.map +1 -1
  179. package/dist/core/permissions.js +8 -4
  180. package/dist/core/permissions.js.map +1 -1
  181. package/dist/core/plan-mode.d.ts.map +1 -1
  182. package/dist/core/plan-mode.js +0 -5
  183. package/dist/core/plan-mode.js.map +1 -1
  184. package/dist/core/runtime-bridges.d.ts.map +1 -1
  185. package/dist/core/runtime-bridges.js +0 -2
  186. package/dist/core/runtime-bridges.js.map +1 -1
  187. package/dist/core/settings-manager.d.ts +4 -0
  188. package/dist/core/settings-manager.d.ts.map +1 -1
  189. package/dist/core/settings-manager.js +11 -0
  190. package/dist/core/settings-manager.js.map +1 -1
  191. package/dist/core/subagent-cancellation.d.ts +21 -0
  192. package/dist/core/subagent-cancellation.d.ts.map +1 -0
  193. package/dist/core/subagent-cancellation.js +53 -0
  194. package/dist/core/subagent-cancellation.js.map +1 -0
  195. package/dist/core/subagent-spinner-setting.d.ts +6 -0
  196. package/dist/core/subagent-spinner-setting.d.ts.map +1 -0
  197. package/dist/core/subagent-spinner-setting.js +12 -0
  198. package/dist/core/subagent-spinner-setting.js.map +1 -0
  199. package/dist/core/subagent-spinner.d.ts +4 -0
  200. package/dist/core/subagent-spinner.d.ts.map +1 -0
  201. package/dist/core/subagent-spinner.js +6 -0
  202. package/dist/core/subagent-spinner.js.map +1 -0
  203. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  204. package/dist/modes/interactive/components/assistant-message.js +12 -18
  205. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  206. package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
  207. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  208. package/dist/modes/interactive/components/settings-selector.js +73 -1
  209. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  210. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  211. package/dist/modes/interactive/components/tool-execution.js +12 -0
  212. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  213. package/dist/modes/interactive/extension-widget-order.d.ts +8 -0
  214. package/dist/modes/interactive/extension-widget-order.d.ts.map +1 -0
  215. package/dist/modes/interactive/extension-widget-order.js +37 -0
  216. package/dist/modes/interactive/extension-widget-order.js.map +1 -0
  217. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  218. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  219. package/dist/modes/interactive/interactive-mode.js +44 -22
  220. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  221. package/dist/node-runtime/{agent-session-services-RSGP5GDN.js → agent-session-services-QANFGM2V.js} +14 -13
  222. package/dist/node-runtime/{builtin-extensions-7STLFW3A.js → builtin-extensions-SRCYQPZ6.js} +4 -3
  223. package/dist/node-runtime/{chunk-5OLJGVCB.js → chunk-3ONQTOMR.js} +2 -2
  224. package/dist/node-runtime/chunk-5ZH3ZFIZ.js +308 -0
  225. package/dist/node-runtime/{chunk-4SJWFTUP.js → chunk-7NBZ5P7I.js} +1 -1
  226. package/dist/node-runtime/chunk-A3KMVBZV.js +60 -0
  227. package/dist/node-runtime/{chunk-FLYMHKCS.js → chunk-BJ6H7DPI.js} +25 -25
  228. package/dist/node-runtime/{chunk-T5GM5BFH.js → chunk-BYQ2MOFI.js} +6 -6
  229. package/dist/node-runtime/{chunk-W7S2REEG.js → chunk-CZUBYPFP.js} +157 -74
  230. package/dist/node-runtime/{chunk-ZRDIMBEQ.js → chunk-D466UAID.js} +9 -6
  231. package/dist/node-runtime/{chunk-K72NVGUB.js → chunk-GT5F3OKM.js} +1 -1
  232. package/dist/node-runtime/chunk-H2BI7G7T.js +73 -0
  233. package/dist/node-runtime/{chunk-ISQDQIZN.js → chunk-HXJS2PJM.js} +2 -2
  234. package/dist/node-runtime/chunk-LISUTZS3.js +19 -0
  235. package/dist/node-runtime/{chunk-BKAZ6BKX.js → chunk-LOYUC2ID.js} +7 -7
  236. package/dist/node-runtime/{chunk-OTT6JMPU.js → chunk-LTYWTR3V.js} +1 -369
  237. package/dist/node-runtime/{chunk-5Q45AVQG.js → chunk-MW2XJZIK.js} +1 -1
  238. package/dist/node-runtime/{chunk-MUMMMTW4.js → chunk-N3PNL74S.js} +536 -265
  239. package/dist/node-runtime/{chunk-HQCKFM2O.js → chunk-VGYZ3APQ.js} +3 -0
  240. package/dist/node-runtime/{chunk-5NWQCSKR.js → chunk-VQ4UBWSA.js} +11 -1
  241. package/dist/node-runtime/{chunk-6SPPH4FY.js → chunk-VTGEKB7R.js} +4 -4
  242. package/dist/node-runtime/chunk-W3SILANP.js +24 -0
  243. package/dist/node-runtime/{chunk-J7QGQD45.js → chunk-WJVFOIB5.js} +1 -1
  244. package/dist/node-runtime/{chunk-JT6YCS5B.js → chunk-XAUQOKYK.js} +408 -45
  245. package/dist/node-runtime/{chunk-LCACDWHJ.js → chunk-XSRCAQK2.js} +13 -13
  246. package/dist/node-runtime/{chunk-TAP7QTUT.js → chunk-ZOIIMEN6.js} +24 -425
  247. package/dist/node-runtime/{chunk-MGSB2C3M.js → chunk-ZVSORYRM.js} +1 -1
  248. package/dist/node-runtime/{command-6UXQ6XZN.js → command-ZURZJDXF.js} +1 -1
  249. package/dist/node-runtime/{commands-LGR5VT5X.js → commands-BZGSLIP7.js} +3 -3
  250. package/dist/node-runtime/{customize-XEXL2DGQ.js → customize-LF5VST47.js} +1 -1
  251. package/dist/node-runtime/{direct-tool-executor-TDJS7TBD.js → direct-tool-executor-BSZDHIYR.js} +4 -4
  252. package/dist/node-runtime/{extract-IUCVZCWC.js → extract-XLQSJN4V.js} +2 -2
  253. package/dist/node-runtime/{gateway-3OLC4GQN.js → gateway-FWHRIBK5.js} +9 -9
  254. package/dist/node-runtime/{gemini-search-NCIDF7NE.js → gemini-search-U7SUMPQA.js} +1 -1
  255. package/dist/node-runtime/{gemini-url-context-OKIN7AIP.js → gemini-url-context-PXWCBQHK.js} +2 -2
  256. package/dist/node-runtime/index.js +34 -31
  257. package/dist/node-runtime/{init-EKE277AG.js → init-DVJUAOUO.js} +3 -3
  258. package/dist/node-runtime/{interactive-mode-S5M26CQ7.js → interactive-mode-BBASNWHN.js} +18 -15
  259. package/dist/node-runtime/lunr-computer-use-TJNDAMWM.js +135 -0
  260. package/dist/node-runtime/{lunr-cron-KKBOGAEF.js → lunr-cron-J64I72C6.js} +5 -5
  261. package/dist/node-runtime/main.js +22 -20
  262. package/dist/node-runtime/{package-manager-cli-C4EJOO5Q.js → package-manager-cli-VMYX4Y2S.js} +8 -7
  263. package/dist/node-runtime/{pi-intercom-EEMBGQID.js → pi-intercom-NV2LW6X7.js} +108 -87
  264. package/dist/node-runtime/{pi-mcp-adapter-DPTJGAAL.js → pi-mcp-adapter-JLB5YL2F.js} +6 -6
  265. package/dist/node-runtime/{pi-subagents-VKCLYIBY.js → pi-subagents-WEHV3W7H.js} +1267 -604
  266. package/dist/node-runtime/{pi-web-access-BV6DSZOP.js → pi-web-access-FN5YC5T6.js} +5 -5
  267. package/dist/node-runtime/{proxy-modes-R64LU6WZ.js → proxy-modes-OR7ISBXK.js} +7 -7
  268. package/dist/node-runtime/rpc-entry.js +22 -20
  269. package/dist/node-runtime/{runtime-bridges-UJ5WJJLN.js → runtime-bridges-2VQTLPOZ.js} +3 -5
  270. package/dist/node-runtime/{settings-manager-K6IPIQTI.js → settings-manager-3CCU326G.js} +3 -2
  271. package/dist/node-runtime/{subagent-executor-EFLTO32A.js → subagent-executor-CXKXQDHH.js} +186 -299
  272. package/dist/node-runtime/{update-cli-I6OVDRPL.js → update-cli-NM7B4CKL.js} +3 -2
  273. package/dist/node-runtime/{video-extract-ETA5RA7U.js → video-extract-OYT5WKS5.js} +2 -2
  274. package/dist/node-runtime/workflow-C26QCUTW.js +468 -0
  275. package/dist/node-runtime/{youtube-extract-SRVGNN26.js → youtube-extract-TQYKGFGS.js} +2 -2
  276. package/docs/computer-use.md +233 -268
  277. package/docs/features.md +22 -4
  278. package/docs/keybindings.md +3 -1
  279. package/docs/settings.md +3 -2
  280. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  281. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  282. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  283. package/examples/extensions/gondolin/package-lock.json +2 -2
  284. package/examples/extensions/gondolin/package.json +1 -1
  285. package/examples/extensions/sandbox/package-lock.json +2 -2
  286. package/examples/extensions/sandbox/package.json +1 -1
  287. package/examples/extensions/with-deps/package-lock.json +2 -2
  288. package/examples/extensions/with-deps/package.json +1 -1
  289. package/install-lock/package-lock.json +24 -24
  290. package/install-lock/package.json +2 -2
  291. package/npm-shrinkwrap.json +21 -21
  292. package/package.json +7 -7
  293. package/dist/builtin-extensions/lunr-settings-tools.d.ts +0 -4
  294. package/dist/builtin-extensions/lunr-settings-tools.d.ts.map +0 -1
  295. package/dist/builtin-extensions/lunr-settings-tools.js +0 -120
  296. package/dist/builtin-extensions/lunr-settings-tools.js.map +0 -1
  297. package/dist/core/settings-tools-bridge.d.ts +0 -35
  298. package/dist/core/settings-tools-bridge.d.ts.map +0 -1
  299. package/dist/core/settings-tools-bridge.js +0 -56
  300. package/dist/core/settings-tools-bridge.js.map +0 -1
  301. package/dist/node-runtime/chunk-EH2LJQPM.js +0 -64
  302. package/dist/node-runtime/image-resize-6ZPBFMWW.js +0 -11
  303. package/dist/node-runtime/lunr-computer-use-4X3KUNF4.js +0 -206
  304. package/dist/node-runtime/workflow-SA34S4VX.js +0 -325
  305. package/dist/node-runtime/{chunk-EHMBW7FA.js → chunk-VSELYKWU.js} +3 -3
  306. package/dist/node-runtime/{chunk-ZSEZY3II.js → chunk-VTPM5V35.js} +0 -0
  307. package/dist/node-runtime/{src-GPFAU3N6.js → src-BPQFJR76.js} +3 -3
@@ -2,16 +2,16 @@ import { createRequire as __lunrRequire } from "node:module"; const require = __
2
2
  import {
3
3
  PLAN_MODE_WRITE_SPAWN_ERROR,
4
4
  resolveChildPermissions
5
- } from "./chunk-MGSB2C3M.js";
5
+ } from "./chunk-ZVSORYRM.js";
6
6
  import {
7
7
  createReadOnlyTools
8
- } from "./chunk-K72NVGUB.js";
9
- import {
10
- COMPUTER_TOOLS
11
- } from "./chunk-5OLJGVCB.js";
8
+ } from "./chunk-GT5F3OKM.js";
12
9
  import {
13
10
  convertToLlm
14
11
  } from "./chunk-FVDOXRUD.js";
12
+ import {
13
+ COMPUTER_TOOLS
14
+ } from "./chunk-3ONQTOMR.js";
15
15
 
16
16
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/shared/types.js
17
17
  import * as os from "node:os";
@@ -66,7 +66,8 @@ function resolveTempScopeId(options) {
66
66
  }
67
67
  return "shared";
68
68
  }
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"];
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;
70
+ 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
71
  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
72
  function normalizeTopLevelParallelValue(value) {
72
73
  let parsed = typeof value == "number" ? value : typeof value == "string" ? Number(value) : NaN;
@@ -423,7 +424,22 @@ function formatModelThinking(model, thinking) {
423
424
  return [displayModel, formatThinkingLabel(model, thinking)].filter(Boolean).join(" \xB7 ");
424
425
  }
425
426
  function formatModelSelection(selection, resolvedModel, thinking) {
426
- return selection?.kind === "tier" && selection.tier ? [selection.tier, formatThinkingLabel(resolvedModel, thinking)].filter(Boolean).join(" \xB7 ") : formatModelThinking(resolvedModel, thinking);
427
+ if (selection?.kind === "tier" && selection.tier)
428
+ return [selection.tier, formatThinkingLabel(resolvedModel, thinking)].filter(Boolean).join(" \xB7 ");
429
+ let selectedModel = selection?.kind === "model" ? selection.model : void 0;
430
+ return formatModelThinking(selectedModel || resolvedModel, thinking);
431
+ }
432
+ function formatModelId(model) {
433
+ if (!model)
434
+ return "";
435
+ let displayModel = splitKnownThinkingSuffix(model).baseModel, slashIdx = displayModel.lastIndexOf("/");
436
+ return slashIdx !== -1 && (displayModel = displayModel.slice(slashIdx + 1)), displayModel;
437
+ }
438
+ function formatCompactModelBadge(selection, resolvedModel) {
439
+ if (selection?.kind === "tier" && selection.tier)
440
+ return selection.tier;
441
+ let explicit = selection?.kind === "model" && typeof selection.model == "string" && selection.model.trim() ? selection.model : void 0;
442
+ return formatModelId(explicit ?? resolvedModel);
427
443
  }
428
444
  function formatUsage(u, model) {
429
445
  let parts = [];
@@ -1914,7 +1930,7 @@ function resolveRuntimeScriptPath(basePathWithoutExt) {
1914
1930
  let tsPath = `${basePathWithoutExt}.ts`;
1915
1931
  return fs9.existsSync(tsPath) ? tsPath : `${basePathWithoutExt}.js`;
1916
1932
  }
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";
1933
+ 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_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
1934
  function sanitizeSupervisorChannelSegment(value) {
1919
1935
  return value.trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "unknown";
1920
1936
  }
@@ -1971,9 +1987,9 @@ function buildPiArgs(input) {
1971
1987
  ...input.childAgentName ? { agent: input.childAgentName } : {}
1972
1988
  }] : []
1973
1989
  ];
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;
1990
+ 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), env[SUBAGENT_SUPERVISOR_SESSION_ID_ENV] = input.supervisorSessionId ?? "", input.parentSessionId && input.runId && (input.childId || input.childAgentName)) {
1991
+ let childIndex = input.childIndex ?? 0, channelAgent = input.childId ?? input.childAgentName, channelDir = supervisorChannelDir(input.runId, channelAgent, childIndex);
1992
+ 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
1993
  }
1978
1994
  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
1995
  let encodedToolBudget = encodeToolBudgetEnv(input.toolBudget);
@@ -1991,11 +2007,7 @@ function cleanupTempDir(tempDir) {
1991
2007
 
1992
2008
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js
1993
2009
  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
- };
2010
+ return splitKnownThinkingSuffix(model);
1999
2011
  }
2000
2012
  var INHERIT_MODEL = "inherit";
2001
2013
  function normalizeModelSegment(segment) {
@@ -2123,14 +2135,61 @@ function resolveRequiredTierModel(tier, availableModels, preferredProvider) {
2123
2135
  throw new Error(`Model tier '${String(tier)}' resolves to '${baseModel}', but that model is unavailable or unauthenticated. Configure an available model in /settings.`);
2124
2136
  return `${resolvedBase}${thinkingSuffix}`;
2125
2137
  }
2138
+ function requestedModelString(model) {
2139
+ return typeof model == "string" && model.trim() && model.trim() !== INHERIT_MODEL ? model.trim() : void 0;
2140
+ }
2126
2141
  function requestedTier(tier) {
2127
2142
  return tier === "light" || tier === "standard" || tier === "heavy" ? tier : void 0;
2128
2143
  }
2144
+ function parseExplicitThinking(value, pathLabel = "thinking") {
2145
+ if (value !== void 0) {
2146
+ if (value === !1 || value === "off")
2147
+ return "off";
2148
+ if (typeof value != "string" || !THINKING_LEVELS.includes(value))
2149
+ throw new Error(`${pathLabel} must be one of ${THINKING_LEVELS.join(", ")}.`);
2150
+ return value;
2151
+ }
2152
+ }
2129
2153
  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 };
2154
+ let model = typeof input.model == "string" ? input.model.trim() : "", hasModel = !!model, tier = requestedTier(input.tier);
2155
+ if (hasModel && model === INHERIT_MODEL)
2156
+ throw new Error('model "inherit" is not supported; choose tier: "light", "standard", or "heavy", or an explicit provider/model.');
2157
+ if (hasModel && tier)
2158
+ throw new Error("Choose exactly one of tier or model; do not pass both.");
2159
+ if (hasModel)
2160
+ return { kind: "model", model };
2161
+ if (tier)
2162
+ return { kind: "tier", tier };
2163
+ throw new Error('Every executable child requires tier: "light", "standard", or "heavy", or an explicit model when the user names one.');
2164
+ }
2165
+ function resolveRequiredExplicitModel(model, availableModels, preferredProvider, thinking) {
2166
+ let requested = requestedModelString(model);
2167
+ if (!requested)
2168
+ throw new Error('Explicit model selection requires model as "provider/id".');
2169
+ if (!availableModels?.length)
2170
+ throw new Error(`Model '${requested}' cannot launch because no authenticated models are available.`);
2171
+ let { baseModel, thinkingSuffix } = splitThinkingSuffix(requested), resolvedBase = resolveBaseModelCandidate(baseModel, availableModels, preferredProvider);
2172
+ if (!resolvedBase)
2173
+ throw new Error(`Model '${baseModel}' is unavailable or unauthenticated. Choose an available provider/model or a configured tier.`);
2174
+ let fromSuffix = thinkingSuffix ? thinkingSuffix.slice(1) : void 0, fromParam = parseExplicitThinking(thinking);
2175
+ if (fromSuffix && fromParam && fromSuffix !== fromParam)
2176
+ throw new Error(`Conflicting thinking levels '${fromSuffix}' and '${fromParam}' for model '${requested}'.`);
2177
+ let level = fromParam ?? fromSuffix;
2178
+ if (!level)
2179
+ return resolvedBase;
2180
+ let info = availableModels.find((entry) => entry.fullId === resolvedBase), supported = getSupportedThinkingLevels(info);
2181
+ if (!supported.includes(level))
2182
+ throw new Error(`Thinking level '${level}' is not supported by '${resolvedBase}'. Supported: ${supported.join(", ") || "none"}.`);
2183
+ return applyThinkingSuffix(resolvedBase, level, !0) ?? resolvedBase;
2184
+ }
2185
+ function resolveExecutableChildModel(input) {
2186
+ let selection = input.modelSelection ?? captureModelSelection({ model: input.model, tier: input.tier });
2187
+ if (selection.kind === "tier") {
2188
+ if (input.thinking !== void 0)
2189
+ throw new Error("thinking is only valid with an explicit model; tier children use the configured tier thinking level.");
2190
+ return resolveRequiredTierModel(selection.tier, input.availableModels, input.preferredProvider);
2191
+ }
2192
+ return resolveRequiredExplicitModel(input.model, input.availableModels, input.preferredProvider, input.thinking);
2134
2193
  }
2135
2194
  function buildModelCandidates(primaryModel, fallbackModels, availableModels, preferredProvider, options) {
2136
2195
  let seen = /* @__PURE__ */ new Set(), candidates = [], rawCandidates = [primaryModel, ...fallbackModels ?? []];
@@ -2276,12 +2335,24 @@ function optionalCount(value) {
2276
2335
  function isModelSelection(value) {
2277
2336
  if (!value || typeof value != "object")
2278
2337
  return !1;
2279
- if (value.kind === "tier") {
2338
+ let kind = value.kind;
2339
+ if (kind === "model")
2340
+ return !0;
2341
+ if (kind === "tier") {
2280
2342
  let tier = value.tier;
2281
2343
  return tier === "light" || tier === "standard" || tier === "heavy";
2282
2344
  }
2283
2345
  return !1;
2284
2346
  }
2347
+ function parseThinking(value, pathLabel) {
2348
+ if (value !== void 0) {
2349
+ if (value === !1)
2350
+ return "off";
2351
+ if (typeof value == "string" && THINKING_LEVELS.includes(value))
2352
+ return value;
2353
+ throw new Error(`${pathLabel}.thinking must be one of ${THINKING_LEVELS.join(", ")}.`);
2354
+ }
2355
+ }
2285
2356
  function normalizeChildSpec(input, options) {
2286
2357
  let pathLabel = options.pathLabel ?? "task", description = validateChildDescription(input.description, `${pathLabel}.description`), task = typeof input.task == "string" && input.task.trim() ? input.task : options.defaultTask;
2287
2358
  if (typeof task != "string" || !task.trim())
@@ -2289,21 +2360,40 @@ function normalizeChildSpec(input, options) {
2289
2360
  let requested = parseChildPermissionsInput(input.permissions, `${pathLabel}.permissions`), resolved = resolveChildPermissions(options.parentMode, requested);
2290
2361
  if (!resolved.ok)
2291
2362
  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 });
2363
+ let preservedSelection = isModelSelection(input.modelSelection) ? input.modelSelection : void 0, rawModel = optionalString(input.model);
2364
+ if (rawModel === INHERIT_MODEL)
2365
+ throw new Error(`${pathLabel}.model "inherit" is not supported; choose tier or an explicit provider/model.`);
2366
+ let modelSelection, tier, model, thinking;
2367
+ if (preservedSelection)
2368
+ if (modelSelection = preservedSelection, modelSelection.kind === "tier") {
2369
+ if (tier = modelSelection.tier, model = void 0, input.thinking !== void 0)
2370
+ throw new Error(`${pathLabel}.thinking is only valid with an explicit model selection.`);
2371
+ } else {
2372
+ if (model = rawModel ?? optionalString(modelSelection.model), !model)
2373
+ throw new Error(`${pathLabel}.model is required when modelSelection.kind is "model".`);
2374
+ modelSelection.model || (modelSelection = { kind: "model", model }), thinking = parseThinking(input.thinking, pathLabel);
2375
+ }
2376
+ else if (options.resolvedModelIsRuntime) {
2377
+ let selectedTier = input.tier === "light" || input.tier === "standard" || input.tier === "heavy" ? input.tier : void 0;
2378
+ if (!selectedTier)
2379
+ throw new Error(`${pathLabel}.tier is required to resume a child without a stored modelSelection.`);
2380
+ modelSelection = { kind: "tier", tier: selectedTier }, tier = selectedTier, model = void 0;
2381
+ } else if (modelSelection = captureModelSelection({ model: input.model, tier: input.tier }), modelSelection.kind === "tier") {
2382
+ if (tier = modelSelection.tier, model = void 0, input.thinking !== void 0)
2383
+ throw new Error(`${pathLabel}.thinking is only valid with an explicit model selection.`);
2384
+ } else
2385
+ model = rawModel, !modelSelection.model && model && (modelSelection = { kind: "model", model }), thinking = parseThinking(input.thinking, pathLabel);
2386
+ let outputMode = input.outputMode === "inline" || input.outputMode === "file-only" ? input.outputMode : void 0;
2298
2387
  return {
2299
2388
  childId: options.childId ?? allocateChildId(options.runId, options.index),
2300
2389
  task,
2301
2390
  description,
2302
2391
  requestedPermissions: resolved.requested,
2303
2392
  effectivePermissions: resolved.effective,
2304
- model: optionalString(input.model),
2393
+ model,
2305
2394
  tier,
2306
2395
  modelSelection,
2396
+ thinking,
2307
2397
  skill: optionalSkill(input.skill),
2308
2398
  cwd: optionalString(input.cwd),
2309
2399
  output: optionalOutput(input.output),
@@ -2334,9 +2424,6 @@ function formatActivityLabel(lastActivityAt, activityState, now = Date.now()) {
2334
2424
  function isCompletedStepStatus(status) {
2335
2425
  return status === "complete" || status === "completed";
2336
2426
  }
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
2427
  function formatAgentRunningLabel(count) {
2341
2428
  return count === 1 ? "1 agent running" : `${count} agents running`;
2342
2429
  }
@@ -2420,6 +2507,34 @@ function formatNestedRunStatusLines(children, options = {}) {
2420
2507
  });
2421
2508
  }
2422
2509
 
2510
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js
2511
+ var LAUNCH_COMPATIBLE_ACTIONS = /* @__PURE__ */ new Set(["schedule", "append-step", "resume", "steer"]);
2512
+ function omitExecutionModeActionAlias(params) {
2513
+ let action = params.action?.toLowerCase();
2514
+ if (action === "single" && params.task !== void 0) {
2515
+ let rest = { ...params };
2516
+ return delete rest.action, rest;
2517
+ }
2518
+ if ((action === "parallel" || action === "tasks") && (params.tasks?.length ?? 0) > 0) {
2519
+ let rest = { ...params };
2520
+ return delete rest.action, rest;
2521
+ }
2522
+ return params;
2523
+ }
2524
+ function hasLaunchFields(params) {
2525
+ return params.task !== void 0 || Array.isArray(params.tasks) && params.tasks.length > 0 || Array.isArray(params.chain) && params.chain.length > 0;
2526
+ }
2527
+ function omitConflictingControlAction(params) {
2528
+ let action = params.action?.toLowerCase();
2529
+ if (!action || LAUNCH_COMPATIBLE_ACTIONS.has(action) || !hasLaunchFields(params))
2530
+ return params;
2531
+ let rest = { ...params };
2532
+ return delete rest.action, typeof rest.task == "string" && rest.task.length > 0 && (delete rest.tasks, delete rest.chain), rest;
2533
+ }
2534
+ function resolveSubagentRequestParams(params) {
2535
+ return omitConflictingControlAction(omitExecutionModeActionAlias(params));
2536
+ }
2537
+
2423
2538
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js
2424
2539
  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
2540
  enabled: !0,
@@ -3808,7 +3923,7 @@ var REVIEW_ONLY_PATTERNS = [
3808
3923
  /\balways\s+(?:edit|modify|change|fix|patch|apply)\b/i,
3809
3924
  /\bapply\s+(?:the\s+)?fix(?:es)?\s+directly\b/i,
3810
3925
  /\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 = [
3926
+ ], 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
3927
  /\bdo not edit files?\s+outside\b/i,
3813
3928
  /\bdo not edit\s+outside\b/i,
3814
3929
  /\bdo not edit\s+unrelated files?\b/i,
@@ -3865,17 +3980,14 @@ function taskHasReadOnlyDeliverable(taskText) {
3865
3980
  function hasImplementationIntent(taskText) {
3866
3981
  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
3982
  }
3868
- function isReadOnlyPermission(permissionsOrLegacyName) {
3869
- return permissionsOrLegacyName === "read-only";
3870
- }
3871
- function classifyTaskMutationIntent(permissionsOrLegacyName, task) {
3872
- if (isReadOnlyPermission(permissionsOrLegacyName))
3983
+ function classifyTaskMutationIntent(permissions, task) {
3984
+ if (permissions === "read-only")
3873
3985
  return { kind: "read-only" };
3874
3986
  let taskText = stripFrameworkInstructions(task), taskTextWithoutScopedConstraints = stripPatterns(taskText, SCOPED_NO_EDIT_CONSTRAINT_PATTERNS), prohibitions = analyzeNoEditProhibitions(taskTextWithoutScopedConstraints);
3875
3987
  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
3988
  }
3877
- function expectsImplementationMutation(permissionsOrLegacyName, task) {
3878
- return isReadOnlyPermission(permissionsOrLegacyName) ? !1 : classifyTaskMutationIntent(permissionsOrLegacyName, task).kind === "implementation";
3989
+ function expectsImplementationMutation(permissions, task) {
3990
+ return classifyTaskMutationIntent(permissions, task).kind === "implementation";
3879
3991
  }
3880
3992
  var MAY_MUTATE_VERB_PATTERN = /\b(?:fix|implement|update|write|edit|modify|migrate|delete|remove|refactor|commit)\b/i;
3881
3993
  function taskMayMutate(task) {
@@ -3900,7 +4012,7 @@ var LEVEL_RANK = {
3900
4012
  "diff-summary",
3901
4013
  "review-findings",
3902
4014
  "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.";
4015
+ ]), 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
4016
  function normalizeLevel(level) {
3905
4017
  return level ?? "auto";
3906
4018
  }
@@ -3950,18 +4062,25 @@ function normalizeAcceptanceInput(input) {
3950
4062
  function explicitAcceptanceCanDisable(explicit) {
3951
4063
  return explicit.level === "none" && typeof explicit.reason == "string" && explicit.reason.trim().length > 0;
3952
4064
  }
3953
- function validateAcceptanceInput(input, pathLabel = "acceptance") {
4065
+ function validateAcceptanceValue(input, pathLabel, mode) {
3954
4066
  let errors = [];
3955
- if (input === void 0 || input === !1)
4067
+ if (input === void 0)
3956
4068
  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;
4069
+ if (mode === "persisted") {
4070
+ if (!input || typeof input != "object" || Array.isArray(input))
4071
+ return errors.push(`${pathLabel} must be a resolved acceptance object.`), errors;
4072
+ } else {
4073
+ if (input === !1)
4074
+ return errors;
4075
+ if (typeof input == "string")
4076
+ 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;
4077
+ if (!input || typeof input != "object" || Array.isArray(input))
4078
+ return errors.push(`${pathLabel} must be a string level, false, or an object.`), errors;
4079
+ }
4080
+ let value = input, allowedKeys = mode === "persisted" ? PERSISTED_ACCEPTANCE_KEYS : ACCEPTANCE_CONFIG_KEYS;
3962
4081
  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)) {
4082
+ allowedKeys.has(key) || errors.push(`${pathLabel}.${key} is not supported.`);
4083
+ 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
4084
  let criterionIds = /* @__PURE__ */ new Set();
3966
4085
  for (let [index, criterion] of value.criteria.entries()) {
3967
4086
  if (typeof criterion == "string")
@@ -4021,6 +4140,29 @@ function validateAcceptanceInput(input, pathLabel = "acceptance") {
4021
4140
  typeof item != "string" && errors.push(`${pathLabel}.stopRules[${index}] must be a string.`);
4022
4141
  return errors;
4023
4142
  }
4143
+ function validateAcceptanceInput(input, pathLabel = "acceptance") {
4144
+ return validateAcceptanceValue(input, pathLabel, "launch");
4145
+ }
4146
+ function validatePersistedAcceptance(input, pathLabel = "acceptance") {
4147
+ return validateAcceptanceValue(input, pathLabel, "persisted");
4148
+ }
4149
+ function restorePersistedAcceptance(input, pathLabel = "acceptance") {
4150
+ let errors = validatePersistedAcceptance(input, pathLabel);
4151
+ if (errors.length > 0)
4152
+ throw new Error(errors.join(" "));
4153
+ let value = input, evidence = Array.isArray(value.evidence) ? unique(value.evidence.filter((item) => VALID_EVIDENCE.has(item))) : [];
4154
+ return {
4155
+ level: value.level,
4156
+ explicit: value.explicit === !0,
4157
+ inferredReason: Array.isArray(value.inferredReason) ? value.inferredReason.filter((item) => typeof item == "string") : [],
4158
+ criteria: normalizeCriteria(value.criteria, evidence),
4159
+ evidence,
4160
+ verify: Array.isArray(value.verify) ? value.verify : [],
4161
+ review: value.review,
4162
+ stopRules: Array.isArray(value.stopRules) ? value.stopRules.filter((item) => typeof item == "string") : [],
4163
+ ...typeof value.reason == "string" ? { reason: value.reason } : {}
4164
+ };
4165
+ }
4024
4166
  function validateExecutionAcceptance(input) {
4025
4167
  let errors = validateAcceptanceInput(input.acceptance, "acceptance");
4026
4168
  for (let [index, task] of (input.tasks ?? []).entries())
@@ -4042,9 +4184,11 @@ function normalizeCriteria(criteria, evidence) {
4042
4184
  }
4043
4185
  function resolveEffectiveAcceptance(input) {
4044
4186
  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 }), {
4187
+ level === "reviewed" && input.explicit !== void 0 && explicitLevel !== "reviewed" && explicit.review === void 0 && review && review !== !1 && (review = { ...review, required: !1 });
4188
+ let parentRequestedLevel = input.explicit === void 0 || explicitLevel === "auto" ? void 0 : explicitLevel;
4189
+ return {
4046
4190
  level,
4047
- explicit: input.explicit !== void 0,
4191
+ explicit: parentRequestedLevel === level,
4048
4192
  inferredReason: inferred.reasons,
4049
4193
  criteria,
4050
4194
  evidence,
@@ -4607,6 +4751,17 @@ function acceptanceFailureMessage(ledger) {
4607
4751
  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
4752
  }
4609
4753
 
4754
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js
4755
+ function normalizeAsyncLaunchConfig(config) {
4756
+ return { ...config, asyncByDefault: !0, forceTopLevelAsync: !1 };
4757
+ }
4758
+ function subagentLaunchRunsAsync(params) {
4759
+ return !(params.foregroundOnly === !0 || params.clarify === !0 || params.async === !1);
4760
+ }
4761
+ function isAsyncSubagentExecution(params) {
4762
+ return params.action || !params.task && !params.tasks?.length && !params.chain?.length ? !1 : subagentLaunchRunsAsync(params);
4763
+ }
4764
+
4610
4765
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/turn-budget.js
4611
4766
  function resolveTurnBudgetConfig(raw, label = "turnBudget") {
4612
4767
  if (raw === void 0)
@@ -4667,132 +4822,36 @@ function shouldAbortForTurnBudget(budget, turnCount, terminalAssistantStop) {
4667
4822
  return turnCount < hardLimit ? !1 : turnCount > hardLimit ? !0 : !terminalAssistantStop;
4668
4823
  }
4669
4824
 
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
4825
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/control-channel.js
4777
4826
  import { randomUUID as randomUUID3 } from "node:crypto";
4778
- import * as fs15 from "node:fs";
4779
- import * as path16 from "node:path";
4827
+ import * as fs14 from "node:fs";
4828
+ import * as path15 from "node:path";
4780
4829
  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;
4830
+ 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
4831
  function controlInboxDir(asyncDir) {
4783
- return path16.join(asyncDir, "control");
4832
+ return path15.join(asyncDir, "control");
4784
4833
  }
4785
4834
  function interruptRequestPath(asyncDir) {
4786
- return path16.join(controlInboxDir(asyncDir), "interrupt.json");
4835
+ return path15.join(controlInboxDir(asyncDir), "interrupt.json");
4787
4836
  }
4788
4837
  function stopRequestPath(asyncDir) {
4789
- return path16.join(controlInboxDir(asyncDir), "stop.json");
4838
+ return path15.join(controlInboxDir(asyncDir), "stop.json");
4790
4839
  }
4791
4840
  function steerRequestsDir(asyncDir) {
4792
- return path16.join(controlInboxDir(asyncDir), STEER_REQUESTS_DIR);
4841
+ return path15.join(controlInboxDir(asyncDir), STEER_REQUESTS_DIR);
4793
4842
  }
4794
4843
  function steerInboxClosedPath(asyncDir) {
4795
- return path16.join(controlInboxDir(asyncDir), STEER_INBOX_CLOSED_FILE);
4844
+ return path15.join(controlInboxDir(asyncDir), STEER_INBOX_CLOSED_FILE);
4845
+ }
4846
+ function steerCapabilitiesDir(asyncDir) {
4847
+ return path15.join(controlInboxDir(asyncDir), STEER_CAPABILITIES_DIR);
4848
+ }
4849
+ function steerCapabilityPath(asyncDir, index) {
4850
+ return assertChildIndex(index), path15.join(steerCapabilitiesDir(asyncDir), `${index}.json`);
4851
+ }
4852
+ function assertChildIndex(index) {
4853
+ if (!Number.isInteger(index) || index < 0 || index > 1e6)
4854
+ throw new Error("steer child index must be a non-negative integer.");
4796
4855
  }
4797
4856
  function steerRequestFileName(request) {
4798
4857
  return `${String(request.ts).padStart(13, "0")}-${Buffer.from(request.id).toString("base64url")}.json`;
@@ -4803,7 +4862,7 @@ function validSteerRequest(request) {
4803
4862
  function writeSteerRequestToDir(dir, request) {
4804
4863
  if (!validSteerRequest(request))
4805
4864
  throw new Error("steer request is malformed or exceeds transport limits.");
4806
- let requestPath = path16.join(dir, steerRequestFileName(request));
4865
+ let requestPath = path15.join(dir, steerRequestFileName(request));
4807
4866
  return writeAtomicJson(requestPath, request), requestPath;
4808
4867
  }
4809
4868
  function requestAsyncInterrupt(asyncDir, payload = {}, deps = {}) {
@@ -4825,7 +4884,7 @@ function requestAsyncSteer(asyncDir, payload, deps = {}) {
4825
4884
  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
4885
  throw new Error("steer targetIndexes must contain 1-1000 unique non-negative integers and cannot be combined with targetIndex.");
4827
4886
  let closedPath = steerInboxClosedPath(asyncDir);
4828
- if (fs15.existsSync(closedPath))
4887
+ if (fs14.existsSync(closedPath))
4829
4888
  throw new Error("Async run no longer accepts steering requests.");
4830
4889
  let request = {
4831
4890
  type: "steer",
@@ -4836,10 +4895,17 @@ function requestAsyncSteer(asyncDir, payload, deps = {}) {
4836
4895
  ...payload.targetIndexes !== void 0 ? { targetIndexes: [...payload.targetIndexes] } : {},
4837
4896
  ...payload.source ? { source: payload.source } : {}
4838
4897
  }, 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.");
4898
+ if (fs14.existsSync(closedPath))
4899
+ throw fs14.rmSync(requestPath, { force: !0 }), new Error("Async run stopped accepting steering before the request was committed.");
4841
4900
  return requestPath;
4842
4901
  }
4902
+ function parseSteerCapability(raw) {
4903
+ if (!raw || typeof raw != "object" || Array.isArray(raw))
4904
+ return;
4905
+ let input = raw;
4906
+ 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"))
4907
+ return { type: "steer-capability", protocolVersion: 1, index: input.index, pid: input.pid, readyAt: input.readyAt, supported: input.supported };
4908
+ }
4843
4909
  function parseSteerAck(raw) {
4844
4910
  if (!raw || typeof raw != "object" || Array.isArray(raw))
4845
4911
  return;
@@ -4847,8 +4913,15 @@ function parseSteerAck(raw) {
4847
4913
  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
4914
  return { type: "steer-ack", protocolVersion: 1, requestId: input.requestId, index: input.index, ts: input.ts, state: input.state, message: input.message.trim() };
4849
4915
  }
4850
- function consumeSteerAcks(asyncDir, fsImpl = fs15) {
4851
- let root = path16.join(controlInboxDir(asyncDir), STEER_ACKS_DIR);
4916
+ function readSteerCapability(asyncDir, index) {
4917
+ try {
4918
+ return parseSteerCapability(JSON.parse(fs14.readFileSync(steerCapabilityPath(asyncDir, index), "utf-8")));
4919
+ } catch {
4920
+ return;
4921
+ }
4922
+ }
4923
+ function consumeSteerAcks(asyncDir, fsImpl = fs14) {
4924
+ let root = path15.join(controlInboxDir(asyncDir), STEER_ACKS_DIR);
4852
4925
  if (!fsImpl.existsSync(root))
4853
4926
  return [];
4854
4927
  let acks = [], indexNames;
@@ -4858,14 +4931,14 @@ function consumeSteerAcks(asyncDir, fsImpl = fs15) {
4858
4931
  return [];
4859
4932
  }
4860
4933
  for (let indexName of indexNames) {
4861
- let dir = path16.join(root, indexName), entries;
4934
+ let dir = path15.join(root, indexName), entries;
4862
4935
  try {
4863
4936
  entries = fsImpl.readdirSync(dir).filter((name) => name.endsWith(".json")).sort();
4864
4937
  } catch {
4865
4938
  continue;
4866
4939
  }
4867
4940
  for (let entry of entries) {
4868
- let target = path16.join(dir, entry), ack;
4941
+ let target = path15.join(dir, entry), ack;
4869
4942
  try {
4870
4943
  ack = parseSteerAck(JSON.parse(fsImpl.readFileSync(target, "utf-8")));
4871
4944
  } catch {
@@ -4890,7 +4963,7 @@ function deliverInterruptRequest(input) {
4890
4963
  if (error?.code === "ENOSYS")
4891
4964
  return;
4892
4965
  try {
4893
- fs15.rmSync(requestPath, { force: !0 });
4966
+ fs14.rmSync(requestPath, { force: !0 });
4894
4967
  } catch {
4895
4968
  }
4896
4969
  throw error;
@@ -4900,6 +4973,112 @@ function deliverStopRequest(input) {
4900
4973
  requestAsyncStop(input.asyncDir, input.source ? { source: input.source } : {}, { now: input.now });
4901
4974
  }
4902
4975
 
4976
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js
4977
+ import * as fs15 from "node:fs";
4978
+ import * as os7 from "node:os";
4979
+ import * as path16 from "node:path";
4980
+ var NATIVE_INTERCOM_EXTENSION_DIR = "native:pi-subagents-supervisor-channel";
4981
+ function defaultAgentDir() {
4982
+ return getAgentDir();
4983
+ }
4984
+ function defaultSubagentConfigDir(agentDir = defaultAgentDir()) {
4985
+ return path16.join(agentDir, "extensions", "subagent");
4986
+ }
4987
+ 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.
4988
+
4989
+ Use contact_supervisor first. It resolves the supervisor session "{orchestratorTarget}" and run metadata automatically.
4990
+ - Need a decision, blocked, approval, or product/API/scope ambiguity: contact_supervisor({ reason: "need_decision", message: "<question>" })
4991
+ - Need structured supervisor input rather than a freeform reply: contact_supervisor({ reason: "interview_request", message: "<what input is needed>", interview: { title: "...", questions: [] } })
4992
+ - 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.
4993
+ - 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.
4994
+ - Meaningful progress or unexpected discoveries that change the plan: contact_supervisor({ reason: "progress_update", message: "UPDATE: <summary>" })
4995
+ - Generic intercom is lower-level plumbing/fallback only: intercom({ action: "ask", to: "{orchestratorTarget}", message: "<question>" })
4996
+
4997
+ Do not use contact_supervisor or intercom for routine completion handoffs. If no coordination is needed, return a focused task result.`;
4998
+ function resolveIntercomSessionTarget(sessionName, sessionId) {
4999
+ let trimmedName = sessionName?.trim();
5000
+ if (trimmedName)
5001
+ return trimmedName;
5002
+ let normalizedSessionId = sessionId.startsWith("session-") ? sessionId.slice(8) : sessionId;
5003
+ return `${DEFAULT_INTERCOM_TARGET_PREFIX}-${normalizedSessionId.slice(0, 8)}`;
5004
+ }
5005
+ function sanitizeIntercomTargetPart(value) {
5006
+ return value.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "agent";
5007
+ }
5008
+ function resolveSubagentIntercomTarget(runId, agent, index) {
5009
+ let stepSuffix = index !== void 0 ? `-${index + 1}` : "";
5010
+ return `subagent-${sanitizeIntercomTargetPart(agent)}-${sanitizeIntercomTargetPart(runId)}${stepSuffix}`;
5011
+ }
5012
+ function resolveIntercomBridgeMode(value) {
5013
+ return value === "off" || value === "always" || value === "fork-only" ? value : "always";
5014
+ }
5015
+ function resolveIntercomBridgeConfig(value) {
5016
+ return !value || typeof value != "object" || Array.isArray(value) ? { mode: "always", instructionFile: "" } : {
5017
+ mode: resolveIntercomBridgeMode(value.mode),
5018
+ instructionFile: typeof value.instructionFile == "string" ? value.instructionFile : ""
5019
+ };
5020
+ }
5021
+ function expandTilde(filePath) {
5022
+ return filePath.startsWith("~/") ? path16.join(os7.homedir(), filePath.slice(2)) : filePath;
5023
+ }
5024
+ function resolveInstructionTemplate(instructionFile, settingsDir) {
5025
+ if (!instructionFile)
5026
+ return DEFAULT_INTERCOM_BRIDGE_TEMPLATE;
5027
+ let expandedPath = expandTilde(instructionFile), resolvedPath = path16.isAbsolute(expandedPath) ? expandedPath : path16.resolve(settingsDir, expandedPath);
5028
+ try {
5029
+ return fs15.readFileSync(resolvedPath, "utf-8");
5030
+ } catch (error) {
5031
+ return console.warn(`Failed to read intercom bridge instructionFile at '${resolvedPath}'. Using default instructions.`, error), DEFAULT_INTERCOM_BRIDGE_TEMPLATE;
5032
+ }
5033
+ }
5034
+ function buildIntercomBridgeInstruction(orchestratorTarget, template) {
5035
+ let instruction = template.replaceAll("{orchestratorTarget}", orchestratorTarget).trim();
5036
+ return instruction.startsWith(INTERCOM_BRIDGE_MARKER) ? instruction : `${INTERCOM_BRIDGE_MARKER}
5037
+ ${instruction}`;
5038
+ }
5039
+ function inactiveReason(mode, context, orchestratorTarget) {
5040
+ if (mode === "off")
5041
+ return "bridge mode is off";
5042
+ if (mode === "fork-only" && context !== "fork")
5043
+ return "bridge mode is fork-only and context is not fork";
5044
+ if (!orchestratorTarget)
5045
+ return "orchestrator target is not available";
5046
+ }
5047
+ function diagnoseIntercomBridge(input) {
5048
+ 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);
5049
+ return {
5050
+ active: reason === void 0,
5051
+ mode,
5052
+ wantsIntercom,
5053
+ supervisorChannelAvailable: !0,
5054
+ extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
5055
+ ...orchestratorTarget ? { orchestratorTarget } : {},
5056
+ ...reason ? { reason } : {}
5057
+ };
5058
+ }
5059
+ function resolveIntercomBridge(input) {
5060
+ let config = resolveIntercomBridgeConfig(input.config), mode = config.mode, 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);
5061
+ return inactiveReason(mode, input.context, orchestratorTarget) || !orchestratorTarget ? { active: !1, mode, extensionDir: NATIVE_INTERCOM_EXTENSION_DIR, instruction: defaultInstruction } : {
5062
+ active: !0,
5063
+ mode,
5064
+ orchestratorTarget,
5065
+ extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
5066
+ instruction: buildIntercomBridgeInstruction(orchestratorTarget, resolveInstructionTemplate(config.instructionFile, settingsDir))
5067
+ };
5068
+ }
5069
+ function applyIntercomBridgeToAgent(agent, bridge) {
5070
+ if (!bridge.active || !bridge.orchestratorTarget)
5071
+ return agent;
5072
+ 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}
5073
+
5074
+ ${instruction}` : instruction;
5075
+ return tools === agent.tools && systemPrompt === agent.systemPrompt ? agent : {
5076
+ ...agent,
5077
+ tools,
5078
+ systemPrompt
5079
+ };
5080
+ }
5081
+
4903
5082
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js
4904
5083
  import * as fs16 from "node:fs";
4905
5084
  import * as path17 from "node:path";
@@ -4930,6 +5109,15 @@ function interruptLiveAsyncResumeTarget(input) {
4930
5109
  function getErrorMessage3(error) {
4931
5110
  return error instanceof Error ? error.message : String(error);
4932
5111
  }
5112
+ var TURN_BUDGET_RUNTIME_KEYS = /* @__PURE__ */ new Set(["outcome", "turnCount", "wrapUpRequestedAtTurn", "exceededAtTurn"]);
5113
+ function persistedTurnBudgetConfig(raw) {
5114
+ if (!raw || typeof raw != "object" || Array.isArray(raw))
5115
+ return raw;
5116
+ let config = {};
5117
+ for (let [key, value] of Object.entries(raw))
5118
+ TURN_BUDGET_RUNTIME_KEYS.has(key) || (config[key] = value);
5119
+ return config;
5120
+ }
4933
5121
  function ensureObject(value, source) {
4934
5122
  if (!value || typeof value != "object" || Array.isArray(value))
4935
5123
  throw new Error(`Async result file '${source}' must contain a JSON object.`);
@@ -5153,7 +5341,7 @@ function readAsyncRecoveryDescriptor(asyncDir) {
5153
5341
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': ${field} must be a non-empty string.`);
5154
5342
  if (parsed.permissions !== "full" && parsed.permissions !== "read-only")
5155
5343
  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")
5344
+ if (parsed.tier !== void 0 && parsed.tier !== "light" && parsed.tier !== "standard" && parsed.tier !== "heavy")
5157
5345
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': tier must be light, standard, or heavy.`);
5158
5346
  if (validateChildDescription(parsed.description, `Async recovery descriptor '${descriptorPath}' description`), parsed.outputMode !== "inline" && parsed.outputMode !== "file-only")
5159
5347
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': outputMode is invalid.`);
@@ -5174,17 +5362,23 @@ function readAsyncRecoveryDescriptor(asyncDir) {
5174
5362
  let selection = parsed.modelSelection;
5175
5363
  if (!selection || typeof selection != "object")
5176
5364
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection must be an object.`);
5177
- if (selection.kind !== "tier")
5365
+ if (selection.kind === "tier") {
5366
+ if (selection.tier !== "light" && selection.tier !== "standard" && selection.tier !== "heavy")
5367
+ throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection.tier is invalid.`);
5368
+ } else if (selection.kind === "model") {
5369
+ if (selection.model !== void 0 && (typeof selection.model != "string" || !selection.model.trim()))
5370
+ throw new Error(`Invalid async recovery descriptor '${descriptorPath}': modelSelection.model must be a non-empty string.`);
5371
+ } else
5178
5372
  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
- }
5373
+ } else if (parsed.tier === void 0)
5374
+ throw new Error(`Invalid async recovery descriptor '${descriptorPath}': tier or modelSelection is required.`);
5182
5375
  if (parsed.absoluteDeadlineAt !== void 0 && (!Number.isFinite(parsed.absoluteDeadlineAt) || parsed.absoluteDeadlineAt <= 0))
5183
5376
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': absoluteDeadlineAt must be a positive timestamp.`);
5184
5377
  if (parsed.initialTurnBudget !== void 0) {
5185
- let result = resolveTurnBudgetConfig(parsed.initialTurnBudget, "recoveryDescriptor.initialTurnBudget");
5378
+ let result = resolveTurnBudgetConfig(persistedTurnBudgetConfig(parsed.initialTurnBudget), "recoveryDescriptor.initialTurnBudget");
5186
5379
  if (result.error)
5187
5380
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': ${result.error}`);
5381
+ result.turnBudget && (parsed.initialTurnBudget = result.turnBudget);
5188
5382
  }
5189
5383
  if (parsed.initialToolBudget !== void 0) {
5190
5384
  let result = validateToolBudgetConfig(parsed.initialToolBudget, "recoveryDescriptor.initialToolBudget");
@@ -5230,7 +5424,7 @@ function readAsyncRecoveryDescriptor(asyncDir) {
5230
5424
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': controlConfig.notifyChannels is invalid.`);
5231
5425
  }
5232
5426
  if (parsed.acceptance !== void 0) {
5233
- let errors = validateAcceptanceInput(parsed.acceptance, "recoveryDescriptor.acceptance");
5427
+ let errors = validatePersistedAcceptance(parsed.acceptance, "recoveryDescriptor.acceptance");
5234
5428
  if (errors.length)
5235
5429
  throw new Error(`Invalid async recovery descriptor '${descriptorPath}': ${errors.join(" ")}`);
5236
5430
  }
@@ -5283,6 +5477,7 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
5283
5477
  sessionFile: selectedStep.sessionFile ?? status?.sessionFile ?? result?.sessionFile,
5284
5478
  model: selectedStep.model,
5285
5479
  thinking: selectedStep.thinking,
5480
+ modelSelection: selectedStep.modelSelection,
5286
5481
  ...recoveryDescriptor ? { recoveryDescriptor } : {}
5287
5482
  };
5288
5483
  if (selectedStep?.status === "pending")
@@ -5308,6 +5503,7 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
5308
5503
  sessionFile: selected.step.sessionFile ?? status?.sessionFile ?? result?.sessionFile,
5309
5504
  model: selected.step.model,
5310
5505
  thinking: selected.step.thinking,
5506
+ modelSelection: selected.step.modelSelection,
5311
5507
  ...recoveryDescriptor ? { recoveryDescriptor } : {}
5312
5508
  };
5313
5509
  }
@@ -5340,6 +5536,7 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
5340
5536
  intercomTarget: resolveSubagentIntercomTarget(runId, childId ?? agent, index),
5341
5537
  cwd: status?.cwd ?? result?.cwd,
5342
5538
  ...resolvedSessionFile ? { sessionFile: resolvedSessionFile } : {},
5539
+ modelSelection: statusSteps[index]?.modelSelection,
5343
5540
  ...stepModel ? { model: stepModel } : {},
5344
5541
  ...stepThinking ? { thinking: stepThinking } : {},
5345
5542
  ...recoveryDescriptor ? { recoveryDescriptor } : {}
@@ -5361,6 +5558,76 @@ function buildRevivedAsyncTask(target, message) {
5361
5558
  `);
5362
5559
  }
5363
5560
 
5561
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/run-id-resolver.js
5562
+ import * as fs17 from "node:fs";
5563
+ import * as path18 from "node:path";
5564
+ function exactAsyncLocation(id, asyncDirRoot, resultsDir) {
5565
+ let asyncDir = path18.join(asyncDirRoot, id), resultPath = path18.join(resultsDir, `${id}.json`);
5566
+ if (!(!fs17.existsSync(asyncDir) && !fs17.existsSync(resultPath)))
5567
+ return {
5568
+ asyncDir: fs17.existsSync(asyncDir) ? asyncDir : null,
5569
+ resultPath: fs17.existsSync(resultPath) ? resultPath : null,
5570
+ resolvedId: id
5571
+ };
5572
+ }
5573
+ function foregroundIds(state) {
5574
+ if (!state)
5575
+ return [];
5576
+ let remembered = state.currentSessionId ? [...state.foregroundRuns?.values() ?? []].filter((run) => run.sessionId === state.currentSessionId).map((run) => run.runId) : [];
5577
+ return [.../* @__PURE__ */ new Set([...state.foregroundControls.keys(), ...remembered])];
5578
+ }
5579
+ function hasExactForegroundId(state, id) {
5580
+ if (!state)
5581
+ return !1;
5582
+ if (state.foregroundControls.has(id))
5583
+ return !0;
5584
+ let remembered = state.foregroundRuns?.get(id);
5585
+ return !!(remembered && state.currentSessionId && remembered.sessionId === state.currentSessionId);
5586
+ }
5587
+ function nestedScopeFromState(state) {
5588
+ if (!state)
5589
+ return;
5590
+ let routes = [], seen = /* @__PURE__ */ new Set(), add = (route) => {
5591
+ if (!route)
5592
+ return;
5593
+ let key = `${route.rootRunId}:${route.eventSink}:${route.controlInbox}`;
5594
+ seen.has(key) || (seen.add(key), routes.push(route));
5595
+ };
5596
+ for (let control of state.foregroundControls.values())
5597
+ add(control.nestedRoute);
5598
+ for (let job of state.asyncJobs.values())
5599
+ add(job.nestedRoute);
5600
+ return { routes };
5601
+ }
5602
+ function asyncPrefixMatches(prefix, asyncDirRoot, resultsDir) {
5603
+ return findAsyncRunPrefixMatches(prefix, asyncDirRoot, resultsDir);
5604
+ }
5605
+ function resolveSubagentRunId(id, deps = {}) {
5606
+ assertSafeNestedId("id", id);
5607
+ let asyncDirRoot = deps.asyncDirRoot ?? ASYNC_DIR, resultsDir = deps.resultsDir ?? RESULTS_DIR, nestedScope = deps.nested ?? nestedScopeFromState(deps.state);
5608
+ if (hasExactForegroundId(deps.state, id))
5609
+ return { kind: "foreground", id };
5610
+ let exactAsync = exactAsyncLocation(id, asyncDirRoot, resultsDir);
5611
+ if (exactAsync)
5612
+ return { kind: "async", id, location: exactAsync };
5613
+ let exactNested = findNestedRunMatchesById(id, nestedScope ? { scope: nestedScope } : {});
5614
+ if (exactNested.length > 1)
5615
+ throw new Error(`Nested run id '${id}' is ambiguous across authorized registries. Provide the full id after stale registries are cleaned up.`);
5616
+ if (exactNested[0])
5617
+ return { kind: "nested", id, match: exactNested[0] };
5618
+ let matches = [];
5619
+ for (let foregroundId of foregroundIds(deps.state).filter((candidate) => candidate.startsWith(id)))
5620
+ matches.push({ kind: "foreground", id: foregroundId });
5621
+ for (let match of asyncPrefixMatches(id, asyncDirRoot, resultsDir))
5622
+ matches.push({ kind: "async", id: match.id, location: match.location });
5623
+ for (let match of findNestedRunMatchesById(id, nestedScope ? { prefix: !0, scope: nestedScope } : { prefix: !0 }))
5624
+ matches.push({ kind: "nested", id: match.run.id, match });
5625
+ let values = [...new Map(matches.map((match) => [`${match.kind}:${match.id}`, match])).values()];
5626
+ if (values.length > 1)
5627
+ throw new Error(`Ambiguous subagent run id prefix '${id}' matched: ${values.map((match) => `${match.kind}:${match.id}`).join(", ")}. Provide a longer id.`);
5628
+ return values[0];
5629
+ }
5630
+
5364
5631
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js
5365
5632
  var SUBAGENT_CONTROL_MESSAGE_TYPE = "subagent_control_notice";
5366
5633
  function controlNoticeTarget(details) {
@@ -5411,8 +5678,8 @@ function handleSubagentControlNotice(input) {
5411
5678
  }
5412
5679
 
5413
5680
  // 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";
5681
+ import * as fs18 from "node:fs";
5682
+ import * as path19 from "node:path";
5416
5683
  function getErrorMessage4(error) {
5417
5684
  return error instanceof Error ? error.message : String(error);
5418
5685
  }
@@ -5420,9 +5687,9 @@ function isNotFoundError3(error) {
5420
5687
  return typeof error == "object" && error !== null && "code" in error && error.code === "ENOENT";
5421
5688
  }
5422
5689
  function isAsyncRunDir(root, entry) {
5423
- let entryPath = path18.join(root, entry);
5690
+ let entryPath = path19.join(root, entry);
5424
5691
  try {
5425
- return fs17.statSync(entryPath).isDirectory();
5692
+ return fs18.statSync(entryPath).isDirectory();
5426
5693
  } catch (error) {
5427
5694
  if (isNotFoundError3(error))
5428
5695
  return !1;
@@ -5434,7 +5701,7 @@ function isAsyncRunDir(root, entry) {
5434
5701
  function outputFileMtime(outputFile) {
5435
5702
  if (outputFile)
5436
5703
  try {
5437
- return fs17.statSync(outputFile).mtimeMs;
5704
+ return fs18.statSync(outputFile).mtimeMs;
5438
5705
  } catch (error) {
5439
5706
  if (isNotFoundError3(error))
5440
5707
  return;
@@ -5446,7 +5713,7 @@ function outputFileMtime(outputFile) {
5446
5713
  function deriveAsyncActivityState(asyncDir, status) {
5447
5714
  if (status.state !== "running")
5448
5715
  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;
5716
+ 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
5717
  return {
5451
5718
  activityState: status.activityState,
5452
5719
  lastActivityAt: status.lastActivityAt ?? outputFileMtime(outputPath) ?? currentStep?.lastActivityAt ?? currentStep?.startedAt ?? status.startedAt
@@ -5454,7 +5721,7 @@ function deriveAsyncActivityState(asyncDir, status) {
5454
5721
  }
5455
5722
  function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
5456
5723
  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.`);
5724
+ throw new Error(`Invalid async status '${path19.join(asyncDir, "status.json")}': sessionId must be a string.`);
5458
5725
  let { activityState, lastActivityAt } = deriveAsyncActivityState(asyncDir, status), steps = status.steps ?? [], chainStepCount = status.chainStepCount ?? steps.length, parallelGroups = normalizeParallelGroups(status.parallelGroups, steps.length, chainStepCount), nestedChildren = [];
5459
5726
  if (nestedWarnings.length === 0 && nestedRoute)
5460
5727
  try {
@@ -5500,8 +5767,8 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
5500
5767
  ...step.children?.length ? { children: step.children } : {}
5501
5768
  };
5502
5769
  });
5503
- return attachRootChildrenToSteps(status.runId || path18.basename(asyncDir), summarizedSteps, nestedChildren), {
5504
- id: status.runId || path18.basename(asyncDir),
5770
+ return attachRootChildrenToSteps(status.runId || path19.basename(asyncDir), summarizedSteps, nestedChildren), {
5771
+ id: status.runId || path19.basename(asyncDir),
5505
5772
  asyncDir,
5506
5773
  ...status.sessionId ? { sessionId: status.sessionId } : {},
5507
5774
  state: status.state,
@@ -5571,7 +5838,7 @@ function sortRuns(runs) {
5571
5838
  function listAsyncRuns(asyncDirRoot, options = {}) {
5572
5839
  let entries;
5573
5840
  try {
5574
- entries = fs17.readdirSync(asyncDirRoot).filter((entry) => isAsyncRunDir(asyncDirRoot, entry));
5841
+ entries = fs18.readdirSync(asyncDirRoot).filter((entry) => isAsyncRunDir(asyncDirRoot, entry));
5575
5842
  } catch (error) {
5576
5843
  if (isNotFoundError3(error))
5577
5844
  return [];
@@ -5581,13 +5848,13 @@ function listAsyncRuns(asyncDirRoot, options = {}) {
5581
5848
  }
5582
5849
  let allowedStates = options.states ? new Set(options.states) : void 0, runs = [], nestedRouteIndex, resolveNestedRoute = (rootRunId) => (nestedRouteIndex || (nestedRouteIndex = buildNestedRouteIndex()), nestedRouteIndex.get(rootRunId));
5583
5850
  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);
5851
+ 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
5852
  if (!status || allowedStates && !allowedStates.has(status.state) || options.sessionId && status.sessionId !== options.sessionId)
5586
5853
  continue;
5587
5854
  let nestedWarnings = [], nestedRoute;
5588
5855
  if (options.reconcile !== !1)
5589
5856
  try {
5590
- nestedRoute = resolveNestedRoute(status.runId || path18.basename(asyncDir)), nestedRoute && reconcileNestedAsyncDescendants(nestedRoute, { resultsDir: options.resultsDir, kill: options.kill, now: options.now });
5857
+ nestedRoute = resolveNestedRoute(status.runId || path19.basename(asyncDir)), nestedRoute && reconcileNestedAsyncDescendants(nestedRoute, { resultsDir: options.resultsDir, kill: options.kill, now: options.now });
5591
5858
  } catch (error) {
5592
5859
  nestedWarnings.push(`Nested status unavailable: ${getErrorMessage4(error)}`);
5593
5860
  }
@@ -5615,7 +5882,7 @@ function formatStepLine(step) {
5615
5882
  }
5616
5883
  function formatAsyncRunOutputPath(run) {
5617
5884
  if (run.outputFile)
5618
- return path18.isAbsolute(run.outputFile) ? run.outputFile : path18.join(run.asyncDir, run.outputFile);
5885
+ return path19.isAbsolute(run.outputFile) ? run.outputFile : path19.join(run.asyncDir, run.outputFile);
5619
5886
  }
5620
5887
  function formatAsyncRunProgressLabel(run) {
5621
5888
  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 +5916,8 @@ function formatAsyncRunList(runs, heading = "Active async runs") {
5649
5916
  }
5650
5917
 
5651
5918
  // 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";
5919
+ import * as fs19 from "node:fs";
5920
+ import * as path20 from "node:path";
5654
5921
  var DEFAULT_TRANSCRIPT_LINES = 80, MAX_TRANSCRIPT_LINES = 500, TRANSCRIPT_TAIL_BYTES = 256 * 1024;
5655
5922
  function transcriptLineLimit(value) {
5656
5923
  return value === void 0 || !Number.isFinite(value) ? DEFAULT_TRANSCRIPT_LINES : Math.max(1, Math.min(MAX_TRANSCRIPT_LINES, Math.trunc(value)));
@@ -5663,11 +5930,11 @@ function uniqueStrings2(values) {
5663
5930
  }
5664
5931
  function resolveMaybeRelative(asyncDir, filePath) {
5665
5932
  if (filePath)
5666
- return path19.resolve(asyncDir, filePath);
5933
+ return path20.resolve(asyncDir, filePath);
5667
5934
  }
5668
5935
  function pathWithin(base, candidate) {
5669
- let resolvedBase = path19.resolve(base), resolvedCandidate = path19.resolve(candidate);
5670
- return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${path19.sep}`);
5936
+ let resolvedBase = path20.resolve(base), resolvedCandidate = path20.resolve(candidate);
5937
+ return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${path20.sep}`);
5671
5938
  }
5672
5939
  function getErrorMessage5(error) {
5673
5940
  return error instanceof Error ? error.message : String(error);
@@ -5678,7 +5945,7 @@ function isNotFoundError4(error) {
5678
5945
  function readTextTail(filePath, maxLines) {
5679
5946
  let stat;
5680
5947
  try {
5681
- stat = fs18.statSync(filePath);
5948
+ stat = fs19.statSync(filePath);
5682
5949
  } catch (error) {
5683
5950
  return isNotFoundError4(error) ? { path: filePath, lines: [], truncated: !1 } : { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
5684
5951
  }
@@ -5687,24 +5954,24 @@ function readTextTail(filePath, maxLines) {
5687
5954
  let fd;
5688
5955
  try {
5689
5956
  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/);
5957
+ fd = fs19.openSync(filePath, "r");
5958
+ let bytesRead = fs19.readSync(fd, buffer, 0, bytesToRead, start), lines = buffer.subarray(0, bytesRead).toString("utf-8").split(/\r?\n/);
5692
5959
  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
5960
  } catch (error) {
5694
5961
  return { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
5695
5962
  } finally {
5696
- fd !== void 0 && fs18.closeSync(fd);
5963
+ fd !== void 0 && fs19.closeSync(fd);
5697
5964
  }
5698
5965
  }
5699
5966
  function readContainedTextTail(filePath, maxLines, trustedRoots, label) {
5700
5967
  if (trustedRoots.length === 0)
5701
5968
  return { path: filePath, lines: [], truncated: !1, error: `Refusing to read ${label} transcript path without a trusted root: ${filePath}` };
5702
- let resolvedPath = path19.resolve(filePath);
5969
+ let resolvedPath = path20.resolve(filePath);
5703
5970
  if (!trustedRoots.some((root) => pathWithin(root, resolvedPath)))
5704
5971
  return { path: filePath, lines: [], truncated: !1, error: `Refusing to read ${label} transcript path outside trusted roots: ${filePath}` };
5705
5972
  let lstat;
5706
5973
  try {
5707
- lstat = fs18.lstatSync(resolvedPath);
5974
+ lstat = fs19.lstatSync(resolvedPath);
5708
5975
  } catch (error) {
5709
5976
  return isNotFoundError4(error) ? { path: filePath, lines: [], truncated: !1 } : { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
5710
5977
  }
@@ -5714,7 +5981,7 @@ function readContainedTextTail(filePath, maxLines, trustedRoots, label) {
5714
5981
  return { path: filePath, lines: [], truncated: !1, error: `Refusing to read non-file ${label} transcript path: ${filePath}` };
5715
5982
  let realPath, realRoots;
5716
5983
  try {
5717
- realPath = fs18.realpathSync(resolvedPath), realRoots = trustedRoots.filter((root) => fs18.existsSync(root)).map((root) => fs18.realpathSync(root));
5984
+ realPath = fs19.realpathSync(resolvedPath), realRoots = trustedRoots.filter((root) => fs19.existsSync(root)).map((root) => fs19.realpathSync(root));
5718
5985
  } catch (error) {
5719
5986
  return { path: filePath, lines: [], truncated: !1, error: getErrorMessage5(error) };
5720
5987
  }
@@ -5805,8 +6072,8 @@ function formatAsyncFleetLines(runs) {
5805
6072
  for (let step of run.steps) {
5806
6073
  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
6074
  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 }));
6075
+ let output = path20.join(run.asyncDir, `output-${step.index}.log`);
6076
+ 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
6077
  }
5811
6078
  let attached = new Set(run.steps.flatMap((step) => step.children?.map((child) => child.id) ?? [])), unattached = run.nestedChildren?.filter((child) => !attached.has(child.id)) ?? [];
5812
6079
  lines.push(...formatNestedRunStatusLines(unattached, { indent: " ", commandHints: !0, maxLines: 12 })), run.error && lines.push(` error: ${run.error}`);
@@ -5896,14 +6163,14 @@ function appendTranscriptBody(lines, sourceLabel, sourceLines, truncated) {
5896
6163
  lines.push(` ${line}`);
5897
6164
  }
5898
6165
  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 = [
6166
+ 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
6167
  `Run: ${status.runId}`,
5901
6168
  `State: ${status.state}`,
5902
6169
  `Mode: ${status.mode}`,
5903
6170
  stepStateLine(status.mode, selected.index, selected.step),
5904
6171
  selected.hint
5905
6172
  ].filter((line) => !!line);
5906
- appendKnownArtifacts(lines, { outputPaths, sessionFile, eventsPath: fs18.existsSync(eventsPath) ? eventsPath : void 0, logPath: fs18.existsSync(logPath) ? logPath : void 0 });
6173
+ appendKnownArtifacts(lines, { outputPaths, sessionFile, eventsPath: fs19.existsSync(eventsPath) ? eventsPath : void 0, logPath: fs19.existsSync(logPath) ? logPath : void 0 });
5907
6174
  let warnings = [], transcriptLines = [], transcriptSource = "Transcript tail", truncated = !1;
5908
6175
  for (let outputPath of outputPaths) {
5909
6176
  let tail = readContainedTextTail(outputPath, lineLimit, [asyncDir], "output");
@@ -5949,7 +6216,7 @@ function formatNestedRunTranscript(run, options = {}) {
5949
6216
  `);
5950
6217
  }
5951
6218
  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;
6219
+ 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
6220
  if (index !== void 0 && !Number.isInteger(index))
5954
6221
  throw new Error("Transcript index must be an integer.");
5955
6222
  if (index === void 0 && children.length === 1 && (index = 0), index !== void 0 && (index < 0 || index >= children.length))
@@ -6087,8 +6354,8 @@ function recommendStrongWatchdogModel(ctx) {
6087
6354
  }
6088
6355
 
6089
6356
  // 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";
6357
+ import * as fs20 from "node:fs";
6358
+ import * as path21 from "node:path";
6092
6359
 
6093
6360
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/types.js
6094
6361
  var SUBAGENT_WATCHDOG_WARNING_TYPE = "subagent_watchdog_warning", WATCHDOG_WARNING_SEVERITIES = ["concern", "blocker"], WATCHDOG_WARNING_CATEGORIES = [
@@ -6214,7 +6481,7 @@ function parseNonEmptyString(value, field, meta) {
6214
6481
  return value.trim();
6215
6482
  throw invalid(meta, field, "a non-empty string");
6216
6483
  }
6217
- function parseThinking(value, field, meta) {
6484
+ function parseThinking2(value, field, meta) {
6218
6485
  if (value === !1)
6219
6486
  return !1;
6220
6487
  if (typeof value == "string" && THINKING_LEVELS.includes(value))
@@ -6253,19 +6520,19 @@ function parseEndpointPatch(value, field, meta) {
6253
6520
  let input = parseObject(value, field, meta);
6254
6521
  assertKnownFields(input, ENDPOINT_FIELDS, field, meta);
6255
6522
  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;
6523
+ 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
6524
  }
6258
6525
  function parseChildOverridePatch(value, field, meta) {
6259
6526
  let input = parseObject(value, field, meta);
6260
6527
  assertKnownFields(input, CHILD_OVERRIDE_FIELDS, field, meta);
6261
6528
  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;
6529
+ 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
6530
  }
6264
6531
  function parseChildrenPatch(value, field, meta) {
6265
6532
  let input = parseObject(value, field, meta);
6266
6533
  assertKnownFields(input, CHILDREN_FIELDS, field, meta);
6267
6534
  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) {
6535
+ 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
6536
  let overrides = parseObject(input.overrides, `${field}.overrides`, meta);
6270
6537
  patch.overrides = {};
6271
6538
  for (let [agent, override] of Object.entries(overrides)) {
@@ -6301,11 +6568,11 @@ function parseSettingsObject(settings, meta) {
6301
6568
  return "watchdog" in subagents ? parseWatchdogPatch(subagents.watchdog, "subagents.watchdog", meta) : {};
6302
6569
  }
6303
6570
  function readSettingsFileStrict(filePath) {
6304
- if (!fs19.existsSync(filePath))
6571
+ if (!fs20.existsSync(filePath))
6305
6572
  return {};
6306
6573
  let raw;
6307
6574
  try {
6308
- raw = fs19.readFileSync(filePath, "utf-8");
6575
+ raw = fs20.readFileSync(filePath, "utf-8");
6309
6576
  } catch (error) {
6310
6577
  let message = error instanceof Error ? error.message : String(error);
6311
6578
  throw new Error(`Failed to read settings file '${filePath}': ${message}`, { cause: error });
@@ -6323,13 +6590,13 @@ function readSettingsFileStrict(filePath) {
6323
6590
  }
6324
6591
  function isDirectory(dir) {
6325
6592
  try {
6326
- return fs19.statSync(dir).isDirectory();
6593
+ return fs20.statSync(dir).isDirectory();
6327
6594
  } catch {
6328
6595
  return !1;
6329
6596
  }
6330
6597
  }
6331
6598
  function getUserSettingsPath() {
6332
- return path20.join(getAgentDir(), "settings.json");
6599
+ return path21.join(getAgentDir(), "settings.json");
6333
6600
  }
6334
6601
  function getWatchdogUserSettingsPath() {
6335
6602
  return getUserSettingsPath();
@@ -6337,16 +6604,16 @@ function getWatchdogUserSettingsPath() {
6337
6604
  function getProjectSettingsPath(cwd) {
6338
6605
  let currentDir = cwd;
6339
6606
  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);
6607
+ if (isDirectory(getProjectConfigDir(currentDir)) || isDirectory(path21.join(currentDir, ".agents")))
6608
+ return path21.join(getProjectConfigDir(currentDir), "settings.json");
6609
+ let parentDir = path21.dirname(currentDir);
6343
6610
  if (parentDir === currentDir)
6344
6611
  return;
6345
6612
  currentDir = parentDir;
6346
6613
  }
6347
6614
  }
6348
6615
  function getWatchdogProjectSettingsPath(cwd) {
6349
- return path20.join(getProjectConfigDir(cwd), "settings.json");
6616
+ return path21.join(getProjectConfigDir(cwd), "settings.json");
6350
6617
  }
6351
6618
  function deepMerge(base, patch) {
6352
6619
  let next = { ...base };
@@ -6390,7 +6657,7 @@ function targetSettingsObject(watchdog, target, meta) {
6390
6657
  return ensureObjectField(overrides, target.agent.trim(), `subagents.watchdog.children.overrides.${target.agent.trim()}`, meta);
6391
6658
  }
6392
6659
  function writeSettingsFile(settingsPath, settings) {
6393
- return fs19.mkdirSync(path20.dirname(settingsPath), { recursive: !0 }), fs19.writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}
6660
+ return fs20.mkdirSync(path21.dirname(settingsPath), { recursive: !0 }), fs20.writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}
6394
6661
  `, "utf-8"), settingsPath;
6395
6662
  }
6396
6663
  function writeUserWatchdogEnabled(enabled) {
@@ -6408,7 +6675,7 @@ function resolveWatchdogConfig(cwd, options = {}) {
6408
6675
  ];
6409
6676
  for (let source of sourceSpecs)
6410
6677
  if (source.path) {
6411
- sources.push({ scope: source.scope, path: source.path, exists: fs19.existsSync(source.path) });
6678
+ sources.push({ scope: source.scope, path: source.path, exists: fs20.existsSync(source.path) });
6412
6679
  try {
6413
6680
  patch = deepMerge(patch, parseSourceFile(source.path, source.scope));
6414
6681
  } catch (error) {
@@ -6682,8 +6949,8 @@ import { createHash as createHash4 } from "node:crypto";
6682
6949
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/change-signature.js
6683
6950
  import { spawnSync as spawnSync2 } from "node:child_process";
6684
6951
  import { createHash as createHash2 } from "node:crypto";
6685
- import * as fs20 from "node:fs";
6686
- import * as path21 from "node:path";
6952
+ import * as fs21 from "node:fs";
6953
+ import * as path22 from "node:path";
6687
6954
  var IGNORED_CHANGE_PREFIXES = [".pi-subagents/", "tmp/", "node_modules/"], IGNORED_CHANGE_PATHS = /* @__PURE__ */ new Set([".pi-subagents", "tmp", "node_modules"]);
6688
6955
  function git(cwd, args) {
6689
6956
  let result = spawnSync2("git", ["-C", cwd, ...args], { encoding: "utf-8", maxBuffer: 10485760 });
@@ -6691,28 +6958,28 @@ function git(cwd, args) {
6691
6958
  return result.stdout;
6692
6959
  }
6693
6960
  function normalizeRelPath(value) {
6694
- return value.replaceAll(path21.sep, "/").replace(/^\.\//, "");
6961
+ return value.replaceAll(path22.sep, "/").replace(/^\.\//, "");
6695
6962
  }
6696
6963
  function ignoredRelPath(relPath) {
6697
6964
  let normalized = normalizeRelPath(relPath);
6698
6965
  return IGNORED_CHANGE_PATHS.has(normalized) || IGNORED_CHANGE_PREFIXES.some((prefix) => normalized.startsWith(prefix));
6699
6966
  }
6700
6967
  function hashFile(filePath) {
6701
- return createHash2("sha256").update(fs20.readFileSync(filePath)).digest("hex");
6968
+ return createHash2("sha256").update(fs21.readFileSync(filePath)).digest("hex");
6702
6969
  }
6703
6970
  function hashPath(root, relPath) {
6704
- let normalized = normalizeRelPath(relPath), fullPath = path21.join(root, normalized), stat;
6971
+ let normalized = normalizeRelPath(relPath), fullPath = path22.join(root, normalized), stat;
6705
6972
  try {
6706
- stat = fs20.lstatSync(fullPath);
6973
+ stat = fs21.lstatSync(fullPath);
6707
6974
  } catch (error) {
6708
6975
  if (error.code === "ENOENT")
6709
6976
  return { path: normalized, state: "deleted" };
6710
6977
  throw error;
6711
6978
  }
6712
6979
  if (stat.isSymbolicLink())
6713
- return { path: normalized, state: "symlink", target: fs20.readlinkSync(fullPath) };
6980
+ return { path: normalized, state: "symlink", target: fs21.readlinkSync(fullPath) };
6714
6981
  if (stat.isDirectory()) {
6715
- let entries = fs20.readdirSync(fullPath).map((entry) => normalizeRelPath(path21.posix.join(normalized, entry))).filter((entry) => !ignoredRelPath(entry)).sort();
6982
+ let entries = fs21.readdirSync(fullPath).map((entry) => normalizeRelPath(path22.posix.join(normalized, entry))).filter((entry) => !ignoredRelPath(entry)).sort();
6716
6983
  return { path: normalized, state: "dir", entries: entries.map((entry) => hashPath(root, entry)) };
6717
6984
  }
6718
6985
  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 +7112,8 @@ var WatchdogEmissionGuard = class {
6845
7112
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/watchdog/lsp-diagnostics.js
6846
7113
  import { spawn as spawn2 } from "node:child_process";
6847
7114
  import { createHash as createHash3 } from "node:crypto";
6848
- import * as fs21 from "node:fs";
6849
- import * as path22 from "node:path";
7115
+ import * as fs22 from "node:fs";
7116
+ import * as path23 from "node:path";
6850
7117
  import { pathToFileURL } from "node:url";
6851
7118
  var TS_JS_EXTENSIONS = /* @__PURE__ */ new Map([
6852
7119
  [".ts", "typescript"],
@@ -6859,14 +7126,14 @@ var TS_JS_EXTENSIONS = /* @__PURE__ */ new Map([
6859
7126
  [".cjs", "javascript"]
6860
7127
  ]), PROVIDER_NAME = "typescript-language-server", MAX_MESSAGE_LENGTH = 500, MAX_STDERR_LENGTH = 2e3, SHUTDOWN_TIMEOUT_MS = 250;
6861
7128
  function normalizeRelPath2(value) {
6862
- return value.replaceAll(path22.sep, "/").replace(/^\.\//, "");
7129
+ return value.replaceAll(path23.sep, "/").replace(/^\.\//, "");
6863
7130
  }
6864
7131
  function isPathInsideRoot(absPath, root) {
6865
- let rel = path22.relative(root, absPath);
6866
- return rel === "" || !rel.startsWith("..") && !path22.isAbsolute(rel);
7132
+ let rel = path23.relative(root, absPath);
7133
+ return rel === "" || !rel.startsWith("..") && !path23.isAbsolute(rel);
6867
7134
  }
6868
7135
  function languageIdForPath(filePath) {
6869
- return TS_JS_EXTENSIONS.get(path22.extname(filePath).toLowerCase());
7136
+ return TS_JS_EXTENSIONS.get(path23.extname(filePath).toLowerCase());
6870
7137
  }
6871
7138
  function trimDiagnosticMessage(message) {
6872
7139
  let normalized = message.replace(/\s+/g, " ").trim();
@@ -6877,7 +7144,7 @@ function severityFromLsp(value) {
6877
7144
  }
6878
7145
  function pathExecutable(filePath) {
6879
7146
  try {
6880
- return fs21.statSync(filePath).isFile() ? (process.platform === "win32" || fs21.accessSync(filePath, fs21.constants.X_OK), !0) : !1;
7147
+ return fs22.statSync(filePath).isFile() ? (process.platform === "win32" || fs22.accessSync(filePath, fs22.constants.X_OK), !0) : !1;
6881
7148
  } catch {
6882
7149
  return !1;
6883
7150
  }
@@ -6890,13 +7157,13 @@ function pathExecutableNames(name) {
6890
7157
  }
6891
7158
  function resolveTypeScriptLanguageServer(root) {
6892
7159
  for (let name of pathExecutableNames(PROVIDER_NAME)) {
6893
- let local = path22.join(root, "node_modules", ".bin", name);
7160
+ let local = path23.join(root, "node_modules", ".bin", name);
6894
7161
  if (pathExecutable(local))
6895
7162
  return { command: local, args: ["--stdio"], label: `${PROVIDER_NAME} (project)` };
6896
7163
  }
6897
- for (let dir of (process.env.PATH ?? "").split(path22.delimiter).filter(Boolean))
7164
+ for (let dir of (process.env.PATH ?? "").split(path23.delimiter).filter(Boolean))
6898
7165
  for (let name of pathExecutableNames(PROVIDER_NAME)) {
6899
- let candidate = path22.join(dir, name);
7166
+ let candidate = path23.join(dir, name);
6900
7167
  if (pathExecutable(candidate))
6901
7168
  return { command: candidate, args: ["--stdio"], label: PROVIDER_NAME };
6902
7169
  }
@@ -6904,14 +7171,14 @@ function resolveTypeScriptLanguageServer(root) {
6904
7171
  function collectTargetFiles(root, changedPaths, maxFiles) {
6905
7172
  let targets = [], skippedPaths = [];
6906
7173
  for (let changedPath of changedPaths) {
6907
- let relPath = normalizeRelPath2(changedPath), absPath = path22.resolve(root, relPath), languageId = languageIdForPath(absPath);
7174
+ let relPath = normalizeRelPath2(changedPath), absPath = path23.resolve(root, relPath), languageId = languageIdForPath(absPath);
6908
7175
  if (!languageId || !isPathInsideRoot(absPath, root)) {
6909
7176
  skippedPaths.push(relPath);
6910
7177
  continue;
6911
7178
  }
6912
7179
  let stat;
6913
7180
  try {
6914
- stat = fs21.statSync(absPath);
7181
+ stat = fs22.statSync(absPath);
6915
7182
  } catch (error) {
6916
7183
  if (error.code === "ENOENT") {
6917
7184
  skippedPaths.push(relPath);
@@ -7138,7 +7405,7 @@ function initializeParams(root) {
7138
7405
  },
7139
7406
  workspace: { configuration: !1, workspaceFolders: !0 }
7140
7407
  },
7141
- workspaceFolders: [{ uri: rootUri, name: path22.basename(root) || "workspace" }]
7408
+ workspaceFolders: [{ uri: rootUri, name: path23.basename(root) || "workspace" }]
7142
7409
  };
7143
7410
  }
7144
7411
  async function waitForDiagnostics(client, targets, timeoutMs, signal) {
@@ -7161,7 +7428,7 @@ async function collectWithTypeScriptLanguageServer(input) {
7161
7428
  try {
7162
7429
  await client.request("initialize", initializeParams(input.root), remaining(), input.signal), client.notify("initialized", {});
7163
7430
  for (let target of input.targets) {
7164
- let text = fs21.readFileSync(target.absPath, "utf-8");
7431
+ let text = fs22.readFileSync(target.absPath, "utf-8");
7165
7432
  client.notify("textDocument/didOpen", {
7166
7433
  textDocument: { uri: target.uri, languageId: target.languageId, version: 1, text }
7167
7434
  }), client.notify("textDocument/didSave", {
@@ -7195,7 +7462,7 @@ async function collectWithTypeScriptLanguageServer(input) {
7195
7462
  async function collectWatchdogLspDiagnostics(request) {
7196
7463
  if (!request.config.enabled)
7197
7464
  return { status: "disabled", checkedPaths: [], skippedPaths: [], diagnostics: [] };
7198
- let root = path22.resolve(request.root || request.cwd), { targets, skippedPaths } = collectTargetFiles(root, request.changedPaths, request.config.maxFiles);
7465
+ let root = path23.resolve(request.root || request.cwd), { targets, skippedPaths } = collectTargetFiles(root, request.changedPaths, request.config.maxFiles);
7199
7466
  if (!targets.length)
7200
7467
  return {
7201
7468
  status: "skipped",
@@ -7904,7 +8171,7 @@ function buildWatchdogStatus(snapshot, ctx) {
7904
8171
  `Auto-follow: not implemented${snapshot.autoFollowQueued ? " (queued)" : ""}`,
7905
8172
  `Review model call: ${snapshot.reviewDescription}`
7906
8173
  ];
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(`
8174
+ 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
8175
  `);
7909
8176
  }
7910
8177
  function parseTestCommand(input) {
@@ -8157,6 +8424,9 @@ function registerMainWatchdog(pi, options = {}) {
8157
8424
  }), runtime;
8158
8425
  }
8159
8426
 
8427
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js
8428
+ 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.";
8429
+
8160
8430
  export {
8161
8431
  childRowLabel,
8162
8432
  SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
@@ -8185,7 +8455,6 @@ export {
8185
8455
  SLASH_SUBAGENT_UPDATE_EVENT,
8186
8456
  SLASH_SUBAGENT_CANCEL_EVENT,
8187
8457
  POLL_INTERVAL_MS,
8188
- MAX_WIDGET_JOBS,
8189
8458
  SUBAGENT_ACTIONS,
8190
8459
  DEFAULT_FORK_PREAMBLE,
8191
8460
  resolveTopLevelParallelMaxTasks,
@@ -8222,7 +8491,6 @@ export {
8222
8491
  buildChainInstructions,
8223
8492
  resolveParallelBehaviors,
8224
8493
  createParallelDirs,
8225
- THINKING_LEVELS,
8226
8494
  toModelInfo,
8227
8495
  resolveEffectiveThinking,
8228
8496
  splitKnownThinkingSuffix,
@@ -8230,6 +8498,7 @@ export {
8230
8498
  getSupportedThinkingLevels,
8231
8499
  formatTokens,
8232
8500
  formatModelSelection,
8501
+ formatCompactModelBadge,
8233
8502
  formatUsage,
8234
8503
  formatDuration,
8235
8504
  buildChainSummary,
@@ -8284,8 +8553,8 @@ export {
8284
8553
  splitThinkingSuffix,
8285
8554
  resolveModelCandidate,
8286
8555
  resolveEffectiveSubagentModel,
8287
- resolveRequiredTierModel,
8288
8556
  captureModelSelection,
8557
+ resolveExecutableChildModel,
8289
8558
  buildModelCandidates,
8290
8559
  isRetryableModelFailure,
8291
8560
  formatModelAttemptNote,
@@ -8295,11 +8564,10 @@ export {
8295
8564
  normalizeParallelGroups,
8296
8565
  flatToLogicalStepIndex,
8297
8566
  formatActivityLabel,
8298
- aggregateStepStatus,
8299
8567
  formatAgentRunningLabel,
8300
- formatParallelOutcome,
8301
8568
  formatNestedAggregate,
8302
8569
  formatNestedRunStatusLines,
8570
+ resolveSubagentRequestParams,
8303
8571
  DEFAULT_CONTROL_CONFIG,
8304
8572
  resolveControlConfig,
8305
8573
  deriveActivityState,
@@ -8310,7 +8578,6 @@ export {
8310
8578
  formatControlIntercomMessage,
8311
8579
  writeAtomicJson,
8312
8580
  writePrivateAtomicJson,
8313
- assertSafeNestedId,
8314
8581
  createNestedRoute,
8315
8582
  resolveInheritedNestedRouteFromEnv,
8316
8583
  resolveNestedParentAddressFromEnv,
@@ -8318,7 +8585,6 @@ export {
8318
8585
  sanitizeSummary,
8319
8586
  findNestedRouteForRootId,
8320
8587
  projectNestedRegistryForRoot,
8321
- findNestedRunMatchesById,
8322
8588
  writeNestedEvent,
8323
8589
  writeNestedControlRequest,
8324
8590
  readNestedControlResults,
@@ -8337,6 +8603,7 @@ export {
8337
8603
  resolveSubagentResultStatus,
8338
8604
  compactNestedResultChildren,
8339
8605
  attachNestedChildrenToResultChildren,
8606
+ formatNestedResultLines,
8340
8607
  buildSubagentResultIntercomPayload,
8341
8608
  deliverSubagentResultIntercomEvent,
8342
8609
  deliverSubagentIntercomMessageEvent,
@@ -8344,6 +8611,7 @@ export {
8344
8611
  formatSubagentResultReceipt,
8345
8612
  expectsImplementationMutation,
8346
8613
  validateAcceptanceInput,
8614
+ restorePersistedAcceptance,
8347
8615
  validateExecutionAcceptance,
8348
8616
  resolveEffectiveAcceptance,
8349
8617
  formatAcceptancePrompt,
@@ -8352,6 +8620,9 @@ export {
8352
8620
  evaluateAcceptance,
8353
8621
  buildSkippedAcceptanceLedger,
8354
8622
  acceptanceFailureMessage,
8623
+ normalizeAsyncLaunchConfig,
8624
+ subagentLaunchRunsAsync,
8625
+ isAsyncSubagentExecution,
8355
8626
  inspectSubagentFleet,
8356
8627
  formatAsyncRunTranscript,
8357
8628
  formatNestedRunTranscript,
@@ -8364,28 +8635,28 @@ export {
8364
8635
  initialTurnBudgetState,
8365
8636
  turnBudgetState,
8366
8637
  shouldAbortForTurnBudget,
8367
- parseWatchdogThinkingInput,
8368
8638
  resolveWatchdogModelInput,
8369
8639
  recommendStrongWatchdogModel,
8370
- writeWatchdogModelSettings,
8371
8640
  resolveWatchdogConfig,
8372
8641
  buildWatchdogStatus,
8373
8642
  registerMainWatchdog,
8643
+ requestAsyncSteer,
8644
+ readSteerCapability,
8645
+ consumeSteerAcks,
8646
+ deliverInterruptRequest,
8647
+ deliverStopRequest,
8374
8648
  INTERCOM_BRIDGE_MARKER,
8375
8649
  resolveIntercomSessionTarget,
8376
8650
  resolveSubagentIntercomTarget,
8377
8651
  diagnoseIntercomBridge,
8378
8652
  resolveIntercomBridge,
8379
8653
  applyIntercomBridgeToAgent,
8380
- requestAsyncSteer,
8381
- consumeSteerAcks,
8382
- deliverInterruptRequest,
8383
- deliverStopRequest,
8384
8654
  interruptLiveAsyncResumeTarget,
8385
- findAsyncRunPrefixMatches,
8386
8655
  resolveAsyncRunLocation,
8387
8656
  resolveAsyncResumeTarget,
8388
8657
  buildRevivedAsyncTask,
8658
+ resolveSubagentRunId,
8659
+ SUBAGENT_ASYNC_GUIDANCE,
8389
8660
  SUBAGENT_CONTROL_MESSAGE_TYPE,
8390
8661
  clearPendingForegroundControlNotices,
8391
8662
  handleSubagentControlNotice