eve 0.65.0 → 0.66.0
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 +23 -0
- package/README.md +1 -2
- package/dist/src/_virtual/_rolldown/runtime.js +1 -1
- package/dist/src/chunks/{use-eve-agent-BIouJCii.js → use-eve-agent-BUeSjwIk.js} +242 -1
- package/dist/src/chunks/{use-eve-agent-BRvEh9sO.js → use-eve-agent-ydPlURM4.js} +242 -1
- package/dist/src/cli/dev/tui/argument-typeahead.d.ts +36 -0
- package/dist/src/cli/dev/tui/argument-typeahead.js +2 -0
- package/dist/src/cli/dev/tui/blocks.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +3 -0
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +2 -8
- package/dist/src/cli/dev/tui/setup-commands.js +1 -2
- package/dist/src/cli/dev/tui/setup-flow.d.ts +0 -3
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +3 -0
- package/dist/src/cli/dev/tui/terminal-renderer.js +10 -11
- package/dist/src/cli/dev/tui/test/fake-setup-flow-renderer.js +1 -1
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/dev/tui/vercel-trusted-sources-policy.d.ts +1 -1
- package/dist/src/cli/dev/tui/vercel-trusted-sources.js +1 -1
- package/dist/src/cli/invoke/result.d.ts +1 -1
- package/dist/src/cli/invoke/result.js +1 -1
- package/dist/src/cli/telemetry/preference.js +1 -1
- package/dist/src/client/index.d.ts +1 -3
- package/dist/src/client/index.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +4 -2
- package/dist/src/compiled/@agentclientprotocol/sdk/index.js +2 -51
- package/dist/src/compiled/@ai-sdk/anthropic/index.js +2 -2
- package/dist/src/compiled/@ai-sdk/google/index.js +7 -7
- package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/openai/index.js +4 -4
- package/dist/src/compiled/@ai-sdk/otel/index.js +1 -1
- package/dist/src/compiled/@cfworker/json-schema/index.d.ts +18 -0
- package/dist/src/compiled/@cfworker/json-schema/index.js +2 -0
- package/dist/src/compiled/@modelcontextprotocol/server/index.js +9 -58
- package/dist/src/compiled/@opentelemetry/api/index.js +1 -1
- package/dist/src/compiled/@opentelemetry/otlp-transformer/index.js +1 -1
- package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +55 -55
- package/dist/src/compiled/@vercel/blob/index.js +14 -36
- package/dist/src/compiled/@vercel/oidc/index.js +6 -28
- package/dist/src/compiled/@vercel/otel/index.js +1 -1
- package/dist/src/compiled/@vercel/sandbox/index.js +13 -13
- package/dist/src/compiled/@vercel/sdk/LICENSE +201 -0
- package/dist/src/compiled/@vercel/sdk/index.d.ts +41 -0
- package/dist/src/compiled/@vercel/sdk/index.js +1 -0
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +2 -2
- package/dist/src/compiled/@workflow/core/serialization.js +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +16 -16
- package/dist/src/compiled/_chunks/client/core-CspsxXR-.js +52 -0
- package/dist/src/compiled/_chunks/client/rolldown-runtime-DK3Fl9T5.js +1 -0
- package/dist/src/compiled/_chunks/node/auth-Dztlx9pE.js +2 -0
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-DFx4eluc.js → attribute-changes-89Nwz7XW.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{chunk-5MU5Z6L3-CrYztnvh.js → chunk-5MU5Z6L3-z9-dfnHp.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{chunk-NWCAEW5Y-ClfmNvkQ.js → chunk-NWCAEW5Y-8afLJrun.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{dist-C3919PVU.js → dist-C3ZE62yI.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/dist-CNT2vjZ4.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{dist-xTushGCp.js → dist-DtXwQbZr.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{esm-DyLz8Egm.js → esm-DtrPCf49.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{experimental-evaluation-D8_K_Pe9.js → experimental-evaluation-Dm32egEG.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/frames-DnrfSd1P.js +3 -0
- package/dist/src/compiled/_chunks/workflow/{functions-C06vHfWP.js → functions-DpZiBxgQ.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{getMachineId-bsd-WEBNKY2R-DcIEvZzd.js → getMachineId-bsd-WEBNKY2R-D5OkV-EY.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{getMachineId-darwin-LT47KAXP-C4nRhfn9.js → getMachineId-darwin-LT47KAXP-BqwKrkSO.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{getMachineId-linux-LTVQO6VW-BqQf2T4W.js → getMachineId-linux-LTVQO6VW-CJlbJ4KP.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{getMachineId-unsupported-UKWBA27G-oYffWhib.js → getMachineId-unsupported-UKWBA27G-C4Y3-LZG.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{getMachineId-win-NLJKOPY6-CpL96LtN.js → getMachineId-win-NLJKOPY6-CsPs71SE.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{global-DFW-hO6M.js → global-DIlFoH2w.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{helpers-Bw52uyzw.js → helpers-k3zcudWr.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{logger-DFNCa8Nl.js → logger-Bzc8jWWj.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-BmJ263ZR.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{rolldown-runtime-DPpTSio4.js → rolldown-runtime-B_knIduE.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{run-BT6SQv5f.js → run-NLvREued.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{serialization-Cl0SYU0I.js → serialization-HCDeQWcR.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/{signal-exit-B9U6kH7R.js → signal-exit-DZKTacNU.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/sleep-Bi508qmg.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{token-CrFhCmWs.js → token-1wSBbi5N.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{token-U5XEWlVM.js → token-BhlnqoHM.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{token-util-BkqzD0OM.js → token-util-Cm4Ec1Bg.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/token-util-DaeRTzDa.js +5 -0
- package/dist/src/compiled/_chunks/workflow/{wait-until-Dzhr6tzf.js → wait-until-DXLZx3tU.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{wrapper-CKui_eTd.js → wrapper-CzrF_dmI.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/ws-transport-BSM_Cl7a.js +1 -0
- package/dist/src/compiled/jose/index.js +1 -1
- package/dist/src/compiled/zod/index.js +1 -51
- package/dist/src/compiled/zod/v3.js +1 -0
- package/dist/src/compiled/zod/v4/core.js +1 -0
- package/dist/src/compiled/zod-validation-error/index.js +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +20 -14
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/context/build-base-tool-context.js +1 -1
- package/dist/src/context/build-callback-context.js +1 -1
- package/dist/src/context/dynamic-skill-lifecycle.d.ts +3 -3
- package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +18 -4
- package/dist/src/context/keys.js +1 -1
- package/dist/src/context/session-context.d.ts +5 -4
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-templates.d.ts +6 -0
- package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker.d.ts +6 -2
- package/dist/src/execution/sandbox/bindings/docker.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.d.ts +2 -2
- package/dist/src/execution/sandbox/bindings/just-bash.d.ts +2 -2
- package/dist/src/execution/sandbox/bindings/local-provider-utils.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.d.ts +7 -2
- package/dist/src/execution/sandbox/bindings/microsandbox.d.ts +6 -2
- package/dist/src/execution/sandbox/bindings/vercel.d.ts +6 -3
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/sandbox/ensure.js +1 -1
- package/dist/src/execution/sandbox/logging-session.js +2 -2
- package/dist/src/execution/sandbox/provider-host.js +1 -1
- package/dist/src/execution/sandbox/session.d.ts +5 -2
- package/dist/src/execution/sandbox/session.js +1 -1
- package/dist/src/execution/session/event-sink.d.ts +7 -13
- package/dist/src/execution/session/event-sink.js +1 -1
- package/dist/src/execution/session/handoff.d.ts +2 -2
- package/dist/src/execution/session/handoff.js +1 -1
- package/dist/src/execution/session/turn-step.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/skills/instructions.d.ts +6 -8
- package/dist/src/execution/skills/instructions.js +2 -2
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/tools/agent-router.d.ts +1 -2
- package/dist/src/execution/tools/agent-router.js +1 -1
- package/dist/src/execution/tools/ask-question-workflow.js +1 -1
- package/dist/src/execution/tools/ask-question.d.ts +17 -18
- package/dist/src/execution/tools/ask-question.js +2 -2
- package/dist/src/execution/tools/connection-search.js +1 -1
- package/dist/src/execution/tools/load-skill.d.ts +9 -5
- package/dist/src/execution/tools/load-skill.js +1 -1
- package/dist/src/execution/tools/sleep-workflow.js +1 -1
- package/dist/src/execution/tools/sleep.d.ts +8 -9
- package/dist/src/execution/tools/sleep.js +1 -1
- package/dist/src/execution/tools/subagent/emit-event-step.d.ts +2 -1
- package/dist/src/execution/tools/subagent/emit-event-step.js +1 -1
- package/dist/src/execution/tools/subagent/task-agent-requests.js +1 -1
- package/dist/src/execution/tools/workflow/body.js +1 -1
- package/dist/src/extensions/code/extension/extension.d.ts +57 -0
- package/dist/src/extensions/code/extension/extension.js +1 -0
- package/dist/src/extensions/code/extension/hooks/authenticate.d.ts +2 -0
- package/dist/src/extensions/code/extension/hooks/authenticate.js +1 -0
- package/dist/src/extensions/code/extension/instructions.md +87 -0
- package/dist/src/extensions/code/extension/lib/command-failure.d.ts +7 -0
- package/dist/src/extensions/code/extension/lib/command-failure.js +2 -0
- package/dist/src/extensions/code/extension/lib/computer-use-driver-source.d.ts +14 -0
- package/dist/src/extensions/code/extension/lib/computer-use-driver-source.js +1309 -0
- package/dist/src/extensions/code/extension/lib/computer-use-sandbox.d.ts +9 -0
- package/dist/src/extensions/code/extension/lib/computer-use-sandbox.js +120 -0
- package/dist/src/extensions/code/extension/lib/computer-use.d.ts +36 -0
- package/dist/src/extensions/code/extension/lib/computer-use.js +78 -0
- package/dist/src/extensions/code/extension/lib/connect-authentication.d.ts +7 -0
- package/dist/src/extensions/code/extension/lib/connect-authentication.js +1 -0
- package/dist/src/extensions/code/extension/lib/credentials.d.ts +13 -0
- package/dist/src/extensions/code/extension/lib/credentials.js +3 -0
- package/dist/src/extensions/code/extension/lib/diagnostics.d.ts +30 -0
- package/dist/src/extensions/code/extension/lib/diagnostics.js +6 -0
- package/dist/src/extensions/code/extension/lib/generated-paths.d.ts +18 -0
- package/dist/src/extensions/code/extension/lib/generated-paths.js +2 -0
- package/dist/src/extensions/code/extension/lib/github-shell-schema.d.ts +11 -0
- package/dist/src/extensions/code/extension/lib/github-shell-schema.js +1 -0
- package/dist/src/extensions/code/extension/lib/github-shell.d.ts +53 -0
- package/dist/src/extensions/code/extension/lib/github-shell.js +1 -0
- package/dist/src/extensions/code/extension/lib/grep-search.d.ts +61 -0
- package/dist/src/extensions/code/extension/lib/grep-search.js +6 -0
- package/dist/src/extensions/code/extension/lib/guidelines.d.ts +25 -0
- package/dist/src/extensions/code/extension/lib/guidelines.js +2 -0
- package/dist/src/extensions/code/extension/lib/patch.d.ts +35 -0
- package/dist/src/extensions/code/extension/lib/patch.js +20 -0
- package/dist/src/extensions/code/extension/lib/prwatch-github.d.ts +70 -0
- package/dist/src/extensions/code/extension/lib/prwatch-github.js +1 -0
- package/dist/src/extensions/code/extension/lib/prwatch-registry.d.ts +27 -0
- package/dist/src/extensions/code/extension/lib/prwatch-registry.js +1 -0
- package/dist/src/extensions/code/extension/lib/prwatch.d.ts +2 -0
- package/dist/src/extensions/code/extension/lib/prwatch.js +1 -0
- package/dist/src/extensions/code/extension/lib/repository-root.d.ts +4 -0
- package/dist/src/extensions/code/extension/lib/repository-root.js +1 -0
- package/dist/src/extensions/code/extension/lib/sandbox.d.ts +12 -0
- package/dist/src/extensions/code/extension/lib/sandbox.js +2 -0
- package/dist/src/extensions/code/extension/lib/shell.d.ts +1 -0
- package/dist/src/extensions/code/extension/lib/shell.js +1 -0
- package/dist/src/extensions/code/extension/lib/signed-commit.d.ts +2 -0
- package/dist/src/extensions/code/extension/lib/signed-commit.js +130 -0
- package/dist/src/extensions/code/extension/lib/tooling.d.ts +27 -0
- package/dist/src/extensions/code/extension/lib/tooling.js +92 -0
- package/dist/src/extensions/code/extension/skills/investigate/SKILL.md +30 -0
- package/dist/src/extensions/code/extension/skills/lookup-agent-run/SKILL.md +29 -0
- package/dist/src/extensions/code/extension/skills/pr/SKILL.md +53 -0
- package/dist/src/extensions/code/extension/skills/review/SKILL.md +21 -0
- package/dist/src/extensions/code/extension/subagents/worker/agent.d.ts +17 -0
- package/dist/src/extensions/code/extension/subagents/worker/agent.js +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/instructions.md +20 -0
- package/dist/src/extensions/code/extension/subagents/worker/sandbox.d.ts +2 -0
- package/dist/src/extensions/code/extension/subagents/worker/sandbox.js +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/glob.d.ts +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/glob.js +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/grep.d.ts +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/grep.js +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/load_skill.d.ts +2 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/load_skill.js +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/read_file.d.ts +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/read_file.js +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/web_fetch.d.ts +2 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/web_fetch.js +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/web_search.d.ts +2 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/web_search.js +1 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/write_file.d.ts +2 -0
- package/dist/src/extensions/code/extension/subagents/worker/tools/write_file.js +1 -0
- package/dist/src/extensions/code/extension/tools/apply_patch.d.ts +28 -0
- package/dist/src/extensions/code/extension/tools/apply_patch.js +2 -0
- package/dist/src/extensions/code/extension/tools/computer_use.d.ts +400 -0
- package/dist/src/extensions/code/extension/tools/computer_use.js +1 -0
- package/dist/src/extensions/code/extension/tools/gh.d.ts +27 -0
- package/dist/src/extensions/code/extension/tools/gh.js +1 -0
- package/dist/src/extensions/code/extension/tools/grep.d.ts +28 -0
- package/dist/src/extensions/code/extension/tools/grep.js +1 -0
- package/dist/src/extensions/code/tools.d.ts +4 -0
- package/dist/src/extensions/code/tools.js +1 -0
- package/dist/src/harness/compaction.js +1 -1
- package/dist/src/harness/final-output.js +1 -1
- package/dist/src/harness/input-extraction.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/internal/application/optional-package-import.d.ts +9 -0
- package/dist/src/internal/application/optional-package-import.js +1 -0
- package/dist/src/internal/application/optional-package-install.d.ts +1 -5
- package/dist/src/internal/application/optional-package-install.js +2 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.7/node_modules/@vercel/cli-config/dist/index.js +21 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/envpath.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errors.js +2 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errutils.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/exec.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/fsutils.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/index.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/lookup.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/safety.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_37d5e4f23f0f03cba2e0819e67e81b38/node_modules/@vercel/connect/dist/authorization.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_37d5e4f23f0f03cba2e0819e67e81b38/node_modules/@vercel/connect/dist/connector.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_37d5e4f23f0f03cba2e0819e67e81b38/node_modules/@vercel/connect/dist/index.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_37d5e4f23f0f03cba2e0819e67e81b38/node_modules/@vercel/connect/dist/installation.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_37d5e4f23f0f03cba2e0819e67e81b38/node_modules/@vercel/connect/dist/internal/base-url.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_37d5e4f23f0f03cba2e0819e67e81b38/node_modules/@vercel/connect/dist/internal/default-scopes.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_37d5e4f23f0f03cba2e0819e67e81b38/node_modules/@vercel/connect/dist/internal/env.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_37d5e4f23f0f03cba2e0819e67e81b38/node_modules/@vercel/connect/dist/internal/url-validation.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_37d5e4f23f0f03cba2e0819e67e81b38/node_modules/@vercel/connect/dist/token.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/auth-errors.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/get-context.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js +2 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/index.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/oauth.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/token-error.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/token-io.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/token-util.js +2 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/token.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.8/node_modules/@vercel/oidc/dist/version.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js +1 -0
- package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/command.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/error.js +2 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/kill.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/promise.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stdio.js +1 -0
- package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stream.js +1 -0
- package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js +1 -0
- package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js +1 -0
- package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/core.js +1 -0
- package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/main.js +1 -0
- package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/realtime.js +1 -0
- package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/signals.js +1 -0
- package/dist/src/node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js +1 -0
- package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js +1 -0
- package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js +1 -0
- package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/index.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/decrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/encrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/decrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/encrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/decrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/encrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/embedded.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/thumbprint.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/local.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/remote.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/sign.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/verify.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/sign.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/verify.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/sign.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/verify.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/decrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/encrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/produce.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/sign.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/unsecured.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/verify.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/export.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_key_pair.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_secret.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/import.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/aesgcmkw.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/buffer_utils.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/cek.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_iv_length.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_key_type.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_p2s.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/crypto_key.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/decrypt_key_management.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/encrypt_key_management.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/epoch.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/invalid_key_input.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_disjoint.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_jwk.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_object.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/iv.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/jwt_claims_set.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/private_symbols.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/secs.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_algorithms.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_crit.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/aeskw.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/asn1.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/base64url.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/cbc_tag.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_cek_length.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_key_length.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ciphers.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/decrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/digest.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/dsa_digest.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ecdhes.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/encrypt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/generate.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_named_curve.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_sign_verify_key.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/hmac_digest.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_like.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_object.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/jwk_to_key.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/key_to_jwk.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/node_key.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/normalize_key.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/pbes2kw.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/random.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/rsaes.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/runtime.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/sign.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/timing_safe_equal.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/verify.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/webcrypto.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/base64url.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_jwt.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_protected_header.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/errors.js +1 -0
- package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/runtime.js +1 -0
- package/dist/src/node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js +1 -0
- package/dist/src/node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js +1 -0
- package/dist/src/node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js +1 -0
- package/dist/src/node_modules/.pnpm/onetime@5.1.2/node_modules/onetime/index.js +1 -0
- package/dist/src/node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js +1 -0
- package/dist/src/node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js +1 -0
- package/dist/src/node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js +1 -0
- package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +1 -0
- package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +1 -0
- package/dist/src/node_modules/.pnpm/strip-final-newline@2.0.0/node_modules/strip-final-newline/index.js +2 -0
- package/dist/src/node_modules/.pnpm/which@2.0.2/node_modules/which/which.js +1 -0
- package/dist/src/public/channels/github/checkout.d.ts +7 -2
- package/dist/src/public/channels/github/checkout.js +1 -1
- package/dist/src/public/channels/github/defaults.js +1 -1
- package/dist/src/public/channels/slack/api-errors.d.ts +33 -0
- package/dist/src/public/channels/slack/api-errors.js +1 -0
- package/dist/src/public/channels/slack/api.js +1 -1
- package/dist/src/public/channels/slack/interaction-cards.js +1 -1
- package/dist/src/public/channels/slack/interactions.js +1 -1
- package/dist/src/public/definitions/sandbox.d.ts +1 -1
- package/dist/src/public/memory/file/provider.js +1 -1
- package/dist/src/public/sandbox/docker.d.ts +7 -0
- package/dist/src/public/sandbox/index.d.ts +1 -1
- package/dist/src/public/sandbox/microsandbox.d.ts +7 -0
- package/dist/src/public/sandbox/vercel.d.ts +7 -0
- package/dist/src/public/skills/index.d.ts +1 -2
- package/dist/src/runtime/connections/mcp-client.d.ts +0 -7
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/connections/openapi-client.d.ts +0 -3
- package/dist/src/runtime/connections/openapi-client.js +1 -1
- package/dist/src/runtime/workspace/seed-files.js +1 -1
- package/dist/src/sandbox/providers/docker.d.ts +4 -4
- package/dist/src/sandbox/providers/just-bash.d.ts +2 -2
- package/dist/src/sandbox/providers/microsandbox.d.ts +4 -4
- package/dist/src/sandbox/providers/vercel.d.ts +4 -3
- package/dist/src/sandbox/state.d.ts +2 -0
- package/dist/src/self-modification/config.d.ts +6 -0
- package/dist/src/self-modification/extension/config-schema.d.ts +25 -0
- package/dist/src/self-modification/extension/config-schema.js +1 -0
- package/dist/src/self-modification/extension/extension.d.ts +3 -47
- package/dist/src/self-modification/extension/extension.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.js +1 -1
- package/dist/src/self-modification/git-workspace.d.ts +5 -1
- package/dist/src/self-modification/git.d.ts +5 -1
- package/dist/src/services/dev-client/request-headers.d.ts +1 -1
- package/dist/src/services/dev-client/request-headers.js +1 -1
- package/dist/src/setup/flows/model.d.ts +0 -108
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/integrations/discord/api.js +1 -1
- package/dist/src/setup/integrations/discord/connect.js +1 -1
- package/dist/src/setup/integrations/github/connect.js +1 -1
- package/dist/src/setup/integrations/linear/connect.js +1 -1
- package/dist/src/setup/integrations/linq/connect.js +1 -1
- package/dist/src/setup/integrations/photon/connect.js +1 -1
- package/dist/src/setup/integrations/teams/connect.js +1 -1
- package/dist/src/setup/project-resolution.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/slack-connect.d.ts +1 -1
- package/dist/src/setup/slack-connect.js +1 -1
- package/dist/src/setup/vercel-api-failure.js +1 -1
- package/dist/src/setup/vercel-deployment.js +1 -1
- package/dist/src/setup/vercel-project-api.d.ts +1 -1
- package/dist/src/setup/vercel-project-api.js +1 -1
- package/dist/src/setup/vercel-project-framework.js +1 -1
- package/dist/src/setup/vercel-project.js +0 -0
- package/dist/src/shared/connection-types.d.ts +0 -2
- package/dist/src/shared/sandbox-network-policy.d.ts +5 -4
- package/dist/src/shared/sandbox-session.d.ts +0 -15
- package/dist/src/shared/skill-package.d.ts +3 -0
- package/dist/src/shared/skill-package.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/json.d.ts +72 -2
- package/dist/src/tasks/json.js +1 -1
- package/dist/src/tools/framework/agent-contract.d.ts +7 -6
- package/dist/src/tools/framework/agent-contract.js +1 -1
- package/dist/src/tools/framework/agent.d.ts +4 -13
- package/dist/src/tools/framework/task-cancel.d.ts +1 -17
- package/dist/src/tools/framework/task-contract.d.ts +16 -137
- package/dist/src/tools/framework/task-contract.js +1 -1
- package/dist/src/tools/provided/bash.d.ts +11 -12
- package/dist/src/tools/provided/bash.js +1 -1
- package/dist/src/tools/provided/glob.d.ts +13 -14
- package/dist/src/tools/provided/glob.js +1 -1
- package/dist/src/tools/provided/grep.d.ts +17 -18
- package/dist/src/tools/provided/grep.js +1 -1
- package/dist/src/tools/provided/read-file.d.ts +14 -15
- package/dist/src/tools/provided/read-file.js +1 -1
- package/dist/src/tools/provided/web-fetch.d.ts +13 -18
- package/dist/src/tools/provided/web-fetch.js +1 -1
- package/dist/src/tools/provided/workflow.js +1 -1
- package/dist/src/tools/provided/write-file.d.ts +10 -11
- package/dist/src/tools/provided/write-file.js +1 -1
- package/dist/src/tools/schema.d.ts +40 -10
- package/dist/src/tools/schema.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/README.md +1 -1
- package/docs/channels/slack.mdx +1 -1
- package/docs/connections/overview.mdx +1 -1
- package/docs/extensions.md +4 -0
- package/docs/getting-started.mdx +1 -1
- package/docs/guides/deployment/vercel.mdx +6 -0
- package/docs/guides/dev-tui.md +1 -1
- package/docs/guides/dynamic-capabilities.md +2 -0
- package/docs/guides/hooks.md +6 -3
- package/docs/guides/instrumentation/agent-runs.mdx +101 -0
- package/docs/guides/instrumentation/instrumentation.mdx +2 -1
- package/docs/guides/instrumentation/meta.json +1 -1
- package/docs/guides/instrumentation/migration.md +5 -1
- package/docs/guides/instrumentation/otel.mdx +8 -27
- package/docs/guides/self-modification.md +37 -0
- package/docs/guides/session-context.md +11 -13
- package/docs/install-integrations.mdx +1 -1
- package/docs/meta.json +1 -0
- package/docs/reference/cli.md +1 -1
- package/docs/reference/typescript-api.md +1 -2
- package/docs/sandbox/index.mdx +11 -0
- package/docs/skills.mdx +3 -10
- package/docs/subagents/index.mdx +1 -1
- package/docs/tools/overview.mdx +7 -1
- package/docs/tools/workflows.mdx +1 -1
- package/package.json +30 -1
- package/dist/src/cli/dev/tui/model-picker.d.ts +0 -50
- package/dist/src/cli/dev/tui/model-picker.js +0 -1
- package/dist/src/compiled/_chunks/client/errors-Cd0_QQdM.js +0 -2
- package/dist/src/compiled/_chunks/node/auth-DDrvYko5.js +0 -2
- package/dist/src/compiled/_chunks/node/schemas-g-rLPCNX.js +0 -50
- package/dist/src/compiled/_chunks/workflow/coerce-D0oqvQ_w.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-DjECvUyK.js +0 -2
- package/dist/src/compiled/_chunks/workflow/frames-D_Q-7A1N.js +0 -3
- package/dist/src/compiled/_chunks/workflow/resume-hook-BhA_nDEV.js +0 -1
- package/dist/src/compiled/_chunks/workflow/schemas-4CmFgxN_.js +0 -50
- package/dist/src/compiled/_chunks/workflow/sleep-DB4AH9-A.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-util-pP4KRRl0.js +0 -27
- package/dist/src/compiled/_chunks/workflow/ws-transport-BpTMh40s.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/lib/primitives.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/lib/schemas.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/models/aclaction.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/models/sdkvalidationerror.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/models/updateprojectblock.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/models/updateprojectprojectsbranchmatcher.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/types/defaultToZeroValue.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/types/fp.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/types/primitives.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/types/rfcdate.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/types/smartUnion.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/types/unrecognized.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/index.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/ZodError.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/errors.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/external.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/helpers/errorUtil.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/helpers/parseUtil.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/helpers/typeAliases.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/helpers/util.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/index.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/locales/en.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/types.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/checks.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/coerce.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/compat.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/deep-partial.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/errors.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/external.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/from-json-schema.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/in-out.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/iso.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/parse.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/schemas.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/api.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/checks.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/compile.js +0 -2
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/core.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/doc.js +0 -3
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/errors.js +0 -2
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/index.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/json-schema-generator.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/json-schema-processors.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/json-schema.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/memoizer.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/parse.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/regexes.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/registries.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/schemas.js +0 -46
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/to-json-schema.js +0 -3
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/util.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/versions.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/visit.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ar.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/az.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/be.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/bg.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/bn.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ca.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ckb.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/cs.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/da.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/de.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/el.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/en.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/eo.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/es.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/fa.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/fi.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/fr-CA.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/fr.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/gu.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/he.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/hi.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/hr.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/hu.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/hy.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/id.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/index.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/is.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/it.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ja.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ka.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/kh.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/km.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/kn.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ko.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/lt.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/mk.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ms.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ne.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/nl.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/nn.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/no.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ota.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/pl.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ps.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/pt-BR.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/pt.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ro.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ru.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/sk.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/sl.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/sv.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ta.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/th.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/tk.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/tr.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ua.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/uk.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/ur.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/uz.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/vi.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/yo.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/zh-CN.js +0 -1
- package/dist/src/node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/zh-TW.js +0 -1
- package/dist/src/runtime/skills/sandbox-access.d.ts +0 -22
- package/dist/src/runtime/skills/sandbox-access.js +0 -1
- package/dist/src/shared/skill-types.d.ts +0 -22
- package/dist/src/shared/skill-types.js +0 -1
|
@@ -0,0 +1,1309 @@
|
|
|
1
|
+
const SERVER_MJS_SOURCE=`import { setTimeout as delay } from "node:timers/promises";
|
|
2
|
+
import { execFile, execFileSync } from "node:child_process";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { chmod, rename, rm } from "node:fs/promises";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import http from "node:http";
|
|
7
|
+
import { env } from "node:process";
|
|
8
|
+
import { dirname, resolve } from "node:path";
|
|
9
|
+
|
|
10
|
+
import { CuaDriver } from "@trycua/cua-driver";
|
|
11
|
+
|
|
12
|
+
import { pointerMotionPlan } from "./pointer-motion.mjs";
|
|
13
|
+
import { selectGroundingElements } from "./state.mjs";
|
|
14
|
+
import { naturalTypingPlan } from "./typing.mjs";
|
|
15
|
+
|
|
16
|
+
const socketPath = env.COMPUTER_USE_SOCKET_PATH;
|
|
17
|
+
const workspaceRoot = env.COMPUTER_USE_ROOT;
|
|
18
|
+
const maxRequestBytes = 32 * 1024;
|
|
19
|
+
const maxRequestMs = 120_000;
|
|
20
|
+
const maxRecordingMs = 300_000;
|
|
21
|
+
const nativeCallTimeoutMs = 10_000;
|
|
22
|
+
// Only the queue owner sets this signal; recording finalization deliberately bypasses it.
|
|
23
|
+
let requestSignal;
|
|
24
|
+
const desktopMargin = 24;
|
|
25
|
+
const minimumWindow = { height: 240, width: 480 };
|
|
26
|
+
const layoutTolerance = { height: 8, width: 8, x: 4, y: 4 };
|
|
27
|
+
const maxClipboardBytes = 10_000;
|
|
28
|
+
const driver = await CuaDriver.create({ claudeCodeCompatibility: false });
|
|
29
|
+
const execFilePromise = promisify(execFile);
|
|
30
|
+
function execFileAsync(file, args, options) {
|
|
31
|
+
return execFilePromise(file, args, {
|
|
32
|
+
timeout: nativeCallTimeoutMs,
|
|
33
|
+
...options,
|
|
34
|
+
signal: requestSignal,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let activeRecording = null;
|
|
39
|
+
let queue = Promise.resolve();
|
|
40
|
+
let shuttingDown = false;
|
|
41
|
+
|
|
42
|
+
await rm(socketPath, { force: true });
|
|
43
|
+
|
|
44
|
+
const server = http.createServer((request, response) => {
|
|
45
|
+
if (shuttingDown) return response.destroy();
|
|
46
|
+
if (request.method !== "POST" || request.url !== "/call") {
|
|
47
|
+
sendJson(response, 404, { error: "not found" });
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const controller = new AbortController();
|
|
51
|
+
const deadline = Number(request.headers["x-computer-use-deadline"]);
|
|
52
|
+
const timeoutMs = Number.isFinite(deadline)
|
|
53
|
+
? Math.max(0, Math.min(maxRequestMs, deadline - Date.now()))
|
|
54
|
+
: maxRequestMs;
|
|
55
|
+
const cancel = () =>
|
|
56
|
+
controller.abort(new Error("computer-use request cancelled or deadline exceeded"));
|
|
57
|
+
const timer = setTimeout(cancel, timeoutMs);
|
|
58
|
+
response.once("close", cancel);
|
|
59
|
+
controller.signal.addEventListener("abort", () => response.destroy(), { once: true });
|
|
60
|
+
if (timeoutMs === 0) cancel();
|
|
61
|
+
// Read immediately: a body may finish or disconnect while another call owns the queue.
|
|
62
|
+
const body = readBody(request);
|
|
63
|
+
void body.catch(() => undefined);
|
|
64
|
+
const task = queue.then(async () => {
|
|
65
|
+
controller.signal.throwIfAborted();
|
|
66
|
+
if (shuttingDown) return;
|
|
67
|
+
requestSignal = controller.signal;
|
|
68
|
+
try {
|
|
69
|
+
await handleRequest(await body, response);
|
|
70
|
+
} finally {
|
|
71
|
+
requestSignal = undefined;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
queue = task
|
|
75
|
+
.catch(() => response.destroy())
|
|
76
|
+
.finally(() => {
|
|
77
|
+
clearTimeout(timer);
|
|
78
|
+
response.removeListener("close", cancel);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
server.listen(socketPath, () => {
|
|
83
|
+
void chmod(socketPath, 0o600);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
87
|
+
process.once(signal, () => {
|
|
88
|
+
void shutdown();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function shutdown() {
|
|
93
|
+
if (shuttingDown) return;
|
|
94
|
+
shuttingDown = true;
|
|
95
|
+
server.close();
|
|
96
|
+
server.closeAllConnections();
|
|
97
|
+
const timer = setTimeout(() => process.exit(1), nativeCallTimeoutMs * 2);
|
|
98
|
+
let exitCode = 0;
|
|
99
|
+
try {
|
|
100
|
+
await queue;
|
|
101
|
+
if (activeRecording !== null) await stopRecording();
|
|
102
|
+
} catch {
|
|
103
|
+
exitCode = 1;
|
|
104
|
+
} finally {
|
|
105
|
+
try {
|
|
106
|
+
await driver.shutdown();
|
|
107
|
+
} catch {
|
|
108
|
+
exitCode = 1;
|
|
109
|
+
} finally {
|
|
110
|
+
clearTimeout(timer);
|
|
111
|
+
process.exit(exitCode);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async function handleRequest(body, response) {
|
|
117
|
+
try {
|
|
118
|
+
const input = JSON.parse(body);
|
|
119
|
+
if (input.action === "health") {
|
|
120
|
+
sendJson(response, 200, { backend: "cua-driver", version: "0.12.5" });
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
validateRequest(input);
|
|
125
|
+
const actionResult = await performAction(input.action);
|
|
126
|
+
const state = await captureState(input.screenshotPath);
|
|
127
|
+
sendJson(response, 200, {
|
|
128
|
+
action: actionResult,
|
|
129
|
+
backend: "cua-driver",
|
|
130
|
+
screenshot: input.screenshotPath,
|
|
131
|
+
state,
|
|
132
|
+
version: "0.12.5",
|
|
133
|
+
});
|
|
134
|
+
} catch (error) {
|
|
135
|
+
if (requestSignal?.aborted && activeRecording !== null) {
|
|
136
|
+
await stopRecording().catch(() => undefined);
|
|
137
|
+
}
|
|
138
|
+
sendJson(response, 500, {
|
|
139
|
+
error: error instanceof Error ? error.message : String(error),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async function performAction(action) {
|
|
145
|
+
requestSignal?.throwIfAborted();
|
|
146
|
+
validateActionCoordinates(action);
|
|
147
|
+
if (action.action === "sequence") {
|
|
148
|
+
const results = [];
|
|
149
|
+
try {
|
|
150
|
+
for (const nested of action.actions) {
|
|
151
|
+
const startedAt = performance.now();
|
|
152
|
+
const result = await performAction(nested);
|
|
153
|
+
results.push({
|
|
154
|
+
action: nested.action,
|
|
155
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
156
|
+
result,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return results;
|
|
160
|
+
} catch (error) {
|
|
161
|
+
// Never strand the durable driver in an active-recording state when a
|
|
162
|
+
// rehearsed step fails. Preserve the original action error.
|
|
163
|
+
if (activeRecording !== null) await stopRecording().catch(() => undefined);
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
switch (action.action) {
|
|
168
|
+
case "screenshot":
|
|
169
|
+
return null;
|
|
170
|
+
case "click":
|
|
171
|
+
await moveCursor(action);
|
|
172
|
+
return click(action, 1);
|
|
173
|
+
case "double_click":
|
|
174
|
+
await moveCursor(action);
|
|
175
|
+
return click(action, 2);
|
|
176
|
+
case "triple_click":
|
|
177
|
+
await moveCursor(action);
|
|
178
|
+
return click(action, 3);
|
|
179
|
+
case "drag":
|
|
180
|
+
return dragCursor(action);
|
|
181
|
+
case "keypress":
|
|
182
|
+
return action.keys.length === 1
|
|
183
|
+
? call("press_key", {
|
|
184
|
+
scope: "desktop",
|
|
185
|
+
key: normalizeKey(action.keys[0]),
|
|
186
|
+
})
|
|
187
|
+
: call("hotkey", {
|
|
188
|
+
scope: "desktop",
|
|
189
|
+
keys: action.keys.map(normalizeKey),
|
|
190
|
+
});
|
|
191
|
+
case "move":
|
|
192
|
+
return moveCursor(action);
|
|
193
|
+
case "scroll": {
|
|
194
|
+
await call("move_cursor", {
|
|
195
|
+
scope: "desktop",
|
|
196
|
+
x: action.x,
|
|
197
|
+
y: action.y,
|
|
198
|
+
});
|
|
199
|
+
const results = [];
|
|
200
|
+
if (action.scrollY !== 0) {
|
|
201
|
+
results.push(await call("scroll", scrollInput(action.scrollY, "up", "down")));
|
|
202
|
+
}
|
|
203
|
+
if (action.scrollX !== 0) {
|
|
204
|
+
results.push(await call("scroll", scrollInput(action.scrollX, "left", "right")));
|
|
205
|
+
}
|
|
206
|
+
return results;
|
|
207
|
+
}
|
|
208
|
+
case "type":
|
|
209
|
+
return typeText(action);
|
|
210
|
+
case "clipboard_read":
|
|
211
|
+
return readClipboard(action.selection);
|
|
212
|
+
case "clipboard_write":
|
|
213
|
+
return writeClipboard(action.selection, action.text);
|
|
214
|
+
case "wait":
|
|
215
|
+
await sleep(action.durationMs ?? 2_000);
|
|
216
|
+
return null;
|
|
217
|
+
case "arrange_windows":
|
|
218
|
+
return arrangeWindows(action);
|
|
219
|
+
case "record_start":
|
|
220
|
+
return startRecording(action.path);
|
|
221
|
+
case "record_stop":
|
|
222
|
+
return stopRecording();
|
|
223
|
+
default:
|
|
224
|
+
throw new Error(\`unsupported computer-use action: \${String(action.action)}\`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
async function captureState(screenshotPath) {
|
|
229
|
+
await call("get_desktop_state", { screenshot_out_file: screenshotPath });
|
|
230
|
+
const pointer = structured(await call("get_cursor_position", {}));
|
|
231
|
+
const screen = x11ScreenSize();
|
|
232
|
+
const windows = structured(await call("list_windows", { on_screen_only: true })).windows;
|
|
233
|
+
const contentWindows = Array.isArray(windows) ? windows.filter(isContentWindow) : [];
|
|
234
|
+
const groundingWindow = contentWindows.toSorted((left, right) => right.z_index - left.z_index)[0];
|
|
235
|
+
|
|
236
|
+
let elements = [];
|
|
237
|
+
if (groundingWindow !== undefined) {
|
|
238
|
+
const windowState = structured(
|
|
239
|
+
await call("get_window_state", {
|
|
240
|
+
pid: groundingWindow.pid,
|
|
241
|
+
window_id: groundingWindow.window_id,
|
|
242
|
+
include_screenshot: false,
|
|
243
|
+
max_depth: 20,
|
|
244
|
+
max_elements: 250,
|
|
245
|
+
}),
|
|
246
|
+
);
|
|
247
|
+
if (Array.isArray(windowState.elements)) {
|
|
248
|
+
elements = selectGroundingElements(windowState.elements, {
|
|
249
|
+
width: Number(screen.width) || 1920,
|
|
250
|
+
height: Number(screen.height) || 1080,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return formatState(groundingWindow, pointer, elements);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
async function startRecording(path) {
|
|
259
|
+
if (activeRecording !== null) {
|
|
260
|
+
throw new Error("a recording is already active");
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const outputDirectory = \`\${workspaceRoot}/recording-\${randomUUID()}\`;
|
|
264
|
+
const result = await call(
|
|
265
|
+
"start_recording",
|
|
266
|
+
{
|
|
267
|
+
output_dir: outputDirectory,
|
|
268
|
+
record_video: true,
|
|
269
|
+
},
|
|
270
|
+
false,
|
|
271
|
+
);
|
|
272
|
+
activeRecording = {
|
|
273
|
+
outputDirectory,
|
|
274
|
+
outputPath: path,
|
|
275
|
+
stopping: null,
|
|
276
|
+
timer: setTimeout(() => {
|
|
277
|
+
void stopRecording().catch(() => {
|
|
278
|
+
void shutdown();
|
|
279
|
+
});
|
|
280
|
+
}, maxRecordingMs),
|
|
281
|
+
};
|
|
282
|
+
return result;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
async function stopRecording() {
|
|
286
|
+
if (activeRecording === null) {
|
|
287
|
+
throw new Error("no recording is active");
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const recording = activeRecording;
|
|
291
|
+
if (recording.stopping !== null) return recording.stopping;
|
|
292
|
+
clearTimeout(recording.timer);
|
|
293
|
+
recording.stopping = finalizeRecording(recording);
|
|
294
|
+
return recording.stopping;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
async function finalizeRecording(recording) {
|
|
298
|
+
try {
|
|
299
|
+
const result = await call("stop_recording", {}, false);
|
|
300
|
+
const output = structured(result);
|
|
301
|
+
const videoPath =
|
|
302
|
+
typeof output.last_video_path === "string"
|
|
303
|
+
? output.last_video_path
|
|
304
|
+
: recording.outputDirectory + "/recording.mp4";
|
|
305
|
+
await rename(videoPath, recording.outputPath);
|
|
306
|
+
await rm(recording.outputDirectory, { force: true, recursive: true });
|
|
307
|
+
return result;
|
|
308
|
+
} catch (error) {
|
|
309
|
+
void shutdown();
|
|
310
|
+
throw error;
|
|
311
|
+
} finally {
|
|
312
|
+
activeRecording = null;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
async function call(name, input, cancellable = true) {
|
|
317
|
+
const signal = cancellable ? requestSignal : undefined;
|
|
318
|
+
signal?.throwIfAborted();
|
|
319
|
+
let timer;
|
|
320
|
+
const result = await Promise.race([
|
|
321
|
+
driver.callTool(name, JSON.stringify(input)),
|
|
322
|
+
new Promise((_, reject) => {
|
|
323
|
+
timer = setTimeout(() => {
|
|
324
|
+
// Native calls have no abort API. Do not reuse a driver with uncertain in-flight work.
|
|
325
|
+
void shutdown();
|
|
326
|
+
reject(new Error("computer-use native call timed out; restart with startComputerUse"));
|
|
327
|
+
}, nativeCallTimeoutMs);
|
|
328
|
+
}),
|
|
329
|
+
]).finally(() => clearTimeout(timer));
|
|
330
|
+
signal?.throwIfAborted();
|
|
331
|
+
if (result.isError) {
|
|
332
|
+
throw new Error(
|
|
333
|
+
\`Cua \${name} failed\${result.errorCode ? \` (\${result.errorCode})\` : ""}: \${result.text}\`,
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
return {
|
|
337
|
+
degraded: result.degraded,
|
|
338
|
+
structuredJson: result.structuredJson,
|
|
339
|
+
text: result.text,
|
|
340
|
+
verified: result.verified,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function structured(result) {
|
|
345
|
+
if (result.structuredJson === undefined) return {};
|
|
346
|
+
return JSON.parse(result.structuredJson);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function pointerClickInput(x, y, button, count) {
|
|
350
|
+
return {
|
|
351
|
+
scope: "desktop",
|
|
352
|
+
x,
|
|
353
|
+
y,
|
|
354
|
+
button: button === "wheel" ? "middle" : button,
|
|
355
|
+
count,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
async function moveCursor(action) {
|
|
360
|
+
if (action.movementStyle === undefined) {
|
|
361
|
+
return call("move_cursor", { scope: "desktop", x: action.x, y: action.y });
|
|
362
|
+
}
|
|
363
|
+
const current = structured(await call("get_cursor_position", {}));
|
|
364
|
+
const start = { x: Number(current.x), y: Number(current.y) };
|
|
365
|
+
if (!Number.isFinite(start.x) || !Number.isFinite(start.y)) {
|
|
366
|
+
return call("move_cursor", { scope: "desktop", x: action.x, y: action.y });
|
|
367
|
+
}
|
|
368
|
+
const options = { style: action.movementStyle };
|
|
369
|
+
if (action.durationMs !== undefined) options.durationMs = action.durationMs;
|
|
370
|
+
return followPointerPlan(pointerMotionPlan(start, { x: action.x, y: action.y }, options), "x11");
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
async function dragCursor(action) {
|
|
374
|
+
const start = action.path[0];
|
|
375
|
+
const end = action.path.at(-1);
|
|
376
|
+
if (action.movementStyle === undefined) {
|
|
377
|
+
return call("drag", {
|
|
378
|
+
scope: "desktop",
|
|
379
|
+
from_x: start.x,
|
|
380
|
+
from_y: start.y,
|
|
381
|
+
to_x: end.x,
|
|
382
|
+
to_y: end.y,
|
|
383
|
+
steps: Math.min(200, Math.max(20, action.path.length * 10)),
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
const style = action.movementStyle;
|
|
387
|
+
const current = structured(await call("get_cursor_position", {}));
|
|
388
|
+
const currentPoint = { x: Number(current.x), y: Number(current.y) };
|
|
389
|
+
const approach =
|
|
390
|
+
Number.isFinite(currentPoint.x) && Number.isFinite(currentPoint.y)
|
|
391
|
+
? pointerPlanArgs(pointerMotionPlan(currentPoint, start, { style: "natural" }))
|
|
392
|
+
: ["mousemove", String(start.x), String(start.y)];
|
|
393
|
+
const options = { style };
|
|
394
|
+
if (action.durationMs !== undefined) options.durationMs = action.durationMs;
|
|
395
|
+
const drag = pointerPlanArgs(pointerMotionPlan(start, end, options));
|
|
396
|
+
return xdotool([
|
|
397
|
+
...approach,
|
|
398
|
+
"sleep",
|
|
399
|
+
"0.025",
|
|
400
|
+
"mousedown",
|
|
401
|
+
"1",
|
|
402
|
+
"sleep",
|
|
403
|
+
"0.030",
|
|
404
|
+
...drag,
|
|
405
|
+
"sleep",
|
|
406
|
+
"0.030",
|
|
407
|
+
"mouseup",
|
|
408
|
+
"1",
|
|
409
|
+
]);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
async function followPointerPlan(plan, backend = "cua") {
|
|
413
|
+
if (backend === "x11") return xdotool(pointerPlanArgs(plan));
|
|
414
|
+
const results = [];
|
|
415
|
+
for (let phaseIndex = 0; phaseIndex < plan.phases.length; phaseIndex += 1) {
|
|
416
|
+
for (const point of plan.phases[phaseIndex]) {
|
|
417
|
+
results.push(await call("move_cursor", { scope: "desktop", x: point.x, y: point.y }));
|
|
418
|
+
if (point.delayMs > 0) await sleep(point.delayMs);
|
|
419
|
+
}
|
|
420
|
+
if (phaseIndex < plan.phases.length - 1 && plan.settleMs > 0) await sleep(plan.settleMs);
|
|
421
|
+
}
|
|
422
|
+
if (plan.phases.length === 1 && plan.settleMs > 0) await sleep(plan.settleMs);
|
|
423
|
+
return results;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
function pointerPlanArgs(plan) {
|
|
427
|
+
const args = [];
|
|
428
|
+
for (let phaseIndex = 0; phaseIndex < plan.phases.length; phaseIndex += 1) {
|
|
429
|
+
for (const point of plan.phases[phaseIndex]) {
|
|
430
|
+
args.push("mousemove", String(point.x), String(point.y));
|
|
431
|
+
if (point.delayMs > 0) args.push("sleep", (point.delayMs / 1000).toFixed(3));
|
|
432
|
+
}
|
|
433
|
+
if (phaseIndex < plan.phases.length - 1 && plan.settleMs > 0) {
|
|
434
|
+
args.push("sleep", (plan.settleMs / 1000).toFixed(3));
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
if (plan.phases.length === 1 && plan.settleMs > 0) {
|
|
438
|
+
args.push("sleep", (plan.settleMs / 1000).toFixed(3));
|
|
439
|
+
}
|
|
440
|
+
return args;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
async function xdotool(args) {
|
|
444
|
+
const plannedSleepMs = args.reduce(
|
|
445
|
+
(total, value, index) => (args[index - 1] === "sleep" ? total + Number(value) * 1000 : total),
|
|
446
|
+
0,
|
|
447
|
+
);
|
|
448
|
+
const timeout = Math.max(2_000, Math.ceil(plannedSleepMs + 1_500));
|
|
449
|
+
const result = await execFileAsync("xdotool", args, { env: displayEnv(), timeout });
|
|
450
|
+
return {
|
|
451
|
+
plannedSleepMs: Math.round(plannedSleepMs),
|
|
452
|
+
stderr: result.stderr,
|
|
453
|
+
stdout: result.stdout,
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function typingPlan(action) {
|
|
458
|
+
if (action.typingStyle === "natural") return naturalTypingPlan(action.text);
|
|
459
|
+
return [...new Intl.Segmenter().segment(action.text)].map(({ segment }) => ({
|
|
460
|
+
grapheme: segment,
|
|
461
|
+
delayMs: action.typingDelayMs ?? 0,
|
|
462
|
+
}));
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
function validateTypingBudget(actions) {
|
|
466
|
+
let characters = 0;
|
|
467
|
+
let calls = 0;
|
|
468
|
+
let delayMs = 0;
|
|
469
|
+
for (const action of actions) {
|
|
470
|
+
if (action.action !== "type") continue;
|
|
471
|
+
if (typeof action.text !== "string" || action.text.length > 10_000) {
|
|
472
|
+
throw new Error("typing text must be at most 10000 characters");
|
|
473
|
+
}
|
|
474
|
+
characters += action.text.length;
|
|
475
|
+
if (action.typingStyle === undefined && !action.typingDelayMs) continue;
|
|
476
|
+
const plan = typingPlan(action);
|
|
477
|
+
calls += plan.length;
|
|
478
|
+
delayMs += plan.reduce((total, step) => total + step.delayMs, 0);
|
|
479
|
+
}
|
|
480
|
+
if (characters > 10_000 || calls > 1_000 || delayMs > 30_000) {
|
|
481
|
+
throw new Error(
|
|
482
|
+
"typing budget exceeded: at most 10000 characters, 1000 paced graphemes and 30000ms delay per request; use unpaced typing for longer text",
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
async function typeText(action) {
|
|
488
|
+
if (action.typingStyle === undefined && !action.typingDelayMs) {
|
|
489
|
+
return call("type_text", { scope: "desktop", text: action.text });
|
|
490
|
+
}
|
|
491
|
+
let result;
|
|
492
|
+
let graphemesTyped = 0;
|
|
493
|
+
for (const { grapheme, delayMs } of typingPlan(action)) {
|
|
494
|
+
result = await call("type_text", { scope: "desktop", text: grapheme });
|
|
495
|
+
graphemesTyped += 1;
|
|
496
|
+
if (delayMs > 0) await sleep(delayMs);
|
|
497
|
+
}
|
|
498
|
+
return { graphemesTyped, result };
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
async function click(action, count) {
|
|
502
|
+
if (action.button !== "back" && action.button !== "forward") {
|
|
503
|
+
return call("click", pointerClickInput(action.x, action.y, action.button, count));
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
await call("move_cursor", {
|
|
507
|
+
scope: "desktop",
|
|
508
|
+
x: action.x,
|
|
509
|
+
y: action.y,
|
|
510
|
+
});
|
|
511
|
+
const results = [];
|
|
512
|
+
for (let index = 0; index < count; index += 1) {
|
|
513
|
+
results.push(
|
|
514
|
+
await call("hotkey", {
|
|
515
|
+
scope: "desktop",
|
|
516
|
+
keys: ["alt", action.button === "back" ? "left" : "right"],
|
|
517
|
+
}),
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
return results;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
async function readClipboard(selection) {
|
|
524
|
+
try {
|
|
525
|
+
const result = await execFileAsync("xclip", ["-selection", xclipSelection(selection), "-out"], {
|
|
526
|
+
env: displayEnv(),
|
|
527
|
+
maxBuffer: maxClipboardBytes + 1,
|
|
528
|
+
});
|
|
529
|
+
if (Buffer.byteLength(result.stdout) > maxClipboardBytes) {
|
|
530
|
+
throw new Error(\`clipboard content exceeds \${maxClipboardBytes} bytes\`);
|
|
531
|
+
}
|
|
532
|
+
return { selection, text: result.stdout };
|
|
533
|
+
} catch (error) {
|
|
534
|
+
if (error instanceof Error && error.message.includes("clipboard content exceeds")) throw error;
|
|
535
|
+
return { selection, text: "" };
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
async function writeClipboard(selection, text) {
|
|
540
|
+
if (Buffer.byteLength(text) > maxClipboardBytes) {
|
|
541
|
+
throw new Error(\`clipboard content exceeds \${maxClipboardBytes} bytes\`);
|
|
542
|
+
}
|
|
543
|
+
await new Promise((resolve, reject) => {
|
|
544
|
+
const child = execFile("xclip", ["-selection", xclipSelection(selection), "-in"], {
|
|
545
|
+
env: displayEnv(),
|
|
546
|
+
timeout: nativeCallTimeoutMs,
|
|
547
|
+
signal: requestSignal,
|
|
548
|
+
});
|
|
549
|
+
child.once("error", reject);
|
|
550
|
+
child.once("exit", (code) =>
|
|
551
|
+
code === 0 ? resolve() : reject(new Error(\`xclip exited \${code}\`)),
|
|
552
|
+
);
|
|
553
|
+
child.stdin.end(text);
|
|
554
|
+
});
|
|
555
|
+
return { bytes: Buffer.byteLength(text), selection };
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function xclipSelection(selection) {
|
|
559
|
+
return selection === "primary" ? "primary" : "clipboard";
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
async function arrangeWindows(action) {
|
|
563
|
+
const scene = validateWindowScene(action.windows);
|
|
564
|
+
const deadline = Date.now() + action.waitForMs;
|
|
565
|
+
let resolved = null;
|
|
566
|
+
while (resolved === null) {
|
|
567
|
+
const windows = structured(await call("list_windows", { on_screen_only: true })).windows;
|
|
568
|
+
resolved = resolveSceneWindows(scene, Array.isArray(windows) ? windows : []);
|
|
569
|
+
if (resolved !== null) break;
|
|
570
|
+
if (Date.now() >= deadline) {
|
|
571
|
+
throw new Error(
|
|
572
|
+
\`arrange_windows timed out waiting for: \${missingSceneSelectors(scene, Array.isArray(windows) ? windows : []).join(", ")}\`,
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
await sleep(100);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// Resolve the complete scene before mutating any window. A missing selector
|
|
579
|
+
// therefore leaves the existing desktop untouched.
|
|
580
|
+
for (const item of resolved) {
|
|
581
|
+
const windowId = String(item.window.window_id);
|
|
582
|
+
await execFileAsync("xdotool", ["windowactivate", "--sync", windowId], { env: displayEnv() });
|
|
583
|
+
await execFileAsync(
|
|
584
|
+
"xdotool",
|
|
585
|
+
["windowmove", windowId, String(item.bounds.x), String(item.bounds.y)],
|
|
586
|
+
{
|
|
587
|
+
env: displayEnv(),
|
|
588
|
+
},
|
|
589
|
+
);
|
|
590
|
+
await execFileAsync(
|
|
591
|
+
"xdotool",
|
|
592
|
+
["windowsize", windowId, String(item.bounds.width), String(item.bounds.height)],
|
|
593
|
+
{ env: displayEnv() },
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
let verified = null;
|
|
598
|
+
let windows = [];
|
|
599
|
+
for (let attempt = 0; attempt < 10; attempt += 1) {
|
|
600
|
+
const response = structured(await call("list_windows", { on_screen_only: true })).windows;
|
|
601
|
+
windows = Array.isArray(response) ? response : [];
|
|
602
|
+
verified = resolveSceneWindows(scene, windows);
|
|
603
|
+
if (
|
|
604
|
+
verified !== null &&
|
|
605
|
+
verified.every(({ bounds, window }) => approximatelyEqual(bounds, window))
|
|
606
|
+
) {
|
|
607
|
+
return verified.map(layoutResult);
|
|
608
|
+
}
|
|
609
|
+
await sleep(100);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const screenshotPath = \`\${workspaceRoot}/layout-failure-\${Date.now()}.png\`;
|
|
613
|
+
await call("get_desktop_state", { screenshot_out_file: screenshotPath });
|
|
614
|
+
const details =
|
|
615
|
+
verified === null
|
|
616
|
+
? { stage: "selector_resolution", missing: missingSceneSelectors(scene, windows) }
|
|
617
|
+
: {
|
|
618
|
+
stage: "verification",
|
|
619
|
+
tolerance: layoutTolerance,
|
|
620
|
+
windows: verified.map(layoutResult),
|
|
621
|
+
};
|
|
622
|
+
throw new Error(
|
|
623
|
+
\`arrange_windows failed: \${JSON.stringify({ ...details, screenshot: screenshotPath })}\`,
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
function validateWindowScene(windows) {
|
|
628
|
+
if (!Array.isArray(windows) || windows.length < 1 || windows.length > 4) {
|
|
629
|
+
throw new Error("arrange_windows requires 1 to 4 windows");
|
|
630
|
+
}
|
|
631
|
+
const scene = windows.map((item) => ({ ...item, bounds: regionBounds(item.region) }));
|
|
632
|
+
const selectors = scene.map((item) => selectorLabel(item.selector));
|
|
633
|
+
if (new Set(selectors).size !== selectors.length) {
|
|
634
|
+
throw new Error("arrange_windows selectors must be unique");
|
|
635
|
+
}
|
|
636
|
+
for (let left = 0; left < scene.length; left += 1) {
|
|
637
|
+
for (let right = left + 1; right < scene.length; right += 1) {
|
|
638
|
+
if (overlaps(scene[left].bounds, scene[right].bounds)) {
|
|
639
|
+
throw new Error("arrange_windows regions must not overlap");
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return scene;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
function desktopBounds() {
|
|
647
|
+
const screen = x11ScreenSize();
|
|
648
|
+
return {
|
|
649
|
+
x: desktopMargin,
|
|
650
|
+
y: desktopMargin,
|
|
651
|
+
width: screen.width - desktopMargin * 2,
|
|
652
|
+
height: screen.height - desktopMargin * 2,
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function x11ScreenSize() {
|
|
657
|
+
// The X server is the source of truth after set_desktop_size. Avoid CUA's
|
|
658
|
+
// session-oriented get_screen_size contract, which differs from pointer
|
|
659
|
+
// actions and does not accept scope.
|
|
660
|
+
const output = execFileSync("xdpyinfo", ["-display", ":99"], {
|
|
661
|
+
encoding: "utf8",
|
|
662
|
+
timeout: 2_000,
|
|
663
|
+
});
|
|
664
|
+
const match = /dimensions:\\s+(\\d+)x(\\d+) pixels/u.exec(output);
|
|
665
|
+
if (match === null) throw new Error("could not determine desktop dimensions");
|
|
666
|
+
return { width: Number(match[1]), height: Number(match[2]) };
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function regionBounds(region) {
|
|
670
|
+
if (
|
|
671
|
+
typeof region !== "object" ||
|
|
672
|
+
region === null ||
|
|
673
|
+
![region.x, region.y, region.width, region.height].every(Number.isFinite) ||
|
|
674
|
+
region.x < 0 ||
|
|
675
|
+
region.y < 0 ||
|
|
676
|
+
region.width <= 0 ||
|
|
677
|
+
region.height <= 0 ||
|
|
678
|
+
region.x + region.width > 1 ||
|
|
679
|
+
region.y + region.height > 1
|
|
680
|
+
) {
|
|
681
|
+
throw new Error("arrange_windows regions must fit within the desktop");
|
|
682
|
+
}
|
|
683
|
+
const desktop = desktopBounds();
|
|
684
|
+
const left = Math.round(desktop.x + desktop.width * region.x);
|
|
685
|
+
const top = Math.round(desktop.y + desktop.height * region.y);
|
|
686
|
+
const right = Math.round(desktop.x + desktop.width * (region.x + region.width));
|
|
687
|
+
const bottom = Math.round(desktop.y + desktop.height * (region.y + region.height));
|
|
688
|
+
const bounds = { x: left, y: top, width: right - left, height: bottom - top };
|
|
689
|
+
if (bounds.width < minimumWindow.width || bounds.height < minimumWindow.height) {
|
|
690
|
+
throw new Error(
|
|
691
|
+
\`arrange_windows regions must be at least \${minimumWindow.width}x\${minimumWindow.height}\`,
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
return bounds;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
function resolveSceneWindows(scene, windows) {
|
|
698
|
+
const resolved = scene.map((item) => {
|
|
699
|
+
const window = windows.find((candidate) => matchesSelector(candidate, item.selector));
|
|
700
|
+
return window === undefined ? null : { bounds: item.bounds, window };
|
|
701
|
+
});
|
|
702
|
+
return resolved.includes(null) ? null : resolved;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
function missingSceneSelectors(scene, windows) {
|
|
706
|
+
return scene
|
|
707
|
+
.filter((item) => !windows.some((window) => matchesSelector(window, item.selector)))
|
|
708
|
+
.map((item) => selectorLabel(item.selector));
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
function matchesSelector(window, selector) {
|
|
712
|
+
const identity = \`\${window.app_name ?? ""}\\n\${window.title ?? ""}\`.toLowerCase();
|
|
713
|
+
if (selector.app === "firefox") return identity.includes("firefox");
|
|
714
|
+
const title = selector.instance === "primary" ? "terminal 1" : "terminal 2";
|
|
715
|
+
return identity.includes(title);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
function selectorLabel(selector) {
|
|
719
|
+
return selector.app === "firefox" ? "firefox" : \`xterm:\${selector.instance}\`;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
function overlaps(left, right) {
|
|
723
|
+
return (
|
|
724
|
+
left.x < right.x + right.width &&
|
|
725
|
+
left.x + left.width > right.x &&
|
|
726
|
+
left.y < right.y + right.height &&
|
|
727
|
+
left.y + left.height > right.y
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
function layoutResult({ bounds, window }) {
|
|
732
|
+
const observed = {
|
|
733
|
+
x: Number(window.x),
|
|
734
|
+
y: Number(window.y),
|
|
735
|
+
width: Number(window.width),
|
|
736
|
+
height: Number(window.height),
|
|
737
|
+
};
|
|
738
|
+
return {
|
|
739
|
+
selector: \`\${window.app_name ?? ""}:\${window.title ?? ""}\`,
|
|
740
|
+
requested: bounds,
|
|
741
|
+
observed,
|
|
742
|
+
delta: {
|
|
743
|
+
x: observed.x - bounds.x,
|
|
744
|
+
y: observed.y - bounds.y,
|
|
745
|
+
width: observed.width - bounds.width,
|
|
746
|
+
height: observed.height - bounds.height,
|
|
747
|
+
},
|
|
748
|
+
tolerance: layoutTolerance,
|
|
749
|
+
title: window.title,
|
|
750
|
+
window_id: window.window_id,
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function displayEnv() {
|
|
755
|
+
return { ...env, DISPLAY: ":99" };
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function approximatelyEqual(bounds, window) {
|
|
759
|
+
return (
|
|
760
|
+
Math.abs(bounds.x - window.x) <= layoutTolerance.x &&
|
|
761
|
+
Math.abs(bounds.y - window.y) <= layoutTolerance.y &&
|
|
762
|
+
Math.abs(bounds.width - window.width) <= layoutTolerance.width &&
|
|
763
|
+
Math.abs(bounds.height - window.height) <= layoutTolerance.height
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
function sleep(milliseconds) {
|
|
768
|
+
return delay(milliseconds, undefined, { signal: requestSignal });
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
function scrollInput(delta, negativeDirection, positiveDirection) {
|
|
772
|
+
return {
|
|
773
|
+
scope: "desktop",
|
|
774
|
+
direction: delta < 0 ? negativeDirection : positiveDirection,
|
|
775
|
+
amount: Math.min(50, Math.max(1, Math.round(Math.abs(delta) / 100))),
|
|
776
|
+
by: "line",
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
function normalizeKey(key) {
|
|
781
|
+
const aliases = {
|
|
782
|
+
ARROWDOWN: "down",
|
|
783
|
+
ARROWLEFT: "left",
|
|
784
|
+
ARROWRIGHT: "right",
|
|
785
|
+
ARROWUP: "up",
|
|
786
|
+
CMD: "meta",
|
|
787
|
+
COMMAND: "meta",
|
|
788
|
+
CONTROL: "ctrl",
|
|
789
|
+
DEL: "delete",
|
|
790
|
+
ENTER: "enter",
|
|
791
|
+
ESC: "escape",
|
|
792
|
+
OPTION: "alt",
|
|
793
|
+
RETURN: "enter",
|
|
794
|
+
};
|
|
795
|
+
return aliases[key] ?? key.toLowerCase();
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function isContentWindow(window) {
|
|
799
|
+
const identity = \`\${window.app_name ?? ""}\\n\${window.title ?? ""}\`.toLowerCase();
|
|
800
|
+
return (
|
|
801
|
+
window.width >= 200 &&
|
|
802
|
+
window.height >= 100 &&
|
|
803
|
+
!identity.includes("xfce4-panel") &&
|
|
804
|
+
!identity.includes("xfdesktop") &&
|
|
805
|
+
window.title !== "Desktop"
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
function formatState(groundingWindow, pointer, elements) {
|
|
810
|
+
const lines = [
|
|
811
|
+
groundingWindow === undefined
|
|
812
|
+
? "grounding_window\\t(none)"
|
|
813
|
+
: \`grounding_window\\t\${groundingWindow.title} pid=\${groundingWindow.pid} window_id=\${groundingWindow.window_id}\`,
|
|
814
|
+
\`pointer\\tx=\${pointer.x ?? "unknown"} y=\${pointer.y ?? "unknown"}\`,
|
|
815
|
+
"accessibility_elements",
|
|
816
|
+
];
|
|
817
|
+
|
|
818
|
+
for (const element of elements) {
|
|
819
|
+
const frame =
|
|
820
|
+
element.frame === undefined
|
|
821
|
+
? ""
|
|
822
|
+
: \` x=\${element.frame.x} y=\${element.frame.y} width=\${element.frame.w} height=\${element.frame.h}\`;
|
|
823
|
+
lines.push(
|
|
824
|
+
\`[\${element.element_index}] role=\${element.role}\${frame} label=\${JSON.stringify(element.label ?? "")}\`,
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
return lines.join("\\n");
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
function validateActionCoordinates(action) {
|
|
831
|
+
const screen = x11ScreenSize();
|
|
832
|
+
const points = [];
|
|
833
|
+
if (["click", "double_click", "triple_click", "move", "scroll"].includes(action.action)) {
|
|
834
|
+
points.push({ x: action.x, y: action.y });
|
|
835
|
+
}
|
|
836
|
+
if (action.action === "drag") points.push(...action.path);
|
|
837
|
+
for (const point of points) {
|
|
838
|
+
if (
|
|
839
|
+
!Number.isFinite(point.x) ||
|
|
840
|
+
!Number.isFinite(point.y) ||
|
|
841
|
+
point.x < 0 ||
|
|
842
|
+
point.y < 0 ||
|
|
843
|
+
point.x >= screen.width ||
|
|
844
|
+
point.y >= screen.height
|
|
845
|
+
) {
|
|
846
|
+
throw new Error(
|
|
847
|
+
\`computer-use coordinate is outside the \${screen.width}x\${screen.height} desktop\`,
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
function validateRequest(input) {
|
|
854
|
+
if (typeof input !== "object" || input === null) {
|
|
855
|
+
throw new Error("request must be an object");
|
|
856
|
+
}
|
|
857
|
+
if (!isArtifactPath(input.screenshotPath, ".png")) {
|
|
858
|
+
throw new Error("screenshot path must be a PNG under the computer-use workspace");
|
|
859
|
+
}
|
|
860
|
+
if (typeof input.action !== "object" || input.action === null) {
|
|
861
|
+
throw new Error("request action must be an object");
|
|
862
|
+
}
|
|
863
|
+
const actions = new Set([
|
|
864
|
+
"arrange_windows",
|
|
865
|
+
"click",
|
|
866
|
+
"clipboard_read",
|
|
867
|
+
"clipboard_write",
|
|
868
|
+
"double_click",
|
|
869
|
+
"drag",
|
|
870
|
+
"keypress",
|
|
871
|
+
"move",
|
|
872
|
+
"record_start",
|
|
873
|
+
"record_stop",
|
|
874
|
+
"screenshot",
|
|
875
|
+
"scroll",
|
|
876
|
+
"sequence",
|
|
877
|
+
"triple_click",
|
|
878
|
+
"type",
|
|
879
|
+
"wait",
|
|
880
|
+
]);
|
|
881
|
+
if (!actions.has(input.action.action)) {
|
|
882
|
+
throw new Error(\`unsupported computer-use action: \${String(input.action.action)}\`);
|
|
883
|
+
}
|
|
884
|
+
if (input.action.action === "sequence") {
|
|
885
|
+
if (
|
|
886
|
+
!Array.isArray(input.action.actions) ||
|
|
887
|
+
input.action.actions.length < 1 ||
|
|
888
|
+
input.action.actions.length > 30
|
|
889
|
+
) {
|
|
890
|
+
throw new Error("sequence must contain 1 to 30 actions");
|
|
891
|
+
}
|
|
892
|
+
for (const action of input.action.actions) validateNestedSequenceAction(action);
|
|
893
|
+
}
|
|
894
|
+
if (input.action.action === "arrange_windows") validateArrangeWindowsAction(input.action);
|
|
895
|
+
if (input.action.action === "record_start" && !isArtifactPath(input.action.path, ".mp4")) {
|
|
896
|
+
throw new Error("recording path must be an MP4 under the computer-use workspace");
|
|
897
|
+
}
|
|
898
|
+
if (
|
|
899
|
+
["click", "double_click", "triple_click", "drag", "move"].includes(input.action.action) &&
|
|
900
|
+
"durationMs" in input.action &&
|
|
901
|
+
(!Number.isInteger(input.action.durationMs) ||
|
|
902
|
+
input.action.durationMs < 0 ||
|
|
903
|
+
input.action.durationMs > 2000)
|
|
904
|
+
) {
|
|
905
|
+
throw new Error("pointer durationMs must be an integer from 0 to 2000");
|
|
906
|
+
}
|
|
907
|
+
validateMovementStyle(input.action, "");
|
|
908
|
+
if (
|
|
909
|
+
input.action.action === "wait" &&
|
|
910
|
+
(!Number.isInteger(input.action.durationMs) ||
|
|
911
|
+
input.action.durationMs < 100 ||
|
|
912
|
+
input.action.durationMs > 10_000)
|
|
913
|
+
) {
|
|
914
|
+
throw new Error("wait durationMs must be an integer from 100 to 10000");
|
|
915
|
+
}
|
|
916
|
+
validateClipboardOptions(input.action);
|
|
917
|
+
validateTypingOptions(input.action, "");
|
|
918
|
+
validateTypingBudget(input.action.action === "sequence" ? input.action.actions : [input.action]);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
function validateNestedSequenceAction(action) {
|
|
922
|
+
if (typeof action !== "object" || action === null)
|
|
923
|
+
throw new Error("sequence action must be an object");
|
|
924
|
+
const allowed = new Set([
|
|
925
|
+
"arrange_windows",
|
|
926
|
+
"click",
|
|
927
|
+
"double_click",
|
|
928
|
+
"drag",
|
|
929
|
+
"keypress",
|
|
930
|
+
"move",
|
|
931
|
+
"record_start",
|
|
932
|
+
"record_stop",
|
|
933
|
+
"triple_click",
|
|
934
|
+
"type",
|
|
935
|
+
"wait",
|
|
936
|
+
]);
|
|
937
|
+
if (!allowed.has(action.action))
|
|
938
|
+
throw new Error(\`unsupported sequence action: \${String(action.action)}\`);
|
|
939
|
+
if (action.action === "arrange_windows") validateArrangeWindowsAction(action);
|
|
940
|
+
if (action.action === "record_start" && !isArtifactPath(action.path, ".mp4")) {
|
|
941
|
+
throw new Error("sequence recording path must be an MP4 under the computer-use workspace");
|
|
942
|
+
}
|
|
943
|
+
if (
|
|
944
|
+
["click", "double_click", "triple_click", "drag", "move"].includes(action.action) &&
|
|
945
|
+
"durationMs" in action &&
|
|
946
|
+
(!Number.isInteger(action.durationMs) || action.durationMs < 0 || action.durationMs > 2000)
|
|
947
|
+
) {
|
|
948
|
+
throw new Error("sequence pointer durationMs must be an integer from 0 to 2000");
|
|
949
|
+
}
|
|
950
|
+
validateMovementStyle(action, "sequence ");
|
|
951
|
+
if (
|
|
952
|
+
action.action === "wait" &&
|
|
953
|
+
(!Number.isInteger(action.durationMs) || action.durationMs < 100 || action.durationMs > 10_000)
|
|
954
|
+
) {
|
|
955
|
+
throw new Error("sequence wait durationMs must be an integer from 100 to 10000");
|
|
956
|
+
}
|
|
957
|
+
if (action.action === "type") validateTypingOptions(action, "sequence ");
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
function validateMovementStyle(action, prefix) {
|
|
961
|
+
if (
|
|
962
|
+
"movementStyle" in action &&
|
|
963
|
+
action.movementStyle !== "natural" &&
|
|
964
|
+
action.movementStyle !== "precision"
|
|
965
|
+
) {
|
|
966
|
+
throw new Error(\`\${prefix}movementStyle must be natural or precision\`);
|
|
967
|
+
}
|
|
968
|
+
if (
|
|
969
|
+
action.action === "drag" &&
|
|
970
|
+
"movementStyle" in action &&
|
|
971
|
+
action.movementStyle !== "precision"
|
|
972
|
+
) {
|
|
973
|
+
throw new Error(\`\${prefix}drag movementStyle must be precision\`);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
function validateClipboardOptions(action) {
|
|
978
|
+
if (
|
|
979
|
+
["clipboard_read", "clipboard_write"].includes(action.action) &&
|
|
980
|
+
action.selection !== "clipboard" &&
|
|
981
|
+
action.selection !== "primary"
|
|
982
|
+
) {
|
|
983
|
+
throw new Error("clipboard selection must be clipboard or primary");
|
|
984
|
+
}
|
|
985
|
+
if (
|
|
986
|
+
action.action === "clipboard_write" &&
|
|
987
|
+
(typeof action.text !== "string" || Buffer.byteLength(action.text) > maxClipboardBytes)
|
|
988
|
+
) {
|
|
989
|
+
throw new Error(\`clipboard text must be at most \${maxClipboardBytes} bytes\`);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
function validateTypingOptions(action, prefix) {
|
|
994
|
+
if (
|
|
995
|
+
"typingDelayMs" in action &&
|
|
996
|
+
(!Number.isInteger(action.typingDelayMs) ||
|
|
997
|
+
action.typingDelayMs < 0 ||
|
|
998
|
+
action.typingDelayMs > 200)
|
|
999
|
+
) {
|
|
1000
|
+
throw new Error(\`\${prefix}typingDelayMs must be an integer from 0 to 200\`);
|
|
1001
|
+
}
|
|
1002
|
+
if ("typingStyle" in action && action.typingStyle !== "natural") {
|
|
1003
|
+
throw new Error(\`\${prefix}typingStyle must be natural\`);
|
|
1004
|
+
}
|
|
1005
|
+
if ("typingStyle" in action && "typingDelayMs" in action) {
|
|
1006
|
+
throw new Error(\`\${prefix}type action cannot set both typingStyle and typingDelayMs\`);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
function validateArrangeWindowsAction(action) {
|
|
1011
|
+
if (!Number.isInteger(action.waitForMs) || action.waitForMs < 0 || action.waitForMs > 10_000) {
|
|
1012
|
+
throw new Error("arrange_windows waitForMs must be an integer from 0 to 10000");
|
|
1013
|
+
}
|
|
1014
|
+
validateWindowScene(action.windows);
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
function isArtifactPath(value, extension) {
|
|
1018
|
+
if (typeof value !== "string" || !value.endsWith(extension)) return false;
|
|
1019
|
+
const path = resolve(value);
|
|
1020
|
+
return dirname(path) === workspaceRoot;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
async function readBody(request) {
|
|
1024
|
+
let body = "";
|
|
1025
|
+
for await (const chunk of request) {
|
|
1026
|
+
body += chunk;
|
|
1027
|
+
if (Buffer.byteLength(body) > maxRequestBytes) {
|
|
1028
|
+
throw new Error("request exceeds 32 KiB");
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
return body;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
function sendJson(response, statusCode, body) {
|
|
1035
|
+
if (response.destroyed) return;
|
|
1036
|
+
const json = JSON.stringify(body);
|
|
1037
|
+
response.writeHead(statusCode, {
|
|
1038
|
+
"content-length": Buffer.byteLength(json),
|
|
1039
|
+
"content-type": "application/json",
|
|
1040
|
+
});
|
|
1041
|
+
response.end(json);
|
|
1042
|
+
}
|
|
1043
|
+
`,CLIENT_MJS_SOURCE=`import http from "node:http";
|
|
1044
|
+
import { env } from "node:process";
|
|
1045
|
+
|
|
1046
|
+
const socketPath = env.COMPUTER_USE_SOCKET_PATH;
|
|
1047
|
+
const body = env.COMPUTER_USE_REQUEST;
|
|
1048
|
+
|
|
1049
|
+
if (body === undefined) {
|
|
1050
|
+
throw new Error("COMPUTER_USE_REQUEST is required");
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
const deadline = Date.now() + 120_000;
|
|
1054
|
+
const response = await new Promise((resolve, reject) => {
|
|
1055
|
+
const request = http.request(
|
|
1056
|
+
{
|
|
1057
|
+
socketPath,
|
|
1058
|
+
method: "POST",
|
|
1059
|
+
path: "/call",
|
|
1060
|
+
headers: {
|
|
1061
|
+
"content-length": Buffer.byteLength(body),
|
|
1062
|
+
"content-type": "application/json",
|
|
1063
|
+
"x-computer-use-deadline": String(deadline),
|
|
1064
|
+
},
|
|
1065
|
+
},
|
|
1066
|
+
(incoming) => {
|
|
1067
|
+
incoming.on("error", reject);
|
|
1068
|
+
incoming.setEncoding("utf8");
|
|
1069
|
+
let responseBody = "";
|
|
1070
|
+
incoming.on("data", (chunk) => {
|
|
1071
|
+
responseBody += chunk;
|
|
1072
|
+
});
|
|
1073
|
+
incoming.on("end", () => {
|
|
1074
|
+
resolve({ body: responseBody, statusCode: incoming.statusCode ?? 500 });
|
|
1075
|
+
});
|
|
1076
|
+
},
|
|
1077
|
+
);
|
|
1078
|
+
const timer = setTimeout(
|
|
1079
|
+
() => request.destroy(new Error("computer-use request deadline exceeded")),
|
|
1080
|
+
Math.max(0, deadline - Date.now()),
|
|
1081
|
+
);
|
|
1082
|
+
request.once("close", () => clearTimeout(timer));
|
|
1083
|
+
request.on("error", reject);
|
|
1084
|
+
request.end(body);
|
|
1085
|
+
});
|
|
1086
|
+
|
|
1087
|
+
if (response.statusCode !== 200) {
|
|
1088
|
+
process.stderr.write(response.body);
|
|
1089
|
+
process.exitCode = 1;
|
|
1090
|
+
} else {
|
|
1091
|
+
process.stdout.write(response.body);
|
|
1092
|
+
}
|
|
1093
|
+
`,STATE_MJS_SOURCE=`const MAX_GROUNDING_ELEMENTS = 80;
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* @typedef {{
|
|
1097
|
+
* element_index?: number;
|
|
1098
|
+
* frame?: { h?: number; w?: number; x?: number; y?: number };
|
|
1099
|
+
* label?: unknown;
|
|
1100
|
+
* [key: string]: unknown;
|
|
1101
|
+
* }} GroundingElement
|
|
1102
|
+
*/
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* Keep the model-facing state aligned with the visible desktop screenshot.
|
|
1106
|
+
*
|
|
1107
|
+
* @param {unknown[]} elements
|
|
1108
|
+
* @returns {GroundingElement[]}
|
|
1109
|
+
*/
|
|
1110
|
+
export function selectGroundingElements(elements, screen = { width: 1920, height: 1080 }) {
|
|
1111
|
+
return elements
|
|
1112
|
+
.filter((element) => isVisibleLabeledElement(element, screen))
|
|
1113
|
+
.slice(0, MAX_GROUNDING_ELEMENTS);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* @param {unknown} value
|
|
1118
|
+
* @returns {value is GroundingElement}
|
|
1119
|
+
*/
|
|
1120
|
+
function isVisibleLabeledElement(value, screen) {
|
|
1121
|
+
if (typeof value !== "object" || value === null) return false;
|
|
1122
|
+
const element = /** @type {GroundingElement} */ (value);
|
|
1123
|
+
const frame = element.frame;
|
|
1124
|
+
if (typeof element.label !== "string" || element.label.trim().length === 0) return false;
|
|
1125
|
+
if (typeof frame !== "object" || frame === null) return false;
|
|
1126
|
+
if (
|
|
1127
|
+
!Number.isFinite(frame.x) ||
|
|
1128
|
+
!Number.isFinite(frame.y) ||
|
|
1129
|
+
!Number.isFinite(frame.w) ||
|
|
1130
|
+
!Number.isFinite(frame.h)
|
|
1131
|
+
) {
|
|
1132
|
+
return false;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
const x = /** @type {number} */ (frame.x);
|
|
1136
|
+
const y = /** @type {number} */ (frame.y);
|
|
1137
|
+
const width = /** @type {number} */ (frame.w);
|
|
1138
|
+
const height = /** @type {number} */ (frame.h);
|
|
1139
|
+
return (
|
|
1140
|
+
width > 0 &&
|
|
1141
|
+
height > 0 &&
|
|
1142
|
+
x < screen.width &&
|
|
1143
|
+
y < screen.height &&
|
|
1144
|
+
x + width > 0 &&
|
|
1145
|
+
y + height > 0
|
|
1146
|
+
);
|
|
1147
|
+
}
|
|
1148
|
+
`,TYPING_MJS_SOURCE=`const DEMO_TYPING_SPEED = 1.2;
|
|
1149
|
+
const MIN_DELAY_MS = 35;
|
|
1150
|
+
const MAX_DELAY_MS = 220;
|
|
1151
|
+
|
|
1152
|
+
export function naturalTypingPlan(text) {
|
|
1153
|
+
const graphemes = [...new Intl.Segmenter().segment(text)].map(({ segment }) => segment);
|
|
1154
|
+
let state = hashText(text) || 1;
|
|
1155
|
+
return graphemes.map((grapheme, index) => {
|
|
1156
|
+
state = nextState(state);
|
|
1157
|
+
return {
|
|
1158
|
+
grapheme,
|
|
1159
|
+
delayMs: index === graphemes.length - 1 ? 0 : naturalDelay(grapheme, state),
|
|
1160
|
+
};
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
function naturalDelay(grapheme, state) {
|
|
1165
|
+
const jitter = state / 0x1_0000_0000;
|
|
1166
|
+
const range = delayRange(grapheme);
|
|
1167
|
+
return Math.round((range.min + (range.max - range.min) * jitter) / DEMO_TYPING_SPEED);
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
function delayRange(grapheme) {
|
|
1171
|
+
if (/\\s/u.test(grapheme)) return { min: 75, max: 125 };
|
|
1172
|
+
if (/[.!?]/u.test(grapheme)) return { min: 145, max: MAX_DELAY_MS };
|
|
1173
|
+
if (/[/|;&]/u.test(grapheme)) return { min: 105, max: 175 };
|
|
1174
|
+
if (/[-_=,:]/u.test(grapheme)) return { min: 70, max: 125 };
|
|
1175
|
+
return { min: MIN_DELAY_MS, max: 85 };
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
function hashText(text) {
|
|
1179
|
+
let hash = 2166136261;
|
|
1180
|
+
for (const character of text) {
|
|
1181
|
+
hash ^= character.codePointAt(0);
|
|
1182
|
+
hash = Math.imul(hash, 16777619);
|
|
1183
|
+
}
|
|
1184
|
+
return hash >>> 0;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
function nextState(state) {
|
|
1188
|
+
let value = state;
|
|
1189
|
+
value ^= value << 13;
|
|
1190
|
+
value ^= value >>> 17;
|
|
1191
|
+
value ^= value << 5;
|
|
1192
|
+
return value >>> 0;
|
|
1193
|
+
}
|
|
1194
|
+
`,POINTER_MOTION_MJS_SOURCE=`const FRAME_MS = 16;
|
|
1195
|
+
|
|
1196
|
+
export function pointerMotionPlan(start, end, options = {}) {
|
|
1197
|
+
const style = options.style ?? "natural";
|
|
1198
|
+
const distance = Math.hypot(end.x - start.x, end.y - start.y);
|
|
1199
|
+
const durationMs = options.durationMs ?? naturalDuration(distance, style);
|
|
1200
|
+
if (distance < 2 || durationMs === 0) {
|
|
1201
|
+
return { phases: [[{ ...end, delayMs: 0 }]], settleMs: 0 };
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
if (style === "precision" && distance >= 120) {
|
|
1205
|
+
const ratio = 0.92 + deterministicUnit(start, end, 7) * 0.04;
|
|
1206
|
+
const undershoot = {
|
|
1207
|
+
x: Math.round(start.x + (end.x - start.x) * ratio),
|
|
1208
|
+
y: Math.round(start.y + (end.y - start.y) * ratio),
|
|
1209
|
+
};
|
|
1210
|
+
// Cover most of the distance quickly, then spend a disproportionate
|
|
1211
|
+
// share of the duration continuously correcting the final 4–8%.
|
|
1212
|
+
const firstDuration = Math.round(durationMs * 0.62);
|
|
1213
|
+
return {
|
|
1214
|
+
phases: [
|
|
1215
|
+
bezierPhase(start, undershoot, firstDuration, "natural", 11),
|
|
1216
|
+
bezierPhase(undershoot, end, durationMs - firstDuration, "precision", 23),
|
|
1217
|
+
],
|
|
1218
|
+
settleMs: 0,
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
return {
|
|
1223
|
+
phases: [bezierPhase(start, end, durationMs, style, 17)],
|
|
1224
|
+
settleMs: style === "natural" ? 15 + Math.round(deterministicUnit(start, end, 31) * 15) : 0,
|
|
1225
|
+
};
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
function bezierPhase(start, end, durationMs, style, salt) {
|
|
1229
|
+
const distance = Math.hypot(end.x - start.x, end.y - start.y);
|
|
1230
|
+
const steps = Math.max(2, Math.min(60, Math.round(durationMs / FRAME_MS)));
|
|
1231
|
+
const perpendicular = unitPerpendicular(start, end);
|
|
1232
|
+
const bendLimit = style === "precision" ? 8 : Math.min(70, distance * 0.09);
|
|
1233
|
+
const bend = (deterministicUnit(start, end, salt) * 2 - 1) * bendLimit;
|
|
1234
|
+
const c1 = {
|
|
1235
|
+
x: start.x + (end.x - start.x) * 0.28 + perpendicular.x * bend,
|
|
1236
|
+
y: start.y + (end.y - start.y) * 0.28 + perpendicular.y * bend,
|
|
1237
|
+
};
|
|
1238
|
+
const c2 = {
|
|
1239
|
+
x: start.x + (end.x - start.x) * 0.76 + perpendicular.x * bend * 0.65,
|
|
1240
|
+
y: start.y + (end.y - start.y) * 0.76 + perpendicular.y * bend * 0.65,
|
|
1241
|
+
};
|
|
1242
|
+
const delayMs = durationMs / steps;
|
|
1243
|
+
return Array.from({ length: steps }, (_, index) => {
|
|
1244
|
+
// This asymmetric timing curve accelerates quickly and eases into the
|
|
1245
|
+
// target without the perfectly mirrored feel of smoothstep.
|
|
1246
|
+
const progress = (index + 1) / steps;
|
|
1247
|
+
const t = 1 - (1 - progress) ** 2.35;
|
|
1248
|
+
const point = cubicBezier(start, c1, c2, end, t);
|
|
1249
|
+
return {
|
|
1250
|
+
x: index === steps - 1 ? end.x : Math.round(point.x),
|
|
1251
|
+
y: index === steps - 1 ? end.y : Math.round(point.y),
|
|
1252
|
+
delayMs: index === steps - 1 ? 0 : delayMs,
|
|
1253
|
+
};
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
function cubicBezier(start, c1, c2, end, t) {
|
|
1258
|
+
const inverse = 1 - t;
|
|
1259
|
+
return {
|
|
1260
|
+
x:
|
|
1261
|
+
inverse ** 3 * start.x +
|
|
1262
|
+
3 * inverse ** 2 * t * c1.x +
|
|
1263
|
+
3 * inverse * t ** 2 * c2.x +
|
|
1264
|
+
t ** 3 * end.x,
|
|
1265
|
+
y:
|
|
1266
|
+
inverse ** 3 * start.y +
|
|
1267
|
+
3 * inverse ** 2 * t * c1.y +
|
|
1268
|
+
3 * inverse * t ** 2 * c2.y +
|
|
1269
|
+
t ** 3 * end.y,
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
function naturalDuration(distance, style) {
|
|
1274
|
+
const base = style === "precision" ? 150 : 110;
|
|
1275
|
+
const scale = style === "precision" ? 0.35 : 0.28;
|
|
1276
|
+
const minimum = style === "precision" ? 180 : 140;
|
|
1277
|
+
const maximum = style === "precision" ? 650 : 550;
|
|
1278
|
+
return Math.round(Math.min(maximum, Math.max(minimum, base + distance * scale)));
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
function unitPerpendicular(start, end) {
|
|
1282
|
+
const dx = end.x - start.x;
|
|
1283
|
+
const dy = end.y - start.y;
|
|
1284
|
+
const length = Math.hypot(dx, dy) || 1;
|
|
1285
|
+
return { x: -dy / length, y: dx / length };
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
function deterministicUnit(start, end, salt) {
|
|
1289
|
+
let value =
|
|
1290
|
+
(Math.imul(Math.round(start.x), 73_856_093) ^
|
|
1291
|
+
Math.imul(Math.round(start.y), 19_349_663) ^
|
|
1292
|
+
Math.imul(Math.round(end.x), 83_492_791) ^
|
|
1293
|
+
Math.imul(Math.round(end.y), 2_654_435_761) ^
|
|
1294
|
+
salt) >>>
|
|
1295
|
+
0;
|
|
1296
|
+
value ^= value << 13;
|
|
1297
|
+
value ^= value >>> 17;
|
|
1298
|
+
value ^= value << 5;
|
|
1299
|
+
return (value >>> 0) / 0x1_0000_0000;
|
|
1300
|
+
}
|
|
1301
|
+
`,PACKAGE_JSON_SOURCE=`{
|
|
1302
|
+
"name": "computer-use-driver",
|
|
1303
|
+
"private": true,
|
|
1304
|
+
"type": "module",
|
|
1305
|
+
"dependencies": {
|
|
1306
|
+
"@trycua/cua-driver": "0.12.5"
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
`,COMPUTER_USE_DRIVER_SOURCES={"server.mjs":SERVER_MJS_SOURCE,"client.mjs":CLIENT_MJS_SOURCE,"state.mjs":STATE_MJS_SOURCE,"typing.mjs":TYPING_MJS_SOURCE,"pointer-motion.mjs":POINTER_MOTION_MJS_SOURCE,"package.json":PACKAGE_JSON_SOURCE};export{CLIENT_MJS_SOURCE,COMPUTER_USE_DRIVER_SOURCES,PACKAGE_JSON_SOURCE,POINTER_MOTION_MJS_SOURCE,SERVER_MJS_SOURCE,STATE_MJS_SOURCE,TYPING_MJS_SOURCE};
|