@ashx-j/lunr-dev 0.2.13-dev.7.1 → 0.2.16-dev.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -1
- package/dist/builtin-extensions/ashxj-tui.d.ts +14 -0
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.js +37 -3
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
- package/dist/builtin-extensions/index.d.ts +1 -15
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +7 -21
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.d.ts.map +1 -1
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js +6 -2
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.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 +163 -169
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +46 -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 +109 -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 +251 -94
- 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-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 +38 -14
- package/dist/builtin-extensions/pi-subagents/src/extension/index.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 +1 -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 +2 -1
- 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 +167 -77
- 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/catalog/models.json +1 -1
- package/dist/catalog/providers/amazon-bedrock.json +1 -1
- package/dist/catalog/providers/azure-openai-responses.json +1 -1
- package/dist/catalog/providers/fireworks.json +1 -1
- package/dist/catalog/providers/github-copilot.json +1 -1
- package/dist/catalog/providers/openai-codex.json +1 -1
- package/dist/catalog/providers/openai.json +1 -1
- package/dist/catalog/providers/opencode.json +1 -1
- package/dist/catalog/providers/openrouter.json +1 -1
- package/dist/catalog/providers/vercel-ai-gateway.json +1 -1
- package/dist/catalog/publication.json +131 -3
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +1 -0
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli-runtime.d.ts +3 -0
- package/dist/cli-runtime.d.ts.map +1 -0
- package/dist/cli-runtime.js +73 -0
- package/dist/cli-runtime.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -53
- 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 +3 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +56 -12
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/catalog-cache-scope.d.ts +3 -0
- package/dist/core/catalog-cache-scope.d.ts.map +1 -0
- package/dist/core/catalog-cache-scope.js +12 -0
- package/dist/core/catalog-cache-scope.js.map +1 -0
- package/dist/core/catalog-merge.d.ts +2 -0
- package/dist/core/catalog-merge.d.ts.map +1 -1
- package/dist/core/catalog-merge.js +29 -2
- package/dist/core/catalog-merge.js.map +1 -1
- package/dist/core/catalog-refresh-polling.d.ts +8 -0
- package/dist/core/catalog-refresh-polling.d.ts.map +1 -0
- package/dist/core/catalog-refresh-polling.js +30 -0
- package/dist/core/catalog-refresh-polling.js.map +1 -0
- package/dist/core/codex-catalog.d.ts +3 -0
- package/dist/core/codex-catalog.d.ts.map +1 -0
- package/dist/core/codex-catalog.js +15 -0
- package/dist/core/codex-catalog.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +10 -5
- package/dist/core/compaction/compaction.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/extensions/types.d.ts +2 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +2 -0
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/live-catalog.d.ts +5 -2
- package/dist/core/live-catalog.d.ts.map +1 -1
- package/dist/core/live-catalog.js +108 -27
- package/dist/core/live-catalog.js.map +1 -1
- package/dist/core/model-runtime.d.ts +8 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +64 -12
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/official-catalog.d.ts +4 -0
- package/dist/core/official-catalog.d.ts.map +1 -1
- package/dist/core/official-catalog.js +86 -21
- package/dist/core/official-catalog.js.map +1 -1
- package/dist/core/permissions.d.ts +0 -2
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +10 -18
- package/dist/core/permissions.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/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +0 -1
- package/dist/core/slash-commands.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/commands.d.ts +1 -1
- package/dist/gateway/commands.d.ts.map +1 -1
- package/dist/gateway/commands.js +1 -18
- package/dist/gateway/commands.js.map +1 -1
- package/dist/main.d.ts +2 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +66 -48
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +4 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +13 -22
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +141 -207
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +95 -84
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/node-runtime/agent-session-services-IFJMSX7Z.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-LYZ3BFWQ.js +28 -0
- package/dist/node-runtime/chunk-2QKLKMKC.js +173 -0
- package/dist/node-runtime/chunk-3GHXVUAK.js +21 -0
- package/dist/node-runtime/chunk-3RCWXWAY.js +466 -0
- package/dist/node-runtime/chunk-3WFAEVKS.js +115 -0
- package/dist/node-runtime/chunk-3X3KZKMI.js +49 -0
- package/dist/node-runtime/chunk-4HXHDDCF.js +16 -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-5P7PZMRU.js +610 -0
- package/dist/node-runtime/chunk-7N3YHTYF.js +26 -0
- package/dist/node-runtime/chunk-7NBZ5P7I.js +24 -0
- package/dist/node-runtime/chunk-A2KQXUJD.js +105 -0
- package/dist/node-runtime/chunk-AD6VXAO7.js +342 -0
- package/dist/node-runtime/chunk-AHSTJBIB.js +64 -0
- package/dist/node-runtime/chunk-AJX357CL.js +20211 -0
- package/dist/node-runtime/chunk-ARC4KOTI.js +11178 -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-BR7YDUKA.js +109 -0
- package/dist/node-runtime/chunk-BRJX2PRC.js +53 -0
- package/dist/node-runtime/chunk-C4O2RSQQ.js +37 -0
- package/dist/node-runtime/chunk-CCZJ3PYY.js +17 -0
- package/dist/node-runtime/chunk-CDFZEWPU.js +8388 -0
- package/dist/node-runtime/chunk-CGBXPL3E.js +1171 -0
- package/dist/node-runtime/chunk-CJECDQKP.js +19 -0
- package/dist/node-runtime/chunk-DAPBPCBP.js +53 -0
- package/dist/node-runtime/chunk-DDGMHUOW.js +305 -0
- package/dist/node-runtime/chunk-DMMTJQMQ.js +43 -0
- package/dist/node-runtime/chunk-DVGWF6A2.js +1180 -0
- package/dist/node-runtime/chunk-ECD5L7YI.js +1369 -0
- package/dist/node-runtime/chunk-EDBJNRSM.js +46 -0
- package/dist/node-runtime/chunk-F4VQFJI2.js +1269 -0
- package/dist/node-runtime/chunk-FVDOXRUD.js +96 -0
- package/dist/node-runtime/chunk-GZQHMEWL.js +126 -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-IPA627GP.js +296 -0
- package/dist/node-runtime/chunk-JHYKXIMM.js +378 -0
- package/dist/node-runtime/chunk-KKSIVROT.js +88 -0
- package/dist/node-runtime/chunk-LZAW4ZX3.js +633 -0
- package/dist/node-runtime/chunk-M3LZLQW2.js +98 -0
- package/dist/node-runtime/chunk-MGWCVY6Y.js +47 -0
- package/dist/node-runtime/chunk-MJQDX3BA.js +72 -0
- package/dist/node-runtime/chunk-MKKH27PH.js +8956 -0
- package/dist/node-runtime/chunk-MX3GJNXJ.js +986 -0
- package/dist/node-runtime/chunk-N77MY65L.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-OR4L3IB2.js +42 -0
- package/dist/node-runtime/chunk-PBC2Y6GS.js +903 -0
- package/dist/node-runtime/chunk-PCGNAY2O.js +1324 -0
- package/dist/node-runtime/chunk-PCIGF2XK.js +250 -0
- package/dist/node-runtime/chunk-PGAJ5MO5.js +7558 -0
- package/dist/node-runtime/chunk-PL6JKXWI.js +3622 -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-QH42CDX3.js +9451 -0
- package/dist/node-runtime/chunk-RQ2Q5IYR.js +72 -0
- package/dist/node-runtime/chunk-RQ5DNUNG.js +429 -0
- package/dist/node-runtime/chunk-RRIZE6QQ.js +17 -0
- package/dist/node-runtime/chunk-SN6G4OU6.js +4753 -0
- package/dist/node-runtime/chunk-SWSN6HAB.js +53 -0
- package/dist/node-runtime/chunk-TQNSPERU.js +949 -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-WOVTOV5P.js +5653 -0
- package/dist/node-runtime/chunk-XBWPBZBN.js +125 -0
- package/dist/node-runtime/chunk-XTHQ7XR7.js +509 -0
- package/dist/node-runtime/chunk-YF63P5ZT.js +864 -0
- package/dist/node-runtime/chunk-YSKSB3BJ.js +295 -0
- package/dist/node-runtime/chunk-ZCHMJ34K.js +130 -0
- package/dist/node-runtime/chunk-ZKMFUD3Q.js +2834 -0
- package/dist/node-runtime/cli-runtime.js +81 -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-L3LAHDIH.js +13 -0
- package/dist/node-runtime/commands-RL5YBW5I.js +291 -0
- package/dist/node-runtime/config-FMEOZSWE.js +77 -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-JVDXTO7A.js +188 -0
- package/dist/node-runtime/exa-LL64QZR2.js +329 -0
- package/dist/node-runtime/export-html-KR26FOUZ.js +150 -0
- package/dist/node-runtime/extension-input-RV5N6APL.js +14 -0
- package/dist/node-runtime/extension-selector-CPD5LWDD.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-X2TI5X7F.js +2484 -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-CZQ7FFQJ.js +1831 -0
- package/dist/node-runtime/index.js +859 -0
- package/dist/node-runtime/init-NJV2T55N.js +28 -0
- package/dist/node-runtime/install-cli-TH7IJJQQ.js +308 -0
- package/dist/node-runtime/interactive-mode-KOM35YF2.js +56 -0
- package/dist/node-runtime/interactive-view-U6OILKF3.js +249 -0
- package/dist/node-runtime/lsp-manager-3ASUSO4T.js +1104 -0
- package/dist/node-runtime/lunr-cron-YJ5UHYRD.js +268 -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-TZZHJCVI.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-QFB37AVN.js +422 -0
- package/dist/node-runtime/pi-ollama-cloud-4VZRMULP.js +1440 -0
- package/dist/node-runtime/pi-prompt-template-model-4QT4LLXF.js +3946 -0
- package/dist/node-runtime/pi-subagents-7XJ4H53P.js +6023 -0
- package/dist/node-runtime/pi-web-access-DPGAVKOA.js +1864 -0
- package/dist/node-runtime/print-mode-VWIRFDAC.js +12 -0
- package/dist/node-runtime/proxy-modes-HEEFK4KC.js +685 -0
- package/dist/node-runtime/rpc-entry.js +62 -0
- package/dist/node-runtime/rpc-mode-SJNSOA4G.js +13 -0
- package/dist/node-runtime/runtime-bridges-PPHNBFWL.js +14 -0
- package/dist/node-runtime/session-manager-MQNBYACL.js +35 -0
- package/dist/node-runtime/session-selector-5AZLJS6U.js +14 -0
- package/dist/node-runtime/settings-manager-5LF2VQWC.js +21 -0
- package/dist/node-runtime/src-Y7JSCK64.js +2407 -0
- package/dist/node-runtime/subagent-executor-5RNDEPIJ.js +8483 -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-A253SZ7P.js +73 -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/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 +55 -0
- package/dist/startup/interactive-view.d.ts.map +1 -0
- package/dist/startup/interactive-view.js +332 -0
- package/dist/startup/interactive-view.js.map +1 -0
- package/dist/startup/launch-routing.d.ts.map +1 -1
- package/dist/startup/launch-routing.js +9 -10
- package/dist/startup/launch-routing.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 +3 -2
- 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/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +10 -4
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/docs/compaction.md +5 -3
- package/docs/development.md +5 -1
- package/docs/features.md +0 -1
- package/docs/interactive-startup.md +98 -0
- package/docs/model-catalog.md +29 -0
- package/docs/usage.md +0 -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/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 +20 -20
- package/dist/core/swarm.d.ts +0 -23
- package/dist/core/swarm.d.ts.map +0 -1
- package/dist/core/swarm.js +0 -45
- package/dist/core/swarm.js.map +0 -1
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
isUserInstructionsPath
|
|
4
|
+
} from "./chunk-M3LZLQW2.js";
|
|
5
|
+
import {
|
|
6
|
+
getAgentDir
|
|
7
|
+
} from "./chunk-PCIGF2XK.js";
|
|
8
|
+
|
|
9
|
+
// packages/coding-agent/dist/core/plan-mode.js
|
|
10
|
+
var PLAN_MODE_ADDENDUM = "You are in plan mode. Investigate read-only, then present your plan by calling the present_plan tool with a concise summary \u2014 the user approves or declines it in a dialog. Do not make changes until the plan is approved. The user can also exit plan mode manually with /plan off.", PLAN_MODE_BLOCK_MESSAGE = "Plan mode is active \u2014 propose a plan; no file changes.", BLOCKED_TOOLS = /* @__PURE__ */ new Set(["edit", "write", "memory_add", "memory_remove", "cron"]), ALLOWED_COMMANDS = /* @__PURE__ */ new Set([
|
|
11
|
+
"ls",
|
|
12
|
+
"ll",
|
|
13
|
+
"cat",
|
|
14
|
+
"tac",
|
|
15
|
+
"grep",
|
|
16
|
+
"rg",
|
|
17
|
+
"find",
|
|
18
|
+
"pwd",
|
|
19
|
+
"echo",
|
|
20
|
+
"printf",
|
|
21
|
+
"head",
|
|
22
|
+
"tail",
|
|
23
|
+
"wc",
|
|
24
|
+
"less",
|
|
25
|
+
"more",
|
|
26
|
+
"sort",
|
|
27
|
+
"uniq",
|
|
28
|
+
"diff",
|
|
29
|
+
"cmp",
|
|
30
|
+
"comm",
|
|
31
|
+
"test",
|
|
32
|
+
"[",
|
|
33
|
+
"true",
|
|
34
|
+
"false",
|
|
35
|
+
"which",
|
|
36
|
+
"whereis",
|
|
37
|
+
"stat",
|
|
38
|
+
"file",
|
|
39
|
+
"id",
|
|
40
|
+
"whoami",
|
|
41
|
+
"who",
|
|
42
|
+
"date",
|
|
43
|
+
"cal",
|
|
44
|
+
"env",
|
|
45
|
+
"printenv",
|
|
46
|
+
"uname",
|
|
47
|
+
"hostname",
|
|
48
|
+
"uptime",
|
|
49
|
+
"nproc",
|
|
50
|
+
"tput",
|
|
51
|
+
"git",
|
|
52
|
+
"gh",
|
|
53
|
+
"node",
|
|
54
|
+
"npm",
|
|
55
|
+
"pnpm",
|
|
56
|
+
"yarn",
|
|
57
|
+
"bun"
|
|
58
|
+
]), MUTATING_GIT_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
59
|
+
"add",
|
|
60
|
+
"commit",
|
|
61
|
+
"push",
|
|
62
|
+
"pull",
|
|
63
|
+
"merge",
|
|
64
|
+
"rebase",
|
|
65
|
+
"reset",
|
|
66
|
+
"checkout",
|
|
67
|
+
"switch",
|
|
68
|
+
"restore",
|
|
69
|
+
"rm",
|
|
70
|
+
"mv",
|
|
71
|
+
"stash",
|
|
72
|
+
"cherry-pick",
|
|
73
|
+
"revert",
|
|
74
|
+
"clean",
|
|
75
|
+
"fetch",
|
|
76
|
+
"config",
|
|
77
|
+
"apply",
|
|
78
|
+
"am",
|
|
79
|
+
"init",
|
|
80
|
+
"clone",
|
|
81
|
+
"submodule",
|
|
82
|
+
"worktree",
|
|
83
|
+
"gc",
|
|
84
|
+
"prune",
|
|
85
|
+
"update-index"
|
|
86
|
+
]), CONDITIONAL_GIT_SUBCOMMANDS = /* @__PURE__ */ new Set(["branch", "tag", "remote"]), CONDITIONAL_GIT_MUTATING_FLAGS = /* @__PURE__ */ new Set(["-d", "-D", "-m", "-M", "-c", "-C"]), PACKAGE_MANAGER_MUTATIONS = {
|
|
87
|
+
npm: /* @__PURE__ */ new Set([
|
|
88
|
+
"install",
|
|
89
|
+
"add",
|
|
90
|
+
"remove",
|
|
91
|
+
"uninstall",
|
|
92
|
+
"update",
|
|
93
|
+
"upgrade",
|
|
94
|
+
"publish",
|
|
95
|
+
"link",
|
|
96
|
+
"unlink",
|
|
97
|
+
"ci",
|
|
98
|
+
"init"
|
|
99
|
+
]),
|
|
100
|
+
pnpm: /* @__PURE__ */ new Set(["install", "add", "remove", "uninstall", "update", "upgrade", "publish", "link", "unlink", "init"]),
|
|
101
|
+
yarn: /* @__PURE__ */ new Set(["install", "add", "remove", "uninstall", "upgrade", "publish", "link", "unlink", "init"]),
|
|
102
|
+
bun: /* @__PURE__ */ new Set(["install", "add", "remove", "uninstall", "update", "upgrade", "publish", "link", "unlink", "init"])
|
|
103
|
+
}, ALWAYS_MUTATING_MANAGERS = /* @__PURE__ */ new Set([
|
|
104
|
+
"apt",
|
|
105
|
+
"apt-get",
|
|
106
|
+
"brew",
|
|
107
|
+
"dnf",
|
|
108
|
+
"yum",
|
|
109
|
+
"pacman",
|
|
110
|
+
"choco",
|
|
111
|
+
"winget",
|
|
112
|
+
"scoop"
|
|
113
|
+
]), EXECUTING_NODE_FLAGS = /* @__PURE__ */ new Set([
|
|
114
|
+
"-e",
|
|
115
|
+
"--eval",
|
|
116
|
+
"-p",
|
|
117
|
+
"--print",
|
|
118
|
+
"-r",
|
|
119
|
+
"--require",
|
|
120
|
+
"--import",
|
|
121
|
+
"-i",
|
|
122
|
+
"--interactive"
|
|
123
|
+
]), EXECUTING_PYTHON_FLAGS = /* @__PURE__ */ new Set(["-c", "-m", "-i", "--interactive"]);
|
|
124
|
+
function isCodeRewriteMutating(input) {
|
|
125
|
+
return input?.dry_run === !1;
|
|
126
|
+
}
|
|
127
|
+
function planModeBlockReason(toolName, input) {
|
|
128
|
+
if (BLOCKED_TOOLS.has(toolName) || toolName === "code_rewrite" && isCodeRewriteMutating(input) || toolName.startsWith("settings_") && toolName !== "settings_load" && Object.keys(input ?? {}).length > 0)
|
|
129
|
+
return PLAN_MODE_BLOCK_MESSAGE;
|
|
130
|
+
if (toolName === "bash") {
|
|
131
|
+
let command = readBashCommand(input);
|
|
132
|
+
if (command && isMutatingBashCommand(command))
|
|
133
|
+
return `${PLAN_MODE_BLOCK_MESSAGE} Blocked command: ${command}`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function readBashCommand(input) {
|
|
137
|
+
let command = input?.command;
|
|
138
|
+
return typeof command == "string" ? command : "";
|
|
139
|
+
}
|
|
140
|
+
function isMutatingBashCommand(command) {
|
|
141
|
+
if (!command.trim())
|
|
142
|
+
return !1;
|
|
143
|
+
if (hasUnquotedRedirect(command) || hasShellSubstitution(command))
|
|
144
|
+
return !0;
|
|
145
|
+
for (let segment of splitShellSegments(command))
|
|
146
|
+
if (isMutatingSegment(segment))
|
|
147
|
+
return !0;
|
|
148
|
+
return !1;
|
|
149
|
+
}
|
|
150
|
+
function hasUnquotedRedirect(command) {
|
|
151
|
+
let quote, escaped = !1;
|
|
152
|
+
for (let i = 0; i < command.length; i++) {
|
|
153
|
+
let ch = command[i];
|
|
154
|
+
if (escaped) {
|
|
155
|
+
escaped = !1;
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (ch === "\\" && quote !== "'") {
|
|
159
|
+
escaped = !0;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (quote) {
|
|
163
|
+
ch === quote && (quote = void 0);
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (ch === "'" || ch === '"') {
|
|
167
|
+
quote = ch;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (ch === ">")
|
|
171
|
+
return !0;
|
|
172
|
+
}
|
|
173
|
+
return !1;
|
|
174
|
+
}
|
|
175
|
+
function splitShellSegments(command) {
|
|
176
|
+
let segments = [], quote, escaped = !1, start = 0;
|
|
177
|
+
for (let i = 0; i < command.length; i++) {
|
|
178
|
+
let ch = command[i], next = command[i + 1];
|
|
179
|
+
if (escaped) {
|
|
180
|
+
escaped = !1;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (ch === "\\" && quote !== "'") {
|
|
184
|
+
escaped = !0;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (quote) {
|
|
188
|
+
ch === quote && (quote = void 0);
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (ch === "'" || ch === '"') {
|
|
192
|
+
quote = ch;
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (ch === "&" && next === "&" || ch === "|" && next === "|") {
|
|
196
|
+
segments.push(command.slice(start, i)), i++, start = i + 1;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
(ch === ";" || ch === "|" || ch === "&" || ch === `
|
|
200
|
+
`) && (segments.push(command.slice(start, i)), start = i + 1);
|
|
201
|
+
}
|
|
202
|
+
return segments.push(command.slice(start)), segments.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
203
|
+
}
|
|
204
|
+
function hasShellSubstitution(command) {
|
|
205
|
+
let quote, escaped = !1;
|
|
206
|
+
for (let i = 0; i < command.length; i++) {
|
|
207
|
+
let ch = command[i];
|
|
208
|
+
if (escaped) {
|
|
209
|
+
escaped = !1;
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
if (ch === "\\" && quote !== "'") {
|
|
213
|
+
escaped = !0;
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (quote) {
|
|
217
|
+
ch === quote && (quote = void 0);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (ch === "'" || ch === '"') {
|
|
221
|
+
quote = ch;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (ch === "`" || ch === "$" && command[i + 1] === "(" || ch === "<" && command[i + 1] === "(" || ch === ">" && command[i + 1] === "(" || ch === "&" && command[i + 1] === ">")
|
|
225
|
+
return !0;
|
|
226
|
+
}
|
|
227
|
+
return !1;
|
|
228
|
+
}
|
|
229
|
+
function isMutatingSegment(segment) {
|
|
230
|
+
let tokens = segment.split(/\s+/).filter((t) => t.length > 0);
|
|
231
|
+
for (; tokens.length > 0 && /^[A-Za-z_][A-Za-z0-9_]*=/.test(tokens[0]); )
|
|
232
|
+
tokens = tokens.slice(1);
|
|
233
|
+
if (tokens.length === 0)
|
|
234
|
+
return !1;
|
|
235
|
+
let command = basenameOf(tokens[0]).toLowerCase(), args = tokens.slice(1);
|
|
236
|
+
if (ALWAYS_MUTATING_MANAGERS.has(command))
|
|
237
|
+
return !0;
|
|
238
|
+
if (command === "sed")
|
|
239
|
+
return args.some((a) => a === "-i" || a.startsWith("-i") || a.startsWith("--in-place") || /^-[^-]*i/.test(a));
|
|
240
|
+
if (command === "find")
|
|
241
|
+
return args.some((a) => ["-delete", "-exec", "-execdir", "-ok", "-okdir"].includes(a));
|
|
242
|
+
if (command === "git")
|
|
243
|
+
return isMutatingGit(args);
|
|
244
|
+
if (command === "gh") {
|
|
245
|
+
let sub = `${args[0] ?? ""} ${args[1] ?? ""}`;
|
|
246
|
+
return ![
|
|
247
|
+
"pr view",
|
|
248
|
+
"pr list",
|
|
249
|
+
"pr status",
|
|
250
|
+
"issue view",
|
|
251
|
+
"issue list",
|
|
252
|
+
"issue status",
|
|
253
|
+
"repo view",
|
|
254
|
+
"release view",
|
|
255
|
+
"release list",
|
|
256
|
+
"run list",
|
|
257
|
+
"run view",
|
|
258
|
+
"status"
|
|
259
|
+
].includes(sub.trim());
|
|
260
|
+
}
|
|
261
|
+
if (command === "sh" || command === "bash" || command === "zsh" || command === "dash")
|
|
262
|
+
return args.some((a) => a === "-c" || a === "-s") || args.some((a) => !a.startsWith("-"));
|
|
263
|
+
let pkgMutations = PACKAGE_MANAGER_MUTATIONS[command];
|
|
264
|
+
if (pkgMutations) {
|
|
265
|
+
let subcommand = args.find((a) => !a.startsWith("-"))?.toLowerCase();
|
|
266
|
+
return subcommand !== void 0 && pkgMutations.has(subcommand);
|
|
267
|
+
}
|
|
268
|
+
return command === "node" ? args.some((a) => !a.startsWith("-")) || args.some((a) => EXECUTING_NODE_FLAGS.has(a)) : command === "python" || command === "python3" ? args.some((a) => !a.startsWith("-")) || args.some((a) => EXECUTING_PYTHON_FLAGS.has(a)) : !ALLOWED_COMMANDS.has(command);
|
|
269
|
+
}
|
|
270
|
+
var GIT_GLOBAL_FLAGS = /* @__PURE__ */ new Set([
|
|
271
|
+
"--no-pager",
|
|
272
|
+
"--paginate",
|
|
273
|
+
"-p",
|
|
274
|
+
"--version",
|
|
275
|
+
"--help",
|
|
276
|
+
"-h",
|
|
277
|
+
"--bare",
|
|
278
|
+
"--no-replace-objects",
|
|
279
|
+
"--no-optional-locks",
|
|
280
|
+
"--literal-pathspecs",
|
|
281
|
+
"--glob-pathspecs",
|
|
282
|
+
"--noglob-pathspecs",
|
|
283
|
+
"--icase-pathspecs"
|
|
284
|
+
]);
|
|
285
|
+
function gitSubcommandIndex(args) {
|
|
286
|
+
let index = 0;
|
|
287
|
+
for (; index < args.length; ) {
|
|
288
|
+
let token = args[index];
|
|
289
|
+
if (!token.startsWith("-"))
|
|
290
|
+
return index;
|
|
291
|
+
if (token === "--")
|
|
292
|
+
return index + 1;
|
|
293
|
+
if (GIT_GLOBAL_FLAGS.has(token)) {
|
|
294
|
+
index++;
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
if (token === "-C" || token === "-c" || token === "--git-dir" || token === "--work-tree" || token === "--namespace") {
|
|
298
|
+
if (args[index + 1] === void 0)
|
|
299
|
+
return -1;
|
|
300
|
+
index += 2;
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
if (token.startsWith("--git-dir=") || token.startsWith("--work-tree=") || token.startsWith("--namespace=") || token.startsWith("--config-env=")) {
|
|
304
|
+
index++;
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
return -1;
|
|
308
|
+
}
|
|
309
|
+
return index;
|
|
310
|
+
}
|
|
311
|
+
function isMutatingGit(args) {
|
|
312
|
+
let index = gitSubcommandIndex(args);
|
|
313
|
+
if (index < 0)
|
|
314
|
+
return !0;
|
|
315
|
+
let subcommand = args[index]?.toLowerCase();
|
|
316
|
+
return subcommand ? MUTATING_GIT_SUBCOMMANDS.has(subcommand) ? !0 : CONDITIONAL_GIT_SUBCOMMANDS.has(subcommand) ? args.slice(index + 1).some((a) => !a.startsWith("-") || CONDITIONAL_GIT_MUTATING_FLAGS.has(a)) : !1 : !1;
|
|
317
|
+
}
|
|
318
|
+
function basenameOf(token) {
|
|
319
|
+
let parts = token.split(/[\\/]/);
|
|
320
|
+
return parts[parts.length - 1] ?? token;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// packages/coding-agent/dist/core/permissions.js
|
|
324
|
+
import { dirname, join, resolve } from "node:path";
|
|
325
|
+
|
|
326
|
+
// packages/coding-agent/dist/core/large-subagent-launch.js
|
|
327
|
+
function countEntry(item) {
|
|
328
|
+
let count = item && typeof item == "object" ? item.count : void 0;
|
|
329
|
+
return typeof count == "number" && Number.isInteger(count) && count >= 1 ? count : 1;
|
|
330
|
+
}
|
|
331
|
+
function isManagementCall(args) {
|
|
332
|
+
return typeof args.action == "string" && args.action.length > 0;
|
|
333
|
+
}
|
|
334
|
+
function isAsyncDetached(args) {
|
|
335
|
+
return args.async === !0 && args.clarify !== !0;
|
|
336
|
+
}
|
|
337
|
+
function effectiveLargeSubagentLaunchCount(args) {
|
|
338
|
+
let total = 0;
|
|
339
|
+
if (Array.isArray(args.tasks))
|
|
340
|
+
for (let task of args.tasks)
|
|
341
|
+
total += countEntry(task);
|
|
342
|
+
if (Array.isArray(args.chain))
|
|
343
|
+
for (let step of args.chain) {
|
|
344
|
+
let parallel = step && typeof step == "object" ? step.parallel : void 0;
|
|
345
|
+
if (Array.isArray(parallel))
|
|
346
|
+
for (let child of parallel)
|
|
347
|
+
total += countEntry(child);
|
|
348
|
+
}
|
|
349
|
+
return total;
|
|
350
|
+
}
|
|
351
|
+
function siblingSingleCount(args) {
|
|
352
|
+
return isManagementCall(args) || isAsyncDetached(args) || Array.isArray(args.tasks) || Array.isArray(args.chain) ? 0 : typeof args.task == "string" && args.task.length > 0 && typeof args.description == "string" && args.description.length > 0 ? 1 : 0;
|
|
353
|
+
}
|
|
354
|
+
function effectiveLargeSubagentLaunchCountForTurn(args, assistantMessage) {
|
|
355
|
+
let own = effectiveLargeSubagentLaunchCount(args), siblingSingles = (assistantMessage?.content ?? []).reduce((total, block) => {
|
|
356
|
+
if (block.type !== "toolCall" || block.name !== "subagent")
|
|
357
|
+
return total;
|
|
358
|
+
let siblingArgs = block.arguments && typeof block.arguments == "object" && !Array.isArray(block.arguments) ? block.arguments : void 0;
|
|
359
|
+
return siblingArgs ? total + siblingSingleCount(siblingArgs) : total;
|
|
360
|
+
}, 0);
|
|
361
|
+
return Math.max(own, siblingSingles);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// packages/coding-agent/dist/core/permissions.js
|
|
365
|
+
var PERMISSION_MODES = ["manual", "yolo", "plan", "auto"];
|
|
366
|
+
function nextPermissionMode(current) {
|
|
367
|
+
let i = PERMISSION_MODES.indexOf(current);
|
|
368
|
+
return PERMISSION_MODES[(i + 1) % PERMISSION_MODES.length];
|
|
369
|
+
}
|
|
370
|
+
function isPlanModeActive(sessionId) {
|
|
371
|
+
return getPermissionMode(sessionId) === "plan";
|
|
372
|
+
}
|
|
373
|
+
function restorePermissionModeAfterPlan(previous, defaultMode) {
|
|
374
|
+
return previous && previous !== "plan" ? previous : defaultMode === "plan" ? "yolo" : defaultMode;
|
|
375
|
+
}
|
|
376
|
+
var READ_ONLY_TOOLS = /* @__PURE__ */ new Set([
|
|
377
|
+
"read",
|
|
378
|
+
"grep",
|
|
379
|
+
"find",
|
|
380
|
+
"ls",
|
|
381
|
+
"web_search",
|
|
382
|
+
"web_fetch",
|
|
383
|
+
"fetch_content",
|
|
384
|
+
"get_search_content",
|
|
385
|
+
"sourcegraph",
|
|
386
|
+
"repo_map",
|
|
387
|
+
"symbol_outline",
|
|
388
|
+
"read_block",
|
|
389
|
+
"code_overview",
|
|
390
|
+
"ast_search",
|
|
391
|
+
"lsp_diagnostics",
|
|
392
|
+
"lsp_hover",
|
|
393
|
+
"lsp_definition",
|
|
394
|
+
"lsp_references",
|
|
395
|
+
"lsp_symbols",
|
|
396
|
+
"lsp_code_actions",
|
|
397
|
+
"lsp_completions",
|
|
398
|
+
"memory_load",
|
|
399
|
+
"settings_load"
|
|
400
|
+
]), MUTATING_TOOLS = /* @__PURE__ */ new Set(["bash", "edit", "write", "memory_add", "memory_remove", "cron"]), REJECT_REASON = "Rejected by user (permission mode: manual).", NO_HANDLER_REASON = "Mutating tool blocked in manual mode: no approval channel available.", LARGE_SUBAGENT_LAUNCH_REJECT_REASON = "Large subagent launch rejected by user.", NO_LARGE_SUBAGENT_LAUNCH_HANDLER_REASON = "Large subagent launch blocked: no approval channel available.", LARGE_SUBAGENT_LAUNCH_ACTION = "large-subagent-launch", FULL_CHILD_ACTION = "subagent-full", contexts = /* @__PURE__ */ new Map(), defaultContext = { mode: "manual", approvals: /* @__PURE__ */ new Set() }, approvalHandler, turnLargeLaunchDecisions = /* @__PURE__ */ new WeakMap();
|
|
401
|
+
function getContext(sessionId) {
|
|
402
|
+
return sessionId ? contexts.get(sessionId) ?? defaultContext : defaultContext;
|
|
403
|
+
}
|
|
404
|
+
function createPermissionContext(sessionId, mode = defaultContext.mode) {
|
|
405
|
+
contexts.set(sessionId, { mode, approvals: /* @__PURE__ */ new Set() });
|
|
406
|
+
}
|
|
407
|
+
function deletePermissionContext(sessionId) {
|
|
408
|
+
contexts.delete(sessionId);
|
|
409
|
+
}
|
|
410
|
+
function getPermissionMode(sessionId) {
|
|
411
|
+
return getContext(sessionId).mode;
|
|
412
|
+
}
|
|
413
|
+
function setPermissionMode(mode, sessionId) {
|
|
414
|
+
getContext(sessionId).mode = mode;
|
|
415
|
+
}
|
|
416
|
+
function resetPermissions(defaultMode = "manual", sessionId) {
|
|
417
|
+
sessionId ? contexts.set(sessionId, { mode: defaultMode, approvals: /* @__PURE__ */ new Set() }) : defaultContext = { mode: defaultMode, approvals: /* @__PURE__ */ new Set() };
|
|
418
|
+
}
|
|
419
|
+
function registerApprovalHandler(fn) {
|
|
420
|
+
approvalHandler = fn;
|
|
421
|
+
}
|
|
422
|
+
var PLAN_APPROVED_TEXT = "Plan approved \u2014 implement it now.", PLAN_DECLINED_TEXT = "Plan declined \u2014 revise the plan and call present_plan again.", PLAN_PASS_THROUGH_TEXT = "Plan presented. The user will review and reply.";
|
|
423
|
+
function planApprovalResultText(resp) {
|
|
424
|
+
let decision = typeof resp == "string" ? resp : resp.decision, feedback = typeof resp == "string" ? void 0 : resp.feedback?.trim();
|
|
425
|
+
return decision === "reject" ? feedback ? `Plan declined: ${feedback} \u2014 revise the plan and call present_plan again.` : PLAN_DECLINED_TEXT : feedback ? `Plan approved with feedback: ${feedback} \u2014 implement it now.` : PLAN_APPROVED_TEXT;
|
|
426
|
+
}
|
|
427
|
+
async function requestPlanApproval(summary) {
|
|
428
|
+
if (!approvalHandler)
|
|
429
|
+
return PLAN_PASS_THROUGH_TEXT;
|
|
430
|
+
let resp;
|
|
431
|
+
try {
|
|
432
|
+
resp = await approvalHandler({ toolName: "present_plan", action: "plan", detail: summary, kind: "plan" });
|
|
433
|
+
} catch (err) {
|
|
434
|
+
let message = err instanceof Error ? err.message : "approval request failed";
|
|
435
|
+
return message === NO_HANDLER_REASON ? PLAN_PASS_THROUGH_TEXT : `Plan declined: ${message} \u2014 revise the plan and call present_plan again.`;
|
|
436
|
+
}
|
|
437
|
+
return planApprovalResultText(resp);
|
|
438
|
+
}
|
|
439
|
+
var AUTO_MODE_ADDENDUM = "You are running fully autonomously. Do not ask the user questions or wait for confirmation; make reasonable decisions and complete the task end-to-end.";
|
|
440
|
+
function isPathOutsideCwd(absPath, cwd) {
|
|
441
|
+
let norm = (p) => p.replace(/\\/g, "/").replace(/\/$/, ""), np = norm(absPath), nc = norm(cwd);
|
|
442
|
+
return np === nc ? !1 : !np.startsWith(`${nc}/`);
|
|
443
|
+
}
|
|
444
|
+
function resolvePath(cwd, p) {
|
|
445
|
+
return typeof p != "string" || !p ? "" : resolve(cwd, p);
|
|
446
|
+
}
|
|
447
|
+
var GLOBAL_AGENTS_FILE_WRITE_BLOCK_REASON = "The agents instruction tree is user-managed. The agent cannot change ~/.lunr/agent/agents/.", MEMORY_FILE_DIRECT_WRITE_BLOCK_REASON = "Memory is model-managed through the memory tools. Do not directly change ~/.lunr/simple-memory/memory.md.";
|
|
448
|
+
function protectedFileWriteReason(toolName, input, cwd) {
|
|
449
|
+
if (toolName !== "edit" && toolName !== "write" && toolName !== "code_rewrite")
|
|
450
|
+
return;
|
|
451
|
+
let target = resolvePath(cwd, input.path);
|
|
452
|
+
if (!target)
|
|
453
|
+
return;
|
|
454
|
+
let normalize = (path) => {
|
|
455
|
+
let normalized = resolve(path).replace(/\\/g, "/").replace(/\/$/, "");
|
|
456
|
+
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
457
|
+
};
|
|
458
|
+
if (isUserInstructionsPath(target, getAgentDir()))
|
|
459
|
+
return GLOBAL_AGENTS_FILE_WRITE_BLOCK_REASON;
|
|
460
|
+
if (normalize(target) === normalize(join(dirname(getAgentDir()), "simple-memory", "memory.md")))
|
|
461
|
+
return MEMORY_FILE_DIRECT_WRITE_BLOCK_REASON;
|
|
462
|
+
}
|
|
463
|
+
function isMutatingTool(toolName) {
|
|
464
|
+
return MUTATING_TOOLS.has(toolName);
|
|
465
|
+
}
|
|
466
|
+
function collectRequestedChildLaunches(value, launches) {
|
|
467
|
+
if (!value || typeof value != "object" || Array.isArray(value))
|
|
468
|
+
return;
|
|
469
|
+
let input = value;
|
|
470
|
+
if (typeof input.task == "string" && input.task.trim()) {
|
|
471
|
+
launches.push({
|
|
472
|
+
description: typeof input.description == "string" && input.description.trim() ? input.description.trim() : input.task.trim(),
|
|
473
|
+
permissions: input.permissions === "read-only" ? "read-only" : "full"
|
|
474
|
+
});
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
for (let key of ["tasks", "chain", "parallel"]) {
|
|
478
|
+
let children = input[key];
|
|
479
|
+
if (Array.isArray(children))
|
|
480
|
+
for (let child of children)
|
|
481
|
+
collectRequestedChildLaunches(child, launches);
|
|
482
|
+
else key === "parallel" && collectRequestedChildLaunches(children, launches);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function getRequestedChildLaunches(input) {
|
|
486
|
+
let launches = [];
|
|
487
|
+
return collectRequestedChildLaunches(input, launches), launches;
|
|
488
|
+
}
|
|
489
|
+
function requiresManualApproval(toolName, input) {
|
|
490
|
+
return isMutatingTool(toolName) ? !0 : toolName.startsWith("settings_") && toolName !== "settings_load" ? Object.keys(input).length > 0 : toolName === "subagent" ? getRequestedChildLaunches(input).some((launch) => launch.permissions === "full") : toolName === "code_rewrite" && isCodeRewriteMutating(input);
|
|
491
|
+
}
|
|
492
|
+
function firstTaskText(value) {
|
|
493
|
+
return typeof value == "string" && value.trim() ? sanitizeDetail(value) : "";
|
|
494
|
+
}
|
|
495
|
+
function largeLaunchTaskSummary(input, assistantMessage) {
|
|
496
|
+
if (Array.isArray(input.tasks))
|
|
497
|
+
for (let task of input.tasks) {
|
|
498
|
+
let text = task && typeof task == "object" ? firstTaskText(task.task) : "";
|
|
499
|
+
if (text)
|
|
500
|
+
return text;
|
|
501
|
+
}
|
|
502
|
+
let own = firstTaskText(input.task);
|
|
503
|
+
if (own)
|
|
504
|
+
return own;
|
|
505
|
+
for (let block of assistantMessage?.content ?? []) {
|
|
506
|
+
if (block.type !== "toolCall" || block.name !== "subagent")
|
|
507
|
+
continue;
|
|
508
|
+
let args = block.arguments && typeof block.arguments == "object" && !Array.isArray(block.arguments) ? block.arguments : void 0, text = firstTaskText(args?.task);
|
|
509
|
+
if (text)
|
|
510
|
+
return text;
|
|
511
|
+
}
|
|
512
|
+
return "";
|
|
513
|
+
}
|
|
514
|
+
async function gateLargeSubagentLaunch(input, ctx, options) {
|
|
515
|
+
if (ctx.mode === "auto" || options?.confirmLargeSubagentLaunches === !1)
|
|
516
|
+
return;
|
|
517
|
+
let count = effectiveLargeSubagentLaunchCountForTurn(input, options?.assistantMessage);
|
|
518
|
+
if (count <= 2)
|
|
519
|
+
return;
|
|
520
|
+
if (ctx.approvals.has(LARGE_SUBAGENT_LAUNCH_ACTION))
|
|
521
|
+
return { fullChildrenApproved: !1 };
|
|
522
|
+
let turnKey = options?.assistantMessage, cached = turnKey ? turnLargeLaunchDecisions.get(turnKey) : void 0;
|
|
523
|
+
if (cached)
|
|
524
|
+
return cached.decision === "reject" ? {
|
|
525
|
+
block: !0,
|
|
526
|
+
reason: cached.feedback ? `${LARGE_SUBAGENT_LAUNCH_REJECT_REASON} ${cached.feedback}` : LARGE_SUBAGENT_LAUNCH_REJECT_REASON
|
|
527
|
+
} : { fullChildrenApproved: cached.fullChildrenApproved };
|
|
528
|
+
if (!approvalHandler)
|
|
529
|
+
return { block: !0, reason: NO_LARGE_SUBAGENT_LAUNCH_HANDLER_REASON };
|
|
530
|
+
let summary = largeLaunchTaskSummary(input, options?.assistantMessage), siblingLaunches = (options?.assistantMessage?.content ?? []).flatMap((block) => {
|
|
531
|
+
if (block.type !== "toolCall" || block.name !== "subagent")
|
|
532
|
+
return [];
|
|
533
|
+
let args = block.arguments && typeof block.arguments == "object" && !Array.isArray(block.arguments) ? block.arguments : void 0;
|
|
534
|
+
return args ? getRequestedChildLaunches(args) : [];
|
|
535
|
+
}), launches = siblingLaunches.length > 0 ? siblingLaunches : getRequestedChildLaunches(input), fullChildrenApproved = launches.some((launch) => launch.permissions === "full"), launchSummary = launches.map((launch) => `${launch.description}
|
|
536
|
+
permissions: ${launch.permissions}`).join(`
|
|
537
|
+
`), resp;
|
|
538
|
+
try {
|
|
539
|
+
resp = await approvalHandler({
|
|
540
|
+
toolName: "subagent",
|
|
541
|
+
action: LARGE_SUBAGENT_LAUNCH_ACTION,
|
|
542
|
+
detail: `large subagent launch (${count} children)${launchSummary || summary ? `
|
|
543
|
+
${launchSummary || summary}` : ""}`,
|
|
544
|
+
kind: "large-subagent-launch"
|
|
545
|
+
});
|
|
546
|
+
} catch (err) {
|
|
547
|
+
return { block: !0, reason: err instanceof Error ? err.message : NO_LARGE_SUBAGENT_LAUNCH_HANDLER_REASON };
|
|
548
|
+
}
|
|
549
|
+
let rawDecision = typeof resp == "string" ? resp : resp.decision, decision = rawDecision === "approve" ? "once" : rawDecision, feedback = typeof resp == "string" ? void 0 : resp.feedback?.trim();
|
|
550
|
+
return turnKey && turnLargeLaunchDecisions.set(turnKey, { decision, ...feedback ? { feedback } : {}, fullChildrenApproved }), decision === "session" ? (ctx.approvals.add(LARGE_SUBAGENT_LAUNCH_ACTION), fullChildrenApproved && ctx.approvals.add(FULL_CHILD_ACTION), { fullChildrenApproved }) : decision === "reject" ? {
|
|
551
|
+
block: !0,
|
|
552
|
+
reason: feedback ? `${LARGE_SUBAGENT_LAUNCH_REJECT_REASON} ${feedback}` : LARGE_SUBAGENT_LAUNCH_REJECT_REASON
|
|
553
|
+
} : { fullChildrenApproved };
|
|
554
|
+
}
|
|
555
|
+
function sanitizeDetail(value) {
|
|
556
|
+
let text = String(value ?? "").trim();
|
|
557
|
+
return text.length > 200 ? `${text.slice(0, 200)}\u2026` : text;
|
|
558
|
+
}
|
|
559
|
+
async function gateToolCall(toolName, input, cwd, sessionId, options) {
|
|
560
|
+
let ctx = getContext(sessionId), protectedWriteReason = protectedFileWriteReason(toolName, input, cwd);
|
|
561
|
+
if (protectedWriteReason)
|
|
562
|
+
return { block: !0, reason: protectedWriteReason };
|
|
563
|
+
if (READ_ONLY_TOOLS.has(toolName))
|
|
564
|
+
return;
|
|
565
|
+
let largeLaunchCoveredManualApproval = !1;
|
|
566
|
+
if (toolName === "subagent") {
|
|
567
|
+
let launchResult = await gateLargeSubagentLaunch(input, ctx, options);
|
|
568
|
+
if (launchResult && "block" in launchResult)
|
|
569
|
+
return launchResult;
|
|
570
|
+
largeLaunchCoveredManualApproval = ctx.mode === "manual" && launchResult?.fullChildrenApproved === !0;
|
|
571
|
+
}
|
|
572
|
+
if (ctx.mode === "plan") {
|
|
573
|
+
let reason = planModeBlockReason(toolName, input);
|
|
574
|
+
return reason ? { block: !0, reason } : void 0;
|
|
575
|
+
}
|
|
576
|
+
if (ctx.mode !== "manual" || !requiresManualApproval(toolName, input) || largeLaunchCoveredManualApproval)
|
|
577
|
+
return;
|
|
578
|
+
let action, detail;
|
|
579
|
+
if (toolName === "bash")
|
|
580
|
+
action = "bash", detail = sanitizeDetail(input.command);
|
|
581
|
+
else if (toolName === "edit" || toolName === "write") {
|
|
582
|
+
let path = resolvePath(cwd, input.path);
|
|
583
|
+
action = (path ? isPathOutsideCwd(path, cwd) : !1) ? `${toolName}-outside` : toolName, detail = path || String(input.path ?? "");
|
|
584
|
+
} else if (toolName === "memory_add")
|
|
585
|
+
action = toolName, detail = sanitizeDetail(input.content);
|
|
586
|
+
else if (toolName === "memory_remove")
|
|
587
|
+
action = toolName, detail = sanitizeDetail(input.line);
|
|
588
|
+
else if (toolName === "cron")
|
|
589
|
+
action = "cron", detail = sanitizeDetail(input.action);
|
|
590
|
+
else if (toolName === "subagent") {
|
|
591
|
+
action = FULL_CHILD_ACTION;
|
|
592
|
+
let launches = getRequestedChildLaunches(input).filter((launch) => launch.permissions === "full");
|
|
593
|
+
detail = sanitizeDetail(launches.map((launch) => `${launch.description}
|
|
594
|
+
permissions: ${launch.permissions}`).join(`
|
|
595
|
+
`));
|
|
596
|
+
} else toolName === "code_rewrite" ? (action = "code_rewrite", detail = sanitizeDetail(input.path ?? input.pattern)) : (action = toolName, detail = "");
|
|
597
|
+
if (ctx.approvals.has(action))
|
|
598
|
+
return;
|
|
599
|
+
if (!approvalHandler)
|
|
600
|
+
return { block: !0, reason: NO_HANDLER_REASON };
|
|
601
|
+
let resp;
|
|
602
|
+
try {
|
|
603
|
+
resp = await approvalHandler({ toolName, action, detail });
|
|
604
|
+
} catch (err) {
|
|
605
|
+
return { block: !0, reason: err instanceof Error ? err.message : NO_HANDLER_REASON };
|
|
606
|
+
}
|
|
607
|
+
let decision = typeof resp == "string" ? resp : resp.decision;
|
|
608
|
+
if (decision === "session") {
|
|
609
|
+
ctx.approvals.add(action);
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
if (decision === "reject") {
|
|
613
|
+
let feedback = typeof resp == "string" ? void 0 : resp.feedback?.trim();
|
|
614
|
+
return { block: !0, reason: feedback ? `${REJECT_REASON} ${feedback}` : REJECT_REASON };
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export {
|
|
619
|
+
PLAN_MODE_ADDENDUM,
|
|
620
|
+
nextPermissionMode,
|
|
621
|
+
isPlanModeActive,
|
|
622
|
+
restorePermissionModeAfterPlan,
|
|
623
|
+
NO_HANDLER_REASON,
|
|
624
|
+
createPermissionContext,
|
|
625
|
+
deletePermissionContext,
|
|
626
|
+
getPermissionMode,
|
|
627
|
+
setPermissionMode,
|
|
628
|
+
resetPermissions,
|
|
629
|
+
registerApprovalHandler,
|
|
630
|
+
requestPlanApproval,
|
|
631
|
+
AUTO_MODE_ADDENDUM,
|
|
632
|
+
gateToolCall
|
|
633
|
+
};
|