@weavetab/mcp 2.5.0-beta.1 → 2.5.0-beta.4

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 (156) hide show
  1. package/AGENTS.md +2 -1
  2. package/ARCHITECTURE.md +6 -6
  3. package/LICENSE +1 -1
  4. package/README.md +164 -802
  5. package/SECURITY.md +33 -22
  6. package/TROUBLESHOOTING.md +3 -3
  7. package/dist/cdp/bridge.d.ts +10 -0
  8. package/dist/cdp/bridge.js +285 -78
  9. package/dist/cdp/connector.d.ts +7 -3
  10. package/dist/cdp/connector.js +196 -75
  11. package/dist/cdp/helpers.d.ts +4 -0
  12. package/dist/cdp/helpers.js +181 -0
  13. package/dist/cdp/lock.d.ts +9 -6
  14. package/dist/cdp/lock.js +72 -59
  15. package/dist/cdp/omni_broker.d.ts +2 -1
  16. package/dist/cdp/omni_broker.js +13 -7
  17. package/dist/cdp/profiles.d.ts +10 -0
  18. package/dist/cdp/profiles.js +65 -0
  19. package/dist/cdp/walker.d.ts +25 -1
  20. package/dist/cdp/walker.js +354 -7
  21. package/dist/cli/plugin.d.ts +0 -2
  22. package/dist/cli/plugin.js +51 -696
  23. package/dist/cli/updater.d.ts +1 -1
  24. package/dist/cli/updater.js +27 -7
  25. package/dist/config/loader.d.ts +33 -6
  26. package/dist/config/loader.js +174 -22
  27. package/dist/desktop/discovery.d.ts +44 -0
  28. package/dist/desktop/discovery.js +364 -0
  29. package/dist/index.js +140 -64
  30. package/dist/intelligence/marks.d.ts +36 -0
  31. package/dist/intelligence/marks.js +30 -0
  32. package/dist/intelligence/patternCompiler.d.ts +118 -0
  33. package/dist/intelligence/patternCompiler.js +259 -0
  34. package/dist/intelligence/sessionMemory.d.ts +2 -0
  35. package/dist/intelligence/sessionMemory.js +18 -8
  36. package/dist/overlay/ghost.js +2 -2
  37. package/dist/overlay/injector.js +3 -5
  38. package/dist/plugin/extension_bridge.d.ts +40 -0
  39. package/dist/plugin/extension_bridge.js +158 -0
  40. package/dist/plugin/interface.d.ts +151 -15
  41. package/dist/plugin/loader.d.ts +19 -1
  42. package/dist/plugin/loader.js +331 -63
  43. package/dist/plugin/pipeline.d.ts +75 -0
  44. package/dist/plugin/pipeline.js +183 -0
  45. package/dist/plugin/registry.js +12 -1
  46. package/dist/plugin/storage.d.ts +51 -0
  47. package/dist/plugin/storage.js +164 -0
  48. package/dist/security/secrets.d.ts +1 -0
  49. package/dist/security/secrets.js +13 -0
  50. package/dist/sensors/actionability.js +1 -2
  51. package/dist/sensors/guard.js +4 -10
  52. package/dist/sensors/mutations.js +12 -0
  53. package/dist/sensors/operation_monitor.js +1 -0
  54. package/dist/server.d.ts +1 -1
  55. package/dist/server.js +600 -236
  56. package/dist/state/agent.d.ts +1 -0
  57. package/dist/state/agent.js +3 -0
  58. package/dist/state/delta.d.ts +12 -4
  59. package/dist/state/delta.js +67 -14
  60. package/dist/state/session.d.ts +8 -2
  61. package/dist/state/session.js +60 -13
  62. package/dist/tools/browser_detect.d.ts +16 -2
  63. package/dist/tools/browser_detect.js +54 -6
  64. package/dist/tools/burst.d.ts +17 -7
  65. package/dist/tools/burst.js +240 -83
  66. package/dist/tools/checkpoint.d.ts +38 -0
  67. package/dist/tools/checkpoint.js +271 -0
  68. package/dist/tools/click.d.ts +1 -0
  69. package/dist/tools/click.js +97 -98
  70. package/dist/tools/clipboard.js +31 -24
  71. package/dist/tools/design_extract.js +1 -1
  72. package/dist/tools/eval.js +1 -1
  73. package/dist/tools/fill.d.ts +20 -1
  74. package/dist/tools/fill.js +199 -40
  75. package/dist/tools/find.d.ts +16 -0
  76. package/dist/tools/find.js +67 -44
  77. package/dist/tools/github/index.d.ts +19 -4
  78. package/dist/tools/github/index.js +40 -4
  79. package/dist/tools/highlight.d.ts +6 -2
  80. package/dist/tools/highlight.js +158 -72
  81. package/dist/tools/inspect.js +1 -1
  82. package/dist/tools/key.js +65 -56
  83. package/dist/tools/navigate.d.ts +1 -1
  84. package/dist/tools/navigate.js +57 -44
  85. package/dist/tools/pdf.js +21 -13
  86. package/dist/tools/pointer.d.ts +18 -3
  87. package/dist/tools/pointer.js +89 -1
  88. package/dist/tools/read.d.ts +28 -8
  89. package/dist/tools/read.js +230 -56
  90. package/dist/tools/scrape.js +67 -13
  91. package/dist/tools/screenshot.js +21 -16
  92. package/dist/tools/scroll.js +6 -11
  93. package/dist/tools/select.js +8 -2
  94. package/dist/tools/snapshot.js +3 -34
  95. package/dist/tools/tabs.d.ts +10 -10
  96. package/dist/tools/tabs.js +55 -39
  97. package/dist/tools/thought.d.ts +2 -0
  98. package/dist/tools/thought.js +13 -14
  99. package/dist/tools/type.d.ts +2 -0
  100. package/dist/tools/type.js +109 -60
  101. package/dist/tools/type_secret.js +42 -76
  102. package/dist/tools/upload.js +1 -1
  103. package/dist/tools/video_compiler.d.ts +1 -1
  104. package/dist/tools/video_compiler.js +11 -12
  105. package/dist/version.d.ts +5 -0
  106. package/dist/version.js +5 -0
  107. package/docs/DOCUMENTATION.md +82 -36
  108. package/docs/PLUGINS.md +82 -499
  109. package/docs/TOOLS.md +51 -99
  110. package/docs/architecture/blind-injection.md +83 -0
  111. package/docs/architecture/dual-injection.md +32 -0
  112. package/docs/architecture/overview.md +49 -0
  113. package/docs/architecture/security.md +35 -0
  114. package/docs/architecture/transport.md +37 -0
  115. package/docs/captcha-stealth/captcha-solver.md +75 -0
  116. package/docs/captcha-stealth/stealth-physics.md +60 -0
  117. package/docs/cli/cli-commands.md +44 -0
  118. package/docs/cli/cli-flags.md +20 -0
  119. package/docs/cli/cli-introduction.md +20 -0
  120. package/docs/cli/cli-scripting.md +32 -0
  121. package/docs/cli/g-ide/ide-antigravity.md +24 -0
  122. package/docs/cli/g-ide/ide-claude-code.md +24 -0
  123. package/docs/cli/g-ide/ide-claude-desktop.md +32 -0
  124. package/docs/cli/g-ide/ide-cursor.md +31 -0
  125. package/docs/cli/g-ide/ide-generic.md +34 -0
  126. package/docs/cli/g-ide/ide-opencode.md +24 -0
  127. package/docs/cli/g-ide/ide-vscode-copilot.md +24 -0
  128. package/docs/cli/g-ide/ide-windsurf.md +24 -0
  129. package/docs/configuration/config-locations.md +24 -0
  130. package/docs/configuration/configuration.md +73 -0
  131. package/docs/configuration/env-variables.md +19 -0
  132. package/docs/configuration/folders.md +55 -0
  133. package/docs/desktop-automation/electron-apps.md +217 -0
  134. package/docs/get-started/installation.md +47 -0
  135. package/docs/get-started/introduction.md +60 -0
  136. package/docs/get-started/quickstart.md +54 -0
  137. package/docs/get-started/setup-wizard.md +26 -0
  138. package/docs/intelligence/site-profiles.md +151 -0
  139. package/docs/skills-ecosystem/skills-overview.md +35 -0
  140. package/docs/skills-ecosystem/skills-recipes.md +36 -0
  141. package/docs/tools/tools.md +631 -0
  142. package/docs/troubleshooting/trouble-browser.md +27 -0
  143. package/docs/troubleshooting/trouble-config.md +20 -0
  144. package/docs/troubleshooting/trouble-loop.md +31 -0
  145. package/ext-dist/background.js +10 -62
  146. package/ext-dist/content.js +333 -921
  147. package/ext-dist/hud/hud.js +9 -9
  148. package/ext-dist/manifest.json +2 -6
  149. package/ext-dist/styles.css +6 -1
  150. package/mcp.json +108 -72
  151. package/package.json +14 -9
  152. package/server.json +3 -3
  153. package/docs/DEV_MODE.md +0 -68
  154. package/docs/dev_plugin.md +0 -310
  155. package/ext-dist/sidepanel/sidepanel.js +0 -25
  156. package/ext-dist/sidepanel.html +0 -547
