opendevbrowser 0.0.11 → 0.0.15
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 +21 -0
- package/README.md +289 -28
- package/dist/chunk-JVBMT2O5.js +7173 -0
- package/dist/chunk-JVBMT2O5.js.map +1 -0
- package/dist/cli/index.js +3690 -275
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +1080 -2857
- package/dist/index.js.map +1 -1
- package/dist/opendevbrowser.js +1080 -2857
- package/dist/opendevbrowser.js.map +1 -1
- package/extension/dist/annotate-content.css +237 -0
- package/extension/dist/annotate-content.js +934 -0
- package/extension/dist/background.js +1291 -8
- package/extension/dist/logging.js +50 -0
- package/extension/dist/ops/dom-bridge.js +355 -0
- package/extension/dist/ops/ops-runtime.js +1249 -0
- package/extension/dist/ops/ops-session-store.js +189 -0
- package/extension/dist/ops/redaction.js +52 -0
- package/extension/dist/ops/snapshot-builder.js +4 -0
- package/extension/dist/ops/snapshot-shared.js +220 -0
- package/extension/dist/popup.js +398 -21
- package/extension/dist/relay-settings.js +3 -1
- package/extension/dist/services/CDPRouter.js +501 -103
- package/extension/dist/services/ConnectionManager.js +464 -57
- package/extension/dist/services/NativePortManager.js +182 -0
- package/extension/dist/services/RelayClient.js +227 -26
- package/extension/dist/services/TabManager.js +81 -0
- package/extension/dist/services/TargetSessionMap.js +146 -0
- package/extension/dist/services/cdp-router-commands.js +203 -0
- package/extension/dist/services/url-restrictions.js +41 -0
- package/extension/dist/types.js +3 -1
- package/extension/icons/icon128.png +0 -0
- package/extension/icons/icon16.png +0 -0
- package/extension/icons/icon32.png +0 -0
- package/extension/icons/icon48.png +0 -0
- package/extension/manifest.json +17 -3
- package/extension/popup.html +469 -65
- package/package.json +2 -2
- package/skills/AGENTS.md +34 -61
- package/skills/data-extraction/SKILL.md +95 -103
- package/skills/form-testing/SKILL.md +75 -82
- package/skills/login-automation/SKILL.md +76 -66
- package/skills/opendevbrowser-best-practices/SKILL.md +90 -49
- package/skills/opendevbrowser-continuity-ledger/SKILL.md +57 -23
- package/dist/chunk-R5VUZEUU.js +0 -128
- package/dist/chunk-R5VUZEUU.js.map +0 -1
- package/extension/dist/popup.jsx +0 -150
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OpenDevBrowser contributors
|
|
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
|
@@ -4,11 +4,45 @@
|
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
[](https://opencode.ai)
|
|
7
|
-
[](docs/CLI.md)
|
|
8
|
+
[](docs/EXTENSION.md)
|
|
9
|
+
[](https://registry.npmjs.org/opendevbrowser)
|
|
8
10
|
|
|
9
11
|
> **Script-first browser automation for AI agents.** Snapshot → Refs → Actions.
|
|
10
12
|
|
|
11
|
-
OpenDevBrowser is an [OpenCode](https://opencode.ai) plugin
|
|
13
|
+
OpenDevBrowser is an agent-agnostic browser automation runtime. You can use it as an [OpenCode](https://opencode.ai) plugin, as a standalone CLI, or through the Chrome extension relay for logged-in browser sessions. It supports managed sessions, direct CDP attach, and extension-backed Ops sessions.
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<img src="assets/readme-image-candidates/2026-02-08/04-annotation-automation-scene.jpg" alt="OpenDevBrowser hero image showing AI-assisted annotation and browser automation workflow" width="920" />
|
|
17
|
+
<br />
|
|
18
|
+
<em>AI-assisted annotation and browser automation workflow</em>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
## Use It Your Way
|
|
22
|
+
|
|
23
|
+
| Interface | OpenCode Required | Best For |
|
|
24
|
+
|-----------|-------------------|----------|
|
|
25
|
+
| **CLI (`npx opendevbrowser ...`)** | No | Any agent/workflow that can run shell commands |
|
|
26
|
+
| **Chrome Extension + Relay** | No | Reusing existing logged-in tabs without launching a new browser |
|
|
27
|
+
| **OpenCode Plugin Tools** | Yes | Native tool-calling inside OpenCode (`opendevbrowser_*`) |
|
|
28
|
+
|
|
29
|
+
All core automation flows are available through the CLI command surface and the plugin tool surface.
|
|
30
|
+
|
|
31
|
+
## Why OpenDevBrowser?
|
|
32
|
+
|
|
33
|
+
| Feature | Benefit |
|
|
34
|
+
|---------|---------|
|
|
35
|
+
| **Script-first UX** | Snapshot → Refs → Actions workflow optimized for AI agents |
|
|
36
|
+
| **Accessibility-tree snapshots** | Token-efficient page representation (not raw DOM) |
|
|
37
|
+
| **Stable refs** | Elements identified by `backendNodeId`, not fragile selectors |
|
|
38
|
+
| **Security by default** | CDP localhost-only, timing-safe auth, HTML sanitization |
|
|
39
|
+
| **3 browser modes** | Managed, CDP connect, or extension relay for logged-in sessions |
|
|
40
|
+
| **Ops + CDP channels** | High-level multi-client `/ops` plus legacy `/cdp` compatibility |
|
|
41
|
+
| **Relay Hub (FIFO leases)** | Single-owner CDP binding with a FIFO queue for multi-client safety |
|
|
42
|
+
| **Flat-session routing** | Extension relay uses DebuggerSession sessionId routing (Chrome 125+) |
|
|
43
|
+
| **5 bundled skill packs** | Best practices for login, forms, data extraction |
|
|
44
|
+
| **41 tools** | Complete browser automation coverage |
|
|
45
|
+
| **97% test coverage** | Production-ready with strict TypeScript |
|
|
12
46
|
|
|
13
47
|
---
|
|
14
48
|
|
|
@@ -28,10 +62,26 @@ npx opendevbrowser --local # ./opencode.json
|
|
|
28
62
|
npx opendevbrowser --full
|
|
29
63
|
```
|
|
30
64
|
|
|
31
|
-
|
|
65
|
+
Use OpenCode only if you want plugin tools. CLI and extension workflows work without OpenCode.
|
|
66
|
+
|
|
67
|
+
On first successful install, the CLI attempts to install daemon auto-start on supported platforms so the relay is available on login.
|
|
68
|
+
You can remove it later with `npx opendevbrowser daemon uninstall`.
|
|
32
69
|
|
|
33
70
|
OpenCode discovers skills in `.opencode/skill` (project) and `~/.config/opencode/skill` (global) first; `.claude/skills` is compatibility-only. The CLI installs bundled skills into the OpenCode-native locations by default.
|
|
34
71
|
|
|
72
|
+
### CLI + Extension (No OpenCode)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Start relay/daemon runtime
|
|
76
|
+
npx opendevbrowser serve
|
|
77
|
+
|
|
78
|
+
# Launch using extension mode (requires extension popup connected)
|
|
79
|
+
npx opendevbrowser launch --extension-only --wait-for-extension
|
|
80
|
+
|
|
81
|
+
# Or force managed mode without extension
|
|
82
|
+
npx opendevbrowser launch --no-extension
|
|
83
|
+
```
|
|
84
|
+
|
|
35
85
|
### Agent Installation (OpenCode)
|
|
36
86
|
|
|
37
87
|
Recommended (CLI, installs plugin + config + bundled skills + extension assets):
|
|
@@ -57,12 +107,14 @@ Manual fallback (edit OpenCode config):
|
|
|
57
107
|
|
|
58
108
|
Config location: `~/.config/opencode/opencode.json`
|
|
59
109
|
|
|
60
|
-
Restart OpenCode, then run `opendevbrowser_status` to verify the plugin is loaded.
|
|
110
|
+
Restart OpenCode, then run `opendevbrowser_status` to verify the plugin is loaded (daemon status when hub is enabled).
|
|
61
111
|
|
|
62
112
|
---
|
|
63
113
|
|
|
64
114
|
## Quick Start
|
|
65
115
|
|
|
116
|
+
OpenDevBrowser uses the same automation model across plugin tools and CLI commands:
|
|
117
|
+
|
|
66
118
|
```
|
|
67
119
|
1. Launch a browser session
|
|
68
120
|
2. Navigate to a URL
|
|
@@ -71,18 +123,70 @@ Restart OpenCode, then run `opendevbrowser_status` to verify the plugin is loade
|
|
|
71
123
|
5. Re-snapshot after navigation
|
|
72
124
|
```
|
|
73
125
|
|
|
74
|
-
### Core Workflow
|
|
126
|
+
### Core Workflow (Plugin Tools)
|
|
75
127
|
|
|
76
128
|
| Step | Tool | Purpose |
|
|
77
129
|
|------|------|---------|
|
|
78
|
-
| 1 | `opendevbrowser_launch` |
|
|
130
|
+
| 1 | `opendevbrowser_launch` | Launch a session (extension relay first; managed fallback is explicit) |
|
|
79
131
|
| 2 | `opendevbrowser_goto` | Navigate to URL |
|
|
80
132
|
| 3 | `opendevbrowser_snapshot` | Get page structure with refs |
|
|
81
133
|
| 4 | `opendevbrowser_click` / `opendevbrowser_type` | Interact with elements |
|
|
82
|
-
| 5 | `
|
|
134
|
+
| 5 | `opendevbrowser_disconnect` | Clean up session |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### CLI Automation Quick Start
|
|
139
|
+
|
|
140
|
+
Run a local daemon for persistent sessions, then drive automation via CLI commands:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Start daemon
|
|
144
|
+
npx opendevbrowser serve
|
|
145
|
+
|
|
146
|
+
# Install auto-start (recommended for resilience)
|
|
147
|
+
npx opendevbrowser daemon install
|
|
148
|
+
|
|
149
|
+
# Stop/kill the daemon before restarting
|
|
150
|
+
npx opendevbrowser serve --stop
|
|
151
|
+
|
|
152
|
+
# Launch a session
|
|
153
|
+
npx opendevbrowser launch --start-url https://example.com
|
|
154
|
+
|
|
155
|
+
# Capture a snapshot
|
|
156
|
+
npx opendevbrowser snapshot --session-id <session-id>
|
|
157
|
+
|
|
158
|
+
# Interact by ref
|
|
159
|
+
npx opendevbrowser click --session-id <session-id> --ref r12
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
For single-shot scripts:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npx opendevbrowser run --script ./script.json --output-format json
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Use `--output-format json|stream-json` for automation-friendly output.
|
|
83
169
|
|
|
84
170
|
---
|
|
85
171
|
|
|
172
|
+
## Recent Features
|
|
173
|
+
|
|
174
|
+
### v0.0.15 (Latest)
|
|
175
|
+
|
|
176
|
+
- **Documentation and release readiness refresh** across README/CLI/extension guidance.
|
|
177
|
+
- **Extension mode stabilization** with stronger native host flow and recovery paths.
|
|
178
|
+
- **Ops/CDP hardening** for disconnect cleanup and extension routing reliability.
|
|
179
|
+
- **Coverage expansion** for browser/target/native workflows while preserving the 97% threshold.
|
|
180
|
+
|
|
181
|
+
### v0.0.14
|
|
182
|
+
|
|
183
|
+
- **Ops parity delivery** across daemon, relay, and extension runtime paths.
|
|
184
|
+
- **New automation surface**: expanded DOM query + interaction commands/tools.
|
|
185
|
+
- **Multi-client/session improvements** in core tracking and extension router behavior.
|
|
186
|
+
- **Security and reliability hardening** for relay + daemon connection handling.
|
|
187
|
+
|
|
188
|
+
See [CHANGELOG.md](CHANGELOG.md) for complete version history.
|
|
189
|
+
|
|
86
190
|
## Features
|
|
87
191
|
|
|
88
192
|
### Browser Control
|
|
@@ -101,8 +205,8 @@ Restart OpenCode, then run `opendevbrowser_status` to verify the plugin is loade
|
|
|
101
205
|
|
|
102
206
|
### DevTools Integration
|
|
103
207
|
- **Console Capture** - Monitor console.log, errors, warnings
|
|
104
|
-
- **Network Tracking** -
|
|
105
|
-
- **Screenshot** -
|
|
208
|
+
- **Network Tracking** - Request/response metadata (method, url, status)
|
|
209
|
+
- **Screenshot** - Viewport PNG screenshot (file or base64)
|
|
106
210
|
- **Performance** - Page load metrics
|
|
107
211
|
|
|
108
212
|
### Export & Clone
|
|
@@ -114,15 +218,16 @@ Restart OpenCode, then run `opendevbrowser_status` to verify the plugin is loade
|
|
|
114
218
|
|
|
115
219
|
## Tool Reference
|
|
116
220
|
|
|
117
|
-
OpenDevBrowser provides **
|
|
221
|
+
OpenDevBrowser provides **41 tools** organized by category:
|
|
222
|
+
Most runtime actions also have CLI command equivalents (see [docs/CLI.md](docs/CLI.md)).
|
|
118
223
|
|
|
119
224
|
### Session Management
|
|
120
225
|
| Tool | Description |
|
|
121
226
|
|------|-------------|
|
|
122
|
-
| `opendevbrowser_launch` | Launch
|
|
123
|
-
| `opendevbrowser_connect` | Connect to existing Chrome CDP endpoint |
|
|
227
|
+
| `opendevbrowser_launch` | Launch a session (extension relay first; managed is explicit) |
|
|
228
|
+
| `opendevbrowser_connect` | Connect to existing Chrome CDP endpoint (or relay `/ops`; legacy `/cdp` via `--extension-legacy`) |
|
|
124
229
|
| `opendevbrowser_disconnect` | Disconnect browser session |
|
|
125
|
-
| `opendevbrowser_status` | Get session status and connection info |
|
|
230
|
+
| `opendevbrowser_status` | Get session status and connection info (daemon status in hub mode) |
|
|
126
231
|
|
|
127
232
|
### Tab/Target Management
|
|
128
233
|
| Tool | Description |
|
|
@@ -146,9 +251,14 @@ OpenDevBrowser provides **30 tools** organized by category:
|
|
|
146
251
|
| `opendevbrowser_wait` | Wait for load state or element |
|
|
147
252
|
| `opendevbrowser_snapshot` | Capture page accessibility tree with refs |
|
|
148
253
|
| `opendevbrowser_click` | Click element by ref |
|
|
254
|
+
| `opendevbrowser_hover` | Hover element by ref |
|
|
255
|
+
| `opendevbrowser_press` | Press a keyboard key (optionally focusing a ref) |
|
|
256
|
+
| `opendevbrowser_check` | Check checkbox/toggle by ref |
|
|
257
|
+
| `opendevbrowser_uncheck` | Uncheck checkbox/toggle by ref |
|
|
149
258
|
| `opendevbrowser_type` | Type text into input by ref |
|
|
150
259
|
| `opendevbrowser_select` | Select dropdown option by ref |
|
|
151
260
|
| `opendevbrowser_scroll` | Scroll page or element |
|
|
261
|
+
| `opendevbrowser_scroll_into_view` | Scroll element into view by ref |
|
|
152
262
|
| `opendevbrowser_run` | Execute multiple actions in sequence |
|
|
153
263
|
|
|
154
264
|
### DOM Inspection
|
|
@@ -156,6 +266,11 @@ OpenDevBrowser provides **30 tools** organized by category:
|
|
|
156
266
|
|------|-------------|
|
|
157
267
|
| `opendevbrowser_dom_get_html` | Get outerHTML of element by ref |
|
|
158
268
|
| `opendevbrowser_dom_get_text` | Get innerText of element by ref |
|
|
269
|
+
| `opendevbrowser_get_attr` | Get attribute value by ref |
|
|
270
|
+
| `opendevbrowser_get_value` | Get input value by ref |
|
|
271
|
+
| `opendevbrowser_is_visible` | Check if element is visible |
|
|
272
|
+
| `opendevbrowser_is_enabled` | Check if element is enabled |
|
|
273
|
+
| `opendevbrowser_is_checked` | Check if element is checked |
|
|
159
274
|
|
|
160
275
|
### DevTools & Analysis
|
|
161
276
|
| Tool | Description |
|
|
@@ -166,6 +281,11 @@ OpenDevBrowser provides **30 tools** organized by category:
|
|
|
166
281
|
| `opendevbrowser_perf` | Get page performance metrics |
|
|
167
282
|
| `opendevbrowser_prompting_guide` | Get best-practice prompting guidance |
|
|
168
283
|
|
|
284
|
+
### Annotation
|
|
285
|
+
| Tool | Description |
|
|
286
|
+
|------|-------------|
|
|
287
|
+
| `opendevbrowser_annotate` | Capture interactive annotations via extension relay |
|
|
288
|
+
|
|
169
289
|
### Export & Cloning
|
|
170
290
|
| Tool | Description |
|
|
171
291
|
|------|-------------|
|
|
@@ -211,31 +331,99 @@ Load a skill: `opendevbrowser_skill_load` with `name` and optional `topic` filte
|
|
|
211
331
|
| **CDP Connect** | `opendevbrowser_connect` | Attach to existing Chrome with `--remote-debugging-port` |
|
|
212
332
|
| **Extension Relay** | Chrome Extension | Attach to logged-in tabs via relay server |
|
|
213
333
|
|
|
334
|
+
Default behavior: `opendevbrowser_launch` prefers **Extension Relay** when available. Use `--no-extension` (and `--headless` if desired) for managed sessions.
|
|
335
|
+
|
|
336
|
+
Extension relay relies on **flat CDP sessions (Chrome 125+)** and uses DebuggerSession `sessionId` routing for multi-tab and child-target support. When hub mode is enabled, the hub daemon is the sole relay owner and there is **no local relay fallback**.
|
|
337
|
+
|
|
338
|
+
Relay ops endpoint: `ws://127.0.0.1:<relayPort>/ops`.
|
|
339
|
+
The connect command also accepts base relay WS URLs (`ws://127.0.0.1:<relayPort>` or `ws://localhost:<relayPort>`) and normalizes them to `/ops`.
|
|
340
|
+
Legacy relay `/cdp` remains available with explicit opt-in (`--extension-legacy`).
|
|
341
|
+
When pairing is enabled, both `/ops` and `/cdp` require a relay token (`?token=<relayToken>`). Tools and the CLI auto-fetch relay config and tokens.
|
|
342
|
+
|
|
343
|
+
## Ops vs CDP
|
|
344
|
+
|
|
345
|
+
| Channel | What It Does | When to Use It |
|
|
346
|
+
|---------|---------------|----------------|
|
|
347
|
+
| **`/ops` (default)** | High-level automation protocol with session ownership, event streaming, and multi-client handling | Preferred extension relay path for modern workflows |
|
|
348
|
+
| **`/cdp` (legacy)** | Low-level CDP relay path with compatibility-focused behavior | Opt-in compatibility mode (`--extension-legacy`) |
|
|
349
|
+
| **Direct CDP connect** | Attach to Chrome started with `--remote-debugging-port` | Existing debug/browser setups without extension relay |
|
|
350
|
+
|
|
214
351
|
---
|
|
215
352
|
|
|
353
|
+
## Breaking Changes (latest)
|
|
354
|
+
|
|
355
|
+
- `opendevbrowser_launch` now prefers the extension relay by default. Use `--no-extension` (and `--headless` if desired) for managed sessions.
|
|
356
|
+
- Relay `/ops` (default) and legacy `/cdp` both require a token when pairing is enabled; tools/CLI handle this automatically.
|
|
357
|
+
|
|
216
358
|
## Chrome Extension (Optional)
|
|
217
359
|
|
|
218
|
-
The extension enables **
|
|
360
|
+
The extension enables **Extension Relay** mode - attach to existing logged-in browser tabs without launching a new browser.
|
|
361
|
+
|
|
362
|
+
**Requirements:** Chrome 125+ (flat CDP sessions). Older versions will fail fast with a clear error.
|
|
219
363
|
|
|
220
|
-
### Auto-Pair
|
|
364
|
+
### Auto-Connect + Auto-Pair
|
|
221
365
|
|
|
222
|
-
The plugin and extension can automatically pair:
|
|
366
|
+
The runtime (plugin or CLI daemon) and extension can automatically pair:
|
|
223
367
|
|
|
224
|
-
1. **
|
|
368
|
+
1. **Runtime side**: Starts a local relay server and config discovery endpoint
|
|
225
369
|
2. **Extension side**: Enable "Auto-Pair" toggle and click Connect
|
|
226
370
|
3. Extension fetches relay port from discovery, then fetches token from the relay server
|
|
227
371
|
4. Connection established with color indicator (green = connected)
|
|
228
372
|
|
|
373
|
+
**Auto-connect** and **Auto-pair** are enabled by default for a seamless setup. The extension badge shows status (ON/OFF).
|
|
374
|
+
If the relay is unavailable, the background worker retries `/config` + `/pair` with exponential backoff (using `chrome.alarms`).
|
|
375
|
+
|
|
376
|
+
### Default Settings (Extension)
|
|
377
|
+
|
|
378
|
+
| Setting | Default |
|
|
379
|
+
|---------|---------|
|
|
380
|
+
| Relay port | `8787` |
|
|
381
|
+
| Auto-connect | `true` |
|
|
382
|
+
| Auto-pair | `true` |
|
|
383
|
+
| Require pairing token | `true` |
|
|
384
|
+
| Pairing token | `null` (fetched on connect) |
|
|
385
|
+
|
|
386
|
+
### Connection Flow (Extension Relay)
|
|
387
|
+
|
|
388
|
+
1. Extension checks the discovery endpoint at `http://127.0.0.1:8787/config`.
|
|
389
|
+
2. It learns the relay port and whether pairing is required.
|
|
390
|
+
3. If pairing is required and Auto-pair is on, it fetches the token from `http://127.0.0.1:<relayPort>/pair`.
|
|
391
|
+
4. It connects to `ws://127.0.0.1:<relayPort>/extension` using the extension origin.
|
|
392
|
+
|
|
393
|
+
`/config` and `/pair` accept loopback requests with no `Origin` (including `Origin: null`) to support MV3 + PNA; non-extension origins are still rejected, and preflights include `Access-Control-Allow-Private-Network: true`.
|
|
394
|
+
|
|
395
|
+
### Troubleshooting: Extension Won't Connect
|
|
396
|
+
|
|
397
|
+
- Ensure the active tab is a normal `http(s)` page (not `chrome://` or extension pages).
|
|
398
|
+
- Confirm `relayPort` and `relayToken` in `~/.config/opencode/opendevbrowser.jsonc` match the popup (Auto-pair should fetch the token).
|
|
399
|
+
- If `relayPort` is `0`, the relay is off.
|
|
400
|
+
- `relayToken: false` disables relay/hub behavior entirely.
|
|
401
|
+
- `relayToken: ""` (empty string) keeps relay enabled but disables pairing requirements.
|
|
402
|
+
- Install auto-start with `npx opendevbrowser daemon install` so the relay is available on login.
|
|
403
|
+
- Clear extension local data and retry if the token/port seem stuck.
|
|
404
|
+
- If another process owns the port, change `relayPort` or stop it; `opencode` listening is expected.
|
|
405
|
+
|
|
229
406
|
### Manual Setup
|
|
230
407
|
|
|
231
|
-
1.
|
|
408
|
+
1. Ensure extension assets exist by running either:
|
|
409
|
+
- `npx opendevbrowser --full` (installer path), or
|
|
410
|
+
- `npm run extension:build` (repo/dev path)
|
|
232
411
|
2. Load unpacked from `~/.config/opencode/opendevbrowser/extension`
|
|
233
412
|
(fallback: `~/.cache/opencode/node_modules/opendevbrowser/extension`).
|
|
234
413
|
3. Open extension popup
|
|
235
|
-
4. Enter the same relay port and token as the
|
|
414
|
+
4. Enter the same relay port and token as the runtime config
|
|
236
415
|
(if `relayToken` is missing, either add one to `opendevbrowser.jsonc` or use Auto-Pair).
|
|
237
416
|
5. Click Connect
|
|
238
417
|
|
|
418
|
+
### Where Extension Assets Live
|
|
419
|
+
|
|
420
|
+
Extension assets are bundled inside the NPM package and extracted on install/startup:
|
|
421
|
+
|
|
422
|
+
- Primary: `~/.config/opencode/opendevbrowser/extension`
|
|
423
|
+
- Fallback: `~/.cache/opencode/node_modules/opendevbrowser/extension`
|
|
424
|
+
|
|
425
|
+
Extraction is handled by `extractExtension()` (see `src/extension-extractor.ts`).
|
|
426
|
+
|
|
239
427
|
---
|
|
240
428
|
|
|
241
429
|
## Configuration
|
|
@@ -292,17 +480,27 @@ Optional config file: `~/.config/opencode/opendevbrowser.jsonc`
|
|
|
292
480
|
"relayPort": 8787,
|
|
293
481
|
"relayToken": "auto-generated-on-first-run",
|
|
294
482
|
|
|
483
|
+
// Hub daemon (relay ownership + FIFO queue)
|
|
484
|
+
"daemonPort": 8788,
|
|
485
|
+
"daemonToken": "auto-generated-on-first-run",
|
|
486
|
+
|
|
295
487
|
// Updates
|
|
296
488
|
"checkForUpdates": false
|
|
297
489
|
}
|
|
298
490
|
```
|
|
299
491
|
|
|
300
|
-
All fields optional.
|
|
492
|
+
All fields are optional. OpenDevBrowser works with sensible defaults.
|
|
301
493
|
|
|
302
494
|
---
|
|
303
495
|
|
|
304
496
|
## CLI Commands
|
|
305
497
|
|
|
498
|
+
The CLI is agent-agnostic and supports the full automation surface (session, navigation, interaction, DOM, targets, pages, export, devtools, and annotate).
|
|
499
|
+
All commands listed in the CLI reference are implemented and available in the current codebase.
|
|
500
|
+
See [docs/CLI.md](docs/CLI.md) for the full command and flag matrix.
|
|
501
|
+
|
|
502
|
+
### Install/Management
|
|
503
|
+
|
|
306
504
|
| Command | Description |
|
|
307
505
|
|---------|-------------|
|
|
308
506
|
| `npx opendevbrowser` | Interactive install |
|
|
@@ -314,16 +512,42 @@ All fields optional. Plugin works with sensible defaults.
|
|
|
314
512
|
| `npx opendevbrowser --uninstall` | Remove from config |
|
|
315
513
|
| `npx opendevbrowser --version` | Show version |
|
|
316
514
|
|
|
515
|
+
### Common Automation Commands (Daemon-backed)
|
|
516
|
+
|
|
517
|
+
Start the daemon with `npx opendevbrowser serve`, then use:
|
|
518
|
+
|
|
519
|
+
| Command | Description |
|
|
520
|
+
|---------|-------------|
|
|
521
|
+
| `npx opendevbrowser launch` | Launch session (defaults to extension mode when available) |
|
|
522
|
+
| `npx opendevbrowser connect` | Connect via relay or direct CDP endpoint |
|
|
523
|
+
| `npx opendevbrowser disconnect` | Disconnect session |
|
|
524
|
+
| `npx opendevbrowser status` | Show session status |
|
|
525
|
+
| `npx opendevbrowser goto` | Navigate to URL |
|
|
526
|
+
| `npx opendevbrowser wait` | Wait for load or element |
|
|
527
|
+
| `npx opendevbrowser snapshot` | Capture snapshot with refs |
|
|
528
|
+
| `npx opendevbrowser click` | Click element by ref |
|
|
529
|
+
| `npx opendevbrowser type` | Type into element by ref |
|
|
530
|
+
| `npx opendevbrowser select` | Select dropdown option by ref |
|
|
531
|
+
| `npx opendevbrowser scroll` | Scroll page or element |
|
|
532
|
+
| `npx opendevbrowser run` | Run a JSON script |
|
|
533
|
+
|
|
317
534
|
---
|
|
318
535
|
|
|
319
536
|
## Security
|
|
320
537
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
538
|
+
OpenDevBrowser is **secure by default** with defense-in-depth protections:
|
|
539
|
+
|
|
540
|
+
| Protection | Details |
|
|
541
|
+
|------------|---------|
|
|
542
|
+
| **CDP Localhost-Only** | Remote endpoints blocked; hostname normalized to prevent bypass |
|
|
543
|
+
| **Timing-Safe Auth** | `crypto.timingSafeEqual()` for token comparison |
|
|
544
|
+
| **Origin Validation** | `/extension` requires `chrome-extension://` origin; `/ops`, `/cdp`, `/annotation`, and `/config`/`/status`/`/pair` allow loopback no-Origin requests |
|
|
545
|
+
| **PNA Preflights** | HTTP preflights include `Access-Control-Allow-Private-Network: true` when requested |
|
|
546
|
+
| **Rate Limiting** | 5 handshake attempts/minute per IP, plus HTTP rate limiting for `/config`, `/status`, `/pair` |
|
|
547
|
+
| **Data Redaction** | Tokens, API keys, sensitive paths auto-redacted |
|
|
548
|
+
| **Export Sanitization** | Scripts, event handlers, dangerous CSS stripped |
|
|
549
|
+
| **Atomic Writes** | Config writes are atomic to prevent corruption |
|
|
550
|
+
| **Secure Defaults** | `allowRawCDP`, `allowNonLocalCdp`, `allowUnsafeExport` all `false` |
|
|
327
551
|
|
|
328
552
|
---
|
|
329
553
|
|
|
@@ -338,22 +562,59 @@ rm -rf ~/.cache/opencode/node_modules/opendevbrowser
|
|
|
338
562
|
npx opendevbrowser --update
|
|
339
563
|
```
|
|
340
564
|
|
|
565
|
+
Architecture overview: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)
|
|
341
566
|
Release checklist: [docs/DISTRIBUTION_PLAN.md](docs/DISTRIBUTION_PLAN.md)
|
|
342
567
|
|
|
343
568
|
---
|
|
344
569
|
|
|
570
|
+
## Architecture
|
|
571
|
+
|
|
572
|
+
```
|
|
573
|
+
src/
|
|
574
|
+
├── browser/ # BrowserManager, TargetManager, CDP lifecycle
|
|
575
|
+
├── cli/ # CLI commands and installers
|
|
576
|
+
├── core/ # Bootstrap, runtime wiring
|
|
577
|
+
├── devtools/ # Console/network trackers with redaction
|
|
578
|
+
├── export/ # DOM capture, React emitter, CSS extraction
|
|
579
|
+
├── relay/ # Extension relay server, protocol types
|
|
580
|
+
├── skills/ # SkillLoader for skill pack discovery
|
|
581
|
+
├── snapshot/ # AX-tree snapshots, ref management
|
|
582
|
+
├── tools/ # 41 opendevbrowser_* tool definitions
|
|
583
|
+
└── utils/ # Shared utilities
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
Extension relay uses flat CDP sessions (Chrome 125+) with DebuggerSession `sessionId` routing for multi-tab support.
|
|
587
|
+
When hub mode is enabled, the hub daemon is the sole relay owner and enforces a FIFO lease queue for multi-client safety.
|
|
588
|
+
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for detailed component diagrams.
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
345
592
|
## Development
|
|
346
593
|
|
|
347
594
|
```bash
|
|
348
595
|
npm install
|
|
349
596
|
npm run build # Compile to dist/
|
|
350
|
-
npm run test # Run tests with coverage
|
|
351
|
-
npm run lint # ESLint checks
|
|
597
|
+
npm run test # Run tests with coverage (97% threshold)
|
|
598
|
+
npm run lint # ESLint checks (strict TypeScript)
|
|
352
599
|
npm run extension:build # Compile extension
|
|
353
600
|
npm run version:check # Verify package/extension version alignment
|
|
354
601
|
npm run extension:pack # Build extension zip for releases
|
|
355
602
|
```
|
|
356
603
|
|
|
604
|
+
### Packaging & Distribution (NPM + GitHub + Extension)
|
|
605
|
+
|
|
606
|
+
Uniform versioning is required (source of truth: `package.json`):
|
|
607
|
+
|
|
608
|
+
1. Bump `package.json` version.
|
|
609
|
+
2. Run: `npm run extension:sync`
|
|
610
|
+
3. Run: `npm run version:check`
|
|
611
|
+
4. Run: `npm run build`
|
|
612
|
+
5. Run: `npm run extension:build`
|
|
613
|
+
6. Run: `npm run extension:pack` (outputs `./opendevbrowser-extension.zip`)
|
|
614
|
+
7. Publish to NPM and attach the zip to the GitHub release tag (`vX.Y.Z`).
|
|
615
|
+
|
|
616
|
+
Release checklist: `docs/DISTRIBUTION_PLAN.md`
|
|
617
|
+
|
|
357
618
|
---
|
|
358
619
|
|
|
359
620
|
## Privacy
|