agent-browser 0.19.0 → 0.20.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/README.md +36 -82
- package/bin/agent-browser-darwin-arm64 +0 -0
- package/bin/agent-browser-darwin-x64 +0 -0
- package/bin/agent-browser-linux-arm64 +0 -0
- package/bin/agent-browser-linux-x64 +0 -0
- package/bin/agent-browser-win32-x64.exe +0 -0
- package/package.json +6 -49
- package/scripts/postinstall.js +12 -15
- package/skills/agent-browser/SKILL.md +9 -18
- package/skills/electron/SKILL.md +5 -5
- package/dist/action-policy.d.ts +0 -14
- package/dist/action-policy.d.ts.map +0 -1
- package/dist/action-policy.js +0 -253
- package/dist/action-policy.js.map +0 -1
- package/dist/actions.d.ts +0 -18
- package/dist/actions.d.ts.map +0 -1
- package/dist/actions.js +0 -2121
- package/dist/actions.js.map +0 -1
- package/dist/auth-cli.d.ts +0 -2
- package/dist/auth-cli.d.ts.map +0 -1
- package/dist/auth-cli.js +0 -97
- package/dist/auth-cli.js.map +0 -1
- package/dist/auth-vault.d.ts +0 -36
- package/dist/auth-vault.d.ts.map +0 -1
- package/dist/auth-vault.js +0 -125
- package/dist/auth-vault.js.map +0 -1
- package/dist/browser.d.ts +0 -629
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.js +0 -2342
- package/dist/browser.js.map +0 -1
- package/dist/confirmation.d.ts +0 -8
- package/dist/confirmation.d.ts.map +0 -1
- package/dist/confirmation.js +0 -30
- package/dist/confirmation.js.map +0 -1
- package/dist/daemon.d.ts +0 -71
- package/dist/daemon.d.ts.map +0 -1
- package/dist/daemon.js +0 -669
- package/dist/daemon.js.map +0 -1
- package/dist/diff.d.ts +0 -18
- package/dist/diff.d.ts.map +0 -1
- package/dist/diff.js +0 -271
- package/dist/diff.js.map +0 -1
- package/dist/domain-filter.d.ts +0 -28
- package/dist/domain-filter.d.ts.map +0 -1
- package/dist/domain-filter.js +0 -149
- package/dist/domain-filter.js.map +0 -1
- package/dist/encryption.d.ts +0 -73
- package/dist/encryption.d.ts.map +0 -1
- package/dist/encryption.js +0 -171
- package/dist/encryption.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -5
- package/dist/index.js.map +0 -1
- package/dist/inspect-server.d.ts +0 -26
- package/dist/inspect-server.d.ts.map +0 -1
- package/dist/inspect-server.js +0 -218
- package/dist/inspect-server.js.map +0 -1
- package/dist/ios-actions.d.ts +0 -11
- package/dist/ios-actions.d.ts.map +0 -1
- package/dist/ios-actions.js +0 -228
- package/dist/ios-actions.js.map +0 -1
- package/dist/ios-manager.d.ts +0 -266
- package/dist/ios-manager.d.ts.map +0 -1
- package/dist/ios-manager.js +0 -1073
- package/dist/ios-manager.js.map +0 -1
- package/dist/protocol.d.ts +0 -28
- package/dist/protocol.d.ts.map +0 -1
- package/dist/protocol.js +0 -988
- package/dist/protocol.js.map +0 -1
- package/dist/snapshot.d.ts +0 -67
- package/dist/snapshot.d.ts.map +0 -1
- package/dist/snapshot.js +0 -514
- package/dist/snapshot.js.map +0 -1
- package/dist/state-utils.d.ts +0 -77
- package/dist/state-utils.d.ts.map +0 -1
- package/dist/state-utils.js +0 -178
- package/dist/state-utils.js.map +0 -1
- package/dist/stream-server.d.ts +0 -117
- package/dist/stream-server.d.ts.map +0 -1
- package/dist/stream-server.js +0 -309
- package/dist/stream-server.js.map +0 -1
- package/dist/types.d.ts +0 -927
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,51 +1,41 @@
|
|
|
1
1
|
# agent-browser
|
|
2
2
|
|
|
3
|
-
Headless browser automation CLI for AI agents. Fast Rust CLI
|
|
3
|
+
Headless browser automation CLI for AI agents. Fast native Rust CLI.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
### Global Installation (recommended)
|
|
8
8
|
|
|
9
|
-
Installs the native Rust binary
|
|
9
|
+
Installs the native Rust binary:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npm install -g agent-browser
|
|
13
|
-
agent-browser install # Download
|
|
13
|
+
agent-browser install # Download Chrome from Chrome for Testing (first time only)
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
This is the fastest option -- commands run through the native Rust CLI directly with sub-millisecond parsing overhead.
|
|
17
|
-
|
|
18
|
-
### Quick Start (no install)
|
|
19
|
-
|
|
20
|
-
Run directly with `npx` if you want to try it without installing globally:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npx agent-browser install # Download Chromium (first time only)
|
|
24
|
-
npx agent-browser open example.com
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
> **Note:** `npx` routes through Node.js before reaching the Rust CLI, so it is noticeably slower than a global install. For regular use, install globally.
|
|
28
|
-
|
|
29
16
|
### Project Installation (local dependency)
|
|
30
17
|
|
|
31
18
|
For projects that want to pin the version in `package.json`:
|
|
32
19
|
|
|
33
20
|
```bash
|
|
34
21
|
npm install agent-browser
|
|
35
|
-
|
|
22
|
+
agent-browser install
|
|
36
23
|
```
|
|
37
24
|
|
|
38
|
-
Then use via `
|
|
25
|
+
Then use via `package.json` scripts or by invoking `agent-browser` directly.
|
|
26
|
+
|
|
27
|
+
### Homebrew (macOS)
|
|
39
28
|
|
|
40
29
|
```bash
|
|
41
|
-
|
|
30
|
+
brew install agent-browser
|
|
31
|
+
agent-browser install # Download Chrome from Chrome for Testing (first time only)
|
|
42
32
|
```
|
|
43
33
|
|
|
44
|
-
###
|
|
34
|
+
### Cargo (Rust)
|
|
45
35
|
|
|
46
36
|
```bash
|
|
47
|
-
|
|
48
|
-
agent-browser install # Download
|
|
37
|
+
cargo install agent-browser
|
|
38
|
+
agent-browser install # Download Chrome from Chrome for Testing (first time only)
|
|
49
39
|
```
|
|
50
40
|
|
|
51
41
|
### From Source
|
|
@@ -66,9 +56,13 @@ On Linux, install system dependencies:
|
|
|
66
56
|
|
|
67
57
|
```bash
|
|
68
58
|
agent-browser install --with-deps
|
|
69
|
-
# or manually: npx playwright install-deps chromium
|
|
70
59
|
```
|
|
71
60
|
|
|
61
|
+
### Requirements
|
|
62
|
+
|
|
63
|
+
- **Chrome** - Run `agent-browser install` to download Chrome from [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) (Google's official automation channel). No Playwright or Node.js required for the daemon.
|
|
64
|
+
- **Rust** - Only needed when building from source (see From Source above).
|
|
65
|
+
|
|
72
66
|
## Quick Start
|
|
73
67
|
|
|
74
68
|
```bash
|
|
@@ -322,7 +316,7 @@ agent-browser reload # Reload page
|
|
|
322
316
|
### Setup
|
|
323
317
|
|
|
324
318
|
```bash
|
|
325
|
-
agent-browser install # Download
|
|
319
|
+
agent-browser install # Download Chrome from Chrome for Testing (Google's official automation channel)
|
|
326
320
|
agent-browser install --with-deps # Also install system deps (Linux)
|
|
327
321
|
```
|
|
328
322
|
|
|
@@ -506,7 +500,7 @@ The `-C` flag is useful for modern web apps that use custom clickable elements (
|
|
|
506
500
|
|
|
507
501
|
The `--annotate` flag overlays numbered labels on interactive elements in the screenshot. Each label `[N]` corresponds to ref `@eN`, so the same refs work for both visual and text-based workflows.
|
|
508
502
|
|
|
509
|
-
|
|
503
|
+
Annotated screenshots are supported on the CDP-backed browser path (Chrome/Lightpanda). The Safari/WebDriver backend does not yet support `--annotate`.
|
|
510
504
|
|
|
511
505
|
```bash
|
|
512
506
|
agent-browser screenshot --annotate
|
|
@@ -561,8 +555,7 @@ This is useful for multimodal AI models that can reason about visual layout, unl
|
|
|
561
555
|
| `--action-policy <path>` | Path to action policy JSON file (or `AGENT_BROWSER_ACTION_POLICY` env) |
|
|
562
556
|
| `--confirm-actions <list>` | Action categories requiring confirmation (or `AGENT_BROWSER_CONFIRM_ACTIONS` env) |
|
|
563
557
|
| `--confirm-interactive` | Interactive confirmation prompts; auto-denies if stdin is not a TTY (or `AGENT_BROWSER_CONFIRM_INTERACTIVE` env) |
|
|
564
|
-
| `--engine <name>` | Browser engine: `chrome` (default), `lightpanda
|
|
565
|
-
| `--native` | [Experimental] Use native Rust daemon instead of Node.js (or `AGENT_BROWSER_NATIVE` env) |
|
|
558
|
+
| `--engine <name>` | Browser engine: `chrome` (default), `lightpanda` (or `AGENT_BROWSER_ENGINE` env) |
|
|
566
559
|
| `--config <path>` | Use a custom config file (or `AGENT_BROWSER_CONFIG` env) |
|
|
567
560
|
| `--debug` | Debug output |
|
|
568
561
|
|
|
@@ -606,7 +599,7 @@ Auto-discovered config files that are missing are silently ignored. If `--config
|
|
|
606
599
|
|
|
607
600
|
## Default Timeout
|
|
608
601
|
|
|
609
|
-
The default
|
|
602
|
+
The default timeout for standard operations (clicks, waits, fills, etc.) is 25 seconds. This is intentionally below the CLI's 30-second IPC read timeout so that the daemon returns a proper error instead of the CLI timing out with EAGAIN.
|
|
610
603
|
|
|
611
604
|
Override the default timeout via environment variable:
|
|
612
605
|
|
|
@@ -615,11 +608,11 @@ Override the default timeout via environment variable:
|
|
|
615
608
|
export AGENT_BROWSER_DEFAULT_TIMEOUT=45000
|
|
616
609
|
```
|
|
617
610
|
|
|
618
|
-
> **Note:** Setting this above 30000 (30s) may cause EAGAIN errors on slow operations because the CLI's read timeout will expire before
|
|
611
|
+
> **Note:** Setting this above 30000 (30s) may cause EAGAIN errors on slow operations because the CLI's read timeout will expire before the daemon responds. The CLI retries transient errors automatically, but response times will increase.
|
|
619
612
|
|
|
620
|
-
| Variable | Description
|
|
621
|
-
| ------------------------------- |
|
|
622
|
-
| `AGENT_BROWSER_DEFAULT_TIMEOUT` | Default
|
|
613
|
+
| Variable | Description |
|
|
614
|
+
| ------------------------------- | ---------------------------------------- |
|
|
615
|
+
| `AGENT_BROWSER_DEFAULT_TIMEOUT` | Default operation timeout in ms (default: 25000) |
|
|
623
616
|
|
|
624
617
|
## Selectors
|
|
625
618
|
|
|
@@ -1009,61 +1002,22 @@ await browser.stopScreencast();
|
|
|
1009
1002
|
|
|
1010
1003
|
agent-browser uses a client-daemon architecture:
|
|
1011
1004
|
|
|
1012
|
-
1. **Rust CLI**
|
|
1013
|
-
2. **
|
|
1014
|
-
3. **Native Daemon** (experimental, `--native`) - Pure Rust daemon using direct CDP, no Node.js required
|
|
1015
|
-
4. **Fallback** - If native binary unavailable, uses Node.js directly
|
|
1016
|
-
|
|
1017
|
-
The daemon starts automatically on first command and persists between commands for fast subsequent operations.
|
|
1018
|
-
|
|
1019
|
-
**Browser Engine:** Uses Chromium by default. The default Node.js daemon also supports Firefox and WebKit via Playwright. The experimental native daemon speaks Chrome DevTools Protocol (CDP) directly and supports Chromium-based browsers and Safari (via WebDriver).
|
|
1020
|
-
|
|
1021
|
-
## Experimental: Native Mode
|
|
1022
|
-
|
|
1023
|
-
The native daemon is a pure Rust implementation that communicates with Chrome directly via CDP, eliminating the Node.js and Playwright dependencies. It is currently **experimental** and opt-in.
|
|
1024
|
-
|
|
1025
|
-
### Enabling Native Mode
|
|
1026
|
-
|
|
1027
|
-
```bash
|
|
1028
|
-
# Via flag
|
|
1029
|
-
agent-browser --native open example.com
|
|
1030
|
-
|
|
1031
|
-
# Via environment variable (recommended for persistent use)
|
|
1032
|
-
export AGENT_BROWSER_NATIVE=1
|
|
1033
|
-
agent-browser open example.com
|
|
1034
|
-
```
|
|
1035
|
-
|
|
1036
|
-
Or add to your config file (`agent-browser.json`):
|
|
1037
|
-
|
|
1038
|
-
```json
|
|
1039
|
-
{ "native": true }
|
|
1040
|
-
```
|
|
1041
|
-
|
|
1042
|
-
### What's Different
|
|
1043
|
-
|
|
1044
|
-
| | Default (Node.js) | Native (`--native`) |
|
|
1045
|
-
| ------------------- | --------------------------- | -------------------------------- |
|
|
1046
|
-
| **Runtime** | Node.js + Playwright | Pure Rust binary |
|
|
1047
|
-
| **Protocol** | Playwright protocol | Direct CDP / WebDriver |
|
|
1048
|
-
| **Install size** | Larger (Node.js + npm deps) | Smaller (single binary) |
|
|
1049
|
-
| **Browser support** | Chromium, Firefox, WebKit | Chromium, Safari (via WebDriver) |
|
|
1050
|
-
| **Stability** | Stable | Experimental |
|
|
1005
|
+
1. **Rust CLI** - Parses commands, communicates with daemon
|
|
1006
|
+
2. **Rust Daemon** - Pure Rust daemon using direct CDP, no Node.js required
|
|
1051
1007
|
|
|
1052
|
-
|
|
1008
|
+
The daemon starts automatically on first command and persists between commands for fast subsequent operations. To auto-shutdown the daemon after a period of inactivity, set `AGENT_BROWSER_IDLE_TIMEOUT_MS` (value in milliseconds). When set, the daemon closes the browser and exits after receiving no commands for the specified duration.
|
|
1053
1009
|
|
|
1054
|
-
|
|
1055
|
-
- Some Playwright-specific features (tracing format, HAR export) are not available
|
|
1056
|
-
- The native daemon and Node.js daemon share the same session socket, so you cannot run both simultaneously for the same session. Use `agent-browser close` before switching modes.
|
|
1010
|
+
**Browser Engine:** Uses Chrome (from Chrome for Testing) by default. The `--engine` flag selects between `chrome` and `lightpanda`. Supported browsers: Chromium/Chrome (via CDP) and Safari (via WebDriver for iOS).
|
|
1057
1011
|
|
|
1058
1012
|
## Platforms
|
|
1059
1013
|
|
|
1060
|
-
| Platform | Binary |
|
|
1061
|
-
| ----------- | ----------- |
|
|
1062
|
-
| macOS ARM64 | Native Rust |
|
|
1063
|
-
| macOS x64 | Native Rust |
|
|
1064
|
-
| Linux ARM64 | Native Rust |
|
|
1065
|
-
| Linux x64 | Native Rust |
|
|
1066
|
-
| Windows x64 | Native Rust |
|
|
1014
|
+
| Platform | Binary |
|
|
1015
|
+
| ----------- | ----------- |
|
|
1016
|
+
| macOS ARM64 | Native Rust |
|
|
1017
|
+
| macOS x64 | Native Rust |
|
|
1018
|
+
| Linux ARM64 | Native Rust |
|
|
1019
|
+
| Linux x64 | Native Rust |
|
|
1020
|
+
| Windows x64 | Native Rust |
|
|
1067
1021
|
|
|
1068
1022
|
## Usage with AI Agents
|
|
1069
1023
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-browser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Headless browser automation CLI for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"default": "./dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./package.json": "./package.json"
|
|
15
|
-
},
|
|
16
6
|
"files": [
|
|
17
|
-
"dist",
|
|
18
7
|
"bin",
|
|
19
8
|
"scripts",
|
|
20
9
|
"skills"
|
|
@@ -26,7 +15,8 @@
|
|
|
26
15
|
"browser",
|
|
27
16
|
"automation",
|
|
28
17
|
"headless",
|
|
29
|
-
"
|
|
18
|
+
"chrome",
|
|
19
|
+
"cdp",
|
|
30
20
|
"cli",
|
|
31
21
|
"agent"
|
|
32
22
|
],
|
|
@@ -39,55 +29,22 @@
|
|
|
39
29
|
"url": "https://github.com/vercel-labs/agent-browser/issues"
|
|
40
30
|
},
|
|
41
31
|
"homepage": "https://github.com/vercel-labs/agent-browser#readme",
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"node-simctl": "^7.4.0",
|
|
44
|
-
"playwright-core": "^1.57.0",
|
|
45
|
-
"webdriverio": "^9.15.0",
|
|
46
|
-
"ws": "^8.19.0",
|
|
47
|
-
"zod": "^3.22.4"
|
|
48
|
-
},
|
|
49
32
|
"devDependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"@changesets/cli": "^2.29.8",
|
|
52
|
-
"@types/node": "^20.10.0",
|
|
53
|
-
"@types/ws": "^8.18.1",
|
|
54
|
-
"husky": "^9.1.7",
|
|
55
|
-
"lint-staged": "^15.2.11",
|
|
56
|
-
"playwright": "^1.57.0",
|
|
57
|
-
"prettier": "^3.7.4",
|
|
58
|
-
"tsx": "^4.6.0",
|
|
59
|
-
"typescript": "^5.3.0",
|
|
60
|
-
"vitest": "^4.0.16"
|
|
61
|
-
},
|
|
62
|
-
"lint-staged": {
|
|
63
|
-
"src/**/*.ts": "prettier --write"
|
|
33
|
+
"@changesets/cli": "^2.29.8"
|
|
64
34
|
},
|
|
65
35
|
"scripts": {
|
|
66
36
|
"version:sync": "node scripts/sync-version.js",
|
|
67
37
|
"version": "npm run version:sync && git add cli/Cargo.toml",
|
|
68
|
-
"build": "tsc",
|
|
69
38
|
"build:native": "npm run version:sync && cargo build --release --manifest-path cli/Cargo.toml && node scripts/copy-native.js",
|
|
70
39
|
"build:linux": "npm run version:sync && docker compose -f docker/docker-compose.yml run --rm build-linux",
|
|
71
40
|
"build:macos": "npm run version:sync && (cargo build --release --manifest-path cli/Cargo.toml --target aarch64-apple-darwin & cargo build --release --manifest-path cli/Cargo.toml --target x86_64-apple-darwin & wait) && cp cli/target/aarch64-apple-darwin/release/agent-browser bin/agent-browser-darwin-arm64 && cp cli/target/x86_64-apple-darwin/release/agent-browser bin/agent-browser-darwin-x64",
|
|
72
41
|
"build:windows": "npm run version:sync && docker compose -f docker/docker-compose.yml run --rm build-windows",
|
|
73
42
|
"build:all-platforms": "npm run version:sync && (npm run build:linux & npm run build:windows & wait) && npm run build:macos",
|
|
74
43
|
"build:docker": "docker build -t agent-browser-builder -f docker/Dockerfile.build .",
|
|
75
|
-
"release": "npm run version:sync && npm run build
|
|
76
|
-
"start": "node dist/daemon.js",
|
|
77
|
-
"dev": "tsx src/daemon.ts",
|
|
78
|
-
"typecheck": "tsc --noEmit",
|
|
79
|
-
"format": "prettier --write 'src/**/*.ts'",
|
|
80
|
-
"format:check": "prettier --check 'src/**/*.ts'",
|
|
81
|
-
"test": "vitest run",
|
|
82
|
-
"test:watch": "vitest",
|
|
83
|
-
"test:e2e:dogfood": "vitest run test/e2e/dogfood.eval.ts",
|
|
84
|
-
"bench": "pnpm build && tsx test/benchmarks/run.ts",
|
|
85
|
-
"bench:node": "pnpm build && tsx test/benchmarks/run.ts --node-only",
|
|
86
|
-
"bench:native": "pnpm build && tsx test/benchmarks/run.ts --native-only",
|
|
87
|
-
"bench:engine": "pnpm build && tsx test/benchmarks/run.ts --engine",
|
|
44
|
+
"release": "npm run version:sync && npm run build:all-platforms && npm publish",
|
|
88
45
|
"postinstall": "node scripts/postinstall.js",
|
|
89
46
|
"changeset": "changeset",
|
|
90
47
|
"ci:version": "changeset version && pnpm run version:sync && pnpm install --no-frozen-lockfile",
|
|
91
|
-
"ci:publish": "pnpm run version:sync &&
|
|
48
|
+
"ci:publish": "pnpm run version:sync && changeset publish"
|
|
92
49
|
}
|
|
93
50
|
}
|
package/scripts/postinstall.js
CHANGED
|
@@ -80,7 +80,7 @@ async function main() {
|
|
|
80
80
|
// On global installs, fix npm's bin entry to use native binary directly
|
|
81
81
|
await fixGlobalInstallBin();
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
showInstallReminder();
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -102,8 +102,7 @@ async function main() {
|
|
|
102
102
|
|
|
103
103
|
console.log(`✓ Downloaded native binary: ${binaryName}`);
|
|
104
104
|
} catch (err) {
|
|
105
|
-
console.log(
|
|
106
|
-
console.log(` The CLI will use Node.js fallback (slightly slower startup)`);
|
|
105
|
+
console.log(`Could not download native binary: ${err.message}`);
|
|
107
106
|
console.log('');
|
|
108
107
|
console.log('To build the native binary locally:');
|
|
109
108
|
console.log(' 1. Install Rust: https://rustup.rs');
|
|
@@ -114,21 +113,19 @@ async function main() {
|
|
|
114
113
|
// This avoids the /bin/sh error on Windows and provides zero-overhead execution
|
|
115
114
|
await fixGlobalInstallBin();
|
|
116
115
|
|
|
117
|
-
|
|
116
|
+
showInstallReminder();
|
|
118
117
|
}
|
|
119
118
|
|
|
120
|
-
function
|
|
119
|
+
function showInstallReminder() {
|
|
120
|
+
console.log('');
|
|
121
|
+
console.log(' To download Chrome, run:');
|
|
122
|
+
console.log('');
|
|
123
|
+
console.log(' agent-browser install');
|
|
124
|
+
console.log('');
|
|
125
|
+
console.log(' On Linux, include system dependencies with:');
|
|
126
|
+
console.log('');
|
|
127
|
+
console.log(' agent-browser install --with-deps');
|
|
121
128
|
console.log('');
|
|
122
|
-
console.log('╔═══════════════════════════════════════════════════════════════════════════╗');
|
|
123
|
-
console.log('║ To download browser binaries, run: ║');
|
|
124
|
-
console.log('║ ║');
|
|
125
|
-
console.log('║ npx playwright install chromium ║');
|
|
126
|
-
console.log('║ ║');
|
|
127
|
-
console.log('║ On Linux, include system dependencies with: ║');
|
|
128
|
-
console.log('║ ║');
|
|
129
|
-
console.log('║ npx playwright install --with-deps chromium ║');
|
|
130
|
-
console.log('║ ║');
|
|
131
|
-
console.log('╚═══════════════════════════════════════════════════════════════════════════╝');
|
|
132
129
|
}
|
|
133
130
|
|
|
134
131
|
/**
|
|
@@ -6,6 +6,8 @@ allowed-tools: Bash(npx agent-browser:*), Bash(agent-browser:*)
|
|
|
6
6
|
|
|
7
7
|
# Browser Automation with agent-browser
|
|
8
8
|
|
|
9
|
+
The CLI uses Chrome/Chromium via CDP directly. Install via `npm i -g agent-browser`, `brew install agent-browser`, or `cargo install agent-browser`. Run `agent-browser install` to download Chrome.
|
|
10
|
+
|
|
9
11
|
## Core Workflow
|
|
10
12
|
|
|
11
13
|
Every browser automation follows this pattern:
|
|
@@ -441,7 +443,7 @@ agent-browser diff url https://staging.example.com https://prod.example.com --sc
|
|
|
441
443
|
|
|
442
444
|
## Timeouts and Slow Pages
|
|
443
445
|
|
|
444
|
-
The default
|
|
446
|
+
The default timeout is 25 seconds. This can be overridden with the `AGENT_BROWSER_DEFAULT_TIMEOUT` environment variable (value in milliseconds). For slow websites or large pages, use explicit waits instead of relying on the default timeout:
|
|
445
447
|
|
|
446
448
|
```bash
|
|
447
449
|
# Wait for network activity to settle (best for slow pages)
|
|
@@ -485,6 +487,12 @@ agent-browser --session agent1 close # Close specific session
|
|
|
485
487
|
|
|
486
488
|
If a previous session was not closed properly, the daemon may still be running. Use `agent-browser close` to clean it up before starting new work.
|
|
487
489
|
|
|
490
|
+
To auto-shutdown the daemon after a period of inactivity (useful for ephemeral/CI environments):
|
|
491
|
+
|
|
492
|
+
```bash
|
|
493
|
+
AGENT_BROWSER_IDLE_TIMEOUT_MS=60000 agent-browser open example.com
|
|
494
|
+
```
|
|
495
|
+
|
|
488
496
|
## Ref Lifecycle (Important)
|
|
489
497
|
|
|
490
498
|
Refs (`@e1`, `@e2`, etc.) are invalidated when the page changes. Always re-snapshot after:
|
|
@@ -503,8 +511,6 @@ agent-browser click @e1 # Use new refs
|
|
|
503
511
|
|
|
504
512
|
Use `--annotate` to take a screenshot with numbered labels overlaid on interactive elements. Each label `[N]` maps to ref `@eN`. This also caches refs, so you can interact with elements immediately without a separate snapshot.
|
|
505
513
|
|
|
506
|
-
In native mode, this currently works on the CDP-backed browser path (Chromium/Lightpanda). The Safari/WebDriver backend does not yet support `--annotate`.
|
|
507
|
-
|
|
508
514
|
```bash
|
|
509
515
|
agent-browser screenshot --annotate
|
|
510
516
|
# Output includes the image path and a legend:
|
|
@@ -589,21 +595,6 @@ Priority (lowest to highest): `~/.agent-browser/config.json` < `./agent-browser.
|
|
|
589
595
|
| [references/profiling.md](references/profiling.md) | Chrome DevTools profiling for performance analysis |
|
|
590
596
|
| [references/proxy-support.md](references/proxy-support.md) | Proxy configuration, geo-testing, rotating proxies |
|
|
591
597
|
|
|
592
|
-
## Experimental: Native Mode
|
|
593
|
-
|
|
594
|
-
agent-browser has an experimental native Rust daemon that communicates with Chrome directly via CDP, bypassing Node.js and Playwright entirely. It is opt-in and not recommended for production use yet.
|
|
595
|
-
|
|
596
|
-
```bash
|
|
597
|
-
# Enable via flag
|
|
598
|
-
agent-browser --native open example.com
|
|
599
|
-
|
|
600
|
-
# Enable via environment variable (avoids passing --native every time)
|
|
601
|
-
export AGENT_BROWSER_NATIVE=1
|
|
602
|
-
agent-browser open example.com
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
The native daemon supports Chromium and Safari (via WebDriver). Firefox and WebKit are not yet supported. All core commands (navigate, snapshot, click, fill, screenshot, cookies, storage, tabs, eval, etc.) work identically in native mode. Use `agent-browser close` before switching between native and default mode within the same session.
|
|
606
|
-
|
|
607
598
|
## Browser Engine Selection
|
|
608
599
|
|
|
609
600
|
Use `--engine` to choose a local browser engine. The default is `chrome`.
|
package/skills/electron/SKILL.md
CHANGED
|
@@ -104,11 +104,11 @@ agent-browser tab --url "*settings*"
|
|
|
104
104
|
|
|
105
105
|
## Webview Support
|
|
106
106
|
|
|
107
|
-
Electron `<webview>` elements are automatically discovered and can be controlled like regular pages.
|
|
107
|
+
Electron `<webview>` elements are automatically discovered and can be controlled like regular pages. Webviews appear as separate targets in the tab list with `type: "webview"`:
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
|
-
# Connect
|
|
111
|
-
agent-browser
|
|
110
|
+
# Connect to running Electron app
|
|
111
|
+
agent-browser connect 9222
|
|
112
112
|
|
|
113
113
|
# List targets -- webviews appear alongside pages
|
|
114
114
|
agent-browser tab
|
|
@@ -125,7 +125,7 @@ agent-browser click @e3
|
|
|
125
125
|
agent-browser screenshot webview.png
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
**Note:** Webview support
|
|
128
|
+
**Note:** Webview support works via raw CDP connection.
|
|
129
129
|
|
|
130
130
|
## Common Patterns
|
|
131
131
|
|
|
@@ -188,7 +188,7 @@ agent-browser --session vscode snapshot -i
|
|
|
188
188
|
|
|
189
189
|
## Color Scheme
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
The default color scheme when connecting via CDP may be `light`. To preserve dark mode:
|
|
192
192
|
|
|
193
193
|
```bash
|
|
194
194
|
agent-browser connect 9222
|
package/dist/action-policy.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface ActionPolicy {
|
|
2
|
-
default: 'allow' | 'deny';
|
|
3
|
-
allow?: string[];
|
|
4
|
-
deny?: string[];
|
|
5
|
-
}
|
|
6
|
-
export type PolicyDecision = 'allow' | 'deny' | 'confirm';
|
|
7
|
-
export declare const KNOWN_CATEGORIES: Set<string>;
|
|
8
|
-
export declare function getActionCategory(action: string): string;
|
|
9
|
-
export declare function loadPolicyFile(policyPath: string): ActionPolicy;
|
|
10
|
-
export declare function initPolicyReloader(policyPath: string, policy: ActionPolicy): void;
|
|
11
|
-
export declare function reloadPolicyIfChanged(): ActionPolicy | null;
|
|
12
|
-
export declare function checkPolicy(action: string, policy: ActionPolicy | null, confirmCategories: Set<string>): PolicyDecision;
|
|
13
|
-
export declare function describeAction(action: string, command: Record<string, unknown>): string;
|
|
14
|
-
//# sourceMappingURL=action-policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-policy.d.ts","sourceRoot":"","sources":["../src/action-policy.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AA4K1D,eAAO,MAAM,gBAAgB,aAE5B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CAwB/D;AAQD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAIjF;AAED,wBAAgB,qBAAqB,IAAI,YAAY,GAAG,IAAI,CAkB3D;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,YAAY,GAAG,IAAI,EAC3B,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,GAC7B,cAAc,CAkBhB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAyBvF"}
|