@ashx-j/lunr 0.2.22 → 0.2.24

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 (277) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +15 -13
  3. package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
  4. package/dist/builtin-extensions/ashxj-tui.js +2 -2
  5. package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
  6. package/dist/builtin-extensions/lunr-browser.d.ts +7 -1
  7. package/dist/builtin-extensions/lunr-browser.d.ts.map +1 -1
  8. package/dist/builtin-extensions/lunr-browser.js +116 -3
  9. package/dist/builtin-extensions/lunr-browser.js.map +1 -1
  10. package/dist/builtin-extensions/lunr-plan-tools.d.ts +7 -7
  11. package/dist/builtin-extensions/lunr-plan-tools.d.ts.map +1 -1
  12. package/dist/builtin-extensions/lunr-plan-tools.js +12 -12
  13. package/dist/builtin-extensions/lunr-plan-tools.js.map +1 -1
  14. package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
  15. package/dist/builtin-extensions/pi-intercom/index.js +2 -0
  16. package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
  17. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
  18. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +1 -0
  19. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
  20. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  21. package/dist/builtin-extensions/pi-mcp-adapter/index.js +1 -1
  22. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  23. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  24. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +1 -1
  25. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  26. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
  27. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +1 -1
  28. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
  29. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -4
  30. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
  31. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +6 -4
  32. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
  33. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts +2 -0
  34. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
  35. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js +6 -3
  36. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
  37. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
  38. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +7 -2
  39. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
  40. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +2 -0
  41. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
  42. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +4 -0
  43. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
  44. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
  45. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +1 -1
  46. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
  47. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +2 -0
  48. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
  49. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +9 -0
  50. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
  51. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +41 -3
  53. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  54. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts +1 -0
  55. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
  56. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +5 -1
  57. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
  58. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
  59. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +3 -2
  60. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
  61. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +23 -0
  63. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  64. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
  65. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
  66. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +1 -1
  67. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
  68. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +2 -0
  69. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
  70. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +17 -15
  71. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
  72. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  73. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +3 -1
  74. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  75. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
  76. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +2 -2
  77. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
  78. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +1 -0
  79. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  80. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  81. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts +1 -1
  82. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -1
  83. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +3 -2
  84. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -1
  85. package/dist/core/agent-session.d.ts +20 -1
  86. package/dist/core/agent-session.d.ts.map +1 -1
  87. package/dist/core/agent-session.js +235 -107
  88. package/dist/core/agent-session.js.map +1 -1
  89. package/dist/core/browser/schema.d.ts +1 -1
  90. package/dist/core/browser/schema.d.ts.map +1 -1
  91. package/dist/core/browser/schema.js +1 -1
  92. package/dist/core/browser/schema.js.map +1 -1
  93. package/dist/core/catalog-cache-scope.d.ts.map +1 -1
  94. package/dist/core/catalog-cache-scope.js +3 -1
  95. package/dist/core/catalog-cache-scope.js.map +1 -1
  96. package/dist/core/model-runtime.d.ts.map +1 -1
  97. package/dist/core/model-runtime.js +3 -2
  98. package/dist/core/model-runtime.js.map +1 -1
  99. package/dist/core/permissions.d.ts +16 -23
  100. package/dist/core/permissions.d.ts.map +1 -1
  101. package/dist/core/permissions.js +66 -141
  102. package/dist/core/permissions.js.map +1 -1
  103. package/dist/core/plan-mode.d.ts +10 -12
  104. package/dist/core/plan-mode.d.ts.map +1 -1
  105. package/dist/core/plan-mode.js +16 -18
  106. package/dist/core/plan-mode.js.map +1 -1
  107. package/dist/core/runtime-bridges.d.ts.map +1 -1
  108. package/dist/core/runtime-bridges.js +2 -0
  109. package/dist/core/runtime-bridges.js.map +1 -1
  110. package/dist/core/sdk.d.ts.map +1 -1
  111. package/dist/core/sdk.js +13 -6
  112. package/dist/core/sdk.js.map +1 -1
  113. package/dist/core/session-manager.d.ts.map +1 -1
  114. package/dist/core/session-manager.js +9 -2
  115. package/dist/core/session-manager.js.map +1 -1
  116. package/dist/core/settings-manager.d.ts +13 -1
  117. package/dist/core/settings-manager.d.ts.map +1 -1
  118. package/dist/core/settings-manager.js +49 -1
  119. package/dist/core/settings-manager.js.map +1 -1
  120. package/dist/core/slash-commands.d.ts.map +1 -1
  121. package/dist/core/slash-commands.js +4 -4
  122. package/dist/core/slash-commands.js.map +1 -1
  123. package/dist/core/subagent-permission-inherit.d.ts +6 -10
  124. package/dist/core/subagent-permission-inherit.d.ts.map +1 -1
  125. package/dist/core/subagent-permission-inherit.js +14 -14
  126. package/dist/core/subagent-permission-inherit.js.map +1 -1
  127. package/dist/core/subagent-wait-interruption.d.ts +11 -0
  128. package/dist/core/subagent-wait-interruption.d.ts.map +1 -0
  129. package/dist/core/subagent-wait-interruption.js +19 -0
  130. package/dist/core/subagent-wait-interruption.js.map +1 -0
  131. package/dist/core/system-prompt.d.ts +2 -0
  132. package/dist/core/system-prompt.d.ts.map +1 -1
  133. package/dist/core/system-prompt.js +11 -4
  134. package/dist/core/system-prompt.js.map +1 -1
  135. package/dist/core/tools/render-utils.d.ts +3 -3
  136. package/dist/core/tools/render-utils.d.ts.map +1 -1
  137. package/dist/core/tools/render-utils.js +3 -3
  138. package/dist/core/tools/render-utils.js.map +1 -1
  139. package/dist/gateway/adapters/discord.d.ts.map +1 -1
  140. package/dist/gateway/adapters/discord.js +1 -1
  141. package/dist/gateway/adapters/discord.js.map +1 -1
  142. package/dist/gateway/approval.d.ts +2 -6
  143. package/dist/gateway/approval.d.ts.map +1 -1
  144. package/dist/gateway/approval.js +3 -7
  145. package/dist/gateway/approval.js.map +1 -1
  146. package/dist/gateway/mobile-commands.d.ts.map +1 -1
  147. package/dist/gateway/mobile-commands.js +12 -11
  148. package/dist/gateway/mobile-commands.js.map +1 -1
  149. package/dist/gateway/router.d.ts.map +1 -1
  150. package/dist/gateway/router.js +1 -1
  151. package/dist/gateway/router.js.map +1 -1
  152. package/dist/main.d.ts.map +1 -1
  153. package/dist/main.js +1 -2
  154. package/dist/main.js.map +1 -1
  155. package/dist/modes/interactive/components/assistant-message.d.ts +10 -2
  156. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  157. package/dist/modes/interactive/components/assistant-message.js +29 -5
  158. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  159. package/dist/modes/interactive/components/copyable-text.d.ts +2 -6
  160. package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -1
  161. package/dist/modes/interactive/components/copyable-text.js +26 -35
  162. package/dist/modes/interactive/components/copyable-text.js.map +1 -1
  163. package/dist/modes/interactive/components/settings-selector.d.ts +7 -1
  164. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  165. package/dist/modes/interactive/components/settings-selector.js +36 -3
  166. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  167. package/dist/modes/interactive/components/thinking-tail.d.ts +9 -2
  168. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  169. package/dist/modes/interactive/components/thinking-tail.js +43 -1
  170. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  171. package/dist/modes/interactive/components/tool-execution.d.ts +5 -3
  172. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  173. package/dist/modes/interactive/components/tool-execution.js +44 -45
  174. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  175. package/dist/modes/interactive/interactive-mode.d.ts +7 -2
  176. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  177. package/dist/modes/interactive/interactive-mode.js +194 -129
  178. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  179. package/dist/modes/interactive/theme/theme.d.ts +1 -0
  180. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  181. package/dist/modes/interactive/theme/theme.js +23 -0
  182. package/dist/modes/interactive/theme/theme.js.map +1 -1
  183. package/dist/node-runtime/{agent-session-services-NQ6GKOIK.js → agent-session-services-IEF7LQWD.js} +12 -13
  184. package/dist/node-runtime/{builtin-extensions-GVC6IFDU.js → builtin-extensions-EBAWTH4M.js} +5 -5
  185. package/dist/node-runtime/{chunk-XLTL257W.js → chunk-2KIPT4HJ.js} +5 -1
  186. package/dist/node-runtime/{chunk-IWOWXRWU.js → chunk-5Q3EHOHI.js} +21 -21
  187. package/dist/node-runtime/{chunk-6B2POMK7.js → chunk-6VYZ5UFP.js} +1 -1
  188. package/dist/node-runtime/{chunk-TQGPP4SC.js → chunk-CDVHZOOK.js} +1 -1
  189. package/dist/node-runtime/{chunk-TDL7UWJ7.js → chunk-DE2JB6J5.js} +189 -70
  190. package/dist/node-runtime/{chunk-YJMMG7C6.js → chunk-DSIKTUPW.js} +1 -1
  191. package/dist/node-runtime/{chunk-IQIEU7SB.js → chunk-F4FLTQKV.js} +2 -2
  192. package/dist/node-runtime/{chunk-GMHJCCEN.js → chunk-FU6OODRZ.js} +4 -1
  193. package/dist/node-runtime/{chunk-5BNJ4JUH.js → chunk-GJ2RDBRL.js} +1 -1
  194. package/dist/node-runtime/{chunk-GNN7H3B7.js → chunk-GS42T6MX.js} +1 -1
  195. package/dist/node-runtime/{chunk-OFKSVRV7.js → chunk-GYIXXQAO.js} +1 -1
  196. package/dist/node-runtime/{chunk-BX2RB477.js → chunk-HFVZUPFJ.js} +1 -1
  197. package/dist/node-runtime/{chunk-PC2Z5TKZ.js → chunk-HMBGROQK.js} +3 -3
  198. package/dist/node-runtime/{chunk-AZJHNQKQ.js → chunk-I54LGHWM.js} +1 -1
  199. package/dist/node-runtime/{chunk-IVXYUAJE.js → chunk-IF24A3FH.js} +1 -1
  200. package/dist/node-runtime/{chunk-VJPTNWAP.js → chunk-IGV54Q5V.js} +3 -3
  201. package/dist/node-runtime/{chunk-QDGKKKUM.js → chunk-K5AGHH57.js} +18 -13
  202. package/dist/node-runtime/{chunk-GS66LV4M.js → chunk-KJ6DWS3K.js} +4 -4
  203. package/dist/node-runtime/{chunk-EQ63ANHL.js → chunk-L3LX4SNR.js} +310 -192
  204. package/dist/node-runtime/{chunk-VSELYKWU.js → chunk-LWYIVUGV.js} +2 -1
  205. package/dist/node-runtime/{chunk-JHYKXIMM.js → chunk-MPKSOJBT.js} +1 -1
  206. package/dist/node-runtime/{chunk-UAFLNHSH.js → chunk-OF7PWMG4.js} +8 -8
  207. package/dist/node-runtime/{chunk-CSUZVNYE.js → chunk-OVX6X377.js} +10 -6
  208. package/dist/node-runtime/{chunk-ORH324EP.js → chunk-PCEW76PM.js} +3 -3
  209. package/dist/node-runtime/{chunk-6427XAWG.js → chunk-QH6YL7VK.js} +3 -3
  210. package/dist/node-runtime/{chunk-LMBNLFXQ.js → chunk-QM43FEAE.js} +15 -15
  211. package/dist/node-runtime/{chunk-7QWNYZDI.js → chunk-RDDAZOMU.js} +16 -0
  212. package/dist/node-runtime/{chunk-WADV2VDS.js → chunk-RORY2HMJ.js} +46 -5
  213. package/dist/node-runtime/{chunk-H3XF4UVQ.js → chunk-RWTKOC3B.js} +1 -1
  214. package/dist/node-runtime/{chunk-V2A7CEXK.js → chunk-WHLRAGUQ.js} +13 -12
  215. package/dist/node-runtime/{chunk-GJSAD4AB.js → chunk-Y73WPE6S.js} +17 -17
  216. package/dist/node-runtime/{chunk-VSSXXL36.js → chunk-YDO2F2IA.js} +2 -2
  217. package/dist/node-runtime/{chunk-BFNXONG3.js → chunk-YVI6L6LU.js} +5 -5
  218. package/dist/node-runtime/{chunk-5D7LC2ZQ.js → chunk-ZXSGTGJ6.js} +54 -85
  219. package/dist/node-runtime/cli-runtime.js +1 -1
  220. package/dist/node-runtime/{command-3JHHXOPX.js → command-7BG7VVTS.js} +3 -3
  221. package/dist/node-runtime/{commands-KAMO2T6P.js → commands-NZLSOHPE.js} +2 -2
  222. package/dist/node-runtime/{commands-2JVNFGMQ.js → commands-QFDKNQTL.js} +9 -9
  223. package/dist/node-runtime/{direct-tool-executor-YAVOLDFY.js → direct-tool-executor-77GW4F5P.js} +3 -3
  224. package/dist/node-runtime/{export-html-KBFVV63J.js → export-html-VM4J2MNR.js} +2 -2
  225. package/dist/node-runtime/{extension-input-K24TVKVW.js → extension-input-E7BJZ35H.js} +4 -4
  226. package/dist/node-runtime/{extension-selector-SPNF7EDR.js → extension-selector-WU42XDTU.js} +4 -4
  227. package/dist/node-runtime/{gateway-VFO6SFKK.js → gateway-TWR3N65G.js} +14 -14
  228. package/dist/node-runtime/index.js +26 -27
  229. package/dist/node-runtime/{init-X2LIUB2H.js → init-HS6NQXSK.js} +2 -2
  230. package/dist/node-runtime/{install-cli-C3CF7O7N.js → install-cli-VAP6KBFN.js} +1 -1
  231. package/dist/node-runtime/{interactive-mode-LOM6AIF6.js → interactive-mode-6J5VZ2TT.js} +19 -20
  232. package/dist/node-runtime/{interactive-view-IDSCPPK7.js → interactive-view-NGFAMHPW.js} +7 -7
  233. package/dist/node-runtime/lunr-browser-J5ZZYVGM.js +174 -0
  234. package/dist/node-runtime/{lunr-cron-BKHGNBKT.js → lunr-cron-CXOL37AL.js} +7 -7
  235. package/dist/node-runtime/main.js +22 -23
  236. package/dist/node-runtime/{mobile-commands-HMP25WBC.js → mobile-commands-VTBM5DSZ.js} +6 -6
  237. package/dist/node-runtime/{model-runtime-PLQKAG4B.js → model-runtime-OO5HFLWE.js} +1 -1
  238. package/dist/node-runtime/{package-manager-cli-VCK4E2RC.js → package-manager-cli-ZLW5DZXF.js} +9 -10
  239. package/dist/node-runtime/{pi-intercom-HBPK5HSJ.js → pi-intercom-QM53RLTS.js} +2 -0
  240. package/dist/node-runtime/{pi-mcp-adapter-E6WULBKF.js → pi-mcp-adapter-5UKBZP44.js} +7 -6
  241. package/dist/node-runtime/{pi-subagents-FEUDLJOE.js → pi-subagents-XPCLLKIM.js} +65 -21
  242. package/dist/node-runtime/{proxy-modes-OSQCWRBI.js → proxy-modes-LGEUYD7R.js} +3 -3
  243. package/dist/node-runtime/rpc-entry.js +22 -23
  244. package/dist/node-runtime/{rpc-mode-P5ODXPEG.js → rpc-mode-O3XV4SID.js} +2 -2
  245. package/dist/node-runtime/{runtime-bridges-3XUQ46XW.js → runtime-bridges-QYXUX2TG.js} +8 -1
  246. package/dist/node-runtime/{session-handoff-HC7R5E24.js → session-handoff-GWARVEWT.js} +2 -2
  247. package/dist/node-runtime/{session-manager-CFN4UFM2.js → session-manager-JB5J6XBN.js} +1 -1
  248. package/dist/node-runtime/{session-selector-LHRMJOKT.js → session-selector-GIM4DHQ2.js} +4 -4
  249. package/dist/node-runtime/{settings-manager-UUZ6NUXI.js → settings-manager-WCQDUVQB.js} +7 -4
  250. package/dist/node-runtime/{setup-NRXVZBLJ.js → setup-YRBKH2LD.js} +2 -2
  251. package/dist/node-runtime/{subagent-executor-MLUMBWCP.js → subagent-executor-OTNISDQU.js} +47 -10
  252. package/dist/node-runtime/{theme-U7IGOA7O.js → theme-UOO5RVFN.js} +1 -1
  253. package/dist/node-runtime/{update-cli-4TP25CNW.js → update-cli-VBR2777K.js} +1 -2
  254. package/dist/startup/interactive-view.d.ts.map +1 -1
  255. package/dist/startup/interactive-view.js +5 -1
  256. package/dist/startup/interactive-view.js.map +1 -1
  257. package/docs/browser.md +1 -1
  258. package/docs/features.md +17 -14
  259. package/docs/index.md +1 -1
  260. package/docs/keybindings.md +1 -1
  261. package/docs/providers.md +6 -2
  262. package/docs/quickstart.md +2 -2
  263. package/docs/settings.md +2 -1
  264. package/docs/usage.md +6 -6
  265. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  266. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  267. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  268. package/examples/extensions/gondolin/package-lock.json +2 -2
  269. package/examples/extensions/gondolin/package.json +1 -1
  270. package/examples/extensions/plan-mode/README.md +1 -1
  271. package/examples/extensions/sandbox/package-lock.json +2 -2
  272. package/examples/extensions/sandbox/package.json +1 -1
  273. package/examples/extensions/with-deps/package-lock.json +2 -2
  274. package/examples/extensions/with-deps/package.json +1 -1
  275. package/package.json +4 -4
  276. package/dist/node-runtime/chunk-LISUTZS3.js +0 -19
  277. package/dist/node-runtime/lunr-browser-YNW7FTYX.js +0 -87
