@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
|
@@ -0,0 +1,900 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
3
|
+
import { DriverCallError } from "./adapter.js";
|
|
4
|
+
import { prepareComputerImage, screenshotDimensions } from "./image.js";
|
|
5
|
+
import { DesktopLease } from "./lease.js";
|
|
6
|
+
import { computerSchemas } from "./schemas.js";
|
|
7
|
+
export function driverData(reply) {
|
|
8
|
+
if (reply.structuredContent &&
|
|
9
|
+
typeof reply.structuredContent === "object" &&
|
|
10
|
+
!Array.isArray(reply.structuredContent))
|
|
11
|
+
return Object.fromEntries(Object.entries(reply.structuredContent));
|
|
12
|
+
if (Array.isArray(reply.content))
|
|
13
|
+
for (const item of reply.content) {
|
|
14
|
+
if (item.type !== "text" || typeof item.text !== "string")
|
|
15
|
+
continue;
|
|
16
|
+
try {
|
|
17
|
+
const value = JSON.parse(item.text);
|
|
18
|
+
if (value && typeof value === "object" && !Array.isArray(value))
|
|
19
|
+
return Object.fromEntries(Object.entries(value));
|
|
20
|
+
}
|
|
21
|
+
catch { }
|
|
22
|
+
}
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
function plainLaunchReason(reply) {
|
|
26
|
+
if (reply.structuredContent || !Array.isArray(reply.content))
|
|
27
|
+
return undefined;
|
|
28
|
+
const text = reply.content.find((item) => item.type === "text")?.text;
|
|
29
|
+
if (typeof text !== "string")
|
|
30
|
+
return undefined;
|
|
31
|
+
if (/^App name lookup for .+ is (?:temporarily unavailable|unavailable).+No app was launched;/s.test(text))
|
|
32
|
+
return "app_lookup_unavailable";
|
|
33
|
+
if (/^App .+ was not found in shell:AppsFolder or by Windows PATH\/association lookup:/s.test(text))
|
|
34
|
+
return "app_not_found";
|
|
35
|
+
if (/^Launch of .+ timed out after 15s/s.test(text))
|
|
36
|
+
return "launch_timeout_unknown";
|
|
37
|
+
if (/^(?:Failed to launch|Task error): /s.test(text))
|
|
38
|
+
return "launch_native_error_unknown";
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
export function driverRefused(reply) {
|
|
42
|
+
const data = driverData(reply);
|
|
43
|
+
const acknowledged = data.activated === true || data.success === true || data.verified === true || data.effect === "confirmed";
|
|
44
|
+
const uncertain = [data.status, data.effect].some((value) => value === "partial" || value === "unverifiable");
|
|
45
|
+
return (reply.isError === true ||
|
|
46
|
+
plainLaunchReason(reply) !== undefined ||
|
|
47
|
+
(data.refusal !== undefined && data.refusal !== null && data.refusal !== false) ||
|
|
48
|
+
(data.error !== undefined && data.error !== null && data.error !== false) ||
|
|
49
|
+
data.effect === "refused" ||
|
|
50
|
+
data.status === "refused" ||
|
|
51
|
+
data.status === "failed" ||
|
|
52
|
+
data.success === false ||
|
|
53
|
+
[
|
|
54
|
+
"window_target_mismatch",
|
|
55
|
+
"window_target_not_found",
|
|
56
|
+
"background_unavailable",
|
|
57
|
+
"foreground_unavailable",
|
|
58
|
+
"type_text_incomplete",
|
|
59
|
+
"verification_failed",
|
|
60
|
+
].includes(String(data.code)) ||
|
|
61
|
+
(data.status !== undefined &&
|
|
62
|
+
!acknowledged &&
|
|
63
|
+
!uncertain &&
|
|
64
|
+
!["ok", "success", "completed"].includes(String(data.status))) ||
|
|
65
|
+
(data.code !== undefined && data.code !== 0 && !acknowledged && !uncertain));
|
|
66
|
+
}
|
|
67
|
+
function record(value) {
|
|
68
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
69
|
+
? Object.fromEntries(Object.entries(value))
|
|
70
|
+
: {};
|
|
71
|
+
}
|
|
72
|
+
function select(data, keys) {
|
|
73
|
+
const result = {};
|
|
74
|
+
for (const key of keys) {
|
|
75
|
+
const value = data[key];
|
|
76
|
+
if (["name", "app_name", "title"].includes(key) && typeof value === "string")
|
|
77
|
+
result[key] = value.slice(0, 240);
|
|
78
|
+
else if (["active", "running", "is_on_screen", "minimized"].includes(key) && typeof value === "boolean")
|
|
79
|
+
result[key] = value;
|
|
80
|
+
else if (["pid", "window_id", "x", "y", "width", "height"].includes(key) &&
|
|
81
|
+
typeof value === "number" &&
|
|
82
|
+
Number.isSafeInteger(value))
|
|
83
|
+
result[key] = value;
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
function typingRecovery(data, text) {
|
|
88
|
+
if (typeof text !== "string")
|
|
89
|
+
return {};
|
|
90
|
+
const requested = data.requested_chars;
|
|
91
|
+
const delivered = data.delivered_chars;
|
|
92
|
+
if (typeof requested !== "number" ||
|
|
93
|
+
!Number.isSafeInteger(requested) ||
|
|
94
|
+
requested < 0 ||
|
|
95
|
+
requested > 20000 ||
|
|
96
|
+
requested !== Array.from(text).length)
|
|
97
|
+
return {};
|
|
98
|
+
const validDelivered = typeof delivered === "number" && Number.isSafeInteger(delivered) && delivered >= 0 && delivered <= requested;
|
|
99
|
+
return {
|
|
100
|
+
requested_chars: requested,
|
|
101
|
+
delivered_chars: validDelivered ? delivered : undefined,
|
|
102
|
+
retryable: validDelivered && data.retry_from_character === delivered && typeof data.retryable === "boolean"
|
|
103
|
+
? data.retryable
|
|
104
|
+
: undefined,
|
|
105
|
+
retry_from_character: validDelivered && data.retry_from_character === delivered ? delivered : undefined,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const nativeCodes = new Set([
|
|
109
|
+
"background_unavailable",
|
|
110
|
+
"background_occluded",
|
|
111
|
+
"background_uipi_blocked",
|
|
112
|
+
"window_target_mismatch",
|
|
113
|
+
"window_target_not_found",
|
|
114
|
+
"type_text_incomplete",
|
|
115
|
+
"foreground_unavailable",
|
|
116
|
+
"foreground_rejected",
|
|
117
|
+
"stale_target",
|
|
118
|
+
"target_not_found",
|
|
119
|
+
"verification_failed",
|
|
120
|
+
"tool_invocation_failed",
|
|
121
|
+
]);
|
|
122
|
+
function safeCode(value) {
|
|
123
|
+
return typeof value === "string" && nativeCodes.has(value) ? value : undefined;
|
|
124
|
+
}
|
|
125
|
+
function nativeReason(reply) {
|
|
126
|
+
const data = driverData(reply);
|
|
127
|
+
const code = safeCode(data.code) ??
|
|
128
|
+
safeCode(record(data.refusal).code) ??
|
|
129
|
+
safeCode(record(data.error).code) ??
|
|
130
|
+
safeCode(data.refusal) ??
|
|
131
|
+
safeCode(data.error);
|
|
132
|
+
if (code)
|
|
133
|
+
return code;
|
|
134
|
+
if (plainLaunchReason(reply))
|
|
135
|
+
return plainLaunchReason(reply);
|
|
136
|
+
return "native_error_unknown";
|
|
137
|
+
}
|
|
138
|
+
function outcome(reply, text) {
|
|
139
|
+
const data = driverData(reply);
|
|
140
|
+
const refused = driverRefused(reply);
|
|
141
|
+
const partial = data.effect === "partial" || data.status === "partial";
|
|
142
|
+
return {
|
|
143
|
+
phase: refused || partial ? "native_result" : "native_request",
|
|
144
|
+
code: refused || partial ? nativeReason(reply) : undefined,
|
|
145
|
+
native_code: safeCode(data.code) ?? safeCode(record(data.refusal).code) ?? safeCode(record(data.error).code),
|
|
146
|
+
status: typeof data.status === "string" &&
|
|
147
|
+
["ok", "success", "completed", "partial", "refused", "failed"].includes(data.status)
|
|
148
|
+
? data.status
|
|
149
|
+
: undefined,
|
|
150
|
+
effect: typeof data.effect === "string" && ["confirmed", "partial", "unverifiable", "refused"].includes(data.effect)
|
|
151
|
+
? data.effect
|
|
152
|
+
: undefined,
|
|
153
|
+
verified: typeof data.verified === "boolean" ? data.verified : undefined,
|
|
154
|
+
success: typeof data.success === "boolean" ? data.success : undefined,
|
|
155
|
+
activated: typeof data.activated === "boolean" ? data.activated : undefined,
|
|
156
|
+
escalation: record(data.escalation).recommended === "foreground" ? "foreground" : undefined,
|
|
157
|
+
input: partial && typingRecovery(data, text).delivered_chars !== undefined
|
|
158
|
+
? "partial"
|
|
159
|
+
: refused || partial
|
|
160
|
+
? "uncertain"
|
|
161
|
+
: "dispatched",
|
|
162
|
+
applicationEffect: "unverified",
|
|
163
|
+
...typingRecovery(data, text),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function abortable(pending, signal) {
|
|
167
|
+
return new Promise((resolve, reject) => {
|
|
168
|
+
const abort = () => {
|
|
169
|
+
signal.removeEventListener("abort", abort);
|
|
170
|
+
reject(signal.reason ?? new Error("Computer operation cancelled."));
|
|
171
|
+
};
|
|
172
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
173
|
+
pending.then((value) => {
|
|
174
|
+
signal.removeEventListener("abort", abort);
|
|
175
|
+
resolve(value);
|
|
176
|
+
}, (error) => {
|
|
177
|
+
signal.removeEventListener("abort", abort);
|
|
178
|
+
reject(error);
|
|
179
|
+
});
|
|
180
|
+
if (signal.aborted)
|
|
181
|
+
abort();
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const freshActionGuidance = "Get a fresh capture of the exact target before any next action, including window focus. Copy its token exactly. No input was sent by this call; earlier calls may have had an effect.";
|
|
185
|
+
class CaptureError extends Error {
|
|
186
|
+
code;
|
|
187
|
+
constructor(code) {
|
|
188
|
+
super(code);
|
|
189
|
+
this.code = code;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
class ObservationError extends Error {
|
|
193
|
+
code;
|
|
194
|
+
constructor(code, message) {
|
|
195
|
+
super(`Stale observation. ${message}`);
|
|
196
|
+
this.code = code;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function targetFrom(input) {
|
|
200
|
+
if (input.desktop === true) {
|
|
201
|
+
if (input.pid !== undefined || input.window_id !== undefined)
|
|
202
|
+
throw new Error("Desktop target cannot include pid/window_id.");
|
|
203
|
+
return { desktop: true };
|
|
204
|
+
}
|
|
205
|
+
if (typeof input.pid !== "number" ||
|
|
206
|
+
!Number.isInteger(input.pid) ||
|
|
207
|
+
input.pid < 1 ||
|
|
208
|
+
typeof input.window_id !== "number" ||
|
|
209
|
+
!Number.isInteger(input.window_id) ||
|
|
210
|
+
input.window_id < 1)
|
|
211
|
+
throw new Error("Window target requires positive integer pid and window_id.");
|
|
212
|
+
return { pid: input.pid, window_id: input.window_id };
|
|
213
|
+
}
|
|
214
|
+
function sameTarget(a, b) {
|
|
215
|
+
return a.desktop === true
|
|
216
|
+
? b.desktop === true
|
|
217
|
+
: b.desktop !== true && a.pid === b.pid && a.window_id === b.window_id;
|
|
218
|
+
}
|
|
219
|
+
export class ComputerWorkflow {
|
|
220
|
+
observation;
|
|
221
|
+
lastCapture;
|
|
222
|
+
lastAction;
|
|
223
|
+
abort = new AbortController();
|
|
224
|
+
closing;
|
|
225
|
+
driver;
|
|
226
|
+
lease;
|
|
227
|
+
constructor(driver, lease = new DesktopLease()) {
|
|
228
|
+
this.driver = driver;
|
|
229
|
+
this.lease = lease;
|
|
230
|
+
this.driver.setProcessObserver?.((pid) => this.lease.trackProcess(pid));
|
|
231
|
+
}
|
|
232
|
+
fresh(input, previous) {
|
|
233
|
+
if (!previous)
|
|
234
|
+
throw new ObservationError("observation_unavailable", "No active observation is available.");
|
|
235
|
+
if (previous.token !== input.observation)
|
|
236
|
+
throw new ObservationError("observation_mismatch", "Token does not match the active observation.");
|
|
237
|
+
if (!sameTarget(previous.target, targetFrom(input)))
|
|
238
|
+
throw new ObservationError("observation_target_mismatch", "Token belongs to a different target.");
|
|
239
|
+
if (Date.now() - previous.time > 30000)
|
|
240
|
+
throw new ObservationError("observation_expired", "The active observation is older than 30 seconds.");
|
|
241
|
+
return previous;
|
|
242
|
+
}
|
|
243
|
+
async capture(target, signal, previous, crop) {
|
|
244
|
+
const time = Date.now();
|
|
245
|
+
const reply = await abortable(this.driver.call(target.desktop ? "get_desktop_state" : "get_window_state", target.desktop
|
|
246
|
+
? {}
|
|
247
|
+
: {
|
|
248
|
+
pid: target.pid,
|
|
249
|
+
window_id: target.window_id,
|
|
250
|
+
include_accessibility_tree: false,
|
|
251
|
+
include_screenshot: true,
|
|
252
|
+
max_dimension: 2560,
|
|
253
|
+
}, signal), signal);
|
|
254
|
+
if (driverRefused(reply))
|
|
255
|
+
throw new CaptureError(nativeReason(reply));
|
|
256
|
+
const data = driverData(reply);
|
|
257
|
+
const images = Array.isArray(reply.content) ? reply.content.filter((item) => item.type === "image") : [];
|
|
258
|
+
if (images.length !== 1 || typeof images[0].data !== "string" || typeof images[0].mimeType !== "string")
|
|
259
|
+
throw new CaptureError("screenshot_unavailable");
|
|
260
|
+
const image = { type: "image", data: images[0].data, mimeType: images[0].mimeType };
|
|
261
|
+
let dimensions;
|
|
262
|
+
try {
|
|
263
|
+
dimensions = screenshotDimensions(image);
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
throw new CaptureError("image_decode_failed");
|
|
267
|
+
}
|
|
268
|
+
if (data.screenshot_frame_valid === false ||
|
|
269
|
+
data.screenshot_error != null ||
|
|
270
|
+
dimensions.width !== data.screenshot_width ||
|
|
271
|
+
dimensions.height !== data.screenshot_height)
|
|
272
|
+
throw new CaptureError("image_frame_invalid");
|
|
273
|
+
const geometry = JSON.stringify(select(record(data.window_bounds), ["x", "y", "width", "height"]));
|
|
274
|
+
if (crop &&
|
|
275
|
+
previous &&
|
|
276
|
+
(previous.sourceWidth !== dimensions.width ||
|
|
277
|
+
previous.sourceHeight !== dimensions.height ||
|
|
278
|
+
previous.geometry !== geometry))
|
|
279
|
+
throw new CaptureError("target_geometry_changed");
|
|
280
|
+
let prepared;
|
|
281
|
+
try {
|
|
282
|
+
prepared = await abortable(prepareComputerImage(image, crop), signal);
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
if (signal.aborted)
|
|
286
|
+
throw error;
|
|
287
|
+
throw new CaptureError("image_decode_failed");
|
|
288
|
+
}
|
|
289
|
+
signal.throwIfAborted();
|
|
290
|
+
return { ...prepared, token: randomUUID(), target, time, fingerprint: prepared.fingerprint, geometry };
|
|
291
|
+
}
|
|
292
|
+
imageResult(observation, extra = {}) {
|
|
293
|
+
this.observation = observation;
|
|
294
|
+
const { width, height, region, sourceWidth, sourceHeight, scaleX, scaleY, target, token } = observation;
|
|
295
|
+
const failed = extra.failed === true;
|
|
296
|
+
return {
|
|
297
|
+
content: [
|
|
298
|
+
{
|
|
299
|
+
type: "text",
|
|
300
|
+
text: JSON.stringify({
|
|
301
|
+
...extra,
|
|
302
|
+
observation: token,
|
|
303
|
+
target,
|
|
304
|
+
captured_at: observation.time,
|
|
305
|
+
expires_at: observation.time + 30000,
|
|
306
|
+
image: { width, height },
|
|
307
|
+
mapping: { sourceWidth, sourceHeight, ...region, scaleX, scaleY },
|
|
308
|
+
coordinates: "Use returned-image pixels; mapping is applied automatically.",
|
|
309
|
+
}),
|
|
310
|
+
},
|
|
311
|
+
observation.image,
|
|
312
|
+
],
|
|
313
|
+
details: { observation: token, computer: { failed, workflow: "ready" } },
|
|
314
|
+
isError: failed,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
crop(input, previous) {
|
|
318
|
+
const crop = record(input.crop);
|
|
319
|
+
const { x, y, width, height } = crop;
|
|
320
|
+
if (typeof x !== "number" ||
|
|
321
|
+
typeof y !== "number" ||
|
|
322
|
+
typeof width !== "number" ||
|
|
323
|
+
typeof height !== "number" ||
|
|
324
|
+
![x, y, width, height].every(Number.isFinite) ||
|
|
325
|
+
x < 0 ||
|
|
326
|
+
y < 0 ||
|
|
327
|
+
width <= 0 ||
|
|
328
|
+
height <= 0 ||
|
|
329
|
+
x + width > previous.width ||
|
|
330
|
+
y + height > previous.height ||
|
|
331
|
+
Object.keys(crop).some((key) => !["x", "y", "width", "height"].includes(key)))
|
|
332
|
+
throw new Error("Crop must fit the latest returned image.");
|
|
333
|
+
const left = Math.floor(previous.region.x + x * previous.scaleX);
|
|
334
|
+
const top = Math.floor(previous.region.y + y * previous.scaleY);
|
|
335
|
+
const right = Math.min(previous.sourceWidth, Math.ceil(previous.region.x + (x + width) * previous.scaleX));
|
|
336
|
+
const bottom = Math.min(previous.sourceHeight, Math.ceil(previous.region.y + (y + height) * previous.scaleY));
|
|
337
|
+
return { x: left, y: top, width: right - left, height: bottom - top };
|
|
338
|
+
}
|
|
339
|
+
action(name, input, previous) {
|
|
340
|
+
const args = previous.target.desktop
|
|
341
|
+
? { scope: "desktop" }
|
|
342
|
+
: { pid: previous.target.pid, window_id: previous.target.window_id };
|
|
343
|
+
if (previous.target.desktop && input.foreground !== true)
|
|
344
|
+
throw new Error("Desktop input requires foreground=true.");
|
|
345
|
+
if (name !== "computer_window" && name !== "computer_hover")
|
|
346
|
+
args.delivery_mode = input.foreground === true ? "foreground" : "background";
|
|
347
|
+
for (const key of ["x", "y", "from_x", "from_y", "to_x", "to_y"]) {
|
|
348
|
+
if (name === "computer_window")
|
|
349
|
+
break;
|
|
350
|
+
const value = input[key];
|
|
351
|
+
if (value === undefined)
|
|
352
|
+
continue;
|
|
353
|
+
const horizontal = key.endsWith("x");
|
|
354
|
+
if (typeof value !== "number" ||
|
|
355
|
+
!Number.isFinite(value) ||
|
|
356
|
+
value < 0 ||
|
|
357
|
+
value >= (horizontal ? previous.width : previous.height))
|
|
358
|
+
throw new Error("Coordinate outside the observed image.");
|
|
359
|
+
args[key] =
|
|
360
|
+
(horizontal ? previous.region.x : previous.region.y) +
|
|
361
|
+
value * (horizontal ? previous.scaleX : previous.scaleY);
|
|
362
|
+
}
|
|
363
|
+
if ((input.x === undefined) !== (input.y === undefined))
|
|
364
|
+
throw new Error("Provide a complete x/y pair.");
|
|
365
|
+
if (previous.target.desktop && ["computer_key", "computer_text"].includes(name) && input.x !== undefined)
|
|
366
|
+
throw new Error("Desktop keyboard input uses the observed focused field. Change focus with a separate grounded click.");
|
|
367
|
+
let operation;
|
|
368
|
+
switch (name) {
|
|
369
|
+
case "computer_hover":
|
|
370
|
+
if (process.platform !== "win32" ||
|
|
371
|
+
!previous.target.desktop ||
|
|
372
|
+
input.desktop !== true ||
|
|
373
|
+
input.foreground !== true ||
|
|
374
|
+
input.x === undefined ||
|
|
375
|
+
input.y === undefined)
|
|
376
|
+
throw new Error("Hover requires a Windows foreground desktop image and x/y coordinates.");
|
|
377
|
+
operation = "move_cursor";
|
|
378
|
+
break;
|
|
379
|
+
case "computer_click":
|
|
380
|
+
case "computer_scroll":
|
|
381
|
+
if (input.x === undefined || input.y === undefined)
|
|
382
|
+
throw new Error("This action requires x/y image coordinates.");
|
|
383
|
+
operation = name === "computer_click" ? "click" : "scroll";
|
|
384
|
+
for (const key of name === "computer_click"
|
|
385
|
+
? ["button", "count", "modifier"]
|
|
386
|
+
: ["direction", "amount", "by"])
|
|
387
|
+
if (input[key] !== undefined)
|
|
388
|
+
args[key] = input[key];
|
|
389
|
+
break;
|
|
390
|
+
case "computer_drag":
|
|
391
|
+
if (!["from_x", "from_y", "to_x", "to_y"].every((key) => typeof args[key] === "number"))
|
|
392
|
+
throw new Error("Drag requires both endpoints.");
|
|
393
|
+
operation = "drag";
|
|
394
|
+
break;
|
|
395
|
+
case "computer_key": {
|
|
396
|
+
if ((input.key === undefined) === (input.keys === undefined))
|
|
397
|
+
throw new Error("Provide key OR keys.");
|
|
398
|
+
const keys = Array.isArray(input.keys) ? input.keys : undefined;
|
|
399
|
+
const last = keys?.at(-1);
|
|
400
|
+
const modifiers = new Set(["ctrl", "control", "shift", "alt", "win", "windows", "cmd", "command"]);
|
|
401
|
+
const foregroundShortcut = process.platform === "win32" &&
|
|
402
|
+
input.foreground === true &&
|
|
403
|
+
input.x === undefined &&
|
|
404
|
+
keys !== undefined &&
|
|
405
|
+
keys.length >= 2 &&
|
|
406
|
+
keys.slice(0, -1).every((key) => typeof key === "string" && modifiers.has(key.toLowerCase())) &&
|
|
407
|
+
typeof last === "string" &&
|
|
408
|
+
!modifiers.has(last.toLowerCase());
|
|
409
|
+
// Pinned Windows hotkey routes XAML through UIA before honoring foreground; press_key honors SendInput.
|
|
410
|
+
operation = input.keys === undefined || foregroundShortcut ? "press_key" : "hotkey";
|
|
411
|
+
if (foregroundShortcut) {
|
|
412
|
+
args.key = last;
|
|
413
|
+
args.modifiers = keys.slice(0, -1);
|
|
414
|
+
}
|
|
415
|
+
else
|
|
416
|
+
args[input.keys === undefined ? "key" : "keys"] = input.keys ?? input.key;
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
case "computer_text":
|
|
420
|
+
operation = "type_text";
|
|
421
|
+
args.text = input.text;
|
|
422
|
+
break;
|
|
423
|
+
case "computer_window":
|
|
424
|
+
if (previous.target.desktop)
|
|
425
|
+
throw new Error("Window management requires an exact window target.");
|
|
426
|
+
if (input.action === "frame") {
|
|
427
|
+
for (const key of ["x", "y", "width", "height"]) {
|
|
428
|
+
const value = input[key];
|
|
429
|
+
if (typeof value !== "number" ||
|
|
430
|
+
!Number.isFinite(value) ||
|
|
431
|
+
(["width", "height"].includes(key) && value <= 0))
|
|
432
|
+
throw new Error("Frame requires valid x/y/width/height.");
|
|
433
|
+
args[key] = value;
|
|
434
|
+
}
|
|
435
|
+
operation = "set_window_frame";
|
|
436
|
+
}
|
|
437
|
+
else if (input.action === "focus" &&
|
|
438
|
+
["x", "y", "width", "height"].every((key) => input[key] === undefined))
|
|
439
|
+
operation = "bring_to_front";
|
|
440
|
+
else
|
|
441
|
+
throw new Error("Use frame or focus. Minimize/restore uses a fresh image click on the visible control.");
|
|
442
|
+
break;
|
|
443
|
+
default:
|
|
444
|
+
throw new Error("Unknown computer action.");
|
|
445
|
+
}
|
|
446
|
+
return { operation, args };
|
|
447
|
+
}
|
|
448
|
+
async execute(name, input, signal) {
|
|
449
|
+
const combined = AbortSignal.any([
|
|
450
|
+
this.abort.signal,
|
|
451
|
+
this.lease.signal,
|
|
452
|
+
AbortSignal.timeout(90000),
|
|
453
|
+
...(signal ? [signal] : []),
|
|
454
|
+
]);
|
|
455
|
+
let inputDispatched = false;
|
|
456
|
+
let failureCode = "workflow_unavailable";
|
|
457
|
+
let phase = "validation";
|
|
458
|
+
const currentPhase = () => phase;
|
|
459
|
+
let operationName = name;
|
|
460
|
+
let actionTarget;
|
|
461
|
+
let actionOutcome;
|
|
462
|
+
try {
|
|
463
|
+
const result = await this.lease.run(async () => {
|
|
464
|
+
failureCode = "invalid_arguments";
|
|
465
|
+
const previous = this.observation;
|
|
466
|
+
if (name !== "computer_apps")
|
|
467
|
+
this.observation = undefined;
|
|
468
|
+
if (!Object.hasOwn(computerSchemas, name))
|
|
469
|
+
throw new Error("Unknown computer operation.");
|
|
470
|
+
const schema = computerSchemas[name];
|
|
471
|
+
if (Object.keys(input).some((key) => !Object.hasOwn(schema.properties, key)))
|
|
472
|
+
throw new Error("Unsupported computer argument. Use image coordinates only.");
|
|
473
|
+
if (name === "computer_apps" || name === "computer_launch") {
|
|
474
|
+
const operation = name === "computer_launch" ? "launch_app" : input.pid === undefined ? "list_apps" : "list_windows";
|
|
475
|
+
operationName = operation;
|
|
476
|
+
if (input.include_windows !== undefined &&
|
|
477
|
+
(name !== "computer_apps" ||
|
|
478
|
+
typeof input.include_windows !== "boolean" ||
|
|
479
|
+
(input.include_windows &&
|
|
480
|
+
(input.pid !== undefined || typeof input.query !== "string" || !input.query.trim()))))
|
|
481
|
+
throw new Error("include_windows requires a named app query without pid.");
|
|
482
|
+
if (input.pid !== undefined &&
|
|
483
|
+
(typeof input.pid !== "number" || !Number.isSafeInteger(input.pid) || input.pid < 1))
|
|
484
|
+
throw new Error("Window lookup requires a positive pid.");
|
|
485
|
+
if (name === "computer_launch" &&
|
|
486
|
+
(typeof input.name !== "string" || !input.name.trim() || input.name.length > 500))
|
|
487
|
+
throw new Error("Launch requires a nonblank name.");
|
|
488
|
+
if (input.query !== undefined &&
|
|
489
|
+
(typeof input.query !== "string" || !input.query.trim() || Array.from(input.query).length > 240))
|
|
490
|
+
throw new Error("Discovery query must be a nonblank string of at most 240 characters.");
|
|
491
|
+
const query = typeof input.query === "string" ? input.query.trim() : undefined;
|
|
492
|
+
const needle = query?.toLowerCase();
|
|
493
|
+
const offset = input.offset ?? 0;
|
|
494
|
+
if (typeof offset !== "number" || !Number.isSafeInteger(offset) || offset < 0)
|
|
495
|
+
throw new Error("Discovery offset must be a nonnegative safe integer.");
|
|
496
|
+
const args = name === "computer_launch" ? { name: input.name } : input.pid === undefined ? {} : { pid: input.pid };
|
|
497
|
+
combined.throwIfAborted();
|
|
498
|
+
inputDispatched = name === "computer_launch";
|
|
499
|
+
phase = "native_request";
|
|
500
|
+
failureCode = "discovery_failed";
|
|
501
|
+
const reply = await abortable(this.driver.call(operation, args, combined), combined);
|
|
502
|
+
const data = driverData(reply);
|
|
503
|
+
const discovered = data.apps ?? data.windows;
|
|
504
|
+
const rows = Array.isArray(discovered) && needle
|
|
505
|
+
? discovered.filter((row) => {
|
|
506
|
+
const item = record(row);
|
|
507
|
+
return [item.name, item.app_name, item.title].some((value) => typeof value === "string" && value.toLowerCase().includes(needle));
|
|
508
|
+
})
|
|
509
|
+
: discovered;
|
|
510
|
+
const metadata = Array.isArray(rows)
|
|
511
|
+
? rows.slice(offset, offset + 50).map((row) => {
|
|
512
|
+
const item = record(row);
|
|
513
|
+
return {
|
|
514
|
+
...select(item, [
|
|
515
|
+
"pid",
|
|
516
|
+
"window_id",
|
|
517
|
+
"name",
|
|
518
|
+
"app_name",
|
|
519
|
+
"title",
|
|
520
|
+
"active",
|
|
521
|
+
"running",
|
|
522
|
+
"is_on_screen",
|
|
523
|
+
"minimized",
|
|
524
|
+
]),
|
|
525
|
+
bounds: item.bounds ? select(record(item.bounds), ["x", "y", "width", "height"]) : undefined,
|
|
526
|
+
};
|
|
527
|
+
})
|
|
528
|
+
: undefined;
|
|
529
|
+
const remaining = Array.isArray(rows) ? Math.max(0, rows.length - offset - (metadata?.length ?? 0)) : 0;
|
|
530
|
+
const failed = driverRefused(reply);
|
|
531
|
+
const pid = typeof data.pid === "number" && Number.isSafeInteger(data.pid) && data.pid > 0 ? data.pid : undefined;
|
|
532
|
+
const launchWindows = Array.isArray(data.windows)
|
|
533
|
+
? data.windows.slice(0, 50).map((row) => {
|
|
534
|
+
const item = record(row);
|
|
535
|
+
return {
|
|
536
|
+
...select(item, ["window_id", "title", "is_on_screen", "minimized"]),
|
|
537
|
+
bounds: item.bounds ? select(record(item.bounds), ["x", "y", "width", "height"]) : undefined,
|
|
538
|
+
};
|
|
539
|
+
})
|
|
540
|
+
: [];
|
|
541
|
+
const returnedId = data.window_id ??
|
|
542
|
+
(Array.isArray(data.windows) && data.windows.length === 1
|
|
543
|
+
? record(data.windows[0]).window_id
|
|
544
|
+
: undefined);
|
|
545
|
+
const windowId = typeof returnedId === "number" && Number.isSafeInteger(returnedId) && returnedId > 0
|
|
546
|
+
? returnedId
|
|
547
|
+
: undefined;
|
|
548
|
+
let windowsByPid;
|
|
549
|
+
let guidance = remaining
|
|
550
|
+
? "Pass next_offset as offset with the same pid and query. Lists refresh per call."
|
|
551
|
+
: input.pid !== undefined
|
|
552
|
+
? "Use computer_observe({pid,window_id}) for an exact returned window."
|
|
553
|
+
: "App query filters app identities, not every window title. Use computer_apps({pid}) to find windows for a running app.";
|
|
554
|
+
if (name === "computer_apps" && input.include_windows === true && !failed) {
|
|
555
|
+
const pids = [
|
|
556
|
+
...new Set((Array.isArray(rows) ? rows : [])
|
|
557
|
+
.map((row) => record(row).pid)
|
|
558
|
+
.filter((value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0)),
|
|
559
|
+
];
|
|
560
|
+
if (pids.length > 5)
|
|
561
|
+
guidance =
|
|
562
|
+
"More than five running processes matched. Narrow the query or choose one positive pid with computer_apps({pid}); no arbitrary process was selected.";
|
|
563
|
+
else {
|
|
564
|
+
windowsByPid = [];
|
|
565
|
+
let budget = 50;
|
|
566
|
+
for (const matchingPid of pids) {
|
|
567
|
+
combined.throwIfAborted();
|
|
568
|
+
try {
|
|
569
|
+
const windowsReply = await abortable(this.driver.call("list_windows", { pid: matchingPid }, combined), combined);
|
|
570
|
+
const windows = driverData(windowsReply).windows;
|
|
571
|
+
if (driverRefused(windowsReply) || !Array.isArray(windows)) {
|
|
572
|
+
windowsByPid.push({
|
|
573
|
+
pid: matchingPid,
|
|
574
|
+
error: driverRefused(windowsReply)
|
|
575
|
+
? nativeReason(windowsReply)
|
|
576
|
+
: "windows_unavailable",
|
|
577
|
+
});
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
const subset = windows.slice(0, budget).map((row) => {
|
|
581
|
+
const item = record(row);
|
|
582
|
+
return {
|
|
583
|
+
...select(item, [
|
|
584
|
+
"pid",
|
|
585
|
+
"window_id",
|
|
586
|
+
"name",
|
|
587
|
+
"app_name",
|
|
588
|
+
"title",
|
|
589
|
+
"active",
|
|
590
|
+
"running",
|
|
591
|
+
"is_on_screen",
|
|
592
|
+
"minimized",
|
|
593
|
+
]),
|
|
594
|
+
bounds: item.bounds
|
|
595
|
+
? select(record(item.bounds), ["x", "y", "width", "height"])
|
|
596
|
+
: undefined,
|
|
597
|
+
};
|
|
598
|
+
});
|
|
599
|
+
const omitted = windows.length - subset.length;
|
|
600
|
+
windowsByPid.push({
|
|
601
|
+
pid: matchingPid,
|
|
602
|
+
windows: subset,
|
|
603
|
+
omitted: omitted || undefined,
|
|
604
|
+
next_offset: omitted ? subset.length : undefined,
|
|
605
|
+
});
|
|
606
|
+
budget -= subset.length;
|
|
607
|
+
}
|
|
608
|
+
catch (error) {
|
|
609
|
+
if (combined.aborted)
|
|
610
|
+
throw error;
|
|
611
|
+
if (error instanceof DriverCallError)
|
|
612
|
+
throw error;
|
|
613
|
+
windowsByPid.push({ pid: matchingPid, error: "window_lookup_failed" });
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
guidance =
|
|
617
|
+
"Use computer_observe({pid,window_id}) for a returned window. For omitted windows use computer_apps({pid,offset:next_offset}). Per-PID failures need a targeted lookup.";
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
if (name === "computer_launch")
|
|
621
|
+
guidance =
|
|
622
|
+
pid && windowId && !failed
|
|
623
|
+
? `Use computer_observe({pid:${pid},window_id:${windowId}}) before input.`
|
|
624
|
+
: `Launch ${failed ? "may have completed despite an unsuccessful reply" : "returned no exact window"}. Use computer_apps({${pid ? `pid:${pid}` : `query:${JSON.stringify(input.name)}`}}) before another launch or input.`;
|
|
625
|
+
return {
|
|
626
|
+
content: [
|
|
627
|
+
{
|
|
628
|
+
type: "text",
|
|
629
|
+
text: JSON.stringify({
|
|
630
|
+
kind: name === "computer_launch" ? "launch" : input.pid === undefined ? "apps" : "windows",
|
|
631
|
+
operation,
|
|
632
|
+
...(name === "computer_launch"
|
|
633
|
+
? outcome(reply)
|
|
634
|
+
: { phase: "native_result", code: failed ? nativeReason(reply) : undefined }),
|
|
635
|
+
input: name === "computer_launch" ? "not_applicable" : undefined,
|
|
636
|
+
launch: name === "computer_launch"
|
|
637
|
+
? plainLaunchReason(reply) === "app_lookup_unavailable"
|
|
638
|
+
? "not_started"
|
|
639
|
+
: failed
|
|
640
|
+
? "completion_uncertain"
|
|
641
|
+
: "acknowledged"
|
|
642
|
+
: undefined,
|
|
643
|
+
...select(data, ["pid", "window_id", "name", "title"]),
|
|
644
|
+
window_id: name === "computer_launch" ? windowId : select(data, ["window_id"]).window_id,
|
|
645
|
+
windows: name === "computer_launch" ? launchWindows : undefined,
|
|
646
|
+
items: name === "computer_launch" ? undefined : metadata,
|
|
647
|
+
windows_by_pid: windowsByPid,
|
|
648
|
+
query,
|
|
649
|
+
offset,
|
|
650
|
+
total: Array.isArray(rows) ? rows.length : undefined,
|
|
651
|
+
omitted: remaining || undefined,
|
|
652
|
+
next_offset: remaining ? offset + 50 : undefined,
|
|
653
|
+
guidance,
|
|
654
|
+
}),
|
|
655
|
+
},
|
|
656
|
+
],
|
|
657
|
+
details: { computer: { failed, workflow: "ready" } },
|
|
658
|
+
isError: failed,
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
const target = targetFrom(input);
|
|
662
|
+
actionTarget = target;
|
|
663
|
+
if (name === "computer_observe") {
|
|
664
|
+
phase = "observation_capture";
|
|
665
|
+
const crop = input.crop === undefined ? undefined : this.crop(input, this.fresh(input, previous));
|
|
666
|
+
failureCode = "capture_failed";
|
|
667
|
+
const captured = await this.capture(target, combined, previous, crop);
|
|
668
|
+
const unchanged = this.lastCapture?.fingerprint === captured.fingerprint && sameTarget(this.lastCapture.target, target);
|
|
669
|
+
const repeats = crop ? 0 : unchanged ? (this.lastCapture?.repeats ?? 0) + 1 : 1;
|
|
670
|
+
this.lastCapture = { fingerprint: captured.fingerprint, target, repeats };
|
|
671
|
+
if (repeats >= 3)
|
|
672
|
+
return {
|
|
673
|
+
content: [
|
|
674
|
+
{
|
|
675
|
+
type: "text",
|
|
676
|
+
text: JSON.stringify({
|
|
677
|
+
phase: "observation_capture",
|
|
678
|
+
code: "unchanged_polling_limit",
|
|
679
|
+
guidance: "Three captures are unchanged. Stop polling and reconsider the target or approach. No input token issued.",
|
|
680
|
+
}),
|
|
681
|
+
},
|
|
682
|
+
],
|
|
683
|
+
details: { computer: { failed: true, workflow: "stopped" } },
|
|
684
|
+
isError: true,
|
|
685
|
+
};
|
|
686
|
+
return this.imageResult(captured, { unchanged });
|
|
687
|
+
}
|
|
688
|
+
const grounded = this.fresh(input, previous);
|
|
689
|
+
const { operation, args } = this.action(name, input, grounded);
|
|
690
|
+
const { button = "left", count = 1, modifier = [], ...clickArgs } = args;
|
|
691
|
+
const signature = JSON.stringify({
|
|
692
|
+
operation,
|
|
693
|
+
args: operation === "click"
|
|
694
|
+
? {
|
|
695
|
+
...clickArgs,
|
|
696
|
+
button,
|
|
697
|
+
count,
|
|
698
|
+
modifier: Array.isArray(modifier) ? [...new Set(modifier)].sort() : modifier,
|
|
699
|
+
}
|
|
700
|
+
: args,
|
|
701
|
+
});
|
|
702
|
+
if (this.lastAction?.unchanged &&
|
|
703
|
+
this.lastAction.signature === signature &&
|
|
704
|
+
this.lastAction.fingerprint === grounded.fingerprint)
|
|
705
|
+
throw new Error("The identical action had no visible change. Choose a different grounded action; never retry blindly.");
|
|
706
|
+
combined.throwIfAborted();
|
|
707
|
+
inputDispatched = true;
|
|
708
|
+
phase = "native_request";
|
|
709
|
+
operationName = operation;
|
|
710
|
+
const reply = await abortable(this.driver.call(operation, args, combined), combined);
|
|
711
|
+
combined.throwIfAborted();
|
|
712
|
+
actionOutcome = outcome(reply, name === "computer_text" ? input.text : undefined);
|
|
713
|
+
const recoveryGuidance = actionOutcome.retry_from_character !== undefined
|
|
714
|
+
? "Verify the field in a fresh image before considering any remaining suffix. retry_from_character is a zero-based Unicode code-point offset, not UTF-16. retryable is driver advice, not authorization to retry."
|
|
715
|
+
: undefined;
|
|
716
|
+
const failed = driverRefused(reply) || driverData(reply).effect === "partial" || driverData(reply).status === "partial";
|
|
717
|
+
const backgroundUnavailable = actionOutcome.code === "background_unavailable";
|
|
718
|
+
if (name === "computer_hover")
|
|
719
|
+
await delay(700, undefined, { signal: combined });
|
|
720
|
+
phase = "post_action_capture";
|
|
721
|
+
try {
|
|
722
|
+
const after = await this.capture(target, combined);
|
|
723
|
+
const unchanged = after.fingerprint === grounded.fingerprint;
|
|
724
|
+
this.lastAction = { signature, fingerprint: after.fingerprint, unchanged };
|
|
725
|
+
this.lastCapture = {
|
|
726
|
+
fingerprint: after.fingerprint,
|
|
727
|
+
target,
|
|
728
|
+
repeats: failed &&
|
|
729
|
+
this.lastCapture?.fingerprint === after.fingerprint &&
|
|
730
|
+
sameTarget(this.lastCapture.target, target)
|
|
731
|
+
? this.lastCapture.repeats
|
|
732
|
+
: 0,
|
|
733
|
+
};
|
|
734
|
+
return this.imageResult(after, {
|
|
735
|
+
kind: "action",
|
|
736
|
+
operation,
|
|
737
|
+
target,
|
|
738
|
+
...actionOutcome,
|
|
739
|
+
failed,
|
|
740
|
+
unchanged,
|
|
741
|
+
guidance: [
|
|
742
|
+
"Inspect the post-action image before another action. No visible change does not prove failure; never repeat blindly.",
|
|
743
|
+
backgroundUnavailable
|
|
744
|
+
? "After this fresh capture, foreground input may be considered if permitted, not another background shortcut."
|
|
745
|
+
: undefined,
|
|
746
|
+
recoveryGuidance,
|
|
747
|
+
]
|
|
748
|
+
.filter(Boolean)
|
|
749
|
+
.join(" "),
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
catch (error) {
|
|
753
|
+
combined.throwIfAborted();
|
|
754
|
+
if (!(error instanceof CaptureError))
|
|
755
|
+
throw error;
|
|
756
|
+
this.lastAction = { signature, fingerprint: grounded.fingerprint, unchanged: true };
|
|
757
|
+
return {
|
|
758
|
+
content: [
|
|
759
|
+
{
|
|
760
|
+
type: "text",
|
|
761
|
+
text: JSON.stringify({
|
|
762
|
+
kind: "action",
|
|
763
|
+
operation,
|
|
764
|
+
target,
|
|
765
|
+
...actionOutcome,
|
|
766
|
+
phase: "post_action_capture",
|
|
767
|
+
capture_error: error.code,
|
|
768
|
+
observation: "unavailable",
|
|
769
|
+
guidance: `Input may have taken effect. ${["target_not_found", "window_target_not_found", "window_target_mismatch"].includes(error.code)
|
|
770
|
+
? "Use computer_apps({pid}) or observe the desktop to find the target."
|
|
771
|
+
: "Get a fresh capture of the exact target"} before another action; never repeat blindly. ${recoveryGuidance ?? ""}`,
|
|
772
|
+
}),
|
|
773
|
+
},
|
|
774
|
+
],
|
|
775
|
+
details: { computer: { failed: true, workflow: "ready" } },
|
|
776
|
+
isError: true,
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
}, combined);
|
|
780
|
+
if (result.details.computer.workflow !== "ready")
|
|
781
|
+
return this.finish(result);
|
|
782
|
+
return result;
|
|
783
|
+
}
|
|
784
|
+
catch (error) {
|
|
785
|
+
if (error instanceof DriverCallError && !(currentPhase() === "post_action_capture" && actionOutcome)) {
|
|
786
|
+
phase = error.phase;
|
|
787
|
+
inputDispatched = error.dispatched;
|
|
788
|
+
}
|
|
789
|
+
const failurePhase = currentPhase();
|
|
790
|
+
const fatal = combined.aborted ||
|
|
791
|
+
this.abort.signal.aborted ||
|
|
792
|
+
this.lease.signal.aborted ||
|
|
793
|
+
error instanceof DriverCallError ||
|
|
794
|
+
!(error instanceof ObservationError ||
|
|
795
|
+
error instanceof CaptureError ||
|
|
796
|
+
failurePhase === "validation" ||
|
|
797
|
+
(failurePhase === "observation_capture" && !inputDispatched));
|
|
798
|
+
const code = error instanceof ObservationError || error instanceof CaptureError
|
|
799
|
+
? error.code
|
|
800
|
+
: inputDispatched && failurePhase === "post_action_capture"
|
|
801
|
+
? "capture_transport_failed"
|
|
802
|
+
: error instanceof DriverCallError
|
|
803
|
+
? error.dispatched
|
|
804
|
+
? "input_dispatch_failed"
|
|
805
|
+
: "adapter_preflight_failed"
|
|
806
|
+
: inputDispatched
|
|
807
|
+
? "input_dispatch_failed"
|
|
808
|
+
: failurePhase === "validation"
|
|
809
|
+
? "invalid_arguments"
|
|
810
|
+
: failureCode;
|
|
811
|
+
const message = name === "computer_launch"
|
|
812
|
+
? inputDispatched
|
|
813
|
+
? "Launch request began; activation may have occurred."
|
|
814
|
+
: "No launch request was sent by this call."
|
|
815
|
+
: inputDispatched
|
|
816
|
+
? "Input may have taken effect; request began."
|
|
817
|
+
: "No input was sent by this call.";
|
|
818
|
+
const guidance = inputDispatched
|
|
819
|
+
? name === "computer_launch"
|
|
820
|
+
? `Use computer_apps({query:${JSON.stringify(input.name)}) before considering another launch.`
|
|
821
|
+
: `Get a fresh capture of the exact target before another action. Input may have taken effect; inspect the field before deciding and never repeat blindly. ${actionOutcome?.retry_from_character !== undefined ? "Verify the field in a fresh image before considering any remaining suffix. retry_from_character is a zero-based Unicode code-point offset, not UTF-16." : ""}`
|
|
822
|
+
: freshActionGuidance;
|
|
823
|
+
const result = {
|
|
824
|
+
content: [
|
|
825
|
+
{
|
|
826
|
+
type: "text",
|
|
827
|
+
text: JSON.stringify({
|
|
828
|
+
kind: name === "computer_apps"
|
|
829
|
+
? "apps"
|
|
830
|
+
: name === "computer_launch"
|
|
831
|
+
? "launch"
|
|
832
|
+
: name === "computer_observe"
|
|
833
|
+
? "observation"
|
|
834
|
+
: "action",
|
|
835
|
+
operation: operationName,
|
|
836
|
+
target: actionTarget,
|
|
837
|
+
...actionOutcome,
|
|
838
|
+
action_outcome: actionOutcome,
|
|
839
|
+
phase: failurePhase,
|
|
840
|
+
code,
|
|
841
|
+
input: name === "computer_apps"
|
|
842
|
+
? undefined
|
|
843
|
+
: name === "computer_launch"
|
|
844
|
+
? "not_applicable"
|
|
845
|
+
: inputDispatched
|
|
846
|
+
? "uncertain"
|
|
847
|
+
: "not_dispatched",
|
|
848
|
+
request: name === "computer_launch" ? (inputDispatched ? "sent" : "not_sent") : undefined,
|
|
849
|
+
applicationEffect: "unverified",
|
|
850
|
+
observation: "unavailable",
|
|
851
|
+
capture_error: failurePhase === "post_action_capture" ? code : undefined,
|
|
852
|
+
message,
|
|
853
|
+
guidance,
|
|
854
|
+
}),
|
|
855
|
+
},
|
|
856
|
+
],
|
|
857
|
+
details: { computer: { failed: true, workflow: fatal ? "stopped" : "ready" } },
|
|
858
|
+
isError: true,
|
|
859
|
+
};
|
|
860
|
+
return fatal ? this.finish(result) : result;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
async finish(result) {
|
|
864
|
+
try {
|
|
865
|
+
await this.close();
|
|
866
|
+
return {
|
|
867
|
+
...result,
|
|
868
|
+
details: { ...result.details, computer: { failed: result.details.computer.failed, workflow: "stopped" } },
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
catch {
|
|
872
|
+
return {
|
|
873
|
+
content: [
|
|
874
|
+
...result.content,
|
|
875
|
+
{
|
|
876
|
+
type: "text",
|
|
877
|
+
text: JSON.stringify({
|
|
878
|
+
phase: "cleanup",
|
|
879
|
+
cleanup: "unconfirmed",
|
|
880
|
+
guidance: "Desktop ownership retained until shutdown is confirmed.",
|
|
881
|
+
}),
|
|
882
|
+
},
|
|
883
|
+
],
|
|
884
|
+
details: { ...result.details, computer: { failed: true, workflow: "cleanup_unconfirmed" } },
|
|
885
|
+
isError: true,
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
close() {
|
|
890
|
+
this.abort.abort();
|
|
891
|
+
this.observation = undefined;
|
|
892
|
+
this.closing ??= this.stop();
|
|
893
|
+
return this.closing;
|
|
894
|
+
}
|
|
895
|
+
async stop() {
|
|
896
|
+
await this.driver.close();
|
|
897
|
+
await this.lease.close();
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
//# sourceMappingURL=workflow.js.map
|