@weavetab/skills 2.5.0 → 2.5.1

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 (62) hide show
  1. package/README.md +108 -108
  2. package/ROUTER.md +43 -43
  3. package/bin/cli.js +232 -232
  4. package/browser/dom-strategy.md +121 -119
  5. package/browser/form-automation.md +84 -87
  6. package/browser/interaction-pipeline.md +242 -216
  7. package/browser/tab-and-window.md +136 -136
  8. package/desktop/desktop-targeting.md +85 -85
  9. package/desktop/electron-discovery.md +115 -115
  10. package/developer/github-forensics.md +89 -74
  11. package/dist/bundled/weavetab-all.md +1885 -1709
  12. package/dist/bundled/weavetab-browser.md +526 -501
  13. package/dist/bundled/weavetab-desktop.md +176 -176
  14. package/dist/bundled/weavetab-developer.md +84 -67
  15. package/dist/bundled/weavetab-documents.md +184 -142
  16. package/dist/bundled/weavetab-memory.md +259 -233
  17. package/dist/bundled/weavetab-network-and-perf.md +250 -223
  18. package/dist/bundled/weavetab-plugins.md +88 -83
  19. package/dist/bundled/weavetab-resilience.md +244 -216
  20. package/dist/bundled/weavetab-security.md +93 -87
  21. package/dist/granular/browser_dom-strategy.md +121 -119
  22. package/dist/granular/browser_form-automation.md +84 -87
  23. package/dist/granular/browser_interaction-pipeline.md +242 -216
  24. package/dist/granular/browser_tab-and-window.md +136 -136
  25. package/dist/granular/desktop_desktop-targeting.md +85 -85
  26. package/dist/granular/desktop_electron-discovery.md +115 -115
  27. package/dist/granular/developer_github-forensics.md +89 -74
  28. package/dist/granular/documents_canvas-and-visual-capture.md +117 -103
  29. package/dist/granular/documents_office-document-ingestion.md +91 -63
  30. package/dist/granular/memory_selector-memory-system.md +127 -127
  31. package/dist/granular/memory_session-trail.md +111 -95
  32. package/dist/granular/memory_site-learning.md +62 -53
  33. package/dist/granular/network-and-perf_device-and-environment.md +100 -87
  34. package/dist/granular/network-and-perf_network-intercept-and-mock.md +97 -84
  35. package/dist/granular/network-and-perf_performance-and-vitals.md +86 -84
  36. package/dist/granular/plugins_hooks-and-overrides.md +40 -35
  37. package/dist/granular/plugins_plugin-runtime.md +63 -63
  38. package/dist/granular/resilience_loop-breaker.md +72 -67
  39. package/dist/granular/resilience_session-time-travel.md +146 -131
  40. package/dist/granular/resilience_stale-ref-recovery.md +61 -53
  41. package/dist/granular/security_rbac-and-policies.md +50 -47
  42. package/dist/granular/security_secret-containment-protocol.md +62 -59
  43. package/documents/canvas-and-visual-capture.md +117 -103
  44. package/documents/office-document-ingestion.md +91 -63
  45. package/evals/evaluator.js +146 -146
  46. package/evals/scenarios.json +239 -239
  47. package/memory/selector-memory-system.md +127 -127
  48. package/memory/session-trail.md +111 -95
  49. package/memory/site-learning.md +61 -52
  50. package/network-and-perf/device-and-environment.md +100 -87
  51. package/network-and-perf/network-intercept-and-mock.md +97 -84
  52. package/network-and-perf/performance-and-vitals.md +86 -84
  53. package/package.json +74 -73
  54. package/plugins/hooks-and-overrides.md +40 -35
  55. package/plugins/plugin-runtime.md +63 -63
  56. package/resilience/loop-breaker.md +72 -67
  57. package/resilience/session-time-travel.md +146 -131
  58. package/resilience/stale-ref-recovery.md +61 -53
  59. package/security/rbac-and-policies.md +50 -47
  60. package/security/secret-containment-protocol.md +62 -59
  61. package/skills.json +425 -426
  62. package/src/api.js +239 -239
