@browserbridge/bbx 1.7.4 → 1.7.6

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.
Files changed (34) hide show
  1. package/package.json +6 -6
  2. package/packages/agent-client/src/atomic-write.js +99 -0
  3. package/packages/agent-client/src/cli-args.js +152 -0
  4. package/packages/agent-client/src/cli-batch.js +140 -0
  5. package/packages/agent-client/src/cli-helpers.js +20 -3
  6. package/packages/agent-client/src/cli-output.js +57 -0
  7. package/packages/agent-client/src/cli-proxy-remote.js +350 -0
  8. package/packages/agent-client/src/cli-setup-commands.js +404 -0
  9. package/packages/agent-client/src/cli.js +63 -906
  10. package/packages/agent-client/src/command-registry.js +12 -6
  11. package/packages/agent-client/src/install.js +39 -4
  12. package/packages/agent-client/src/mcp-config.js +28 -14
  13. package/packages/agent-client/src/remotes.js +93 -15
  14. package/packages/agent-client/src/runtime.js +6 -4
  15. package/packages/mcp-server/src/bin.js +10 -1
  16. package/packages/mcp-server/src/guidance.js +1 -1
  17. package/packages/mcp-server/src/handlers-capture.js +8 -5
  18. package/packages/mcp-server/src/handlers-dom.js +2 -2
  19. package/packages/mcp-server/src/handlers-navigation.js +20 -9
  20. package/packages/mcp-server/src/handlers-page.js +111 -111
  21. package/packages/mcp-server/src/handlers-utils.js +268 -8
  22. package/packages/mcp-server/src/handlers.js +31 -10
  23. package/packages/mcp-server/src/lifecycle.js +413 -0
  24. package/packages/mcp-server/src/server.js +27 -19
  25. package/packages/native-host/src/auth-token.js +1 -1
  26. package/packages/native-host/src/config.js +9 -4
  27. package/packages/native-host/src/daemon-process.js +8 -1
  28. package/packages/protocol/src/capabilities.js +33 -110
  29. package/packages/protocol/src/capability-values.js +45 -0
  30. package/packages/protocol/src/defaults.js +19 -2
  31. package/packages/protocol/src/protocol.js +106 -5
  32. package/packages/protocol/src/registry.js +299 -86
  33. package/packages/protocol/src/types.ts +19 -1
  34. package/skills/browser-bridge/SKILL.md +1 -1
@@ -1,5 +1,7 @@
1
1
  // @ts-check
2
2
 
3
+ import { CAPABILITIES } from './capability-values.js';
4
+
3
5
  /**
4
6
  * @typedef {'trivial' | 'low' | 'moderate' | 'high'} BridgeMethodComplexity
5
7
  */
@@ -11,14 +13,79 @@
11
13
  * params: readonly string[],
12
14
  * description: string,
13
15
  * since: string,
14
- * complexity: BridgeMethodComplexity
16
+ * complexity: BridgeMethodComplexity,
17
+ * capability: import('./types.js').Capability | null,
18
+ * debuggerBacked: boolean
15
19
  * }} BridgeMethodRegistryEntry
16
20
  */
17
21
 
