@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,424 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
$brand,
|
|
4
|
+
$input,
|
|
5
|
+
$output,
|
|
6
|
+
NEVER,
|
|
7
|
+
TimePrecision,
|
|
8
|
+
ZodAny,
|
|
9
|
+
ZodArray,
|
|
10
|
+
ZodBase64,
|
|
11
|
+
ZodBase64URL,
|
|
12
|
+
ZodBigInt,
|
|
13
|
+
ZodBigIntFormat,
|
|
14
|
+
ZodBoolean,
|
|
15
|
+
ZodCIDRv4,
|
|
16
|
+
ZodCIDRv6,
|
|
17
|
+
ZodCUID,
|
|
18
|
+
ZodCUID2,
|
|
19
|
+
ZodCatch,
|
|
20
|
+
ZodCustom,
|
|
21
|
+
ZodCustomStringFormat,
|
|
22
|
+
ZodDate,
|
|
23
|
+
ZodDefault,
|
|
24
|
+
ZodDiscriminatedUnion,
|
|
25
|
+
ZodE164,
|
|
26
|
+
ZodEmail,
|
|
27
|
+
ZodEmoji,
|
|
28
|
+
ZodEnum,
|
|
29
|
+
ZodError,
|
|
30
|
+
ZodFile,
|
|
31
|
+
ZodGUID,
|
|
32
|
+
ZodIPv4,
|
|
33
|
+
ZodIPv6,
|
|
34
|
+
ZodISODate,
|
|
35
|
+
ZodISODateTime,
|
|
36
|
+
ZodISODuration,
|
|
37
|
+
ZodISOTime,
|
|
38
|
+
ZodIntersection,
|
|
39
|
+
ZodIssueCode,
|
|
40
|
+
ZodJWT,
|
|
41
|
+
ZodKSUID,
|
|
42
|
+
ZodLazy,
|
|
43
|
+
ZodLiteral,
|
|
44
|
+
ZodMap,
|
|
45
|
+
ZodNaN,
|
|
46
|
+
ZodNanoID,
|
|
47
|
+
ZodNever,
|
|
48
|
+
ZodNonOptional,
|
|
49
|
+
ZodNull,
|
|
50
|
+
ZodNullable,
|
|
51
|
+
ZodNumber,
|
|
52
|
+
ZodNumberFormat,
|
|
53
|
+
ZodObject,
|
|
54
|
+
ZodOptional,
|
|
55
|
+
ZodPipe,
|
|
56
|
+
ZodPrefault,
|
|
57
|
+
ZodPromise,
|
|
58
|
+
ZodReadonly,
|
|
59
|
+
ZodRealError,
|
|
60
|
+
ZodRecord,
|
|
61
|
+
ZodSet,
|
|
62
|
+
ZodString,
|
|
63
|
+
ZodStringFormat,
|
|
64
|
+
ZodSuccess,
|
|
65
|
+
ZodSymbol,
|
|
66
|
+
ZodTemplateLiteral,
|
|
67
|
+
ZodTransform,
|
|
68
|
+
ZodTuple,
|
|
69
|
+
ZodType,
|
|
70
|
+
ZodULID,
|
|
71
|
+
ZodURL,
|
|
72
|
+
ZodUUID,
|
|
73
|
+
ZodUndefined,
|
|
74
|
+
ZodUnion,
|
|
75
|
+
ZodUnknown,
|
|
76
|
+
ZodVoid,
|
|
77
|
+
ZodXID,
|
|
78
|
+
_ZodString,
|
|
79
|
+
_catch,
|
|
80
|
+
_default,
|
|
81
|
+
_endsWith,
|
|
82
|
+
_enum,
|
|
83
|
+
_function,
|
|
84
|
+
_gt,
|
|
85
|
+
_gte,
|
|
86
|
+
_includes,
|
|
87
|
+
_instanceof,
|
|
88
|
+
_length,
|
|
89
|
+
_lowercase,
|
|
90
|
+
_lt,
|
|
91
|
+
_lte,
|
|
92
|
+
_maxLength,
|
|
93
|
+
_maxSize,
|
|
94
|
+
_mime,
|
|
95
|
+
_minLength,
|
|
96
|
+
_minSize,
|
|
97
|
+
_multipleOf,
|
|
98
|
+
_negative,
|
|
99
|
+
_nonnegative,
|
|
100
|
+
_nonpositive,
|
|
101
|
+
_normalize,
|
|
102
|
+
_null,
|
|
103
|
+
_overwrite,
|
|
104
|
+
_positive,
|
|
105
|
+
_property,
|
|
106
|
+
_regex,
|
|
107
|
+
_size,
|
|
108
|
+
_startsWith,
|
|
109
|
+
_toLowerCase,
|
|
110
|
+
_toUpperCase,
|
|
111
|
+
_trim,
|
|
112
|
+
_undefined,
|
|
113
|
+
_uppercase,
|
|
114
|
+
_void,
|
|
115
|
+
any,
|
|
116
|
+
array,
|
|
117
|
+
base64,
|
|
118
|
+
base64url,
|
|
119
|
+
bigint,
|
|
120
|
+
boolean,
|
|
121
|
+
check,
|
|
122
|
+
cidrv4,
|
|
123
|
+
cidrv6,
|
|
124
|
+
clone,
|
|
125
|
+
coerce_exports,
|
|
126
|
+
config,
|
|
127
|
+
core_exports,
|
|
128
|
+
cuid,
|
|
129
|
+
cuid2,
|
|
130
|
+
custom,
|
|
131
|
+
date,
|
|
132
|
+
discriminatedUnion,
|
|
133
|
+
e164,
|
|
134
|
+
email,
|
|
135
|
+
emoji,
|
|
136
|
+
external_exports,
|
|
137
|
+
file,
|
|
138
|
+
flattenError,
|
|
139
|
+
float32,
|
|
140
|
+
float64,
|
|
141
|
+
formatError,
|
|
142
|
+
getErrorMap,
|
|
143
|
+
globalRegistry,
|
|
144
|
+
guid,
|
|
145
|
+
int,
|
|
146
|
+
int32,
|
|
147
|
+
int64,
|
|
148
|
+
intersection,
|
|
149
|
+
ipv4,
|
|
150
|
+
ipv6,
|
|
151
|
+
iso_exports,
|
|
152
|
+
json,
|
|
153
|
+
jwt,
|
|
154
|
+
keyof,
|
|
155
|
+
ksuid,
|
|
156
|
+
lazy,
|
|
157
|
+
literal,
|
|
158
|
+
locales_exports,
|
|
159
|
+
looseObject,
|
|
160
|
+
map,
|
|
161
|
+
nan,
|
|
162
|
+
nanoid,
|
|
163
|
+
nativeEnum,
|
|
164
|
+
never,
|
|
165
|
+
nonoptional,
|
|
166
|
+
nullable,
|
|
167
|
+
nullish,
|
|
168
|
+
number,
|
|
169
|
+
object,
|
|
170
|
+
optional,
|
|
171
|
+
parse,
|
|
172
|
+
parseAsync,
|
|
173
|
+
partialRecord,
|
|
174
|
+
pipe,
|
|
175
|
+
prefault,
|
|
176
|
+
preprocess,
|
|
177
|
+
prettifyError,
|
|
178
|
+
promise,
|
|
179
|
+
readonly,
|
|
180
|
+
record,
|
|
181
|
+
refine,
|
|
182
|
+
regexes_exports,
|
|
183
|
+
registry,
|
|
184
|
+
safeParse2 as safeParse,
|
|
185
|
+
safeParseAsync,
|
|
186
|
+
set,
|
|
187
|
+
setErrorMap,
|
|
188
|
+
strictObject,
|
|
189
|
+
string,
|
|
190
|
+
stringFormat,
|
|
191
|
+
stringbool,
|
|
192
|
+
success,
|
|
193
|
+
superRefine,
|
|
194
|
+
symbol,
|
|
195
|
+
templateLiteral,
|
|
196
|
+
toJSONSchema,
|
|
197
|
+
transform,
|
|
198
|
+
treeifyError,
|
|
199
|
+
tuple,
|
|
200
|
+
uint32,
|
|
201
|
+
uint64,
|
|
202
|
+
ulid,
|
|
203
|
+
union,
|
|
204
|
+
unknown,
|
|
205
|
+
url,
|
|
206
|
+
uuid,
|
|
207
|
+
uuidv4,
|
|
208
|
+
uuidv6,
|
|
209
|
+
uuidv7,
|
|
210
|
+
v4_default,
|
|
211
|
+
xid
|
|
212
|
+
} from "./chunk-BI3DHYCN.js";
|
|
213
|
+
import "./chunk-BRJX2PRC.js";
|
|
214
|
+
export {
|
|
215
|
+
$brand,
|
|
216
|
+
$input,
|
|
217
|
+
$output,
|
|
218
|
+
NEVER,
|
|
219
|
+
TimePrecision,
|
|
220
|
+
ZodAny,
|
|
221
|
+
ZodArray,
|
|
222
|
+
ZodBase64,
|
|
223
|
+
ZodBase64URL,
|
|
224
|
+
ZodBigInt,
|
|
225
|
+
ZodBigIntFormat,
|
|
226
|
+
ZodBoolean,
|
|
227
|
+
ZodCIDRv4,
|
|
228
|
+
ZodCIDRv6,
|
|
229
|
+
ZodCUID,
|
|
230
|
+
ZodCUID2,
|
|
231
|
+
ZodCatch,
|
|
232
|
+
ZodCustom,
|
|
233
|
+
ZodCustomStringFormat,
|
|
234
|
+
ZodDate,
|
|
235
|
+
ZodDefault,
|
|
236
|
+
ZodDiscriminatedUnion,
|
|
237
|
+
ZodE164,
|
|
238
|
+
ZodEmail,
|
|
239
|
+
ZodEmoji,
|
|
240
|
+
ZodEnum,
|
|
241
|
+
ZodError,
|
|
242
|
+
ZodFile,
|
|
243
|
+
ZodGUID,
|
|
244
|
+
ZodIPv4,
|
|
245
|
+
ZodIPv6,
|
|
246
|
+
ZodISODate,
|
|
247
|
+
ZodISODateTime,
|
|
248
|
+
ZodISODuration,
|
|
249
|
+
ZodISOTime,
|
|
250
|
+
ZodIntersection,
|
|
251
|
+
ZodIssueCode,
|
|
252
|
+
ZodJWT,
|
|
253
|
+
ZodKSUID,
|
|
254
|
+
ZodLazy,
|
|
255
|
+
ZodLiteral,
|
|
256
|
+
ZodMap,
|
|
257
|
+
ZodNaN,
|
|
258
|
+
ZodNanoID,
|
|
259
|
+
ZodNever,
|
|
260
|
+
ZodNonOptional,
|
|
261
|
+
ZodNull,
|
|
262
|
+
ZodNullable,
|
|
263
|
+
ZodNumber,
|
|
264
|
+
ZodNumberFormat,
|
|
265
|
+
ZodObject,
|
|
266
|
+
ZodOptional,
|
|
267
|
+
ZodPipe,
|
|
268
|
+
ZodPrefault,
|
|
269
|
+
ZodPromise,
|
|
270
|
+
ZodReadonly,
|
|
271
|
+
ZodRealError,
|
|
272
|
+
ZodRecord,
|
|
273
|
+
ZodSet,
|
|
274
|
+
ZodString,
|
|
275
|
+
ZodStringFormat,
|
|
276
|
+
ZodSuccess,
|
|
277
|
+
ZodSymbol,
|
|
278
|
+
ZodTemplateLiteral,
|
|
279
|
+
ZodTransform,
|
|
280
|
+
ZodTuple,
|
|
281
|
+
ZodType,
|
|
282
|
+
ZodULID,
|
|
283
|
+
ZodURL,
|
|
284
|
+
ZodUUID,
|
|
285
|
+
ZodUndefined,
|
|
286
|
+
ZodUnion,
|
|
287
|
+
ZodUnknown,
|
|
288
|
+
ZodVoid,
|
|
289
|
+
ZodXID,
|
|
290
|
+
_ZodString,
|
|
291
|
+
_default,
|
|
292
|
+
any,
|
|
293
|
+
array,
|
|
294
|
+
base64,
|
|
295
|
+
base64url,
|
|
296
|
+
bigint,
|
|
297
|
+
boolean,
|
|
298
|
+
_catch as catch,
|
|
299
|
+
check,
|
|
300
|
+
cidrv4,
|
|
301
|
+
cidrv6,
|
|
302
|
+
clone,
|
|
303
|
+
coerce_exports as coerce,
|
|
304
|
+
config,
|
|
305
|
+
core_exports as core,
|
|
306
|
+
cuid,
|
|
307
|
+
cuid2,
|
|
308
|
+
custom,
|
|
309
|
+
date,
|
|
310
|
+
v4_default as default,
|
|
311
|
+
discriminatedUnion,
|
|
312
|
+
e164,
|
|
313
|
+
email,
|
|
314
|
+
emoji,
|
|
315
|
+
_endsWith as endsWith,
|
|
316
|
+
_enum as enum,
|
|
317
|
+
file,
|
|
318
|
+
flattenError,
|
|
319
|
+
float32,
|
|
320
|
+
float64,
|
|
321
|
+
formatError,
|
|
322
|
+
_function as function,
|
|
323
|
+
getErrorMap,
|
|
324
|
+
globalRegistry,
|
|
325
|
+
_gt as gt,
|
|
326
|
+
_gte as gte,
|
|
327
|
+
guid,
|
|
328
|
+
_includes as includes,
|
|
329
|
+
_instanceof as instanceof,
|
|
330
|
+
int,
|
|
331
|
+
int32,
|
|
332
|
+
int64,
|
|
333
|
+
intersection,
|
|
334
|
+
ipv4,
|
|
335
|
+
ipv6,
|
|
336
|
+
iso_exports as iso,
|
|
337
|
+
json,
|
|
338
|
+
jwt,
|
|
339
|
+
keyof,
|
|
340
|
+
ksuid,
|
|
341
|
+
lazy,
|
|
342
|
+
_length as length,
|
|
343
|
+
literal,
|
|
344
|
+
locales_exports as locales,
|
|
345
|
+
looseObject,
|
|
346
|
+
_lowercase as lowercase,
|
|
347
|
+
_lt as lt,
|
|
348
|
+
_lte as lte,
|
|
349
|
+
map,
|
|
350
|
+
_maxLength as maxLength,
|
|
351
|
+
_maxSize as maxSize,
|
|
352
|
+
_mime as mime,
|
|
353
|
+
_minLength as minLength,
|
|
354
|
+
_minSize as minSize,
|
|
355
|
+
_multipleOf as multipleOf,
|
|
356
|
+
nan,
|
|
357
|
+
nanoid,
|
|
358
|
+
nativeEnum,
|
|
359
|
+
_negative as negative,
|
|
360
|
+
never,
|
|
361
|
+
_nonnegative as nonnegative,
|
|
362
|
+
nonoptional,
|
|
363
|
+
_nonpositive as nonpositive,
|
|
364
|
+
_normalize as normalize,
|
|
365
|
+
_null as null,
|
|
366
|
+
nullable,
|
|
367
|
+
nullish,
|
|
368
|
+
number,
|
|
369
|
+
object,
|
|
370
|
+
optional,
|
|
371
|
+
_overwrite as overwrite,
|
|
372
|
+
parse,
|
|
373
|
+
parseAsync,
|
|
374
|
+
partialRecord,
|
|
375
|
+
pipe,
|
|
376
|
+
_positive as positive,
|
|
377
|
+
prefault,
|
|
378
|
+
preprocess,
|
|
379
|
+
prettifyError,
|
|
380
|
+
promise,
|
|
381
|
+
_property as property,
|
|
382
|
+
readonly,
|
|
383
|
+
record,
|
|
384
|
+
refine,
|
|
385
|
+
_regex as regex,
|
|
386
|
+
regexes_exports as regexes,
|
|
387
|
+
registry,
|
|
388
|
+
safeParse,
|
|
389
|
+
safeParseAsync,
|
|
390
|
+
set,
|
|
391
|
+
setErrorMap,
|
|
392
|
+
_size as size,
|
|
393
|
+
_startsWith as startsWith,
|
|
394
|
+
strictObject,
|
|
395
|
+
string,
|
|
396
|
+
stringFormat,
|
|
397
|
+
stringbool,
|
|
398
|
+
success,
|
|
399
|
+
superRefine,
|
|
400
|
+
symbol,
|
|
401
|
+
templateLiteral,
|
|
402
|
+
toJSONSchema,
|
|
403
|
+
_toLowerCase as toLowerCase,
|
|
404
|
+
_toUpperCase as toUpperCase,
|
|
405
|
+
transform,
|
|
406
|
+
treeifyError,
|
|
407
|
+
_trim as trim,
|
|
408
|
+
tuple,
|
|
409
|
+
uint32,
|
|
410
|
+
uint64,
|
|
411
|
+
ulid,
|
|
412
|
+
_undefined as undefined,
|
|
413
|
+
union,
|
|
414
|
+
unknown,
|
|
415
|
+
_uppercase as uppercase,
|
|
416
|
+
url,
|
|
417
|
+
uuid,
|
|
418
|
+
uuidv4,
|
|
419
|
+
uuidv6,
|
|
420
|
+
uuidv7,
|
|
421
|
+
_void as void,
|
|
422
|
+
xid,
|
|
423
|
+
external_exports as z
|
|
424
|
+
};
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
isGeminiWebAvailable,
|
|
4
|
+
queryWithCookies
|
|
5
|
+
} from "./chunk-XTHQ7XR7.js";
|
|
6
|
+
import "./chunk-DMMTJQMQ.js";
|
|
7
|
+
import {
|
|
8
|
+
API_BASE,
|
|
9
|
+
getApiKey,
|
|
10
|
+
queryGeminiApiWithVideo
|
|
11
|
+
} from "./chunk-3WFAEVKS.js";
|
|
12
|
+
import {
|
|
13
|
+
extractHeadingTitle
|
|
14
|
+
} from "./chunk-WJVFOIB5.js";
|
|
15
|
+
import "./chunk-7NBZ5P7I.js";
|
|
16
|
+
import {
|
|
17
|
+
activityMonitor
|
|
18
|
+
} from "./chunk-DAPBPCBP.js";
|
|
19
|
+
import {
|
|
20
|
+
getWebSearchConfigPath,
|
|
21
|
+
mapFfmpegError,
|
|
22
|
+
readExecError,
|
|
23
|
+
trimErrorText
|
|
24
|
+
} from "./chunk-VRB2IYGG.js";
|
|
25
|
+
import "./chunk-BRJX2PRC.js";
|
|
26
|
+
|
|
27
|
+
// packages/coding-agent/dist/builtin-extensions/pi-web-access/video-extract.js
|
|
28
|
+
import { execFileSync } from "node:child_process";
|
|
29
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
30
|
+
import { readFile } from "node:fs/promises";
|
|
31
|
+
import { resolve, extname, basename, join, dirname } from "node:path";
|
|
32
|
+
var CONFIG_PATH = getWebSearchConfigPath(), UPLOAD_BASE = "https://generativelanguage.googleapis.com/upload/v1beta", DEFAULT_VIDEO_PROMPT = `Extract the complete content of this video. Include:
|
|
33
|
+
1. Video title (infer from content if not explicit), duration
|
|
34
|
+
2. A brief summary (2-3 sentences)
|
|
35
|
+
3. Full transcript with timestamps
|
|
36
|
+
4. Descriptions of any code, terminal commands, diagrams, slides, or UI shown on screen
|
|
37
|
+
|
|
38
|
+
Format as markdown.`, VIDEO_EXTENSIONS = {
|
|
39
|
+
".mp4": "video/mp4",
|
|
40
|
+
".mov": "video/quicktime",
|
|
41
|
+
".webm": "video/webm",
|
|
42
|
+
".avi": "video/x-msvideo",
|
|
43
|
+
".mpeg": "video/mpeg",
|
|
44
|
+
".mpg": "video/mpeg",
|
|
45
|
+
".wmv": "video/x-ms-wmv",
|
|
46
|
+
".flv": "video/x-flv",
|
|
47
|
+
".3gp": "video/3gpp",
|
|
48
|
+
".3gpp": "video/3gpp"
|
|
49
|
+
};
|
|
50
|
+
function shouldRethrow(err) {
|
|
51
|
+
return (err instanceof Error ? err.message : String(err)).startsWith("Failed to parse ");
|
|
52
|
+
}
|
|
53
|
+
function normalizePreferredModel(value, fallback) {
|
|
54
|
+
if (typeof value != "string")
|
|
55
|
+
return fallback;
|
|
56
|
+
let normalized = value.trim();
|
|
57
|
+
return normalized.length > 0 ? normalized : fallback;
|
|
58
|
+
}
|
|
59
|
+
function normalizeEnabled(value, fallback) {
|
|
60
|
+
return typeof value == "boolean" ? value : fallback;
|
|
61
|
+
}
|
|
62
|
+
function normalizeMaxSizeMB(value, fallback) {
|
|
63
|
+
return typeof value != "number" || !Number.isFinite(value) ? fallback : value > 0 ? value : fallback;
|
|
64
|
+
}
|
|
65
|
+
var VIDEO_CONFIG_DEFAULTS = {
|
|
66
|
+
enabled: !0,
|
|
67
|
+
preferredModel: "gemini-3-flash-preview",
|
|
68
|
+
maxSizeMB: 50
|
|
69
|
+
}, cachedVideoConfig = null;
|
|
70
|
+
function loadVideoConfig() {
|
|
71
|
+
if (cachedVideoConfig)
|
|
72
|
+
return cachedVideoConfig;
|
|
73
|
+
if (!existsSync(CONFIG_PATH))
|
|
74
|
+
return cachedVideoConfig = { ...VIDEO_CONFIG_DEFAULTS }, cachedVideoConfig;
|
|
75
|
+
let rawText = readFileSync(CONFIG_PATH, "utf-8"), raw;
|
|
76
|
+
try {
|
|
77
|
+
raw = JSON.parse(rawText);
|
|
78
|
+
} catch (err) {
|
|
79
|
+
let message = err instanceof Error ? err.message : String(err);
|
|
80
|
+
throw new Error(`Failed to parse ${CONFIG_PATH}: ${message}`);
|
|
81
|
+
}
|
|
82
|
+
let v = raw.video ?? {};
|
|
83
|
+
return cachedVideoConfig = {
|
|
84
|
+
enabled: normalizeEnabled(v.enabled, VIDEO_CONFIG_DEFAULTS.enabled),
|
|
85
|
+
preferredModel: normalizePreferredModel(v.preferredModel, VIDEO_CONFIG_DEFAULTS.preferredModel),
|
|
86
|
+
maxSizeMB: normalizeMaxSizeMB(v.maxSizeMB, VIDEO_CONFIG_DEFAULTS.maxSizeMB)
|
|
87
|
+
}, cachedVideoConfig;
|
|
88
|
+
}
|
|
89
|
+
function isVideoFile(input) {
|
|
90
|
+
let config = loadVideoConfig();
|
|
91
|
+
if (!config.enabled || !(input.startsWith("/") || input.startsWith("./") || input.startsWith("../") || input.startsWith("file://")))
|
|
92
|
+
return null;
|
|
93
|
+
let filePath = input;
|
|
94
|
+
if (input.startsWith("file://"))
|
|
95
|
+
try {
|
|
96
|
+
filePath = decodeURIComponent(new URL(input).pathname);
|
|
97
|
+
} catch {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
let ext = extname(filePath).toLowerCase(), mimeType = VIDEO_EXTENSIONS[ext];
|
|
101
|
+
if (!mimeType)
|
|
102
|
+
return null;
|
|
103
|
+
let absolutePath = resolveFilePath(filePath);
|
|
104
|
+
if (!absolutePath)
|
|
105
|
+
return null;
|
|
106
|
+
let stat;
|
|
107
|
+
try {
|
|
108
|
+
stat = statSync(absolutePath);
|
|
109
|
+
} catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
if (!stat.isFile())
|
|
113
|
+
return null;
|
|
114
|
+
let maxBytes = config.maxSizeMB * 1024 * 1024;
|
|
115
|
+
return stat.size > maxBytes ? null : { absolutePath, mimeType, sizeBytes: stat.size };
|
|
116
|
+
}
|
|
117
|
+
function resolveFilePath(filePath) {
|
|
118
|
+
let absolutePath = resolve(filePath);
|
|
119
|
+
if (existsSync(absolutePath))
|
|
120
|
+
return absolutePath;
|
|
121
|
+
let dir = dirname(absolutePath), base = basename(absolutePath);
|
|
122
|
+
if (!existsSync(dir))
|
|
123
|
+
return null;
|
|
124
|
+
try {
|
|
125
|
+
let normalizedBase = normalizeSpaces(base), match = readdirSync(dir).find((f) => normalizeSpaces(f) === normalizedBase);
|
|
126
|
+
return match ? join(dir, match) : null;
|
|
127
|
+
} catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function normalizeSpaces(s) {
|
|
132
|
+
return s.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g, " ");
|
|
133
|
+
}
|
|
134
|
+
async function extractVideo(info, signal, options) {
|
|
135
|
+
let config = loadVideoConfig(), effectivePrompt = options?.prompt ?? DEFAULT_VIDEO_PROMPT, effectiveModel = options?.model ?? config.preferredModel, displayName = basename(info.absolutePath), activityId = activityMonitor.logStart({ type: "fetch", url: `video:${displayName}` }), result = await tryVideoGeminiApi(info, effectivePrompt, effectiveModel, signal) ?? await tryVideoGeminiWeb(info, effectivePrompt, effectiveModel, signal);
|
|
136
|
+
if (result) {
|
|
137
|
+
let thumbnail = await extractVideoFrame(info.absolutePath);
|
|
138
|
+
return "error" in thumbnail || (result.thumbnail = thumbnail), activityMonitor.logComplete(activityId, 200), result;
|
|
139
|
+
}
|
|
140
|
+
return signal?.aborted ? (activityMonitor.logComplete(activityId, 0), null) : (activityMonitor.logError(activityId, "all video extraction paths failed"), null);
|
|
141
|
+
}
|
|
142
|
+
function mapFfprobeError(err) {
|
|
143
|
+
let { code, stderr, message } = readExecError(err);
|
|
144
|
+
if (code === "ENOENT")
|
|
145
|
+
return "ffprobe is not installed. Install ffmpeg which includes ffprobe";
|
|
146
|
+
let snippet = trimErrorText(stderr || message);
|
|
147
|
+
return snippet ? `ffprobe failed: ${snippet}` : "ffprobe failed";
|
|
148
|
+
}
|
|
149
|
+
async function extractVideoFrame(filePath, seconds = 1) {
|
|
150
|
+
try {
|
|
151
|
+
let buffer = execFileSync("ffmpeg", [
|
|
152
|
+
"-ss",
|
|
153
|
+
String(seconds),
|
|
154
|
+
"-i",
|
|
155
|
+
filePath,
|
|
156
|
+
"-frames:v",
|
|
157
|
+
"1",
|
|
158
|
+
"-f",
|
|
159
|
+
"image2pipe",
|
|
160
|
+
"-vcodec",
|
|
161
|
+
"mjpeg",
|
|
162
|
+
"pipe:1"
|
|
163
|
+
], { maxBuffer: 5242880, timeout: 1e4, stdio: ["pipe", "pipe", "pipe"] });
|
|
164
|
+
return buffer.length === 0 ? { error: "ffmpeg failed: empty output" } : { data: buffer.toString("base64"), mimeType: "image/jpeg" };
|
|
165
|
+
} catch (err) {
|
|
166
|
+
return { error: mapFfmpegError(err) };
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async function getLocalVideoDuration(filePath) {
|
|
170
|
+
try {
|
|
171
|
+
let output = execFileSync("ffprobe", [
|
|
172
|
+
"-v",
|
|
173
|
+
"quiet",
|
|
174
|
+
"-show_entries",
|
|
175
|
+
"format=duration",
|
|
176
|
+
"-of",
|
|
177
|
+
"csv=p=0",
|
|
178
|
+
filePath
|
|
179
|
+
], { timeout: 1e4, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim(), duration = Number.parseFloat(output);
|
|
180
|
+
return Number.isFinite(duration) ? duration : { error: "ffprobe failed: invalid duration output" };
|
|
181
|
+
} catch (err) {
|
|
182
|
+
return { error: mapFfprobeError(err) };
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
async function tryVideoGeminiWeb(info, prompt, model, signal) {
|
|
186
|
+
try {
|
|
187
|
+
let cookies = await isGeminiWebAvailable();
|
|
188
|
+
if (!cookies || signal?.aborted)
|
|
189
|
+
return null;
|
|
190
|
+
let text = await queryWithCookies(prompt, cookies, {
|
|
191
|
+
files: [info.absolutePath],
|
|
192
|
+
model,
|
|
193
|
+
signal,
|
|
194
|
+
timeoutMs: 18e4
|
|
195
|
+
});
|
|
196
|
+
return {
|
|
197
|
+
url: info.absolutePath,
|
|
198
|
+
title: extractVideoTitle(text, info.absolutePath),
|
|
199
|
+
content: text,
|
|
200
|
+
error: null
|
|
201
|
+
};
|
|
202
|
+
} catch (err) {
|
|
203
|
+
if (shouldRethrow(err))
|
|
204
|
+
throw err;
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async function tryVideoGeminiApi(info, prompt, model, signal) {
|
|
209
|
+
let apiKey = getApiKey();
|
|
210
|
+
if (!apiKey || signal?.aborted)
|
|
211
|
+
return null;
|
|
212
|
+
let fileName = null;
|
|
213
|
+
try {
|
|
214
|
+
let uploaded = await uploadToFilesApi(info, apiKey, signal);
|
|
215
|
+
fileName = uploaded.name, await pollFileState(fileName, apiKey, signal, 12e4);
|
|
216
|
+
let text = await queryGeminiApiWithVideo(prompt, uploaded.uri, {
|
|
217
|
+
model,
|
|
218
|
+
mimeType: info.mimeType,
|
|
219
|
+
signal,
|
|
220
|
+
timeoutMs: 12e4
|
|
221
|
+
});
|
|
222
|
+
return {
|
|
223
|
+
url: info.absolutePath,
|
|
224
|
+
title: extractVideoTitle(text, info.absolutePath),
|
|
225
|
+
content: text,
|
|
226
|
+
error: null
|
|
227
|
+
};
|
|
228
|
+
} catch (err) {
|
|
229
|
+
if (shouldRethrow(err))
|
|
230
|
+
throw err;
|
|
231
|
+
return null;
|
|
232
|
+
} finally {
|
|
233
|
+
fileName && deleteGeminiFile(fileName, apiKey);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
async function uploadToFilesApi(info, apiKey, signal) {
|
|
237
|
+
let displayName = basename(info.absolutePath), initRes = await fetch(`${UPLOAD_BASE}/files`, {
|
|
238
|
+
method: "POST",
|
|
239
|
+
headers: {
|
|
240
|
+
"x-goog-api-key": apiKey,
|
|
241
|
+
"X-Goog-Upload-Protocol": "resumable",
|
|
242
|
+
"X-Goog-Upload-Command": "start",
|
|
243
|
+
"X-Goog-Upload-Header-Content-Length": String(info.sizeBytes),
|
|
244
|
+
"X-Goog-Upload-Header-Content-Type": info.mimeType,
|
|
245
|
+
"Content-Type": "application/json"
|
|
246
|
+
},
|
|
247
|
+
body: JSON.stringify({ file: { display_name: displayName } }),
|
|
248
|
+
signal
|
|
249
|
+
});
|
|
250
|
+
if (!initRes.ok) {
|
|
251
|
+
let text = await initRes.text();
|
|
252
|
+
throw new Error(`File upload init failed: ${initRes.status} (${text.slice(0, 200)})`);
|
|
253
|
+
}
|
|
254
|
+
let uploadUrl = initRes.headers.get("x-goog-upload-url");
|
|
255
|
+
if (!uploadUrl)
|
|
256
|
+
throw new Error("No upload URL in response headers");
|
|
257
|
+
let fileData = await readFile(info.absolutePath), uploadRes = await fetch(uploadUrl, {
|
|
258
|
+
method: "PUT",
|
|
259
|
+
headers: {
|
|
260
|
+
"Content-Length": String(info.sizeBytes),
|
|
261
|
+
"X-Goog-Upload-Offset": "0",
|
|
262
|
+
"X-Goog-Upload-Command": "upload, finalize"
|
|
263
|
+
},
|
|
264
|
+
body: fileData,
|
|
265
|
+
signal
|
|
266
|
+
});
|
|
267
|
+
if (!uploadRes.ok) {
|
|
268
|
+
let text = await uploadRes.text();
|
|
269
|
+
throw new Error(`File upload failed: ${uploadRes.status} (${text.slice(0, 200)})`);
|
|
270
|
+
}
|
|
271
|
+
return (await uploadRes.json()).file;
|
|
272
|
+
}
|
|
273
|
+
async function pollFileState(fileName, apiKey, signal, timeoutMs = 12e4) {
|
|
274
|
+
let deadline = Date.now() + timeoutMs;
|
|
275
|
+
for (; Date.now() < deadline; ) {
|
|
276
|
+
if (signal?.aborted)
|
|
277
|
+
throw new Error("Aborted");
|
|
278
|
+
let res = await fetch(`${API_BASE}/${fileName}?key=${apiKey}`, { signal });
|
|
279
|
+
if (!res.ok)
|
|
280
|
+
throw new Error(`File state check failed: ${res.status}`);
|
|
281
|
+
let data = await res.json();
|
|
282
|
+
if (data.state === "ACTIVE")
|
|
283
|
+
return;
|
|
284
|
+
if (data.state === "FAILED")
|
|
285
|
+
throw new Error("File processing failed");
|
|
286
|
+
await new Promise((r) => setTimeout(r, 5e3));
|
|
287
|
+
}
|
|
288
|
+
throw new Error("File processing timed out");
|
|
289
|
+
}
|
|
290
|
+
function deleteGeminiFile(fileName, apiKey) {
|
|
291
|
+
fetch(`${API_BASE}/${fileName}?key=${apiKey}`, { method: "DELETE" }).catch((err) => {
|
|
292
|
+
let message = err instanceof Error ? err.message : String(err);
|
|
293
|
+
console.error(`Failed to delete Gemini file ${fileName}: ${message}`);
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function extractVideoTitle(text, filePath) {
|
|
297
|
+
return extractHeadingTitle(text) ?? basename(filePath, extname(filePath));
|
|
298
|
+
}
|
|
299
|
+
export {
|
|
300
|
+
extractVideo,
|
|
301
|
+
extractVideoFrame,
|
|
302
|
+
getLocalVideoDuration,
|
|
303
|
+
isVideoFile
|
|
304
|
+
};
|