@weavetab/skills 2.5.0 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +108 -108
- package/ROUTER.md +43 -43
- package/bin/cli.js +232 -232
- package/browser/dom-strategy.md +121 -119
- package/browser/form-automation.md +84 -87
- package/browser/interaction-pipeline.md +242 -216
- package/browser/tab-and-window.md +136 -136
- package/desktop/desktop-targeting.md +85 -85
- package/desktop/electron-discovery.md +115 -115
- package/developer/github-forensics.md +89 -74
- package/dist/bundled/weavetab-all.md +1885 -1709
- package/dist/bundled/weavetab-browser.md +526 -501
- package/dist/bundled/weavetab-desktop.md +176 -176
- package/dist/bundled/weavetab-developer.md +84 -67
- package/dist/bundled/weavetab-documents.md +184 -142
- package/dist/bundled/weavetab-memory.md +259 -233
- package/dist/bundled/weavetab-network-and-perf.md +250 -223
- package/dist/bundled/weavetab-plugins.md +88 -83
- package/dist/bundled/weavetab-resilience.md +244 -216
- package/dist/bundled/weavetab-security.md +93 -87
- package/dist/granular/browser_dom-strategy.md +121 -119
- package/dist/granular/browser_form-automation.md +84 -87
- package/dist/granular/browser_interaction-pipeline.md +242 -216
- package/dist/granular/browser_tab-and-window.md +136 -136
- package/dist/granular/desktop_desktop-targeting.md +85 -85
- package/dist/granular/desktop_electron-discovery.md +115 -115
- package/dist/granular/developer_github-forensics.md +89 -74
- package/dist/granular/documents_canvas-and-visual-capture.md +117 -103
- package/dist/granular/documents_office-document-ingestion.md +91 -63
- package/dist/granular/memory_selector-memory-system.md +127 -127
- package/dist/granular/memory_session-trail.md +111 -95
- package/dist/granular/memory_site-learning.md +62 -53
- package/dist/granular/network-and-perf_device-and-environment.md +100 -87
- package/dist/granular/network-and-perf_network-intercept-and-mock.md +97 -84
- package/dist/granular/network-and-perf_performance-and-vitals.md +86 -84
- package/dist/granular/plugins_hooks-and-overrides.md +40 -35
- package/dist/granular/plugins_plugin-runtime.md +63 -63
- package/dist/granular/resilience_loop-breaker.md +72 -67
- package/dist/granular/resilience_session-time-travel.md +146 -131
- package/dist/granular/resilience_stale-ref-recovery.md +61 -53
- package/dist/granular/security_rbac-and-policies.md +50 -47
- package/dist/granular/security_secret-containment-protocol.md +62 -59
- package/documents/canvas-and-visual-capture.md +117 -103
- package/documents/office-document-ingestion.md +91 -63
- package/evals/evaluator.js +146 -146
- package/evals/scenarios.json +239 -239
- package/memory/selector-memory-system.md +127 -127
- package/memory/session-trail.md +111 -95
- package/memory/site-learning.md +61 -52
- package/network-and-perf/device-and-environment.md +100 -87
- package/network-and-perf/network-intercept-and-mock.md +97 -84
- package/network-and-perf/performance-and-vitals.md +86 -84
- package/package.json +74 -73
- package/plugins/hooks-and-overrides.md +40 -35
- package/plugins/plugin-runtime.md +63 -63
- package/resilience/loop-breaker.md +72 -67
- package/resilience/session-time-travel.md +146 -131
- package/resilience/stale-ref-recovery.md +61 -53
- package/security/rbac-and-policies.md +50 -47
- package/security/secret-containment-protocol.md +62 -59
- package/skills.json +425 -426
- package/src/api.js +239 -239
|
@@ -14,12 +14,14 @@ triggers:
|
|
|
14
14
|
tools:
|
|
15
15
|
- "browser_pattern_learn"
|
|
16
16
|
- "browser_burst"
|
|
17
|
-
weavetab: ">=2.5.0
|
|
17
|
+
weavetab: ">=2.5.0"
|
|
18
18
|
---
|
|
19
19
|
|
|
20
20
|
# Site Learning — Autonomous Workflow Memory
|
|
21
21
|
|
|
22
|
-
Weavetab's Site Learning engine accumulates cross-session knowledge about websites and multi-step automation flows. Each site gets one profile file at
|
|
22
|
+
Weavetab's Site Learning engine accumulates cross-session knowledge about websites and multi-step automation flows. Each site gets one profile file at `~/.weavetab-system/memory/sites/<origin>.json` — never duplicated, always merged on write.
|
|
23
|
+
|
|
24
|
+
A profile holds `framework`, `captcha_frequency`, `quirks`, and named `patterns` (each with `steps`, `reliability`, `strikes`, and execution counters).
|
|
23
25
|
|
|
24
26
|
---
|
|
25
27
|
|
|
@@ -27,38 +29,41 @@ Weavetab's Site Learning engine accumulates cross-session knowledge about websit
|
|
|
27
29
|
|
|
28
30
|
On every session visiting a known or potentially-known site, run:
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
{ "
|
|
32
|
-
|
|
32
|
+
```json
|
|
33
|
+
{ "action": "get", "origin": "https://github.com" }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`action` defaults to `"learn"`, so `get` must be stated explicitly. If `origin` is omitted, `get` reads the active tab's origin.
|
|
33
37
|
|
|
34
38
|
Parse the response:
|
|
35
|
-
- known: false → site is new
|
|
36
|
-
-
|
|
37
|
-
- quirks → auto-handle any listed quirks (cookie banners, rate limits) before main task
|
|
38
|
-
- ramework → adjust interaction strategy accordingly (React, Vue, etc.)
|
|
39
|
+
- `known: false` → the site is new; proceed exploratorily and teach it after completion.
|
|
40
|
+
- `_hint` → a compact text summary listing `framework`, `captcha_frequency`, `known_patterns` (with reliability and step counts), and `quirks`.
|
|
41
|
+
- `quirks` → auto-handle any listed quirks (cookie banners, rate limits) before the main task.
|
|
39
42
|
|
|
40
43
|
---
|
|
41
44
|
|
|
42
45
|
## 2. Fast-Path vs. Exploratory Decision
|
|
43
46
|
|
|
44
|
-
Use the
|
|
47
|
+
Use the per-pattern `reliability` (and `strikes`) values to choose your strategy:
|
|
45
48
|
|
|
46
49
|
| Reliability | Strikes | Strategy |
|
|
47
50
|
|---|---|---|
|
|
48
|
-
| ≥ 0.8, strikes = 0 |
|
|
49
|
-
| 0.5–0.79 | 0–1 | **Cautious path**: replay steps, verify success_indicator after each critical step |
|
|
51
|
+
| ≥ 0.8, strikes = 0 | — | **Fast path**: replay the stored steps via `browser_burst` directly |
|
|
52
|
+
| 0.5–0.79 | 0–1 | **Cautious path**: replay steps, verify `success_indicator` after each critical step |
|
|
50
53
|
| < 0.5 | any | **Re-explore**: navigate manually, collect correct steps, then teach |
|
|
51
|
-
| any | ≥ 3 | **Re-learn**: ignore cached pattern, re-explore, then
|
|
54
|
+
| any | ≥ 3 | **Re-learn**: ignore the cached pattern, re-explore, then `learn` again with updated steps |
|
|
55
|
+
|
|
56
|
+
The `_hint` string flags eligible patterns with `[fast-path eligible]` and stale ones with `[RE-LEARN NEEDED]`.
|
|
52
57
|
|
|
53
58
|
---
|
|
54
59
|
|
|
55
60
|
## 3. Quirk Auto-Handling
|
|
56
61
|
|
|
57
|
-
If a profile
|
|
62
|
+
If a profile lists quirks, resolve them immediately after navigation before executing your main task. Example stored quirk data:
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
```
|
|
65
|
+
{ "cookie_banner": { "selector": "#cookie-consent", "action": "click .accept-all", "appears": "first_visit" } }
|
|
66
|
+
```
|
|
62
67
|
|
|
63
68
|
Execute the action before doing anything else. Never spend reasoning turns on a known dismissible popup.
|
|
64
69
|
|
|
@@ -68,11 +73,10 @@ Execute the action before doing anything else. Never spend reasoning turns on a
|
|
|
68
73
|
|
|
69
74
|
After successfully completing a multi-step flow for the first time (or after re-learning):
|
|
70
75
|
|
|
71
|
-
|
|
76
|
+
```json
|
|
72
77
|
{
|
|
73
|
-
"tool": "browser_pattern_learn",
|
|
74
|
-
"origin": "https://github.com",
|
|
75
78
|
"action": "learn",
|
|
79
|
+
"origin": "https://github.com",
|
|
76
80
|
"name": "login_flow",
|
|
77
81
|
"steps": [
|
|
78
82
|
{ "tool": "browser_navigate", "target": "https://github.com/login" },
|
|
@@ -83,18 +87,19 @@ After successfully completing a multi-step flow for the first time (or after re-
|
|
|
83
87
|
"success_indicator": "a[aria-label='Homepage']",
|
|
84
88
|
"entry": "/login"
|
|
85
89
|
}
|
|
86
|
-
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Each step accepts `tool`, an optional `target` (selector or URL), an optional `value`, and an optional `extra` object forwarded verbatim to `browser_burst` replay.
|
|
87
93
|
|
|
88
94
|
**Pattern Naming Rules**:
|
|
89
|
-
- Use snake_case
|
|
90
|
-
- Be descriptive: login_flow
|
|
91
|
-
-
|
|
95
|
+
- Use snake_case.
|
|
96
|
+
- Be descriptive: `login_flow`, `pr_review`, `csv_export`, `checkout_flow`.
|
|
97
|
+
- A duplicate name on the same origin is an **update** (merge) — it never creates a second pattern.
|
|
92
98
|
|
|
93
99
|
**Step Quality Rules**:
|
|
94
|
-
-
|
|
95
|
-
- Avoid
|
|
96
|
-
|
|
97
|
-
- For sensitive inputs, record the step with a placeholder like {{username}} — never hardcode credentials
|
|
100
|
+
- Prefer semantic selectors: `data-testid`, `id`, `aria-label`, readable text-based selectors.
|
|
101
|
+
- Avoid hashed classes (`.hash_abc123`), positional selectors (`div:nth-child(4)`), and deep anonymous chains (`div > div > div > span`) — the engine drops volatile selectors during compilation.
|
|
102
|
+
- For sensitive inputs, record a placeholder like `{{username}}` — never hardcode credentials.
|
|
98
103
|
|
|
99
104
|
---
|
|
100
105
|
|
|
@@ -102,20 +107,21 @@ After successfully completing a multi-step flow for the first time (or after re-
|
|
|
102
107
|
|
|
103
108
|
Every time you replay a pattern, report the outcome:
|
|
104
109
|
|
|
105
|
-
|
|
110
|
+
```json
|
|
106
111
|
{
|
|
107
|
-
"tool": "browser_pattern_learn",
|
|
108
|
-
"origin": "https://github.com",
|
|
109
112
|
"action": "record_execution",
|
|
113
|
+
"origin": "https://github.com",
|
|
110
114
|
"name": "login_flow",
|
|
111
115
|
"success": true,
|
|
112
116
|
"duration_ms": 3100
|
|
113
117
|
}
|
|
114
|
-
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`success` is required. The engine updates reliability via EWMA (α=0.15):
|
|
121
|
+
- A success nudges reliability toward 1.0 (and resets `strikes` to 0).
|
|
122
|
+
- A failure lowers reliability and increments `strikes`; 3 consecutive failures trigger a re-learn flag.
|
|
115
123
|
|
|
116
|
-
|
|
117
|
-
- Success run → reliability climbs toward 1.0 slowly
|
|
118
|
-
- Failure run → reliability drops; 3 consecutive failures trigger [RE-LEARN NEEDED] flag
|
|
124
|
+
If no pattern with that name exists for the origin, the call returns `error_code: "PATTERN_NOT_FOUND"`.
|
|
119
125
|
|
|
120
126
|
---
|
|
121
127
|
|
|
@@ -123,11 +129,10 @@ The engine uses EWMA (α=0.15) to update the reliability score:
|
|
|
123
129
|
|
|
124
130
|
When you encounter a cookie consent modal, popup, or rate limit for the first time:
|
|
125
131
|
|
|
126
|
-
|
|
132
|
+
```json
|
|
127
133
|
{
|
|
128
|
-
"tool": "browser_pattern_learn",
|
|
129
|
-
"origin": "https://example.com",
|
|
130
134
|
"action": "record_quirk",
|
|
135
|
+
"origin": "https://example.com",
|
|
131
136
|
"quirk_key": "cookie_banner",
|
|
132
137
|
"quirk_data": {
|
|
133
138
|
"selector": "#cookie-consent",
|
|
@@ -135,46 +140,50 @@ When you encounter a cookie consent modal, popup, or rate limit for the first ti
|
|
|
135
140
|
"appears": "first_visit"
|
|
136
141
|
}
|
|
137
142
|
}
|
|
138
|
-
|
|
143
|
+
```
|
|
139
144
|
|
|
140
|
-
Supported quirk_key values: cookie_banner
|
|
145
|
+
Supported `quirk_key` values: `cookie_banner`, `rate_limit`, `modal_popups`.
|
|
141
146
|
|
|
142
147
|
For rate limits:
|
|
143
|
-
|
|
148
|
+
|
|
149
|
+
```json
|
|
144
150
|
{
|
|
151
|
+
"action": "record_quirk",
|
|
152
|
+
"origin": "https://example.com",
|
|
145
153
|
"quirk_key": "rate_limit",
|
|
146
154
|
"quirk_data": { "threshold": "60req/min", "recovery": "wait 30s" }
|
|
147
155
|
}
|
|
148
|
-
|
|
156
|
+
```
|
|
149
157
|
|
|
150
158
|
---
|
|
151
159
|
|
|
152
160
|
## 7. Anti-Patterns to Avoid
|
|
153
161
|
|
|
154
|
-
- **Never create per-session pattern names** like login_2026_09_16 — one name per workflow per origin, forever updated in place.
|
|
155
|
-
- **Never call
|
|
156
|
-
- **Never store credentials in steps** — use placeholders or
|
|
157
|
-
- **Never write to
|
|
162
|
+
- **Never create per-session pattern names** like `login_2026_09_16` — one name per workflow per origin, forever updated in place.
|
|
163
|
+
- **Never call `browser_pattern_learn` in a loop** — one call per workflow completion. The write is idempotent (skips the disk write if nothing changed).
|
|
164
|
+
- **Never store credentials in steps** — use placeholders or `browser_type_secret` during actual execution.
|
|
165
|
+
- **Never write to `~/.weavetab/`** — all memory belongs in `~/.weavetab-system/memory/sites/`.
|
|
158
166
|
|
|
159
167
|
---
|
|
160
168
|
|
|
161
169
|
## 8. Full Session Example: GitHub PR Review
|
|
162
170
|
|
|
163
|
-
|
|
171
|
+
```
|
|
164
172
|
1. browser_pattern_learn { action: "get", origin: "https://github.com" }
|
|
165
|
-
→
|
|
166
|
-
→ quirks:
|
|
173
|
+
→ known_patterns: pr_review (reliability 0.95, 3 steps) [fast-path eligible]
|
|
174
|
+
→ quirks: none
|
|
167
175
|
|
|
168
|
-
2. Since reliability=0.95 (≥ 0.8): use fast path
|
|
169
|
-
browser_burst with the 3 stored steps
|
|
176
|
+
2. Since reliability = 0.95 (≥ 0.8): use the fast path.
|
|
177
|
+
browser_burst with the 3 stored steps.
|
|
170
178
|
|
|
171
179
|
3. After completion:
|
|
172
180
|
browser_pattern_learn {
|
|
173
181
|
action: "record_execution",
|
|
174
182
|
name: "pr_review",
|
|
183
|
+
origin: "https://github.com",
|
|
175
184
|
success: true,
|
|
176
185
|
duration_ms: 2800
|
|
177
186
|
}
|
|
178
|
-
|
|
187
|
+
```
|
|
179
188
|
|
|
180
|
-
Total agent turns for a known site: **3 tool calls** vs. potentially 12+ with full exploration.
|
|
189
|
+
Total agent turns for a known site: **3 tool calls** vs. potentially 12+ with full exploration.
|
|
@@ -1,87 +1,100 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: device-and-environment
|
|
3
|
-
domain: network-and-perf
|
|
4
|
-
triggers:
|
|
5
|
-
- "emulate device"
|
|
6
|
-
- "mobile view"
|
|
7
|
-
- "throttle network"
|
|
8
|
-
- "geolocation override"
|
|
9
|
-
- "user agent"
|
|
10
|
-
- "responsive testing"
|
|
11
|
-
tools:
|
|
12
|
-
- "
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
1
|
+
---
|
|
2
|
+
id: device-and-environment
|
|
3
|
+
domain: network-and-perf
|
|
4
|
+
triggers:
|
|
5
|
+
- "emulate device"
|
|
6
|
+
- "mobile view"
|
|
7
|
+
- "throttle network"
|
|
8
|
+
- "geolocation override"
|
|
9
|
+
- "user agent"
|
|
10
|
+
- "responsive testing"
|
|
11
|
+
tools:
|
|
12
|
+
- "browser_viewport"
|
|
13
|
+
- "browser_emulate"
|
|
14
|
+
weavetab: ">=2.5.0"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Device Emulation & Environment Simulation
|
|
18
|
+
|
|
19
|
+
Auditing mobile responsive layouts, testing geographic restrictions, and simulating degraded network conditions are split across two tools: `browser_viewport` owns device geometry, locale, timezone, and color-scheme emulation; `browser_emulate` owns network throttling and CPU slowdown.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 1. Device Presets & Viewport Simulation (`browser_viewport`)
|
|
24
|
+
|
|
25
|
+
List the available hardware presets, then apply one:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{ "action": "list" }
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"action": "preset",
|
|
34
|
+
"devicePreset": "iPhone 15 Pro"
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or configure custom screen geometry directly with `action: "set"`:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"action": "set",
|
|
43
|
+
"width": 393,
|
|
44
|
+
"height": 852,
|
|
45
|
+
"deviceScaleFactor": 3,
|
|
46
|
+
"mobile": true,
|
|
47
|
+
"hasTouch": true,
|
|
48
|
+
"screenOrientation": "portrait"
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Clear all viewport and emulation overrides back to the host defaults:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{ "action": "clear" }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 2. Network & CPU Throttling (`browser_emulate`)
|
|
61
|
+
|
|
62
|
+
Verify how web applications degrade under poor connectivity:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"network": {
|
|
67
|
+
"offline": false,
|
|
68
|
+
"downloadThroughput": 512000,
|
|
69
|
+
"uploadThroughput": 256000,
|
|
70
|
+
"latency": 400
|
|
71
|
+
},
|
|
72
|
+
"cpuThrottlingRate": 4
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Use a named profile for common cases (`"slow3g"`, `"fast3g"`, `"4g"`, `"offline"`, `"online"`):
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{ "network": "slow3g" }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 3. Geolocation, Timezone, Locale & Color Scheme (`browser_viewport`)
|
|
85
|
+
|
|
86
|
+
Bypass localized IP redirects or verify localized content rendering:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"action": "set",
|
|
91
|
+
"geolocation": {
|
|
92
|
+
"latitude": 37.7749,
|
|
93
|
+
"longitude": -122.4194,
|
|
94
|
+
"accuracy": 100
|
|
95
|
+
},
|
|
96
|
+
"timezoneId": "America/Los_Angeles",
|
|
97
|
+
"locale": "en-US",
|
|
98
|
+
"colorScheme": "dark"
|
|
99
|
+
}
|
|
100
|
+
```
|
|
@@ -1,84 +1,97 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: network-intercept-and-mock
|
|
3
|
-
domain: network-and-perf
|
|
4
|
-
triggers:
|
|
5
|
-
- "mock api"
|
|
6
|
-
- "intercept network"
|
|
7
|
-
- "stub request"
|
|
8
|
-
- "inspect tls"
|
|
9
|
-
- "ssl certificate"
|
|
10
|
-
- "network waterfall"
|
|
11
|
-
tools:
|
|
12
|
-
- "browser_network_intercept"
|
|
13
|
-
weavetab: ">=2.5.0
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
# Network Interception, Mocking &
|
|
17
|
-
|
|
18
|
-
Autonomous testing and debugging often require simulating backend error states (e.g. 500 Internal Server Error, 429 Rate Limit), stubbing third-party analytics, or
|
|
19
|
-
|
|
20
|
-
`browser_network_intercept`
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## 1. Mocking API Responses
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
```json
|
|
29
|
-
{
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## 3.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"action": "
|
|
64
|
-
"
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
1
|
+
---
|
|
2
|
+
id: network-intercept-and-mock
|
|
3
|
+
domain: network-and-perf
|
|
4
|
+
triggers:
|
|
5
|
+
- "mock api"
|
|
6
|
+
- "intercept network"
|
|
7
|
+
- "stub request"
|
|
8
|
+
- "inspect tls"
|
|
9
|
+
- "ssl certificate"
|
|
10
|
+
- "network waterfall"
|
|
11
|
+
tools:
|
|
12
|
+
- "browser_network_intercept"
|
|
13
|
+
weavetab: ">=2.5.0"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Network Interception, Mocking & Telemetry
|
|
17
|
+
|
|
18
|
+
Autonomous testing and debugging often require simulating backend error states (e.g. 500 Internal Server Error, 429 Rate Limit), stubbing third-party analytics, or inspecting real request timing and TLS metadata.
|
|
19
|
+
|
|
20
|
+
`browser_network_intercept` exposes four actions: `enable`, `disable`, `get_telemetry`, and `clear_telemetry`.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 1. Mocking API Responses (`enable`)
|
|
25
|
+
|
|
26
|
+
`enable` requires a `pattern` (URL glob). Every matching response is fulfilled with your mock:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"action": "enable",
|
|
31
|
+
"pattern": "*/api/v1/user/profile",
|
|
32
|
+
"mockStatus": 200,
|
|
33
|
+
"mockBody": "{\"id\": \"usr_test\", \"role\": \"admin\", \"credits\": 9999}"
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- **`pattern`** — URL glob, e.g. `*api/users*`. `*` and `?` are treated as wildcards.
|
|
38
|
+
- **`mockStatus`** — HTTP status to return (default `200`). Use `500`/`429`/`404` to simulate failures.
|
|
39
|
+
- **`mockBody`** — response body string (default `{}`). Pass JSON as a string.
|
|
40
|
+
|
|
41
|
+
Mocks are served from the extension when present, otherwise via CDP's Fetch domain (fallback mode).
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 2. Stopping Interception (`disable`)
|
|
46
|
+
|
|
47
|
+
Return the browser to live traffic when a test completes:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"action": "disable"
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 3. Network Telemetry (`get_telemetry`)
|
|
58
|
+
|
|
59
|
+
`get_telemetry` starts a background capture (if not already running) and returns the recorded requests — including per-request protocol timing phases, TLS/SSL certificate details when the connection exposes them, and failure reasons:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"action": "get_telemetry",
|
|
64
|
+
"pattern": "*api/*"
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
An optional `pattern` filters the returned requests by URL. The response includes:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"success": true,
|
|
73
|
+
"count": 12,
|
|
74
|
+
"requests": [
|
|
75
|
+
{
|
|
76
|
+
"url": "https://weavetab.dev/api/v1/session",
|
|
77
|
+
"timing": { "dnsMs": 1.4, "tcpMs": 3.2, "sslMs": 4.1, "ttfbMs": 12.8 }
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"navigationOccurred": false,
|
|
81
|
+
"errors": []
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> Certificates and timing fields are surfaced only when the underlying connection exposes them; treat missing fields as "not reported", not "absent".
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 4. Clearing the Buffer (`clear_telemetry`)
|
|
90
|
+
|
|
91
|
+
Reset the capture buffer between scenarios without tearing down the session:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"action": "clear_telemetry"
|
|
96
|
+
}
|
|
97
|
+
```
|