22
+ /**
23
+ * @typedef {{
24
+ * capability: import('./types.js').Capability | null,
25
+ * debuggerBacked?: boolean
26
+ * }} BridgeMethodPolicy
27
+ */
28
+
29
+ /** @type {Readonly<Record<string, Readonly<BridgeMethodPolicy>>>} */
30
+ const METHOD_POLICIES = Object.freeze({
31
+ none: Object.freeze({ capability: null }),
32
+ tabsManage: Object.freeze({ capability: CAPABILITIES.TABS_MANAGE }),
33
+ pageRead: Object.freeze({ capability: CAPABILITIES.PAGE_READ }),
34
+ pageEvaluateDebugger: Object.freeze({
35
+ capability: CAPABILITIES.PAGE_EVALUATE,
36
+ debuggerBacked: true,
37
+ }),
38
+ networkRead: Object.freeze({ capability: CAPABILITIES.NETWORK_READ }),
39
+ networkInterceptDebugger: Object.freeze({
40
+ capability: CAPABILITIES.NETWORK_INTERCEPT,
41
+ debuggerBacked: true,
42
+ }),
43
+ navigationControl: Object.freeze({ capability: CAPABILITIES.NAVIGATION_CONTROL }),
44
+ domRead: Object.freeze({ capability: CAPABILITIES.DOM_READ }),
45
+ domReadDebugger: Object.freeze({
46
+ capability: CAPABILITIES.DOM_READ,
47
+ debuggerBacked: true,
48
+ }),
49
+ layoutRead: Object.freeze({ capability: CAPABILITIES.LAYOUT_READ }),
50
+ stylesRead: Object.freeze({ capability: CAPABILITIES.STYLES_READ }),
51
+ viewportControl: Object.freeze({ capability: CAPABILITIES.VIEWPORT_CONTROL }),
52
+ viewportControlDebugger: Object.freeze({
53
+ capability: CAPABILITIES.VIEWPORT_CONTROL,
54
+ debuggerBacked: true,
55
+ }),
56
+ automationInput: Object.freeze({ capability: CAPABILITIES.AUTOMATION_INPUT }),
57
+ screenshotPartialDebugger: Object.freeze({
58
+ capability: CAPABILITIES.SCREENSHOT_PARTIAL,
59
+ debuggerBacked: true,
60
+ }),
61
+ patchDom: Object.freeze({ capability: CAPABILITIES.PATCH_DOM }),
62
+ patchStyles: Object.freeze({ capability: CAPABILITIES.PATCH_STYLES }),
63
+ cdpDomSnapshotDebugger: Object.freeze({
64
+ capability: CAPABILITIES.CDP_DOM_SNAPSHOT,
65
+ debuggerBacked: true,
66
+ }),
67
+ cdpBoxModelDebugger: Object.freeze({
68
+ capability: CAPABILITIES.CDP_BOX_MODEL,
69
+ debuggerBacked: true,
70
+ }),
71
+ cdpStylesDebugger: Object.freeze({
72
+ capability: CAPABILITIES.CDP_STYLES,
73
+ debuggerBacked: true,
74
+ }),
75
+ cdpInputDebugger: Object.freeze({
76
+ capability: CAPABILITIES.CDP_INPUT,
77
+ debuggerBacked: true,
78
+ }),
79
+ performanceReadDebugger: Object.freeze({
80
+ capability: CAPABILITIES.PERFORMANCE_READ,
81
+ debuggerBacked: true,
82
+ }),
83
+ });
84
+
18
85
  /**
19
86
  * Canonical bridge method registry. This is the shared source of truth for
20
- * method grouping, tab-routing requirements, and exposed params so the protocol,
21
- * CLI, MCP layer, and docs can stay aligned.
87
+ * method grouping, tab-routing requirements, exposed params, capability mapping,
88
+ * and debugger policy so the protocol, CLI, MCP layer, and docs can stay aligned.
22
89
  *
23
90
  * @type {Readonly<Record<import('./types.js').BridgeMethod, string>>}
24
91
  */
