@btraut/browser-bridge 0.13.2 → 0.15.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/CHANGELOG.md CHANGED
@@ -6,6 +6,57 @@ The format is based on "Keep a Changelog", and this project adheres to Semantic
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ### Added
10
+
11
+ ### Changed
12
+
13
+ ### Fixed
14
+
15
+ ## [0.15.0] - 2026-03-21
16
+
17
+ ### Added
18
+
19
+ - Added first-class `permissions.*` support across Core, CLI, and MCP for reading allowlist/mode state and requesting allowlist/mode changes through a human approval flow in Chrome.
20
+ - Added a repo-local `dev:loop` helper plus a matching local `dev-loop` skill for Browser Bridge contributors, so extension rebuild/relaunch/bypass setup can run from one command instead of the usual Chrome nonsense.
21
+
22
+ ### Changed
23
+
24
+ - The repo-local `bump-version` release skill and release doc now require a fresh `npm install` and `npm run build` before any version bumping, so releases start from a clean build instead of wishful thinking.
25
+ - External permission changes are now approval-gated end to end: CLI/MCP can request them, but the extension applies them only after a human approves a dedicated prompt, with extra friction for bypass mode.
26
+
27
+ ### Fixed
28
+
29
+ - Cold-start extension attach is less brittle: Core now waits briefly for the extension handshake before failing drive and permissions calls with `EXTENSION_DISCONNECTED`, which cuts down false startup misses right after Chrome/runtime reconnects.
30
+ - `drive.click` now retries a few transient locator-resolution misses instead of giving up after one wobble, which makes toggle/action controls like ManaVault's `Edit list` less likely to fail during live rerenders.
31
+ - Interactive AX snapshots now prune hover-hidden controls that fail live DOM visibility and pointer-event checks, so inspect stops advertising inert ManaVault-style quantity buttons as actionable.
32
+ - `dev enable-inspect` now retries transient stale diagnostics before failing, which cuts down false "inspect unavailable" reports while the extension handshake and capability negotiation are still catching up.
33
+ - Locator ranking now prefers directly hittable exact matches over merely visible duplicates, so drive clicks are less likely to land on ghost controls that share an `aria-label` but are occluded or inert.
34
+ - Repo-local Codex skills now live under `.agents/skills`, and the CLI install/prepack flow now reads from that canonical repo path instead of the dead `skills/` directory.
35
+ - Existing tabs now recover their content script on demand after extension updates, so `drive.wait_for` and other tab actions stop dying with `Receiving end does not exist` just because the tab predates the current build.
36
+ - Inspect now evaluates in an isolated world on the top frame when available, which makes auth/passkey pages less likely to derail `extract_content`, `page_state`, and `evaluate` with extension-surface debugger context errors.
37
+ - Inspect reads are less flaky and less noisy: `extract_content` now defaults to quiesced capture, `page_state` is summary-first with redacted values by default, and `console_list` filters stale pre-session history unless you ask for older entries explicitly.
38
+
39
+ ## [0.14.0] - 2026-03-13
40
+
41
+ ### Added
42
+
43
+ - Added a project-local `bump-version` skill that walks an agent through the repo's release flow: explicit SemVer bump selection, changelog move, release commit/tag push, GitHub release verification, npm publish, and the final extension-update reminder.
44
+
45
+ ### Changed
46
+
47
+ - Refactored the extension action path into smaller, clearer pieces: tab resolution, permission gating, debugger dispatch, click strategies, and locator scoring no longer all live inline in the same giant handlers.
48
+ - Refactored inspect internals into explicit subsystems for target selection, content extraction policy, and snapshot-ref lifecycle management, which makes the core behavior easier to follow and safer to change.
49
+
50
+ ### Fixed
51
+
52
+ - Clicks and locator resolution are much more reliable on real sites, especially for popup/menu triggers, duplicate controls, exact text matches, and visible-vs-hidden targets.
53
+ - Inspect is more stable and useful on dynamic pages: AX snapshots keep the right interactive nodes, `extract_content` handles SPA layouts better, and snapshot refs recover more cleanly after rerenders.
54
+ - Drive and inspect targeting are more predictable: session tab affinity is preserved by default, explicit `tab_id` targeting works end-to-end, and tab-activation failures degrade more gracefully when the right tab is already active.
55
+ - The inspect/setup story is much cleaner: current builds treat inspect as always-on, `dev enable-inspect` behaves like a diagnostics/remediation command, and the docs/runtime guidance now match reality.
56
+ - CLI and runtime plumbing got tougher around packaging and failure handling, including cleaner startup errors, better executable/shebang preservation, and less debugger coupling for screenshots.
57
+ - Repo tooling and validation were cleaned up too, including hook fixes, docs cleanup, and follow-up CI/lint/typecheck regressions on `main`.
58
+ - Plus 35 other bug fixes and polish items across diagnostics, docs, test coverage, and developer tooling.
59
+
9
60
  ## [0.13.2] - 2026-02-18
