@ashx-j/lunr-dev 0.2.13-dev.8.1 → 0.2.19-dev.10.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 +60 -1
- package/README.md +7 -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 +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 +8 -21
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/lunr-computer-use.d.ts +3 -0
- package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-computer-use.js +157 -0
- package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
- 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 +172 -171
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +50 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +131 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts +7 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js +211 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts +0 -5
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +0 -202
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.js +276 -109
- package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts +4 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.js +10 -3
- package/dist/builtin-extensions/pi-mcp-adapter/init.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js +6 -1
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +6 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js +2 -1
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +68 -15
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +6 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +5 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js +38 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +3 -16
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.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/catalog/publication.json +12 -12
- 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-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session-services.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/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/computer-use/adapter.d.ts +23 -0
- package/dist/core/computer-use/adapter.d.ts.map +1 -0
- package/dist/core/computer-use/adapter.js +116 -0
- package/dist/core/computer-use/adapter.js.map +1 -0
- package/dist/core/computer-use/lease.d.ts +18 -0
- package/dist/core/computer-use/lease.d.ts.map +1 -0
- package/dist/core/computer-use/lease.js +129 -0
- package/dist/core/computer-use/lease.js.map +1 -0
- package/dist/core/computer-use/macos-runtime.d.ts +14 -0
- package/dist/core/computer-use/macos-runtime.d.ts.map +1 -0
- package/dist/core/computer-use/macos-runtime.js +148 -0
- package/dist/core/computer-use/macos-runtime.js.map +1 -0
- package/dist/core/computer-use/policy.d.ts +19 -0
- package/dist/core/computer-use/policy.d.ts.map +1 -0
- package/dist/core/computer-use/policy.js +66 -0
- package/dist/core/computer-use/policy.js.map +1 -0
- package/dist/core/computer-use/release.generated.d.ts +31 -0
- package/dist/core/computer-use/release.generated.d.ts.map +1 -0
- package/dist/core/computer-use/release.generated.js +36 -0
- package/dist/core/computer-use/release.generated.js.map +1 -0
- package/dist/core/computer-use/runtime.d.ts +13 -0
- package/dist/core/computer-use/runtime.d.ts.map +1 -0
- package/dist/core/computer-use/runtime.js +158 -0
- package/dist/core/computer-use/runtime.js.map +1 -0
- package/dist/core/computer-use/schemas.d.ts +88 -0
- package/dist/core/computer-use/schemas.d.ts.map +1 -0
- package/dist/core/computer-use/schemas.js +80 -0
- package/dist/core/computer-use/schemas.js.map +1 -0
- package/dist/core/computer-use/windows-desktop.d.ts +3 -0
- package/dist/core/computer-use/windows-desktop.d.ts.map +1 -0
- package/dist/core/computer-use/windows-desktop.js +48 -0
- package/dist/core/computer-use/windows-desktop.js.map +1 -0
- package/dist/core/computer-use/workflow.d.ts +24 -0
- package/dist/core/computer-use/workflow.d.ts.map +1 -0
- package/dist/core/computer-use/workflow.js +330 -0
- package/dist/core/computer-use/workflow.js.map +1 -0
- 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/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/model-runtime.d.ts +0 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +1 -10
- package/dist/core/model-runtime.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/permissions.d.ts +1 -3
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +33 -25
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +9 -0
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/rollback.d.ts.map +1 -1
- package/dist/core/rollback.js +13 -90
- package/dist/core/rollback.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/session-manager.d.ts +0 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +21 -79
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +6 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +19 -0
- package/dist/core/settings-manager.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/dev-cli.js +0 -0
- 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/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/gateway/cron.d.ts +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +23 -7
- package/dist/gateway/cron.js.map +1 -1
- package/dist/main.d.ts +2 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +57 -48
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +4 -2
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +23 -32
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/processes-selector.d.ts +2 -3
- package/dist/modes/interactive/components/processes-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/processes-selector.js +5 -10
- package/dist/modes/interactive/components/processes-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +12 -21
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +138 -152
- 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/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/adapter-AZMY335J.js +279 -0
- package/dist/node-runtime/agent-session-services-RSGP5GDN.js +39 -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-7STLFW3A.js +29 -0
- package/dist/node-runtime/chunk-2IDTZAG5.js +1415 -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-4SJWFTUP.js +24 -0
- package/dist/node-runtime/chunk-4ZWGEEAS.js +69 -0
- package/dist/node-runtime/chunk-53YJI7JU.js +137 -0
- package/dist/node-runtime/chunk-5NWQCSKR.js +19218 -0
- package/dist/node-runtime/chunk-5OLJGVCB.js +68 -0
- package/dist/node-runtime/chunk-5Q45AVQG.js +108 -0
- package/dist/node-runtime/chunk-5SQDLSZJ.js +949 -0
- package/dist/node-runtime/chunk-6SPPH4FY.js +1269 -0
- package/dist/node-runtime/chunk-6UB6NKA3.js +860 -0
- package/dist/node-runtime/chunk-7AFOFSDY.js +105 -0
- package/dist/node-runtime/chunk-7N3YHTYF.js +26 -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-BKAZ6BKX.js +2185 -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-CGBXPL3E.js +1171 -0
- package/dist/node-runtime/chunk-CH6OL6P2.js +295 -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-EH2LJQPM.js +64 -0
- package/dist/node-runtime/chunk-EHMBW7FA.js +772 -0
- package/dist/node-runtime/chunk-FLYMHKCS.js +966 -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-HRS4HMDX.js +610 -0
- package/dist/node-runtime/chunk-HYHJIRDW.js +19 -0
- package/dist/node-runtime/chunk-I6R76AG7.js +22 -0
- package/dist/node-runtime/chunk-ISQDQIZN.js +296 -0
- package/dist/node-runtime/chunk-J7QGQD45.js +24921 -0
- package/dist/node-runtime/chunk-JHYKXIMM.js +378 -0
- package/dist/node-runtime/chunk-JT6YCS5B.js +5648 -0
- package/dist/node-runtime/chunk-JZHEUQRL.js +180 -0
- package/dist/node-runtime/chunk-K72NVGUB.js +2834 -0
- package/dist/node-runtime/chunk-KKSIVROT.js +88 -0
- package/dist/node-runtime/chunk-LCACDWHJ.js +1743 -0
- package/dist/node-runtime/chunk-LTXUQJI4.js +173 -0
- package/dist/node-runtime/chunk-LWJXTA6Z.js +6814 -0
- package/dist/node-runtime/chunk-M3LZLQW2.js +98 -0
- package/dist/node-runtime/chunk-MGSB2C3M.js +46 -0
- package/dist/node-runtime/chunk-MGWCVY6Y.js +47 -0
- package/dist/node-runtime/chunk-MJQDX3BA.js +72 -0
- package/dist/node-runtime/chunk-MUMMMTW4.js +8392 -0
- package/dist/node-runtime/chunk-MX3GJNXJ.js +986 -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-OTT6JMPU.js +807 -0
- package/dist/node-runtime/chunk-PCIGF2XK.js +250 -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-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-T5GM5BFH.js +7558 -0
- package/dist/node-runtime/chunk-TAP7QTUT.js +1346 -0
- package/dist/node-runtime/chunk-U6C7VTR5.js +2033 -0
- package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
- package/dist/node-runtime/chunk-VRB2IYGG.js +53 -0
- package/dist/node-runtime/chunk-W3CVH5RX.js +62 -0
- package/dist/node-runtime/chunk-W7S2REEG.js +9478 -0
- package/dist/node-runtime/chunk-XBWPBZBN.js +125 -0
- package/dist/node-runtime/chunk-XTHQ7XR7.js +509 -0
- package/dist/node-runtime/chunk-ZCHMJ34K.js +130 -0
- package/dist/node-runtime/chunk-ZRDIMBEQ.js +651 -0
- package/dist/node-runtime/chunk-ZSEZY3II.js +247 -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-6UXQ6XZN.js +13 -0
- package/dist/node-runtime/commands-LGR5VT5X.js +293 -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-TDJS7TBD.js +191 -0
- package/dist/node-runtime/exa-LL64QZR2.js +329 -0
- package/dist/node-runtime/export-html-E4DT6ZJQ.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-IUCVZCWC.js +17 -0
- package/dist/node-runtime/file-sync-HCOP2QVF.js +117 -0
- package/dist/node-runtime/gateway-3OLC4GQN.js +2139 -0
- package/dist/node-runtime/gemini-api-QE7ANVDZ.js +29 -0
- package/dist/node-runtime/gemini-search-NCIDF7NE.js +330 -0
- package/dist/node-runtime/gemini-url-context-OKIN7AIP.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/image-resize-6ZPBFMWW.js +11 -0
- package/dist/node-runtime/index.js +863 -0
- package/dist/node-runtime/init-EKE277AG.js +30 -0
- package/dist/node-runtime/install-cli-TH7IJJQQ.js +308 -0
- package/dist/node-runtime/interactive-mode-S5M26CQ7.js +59 -0
- package/dist/node-runtime/interactive-view-N6F4KUIT.js +247 -0
- package/dist/node-runtime/lsp-manager-3ASUSO4T.js +1104 -0
- package/dist/node-runtime/lunr-computer-use-4X3KUNF4.js +206 -0
- package/dist/node-runtime/lunr-cron-KKBOGAEF.js +274 -0
- package/dist/node-runtime/main.js +57 -0
- package/dist/node-runtime/mcp-auth-flow-YL6RWPYG.js +33 -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-C4EJOO5Q.js +751 -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-DPTJGAAL.js +428 -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-VKCLYIBY.js +6050 -0
- package/dist/node-runtime/pi-web-access-BV6DSZOP.js +1867 -0
- package/dist/node-runtime/print-mode-VWIRFDAC.js +12 -0
- package/dist/node-runtime/proxy-modes-R64LU6WZ.js +688 -0
- package/dist/node-runtime/rpc-entry.js +65 -0
- package/dist/node-runtime/rpc-mode-SJNSOA4G.js +13 -0
- package/dist/node-runtime/runtime-3SB5ATHQ.js +21 -0
- package/dist/node-runtime/runtime-bridges-UJ5WJJLN.js +14 -0
- package/dist/node-runtime/session-manager-QEMZBMTM.js +33 -0
- package/dist/node-runtime/session-selector-URVJLOTK.js +14 -0
- package/dist/node-runtime/settings-manager-K6IPIQTI.js +23 -0
- package/dist/node-runtime/src-GPFAU3N6.js +2427 -0
- package/dist/node-runtime/subagent-executor-EFLTO32A.js +8501 -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-I6OVDRPL.js +75 -0
- package/dist/node-runtime/v4-5MNC3H7G.js +424 -0
- package/dist/node-runtime/video-extract-ETA5RA7U.js +304 -0
- package/dist/node-runtime/workflow-SA34S4VX.js +325 -0
- package/dist/node-runtime/workspace-index-6DBXSTJ6.js +163 -0
- package/dist/node-runtime/youtube-extract-SRVGNN26.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-shell.d.ts → interactive-view.d.ts} +18 -18
- package/dist/startup/interactive-view.d.ts.map +1 -0
- package/dist/startup/{interactive-shell.js → interactive-view.js} +119 -52
- 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/computer-use.md +277 -0
- package/docs/development.md +5 -33
- package/docs/features.md +2 -3
- package/docs/interactive-startup.md +105 -0
- package/docs/keybindings.md +2 -2
- package/docs/terminal-setup.md +1 -1
- package/docs/usage.md +1 -2
- 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/install-lock/package-lock.json +3827 -0
- package/install-lock/package.json +18 -0
- package/native/computer-use/LICENSE.md +21 -0
- package/npm-shrinkwrap.json +3808 -0
- package/package.json +30 -24
- 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
- package/dist/startup/interactive-shell.d.ts.map +0 -1
- package/dist/startup/interactive-shell.js.map +0 -1
|
@@ -0,0 +1,651 @@
|
|
|
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
|
+
computerPolicy
|
|
7
|
+
} from "./chunk-5OLJGVCB.js";
|
|
8
|
+
import {
|
|
9
|
+
getAgentDir
|
|
10
|
+
} from "./chunk-PCIGF2XK.js";
|
|
11
|
+
|
|
12
|
+
// packages/coding-agent/dist/core/plan-mode.js
|
|
13
|
+
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([
|
|
14
|
+
"ls",
|
|
15
|
+
"ll",
|
|
16
|
+
"cat",
|
|
17
|
+
"tac",
|
|
18
|
+
"grep",
|
|
19
|
+
"rg",
|
|
20
|
+
"find",
|
|
21
|
+
"pwd",
|
|
22
|
+
"echo",
|
|
23
|
+
"printf",
|
|
24
|
+
"head",
|
|
25
|
+
"tail",
|
|
26
|
+
"wc",
|
|
27
|
+
"less",
|
|
28
|
+
"more",
|
|
29
|
+
"sort",
|
|
30
|
+
"uniq",
|
|
31
|
+
"diff",
|
|
32
|
+
"cmp",
|
|
33
|
+
"comm",
|
|
34
|
+
"test",
|
|
35
|
+
"[",
|
|
36
|
+
"true",
|
|
37
|
+
"false",
|
|
38
|
+
"which",
|
|
39
|
+
"whereis",
|
|
40
|
+
"stat",
|
|
41
|
+
"file",
|
|
42
|
+
"id",
|
|
43
|
+
"whoami",
|
|
44
|
+
"who",
|
|
45
|
+
"date",
|
|
46
|
+
"cal",
|
|
47
|
+
"env",
|
|
48
|
+
"printenv",
|
|
49
|
+
"uname",
|
|
50
|
+
"hostname",
|
|
51
|
+
"uptime",
|
|
52
|
+
"nproc",
|
|
53
|
+
"tput",
|
|
54
|
+
"git",
|
|
55
|
+
"gh",
|
|
56
|
+
"node",
|
|
57
|
+
"npm",
|
|
58
|
+
"pnpm",
|
|
59
|
+
"yarn",
|
|
60
|
+
"bun"
|
|
61
|
+
]), MUTATING_GIT_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
62
|
+
"add",
|
|
63
|
+
"commit",
|
|
64
|
+
"push",
|
|
65
|
+
"pull",
|
|
66
|
+
"merge",
|
|
67
|
+
"rebase",
|
|
68
|
+
"reset",
|
|
69
|
+
"checkout",
|
|
70
|
+
"switch",
|
|
71
|
+
"restore",
|
|
72
|
+
"rm",
|
|
73
|
+
"mv",
|
|
74
|
+
"stash",
|
|
75
|
+
"cherry-pick",
|
|
76
|
+
"revert",
|
|
77
|
+
"clean",
|
|
78
|
+
"fetch",
|
|
79
|
+
"config",
|
|
80
|
+
"apply",
|
|
81
|
+
"am",
|
|
82
|
+
"init",
|
|
83
|
+
"clone",
|
|
84
|
+
"submodule",
|
|
85
|
+
"worktree",
|
|
86
|
+
"gc",
|
|
87
|
+
"prune",
|
|
88
|
+
"update-index"
|
|
89
|
+
]), 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 = {
|
|
90
|
+
npm: /* @__PURE__ */ new Set([
|
|
91
|
+
"install",
|
|
92
|
+
"add",
|
|
93
|
+
"remove",
|
|
94
|
+
"uninstall",
|
|
95
|
+
"update",
|
|
96
|
+
"upgrade",
|
|
97
|
+
"publish",
|
|
98
|
+
"link",
|
|
99
|
+
"unlink",
|
|
100
|
+
"ci",
|
|
101
|
+
"init"
|
|
102
|
+
]),
|
|
103
|
+
pnpm: /* @__PURE__ */ new Set(["install", "add", "remove", "uninstall", "update", "upgrade", "publish", "link", "unlink", "init"]),
|
|
104
|
+
yarn: /* @__PURE__ */ new Set(["install", "add", "remove", "uninstall", "upgrade", "publish", "link", "unlink", "init"]),
|
|
105
|
+
bun: /* @__PURE__ */ new Set(["install", "add", "remove", "uninstall", "update", "upgrade", "publish", "link", "unlink", "init"])
|
|
106
|
+
}, ALWAYS_MUTATING_MANAGERS = /* @__PURE__ */ new Set([
|
|
107
|
+
"apt",
|
|
108
|
+
"apt-get",
|
|
109
|
+
"brew",
|
|
110
|
+
"dnf",
|
|
111
|
+
"yum",
|
|
112
|
+
"pacman",
|
|
113
|
+
"choco",
|
|
114
|
+
"winget",
|
|
115
|
+
"scoop"
|
|
116
|
+
]), EXECUTING_NODE_FLAGS = /* @__PURE__ */ new Set([
|
|
117
|
+
"-e",
|
|
118
|
+
"--eval",
|
|
119
|
+
"-p",
|
|
120
|
+
"--print",
|
|
121
|
+
"-r",
|
|
122
|
+
"--require",
|
|
123
|
+
"--import",
|
|
124
|
+
"-i",
|
|
125
|
+
"--interactive"
|
|
126
|
+
]), EXECUTING_PYTHON_FLAGS = /* @__PURE__ */ new Set(["-c", "-m", "-i", "--interactive"]);
|
|
127
|
+
function isCodeRewriteMutating(input) {
|
|
128
|
+
return input?.dry_run === !1;
|
|
129
|
+
}
|
|
130
|
+
function planModeBlockReason(toolName, input) {
|
|
131
|
+
if (toolName.startsWith("computer_"))
|
|
132
|
+
try {
|
|
133
|
+
return computerPolicy(toolName, {})?.observation ? void 0 : PLAN_MODE_BLOCK_MESSAGE;
|
|
134
|
+
} catch {
|
|
135
|
+
return PLAN_MODE_BLOCK_MESSAGE;
|
|
136
|
+
}
|
|
137
|
+
if (BLOCKED_TOOLS.has(toolName) || toolName === "code_rewrite" && isCodeRewriteMutating(input) || toolName.startsWith("settings_") && toolName !== "settings_load" && Object.keys(input ?? {}).length > 0)
|
|
138
|
+
return PLAN_MODE_BLOCK_MESSAGE;
|
|
139
|
+
if (toolName === "bash") {
|
|
140
|
+
let command = readBashCommand(input);
|
|
141
|
+
if (command && isMutatingBashCommand(command))
|
|
142
|
+
return `${PLAN_MODE_BLOCK_MESSAGE} Blocked command: ${command}`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function readBashCommand(input) {
|
|
146
|
+
let command = input?.command;
|
|
147
|
+
return typeof command == "string" ? command : "";
|
|
148
|
+
}
|
|
149
|
+
function isMutatingBashCommand(command) {
|
|
150
|
+
if (!command.trim())
|
|
151
|
+
return !1;
|
|
152
|
+
if (hasUnquotedRedirect(command) || hasShellSubstitution(command))
|
|
153
|
+
return !0;
|
|
154
|
+
for (let segment of splitShellSegments(command))
|
|
155
|
+
if (isMutatingSegment(segment))
|
|
156
|
+
return !0;
|
|
157
|
+
return !1;
|
|
158
|
+
}
|
|
159
|
+
function hasUnquotedRedirect(command) {
|
|
160
|
+
let quote, escaped = !1;
|
|
161
|
+
for (let i = 0; i < command.length; i++) {
|
|
162
|
+
let ch = command[i];
|
|
163
|
+
if (escaped) {
|
|
164
|
+
escaped = !1;
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (ch === "\\" && quote !== "'") {
|
|
168
|
+
escaped = !0;
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (quote) {
|
|
172
|
+
ch === quote && (quote = void 0);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (ch === "'" || ch === '"') {
|
|
176
|
+
quote = ch;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (ch === ">")
|
|
180
|
+
return !0;
|
|
181
|
+
}
|
|
182
|
+
return !1;
|
|
183
|
+
}
|
|
184
|
+
function splitShellSegments(command) {
|
|
185
|
+
let segments = [], quote, escaped = !1, start = 0;
|
|
186
|
+
for (let i = 0; i < command.length; i++) {
|
|
187
|
+
let ch = command[i], next = command[i + 1];
|
|
188
|
+
if (escaped) {
|
|
189
|
+
escaped = !1;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (ch === "\\" && quote !== "'") {
|
|
193
|
+
escaped = !0;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (quote) {
|
|
197
|
+
ch === quote && (quote = void 0);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (ch === "'" || ch === '"') {
|
|
201
|
+
quote = ch;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (ch === "&" && next === "&" || ch === "|" && next === "|") {
|
|
205
|
+
segments.push(command.slice(start, i)), i++, start = i + 1;
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
(ch === ";" || ch === "|" || ch === "&" || ch === `
|
|
209
|
+
`) && (segments.push(command.slice(start, i)), start = i + 1);
|
|
210
|
+
}
|
|
211
|
+
return segments.push(command.slice(start)), segments.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
212
|
+
}
|
|
213
|
+
function hasShellSubstitution(command) {
|
|
214
|
+
let quote, escaped = !1;
|
|
215
|
+
for (let i = 0; i < command.length; i++) {
|
|
216
|
+
let ch = command[i];
|
|
217
|
+
if (escaped) {
|
|
218
|
+
escaped = !1;
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (ch === "\\" && quote !== "'") {
|
|
222
|
+
escaped = !0;
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (quote) {
|
|
226
|
+
ch === quote && (quote = void 0);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (ch === "'" || ch === '"') {
|
|
230
|
+
quote = ch;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
if (ch === "`" || ch === "$" && command[i + 1] === "(" || ch === "<" && command[i + 1] === "(" || ch === ">" && command[i + 1] === "(" || ch === "&" && command[i + 1] === ">")
|
|
234
|
+
return !0;
|
|
235
|
+
}
|
|
236
|
+
return !1;
|
|
237
|
+
}
|
|
238
|
+
function isMutatingSegment(segment) {
|
|
239
|
+
let tokens = segment.split(/\s+/).filter((t) => t.length > 0);
|
|
240
|
+
for (; tokens.length > 0 && /^[A-Za-z_][A-Za-z0-9_]*=/.test(tokens[0]); )
|
|
241
|
+
tokens = tokens.slice(1);
|
|
242
|
+
if (tokens.length === 0)
|
|
243
|
+
return !1;
|
|
244
|
+
let command = basenameOf(tokens[0]).toLowerCase(), args = tokens.slice(1);
|
|
245
|
+
if (ALWAYS_MUTATING_MANAGERS.has(command))
|
|
246
|
+
return !0;
|
|
247
|
+
if (command === "sed")
|
|
248
|
+
return args.some((a) => a === "-i" || a.startsWith("-i") || a.startsWith("--in-place") || /^-[^-]*i/.test(a));
|
|
249
|
+
if (command === "find")
|
|
250
|
+
return args.some((a) => ["-delete", "-exec", "-execdir", "-ok", "-okdir"].includes(a));
|
|
251
|
+
if (command === "git")
|
|
252
|
+
return isMutatingGit(args);
|
|
253
|
+
if (command === "gh") {
|
|
254
|
+
let sub = `${args[0] ?? ""} ${args[1] ?? ""}`;
|
|
255
|
+
return ![
|
|
256
|
+
"pr view",
|
|
257
|
+
"pr list",
|
|
258
|
+
"pr status",
|
|
259
|
+
"issue view",
|
|
260
|
+
"issue list",
|
|
261
|
+
"issue status",
|
|
262
|
+
"repo view",
|
|
263
|
+
"release view",
|
|
264
|
+
"release list",
|
|
265
|
+
"run list",
|
|
266
|
+
"run view",
|
|
267
|
+
"status"
|
|
268
|
+
].includes(sub.trim());
|
|
269
|
+
}
|
|
270
|
+
if (command === "sh" || command === "bash" || command === "zsh" || command === "dash")
|
|
271
|
+
return args.some((a) => a === "-c" || a === "-s") || args.some((a) => !a.startsWith("-"));
|
|
272
|
+
let pkgMutations = PACKAGE_MANAGER_MUTATIONS[command];
|
|
273
|
+
if (pkgMutations) {
|
|
274
|
+
let subcommand = args.find((a) => !a.startsWith("-"))?.toLowerCase();
|
|
275
|
+
return subcommand !== void 0 && pkgMutations.has(subcommand);
|
|
276
|
+
}
|
|
277
|
+
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);
|
|
278
|
+
}
|
|
279
|
+
var GIT_GLOBAL_FLAGS = /* @__PURE__ */ new Set([
|
|
280
|
+
"--no-pager",
|
|
281
|
+
"--paginate",
|
|
282
|
+
"-p",
|
|
283
|
+
"--version",
|
|
284
|
+
"--help",
|
|
285
|
+
"-h",
|
|
286
|
+
"--bare",
|
|
287
|
+
"--no-replace-objects",
|
|
288
|
+
"--no-optional-locks",
|
|
289
|
+
"--literal-pathspecs",
|
|
290
|
+
"--glob-pathspecs",
|
|
291
|
+
"--noglob-pathspecs",
|
|
292
|
+
"--icase-pathspecs"
|
|
293
|
+
]);
|
|
294
|
+
function gitSubcommandIndex(args) {
|
|
295
|
+
let index = 0;
|
|
296
|
+
for (; index < args.length; ) {
|
|
297
|
+
let token = args[index];
|
|
298
|
+
if (!token.startsWith("-"))
|
|
299
|
+
return index;
|
|
300
|
+
if (token === "--")
|
|
301
|
+
return index + 1;
|
|
302
|
+
if (GIT_GLOBAL_FLAGS.has(token)) {
|
|
303
|
+
index++;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (token === "-C" || token === "-c" || token === "--git-dir" || token === "--work-tree" || token === "--namespace") {
|
|
307
|
+
if (args[index + 1] === void 0)
|
|
308
|
+
return -1;
|
|
309
|
+
index += 2;
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
if (token.startsWith("--git-dir=") || token.startsWith("--work-tree=") || token.startsWith("--namespace=") || token.startsWith("--config-env=")) {
|
|
313
|
+
index++;
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
return -1;
|
|
317
|
+
}
|
|
318
|
+
return index;
|
|
319
|
+
}
|
|
320
|
+
function isMutatingGit(args) {
|
|
321
|
+
let index = gitSubcommandIndex(args);
|
|
322
|
+
if (index < 0)
|
|
323
|
+
return !0;
|
|
324
|
+
let subcommand = args[index]?.toLowerCase();
|
|
325
|
+
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;
|
|
326
|
+
}
|
|
327
|
+
function basenameOf(token) {
|
|
328
|
+
let parts = token.split(/[\\/]/);
|
|
329
|
+
return parts[parts.length - 1] ?? token;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// packages/coding-agent/dist/core/permissions.js
|
|
333
|
+
import { dirname, join, resolve } from "node:path";
|
|
334
|
+
|
|
335
|
+
// packages/coding-agent/dist/core/large-subagent-launch.js
|
|
336
|
+
function countEntry(item) {
|
|
337
|
+
let count = item && typeof item == "object" ? item.count : void 0;
|
|
338
|
+
return typeof count == "number" && Number.isInteger(count) && count >= 1 ? count : 1;
|
|
339
|
+
}
|
|
340
|
+
function isManagementCall(args) {
|
|
341
|
+
return typeof args.action == "string" && args.action.length > 0;
|
|
342
|
+
}
|
|
343
|
+
function isAsyncDetached(args) {
|
|
344
|
+
return args.async === !0 && args.clarify !== !0;
|
|
345
|
+
}
|
|
346
|
+
function effectiveLargeSubagentLaunchCount(args) {
|
|
347
|
+
let total = 0;
|
|
348
|
+
if (Array.isArray(args.tasks))
|
|
349
|
+
for (let task of args.tasks)
|
|
350
|
+
total += countEntry(task);
|
|
351
|
+
if (Array.isArray(args.chain))
|
|
352
|
+
for (let step of args.chain) {
|
|
353
|
+
let parallel = step && typeof step == "object" ? step.parallel : void 0;
|
|
354
|
+
if (Array.isArray(parallel))
|
|
355
|
+
for (let child of parallel)
|
|
356
|
+
total += countEntry(child);
|
|
357
|
+
}
|
|
358
|
+
return total;
|
|
359
|
+
}
|
|
360
|
+
function siblingSingleCount(args) {
|
|
361
|
+
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;
|
|
362
|
+
}
|
|
363
|
+
function effectiveLargeSubagentLaunchCountForTurn(args, assistantMessage) {
|
|
364
|
+
let own = effectiveLargeSubagentLaunchCount(args), siblingSingles = (assistantMessage?.content ?? []).reduce((total, block) => {
|
|
365
|
+
if (block.type !== "toolCall" || block.name !== "subagent")
|
|
366
|
+
return total;
|
|
367
|
+
let siblingArgs = block.arguments && typeof block.arguments == "object" && !Array.isArray(block.arguments) ? block.arguments : void 0;
|
|
368
|
+
return siblingArgs ? total + siblingSingleCount(siblingArgs) : total;
|
|
369
|
+
}, 0);
|
|
370
|
+
return Math.max(own, siblingSingles);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// packages/coding-agent/dist/core/permissions.js
|
|
374
|
+
var PERMISSION_MODES = ["manual", "yolo", "plan", "auto"];
|
|
375
|
+
function nextPermissionMode(current) {
|
|
376
|
+
let i = PERMISSION_MODES.indexOf(current);
|
|
377
|
+
return PERMISSION_MODES[(i + 1) % PERMISSION_MODES.length];
|
|
378
|
+
}
|
|
379
|
+
function isPlanModeActive(sessionId) {
|
|
380
|
+
return getPermissionMode(sessionId) === "plan";
|
|
381
|
+
}
|
|
382
|
+
function restorePermissionModeAfterPlan(previous, defaultMode) {
|
|
383
|
+
return previous && previous !== "plan" ? previous : defaultMode === "plan" ? "yolo" : defaultMode;
|
|
384
|
+
}
|
|
385
|
+
var READ_ONLY_TOOLS = /* @__PURE__ */ new Set([
|
|
386
|
+
"read",
|
|
387
|
+
"grep",
|
|
388
|
+
"find",
|
|
389
|
+
"ls",
|
|
390
|
+
"web_search",
|
|
391
|
+
"web_fetch",
|
|
392
|
+
"fetch_content",
|
|
393
|
+
"get_search_content",
|
|
394
|
+
"sourcegraph",
|
|
395
|
+
"repo_map",
|
|
396
|
+
"symbol_outline",
|
|
397
|
+
"read_block",
|
|
398
|
+
"code_overview",
|
|
399
|
+
"ast_search",
|
|
400
|
+
"lsp_diagnostics",
|
|
401
|
+
"lsp_hover",
|
|
402
|
+
"lsp_definition",
|
|
403
|
+
"lsp_references",
|
|
404
|
+
"lsp_symbols",
|
|
405
|
+
"lsp_code_actions",
|
|
406
|
+
"lsp_completions",
|
|
407
|
+
"memory_load",
|
|
408
|
+
"settings_load"
|
|
409
|
+
]), 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();
|
|
410
|
+
function getContext(sessionId) {
|
|
411
|
+
return sessionId ? contexts.get(sessionId) ?? defaultContext : defaultContext;
|
|
412
|
+
}
|
|
413
|
+
function createPermissionContext(sessionId, mode = defaultContext.mode, allowApprovals = !0) {
|
|
414
|
+
contexts.set(sessionId, { mode, allowApprovals, approvals: /* @__PURE__ */ new Set() });
|
|
415
|
+
}
|
|
416
|
+
function deletePermissionContext(sessionId) {
|
|
417
|
+
contexts.delete(sessionId);
|
|
418
|
+
}
|
|
419
|
+
function getPermissionMode(sessionId) {
|
|
420
|
+
return getContext(sessionId).mode;
|
|
421
|
+
}
|
|
422
|
+
function setPermissionMode(mode, sessionId) {
|
|
423
|
+
getContext(sessionId).mode = mode;
|
|
424
|
+
}
|
|
425
|
+
function resetPermissions(defaultMode = "manual", sessionId) {
|
|
426
|
+
sessionId ? contexts.set(sessionId, { mode: defaultMode, approvals: /* @__PURE__ */ new Set() }) : defaultContext = { mode: defaultMode, approvals: /* @__PURE__ */ new Set() };
|
|
427
|
+
}
|
|
428
|
+
function registerApprovalHandler(fn) {
|
|
429
|
+
approvalHandler = fn;
|
|
430
|
+
}
|
|
431
|
+
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.";
|
|
432
|
+
function planApprovalResultText(resp) {
|
|
433
|
+
let decision = typeof resp == "string" ? resp : resp.decision, feedback = typeof resp == "string" ? void 0 : resp.feedback?.trim();
|
|
434
|
+
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;
|
|
435
|
+
}
|
|
436
|
+
async function requestPlanApproval(summary) {
|
|
437
|
+
if (!approvalHandler)
|
|
438
|
+
return PLAN_PASS_THROUGH_TEXT;
|
|
439
|
+
let resp;
|
|
440
|
+
try {
|
|
441
|
+
resp = await approvalHandler({ toolName: "present_plan", action: "plan", detail: summary, kind: "plan" });
|
|
442
|
+
} catch (err) {
|
|
443
|
+
let message = err instanceof Error ? err.message : "approval request failed";
|
|
444
|
+
return message === NO_HANDLER_REASON ? PLAN_PASS_THROUGH_TEXT : `Plan declined: ${message} \u2014 revise the plan and call present_plan again.`;
|
|
445
|
+
}
|
|
446
|
+
return planApprovalResultText(resp);
|
|
447
|
+
}
|
|
448
|
+
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.";
|
|
449
|
+
function isPathOutsideCwd(absPath, cwd) {
|
|
450
|
+
let norm = (p) => p.replace(/\\/g, "/").replace(/\/$/, ""), np = norm(absPath), nc = norm(cwd);
|
|
451
|
+
return np === nc ? !1 : !np.startsWith(`${nc}/`);
|
|
452
|
+
}
|
|
453
|
+
function resolvePath(cwd, p) {
|
|
454
|
+
return typeof p != "string" || !p ? "" : resolve(cwd, p);
|
|
455
|
+
}
|
|
456
|
+
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.";
|
|
457
|
+
function protectedFileWriteReason(toolName, input, cwd) {
|
|
458
|
+
if (toolName !== "edit" && toolName !== "write" && toolName !== "code_rewrite")
|
|
459
|
+
return;
|
|
460
|
+
let target = resolvePath(cwd, input.path);
|
|
461
|
+
if (!target)
|
|
462
|
+
return;
|
|
463
|
+
let normalize = (path) => {
|
|
464
|
+
let normalized = resolve(path).replace(/\\/g, "/").replace(/\/$/, "");
|
|
465
|
+
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
466
|
+
};
|
|
467
|
+
if (isUserInstructionsPath(target, getAgentDir()))
|
|
468
|
+
return GLOBAL_AGENTS_FILE_WRITE_BLOCK_REASON;
|
|
469
|
+
if (normalize(target) === normalize(join(dirname(getAgentDir()), "simple-memory", "memory.md")))
|
|
470
|
+
return MEMORY_FILE_DIRECT_WRITE_BLOCK_REASON;
|
|
471
|
+
}
|
|
472
|
+
function isMutatingTool(toolName) {
|
|
473
|
+
return MUTATING_TOOLS.has(toolName);
|
|
474
|
+
}
|
|
475
|
+
function collectRequestedChildLaunches(value, launches) {
|
|
476
|
+
if (!value || typeof value != "object" || Array.isArray(value))
|
|
477
|
+
return;
|
|
478
|
+
let input = value;
|
|
479
|
+
if (typeof input.task == "string" && input.task.trim()) {
|
|
480
|
+
launches.push({
|
|
481
|
+
description: typeof input.description == "string" && input.description.trim() ? input.description.trim() : input.task.trim(),
|
|
482
|
+
permissions: input.permissions === "read-only" ? "read-only" : "full"
|
|
483
|
+
});
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
for (let key of ["tasks", "chain", "parallel"]) {
|
|
487
|
+
let children = input[key];
|
|
488
|
+
if (Array.isArray(children))
|
|
489
|
+
for (let child of children)
|
|
490
|
+
collectRequestedChildLaunches(child, launches);
|
|
491
|
+
else key === "parallel" && collectRequestedChildLaunches(children, launches);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
function getRequestedChildLaunches(input) {
|
|
495
|
+
let launches = [];
|
|
496
|
+
return collectRequestedChildLaunches(input, launches), launches;
|
|
497
|
+
}
|
|
498
|
+
function requiresManualApproval(toolName, input) {
|
|
499
|
+
return toolName.startsWith("computer_") ? toolName !== "computer_end" : 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);
|
|
500
|
+
}
|
|
501
|
+
function firstTaskText(value) {
|
|
502
|
+
return typeof value == "string" && value.trim() ? sanitizeDetail(value) : "";
|
|
503
|
+
}
|
|
504
|
+
function largeLaunchTaskSummary(input, assistantMessage) {
|
|
505
|
+
if (Array.isArray(input.tasks))
|
|
506
|
+
for (let task of input.tasks) {
|
|
507
|
+
let text = task && typeof task == "object" ? firstTaskText(task.task) : "";
|
|
508
|
+
if (text)
|
|
509
|
+
return text;
|
|
510
|
+
}
|
|
511
|
+
let own = firstTaskText(input.task);
|
|
512
|
+
if (own)
|
|
513
|
+
return own;
|
|
514
|
+
for (let block of assistantMessage?.content ?? []) {
|
|
515
|
+
if (block.type !== "toolCall" || block.name !== "subagent")
|
|
516
|
+
continue;
|
|
517
|
+
let args = block.arguments && typeof block.arguments == "object" && !Array.isArray(block.arguments) ? block.arguments : void 0, text = firstTaskText(args?.task);
|
|
518
|
+
if (text)
|
|
519
|
+
return text;
|
|
520
|
+
}
|
|
521
|
+
return "";
|
|
522
|
+
}
|
|
523
|
+
async function gateLargeSubagentLaunch(input, ctx, options) {
|
|
524
|
+
if (ctx.mode === "auto" || options?.confirmLargeSubagentLaunches === !1)
|
|
525
|
+
return;
|
|
526
|
+
let count = effectiveLargeSubagentLaunchCountForTurn(input, options?.assistantMessage);
|
|
527
|
+
if (count <= 2)
|
|
528
|
+
return;
|
|
529
|
+
if (ctx.approvals.has(LARGE_SUBAGENT_LAUNCH_ACTION))
|
|
530
|
+
return { fullChildrenApproved: !1 };
|
|
531
|
+
let turnKey = options?.assistantMessage, cached = turnKey ? turnLargeLaunchDecisions.get(turnKey) : void 0;
|
|
532
|
+
if (cached)
|
|
533
|
+
return cached.decision === "reject" ? {
|
|
534
|
+
block: !0,
|
|
535
|
+
reason: cached.feedback ? `${LARGE_SUBAGENT_LAUNCH_REJECT_REASON} ${cached.feedback}` : LARGE_SUBAGENT_LAUNCH_REJECT_REASON
|
|
536
|
+
} : { fullChildrenApproved: cached.fullChildrenApproved };
|
|
537
|
+
if (!approvalHandler || ctx.allowApprovals === !1)
|
|
538
|
+
return { block: !0, reason: NO_LARGE_SUBAGENT_LAUNCH_HANDLER_REASON };
|
|
539
|
+
let summary = largeLaunchTaskSummary(input, options?.assistantMessage), siblingLaunches = (options?.assistantMessage?.content ?? []).flatMap((block) => {
|
|
540
|
+
if (block.type !== "toolCall" || block.name !== "subagent")
|
|
541
|
+
return [];
|
|
542
|
+
let args = block.arguments && typeof block.arguments == "object" && !Array.isArray(block.arguments) ? block.arguments : void 0;
|
|
543
|
+
return args ? getRequestedChildLaunches(args) : [];
|
|
544
|
+
}), launches = siblingLaunches.length > 0 ? siblingLaunches : getRequestedChildLaunches(input), fullChildrenApproved = launches.some((launch) => launch.permissions === "full"), launchSummary = launches.map((launch) => `${launch.description}
|
|
545
|
+
permissions: ${launch.permissions}`).join(`
|
|
546
|
+
`), resp;
|
|
547
|
+
try {
|
|
548
|
+
resp = await approvalHandler({
|
|
549
|
+
toolName: "subagent",
|
|
550
|
+
action: LARGE_SUBAGENT_LAUNCH_ACTION,
|
|
551
|
+
detail: `large subagent launch (${count} children)${launchSummary || summary ? `
|
|
552
|
+
${launchSummary || summary}` : ""}`,
|
|
553
|
+
kind: "large-subagent-launch"
|
|
554
|
+
});
|
|
555
|
+
} catch (err) {
|
|
556
|
+
return { block: !0, reason: err instanceof Error ? err.message : NO_LARGE_SUBAGENT_LAUNCH_HANDLER_REASON };
|
|
557
|
+
}
|
|
558
|
+
let rawDecision = typeof resp == "string" ? resp : resp.decision, decision = rawDecision === "approve" ? "once" : rawDecision, feedback = typeof resp == "string" ? void 0 : resp.feedback?.trim();
|
|
559
|
+
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" ? {
|
|
560
|
+
block: !0,
|
|
561
|
+
reason: feedback ? `${LARGE_SUBAGENT_LAUNCH_REJECT_REASON} ${feedback}` : LARGE_SUBAGENT_LAUNCH_REJECT_REASON
|
|
562
|
+
} : { fullChildrenApproved };
|
|
563
|
+
}
|
|
564
|
+
function sanitizeDetail(value) {
|
|
565
|
+
let text = String(value ?? "").trim();
|
|
566
|
+
return text.length > 200 ? `${text.slice(0, 200)}\u2026` : text;
|
|
567
|
+
}
|
|
568
|
+
async function gateToolCall(toolName, input, cwd, sessionId, options) {
|
|
569
|
+
let ctx = getContext(sessionId);
|
|
570
|
+
if (toolName.startsWith("computer_"))
|
|
571
|
+
try {
|
|
572
|
+
computerPolicy(toolName, input);
|
|
573
|
+
} catch (error) {
|
|
574
|
+
return { block: !0, reason: String(error) };
|
|
575
|
+
}
|
|
576
|
+
let protectedWriteReason = protectedFileWriteReason(toolName, input, cwd);
|
|
577
|
+
if (protectedWriteReason)
|
|
578
|
+
return { block: !0, reason: protectedWriteReason };
|
|
579
|
+
if (READ_ONLY_TOOLS.has(toolName))
|
|
580
|
+
return;
|
|
581
|
+
let largeLaunchCoveredManualApproval = !1;
|
|
582
|
+
if (toolName === "subagent") {
|
|
583
|
+
let launchResult = await gateLargeSubagentLaunch(input, ctx, options);
|
|
584
|
+
if (launchResult && "block" in launchResult)
|
|
585
|
+
return launchResult;
|
|
586
|
+
largeLaunchCoveredManualApproval = ctx.mode === "manual" && launchResult?.fullChildrenApproved === !0;
|
|
587
|
+
}
|
|
588
|
+
if (ctx.mode === "plan") {
|
|
589
|
+
let reason = planModeBlockReason(toolName, input);
|
|
590
|
+
return reason ? { block: !0, reason } : void 0;
|
|
591
|
+
}
|
|
592
|
+
if (ctx.mode !== "manual" || !requiresManualApproval(toolName, input) || largeLaunchCoveredManualApproval)
|
|
593
|
+
return;
|
|
594
|
+
let action, detail;
|
|
595
|
+
if (toolName.startsWith("computer_"))
|
|
596
|
+
action = toolName, detail = sanitizeDetail(JSON.stringify(input));
|
|
597
|
+
else if (toolName === "bash")
|
|
598
|
+
action = "bash", detail = sanitizeDetail(input.command);
|
|
599
|
+
else if (toolName === "edit" || toolName === "write") {
|
|
600
|
+
let path = resolvePath(cwd, input.path);
|
|
601
|
+
action = (path ? isPathOutsideCwd(path, cwd) : !1) ? `${toolName}-outside` : toolName, detail = path || String(input.path ?? "");
|
|
602
|
+
} else if (toolName === "memory_add")
|
|
603
|
+
action = toolName, detail = sanitizeDetail(input.content);
|
|
604
|
+
else if (toolName === "memory_remove")
|
|
605
|
+
action = toolName, detail = sanitizeDetail(input.line);
|
|
606
|
+
else if (toolName === "cron")
|
|
607
|
+
action = "cron", detail = sanitizeDetail(input.action);
|
|
608
|
+
else if (toolName === "subagent") {
|
|
609
|
+
action = FULL_CHILD_ACTION;
|
|
610
|
+
let launches = getRequestedChildLaunches(input).filter((launch) => launch.permissions === "full");
|
|
611
|
+
detail = sanitizeDetail(launches.map((launch) => `${launch.description}
|
|
612
|
+
permissions: ${launch.permissions}`).join(`
|
|
613
|
+
`));
|
|
614
|
+
} else toolName === "code_rewrite" ? (action = "code_rewrite", detail = sanitizeDetail(input.path ?? input.pattern)) : (action = toolName, detail = "");
|
|
615
|
+
if (!toolName.startsWith("computer_") && ctx.approvals.has(action))
|
|
616
|
+
return;
|
|
617
|
+
if (!approvalHandler || ctx.allowApprovals === !1)
|
|
618
|
+
return { block: !0, reason: NO_HANDLER_REASON };
|
|
619
|
+
let resp;
|
|
620
|
+
try {
|
|
621
|
+
resp = await approvalHandler({ toolName, action, detail });
|
|
622
|
+
} catch (err) {
|
|
623
|
+
return { block: !0, reason: err instanceof Error ? err.message : NO_HANDLER_REASON };
|
|
624
|
+
}
|
|
625
|
+
let decision = typeof resp == "string" ? resp : resp.decision;
|
|
626
|
+
if (decision === "session") {
|
|
627
|
+
toolName.startsWith("computer_") || ctx.approvals.add(action);
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
if (decision === "reject") {
|
|
631
|
+
let feedback = typeof resp == "string" ? void 0 : resp.feedback?.trim();
|
|
632
|
+
return { block: !0, reason: feedback ? `${REJECT_REASON} ${feedback}` : REJECT_REASON };
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
export {
|
|
637
|
+
PLAN_MODE_ADDENDUM,
|
|
638
|
+
nextPermissionMode,
|
|
639
|
+
isPlanModeActive,
|
|
640
|
+
restorePermissionModeAfterPlan,
|
|
641
|
+
NO_HANDLER_REASON,
|
|
642
|
+
createPermissionContext,
|
|
643
|
+
deletePermissionContext,
|
|
644
|
+
getPermissionMode,
|
|
645
|
+
setPermissionMode,
|
|
646
|
+
resetPermissions,
|
|
647
|
+
registerApprovalHandler,
|
|
648
|
+
requestPlanApproval,
|
|
649
|
+
AUTO_MODE_ADDENDUM,
|
|
650
|
+
gateToolCall
|
|
651
|
+
};
|