Skip to main content
Glama
README.md
# Browser-Pilot (`bp`)

**Ultra-fast, high-accuracy, zero-LLM-lock-in Native CDP Interactive Browser QA Engine for AI Agents.**

[中文文档](./README.zh-CN.md)

Browser-Pilot (`bp`) replaces fragile "write a blind test script -> crash -> edit selector -> re-run from step 1" loops with a **persistent, human-like `Observe -> Act -> Verify` engine** driven directly over Chromium's native DevTools Protocol (`--remote-debugging-pipe` & WebSockets).

## Key Highlights

- **Zero Playwright / Puppeteer Overhead**: Direct native CDP multiplexer over OS anonymous/named pipes (`stdio[3]/stdio[4]`) + `< 1ms` local Named Pipe / Unix Socket daemon IPC.
- **4-Way Perception Fusion**: Merges `DOMSnapshot` (`paintOrders` Z-stacking) + `Accessibility.getFullAXTree` + In-Page Framework Probe (`__reactProps$`, Vue `@click`, `contenteditable`) + Set-of-Mark (`[e12]`) visual grounding.
- **Mathematical Occlusion & Safe-Point Solver**: Automatically hides background controls blocked by modals and computes quadrant safe-click points when badges cover an element's center.
- **Incremental Structural Delta**: Sends compact UI diffs on in-page interactions, cutting context tokens by **80%–90%**.
- **Guarded Micro-Batching**: Execute deterministic multi-field form sequences in a single LLM turn with sub-millisecond circuit-breaker protection on unexpected modals or errors.
- **Zero Silent Failures (`NO_EFFECT` Verifier) & Full-Stack Telemetry**: Automatically detects no-op clicks (with 1 hydration-gap auto-retry), ignores persistent SSE/WebSocket streams during adaptive `~32ms` settle, and surfaces `HTTP 4xx/5xx`, **HTTP 200 JSON Soft-API Errors** (`{ code: 5001, success: false }`), and Console exceptions on every receipt.
- **Dual Interface (CLI + 6-Tool Lean MCP) + 1-Command Multi-Agent Skill Installer**: Works out of the box with **Claude Code**, **OpenAI Codex**, **OpenCode**, and **Antigravity**.

## Quick Start

```bash
npm install
npm run build
npm link   # Exposes `bp` and `bp-mcp` globally

# Install interactive QA skills, MCP & anti-blind-script rules globally for GitHub Copilot (IntelliJ/VS Code), Claude Code, Codex, OpenCode & Antigravity:
bp install-skills --global --with-rules --with-mcp
```

## Core CLI Usage

```bash
# 1. Open persistent headed browser (or attach to live Chrome 144+ / Extension)
bp open http://localhost:3000 --role officer
# bp attach --chrome

# 2. Observe semantic tree or Set-of-Mark annotated screenshot
bp obs --full
bp obs --som ./reports/som.webp

# 3. Act step-by-step or run Guarded Micro-Batches
bp act click e12
bp act fill e5 "EA26110004" --submit
bp batch '[{"op":"fill","ref":"e3","value":"admin"},{"op":"fill","ref":"e4","value":"123456"},{"op":"click","ref":"e5"}]'

# 4. Assert UI + zero API/Console anomalies & export visual HTML report
bp assert --visible "Saved Successfully" --no-errors
bp report --out ./reports/qa-report.html --export-spec ./e2e/verified.spec.ts
bp close
```

## MCP Configuration (`mcp_config.json`)

```json
{
  "mcpServers": {
    "browser-pilot": {
      "command": "node",
      "args": ["D:/IdeaProjects/browser-pilot/dist/mcp.js"]
    }
  }
}
```