@ashx-j/lunr-dev 0.2.16-dev.9.1 → 0.2.19-dev.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/README.md +7 -1
  3. package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -0
  4. package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
  5. package/dist/builtin-extensions/ashxj-thinking.js +44 -19
  6. package/dist/builtin-extensions/ashxj-thinking.js.map +1 -1
  7. package/dist/builtin-extensions/index.d.ts.map +1 -1
  8. package/dist/builtin-extensions/index.js +1 -0
  9. package/dist/builtin-extensions/index.js.map +1 -1
  10. package/dist/builtin-extensions/lunr-computer-use.d.ts +3 -0
  11. package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -0
  12. package/dist/builtin-extensions/lunr-computer-use.js +157 -0
  13. package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
  14. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
  15. package/dist/builtin-extensions/pi-lsp-extension/src/index.js +10 -3
  16. package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
  17. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +5 -1
  18. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -1
  19. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +26 -4
  20. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -1
  21. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  22. package/dist/builtin-extensions/pi-mcp-adapter/index.js +37 -27
  23. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  24. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +6 -1
  25. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
  26. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
  27. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
  28. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  29. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +52 -23
  30. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  31. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
  32. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +6 -2
  33. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
  34. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +1 -1
  35. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  36. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +5 -2
  37. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  38. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts +10 -0
  39. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts.map +1 -0
  40. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js +38 -0
  41. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js.map +1 -0
  42. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  43. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +3 -16
  44. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  45. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
  46. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
  47. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +2 -0
  48. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
  49. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +1 -0
  50. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  51. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +70 -30
  52. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  53. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  54. package/dist/builtin-extensions/pi-web-access/index.js +103 -102
  55. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  56. package/dist/core/agent-session-services.d.ts.map +1 -1
  57. package/dist/core/agent-session-services.js +1 -1
  58. package/dist/core/agent-session-services.js.map +1 -1
  59. package/dist/core/computer-use/adapter.d.ts +23 -0
  60. package/dist/core/computer-use/adapter.d.ts.map +1 -0
  61. package/dist/core/computer-use/adapter.js +116 -0
  62. package/dist/core/computer-use/adapter.js.map +1 -0
  63. package/dist/core/computer-use/lease.d.ts +18 -0
  64. package/dist/core/computer-use/lease.d.ts.map +1 -0
  65. package/dist/core/computer-use/lease.js +129 -0
  66. package/dist/core/computer-use/lease.js.map +1 -0
  67. package/dist/core/computer-use/macos-runtime.d.ts +14 -0
  68. package/dist/core/computer-use/macos-runtime.d.ts.map +1 -0
  69. package/dist/core/computer-use/macos-runtime.js +148 -0
  70. package/dist/core/computer-use/macos-runtime.js.map +1 -0
  71. package/dist/core/computer-use/policy.d.ts +19 -0
  72. package/dist/core/computer-use/policy.d.ts.map +1 -0
  73. package/dist/core/computer-use/policy.js +66 -0
  74. package/dist/core/computer-use/policy.js.map +1 -0
  75. package/dist/core/computer-use/release.generated.d.ts +31 -0
  76. package/dist/core/computer-use/release.generated.d.ts.map +1 -0
  77. package/dist/core/computer-use/release.generated.js +36 -0
  78. package/dist/core/computer-use/release.generated.js.map +1 -0
  79. package/dist/core/computer-use/runtime.d.ts +13 -0
  80. package/dist/core/computer-use/runtime.d.ts.map +1 -0
  81. package/dist/core/computer-use/runtime.js +158 -0
  82. package/dist/core/computer-use/runtime.js.map +1 -0
  83. package/dist/core/computer-use/schemas.d.ts +88 -0
  84. package/dist/core/computer-use/schemas.d.ts.map +1 -0
  85. package/dist/core/computer-use/schemas.js +80 -0
  86. package/dist/core/computer-use/schemas.js.map +1 -0
  87. package/dist/core/computer-use/windows-desktop.d.ts +3 -0
  88. package/dist/core/computer-use/windows-desktop.d.ts.map +1 -0
  89. package/dist/core/computer-use/windows-desktop.js +48 -0
  90. package/dist/core/computer-use/windows-desktop.js.map +1 -0
  91. package/dist/core/computer-use/workflow.d.ts +24 -0
  92. package/dist/core/computer-use/workflow.d.ts.map +1 -0
  93. package/dist/core/computer-use/workflow.js +330 -0
  94. package/dist/core/computer-use/workflow.js.map +1 -0
  95. package/dist/core/keybindings.d.ts +2 -2
  96. package/dist/core/keybindings.d.ts.map +1 -1
  97. package/dist/core/keybindings.js +2 -2
  98. package/dist/core/keybindings.js.map +1 -1
  99. package/dist/core/model-runtime.d.ts +0 -3
  100. package/dist/core/model-runtime.d.ts.map +1 -1
  101. package/dist/core/model-runtime.js +1 -10
  102. package/dist/core/model-runtime.js.map +1 -1
  103. package/dist/core/package-manager.d.ts.map +1 -1
  104. package/dist/core/package-manager.js +1 -1
  105. package/dist/core/package-manager.js.map +1 -1
  106. package/dist/core/permissions.d.ts +1 -1
  107. package/dist/core/permissions.d.ts.map +1 -1
  108. package/dist/core/permissions.js +23 -7
  109. package/dist/core/permissions.js.map +1 -1
  110. package/dist/core/plan-mode.d.ts.map +1 -1
  111. package/dist/core/plan-mode.js +9 -0
  112. package/dist/core/plan-mode.js.map +1 -1
  113. package/dist/core/rollback.d.ts.map +1 -1
  114. package/dist/core/rollback.js +13 -90
  115. package/dist/core/rollback.js.map +1 -1
  116. package/dist/core/session-manager.d.ts +0 -1
  117. package/dist/core/session-manager.d.ts.map +1 -1
  118. package/dist/core/session-manager.js +21 -79
  119. package/dist/core/session-manager.js.map +1 -1
  120. package/dist/core/settings-manager.d.ts +6 -0
  121. package/dist/core/settings-manager.d.ts.map +1 -1
  122. package/dist/core/settings-manager.js +19 -0
  123. package/dist/core/settings-manager.js.map +1 -1
  124. package/dist/dev-cli.js +0 -0
  125. package/dist/gateway/agent-bridge.d.ts +6 -1
  126. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  127. package/dist/gateway/agent-bridge.js +23 -6
  128. package/dist/gateway/agent-bridge.js.map +1 -1
  129. package/dist/gateway/cron.d.ts +1 -1
  130. package/dist/gateway/cron.d.ts.map +1 -1
  131. package/dist/gateway/cron.js +23 -7
  132. package/dist/gateway/cron.js.map +1 -1
  133. package/dist/modes/interactive/components/footer.d.ts +4 -2
  134. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  135. package/dist/modes/interactive/components/footer.js +23 -32
  136. package/dist/modes/interactive/components/footer.js.map +1 -1
  137. package/dist/modes/interactive/components/processes-selector.d.ts +2 -3
  138. package/dist/modes/interactive/components/processes-selector.d.ts.map +1 -1
  139. package/dist/modes/interactive/components/processes-selector.js +5 -10
  140. package/dist/modes/interactive/components/processes-selector.js.map +1 -1
  141. package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
  142. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  143. package/dist/modes/interactive/components/settings-selector.js +20 -0
  144. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  145. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  146. package/dist/modes/interactive/interactive-mode.js +18 -8
  147. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  148. package/dist/modes/interactive/thinking-level-slash.d.ts +4 -0
  149. package/dist/modes/interactive/thinking-level-slash.d.ts.map +1 -0
  150. package/dist/modes/interactive/thinking-level-slash.js +23 -0
  151. package/dist/modes/interactive/thinking-level-slash.js.map +1 -0
  152. package/dist/node-runtime/adapter-AZMY335J.js +279 -0
  153. package/dist/node-runtime/{agent-session-services-IFJMSX7Z.js → agent-session-services-RSGP5GDN.js} +15 -12
  154. package/dist/node-runtime/{builtin-extensions-LYZ3BFWQ.js → builtin-extensions-7STLFW3A.js} +4 -3
  155. package/dist/node-runtime/chunk-2IDTZAG5.js +1415 -0
  156. package/dist/node-runtime/{chunk-7NBZ5P7I.js → chunk-4SJWFTUP.js} +1 -1
  157. package/dist/node-runtime/{chunk-AJX357CL.js → chunk-5NWQCSKR.js} +20 -1013
  158. package/dist/node-runtime/chunk-5OLJGVCB.js +68 -0
  159. package/dist/node-runtime/chunk-5Q45AVQG.js +108 -0
  160. package/dist/node-runtime/{chunk-TQNSPERU.js → chunk-5SQDLSZJ.js} +1 -1
  161. package/dist/node-runtime/{chunk-F4VQFJI2.js → chunk-6SPPH4FY.js} +4 -4
  162. package/dist/node-runtime/{chunk-PBC2Y6GS.js → chunk-6UB6NKA3.js} +29 -72
  163. package/dist/node-runtime/{chunk-A2KQXUJD.js → chunk-7AFOFSDY.js} +1 -1
  164. package/dist/node-runtime/chunk-BKAZ6BKX.js +2185 -0
  165. package/dist/node-runtime/{chunk-AHSTJBIB.js → chunk-EH2LJQPM.js} +4 -4
  166. package/dist/node-runtime/{chunk-N77MY65L.js → chunk-FLYMHKCS.js} +25 -25
  167. package/dist/node-runtime/{chunk-5P7PZMRU.js → chunk-HRS4HMDX.js} +1 -1
  168. package/dist/node-runtime/{chunk-IPA627GP.js → chunk-ISQDQIZN.js} +4 -4
  169. package/dist/node-runtime/{chunk-WJVFOIB5.js → chunk-J7QGQD45.js} +1 -1
  170. package/dist/node-runtime/{chunk-WOVTOV5P.js → chunk-JT6YCS5B.js} +29 -34
  171. package/dist/node-runtime/chunk-JZHEUQRL.js +180 -0
  172. package/dist/node-runtime/{chunk-ZKMFUD3Q.js → chunk-K72NVGUB.js} +3 -3
  173. package/dist/node-runtime/{chunk-ECD5L7YI.js → chunk-LCACDWHJ.js} +389 -15
  174. package/dist/node-runtime/{chunk-2QKLKMKC.js → chunk-LTXUQJI4.js} +1 -1
  175. package/dist/node-runtime/{chunk-MKKH27PH.js → chunk-LWJXTA6Z.js} +274 -2416
  176. package/dist/node-runtime/{chunk-EDBJNRSM.js → chunk-MGSB2C3M.js} +1 -1
  177. package/dist/node-runtime/{chunk-CDFZEWPU.js → chunk-MUMMMTW4.js} +6 -2
  178. package/dist/node-runtime/{chunk-YF63P5ZT.js → chunk-OTT6JMPU.js} +10 -67
  179. package/dist/node-runtime/{chunk-PGAJ5MO5.js → chunk-T5GM5BFH.js} +1 -1
  180. package/dist/node-runtime/{chunk-PCGNAY2O.js → chunk-TAP7QTUT.js} +38 -16
  181. package/dist/node-runtime/{chunk-4TLO4PO2.js → chunk-U6C7VTR5.js} +7 -1401
  182. package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
  183. package/dist/node-runtime/{chunk-QH42CDX3.js → chunk-W7S2REEG.js} +111 -84
  184. package/dist/node-runtime/{chunk-LZAW4ZX3.js → chunk-ZRDIMBEQ.js} +27 -9
  185. package/dist/node-runtime/{chunk-AD6VXAO7.js → chunk-ZSEZY3II.js} +5 -100
  186. package/dist/node-runtime/cli-runtime.js +1 -1
  187. package/dist/node-runtime/{command-L3LAHDIH.js → command-6UXQ6XZN.js} +1 -1
  188. package/dist/node-runtime/{commands-RL5YBW5I.js → commands-LGR5VT5X.js} +6 -4
  189. package/dist/node-runtime/{direct-tool-executor-JVDXTO7A.js → direct-tool-executor-TDJS7TBD.js} +9 -6
  190. package/dist/node-runtime/{export-html-KR26FOUZ.js → export-html-E4DT6ZJQ.js} +1 -1
  191. package/dist/node-runtime/{extract-XLQSJN4V.js → extract-IUCVZCWC.js} +2 -2
  192. package/dist/node-runtime/{gateway-X2TI5X7F.js → gateway-3OLC4GQN.js} +22 -367
  193. package/dist/node-runtime/{gemini-search-U7SUMPQA.js → gemini-search-NCIDF7NE.js} +1 -1
  194. package/dist/node-runtime/{gemini-url-context-PXWCBQHK.js → gemini-url-context-OKIN7AIP.js} +2 -2
  195. package/dist/node-runtime/image-resize-6ZPBFMWW.js +11 -0
  196. package/dist/node-runtime/index.js +53 -49
  197. package/dist/node-runtime/{init-NJV2T55N.js → init-EKE277AG.js} +6 -4
  198. package/dist/node-runtime/{interactive-mode-KOM35YF2.js → interactive-mode-S5M26CQ7.js} +20 -17
  199. package/dist/node-runtime/{interactive-view-U6OILKF3.js → interactive-view-N6F4KUIT.js} +3 -5
  200. package/dist/node-runtime/lunr-computer-use-4X3KUNF4.js +206 -0
  201. package/dist/node-runtime/{lunr-cron-YJ5UHYRD.js → lunr-cron-KKBOGAEF.js} +7 -1
  202. package/dist/node-runtime/main.js +24 -21
  203. package/dist/node-runtime/{mcp-auth-flow-QIXHW6QN.js → mcp-auth-flow-YL6RWPYG.js} +2 -1
  204. package/dist/node-runtime/{package-manager-cli-TZZHJCVI.js → package-manager-cli-C4EJOO5Q.js} +8 -6
  205. package/dist/node-runtime/{pi-mcp-adapter-QFB37AVN.js → pi-mcp-adapter-DPTJGAAL.js} +33 -27
  206. package/dist/node-runtime/{pi-subagents-7XJ4H53P.js → pi-subagents-VKCLYIBY.js} +103 -76
  207. package/dist/node-runtime/{pi-web-access-DPGAVKOA.js → pi-web-access-BV6DSZOP.js} +72 -69
  208. package/dist/node-runtime/{proxy-modes-HEEFK4KC.js → proxy-modes-R64LU6WZ.js} +12 -9
  209. package/dist/node-runtime/rpc-entry.js +24 -21
  210. package/dist/node-runtime/runtime-3SB5ATHQ.js +21 -0
  211. package/dist/node-runtime/{runtime-bridges-PPHNBFWL.js → runtime-bridges-UJ5WJJLN.js} +3 -3
  212. package/dist/node-runtime/{session-manager-MQNBYACL.js → session-manager-QEMZBMTM.js} +3 -5
  213. package/dist/node-runtime/{session-selector-5AZLJS6U.js → session-selector-URVJLOTK.js} +2 -2
  214. package/dist/node-runtime/{settings-manager-5LF2VQWC.js → settings-manager-K6IPIQTI.js} +3 -1
  215. package/dist/node-runtime/{src-Y7JSCK64.js → src-GPFAU3N6.js} +30 -10
  216. package/dist/node-runtime/{subagent-executor-5RNDEPIJ.js → subagent-executor-EFLTO32A.js} +39 -21
  217. package/dist/node-runtime/{update-cli-A253SZ7P.js → update-cli-I6OVDRPL.js} +3 -1
  218. package/dist/node-runtime/{video-extract-OYT5WKS5.js → video-extract-ETA5RA7U.js} +2 -2
  219. package/dist/node-runtime/workflow-SA34S4VX.js +325 -0
  220. package/dist/node-runtime/{youtube-extract-TQYKGFGS.js → youtube-extract-SRVGNN26.js} +2 -2
  221. package/dist/rpc.d.ts +3 -0
  222. package/dist/rpc.d.ts.map +1 -0
  223. package/dist/rpc.js +18 -0
  224. package/dist/rpc.js.map +1 -0
  225. package/dist/startup/interactive-view.d.ts.map +1 -1
  226. package/dist/startup/interactive-view.js +1 -2
  227. package/dist/startup/interactive-view.js.map +1 -1
  228. package/docs/computer-use.md +277 -0
  229. package/docs/development.md +0 -32
  230. package/docs/features.md +2 -2
  231. package/docs/interactive-startup.md +10 -3
  232. package/docs/keybindings.md +2 -2
  233. package/docs/terminal-setup.md +1 -1
  234. package/docs/usage.md +1 -1
  235. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  236. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  237. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  238. package/examples/extensions/gondolin/package-lock.json +2 -2
  239. package/examples/extensions/gondolin/package.json +1 -1
  240. package/examples/extensions/hidden-thinking-label.ts +1 -1
  241. package/examples/extensions/sandbox/package-lock.json +2 -2
  242. package/examples/extensions/sandbox/package.json +1 -1
  243. package/examples/extensions/with-deps/package-lock.json +2 -2
  244. package/examples/extensions/with-deps/package.json +1 -1
  245. package/install-lock/package-lock.json +3827 -0
  246. package/install-lock/package.json +18 -0
  247. package/native/computer-use/LICENSE.md +21 -0
  248. package/npm-shrinkwrap.json +3808 -0
  249. package/package.json +16 -10
  250. package/dist/startup/interactive-shell.d.ts +0 -55
  251. package/dist/startup/interactive-shell.d.ts.map +0 -1
  252. package/dist/startup/interactive-shell.js +0 -264
  253. package/dist/startup/interactive-shell.js.map +0 -1
  254. package/dist/node-runtime/{chunk-YSKSB3BJ.js → chunk-CH6OL6P2.js} +2 -2
  255. package/dist/node-runtime/{chunk-VSELYKWU.js → chunk-EHMBW7FA.js} +3 -3