10
61
 
11
62
  ### Changed
package/README.md CHANGED
@@ -19,6 +19,10 @@ npm i -g @btraut/browser-bridge
19
19
  browser-bridge --help
20
20
  ```
21
21
 
22
+ zsh gotcha:
23
+
24
+ - If `browser-bridge` is not installed or not on `PATH` and you run it from inside a directory also named `browser-bridge`, zsh can print a misleading `permission denied` by trying to execute the directory itself. Check `command -v browser-bridge` before treating that error as a packaging failure.
25
+
22
26
  2. Run the installer:
23
27
 
24
28
  ```bash
@@ -45,6 +49,16 @@ Then load the unpacked extension from `packages/extension/`.
45
49
 
46
50
  </details>
47
51
 
52
+ Repo contributors: run `npm run hooks:install` once after clone. This repo expects `core.hooksPath=.githooks` so local `pre-commit` and `pre-push` block the same format/lint/typecheck failures that CI enforces.
53
+
54
+ Repo contributors who are iterating on the extension should stop doing the manual delete/reinstall routine. Use:
55
+
56
+ ```bash
57
+ npm run dev:loop -- --open-options
58
+ ```
59
+
60
+ That rebuilds the workspace, uses macOS UI scripting to open `chrome://extensions` in your existing Chrome profile, clicks **Update** to reload unpacked extensions, waits for Browser Bridge to reconnect, and requests bypass mode if Chrome is still granular. Add `--install` only when dependencies changed.
61
+
48
62
  4. Try it:
49
63
 
50
64
  ```text
@@ -106,7 +120,7 @@ See `docs/cdp-input-model.md` for details and smoke verification.
106
120
 
107
121
  ## 🔒 Site Permissions (Drive Actions)
108
122
 
109
- Browser Bridge is intentionally safe: **drive actions** (`drive.navigate`, click, type, etc.) require **per-site approval**. `inspect.*` is additionally guarded behind an explicit debugger-capability toggle in extension options.
123
+ Browser Bridge is intentionally safe: **drive actions** (`drive.navigate`, click, type, etc.) require **per-site approval**. `inspect.*` is always available in current builds; if diagnostics reports missing inspect capability, that is stale runtime drift, not a separate permission toggle.
110
124
 
111
125
  <details>
112
126
  <summary>How approvals work (click to expand)</summary>
@@ -124,7 +138,15 @@ Manage approvals (and bypass mode):
124
138
  - Switch **Permission mode** to **Bypass (dangerous)** to skip the allowlist and prompts entirely.
125
139
  - In bypass mode, the agent can take actions on any website without asking.
126
140
  - Restricted URLs (for example `chrome://` and `file://`) are still blocked.
127
- - `inspect.*` requires enabling **Debugger-based inspect** in extension options. If disabled, inspect calls fail with `ATTACH_DENIED` and a clear next step.
141
+ - CLI and MCP can also inspect or request permission changes:
142
+ - Reads: `browser-bridge permissions list`, `browser-bridge permissions mode`, `browser-bridge permissions pending`
143
+ - Requests: `browser-bridge permissions allow-site --site example.com`, `revoke-site --site example.com`, `set-mode --mode granular|bypass`
144
+ - Equivalent MCP tools exist under `permissions.*`
145
+ - External permission-change requests are still human-gated:
146
+ - CLI/MCP request calls open a dedicated Chrome approval prompt.
147
+ - Nothing is mutated silently from CLI or MCP.
148
+ - If the request times out, the command/tool returns `status: "timed_out"`; if the prompt is still open, a later human approval still applies the change.
149
+ - `inspect.*` should already be enabled in current builds. Use `browser-bridge dev enable-inspect` as a diagnostics probe; if it reports missing inspect capability, treat that as stale runtime drift and reload or update the Browser Bridge extension.
128
150
 
129
151
  </details>
130
152
 
