From cb15c5e0d8988f5c50e31ef2c675d49b3e280ac0 Mon Sep 17 00:00:00 2001 From: wehub-resource-sync Date: Mon, 13 Jul 2026 12:35:58 +0800 Subject: [PATCH] chore: import upstream snapshot with attribution --- .claude-plugin/marketplace.json | 19 + .github/workflows/ci.yml | 294 + .github/workflows/release.yml | 406 + .gitignore | 73 + .husky/pre-commit | 2 + .node-version | 1 + .prettierrc | 7 + AGENTS.md | 214 + CHANGELOG.md | 1065 + LICENSE | 201 + README.md | 1720 + README.wehub.md | 7 + agent-browser.schema.json | 248 + benchmarks/.env.example | 4 + benchmarks/.gitignore | 2 + benchmarks/README.md | 76 + benchmarks/bench.ts | 900 + benchmarks/package.json | 13 + benchmarks/pnpm-lock.yaml | 472 + benchmarks/scenarios.ts | 105 + benchmarks/tsconfig.json | 13 + bin/agent-browser.js | 120 + cli/Cargo.lock | 3187 ++ cli/Cargo.toml | 61 + cli/build.rs | 498 + cli/cdp-protocol/browser_protocol.json | 31262 ++++++++++++++++ cli/cdp-protocol/js_protocol.json | 3810 ++ cli/src/chat.rs | 503 + cli/src/color.rs | 173 + cli/src/commands.rs | 5699 +++ cli/src/connection.rs | 1593 + cli/src/doctor/chrome.rs | 156 + cli/src/doctor/config.rs | 90 + cli/src/doctor/daemon.rs | 70 + cli/src/doctor/environment.rs | 140 + cli/src/doctor/fix.rs | 247 + cli/src/doctor/helpers.rs | 185 + cli/src/doctor/launch.rs | 192 + cli/src/doctor/mod.rs | 289 + cli/src/doctor/network.rs | 154 + cli/src/doctor/providers.rs | 128 + cli/src/doctor/security.rs | 167 + cli/src/flags.rs | 1840 + cli/src/install.rs | 1056 + cli/src/main.rs | 2051 + cli/src/mcp.rs | 4034 ++ cli/src/native/actions.rs | 11460 ++++++ cli/src/native/auth.rs | 556 + cli/src/native/browser.rs | 2202 ++ cli/src/native/cdp/chrome.rs | 1994 + cli/src/native/cdp/client.rs | 361 + cli/src/native/cdp/discovery.rs | 387 + cli/src/native/cdp/lightpanda.rs | 495 + cli/src/native/cdp/mod.rs | 5 + cli/src/native/cdp/types.rs | 586 + cli/src/native/cookies.rs | 100 + cli/src/native/daemon.rs | 792 + cli/src/native/diff.rs | 274 + cli/src/native/e2e_tests.rs | 6332 ++++ cli/src/native/element.rs | 1478 + cli/src/native/inspect_server.rs | 362 + cli/src/native/interaction.rs | 1337 + cli/src/native/mod.rs | 49 + cli/src/native/network.rs | 672 + cli/src/native/parity_tests.rs | 721 + cli/src/native/policy.rs | 217 + cli/src/native/providers.rs | 1103 + cli/src/native/react/installHook.js | 28 + cli/src/native/react/mod.rs | 29 + cli/src/native/react/renders.rs | 169 + cli/src/native/react/scripts.rs | 842 + cli/src/native/react/suspense.rs | 633 + cli/src/native/react/tree.rs | 67 + cli/src/native/recording.rs | 323 + cli/src/native/screenshot.rs | 691 + cli/src/native/snapshot.rs | 1586 + cli/src/native/state.rs | 1061 + cli/src/native/storage.rs | 94 + cli/src/native/stream/cdp_loop.rs | 325 + cli/src/native/stream/chat.rs | 970 + cli/src/native/stream/dashboard.rs | 960 + cli/src/native/stream/discovery.rs | 118 + cli/src/native/stream/http.rs | 715 + cli/src/native/stream/mod.rs | 486 + cli/src/native/stream/websocket.rs | 338 + cli/src/native/test_fixtures/drag_probe.html | 135 + .../test_fixtures/html5_drag_probe.html | 91 + .../test_fixtures/pointer_capture_probe.html | 113 + .../native/test_fixtures/upload_probe.html | 18 + cli/src/native/tracing.rs | 373 + cli/src/native/webdriver/appium.rs | 240 + cli/src/native/webdriver/backend.rs | 142 + cli/src/native/webdriver/client.rs | 318 + cli/src/native/webdriver/ios.rs | 235 + cli/src/native/webdriver/mod.rs | 6 + cli/src/native/webdriver/safari.rs | 80 + cli/src/native/webdriver/types.rs | 97 + cli/src/output.rs | 3927 ++ cli/src/plugins.rs | 1346 + cli/src/read.rs | 1913 + cli/src/skills.rs | 622 + cli/src/test_utils.rs | 49 + cli/src/upgrade.rs | 284 + cli/src/validation.rs | 60 + cli/tests/doctor_cli.rs | 141 + docker/Dockerfile.build | 34 + docker/docker-compose.yml | 163 + docs/.gitignore | 41 + docs/components.json | 22 + docs/eslint.config.mjs | 18 + docs/mdx-components.tsx | 102 + docs/next.config.mjs | 11 + docs/package.json | 48 + docs/pnpm-lock.yaml | 8139 ++++ docs/postcss.config.mjs | 7 + docs/public/Geist-Regular.ttf | Bin 0 -> 71112 bytes docs/public/GeistPixel-Square.ttf | Bin 0 -> 94800 bytes docs/public/schema.json | 248 + docs/src/app/api/docs-chat/route.ts | 123 + docs/src/app/api/docs-markdown/route.ts | 40 + docs/src/app/api/search/route.ts | 69 + docs/src/app/cdp-mode/layout.tsx | 7 + docs/src/app/cdp-mode/page.mdx | 120 + docs/src/app/changelog/layout.tsx | 7 + docs/src/app/changelog/page.mdx | 1325 + docs/src/app/commands/layout.tsx | 7 + docs/src/app/commands/page.mdx | 688 + docs/src/app/configuration/layout.tsx | 7 + docs/src/app/configuration/page.mdx | 310 + docs/src/app/dashboard/layout.tsx | 7 + docs/src/app/dashboard/page.mdx | 160 + docs/src/app/debugging/layout.tsx | 7 + docs/src/app/debugging/page.mdx | 81 + docs/src/app/diffing/layout.tsx | 7 + docs/src/app/diffing/page.mdx | 175 + docs/src/app/engines/chrome/layout.tsx | 7 + docs/src/app/engines/chrome/page.mdx | 105 + docs/src/app/engines/lightpanda/layout.tsx | 7 + docs/src/app/engines/lightpanda/page.mdx | 93 + docs/src/app/favicon.ico | Bin 0 -> 25931 bytes docs/src/app/files/layout.tsx | 7 + docs/src/app/files/page.mdx | 73 + docs/src/app/globals.css | 374 + docs/src/app/init-scripts/layout.tsx | 7 + docs/src/app/init-scripts/page.mdx | 65 + docs/src/app/installation/layout.tsx | 7 + docs/src/app/installation/page.mdx | 175 + docs/src/app/ios/layout.tsx | 7 + docs/src/app/ios/page.mdx | 202 + docs/src/app/layout.tsx | 93 + docs/src/app/native-mode/layout.tsx | 7 + docs/src/app/native-mode/page.mdx | 5 + docs/src/app/network/layout.tsx | 7 + docs/src/app/network/page.mdx | 81 + docs/src/app/next/layout.tsx | 7 + docs/src/app/next/page.mdx | 137 + docs/src/app/og/[...slug]/route.tsx | 16 + docs/src/app/og/og-image.tsx | 112 + docs/src/app/og/route.tsx | 6 + docs/src/app/page.mdx | 65 + docs/src/app/plugins/layout.tsx | 7 + docs/src/app/plugins/page.mdx | 409 + docs/src/app/profiler/layout.tsx | 7 + docs/src/app/profiler/page.mdx | 103 + docs/src/app/providers/agentcore/layout.tsx | 7 + docs/src/app/providers/agentcore/page.mdx | 89 + docs/src/app/providers/browser-use/layout.tsx | 7 + docs/src/app/providers/browser-use/page.mdx | 24 + docs/src/app/providers/browserbase/layout.tsx | 7 + docs/src/app/providers/browserbase/page.mdx | 24 + docs/src/app/providers/browserless/layout.tsx | 7 + docs/src/app/providers/browserless/page.mdx | 39 + docs/src/app/providers/kernel/layout.tsx | 7 + docs/src/app/providers/kernel/page.mdx | 41 + docs/src/app/proxy/layout.tsx | 7 + docs/src/app/proxy/page.mdx | 75 + docs/src/app/quick-start/layout.tsx | 7 + docs/src/app/quick-start/page.mdx | 90 + docs/src/app/react/layout.tsx | 7 + docs/src/app/react/page.mdx | 63 + docs/src/app/recording/layout.tsx | 7 + docs/src/app/recording/page.mdx | 96 + docs/src/app/security/layout.tsx | 7 + docs/src/app/security/page.mdx | 319 + docs/src/app/selectors/layout.tsx | 7 + docs/src/app/selectors/page.mdx | 54 + docs/src/app/sessions/layout.tsx | 7 + docs/src/app/sessions/page.mdx | 283 + docs/src/app/skills/layout.tsx | 7 + docs/src/app/skills/page.mdx | 75 + docs/src/app/snapshots/layout.tsx | 7 + docs/src/app/snapshots/page.mdx | 125 + docs/src/app/streaming/layout.tsx | 7 + docs/src/app/streaming/page.mdx | 259 + docs/src/components/code-block.tsx | 178 + docs/src/components/copy-button.tsx | 40 + docs/src/components/copy-page-button.tsx | 71 + docs/src/components/diff-demo.tsx | 282 + docs/src/components/docs-chat.tsx | 538 + docs/src/components/docs-mobile-nav.tsx | 81 + docs/src/components/docs-sidebar.tsx | 44 + docs/src/components/header.tsx | 86 + docs/src/components/search.tsx | 265 + docs/src/components/theme-provider.tsx | 16 + docs/src/components/theme-toggle.tsx | 61 + docs/src/components/ui/dialog.tsx | 92 + docs/src/components/ui/sheet.tsx | 147 + docs/src/lib/docs-navigation.ts | 78 + docs/src/lib/github.ts | 20 + docs/src/lib/mdx-to-markdown.ts | 47 + docs/src/lib/page-metadata.ts | 39 + docs/src/lib/page-titles.ts | 40 + docs/src/lib/rate-limit.ts | 57 + docs/src/lib/search-index.ts | 66 + docs/src/lib/utils.ts | 6 + docs/tsconfig.json | 34 + evals/.env.example | 2 + evals/.gitignore | 4 + evals/README.md | 138 + evals/bun.lock | 19 + evals/cases/command-usage.ts | 120 + evals/cases/context-footprint.ts | 53 + evals/cases/skill-loading.ts | 66 + evals/cases/skill-selection.ts | 94 + evals/context-footprint.ts | 266 + evals/lib/claude.ts | 142 + evals/lib/codex.ts | 212 + evals/lib/judge.ts | 140 + evals/lib/providers.ts | 16 + evals/lib/reporter.ts | 143 + evals/lib/types.ts | 82 + evals/package.json | 17 + evals/run.ts | 151 + evals/tsconfig.json | 14 + examples/environments/.env.example | 20 + examples/environments/.gitignore | 8 + examples/environments/README.md | 61 + examples/environments/app/actions/browse.ts | 15 + examples/environments/app/api/browse/route.ts | 90 + examples/environments/app/favicon.ico | Bin 0 -> 25931 bytes examples/environments/app/globals.css | 139 + examples/environments/app/layout.tsx | 21 + examples/environments/app/page.tsx | 518 + examples/environments/components.json | 25 + examples/environments/components/ui/alert.tsx | 76 + examples/environments/components/ui/badge.tsx | 52 + .../environments/components/ui/button.tsx | 60 + examples/environments/components/ui/input.tsx | 20 + examples/environments/components/ui/label.tsx | 20 + .../environments/components/ui/resizable.tsx | 50 + .../environments/components/ui/select.tsx | 201 + .../environments/components/ui/separator.tsx | 25 + .../components/ui/toggle-group.tsx | 89 + .../environments/components/ui/toggle.tsx | 44 + .../environments/lib/agent-browser-sandbox.ts | 323 + examples/environments/lib/constants.ts | 8 + examples/environments/lib/rate-limit.ts | 53 + examples/environments/lib/utils.ts | 6 + examples/environments/next.config.ts | 5 + examples/environments/package.json | 38 + examples/environments/pnpm-lock.yaml | 3995 ++ examples/environments/postcss.config.mjs | 7 + .../environments/scripts/create-snapshot.ts | 54 + examples/environments/tsconfig.json | 42 + examples/sandbox/README.md | 37 + examples/sandbox/eve/.gitignore | 16 + examples/sandbox/eve/.vercelignore | 8 + examples/sandbox/eve/AGENTS.md | 3 + examples/sandbox/eve/CLAUDE.md | 1 + examples/sandbox/eve/README.md | 20 + examples/sandbox/eve/agent/agent.ts | 5 + examples/sandbox/eve/agent/channels/eve.ts | 15 + examples/sandbox/eve/agent/instructions.md | 9 + examples/sandbox/eve/agent/sandbox.ts | 12 + .../eve/agent/tools/browser_snapshot.ts | 19 + .../eve/app/_components/agent-chat.tsx | 144 + .../eve/app/_components/agent-message.tsx | 169 + examples/sandbox/eve/app/globals.css | 98 + examples/sandbox/eve/app/layout.tsx | 35 + examples/sandbox/eve/app/page.tsx | 5 + examples/sandbox/eve/components.json | 22 + .../ai-elements/chain-of-thought.tsx | 197 + .../eve/components/ai-elements/code-block.tsx | 522 + .../components/ai-elements/conversation.tsx | 151 + .../eve/components/ai-elements/message.tsx | 296 + .../components/ai-elements/prompt-input.tsx | 1315 + .../eve/components/ai-elements/reasoning.tsx | 208 + .../eve/components/ai-elements/shimmer.tsx | 72 + .../eve/components/ai-elements/tool.tsx | 156 + examples/sandbox/eve/components/ui/badge.tsx | 46 + .../eve/components/ui/button-group.tsx | 78 + examples/sandbox/eve/components/ui/button.tsx | 62 + .../sandbox/eve/components/ui/collapsible.tsx | 21 + .../sandbox/eve/components/ui/command.tsx | 161 + examples/sandbox/eve/components/ui/dialog.tsx | 144 + .../eve/components/ui/dropdown-menu.tsx | 228 + .../sandbox/eve/components/ui/hover-card.tsx | 38 + .../sandbox/eve/components/ui/input-group.tsx | 158 + examples/sandbox/eve/components/ui/input.tsx | 21 + examples/sandbox/eve/components/ui/select.tsx | 175 + .../sandbox/eve/components/ui/separator.tsx | 28 + .../sandbox/eve/components/ui/spinner.tsx | 16 + .../sandbox/eve/components/ui/textarea.tsx | 18 + .../sandbox/eve/components/ui/tooltip.tsx | 53 + examples/sandbox/eve/css.d.ts | 1 + examples/sandbox/eve/lib/utils.ts | 6 + examples/sandbox/eve/next.config.ts | 10 + examples/sandbox/eve/package.json | 62 + examples/sandbox/eve/pnpm-lock.yaml | 6437 ++++ examples/sandbox/eve/pnpm-workspace.yaml | 7 + examples/sandbox/eve/postcss.config.mjs | 7 + examples/sandbox/eve/tsconfig.json | 35 + examples/sandbox/package.json | 10 + examples/sandbox/vercel/snapshot-url.mjs | 20 + package.json | 52 + packages/@agent-browser/sandbox/README.md | 68 + packages/@agent-browser/sandbox/package.json | 61 + packages/@agent-browser/sandbox/src/eve.ts | 215 + packages/@agent-browser/sandbox/src/index.ts | 18 + packages/@agent-browser/sandbox/src/shared.ts | 171 + .../sandbox/src/vercel-sandbox.d.ts | 3 + packages/@agent-browser/sandbox/src/vercel.ts | 356 + .../@agent-browser/sandbox/src/version.ts | 1 + .../@agent-browser/sandbox/test/eve.test.mjs | 146 + .../sandbox/test/shared.test.mjs | 70 + .../sandbox/test/vercel.test.mjs | 281 + packages/@agent-browser/sandbox/tsconfig.json | 16 + packages/dashboard/components.json | 25 + packages/dashboard/next.config.ts | 22 + packages/dashboard/package.json | 38 + packages/dashboard/postcss.config.mjs | 7 + packages/dashboard/public/lightpanda.svg | 1 + .../dashboard/public/providers/agentcore.svg | 59 + .../public/providers/browser-use.svg | 1 + .../public/providers/browserbase.svg | 1 + .../public/providers/browserless.svg | 1 + .../dashboard/public/providers/kernel.svg | 1 + packages/dashboard/src/app/favicon.ico | Bin 0 -> 25931 bytes packages/dashboard/src/app/globals.css | 207 + packages/dashboard/src/app/layout.tsx | 32 + packages/dashboard/src/app/page.tsx | 163 + .../src/components/activity-feed.tsx | 247 + .../dashboard/src/components/chat-panel.tsx | 822 + .../src/components/console-panel.tsx | 306 + .../src/components/extensions-panel.tsx | 110 + .../dashboard/src/components/json-syntax.tsx | 70 + .../src/components/model-selector.tsx | 97 + .../src/components/network-panel.tsx | 427 + .../dashboard/src/components/session-tree.tsx | 575 + .../src/components/storage-panel.tsx | 344 + .../src/components/theme-provider.tsx | 10 + .../dashboard/src/components/theme-toggle.tsx | 23 + .../dashboard/src/components/ui/badge.tsx | 49 + .../dashboard/src/components/ui/button.tsx | 67 + .../src/components/ui/collapsible.tsx | 33 + .../dashboard/src/components/ui/command.tsx | 98 + .../src/components/ui/context-menu.tsx | 263 + .../dashboard/src/components/ui/dialog.tsx | 168 + .../src/components/ui/dropdown-menu.tsx | 269 + .../dashboard/src/components/ui/popover.tsx | 30 + .../dashboard/src/components/ui/resizable.tsx | 50 + .../src/components/ui/scroll-area.tsx | 55 + .../dashboard/src/components/ui/separator.tsx | 28 + packages/dashboard/src/components/ui/tabs.tsx | 90 + .../dashboard/src/components/ui/tooltip.tsx | 57 + .../dashboard/src/components/viewport.tsx | 731 + .../dashboard/src/hooks/use-media-query.ts | 17 + .../dashboard/src/lib/dashboard-routes.ts | 42 + packages/dashboard/src/lib/exec.ts | 41 + packages/dashboard/src/lib/shiki-theme.ts | 160 + packages/dashboard/src/lib/utils.ts | 6 + packages/dashboard/src/store/activity.ts | 120 + packages/dashboard/src/store/chat.ts | 81 + packages/dashboard/src/store/provider.tsx | 7 + packages/dashboard/src/store/sessions.ts | 292 + packages/dashboard/src/store/stream.ts | 231 + packages/dashboard/src/store/tabs.ts | 38 + packages/dashboard/src/types.ts | 115 + packages/dashboard/tsconfig.json | 41 + pnpm-lock.yaml | 11330 ++++++ pnpm-workspace.yaml | 12 + scripts/build-all-platforms.sh | 85 + scripts/check-version-sync.js | 70 + scripts/copy-native.js | 36 + scripts/postinstall.js | 321 + scripts/sync-version.js | 111 + scripts/windows-debug/provision.sh | 220 + scripts/windows-debug/run.sh | 92 + scripts/windows-debug/start.sh | 43 + scripts/windows-debug/stop.sh | 28 + scripts/windows-debug/sync.sh | 27 + skill-data/agentcore/SKILL.md | 115 + skill-data/core/SKILL.md | 469 + skill-data/core/references/authentication.md | 380 + skill-data/core/references/commands.md | 457 + skill-data/core/references/profiling.md | 120 + skill-data/core/references/proxy-support.md | 194 + .../core/references/session-management.md | 180 + skill-data/core/references/snapshot-refs.md | 219 + .../core/references/trust-boundaries.md | 50 + skill-data/core/references/video-recording.md | 175 + .../core/templates/authenticated-session.sh | 105 + skill-data/core/templates/capture-workflow.sh | 69 + skill-data/core/templates/form-automation.sh | 62 + skill-data/dogfood/SKILL.md | 220 + .../dogfood/references/issue-taxonomy.md | 109 + .../templates/dogfood-report-template.md | 53 + skill-data/electron/SKILL.md | 236 + skill-data/slack/SKILL.md | 285 + skill-data/slack/references/slack-tasks.md | 348 + .../slack/templates/slack-report-template.md | 163 + skill-data/vercel-sandbox/SKILL.md | 213 + skills/agent-browser/SKILL.md | 50 + 413 files changed, 176862 insertions(+) create mode 100644 .claude-plugin/marketplace.json create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 .husky/pre-commit create mode 100644 .node-version create mode 100644 .prettierrc create mode 100644 AGENTS.md create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 README.wehub.md create mode 100644 agent-browser.schema.json create mode 100644 benchmarks/.env.example create mode 100644 benchmarks/.gitignore create mode 100644 benchmarks/README.md create mode 100644 benchmarks/bench.ts create mode 100644 benchmarks/package.json create mode 100644 benchmarks/pnpm-lock.yaml create mode 100644 benchmarks/scenarios.ts create mode 100644 benchmarks/tsconfig.json create mode 100755 bin/agent-browser.js create mode 100644 cli/Cargo.lock create mode 100644 cli/Cargo.toml create mode 100644 cli/build.rs create mode 100644 cli/cdp-protocol/browser_protocol.json create mode 100644 cli/cdp-protocol/js_protocol.json create mode 100644 cli/src/chat.rs create mode 100644 cli/src/color.rs create mode 100644 cli/src/commands.rs create mode 100644 cli/src/connection.rs create mode 100644 cli/src/doctor/chrome.rs create mode 100644 cli/src/doctor/config.rs create mode 100644 cli/src/doctor/daemon.rs create mode 100644 cli/src/doctor/environment.rs create mode 100644 cli/src/doctor/fix.rs create mode 100644 cli/src/doctor/helpers.rs create mode 100644 cli/src/doctor/launch.rs create mode 100644 cli/src/doctor/mod.rs create mode 100644 cli/src/doctor/network.rs create mode 100644 cli/src/doctor/providers.rs create mode 100644 cli/src/doctor/security.rs create mode 100644 cli/src/flags.rs create mode 100644 cli/src/install.rs create mode 100644 cli/src/main.rs create mode 100644 cli/src/mcp.rs create mode 100644 cli/src/native/actions.rs create mode 100644 cli/src/native/auth.rs create mode 100644 cli/src/native/browser.rs create mode 100644 cli/src/native/cdp/chrome.rs create mode 100644 cli/src/native/cdp/client.rs create mode 100644 cli/src/native/cdp/discovery.rs create mode 100644 cli/src/native/cdp/lightpanda.rs create mode 100644 cli/src/native/cdp/mod.rs create mode 100644 cli/src/native/cdp/types.rs create mode 100644 cli/src/native/cookies.rs create mode 100644 cli/src/native/daemon.rs create mode 100644 cli/src/native/diff.rs create mode 100644 cli/src/native/e2e_tests.rs create mode 100644 cli/src/native/element.rs create mode 100644 cli/src/native/inspect_server.rs create mode 100644 cli/src/native/interaction.rs create mode 100644 cli/src/native/mod.rs create mode 100644 cli/src/native/network.rs create mode 100644 cli/src/native/parity_tests.rs create mode 100644 cli/src/native/policy.rs create mode 100644 cli/src/native/providers.rs create mode 100644 cli/src/native/react/installHook.js create mode 100644 cli/src/native/react/mod.rs create mode 100644 cli/src/native/react/renders.rs create mode 100644 cli/src/native/react/scripts.rs create mode 100644 cli/src/native/react/suspense.rs create mode 100644 cli/src/native/react/tree.rs create mode 100644 cli/src/native/recording.rs create mode 100644 cli/src/native/screenshot.rs create mode 100644 cli/src/native/snapshot.rs create mode 100644 cli/src/native/state.rs create mode 100644 cli/src/native/storage.rs create mode 100644 cli/src/native/stream/cdp_loop.rs create mode 100644 cli/src/native/stream/chat.rs create mode 100644 cli/src/native/stream/dashboard.rs create mode 100644 cli/src/native/stream/discovery.rs create mode 100644 cli/src/native/stream/http.rs create mode 100644 cli/src/native/stream/mod.rs create mode 100644 cli/src/native/stream/websocket.rs create mode 100644 cli/src/native/test_fixtures/drag_probe.html create mode 100644 cli/src/native/test_fixtures/html5_drag_probe.html create mode 100644 cli/src/native/test_fixtures/pointer_capture_probe.html create mode 100644 cli/src/native/test_fixtures/upload_probe.html create mode 100644 cli/src/native/tracing.rs create mode 100644 cli/src/native/webdriver/appium.rs create mode 100644 cli/src/native/webdriver/backend.rs create mode 100644 cli/src/native/webdriver/client.rs create mode 100644 cli/src/native/webdriver/ios.rs create mode 100644 cli/src/native/webdriver/mod.rs create mode 100644 cli/src/native/webdriver/safari.rs create mode 100644 cli/src/native/webdriver/types.rs create mode 100644 cli/src/output.rs create mode 100644 cli/src/plugins.rs create mode 100644 cli/src/read.rs create mode 100644 cli/src/skills.rs create mode 100644 cli/src/test_utils.rs create mode 100644 cli/src/upgrade.rs create mode 100644 cli/src/validation.rs create mode 100644 cli/tests/doctor_cli.rs create mode 100644 docker/Dockerfile.build create mode 100644 docker/docker-compose.yml create mode 100644 docs/.gitignore create mode 100644 docs/components.json create mode 100644 docs/eslint.config.mjs create mode 100644 docs/mdx-components.tsx create mode 100644 docs/next.config.mjs create mode 100644 docs/package.json create mode 100644 docs/pnpm-lock.yaml create mode 100644 docs/postcss.config.mjs create mode 100644 docs/public/Geist-Regular.ttf create mode 100644 docs/public/GeistPixel-Square.ttf create mode 100644 docs/public/schema.json create mode 100644 docs/src/app/api/docs-chat/route.ts create mode 100644 docs/src/app/api/docs-markdown/route.ts create mode 100644 docs/src/app/api/search/route.ts create mode 100644 docs/src/app/cdp-mode/layout.tsx create mode 100644 docs/src/app/cdp-mode/page.mdx create mode 100644 docs/src/app/changelog/layout.tsx create mode 100644 docs/src/app/changelog/page.mdx create mode 100644 docs/src/app/commands/layout.tsx create mode 100644 docs/src/app/commands/page.mdx create mode 100644 docs/src/app/configuration/layout.tsx create mode 100644 docs/src/app/configuration/page.mdx create mode 100644 docs/src/app/dashboard/layout.tsx create mode 100644 docs/src/app/dashboard/page.mdx create mode 100644 docs/src/app/debugging/layout.tsx create mode 100644 docs/src/app/debugging/page.mdx create mode 100644 docs/src/app/diffing/layout.tsx create mode 100644 docs/src/app/diffing/page.mdx create mode 100644 docs/src/app/engines/chrome/layout.tsx create mode 100644 docs/src/app/engines/chrome/page.mdx create mode 100644 docs/src/app/engines/lightpanda/layout.tsx create mode 100644 docs/src/app/engines/lightpanda/page.mdx create mode 100644 docs/src/app/favicon.ico create mode 100644 docs/src/app/files/layout.tsx create mode 100644 docs/src/app/files/page.mdx create mode 100644 docs/src/app/globals.css create mode 100644 docs/src/app/init-scripts/layout.tsx create mode 100644 docs/src/app/init-scripts/page.mdx create mode 100644 docs/src/app/installation/layout.tsx create mode 100644 docs/src/app/installation/page.mdx create mode 100644 docs/src/app/ios/layout.tsx create mode 100644 docs/src/app/ios/page.mdx create mode 100644 docs/src/app/layout.tsx create mode 100644 docs/src/app/native-mode/layout.tsx create mode 100644 docs/src/app/native-mode/page.mdx create mode 100644 docs/src/app/network/layout.tsx create mode 100644 docs/src/app/network/page.mdx create mode 100644 docs/src/app/next/layout.tsx create mode 100644 docs/src/app/next/page.mdx create mode 100644 docs/src/app/og/[...slug]/route.tsx create mode 100644 docs/src/app/og/og-image.tsx create mode 100644 docs/src/app/og/route.tsx create mode 100644 docs/src/app/page.mdx create mode 100644 docs/src/app/plugins/layout.tsx create mode 100644 docs/src/app/plugins/page.mdx create mode 100644 docs/src/app/profiler/layout.tsx create mode 100644 docs/src/app/profiler/page.mdx create mode 100644 docs/src/app/providers/agentcore/layout.tsx create mode 100644 docs/src/app/providers/agentcore/page.mdx create mode 100644 docs/src/app/providers/browser-use/layout.tsx create mode 100644 docs/src/app/providers/browser-use/page.mdx create mode 100644 docs/src/app/providers/browserbase/layout.tsx create mode 100644 docs/src/app/providers/browserbase/page.mdx create mode 100644 docs/src/app/providers/browserless/layout.tsx create mode 100644 docs/src/app/providers/browserless/page.mdx create mode 100644 docs/src/app/providers/kernel/layout.tsx create mode 100644 docs/src/app/providers/kernel/page.mdx create mode 100644 docs/src/app/proxy/layout.tsx create mode 100644 docs/src/app/proxy/page.mdx create mode 100644 docs/src/app/quick-start/layout.tsx create mode 100644 docs/src/app/quick-start/page.mdx create mode 100644 docs/src/app/react/layout.tsx create mode 100644 docs/src/app/react/page.mdx create mode 100644 docs/src/app/recording/layout.tsx create mode 100644 docs/src/app/recording/page.mdx create mode 100644 docs/src/app/security/layout.tsx create mode 100644 docs/src/app/security/page.mdx create mode 100644 docs/src/app/selectors/layout.tsx create mode 100644 docs/src/app/selectors/page.mdx create mode 100644 docs/src/app/sessions/layout.tsx create mode 100644 docs/src/app/sessions/page.mdx create mode 100644 docs/src/app/skills/layout.tsx create mode 100644 docs/src/app/skills/page.mdx create mode 100644 docs/src/app/snapshots/layout.tsx create mode 100644 docs/src/app/snapshots/page.mdx create mode 100644 docs/src/app/streaming/layout.tsx create mode 100644 docs/src/app/streaming/page.mdx create mode 100644 docs/src/components/code-block.tsx create mode 100644 docs/src/components/copy-button.tsx create mode 100644 docs/src/components/copy-page-button.tsx create mode 100644 docs/src/components/diff-demo.tsx create mode 100644 docs/src/components/docs-chat.tsx create mode 100644 docs/src/components/docs-mobile-nav.tsx create mode 100644 docs/src/components/docs-sidebar.tsx create mode 100644 docs/src/components/header.tsx create mode 100644 docs/src/components/search.tsx create mode 100644 docs/src/components/theme-provider.tsx create mode 100644 docs/src/components/theme-toggle.tsx create mode 100644 docs/src/components/ui/dialog.tsx create mode 100644 docs/src/components/ui/sheet.tsx create mode 100644 docs/src/lib/docs-navigation.ts create mode 100644 docs/src/lib/github.ts create mode 100644 docs/src/lib/mdx-to-markdown.ts create mode 100644 docs/src/lib/page-metadata.ts create mode 100644 docs/src/lib/page-titles.ts create mode 100644 docs/src/lib/rate-limit.ts create mode 100644 docs/src/lib/search-index.ts create mode 100644 docs/src/lib/utils.ts create mode 100644 docs/tsconfig.json create mode 100644 evals/.env.example create mode 100644 evals/.gitignore create mode 100644 evals/README.md create mode 100644 evals/bun.lock create mode 100644 evals/cases/command-usage.ts create mode 100644 evals/cases/context-footprint.ts create mode 100644 evals/cases/skill-loading.ts create mode 100644 evals/cases/skill-selection.ts create mode 100644 evals/context-footprint.ts create mode 100644 evals/lib/claude.ts create mode 100644 evals/lib/codex.ts create mode 100644 evals/lib/judge.ts create mode 100644 evals/lib/providers.ts create mode 100644 evals/lib/reporter.ts create mode 100644 evals/lib/types.ts create mode 100644 evals/package.json create mode 100644 evals/run.ts create mode 100644 evals/tsconfig.json create mode 100644 examples/environments/.env.example create mode 100644 examples/environments/.gitignore create mode 100644 examples/environments/README.md create mode 100644 examples/environments/app/actions/browse.ts create mode 100644 examples/environments/app/api/browse/route.ts create mode 100644 examples/environments/app/favicon.ico create mode 100644 examples/environments/app/globals.css create mode 100644 examples/environments/app/layout.tsx create mode 100644 examples/environments/app/page.tsx create mode 100644 examples/environments/components.json create mode 100644 examples/environments/components/ui/alert.tsx create mode 100644 examples/environments/components/ui/badge.tsx create mode 100644 examples/environments/components/ui/button.tsx create mode 100644 examples/environments/components/ui/input.tsx create mode 100644 examples/environments/components/ui/label.tsx create mode 100644 examples/environments/components/ui/resizable.tsx create mode 100644 examples/environments/components/ui/select.tsx create mode 100644 examples/environments/components/ui/separator.tsx create mode 100644 examples/environments/components/ui/toggle-group.tsx create mode 100644 examples/environments/components/ui/toggle.tsx create mode 100644 examples/environments/lib/agent-browser-sandbox.ts create mode 100644 examples/environments/lib/constants.ts create mode 100644 examples/environments/lib/rate-limit.ts create mode 100644 examples/environments/lib/utils.ts create mode 100644 examples/environments/next.config.ts create mode 100644 examples/environments/package.json create mode 100644 examples/environments/pnpm-lock.yaml create mode 100644 examples/environments/postcss.config.mjs create mode 100644 examples/environments/scripts/create-snapshot.ts create mode 100644 examples/environments/tsconfig.json create mode 100644 examples/sandbox/README.md create mode 100644 examples/sandbox/eve/.gitignore create mode 100644 examples/sandbox/eve/.vercelignore create mode 100644 examples/sandbox/eve/AGENTS.md create mode 100644 examples/sandbox/eve/CLAUDE.md create mode 100644 examples/sandbox/eve/README.md create mode 100644 examples/sandbox/eve/agent/agent.ts create mode 100644 examples/sandbox/eve/agent/channels/eve.ts create mode 100644 examples/sandbox/eve/agent/instructions.md create mode 100644 examples/sandbox/eve/agent/sandbox.ts create mode 100644 examples/sandbox/eve/agent/tools/browser_snapshot.ts create mode 100644 examples/sandbox/eve/app/_components/agent-chat.tsx create mode 100644 examples/sandbox/eve/app/_components/agent-message.tsx create mode 100644 examples/sandbox/eve/app/globals.css create mode 100644 examples/sandbox/eve/app/layout.tsx create mode 100644 examples/sandbox/eve/app/page.tsx create mode 100644 examples/sandbox/eve/components.json create mode 100644 examples/sandbox/eve/components/ai-elements/chain-of-thought.tsx create mode 100644 examples/sandbox/eve/components/ai-elements/code-block.tsx create mode 100644 examples/sandbox/eve/components/ai-elements/conversation.tsx create mode 100644 examples/sandbox/eve/components/ai-elements/message.tsx create mode 100644 examples/sandbox/eve/components/ai-elements/prompt-input.tsx create mode 100644 examples/sandbox/eve/components/ai-elements/reasoning.tsx create mode 100644 examples/sandbox/eve/components/ai-elements/shimmer.tsx create mode 100644 examples/sandbox/eve/components/ai-elements/tool.tsx create mode 100644 examples/sandbox/eve/components/ui/badge.tsx create mode 100644 examples/sandbox/eve/components/ui/button-group.tsx create mode 100644 examples/sandbox/eve/components/ui/button.tsx create mode 100644 examples/sandbox/eve/components/ui/collapsible.tsx create mode 100644 examples/sandbox/eve/components/ui/command.tsx create mode 100644 examples/sandbox/eve/components/ui/dialog.tsx create mode 100644 examples/sandbox/eve/components/ui/dropdown-menu.tsx create mode 100644 examples/sandbox/eve/components/ui/hover-card.tsx create mode 100644 examples/sandbox/eve/components/ui/input-group.tsx create mode 100644 examples/sandbox/eve/components/ui/input.tsx create mode 100644 examples/sandbox/eve/components/ui/select.tsx create mode 100644 examples/sandbox/eve/components/ui/separator.tsx create mode 100644 examples/sandbox/eve/components/ui/spinner.tsx create mode 100644 examples/sandbox/eve/components/ui/textarea.tsx create mode 100644 examples/sandbox/eve/components/ui/tooltip.tsx create mode 100644 examples/sandbox/eve/css.d.ts create mode 100644 examples/sandbox/eve/lib/utils.ts create mode 100644 examples/sandbox/eve/next.config.ts create mode 100644 examples/sandbox/eve/package.json create mode 100644 examples/sandbox/eve/pnpm-lock.yaml create mode 100644 examples/sandbox/eve/pnpm-workspace.yaml create mode 100644 examples/sandbox/eve/postcss.config.mjs create mode 100644 examples/sandbox/eve/tsconfig.json create mode 100644 examples/sandbox/package.json create mode 100644 examples/sandbox/vercel/snapshot-url.mjs create mode 100644 package.json create mode 100644 packages/@agent-browser/sandbox/README.md create mode 100644 packages/@agent-browser/sandbox/package.json create mode 100644 packages/@agent-browser/sandbox/src/eve.ts create mode 100644 packages/@agent-browser/sandbox/src/index.ts create mode 100644 packages/@agent-browser/sandbox/src/shared.ts create mode 100644 packages/@agent-browser/sandbox/src/vercel-sandbox.d.ts create mode 100644 packages/@agent-browser/sandbox/src/vercel.ts create mode 100644 packages/@agent-browser/sandbox/src/version.ts create mode 100644 packages/@agent-browser/sandbox/test/eve.test.mjs create mode 100644 packages/@agent-browser/sandbox/test/shared.test.mjs create mode 100644 packages/@agent-browser/sandbox/test/vercel.test.mjs create mode 100644 packages/@agent-browser/sandbox/tsconfig.json create mode 100644 packages/dashboard/components.json create mode 100644 packages/dashboard/next.config.ts create mode 100644 packages/dashboard/package.json create mode 100644 packages/dashboard/postcss.config.mjs create mode 100644 packages/dashboard/public/lightpanda.svg create mode 100644 packages/dashboard/public/providers/agentcore.svg create mode 100644 packages/dashboard/public/providers/browser-use.svg create mode 100644 packages/dashboard/public/providers/browserbase.svg create mode 100644 packages/dashboard/public/providers/browserless.svg create mode 100644 packages/dashboard/public/providers/kernel.svg create mode 100644 packages/dashboard/src/app/favicon.ico create mode 100644 packages/dashboard/src/app/globals.css create mode 100644 packages/dashboard/src/app/layout.tsx create mode 100644 packages/dashboard/src/app/page.tsx create mode 100644 packages/dashboard/src/components/activity-feed.tsx create mode 100644 packages/dashboard/src/components/chat-panel.tsx create mode 100644 packages/dashboard/src/components/console-panel.tsx create mode 100644 packages/dashboard/src/components/extensions-panel.tsx create mode 100644 packages/dashboard/src/components/json-syntax.tsx create mode 100644 packages/dashboard/src/components/model-selector.tsx create mode 100644 packages/dashboard/src/components/network-panel.tsx create mode 100644 packages/dashboard/src/components/session-tree.tsx create mode 100644 packages/dashboard/src/components/storage-panel.tsx create mode 100644 packages/dashboard/src/components/theme-provider.tsx create mode 100644 packages/dashboard/src/components/theme-toggle.tsx create mode 100644 packages/dashboard/src/components/ui/badge.tsx create mode 100644 packages/dashboard/src/components/ui/button.tsx create mode 100644 packages/dashboard/src/components/ui/collapsible.tsx create mode 100644 packages/dashboard/src/components/ui/command.tsx create mode 100644 packages/dashboard/src/components/ui/context-menu.tsx create mode 100644 packages/dashboard/src/components/ui/dialog.tsx create mode 100644 packages/dashboard/src/components/ui/dropdown-menu.tsx create mode 100644 packages/dashboard/src/components/ui/popover.tsx create mode 100644 packages/dashboard/src/components/ui/resizable.tsx create mode 100644 packages/dashboard/src/components/ui/scroll-area.tsx create mode 100644 packages/dashboard/src/components/ui/separator.tsx create mode 100644 packages/dashboard/src/components/ui/tabs.tsx create mode 100644 packages/dashboard/src/components/ui/tooltip.tsx create mode 100644 packages/dashboard/src/components/viewport.tsx create mode 100644 packages/dashboard/src/hooks/use-media-query.ts create mode 100644 packages/dashboard/src/lib/dashboard-routes.ts create mode 100644 packages/dashboard/src/lib/exec.ts create mode 100644 packages/dashboard/src/lib/shiki-theme.ts create mode 100644 packages/dashboard/src/lib/utils.ts create mode 100644 packages/dashboard/src/store/activity.ts create mode 100644 packages/dashboard/src/store/chat.ts create mode 100644 packages/dashboard/src/store/provider.tsx create mode 100644 packages/dashboard/src/store/sessions.ts create mode 100644 packages/dashboard/src/store/stream.ts create mode 100644 packages/dashboard/src/store/tabs.ts create mode 100644 packages/dashboard/src/types.ts create mode 100644 packages/dashboard/tsconfig.json create mode 100644 pnpm-lock.yaml create mode 100644 pnpm-workspace.yaml create mode 100755 scripts/build-all-platforms.sh create mode 100644 scripts/check-version-sync.js create mode 100644 scripts/copy-native.js create mode 100644 scripts/postinstall.js create mode 100644 scripts/sync-version.js create mode 100755 scripts/windows-debug/provision.sh create mode 100755 scripts/windows-debug/run.sh create mode 100755 scripts/windows-debug/start.sh create mode 100755 scripts/windows-debug/stop.sh create mode 100755 scripts/windows-debug/sync.sh create mode 100644 skill-data/agentcore/SKILL.md create mode 100644 skill-data/core/SKILL.md create mode 100644 skill-data/core/references/authentication.md create mode 100644 skill-data/core/references/commands.md create mode 100644 skill-data/core/references/profiling.md create mode 100644 skill-data/core/references/proxy-support.md create mode 100644 skill-data/core/references/session-management.md create mode 100644 skill-data/core/references/snapshot-refs.md create mode 100644 skill-data/core/references/trust-boundaries.md create mode 100644 skill-data/core/references/video-recording.md create mode 100755 skill-data/core/templates/authenticated-session.sh create mode 100755 skill-data/core/templates/capture-workflow.sh create mode 100755 skill-data/core/templates/form-automation.sh create mode 100644 skill-data/dogfood/SKILL.md create mode 100644 skill-data/dogfood/references/issue-taxonomy.md create mode 100644 skill-data/dogfood/templates/dogfood-report-template.md create mode 100644 skill-data/electron/SKILL.md create mode 100644 skill-data/slack/SKILL.md create mode 100644 skill-data/slack/references/slack-tasks.md create mode 100644 skill-data/slack/templates/slack-report-template.md create mode 100644 skill-data/vercel-sandbox/SKILL.md create mode 100644 skills/agent-browser/SKILL.md diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json new file mode 100644 index 0000000..3560fe6 --- /dev/null +++ b/.claude-plugin/marketplace.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://anthropic.com/claude-code/marketplace.schema.json", + "name": "agent-browser", + "description": "Browser automation for AI agents", + "owner": { + "name": "Vercel", + "email": "support@vercel.com" + }, + "plugins": [ + { + "name": "agent-browser", + "description": "Automates browser interactions for web testing, form filling, screenshots, and data extraction", + "source": "./", + "strict": false, + "skills": ["./skills/agent-browser"], + "category": "development" + } + ] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..05f6a87 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,294 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + version-sync: + name: Version Sync Check + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - name: Check version sync + run: node scripts/check-version-sync.js + + rust: + name: Rust + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: cli + + - name: Format check + run: cargo fmt --manifest-path cli/Cargo.toml -- --check + + - name: Clippy check + run: cargo clippy --manifest-path cli/Cargo.toml -- -D warnings + + - name: Run Rust tests + run: cargo test --profile ci --manifest-path cli/Cargo.toml + + dashboard: + name: Dashboard + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Install dependencies + run: pnpm install --filter dashboard + working-directory: packages/dashboard + + - name: Build dashboard + run: pnpm build + working-directory: packages/dashboard + + sandbox-package: + name: Sandbox Package + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Test sandbox package + run: pnpm --filter @agent-browser/sandbox test + + rust-cross: + name: Rust (${{ matrix.os }} - ${{ matrix.target }}) + if: github.event_name != 'pull_request' + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: macos-latest + target: aarch64-apple-darwin + - os: macos-latest + target: x86_64-apple-darwin + - os: windows-latest + target: x86_64-pc-windows-msvc + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: cli + + - name: Run Rust tests + run: cargo test --profile ci --manifest-path cli/Cargo.toml --target ${{ matrix.target }} + + native-e2e: + name: Native E2E Tests + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + needs: rust + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: cli + + - name: Install Chrome + run: | + cargo run --manifest-path cli/Cargo.toml -- install --with-deps + + - name: Install ffmpeg + run: sudo apt-get update && sudo apt-get install -y ffmpeg + + - name: Run e2e tests + run: cargo test --profile ci --manifest-path cli/Cargo.toml e2e -- --ignored --test-threads=1 + + windows-integration: + name: Windows Integration Test + if: github.event_name != 'pull_request' + runs-on: windows-latest + needs: rust-cross + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-pc-windows-msvc + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: cli + + - name: Build Rust CLI + run: cargo build --release --manifest-path cli/Cargo.toml --target x86_64-pc-windows-msvc + + - name: Copy CLI binary to bin directory + run: | + Copy-Item cli/target/x86_64-pc-windows-msvc/release/agent-browser.exe bin/agent-browser-win32-x64.exe + + - name: Test agent-browser install command + run: | + $env:PATH = "$pwd\bin;$env:PATH" + for ($i = 1; $i -le 3; $i++) { + bin/agent-browser-win32-x64.exe install + if ($LASTEXITCODE -eq 0) { exit 0 } + Write-Host "Attempt $i failed, retrying in 10 seconds..." + Start-Sleep -Seconds 10 + } + exit 1 + shell: pwsh + timeout-minutes: 10 + + - name: Test daemon lifecycle (open, snapshot, close) + run: | + $env:PATH = "$pwd\bin;$env:PATH" + Write-Host "--- Opening page ---" + bin/agent-browser-win32-x64.exe open https://example.com + if ($LASTEXITCODE -ne 0) { Write-Error "open failed"; exit 1 } + Write-Host "--- Taking snapshot ---" + $snapshot = bin/agent-browser-win32-x64.exe snapshot + if ($LASTEXITCODE -ne 0) { Write-Error "snapshot failed"; exit 1 } + Write-Host $snapshot + Write-Host "--- Closing browser ---" + bin/agent-browser-win32-x64.exe close + if ($LASTEXITCODE -ne 0) { Write-Error "close failed"; exit 1 } + Write-Host "--- Windows daemon lifecycle test passed ---" + shell: pwsh + timeout-minutes: 5 + + global-install: + name: Global Install (${{ matrix.os }}) + if: github.event_name != 'pull_request' + runs-on: ${{ matrix.os }} + needs: rust-cross + strategy: + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + binary: agent-browser-linux-x64 + - os: macos-latest + target: aarch64-apple-darwin + binary: agent-browser-darwin-arm64 + - os: windows-latest + target: x86_64-pc-windows-msvc + binary: agent-browser-win32-x64.exe + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - name: Setup Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: cli + + - name: Build Rust CLI + run: cargo build --release --manifest-path cli/Cargo.toml --target ${{ matrix.target }} + + - name: Copy CLI binary to bin directory (Unix) + if: runner.os != 'Windows' + run: cp cli/target/${{ matrix.target }}/release/agent-browser bin/${{ matrix.binary }} + + - name: Copy CLI binary to bin directory (Windows) + if: runner.os == 'Windows' + run: Copy-Item cli/target/${{ matrix.target }}/release/agent-browser.exe bin/${{ matrix.binary }} + + - name: Test npm global install + run: | + npm pack + npm install -g agent-browser-*.tgz + agent-browser --version + shell: bash + + - name: Verify symlink points to native binary (Unix) + if: runner.os != 'Windows' + run: | + SYMLINK=$(npm prefix -g)/bin/agent-browser + TARGET=$(readlink "$SYMLINK") + echo "Symlink: $SYMLINK" + echo "Target: $TARGET" + if [[ "$TARGET" != *"${{ matrix.binary }}"* ]]; then + echo "ERROR: Symlink should point to native binary, not JS wrapper" + exit 1 + fi + echo "Symlink correctly points to native binary" + shell: bash + + - name: Verify shim points to native binary (Windows) + if: runner.os == 'Windows' + run: | + $shimPath = "$(npm prefix -g)\agent-browser.cmd" + $content = Get-Content $shimPath -Raw + echo "Shim path: $shimPath" + echo "Shim content:" + echo $content + if ($content -notmatch "agent-browser-win32-x64\.exe") { + echo "ERROR: Shim should point to native .exe, not JS wrapper" + exit 1 + } + echo "Shim correctly points to native binary" + shell: pwsh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..639dd1d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,406 @@ +name: Release + +on: + push: + branches: + - main + workflow_dispatch: + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +permissions: + contents: read + +jobs: + check-release: + name: Check for new version + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + outputs: + should_release: ${{ steps.check.outputs.should_release }} + should_publish_sandbox: ${{ steps.check.outputs.should_publish_sandbox }} + needs_github_release: ${{ steps.check.outputs.needs_github_release }} + version: ${{ steps.check.outputs.version }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - name: Compare package.json version to npm and check GitHub release + id: check + run: | + LOCAL_VERSION=$(node -p "require('./package.json').version") + SANDBOX_VERSION=$(node -p "require('./packages/@agent-browser/sandbox/package.json').version") + echo "Local version: $LOCAL_VERSION" + echo "Sandbox package version: $SANDBOX_VERSION" + + NPM_VERSION=$(npm view agent-browser version 2>/dev/null || echo "0.0.0") + SANDBOX_NPM_VERSION=$(npm view @agent-browser/sandbox version 2>/dev/null || echo "0.0.0") + echo "npm version: $NPM_VERSION" + echo "@agent-browser/sandbox npm version: $SANDBOX_NPM_VERSION" + + if [ "$LOCAL_VERSION" != "$NPM_VERSION" ]; then + echo "Version changed: $NPM_VERSION -> $LOCAL_VERSION" + echo "should_release=true" >> "$GITHUB_OUTPUT" + echo "needs_github_release=true" >> "$GITHUB_OUTPUT" + else + echo "Version unchanged on npm, skipping build and publish" + echo "should_release=false" >> "$GITHUB_OUTPUT" + + # Check if GitHub release exists; it may be missing if a prior run + # published to npm but failed before creating the release. + TAG="v$LOCAL_VERSION" + if gh release view "$TAG" &>/dev/null; then + echo "GitHub release $TAG exists" + echo "needs_github_release=false" >> "$GITHUB_OUTPUT" + else + echo "GitHub release $TAG is missing, will rebuild and create it" + echo "needs_github_release=true" >> "$GITHUB_OUTPUT" + fi + fi + if [ "$SANDBOX_VERSION" != "$SANDBOX_NPM_VERSION" ]; then + echo "Sandbox package version changed: $SANDBOX_NPM_VERSION -> $SANDBOX_VERSION" + echo "should_publish_sandbox=true" >> "$GITHUB_OUTPUT" + else + echo "Sandbox package version unchanged on npm, skipping publish" + echo "should_publish_sandbox=false" >> "$GITHUB_OUTPUT" + fi + echo "version=$LOCAL_VERSION" >> "$GITHUB_OUTPUT" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-binaries: + name: Build ${{ matrix.name }} + needs: check-release + if: needs.check-release.outputs.should_release == 'true' || needs.check-release.outputs.needs_github_release == 'true' + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: Linux x64 + os: ubuntu-latest + rust_target: x86_64-unknown-linux-gnu + build_target: x86_64-unknown-linux-gnu.2.28 + binary: agent-browser-linux-x64 + use_zigbuild: true + - name: Linux ARM64 + os: ubuntu-latest + rust_target: aarch64-unknown-linux-gnu + build_target: aarch64-unknown-linux-gnu.2.28 + binary: agent-browser-linux-arm64 + use_zigbuild: true + - name: Linux musl x64 + os: ubuntu-latest + rust_target: x86_64-unknown-linux-musl + build_target: x86_64-unknown-linux-musl + binary: agent-browser-linux-musl-x64 + use_zigbuild: true + - name: Linux musl ARM64 + os: ubuntu-latest + rust_target: aarch64-unknown-linux-musl + build_target: aarch64-unknown-linux-musl + binary: agent-browser-linux-musl-arm64 + use_zigbuild: true + - name: Windows x64 + os: ubuntu-latest + rust_target: x86_64-pc-windows-gnu + build_target: x86_64-pc-windows-gnu + binary: agent-browser-win32-x64.exe + use_zigbuild: false + - name: macOS x64 + os: macos-latest + rust_target: x86_64-apple-darwin + build_target: x86_64-apple-darwin + binary: agent-browser-darwin-x64 + use_zigbuild: false + - name: macOS ARM64 + os: macos-latest + rust_target: aarch64-apple-darwin + build_target: aarch64-apple-darwin + binary: agent-browser-darwin-arm64 + use_zigbuild: false + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: pnpm + + - name: Install npm dependencies + run: pnpm install --frozen-lockfile + + - name: Sync version + run: pnpm run version:sync + + - name: Build dashboard + run: pnpm --filter dashboard build + + - name: Setup Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.rust_target }} + + - name: Install cross-compilation tools (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu mingw-w64 + + - name: Install cargo-zigbuild + if: matrix.use_zigbuild + run: | + pip3 install ziglang + cargo install cargo-zigbuild --version 0.22.3 --locked + + - name: Configure Rust linkers + if: runner.os == 'Linux' + run: | + mkdir -p ~/.cargo + cat >> ~/.cargo/config.toml << 'EOF' + [target.aarch64-unknown-linux-gnu] + linker = "aarch64-linux-gnu-gcc" + + [target.x86_64-pc-windows-gnu] + linker = "x86_64-w64-mingw32-gcc" + EOF + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: cli + + - name: Build with zigbuild + if: matrix.use_zigbuild + run: cargo zigbuild --release --manifest-path cli/Cargo.toml --target ${{ matrix.build_target }} + + - name: Build with cargo + if: '!matrix.use_zigbuild' + run: cargo build --release --manifest-path cli/Cargo.toml --target ${{ matrix.rust_target }} + + - name: Copy binary + run: | + mkdir -p artifacts + if [[ "${{ matrix.rust_target }}" == *"windows"* ]]; then + cp cli/target/${{ matrix.rust_target }}/release/agent-browser.exe artifacts/${{ matrix.binary }} + else + cp cli/target/${{ matrix.rust_target }}/release/agent-browser artifacts/${{ matrix.binary }} + chmod +x artifacts/${{ matrix.binary }} + fi + + - name: Verify Linux GNU glibc floor + if: matrix.binary == 'agent-browser-linux-x64' || matrix.binary == 'agent-browser-linux-arm64' + run: | + set -euo pipefail + if objdump -p artifacts/${{ matrix.binary }} | grep -E 'GLIBC_2\.([3-9][0-9]|29)'; then + echo "ERROR: ${{ matrix.binary }} requires glibc newer than 2.28" + exit 1 + fi + objdump -p artifacts/${{ matrix.binary }} | sed -n '/Version References:/,$p' + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.binary }} + path: artifacts/${{ matrix.binary }} + retention-days: 7 + + publish: + name: Publish to npm + needs: [check-release, build-binaries] + if: needs.check-release.outputs.should_release == 'true' + runs-on: ubuntu-latest + timeout-minutes: 15 + environment: Release + permissions: + contents: read + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: pnpm + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Download all binary artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts/ + + - name: Move binaries to bin directory + run: | + mkdir -p bin + find artifacts -type f -name 'agent-browser-*' -exec mv {} bin/ \; + rm -rf artifacts + chmod +x bin/agent-browser-* 2>/dev/null || true + echo "Binaries in bin/:" + ls -la bin/ + + - name: Verify all binaries exist + run: | + EXPECTED_BINARIES=( + "agent-browser-linux-x64" + "agent-browser-linux-arm64" + "agent-browser-linux-musl-x64" + "agent-browser-linux-musl-arm64" + "agent-browser-win32-x64.exe" + "agent-browser-darwin-x64" + "agent-browser-darwin-arm64" + ) + MIN_SIZE=100000 + ERRORS=0 + for binary in "${EXPECTED_BINARIES[@]}"; do + if [ ! -f "bin/$binary" ]; then + echo "ERROR: Missing bin/$binary" + ERRORS=$((ERRORS + 1)) + else + SIZE=$(stat -c%s "bin/$binary" 2>/dev/null || stat -f%z "bin/$binary") + if [ "$SIZE" -lt "$MIN_SIZE" ]; then + echo "ERROR: bin/$binary is too small ($SIZE bytes, expected >= $MIN_SIZE)" + ERRORS=$((ERRORS + 1)) + else + echo "OK: bin/$binary ($SIZE bytes)" + fi + fi + done + if [ "$ERRORS" -gt 0 ]; then + echo "Error: $ERRORS binary issues found" + exit 1 + fi + echo "All 7 platform binaries present and valid" + + - name: Publish to npm + run: pnpm publish --provenance --no-git-checks + + publish-sandbox: + name: Publish sandbox package to npm + needs: [check-release, publish] + if: >- + always() && + needs.check-release.outputs.should_publish_sandbox == 'true' && + ( + needs.check-release.outputs.should_release != 'true' || + needs.publish.result == 'success' + ) + runs-on: ubuntu-latest + timeout-minutes: 10 + environment: Release + permissions: + contents: read + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: pnpm + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Sync version + run: pnpm run version:sync + + - name: Publish sandbox package to npm + working-directory: packages/@agent-browser/sandbox + run: pnpm publish --provenance --access public --no-git-checks + + github-release: + name: Create GitHub Release + needs: [check-release, build-binaries, publish, publish-sandbox] + if: >- + always() && + needs.build-binaries.result == 'success' && + needs.check-release.outputs.needs_github_release == 'true' && + (needs.publish.result == 'success' || needs.publish.result == 'skipped') && + (needs.publish-sandbox.result == 'success' || needs.publish-sandbox.result == 'skipped') + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts/ + + - name: Move binaries to bin directory + run: | + mkdir -p bin + find artifacts -type f -name 'agent-browser-*' -exec mv {} bin/ \; + rm -rf artifacts + chmod +x bin/agent-browser-* 2>/dev/null || true + ls -la bin/ + + - name: Verify binaries exist + run: | + BINARY_COUNT=$(ls bin/agent-browser-* 2>/dev/null | wc -l) + if [ "$BINARY_COUNT" -lt 7 ]; then + echo "Error: Expected 7 binaries, found $BINARY_COUNT" + ls -la bin/ + exit 1 + fi + echo "Found $BINARY_COUNT binaries" + + - name: Extract changelog entry + run: | + VERSION="${{ needs.check-release.outputs.version }}" + awk '//{found=1; next} //{found=0} found{print}' CHANGELOG.md > /tmp/release-notes.md + + LINES=$(wc -l < /tmp/release-notes.md | tr -d ' ') + if [ "$LINES" -lt 2 ]; then + echo "Error: No release notes found between and markers in CHANGELOG.md" + exit 1 + fi + echo "Extracted release notes for $VERSION ($LINES lines)" + + - name: Create GitHub Release + run: | + VERSION="${{ needs.check-release.outputs.version }}" + TAG="v$VERSION" + + if gh release view "$TAG" &>/dev/null; then + echo "Release $TAG already exists, uploading assets..." + gh release upload "$TAG" bin/agent-browser-* --clobber + else + echo "Creating release $TAG..." + gh release create "$TAG" \ + --title "$TAG" \ + --notes-file /tmp/release-notes.md \ + bin/agent-browser-* + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e015a09 --- /dev/null +++ b/.gitignore @@ -0,0 +1,73 @@ +# Dependencies +node_modules/ + +# Build output +dist/ + +# Native binaries (keep the launcher scripts) +bin/agent-browser-* +bin/.install-method +!bin/agent-browser +!bin/agent-browser.cmd + +# Rust build artifacts +cli/target/ +cli/*.o + +# Logs +*.log +npm-debug.log* + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Python +__pycache__/ + +# Test artifacts +*.png +*.jpeg +*.jpg +*.webm +test/e2e/.dogfood-output/ + +# Package manager +package-lock.json +yarn.lock + +# Environment +.env +.env.local +.env.* +!.env.example +!.env.*.example + +# Windows debug instance config +scripts/windows-debug/.instance + +# opensrc - source code for packages +opensrc/ + +# Docs site +docs/node_modules/ +docs/.next/ +docs/out/ +docs/package-lock.json + +# pnpm +.pnpm-store/ + +# TypeScript +*.tsbuildinfo + +# next +.next/ +out/ +next-env.d.ts diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..7509bfb --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,2 @@ +node scripts/sync-version.js +git add cli/Cargo.toml cli/Cargo.lock diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..a45fd52 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +24 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..a95cb05 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": true, + "singleQuote": true, + "trailingComma": "es5", + "printWidth": 100, + "tabWidth": 2 +} diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..21fbfb8 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,214 @@ +# AGENTS.md + +Instructions for AI coding agents working with this codebase. + +## Package Manager + +This project uses **pnpm**. Always use `pnpm` instead of `npm` or `yarn` for installing dependencies, running scripts, etc. (e.g., `pnpm install`, `pnpm run build`). + +## Code Style + +- Do not use emojis in code, output, or documentation. Unicode symbols (✓, ✗, →, ⚠) are acceptable. +- In documentation and markdown, never use double hyphens (`--`) as a dash. Use an emdash (—) sparingly when needed. Prefer rewriting the sentence to avoid dashes entirely. +- CLI colored output uses `cli/src/color.rs`. This module respects the `NO_COLOR` environment variable. Never use hardcoded ANSI color codes. +- CLI flags must always use kebab-case (e.g., `--auto-connect`, `--allow-file-access`). Never use camelCase for flags (e.g., `--autoConnect` is wrong). + +## Documentation + +Do not hard-wrap prose in documentation files such as Markdown, MDX, and READMEs; let the editor or renderer wrap text naturally. + +When adding or changing user-facing features (new flags, commands, behaviors, environment variables, etc.), update **all** of the following: + +1. `cli/src/output.rs` — `--help` output (flags list, examples, environment variables) +2. `README.md` — Options table, relevant feature sections, examples +3. `skill-data/core/SKILL.md` (and its `references/`) — so AI agents know about the feature when they load the core skill. Edit `skill-data/core/SKILL.md` for overview/workflow changes; edit `skill-data/core/references/*.md` for detailed reference content. Do **not** put feature content in `skills/agent-browser/SKILL.md` — that file is an intentionally thin discovery stub for `npx skills add` and exists only to redirect agents to `agent-browser skills get core`. +4. `docs/src/app/` — the Next.js docs site (MDX pages) +5. Inline doc comments in the relevant source files + +This applies to changes that either human users or AI agents would need to know about. Do not skip any of these locations. + +## CLI/MCP Parity + +When adding or changing any CLI command, flag, behavior, output, environment variable, or parser semantics, update the MCP server in `cli/src/mcp.rs` in the same change. MCP tools should stay in sync with canonical CLI behavior by delegating through the normal CLI parser where possible. If a CLI command has no dedicated MCP tool, add one or document why it is intentionally omitted. Add or update tests that prove the CLI and MCP surfaces remain aligned. + +In the `docs/src/app/` MDX files, always use HTML `` syntax for tables (not markdown pipe tables). This matches the existing convention across the docs site. + +## Dashboard (packages/dashboard) + +- Never use native browser dialogs (`alert`, `confirm`, `prompt`). Use shadcn/ui components (`Dialog`, `AlertDialog`, etc.) instead. +- Use param-case (kebab-case) for all file and folder names (e.g., `session-tree.tsx`, not `SessionTree.tsx`). The `ui/` directory follows shadcn conventions which already uses param-case. + +## Releasing + +Releases are manual, single-PR affairs. There is no changesets automation. The maintainer controls the changelog voice and format. + +To prepare a release: + +1. Create a branch (e.g. `prepare-v0.24.0`) +2. Bump `version` in `package.json` +3. Run `pnpm version:sync` to update `cli/Cargo.toml`, `cli/Cargo.lock`, and `packages/dashboard/package.json` +4. Write the changelog entry in `CHANGELOG.md` at the top, under a new `## ` heading, wrapped in `` and `` markers. Remove the `` and `` markers from the previous release entry so only the new release has markers. +5. Add a matching entry to `docs/src/app/changelog/page.mdx` at the top (below the `# Changelog` heading) +6. Open a PR and merge to `main` + +When the PR merges, CI compares `package.json` version to what's on npm. If it differs, it builds all 7 platform binaries, publishes to npm, and creates the GitHub release automatically. The GitHub release body is extracted from the content between the `` and `` markers in `CHANGELOG.md`. + +### Writing the changelog + +Review the git log since the last release and write the entry in `CHANGELOG.md`. Follow the existing format and voice. Group changes under `### New Features`, `### Bug Fixes`, `### Improvements`, etc. Bold the feature/fix name, then describe it concisely. Reference PR numbers in parentheses. + +Wrap the release notes (everything between the `## ` heading and the previous version) in markers so CI can extract them for the GitHub release. Only the current release should have markers; remove the `` and `` markers from any previous release entry: + +```markdown +## 0.24.1 + + +### Bug Fixes + +- Fixed **baz** not working when qux is enabled (#1235) + +### Contributors + +- @ctate + + +## 0.24.0 + +### New Features + +- **Foo command** - Added `foo` command for bar (#1234) +``` + +Include a `### Contributors` section listing the GitHub usernames (with `@` prefix) of everyone who contributed to the release. Check the git log between the previous tag and HEAD to find them. + +Do not prefix entries with commit hashes. Do not use the changesets `### Patch Changes` / `### Minor Changes` headings. Use descriptive section names instead. + +### Docs changelog + +The docs changelog at `docs/src/app/changelog/page.mdx` mirrors `CHANGELOG.md` but uses a slightly different format. Each entry uses: + +- A `v` prefix on the version (e.g. `## v0.24.0`) +- A date line with the full date: `

