@ashx-j/lunr 0.2.23 → 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 (222) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +10 -10
  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-plan-tools.d.ts +7 -7
  7. package/dist/builtin-extensions/lunr-plan-tools.d.ts.map +1 -1
  8. package/dist/builtin-extensions/lunr-plan-tools.js +12 -12
  9. package/dist/builtin-extensions/lunr-plan-tools.js.map +1 -1
  10. package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
  11. package/dist/builtin-extensions/pi-intercom/index.js +2 -0
  12. package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
  13. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
  14. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +1 -0
  15. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
  16. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  17. package/dist/builtin-extensions/pi-mcp-adapter/index.js +1 -1
  18. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  19. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
  20. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +1 -1
  21. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
  22. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -4
  23. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
  24. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +6 -4
  25. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
  26. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts +2 -0
  27. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
  28. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js +6 -3
  29. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
  30. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
  31. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +7 -2
  32. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
  33. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +2 -0
  34. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
  35. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +4 -0
  36. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
  37. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
  38. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +1 -1
  39. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
  40. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts +1 -0
  41. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
  42. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +5 -1
  43. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
  44. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
  45. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +3 -2
  46. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
  47. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  48. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +19 -0
  49. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  50. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
  51. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +1 -1
  53. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
  54. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +2 -0
  55. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
  56. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +17 -15
  57. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
  58. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  59. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +3 -1
  60. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  61. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +2 -2
  63. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
  64. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +1 -0
  65. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  66. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  67. package/dist/core/agent-session.d.ts +1 -1
  68. package/dist/core/agent-session.d.ts.map +1 -1
  69. package/dist/core/agent-session.js +5 -4
  70. package/dist/core/agent-session.js.map +1 -1
  71. package/dist/core/browser/schema.d.ts +1 -1
  72. package/dist/core/browser/schema.d.ts.map +1 -1
  73. package/dist/core/browser/schema.js +1 -1
  74. package/dist/core/browser/schema.js.map +1 -1
  75. package/dist/core/catalog-cache-scope.d.ts.map +1 -1
  76. package/dist/core/catalog-cache-scope.js +3 -1
  77. package/dist/core/catalog-cache-scope.js.map +1 -1
  78. package/dist/core/model-runtime.d.ts.map +1 -1
  79. package/dist/core/model-runtime.js +3 -2
  80. package/dist/core/model-runtime.js.map +1 -1
  81. package/dist/core/permissions.d.ts +16 -23
  82. package/dist/core/permissions.d.ts.map +1 -1
  83. package/dist/core/permissions.js +66 -141
  84. package/dist/core/permissions.js.map +1 -1
  85. package/dist/core/plan-mode.d.ts +10 -12
  86. package/dist/core/plan-mode.d.ts.map +1 -1
  87. package/dist/core/plan-mode.js +16 -18
  88. package/dist/core/plan-mode.js.map +1 -1
  89. package/dist/core/runtime-bridges.d.ts.map +1 -1
  90. package/dist/core/runtime-bridges.js +2 -0
  91. package/dist/core/runtime-bridges.js.map +1 -1
  92. package/dist/core/sdk.d.ts.map +1 -1
  93. package/dist/core/sdk.js +13 -6
  94. package/dist/core/sdk.js.map +1 -1
  95. package/dist/core/session-manager.d.ts.map +1 -1
  96. package/dist/core/session-manager.js +9 -2
  97. package/dist/core/session-manager.js.map +1 -1
  98. package/dist/core/settings-manager.d.ts +9 -1
  99. package/dist/core/settings-manager.d.ts.map +1 -1
  100. package/dist/core/settings-manager.js +40 -1
  101. package/dist/core/settings-manager.js.map +1 -1
  102. package/dist/core/slash-commands.d.ts.map +1 -1
  103. package/dist/core/slash-commands.js +4 -4
  104. package/dist/core/slash-commands.js.map +1 -1
  105. package/dist/core/subagent-permission-inherit.d.ts +6 -10
  106. package/dist/core/subagent-permission-inherit.d.ts.map +1 -1
  107. package/dist/core/subagent-permission-inherit.js +14 -14
  108. package/dist/core/subagent-permission-inherit.js.map +1 -1
  109. package/dist/core/system-prompt.d.ts +2 -0
  110. package/dist/core/system-prompt.d.ts.map +1 -1
  111. package/dist/core/system-prompt.js +9 -4
  112. package/dist/core/system-prompt.js.map +1 -1
  113. package/dist/gateway/adapters/discord.d.ts.map +1 -1
  114. package/dist/gateway/adapters/discord.js +1 -1
  115. package/dist/gateway/adapters/discord.js.map +1 -1
  116. package/dist/gateway/approval.d.ts +2 -6
  117. package/dist/gateway/approval.d.ts.map +1 -1
  118. package/dist/gateway/approval.js +3 -7
  119. package/dist/gateway/approval.js.map +1 -1
  120. package/dist/gateway/mobile-commands.d.ts.map +1 -1
  121. package/dist/gateway/mobile-commands.js +12 -11
  122. package/dist/gateway/mobile-commands.js.map +1 -1
  123. package/dist/gateway/router.d.ts.map +1 -1
  124. package/dist/gateway/router.js +1 -1
  125. package/dist/gateway/router.js.map +1 -1
  126. package/dist/main.d.ts.map +1 -1
  127. package/dist/main.js +1 -2
  128. package/dist/main.js.map +1 -1
  129. package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
  130. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  131. package/dist/modes/interactive/components/settings-selector.js +23 -3
  132. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  133. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  134. package/dist/modes/interactive/components/thinking-tail.js +2 -2
  135. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  136. package/dist/modes/interactive/components/tool-execution.d.ts +1 -0
  137. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  138. package/dist/modes/interactive/components/tool-execution.js +12 -2
  139. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  140. package/dist/modes/interactive/interactive-mode.d.ts +1 -2
  141. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  142. package/dist/modes/interactive/interactive-mode.js +76 -90
  143. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  144. package/dist/node-runtime/{agent-session-services-GZVSOGYR.js → agent-session-services-IEF7LQWD.js} +8 -9
  145. package/dist/node-runtime/{builtin-extensions-QVCXNQT4.js → builtin-extensions-EBAWTH4M.js} +3 -3
  146. package/dist/node-runtime/{chunk-XLTL257W.js → chunk-2KIPT4HJ.js} +5 -1
  147. package/dist/node-runtime/{chunk-YHQ3NBB3.js → chunk-5Q3EHOHI.js} +17 -17
  148. package/dist/node-runtime/{chunk-TQGPP4SC.js → chunk-CDVHZOOK.js} +1 -1
  149. package/dist/node-runtime/{chunk-DQMGU675.js → chunk-DE2JB6J5.js} +20 -17
  150. package/dist/node-runtime/{chunk-YJMMG7C6.js → chunk-DSIKTUPW.js} +1 -1
  151. package/dist/node-runtime/{chunk-TVJUOJZJ.js → chunk-F4FLTQKV.js} +1 -1
  152. package/dist/node-runtime/{chunk-GMHJCCEN.js → chunk-FU6OODRZ.js} +4 -1
  153. package/dist/node-runtime/{chunk-OFKSVRV7.js → chunk-GYIXXQAO.js} +1 -1
  154. package/dist/node-runtime/{chunk-BX2RB477.js → chunk-HFVZUPFJ.js} +1 -1
  155. package/dist/node-runtime/{chunk-AZJHNQKQ.js → chunk-I54LGHWM.js} +1 -1
  156. package/dist/node-runtime/{chunk-DD5YWFSJ.js → chunk-IGV54Q5V.js} +2 -2
  157. package/dist/node-runtime/{chunk-RIR5EDDJ.js → chunk-K5AGHH57.js} +17 -12
  158. package/dist/node-runtime/{chunk-GS66LV4M.js → chunk-KJ6DWS3K.js} +4 -4
  159. package/dist/node-runtime/{chunk-LLUIPGDR.js → chunk-L3LX4SNR.js} +108 -75
  160. package/dist/node-runtime/{chunk-VSELYKWU.js → chunk-LWYIVUGV.js} +2 -1
  161. package/dist/node-runtime/{chunk-JHYKXIMM.js → chunk-MPKSOJBT.js} +1 -1
  162. package/dist/node-runtime/{chunk-W64JC4E7.js → chunk-OF7PWMG4.js} +2 -2
  163. package/dist/node-runtime/{chunk-CSUZVNYE.js → chunk-OVX6X377.js} +10 -6
  164. package/dist/node-runtime/{chunk-X3URCYCU.js → chunk-QM43FEAE.js} +14 -14
  165. package/dist/node-runtime/{chunk-QAZOULTU.js → chunk-RORY2HMJ.js} +39 -5
  166. package/dist/node-runtime/{chunk-EKVFP6YF.js → chunk-WHLRAGUQ.js} +13 -12
  167. package/dist/node-runtime/{chunk-HPUP7E4T.js → chunk-Y73WPE6S.js} +16 -16
  168. package/dist/node-runtime/{chunk-LFZDVKSP.js → chunk-YVI6L6LU.js} +5 -5
  169. package/dist/node-runtime/{chunk-5D7LC2ZQ.js → chunk-ZXSGTGJ6.js} +54 -85
  170. package/dist/node-runtime/cli-runtime.js +1 -1
  171. package/dist/node-runtime/{command-PDVTBRWA.js → command-7BG7VVTS.js} +3 -3
  172. package/dist/node-runtime/{commands-KAMO2T6P.js → commands-NZLSOHPE.js} +2 -2
  173. package/dist/node-runtime/{commands-XDCFGIGW.js → commands-QFDKNQTL.js} +7 -7
  174. package/dist/node-runtime/{direct-tool-executor-YAVOLDFY.js → direct-tool-executor-77GW4F5P.js} +3 -3
  175. package/dist/node-runtime/{export-html-KSOIMVPI.js → export-html-VM4J2MNR.js} +1 -1
  176. package/dist/node-runtime/{gateway-AYWM5DIO.js → gateway-TWR3N65G.js} +12 -12
  177. package/dist/node-runtime/index.js +16 -17
  178. package/dist/node-runtime/{init-X2LIUB2H.js → init-HS6NQXSK.js} +2 -2
  179. package/dist/node-runtime/{install-cli-3BO4MMQ6.js → install-cli-VAP6KBFN.js} +1 -1
  180. package/dist/node-runtime/{interactive-mode-4MFRKAHG.js → interactive-mode-6J5VZ2TT.js} +10 -11
  181. package/dist/node-runtime/{interactive-view-TUZHCQM3.js → interactive-view-NGFAMHPW.js} +2 -2
  182. package/dist/node-runtime/{lunr-browser-RYFIIVJN.js → lunr-browser-J5ZZYVGM.js} +1 -1
  183. package/dist/node-runtime/{lunr-cron-YWXEPZMQ.js → lunr-cron-CXOL37AL.js} +5 -5
  184. package/dist/node-runtime/main.js +14 -15
  185. package/dist/node-runtime/{mobile-commands-LVHDAUDP.js → mobile-commands-VTBM5DSZ.js} +4 -4
  186. package/dist/node-runtime/{model-runtime-PLQKAG4B.js → model-runtime-OO5HFLWE.js} +1 -1
  187. package/dist/node-runtime/{package-manager-cli-6GT3Z3CK.js → package-manager-cli-ZLW5DZXF.js} +3 -4
  188. package/dist/node-runtime/{pi-intercom-HBPK5HSJ.js → pi-intercom-QM53RLTS.js} +2 -0
  189. package/dist/node-runtime/{pi-mcp-adapter-E6WULBKF.js → pi-mcp-adapter-5UKBZP44.js} +7 -6
  190. package/dist/node-runtime/{pi-subagents-CDWK2AKY.js → pi-subagents-XPCLLKIM.js} +23 -13
  191. package/dist/node-runtime/{proxy-modes-OSQCWRBI.js → proxy-modes-LGEUYD7R.js} +3 -3
  192. package/dist/node-runtime/rpc-entry.js +14 -15
  193. package/dist/node-runtime/{runtime-bridges-3XUQ46XW.js → runtime-bridges-QYXUX2TG.js} +8 -1
  194. package/dist/node-runtime/{session-handoff-HC7R5E24.js → session-handoff-GWARVEWT.js} +2 -2
  195. package/dist/node-runtime/{session-manager-CFN4UFM2.js → session-manager-JB5J6XBN.js} +1 -1
  196. package/dist/node-runtime/{settings-manager-6VEMXRDL.js → settings-manager-WCQDUVQB.js} +7 -4
  197. package/dist/node-runtime/{setup-5SR2J35A.js → setup-YRBKH2LD.js} +2 -2
  198. package/dist/node-runtime/{subagent-executor-M5VWB3D3.js → subagent-executor-OTNISDQU.js} +40 -7
  199. package/dist/node-runtime/{update-cli-UVKJWRRJ.js → update-cli-VBR2777K.js} +1 -2
  200. package/dist/startup/interactive-view.d.ts.map +1 -1
  201. package/dist/startup/interactive-view.js +5 -1
  202. package/dist/startup/interactive-view.js.map +1 -1
  203. package/docs/browser.md +1 -1
  204. package/docs/features.md +15 -14
  205. package/docs/index.md +1 -1
  206. package/docs/keybindings.md +1 -1
  207. package/docs/providers.md +6 -2
  208. package/docs/quickstart.md +2 -2
  209. package/docs/settings.md +1 -1
  210. package/docs/usage.md +4 -4
  211. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  212. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  213. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  214. package/examples/extensions/gondolin/package-lock.json +2 -2
  215. package/examples/extensions/gondolin/package.json +1 -1
  216. package/examples/extensions/plan-mode/README.md +1 -1
  217. package/examples/extensions/sandbox/package-lock.json +2 -2
  218. package/examples/extensions/sandbox/package.json +1 -1
  219. package/examples/extensions/with-deps/package-lock.json +2 -2
  220. package/examples/extensions/with-deps/package.json +1 -1
  221. package/package.json +4 -4
  222. package/dist/node-runtime/chunk-LISUTZS3.js +0 -19