@@ -1,501 +1,526 @@
1
- # Weavetab Domain Profile: BROWSER
2
-
3
- Generated for @weavetab/skills v2.5.0-beta.5
4
-
5
-
6
- ## dom-strategy
7
-
8
- # DOM Strategy & Token Conservation Engine
9
-
10
- When parsing modern web applications, naive DOM dumps can consume 50,000+ tokens and cause agent degradation. Weavetab provides a high-efficiency 4-tier reading architecture.
11
-
12
- ---
13
-
14
- ## 1. The 4-Tier Reading Filter
15
-
16
- Always select the narrowest tool that satisfies your immediate objective:
17
-
18
- ```
19
- ┌───────────────────────────────┐
20
- │ Do you need full structural │
21
- │ context or just a target? │
22
- └──────────────┬────────────────┘
23
- │
24
- ┌───────────────┴───────────────┐
25
- ▼ ▼
26
- [Specific Target] [Whole Document]
27
- │ │
28
- ┌────────┴────────┐ ┌───────┴────────┐
29
- ▼ ▼ ▼ ▼
30
- Target by text Target by role Read articles Interactive
31
- or keywords or hierarchy or prose data UI layout
32
- │ │ │ │
33
- ▼ ▼ ▼ ▼
34
- `browser_find` `browser_map` `browser_scrape` `browser_map`
35
- (lite: true) (lite: true)
36
- │
37
- [Sparse / Canvas / WebGL / <5 elements?]
38
- │
39
- ▼
40
- `browser_map`
41
- (visual: "auto")
42
- ```
43
-
44
- ### Tier 1: Targeted Keyword Jump (`browser_find`)
45
- Use `browser_find` when you already know the label, text snippet, placeholder, or aria-label of the target element.
46
- - **Latency**: Sub-5ms CDP search.
47
- - **Token Cost**: ~50–100 tokens (returns only matching candidate nodes).
48
-
49
- ```json
50
- {
51
- "query": "Sign In",
52
- "matchType": "contains",
53
- "visibleOnly": true
54
- }
55
- ```
56
-
57
- ### Tier 2: Token-Optimized DOM Walk (`browser_map` with `lite: true`)
58
- Use `browser_map` when you must understand the interactive structure of the page.
59
- - **Rule**: ALWAYS pass `"lite": true` unless you strictly need deeply nested non-interactive DOM trees.
60
- - **Efficiency**: Strips decorative wrappers, SVG paths, hidden containers, and scripts. Reduces payload by **85% to 95%**.
61
- - **Viewport Filtering**: Set `"includeOffscreen": false` to only inspect elements currently visible in the active viewport.
62
-
63
- ```json
64
- {
65
- "lite": true,
66
- "includeOffscreen": false,
67
- "maxDepth": 6
68
- }
69
- ```
70
-
71
- ### Tier 3: Markdown Prose & Data Ingestion (`browser_scrape`)
72
- Use `browser_scrape` when your objective is reading articles, blog posts, documentation, or legal terms rather than clicking buttons.
73
- - Converts HTML to clean, semantically structured Markdown.
74
- - Automatically handles readability filtering and removes advertising/cookie banners.
75
-
76
- ### Tier 4: Set-of-Marks Visual Grounding (`browser_map` with `visual: "auto"`)
77
- Use when target pages are canvas-heavy, WebGL, Figma, Google Sheets, or when standard `browser_map` returns < 5 interactive elements.
78
- - Injects temporary numbered badges `[1]…[N]` over interactive elements & canvas regions.
79
- - Captures an annotated screenshot + returns a structured mark list.
80
- - **Zero Page Pollution**: Strips badges immediately after capture.
81
- - **Action**: Pass `"mark": N` to `browser_click` to click the exact element without re-scanning the DOM.
82
-
83
- ```json
84
- {
85
- "visual": "auto"
86
- }
87
- ```
88
-
89
- ### Tier 5: Runtime State & JavaScript Evaluation (`browser_eval`)
90
- When DOM nodes are occluded or you need direct access to in-memory window state (e.g. Redux store, localStorage keys, or complex canvas dimensions), use `browser_eval` as an escape hatch:
91
- ```json
92
- {
93
- "expression": "window.__INITIAL_STATE__ || document.title"
94
- }
95
- ```
96
-
97
- ---
98
-
99
- ## 2. Volatile Ref ID & Visual Mark Navigation
100
-
101
- Weavetab maps elements to ephemeral handles (`w:NN`) and visual marks (`[1]…[N]`):
102
-
103
- ### Operational Rules:
104
- 1. **Never Construct Speculative CSS Selectors**: If an element has ref `w:14`, pass `"ref": "w:14"` to `browser_click`, `browser_fill`, `browser_type`.
105
- 2. **Visual Mark Targeting**: On canvas or unlabelled elements from `visual: "auto"`, pass `"mark": N` directly to `browser_click({ mark: N })`.
106
- 3. **Lifespan of Handles**: Ref IDs and marks invalidate on page navigation (`browser_navigate`) or heavy SPA re-renders.
107
- 4. **Recovery on Invalidation**: If an action fails with `ELEMENT_NOT_FOUND` or `MARK_NOT_FOUND`, re-run `browser_map({ visual: "auto" })` to refresh active handles.
108
-
109
-
110
- ## form-automation
111
-
112
- # Form Automation: Atomic Multi-Field Execution
113
-
114
- Submitting complex web forms one field at a time wastes agent turns and increases the probability of layout shifts. Weavetab provides atomic multi-field batching and native dropdown selectors.
115
-
116
- ---
117
-
118
- ## 1. Atomic Multi-Field Filling (`browser_fill`)
119
-
120
- `browser_fill` populates multiple inputs, textareas, checkboxes, and radio buttons in a single CDP roundtrip.
121
-
122
- ```json
123
- {
124
- "fields": [
125
- {
126
- "ref": "w:12",
127
- "value": "Anas"
128
- },
129
- {
130
- "ref": "w:14",
131
- "value": "Khezaz"
132
- },
133
- {
134
- "ref": "w:16",
135
- "value": "contact@weavetab.com"
136
- },
137
- {
138
- "ref": "w:19",
139
- "value": true
140
- }
141
- ]
142
- }
143
- ```
144
-
145
- ### Supported Field Value Types:
146
- - **Text / Search / Email / Tel**: Provide a `string`.
147
- - **Checkbox**: Provide a `boolean` (`true` to check, `false` to uncheck).
148
- - **Radio Buttons**: Provide `true` on the matching option ref.
149
- - **ContentEditable**: Provide a `string` (automatically handles inner text formatting).
150
-
151
- ---
152
-
153
- ## 2. Dropdown & Select Automation (`browser_select`)
154
-
155
- Standard `<select>` elements and custom dropdowns often fail under simple click-and-type automation. `browser_select` dispatches native CDP change events.
156
-
157
- ```json
158
- {
159
- "ref": "w:31",
160
- "values": ["enterprise_tier"]
161
- }
162
- ```
163
-
164
- ### Multi-Select Support:
165
- For `<select multiple>` elements, pass an array of option values:
166
-
167
- ```json
168
- {
169
- "ref": "w:35",
170
- "values": ["us-east-1", "eu-central-1"]
171
- }
172
- ```
173
-
174
- ---
175
-
176
- ## 3. Form Submission Best Practices
177
-
178
- 1. **Pre-Validate State**: Before clicking Submit, confirm that required fields have passed HTML5/client-side validation (no active red borders or validation popups).
179
- 2. **Submit via Enter Key vs Click**:
180
- - If the submit button has a dynamic ref or changes during typing, send `"key": "Enter"` via `browser_key` inside the last filled text field.
181
- - Otherwise, locate the submit button via `browser_find` and click via `browser_click`.
182
- 3. **Wait for Post-Submission Route**: Always follow form submission with `browser_wait` for URL changes or target DOM confirmation rather than immediately firing subsequent actions.
183
-
184
-
185
- ## interaction-pipeline
186
-
187
- # Interaction Pipeline: Physical & Synthetic Input Engine
188
-
189
- Weavetab executes browser interactions via direct Chrome DevTools Protocol (CDP) dispatch, bypassing synthetic JavaScript event limitations and anti-automation tripwires.
190
-
191
- ---
192
-
193
- ## 1. Clicking Elements (`browser_click`)
194
-
195
- Execute deterministic clicks on DOM elements using volatile handles (`ref`), CSS selectors, or exact coordinates.
196
-
197
- ```json
198
- {
199
- "ref": "w:23",
200
- "clickCount": 1,
201
- "button": "left"
202
- }
203
- ```
204
-
205
- ### Advanced Modifiers:
206
- - **Double Click**: Set `"clickCount": 2` for inline editing or selecting text blocks.
207
- - **Context Menu**: Set `"button": "right"` to trigger native context menus.
208
- - **Modifier Keys**: Pass `"modifiers": ["Control"]` or `["Meta"]` for multi-selection or opening links in background tabs.
209
-
210
- ---
211
-
212
- ## 2. Text Input (`browser_type`)
213
-
214
- Simulate natural keystrokes into input fields, textareas, and `contenteditable` elements.
215
-
216
- ```json
217
- {
218
- "ref": "w:18",
219
- "text": "Enterprise Search Query",
220
- "clear": true,
221
- "delay": 20
222
- }
223
- ```
224
-
225
- > [!CAUTION]
226
- > **Secret Boundary Enforcement**:
227
- > NEVER use `browser_type` for passwords, API tokens, or payment card data. Always route sensitive credentials through [`security/secret-containment-protocol.md`](file:///c:/Users/fy2ne/Music/Weavetab/skills/security/secret-containment-protocol.md) via `browser_type_secret`.
228
-
229
- ---
230
-
231
- ## 3. Physical Pointer Trajectories (`browser_pointer`)
232
-
233
- Handle complex drag-and-drop interactions, canvas sketching, hover-activated navigation flyouts, and custom sliders.
234
-
235
- ### Hover / Mouse Move:
236
- ```json
237
- {
238
- "action": "move",
239
- "x": 450,
240
- "y": 180
241
- }
242
- ```
243
-
244
- ### Drag & Drop Pipeline:
245
- ```json
246
- // Step 1: Move to origin & press mouse
247
- { "action": "move", "x": 200, "y": 300 }
248
- { "action": "down", "button": "left" }
249
-
250
- // Step 2: Smooth trajectory to destination
251
- { "action": "move", "x": 600, "y": 300 }
252
-
253
- // Step 3: Release
254
- { "action": "up", "button": "left" }
255
- ```
256
-
257
- ---
258
-
259
- ## 4. Keystrokes & Shortcuts (`browser_key`)
260
-
261
- Trigger keyboard shortcuts, navigation keys, and dialog dismissals.
262
-
263
- ```json
264
- {
265
- "key": "Enter"
266
- }
267
- ```
268
-
269
- ### High-Frequency Key Combos:
270
- - **Select All & Delete**: Send `"key": "a"`, `"modifiers": ["Control"]` (or `["Meta"]` on macOS), followed by `"key": "Backspace"`.
271
- - **Dismiss Overlays**: Send `"key": "Escape"`.
272
- - **Form Tab Navigation**: Send `"key": "Tab"`.
273
-
274
- ---
275
-
276
- ## 5. OS File Upload Bypass (`browser_upload`)
277
-
278
- Native operating system file picker dialogs block autonomous agent execution because they operate outside the browser DOM. Weavetab bypasses this entirely using CDP's `DOM.setFileInputFiles`.
279
-
280
- ```json
281
- {
282
- "ref": "w:41",
283
- "files": [
284
- "C:/Users/fy2ne/Documents/contract.pdf",
285
- "C:/Users/fy2ne/Documents/financial_report.xlsx"
286
- ]
287
- }
288
- ```
289
-
290
- - **Targeting**: Supply the volatile handle `ref` or CSS selector for the `<input type="file">`.
291
- - **Hidden Inputs**: `browser_upload` automatically handles `display: none` file inputs commonly used in custom drag-and-drop upload widgets.
292
-
293
- ---
294
-
295
- ## 6. Viewport & Element Scrolling (`browser_scroll`)
296
-
297
- Scroll the entire page viewport or scroll specific scrollable containers:
298
-
299
- ```json
300
- {
301
- "direction": "down",
302
- "amount": 500
303
- }
304
- ```
305
-
306
- Or scroll a specific element container:
307
- ```json
308
- {
309
- "ref": "w:12",
310
- "direction": "down",
311
- "amount": 300
312
- }
313
- ```
314
-
315
- ---
316
-
317
- ## 7. Native Dialog Handling (`browser_dialog`)
318
-
319
- Handle native JavaScript `alert`, `confirm`, `prompt`, or `beforeunload` dialogs that block page execution:
320
-
321
- ```json
322
- {
323
- "action": "accept",
324
- "promptText": "Confirmed"
325
- }
326
- ```
327
-
328
- ---
329
-
330
- ## 8. High-Speed Action Batches (`browser_burst`)
331
-
332
- Execute multiple sequential micro-actions in a single CDP roundtrip without waiting for intermediate LLM turns:
333
-
334
- ```json
335
- {
336
- "steps": [
337
- { "tool": "browser_fill", "ref": "w:10", "value": "search query" },
338
- { "tool": "click_and_wait", "ref": "w:15" }
339
- ]
340
- }
341
- ```
342
- *(Accepts both `steps` and `actions`, with arguments either nested under `args` or specified flat on the step object).*
343
-
344
- ---
345
-
346
- ## 9. Visual Element Highlighting & Consideration (`browser_highlight`)
347
-
348
- Draw visual consideration, target lock, danger/success, or shimmer overlays without mutating the DOM. Supports multi-element candidate evaluation:
349
-
350
- ```json
351
- {
352
- "refs": ["w:12", "w:15", "w:23"],
353
- "style": "consideration",
354
- "label": "Evaluating form options",
355
- "duration": 2000
356
- }
357
- ```
358
-
359
- ### Presentation Styles:
360
- - `"consideration"`: Soft pulsing cyan/blue outline (`#38bdf8`) with ambient glow — ideal when weighing multiple interactive candidates.
361
- - `"target"`: High-contrast amber lock-on ring (`#f59e0b`) before executing high-impact clicks.
362
- - `"danger"`: Red warning border (`#ef4444`) for destructive buttons (Delete, Reset, Purge).
363
- - `"success"`: Emerald glow (`#10b981`) confirming completed actions.
364
- - `"shimmer"`: Rapid purple accent wave (default for quick inspection).
365
-
366
- ---
367
-
368
- ## 10. System Clipboard Bridging (`browser_clipboard`)
369
-
370
- Read or write system clipboard text during automation:
371
-
372
- ```json
373
- {
374
- "action": "write",
375
- "text": "AuthToken_xyz987"
376
- }
377
- ```
378
-
379
-
380
- ## tab-and-window
381
-
382
- # Tab & Window Lifecycle Management
383
-
384
- Multi-tab workflows (OAuth popups, payment gateways, documentation references, desktop application windows) require deterministic tab switching, window focusing, and failure recovery. `browser_tabs` controls all CDP page and window targets.
385
-
386
- ---
387
-
388
- ## 1. Tab Discovery & Target Enumeration
389
-
390
- Inspect all active targets, open URLs, and page titles:
391
-
392
- ```json
393
- {
394
- "action": "list"
395
- }
396
- ```
397
-
398
- To list targets inside a specific desktop app (e.g. Discord, Slack):
399
- ```json
400
- {
401
- "action": "list",
402
- "app": "discord"
403
- }
404
- ```
405
-
406
- > [!TIP]
407
- > Always pass `"app": "<name>"` when inspecting desktop applications. This guarantees that Weavetab does not launch or query the web browser.
408
-
409
- ---
410
-
411
- ## 2. Opening Tabs & Smart Reuse
412
-
413
- Open a target URL. By default, `reuse: true` will focus an existing tab if the URL is already loaded:
414
-
415
- ```json
416
- {
417
- "action": "open",
418
- "url": "https://github.com"
419
- }
420
- ```
421
-
422
- To force opening a brand-new duplicate tab instead of reusing:
423
- ```json
424
- {
425
- "action": "open",
426
- "url": "https://github.com",
427
- "reuse": false
428
- }
429
- ```
430
-
431
- ---
432
-
433
- ## 3. Context Switching
434
-
435
- Switch active agent focus between open tabs:
436
-
437
- ```json
438
- {
439
- "action": "switch",
440
- "tabId": "TARGET_PAGE_ID"
441
- }
442
- ```
443
-
444
- ---
445
-
446
- ## 4. Closing Tabs & Batch Cleanup
447
-
448
- Close a single tab:
449
- ```json
450
- {
451
- "action": "close",
452
- "tabId": "TARGET_PAGE_ID"
453
- }
454
- ```
455
-
456
- Close multiple tabs simultaneously in a single round-trip:
457
- ```json
458
- {
459
- "action": "close",
460
- "tabIds": ["TARGET_1", "TARGET_2", "TARGET_3"]
461
- }
462
- ```
463
-
464
- ---
465
-
466
- ## 5. Native Window Management
467
-
468
- List native OS windows:
469
- ```json
470
- {
471
- "action": "list_windows"
472
- }
473
- ```
474
-
475
- Bring a specific native window to the foreground:
476
- ```json
477
- {
478
- "action": "focus_window",
479
- "windowId": 1
480
- }
481
- ```
482
-
483
- ---
484
-
485
- ## 6. Duplicate Consolidation & Auto-Heal
486
-
487
- Deduplicate redundant tabs across the session:
488
- ```json
489
- {
490
- "action": "consolidate"
491
- }
492
- ```
493
-
494
- If a target page crashes or detaches due to memory limits:
495
- ```json
496
- {
497
- "action": "heal"
498
- }
499
- ```
500
-
501
- The auto-heal routine re-establishes CDP protocol sessions, reconnects event listeners, and synchronizes the active page target.
1
+ # Weavetab Domain Profile: BROWSER
2
+
3
+ Generated for @weavetab/skills v2.5.1
4
+
5
+
6
+ ## dom-strategy
7
+
8
+ # DOM Strategy & Token Conservation Engine
9
+
10
+ When parsing modern web applications, naive DOM dumps can consume 50,000+ tokens and cause agent degradation. Weavetab provides a high-efficiency 4-tier reading architecture.
11
+
12
+ ---
13
+
14
+ ## 1. The 4-Tier Reading Filter
15
+
16
+ Always select the narrowest tool that satisfies your immediate objective:
17
+
18
+ ```
19
+ ┌───────────────────────────────┐
20
+ │ Do you need full structural │
21
+ │ context or just a target? │
22
+ └──────────────┬────────────────┘
23
+ │
24
+ ┌───────────────┴───────────────┐
25
+ ▼ ▼
26
+ [Specific Target] [Whole Document]
27
+ │ │
28
+ ┌────────┴────────┐ ┌───────┴────────┐
29
+ ▼ ▼ ▼ ▼
30
+ Target by text Target by role Read articles Interactive
31
+ or keywords or hierarchy or prose data UI layout
32
+ │ │ │ │
33
+ ▼ ▼ ▼ ▼
34
+ `browser_find` `browser_map` `browser_scrape` `browser_map`
35
+ (lite: true) (lite: true)
36
+ │
37
+ [Sparse / Canvas / WebGL / <5 elements?]
38
+ │
39
+ ▼
40
+ `browser_map`
41
+ (visual: "auto")
42
+ ```
43
+
44
+ ### Tier 1: Targeted Keyword Jump (`browser_find`)
45
+ Use `browser_find` when you already know the label, text snippet, placeholder, or aria-label of the target element.
46
+ - **Latency**: Sub-5ms CDP search.
47
+ - **Token Cost**: ~50–100 tokens (returns only matching candidate nodes).
48
+
49
+ ```json
50
+ {
51
+ "query": "Sign In"
52
+ }
53
+ ```
54
+
55
+ Set `"all": true` to return every match (with `"limit"` capping the count, default 10) instead of only the first.
56
+
57
+ ### Tier 2: Token-Optimized DOM Walk (`browser_map` with `lite: true`)
58
+ Use `browser_map` when you must understand the interactive structure of the page.
59
+ - **Rule**: ALWAYS pass `"lite": true` unless you strictly need deeply nested non-interactive DOM trees.
60
+ - **Efficiency**: Strips decorative wrappers, SVG paths, hidden containers, and scripts. Reduces payload by **85% to 95%**.
61
+ - **Scope & filter**: Narrow a dense page with `"scope": "main"` (or `navigation`, `sidebar`, `form`, `modal`, `utility`) and `"query": "<substring>"` to filter by label/role.
62
+ - **Delta mode**: Set `"delta": true` on repeated maps to receive only what changed since the last call (up to 97% token savings).
63
+ - **Pruning**: Set `"prune": true` to drop hidden, non-interactive subtrees and collapse SVG icons in this snapshot.
64
+
65
+ ```json
66
+ {
67
+ "lite": true,
68
+ "scope": "main",
69
+ "delta": true
70
+ }
71
+ ```
72
+
73
+ ### Tier 3: Markdown Prose & Data Ingestion (`browser_scrape`)
74
+ Use `browser_scrape` when your objective is reading articles, blog posts, documentation, or legal terms rather than clicking buttons.
75
+ - Converts HTML to clean, semantically structured Markdown.
76
+ - Automatically handles readability filtering and removes advertising/cookie banners.
77
+
78
+ ### Tier 4: Set-of-Marks Visual Grounding (`browser_map` with `visual: "auto"`)
79
+ Use when target pages are canvas-heavy, WebGL, Figma, Google Sheets, or when standard `browser_map` returns < 5 interactive elements.
80
+ - Injects temporary numbered badges `[1]…[N]` over interactive elements & canvas regions.
81
+ - Captures an annotated screenshot + returns a structured mark list.
82
+ - **Zero Page Pollution**: Strips badges immediately after capture.
83
+ - **Action**: Pass `"mark": N` to `browser_click` to click the exact element without re-scanning the DOM.
84
+
85
+ ```json
86
+ {
87
+ "visual": "auto"
88
+ }
89
+ ```
90
+
91
+ ### Tier 5: Runtime State & JavaScript Evaluation (`browser_eval`)
92
+ When DOM nodes are occluded or you need direct access to in-memory window state (e.g. Redux store, localStorage keys, or complex canvas dimensions), use `browser_eval` as an escape hatch:
93
+ ```json
94
+ {
95
+ "expression": "window.__INITIAL_STATE__ || document.title"
96
+ }
97
+ ```
98
+
99
+ ---
100
+
101
+ ## 2. Volatile Ref ID & Visual Mark Navigation
102
+
103
+ Weavetab maps elements to ephemeral handles (`w:NN`) and visual marks (`[1]…[N]`):
104
+
105
+ ### Operational Rules:
106
+ 1. **Never Construct Speculative CSS Selectors**: If an element has ref `w:14`, pass `"ref": "w:14"` to `browser_click`, `browser_fill`, `browser_type`.
107
+ 2. **Visual Mark Targeting**: On canvas or unlabelled elements from `visual: "auto"`, pass `"mark": N` directly to `browser_click({ mark: N })`.
108
+ 3. **Lifespan of Handles**: Ref IDs and marks invalidate on page navigation (`browser_navigate`) or heavy SPA re-renders.
109
+ 4. **Recovery on Invalidation**: If an action fails with `ELEMENT_NOT_FOUND` or `MARK_NOT_FOUND`, re-run `browser_map({ visual: "auto" })` to refresh active handles.
110
+
111
+
112
+ ## form-automation
113
+
114
+ # Form Automation: Atomic Multi-Field Execution
115
+
116
+ Submitting complex web forms one field at a time wastes agent turns and increases the probability of layout shifts. Weavetab provides atomic multi-field batching and native dropdown selectors.
117
+
118
+ ---
119
+
120
+ ## 1. Atomic Multi-Field Filling (`browser_fill`)
121
+
122
+ `browser_fill` populates multiple inputs, textareas, checkboxes, and radio buttons in a single CDP roundtrip.
123
+
124
+ ```json
125
+ {
126
+ "fields": [
127
+ {
128
+ "ref": "w:12",
129
+ "value": "Anas"
130
+ },
131
+ {
132
+ "ref": "w:14",
133
+ "value": "Khezaz"
134
+ },
135
+ {
136
+ "ref": "w:16",
137
+ "value": "contact@weavetab.com"
138
+ },
139
+ {
140
+ "ref": "w:19",
141
+ "value": "true"
142
+ }
143
+ ]
144
+ }
145
+ ```
146
+
147
+ ### Supported Field Value Types:
148
+ Every `value` is a **string**.
149
+ - **Text / Search / Email / Tel**: The literal text to type.
150
+ - **Checkbox / ARIA switch**: A truthy string (`"true"`, `"yes"`, `"checked"`, `"1"`, or `"on"`) checks it; anything else unchecks it.
151
+ - **Radio Buttons**: Set the matching option's ref to a truthy string to select it.
152
+ - **Select**: The option `value` or visible text to choose.
153
+ - **ContentEditable**: The text content to set (inner text formatting handled automatically).
154
+
155
+ ---
156
+
157
+ ## 2. Dropdown & Select Automation (`browser_select`)
158
+
159
+ Standard `<select>` elements and custom dropdowns often fail under simple click-and-type automation. `browser_select` dispatches native CDP change events.
160
+
161
+ ```json
162
+ {
163
+ "ref": "w:31",
164
+ "value": "enterprise_tier"
165
+ }
166
+ ```
167
+
168
+ `value` is a **single string** (required) and matches either the option's `value` or its visible text, trimmed. For a custom ARIA/React dropdown it opens the popover, scans `[role="option"]`/`[role="menuitem"]` candidates, and clicks the best match.
169
+
170
+ ### Multi-Select Support:
171
+ `browser_select` selects one option per call. For a `<select multiple>` element, call it once per option you want selected.
172
+
173
+ ---
174
+
175
+ ## 3. Form Submission Best Practices
176
+
177
+ 1. **Pre-Validate State**: Before clicking Submit, confirm that required fields have passed HTML5/client-side validation (no active red borders or validation popups).
178
+ 2. **Submit via Enter Key vs Click**:
179
+ - If the submit button has a dynamic ref or changes during typing, send `"key": "Enter"` via `browser_key` inside the last filled text field.
180
+ - Otherwise, locate the submit button via `browser_find` and click via `browser_click`.
181
+ 3. **Wait for Post-Submission Route**: Always follow form submission with `browser_wait` for URL changes or target DOM confirmation rather than immediately firing subsequent actions.
182
+
183
+
184
+ ## interaction-pipeline
185
+
186
+ # Interaction Pipeline: Physical & Synthetic Input Engine
187
+
188
+ Weavetab executes browser interactions via direct Chrome DevTools Protocol (CDP) dispatch, bypassing synthetic JavaScript event limitations and anti-automation tripwires.
189
+
190
+ ---
191
+
192
+ ## 1. Clicking Elements (`browser_click`)
193
+
194
+ Execute deterministic clicks on DOM elements using volatile handles (`ref`/`id`), CSS selectors, labels, marks, or coordinates.
195
+
196
+ ```json
197
+ {
198
+ "ref": "w:23"
199
+ }
200
+ ```
201
+
202
+ ### Targeting & Options:
203
+ - **By ref**: pass `id` (or its alias `ref`) from `browser_map`.
204
+ - **By selector / label**: pass `selector` (alias `target`) or `label` (visible text or aria-label).
205
+ - **By visual mark**: pass `mark: N` from `browser_map({ visual: "auto" })` for canvas/WebGL pages.
206
+ - **By coordinates**: pass `x`/`y`, or a raw `backendNodeId`.
207
+ - **`intent`**: an optional semantic description (e.g. `"submit login form"`) — Weavetab checks learned memory first and clicks a high-confidence selector without DOM resolution.
208
+ - **`include_map`**: set `true` to return a refreshed page map with the result.
209
+
210
+ > `browser_click` always dispatches a left-button single click. To double-click or right-click, use `browser_pointer` (`double_click`) or open the native context menu another way.
211
+
212
+ ---
213
+
214
+ ## 2. Text Input (`browser_type`)
215
+
216
+ Simulate natural keystrokes into input fields, textareas, and `contenteditable` elements.
217
+
218
+ ```json
219
+ {
220
+ "ref": "w:18",
221
+ "text": "Enterprise Search Query",
222
+ "clearFirst": true
223
+ }
224
+ ```
225
+
226
+ Useful options:
227
+ - **`clearFirst`**: wipe existing field content before typing.
228
+ - **`paste`**: instant paste mode via clipboard, auto-enabled for text longer than 8 chars.
229
+ - If `id`/`selector`/`label` is omitted, text is typed into the currently focused element.
230
+
231
+ > [!CAUTION]
232
+ > **Secret Boundary Enforcement**:
233
+ > NEVER use `browser_type` for passwords, API tokens, or payment card data. Always route sensitive credentials through [`security/secret-containment-protocol.md`](../security/secret-containment-protocol.md) via `browser_type_secret`.
234
+
235
+ ---
236
+
237
+ ## 3. Physical Pointer Trajectories (`browser_pointer`)
238
+
239
+ Handle complex drag-and-drop interactions, canvas sketching, hover-activated navigation flyouts, and custom sliders.
240
+
241
+ Actions: `hover`, `click`, `double_click`, `drag_and_drop`, `hover_chain`.
242
+
243
+ ### Hover:
244
+ ```json
245
+ {
246
+ "action": "hover",
247
+ "ref": "w:12",
248
+ "waitForChild": ".submenu",
249
+ "holdMs": 200
250
+ }
251
+ ```
252
+
253
+ ### Double Click:
254
+ ```json
255
+ {
256
+ "action": "double_click",
257
+ "ref": "w:30"
258
+ }
259
+ ```
260
+
261
+ ### Drag & Drop Pipeline:
262
+ A single `drag_and_drop` action drives the whole drag — supply the source (`ref`/`selector`/`x`/`y`) and destination (`end_ref`/`end_selector`/`end_x`/`end_y`):
263
+ ```json
264
+ {
265
+ "action": "drag_and_drop",
266
+ "ref": "w:20",
267
+ "end_ref": "w:35"
268
+ }
269
+ ```
270
+
271
+ ### Multi-Level Flyout Menus (`hover_chain`):
272
+ Hover each element in order and click the last one (e.g. Photoshop/Figma-style menus):
273
+ ```json
274
+ {
275
+ "hover_chain": ["File", "Export As", "PNG"]
276
+ }
277
+ ```
278
+
279
+ ---
280
+
281
+ ## 4. Keystrokes & Shortcuts (`browser_key`)
282
+
283
+ Trigger keyboard shortcuts, navigation keys, and dialog dismissals.
284
+
285
+ ```json
286
+ {
287
+ "key": "Enter"
288
+ }
289
+ ```
290
+
291
+ ### High-Frequency Key Combos:
292
+ - **Select All & Delete**: Send `"key": "a"` with `"modifiers": ["Ctrl"]` (or `["Meta"]` on macOS), followed by `"key": "Backspace"`.
293
+ - **Dismiss Overlays**: Send `"key": "Escape"`.
294
+ - **Form Tab Navigation**: Send `"key": "Tab"`.
295
+
296
+ Valid modifiers are `Alt`, `Ctrl`, `Meta`, and `Shift`.
297
+
298
+ ---
299
+
300
+ ## 5. OS File Upload Bypass (`browser_upload`)
301
+
302
+ Native operating system file picker dialogs block autonomous agent execution because they operate outside the browser DOM. Weavetab bypasses this entirely using CDP's `DOM.setFileInputFiles`.
303
+
304
+ ```json
305
+ {
306
+ "nodeId": 4821,
307
+ "filePaths": [
308
+ "C:/Users/me/Documents/contract.pdf",
309
+ "C:/Users/me/Documents/financial_report.xlsx"
310
+ ]
311
+ }
312
+ ```
313
+
314
+ - **Targeting**: Supply the CDP `nodeId` (backendNodeId) of the `<input type="file">` element — obtain it from `browser_map`, `browser_inspect`, or `browser_find` output.
315
+ - **Hidden Inputs**: `browser_upload` automatically handles `display: none` file inputs commonly used in custom drag-and-drop upload widgets.
316
+
317
+ ---
318
+
319
+ ## 6. Viewport & Element Scrolling (`browser_scroll`)
320
+
321
+ Scroll the entire page viewport or scroll specific scrollable containers:
322
+
323
+ ```json
324
+ {
325
+ "direction": "down",
326
+ "distance": 500
327
+ }
328
+ ```
329
+
330
+ Or scroll a specific element container:
331
+ ```json
332
+ {
333
+ "ref": "w:12",
334
+ "direction": "down",
335
+ "distance": 300
336
+ }
337
+ ```
338
+
339
+ ---
340
+
341
+ ## 7. Native Dialog Handling (`browser_dialog`)
342
+
343
+ Handle native JavaScript `alert`, `confirm`, `prompt`, or `beforeunload` dialogs that block page execution:
344
+
345
+ ```json
346
+ {
347
+ "action": "accept",
348
+ "promptText": "Confirmed"
349
+ }
350
+ ```
351
+
352
+ ---
353
+
354
+ ## 8. High-Speed Action Batches (`browser_burst`)
355
+
356
+ Execute multiple sequential micro-actions in a single CDP roundtrip without waiting for intermediate LLM turns:
357
+
358
+ ```json
359
+ {
360
+ "steps": [
361
+ { "tool": "browser_type", "ref": "w:10", "text": "search query" },
362
+ { "tool": "click_and_wait", "ref": "w:15" }
363
+ ]
364
+ }
365
+ ```
366
+
367
+ Macro steps (`type_and_send`, `click_and_wait`, `navigate_and_read`, `scroll_and_read`, `fill_form`) collapse common two-step patterns into one entry. *(Accepts both `steps` and `actions`, with arguments either nested under `args` or specified flat on the step object.)*
368
+
369
+ ---
370
+
371
+ ## 9. Visual Element Highlighting & Consideration (`browser_highlight`)
372
+
373
+ Draw visual consideration, target lock, danger/success, or shimmer overlays without mutating the DOM. Supports multi-element candidate evaluation:
374
+
375
+ ```json
376
+ {
377
+ "refs": ["w:12", "w:15", "w:23"],
378
+ "style": "consideration",
379
+ "label": "Evaluating form options",
380
+ "duration": 2000
381
+ }
382
+ ```
383
+
384
+ ### Presentation Styles:
385
+ - `"consideration"`: Soft pulsing cyan/blue outline (`#38bdf8`) with ambient glow — ideal when weighing multiple interactive candidates.
386
+ - `"target"`: High-contrast amber lock-on ring (`#f59e0b`) before executing high-impact clicks.
387
+ - `"danger"`: Red warning border (`#ef4444`) for destructive buttons (Delete, Reset, Purge).
388
+ - `"success"`: Emerald glow (`#10b981`) confirming completed actions.
389
+ - `"shimmer"`: Rapid purple accent wave (default for quick inspection).
390
+
391
+ ---
392
+
393
+ ## 10. System Clipboard Bridging (`browser_clipboard`)
394
+
395
+ Read or write system clipboard text during automation:
396
+
397
+ ```json
398
+ {
399
+ "action": "write",
400
+ "text": "AuthToken_xyz987"
401
+ }
402
+ ```
403
+
404
+
405
+ ## tab-and-window
406
+
407
+ # Tab & Window Lifecycle Management
408
+
409
+ Multi-tab workflows (OAuth popups, payment gateways, documentation references, desktop application windows) require deterministic tab switching, window focusing, and failure recovery. `browser_tabs` controls all CDP page and window targets.
410
+
411
+ ---
412
+
413
+ ## 1. Tab Discovery & Target Enumeration
414
+
415
+ Inspect all active targets, open URLs, and page titles:
416
+
417
+ ```json
418
+ {
419
+ "action": "list"
420
+ }
421
+ ```
422
+
423
+ To list targets inside a specific desktop app (e.g. Discord, Slack):
424
+ ```json
425
+ {
426
+ "action": "list",
427
+ "app": "discord"
428
+ }
429
+ ```
430
+
431
+ > [!TIP]
432
+ > Always pass `"app": "<name>"` when inspecting desktop applications. This guarantees that Weavetab does not launch or query the web browser.
433
+
434
+ ---
435
+
436
+ ## 2. Opening Tabs & Smart Reuse
437
+
438
+ Open a target URL. By default, `reuse: true` will focus an existing tab if the URL is already loaded:
439
+
440
+ ```json
441
+ {
442
+ "action": "open",
443
+ "url": "https://github.com"
444
+ }
445
+ ```
446
+
447
+ To force opening a brand-new duplicate tab instead of reusing:
448
+ ```json
449
+ {
450
+ "action": "open",
451
+ "url": "https://github.com",
452
+ "reuse": false
453
+ }
454
+ ```
455
+
456
+ ---
457
+
458
+ ## 3. Context Switching
459
+
460
+ Switch active agent focus between open tabs:
461
+
462
+ ```json
463
+ {
464
+ "action": "switch",
465
+ "tabId": "TARGET_PAGE_ID"
466
+ }
467
+ ```
468
+
469
+ ---
470
+
471
+ ## 4. Closing Tabs & Batch Cleanup
472
+
473
+ Close a single tab:
474
+ ```json
475
+ {
476
+ "action": "close",
477
+ "tabId": "TARGET_PAGE_ID"
478
+ }
479
+ ```
480
+
481
+ Close multiple tabs simultaneously in a single round-trip:
482
+ ```json
483
+ {
484
+ "action": "close",
485
+ "tabIds": ["TARGET_1", "TARGET_2", "TARGET_3"]
486
+ }
487
+ ```
488
+
489
+ ---
490
+
491
+ ## 5. Native Window Management
492
+
493
+ List native OS windows:
494
+ ```json
495
+ {
496
+ "action": "list_windows"
497
+ }
498
+ ```
499
+
500
+ Bring a specific native window to the foreground:
501
+ ```json
502
+ {
503
+ "action": "focus_window",
504
+ "windowId": 1
505
+ }
506
+ ```
507
+
508
+ ---
509
+
510
+ ## 6. Duplicate Consolidation & Auto-Heal
511
+
512
+ Deduplicate redundant tabs across the session:
513
+ ```json
514
+ {
515
+ "action": "consolidate"
516
+ }
517
+ ```
518
+
519
+ If a target page crashes or detaches due to memory limits:
520
+ ```json
521
+ {
522
+ "action": "heal"
523
+ }
524
+ ```
525
+
526
+ The auto-heal routine re-establishes CDP protocol sessions, reconnects event listeners, and synchronizes the active page target.