@@ -11,9 +11,9 @@ import {
11
11
  resolveDirectTools,
12
12
  throwIfAborted,
13
13
  truncateAtWord
14
- } from "./chunk-VSELYKWU.js";
15
- import "./chunk-4HXHDDCF.js";
14
+ } from "./chunk-EHMBW7FA.js";
16
15
  import "./chunk-ARC4KOTI.js";
16
+ import "./chunk-4HXHDDCF.js";
17
17
  import "./chunk-BRJX2PRC.js";
18
18
 
19
19
  // packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/index.js
@@ -117,41 +117,47 @@ function shouldBackgroundAutostart(config, cache) {
117
117
  return process.env.MCP_DIRECT_TOOLS === "__none__" ? !1 : getMissingConfiguredDirectToolServers(config, cache).length > 0;
118
118
  }
119
119
  function mcpAdapter(pi) {
120
- let state = null, initPromise = null, lifecycleGeneration = 0, sessionAbort = new AbortController(), initializingStates = /* @__PURE__ */ new Set(), heavyModules = null, heavyModulesPromise = null, directExecutors = /* @__PURE__ */ new Map();
120
+ let state = null, initPromise = null, lifecycleGeneration = 0, sessionAbort = new AbortController(), initializingStates = /* @__PURE__ */ new Set(), shutdownPromises = /* @__PURE__ */ new WeakMap(), heavyModules = null, heavyModulesPromise = null, directExecutors = /* @__PURE__ */ new Map();
121
121
  function loadHeavyModules() {
122
122
  return heavyModules ? Promise.resolve(heavyModules) : (heavyModulesPromise || (heavyModulesPromise = (async () => {
123
123
  let [init, authFlow, commands, proxyModes, directToolExecutor] = await Promise.all([
124
- import("./init-NJV2T55N.js"),
125
- import("./mcp-auth-flow-QIXHW6QN.js"),
126
- import("./commands-RL5YBW5I.js"),
127
- import("./proxy-modes-HEEFK4KC.js"),
128
- import("./direct-tool-executor-JVDXTO7A.js")
124
+ import("./init-EKE277AG.js"),
125
+ import("./mcp-auth-flow-YL6RWPYG.js"),
126
+ import("./commands-LGR5VT5X.js"),
127
+ import("./proxy-modes-R64LU6WZ.js"),
128
+ import("./direct-tool-executor-TDJS7TBD.js")
129
129
  ]), loaded = { init, authFlow, commands, proxyModes, directToolExecutor };
130
130
  return heavyModules = loaded, loaded;
131
131
  })().catch((error) => {
132
132
  throw heavyModulesPromise = null, error;
133
133
  })), heavyModulesPromise);
134
134
  }
135
- async function shutdownState(currentState, reason) {
135
+ function shutdownState(currentState, reason) {
136
136
  if (!currentState)
137
- return;
138
- currentState.uiServer && (currentState.uiServer.close(reason), currentState.uiServer = null);
139
- let flushError;
140
- try {
141
- heavyModules && heavyModules.init.flushMetadataCache(currentState);
142
- } catch (error) {
143
- flushError = error;
144
- }
145
- try {
146
- await currentState.lifecycle.gracefulShutdown();
147
- } catch (error) {
137
+ return Promise.resolve();
138
+ let existing = shutdownPromises.get(currentState);
139
+ if (existing)
140
+ return existing;
141
+ let shutdown = (async () => {
142
+ currentState.uiServer && (currentState.uiServer.close(reason), currentState.uiServer = null);
143
+ let flushError;
144
+ try {
145
+ heavyModules && heavyModules.init.flushMetadataCache(currentState);
146
+ } catch (error) {
147
+ flushError = error;
148
+ }
149
+ try {
150
+ await currentState.lifecycle.gracefulShutdown();
151
+ } catch (error) {
152
+ if (flushError)
153
+ console.error("MCP: graceful shutdown failed after metadata flush error", error);
154
+ else
155
+ throw error;
156
+ }
148
157
  if (flushError)
149
- console.error("MCP: graceful shutdown failed after metadata flush error", error);
150
- else
151
- throw error;
152
- }
153
- if (flushError)
154
- throw flushError;
158
+ throw flushError;
159
+ })();
160
+ return shutdownPromises.set(currentState, shutdown), shutdown;
155
161
  }
156
162
  async function shutdownInitializingStates() {
157
163
  let pending = [...initializingStates];
@@ -178,7 +184,7 @@ function mcpAdapter(pi) {
178
184
  });
179
185
  return partial || (partial = initialized, initializingStates.add(initialized)), throwIfAborted(signal), initialized;
180
186
  } catch (error) {
181
- throw partial && initializingStates.delete(partial) && await shutdownState(partial, "initialization_failed"), error;
187
+ throw partial && (initializingStates.delete(partial), await shutdownState(partial, "initialization_failed")), error;
182
188
  } finally {
183
189
  partial && initializingStates.delete(partial);
184
190
  }
@@ -82,16 +82,18 @@ import {
82
82
  validateExecutionAcceptance,
83
83
  validateToolBudgetConfig,
84
84
  writeAtomicJson
85
- } from "./chunk-CDFZEWPU.js";
86
- import "./chunk-EDBJNRSM.js";
87
- import "./chunk-ZKMFUD3Q.js";
88
- import "./chunk-AD6VXAO7.js";
89
- import "./chunk-LZAW4ZX3.js";
90
- import "./chunk-M3LZLQW2.js";
85
+ } from "./chunk-MUMMMTW4.js";
86
+ import "./chunk-MGSB2C3M.js";
87
+ import "./chunk-K72NVGUB.js";
91
88
  import "./chunk-53YJI7JU.js";