@@ -2,7 +2,7 @@ import { createRequire as __lunrRequire } from "node:module"; const require = __
2
2
  import {
3
3
  lightBuiltinExtensions,
4
4
  loadAllBuiltinExtensions
5
- } from "./chunk-LMBNLFXQ.js";
5
+ } from "./chunk-QM43FEAE.js";
6
6
  import {
7
7
  createProjectTrustContext,
8
8
  createStartupTui,
@@ -11,10 +11,10 @@ import {
11
11
  showFirstTimeSetup,
12
12
  showStartupSelector,
13
13
  startStartupTui
14
- } from "./chunk-UAFLNHSH.js";
14
+ } from "./chunk-OF7PWMG4.js";
15
15
  import {
16
16
  applyInheritedSubagentPermissions
17
- } from "./chunk-CSUZVNYE.js";
17
+ } from "./chunk-OVX6X377.js";
18
18
  import {
19
19
  MissingSessionCwdError,
20
20
  createAgentSessionFromServices,
@@ -23,7 +23,7 @@ import {
23
23
  formatMissingSessionCwdPrompt,
24
24
  formatNoModelsAvailableMessage,
25
25
  getMissingSessionCwdIssue
26
- } from "./chunk-TDL7UWJ7.js";
26
+ } from "./chunk-DE2JB6J5.js";
27
27
  import {
28
28
  restoreStdout,
29
29
  takeOverStdout
@@ -31,18 +31,18 @@ import {
31
31
  import {
32
32
  detectSupportedImageMimeTypeFromFile,
33
33
  resolveReadPath
34
- } from "./chunk-VSSXXL36.js";
34
+ } from "./chunk-YDO2F2IA.js";
35
35
  import {
36
36
  processImage
37
37
  } from "./chunk-AD6VXAO7.js";
38
+ import {
39
+ bindRuntimeBridges
40
+ } from "./chunk-FU6OODRZ.js";
38
41
  import {
39
42
  SettingsManager,
40
43
  applyHttpProxySettings,
41
44
  configureHttpDispatcher
42
- } from "./chunk-WADV2VDS.js";
43
- import {
44
- bindRuntimeBridges
45
- } from "./chunk-GMHJCCEN.js";
45
+ } from "./chunk-RORY2HMJ.js";
46
46
  import {
47
47
  ProjectTrustStore,
48
48
  hasTrustRequiringProjectResources
@@ -50,14 +50,14 @@ import {
50
50
  import {
51
51
  resolveCliModel,
52
52
  resolveModelScope
53
- } from "./chunk-OFKSVRV7.js";
53
+ } from "./chunk-GYIXXQAO.js";
54
54
  import {
55
55
  migrateLegacyGlobalInstructions
56
56
  } from "./chunk-M3LZLQW2.js";
57
57
  import {
58
58
  SessionManager,
59
59
  assertValidSessionId
60
- } from "./chunk-XLTL257W.js";
60
+ } from "./chunk-2KIPT4HJ.js";
61
61
  import {
62
62
  registerCustomizeBridge
63
63
  } from "./chunk-4EULYYR4.js";
@@ -69,7 +69,7 @@ import {
69
69
  } from "./chunk-2TKODGBZ.js";
70
70
  import {
71
71
  SessionSelectorComponent
72
- } from "./chunk-ORH324EP.js";
72
+ } from "./chunk-PCEW76PM.js";
73
73
  import {
74
74
  SessionOwnership
75
75
  } from "./chunk-UAEOTO52.js";
@@ -92,7 +92,7 @@ import {
92
92
  import {
93
93
  initTheme,
94
94
  stopThemeWatcher
95
- } from "./chunk-7QWNYZDI.js";
95
+ } from "./chunk-RDDAZOMU.js";
96
96
  import {
97
97
  APP_NAME,
98
98
  CONFIG_DIR_NAME,
@@ -730,17 +730,17 @@ async function main(args, options) {
730
730
  resetTimings(), (args.includes("--offline") || isTruthyEnvFlag(process.env.PI_OFFLINE)) && (process.env.PI_OFFLINE = "1");
731
731
  let cwd = process.cwd(), agentDir = getAgentDir(), bootstrapSettingsManager = SettingsManager.create(cwd, agentDir, { projectTrusted: !1 });
732
732
  if (applyHttpProxySettings(bootstrapSettingsManager.getGlobalSettings().httpProxy), configureHttpDispatcher(), ["setup", "features", "uninstall", "browser"].includes(args[0])) {
733
- let { handleInstallCli } = await import("./install-cli-C3CF7O7N.js");
733
+ let { handleInstallCli } = await import("./install-cli-VAP6KBFN.js");
734
734
  if (await handleInstallCli(args))
735
735
  return;
736
736
  }
737
737
  if (args[0] === "update") {
738
- let { handleUpdateCli } = await import("./update-cli-4TP25CNW.js");
738
+ let { handleUpdateCli } = await import("./update-cli-VBR2777K.js");
739
739
  if (await handleUpdateCli(args))
740
740
  return;
741
741
  }
742
742
  if (["install", "remove", "uninstall", "list", "config"].includes(args[0])) {
743
- let { handleConfigCommand, handlePackageCommand } = await import("./package-manager-cli-VCK4E2RC.js");
743
+ let { handleConfigCommand, handlePackageCommand } = await import("./package-manager-cli-ZLW5DZXF.js");
744
744
  if (await handlePackageCommand(args, { extensionFactories: options?.extensionFactories })) {
745
745
  process.exit(process.exitCode ?? 0);
746
746
  return;
@@ -749,7 +749,7 @@ async function main(args, options) {
749
749
  return;
750
750
  }
751
751
  if (args[0] === "gateway") {
752
- let { handleGatewayCommand } = await import("./command-3JHHXOPX.js");
752
+ let { handleGatewayCommand } = await import("./command-7BG7VVTS.js");
753
753
  if (await handleGatewayCommand(args))
754
754
  return;
755
755
  }
@@ -764,7 +764,7 @@ async function main(args, options) {
764
764
  if (time("parseArgs"), parsed.version && (console.log(VERSION), process.exit(0)), parsed.export) {
765
765
  let result;
766
766
  try {
767
- let { exportFromFile } = await import("./export-html-KBFVV63J.js"), outputPath = parsed.messages.length > 0 ? parsed.messages[0] : void 0;
767
+ let { exportFromFile } = await import("./export-html-VM4J2MNR.js"), outputPath = parsed.messages.length > 0 ? parsed.messages[0] : void 0;
768
768
  result = await exportFromFile(parsed.export, outputPath);
769
769
  } catch (error) {
770
770
  let message = error instanceof Error ? error.message : "Failed to export session";
@@ -772,7 +772,7 @@ async function main(args, options) {
772
772
  }
773
773
  console.log(`Exported to: ${result}`), process.exit(0);
774
774
  }
775
- let appMode = resolveAppMode(parsed, process.stdin.isTTY, process.stdout.isTTY), interactiveModeImport = appMode === "interactive" ? import("./interactive-mode-LOM6AIF6.js") : void 0, startupView = appMode === "interactive" ? options?.startupView : void 0;
775
+ let appMode = resolveAppMode(parsed, process.stdin.isTTY, process.stdout.isTTY), interactiveModeImport = appMode === "interactive" ? import("./interactive-mode-6J5VZ2TT.js") : void 0, startupView = appMode === "interactive" ? options?.startupView : void 0;
776
776
  options?.startupView && !startupView && options.startupView.stop(), applyInheritedSubagentPermissions(), appMode !== "interactive" && !isPlainRuntimeMetadataCommand(parsed) && takeOverStdout(), parsed.mode === "rpc" && parsed.fileArgs.length > 0 && (console.error(chalk4.red("Error: @file arguments are not supported in RPC mode")), process.exit(1)), validateForkFlags(parsed), validateSessionIdFlags(parsed);
777
777
  let { migratedAuthProviders: migratedProviders, deprecationWarnings } = runMigrations(cwd);
778
778
  time("runMigrations");
@@ -929,12 +929,12 @@ ${EXTENSION_LOAD_FAILURE_HINT}` : "";
929
929
  extensionHint && console.error(chalk4.yellow(EXTENSION_LOAD_FAILURE_HINT)), process.exit(1);
930
930
  }
931
931
  if (time("createAgentSession"), appMode !== "interactive" && !session.model && (console.error(chalk4.red(formatNoModelsAvailableMessage())), process.exit(1)), startupBenchmark && appMode !== "interactive" && (console.error(chalk4.red("Error: PI_STARTUP_BENCHMARK only supports interactive mode")), process.exit(1)), appMode === "rpc") {
932
- let { runRpcMode } = await import("./rpc-mode-P5ODXPEG.js");
932
+ let { runRpcMode } = await import("./rpc-mode-O3XV4SID.js");
933
933
  printTimings(), await runRpcMode(runtime);
934
934
  } else if (appMode === "interactive") {
935
935
  let [{ InteractiveMode }, { loadDeferredBuiltinExtensions }] = await Promise.all([
936
936
  interactiveModeImport,
937
- import("./builtin-extensions-GVC6IFDU.js")
937
+ import("./builtin-extensions-EBAWTH4M.js")
938
938
  ]), interactiveMode = new InteractiveMode(runtime, {
939
939
  migratedProviders,
940
940
  modelFallbackMessage,
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
3
  theme
4
- } from "./chunk-7QWNYZDI.js";
4
+ } from "./chunk-RDDAZOMU.js";
5
5
 
6
6
  // packages/coding-agent/dist/modes/interactive/components/dynamic-border.js
7
7
  var DynamicBorder = class {
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
3
  estimateTokens
4
- } from "./chunk-OFKSVRV7.js";
4
+ } from "./chunk-GYIXXQAO.js";
5
5
 
6
6
  // packages/coding-agent/dist/core/context-breakdown.js
7
7
  var CHARS_PER_TOKEN = 4, PROJECT_CONTEXT_RE = /<project_context>[\s\S]*?<\/project_context>/, PROJECT_INSTRUCTIONS_RE = /<project_instructions(?:\s+path="([^"]*)")?>([\s\S]*?)<\/project_instructions>/g, SKILLS_BLOCK_RE = /\n\nThe following skills provide specialized instructions for specific tasks\.[\s\S]*<\/available_skills>/;
@@ -7,7 +7,7 @@ import {
7
7
  createSyntheticSourceInfo,
8
8
  expandPromptTemplate,
9
9
  formatSkillsForPrompt
10
- } from "./chunk-IQIEU7SB.js";
10
+ } from "./chunk-F4FLTQKV.js";
11
11
  import {
12
12
  stripFrontmatter
13
13
  } from "./chunk-QFWG2RVL.js";
@@ -16,7 +16,7 @@ import {
16
16
  createLocalBashOperations,
17
17
  createToolDefinitionFromAgentTool,
18
18
  wrapToolDefinition
19
- } from "./chunk-VSSXXL36.js";
19
+ } from "./chunk-YDO2F2IA.js";
20
20
  import {
21
21
  DEFAULT_MAX_BYTES,
22
22
  truncateTail
@@ -28,10 +28,10 @@ import {
28
28
  ModelRuntime,
29
29
  isAuthInvalidError,
30
30
  isUsageLimitError
31
- } from "./chunk-GS66LV4M.js";
31
+ } from "./chunk-KJ6DWS3K.js";
32
32
  import {
33
33
  SettingsManager
34
- } from "./chunk-WADV2VDS.js";
34
+ } from "./chunk-RORY2HMJ.js";
35
35
  import {
36
36
  DEFAULT_THINKING_LEVEL,
37
37
  calculateContextTokens,
@@ -43,17 +43,17 @@ import {
43
43
  generateBranchSummary,
44
44
  prepareCompaction,
45
45
  shouldCompact
46
- } from "./chunk-OFKSVRV7.js";
46
+ } from "./chunk-GYIXXQAO.js";
47
47
  import {
48
48
  ExtensionRunner,
49
49
  emitSessionShutdownEvent
50
- } from "./chunk-5BNJ4JUH.js";
50
+ } from "./chunk-GJ2RDBRL.js";
51
51
  import {
52
52
  getSubagentCancellation
53
53
  } from "./chunk-BBUVIEZB.js";
54
54
  import {
55
55
  gateToolCall
56
- } from "./chunk-5D7LC2ZQ.js";
56
+ } from "./chunk-ZXSGTGJ6.js";
57
57
  import {
58
58
  isUserInstructionsPath,
59
59
  loadSelectedUserInstructions
@@ -66,13 +66,13 @@ import {
66
66
  } from "./chunk-CSFI6YXL.js";
67
67
  import {
68
68
  SessionTransferError
69
- } from "./chunk-AZJHNQKQ.js";
69
+ } from "./chunk-I54LGHWM.js";
70
70
  import {
71
71
  CURRENT_SESSION_VERSION,
72
72
  SessionManager,
73
73
  getDefaultSessionDir,
74
74
  getLatestCompactionEntry
75
- } from "./chunk-XLTL257W.js";
75
+ } from "./chunk-2KIPT4HJ.js";
76
76
  import {
77
77
  convertToLlm
78
78
  } from "./chunk-FVDOXRUD.js";
@@ -90,7 +90,7 @@ import {
90
90
  import {
91
91
  getThemeByName,
92
92
  theme
93
- } from "./chunk-7QWNYZDI.js";
93
+ } from "./chunk-RDDAZOMU.js";
94
94
  import {
95
95
  CONFIG_DIR_NAME,
96
96
  getAgentDir,
@@ -649,9 +649,25 @@ function snapFileName(absPath) {
649
649
  return `${createHash("sha1").update(absPath).digest("hex")}.snap`;
650
650
  }
651
651
 
652
+ // packages/coding-agent/dist/core/subagent-wait-interruption.js
653
+ var SUBAGENT_WAIT_INTERRUPTION_SYMBOL = /* @__PURE__ */ Symbol.for("@lunr/subagent-wait-interruption");
654
+ function getBridge() {
655
+ let globals = globalThis, existing = globals[SUBAGENT_WAIT_INTERRUPTION_SYMBOL];
656
+ if (existing)
657
+ return existing;
658
+ let bridge = { owners: /* @__PURE__ */ new Map() };
659
+ return globals[SUBAGENT_WAIT_INTERRUPTION_SYMBOL] = bridge, bridge;
660
+ }
661
+ function registerSubagentWaitInterruptionOwner(sessionId, owner) {
662
+ let owners = getBridge().owners;
663
+ return owners.set(sessionId, owner), () => {
664
+ owners.get(sessionId) === owner && owners.delete(sessionId);
665
+ };
666
+ }
667
+
652
668
  // packages/coding-agent/dist/core/system-prompt.js
653
669
  function buildSystemPrompt(options) {
654
- let { customPrompt, modelSlug, selectedTools, appendSystemPrompt, cwd, contextFiles: providedContextFiles, skills: providedSkills } = options, promptCwd = cwd.replace(/\\/g, "/"), appendSection = appendSystemPrompt ? `
670
+ let { customPrompt, modelSlug, automaticSubagentDelegation = !0, selectedTools, appendSystemPrompt, cwd, contextFiles: providedContextFiles, skills: providedSkills } = options, promptCwd = cwd.replace(/\\/g, "/"), appendSection = appendSystemPrompt ? `
655
671
 
656
672
  ${appendSystemPrompt}` : "", contextFiles = providedContextFiles ?? [], skills = providedSkills ?? [];
657
673
  if (customPrompt) {
@@ -684,11 +700,11 @@ Behavior guidelines:
684
700
  - Default to writing no comments. Only add one if the why is non-obvious: a hidden constraint, a subtle invariant, a workaround for a specific bug, something that would surprise the reader. If removing the comment wouldn't confuse a future reader, don't write it.
685
701
  - Keep comments up to date! When making changes, it's important to keep things in sync. An outdated comment is worse than no comment at all.
686
702
  - Carefully consider the reversibility and blast radius of actions. Generally you can freely take local, reversible actions like editing files or running tests. But for actions that are hard to reverse, affect shared systems beyond your local environment, or could otherwise be risky or destructive, check with the user before proceeding.
687
- - Orchestrate subagents with intent! Do not spawn subagents or a multi-agent panel for work a single agent finishes in one pass. Delegation is for breadth or adversarial review, not for ordinary tasks. Use subagents as a tool when there is genuine benefit to it or the user explicitly asks for it.
703
+ ${automaticSubagentDelegation ? "- Orchestrate subagents with intent! Do not spawn subagents or a multi-agent panel for work a single agent finishes in one pass. Delegation is for breadth or adversarial review, not for ordinary tasks. Use subagents as a tool when there is genuine benefit to it or the user explicitly asks for it." : "- Work on tasks directly. Launch subagents only when the user specifically instructs you to delegate work."}
688
704
  - When several agents work in parallel, state file ownership up front so they do not collide.
689
705
  - Tests are good! Endless smoke tests, regressions tests for feature deletions, etc, much less good. Tests should be focused, not slop.
690
706
  - Prefer editing existing files to creating new ones.
691
- - When a reusable excerpt, prompt, or code fragment should have its own Copy button, wrap only that payload in a fenced Markdown block with the info string \`lunr-copy\`. Keep explanation outside the block. Use a longer backtick or tilde fence when the payload contains fenced code.
707
+ - When a reusable excerpt, prompt, or code fragment should be click-to-copy, wrap only that payload in a fenced Markdown block with the info string \`lunr-copy\`. Keep explanation outside the block. Use a longer backtick or tilde fence when the payload contains fenced code.
692
708
  - Only use emojis if the user explicitly requests it.
693
709
  - Never exfil private data on public platforms like github or any other services under any circumstances.
694
710
 
@@ -701,9 +717,11 @@ Guidelines:
701
717
  - Each edits[].oldText is matched against the original file, not after earlier edits are applied. Do not emit overlapping or nested edits. Merge nearby changes into one edit.
702
718
  - Keep edits[].oldText as small as possible while still being unique in the file. Do not pad with large unchanged regions.
703
719
  - Use write only for new files or complete rewrites.
704
- ${todoGuideline}- Use subagents for independent parallel work, specialist analysis, or substantial research. Subagents start with fresh sessions. Use intercom instead to coordinate with an existing lunR session.
720
+ ${todoGuideline}${automaticSubagentDelegation ? `- Use subagents for independent parallel work, specialist analysis, or substantial research. Subagents start with fresh sessions. Use intercom instead to coordinate with an existing lunR session.
721
+ ` : ""}- Resume a subagent only when its work is unfinished or the next task genuinely needs the context it built up. Otherwise launch a new subagent.
705
722
  - Use ast_search for structural code matches.
706
723
  - Use cron only when the user asks to schedule or manage unattended prompts.
724
+ - For gateway work, inspect with \`lunr gateway status\` or \`lunr gateway doctor\`, configure with \`lunr gateway setup\`, and run \`lunr gateway start\` or \`lunr gateway stop\` only with user approval. Test by asking the user to send \`/whoami\` or a normal message to the bot; there is no arbitrary outbound send command. Keep bot tokens out of commands and output. See ${docsPath}/features.md for pairing, logs, and service details.
707
725
  - Memory stores established, durable facts and stable preferences. Do not store behavior instructions, transient task details, transcripts, guesses, or secrets. Change memory only with the memory tools.
708
726
  - ~/.lunr/agent/agents/ contains optional global and per-model AGENTS.md instructions written by the user. Never modify this tree, including through shell commands.
709
727
  - Use web search when information is current, uncertain, externally referenced, or research-heavy, and cite the sources used.
@@ -765,6 +783,11 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
765
783
  _isAgentRunActive = !1;
766
784
  _idleWaitPromise;
767
785
  _resolveIdleWait;
786
+ _activePromptRun;
787
+ _waitPromptHandoff;
788
+ _waitPromptAcceptance = Promise.resolve();
789
+ _waitPromptGeneration = 0;
790
+ _unregisterSubagentWaitInterruptionOwners = [];
768
791
  /** Tracks pending steering messages for UI display. Removed when delivered. */
769
792
  _steeringMessages = [];
770
793
  /** Tracks pending follow-up messages for UI display. Removed when delivered. */
@@ -815,12 +838,16 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
815
838
  _baseSystemPrompt = "";
816
839
  _baseSystemPromptOptions;
817
840
  _systemPromptOverride;
818
- // lunr: core-owned system-prompt append (plan mode addendum) applied on top of base/override
841
+ // lunr: core-owned system-prompt append (read-only mode addendum) applied on top of base/override
819
842
  _systemPromptAppend;
820
- // lunr: core-owned tool-call gates (plan mode) checked before extension tool_call handlers
843
+ // lunr: core-owned tool-call gates (read-only mode) checked before extension tool_call handlers
821
844
  _toolCallGates = [];
822
845
  constructor(config) {
823
- this.agent = config.agent, this.sessionManager = config.sessionManager, this.settingsManager = config.settingsManager, this._scopedModels = config.scopedModels ?? [], this._resourceLoader = config.resourceLoader, this._customTools = config.customTools ?? [], this._cwd = config.cwd, this._agentDir = config.agentDir ?? getAgentDir(), this._modelRuntime = config.modelRuntime, this._syncOpenAIServiceTier(), this._extensionRunnerRef = config.extensionRunnerRef, this._initialActiveToolNames = config.initialActiveToolNames, this._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : void 0, this._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : void 0, this._baseToolsOverride = config.baseToolsOverride, this._sessionStartEvent = config.sessionStartEvent ?? { type: "session_start", reason: "startup" }, this._unsubscribeAgent = this.agent.subscribe(this._handleAgentEvent), this._installAgentToolHooks(), this._installAgentNextTurnRefresh(), this._buildRuntime({
846
+ this.agent = config.agent, this.sessionManager = config.sessionManager, this.settingsManager = config.settingsManager, this._scopedModels = config.scopedModels ?? [], this._resourceLoader = config.resourceLoader, this._customTools = config.customTools ?? [], this._cwd = config.cwd, this._agentDir = config.agentDir ?? getAgentDir(), this._modelRuntime = config.modelRuntime, this._syncOpenAIServiceTier(), this._extensionRunnerRef = config.extensionRunnerRef, this._initialActiveToolNames = config.initialActiveToolNames, this._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : void 0, this._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : void 0, this._baseToolsOverride = config.baseToolsOverride, this._sessionStartEvent = config.sessionStartEvent ?? { type: "session_start", reason: "startup" };
847
+ let waitInterruptionOwner = { register: () => this._registerSubagentWaitInterruption() };
848
+ for (let identity of new Set([this.sessionId, this.sessionFile].filter((value) => !!value)))
849
+ this._unregisterSubagentWaitInterruptionOwners.push(registerSubagentWaitInterruptionOwner(identity, waitInterruptionOwner));
850
+ this._unsubscribeAgent = this.agent.subscribe(this._handleAgentEvent), this._installAgentToolHooks(), this._installAgentNextTurnRefresh(), this._buildRuntime({
824
851
  activeToolNames: this._initialActiveToolNames,
825
852
  includeAllExtensionTools: !0
826
853
  });
@@ -1152,13 +1179,16 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
1152
1179
  */
1153
1180
  transferring = !1;
1154
1181
  setTransferring(value) {
1155
- this.transferring = value;
1182
+ this.transferring = value, value && this._invalidateWaitPromptHandoffs("Session transfer interrupted the pending prompt.");
1156
1183
  }
1157
1184
  assertCanStartWork() {
1158
1185
  if (this.sessionManager.assertWritable(), this.transferring)
1159
1186
  throw new Error("Session transfer is in progress. Wait or reclaim the session.");
1160
1187
  }
1161
1188
  dispose() {
1189
+ this._invalidateWaitPromptHandoffs("Session closed before the pending prompt could run.");
1190
+ for (let unregister of this._unregisterSubagentWaitInterruptionOwners.splice(0))
1191
+ unregister();
1162
1192
  try {
1163
1193
  this.abortRetry(), this.abortCompaction(), this.abortBranchSummary(), this.abortBash(), this.agent.abort();
1164
1194
  } catch {
@@ -1188,12 +1218,16 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
1188
1218
  get isIdle() {
1189
1219
  return !this._isAgentRunActive;
1190
1220
  }
1221
+ /** Whether normal Enter is still being reserved for an interrupted wait handoff. */
1222
+ get isWaitPromptHandoffActive() {
1223
+ return this._waitPromptHandoff?.accepting === !0;
1224
+ }
1191
1225
  /** Current effective system prompt (includes any per-turn extension modifications) */
1192
1226
  get systemPrompt() {
1193
1227
  return this.agent.state.systemPrompt;
1194
1228
  }
1195
1229
  /**
1196
- * lunr: register a core-owned tool-call gate (plan mode). Gates run before extension
1230
+ * lunr: register a core-owned tool-call gate (read-only mode). Gates run before extension
1197
1231
  * tool_call handlers and even when no extension handles tool_call. Returns an
1198
1232
  * unsubscribe function.
1199
1233
  */
@@ -1337,6 +1371,7 @@ ${this._systemPromptAppend}` : prompt;
1337
1371
  return this._baseSystemPromptOptions = {
1338
1372
  cwd: this._cwd,
1339
1373
  modelSlug: this.model ? `${this.model.provider}/${this.model.id}` : void 0,
1374
+ automaticSubagentDelegation: this.settingsManager.getAutomaticSubagentDelegation(),
1340
1375
  skills: loadedSkills,
1341
1376
  contextFiles,
1342
1377
  customPrompt: loaderSystemPrompt,
@@ -1352,23 +1387,47 @@ ${this._systemPromptAppend}` : prompt;
1352
1387
  // =========================================================================
1353
1388
  // Prompting
1354
1389
  // =========================================================================
1390
+ _registerSubagentWaitInterruption() {
1391
+ let run = this._activePromptRun, ownerSignal = this.agent.signal, wait = run && ownerSignal ? { controller: new AbortController(), interrupted: !1, ownerSignal } : void 0;
1392
+ return run && wait && (run.waits.add(wait), run.gracefulStopRequested && (wait.interrupted = !0, wait.controller.abort())), {
1393
+ signal: wait?.controller.signal ?? new AbortController().signal,
1394
+ wasInterrupted: () => wait?.interrupted === !0,
1395
+ unregister: () => {
1396
+ wait && run?.waits.delete(wait);
1397
+ }
1398
+ };
1399
+ }
1400
+ _interruptSubagentWaits(run, ownerSignal) {
1401
+ for (let wait of run.waits)
1402
+ wait.ownerSignal === ownerSignal && (wait.interrupted = !0, wait.controller.abort());
1403
+ }
1404
+ _invalidateWaitPromptHandoffs(message) {
1405
+ this._waitPromptGeneration++;
1406
+ let handoff = this._waitPromptHandoff;
1407
+ if (this._waitPromptHandoff = void 0, !handoff)
1408
+ return;
1409
+ let error = new Error(message);
1410
+ for (let reservation of handoff.reservations.splice(0))
1411
+ reservation.reject(error);
1412
+ }
1355
1413
  async _runAgentPrompt(messages) {
1356
- this._isAgentRunActive = !0;
1414
+ let run = { waits: /* @__PURE__ */ new Set(), gracefulStopRequested: !1 };
1415
+ this._activePromptRun = run, this._isAgentRunActive = !0;
1357
1416
  try {
1358
- for (await this.agent.prompt(messages); await this._handlePostAgentRun(); )
1417
+ for (await this.agent.prompt(messages); await this._handlePostAgentRun(run); )
1359
1418
  await this.agent.continue();
1360
1419
  } finally {
1361
- this._systemPromptOverride = void 0, this._flushPendingBashMessages(), await this._emitAgentSettled();
1420
+ this._activePromptRun === run && (this._activePromptRun = void 0), this._systemPromptOverride = void 0, this._flushPendingBashMessages(), await this._emitAgentSettled();
1362
1421
  }
1363
1422
  }
1364
- async _handlePostAgentRun() {
1423
+ async _handlePostAgentRun(run) {
1365
1424
  let msg = this._lastAssistantMessage;
1366
- return this._lastAssistantMessage = void 0, msg ? msg.stopReason === "error" && this._isRotationError(msg) && await this._tryRotateSubscriptionKey(msg) || this._isRetryableError(msg) && await this._prepareRetry(msg) || msg.stopReason === "error" && this._isRetryableError(msg) && await this._tryRotateSubscriptionKey(msg) || (msg.stopReason === "error" && this._retryAttempt > 0 && (this._emit({
1425
+ return this._lastAssistantMessage = void 0, !msg || run.gracefulStopRequested ? !1 : msg.stopReason === "error" && this._isRotationError(msg) && await this._tryRotateSubscriptionKey(msg) || this._isRetryableError(msg) && await this._prepareRetry(msg) || msg.stopReason === "error" && this._isRetryableError(msg) && await this._tryRotateSubscriptionKey(msg) || (msg.stopReason === "error" && this._retryAttempt > 0 && (this._emit({
1367
1426
  type: "auto_retry_end",
1368
1427
  success: !1,
1369
1428
  attempt: this._retryAttempt,
1370
1429
  finalError: msg.errorMessage
1371
- }), this._retryAttempt = 0), await this._checkCompaction(msg)) ? !0 : this.agent.hasQueuedMessages() : !1;
1430
+ }), this._retryAttempt = 0), await this._checkCompaction(msg)) ? !0 : this.agent.hasQueuedMessages();
1372
1431
  }
1373
1432
  /**
1374
1433
  * Send a prompt to the agent.
@@ -1381,60 +1440,117 @@ ${this._systemPromptAppend}` : prompt;
1381
1440
  */
1382
1441
  async prompt(text, options) {
1383
1442
  this.assertCanStartWork();
1384
- let expandPromptTemplates = options?.expandPromptTemplates ?? !0, preflightResult = options?.preflightResult, messages;
1443
+ let preflightResult = options?.preflightResult, prepared, messages;
1385
1444
  try {
1386
- if (expandPromptTemplates && text.startsWith("/") && await this._tryExecuteExtensionCommand(text)) {
1445
+ if (prepared = await this._preparePromptInput(text, options, this.isStreaming ? options?.streamingBehavior : void 0), !prepared) {
1387
1446
  preflightResult?.(!0);
1388
1447
  return;
1389
1448
  }
1390
- let currentText = text, currentImages = options?.images;
1391
- if (this._extensionRunner.hasHandlers("input")) {
1392
- let inputResult = await this._extensionRunner.emitInput(currentText, currentImages, options?.source ?? "interactive", this.isStreaming ? options?.streamingBehavior : void 0);
1393
- if (inputResult.action === "handled") {
1394
- preflightResult?.(!0);
1395
- return;
1396
- }
1397
- inputResult.action === "transform" && (currentText = inputResult.text, currentImages = inputResult.images ?? currentImages);
1398
- }
1399
- let expandedText = currentText;
1400
- if (expandPromptTemplates && (expandedText = this._expandSkillCommand(expandedText), expandedText = expandPromptTemplate(expandedText, [...this.promptTemplates])), this.isStreaming) {
1449
+ if (this.isStreaming) {
1401
1450
  if (!options?.streamingBehavior)
1402
1451
  throw new Error("Agent is already processing. Specify streamingBehavior ('steer' or 'followUp') to queue the message.");
1403
- options.streamingBehavior === "followUp" ? await this._queueFollowUp(expandedText, currentImages) : await this._queueSteer(expandedText, currentImages), preflightResult?.(!0);
1452
+ options.streamingBehavior === "followUp" ? await this._queueFollowUp(prepared.text, prepared.images) : await this._queueSteer(prepared.text, prepared.images), preflightResult?.(!0);
1404
1453
  return;
1405
1454
  }
1406
- if (this._flushPendingBashMessages(), !this.model)
1407
- throw new Error(formatNoModelSelectedMessage());
1408
- if (!(this._modelRuntime.hasConfiguredAuth(this.model.provider) || await this._modelRuntime.checkAuth(this.model.provider) !== void 0))
1409
- throw this._modelRuntime.isUsingOAuth(this.model.provider) ? new Error(`Authentication failed for "${this.model.provider}". Credentials may have expired or network is unavailable. Run '/login ${this.model.provider}' to re-authenticate.`) : new Error(formatNoApiKeyFoundMessage(this.model.provider));
1410
- let lastAssistant = this._findLastAssistantMessage();
1411
- lastAssistant && await this._checkCompaction(lastAssistant, !1), messages = [];
1412
- let userContent = [{ type: "text", text: expandedText }];
1413
- currentImages && userContent.push(...currentImages), messages.push({
1455
+ messages = await this._createPromptMessages(prepared);
1456
+ } catch (error) {
1457
+ throw preflightResult?.(!1), error;
1458
+ }
1459
+ preflightResult?.(!0), await this._runAgentPrompt(messages);
1460
+ }
1461
+ async _preparePromptInput(text, options, streamingBehavior) {
1462
+ let expandPromptTemplates = options?.expandPromptTemplates ?? !0;
1463
+ if (expandPromptTemplates && text.startsWith("/") && await this._tryExecuteExtensionCommand(text))
1464
+ return;
1465
+ let currentText = text, currentImages = options?.images;
1466
+ if (this._extensionRunner.hasHandlers("input")) {
1467
+ let inputResult = await this._extensionRunner.emitInput(currentText, currentImages, options?.source ?? "interactive", streamingBehavior);
1468
+ if (inputResult.action === "handled")
1469
+ return;
1470
+ inputResult.action === "transform" && (currentText = inputResult.text, currentImages = inputResult.images ?? currentImages);
1471
+ }
1472
+ return expandPromptTemplates && (currentText = this._expandSkillCommand(currentText), currentText = expandPromptTemplate(currentText, [...this.promptTemplates])), { text: currentText, images: currentImages };
1473
+ }
1474
+ async _createPromptMessages(input) {
1475
+ if (this._flushPendingBashMessages(), !this.model)
1476
+ throw new Error(formatNoModelSelectedMessage());
1477
+ if (!(this._modelRuntime.hasConfiguredAuth(this.model.provider) || await this._modelRuntime.checkAuth(this.model.provider) !== void 0))
1478
+ throw this._modelRuntime.isUsingOAuth(this.model.provider) ? new Error(`Authentication failed for "${this.model.provider}". Credentials may have expired or network is unavailable. Run '/login ${this.model.provider}' to re-authenticate.`) : new Error(formatNoApiKeyFoundMessage(this.model.provider));
1479
+ let lastAssistant = this._findLastAssistantMessage();
1480
+ lastAssistant && await this._checkCompaction(lastAssistant, !1);
1481
+ let userContent = [{ type: "text", text: input.text }];
1482
+ input.images && userContent.push(...input.images);
1483
+ let messages = [
1484
+ {
1414
1485
  role: "user",
1415
1486
  content: userContent,
1416
1487
  timestamp: Date.now()
1417
- });
1418
- for (let msg of this._pendingNextTurnMessages)
1419
- messages.push(msg);
1420
- this._pendingNextTurnMessages = [];
1421
- let result = await this._extensionRunner.emitBeforeAgentStart(expandedText, currentImages, this._baseSystemPrompt, this._baseSystemPromptOptions);
1422
- if (result?.messages)
1423
- for (let msg of result.messages)
1424
- messages.push({
1425
- role: "custom",
1426
- customType: msg.customType,
1427
- // Untyped extensions can pass null/missing content; normalize at ingestion.
1428
- content: msg.content ?? [],
1429
- display: msg.display,
1430
- details: msg.details,
1431
- timestamp: Date.now()
1432
- });
1433
- result?.systemPrompt !== void 0 ? (this._systemPromptOverride = result.systemPrompt, this.agent.state.systemPrompt = this._withSystemPromptAppend(result.systemPrompt)) : (this._systemPromptOverride = void 0, this.agent.state.systemPrompt = this._withSystemPromptAppend(this._baseSystemPrompt));
1488
+ },
1489
+ ...this._pendingNextTurnMessages
1490
+ ];
1491
+ this._pendingNextTurnMessages = [];
1492
+ let result = await this._extensionRunner.emitBeforeAgentStart(input.text, input.images, this._baseSystemPrompt, this._baseSystemPromptOptions);
1493
+ if (result?.messages)
1494
+ for (let msg of result.messages)
1495
+ messages.push({
1496
+ role: "custom",
1497
+ customType: msg.customType,
1498
+ content: msg.content ?? [],
1499
+ display: msg.display,
1500
+ details: msg.details,
1501
+ timestamp: Date.now()
1502
+ });
1503
+ return result?.systemPrompt !== void 0 ? (this._systemPromptOverride = result.systemPrompt, this.agent.state.systemPrompt = this._withSystemPromptAppend(result.systemPrompt)) : (this._systemPromptOverride = void 0, this.agent.state.systemPrompt = this._withSystemPromptAppend(this._baseSystemPrompt)), messages;
1504
+ }
1505
+ async interruptSubagentWaitWithPrompt(text, options) {
1506
+ let acceptance = this._waitPromptAcceptance.then(() => this._reserveWaitPrompt(text, options));
1507
+ return this._waitPromptAcceptance = acceptance.then(() => {
1508
+ }, () => {
1509
+ }), acceptance;
1510
+ }
1511
+ async _reserveWaitPrompt(text, options) {
1512
+ this.assertCanStartWork();
1513
+ let activeRun = this._activePromptRun, existing = this._waitPromptHandoff, activeWait = activeRun?.waits.values().next().value, run = existing?.accepting ? existing.run : activeWait ? activeRun : void 0, ownerSignal = existing?.accepting ? existing.ownerSignal : activeWait?.ownerSignal;
1514
+ if (!run || !ownerSignal)
1515
+ return;
1516
+ let handoff = existing?.run === run && existing.accepting ? existing : {
1517
+ run,
1518
+ ownerSignal,
1519
+ generation: this._waitPromptGeneration,
1520
+ reservations: [],
1521
+ draining: !1,
1522
+ accepting: !0
1523
+ };
1524
+ this._waitPromptHandoff = handoff;
1525
+ let prepared;
1526
+ try {
1527
+ prepared = await this._preparePromptInput(text, options, void 0);
1434
1528
  } catch (error) {
1435
- throw preflightResult?.(!1), error;
1529
+ throw handoff.reservations.length === 0 && this._waitPromptHandoff === handoff && (this._waitPromptHandoff = void 0), error;
1530
+ }
1531
+ if (!prepared)
1532
+ return handoff.reservations.length === 0 && this._waitPromptHandoff === handoff && (this._waitPromptHandoff = void 0), { completion: Promise.resolve() };
1533
+ let resolveCompletion = () => {
1534
+ }, rejectCompletion = (_error) => {
1535
+ }, completion = new Promise((resolve3, reject) => {
1536
+ resolveCompletion = resolve3, rejectCompletion = reject;
1537
+ });
1538
+ return handoff.reservations.push({ input: prepared, resolve: resolveCompletion, reject: rejectCompletion }), !run.gracefulStopRequested && this.agent.requestGracefulStop(handoff.ownerSignal) && (run.gracefulStopRequested = !0), this._interruptSubagentWaits(run, handoff.ownerSignal), handoff.draining || (handoff.draining = !0, this._drainWaitPromptHandoff(handoff)), { completion };
1539
+ }
1540
+ async _drainWaitPromptHandoff(handoff) {
1541
+ for (await this.waitForIdle(); this._waitPromptHandoff === handoff && handoff.generation === this._waitPromptGeneration && handoff.reservations.length > 0; ) {
1542
+ let reservation = handoff.reservations[0];
1543
+ try {
1544
+ this.assertCanStartWork();
1545
+ let messages = await this._createPromptMessages(reservation.input);
1546
+ handoff.accepting = !1, await this._runAgentPrompt(messages), reservation.resolve();
1547
+ } catch (error) {
1548
+ reservation.reject(error);
1549
+ } finally {
1550
+ handoff.reservations[0] === reservation && handoff.reservations.shift();
1551
+ }
1436
1552
  }
1437
- messages && (preflightResult?.(!0), await this._runAgentPrompt(messages));
1553
+ handoff.accepting = !1, this._waitPromptHandoff === handoff && (this._waitPromptHandoff = void 0);
1438
1554
  }
1439
1555
  /**
1440
1556
  * Try to execute an extension command. Returns true if command was found and executed.
@@ -1618,7 +1734,7 @@ ${args}` : skillBlock;
1618
1734
  * Abort current operation and wait for agent to become idle.
1619
1735
  */
1620
1736
  async abort() {
1621
- this.abortRetry(), this.agent.abort(), await this.waitForIdle();
1737
+ this._invalidateWaitPromptHandoffs("The active run was aborted before the pending prompt could run."), this.abortRetry(), this.agent.abort(), await this.waitForIdle();
1622
1738
  }
1623
1739
  async waitForIdle() {
1624
1740
  this.isIdle || await this._getIdleWaitPromise();
@@ -2289,6 +2405,7 @@ ${args}` : skillBlock;
2289
2405
  });
2290
2406
  }
2291
2407
  async reload(options) {
2408
+ this._invalidateWaitPromptHandoffs("Extensions reloaded before the pending prompt could run.");
2292
2409
  let previousFlagValues = this._extensionRunner.getFlagValues();
2293
2410
  await emitSessionShutdownEvent(this._extensionRunner, { type: "session_shutdown", reason: "reload" }), await this.settingsManager.reload(), this.syncQueueModesFromSettings(), resetApiProviders(), await this._resourceLoader.reload(), this._buildRuntime({
2294
2411
  activeToolNames: this.getActiveToolNames(),
@@ -2663,7 +2780,7 @@ ${command}` : command;
2663
2780
  */
2664
2781
  async exportToHtml(outputPath) {
2665
2782
  let [{ exportSessionToHtml }, { createToolHtmlRenderer }] = await Promise.all([
2666
- import("./export-html-KBFVV63J.js"),
2783
+ import("./export-html-VM4J2MNR.js"),
2667
2784
  import("./tool-renderer-MV5O452K.js")
2668
2785
  ]), configuredThemeName = this.settingsManager.getTheme(), themeName = configuredThemeName && getThemeByName(configuredThemeName) ? configuredThemeName : void 0, toolRenderer = createToolHtmlRenderer({
2669
2786
  getToolDefinition: (name) => this.getToolDefinition(name),
@@ -3115,15 +3232,17 @@ async function createOwnedAgentSession(options) {
3115
3232
  },
3116
3233
  convertToLlm: convertToLlmWithBlockImages,
3117
3234
  streamFn: async (model2, context, options2) => {
3118
- let providerRetrySettings = settingsManager.getProviderRetrySettings(), httpIdleTimeoutMs = settingsManager.getHttpIdleTimeoutMs(), effectiveTimeoutMs = httpIdleTimeoutMs === 0 ? 2147483647 : httpIdleTimeoutMs, timeoutMs = options2?.timeoutMs ?? providerRetrySettings.timeoutMs ?? effectiveTimeoutMs, websocketConnectTimeoutMs = options2?.websocketConnectTimeoutMs ?? settingsManager.getWebSocketConnectTimeoutMs(), headerRunner = extensionRunnerRef.current;
3235
+ let providerRetrySettings = settingsManager.getProviderRetrySettings(), httpIdleTimeoutMs = settingsManager.getHttpIdleTimeoutMs(), effectiveTimeoutMs = httpIdleTimeoutMs === 0 ? 2147483647 : httpIdleTimeoutMs, timeoutMs = options2?.timeoutMs ?? providerRetrySettings.timeoutMs ?? effectiveTimeoutMs, websocketConnectTimeoutMs = options2?.websocketConnectTimeoutMs ?? settingsManager.getWebSocketConnectTimeoutMs(), headerRunner = extensionRunnerRef.current, subscription = model2.provider === "anthropic" && (await modelRuntime.getAuth(model2, { apiKey: options2?.apiKey, env: options2?.env }))?.auth.externalClaudeCode;
3119
3236
  return modelRuntime.streamSimple(model2, context, {
3120
3237
  ...options2,
3238
+ ...subscription && !headerRunner?.hasHandlers("before_provider_request") ? { onPayload: void 0 } : {},
3239
+ ...subscription && !headerRunner?.hasHandlers("after_provider_response") ? { onResponse: void 0 } : {},
3121
3240
  timeoutMs,
3122
3241
  websocketConnectTimeoutMs,
3123
3242
  cacheRetention: settingsManager.getCacheRetention(),
3124
3243
  maxRetries: options2?.maxRetries ?? providerRetrySettings.maxRetries,
3125
3244
  maxRetryDelayMs: options2?.maxRetryDelayMs ?? providerRetrySettings.maxRetryDelayMs,
3126
- transformHeaders: async (requestHeaders) => {
3245
+ transformHeaders: subscription && !headerRunner?.hasHandlers("before_provider_headers") ? void 0 : async (requestHeaders) => {
3127
3246
  let headers = mergeProviderAttributionHeaders(model2, settingsManager, options2?.sessionId, requestHeaders);
3128
3247
  return headerRunner?.hasHandlers("before_provider_headers") ? headerRunner.emitBeforeProviderHeaders(headers ?? {}) : headers ?? {};
3129
3248
  }
@@ -81,7 +81,7 @@ import {
81
81
  serializeTools,
82
82
  throwIfAborted,
83
83
  truncateAtWord
84
- } from "./chunk-VSELYKWU.js";
84
+ } from "./chunk-LWYIVUGV.js";
85
85
  import {
86
86
  getAgentPath
87
87
  } from "./chunk-4HXHDDCF.js";