@ashx-j/lunr 0.2.25 → 0.2.27
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 +31 -1
- package/LICENSE +22 -0
- package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -1
- package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-thinking.js +1 -1
- package/dist/builtin-extensions/ashxj-thinking.js.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.d.ts +11 -1
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.js +6 -10
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +1 -0
- 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 +179 -0
- package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
- package/dist/builtin-extensions/lunr-cron.d.ts +4 -5
- package/dist/builtin-extensions/lunr-cron.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-cron.js +94 -108
- package/dist/builtin-extensions/lunr-cron.js.map +1 -1
- package/dist/builtin-extensions/lunr-local-providers/local-servers.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-local-providers/local-servers.js +3 -1
- package/dist/builtin-extensions/lunr-local-providers/local-servers.js.map +1 -1
- package/dist/builtin-extensions/narumiruna-pi-goal/src/commands.d.ts.map +1 -1
- package/dist/builtin-extensions/narumiruna-pi-goal/src/commands.js +2 -2
- package/dist/builtin-extensions/narumiruna-pi-goal/src/commands.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 +1 -1
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js.map +1 -1
- package/dist/builtin-extensions/narumiruna-pi-goal/src/runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/narumiruna-pi-goal/src/runtime.js +1 -1
- package/dist/builtin-extensions/narumiruna-pi-goal/src/runtime.js.map +1 -1
- package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-intercom/index.js +2 -2
- package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.d.ts +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.js +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/bemol-extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js +1 -15
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.d.ts +6 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.js +187 -132
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-client.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.d.ts +8 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.js +142 -112
- package/dist/builtin-extensions/pi-lsp-extension/src/lsp-manager.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.d.ts +12 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.js +14 -7
- package/dist/builtin-extensions/pi-lsp-extension/src/tools/code-rewrite.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.d.ts +11 -3
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.js +67 -41
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/rewrite-engine.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.d.ts +4 -2
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.js +3 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/tree-sitter/search-engine.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/commands.d.ts +2 -1
- package/dist/builtin-extensions/pi-mcp-adapter/commands.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/commands.js +6 -6
- package/dist/builtin-extensions/pi-mcp-adapter/commands.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/config.d.ts +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/config.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/config.js +11 -5
- package/dist/builtin-extensions/pi-mcp-adapter/config.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js +2 -2
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/host-html-template.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/host-html-template.js +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/host-html-template.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 +48 -40
- package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.js +3 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.d.ts +12 -40
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.js +166 -235
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-auth-flow.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.d.ts +5 -0
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.js +43 -13
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-callback-server.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.d.ts +14 -3
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.js +73 -21
- package/dist/builtin-extensions/pi-mcp-adapter/mcp-oauth-provider.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/proxy-modes.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/proxy-modes.js +4 -4
- package/dist/builtin-extensions/pi-mcp-adapter/proxy-modes.js.map +1 -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 +2 -2
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/state.d.ts +2 -0
- package/dist/builtin-extensions/pi-mcp-adapter/state.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/state.js.map +1 -1
- package/dist/builtin-extensions/pi-ollama-cloud/index.d.ts +1 -1
- package/dist/builtin-extensions/pi-ollama-cloud/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-ollama-cloud/index.js +1 -1
- package/dist/builtin-extensions/pi-ollama-cloud/index.js.map +1 -1
- package/dist/builtin-extensions/pi-ollama-cloud/models.d.ts +11 -5
- package/dist/builtin-extensions/pi-ollama-cloud/models.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-ollama-cloud/models.js +12 -32
- package/dist/builtin-extensions/pi-ollama-cloud/models.js.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/index.js +5 -3
- package/dist/builtin-extensions/pi-prompt-template-model/index.js.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts +2 -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 +21 -12
- 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.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js +7 -24
- 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.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +39 -77
- 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 +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -4
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +8 -5
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js +15 -31
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js +7 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +21 -4
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +11 -4
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +121 -25
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
- 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 +25 -5
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.js +5 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.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/runs/shared/model-fallback.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +7 -8
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js +60 -32
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/utils.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/utils.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/utils.js +15 -5
- package/dist/builtin-extensions/pi-subagents/src/shared/utils.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +4 -3
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/communication.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 +22 -11
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +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 +3 -3
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js.map +1 -1
- package/dist/builtin-extensions/pi-tps.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-tps.js +20 -17
- package/dist/builtin-extensions/pi-tps.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/activity.d.ts +1 -0
- package/dist/builtin-extensions/pi-web-access/activity.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/activity.js +27 -5
- package/dist/builtin-extensions/pi-web-access/activity.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/bounded-body.d.ts +3 -0
- package/dist/builtin-extensions/pi-web-access/bounded-body.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/bounded-body.js +43 -0
- package/dist/builtin-extensions/pi-web-access/bounded-body.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/content-page.d.ts +24 -0
- package/dist/builtin-extensions/pi-web-access/content-page.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/content-page.js +57 -0
- package/dist/builtin-extensions/pi-web-access/content-page.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/extract.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/extract.js +7 -2
- package/dist/builtin-extensions/pi-web-access/extract.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/github-extract.d.ts +0 -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 +147 -36
- 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 +48 -73
- package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts +12 -4
- package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/session-cleanup.js +35 -12
- package/dist/builtin-extensions/pi-web-access/session-cleanup.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/storage.d.ts +9 -6
- package/dist/builtin-extensions/pi-web-access/storage.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/storage.js +36 -24
- package/dist/builtin-extensions/pi-web-access/storage.js.map +1 -1
- package/dist/builtin-extensions/simple-pi-memory.d.ts +1 -1
- package/dist/builtin-extensions/simple-pi-memory.d.ts.map +1 -1
- package/dist/builtin-extensions/simple-pi-memory.js +1 -1
- package/dist/builtin-extensions/simple-pi-memory.js.map +1 -1
- package/dist/cli/install-cli.d.ts.map +1 -1
- package/dist/cli/install-cli.js +38 -30
- package/dist/cli/install-cli.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +13 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +75 -11
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +40 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +309 -76
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/browser/runtime.d.ts +2 -0
- package/dist/core/browser/runtime.d.ts.map +1 -1
- package/dist/core/browser/runtime.js +80 -45
- package/dist/core/browser/runtime.js.map +1 -1
- package/dist/core/browser/setup.d.ts.map +1 -1
- package/dist/core/browser/setup.js +12 -1
- package/dist/core/browser/setup.js.map +1 -1
- package/dist/core/computer-use/adapter.d.ts +28 -0
- package/dist/core/computer-use/adapter.d.ts.map +1 -0
- package/dist/core/computer-use/adapter.js +138 -0
- package/dist/core/computer-use/adapter.js.map +1 -0
- package/dist/core/computer-use/image.d.ts +27 -0
- package/dist/core/computer-use/image.d.ts.map +1 -0
- package/dist/core/computer-use/image.js +84 -0
- package/dist/core/computer-use/image.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 +67 -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 +100 -0
- package/dist/core/computer-use/schemas.d.ts.map +1 -0
- package/dist/core/computer-use/schemas.js +96 -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 +38 -0
- package/dist/core/computer-use/workflow.d.ts.map +1 -0
- package/dist/core/computer-use/workflow.js +900 -0
- package/dist/core/computer-use/workflow.js.map +1 -0
- package/dist/core/cron/jobs.d.ts +26 -8
- package/dist/core/cron/jobs.d.ts.map +1 -1
- package/dist/core/cron/jobs.js +357 -232
- package/dist/core/cron/jobs.js.map +1 -1
- package/dist/core/cron/origin-context.d.ts +1 -0
- package/dist/core/cron/origin-context.d.ts.map +1 -1
- package/dist/core/cron/origin-context.js.map +1 -1
- package/dist/core/cron/scheduler.d.ts +22 -17
- package/dist/core/cron/scheduler.d.ts.map +1 -1
- package/dist/core/cron/scheduler.js +153 -73
- package/dist/core/cron/scheduler.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +4 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +8 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +8 -0
- 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 +4 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +22 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/large-subagent-launch.d.ts +1 -1
- package/dist/core/large-subagent-launch.d.ts.map +1 -1
- package/dist/core/large-subagent-launch.js +7 -7
- package/dist/core/large-subagent-launch.js.map +1 -1
- package/dist/core/model-registry.d.ts +2 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +5 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-runtime.d.ts +4 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +40 -4
- 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.map +1 -1
- package/dist/core/permissions.d.ts +4 -4
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +25 -38
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts +5 -13
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +135 -116
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-resource-bridge.d.ts +12 -0
- package/dist/core/prompt-resource-bridge.d.ts.map +1 -0
- package/dist/core/prompt-resource-bridge.js +9 -0
- package/dist/core/prompt-resource-bridge.js.map +1 -0
- package/dist/core/protected-targets.d.ts +6 -0
- package/dist/core/protected-targets.d.ts.map +1 -0
- package/dist/core/protected-targets.js +45 -0
- package/dist/core/protected-targets.js.map +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +7 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/rollback.d.ts +19 -3
- package/dist/core/rollback.d.ts.map +1 -1
- package/dist/core/rollback.js +172 -56
- package/dist/core/rollback.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +3 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +14 -1
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk.d.ts +3 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +6 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +95 -32
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-ownership.d.ts.map +1 -1
- package/dist/core/session-ownership.js +8 -3
- package/dist/core/session-ownership.js.map +1 -1
- package/dist/core/session-retention.d.ts.map +1 -1
- package/dist/core/session-retention.js +18 -7
- package/dist/core/session-retention.js.map +1 -1
- package/dist/core/session-startup-settings.d.ts +10 -0
- package/dist/core/session-startup-settings.d.ts.map +1 -0
- package/dist/core/session-startup-settings.js +70 -0
- package/dist/core/session-startup-settings.js.map +1 -0
- 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/subagent-event-transport.d.ts +3 -0
- package/dist/core/subagent-event-transport.d.ts.map +1 -0
- package/dist/core/subagent-event-transport.js +61 -0
- package/dist/core/subagent-event-transport.js.map +1 -0
- package/dist/core/subscriptions.d.ts +16 -7
- package/dist/core/subscriptions.d.ts.map +1 -1
- package/dist/core/subscriptions.js +96 -55
- package/dist/core/subscriptions.js.map +1 -1
- package/dist/core/trust-manager.d.ts +2 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +6 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/update-check.d.ts.map +1 -1
- package/dist/core/update-check.js.map +1 -1
- package/dist/core/usage-adapters/kimi-coding.d.ts +2 -2
- package/dist/core/usage-adapters/kimi-coding.d.ts.map +1 -1
- package/dist/core/usage-adapters/kimi-coding.js +2 -2
- package/dist/core/usage-adapters/kimi-coding.js.map +1 -1
- package/dist/core/usage-adapters/openai-codex.d.ts +3 -2
- package/dist/core/usage-adapters/openai-codex.d.ts.map +1 -1
- package/dist/core/usage-adapters/openai-codex.js +3 -3
- package/dist/core/usage-adapters/openai-codex.js.map +1 -1
- package/dist/core/usage-adapters/xai.d.ts +2 -2
- package/dist/core/usage-adapters/xai.d.ts.map +1 -1
- package/dist/core/usage-adapters/xai.js +3 -3
- package/dist/core/usage-adapters/xai.js.map +1 -1
- package/dist/core/usage-adapters/zai.d.ts +2 -2
- package/dist/core/usage-adapters/zai.d.ts.map +1 -1
- package/dist/core/usage-adapters/zai.js +2 -2
- package/dist/core/usage-adapters/zai.js.map +1 -1
- package/dist/core/usage-service.d.ts +9 -2
- package/dist/core/usage-service.d.ts.map +1 -1
- package/dist/core/usage-service.js +95 -50
- package/dist/core/usage-service.js.map +1 -1
- package/dist/gateway/adapters/discord.d.ts.map +1 -1
- package/dist/gateway/adapters/discord.js +2 -2
- package/dist/gateway/adapters/discord.js.map +1 -1
- package/dist/gateway/agent-bridge.d.ts +9 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +91 -37
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/approval.d.ts.map +1 -1
- package/dist/gateway/approval.js +3 -3
- package/dist/gateway/approval.js.map +1 -1
- package/dist/gateway/authz.d.ts +4 -4
- package/dist/gateway/authz.d.ts.map +1 -1
- package/dist/gateway/authz.js +8 -12
- package/dist/gateway/authz.js.map +1 -1
- package/dist/gateway/buttons.d.ts +8 -1
- package/dist/gateway/buttons.d.ts.map +1 -1
- package/dist/gateway/buttons.js +76 -18
- package/dist/gateway/buttons.js.map +1 -1
- package/dist/gateway/commands.d.ts +1 -0
- package/dist/gateway/commands.d.ts.map +1 -1
- package/dist/gateway/commands.js +12 -10
- package/dist/gateway/commands.js.map +1 -1
- package/dist/gateway/cron.d.ts +12 -11
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +85 -62
- package/dist/gateway/cron.js.map +1 -1
- package/dist/gateway/index.d.ts.map +1 -1
- package/dist/gateway/index.js +5 -4
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/mobile-commands.d.ts +1 -0
- package/dist/gateway/mobile-commands.d.ts.map +1 -1
- package/dist/gateway/mobile-commands.js +64 -22
- package/dist/gateway/mobile-commands.js.map +1 -1
- package/dist/gateway/presenter.d.ts +12 -2
- package/dist/gateway/presenter.d.ts.map +1 -1
- package/dist/gateway/presenter.js +74 -39
- package/dist/gateway/presenter.js.map +1 -1
- package/dist/gateway/router.d.ts +2 -2
- package/dist/gateway/router.d.ts.map +1 -1
- package/dist/gateway/router.js +22 -9
- package/dist/gateway/router.js.map +1 -1
- package/dist/gateway/service.d.ts +2 -0
- package/dist/gateway/service.d.ts.map +1 -1
- package/dist/gateway/service.js +153 -0
- package/dist/gateway/service.js.map +1 -1
- package/dist/gateway/setup.d.ts.map +1 -1
- package/dist/gateway/setup.js +6 -4
- package/dist/gateway/setup.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +86 -33
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +6 -4
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -1
- package/dist/modes/interactive/components/copyable-text.js +3 -2
- package/dist/modes/interactive/components/copyable-text.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +1 -1
- package/dist/modes/interactive/components/extension-editor.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 +2 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +104 -109
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/smooth-streaming.d.ts.map +1 -1
- package/dist/modes/interactive/smooth-streaming.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +9 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +2 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/node-runtime/adapter-247RTYLS.js +16 -0
- package/dist/node-runtime/agent-session-services-KDMSPQDY.js +53 -0
- package/dist/node-runtime/{brave-UWDA3I22.js → brave-2AFFAXNN.js} +1 -1
- package/dist/node-runtime/{builtin-extensions-ZLAX7TUH.js → builtin-extensions-OX6KELNX.js} +9 -7
- package/dist/node-runtime/{chunk-QH6YL7VK.js → chunk-252ZVPPF.js} +3 -3
- package/dist/node-runtime/{chunk-PCEW76PM.js → chunk-2OIPYKLZ.js} +6 -6
- package/dist/node-runtime/{chunk-XBWPBZBN.js → chunk-2SWW7KMW.js} +1 -1
- package/dist/node-runtime/{chunk-UQUCFAJ3.js → chunk-2VIW3IMF.js} +40 -7
- package/dist/node-runtime/{chunk-UOEDI7RP.js → chunk-4KNKQGHM.js} +2 -2
- package/dist/node-runtime/{chunk-FQMM2EZ2.js → chunk-64XTQNLA.js} +29 -7
- package/dist/node-runtime/{chunk-NRKGMJYU.js → chunk-6O3IW3IA.js} +2 -2
- package/dist/node-runtime/{chunk-5ZQXRPMC.js → chunk-6ZZHGUSA.js} +2 -2
- package/dist/node-runtime/chunk-A2WO6WIN.js +1197 -0
- package/dist/node-runtime/{chunk-ZXSGTGJ6.js → chunk-APVM5NEU.js} +169 -148
- package/dist/node-runtime/{chunk-RC7DMV45.js → chunk-AYHH7YSD.js} +205 -144
- package/dist/node-runtime/{chunk-LWYIVUGV.js → chunk-B2IBAXNX.js} +48 -31
- package/dist/node-runtime/{chunk-M3LZLQW2.js → chunk-BDRGN3L2.js} +1 -0
- package/dist/node-runtime/{chunk-GJ2RDBRL.js → chunk-BYC6RKCN.js} +4 -2
- package/dist/node-runtime/{chunk-KWIYUUZK.js → chunk-C3P6Q3B2.js} +469 -283
- package/dist/node-runtime/{chunk-YCUZEGJG.js → chunk-DQSCFU7R.js} +17 -8
- package/dist/node-runtime/chunk-EBLAZVSA.js +4170 -0
- package/dist/node-runtime/{chunk-2KIPT4HJ.js → chunk-EPR2F3GU.js} +68 -20
- package/dist/node-runtime/{chunk-CSFI6YXL.js → chunk-ES6PBSIE.js} +1 -1
- package/dist/node-runtime/{chunk-IF24A3FH.js → chunk-EVM653DD.js} +4 -4
- package/dist/node-runtime/{chunk-HTFRRDSF.js → chunk-F2SMQ6ES.js} +3 -2
- package/dist/node-runtime/chunk-F2V2F4ZG.js +114 -0
- package/dist/node-runtime/chunk-FE3WZI7F.js +290 -0
- package/dist/node-runtime/{chunk-GYIXXQAO.js → chunk-FIRA54AC.js} +2 -5
- package/dist/node-runtime/{chunk-6VYZ5UFP.js → chunk-FLGEEH27.js} +1 -1
- package/dist/node-runtime/{chunk-5EFIU3OM.js → chunk-FTKEZL27.js} +1 -1
- package/dist/node-runtime/chunk-FY4A63RK.js +73 -0
- package/dist/node-runtime/chunk-FYIFPFXE.js +98 -0
- package/dist/node-runtime/{chunk-HMBGROQK.js → chunk-GLDXBBL6.js} +3 -3
- package/dist/node-runtime/{chunk-KWA4OC2J.js → chunk-H6YBCWKG.js} +1 -1
- package/dist/node-runtime/{chunk-2MI5OPMN.js → chunk-HNNHHJAB.js} +68 -50
- package/dist/node-runtime/{chunk-6XL67VVY.js → chunk-HUD2RFJW.js} +17 -2
- package/dist/node-runtime/{chunk-I54LGHWM.js → chunk-I2H5QMWW.js} +3 -3
- package/dist/node-runtime/chunk-IAZSK7KK.js +108 -0
- package/dist/node-runtime/{chunk-2HHLJWGD.js → chunk-IHHTWSXN.js} +9 -9
- package/dist/node-runtime/{chunk-DAPBPCBP.js → chunk-IPP5BIV5.js} +25 -3
- package/dist/node-runtime/{chunk-QFWG2RVL.js → chunk-IXG6F4NT.js} +11 -0
- package/dist/node-runtime/{chunk-RDDAZOMU.js → chunk-JL4HYQXK.js} +1 -1
- package/dist/node-runtime/{chunk-CDVHZOOK.js → chunk-JQYNHAKX.js} +1 -1
- package/dist/node-runtime/{chunk-WF7PGWRZ.js → chunk-JWEVT363.js} +37 -28
- package/dist/node-runtime/{chunk-2HMIRK7W.js → chunk-LHV3V67B.js} +5 -5
- package/dist/node-runtime/{chunk-UAEOTO52.js → chunk-MNQXDFPV.js} +6 -2
- package/dist/node-runtime/{chunk-IJIFHRTB.js → chunk-MQPKUHRN.js} +165 -85
- package/dist/node-runtime/{chunk-MPKSOJBT.js → chunk-NHATCSOI.js} +4 -7
- package/dist/node-runtime/{chunk-RMQZU2YU.js → chunk-NNNR3QIY.js} +1 -1
- package/dist/node-runtime/{chunk-RWTKOC3B.js → chunk-QBTJG3UM.js} +1 -1
- package/dist/node-runtime/{chunk-E4D3IGP2.js → chunk-QNVMKNNN.js} +20 -17
- package/dist/node-runtime/{chunk-GS42T6MX.js → chunk-QW3AAHWN.js} +1 -1
- package/dist/node-runtime/{chunk-7S3T6YEA.js → chunk-R4WSB2MQ.js} +5 -5
- package/dist/node-runtime/{chunk-B4HP6ZWM.js → chunk-RHCGYWO7.js} +1 -1
- package/dist/node-runtime/{chunk-3XPLBUEM.js → chunk-RLGY2QIL.js} +49 -59
- package/dist/node-runtime/{chunk-KKUTQQV7.js → chunk-RYRGL7P4.js} +1 -1
- package/dist/node-runtime/{chunk-AD6VXAO7.js → chunk-TCT6PCUR.js} +47 -115
- package/dist/node-runtime/chunk-U5F4IC7R.js +53 -0
- package/dist/node-runtime/{chunk-OCVIXVTZ.js → chunk-UBWW2PID.js} +13 -2
- package/dist/node-runtime/{chunk-HFVZUPFJ.js → chunk-UNUZICC4.js} +3 -3
- package/dist/node-runtime/{chunk-LQP3RB67.js → chunk-UYRKUKFE.js} +1 -1
- package/dist/node-runtime/{chunk-DSIKTUPW.js → chunk-VSUEAI7O.js} +2993 -3820
- package/dist/node-runtime/{chunk-NAY6UUQZ.js → chunk-WDIVLMOH.js} +1 -1
- package/dist/node-runtime/{chunk-E24EO34J.js → chunk-WPXUR3HE.js} +1 -1
- package/dist/node-runtime/{chunk-SLVOAQOY.js → chunk-WXYNALHD.js} +113 -1
- package/dist/node-runtime/{chunk-KJ6DWS3K.js → chunk-XEOCUEUJ.js} +121 -60
- package/dist/node-runtime/chunk-YD3IZAZ7.js +47 -0
- package/dist/node-runtime/chunk-YSB6URMT.js +41 -0
- package/dist/node-runtime/{chunk-VQFSUJJG.js → chunk-ZDJUR45D.js} +430 -129
- package/dist/node-runtime/{chunk-YDO2F2IA.js → chunk-ZEVFBFNF.js} +95 -142
- package/dist/node-runtime/chunk-ZIQUS5QO.js +180 -0
- package/dist/node-runtime/cli-runtime.js +4 -4
- package/dist/node-runtime/{command-6WDOYKS6.js → command-3HMSY6W2.js} +5 -5
- package/dist/node-runtime/{commands-NZLSOHPE.js → commands-D6A6H4TS.js} +11 -16
- package/dist/node-runtime/commands-OCSSEEWJ.js +37 -0
- package/dist/node-runtime/{config-QDD5PUE2.js → config-CU7M7BTK.js} +1 -1
- package/dist/node-runtime/{config-D4QUPAHX.js → config-DS7XLMEM.js} +2 -2
- package/dist/node-runtime/{direct-tool-executor-77GW4F5P.js → direct-tool-executor-2QJXVQD2.js} +8 -10
- package/dist/node-runtime/{exa-LL64QZR2.js → exa-6VBZNPGE.js} +1 -1
- package/dist/node-runtime/{export-html-VM4J2MNR.js → export-html-BRWF5AHI.js} +4 -4
- package/dist/node-runtime/{extension-input-E7BJZ35H.js → extension-input-VBBMX7YV.js} +5 -5
- package/dist/node-runtime/{extension-selector-WU42XDTU.js → extension-selector-T5AOG5XB.js} +5 -5
- package/dist/node-runtime/{extract-EQJE7FZZ.js → extract-BFX2N35A.js} +3 -3
- package/dist/node-runtime/{gateway-INAYBF4Q.js → gateway-6623C2U3.js} +61 -53
- package/dist/node-runtime/{gemini-search-35OCRFLN.js → gemini-search-C66QHDT6.js} +2 -2
- package/dist/node-runtime/{gemini-url-context-UQY3PHHW.js → gemini-url-context-T7DEK73R.js} +3 -3
- package/dist/node-runtime/{github-extract-F64RZOEA.js → github-extract-HOGE3D6F.js} +107 -38
- package/dist/node-runtime/{goal-NJEE5CTU.js → goal-AIHEDUYA.js} +5 -5
- package/dist/node-runtime/index.js +54 -48
- package/dist/node-runtime/{init-HS6NQXSK.js → init-JBQJIPYI.js} +3 -4
- package/dist/node-runtime/{install-cli-KL4UDDAD.js → install-cli-INGHIVBY.js} +30 -25
- package/dist/node-runtime/interactive-mode-FM5DNUSW.js +74 -0
- package/dist/node-runtime/{interactive-view-NGFAMHPW.js → interactive-view-K33PM4OS.js} +8 -8
- package/dist/node-runtime/{lsp-manager-3ASUSO4T.js → lsp-manager-S554V5HR.js} +240 -155
- package/dist/node-runtime/{lunr-browser-IR7TL3J7.js → lunr-browser-H4FDOR3C.js} +7 -7
- package/dist/node-runtime/lunr-computer-use-VDP2QNRQ.js +158 -0
- package/dist/node-runtime/{lunr-cron-LWIZJM2N.js → lunr-cron-LKVA5CZZ.js} +94 -79
- package/dist/node-runtime/main.js +42 -39
- package/dist/node-runtime/{mobile-commands-J7OJEKFO.js → mobile-commands-XT3NQXLD.js} +13 -12
- package/dist/node-runtime/{model-runtime-OO5HFLWE.js → model-runtime-MZ2JMDV4.js} +4 -4
- package/dist/node-runtime/{openai-search-B3MSNCQA.js → openai-search-K72LJDYN.js} +1 -1
- package/dist/node-runtime/{package-manager-cli-VYZM5WHN.js → package-manager-cli-CYM262SI.js} +20 -19
- package/dist/node-runtime/{parallel-AI2MNSCU.js → parallel-X724NCNU.js} +1 -1
- package/dist/node-runtime/{perplexity-QVJW3I35.js → perplexity-RDHQHVMK.js} +2 -2
- package/dist/node-runtime/{pi-intercom-QM53RLTS.js → pi-intercom-NHHEPBMI.js} +2 -2
- package/dist/node-runtime/{pi-mcp-adapter-5UKBZP44.js → pi-mcp-adapter-PP3GQJQ2.js} +98 -94
- package/dist/node-runtime/{pi-ollama-cloud-2F3Y2QNM.js → pi-ollama-cloud-4MNWIMFN.js} +11 -24
- package/dist/node-runtime/{pi-prompt-template-model-QWTCGLJU.js → pi-prompt-template-model-FTGELLS5.js} +32 -36
- package/dist/node-runtime/{pi-subagents-DNY7EAIG.js → pi-subagents-LT3CTO4E.js} +114 -116
- package/dist/node-runtime/{pi-web-access-WTGMNZ32.js → pi-web-access-Z3LP246C.js} +144 -108
- package/dist/node-runtime/{print-mode-XSFM26EL.js → print-mode-2XHN5SUA.js} +4 -3
- package/dist/node-runtime/{process-registry-4FAKZQOL.js → process-registry-Q4QWIU33.js} +3 -3
- package/dist/node-runtime/{proxy-modes-LGEUYD7R.js → proxy-modes-VEGC6QG5.js} +9 -13
- package/dist/node-runtime/rpc-entry.js +42 -39
- package/dist/node-runtime/{rpc-mode-O3XV4SID.js → rpc-mode-32DHJPEJ.js} +4 -4
- package/dist/node-runtime/{runtime-4VA6JKNF.js → runtime-EDUUGAQD.js} +56 -46
- package/dist/node-runtime/runtime-UGXM4NPQ.js +21 -0
- package/dist/node-runtime/{runtime-bridges-VRDDR73P.js → runtime-bridges-DNKMNJCF.js} +8 -7
- package/dist/node-runtime/{service-MDQIPQ26.js → service-IHLGFLBT.js} +6 -4
- package/dist/node-runtime/{session-handoff-GWARVEWT.js → session-handoff-LNSPDTKY.js} +4 -4
- package/dist/node-runtime/{session-manager-JB5J6XBN.js → session-manager-YIFIAVGC.js} +3 -3
- package/dist/node-runtime/{session-selector-GIM4DHQ2.js → session-selector-I73U3EIO.js} +7 -7
- package/dist/node-runtime/{settings-manager-J4SPQPDJ.js → settings-manager-P2TKGYTR.js} +6 -5
- package/dist/node-runtime/{setup-JBKOLJ6F.js → setup-H7CCELIL.js} +15 -1
- package/dist/node-runtime/{setup-CQ2NLVK5.js → setup-OLQ4GXWS.js} +22 -21
- package/dist/node-runtime/{src-IVPNZ2BX.js → src-6RV4PXKJ.js} +64 -36
- package/dist/node-runtime/{subagent-executor-KZZQGAKV.js → subagent-executor-Q5F7DBVM.js} +141 -62
- package/dist/node-runtime/{tavily-WEZFVFP7.js → tavily-KZBFYQB6.js} +1 -1
- package/dist/node-runtime/{theme-UOO5RVFN.js → theme-YLVZKKZD.js} +2 -2
- package/dist/node-runtime/{trust-manager-MMISNCYO.js → trust-manager-ZCU76D23.js} +2 -2
- package/dist/node-runtime/{update-cli-GTFJC7XK.js → update-cli-F3XXJANQ.js} +7 -6
- package/dist/node-runtime/{usage-service-LFB2SWYV.js → usage-service-CPAGBED5.js} +1 -1
- package/dist/node-runtime/{video-extract-OOZHR7SU.js → video-extract-UPKYIBW3.js} +3 -3
- package/dist/node-runtime/workflow-ICDI4N3J.js +767 -0
- package/dist/node-runtime/{youtube-extract-FNPAUNHU.js → youtube-extract-77NT7FWH.js} +4 -4
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +25 -10
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts +2 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +12 -0
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/paths.d.ts +4 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +33 -2
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/sanitize-terminal-text.d.ts +7 -0
- package/dist/utils/sanitize-terminal-text.d.ts.map +1 -0
- package/dist/utils/sanitize-terminal-text.js +67 -0
- package/dist/utils/sanitize-terminal-text.js.map +1 -0
- package/docs/browser.md +1 -1
- package/docs/computer-use.md +362 -0
- package/docs/custom-provider.md +3 -3
- package/docs/extensions.md +8 -4
- package/docs/features.md +22 -12
- package/docs/keybindings.md +1 -1
- package/docs/models.md +5 -5
- package/docs/packages.md +1 -1
- package/docs/providers.md +2 -2
- package/docs/rpc.md +7 -7
- package/docs/security.md +10 -5
- package/docs/sessions.md +2 -2
- package/docs/skills.md +1 -1
- package/docs/terminal-setup.md +7 -7
- package/docs/themes.md +1 -1
- package/docs/usage.md +1 -1
- package/examples/extensions/auto-commit-on-exit.ts +1 -1
- package/examples/extensions/bash-spawn-hook.ts +1 -1
- package/examples/extensions/built-in-tool-renderer.ts +1 -1
- package/examples/extensions/claude-rules.ts +1 -1
- package/examples/extensions/commands.ts +1 -1
- package/examples/extensions/custom-compaction.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +3 -3
- 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/index.ts +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/doom-overlay/index.ts +1 -1
- package/examples/extensions/git-merge-and-resolve.ts +2 -2
- package/examples/extensions/gondolin/index.ts +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/inline-bash.ts +2 -2
- package/examples/extensions/input-transform-streaming.ts +2 -2
- package/examples/extensions/input-transform.ts +2 -2
- package/examples/extensions/interactive-shell.ts +1 -1
- package/examples/extensions/kimi-deferred-tools.ts +1 -1
- package/examples/extensions/mac-system-theme.ts +1 -1
- package/examples/extensions/minimal-mode.ts +1 -1
- package/examples/extensions/modal-editor.ts +1 -1
- package/examples/extensions/model-status.ts +1 -1
- package/examples/extensions/notify.ts +3 -3
- package/examples/extensions/overlay-qa-tests.ts +1 -1
- package/examples/extensions/overlay-test.ts +1 -1
- package/examples/extensions/pirate.ts +1 -1
- package/examples/extensions/preset.ts +3 -3
- package/examples/extensions/project-trust.ts +4 -4
- package/examples/extensions/prompt-customizer.ts +1 -1
- package/examples/extensions/rainbow-editor.ts +1 -1
- package/examples/extensions/rpc-demo.ts +1 -1
- package/examples/extensions/sandbox/index.ts +7 -7
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/shutdown-command.ts +5 -5
- package/examples/extensions/ssh.ts +2 -2
- package/examples/extensions/subagent/README.md +3 -3
- package/examples/extensions/subagent/index.ts +2 -2
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/tool-override.ts +1 -1
- package/examples/extensions/tools.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/working-indicator.ts +1 -1
- package/examples/extensions/working-message-test.ts +1 -1
- package/examples/sdk/01-minimal.ts +1 -1
- package/examples/sdk/03-custom-prompt.ts +1 -1
- package/examples/sdk/04-skills.ts +1 -1
- package/examples/sdk/06-extensions.ts +2 -2
- package/examples/sdk/08-prompt-templates.ts +1 -1
- package/install-lock/package-lock.json +3841 -0
- package/install-lock/package.json +18 -0
- package/native/computer-use/LICENSE.md +21 -0
- package/npm-shrinkwrap.json +3858 -0
- package/package.json +15 -9
- package/dist/modes/interactive/components/exit-card.d.ts +0 -22
- package/dist/modes/interactive/components/exit-card.d.ts.map +0 -1
- package/dist/modes/interactive/components/exit-card.js +0 -69
- package/dist/modes/interactive/components/exit-card.js.map +0 -1
- package/dist/node-runtime/agent-session-services-YXXFCP5J.js +0 -49
- package/dist/node-runtime/chunk-4HXHDDCF.js +0 -16
- package/dist/node-runtime/chunk-4TLO4PO2.js +0 -3427
- package/dist/node-runtime/chunk-AUXVGBO4.js +0 -19
- package/dist/node-runtime/chunk-OVX6X377.js +0 -50
- package/dist/node-runtime/chunk-QTU6AKNJ.js +0 -773
- package/dist/node-runtime/chunk-TORR5XBV.js +0 -356
- package/dist/node-runtime/commands-QC6VUZJQ.js +0 -36
- package/dist/node-runtime/interactive-mode-Z5M7WYYZ.js +0 -72
- package/dist/node-runtime/mcp-auth-flow-QIXHW6QN.js +0 -32
|
@@ -1,37 +1,40 @@
|
|
|
1
1
|
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
TODO_TOOL_NAMES
|
|
4
|
-
} from "./chunk-CCCN2UCX.js";
|
|
5
2
|
import {
|
|
6
3
|
DefaultResourceLoader,
|
|
7
4
|
createSyntheticSourceInfo,
|
|
8
5
|
expandPromptTemplate,
|
|
9
6
|
formatSkillsForPrompt
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DQSCFU7R.js";
|
|
8
|
+
import {
|
|
9
|
+
TODO_TOOL_NAMES
|
|
10
|
+
} from "./chunk-CCCN2UCX.js";
|
|
11
11
|
import {
|
|
12
12
|
stripFrontmatter
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IXG6F4NT.js";
|
|
14
14
|
import {
|
|
15
|
+
SUBAGENT_CHILD_PERMISSION_ENV,
|
|
15
16
|
createAllToolDefinitions,
|
|
16
17
|
createLocalBashOperations,
|
|
17
18
|
createToolDefinitionFromAgentTool,
|
|
19
|
+
isSubagentChildProcess,
|
|
20
|
+
resolveChildRuntimePermissionMode,
|
|
18
21
|
wrapToolDefinition
|
|
19
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZEVFBFNF.js";
|
|
23
|
+
import {
|
|
24
|
+
stripAnsi
|
|
25
|
+
} from "./chunk-6ZZHGUSA.js";
|
|
20
26
|
import {
|
|
21
27
|
DEFAULT_MAX_BYTES,
|
|
22
28
|
truncateTail
|
|
23
29
|
} from "./chunk-53YJI7JU.js";
|
|
24
|
-
import {
|
|
25
|
-
stripAnsi
|
|
26
|
-
} from "./chunk-5ZQXRPMC.js";
|
|
27
30
|
import {
|
|
28
31
|
ModelRuntime,
|
|
29
32
|
isAuthInvalidError,
|
|
30
33
|
isUsageLimitError
|
|
31
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-XEOCUEUJ.js";
|
|
32
35
|
import {
|
|
33
36
|
SettingsManager
|
|
34
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-HUD2RFJW.js";
|
|
35
38
|
import {
|
|
36
39
|
DEFAULT_THINKING_LEVEL,
|
|
37
40
|
calculateContextTokens,
|
|
@@ -43,46 +46,56 @@ import {
|
|
|
43
46
|
generateBranchSummary,
|
|
44
47
|
prepareCompaction,
|
|
45
48
|
shouldCompact
|
|
46
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-FIRA54AC.js";
|
|
47
50
|
import {
|
|
48
51
|
ExtensionRunner,
|
|
49
52
|
emitSessionShutdownEvent
|
|
50
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-BYC6RKCN.js";
|
|
51
54
|
import {
|
|
52
55
|
getSubagentCancellation
|
|
53
56
|
} from "./chunk-BBUVIEZB.js";
|
|
54
57
|
import {
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
AUTO_MODE_ADDENDUM,
|
|
59
|
+
READ_ONLY_MODE_ADDENDUM,
|
|
60
|
+
deletePermissionContext,
|
|
61
|
+
gateToolCall,
|
|
62
|
+
getPermissionMode,
|
|
63
|
+
initializePermissionContext,
|
|
64
|
+
setPermissionMode
|
|
65
|
+
} from "./chunk-APVM5NEU.js";
|
|
57
66
|
import {
|
|
58
67
|
isUserInstructionsPath,
|
|
59
68
|
loadSelectedUserInstructions
|
|
60
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-BDRGN3L2.js";
|
|
61
70
|
import {
|
|
62
71
|
list
|
|
63
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-RYRGL7P4.js";
|
|
64
73
|
import {
|
|
65
74
|
sanitizeBinaryOutput
|
|
66
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-ES6PBSIE.js";
|
|
67
76
|
import {
|
|
68
77
|
SessionTransferError
|
|
69
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-I2H5QMWW.js";
|
|
70
79
|
import {
|
|
71
80
|
CURRENT_SESSION_VERSION,
|
|
72
81
|
SessionManager,
|
|
73
82
|
getDefaultSessionDir,
|
|
74
83
|
getLatestCompactionEntry
|
|
75
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-EPR2F3GU.js";
|
|
76
85
|
import {
|
|
77
86
|
convertToLlm
|
|
78
87
|
} from "./chunk-FVDOXRUD.js";
|
|
79
88
|
import {
|
|
80
89
|
MEMORY_TOOL_NAMES
|
|
81
90
|
} from "./chunk-UJOCPOMX.js";
|
|
91
|
+
import {
|
|
92
|
+
getUsageServiceBridge
|
|
93
|
+
} from "./chunk-HNNHHJAB.js";
|
|
82
94
|
import {
|
|
83
95
|
SessionOwnership,
|
|
84
|
-
canonicalSessionPath
|
|
85
|
-
|
|
96
|
+
canonicalSessionPath,
|
|
97
|
+
writeSessionJson
|
|
98
|
+
} from "./chunk-MNQXDFPV.js";
|
|
86
99
|
import {
|
|
87
100
|
measureStartup,
|
|
88
101
|
time
|
|
@@ -90,7 +103,7 @@ import {
|
|
|
90
103
|
import {
|
|
91
104
|
getThemeByName,
|
|
92
105
|
theme
|
|
93
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-JL4HYQXK.js";
|
|
94
107
|
import {
|
|
95
108
|
CONFIG_DIR_NAME,
|
|
96
109
|
getAgentDir,
|
|
@@ -98,7 +111,7 @@ import {
|
|
|
98
111
|
getExamplesPath,
|
|
99
112
|
getReadmePath,
|
|
100
113
|
resolvePath
|
|
101
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-64XTQNLA.js";
|
|
102
115
|
|
|
103
116
|
// packages/coding-agent/dist/core/agent-session-services.js
|
|
104
117
|
import { join as join7 } from "node:path";
|
|
@@ -232,6 +245,10 @@ var ModelRegistry = class {
|
|
|
232
245
|
constructor(runtime) {
|
|
233
246
|
this.runtime = runtime;
|
|
234
247
|
}
|
|
248
|
+
/** Owner-bound usage bridge for deferred footer rendering. */
|
|
249
|
+
getUsageServiceBridge() {
|
|
250
|
+
return getUsageServiceBridge(this.runtime);
|
|
251
|
+
}
|
|
235
252
|
/** Reload models.json asynchronously. Await before making synchronous registry reads. */
|
|
236
253
|
refresh() {
|
|
237
254
|
return this.runtime.reloadConfig();
|
|
@@ -343,15 +360,20 @@ function disableRollbackForSession(sessionId) {
|
|
|
343
360
|
}
|
|
344
361
|
function pruneTurns(ctx) {
|
|
345
362
|
let maxTurns = ctx.settingsManager?.getRollbackTurns() ?? 2;
|
|
346
|
-
for (; ctx.turns.length > maxTurns; ) {
|
|
347
|
-
let
|
|
348
|
-
|
|
363
|
+
for (; ctx.turns.filter((turn) => !turn.recovery).length > maxTurns; ) {
|
|
364
|
+
let index = ctx.turns.findIndex((turn) => !turn.recovery);
|
|
365
|
+
if (index < 0)
|
|
366
|
+
break;
|
|
367
|
+
let [old] = ctx.turns.splice(index, 1);
|
|
368
|
+
cleanupTurnFiles(ctx, old);
|
|
349
369
|
}
|
|
350
370
|
}
|
|
351
371
|
function beginTurn(cwd, sessionId) {
|
|
352
372
|
let ctx = getContext(sessionId);
|
|
353
373
|
if (!isRollbackEnabled(ctx.sessionId))
|
|
354
374
|
return;
|
|
375
|
+
for (let pending of ctx.turns.filter((turn2) => turn2.recovery))
|
|
376
|
+
pending.recovery.newerTurnStarted = !0, persistRecoveryProgress(ctx, pending);
|
|
355
377
|
cwd && (ctx.lastCwd = cwd), ctx.currentTurnIndex++;
|
|
356
378
|
let turn = { turnIndex: ctx.currentTurnIndex, cwd, files: /* @__PURE__ */ new Map() };
|
|
357
379
|
ctx.turns.push(turn), pruneTurns(ctx), cwd && ctx.settingsManager?.getRollbackScope() === "tree" && captureTreeBaseline(ctx, cwd);
|
|
@@ -496,6 +518,7 @@ function readManifest(path) {
|
|
|
496
518
|
let files = parsed.files;
|
|
497
519
|
return {
|
|
498
520
|
cwd: typeof parsed.cwd == "string" ? parsed.cwd : void 0,
|
|
521
|
+
recovery: parseRecoveryProgress(parsed.recovery),
|
|
499
522
|
files: files && typeof files == "object" && !Array.isArray(files) ? files : {}
|
|
500
523
|
};
|
|
501
524
|
}
|
|
@@ -504,6 +527,31 @@ function readManifest(path) {
|
|
|
504
527
|
return { files: {} };
|
|
505
528
|
}
|
|
506
529
|
}
|
|
530
|
+
function parseRecoveryProgress(value) {
|
|
531
|
+
if (!value || typeof value != "object")
|
|
532
|
+
return;
|
|
533
|
+
let progress = value;
|
|
534
|
+
if (!(typeof progress.turnsToConsume != "number" || !Number.isInteger(progress.turnsToConsume) || progress.turnsToConsume < 1 || !Array.isArray(progress.completed) || !progress.completed.every((path) => typeof path == "string")))
|
|
535
|
+
return {
|
|
536
|
+
targetUserId: typeof progress.targetUserId == "string" ? progress.targetUserId : void 0,
|
|
537
|
+
turnsToConsume: progress.turnsToConsume,
|
|
538
|
+
completed: progress.completed,
|
|
539
|
+
pending: typeof progress.pending == "string" ? progress.pending : void 0,
|
|
540
|
+
newerTurnStarted: progress.newerTurnStarted === !0
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
function persistRecoveryProgress(ctx, turn) {
|
|
544
|
+
let turnDir = getTurnDir(ctx, turn.turnIndex);
|
|
545
|
+
mkdirSync(turnDir, { recursive: !0 });
|
|
546
|
+
let manifest = { cwd: turn.cwd, recovery: turn.recovery, files: {} };
|
|
547
|
+
for (let [path, snap] of turn.files)
|
|
548
|
+
manifest.files[path] = {
|
|
549
|
+
existed: snap.existed,
|
|
550
|
+
createdByTool: snap.createdByTool,
|
|
551
|
+
snapFile: snap.existed ? snapFileName(path) : void 0
|
|
552
|
+
};
|
|
553
|
+
writeSessionJson(join3(turnDir, "manifest.json"), manifest);
|
|
554
|
+
}
|
|
507
555
|
function loadPersistedTurns(ctx) {
|
|
508
556
|
try {
|
|
509
557
|
let sessionDir = join3(ROLLBACK_BASE, ctx.sessionId);
|
|
@@ -525,7 +573,7 @@ function loadPersistedTurns(ctx) {
|
|
|
525
573
|
}
|
|
526
574
|
files.set(absPath, { existed: meta.existed, content, createdByTool: meta.createdByTool });
|
|
527
575
|
}
|
|
528
|
-
loaded.push({ turnIndex, cwd: manifest.cwd, files });
|
|
576
|
+
loaded.push({ turnIndex, cwd: manifest.cwd, files, recovery: manifest.recovery });
|
|
529
577
|
}
|
|
530
578
|
loaded.sort((a, b) => a.turnIndex - b.turnIndex), ctx.turns = loaded, ctx.currentTurnIndex = loaded.length > 0 ? loaded[loaded.length - 1].turnIndex : -1, pruneTurns(ctx);
|
|
531
579
|
} catch {
|
|
@@ -564,42 +612,99 @@ function warnExternalModification(ctx, message) {
|
|
|
564
612
|
}
|
|
565
613
|
}
|
|
566
614
|
}
|
|
615
|
+
function recoveryTurn(ctx) {
|
|
616
|
+
return ctx.turns.find((turn) => turn.recovery) ?? [...ctx.turns].reverse().find((turn) => turn.files.size > 0);
|
|
617
|
+
}
|
|
618
|
+
function getRollbackTargetUserId(sessionId) {
|
|
619
|
+
return recoveryTurn(getContext(sessionId))?.recovery?.targetUserId;
|
|
620
|
+
}
|
|
621
|
+
function getRollbackRecoveryBlockReason(sessionId) {
|
|
622
|
+
let ctx = getContext(sessionId), pending = ctx.turns.find((turn) => turn.recovery);
|
|
623
|
+
if (pending?.recovery && (pending.recovery.newerTurnStarted || ctx.turns.some((turn) => turn.turnIndex > pending.turnIndex + pending.recovery.turnsToConsume - 1)))
|
|
624
|
+
return "Automatic rollback retry is unavailable after newer turns. Chat and files are unchanged. Use /new to continue in a separate chat; this does not repair the retained recovery. Snapshots remain available for manual recovery.";
|
|
625
|
+
}
|
|
567
626
|
function peekRollbackTurnsConsumed(sessionId) {
|
|
568
627
|
let ctx = getContext(sessionId);
|
|
569
|
-
if (!isRollbackEnabled(ctx.sessionId)
|
|
628
|
+
if (!isRollbackEnabled(ctx.sessionId))
|
|
570
629
|
return 0;
|
|
571
|
-
let
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
630
|
+
let turn = recoveryTurn(ctx);
|
|
631
|
+
return turn?.recovery?.turnsToConsume ?? (turn ? ctx.turns.length - ctx.turns.indexOf(turn) : ctx.turns.length);
|
|
632
|
+
}
|
|
633
|
+
function commitRollbackTurn(sessionId, turnIndex) {
|
|
634
|
+
let ctx = getContext(sessionId), blocked = getRollbackRecoveryBlockReason(sessionId);
|
|
635
|
+
if (blocked)
|
|
636
|
+
throw new Error(blocked);
|
|
637
|
+
let index = ctx.turns.findIndex((turn2) => turn2.turnIndex === turnIndex);
|
|
638
|
+
if (index < 0)
|
|
639
|
+
return;
|
|
640
|
+
let turn = ctx.turns[index];
|
|
641
|
+
if (!turn.recovery || [...turn.files.keys()].some((path) => !turn.recovery?.completed.includes(path)))
|
|
642
|
+
throw new Error("Rollback still has unrestored files.");
|
|
643
|
+
let count = 1;
|
|
644
|
+
for (; index + count < ctx.turns.length && ctx.turns[index + count].files.size === 0; )
|
|
645
|
+
count++;
|
|
646
|
+
for (let removed of ctx.turns.splice(index, count))
|
|
647
|
+
cleanupTurnFiles(ctx, removed);
|
|
575
648
|
}
|
|
576
|
-
function rollbackLastTurn(sessionId) {
|
|
577
|
-
let ctx = getContext(sessionId),
|
|
649
|
+
function rollbackLastTurn(sessionId, options = {}) {
|
|
650
|
+
let ctx = getContext(sessionId), result = { restored: [], deleted: [], failed: [], complete: !0, turnsConsumed: 0 };
|
|
578
651
|
if (!isRollbackEnabled(ctx.sessionId))
|
|
579
|
-
return
|
|
580
|
-
let
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
652
|
+
return result;
|
|
653
|
+
let blocked = getRollbackRecoveryBlockReason(ctx.sessionId);
|
|
654
|
+
if (blocked)
|
|
655
|
+
throw new Error(blocked);
|
|
656
|
+
let turn = recoveryTurn(ctx) ?? (options.deferCommit ? ctx.turns[0] : void 0);
|
|
657
|
+
if (!turn) {
|
|
658
|
+
for (let empty of ctx.turns.splice(0))
|
|
659
|
+
cleanupTurnFiles(ctx, empty);
|
|
660
|
+
return result;
|
|
661
|
+
}
|
|
662
|
+
result.turnIndex = turn.turnIndex, turn.recovery ??= {
|
|
663
|
+
turnsToConsume: peekRollbackTurnsConsumed(ctx.sessionId),
|
|
664
|
+
completed: [],
|
|
665
|
+
targetUserId: options.targetUserId
|
|
666
|
+
}, turn.recovery.targetUserId ??= options.targetUserId, persistRecoveryProgress(ctx, turn);
|
|
667
|
+
let capture = ctx.settingsManager?.getRollbackCapture() ?? "copies";
|
|
668
|
+
for (let [absPath, snap] of turn.files) {
|
|
669
|
+
if (turn.recovery.completed.includes(absPath))
|
|
670
|
+
continue;
|
|
671
|
+
let wasPending = turn.recovery.pending === absPath;
|
|
590
672
|
try {
|
|
591
|
-
if (
|
|
592
|
-
|
|
673
|
+
if (turn.recovery.pending === absPath) {
|
|
674
|
+
if (!(snap.existed ? snap.content && existsSync(absPath) && readFileSync(absPath).equals(snap.content) : !existsSync(absPath))) {
|
|
675
|
+
result.failed.push({
|
|
676
|
+
path: absPath,
|
|
677
|
+
error: "Previous recovery outcome is uncertain. Restore this path from its retained snapshot before retrying."
|
|
678
|
+
});
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
turn.recovery.completed.push(absPath), turn.recovery.pending = void 0, persistRecoveryProgress(ctx, turn);
|
|
593
682
|
continue;
|
|
594
683
|
}
|
|
595
|
-
if (
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
684
|
+
if (!isWithinAllowedRoots(absPath, turn))
|
|
685
|
+
throw warnExternalModification(ctx, `Rollback skipped ${absPath}: outside the session working directory or lunR config dir.`), new Error("Outside the allowed rollback roots.");
|
|
686
|
+
if (turn.recovery.pending) {
|
|
687
|
+
result.failed.push({
|
|
688
|
+
path: absPath,
|
|
689
|
+
error: "Resolve the uncertain recovery path before continuing this turn."
|
|
690
|
+
});
|
|
691
|
+
continue;
|
|
692
|
+
}
|
|
693
|
+
if (snap.existed && !snap.content)
|
|
694
|
+
throw new Error("Snapshot content is unavailable.");
|
|
695
|
+
turn.recovery.pending = absPath, persistRecoveryProgress(ctx, turn), snap.existed && snap.content ? !snap.createdByTool && existsSync(absPath) && readFileSync(absPath).equals(snap.content) || (mkdirSync(dirname(absPath), { recursive: !0 }), writeFileSync(absPath, snap.content), result.restored.push(absPath)) : (snap.createdByTool || capture === "hybrid" || capture === "shadow-git") && existsSync(absPath) && (unlinkSync(absPath), result.deleted.push(absPath)), turn.recovery.completed.push(absPath), turn.recovery.pending = void 0, persistRecoveryProgress(ctx, turn);
|
|
696
|
+
} catch (error) {
|
|
697
|
+
if (!wasPending && turn.recovery.pending === absPath) {
|
|
698
|
+
turn.recovery.pending = void 0;
|
|
699
|
+
try {
|
|
700
|
+
persistRecoveryProgress(ctx, turn);
|
|
701
|
+
} catch {
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
result.failed.push({ path: absPath, error: error instanceof Error ? error.message : String(error) });
|
|
601
705
|
}
|
|
602
|
-
|
|
706
|
+
}
|
|
707
|
+
return result.complete = result.failed.length === 0, result.complete && !options.deferCommit && (result.turnsConsumed = turn.recovery.turnsToConsume, commitRollbackTurn(ctx.sessionId, turn.turnIndex)), result;
|
|
603
708
|
}
|
|
604
709
|
function migrateRollbackSession(oldSessionId, newSessionId) {
|
|
605
710
|
if (oldSessionId === newSessionId)
|
|
@@ -805,7 +910,12 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
|
|
|
805
910
|
_retryAbortController = void 0;
|
|
806
911
|
_retryAttempt = 0;
|
|
807
912
|
// Bash execution state
|
|
808
|
-
|
|
913
|
+
_bashOperations = /* @__PURE__ */ new Map();
|
|
914
|
+
_operations = /* @__PURE__ */ new Set();
|
|
915
|
+
_closing = !1;
|
|
916
|
+
_disposed = !1;
|
|
917
|
+
_drainPromise;
|
|
918
|
+
_shutdownPromise;
|
|
809
919
|
_pendingBashMessages = [];
|
|
810
920
|
// Extension system
|
|
811
921
|
_extensionRunner;
|
|
@@ -838,12 +948,14 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
|
|
|
838
948
|
_baseSystemPrompt = "";
|
|
839
949
|
_baseSystemPromptOptions;
|
|
840
950
|
_systemPromptOverride;
|
|
841
|
-
//
|
|
951
|
+
// Optional host-owned prompt append, separate from session permission guidance.
|
|
842
952
|
_systemPromptAppend;
|
|
843
953
|
// lunr: core-owned tool-call gates (read-only mode) checked before extension tool_call handlers
|
|
844
954
|
_toolCallGates = [];
|
|
845
955
|
constructor(config) {
|
|
846
|
-
this.agent = config.agent, this.sessionManager = config.sessionManager, this.settingsManager = config.settingsManager
|
|
956
|
+
this.agent = config.agent, this.sessionManager = config.sessionManager, this.settingsManager = config.settingsManager;
|
|
957
|
+
let permissionMode = config.permissionMode ?? (isSubagentChildProcess() ? resolveChildRuntimePermissionMode(process.env[SUBAGENT_CHILD_PERMISSION_ENV]) : void 0) ?? this.sessionManager.getPermissionMode() ?? this.settingsManager.getDefaultPermissionMode();
|
|
958
|
+
initializePermissionContext(this.sessionId, permissionMode, config.permissionMode), this._scopedModels = config.scopedModels ?? [], this._resourceLoader = config.resourceLoader, this._customTools = config.customTools ?? [], this._cwd = config.cwd, this._agentDir = config.agentDir ?? getAgentDir(), this._modelRuntime = config.modelRuntime, this._syncOpenAIServiceTier(), this._extensionRunnerRef = config.extensionRunnerRef, this._initialActiveToolNames = config.initialActiveToolNames, this._allowedToolNames = config.allowedToolNames ? new Set(config.allowedToolNames) : void 0, this._excludedToolNames = config.excludedToolNames ? new Set(config.excludedToolNames) : void 0, this._baseToolsOverride = config.baseToolsOverride, this._sessionStartEvent = config.sessionStartEvent ?? { type: "session_start", reason: "startup" };
|
|
847
959
|
let waitInterruptionOwner = { register: () => this._registerSubagentWaitInterruption() };
|
|
848
960
|
for (let identity of new Set([this.sessionId, this.sessionFile].filter((value) => !!value)))
|
|
849
961
|
this._unregisterSubagentWaitInterruptionOwners.push(registerSubagentWaitInterruptionOwner(identity, waitInterruptionOwner));
|
|
@@ -1031,7 +1143,7 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
|
|
|
1031
1143
|
}
|
|
1032
1144
|
}
|
|
1033
1145
|
}
|
|
1034
|
-
if (await this._emitExtensionEvent(event), this._emit(event.type === "agent_end" ? { ...event, willRetry: this._willRetryAfterAgentEnd(event) } : event), event.type === "message_end" && (event.message.role === "custom" ? this.sessionManager.appendCustomMessageEntry(event.message.customType, event.message.content, event.message.display, event.message.details) : (event.message.role === "user" || event.message.role === "assistant" || event.message.role === "toolResult") && this.sessionManager.appendMessage(event.message), event.message.role === "assistant")) {
|
|
1146
|
+
if (event.type === "message_end" && this._activePromptRun?.completion?.messages.push(event.message), await this._emitExtensionEvent(event), this._emit(event.type === "agent_end" ? { ...event, willRetry: this._willRetryAfterAgentEnd(event) } : event), event.type === "message_end" && (event.message.role === "custom" ? this.sessionManager.appendCustomMessageEntry(event.message.customType, event.message.content, event.message.display, event.message.details) : (event.message.role === "user" || event.message.role === "assistant" || event.message.role === "toolResult") && this.sessionManager.appendMessage(event.message), event.message.role === "assistant")) {
|
|
1035
1147
|
this._lastAssistantMessage = event.message;
|
|
1036
1148
|
let assistantMsg = event.message;
|
|
1037
1149
|
assistantMsg.stopReason !== "error" && (this._overflowRecoveryAttempted = !1), assistantMsg.stopReason !== "error" && this._retryAttempt > 0 && (this._emit({
|
|
@@ -1182,18 +1294,53 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
|
|
|
1182
1294
|
this.transferring = value, value && this._invalidateWaitPromptHandoffs("Session transfer interrupted the pending prompt.");
|
|
1183
1295
|
}
|
|
1184
1296
|
assertCanStartWork() {
|
|
1185
|
-
if (this.sessionManager.assertWritable(), this.
|
|
1297
|
+
if (this.sessionManager.assertWritable(), this._closing)
|
|
1298
|
+
throw new Error("Session is closing. New work is not accepted.");
|
|
1299
|
+
if (this.transferring)
|
|
1186
1300
|
throw new Error("Session transfer is in progress. Wait or reclaim the session.");
|
|
1187
1301
|
}
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1302
|
+
/** Stop admission synchronously, retaining listeners and session ownership. */
|
|
1303
|
+
stopAdmission() {
|
|
1304
|
+
this._closing = !0, this._invalidateWaitPromptHandoffs("Session closed before the pending prompt could run.");
|
|
1305
|
+
}
|
|
1306
|
+
async _trackOperation(operation) {
|
|
1307
|
+
let settle = () => {
|
|
1308
|
+
}, completion = new Promise((resolve3) => {
|
|
1309
|
+
settle = resolve3;
|
|
1310
|
+
});
|
|
1311
|
+
this._operations.add(completion);
|
|
1192
1312
|
try {
|
|
1193
|
-
|
|
1194
|
-
}
|
|
1313
|
+
return await operation();
|
|
1314
|
+
} finally {
|
|
1315
|
+
this._operations.delete(completion), settle();
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
/** Cancel owned work and wait for final persistence before extension shutdown. */
|
|
1319
|
+
drain() {
|
|
1320
|
+
return this._drainPromise ? this._drainPromise : (this.stopAdmission(), this._activePromptRun && (this._activePromptRun.gracefulStopRequested = !0), this.abortRetry(), this.abortCompaction(), this.abortBranchSummary(), this.abortBash(), this.clearQueue(), this.agent.abort(), this._drainPromise = (async () => {
|
|
1321
|
+
await Promise.all([...this._operations]), await this.waitForIdle(), await this.agent.waitForIdle(), this._flushPendingBashMessages();
|
|
1322
|
+
})(), this._drainPromise);
|
|
1323
|
+
}
|
|
1324
|
+
/** Await cancellation and persistence, then release listeners and ownership. */
|
|
1325
|
+
shutdown() {
|
|
1326
|
+
return this._shutdownPromise || (this._shutdownPromise = this.drain().then(() => this._disposeSettled())), this._shutdownPromise;
|
|
1327
|
+
}
|
|
1328
|
+
/** Compatibility wrapper. Use await shutdown() when release must be complete. */
|
|
1329
|
+
dispose() {
|
|
1330
|
+
if (this._operations.size === 0 && !this._isAgentRunActive && !this.agent.state.isStreaming) {
|
|
1331
|
+
this.stopAdmission(), this._disposeSettled();
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
this.shutdown().catch(() => {
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
_disposeSettled() {
|
|
1338
|
+
if (!this._disposed) {
|
|
1339
|
+
this._disposed = !0;
|
|
1340
|
+
for (let unregister of this._unregisterSubagentWaitInterruptionOwners.splice(0))
|
|
1341
|
+
unregister();
|
|
1342
|
+
this._extensionRunner.invalidate("This extension ctx is stale after session replacement or reload. Do not use a captured pi or command ctx after ctx.newSession(), ctx.fork(), ctx.switchSession(), or ctx.reload(). For newSession, fork, and switchSession, move post-replacement work into withSession and use the ctx passed to withSession. For reload, do not use the old ctx after await ctx.reload()."), this._disconnectFromAgent(), this._eventListeners = [], cleanupSessionResources(this.sessionId), deletePermissionContext(this.sessionId), this.sessionManager.dispose();
|
|
1195
1343
|
}
|
|
1196
|
-
this._extensionRunner.invalidate("This extension ctx is stale after session replacement or reload. Do not use a captured pi or command ctx after ctx.newSession(), ctx.fork(), ctx.switchSession(), or ctx.reload(). For newSession, fork, and switchSession, move post-replacement work into withSession and use the ctx passed to withSession. For reload, do not use the old ctx after await ctx.reload()."), this._disconnectFromAgent(), this._eventListeners = [], cleanupSessionResources(this.sessionId), this.sessionManager.dispose();
|
|
1197
1344
|
}
|
|
1198
1345
|
// =========================================================================
|
|
1199
1346
|
// Read-only State Access
|
|
@@ -1245,10 +1392,20 @@ var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"
|
|
|
1245
1392
|
let next = text && text.trim().length > 0 ? text : void 0;
|
|
1246
1393
|
next !== this._systemPromptAppend && (this._systemPromptAppend = next, this.agent.state.systemPrompt = this._withSystemPromptAppend(this._systemPromptOverride ?? this._baseSystemPrompt));
|
|
1247
1394
|
}
|
|
1395
|
+
get permissionMode() {
|
|
1396
|
+
return getPermissionMode(this.sessionId);
|
|
1397
|
+
}
|
|
1398
|
+
_permissionAddendum(mode) {
|
|
1399
|
+
return mode === "read-only" ? READ_ONLY_MODE_ADDENDUM : mode === "auto" ? AUTO_MODE_ADDENDUM : void 0;
|
|
1400
|
+
}
|
|
1401
|
+
/** Update the same permission context consulted by headless and interactive tools. */
|
|
1402
|
+
setPermissionMode(mode) {
|
|
1403
|
+
this.assertCanStartWork(), setPermissionMode(mode, this.sessionId), this.sessionManager.setPermissionMode(mode), this.agent.state.systemPrompt = this._withSystemPromptAppend(this._systemPromptOverride ?? this._baseSystemPrompt);
|
|
1404
|
+
}
|
|
1248
1405
|
_withSystemPromptAppend(prompt) {
|
|
1249
|
-
return this._systemPromptAppend
|
|
1406
|
+
return [prompt, this._permissionAddendum(this.permissionMode), this._systemPromptAppend].filter(Boolean).join(`
|
|
1250
1407
|
|
|
1251
|
-
|
|
1408
|
+
`);
|
|
1252
1409
|
}
|
|
1253
1410
|
/** Current retry attempt (0 if not retrying) */
|
|
1254
1411
|
get retryAttempt() {
|
|
@@ -1410,24 +1567,46 @@ ${this._systemPromptAppend}` : prompt;
|
|
|
1410
1567
|
for (let reservation of handoff.reservations.splice(0))
|
|
1411
1568
|
reservation.reject(error);
|
|
1412
1569
|
}
|
|
1413
|
-
|
|
1570
|
+
_reservePromptRun() {
|
|
1571
|
+
if (this.assertCanStartWork(), this._isAgentRunActive || this._manualCompactionPromise)
|
|
1572
|
+
throw new Error("Agent is already processing. Specify streamingBehavior ('steer' or 'followUp') to queue the message.");
|
|
1414
1573
|
let run = { waits: /* @__PURE__ */ new Set(), gracefulStopRequested: !1 };
|
|
1415
|
-
this._activePromptRun = run, this._isAgentRunActive = !0;
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1574
|
+
return this._activePromptRun = run, this._isAgentRunActive = !0, run;
|
|
1575
|
+
}
|
|
1576
|
+
async _releasePromptRun(run) {
|
|
1577
|
+
this._activePromptRun === run && (this._activePromptRun = void 0, this._systemPromptOverride = void 0, this._flushPendingBashMessages(), await this._emitAgentSettled());
|
|
1578
|
+
}
|
|
1579
|
+
async _runAgentPrompt(messages, owner) {
|
|
1580
|
+
let run = owner ?? this._reservePromptRun();
|
|
1581
|
+
await this._trackOperation(async () => {
|
|
1582
|
+
try {
|
|
1583
|
+
if (this.assertCanStartWork(), run.gracefulStopRequested)
|
|
1584
|
+
throw new Error("Prompt was cancelled during preparation.");
|
|
1585
|
+
for (await this.agent.prompt(Array.isArray(messages) ? messages : [messages], {
|
|
1586
|
+
consumeFollowUps: !run.completion
|
|
1587
|
+
}); await this._handlePostAgentRun(run) && !(run.gracefulStopRequested || this._closing || run.completion?.cancelled); )
|
|
1588
|
+
await this.agent.continue({ consumeFollowUps: !run.completion });
|
|
1589
|
+
if (run.completion) {
|
|
1590
|
+
let completion = run.completion;
|
|
1591
|
+
run.completion = void 0, completion.detach?.();
|
|
1592
|
+
let hasQueuedWork = !run.gracefulStopRequested && !this._closing && this.agent.hasQueuedMessages();
|
|
1593
|
+
if (hasQueuedWork || await this._releasePromptRun(run), completion.settle(), hasQueuedWork)
|
|
1594
|
+
for (await this.agent.continueQueued(); await this._handlePostAgentRun(run) && !(run.gracefulStopRequested || this._closing); )
|
|
1595
|
+
await this.agent.continue();
|
|
1596
|
+
}
|
|
1597
|
+
} finally {
|
|
1598
|
+
await this._releasePromptRun(run);
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1422
1601
|
}
|
|
1423
1602
|
async _handlePostAgentRun(run) {
|
|
1424
1603
|
let msg = this._lastAssistantMessage;
|
|
1425
|
-
return this._lastAssistantMessage = void 0, !msg || run.gracefulStopRequested ? !1 : msg.stopReason === "error" && this._isRotationError(msg) && await this._tryRotateSubscriptionKey(msg) || this._isRetryableError(msg) && await this._prepareRetry(msg) || msg.stopReason === "error" && this._isRetryableError(msg) && await this._tryRotateSubscriptionKey(msg) || (msg.stopReason === "error" && this._retryAttempt > 0 && (this._emit({
|
|
1604
|
+
return this._lastAssistantMessage = void 0, !msg || run.gracefulStopRequested || run.completion?.signal?.aborted ? !1 : msg.stopReason === "error" && this._isRotationError(msg) && await this._tryRotateSubscriptionKey(msg) || this._isRetryableError(msg) && await this._prepareRetry(msg) || msg.stopReason === "error" && this._isRetryableError(msg) && await this._tryRotateSubscriptionKey(msg) || (msg.stopReason === "error" && this._retryAttempt > 0 && (this._emit({
|
|
1426
1605
|
type: "auto_retry_end",
|
|
1427
1606
|
success: !1,
|
|
1428
1607
|
attempt: this._retryAttempt,
|
|
1429
1608
|
finalError: msg.errorMessage
|
|
1430
|
-
}), this._retryAttempt = 0), await this._checkCompaction(msg)) ? !0 : this.agent.hasQueuedMessages();
|
|
1609
|
+
}), this._retryAttempt = 0), await this._checkCompaction(msg)) ? !0 : !run.completion && this.agent.hasQueuedMessages();
|
|
1431
1610
|
}
|
|
1432
1611
|
/**
|
|
1433
1612
|
* Send a prompt to the agent.
|
|
@@ -1440,23 +1619,72 @@ ${this._systemPromptAppend}` : prompt;
|
|
|
1440
1619
|
*/
|
|
1441
1620
|
async prompt(text, options) {
|
|
1442
1621
|
this.assertCanStartWork();
|
|
1443
|
-
let
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
preflightResult?.(!0);
|
|
1447
|
-
|
|
1622
|
+
let commandName = text.startsWith("/") ? text.slice(1).split(" ")[0] : void 0;
|
|
1623
|
+
if ((options?.expandPromptTemplates ?? !0) && commandName && this._extensionRunner.getCommand(commandName)) {
|
|
1624
|
+
try {
|
|
1625
|
+
await this._tryExecuteExtensionCommand(text), options?.preflightResult?.(!0);
|
|
1626
|
+
} catch (error) {
|
|
1627
|
+
throw options?.preflightResult?.(!1), error;
|
|
1448
1628
|
}
|
|
1449
|
-
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
return this._trackOperation(() => this._prompt(text, options));
|
|
1632
|
+
}
|
|
1633
|
+
async _prompt(text, options, completion) {
|
|
1634
|
+
let run, accepted = !1;
|
|
1635
|
+
try {
|
|
1636
|
+
this.assertCanStartWork();
|
|
1637
|
+
let wasStreaming = this.isStreaming;
|
|
1638
|
+
if (wasStreaming) {
|
|
1450
1639
|
if (!options?.streamingBehavior)
|
|
1451
1640
|
throw new Error("Agent is already processing. Specify streamingBehavior ('steer' or 'followUp') to queue the message.");
|
|
1452
|
-
|
|
1641
|
+
} else if (run = this._reservePromptRun(), run.completion = completion, completion?.signal) {
|
|
1642
|
+
let owner = run, cancel = () => {
|
|
1643
|
+
this._activePromptRun !== owner || owner.completion !== completion || (completion.cancelled = !0, this.agent.abort(), this.abortRetry(), this._autoCompactionAbortController?.abort());
|
|
1644
|
+
};
|
|
1645
|
+
completion.signal.addEventListener("abort", cancel, { once: !0 }), completion.detach = () => completion.signal?.removeEventListener("abort", cancel), completion.signal.throwIfAborted();
|
|
1646
|
+
}
|
|
1647
|
+
let prepared = await this._preparePromptInput(text, options, wasStreaming ? options?.streamingBehavior : void 0);
|
|
1648
|
+
if (this.assertCanStartWork(), run?.completion?.signal?.throwIfAborted(), run?.gracefulStopRequested)
|
|
1649
|
+
throw new Error("Prompt was cancelled during preparation.");
|
|
1650
|
+
if (!prepared) {
|
|
1651
|
+
accepted = !0, options?.preflightResult?.(!0);
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1654
|
+
if (wasStreaming && this.isStreaming) {
|
|
1655
|
+
options?.streamingBehavior === "followUp" ? await this._queueFollowUp(prepared.text, prepared.images) : await this._queueSteer(prepared.text, prepared.images), accepted = !0, options?.preflightResult?.(!0);
|
|
1453
1656
|
return;
|
|
1454
1657
|
}
|
|
1455
|
-
|
|
1658
|
+
run ??= this._reservePromptRun(), run.completion = completion;
|
|
1659
|
+
let messages = await this._createPromptMessages(prepared);
|
|
1660
|
+
if (this.assertCanStartWork(), run.completion?.signal?.throwIfAborted(), run.gracefulStopRequested)
|
|
1661
|
+
throw new Error("Prompt was cancelled during preparation.");
|
|
1662
|
+
accepted = !0, options?.preflightResult?.(!0), await this._runAgentPrompt(messages, run);
|
|
1456
1663
|
} catch (error) {
|
|
1457
|
-
throw preflightResult?.(!1), error;
|
|
1664
|
+
throw accepted || options?.preflightResult?.(!1), error;
|
|
1665
|
+
} finally {
|
|
1666
|
+
completion?.detach?.(), run && await this._releasePromptRun(run);
|
|
1458
1667
|
}
|
|
1459
|
-
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Admit one scheduled request, including steering, retries and compaction.
|
|
1671
|
+
* Completes before later follow-ups; signal cancellation belongs only to this request.
|
|
1672
|
+
*/
|
|
1673
|
+
async promptWithCompletion(text, options) {
|
|
1674
|
+
if (this.assertCanStartWork(), !this.isIdle || this.isBashRunning || this.isCompacting || this.pendingMessageCount > 0)
|
|
1675
|
+
throw new Error("Session is busy. Retry the scheduled prompt after its work settles.");
|
|
1676
|
+
text.startsWith("/") && (options?.expandPromptTemplates ?? !0) && this._throwIfExtensionCommand(text), options?.signal?.throwIfAborted();
|
|
1677
|
+
let messages = [];
|
|
1678
|
+
return new Promise((resolve3, reject) => {
|
|
1679
|
+
let completion = {
|
|
1680
|
+
messages,
|
|
1681
|
+
signal: options?.signal,
|
|
1682
|
+
settle: () => {
|
|
1683
|
+
completion.cancelled ? reject(completion.signal?.reason) : resolve3({ messages });
|
|
1684
|
+
}
|
|
1685
|
+
};
|
|
1686
|
+
this._trackOperation(() => this._prompt(text, options, completion)).then(completion.settle, reject);
|
|
1687
|
+
});
|
|
1460
1688
|
}
|
|
1461
1689
|
async _preparePromptInput(text, options, streamingBehavior) {
|
|
1462
1690
|
let expandPromptTemplates = options?.expandPromptTemplates ?? !0;
|
|
@@ -1503,7 +1731,8 @@ ${this._systemPromptAppend}` : prompt;
|
|
|
1503
1731
|
return result?.systemPrompt !== void 0 ? (this._systemPromptOverride = result.systemPrompt, this.agent.state.systemPrompt = this._withSystemPromptAppend(result.systemPrompt)) : (this._systemPromptOverride = void 0, this.agent.state.systemPrompt = this._withSystemPromptAppend(this._baseSystemPrompt)), messages;
|
|
1504
1732
|
}
|
|
1505
1733
|
async interruptSubagentWaitWithPrompt(text, options) {
|
|
1506
|
-
|
|
1734
|
+
this.assertCanStartWork();
|
|
1735
|
+
let previousAcceptance = this._waitPromptAcceptance, acceptance = this._trackOperation(() => previousAcceptance.then(() => this._reserveWaitPrompt(text, options)));
|
|
1507
1736
|
return this._waitPromptAcceptance = acceptance.then(() => {
|
|
1508
1737
|
}, () => {
|
|
1509
1738
|
}), acceptance;
|
|
@@ -1528,6 +1757,8 @@ ${this._systemPromptAppend}` : prompt;
|
|
|
1528
1757
|
} catch (error) {
|
|
1529
1758
|
throw handoff.reservations.length === 0 && this._waitPromptHandoff === handoff && (this._waitPromptHandoff = void 0), error;
|
|
1530
1759
|
}
|
|
1760
|
+
if (this.assertCanStartWork(), handoff.generation !== this._waitPromptGeneration)
|
|
1761
|
+
throw new Error("Pending prompt was cancelled during preparation.");
|
|
1531
1762
|
if (!prepared)
|
|
1532
1763
|
return handoff.reservations.length === 0 && this._waitPromptHandoff === handoff && (this._waitPromptHandoff = void 0), { completion: Promise.resolve() };
|
|
1533
1764
|
let resolveCompletion = () => {
|
|
@@ -1539,15 +1770,15 @@ ${this._systemPromptAppend}` : prompt;
|
|
|
1539
1770
|
}
|
|
1540
1771
|
async _drainWaitPromptHandoff(handoff) {
|
|
1541
1772
|
for (await this.waitForIdle(); this._waitPromptHandoff === handoff && handoff.generation === this._waitPromptGeneration && handoff.reservations.length > 0; ) {
|
|
1542
|
-
let reservation = handoff.reservations[0];
|
|
1773
|
+
let reservation = handoff.reservations[0], run;
|
|
1543
1774
|
try {
|
|
1544
|
-
this.assertCanStartWork();
|
|
1775
|
+
this.assertCanStartWork(), run = this._reservePromptRun();
|
|
1545
1776
|
let messages = await this._createPromptMessages(reservation.input);
|
|
1546
|
-
handoff.accepting = !1, await this._runAgentPrompt(messages), reservation.resolve();
|
|
1777
|
+
handoff.accepting = !1, await this._runAgentPrompt(messages, run), reservation.resolve();
|
|
1547
1778
|
} catch (error) {
|
|
1548
1779
|
reservation.reject(error);
|
|
1549
1780
|
} finally {
|
|
1550
|
-
handoff.reservations[0] === reservation && handoff.reservations.shift();
|
|
1781
|
+
run && await this._releasePromptRun(run), handoff.reservations[0] === reservation && handoff.reservations.shift();
|
|
1551
1782
|
}
|
|
1552
1783
|
}
|
|
1553
1784
|
handoff.accepting = !1, this._waitPromptHandoff === handoff && (this._waitPromptHandoff = void 0);
|
|
@@ -1734,7 +1965,9 @@ ${args}` : skillBlock;
|
|
|
1734
1965
|
* Abort current operation and wait for agent to become idle.
|
|
1735
1966
|
*/
|
|
1736
1967
|
async abort() {
|
|
1737
|
-
this._invalidateWaitPromptHandoffs("The active run was aborted before the pending prompt could run."), this.abortRetry(), this.agent.
|
|
1968
|
+
this._invalidateWaitPromptHandoffs("The active run was aborted before the pending prompt could run."), this.abortRetry(), this._activePromptRun && !this.agent.signal && (this._activePromptRun.gracefulStopRequested = !0);
|
|
1969
|
+
let bash = [...this._bashOperations.values()];
|
|
1970
|
+
this.abortBash(), this.agent.abort(), await this.waitForIdle(), await Promise.all(bash);
|
|
1738
1971
|
}
|
|
1739
1972
|
async waitForIdle() {
|
|
1740
1973
|
this.isIdle || await this._getIdleWaitPromise();
|
|
@@ -1896,12 +2129,13 @@ ${args}` : skillBlock;
|
|
|
1896
2129
|
* @param customInstructions Optional instructions for the compaction summary
|
|
1897
2130
|
*/
|
|
1898
2131
|
async compact(customInstructions) {
|
|
2132
|
+
this.assertCanStartWork();
|
|
1899
2133
|
let existing = this._latestCompactionResult();
|
|
1900
2134
|
if (existing)
|
|
1901
2135
|
return existing;
|
|
1902
2136
|
if (this._manualCompactionPromise)
|
|
1903
2137
|
return this._manualCompactionPromise;
|
|
1904
|
-
let promise = this._compact(customInstructions);
|
|
2138
|
+
let promise = this._trackOperation(() => this._compact(customInstructions));
|
|
1905
2139
|
this._manualCompactionPromise = promise;
|
|
1906
2140
|
try {
|
|
1907
2141
|
return await promise;
|
|
@@ -1910,13 +2144,13 @@ ${args}` : skillBlock;
|
|
|
1910
2144
|
}
|
|
1911
2145
|
}
|
|
1912
2146
|
async _compact(customInstructions) {
|
|
1913
|
-
this.
|
|
2147
|
+
await this.abort(), this.assertCanStartWork();
|
|
1914
2148
|
let existing = this._latestCompactionResult();
|
|
1915
2149
|
if (existing)
|
|
1916
|
-
return
|
|
1917
|
-
this.
|
|
2150
|
+
return existing;
|
|
2151
|
+
this._disconnectFromAgent(), this._compactionAbortController = new AbortController();
|
|
1918
2152
|
try {
|
|
1919
|
-
if (!this.model)
|
|
2153
|
+
if (this._emit({ type: "compaction_start", reason: "manual" }), !this.model)
|
|
1920
2154
|
throw new Error(formatNoModelSelectedMessage());
|
|
1921
2155
|
let { apiKey, headers, env } = await this._getSummarizationRequestAuth(this.model), pathEntries = this.sessionManager.getBranch(), settings = this.settingsManager.getCompactionSettings(), preparation = prepareCompaction(pathEntries, settings);
|
|
1922
2156
|
if (!preparation)
|
|
@@ -2122,7 +2356,7 @@ ${args}` : skillBlock;
|
|
|
2122
2356
|
let messages = this.agent.state.messages, lastMsg = messages[messages.length - 1];
|
|
2123
2357
|
return lastMsg?.role === "assistant" && lastMsg.stopReason === "error" && (this.agent.state.messages = messages.slice(0, -1)), !0;
|
|
2124
2358
|
}
|
|
2125
|
-
return this.agent.hasQueuedMessages();
|
|
2359
|
+
return !this._activePromptRun?.completion && this.agent.hasQueuedMessages();
|
|
2126
2360
|
} catch (error) {
|
|
2127
2361
|
let errorMessage = error instanceof Error ? error.message : "compaction failed";
|
|
2128
2362
|
return started && this._emit({
|
|
@@ -2303,6 +2537,7 @@ ${args}` : skillBlock;
|
|
|
2303
2537
|
}, {
|
|
2304
2538
|
getModel: () => this.resolvedCatalogModel(),
|
|
2305
2539
|
isIdle: () => this.isIdle,
|
|
2540
|
+
promptWithCompletion: (text, options) => this.promptWithCompletion(text, options),
|
|
2306
2541
|
isProjectTrusted: () => this.settingsManager.isProjectTrusted(),
|
|
2307
2542
|
getSignal: () => this.agent.signal,
|
|
2308
2543
|
abort: () => {
|
|
@@ -2476,16 +2711,13 @@ ${args}` : skillBlock;
|
|
|
2476
2711
|
* false when rotation is impossible, leaving the error as the final message.
|
|
2477
2712
|
*/
|
|
2478
2713
|
async _tryRotateSubscriptionKey(message) {
|
|
2479
|
-
let
|
|
2480
|
-
if (!
|
|
2714
|
+
let requestKey = this._modelRuntime.getRequestSubscriptionKey(message);
|
|
2715
|
+
if (!requestKey)
|
|
2481
2716
|
return !1;
|
|
2482
|
-
let providerId =
|
|
2717
|
+
let providerId = requestKey.providerId;
|
|
2483
2718
|
if (this._modelRuntime.hasRuntimeApiKey(providerId))
|
|
2484
2719
|
return !1;
|
|
2485
|
-
let manager = this._modelRuntime.subscriptionManager;
|
|
2486
|
-
if ((await manager.list(providerId)).length < 2)
|
|
2487
|
-
return !1;
|
|
2488
|
-
let errorMessage = message.errorMessage ?? "Unknown error", entry = await manager.rotateOnFailure(providerId, errorMessage);
|
|
2720
|
+
let manager = this._modelRuntime.subscriptionManager, errorMessage = message.errorMessage ?? "Unknown error", entry = await manager.rotateOnFailure(providerId, errorMessage, requestKey.fingerprint);
|
|
2489
2721
|
if (!entry)
|
|
2490
2722
|
return !1;
|
|
2491
2723
|
this._retryAttempt > 0 && this._emit({ type: "auto_retry_end", success: !0, attempt: this._retryAttempt }), this._retryAttempt = 0;
|
|
@@ -2523,17 +2755,21 @@ ${args}` : skillBlock;
|
|
|
2523
2755
|
* @param options.operations Custom BashOperations for remote execution
|
|
2524
2756
|
*/
|
|
2525
2757
|
async executeBash(command, onChunk, options) {
|
|
2526
|
-
this.assertCanStartWork()
|
|
2527
|
-
let
|
|
2528
|
-
|
|
2758
|
+
this.assertCanStartWork();
|
|
2759
|
+
let controller = new AbortController(), settle = () => {
|
|
2760
|
+
}, completion = new Promise((resolve3) => {
|
|
2761
|
+
settle = resolve3;
|
|
2762
|
+
});
|
|
2763
|
+
this._bashOperations.set(controller, completion), this._operations.add(completion);
|
|
2529
2764
|
try {
|
|
2530
|
-
let
|
|
2765
|
+
let prefix = this.settingsManager.getShellCommandPrefix(), shellPath = this.settingsManager.getShellPath(), resolvedCommand = prefix ? `${prefix}
|
|
2766
|
+
${command}` : command, result = await executeBashWithOperations(resolvedCommand, this.sessionManager.getCwd(), options?.operations ?? createLocalBashOperations({ shellPath, sessionId: this.sessionId }), {
|
|
2531
2767
|
onChunk,
|
|
2532
|
-
signal:
|
|
2768
|
+
signal: controller.signal
|
|
2533
2769
|
});
|
|
2534
2770
|
return this.recordBashResult(command, result, options), result;
|
|
2535
2771
|
} finally {
|
|
2536
|
-
this.
|
|
2772
|
+
this._bashOperations.delete(controller), this._operations.delete(completion), settle();
|
|
2537
2773
|
}
|
|
2538
2774
|
}
|
|
2539
2775
|
/**
|
|
@@ -2555,14 +2791,15 @@ ${command}` : command;
|
|
|
2555
2791
|
this.isStreaming ? this._pendingBashMessages.push(bashMessage) : (this.agent.state.messages.push(bashMessage), this.sessionManager.appendMessage(bashMessage));
|
|
2556
2792
|
}
|
|
2557
2793
|
/**
|
|
2558
|
-
* Cancel running bash
|
|
2794
|
+
* Cancel every running direct bash operation.
|
|
2559
2795
|
*/
|
|
2560
2796
|
abortBash() {
|
|
2561
|
-
this.
|
|
2797
|
+
for (let controller of this._bashOperations.keys())
|
|
2798
|
+
controller.abort();
|
|
2562
2799
|
}
|
|
2563
2800
|
/** Whether a bash command is currently running */
|
|
2564
2801
|
get isBashRunning() {
|
|
2565
|
-
return this.
|
|
2802
|
+
return this._bashOperations.size > 0;
|
|
2566
2803
|
}
|
|
2567
2804
|
/** Whether there are pending bash messages waiting to be flushed */
|
|
2568
2805
|
get hasPendingBashMessages() {
|
|
@@ -2605,6 +2842,11 @@ ${command}` : command;
|
|
|
2605
2842
|
* @returns Result with editorText (if user message) and cancelled status
|
|
2606
2843
|
*/
|
|
2607
2844
|
async navigateTree(targetId, options = {}) {
|
|
2845
|
+
if (this.assertCanStartWork(), this._branchSummaryAbortController)
|
|
2846
|
+
throw new Error("Tree navigation is already in progress.");
|
|
2847
|
+
return this._trackOperation(() => this._navigateTree(targetId, options));
|
|
2848
|
+
}
|
|
2849
|
+
async _navigateTree(targetId, options = {}) {
|
|
2608
2850
|
let oldLeafId = this.sessionManager.getLeafId();
|
|
2609
2851
|
if (targetId === oldLeafId)
|
|
2610
2852
|
return { cancelled: !1 };
|
|
@@ -2658,6 +2900,8 @@ ${command}` : command;
|
|
|
2658
2900
|
modifiedFiles: result.modifiedFiles || []
|
|
2659
2901
|
};
|
|
2660
2902
|
} else extensionSummary && (summaryText = extensionSummary.summary, summaryDetails = extensionSummary.details);
|
|
2903
|
+
if (this._branchSummaryAbortController.signal.aborted)
|
|
2904
|
+
return { cancelled: !0, aborted: !0 };
|
|
2661
2905
|
let newLeafId, editorText, editorImages;
|
|
2662
2906
|
targetEntry.type === "message" && targetEntry.message.role === "user" ? (newLeafId = targetEntry.parentId, editorText = this._extractUserMessageText(targetEntry.message.content), editorImages = this._extractUserMessageImages(targetEntry.message.content)) : targetEntry.type === "custom_message" ? (newLeafId = targetEntry.parentId, editorText = typeof targetEntry.content == "string" ? targetEntry.content : targetEntry.content.filter((c) => c.type === "text").map((c) => c.text).join("")) : newLeafId = targetId;
|
|
2663
2907
|
let summaryEntry;
|
|
@@ -2780,7 +3024,7 @@ ${command}` : command;
|
|
|
2780
3024
|
*/
|
|
2781
3025
|
async exportToHtml(outputPath) {
|
|
2782
3026
|
let [{ exportSessionToHtml }, { createToolHtmlRenderer }] = await Promise.all([
|
|
2783
|
-
import("./export-html-
|
|
3027
|
+
import("./export-html-BRWF5AHI.js"),
|
|
2784
3028
|
import("./tool-renderer-MV5O452K.js")
|
|
2785
3029
|
]), configuredThemeName = this.settingsManager.getTheme(), themeName = configuredThemeName && getThemeByName(configuredThemeName) ? configuredThemeName : void 0, toolRenderer = createToolHtmlRenderer({
|
|
2786
3030
|
getToolDefinition: (name) => this.getToolDefinition(name),
|
|
@@ -2946,13 +3190,36 @@ var AgentSessionRuntime = class {
|
|
|
2946
3190
|
_modelFallbackMessage;
|
|
2947
3191
|
detached = !1;
|
|
2948
3192
|
transferring = !1;
|
|
3193
|
+
replacement;
|
|
3194
|
+
teardown;
|
|
3195
|
+
closing = !1;
|
|
3196
|
+
async withReplacement(operation) {
|
|
3197
|
+
if (this.closing || this.replacement || this.transferring)
|
|
3198
|
+
throw new Error("Session lifecycle change is already in progress.");
|
|
3199
|
+
let promise = Promise.resolve().then(operation);
|
|
3200
|
+
this.replacement = promise;
|
|
3201
|
+
try {
|
|
3202
|
+
return await promise;
|
|
3203
|
+
} finally {
|
|
3204
|
+
this.replacement === promise && (this.replacement = void 0);
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
2949
3207
|
get isDetached() {
|
|
2950
3208
|
return this.detached;
|
|
2951
3209
|
}
|
|
3210
|
+
/** Correlated prompt entry for scheduled hosts; never queues across a lifecycle change. */
|
|
3211
|
+
promptWithCompletion(text, options) {
|
|
3212
|
+
return this.detached || this.closing || this.replacement || this.transferring ? Promise.reject(new Error("Session lifecycle change is in progress. Retry the scheduled prompt later.")) : this.session.promptWithCompletion(text, options);
|
|
3213
|
+
}
|
|
2952
3214
|
async releaseForTransfer(options = {}) {
|
|
3215
|
+
if (this.closing || this.replacement || this.transferring)
|
|
3216
|
+
throw new SessionTransferError("Session transfer is already in progress.", "busy");
|
|
3217
|
+
return this.withReplacement(() => this.releaseForTransferOwned(options));
|
|
3218
|
+
}
|
|
3219
|
+
async releaseForTransferOwned(options) {
|
|
2953
3220
|
if (options.signal?.throwIfAborted(), this.detached)
|
|
2954
3221
|
return;
|
|
2955
|
-
if (this.transferring)
|
|
3222
|
+
if (this.closing || this.transferring)
|
|
2956
3223
|
throw new SessionTransferError("Session transfer is already in progress.", "busy");
|
|
2957
3224
|
this.transferring = !0, this.session.setTransferring(!0);
|
|
2958
3225
|
let hasAttachedWork = () => getSubagentCancellation(this.session.sessionId)?.hasActiveRuns() || getSubagentCancellation(this.session.sessionFile ?? "")?.hasActiveRuns() || list().some((entry) => entry.status !== "exited" && (!entry.sessionId || entry.sessionId === this.session.sessionId)), busy = () => this.session.isStreaming || this.session.isCompacting || this.session.isBashRunning || this.session.isRetrying || this.session.pendingMessageCount > 0;
|
|
@@ -3023,12 +3290,28 @@ var AgentSessionRuntime = class {
|
|
|
3023
3290
|
...options
|
|
3024
3291
|
}))?.cancel === !0 } : { cancelled: !1 };
|
|
3025
3292
|
}
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3293
|
+
teardownCurrent(reason, targetSessionFile) {
|
|
3294
|
+
if (this.teardown)
|
|
3295
|
+
return this.teardown;
|
|
3296
|
+
if (this.detached)
|
|
3297
|
+
return Promise.resolve();
|
|
3298
|
+
let session = this.session;
|
|
3299
|
+
return session.stopAdmission(), this.teardown = (async () => {
|
|
3300
|
+
await session.drain();
|
|
3301
|
+
try {
|
|
3302
|
+
await emitSessionShutdownEvent(session.extensionRunner, {
|
|
3303
|
+
type: "session_shutdown",
|
|
3304
|
+
reason,
|
|
3305
|
+
targetSessionFile
|
|
3306
|
+
});
|
|
3307
|
+
} finally {
|
|
3308
|
+
try {
|
|
3309
|
+
this.beforeSessionInvalidate?.(reason);
|
|
3310
|
+
} finally {
|
|
3311
|
+
await session.shutdown(), this.detached = !0;
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
})(), this.teardown;
|
|
3032
3315
|
}
|
|
3033
3316
|
async teardownForReplacement(reason, sessionManager) {
|
|
3034
3317
|
try {
|
|
@@ -3038,12 +3321,15 @@ var AgentSessionRuntime = class {
|
|
|
3038
3321
|
}
|
|
3039
3322
|
}
|
|
3040
3323
|
apply(result) {
|
|
3041
|
-
this.detached = !1, this._session = result.session, this._services = result.services, this._diagnostics = result.diagnostics, this._modelFallbackMessage = result.modelFallbackMessage, this.onRuntimeApplied?.(result);
|
|
3324
|
+
this.detached = !1, this.teardown = void 0, this._session = result.session, this.closing && this._session.stopAdmission(), this._services = result.services, this._diagnostics = result.diagnostics, this._modelFallbackMessage = result.modelFallbackMessage, this.onRuntimeApplied?.(result);
|
|
3042
3325
|
}
|
|
3043
3326
|
async finishSessionReplacement(withSession) {
|
|
3044
3327
|
this.rebindSession && await this.rebindSession(this.session), withSession && await withSession(this.session.createReplacedSessionContext());
|
|
3045
3328
|
}
|
|
3046
3329
|
async switchSession(sessionPath, options) {
|
|
3330
|
+
return this.withReplacement(() => this.switchSessionOwned(sessionPath, options));
|
|
3331
|
+
}
|
|
3332
|
+
async switchSessionOwned(sessionPath, options) {
|
|
3047
3333
|
if (!this.detached && this.session.sessionFile && canonicalSessionPath(sessionPath) === canonicalSessionPath(this.session.sessionFile))
|
|
3048
3334
|
return { cancelled: !1 };
|
|
3049
3335
|
let beforeResult = this.detached ? { cancelled: !1 } : await this.emitBeforeSwitch("resume", sessionPath);
|
|
@@ -3064,6 +3350,9 @@ var AgentSessionRuntime = class {
|
|
|
3064
3350
|
})), await this.finishSessionReplacement(options?.withSession), { cancelled: !1 };
|
|
3065
3351
|
}
|
|
3066
3352
|
async newSession(options) {
|
|
3353
|
+
return this.withReplacement(() => this.newSessionOwned(options));
|
|
3354
|
+
}
|
|
3355
|
+
async newSessionOwned(options) {
|
|
3067
3356
|
let beforeResult = await this.emitBeforeSwitch("new");
|
|
3068
3357
|
if (beforeResult.cancelled)
|
|
3069
3358
|
return beforeResult;
|
|
@@ -3076,6 +3365,9 @@ var AgentSessionRuntime = class {
|
|
|
3076
3365
|
})), options?.setup && (await options.setup(this.session.sessionManager), this.session.agent.state.messages = this.session.sessionManager.buildSessionContext().messages), await this.finishSessionReplacement(options?.withSession), { cancelled: !1 };
|
|
3077
3366
|
}
|
|
3078
3367
|
async fork(entryId, options) {
|
|
3368
|
+
return this.withReplacement(() => this.forkOwned(entryId, options));
|
|
3369
|
+
}
|
|
3370
|
+
async forkOwned(entryId, options) {
|
|
3079
3371
|
let position = options?.position ?? "before";
|
|
3080
3372
|
if ((await this.emitBeforeFork(entryId, { position })).cancelled)
|
|
3081
3373
|
return { cancelled: !0 };
|
|
@@ -3132,6 +3424,9 @@ var AgentSessionRuntime = class {
|
|
|
3132
3424
|
* @throws {MissingSessionCwdError} When the imported session cwd cannot be resolved and no override is provided.
|
|
3133
3425
|
*/
|
|
3134
3426
|
async importFromJsonl(inputPath, cwdOverride) {
|
|
3427
|
+
return this.withReplacement(() => this.importFromJsonlOwned(inputPath, cwdOverride));
|
|
3428
|
+
}
|
|
3429
|
+
async importFromJsonlOwned(inputPath, cwdOverride) {
|
|
3135
3430
|
let resolvedPath = resolvePath(inputPath);
|
|
3136
3431
|
if (!existsSync4(resolvedPath))
|
|
3137
3432
|
throw new SessionImportFileNotFoundError(resolvedPath);
|
|
@@ -3163,7 +3458,8 @@ var AgentSessionRuntime = class {
|
|
|
3163
3458
|
})), await this.finishSessionReplacement(), { cancelled: !1 };
|
|
3164
3459
|
}
|
|
3165
3460
|
async dispose() {
|
|
3166
|
-
await this.
|
|
3461
|
+
this.closing = !0, this.session.stopAdmission(), this.replacement && await this.replacement.catch(() => {
|
|
3462
|
+
}), await this.teardownCurrent("quit");
|
|
3167
3463
|
}
|
|
3168
3464
|
};
|
|
3169
3465
|
async function createAgentSessionRuntime(createRuntime, options) {
|
|
@@ -3285,7 +3581,8 @@ async function createOwnedAgentSession(options) {
|
|
|
3285
3581
|
allowedToolNames,
|
|
3286
3582
|
excludedToolNames,
|
|
3287
3583
|
extensionRunnerRef,
|
|
3288
|
-
sessionStartEvent: options.sessionStartEvent
|
|
3584
|
+
sessionStartEvent: options.sessionStartEvent,
|
|
3585
|
+
permissionMode: options.permissionMode
|
|
3289
3586
|
}), extensionsResult = resourceLoader.getExtensions();
|
|
3290
3587
|
return {
|
|
3291
3588
|
session,
|
|
@@ -3377,7 +3674,8 @@ async function createAgentSessionFromServices(options) {
|
|
|
3377
3674
|
excludeTools: options.excludeTools,
|
|
3378
3675
|
noTools: options.noTools,
|
|
3379
3676
|
customTools: options.customTools,
|
|
3380
|
-
sessionStartEvent: options.sessionStartEvent
|
|
3677
|
+
sessionStartEvent: options.sessionStartEvent,
|
|
3678
|
+
permissionMode: options.permissionMode
|
|
3381
3679
|
});
|
|
3382
3680
|
}
|
|
3383
3681
|
|
|
@@ -3394,7 +3692,10 @@ export {
|
|
|
3394
3692
|
disableRollbackForSession,
|
|
3395
3693
|
beginTurn,
|
|
3396
3694
|
captureTreeChanges,
|
|
3695
|
+
getRollbackTargetUserId,
|
|
3696
|
+
getRollbackRecoveryBlockReason,
|
|
3397
3697
|
peekRollbackTurnsConsumed,
|
|
3698
|
+
commitRollbackTurn,
|
|
3398
3699
|
rollbackLastTurn,
|
|
3399
3700
|
migrateRollbackSession,
|
|
3400
3701
|
clearRollback,
|