@ashx-j/lunr 0.2.23 → 0.2.25

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 (272) hide show
  1. package/CHANGELOG.md +22 -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 +3 -8
  115. package/dist/gateway/adapters/discord.js.map +1 -1
  116. package/dist/gateway/adapters/telegram.d.ts.map +1 -1
  117. package/dist/gateway/adapters/telegram.js +7 -0
  118. package/dist/gateway/adapters/telegram.js.map +1 -1
  119. package/dist/gateway/agent-bridge.d.ts +4 -1
  120. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  121. package/dist/gateway/agent-bridge.js +57 -17
  122. package/dist/gateway/agent-bridge.js.map +1 -1
  123. package/dist/gateway/approval.d.ts +2 -6
  124. package/dist/gateway/approval.d.ts.map +1 -1
  125. package/dist/gateway/approval.js +3 -7
  126. package/dist/gateway/approval.js.map +1 -1
  127. package/dist/gateway/buttons.d.ts.map +1 -1
  128. package/dist/gateway/buttons.js +29 -19
  129. package/dist/gateway/buttons.js.map +1 -1
  130. package/dist/gateway/commands.d.ts +2 -0
  131. package/dist/gateway/commands.d.ts.map +1 -1
  132. package/dist/gateway/commands.js +39 -18
  133. package/dist/gateway/commands.js.map +1 -1
  134. package/dist/gateway/config.d.ts +1 -0
  135. package/dist/gateway/config.d.ts.map +1 -1
  136. package/dist/gateway/config.js +2 -0
  137. package/dist/gateway/config.js.map +1 -1
  138. package/dist/gateway/cron.d.ts +1 -1
  139. package/dist/gateway/cron.d.ts.map +1 -1
  140. package/dist/gateway/cron.js +2 -2
  141. package/dist/gateway/cron.js.map +1 -1
  142. package/dist/gateway/index.d.ts.map +1 -1
  143. package/dist/gateway/index.js +26 -26
  144. package/dist/gateway/index.js.map +1 -1
  145. package/dist/gateway/mobile-commands.d.ts.map +1 -1
  146. package/dist/gateway/mobile-commands.js +15 -14
  147. package/dist/gateway/mobile-commands.js.map +1 -1
  148. package/dist/gateway/presenter.d.ts +12 -1
  149. package/dist/gateway/presenter.d.ts.map +1 -1
  150. package/dist/gateway/presenter.js +146 -48
  151. package/dist/gateway/presenter.js.map +1 -1
  152. package/dist/gateway/router.d.ts +5 -5
  153. package/dist/gateway/router.d.ts.map +1 -1
  154. package/dist/gateway/router.js +96 -42
  155. package/dist/gateway/router.js.map +1 -1
  156. package/dist/gateway/service.d.ts.map +1 -1
  157. package/dist/gateway/service.js +13 -4
  158. package/dist/gateway/service.js.map +1 -1
  159. package/dist/gateway/setup.d.ts +5 -0
  160. package/dist/gateway/setup.d.ts.map +1 -1
  161. package/dist/gateway/setup.js +98 -42
  162. package/dist/gateway/setup.js.map +1 -1
  163. package/dist/gateway/stream.d.ts +6 -5
  164. package/dist/gateway/stream.d.ts.map +1 -1
  165. package/dist/gateway/stream.js +24 -11
  166. package/dist/gateway/stream.js.map +1 -1
  167. package/dist/main.d.ts.map +1 -1
  168. package/dist/main.js +1 -2
  169. package/dist/main.js.map +1 -1
  170. package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
  171. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  172. package/dist/modes/interactive/components/settings-selector.js +23 -3
  173. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  174. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  175. package/dist/modes/interactive/components/thinking-tail.js +2 -2
  176. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  177. package/dist/modes/interactive/components/tool-execution.d.ts +1 -0
  178. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  179. package/dist/modes/interactive/components/tool-execution.js +12 -2
  180. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  181. package/dist/modes/interactive/interactive-mode.d.ts +1 -2
  182. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  183. package/dist/modes/interactive/interactive-mode.js +76 -90
  184. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  185. package/dist/node-runtime/{agent-session-services-GZVSOGYR.js → agent-session-services-YXXFCP5J.js} +12 -12
  186. package/dist/node-runtime/{builtin-extensions-QVCXNQT4.js → builtin-extensions-ZLAX7TUH.js} +3 -3
  187. package/dist/node-runtime/{chunk-W64JC4E7.js → chunk-2HHLJWGD.js} +3 -87
  188. package/dist/node-runtime/{chunk-VWCE2HSZ.js → chunk-2HMIRK7W.js} +4 -4
  189. package/dist/node-runtime/{chunk-XLTL257W.js → chunk-2KIPT4HJ.js} +5 -1
  190. package/dist/node-runtime/{chunk-RIR5EDDJ.js → chunk-3XPLBUEM.js} +17 -12
  191. package/dist/node-runtime/{chunk-QAZOULTU.js → chunk-6XL67VVY.js} +40 -6
  192. package/dist/node-runtime/chunk-7S3T6YEA.js +97 -0
  193. package/dist/node-runtime/{chunk-R3K2F5GI.js → chunk-B4HP6ZWM.js} +2 -0
  194. package/dist/node-runtime/{chunk-TQGPP4SC.js → chunk-CDVHZOOK.js} +1 -1
  195. package/dist/node-runtime/{chunk-YJMMG7C6.js → chunk-DSIKTUPW.js} +1 -1
  196. package/dist/node-runtime/{chunk-LFZDVKSP.js → chunk-E4D3IGP2.js} +41 -25
  197. package/dist/node-runtime/{chunk-OFKSVRV7.js → chunk-GYIXXQAO.js} +1 -1
  198. package/dist/node-runtime/{chunk-BX2RB477.js → chunk-HFVZUPFJ.js} +1 -1
  199. package/dist/node-runtime/{chunk-AZJHNQKQ.js → chunk-I54LGHWM.js} +1 -1
  200. package/dist/node-runtime/{chunk-YHQ3NBB3.js → chunk-IJIFHRTB.js} +20 -18
  201. package/dist/node-runtime/{chunk-GS66LV4M.js → chunk-KJ6DWS3K.js} +4 -4
  202. package/dist/node-runtime/{chunk-HPUP7E4T.js → chunk-KWIYUUZK.js} +68 -42
  203. package/dist/node-runtime/{chunk-TVJUOJZJ.js → chunk-LQP3RB67.js} +184 -1527
  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-GMHJCCEN.js → chunk-NRKGMJYU.js} +4 -1
  207. package/dist/node-runtime/{chunk-CSUZVNYE.js → chunk-OVX6X377.js} +10 -6
  208. package/dist/node-runtime/{chunk-DD5YWFSJ.js → chunk-QTU6AKNJ.js} +130 -65
  209. package/dist/node-runtime/{chunk-LLUIPGDR.js → chunk-RC7DMV45.js} +110 -77
  210. package/dist/node-runtime/{chunk-UWPJL22I.js → chunk-SLVOAQOY.js} +15 -4
  211. package/dist/node-runtime/{chunk-EKVFP6YF.js → chunk-TORR5XBV.js} +17 -16
  212. package/dist/node-runtime/{chunk-UP2XBVH5.js → chunk-UOEDI7RP.js} +1 -1
  213. package/dist/node-runtime/{chunk-DQMGU675.js → chunk-VQFSUJJG.js} +20 -17
  214. package/dist/node-runtime/{chunk-X3URCYCU.js → chunk-WF7PGWRZ.js} +14 -14
  215. package/dist/node-runtime/chunk-YCUZEGJG.js +1361 -0
  216. package/dist/node-runtime/{chunk-5D7LC2ZQ.js → chunk-ZXSGTGJ6.js} +54 -85
  217. package/dist/node-runtime/cli-runtime.js +1 -1
  218. package/dist/node-runtime/{command-PDVTBRWA.js → command-6WDOYKS6.js} +5 -5
  219. package/dist/node-runtime/{commands-KAMO2T6P.js → commands-NZLSOHPE.js} +2 -2
  220. package/dist/node-runtime/{commands-XDCFGIGW.js → commands-QC6VUZJQ.js} +9 -9
  221. package/dist/node-runtime/{config-RORQUQFG.js → config-D4QUPAHX.js} +1 -1
  222. package/dist/node-runtime/{direct-tool-executor-YAVOLDFY.js → direct-tool-executor-77GW4F5P.js} +3 -3
  223. package/dist/node-runtime/{export-html-KSOIMVPI.js → export-html-VM4J2MNR.js} +1 -1
  224. package/dist/node-runtime/{gateway-AYWM5DIO.js → gateway-INAYBF4Q.js} +141 -85
  225. package/dist/node-runtime/index.js +23 -21
  226. package/dist/node-runtime/{init-X2LIUB2H.js → init-HS6NQXSK.js} +2 -2
  227. package/dist/node-runtime/{install-cli-3BO4MMQ6.js → install-cli-KL4UDDAD.js} +3 -3
  228. package/dist/node-runtime/{interactive-mode-4MFRKAHG.js → interactive-mode-Z5M7WYYZ.js} +14 -14
  229. package/dist/node-runtime/{interactive-view-TUZHCQM3.js → interactive-view-NGFAMHPW.js} +2 -2
  230. package/dist/node-runtime/{lunr-browser-RYFIIVJN.js → lunr-browser-IR7TL3J7.js} +4 -4
  231. package/dist/node-runtime/{lunr-cron-YWXEPZMQ.js → lunr-cron-LWIZJM2N.js} +8 -8
  232. package/dist/node-runtime/main.js +19 -18
  233. package/dist/node-runtime/{mobile-commands-LVHDAUDP.js → mobile-commands-J7OJEKFO.js} +6 -6
  234. package/dist/node-runtime/{model-runtime-PLQKAG4B.js → model-runtime-OO5HFLWE.js} +1 -1
  235. package/dist/node-runtime/{package-manager-cli-6GT3Z3CK.js → package-manager-cli-VYZM5WHN.js} +10 -8
  236. package/dist/node-runtime/{pi-intercom-HBPK5HSJ.js → pi-intercom-QM53RLTS.js} +2 -0
  237. package/dist/node-runtime/{pi-mcp-adapter-E6WULBKF.js → pi-mcp-adapter-5UKBZP44.js} +7 -6
  238. package/dist/node-runtime/{pi-subagents-CDWK2AKY.js → pi-subagents-DNY7EAIG.js} +23 -13
  239. package/dist/node-runtime/{proxy-modes-OSQCWRBI.js → proxy-modes-LGEUYD7R.js} +3 -3
  240. package/dist/node-runtime/rpc-entry.js +19 -18
  241. package/dist/node-runtime/{runtime-bridges-3XUQ46XW.js → runtime-bridges-VRDDR73P.js} +8 -1
  242. package/dist/node-runtime/{service-ISSP6VHE.js → service-MDQIPQ26.js} +1 -1
  243. package/dist/node-runtime/{session-handoff-HC7R5E24.js → session-handoff-GWARVEWT.js} +2 -2
  244. package/dist/node-runtime/{session-manager-CFN4UFM2.js → session-manager-JB5J6XBN.js} +1 -1
  245. package/dist/node-runtime/{settings-manager-6VEMXRDL.js → settings-manager-J4SPQPDJ.js} +10 -7
  246. package/dist/node-runtime/setup-CQ2NLVK5.js +214 -0
  247. package/dist/node-runtime/{subagent-executor-M5VWB3D3.js → subagent-executor-KZZQGAKV.js} +40 -7
  248. package/dist/node-runtime/{update-cli-UVKJWRRJ.js → update-cli-GTFJC7XK.js} +4 -5
  249. package/dist/startup/interactive-view.d.ts.map +1 -1
  250. package/dist/startup/interactive-view.js +5 -1
  251. package/dist/startup/interactive-view.js.map +1 -1
  252. package/docs/browser.md +1 -1
  253. package/docs/features.md +19 -18
  254. package/docs/index.md +1 -1
  255. package/docs/keybindings.md +1 -1
  256. package/docs/providers.md +6 -2
  257. package/docs/quickstart.md +2 -2
  258. package/docs/settings.md +1 -1
  259. package/docs/usage.md +4 -4
  260. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  261. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  262. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  263. package/examples/extensions/gondolin/package-lock.json +2 -2
  264. package/examples/extensions/gondolin/package.json +1 -1
  265. package/examples/extensions/plan-mode/README.md +1 -1
  266. package/examples/extensions/sandbox/package-lock.json +2 -2
  267. package/examples/extensions/sandbox/package.json +1 -1
  268. package/examples/extensions/with-deps/package-lock.json +2 -2
  269. package/examples/extensions/with-deps/package.json +1 -1
  270. package/package.json +4 -4
  271. package/dist/node-runtime/chunk-LISUTZS3.js +0 -19
  272. package/dist/node-runtime/setup-5SR2J35A.js +0 -155