package/docs/PLUGINS.md CHANGED
@@ -1,538 +1,121 @@
1
- # Weavetab Plugin System Architecture & Developer Guide
1
+ # Weavetab Plugin System & SDK Specification
2
2
 
3
- The **Weavetab Plugin System** is an enterprise-grade extension platform designed for the Model Context Protocol (MCP). It allows developers and enterprises to seamlessly extend, customize, and harden Weavetab's browser automation runtime.
3
+ > **Version:** 2.5.0-beta.2 | **SDK:** @weavetab/sdk | **License:** AGPL-3.0-only
4
4
 
5
- Unlike rigid toolkits, Weavetab plugins can:
6
- 1. **Add New Tools**: Expose custom domain tools (e.g., Notion synchronization, Jira automation, SEO audits).
7
- 2. **Override & Wrap Built-in Tools**: Intercept and augment native Weavetab tools (e.g., `eval_plus` upgrading `browser_eval` with a sandboxed TypeScript engine and calling `originalHandler`).
8
- 3. **Remove & Disable Built-in Tools**: Enforce zero-trust enterprise lockdown by stripping dangerous or redundant tools (e.g., disabling `browser_inspect`, `browser_cookies`, or `browser_eval` in restricted production environments).
5
+ The **Weavetab Plugin System** allows developers to extend the MCP runtime with custom tools, visual HUD overlays, thought bubbles, lifecycle hooks, and tool overrides.
9
6
 
