browserpilot-cdp 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,176 @@
1
- # Temporary Holding Version
1
+ # BrowserPilot
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **Zero-click, pure-CDP Chrome Extension, MCP Server & CLI for AI Agents.**
4
+ > Control, inspect, and debug your real logged-in Chrome browser — no Playwright/Puppeteer runtime bloat, no per-tab icon clicking, and no repetitive Chrome `--autoConnect` "Allow" confirmation popups.
5
+
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
7
+
8
+ ---
9
+
10
+ ## Why BrowserPilot?
11
+
12
+ | Capability | Playwriter | Chrome DevTools MCP (`--autoConnect`) | Claude in Chrome | **BrowserPilot** |
13
+ | :--- | :---: | :---: | :---: | :---: |
14
+ | Uses your real logged-in Chrome (cookies, logins, extensions) | Yes | Yes | Yes | **Yes** |
15
+ | Zero clicks to attach to already-open tabs | No (click icon per tab) | No ("Allow" popup per connection) | Partial | **Yes (Zero-Click)** |
16
+ | Zero Playwright / Puppeteer runtime dependency | No | No (Puppeteer) | Yes | **Yes (100% Pure CDP)** |
17
+ | Chrome Native Messaging + Auth Token Daemon | No | No | Yes | **Yes (Dual Transport)** |
18
+ | Stateful JS Sandbox (`session new` / `exec -s 1 -e`) | Yes | No | No | **Yes** |
19
+ | First-class MCP Server (41 tools + image blocks) | Partial (1-tool execute) | Yes | Yes | **Yes** |
20
+ | Companion Side Panel + Action Highlights + Ghost Cursor | Partial | No | Yes | **Yes** |
21
+ | Deep DevTools (Console, Network, Fetch Mock, CSS Rules, Debugger, Live Edit, React Fiber, Web Vitals, Tracing, Video Recording) | Yes (most) | Yes (most) | Partial | **Yes (All Built-in)** |
22
+ | Direct CDP Mode (`--remote-debugging-port` for CI/Headless) | Yes | Yes | No | **Yes** |
23
+
24
+ ---
25
+
26
+ ## Architecture
27
+
28
+ ```text
29
+ AI Coding Agents (Claude Code / Cursor / Codex / Antigravity / Custom SDK)
30
+ │ MCP stdio (39 tools + images) / CLI (`browserpilot`) / TypeScript SDK
31
+ ▼
32
+ ┌──────────────────────────────────────────────────────────────────────────────┐
33
+ │ @browserpilot/server Authenticated Local Daemon (127.0.0.1 + 256-bit token) │
34
+ │ + Chrome Native Messaging Host (`com.browserpilot.bridge`) │
35
+ │ @browserpilot/core 100% Pure-CDP Engine (Trusted Input, AXTree, DevTools) │
36
+ └──────────────────────────┬───────────────────────────────┬───────────────────┘
37
+ │ Native Messaging (primary) │ Direct CDP WS
38
+ │ or Auth WebSocket (fallback) │ (--cdp <url>)
39
+ ▼ ▼
40
+ ┌─────────────────────────────────────────────┐ ┌────────────────────────────┐
41
+ │ @browserpilot/extension (Manifest V3) │ │ Chrome / Chromium │
42
+ │ • Zero-click chrome.debugger (CDP v1.3) │ │ --remote-debugging-port │
43
+ │ • OOPIF iframes & popup Tab Groups │ └────────────────────────────┘
44
+ │ • Closed-Shadow-DOM highlight & cursor │
45
+ │ • Companion Side Panel + Domain Safety │
46
+ └─────────────────────────────────────────────┘
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Quick Start (1 Minute)
52
+
53
+ ### Option 1: Install from npm (Recommended)
54
+
55
+ ```bash
56
+ npm install -g browserpilot-cdp
57
+ browserpilot setup
58
+ ```
59
+
60
+ 1. Open `chrome://extensions` in Chrome, enable **Developer mode**, click **Load unpacked**, and select the bundled `extension/` path printed by `browserpilot setup`.
61
+ 2. Copy the Extension ID from Chrome and run:
62
+ ```bash
63
+ browserpilot setup --extension-id <YOUR_EXTENSION_ID>
64
+ ```
65
+ 3. Add `browserpilot` to your AI coding agent MCP config (Claude Code / Cursor / Codex / Antigravity):
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "browserpilot": {
70
+ "command": "npx",
71
+ "args": ["-y", "browserpilot-cdp@latest", "mcp"]
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ ### Option 2: Build from Source
78
+
79
+ ```bash
80
+ git clone https://github.com/xy-tuoren/browserpilot.git
81
+ cd browserpilot
82
+ pnpm install
83
+ pnpm build
84
+ node packages/server/dist/cli.js setup
85
+ ```
86
+
87
+ Or connect directly to a `--remote-debugging-port` Chrome without an extension:
88
+
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "browserpilot": {
93
+ "command": "npx",
94
+ "args": ["-y", "browserpilot-cdp@latest", "mcp", "--cdp", "http://127.0.0.1:9222"]
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ ---
101
+
102
+ ## CLI Usage (Drop-in Playwriter Replacement)
103
+
104
+ ### Stateful Multi-Step Sandbox
105
+ ```bash
106
+ # Create an isolated session grouped into its own Chrome Tab Group
107
+ browserpilot session new --tab-group app --tab-group-color cyan
108
+ # => 1
109
+
110
+ # Execute stateful JS with full pure-CDP & DevTools helpers
111
+ browserpilot exec -s 1 -e '
112
+ const t = await tabs.open("http://localhost:3000");
113
+ state.tab = t;
114
+ console.log(await snapshot({ tab: t }));
115
+ '
116
+
117
+ # Reuse state across calls
118
+ browserpilot exec -s 1 -e '
119
+ await state.tab.page.fill("e3", "alice@example.com");
120
+ await state.tab.page.click("e4");
121
+ console.log(await getLatestLogs({ tab: state.tab, sinceLastCall: true }));
122
+ '
123
+ ```
124
+
125
+ ### Direct One-Liner Shortcuts
126
+ ```bash
127
+ browserpilot tabs # List all open Chrome tabs
128
+ browserpilot open https://example.com # Open & auto-attach a tab
129
+ browserpilot snapshot --search "Sign in" # Semantic AXTree with refs + auto-diff
130
+ browserpilot click e3 # Trusted CDP mouse click (isTrusted=true)
131
+ browserpilot fill e4 "hello world" # SPA-safe trusted text input
132
+ browserpilot screenshot ./page.png --full-page # CSS-scaled screenshot
133
+ browserpilot labeled-screenshot ./som.png # Vimium-style Set-of-Mark labeled shot
134
+ browserpilot console --level error --since-last # Incremental console errors & exceptions
135
+ browserpilot network --failed # Failed HTTP requests + initiator stack
136
+ browserpilot styles "#submit-btn" # DevTools Styles cascade (file:line)
137
+ browserpilot react "#submit-btn" # React Fiber component + _debugSource
138
+ browserpilot perf metrics # Core Web Vitals + CDP metrics
139
+ browserpilot skill # Print full Agent Skill instructions
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Complete MCP Tool Matrix (41 Tools)
145
+
146
+ | Category | Tools |
147
+ | :--- | :--- |
148
+ | **Browser & Tabs** | `browser_status`, `browser_tabs`, `browser_open_tab`, `browser_close_tab`, `browser_select_tab` |
149
+ | **Navigation & Perception** | `browser_navigate`, `browser_history`, `browser_snapshot`, `browser_screenshot`, `browser_labeled_screenshot`, `browser_clean_html`, `browser_markdown`, `browser_inspect_element`, `browser_pinned` |
150
+ | **Trusted Interaction** | `browser_click`, `browser_fill`, `browser_type`, `browser_press_key`, `browser_hover`, `browser_scroll`, `browser_drag`, `browser_select_option`, `browser_upload_file`, `browser_handle_dialog`, `browser_wait`, `browser_batch` |
151
+ | **DevTools Debugging** | `browser_evaluate`, `browser_console`, `browser_network`, `browser_network_intercept`, `browser_styles`, `browser_react_info`, `browser_debugger`, `browser_live_edit`, `browser_performance`, `browser_emulate`, `browser_cookies`, `browser_storage`, `browser_cdp` |
152
+ | **Media & Sandbox** | `browser_record`, `browser_exec` |
153
+
154
+ ---
155
+
156
+ ## Safety & Built-in Guards
157
+
158
+ 1. **Profile-Wide Wipe Protection**: Destructive CDP commands (`Network.clearBrowserCookies`, `Network.clearBrowserCache`) are blocked at both the core engine and extension layers so an agent can never log you out of your browser profile.
159
+ 2. **Domain Allowlist / Denylist**: Configure blocked domains (e.g., `*.bank.com`) directly in the extension popup.
160
+ 3. **Instant Pause Kill-Switch**: One click in the popup or Side Panel immediately pauses all auto-attach and CDP execution.
161
+ 4. **Local-Only Authenticated Bridge**: Binds strictly to `127.0.0.1` with a 256-bit random token stored in `~/.browserpilot/daemon.json` (`0600`), or uses extension-ID-locked Chrome Native Messaging.
162
+ 5. **Chrome Transparency**: Because BrowserPilot uses Chrome's documented `chrome.debugger` API, Chrome displays its standard debugging infobar while attached (or launch a dedicated local dev Chrome with `--silent-debugger-extension-api` / `browserpilot browser start`).
163
+
164
+ ---
165
+
166
+ ## Packages
167
+
168
+ - [`packages/protocol`](./packages/protocol) — Shared types, JSON-RPC bridge schema, Native Messaging framing codec, and security guards.
169
+ - [`packages/core`](./packages/core) — 100% pure-CDP automation, perception, DevTools debugging suite, ffmpeg recorder, and stateful sandbox.
170
+ - [`packages/extension`](./packages/extension) — Zero-click Chrome Manifest V3 extension with closed-Shadow-DOM overlays, Popup, and Companion Side Panel.
171
+ - [`packages/server`](./packages/server) — Authenticated Local Daemon, Chrome Native Messaging Host & installer, MCP Server, CLI, and TypeScript SDK.
172
+ - [`skills/browserpilot/SKILL.md`](./skills/browserpilot/SKILL.md) — Ready-to-deploy skill instructions for AI coding agents.
173
+
174
+ ## License
175
+
176
+ [MIT](./LICENSE) — see [CHANGELOG.md](./CHANGELOG.md) for full iteration history.