March 30, 2026

` +- A `---` separator between entries + +Match the existing style in that file. + +## Architecture + +This is a Rust codebase. The browser automation daemon lives in `cli/src/native/` (daemon, actions, browser, CDP client, snapshot, state). The `--engine` flag selects Chrome vs Lightpanda. The `install` command downloads Chrome from Chrome for Testing directly. + +## Testing + +### Unit Tests + +```bash +cd cli && cargo test +``` + +Runs all unit tests (~320 tests). These are fast and don't require Chrome. + +### End-to-End Tests + +```bash +cd cli && cargo test e2e -- --ignored --test-threads=1 +``` + +Runs 18 e2e tests that launch real headless Chrome instances and exercise the full native daemon command pipeline. Requirements: + +- Chrome must be installed +- Must run serially (`--test-threads=1`) to avoid Chrome instance contention +- Tests are `#[ignore]`'d so they don't run during normal `cargo test` + +The e2e tests live in `cli/src/native/e2e_tests.rs` and cover: launch/close, navigation, snapshots, screenshots, form interaction, cookies, storage, tabs, element queries, viewport/emulation, domain filtering, diff, state management, error handling, and Phase 8 commands. + +### Linting and Formatting + +```bash +cd cli && cargo fmt -- --check # Check formatting +cd cli && cargo clippy # Lint +``` + +## Windows Debugging + +A remote Windows Server 2022 EC2 instance is available for debugging Windows-specific issues. It uses AWS Systems Manager (SSM) with no SSH or open ports. Commands run via `aws ssm send-command` and return stdout/stderr. + +### Prerequisites + +The instance must be provisioned first (one-time, by a human): + +```bash +./scripts/windows-debug/provision.sh +``` + +Requires: AWS CLI v2 configured with `ec2:*`, `iam:CreateRole`, `iam:AttachRolePolicy`, `ssm:SendCommand`, `ssm:GetCommandInvocation` permissions and a default VPC. + +### Usage + +Start the instance (if stopped): + +```bash +./scripts/windows-debug/start.sh +``` + +Run a command on Windows: + +```bash +./scripts/windows-debug/run.sh "" +``` + +Sync the current git branch and rebuild: + +```bash +./scripts/windows-debug/sync.sh +``` + +Stop the instance when done (avoids cost): + +```bash +./scripts/windows-debug/stop.sh +``` + +### Common Workflows + +Run unit tests on Windows: + +```bash +./scripts/windows-debug/run.sh "cd C:\agent-browser && cargo test --manifest-path cli\Cargo.toml" +``` + +Run e2e tests on Windows: + +```bash +./scripts/windows-debug/run.sh "cd C:\agent-browser && cargo test e2e --manifest-path cli\Cargo.toml -- --ignored --test-threads=1" +``` + +Check bootstrap progress (first boot only): + +```bash +./scripts/windows-debug/run.sh "Get-Content C:\bootstrap.log" +``` + +The repo lives at `C:\agent-browser` on the instance. Rust, Git, and Chrome are pre-installed. The `run.sh` wrapper automatically adds cargo and git to PATH. + + + +## Source Code Reference + +Source code for dependencies is available in `opensrc/` for deeper understanding of implementation details. + +See `opensrc/sources.json` for the list of available packages and their versions. + +Use this source code when you need to understand how a package works internally, not just its types/interface. + +### Fetching Additional Source Code + +To fetch source code for a package or repository you need to understand, run: + +```bash +npx opensrc # npm package (e.g., npx opensrc zod) +npx opensrc pypi: # Python package (e.g., npx opensrc pypi:requests) +npx opensrc crates: # Rust crate (e.g., npx opensrc crates:serde) +npx opensrc / # GitHub repo (e.g., npx opensrc vercel/ai) +``` + + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1a42e0c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,1065 @@ +# agent-browser + +## 0.31.1 + + +### Bug Fixes + +- Fixed the **React renderer** so it picks the react-dom renderer instead of hardcoding renderer id 1, which prevented reading an empty tree on Next.js 16.3 Turbopack (#1491) + +### Contributors + +- @gaojude + + +## 0.31.0 + +### New Features + +- **Restore workflow** - Added `--restore`, `--restore-save`, restore validation flags, worktree-scoped `session id`, `session info`, and `--namespace` so agent runs can use stable, isolated, automatically restored browser state without managing state files by hand (#1486) + +### Improvements + +- Hardened **session lifecycle handling** with explicit daemon and browser compatibility checks, lifecycle status output, MCP support for restore options, and safer auto-save behavior that avoids overwriting good state after a failed restore or failed validation (#1486) + +### Bug Fixes + +- Fixed **restore lifecycle edge cases** around switching restore keys with a live browser, daemon configuration startup races, launch mode validation, and clearing restore failures after an explicit state load (#1486) + +### Contributors + +- @ctate + +## 0.30.1 + +### Bug Fixes + +- Fixed **URL waits** so `wait --url` and `waitforurl` honor glob patterns such as `**/dashboard` against the full active URL (#1483) + +### Contributors + +- @gaearon + +## 0.30.0 + +### New Features + +- **Read command** - Added `agent-browser read [url]` and the matching MCP tool for agent-readable text extraction. URL reads prefer Markdown, try `.md` and nearby `llms.txt` docs, support outlines, filters, raw and JSON output, headers, and domain/output safeguards; omitting the URL reads the rendered active tab DOM with current browser state (#1480) + +### Contributors + +- @ctate + +## 0.29.1 + +### Improvements + +- Defaulted **sandbox system dependency installs** so the Eve and Vercel sandbox helpers install Chromium's required libraries unless explicitly disabled, making first-run sandbox setup simpler (#1469) + +### Contributors + +- @ctate + +## 0.29.0 + +### New Features + +- **Sandbox package** - Added `@agent-browser/sandbox` with shared, Eve, and Vercel Sandbox helpers, example projects, and docs for running agent-browser in hosted sandbox environments (#1465) + +### Improvements + +- Updated **sandbox release flow** so the new package stays version-synced with the CLI release and publishes from the correct workspace path (#1465) +- Reflowed **documentation prose** across the README, docs site, examples, and skills so Markdown and MDX wrap naturally in editors and renderers (#1466) + +### Contributors + +- @ctate + +## 0.28.0 + +### New Features + +- **MCP server** - Added `agent-browser mcp`, a stdio Model Context Protocol server with typed tools, paginated discovery, protocol negotiation, and startup tool profiles. The default `core` profile keeps context small, while `--tools all` exposes full CLI parity and composed profiles such as `core,network,react` are supported (#1454) +- **Plugin system** - Added out-of-process plugin support over the `agent-browser.plugin.v1` stdio protocol, with `plugin add/list/show/run`, manifest discovery, npm and GitHub refs, credential providers, browser provider plugins, launch mutators, custom command capabilities, config and env registry support, and capability-scoped policy gates (#1452) + +### Infrastructure + +- Added **context footprint eval coverage** for CLI skills, MCP core, and MCP full-profile surfaces, plus MCP parity tests to keep tool behavior aligned with the CLI (#1454) + +### Contributors + +- @ctate + +## 0.27.3 + +### Bug Fixes + +- Fixed **Windows ARM64 installs** by falling back to the Windows x64 binary during postinstall, avoiding failed downloads for a native ARM64 artifact that is not published (#1269) + +### Contributors + +- @EternalRights + +## 0.27.2 + +### Bug Fixes + +- Fixed **click reliability** by scrolling off-viewport elements into view before resolving coordinates, handling JavaScript dialogs promptly, recovering mouse state after dialog-opening clicks, and detecting click interception by overlays before dispatching input (#1432, #1434) +- Fixed **frame-scoped selectors and waits** so CSS-selector actions and `wait` respect the selected iframe, including cross-process iframes, with translated click coordinates (#1432) +- Fixed **wait timeout handling** so the documented 25s default is used, `--timeout` is honored across wait variants, and long waits receive an appropriate client read budget (#1432) +- Fixed **agent-facing form commands** so `find label` matches `aria-label` and `aria-labelledby`, `select` errors when no option matches, and `type` parses `--clear` and `--delay` instead of typing them as text (#1432) + +### Improvements + +- Cut **warm CLI command latency** from about 150ms to about 1ms by removing the unconditional daemon settle sleep and retrying once when a stale daemon socket is discovered (#1432) +- Extended **daemon respawn and retry** handling to batch commands so batches recover from a daemon exit after the initial liveness check (#1432) + +### Infrastructure + +- Pinned **GNU Linux release artifacts** to glibc 2.28 with zigbuild, added a release guard for newer GLIBC symbols, and aligned Docker release helpers with the pinned target (#1417) + +### Contributors + +- @ctate +- @heshamkhaledd + +## 0.27.1 + +### Improvements + +- Improved **`vitals` command** output formatting for better readability (#1404) + +### Documentation + +- Surfaced agent-browser feature coverage in documentation (#1403) + +## 0.27.0 + +### New Features + +- **React introspection** - First-class React DevTools integration with new `react tree`, `react inspect `, `react renders start|stop`, and `react suspense` commands for full component-tree visibility, per-fiber props/hooks/state inspection, render profiling with mount/re-render counts and change details, and Suspense boundary classification with root-cause grouping and recommendations. React DevTools hook is vendored (MIT) and embedded in the binary with zero runtime dependencies (#1257) +- **Web Vitals** - New `vitals [url]` command that reports Core Web Vitals (LCP, CLS, TTFB, FCP, INP) plus React hydration phases for any page (#1257) +- **SPA navigation** - New `pushstate ` command for client-side SPA navigations without a full page load (#1257) +- **Init scripts and feature flags** - New `--init-script ` flag (repeatable; env `AGENT_BROWSER_INIT_SCRIPTS`) to register scripts before first navigation, and `--enable ` flag (repeatable; env `AGENT_BROWSER_ENABLE`) for built-in init scripts such as `react-devtools` (#1257) +- **Network route resource type filter** - `network route` now accepts `--resource-type ` to filter intercepted requests by CDP resource type (#1257) +- **cURL cookie import** - `cookies set --curl ` auto-detects JSON, cURL, and Cookie-header formats for bulk cookie import (#1257) +- **Dashboard proxy support** - The observability dashboard now works from proxied origins via a same-origin proxy, enabling deployment behind reverse proxies and path-based routing (#1111) + +### Bug Fixes + +- Fixed **`doctor` command** generating duplicate check ids when called multiple times in the same process (#1330) + +### Infrastructure + +- Switched npm publishing to **trusted publishing** via GitHub Actions OIDC, removing the need for manually managed npm tokens (#1273) + +### Contributors + +- @ctate +- @quuu +- @shaper +- @ThomasK33 + +## 0.26.0 + +### New Features + +- **`doctor` command** - Added `agent-browser doctor` for one-shot diagnosis of an install. Checks environment, Chrome, running daemons, config files, security, providers, and network connectivity; auto-cleans stale daemon sidecar files on every run; and performs a live headless launch test. Supports `--offline` to skip network probes, `--quick` to skip the launch test, `--fix` for opt-in repairs (install missing Chrome, close version-mismatched daemons, prune expired state files), and `--json` for structured output (#1254) +- **Stable tab ids and labels** - Tabs now have stable string ids like `t1`, `t2`, `t3` that don't shift when other tabs close or popups appear. Tabs can be created with a memorable label via `tab new --label []`, and labels are interchangeable with `t` ids everywhere a tab ref is accepted (`tab `, `tab close `). Bare-integer input is rejected with a teaching error so agents can't mistake stable handles for positional indices (#892, #1249, #1250) +- **`core` skill** - Renamed the built-in `agent-browser` skill to `core` and replaced its ~40-line discovery stub with a ~420-line usage guide covering the core snapshot-ref-act loop, reading, interacting, waiting, common workflows, troubleshooting, and global flags. `agent-browser skills get core` now returns content agents can use directly; `--full` adds references and templates. Added a `hidden:` frontmatter flag so the original `agent-browser` stub stays reachable for `npx skills add` discovery without polluting `skills list` (#1253) +- **JSON Schema for config files** - Added `agent-browser.schema.json` describing every config option with types and descriptions, enabling IDE autocomplete and validation when referenced via `$schema` in `agent-browser.json` or `~/.agent-browser/config.json`. The schema is served from the docs site at `https://agent-browser.dev/schema.json` (#1242, #1248) + +### Bug Fixes + +- Fixed **`--state` / `AGENT_BROWSER_STATE`** not actually loading saved browser state (cookies and localStorage) at launch. The flag had been fully plumbed through parsing, env propagation, and validation since the native Rust rewrite, but the load step was never wired up. Storage state now loads after launch across all four paths: explicit launch, auto-connect, provider, and local Chrome (#1241) + +### Documentation + +- `--help` output now shows the **skills** section first so agents discover `skills get core` (the canonical usage guide) before the core command list (#1251) + +### Contributors + +- @ctate +- @DJRHails +- @michael-farah +- @tomdale + +## 0.25.5 + +### Bug Fixes + +- Fixed **`--auto-connect` CDP discovery** preferring HTTP endpoint discovery over the DevToolsActivePort websocket path, which could fail on some setups. The CLI now reads the websocket path from DevToolsActivePort first and only falls back to HTTP discovery (#1218) +- Fixed **recording context viewport** not inheriting the active viewport dimensions, causing recordings to use default resolution instead of the configured viewport (#1208) +- Fixed **`get box` and `get styles`** printing no data in text mode (#1231, #1233) +- Fixed **active page changing** when closing or removing earlier tabs. The previously focused page is now preserved correctly (#1220) + +### Contributors + +- @ctate +- @jin-2-kakaoent +- @officialasishkumar + +## 0.25.4 + +### New Features + +- **`skills` command** - Added `agent-browser skills` command for discovering and installing agent skills, with built-in evaluation support for testing skills against live browser sessions (#1225, #1227) + +### Bug Fixes + +- Fixed **custom viewport dimensions** not being used in streaming frame metadata and image resolution (#1033) +- Fixed **`--ignore-https-errors`** not being re-applied to recording contexts, causing TLS errors during screen recordings (#1178) +- Fixed **duplicate option numbering** in the auth skill documentation (#1161) + +### Documentation + +- The docs site header now **dynamically fetches** the GitHub star count (#1202) + +### Contributors + +- @ctate +- @jin-2-kakaoent +- @juniper929 +- @Marshall-Sun + +## 0.25.3 + +### Bug Fixes + +- Fixed **hidden radio/checkbox inputs missing from snapshot refs** when a `