20 Commits
Author SHA1 Message Date
9prodhiandClaude Opus 5.5 3f20d7bbff docs: clarify that profile reservation is per daemon
Persistent profile reservations live in each daemon's memory, so two
daemons on different sockets can open the same profile directory. The
docs now say concurrent launches are refused within one daemon and warn
against pointing two daemons at one profile. TODOS.md tracks
cross-daemon profile locking and record/replay for popups and
service-worker requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:50:18 -06:00
9prodhiandClaude Opus 5.5 0dcb9985a2 docs: document uploads, cassettes, persistent profiles and external commands
Updates the README, CLI and library references, how-to guides,
architecture notes and the camoufox-browse skill for upload,
record/replay, launch --profile-dir, external subcommands,
CAMOUFOX_SOCKET/CAMOUFOX_JSON, error kinds and Browser::default_context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:38:17 -06:00
9prodhiandClaude Opus 5.5 158160a216 fix(cli): isolate cassette cleanup per tab and keep closed-page results
- Closing a tab or a self-closing popup no longer shuts down the browser
  when finalizing its recording takes too long; body reads observe the
  deadline instead, and only instance stop and daemon shutdown still
  close the connection. The budget starts once the page's network lock
  is held.
- record stop / replay stop for a closed page return its finalized
  result (repeated, page_closed) from a bounded per-instance registry.
- close-tab and stop report `cassette_errors` when a cassette could not
  be published, with a warning in plain output.
- Deadline tests use a short injected budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:18:26 -06:00
9prodhiandClaude Opus 5.5 485f1aeded fix(cli): retry external subcommands on ETXTBSY
A freshly written executable can briefly fail to spawn with "Text file
busy" when a concurrent fork still holds a writable descriptor. Spawning
an external subcommand now retries that error up to five times with a
short backoff; other spawn errors are reported immediately.

Test fixtures write executables from a helper process so parallel
tests no longer race, and process assertions include stderr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:58:41 -06:00
9prodhi dfd0fd9b09 Merge branch 'fix/review-p2' into feat/cli-automation-primitives 2026-11-23 10:39:39 -06:00
9prodhiandClaude Opus 5.5 5567c3f98b fix(cli): clean up after old daemons and classify client errors
- When an older daemon ignores --profile-dir, the launched instance is
  stopped before reporting the error.
- Client-side argument errors report kind invalid_argument (exit 2);
  local I/O failures report kind io (exit 1).
- External subcommands never inherit CAMOUFOX_JSON without --json;
  test daemons ignore an ambient CAMOUFOX_SOCKET.
- Documents CAMOUFOX_SOCKET resolution, upload dialog results and
  directory-picker rejection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:39:39 -06:00
9prodhiandClaude Opus 5.5 491637d35c fix(cli): bound cassette finalization and tighten cassette loading
- Instance stop, shutdown and close-tab finalize recordings within a
  15 s deadline; unfinished exchanges are reported as skipped.
- index.json is opened like bodies (no FIFOs, no symlinks) and capped
  in size.
- Plain output shows skipped exchanges, repeated stops and the real
  miss count.
- A failed record/replay start no longer replays the previous stop
  result.
- Removes the replay encoding cache and the legacy multipart hash
  fallback; streams hashing through io::copy; splits the event loop.
- Strengthens Set-Cookie, multipart, owner-check and large-response
  tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:39:39 -06:00
9prodhi ce462434c7 Merge branch 'fix/review-p' into feat/cli-automation-primitives
# Conflicts:
#	tests/network_cassette.rs
2026-11-23 10:15:55 -06:00
9prodhiandClaude Opus 5.5 4a7d3a23bd fix(cli): harden persistent profiles and daemon compatibility
- `launch` reports the profile directory; the client fails clearly when
  an older daemon ignores --profile-dir instead of silently using a
  temporary profile.
- --profile-dir accepts an existing directory only if it is empty or
  already a browser profile, and tightening keeps setgid/sticky bits.
- New error kind `page_closed`; the client backfills `kind` when talking
  to an older daemon; ErrorKind, DaemonRequest, DaemonResponse and
  LaunchOptions are #[non_exhaustive].
- --socket defaults from CAMOUFOX_SOCKET; external subcommands receive
  an absolute socket path and CAMOUFOX_JSON=1 with --json; relative PATH
  entries are ignored when looking up external subcommands.
- Removes a dead profile path field and duplicated profile-dir code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:10:20 -06:00
9prodhiandClaude Opus 5.5 7fcf0a0c7c fix(cli): harden network cassette recording and replay
- Unreadable or evicted response bodies (Firefox keeps at most 10 MB per
  response and 100 MB buffered) are skipped and reported in `skipped`;
  the index is still published.
- Cassette directories are created 0700 and bodies 0600 with
  O_NOFOLLOW; an existing directory must be owned by the user and
  private.
- Replayed responses drop caching, HSTS, Alt-Svc, Service-Worker-Allowed,
  Clear-Site-Data and Set-Cookie headers and add Cache-Control: no-store;
  recording scrubs more credential headers.
