agent-browser 0.18.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 +150 -122
- 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 -40
- package/scripts/postinstall.js +12 -15
- package/skills/agent-browser/SKILL.md +37 -32
- 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 -2120
- 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 -592
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.js +0 -2190
- 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 -671
- 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/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 -986
- 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 -925
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
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:
|
|
@@ -136,6 +138,9 @@ agent-browser wait @e1 # Wait for element
|
|
|
136
138
|
agent-browser wait --load networkidle # Wait for network idle
|
|
137
139
|
agent-browser wait --url "**/page" # Wait for URL pattern
|
|
138
140
|
agent-browser wait 2000 # Wait milliseconds
|
|
141
|
+
agent-browser wait --text "Welcome" # Wait for text to appear (substring match)
|
|
142
|
+
agent-browser wait --fn "!document.body.innerText.includes('Loading...')" # Wait for text to disappear
|
|
143
|
+
agent-browser wait "#spinner" --state hidden # Wait for element to disappear
|
|
139
144
|
|
|
140
145
|
# Downloads
|
|
141
146
|
agent-browser download @e1 ./file.pdf # Click element to trigger download
|
|
@@ -151,8 +156,16 @@ agent-browser set device "iPhone 14" # Emulate device (viewport + user
|
|
|
151
156
|
agent-browser screenshot # Screenshot to temp dir
|
|
152
157
|
agent-browser screenshot --full # Full page screenshot
|
|
153
158
|
agent-browser screenshot --annotate # Annotated screenshot with numbered element labels
|
|
159
|
+
agent-browser screenshot --screenshot-dir ./shots # Save to custom directory
|
|
160
|
+
agent-browser screenshot --screenshot-format jpeg --screenshot-quality 80
|
|
154
161
|
agent-browser pdf output.pdf # Save as PDF
|
|
155
162
|
|
|
163
|
+
# Clipboard
|
|
164
|
+
agent-browser clipboard read # Read text from clipboard
|
|
165
|
+
agent-browser clipboard write "Hello, World!" # Write text to clipboard
|
|
166
|
+
agent-browser clipboard copy # Copy current selection
|
|
167
|
+
agent-browser clipboard paste # Paste from clipboard
|
|
168
|
+
|
|
156
169
|
# Diff (compare page states)
|
|
157
170
|
agent-browser diff snapshot # Compare current vs last snapshot
|
|
158
171
|
agent-browser diff snapshot --baseline before.txt # Compare current vs saved file
|
|
@@ -388,8 +401,9 @@ export AGENT_BROWSER_ACTION_POLICY=./policy.json
|
|
|
388
401
|
```
|
|
389
402
|
|
|
390
403
|
Example `policy.json`:
|
|
404
|
+
|
|
391
405
|
```json
|
|
392
|
-
{"default": "deny", "allow": ["navigate", "snapshot", "click", "scroll", "wait", "get"]}
|
|
406
|
+
{ "default": "deny", "allow": ["navigate", "snapshot", "click", "scroll", "wait", "get"] }
|
|
393
407
|
```
|
|
394
408
|
|
|
395
409
|
Auth vault operations (`auth login`, etc.) bypass action policy but domain allowlist still applies.
|
|
@@ -429,7 +443,7 @@ agent-browser diff url https://staging.example.com https://prod.example.com --sc
|
|
|
429
443
|
|
|
430
444
|
## Timeouts and Slow Pages
|
|
431
445
|
|
|
432
|
-
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:
|
|
433
447
|
|
|
434
448
|
```bash
|
|
435
449
|
# Wait for network activity to settle (best for slow pages)
|
|
@@ -473,6 +487,12 @@ agent-browser --session agent1 close # Close specific session
|
|
|
473
487
|
|
|
474
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.
|
|
475
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
|
+
|
|
476
496
|
## Ref Lifecycle (Important)
|
|
477
497
|
|
|
478
498
|
Refs (`@e1`, `@e2`, etc.) are invalidated when the page changes. Always re-snapshot after:
|
|
@@ -491,8 +511,6 @@ agent-browser click @e1 # Use new refs
|
|
|
491
511
|
|
|
492
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.
|
|
493
513
|
|
|
494
|
-
In native mode, this currently works on the CDP-backed browser path (Chromium/Lightpanda). The Safari/WebDriver backend does not yet support `--annotate`.
|
|
495
|
-
|
|
496
514
|
```bash
|
|
497
515
|
agent-browser screenshot --annotate
|
|
498
516
|
# Output includes the image path and a legend:
|
|
@@ -503,6 +521,7 @@ agent-browser click @e2 # Click using ref from annotated screenshot
|
|
|
503
521
|
```
|
|
504
522
|
|
|
505
523
|
Use annotated screenshots when:
|
|
524
|
+
|
|
506
525
|
- The page has unlabeled icon buttons or visual-only elements
|
|
507
526
|
- You need to verify visual layout or styling
|
|
508
527
|
- Canvas or chart elements are present (invisible to text snapshots)
|
|
@@ -545,6 +564,7 @@ agent-browser eval -b "$(echo -n 'Array.from(document.querySelectorAll("a")).map
|
|
|
545
564
|
**Why this matters:** When the shell processes your command, inner double quotes, `!` characters (history expansion), backticks, and `$()` can all corrupt the JavaScript before it reaches agent-browser. The `--stdin` and `-b` flags bypass shell interpretation entirely.
|
|
546
565
|
|
|
547
566
|
**Rules of thumb:**
|
|
567
|
+
|
|
548
568
|
- Single-line, no nested quotes -> regular `eval 'expression'` with single quotes is fine
|
|
549
569
|
- Nested quotes, arrow functions, template literals, or multiline -> use `eval --stdin <<'EVALEOF'`
|
|
550
570
|
- Programmatic/generated scripts -> use `eval -b` with base64
|
|
@@ -565,30 +585,15 @@ Priority (lowest to highest): `~/.agent-browser/config.json` < `./agent-browser.
|
|
|
565
585
|
|
|
566
586
|
## Deep-Dive Documentation
|
|
567
587
|
|
|
568
|
-
| Reference
|
|
569
|
-
|
|
570
|
-
| [references/commands.md](references/commands.md)
|
|
571
|
-
| [references/snapshot-refs.md](references/snapshot-refs.md)
|
|
588
|
+
| Reference | When to Use |
|
|
589
|
+
| -------------------------------------------------------------------- | --------------------------------------------------------- |
|
|
590
|
+
| [references/commands.md](references/commands.md) | Full command reference with all options |
|
|
591
|
+
| [references/snapshot-refs.md](references/snapshot-refs.md) | Ref lifecycle, invalidation rules, troubleshooting |
|
|
572
592
|
| [references/session-management.md](references/session-management.md) | Parallel sessions, state persistence, concurrent scraping |
|
|
573
|
-
| [references/authentication.md](references/authentication.md)
|
|
574
|
-
| [references/video-recording.md](references/video-recording.md)
|
|
575
|
-
| [references/profiling.md](references/profiling.md)
|
|
576
|
-
| [references/proxy-support.md](references/proxy-support.md)
|
|
577
|
-
|
|
578
|
-
## Experimental: Native Mode
|
|
579
|
-
|
|
580
|
-
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.
|
|
581
|
-
|
|
582
|
-
```bash
|
|
583
|
-
# Enable via flag
|
|
584
|
-
agent-browser --native open example.com
|
|
585
|
-
|
|
586
|
-
# Enable via environment variable (avoids passing --native every time)
|
|
587
|
-
export AGENT_BROWSER_NATIVE=1
|
|
588
|
-
agent-browser open example.com
|
|
589
|
-
```
|
|
590
|
-
|
|
591
|
-
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.
|
|
593
|
+
| [references/authentication.md](references/authentication.md) | Login flows, OAuth, 2FA handling, state reuse |
|
|
594
|
+
| [references/video-recording.md](references/video-recording.md) | Recording workflows for debugging and documentation |
|
|
595
|
+
| [references/profiling.md](references/profiling.md) | Chrome DevTools profiling for performance analysis |
|
|
596
|
+
| [references/proxy-support.md](references/proxy-support.md) | Proxy configuration, geo-testing, rotating proxies |
|
|
592
597
|
|
|
593
598
|
## Browser Engine Selection
|
|
594
599
|
|
|
@@ -614,11 +619,11 @@ Lightpanda does not support `--extension`, `--profile`, `--state`, or `--allow-f
|
|
|
614
619
|
|
|
615
620
|
## Ready-to-Use Templates
|
|
616
621
|
|
|
617
|
-
| Template
|
|
618
|
-
|
|
619
|
-
| [templates/form-automation.sh](templates/form-automation.sh)
|
|
620
|
-
| [templates/authenticated-session.sh](templates/authenticated-session.sh) | Login once, reuse state
|
|
621
|
-
| [templates/capture-workflow.sh](templates/capture-workflow.sh)
|
|
622
|
+
| Template | Description |
|
|
623
|
+
| ------------------------------------------------------------------------ | ----------------------------------- |
|
|
624
|
+
| [templates/form-automation.sh](templates/form-automation.sh) | Form filling with validation |
|
|
625
|
+
| [templates/authenticated-session.sh](templates/authenticated-session.sh) | Login once, reuse state |
|
|
626
|
+
| [templates/capture-workflow.sh](templates/capture-workflow.sh) | Content extraction with screenshots |
|
|
622
627
|
|
|
623
628
|
```bash
|
|
624
629
|
./templates/form-automation.sh https://example.com/form
|
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"}
|
package/dist/action-policy.js
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import { readFileSync, statSync } from 'node:fs';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
const ACTION_CATEGORIES = {
|
|
4
|
-
navigate: 'navigate',
|
|
5
|
-
back: 'navigate',
|
|
6
|
-
forward: 'navigate',
|
|
7
|
-
reload: 'navigate',
|
|
8
|
-
tab_new: 'navigate',
|
|
9
|
-
click: 'click',
|
|
10
|
-
dblclick: 'click',
|
|
11
|
-
tap: 'click',
|
|
12
|
-
fill: 'fill',
|
|
13
|
-
type: 'fill',
|
|
14
|
-
// The `keyboard` action is a compound command that dispatches to sub-actions
|
|
15
|
-
// (type, inserttext, press, down, up). Its primary use is text input, so it
|
|
16
|
-
// maps to 'fill'. The interact-like sub-actions (press, down, up) are less
|
|
17
|
-
// common and don't have separate top-level action names in the protocol.
|
|
18
|
-
keyboard: 'fill',
|
|
19
|
-
inserttext: 'fill',
|
|
20
|
-
select: 'fill',
|
|
21
|
-
multiselect: 'fill',
|
|
22
|
-
check: 'fill',
|
|
23
|
-
uncheck: 'fill',
|
|
24
|
-
clear: 'fill',
|
|
25
|
-
selectall: 'fill',
|
|
26
|
-
setvalue: 'fill',
|
|
27
|
-
download: 'download',
|
|
28
|
-
waitfordownload: 'download',
|
|
29
|
-
upload: 'upload',
|
|
30
|
-
evaluate: 'eval',
|
|
31
|
-
evalhandle: 'eval',
|
|
32
|
-
addscript: 'eval',
|
|
33
|
-
addinitscript: 'eval',
|
|
34
|
-
snapshot: 'snapshot',
|
|
35
|
-
screenshot: 'snapshot',
|
|
36
|
-
pdf: 'snapshot',
|
|
37
|
-
diff_snapshot: 'snapshot',
|
|
38
|
-
diff_screenshot: 'snapshot',
|
|
39
|
-
diff_url: 'snapshot',
|
|
40
|
-
scroll: 'scroll',
|
|
41
|
-
scrollintoview: 'scroll',
|
|
42
|
-
wait: 'wait',
|
|
43
|
-
waitforurl: 'wait',
|
|
44
|
-
waitforloadstate: 'wait',
|
|
45
|
-
waitforfunction: 'wait',
|
|
46
|
-
gettext: 'get',
|
|
47
|
-
content: 'get',
|
|
48
|
-
innerhtml: 'get',
|
|
49
|
-
innertext: 'get',
|
|
50
|
-
inputvalue: 'get',
|
|
51
|
-
url: 'get',
|
|
52
|
-
title: 'get',
|
|
53
|
-
getattribute: 'get',
|
|
54
|
-
count: 'get',
|
|
55
|
-
boundingbox: 'get',
|
|
56
|
-
styles: 'get',
|
|
57
|
-
isvisible: 'get',
|
|
58
|
-
isenabled: 'get',
|
|
59
|
-
ischecked: 'get',
|
|
60
|
-
responsebody: 'get',
|
|
61
|
-
route: 'network',
|
|
62
|
-
unroute: 'network',
|
|
63
|
-
requests: 'network',
|
|
64
|
-
state_save: 'state',
|
|
65
|
-
state_load: 'state',
|
|
66
|
-
cookies_set: 'state',
|
|
67
|
-
storage_set: 'state',
|
|
68
|
-
credentials: 'state',
|
|
69
|
-
hover: 'interact',
|
|
70
|
-
focus: 'interact',
|
|
71
|
-
drag: 'interact',
|
|
72
|
-
press: 'interact',
|
|
73
|
-
keydown: 'interact',
|
|
74
|
-
keyup: 'interact',
|
|
75
|
-
mousemove: 'interact',
|
|
76
|
-
mousedown: 'interact',
|
|
77
|
-
mouseup: 'interact',
|
|
78
|
-
wheel: 'interact',
|
|
79
|
-
dispatch: 'interact',
|
|
80
|
-
// These are always allowed (internal/meta operations)
|
|
81
|
-
launch: '_internal',
|
|
82
|
-
close: '_internal',
|
|
83
|
-
tab_list: '_internal',
|
|
84
|
-
tab_switch: '_internal',
|
|
85
|
-
tab_close: '_internal',
|
|
86
|
-
window_new: '_internal',
|
|
87
|
-
frame: '_internal',
|
|
88
|
-
mainframe: '_internal',
|
|
89
|
-
dialog: '_internal',
|
|
90
|
-
session: '_internal',
|
|
91
|
-
console: '_internal',
|
|
92
|
-
errors: '_internal',
|
|
93
|
-
cookies_get: '_internal',
|
|
94
|
-
cookies_clear: '_internal',
|
|
95
|
-
storage_get: '_internal',
|
|
96
|
-
storage_clear: '_internal',
|
|
97
|
-
state_list: '_internal',
|
|
98
|
-
state_show: '_internal',
|
|
99
|
-
state_clear: '_internal',
|
|
100
|
-
state_clean: '_internal',
|
|
101
|
-
state_rename: '_internal',
|
|
102
|
-
highlight: '_internal',
|
|
103
|
-
bringtofront: '_internal',
|
|
104
|
-
trace_start: '_internal',
|
|
105
|
-
trace_stop: '_internal',
|
|
106
|
-
har_start: '_internal',
|
|
107
|
-
har_stop: '_internal',
|
|
108
|
-
video_start: '_internal',
|
|
109
|
-
video_stop: '_internal',
|
|
110
|
-
recording_start: '_internal',
|
|
111
|
-
recording_stop: '_internal',
|
|
112
|
-
recording_restart: '_internal',
|
|
113
|
-
profiler_start: '_internal',
|
|
114
|
-
profiler_stop: '_internal',
|
|
115
|
-
clipboard: '_internal',
|
|
116
|
-
viewport: '_internal',
|
|
117
|
-
useragent: '_internal',
|
|
118
|
-
device: '_internal',
|
|
119
|
-
geolocation: '_internal',
|
|
120
|
-
permissions: '_internal',
|
|
121
|
-
emulatemedia: '_internal',
|
|
122
|
-
offline: '_internal',
|
|
123
|
-
headers: '_internal',
|
|
124
|
-
addstyle: 'eval',
|
|
125
|
-
expose: 'eval',
|
|
126
|
-
timezone: '_internal',
|
|
127
|
-
locale: '_internal',
|
|
128
|
-
pause: '_internal',
|
|
129
|
-
setcontent: 'eval',
|
|
130
|
-
screencast_start: '_internal',
|
|
131
|
-
screencast_stop: '_internal',
|
|
132
|
-
input_mouse: '_internal',
|
|
133
|
-
input_keyboard: '_internal',
|
|
134
|
-
input_touch: '_internal',
|
|
135
|
-
auth_save: '_internal',
|
|
136
|
-
auth_login: '_internal',
|
|
137
|
-
auth_list: '_internal',
|
|
138
|
-
auth_delete: '_internal',
|
|
139
|
-
auth_show: '_internal',
|
|
140
|
-
confirm: '_internal',
|
|
141
|
-
deny: '_internal',
|
|
142
|
-
// Find/semantic locator actions (read-only element resolution)
|
|
143
|
-
getbyrole: 'get',
|
|
144
|
-
getbytext: 'get',
|
|
145
|
-
getbylabel: 'get',
|
|
146
|
-
getbyplaceholder: 'get',
|
|
147
|
-
getbyalttext: 'get',
|
|
148
|
-
getbytitle: 'get',
|
|
149
|
-
getbytestid: 'get',
|
|
150
|
-
nth: 'get',
|
|
151
|
-
};
|
|
152
|
-
// User-facing categories used in policy files. '_internal' is excluded because
|
|
153
|
-
// internal actions always bypass policy. 'unknown' is intentionally not a value
|
|
154
|
-
// in ACTION_CATEGORIES -- it is only the fallback return of getActionCategory()
|
|
155
|
-
// for unrecognized actions. If a user puts "unknown" in a policy file,
|
|
156
|
-
// loadPolicyFile will warn about it as unrecognized, which is correct.
|
|
157
|
-
export const KNOWN_CATEGORIES = new Set(Object.values(ACTION_CATEGORIES).filter((c) => c !== '_internal'));
|
|
158
|
-
export function getActionCategory(action) {
|
|
159
|
-
return ACTION_CATEGORIES[action] ?? 'unknown';
|
|
160
|
-
}
|
|
161
|
-
export function loadPolicyFile(policyPath) {
|
|
162
|
-
const resolved = resolve(policyPath);
|
|
163
|
-
const content = readFileSync(resolved, 'utf-8');
|
|
164
|
-
const policy = JSON.parse(content);
|
|
165
|
-
if (policy.default !== 'allow' && policy.default !== 'deny') {
|
|
166
|
-
throw new Error(`Invalid action policy: "default" must be "allow" or "deny", got "${policy.default}"`);
|
|
167
|
-
}
|
|
168
|
-
for (const list of [policy.allow, policy.deny]) {
|
|
169
|
-
if (!list)
|
|
170
|
-
continue;
|
|
171
|
-
for (const category of list) {
|
|
172
|
-
if (!KNOWN_CATEGORIES.has(category)) {
|
|
173
|
-
console.warn(`[agent-browser] Warning: unrecognized action category "${category}" in policy file. ` +
|
|
174
|
-
`Known categories: ${[...KNOWN_CATEGORIES].sort().join(', ')}`);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return policy;
|
|
179
|
-
}
|
|
180
|
-
let cachedPolicyPath = null;
|
|
181
|
-
let cachedPolicyMtimeMs = 0;
|
|
182
|
-
let cachedPolicy = null;
|
|
183
|
-
const RELOAD_CHECK_INTERVAL_MS = 5_000;
|
|
184
|
-
let lastCheckMs = 0;
|
|
185
|
-
export function initPolicyReloader(policyPath, policy) {
|
|
186
|
-
cachedPolicyPath = resolve(policyPath);
|
|
187
|
-
cachedPolicyMtimeMs = statSync(cachedPolicyPath).mtimeMs;
|
|
188
|
-
cachedPolicy = policy;
|
|
189
|
-
}
|
|
190
|
-
export function reloadPolicyIfChanged() {
|
|
191
|
-
if (!cachedPolicyPath)
|
|
192
|
-
return cachedPolicy;
|
|
193
|
-
const now = Date.now();
|
|
194
|
-
if (now - lastCheckMs < RELOAD_CHECK_INTERVAL_MS)
|
|
195
|
-
return cachedPolicy;
|
|
196
|
-
lastCheckMs = now;
|
|
197
|
-
try {
|
|
198
|
-
const currentMtime = statSync(cachedPolicyPath).mtimeMs;
|
|
199
|
-
if (currentMtime !== cachedPolicyMtimeMs) {
|
|
200
|
-
cachedPolicy = loadPolicyFile(cachedPolicyPath);
|
|
201
|
-
cachedPolicyMtimeMs = currentMtime;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
catch {
|
|
205
|
-
// File may have been removed; keep using cached policy
|
|
206
|
-
}
|
|
207
|
-
return cachedPolicy;
|
|
208
|
-
}
|
|
209
|
-
export function checkPolicy(action, policy, confirmCategories) {
|
|
210
|
-
const category = getActionCategory(action);
|
|
211
|
-
// Internal actions are always allowed
|
|
212
|
-
if (category === '_internal')
|
|
213
|
-
return 'allow';
|
|
214
|
-
// Explicit deny takes precedence over confirmation
|
|
215
|
-
if (policy?.deny?.includes(category))
|
|
216
|
-
return 'deny';
|
|
217
|
-
// Check if this category requires confirmation
|
|
218
|
-
if (confirmCategories.has(category))
|
|
219
|
-
return 'confirm';
|
|
220
|
-
if (!policy)
|
|
221
|
-
return 'allow';
|
|
222
|
-
// Explicit allow list
|
|
223
|
-
if (policy.allow?.includes(category))
|
|
224
|
-
return 'allow';
|
|
225
|
-
return policy.default;
|
|
226
|
-
}
|
|
227
|
-
export function describeAction(action, command) {
|
|
228
|
-
const category = getActionCategory(action);
|
|
229
|
-
switch (action) {
|
|
230
|
-
case 'navigate':
|
|
231
|
-
return `Navigate to ${command.url}`;
|
|
232
|
-
case 'evaluate':
|
|
233
|
-
case 'evalhandle':
|
|
234
|
-
return `Evaluate JavaScript: ${String(command.script ?? '').slice(0, 80)}`;
|
|
235
|
-
case 'fill':
|
|
236
|
-
return `Fill ${command.selector}`;
|
|
237
|
-
case 'type':
|
|
238
|
-
return `Type into ${command.selector}`;
|
|
239
|
-
case 'click':
|
|
240
|
-
return `Click ${command.selector}`;
|
|
241
|
-
case 'dblclick':
|
|
242
|
-
return `Double-click ${command.selector}`;
|
|
243
|
-
case 'tap':
|
|
244
|
-
return `Tap ${command.selector}`;
|
|
245
|
-
case 'download':
|
|
246
|
-
return `Download via ${command.selector} to ${command.path}`;
|
|
247
|
-
case 'upload':
|
|
248
|
-
return `Upload files to ${command.selector}`;
|
|
249
|
-
default:
|
|
250
|
-
return `${category}: ${action}`;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
//# sourceMappingURL=action-policy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-policy.js","sourceRoot":"","sources":["../src/action-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,MAAM,iBAAiB,GAA2B;IAChD,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;IACnB,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,UAAU;IAEnB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,OAAO;IACjB,GAAG,EAAE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Ac,CAAC,MAAc,EAAE,OAAgC;IAC7E,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,UAAU;YACb,OAAO,eAAe,OAAO,CAAC,GAAG,EAAE,CAAC;QACtC,KAAK,UAAU,CAAC;QAChB,KAAK,YAAY;YACf,OAAO,wBAAwB,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAC7E,KAAK,MAAM;YACT,OAAO,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;QACpC,KAAK,MAAM;YACT,OAAO,aAAa,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzC,KAAK,OAAO;YACV,OAAO,SAAS,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrC,KAAK,UAAU;YACb,OAAO,gBAAgB,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC5C,KAAK,KAAK;YACR,OAAO,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;QACnC,KAAK,UAAU;YACb,OAAO,gBAAgB,OAAO,CAAC,QAAQ,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;QAC/D,KAAK,QAAQ;YACX,OAAO,mBAAmB,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC/C;YACE,OAAO,GAAG,QAAQ,KAAK,MAAM,EAAE,CAAC;IACpC,CAAC;AACH,CAAC"}
|
package/dist/actions.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { BrowserManager, ScreencastFrame } from './browser.js';
|
|
2
|
-
import type { Command, Response } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Set the callback for screencast frames
|
|
5
|
-
* This is called by the daemon to set up frame streaming
|
|
6
|
-
*/
|
|
7
|
-
export declare function setScreencastFrameCallback(callback: ((frame: ScreencastFrame) => void) | null): void;
|
|
8
|
-
/**
|
|
9
|
-
* Convert Playwright errors to AI-friendly messages
|
|
10
|
-
* @internal Exported for testing
|
|
11
|
-
*/
|
|
12
|
-
export declare function toAIFriendlyError(error: unknown, selector: string): Error;
|
|
13
|
-
export declare function initActionPolicy(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Execute a command and return a response
|
|
16
|
-
*/
|
|
17
|
-
export declare function executeCommand(command: Command, browser: BrowserManager): Promise<Response>;
|
|
18
|
-
//# sourceMappingURL=actions.d.ts.map
|
package/dist/actions.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqBpE,OAAO,KAAK,EACV,OAAO,EACP,QAAQ,EAsIT,MAAM,YAAY,CAAC;AAQpB;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC,GAAG,IAAI,GAClD,IAAI,CAEN;AAQD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAqDzE;AAKD,wBAAgB,gBAAgB,IAAI,IAAI,CAuBvC;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6CjG"}
|