92
89
  import "./chunk-GZQHMEWL.js";
93
90
  import "./chunk-ZCHMJ34K.js";
91
+ import "./chunk-5Q45AVQG.js";
92
+ import "./chunk-ZRDIMBEQ.js";
93
+ import "./chunk-M3LZLQW2.js";
94
+ import "./chunk-5OLJGVCB.js";
94
95
  import "./chunk-FVDOXRUD.js";
96
+ import "./chunk-ZSEZY3II.js";
95
97
  import "./chunk-RQ2Q5IYR.js";
96
98
  import {
97
99
  keyText
@@ -354,8 +356,11 @@ function widgetJobsRunningSeed(jobs) {
354
356
  seed = runningSeed(seed, widgetJobRunningSeed(job));
355
357
  return seed;
356
358
  }
357
- function widgetStatusGlyph(job, theme) {
358
- return job.status === "running" ? theme.fg("accent", runningGlyph(widgetJobRunningSeed(job))) : job.status === "queued" ? theme.fg("muted", "\u25E6") : job.status === "complete" ? theme.fg("success", "\u2713") : job.status === "paused" || job.status === "stopped" ? theme.fg("warning", "\u25A0") : theme.fg("error", "\u2717");
359
+ function widgetAnimFrame(now = Date.now()) {
360
+ return Math.floor(now / 80) % RUNNING_FRAMES.length;
361
+ }
362
+ function widgetStatusGlyph(job, theme, now = Date.now()) {
363
+ return job.status === "running" ? theme.fg("accent", runningGlyph((widgetJobRunningSeed(job) ?? 0) + widgetAnimFrame(now))) : job.status === "queued" ? theme.fg("muted", "\u25E6") : job.status === "complete" ? theme.fg("success", "\u2713") : job.status === "paused" || job.status === "stopped" ? theme.fg("warning", "\u25A0") : theme.fg("error", "\u2717");
359
364
  }
360
365
  function widgetStepGlyph(status, theme, seed) {
361
366
  return status === "running" ? theme.fg("accent", runningGlyph(seed)) : status === "complete" || status === "completed" ? theme.fg("success", "\u2713") : status === "failed" ? theme.fg("error", "\u2717") : status === "paused" || status === "stopped" ? theme.fg("warning", "\u25A0") : theme.fg("muted", "\u25E6");
@@ -659,42 +664,33 @@ function foregroundStyleWidgetStepLines(job, theme, step, itemTitle, index, tota
659
664
  }
660
665
  return lines;
661
666
  }
662
- function foregroundStyleWidgetDetails(job, theme, expanded, width) {
663
- if (!job.steps?.length)
664
- return [
665
- ` ${theme.fg("dim", `\u23BF ${widgetActivity(job)}`)}`,
666
- ...formatNestedWidgetLines(job.nestedChildren, theme, width, expanded, job.updatedAt).map((line) => ` ${line}`)
667
- ];
668
- if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length)
669
- return widgetChainDetails(job, theme, expanded, width);
670
- let total = job.stepsTotal ?? job.steps.length, itemTitle = job.mode === "parallel" || job.activeParallelGroup ? "Agent" : "Step", lines = [];
671
- for (let [index, step] of job.steps.entries())
672
- lines.push(...foregroundStyleWidgetStepLines(job, theme, step, itemTitle, index + 1, total, expanded, width));
673
- let attached = new Set(job.steps.flatMap((step) => step.children?.map((child) => child.id) ?? [])), unattached = job.nestedChildren?.filter((child) => !attached.has(child.id)) ?? [];
674
- for (let nestedLine of formatNestedWidgetLines(unattached, theme, width, expanded, job.updatedAt))
675
- lines.push(` ${nestedLine}`);
676
- return lines;
667
+ function compactJobProgress(job, step, now = Date.now()) {
668
+ let running = (step?.status ?? job.status) === "running", startedAt = step?.startedAt ?? job.startedAt, endedAt = running ? now : step?.endedAt ?? step?.lastActivityAt ?? job.updatedAt ?? now, durationMs = step?.durationMs !== void 0 ? step.durationMs : startedAt !== void 0 ? Math.max(0, endedAt - startedAt) : 0;
669
+ return {
670
+ toolCount: step?.toolCount ?? job.toolCount ?? 0,
671
+ tokens: step?.tokens?.total ?? job.totalTokens?.total ?? 0,
672
+ durationMs
673
+ };
674
+ }
675
+ function compactJobLead(job, step) {
676
+ return compactRowLead({
677
+ description: step?.description ?? step?.agent ?? job.agents?.[0],
678
+ task: step?.description ?? step?.agent
679
+ }) || widgetJobName(job);
677
680
  }
678
- function buildSingleWidgetLines(job, theme, width, expanded) {
679
- let stats = widgetStats(job, theme), count = job.mode === "chain" ? job.chainStepCount : job.stepsTotal ?? job.agents?.length ?? job.steps?.length, mode = widgetJobName(job), title = `async subagent ${mode}${count && count > 1 ? ` (${count})` : ""}`;
681
+ function compactJobLines(job, step, theme, width, now = Date.now()) {
682
+ let running = (step?.status ?? job.status) === "running", lead = compactJobLead(job, step), modelBadge = formatModelSelection(step?.modelSelection, step?.model, step?.thinking), permissionBadge = step?.permissions ? theme.fg("dim", step.permissions) : "", glyph = step ? widgetStepGlyph(step.status, theme, running ? (widgetStepRunningSeed(step, step.index) ?? 0) + widgetAnimFrame(now) : widgetStepRunningSeed(step, step.index)) : widgetStatusGlyph(job, theme, now), hang = formatCompactStatsHangLine(compactJobProgress(job, step, now), width, (s) => theme.fg("dim", s), " \u23BF ", now, running);
680
683
  return [
681
- `${theme.fg("toolTitle", themeBold(theme, title))} ${theme.fg("dim", "\xB7 background")}`,
682
- `${widgetStatusGlyph(job, theme)} ${themeBold(theme, mode)}${stats ? ` ${theme.fg("dim", "\xB7")} ${stats}` : ""}`,
683
- ...foregroundStyleWidgetDetails(job, theme, expanded, width)
684
- ].map((line) => truncLine(line, width));
684
+ truncLine(`${glyph} ${themeBold(theme, lead)}${modelBadge ? ` ${theme.fg("dim", "\xB7")} ${theme.fg("dim", modelBadge)}` : ""}${permissionBadge ? ` ${theme.fg("dim", "\xB7")} ${permissionBadge}` : ""}`, width),
685
+ hang
686
+ ];
687
+ }
688
+ function buildSingleWidgetLines(job, theme, width, _expanded) {
689
+ let now = Date.now(), steps = job.steps ?? [];
690
+ return steps.length <= 1 ? compactJobLines(job, steps[0], theme, width, now) : steps.flatMap((step) => compactJobLines(job, step, theme, width, now));
685
691
  }
686
692
  function compactSingleWidgetLines(job, theme, width) {
687
- let fullLines = buildSingleWidgetLines(job, theme, width, !1);
688
- if (fullLines.length <= 10 || !job.steps?.length || job.mode !== "parallel" && !job.activeParallelGroup)
689
- return fullLines;
690
- let total = job.stepsTotal ?? job.steps.length, itemTitle = job.mode === "parallel" || job.activeParallelGroup ? "Agent" : "Step", lines = fullLines.slice(0, 2);
691
- for (let [index, step] of job.steps.entries()) {
692
- let status = widgetStepStatus(step.status, theme), activity = widgetStepActivityLine(step, width, !1, job.updatedAt), stepStats = widgetStepStats(theme, step), activitySuffix = activity ? ` ${theme.fg("dim", "\xB7")} ${theme.fg("dim", activity)}` : "", modelDisplay = modelThinkingBadge(theme, step.model, step.thinking, step.modelSelection);
693
- lines.push(` ${widgetStepGlyph(step.status, theme, widgetStepRunningSeed(step, index))} ${itemTitle} ${index + 1}/${total}: ${themeBold(theme, step.agent)} ${theme.fg("dim", "\xB7")} ${status}${modelDisplay}${activitySuffix}${stepStats ? ` ${theme.fg("dim", "\xB7")} ${stepStats}` : ""}`);
694
- for (let nestedLine of formatNestedWidgetLines(step.children, theme, width, !1, job.updatedAt))
695
- lines.push(` ${nestedLine}`);
696
- }
697
- return job.steps.some((step) => step.status === "running") && lines.push(theme.fg("accent", ` ${liveDetailHintText()}`)), lines.map((line) => truncLine(line, width));
693
+ return buildSingleWidgetLines(job, theme, width, !1);
698
694
  }
699
695
  var RESERVED_NON_WIDGET_ROWS = 19, widgetLayoutSession;
700
696
  function resetWidgetLayoutSession() {
@@ -882,12 +878,25 @@ function buildWidgetLines(jobs, theme, width = getTermWidth(), expanded = !1) {
882
878
  }
883
879
  return lines;
884
880
  }
881
+ var widgetPaintTimer, widgetPaintCtx;
882
+ function clearWidgetPaintTimer() {
883
+ widgetPaintTimer && (clearInterval(widgetPaintTimer), widgetPaintTimer = void 0), widgetPaintCtx = void 0;
884
+ }
885
+ function ensureWidgetPaintTimer(ctx, running) {
886
+ if (widgetPaintCtx = ctx, !running || !ctx.hasUI) {
887
+ clearWidgetPaintTimer();
888
+ return;
889
+ }
890
+ widgetPaintTimer || (widgetPaintTimer = setInterval(() => {
891
+ widgetPaintCtx?.ui.requestRender?.();
892
+ }, 80), widgetPaintTimer.unref?.());
893
+ }
885
894
  function renderWidget(ctx, jobs) {
886
895
  if (jobs.length === 0) {
887
- resetWidgetLayoutSession(), ctx.hasUI && ctx.ui.setWidget(WIDGET_KEY, void 0);
896
+ resetWidgetLayoutSession(), clearWidgetPaintTimer(), ctx.hasUI && ctx.ui.setWidget(WIDGET_KEY, void 0);
888
897
  return;
889
898
  }
890
- ctx.hasUI && ctx.ui.setWidget(WIDGET_KEY, buildWidgetComponent(jobs, ctx.ui.getToolsExpanded?.() ?? !1));
899
+ ctx.hasUI && (ensureWidgetPaintTimer(ctx, jobs.some((job) => job.status === "running")), ctx.ui.setWidget(WIDGET_KEY, buildWidgetComponent(jobs, ctx.ui.getToolsExpanded?.() ?? !1)));
891
900
  }
892
901
  function renderSingleCompact(d, r, theme, frame) {
893
902
  let output = r.truncation?.text || getSingleResultOutput(r), progress = r.progress || r.progressSummary, isRunning = r.progress?.status === "running", contextBadge = d.context === "fork" ? theme.fg("warning", " [fork]") : "", c = new Container(), width = getTermWidth() - 4, lead = compactRowLead({ description: r.description ?? r.agent, task: r.task }), modelBadge = formatModelSelection(r.modelSelection ?? progress?.modelSelection, r.model ?? progress?.model, r.thinking ?? progress?.thinking), permissionBadge = r.permissions ? theme.fg("dim", r.permissions) : "";
@@ -1056,7 +1065,7 @@ function pruneNestedDescriptions(value, path12) {
1056
1065
  let result2 = Array.isArray(value) ? [] : Object.create(Object.getPrototypeOf(value));
1057
1066
  for (let key of Reflect.ownKeys(value)) {
1058
1067
  let descriptor = Object.getOwnPropertyDescriptor(value, key);
1059
- if (descriptor && !(key === "description" && !isTopLevelParameterDescription(path12))) {
1068
+ if (descriptor && !(key === "description" && !isPropertiesMap(path12) && !isTopLevelParameterHelpText(path12))) {
1060
1069
  if ("value" in descriptor) {
1061
1070
  let nextPath = typeof key == "string" ? [...path12, key] : path12;
1062
1071
  descriptor.value = pruneNestedDescriptions(descriptor.value, nextPath);
@@ -1066,7 +1075,10 @@ function pruneNestedDescriptions(value, path12) {
1066
1075
  }
1067
1076
  return result2;
1068
1077
  }
1069
- function isTopLevelParameterDescription(path12) {
1078
+ function isPropertiesMap(path12) {
1079
+ return path12[path12.length - 1] === "properties";
1080
+ }
1081
+ function isTopLevelParameterHelpText(path12) {
1070
1082
  return path12.length === 2 && path12[0] === "properties";
1071
1083
  }
1072
1084
  var SkillOverride = Type.Unsafe({
@@ -5238,7 +5250,7 @@ async function waitForSubagents(params, signal, deps) {
5238
5250
  }
5239
5251
 
5240
5252
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js
5241
- function registerWaitTool(pi, state, enabled = resolveWaitToolConfig().enabled) {
5253
+ function registerWaitTool(pi, state, enabled = resolveWaitToolConfig().enabled, waitForPendingLaunches) {
5242
5254
  let tool = {
5243
5255
  name: "subagent_wait",
5244
5256
  label: "Subagent Wait",
@@ -5255,8 +5267,8 @@ Provider jobs are session-scoped and identified exactly, so replacing one job wi
5255
5267
 
5256
5268
  Configured behavior: subagent_wait is disabled by config.waitTool or PI_SUBAGENT_WAIT_TOOL_ENABLED and returns immediately without blocking.`}`,
5257
5269
  parameters: SubagentWaitParams,
5258
- execute(_id, params, signal) {
5259
- return waitForSubagents(params, signal, { state, events: pi.events, enabled });
5270
+ async execute(_id, params, signal) {
5271
+ return await Promise.resolve(), await waitForPendingLaunches?.(signal), signal?.throwIfAborted(), waitForSubagents(params, signal, { state, events: pi.events, enabled });
5260
5272
  }
5261
5273
  };
5262
5274
  pi.registerTool(tool);
@@ -5832,8 +5844,8 @@ function registerSubagentExtension(pi) {
5832
5844
  }
5833
5845
  }, supervisorChannel = createNativeSupervisorChannel(pi, state), mainWatchdog = registerMainWatchdog(pi), { startResultWatcher, primeExistingResults, stopResultWatcher } = createResultWatcher(pi, state, RESULTS_DIR, 600 * 1e3);
5834
5846
  startResultWatcher(), primeExistingResults();
5835
- let generation = 0, executorPromise, runtimeCleanup = () => {
5836
- generation++, executorPromise = void 0, mainWatchdog.dispose(), stopResultWatcher(), scheduledRunManager.stop(), supervisorChannel.dispose(), clearPendingForegroundControlNotices(state), state.poller && (clearInterval(state.poller), state.poller = null);
5847
+ let generation = 0, executorPromise, pendingLaunches = /* @__PURE__ */ new Set(), runtimeCleanup = () => {
5848
+ generation++, executorPromise = void 0, pendingLaunches.clear(), mainWatchdog.dispose(), stopResultWatcher(), scheduledRunManager.stop(), supervisorChannel.dispose(), clearPendingForegroundControlNotices(state), state.poller && (clearInterval(state.poller), state.poller = null);
5837
5849
  };
5838
5850
  globalStore[runtimeCleanupStoreKey] = runtimeCleanup;
5839
5851
  let { ensurePoller, refreshWidget, handleStarted, handleComplete, resetJobs, restoreActiveJobs } = createAsyncJobTracker(pi, state, ASYNC_DIR, {
@@ -5847,32 +5859,43 @@ function registerSubagentExtension(pi) {
5847
5859
  })
5848
5860
  }), executor = {
5849
5861
  async execute(id, params, signal, onUpdate, ctx) {
5850
- let currentGeneration = generation;
5851
- if (signal?.throwIfAborted(), !executorPromise) {
5852
- let pending = import("./subagent-executor-5RNDEPIJ.js").then(({ createSubagentExecutor }) => {
5853
- if (generation !== currentGeneration)
5854
- throw new Error("Subagent session changed before initialization");
5855
- return createSubagentExecutor({
5856
- pi,
5857
- state,
5858
- config,
5859
- asyncByDefault,
5860
- waitToolEnabled: waitToolConfig.enabled,
5861
- handleScheduledRunAction: (params2, ctx2) => scheduledRunManager.handleToolCall(params2, ctx2),
5862
- watchdog: mainWatchdog,
5863
- tempArtifactsDir,
5864
- getSubagentSessionRoot,
5865
- expandTilde
5862
+ let resolveLaunchReady, launchReady = !1, launchReadyPromise = new Promise((resolve3) => {
5863
+ resolveLaunchReady = resolve3;
5864
+ }), markLaunchReady = () => {
5865
+ launchReady || (launchReady = !0, pendingLaunches.delete(launchReadyPromise), resolveLaunchReady());
5866
+ };
5867
+ pendingLaunches.add(launchReadyPromise);
5868
+ try {
5869
+ let currentGeneration = generation;
5870
+ if (signal?.throwIfAborted(), !executorPromise) {
5871
+ let pending = import("./subagent-executor-EFLTO32A.js").then(({ createSubagentExecutor }) => {
5872
+ if (generation !== currentGeneration)
5873
+ throw new Error("Subagent session changed before initialization");
5874
+ return createSubagentExecutor({
5875
+ pi,
5876
+ state,
5877
+ config,
5878
+ asyncByDefault,
5879
+ waitToolEnabled: waitToolConfig.enabled,
5880
+ handleScheduledRunAction: (params2, ctx2) => scheduledRunManager.handleToolCall(params2, ctx2),
5881
+ watchdog: mainWatchdog,
5882
+ tempArtifactsDir,
5883
+ getSubagentSessionRoot,
5884
+ expandTilde
5885
+ });
5866
5886
  });
5867
- });
5868
- executorPromise = pending, pending.catch(() => {
5869
- executorPromise === pending && (executorPromise = void 0);
5870
- });
5887
+ executorPromise = pending, pending.catch(() => {
5888
+ executorPromise === pending && (executorPromise = void 0);
5889
+ });
5890
+ }
5891
+ let ready = await awaitWithAbort(executorPromise, signal);
5892
+ if (signal?.throwIfAborted(), generation !== currentGeneration)
5893
+ throw new Error("Subagent session changed before execution");
5894
+ let execution = ready.execute(id, params, signal, onUpdate, ctx);
5895
+ return markLaunchReady(), await execution;
5896
+ } finally {
5897
+ markLaunchReady();
5871
5898
  }
5872
- let ready = await awaitWithAbort(executorPromise, signal);
5873
- if (signal?.throwIfAborted(), generation !== currentGeneration)
5874
- throw new Error("Subagent session changed before execution");
5875
- return ready.execute(id, params, signal, onUpdate, ctx);
5876
5899
  }
5877
5900
  };
5878
5901
  executorExecute = executor.execute, pi.registerMessageRenderer(SLASH_RESULT_TYPE, (message, options, theme) => {
@@ -5950,7 +5973,11 @@ function registerSubagentExtension(pi) {
5950
5973
  };
5951
5974
  pi.registerTool(tool), globalThis[/* @__PURE__ */ Symbol.for("@lunr/model-tiers")]?.registerToolDescriptionRefresher?.(() => {
5952
5975
  tool.description = buildSubagentToolDescription(config), pi.registerTool(tool);
5953
- }), registerWaitTool(pi, state, waitToolConfig.enabled), pi.on("agent_end", async (_event, ctx) => {
5976
+ }), registerWaitTool(pi, state, waitToolConfig.enabled, async (signal) => {
5977
+ let launches = [...pendingLaunches];
5978
+ launches.length !== 0 && await awaitWithAbort(Promise.all(launches).then(() => {
5979
+ }), signal);
5980
+ }), pi.on("agent_end", async (_event, ctx) => {
5954
5981
  ctx.hasUI || await drainOutstandingWork({ state, events: pi.events });
5955
5982
  }), registerSlashCommands(pi, state);
5956
5983
  let eventUnsubscribeStoreKey = "__piSubagentEventUnsubscribes", controlNoticeSeenStoreKey = "__piSubagentVisibleControlNotices", previousEventUnsubscribes = globalStore[eventUnsubscribeStoreKey];
@@ -5991,7 +6018,7 @@ function registerSubagentExtension(pi) {
5991
6018
  } catch {
5992
6019
  }
5993
6020
  }, resetSessionState = (ctx) => {
5994
- if (generation++, executorPromise = void 0, state.baseCwd = ctx.cwd, state.currentSessionId = resolveCurrentSessionId(ctx.sessionManager), state.subagentSpawns = { sessionId: state.currentSessionId, count: 0 }, !process.env[SUBAGENT_CHILD_ENV]) {
6021
+ if (generation++, executorPromise = void 0, pendingLaunches.clear(), state.baseCwd = ctx.cwd, state.currentSessionId = resolveCurrentSessionId(ctx.sessionManager), state.subagentSpawns = { sessionId: state.currentSessionId, count: 0 }, !process.env[SUBAGENT_CHILD_ENV]) {
5995
6022
  let sessionId = ctx.sessionManager.getSessionId();
5996
6023
  sessionId && (process.env[SUBAGENT_PARENT_SESSION_ENV] = sessionId);
5997
6024
  }
@@ -6000,7 +6027,7 @@ function registerSubagentExtension(pi) {
6000
6027
  pi.on("session_start", (_event, ctx) => {
6001
6028
  resetSessionState(ctx), rpcBridge.emitReady(ctx), supervisorChannel.start();
6002
6029
  }), pi.on("session_shutdown", () => {
6003
- generation++, executorPromise = void 0, delete process.env[SUBAGENT_PARENT_SESSION_ENV];
6030
+ generation++, executorPromise = void 0, pendingLaunches.clear(), delete process.env[SUBAGENT_PARENT_SESSION_ENV];
6004
6031
  for (let unsubscribe of eventUnsubscribes)
6005
6032
  try {
6006
6033
  unsubscribe();
@@ -2,6 +2,10 @@ import { createRequire as __lunrRequire } from "node:module"; const require = __
2
2
  import {
3
3
  runSessionCleanups
4
4
  } from "./chunk-AUXVGBO4.js";
5
+ import {
6
+ loadEnabledModelPatterns,
7
+ modelMatchesEnabledPatterns
8
+ } from "./chunk-4ZWGEEAS.js";
5
9
  import {
6
10
  isBrowserCookieAccessAllowed
7
11
  } from "./chunk-DMMTJQMQ.js";
@@ -18,7 +22,7 @@ import {
18
22
  loadPerplexity,
19
23
  loadSummaryReview,
20
24
  loadTavily
21
- } from "./chunk-7NBZ5P7I.js";
25
+ } from "./chunk-4SJWFTUP.js";
22
26
  import {
23
27
  activityMonitor
24
28
  } from "./chunk-DAPBPCBP.js";
@@ -26,10 +30,6 @@ import {
26
30
  getWebSearchConfigDir,
27
31
  getWebSearchConfigPath
28
32
  } from "./chunk-VRB2IYGG.js";
29
- import {
30
- loadEnabledModelPatterns,
31
- modelMatchesEnabledPatterns
32
- } from "./chunk-4ZWGEEAS.js";
33
33
  import {
34
34
  formatGroupedCall,
35
35
  toolGroupTree,
@@ -340,12 +340,7 @@ function resolveProvider(requested, available, options) {
340
340
  let provider = normalizeProviderInput(requested ?? loadConfig().provider ?? "auto") ?? "auto", preferOpenAI = shouldPreferOpenAI(options);
341
341
  return provider === "auto" ? firstAvailableProvider(available, preferOpenAI, "exa") : provider === "openai" && !available.openai ? firstAvailableProvider(available, !1, "openai") : provider === "brave" && !available.brave ? firstAvailableProvider(available, preferOpenAI, "brave") : provider === "parallel" && !available.parallel ? firstAvailableProvider(available, preferOpenAI, "parallel") : provider === "tavily" && !available.tavily ? firstAvailableProvider(available, preferOpenAI, "tavily") : provider === "exa" && !available.exa ? firstAvailableProvider(available, preferOpenAI, "exa") : provider === "perplexity" && !available.perplexity ? firstAvailableProvider(available, preferOpenAI, "perplexity") : provider === "gemini" && !available.gemini ? firstAvailableProvider(available, preferOpenAI, "gemini") : provider;
342
342
  }
343
- var pendingFetches = /* @__PURE__ */ new Map(), sessionActive = !1, sessionGeneration = 0, sessionAbort = new AbortController();
344
- function assertActiveRequest(generation, signal) {
345
- if (signal?.throwIfAborted(), generation !== sessionGeneration)
346
- throw new Error("Web request cancelled: session changed");
347
- }
348
- var widgetVisible = !1, widgetUnsubscribe = null, pendingCurates = /* @__PURE__ */ new Map(), activeCurators = /* @__PURE__ */ new Map(), glimpseWins = /* @__PURE__ */ new Map(), MAX_INLINE_CONTENT = 3e4;
343
+ var MAX_INLINE_CONTENT = 3e4;
349
344
  function stripThumbnails(results) {
350
345
  return results.map(({ thumbnail, frames, ...rest }) => rest);
351
346
  }
@@ -398,47 +393,6 @@ ${r.url}
398
393
  `;
399
394
  return output;
400
395
  }
401
- function abortPendingFetches() {
402
- for (let controller of pendingFetches.values())
403
- controller.abort();
404
- pendingFetches.clear();
405
- }
406
- function closeCurator(callId) {
407
- if (callId !== void 0) {
408
- let win = glimpseWins.get(callId);
409
- glimpseWins.delete(callId);
410
- try {
411
- win?.close();
412
- } catch {
413
- }
414
- pendingCurates.get(callId)?.cancel("stale"), pendingCurates.delete(callId);
415
- let curator = activeCurators.get(callId);
416
- activeCurators.delete(callId);
417
- try {
418
- curator?.close();
419
- } catch {
420
- }
421
- return;
422
- }
423
- for (let win of glimpseWins.values())
424
- try {
425
- win.close();
426
- } catch {
427
- }
428
- glimpseWins.clear();
429
- for (let pc of pendingCurates.values())
430
- try {
431
- pc.cancel("stale");
432
- } catch {
433
- }
434
- pendingCurates.clear();
435
- for (let curator of activeCurators.values())
436
- try {
437
- curator.close();
438
- } catch {
439
- }
440
- activeCurators.clear();
441
- }
442
396
  async function openInBrowser(pi, url) {
443
397
  let plat = platform(), result = plat === "darwin" ? await pi.exec("open", [url]) : plat === "win32" ? await pi.exec("cmd", ["/c", "start", "", url]) : await pi.exec("xdg-open", [url]);
444
398
  if (result.code !== 0)
@@ -501,27 +455,76 @@ function extractDomain(url) {
501
455
  return url;
502
456
  }
503
457
  }
504
- function updateWidget(ctx2) {
505
- let theme = ctx2.ui.theme, entries = activityMonitor.getEntries(), lines = [];
506
- if (lines.push(theme.fg("accent", "\u2500\u2500\u2500 Web Search Activity " + "\u2500".repeat(36))), entries.length === 0)
507
- lines.push(theme.fg("muted", " No activity yet"));
508
- else
509
- for (let e of entries)
510
- lines.push(" " + formatEntryLine(e, theme));
511
- lines.push(theme.fg("accent", "\u2500".repeat(60)));
512
- let rateInfo = activityMonitor.getRateLimitInfo(), resetMs = rateInfo.oldestTimestamp ? Math.max(0, rateInfo.oldestTimestamp + rateInfo.windowMs - Date.now()) : 0, resetSec = Math.ceil(resetMs / 1e3);
513
- lines.push(theme.fg("muted", `Rate: ${rateInfo.used}/${rateInfo.max}`) + (resetMs > 0 ? theme.fg("dim", ` (resets in ${resetSec}s)`) : "")), ctx2.ui.setWidget("web-activity", new Text(lines.join(`
514
- `), 0, 0));
515
- }
516
458
  function formatEntryLine(entry, theme) {
517
459
  let typeStr = entry.type === "api" ? "API" : "GET", target = entry.type === "api" ? `"${truncateToWidth(entry.query || "", 28, "")}"` : truncateToWidth(entry.url?.replace(/^https?:\/\//, "") || "", 30, ""), duration = entry.endTime ? `${((entry.endTime - entry.startTime) / 1e3).toFixed(1)}s` : `${((Date.now() - entry.startTime) / 1e3).toFixed(1)}s`, statusStr, indicator;
518
460
  return entry.error ? (statusStr = "err", indicator = theme.fg("error", "\u2717")) : entry.status === null ? (statusStr = "...", indicator = theme.fg("warning", "\u22EF")) : entry.status === 0 ? (statusStr = "abort", indicator = theme.fg("muted", "\u25CB")) : (statusStr = String(entry.status), indicator = entry.status >= 200 && entry.status < 300 ? theme.fg("success", "\u2713") : theme.fg("error", "\u2717")), `${typeStr.padEnd(4)} ${target.padEnd(32)} ${statusStr.padStart(5)} ${duration.padStart(5)} ${indicator}`;
519
461
  }
520
- function handleSessionChange(ctx2) {
521
- sessionGeneration++, sessionAbort.abort(), sessionAbort = new AbortController(), abortPendingFetches(), closeCurator(), runSessionCleanups(), sessionActive = !0, restoreFromSession(ctx2), widgetUnsubscribe?.(), widgetUnsubscribe = null, activityMonitor.clear(), widgetVisible && (widgetUnsubscribe = activityMonitor.onUpdate(() => updateWidget(ctx2)), updateWidget(ctx2));
522
- }
523
462
  function pi_web_access_default(pi) {
524
- let initConfig = loadConfigForExtensionInit(), curateKey = initConfig.shortcuts?.curate || DEFAULT_SHORTCUTS.curate, activityKey = initConfig.shortcuts?.activity || DEFAULT_SHORTCUTS.activity, warmSummaryReview = null;
463
+ let initConfig = loadConfigForExtensionInit(), curateKey = initConfig.shortcuts?.curate || DEFAULT_SHORTCUTS.curate, activityKey = initConfig.shortcuts?.activity || DEFAULT_SHORTCUTS.activity, pendingFetches = /* @__PURE__ */ new Map(), pendingCurates = /* @__PURE__ */ new Map(), activeCurators = /* @__PURE__ */ new Map(), glimpseWins = /* @__PURE__ */ new Map(), sessionActive = !1, widgetVisible = !1, widgetUnsubscribe = null, sessionGeneration = 0, sessionAbort = new AbortController();
464
+ function abortPendingFetches() {
465
+ for (let controller of pendingFetches.values())
466
+ controller.abort();
467
+ pendingFetches.clear();
468
+ }
469
+ function closeCurator(callId) {
470
+ if (callId !== void 0) {
471
+ let win = glimpseWins.get(callId);
472
+ glimpseWins.delete(callId);
473
+ try {
474
+ win?.close();
475
+ } catch {
476
+ }
477
+ pendingCurates.get(callId)?.cancel("stale"), pendingCurates.delete(callId);
478
+ let curator = activeCurators.get(callId);
479
+ activeCurators.delete(callId);
480
+ try {
481
+ curator?.close();
482
+ } catch {
483
+ }
484
+ return;
485
+ }
486
+ for (let win of glimpseWins.values())
487
+ try {
488
+ win.close();
489
+ } catch {
490
+ }
491
+ glimpseWins.clear();
492
+ for (let pending of pendingCurates.values())
493
+ try {
494
+ pending.cancel("stale");
495
+ } catch {
496
+ }
497
+ pendingCurates.clear();
498
+ for (let curator of activeCurators.values())
499
+ try {
500
+ curator.close();
501
+ } catch {
502
+ }
503
+ activeCurators.clear();
504
+ }
505
+ function updateWidget(ctx2) {
506
+ let theme = ctx2.ui.theme, entries = activityMonitor.getEntries(), lines = [];
507
+ if (lines.push(theme.fg("accent", "\u2500\u2500\u2500 Web Search Activity " + "\u2500".repeat(36))), entries.length === 0)
508
+ lines.push(theme.fg("muted", " No activity yet"));
509
+ else
510
+ for (let entry of entries)
511
+ lines.push(" " + formatEntryLine(entry, theme));
512
+ lines.push(theme.fg("accent", "\u2500".repeat(60)));
513
+ let rateInfo = activityMonitor.getRateLimitInfo(), resetMs = rateInfo.oldestTimestamp ? Math.max(0, rateInfo.oldestTimestamp + rateInfo.windowMs - Date.now()) : 0, resetSec = Math.ceil(resetMs / 1e3);
514
+ lines.push(theme.fg("muted", `Rate: ${rateInfo.used}/${rateInfo.max}`) + (resetMs > 0 ? theme.fg("dim", ` (resets in ${resetSec}s)`) : "")), ctx2.ui.setWidget("web-activity", new Text(lines.join(`
515
+ `), 0, 0));
516
+ }
517
+ function handleSessionChange(ctx2) {
518
+ abortPendingFetches(), closeCurator(), runSessionCleanups(), sessionActive = !0, restoreFromSession(ctx2), widgetUnsubscribe?.(), widgetUnsubscribe = null, activityMonitor.clear(), widgetVisible && (widgetUnsubscribe = activityMonitor.onUpdate(() => updateWidget(ctx2)), updateWidget(ctx2));
519
+ }
520
+ let warmSummaryReview = null;
521
+ function assertActiveRequest(generation, signal) {
522
+ if (signal?.throwIfAborted(), generation !== sessionGeneration)
523
+ throw new Error("Web request cancelled: session changed");
524
+ }
525
+ function startSession(ctx2) {
526
+ sessionGeneration++, sessionAbort.abort(), sessionAbort = new AbortController(), handleSessionChange(ctx2);
527
+ }
525
528
  async function ensureSummaryReview() {
526
529
  return warmSummaryReview || (warmSummaryReview = await loadSummaryReview()), warmSummaryReview;
527
530
  }
@@ -1027,7 +1030,7 @@ Open manually: ${handle.url}` }],
1027
1030
  handler: async (ctx2) => {
1028
1031
  widgetVisible = !widgetVisible, widgetVisible ? (widgetUnsubscribe = activityMonitor.onUpdate(() => updateWidget(ctx2)), updateWidget(ctx2)) : (widgetUnsubscribe?.(), widgetUnsubscribe = null, ctx2.ui.setWidget("web-activity", void 0));
1029
1032
  }
1030
- }), pi.on("session_start", async (_event, ctx2) => handleSessionChange(ctx2)), pi.on("session_tree", async (_event, ctx2) => handleSessionChange(ctx2)), pi.on("session_shutdown", () => {
1033
+ }), pi.on("session_start", async (_event, ctx2) => startSession(ctx2)), pi.on("session_tree", async (_event, ctx2) => startSession(ctx2)), pi.on("session_shutdown", () => {
1031
1034
  sessionGeneration++, sessionAbort.abort(), sessionActive = !1, abortPendingFetches(), closeCurator(), runSessionCleanups(), clearResults(), widgetUnsubscribe?.(), widgetUnsubscribe = null, activityMonitor.clear(), widgetVisible = !1;
1032
1035
  }), initConfig.webSearch?.enabled !== !1 && pi.registerTool({
1033
1036
  name: "web_search",
@@ -6,7 +6,7 @@ import {
6
6
  resolveMcpOutputGuardOptions,
7
7
  resolveMcpResultContent,
8
8
  transformMcpContent
9
- } from "./chunk-F4VQFJI2.js";
9
+ } from "./chunk-6SPPH4FY.js";
10
10
  import {
11
11
  buildToolMetadata,
12
12
  findToolByName,
@@ -17,26 +17,29 @@ import {
17
17
  updateMetadataCache,
18
18
  updateServerMetadata,
19
19
  updateStatusBar
20
- } from "./chunk-MKKH27PH.js";
20
+ } from "./chunk-BKAZ6BKX.js";
21
21
  import {
22
22
  abortable,
23
23
  formatAuthRequiredMessage,
24
24
  throwIfAborted,
25
25
  truncateAtWord
26
- } from "./chunk-VSELYKWU.js";
26
+ } from "./chunk-EHMBW7FA.js";
27
+ import {
28
+ getServerPrefix,
29
+ parseUiPromptHandoff
30
+ } from "./chunk-ARC4KOTI.js";
31
+ import "./chunk-LWJXTA6Z.js";
27
32
  import {
28
- UrlElicitationRequiredError,
29
33
  authenticate,
30
34
  completeAuthFromInput,
31
35
  startAuth,
32
36
  supportsOAuth
33
- } from "./chunk-4TLO4PO2.js";
37
+ } from "./chunk-U6C7VTR5.js";
34
38
  import "./chunk-4HXHDDCF.js";
35
- import "./chunk-BI3DHYCN.js";
36
39
  import {
37
- getServerPrefix,
38
- parseUiPromptHandoff
39
- } from "./chunk-ARC4KOTI.js";
40
+ UrlElicitationRequiredError
41
+ } from "./chunk-2IDTZAG5.js";
42
+ import "./chunk-BI3DHYCN.js";
40
43
  import "./chunk-Q4Q6D4IY.js";
41
44
  import "./chunk-BRJX2PRC.js";
42
45