@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
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getAgentPath
|
|
4
|
+
} from "./chunk-4HXHDDCF.js";
|
|
5
|
+
import {
|
|
6
|
+
formatToolName,
|
|
7
|
+
isToolExcluded,
|
|
8
|
+
resourceNameToToolName
|
|
9
|
+
} from "./chunk-ARC4KOTI.js";
|
|
10
|
+
|
|
11
|
+
// packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/config.js
|
|
12
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, renameSync } from "node:fs";
|
|
13
|
+
import { homedir } from "node:os";
|
|
14
|
+
import { dirname, join, resolve } from "node:path";
|
|
15
|
+
var GENERIC_GLOBAL_CONFIG_PATH = join(homedir(), ".config", "mcp", "mcp.json"), PROJECT_CONFIG_NAME = ".mcp.json", PROJECT_LUNR_CONFIG_NAME = ".lunr/mcp.json", LEGACY_PROJECT_PI_CONFIG_NAME = ".pi/mcp.json", REPOPROMPT_BINARY_CANDIDATES = [
|
|
16
|
+
join(homedir(), "RepoPrompt", "repoprompt_cli"),
|
|
17
|
+
"/Applications/Repo Prompt.app/Contents/MacOS/repoprompt-mcp"
|
|
18
|
+
], IMPORT_PATHS = {
|
|
19
|
+
cursor: [join(homedir(), ".cursor", "mcp.json")],
|
|
20
|
+
"claude-code": [
|
|
21
|
+
join(homedir(), ".claude", "mcp.json"),
|
|
22
|
+
join(homedir(), ".claude.json"),
|
|
23
|
+
join(homedir(), ".claude", "claude_desktop_config.json")
|
|
24
|
+
],
|
|
25
|
+
"claude-desktop": [join(homedir(), "Library", "Application Support", "Claude", "claude_desktop_config.json")],
|
|
26
|
+
codex: [join(homedir(), ".codex", "config.json")],
|
|
27
|
+
windsurf: [join(homedir(), ".windsurf", "mcp.json")],
|
|
28
|
+
vscode: [".vscode/mcp.json"]
|
|
29
|
+
};
|
|
30
|
+
function getPiGlobalConfigPath(overridePath) {
|
|
31
|
+
return overridePath ? resolve(overridePath) : getAgentPath("mcp.json");
|
|
32
|
+
}
|
|
33
|
+
function getProjectConfigPath(cwd = process.cwd()) {
|
|
34
|
+
return resolve(cwd, PROJECT_CONFIG_NAME);
|
|
35
|
+
}
|
|
36
|
+
function getProjectPiConfigPath(cwd = process.cwd()) {
|
|
37
|
+
return resolve(cwd, PROJECT_LUNR_CONFIG_NAME);
|
|
38
|
+
}
|
|
39
|
+
function getProjectPiConfigReadPath(cwd = process.cwd()) {
|
|
40
|
+
let lunrPath = getProjectPiConfigPath(cwd);
|
|
41
|
+
if (existsSync(lunrPath))
|
|
42
|
+
return lunrPath;
|
|
43
|
+
let legacyPath = resolve(cwd, LEGACY_PROJECT_PI_CONFIG_NAME);
|
|
44
|
+
return existsSync(legacyPath) ? legacyPath : lunrPath;
|
|
45
|
+
}
|
|
46
|
+
function getMcpDiscoverySummary(overridePath, cwd = process.cwd()) {
|
|
47
|
+
let sources = getConfigSources(overridePath, cwd).map((source) => {
|
|
48
|
+
let loaded = readValidatedConfig(source.readPath, `MCP config from ${source.readPath}`);
|
|
49
|
+
return {
|
|
50
|
+
id: source.id,
|
|
51
|
+
label: source.label,
|
|
52
|
+
path: source.readPath,
|
|
53
|
+
exists: existsSync(source.readPath),
|
|
54
|
+
scope: source.scope,
|
|
55
|
+
kind: source.shared ? "shared" : "pi",
|
|
56
|
+
serverCount: loaded ? Object.keys(loaded.mcpServers).length : 0
|
|
57
|
+
};
|
|
58
|
+
}), imports = Object.keys(IMPORT_PATHS).map((kind) => {
|
|
59
|
+
let path = resolveImportPath(kind, cwd);
|
|
60
|
+
return path ? {
|
|
61
|
+
kind,
|
|
62
|
+
path,
|
|
63
|
+
serverCount: getImportServerCount(kind, path)
|
|
64
|
+
} : null;
|
|
65
|
+
}).filter((value) => value !== null), totalServerCount = sources.reduce((sum, source) => sum + source.serverCount, 0), hasSharedServers = sources.some((source) => source.kind === "shared" && source.serverCount > 0), hasPiOwnedServers = sources.some((source) => source.kind === "pi" && source.serverCount > 0), hasAnyDetectedPaths = sources.some((source) => source.exists) || imports.length > 0, hasAnyConfig = totalServerCount > 0 || imports.some((entry) => entry.serverCount > 0) || hasAnyDetectedPaths, summaryWithoutRepoPrompt = {
|
|
66
|
+
sources,
|
|
67
|
+
imports,
|
|
68
|
+
hasAnyConfig,
|
|
69
|
+
hasAnyDetectedPaths,
|
|
70
|
+
hasSharedServers,
|
|
71
|
+
hasPiOwnedServers,
|
|
72
|
+
totalServerCount
|
|
73
|
+
}, fingerprint = JSON.stringify({
|
|
74
|
+
sources: sources.map((source) => [source.id, source.exists, source.serverCount]),
|
|
75
|
+
imports: imports.map((entry) => [entry.kind, entry.path, entry.serverCount])
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
...summaryWithoutRepoPrompt,
|
|
79
|
+
fingerprint,
|
|
80
|
+
repoPrompt: detectRepoPrompt(summaryWithoutRepoPrompt, cwd)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function loadMcpConfig(overridePath, cwd = process.cwd()) {
|
|
84
|
+
let config = { mcpServers: {} };
|
|
85
|
+
for (let source of getConfigSources(overridePath, cwd)) {
|
|
86
|
+
let loaded = readValidatedConfig(source.readPath, `MCP config from ${source.readPath}`);
|
|
87
|
+
loaded && (config = mergeConfigs(config, expandImports(loaded, cwd)));
|
|
88
|
+
}
|
|
89
|
+
return config;
|
|
90
|
+
}
|
|
91
|
+
function getConfigSources(overridePath, cwd = process.cwd()) {
|
|
92
|
+
let userPath = getPiGlobalConfigPath(overridePath), projectPath = getProjectConfigPath(cwd), projectPiPath = getProjectPiConfigPath(cwd), projectPiReadPath = getProjectPiConfigReadPath(cwd), sources = [];
|
|
93
|
+
return GENERIC_GLOBAL_CONFIG_PATH !== userPath && sources.push({
|
|
94
|
+
id: "shared-global",
|
|
95
|
+
label: "user-global standard MCP",
|
|
96
|
+
readPath: GENERIC_GLOBAL_CONFIG_PATH,
|
|
97
|
+
writePath: userPath,
|
|
98
|
+
kind: "import",
|
|
99
|
+
importKind: "global MCP config",
|
|
100
|
+
shared: !0,
|
|
101
|
+
scope: "global"
|
|
102
|
+
}), sources.push({
|
|
103
|
+
id: "pi-global",
|
|
104
|
+
label: "Pi global override",
|
|
105
|
+
readPath: userPath,
|
|
106
|
+
writePath: userPath,
|
|
107
|
+
kind: "user",
|
|
108
|
+
shared: !1,
|
|
109
|
+
scope: "global"
|
|
110
|
+
}), projectPath !== userPath && sources.push({
|
|
111
|
+
id: "shared-project",
|
|
112
|
+
label: "project standard MCP",
|
|
113
|
+
readPath: projectPath,
|
|
114
|
+
writePath: projectPath,
|
|
115
|
+
kind: "project",
|
|
116
|
+
shared: !0,
|
|
117
|
+
scope: "project"
|
|
118
|
+
}), projectPiPath !== userPath && projectPiPath !== projectPath && sources.push({
|
|
119
|
+
id: "pi-project",
|
|
120
|
+
label: "project Pi override",
|
|
121
|
+
readPath: projectPiReadPath,
|
|
122
|
+
writePath: projectPiPath,
|
|
123
|
+
kind: "project",
|
|
124
|
+
shared: !1,
|
|
125
|
+
scope: "project"
|
|
126
|
+
}), sources;
|
|
127
|
+
}
|
|
128
|
+
function mergeConfigs(base, next) {
|
|
129
|
+
return {
|
|
130
|
+
mcpServers: mergeServerMaps(base.mcpServers, next.mcpServers),
|
|
131
|
+
imports: mergeImports(base.imports, next.imports),
|
|
132
|
+
settings: next.settings ? { ...base.settings, ...next.settings } : base.settings
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function mergeServerMaps(base, next) {
|
|
136
|
+
let merged = { ...base };
|
|
137
|
+
for (let [name, definition] of Object.entries(next))
|
|
138
|
+
merged[name] = { ...merged[name] ?? {}, ...definition };
|
|
139
|
+
return merged;
|
|
140
|
+
}
|
|
141
|
+
function mergeImports(left, right) {
|
|
142
|
+
let merged = [...left ?? [], ...right ?? []];
|
|
143
|
+
if (merged.length !== 0)
|
|
144
|
+
return [...new Set(merged)];
|
|
145
|
+
}
|
|
146
|
+
function expandImports(config, cwd = process.cwd()) {
|
|
147
|
+
if (!config.imports?.length)
|
|
148
|
+
return config;
|
|
149
|
+
let importedServers = {};
|
|
150
|
+
for (let importKind of config.imports) {
|
|
151
|
+
let importPath = resolveImportPath(importKind, cwd);
|
|
152
|
+
if (importPath)
|
|
153
|
+
try {
|
|
154
|
+
let imported = JSON.parse(readFileSync(importPath, "utf-8")), servers = extractServers(imported, importKind);
|
|
155
|
+
for (let [name, definition] of Object.entries(servers))
|
|
156
|
+
importedServers[name] || (importedServers[name] = definition);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.warn(`Failed to import MCP config from ${importKind}:`, error);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
imports: config.imports,
|
|
163
|
+
settings: config.settings,
|
|
164
|
+
mcpServers: mergeServerMaps(importedServers, config.mcpServers)
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function resolveImportPath(importKind, cwd = process.cwd()) {
|
|
168
|
+
let candidates = IMPORT_PATHS[importKind] ?? [];
|
|
169
|
+
for (let candidate of candidates) {
|
|
170
|
+
let fullPath = candidate.startsWith(".") ? resolve(cwd, candidate) : candidate;
|
|
171
|
+
if (existsSync(fullPath))
|
|
172
|
+
return fullPath;
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
function getImportServerCount(importKind, path) {
|
|
177
|
+
try {
|
|
178
|
+
let raw = JSON.parse(readFileSync(path, "utf-8"));
|
|
179
|
+
return Object.keys(extractServers(raw, importKind)).length;
|
|
180
|
+
} catch {
|
|
181
|
+
return 0;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function readValidatedConfig(path, label) {
|
|
185
|
+
if (!existsSync(path))
|
|
186
|
+
return null;
|
|
187
|
+
try {
|
|
188
|
+
return validateConfig(JSON.parse(readFileSync(path, "utf-8")));
|
|
189
|
+
} catch (error) {
|
|
190
|
+
return console.warn(`Failed to load ${label}:`, error), null;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function validateConfig(raw) {
|
|
194
|
+
if (!raw || typeof raw != "object")
|
|
195
|
+
return { mcpServers: {} };
|
|
196
|
+
let obj = raw, servers = obj.mcpServers ?? obj["mcp-servers"] ?? {};
|
|
197
|
+
return typeof servers != "object" || servers === null || Array.isArray(servers) ? { mcpServers: {} } : {
|
|
198
|
+
mcpServers: servers,
|
|
199
|
+
imports: Array.isArray(obj.imports) ? obj.imports : void 0,
|
|
200
|
+
settings: obj.settings
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function extractServers(config, kind) {
|
|
204
|
+
if (!config || typeof config != "object")
|
|
205
|
+
return {};
|
|
206
|
+
let obj = config, servers;
|
|
207
|
+
switch (kind) {
|
|
208
|
+
case "claude-desktop":
|
|
209
|
+
case "claude-code":
|
|
210
|
+
case "codex":
|
|
211
|
+
servers = obj.mcpServers;
|
|
212
|
+
break;
|
|
213
|
+
case "cursor":
|
|
214
|
+
case "windsurf":
|
|
215
|
+
case "vscode":
|
|
216
|
+
servers = obj.mcpServers ?? obj["mcp-servers"];
|
|
217
|
+
break;
|
|
218
|
+
default:
|
|
219
|
+
return {};
|
|
220
|
+
}
|
|
221
|
+
return !servers || typeof servers != "object" || Array.isArray(servers) ? {} : servers;
|
|
222
|
+
}
|
|
223
|
+
function serializeRawConfig(raw) {
|
|
224
|
+
return `${JSON.stringify(raw, null, 2)}
|
|
225
|
+
`;
|
|
226
|
+
}
|
|
227
|
+
function buildUnifiedDiff(beforeText, afterText) {
|
|
228
|
+
if (beforeText === afterText)
|
|
229
|
+
return "(no changes)";
|
|
230
|
+
let before = beforeText.split(`
|
|
231
|
+
`), after = afterText.split(`
|
|
232
|
+
`), rows = before.length, cols = after.length, lcs = Array.from({ length: rows + 1 }, () => Array(cols + 1).fill(0));
|
|
233
|
+
for (let i2 = rows - 1; i2 >= 0; i2--)
|
|
234
|
+
for (let j2 = cols - 1; j2 >= 0; j2--)
|
|
235
|
+
lcs[i2][j2] = before[i2] === after[j2] ? lcs[i2 + 1][j2 + 1] + 1 : Math.max(lcs[i2 + 1][j2], lcs[i2][j2 + 1]);
|
|
236
|
+
let lines = ["--- before", "+++ after"], i = 0, j = 0;
|
|
237
|
+
for (; i < rows || j < cols; ) {
|
|
238
|
+
if (i < rows && j < cols && before[i] === after[j]) {
|
|
239
|
+
lines.push(` ${before[i]}`), i++, j++;
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
if (j < cols && (i === rows || lcs[i][j + 1] >= lcs[i + 1][j])) {
|
|
243
|
+
lines.push(`+ ${after[j]}`), j++;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
i < rows && (lines.push(`- ${before[i]}`), i++);
|
|
247
|
+
}
|
|
248
|
+
return lines.join(`
|
|
249
|
+
`);
|
|
250
|
+
}
|
|
251
|
+
function buildConfigWritePreview(filePath, nextRaw) {
|
|
252
|
+
let existed = existsSync(filePath), beforeRaw = readRawConfigObject(filePath), beforeText = existed ? serializeRawConfig(beforeRaw) : "", afterText = serializeRawConfig(nextRaw);
|
|
253
|
+
return {
|
|
254
|
+
path: filePath,
|
|
255
|
+
existed,
|
|
256
|
+
changed: beforeText !== afterText,
|
|
257
|
+
beforeText,
|
|
258
|
+
afterText,
|
|
259
|
+
diffText: buildUnifiedDiff(beforeText, afterText)
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function readRawConfigObject(filePath) {
|
|
263
|
+
if (!existsSync(filePath))
|
|
264
|
+
return {};
|
|
265
|
+
try {
|
|
266
|
+
let raw = JSON.parse(readFileSync(filePath, "utf-8"));
|
|
267
|
+
return raw && typeof raw == "object" && !Array.isArray(raw) ? raw : {};
|
|
268
|
+
} catch {
|
|
269
|
+
return {};
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function writeRawConfigObject(filePath, raw) {
|
|
273
|
+
mkdirSync(dirname(filePath), { recursive: !0 });
|
|
274
|
+
let tmpPath = `${filePath}.${process.pid}.tmp`;
|
|
275
|
+
writeFileSync(tmpPath, `${JSON.stringify(raw, null, 2)}
|
|
276
|
+
`, "utf-8"), renameSync(tmpPath, filePath);
|
|
277
|
+
}
|
|
278
|
+
function getServersObject(raw) {
|
|
279
|
+
let existing = raw.mcpServers ?? raw["mcp-servers"] ?? {};
|
|
280
|
+
return !existing || typeof existing != "object" || Array.isArray(existing) ? {} : existing;
|
|
281
|
+
}
|
|
282
|
+
function setServersObject(raw, servers) {
|
|
283
|
+
delete raw["mcp-servers"], raw.mcpServers = servers;
|
|
284
|
+
}
|
|
285
|
+
function isRepoPromptServer(name, entry) {
|
|
286
|
+
let normalizedName = name.toLowerCase();
|
|
287
|
+
if (normalizedName.includes("repoprompt") || normalizedName === "rp")
|
|
288
|
+
return !0;
|
|
289
|
+
let command = entry.command?.toLowerCase() ?? "";
|
|
290
|
+
return command.includes("repoprompt") || command.includes("rp-mcp") || command.endsWith("repoprompt_cli") ? !0 : (entry.args ?? []).some((arg) => typeof arg == "string" && arg.toLowerCase().includes("repoprompt"));
|
|
291
|
+
}
|
|
292
|
+
function findProjectRoot(cwd = process.cwd()) {
|
|
293
|
+
let current = resolve(cwd);
|
|
294
|
+
for (; ; ) {
|
|
295
|
+
if (existsSync(join(current, ".git")) || existsSync(join(current, "package.json")) || existsSync(join(current, PROJECT_CONFIG_NAME)) || existsSync(join(current, ".pi")) || existsSync(join(current, ".lunr")))
|
|
296
|
+
return current;
|
|
297
|
+
let parent = dirname(current);
|
|
298
|
+
if (parent === current)
|
|
299
|
+
return null;
|
|
300
|
+
current = parent;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function buildRepoPromptEntry(executablePath) {
|
|
304
|
+
return {
|
|
305
|
+
command: executablePath,
|
|
306
|
+
args: [],
|
|
307
|
+
lifecycle: "lazy"
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function detectRepoPrompt(summary, cwd = process.cwd()) {
|
|
311
|
+
for (let source of summary.sources) {
|
|
312
|
+
if (source.kind !== "shared" || source.serverCount === 0)
|
|
313
|
+
continue;
|
|
314
|
+
let config = readValidatedConfig(source.path, `MCP config from ${source.path}`);
|
|
315
|
+
if (config) {
|
|
316
|
+
for (let [name, entry] of Object.entries(config.mcpServers))
|
|
317
|
+
if (isRepoPromptServer(name, entry))
|
|
318
|
+
return { configured: !0, configuredPath: source.path };
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
let executablePath = REPOPROMPT_BINARY_CANDIDATES.find((candidate) => existsSync(candidate));
|
|
322
|
+
if (!executablePath)
|
|
323
|
+
return { configured: !1 };
|
|
324
|
+
let projectRoot = findProjectRoot(cwd), targetPath = projectRoot ? join(projectRoot, PROJECT_CONFIG_NAME) : GENERIC_GLOBAL_CONFIG_PATH;
|
|
325
|
+
return {
|
|
326
|
+
configured: !1,
|
|
327
|
+
executablePath,
|
|
328
|
+
targetPath,
|
|
329
|
+
serverName: "repoprompt",
|
|
330
|
+
entry: buildRepoPromptEntry(executablePath)
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function previewCompatibilityImports(importKinds, overridePath) {
|
|
334
|
+
let targetPath = getPiGlobalConfigPath(overridePath), raw = readRawConfigObject(targetPath), currentImports = Array.isArray(raw.imports) ? raw.imports.filter((value) => typeof value == "string") : [], merged = [.../* @__PURE__ */ new Set([...currentImports, ...importKinds])], nextRaw = { ...raw, imports: merged };
|
|
335
|
+
return setServersObject(nextRaw, getServersObject(nextRaw)), buildConfigWritePreview(targetPath, nextRaw);
|
|
336
|
+
}
|
|
337
|
+
function ensureCompatibilityImports(importKinds, overridePath) {
|
|
338
|
+
let targetPath = getPiGlobalConfigPath(overridePath), raw = readRawConfigObject(targetPath), currentImports = Array.isArray(raw.imports) ? raw.imports.filter((value) => typeof value == "string") : [], merged = [.../* @__PURE__ */ new Set([...currentImports, ...importKinds])], added = merged.filter((kind) => !currentImports.includes(kind));
|
|
339
|
+
if (added.length === 0)
|
|
340
|
+
return { path: targetPath, added: [] };
|
|
341
|
+
raw.imports = merged;
|
|
342
|
+
let servers = getServersObject(raw);
|
|
343
|
+
return setServersObject(raw, servers), writeRawConfigObject(targetPath, raw), { path: targetPath, added };
|
|
344
|
+
}
|
|
345
|
+
function buildStarterProjectConfig() {
|
|
346
|
+
return {
|
|
347
|
+
mcpServers: {}
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function previewStarterProjectConfig(cwd = process.cwd()) {
|
|
351
|
+
let targetPath = getProjectConfigPath(cwd), nextRaw = { mcpServers: buildStarterProjectConfig().mcpServers };
|
|
352
|
+
return buildConfigWritePreview(targetPath, nextRaw);
|
|
353
|
+
}
|
|
354
|
+
function writeStarterProjectConfig(cwd = process.cwd()) {
|
|
355
|
+
let targetPath = getProjectConfigPath(cwd), raw = { mcpServers: buildStarterProjectConfig().mcpServers };
|
|
356
|
+
return writeRawConfigObject(targetPath, raw), targetPath;
|
|
357
|
+
}
|
|
358
|
+
function previewSharedServerEntry(filePath, serverName, entry) {
|
|
359
|
+
let nextRaw = { ...readRawConfigObject(filePath) }, servers = getServersObject(nextRaw);
|
|
360
|
+
return servers[serverName] = entry, setServersObject(nextRaw, servers), buildConfigWritePreview(filePath, nextRaw);
|
|
361
|
+
}
|
|
362
|
+
function writeSharedServerEntry(filePath, serverName, entry) {
|
|
363
|
+
let raw = readRawConfigObject(filePath), servers = getServersObject(raw);
|
|
364
|
+
return servers[serverName] = entry, setServersObject(raw, servers), writeRawConfigObject(filePath, raw), filePath;
|
|
365
|
+
}
|
|
366
|
+
function getServerProvenance(overridePath, cwd = process.cwd()) {
|
|
367
|
+
let provenance = /* @__PURE__ */ new Map(), userPath = getPiGlobalConfigPath(overridePath);
|
|
368
|
+
for (let source of getConfigSources(overridePath, cwd)) {
|
|
369
|
+
let loaded = readValidatedConfig(source.readPath, `MCP config from ${source.readPath}`);
|
|
370
|
+
if (loaded) {
|
|
371
|
+
if (loaded.imports?.length)
|
|
372
|
+
for (let importKind of loaded.imports) {
|
|
373
|
+
let importPath = resolveImportPath(importKind, cwd);
|
|
374
|
+
if (importPath)
|
|
375
|
+
try {
|
|
376
|
+
let imported = JSON.parse(readFileSync(importPath, "utf-8")), servers = extractServers(imported, importKind);
|
|
377
|
+
for (let name of Object.keys(servers))
|
|
378
|
+
provenance.has(name) || provenance.set(name, { path: userPath, kind: "import", importKind });
|
|
379
|
+
} catch {
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
for (let name of Object.keys(loaded.mcpServers))
|
|
383
|
+
provenance.set(name, {
|
|
384
|
+
path: source.writePath,
|
|
385
|
+
kind: source.kind,
|
|
386
|
+
importKind: source.importKind
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return provenance;
|
|
391
|
+
}
|
|
392
|
+
function writeDirectToolsConfig(changes, provenance, fullConfig) {
|
|
393
|
+
let byPath = /* @__PURE__ */ new Map();
|
|
394
|
+
for (let [serverName, value] of changes) {
|
|
395
|
+
let prov = provenance.get(serverName);
|
|
396
|
+
if (!prov)
|
|
397
|
+
continue;
|
|
398
|
+
let targetPath = prov.path;
|
|
399
|
+
byPath.has(targetPath) || byPath.set(targetPath, []), byPath.get(targetPath).push({ name: serverName, value, prov });
|
|
400
|
+
}
|
|
401
|
+
for (let [filePath, entries] of byPath) {
|
|
402
|
+
let raw = readRawConfigObject(filePath), servers = getServersObject(raw);
|
|
403
|
+
for (let { name, value, prov } of entries)
|
|
404
|
+
if (prov.kind === "import") {
|
|
405
|
+
let fullDef = fullConfig.mcpServers[name];
|
|
406
|
+
fullDef && (servers[name] = { ...fullDef, directTools: value });
|
|
407
|
+
} else servers[name] && (servers[name] = { ...servers[name], directTools: value });
|
|
408
|
+
setServersObject(raw, servers), writeRawConfigObject(filePath, raw);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/utils.js
|
|
413
|
+
import { homedir as homedir2, platform } from "node:os";
|
|
414
|
+
import { join as join2 } from "node:path";
|
|
415
|
+
async function execOpen(pi, target, browser) {
|
|
416
|
+
let os = platform();
|
|
417
|
+
return os === "darwin" ? browser ? pi.exec("open", ["-a", browser, target]) : pi.exec("open", [target]) : os === "win32" ? browser ? pi.exec("cmd", ["/c", "start", "", browser, target]) : pi.exec("cmd", ["/c", "start", "", target]) : browser ? pi.exec(browser, [target]) : pi.exec("xdg-open", [target]);
|
|
418
|
+
}
|
|
419
|
+
async function openUrl(pi, url, browser) {
|
|
420
|
+
let result = await execOpen(pi, url, browser);
|
|
421
|
+
if (result.code !== 0)
|
|
422
|
+
throw new Error(result.stderr || `Failed to open browser (exit code ${result.code})`);
|
|
423
|
+
}
|
|
424
|
+
async function openPath(pi, targetPath) {
|
|
425
|
+
let result = await execOpen(pi, targetPath);
|
|
426
|
+
if (result.code !== 0)
|
|
427
|
+
throw new Error(result.stderr || `Failed to open path (exit code ${result.code})`);
|
|
428
|
+
}
|
|
429
|
+
async function parallelLimit(items, limit, fn) {
|
|
430
|
+
let results = [], index = 0;
|
|
431
|
+
async function worker() {
|
|
432
|
+
for (; index < items.length; ) {
|
|
433
|
+
let i = index++;
|
|
434
|
+
results[i] = await fn(items[i]);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
let workers = Array(Math.min(limit, items.length)).fill(null).map(() => worker());
|
|
438
|
+
return await Promise.all(workers), results;
|
|
439
|
+
}
|
|
440
|
+
function getConfigPathFromArgv() {
|
|
441
|
+
let idx = process.argv.indexOf("--mcp-config");
|
|
442
|
+
if (idx >= 0 && idx + 1 < process.argv.length)
|
|
443
|
+
return process.argv[idx + 1];
|
|
444
|
+
}
|
|
445
|
+
function interpolateEnvVars(value) {
|
|
446
|
+
return value.replace(/\$\{(\w+)\}/g, (_, name) => process.env[name] ?? "").replace(/\$env:(\w+)/g, (_, name) => process.env[name] ?? "");
|
|
447
|
+
}
|
|
448
|
+
function interpolateEnvRecord(values) {
|
|
449
|
+
if (!values)
|
|
450
|
+
return;
|
|
451
|
+
let resolved = {};
|
|
452
|
+
for (let [key, value] of Object.entries(values))
|
|
453
|
+
resolved[key] = interpolateEnvVars(value);
|
|
454
|
+
return resolved;
|
|
455
|
+
}
|
|
456
|
+
function resolveConfigPath(value) {
|
|
457
|
+
if (value === void 0)
|
|
458
|
+
return;
|
|
459
|
+
let resolved = interpolateEnvVars(value);
|
|
460
|
+
return resolved === "~" ? homedir2() : resolved.startsWith("~/") || resolved.startsWith("~\\") ? join2(homedir2(), resolved.slice(2)) : resolved;
|
|
461
|
+
}
|
|
462
|
+
function resolveBearerToken(definition) {
|
|
463
|
+
return definition.bearerToken !== void 0 ? interpolateEnvVars(definition.bearerToken) : definition.bearerTokenEnv ? process.env[definition.bearerTokenEnv] : void 0;
|
|
464
|
+
}
|
|
465
|
+
function truncateAtWord(text, target) {
|
|
466
|
+
if (!text || text.length <= target)
|
|
467
|
+
return text;
|
|
468
|
+
let truncated = text.slice(0, target), lastSpace = truncated.lastIndexOf(" ");
|
|
469
|
+
return lastSpace > target * 0.6 ? truncated.slice(0, lastSpace) + "..." : truncated + "...";
|
|
470
|
+
}
|
|
471
|
+
function normalizeDirectToolInputSchema(schema) {
|
|
472
|
+
let inputSchema = schema && typeof schema == "object" && !Array.isArray(schema) ? schema : { type: "object", properties: {} }, { $schema, additionalProperties, ...normalized } = inputSchema;
|
|
473
|
+
return normalized;
|
|
474
|
+
}
|
|
475
|
+
function formatAuthRequiredMessage(config, serverName, defaultMessage) {
|
|
476
|
+
let template = config.settings?.authRequiredMessage;
|
|
477
|
+
return template ? template.replaceAll("${server}", serverName) : defaultMessage;
|
|
478
|
+
}
|
|
479
|
+
function extractToolUiStreamMode(toolMeta) {
|
|
480
|
+
let uiMeta = toolMeta?.ui;
|
|
481
|
+
if (!uiMeta || typeof uiMeta != "object")
|
|
482
|
+
return;
|
|
483
|
+
let streamMode = uiMeta["pi-mcp-adapter.streamMode"];
|
|
484
|
+
if (streamMode === "eager" || streamMode === "stream-first")
|
|
485
|
+
return streamMode;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js
|
|
489
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, renameSync as renameSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
490
|
+
import { dirname as dirname2 } from "node:path";
|
|
491
|
+
import { createHash } from "node:crypto";
|
|
492
|
+
import { createRequire } from "node:module";
|
|
493
|
+
var CACHE_VERSION = 1, CACHE_MAX_AGE_MS = 10080 * 60 * 1e3;
|
|
494
|
+
function getMetadataCachePath() {
|
|
495
|
+
return getAgentPath("mcp-cache.json");
|
|
496
|
+
}
|
|
497
|
+
function loadMetadataCache() {
|
|
498
|
+
let cachePath = getMetadataCachePath();
|
|
499
|
+
if (!existsSync2(cachePath))
|
|
500
|
+
return null;
|
|
501
|
+
try {
|
|
502
|
+
let raw = JSON.parse(readFileSync2(cachePath, "utf-8"));
|
|
503
|
+
return !raw || typeof raw != "object" || raw.version !== CACHE_VERSION || !raw.servers || typeof raw.servers != "object" ? null : raw;
|
|
504
|
+
} catch {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
function saveMetadataCache(cache) {
|
|
509
|
+
let cachePath = getMetadataCachePath(), dir = dirname2(cachePath);
|
|
510
|
+
mkdirSync2(dir, { recursive: !0 });
|
|
511
|
+
let merged = { version: CACHE_VERSION, servers: {} };
|
|
512
|
+
try {
|
|
513
|
+
if (existsSync2(cachePath)) {
|
|
514
|
+
let existing = JSON.parse(readFileSync2(cachePath, "utf-8"));
|
|
515
|
+
existing && existing.version === CACHE_VERSION && existing.servers && (merged.servers = { ...existing.servers });
|
|
516
|
+
}
|
|
517
|
+
} catch {
|
|
518
|
+
}
|
|
519
|
+
merged.version = CACHE_VERSION, merged.servers = { ...merged.servers, ...cache.servers };
|
|
520
|
+
let tmpPath = `${cachePath}.${process.pid}.tmp`;
|
|
521
|
+
writeFileSync2(tmpPath, JSON.stringify(merged, null, 2), "utf-8"), renameSync2(tmpPath, cachePath);
|
|
522
|
+
}
|
|
523
|
+
function computeServerHash(definition) {
|
|
524
|
+
let identity = {
|
|
525
|
+
command: definition.command,
|
|
526
|
+
args: definition.args,
|
|
527
|
+
env: interpolateEnvRecord(definition.env),
|
|
528
|
+
cwd: resolveConfigPath(definition.cwd),
|
|
529
|
+
url: definition.url,
|
|
530
|
+
headers: interpolateEnvRecord(definition.headers),
|
|
531
|
+
auth: definition.auth,
|
|
532
|
+
bearerToken: resolveBearerToken(definition),
|
|
533
|
+
bearerTokenEnv: definition.bearerTokenEnv,
|
|
534
|
+
exposeResources: definition.exposeResources,
|
|
535
|
+
excludeTools: definition.excludeTools
|
|
536
|
+
}, normalized = stableStringify(identity);
|
|
537
|
+
return createHash("sha256").update(normalized).digest("hex");
|
|
538
|
+
}
|
|
539
|
+
function isServerCacheValid(entry, definition, maxAgeMs = CACHE_MAX_AGE_MS) {
|
|
540
|
+
return !(!entry || entry.configHash !== computeServerHash(definition) || !entry.cachedAt || typeof entry.cachedAt != "number" || maxAgeMs > 0 && Date.now() - entry.cachedAt > maxAgeMs);
|
|
541
|
+
}
|
|
542
|
+
function reconstructToolMetadata(serverName, entry, prefix, definition) {
|
|
543
|
+
let metadata = [];
|
|
544
|
+
for (let tool of entry.tools ?? [])
|
|
545
|
+
tool?.name && (isToolExcluded(tool.name, serverName, prefix, definition.excludeTools) || metadata.push({
|
|
546
|
+
name: formatToolName(tool.name, serverName, prefix),
|
|
547
|
+
originalName: tool.name,
|
|
548
|
+
description: tool.description ?? "",
|
|
549
|
+
inputSchema: tool.inputSchema,
|
|
550
|
+
uiResourceUri: tool.uiResourceUri,
|
|
551
|
+
uiStreamMode: tool.uiStreamMode
|
|
552
|
+
}));
|
|
553
|
+
if (definition.exposeResources !== !1)
|
|
554
|
+
for (let resource of entry.resources ?? []) {
|
|
555
|
+
if (!resource?.name || !resource?.uri)
|
|
556
|
+
continue;
|
|
557
|
+
let baseName = `get_${resourceNameToToolName(resource.name)}`;
|
|
558
|
+
isToolExcluded(baseName, serverName, prefix, definition.excludeTools) || metadata.push({
|
|
559
|
+
name: formatToolName(baseName, serverName, prefix),
|
|
560
|
+
originalName: baseName,
|
|
561
|
+
description: resource.description ?? `Read resource: ${resource.uri}`,
|
|
562
|
+
resourceUri: resource.uri
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
return metadata;
|
|
566
|
+
}
|
|
567
|
+
function serializeTools(tools) {
|
|
568
|
+
return tools.filter((t) => t?.name).map((t) => ({
|
|
569
|
+
name: t.name,
|
|
570
|
+
description: t.description,
|
|
571
|
+
inputSchema: t.inputSchema,
|
|
572
|
+
uiResourceUri: tryGetToolUiResourceUri(t),
|
|
573
|
+
uiStreamMode: extractToolUiStreamMode(t._meta)
|
|
574
|
+
}));
|
|
575
|
+
}
|
|
576
|
+
function serializeResources(resources) {
|
|
577
|
+
return resources.filter((r) => r?.name && r?.uri).map((r) => ({
|
|
578
|
+
uri: r.uri,
|
|
579
|
+
name: r.name,
|
|
580
|
+
description: r.description
|
|
581
|
+
}));
|
|
582
|
+
}
|
|
583
|
+
function stableStringify(value) {
|
|
584
|
+
if (value == null || typeof value != "object") {
|
|
585
|
+
let serialized = JSON.stringify(value);
|
|
586
|
+
return serialized === void 0 ? "undefined" : serialized;
|
|
587
|
+
}
|
|
588
|
+
if (Array.isArray(value))
|
|
589
|
+
return `[${value.map((v) => stableStringify(v)).join(",")}]`;
|
|
590
|
+
let obj = value;
|
|
591
|
+
return `{${Object.keys(obj).sort().map((k) => `${JSON.stringify(k)}:${stableStringify(obj[k])}`).join(",")}}`;
|
|
592
|
+
}
|
|
593
|
+
var requireExtApps = createRequire(new URL("../builtin-extensions/pi-mcp-adapter/metadata-cache.js", import.meta.url).href), getToolUiResourceUri;
|
|
594
|
+
function tryGetToolUiResourceUri(tool) {
|
|
595
|
+
try {
|
|
596
|
+
return getToolUiResourceUri || (getToolUiResourceUri = requireExtApps("@modelcontextprotocol/ext-apps/app-bridge").getToolUiResourceUri), getToolUiResourceUri({ _meta: tool._meta });
|
|
597
|
+
} catch {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js
|
|
603
|
+
var BUILTIN_NAMES = /* @__PURE__ */ new Set(["read", "bash", "edit", "write", "grep", "find", "ls", "mcp"]);
|
|
604
|
+
function resolveDirectTools(config, cache, prefix, envOverride) {
|
|
605
|
+
let specs = [];
|
|
606
|
+
if (!cache)
|
|
607
|
+
return specs;
|
|
608
|
+
let seenNames = /* @__PURE__ */ new Set(), envServers = /* @__PURE__ */ new Set(), envTools = /* @__PURE__ */ new Map();
|
|
609
|
+
if (envOverride)
|
|
610
|
+
for (let item of envOverride)
|
|
611
|
+
if (item = item.replace(/\/+$/, ""), item.includes("/")) {
|
|
612
|
+
let [server, tool] = item.split("/", 2);
|
|
613
|
+
server && tool ? (envTools.has(server) || envTools.set(server, /* @__PURE__ */ new Set()), envTools.get(server).add(tool)) : server && envServers.add(server);
|
|
614
|
+
} else item && envServers.add(item);
|
|
615
|
+
let globalDirect = config.settings?.directTools;
|
|
616
|
+
for (let [serverName, definition] of Object.entries(config.mcpServers)) {
|
|
617
|
+
let serverCache = cache.servers[serverName];
|
|
618
|
+
if (!serverCache || !isServerCacheValid(serverCache, definition))
|
|
619
|
+
continue;
|
|
620
|
+
let toolFilter = !1;
|
|
621
|
+
if (envOverride ? envServers.has(serverName) ? toolFilter = !0 : envTools.has(serverName) && (toolFilter = [...envTools.get(serverName)]) : definition.directTools !== void 0 ? toolFilter = definition.directTools : globalDirect && (toolFilter = globalDirect), !!toolFilter) {
|
|
622
|
+
for (let tool of serverCache.tools ?? []) {
|
|
623
|
+
if (toolFilter !== !0 && !toolFilter.includes(tool.name) || isToolExcluded(tool.name, serverName, prefix, definition.excludeTools))
|
|
624
|
+
continue;
|
|
625
|
+
let prefixedName = formatToolName(tool.name, serverName, prefix);
|
|
626
|
+
if (BUILTIN_NAMES.has(prefixedName)) {
|
|
627
|
+
console.warn(`MCP: skipping direct tool "${prefixedName}" (collides with builtin)`);
|
|
628
|
+
continue;
|
|
629
|
+
}
|
|
630
|
+
if (seenNames.has(prefixedName)) {
|
|
631
|
+
console.warn(`MCP: skipping duplicate direct tool "${prefixedName}" from "${serverName}"`);
|
|
632
|
+
continue;
|
|
633
|
+
}
|
|
634
|
+
seenNames.add(prefixedName), specs.push({
|
|
635
|
+
serverName,
|
|
636
|
+
originalName: tool.name,
|
|
637
|
+
prefixedName,
|
|
638
|
+
description: tool.description ?? "",
|
|
639
|
+
inputSchema: tool.inputSchema,
|
|
640
|
+
uiResourceUri: tool.uiResourceUri,
|
|
641
|
+
uiStreamMode: tool.uiStreamMode
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
if (definition.exposeResources !== !1)
|
|
645
|
+
for (let resource of serverCache.resources ?? []) {
|
|
646
|
+
let baseName = `get_${resourceNameToToolName(resource.name)}`;
|
|
647
|
+
if (toolFilter !== !0 && !toolFilter.includes(baseName) || isToolExcluded(baseName, serverName, prefix, definition.excludeTools))
|
|
648
|
+
continue;
|
|
649
|
+
let prefixedName = formatToolName(baseName, serverName, prefix);
|
|
650
|
+
if (BUILTIN_NAMES.has(prefixedName)) {
|
|
651
|
+
console.warn(`MCP: skipping direct resource tool "${prefixedName}" (collides with builtin)`);
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
if (seenNames.has(prefixedName)) {
|
|
655
|
+
console.warn(`MCP: skipping duplicate direct resource tool "${prefixedName}" from "${serverName}"`);
|
|
656
|
+
continue;
|
|
657
|
+
}
|
|
658
|
+
seenNames.add(prefixedName), specs.push({
|
|
659
|
+
serverName,
|
|
660
|
+
originalName: baseName,
|
|
661
|
+
prefixedName,
|
|
662
|
+
description: resource.description ?? `Read resource: ${resource.uri}`,
|
|
663
|
+
resourceUri: resource.uri
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return specs;
|
|
669
|
+
}
|
|
670
|
+
function getMissingConfiguredDirectToolServers(config, cache) {
|
|
671
|
+
let missing = [], globalDirect = config.settings?.directTools;
|
|
672
|
+
for (let [serverName, definition] of Object.entries(config.mcpServers)) {
|
|
673
|
+
if (!(definition.directTools !== void 0 ? !!definition.directTools : !!globalDirect))
|
|
674
|
+
continue;
|
|
675
|
+
let serverCache = cache?.servers?.[serverName];
|
|
676
|
+
(!serverCache || !isServerCacheValid(serverCache, definition)) && missing.push(serverName);
|
|
677
|
+
}
|
|
678
|
+
return missing;
|
|
679
|
+
}
|
|
680
|
+
function buildProxyDescription(config, cache, directSpecs) {
|
|
681
|
+
let prefix = config.settings?.toolPrefix ?? "server", desc = `MCP gateway - connect to MCP servers and call their tools. Non-MCP Pi tools should be called directly, not through mcp.
|
|
682
|
+
`, directByServer = /* @__PURE__ */ new Map();
|
|
683
|
+
for (let spec of directSpecs)
|
|
684
|
+
directByServer.set(spec.serverName, (directByServer.get(spec.serverName) ?? 0) + 1);
|
|
685
|
+
if (directByServer.size > 0) {
|
|
686
|
+
let parts = [...directByServer.entries()].map(([server, count]) => `${server} (${count})`);
|
|
687
|
+
desc += `
|
|
688
|
+
Direct tools available (call as normal tools): ${parts.join(", ")}
|
|
689
|
+
`;
|
|
690
|
+
}
|
|
691
|
+
let serverSummaries = [];
|
|
692
|
+
for (let serverName of Object.keys(config.mcpServers)) {
|
|
693
|
+
let entry = cache?.servers?.[serverName], definition = config.mcpServers[serverName], toolCount = (entry?.tools ?? []).filter((tool) => !isToolExcluded(tool.name, serverName, prefix, definition.excludeTools)).length, resourceCount = definition?.exposeResources !== !1 ? (entry?.resources ?? []).filter((resource) => {
|
|
694
|
+
let baseName = `get_${resourceNameToToolName(resource.name)}`;
|
|
695
|
+
return !isToolExcluded(baseName, serverName, prefix, definition.excludeTools);
|
|
696
|
+
}).length : 0, totalItems = toolCount + resourceCount;
|
|
697
|
+
if (totalItems === 0)
|
|
698
|
+
continue;
|
|
699
|
+
let directCount = directByServer.get(serverName) ?? 0, proxyCount = totalItems - directCount;
|
|
700
|
+
proxyCount > 0 && serverSummaries.push(`${serverName} (${proxyCount} tools)`);
|
|
701
|
+
}
|
|
702
|
+
return serverSummaries.length > 0 && (desc += `
|
|
703
|
+
Servers: ${serverSummaries.join(", ")}
|
|
704
|
+
`), desc += `
|
|
705
|
+
Usage:
|
|
706
|
+
`, desc += ` mcp({ }) \u2192 Show server status
|
|
707
|
+
`, desc += ` mcp({ server: "name" }) \u2192 List tools from server
|
|
708
|
+
`, desc += ` mcp({ search: "query" }) \u2192 Search MCP tools by name/description
|
|
709
|
+
`, desc += ` mcp({ describe: "tool_name" }) \u2192 Show tool details and parameters
|
|
710
|
+
`, desc += ` mcp({ connect: "server-name" }) \u2192 Connect to a server and refresh metadata
|
|
711
|
+
`, desc += ` mcp({ tool: "name", args: '{"key": "value"}' }) \u2192 Call a tool (args is JSON string)
|
|
712
|
+
`, desc += ` mcp({ action: "ui-messages" }) \u2192 Retrieve accumulated messages from completed UI sessions
|
|
713
|
+
`, desc += ` mcp({ action: "auth-start", server: "name" }) \u2192 Start manual OAuth and get a browser URL
|
|
714
|
+
`, desc += ` mcp({ action: "auth-complete", server: "name", args: '{"redirectUrl":"..."}' }) \u2192 Complete manual OAuth
|
|
715
|
+
`, desc += `
|
|
716
|
+
Mode: action > tool (call) > connect > describe > search > server (list) > nothing (status)`, desc;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/abort.js
|
|
720
|
+
function throwIfAborted(signal) {
|
|
721
|
+
if (signal?.aborted)
|
|
722
|
+
throw signal.reason instanceof Error ? signal.reason : new Error(String(signal.reason ?? "MCP request aborted"));
|
|
723
|
+
}
|
|
724
|
+
async function abortable(promise, signal) {
|
|
725
|
+
return signal ? (throwIfAborted(signal), await new Promise((resolve2, reject) => {
|
|
726
|
+
let settled = !1, cleanup = () => signal.removeEventListener("abort", onAbort), onAbort = () => {
|
|
727
|
+
settled || (settled = !0, cleanup(), reject(signal.reason instanceof Error ? signal.reason : new Error(String(signal.reason ?? "MCP request aborted"))));
|
|
728
|
+
};
|
|
729
|
+
signal.addEventListener("abort", onAbort, { once: !0 }), promise.then((value) => {
|
|
730
|
+
settled || (settled = !0, cleanup(), resolve2(value));
|
|
731
|
+
}, (error) => {
|
|
732
|
+
settled || (settled = !0, cleanup(), reject(error));
|
|
733
|
+
});
|
|
734
|
+
})) : promise;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
export {
|
|
738
|
+
getMcpDiscoverySummary,
|
|
739
|
+
loadMcpConfig,
|
|
740
|
+
previewCompatibilityImports,
|
|
741
|
+
ensureCompatibilityImports,
|
|
742
|
+
previewStarterProjectConfig,
|
|
743
|
+
writeStarterProjectConfig,
|
|
744
|
+
previewSharedServerEntry,
|
|
745
|
+
writeSharedServerEntry,
|
|
746
|
+
getServerProvenance,
|
|
747
|
+
writeDirectToolsConfig,
|
|
748
|
+
openUrl,
|
|
749
|
+
openPath,
|
|
750
|
+
parallelLimit,
|
|
751
|
+
getConfigPathFromArgv,
|
|
752
|
+
interpolateEnvRecord,
|
|
753
|
+
resolveConfigPath,
|
|
754
|
+
resolveBearerToken,
|
|
755
|
+
truncateAtWord,
|
|
756
|
+
normalizeDirectToolInputSchema,
|
|
757
|
+
formatAuthRequiredMessage,
|
|
758
|
+
extractToolUiStreamMode,
|
|
759
|
+
getMetadataCachePath,
|
|
760
|
+
loadMetadataCache,
|
|
761
|
+
saveMetadataCache,
|
|
762
|
+
computeServerHash,
|
|
763
|
+
isServerCacheValid,
|
|
764
|
+
reconstructToolMetadata,
|
|
765
|
+
serializeTools,
|
|
766
|
+
serializeResources,
|
|
767
|
+
resolveDirectTools,
|
|
768
|
+
getMissingConfiguredDirectToolServers,
|
|
769
|
+
buildProxyDescription,
|
|
770
|
+
throwIfAborted,
|
|
771
|
+
abortable
|
|
772
|
+
};
|