@@ -142,6 +164,15 @@ The CLI mirrors the MCP tool surface.
142
164
  - `session.recover`
143
165
  - `session.close`
144
166
 
167
+ **permissions**
168
+
169
+ - `permissions.list`
170
+ - `permissions.get_mode`
171
+ - `permissions.list_pending_requests`
172
+ - `permissions.request_allow_site`
173
+ - `permissions.request_revoke_site`
174
+ - `permissions.request_set_mode`
175
+
145
176
  **drive**
146
177
 
147
178
  - `drive.navigate`
@@ -206,8 +237,8 @@ Or copy the Browser Bridge skill into your agent skills directory (advanced):
206
237
 
207
238
  ```bash
208
239
  # From this repo:
209
- # cp -R docs/skills/browser-bridge ~/.agents/skills/browser-bridge
210
- # cp -R docs/skills/browser-bridge ~/.claude/skills/browser-bridge
240
+ # cp -R .agents/skills/browser-bridge ~/.agents/skills/browser-bridge
241
+ # cp -R .agents/skills/browser-bridge ~/.claude/skills/browser-bridge
211
242
 
212
243
  # From npm (global install):
213
244
  cp -R "$(npm root -g)/@btraut/browser-bridge/skills/browser-bridge" ~/.agents/skills/browser-bridge
@@ -234,12 +265,12 @@ Codex:
234
265
  codex mcp add browser-bridge -- browser-bridge mcp
235
266
  ```
236
267
 
237
- Optional custom host/port (use `browser-bridge dev info` to get the current worktree port):
268
+ Optional custom host/port override (only if you intentionally run Core somewhere else):
238
269
 
239
270
  ```bash
240
271
  codex mcp add browser-bridge \
241
272
  --env BROWSER_BRIDGE_CORE_HOST=127.0.0.1 \
242
- --env BROWSER_BRIDGE_CORE_PORT=<port-from-dev-info> \
273
+ --env BROWSER_BRIDGE_CORE_PORT=<custom-port> \
243
274
  -- browser-bridge mcp
244
275
  ```
245
276
 
@@ -249,12 +280,12 @@ Claude Code:
249
280
  claude mcp add --transport stdio browser-bridge -- browser-bridge mcp
250
281
  ```
251
282
 
252
- Optional custom host/port (use `browser-bridge dev info` to get the current worktree port):
283
+ Optional custom host/port override (only if you intentionally run Core somewhere else):
253
284
 
254
285
  ```bash
255
286
  claude mcp add --transport stdio browser-bridge \
256
287
  --env BROWSER_BRIDGE_CORE_HOST=127.0.0.1 \
257
- --env BROWSER_BRIDGE_CORE_PORT=<port-from-dev-info> \
288
+ --env BROWSER_BRIDGE_CORE_PORT=<custom-port> \
258
289
  -- browser-bridge mcp
259
290
  ```
260
291
 
@@ -262,13 +293,12 @@ claude mcp add --transport stdio browser-bridge \
262
293
 
263
294
  ## ✅ Default Runtime (Normal Usage)
264
295
 
265
- For normal usage, Browser Bridge is zero-setup:
296
+ Browser Bridge is now a single-runtime setup by default:
266
297
 
267
- - Core and CLI default to `127.0.0.1:3210`.
268
- - The extension also defaults to `3210`.
269
- - You do not need `dev activate` unless you intentionally opt into isolated worktree routing.
298
+ - Core, CLI, and extension target `127.0.0.1:3210`.
299
+ - You do not need any activation or routing step for normal use.
270
300
  - After reboot/cold start, the first CLI or MCP request auto-starts Core (no manual daemon wake-up required).
271
- - If Core is idle/offline, the extension popup may show `disconnected` or `backoff`; this is expected until Core is reachable again.
301
+ - If Core is idle/offline, the extension popup may show `disconnected` or `backoff`; that just means Core is not reachable yet.
272
302
 
273
303
  Optional status check:
274
304
 
@@ -276,32 +306,18 @@ Optional status check:
276
306
  browser-bridge dev info --json
277
307
  ```
278
308
 
279
- ## 🔁 Isolated Multi-Worktree Dev Loop (Advanced)
280
-
281
- Use this loop when you intentionally run multiple worktree instances in parallel.
282
-
283
- 1. Resolve runtime for the current worktree:
309
+ Use `browser-bridge dev enable-inspect` only as a quick diagnostics probe when you want to sanity-check debugger-backed inspect on the live runtime:
284
310
 
