@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.
Files changed (168) hide show
  1. package/AGENTS.md +49 -49
  2. package/ARCHITECTURE.md +590 -590
  3. package/LICENSE +216 -216
  4. package/README.md +269 -269
  5. package/SECURITY.md +207 -207
  6. package/TROUBLESHOOTING.md +373 -365
  7. package/dist/anticaptcha/detector.js +395 -395
  8. package/dist/anticaptcha/solver.js +130 -130
  9. package/dist/cdp/bridge.js +73 -73
  10. package/dist/cdp/connector.js +46 -22
  11. package/dist/cdp/extension.js +34 -34
  12. package/dist/cdp/helpers.js +174 -174
  13. package/dist/cdp/pruner.js +195 -195
  14. package/dist/cdp/ref_cache.js +66 -66
  15. package/dist/cdp/security.js +10 -10
  16. package/dist/cdp/verify.js +57 -57
  17. package/dist/cdp/walker.js +563 -525
  18. package/dist/cli/plugin.js +26 -3
  19. package/dist/config/loader.d.ts +0 -3
  20. package/dist/config/loader.js +0 -9
  21. package/dist/index.js +0 -4
  22. package/dist/intelligence/intent.js +81 -81
  23. package/dist/intelligence/sessionMemory.js +2 -2
  24. package/dist/overlay/ghost.js +22 -22
  25. package/dist/overlay/injector.js +89 -89
  26. package/dist/plugin/extension_bridge.js +54 -54
  27. package/dist/plugin/interface.d.ts +7 -0
  28. package/dist/plugin/loader.js +3 -4
  29. package/dist/plugin/schema.d.ts +11 -0
  30. package/dist/plugin/schema.js +59 -0
  31. package/dist/security/guard.js +18 -18
  32. package/dist/sensors/actionability.js +167 -167
  33. package/dist/sensors/guard.js +29 -29
  34. package/dist/sensors/network.js +15 -17
  35. package/dist/server.d.ts +1 -1
  36. package/dist/server.js +173 -144
  37. package/dist/state/delta.js +6 -7
  38. package/dist/tools/automation.js +85 -85
  39. package/dist/tools/canvas.js +48 -25
  40. package/dist/tools/checkpoint.js +94 -35
  41. package/dist/tools/click.js +52 -41
  42. package/dist/tools/clipboard.js +80 -74
  43. package/dist/tools/design_extract.js +441 -441
  44. package/dist/tools/dialog.js +13 -13
  45. package/dist/tools/emulation.d.ts +2 -0
  46. package/dist/tools/emulation.js +7 -0
  47. package/dist/tools/fill.js +344 -347
  48. package/dist/tools/find.js +78 -52
  49. package/dist/tools/highlight.js +67 -67
  50. package/dist/tools/inspect.js +54 -25
  51. package/dist/tools/key.js +42 -35
  52. package/dist/tools/navigate.d.ts +1 -1
  53. package/dist/tools/navigate.js +35 -35
  54. package/dist/tools/office/parse.js +62 -18
  55. package/dist/tools/pdf.d.ts +9 -0
  56. package/dist/tools/pdf.js +7 -4
  57. package/dist/tools/performance.d.ts +11 -4
  58. package/dist/tools/performance.js +94 -42
  59. package/dist/tools/performance_test.d.ts +2 -2
  60. package/dist/tools/performance_test.js +69 -69
  61. package/dist/tools/pointer.js +116 -116
  62. package/dist/tools/read.js +99 -67
  63. package/dist/tools/recording.js +9 -0
  64. package/dist/tools/scrape.js +146 -146
  65. package/dist/tools/screenshot.d.ts +2 -0
  66. package/dist/tools/screenshot.js +46 -4
  67. package/dist/tools/scroll.d.ts +3 -1
  68. package/dist/tools/scroll.js +13 -15
  69. package/dist/tools/select.d.ts +3 -0
  70. package/dist/tools/select.js +131 -124
  71. package/dist/tools/snapshot.js +8 -6
  72. package/dist/tools/storage.d.ts +5 -1
  73. package/dist/tools/storage.js +16 -0
  74. package/dist/tools/tabs.d.ts +7 -5
  75. package/dist/tools/tabs.js +79 -26
  76. package/dist/tools/thought.js +8 -8
  77. package/dist/tools/type.js +274 -274
  78. package/dist/tools/type_secret.js +23 -23
  79. package/dist/tools/upload.js +3 -3
  80. package/dist/tools/video_compiler.js +9 -0
  81. package/dist/tools/wait.js +35 -35
  82. package/dist/version.d.ts +1 -1
  83. package/dist/version.js +1 -1
  84. package/docs/DOCUMENTATION.md +583 -585
  85. package/docs/PLUGINS.md +139 -121
  86. package/docs/TOOLS.md +3 -4
  87. package/docs/architecture/blind-injection.md +83 -83
  88. package/docs/architecture/overview.md +49 -49
  89. package/docs/architecture/security.md +36 -36
  90. package/docs/architecture/transport.md +37 -37
  91. package/docs/cli/cli-commands.md +50 -50
  92. package/docs/cli/cli-flags.md +28 -28
  93. package/docs/cli/cli-scripting.md +35 -35
  94. package/docs/configuration/config-locations.md +23 -23
  95. package/docs/configuration/configuration.md +39 -27
  96. package/docs/configuration/env-variables.md +19 -19
  97. package/docs/configuration/folders.md +62 -55
  98. package/docs/desktop-automation/electron-apps.md +225 -214
  99. package/docs/get-started/installation.md +1 -1
  100. package/docs/get-started/introduction.md +60 -60
  101. package/docs/get-started/quickstart.md +2 -2
  102. package/docs/get-started/setup-wizard.md +27 -27
  103. package/docs/intelligence/site-profiles.md +151 -151
  104. package/docs/tools/tools.md +582 -631
  105. package/docs/troubleshooting/trouble-browser.md +27 -27
  106. package/docs/troubleshooting/trouble-loop.md +31 -31
  107. package/ext-dist/background.js +415 -415
  108. package/ext-dist/content.js +2527 -2527
  109. package/ext-dist/dashboard.html +583 -583
  110. package/ext-dist/hud/hud.js +3 -3
  111. package/ext-dist/hud/index.html +20 -20
  112. package/ext-dist/manifest.json +73 -73
  113. package/ext-dist/styles.css +223 -223
  114. package/mcp.json +796 -805
  115. package/package.json +118 -118
  116. package/server.json +23 -23
  117. package/dist/cdp/walker.test.d.ts +0 -2
  118. package/dist/cdp/walker.test.js +0 -172
  119. package/dist/intelligence/sessionMemory.test.d.ts +0 -2
  120. package/dist/intelligence/sessionMemory.test.js +0 -62
  121. package/dist/intelligence/trail.test.d.ts +0 -2
  122. package/dist/intelligence/trail.test.js +0 -110
  123. package/dist/state/cache.test.d.ts +0 -2
  124. package/dist/state/cache.test.js +0 -76
  125. package/dist/state/delta.test.d.ts +0 -2
  126. package/dist/state/delta.test.js +0 -279
  127. package/dist/state/groups.d.ts +0 -15
  128. package/dist/state/groups.js +0 -80
  129. package/dist/tools/accessibility.d.ts +0 -14
  130. package/dist/tools/accessibility.js +0 -32
  131. package/dist/tools/ask.d.ts +0 -14
  132. package/dist/tools/ask.js +0 -49
  133. package/dist/tools/click_and_wait.d.ts +0 -33
  134. package/dist/tools/click_and_wait.js +0 -149
  135. package/dist/tools/drag.d.ts +0 -15
  136. package/dist/tools/drag.js +0 -29
  137. package/dist/tools/geo.d.ts +0 -19
  138. package/dist/tools/geo.js +0 -29
  139. package/dist/tools/github/analyze.d.ts +0 -4
  140. package/dist/tools/github/analyze.js +0 -113
  141. package/dist/tools/github/cache.d.ts +0 -21
  142. package/dist/tools/github/cache.js +0 -28
  143. package/dist/tools/github/index.d.ts +0 -19
  144. package/dist/tools/github/index.js +0 -40
  145. package/dist/tools/github/issues.d.ts +0 -9
  146. package/dist/tools/github/issues.js +0 -88
  147. package/dist/tools/github/pr.d.ts +0 -5
  148. package/dist/tools/github/pr.js +0 -88
  149. package/dist/tools/github/rateLimiter.d.ts +0 -4
  150. package/dist/tools/github/rateLimiter.js +0 -46
  151. package/dist/tools/github/read.d.ts +0 -34
  152. package/dist/tools/github/read.js +0 -74
  153. package/dist/tools/github/repoContext.d.ts +0 -20
  154. package/dist/tools/github/repoContext.js +0 -129
  155. package/dist/tools/hover.d.ts +0 -19
  156. package/dist/tools/hover.js +0 -57
  157. package/dist/tools/integration.test.d.ts +0 -2
  158. package/dist/tools/integration.test.js +0 -96
  159. package/dist/tools/macro_compiler.d.ts +0 -7
  160. package/dist/tools/macro_compiler.js +0 -82
  161. package/dist/tools/mouse.d.ts +0 -21
  162. package/dist/tools/mouse.js +0 -62
  163. package/dist/tools/response.d.ts +0 -129
  164. package/dist/tools/response.js +0 -5
  165. package/dist/tools/wait_for.d.ts +0 -23
  166. package/dist/tools/wait_for.js +0 -30
  167. package/dist/tools/windows.d.ts +0 -22
  168. package/dist/tools/windows.js +0 -57
