@ashx-j/lunr 0.2.16 → 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 +25 -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/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +6 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.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/runs/foreground/request-params.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js +38 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +3 -16
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.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,265 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
activityMonitor
|
|
4
|
+
} from "./chunk-DAPBPCBP.js";
|
|
5
|
+
import {
|
|
6
|
+
getWebSearchConfigPath
|
|
7
|
+
} from "./chunk-VRB2IYGG.js";
|
|
8
|
+
import "./chunk-BRJX2PRC.js";
|
|
9
|
+
|
|
10
|
+
// packages/coding-agent/dist/builtin-extensions/pi-web-access/parallel.js
|
|
11
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
12
|
+
var PARALLEL_SEARCH_URL = "https://api.parallel.ai/v1/search", PARALLEL_EXTRACT_URL = "https://api.parallel.ai/v1/extract", CONFIG_PATH = getWebSearchConfigPath(), MIN_PARALLEL_API_KEY_LENGTH = 8, MIN_USEFUL_CONTENT = 500, SEARCH_TIMEOUT_MS = 6e4, PLACEHOLDER_API_KEY_DENYLIST = /* @__PURE__ */ new Set([
|
|
13
|
+
"replace_with_your_parallel_api_key",
|
|
14
|
+
"parallel_api_key",
|
|
15
|
+
"your-key",
|
|
16
|
+
"your-key-here",
|
|
17
|
+
"your-api-key-here",
|
|
18
|
+
"dummy",
|
|
19
|
+
"placeholder",
|
|
20
|
+
"changeme",
|
|
21
|
+
"insert-your-key",
|
|
22
|
+
"insert-your-key-here",
|
|
23
|
+
"api-key",
|
|
24
|
+
"xxx"
|
|
25
|
+
]), cachedConfig = null;
|
|
26
|
+
function loadConfig() {
|
|
27
|
+
if (cachedConfig)
|
|
28
|
+
return cachedConfig;
|
|
29
|
+
if (!existsSync(CONFIG_PATH))
|
|
30
|
+
return cachedConfig = {}, cachedConfig;
|
|
31
|
+
let raw = readFileSync(CONFIG_PATH, "utf-8");
|
|
32
|
+
try {
|
|
33
|
+
return cachedConfig = JSON.parse(raw), cachedConfig;
|
|
34
|
+
} catch (err) {
|
|
35
|
+
let message = err instanceof Error ? err.message : String(err);
|
|
36
|
+
throw new Error(`Failed to parse ${CONFIG_PATH}: ${message}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function clearParallelConfigCache() {
|
|
40
|
+
cachedConfig = null;
|
|
41
|
+
}
|
|
42
|
+
function normalizeApiKey(value) {
|
|
43
|
+
if (typeof value != "string")
|
|
44
|
+
return null;
|
|
45
|
+
let normalized = value.trim();
|
|
46
|
+
return normalized.length > 0 ? normalized : null;
|
|
47
|
+
}
|
|
48
|
+
function isPlaceholderApiKey(key) {
|
|
49
|
+
let normalized = key.trim();
|
|
50
|
+
return normalized.length < MIN_PARALLEL_API_KEY_LENGTH || PLACEHOLDER_API_KEY_DENYLIST.has(normalized.toLowerCase());
|
|
51
|
+
}
|
|
52
|
+
function resolveApiKey() {
|
|
53
|
+
let envKey = normalizeApiKey(process.env.PARALLEL_API_KEY);
|
|
54
|
+
if (envKey && !isPlaceholderApiKey(envKey))
|
|
55
|
+
return envKey;
|
|
56
|
+
let configKey = normalizeApiKey(loadConfig().parallelApiKey);
|
|
57
|
+
return configKey && !isPlaceholderApiKey(configKey) ? configKey : null;
|
|
58
|
+
}
|
|
59
|
+
function getApiKey() {
|
|
60
|
+
let key = resolveApiKey();
|
|
61
|
+
if (!key)
|
|
62
|
+
throw new Error(`Parallel API key not found. Either:
|
|
63
|
+
1. Create ${CONFIG_PATH} with { "parallelApiKey": "your-key" }
|
|
64
|
+
2. Set PARALLEL_API_KEY environment variable
|
|
65
|
+
Get a key at https://platform.parallel.ai`);
|
|
66
|
+
return key;
|
|
67
|
+
}
|
|
68
|
+
function hasParallelApiKey() {
|
|
69
|
+
return !!resolveApiKey();
|
|
70
|
+
}
|
|
71
|
+
function isParallelAvailable() {
|
|
72
|
+
return hasParallelApiKey();
|
|
73
|
+
}
|
|
74
|
+
function requestSignal(signal) {
|
|
75
|
+
let timeout = AbortSignal.timeout(SEARCH_TIMEOUT_MS);
|
|
76
|
+
return signal ? AbortSignal.any([signal, timeout]) : timeout;
|
|
77
|
+
}
|
|
78
|
+
function errorMessage(err) {
|
|
79
|
+
return err instanceof Error ? err.message : String(err);
|
|
80
|
+
}
|
|
81
|
+
function activityContext(url, body) {
|
|
82
|
+
if (typeof body.objective == "string" && body.objective.trim().length > 0)
|
|
83
|
+
return { type: "api", query: body.objective };
|
|
84
|
+
let searchQueries = body.search_queries;
|
|
85
|
+
if (Array.isArray(searchQueries) && typeof searchQueries[0] == "string")
|
|
86
|
+
return { type: "api", query: searchQueries[0] };
|
|
87
|
+
let urls = body.urls;
|
|
88
|
+
return Array.isArray(urls) && typeof urls[0] == "string" ? { type: "fetch", url: urls[0] } : url.includes("/search") ? { type: "api", query: "Parallel search" } : { type: "fetch", url };
|
|
89
|
+
}
|
|
90
|
+
function recencyToAfterDate(filter) {
|
|
91
|
+
let now = /* @__PURE__ */ new Date(), days = { day: 1, week: 7, month: 30, year: 365 }[filter] ?? 0;
|
|
92
|
+
return new Date(now.getTime() - days * 864e5).toISOString().slice(0, 10);
|
|
93
|
+
}
|
|
94
|
+
function normalizeDomain(value) {
|
|
95
|
+
let input = value.trim().toLowerCase();
|
|
96
|
+
if (!input || (input.startsWith("-") && (input = input.slice(1).trim()), !input))
|
|
97
|
+
return null;
|
|
98
|
+
try {
|
|
99
|
+
input = (input.includes("://") ? new URL(input) : new URL(`https://${input}`)).hostname;
|
|
100
|
+
} catch {
|
|
101
|
+
input = input.split("/")[0]?.split(":")[0] ?? "";
|
|
102
|
+
}
|
|
103
|
+
return input = input.replace(/^\.+|\.+$/g, ""), /^[a-z0-9][a-z0-9.-]*\.[a-z]{2,}$/i.test(input) ? input : null;
|
|
104
|
+
}
|
|
105
|
+
function mapDomainFilter(domainFilter) {
|
|
106
|
+
if (!domainFilter?.length)
|
|
107
|
+
return {};
|
|
108
|
+
let include_domains = [], exclude_domains = [];
|
|
109
|
+
for (let raw of domainFilter) {
|
|
110
|
+
let domain = normalizeDomain(raw);
|
|
111
|
+
if (!domain)
|
|
112
|
+
continue;
|
|
113
|
+
let target = raw.trim().startsWith("-") ? exclude_domains : include_domains;
|
|
114
|
+
target.includes(domain) || target.push(domain);
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
...include_domains.length ? { include_domains } : {},
|
|
118
|
+
...exclude_domains.length ? { exclude_domains } : {}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function buildSearchRequestBody(query, options = {}) {
|
|
122
|
+
let numResults = Math.max(1, Math.min(Math.floor(options.numResults ?? 5), 20)), sourcePolicy = {
|
|
123
|
+
...mapDomainFilter(options.domainFilter),
|
|
124
|
+
...options.recencyFilter ? { after_date: recencyToAfterDate(options.recencyFilter) } : {}
|
|
125
|
+
};
|
|
126
|
+
return {
|
|
127
|
+
objective: query,
|
|
128
|
+
search_queries: [query],
|
|
129
|
+
advanced_settings: {
|
|
130
|
+
max_results: numResults,
|
|
131
|
+
...Object.keys(sourcePolicy).length > 0 ? { source_policy: sourcePolicy } : {}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function normalizeExcerpts(value) {
|
|
136
|
+
return Array.isArray(value) ? value.filter((item) => typeof item == "string" && item.trim().length > 0) : [];
|
|
137
|
+
}
|
|
138
|
+
function mapSearchResults(results) {
|
|
139
|
+
if (!Array.isArray(results))
|
|
140
|
+
return [];
|
|
141
|
+
let mapped = [];
|
|
142
|
+
for (let i = 0; i < results.length; i++) {
|
|
143
|
+
let item = results[i];
|
|
144
|
+
if (!item?.url)
|
|
145
|
+
continue;
|
|
146
|
+
let excerpts = normalizeExcerpts(item.excerpts);
|
|
147
|
+
mapped.push({
|
|
148
|
+
title: item.title || `Source ${i + 1}`,
|
|
149
|
+
url: item.url,
|
|
150
|
+
snippet: excerpts.length > 0 ? excerpts[0].replace(/\s+/g, " ").trim().slice(0, 200) : ""
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return mapped;
|
|
154
|
+
}
|
|
155
|
+
function buildAnswerFromExcerpts(results) {
|
|
156
|
+
if (!Array.isArray(results))
|
|
157
|
+
return "";
|
|
158
|
+
let parts = [];
|
|
159
|
+
for (let i = 0; i < results.length; i++) {
|
|
160
|
+
let item = results[i];
|
|
161
|
+
if (!item?.url)
|
|
162
|
+
continue;
|
|
163
|
+
let excerpts = normalizeExcerpts(item.excerpts);
|
|
164
|
+
excerpts.length !== 0 && parts.push(`${excerpts.join(" ")}
|
|
165
|
+
Source: ${item.title || `Source ${i + 1}`} (${item.url})`);
|
|
166
|
+
}
|
|
167
|
+
return parts.join(`
|
|
168
|
+
|
|
169
|
+
`);
|
|
170
|
+
}
|
|
171
|
+
function mapInlineContent(results) {
|
|
172
|
+
return Array.isArray(results) ? results.flatMap((result) => {
|
|
173
|
+
if (!result?.url)
|
|
174
|
+
return [];
|
|
175
|
+
let excerpts = normalizeExcerpts(result.excerpts);
|
|
176
|
+
return excerpts.length === 0 ? [] : [{ url: result.url, title: result.title || "", content: excerpts.join(`
|
|
177
|
+
|
|
178
|
+
`), error: null }];
|
|
179
|
+
}) : [];
|
|
180
|
+
}
|
|
181
|
+
function resolveExtractContent(result) {
|
|
182
|
+
let fullContent = typeof result.full_content == "string" ? result.full_content.trim() : "";
|
|
183
|
+
return fullContent.length > 0 ? fullContent : normalizeExcerpts(result.excerpts).join(`
|
|
184
|
+
|
|
185
|
+
`);
|
|
186
|
+
}
|
|
187
|
+
function mapExtractResult(result) {
|
|
188
|
+
if (!result?.url)
|
|
189
|
+
return null;
|
|
190
|
+
let content = resolveExtractContent(result);
|
|
191
|
+
return content.length < MIN_USEFUL_CONTENT ? null : {
|
|
192
|
+
url: result.url,
|
|
193
|
+
title: typeof result.title == "string" ? result.title.trim() : "",
|
|
194
|
+
content,
|
|
195
|
+
error: null
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function buildExtractRequestBody(url, options = {}, fullContent = !1) {
|
|
199
|
+
let body = { urls: [url] }, prompt = options.prompt?.trim();
|
|
200
|
+
return prompt && (body.objective = prompt), fullContent && (body.advanced_settings = { full_content: !0 }), body;
|
|
201
|
+
}
|
|
202
|
+
function findExtractResult(results, url) {
|
|
203
|
+
if (Array.isArray(results))
|
|
204
|
+
return results.find((item) => item?.url === url) ?? results[0];
|
|
205
|
+
}
|
|
206
|
+
function hasExtractUrlError(errors, url) {
|
|
207
|
+
return Array.isArray(errors) ? errors.some((entry) => typeof entry == "string" ? entry === url : typeof entry == "object" && entry !== null && entry.url === url) : !1;
|
|
208
|
+
}
|
|
209
|
+
async function fetchAndMapExtractResult(url, body, signal) {
|
|
210
|
+
let data = await parallelFetch(PARALLEL_EXTRACT_URL, body, signal);
|
|
211
|
+
if (hasExtractUrlError(data.errors, url))
|
|
212
|
+
return { mapped: null, result: void 0 };
|
|
213
|
+
let result = findExtractResult(data.results, url);
|
|
214
|
+
return { mapped: mapExtractResult(result), result };
|
|
215
|
+
}
|
|
216
|
+
async function searchWithParallel(query, options = {}) {
|
|
217
|
+
let results = (await parallelFetch(PARALLEL_SEARCH_URL, buildSearchRequestBody(query, options), options.signal)).results, response = {
|
|
218
|
+
answer: buildAnswerFromExcerpts(results),
|
|
219
|
+
results: mapSearchResults(results)
|
|
220
|
+
};
|
|
221
|
+
if (options.includeContent) {
|
|
222
|
+
let inlineContent = mapInlineContent(results);
|
|
223
|
+
inlineContent.length > 0 && (response.inlineContent = inlineContent);
|
|
224
|
+
}
|
|
225
|
+
return response;
|
|
226
|
+
}
|
|
227
|
+
async function extractWithParallel(url, signal, options = {}) {
|
|
228
|
+
let initial = await fetchAndMapExtractResult(url, buildExtractRequestBody(url, options), signal);
|
|
229
|
+
return initial.mapped ? initial.mapped : !initial.result || resolveExtractContent(initial.result).length >= MIN_USEFUL_CONTENT ? null : (await fetchAndMapExtractResult(url, buildExtractRequestBody(url, options, !0), signal)).mapped;
|
|
230
|
+
}
|
|
231
|
+
async function parallelFetch(url, body, signal) {
|
|
232
|
+
let apiKey = getApiKey(), activityId = activityMonitor.logStart(activityContext(url, body)), response;
|
|
233
|
+
try {
|
|
234
|
+
response = await fetch(url, {
|
|
235
|
+
method: "POST",
|
|
236
|
+
headers: {
|
|
237
|
+
"x-api-key": apiKey,
|
|
238
|
+
"Content-Type": "application/json"
|
|
239
|
+
},
|
|
240
|
+
body: JSON.stringify(body),
|
|
241
|
+
signal: requestSignal(signal)
|
|
242
|
+
});
|
|
243
|
+
} catch (err) {
|
|
244
|
+
let message = errorMessage(err);
|
|
245
|
+
throw message.toLowerCase().includes("abort") ? activityMonitor.logComplete(activityId, 0) : activityMonitor.logError(activityId, message), err;
|
|
246
|
+
}
|
|
247
|
+
if (!response.ok) {
|
|
248
|
+
activityMonitor.logComplete(activityId, response.status);
|
|
249
|
+
let errorText = await response.text();
|
|
250
|
+
throw new Error(`Parallel API error ${response.status}: ${errorText.slice(0, 300)}`);
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
let data = await response.json();
|
|
254
|
+
return activityMonitor.logComplete(activityId, response.status), data;
|
|
255
|
+
} catch (err) {
|
|
256
|
+
throw activityMonitor.logComplete(activityId, response.status), new Error(`Parallel API returned invalid JSON: ${errorMessage(err)}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
export {
|
|
260
|
+
clearParallelConfigCache,
|
|
261
|
+
extractWithParallel,
|
|
262
|
+
hasParallelApiKey,
|
|
263
|
+
isParallelAvailable,
|
|
264
|
+
searchWithParallel
|
|
265
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getLanguageIdFromPath
|
|
4
|
+
} from "./chunk-3X3KZKMI.js";
|
|
5
|
+
import "./chunk-BRJX2PRC.js";
|
|
6
|
+
|
|
7
|
+
// packages/coding-agent/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/parser-manager.js
|
|
8
|
+
import { createRequire } from "node:module";
|
|
9
|
+
import { dirname, resolve } from "node:path";
|
|
10
|
+
import Parser from "web-tree-sitter";
|
|
11
|
+
var require2 = createRequire(new URL("../builtin-extensions/pi-lsp-extension/src/tree-sitter/parser-manager.js", import.meta.url).href), LANGUAGE_TO_GRAMMAR = {
|
|
12
|
+
typescript: "tree-sitter-typescript.wasm",
|
|
13
|
+
typescriptreact: "tree-sitter-tsx.wasm",
|
|
14
|
+
javascript: "tree-sitter-javascript.wasm",
|
|
15
|
+
javascriptreact: "tree-sitter-javascript.wasm",
|
|
16
|
+
python: "tree-sitter-python.wasm",
|
|
17
|
+
rust: "tree-sitter-rust.wasm",
|
|
18
|
+
go: "tree-sitter-go.wasm",
|
|
19
|
+
java: "tree-sitter-java.wasm",
|
|
20
|
+
c: "tree-sitter-c.wasm",
|
|
21
|
+
cpp: "tree-sitter-cpp.wasm",
|
|
22
|
+
ruby: "tree-sitter-ruby.wasm",
|
|
23
|
+
kotlin: "tree-sitter-kotlin.wasm",
|
|
24
|
+
scala: "tree-sitter-scala.wasm",
|
|
25
|
+
swift: "tree-sitter-swift.wasm",
|
|
26
|
+
lua: "tree-sitter-lua.wasm",
|
|
27
|
+
bash: "tree-sitter-bash.wasm",
|
|
28
|
+
json: "tree-sitter-json.wasm",
|
|
29
|
+
html: "tree-sitter-html.wasm",
|
|
30
|
+
css: "tree-sitter-css.wasm"
|
|
31
|
+
}, TreeSitterManager = class {
|
|
32
|
+
initialized = !1;
|
|
33
|
+
initializing = null;
|
|
34
|
+
languages = /* @__PURE__ */ new Map();
|
|
35
|
+
loadingLanguages = /* @__PURE__ */ new Map();
|
|
36
|
+
parsers = /* @__PURE__ */ new Map();
|
|
37
|
+
cachedTrees = /* @__PURE__ */ new Map();
|
|
38
|
+
grammarsDir;
|
|
39
|
+
constructor() {
|
|
40
|
+
let wasmsPkgJson = require2.resolve("tree-sitter-wasms/package.json");
|
|
41
|
+
this.grammarsDir = resolve(dirname(wasmsPkgJson), "out");
|
|
42
|
+
}
|
|
43
|
+
/** Initialize web-tree-sitter WASM runtime. Must be called before any parsing. */
|
|
44
|
+
async init() {
|
|
45
|
+
if (!this.initialized) {
|
|
46
|
+
if (this.initializing) {
|
|
47
|
+
await this.initializing;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.initializing = Parser.init({
|
|
51
|
+
locateFile: (scriptName) => {
|
|
52
|
+
let webTsPkgJson = require2.resolve("web-tree-sitter/package.json");
|
|
53
|
+
return resolve(dirname(webTsPkgJson), scriptName);
|
|
54
|
+
}
|
|
55
|
+
}), await this.initializing, this.initialized = !0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** Get the language ID for a file path based on extension */
|
|
59
|
+
getLanguageId(filePath) {
|
|
60
|
+
return getLanguageIdFromPath(filePath);
|
|
61
|
+
}
|
|
62
|
+
/** Check if we have a grammar available for a language */
|
|
63
|
+
hasGrammar(languageId) {
|
|
64
|
+
return languageId in LANGUAGE_TO_GRAMMAR;
|
|
65
|
+
}
|
|
66
|
+
/** Get all supported language IDs */
|
|
67
|
+
getSupportedLanguages() {
|
|
68
|
+
return Object.keys(LANGUAGE_TO_GRAMMAR);
|
|
69
|
+
}
|
|
70
|
+
/** Load a language grammar, caching the result */
|
|
71
|
+
async getLanguage(languageId) {
|
|
72
|
+
let cached = this.languages.get(languageId);
|
|
73
|
+
if (cached)
|
|
74
|
+
return cached;
|
|
75
|
+
let loading = this.loadingLanguages.get(languageId);
|
|
76
|
+
if (loading)
|
|
77
|
+
return loading;
|
|
78
|
+
let grammarFile = LANGUAGE_TO_GRAMMAR[languageId];
|
|
79
|
+
if (!grammarFile)
|
|
80
|
+
return null;
|
|
81
|
+
let loadPromise = (async () => {
|
|
82
|
+
await this.init();
|
|
83
|
+
try {
|
|
84
|
+
let grammarPath = resolve(this.grammarsDir, grammarFile), language = await Parser.Language.load(grammarPath);
|
|
85
|
+
return this.languages.set(languageId, language), language;
|
|
86
|
+
} catch {
|
|
87
|
+
return null;
|
|
88
|
+
} finally {
|
|
89
|
+
this.loadingLanguages.delete(languageId);
|
|
90
|
+
}
|
|
91
|
+
})();
|
|
92
|
+
return this.loadingLanguages.set(languageId, loadPromise), loadPromise;
|
|
93
|
+
}
|
|
94
|
+
/** Get or create a parser for a language */
|
|
95
|
+
async getParser(languageId) {
|
|
96
|
+
let existing = this.parsers.get(languageId);
|
|
97
|
+
if (existing)
|
|
98
|
+
return existing;
|
|
99
|
+
let language = await this.getLanguage(languageId);
|
|
100
|
+
if (!language)
|
|
101
|
+
return null;
|
|
102
|
+
let parser = new Parser();
|
|
103
|
+
return parser.setLanguage(language), this.parsers.set(languageId, parser), parser;
|
|
104
|
+
}
|
|
105
|
+
/** Parse a file's content and return the tree. Caches by file path + content hash. */
|
|
106
|
+
async parse(filePath, content) {
|
|
107
|
+
let languageId = this.getLanguageId(filePath);
|
|
108
|
+
return languageId ? this.parseWithLanguage(filePath, content, languageId) : null;
|
|
109
|
+
}
|
|
110
|
+
/** Parse content with an explicit language ID */
|
|
111
|
+
async parseWithLanguage(filePath, content, languageId) {
|
|
112
|
+
let length = content.length, head = djb2Hash(content, 0, Math.min(length, 4096)), tail = length > 4096 ? djb2Hash(content, Math.max(0, length - 4096), length) : head, cached = this.cachedTrees.get(filePath);
|
|
113
|
+
if (cached && cached.contentLength === length && cached.hashHead === head && cached.hashTail === tail)
|
|
114
|
+
return cached.tree;
|
|
115
|
+
let parser = await this.getParser(languageId);
|
|
116
|
+
if (!parser)
|
|
117
|
+
return null;
|
|
118
|
+
let tree = parser.parse(content);
|
|
119
|
+
return tree ? (cached && cached.tree.delete(), this.cachedTrees.set(filePath, { tree, contentLength: length, hashHead: head, hashTail: tail }), tree) : null;
|
|
120
|
+
}
|
|
121
|
+
/** Invalidate the cached tree for a file */
|
|
122
|
+
invalidate(filePath) {
|
|
123
|
+
let cached = this.cachedTrees.get(filePath);
|
|
124
|
+
cached && (cached.tree.delete(), this.cachedTrees.delete(filePath));
|
|
125
|
+
}
|
|
126
|
+
/** Get a cached tree without re-parsing */
|
|
127
|
+
getCachedTree(filePath) {
|
|
128
|
+
return this.cachedTrees.get(filePath)?.tree ?? null;
|
|
129
|
+
}
|
|
130
|
+
/** Shut down — free all resources */
|
|
131
|
+
shutdown() {
|
|
132
|
+
for (let [, cached] of this.cachedTrees)
|
|
133
|
+
cached.tree.delete();
|
|
134
|
+
this.cachedTrees.clear();
|
|
135
|
+
for (let [, parser] of this.parsers)
|
|
136
|
+
parser.delete();
|
|
137
|
+
this.parsers.clear(), this.languages.clear();
|
|
138
|
+
}
|
|
139
|
+
/** Alias for shutdown() — conventional dispose pattern for extension lifecycle */
|
|
140
|
+
dispose() {
|
|
141
|
+
this.shutdown();
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
function djb2Hash(str, start, end) {
|
|
145
|
+
let hash = 5381;
|
|
146
|
+
for (let i = start; i < end; i++)
|
|
147
|
+
hash = (hash << 5) + hash + str.charCodeAt(i) | 0;
|
|
148
|
+
return hash;
|
|
149
|
+
}
|
|
150
|
+
export {
|
|
151
|
+
TreeSitterManager
|
|
152
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import "./chunk-BRJX2PRC.js";
|
|
3
|
+
|
|
4
|
+
// packages/coding-agent/dist/builtin-extensions/pi-web-access/pdf-extract.js
|
|
5
|
+
import { getDocumentProxy } from "unpdf";
|
|
6
|
+
import { writeFile, mkdir } from "node:fs/promises";
|
|
7
|
+
import { join, basename } from "node:path";
|
|
8
|
+
import { homedir } from "node:os";
|
|
9
|
+
var DEFAULT_MAX_PAGES = 100, DEFAULT_OUTPUT_DIR = join(homedir(), "Downloads");
|
|
10
|
+
async function extractPDFToMarkdown(buffer, url, options = {}) {
|
|
11
|
+
let { maxPages = DEFAULT_MAX_PAGES, outputDir = DEFAULT_OUTPUT_DIR, filename } = options, safeMaxPages = Number.isFinite(maxPages) ? Math.max(1, Math.floor(maxPages)) : DEFAULT_MAX_PAGES, pdf = await getDocumentProxy(new Uint8Array(buffer)), metadata = await pdf.getMetadata(), metadataInfo = metadata.info && typeof metadata.info == "object" ? metadata.info : null, metaTitle = typeof metadataInfo?.Title == "string" ? metadataInfo.Title : void 0, metaAuthor = typeof metadataInfo?.Author == "string" ? metadataInfo.Author : void 0, urlTitle = extractTitleFromURL(url), title = metaTitle?.trim() || urlTitle, pagesToExtract = Math.min(pdf.numPages, safeMaxPages), truncated = pdf.numPages > safeMaxPages, pages = [];
|
|
12
|
+
for (let i = 1; i <= pagesToExtract; i++) {
|
|
13
|
+
let pageText = (await (await pdf.getPage(i)).getTextContent()).items.map((item) => item.str || "").join(" ").replace(/\s+/g, " ").trim();
|
|
14
|
+
pageText && pages.push({ pageNum: i, text: pageText });
|
|
15
|
+
}
|
|
16
|
+
let lines = [];
|
|
17
|
+
lines.push(`# ${title}`), lines.push(""), lines.push(`> Source: ${url}`), lines.push(`> Pages: ${pdf.numPages}${truncated ? ` (extracted first ${pagesToExtract})` : ""}`), metaAuthor && lines.push(`> Author: ${metaAuthor}`), lines.push(""), lines.push("---"), lines.push("");
|
|
18
|
+
for (let i = 0; i < pages.length; i++)
|
|
19
|
+
i > 0 && (lines.push(""), lines.push(`<!-- Page ${pages[i].pageNum} -->`), lines.push("")), lines.push(pages[i].text);
|
|
20
|
+
truncated && (lines.push(""), lines.push("---"), lines.push(""), lines.push(`*[Truncated: Only first ${pagesToExtract} of ${pdf.numPages} pages extracted]*`));
|
|
21
|
+
let content = lines.join(`
|
|
22
|
+
`), outputFilename = filename || sanitizeFilename(title) + ".md", outputPath = join(outputDir, outputFilename);
|
|
23
|
+
return await mkdir(outputDir, { recursive: !0 }), await writeFile(outputPath, content, "utf-8"), {
|
|
24
|
+
title,
|
|
25
|
+
pages: pdf.numPages,
|
|
26
|
+
chars: content.length,
|
|
27
|
+
outputPath
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function extractTitleFromURL(url) {
|
|
31
|
+
try {
|
|
32
|
+
let urlObj = new URL(url), pathname = urlObj.pathname, filename = basename(pathname, ".pdf");
|
|
33
|
+
if (urlObj.hostname.includes("arxiv.org")) {
|
|
34
|
+
let match = pathname.match(/\/(?:pdf|abs)\/(\d+\.\d+)/);
|
|
35
|
+
match && (filename = `arxiv-${match[1]}`);
|
|
36
|
+
}
|
|
37
|
+
return filename = filename.replace(/[_-]+/g, " ").replace(/\s+/g, " ").trim(), filename || "document";
|
|
38
|
+
} catch {
|
|
39
|
+
return "document";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function sanitizeFilename(name) {
|
|
43
|
+
return name.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").slice(0, 100).replace(/^-|-$/g, "") || "document";
|
|
44
|
+
}
|
|
45
|
+
function isPDF(url, contentType) {
|
|
46
|
+
if (contentType?.includes("application/pdf"))
|
|
47
|
+
return !0;
|
|
48
|
+
try {
|
|
49
|
+
return new URL(url).pathname.toLowerCase().endsWith(".pdf");
|
|
50
|
+
} catch {
|
|
51
|
+
return !1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
extractPDFToMarkdown,
|
|
56
|
+
isPDF
|
|
57
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
isPerplexityAvailable,
|
|
4
|
+
searchWithPerplexity
|
|
5
|
+
} from "./chunk-XBWPBZBN.js";
|
|
6
|
+
import "./chunk-DAPBPCBP.js";
|
|
7
|
+
import "./chunk-VRB2IYGG.js";
|
|
8
|
+
import "./chunk-BRJX2PRC.js";
|
|
9
|
+
export {
|
|
10
|
+
isPerplexityAvailable,
|
|
11
|
+
searchWithPerplexity
|
|
12
|
+
};
|