@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
@@ -1,6 +1,8 @@
1
1
  import type { z } from "zod";
2
2
  import type CDP from "chrome-remote-interface";
3
3
  import type { Config } from "../config/loader.js";
4
+ import type { IPluginStorage } from "./storage.js";
5
+ import type { IPluginExtensionBridge } from "./extension_bridge.js";
4
6
  export interface WeavetabToolDefinition {
5
7
  name: string;
6
8
  description: string;
@@ -23,10 +25,25 @@ export interface WeavetabManifestTool {
23
25
  name: string;
24
26
  description: string;
25
27
  inputSchema?: Record<string, any>;
28
+ parameters?: Record<string, any>;
26
29
  }
27
- export interface WeavetabManifestPermissions {
30
+ export interface WeavetabPermissions {
31
+ config?: {
32
+ read?: boolean;
33
+ write?: boolean;
34
+ default?: Record<string, any>;
35
+ reason?: string;
36
+ };
37
+ extension?: {
38
+ hud?: boolean;
39
+ overlay?: boolean;
40
+ styles?: boolean;
41
+ scripts?: boolean;
42
+ reason?: string;
43
+ };
28
44
  network?: {
29
45
  domains?: string[];
46
+ hosts?: string[];
30
47
  intercept?: boolean;
31
48
  reason?: string;
32
49
  };
@@ -36,6 +53,7 @@ export interface WeavetabManifestPermissions {
36
53
  click?: boolean;
37
54
  input?: boolean;
38
55
  screenshot?: boolean;
56
+ dom?: boolean;
39
57
  reason?: string;
40
58
  [key: string]: any;
41
59
  };
@@ -44,19 +62,28 @@ export interface WeavetabManifestPermissions {
44
62
  write?: string[];
45
63
  reason?: string;
46
64
  };
65
+ filesystem?: {
66
+ read?: string[];
67
+ write?: string[];
68
+ reason?: string;
69
+ };
47
70
  tools?: {
48
71
  /** List of built-in tool names this plugin is permitted to override */
49
72
  override?: string[];
50
73
  /** List of built-in tool names this plugin is permitted to remove */
51
74
  remove?: string[];
75
+ hooks?: boolean;
52
76
  reason?: string;
53
77
  };
78
+ [key: string]: any;
54
79
  }
80
+ export type WeavetabManifestPermissions = WeavetabPermissions | string[];
55
81
  export interface WeavetabManifestAuthor {
56
82
  name: string;
57
83
  role?: string;
58
84
  avatar?: string;
59
85
  url?: string;
86
+ email?: string;
60
87
  }
61
88
  export interface WeavetabManifestLinks {
62
89
  github?: string;
@@ -65,10 +92,6 @@ export interface WeavetabManifestLinks {
65
92
  issues?: string;
66
93
  homepage?: string;
67
94
  }
68
- export interface WeavetabCompatibility {
69
- weavetab?: string;
70
- node?: string;
71
- }
72
95
  export interface WeavetabManifest {
73
96
  /** Schema identifier */
74
97
  $schema?: string;
@@ -78,13 +101,15 @@ export interface WeavetabManifest {
78
101
  version: string;
79
102
  /** Short summary of what this plugin provides */
80
103
  description?: string;
104
+ /** Entry point file relative to the plugin root (e.g., 'dist/index.js') */
105
+ entry?: string;
81
106
  /** Single author or multiple authors with roles */
82
107
  author?: string | WeavetabManifestAuthor | (string | WeavetabManifestAuthor)[];
83
108
  /** Array of authors */
84
109
  authors?: (string | WeavetabManifestAuthor)[];
85
- /** Path to plugin logo (e.g. "images/logo.svg" or "images/logo.png") */
110
+ /** Path to plugin logo */
86
111
  logo?: string;
87
- /** Path to plugin header banner (e.g. "images/banner.png" or "images/banner.webp") */
112
+ /** Path to plugin header banner */
88
113
  banner?: string;
89
114
  /** Path to README markdown file (default: "README.md") */
90
115
  readme?: string;
@@ -92,43 +117,154 @@ export interface WeavetabManifest {
92
117
  tags?: string[];
93
118
  /** External links */
94
119
  links?: WeavetabManifestLinks;
95
- /** Runtime compatibility requirements */
96
- compatibility?: WeavetabCompatibility;
120
+ /** Engine dependencies */
121
+ engines?: Record<string, string>;
122
+ /** Supported environments */
123
+ environments?: string[];
124
+ /** Whether the plugin should be lazy-loaded on demand */
125
+ lazy?: boolean;
97
126
  /** Tools exposed by this plugin to the MCP server */
98
127
  tools?: WeavetabManifestTool[];
128
+ /** Default configuration template */
129
+ defaultConfig?: Record<string, any>;
99
130
  /** Required permissions with security rationale */
100
131
  permissions?: WeavetabManifestPermissions;
101
132
  /** Open source license */
102
133
  license?: string;
134
+ [key: string]: any;
103
135
  }
104
136
  export interface WeavetabPluginTool<TArgs = any> {
105
137
  name: string;
106
138
  description: string;
107
139
  schema?: Record<string, any> | Record<string, z.ZodType<any>>;
108
140
  inputSchema?: Record<string, any>;
141
+ parameters?: Record<string, any>;
109
142
  handler: (args: TArgs, session?: any, config?: any) => Promise<any>;
110
143
  }
144
+ export interface DOMMutationDelta {
145
+ type?: "cdp_mutation" | "action_delta" | "page_update" | "dom_diff" | "rich_delta" | string;
146
+ timestamp?: number;
147
+ url?: string;
148
+ added?: Array<{
149
+ id?: string;
150
+ role?: string;
151
+ label?: string;
152
+ tag?: string;
153
+ text?: string;
154
+ backendNodeId?: number;
155
+ [key: string]: any;
156
+ }>;
157
+ removed?: Array<string | {
158
+ backendNodeId?: number;
159
+ tag?: string;
160
+ text?: string;
161
+ [key: string]: any;
162
+ }>;
163
+ changed?: Array<{
164
+ ref?: string;
165
+ role?: string;
166
+ label?: string;
167
+ attribute?: string;
168
+ oldValue?: any;
169
+ newValue?: any;
170
+ changes?: Record<string, {
171
+ from: any;
172
+ to: any;
173
+ }>;
174
+ actionable?: boolean;
175
+ [key: string]: any;
176
+ }>;
177
+ significantChange?: boolean;
178
+ stable_count?: number;
179
+ iframes?: any[];
180
+ [key: string]: any;
181
+ }
182
+ export type BeforeActionHook = (tool: string, args: Record<string, any>, session?: any) => Promise<Record<string, any> | {
183
+ __blocked: boolean;
184
+ reason?: string;
185
+ } | void> | Record<string, any> | {
186
+ __blocked: boolean;
187
+ reason?: string;
188
+ } | void;
189
+ export type AfterActionHook = (tool: string, result: any, session?: any, args?: Record<string, any>) => Promise<any> | any;
190
+ export type DOMMutationHook = (delta: DOMMutationDelta, session?: any) => Promise<void> | void;
191
+ export interface PluginHooksContext {
192
+ onBeforeAction: (handler: BeforeActionHook) => void;
193
+ onAfterAction: (handler: AfterActionHook) => void;
194
+ onDOMMutation: (handler: DOMMutationHook) => void;
195
+ beforeToolCall: (handler: (toolName: string, args: Record<string, any>, session?: any) => Promise<any> | void) => void;
196
+ afterToolCall: (handler: (toolName: string, args: Record<string, any>, result: any, session?: any) => Promise<any> | void) => void;
197
+ onPageNavigate?: (handler: (url: string, session?: any) => Promise<void> | void) => void;
198
+ }
199
+ export interface PluginMcpContext {
200
+ registerTool: (tool: WeavetabPluginTool | any) => void;
201
+ overrideTool?: (toolName: string, overrideHandler: any) => void;
202
+ removeTool?: (toolName: string) => void;
203
+ unregisterTool?: (toolName: string) => void;
204
+ [key: string]: any;
205
+ }
206
+ export interface PluginMemoryContext {
207
+ getSiteProfile(origin: string): Promise<any>;
208
+ learnPattern(origin: string, name: string, pattern: any): Promise<any>;
209
+ recordExecution(origin: string, name: string, success: boolean, durationMs?: number): Promise<any>;
210
+ getReliability(origin: string, patternName: string): Promise<number>;
211
+ recordQuirk(origin: string, quirkKey: string, quirkData: any): Promise<void>;
212
+ }
213
+ export interface PluginContext {
214
+ name: string;
215
+ version?: string;
216
+ pluginDir: string;
217
+ config: Record<string, any>;
218
+ storage: IPluginStorage;
219
+ extension: IPluginExtensionBridge;
220
+ mcp: PluginMcpContext;
221
+ hooks: PluginHooksContext;
222
+ memory?: PluginMemoryContext;
223
+ logger: {
224
+ info: (...args: any[]) => void;
225
+ warn: (...args: any[]) => void;
226
+ error: (...args: any[]) => void;
227
+ debug: (...args: any[]) => void;
228
+ };
229
+ [key: string]: any;
230
+ }
111
231
  export interface WeavetabPluginDefinition {
112
232
  name: string;
113
- version: string;
233
+ version?: string;
114
234
  description?: string;
115
235
  tools?: WeavetabPluginTool[];
116
236
  overrides?: WeavetabToolOverride[];
117
237
  removeTools?: string[];
118
- onLoad?: () => Promise<void>;
119
- onUnload?: () => Promise<void>;
238
+ defaultConfig?: Record<string, any>;
239
+ onBeforeAction?: BeforeActionHook;
240
+ onAfterAction?: AfterActionHook;
241
+ onDOMMutation?: DOMMutationHook;
242
+ onLoad?: (ctx: PluginContext) => Promise<void> | void;
243
+ onUnload?: (ctx: PluginContext) => Promise<void> | void;
120
244
  }
121
245
  export interface WeavetabPlugin {
122
246
  name: string;
123
247
  version: string;
124
248
  description?: string;
125
249
  /** Add new tools */
126
- tools?: WeavetabToolDefinition[];
250
+ tools?: WeavetabToolDefinition[] | WeavetabPluginTool[];
127
251
  /** Override or wrap existing tools */
128
252
  overrides?: WeavetabToolOverride[];
129
253
  /** Built-in tools to remove or disable */
130
254
  removeTools?: string[];
255
+ defaultConfig?: Record<string, any>;
131
256
  manifest?: WeavetabManifest;
132
- onLoad?: () => Promise<void>;
133
- onUnload?: () => Promise<void>;
257
+ storage?: IPluginStorage;
258
+ extension?: IPluginExtensionBridge;
259
+ hooks?: {
260
+ beforeToolCall: Array<(toolName: string, args: Record<string, any>, session?: any) => Promise<any> | void>;
261
+ afterToolCall: Array<(toolName: string, args: Record<string, any>, result: any, session?: any) => Promise<any> | void>;
262
+ onDOMMutation: Array<DOMMutationHook>;
263
+ onPageNavigate: Array<(url: string, session?: any) => Promise<void> | void>;
264
+ };
265
+ onBeforeAction?: BeforeActionHook;
266
+ onAfterAction?: AfterActionHook;
267
+ onDOMMutation?: DOMMutationHook;
268
+ onLoad?: (ctx: PluginContext) => Promise<void> | void;
269
+ onUnload?: (ctx: PluginContext) => Promise<void> | void;
134
270
  }
@@ -1,4 +1,6 @@
1
- import type { WeavetabPlugin, WeavetabManifest } from "./interface.js";
1
+ import type { WeavetabPlugin, WeavetabManifest, WeavetabPermissions, PluginContext } from "./interface.js";
2
+ import { PluginStorageManager } from "./storage.js";
3
+ import { PluginExtensionBridge } from "./extension_bridge.js";
2
4
  export interface InstalledPluginInfo {
3
5
  packageName: string;
4
6
  dir: string;
@@ -6,6 +8,10 @@ export interface InstalledPluginInfo {
6
8
  pkgJson?: Record<string, any>;
7
9
  hasValidManifest: boolean;
8
10
  }
11
+ /**
12
+ * Normalizes permissions format across legacy arrays and object aliases (filesystem vs fs).
13
+ */
14
+ export declare function normalizePermissions(perms?: any): WeavetabPermissions;
9
15
  /**
10
16
  * Reads the manifest (weavetab.json) and package.json for an installed package
11
17
  * without executing its runtime code (safe for listing/inspection).
@@ -15,4 +21,16 @@ export declare function inspectInstalledPackage(pkgDir: string): InstalledPlugin
15
21
  * Scan node_modules and return metadata for all installed Weavetab plugins.
16
22
  */
17
23
  export declare function listInstalledPlugins(pluginDir?: string): InstalledPluginInfo[];
24
+ /**
25
+ * Builds the canonical rich PluginContext for a loaded plugin.
26
+ */
27
+ export declare function buildPluginContext(plugin: WeavetabPlugin, storageManager: PluginStorageManager, extensionBridge: PluginExtensionBridge, pluginConfig: Record<string, any>, hooks: {
28
+ beforeToolCall: Array<(toolName: string, args: Record<string, any>, session?: any) => Promise<any> | void>;
29
+ afterToolCall: Array<(toolName: string, args: Record<string, any>, result: any, session?: any) => Promise<any> | void>;
30
+ onPageNavigate: Array<(url: string, session?: any) => Promise<void> | void>;
31
+ }): PluginContext;
18
32
  export declare function discoverPlugins(pluginDir?: string): WeavetabPlugin[];
33
+ /**
34
+ * Loads a specific plugin by name from node_modules.
35
+ */
36
+ export declare function loadPluginByName(name: string, pluginDir?: string): WeavetabPlugin | null;