eve 0.64.1 → 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 +42 -0
- package/README.md +1 -2
- package/dist/src/_virtual/_rolldown/runtime.js +1 -1
- package/dist/src/channel/resolve-text.d.ts +11 -7
- package/dist/src/channel/resolve-text.js +1 -1
- package/dist/src/channel/types.d.ts +4 -5
- package/dist/src/chunks/{use-eve-agent-BdKlQF32.js → use-eve-agent-BUeSjwIk.js} +244 -11
- package/dist/src/chunks/{use-eve-agent-IIuxkn6y.js → use-eve-agent-ydPlURM4.js} +244 -11
- package/dist/src/cli/dev/command-options.d.ts +1 -0
- package/dist/src/cli/dev/command.js +2 -2
- package/dist/src/cli/dev/local-server-process.js +1 -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.d.ts +1 -1
- package/dist/src/cli/dev/tui/blocks.js +2 -2
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/question-panel.d.ts +3 -2
- package/dist/src/cli/dev/tui/rail.d.ts +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 -12
- package/dist/src/cli/dev/tui/test/fake-setup-flow-renderer.js +1 -1
- package/dist/src/cli/dev/tui/theme.d.ts +1 -1
- package/dist/src/cli/dev/tui/tool-presentation.d.ts +4 -4
- package/dist/src/cli/dev/tui/tool-presentation.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/agent-info-schema.d.ts +0 -2
- package/dist/src/client/agent-info-schema.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 -3
- 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/{@workflow/builders/LICENSE.md → @vercel/sdk/LICENSE} +2 -2
- 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/artifacts.d.ts +2 -0
- package/dist/src/compiler/artifacts.js +1 -1
- package/dist/src/compiler/bundled-extension.d.ts +17 -0
- package/dist/src/compiler/bundled-extension.js +1 -0
- package/dist/src/compiler/compile-agent.d.ts +4 -0
- package/dist/src/compiler/compile-agent.js +1 -1
- package/dist/src/compiler/compile-from-memory.js +1 -1
- package/dist/src/compiler/development-extensions.d.ts +23 -0
- package/dist/src/compiler/development-extensions.js +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +20 -14
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/load-binding-namespace.js +1 -1
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
- package/dist/src/compiler/normalize-manifest-types.d.ts +23 -0
- package/dist/src/compiler/normalize-manifest.d.ts +2 -7
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/source-graph-paths.d.ts +2 -0
- package/dist/src/compiler/source-graph-paths.js +1 -0
- package/dist/src/compiler/source-graph.d.ts +4 -1
- package/dist/src/compiler/source-graph.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/discover/bundled-extension.d.ts +11 -0
- package/dist/src/discover/bundled-extension.js +1 -0
- package/dist/src/discover/discover-agent.js +1 -1
- package/dist/src/discover/manifest.d.ts +5 -0
- package/dist/src/evals/assertions/collector.js +1 -1
- package/dist/src/evals/cli/eval.js +2 -2
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/types.d.ts +2 -0
- package/dist/src/execution/coordination-dispatch-step.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/node-step.d.ts +2 -4
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/proxied-deliver-step.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/glob-tool.js +1 -1
- package/dist/src/execution/sandbox/grep-tool.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/read-file.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/session-workflow-tool-run.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/tasks/parent/tool-execution.js +1 -1
- 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.d.ts +11 -0
- package/dist/src/execution/tools/ask-question-workflow.js +1 -0
- package/dist/src/execution/tools/ask-question.d.ts +19 -0
- package/dist/src/execution/tools/ask-question.js +2 -0
- package/dist/src/execution/tools/connection-search.js +1 -1
- package/dist/src/execution/tools/file-state.d.ts +1 -7
- package/dist/src/execution/tools/file-state.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/answer.d.ts +2 -0
- package/dist/src/execution/tools/workflow/answer.js +1 -1
- package/dist/src/execution/tools/workflow/ask.d.ts +3 -2
- package/dist/src/execution/tools/workflow/ask.js +1 -1
- package/dist/src/execution/tools/workflow/body.d.ts +5 -0
- package/dist/src/execution/tools/workflow/body.js +1 -1
- package/dist/src/execution/tools/workflow/cancel.d.ts +0 -4
- package/dist/src/execution/tools/workflow/cancel.js +1 -1
- package/dist/src/execution/tools/workflow/start.d.ts +1 -0
- package/dist/src/execution/tools/workflow/start.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/framework/sources/registry.js +1 -1
- package/dist/src/harness/compaction-prompt.d.ts +0 -6
- package/dist/src/harness/compaction-prompt.js +2 -2
- package/dist/src/harness/compaction.js +1 -1
- package/dist/src/harness/final-output.js +1 -1
- package/dist/src/harness/hitl/approval-input-requests.d.ts +0 -2
- package/dist/src/harness/hitl/approval-input-requests.js +1 -1
- package/dist/src/harness/input-extraction.d.ts +4 -15
- package/dist/src/harness/input-extraction.js +1 -1
- package/dist/src/harness/input-request-class.d.ts +0 -20
- package/dist/src/harness/input-request-class.js +1 -1
- package/dist/src/harness/input-requests.d.ts +1 -1
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/pending-input-batches.d.ts +1 -1
- package/dist/src/harness/proxy-input-requests.d.ts +9 -1
- package/dist/src/harness/proxy-input-requests.js +1 -1
- package/dist/src/harness/stale-input-responses.d.ts +1 -2
- package/dist/src/harness/stale-input-responses.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tools.d.ts +0 -9
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/harness/types.d.ts +2 -9
- 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/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/authored-module-loader.js +1 -1
- package/dist/src/internal/development-programmatic-source-loader.d.ts +6 -0
- package/dist/src/internal/development-programmatic-source-loader.js +1 -0
- package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.d.ts +2 -0
- package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
- package/dist/src/internal/nitro/host/dev-workspace-extensions.js +1 -1
- package/dist/src/internal/nitro/host/prepare-application-host.d.ts +2 -0
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/nitro/host/types.d.ts +3 -0
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +0 -2
- package/dist/src/internal/workflow-bundle/workflow-builders.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/public/tools/ask-question.d.ts +1 -1
- package/dist/src/public/tools/ask-question.js +1 -1
- package/dist/src/runtime/agent/mock-model-fixtures.js +2 -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/instructions.js +6 -2
- 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/input.d.ts +1 -6
- 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/subagents/hitl-proxy.d.ts +11 -1
- package/dist/src/subagents/hitl-proxy.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/behavior.d.ts +2 -5
- package/dist/src/tools/definition.d.ts +23 -5
- 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/ask-question.d.ts +18 -0
- package/dist/src/tools/provided/ask-question.js +1 -0
- 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/sleep.d.ts +2 -2
- 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/agent-config.md +11 -11
- package/docs/channels/slack.mdx +1 -1
- package/docs/concepts/built-in-tools.md +16 -66
- package/docs/concepts/default-harness.md +1 -3
- package/docs/concepts/execution-model-and-durability.mdx +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +2 -2
- package/docs/connections/overview.mdx +1 -1
- package/docs/evals/assertions.mdx +2 -2
- package/docs/evals/judge.mdx +3 -3
- package/docs/extensions.md +4 -0
- package/docs/getting-started.mdx +2 -2
- package/docs/guides/deployment/vercel.mdx +6 -0
- package/docs/guides/dev-tui.md +2 -2
- package/docs/guides/dynamic-capabilities.md +2 -0
- package/docs/guides/evaluate.md +12 -9
- package/docs/guides/frontend/overview.mdx +1 -1
- 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 +10 -7
- package/docs/reference/typescript-api.md +42 -42
- package/docs/sandbox/index.mdx +11 -0
- package/docs/skills.mdx +5 -10
- package/docs/subagents/index.mdx +7 -5
- package/docs/tools/human-in-the-loop.md +22 -11
- package/docs/tools/overview.mdx +7 -1
- package/docs/tools/workflows.mdx +45 -20
- package/docs/tutorial/guard-the-spend.mdx +1 -1
- package/package.json +30 -9
- 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/cli/dev/tui/todo-panel.d.ts +0 -44
- package/dist/src/cli/dev/tui/todo-panel.js +0 -1
- package/dist/src/compiled/@workflow/builders/index.d.ts +0 -62
- package/dist/src/compiled/@workflow/builders/index.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/execution/compaction.d.ts +0 -14
- package/dist/src/execution/compaction.js +0 -1
- package/dist/src/execution/tools/todo.d.ts +0 -91
- package/dist/src/execution/tools/todo.js +0 -2
- package/dist/src/harness/hitl/question-input-requests.d.ts +0 -15
- package/dist/src/harness/hitl/question-input-requests.js +0 -1
- package/dist/src/harness/request-input-tool.d.ts +0 -4
- package/dist/src/harness/request-input-tool.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/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/public/tools/todo.d.ts +0 -3
- package/dist/src/public/tools/todo.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
- package/dist/src/tools/framework/ask-question.d.ts +0 -38
- package/dist/src/tools/framework/ask-question.js +0 -1
- package/dist/src/tools/provided/todo.d.ts +0 -8
- package/dist/src/tools/provided/todo.js +0 -2
- /package/dist/src/{node_modules/.pnpm/zod@4.5.4/node_modules/zod/v3/helpers/typeAliases.js → compiler/normalize-manifest-types.js} +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { SandboxSession } from "eve/sandbox";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export type CredentialPolicyBroker = (sandbox: SandboxSession, rules: Record<string, Record<string, string>>) => Promise<void>;
|
|
4
|
+
export interface GitHubLeaseRule {
|
|
5
|
+
readonly match?: {
|
|
6
|
+
readonly headers?: readonly {
|
|
7
|
+
readonly key?: {
|
|
8
|
+
readonly exact: string;
|
|
9
|
+
};
|
|
10
|
+
readonly value?: {
|
|
11
|
+
readonly exact?: string;
|
|
12
|
+
readonly regex?: string;
|
|
13
|
+
};
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
readonly transform: readonly {
|
|
17
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
20
|
+
export type GitHubLeaseBroker = (sandbox: SandboxSession, rules: Readonly<Record<string, readonly GitHubLeaseRule[]>> | null) => Promise<void>;
|
|
21
|
+
declare const _default: import("eve/extension").ExtensionHandle<z.ZodObject<{
|
|
22
|
+
github: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
connector: z.ZodString;
|
|
24
|
+
org: z.ZodString;
|
|
25
|
+
broker: z.ZodCustom<GitHubLeaseBroker, GitHubLeaseBroker>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
vercel: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
connector: z.ZodString;
|
|
29
|
+
delivery: z.ZodDefault<z.ZodEnum<{
|
|
30
|
+
command: "command";
|
|
31
|
+
firewall: "firewall";
|
|
32
|
+
}>>;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
broker: z.ZodOptional<z.ZodCustom<CredentialPolicyBroker, CredentialPolicyBroker>>;
|
|
35
|
+
worker: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
model: z.ZodString;
|
|
37
|
+
reasoning: z.ZodEnum<{
|
|
38
|
+
high: "high";
|
|
39
|
+
low: "low";
|
|
40
|
+
medium: "medium";
|
|
41
|
+
minimal: "minimal";
|
|
42
|
+
none: "none";
|
|
43
|
+
"provider-default": "provider-default";
|
|
44
|
+
xhigh: "xhigh";
|
|
45
|
+
}>;
|
|
46
|
+
openaiReasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
47
|
+
high: "high";
|
|
48
|
+
low: "low";
|
|
49
|
+
max: "max";
|
|
50
|
+
medium: "medium";
|
|
51
|
+
minimal: "minimal";
|
|
52
|
+
none: "none";
|
|
53
|
+
xhigh: "xhigh";
|
|
54
|
+
}>>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{defineExtension}from"eve/extension";const fn=()=>z.custom(e=>typeof e==`function`),delivery=z.enum([`firewall`,`command`]).default(`firewall`),reasoning=z.enum([`provider-default`,`none`,`minimal`,`low`,`medium`,`high`,`xhigh`]),openaiReasoningEffort=z.enum([`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]);var extension_default=defineExtension({config:z.object({github:z.object({connector:z.string().min(1),org:z.string().min(1),broker:fn()}).optional(),vercel:z.object({connector:z.string().min(1),delivery}).optional(),broker:fn().optional(),worker:z.object({model:z.string().min(1),reasoning,openaiReasoningEffort:openaiReasoningEffort.optional()}).optional()})});export{extension_default as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import extension_default from"../extension.js";import{authenticateTurn}from"../lib/connect-authentication.js";import{defineHook}from"eve/hooks";var authenticate_default=defineHook({events:{async"turn.started"(e,t){await authenticateTurn(extension_default.config,()=>t.getSandbox())}}});export{authenticate_default as default};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Principles
|
|
2
|
+
|
|
3
|
+
This is an eve extension that enables coding capabilities.
|
|
4
|
+
|
|
5
|
+
You are extremely autonomous. Fully leverage your capabilities to get the job done.
|
|
6
|
+
|
|
7
|
+
Simplicity prevails almost always. Simple language: clear, to the point, least amount of new concepts to the reader. Same for implementation. Noise-free.
|
|
8
|
+
|
|
9
|
+
Prefer action over ceremony. A list, status ritual, or extra plan is only worth a turn when losing the thread would cost more than writing it.
|
|
10
|
+
|
|
11
|
+
# Communication guidelines
|
|
12
|
+
|
|
13
|
+
Communication happens on an instant messaging app. The reader did not see your tool calls. Lead with the answer. The final message stands alone. Be brief.
|
|
14
|
+
|
|
15
|
+
If the next cut depends on an unstated constraint, ask one question. Otherwise decide and proceed.
|
|
16
|
+
|
|
17
|
+
# Minds
|
|
18
|
+
|
|
19
|
+
Hold the other people in the work. The requester named an outcome, not a procedure. The reader did not see your tools. A future maintainer pays for every new concept. A worker is another mind with one slice and a chosen lifetime: own that slice end to end, or answer once. You are the arbiter of writes, cross-slice decisions, and disagreement. Evidence does not care what you hoped.
|
|
20
|
+
|
|
21
|
+
# Execution
|
|
22
|
+
|
|
23
|
+
Match action to the request. An answer, explanation, review, status report, diagnosis, or plan authorizes relevant read-only inspection and a reply, not workspace edits, publication, cross-posts, or other external writes. Diagnose and explain causes without implementing a fix unless asked. Build or change the workspace only when the requester asks for implementation. Publish or perform another external write only when the requester explicitly asks for it or names a delivery outcome that requires it. Persistence never expands authority.
|
|
24
|
+
|
|
25
|
+
Break the work down. When multiple read-only calls are independently useful, emit them in the same response. eve executes calls from one response concurrently. Do not wait for one result unless it determines whether the next call is valid. Serialize work that depends on earlier results.
|
|
26
|
+
|
|
27
|
+
Work streams that can run apart should. Identify independent slices a worker can own and start independent calls together. Give each one a self-contained question with repositories, paths or refs, constraints, and expected output. The tree is already shared, so do not copy full source. Choose the lifetime: keep the collaborator and send follow-ups as deltas when it should own the slice end to end, or spawn ephemerally and ask once. Isolated context is the point; do not make delegation lossy. Writes stay here so workers never compete to mutate the shared workspace.
|
|
28
|
+
|
|
29
|
+
Make extensive use of parallelism to speed things up.
|
|
30
|
+
|
|
31
|
+
Cost-sensitive: do not spend tokens on unbounded work like tracking; ask permission first. For bounded tasks, do not call `todo`; begin the work directly instead of spending a model turn maintaining a plan. Use `todo` only for long-running or open-ended work where losing the thread would cost more than writing it.
|
|
32
|
+
|
|
33
|
+
## Issues and bugs
|
|
34
|
+
|
|
35
|
+
Required steps, in order:
|
|
36
|
+
|
|
37
|
+
1. Clear, precise and concrete understanding of the issue.
|
|
38
|
+
- Ideal: each and every evidence of the issue possible.
|
|
39
|
+
- Why this is happening only now? What has changed?
|
|
40
|
+
2. Precise and unambiguous reproduction of stated issue.
|
|
41
|
+
3. Hypothesis derived from actual, detailed and sound reasoning chain.
|
|
42
|
+
|
|
43
|
+
## Analysis and design
|
|
44
|
+
|
|
45
|
+
1. What are the fundamental constraints?
|
|
46
|
+
- Any noteworthy data flows? Which entry points trigger relevant codepaths?
|
|
47
|
+
- What is the history of change of this area of the codebase?
|
|
48
|
+
2. What is the simplest cut to be made to achieve desired state?
|
|
49
|
+
|
|
50
|
+
# Repository work
|
|
51
|
+
|
|
52
|
+
GitHub credentials are not available to ordinary `bash`. Use the `gh` tool for every authenticated GitHub operation. The full `gh` CLI surface is available. Declare exactly one repository in the configured organization with write-capable access. Authenticated commands run without an approval prompt; describe the intended GitHub-side result accurately in `description`. Connect mints the real token for only the declared repository. The sandbox process receives only a placeholder `GH_TOKEN`, and the firewall exchanges it on matching GitHub requests. GitHub rejects access outside the token's server-side repository scope. Never put credentials in URLs or commands. If access is denied, report it plainly and stop.
|
|
53
|
+
|
|
54
|
+
Pass commands as simple argv with ordinary quoting. Do not use environment assignments, pipes, redirects, substitutions, or other shell syntax. Commands without an explicit repository may use normal `gh` context, but their token remains scoped to the declared repository. An explicit `-R`, `--repo`, `--repo=`, or repository argument to `gh repo clone`, `view`, or `fork` must match the declaration.
|
|
55
|
+
|
|
56
|
+
Determine the repositories needed to complete the task through source discovery and investigation, even when the requester does not name them. Do not ask the requester to enumerate repositories that can be discovered, and never default to the current agent's repository. The agent may select additional repositories as the work reveals them. Each authenticated command declares exactly one target repository and mints a credential lease for that repository at the moment it is needed, so cross-repository work uses separate scoped commands and leases.
|
|
57
|
+
|
|
58
|
+
Clone with `gh repo clone owner/name`. Use authenticated `git fetch`, `git pull`, `git push`, and `git ls-remote` through the `gh` tool too. Local `git status`, `diff`, `add`, `commit`, and `rebase` remain ordinary `bash` commands because they need no GitHub credential. Immediately after entering a checkout and before planning or editing, read its root `AGENTS.md`; use root `CLAUDE.md` only when `AGENTS.md` is absent. Before touching any path, read the nearest nested `AGENTS.md`, falling back to `CLAUDE.md` only when that directory has no `AGENTS.md`.
|
|
59
|
+
|
|
60
|
+
Do not rebase before work by default. Rebase only when the requester explicitly asks for it or when an explicitly requested publication or delivery outcome requires a current base. Inspect the worktree first and preserve pre-existing changes.
|
|
61
|
+
|
|
62
|
+
Use GitHub CLI commands through the `gh` tool for issues, pull requests, reviews, Actions, CI, authentication status, configuration, aliases, extensions, and API requests. Common commands include `gh pr create --draft`, `gh pr checks`, `gh run rerun --failed`, and `gh pr review`, but they are not restrictions.
|
|
63
|
+
|
|
64
|
+
Repositories that require verified signatures reject ordinary sandbox commits. Stage the intended changes explicitly, run `gh-signed-commit --repo owner/name --branch <branch> -m <headline>` through the `gh` tool, then create the draft pull request through the same tool.
|
|
65
|
+
|
|
66
|
+
Use apply_patch for authored edits. Formatters and generators may write their own output. Never rewrite files through shell or Python when a focused patch is sufficient. Write small hunks against current file contents. If a hunk misses, re-read that file and rewrite only the failed hunk.
|
|
67
|
+
|
|
68
|
+
Use `grep` for sandbox content search. Start with `files_with_matches` and a narrow path or glob.
|
|
69
|
+
|
|
70
|
+
Assume pre-existing modifications belong to the requester. Preserve unrelated changes and inspect overlap before editing. Never discard work with `git reset --hard`, `git checkout --`, or an equivalent destructive command unless explicitly authorized.
|
|
71
|
+
|
|
72
|
+
Make the smallest coherent change. Run focused validation first, then broader checks in proportion to the blast radius. Treat failures as evidence.
|
|
73
|
+
|
|
74
|
+
Be mindful of loading large files into your context window.
|
|
75
|
+
|
|
76
|
+
Load the pr skill before publishing. Create one pull request per request unless the requester asks otherwise.
|
|
77
|
+
|
|
78
|
+
## Destructive actions
|
|
79
|
+
|
|
80
|
+
Before deleting, overwriting, or making data difficult to recover, confirm scope and resolve the exact target with read-only checks. Never use a home directory, repository root, workspace root, unresolved variable, broad glob, or command substitution as a recursive destructive target. Prefer recoverable operations and stop when target or authority is unclear.
|
|
81
|
+
|
|
82
|
+
# Safety and writing
|
|
83
|
+
|
|
84
|
+
- Never print credentials, tokens, or `.env` contents
|
|
85
|
+
- Never expose company private references (Slack links, channel names, product or agent names, requester names or emails) in public environments (e.g. a public GitHub pull request)
|
|
86
|
+
- Use no em dashes in human-facing text
|
|
87
|
+
- Default to silence when the right action is no action
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const MAX_STREAM_CHARS=8e3;function boundedStream(e,t){let n=t.trim();if(n)return n.length<=MAX_STREAM_CHARS?`${e}:\n${n}`:`${e} (last ${MAX_STREAM_CHARS} characters):\n${n.slice(-8e3)}`}function commandFailureDetail(e){return[boundedStream(`stdout`,e.stdout),boundedStream(`stderr`,e.stderr)].filter(e=>e!==void 0).join(`
|
|
2
|
+
`)||`no command output`}export{commandFailureDetail};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const SERVER_MJS_SOURCE = "import { setTimeout as delay } from \"node:timers/promises\";\nimport { execFile, execFileSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { chmod, rename, rm } from \"node:fs/promises\";\nimport { promisify } from \"node:util\";\nimport http from \"node:http\";\nimport { env } from \"node:process\";\nimport { dirname, resolve } from \"node:path\";\n\nimport { CuaDriver } from \"@trycua/cua-driver\";\n\nimport { pointerMotionPlan } from \"./pointer-motion.mjs\";\nimport { selectGroundingElements } from \"./state.mjs\";\nimport { naturalTypingPlan } from \"./typing.mjs\";\n\nconst socketPath = env.COMPUTER_USE_SOCKET_PATH;\nconst workspaceRoot = env.COMPUTER_USE_ROOT;\nconst maxRequestBytes = 32 * 1024;\nconst maxRequestMs = 120_000;\nconst maxRecordingMs = 300_000;\nconst nativeCallTimeoutMs = 10_000;\n// Only the queue owner sets this signal; recording finalization deliberately bypasses it.\nlet requestSignal;\nconst desktopMargin = 24;\nconst minimumWindow = { height: 240, width: 480 };\nconst layoutTolerance = { height: 8, width: 8, x: 4, y: 4 };\nconst maxClipboardBytes = 10_000;\nconst driver = await CuaDriver.create({ claudeCodeCompatibility: false });\nconst execFilePromise = promisify(execFile);\nfunction execFileAsync(file, args, options) {\n return execFilePromise(file, args, {\n timeout: nativeCallTimeoutMs,\n ...options,\n signal: requestSignal,\n });\n}\n\nlet activeRecording = null;\nlet queue = Promise.resolve();\nlet shuttingDown = false;\n\nawait rm(socketPath, { force: true });\n\nconst server = http.createServer((request, response) => {\n if (shuttingDown) return response.destroy();\n if (request.method !== \"POST\" || request.url !== \"/call\") {\n sendJson(response, 404, { error: \"not found\" });\n return;\n }\n const controller = new AbortController();\n const deadline = Number(request.headers[\"x-computer-use-deadline\"]);\n const timeoutMs = Number.isFinite(deadline)\n ? Math.max(0, Math.min(maxRequestMs, deadline - Date.now()))\n : maxRequestMs;\n const cancel = () =>\n controller.abort(new Error(\"computer-use request cancelled or deadline exceeded\"));\n const timer = setTimeout(cancel, timeoutMs);\n response.once(\"close\", cancel);\n controller.signal.addEventListener(\"abort\", () => response.destroy(), { once: true });\n if (timeoutMs === 0) cancel();\n // Read immediately: a body may finish or disconnect while another call owns the queue.\n const body = readBody(request);\n void body.catch(() => undefined);\n const task = queue.then(async () => {\n controller.signal.throwIfAborted();\n if (shuttingDown) return;\n requestSignal = controller.signal;\n try {\n await handleRequest(await body, response);\n } finally {\n requestSignal = undefined;\n }\n });\n queue = task\n .catch(() => response.destroy())\n .finally(() => {\n clearTimeout(timer);\n response.removeListener(\"close\", cancel);\n });\n});\n\nserver.listen(socketPath, () => {\n void chmod(socketPath, 0o600);\n});\n\nfor (const signal of [\"SIGINT\", \"SIGTERM\"]) {\n process.once(signal, () => {\n void shutdown();\n });\n}\n\nasync function shutdown() {\n if (shuttingDown) return;\n shuttingDown = true;\n server.close();\n server.closeAllConnections();\n const timer = setTimeout(() => process.exit(1), nativeCallTimeoutMs * 2);\n let exitCode = 0;\n try {\n await queue;\n if (activeRecording !== null) await stopRecording();\n } catch {\n exitCode = 1;\n } finally {\n try {\n await driver.shutdown();\n } catch {\n exitCode = 1;\n } finally {\n clearTimeout(timer);\n process.exit(exitCode);\n }\n }\n}\n\nasync function handleRequest(body, response) {\n try {\n const input = JSON.parse(body);\n if (input.action === \"health\") {\n sendJson(response, 200, { backend: \"cua-driver\", version: \"0.12.5\" });\n return;\n }\n\n validateRequest(input);\n const actionResult = await performAction(input.action);\n const state = await captureState(input.screenshotPath);\n sendJson(response, 200, {\n action: actionResult,\n backend: \"cua-driver\",\n screenshot: input.screenshotPath,\n state,\n version: \"0.12.5\",\n });\n } catch (error) {\n if (requestSignal?.aborted && activeRecording !== null) {\n await stopRecording().catch(() => undefined);\n }\n sendJson(response, 500, {\n error: error instanceof Error ? error.message : String(error),\n });\n }\n}\n\nasync function performAction(action) {\n requestSignal?.throwIfAborted();\n validateActionCoordinates(action);\n if (action.action === \"sequence\") {\n const results = [];\n try {\n for (const nested of action.actions) {\n const startedAt = performance.now();\n const result = await performAction(nested);\n results.push({\n action: nested.action,\n durationMs: Math.round(performance.now() - startedAt),\n result,\n });\n }\n return results;\n } catch (error) {\n // Never strand the durable driver in an active-recording state when a\n // rehearsed step fails. Preserve the original action error.\n if (activeRecording !== null) await stopRecording().catch(() => undefined);\n throw error;\n }\n }\n switch (action.action) {\n case \"screenshot\":\n return null;\n case \"click\":\n await moveCursor(action);\n return click(action, 1);\n case \"double_click\":\n await moveCursor(action);\n return click(action, 2);\n case \"triple_click\":\n await moveCursor(action);\n return click(action, 3);\n case \"drag\":\n return dragCursor(action);\n case \"keypress\":\n return action.keys.length === 1\n ? call(\"press_key\", {\n scope: \"desktop\",\n key: normalizeKey(action.keys[0]),\n })\n : call(\"hotkey\", {\n scope: \"desktop\",\n keys: action.keys.map(normalizeKey),\n });\n case \"move\":\n return moveCursor(action);\n case \"scroll\": {\n await call(\"move_cursor\", {\n scope: \"desktop\",\n x: action.x,\n y: action.y,\n });\n const results = [];\n if (action.scrollY !== 0) {\n results.push(await call(\"scroll\", scrollInput(action.scrollY, \"up\", \"down\")));\n }\n if (action.scrollX !== 0) {\n results.push(await call(\"scroll\", scrollInput(action.scrollX, \"left\", \"right\")));\n }\n return results;\n }\n case \"type\":\n return typeText(action);\n case \"clipboard_read\":\n return readClipboard(action.selection);\n case \"clipboard_write\":\n return writeClipboard(action.selection, action.text);\n case \"wait\":\n await sleep(action.durationMs ?? 2_000);\n return null;\n case \"arrange_windows\":\n return arrangeWindows(action);\n case \"record_start\":\n return startRecording(action.path);\n case \"record_stop\":\n return stopRecording();\n default:\n throw new Error(`unsupported computer-use action: ${String(action.action)}`);\n }\n}\n\nasync function captureState(screenshotPath) {\n await call(\"get_desktop_state\", { screenshot_out_file: screenshotPath });\n const pointer = structured(await call(\"get_cursor_position\", {}));\n const screen = x11ScreenSize();\n const windows = structured(await call(\"list_windows\", { on_screen_only: true })).windows;\n const contentWindows = Array.isArray(windows) ? windows.filter(isContentWindow) : [];\n const groundingWindow = contentWindows.toSorted((left, right) => right.z_index - left.z_index)[0];\n\n let elements = [];\n if (groundingWindow !== undefined) {\n const windowState = structured(\n await call(\"get_window_state\", {\n pid: groundingWindow.pid,\n window_id: groundingWindow.window_id,\n include_screenshot: false,\n max_depth: 20,\n max_elements: 250,\n }),\n );\n if (Array.isArray(windowState.elements)) {\n elements = selectGroundingElements(windowState.elements, {\n width: Number(screen.width) || 1920,\n height: Number(screen.height) || 1080,\n });\n }\n }\n\n return formatState(groundingWindow, pointer, elements);\n}\n\nasync function startRecording(path) {\n if (activeRecording !== null) {\n throw new Error(\"a recording is already active\");\n }\n\n const outputDirectory = `${workspaceRoot}/recording-${randomUUID()}`;\n const result = await call(\n \"start_recording\",\n {\n output_dir: outputDirectory,\n record_video: true,\n },\n false,\n );\n activeRecording = {\n outputDirectory,\n outputPath: path,\n stopping: null,\n timer: setTimeout(() => {\n void stopRecording().catch(() => {\n void shutdown();\n });\n }, maxRecordingMs),\n };\n return result;\n}\n\nasync function stopRecording() {\n if (activeRecording === null) {\n throw new Error(\"no recording is active\");\n }\n\n const recording = activeRecording;\n if (recording.stopping !== null) return recording.stopping;\n clearTimeout(recording.timer);\n recording.stopping = finalizeRecording(recording);\n return recording.stopping;\n}\n\nasync function finalizeRecording(recording) {\n try {\n const result = await call(\"stop_recording\", {}, false);\n const output = structured(result);\n const videoPath =\n typeof output.last_video_path === \"string\"\n ? output.last_video_path\n : recording.outputDirectory + \"/recording.mp4\";\n await rename(videoPath, recording.outputPath);\n await rm(recording.outputDirectory, { force: true, recursive: true });\n return result;\n } catch (error) {\n void shutdown();\n throw error;\n } finally {\n activeRecording = null;\n }\n}\n\nasync function call(name, input, cancellable = true) {\n const signal = cancellable ? requestSignal : undefined;\n signal?.throwIfAborted();\n let timer;\n const result = await Promise.race([\n driver.callTool(name, JSON.stringify(input)),\n new Promise((_, reject) => {\n timer = setTimeout(() => {\n // Native calls have no abort API. Do not reuse a driver with uncertain in-flight work.\n void shutdown();\n reject(new Error(\"computer-use native call timed out; restart with startComputerUse\"));\n }, nativeCallTimeoutMs);\n }),\n ]).finally(() => clearTimeout(timer));\n signal?.throwIfAborted();\n if (result.isError) {\n throw new Error(\n `Cua ${name} failed${result.errorCode ? ` (${result.errorCode})` : \"\"}: ${result.text}`,\n );\n }\n return {\n degraded: result.degraded,\n structuredJson: result.structuredJson,\n text: result.text,\n verified: result.verified,\n };\n}\n\nfunction structured(result) {\n if (result.structuredJson === undefined) return {};\n return JSON.parse(result.structuredJson);\n}\n\nfunction pointerClickInput(x, y, button, count) {\n return {\n scope: \"desktop\",\n x,\n y,\n button: button === \"wheel\" ? \"middle\" : button,\n count,\n };\n}\n\nasync function moveCursor(action) {\n if (action.movementStyle === undefined) {\n return call(\"move_cursor\", { scope: \"desktop\", x: action.x, y: action.y });\n }\n const current = structured(await call(\"get_cursor_position\", {}));\n const start = { x: Number(current.x), y: Number(current.y) };\n if (!Number.isFinite(start.x) || !Number.isFinite(start.y)) {\n return call(\"move_cursor\", { scope: \"desktop\", x: action.x, y: action.y });\n }\n const options = { style: action.movementStyle };\n if (action.durationMs !== undefined) options.durationMs = action.durationMs;\n return followPointerPlan(pointerMotionPlan(start, { x: action.x, y: action.y }, options), \"x11\");\n}\n\nasync function dragCursor(action) {\n const start = action.path[0];\n const end = action.path.at(-1);\n if (action.movementStyle === undefined) {\n return call(\"drag\", {\n scope: \"desktop\",\n from_x: start.x,\n from_y: start.y,\n to_x: end.x,\n to_y: end.y,\n steps: Math.min(200, Math.max(20, action.path.length * 10)),\n });\n }\n const style = action.movementStyle;\n const current = structured(await call(\"get_cursor_position\", {}));\n const currentPoint = { x: Number(current.x), y: Number(current.y) };\n const approach =\n Number.isFinite(currentPoint.x) && Number.isFinite(currentPoint.y)\n ? pointerPlanArgs(pointerMotionPlan(currentPoint, start, { style: \"natural\" }))\n : [\"mousemove\", String(start.x), String(start.y)];\n const options = { style };\n if (action.durationMs !== undefined) options.durationMs = action.durationMs;\n const drag = pointerPlanArgs(pointerMotionPlan(start, end, options));\n return xdotool([\n ...approach,\n \"sleep\",\n \"0.025\",\n \"mousedown\",\n \"1\",\n \"sleep\",\n \"0.030\",\n ...drag,\n \"sleep\",\n \"0.030\",\n \"mouseup\",\n \"1\",\n ]);\n}\n\nasync function followPointerPlan(plan, backend = \"cua\") {\n if (backend === \"x11\") return xdotool(pointerPlanArgs(plan));\n const results = [];\n for (let phaseIndex = 0; phaseIndex < plan.phases.length; phaseIndex += 1) {\n for (const point of plan.phases[phaseIndex]) {\n results.push(await call(\"move_cursor\", { scope: \"desktop\", x: point.x, y: point.y }));\n if (point.delayMs > 0) await sleep(point.delayMs);\n }\n if (phaseIndex < plan.phases.length - 1 && plan.settleMs > 0) await sleep(plan.settleMs);\n }\n if (plan.phases.length === 1 && plan.settleMs > 0) await sleep(plan.settleMs);\n return results;\n}\n\nfunction pointerPlanArgs(plan) {\n const args = [];\n for (let phaseIndex = 0; phaseIndex < plan.phases.length; phaseIndex += 1) {\n for (const point of plan.phases[phaseIndex]) {\n args.push(\"mousemove\", String(point.x), String(point.y));\n if (point.delayMs > 0) args.push(\"sleep\", (point.delayMs / 1000).toFixed(3));\n }\n if (phaseIndex < plan.phases.length - 1 && plan.settleMs > 0) {\n args.push(\"sleep\", (plan.settleMs / 1000).toFixed(3));\n }\n }\n if (plan.phases.length === 1 && plan.settleMs > 0) {\n args.push(\"sleep\", (plan.settleMs / 1000).toFixed(3));\n }\n return args;\n}\n\nasync function xdotool(args) {\n const plannedSleepMs = args.reduce(\n (total, value, index) => (args[index - 1] === \"sleep\" ? total + Number(value) * 1000 : total),\n 0,\n );\n const timeout = Math.max(2_000, Math.ceil(plannedSleepMs + 1_500));\n const result = await execFileAsync(\"xdotool\", args, { env: displayEnv(), timeout });\n return {\n plannedSleepMs: Math.round(plannedSleepMs),\n stderr: result.stderr,\n stdout: result.stdout,\n };\n}\n\nfunction typingPlan(action) {\n if (action.typingStyle === \"natural\") return naturalTypingPlan(action.text);\n return [...new Intl.Segmenter().segment(action.text)].map(({ segment }) => ({\n grapheme: segment,\n delayMs: action.typingDelayMs ?? 0,\n }));\n}\n\nfunction validateTypingBudget(actions) {\n let characters = 0;\n let calls = 0;\n let delayMs = 0;\n for (const action of actions) {\n if (action.action !== \"type\") continue;\n if (typeof action.text !== \"string\" || action.text.length > 10_000) {\n throw new Error(\"typing text must be at most 10000 characters\");\n }\n characters += action.text.length;\n if (action.typingStyle === undefined && !action.typingDelayMs) continue;\n const plan = typingPlan(action);\n calls += plan.length;\n delayMs += plan.reduce((total, step) => total + step.delayMs, 0);\n }\n if (characters > 10_000 || calls > 1_000 || delayMs > 30_000) {\n throw new Error(\n \"typing budget exceeded: at most 10000 characters, 1000 paced graphemes and 30000ms delay per request; use unpaced typing for longer text\",\n );\n }\n}\n\nasync function typeText(action) {\n if (action.typingStyle === undefined && !action.typingDelayMs) {\n return call(\"type_text\", { scope: \"desktop\", text: action.text });\n }\n let result;\n let graphemesTyped = 0;\n for (const { grapheme, delayMs } of typingPlan(action)) {\n result = await call(\"type_text\", { scope: \"desktop\", text: grapheme });\n graphemesTyped += 1;\n if (delayMs > 0) await sleep(delayMs);\n }\n return { graphemesTyped, result };\n}\n\nasync function click(action, count) {\n if (action.button !== \"back\" && action.button !== \"forward\") {\n return call(\"click\", pointerClickInput(action.x, action.y, action.button, count));\n }\n\n await call(\"move_cursor\", {\n scope: \"desktop\",\n x: action.x,\n y: action.y,\n });\n const results = [];\n for (let index = 0; index < count; index += 1) {\n results.push(\n await call(\"hotkey\", {\n scope: \"desktop\",\n keys: [\"alt\", action.button === \"back\" ? \"left\" : \"right\"],\n }),\n );\n }\n return results;\n}\n\nasync function readClipboard(selection) {\n try {\n const result = await execFileAsync(\"xclip\", [\"-selection\", xclipSelection(selection), \"-out\"], {\n env: displayEnv(),\n maxBuffer: maxClipboardBytes + 1,\n });\n if (Buffer.byteLength(result.stdout) > maxClipboardBytes) {\n throw new Error(`clipboard content exceeds ${maxClipboardBytes} bytes`);\n }\n return { selection, text: result.stdout };\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"clipboard content exceeds\")) throw error;\n return { selection, text: \"\" };\n }\n}\n\nasync function writeClipboard(selection, text) {\n if (Buffer.byteLength(text) > maxClipboardBytes) {\n throw new Error(`clipboard content exceeds ${maxClipboardBytes} bytes`);\n }\n await new Promise((resolve, reject) => {\n const child = execFile(\"xclip\", [\"-selection\", xclipSelection(selection), \"-in\"], {\n env: displayEnv(),\n timeout: nativeCallTimeoutMs,\n signal: requestSignal,\n });\n child.once(\"error\", reject);\n child.once(\"exit\", (code) =>\n code === 0 ? resolve() : reject(new Error(`xclip exited ${code}`)),\n );\n child.stdin.end(text);\n });\n return { bytes: Buffer.byteLength(text), selection };\n}\n\nfunction xclipSelection(selection) {\n return selection === \"primary\" ? \"primary\" : \"clipboard\";\n}\n\nasync function arrangeWindows(action) {\n const scene = validateWindowScene(action.windows);\n const deadline = Date.now() + action.waitForMs;\n let resolved = null;\n while (resolved === null) {\n const windows = structured(await call(\"list_windows\", { on_screen_only: true })).windows;\n resolved = resolveSceneWindows(scene, Array.isArray(windows) ? windows : []);\n if (resolved !== null) break;\n if (Date.now() >= deadline) {\n throw new Error(\n `arrange_windows timed out waiting for: ${missingSceneSelectors(scene, Array.isArray(windows) ? windows : []).join(\", \")}`,\n );\n }\n await sleep(100);\n }\n\n // Resolve the complete scene before mutating any window. A missing selector\n // therefore leaves the existing desktop untouched.\n for (const item of resolved) {\n const windowId = String(item.window.window_id);\n await execFileAsync(\"xdotool\", [\"windowactivate\", \"--sync\", windowId], { env: displayEnv() });\n await execFileAsync(\n \"xdotool\",\n [\"windowmove\", windowId, String(item.bounds.x), String(item.bounds.y)],\n {\n env: displayEnv(),\n },\n );\n await execFileAsync(\n \"xdotool\",\n [\"windowsize\", windowId, String(item.bounds.width), String(item.bounds.height)],\n { env: displayEnv() },\n );\n }\n\n let verified = null;\n let windows = [];\n for (let attempt = 0; attempt < 10; attempt += 1) {\n const response = structured(await call(\"list_windows\", { on_screen_only: true })).windows;\n windows = Array.isArray(response) ? response : [];\n verified = resolveSceneWindows(scene, windows);\n if (\n verified !== null &&\n verified.every(({ bounds, window }) => approximatelyEqual(bounds, window))\n ) {\n return verified.map(layoutResult);\n }\n await sleep(100);\n }\n\n const screenshotPath = `${workspaceRoot}/layout-failure-${Date.now()}.png`;\n await call(\"get_desktop_state\", { screenshot_out_file: screenshotPath });\n const details =\n verified === null\n ? { stage: \"selector_resolution\", missing: missingSceneSelectors(scene, windows) }\n : {\n stage: \"verification\",\n tolerance: layoutTolerance,\n windows: verified.map(layoutResult),\n };\n throw new Error(\n `arrange_windows failed: ${JSON.stringify({ ...details, screenshot: screenshotPath })}`,\n );\n}\n\nfunction validateWindowScene(windows) {\n if (!Array.isArray(windows) || windows.length < 1 || windows.length > 4) {\n throw new Error(\"arrange_windows requires 1 to 4 windows\");\n }\n const scene = windows.map((item) => ({ ...item, bounds: regionBounds(item.region) }));\n const selectors = scene.map((item) => selectorLabel(item.selector));\n if (new Set(selectors).size !== selectors.length) {\n throw new Error(\"arrange_windows selectors must be unique\");\n }\n for (let left = 0; left < scene.length; left += 1) {\n for (let right = left + 1; right < scene.length; right += 1) {\n if (overlaps(scene[left].bounds, scene[right].bounds)) {\n throw new Error(\"arrange_windows regions must not overlap\");\n }\n }\n }\n return scene;\n}\n\nfunction desktopBounds() {\n const screen = x11ScreenSize();\n return {\n x: desktopMargin,\n y: desktopMargin,\n width: screen.width - desktopMargin * 2,\n height: screen.height - desktopMargin * 2,\n };\n}\n\nfunction x11ScreenSize() {\n // The X server is the source of truth after set_desktop_size. Avoid CUA's\n // session-oriented get_screen_size contract, which differs from pointer\n // actions and does not accept scope.\n const output = execFileSync(\"xdpyinfo\", [\"-display\", \":99\"], {\n encoding: \"utf8\",\n timeout: 2_000,\n });\n const match = /dimensions:\\s+(\\d+)x(\\d+) pixels/u.exec(output);\n if (match === null) throw new Error(\"could not determine desktop dimensions\");\n return { width: Number(match[1]), height: Number(match[2]) };\n}\n\nfunction regionBounds(region) {\n if (\n typeof region !== \"object\" ||\n region === null ||\n ![region.x, region.y, region.width, region.height].every(Number.isFinite) ||\n region.x < 0 ||\n region.y < 0 ||\n region.width <= 0 ||\n region.height <= 0 ||\n region.x + region.width > 1 ||\n region.y + region.height > 1\n ) {\n throw new Error(\"arrange_windows regions must fit within the desktop\");\n }\n const desktop = desktopBounds();\n const left = Math.round(desktop.x + desktop.width * region.x);\n const top = Math.round(desktop.y + desktop.height * region.y);\n const right = Math.round(desktop.x + desktop.width * (region.x + region.width));\n const bottom = Math.round(desktop.y + desktop.height * (region.y + region.height));\n const bounds = { x: left, y: top, width: right - left, height: bottom - top };\n if (bounds.width < minimumWindow.width || bounds.height < minimumWindow.height) {\n throw new Error(\n `arrange_windows regions must be at least ${minimumWindow.width}x${minimumWindow.height}`,\n );\n }\n return bounds;\n}\n\nfunction resolveSceneWindows(scene, windows) {\n const resolved = scene.map((item) => {\n const window = windows.find((candidate) => matchesSelector(candidate, item.selector));\n return window === undefined ? null : { bounds: item.bounds, window };\n });\n return resolved.includes(null) ? null : resolved;\n}\n\nfunction missingSceneSelectors(scene, windows) {\n return scene\n .filter((item) => !windows.some((window) => matchesSelector(window, item.selector)))\n .map((item) => selectorLabel(item.selector));\n}\n\nfunction matchesSelector(window, selector) {\n const identity = `${window.app_name ?? \"\"}\\n${window.title ?? \"\"}`.toLowerCase();\n if (selector.app === \"firefox\") return identity.includes(\"firefox\");\n const title = selector.instance === \"primary\" ? \"terminal 1\" : \"terminal 2\";\n return identity.includes(title);\n}\n\nfunction selectorLabel(selector) {\n return selector.app === \"firefox\" ? \"firefox\" : `xterm:${selector.instance}`;\n}\n\nfunction overlaps(left, right) {\n return (\n left.x < right.x + right.width &&\n left.x + left.width > right.x &&\n left.y < right.y + right.height &&\n left.y + left.height > right.y\n );\n}\n\nfunction layoutResult({ bounds, window }) {\n const observed = {\n x: Number(window.x),\n y: Number(window.y),\n width: Number(window.width),\n height: Number(window.height),\n };\n return {\n selector: `${window.app_name ?? \"\"}:${window.title ?? \"\"}`,\n requested: bounds,\n observed,\n delta: {\n x: observed.x - bounds.x,\n y: observed.y - bounds.y,\n width: observed.width - bounds.width,\n height: observed.height - bounds.height,\n },\n tolerance: layoutTolerance,\n title: window.title,\n window_id: window.window_id,\n };\n}\n\nfunction displayEnv() {\n return { ...env, DISPLAY: \":99\" };\n}\n\nfunction approximatelyEqual(bounds, window) {\n return (\n Math.abs(bounds.x - window.x) <= layoutTolerance.x &&\n Math.abs(bounds.y - window.y) <= layoutTolerance.y &&\n Math.abs(bounds.width - window.width) <= layoutTolerance.width &&\n Math.abs(bounds.height - window.height) <= layoutTolerance.height\n );\n}\n\nfunction sleep(milliseconds) {\n return delay(milliseconds, undefined, { signal: requestSignal });\n}\n\nfunction scrollInput(delta, negativeDirection, positiveDirection) {\n return {\n scope: \"desktop\",\n direction: delta < 0 ? negativeDirection : positiveDirection,\n amount: Math.min(50, Math.max(1, Math.round(Math.abs(delta) / 100))),\n by: \"line\",\n };\n}\n\nfunction normalizeKey(key) {\n const aliases = {\n ARROWDOWN: \"down\",\n ARROWLEFT: \"left\",\n ARROWRIGHT: \"right\",\n ARROWUP: \"up\",\n CMD: \"meta\",\n COMMAND: \"meta\",\n CONTROL: \"ctrl\",\n DEL: \"delete\",\n ENTER: \"enter\",\n ESC: \"escape\",\n OPTION: \"alt\",\n RETURN: \"enter\",\n };\n return aliases[key] ?? key.toLowerCase();\n}\n\nfunction isContentWindow(window) {\n const identity = `${window.app_name ?? \"\"}\\n${window.title ?? \"\"}`.toLowerCase();\n return (\n window.width >= 200 &&\n window.height >= 100 &&\n !identity.includes(\"xfce4-panel\") &&\n !identity.includes(\"xfdesktop\") &&\n window.title !== \"Desktop\"\n );\n}\n\nfunction formatState(groundingWindow, pointer, elements) {\n const lines = [\n groundingWindow === undefined\n ? \"grounding_window\\t(none)\"\n : `grounding_window\\t${groundingWindow.title} pid=${groundingWindow.pid} window_id=${groundingWindow.window_id}`,\n `pointer\\tx=${pointer.x ?? \"unknown\"} y=${pointer.y ?? \"unknown\"}`,\n \"accessibility_elements\",\n ];\n\n for (const element of elements) {\n const frame =\n element.frame === undefined\n ? \"\"\n : ` x=${element.frame.x} y=${element.frame.y} width=${element.frame.w} height=${element.frame.h}`;\n lines.push(\n `[${element.element_index}] role=${element.role}${frame} label=${JSON.stringify(element.label ?? \"\")}`,\n );\n }\n return lines.join(\"\\n\");\n}\n\nfunction validateActionCoordinates(action) {\n const screen = x11ScreenSize();\n const points = [];\n if ([\"click\", \"double_click\", \"triple_click\", \"move\", \"scroll\"].includes(action.action)) {\n points.push({ x: action.x, y: action.y });\n }\n if (action.action === \"drag\") points.push(...action.path);\n for (const point of points) {\n if (\n !Number.isFinite(point.x) ||\n !Number.isFinite(point.y) ||\n point.x < 0 ||\n point.y < 0 ||\n point.x >= screen.width ||\n point.y >= screen.height\n ) {\n throw new Error(\n `computer-use coordinate is outside the ${screen.width}x${screen.height} desktop`,\n );\n }\n }\n}\n\nfunction validateRequest(input) {\n if (typeof input !== \"object\" || input === null) {\n throw new Error(\"request must be an object\");\n }\n if (!isArtifactPath(input.screenshotPath, \".png\")) {\n throw new Error(\"screenshot path must be a PNG under the computer-use workspace\");\n }\n if (typeof input.action !== \"object\" || input.action === null) {\n throw new Error(\"request action must be an object\");\n }\n const actions = new Set([\n \"arrange_windows\",\n \"click\",\n \"clipboard_read\",\n \"clipboard_write\",\n \"double_click\",\n \"drag\",\n \"keypress\",\n \"move\",\n \"record_start\",\n \"record_stop\",\n \"screenshot\",\n \"scroll\",\n \"sequence\",\n \"triple_click\",\n \"type\",\n \"wait\",\n ]);\n if (!actions.has(input.action.action)) {\n throw new Error(`unsupported computer-use action: ${String(input.action.action)}`);\n }\n if (input.action.action === \"sequence\") {\n if (\n !Array.isArray(input.action.actions) ||\n input.action.actions.length < 1 ||\n input.action.actions.length > 30\n ) {\n throw new Error(\"sequence must contain 1 to 30 actions\");\n }\n for (const action of input.action.actions) validateNestedSequenceAction(action);\n }\n if (input.action.action === \"arrange_windows\") validateArrangeWindowsAction(input.action);\n if (input.action.action === \"record_start\" && !isArtifactPath(input.action.path, \".mp4\")) {\n throw new Error(\"recording path must be an MP4 under the computer-use workspace\");\n }\n if (\n [\"click\", \"double_click\", \"triple_click\", \"drag\", \"move\"].includes(input.action.action) &&\n \"durationMs\" in input.action &&\n (!Number.isInteger(input.action.durationMs) ||\n input.action.durationMs < 0 ||\n input.action.durationMs > 2000)\n ) {\n throw new Error(\"pointer durationMs must be an integer from 0 to 2000\");\n }\n validateMovementStyle(input.action, \"\");\n if (\n input.action.action === \"wait\" &&\n (!Number.isInteger(input.action.durationMs) ||\n input.action.durationMs < 100 ||\n input.action.durationMs > 10_000)\n ) {\n throw new Error(\"wait durationMs must be an integer from 100 to 10000\");\n }\n validateClipboardOptions(input.action);\n validateTypingOptions(input.action, \"\");\n validateTypingBudget(input.action.action === \"sequence\" ? input.action.actions : [input.action]);\n}\n\nfunction validateNestedSequenceAction(action) {\n if (typeof action !== \"object\" || action === null)\n throw new Error(\"sequence action must be an object\");\n const allowed = new Set([\n \"arrange_windows\",\n \"click\",\n \"double_click\",\n \"drag\",\n \"keypress\",\n \"move\",\n \"record_start\",\n \"record_stop\",\n \"triple_click\",\n \"type\",\n \"wait\",\n ]);\n if (!allowed.has(action.action))\n throw new Error(`unsupported sequence action: ${String(action.action)}`);\n if (action.action === \"arrange_windows\") validateArrangeWindowsAction(action);\n if (action.action === \"record_start\" && !isArtifactPath(action.path, \".mp4\")) {\n throw new Error(\"sequence recording path must be an MP4 under the computer-use workspace\");\n }\n if (\n [\"click\", \"double_click\", \"triple_click\", \"drag\", \"move\"].includes(action.action) &&\n \"durationMs\" in action &&\n (!Number.isInteger(action.durationMs) || action.durationMs < 0 || action.durationMs > 2000)\n ) {\n throw new Error(\"sequence pointer durationMs must be an integer from 0 to 2000\");\n }\n validateMovementStyle(action, \"sequence \");\n if (\n action.action === \"wait\" &&\n (!Number.isInteger(action.durationMs) || action.durationMs < 100 || action.durationMs > 10_000)\n ) {\n throw new Error(\"sequence wait durationMs must be an integer from 100 to 10000\");\n }\n if (action.action === \"type\") validateTypingOptions(action, \"sequence \");\n}\n\nfunction validateMovementStyle(action, prefix) {\n if (\n \"movementStyle\" in action &&\n action.movementStyle !== \"natural\" &&\n action.movementStyle !== \"precision\"\n ) {\n throw new Error(`${prefix}movementStyle must be natural or precision`);\n }\n if (\n action.action === \"drag\" &&\n \"movementStyle\" in action &&\n action.movementStyle !== \"precision\"\n ) {\n throw new Error(`${prefix}drag movementStyle must be precision`);\n }\n}\n\nfunction validateClipboardOptions(action) {\n if (\n [\"clipboard_read\", \"clipboard_write\"].includes(action.action) &&\n action.selection !== \"clipboard\" &&\n action.selection !== \"primary\"\n ) {\n throw new Error(\"clipboard selection must be clipboard or primary\");\n }\n if (\n action.action === \"clipboard_write\" &&\n (typeof action.text !== \"string\" || Buffer.byteLength(action.text) > maxClipboardBytes)\n ) {\n throw new Error(`clipboard text must be at most ${maxClipboardBytes} bytes`);\n }\n}\n\nfunction validateTypingOptions(action, prefix) {\n if (\n \"typingDelayMs\" in action &&\n (!Number.isInteger(action.typingDelayMs) ||\n action.typingDelayMs < 0 ||\n action.typingDelayMs > 200)\n ) {\n throw new Error(`${prefix}typingDelayMs must be an integer from 0 to 200`);\n }\n if (\"typingStyle\" in action && action.typingStyle !== \"natural\") {\n throw new Error(`${prefix}typingStyle must be natural`);\n }\n if (\"typingStyle\" in action && \"typingDelayMs\" in action) {\n throw new Error(`${prefix}type action cannot set both typingStyle and typingDelayMs`);\n }\n}\n\nfunction validateArrangeWindowsAction(action) {\n if (!Number.isInteger(action.waitForMs) || action.waitForMs < 0 || action.waitForMs > 10_000) {\n throw new Error(\"arrange_windows waitForMs must be an integer from 0 to 10000\");\n }\n validateWindowScene(action.windows);\n}\n\nfunction isArtifactPath(value, extension) {\n if (typeof value !== \"string\" || !value.endsWith(extension)) return false;\n const path = resolve(value);\n return dirname(path) === workspaceRoot;\n}\n\nasync function readBody(request) {\n let body = \"\";\n for await (const chunk of request) {\n body += chunk;\n if (Buffer.byteLength(body) > maxRequestBytes) {\n throw new Error(\"request exceeds 32 KiB\");\n }\n }\n return body;\n}\n\nfunction sendJson(response, statusCode, body) {\n if (response.destroyed) return;\n const json = JSON.stringify(body);\n response.writeHead(statusCode, {\n \"content-length\": Buffer.byteLength(json),\n \"content-type\": \"application/json\",\n });\n response.end(json);\n}\n";
|
|
2
|
+
export declare const CLIENT_MJS_SOURCE = "import http from \"node:http\";\nimport { env } from \"node:process\";\n\nconst socketPath = env.COMPUTER_USE_SOCKET_PATH;\nconst body = env.COMPUTER_USE_REQUEST;\n\nif (body === undefined) {\n throw new Error(\"COMPUTER_USE_REQUEST is required\");\n}\n\nconst deadline = Date.now() + 120_000;\nconst response = await new Promise((resolve, reject) => {\n const request = http.request(\n {\n socketPath,\n method: \"POST\",\n path: \"/call\",\n headers: {\n \"content-length\": Buffer.byteLength(body),\n \"content-type\": \"application/json\",\n \"x-computer-use-deadline\": String(deadline),\n },\n },\n (incoming) => {\n incoming.on(\"error\", reject);\n incoming.setEncoding(\"utf8\");\n let responseBody = \"\";\n incoming.on(\"data\", (chunk) => {\n responseBody += chunk;\n });\n incoming.on(\"end\", () => {\n resolve({ body: responseBody, statusCode: incoming.statusCode ?? 500 });\n });\n },\n );\n const timer = setTimeout(\n () => request.destroy(new Error(\"computer-use request deadline exceeded\")),\n Math.max(0, deadline - Date.now()),\n );\n request.once(\"close\", () => clearTimeout(timer));\n request.on(\"error\", reject);\n request.end(body);\n});\n\nif (response.statusCode !== 200) {\n process.stderr.write(response.body);\n process.exitCode = 1;\n} else {\n process.stdout.write(response.body);\n}\n";
|
|
3
|
+
export declare const STATE_MJS_SOURCE = "const MAX_GROUNDING_ELEMENTS = 80;\n\n/**\n * @typedef {{\n * element_index?: number;\n * frame?: { h?: number; w?: number; x?: number; y?: number };\n * label?: unknown;\n * [key: string]: unknown;\n * }} GroundingElement\n */\n\n/**\n * Keep the model-facing state aligned with the visible desktop screenshot.\n *\n * @param {unknown[]} elements\n * @returns {GroundingElement[]}\n */\nexport function selectGroundingElements(elements, screen = { width: 1920, height: 1080 }) {\n return elements\n .filter((element) => isVisibleLabeledElement(element, screen))\n .slice(0, MAX_GROUNDING_ELEMENTS);\n}\n\n/**\n * @param {unknown} value\n * @returns {value is GroundingElement}\n */\nfunction isVisibleLabeledElement(value, screen) {\n if (typeof value !== \"object\" || value === null) return false;\n const element = /** @type {GroundingElement} */ (value);\n const frame = element.frame;\n if (typeof element.label !== \"string\" || element.label.trim().length === 0) return false;\n if (typeof frame !== \"object\" || frame === null) return false;\n if (\n !Number.isFinite(frame.x) ||\n !Number.isFinite(frame.y) ||\n !Number.isFinite(frame.w) ||\n !Number.isFinite(frame.h)\n ) {\n return false;\n }\n\n const x = /** @type {number} */ (frame.x);\n const y = /** @type {number} */ (frame.y);\n const width = /** @type {number} */ (frame.w);\n const height = /** @type {number} */ (frame.h);\n return (\n width > 0 &&\n height > 0 &&\n x < screen.width &&\n y < screen.height &&\n x + width > 0 &&\n y + height > 0\n );\n}\n";
|
|
4
|
+
export declare const TYPING_MJS_SOURCE = "const DEMO_TYPING_SPEED = 1.2;\nconst MIN_DELAY_MS = 35;\nconst MAX_DELAY_MS = 220;\n\nexport function naturalTypingPlan(text) {\n const graphemes = [...new Intl.Segmenter().segment(text)].map(({ segment }) => segment);\n let state = hashText(text) || 1;\n return graphemes.map((grapheme, index) => {\n state = nextState(state);\n return {\n grapheme,\n delayMs: index === graphemes.length - 1 ? 0 : naturalDelay(grapheme, state),\n };\n });\n}\n\nfunction naturalDelay(grapheme, state) {\n const jitter = state / 0x1_0000_0000;\n const range = delayRange(grapheme);\n return Math.round((range.min + (range.max - range.min) * jitter) / DEMO_TYPING_SPEED);\n}\n\nfunction delayRange(grapheme) {\n if (/\\s/u.test(grapheme)) return { min: 75, max: 125 };\n if (/[.!?]/u.test(grapheme)) return { min: 145, max: MAX_DELAY_MS };\n if (/[/|;&]/u.test(grapheme)) return { min: 105, max: 175 };\n if (/[-_=,:]/u.test(grapheme)) return { min: 70, max: 125 };\n return { min: MIN_DELAY_MS, max: 85 };\n}\n\nfunction hashText(text) {\n let hash = 2166136261;\n for (const character of text) {\n hash ^= character.codePointAt(0);\n hash = Math.imul(hash, 16777619);\n }\n return hash >>> 0;\n}\n\nfunction nextState(state) {\n let value = state;\n value ^= value << 13;\n value ^= value >>> 17;\n value ^= value << 5;\n return value >>> 0;\n}\n";
|
|
5
|
+
export declare const POINTER_MOTION_MJS_SOURCE = "const FRAME_MS = 16;\n\nexport function pointerMotionPlan(start, end, options = {}) {\n const style = options.style ?? \"natural\";\n const distance = Math.hypot(end.x - start.x, end.y - start.y);\n const durationMs = options.durationMs ?? naturalDuration(distance, style);\n if (distance < 2 || durationMs === 0) {\n return { phases: [[{ ...end, delayMs: 0 }]], settleMs: 0 };\n }\n\n if (style === \"precision\" && distance >= 120) {\n const ratio = 0.92 + deterministicUnit(start, end, 7) * 0.04;\n const undershoot = {\n x: Math.round(start.x + (end.x - start.x) * ratio),\n y: Math.round(start.y + (end.y - start.y) * ratio),\n };\n // Cover most of the distance quickly, then spend a disproportionate\n // share of the duration continuously correcting the final 4\u20138%.\n const firstDuration = Math.round(durationMs * 0.62);\n return {\n phases: [\n bezierPhase(start, undershoot, firstDuration, \"natural\", 11),\n bezierPhase(undershoot, end, durationMs - firstDuration, \"precision\", 23),\n ],\n settleMs: 0,\n };\n }\n\n return {\n phases: [bezierPhase(start, end, durationMs, style, 17)],\n settleMs: style === \"natural\" ? 15 + Math.round(deterministicUnit(start, end, 31) * 15) : 0,\n };\n}\n\nfunction bezierPhase(start, end, durationMs, style, salt) {\n const distance = Math.hypot(end.x - start.x, end.y - start.y);\n const steps = Math.max(2, Math.min(60, Math.round(durationMs / FRAME_MS)));\n const perpendicular = unitPerpendicular(start, end);\n const bendLimit = style === \"precision\" ? 8 : Math.min(70, distance * 0.09);\n const bend = (deterministicUnit(start, end, salt) * 2 - 1) * bendLimit;\n const c1 = {\n x: start.x + (end.x - start.x) * 0.28 + perpendicular.x * bend,\n y: start.y + (end.y - start.y) * 0.28 + perpendicular.y * bend,\n };\n const c2 = {\n x: start.x + (end.x - start.x) * 0.76 + perpendicular.x * bend * 0.65,\n y: start.y + (end.y - start.y) * 0.76 + perpendicular.y * bend * 0.65,\n };\n const delayMs = durationMs / steps;\n return Array.from({ length: steps }, (_, index) => {\n // This asymmetric timing curve accelerates quickly and eases into the\n // target without the perfectly mirrored feel of smoothstep.\n const progress = (index + 1) / steps;\n const t = 1 - (1 - progress) ** 2.35;\n const point = cubicBezier(start, c1, c2, end, t);\n return {\n x: index === steps - 1 ? end.x : Math.round(point.x),\n y: index === steps - 1 ? end.y : Math.round(point.y),\n delayMs: index === steps - 1 ? 0 : delayMs,\n };\n });\n}\n\nfunction cubicBezier(start, c1, c2, end, t) {\n const inverse = 1 - t;\n return {\n x:\n inverse ** 3 * start.x +\n 3 * inverse ** 2 * t * c1.x +\n 3 * inverse * t ** 2 * c2.x +\n t ** 3 * end.x,\n y:\n inverse ** 3 * start.y +\n 3 * inverse ** 2 * t * c1.y +\n 3 * inverse * t ** 2 * c2.y +\n t ** 3 * end.y,\n };\n}\n\nfunction naturalDuration(distance, style) {\n const base = style === \"precision\" ? 150 : 110;\n const scale = style === \"precision\" ? 0.35 : 0.28;\n const minimum = style === \"precision\" ? 180 : 140;\n const maximum = style === \"precision\" ? 650 : 550;\n return Math.round(Math.min(maximum, Math.max(minimum, base + distance * scale)));\n}\n\nfunction unitPerpendicular(start, end) {\n const dx = end.x - start.x;\n const dy = end.y - start.y;\n const length = Math.hypot(dx, dy) || 1;\n return { x: -dy / length, y: dx / length };\n}\n\nfunction deterministicUnit(start, end, salt) {\n let value =\n (Math.imul(Math.round(start.x), 73_856_093) ^\n Math.imul(Math.round(start.y), 19_349_663) ^\n Math.imul(Math.round(end.x), 83_492_791) ^\n Math.imul(Math.round(end.y), 2_654_435_761) ^\n salt) >>>\n 0;\n value ^= value << 13;\n value ^= value >>> 17;\n value ^= value << 5;\n return (value >>> 0) / 0x1_0000_0000;\n}\n";
|
|
6
|
+
export declare const PACKAGE_JSON_SOURCE = "{\n \"name\": \"computer-use-driver\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@trycua/cua-driver\": \"0.12.5\"\n }\n}\n";
|
|
7
|
+
export declare const COMPUTER_USE_DRIVER_SOURCES: {
|
|
8
|
+
readonly "server.mjs": "import { setTimeout as delay } from \"node:timers/promises\";\nimport { execFile, execFileSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { chmod, rename, rm } from \"node:fs/promises\";\nimport { promisify } from \"node:util\";\nimport http from \"node:http\";\nimport { env } from \"node:process\";\nimport { dirname, resolve } from \"node:path\";\n\nimport { CuaDriver } from \"@trycua/cua-driver\";\n\nimport { pointerMotionPlan } from \"./pointer-motion.mjs\";\nimport { selectGroundingElements } from \"./state.mjs\";\nimport { naturalTypingPlan } from \"./typing.mjs\";\n\nconst socketPath = env.COMPUTER_USE_SOCKET_PATH;\nconst workspaceRoot = env.COMPUTER_USE_ROOT;\nconst maxRequestBytes = 32 * 1024;\nconst maxRequestMs = 120_000;\nconst maxRecordingMs = 300_000;\nconst nativeCallTimeoutMs = 10_000;\n// Only the queue owner sets this signal; recording finalization deliberately bypasses it.\nlet requestSignal;\nconst desktopMargin = 24;\nconst minimumWindow = { height: 240, width: 480 };\nconst layoutTolerance = { height: 8, width: 8, x: 4, y: 4 };\nconst maxClipboardBytes = 10_000;\nconst driver = await CuaDriver.create({ claudeCodeCompatibility: false });\nconst execFilePromise = promisify(execFile);\nfunction execFileAsync(file, args, options) {\n return execFilePromise(file, args, {\n timeout: nativeCallTimeoutMs,\n ...options,\n signal: requestSignal,\n });\n}\n\nlet activeRecording = null;\nlet queue = Promise.resolve();\nlet shuttingDown = false;\n\nawait rm(socketPath, { force: true });\n\nconst server = http.createServer((request, response) => {\n if (shuttingDown) return response.destroy();\n if (request.method !== \"POST\" || request.url !== \"/call\") {\n sendJson(response, 404, { error: \"not found\" });\n return;\n }\n const controller = new AbortController();\n const deadline = Number(request.headers[\"x-computer-use-deadline\"]);\n const timeoutMs = Number.isFinite(deadline)\n ? Math.max(0, Math.min(maxRequestMs, deadline - Date.now()))\n : maxRequestMs;\n const cancel = () =>\n controller.abort(new Error(\"computer-use request cancelled or deadline exceeded\"));\n const timer = setTimeout(cancel, timeoutMs);\n response.once(\"close\", cancel);\n controller.signal.addEventListener(\"abort\", () => response.destroy(), { once: true });\n if (timeoutMs === 0) cancel();\n // Read immediately: a body may finish or disconnect while another call owns the queue.\n const body = readBody(request);\n void body.catch(() => undefined);\n const task = queue.then(async () => {\n controller.signal.throwIfAborted();\n if (shuttingDown) return;\n requestSignal = controller.signal;\n try {\n await handleRequest(await body, response);\n } finally {\n requestSignal = undefined;\n }\n });\n queue = task\n .catch(() => response.destroy())\n .finally(() => {\n clearTimeout(timer);\n response.removeListener(\"close\", cancel);\n });\n});\n\nserver.listen(socketPath, () => {\n void chmod(socketPath, 0o600);\n});\n\nfor (const signal of [\"SIGINT\", \"SIGTERM\"]) {\n process.once(signal, () => {\n void shutdown();\n });\n}\n\nasync function shutdown() {\n if (shuttingDown) return;\n shuttingDown = true;\n server.close();\n server.closeAllConnections();\n const timer = setTimeout(() => process.exit(1), nativeCallTimeoutMs * 2);\n let exitCode = 0;\n try {\n await queue;\n if (activeRecording !== null) await stopRecording();\n } catch {\n exitCode = 1;\n } finally {\n try {\n await driver.shutdown();\n } catch {\n exitCode = 1;\n } finally {\n clearTimeout(timer);\n process.exit(exitCode);\n }\n }\n}\n\nasync function handleRequest(body, response) {\n try {\n const input = JSON.parse(body);\n if (input.action === \"health\") {\n sendJson(response, 200, { backend: \"cua-driver\", version: \"0.12.5\" });\n return;\n }\n\n validateRequest(input);\n const actionResult = await performAction(input.action);\n const state = await captureState(input.screenshotPath);\n sendJson(response, 200, {\n action: actionResult,\n backend: \"cua-driver\",\n screenshot: input.screenshotPath,\n state,\n version: \"0.12.5\",\n });\n } catch (error) {\n if (requestSignal?.aborted && activeRecording !== null) {\n await stopRecording().catch(() => undefined);\n }\n sendJson(response, 500, {\n error: error instanceof Error ? error.message : String(error),\n });\n }\n}\n\nasync function performAction(action) {\n requestSignal?.throwIfAborted();\n validateActionCoordinates(action);\n if (action.action === \"sequence\") {\n const results = [];\n try {\n for (const nested of action.actions) {\n const startedAt = performance.now();\n const result = await performAction(nested);\n results.push({\n action: nested.action,\n durationMs: Math.round(performance.now() - startedAt),\n result,\n });\n }\n return results;\n } catch (error) {\n // Never strand the durable driver in an active-recording state when a\n // rehearsed step fails. Preserve the original action error.\n if (activeRecording !== null) await stopRecording().catch(() => undefined);\n throw error;\n }\n }\n switch (action.action) {\n case \"screenshot\":\n return null;\n case \"click\":\n await moveCursor(action);\n return click(action, 1);\n case \"double_click\":\n await moveCursor(action);\n return click(action, 2);\n case \"triple_click\":\n await moveCursor(action);\n return click(action, 3);\n case \"drag\":\n return dragCursor(action);\n case \"keypress\":\n return action.keys.length === 1\n ? call(\"press_key\", {\n scope: \"desktop\",\n key: normalizeKey(action.keys[0]),\n })\n : call(\"hotkey\", {\n scope: \"desktop\",\n keys: action.keys.map(normalizeKey),\n });\n case \"move\":\n return moveCursor(action);\n case \"scroll\": {\n await call(\"move_cursor\", {\n scope: \"desktop\",\n x: action.x,\n y: action.y,\n });\n const results = [];\n if (action.scrollY !== 0) {\n results.push(await call(\"scroll\", scrollInput(action.scrollY, \"up\", \"down\")));\n }\n if (action.scrollX !== 0) {\n results.push(await call(\"scroll\", scrollInput(action.scrollX, \"left\", \"right\")));\n }\n return results;\n }\n case \"type\":\n return typeText(action);\n case \"clipboard_read\":\n return readClipboard(action.selection);\n case \"clipboard_write\":\n return writeClipboard(action.selection, action.text);\n case \"wait\":\n await sleep(action.durationMs ?? 2_000);\n return null;\n case \"arrange_windows\":\n return arrangeWindows(action);\n case \"record_start\":\n return startRecording(action.path);\n case \"record_stop\":\n return stopRecording();\n default:\n throw new Error(`unsupported computer-use action: ${String(action.action)}`);\n }\n}\n\nasync function captureState(screenshotPath) {\n await call(\"get_desktop_state\", { screenshot_out_file: screenshotPath });\n const pointer = structured(await call(\"get_cursor_position\", {}));\n const screen = x11ScreenSize();\n const windows = structured(await call(\"list_windows\", { on_screen_only: true })).windows;\n const contentWindows = Array.isArray(windows) ? windows.filter(isContentWindow) : [];\n const groundingWindow = contentWindows.toSorted((left, right) => right.z_index - left.z_index)[0];\n\n let elements = [];\n if (groundingWindow !== undefined) {\n const windowState = structured(\n await call(\"get_window_state\", {\n pid: groundingWindow.pid,\n window_id: groundingWindow.window_id,\n include_screenshot: false,\n max_depth: 20,\n max_elements: 250,\n }),\n );\n if (Array.isArray(windowState.elements)) {\n elements = selectGroundingElements(windowState.elements, {\n width: Number(screen.width) || 1920,\n height: Number(screen.height) || 1080,\n });\n }\n }\n\n return formatState(groundingWindow, pointer, elements);\n}\n\nasync function startRecording(path) {\n if (activeRecording !== null) {\n throw new Error(\"a recording is already active\");\n }\n\n const outputDirectory = `${workspaceRoot}/recording-${randomUUID()}`;\n const result = await call(\n \"start_recording\",\n {\n output_dir: outputDirectory,\n record_video: true,\n },\n false,\n );\n activeRecording = {\n outputDirectory,\n outputPath: path,\n stopping: null,\n timer: setTimeout(() => {\n void stopRecording().catch(() => {\n void shutdown();\n });\n }, maxRecordingMs),\n };\n return result;\n}\n\nasync function stopRecording() {\n if (activeRecording === null) {\n throw new Error(\"no recording is active\");\n }\n\n const recording = activeRecording;\n if (recording.stopping !== null) return recording.stopping;\n clearTimeout(recording.timer);\n recording.stopping = finalizeRecording(recording);\n return recording.stopping;\n}\n\nasync function finalizeRecording(recording) {\n try {\n const result = await call(\"stop_recording\", {}, false);\n const output = structured(result);\n const videoPath =\n typeof output.last_video_path === \"string\"\n ? output.last_video_path\n : recording.outputDirectory + \"/recording.mp4\";\n await rename(videoPath, recording.outputPath);\n await rm(recording.outputDirectory, { force: true, recursive: true });\n return result;\n } catch (error) {\n void shutdown();\n throw error;\n } finally {\n activeRecording = null;\n }\n}\n\nasync function call(name, input, cancellable = true) {\n const signal = cancellable ? requestSignal : undefined;\n signal?.throwIfAborted();\n let timer;\n const result = await Promise.race([\n driver.callTool(name, JSON.stringify(input)),\n new Promise((_, reject) => {\n timer = setTimeout(() => {\n // Native calls have no abort API. Do not reuse a driver with uncertain in-flight work.\n void shutdown();\n reject(new Error(\"computer-use native call timed out; restart with startComputerUse\"));\n }, nativeCallTimeoutMs);\n }),\n ]).finally(() => clearTimeout(timer));\n signal?.throwIfAborted();\n if (result.isError) {\n throw new Error(\n `Cua ${name} failed${result.errorCode ? ` (${result.errorCode})` : \"\"}: ${result.text}`,\n );\n }\n return {\n degraded: result.degraded,\n structuredJson: result.structuredJson,\n text: result.text,\n verified: result.verified,\n };\n}\n\nfunction structured(result) {\n if (result.structuredJson === undefined) return {};\n return JSON.parse(result.structuredJson);\n}\n\nfunction pointerClickInput(x, y, button, count) {\n return {\n scope: \"desktop\",\n x,\n y,\n button: button === \"wheel\" ? \"middle\" : button,\n count,\n };\n}\n\nasync function moveCursor(action) {\n if (action.movementStyle === undefined) {\n return call(\"move_cursor\", { scope: \"desktop\", x: action.x, y: action.y });\n }\n const current = structured(await call(\"get_cursor_position\", {}));\n const start = { x: Number(current.x), y: Number(current.y) };\n if (!Number.isFinite(start.x) || !Number.isFinite(start.y)) {\n return call(\"move_cursor\", { scope: \"desktop\", x: action.x, y: action.y });\n }\n const options = { style: action.movementStyle };\n if (action.durationMs !== undefined) options.durationMs = action.durationMs;\n return followPointerPlan(pointerMotionPlan(start, { x: action.x, y: action.y }, options), \"x11\");\n}\n\nasync function dragCursor(action) {\n const start = action.path[0];\n const end = action.path.at(-1);\n if (action.movementStyle === undefined) {\n return call(\"drag\", {\n scope: \"desktop\",\n from_x: start.x,\n from_y: start.y,\n to_x: end.x,\n to_y: end.y,\n steps: Math.min(200, Math.max(20, action.path.length * 10)),\n });\n }\n const style = action.movementStyle;\n const current = structured(await call(\"get_cursor_position\", {}));\n const currentPoint = { x: Number(current.x), y: Number(current.y) };\n const approach =\n Number.isFinite(currentPoint.x) && Number.isFinite(currentPoint.y)\n ? pointerPlanArgs(pointerMotionPlan(currentPoint, start, { style: \"natural\" }))\n : [\"mousemove\", String(start.x), String(start.y)];\n const options = { style };\n if (action.durationMs !== undefined) options.durationMs = action.durationMs;\n const drag = pointerPlanArgs(pointerMotionPlan(start, end, options));\n return xdotool([\n ...approach,\n \"sleep\",\n \"0.025\",\n \"mousedown\",\n \"1\",\n \"sleep\",\n \"0.030\",\n ...drag,\n \"sleep\",\n \"0.030\",\n \"mouseup\",\n \"1\",\n ]);\n}\n\nasync function followPointerPlan(plan, backend = \"cua\") {\n if (backend === \"x11\") return xdotool(pointerPlanArgs(plan));\n const results = [];\n for (let phaseIndex = 0; phaseIndex < plan.phases.length; phaseIndex += 1) {\n for (const point of plan.phases[phaseIndex]) {\n results.push(await call(\"move_cursor\", { scope: \"desktop\", x: point.x, y: point.y }));\n if (point.delayMs > 0) await sleep(point.delayMs);\n }\n if (phaseIndex < plan.phases.length - 1 && plan.settleMs > 0) await sleep(plan.settleMs);\n }\n if (plan.phases.length === 1 && plan.settleMs > 0) await sleep(plan.settleMs);\n return results;\n}\n\nfunction pointerPlanArgs(plan) {\n const args = [];\n for (let phaseIndex = 0; phaseIndex < plan.phases.length; phaseIndex += 1) {\n for (const point of plan.phases[phaseIndex]) {\n args.push(\"mousemove\", String(point.x), String(point.y));\n if (point.delayMs > 0) args.push(\"sleep\", (point.delayMs / 1000).toFixed(3));\n }\n if (phaseIndex < plan.phases.length - 1 && plan.settleMs > 0) {\n args.push(\"sleep\", (plan.settleMs / 1000).toFixed(3));\n }\n }\n if (plan.phases.length === 1 && plan.settleMs > 0) {\n args.push(\"sleep\", (plan.settleMs / 1000).toFixed(3));\n }\n return args;\n}\n\nasync function xdotool(args) {\n const plannedSleepMs = args.reduce(\n (total, value, index) => (args[index - 1] === \"sleep\" ? total + Number(value) * 1000 : total),\n 0,\n );\n const timeout = Math.max(2_000, Math.ceil(plannedSleepMs + 1_500));\n const result = await execFileAsync(\"xdotool\", args, { env: displayEnv(), timeout });\n return {\n plannedSleepMs: Math.round(plannedSleepMs),\n stderr: result.stderr,\n stdout: result.stdout,\n };\n}\n\nfunction typingPlan(action) {\n if (action.typingStyle === \"natural\") return naturalTypingPlan(action.text);\n return [...new Intl.Segmenter().segment(action.text)].map(({ segment }) => ({\n grapheme: segment,\n delayMs: action.typingDelayMs ?? 0,\n }));\n}\n\nfunction validateTypingBudget(actions) {\n let characters = 0;\n let calls = 0;\n let delayMs = 0;\n for (const action of actions) {\n if (action.action !== \"type\") continue;\n if (typeof action.text !== \"string\" || action.text.length > 10_000) {\n throw new Error(\"typing text must be at most 10000 characters\");\n }\n characters += action.text.length;\n if (action.typingStyle === undefined && !action.typingDelayMs) continue;\n const plan = typingPlan(action);\n calls += plan.length;\n delayMs += plan.reduce((total, step) => total + step.delayMs, 0);\n }\n if (characters > 10_000 || calls > 1_000 || delayMs > 30_000) {\n throw new Error(\n \"typing budget exceeded: at most 10000 characters, 1000 paced graphemes and 30000ms delay per request; use unpaced typing for longer text\",\n );\n }\n}\n\nasync function typeText(action) {\n if (action.typingStyle === undefined && !action.typingDelayMs) {\n return call(\"type_text\", { scope: \"desktop\", text: action.text });\n }\n let result;\n let graphemesTyped = 0;\n for (const { grapheme, delayMs } of typingPlan(action)) {\n result = await call(\"type_text\", { scope: \"desktop\", text: grapheme });\n graphemesTyped += 1;\n if (delayMs > 0) await sleep(delayMs);\n }\n return { graphemesTyped, result };\n}\n\nasync function click(action, count) {\n if (action.button !== \"back\" && action.button !== \"forward\") {\n return call(\"click\", pointerClickInput(action.x, action.y, action.button, count));\n }\n\n await call(\"move_cursor\", {\n scope: \"desktop\",\n x: action.x,\n y: action.y,\n });\n const results = [];\n for (let index = 0; index < count; index += 1) {\n results.push(\n await call(\"hotkey\", {\n scope: \"desktop\",\n keys: [\"alt\", action.button === \"back\" ? \"left\" : \"right\"],\n }),\n );\n }\n return results;\n}\n\nasync function readClipboard(selection) {\n try {\n const result = await execFileAsync(\"xclip\", [\"-selection\", xclipSelection(selection), \"-out\"], {\n env: displayEnv(),\n maxBuffer: maxClipboardBytes + 1,\n });\n if (Buffer.byteLength(result.stdout) > maxClipboardBytes) {\n throw new Error(`clipboard content exceeds ${maxClipboardBytes} bytes`);\n }\n return { selection, text: result.stdout };\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"clipboard content exceeds\")) throw error;\n return { selection, text: \"\" };\n }\n}\n\nasync function writeClipboard(selection, text) {\n if (Buffer.byteLength(text) > maxClipboardBytes) {\n throw new Error(`clipboard content exceeds ${maxClipboardBytes} bytes`);\n }\n await new Promise((resolve, reject) => {\n const child = execFile(\"xclip\", [\"-selection\", xclipSelection(selection), \"-in\"], {\n env: displayEnv(),\n timeout: nativeCallTimeoutMs,\n signal: requestSignal,\n });\n child.once(\"error\", reject);\n child.once(\"exit\", (code) =>\n code === 0 ? resolve() : reject(new Error(`xclip exited ${code}`)),\n );\n child.stdin.end(text);\n });\n return { bytes: Buffer.byteLength(text), selection };\n}\n\nfunction xclipSelection(selection) {\n return selection === \"primary\" ? \"primary\" : \"clipboard\";\n}\n\nasync function arrangeWindows(action) {\n const scene = validateWindowScene(action.windows);\n const deadline = Date.now() + action.waitForMs;\n let resolved = null;\n while (resolved === null) {\n const windows = structured(await call(\"list_windows\", { on_screen_only: true })).windows;\n resolved = resolveSceneWindows(scene, Array.isArray(windows) ? windows : []);\n if (resolved !== null) break;\n if (Date.now() >= deadline) {\n throw new Error(\n `arrange_windows timed out waiting for: ${missingSceneSelectors(scene, Array.isArray(windows) ? windows : []).join(\", \")}`,\n );\n }\n await sleep(100);\n }\n\n // Resolve the complete scene before mutating any window. A missing selector\n // therefore leaves the existing desktop untouched.\n for (const item of resolved) {\n const windowId = String(item.window.window_id);\n await execFileAsync(\"xdotool\", [\"windowactivate\", \"--sync\", windowId], { env: displayEnv() });\n await execFileAsync(\n \"xdotool\",\n [\"windowmove\", windowId, String(item.bounds.x), String(item.bounds.y)],\n {\n env: displayEnv(),\n },\n );\n await execFileAsync(\n \"xdotool\",\n [\"windowsize\", windowId, String(item.bounds.width), String(item.bounds.height)],\n { env: displayEnv() },\n );\n }\n\n let verified = null;\n let windows = [];\n for (let attempt = 0; attempt < 10; attempt += 1) {\n const response = structured(await call(\"list_windows\", { on_screen_only: true })).windows;\n windows = Array.isArray(response) ? response : [];\n verified = resolveSceneWindows(scene, windows);\n if (\n verified !== null &&\n verified.every(({ bounds, window }) => approximatelyEqual(bounds, window))\n ) {\n return verified.map(layoutResult);\n }\n await sleep(100);\n }\n\n const screenshotPath = `${workspaceRoot}/layout-failure-${Date.now()}.png`;\n await call(\"get_desktop_state\", { screenshot_out_file: screenshotPath });\n const details =\n verified === null\n ? { stage: \"selector_resolution\", missing: missingSceneSelectors(scene, windows) }\n : {\n stage: \"verification\",\n tolerance: layoutTolerance,\n windows: verified.map(layoutResult),\n };\n throw new Error(\n `arrange_windows failed: ${JSON.stringify({ ...details, screenshot: screenshotPath })}`,\n );\n}\n\nfunction validateWindowScene(windows) {\n if (!Array.isArray(windows) || windows.length < 1 || windows.length > 4) {\n throw new Error(\"arrange_windows requires 1 to 4 windows\");\n }\n const scene = windows.map((item) => ({ ...item, bounds: regionBounds(item.region) }));\n const selectors = scene.map((item) => selectorLabel(item.selector));\n if (new Set(selectors).size !== selectors.length) {\n throw new Error(\"arrange_windows selectors must be unique\");\n }\n for (let left = 0; left < scene.length; left += 1) {\n for (let right = left + 1; right < scene.length; right += 1) {\n if (overlaps(scene[left].bounds, scene[right].bounds)) {\n throw new Error(\"arrange_windows regions must not overlap\");\n }\n }\n }\n return scene;\n}\n\nfunction desktopBounds() {\n const screen = x11ScreenSize();\n return {\n x: desktopMargin,\n y: desktopMargin,\n width: screen.width - desktopMargin * 2,\n height: screen.height - desktopMargin * 2,\n };\n}\n\nfunction x11ScreenSize() {\n // The X server is the source of truth after set_desktop_size. Avoid CUA's\n // session-oriented get_screen_size contract, which differs from pointer\n // actions and does not accept scope.\n const output = execFileSync(\"xdpyinfo\", [\"-display\", \":99\"], {\n encoding: \"utf8\",\n timeout: 2_000,\n });\n const match = /dimensions:\\s+(\\d+)x(\\d+) pixels/u.exec(output);\n if (match === null) throw new Error(\"could not determine desktop dimensions\");\n return { width: Number(match[1]), height: Number(match[2]) };\n}\n\nfunction regionBounds(region) {\n if (\n typeof region !== \"object\" ||\n region === null ||\n ![region.x, region.y, region.width, region.height].every(Number.isFinite) ||\n region.x < 0 ||\n region.y < 0 ||\n region.width <= 0 ||\n region.height <= 0 ||\n region.x + region.width > 1 ||\n region.y + region.height > 1\n ) {\n throw new Error(\"arrange_windows regions must fit within the desktop\");\n }\n const desktop = desktopBounds();\n const left = Math.round(desktop.x + desktop.width * region.x);\n const top = Math.round(desktop.y + desktop.height * region.y);\n const right = Math.round(desktop.x + desktop.width * (region.x + region.width));\n const bottom = Math.round(desktop.y + desktop.height * (region.y + region.height));\n const bounds = { x: left, y: top, width: right - left, height: bottom - top };\n if (bounds.width < minimumWindow.width || bounds.height < minimumWindow.height) {\n throw new Error(\n `arrange_windows regions must be at least ${minimumWindow.width}x${minimumWindow.height}`,\n );\n }\n return bounds;\n}\n\nfunction resolveSceneWindows(scene, windows) {\n const resolved = scene.map((item) => {\n const window = windows.find((candidate) => matchesSelector(candidate, item.selector));\n return window === undefined ? null : { bounds: item.bounds, window };\n });\n return resolved.includes(null) ? null : resolved;\n}\n\nfunction missingSceneSelectors(scene, windows) {\n return scene\n .filter((item) => !windows.some((window) => matchesSelector(window, item.selector)))\n .map((item) => selectorLabel(item.selector));\n}\n\nfunction matchesSelector(window, selector) {\n const identity = `${window.app_name ?? \"\"}\\n${window.title ?? \"\"}`.toLowerCase();\n if (selector.app === \"firefox\") return identity.includes(\"firefox\");\n const title = selector.instance === \"primary\" ? \"terminal 1\" : \"terminal 2\";\n return identity.includes(title);\n}\n\nfunction selectorLabel(selector) {\n return selector.app === \"firefox\" ? \"firefox\" : `xterm:${selector.instance}`;\n}\n\nfunction overlaps(left, right) {\n return (\n left.x < right.x + right.width &&\n left.x + left.width > right.x &&\n left.y < right.y + right.height &&\n left.y + left.height > right.y\n );\n}\n\nfunction layoutResult({ bounds, window }) {\n const observed = {\n x: Number(window.x),\n y: Number(window.y),\n width: Number(window.width),\n height: Number(window.height),\n };\n return {\n selector: `${window.app_name ?? \"\"}:${window.title ?? \"\"}`,\n requested: bounds,\n observed,\n delta: {\n x: observed.x - bounds.x,\n y: observed.y - bounds.y,\n width: observed.width - bounds.width,\n height: observed.height - bounds.height,\n },\n tolerance: layoutTolerance,\n title: window.title,\n window_id: window.window_id,\n };\n}\n\nfunction displayEnv() {\n return { ...env, DISPLAY: \":99\" };\n}\n\nfunction approximatelyEqual(bounds, window) {\n return (\n Math.abs(bounds.x - window.x) <= layoutTolerance.x &&\n Math.abs(bounds.y - window.y) <= layoutTolerance.y &&\n Math.abs(bounds.width - window.width) <= layoutTolerance.width &&\n Math.abs(bounds.height - window.height) <= layoutTolerance.height\n );\n}\n\nfunction sleep(milliseconds) {\n return delay(milliseconds, undefined, { signal: requestSignal });\n}\n\nfunction scrollInput(delta, negativeDirection, positiveDirection) {\n return {\n scope: \"desktop\",\n direction: delta < 0 ? negativeDirection : positiveDirection,\n amount: Math.min(50, Math.max(1, Math.round(Math.abs(delta) / 100))),\n by: \"line\",\n };\n}\n\nfunction normalizeKey(key) {\n const aliases = {\n ARROWDOWN: \"down\",\n ARROWLEFT: \"left\",\n ARROWRIGHT: \"right\",\n ARROWUP: \"up\",\n CMD: \"meta\",\n COMMAND: \"meta\",\n CONTROL: \"ctrl\",\n DEL: \"delete\",\n ENTER: \"enter\",\n ESC: \"escape\",\n OPTION: \"alt\",\n RETURN: \"enter\",\n };\n return aliases[key] ?? key.toLowerCase();\n}\n\nfunction isContentWindow(window) {\n const identity = `${window.app_name ?? \"\"}\\n${window.title ?? \"\"}`.toLowerCase();\n return (\n window.width >= 200 &&\n window.height >= 100 &&\n !identity.includes(\"xfce4-panel\") &&\n !identity.includes(\"xfdesktop\") &&\n window.title !== \"Desktop\"\n );\n}\n\nfunction formatState(groundingWindow, pointer, elements) {\n const lines = [\n groundingWindow === undefined\n ? \"grounding_window\\t(none)\"\n : `grounding_window\\t${groundingWindow.title} pid=${groundingWindow.pid} window_id=${groundingWindow.window_id}`,\n `pointer\\tx=${pointer.x ?? \"unknown\"} y=${pointer.y ?? \"unknown\"}`,\n \"accessibility_elements\",\n ];\n\n for (const element of elements) {\n const frame =\n element.frame === undefined\n ? \"\"\n : ` x=${element.frame.x} y=${element.frame.y} width=${element.frame.w} height=${element.frame.h}`;\n lines.push(\n `[${element.element_index}] role=${element.role}${frame} label=${JSON.stringify(element.label ?? \"\")}`,\n );\n }\n return lines.join(\"\\n\");\n}\n\nfunction validateActionCoordinates(action) {\n const screen = x11ScreenSize();\n const points = [];\n if ([\"click\", \"double_click\", \"triple_click\", \"move\", \"scroll\"].includes(action.action)) {\n points.push({ x: action.x, y: action.y });\n }\n if (action.action === \"drag\") points.push(...action.path);\n for (const point of points) {\n if (\n !Number.isFinite(point.x) ||\n !Number.isFinite(point.y) ||\n point.x < 0 ||\n point.y < 0 ||\n point.x >= screen.width ||\n point.y >= screen.height\n ) {\n throw new Error(\n `computer-use coordinate is outside the ${screen.width}x${screen.height} desktop`,\n );\n }\n }\n}\n\nfunction validateRequest(input) {\n if (typeof input !== \"object\" || input === null) {\n throw new Error(\"request must be an object\");\n }\n if (!isArtifactPath(input.screenshotPath, \".png\")) {\n throw new Error(\"screenshot path must be a PNG under the computer-use workspace\");\n }\n if (typeof input.action !== \"object\" || input.action === null) {\n throw new Error(\"request action must be an object\");\n }\n const actions = new Set([\n \"arrange_windows\",\n \"click\",\n \"clipboard_read\",\n \"clipboard_write\",\n \"double_click\",\n \"drag\",\n \"keypress\",\n \"move\",\n \"record_start\",\n \"record_stop\",\n \"screenshot\",\n \"scroll\",\n \"sequence\",\n \"triple_click\",\n \"type\",\n \"wait\",\n ]);\n if (!actions.has(input.action.action)) {\n throw new Error(`unsupported computer-use action: ${String(input.action.action)}`);\n }\n if (input.action.action === \"sequence\") {\n if (\n !Array.isArray(input.action.actions) ||\n input.action.actions.length < 1 ||\n input.action.actions.length > 30\n ) {\n throw new Error(\"sequence must contain 1 to 30 actions\");\n }\n for (const action of input.action.actions) validateNestedSequenceAction(action);\n }\n if (input.action.action === \"arrange_windows\") validateArrangeWindowsAction(input.action);\n if (input.action.action === \"record_start\" && !isArtifactPath(input.action.path, \".mp4\")) {\n throw new Error(\"recording path must be an MP4 under the computer-use workspace\");\n }\n if (\n [\"click\", \"double_click\", \"triple_click\", \"drag\", \"move\"].includes(input.action.action) &&\n \"durationMs\" in input.action &&\n (!Number.isInteger(input.action.durationMs) ||\n input.action.durationMs < 0 ||\n input.action.durationMs > 2000)\n ) {\n throw new Error(\"pointer durationMs must be an integer from 0 to 2000\");\n }\n validateMovementStyle(input.action, \"\");\n if (\n input.action.action === \"wait\" &&\n (!Number.isInteger(input.action.durationMs) ||\n input.action.durationMs < 100 ||\n input.action.durationMs > 10_000)\n ) {\n throw new Error(\"wait durationMs must be an integer from 100 to 10000\");\n }\n validateClipboardOptions(input.action);\n validateTypingOptions(input.action, \"\");\n validateTypingBudget(input.action.action === \"sequence\" ? input.action.actions : [input.action]);\n}\n\nfunction validateNestedSequenceAction(action) {\n if (typeof action !== \"object\" || action === null)\n throw new Error(\"sequence action must be an object\");\n const allowed = new Set([\n \"arrange_windows\",\n \"click\",\n \"double_click\",\n \"drag\",\n \"keypress\",\n \"move\",\n \"record_start\",\n \"record_stop\",\n \"triple_click\",\n \"type\",\n \"wait\",\n ]);\n if (!allowed.has(action.action))\n throw new Error(`unsupported sequence action: ${String(action.action)}`);\n if (action.action === \"arrange_windows\") validateArrangeWindowsAction(action);\n if (action.action === \"record_start\" && !isArtifactPath(action.path, \".mp4\")) {\n throw new Error(\"sequence recording path must be an MP4 under the computer-use workspace\");\n }\n if (\n [\"click\", \"double_click\", \"triple_click\", \"drag\", \"move\"].includes(action.action) &&\n \"durationMs\" in action &&\n (!Number.isInteger(action.durationMs) || action.durationMs < 0 || action.durationMs > 2000)\n ) {\n throw new Error(\"sequence pointer durationMs must be an integer from 0 to 2000\");\n }\n validateMovementStyle(action, \"sequence \");\n if (\n action.action === \"wait\" &&\n (!Number.isInteger(action.durationMs) || action.durationMs < 100 || action.durationMs > 10_000)\n ) {\n throw new Error(\"sequence wait durationMs must be an integer from 100 to 10000\");\n }\n if (action.action === \"type\") validateTypingOptions(action, \"sequence \");\n}\n\nfunction validateMovementStyle(action, prefix) {\n if (\n \"movementStyle\" in action &&\n action.movementStyle !== \"natural\" &&\n action.movementStyle !== \"precision\"\n ) {\n throw new Error(`${prefix}movementStyle must be natural or precision`);\n }\n if (\n action.action === \"drag\" &&\n \"movementStyle\" in action &&\n action.movementStyle !== \"precision\"\n ) {\n throw new Error(`${prefix}drag movementStyle must be precision`);\n }\n}\n\nfunction validateClipboardOptions(action) {\n if (\n [\"clipboard_read\", \"clipboard_write\"].includes(action.action) &&\n action.selection !== \"clipboard\" &&\n action.selection !== \"primary\"\n ) {\n throw new Error(\"clipboard selection must be clipboard or primary\");\n }\n if (\n action.action === \"clipboard_write\" &&\n (typeof action.text !== \"string\" || Buffer.byteLength(action.text) > maxClipboardBytes)\n ) {\n throw new Error(`clipboard text must be at most ${maxClipboardBytes} bytes`);\n }\n}\n\nfunction validateTypingOptions(action, prefix) {\n if (\n \"typingDelayMs\" in action &&\n (!Number.isInteger(action.typingDelayMs) ||\n action.typingDelayMs < 0 ||\n action.typingDelayMs > 200)\n ) {\n throw new Error(`${prefix}typingDelayMs must be an integer from 0 to 200`);\n }\n if (\"typingStyle\" in action && action.typingStyle !== \"natural\") {\n throw new Error(`${prefix}typingStyle must be natural`);\n }\n if (\"typingStyle\" in action && \"typingDelayMs\" in action) {\n throw new Error(`${prefix}type action cannot set both typingStyle and typingDelayMs`);\n }\n}\n\nfunction validateArrangeWindowsAction(action) {\n if (!Number.isInteger(action.waitForMs) || action.waitForMs < 0 || action.waitForMs > 10_000) {\n throw new Error(\"arrange_windows waitForMs must be an integer from 0 to 10000\");\n }\n validateWindowScene(action.windows);\n}\n\nfunction isArtifactPath(value, extension) {\n if (typeof value !== \"string\" || !value.endsWith(extension)) return false;\n const path = resolve(value);\n return dirname(path) === workspaceRoot;\n}\n\nasync function readBody(request) {\n let body = \"\";\n for await (const chunk of request) {\n body += chunk;\n if (Buffer.byteLength(body) > maxRequestBytes) {\n throw new Error(\"request exceeds 32 KiB\");\n }\n }\n return body;\n}\n\nfunction sendJson(response, statusCode, body) {\n if (response.destroyed) return;\n const json = JSON.stringify(body);\n response.writeHead(statusCode, {\n \"content-length\": Buffer.byteLength(json),\n \"content-type\": \"application/json\",\n });\n response.end(json);\n}\n";
|
|
9
|
+
readonly "client.mjs": "import http from \"node:http\";\nimport { env } from \"node:process\";\n\nconst socketPath = env.COMPUTER_USE_SOCKET_PATH;\nconst body = env.COMPUTER_USE_REQUEST;\n\nif (body === undefined) {\n throw new Error(\"COMPUTER_USE_REQUEST is required\");\n}\n\nconst deadline = Date.now() + 120_000;\nconst response = await new Promise((resolve, reject) => {\n const request = http.request(\n {\n socketPath,\n method: \"POST\",\n path: \"/call\",\n headers: {\n \"content-length\": Buffer.byteLength(body),\n \"content-type\": \"application/json\",\n \"x-computer-use-deadline\": String(deadline),\n },\n },\n (incoming) => {\n incoming.on(\"error\", reject);\n incoming.setEncoding(\"utf8\");\n let responseBody = \"\";\n incoming.on(\"data\", (chunk) => {\n responseBody += chunk;\n });\n incoming.on(\"end\", () => {\n resolve({ body: responseBody, statusCode: incoming.statusCode ?? 500 });\n });\n },\n );\n const timer = setTimeout(\n () => request.destroy(new Error(\"computer-use request deadline exceeded\")),\n Math.max(0, deadline - Date.now()),\n );\n request.once(\"close\", () => clearTimeout(timer));\n request.on(\"error\", reject);\n request.end(body);\n});\n\nif (response.statusCode !== 200) {\n process.stderr.write(response.body);\n process.exitCode = 1;\n} else {\n process.stdout.write(response.body);\n}\n";
|
|
10
|
+
readonly "state.mjs": "const MAX_GROUNDING_ELEMENTS = 80;\n\n/**\n * @typedef {{\n * element_index?: number;\n * frame?: { h?: number; w?: number; x?: number; y?: number };\n * label?: unknown;\n * [key: string]: unknown;\n * }} GroundingElement\n */\n\n/**\n * Keep the model-facing state aligned with the visible desktop screenshot.\n *\n * @param {unknown[]} elements\n * @returns {GroundingElement[]}\n */\nexport function selectGroundingElements(elements, screen = { width: 1920, height: 1080 }) {\n return elements\n .filter((element) => isVisibleLabeledElement(element, screen))\n .slice(0, MAX_GROUNDING_ELEMENTS);\n}\n\n/**\n * @param {unknown} value\n * @returns {value is GroundingElement}\n */\nfunction isVisibleLabeledElement(value, screen) {\n if (typeof value !== \"object\" || value === null) return false;\n const element = /** @type {GroundingElement} */ (value);\n const frame = element.frame;\n if (typeof element.label !== \"string\" || element.label.trim().length === 0) return false;\n if (typeof frame !== \"object\" || frame === null) return false;\n if (\n !Number.isFinite(frame.x) ||\n !Number.isFinite(frame.y) ||\n !Number.isFinite(frame.w) ||\n !Number.isFinite(frame.h)\n ) {\n return false;\n }\n\n const x = /** @type {number} */ (frame.x);\n const y = /** @type {number} */ (frame.y);\n const width = /** @type {number} */ (frame.w);\n const height = /** @type {number} */ (frame.h);\n return (\n width > 0 &&\n height > 0 &&\n x < screen.width &&\n y < screen.height &&\n x + width > 0 &&\n y + height > 0\n );\n}\n";
|
|
11
|
+
readonly "typing.mjs": "const DEMO_TYPING_SPEED = 1.2;\nconst MIN_DELAY_MS = 35;\nconst MAX_DELAY_MS = 220;\n\nexport function naturalTypingPlan(text) {\n const graphemes = [...new Intl.Segmenter().segment(text)].map(({ segment }) => segment);\n let state = hashText(text) || 1;\n return graphemes.map((grapheme, index) => {\n state = nextState(state);\n return {\n grapheme,\n delayMs: index === graphemes.length - 1 ? 0 : naturalDelay(grapheme, state),\n };\n });\n}\n\nfunction naturalDelay(grapheme, state) {\n const jitter = state / 0x1_0000_0000;\n const range = delayRange(grapheme);\n return Math.round((range.min + (range.max - range.min) * jitter) / DEMO_TYPING_SPEED);\n}\n\nfunction delayRange(grapheme) {\n if (/\\s/u.test(grapheme)) return { min: 75, max: 125 };\n if (/[.!?]/u.test(grapheme)) return { min: 145, max: MAX_DELAY_MS };\n if (/[/|;&]/u.test(grapheme)) return { min: 105, max: 175 };\n if (/[-_=,:]/u.test(grapheme)) return { min: 70, max: 125 };\n return { min: MIN_DELAY_MS, max: 85 };\n}\n\nfunction hashText(text) {\n let hash = 2166136261;\n for (const character of text) {\n hash ^= character.codePointAt(0);\n hash = Math.imul(hash, 16777619);\n }\n return hash >>> 0;\n}\n\nfunction nextState(state) {\n let value = state;\n value ^= value << 13;\n value ^= value >>> 17;\n value ^= value << 5;\n return value >>> 0;\n}\n";
|
|
12
|
+
readonly "pointer-motion.mjs": "const FRAME_MS = 16;\n\nexport function pointerMotionPlan(start, end, options = {}) {\n const style = options.style ?? \"natural\";\n const distance = Math.hypot(end.x - start.x, end.y - start.y);\n const durationMs = options.durationMs ?? naturalDuration(distance, style);\n if (distance < 2 || durationMs === 0) {\n return { phases: [[{ ...end, delayMs: 0 }]], settleMs: 0 };\n }\n\n if (style === \"precision\" && distance >= 120) {\n const ratio = 0.92 + deterministicUnit(start, end, 7) * 0.04;\n const undershoot = {\n x: Math.round(start.x + (end.x - start.x) * ratio),\n y: Math.round(start.y + (end.y - start.y) * ratio),\n };\n // Cover most of the distance quickly, then spend a disproportionate\n // share of the duration continuously correcting the final 4–8%.\n const firstDuration = Math.round(durationMs * 0.62);\n return {\n phases: [\n bezierPhase(start, undershoot, firstDuration, \"natural\", 11),\n bezierPhase(undershoot, end, durationMs - firstDuration, \"precision\", 23),\n ],\n settleMs: 0,\n };\n }\n\n return {\n phases: [bezierPhase(start, end, durationMs, style, 17)],\n settleMs: style === \"natural\" ? 15 + Math.round(deterministicUnit(start, end, 31) * 15) : 0,\n };\n}\n\nfunction bezierPhase(start, end, durationMs, style, salt) {\n const distance = Math.hypot(end.x - start.x, end.y - start.y);\n const steps = Math.max(2, Math.min(60, Math.round(durationMs / FRAME_MS)));\n const perpendicular = unitPerpendicular(start, end);\n const bendLimit = style === \"precision\" ? 8 : Math.min(70, distance * 0.09);\n const bend = (deterministicUnit(start, end, salt) * 2 - 1) * bendLimit;\n const c1 = {\n x: start.x + (end.x - start.x) * 0.28 + perpendicular.x * bend,\n y: start.y + (end.y - start.y) * 0.28 + perpendicular.y * bend,\n };\n const c2 = {\n x: start.x + (end.x - start.x) * 0.76 + perpendicular.x * bend * 0.65,\n y: start.y + (end.y - start.y) * 0.76 + perpendicular.y * bend * 0.65,\n };\n const delayMs = durationMs / steps;\n return Array.from({ length: steps }, (_, index) => {\n // This asymmetric timing curve accelerates quickly and eases into the\n // target without the perfectly mirrored feel of smoothstep.\n const progress = (index + 1) / steps;\n const t = 1 - (1 - progress) ** 2.35;\n const point = cubicBezier(start, c1, c2, end, t);\n return {\n x: index === steps - 1 ? end.x : Math.round(point.x),\n y: index === steps - 1 ? end.y : Math.round(point.y),\n delayMs: index === steps - 1 ? 0 : delayMs,\n };\n });\n}\n\nfunction cubicBezier(start, c1, c2, end, t) {\n const inverse = 1 - t;\n return {\n x:\n inverse ** 3 * start.x +\n 3 * inverse ** 2 * t * c1.x +\n 3 * inverse * t ** 2 * c2.x +\n t ** 3 * end.x,\n y:\n inverse ** 3 * start.y +\n 3 * inverse ** 2 * t * c1.y +\n 3 * inverse * t ** 2 * c2.y +\n t ** 3 * end.y,\n };\n}\n\nfunction naturalDuration(distance, style) {\n const base = style === \"precision\" ? 150 : 110;\n const scale = style === \"precision\" ? 0.35 : 0.28;\n const minimum = style === \"precision\" ? 180 : 140;\n const maximum = style === \"precision\" ? 650 : 550;\n return Math.round(Math.min(maximum, Math.max(minimum, base + distance * scale)));\n}\n\nfunction unitPerpendicular(start, end) {\n const dx = end.x - start.x;\n const dy = end.y - start.y;\n const length = Math.hypot(dx, dy) || 1;\n return { x: -dy / length, y: dx / length };\n}\n\nfunction deterministicUnit(start, end, salt) {\n let value =\n (Math.imul(Math.round(start.x), 73_856_093) ^\n Math.imul(Math.round(start.y), 19_349_663) ^\n Math.imul(Math.round(end.x), 83_492_791) ^\n Math.imul(Math.round(end.y), 2_654_435_761) ^\n salt) >>>\n 0;\n value ^= value << 13;\n value ^= value >>> 17;\n value ^= value << 5;\n return (value >>> 0) / 0x1_0000_0000;\n}\n";
|
|
13
|
+
readonly "package.json": "{\n \"name\": \"computer-use-driver\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@trycua/cua-driver\": \"0.12.5\"\n }\n}\n";
|
|
14
|
+
};
|