@weavetab/mcp 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.
- package/AGENTS.md +49 -49
- package/ARCHITECTURE.md +590 -590
- package/LICENSE +216 -216
- package/README.md +269 -269
- package/SECURITY.md +207 -207
- package/TROUBLESHOOTING.md +373 -365
- package/dist/anticaptcha/detector.js +395 -395
- package/dist/anticaptcha/solver.js +130 -130
- package/dist/cdp/bridge.js +73 -73
- package/dist/cdp/connector.js +46 -22
- package/dist/cdp/extension.js +34 -34
- package/dist/cdp/helpers.js +174 -174
- package/dist/cdp/pruner.js +195 -195
- package/dist/cdp/ref_cache.js +66 -66
- package/dist/cdp/security.js +10 -10
- package/dist/cdp/verify.js +57 -57
- package/dist/cdp/walker.js +563 -525
- package/dist/cli/plugin.js +26 -3
- package/dist/config/loader.d.ts +0 -3
- package/dist/config/loader.js +0 -9
- package/dist/index.js +0 -4
- package/dist/intelligence/intent.js +81 -81
- package/dist/intelligence/sessionMemory.js +2 -2
- package/dist/overlay/ghost.js +22 -22
- package/dist/overlay/injector.js +89 -89
- package/dist/plugin/extension_bridge.js +54 -54
- package/dist/plugin/interface.d.ts +7 -0
- package/dist/plugin/loader.js +3 -4
- package/dist/plugin/schema.d.ts +11 -0
- package/dist/plugin/schema.js +59 -0
- package/dist/security/guard.js +18 -18
- package/dist/sensors/actionability.js +167 -167
- package/dist/sensors/guard.js +29 -29
- package/dist/sensors/network.js +15 -17
- package/dist/server.d.ts +1 -1
- package/dist/server.js +173 -144
- package/dist/state/delta.js +6 -7
- package/dist/tools/automation.js +85 -85
- package/dist/tools/canvas.js +48 -25
- package/dist/tools/checkpoint.js +94 -35
- package/dist/tools/click.js +52 -41
- package/dist/tools/clipboard.js +80 -74
- package/dist/tools/design_extract.js +441 -441
- package/dist/tools/dialog.js +13 -13
- package/dist/tools/emulation.d.ts +2 -0
- package/dist/tools/emulation.js +7 -0
- package/dist/tools/fill.js +344 -347
- package/dist/tools/find.js +78 -52
- package/dist/tools/highlight.js +67 -67
- package/dist/tools/inspect.js +54 -25
- package/dist/tools/key.js +42 -35
- package/dist/tools/navigate.d.ts +1 -1
- package/dist/tools/navigate.js +35 -35
- package/dist/tools/office/parse.js +62 -18
- package/dist/tools/pdf.d.ts +9 -0
- package/dist/tools/pdf.js +7 -4
- package/dist/tools/performance.d.ts +11 -4
- package/dist/tools/performance.js +94 -42
- package/dist/tools/performance_test.d.ts +2 -2
- package/dist/tools/performance_test.js +69 -69
- package/dist/tools/pointer.js +116 -116
- package/dist/tools/read.js +99 -67
- package/dist/tools/recording.js +9 -0
- package/dist/tools/scrape.js +146 -146
- package/dist/tools/screenshot.d.ts +2 -0
- package/dist/tools/screenshot.js +46 -4
- package/dist/tools/scroll.d.ts +3 -1
- package/dist/tools/scroll.js +13 -15
- package/dist/tools/select.d.ts +3 -0
- package/dist/tools/select.js +131 -124
- package/dist/tools/snapshot.js +8 -6
- package/dist/tools/storage.d.ts +5 -1
- package/dist/tools/storage.js +16 -0
- package/dist/tools/tabs.d.ts +7 -5
- package/dist/tools/tabs.js +79 -26
- package/dist/tools/thought.js +8 -8
- package/dist/tools/type.js +274 -274
- package/dist/tools/type_secret.js +23 -23
- package/dist/tools/upload.js +3 -3
- package/dist/tools/video_compiler.js +9 -0
- package/dist/tools/wait.js +35 -35
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/DOCUMENTATION.md +583 -585
- package/docs/PLUGINS.md +139 -121
- package/docs/TOOLS.md +3 -4
- package/docs/architecture/blind-injection.md +83 -83
- package/docs/architecture/overview.md +49 -49
- package/docs/architecture/security.md +36 -36
- package/docs/architecture/transport.md +37 -37
- package/docs/cli/cli-commands.md +50 -50
- package/docs/cli/cli-flags.md +28 -28
- package/docs/cli/cli-scripting.md +35 -35
- package/docs/configuration/config-locations.md +23 -23
- package/docs/configuration/configuration.md +39 -27
- package/docs/configuration/env-variables.md +19 -19
- package/docs/configuration/folders.md +62 -55
- package/docs/desktop-automation/electron-apps.md +225 -214
- package/docs/get-started/installation.md +1 -1
- package/docs/get-started/introduction.md +60 -60
- package/docs/get-started/quickstart.md +2 -2
- package/docs/get-started/setup-wizard.md +27 -27
- package/docs/intelligence/site-profiles.md +151 -151
- package/docs/tools/tools.md +582 -631
- package/docs/troubleshooting/trouble-browser.md +27 -27
- package/docs/troubleshooting/trouble-loop.md +31 -31
- package/ext-dist/background.js +415 -415
- package/ext-dist/content.js +2527 -2527
- package/ext-dist/dashboard.html +583 -583
- package/ext-dist/hud/hud.js +3 -3
- package/ext-dist/hud/index.html +20 -20
- package/ext-dist/manifest.json +73 -73
- package/ext-dist/styles.css +223 -223
- package/mcp.json +796 -805
- package/package.json +118 -118
- package/server.json +23 -23
- package/dist/cdp/walker.test.d.ts +0 -2
- package/dist/cdp/walker.test.js +0 -172
- package/dist/intelligence/sessionMemory.test.d.ts +0 -2
- package/dist/intelligence/sessionMemory.test.js +0 -62
- package/dist/intelligence/trail.test.d.ts +0 -2
- package/dist/intelligence/trail.test.js +0 -110
- package/dist/state/cache.test.d.ts +0 -2
- package/dist/state/cache.test.js +0 -76
- package/dist/state/delta.test.d.ts +0 -2
- package/dist/state/delta.test.js +0 -279
- package/dist/state/groups.d.ts +0 -15
- package/dist/state/groups.js +0 -80
- package/dist/tools/accessibility.d.ts +0 -14
- package/dist/tools/accessibility.js +0 -32
- package/dist/tools/ask.d.ts +0 -14
- package/dist/tools/ask.js +0 -49
- package/dist/tools/click_and_wait.d.ts +0 -33
- package/dist/tools/click_and_wait.js +0 -149
- package/dist/tools/drag.d.ts +0 -15
- package/dist/tools/drag.js +0 -29
- package/dist/tools/geo.d.ts +0 -19
- package/dist/tools/geo.js +0 -29
- package/dist/tools/github/analyze.d.ts +0 -4
- package/dist/tools/github/analyze.js +0 -113
- package/dist/tools/github/cache.d.ts +0 -21
- package/dist/tools/github/cache.js +0 -28
- package/dist/tools/github/index.d.ts +0 -19
- package/dist/tools/github/index.js +0 -40
- package/dist/tools/github/issues.d.ts +0 -9
- package/dist/tools/github/issues.js +0 -88
- package/dist/tools/github/pr.d.ts +0 -5
- package/dist/tools/github/pr.js +0 -88
- package/dist/tools/github/rateLimiter.d.ts +0 -4
- package/dist/tools/github/rateLimiter.js +0 -46
- package/dist/tools/github/read.d.ts +0 -34
- package/dist/tools/github/read.js +0 -74
- package/dist/tools/github/repoContext.d.ts +0 -20
- package/dist/tools/github/repoContext.js +0 -129
- package/dist/tools/hover.d.ts +0 -19
- package/dist/tools/hover.js +0 -57
- package/dist/tools/integration.test.d.ts +0 -2
- package/dist/tools/integration.test.js +0 -96
- package/dist/tools/macro_compiler.d.ts +0 -7
- package/dist/tools/macro_compiler.js +0 -82
- package/dist/tools/mouse.d.ts +0 -21
- package/dist/tools/mouse.js +0 -62
- package/dist/tools/response.d.ts +0 -129
- package/dist/tools/response.js +0 -5
- package/dist/tools/wait_for.d.ts +0 -23
- package/dist/tools/wait_for.js +0 -30
- package/dist/tools/windows.d.ts +0 -22
- package/dist/tools/windows.js +0 -57
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Site Profiles and Intelligent Memory"
|
|
3
|
-
description: "Persistent cross-session workflow memory, pattern compilation, and quirk bypass in ~/.weavetab-system/memory/sites/."
|
|
4
|
-
product: mcp
|
|
5
|
-
section: intelligence
|
|
6
|
-
icon: Brain
|
|
7
|
-
slug: site-profiles
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Site Profiles and Intelligent Memory Engine
|
|
11
|
-
|
|
12
|
-
Every browser automation session normally starts from zero context. The agent re-inspects DOM trees, re-triggers cookie banners, and re-discovers login fields.
|
|
13
|
-
|
|
14
|
-
Weavetab solves this with a **Two-Tier Persistent Memory System** that accumulates knowledge about domains and workflows across sessions.
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Directory Hierarchy: System vs. User Space
|
|
19
|
-
|
|
20
|
-
| Directory | Purpose | Managed By |
|
|
21
|
-
| :--- | :--- | :--- |
|
|
22
|
-
| `~/.weavetab-system/memory/sites/` | **Persistent Site Profiles**: named workflow patterns, quirks, reliability scores | Weavetab Engine (autonomous) |
|
|
23
|
-
| `~/.weavetab-system/memory/` | **Selector Confidence Cache**: per-domain element selectors and strike counters | Weavetab Engine (autonomous) |
|
|
24
|
-
| `~/.weavetab-system/sessions/` | **Rolling Action Trails**: 50-step window for loop detection | Weavetab Engine (autonomous) |
|
|
25
|
-
| `~/.weavetab/` | **User Configuration**: `config.json`, `secrets.json`, `
|
|
26
|
-
|
|
27
|
-
> **Directory Law**: Machine-compiled memory profiles are strictly located in `~/.weavetab-system/memory/sites/`. User configuration in `~/.weavetab/` is never polluted by machine learning trails or dynamic decay counters.
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Site Profile Schema
|
|
32
|
-
|
|
33
|
-
Profiles are stored as `<sanitized-hostname>.json` under `~/.weavetab-system/memory/sites/`:
|
|
34
|
-
|
|
35
|
-
```json
|
|
36
|
-
{
|
|
37
|
-
"origin": "https://github.com",
|
|
38
|
-
"framework": "react",
|
|
39
|
-
"shadowDom": false,
|
|
40
|
-
"captcha_frequency": "rare",
|
|
41
|
-
"quirks": {
|
|
42
|
-
"cookie_banner": {
|
|
43
|
-
"selector": "#cookie-consent",
|
|
44
|
-
"action": "click .accept-all",
|
|
45
|
-
"appears": "first_visit"
|
|
46
|
-
},
|
|
47
|
-
"rate_limit": {
|
|
48
|
-
"threshold": "60req/min",
|
|
49
|
-
"recovery": "wait 30s"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"patterns": {
|
|
53
|
-
"login_flow": {
|
|
54
|
-
"name": "login_flow",
|
|
55
|
-
"steps": [
|
|
56
|
-
{ "tool": "browser_navigate", "target": "https://github.com/login" },
|
|
57
|
-
{ "tool": "browser_fill", "target": "#login_field", "value": "{{username}}" },
|
|
58
|
-
{ "tool": "browser_fill", "target": "#password", "value": "{{password}}" },
|
|
59
|
-
{ "tool": "browser_click", "target": "[type=submit]" }
|
|
60
|
-
],
|
|
61
|
-
"success_indicator": "a[aria-label='Homepage']",
|
|
62
|
-
"entry": "/login",
|
|
63
|
-
"avg_duration_ms": 3200,
|
|
64
|
-
"reliability": 0.96,
|
|
65
|
-
"strikes": 0,
|
|
66
|
-
"last_verified": "2026-09-16T08:00:00.000Z",
|
|
67
|
-
"total_executions": 12,
|
|
68
|
-
"successful_executions": 12
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
"visitCount": 15,
|
|
72
|
-
"updatedAt": "2026-09-16T08:00:00.000Z"
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## The Pattern Compiler
|
|
79
|
-
|
|
80
|
-
When an agent executes an automation flow:
|
|
81
|
-
1. **Trail Capture**: Steps are tracked via the lightweight action trail.
|
|
82
|
-
2. **Selector Stabilization**: Volatile CSS hash classes (`[class*="hash-"]`), positional pseudos (`:nth-child`), and deep anonymous structural chains are filtered out. Only semantic selectors (`id`, `data-testid`, semantic attributes, roles) are persisted.
|
|
83
|
-
3. **Merge-on-Write**: Calling `browser_pattern_learn` updates existing patterns in place. Duplicate calls never create duplicate files or duplicate entries.
|
|
84
|
-
4. **Anti-Spam Guard**: If an incoming pattern is identical to stored disk state, the disk write is skipped entirely.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## Reliability Scoring and 3-Strike Degradation
|
|
89
|
-
|
|
90
|
-
Each pattern tracks a reliability score (`0.0` to `1.0`) computed via Exponentially Weighted Moving Average (EWMA with $\alpha = 0.15$):
|
|
91
|
-
|
|
92
|
-
$$\text{Reliability}_{t} = 0.85 \times \text{Reliability}_{t-1} + 0.15 \times (\text{Success} ? 1 : 0)$$
|
|
93
|
-
|
|
94
|
-
### Decision Thresholds
|
|
95
|
-
|
|
96
|
-
- **Fast-Path ($\ge 0.80$)**: Replay stored steps directly via `browser_burst` — skips exploratory DOM navigation entirely.
|
|
97
|
-
- **Cautious Replay ($0.50 - 0.79$)**: Replay steps, but verify `success_indicator` after critical steps.
|
|
98
|
-
- **Re-Learn ($< 0.50$ or $\ge 3$ consecutive strikes)**: Pattern is flagged `[RE-LEARN NEEDED]`. The agent falls back to fresh DOM exploration, then calls `browser_pattern_learn` to teach the updated steps.
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## MCP Tools
|
|
103
|
-
|
|
104
|
-
### `browser_pattern_learn`
|
|
105
|
-
All site memory operations use a single tool. Use `action: "get"` to read a site profile, `action: "learn"` to register a workflow, `action: "record_execution"` to update reliability scores, and `action: "record_quirk"` to store site quirks:
|
|
106
|
-
|
|
107
|
-
```json
|
|
108
|
-
{ "
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
```json
|
|
112
|
-
{
|
|
113
|
-
"origin": "https://github.com",
|
|
114
|
-
"action": "learn",
|
|
115
|
-
"name": "login_flow",
|
|
116
|
-
"steps": [
|
|
117
|
-
{ "tool": "browser_click", "target": ".btn-login" },
|
|
118
|
-
{ "tool": "browser_fill", "target": "#login_field", "value": "{{username}}" }
|
|
119
|
-
],
|
|
120
|
-
"success_indicator": "a[aria-label='Homepage']"
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## SDK Plugin Integration (`ctx.memory`)
|
|
127
|
-
|
|
128
|
-
Plugin authors can interact with persistent site memory directly via the SDK:
|
|
129
|
-
|
|
130
|
-
```typescript
|
|
131
|
-
import { definePlugin } from "@weavetab/sdk";
|
|
132
|
-
|
|
133
|
-
export default definePlugin({
|
|
134
|
-
name: "custom-site-automator",
|
|
135
|
-
async onLoad(ctx) {
|
|
136
|
-
// Read current profile
|
|
137
|
-
const profile = await ctx.memory?.getSiteProfile("https://github.com");
|
|
138
|
-
|
|
139
|
-
// Check reliability
|
|
140
|
-
const reliability = await ctx.memory?.getReliability("https://github.com", "login_flow");
|
|
141
|
-
if (reliability && reliability >= 0.8) {
|
|
142
|
-
ctx.logger.info("Fast-path ready for login_flow");
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Teach a new pattern
|
|
146
|
-
await ctx.memory?.learnPattern("https://github.com", "quick_search", {
|
|
147
|
-
steps: [{ tool: "browser_fill", target: "input.header-search-input", value: "test" }]
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
```
|
|
1
|
+
---
|
|
2
|
+
title: "Site Profiles and Intelligent Memory"
|
|
3
|
+
description: "Persistent cross-session workflow memory, pattern compilation, and quirk bypass in ~/.weavetab-system/memory/sites/."
|
|
4
|
+
product: mcp
|
|
5
|
+
section: intelligence
|
|
6
|
+
icon: Brain
|
|
7
|
+
slug: site-profiles
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Site Profiles and Intelligent Memory Engine
|
|
11
|
+
|
|
12
|
+
Every browser automation session normally starts from zero context. The agent re-inspects DOM trees, re-triggers cookie banners, and re-discovers login fields.
|
|
13
|
+
|
|
14
|
+
Weavetab solves this with a **Two-Tier Persistent Memory System** that accumulates knowledge about domains and workflows across sessions.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Directory Hierarchy: System vs. User Space
|
|
19
|
+
|
|
20
|
+
| Directory | Purpose | Managed By |
|
|
21
|
+
| :--- | :--- | :--- |
|
|
22
|
+
| `~/.weavetab-system/memory/sites/` | **Persistent Site Profiles**: named workflow patterns, quirks, reliability scores | Weavetab Engine (autonomous) |
|
|
23
|
+
| `~/.weavetab-system/memory/` | **Selector Confidence Cache**: per-domain element selectors and strike counters | Weavetab Engine (autonomous) |
|
|
24
|
+
| `~/.weavetab-system/sessions/` | **Rolling Action Trails**: 50-step window for loop detection | Weavetab Engine (autonomous) |
|
|
25
|
+
| `~/.weavetab/` | **User Configuration**: `config.json`, `secrets.json`, `knowledge/`, plugins | User / Developer (manual) |
|
|
26
|
+
|
|
27
|
+
> **Directory Law**: Machine-compiled memory profiles are strictly located in `~/.weavetab-system/memory/sites/`. User configuration in `~/.weavetab/` is never polluted by machine learning trails or dynamic decay counters.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Site Profile Schema
|
|
32
|
+
|
|
33
|
+
Profiles are stored as `<sanitized-hostname>.json` under `~/.weavetab-system/memory/sites/`:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"origin": "https://github.com",
|
|
38
|
+
"framework": "react",
|
|
39
|
+
"shadowDom": false,
|
|
40
|
+
"captcha_frequency": "rare",
|
|
41
|
+
"quirks": {
|
|
42
|
+
"cookie_banner": {
|
|
43
|
+
"selector": "#cookie-consent",
|
|
44
|
+
"action": "click .accept-all",
|
|
45
|
+
"appears": "first_visit"
|
|
46
|
+
},
|
|
47
|
+
"rate_limit": {
|
|
48
|
+
"threshold": "60req/min",
|
|
49
|
+
"recovery": "wait 30s"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"patterns": {
|
|
53
|
+
"login_flow": {
|
|
54
|
+
"name": "login_flow",
|
|
55
|
+
"steps": [
|
|
56
|
+
{ "tool": "browser_navigate", "target": "https://github.com/login" },
|
|
57
|
+
{ "tool": "browser_fill", "target": "#login_field", "value": "{{username}}" },
|
|
58
|
+
{ "tool": "browser_fill", "target": "#password", "value": "{{password}}" },
|
|
59
|
+
{ "tool": "browser_click", "target": "[type=submit]" }
|
|
60
|
+
],
|
|
61
|
+
"success_indicator": "a[aria-label='Homepage']",
|
|
62
|
+
"entry": "/login",
|
|
63
|
+
"avg_duration_ms": 3200,
|
|
64
|
+
"reliability": 0.96,
|
|
65
|
+
"strikes": 0,
|
|
66
|
+
"last_verified": "2026-09-16T08:00:00.000Z",
|
|
67
|
+
"total_executions": 12,
|
|
68
|
+
"successful_executions": 12
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"visitCount": 15,
|
|
72
|
+
"updatedAt": "2026-09-16T08:00:00.000Z"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## The Pattern Compiler
|
|
79
|
+
|
|
80
|
+
When an agent executes an automation flow:
|
|
81
|
+
1. **Trail Capture**: Steps are tracked via the lightweight action trail.
|
|
82
|
+
2. **Selector Stabilization**: Volatile CSS hash classes (`[class*="hash-"]`), positional pseudos (`:nth-child`), and deep anonymous structural chains are filtered out. Only semantic selectors (`id`, `data-testid`, semantic attributes, roles) are persisted.
|
|
83
|
+
3. **Merge-on-Write**: Calling `browser_pattern_learn` updates existing patterns in place. Duplicate calls never create duplicate files or duplicate entries.
|
|
84
|
+
4. **Anti-Spam Guard**: If an incoming pattern is identical to stored disk state, the disk write is skipped entirely.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Reliability Scoring and 3-Strike Degradation
|
|
89
|
+
|
|
90
|
+
Each pattern tracks a reliability score (`0.0` to `1.0`) computed via Exponentially Weighted Moving Average (EWMA with $\alpha = 0.15$):
|
|
91
|
+
|
|
92
|
+
$$\text{Reliability}_{t} = 0.85 \times \text{Reliability}_{t-1} + 0.15 \times (\text{Success} ? 1 : 0)$$
|
|
93
|
+
|
|
94
|
+
### Decision Thresholds
|
|
95
|
+
|
|
96
|
+
- **Fast-Path ($\ge 0.80$)**: Replay stored steps directly via `browser_burst` — skips exploratory DOM navigation entirely.
|
|
97
|
+
- **Cautious Replay ($0.50 - 0.79$)**: Replay steps, but verify `success_indicator` after critical steps.
|
|
98
|
+
- **Re-Learn ($< 0.50$ or $\ge 3$ consecutive strikes)**: Pattern is flagged `[RE-LEARN NEEDED]`. The agent falls back to fresh DOM exploration, then calls `browser_pattern_learn` to teach the updated steps.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## MCP Tools
|
|
103
|
+
|
|
104
|
+
### `browser_pattern_learn`
|
|
105
|
+
All site memory operations use a single tool. Use `action: "get"` to read a site profile, `action: "learn"` to register a workflow, `action: "record_execution"` to update reliability scores, and `action: "record_quirk"` to store site quirks:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{ "tool": "get", "origin": "https://github.com" }
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"origin": "https://github.com",
|
|
114
|
+
"action": "learn",
|
|
115
|
+
"name": "login_flow",
|
|
116
|
+
"steps": [
|
|
117
|
+
{ "tool": "browser_click", "target": ".btn-login" },
|
|
118
|
+
{ "tool": "browser_fill", "target": "#login_field", "value": "{{username}}" }
|
|
119
|
+
],
|
|
120
|
+
"success_indicator": "a[aria-label='Homepage']"
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## SDK Plugin Integration (`ctx.memory`)
|
|
127
|
+
|
|
128
|
+
Plugin authors can interact with persistent site memory directly via the SDK:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import { definePlugin } from "@weavetab/sdk";
|
|
132
|
+
|
|
133
|
+
export default definePlugin({
|
|
134
|
+
name: "custom-site-automator",
|
|
135
|
+
async onLoad(ctx) {
|
|
136
|
+
// Read current profile
|
|
137
|
+
const profile = await ctx.memory?.getSiteProfile("https://github.com");
|
|
138
|
+
|
|
139
|
+
// Check reliability
|
|
140
|
+
const reliability = await ctx.memory?.getReliability("https://github.com", "login_flow");
|
|
141
|
+
if (reliability && reliability >= 0.8) {
|
|
142
|
+
ctx.logger.info("Fast-path ready for login_flow");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Teach a new pattern
|
|
146
|
+
await ctx.memory?.learnPattern("https://github.com", "quick_search", {
|
|
147
|
+
steps: [{ tool: "browser_fill", target: "input.header-search-input", value: "test" }]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
```
|