* 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>
3.8 KiB
AGENTS.md
Instructions for AI coding agents working with this codebase.
Package Manager
This project uses pnpm. Always use pnpm instead of npm or yarn for installing dependencies, running scripts, etc. (e.g., pnpm install, pnpm run build).
Code Style
- Do not use emojis in code, output, or documentation. Unicode symbols (✓, ✗, →, ⚠) are acceptable.
- CLI colored output uses
cli/src/color.rs. This module respects theNO_COLORenvironment variable. Never use hardcoded ANSI color codes. - CLI flags must always use kebab-case (e.g.,
--auto-connect,--allow-file-access). Never use camelCase for flags (e.g.,--autoConnectis wrong).
Documentation
When adding or changing user-facing features (new flags, commands, behaviors, environment variables, etc.), update all of the following:
cli/src/output.rs----helpoutput (flags list, examples, environment variables)README.md-- Options table, relevant feature sections, examplesskills/agent-browser/SKILL.md-- so AI agents know about the featuredocs/src/app/-- the Next.js docs site (MDX pages)- Inline doc comments in the relevant source files
This applies to changes that either human users or AI agents would need to know about. Do not skip any of these locations.
In the docs/src/app/ MDX files, always use HTML <table> syntax for tables (not markdown pipe tables). This matches the existing convention across the docs site.
Dashboard (packages/dashboard)
- Never use native browser dialogs (
alert,confirm,prompt). Use shadcn/ui components (Dialog,AlertDialog, etc.) instead. - Use param-case (kebab-case) for all file and folder names (e.g.,
session-tree.tsx, notSessionTree.tsx). Theui/directory follows shadcn conventions which already uses param-case.
Architecture
This is a Rust codebase. The browser automation daemon lives in cli/src/native/ (daemon, actions, browser, CDP client, snapshot, state). The --engine flag selects Chrome vs Lightpanda. The install command downloads Chrome from Chrome for Testing directly.
Testing
Unit Tests
cd cli && cargo test
Runs all unit tests (~320 tests). These are fast and don't require Chrome.
End-to-End Tests
cd cli && cargo test e2e -- --ignored --test-threads=1
Runs 18 e2e tests that launch real headless Chrome instances and exercise the full native daemon command pipeline. Requirements:
- Chrome must be installed
- Must run serially (
--test-threads=1) to avoid Chrome instance contention - Tests are
#[ignore]'d so they don't run during normalcargo test
The e2e tests live in cli/src/native/e2e_tests.rs and cover: launch/close, navigation, snapshots, screenshots, form interaction, cookies, storage, tabs, element queries, viewport/emulation, domain filtering, diff, state management, error handling, and Phase 8 commands.
Linting and Formatting
cd cli && cargo fmt -- --check # Check formatting
cd cli && cargo clippy # Lint
Source Code Reference
Source code for dependencies is available in opensrc/ for deeper understanding of implementation details.
See opensrc/sources.json for the list of available packages and their versions.
Use this source code when you need to understand how a package works internally, not just its types/interface.
Fetching Additional Source Code
To fetch source code for a package or repository you need to understand, run:
npx opensrc <package> # npm package (e.g., npx opensrc zod)
npx opensrc pypi:<package> # Python package (e.g., npx opensrc pypi:requests)
npx opensrc crates:<package> # Rust crate (e.g., npx opensrc crates:serde)
npx opensrc <owner>/<repo> # GitHub repo (e.g., npx opensrc vercel/ai)