@kienxuandaoit89/pi-camoufox-browser0.2.1
Stealth Firefox (Camoufox) browser tool for pi
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
fox — stealth Firefox for pi
One tool, fox, that drives a Camoufox browser: a Firefox fork patched in C++ so fingerprint surfaces are spoofed before page script runs. Input goes through the launcher's humanize engine (myuri), so clicks, typing and scrolling move like a person.
Use it for sites that block the normal browser tool with bot detection. Everything else — your logged-in Chrome profile — stays with browser.
Install
pi install npm:@kienxuandaoit89/pi-camoufox-browser
Or from the repo / a local checkout, after installing the workspace dependencies:
pi install git:github.com/kienxuandaoit89/my_pi_extensions
npm install
pi install ./pi-camoufox-browser
playwright-core must stay below 1.63: 1.65 sends a legacyInterceptor field in Browser.setDownloadOptions that the browser's Juggler rejects, and every newContext fails.
The first launch downloads the browser build (1.31 GB, one time) into ~/.cache/camoufox.
Configuration
Environment, read at launch:
| Variable | Default | Effect |
|---|---|---|
PI_CAMOUFOX_HEADLESS |
1 |
0 opens a visible window (needs a display) |
PI_CAMOUFOX_HUMANIZE |
1 |
0 sends Playwright's own input |
PI_CAMOUFOX_OS |
the host's | identity OS: windows, macos, linux |
PI_CAMOUFOX_PROFILE |
~/.pi/agent/camoufox/storage-state.json |
cookies and localStorage |
PI_CAMOUFOX_TIMEOUT_MS |
30000 |
default per-action timeout |
Claiming the host's OS keeps canvas and WebGL pixels real. Another OS turns on canvas noise and makes the browser read as a hardened one.
Usage
fox({action, ...}), one JSON action per call. {"action":"help"} lists the fields; the table below is the short version.
| Action | Fields | Result |
|---|---|---|
start |
url? |
launches the browser, optionally navigating |
status |
session, config, tabs | |
tabs |
ref_id, url, title per tab |
|
open / navigate |
url, new_tab? |
goes to the url, returns status and the final title |
show / close |
ref_id |
front / close one tab |
frames |
every frame: index, url, name, main |
|
click |
selector or x+y, frame?, ref_id?, force?, js_click? |
humanized click, reports via; x+y is a real mouse click at viewport coordinates |
type / fill |
selector, text, submit?, frame? |
humanized fill, Enter when submit |
press |
key, selector? |
Enter, Control+a |
scroll |
selector?, delta_y? |
into view, then a wheel |
wait |
selector?, url_includes?, text?, timeout_ms? |
|
html / text |
selector?, frame?, max_chars?, offset? |
outerHTML / innerText, paged |
snapshot |
selector?, frame?, max_chars?, offset? |
accessibility tree with @eN refs |
evaluate |
expression, frame?, main_world? |
JS in the page, returns the value |
network |
filter?, limit? |
requests seen in this tab |
console |
filter?, limit? |
console messages and page errors |
screenshot |
selector?, full_page?, path? |
PNG path under /tmp/pi-camoufox, image inline |
quit |
closes the browser |
selector is a Playwright selector: .item, #id, text=Sign in, role=button[name="Send"], xpath=//a[1] — or an @eN ref from snapshot.
frame scopes any of those to one frame: its index or a url/name/id substring from frames. A frame click goes through ElementHandle.click, because the humanized Locator.click adds the frame origin twice and lands tens of pixels below the target.
Rules that save a retry
- A challenge page answers first. Cloudflare returns
status: 403and titleVerifying Connection; the real page arrives about six seconds later. Callwaiton a selector from the real page, ortextagain, before deciding the site blocked you. - Click reports
via.humanizedis real input at the element's point.forceandjsare the escape hatches, and a failure names the overlay that covers the element: retry withjs_click: true(a DOM click) when a widget refuses the reach check. Trustpilot's tab strip is such a widget;js_clickscrolls the page exactly as a person's click does. - Snapshot before clicking.
snapshotreturns an accessibility tree with@eNrefs; pass one asselector. Refs die on navigation, so snapshot again afteropen. - Closed shadow roots have no selector. A Cloudflare Turnstile checkbox lives in a closed shadow root inside a frame:
snapshotdoes not show it,framesshows the frame but its context cannot be evaluated. Read the widget's box from the page (input[name="cf-turnstile-response"]and its ancestors), thenclickwithxandy. Headless Firefox never gets a reaction out of the widget; a headed browser (PI_CAMOUFOX_HEADLESS=0) does get hover feedback, so use headless for the non-interactive managed challenge and headless off when a checkbox must be pressed. - Duplicated elements. Sticky headers render the same control several times; the tool clicks the first copy that is on screen, not the first in the DOM.
evaluateruns in the page's own world (main_world: true), so it sees the page's own globals.main_world: falseruns in the isolated world: same DOM, no page variables.- No CDP. Firefox speaks Juggler, so there is no
rawaction. Everything elsebrowserdoes, Playwright does here. - The browser survives
/reload. The handle sits onglobalThis; a reload reuses it and only a real exit closes it. Cookies are saved toPI_CAMOUFOX_PROFILEafter each click, type and press, and on exit.
Skill
The package ships one skill, fox-browser (skills/fox-browser/SKILL.md), declared under pi.skills. Pi lists its name and description in the system prompt and loads the body only when a task matches, so the action/field matrix, the closed-shadow click recipe and the iframe rules stay out of context until they are needed. /skill:fox-browser forces it.
Test
npm test
Starts a local HTTP server, launches Camoufox, and checks help, launch, navigation, text/html, main-world evaluate, snapshot refs, click, fill, console, network capture, frame listing, a click inside a frame, a click at viewport coordinates, screenshot, tabs, close and quit. No external sites; exits non-zero on the first failure.
Live stealth check
npm run test:live
Opens Trustpilot (Cloudflare) and waits up to 30s for real content. Needs network and can fail when Cloudflare changes; not part of npm test. Override with FOX_LIVE_URL and FOX_LIVE_TEXT.
Also here: mcp.mjs
A one-line MCP server over the same driver (camoucore/mcp), registered as the camoufox server in ~/.pi/agent/mcp.json. It speaks a different surface — accessibility snapshots with @e refs, type_secret, hand_off — and is what session_open/snapshot/click refer to. It launches its own browser, separate from this extension's.
npm audit
npm audit reports 3 high findings through camoucore@0.6.3: @modelcontextprotocol/sdk@1.30.0 and zod@3.25.76 are pinned exactly by camoucore. The fixes are SDK 1.32.0 and zod 4.x; the audit's suggested "fix" is a downgrade to camoucore@0.3.0, which breaks this extension. The findings live in the MCP server/HTTP path used by mcp.mjs, not in the fox browser path. Leave them until camoucore updates.