849 Commits
Author SHA1 Message Date
Chris Tate 1b26ff886c Fix tab list command not recognizing new pages opened via clicks (#275)
## Summary

Fixed an issue where the `tab list` command couldn't recognize new pages that were opened externally (e.g., via `target="_blank"` links or popup windows). The problem occurred because context-level page tracking wasn't properly set up for all browser launch methods, causing new pages created outside of explicit `newTab()` calls to go untracked.

## Changes

- Added `setupContextTracking(context)` calls to `launch()`, `launchIncognito()`, and other context creation methods to ensure all contexts listen for new page events
- Added duplicate page checks (`!this.pages.includes(page)`) in `setupContextTracking()`, `newTab()`, and `launchIncognito()` to prevent the same page from being tracked multiple times
- Fixed `activePageIndex` calculation in `launch()` to properly set the active page index
- Enhanced comments to clarify that `setupContextTracking()` handles externally created pages (popups, new tabs from links)

## Implementation Details

The fix ensures that when a user clicks an element that opens a new tab/window, the browser context's 'page' event listener will automatically detect and track the new page. The duplicate prevention logic handles cases where both the context listener and manual page creation might try to add the same page.

Fixes #273
2026-01-26 01:25:49 -06:00
Chris Tate f862e2f7df Security: Reject cross-origin connections to daemon and stream server (#274) 2026-01-26 00:42:00 -06:00
RafaelandClaude Opus 4.5 fcee8f70d1 feat: add Kernel as cloud browser provider (#200)
Add Kernel (https://kernel.sh) as a third-party cloud browser provider,
following the same pattern as Browserbase and Browser Use integrations.

Features:
- Launch browser with `-p kernel` flag or `AGENT_BROWSER_PROVIDER=kernel`
- Configurable via environment variables:
  - KERNEL_API_KEY (required)
  - KERNEL_HEADLESS (default: false)
  - KERNEL_STEALTH (default: true)
  - KERNEL_TIMEOUT_SECONDS (default: 300)
  - KERNEL_PROFILE_NAME (optional, for persistent sessions)
- Profile find-or-create: automatically creates profile if it doesn't exist
- Profile persistence: cookies/logins saved back to profile on session close
- Uses raw fetch() calls for API communication (no SDK dependency)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 00:22:25 -06:00
Chris Tate a99f59cd20 Fix: check command hangs indefinitely (#272)
Fixes #257
2026-01-25 23:58:53 -06:00
Chris Tate 45506fbff0 Fix: set device does not apply deviceScaleFactor - HiDPI screenshots not possible (#270)
Fixes #255
2026-01-25 15:27:03 -06:00
shawn pana a22af0e675 generic placeholder for cloud browser provider (#260)
* docs: use generic placeholder for cloud browser provider

* docs: clarify available cloud browser providers
2026-01-25 13:55:29 -06:00
Chris Tate 79863a5180 Fix: CLI: state load / profile persistence not usable in v0.7.6 (#268)
* Fix: CLI: state load / profile persistence not usable in v0.7.6

This PR addresses issue #259

* Fix issues identified in code review
2026-01-25 13:45:17 -06:00
Chris Tate ae09fdd431 Add CLI flags for cookie URL, domain, path, httpOnly, secure, and expires (#266)
* Add CLI flags for cookie URL, domain, path, httpOnly, secure, and expires

Extends the `cookies set` command to support setting cookies with additional parameters before loading a page, solving authentication workflows where cookies need to be set for different domains.

**Key changes:**
- Added CLI flags: `--url`, `--domain`, `--path`, `--httpOnly`, `--secure`, `--sameSite`, `--expires`
- Added comprehensive test coverage for all new flags and combinations
- Updated help documentation with usage examples
- No daemon changes needed - it already supported these parameters

**Example usage:**
```bash
agent-browser cookies set session_id "abc123" --url https://app.example.com --httpOnly --secure
```

This allows setting cookies for a URL before opening the page, eliminating the need for workarounds in cross-domain authentication scenarios.

Fixes #261

* Update lock

* Fix compilation error
2026-01-25 11:53:49 -06:00
Zhiwei Li 53187a603c feat: add support for ignoring HTTPS certificate errors (#93)
* feat: add support for ignoring HTTPS certificate errors

* fix: update warning message for already running daemon to include ignore HTTPS errors option

* docs: add documentation for --ignore-https-errors option in README and SKILL.md

* feat: initialize ignore_https_errors flag in command context

* fix: change launch_cmd to mutable for cdp value handling
2026-01-24 23:54:33 -06:00
github-actions[bot]andgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 60534dfd63 chore: version packages (#243)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-23 23:44:31 -06:00
Chris Tate a4d0c2624b chore: add patch changeset for release (#242) 2026-01-23 23:40:05 -06:00
Zach Warunek 36ea8ecb55 fix: allow null selector in screenshot command schema (#236)
The screenshot command was failing with 'Validation error: selector: Expected string, received null' when only a path was provided (e.g., 'agent-browser screenshot ~/Desktop/test.png').

The Rust CLI serializes None values as null in JSON, but the Zod schema only allowed undefined (via .optional()), not null. Changed selector field to use .nullish() which accepts both null and undefined.

Fixes issue where screenshot command without selector fails validation.
2026-01-23 17:50:11 -06:00
github-actions[bot]andgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> d10fd2d545 chore: version packages (#233)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-23 15:59:36 -06:00
Chris Tate 8c2a6ec5d2 fix: handle existing GitHub releases in workflow (#232) 2026-01-23 15:55:18 -06:00
github-actions[bot]andgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> c0fd1be132 chore: version packages (#231)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-23 15:44:44 -06:00
Chris Tate 957b5e5994 fix: ensure binary is executable after npm install (#229) 2026-01-23 15:40:46 -06:00
github-actions[bot]andgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 65d4df84ac chore: version packages (#228)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-23 15:29:51 -06:00
Chris Tate 161d8f5c8d chore: add changeset for binary distribution fix (#227) 2026-01-23 15:25:53 -06:00
github-actions[bot]andgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> f3ed1be409 chore: version packages (#226)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-23 15:13:12 -06:00
Chris Tate 6afede28b3 chore: release v0.7.1 (#225)
Fix native binary distribution in npm package. Binaries are now built
before publishing to npm, ensuring all platforms work on installation.
2026-01-23 15:08:59 -06:00
Chris Tate 6f1c83de1b fix bin (#224) 2026-01-23 15:00:13 -06:00
Chris Tate 28129df124 fix docs (#223)
* fix: download artifacts to temp directory to avoid naming conflict

The download-artifact action creates directories named after each artifact.
When downloading to bin/, this caused conflicts because the artifact directory
names matched the binary names (e.g., bin/agent-browser-darwin-arm64/agent-browser-darwin-arm64).

Fix by downloading to artifacts/ first, then using find to move the binaries to bin/.

* fix docs
2026-01-23 13:51:23 -06:00
Chris Tate eb8325e9b4 fix: download artifacts to temp directory to avoid naming conflict (#221)
The download-artifact action creates directories named after each artifact.
When downloading to bin/, this caused conflicts because the artifact directory
names matched the binary names (e.g., bin/agent-browser-darwin-arm64/agent-browser-darwin-arm64).

Fix by downloading to artifacts/ first, then using find to move the binaries to bin/.
2026-01-23 13:15:51 -06:00
github-actions[bot]andgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 9281f46823 chore: version packages (#220)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-23 13:06:48 -06:00
Chris Tate 316e649740 chore: add changeset for v0.7.0 release (#219) 2026-01-23 13:00:24 -06:00
Chris Tate 35d345b2b4 v0.7.0 docs (#218)
* auto-release

* fixes

* fix secret name

* update provider flag

* v0.7.0 changelog
2026-01-23 12:49:40 -06:00
Chris Tate fff4312d16 update provider flag (#217)
* auto-release

* fixes

* fix secret name

* update provider flag
2026-01-23 11:41:17 -06:00
Chris Tate 57dc7602fc auto-release (#216)
* auto-release

* fixes

* fix secret name
2026-01-23 11:19:43 -06:00
TimWhiteandChris Tate ea17db8564 fix(cli): correct output messages for state load and path-based actions (#109)
* Add files via upload

fix(cli): correct output messages for state load and path-based actions

* Add files via upload

* Update output.rs

* fix crlf

---------

Co-authored-by: Chris Tate <chris@ctate.dev>
2026-01-22 10:43:27 -06:00
Yonatan f74924cd0c feat(skills): Add hierarchical structure with references and templates (#157)
* feat(skills): Add hierarchical structure with references and templates

Adds modular documentation and executable templates to the agent-browser skill
for better AI agent consumption and progressive disclosure.

## Added

### References (deep-dive documentation)
- `references/snapshot-refs.md` - Ref lifecycle, invalidation, troubleshooting
- `references/session-management.md` - Parallel sessions, state persistence
- `references/authentication.md` - Login flows, OAuth, 2FA patterns
- `references/video-recording.md` - Recording for debugging/docs
- `references/proxy-support.md` - Proxy configuration, geo-testing

### Templates (ready-to-use workflows)
- `templates/form-automation.sh` - Form filling with validation
- `templates/authenticated-session.sh` - Login once, reuse state
- `templates/capture-workflow.sh` - Content extraction with screenshots

## Modified
- `SKILL.md` - Added reference tables linking to new documentation

## Benefits
- Progressive disclosure: Load overview first, deep dives on demand
- Reduced context: Smaller chunks for better LLM token efficiency
- Ready workflows: Copy-paste templates for common patterns

* fix(templates): Make authenticated-session.sh runnable out-of-box

Addresses review feedback: login actions were commented but verification
wasn't, causing script to fail when run as-is.

New approach:
- DISCOVERY MODE runs first (shows form structure)
- LOGIN FLOW section is fully commented as a unit
- User runs once to see refs, then customizes

┌─────────────────────────────────────────────────────────────┐
│ LOGIN FORM STRUCTURE                                        │
├─────────────────────────────────────────────────────────────┤
│ @e1 [input type="email"]                                    │
│ @e2 [input type="password"]                                 │
│ @e3 [button] "Sign In"                                      │
└─────────────────────────────────────────────────────────────┘
2026-01-22 10:26:31 -06:00
Danila PoyarkovandChris Tate 9f3c3ad933 fix(screenshot): support refs and improve error messages (#141)
* fix(screenshot): support refs and improve error messages

* fix(cli): support selector argument in screenshot command

* Fix CSS class selectors being treated as file paths

* fix(test): update screenshot test assertions

---------

Co-authored-by: Chris Tate <chris@ctate.dev>
2026-01-22 10:06:38 -06:00
Márk Magyar c046de2ec7 docs: update agent-browser skill documentation (#164) 2026-01-22 09:26:54 -06:00
55f4eaa728 feat: add download CLI commands with ref support (#183)
* feat: add download and waitfordownload CLI commands

Add CLI support for the existing download functionality in the daemon:

- `download <selector> <path>`: Click an element to trigger download
  and save to specified path
- `wait --download [path] [--timeout ms]`: Wait for any download to
  complete, optionally save to path with configurable timeout

Includes comprehensive unit tests and help documentation.

* fix: download command ref support and output message

- Fix handleDownload to use browser.getLocator() for ref selector support
- Fix CLI output to show "Downloaded to" instead of "Screenshot saved"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Chris Tate <chris@ctate.dev>
2026-01-22 08:55:19 -06:00
Chris Tate 307f970d53 fix: support WebSocket URLs in connect command (#205)
* fix: support WebSocket URLs in connect command

* address feedback
2026-01-22 08:38:53 -06:00
Lindsey SimonandChris Tate 36cca10c10 Add --profile flag for persistent browser profiles (#68)
* Add --profile flag for persistent browser profiles

Adds support for persistent browser profiles that preserve cookies,
localStorage, and login sessions across browser restarts.

Changes:
- Add --profile <path> CLI flag (flags.rs)
- Add AGENT_BROWSER_PROFILE environment variable support
- Add profile field to LaunchCommand type (types.ts)
- Use launchPersistentContext when profile is specified (browser.ts)
- Update help text and README with documentation

Usage:
  agent-browser --profile ~/.myapp-profile open myapp.com

This enables AI agents to maintain authenticated sessions across
browser restarts without re-authenticating each time.

* Expand tilde in profile path to home directory

* fix: add missing profile field to test Flags struct

---------

Co-authored-by: Chris Tate <chris@ctate.dev>
2026-01-22 08:05:25 -06:00
Tom Dale c6a92a1472 docs: add Claude Code marketplace plugin installation instructions (#181)
Document the recommended way to install the agent-browser skill using the /plugin marketplace commands introduced in PR #106.
2026-01-22 01:44:06 -06:00
Shpeedle c4f66a5922 errors doc more descriptive (#190) 2026-01-22 01:25:46 -06:00
mmhiyokoandClaude Opus 4.5 946d236d9f fix: use ~/.agent-browser for socket files instead of TMPDIR (#180)
* fix: use ~/.agent-browser for socket files instead of TMPDIR

This fixes issue #163 where different TMPDIR values (common with
tmux/screen/VSCode/IntelliJ) caused the CLI and daemon to use
different socket paths.

Socket directory priority:
1. AGENT_BROWSER_SOCKET_DIR (explicit override)
2. $XDG_RUNTIME_DIR/agent-browser (Linux standard)
3. ~/.agent-browser (fallback, like Docker Desktop)

Both CLI (Rust) and daemon (Node.js) now use the same logic.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: session list now looks in correct socket directory

- Make get_socket_dir() public in connection.rs
- Update session list to use get_socket_dir() instead of temp_dir()
- Update pid file pattern from agent-browser-{session}.pid to {session}.pid
- Add tmpdir fallback to daemon.ts when homedir is unavailable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test: add unit tests for socket directory resolution

Add comprehensive tests for get_socket_dir/getSocketDir to verify:
- AGENT_BROWSER_SOCKET_DIR takes priority
- Empty strings are ignored (fixes Rust/TypeScript consistency)
- XDG_RUNTIME_DIR fallback works correctly
- Home directory fallback when env vars unset

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:15:25 -06:00
cb37630ccf fix: add .exe extension for Windows source binary path (#188)
The copy-native.js script was looking for 'agent-browser' but on Windows
the compiled binary is 'agent-browser.exe', causing the copy to fail.

Co-authored-by: jiazhuangai <jiazhuangai@example.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-01-22 01:11:13 -06:00
Chris Tate 61c004db94 add missing flag (#203)
* add missing flag

* clean up tests
2026-01-22 00:59:53 -06:00
OanakiajaandChris Tate 083a946aac feat: add browser launch --args, --user-agent, --proxy-bypass configuration support. (#35)
* feat: add browser launch args, user-agent, and proxy configuration support

* fix: User Agent env need added

* fix: command pass error

---------

Co-authored-by: Chris Tate <chris@ctate.dev>
2026-01-22 00:19:37 -06:00
RafaelandClaude Opus 4.5 e892bceadf feat: support remote CDP WebSocket URLs in --cdp flag (#99)
Previously, the --cdp flag only accepted a port number and connected via
http://localhost:{port}. This made it impossible to connect to remote
browser services like Kernel, Browserless, etc. that provide WebSocket URLs.

The --cdp flag now accepts either:
- A port number (e.g., 9222) for local connections
- A full WebSocket URL (e.g., wss://...) for remote browser services

Changes:
- Added cdpUrl field to LaunchCommand type
- Updated protocol validation to accept URL format with scheme validation
- Modified connectViaCDP to detect and handle both formats
- Handle numeric strings for JSON serialization edge cases
- Updated CLI to send cdpUrl or cdpPort based on input format
- Updated README with examples for remote connections

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 21:11:14 -06:00
Aitor c4139fa389 feat: add Browser Use cloud browser as available provider (#138)
* feat: add Browser Use cloud browser
  integration

* feat: enhance Browser Use integration with provider flag support

- Updated README to reflect new usage instructions for enabling Browser Use with the `-p` flag.
- Modified CLI to parse and handle the `-p` flag for specifying the provider.
- Implemented logic in the main application to launch with the specified cloud provider.
- Adjusted BrowserManager to connect to Browser Use based on the provider flag or environment variable.
- Updated types and protocol schemas to include provider information.

* feat: add validation for mutually exclusive CLI options

- Implemented checks to prevent the use of both --cdp and --provider flags simultaneously.
- Added validation to ensure --extension cannot be used with the --provider flag.
- Enhanced error handling to provide clear feedback in both JSON and console output formats.
2026-01-21 18:01:19 -06:00
Paul KleinandKylejeong2 7123d46e7f Add Browserbase support for remote browser over CDP (#3)
* Add Browserbase support for remote browser over CDP

When BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID env vars are set,
connect to a Browserbase session via CDP instead of launching a local browser.

* Update URLs to browserbase repo

* Add Browserbase support for remote browser over CDP

When BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID env vars are set,
connect to a Browserbase session via CDP instead of launching a local browser.

* Update link to Browserbase Dashboard in README

* bump browserbase sdk to latest version

* remove sdk as a dep

* change name back to vercel labs

* added try catch blocks, functions to close session

* revert package names

* remove extra if statement

---------

Co-authored-by: Kylejeong2 <kylejeong21@gmail.com>
2026-01-21 17:49:21 -06:00
Chris Tate 399fd7a434 v0.6.0 changelog (#154) 2026-01-18 11:44:56 -06:00
Chris Tate 62f9b4dd6b chore: bump version to 0.6.0 (#153) 2026-01-18 11:37:26 -06:00
Chris Tate 818d9fa95e format code (#152) v0.6.0 2026-01-18 11:21:28 -06:00
Kye Burchard a8dcbb1222 feat: add connect command for persistent CDP sessions (#127)
Adds a `connect <port>` command that establishes a CDP connection
to a running browser. The daemon remembers the connection, so
subsequent commands work without needing --cdp on every call.

Example:
  agent-browser connect 9222
  agent-browser snapshot  # works without --cdp
  agent-browser tab
  agent-browser close
2026-01-18 10:54:12 -06:00
Mikhail Beliakovvercel[bot] <35613825+vercel[bot]@users.noreply.github.com>google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
a9fcef4579 fix: support libasound2t64 on newer Ubuntu versions (#112)
* fix: support libasound2t64 on newer Ubuntu versions

Updates the install logic to check if `libasound2t64` is available using
`apt-cache` before falling back to `libasound2`. This fixes installation
on Ubuntu 24.04 and other systems affected by the 64-bit time_t transition.

* Update cli/src/install.rs

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2026-01-18 10:50:57 -06:00
Zhiwei Li 59baf97e51 fix: allow additional URL schemes in parse_command function (#125)
* fix: allow additional URL schemes in parse_command function

* fix: enhance URL validation in parse_command function to support lowercase schemes
2026-01-18 10:36:38 -06:00