@@ -97,10 +164,18 @@ const BRIDGE_METHOD_DESCRIPTIONS = Object.freeze({
97
164
  * @param {boolean} tab
98
165
  * @param {readonly string[]} params
99
166
  * @param {BridgeMethodComplexity} [complexity='low']
167
+ * @param {Readonly<BridgeMethodPolicy>} [policy=METHOD_POLICIES.none]
100
168
  * @returns {BridgeMethodRegistryEntry}
101
169
  */
102
- function createRegistryEntry(method, group, tab, params, complexity = 'low') {
103
- return {
170
+ function createRegistryEntry(
171
+ method,
172
+ group,
173
+ tab,
174
+ params,
175
+ complexity = 'low',
176
+ policy = METHOD_POLICIES.none
177
+ ) {
178
+ const entry = {
104
179
  group,
105
180
  tab,
106
181
  params,
@@ -108,6 +183,13 @@ function createRegistryEntry(method, group, tab, params, complexity = 'low') {
108
183
  since: '1.0',
109
184
  complexity,
110
185
  };
186
+
187
+ return /** @type {BridgeMethodRegistryEntry} */ (
188
+ Object.defineProperties(entry, {
189
+ capability: { value: policy.capability },
190
+ debuggerBacked: { value: policy.debuggerBacked ?? false },
191
+ })
192
+ );
111
193
  }
112
194
 
113
195
  /** @type {Readonly<Record<import('./types.js').BridgeMethod, BridgeMethodRegistryEntry>>} */
@@ -134,48 +216,86 @@ export const BRIDGE_METHOD_REGISTRY = Object.freeze({
134
216
  'daemon.metrics': createRegistryEntry('daemon.metrics', 'system', false, [], 'trivial'),
135
217
  // tabs - trivial
136
218
  'tabs.list': createRegistryEntry('tabs.list', 'tabs', false, [], 'trivial'),
137
- 'tabs.create': createRegistryEntry('tabs.create', 'tabs', false, ['url', 'active'], 'trivial'),
138
- 'tabs.close': createRegistryEntry('tabs.close', 'tabs', false, ['tabId'], 'trivial'),
139
- 'tabs.activate': createRegistryEntry('tabs.activate', 'tabs', false, ['tabId'], 'trivial'),
219
+ 'tabs.create': createRegistryEntry(
220
+ 'tabs.create',
221
+ 'tabs',
222
+ false,
223
+ ['url', 'active'],
224
+ 'trivial',
225
+ METHOD_POLICIES.tabsManage
226
+ ),
227
+ 'tabs.close': createRegistryEntry(
228
+ 'tabs.close',
229
+ 'tabs',
230
+ false,
231
+ ['tabId'],
232
+ 'trivial',
233
+ METHOD_POLICIES.tabsManage
234
+ ),
235
+ 'tabs.activate': createRegistryEntry(
236
+ 'tabs.activate',
237
+ 'tabs',
238
+ false,
239
+ ['tabId'],
240
+ 'trivial',
241
+ METHOD_POLICIES.tabsManage
242
+ ),
140
243
  // page - low (basic reads), moderate (evaluate, debugger-backed)
141
- 'page.get_state': createRegistryEntry('page.get_state', 'page', true, [], 'low'),
142
- 'page.evaluate': {
143
- ...createRegistryEntry(
144
- 'page.evaluate',
145
- 'page',
146
- true,
147
- ['expression', 'awaitPromise', 'timeoutMs', 'returnByValue'],
148
- 'moderate'
149
- ),
150
- },
244
+ 'page.get_state': createRegistryEntry(
245
+ 'page.get_state',
246
+ 'page',
247
+ true,
248
+ [],
249
+ 'low',
250
+ METHOD_POLICIES.pageRead
251
+ ),
252
+ 'page.evaluate': createRegistryEntry(
253
+ 'page.evaluate',
254
+ 'page',
255
+ true,
256
+ ['expression', 'awaitPromise', 'timeoutMs', 'returnByValue'],
257
+ 'moderate',
258
+ METHOD_POLICIES.pageEvaluateDebugger
259
+ ),
151
260
  'page.get_console': createRegistryEntry(
152
261
  'page.get_console',
153
262
  'page',
154
263
  true,
155
264
  ['level', 'clear', 'limit'],
156
- 'low'
265
+ 'low',
266
+ METHOD_POLICIES.pageRead
157
267
  ),
158
268
  'page.wait_for_load_state': createRegistryEntry(
159
269
  'page.wait_for_load_state',
160
270
  'wait',
161
271
  true,
162
272
  ['timeoutMs'],
163
- 'low'
273
+ 'low',
274
+ METHOD_POLICIES.pageRead
164
275
  ),
165
276
  'page.get_storage': createRegistryEntry(
166
277
  'page.get_storage',
167
278
  'page',
168
279
  true,
169
280
  ['type', 'keys'],
170
- 'low'
281
+ 'low',
282
+ METHOD_POLICIES.pageRead
283
+ ),
284
+ 'page.get_text': createRegistryEntry(
285
+ 'page.get_text',
286
+ 'page',
287
+ true,
288
+ ['textBudget'],
289
+ 'low',
290
+ METHOD_POLICIES.pageRead
171
291
  ),
172
- 'page.get_text': createRegistryEntry('page.get_text', 'page', true, ['textBudget'], 'low'),
173
292
  'page.get_network': createRegistryEntry(
174
293
  'page.get_network',
175
294
  'page',
176
295
  true,
177
296
  ['clear', 'limit', 'urlPattern'],
178
- 'low'
297
+ 'low',
298
+ METHOD_POLICIES.networkRead
179
299
  ),
180
300
  // network intercept - moderate (holds debugger session)
181
301
  'network.intercept.add': createRegistryEntry(
@@ -183,28 +303,32 @@ export const BRIDGE_METHOD_REGISTRY = Object.freeze({
183
303
  'page',
184
304
  true,
185
305
  ['urlPattern', 'action', 'statusCode', 'body', 'headers'],
186
- 'moderate'
306
+ 'moderate',
307
+ METHOD_POLICIES.networkInterceptDebugger
187
308
  ),
188
309
  'network.intercept.remove': createRegistryEntry(
189
310
  'network.intercept.remove',
190
311
  'page',
191
312
  true,
192
313
  ['ruleId'],
193
- 'trivial'
314
+ 'trivial',
315
+ METHOD_POLICIES.networkInterceptDebugger
194
316
  ),
195
317
  'network.intercept.list': createRegistryEntry(
196
318
  'network.intercept.list',
197
319
  'page',
198
320
  true,
199
321
  [],
200
- 'trivial'
322
+ 'trivial',
323
+ METHOD_POLICIES.networkInterceptDebugger
201
324
  ),
202
325
  'network.intercept.clear': createRegistryEntry(
203
326
  'network.intercept.clear',
204
327
  'page',
205
328
  true,
206
329
  [],
207
- 'low'
330
+ 'low',
331
+ METHOD_POLICIES.networkInterceptDebugger
208
332
  ),
209
333
  // navigation - low
210
334
  'navigation.navigate': createRegistryEntry(
@@ -212,96 +336,113 @@ export const BRIDGE_METHOD_REGISTRY = Object.freeze({
212
336
  'navigate',
213
337
  true,
214
338
  ['url', 'waitForLoad', 'timeoutMs'],
215
- 'low'
339
+ 'low',
340
+ METHOD_POLICIES.navigationControl
216
341
  ),
217
342
  'navigation.reload': createRegistryEntry(
218
343
  'navigation.reload',
219
344
  'navigate',
220
345
  true,
221
346
  ['waitForLoad', 'timeoutMs'],
222
- 'low'
347
+ 'low',
348
+ METHOD_POLICIES.navigationControl
223
349
  ),
224
350
  'navigation.go_back': createRegistryEntry(
225
351
  'navigation.go_back',
226
352
  'navigate',
227
353
  true,
228
354
  ['waitForLoad', 'timeoutMs'],
229
- 'low'
355
+ 'low',
356
+ METHOD_POLICIES.navigationControl
230
357
  ),
231
358
  'navigation.go_forward': createRegistryEntry(
232
359
  'navigation.go_forward',
233
360
  'navigate',
234
361
  true,
235
362
  ['waitForLoad', 'timeoutMs'],
236
- 'low'
363
+ 'low',
364
+ METHOD_POLICIES.navigationControl
237
365
  ),
238
366
  // dom - low (reads), moderate (accessibility tree)
239
- 'dom.query': {
240
- ...createRegistryEntry(
241
- 'dom.query',
242
- 'inspect',
243
- true,
244
- [
245
- 'selector',
246
- 'withinRef',
247
- 'maxNodes',
248
- 'maxDepth',
249
- 'textBudget',
250
- 'includeBbox',
251
- 'attributeAllowlist',
252
- ],
253
- 'low'
254
- ),
255
- },
256
- 'dom.describe': createRegistryEntry('dom.describe', 'inspect', true, ['elementRef'], 'low'),
367
+ 'dom.query': createRegistryEntry(
368
+ 'dom.query',
369
+ 'inspect',
370
+ true,
371
+ [
372
+ 'selector',
373
+ 'withinRef',
374
+ 'maxNodes',
375
+ 'maxDepth',
376
+ 'textBudget',
377
+ 'includeBbox',
378
+ 'attributeAllowlist',
379
+ ],
380
+ 'low',
381
+ METHOD_POLICIES.domRead
382
+ ),
383
+ 'dom.describe': createRegistryEntry(
384
+ 'dom.describe',
385
+ 'inspect',
386
+ true,
387
+ ['elementRef'],
388
+ 'low',
389
+ METHOD_POLICIES.domRead
390
+ ),
257
391
  'dom.get_text': createRegistryEntry(
258
392
  'dom.get_text',
259
393
  'inspect',
260
394
  true,
261
395
  ['elementRef', 'textBudget'],
262
- 'low'
396
+ 'low',
397
+ METHOD_POLICIES.domRead
263
398
  ),
264
399
  'dom.get_attributes': createRegistryEntry(
265
400
  'dom.get_attributes',
266
401
  'inspect',
267
402
  true,
268
403
  ['elementRef', 'attributes'],
269
- 'low'
404
+ 'low',
405
+ METHOD_POLICIES.domRead
270
406
  ),
271
407
  'dom.wait_for': createRegistryEntry(
272
408
  'dom.wait_for',
273
409
  'wait',
274
410
  true,
275
411
  ['selector', 'text', 'state', 'timeoutMs'],
276
- 'low'
412
+ 'low',
413
+ METHOD_POLICIES.domRead
277
414
  ),
278
415
  'dom.find_by_text': createRegistryEntry(
279
416
  'dom.find_by_text',
280
417
  'inspect',
281
418
  true,
282
419
  ['text', 'exact', 'selector', 'maxResults'],
283
- 'low'
420
+ 'low',
421
+ METHOD_POLICIES.domRead
284
422
  ),
285
423
  'dom.find_by_role': createRegistryEntry(
286
424
  'dom.find_by_role',
287
425
  'inspect',
288
426
  true,
289
427
  ['role', 'name', 'selector', 'maxResults'],
290
- 'low'
428
+ 'low',
429
+ METHOD_POLICIES.domRead
291
430
  ),
292
431
  'dom.get_html': createRegistryEntry(
293
432
  'dom.get_html',
294
433
  'inspect',
295
434
  true,
296
435
  ['elementRef', 'outer', 'maxLength'],
297
- 'low'
436
+ 'low',
437
+ METHOD_POLICIES.domRead
298
438
  ),
299
439
  'dom.get_accessibility_tree': createRegistryEntry(
300
440
  'dom.get_accessibility_tree',
301
441
  'inspect',
302
442
  true,
303
443
  ['maxNodes', 'maxDepth'],
304
- 'moderate'
444
+ 'moderate',
445
+ METHOD_POLICIES.domReadDebugger
305
446
  ),
306
447
  // layout - low
307
448
  'layout.get_box_model': createRegistryEntry(
@@ -309,23 +450,33 @@ export const BRIDGE_METHOD_REGISTRY = Object.freeze({
309
450
  'inspect',
310
451
  true,
311
452
  ['elementRef'],
312
- 'low'
453
+ 'low',
454
+ METHOD_POLICIES.layoutRead
455
+ ),
456
+ 'layout.hit_test': createRegistryEntry(
457
+ 'layout.hit_test',
458
+ 'inspect',
459
+ true,
460
+ ['x', 'y'],
461
+ 'low',
462
+ METHOD_POLICIES.layoutRead
313
463
  ),
314
- 'layout.hit_test': createRegistryEntry('layout.hit_test', 'inspect', true, ['x', 'y'], 'low'),
315
464
  // styles - low (computed), moderate (matched rules)
316
465
  'styles.get_computed': createRegistryEntry(
317
466
  'styles.get_computed',
318
467
  'inspect',
319
468
  true,
320
469
  ['elementRef', 'properties'],
321
- 'low'
470
+ 'low',
471
+ METHOD_POLICIES.stylesRead
322
472
  ),
323
473
  'styles.get_matched_rules': createRegistryEntry(
324
474
  'styles.get_matched_rules',
325
475
  'inspect',
326
476
  true,
327
477
  ['elementRef'],
328
- 'moderate'
478
+ 'moderate',
479
+ METHOD_POLICIES.stylesRead
329
480
  ),
330
481
  // viewport - low (scroll), moderate (resize, debugger-backed)
331
482
  'viewport.scroll': createRegistryEntry(
@@ -333,14 +484,16 @@ export const BRIDGE_METHOD_REGISTRY = Object.freeze({
333
484
  'navigate',
334
485
  true,
335
486
  ['target', 'top', 'left', 'behavior', 'relative'],
336
- 'low'
487
+ 'low',
488
+ METHOD_POLICIES.viewportControl
337
489
  ),
338
490
  'viewport.resize': createRegistryEntry(
339
491
  'viewport.resize',
340
492
  'navigate',
341
493
  true,
342
494
  ['width', 'height', 'deviceScaleFactor', 'reset'],
343
- 'moderate'
495
+ 'moderate',
496
+ METHOD_POLICIES.viewportControlDebugger
344
497
  ),
345
498
  // input - low (simple), moderate (drag)
346
499
  'input.click': createRegistryEntry(
@@ -348,64 +501,80 @@ export const BRIDGE_METHOD_REGISTRY = Object.freeze({
348
501
  'interact',
349
502
  true,
350
503
  ['target', 'button', 'clickCount', 'modifiers'],
351
- 'low'
504
+ 'low',
505
+ METHOD_POLICIES.automationInput
506
+ ),
507
+ 'input.focus': createRegistryEntry(
508
+ 'input.focus',
509
+ 'interact',
510
+ true,
511
+ ['target'],
512
+ 'low',
513
+ METHOD_POLICIES.automationInput
352
514
  ),
353
- 'input.focus': createRegistryEntry('input.focus', 'interact', true, ['target'], 'low'),
354
515
  'input.type': createRegistryEntry(
355
516
  'input.type',
356
517
  'interact',
357
518
  true,
358
519
  ['target', 'text', 'clear', 'submit', 'modifiers'],
359
- 'low'
520
+ 'low',
521
+ METHOD_POLICIES.automationInput
360
522
  ),
361
523
  'input.fill': createRegistryEntry(
362
524
  'input.fill',
363
525
  'interact',
364
526
  true,
365
527
  ['target', 'value', 'mode'],
366
- 'low'
528
+ 'low',
529
+ METHOD_POLICIES.automationInput
367
530
  ),
368
531
  'input.press_key': createRegistryEntry(
369
532
  'input.press_key',
370
533
  'interact',
371
534
  true,
372
535
  ['target', 'key', 'modifiers'],
373
- 'low'
536
+ 'low',
537
+ METHOD_POLICIES.automationInput
374
538
  ),
375
539
  'input.set_checked': createRegistryEntry(
376
540
  'input.set_checked',
377
541
  'interact',
378
542
  true,
379
543
  ['target', 'checked'],
380
- 'low'
544
+ 'low',
545
+ METHOD_POLICIES.automationInput
381
546
  ),
382
547
  'input.select_option': createRegistryEntry(
383
548
  'input.select_option',
384
549
  'interact',
385
550
  true,
386
551
  ['target', 'values', 'labels', 'indexes'],
387
- 'low'
552
+ 'low',
553
+ METHOD_POLICIES.automationInput
388
554
  ),
389
555
  'input.hover': createRegistryEntry(
390
556
  'input.hover',
391
557
  'interact',
392
558
  true,
393
559
  ['target', 'duration', 'modifiers'],
394
- 'low'
560
+ 'low',
561
+ METHOD_POLICIES.automationInput
395
562
  ),
396
563
  'input.drag': createRegistryEntry(
397
564
  'input.drag',
398
565
  'interact',
399
566
  true,
400
567
  ['source', 'destination', 'offsetX', 'offsetY'],
401
- 'moderate'
568
+ 'moderate',
569
+ METHOD_POLICIES.automationInput
402
570
  ),
403
571
  'input.scroll_into_view': createRegistryEntry(
404
572
  'input.scroll_into_view',
405
573
  'interact',
406
574
  true,
407
575
  ['target'],
408
- 'low'
576
+ 'low',
577
+ METHOD_POLICIES.automationInput
409
578
  ),
410
579
  // capture - high (screenshots, CDP)
411
580
  'screenshot.capture_region': createRegistryEntry(
@@ -413,21 +582,24 @@ export const BRIDGE_METHOD_REGISTRY = Object.freeze({
413
582
  'capture',
414
583
  true,
415
584
  ['x', 'y', 'width', 'height'],
416
- 'high'
585
+ 'high',
586
+ METHOD_POLICIES.screenshotPartialDebugger
417
587
  ),
418
588
  'screenshot.capture_element': createRegistryEntry(
419
589
  'screenshot.capture_element',
420
590
  'capture',
421
591
  true,
422
592
  ['elementRef'],
423
- 'high'
593
+ 'high',
594
+ METHOD_POLICIES.screenshotPartialDebugger
424
595
  ),
425
596
  'screenshot.capture_full_page': createRegistryEntry(
426
597
  'screenshot.capture_full_page',
427
598
  'capture',
428
599
  true,
429
600
  [],
430
- 'high'
601
+ 'high',
602
+ METHOD_POLICIES.screenshotPartialDebugger
431
603
  ),
432
604
  // patch - moderate (side effects)
433
605
  'patch.apply_styles': createRegistryEntry(
@@ -435,41 +607,81 @@ export const BRIDGE_METHOD_REGISTRY = Object.freeze({
435
607
  'patch',
436
608
  true,
437
609
  ['target', 'declarations', 'important', 'patchId', 'verify'],
438
- 'moderate'
610
+ 'moderate',
611
+ METHOD_POLICIES.patchStyles
439
612
  ),
440
613
  'patch.apply_dom': createRegistryEntry(
441
614
  'patch.apply_dom',
442
615
  'patch',
443
616
  true,
444
617
  ['target', 'operation', 'name', 'value', 'patchId', 'verify'],
445
- 'moderate'
618
+ 'moderate',
619
+ METHOD_POLICIES.patchDom
620
+ ),
621
+ 'patch.list': createRegistryEntry(
622
+ 'patch.list',
623
+ 'patch',
624
+ true,
625
+ [],
626
+ 'low',
627
+ METHOD_POLICIES.patchDom
628
+ ),
629
+ 'patch.rollback': createRegistryEntry(
630
+ 'patch.rollback',
631
+ 'patch',
632
+ true,
633
+ ['patchId'],
634
+ 'low',
635
+ METHOD_POLICIES.patchDom
446
636
  ),
447
- 'patch.list': createRegistryEntry('patch.list', 'patch', true, [], 'low'),
448
- 'patch.rollback': createRegistryEntry('patch.rollback', 'patch', true, ['patchId'], 'low'),
449
637
  'patch.commit_session_baseline': createRegistryEntry(
450
638
  'patch.commit_session_baseline',
451
639
  'patch',
452
640
  true,
453
641
  [],
454
- 'low'
642
+ 'low',
643
+ METHOD_POLICIES.patchDom
455
644
  ),
456
645
  // cdp - high (raw protocol, large payloads)
457
- 'cdp.get_document': createRegistryEntry('cdp.get_document', 'cdp', true, [], 'high'),
458
- 'cdp.get_dom_snapshot': createRegistryEntry('cdp.get_dom_snapshot', 'cdp', true, [], 'high'),
459
- 'cdp.get_box_model': createRegistryEntry('cdp.get_box_model', 'cdp', true, ['nodeId'], 'high'),
646
+ 'cdp.get_document': createRegistryEntry(
647
+ 'cdp.get_document',
648
+ 'cdp',
649
+ true,
650
+ [],
651
+ 'high',
652
+ METHOD_POLICIES.cdpDomSnapshotDebugger
653
+ ),
654
+ 'cdp.get_dom_snapshot': createRegistryEntry(
655
+ 'cdp.get_dom_snapshot',
656
+ 'cdp',
657
+ true,
658
+ [],
659
+ 'high',
660
+ METHOD_POLICIES.cdpDomSnapshotDebugger
661
+ ),
662
+ 'cdp.get_box_model': createRegistryEntry(
663
+ 'cdp.get_box_model',
664
+ 'cdp',
665
+ true,
666
+ ['nodeId'],
667
+ 'high',
668
+ METHOD_POLICIES.cdpBoxModelDebugger
669
+ ),
460
670
  'cdp.get_computed_styles_for_node': createRegistryEntry(
461
671
  'cdp.get_computed_styles_for_node',
462
672
  'cdp',
463
673
  true,
464
674
  ['nodeId'],
465
- 'high'
675
+ 'high',
676
+ METHOD_POLICIES.cdpStylesDebugger
466
677
  ),
467
678
  'cdp.dispatch_key_event': createRegistryEntry(
468
679
  'cdp.dispatch_key_event',
469
680
  'cdp',
470
681
  true,
471
682
  ['key', 'code', 'modifiers'],
472
- 'moderate'
683
+ 'moderate',
684
+ METHOD_POLICIES.cdpInputDebugger
473
685
  ),
474
686
  // performance - moderate (debugger-backed)
475
687
  'performance.get_metrics': createRegistryEntry(
@@ -477,7 +689,8 @@ export const BRIDGE_METHOD_REGISTRY = Object.freeze({
477
689
  'performance',
478
690
  true,
479
691
  [],
480
- 'moderate'
692
+ 'moderate',
693
+ METHOD_POLICIES.performanceReadDebugger
481
694
  ),
482
695
  });
483
696