- Stopping an instance or the daemon finalizes active recordings first;
  record/replay stop works while a dialog is open, uses a 300 s client
  timeout and repeats return the last result.
- A lenient format/version header is checked before strict parsing.
- Replay reads bodies from disk on demand, hashes request bodies only
  with --match-body, normalizes multipart boundaries, caches encodings,
  deduplicates and caps misses; cassette loading and worker joins run
  outside the per-instance lock; events are filtered before queueing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:10:20 -06:00
9prodhiandClaude Opus 5.5 d1ecce4500 fix(cli): persist profile state, reserve profile dirs, classify io/daemon errors
- Persistent `--profile-dir` launches now run pages in the browser's
  default context (as persistent launches in other automation tools do),
  so cookies, localStorage and other site data survive stop/relaunch.
  Temporary profiles keep their private, isolated context. Adds
  `Browser::default_context` (additive API).
- The canonical profile path is reserved atomically before the browser
  is spawned and released on exit or failed startup, so concurrent
  launches on one directory get the documented "already in use" error.
- Profile-directory filesystem failures classify as `io` and client-side
  connection failures ("daemon is not running", socket errors) as
  `daemon`; message text is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:16:57 -06:00
9prodhi 70e601b143 Merge branch 'feat/net-record-replay' into feat/cli-automation-primitives
# Conflicts:
#	docs/reference-cli.md
2026-11-23 08:42:59 -06:00
9prodhi 7dcd8eaedb Merge branch 'feat/profile-dir-dispatch' into feat/cli-automation-primitives
# Conflicts:
#	tests/integration.rs
2026-11-23 08:33:07 -06:00
9prodhi 862f056bc8 Merge branch 'feat/upload' into feat/cli-automation-primitives 2026-11-23 08:31:18 -06:00
9prodhiandClaude Opus 5.5 ba10b3a898 feat(cli): add persistent profile directories and external subcommands
`launch --profile-dir <abs path>` runs an instance on a persistent
profile instead of a temporary one: the directory is created or
tightened to 0700, refused if relative or already used by another
instance in the daemon, kept on stop/shutdown, and shown in `list`.
Temporary profiles behave exactly as before.

Unknown subcommands now dispatch git-style: `camoufox <name> ...` runs
`camoufox-<name>` from PATH with the arguments passed through,
CAMOUFOX_SOCKET set to the resolved daemon socket, and its exit status
propagated. Built-in names always win; when no such executable exists
the clap error and exit code 2 are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 08:31:12 -06:00
9prodhiandClaude Opus 5.5 fcf96f5a95 feat(cli): add page network cassette recording and replay
`record start|stop` captures a page's HTTP exchanges (optionally filtered
by URL regex) into a cassette directory: index.json plus deduplicated
bodies stored by sha256, with Set-Cookie, Cookie and Authorization
removed. `replay start|stop` validates a cassette, then serves matching
requests (method + URL, optionally request-body hash) from it and aborts
everything else, reporting misses on stop. Recording is passive and does
not change page behaviour; stop drains in-flight replay requests before
interception is disabled. Redirect chains are rejected for replay
because the browser bypasses interception after a redirect.

New optional dependencies (sha2, regex, base64) are enabled only by the
`cli` feature; the library's default dependencies are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 08:18:58 -06:00
9prodhiandClaude Opus 5.5 f12a796d8a feat(cli): add file uploads with frame and shadow scoping
Add an `upload` command that sets the files of an <input type="file">
selected by CSS selector, reusing the existing selector pipeline so
`--frame` (repeatable, nested iframes) and `a >>> b` shadow piercing work
as they do for fill/click. Paths are resolved to absolute on the client
and validated by the daemon (missing, directory, non-regular, multiple
files without the `multiple` attribute) before the page is touched.
Hidden inputs are supported. Exposed as InstanceManager::upload, a daemon
IPC request and a CLI command; plain mode prints the uploaded file names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 08:18:58 -06:00
9prodhiandClaude Opus 5.5 aa7f937725 feat(cli): add stable error kinds to daemon responses
Error responses now carry a machine-readable `kind` next to the
unchanged `error` message, so programmatic clients can branch on error
type without parsing text. A single classifier maps messages to a fixed
snake_case set (selector_not_found, timeout, dialog_open, frame_detached,
frame_not_found, not_iframe, shadow_root, navigation,
instance_not_found, page_not_found, invalid_argument, io, daemon, other).
Plain-mode stderr, message text and exit codes are unchanged; success
responses never include `kind`; older responses without it still parse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 08:18:58 -06:00
9prodhiandClaude Opus 5.5 c6cd4595f7 fix(config): find the browser where current Camoufox installs it
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>
2026-11-22 21:34:15 -06:00
9prodhiandClaude Opus 5.5 02b2f8fe60 docs: Diataxis documentation suite, verified against the code
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
2026-11-21 17:03:19 -06:00