@ashx-j/lunr 0.2.17 → 0.2.18
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.
- package/CHANGELOG.md +19 -1
- package/README.md +2 -1
- package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -0
- package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-thinking.js +44 -19
- package/dist/builtin-extensions/ashxj-thinking.js.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.d.ts +2 -2
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.js +8 -11
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +2 -1
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts +4 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js +172 -171
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +50 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +131 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts +7 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js +211 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts +0 -5
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +0 -202
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.js +276 -109
- package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts +4 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.js +10 -3
- package/dist/builtin-extensions/pi-mcp-adapter/init.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js +6 -1
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +6 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js +2 -1
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +68 -15
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +5 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +72 -31
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js +2 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/extract.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/extract.js +105 -54
- package/dist/builtin-extensions/pi-web-access/extract.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts +1 -1
- package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/gemini-search.js +82 -65
- package/dist/builtin-extensions/pi-web-access/gemini-search.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/github-extract.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/github-extract.js +2 -0
- package/dist/builtin-extensions/pi-web-access/github-extract.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.js +259 -168
- package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/lazy.d.ts +18 -0
- package/dist/builtin-extensions/pi-web-access/lazy.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/lazy.js +19 -0
- package/dist/builtin-extensions/pi-web-access/lazy.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts +6 -0
- package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/session-cleanup.js +17 -0
- package/dist/builtin-extensions/pi-web-access/session-cleanup.js.map +1 -0
- package/dist/cli-runtime.d.ts +3 -0
- package/dist/cli-runtime.d.ts.map +1 -0
- package/dist/cli-runtime.js +72 -0
- package/dist/cli-runtime.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -60
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +6 -3
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/host-static.d.ts.map +1 -1
- package/dist/core/extensions/host-static.js +34 -12
- package/dist/core/extensions/host-static.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +1 -2
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +10 -64
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +2 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +1 -1
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/timings.d.ts +2 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +17 -2
- package/dist/core/timings.js.map +1 -1
- package/dist/gateway/agent-bridge.d.ts +6 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +23 -6
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/cron.d.ts +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +3 -1
- package/dist/gateway/cron.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +20 -14
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/injected-context.d.ts +2 -0
- package/dist/modes/interactive/injected-context.d.ts.map +1 -0
- package/dist/modes/interactive/injected-context.js +7 -0
- package/dist/modes/interactive/injected-context.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +2 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +32 -8
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/thinking-level-slash.d.ts +4 -0
- package/dist/modes/interactive/thinking-level-slash.d.ts.map +1 -0
- package/dist/modes/interactive/thinking-level-slash.js +23 -0
- package/dist/modes/interactive/thinking-level-slash.js.map +1 -0
- package/dist/node-runtime/agent-session-services-35WNVGMR.js +36 -0
- package/dist/node-runtime/benchmark-request-UC7PD3V3.js +57 -0
- package/dist/node-runtime/brave-UWDA3I22.js +143 -0
- package/dist/node-runtime/builtin-extensions-QATGXENO.js +28 -0
- package/dist/node-runtime/chunk-2SJB2AWP.js +47 -0
- package/dist/node-runtime/chunk-3NMWLTPV.js +64 -0
- package/dist/node-runtime/chunk-3WFAEVKS.js +115 -0
- package/dist/node-runtime/chunk-3X3KZKMI.js +49 -0
- package/dist/node-runtime/chunk-4CSFRBCN.js +7558 -0
- package/dist/node-runtime/chunk-4DJ6HEGH.js +296 -0
- package/dist/node-runtime/chunk-4HXHDDCF.js +16 -0
- package/dist/node-runtime/chunk-4I23VTC4.js +429 -0
- package/dist/node-runtime/chunk-4TLO4PO2.js +3427 -0
- package/dist/node-runtime/chunk-4ZWGEEAS.js +69 -0
- package/dist/node-runtime/chunk-53YJI7JU.js +137 -0
- package/dist/node-runtime/chunk-5EFIU3OM.js +295 -0
- package/dist/node-runtime/chunk-6BEIBLQ3.js +53 -0
- package/dist/node-runtime/chunk-6KDIOJL3.js +72 -0
- package/dist/node-runtime/chunk-7N3YHTYF.js +26 -0
- package/dist/node-runtime/chunk-7NBZ5P7I.js +24 -0
- package/dist/node-runtime/chunk-AD6VXAO7.js +342 -0
- package/dist/node-runtime/chunk-ARC4KOTI.js +11178 -0
- package/dist/node-runtime/chunk-AROOY4BB.js +173 -0
- package/dist/node-runtime/chunk-ATGA2WLC.js +5646 -0
- package/dist/node-runtime/chunk-AUXVGBO4.js +19 -0
- package/dist/node-runtime/chunk-AY6CAJSL.js +30 -0
- package/dist/node-runtime/chunk-BHO7O6E5.js +296 -0
- package/dist/node-runtime/chunk-BI3DHYCN.js +8845 -0
- package/dist/node-runtime/chunk-BOHIDQT4.js +21 -0
- package/dist/node-runtime/chunk-BRJX2PRC.js +53 -0
- package/dist/node-runtime/chunk-CBGB57XT.js +20211 -0
- package/dist/node-runtime/chunk-CCZJ3PYY.js +17 -0
- package/dist/node-runtime/chunk-CGBXPL3E.js +1171 -0
- package/dist/node-runtime/chunk-CJECDQKP.js +19 -0
- package/dist/node-runtime/chunk-CSFI6YXL.js +130 -0
- package/dist/node-runtime/chunk-DAPBPCBP.js +53 -0
- package/dist/node-runtime/chunk-DDWHZ633.js +37 -0
- package/dist/node-runtime/chunk-DMMTJQMQ.js +43 -0
- package/dist/node-runtime/chunk-DVGWF6A2.js +1180 -0
- package/dist/node-runtime/chunk-EBF6COVM.js +1734 -0
- package/dist/node-runtime/chunk-FQMM2EZ2.js +248 -0
- package/dist/node-runtime/chunk-FVDOXRUD.js +96 -0
- package/dist/node-runtime/chunk-G4P75AIS.js +9471 -0
- package/dist/node-runtime/chunk-G6LRAP36.js +105 -0
- package/dist/node-runtime/chunk-GKLEQ3I4.js +860 -0
- package/dist/node-runtime/chunk-H2EOZYMP.js +57 -0
- package/dist/node-runtime/chunk-HQCKFM2O.js +56 -0
- package/dist/node-runtime/chunk-HYHJIRDW.js +19 -0
- package/dist/node-runtime/chunk-I6R76AG7.js +22 -0
- package/dist/node-runtime/chunk-IRPJXI6U.js +1269 -0
- package/dist/node-runtime/chunk-J26TSGDL.js +633 -0
- package/dist/node-runtime/chunk-JZQ7F36T.js +610 -0
- package/dist/node-runtime/chunk-KBKMCJDU.js +126 -0
- package/dist/node-runtime/chunk-KWA4OC2J.js +100 -0
- package/dist/node-runtime/chunk-M3LZLQW2.js +98 -0
- package/dist/node-runtime/chunk-MCUNIRD5.js +8388 -0
- package/dist/node-runtime/chunk-NI6OTSBH.js +966 -0
- package/dist/node-runtime/chunk-NUIFPZWX.js +209 -0
- package/dist/node-runtime/chunk-OBMWP3I5.js +68 -0
- package/dist/node-runtime/chunk-OCVIXVTZ.js +88 -0
- package/dist/node-runtime/chunk-OPEK5RRY.js +466 -0
- package/dist/node-runtime/chunk-OR4L3IB2.js +42 -0
- package/dist/node-runtime/chunk-PL6JKXWI.js +3622 -0
- package/dist/node-runtime/chunk-PNJSG3IZ.js +807 -0
- package/dist/node-runtime/chunk-PVCDKGR6.js +55 -0
- package/dist/node-runtime/chunk-Q4Q6D4IY.js +364 -0
- package/dist/node-runtime/chunk-Q5ZU2VRT.js +83 -0
- package/dist/node-runtime/chunk-QFWG2RVL.js +5477 -0
- package/dist/node-runtime/chunk-QZMODZQ2.js +305 -0
- package/dist/node-runtime/chunk-R5EDISSV.js +375 -0
- package/dist/node-runtime/chunk-RNBHABBA.js +986 -0
- package/dist/node-runtime/chunk-RQ2Q5IYR.js +72 -0
- package/dist/node-runtime/chunk-RRIZE6QQ.js +17 -0
- package/dist/node-runtime/chunk-SN6G4OU6.js +4753 -0
- package/dist/node-runtime/chunk-STERBGUB.js +949 -0
- package/dist/node-runtime/chunk-UWQYRSYQ.js +8973 -0
- package/dist/node-runtime/chunk-VRB2IYGG.js +53 -0
- package/dist/node-runtime/chunk-VSELYKWU.js +772 -0
- package/dist/node-runtime/chunk-W3CVH5RX.js +62 -0
- package/dist/node-runtime/chunk-WJVFOIB5.js +24921 -0
- package/dist/node-runtime/chunk-WKDK4C5P.js +2834 -0
- package/dist/node-runtime/chunk-XATUM2HK.js +46 -0
- package/dist/node-runtime/chunk-XBWPBZBN.js +125 -0
- package/dist/node-runtime/chunk-XTHQ7XR7.js +509 -0
- package/dist/node-runtime/chunk-ZBV7FAHG.js +1345 -0
- package/dist/node-runtime/cli-runtime.js +80 -0
- package/dist/node-runtime/clipboard-OZ63BBC6.js +12 -0
- package/dist/node-runtime/clipboard-image-7QR6GXVA.js +13 -0
- package/dist/node-runtime/command-AAV3YRR5.js +13 -0
- package/dist/node-runtime/commands-MV5KOZ64.js +291 -0
- package/dist/node-runtime/config-QDD5PUE2.js +73 -0
- package/dist/node-runtime/curator-server-XCM43VEF.js +3816 -0
- package/dist/node-runtime/customize-XEXL2DGQ.js +12 -0
- package/dist/node-runtime/direct-tool-executor-BK7CLEBX.js +188 -0
- package/dist/node-runtime/exa-LL64QZR2.js +329 -0
- package/dist/node-runtime/export-html-TEXVV5RP.js +150 -0
- package/dist/node-runtime/extension-input-O4HSAEM4.js +14 -0
- package/dist/node-runtime/extension-selector-X5FCX43D.js +14 -0
- package/dist/node-runtime/extract-XLQSJN4V.js +17 -0
- package/dist/node-runtime/file-sync-HCOP2QVF.js +117 -0
- package/dist/node-runtime/gateway-OAC4OBBL.js +2137 -0
- package/dist/node-runtime/gemini-api-QE7ANVDZ.js +29 -0
- package/dist/node-runtime/gemini-search-U7SUMPQA.js +330 -0
- package/dist/node-runtime/gemini-url-context-PXWCBQHK.js +103 -0
- package/dist/node-runtime/gemini-web-MM446SEH.js +14 -0
- package/dist/node-runtime/github-extract-F64RZOEA.js +619 -0
- package/dist/node-runtime/goal-NJEE5CTU.js +1831 -0
- package/dist/node-runtime/index.js +859 -0
- package/dist/node-runtime/init-3C7Z24OI.js +28 -0
- package/dist/node-runtime/install-cli-EXMJQESX.js +308 -0
- package/dist/node-runtime/interactive-mode-2SZUO53H.js +56 -0
- package/dist/node-runtime/interactive-view-S6J3QHEF.js +247 -0
- package/dist/node-runtime/lsp-manager-3ASUSO4T.js +1104 -0
- package/dist/node-runtime/lunr-cron-AUUYP4N4.js +272 -0
- package/dist/node-runtime/main.js +54 -0
- package/dist/node-runtime/mcp-auth-flow-QIXHW6QN.js +32 -0
- package/dist/node-runtime/mcp-panel-IIGMXQGP.js +501 -0
- package/dist/node-runtime/mcp-setup-panel-FEK7663I.js +355 -0
- package/dist/node-runtime/memory-cap-3S4XRLNP.js +20 -0
- package/dist/node-runtime/model-tiers-NJLHUEGK.js +20 -0
- package/dist/node-runtime/openai-search-B3MSNCQA.js +288 -0
- package/dist/node-runtime/package-manager-cli-7RKSZGEN.js +749 -0
- package/dist/node-runtime/parallel-AI2MNSCU.js +265 -0
- package/dist/node-runtime/parser-manager-TQHWYDH7.js +152 -0
- package/dist/node-runtime/pdf-extract-IPE6H4HP.js +57 -0
- package/dist/node-runtime/perplexity-QVJW3I35.js +12 -0
- package/dist/node-runtime/pi-intercom-EEMBGQID.js +2215 -0
- package/dist/node-runtime/pi-mcp-adapter-GUFZWW54.js +428 -0
- package/dist/node-runtime/pi-ollama-cloud-2F3Y2QNM.js +1440 -0
- package/dist/node-runtime/pi-prompt-template-model-QWTCGLJU.js +3946 -0
- package/dist/node-runtime/pi-subagents-7YJ3I4VE.js +6048 -0
- package/dist/node-runtime/pi-web-access-2CQGFLT2.js +1867 -0
- package/dist/node-runtime/print-mode-XSFM26EL.js +12 -0
- package/dist/node-runtime/proxy-modes-V6YVFH3C.js +685 -0
- package/dist/node-runtime/rpc-entry.js +62 -0
- package/dist/node-runtime/rpc-mode-W5ZTLTMZ.js +13 -0
- package/dist/node-runtime/runtime-bridges-3RKBDLNA.js +14 -0
- package/dist/node-runtime/session-manager-E7AREDTV.js +33 -0
- package/dist/node-runtime/session-selector-FJ7M2AIX.js +14 -0
- package/dist/node-runtime/settings-manager-GHPTUN7R.js +21 -0
- package/dist/node-runtime/src-BPQFJR76.js +2427 -0
- package/dist/node-runtime/subagent-executor-5Q5A4HJ2.js +8499 -0
- package/dist/node-runtime/summary-review-YSMXKITO.js +228 -0
- package/dist/node-runtime/tavily-WEZFVFP7.js +154 -0
- package/dist/node-runtime/timings-UAD5BEAS.js +16 -0
- package/dist/node-runtime/tool-renderer-MV5O452K.js +204 -0
- package/dist/node-runtime/update-cli-L3JIBH2U.js +70 -0
- package/dist/node-runtime/v4-5MNC3H7G.js +424 -0
- package/dist/node-runtime/video-extract-OYT5WKS5.js +304 -0
- package/dist/node-runtime/workspace-index-6DBXSTJ6.js +163 -0
- package/dist/node-runtime/youtube-extract-TQYKGFGS.js +264 -0
- package/dist/rpc.d.ts +3 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +18 -0
- package/dist/rpc.js.map +1 -0
- package/dist/startup/benchmark-request.d.ts +3 -0
- package/dist/startup/benchmark-request.d.ts.map +1 -0
- package/dist/startup/benchmark-request.js +65 -0
- package/dist/startup/benchmark-request.js.map +1 -0
- package/dist/startup/interactive-view.d.ts.map +1 -1
- package/dist/startup/interactive-view.js +1 -2
- package/dist/startup/interactive-view.js.map +1 -1
- package/dist/startup/startup-milestones.d.ts +1 -1
- package/dist/startup/startup-milestones.d.ts.map +1 -1
- package/dist/startup/startup-milestones.js.map +1 -1
- package/dist/utils/await-with-abort.d.ts +2 -0
- package/dist/utils/await-with-abort.d.ts.map +1 -0
- package/dist/utils/await-with-abort.js +19 -0
- package/dist/utils/await-with-abort.js.map +1 -0
- package/docs/development.md +5 -1
- package/docs/features.md +2 -2
- package/docs/interactive-startup.md +95 -48
- package/docs/keybindings.md +2 -2
- package/docs/terminal-setup.md +1 -1
- package/docs/usage.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/hidden-thinking-label.ts +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +8 -8
|
@@ -9,30 +9,19 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
9
9
|
import { Box, Text, truncateToWidth } from "@ashx-j/lunr-tui";
|
|
10
10
|
import { Type } from "typebox";
|
|
11
11
|
import { StringEnum, complete } from "@ashx-j/lunr-ai/compat";
|
|
12
|
-
import { fetchAllContent } from "./extract.js";
|
|
13
12
|
import { normalizeFetchContentParams } from "./fetch-params.js";
|
|
14
|
-
import { clearCloneCache } from "./github-extract.js";
|
|
15
|
-
import { search } from "./gemini-search.js";
|
|
16
13
|
import { getWebSearchConfigDir, getWebSearchConfigPath } from "./utils.js";
|
|
17
14
|
import { clearResults, deleteResult, generateId, getAllResults, getResult, restoreFromSession, storeResult, } from "./storage.js";
|
|
18
15
|
import { activityMonitor } from "./activity.js";
|
|
19
|
-
import { startCuratorServer } from "./curator-server.js";
|
|
20
|
-
import { buildDeterministicSummary, generateSummaryDraft, } from "./summary-review.js";
|
|
21
16
|
import { randomUUID } from "node:crypto";
|
|
22
17
|
import { execFileSync } from "node:child_process";
|
|
23
18
|
import { createRequire } from "node:module";
|
|
24
19
|
import { platform } from "node:os";
|
|
25
20
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
26
21
|
import { join } from "node:path";
|
|
27
|
-
import { isPerplexityAvailable } from "./perplexity.js";
|
|
28
|
-
import { isExaAvailable } from "./exa.js";
|
|
29
|
-
import { isGeminiApiAvailable } from "./gemini-api.js";
|
|
30
|
-
import { getActiveGoogleEmail, isGeminiWebAvailable } from "./gemini-web.js";
|
|
31
22
|
import { isBrowserCookieAccessAllowed } from "./gemini-web-config.js";
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import { isParallelAvailable } from "./parallel.js";
|
|
35
|
-
import { isTavilyAvailable } from "./tavily.js";
|
|
23
|
+
import { loadBrave, loadCuratorServer, loadExa, loadExtract, loadGeminiApi, loadGeminiSearch, loadGeminiWeb, loadOpenAISearch, loadParallel, loadPerplexity, loadSummaryReview, loadTavily, } from "./lazy.js";
|
|
24
|
+
import { runSessionCleanups } from "./session-cleanup.js";
|
|
36
25
|
import { buildSearchErrorPlan } from "./render-search-error.js";
|
|
37
26
|
import { collectFetchUrls, collectSearchQueries, formatFetchCallTitle, formatFetchChrome, formatFetchDetail, formatSearchCallTitle, formatSearchChrome, formatSearchDetail, } from "./render-search-chrome.js";
|
|
38
27
|
import { formatGroupedCall, toolGroupTree, toolStatusDotFromContext } from "../../core/tools/render-utils.js";
|
|
@@ -133,15 +122,28 @@ function getCuratorTimeoutSeconds() {
|
|
|
133
122
|
return normalizeCuratorTimeoutSeconds(source.curatorTimeoutSeconds) ?? DEFAULT_CURATOR_TIMEOUT_SECONDS;
|
|
134
123
|
}
|
|
135
124
|
async function getProviderAvailability(ctx) {
|
|
136
|
-
const
|
|
125
|
+
const [openaiMod, braveMod, parallelMod, tavilyMod, perplexityMod, exaMod, geminiApiMod,] = await Promise.all([
|
|
126
|
+
loadOpenAISearch(),
|
|
127
|
+
loadBrave(),
|
|
128
|
+
loadParallel(),
|
|
129
|
+
loadTavily(),
|
|
130
|
+
loadPerplexity(),
|
|
131
|
+
loadExa(),
|
|
132
|
+
loadGeminiApi(),
|
|
133
|
+
]);
|
|
134
|
+
let geminiWebAvail = null;
|
|
135
|
+
if (isBrowserCookieAccessAllowed()) {
|
|
136
|
+
const geminiWebMod = await loadGeminiWeb();
|
|
137
|
+
geminiWebAvail = await geminiWebMod.isGeminiWebAvailable();
|
|
138
|
+
}
|
|
137
139
|
return {
|
|
138
|
-
openai: await isOpenAISearchAvailable(ctx),
|
|
139
|
-
brave: isBraveAvailable(),
|
|
140
|
-
parallel: isParallelAvailable(),
|
|
141
|
-
tavily: isTavilyAvailable(),
|
|
142
|
-
perplexity: isPerplexityAvailable(),
|
|
143
|
-
exa: isExaAvailable(),
|
|
144
|
-
gemini: isGeminiApiAvailable() || !!geminiWebAvail,
|
|
140
|
+
openai: await openaiMod.isOpenAISearchAvailable(ctx),
|
|
141
|
+
brave: braveMod.isBraveAvailable(),
|
|
142
|
+
parallel: parallelMod.isParallelAvailable(),
|
|
143
|
+
tavily: tavilyMod.isTavilyAvailable(),
|
|
144
|
+
perplexity: perplexityMod.isPerplexityAvailable(),
|
|
145
|
+
exa: exaMod.isExaAvailable(),
|
|
146
|
+
gemini: geminiApiMod.isGeminiApiAvailable() || !!geminiWebAvail,
|
|
145
147
|
};
|
|
146
148
|
}
|
|
147
149
|
function shouldPreferOpenAI(options) {
|
|
@@ -208,13 +210,6 @@ function resolveProvider(requested, available, options) {
|
|
|
208
210
|
}
|
|
209
211
|
return provider;
|
|
210
212
|
}
|
|
211
|
-
const pendingFetches = new Map();
|
|
212
|
-
let sessionActive = false;
|
|
213
|
-
let widgetVisible = false;
|
|
214
|
-
let widgetUnsubscribe = null;
|
|
215
|
-
const pendingCurates = new Map();
|
|
216
|
-
const activeCurators = new Map();
|
|
217
|
-
const glimpseWins = new Map();
|
|
218
213
|
const MAX_INLINE_CONTENT = 30000; // Content returned directly to agent
|
|
219
214
|
function stripThumbnails(results) {
|
|
220
215
|
return results.map(({ thumbnail, frames, ...rest }) => rest);
|
|
@@ -256,52 +251,6 @@ function formatFullResults(queryData) {
|
|
|
256
251
|
}
|
|
257
252
|
return output;
|
|
258
253
|
}
|
|
259
|
-
function abortPendingFetches() {
|
|
260
|
-
for (const controller of pendingFetches.values()) {
|
|
261
|
-
controller.abort();
|
|
262
|
-
}
|
|
263
|
-
pendingFetches.clear();
|
|
264
|
-
}
|
|
265
|
-
function closeCurator(callId) {
|
|
266
|
-
if (callId !== undefined) {
|
|
267
|
-
const win = glimpseWins.get(callId);
|
|
268
|
-
glimpseWins.delete(callId);
|
|
269
|
-
try {
|
|
270
|
-
win?.close();
|
|
271
|
-
}
|
|
272
|
-
catch { }
|
|
273
|
-
pendingCurates.get(callId)?.cancel("stale");
|
|
274
|
-
pendingCurates.delete(callId);
|
|
275
|
-
const curator = activeCurators.get(callId);
|
|
276
|
-
activeCurators.delete(callId);
|
|
277
|
-
try {
|
|
278
|
-
curator?.close();
|
|
279
|
-
}
|
|
280
|
-
catch { }
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
for (const win of glimpseWins.values()) {
|
|
284
|
-
try {
|
|
285
|
-
win.close();
|
|
286
|
-
}
|
|
287
|
-
catch { }
|
|
288
|
-
}
|
|
289
|
-
glimpseWins.clear();
|
|
290
|
-
for (const pc of pendingCurates.values()) {
|
|
291
|
-
try {
|
|
292
|
-
pc.cancel("stale");
|
|
293
|
-
}
|
|
294
|
-
catch { }
|
|
295
|
-
}
|
|
296
|
-
pendingCurates.clear();
|
|
297
|
-
for (const curator of activeCurators.values()) {
|
|
298
|
-
try {
|
|
299
|
-
curator.close();
|
|
300
|
-
}
|
|
301
|
-
catch { }
|
|
302
|
-
}
|
|
303
|
-
activeCurators.clear();
|
|
304
|
-
}
|
|
305
254
|
async function openInBrowser(pi, url) {
|
|
306
255
|
const plat = platform();
|
|
307
256
|
const result = plat === "darwin"
|
|
@@ -386,27 +335,6 @@ function extractDomain(url) {
|
|
|
386
335
|
return url;
|
|
387
336
|
}
|
|
388
337
|
}
|
|
389
|
-
function updateWidget(ctx) {
|
|
390
|
-
const theme = ctx.ui.theme;
|
|
391
|
-
const entries = activityMonitor.getEntries();
|
|
392
|
-
const lines = [];
|
|
393
|
-
lines.push(theme.fg("accent", "─── Web Search Activity " + "─".repeat(36)));
|
|
394
|
-
if (entries.length === 0) {
|
|
395
|
-
lines.push(theme.fg("muted", " No activity yet"));
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
for (const e of entries) {
|
|
399
|
-
lines.push(" " + formatEntryLine(e, theme));
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
lines.push(theme.fg("accent", "─".repeat(60)));
|
|
403
|
-
const rateInfo = activityMonitor.getRateLimitInfo();
|
|
404
|
-
const resetMs = rateInfo.oldestTimestamp ? Math.max(0, rateInfo.oldestTimestamp + rateInfo.windowMs - Date.now()) : 0;
|
|
405
|
-
const resetSec = Math.ceil(resetMs / 1000);
|
|
406
|
-
lines.push(theme.fg("muted", `Rate: ${rateInfo.used}/${rateInfo.max}`) +
|
|
407
|
-
(resetMs > 0 ? theme.fg("dim", ` (resets in ${resetSec}s)`) : ""));
|
|
408
|
-
ctx.ui.setWidget("web-activity", new Text(lines.join("\n"), 0, 0));
|
|
409
|
-
}
|
|
410
338
|
function formatEntryLine(entry, theme) {
|
|
411
339
|
const typeStr = entry.type === "api" ? "API" : "GET";
|
|
412
340
|
const target = entry.type === "api"
|
|
@@ -435,26 +363,122 @@ function formatEntryLine(entry, theme) {
|
|
|
435
363
|
}
|
|
436
364
|
return `${typeStr.padEnd(4)} ${target.padEnd(32)} ${statusStr.padStart(5)} ${duration.padStart(5)} ${indicator}`;
|
|
437
365
|
}
|
|
438
|
-
function handleSessionChange(ctx) {
|
|
439
|
-
abortPendingFetches();
|
|
440
|
-
closeCurator();
|
|
441
|
-
clearCloneCache();
|
|
442
|
-
sessionActive = true;
|
|
443
|
-
restoreFromSession(ctx);
|
|
444
|
-
// Unsubscribe before clear() to avoid callback with stale ctx
|
|
445
|
-
widgetUnsubscribe?.();
|
|
446
|
-
widgetUnsubscribe = null;
|
|
447
|
-
activityMonitor.clear();
|
|
448
|
-
if (widgetVisible) {
|
|
449
|
-
// Re-subscribe with new ctx
|
|
450
|
-
widgetUnsubscribe = activityMonitor.onUpdate(() => updateWidget(ctx));
|
|
451
|
-
updateWidget(ctx);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
366
|
export default function (pi) {
|
|
455
367
|
const initConfig = loadConfigForExtensionInit();
|
|
456
368
|
const curateKey = initConfig.shortcuts?.curate || DEFAULT_SHORTCUTS.curate;
|
|
457
369
|
const activityKey = initConfig.shortcuts?.activity || DEFAULT_SHORTCUTS.activity;
|
|
370
|
+
const pendingFetches = new Map();
|
|
371
|
+
const pendingCurates = new Map();
|
|
372
|
+
const activeCurators = new Map();
|
|
373
|
+
const glimpseWins = new Map();
|
|
374
|
+
let sessionActive = false;
|
|
375
|
+
let widgetVisible = false;
|
|
376
|
+
let widgetUnsubscribe = null;
|
|
377
|
+
let sessionGeneration = 0;
|
|
378
|
+
let sessionAbort = new AbortController();
|
|
379
|
+
function abortPendingFetches() {
|
|
380
|
+
for (const controller of pendingFetches.values())
|
|
381
|
+
controller.abort();
|
|
382
|
+
pendingFetches.clear();
|
|
383
|
+
}
|
|
384
|
+
function closeCurator(callId) {
|
|
385
|
+
if (callId !== undefined) {
|
|
386
|
+
const win = glimpseWins.get(callId);
|
|
387
|
+
glimpseWins.delete(callId);
|
|
388
|
+
try {
|
|
389
|
+
win?.close();
|
|
390
|
+
}
|
|
391
|
+
catch { }
|
|
392
|
+
pendingCurates.get(callId)?.cancel("stale");
|
|
393
|
+
pendingCurates.delete(callId);
|
|
394
|
+
const curator = activeCurators.get(callId);
|
|
395
|
+
activeCurators.delete(callId);
|
|
396
|
+
try {
|
|
397
|
+
curator?.close();
|
|
398
|
+
}
|
|
399
|
+
catch { }
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
for (const win of glimpseWins.values()) {
|
|
403
|
+
try {
|
|
404
|
+
win.close();
|
|
405
|
+
}
|
|
406
|
+
catch { }
|
|
407
|
+
}
|
|
408
|
+
glimpseWins.clear();
|
|
409
|
+
for (const pending of pendingCurates.values()) {
|
|
410
|
+
try {
|
|
411
|
+
pending.cancel("stale");
|
|
412
|
+
}
|
|
413
|
+
catch { }
|
|
414
|
+
}
|
|
415
|
+
pendingCurates.clear();
|
|
416
|
+
for (const curator of activeCurators.values()) {
|
|
417
|
+
try {
|
|
418
|
+
curator.close();
|
|
419
|
+
}
|
|
420
|
+
catch { }
|
|
421
|
+
}
|
|
422
|
+
activeCurators.clear();
|
|
423
|
+
}
|
|
424
|
+
function updateWidget(ctx) {
|
|
425
|
+
const theme = ctx.ui.theme;
|
|
426
|
+
const entries = activityMonitor.getEntries();
|
|
427
|
+
const lines = [];
|
|
428
|
+
lines.push(theme.fg("accent", "─── Web Search Activity " + "─".repeat(36)));
|
|
429
|
+
if (entries.length === 0) {
|
|
430
|
+
lines.push(theme.fg("muted", " No activity yet"));
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
for (const entry of entries)
|
|
434
|
+
lines.push(" " + formatEntryLine(entry, theme));
|
|
435
|
+
}
|
|
436
|
+
lines.push(theme.fg("accent", "─".repeat(60)));
|
|
437
|
+
const rateInfo = activityMonitor.getRateLimitInfo();
|
|
438
|
+
const resetMs = rateInfo.oldestTimestamp
|
|
439
|
+
? Math.max(0, rateInfo.oldestTimestamp + rateInfo.windowMs - Date.now())
|
|
440
|
+
: 0;
|
|
441
|
+
const resetSec = Math.ceil(resetMs / 1000);
|
|
442
|
+
lines.push(theme.fg("muted", `Rate: ${rateInfo.used}/${rateInfo.max}`) +
|
|
443
|
+
(resetMs > 0 ? theme.fg("dim", ` (resets in ${resetSec}s)`) : ""));
|
|
444
|
+
ctx.ui.setWidget("web-activity", new Text(lines.join("\n"), 0, 0));
|
|
445
|
+
}
|
|
446
|
+
function handleSessionChange(ctx) {
|
|
447
|
+
abortPendingFetches();
|
|
448
|
+
closeCurator();
|
|
449
|
+
runSessionCleanups();
|
|
450
|
+
sessionActive = true;
|
|
451
|
+
restoreFromSession(ctx);
|
|
452
|
+
widgetUnsubscribe?.();
|
|
453
|
+
widgetUnsubscribe = null;
|
|
454
|
+
activityMonitor.clear();
|
|
455
|
+
if (widgetVisible) {
|
|
456
|
+
widgetUnsubscribe = activityMonitor.onUpdate(() => updateWidget(ctx));
|
|
457
|
+
updateWidget(ctx);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
/** Populated on first summary/curator use so sync curator submit/cancel can build fallbacks. */
|
|
461
|
+
let warmSummaryReview = null;
|
|
462
|
+
function assertActiveRequest(generation, signal) {
|
|
463
|
+
signal?.throwIfAborted();
|
|
464
|
+
if (generation !== sessionGeneration)
|
|
465
|
+
throw new Error("Web request cancelled: session changed");
|
|
466
|
+
}
|
|
467
|
+
function startSession(ctx) {
|
|
468
|
+
sessionGeneration++;
|
|
469
|
+
sessionAbort.abort();
|
|
470
|
+
sessionAbort = new AbortController();
|
|
471
|
+
handleSessionChange(ctx);
|
|
472
|
+
}
|
|
473
|
+
async function ensureSummaryReview() {
|
|
474
|
+
if (!warmSummaryReview)
|
|
475
|
+
warmSummaryReview = await loadSummaryReview();
|
|
476
|
+
return warmSummaryReview;
|
|
477
|
+
}
|
|
478
|
+
async function runSearch(query, options) {
|
|
479
|
+
const { search } = await loadGeminiSearch();
|
|
480
|
+
return search(query, options);
|
|
481
|
+
}
|
|
458
482
|
// lunr: expose curator workflow state to core (/settings "Extensions" submenu)
|
|
459
483
|
// so the /settings toggle writes through the same web-search.json saveConfig
|
|
460
484
|
// path as /curator — single source of truth, no forked state.
|
|
@@ -472,39 +496,46 @@ export default function (pi) {
|
|
|
472
496
|
const fetchId = generateId();
|
|
473
497
|
const controller = new AbortController();
|
|
474
498
|
pendingFetches.set(fetchId, controller);
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}, { triggerTurn: true });
|
|
493
|
-
})
|
|
494
|
-
.catch((err) => {
|
|
495
|
-
if (!sessionActive || !pendingFetches.has(fetchId))
|
|
496
|
-
return;
|
|
497
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
498
|
-
const isAbort = (err instanceof Error && err.name === "AbortError") || message.toLowerCase().includes("abort");
|
|
499
|
-
if (!isAbort) {
|
|
499
|
+
void (async () => {
|
|
500
|
+
try {
|
|
501
|
+
const { fetchAllContent } = await loadExtract();
|
|
502
|
+
if (!sessionActive || !pendingFetches.has(fetchId))
|
|
503
|
+
return;
|
|
504
|
+
const fetched = await fetchAllContent(urls, controller.signal);
|
|
505
|
+
if (!sessionActive || !pendingFetches.has(fetchId))
|
|
506
|
+
return;
|
|
507
|
+
const data = {
|
|
508
|
+
id: fetchId,
|
|
509
|
+
type: "fetch",
|
|
510
|
+
timestamp: Date.now(),
|
|
511
|
+
urls: stripThumbnails(fetched),
|
|
512
|
+
};
|
|
513
|
+
storeResult(fetchId, data);
|
|
514
|
+
pi.appendEntry("web-search-results", data);
|
|
515
|
+
const ok = fetched.filter(f => !f.error).length;
|
|
500
516
|
pi.sendMessage({
|
|
501
|
-
customType: "web-search-
|
|
502
|
-
content: `Content
|
|
517
|
+
customType: "web-search-content-ready",
|
|
518
|
+
content: `Content fetched for ${ok}/${fetched.length} URLs [${fetchId}]. Full page content now available.`,
|
|
503
519
|
display: true,
|
|
504
|
-
}, { triggerTurn:
|
|
520
|
+
}, { triggerTurn: true });
|
|
505
521
|
}
|
|
506
|
-
|
|
507
|
-
|
|
522
|
+
catch (err) {
|
|
523
|
+
if (!sessionActive || !pendingFetches.has(fetchId))
|
|
524
|
+
return;
|
|
525
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
526
|
+
const isAbort = (err instanceof Error && err.name === "AbortError") || message.toLowerCase().includes("abort");
|
|
527
|
+
if (!isAbort) {
|
|
528
|
+
pi.sendMessage({
|
|
529
|
+
customType: "web-search-error",
|
|
530
|
+
content: `Content fetch failed [${fetchId}]: ${message}`,
|
|
531
|
+
display: true,
|
|
532
|
+
}, { triggerTurn: false });
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
finally {
|
|
536
|
+
pendingFetches.delete(fetchId);
|
|
537
|
+
}
|
|
538
|
+
})();
|
|
508
539
|
return fetchId;
|
|
509
540
|
}
|
|
510
541
|
function storeAndPublishSearch(results) {
|
|
@@ -618,14 +649,15 @@ export default function (pi) {
|
|
|
618
649
|
if (selectedResults.length === 0) {
|
|
619
650
|
throw new Error("No selected results available for summary generation");
|
|
620
651
|
}
|
|
652
|
+
const summaryReview = await ensureSummaryReview();
|
|
621
653
|
try {
|
|
622
|
-
return await generateSummaryDraft(selectedResults, summaryContext, signal, modelOverride, feedback);
|
|
654
|
+
return await summaryReview.generateSummaryDraft(selectedResults, summaryContext, signal, modelOverride, feedback);
|
|
623
655
|
}
|
|
624
656
|
catch (err) {
|
|
625
657
|
const isEmptyResponse = err instanceof Error && err.message.includes("Summary model returned empty response");
|
|
626
658
|
if (!isEmptyResponse)
|
|
627
659
|
throw err;
|
|
628
|
-
const deterministic = buildDeterministicSummary(selectedResults);
|
|
660
|
+
const deterministic = summaryReview.buildDeterministicSummary(selectedResults);
|
|
629
661
|
return {
|
|
630
662
|
summary: deterministic.summary,
|
|
631
663
|
meta: {
|
|
@@ -700,7 +732,11 @@ export default function (pi) {
|
|
|
700
732
|
}
|
|
701
733
|
const selected = filterByQueryIndices(payload.selectedQueryIndices, resultsByIndex).results;
|
|
702
734
|
const fallbackResults = selected.length > 0 ? selected : [...resultsByIndex.values()];
|
|
703
|
-
|
|
735
|
+
// Curator paths preload summary-review before opening; sync submit/cancel need it warm.
|
|
736
|
+
if (!warmSummaryReview) {
|
|
737
|
+
throw new Error("Summary review module is not loaded");
|
|
738
|
+
}
|
|
739
|
+
const deterministic = warmSummaryReview.buildDeterministicSummary(fallbackResults);
|
|
704
740
|
return {
|
|
705
741
|
approvedSummary: deterministic.summary,
|
|
706
742
|
summaryMeta: deterministic.meta,
|
|
@@ -833,6 +869,12 @@ export default function (pi) {
|
|
|
833
869
|
? AbortSignal.any([pc.signal, searchAbort.signal])
|
|
834
870
|
: searchAbort.signal;
|
|
835
871
|
const sessionToken = randomUUID();
|
|
872
|
+
const [{ startCuratorServer }] = await Promise.all([
|
|
873
|
+
loadCuratorServer(),
|
|
874
|
+
ensureSummaryReview(),
|
|
875
|
+
]);
|
|
876
|
+
if (pendingCurates.get(callId) !== pc)
|
|
877
|
+
return;
|
|
836
878
|
handle = await startCuratorServer({
|
|
837
879
|
queries: pc.queryList,
|
|
838
880
|
sessionToken,
|
|
@@ -943,7 +985,7 @@ export default function (pi) {
|
|
|
943
985
|
? pc.searchProvider
|
|
944
986
|
: normalizedProvider;
|
|
945
987
|
try {
|
|
946
|
-
const { answer, results, inlineContent, provider: actualProvider } = await
|
|
988
|
+
const { answer, results, inlineContent, provider: actualProvider } = await runSearch(query, {
|
|
947
989
|
provider: requestedProvider,
|
|
948
990
|
numResults: pc.numResults,
|
|
949
991
|
recencyFilter: pc.recencyFilter,
|
|
@@ -1082,13 +1124,15 @@ export default function (pi) {
|
|
|
1082
1124
|
}
|
|
1083
1125
|
},
|
|
1084
1126
|
});
|
|
1085
|
-
pi.on("session_start", async (_event, ctx) =>
|
|
1086
|
-
pi.on("session_tree", async (_event, ctx) =>
|
|
1127
|
+
pi.on("session_start", async (_event, ctx) => startSession(ctx));
|
|
1128
|
+
pi.on("session_tree", async (_event, ctx) => startSession(ctx));
|
|
1087
1129
|
pi.on("session_shutdown", () => {
|
|
1130
|
+
sessionGeneration++;
|
|
1131
|
+
sessionAbort.abort();
|
|
1088
1132
|
sessionActive = false;
|
|
1089
1133
|
abortPendingFetches();
|
|
1090
1134
|
closeCurator();
|
|
1091
|
-
|
|
1135
|
+
runSessionCleanups();
|
|
1092
1136
|
clearResults();
|
|
1093
1137
|
// Unsubscribe before clear() to avoid callback with stale ctx
|
|
1094
1138
|
widgetUnsubscribe?.();
|
|
@@ -1114,7 +1158,10 @@ export default function (pi) {
|
|
|
1114
1158
|
description: "Search workflow mode: none = no curator, summary-review = open curator with auto summary draft (default), auto-summary = generate summary without opening curator",
|
|
1115
1159
|
})),
|
|
1116
1160
|
}),
|
|
1117
|
-
async execute(callId, params,
|
|
1161
|
+
async execute(callId, params, incomingSignal, onUpdate, ctx) {
|
|
1162
|
+
const generation = sessionGeneration;
|
|
1163
|
+
const signal = incomingSignal ? AbortSignal.any([incomingSignal, sessionAbort.signal]) : sessionAbort.signal;
|
|
1164
|
+
assertActiveRequest(generation, signal);
|
|
1118
1165
|
const rawQueryList = Array.isArray(params.queries)
|
|
1119
1166
|
? params.queries
|
|
1120
1167
|
: (params.query !== undefined ? [params.query] : []);
|
|
@@ -1152,6 +1199,7 @@ export default function (pi) {
|
|
|
1152
1199
|
numResults: params.numResults,
|
|
1153
1200
|
recencyFilter: params.recencyFilter,
|
|
1154
1201
|
});
|
|
1202
|
+
assertActiveRequest(generation, signal);
|
|
1155
1203
|
const availableProviders = bootstrap.availableProviders;
|
|
1156
1204
|
const defaultProvider = bootstrap.defaultProvider;
|
|
1157
1205
|
const rawSearchProvider = normalizeProviderInput(params.provider ?? loadConfig().provider ?? "auto") ?? "auto";
|
|
@@ -1165,6 +1213,7 @@ export default function (pi) {
|
|
|
1165
1213
|
isProjectTrusted: () => ctx.isProjectTrusted(),
|
|
1166
1214
|
};
|
|
1167
1215
|
const summaryModelChoices = await loadSummaryModelChoices(summaryContext);
|
|
1216
|
+
assertActiveRequest(generation, signal);
|
|
1168
1217
|
const pc = {
|
|
1169
1218
|
phase: "searching",
|
|
1170
1219
|
workflow: curatorWorkflow,
|
|
@@ -1228,7 +1277,7 @@ export default function (pi) {
|
|
|
1228
1277
|
});
|
|
1229
1278
|
const requestedProvider = pc.searchProvider;
|
|
1230
1279
|
try {
|
|
1231
|
-
const { answer, results, inlineContent, provider } = await
|
|
1280
|
+
const { answer, results, inlineContent, provider } = await runSearch(queryList[qi], {
|
|
1232
1281
|
provider: requestedProvider,
|
|
1233
1282
|
numResults: params.numResults,
|
|
1234
1283
|
recencyFilter: params.recencyFilter,
|
|
@@ -1303,13 +1352,14 @@ export default function (pi) {
|
|
|
1303
1352
|
const allInlineContent = [];
|
|
1304
1353
|
const resolvedProvider = normalizeProviderInput(params.provider ?? loadConfig().provider);
|
|
1305
1354
|
for (let i = 0; i < queryList.length; i++) {
|
|
1355
|
+
assertActiveRequest(generation, signal);
|
|
1306
1356
|
const query = queryList[i];
|
|
1307
1357
|
onUpdate?.({
|
|
1308
1358
|
content: [{ type: "text", text: `Searching ${i + 1}/${queryList.length}: "${query}"...` }],
|
|
1309
1359
|
details: { phase: "search", progress: i / queryList.length, currentQuery: query },
|
|
1310
1360
|
});
|
|
1311
1361
|
try {
|
|
1312
|
-
const { answer, results, inlineContent, provider } = await
|
|
1362
|
+
const { answer, results, inlineContent, provider } = await runSearch(query, {
|
|
1313
1363
|
provider: resolvedProvider,
|
|
1314
1364
|
numResults: params.numResults,
|
|
1315
1365
|
recencyFilter: params.recencyFilter,
|
|
@@ -1318,6 +1368,7 @@ export default function (pi) {
|
|
|
1318
1368
|
signal,
|
|
1319
1369
|
extensionContext: ctx,
|
|
1320
1370
|
});
|
|
1371
|
+
assertActiveRequest(generation, signal);
|
|
1321
1372
|
searchResults.push({ query, answer, results, error: null, provider });
|
|
1322
1373
|
for (const r of results) {
|
|
1323
1374
|
if (!allUrls.includes(r.url)) {
|
|
@@ -1328,6 +1379,7 @@ export default function (pi) {
|
|
|
1328
1379
|
allInlineContent.push(...inlineContent);
|
|
1329
1380
|
}
|
|
1330
1381
|
catch (err) {
|
|
1382
|
+
assertActiveRequest(generation, signal);
|
|
1331
1383
|
const message = err instanceof Error ? err.message : String(err);
|
|
1332
1384
|
const requestedProvider = typeof resolvedProvider === "string" && resolvedProvider !== "auto"
|
|
1333
1385
|
? resolvedProvider
|
|
@@ -1355,10 +1407,12 @@ export default function (pi) {
|
|
|
1355
1407
|
isProjectTrusted: () => ctx.isProjectTrusted(),
|
|
1356
1408
|
};
|
|
1357
1409
|
const summaryModelChoices = await loadSummaryModelChoices(summaryContext);
|
|
1358
|
-
const
|
|
1410
|
+
const summaryReview = await ensureSummaryReview();
|
|
1411
|
+
const generated = await summaryReview.generateSummaryDraft(searchResults, summaryContext, signal, summaryModelChoices.defaultSummaryModel ?? undefined);
|
|
1359
1412
|
approvedSummary = generated.summary;
|
|
1360
1413
|
summaryMeta = generated.meta;
|
|
1361
1414
|
}
|
|
1415
|
+
assertActiveRequest(generation, signal);
|
|
1362
1416
|
return buildSearchReturn({
|
|
1363
1417
|
queryList,
|
|
1364
1418
|
results: searchResults,
|
|
@@ -1479,7 +1533,10 @@ export default function (pi) {
|
|
|
1479
1533
|
description: "Override the Gemini model for video/YouTube analysis (e.g. 'gemini-2.5-flash', 'gemini-3-flash-preview'). Defaults to config or gemini-3-flash-preview.",
|
|
1480
1534
|
})),
|
|
1481
1535
|
}),
|
|
1482
|
-
async execute(_toolCallId, params,
|
|
1536
|
+
async execute(_toolCallId, params, incomingSignal, onUpdate) {
|
|
1537
|
+
const generation = sessionGeneration;
|
|
1538
|
+
const signal = incomingSignal ? AbortSignal.any([incomingSignal, sessionAbort.signal]) : sessionAbort.signal;
|
|
1539
|
+
assertActiveRequest(generation, signal);
|
|
1483
1540
|
const { urlList, options } = normalizeFetchContentParams(params);
|
|
1484
1541
|
if (urlList.length === 0) {
|
|
1485
1542
|
return {
|
|
@@ -1491,7 +1548,15 @@ export default function (pi) {
|
|
|
1491
1548
|
content: [{ type: "text", text: `Fetching ${urlList.length} URL(s)...` }],
|
|
1492
1549
|
details: { phase: "fetch", progress: 0 },
|
|
1493
1550
|
});
|
|
1551
|
+
const { fetchAllContent } = await loadExtract();
|
|
1552
|
+
if (signal?.aborted) {
|
|
1553
|
+
return {
|
|
1554
|
+
content: [{ type: "text", text: "Error: Aborted" }],
|
|
1555
|
+
details: { error: "Aborted", urls: urlList, urlCount: urlList.length, successful: 0 },
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1494
1558
|
const fetchResults = await fetchAllContent(urlList, signal, options);
|
|
1559
|
+
assertActiveRequest(generation, signal);
|
|
1495
1560
|
const successful = fetchResults.filter((r) => !r.error).length;
|
|
1496
1561
|
const totalChars = fetchResults.reduce((sum, r) => sum + r.content.length, 0);
|
|
1497
1562
|
// ALWAYS store results (even for single URL)
|
|
@@ -1776,6 +1841,8 @@ export default function (pi) {
|
|
|
1776
1841
|
pi.registerCommand("websearch", {
|
|
1777
1842
|
description: "Open web search curator",
|
|
1778
1843
|
handler: async (args, ctx) => {
|
|
1844
|
+
const generation = sessionGeneration;
|
|
1845
|
+
const sessionSignal = sessionAbort.signal;
|
|
1779
1846
|
const sessionToken = randomUUID();
|
|
1780
1847
|
const commandCallId = `cmd:${sessionToken}`;
|
|
1781
1848
|
closeCurator(commandCallId);
|
|
@@ -1788,10 +1855,14 @@ export default function (pi) {
|
|
|
1788
1855
|
bootstrap = await loadCuratorBootstrap(undefined, ctx);
|
|
1789
1856
|
}
|
|
1790
1857
|
catch (err) {
|
|
1858
|
+
if (generation !== sessionGeneration)
|
|
1859
|
+
return;
|
|
1791
1860
|
const message = err instanceof Error ? err.message : String(err);
|
|
1792
1861
|
ctx.ui.notify(`Failed to load web search config: ${message}`, "error");
|
|
1793
1862
|
return;
|
|
1794
1863
|
}
|
|
1864
|
+
if (generation !== sessionGeneration)
|
|
1865
|
+
return;
|
|
1795
1866
|
const availableProviders = bootstrap.availableProviders;
|
|
1796
1867
|
const initialProvider = bootstrap.defaultProvider;
|
|
1797
1868
|
const curatorTimeoutSeconds = bootstrap.timeoutSeconds;
|
|
@@ -1805,12 +1876,15 @@ export default function (pi) {
|
|
|
1805
1876
|
isProjectTrusted: () => ctx.isProjectTrusted(),
|
|
1806
1877
|
};
|
|
1807
1878
|
const summaryModelChoices = await loadSummaryModelChoices(summaryContext);
|
|
1879
|
+
if (generation !== sessionGeneration)
|
|
1880
|
+
return;
|
|
1808
1881
|
ctx.ui.notify("Opening web search curator...", "info");
|
|
1809
1882
|
const collected = new Map();
|
|
1810
1883
|
const searchAbort = new AbortController();
|
|
1884
|
+
const searchSignal = AbortSignal.any([searchAbort.signal, sessionSignal]);
|
|
1811
1885
|
let aborted = false;
|
|
1812
1886
|
let commandHandle = null;
|
|
1813
|
-
const isCommandActive = () => commandHandle
|
|
1887
|
+
const isCommandActive = () => generation === sessionGeneration && (commandHandle === null || activeCurators.get(commandCallId) === commandHandle);
|
|
1814
1888
|
function sendFollowUpFromReturn(payload) {
|
|
1815
1889
|
pi.sendMessage({
|
|
1816
1890
|
customType: "web-search-results",
|
|
@@ -1820,6 +1894,12 @@ export default function (pi) {
|
|
|
1820
1894
|
}, { triggerTurn: true, deliverAs: "followUp" });
|
|
1821
1895
|
}
|
|
1822
1896
|
try {
|
|
1897
|
+
const [{ startCuratorServer }] = await Promise.all([
|
|
1898
|
+
loadCuratorServer(),
|
|
1899
|
+
ensureSummaryReview(),
|
|
1900
|
+
]);
|
|
1901
|
+
if (!isCommandActive())
|
|
1902
|
+
return;
|
|
1823
1903
|
const handle = await startCuratorServer({
|
|
1824
1904
|
queries,
|
|
1825
1905
|
sessionToken,
|
|
@@ -1831,13 +1911,13 @@ export default function (pi) {
|
|
|
1831
1911
|
defaultSummaryModel: summaryModelChoices.defaultSummaryModel,
|
|
1832
1912
|
}, {
|
|
1833
1913
|
async onSummarize(selectedQueryIndices, summarizeSignal, model, feedback) {
|
|
1834
|
-
if (
|
|
1914
|
+
if (!isCommandActive()) {
|
|
1835
1915
|
throw new Error("Curator session is no longer active.");
|
|
1836
1916
|
}
|
|
1837
1917
|
return generateSummaryForSelectedIndices(selectedQueryIndices, collected, summaryContext, summarizeSignal, model, feedback);
|
|
1838
1918
|
},
|
|
1839
1919
|
onSubmit(payload) {
|
|
1840
|
-
if (
|
|
1920
|
+
if (!isCommandActive())
|
|
1841
1921
|
return;
|
|
1842
1922
|
aborted = true;
|
|
1843
1923
|
searchAbort.abort();
|
|
@@ -1862,7 +1942,7 @@ export default function (pi) {
|
|
|
1862
1942
|
closeCurator(commandCallId);
|
|
1863
1943
|
},
|
|
1864
1944
|
onCancel(reason) {
|
|
1865
|
-
if (
|
|
1945
|
+
if (!isCommandActive())
|
|
1866
1946
|
return;
|
|
1867
1947
|
aborted = true;
|
|
1868
1948
|
searchAbort.abort();
|
|
@@ -1884,7 +1964,7 @@ export default function (pi) {
|
|
|
1884
1964
|
closeCurator(commandCallId);
|
|
1885
1965
|
},
|
|
1886
1966
|
onProviderChange(provider) {
|
|
1887
|
-
if (
|
|
1967
|
+
if (!isCommandActive())
|
|
1888
1968
|
return;
|
|
1889
1969
|
const normalized = normalizeProviderInput(provider);
|
|
1890
1970
|
if (!normalized || normalized === "auto")
|
|
@@ -1900,7 +1980,7 @@ export default function (pi) {
|
|
|
1900
1980
|
}
|
|
1901
1981
|
},
|
|
1902
1982
|
async onAddSearch(query, queryIndex, provider) {
|
|
1903
|
-
if (
|
|
1983
|
+
if (!isCommandActive()) {
|
|
1904
1984
|
throw new Error("Curator session is no longer active.");
|
|
1905
1985
|
}
|
|
1906
1986
|
const normalizedProvider = normalizeProviderInput(provider);
|
|
@@ -1908,12 +1988,12 @@ export default function (pi) {
|
|
|
1908
1988
|
? currentSearchProvider
|
|
1909
1989
|
: normalizedProvider;
|
|
1910
1990
|
try {
|
|
1911
|
-
const { answer, results, provider: actualProvider } = await
|
|
1991
|
+
const { answer, results, provider: actualProvider } = await runSearch(query, {
|
|
1912
1992
|
provider: requestedProvider,
|
|
1913
|
-
signal:
|
|
1993
|
+
signal: searchSignal,
|
|
1914
1994
|
extensionContext: ctx,
|
|
1915
1995
|
});
|
|
1916
|
-
if (
|
|
1996
|
+
if (!isCommandActive()) {
|
|
1917
1997
|
throw new Error("Curator session is no longer active.");
|
|
1918
1998
|
}
|
|
1919
1999
|
collected.set(queryIndex, { query, answer, results, error: null, provider: actualProvider });
|
|
@@ -1925,22 +2005,28 @@ export default function (pi) {
|
|
|
1925
2005
|
}
|
|
1926
2006
|
catch (err) {
|
|
1927
2007
|
const message = err instanceof Error ? err.message : String(err);
|
|
1928
|
-
if (
|
|
2008
|
+
if (isCommandActive()) {
|
|
1929
2009
|
collected.set(queryIndex, { query, answer: "", results: [], error: message, provider: requestedProvider });
|
|
1930
2010
|
}
|
|
1931
2011
|
throw err;
|
|
1932
2012
|
}
|
|
1933
2013
|
},
|
|
1934
2014
|
async onRewriteQuery(query, rewriteSignal) {
|
|
1935
|
-
if (
|
|
2015
|
+
if (!isCommandActive()) {
|
|
1936
2016
|
throw new Error("Curator session is no longer active.");
|
|
1937
2017
|
}
|
|
1938
2018
|
return rewriteSearchQuery(query, summaryContext, rewriteSignal);
|
|
1939
2019
|
},
|
|
1940
2020
|
});
|
|
2021
|
+
if (!isCommandActive()) {
|
|
2022
|
+
handle.close();
|
|
2023
|
+
return;
|
|
2024
|
+
}
|
|
1941
2025
|
commandHandle = handle;
|
|
1942
2026
|
activeCurators.set(commandCallId, handle);
|
|
1943
2027
|
const open = platform() === "darwin" ? await getGlimpseOpen() : null;
|
|
2028
|
+
if (!isCommandActive())
|
|
2029
|
+
return;
|
|
1944
2030
|
let browserOpenError = null;
|
|
1945
2031
|
if (open) {
|
|
1946
2032
|
try {
|
|
@@ -1973,6 +2059,8 @@ export default function (pi) {
|
|
|
1973
2059
|
browserOpenError = browserErr instanceof Error ? browserErr.message : String(browserErr);
|
|
1974
2060
|
}
|
|
1975
2061
|
}
|
|
2062
|
+
if (!isCommandActive())
|
|
2063
|
+
return;
|
|
1976
2064
|
if (browserOpenError) {
|
|
1977
2065
|
console.error(`Failed to open curator UI: ${browserOpenError}`);
|
|
1978
2066
|
ctx.ui.notify(`Search curator is running, but the browser did not open automatically. Open manually: ${handle.url}`, "info");
|
|
@@ -1984,9 +2072,9 @@ export default function (pi) {
|
|
|
1984
2072
|
break;
|
|
1985
2073
|
const requestedProvider = currentSearchProvider;
|
|
1986
2074
|
try {
|
|
1987
|
-
const { answer, results, provider } = await
|
|
2075
|
+
const { answer, results, provider } = await runSearch(queries[qi], {
|
|
1988
2076
|
provider: requestedProvider,
|
|
1989
|
-
signal:
|
|
2077
|
+
signal: searchSignal,
|
|
1990
2078
|
extensionContext: ctx,
|
|
1991
2079
|
});
|
|
1992
2080
|
if (aborted || !isCommandActive())
|
|
@@ -2017,6 +2105,8 @@ export default function (pi) {
|
|
|
2017
2105
|
}
|
|
2018
2106
|
catch (err) {
|
|
2019
2107
|
closeCurator(commandCallId);
|
|
2108
|
+
if (generation !== sessionGeneration)
|
|
2109
|
+
return;
|
|
2020
2110
|
const message = err instanceof Error ? err.message : String(err);
|
|
2021
2111
|
ctx.ui.notify(`Failed to open curator: ${message}`, "error");
|
|
2022
2112
|
}
|
|
@@ -2077,7 +2167,8 @@ export default function (pi) {
|
|
|
2077
2167
|
}, { triggerTurn: true, deliverAs: "followUp" });
|
|
2078
2168
|
return;
|
|
2079
2169
|
}
|
|
2080
|
-
const
|
|
2170
|
+
const geminiWeb = await loadGeminiWeb();
|
|
2171
|
+
const cookies = await geminiWeb.isGeminiWebAvailable();
|
|
2081
2172
|
if (!cookies) {
|
|
2082
2173
|
pi.sendMessage({
|
|
2083
2174
|
customType: "google-account",
|
|
@@ -2087,7 +2178,7 @@ export default function (pi) {
|
|
|
2087
2178
|
}, { triggerTurn: true, deliverAs: "followUp" });
|
|
2088
2179
|
return;
|
|
2089
2180
|
}
|
|
2090
|
-
const email = await getActiveGoogleEmail(cookies);
|
|
2181
|
+
const email = await geminiWeb.getActiveGoogleEmail(cookies);
|
|
2091
2182
|
const text = email
|
|
2092
2183
|
? `Active Google account: ${email}`
|
|
2093
2184
|
: "Gemini Web is available, but the active Google account could not be determined.";
|