Add AI chat to dashboard, refactor stream module, snapshot --urls, batch argument mode (#1160)

* chat

* refactor

* fixes

* fixes

* fixes

* fixes

* improvements

* download chat

* batch

* fixes

* fixes

* fixes

* fmt

* fixes

* fixes

* fixes

* fmt
This commit is contained in:
Chris Tate
2026-04-06 08:10:43 -05:00
committed by GitHub
parent fcb6615f5a
commit 317e6869b6
44 changed files with 4933 additions and 1957 deletions
+25 -7
View File
@@ -203,21 +203,24 @@ agent-browser wait "#spinner" --state hidden
### Batch Execution
Execute multiple commands in a single invocation by piping a JSON array of
string arrays to `batch`. This avoids per-command process startup overhead
when running multi-step workflows.
Execute multiple commands in a single invocation. Commands can be passed as
quoted arguments or piped as JSON via stdin. This avoids per-command process
startup overhead when running multi-step workflows.
```bash
# Pipe commands as JSON
# Argument mode: each quoted argument is a full command
agent-browser batch "open https://example.com" "snapshot -i" "screenshot"
# With --bail to stop on first error
agent-browser batch --bail "open https://example.com" "click @e1" "screenshot"
# Stdin mode: pipe commands as JSON
echo '[
["open", "https://example.com"],
["snapshot", "-i"],
["click", "@e1"],
["screenshot", "result.png"]
]' | agent-browser batch --json
# Stop on first error
agent-browser batch --bail < commands.json
```
### Clipboard
@@ -548,6 +551,7 @@ The `snapshot` command supports filtering to reduce output size:
```bash
agent-browser snapshot # Full accessibility tree
agent-browser snapshot -i # Interactive elements only (buttons, inputs, links)
agent-browser snapshot -i --urls # Interactive elements with link URLs
agent-browser snapshot -c # Compact (remove empty structural elements)
agent-browser snapshot -d 3 # Limit depth to 3 levels
agent-browser snapshot -s "#main" # Scope to CSS selector
@@ -557,6 +561,7 @@ agent-browser snapshot -i -c -d 5 # Combine options
| Option | Description |
| ---------------------- | ----------------------------------------------------------------------- |
| `-i, --interactive` | Only show interactive elements (buttons, links, inputs) |
| `-u, --urls` | Include href URLs for link elements |
| `-c, --compact` | Remove empty structural elements |
| `-d, --depth <n>` | Limit tree depth |
| `-s, --selector <sel>` | Scope to CSS selector |
@@ -650,6 +655,19 @@ The dashboard displays:
- **Activity feed** -- chronological command/result stream with timing and expandable details
- **Console output** -- browser console messages (log, warn, error)
- **Session creation** -- create new sessions from the UI with local engines (Chrome, Lightpanda) or cloud providers (AgentCore, Browserbase, Browserless, Browser Use, Kernel)
- **AI Chat** -- chat with an AI assistant directly in the dashboard (requires Vercel AI Gateway configuration)
### AI Chat
The dashboard includes an optional AI chat panel powered by the Vercel AI Gateway. Set these environment variables to enable it:
```bash
export AI_GATEWAY_API_KEY=gw_your_key_here
export AI_GATEWAY_MODEL=anthropic/claude-sonnet-4.6 # optional, this is the default
export AI_GATEWAY_URL=https://ai-gateway.vercel.sh # optional, this is the default
```
The Chat tab is always visible in the dashboard. When `AI_GATEWAY_API_KEY` is set, the Rust server proxies requests to the gateway and streams responses back using the Vercel AI SDK's UI Message Stream protocol. Without the key, sending a message shows an error inline.
## Configuration