285
311
  ```bash
286
- browser-bridge dev info --json
312
+ browser-bridge dev enable-inspect
287
313
  ```
288
314
 
289
- Use the `port`, `worktreeId`, `metadataPath`, and `logDir` from output.
290
-
291
- 2. Activate isolated extension routing for this worktree:
292
-
293
- ```bash
294
- browser-bridge dev activate --extension-id <id>
295
- ```
296
-
297
- After the first run, you can usually omit `--extension-id` because it is saved in `.context/browser-bridge/dev.json`.
298
-
299
- 3. Run your CLI/MCP workflow in this worktree.
315
+ The helper verifies inspect capability against the live runtime and can also sanity-check a specific connected extension via `--extension-id <id>`. It does not flip inspect on through Core. The extension id may be cached in `.context/browser-bridge/dev.json` after a successful run, but that metadata is no longer a routing switch.
300
316
 
301
- ## 🧯 Worktree Troubleshooting
317
+ ## 🧯 Runtime Troubleshooting
302
318
 
303
- - Missing extension id: Run `browser-bridge dev activate --extension-id <id>`. Or set `BROWSER_BRIDGE_EXTENSION_ID=<id>`. You can copy the id from `chrome://extensions` (enable Developer mode to see ids).
304
- - Activation URL did not open in Chrome: Run `browser-bridge dev activate --json`, copy `result.activationUrl`, and open it directly in Chrome. `dev activate` uses the OS URL opener, so your default browser setting matters.
319
+ - Inspect capability still unavailable: restart the Browser Bridge core daemon, then reload or update the Browser Bridge extension and rerun `browser-bridge diagnostics doctor` plus `browser-bridge dev enable-inspect`.
320
+ - Extension id mismatch while verifying inspect: rerun with the correct `--extension-id <id>` or clear `BROWSER_BRIDGE_EXTENSION_ID` if you pinned the wrong unpacked install. You can copy the id from `chrome://extensions` (enable Developer mode to see ids).
305
321
  - Logs and per-stream JSONL inspection: Logs are under `.context/logs/browser-bridge/`. Common streams: `cli.jsonl`, `core.jsonl`, `mcp-adapter.jsonl` (plus rotated files like `core.1.jsonl`).
306
322
 
307
323
  ```bash
@@ -311,7 +327,7 @@ tail -n 80 .context/logs/browser-bridge/core.jsonl
311
327
  tail -n 80 .context/logs/browser-bridge/mcp-adapter.jsonl
312
328
  ```
313
329
 
314
- - Default mode port is `3210`. In isolated mode, port is worktree-specific. Use `browser-bridge dev info` if you are unsure (or pass explicit `--port` / `BROWSER_BRIDGE_CORE_PORT`).
330
+ - Default runtime is `127.0.0.1:3210`. If you are unsure, run `browser-bridge dev info` or pass explicit `--host` / `--port` overrides.
315
331
 
316
332
  ## 🩺 Diagnostics
317
333
 
@@ -322,7 +338,7 @@ tail -n 80 .context/logs/browser-bridge/mcp-adapter.jsonl
322
338
 
323
339
  ### End-to-End Connection Troubleshooting Flow
324
340
 
325
- Use this exact flow when commands fail after reboot, runtime changes, or worktree switching:
341
+ Use this exact flow when commands fail after reboot or runtime changes:
326
342
 
327
343
  1. Check runtime resolution:
328
344
 
@@ -341,8 +357,8 @@ browser-bridge diagnostics doctor --json
341
357
  - Red dot: extension is disconnected or reconnecting.
342
358
 
343
359
  4. If caller/core/extension endpoints differ in the diagnostics report:
344
- - Default mode: remove custom host/port env overrides and retry (`BROWSER_BRIDGE_CORE_HOST`, `BROWSER_BRIDGE_CORE_PORT`).
345
- - Isolated mode: re-run `browser-bridge dev activate --extension-id <id>` for the intended worktree.
360
+ - Remove custom host/port env overrides and retry (`BROWSER_BRIDGE_CORE_HOST`, `BROWSER_BRIDGE_CORE_PORT`).
361
+ - If inspect capability is the missing piece, run `browser-bridge dev enable-inspect --extension-id <id>`.
346
362
 
347
363
  5. If the popup stays red and failures continue:
348
364
  - Inspect logs: