* dashboard * fix: re-apply download behavior on recording context (#1019) * fix: re-apply download behavior on recording context record start creates a new browser context via Target.createBrowserContext. Browser.setDownloadBehavior called at launch only applies to the default context, so downloads in the recording context are silently dropped. Fix: 1. Store download_path on BrowserManager (from LaunchOptions) 2. After creating the recording context, call Browser.setDownloadBehavior with the new browserContextId This ensures downloads work during recording. Fixes #1018 * fix: add download_path to third BrowserManager constructor (auto_connect_cdp) * fix: reap zombie Chrome process and fast-detect crash for auto-restart (#1023) When Chrome crashes (e.g. SIGTRAP from CHECK() assertion), the daemon now: 1. Reaps the zombie immediately via a SIGCHLD handler in the event loop that calls waitpid(-1, WNOHANG) 2. Detects the crash instantly on the next command via a non-blocking try_wait() check (has_process_exited), avoiding the 3-second CDP timeout that is_connection_alive() would incur 3. Auto-relaunches Chrome transparently for the caller Fixes #1017 Co-authored-by: ctate <366502+ctate@users.noreply.github.com> * fix: route keyboard type through text input (#1014) * fix: handle --clear flag in console command (#1015) The console and errors commands parsed --clear from CLI args but the action handlers silently ignored the flag. The handlers did not accept the cmd parameter so they had no way to read the clear field. Changes: - Add clear_console() method to EventTracker in network.rs - Update handle_console to accept cmd, read the clear field, and clear the buffer when --clear is passed (returns {cleared: true}) - Update call site in execute_command to pass cmd Co-authored-by: xuyongliang <yongliang.xyl@alibaba-inc.com> * chore: patch release - ### Bug Fixes - **Re-apply download behavior on r... (#1025) * Add runtime stream enable/disable/status commands (#951) * Add runtime stream management commands * Run rustfmt and satisfy clippy * Fix stream disable cleanup semantics * Format stream disable regression tests * fix: retain radio/checkbox elements in compact snapshot tree (#1008) compact_tree() checked for "[ref=" to identify lines worth keeping, but radio and checkbox elements render as e.g. [checked=false, ref=e1] where the "[" opens before "checked=", not "ref=". Dropping the leading bracket so the check is just "ref=" fixes the match for all elements with refs. Fixes #1006 Co-authored-by: ctate <366502+ctate@users.noreply.github.com> * chore: version packages (#1027) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fixes * dashboard * fixes * remove observe * fmt * fixes * fixes * jotai * fmt * upload dashboard --------- Co-authored-by: Stefan Smiljkovic <stefan@vanila.io> Co-authored-by: ctate <366502+ctate@users.noreply.github.com> Co-authored-by: zhanba <c5e1856@gmail.com> Co-authored-by: xuyongliang <478439790@qq.com> Co-authored-by: xuyongliang <yongliang.xyl@alibaba-inc.com> Co-authored-by: Thomas Kosiewski <thoma471@googlemail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
199 lines
10 KiB
Plaintext
199 lines
10 KiB
Plaintext
# Configuration
|
|
|
|
Create an `agent-browser.json` file to set persistent defaults instead of repeating flags on every command.
|
|
|
|
## Config File Locations
|
|
|
|
agent-browser checks two locations, merged in priority order:
|
|
|
|
<table>
|
|
<thead>
|
|
<tr><th>Priority</th><th>Location</th><th>Scope</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td>1 (lowest)</td><td><code>~/.agent-browser/config.json</code></td><td>User-level defaults</td></tr>
|
|
<tr><td>2</td><td><code>./agent-browser.json</code></td><td>Project-level overrides</td></tr>
|
|
<tr><td>3</td><td><code>AGENT_BROWSER_*</code> env vars</td><td>Override config values</td></tr>
|
|
<tr><td>4 (highest)</td><td>CLI flags</td><td>Override everything</td></tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
Project-level values override user-level values. Environment variables override both. CLI flags always win.
|
|
|
|
Use `--config <path>` or the `AGENT_BROWSER_CONFIG` environment variable to load a specific config file instead of the default locations:
|
|
|
|
```bash
|
|
agent-browser --config ./ci-config.json open example.com
|
|
AGENT_BROWSER_CONFIG=./ci-config.json agent-browser open example.com
|
|
```
|
|
|
|
## Example Config
|
|
|
|
```json
|
|
{
|
|
"headed": true,
|
|
"proxy": "http://localhost:8080",
|
|
"profile": "./browser-data",
|
|
"userAgent": "my-agent/1.0",
|
|
"ignoreHttpsErrors": true
|
|
}
|
|
```
|
|
|
|
## All Options
|
|
|
|
Every CLI flag can be set in the config file using its camelCase equivalent:
|
|
|
|
<table>
|
|
<thead>
|
|
<tr><th>Config Key</th><th>CLI Flag</th><th>Type</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td><code>headed</code></td><td><code>--headed</code></td><td>boolean</td></tr>
|
|
<tr><td><code>json</code></td><td><code>--json</code></td><td>boolean</td></tr>
|
|
<tr><td><code>full</code></td><td><code>--full, -f</code></td><td>boolean</td></tr>
|
|
<tr><td><code>debug</code></td><td><code>--debug</code></td><td>boolean</td></tr>
|
|
<tr><td><code>session</code></td><td><code>--session</code></td><td>string</td></tr>
|
|
<tr><td><code>sessionName</code></td><td><code>--session-name</code></td><td>string</td></tr>
|
|
<tr><td><code>executablePath</code></td><td><code>--executable-path</code></td><td>string</td></tr>
|
|
<tr><td><code>extensions</code></td><td><code>--extension</code></td><td>string[]</td></tr>
|
|
<tr><td><code>profile</code></td><td><code>--profile</code></td><td>string</td></tr>
|
|
<tr><td><code>state</code></td><td><code>--state</code></td><td>string</td></tr>
|
|
<tr><td><code>proxy</code></td><td><code>--proxy</code></td><td>string</td></tr>
|
|
<tr><td><code>proxyBypass</code></td><td><code>--proxy-bypass</code></td><td>string</td></tr>
|
|
<tr><td><code>args</code></td><td><code>--args</code></td><td>string</td></tr>
|
|
<tr><td><code>userAgent</code></td><td><code>--user-agent</code></td><td>string</td></tr>
|
|
<tr><td><code>provider</code></td><td><code>-p, --provider</code></td><td>string</td></tr>
|
|
<tr><td><code>device</code></td><td><code>--device</code></td><td>string</td></tr>
|
|
<tr><td><code>ignoreHttpsErrors</code></td><td><code>--ignore-https-errors</code></td><td>boolean</td></tr>
|
|
<tr><td><code>allowFileAccess</code></td><td><code>--allow-file-access</code></td><td>boolean</td></tr>
|
|
<tr><td><code>cdp</code></td><td><code>--cdp</code></td><td>string</td></tr>
|
|
<tr><td><code>autoConnect</code></td><td><code>--auto-connect</code></td><td>boolean</td></tr>
|
|
<tr><td><code>colorScheme</code></td><td><code>--color-scheme</code></td><td>string (<code>dark</code>, <code>light</code>, <code>no-preference</code>)</td></tr>
|
|
<tr><td><code>downloadPath</code></td><td><code>--download-path</code></td><td>string</td></tr>
|
|
<tr><td><code>contentBoundaries</code></td><td><code>--content-boundaries</code></td><td>boolean</td></tr>
|
|
<tr><td><code>maxOutput</code></td><td><code>--max-output</code></td><td>number</td></tr>
|
|
<tr><td><code>allowedDomains</code></td><td><code>--allowed-domains</code></td><td>string[]</td></tr>
|
|
<tr><td><code>actionPolicy</code></td><td><code>--action-policy</code></td><td>string</td></tr>
|
|
<tr><td><code>confirmActions</code></td><td><code>--confirm-actions</code></td><td>string</td></tr>
|
|
<tr><td><code>confirmInteractive</code></td><td><code>--confirm-interactive</code></td><td>boolean</td></tr>
|
|
<tr><td><code>engine</code></td><td><code>--engine</code></td><td>string (<code>chrome</code>, <code>lightpanda</code>)</td></tr>
|
|
<tr><td><code>headers</code></td><td><code>--headers</code></td><td>string (JSON)</td></tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
## Common Configurations
|
|
|
|
### Local Development
|
|
|
|
```json
|
|
{
|
|
"headed": true,
|
|
"profile": "./browser-data"
|
|
}
|
|
```
|
|
|
|
### Behind a Proxy
|
|
|
|
```json
|
|
{
|
|
"proxy": "http://proxy.corp.example.com:8080",
|
|
"proxyBypass": "localhost,*.internal.com",
|
|
"ignoreHttpsErrors": true
|
|
}
|
|
```
|
|
|
|
### CI / Devcontainer
|
|
|
|
```json
|
|
{
|
|
"args": "--no-sandbox,--disable-gpu",
|
|
"ignoreHttpsErrors": true
|
|
}
|
|
```
|
|
|
|
### iOS Testing
|
|
|
|
```json
|
|
{
|
|
"provider": "ios",
|
|
"device": "iPhone 16 Pro"
|
|
}
|
|
```
|
|
|
|
### AI Agent Security
|
|
|
|
```json
|
|
{
|
|
"contentBoundaries": true,
|
|
"maxOutput": 50000,
|
|
"allowedDomains": ["your-app.com", "*.your-app.com"],
|
|
"actionPolicy": "./policy.json"
|
|
}
|
|
```
|
|
|
|
## Overriding Boolean Options
|
|
|
|
Boolean flags accept an optional `true`/`false` value to override config settings:
|
|
|
|
```bash
|
|
agent-browser --headed false open example.com
|
|
```
|
|
|
|
A bare flag is equivalent to passing `true`:
|
|
|
|
```bash
|
|
agent-browser --headed open example.com # same as --headed true
|
|
agent-browser --headed true open example.com # explicit
|
|
```
|
|
|
|
This applies to all boolean flags: `--headed`, `--debug`, `--json`, `--ignore-https-errors`, `--allow-file-access`, `--auto-connect`, `--content-boundaries`, `--confirm-interactive`.
|
|
|
|
## Extensions Merging
|
|
|
|
Extensions from user-level and project-level configs are **concatenated**, not replaced. For example, if `~/.agent-browser/config.json` specifies `["/ext1"]` and `./agent-browser.json` specifies `["/ext2"]`, the result is `["/ext1", "/ext2"]`.
|
|
|
|
The `AGENT_BROWSER_EXTENSIONS` environment variable and CLI `--extension` flags follow the standard priority rules (env replaces config, CLI appends).
|
|
|
|
## Environment Variables
|
|
|
|
These environment variables configure additional daemon and runtime behavior:
|
|
|
|
<table>
|
|
<thead>
|
|
<tr><th>Variable</th><th>Description</th><th>Default</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td><code>AGENT_BROWSER_AUTO_CONNECT</code></td><td>Auto-discover and connect to a running Chrome instance.</td><td>(disabled)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_ALLOW_FILE_ACCESS</code></td><td>Allow <code>file://</code> URLs to access local files.</td><td>(disabled)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_COLOR_SCHEME</code></td><td>Color scheme preference (<code>dark</code>, <code>light</code>, <code>no-preference</code>).</td><td>(none)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_DOWNLOAD_PATH</code></td><td>Default directory for browser downloads.</td><td>(temp directory)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_DEFAULT_TIMEOUT</code></td><td>Default timeout in ms. Keep below 30000 to avoid IPC timeouts.</td><td><code>25000</code></td></tr>
|
|
<tr><td><code>AGENT_BROWSER_SESSION_NAME</code></td><td>Auto-save/load state persistence name.</td><td>(none)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_STATE_EXPIRE_DAYS</code></td><td>Auto-delete saved session states older than N days.</td><td><code>30</code></td></tr>
|
|
<tr><td><code>AGENT_BROWSER_ENCRYPTION_KEY</code></td><td>64-char hex key for AES-256-GCM session encryption.</td><td>(none)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_EXTENSIONS</code></td><td>Comma-separated browser extension paths. Extensions work in both headed and headless mode.</td><td>(none)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_HEADED</code></td><td>Show browser window instead of running headless (<code>1</code> to enable).</td><td>(disabled)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_STREAM_PORT</code></td><td>Override the WebSocket streaming port. By default, an OS-assigned port is used. Set this to bind to a specific port (e.g., <code>9223</code>).</td><td>OS-assigned</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_IDLE_TIMEOUT_MS</code></td><td>Auto-shutdown the daemon after N ms of inactivity (no commands received). Useful for ephemeral environments.</td><td>(disabled)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_IOS_DEVICE</code></td><td>Default iOS device name for the <code>ios</code> provider.</td><td>(none)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_IOS_UDID</code></td><td>Default iOS device UDID for the <code>ios</code> provider.</td><td>(none)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_DEBUG</code></td><td>Enable debug output (<code>1</code> to enable).</td><td>(disabled)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_CONTENT_BOUNDARIES</code></td><td>Wrap page output in boundary markers for LLM safety.</td><td>(disabled)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_MAX_OUTPUT</code></td><td>Max characters for page output (truncates beyond limit).</td><td>(unlimited)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_ALLOWED_DOMAINS</code></td><td>Comma-separated allowed domain patterns (e.g., <code>example.com,*.example.com</code>).</td><td>(unrestricted)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_ACTION_POLICY</code></td><td>Path to action policy JSON file.</td><td>(none)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_CONFIRM_ACTIONS</code></td><td>Comma-separated action categories requiring confirmation.</td><td>(none)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_CONFIRM_INTERACTIVE</code></td><td>Enable interactive confirmation prompts (auto-denies if stdin is not a TTY).</td><td>(disabled)</td></tr>
|
|
<tr><td><code>AGENT_BROWSER_ENGINE</code></td><td>Browser engine to use: <code>chrome</code> (default), <code>lightpanda</code>.</td><td><code>chrome</code></td></tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
## Error Handling
|
|
|
|
- **Auto-discovered config files** (`~/.agent-browser/config.json`, `./agent-browser.json`) that are missing are silently ignored.
|
|
- **`--config <path>`** with a missing or malformed file exits with an error.
|
|
- **Malformed JSON** in auto-discovered files prints a warning to stderr and continues without that file.
|
|
- **Unknown keys** are silently ignored for forward compatibility.
|
|
|
|
> **Tip:** If your project-level `agent-browser.json` contains environment-specific values (paths, proxies), consider adding it to `.gitignore`.
|