Browser Harness JS gives an LLM agent direct access to Chrome through the Chrome DevTools Protocol (CDP), with no intermediate helper layer. Instead of click(), goto(), or upload_file() wrappers, the agent writes the CDP call itself, for example session.Input.dispatchMouseEvent({...}), using typed wrappers generated for every method in the protocol.
The package holds one persistent WebSocket session across 56 domains and 652 typed methods. Types are generated from the upstream browserprotocol.json and jsprotocol.json, so autocomplete shows the exact parameters with the same JSDoc as the CDP reference, and new Chrome methods appear when you swap in newer protocol files.
It ships as an agent skill with a small CLI that spawns a Bun HTTP server holding the session and forwards code snippets to it. The design argument is that every helper hides parameters CDP already exposes: Input.dispatchMouseEvent has 14, and a wrapper that surfaces three limits the agent.
Features
- Full protocol surface: every CDP method as session. . (params), typed
- Persistent session: one WebSocket connection shared across calls, held by a local REPL server
- Codegen: sdk/gen.ts regenerates wrappers from the protocol JSON, avoiding version drift
- Minimal routing primitives: session.use(targetId) and session.waitFor(method, predicate, timeout)
- Gap fillers: listPageTargets() filters out chrome:// and devtools:// targets, and resolveWsUrl() reads DevToolsActivePort for Chrome 144+
- Interaction skills: a directory of pure-CDP recipes for non-obvious mechanics such as dropdown frameworks, shadow DOM, and network waits