@@ -713,7 +713,8 @@ Usage:
713
713
  `, desc += ` mcp({ action: "auth-start", server: "name" }) \u2192 Start manual OAuth and get a browser URL
714
714
  `, desc += ` mcp({ action: "auth-complete", server: "name", args: '{"redirectUrl":"..."}' }) \u2192 Complete manual OAuth
715
715
  `, desc += `
716
- Mode: action > tool (call) > connect > describe > search > server (list) > nothing (status)`, desc;
716
+ Mode: action > tool (call) > connect > describe > search > server (list) > nothing (status)`, desc += `
717
+ Read-only mode permits status, search, describe, and ui-messages only. Tool calls, connections, and authentication require yolo or auto; direct MCP tools are blocked in read-only.`, desc;
717
718
  }
718
719
 
719
720
  // packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/abort.js
@@ -254,7 +254,7 @@ var ChatboxEditor = class extends CustomEditor {
254
254
  };
255
255
  function renderStatsLine(width, ctx, theme, footerData) {
256
256
  let sep = color(theme, "accent2", " | "), parts = [], modeZone = [], mode = lunrPermissionMode();
257
- mode === "yolo" || mode === "auto" ? modeZone.push(color(theme, "warning", mode)) : (mode === "manual" || mode === "plan") && modeZone.push(color(theme, "white", mode));
257
+ mode === "yolo" || mode === "auto" ? modeZone.push(color(theme, "warning", mode)) : mode === "read-only" && modeZone.push(color(theme, "white", "read"));
258
258
  let footerToggles = lunrFooterToggles(), statuses = footerData.getExtensionStatuses?.();
259
259
  if (statuses && statuses.size > 0) {
260
260
  let modeKeys = footerToggles.statuses ? ["plan", "goal"] : [];
@@ -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-6XL67VVY.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 {
@@ -2,17 +2,21 @@ import { createRequire as __lunrRequire } from "node:module"; const require = __
2
2
  import {
3
3
  getPermissionMode,
4
4
  resetPermissions
5
- } from "./chunk-5D7LC2ZQ.js";
5
+ } from "./chunk-ZXSGTGJ6.js";
6
6
 
7
7
  // packages/coding-agent/dist/core/subagent-permission-inherit.js
8
8
  var SUBAGENT_CHILD_ENV = "PI_SUBAGENT_CHILD", SUBAGENT_CHILD_PERMISSION_ENV = "PI_SUBAGENT_CHILD_PERMISSION";
9
- var PLAN_MODE_WRITE_SPAWN_ERROR = 'Cannot launch a full-access child in plan mode. Relaunch with permissions: "read-only".';
9
+ var READ_ONLY_WRITE_SPAWN_ERROR = 'Cannot launch a full-access child in read-only mode. Relaunch with permissions: "read-only".';
10
10
  function isSubagentChildProcess(env = process.env) {
11
11
  return env[SUBAGENT_CHILD_ENV] === "1";
12
12
  }
13
13
  function parseParentPermissionMode(value) {
14
- if (value === "manual" || value === "yolo" || value === "plan" || value === "auto")
14
+ if (value === "yolo" || value === "auto" || value === "read-only")
15
15
  return value;
16
+ if (value === "plan")
17
+ return "read-only";
18
+ if (value === "manual")
19
+ return "yolo";
16
20
  }
17
21
  function parseChildPermission(value) {
18
22
  if (value === "full" || value === "read-only")
@@ -22,14 +26,14 @@ function resolveRequestedChildPermission(requested) {
22
26
  return requested === "read-only" ? "read-only" : "full";
23
27
  }
24
28
  function resolveChildRuntimePermissionMode(childPermission) {
25
- return parseChildPermission(childPermission) === "read-only" ? "plan" : "auto";
29
+ return parseChildPermission(childPermission) === "read-only" ? "read-only" : "auto";
26
30
  }
27
31
  function snapshotParentPermissionMode(sessionId) {
28
32
  return getPermissionMode(sessionId);
29
33
  }
30
34
  function resolveChildPermissions(parentMode, requested) {
31
35
  let requestedPermission = resolveRequestedChildPermission(requested);
32
- return parseParentPermissionMode(parentMode) === "plan" && requestedPermission === "full" ? { ok: !1, requested: requestedPermission, error: PLAN_MODE_WRITE_SPAWN_ERROR } : { ok: !0, requested: requestedPermission, effective: requestedPermission };
36
+ return parseParentPermissionMode(parentMode) === "read-only" && requestedPermission === "full" ? { ok: !1, requested: requestedPermission, error: READ_ONLY_WRITE_SPAWN_ERROR } : { ok: !0, requested: requestedPermission, effective: requestedPermission };
33
37
  }
34
38
  function applyInheritedSubagentPermissions(env = process.env) {
35
39
  if (!isSubagentChildProcess(env))
@@ -39,7 +43,7 @@ function applyInheritedSubagentPermissions(env = process.env) {
39
43
  }
40
44
 
41
45
  export {
42
- PLAN_MODE_WRITE_SPAWN_ERROR,
46
+ READ_ONLY_WRITE_SPAWN_ERROR,
43
47
  snapshotParentPermissionMode,
44
48
  resolveChildPermissions,
45
49
  applyInheritedSubagentPermissions
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-RMQZU2YU.js";
5
5
  import {
6
6
  atomicJson
7
- } from "./chunk-UWPJL22I.js";
7
+ } from "./chunk-SLVOAQOY.js";
8
8
  import {
9
9
  noOpUIContext
10
10
  } from "./chunk-GJ2RDBRL.js";
@@ -12,12 +12,13 @@ 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
+ gatewayConfigPath,
17
18
  loadGatewayConfig,
18
19
  platformConfigFor,
19
20
  saveGatewayConfig
20
- } from "./chunk-R3K2F5GI.js";
21
+ } from "./chunk-B4HP6ZWM.js";
21
22
  import {
22
23
  getAgentDir
23
24
  } from "./chunk-FQMM2EZ2.js";
@@ -236,7 +237,7 @@ async function handleApprovalCallback(event, adapter) {
236
237
  return entry.resolve("reject"), !0;
237
238
  if (entry.plan && response !== "reject" && entry.key) {
238
239
  let sessionId = getSession(entry.key)?.sessionId;
239
- sessionId && setPermissionMode("manual", sessionId);
240
+ sessionId && setPermissionMode("yolo", sessionId);
240
241
  }
241
242
  entry.resolve(response);
242
243
  let label = parsed.action === "reject" || parsed.action === "cancel" ? "Rejected." : `Approved (${parsed.action}).`;
@@ -341,12 +342,12 @@ async function handleCallback(cb, deps) {
341
342
  await answerExpired(adapter, cb);
342
343
  return;
343
344
  }
344
- if (picker.validate && !picker.validate()) {
345
+ if (!picker.completed && picker.validate && !picker.validate()) {
345
346
  registry.delete(parsed.id), picker.onCancel?.(), await answerExpired(adapter, cb);
346
347
  return;
347
348
  }
348
349
  if (Date.now() > picker.createdAt + PICKER_TTL_MS) {
349
- picker.onCancel?.(), registry.delete(parsed.id);
350
+ picker.completed || picker.onCancel?.(), registry.delete(parsed.id);
350
351
  try {
351
352
  await picker.adapter.editMessage(picker.chatId, picker.messageId, "\u23F1 Expired \u2014 run the command again.", []);
352
353
  } catch {
@@ -366,6 +367,11 @@ async function handleCallback(cb, deps) {
366
367
  await answerUnauthorized(adapter, cb);
367
368
  return;
368
369
  }
370
+ if (picker.completed !== void 0) {
371
+ await adapter.answerCallback(cb.id, "Already completed.").catch(() => {
372
+ });
373
+ return;
374
+ }
369
375
  if (parsed.action === "cancel") {
370
376
  registry.delete(parsed.id), picker.onCancel?.();
371
377
  try {
@@ -417,33 +423,25 @@ async function handleCallback(cb, deps) {
417
423
  }
418
424
  return;
419
425
  }
420
- registry.delete(parsed.id);
421
- try {
422
- await picker.adapter.editMessage(picker.chatId, picker.messageId, result.text, []);
423
- } catch {
424
- }
426
+ picker.completed = result.text, await confirmPicker(picker, result.text);
425
427
  } catch (err) {
426
- registry.delete(parsed.id);
427
428
  let message = err instanceof Error ? err.message : String(err);
428
- try {
429
- await picker.adapter.editMessage(picker.chatId, picker.messageId, `\u26A0 ${message}`, []);
430
- } catch {
431
- }
429
+ picker.completed = `\u26A0 ${message}`, await confirmPicker(picker, picker.completed);
432
430
  } finally {
433
431
  picker.resolving = !1;
434
432
  }
435
433
  }
434
+ async function confirmPicker(picker, text) {
435
+ if ((await picker.adapter.editMessage(picker.chatId, picker.messageId, text, []).catch(() => ({ success: !1 }))).success)
436
+ return;
437
+ (await picker.adapter.send(picker.chatId, text, { threadId: picker.source.threadId }).catch(() => ({ success: !1 }))).success || console.error(`[gateway] picker confirmation failed on ${picker.adapter.platform}`);
438
+ }
436
439
  function startButtonSweeper() {
437
440
  sweeper || (sweeper = setInterval(() => {
438
441
  let cutoff = Date.now() - PICKER_TTL_MS;
439
442
  for (let [id, entry] of registry)
440
- if (!(entry.createdAt > cutoff)) {
441
- registry.delete(id), entry.onCancel?.();
442
- try {
443
- entry.adapter.editMessage(entry.chatId, entry.messageId, "\u23F1 Expired \u2014 run the command again.", []);
444
- } catch {
445
- }
446
- }
443
+ entry.createdAt > cutoff || (registry.delete(id), !entry.completed && (entry.onCancel?.(), entry.adapter.editMessage(entry.chatId, entry.messageId, "\u23F1 Expired \u2014 run the command again.", []).catch(() => {
444
+ })));
447
445
  }, SWEEP_INTERVAL_MS), sweeper.unref?.());
448
446
  }
449
447
  function stopButtonSweeper() {
@@ -530,13 +528,23 @@ function splitMessage(text, max) {
530
528
  }
531
529
 
532
530
  // packages/coding-agent/dist/gateway/presenter.js
533
- var epochs = /* @__PURE__ */ new Map(), inputs = /* @__PURE__ */ new Map(), dialogs = /* @__PURE__ */ new Map(), adapters = /* @__PURE__ */ new Map(), timer, sending = !1, path2 = () => join3(getAgentDir(), "gateway-outbox.json"), outbox = [];
531
+ var epochs = /* @__PURE__ */ new Map(), inputs = /* @__PURE__ */ new Map(), dialogs = /* @__PURE__ */ new Map(), adapters = /* @__PURE__ */ new Map(), deliveryConfigs = /* @__PURE__ */ new Map(), roleGrants = /* @__PURE__ */ new Map(), timer, activeDeliveries = /* @__PURE__ */ new Map(), MAX_ATTEMPTS = 5, path2 = () => join3(getAgentDir(), "gateway-outbox.json"), outbox = [];
532
+ function sourceWithCurrentRole(key, source) {
533
+ let grant = roleGrants.get(key);
534
+ return {
535
+ ...source,
536
+ roleAuthorized: grant?.userId === source.userId && grant.chatId === source.chatId && grant.threadId === source.threadId
537
+ };
538
+ }
539
+ function rememberGatewayRole(key, source) {
540
+ source.roleAuthorized === !0 ? roleGrants.set(key, { userId: source.userId, chatId: source.chatId, threadId: source.threadId }) : roleGrants.delete(key);
541
+ }
534
542
  function canDeliver(key) {
535
543
  let binding = conversationBinding(key);
536
544
  if (!binding)
537
545
  return !1;
538
546
  let cfg = loadGatewayConfig();
539
- return binding.owner && (binding.owner !== binding.source.userId || !isGatewayOwner(binding.source, cfg)) ? !1 : isAuthorized(binding.source, cfg, createPairingStore());
547
+ return binding.owner && (binding.owner !== binding.source.userId || !isGatewayOwner(binding.source, cfg)) ? !1 : isAuthorized(sourceWithCurrentRole(key, binding.source), cfg, createPairingStore());
540
548
  }
541
549
  function gatewayDestination(key) {
542
550
  let binding = conversationBinding(key), adapter = binding && adapters.get(binding.source.platform);
@@ -551,56 +559,106 @@ function withGatewayPresentation(key, run) {
551
559
  function startGatewayPresenter(connected) {
552
560
  if (adapters = connected, existsSync3(path2()))
553
561
  try {
554
- outbox = JSON.parse(readFileSync3(path2(), "utf8"));
562
+ let raw = JSON.parse(readFileSync3(path2(), "utf8"));
563
+ if (!Array.isArray(raw) || !raw.every((item) => item && typeof item.id == "string" && typeof item.key == "string" && typeof item.text == "string"))
564
+ throw new Error("Invalid outbox");
565
+ outbox = raw;
555
566
  } catch {
556
567
  throw new Error("Gateway outbox is invalid. Restore it before starting.");
557
568
  }
569
+ else
570
+ outbox = [];
571
+ for (let item of outbox)
572
+ item.kind === "notice" && epochs.set(item.key, Math.max(epochs.get(item.key) ?? 0, item.epoch ?? 0));
558
573
  timer && clearInterval(timer), timer = setInterval(() => {
559
- flushOutbox();
560
- }, 3e3), timer.unref(), flushOutbox();
574
+ flushOutbox().catch((error) => console.error("[gateway] outbox flush failed:", error));
575
+ }, 3e3), timer.unref(), flushOutbox().catch((error) => console.error("[gateway] outbox flush failed:", error));
561
576
  }
562
577
  function stopGatewayPresenter() {
563
578
  timer && clearInterval(timer), timer = void 0;
564
579
  for (let key of dialogs.keys())
565
580
  invalidateGatewayDialogs(key);
566
- adapters = /* @__PURE__ */ new Map();
581
+ adapters = /* @__PURE__ */ new Map(), deliveryConfigs.clear(), roleGrants.clear();
582
+ }
583
+ function gatewayEpoch(key) {
584
+ return epochs.get(key) ?? 0;
567
585
  }
568
- async function sendGatewayNotice(key, text) {
586
+ async function sendGatewayNotice(key, text, kind = "notice", epoch = gatewayEpoch(key)) {
569
587
  let clean = text.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").trim();
570
588
  if (!clean || !canDeliver(key))
571
589
  return;
572
- let { adapter } = gatewayDestination(key);
573
- for (let chunk of splitMessage(clean, adapter.maxMessageLength))
574
- outbox.push({ id: randomUUID(), key, epoch: epochs.get(key) ?? 0, text: chunk });
575
- atomicJson(path2(), outbox), await flushOutbox();
576
- }
577
- async function flushOutbox() {
578
- if (!sending) {
579
- sending = !0;
580
- try {
581
- for (let item of [...outbox]) {
582
- if (!canDeliver(item.key)) {
583
- outbox = outbox.filter((v) => v.id !== item.id), atomicJson(path2(), outbox);
584
- continue;
585
- }
586
- let target;
587
- try {
588
- target = gatewayDestination(item.key);
589
- } catch {
590
- continue;
591
- }
592
- if ((await target.adapter.send(target.source.chatId, item.text, { threadId: target.source.threadId }).catch(() => ({ success: !1 }))).success)
593
- outbox = outbox.filter((v) => v.id !== item.id), atomicJson(path2(), outbox);
594
- else
595
- break;
590
+ let { adapter, source } = gatewayDestination(key);
591
+ await queueGatewayText(key, source, adapter, clean, { kind, epoch });
592
+ }
593
+ async function queueGatewayText(key, source, adapter, text, options) {
594
+ if (!text || options.kind === "notice" && options.epoch !== void 0 && options.epoch !== gatewayEpoch(key))
595
+ return;
596
+ adapters.set(source.platform, adapter), options.cfg && deliveryConfigs.set(key, options.cfg);
597
+ let chunks = options.chunks ?? splitMessage(text, adapter.maxMessageLength), batchId = randomUUID();
598
+ for (let [index, chunk] of chunks.entries())
599
+ outbox.push({
600
+ id: randomUUID(),
601
+ batchId,
602
+ key,
603
+ source: { ...source, roleAuthorized: void 0 },
604
+ epoch: options.epoch ?? gatewayEpoch(key),
605
+ text: chunk,
606
+ kind: options.kind,
607
+ replyTo: index === 0 ? options.replyTo : void 0
608
+ });
609
+ atomicJson(path2(), outbox), activeDeliveries.has(key) && await activeDeliveries.get(key), await flushKey(key);
610
+ }
611
+ function flushOutbox() {
612
+ return Promise.all([...new Set(outbox.map((item) => item.key))].map(flushKey)).then(() => {
613
+ });
614
+ }
615
+ function flushKey(key) {
616
+ let current = activeDeliveries.get(key);
617
+ if (current)
618
+ return current;
619
+ let running = drainKey(key).finally(() => {
620
+ activeDeliveries.delete(key);
621
+ });
622
+ return activeDeliveries.set(key, running), running;
623
+ }
624
+ async function drainKey(key) {
625
+ let failedBatches = new Set(outbox.filter((item) => item.failed && item.batchId).map((item) => item.batchId));
626
+ for (let item of [...outbox].filter((item2) => item2.key === key)) {
627
+ if (item.failed || item.batchId && failedBatches.has(item.batchId))
628
+ continue;
629
+ if (item.kind === "notice" && item.epoch !== (epochs.get(item.key) ?? 0)) {
630
+ outbox = outbox.filter((v) => v.id !== item.id), atomicJson(path2(), outbox);
631
+ continue;
632
+ }
633
+ let binding = conversationBinding(item.key), source = item.source ?? binding?.source;
634
+ if (!source)
635
+ break;
636
+ let cfg = existsSync3(gatewayConfigPath()) ? loadGatewayConfig() : deliveryConfigs.get(item.key) ?? loadGatewayConfig();
637
+ if (binding && (binding.source.platform !== source.platform || binding.source.chatId !== source.chatId || binding.source.userId !== source.userId || binding.source.threadId !== source.threadId) || !isAuthorized(sourceWithCurrentRole(key, source), cfg, createPairingStore()) || binding?.owner && (binding.owner !== source.userId || !isGatewayOwner(source, cfg))) {
638
+ outbox = outbox.filter((v) => v.id !== item.id), atomicJson(path2(), outbox);
639
+ continue;
640
+ }
641
+ let adapter = adapters.get(source.platform);
642
+ if (!adapter || (item.nextAttempt ?? 0) > Date.now())
643
+ break;
644
+ let opts = { threadId: source.threadId, replyTo: item.replyTo }, result = await adapter.send(source.chatId, item.text, opts).catch((error) => ({ success: !1, error: String(error), retryable: !0 }));
645
+ if (result.success)
646
+ outbox = outbox.filter((v) => v.id !== item.id), atomicJson(path2(), outbox);
647
+ else {
648
+ if (item.attempts = (item.attempts ?? 0) + 1, item.failed = result.retryable === !1 || item.attempts >= MAX_ATTEMPTS, item.nextAttempt = Date.now() + Math.min(6e4, 3e3 * 2 ** (item.attempts - 1)), item.failed && item.batchId) {
649
+ failedBatches.add(item.batchId);
650
+ for (let pending2 of outbox)
651
+ pending2.batchId === item.batchId && (pending2.failed = !0);
596
652
  }
597
- } finally {
598
- sending = !1;
653
+ atomicJson(path2(), outbox), console.error(`[gateway] delivery ${item.failed ? "failed permanently" : "retry scheduled"} for ${source.platform}: ${result.error ?? "unknown error"}`);
654
+ break;
599
655
  }
600
656
  }
601
657
  }
602
658
  function invalidateGatewayDialogs(key) {
603
659
  epochs.set(key, (epochs.get(key) ?? 0) + 1);
660
+ let remaining = outbox.filter((item) => item.key !== key || item.kind !== "notice");
661
+ remaining.length !== outbox.length && (outbox = remaining, atomicJson(path2(), outbox));
604
662
  for (let cancel of dialogs.get(key) ?? [])
605
663
  cancel();
606
664
  dialogs.delete(key), inputs.delete(key);
@@ -642,34 +700,38 @@ ${item.value}` })
642
700
  });
643
701
  }
644
702
  function gatewayInput(key, title, placeholder, opts) {
645
- return inputs.has(key) ? Promise.reject(new Error("Answer or cancel the existing question first.")) : dialog(key, opts, async (done) => {
703
+ if (inputs.has(key))
704
+ return Promise.reject(new Error("Answer or cancel the existing question first."));
705
+ let epoch = gatewayEpoch(key);
706
+ return dialog(key, opts, async (done) => {
646
707
  let { source } = gatewayDestination(key);
647
708
  inputs.set(key, { userId: source.userId, resolve: done }), await sendGatewayNotice(key, `${title}${placeholder ? `
648
709
  ${placeholder}` : ""}
649
- Reply with text, or /cancel.`);
710
+ Reply with text, or /cancel.`, "notice", epoch);
650
711
  });
651
712
  }
652
713
  function createGatewayUI(key) {
714
+ let epoch = gatewayEpoch(key);
653
715
  return {
654
716
  ...noOpUIContext,
655
- select: (title, options, opts) => gatewaySelect(key, title, options, opts),
656
- confirm: async (title, message, opts) => await gatewaySelect(key, `${title}
717
+ select: (title, options, opts) => gatewayEpoch(key) === epoch ? gatewaySelect(key, title, options, opts) : Promise.resolve(void 0),
718
+ confirm: async (title, message, opts) => gatewayEpoch(key) === epoch && await gatewaySelect(key, `${title}
657
719
  ${message}`, ["Approve", "Decline"], opts) === "Approve",
658
- input: (title, placeholder, opts) => gatewayInput(key, title, placeholder, opts),
659
- editor: (title, prefill) => gatewayInput(key, title, prefill),
720
+ input: (title, placeholder, opts) => gatewayEpoch(key) === epoch ? gatewayInput(key, title, placeholder, opts) : Promise.resolve(void 0),
721
+ editor: (title, prefill) => gatewayEpoch(key) === epoch ? gatewayInput(key, title, prefill) : Promise.resolve(void 0),
660
722
  notify: (message) => {
661
- sendGatewayNotice(key, message).catch(() => {
723
+ sendGatewayNotice(key, message, "notice", epoch).catch(() => {
662
724
  });
663
725
  },
664
726
  custom: async () => {
665
727
  throw new Error("This command requires the terminal interface. Use the gateway's text commands or button pickers.");
666
728
  },
667
729
  pasteToEditor: (text) => {
668
- sendGatewayNotice(key, text).catch(() => {
730
+ sendGatewayNotice(key, text, "notice", epoch).catch(() => {
669
731
  });
670
732
  },
671
733
  setEditorText: (text) => {
672
- sendGatewayNotice(key, text).catch(() => {
734
+ sendGatewayNotice(key, text, "notice", epoch).catch(() => {
673
735
  });
674
736
  }
675
737
  };
@@ -696,10 +758,13 @@ export {
696
758
  startButtonSweeper,
697
759
  stopButtonSweeper,
698
760
  splitMessage,
761
+ rememberGatewayRole,
699
762
  withGatewayPresentation,
700
763
  startGatewayPresenter,
701
764
  stopGatewayPresenter,
765
+ gatewayEpoch,
702
766
  sendGatewayNotice,
767
+ queueGatewayText,
703
768
  invalidateGatewayDialogs,
704
769
  acceptGatewayInput,
705
770
  gatewaySelect,