The CLI daemon, integration tests and web_browse example each resolved the
browser as $CAMOUFOX_BIN, else ~/.cache/camoufox/camoufox. Current Camoufox
(`python -m camoufox fetch`) installs to
~/.cache/camoufox/browsers/<repo>/<version>/camoufox and records the active
one in ~/.cache/camoufox/config.json, so a fresh install failed with
"failed to spawn browser ... No such file or directory" unless the path was
passed by hand.
Add camoufox::config::default_executable(), mirroring the Python package's
lookup, and use it from all three places:
1. $CAMOUFOX_BIN, if set and non-empty
2. active_version from <cache>/config.json, if its executable exists
3. the newest browsers/<repo>/<version>/camoufox (natural version order)
4. the legacy <cache>/camoufox, returned even if missing
<cache> honours an absolute $XDG_CACHE_HOME, else $HOME/.cache/camoufox.
An empty CAMOUFOX_BIN is now treated as unset.
Docs (README, CLI and library references, tutorial, how-to), CHANGELOG and
the camoufox-browse skill note are updated; plugin bumped to 1.1.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds docs/ guides by type and makes README the entry point:
- tutorial: docs/tutorial-getting-started.md
- how-to: CLI daemon, iframes and shadow DOM, downloads and dialogs,
library usage
- reference: docs/reference-cli.md (all 33 subcommands, built from the
release binary's --help, with JSON samples from real runs and the
{"ok","data"} envelope) and docs/reference-library-api.md
- explanation: docs/explanation-architecture.md
Repairs stale claims in README.md, docs/UNDERSTANDING.md and
docs/PROTOCOL.md (pipe/fd setup, concurrency model, unsafe scope, frame
buffer cap, readiness sentinels, navigate/evaluate return types, trusted
vs synthetic input, downloads --wait semantics, socket security on
Linux vs other platforms). Adds TODOS.md with verified follow-ups.
Written by agy (gemini-3.8-flash-high) via the gstack document-generate
skill; audited twice against the source by Fable 5.2 (41 semantic
findings fixed) and by a docs-vs-code name check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YQU84X3UzxGaxqrADxbkoE
Grow the CLI from 12 primitives to a full browsing/scraping surface. Every new
command is a thin CLI/IPC wrapper over the existing `api` layer (no new protocol
plumbing), and `output.rs` is refactored into a pure, testable `render()`:
- Reading: text, html, links, data (og/jsonld/meta), url
- Navigation/waiting: wait, reload, back, forward
- Cookies/headers: cookie, header
- Interaction: click (selector or x,y trusted event), fill, type, press,
hover, select, scroll
- Tabs: tabs, close-tab
- screenshot --selector / --clip, and a viewport-origin default clip
Public-release preparation and review hardening:
- Add MIT LICENSE and repository metadata to Cargo.toml
- Make the camoufox-browse plugin portable: discover the binary via
$CAMOUFOX_BIN / PATH / ./target/release instead of hardcoded container paths
(SKILL.md and hook.json)
- Sanitize internal client references from docs and code comments
- CHANGELOG: list the new commands under Added (not Changed)
- wait_for_selector fails fast on invalid selectors instead of burning the
full timeout under the daemon lock
- Correct punctuation keyCodes in key_descriptor (`press .` no longer collides
with Delete's keyCode)
- Add --timeout to the tabs command
- Document the daemon's serial-execution behavior in README
- Add integration tests: trusted click, reading, interaction, screenshot
scroll-offset regression, and wait fail-fast
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Additively add `status_code: Option<u16>` to `navigate` outcome.
Navigate returns `NavigateOutcome { nav_id, status_code }` instead of
`Option<String>`. The existing `navigation_id` semantics are unchanged;
`status_code` is a new additive field at both the API and IPC/JSON layers.
Navigate NEVER fails due to 4xx/5xx — the status is surfaced and the
call still returns Ok. If the status cannot be captured (e.g. the
Network events do not arrive within a 500 ms cap), `status_code` is
`None`.
Correlation approach: subscribe `Network.requestWillBeSent` and
`Network.responseReceived` on the page session BEFORE issuing
`Page.navigate`. The `requestWillBeSent` handler accepts the first
`document`-typed request (speculatively while nav_id is not yet known,
precisely after the navigate ack). The `responseReceived` handler
captures the HTTP status for the matching `requestId`. Both handlers
are RAII-guarded via `SubscriptionGuard` (mirrors the G3 pattern) so
they cannot leak on any exit path.
Risk gate result: `Network.responseReceived` events DO flow without
`Network.setRequestInterception`. Confirmed by event-logging probe
against the live camoufox 135 browser.
Protocol discovery: the live browser emits raw Firefox type names
(`"TYPE_DOCUMENT"`, `"TYPE_IMAGE"` etc.) in the `cause` field of
`requestWillBeSent` rather than the spec-mapped values (`"document"`,
`"image"`). The handler now accepts both forms. PROTOCOL.md updated.
TDD coverage:
- Unit: 404 status captured → Ok (not error); nav_id preserved.
- Unit: no responseReceived → status_code == None, navigate still Ok;
both handlers deregistered (no leak).
- Unit: IPC serde includes status_code; legacy callers (no field) OK.
- Unit: print_response emits status code in human + JSON mode.
- Unit: 200 status captured.
- Integration (#[ignore]): StatusServer fixture serves /404 and /200;
navigate to /404 → status_code==Some(404), Ok; /200 → Some(200).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixes the bug where camoufox-rs evaluates against a cross-origin ad-pixel
iframe (e.g. aax-eu.amazon-adsystem.com on amazon.in) instead of the top
page. Three accept-the-first-event spots in src/cli/instance.rs are
replaced with authoritative protocol responses; a new MainFrame type
replaces the public Page struct so page-scoped operations cannot target
sub-frames at compile time.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>