Commit ee20694
feat(camoufox): drive targets via interceptor_browser_*; file-based ws handshake; v3.1.0 (#17)
Camoufox targets are now first-class citizens of the interceptor_browser_* /
humanizer_* tool surface. Callers don't have to reach for `firefox.connect`
themselves; passing a `camoufox_*` target_id through navigate / snapshot /
screenshot / click / scroll just works, same as cloakbrowser.
Headline changes:
- session.ts: lazy `firefox.connect(wsUrl)` + cached Browser/Context/Page on
the camoufox entry. `getPageForTarget` is now async and dispatches on
target_id prefix. Callers in humanizer engine + devtools tools updated.
New `getBrowserEntry` for the cloakbrowser-only paths (consoleBuffer,
context.cookies) — camoufox callers get a clear "not yet supported"
error instead of a deep type-mismatch.
- File-based ws-endpoint handshake: replaces the stdout WS_REGEX with an
atomic JSON drop at `${launcherDir}/ws-endpoint.json`. The python
wrapper around `camoufox.server.launch_server` pipes the underlying
Playwright Node child's stdout, strips ANSI, and writes the URL once;
Node side polls the file. ANSI / log-level / locale changes upstream
no longer affect Node's parser.
- firefox_user_prefs forwarded through `FORWARDED_PARAMS`, with the proxy
CA path auto-setting `security.enterprise_roots.enabled = true` when
`trust_proxy_cert` is true. Without it, hardened-Firefox builds ignore
the imported NSS CA and HTTPS pages return SEC_ERROR_UNKNOWN_ISSUER.
- Launcher cwd hardened: spawn cwd is the launcher temp dir, AND a
`package.json` with `{\"type\":\"commonjs\"}` lands there before spawn.
This isolates camoufox's CommonJS launcher from any stale ancestor
`package.json` (notably `/tmp/package.json` from other tools) that
would otherwise force Node to load `launchServer.js` as ESM.
- `interceptor_browser_close` now closes camoufox targets too, dispatching
the deactivate to the right interceptor based on target_id prefix.
- `proxy_check_fingerprint_runtime` now returns a `runtimes[]` array per
backend — keeps the contract forward-compatible if more backends land.
- `proxy_list_traffic` exposes `count` alongside `total` for the
historical alias.
Tests:
- Unit suite rewired around the file-handshake contract (5 new cases:
resolve via file, stderr-tail capture on early exit, ANSI noise on
stderr is irrelevant to the resolve path, etc.).
- Integration: new test that drives the camoufox target via
\`interceptor_browser_navigate\` (skipped pending an upstream Playwright
fix for proxy propagation through \`BrowserServer.newContext\`; the
mscdirect-actor end-to-end smoke covers the production path).
- mcp-server preflight + HAR-replay tests: schema fixes (runtimes array,
\`count\` alias).
Out of band:
- /tmp/package.json poisoning fix is now baked into the launcher (cwd +
cjs marker). Operator hosts no longer need to keep /tmp clean.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8c4ad7a commit ee20694
10 files changed
Lines changed: 489 additions & 134 deletions
File tree
- src
- browser
- humanizer
- interceptors
- tools
- test
- integration
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
4 | 11 | | |
5 | 12 | | |
6 | | - | |
| 13 | + | |
7 | 14 | | |
8 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
9 | 24 | | |
10 | 25 | | |
11 | 26 | | |
12 | 27 | | |
13 | 28 | | |
14 | 29 | | |
15 | 30 | | |
16 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
17 | 93 | | |
18 | 94 | | |
19 | 95 | | |
20 | 96 | | |
21 | 97 | | |
22 | | - | |
| 98 | + | |
23 | 99 | | |
24 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
25 | 105 | | |
26 | 106 | | |
27 | | - | |
| 107 | + | |
28 | 108 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
0 commit comments