@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
@@ -14,6 +14,7 @@ import {
14
14
  PI_CODING_AGENT_PACKAGE_ROOT_ENV,
15
15
  RESULTS_DIR,
16
16
  SUBAGENT_ACTIONS,
17
+ SUBAGENT_ASYNC_GUIDANCE,
17
18
  SUBAGENT_ASYNC_STARTED_EVENT,
18
19
  SUBAGENT_CONTROL_EVENT,
19
20
  SUBAGENT_CONTROL_INTERCOM_EVENT,
@@ -21,7 +22,6 @@ import {
21
22
  SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
22
23
  Semaphore,
23
24
  TEMP_ROOT_DIR,
24
- THINKING_LEVELS,
25
25
  acceptChildWatchdogEvent,
26
26
  acceptanceFailureMessage,
27
27
  aggregateAcceptanceReport,
@@ -30,7 +30,6 @@ import {
30
30
  appendTurnBudgetSystemPrompt,
31
31
  applyIntercomBridgeToAgent,
32
32
  applyThinkingSuffix,
33
- assertSafeNestedId,
34
33
  attachNestedChildrenToResultChildren,
35
34
  attachRootChildrenToSteps,
36
35
  buildChainInstructions,
@@ -69,11 +68,9 @@ import {
69
68
  expectsImplementationMutation,
70
69
  extractTextFromContent,
71
70
  extractToolArgsPreview,
72
- findAsyncRunPrefixMatches,
73
71
  findLatestSessionFile,
74
72
  findModelInfo,
75
73
  findNestedRouteForRootId,
76
- findNestedRunMatchesById,
77
74
  flatToLogicalStepIndex,
78
75
  formatAcceptancePrompt,
79
76
  formatActivityLabel,
@@ -116,7 +113,6 @@ import {
116
113
  normalizeChildSpec,
117
114
  normalizeParallelGroups,
118
115
  normalizeSkillInput,
119
- parseWatchdogThinkingInput,
120
116
  projectNestedRegistryForRoot,
121
117
  readChildToolDiagnosticError,
122
118
  readNestedControlResults,
@@ -140,6 +136,7 @@ import {
140
136
  resolveEffectiveAcceptance,
141
137
  resolveEffectiveSubagentModel,
142
138
  resolveEffectiveThinking,
139
+ resolveExecutableChildModel,
143
140
  resolveInheritedNestedRouteFromEnv,
144
141
  resolveIntercomBridge,
145
142
  resolveIntercomSessionTarget,
@@ -148,22 +145,25 @@ import {
148
145
  resolveNestedAsyncDir,
149
146
  resolveNestedParentAddressFromEnv,
150
147
  resolveParallelBehaviors,
151
- resolveRequiredTierModel,
152
148
  resolveSkillsWithFallback,
153
149
  resolveStepBehavior,
154
150
  resolveSubagentIntercomTarget,
151
+ resolveSubagentRequestParams,
155
152
  resolveSubagentResultStatus,
153
+ resolveSubagentRunId,
156
154
  resolveTopLevelParallelConcurrency,
157
155
  resolveTopLevelParallelMaxTasks,
158
156
  resolveTurnBudgetConfig,
159
157
  resolveWatchdogConfig,
160
158
  resolveWatchdogModelInput,
159
+ restorePersistedAcceptance,
161
160
  shouldAbortForTurnBudget,
162
161
  shouldNotifyControlEvent,
163
162
  splitKnownThinkingSuffix,
164
163
  splitThinkingSuffix,
165
164
  stripAcceptanceReport,
166
165
  stripDetailsOutputsForIntercomReceipt,
166
+ subagentLaunchRunsAsync,
167
167
  sumResultsCost,
168
168
  sumResultsUsage,
169
169
  suppressProgressForReadOnlyTask,
@@ -186,27 +186,26 @@ import {
186
186
  writeMetadata,
187
187
  writeNestedControlRequest,
188
188
  writeNestedEvent,
189
- writePrivateAtomicJson,
190
- writeWatchdogModelSettings
191
- } from "./chunk-MUMMMTW4.js";
189
+ writePrivateAtomicJson
190
+ } from "./chunk-N3PNL74S.js";
192
191
  import {
193
192
  PLAN_MODE_WRITE_SPAWN_ERROR,
194
193
  resolveChildPermissions,
195
194
  snapshotParentPermissionMode
196
- } from "./chunk-MGSB2C3M.js";
197
- import "./chunk-K72NVGUB.js";
195
+ } from "./chunk-ZVSORYRM.js";
196
+ import "./chunk-GT5F3OKM.js";
198
197
  import "./chunk-53YJI7JU.js";
199
198
  import "./chunk-GZQHMEWL.js";
200
199
  import "./chunk-ZCHMJ34K.js";
201
- import "./chunk-5Q45AVQG.js";
202
- import "./chunk-ZRDIMBEQ.js";
203
- import "./chunk-M3LZLQW2.js";
204
- import "./chunk-5OLJGVCB.js";
205
200
  import {
206
201
  SessionManager
207
202
  } from "./chunk-6UB6NKA3.js";
208
203
  import "./chunk-FVDOXRUD.js";
209
- import "./chunk-ZSEZY3II.js";
204
+ import "./chunk-MW2XJZIK.js";
205
+ import "./chunk-D466UAID.js";
206
+ import "./chunk-M3LZLQW2.js";
207
+ import "./chunk-VTPM5V35.js";
208
+ import "./chunk-3ONQTOMR.js";
210
209
  import "./chunk-RQ2Q5IYR.js";
211
210
  import "./chunk-C4O2RSQQ.js";
212
211
  import "./chunk-MX3GJNXJ.js";
@@ -216,8 +215,8 @@ import "./chunk-BRJX2PRC.js";
216
215
 
217
216
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js
218
217
  import { randomUUID as randomUUID4 } from "node:crypto";
219
- import * as fs16 from "node:fs";
220
- import * as path16 from "node:path";
218
+ import * as fs15 from "node:fs";
219
+ import * as path15 from "node:path";
221
220
 
222
221
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-clarify.js
223
222
  import { matchesKey, visibleWidth, truncateToWidth } from "@ashx-j/lunr-tui";
@@ -900,34 +899,6 @@ var ChainClarifyComponent = class {
900
899
  }
901
900
  };
902
901
 
903
- // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js
904
- var LAUNCH_COMPATIBLE_ACTIONS = /* @__PURE__ */ new Set(["schedule", "append-step", "resume", "steer"]);
905
- function omitExecutionModeActionAlias(params) {
906
- let action = params.action?.toLowerCase();
907
- if (action === "single" && params.task !== void 0) {
908
- let rest = { ...params };
909
- return delete rest.action, rest;
910
- }
911
- if ((action === "parallel" || action === "tasks") && (params.tasks?.length ?? 0) > 0) {
912
- let rest = { ...params };
913
- return delete rest.action, rest;
914
- }
915
- return params;
916
- }
917
- function hasLaunchFields(params) {
918
- return params.task !== void 0 || Array.isArray(params.tasks) && params.tasks.length > 0 || Array.isArray(params.chain) && params.chain.length > 0;
919
- }
920
- function omitConflictingControlAction(params) {
921
- let action = params.action?.toLowerCase();
922
- if (!action || LAUNCH_COMPATIBLE_ACTIONS.has(action) || !hasLaunchFields(params))
923
- return params;
924
- let rest = { ...params };
925
- return delete rest.action, typeof rest.task == "string" && rest.task.length > 0 && (delete rest.tasks, delete rest.chain), rest;
926
- }
927
- function resolveSubagentRequestParams(params) {
928
- return omitConflictingControlAction(omitExecutionModeActionAlias(params));
929
- }
930
-
931
902
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js
932
903
  import * as fs7 from "node:fs";
933
904
  import * as path6 from "node:path";
@@ -1229,7 +1200,7 @@ function hasMutationToolCall(messages) {
1229
1200
  return !1;
1230
1201
  }
1231
1202
  function evaluateCompletionMutationGuard(input) {
1232
- let expectedMutation = hasMutationToolCapability(input.tools, input.mcpDirectTools) ? expectsImplementationMutation(input.agent, input.task) : !1, attemptedMutation = hasMutationToolCall(input.messages);
1203
+ let expectedMutation = hasMutationToolCapability(input.tools, input.mcpDirectTools) ? expectsImplementationMutation(input.permissions, input.task) : !1, attemptedMutation = hasMutationToolCall(input.messages);
1233
1204
  return {
1234
1205
  expectedMutation,
1235
1206
  attemptedMutation,
@@ -1262,20 +1233,20 @@ function resolvePiPackageRoot() {
1262
1233
  return;
1263
1234
  }
1264
1235
  }
1265
- function isRunnableNodeScript(filePath, existsSync12) {
1266
- return existsSync12(filePath) ? /\.(?:mjs|cjs|js)$/i.test(filePath) : !1;
1236
+ function isRunnableNodeScript(filePath, existsSync11) {
1237
+ return existsSync11(filePath) ? /\.(?:mjs|cjs|js)$/i.test(filePath) : !1;
1267
1238
  }
1268
1239
  function normalizePath(filePath) {
1269
1240
  return path2.isAbsolute(filePath) ? filePath : path2.resolve(filePath);
1270
1241
  }
1271
1242
  function resolvePiCliScript(deps = {}) {
1272
- let existsSync12 = deps.existsSync ?? fs2.existsSync, realpathSync5 = deps.realpathSync ?? fs2.realpathSync, readFileSync8 = deps.readFileSync ?? ((filePath, encoding) => fs2.readFileSync(filePath, encoding)), argv1 = deps.argv1 ?? process.argv[1];
1243
+ let existsSync11 = deps.existsSync ?? fs2.existsSync, realpathSync5 = deps.realpathSync ?? fs2.realpathSync, readFileSync8 = deps.readFileSync ?? ((filePath, encoding) => fs2.readFileSync(filePath, encoding)), argv1 = deps.argv1 ?? process.argv[1];
1273
1244
  if (argv1) {
1274
1245
  let argvPath = normalizePath(argv1);
1275
- if (isRunnableNodeScript(argvPath, existsSync12))
1246
+ if (isRunnableNodeScript(argvPath, existsSync11))
1276
1247
  try {
1277
1248
  let canonicalArgvPath = realpathSync5(argvPath);
1278
- if (isRunnableNodeScript(canonicalArgvPath, existsSync12) && findPiPackageRootFromEntry(canonicalArgvPath))
1249
+ if (isRunnableNodeScript(canonicalArgvPath, existsSync11) && findPiPackageRootFromEntry(canonicalArgvPath))
1279
1250
  return canonicalArgvPath;
1280
1251
  } catch {
1281
1252
  }
@@ -1293,7 +1264,7 @@ function resolvePiCliScript(deps = {}) {
1293
1264
  if (!binPath)
1294
1265
  return;
1295
1266
  let candidate = path2.resolve(path2.dirname(packageJsonPath), binPath);
1296
- if (isRunnableNodeScript(candidate, existsSync12))
1267
+ if (isRunnableNodeScript(candidate, existsSync11))
1297
1268
  return candidate;
1298
1269
  } catch {
1299
1270
  return;
@@ -2166,7 +2137,7 @@ ${fullOutput}` : timeoutMessage;
2166
2137
  ${fullOutput}` : note;
2167
2138
  }
2168
2139
  if ((result2.exitCode === 0 && !result2.error ? evaluateCompletionMutationGuard({
2169
- agent: spec.effectivePermissions,
2140
+ permissions: spec.effectivePermissions,
2170
2141
  task: shared.originalTask ?? task,
2171
2142
  messages: result2.messages,
2172
2143
  tools: spec.effectivePermissions === "read-only" ? ["read", "grep", "find", "ls", "bash"] : void 0
@@ -3296,10 +3267,13 @@ function resolveChainToolBudget(input) {
3296
3267
  return { toolBudget: resolved.budget, error: resolved.error };
3297
3268
  }
3298
3269
  async function runParallelChainTasks(input) {
3299
- let concurrency = input.step.concurrency ?? MAX_CONCURRENCY, failFast = input.step.failFast ?? !1, aborted = !1, effectiveModels = input.step.parallel.map((task) => {
3300
- let taskChildConfig = input.agents.find((child) => child.name === task.agent);
3301
- return resolveRequiredTierModel(task.tier, input.availableModels, input.ctx.model?.provider);
3302
- });
3270
+ let concurrency = input.step.concurrency ?? MAX_CONCURRENCY, failFast = input.step.failFast ?? !1, aborted = !1, effectiveModels = input.step.parallel.map((task) => resolveExecutableChildModel({
3271
+ model: task.model,
3272
+ tier: task.tier,
3273
+ thinking: task.thinking,
3274
+ availableModels: input.availableModels,
3275
+ preferredProvider: input.ctx.model?.provider
3276
+ }));
3303
3277
  for (let taskIndex = 0; taskIndex < input.step.parallel.length; taskIndex++) {
3304
3278
  let task = input.step.parallel[taskIndex];
3305
3279
  input.sessionFileForTask?.(task.agent, input.globalTaskIndex + taskIndex, effectiveModels[taskIndex]);
@@ -3329,9 +3303,10 @@ async function runParallelChainTasks(input) {
3329
3303
  task: taskStr,
3330
3304
  description: task.description,
3331
3305
  permissions: task.permissions,
3332
- model: effectiveModel ?? task.model,
3306
+ model: task.model,
3333
3307
  tier: task.tier,
3334
- modelSelection: captureModelSelection({ tier: task.tier }),
3308
+ thinking: task.thinking,
3309
+ modelSelection: captureModelSelection({ model: task.model, tier: task.tier }),
3335
3310
  skill: task.skill,
3336
3311
  cwd: taskCwd,
3337
3312
  output: task.output,
@@ -3836,7 +3811,13 @@ ${failureSummary}`;
3836
3811
  stepTask = stepTask.replace(/\{task\}/g, originalTask), stepTask = stepTask.replace(/\{previous\}/g, prev), stepTask = stepTask.replace(/\{chain_dir\}/g, chainDir);
3837
3812
  let cleanTask = stepTask;
3838
3813
  stepTask = prefix + stepTask + suffix;
3839
- let effectiveModel = resolveRequiredTierModel(seqStep.tier, availableModels, ctx.model?.provider), outputPath = typeof behavior.output == "string" ? path6.isAbsolute(behavior.output) ? behavior.output : path6.join(chainDir, behavior.output) : void 0;
3814
+ let effectiveModel = resolveExecutableChildModel({
3815
+ model: seqStep.model,
3816
+ tier: seqStep.tier,
3817
+ thinking: seqStep.thinking,
3818
+ availableModels,
3819
+ preferredProvider: ctx.model?.provider
3820
+ }), outputPath = typeof behavior.output == "string" ? path6.isAbsolute(behavior.output) ? behavior.output : path6.join(chainDir, behavior.output) : void 0;
3840
3821
  stepTask = injectSingleOutputInstruction(stepTask, outputPath, agentConfig);
3841
3822
  let validationError = validateFileOnlyOutputMode(behavior.outputMode, outputPath, `Chain step ${stepIndex + 1} (${seqStep.agent})`);
3842
3823
  if (validationError)
@@ -3865,9 +3846,10 @@ ${failureSummary}`;
3865
3846
  task: stepTask,
3866
3847
  description: seqStep.description,
3867
3848
  permissions: seqStep.permissions,
3868
- model: effectiveModel ?? seqStep.model,
3849
+ model: seqStep.model,
3869
3850
  tier: seqStep.tier,
3870
- modelSelection: captureModelSelection({ tier: seqStep.tier }),
3851
+ thinking: seqStep.thinking,
3852
+ modelSelection: captureModelSelection({ model: seqStep.model, tier: seqStep.tier }),
3871
3853
  skill: seqStep.skill,
3872
3854
  cwd: seqStep.cwd,
3873
3855
  output: seqStep.output,
@@ -4028,9 +4010,8 @@ function formatAsyncStartedMessage(headline) {
4028
4010
  return [
4029
4011
  headline,
4030
4012
  "",
4031
- "The async run is detached. Do not run sleep timers or polling loops just to wait for it.",
4032
- "If you have independent work, continue that work. When you have nothing left to do until the async result arrives, call subagent_wait() \u2014 it blocks until the run finishes and delivers the completion here. Only if you are certain you will get another turn (an interactive session where the user will prompt you again) can you instead stop and let Pi wake you; inside a skill that must run to completion, or in a non-interactive run, there is no next turn, so use subagent_wait().",
4033
- 'Use subagent({ action: "status", id: "..." }) when you need a one-shot status/result or to inspect a blocked/stale run. To block until completion, prefer subagent_wait(). Do not poll in a loop just to wait.'
4013
+ SUBAGENT_ASYNC_GUIDANCE,
4014
+ 'For one-time inspection or recovery of a blocked or stale run, use subagent({ action: "status", id: "..." }).'
4034
4015
  ].join(`
4035
4016
  `);
4036
4017
  }
@@ -4266,7 +4247,14 @@ ${injection}` : injection;
4266
4247
  taskTemplate = taskTemplate.replace(/\{task\}/g, originalTask ?? ""), taskTemplate = taskTemplate.replace(/\{chain_dir\}/g, runnerCwd);
4267
4248
  let taskText = `${readInstructions.prefix}${taskTemplate}${progressInstructions.suffix}`, task = namespaceOutputPath ? taskText : injectSingleOutputInstruction(taskText, outputPath, {
4268
4249
  tools: spec.effectivePermissions === "read-only" ? ["read", "grep", "find", "ls", "bash"] : void 0
4269
- }), primaryModel = resolveRequiredTierModel(spec.tier, availableModels, ctx.currentModelProvider), thinkingOverride = flatIndex === void 0 ? void 0 : thinkingOverridesByFlatIndex?.[flatIndex], effectiveThinking = thinkingOverride, model = applyThinkingSuffix(primaryModel, effectiveThinking, thinkingOverride !== void 0);
4250
+ }), primaryModel = resolveExecutableChildModel({
4251
+ modelSelection: spec.modelSelection,
4252
+ model: spec.model,
4253
+ tier: spec.tier,
4254
+ thinking: spec.thinking,
4255
+ availableModels,
4256
+ preferredProvider: ctx.currentModelProvider
4257
+ }), thinkingOverride = flatIndex === void 0 ? void 0 : thinkingOverridesByFlatIndex?.[flatIndex], effectiveThinking = thinkingOverride, model = applyThinkingSuffix(primaryModel, effectiveThinking, thinkingOverride !== void 0);
4270
4258
  return {
4271
4259
  parentSessionId: ctx.parentSessionId ?? ctx.currentSessionId,
4272
4260
  parentPermissionMode: snapshotParentPermissionMode(ctx.parentSessionId ?? ctx.currentSessionId),
@@ -4558,6 +4546,16 @@ function executeAsyncChain(id, params) {
4558
4546
  details: { mode: resultMode, runId: id, results: [], asyncId: id, asyncDir, workflowGraph, ...params.timeoutMs !== void 0 ? { timeoutMs: params.timeoutMs, deadlineAt } : {}, ...params.turnBudget ? { turnBudget: params.turnBudget } : {}, ...params.toolBudget ? { toolBudget: params.toolBudget } : {} }
4559
4547
  };
4560
4548
  }
4549
+ function resolveAsyncSingleAcceptance(input) {
4550
+ return input.restoredAcceptance ? input.restoredAcceptance : resolveEffectiveAcceptance({
4551
+ explicit: input.launchAcceptance,
4552
+ agentName: input.agentName,
4553
+ permissions: input.permissions,
4554
+ task: input.task,
4555
+ mode: "single",
4556
+ async: !0
4557
+ });
4558
+ }
4561
4559
  function executeAsyncSingle(id, params) {
4562
4560
  let { spec, ctx, cwd, maxOutput, artifactsDir, artifactConfig, shareEnabled, sessionRoot, sessionFile, maxSubagentDepth, worktreeSetupHook, worktreeSetupHookTimeoutMs, worktreeBaseDir, controlConfig, controlIntercomTarget, childIntercomTarget, nestedRoute } = params, agent = spec.description, task = spec.task, runnerCwd = resolveChildCwd(ctx.cwd, cwd), skillNames = params.skills ?? (spec.skill === !1 ? [] : normalizeSkillInput(spec.skill) ?? []), availableModels = params.availableModels, { resolved: resolvedSkills, missing: missingSkills } = resolveSkillsWithFallback(skillNames, runnerCwd, ctx.cwd, void 0, runnerCwd);
4563
4561
  if (missingSkills.includes("pi-subagents"))
@@ -4585,19 +4583,25 @@ ${injection}` : injection;
4585
4583
  let outputMode = params.outputMode ?? spec.outputMode ?? "inline", validationError = validateFileOnlyOutputMode(outputMode, outputPath, `Async single run (${agent})`);
4586
4584
  if (validationError)
4587
4585
  return formatAsyncStartError("single", validationError);
4588
- let taskWithOutputInstruction = injectSingleOutputInstruction(task, outputPath, childToolShape), primaryModel = resolveRequiredTierModel(spec.tier, availableModels, ctx.currentModelProvider), effectiveThinking = params.thinkingOverride, model = applyThinkingSuffix(primaryModel, effectiveThinking, params.thinkingOverride !== void 0), toolBudgetInput = params.toolBudget ?? spec.toolBudget ?? params.configToolBudget, resolvedToolBudget = validateToolBudgetConfig(toolBudgetInput, params.toolBudget || spec.toolBudget ? "toolBudget" : "config.toolBudget");
4586
+ let taskWithOutputInstruction = injectSingleOutputInstruction(task, outputPath, childToolShape), primaryModel = resolveExecutableChildModel({
4587
+ modelSelection: spec.modelSelection,
4588
+ model: spec.model,
4589
+ tier: spec.tier,
4590
+ thinking: spec.thinking,
4591
+ availableModels,
4592
+ preferredProvider: ctx.currentModelProvider
4593
+ }), effectiveThinking = params.thinkingOverride, model = applyThinkingSuffix(primaryModel, effectiveThinking, params.thinkingOverride !== void 0), toolBudgetInput = params.toolBudget ?? spec.toolBudget ?? params.configToolBudget, resolvedToolBudget = validateToolBudgetConfig(toolBudgetInput, params.toolBudget || spec.toolBudget ? "toolBudget" : "config.toolBudget");
4589
4594
  if (resolvedToolBudget.error)
4590
4595
  return formatAsyncStartError("single", resolvedToolBudget.error);
4591
4596
  let deadlineAt = params.absoluteDeadlineAt ?? (params.timeoutMs !== void 0 ? Date.now() + params.timeoutMs : void 0), timeoutMs = params.absoluteDeadlineAt !== void 0 && deadlineAt !== void 0 ? deadlineAt - Date.now() : params.timeoutMs;
4592
4597
  if (timeoutMs !== void 0 && timeoutMs <= 0)
4593
4598
  return formatAsyncStartError("single", "The source run's absolute deadline expired before recovery could launch.");
4594
- let initialTurnBudget = params.turnBudget ? initialTurnBudgetState(params.turnBudget) : void 0, resolvedSessionDir = params.sessionDir ?? (sessionRoot ? path7.join(sessionRoot, `async-${id}`) : void 0), resolvedAcceptance = resolveEffectiveAcceptance({
4595
- explicit: params.acceptance ?? spec.acceptance,
4599
+ let initialTurnBudget = params.turnBudget ? initialTurnBudgetState(params.turnBudget) : void 0, resolvedSessionDir = params.sessionDir ?? (sessionRoot ? path7.join(sessionRoot, `async-${id}`) : void 0), resolvedAcceptance = resolveAsyncSingleAcceptance({
4600
+ restoredAcceptance: params.restoredAcceptance,
4601
+ launchAcceptance: params.acceptance ?? spec.acceptance,
4596
4602
  agentName: agent,
4597
4603
  permissions: spec.effectivePermissions,
4598
- task,
4599
- mode: "single",
4600
- async: !0
4604
+ task
4601
4605
  }), recoveryDescriptor = {
4602
4606
  version: 4,
4603
4607
  lifecycleArtifactVersion: SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
@@ -4609,8 +4613,8 @@ ${injection}` : injection;
4609
4613
  ...sessionFile ? { sessionFile } : {},
4610
4614
  cwd: runnerCwd,
4611
4615
  ...model ? { model } : {},
4612
- tier: spec.tier,
4613
- ...effectiveThinking ? { thinking: resolveEffectiveThinking(model, effectiveThinking) } : {},
4616
+ ...spec.tier ? { tier: spec.tier } : {},
4617
+ ...effectiveThinking || spec.thinking ? { thinking: resolveEffectiveThinking(model, effectiveThinking ?? spec.thinking) } : {},
4614
4618
  ...spec.modelSelection ? { modelSelection: spec.modelSelection } : {},
4615
4619
  ...resolvedSkills.length ? { skills: resolvedSkills.map((skill) => skill.name) } : {},
4616
4620
  ...outputPath ? { outputPath } : {},
@@ -4645,6 +4649,7 @@ ${injection}` : injection;
4645
4649
  permissions: spec.effectivePermissions,
4646
4650
  agent,
4647
4651
  task: taskWithOutputInstruction,
4652
+ completionTask: params.completionTask ?? task,
4648
4653
  cwd: runnerCwd,
4649
4654
  model,
4650
4655
  thinking: resolveEffectiveThinking(model, effectiveThinking),
@@ -4889,62 +4894,13 @@ function result(text, isError = !1) {
4889
4894
  function messageFromError(error) {
4890
4895
  return error instanceof Error ? error.message : String(error);
4891
4896
  }
4892
- function parseScope(raw) {
4893
- if (raw === void 0 || raw === "session")
4894
- return "session";
4895
- if (raw === "user" || raw === "project")
4896
- return raw;
4897
- throw new Error("watchdog.configure scope must be 'session', 'user', or 'project'.");
4898
- }
4899
- function parseTarget(params) {
4900
- let target = params.target ?? "main";
4901
- if (target === "main")
4902
- return { kind: "main" };
4903
- if (target === "children")
4904
- return { kind: "children" };
4905
- if (target === "child") {
4906
- if (!params.agent?.trim())
4907
- throw new Error("watchdog.configure target='child' requires agent.");
4908
- return { kind: "child", agent: params.agent.trim() };
4909
- }
4910
- throw new Error("watchdog.configure target must be 'main', 'children', or 'child'.");
4911
- }
4912
- function parseThinking(raw) {
4913
- if (raw !== void 0)
4914
- return raw === "inherit" ? null : parseWatchdogThinkingInput(raw, "watchdog.configure thinking") ?? void 0;
4915
- }
4916
- function resolveConfiguredValue(ctx, params) {
4917
- let thinking = parseThinking(params.thinking), rawModel = params.model?.trim();
4918
- if (!rawModel) {
4919
- if (thinking === void 0)
4920
- throw new Error("watchdog.configure requires model, thinking, or both.");
4921
- return { thinking, description: `thinking ${thinking === null ? "inherit" : thinking === !1 ? "off" : thinking}` };
4922
- }
4923
- if (rawModel === "inherit")
4924
- return { model: null, thinking: thinking ?? null, description: "inherit" };
4925
- if (rawModel === "recommended") {
4926
- let recommendation = recommendStrongWatchdogModel(ctx);
4927
- return {
4928
- model: recommendation.model,
4929
- thinking: recommendation.thinking,
4930
- description: `${recommendation.model}:${recommendation.thinking}`
4931
- };
4932
- }
4933
- let resolved = resolveWatchdogModelInput(ctx, rawModel);
4934
- return {
4935
- model: resolved.model,
4936
- thinking: resolved.thinking ?? thinking,
4937
- description: `${resolved.model}${resolved.thinking ?? thinking ? `:${resolved.thinking ?? thinking}` : ""}`
4938
- };
4939
- }
4940
4897
  function buildRecommendationText(ctx) {
4941
4898
  let recommendation = recommendStrongWatchdogModel(ctx);
4942
4899
  return [
4943
4900
  "Subagent watchdog recommended model",
4944
4901
  `Recommended: ${recommendation.model}:${recommendation.thinking}`,
4945
4902
  `Reason: ${recommendation.reason}`,
4946
- 'Apply temporarily with subagent({ action: "watchdog.configure", scope: "session", model: "recommended" }).',
4947
- 'Persist with scope: "project" or scope: "user" only when the user asks for that scope.'
4903
+ "Watchdog settings are user-managed through /subagents-watchdog."
4948
4904
  ].join(`
4949
4905
  `);
4950
4906
  }
@@ -4971,44 +4927,14 @@ function buildCheckText(runtime, ctx) {
4971
4927
  return lines.join(`
4972
4928
  `);
4973
4929
  }
4974
- function handleWatchdogToolAction(action, params, ctx, runtime) {
4930
+ function handleWatchdogToolAction(action, _params, ctx, runtime) {
4975
4931
  try {
4976
- if (action === "watchdog.status")
4977
- return runtime ? result(buildWatchdogStatus(runtime.getSnapshot(ctx.cwd), ctx)) : result("Subagent watchdog runtime is unavailable.", !0);
4978
- if (action === "watchdog.recommend-model")
4979
- return result(buildRecommendationText(ctx));
4980
- if (action === "watchdog.check")
4981
- return result(buildCheckText(runtime, ctx));
4982
- if (action !== "watchdog.configure")
4983
- return result(`Unknown watchdog action: ${action}`, !0);
4984
- let scope = parseScope(params.scope), target = parseTarget(params), value = resolveConfiguredValue(ctx, params);
4985
- if (scope === "session")
4986
- return runtime ? target.kind !== "main" ? result("Session-scoped watchdog.configure currently supports target='main' only.", !0) : (runtime.setSessionModel({ model: value.model, thinking: value.thinking }, ctx.cwd), result([
4987
- `Subagent watchdog session model configured: ${value.description}.`,
4988
- "No settings files were changed.",
4989
- "",
4990
- buildWatchdogStatus(runtime.getSnapshot(ctx.cwd), ctx)
4991
- ].join(`
4992
- `))) : result("Subagent watchdog runtime is unavailable.", !0);
4993
- let settingsPath = writeWatchdogModelSettings({
4994
- scope,
4995
- cwd: ctx.cwd,
4996
- target,
4997
- model: value.model,
4998
- thinking: value.thinking
4999
- });
5000
- runtime?.refreshConfig(ctx.cwd);
5001
- let targetLabel = target.kind === "child" ? `child ${target.agent}` : target.kind;
5002
- return result([
5003
- `Subagent watchdog ${targetLabel} model configured: ${value.description}.`,
5004
- `Updated: ${settingsPath}`
5005
- ].join(`
5006
- `));
4932
+ return action === "watchdog.status" ? runtime ? result(buildWatchdogStatus(runtime.getSnapshot(ctx.cwd), ctx)) : result("Subagent watchdog runtime is unavailable.", !0) : action === "watchdog.recommend-model" ? result(buildRecommendationText(ctx)) : action === "watchdog.check" ? result(buildCheckText(runtime, ctx)) : result(`Unknown watchdog action: ${action}`, !0);
5007
4933
  } catch (error) {
5008
4934
  return result(`Subagent watchdog action failed: ${messageFromError(error)}`, !0);
5009
4935
  }
5010
4936
  }
5011
- var WATCHDOG_TOOL_ACTIONS = ["watchdog.status", "watchdog.check", "watchdog.configure", "watchdog.recommend-model"], WATCHDOG_THINKING_VALUES = ["inherit", ...THINKING_LEVELS];
4937
+ var WATCHDOG_TOOL_ACTIONS = ["watchdog.status", "watchdog.check", "watchdog.recommend-model"];
5012
4938
 
5013
4939
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/chain-append.js
5014
4940
  import { randomUUID } from "node:crypto";
@@ -5490,81 +5416,11 @@ function resolveAsyncRootResultPath(resultsDir, runId) {
5490
5416
  return path13.join(resultsDir, `${runId}.json`);
5491
5417
  }
5492
5418
 
5493
- // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/run-id-resolver.js
5419
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js
5494
5420
  import * as fs14 from "node:fs";
5495
5421
  import * as path14 from "node:path";
5496
- function exactAsyncLocation(id, asyncDirRoot, resultsDir) {
5497
- let asyncDir = path14.join(asyncDirRoot, id), resultPath = path14.join(resultsDir, `${id}.json`);
5498
- if (!(!fs14.existsSync(asyncDir) && !fs14.existsSync(resultPath)))
5499
- return {
5500
- asyncDir: fs14.existsSync(asyncDir) ? asyncDir : null,
5501
- resultPath: fs14.existsSync(resultPath) ? resultPath : null,
5502
- resolvedId: id
5503
- };
5504
- }
5505
- function foregroundIds(state) {
5506
- if (!state)
5507
- return [];
5508
- let remembered = state.currentSessionId ? [...state.foregroundRuns?.values() ?? []].filter((run) => run.sessionId === state.currentSessionId).map((run) => run.runId) : [];
5509
- return [.../* @__PURE__ */ new Set([...state.foregroundControls.keys(), ...remembered])];
5510
- }
5511
- function hasExactForegroundId(state, id) {
5512
- if (!state)
5513
- return !1;
5514
- if (state.foregroundControls.has(id))
5515
- return !0;
5516
- let remembered = state.foregroundRuns?.get(id);
5517
- return !!(remembered && state.currentSessionId && remembered.sessionId === state.currentSessionId);
5518
- }
5519
- function nestedScopeFromState(state) {
5520
- if (!state)
5521
- return;
5522
- let routes = [], seen = /* @__PURE__ */ new Set(), add = (route) => {
5523
- if (!route)
5524
- return;
5525
- let key = `${route.rootRunId}:${route.eventSink}:${route.controlInbox}`;
5526
- seen.has(key) || (seen.add(key), routes.push(route));
5527
- };
5528
- for (let control of state.foregroundControls.values())
5529
- add(control.nestedRoute);
5530
- for (let job of state.asyncJobs.values())
5531
- add(job.nestedRoute);
5532
- return { routes };
5533
- }
5534
- function asyncPrefixMatches(prefix, asyncDirRoot, resultsDir) {
5535
- return findAsyncRunPrefixMatches(prefix, asyncDirRoot, resultsDir);
5536
- }
5537
- function resolveSubagentRunId(id, deps = {}) {
5538
- assertSafeNestedId("id", id);
5539
- let asyncDirRoot = deps.asyncDirRoot ?? ASYNC_DIR, resultsDir = deps.resultsDir ?? RESULTS_DIR, nestedScope = deps.nested ?? nestedScopeFromState(deps.state);
5540
- if (hasExactForegroundId(deps.state, id))
5541
- return { kind: "foreground", id };
5542
- let exactAsync = exactAsyncLocation(id, asyncDirRoot, resultsDir);
5543
- if (exactAsync)
5544
- return { kind: "async", id, location: exactAsync };
5545
- let exactNested = findNestedRunMatchesById(id, nestedScope ? { scope: nestedScope } : {});
5546
- if (exactNested.length > 1)
5547
- throw new Error(`Nested run id '${id}' is ambiguous across authorized registries. Provide the full id after stale registries are cleaned up.`);
5548
- if (exactNested[0])
5549
- return { kind: "nested", id, match: exactNested[0] };
5550
- let matches = [];
5551
- for (let foregroundId of foregroundIds(deps.state).filter((candidate) => candidate.startsWith(id)))
5552
- matches.push({ kind: "foreground", id: foregroundId });
5553
- for (let match of asyncPrefixMatches(id, asyncDirRoot, resultsDir))
5554
- matches.push({ kind: "async", id: match.id, location: match.location });
5555
- for (let match of findNestedRunMatchesById(id, nestedScope ? { prefix: !0, scope: nestedScope } : { prefix: !0 }))
5556
- matches.push({ kind: "nested", id: match.run.id, match });
5557
- let values = [...new Map(matches.map((match) => [`${match.kind}:${match.id}`, match])).values()];
5558
- if (values.length > 1)
5559
- throw new Error(`Ambiguous subagent run id prefix '${id}' matched: ${values.map((match) => `${match.kind}:${match.id}`).join(", ")}. Provide a longer id.`);
5560
- return values[0];
5561
- }
5562
-
5563
- // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/run-status.js
5564
- import * as fs15 from "node:fs";
5565
- import * as path15 from "node:path";
5566
5422
  function hasExistingSessionFile(value) {
5567
- return typeof value == "string" && fs15.existsSync(value);
5423
+ return typeof value == "string" && fs14.existsSync(value);
5568
5424
  }
5569
5425
  function formatResumeGuidance(runId, children, fallbackSessionFile, options = {}) {
5570
5426
  if (options.stopped)
@@ -5600,9 +5456,9 @@ function formatSteeringSummary(input) {
5600
5456
  }
5601
5457
  function rememberedForegroundChildOutput(child) {
5602
5458
  let outputPath = child.artifactPaths?.outputPath ?? child.savedOutputPath;
5603
- if (outputPath && fs15.existsSync(outputPath))
5459
+ if (outputPath && fs14.existsSync(outputPath))
5604
5460
  try {
5605
- let artifactOutput = fs15.readFileSync(outputPath, "utf-8").trim();
5461
+ let artifactOutput = fs14.readFileSync(outputPath, "utf-8").trim();
5606
5462
  if (artifactOutput)
5607
5463
  return artifactOutput;
5608
5464
  } catch {
@@ -5775,7 +5631,7 @@ function inspectSubagentStatus(params, deps = {}) {
5775
5631
  details: { mode: "single", results: [] }
5776
5632
  };
5777
5633
  }
5778
- let status = reconciliation.status, effectiveRunId = status?.runId ?? resolvedId ?? "unknown", logPath = path15.join(asyncDir, `subagent-log-${effectiveRunId}.md`), eventsPath = path15.join(asyncDir, "events.jsonl");
5634
+ let status = reconciliation.status, effectiveRunId = status?.runId ?? resolvedId ?? "unknown", logPath = path14.join(asyncDir, `subagent-log-${effectiveRunId}.md`), eventsPath = path14.join(asyncDir, "events.jsonl");
5779
5635
  if (status) {
5780
5636
  if (params.view === "transcript") {
5781
5637
  if (currentSessionId && status.sessionId !== currentSessionId)
@@ -5819,22 +5675,22 @@ function inspectSubagentStatus(params, deps = {}) {
5819
5675
  `Dir: ${asyncDir}`,
5820
5676
  outputPath ? `Output: ${outputPath}` : void 0,
5821
5677
  reconciliation.message ? `Diagnosis: ${reconciliation.message}` : void 0,
5822
- reconciliation.resultPath && fs15.existsSync(reconciliation.resultPath) ? `Result: ${reconciliation.resultPath}` : void 0
5678
+ reconciliation.resultPath && fs14.existsSync(reconciliation.resultPath) ? `Result: ${reconciliation.resultPath}` : void 0
5823
5679
  ].filter((line) => !!line);
5824
5680
  for (let [index, step] of (status.steps ?? []).entries()) {
5825
5681
  let stepActivityText = step.status === "running" ? formatActivityLabel(step.lastActivityAt, step.activityState) : void 0, modelThinking = formatModelSelection(step.modelSelection, step.model, step.thinking), modelText = modelThinking ? ` (${modelThinking})` : "", steeringText2 = formatSteeringSummary(step), steeringSuffix = steeringText2 ? `, steering: ${steeringText2}` : "", errorText2 = step.error ? `, error: ${step.error}` : "", acceptanceText = step.acceptance?.status ? `, acceptance: ${step.acceptance.status}` : "", budgetText = step.turnBudget ? `, turn budget: ${step.turnBudget.turnCount}/${step.turnBudget.maxTurns}+${step.turnBudget.graceTurns} (${step.turnBudget.outcome})` : "", display = step.label ? `${step.label} (${step.agent})` : step.agent, phase = step.phase ? `[${step.phase}] ` : "";
5826
5682
  lines.push(`${stepLineLabel(status, index)}: ${phase}${display} ${step.status}${modelText}${stepActivityText ? `, ${stepActivityText}` : ""}${steeringSuffix}${acceptanceText}${budgetText}${errorText2}`), lines.push(...formatNestedRunStatusLines(step.children, { indent: " ", commandHints: !0, maxLines: 20 }));
5827
- let stepOutputPath = path15.join(asyncDir, `output-${index}.log`);
5828
- stepOutputPath !== outputPath && fs15.existsSync(stepOutputPath) && lines.push(` Output: ${stepOutputPath}`), step.status === "running" && (lines.push(` Intercom target: ${resolveSubagentIntercomTarget(status.runId, step.childId ?? step.agent, index)} (if registered)`), lines.push(` Steer: subagent({ action: "steer", id: "${status.runId}", index: ${index}, message: "..." })`));
5683
+ let stepOutputPath = path14.join(asyncDir, `output-${index}.log`);
5684
+ stepOutputPath !== outputPath && fs14.existsSync(stepOutputPath) && lines.push(` Output: ${stepOutputPath}`), step.status === "running" && (lines.push(` Intercom target: ${resolveSubagentIntercomTarget(status.runId, step.childId ?? step.agent, index)} (if registered)`), lines.push(` Steer: subagent({ action: "steer", id: "${status.runId}", index: ${index}, message: "..." })`));
5829
5685
  }
5830
5686
  let attached = new Set((status.steps ?? []).flatMap((step) => step.children?.map((child) => child.id) ?? [])), unattached = nestedChildren.filter((child) => !attached.has(child.id));
5831
- return lines.push(...formatNestedRunStatusLines(unattached, { indent: "", commandHints: !0, maxLines: 20 })), nestedWarning && lines.push(`Warning: ${nestedWarning}`), status.sessionFile && lines.push(`Session: ${status.sessionFile}`), status.state === "running" && lines.push(`Steer running child: subagent({ action: "steer", id: "${status.runId}", message: "..." })`), status.state !== "running" && lines.push(formatResumeGuidance(status.runId, status.steps ?? [], status.sessionFile, { stopped: status.state === "stopped" || status.stopped === !0 })), fs15.existsSync(logPath) && lines.push(`Log: ${logPath}`), fs15.existsSync(eventsPath) && lines.push(`Events: ${eventsPath}`), { content: [{ type: "text", text: lines.join(`
5687
+ return lines.push(...formatNestedRunStatusLines(unattached, { indent: "", commandHints: !0, maxLines: 20 })), nestedWarning && lines.push(`Warning: ${nestedWarning}`), status.sessionFile && lines.push(`Session: ${status.sessionFile}`), status.state === "running" && lines.push(`Steer running child: subagent({ action: "steer", id: "${status.runId}", message: "..." })`), status.state !== "running" && lines.push(formatResumeGuidance(status.runId, status.steps ?? [], status.sessionFile, { stopped: status.state === "stopped" || status.stopped === !0 })), fs14.existsSync(logPath) && lines.push(`Log: ${logPath}`), fs14.existsSync(eventsPath) && lines.push(`Events: ${eventsPath}`), { content: [{ type: "text", text: lines.join(`
5832
5688
  `) }], details: { mode: "single", results: [] } };
5833
5689
  }
5834
5690
  }
5835
5691
  if (resultPath)
5836
5692
  try {
5837
- let raw = fs15.readFileSync(resultPath, "utf-8"), data = JSON.parse(raw);
5693
+ let raw = fs14.readFileSync(resultPath, "utf-8"), data = JSON.parse(raw);
5838
5694
  if (params.view === "transcript")
5839
5695
  try {
5840
5696
  return { content: [{ type: "text", text: formatAsyncResultTranscript(data, resultPath, { index: params.index, lines: params.lines }) }], details: { mode: "single", results: [] } };
@@ -5858,15 +5714,10 @@ function inspectSubagentStatus(params, deps = {}) {
5858
5714
  };
5859
5715
  }
5860
5716
 
5861
- // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js
5862
- function applyForceTopLevelAsyncOverride(params, depth, forceTopLevelAsync) {
5863
- return params.foregroundOnly || !(depth === 0 && forceTopLevelAsync) ? params : { ...params, async: !0, clarify: !1 };
5864
- }
5865
-
5866
5717
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js
5867
- var MUTATING_MANAGEMENT_ACTIONS = /* @__PURE__ */ new Set(["create", "update", "delete", "eject", "disable", "enable", "reset", "watchdog.configure"]);
5718
+ var MUTATING_MANAGEMENT_ACTIONS = /* @__PURE__ */ new Set(["create", "update", "delete", "eject", "disable", "enable", "reset"]);
5868
5719
  function resolveRequestedCwd(runtimeCwd, requestedCwd) {
5869
- return requestedCwd ? path16.resolve(runtimeCwd, requestedCwd) : runtimeCwd;
5720
+ return requestedCwd ? path15.resolve(runtimeCwd, requestedCwd) : runtimeCwd;
5870
5721
  }
5871
5722
  function getForegroundControl(state, runId) {
5872
5723
  if (runId)
@@ -5898,7 +5749,7 @@ function nestedResolutionScopeForExecutor(deps) {
5898
5749
  };
5899
5750
  }
5900
5751
  function trustedSessionRootsForStatus(ctx, deps) {
5901
- let roots = deps.config.defaultSessionDir ? [path16.resolve(deps.expandTilde(deps.config.defaultSessionDir))] : [], parentSessionFile = ctx.sessionManager.getSessionFile() ?? null;
5752
+ let roots = deps.config.defaultSessionDir ? [path15.resolve(deps.expandTilde(deps.config.defaultSessionDir))] : [], parentSessionFile = ctx.sessionManager.getSessionFile() ?? null;
5902
5753
  return parentSessionFile && roots.push(deps.getSubagentSessionRoot(parentSessionFile)), [...new Set(roots)];
5903
5754
  }
5904
5755
  function reserveSubagentSpawns(input) {
@@ -6045,10 +5896,10 @@ function resolveForegroundResumeTarget(params, state) {
6045
5896
  let child = run.children[index];
6046
5897
  if (!child.sessionFile)
6047
5898
  throw new Error(`Foreground run '${run.runId}' child ${index} does not have a persisted session file to resume from.`);
6048
- if (path16.extname(child.sessionFile) !== ".jsonl")
5899
+ if (path15.extname(child.sessionFile) !== ".jsonl")
6049
5900
  throw new Error(`Foreground run '${run.runId}' child ${index} session file must be a .jsonl file: ${child.sessionFile}`);
6050
- let sessionFile = path16.resolve(child.sessionFile);
6051
- if (!fs16.existsSync(sessionFile))
5901
+ let sessionFile = path15.resolve(child.sessionFile);
5902
+ if (!fs15.existsSync(sessionFile))
6052
5903
  throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}`);
6053
5904
  return { runId: run.runId, mode: run.mode, state: "complete", agent: child.agent, index, intercomTarget: resolveSubagentIntercomTarget(run.runId, child.agent, index), cwd: run.cwd, sessionFile };
6054
5905
  }
@@ -6103,7 +5954,7 @@ function resolveResumeTarget(params, state, options = {}) {
6103
5954
  function getAsyncInterruptTarget(state, runId, location, options = {}) {
6104
5955
  if (location?.asyncDir)
6105
5956
  return {
6106
- asyncId: location.resolvedId ?? runId ?? path16.basename(location.asyncDir),
5957
+ asyncId: location.resolvedId ?? runId ?? path15.basename(location.asyncDir),
6107
5958
  asyncDir: location.asyncDir
6108
5959
  };
6109
5960
  if (runId) {
@@ -6368,27 +6219,27 @@ function nestedRunAgent(run) {
6368
6219
  return run.agent ?? run.agents?.[0] ?? (run.steps?.length === 1 ? run.steps[0]?.agent : void 0);
6369
6220
  }
6370
6221
  function pathWithin(base, candidate) {
6371
- let resolvedBase = path16.resolve(base), resolvedCandidate = path16.resolve(candidate);
6372
- return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${path16.sep}`);
6222
+ let resolvedBase = path15.resolve(base), resolvedCandidate = path15.resolve(candidate);
6223
+ return resolvedCandidate === resolvedBase || resolvedCandidate.startsWith(`${resolvedBase}${path15.sep}`);
6373
6224
  }
6374
6225
  function validateNestedSessionFile(run, trustedSessionRoots) {
6375
6226
  let sessionFile = nestedRunSessionFile(run);
6376
6227
  if (!sessionFile)
6377
6228
  throw new Error(`Nested run '${run.id}' does not have a persisted session file to resume from.`);
6378
- if (path16.extname(sessionFile) !== ".jsonl")
6229
+ if (path15.extname(sessionFile) !== ".jsonl")
6379
6230
  throw new Error(`Nested run '${run.id}' session file must be a .jsonl file: ${sessionFile}`);
6380
- let resolved = path16.resolve(sessionFile);
6381
- if (!path16.isAbsolute(sessionFile))
6231
+ let resolved = path15.resolve(sessionFile);
6232
+ if (!path15.isAbsolute(sessionFile))
6382
6233
  throw new Error(`Nested run '${run.id}' session file must be absolute: ${sessionFile}`);
6383
- if (!fs16.existsSync(resolved))
6234
+ if (!fs15.existsSync(resolved))
6384
6235
  throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}`);
6385
- let stat = fs16.lstatSync(resolved);
6236
+ let stat = fs15.lstatSync(resolved);
6386
6237
  if (!stat.isFile() || stat.isSymbolicLink())
6387
6238
  throw new Error(`Nested run '${run.id}' session file is not a regular file: ${sessionFile}`);
6388
- let realSessionFile = fs16.realpathSync(resolved);
6389
- if (!trustedSessionRoots.filter((root) => fs16.existsSync(root)).map((root) => fs16.realpathSync(root)).some((root) => pathWithin(root, realSessionFile)))
6239
+ let realSessionFile = fs15.realpathSync(resolved);
6240
+ if (!trustedSessionRoots.filter((root) => fs15.existsSync(root)).map((root) => fs15.realpathSync(root)).some((root) => pathWithin(root, realSessionFile)))
6390
6241
  throw new Error(`Nested run '${run.id}' session file is outside trusted nested session roots: ${sessionFile}`);
6391
- if (!realSessionFile.split(path16.sep).includes(run.id))
6242
+ if (!realSessionFile.split(path15.sep).includes(run.id))
6392
6243
  throw new Error(`Nested run '${run.id}' session file is not under that nested run's session directory: ${sessionFile}`);
6393
6244
  return realSessionFile;
6394
6245
  }
@@ -6408,7 +6259,7 @@ function resolveNestedResumeTarget(match, trustedSessionRoots) {
6408
6259
  agent,
6409
6260
  index: 0,
6410
6261
  intercomTarget: resolveSubagentIntercomTarget(run.id, agent, 0),
6411
- cwd: asyncDir ? path16.dirname(asyncDir) : void 0,
6262
+ cwd: asyncDir ? path15.dirname(asyncDir) : void 0,
6412
6263
  sessionFile: validateNestedSessionFile(run, trustedSessionRoots)
6413
6264
  };
6414
6265
  }
@@ -6435,7 +6286,7 @@ function directNestedAsyncInterrupt(target) {
6435
6286
  let run = target.match.run, asyncDir = resolveNestedAsyncDir(target.match.rootRunId, run);
6436
6287
  if (!asyncDir)
6437
6288
  return;
6438
- let status = reconcileAsyncRun(asyncDir, { resultsDir: path16.join(RESULTS_DIR, "nested", target.match.rootRunId) }).status, pid = typeof status?.pid == "number" && status.pid > 0 ? status.pid : run.pid;
6289
+ let status = reconcileAsyncRun(asyncDir, { resultsDir: path15.join(RESULTS_DIR, "nested", target.match.rootRunId) }).status, pid = typeof status?.pid == "number" && status.pid > 0 ? status.pid : run.pid;
6439
6290
  if (!(!status || status.state !== "running" || typeof pid != "number" || pid <= 0))
6440
6291
  try {
6441
6292
  return deliverInterruptRequest({ asyncDir, pid, source: "nested-interrupt" }), { content: [{ type: "text", text: `Interrupt requested for nested async run ${run.id}.` }], details: { mode: "management", results: [] } };
@@ -6448,7 +6299,7 @@ async function directNestedAsyncSteer(input) {
6448
6299
  let run = input.target.match.run, asyncDir = resolveNestedAsyncDir(input.target.match.rootRunId, run);
6449
6300
  if (!asyncDir)
6450
6301
  return;
6451
- let status = reconcileAsyncRun(asyncDir, { resultsDir: path16.join(RESULTS_DIR, "nested", input.target.match.rootRunId) }).status;
6302
+ let status = reconcileAsyncRun(asyncDir, { resultsDir: path15.join(RESULTS_DIR, "nested", input.target.match.rootRunId) }).status;
6452
6303
  if (!status || status.state !== "running" && status.state !== "queued")
6453
6304
  return;
6454
6305
  let steps = status.steps ?? [];
@@ -6542,7 +6393,7 @@ async function resumeAsyncRun(input) {
6542
6393
  if (resolved.match.run.state === "running" || resolved.match.run.state === "queued")
6543
6394
  return resumeLiveNestedRun({ target: resolved, message: followUp });
6544
6395
  let trustedSessionRoots = [
6545
- ...input.deps.config.defaultSessionDir ? [path16.resolve(input.deps.expandTilde(input.deps.config.defaultSessionDir))] : [],
6396
+ ...input.deps.config.defaultSessionDir ? [path15.resolve(input.deps.expandTilde(input.deps.config.defaultSessionDir))] : [],
6546
6397
  ...parentSessionFile ? [input.deps.getSubagentSessionRoot(parentSessionFile)] : []
6547
6398
  ];
6548
6399
  target = resolveNestedResumeTarget(resolved, trustedSessionRoots);
@@ -6607,7 +6458,7 @@ ${followUp}`, 500, { source: "async-resume", runId: target.runId, agent: target.
6607
6458
  goal,
6608
6459
  attachRoot: {
6609
6460
  runId: target.runId,
6610
- asyncDir: target.asyncDir ?? path16.join(ASYNC_DIR, target.runId),
6461
+ asyncDir: target.asyncDir ?? path15.join(ASYNC_DIR, target.runId),
6611
6462
  resultPath: resolveAsyncRootResultPath(RESULTS_DIR, target.runId),
6612
6463
  index: target.index,
6613
6464
  agent: target.agent,
@@ -6653,32 +6504,43 @@ ${followUp}`, 500, { source: "async-resume", runId: target.runId, agent: target.
6653
6504
  return { content: [{ type: "text", text: formatAsyncStartedMessage(lines2.join(`
6654
6505
  `)) }], details: result3.details };
6655
6506
  }
6656
- let runId = randomUUID4().slice(0, 8), artifactConfig = recoveryDescriptor?.artifactConfig ?? { ...DEFAULT_ARTIFACT_CONFIG, enabled: input.params.artifacts !== !1 }, artifactsDir = recoveryDescriptor?.artifactsDir ?? getArtifactsDir(parentSessionFile, effectiveCwd), availableModels = input.ctx.modelRegistry.getAvailable().map(toModelInfo), recoverySpec;
6507
+ let runId = randomUUID4().slice(0, 8), artifactConfig = recoveryDescriptor?.artifactConfig ?? { ...DEFAULT_ARTIFACT_CONFIG, enabled: input.params.artifacts !== !1 }, artifactsDir = recoveryDescriptor?.artifactsDir ?? getArtifactsDir(parentSessionFile, effectiveCwd), availableModels = input.ctx.modelRegistry.getAvailable().map(toModelInfo), restoredAcceptance;
6508
+ if (recoveryDescriptor?.acceptance !== void 0 && input.params.acceptance === void 0)
6509
+ try {
6510
+ restoredAcceptance = restorePersistedAcceptance(recoveryDescriptor.acceptance, "recoveryDescriptor.acceptance");
6511
+ } catch (error) {
6512
+ return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: !0, details: { mode: "management", results: [] } };
6513
+ }
6514
+ let recoverySpec;
6657
6515
  try {
6516
+ let recoverySelection = recoveryDescriptor?.modelSelection ?? target.modelSelection, recoveryIsExplicitModel = recoverySelection?.kind === "model";
6658
6517
  recoverySpec = normalizeChildSpec({
6659
6518
  task: buildRevivedAsyncTask(target, followUp),
6660
6519
  description: recoveryDescriptor?.description ?? target.description ?? target.agent,
6661
6520
  permissions: recoveryDescriptor?.permissions ?? target.permissions ?? "read-only",
6662
- model: recoveryDescriptor?.model ?? target.model,
6663
- tier: input.params.tier ?? recoveryDescriptor?.tier ?? recoveryDescriptor?.modelSelection?.tier,
6664
- modelSelection: recoveryDescriptor?.modelSelection,
6521
+ model: recoveryIsExplicitModel ? recoverySelection.model ?? recoveryDescriptor?.model ?? target.model : void 0,
6522
+ tier: recoveryIsExplicitModel ? void 0 : input.params.tier ?? recoverySelection?.tier ?? recoveryDescriptor?.tier,
6523
+ thinking: recoveryIsExplicitModel ? recoveryDescriptor?.thinking ?? target.thinking : void 0,
6524
+ modelSelection: recoverySelection,
6665
6525
  skill: recoveryDescriptor?.skills,
6666
6526
  cwd: effectiveCwd,
6667
6527
  output: recoveryDescriptor?.outputPath,
6668
6528
  outputMode: recoveryDescriptor?.outputMode,
6669
- acceptance: input.params.acceptance ?? recoveryDescriptor?.acceptance,
6529
+ acceptance: input.params.acceptance,
6670
6530
  toolBudget: recoveryDescriptor?.initialToolBudget
6671
6531
  }, {
6672
6532
  parentMode: snapshotParentPermissionMode(input.deps.state.currentSessionId),
6673
6533
  runId,
6674
6534
  index: 0,
6675
- childId: recoveryDescriptor?.childId ?? target.childId ?? `${runId}-0`
6535
+ childId: recoveryDescriptor?.childId ?? target.childId ?? `${runId}-0`,
6536
+ resolvedModelIsRuntime: !recoveryIsExplicitModel && !!(recoveryDescriptor?.model ?? target.model)
6676
6537
  });
6677
6538
  } catch (error) {
6678
6539
  return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: !0, details: { mode: "management", results: [] } };
6679
6540
  }
6680
6541
  let result2 = executeAsyncSingle(runId, {
6681
6542
  spec: recoverySpec,
6543
+ completionTask: followUp,
6682
6544
  goal: followUp,
6683
6545
  ctx: {
6684
6546
  pi: input.deps.pi,
@@ -6718,7 +6580,7 @@ ${followUp}`, 500, { source: "async-resume", runId: target.runId, agent: target.
6718
6580
  output: recoveryDescriptor?.outputPath,
6719
6581
  outputMode: recoveryDescriptor?.outputMode,
6720
6582
  ...recoveryDescriptor?.skills ? { skills: [...recoveryDescriptor.skills] } : {},
6721
- ...recoveryDescriptor?.acceptance !== void 0 && input.params.acceptance === void 0 ? { acceptance: recoveryDescriptor.acceptance } : {},
6583
+ ...restoredAcceptance ? { restoredAcceptance } : {},
6722
6584
  ...input.params.timeoutMs !== void 0 ? { timeoutMs: input.params.timeoutMs } : {},
6723
6585
  ...input.absoluteDeadlineAt !== void 0 ? { absoluteDeadlineAt: input.absoluteDeadlineAt } : {},
6724
6586
  ...input.params.turnBudget !== void 0 ? { turnBudget: input.params.turnBudget } : {},
@@ -6986,6 +6848,7 @@ function internalizePromptDrivenChildren(params, options) {
6986
6848
  cwd: params.cwd,
6987
6849
  model: params.model,
6988
6850
  tier: params.tier,
6851
+ thinking: params.thinking,
6989
6852
  skill: params.skill,
6990
6853
  output: params.output,
6991
6854
  outputMode: params.outputMode,
@@ -7330,13 +7193,21 @@ function runAsyncPath(data, deps) {
7330
7193
  isError: !0,
7331
7194
  details: { mode: "single", results: [] }
7332
7195
  };
7333
- let rawOutput = params.output !== void 0 ? params.output : a.output, effectiveOutput = normalizeSingleOutputOverride(rawOutput, a.output), effectiveOutputMode = params.outputMode ?? "inline", normalizedSkills = normalizeSkillInput(params.skill), skills = normalizedSkills === !1 ? [] : normalizedSkills, maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, a.maxSubagentDepth), modelOverride = resolveRequiredTierModel(params.tier, availableModels, currentProvider), spec = normalizeChildSpec({
7196
+ let rawOutput = params.output !== void 0 ? params.output : a.output, effectiveOutput = normalizeSingleOutputOverride(rawOutput, a.output), effectiveOutputMode = params.outputMode ?? "inline", normalizedSkills = normalizeSkillInput(params.skill), skills = normalizedSkills === !1 ? [] : normalizedSkills, maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, a.maxSubagentDepth), modelSelection = captureModelSelection({ model: params.model, tier: params.tier }), modelOverride = resolveExecutableChildModel({
7197
+ modelSelection,
7198
+ model: params.model,
7199
+ tier: params.tier,
7200
+ thinking: params.thinking,
7201
+ availableModels,
7202
+ preferredProvider: currentProvider
7203
+ }), spec = normalizeChildSpec({
7334
7204
  task: shouldForkAgent(contextPolicy, params.agent) ? wrapForkTask(params.task ?? "") : params.task ?? "",
7335
7205
  description: params.description,
7336
7206
  permissions: params.permissions,
7337
- model: modelOverride,
7207
+ model: params.model,
7338
7208
  tier: params.tier,
7339
- modelSelection: captureModelSelection({ tier: params.tier }),
7209
+ thinking: params.thinking,
7210
+ modelSelection,
7340
7211
  skill: params.skill,
7341
7212
  cwd: effectiveCwd,
7342
7213
  output: effectiveOutput,
@@ -7522,7 +7393,7 @@ function buildParallelWorktreeTaskCwdError(tasks, sharedCwd) {
7522
7393
  return formatWorktreeTaskCwdConflict(conflict, sharedCwd);
7523
7394
  }
7524
7395
  function resolveSingleRunOutputBaseDir(deps, artifactsDir, runId) {
7525
- return deps.config.singleRunOutputBaseDir ? path16.resolve(deps.expandTilde(deps.config.singleRunOutputBaseDir)) : path16.join(artifactsDir, "outputs", runId);
7396
+ return deps.config.singleRunOutputBaseDir ? path15.resolve(deps.expandTilde(deps.config.singleRunOutputBaseDir)) : path15.join(artifactsDir, "outputs", runId);
7526
7397
  }
7527
7398
  function buildChainWorktreeTaskCwdError(chain, sharedCwd) {
7528
7399
  for (let stepIndex = 0; stepIndex < chain.length; stepIndex++) {
@@ -7542,7 +7413,7 @@ function resolveParallelTaskCwd(task, paramsCwd, worktreeSetup, index) {
7542
7413
  function buildParallelWorktreeSuffix(worktreeSetup, artifactsDir, tasks) {
7543
7414
  if (!worktreeSetup)
7544
7415
  return "";
7545
- let diffsDir = path16.join(artifactsDir, "worktree-diffs"), diffs = diffWorktrees(worktreeSetup, tasks.map((task) => task.agent), diffsDir);
7416
+ let diffsDir = path15.join(artifactsDir, "worktree-diffs"), diffs = diffWorktrees(worktreeSetup, tasks.map((task) => task.agent), diffsDir);
7546
7417
  return formatWorktreeDiffSummary(diffs);
7547
7418
  }
7548
7419
  function findDuplicateParallelOutputPath(input) {
@@ -7565,13 +7436,16 @@ async function runForegroundParallelTasks(input) {
7565
7436
  input.sessionFileForTask(input.tasks[i].agent, i, input.modelOverrides[i]);
7566
7437
  return mapConcurrent(input.tasks, input.concurrencyLimit, async (task, index) => {
7567
7438
  let behavior = input.behaviors[index], effectiveSkills = behavior?.skills, taskCwd = resolveParallelTaskCwd(task, input.paramsCwd, input.worktreeSetup, index), readInstructions = behavior ? buildChainInstructions({ ...behavior, output: !1, progress: !1 }, taskCwd, !1) : { prefix: "", suffix: "" }, progressInstructions = behavior ? buildChainInstructions({ ...behavior, output: !1, reads: !1 }, input.progressDir, index === input.firstProgressIndex) : { prefix: "", suffix: "" }, outputPath = resolveSingleOutputPath(behavior?.output, input.ctx.cwd, taskCwd, input.outputBaseDir), agentConfig = input.agents.find((agent) => agent.name === task.agent), taskText = injectSingleOutputInstruction(`${readInstructions.prefix}${input.taskTexts[index]}${progressInstructions.suffix}`, outputPath, agentConfig), interruptController = new AbortController();
7568
- return input.foregroundControl && (input.foregroundControl.currentAgent = task.description || task.agent, input.foregroundControl.currentChildId = task.agent, input.foregroundControl.currentIndex = index, input.foregroundControl.currentActivityState = void 0, input.foregroundControl.updatedAt = Date.now(), input.foregroundControl.interrupt = () => interruptController.signal.aborted ? !1 : (interruptController.abort(), input.foregroundControl.currentActivityState = void 0, input.foregroundControl.updatedAt = Date.now(), !0)), runSync(input.ctx.cwd, normalizeChildSpec({
7439
+ input.foregroundControl && (input.foregroundControl.currentAgent = task.description || task.agent, input.foregroundControl.currentChildId = task.agent, input.foregroundControl.currentIndex = index, input.foregroundControl.currentActivityState = void 0, input.foregroundControl.updatedAt = Date.now(), input.foregroundControl.interrupt = () => interruptController.signal.aborted ? !1 : (interruptController.abort(), input.foregroundControl.currentActivityState = void 0, input.foregroundControl.updatedAt = Date.now(), !0));
7440
+ let modelSelection = input.modelSelections[index] ?? captureModelSelection({ model: task.model, tier: task.tier });
7441
+ return runSync(input.ctx.cwd, normalizeChildSpec({
7569
7442
  task: taskText,
7570
7443
  description: task.description,
7571
7444
  permissions: task.permissions,
7572
- model: input.modelOverrides[index] ?? task.model,
7445
+ model: task.model,
7573
7446
  tier: task.tier,
7574
- modelSelection: input.modelSelections[index] ?? captureModelSelection({ tier: task.tier }),
7447
+ thinking: task.thinking,
7448
+ modelSelection,
7575
7449
  skill: task.skill,
7576
7450
  cwd: taskCwd,
7577
7451
  output: task.output,
@@ -7676,7 +7550,14 @@ async function runParallelPath(data, deps) {
7676
7550
  ...task.reads !== void 0 && task.reads !== !0 ? { reads: task.reads } : {},
7677
7551
  ...task.progress !== void 0 ? { progress: task.progress } : {},
7678
7552
  ...skillOverrides[index] !== void 0 ? { skills: skillOverrides[index] } : {}
7679
- })), modelOverrides = tasks.map((task, i) => resolveRequiredTierModel(task.tier, availableModels, currentProvider)), modelSelections = tasks.map((task) => captureModelSelection({ tier: task.tier }));
7553
+ })), modelSelections = tasks.map((task) => captureModelSelection({ model: task.model, tier: task.tier })), modelOverrides = tasks.map((task, index) => resolveExecutableChildModel({
7554
+ modelSelection: modelSelections[index],
7555
+ model: task.model,
7556
+ tier: task.tier,
7557
+ thinking: task.thinking,
7558
+ availableModels,
7559
+ preferredProvider: currentProvider
7560
+ }));
7680
7561
  if (params.clarify === !0 && ctx.hasUI) {
7681
7562
  let behaviors2 = agentConfigs.map((_c, i) => resolveStepBehavior(behaviorOverrides[i])), availableSkills = discoverAvailableSkills(effectiveCwd), result2 = await ctx.ui.custom((tui, theme, _kb, done) => new ChainClarifyComponent(tui, theme, agentConfigs, taskTexts, "", void 0, behaviors2, availableModels, currentProvider, availableSkills, done, "parallel"), { overlay: !0, overlayOptions: { anchor: "center", width: 84, maxHeight: "80%" } });
7682
7563
  if (!result2 || !result2.confirmed)
@@ -7752,7 +7633,7 @@ async function runParallelPath(data, deps) {
7752
7633
  if (errorResult)
7753
7634
  return errorResult;
7754
7635
  try {
7755
- let outputBaseDir = path16.join(artifactsDir, "outputs", runId), duplicateOutputError = findDuplicateParallelOutputPath({
7636
+ let outputBaseDir = path15.join(artifactsDir, "outputs", runId), duplicateOutputError = findDuplicateParallelOutputPath({
7756
7637
  tasks,
7757
7638
  behaviors,
7758
7639
  paramsCwd: effectiveCwd,
@@ -7767,7 +7648,7 @@ async function runParallelPath(data, deps) {
7767
7648
  if (validationError)
7768
7649
  return buildParallelModeError(validationError);
7769
7650
  }
7770
- let parallelProgressPrecreated = firstProgressIndex !== -1, parallelProgressDir = path16.join(artifactsDir, "progress", runId);
7651
+ let parallelProgressPrecreated = firstProgressIndex !== -1, parallelProgressDir = path15.join(artifactsDir, "progress", runId);
7771
7652
  parallelProgressPrecreated && writeInitialProgressFile(parallelProgressDir);
7772
7653
  for (let i = 0; i < taskTexts.length; i++)
7773
7654
  shouldForkAgent(contextPolicy, tasks[i].agent) && (taskTexts[i] = wrapForkTask(taskTexts[i]));
@@ -7885,7 +7766,9 @@ async function runSinglePath(data, deps) {
7885
7766
  task: params.task,
7886
7767
  description: params.description,
7887
7768
  permissions: params.permissions,
7769
+ model: params.model,
7888
7770
  tier: params.tier,
7771
+ thinking: params.thinking,
7889
7772
  skill: params.skill,
7890
7773
  cwd: effectiveCwd,
7891
7774
  output: params.output,
@@ -7914,7 +7797,14 @@ async function runSinglePath(data, deps) {
7914
7797
  }, effectiveToolBudget = resolveEffectiveToolBudget({ runBudget: data.toolBudget, agentBudget: spec.toolBudget, configBudget: data.configToolBudget });
7915
7798
  if (effectiveToolBudget.error)
7916
7799
  return toExecutionErrorResult(params, new Error(effectiveToolBudget.error));
7917
- let currentProvider = ctx.model?.provider, availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo), task = params.task ?? "", modelOverride = resolveRequiredTierModel(params.tier, availableModels, currentProvider), skillOverride = normalizeSkillInput(params.skill), rawOutput = params.output !== void 0 ? params.output : agentConfig.output, effectiveOutput = normalizeSingleOutputOverride(rawOutput, agentConfig.output), effectiveOutputMode = params.outputMode ?? "inline", currentMaxSubagentDepth = resolveCurrentMaxSubagentDepth(deps.config.maxSubagentDepth), maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, agentConfig.maxSubagentDepth);
7800
+ let currentProvider = ctx.model?.provider, availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo), task = params.task ?? "", modelSelection = captureModelSelection({ model: params.model, tier: params.tier }), modelOverride = resolveExecutableChildModel({
7801
+ modelSelection,
7802
+ model: params.model,
7803
+ tier: params.tier,
7804
+ thinking: params.thinking,
7805
+ availableModels,
7806
+ preferredProvider: currentProvider
7807
+ }), skillOverride = normalizeSkillInput(params.skill), rawOutput = params.output !== void 0 ? params.output : agentConfig.output, effectiveOutput = normalizeSingleOutputOverride(rawOutput, agentConfig.output), effectiveOutputMode = params.outputMode ?? "inline", currentMaxSubagentDepth = resolveCurrentMaxSubagentDepth(deps.config.maxSubagentDepth), maxSubagentDepth = resolveChildMaxSubagentDepth(currentMaxSubagentDepth, agentConfig.maxSubagentDepth);
7918
7808
  if (params.clarify === !0 && ctx.hasUI) {
7919
7809
  let behavior = resolveStepBehavior({ output: effectiveOutput, skills: skillOverride }), availableSkills = discoverAvailableSkills(effectiveCwd), result2 = await ctx.ui.custom((tui, theme, _kb, done) => new ChainClarifyComponent(tui, theme, [agentConfig], [task], task, void 0, [behavior], availableModels, currentProvider, availableSkills, done, "single"), { overlay: !0, overlayOptions: { anchor: "center", width: 84, maxHeight: "80%" } });
7920
7810
  if (!result2 || !result2.confirmed)
@@ -8086,7 +7976,7 @@ function foregroundCapacityResult(params, inFlight, limit) {
8086
7976
  return {
8087
7977
  content: [{
8088
7978
  type: "text",
8089
- text: `Foreground subagent capacity reached (${inFlight}/${limit} running). Wait for a child to finish, use ONE subagent call with tasks: [{task, description}, \u2026], or set async: true.`
7979
+ text: `Foreground subagent capacity reached (${inFlight}/${limit} running). Wait for a child to finish, combine work in ONE tasks call, or launch without async:false or clarify:true when foreground execution is unnecessary.`
8090
7980
  }],
8091
7981
  isError: !0,
8092
7982
  details: { mode: inferExecutionMode(params), results: [] }
@@ -8176,7 +8066,7 @@ function createSubagentExecutor(deps) {
8176
8066
  let targetRunId = paramsWithResolvedCwd.runId ?? paramsWithResolvedCwd.id;
8177
8067
  if (paramsWithResolvedCwd.dir)
8178
8068
  try {
8179
- let location = resolveAsyncRunLocation(paramsWithResolvedCwd, ASYNC_DIR, RESULTS_DIR), runId2 = location.resolvedId ?? targetRunId ?? path16.basename(location.asyncDir ?? paramsWithResolvedCwd.dir);
8069
+ let location = resolveAsyncRunLocation(paramsWithResolvedCwd, ASYNC_DIR, RESULTS_DIR), runId2 = location.resolvedId ?? targetRunId ?? path15.basename(location.asyncDir ?? paramsWithResolvedCwd.dir);
8180
8070
  return steerAsyncRun({ state: deps.state, runId: runId2, message, index: paramsWithResolvedCwd.index, kill: deps.kill, location, signal, recover: ({ absoluteDeadlineAt, ...limits }) => resumeAsyncRun({ params: { ...limits, action: "resume", id: runId2, message }, requestCwd, ctx, deps, absoluteDeadlineAt }) });
8181
8071
  } catch (error) {
8182
8072
  return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: !0, details: { mode: "management", results: [] } };
@@ -8204,7 +8094,7 @@ function createSubagentExecutor(deps) {
8204
8094
  if (paramsWithResolvedCwd.dir)
8205
8095
  try {
8206
8096
  let location = resolveAsyncRunLocation(paramsWithResolvedCwd, ASYNC_DIR, RESULTS_DIR);
8207
- return stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ?? path16.basename(location.asyncDir ?? paramsWithResolvedCwd.dir), deps.kill, location);
8097
+ return stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ?? path15.basename(location.asyncDir ?? paramsWithResolvedCwd.dir), deps.kill, location);
8208
8098
  } catch (error) {
8209
8099
  return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: !0, details: { mode: "management", results: [] } };
8210
8100
  }
@@ -8274,7 +8164,7 @@ function createSubagentExecutor(deps) {
8274
8164
  let normalized = normalizeRepeatedParallelCounts(paramsWithResolvedCwd);
8275
8165
  if (normalized.error)
8276
8166
  return normalized.error;
8277
- let normalizedParams = normalized.params, effectiveParams = applyForceTopLevelAsyncOverride(normalizedParams, depth, deps.config.forceTopLevelAsync === !0), runToolBudget = resolveToolBudget(effectiveParams.toolBudget, "toolBudget");
8167
+ let effectiveParams = normalized.params, runToolBudget = resolveToolBudget(effectiveParams.toolBudget, "toolBudget");
8278
8168
  if (runToolBudget.error)
8279
8169
  return buildRequestedModeError(effectiveParams, runToolBudget.error);
8280
8170
  let configToolBudget = resolveToolBudget(deps.config.toolBudget, "config.toolBudget");
@@ -8325,23 +8215,23 @@ function createSubagentExecutor(deps) {
8325
8215
  } catch (error) {
8326
8216
  return toExecutionErrorResult(effectiveParams, error);
8327
8217
  }
8328
- let requestedAsync = effectiveParams.async ?? deps.asyncByDefault, backgroundRequestedWhileClarifying = (hasChain || hasTasks) && requestedAsync && effectiveParams.clarify === !0, effectiveAsync = requestedAsync && effectiveParams.clarify !== !0, controlConfig = resolveControlConfig(deps.config.control, effectiveParams.control), artifactConfig = {
8218
+ let backgroundRequestedWhileClarifying = (hasChain || hasTasks) && effectiveParams.async === !0 && effectiveParams.clarify === !0, effectiveAsync = subagentLaunchRunsAsync(effectiveParams), controlConfig = resolveControlConfig(deps.config.control, effectiveParams.control), artifactConfig = {
8329
8219
  ...DEFAULT_ARTIFACT_CONFIG,
8330
8220
  enabled: effectiveParams.artifacts !== !1
8331
8221
  }, artifactsDir = getArtifactsDir(parentSessionFile, effectiveCwd), sessionRoot;
8332
8222
  if (effectiveParams.sessionDir)
8333
- sessionRoot = path16.resolve(deps.expandTilde(effectiveParams.sessionDir));
8223
+ sessionRoot = path15.resolve(deps.expandTilde(effectiveParams.sessionDir));
8334
8224
  else {
8335
- let baseSessionRoot = deps.config.defaultSessionDir ? path16.resolve(deps.expandTilde(deps.config.defaultSessionDir)) : deps.getSubagentSessionRoot(parentSessionFile);
8336
- sessionRoot = path16.join(baseSessionRoot, runId);
8225
+ let baseSessionRoot = deps.config.defaultSessionDir ? path15.resolve(deps.expandTilde(deps.config.defaultSessionDir)) : deps.getSubagentSessionRoot(parentSessionFile);
8226
+ sessionRoot = path15.join(baseSessionRoot, runId);
8337
8227
  }
8338
8228
  try {
8339
- fs16.mkdirSync(sessionRoot, { recursive: !0 });
8229
+ fs15.mkdirSync(sessionRoot, { recursive: !0 });
8340
8230
  } catch (error) {
8341
8231
  let message = error instanceof Error ? error.message : String(error);
8342
8232
  return toExecutionErrorResult(effectiveParams, new Error(`Failed to create session directory '${sessionRoot}': ${message}`));
8343
8233
  }
8344
- let sessionDirForIndex = (idx) => path16.join(sessionRoot, `run-${idx ?? 0}`), forkSessionFileForTask = (agentName, idx = 0, modelOverride) => {
8234
+ let sessionDirForIndex = (idx) => path15.join(sessionRoot, `run-${idx ?? 0}`), forkSessionFileForTask = (agentName, idx = 0, modelOverride) => {
8345
8235
  if (shouldForkAgent(contextPolicy, agentName))
8346
8236
  return prepareForkThinking(agentName, idx, modelOverride), forkSessionFileForIndex(idx);
8347
8237
  }, forkThinkingOverrideForTask = (agentName, idx = 0, modelOverride) => {
@@ -8350,7 +8240,7 @@ function createSubagentExecutor(deps) {
8350
8240
  prepareForkThinking(agentName, idx, modelOverride);
8351
8241
  let override = forkThinkingOverrideForIndex(idx);
8352
8242
  return override === "off" && forkThinkingDowngrades.set(idx, agentName), override;
8353
- }, childSessionFileForTask = (agentName, idx, modelOverride) => forkSessionFileForTask(agentName, idx, modelOverride) ?? path16.join(sessionDirForIndex(idx), "session.jsonl"), childSessionFileForIndex = (idx) => path16.join(sessionDirForIndex(idx), "session.jsonl");
8243
+ }, childSessionFileForTask = (agentName, idx, modelOverride) => forkSessionFileForTask(agentName, idx, modelOverride) ?? path15.join(sessionDirForIndex(idx), "session.jsonl"), childSessionFileForIndex = (idx) => path15.join(sessionDirForIndex(idx), "session.jsonl");
8354
8244
  try {
8355
8245
  effectiveParams.clarify === !0 && ctx.hasUI || preflightForkSessionsForStaticTasks(effectiveParams, contextPolicy, forkSessionFileForTask, deps.config.chain?.dynamicFanout?.maxItems);
8356
8246
  } catch (error) {
@@ -8480,10 +8370,7 @@ function createSubagentExecutor(deps) {
8480
8370
  };
8481
8371
  return { execute: async (id, params, signal, onUpdate, ctx) => {
8482
8372
  let requestParams = resolveSubagentRequestParams(params);
8483
- if (requestParams.action)
8484
- return execute(id, requestParams, signal, onUpdate, ctx);
8485
- let { depth } = checkSubagentDepth(deps.config.maxSubagentDepth), dispatchParams = applyForceTopLevelAsyncOverride(requestParams, depth, deps.config.forceTopLevelAsync === !0);
8486
- if (!(dispatchParams.clarify === !0 || (dispatchParams.async ?? deps.asyncByDefault) !== !0))
8373
+ if (requestParams.action || !!subagentLaunchRunsAsync(requestParams))
8487
8374
  return execute(id, requestParams, signal, onUpdate, ctx);
8488
8375
  let limit = resolveTopLevelParallelConcurrency(void 0, deps.config.parallel?.concurrency), inFlight = deps.state.foregroundSubagentInFlight ?? 0;
8489
8376
  if (inFlight >= limit)