@@ -1,129 +0,0 @@
1
- /**
2
- * Shared response interfaces for all interaction tools
3
- * Standardizes the semantic response contract across WeaveTab tools
4
- */
5
- import type { ElementState, VisibleFeedback } from "../cdp/verify.js";
6
- /**
7
- * Base interface for all interaction tool responses
8
- * Provides standard fields for success confirmation, strategy used, and state verification
9
- */
10
- export interface InteractionResponse {
11
- success: boolean;
12
- /** Whether the effect was verified in DOM, not just dispatched */
13
- confirmed: boolean;
14
- /** What method/strategy was used for the interaction */
15
- strategy: string;
16
- /** Full element state after the action */
17
- elementState?: ElementState;
18
- /** Any toast/error/validation text that appeared after the action */
19
- visibleFeedback?: VisibleFeedback[];
20
- /** Suggested next action based on page context */
21
- suggestedNext?: string;
22
- /** Confidence score (0-1) based on verification strength */
23
- confidence?: number;
24
- /** True if result is degraded due to timeout or partial failure */
25
- degraded?: boolean;
26
- }
27
- /**
28
- * Extended response for click operations
29
- */
30
- export interface ClickResponse extends InteractionResponse {
31
- clicked: string;
32
- ref: string;
33
- execution_ms: number;
34
- tab_id: string;
35
- url: string;
36
- title: string;
37
- url_changed: boolean;
38
- page_map?: string;
39
- dom_changed: boolean;
40
- stuck_warning: boolean;
41
- stuck_hint?: string;
42
- sniper_warning?: string;
43
- _timing?: {
44
- element_resolution_ms: number;
45
- actionability_check_ms: number;
46
- ghost_move_ms: number;
47
- click_dispatch_ms: number;
48
- stuck_check_ms: number;
49
- fallback_retry_ms?: number;
50
- recalibration_ms?: number;
51
- map_build_count: number;
52
- };
53
- stuck_check_degraded?: boolean;
54
- }
55
- /**
56
- * Extended response for type operations
57
- */
58
- export interface TypeResponse extends InteractionResponse {
59
- typed_into: string;
60
- ref: string;
61
- length: number;
62
- execution_ms: number;
63
- tab_id: string;
64
- url: string;
65
- title: string;
66
- page_map?: string;
67
- dom_changed: boolean;
68
- stuck_warning: boolean;
69
- stuck_hint?: string;
70
- sniper_warning?: string;
71
- memory_hit?: boolean;
72
- delta?: any;
73
- }
74
- /**
75
- * Extended response for fill operations (per-field)
76
- */
77
- export interface FillFieldResponse extends InteractionResponse {
78
- ref: string;
79
- field_type: string;
80
- success: boolean;
81
- message: string;
82
- value?: string;
83
- /** Actual value read back from DOM after fill */
84
- confirmedValue?: string;
85
- /** Any validation error that appeared after fill */
86
- validationError?: string;
87
- }
88
- /**
89
- * Extended response for fill operations (overall)
90
- */
91
- export interface FillResponse {
92
- success: boolean;
93
- total_fields: number;
94
- succeeded: number;
95
- failed: number;
96
- submitted: boolean;
97
- results: FillFieldResponse[];
98
- execution_ms: number;
99
- }
100
- /**
101
- * Extended response for navigate operations
102
- */
103
- export interface NavigateResponse extends InteractionResponse {
104
- url: string;
105
- title: string;
106
- tab_id: string;
107
- /** Initial element count after navigation */
108
- elementCount?: number;
109
- /** Number of forms detected on page */
110
- formCount?: number;
111
- /** Whether cookie banners were dismissed */
112
- cookiesDismissed?: boolean;
113
- }
114
- /**
115
- * Error response structure
116
- */
117
- export interface ErrorResponse {
118
- success: false;
119
- error_code: string;
120
- message: string;
121
- suggestion?: string;
122
- human_needed?: boolean;
123
- tab_id?: string;
124
- url?: string;
125
- }
126
- /**
127
- * Union type for all possible tool responses
128
- */
129
- export type ToolResponse = InteractionResponse | ClickResponse | TypeResponse | FillResponse | FillFieldResponse | NavigateResponse | ErrorResponse;
@@ -1,5 +0,0 @@
1
- /**
2
- * Shared response interfaces for all interaction tools
3
- * Standardizes the semantic response contract across WeaveTab tools
4
- */
5
- export {};
@@ -1,23 +0,0 @@
1
- /**
2
- * Weavetab — tools/wait_for.ts
3
- * browser_wait_for: Poll the DOM for a CSS selector to appear.
4
- *
5
- * Use this to explicitly wait for an element to exist in the DOM instead of relying on
6
- * hardcoded sleeps. It polls the document using querySelector.
7
- * Returns the resolved backendNodeId if found before the timeout.
8
- * Weavetab by fy2ne
9
- */
10
- import CDP from "chrome-remote-interface";
11
- import type { Config } from "../config/loader.js";
12
- export interface WaitForOptions {
13
- selector: string;
14
- timeoutMs?: number;
15
- }
16
- export interface WaitForResult {
17
- success: boolean;
18
- selector: string;
19
- found: boolean;
20
- elapsedMs: number;
21
- nodeId?: number;
22
- }
23
- export declare function browserWaitFor(session: CDP.Client, options: WaitForOptions, _config: Config): Promise<WaitForResult>;
@@ -1,30 +0,0 @@
1
- export async function browserWaitFor(session, options, _config) {
2
- const { selector, timeoutMs = 10000 } = options;
3
- const pollInterval = 200;
4
- const start = Date.now();
5
- while (Date.now() - start < timeoutMs) {
6
- try {
7
- const { result } = await session.Runtime.evaluate({
8
- expression: `document.querySelector('${selector.replace(/'/g, "\\'")}') !== null`,
9
- returnByValue: true
10
- });
11
- if (result.value === true) {
12
- // Find the node id
13
- const { root } = await session.DOM.getDocument({ depth: -1 });
14
- const { nodeId } = await session.DOM.querySelector({ nodeId: root.nodeId, selector });
15
- const elapsed = Date.now() - start;
16
- return { success: true, selector, found: true, elapsedMs: elapsed, nodeId };
17
- }
18
- }
19
- catch {
20
- // Evaluation might fail if page is navigating, just retry
21
- }
22
- await new Promise(r => setTimeout(r, pollInterval));
23
- }
24
- return {
25
- success: false,
26
- selector,
27
- found: false,
28
- elapsedMs: Date.now() - start
29
- };
30
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Weavetab — tools/windows.ts
3
- * Lists and focuses browser windows/popups opened via window.open().
4
- * Weavetab by fy2ne
5
- */
6
- import CDP from "chrome-remote-interface";
7
- import type { Config } from "../config/loader.js";
8
- export interface WindowInfo {
9
- id: string;
10
- url: string;
11
- title: string;
12
- type: string;
13
- }
14
- export interface WindowsResult {
15
- success: true;
16
- windows: WindowInfo[];
17
- active_id: string | null;
18
- }
19
- export declare function browserWindows(session: CDP.Client, args: {
20
- action: "list" | "focus";
21
- windowId?: string;
22
- }, config: Config): Promise<WindowsResult>;
@@ -1,57 +0,0 @@
1
- /**
2
- * Weavetab — tools/windows.ts
3
- * Lists and focuses browser windows/popups opened via window.open().
4
- * Weavetab by fy2ne
5
- */
6
- import CDP from "chrome-remote-interface";
7
- import { getPort } from "../cdp/connector.js";
8
- import { connectToTab } from "../cdp/connector.js";
9
- import { sessionRegistry } from "../state/session.js";
10
- import { logAction } from "../audit/logger.js";
11
- import { getConfigAgentId } from "../config/loader.js";
12
- import { readLock } from "../cdp/lock.js";
13
- /** Resolve active CDP port — live > lock file */
14
- function resolvePort(_config) {
15
- const port = getPort() || readLock()?.port;
16
- if (!port)
17
- throw new Error("[!] No active browser session. Run browser_go first.");
18
- return port;
19
- }
20
- export async function browserWindows(session, args, config) {
21
- const { action, windowId } = args;
22
- const port = resolvePort(config);
23
- const targets = await CDP.List({ host: "127.0.0.1", port });
24
- // Include ALL target types — pages, popups, iframes
25
- const windows = targets
26
- .filter((t) => t.type === "page" || t.type === "popup")
27
- .map((t) => ({
28
- id: t.id,
29
- url: t.url,
30
- title: t.title,
31
- type: t.type === "page" ? "tab/window" : t.type,
32
- }));
33
- // Auto-attach any popup that isn't in the session registry
34
- for (const w of windows) {
35
- const known = sessionRegistry.getAll().find((c) => c.targetId === w.id);
36
- if (!known) {
37
- connectToTab(w.id, port, getConfigAgentId(config)).catch(() => { });
38
- }
39
- }
40
- if (action === "focus" && windowId) {
41
- const cleanId = windowId.trim();
42
- // Short delay to let auto-attach (above) complete if it was just fired
43
- await new Promise(r => setTimeout(r, 150));
44
- const client = await connectToTab(cleanId, port, getConfigAgentId(config));
45
- await client.session.Target.activateTarget({ targetId: cleanId });
46
- sessionRegistry.setActive(cleanId, getConfigAgentId(config));
47
- logAction("browser_windows", "focus", cleanId);
48
- }
49
- else {
50
- logAction("browser_windows", "list", `${windows.length} windows`);
51
- }
52
- return {
53
- success: true,
54
- windows,
55
- active_id: sessionRegistry.getActive(getConfigAgentId(config))?.targetId ?? null,
56
- };
57
- }