@browserbridge/bbx 1.8.0 → 1.10.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/PRIVACY.md +29 -3
- package/README.md +10 -3
- package/SECURITY.md +12 -0
- package/package.json +7 -1
- package/packages/agent-client/src/cli-args.js +70 -6
- package/packages/agent-client/src/cli-batch.js +127 -59
- package/packages/agent-client/src/cli-helpers.js +8 -0
- package/packages/agent-client/src/cli-output.js +8 -1
- package/packages/agent-client/src/cli-setup-commands.js +3 -1
- package/packages/agent-client/src/cli.js +254 -26
- package/packages/agent-client/src/client.js +156 -3
- package/packages/agent-client/src/command-registry.js +14 -4
- package/packages/agent-client/src/config.js +195 -0
- package/packages/agent-client/src/mcp-config.js +8 -8
- package/packages/agent-client/src/npm-self-update.js +305 -0
- package/packages/agent-client/src/remotes.js +4 -2
- package/packages/agent-client/src/runtime.js +99 -7
- package/packages/agent-client/src/types.ts +38 -0
- package/packages/mcp-server/src/guidance.js +37 -6
- package/packages/mcp-server/src/handlers-capture.js +29 -2
- package/packages/mcp-server/src/handlers-dom.js +54 -3
- package/packages/mcp-server/src/handlers-page.js +333 -60
- package/packages/mcp-server/src/handlers-utils.js +141 -151
- package/packages/mcp-server/src/handlers.js +17 -4
- package/packages/mcp-server/src/server.js +269 -51
- package/packages/mcp-server/src/toolset.js +48 -0
- package/packages/native-host/src/artifact-store.js +353 -0
- package/packages/native-host/src/config.js +9 -1
- package/packages/native-host/src/daemon-logger.js +3 -1
- package/packages/native-host/src/daemon.js +457 -27
- package/packages/native-host/src/dom-baseline-owners.js +210 -0
- package/packages/native-host/src/native-host.js +38 -29
- package/packages/protocol/src/budget-presets.js +182 -0
- package/packages/protocol/src/capability-values.js +2 -0
- package/packages/protocol/src/defaults.js +28 -0
- package/packages/protocol/src/errors.js +48 -5
- package/packages/protocol/src/har.js +34 -0
- package/packages/protocol/src/incidental-sanitizer.js +197 -0
- package/packages/protocol/src/index.js +4 -0
- package/packages/protocol/src/json-lines.js +3 -2
- package/packages/protocol/src/protocol.js +316 -6
- package/packages/protocol/src/recovery-telemetry.js +302 -0
- package/packages/protocol/src/registry.js +226 -6
- package/packages/protocol/src/summary.js +116 -25
- package/packages/protocol/src/types.ts +490 -4
- package/skills/browser-bridge/SKILL.md +26 -8
- package/skills/browser-bridge/references/protocol.md +125 -15
- package/skills/browser-bridge/references/token-efficiency.md +17 -7
|
@@ -14,6 +14,8 @@ Permission prompts are controlled by the host agent, not by Browser Bridge. In p
|
|
|
14
14
|
Skill name: `browser-bridge` (also known as `bbx`). In GitHub Copilot, invoke as `/browser-bridge`. `bbx` is the CLI command used throughout this skill.
|
|
15
15
|
When the runtime supports subagents, delegate bridge inspection to a smaller, lower-cost worker and return only concise findings to the parent.
|
|
16
16
|
For open-ended investigation, start with structured reads (`page.get_state`, `dom.query`, `page.get_text`, `page.extract_content`, `styles.get_computed`, and `bbx batch` for CLI or `browser_batch` for MCP) and escalate to screenshots or debugger-backed methods only when structured evidence is insufficient. `browser_call` accepts one protocol method at a time; `batch` is not a valid `browser_call` method.
|
|
17
|
+
When an unfamiliar method is needed, run `bbx protocol describe <method|group>` before guessing parameters. In MCP mode, call `browser_call` with method `protocol.describe` and params `{ "method": "dom.query" }` or `{ "group": "inspect" }`.
|
|
18
|
+
MCP exposes common tools first. Load one specialized typed tool only when needed by calling `browser_toolset` with its exact name, for example `{ "tool": "browser_dom" }`; `browser_call` remains the universal fallback.
|
|
17
19
|
|
|
18
20
|
## CLI
|
|
19
21
|
|
|
@@ -32,6 +34,7 @@ bbx tab-create [url] # open a new tab (avoid unless necessary)
|
|
|
32
34
|
bbx tab-close <tabId> # close a tab
|
|
33
35
|
bbx tab-activate <tabId> # bring a tab to the foreground
|
|
34
36
|
bbx skill # live runtime presets + limits
|
|
37
|
+
bbx protocol describe [method|group] # local method params or compact group index
|
|
35
38
|
```
|
|
36
39
|
|
|
37
40
|
Use the globally installed `bbx` command or `node packages/agent-client/src/cli.js ...` for live readiness checks from this repository. Avoid `rtk npm exec -- bbx status` as a health signal: that path can restart/replace the daemon and report `Extension: disconnected` before Chrome reconnects. If it happens, wait a few seconds and verify with `bbx status`.
|
|
@@ -59,11 +62,13 @@ bbx a11y-tree [maxNodes] [maxDepth] # accessibility tree
|
|
|
59
62
|
bbx eval [--await] <expression> # JS eval (--await for promises, - for stdin)
|
|
60
63
|
bbx console [level] # console output
|
|
61
64
|
bbx network [limit] # recent fetch/XHR requests
|
|
65
|
+
bbx har [options] [outPath] # export armed CDP capture as sanitized HAR 1.2
|
|
62
66
|
bbx intercept add <pattern> [--respond <body>] [--status <code>] [--block] # intercept matching requests
|
|
63
67
|
bbx intercept list|remove <id>|clear # manage interception rules
|
|
64
68
|
bbx page-text [budget] # full page text
|
|
65
|
-
bbx storage [local|session] [keys] #
|
|
66
|
-
bbx
|
|
69
|
+
bbx storage [local|session] [keys] # storage key/presence metadata
|
|
70
|
+
bbx call sensitive.read '{"source":"local_storage","key":"name"}' # deliberate exact value
|
|
71
|
+
bbx perf # raw Chrome/CDP counter point sample
|
|
67
72
|
bbx navigate <url> # navigate to URL
|
|
68
73
|
bbx reload # reload current page
|
|
69
74
|
bbx back # navigate back
|
|
@@ -145,7 +150,7 @@ After access is enabled:
|
|
|
145
150
|
| `DIALOG_ACTION_CONFLICT` | No | Inspect current dialog state; never auto-repeat accept/dismiss |
|
|
146
151
|
| `TAB_MISMATCH` | No | Tab closed or not found - use `tabs.list` to find an available tab |
|
|
147
152
|
| `TIMEOUT` | Once | Retry once; if still failing, simplify (smaller `maxNodes`, narrower selector) |
|
|
148
|
-
| `
|
|
153
|
+
| `CONTENT_SCRIPT_UNAVAILABLE` | No | Switch to a normal http(s) page in the enabled window |
|
|
149
154
|
| `EXTENSION_DISCONNECTED` | After 3s | Check Chrome is running; `bbx status` to verify, then retry |
|
|
150
155
|
| `NATIVE_HOST_UNAVAILABLE` | No | Run `bbx doctor` to diagnose the installation |
|
|
151
156
|
| `INTERNAL_ERROR` | Once | Retry once; if persistent, check `page.get_console` for details |
|
|
@@ -155,6 +160,13 @@ After access is enabled:
|
|
|
155
160
|
|
|
156
161
|
Error responses now include a machine-readable `error.recovery` field with `retry`, `retryAfterMs`, `alternativeMethod`, and `hint`.
|
|
157
162
|
|
|
163
|
+
`health.ping`, `daemon.metrics`, and `bbx doctor` also expose process-local
|
|
164
|
+
five-minute recovery summaries for six fixed, content-free categories. Three
|
|
165
|
+
failures in the same hidden group within 60 seconds marks an active loop. Stop
|
|
166
|
+
repeating the action and follow Doctor's fixed category guidance. Extension
|
|
167
|
+
summaries reset on service-worker restart and daemon summaries on daemon restart;
|
|
168
|
+
they contain no page data, URLs, selectors, payloads, errors, or group names.
|
|
169
|
+
|
|
158
170
|
## Core Rules
|
|
159
171
|
|
|
160
172
|
1. **Work in existing tabs** - Never create new tabs unless the user explicitly asks for it, or the task absolutely requires a fresh page (e.g., testing a clean state, comparing across URLs). Prefer `tabs.list` to find an appropriate existing tab.
|
|
@@ -168,7 +180,8 @@ Error responses now include a machine-readable `error.recovery` field with `retr
|
|
|
168
180
|
9. **Batch reads** - combine independent reads with `bbx batch` in CLI mode or `browser_batch` in MCP mode; do not pass `batch` as a `browser_call` method.
|
|
169
181
|
10. **Avoid debugger first** - prefer DOM/content-script methods (`dom.*`, `styles.*`, `layout.get_box_model`, `page.get_console`, `page.get_text`, `page.get_storage`, `page.get_network`) before any debugger-backed method. Escalate to CDP only when those cannot answer the question.
|
|
170
182
|
11. **Evaluate only when needed** - `page.evaluate` is powerful but debugger-backed; use it only when DOM, storage, console, network, or text reads cannot expose the needed state.
|
|
171
|
-
12. **
|
|
183
|
+
12. **Treat exact storage as sensitive** - use `page.get_storage` for metadata first. Call `sensitive.read` for one exact key only when necessary; never batch or automatically retry it, and never repeat a failed attempt without new evidence.
|
|
184
|
+
12. **Debugger-backed methods are last resort** - treat `page.evaluate`, `page.handle_dialog`, `dom.get_accessibility_tree`, `page.get_network` with `source: 'cdp'`, input with `executionMode: 'cdp'`, `viewport.resize`, `performance.get_metrics`, `screenshot.capture_*`, and all `cdp.*` methods as escalation steps because they attach `chrome.debugger`. `performance.get_metrics` is a raw browser-maintained CDP counter point sample, not Web Vitals.
|
|
172
185
|
13. **Wait after change** - after editing source, wait for expected new text, a selector matching the changed attribute, or a detach/attach remount; waiting for `attached` on a selector that already exists does not prove HMR ran. Use `page.wait_for_load_state` for navigation, not HMR.
|
|
173
186
|
14. **Prime event buffers** - before reproducing a console or fetch/XHR issue, call `page.get_console` and default `page.get_network` once with `clear: true`; then reproduce and read without clearing. CDP all-resource capture instead requires explicit `start`, reproduce, `read`, and `stop` calls.
|
|
174
187
|
15. **Semantic finding** - use `dom.find_by_text` / `dom.find_by_role` when you know the label but not the selector.
|
|
@@ -180,6 +193,8 @@ Error responses now include a machine-readable `error.recovery` field with `retr
|
|
|
180
193
|
21. **Do not guess input targets** - for targeted click, focus, type, fill, press-key, checked-state, option-selection, hover, and drag calls, honor actionability errors and returned `resolution` metadata. `cdp_press_key` and `scroll_into_view` use separate contracts. `executionMode` is only `dom` or `cdp`; `input.fill.mode: auto` is a separate DOM setter/keystroke strategy.
|
|
181
194
|
22. **Stale recovery stays opt-in** - prefer re-querying. Use `recoverStale: true` once only when the same document/URL and a strong unique semantic descriptor should still identify the target; inspect `recovered`, old/new refs, and matched fields. A scan with more than 100 same-tag candidates fails as `ELEMENT_AMBIGUOUS`/`scan_incomplete` because uniqueness is not provable.
|
|
182
195
|
23. **Dialogs are explicit** - inspect first, then accept or dismiss only when intended. `expectedDialogId` is a pre-dispatch stale-decision check, not an atomic CDP binding; never auto-repeat `DIALOG_ACTION_CONFLICT`.
|
|
196
|
+
24. **DOM diffs use explicit baselines** - call `dom.baseline.create` before the action, `dom.baseline.compare` afterward, then `dom.baseline.release`. Use a narrow selector and bounded evidence. Never substitute unrelated DOM reads for the retained baseline, and recreate it after `DOM_BASELINE_INVALIDATED`.
|
|
197
|
+
25. **HAR export reads an armed capture** - use CDP capture `start`, reproduce, `network.export_har`/`bbx har`, then `stop`. Export never starts, stops, or clears capture. Inspect truncation plus `dropped`, `abandoned`, and `inflight` before claiming completeness.
|
|
183
198
|
|
|
184
199
|
## Token Budget Quick Rules
|
|
185
200
|
|
|
@@ -251,12 +266,12 @@ bbx page-text 2000 # extract page content
|
|
|
251
266
|
| Find | `dom.find_by_text`, `dom.find_by_role`, `dom.wait_for`, `dom.get_accessibility_tree` |
|
|
252
267
|
| Page State | `page.get_console`, `page.get_storage`, `page.get_text`, `page.wait_for_load_state`, `page.evaluate` (debugger-backed) |
|
|
253
268
|
| Dialogs | `page.handle_dialog` (debugger-backed; explicit inspect/accept/dismiss only) |
|
|
254
|
-
| Network | `page.get_network` (fetch/XHR default; optional CDP lifecycle), `network.intercept.add/remove/list/clear` (debugger-backed)
|
|
269
|
+
| Network | `page.get_network` (fetch/XHR default; optional CDP lifecycle), `network.export_har`, `network.intercept.add/remove/list/clear` (debugger-backed) |
|
|
255
270
|
| Interact | `input.click`, `input.type`, `input.fill`, `input.focus`, `input.press_key`, `cdp.dispatch_key_event`, `input.hover`, `input.drag`, `input.scroll_into_view` |
|
|
256
271
|
| Tabs | `tabs.list` (preferred), `tabs.create` (avoid unless necessary), `tabs.close`, `tabs.activate` |
|
|
257
272
|
| Patch | `patch.apply_styles`, `patch.apply_dom`, `patch.rollback` |
|
|
258
273
|
| Navigate | `navigation.navigate`, `viewport.scroll`, `viewport.resize` |
|
|
259
|
-
| Performance | `performance.get_metrics` (debugger-backed)
|
|
274
|
+
| Performance | `performance.get_metrics` (raw Chrome/CDP counter point sample; debugger-backed) |
|
|
260
275
|
| Escalate | `dom.get_accessibility_tree`, `screenshot.capture_element`, `screenshot.capture_region` (tight crops only), `screenshot.capture_full_page`, `cdp.*` |
|
|
261
276
|
|
|
262
277
|
## Dev-Server Workflow (HMR-aware)
|
|
@@ -336,8 +351,10 @@ Every CLI shortcut command produces consistent `{ok, summary, evidence}` JSON. U
|
|
|
336
351
|
- `input.drag` uses `source`, `destination`, and optional destination offsets `offsetX` / `offsetY`.
|
|
337
352
|
- `executionMode` accepts `dom` or `cdp` and defaults to `dom`; CDP supports only click, hover, drag, type, and fill. `input.fill.mode` (`auto`, `setter`, `keystrokes`) is a separate DOM strategy.
|
|
338
353
|
- `page.get_network` defaults to low-cost fetch/XHR instrumentation. All-resource CDP capture must be armed before the activity with `source: "cdp", capture: "start"`, read later, and explicitly stopped.
|
|
354
|
+
- `network.export_har` requires that explicit capture to still be armed. Params are `limit` (1-200), sanitized-URL substring `urlPattern`, and `delivery` (`auto`, `inline`, `artifact`). Inline bounds remove whole oldest entries; export never changes capture state. `bbx har` uses the same client to download, length/SHA-256 verify, delete, validate, and atomically write artifacts locally.
|
|
339
355
|
- `page.handle_dialog` mutations are not atomically bound to `expectedDialogId`; treat `commandDispatched` as dispatch evidence and verify follow-up state.
|
|
340
|
-
- Raw
|
|
356
|
+
- Raw screenshot calls default to inline base64. Use `delivery: "auto"` for size-aware artifact fallback, or explicit `inline` when MCP image content is required; prefer `bbx screenshot <ref> [outPath]` when one element is enough because the CLI downloads and verifies artifacts locally.
|
|
357
|
+
- Artifact delivery returns a descriptor (artifactId, sha256, byteLength), not bytes. From MCP, read chunks with the `browser_artifact` tool (`action: "read"`, paging `offset` until `nextOffset` is null, then verify the reassembled bytes against `sha256`) and free storage with `action: "delete"`. Each standalone CLI invocation has a new artifact owner, so use `bbx screenshot` / `bbx har` to capture, download, verify, and delete within one CLI process; use `delivery: "inline"` for raw CLI screenshot calls that need the bytes in their immediate result.
|
|
341
358
|
|
|
342
359
|
## Response Shapes
|
|
343
360
|
|
|
@@ -360,13 +377,14 @@ Shortcut commands intentionally expose only the common case. Use `bbx call <meth
|
|
|
360
377
|
| Computed styles | `result.properties + elementRef` | `Computed N style(s) for ref.` |
|
|
361
378
|
| Box model | `result.content + border` | `Box model: W×H at (x, y).` |
|
|
362
379
|
| Network | `result.source + entries` | `Network: N requests.` |
|
|
380
|
+
| HAR export | `result.format === "har"` | `HAR export delivered mode: N/M entries.` |
|
|
363
381
|
| Console | `entries` (no type field) | `Console: N entries.` |
|
|
364
382
|
| Logs | `entries[0].at + method` | `Log: N entries.` |
|
|
365
383
|
| Patch apply | `result.patchId` | `Patch id applied.` |
|
|
366
384
|
| Patch rollback | `result.rolled_back` | `Patch rolled back.` |
|
|
367
385
|
| Patch list | `result.patches` | `N active patch(es).` |
|
|
368
386
|
| HTML | `result.html` | `HTML fragment: N chars.` |
|
|
369
|
-
| Performance | `result.metrics` | `
|
|
387
|
+
| Performance | `result.metrics` | `Raw CDP performance counters: N collected; Web Vitals not measured.` |
|
|
370
388
|
| Storage | `result.type + count + entries` | `Storage (type): N entries.` |
|
|
371
389
|
| Click/Focus/Type | `result.clicked/focused/typed` | `Clicked/Focused/Typed ref.` |
|
|
372
390
|
| Key press | `result.pressed` | `Key pressed (key).` |
|
|
@@ -27,11 +27,16 @@ The table below includes the legacy capability bucket for each method so agents
|
|
|
27
27
|
- `-` means the method is global/system-scoped and was never gated by a former capability bucket.
|
|
28
28
|
- Capability names are descriptive coverage labels only. Browser Bridge access is window-scoped now; there are no capability-scoped sessions.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Use `bbx protocol describe <method|group>` for a compact local signature lookup. In MCP mode,
|
|
31
|
+
call `browser_call` with method `protocol.describe` and params containing `method` or `group`;
|
|
32
|
+
omit both for the group index.
|
|
33
|
+
|
|
34
|
+
## All Methods (76)
|
|
31
35
|
|
|
32
36
|
| Method | Tab? | CDP? | Group | Capability | Notes |
|
|
33
37
|
| ---------------------------------- | ---- | ---------- | ----------- | -------------------- | ------------------------------------------------------------------------------------------ |
|
|
34
38
|
| `access.request` | No | - | system | `intent?` | Request window access with bounded operation context in the extension UI |
|
|
39
|
+
| `protocol.describe` | No | - | system | `-` | Local compact method/group parameters and metadata |
|
|
35
40
|
| `tabs.list` | No | - | tabs | `-` | Discover tabs in the enabled window |
|
|
36
41
|
| `tabs.create` | No | - | tabs | `tabs.manage` | Open a new tab; optional `url` and `active` |
|
|
37
42
|
| `tabs.close` | No | - | tabs | `tabs.manage` | Close a tab by `tabId` |
|
|
@@ -39,18 +44,20 @@ The table below includes the legacy capability bucket for each method so agents
|
|
|
39
44
|
| `skill.get_runtime_context` | No | - | system | `-` | Live budget presets and method groups |
|
|
40
45
|
| `setup.get_status` | No | - | system | `-` | Global MCP config and CLI skill install status |
|
|
41
46
|
| `setup.install` | No | - | system | `-` | Install or uninstall MCP/skill integration targets |
|
|
42
|
-
| `health.ping` | No | - | system | `-` | Connectivity,
|
|
47
|
+
| `health.ping` | No | - | system | `-` | Connectivity, routing, capture, and daemon/routed-extension recovery summaries |
|
|
43
48
|
| `log.tail` | No | - | system | `-` | Recent redacted bridge logs |
|
|
44
|
-
| `daemon.metrics` | No | - | system | `-` | Daemon health and
|
|
49
|
+
| `daemon.metrics` | No | - | system | `-` | Daemon health, performance, and process-local recovery metrics |
|
|
45
50
|
| `page.get_state` | Yes | - | page | `page.read` | URL, readiness, focus, viewport, and observable dialog status |
|
|
46
51
|
| `page.evaluate` | Yes | CDP | page | `page.evaluate` | JS expression in page context; last resort |
|
|
47
52
|
| `page.get_console` | Yes | - | page | `page.read` | Buffered console messages; filter by `level`, `limit` |
|
|
48
53
|
| `page.handle_dialog` | Yes | CDP | page | `navigation.control` | Inspect or explicitly accept/dismiss the currently observable dialog |
|
|
49
54
|
| `page.wait_for_load_state` | Yes | - | wait | `page.read` | Wait for truthful tab `complete` state and/or a URL condition |
|
|
50
|
-
| `page.get_storage` | Yes | - | page | `page.read` |
|
|
55
|
+
| `page.get_storage` | Yes | - | page | `page.read` | Bounded storage key/presence metadata; optional `keys`; never values |
|
|
56
|
+
| `sensitive.read` | Yes | - | sensitive | `sensitive.read` | One exact local/session storage key; sequential, non-retryable, whole-or-error |
|
|
51
57
|
| `page.get_text` | Yes | - | page | `page.read` | Full page text; `textBudget` limits size |
|
|
52
58
|
| `page.extract_content` | Yes | - | page | `page.read` | Node-processed semantic text/Markdown with bounded HTML snapshots and optional settlement |
|
|
53
59
|
| `page.get_network` | Yes | Conditional | page | `network.read` | Fetch/XHR by default; explicit CDP all-resource capture lifecycle |
|
|
60
|
+
| `network.export_har` | Yes | No* | page | `network.read` | Read an already armed CDP capture as bounded metadata-only HAR 1.2 |
|
|
54
61
|
| `network.intercept.add` | Yes | CDP | page | `network.intercept` | Add interception rule; action fulfill/continue/block |
|
|
55
62
|
| `network.intercept.remove` | Yes | CDP | page | `network.intercept` | Remove rule by `ruleId` |
|
|
56
63
|
| `network.intercept.list` | Yes | CDP | page | `network.intercept` | List active rules (rules drop on debugger detach) |
|
|
@@ -60,6 +67,10 @@ The table below includes the legacy capability bucket for each method so agents
|
|
|
60
67
|
| `navigation.go_back` | Yes | - | navigate | `navigation.control` | History back |
|
|
61
68
|
| `navigation.go_forward` | Yes | - | navigate | `navigation.control` | History forward |
|
|
62
69
|
| `dom.query` | Yes | - | inspect | `dom.read` | Query subtree with budget constraints |
|
|
70
|
+
| `dom.baseline.create` | Yes | - | inspect | `dom.read` | Retain a short-lived memory-only semantic snapshot; sequential only |
|
|
71
|
+
| `dom.baseline.compare` | Yes | - | inspect | `dom.read` | Compare current semantic DOM to an explicit retained baseline; batch-safe |
|
|
72
|
+
| `dom.baseline.describe` | Yes | - | inspect | `dom.read` | Return exact baseline scope, options, expiry, and snapshot statistics; batch-safe |
|
|
73
|
+
| `dom.baseline.release` | Yes | - | inspect | `dom.read` | Idempotently release retained baseline state; sequential only |
|
|
63
74
|
| `dom.describe` | Yes | - | inspect | `dom.read` | Single element details via `elementRef` |
|
|
64
75
|
| `dom.get_text` | Yes | - | inspect | `dom.read` | Text content with `textBudget` |
|
|
65
76
|
| `dom.get_attributes` | Yes | - | inspect | `dom.read` | Targeted attribute read |
|
|
@@ -87,28 +98,35 @@ The table below includes the legacy capability bucket for each method so agents
|
|
|
87
98
|
| `screenshot.capture_element` | Yes | CDP | capture | `screenshot.partial` | Complete element screenshot with explicit completeness metadata |
|
|
88
99
|
| `screenshot.capture_region` | Yes | CDP | capture | `screenshot.partial` | Cropped viewport region in PNG, JPEG, or WebP |
|
|
89
100
|
| `screenshot.capture_full_page` | Yes | CDP | capture | `screenshot.partial` | Full document screenshot; fails coherently above Chrome capture limits |
|
|
101
|
+
| `artifact.read` | No | daemon | raw | None | Read one bounded chunk from an owner-scoped artifact handle |
|
|
102
|
+
| `artifact.delete` | No | daemon | raw | None | Delete an owner-scoped artifact handle |
|
|
90
103
|
| `patch.apply_styles` | Yes | - | patch | `patch.styles` | Reversible CSS patch; `verify` returns computed result |
|
|
91
|
-
| `patch.apply_dom` | Yes | - | patch | `patch.dom` | Reversible
|
|
104
|
+
| `patch.apply_dom` | Yes | - | patch | `patch.dom` | Reversible text, attribute, add/remove/toggle-class mutation; `verify` returns result |
|
|
92
105
|
| `patch.list` | Yes | - | patch | `patch.dom` | Active rollback records in the current document |
|
|
93
106
|
| `patch.rollback` | Yes | - | patch | `patch.dom` | Revert one active patch |
|
|
94
107
|
| `patch.commit_session_baseline` | Yes | - | patch | `patch.dom` | Keep current mutations and discard their rollback history |
|
|
95
108
|
| `performance.get_metrics` | Yes | CDP | performance | `performance.read` | Chrome performance counters |
|
|
96
109
|
| `cdp.get_document` | Yes | CDP | cdp | `cdp.dom_snapshot` | DevTools document tree |
|
|
97
|
-
| `cdp.get_dom_snapshot` | Yes | CDP | cdp | `cdp.dom_snapshot` | DevTools DOM snapshot
|
|
110
|
+
| `cdp.get_dom_snapshot` | Yes | CDP | cdp | `cdp.dom_snapshot` | DevTools DOM snapshot; optional bounded `computedStyles` property names |
|
|
98
111
|
| `cdp.get_box_model` | Yes | CDP | cdp | `cdp.box_model` | DevTools-backed element geometry |
|
|
99
112
|
| `cdp.get_computed_styles_for_node` | Yes | CDP | cdp | `cdp.styles` | DevTools-backed computed styles |
|
|
100
113
|
| `cdp.dispatch_key_event` | Yes | CDP | cdp | `cdp.input` | DevTools keyDown/keyUp without foreground focus |
|
|
101
114
|
|
|
115
|
+
`No*` means HAR export issues no CDP command itself, but its source capture must
|
|
116
|
+
already be armed and continues to hold debugger ownership until explicitly
|
|
117
|
+
stopped.
|
|
118
|
+
|
|
102
119
|
## CLI
|
|
103
120
|
|
|
104
121
|
```bash
|
|
105
122
|
bbx status | doctor | restart | logs | tabs | skill # no routed tab needed
|
|
123
|
+
bbx protocol describe [method|group] # local signature or compact group index
|
|
106
124
|
bbx call <method> '{"key":"val"}' # generic RPC (routes to active tab in enabled window)
|
|
107
125
|
bbx call --tab 123 <method> '{...}' # explicit tab target inside enabled window
|
|
108
126
|
bbx batch '[{"method":"...","params":{}}]' # parallel calls
|
|
109
127
|
```
|
|
110
128
|
|
|
111
|
-
**Convenience shortcuts:** `access-request`, `dom-query`, `describe`, `text`, `styles`, `box`, `click`, `focus`, `type`, `press-key`, `cdp-press-key`, `patch-style`, `patch-text`, `patches`, `rollback`, `screenshot`, `eval`, `console`, `wait`, `find`, `find-role`, `html`, `hover`, `navigate`, `storage`, `tab-create`, `tab-close`, `page-text`, `network`, `a11y-tree`, `perf`, `scroll`, `resize`, `reload`, `back`, `forward`, `attrs`, `matched-rules`
|
|
129
|
+
**Convenience shortcuts:** `access-request`, `dom-query`, `describe`, `text`, `styles`, `box`, `click`, `focus`, `type`, `press-key`, `cdp-press-key`, `patch-style`, `patch-text`, `patches`, `rollback`, `screenshot`, `har`, `eval`, `console`, `wait`, `find`, `find-role`, `html`, `hover`, `navigate`, `storage`, `tab-create`, `tab-close`, `page-text`, `network`, `a11y-tree`, `perf`, `scroll`, `resize`, `reload`, `back`, `forward`, `attrs`, `matched-rules`
|
|
112
130
|
|
|
113
131
|
Newer bridge methods such as `input.scroll_into_view` and `screenshot.capture_full_page` currently use the raw path: `bbx call <method> '{...}'`.
|
|
114
132
|
|
|
@@ -181,7 +199,7 @@ bbx call page.wait_for_load_state '{"url":"/dashboard","urlMatch":"contains","wa
|
|
|
181
199
|
|
|
182
200
|
### page.get_storage
|
|
183
201
|
|
|
184
|
-
Read `localStorage` or `sessionStorage`
|
|
202
|
+
Read bounded `localStorage` or `sessionStorage` key/presence metadata. Values are never returned.
|
|
185
203
|
|
|
186
204
|
```bash
|
|
187
205
|
bbx storage # all localStorage
|
|
@@ -189,6 +207,17 @@ bbx storage session token,user # specific sessionStorage keys
|
|
|
189
207
|
bbx call page.get_storage '{"type":"session","keys":["token"]}'
|
|
190
208
|
```
|
|
191
209
|
|
|
210
|
+
### sensitive.read
|
|
211
|
+
|
|
212
|
+
Deliberately read one exact Web Storage value after discovering its key. The
|
|
213
|
+
value bypasses token truncation, is never batched or automatically retried, and
|
|
214
|
+
is returned whole or rejected whole. Every attempt creates a Sensitive access
|
|
215
|
+
Recent Activity warning without retaining the key or value.
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
bbx call sensitive.read '{"source":"session_storage","key":"token"}'
|
|
219
|
+
```
|
|
220
|
+
|
|
192
221
|
### dom.query
|
|
193
222
|
|
|
194
223
|
Run a bounded breadth-first DOM summary rooted at a selector or existing ref. Returns `{nodes, revision, truncated, registrySize}` and may also include `_registryPruned: true` when the element registry evicted older refs.
|
|
@@ -200,6 +229,23 @@ bbx call dom.query '{"selector":"main","maxNodes":10,"attributeAllowlist":["clas
|
|
|
200
229
|
|
|
201
230
|
If `_registryPruned` is true, refresh previously cached refs before reusing them.
|
|
202
231
|
|
|
232
|
+
### dom.baseline.create, compare, describe, and release
|
|
233
|
+
|
|
234
|
+
Use an explicit semantic baseline when an action must be verified against a known before-state without returning two full DOM snapshots. Baselines retain bounded structured summaries in extension memory only; they do not add attributes, scripts, or markers to the application page.
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
bbx call dom.baseline.create '{"selector":"main","maxNodes":100,"maxDepth":8,"textBudget":160,"attributeAllowlist":["data-testid"]}'
|
|
238
|
+
bbx call dom.baseline.compare '{"baselineId":"baseline_...","maxChanges":50}'
|
|
239
|
+
bbx call dom.baseline.describe '{"baselineId":"baseline_..."}'
|
|
240
|
+
bbx call dom.baseline.release '{"baselineId":"baseline_..."}'
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
The create result is a destination-bound opaque handle plus creation/expiry timestamps, window/tab/frame/document/selector/representation scope, effective capture options, and snapshot counts. It never returns retained nodes. `compare` reports exact `added`, `removed`, `changed`, `moved`, `unchanged`, and total counts while bounding returned examples with `maxChanges`; ambiguity and omitted evidence are explicit. `describe` returns the exact descriptor. `release` is idempotent.
|
|
244
|
+
|
|
245
|
+
Creation and release are stateful and excluded from read-only batch. Compare and describe do not mutate the baseline or extend its five-minute expiry, so they are batch-safe. Navigation, document replacement, tab/window cleanup, access disable, destination disconnect, expiry, quota eviction, or explicit release makes the handle unavailable. Navigation and document replacement return `DOM_BASELINE_INVALIDATED`; missing, expired, released, or evicted handles return `DOM_BASELINE_NOT_FOUND`.
|
|
246
|
+
|
|
247
|
+
Capture defaults to stable semantic fields and safe attributes. Form values and event-handler attributes are never retained, URL credentials/fragments/query values are removed, opaque URL payloads are redacted, and caller-provided attribute names are canonicalized and bounded. Use a narrow selector for dialogs, forms, lists, or application regions.
|
|
248
|
+
|
|
203
249
|
### dom.wait_for
|
|
204
250
|
|
|
205
251
|
Wait for a DOM condition using MutationObserver + 250 ms polling fallback. A text-only wait searches all elements. `hidden` succeeds when no matching visible element remains, including when it is absent. Returns `{found, elementRef, duration}`.
|
|
@@ -359,9 +405,45 @@ bbx call page.get_network '{"source":"cdp","capture":"stop"}'
|
|
|
359
405
|
|
|
360
406
|
CDP URL output removes credentials and fragments, replaces every query value with `[redacted]`, and summarizes data/blob URLs. Request/response bodies, cookies, authorization values, and complete headers are not returned. This mode captures all observed resource classes and is materially more expensive and intrusive than fetch/XHR instrumentation; always stop it when finished.
|
|
361
407
|
|
|
408
|
+
### network.export_har
|
|
409
|
+
|
|
410
|
+
Export metadata-only HAR 1.2 from a CDP capture that is currently armed. The
|
|
411
|
+
method is a read and does not attach, start, stop, clear, or otherwise change the
|
|
412
|
+
capture. Use this exact sequence:
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
bbx call page.get_network '{"source":"cdp","capture":"start"}'
|
|
416
|
+
# reproduce the activity
|
|
417
|
+
bbx har --limit 100 --url-pattern /api/ reproduction.har
|
|
418
|
+
bbx call page.get_network '{"source":"cdp","capture":"stop"}'
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Parameters are `limit` (1-200, default 50), `urlPattern` (at most 2048
|
|
422
|
+
characters; substring match on sanitized URLs), and `delivery` (`auto` default,
|
|
423
|
+
`inline`, or `artifact`). Count and inline byte/token limits retain the newest
|
|
424
|
+
matching entries and remove complete oldest entries; fields are not truncated to
|
|
425
|
+
fit. `auto` uses an artifact above 256 KiB, while explicit `artifact` always
|
|
426
|
+
returns one. Artifacts last five minutes, are readable/deletable only by their
|
|
427
|
+
requesting client, use private daemon files, and expose no browser-host path.
|
|
428
|
+
|
|
429
|
+
HAR URLs preserve schemes, hosts, paths, and query names, remove credentials and
|
|
430
|
+
fragments, and replace query values with `[redacted]`. `queryString`, headers,
|
|
431
|
+
and cookies are empty; bodies and authorization data are absent. Unsupported
|
|
432
|
+
header/body/content sizes and send/wait/receive timing phases are `-1`.
|
|
433
|
+
`entry.time` is observed total duration. Redirects are separate observed entries;
|
|
434
|
+
`_bbx` reports resource type, failure reason, and memory/disk/prefetch cache and
|
|
435
|
+
service-worker observations. Result counters expose completed-entry loss as
|
|
436
|
+
`dropped`, discarded unfinished activity as `abandoned`, and requests still
|
|
437
|
+
unfinished and omitted from the HAR as `inflight`.
|
|
438
|
+
|
|
439
|
+
MCP uses `browser_page` with `action: "har"`. `bbx har` accepts the same limit,
|
|
440
|
+
URL pattern, and delivery choices, then uses one client connection to download
|
|
441
|
+
owner-scoped chunks, verify byte length/SHA-256 and HAR shape, delete the
|
|
442
|
+
artifact, and atomically write the output on the CLI host.
|
|
443
|
+
|
|
362
444
|
### dom.get_accessibility_tree
|
|
363
445
|
|
|
364
|
-
Retrieve a depth-limited accessibility tree via CDP. Full reads use `Accessibility.getFullAXTree`; an optional unique `selector` resolves through CDP DOM methods
|
|
446
|
+
Retrieve a depth-limited accessibility tree via CDP. Full reads use `Accessibility.getFullAXTree`; an optional unique `selector` resolves through CDP DOM methods, starts with `Accessibility.getPartialAXTree`, and incrementally fetches selected descendant layers with `Accessibility.getChildAXNodes`. Only the selected subtree and required ancestor chain are retained. Missing and ambiguous selectors return typed errors instead of selecting an arbitrary candidate. Nodes include `role`, `name`, `description`, `value`, state fields, `interactive`, `semanticInteractive`, `focusable`, `focusableAndEnabled`, `ignored`, and `childIds`. `interactive` is semantic/focusability metadata, not current pointer actionability.
|
|
365
447
|
|
|
366
448
|
This is debugger-backed. Prefer `dom.find_by_role`, `dom.find_by_text`, and targeted `dom.query`/`dom.describe` first.
|
|
367
449
|
|
|
@@ -373,7 +455,7 @@ bbx call dom.get_accessibility_tree '{"maxNodes":100,"maxDepth":6,"interactiveOn
|
|
|
373
455
|
bbx call dom.get_accessibility_tree '{"selector":"[role=dialog]","maxNodes":50,"compact":true}'
|
|
374
456
|
```
|
|
375
457
|
|
|
376
|
-
Filtering occurs before `maxNodes`. Compact mode drops ignored, decorative, and empty nodes while reconnecting retained descendants; interactive-only keeps non-ignored semantic interactive roles.
|
|
458
|
+
Filtering occurs before `maxNodes`. Compact mode drops ignored, decorative, and empty nodes while reconnecting retained descendants; interactive-only keeps non-ignored semantic interactive roles. Full reads ask CDP for the requested depth, while selector-scoped reads fetch descendant layers up to that same bound. Every result reports `truncated: true`, `partialTopology: true`, depth metadata, missing-child counts, and a continuation hint. No AX node is written into the page DOM or converted directly into an actionable element ref; use role/name with `dom.find_by_role` before input.
|
|
377
459
|
|
|
378
460
|
### viewport.resize
|
|
379
461
|
|
|
@@ -389,7 +471,9 @@ bbx call viewport.resize '{"reset":true}'
|
|
|
389
471
|
|
|
390
472
|
### performance.get_metrics
|
|
391
473
|
|
|
392
|
-
Read Chrome
|
|
474
|
+
Read a browser-maintained point sample of raw Chrome counters via CDP `Performance.getMetrics`. The additive result is `{metrics, measurement}`, where `measurement` identifies the CDP source, `timeTicks` domain, sample timestamp, point-sample observation, and `webVitals: "not_measured"`. Metric names, availability, and units are defined by Chrome/CDP and can vary by browser version.
|
|
475
|
+
|
|
476
|
+
BBX does not establish a navigation observation window and does not measure LCP, CLS, or INP. Do not interpret the returned counters as Web Vitals or page-load measurements.
|
|
393
477
|
|
|
394
478
|
Debugger-backed. Use after lighter reads fail to explain a performance symptom.
|
|
395
479
|
|
|
@@ -400,16 +484,40 @@ bbx call performance.get_metrics
|
|
|
400
484
|
|
|
401
485
|
### screenshot.capture_\*
|
|
402
486
|
|
|
403
|
-
Capture a complete element, a tight viewport region, or a full document. All methods accept `format: "png" | "jpeg" | "webp"`; JPEG and WebP additionally accept integer `quality` from 0 to 100. Results include matching `format`, `mimeType`, `complete`, and `
|
|
487
|
+
Capture a complete element, a tight viewport region, or a full document. All methods accept `format: "png" | "jpeg" | "webp"`, `scale` from 0.1 to 4, and `delivery: "inline" | "artifact" | "auto"`; JPEG and WebP additionally accept integer `quality` from 0 to 100. Results include matching `format`, `mimeType`, encoded `byteLength`, actual `dimensions`, `complete`, `clipped`, and `delivery` metadata.
|
|
404
488
|
|
|
405
489
|
Element capture uses full page-coordinate bounds with CDP capture beyond the viewport. If Browser Bridge cannot guarantee the entire element, or if an element/page exceeds Chrome capture limits, it returns a typed failure rather than a viewport-clipped image labeled complete. Use full-page capture only when element or tight region captures cannot express the issue.
|
|
406
490
|
|
|
407
|
-
Raw calls
|
|
491
|
+
Raw calls default to inline base64 for compatibility. `auto` keeps small captures inline and returns a short-lived, daemon-owned opaque artifact handle for large captures; explicit `inline` preserves MCP image content when model vision is needed. Artifact handles expose no browser-host path and support owner-scoped bounded `artifact.read` and `artifact.delete` calls. Each standalone CLI invocation uses a new artifact owner, so raw CLI screenshot calls should keep inline delivery. Prefer `bbx screenshot [--format png|jpeg|webp] [--quality 0-100] <ref> [outPath]` when one element is enough; the CLI downloads, verifies, deletes, and atomically writes the artifact within one process.
|
|
492
|
+
|
|
493
|
+
Artifact handles expire after five minutes and can be read or deleted only by
|
|
494
|
+
the requesting client. The daemon creates a private artifact directory and
|
|
495
|
+
owner-only files on POSIX hosts, removes artifacts on expiry/teardown, and never
|
|
496
|
+
returns its browser-host filesystem path.
|
|
408
497
|
|
|
409
498
|
```bash
|
|
410
|
-
bbx call screenshot.capture_full_page '{"format":"jpeg","quality":75}'
|
|
499
|
+
bbx call screenshot.capture_full_page '{"format":"jpeg","quality":75,"delivery":"inline","scale":0.75}'
|
|
411
500
|
```
|
|
412
501
|
|
|
502
|
+
## Recovery Telemetry
|
|
503
|
+
|
|
504
|
+
Recovery telemetry is process-local and uses fixed five-second buckets over a
|
|
505
|
+
five-minute window. Three failures for the same hidden group within 60 seconds
|
|
506
|
+
set `activeLoop` for that category. Public summaries always use only these fixed
|
|
507
|
+
categories: `automatic_mcp_retry`, `stale_ref_recovery`, `debugger_reattach`,
|
|
508
|
+
`content_script_reinjection`, `native_host_reconnect`, and `request_outcome`.
|
|
509
|
+
They contain attempts/successes/failures/pending, bounded rates, saturation,
|
|
510
|
+
last-event timestamps, and loop flags, but no page data, URL, selector, payload,
|
|
511
|
+
error text, method name, tab identifier, or internal group name.
|
|
512
|
+
|
|
513
|
+
`health.ping` includes daemon and available routed-extension summaries;
|
|
514
|
+
`daemon.metrics` includes daemon scope. `bbx doctor` combines both, marks active
|
|
515
|
+
loops as issues, and emits fixed guidance. Stop repeated attempts: re-query stale
|
|
516
|
+
refs, close competing debuggers, reload extension/page after reinjection
|
|
517
|
+
failures, restart for native-host reconnect failures, stop automatic MCP retry
|
|
518
|
+
loops, or inspect the first typed error for request failures. Extension data
|
|
519
|
+
resets with the service worker and daemon data resets with the daemon.
|
|
520
|
+
|
|
413
521
|
## Request Envelope
|
|
414
522
|
|
|
415
523
|
```json
|
|
@@ -433,6 +541,9 @@ bbx call screenshot.capture_full_page '{"format":"jpeg","quality":75}'
|
|
|
433
541
|
| `ELEMENT_NOT_ACTIONABLE` | Inspect hidden/disabled/inert/zero-size target | `retry: false`, use `dom.describe` |
|
|
434
542
|
| `ELEMENT_OBSCURED` | Inspect the element blocking the target point | `retry: false`, use `layout.hit_test` |
|
|
435
543
|
| `ELEMENT_NOT_FOUND` | Correct or narrow the selector | `retry: false`, use `dom.query` |
|
|
544
|
+
| `DOM_BASELINE_NOT_FOUND` | Handle expired, released, evicted, or does not exist | `retry: false`, create a new baseline |
|
|
545
|
+
| `DOM_BASELINE_INVALIDATED` | Navigation, document, or access scope changed | `retry: false`, create a new baseline |
|
|
546
|
+
| `DOM_BASELINE_QUOTA_EXCEEDED` | Snapshot or retained-state quota was exceeded | `retry: false`, narrow selector or release |
|
|
436
547
|
| `INPUT_UNSUPPORTED` | Use DOM execution or a CDP-supported input method | `retry: false` |
|
|
437
548
|
| `INPUT_INVALID_TARGET` | Choose a control compatible with the input | `retry: false`, use `dom.describe` |
|
|
438
549
|
| `INPUT_FOCUS_CHANGED` | Inspect focus handlers; do not replay native text blindly | `retry: false`, use `dom.describe` |
|
|
@@ -442,7 +553,6 @@ bbx call screenshot.capture_full_page '{"format":"jpeg","quality":75}'
|
|
|
442
553
|
| `NATIVE_HOST_UNAVAILABLE` | Check daemon: `bbx status` | `retry: false` |
|
|
443
554
|
| `EXTENSION_DISCONNECTED` | Extension not connected to daemon | `retry: true` after 3 s, check `health.ping` |
|
|
444
555
|
| `TIMEOUT` | Wait/evaluate exceeded `timeoutMs` | `retry: true` after 1 s |
|
|
445
|
-
| `RATE_LIMITED` | Too many requests | `retry: true` after 2 s |
|
|
446
556
|
|
|
447
557
|
Timeout on content-script request → use narrower `dom.query` or CDP fallback.
|
|
448
558
|
Timeout on navigation → increase `timeoutMs`, set `waitForLoad:false`, or check `page.get_state`.
|
|
@@ -14,7 +14,7 @@ These presets are also available at runtime via `bbx skill`.
|
|
|
14
14
|
|
|
15
15
|
## Debugger Policy
|
|
16
16
|
|
|
17
|
-
Avoid debugger-backed methods until they are clearly necessary. In Browser Bridge, `page.evaluate`, `page.handle_dialog`, `dom.get_accessibility_tree`, CDP network capture, CDP input execution, `viewport.resize`, `performance.get_metrics`, `screenshot.capture_*`, and `cdp.*` attach `chrome.debugger`, which can make Chrome show its native debugging banner across the running browser instance.
|
|
17
|
+
Avoid debugger-backed methods until they are clearly necessary. In Browser Bridge, `page.evaluate`, `page.handle_dialog`, `dom.get_accessibility_tree`, CDP network capture, CDP input execution, `viewport.resize`, `performance.get_metrics`, `screenshot.capture_*`, and `cdp.*` attach `chrome.debugger`, which can make Chrome show its native debugging banner across the running browser instance. `network.export_har` does not attach by itself, but it requires the explicit CDP capture to remain armed.
|
|
18
18
|
|
|
19
19
|
## Decision Tree
|
|
20
20
|
|
|
@@ -28,12 +28,13 @@ Avoid debugger-backed methods until they are clearly necessary. In Browser Bridg
|
|
|
28
28
|
8. **Need article or documentation content?** → `page.extract_content` (removes navigation and repeated chrome)
|
|
29
29
|
9. **Need all visible page UI text?** → `page.get_text` (cheaper than `dom.query` on body)
|
|
30
30
|
10. **Need API call history?** → default `page.get_network` (intercepted fetch/XHR log)
|
|
31
|
-
11. **Need
|
|
32
|
-
12. **Need
|
|
33
|
-
13. **Need
|
|
34
|
-
14. **
|
|
35
|
-
15. **
|
|
36
|
-
16. **
|
|
31
|
+
11. **Need portable all-resource evidence?** → explicitly arm CDP, reproduce, `network.export_har`, then stop capture
|
|
32
|
+
12. **Need framework/app state and no lighter read can expose it?** → `page.evaluate` (debugger-backed)
|
|
33
|
+
13. **Need semantic structure and role/text queries are insufficient?** → compact or interactive-only `dom.get_accessibility_tree` (debugger-backed)
|
|
34
|
+
14. **Need a raw Chrome/CDP counter point sample?** → `performance.get_metrics` (debugger-backed; no BBX navigation window or LCP/CLS/INP measurement)
|
|
35
|
+
15. **Testing responsive with an exact forced viewport?** → `viewport.resize` (debugger-backed)
|
|
36
|
+
16. **Visual ambiguity after structured reads?** → `screenshot.capture_element` first, or `screenshot.capture_region` with a tight crop when one element is not enough (debugger-backed)
|
|
37
|
+
17. **Content-script blocked?** → `cdp.get_document` or `cdp.get_dom_snapshot` (debugger-backed fallback)
|
|
37
38
|
|
|
38
39
|
## Allowlist Strategy
|
|
39
40
|
|
|
@@ -70,6 +71,7 @@ Omitting allowlists or leaving the text budget wide open often returns 3–5× t
|
|
|
70
71
|
| Fetching network via evaluate hacks | ~400 tok | Use `page.get_network` (auto-interceptor) |
|
|
71
72
|
| Full a11y tree with no limits | ~3000 tok | Set `maxNodes` ≤ 50, `maxDepth` ≤ 4 |
|
|
72
73
|
| CDP network capture for API-only traffic | debugger lifecycle | Use default fetch/XHR capture; reserve CDP for all-resource failures |
|
|
74
|
+
| Broad inline HAR export | token/byte pressure | Narrow `urlPattern`/`limit`, or use `delivery: "artifact"`; bounds remove whole entries |
|
|
73
75
|
| Repeated page-state polling for a route | ~500 tok/poll | Use one event-aware `page.wait_for_load_state` URL condition |
|
|
74
76
|
|
|
75
77
|
## Efficient Loop
|
|
@@ -133,6 +135,14 @@ The interceptor auto-installs on first call. Before reproducing an event, call `
|
|
|
133
135
|
|
|
134
136
|
Only escalate to `source: "cdp"` when fetch/XHR misses the relevant document, asset, socket, cache, redirect, or failed-resource metadata. CDP must be started before reproduction and explicitly stopped afterward; it holds debugger ownership, tracks in-flight state, and returns a larger entry shape. Its URLs redact credentials, fragments, and query values, and it never returns bodies, cookies, authorization values, or complete headers.
|
|
135
137
|
|
|
138
|
+
For a HAR, export while that capture is still armed, then stop it. Use a narrow
|
|
139
|
+
sanitized-URL `urlPattern` and small `limit` first. Inline delivery removes whole
|
|
140
|
+
oldest entries to meet byte/token bounds rather than truncating fields; inspect
|
|
141
|
+
`truncation`, `dropped`, `abandoned`, and `inflight`. Use `delivery: "artifact"`
|
|
142
|
+
for larger evidence. The five-minute opaque handle is owner-scoped and has no
|
|
143
|
+
browser-host path; `bbx har` downloads, verifies, deletes, and atomically writes
|
|
144
|
+
it on the CLI host through the same client.
|
|
145
|
+
|
|
136
146
|
## Accessibility Tree for Semantic Discovery
|
|
137
147
|
|
|
138
148
|
When you need to understand the page's interactive structure without guessing selectors:
|