@@ -2,9 +2,9 @@ import { createRequire as __lunrRequire } from "node:module"; const require = __
2
2
  import {
3
3
  createAgentSessionFromServices,
4
4
  createAgentSessionServices
5
- } from "./chunk-DQMGU675.js";
5
+ } from "./chunk-DE2JB6J5.js";
6
6
  import "./chunk-CCCN2UCX.js";
7
- import "./chunk-TVJUOJZJ.js";
7
+ import "./chunk-F4FLTQKV.js";
8
8
  import "./chunk-OBMWP3I5.js";
9
9
  import "./chunk-DVGWF6A2.js";
10
10
  import "./chunk-QFWG2RVL.js";
@@ -12,22 +12,21 @@ import "./chunk-YDO2F2IA.js";
12
12
  import "./chunk-53YJI7JU.js";
13
13
  import "./chunk-5ZQXRPMC.js";
14
14
  import "./chunk-AD6VXAO7.js";
15
- import "./chunk-GS66LV4M.js";
16
- import "./chunk-QAZOULTU.js";
15
+ import "./chunk-KJ6DWS3K.js";
16
+ import "./chunk-RORY2HMJ.js";
17
17
  import "./chunk-UP2XBVH5.js";
18
18
  import "./chunk-VWCE2HSZ.js";
19
- import "./chunk-LISUTZS3.js";
20
19
  import "./chunk-URD2SLIT.js";
21
- import "./chunk-OFKSVRV7.js";
20
+ import "./chunk-GYIXXQAO.js";
22
21
  import "./chunk-GJ2RDBRL.js";
23
22
  import "./chunk-CGBXPL3E.js";
24
23
  import "./chunk-BBUVIEZB.js";
25
- import "./chunk-5D7LC2ZQ.js";
24
+ import "./chunk-ZXSGTGJ6.js";
26
25
  import "./chunk-M3LZLQW2.js";
27
26
  import "./chunk-KKUTQQV7.js";
28
27
  import "./chunk-CSFI6YXL.js";
29
- import "./chunk-AZJHNQKQ.js";
30
- import "./chunk-XLTL257W.js";
28
+ import "./chunk-I54LGHWM.js";
29
+ import "./chunk-2KIPT4HJ.js";
31
30
  import "./chunk-FVDOXRUD.js";
32
31
  import "./chunk-UJOCPOMX.js";
33
32
  import "./chunk-2MI5OPMN.js";
@@ -6,13 +6,13 @@ import {
6
6
  lightBuiltinExtensions,
7
7
  loadAllBuiltinExtensions,
8
8
  loadDeferredBuiltinExtensions
9
- } from "./chunk-X3URCYCU.js";
9
+ } from "./chunk-QM43FEAE.js";
10
10
  import "./chunk-PL6JKXWI.js";
11
11
  import "./chunk-5ZH3ZFIZ.js";
12
12
  import "./chunk-CCCN2UCX.js";
13
- import "./chunk-5D7LC2ZQ.js";
13
+ import "./chunk-ZXSGTGJ6.js";
14
14
  import "./chunk-M3LZLQW2.js";
15
- import "./chunk-JHYKXIMM.js";
15
+ import "./chunk-MPKSOJBT.js";
16
16
  import "./chunk-H2EOZYMP.js";
17
17
  import "./chunk-PVCDKGR6.js";
18
18
  import "./chunk-GS42T6MX.js";
@@ -387,7 +387,11 @@ var SessionManager = class _SessionManager {
387
387
  if (this.sessionFile)
388
388
  try {
389
389
  let saved = JSON.parse(readFileSync(`${this.sessionFile}.leaf.json`, "utf8"));
390
- saved.id === this.sessionId && ["manual", "yolo", "plan", "auto"].includes(saved.permissionMode) && (this.permissionMode = saved.permissionMode), saved.id === this.sessionId && (saved.leafId === null || this.byId.has(saved.leafId)) && saved.revision === createHash("sha256").update(readFileSync(this.sessionFile)).digest("hex") && (this.leafId = saved.leafId);
390
+ if (saved.id === this.sessionId) {
391
+ let mode = saved.permissionMode;
392
+ mode === "plan" || mode === "read-only" ? this.permissionMode = "read-only" : mode === "manual" || mode === "yolo" ? this.permissionMode = "yolo" : mode === "auto" && (this.permissionMode = "auto");
393
+ }
394
+ saved.id === this.sessionId && (saved.leafId === null || this.byId.has(saved.leafId)) && saved.revision === createHash("sha256").update(readFileSync(this.sessionFile)).digest("hex") && (this.leafId = saved.leafId);
391
395
  } catch {
392
396
  }
393
397
  }