10
7
  ---
11
8
 
12
- ## 1. 3-Tier Security & Trust Hierarchy
9
+ ## 1. Quick Start
13
10
 
14
- Weavetab enforces a strict, defense-in-depth trust model across all installed plugins.
11
+ ### Scaffold a New Plugin
12
+ `ash
13
+ npx @weavetab/sdk init my-custom-plugin
14
+ cd my-custom-plugin
15
+ npm install
16
+ `
15
17
 
16
- ```mermaid
17
- flowchart TD
18
- subgraph Tiers ["Weavetab Trust Tiers"]
19
- direction TB
20
- T1[" ✚ Official Tier\n(@weavetab/plugin-*)"]
21
- T2[" ✔ Verified Community Tier\n(Listed in verified.json)"]
22
- T3[" ⚠ Unverified Community Tier\n(Arbitrary NPM packages)"]
23
- end
24
-
25
- T1 -->|Full Trust| R1["Instant Activation · Audited Code · Zero Warnings"]
26
- T2 -->|Vetted Trust| R2["Safe Installation · Verified by Weavetab Maintainers"]
27
- T3 -->|Zero Trust| R3["Security Warning Banner · Interactive Confirmation · Tool Audit"]
28
- ```
29
-
30
- | Trust Tier | Scope / Criteria | Security Status | CLI Badge |
31
- | :--- | :--- | :--- | :--- |
32
- | **Official** | Published under `@weavetab/plugin-*` | Built, maintained, and cryptographically verified by the Weavetab Core Team. | `✚ [Official]` |
33
- | **Verified Community** | Any NPM package listed in [`registry/verified.json`](file:///c:/Users/fy2ne/Music/Weavetab/registry/verified.json) | Community package reviewed and audited by Weavetab maintainers. | `✔ [Verified]` |
34
- | **Unverified Community** | Any arbitrary NPM package containing a `weavetab.json` manifest | Unvetted third-party package. Prompts the operator with an interactive security audit before installation. | `⚠ [Unverified]` |
35
-
36
- > [!IMPORTANT]
37
- > **Universal Package Naming**: Plugins are **not** restricted to `weavetab-plugin-*` naming. Any NPM package containing a valid `weavetab.json` manifest at its root is automatically recognized, parsed, and registered by Weavetab.
38
-
39
- ---
40
-
41
- ## 2. Candidate Disambiguation Engine
42
-
43
- When installing a plugin via short name (e.g., `wt plugin add n8n-wt`), Weavetab queries both official scoped shortcuts and community packages in parallel:
44
-
45
- * **Official Candidate**: `@weavetab/plugin-<name>` (First-party team package)
46
- * **Community Candidate**: `<name>` (Community NPM package)
47
-
48
- ```mermaid
49
- flowchart TD
50
- A["wt plugin add n8n-wt"] --> B{Explicit Scope (@...)?}
51
- B -->|Yes| C["Direct Installation"]
52
- B -->|No| D["Query Candidates in Parallel"]
53
-
54
- D --> E["1. @weavetab/plugin-n8n-wt (Official)"]
55
- D --> F["2. n8n-wt (Community Registry / NPM)"]
56
-
57
- E & F --> G{Both exist on NPM?}
58
-
59
- G -->|Yes| H["Interactive Disambiguation Prompt"]
60
- G -->|Only Official| I["Install @weavetab/plugin-n8n-wt"]
61
- G -->|Only Community| J["Install n8n-wt"]
62
-
63
- H -->|Selects Official| I
64
- H -->|Selects Community| J
65
- ```
66
-
67
- ### Disambiguation CLI Selector
68
- ```text
69
- ╭────────────────────────────────────────────────────────────────────────╮
70
- │ Multiple packages found for "n8n-wt". Which one do you want to install?│
71
- ╰────────────────────────────────────────────────────────────────────────╯
72
-
73
- ● @weavetab/plugin-n8n-wt [Official] (Made by the Weavetab team)
74
- ○ n8n-wt [Verified] (Community plugin in verified registry)
75
- ○ n8n-wt [Unverified] (Third-party community package on npm)
76
- ```
77
-
78
- > [!TIP]
79
- > **CI/CD Automation Flags**:
80
- > * `wt plugin add <name> --official` (or `-O`): Forces installation of `@weavetab/plugin-<name>`.
81
- > * `wt plugin add <name> --community` (or `-C`): Forces installation of community package `<name>`.
82
- > * `wt plugin add <name> --yes` (or `-y`): Bypasses interactive confirmation for unverified plugins in CI environments.
18
+ ### Build & Compile
19
+ `ash
20
+ npm run build
21
+ `
83
22
 
84
23
  ---
85
24
 
86
- ## 3. Tool Lifecycle & Capabilities
87
-
88
- Weavetab plugins provide full programmatic control over the MCP tool registry.
89
-
90
- ```mermaid
91
- flowchart LR
92
- P["Plugin Runtime"] --> A["1. Add New Tools\n(plugin.tools)"]
93
- P --> B["2. Override Tools\n(plugin.overrides)"]
94
- P --> C["3. Remove Tools\n(plugin.removeTools)"]
95
-
96
- A --> M["MCP Tool Registry"]
97
- B --> M
98
- C --> M
99
- ```
25
+ ## 2. Plugin Architecture
100
26
 
101
- ### A. Tool Additions (`tools`)
102
- Plugins can introduce brand new capabilities with full Zod schema validation:
103
-
104
- ```typescript
105
- import { z } from "zod";
106
- import type { WeavetabPlugin } from "./interface.js";
107
-
108
- const plugin: WeavetabPlugin = {
109
- name: "notion_sync",
110
- version: "1.0.0",
111
- tools: [
112
- {
113
- name: "notion_create_page",
114
- description: "Creates a new structured documentation page in Notion",
115
- schema: {
116
- title: z.string().describe("The title of the Notion page"),
117
- content: z.string().describe("Markdown content for the body"),
118
- },
119
- handler: async (args, session, config) => {
120
- // Full access to Chrome DevTools Protocol session and Weavetab config
121
- return { success: true, url: "https://notion.so/my-page" };
122
- },
123
- },
124
- ],
125
- };
126
- ```
27
+ Every Weavetab plugin exports a plugin definition created with definePlugin:
127
28
 
128
- ---
29
+ ` ypescript
30
+ // src/index.ts
31
+ import { definePlugin, type PluginContext } from @weavetab/sdk;
129
32
 
130
- ### B. Tool Overrides & Wrapping (`overrides`)
131
- A plugin can intercept, augment, or completely replace built-in tools. When overriding, the plugin receives an optional `originalHandler` function to chain or wrap the base tool execution:
33
+ export default definePlugin({
34
+ name: weavetab-plugin-sample,
35
+ version: 1.0.0,
36
+ description: Sample custom tool plugin for Weavetab,
132
37
 
133
- ```typescript
134
- import { z } from "zod";
135
- import type { WeavetabPlugin } from "./interface.js";
38
+ defaultConfig: {
39
+ enableHud: true,
40
+ },
136
41
 
137
- const evalPlusPlugin: WeavetabPlugin = {
138
- name: "eval_plus",
139
- version: "2.1.0",
140
- overrides: [
141
- {
142
- name: "browser_eval",
143
- description: "High-performance TypeScript & Sandboxed JavaScript runtime for browser evaluation",
42
+ async onLoad(ctx: PluginContext) {
43
+ // Register a custom MCP tool
44
+ ctx.mcp.registerTool({
45
+ name: custom_analyzer,
46
+ description: Performs custom DOM analysis,
144
47
  schema: {
145
- code: z.string().describe("TypeScript or JS code to evaluate"),
146
- sandbox: z.boolean().optional().describe("Execute in isolated sandbox"),
48
+ type: object,
49
+ properties: {
50
+ selector: { type: string, description: Target CSS selector }
51
+ },
52
+ required: [selector]
147
53
  },
148
- handler: async (args, session, config, originalHandler) => {
149
- // Pre-processing: transpile TypeScript to JavaScript
150
- const transpiledCode = transpileTypeScript(args.code);
151
-
152
- if (!args.sandbox && originalHandler) {
153
- // Pass execution down to Weavetab's native browser_eval handler
154
- return await originalHandler({ code: transpiledCode }, session, config);
54
+ handler: async (args: { selector: string }, session: any) => {
55
+ // Show thought bubble on browser tab
56
+ if (ctx.config.enableHud && session) {
57
+ await ctx.extension.showThought(session, Analyzing ...);
155
58
  }
156
59
 
157
- // Custom sandboxed execution via isolated CDP execution context
158
- const result = await runInIsolatedWorld(session, transpiledCode);
159
- return { success: true, sandboxed: true, result };
160
- },
161
- },
162
- ],
163
- };
164
- ```
165
-
166
- ---
167
-
168
- ### C. Tool Removals (`removeTools`)
169
- For enterprise compliance, zero-trust environments, or locked-down production agents, plugins can completely unregister built-in tools:
170
-
171
- ```typescript
172
- import type { WeavetabPlugin } from "./interface.js";
173
-
174
- const enterpriseLockdown: WeavetabPlugin = {
175
- name: "enterprise_security_lockdown",
176
- version: "1.0.0",
177
- removeTools: [
178
- "browser_eval", // Disable arbitrary script evaluation
179
- "browser_cookies", // Prevent cookie extraction
180
- "browser_storage", // Prevent storage inspection
181
- "browser_inspect", // Prevent raw source tree dumps
182
- ],
183
- };
184
- ```
185
-
186
- > [!CAUTION]
187
- > When a tool is removed by a plugin, it is permanently deleted from the MCP Server tool registry during that session. Any agent attempting to invoke a removed tool will receive a tool-not-found error.
188
-
189
- ---
190
-
191
- ## 4. Manifest Specification (`weavetab.json`)
192
-
193
- Every plugin package must include a `weavetab.json` file in its root directory. This manifest acts as the security contract for the plugin.
194
-
195
- ### Complete Manifest Schema
196
- ```json
197
- {
198
- "$schema": "https://weavetab.dev/schema/plugin.json",
199
- "name": "eval_plus",
200
- "version": "2.1.0",
201
- "description": "Enterprise TypeScript evaluation engine and runtime sandbox for Weavetab",
202
- "authors": [
203
- {
204
- "name": "Acme Security Labs",
205
- "role": "Lead Architect",
206
- "url": "https://github.com/acme"
207
- }
208
- ],
209
- "logo": "images/logo.svg",
210
- "banner": "images/banner.svg",
211
- "license": "MIT",
212
- "tags": ["Security", "Sandbox", "TypeScript", "MCP"],
213
- "compatibility": {
214
- "weavetab": "^2.5.0",
215
- "node": ">=18.0.0"
216
- },
217
- "tools": [
218
- {
219
- "name": "browser_eval_ts",
220
- "description": "Evaluates pure TypeScript files in browser context",
221
- "inputSchema": {
222
- "type": "object",
223
- "properties": {
224
- "code": {
225
- "type": "string",
226
- "description": "TypeScript code string to transpile and evaluate"
227
- }
228
- },
229
- "required": ["code"]
60
+ return {
61
+ content: [
62
+ { type: text, text: Analysis complete for }
63
+ ]
64
+ };
230
65
  }
231
- }
232
- ],
233
- "permissions": {
234
- "network": {
235
- "domains": ["*.acme.corp"],
236
- "reason": "Required to transpile TypeScript compiler modules on-demand"
237
- },
238
- "cdp": {
239
- "evaluate": true,
240
- "click": true,
241
- "reason": "Required to inject transpiled bytecode into isolated CDP contexts"
242
- },
243
- "fs": {
244
- "read": ["./types/*"],
245
- "reason": "Reads local TypeScript declaration definitions"
246
- }
247
- }
248
- }
249
- ```
250
-
251
- ### Manifest Fields Reference
252
-
253
- | Field | Type | Required | Description |
254
- | :--- | :--- | :--- | :--- |
255
- | `name` | `string` | **Yes** | Display or package name. |
256
- | `version` | `string` | **Yes** | Semantic version string (`1.0.0`). |
257
- | `description` | `string` | Recommended | Human-readable description of plugin capabilities. |
258
- | `authors` | `array` | **Yes** | Authors array with custom roles ($\ge 3$ chars) and optional GitHub/NPM profile URLs for auto avatar resolution. |
259
- | `logo` | `string` | Optional | Path to local logo asset (e.g. `images/logo.svg`). |
260
- | `banner` | `string` | Optional | Path to local banner asset (e.g. `images/banner.svg`). |
261
- | `compatibility` | `object` | Optional | Runtime version compatibility (`weavetab` and `node`). |
262
- | `tools` | `array` | Optional | List of exposed MCP tools registered by this plugin. |
263
- | `permissions` | `object` | Optional | Explicit security scopes and human-readable justification reasons. |
264
-
265
- > [!TIP]
266
- > For a full step-by-step tutorial on building plugins from scratch, see [Developer Plugin Guide](file:///c:/Users/fy2ne/Music/Weavetab/docs/dev_plugin.md).
267
-
268
- ---
269
-
270
- ## 5. CLI Plugin Command Suite
271
-
272
- Weavetab provides a dedicated CLI suite (`wt plugin`) for managing plugins, discovering packages, auditing security, and generating manifests.
273
-
274
- ### 1. `wt plugin add <package>`
275
- Installs a plugin into the local environment with automatic candidate resolution and trust auditing.
276
-
277
- ```bash
278
- # Install via short name (resolves official @weavetab/plugin-vision or vision)
279
- wt plugin add vision
280
-
281
- # Install explicit community package
282
- wt plugin add eval_plus
283
-
284
- # Non-interactive installation for CI/CD
285
- wt plugin add eval_plus --yes
286
- ```
287
-
288
- If an unverified package requests tool modifications, a security warning is displayed:
289
-
290
- ```text
291
- ╭───────────────────────────────────────────────────────────────────╮
292
- │ ⚠️ SECURITY WARNING: UNVERIFIED COMMUNITY PLUGIN │
293
- │ │
294
- │ Package "eval_plus" is NOT verified by Weavetab. │
295
- │ It is an unvetted third-party package and may potentially contain:│
296
- │ • Arbitrary code execution during installation or runtime │
297
- │ • CDP browser control (evaluating scripts, session access) │
298
- │ • Tool overrides / removals │
299
- │ │
300
- │ Install and run this plugin strictly at your own risk! │
301
- ╰───────────────────────────────────────────────────────────────────╯
302
- ```
303
-
304
- ---
305
-
306
- ### 2. `wt plugin browse`
307
- Opens an interactive, terminal-based marketplace explorer to discover official and verified community plugins with 1-click installation.
308
-
309
- ```bash
310
- wt plugin browse
311
- ```
312
-
313
- ---
314
-
315
- ### 3. `wt plugin search [query]`
316
- Live search across both the Weavetab Verified Registry and NPM for plugins matching the search query.
317
-
318
- ```bash
319
- wt plugin search accessibility
320
- ```
321
-
322
- ---
323
-
324
- ### 4. `wt plugin verify <package>`
325
- Audits the trust tier, verification status, and declared permissions of any package before installation.
326
-
327
- ```bash
328
- wt plugin verify @weavetab/plugin-n8n-wt
329
- wt plugin verify eval_plus
330
- ```
331
-
332
- ---
333
-
334
- ### 5. `wt plugin list`
335
- Lists all installed plugins in the active Weavetab environment, displaying versions, trust tiers, and exposed/overridden tools.
336
-
337
- ```bash
338
- wt plugin list
339
- ```
340
-
341
- ---
342
-
343
- ### 6. `wt plugin remove <package>`
344
- Uninstalls a plugin from `node_modules`.
345
-
346
- ```bash
347
- wt plugin remove eval_plus
348
- ```
349
-
350
- ---
351
-
352
- ### 7. `wt plugin init`
353
- Interactive CLI wizard that introspects your plugin source code and generates a standardized `weavetab.json` manifest.
354
-
355
- ```bash
356
- wt plugin init
357
- ```
66
+ });
67
+ },
358
68
 
359
- The wizard prompts for:
360
- 1. Plugin ID and package metadata
361
- 2. Network, CDP, and File System access requirements
362
- 3. Tool override and removal specifications
69
+ async onUnload(ctx: PluginContext) {
70
+ // Cleanup resources
71
+ }
72
+ });
73
+ `
363
74
 
364
75
  ---
365
76
 
366
- ## 6. Step-by-Step Plugin Authoring Guide
77
+ ## 3. Manifest Specification (weavetab.json)
367
78
 
368
- ### Step 1: Initialize Project
369
- ```bash
370
- mkdir wt-eval-plus
371
- cd wt-eval-plus
372
- npm init -y
373
- ```
79
+ Plugins require a weavetab.json manifest in their package root:
374
80
 
375
- ### Step 2: Configure `package.json`
376
- ```json
81
+ `json
377
82
  {
378
- "name": "eval_plus",
379
- "version": "1.0.0",
380
- "type": "module",
381
- "main": "dist/index.js",
382
- "scripts": {
383
- "build": "tsc"
384
- },
385
- "dependencies": {
386
- "zod": "^3.23.8"
387
- },
388
- "devDependencies": {
389
- "typescript": "^5.4.0",
390
- "@types/node": "^20.0.0"
391
- }
83
+ name: weavetab-plugin-sample,
84
+ version: 1.0.0,
85
+ entry: ./dist/index.js,
86
+ permissions: [storage, extension, cdp],
87
+ tools: [custom_analyzer]
392
88
  }
393
- ```
394
-
395
- ### Step 3: Implement Plugin Entry (`src/index.ts`)
396
- ```typescript
397
- import { z } from "zod";
398
-
399
- export default {
400
- name: "eval_plus",
401
- version: "1.0.0",
402
- description: "Enhanced evaluation with TypeScript and sandbox support",
403
-
404
- // 1. Tool Additions
405
- tools: [
406
- {
407
- name: "browser_eval_ts",
408
- description: "Compile and evaluate TypeScript code in page context",
409
- schema: {
410
- code: z.string().describe("TypeScript code string"),
411
- },
412
- handler: async (args, session, config) => {
413
- // Compile TypeScript to JS
414
- const js = compileTS(args.code);
415
- const { result } = await session.Runtime.evaluate({
416
- expression: js,
417
- returnByValue: true,
418
- });
419
- return { value: result.value };
420
- },
421
- },
422
- ],
89
+ `
423
90
 
424
- // 2. Tool Overrides (Wrapping built-in browser_eval)
425
- overrides: [
426
- {
427
- name: "browser_eval",
428
- description: "Enhanced browser_eval with pre-execution safety filters",
429
- schema: {
430
- expression: z.string().describe("JavaScript expression"),
431
- },
432
- handler: async (args, session, config, originalHandler) => {
433
- if (args.expression.includes("localStorage.clear()")) {
434
- throw new Error("[SECURITY] localStorage wiping blocked by eval_plus");
435
- }
436
- if (originalHandler) {
437
- return await originalHandler(args, session, config);
438
- }
439
- return { success: true };
440
- },
441
- },
442
- ],
443
-
444
- // 3. Tool Removals
445
- removeTools: ["browser_inspect"],
446
-
447
- // 4. Lifecycle Hooks
448
- onLoad: async () => {
449
- process.stderr.write("[eval_plus] Initialized sandbox engine successfully.\n");
450
- },
451
- onUnload: async () => {
452
- process.stderr.write("[eval_plus] Sandbox engine cleaned up.\n");
453
- },
454
- };
455
-
456
- function compileTS(tsCode: string): string {
457
- // Simple transpile logic or compiler integration
458
- return tsCode;
459
- }
460
- ```
461
-
462
- ### Step 4: Generate Manifest
463
- Run `npx weavetab init` or create `weavetab.json`:
464
- ```json
465
- {
466
- "$schema": "https://weavetab.dev/schema/plugin.json",
467
- "name": "eval_plus",
468
- "version": "1.0.0",
469
- "description": "Enhanced evaluation with TypeScript and sandbox support",
470
- "authors": [
471
- {
472
- "name": "Acme Security Labs",
473
- "role": "Lead Architect",
474
- "url": "https://github.com/acme"
475
- }
476
- ],
477
- "permissions": {
478
- "network": {
479
- "domains": ["*.acme.corp"],
480
- "reason": "Required to transpile TypeScript compiler modules on-demand"
481
- },
482
- "cdp": {
483
- "evaluate": true,
484
- "click": true,
485
- "reason": "Required to inject transpiled bytecode into isolated CDP contexts"
486
- }
487
- }
488
- }
489
- ```
91
+ ---
490
92
 
491
- ### Step 5: Build and Validate Plugin
492
- ```bash
493
- npx weavetab build
494
- ```
495
- This runs TypeScript compilation, introspects exported MCP tools, audits permissions, and verifies manifest integrity.
93
+ ## 4. Plugin Capabilities
496
94
 
497
- In your Weavetab project directory:
498
- ```bash
499
- npm link eval_plus
500
- wt plugin list
501
- ```
95
+ | Capability | API | Description |
96
+ | :--- | :--- | :--- |
97
+ | **Sandboxed Storage** | ctx.storage.get(), ctx.storage.set() | Isolated key-value storage in ~/.weavetab/plugins/<name>/. |
98
+ | **Thought Bubbles** | ctx.extension.showThought(session, text) | Floating green thoughts on the live browser tab. |
99
+ | **HUD Badges** | ctx.extension.setHudState(session, state) | Real-time status in the Weavetab overlay. |
100
+ | **Tool Overrides** | ctx.mcp.overrideTool(name, wrapperFn) | Wrap or intercept built-in MCP tools with custom pre/post logic. |
101
+ | **Lifecycle Hooks** | ctx.hooks.beforeToolCall, ctx.hooks.afterToolCall | Global auditing and security filters. |
502
102
 
503
103
  ---
504
104
 
505
- ## 7. Performance Profiling via `devMode`
105
+ ## 5. Installing Plugins
506
106
 
507
- To benchmark plugin performance and ensure sub-millisecond execution overhead:
107
+ `ash
108
+ # Install an official plugin
109
+ weavetab plugin add @weavetab/plugin-youtube
508
110
 
509
- 1. Enable Developer Mode: `WEAVETAB_DEV=1 wt start` (or set `"devMode": true` in `~/.weavetab/config.json`).
510
- 2. Run your tool.
511
- 3. Weavetab measures and records execution duration in real time:
512
- ```json
513
- {
514
- "success": true,
515
- "execution_ms": 14,
516
- "result": { ... }
517
- }
518
- ```
519
- 4. Check real-time HUD telemetry inside the attached Chrome browser to inspect WebSocket latency, DOM mutation counts, and memory footprint.
111
+ # Install community plugins (any npm package)
112
+ weavetab plugin add my-custom-plugin
520
113
 
521
- ---
114
+ # List installed plugins
115
+ weavetab plugin list
522
116
 
523
- ## 8. Publishing & Verification
117
+ # Remove a plugin
118
+ weavetab plugin rm my-custom-plugin
119
+ `
524
120
 
525
- 1. **Publish to NPM**:
526
- ```bash
527
- npm publish --access public
528
- ```
529
- 2. **Submit for Community Verification**:
530
- Submit a Pull Request to [Weavetab Community Registry](https://github.com/weavetab/registry) adding your package name to `verified.json`:
531
- ```json
532
- [
533
- "eval_plus",
534
- "github-automation",
535
- "vision-accessibility"
536
- ]
537
- ```
538
- 3. Once reviewed and merged by the Weavetab maintainers, your plugin will automatically receive the `✔ [Verified]` badge across all Weavetab CLI installations worldwide.
121
+ Restart weavetab to load the newly installed plugin tools into the MCP server.