* ci: speed up Rust builds, caching, and native E2E tests
CI currently spends ~28 minutes per push to main because test binaries compile with release optimization and thin LTO, build.rs generates 16,639 lines of unused CDP types, 16 integration test files link as separate binaries, macOS targets share one rust-cache key, and native E2E tests run serially behind unit tests with hardcoded 30s wedge timeouts.
Changes:
- Remove unused cdp_generated.rs codegen from cli/build.rs, cli/src/native/cdp/types.rs, and unused build-dependencies from cli/Cargo.toml.
- Add [profile.ci-test] (dev-derived with line-tables-only debuginfo and opt-level 3 for image/png) and use it with RUST_MIN_STACK=8388608 across Rust CI test jobs.
- Merge the 16 cli/tests/*.rs integration binaries into cli/tests/cli_integration/main.rs so they link once.
- Add test-only AGENT_BROWSER_TEST_CDP_TIMEOUT_MS and AGENT_BROWSER_TEST_PROBE_TIMEOUT_MS overrides with a unit test pinning the 30s and 3000ms production defaults.
- Create ~/.agent-browser/.encryption-key atomically in auth.rs so parallel E2E processes cannot clobber the key on first run.
- Split Rust Lint into its own parallel job, remove serial needs chains on native-e2e, windows-integration, and global-install, fix Swatinem/rust-cache target/shared keys, and run native E2E via cargo-nextest with 4 parallel processes.
* ci: run e2e_recording tests exclusively in cargo-nextest
Screencast recording tests spawn ffmpeg and assert captured motion frames during drags. Running them concurrently with other Chrome E2E tests on a 4-vCPU runner can starve frame capture. Reserve all test threads for e2e_recording tests while keeping the rest of the E2E suite 4-way parallel.
* ci: run Firefox e2e tests serially in cargo-nextest
Firefox e2e tests are marked to run serially and fail timing and cleanup assertions under 4-way concurrency on a 4-vCPU runner. Pass --test-threads 1 to the Firefox e2e step and reserve all test threads for e2e_firefox in nextest.toml.
* feat(firefox): dashboard live view, bidi module and docs
Squashed during the stack rebase onto main.
* docs(firefox): drop set device from the supported list
set device errors on Firefox, and the README and core skill already say it is unsupported.
* test(stream): use an array for the cached tabs fixture
clippy --all-targets flags the vec! as useless_vec; the test only slices it.
* fix(firefox): switch to tabs the page opens
target=_blank links and window.open left agent-browser on the old tab while Chrome follows the popup. Contexts BiDi reports with an originalOpener now become the active tab, and refs reset whenever drained events change it.
* fix(firefox): complete native HTML5 drag gestures
* fix(firefox): read the active page through BiDi
* fix(firefox): retain HAR request bodies and elapsed time
* fix(firefox): complete HTML5 drags with DOM events
* Preserve proxy settings rollback after Firefox launch failures
* Format Firefox proxy rollback regression
* Preserve Firefox and streaming documentation expectations
* fix(firefox): preserve dashboard input modifiers
* fix(firefox): restore popup openers and clear stale frames
* fix: align regression tests with integrated browser code
* style: format integrated Firefox regressions
* fix: correct docs fixtures and bound popup regression waits
* fix: apply the engine docs fixture edit once
* fix(firefox): verify restore recovery and document capture limits
* fix(firefox): preserve CLI titles while bounding tab lookups
* style: format bounded tab lookup
* test(firefox): accept the command deadline for idle waits
* test(firefox): match the clarified attach error before attach support
* ci: run pull request checks for stacked branches
* test(firefox): use the current daemon stream constructor
* test(firefox): cover selectors shared by light and shadow roots
* fix(firefox): resolve shadow refs through exact DOM ancestry
* Fix the BiDi client path in the pointer rejection test
* Remove duplicate Firefox dialog regression
* Skip unreadable Firefox frames during state save
* Format the unreadable-frame regression
* Remove the unused RDP dispatcher dependency
* Restore the owning tab when an iframe popup closes
* Format the request scope regression
* Fix renamed module references in request scope tests
* Keep stale-ref checks tied to the snapshot document
* Format snapshot document tracking
* Adapt pointer checks and snapshot tracking to BiDi APIs
* Return the snapshot result after recording its document
* Apply RDP reply matching in the renamed module
* Fail closed after a Firefox DevTools timeout
* Format fail-closed RDP timeout assertions
* Keep standard RDP replies after fail-closed timeouts
* Remove duplicate DevTools initialization after merge
* test(bidi): restore unit tests dropped when the Firefox modules moved
38 tests were lost in the move from firefox/ to bidi/. Restore them, porting the touch tap and stale-ref recovery tests to the new Origin and document-identity APIs.
* docs: drop the stale browser engine edit from the commands fixture
The page already lists firefox, so the edit no longer applies and the docs contract test fails on the missing anchor.
* docs: keep one engine-list edit for the commands page
The fixture listed the same replacement twice, so the second pass failed. Keep a single entry and leave the baseline untouched, so the route contract sees the Firefox engine list.
* docs: record the Firefox engine in the configuration fixture
The env table row changed with the engine list, so the route contract needs the matching edit.
* docs: cover the plain-text configuration sample in the fixture
The rendered sample and the table markup carry the engine list in different forms, so both need the edit.
* fix(firefox): give the dashboard live view one owner
With streaming enabled, every Firefox command asked the browser for the
tab tree and each tab's title, whether or not a dashboard was
connected, and the frame poller awaited each screenshot inline with a
30 s timeout, so one unresponsive tab stalled commands and froze prompt
tracking.
The poller is now the only code that talks to Firefox for the
dashboard and the only writer of frames, viewport status, the tab list
and the paused state. It is started once per session, works only while
a client is connected, runs captures and tab reads as child tasks with
2 s timeouts, and learns about tab changes through one watch channel.
The command path sends no BiDi request for the stream.
Dashboards now get a tab list within one poll interval of a command
instead of immediately.
* fix(firefox): start a new dashboard poller for each Firefox session
The poller was created once and reused for whatever session came next.
It listens to one session's events and stops when that session's
socket closes, so after Firefox exited and the session was relaunched,
dashboards got no frames.
A poller now knows which session it serves, and a session it does not
serve gets its own.
* fix(firefox): round live-view wheel input and reject connect
Firefox takes only integers for a wheel scroll, so a trackpad's
fractional deltas were rejected and live-view scrolling did nothing.
The wheel builder now rounds the position and deltas for every caller.
`connect` with `--engine firefox` attached to Chrome over CDP because
the engine was set by the settings patch and dropped by the launch
patch. The launch patch now carries it, so `connect` is rejected like
`--cdp`. The docs no longer say it drives Chrome.
* fix(stream): serve /api/tabs only to same-origin and local requests
A session's HTTP server returned its cached tab titles and URLs from
`/api/tabs` with a wildcard CORS header and no check of the request, so
any page that could reach the loopback port could read them. Firefox
sessions now fill that cache too.
`/api/tabs` is served only when the request's `Origin` names the same
loopback authority as `Host`, or when there is no `Origin` and `Host` is
a loopback authority, which also stops a DNS-rebinding page. Other
requests get 403. The response no longer carries the wildcard header; a
same-origin request gets its own origin reflected.
The dashboard reads tabs through its server-side proxy, which sends a
loopback `Host` and no `Origin`, so it is unaffected.
* test(firefox): point the stalled-tab test at the bidi module
The merge from laf/bidi-network-emulation brought in a test that still
named the firefox module, which this branch renames to bidi.
* fix(firefox): cap live view frames and validate options before a relaunch closes Firefox
AGENT_BROWSER_STREAM_MAX_WIDTH and AGENT_BROWSER_STREAM_MAX_HEIGHT did
nothing on Firefox, which captures frames at the viewport size. Frames
larger than the cap are now scaled down in proportion before they are
published.
A relaunch closed the running Firefox and only then checked the new
settings, so an option Firefox rejects cost the open pages. The settings
are now checked first, and a rejected option leaves the browser open.
* refactor(firefox): drop duplicate live view tests, helpers and docs
Removes a copied upload helper, two forwarding accessors, tests that
repeat another test's assertions, and docs passages that repeat the
Firefox engine page. No behaviour change.
* test(firefox): give the idle live view test a session that already collects bodies
A dashboard turns request tracking on, so the session adds its body
collector on the first command. The test asserts an idle live view asks
Firefox for nothing, so its session now starts with the collector in
place.
* test(firefox): restore the connect test and two docs passages
The cleanup removed the only test that drives the explicit launch
command with a CDP target into the Firefox check, the Obscura sentence
saying later commands keep the engine, and the guidance on when to
choose Firefox. None of the three is stated or tested anywhere else.
* docs(firefox): note auth challenges, closed shadow roots and transformed iframes
Firefox now cancels an auth challenge it has no credentials for, so the guide says what the page shows and how to authenticate. It also names two limits: controls in closed shadow roots cannot be acted on, and pointer commands can miss inside an iframe with a CSS transform.
* docs(firefox): state that the Windows DevTools port is open to local accounts
On Windows the daemon can only give Firefox's DevTools server a loopback
TCP port, and Firefox has no way to restrict it to one account or
authenticate its clients. The Firefox page now says so and tells readers
to use the engine on Windows only where they trust every local account.
* Take the relaunch validation from laf/bidi-network-emulation before merging it
Brings in the base branch's launch validation hunks as they are so the merge that follows is conflict-free; the next commit reconciles them with this branch's validate_firefox_launch.
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
* Bring in laf/bidi-network-emulation's relaunch validation and snapshot hint fixes
Content of merging laf/bidi-network-emulation, with the relaunch pre-check reconciled with this branch's validate_firefox_launch and the Firefox hint pass carried to bidi/snapshot.rs. Pushed as a single commit because the signed-commit rule and GitHub's merge endpoint (no rename detection for firefox/ to bidi/) leave no way to push the two-parent merge from here. Running git merge -s ours origin/laf/bidi-network-emulation records the ancestry without changing the tree.
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
* fix(firefox): record the pointer position from the browser, not from page scripts
The pointer position is kept in top-level coordinates and later used by coordinate-free mouse commands. It was built from two values computed in the page's own realm: the element's point inside its frame, and a frame offset read through window.frameElement and window.parent, with a page-reported flag that skipped the browser-based mapping. A cross-origin iframe can redefine all of those, so hovering one of its refs could leave the pointer on a control in the parent, and the next mouse down and up would press it.
The point inside the frame is now read in the isolated sandbox, and every frame hop is mapped from the browser's context tree and a verified frame handle read in the parent's sandbox. The page-realm mapper and the DOM-scanning mapper are gone, and the click path shares the frame lookup. The viewport edge used to plan the pointer path is read in the sandbox too.
Adds a unit test where the page answers every call in its own realm with coordinates aimed at a parent control; the recorded position must still come from the sandbox and the frame handle.
* fix(console): bound the console and page error history by memory, not only by count
The tracker kept the latest 1,000 console messages and 1,000 page errors whatever their size, so a page that logged multi-megabyte messages could grow the daemon by gigabytes. Both engines feed it, and Firefox now subscribes to page logs at launch.
The tracker now cuts each message or error to 64 KiB of text, marked with the number of bytes cut, replaces console arguments over 64 KiB with a note, and drops the oldest entries once the console messages, or the page errors, hold about 8 MiB. One bounded store handles both lists and the lists are read-only outside it. Callers pass arguments by reference, so an oversized value is never copied first.
With a page logging 3 MiB messages, the daemon held 447 MiB on Firefox and 792 MiB on Chrome before, and 73 MiB and 193 MiB after. The console command returned 198 MB and 314 MB before, and about 4 MB and 6.5 MB after.
Adds unit tests for the cut, the note, the byte bound with oldest-first eviction, and page errors. The limits are documented in the console and errors help, the debugging page and the command reference.
* fix(firefox): serve fresh /api/tabs for Firefox sessions without a WebSocket client
- Add a single-flight on-demand tab refresh channel from GET /api/tabs to the active Firefox poller when no WebSocket dashboard client is connected
- Clear cached tabs when attaching a new Firefox BiDi client so stale Chrome tabs are not served
- Keep idle Firefox sessions free of background polling when neither a WebSocket client nor /api/tabs requests tabs
* test(firefox): accept default-denied geolocation before granting in loaded iframe E2E
* docs(firefox): note that closed shadow root refs are actionable
* Align actions.rs, bidi/client.rs and bidi/forms.rs ahead of laf/bidi-network-emulation merge
* Temporarily align renamed firefox/ paths ahead of laf/bidi-network-emulation merge
* Resolve merge, sync dashboard live view on pin changes, and document Firefox form commands
Resolve the merge of laf/bidi-network-emulation across actions.rs and cli/src/native/bidi/.
Reconcile the dashboard Firefox live target at command and tick boundaries so disabling --pin-tab after a closed pinned tab re-points dashboard input and live frames to the surviving tab.
Document shared Firefox form prechecks, warnings, select --by, and check behavior in firefox.mdx, commands.mdx, skill-data/core/references/commands.md, CLI help, and MCP tool descriptions.
---------
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
* feat(firefox): add WebDriver BiDi and DevTools protocol clients
Small clients for the two protocols the Firefox engine uses: BiDi over
WebSocket and Firefox's DevTools protocol (length-prefixed JSON over a
unix socket or loopback TCP). Covered by mock-server tests.
* fix(firefox): time out DevTools requests and keep replies aligned
A DevTools request now fails after 30s instead of waiting forever, and a
failed write drops its waiter so later replies reach the right request.
* feat(firefox): find, validate and launch an owned Firefox
Locates Firefox (env override, PATH, standard installs; rejects snap),
rejects options that cannot apply to Firefox, and launches it with a
fresh temp profile, BiDi on a random port and the DevTools server on a
private socket. The process tree and profile are removed on drop.
* feat(firefox): launch Firefox sessions and route commands to them
--engine firefox now launches an owned Firefox from both the explicit and
implicit launch paths, reuses a live session, relaunches a dead one, and
tears it down through the same close path. Commands are routed to a
Firefox module before the WebDriver and dialog gates; Chrome-only commands
fail with a clear error, and confirm/deny and the pending-dialog guard
work as on Chrome. navigate, url, title, eval, tab list and close work;
doctor reports the Firefox binary.
* fix(firefox): keep the DevTools socket path short
The DevTools socket now lives in a short private dir under /tmp, so a long
TMPDIR no longer breaks launch on the macOS socket path limit.
* feat(firefox): page, tab, storage and capture commands
back, forward, reload, content, wait (ms, load state, function, url),
tabs with Chrome-style t<N> ids, cookies, local/session storage, state
save/load with --session-name restore, screenshots (viewport and full
page) and PDF now work on Firefox with the same output as Chrome.
* test(firefox): add Firefox e2e harness and CI job
Real-browser e2e tests gated on FIREFOX_BIN, mirroring the Obscura
harness. CI installs Firefox from Mozilla and runs the smoke test; later
scenarios are enabled as their features land.
* fix(firefox): engine switching, recovery, autosave and handshake bounds
Close Firefox before switching engines, relaunch Firefox (not Chrome)
after a crash, autosave and drain Firefox sessions on the background
tick and before a relaunch, reject launch options Firefox would ignore,
keep DevTools replies aligned after a timeout, keep wait polling through
transient script errors, and bound the BiDi and DevTools handshakes.
* fix(firefox): keep the BiDi connection on large full-page screenshots
The BiDi socket used tungstenite's default 64 MB message limit, so a long
page's full-page screenshot closed the connection and every later command
waited 30 seconds before failing. The limit is now off, like the CDP
client, and a command on a closed socket fails immediately.
Tested with a Firefox e2e that captures a >48 MB full-page screenshot:
fails with "BiDi connection closed" before, passes after.
* fix(firefox): auto-accept alert and beforeunload like Chrome
Chrome accepts alert and beforeunload dialogs unless --no-auto-dialog is
set; Firefox left them pending and blocked the next command. The BiDi
session now asks Firefox to accept those two prompt types itself, and
prompts Firefox already handled are not reported as pending. confirm and
prompt still wait for the dialog command.
Tested with a Firefox e2e: an alert and a beforeunload no longer block.
* fix(firefox): default cookie paths like Chrome
cookies set without a path used the page's full path, so a cookie set on
/one was gone on /two. Chrome's CDP setter builds a host-only URL, so the
default path is /. Firefox now defaults to / too; explicit paths are
unchanged.
Tested with a Firefox e2e: fails before, passes after.
* fix(state): write state files owner-only
State exports and autosaves hold cookies and tokens but were written
with default permissions, so under a 022 umask other local users could
read them. Chrome and Firefox now write state files through one helper
that creates or tightens them to 0600 before writing, and the managed
sessions directories are 0700. User-chosen export folders are untouched.
Tested with a unit test that rewrites an existing 0644 file and creates
a new one.
* fix(firefox): restore saved storage in an isolated realm
The state restore wrote saved localStorage and sessionStorage by
evaluating setItem calls in the page, with no origin check, so a page
hooking Storage or a redirect to another origin could read the saved
tokens. Restore now runs one script in a BiDi sandbox that checks the
origin before reading the payload.
* fix(firefox): skip storage origins that redirect and keep restoring
Firefox state restore now skips an origin whose page landed somewhere else, like Chrome, and returns the skipped origins so state load and launch --state report them. Adds a Firefox e2e test for page-script isolation and redirects.
* fix(firefox): box the Firefox dispatch future so execute_command stays small
* fix(daemon): run confirm outside the dispatch match so it never nests
execute_command's dispatch match has a very large debug poll frame. confirm
re-entered execute_command from inside that match, so a confirmed command
kept two dispatch frames on the stack and overflowed the 2 MiB test thread
stack. The match now lives in dispatch(), and confirm calls handle_confirm
before it.
* fix(firefox): validate restores and scope cookie reads like Chrome
Firefox restore checks now run against the page, and autosave goes through
the shared private writer with candidate validation and promotion, so a
failed restore no longer overwrites good saved state. cookies get returns only
cookies that apply to the requested URLs, or the active page and its frames,
checking domain, path and Secure.
* test(daemon): clear AGENT_BROWSER_CDP in the unknown-command test
The test read the process environment without holding the env lock, so it
failed whenever it ran alongside the test that sets AGENT_BROWSER_CDP to an
invalid target.
* fix(firefox): launch, idle and autosave lifecycle fixes
- launch --state no longer merges into a live Firefox; it relaunches like Chrome.
- A headed Firefox is exempt from the default idle shutdown, and browserLaunched reports a live Firefox.
- A closed BiDi connection counts as a dead session, so the next command relaunches.
- Autosave reads iframe origins and keeps saved origins it could not read, so a partial save no longer drops logged-in storage. Explicit state save still overwrites.
- The stderr drain decodes lossily instead of stopping at the first non-UTF-8 line.
- Firefox reuses Chrome's URL glob matcher instead of a copy.
- Test fixes: cookie default-path comment, restore-validation e2e checks saveStatus and cleans up.
* chore: refresh MCP tool catalog snapshot
* fix(firefox): preserve saved storage when reads are blocked
Return null when either storage read fails so autosave keeps the previous origin. Cover blocked reads and deliberate storage clearing.
Use the platform Firefox filename in the resolver test and keep launch tests within the commands this branch supports.
* fix(firefox): read the active page through BiDi
* test: preserve Windows runtime variables in MCP CLI check
Keep the environment variables needed for Windows sockets when clearing the test environment. Include the full MCP result if the expected parser error is absent.
* fix(firefox): preserve saved state and handle dialogs
* fix: align browser startup and docs checks with current behavior
* fix: preserve paused target state during network setup
* fix: align regression tests with integrated browser code
* fix: correct docs fixtures and bound popup regression waits
* fix(firefox): handle launch defaults and bound tab operations
* fix(firefox): verify restore recovery and document capture limits
* fix(firefox): run all Firefox e2es and reject unsupported headers
* fix(firefox): reset inherited engine when switching connections
* fix(firefox): apply live dialog settings and count open tabs
* Run native browser end-to-end tests on pull requests
* Run only Firefox browser tests on pull requests
* Remove timed-out Firefox DevTools requests from the actor queue
* Test RDP recovery after a request timeout
* Remove unused DevTools setup from owned Firefox launch
* Match RDP replies by command type after timeouts
* Fail closed after a Firefox DevTools timeout
* Keep standard RDP replies after fail-closed timeouts
* Format fail-closed RDP timeout assertions
* fix(firefox): drop tabs closed outside the daemon
Subscribe to browsingContext.contextDestroyed and remove destroyed top-level contexts from the tab list and labels. If the active tab was destroyed, fall back to a surviving tab and reset refs and frame state, so later commands work and the label can be reused.
* fix(firefox): tab new races prompts and launch stops opening the debugger socket
tab new <url> now returns with dialogOpened set when the page opens a prompt during load, instead of waiting out the 30s BiDi timeout. Firefox no longer starts the DevTools server or enables chrome devtools here, since nothing in this change connects to it.
* refactor(firefox): one owner each for navigation, tab lifecycle, prompts and launch validation
* fix(firefox): answer the prompt in the tab that opened it
dialog now targets the context recorded with the pending prompt instead of the active tab, so a prompt in a tab you switched away from can still be accepted or dismissed.
* test(firefox): pin the prompt target in the dialog test
The test asserted only that handleUserPrompt was sent, so it passed while the command went to the active tab. It now checks the context in the request.
* fix(firefox): give window new its own cookie jar
window new now opens the window in a fresh BiDi user context, so it starts without the other window's cookies and storage, like Chrome's browser context. Closing the window removes the user context.
* fix(firefox): keep cookies and new tabs inside the window's user context
Cookie reads, writes and clears use the active tab's storage partition, and tab new opens in that user context, so an isolated window stays isolated.
* fix(firefox): keep new tabs and restored cookies in the window's jar
A tab opened from an isolated window was created in that window's user
context but never recorded as belonging to it. active_partition looked the
new tab's context up in window_contexts, missed, and fell back to the
default jar, so cookie reads and writes on that tab went to the wrong jar
and the next tab opened outside the window. tab_new now records the user
context it created along with the context, which keeps active_partition and
the following tab_new inside the window. Several tabs now share one user
context, and tab_close still drops the context only when the last tab of
the window closes, counting by user context value.
A state load replayed saved cookies without a partition, so loading while
an isolated window was active wrote them into the default jar. The restore
path now sends the active partition, the same way cookies_set does. The
other cookie calls in this module already carried it.
The window cookie e2e test now sets a cookie in a tab opened from the
window, checks a third tab opened from that one stays in the same jar, and
checks the default jar stays clean once the window closes. A new e2e test
covers restoring cookies while an isolated window is active.
* refactor(firefox): track browsing contexts in one registry
Tab ids, labels, the active tab and each tab's cookie jar lived in five
maps on the session that every handler updated by hand. A popup opened
from an isolated window was never added to the jar map, so cookie
commands and state save used the default jar while it was active.
`Contexts` now records every context Firefox reports, frames included,
with the user context Firefox reports for it. Tab ownership, the active
context and the storage partition are answered there and nowhere else.
User contexts created by `window new` are removed once their last tab
is gone, whoever closed it.
Also in this change:
- `window new` honours `viewport`, as it does on Chrome.
- The DevTools client and its socket setup move to the snapshots
change, the first one that uses them, so the module-wide
`allow(dead_code)` can go.
- Drop a launch test that repeated the fake-binary test and the e2e
smoke test.
Tested with `cargo test firefox` and the Firefox e2e suite; the window
test now opens a popup from an isolated window and reads its cookies.
* fix(firefox): adopt the next tab when no open tab is active
After the last known tab closed, the session kept an empty active
context, so commands failed until a tab switch even though a new tab
had opened. The registry now makes the first tab it records active when
none is.
* fix(firefox): recover the active tab when its creation event was lost
When no context is active, read the context tree instead of waiting for
an event that may have been dropped. Also restore the launch test's
check that Firefox is not started with a DevTools server.
* fix(firefox): save state from the active window's cookie jar
State save from a window opened by `window new` read open tabs from
every jar and re-read visited origins in a tab created in the default
jar, so it dropped the window's storage and picked up the default
window's. It now reads only tabs in the active tab's jar and creates
the storage tab in that jar, both asked of the context registry.
The window e2e test saves state from an isolated window after
navigating away and checks the saved storage is that window's.
* fix(firefox): read saved storage in a sandbox and check its origin
State save read each origin's storage with a script in the page's own
JavaScript realm, so the page could change what was read, for example by
patching `Storage.prototype.getItem`, and the values it chose were saved
and written back into that origin on restore. The origin on the result
was also taken from the script and never compared with the browser's.
Storage is now read in the same BiDi sandbox the restore already uses,
where page patches do not apply. Each read is given the origin the
browser reports for the context, returns nothing if the page has moved
to another origin, and is dropped on the Rust side unless its origin
matches. The open-tab path and the background-tab path share that one
read.
* fix(firefox): reject proxy schemes Firefox cannot honour
An https:// proxy fell through to the plain HTTP proxy setting, so
Firefox talked to the proxy without TLS while the user had asked for an
encrypted connection to it. The WebDriver proxy capability has no way to
ask for TLS to the proxy.
The proxy scheme is now matched explicitly. http://, socks4://, and
socks5:// proxies work as before, and any other scheme is rejected by
launch validation before Firefox starts.
* test: stop two races that fail the Rust job
The credentials and HAR tests read paths under HOME more than once
without the lock that other tests hold while they change HOME, so a
change in between sent the second read to a different directory. Both
now hold that lock for the whole test.
The skills tests copy the binary and run the copy. A child forked by one
test inherited the descriptor another test was still copying through,
and running that copy failed with 'Text file busy'. The tests in that
file now run one at a time.
* fix(firefox): default a cookie's path from its URL
A cookie set without a path was stored at "/", so one set on /foo/bar was
sent site-wide. Chrome derives the RFC 6265 default path from the cookie
url or the page URL (/foo). Firefox now does the same and keeps "/" only
when there is no URL to derive from.
The e2e test asserted the old path and now checks the cookie is scoped to
the page directory.
* test(firefox): drop launch tests that repeat other tests
Removes unit tests that restate the implementation or assert a fake's
canned reply, merges tests that prove the same behaviour, folds the
read e2e test into the smoke test to save a browser launch, and trims
two doc passages that described internals.
* fix(firefox): report values JSON cannot carry the way Chrome does
eval returned null for undefined and the strings "NaN", "Infinity" and
"10" for NaN, Infinity and bigint, so callers saw engine-dependent values.
The BiDi value conversion now yields null for anything JSON cannot
represent, and eval adds the same unserializable token Chrome returns
(undefined, NaN, Infinity, -Infinity, -0, 10n). Both engines build the
reply with one function.
* refactor(firefox): reuse shared helpers for waits and timeouts
Firefox carried its own copies of code the Chrome path already has: the
wait-for-selector expression and the command timeout lookup. It also had
three copies of the same poll loop. Each now has one implementation. No
behaviour change.
* test(firefox): restore the smoke checks for init scripts and first-save storage
The cleanup removed them as duplicates, but nothing else sends
initScripts through the launch command, and nothing else asserts that
the first save captures a closed origin's storage.
* fix(firefox): always name the tab's cookie jar when reading or writing cookies
cookies, cookies clear and state save/load sent no partition for a tab in
Firefox's default user context, so BiDi ran the command over every jar and a
window opened with `window new` leaked into them. The partition is now always
the tab's user context, default included, matching Chrome.
* fix(firefox): report a load timeout instead of a raw socket error
A page whose subresource never finishes kept the BiDi load waiting for 30 seconds, as long as the CLI waits for the daemon, so the CLI gave up first with a socket error.
A load now uses the session's default timeout, as Chrome does, and fails with the same load timeout message. This covers open, tab new, reload, back and forward.
* fix(firefox): reject an unsupported action before launching Firefox
The check for actions Firefox cannot run sat in the Firefox dispatch, which runs after the browser is launched. An unsupported action therefore started Firefox and then failed, or failed with a launch error when Firefox was missing.
The same check now runs before the launch, so the action fails at once with the not-supported message and no browser starts.
* fix(firefox): reject an unsupported action before switching restore sessions
The check ran after the restore session switch, which saves and closes the running browser. An unsupported action with a new session name closed Firefox and then failed without starting a replacement. The check now runs first.
* test(firefox): use an action no layer of the stack supports
The pre-launch test used snapshot, which Firefox gains later in the stack, so the test would then try to launch a browser. vitals stays unsupported.
* fix(firefox): let the session timeout decide when a load gives up
`ff.bidi.send` carries a fixed 30s deadline, so a session timeout above 30s
failed the load at 30s with the BiDi error instead of the load timeout. The
load now sends without a client-side deadline and its own budget is the only
one in play.
A fake session that never answers a method covers the case.
* A launch setting Firefox rejects (--profile, --user-agent, --cdp) closed the running Firefox in the settings relaunch before launch_firefox validated it, losing the session. Validate the planned settings before the relaunch instead, reusing the launch validation.
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
* fix(firefox): follow a popup the active tab opens
A tab opened by window.open or target=_blank only became active once the previous active tab was gone, so url, navigate and eval kept acting on the opener. Record each tab's opener, make a popup of the active tab active like Chrome does, and hand back to the opener when it closes. Matches the later bidi branches.
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
* fix(firefox): handle history boundaries, history landing, event loss, and storage origin normalization
- Treat BiDi no-such-history-entry as a no-op returning the current URL
- Wait for history traversal to land on the destination document under one timeout and prompt race
- Filter critical BiDi event subscriptions in the socket reader and reconcile context state on overflow
- Normalize saved storage origins during restore and autosave merge while keeping original skipped labels
* Apply main's changes to actions.rs and the restore docs ahead of the main merge
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
* Resolve the main merge in actions.rs and the restore docs
Keep the Firefox unsupported-action check ahead of main's restore unit, count Firefox and the other WebDriver sessions as active browsers for relaunch and autosave, skip Firefox autosave while the restore identity is unresolved, and keep the Firefox notes in the restore docs.
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
* test(firefox): pass the restore key through the settings patch
main now carries the restore key and checks only in the settings patch, so the Firefox restore e2e sends them there instead of the old top-level fields.
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
* fix(firefox): enforce --pin-tab in the context registry
Propagate --pin-tab to Firefox on launch and runtime settings updates so page-opened popups never replace the active context while pinned.
Closing the bound tab moves the registry into a tab_gone state instead of falling back to an opener or neighboring tab, refusing page commands with Chrome's tab_gone error and structured recovery data until an explicit tab switch, tab new, window new, or --no-pin-tab.
* fix(firefox): refuse storage reads and autosave when a pinned tab is gone
Require a live storage tab instead of falling back to the default user context when a pinned tab closes, so periodic autosave and close cannot overwrite an isolated tab's saved state with the default window's cookies or storage. Keep restore validation pending while pinned-gone.
---------
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
* Ship native binaries as per-platform packages
- Publish each platform binary as an @agent-browser/cli-* optional dependency, so installs download only the host's binary
- Link the global command to the native binary on first run when install scripts are blocked (npm 12, pnpm, bun), and in postinstall when they run
- Release and CI publish the platform packages and test global installs with scripts blocked and allowed
* fix: link the native binary on pnpm 12 and keep skills resolvable
Three fixes on top of the per-platform packaging work.
relinkPnpmShim compared the shim's cmd-shim-target marker to argv[1] with
string equality. On pnpm 12 the marker keeps the ./ from the package's
"./bin/agent-browser.js" and argv[1] does not, so the shim was never
rewritten and every command still started Node. It now compares resolved
paths, which also covers the pnpm 10 and 11 spellings.
The launcher spawned the binary straight out of the platform package.
npm hoists that package beside agent-browser, so skills.rs, chat.rs and
upgrade.rs, which resolve their files by walking up from the executable,
found nothing. It now materializes into agent-browser/bin first and runs
from there.
postinstall only linked when npm_config_global was set, which only npm
does, so pnpm, yarn and bun never linked at install time. It now asks the
invoking manager for its global bin directory and also considers the
enclosing node_modules/.bin, which Yarn Classic links through. The probe
is skipped for local installs so they do not pay a subprocess.
The Windows shims are rewritten in a format npm's read-cmd-shim can parse,
each file's own target is checked before it is replaced, and replacement
is staged then renamed so a failure leaves the working launcher in place.
Verified with real global installs on macOS and Linux: npm with scripts
allowed and blocked, pnpm 11 and 12, and bun. Yarn could not be verified
locally because it fails when an optionalDependency is unresolvable and
the platform packages are unpublished. Windows is unverified.
* fix(pnpm): link the shim to the binary in the package bin
The pnpm branch wrote the platform package's own path into the shim, so
once that package resolved, the binary ran from a directory with no
skills/ above it. It now links the same materialized path the symlink and
Windows branches already use.
---------
Co-authored-by: Lahfir <70215676+lahfir@users.noreply.github.com>
- Run the Eve package's typecheck with tsc-ts, which reports the same diagnostics as tsc
- Keep the official tsc as typecheck:tsc and run it in CI while tsc-ts is new
e2e_snapshot_and_click_ref depended on example.com, which no longer renders the asserted heading. It now uses a loopback fixture. The E2E job installs Obscura v0.2.4 and sets OBSCURA_BIN, which the Obscura verification tests require.
* feat(docs): migrate agent-browser to Geistdocs
* fix(docs): use workspace pnpm configuration on Vercel
* fix(docs): run Vercel installs and builds through Corepack
* docs: document Vercel workspace build requirements
* fix(docs): scope Vercel dependency installation to docs
* feat(docs): switch navbar to Vercel Labs brand
Bump @vercel/geistdocs to 2.4.1 and set navbarBrand: "labs" so the
docs navbar uses the Vercel Labs logo and links to vercel.com/labs
instead of the default OSS branding.
* chore: regenerate lockfile after merge
* fix(docs): restore navigation sections
* test(docs): re-pin baseline to d01253d9 after main advanced
Main updated the contact sheet example image (#1871) and the
browser-use provider page (#1879); the rename-aware merge carried both
into the migrated content. Re-pin the original-state baseline to the
new main commit so the contract checks pin the current originals.
* docs: update Geistdocs to 2.7.5 and check the MCP route
* test(docs): re-pin baseline to 526157cf after main advanced
* docs: port Obscura engine page to Geistdocs and re-pin baseline to efee3893
* Add Eve browser extension
- Add @agent-browser/eve with namespaced browser tools, configuration, and tests.
- Move the Eve example out of sandbox helpers and document extension usage.
- Improve snapshot selector errors and sync/version workspace handling.
* Ship Eve extension release path
- Publish @agent-browser/eve through the trusted npm release workflow
- Add Eve package CI, version sync, docs, and skill discovery
- Harden Eve waits and sandbox command deadlines
* Add agent-browser sandbox package
- Add @agent-browser/sandbox with shared, Eve, and Vercel Sandbox helpers.
- Wire workspace and version sync so the package stays aligned with agent-browser releases.
- Add sandbox examples and update docs/skills to use the new helper API.
* Fix sandbox package release path
* Fix sandbox package release flow
* Fix sandbox helper cleanup and dependency validation
* Add Eve sandbox example
The `e2e_recording_inherits_viewport` test added in #1208 requires
ffmpeg on the CI runner. Without it, `recording_start` fails with
"ffmpeg not found".
check-release now detects when the npm version matches but the GitHub
release is missing. build-binaries and github-release run in that case
so binaries, dashboard, and release notes are created without requiring
a version bump.
* 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>
The global-install job only uses npm (npm pack, npm install -g) but had
pnpm setup with cache enabled. On Windows, the pnpm store directory
doesn't exist since pnpm is never used, causing the Post Setup Node.js
cache step to fail with a path validation error.
* feat: add linux-musl (Alpine) builds for x64 and arm64
Add x86_64-unknown-linux-musl and aarch64-unknown-linux-musl targets to
the release workflow using cargo-zigbuild. Update the JS wrapper and
postinstall script to detect musl libc and select the correct binary.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: simplify isMusl() and add musl targets to build script
Address PR #784 review feedback:
- Remove redundant first try block in isMusl() (ldd --version always
throws on musl, so only the `|| true` variant works)
- Add x86_64-unknown-linux-musl and aarch64-unknown-linux-musl targets
to build-all-platforms.sh to stay in sync with the release workflow
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolves CI slowdown issues caused by limited availability of Windows containers with 8 cores by switching to the standard Windows runner image.
## Changes Made
- Updated `rust-cross` job to use `windows-latest` instead of `windows-latest-8-cores`
- Updated `windows-integration` job to use `windows-latest` instead of `windows-latest-8-cores`
- Updated `global-install` job matrix to use `windows-latest` instead of `windows-latest-8-cores`
This change trades some performance for better availability and faster CI queue times, as the standard Windows runners have much better availability than the 8-core variant.
Fixes#741
Add `cargo clippy -- -D warnings` step to the Rust CI job so that
clippy warnings fail the build. Also fix the one new lint
(`unnecessary_map_or`) introduced in the current stable clippy.
Fixes#672
Co-authored-by: hyunjinee <leehj0110@kakao.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
TypeScript CI has prettier --check but Rust CI only runs cargo test.
Add cargo fmt --check to catch formatting issues early, and fix the
8 pre-existing formatting violations on main.
* fix(windows): resolve daemon startup failures and Git Bash compatibility
Three root causes behind 27 open Windows issues:
1. Path::canonicalize() returns \\?\ prefixed paths on Windows that
Node.js cannot parse, preventing daemon startup. Strip the prefix
before passing to Node. (fixes#522, #390, #56, #25, #37, #89)
2. Git Bash/MSYS2 translates Unix-style paths and resolves node to
a shell wrapper script. Use node.exe explicitly and set
MSYS_NO_PATHCONV/MSYS2_ARG_CONV_EXCL to prevent argument mangling.
(fixes#148, #108, #171)
3. postinstall fixWindowsShims() hardcoded x64 arch and did not verify
the native binary exists before rewriting shims. Now detects arch
dynamically and validates the binary path. (fixes#262)
Also:
- Error messages now show TCP port on Windows instead of Unix socket path
- Windows CI expanded to test full daemon lifecycle (open, snapshot, close)
* fix(windows): strip \\?\ prefix in auth-cli path (fixes#579)
Same canonicalize() issue as the daemon spawn path, but in
run_auth_cli() which passes the script path to Node.js.
Add automated verification that package.json and cli/Cargo.toml versions
stay in sync. This prevents version drift between the npm package and
Rust CLI binary.
- Add CI job to check version sync on push/PR
- Update pre-commit hook to sync versions automatically
- Update ci:version script to include version sync step
- Add check-version-sync.js script for CI validation
* test: add Windows npm global install CI test (reproduces #262)
This test packs the package and installs it globally with npm,
then runs agent-browser --version. This reproduces the issue where
npm-generated shims on Windows try to invoke /bin/sh which doesn't exist.
The bin/agent-browser.js wrapper is added but not yet wired up,
so this commit should fail CI to confirm the issue.
* fix: Windows npm global install and npx support
The shell script wrapper (bin/agent-browser) with #!/bin/sh shebang
causes npm to generate Windows shims that try to invoke /bin/sh,
which doesn't exist on Windows.
This fix uses a hybrid approach:
1. Node.js wrapper (bin/agent-browser.js) as bin entry
- Makes npx work on all platforms
- ~100ms overhead (acceptable since npx has its own overhead)
2. postinstall patches bin entries for global installs
- Windows: Overwrites .cmd/.ps1 shims to invoke .exe directly
- Mac/Linux: Replaces symlink to point to native binary
- Zero overhead for `npm i -g agent-browser` users on all platforms
Also fixes PowerShell glob expansion in CI test.
Fixes#262
* fix: Windows npm global install and npx support
The shell script wrapper (bin/agent-browser) with #!/bin/sh shebang
causes npm to generate Windows shims that try to invoke /bin/sh,
which doesn't exist on Windows.
This fix uses a hybrid approach:
1. Node.js wrapper (bin/agent-browser.js) as bin entry
- Makes npx work on all platforms
- ~100ms overhead (acceptable since npx has its own overhead)
2. postinstall patches bin entries for global installs
- Windows: Overwrites .cmd/.ps1 shims to invoke .exe directly
- Mac/Linux: Replaces symlink to point to native binary
- Zero overhead for `npm i -g agent-browser` users on all platforms
Also adds cross-platform CI tests for npm global install to catch
regressions on all platforms (Ubuntu, macOS, Windows).
Fixes#262
* test global install
* remove dead code
* ci: add test for Windows CMD wrapper
This test will fail until the CMD wrapper is fixed to call the native binary.
* fix: Windows CMD wrapper calls native binary instead of missing index.js
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/.