@@ -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-X3URCYCU.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-W64JC4E7.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-DQMGU675.js";
26
+ } from "./chunk-DE2JB6J5.js";
27
27
  import {
28
28
  restoreStdout,
29
29
  takeOverStdout
@@ -35,14 +35,14 @@ import {
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-QAZOULTU.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";
@@ -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-3BO4MMQ6.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-UVKJWRRJ.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-6GT3Z3CK.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-PDVTBRWA.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-KSOIMVPI.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-4MFRKAHG.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");
@@ -934,7 +934,7 @@ ${EXTENSION_LOAD_FAILURE_HINT}` : "";
934
934
  } else if (appMode === "interactive") {
935
935
  let [{ InteractiveMode }, { loadDeferredBuiltinExtensions }] = await Promise.all([
936
936
  interactiveModeImport,
937
- import("./builtin-extensions-QVCXNQT4.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
  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-TVJUOJZJ.js";
10
+ } from "./chunk-F4FLTQKV.js";
11
11
  import {
12
12
  stripFrontmatter
13
13
  } from "./chunk-QFWG2RVL.js";
@@ -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-QAZOULTU.js";
34
+ } from "./chunk-RORY2HMJ.js";
35
35
  import {
36
36
  DEFAULT_THINKING_LEVEL,
37
37
  calculateContextTokens,
@@ -43,7 +43,7 @@ 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
@@ -53,7 +53,7 @@ import {
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";
@@ -667,7 +667,7 @@ function registerSubagentWaitInterruptionOwner(sessionId, owner) {
667
667
 
668
668
  // packages/coding-agent/dist/core/system-prompt.js
669
669
  function buildSystemPrompt(options) {
670
- 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 ? `
671
671
 
672
672
  ${appendSystemPrompt}` : "", contextFiles = providedContextFiles ?? [], skills = providedSkills ?? [];
673
673
  if (customPrompt) {
@@ -700,7 +700,7 @@ Behavior guidelines:
700
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.
701
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.
702
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.
703
- - 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."}
704
704
  - When several agents work in parallel, state file ownership up front so they do not collide.
705
705
  - Tests are good! Endless smoke tests, regressions tests for feature deletions, etc, much less good. Tests should be focused, not slop.
706
706
  - Prefer editing existing files to creating new ones.
@@ -717,8 +717,8 @@ Guidelines:
717
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.
718
718
  - Keep edits[].oldText as small as possible while still being unique in the file. Do not pad with large unchanged regions.
719
719
  - Use write only for new files or complete rewrites.
720
- ${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.
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.
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.
722
722
  - Use ast_search for structural code matches.
723
723
  - Use cron only when the user asks to schedule or manage unattended prompts.
724
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.
@@ -838,9 +838,9 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
838
838
  _baseSystemPrompt = "";
839
839
  _baseSystemPromptOptions;
840
840
  _systemPromptOverride;
841
- // 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
842
842
  _systemPromptAppend;
843
- // 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
844
844
  _toolCallGates = [];
845
845
  constructor(config) {
846
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" };
@@ -1227,7 +1227,7 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
1227
1227
  return this.agent.state.systemPrompt;
1228
1228
  }
1229
1229
  /**
1230
- * 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
1231
1231
  * tool_call handlers and even when no extension handles tool_call. Returns an
1232
1232
  * unsubscribe function.
1233
1233
  */
@@ -1371,6 +1371,7 @@ ${this._systemPromptAppend}` : prompt;
1371
1371
  return this._baseSystemPromptOptions = {
1372
1372
  cwd: this._cwd,
1373
1373
  modelSlug: this.model ? `${this.model.provider}/${this.model.id}` : void 0,
1374
+ automaticSubagentDelegation: this.settingsManager.getAutomaticSubagentDelegation(),
1374
1375
  skills: loadedSkills,
1375
1376
  contextFiles,
1376
1377
  customPrompt: loaderSystemPrompt,
@@ -2779,7 +2780,7 @@ ${command}` : command;
2779
2780
  */
2780
2781
  async exportToHtml(outputPath) {
2781
2782
  let [{ exportSessionToHtml }, { createToolHtmlRenderer }] = await Promise.all([
2782
- import("./export-html-KSOIMVPI.js"),
2783
+ import("./export-html-VM4J2MNR.js"),
2783
2784
  import("./tool-renderer-MV5O452K.js")
2784
2785
  ]), configuredThemeName = this.settingsManager.getTheme(), themeName = configuredThemeName && getThemeByName(configuredThemeName) ? configuredThemeName : void 0, toolRenderer = createToolHtmlRenderer({
2785
2786
  getToolDefinition: (name) => this.getToolDefinition(name),
@@ -3231,15 +3232,17 @@ async function createOwnedAgentSession(options) {
3231
3232
  },
3232
3233
  convertToLlm: convertToLlmWithBlockImages,
3233
3234
  streamFn: async (model2, context, options2) => {
3234
- 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;
3235
3236
  return modelRuntime.streamSimple(model2, context, {
3236
3237
  ...options2,
3238
+ ...subscription && !headerRunner?.hasHandlers("before_provider_request") ? { onPayload: void 0 } : {},
3239
+ ...subscription && !headerRunner?.hasHandlers("after_provider_response") ? { onResponse: void 0 } : {},
3237
3240
  timeoutMs,
3238
3241
  websocketConnectTimeoutMs,
3239
3242
  cacheRetention: settingsManager.getCacheRetention(),
3240
3243
  maxRetries: options2?.maxRetries ?? providerRetrySettings.maxRetries,
3241
3244
  maxRetryDelayMs: options2?.maxRetryDelayMs ?? providerRetrySettings.maxRetryDelayMs,
3242
- transformHeaders: async (requestHeaders) => {
3245
+ transformHeaders: subscription && !headerRunner?.hasHandlers("before_provider_headers") ? void 0 : async (requestHeaders) => {
3243
3246
  let headers = mergeProviderAttributionHeaders(model2, settingsManager, options2?.sessionId, requestHeaders);
3244
3247
  return headerRunner?.hasHandlers("before_provider_headers") ? headerRunner.emitBeforeProviderHeaders(headers ?? {}) : headers ?? {};
3245
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";
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-QFWG2RVL.js";
11
11
  import {
12
12
  SettingsManager
13
- } from "./chunk-QAZOULTU.js";
13
+ } from "./chunk-RORY2HMJ.js";
14
14
  import {
15
15
  minimatch
16
16
  } from "./chunk-CGBXPL3E.js";
@@ -1,4 +1,7 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ bindSubagentCommunicationSetting
4
+ } from "./chunk-RORY2HMJ.js";
2
5
  import {
3
6
  registerCustomizeBridge
4
7
  } from "./chunk-4EULYYR4.js";
@@ -16,7 +19,7 @@ import {
16
19
  // packages/coding-agent/dist/core/runtime-bridges.js
17
20
  function bindRuntimeBridges({ session, services }) {
18
21
  let { settingsManager, modelRuntime } = services;
19
- registerModelTierBridge(settingsManager), getModelTiersBridge()?.setParentThinkingProvider(() => session.thinkingLevel), registerMemoryCapBridge(settingsManager), registerCustomizeBridge(settingsManager), registerUsageServiceBridge(modelRuntime, settingsManager);
22
+ registerModelTierBridge(settingsManager), getModelTiersBridge()?.setParentThinkingProvider(() => session.thinkingLevel), registerMemoryCapBridge(settingsManager), bindSubagentCommunicationSetting(settingsManager), registerCustomizeBridge(settingsManager), registerUsageServiceBridge(modelRuntime, settingsManager);
20
23
  }
21
24
 
22
25
  export {
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  buildSessionContext,
7
7
  sessionEntryToContextMessages
8
- } from "./chunk-XLTL257W.js";
8
+ } from "./chunk-2KIPT4HJ.js";
9
9
  import {
10
10
  convertToLlm,
11
11
  createBranchSummaryMessage,
@@ -4,7 +4,7 @@ import {
4
4
  ServerError,
5
5
  logger,
6
6
  wrapError
7
- } from "./chunk-YJMMG7C6.js";
7
+ } from "./chunk-DSIKTUPW.js";
8
8
  import {
9
9
  UrlElicitationRequiredError
10
10
  } from "./chunk-4TLO4PO2.js";
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
3
  SessionManager
4
- } from "./chunk-XLTL257W.js";
4
+ } from "./chunk-2KIPT4HJ.js";
5
5
  import {
6
6
  SessionOwnership,
7
7
  canonicalSessionPath,
@@ -12,7 +12,7 @@ import {
12
12
  NO_HANDLER_REASON,
13
13
  registerApprovalHandler,
14
14
  setPermissionMode
15
- } from "./chunk-5D7LC2ZQ.js";
15
+ } from "./chunk-ZXSGTGJ6.js";
16
16
  import {
17
17
  loadGatewayConfig,
18
18
  platformConfigFor,
@@ -236,7 +236,7 @@ async function handleApprovalCallback(event, adapter) {
236
236
  return entry.resolve("reject"), !0;
237
237
  if (entry.plan && response !== "reject" && entry.key) {
238
238
  let sessionId = getSession(entry.key)?.sessionId;
239
- sessionId && setPermissionMode("manual", sessionId);
239
+ sessionId && setPermissionMode("yolo", sessionId);
240
240
  }
241
241
  entry.resolve(response);
242
242
  let label = parsed.action === "reject" || parsed.action === "cancel" ? "Rejected." : `Approved (${parsed.action}).`;
@@ -5,12 +5,15 @@ import {
5
5
  isDiagnosticControlEvent
6
6
  } from "./chunk-OAR4TYZE.js";
7
7
  import {
8
- PLAN_MODE_WRITE_SPAWN_ERROR,
8
+ READ_ONLY_WRITE_SPAWN_ERROR,
9
9
  resolveChildPermissions
10
- } from "./chunk-CSUZVNYE.js";
10
+ } from "./chunk-OVX6X377.js";
11
11
  import {
12
12
  createReadOnlyTools
13
13
  } from "./chunk-YDO2F2IA.js";
14
+ import {
15
+ subagentCommunicationEnabled
16
+ } from "./chunk-RORY2HMJ.js";
14
17
  import {
15
18
  convertToLlm
16
19
  } from "./chunk-FVDOXRUD.js";
@@ -1956,7 +1959,7 @@ function resolveRuntimeScriptPath(basePathWithoutExt) {
1956
1959
  let tsPath = `${basePathWithoutExt}.ts`;
1957
1960
  return fs9.existsSync(tsPath) ? tsPath : `${basePathWithoutExt}.js`;
1958
1961
  }
1959
- var PROMPT_RUNTIME_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "subagent-prompt-runtime")), FANOUT_CHILD_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "..", "..", "extension", "fanout-child")), SUBAGENT_CHILD_ENV = "PI_SUBAGENT_CHILD", SUBAGENT_ORCHESTRATOR_TARGET_ENV = "PI_SUBAGENT_ORCHESTRATOR_TARGET", SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV = "PI_SUBAGENT_ORCHESTRATOR_SESSION_ID", SUBAGENT_SUPERVISOR_SESSION_ID_ENV = "PI_SUBAGENT_SUPERVISOR_SESSION_ID", SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV = "PI_SUBAGENT_SUPERVISOR_CHANNEL_DIR", SUBAGENT_RUN_ID_ENV = "PI_SUBAGENT_RUN_ID", SUBAGENT_CHILD_AGENT_ENV = "PI_SUBAGENT_CHILD_AGENT", SUBAGENT_CHILD_INDEX_ENV = "PI_SUBAGENT_CHILD_INDEX", SUBAGENT_FANOUT_CHILD_ENV = "PI_SUBAGENT_FANOUT_CHILD", SUBAGENT_PARENT_EVENT_SINK_ENV = "PI_SUBAGENT_PARENT_EVENT_SINK", SUBAGENT_PARENT_CONTROL_INBOX_ENV = "PI_SUBAGENT_PARENT_CONTROL_INBOX", SUBAGENT_PARENT_ROOT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_ROOT_RUN_ID", SUBAGENT_PARENT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_RUN_ID", SUBAGENT_PARENT_CHILD_INDEX_ENV = "PI_SUBAGENT_PARENT_CHILD_INDEX", SUBAGENT_PARENT_DEPTH_ENV = "PI_SUBAGENT_PARENT_DEPTH", SUBAGENT_PARENT_PATH_ENV = "PI_SUBAGENT_PARENT_PATH", SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV = "PI_SUBAGENT_PARENT_CAPABILITY_TOKEN", SUBAGENT_PARENT_SESSION_ENV = "PI_SUBAGENT_PARENT_SESSION", SUBAGENT_PARENT_PERMISSION_MODE_ENV = "PI_SUBAGENT_PARENT_PERMISSION_MODE", SUBAGENT_CHILD_PERMISSION_ENV = "PI_SUBAGENT_CHILD_PERMISSION", SUBAGENT_STEER_INBOX_ENV = "PI_SUBAGENT_STEER_INBOX", SUBAGENT_STEER_CAPABILITY_ENV = "PI_SUBAGENT_STEER_CAPABILITY", SUBAGENT_STEER_ACK_DIR_ENV = "PI_SUBAGENT_STEER_ACK_DIR";
1962
+ var PROMPT_RUNTIME_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "subagent-prompt-runtime")), FANOUT_CHILD_EXTENSION_PATH = resolveRuntimeScriptPath(path10.join(path10.dirname(fileURLToPath(new URL("../builtin-extensions/pi-subagents/src/runs/shared/pi-args.js", import.meta.url).href)), "..", "..", "extension", "fanout-child")), SUBAGENT_COMMUNICATION_ENV = "PI_SUBAGENT_COMMUNICATION_ENABLED", SUBAGENT_CHILD_ENV = "PI_SUBAGENT_CHILD", SUBAGENT_ORCHESTRATOR_TARGET_ENV = "PI_SUBAGENT_ORCHESTRATOR_TARGET", SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV = "PI_SUBAGENT_ORCHESTRATOR_SESSION_ID", SUBAGENT_SUPERVISOR_SESSION_ID_ENV = "PI_SUBAGENT_SUPERVISOR_SESSION_ID", SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV = "PI_SUBAGENT_SUPERVISOR_CHANNEL_DIR", SUBAGENT_RUN_ID_ENV = "PI_SUBAGENT_RUN_ID", SUBAGENT_CHILD_AGENT_ENV = "PI_SUBAGENT_CHILD_AGENT", SUBAGENT_CHILD_INDEX_ENV = "PI_SUBAGENT_CHILD_INDEX", SUBAGENT_FANOUT_CHILD_ENV = "PI_SUBAGENT_FANOUT_CHILD", SUBAGENT_PARENT_EVENT_SINK_ENV = "PI_SUBAGENT_PARENT_EVENT_SINK", SUBAGENT_PARENT_CONTROL_INBOX_ENV = "PI_SUBAGENT_PARENT_CONTROL_INBOX", SUBAGENT_PARENT_ROOT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_ROOT_RUN_ID", SUBAGENT_PARENT_RUN_ID_ENV = "PI_SUBAGENT_PARENT_RUN_ID", SUBAGENT_PARENT_CHILD_INDEX_ENV = "PI_SUBAGENT_PARENT_CHILD_INDEX", SUBAGENT_PARENT_DEPTH_ENV = "PI_SUBAGENT_PARENT_DEPTH", SUBAGENT_PARENT_PATH_ENV = "PI_SUBAGENT_PARENT_PATH", SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV = "PI_SUBAGENT_PARENT_CAPABILITY_TOKEN", SUBAGENT_PARENT_SESSION_ENV = "PI_SUBAGENT_PARENT_SESSION", SUBAGENT_PARENT_PERMISSION_MODE_ENV = "PI_SUBAGENT_PARENT_PERMISSION_MODE", SUBAGENT_CHILD_PERMISSION_ENV = "PI_SUBAGENT_CHILD_PERMISSION", SUBAGENT_STEER_INBOX_ENV = "PI_SUBAGENT_STEER_INBOX", SUBAGENT_STEER_CAPABILITY_ENV = "PI_SUBAGENT_STEER_CAPABILITY", SUBAGENT_STEER_ACK_DIR_ENV = "PI_SUBAGENT_STEER_ACK_DIR";
1960
1963
  function sanitizeSupervisorChannelSegment(value) {
1961
1964
  return value.trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "unknown";
1962
1965
  }
@@ -1970,18 +1973,19 @@ function applyThinkingSuffix(model, thinking, replaceExisting = !1) {
1970
1973
  return colonIdx !== -1 && THINKING_LEVELS.some((level) => level === model.substring(colonIdx + 1)) ? replaceExisting ? `${model.slice(0, colonIdx)}:${thinking}` : model : `${model}:${thinking}`;
1971
1974
  }
1972
1975
  function buildPiArgs(input) {
1973
- let args = [...input.baseArgs];
1976
+ let communicationEnabled = input.communicationEnabled ?? subagentCommunicationEnabled(input.cwd ?? process.cwd(), getAgentDir()), args = [...input.baseArgs];
1974
1977
  input.sessionFile ? (fs9.mkdirSync(path10.dirname(input.sessionFile), { recursive: !0 }), args.push("--session", input.sessionFile)) : (input.sessionEnabled || args.push("--no-session"), input.sessionDir && (fs9.mkdirSync(input.sessionDir, { recursive: !0 }), args.push("--session-dir", input.sessionDir)));
1975
1978
  let modelArg = applyThinkingSuffix(input.model, input.thinking);
1976
1979
  modelArg && args.push("--model", modelArg);
1977
- let declaredBuiltinToolsBase = input.tools?.filter((tool) => !(tool.includes("/") || tool.endsWith(".ts") || tool.endsWith(".js"))) ?? [], declaredBuiltinTools = input.requireReadTool && input.tools?.length && !declaredBuiltinToolsBase.includes("read") ? ["read", ...declaredBuiltinToolsBase] : declaredBuiltinToolsBase, fanoutAuthorized = declaredBuiltinTools.includes("subagent"), toolExtensionPaths = [], requiredChildTools = [];
1980
+ let declaredBuiltinToolsBase = input.tools?.filter((tool) => !(tool.includes("/") || tool.endsWith(".ts") || tool.endsWith(".js")) && (communicationEnabled || tool !== "contact_supervisor" && tool !== "intercom")) ?? [], declaredBuiltinTools = input.requireReadTool && input.tools?.length && !declaredBuiltinToolsBase.includes("read") ? ["read", ...declaredBuiltinToolsBase] : declaredBuiltinToolsBase, fanoutAuthorized = declaredBuiltinTools.includes("subagent"), toolExtensionPaths = [], requiredChildTools = [];
1978
1981
  if (input.tools?.length) {
1979
1982
  let allowedTools = [...declaredBuiltinTools];
1980
1983
  for (let tool of input.tools)
1981
1984
  !declaredBuiltinTools.includes(tool) && (tool.includes("/") || tool.endsWith(".ts") || tool.endsWith(".js")) && toolExtensionPaths.push(tool);
1982
1985
  allowedTools.length > 0 && (input.mcpDirectTools?.length && allowedTools.push(...resolveMcpDirectToolNames(input.mcpDirectTools, input.cwd)), input.structuredOutput && allowedTools.push("structured_output"), requiredChildTools = [...new Set(allowedTools)], args.push("--tools", requiredChildTools.join(",")));
1983
1986
  }
1984
- input.excludeTools?.length && args.push("--exclude-tools", [...new Set(input.excludeTools)].join(","));
1987
+ let excludedTools = [...input.excludeTools ?? [], ...communicationEnabled ? [] : ["contact_supervisor", "intercom"]];
1988
+ excludedTools.length && args.push("--exclude-tools", [...new Set(excludedTools)].join(","));
1985
1989
  let runtimeExtensions = fanoutAuthorized ? [PROMPT_RUNTIME_EXTENSION_PATH, FANOUT_CHILD_EXTENSION_PATH] : [PROMPT_RUNTIME_EXTENSION_PATH];
1986
1990
  if (input.extensions !== void 0) {
1987
1991
  args.push("--no-extensions");
@@ -2004,7 +2008,7 @@ function buildPiArgs(input) {
2004
2008
  } else
2005
2009
  args.push(`Task: ${input.task}`);
2006
2010
  let env = {}, toolDiagnosticPath;
2007
- requiredChildTools.length > 0 && (tempDir || (tempDir = fs9.mkdtempSync(path10.join(os6.tmpdir(), "pi-subagent-"))), toolDiagnosticPath = path10.join(tempDir, "tool-diagnostic.json"), env[REQUIRED_CHILD_TOOLS_ENV] = JSON.stringify(requiredChildTools), env[CHILD_TOOL_DIAGNOSTIC_PATH_ENV] = toolDiagnosticPath), env[SUBAGENT_CHILD_ENV] = "1", env[SUBAGENT_CHILD_PERMISSION_ENV] = input.childPermission ?? (input.parentPermissionMode === "plan" ? "read-only" : "full"), env[SUBAGENT_PARENT_PERMISSION_MODE_ENV] = "", env[SUBAGENT_FANOUT_CHILD_ENV] = fanoutAuthorized ? "1" : "0", input.waitToolEnabled !== void 0 && (env[WAIT_TOOL_ENABLED_ENV] = input.waitToolEnabled ? "true" : "false");
2011
+ requiredChildTools.length > 0 && (tempDir || (tempDir = fs9.mkdtempSync(path10.join(os6.tmpdir(), "pi-subagent-"))), toolDiagnosticPath = path10.join(tempDir, "tool-diagnostic.json"), env[REQUIRED_CHILD_TOOLS_ENV] = JSON.stringify(requiredChildTools), env[CHILD_TOOL_DIAGNOSTIC_PATH_ENV] = toolDiagnosticPath), env[SUBAGENT_CHILD_ENV] = "1", env[SUBAGENT_COMMUNICATION_ENV] = communicationEnabled ? "1" : "0", env[SUBAGENT_CHILD_PERMISSION_ENV] = input.childPermission ?? (input.parentPermissionMode === "read-only" ? "read-only" : "full"), env[SUBAGENT_PARENT_PERMISSION_MODE_ENV] = "", env[SUBAGENT_FANOUT_CHILD_ENV] = fanoutAuthorized ? "1" : "0", input.waitToolEnabled !== void 0 && (env[WAIT_TOOL_ENABLED_ENV] = input.waitToolEnabled ? "true" : "false");
2008
2012
  let inheritedNestedRoute = !!(process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] && process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] && process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV]), parentRunId = input.parentRunId ?? input.runId ?? (inheritedNestedRoute ? process.env[SUBAGENT_RUN_ID_ENV] : void 0) ?? process.env[SUBAGENT_PARENT_RUN_ID_ENV] ?? "", parentChildIndex = input.parentChildIndex !== void 0 ? String(input.parentChildIndex) : input.childIndex !== void 0 ? String(input.childIndex) : process.env[SUBAGENT_PARENT_CHILD_INDEX_ENV] ?? "", inheritedDepth = Number(process.env[SUBAGENT_PARENT_DEPTH_ENV]), parentDepth = input.parentDepth ?? (inheritedNestedRoute && Number.isFinite(inheritedDepth) ? inheritedDepth + 1 : 1), parentPath = input.parentPath ?? [
2009
2013
  ...parseNestedPathEnv(process.env[SUBAGENT_PARENT_PATH_ENV]),
2010
2014
  ...parentRunId ? [{
@@ -2013,7 +2017,7 @@ function buildPiArgs(input) {
2013
2017
  ...input.childAgentName ? { agent: input.childAgentName } : {}
2014
2018
  }] : []
2015
2019
  ];
2016
- if (env[SUBAGENT_PARENT_EVENT_SINK_ENV] = fanoutAuthorized ? input.parentEventSink ?? process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] ?? "" : "", env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] = fanoutAuthorized ? input.parentControlInbox ?? process.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] ?? "" : "", env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] = fanoutAuthorized ? input.parentRootRunId ?? process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] ?? input.runId ?? "" : "", env[SUBAGENT_PARENT_RUN_ID_ENV] = fanoutAuthorized ? parentRunId : "", env[SUBAGENT_PARENT_CHILD_INDEX_ENV] = fanoutAuthorized ? parentChildIndex : "", env[SUBAGENT_PARENT_DEPTH_ENV] = fanoutAuthorized ? String(parentDepth) : "", env[SUBAGENT_PARENT_PATH_ENV] = fanoutAuthorized ? encodeNestedPathEnv(parentPath) : "", env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] = fanoutAuthorized ? input.parentCapabilityToken ?? process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] ?? "" : "", env.PI_SUBAGENT_INHERIT_PROJECT_CONTEXT = input.inheritProjectContext ? "1" : "0", env.PI_SUBAGENT_INHERIT_SKILLS = input.inheritSkills ? "1" : "0", input.intercomSessionName && (env.PI_SUBAGENT_INTERCOM_SESSION_NAME = input.intercomSessionName), input.orchestratorIntercomTarget && (env[SUBAGENT_ORCHESTRATOR_TARGET_ENV] = input.orchestratorIntercomTarget), input.parentSessionId && (env[SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV] = input.parentSessionId), env[SUBAGENT_SUPERVISOR_SESSION_ID_ENV] = input.supervisorSessionId ?? "", env[SUPERVISOR_PROTOCOL_ENV] = String(2), env[CHILD_DESCRIPTION_ENV] = input.childDescription ?? input.childAgentName ?? "", input.parentSessionId && input.runId && (input.childId || input.childAgentName)) {
2020
+ if (env[SUBAGENT_PARENT_EVENT_SINK_ENV] = fanoutAuthorized ? input.parentEventSink ?? process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] ?? "" : "", env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] = fanoutAuthorized ? input.parentControlInbox ?? process.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] ?? "" : "", env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] = fanoutAuthorized ? input.parentRootRunId ?? process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] ?? input.runId ?? "" : "", env[SUBAGENT_PARENT_RUN_ID_ENV] = fanoutAuthorized ? parentRunId : "", env[SUBAGENT_PARENT_CHILD_INDEX_ENV] = fanoutAuthorized ? parentChildIndex : "", env[SUBAGENT_PARENT_DEPTH_ENV] = fanoutAuthorized ? String(parentDepth) : "", env[SUBAGENT_PARENT_PATH_ENV] = fanoutAuthorized ? encodeNestedPathEnv(parentPath) : "", env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] = fanoutAuthorized ? input.parentCapabilityToken ?? process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] ?? "" : "", env.PI_SUBAGENT_INHERIT_PROJECT_CONTEXT = input.inheritProjectContext ? "1" : "0", env.PI_SUBAGENT_INHERIT_SKILLS = input.inheritSkills ? "1" : "0", env.PI_SUBAGENT_INTERCOM_SESSION_NAME = communicationEnabled ? input.intercomSessionName ?? "" : "", env[SUBAGENT_ORCHESTRATOR_TARGET_ENV] = communicationEnabled ? input.orchestratorIntercomTarget ?? "" : "", env[SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV] = communicationEnabled ? input.parentSessionId ?? "" : "", env[SUBAGENT_SUPERVISOR_SESSION_ID_ENV] = communicationEnabled ? input.supervisorSessionId ?? "" : "", env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV] = "", env[SUPERVISOR_PROTOCOL_ENV] = String(2), env[CHILD_DESCRIPTION_ENV] = input.childDescription ?? input.childAgentName ?? "", communicationEnabled && input.parentSessionId && input.runId && (input.childId || input.childAgentName)) {
2017
2021
  let childIndex = input.childIndex ?? 0, channelAgent = input.childId ?? input.childAgentName, channelDir = supervisorChannelDir(input.runId, channelAgent, childIndex);
2018
2022
  fs9.mkdirSync(path10.join(channelDir, "requests"), { recursive: !0 }), fs9.mkdirSync(path10.join(channelDir, "replies"), { recursive: !0 }), fs9.mkdirSync(path10.join(channelDir, "questions"), { recursive: !0 }), env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV] = channelDir, env[SUBAGENT_CHILD_INDEX_ENV] = String(childIndex);
2019
2023
  }
@@ -2384,7 +2388,7 @@ function normalizeChildSpec(input, options) {
2384
2388
  throw new Error(`${pathLabel}.task is required.`);
2385
2389
  let requested = parseChildPermissionsInput(input.permissions, `${pathLabel}.permissions`), resolved = resolveChildPermissions(options.parentMode, requested);
2386
2390
  if (!resolved.ok)
2387
- throw new Error(resolved.error || PLAN_MODE_WRITE_SPAWN_ERROR);
2391
+ throw new Error(resolved.error || READ_ONLY_WRITE_SPAWN_ERROR);
2388
2392
  let preservedSelection = isModelSelection(input.modelSelection) ? input.modelSelection : void 0, rawModel = optionalString(input.model);
2389
2393
  if (rawModel === INHERIT_MODEL)
2390
2394
  throw new Error(`${pathLabel}.model "inherit" is not supported; choose tier or an explicit provider/model.`);
@@ -4934,7 +4938,7 @@ function inactiveReason(mode, context, orchestratorTarget) {
4934
4938
  return "orchestrator target is not available";
4935
4939
  }
4936
4940
  function diagnoseIntercomBridge(input) {
4937
- let mode = resolveIntercomBridgeConfig(input.config).mode, orchestratorTarget = input.orchestratorTarget?.trim(), wantsIntercom = mode !== "off" && !(mode === "fork-only" && input.context !== "fork"), reason = inactiveReason(mode, input.context, orchestratorTarget);
4941
+ let config = resolveIntercomBridgeConfig(input.config), mode = subagentCommunicationEnabled(input.cwd ?? process.cwd(), input.agentDir ?? defaultAgentDir()) ? config.mode : "off", orchestratorTarget = input.orchestratorTarget?.trim(), wantsIntercom = mode !== "off" && !(mode === "fork-only" && input.context !== "fork"), reason = inactiveReason(mode, input.context, orchestratorTarget);
4938
4942
  return {
4939
4943
  active: reason === void 0,
4940
4944
  mode,
@@ -4946,9 +4950,10 @@ function diagnoseIntercomBridge(input) {
4946
4950
  };
4947
4951
  }
4948
4952
  function resolveIntercomBridge(input) {
4949
- let config = resolveIntercomBridgeConfig(input.config), mode = config.mode, orchestratorTarget = input.orchestratorTarget?.trim(), agentDir = path16.resolve(input.agentDir ?? defaultAgentDir()), settingsDir = path16.resolve(input.settingsDir ?? defaultSubagentConfigDir(agentDir)), defaultInstruction = buildIntercomBridgeInstruction(orchestratorTarget || "{orchestratorTarget}", DEFAULT_INTERCOM_BRIDGE_TEMPLATE);
4950
- return inactiveReason(mode, input.context, orchestratorTarget) || !orchestratorTarget ? { active: !1, mode, extensionDir: NATIVE_INTERCOM_EXTENSION_DIR, instruction: defaultInstruction } : {
4953
+ let config = resolveIntercomBridgeConfig(input.config), communicationEnabled = subagentCommunicationEnabled(input.cwd ?? process.cwd(), input.agentDir ?? defaultAgentDir()), mode = communicationEnabled ? config.mode : "off", orchestratorTarget = input.orchestratorTarget?.trim(), agentDir = path16.resolve(input.agentDir ?? defaultAgentDir()), settingsDir = path16.resolve(input.settingsDir ?? defaultSubagentConfigDir(agentDir)), defaultInstruction = buildIntercomBridgeInstruction(orchestratorTarget || "{orchestratorTarget}", DEFAULT_INTERCOM_BRIDGE_TEMPLATE);
4954
+ return inactiveReason(mode, input.context, orchestratorTarget) || !orchestratorTarget ? { active: !1, communicationEnabled, mode, extensionDir: NATIVE_INTERCOM_EXTENSION_DIR, instruction: defaultInstruction } : {
4951
4955
  active: !0,
4956
+ communicationEnabled,
4952
4957
  mode,
4953
4958
  orchestratorTarget,
4954
4959
  extensionDir: NATIVE_INTERCOM_EXTENSION_DIR,
@@ -20,7 +20,7 @@ import {
20
20
 
21
21
  // packages/coding-agent/dist/core/model-runtime.js
22
22
  import { dirname as dirname5, join as join7 } from "node:path";
23
- import { createModels, lazyStream as lazyStream2, ModelsError } from "@ashx-j/lunr-ai";
23
+ import { anthropicRequestRoute, createModels, lazyStream as lazyStream2, ModelsError } from "@ashx-j/lunr-ai";
24
24
  import * as builtinProviderCatalog from "@ashx-j/lunr-ai/providers/all";
25
25
 
26
26
  // packages/coding-agent/dist/core/auth-storage.js
@@ -353,7 +353,7 @@ function readStoredCredential(providerId, authPath = join(getAgentDir(), "auth.j
353
353
  // packages/coding-agent/dist/core/catalog-cache-scope.js
354
354
  import { createHash } from "node:crypto";
355
355
  function catalogCacheScope(provider, baseUrl, credential) {
356
- let identity = credential?.type === "oauth" ? typeof credential.accountId == "string" ? credential.accountId : credential.refresh || credential.access : credential?.key;
356
+ let identity = credential?.type === "oauth" ? typeof credential.accountId == "string" ? credential.accountId : credential.refresh || credential.access : credential?.type === "external_claude_code" ? credential.accountFingerprint : credential?.key;
357
357
  return createHash("sha256").update(JSON.stringify([provider, baseUrl.replace(/\/+$/, ""), identity ?? null])).digest("hex");
358
358
  }
359
359
 
@@ -2566,7 +2566,7 @@ var ModelRuntime = class _ModelRuntime {
2566
2566
  let resolution = await this.getAuth(model, { apiKey: options?.apiKey, env: options?.env });
2567
2567
  if (!resolution)
2568
2568
  throw new ModelsError("auth", `Provider is not configured: ${model.provider}`);
2569
- let { transformHeaders, ...providerOptions } = options ?? {}, headers = mergeHeaders(resolution.auth.headers, providerOptions.headers);
2569
+ let { transformHeaders, ...providerOptions } = options ?? {}, route = anthropicRequestRoute(model.provider, resolution, options), headers = mergeHeaders(resolution.auth.headers, providerOptions.headers);
2570
2570
  transformHeaders && (headers = await transformHeaders(headers ?? {}));
2571
2571
  let env = resolution.env || providerOptions.env ? { ...resolution.env ?? {}, ...providerOptions.env ?? {} } : void 0;
2572
2572
  return {
@@ -2574,7 +2574,7 @@ var ModelRuntime = class _ModelRuntime {
2574
2574
  model: resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model,
2575
2575
  options: {
2576
2576
  ...providerOptions,
2577
- apiKey: providerOptions.apiKey ?? resolution.auth.apiKey,
2577
+ ...route,
2578
2578
  headers,
2579
2579
  env
2580
2580
  }