@weavetab/skills 1.0.3 → 2.5.0-beta.5
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/README.md +108 -60
- package/ROUTER.md +43 -0
- package/bin/cli.js +232 -132
- package/browser/dom-strategy.md +119 -0
- package/browser/form-automation.md +87 -0
- package/browser/interaction-pipeline.md +216 -0
- package/browser/tab-and-window.md +136 -0
- package/desktop/desktop-targeting.md +85 -0
- package/desktop/electron-discovery.md +115 -0
- package/developer/github-forensics.md +74 -0
- package/dist/bundled/weavetab-all.md +1910 -0
- package/dist/bundled/weavetab-browser.md +501 -0
- package/dist/bundled/weavetab-desktop.md +176 -0
- package/dist/bundled/weavetab-developer.md +67 -0
- package/dist/bundled/weavetab-documents.md +142 -0
- package/dist/bundled/weavetab-memory.md +359 -0
- package/dist/bundled/weavetab-network-and-perf.md +223 -0
- package/dist/bundled/weavetab-plugins.md +83 -0
- package/dist/bundled/weavetab-resilience.md +216 -0
- package/dist/bundled/weavetab-security.md +87 -0
- package/dist/granular/browser_dom-strategy.md +119 -0
- package/dist/granular/browser_form-automation.md +87 -0
- package/dist/granular/browser_interaction-pipeline.md +216 -0
- package/dist/granular/browser_tab-and-window.md +136 -0
- package/dist/granular/desktop_desktop-targeting.md +85 -0
- package/dist/granular/desktop_electron-discovery.md +115 -0
- package/dist/granular/developer_github-forensics.md +74 -0
- package/dist/granular/documents_canvas-and-visual-capture.md +103 -0
- package/dist/granular/documents_office-document-ingestion.md +63 -0
- package/dist/granular/memory_selector-memory-system.md +127 -0
- package/dist/granular/memory_session-trail.md +95 -0
- package/dist/granular/memory_site-learning.md +180 -0
- package/dist/granular/network-and-perf_device-and-environment.md +87 -0
- package/dist/granular/network-and-perf_network-intercept-and-mock.md +84 -0
- package/dist/granular/network-and-perf_performance-and-vitals.md +84 -0
- package/dist/granular/plugins_hooks-and-overrides.md +35 -0
- package/dist/granular/plugins_plugin-runtime.md +63 -0
- package/dist/granular/resilience_loop-breaker.md +67 -0
- package/dist/granular/resilience_session-time-travel.md +131 -0
- package/dist/granular/resilience_stale-ref-recovery.md +53 -0
- package/dist/granular/security_rbac-and-policies.md +47 -0
- package/dist/granular/security_secret-containment-protocol.md +59 -0
- package/documents/canvas-and-visual-capture.md +103 -0
- package/documents/office-document-ingestion.md +63 -0
- package/evals/evaluator.js +146 -0
- package/evals/scenarios.json +239 -0
- package/memory/selector-memory-system.md +127 -0
- package/memory/session-trail.md +95 -0
- package/memory/site-learning.md +180 -0
- package/network-and-perf/device-and-environment.md +87 -0
- package/network-and-perf/network-intercept-and-mock.md +84 -0
- package/network-and-perf/performance-and-vitals.md +84 -0
- package/package.json +31 -9
- package/plugins/hooks-and-overrides.md +35 -0
- package/plugins/plugin-runtime.md +63 -0
- package/resilience/loop-breaker.md +67 -0
- package/resilience/session-time-travel.md +131 -0
- package/resilience/stale-ref-recovery.md +53 -0
- package/security/rbac-and-policies.md +47 -0
- package/security/secret-containment-protocol.md +59 -0
- package/skills.json +321 -203
- package/src/api.js +239 -128
- package/advanced/README.md +0 -2
- package/automation/README.md +0 -2
- package/general/captcha-evasion.md +0 -13
- package/general/context-awareness.md +0 -13
- package/general/cookie-consent.md +0 -13
- package/general/data-extraction.md +0 -13
- package/general/dynamic-interaction.md +0 -13
- package/general/error-recovery.md +0 -13
- package/general/file-upload.md +0 -13
- package/general/form-filling.md +0 -16
- package/general/guardrails.md +0 -13
- package/general/iframe-handling.md +0 -13
- package/general/infinite-scroll.md +0 -13
- package/general/login-flow.md +0 -16
- package/general/multi-tab-management.md +0 -13
- package/general/spa-navigation.md +0 -13
- package/general/table-scraping.md +0 -13
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: session-time-travel
|
|
3
|
+
domain: resilience
|
|
4
|
+
triggers:
|
|
5
|
+
- "time travel"
|
|
6
|
+
- "browser checkpoint"
|
|
7
|
+
- "rollback session"
|
|
8
|
+
- "save state"
|
|
9
|
+
- "restore cookies"
|
|
10
|
+
tools:
|
|
11
|
+
- "browser_checkpoint"
|
|
12
|
+
- "browser_cookies"
|
|
13
|
+
- "browser_storage"
|
|
14
|
+
weavetab: ">=2.5.0-beta.5"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Session Time-Travel & Instant State Rollback
|
|
18
|
+
|
|
19
|
+
In complex multi-step workflows (e.g. checkout funnels, multi-page configuration wizards, onboarding questionnaires), an error at Step 7 traditionally forces an agent to reload the root URL, re-authenticate, and waste 10+ turns repeating steps.
|
|
20
|
+
|
|
21
|
+
`browser_checkpoint` enables instantaneous time-travel by snapshotting and restoring complete browser session state.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 1. What a Checkpoint Captures
|
|
26
|
+
|
|
27
|
+
A single named checkpoint atomically preserves:
|
|
28
|
+
- **Cookies**: Full domain cookies including `HttpOnly`, `Secure`, and `SameSite` flags.
|
|
29
|
+
- **Web Storage**: Entire `localStorage` and `sessionStorage` key-value maps.
|
|
30
|
+
- **Navigation State**: Exact page URL, scroll positions (`x`, `y`), and page title.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 2. Checkpoint Operations
|
|
35
|
+
|
|
36
|
+
### A. Saving a Checkpoint (`save`)
|
|
37
|
+
Create a checkpoint right before undertaking risky, branching, or destructive actions:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"action": "save",
|
|
42
|
+
"name": "pre_checkout_authenticated"
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### B. Restoring a Checkpoint (`restore`)
|
|
47
|
+
If a downstream step errors out, times out, or hits an invalid state, roll back immediately:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"action": "restore",
|
|
52
|
+
"name": "pre_checkout_authenticated"
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
*Latency: ~15ms*. The page navigates back to the checkpoint URL with cookies and storage atomically injected.
|
|
56
|
+
|
|
57
|
+
### C. Listing Checkpoints (`list`)
|
|
58
|
+
Inspect all active checkpoints for the current page target:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"action": "list"
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### D. Cleaning Up (`delete`)
|
|
67
|
+
Free memory once a workflow has concluded:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"action": "delete",
|
|
72
|
+
"name": "pre_checkout_authenticated"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 3. High-Leverage Agent Pattern
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
1. Authenticate to Target Portal
|
|
82
|
+
2. browser_checkpoint({ action: "save", name: "auth_ready" })
|
|
83
|
+
3. Attempt automated action sequence (e.g. form filling or testing)
|
|
84
|
+
4. IF error occurs:
|
|
85
|
+
browser_checkpoint({ action: "restore", name: "auth_ready" })
|
|
86
|
+
-> Agent is immediately back at authenticated state without re-login!
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 4. Fine-Grained Cookie Management (`browser_cookies`)
|
|
92
|
+
|
|
93
|
+
Inspect, set, or delete individual browser session cookies without restoring an entire checkpoint:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"action": "get",
|
|
98
|
+
"urls": ["https://example.com"]
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or inject an authentication cookie:
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"action": "set",
|
|
106
|
+
"cookies": [
|
|
107
|
+
{
|
|
108
|
+
"name": "session_token",
|
|
109
|
+
"value": "xyz123",
|
|
110
|
+
"domain": "example.com",
|
|
111
|
+
"httpOnly": true,
|
|
112
|
+
"secure": true
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 5. Web Storage Inspection & Injection (`browser_storage`)
|
|
121
|
+
|
|
122
|
+
Query or clear `localStorage` and `sessionStorage` keys:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"storageType": "localStorage",
|
|
127
|
+
"action": "get",
|
|
128
|
+
"key": "authToken"
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: stale-ref-recovery
|
|
3
|
+
domain: resilience
|
|
4
|
+
triggers:
|
|
5
|
+
- "stale element reference"
|
|
6
|
+
- "detached from dom"
|
|
7
|
+
- "spa re-render"
|
|
8
|
+
- "react hydration"
|
|
9
|
+
- "element not found"
|
|
10
|
+
tools:
|
|
11
|
+
- "browser_find"
|
|
12
|
+
- "browser_map"
|
|
13
|
+
- "browser_click"
|
|
14
|
+
weavetab: ">=2.5.0-beta.5"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Stale Ref Recovery & SPA Hydration Resilience
|
|
18
|
+
|
|
19
|
+
In modern Single Page Applications (built with React, Next.js, Vue, Nuxt, Svelte), DOM nodes are frequently destroyed and recreated during client-side hydration or reactive state updates. This often causes `STALE_ELEMENT_REFERENCE` or `NODE_DETACHED` errors when an agent attempts an action.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 1. The 4-Tier Auto-Recovery Chain
|
|
24
|
+
|
|
25
|
+
When a tool receives a stale or missing `ref`, Weavetab does not immediately fail. It activates an internal 4-tier recovery chain:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
[Action on w:14 Fails / Stale]
|
|
29
|
+
│
|
|
30
|
+
▼
|
|
31
|
+
[Tier 1: Stored Selector] ──▶ Re-queries cached stable selector (data-testid, id)
|
|
32
|
+
│ (if not found)
|
|
33
|
+
▼
|
|
34
|
+
[Tier 2: Exact Label Match] ──▶ Queries element with identical visible text & tag
|
|
35
|
+
│ (if not found)
|
|
36
|
+
▼
|
|
37
|
+
[Tier 3: Semantic Role Match] ──▶ Queries nearest sibling with matching ARIA role
|
|
38
|
+
│ (if not found)
|
|
39
|
+
▼
|
|
40
|
+
[Tier 4: Fuzzy Match] ──▶ Re-anchors to highest-confidence visual candidate
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If the recovery chain succeeds, the action executes seamlessly and the return payload notifies the agent that the handle was refreshed.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 2. Agent Reactive Behavior
|
|
48
|
+
|
|
49
|
+
If an action returns `ERROR: STALE_ELEMENT_REFERENCE` because all 4 recovery tiers were exhausted:
|
|
50
|
+
|
|
51
|
+
1. **Do NOT Repeat the Identical Call**: Retrying the exact same stale `ref` (`w:14`) will fail again.
|
|
52
|
+
2. **Execute a Fast Targeted Lookup**: Run `browser_find` with the text of the button or input field.
|
|
53
|
+
3. **Execute the Action on the New Handle**: Use the updated handle returned by `browser_find`.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: rbac-and-policies
|
|
3
|
+
domain: security
|
|
4
|
+
triggers:
|
|
5
|
+
- "rbac"
|
|
6
|
+
- "security policy"
|
|
7
|
+
- "role boundaries"
|
|
8
|
+
- "viewer agent"
|
|
9
|
+
- "permission denied"
|
|
10
|
+
tools:
|
|
11
|
+
- "browser_inspect"
|
|
12
|
+
- "browser_scrape"
|
|
13
|
+
- "browser_map"
|
|
14
|
+
weavetab: ">=2.5.0-beta.5"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Role-Based Access Control (RBAC) & Agent Guardrails
|
|
18
|
+
|
|
19
|
+
Weavetab allows developers to run untrusted or lower-privilege subagents within strict security boundaries to prevent accidental destructive operations or data leaks.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 1. The 4 Security Tiers
|
|
24
|
+
|
|
25
|
+
| Tier | Name | Allowed Tools & Capabilities | Intended Role |
|
|
26
|
+
| :--- | :--- | :--- | :--- |
|
|
27
|
+
| **0** | `admin` | Full tool access (all 48 tools), plugin loading, arbitrary script eval, cookies/storage write. | Primary Operator / Lead Agent. |
|
|
28
|
+
| **1** | `operator` | Interactive tools (`browser_click`, `browser_fill`, `browser_upload`), but blocked from loading untrusted plugins. | Standard Automation Agent. |
|
|
29
|
+
| **2** | `automation` | Pre-approved deterministic macros (`browser_automation`), scoped form filling, no arbitrary script execution. | Background Cron / Worker. |
|
|
30
|
+
| **3** | `viewer` | Read-only inspection tools (`browser_map`, `browser_find`, `browser_scrape`, `browser_inspect`). All click, type, and storage tools are rejected with `PERMISSION_DENIED`. | Research Subagents / Scrapers. |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 2. Handling `PERMISSION_DENIED` Errors
|
|
35
|
+
|
|
36
|
+
If an agent attempts an action outside its allocated role tier:
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"error_code": "PERMISSION_DENIED",
|
|
40
|
+
"message": "Tool 'browser_click' is disabled under role 'viewer'. Only read operations are permitted."
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Protocol:
|
|
45
|
+
1. Do not retry the denied tool.
|
|
46
|
+
2. Delegate the interactive action to the parent agent or primary operator.
|
|
47
|
+
3. Limit your output to findings gathered via read-only tools (`browser_scrape`, `browser_map`, `browser_inspect`).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: secret-containment-protocol
|
|
3
|
+
domain: security
|
|
4
|
+
triggers:
|
|
5
|
+
- "enter password"
|
|
6
|
+
- "input credentials"
|
|
7
|
+
- "api key entry"
|
|
8
|
+
- "sensitive token"
|
|
9
|
+
- "secret containment"
|
|
10
|
+
tools:
|
|
11
|
+
- "browser_type_secret"
|
|
12
|
+
weavetab: ">=2.5.0-beta.5"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Secret Containment Protocol & Zero-Bleed Execution
|
|
16
|
+
|
|
17
|
+
AI agent transcripts, LLM providers, and tool logs represent massive attack surfaces for credential leaks. Weavetab enforces a hardware-grade **Zero-Bleed Security Guarantee** for sensitive inputs.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 1. Entering Credentials with `browser_type_secret`
|
|
22
|
+
|
|
23
|
+
Whenever an agent inputs passwords, two-factor backup codes, credit card numbers, or proprietary API keys, you MUST use `browser_type_secret`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"ref": "w:12",
|
|
28
|
+
"secret": "MySuperSecretPassword!2026",
|
|
29
|
+
"clear": true
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 2. The Zero-Bleed Guarantee Architecture
|
|
36
|
+
|
|
37
|
+
When `browser_type_secret` is invoked:
|
|
38
|
+
1. **CDP Interception**: The secret is typed via masked CDP synthetic key events.
|
|
39
|
+
2. **HUD Redaction**: The browser Heads-Up Display (HUD) and visual overlay strictly renders bullets (`••••••••`).
|
|
40
|
+
3. **Log Sanitization**: Console logs, MCP server logs, and JSON return values strip the secret string and return:
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"success": true,
|
|
44
|
+
"message": "Secret typed successfully into ref 'w:12' (length: 26). Value redacted."
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
4. **No Re-Emission**: Never print or echo raw credentials into subsequent model thoughts or conversation messages.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 3. Strict Operating Prohibition
|
|
52
|
+
|
|
53
|
+
> [!CAUTION]
|
|
54
|
+
> Under NO circumstances should an agent pass passwords or credentials to:
|
|
55
|
+
> - `browser_type`
|
|
56
|
+
> - `browser_fill`
|
|
57
|
+
> - `browser_eval`
|
|
58
|
+
>
|
|
59
|
+
> Doing so causes plaintext secrets to enter unmasked transcripts and tool logs.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: canvas-and-visual-capture
|
|
3
|
+
domain: documents
|
|
4
|
+
triggers:
|
|
5
|
+
- "take screenshot"
|
|
6
|
+
- "capture viewport"
|
|
7
|
+
- "export pdf"
|
|
8
|
+
- "canvas inspection"
|
|
9
|
+
- "extract design tokens"
|
|
10
|
+
tools:
|
|
11
|
+
- "browser_screenshot"
|
|
12
|
+
- "browser_viewport"
|
|
13
|
+
- "browser_canvas"
|
|
14
|
+
- "browser_pdf"
|
|
15
|
+
- "browser_extract_design"
|
|
16
|
+
- "browser_map"
|
|
17
|
+
- "browser_click"
|
|
18
|
+
weavetab: ">=2.5.0-beta.5"
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Visual Capture, Canvas Forensics & Design Extraction
|
|
22
|
+
|
|
23
|
+
Beyond textual DOM manipulation, modern web applications contain dynamic HTML5 canvas renderings (charts, maps, WebGL games), and agents often need high-fidelity visual artifacts.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 1. Targeted Screenshots (`browser_screenshot`)
|
|
28
|
+
|
|
29
|
+
Capture full page layouts, the visible viewport, or specific element bounding boxes:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"fullPage": true,
|
|
34
|
+
"format": "png"
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or target a specific element ref:
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"ref": "w:55",
|
|
42
|
+
"format": "jpeg",
|
|
43
|
+
"quality": 80
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 2. PDF Document Generation (`browser_pdf`)
|
|
50
|
+
|
|
51
|
+
Render the current page into a print-ready PDF document with print CSS styles applied:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"landscape": false,
|
|
56
|
+
"printBackground": true,
|
|
57
|
+
"paperWidth": 8.5,
|
|
58
|
+
"paperHeight": 11
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 3. HTML5 Canvas Pixel Inspection & Visual Grounding (`browser_canvas` & `browser_map`)
|
|
65
|
+
|
|
66
|
+
When a chart or graphic is rendered via `<canvas>`, standard DOM reading tools cannot see individual buttons or nodes. You have two strategies:
|
|
67
|
+
|
|
68
|
+
### A. Set-of-Marks Visual Grounding (Recommended for Canvas UIs & WebGL)
|
|
69
|
+
Run `browser_map({ visual: "auto" })`. It detects canvas elements and high-contrast regions, attaches numbered badges `[1]…[N]`, and returns an annotated image:
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"visual": "auto"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
Then interact directly by mark number without guessing pixel coordinates:
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"mark": 3
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### B. Direct Canvas Pixel Export (`browser_canvas`)
|
|
83
|
+
To extract the raw image data or draw programmatic gesture paths:
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"ref": "w:19",
|
|
87
|
+
"action": "toDataURL"
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 4. Design System Extraction (`browser_extract_design`)
|
|
94
|
+
|
|
95
|
+
Reverse-engineer UI stylesheets, active CSS custom properties (variables), typography scales, and color palettes:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"selector": ".antigravity-hud-panel"
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Returns structured JSON representing colors, font families, shadows, and spacing tokens.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: office-document-ingestion
|
|
3
|
+
domain: documents
|
|
4
|
+
triggers:
|
|
5
|
+
- "read excel"
|
|
6
|
+
- "read docx"
|
|
7
|
+
- "parse csv"
|
|
8
|
+
- "spreadsheet"
|
|
9
|
+
- "word document"
|
|
10
|
+
- "parse table"
|
|
11
|
+
tools:
|
|
12
|
+
- "browser_office"
|
|
13
|
+
weavetab: ">=2.5.0-beta.5"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Office Document Ingestion: Word, Excel & CSV Parsing
|
|
17
|
+
|
|
18
|
+
Agents frequently need to parse structured spreadsheets or corporate documents downloaded during automation runs. `browser_office` parses `.docx`, `.xlsx`, `.xls`, and `.csv` files directly into clean JSON structures.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 1. Parsing Spreadsheets (`.xlsx`, `.csv`)
|
|
23
|
+
|
|
24
|
+
Stream structured sheet data, headers, and cell values:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"filePath": "C:/Users/fy2ne/Downloads/quarterly_revenue.xlsx",
|
|
29
|
+
"sheet": "Q3_Summary",
|
|
30
|
+
"headerRow": 1,
|
|
31
|
+
"maxRows": 100
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Response Example:
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"fileType": "xlsx",
|
|
39
|
+
"sheets": ["Q1", "Q2", "Q3_Summary"],
|
|
40
|
+
"rowCount": 45,
|
|
41
|
+
"data": [
|
|
42
|
+
{ "Department": "Engineering", "Budget": 1250000, "Actual": 1180000 },
|
|
43
|
+
{ "Department": "Marketing", "Budget": 600000, "Actual": 620000 }
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 2. Ingesting Word Documents (`.docx`)
|
|
51
|
+
|
|
52
|
+
Extract semantic paragraphs, document headings, tables, and lists:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"filePath": "C:/Users/fy2ne/Documents/service_agreement.docx",
|
|
57
|
+
"extractTables": true
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Operational Advantages:
|
|
62
|
+
- Eliminates the need for heavy external Python libraries or microservices.
|
|
63
|
+
- Safely sanitizes binary formats before passing content into LLM context.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const packageRoot = path.join(__dirname, '..');
|
|
5
|
+
const scenariosPath = path.join(packageRoot, 'evals', 'scenarios.json');
|
|
6
|
+
const skillsJsonPath = path.join(packageRoot, 'skills.json');
|
|
7
|
+
|
|
8
|
+
const OFFICIAL_TOOLS = new Set([
|
|
9
|
+
"browser_map", "browser_navigate", "browser_click", "browser_type",
|
|
10
|
+
"browser_type_secret", "browser_key", "browser_scroll", "browser_dialog",
|
|
11
|
+
"browser_burst", "browser_tabs", "browser_wait", "browser_captcha",
|
|
12
|
+
"browser_thoughts", "browser_pointer", "browser_select", "browser_fill",
|
|
13
|
+
"browser_highlight", "browser_upload", "browser_find", "browser_storage",
|
|
14
|
+
"browser_network_intercept", "browser_console", "browser_pdf", "browser_eval",
|
|
15
|
+
"browser_cookies", "browser_canvas", "browser_scrape", "browser_snapshot",
|
|
16
|
+
"browser_screenshot", "browser_viewport", "browser_clipboard", "browser_inspect",
|
|
17
|
+
"browser_extract_design", "browser_automation", "browser_recording",
|
|
18
|
+
"browser_detect", "browser_performance",
|
|
19
|
+
"browser_github", "browser_office", "browser_emulate",
|
|
20
|
+
"browser_checkpoint", "browser_pattern_learn"
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
const BANNED_TOOLS = [
|
|
24
|
+
"browser_evaluate", "browser_ask", "scrape_page", "click_element", "fill_field"
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
console.log("====================================================");
|
|
28
|
+
console.log("Weavetab Agent Skills Evaluation Harness (evals/)");
|
|
29
|
+
console.log("====================================================");
|
|
30
|
+
|
|
31
|
+
if (!fs.existsSync(scenariosPath)) {
|
|
32
|
+
console.error("Missing evals/scenarios.json");
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!fs.existsSync(skillsJsonPath)) {
|
|
37
|
+
console.error("Missing skills.json. Run 'npm run build' first.");
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const scenariosData = JSON.parse(fs.readFileSync(scenariosPath, 'utf8'));
|
|
42
|
+
const skillsData = JSON.parse(fs.readFileSync(skillsJsonPath, 'utf8'));
|
|
43
|
+
|
|
44
|
+
let passed = 0;
|
|
45
|
+
let failed = 0;
|
|
46
|
+
const errors = [];
|
|
47
|
+
|
|
48
|
+
console.log(`Running evaluation on ${scenariosData.scenarios.length} scenarios...\n`);
|
|
49
|
+
|
|
50
|
+
for (const scenario of scenariosData.scenarios) {
|
|
51
|
+
process.stdout.write(` [TEST] ${scenario.id.padEnd(35)} `);
|
|
52
|
+
|
|
53
|
+
const guidePath = path.join(packageRoot, scenario.expectedDomain, scenario.expectedGuide);
|
|
54
|
+
if (!fs.existsSync(guidePath)) {
|
|
55
|
+
console.log("❌ FAIL: Guide file missing");
|
|
56
|
+
errors.push(`Scenario '${scenario.id}': Expected guide not found at ${guidePath}`);
|
|
57
|
+
failed++;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const guideContent = fs.readFileSync(guidePath, 'utf8');
|
|
62
|
+
|
|
63
|
+
// 1. Verify expected tools are documented
|
|
64
|
+
let toolsMissing = [];
|
|
65
|
+
for (const tool of scenario.expectedTools) {
|
|
66
|
+
if (!guideContent.includes(tool)) {
|
|
67
|
+
toolsMissing.push(tool);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (toolsMissing.length > 0) {
|
|
72
|
+
console.log(`❌ FAIL: Missing tools (${toolsMissing.join(', ')})`);
|
|
73
|
+
errors.push(`Scenario '${scenario.id}': Guide ${scenario.expectedGuide} does not document required tools: ${toolsMissing.join(', ')}`);
|
|
74
|
+
failed++;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 2. Verify no banned tools in guide
|
|
79
|
+
let bannedFound = [];
|
|
80
|
+
for (const banned of scenario.bannedTools || BANNED_TOOLS) {
|
|
81
|
+
if (guideContent.includes(`\`${banned}\``) || guideContent.includes(`"${banned}"`)) {
|
|
82
|
+
bannedFound.push(banned);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (bannedFound.length > 0) {
|
|
87
|
+
console.log(`❌ FAIL: Contains banned tools (${bannedFound.join(', ')})`);
|
|
88
|
+
errors.push(`Scenario '${scenario.id}': Guide ${scenario.expectedGuide} references banned tools: ${bannedFound.join(', ')}`);
|
|
89
|
+
failed++;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
console.log("✔ PASS");
|
|
94
|
+
passed++;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Global Check: Verify all 48 tools appear across the entire skill base
|
|
98
|
+
console.log("\n----------------------------------------------------");
|
|
99
|
+
console.log("Auditing Global Tool Coverage Across All 9 Domains...");
|
|
100
|
+
const coveredTools = new Set();
|
|
101
|
+
for (const skill of skillsData.skills) {
|
|
102
|
+
for (const t of skill.tools) {
|
|
103
|
+
coveredTools.add(t);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Also scan markdown files for tools covered in text
|
|
108
|
+
for (const domain of skillsData.domains) {
|
|
109
|
+
const dPath = path.join(packageRoot, domain);
|
|
110
|
+
if (!fs.existsSync(dPath)) continue;
|
|
111
|
+
for (const f of fs.readdirSync(dPath).filter(x => x.endsWith('.md'))) {
|
|
112
|
+
const content = fs.readFileSync(path.join(dPath, f), 'utf8');
|
|
113
|
+
for (const tool of OFFICIAL_TOOLS) {
|
|
114
|
+
if (content.includes(tool)) {
|
|
115
|
+
coveredTools.add(tool);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let uncoveredTools = [];
|
|
122
|
+
for (const tool of OFFICIAL_TOOLS) {
|
|
123
|
+
if (!coveredTools.has(tool)) {
|
|
124
|
+
uncoveredTools.push(tool);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
console.log(`Official Tools In MCP: ${OFFICIAL_TOOLS.size}`);
|
|
129
|
+
console.log(`Covered in Skills: ${coveredTools.size}`);
|
|
130
|
+
|
|
131
|
+
if (uncoveredTools.length > 0) {
|
|
132
|
+
console.warn(`⚠️ Warning: Uncovered tools in skills: ${uncoveredTools.join(', ')}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
console.log("====================================================");
|
|
136
|
+
console.log(`Test Summary: ${passed} Passed, ${failed} Failed`);
|
|
137
|
+
console.log("====================================================");
|
|
138
|
+
|
|
139
|
+
if (failed > 0) {
|
|
140
|
+
console.error("\nFailure details:");
|
|
141
|
+
errors.forEach(err => console.error(` - ${err}`));
|
|
142
|
+
process.exit(1);
|
|
143
|
+
} else {
|
|
144
|
+
console.log("\nAll benchmark evaluation tests passed successfully.");
|
|
145
|
+
process.exit(0);
|
|
146
|
+
}
|