@weavetab/mcp 2.5.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +48 -0
- package/ARCHITECTURE.md +590 -0
- package/LICENSE +631 -0
- package/README.md +909 -0
- package/SECURITY.md +196 -0
- package/TROUBLESHOOTING.md +365 -0
- package/dist/anticaptcha/detector.d.ts +49 -0
- package/dist/anticaptcha/detector.js +465 -0
- package/dist/anticaptcha/integration.d.ts +36 -0
- package/dist/anticaptcha/integration.js +123 -0
- package/dist/anticaptcha/solver.d.ts +27 -0
- package/dist/anticaptcha/solver.js +552 -0
- package/dist/audit/logger.d.ts +13 -0
- package/dist/audit/logger.js +177 -0
- package/dist/audit/telemetry.d.ts +36 -0
- package/dist/audit/telemetry.js +162 -0
- package/dist/cdp/bridge.d.ts +16 -0
- package/dist/cdp/bridge.js +826 -0
- package/dist/cdp/confirm.d.ts +26 -0
- package/dist/cdp/confirm.js +79 -0
- package/dist/cdp/connector.d.ts +37 -0
- package/dist/cdp/connector.js +661 -0
- package/dist/cdp/extension.d.ts +36 -0
- package/dist/cdp/extension.js +118 -0
- package/dist/cdp/finder.d.ts +1 -0
- package/dist/cdp/finder.js +2 -0
- package/dist/cdp/helpers.d.ts +11 -0
- package/dist/cdp/helpers.js +195 -0
- package/dist/cdp/label_cache.d.ts +12 -0
- package/dist/cdp/label_cache.js +51 -0
- package/dist/cdp/lock.d.ts +33 -0
- package/dist/cdp/lock.js +206 -0
- package/dist/cdp/omni_broker.d.ts +17 -0
- package/dist/cdp/omni_broker.js +119 -0
- package/dist/cdp/profiles.d.ts +1 -0
- package/dist/cdp/profiles.js +87 -0
- package/dist/cdp/pruner.d.ts +41 -0
- package/dist/cdp/pruner.js +263 -0
- package/dist/cdp/ref_cache.d.ts +101 -0
- package/dist/cdp/ref_cache.js +234 -0
- package/dist/cdp/retry.d.ts +5 -0
- package/dist/cdp/retry.js +39 -0
- package/dist/cdp/retry_enhanced.d.ts +44 -0
- package/dist/cdp/retry_enhanced.js +102 -0
- package/dist/cdp/security.d.ts +50 -0
- package/dist/cdp/security.js +237 -0
- package/dist/cdp/verify.d.ts +39 -0
- package/dist/cdp/verify.js +143 -0
- package/dist/cdp/walker.d.ts +91 -0
- package/dist/cdp/walker.js +896 -0
- package/dist/cdp/walker.test.d.ts +2 -0
- package/dist/cdp/walker.test.js +172 -0
- package/dist/cdp/websocket_transport.d.ts +15 -0
- package/dist/cdp/websocket_transport.js +118 -0
- package/dist/cli/plugin.d.ts +9 -0
- package/dist/cli/plugin.js +1134 -0
- package/dist/cli/updater.d.ts +1 -0
- package/dist/cli/updater.js +72 -0
- package/dist/config/loader.d.ts +120 -0
- package/dist/config/loader.js +704 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1248 -0
- package/dist/intelligence/hints.d.ts +11 -0
- package/dist/intelligence/hints.js +39 -0
- package/dist/intelligence/intent.d.ts +33 -0
- package/dist/intelligence/intent.js +171 -0
- package/dist/intelligence/sessionMemory.d.ts +66 -0
- package/dist/intelligence/sessionMemory.js +284 -0
- package/dist/intelligence/sessionMemory.test.d.ts +2 -0
- package/dist/intelligence/sessionMemory.test.js +62 -0
- package/dist/intelligence/trail.d.ts +64 -0
- package/dist/intelligence/trail.js +233 -0
- package/dist/intelligence/trail.test.d.ts +2 -0
- package/dist/intelligence/trail.test.js +110 -0
- package/dist/intelligence/vision.d.ts +24 -0
- package/dist/intelligence/vision.js +151 -0
- package/dist/lifecycle/mission_manager.d.ts +16 -0
- package/dist/lifecycle/mission_manager.js +44 -0
- package/dist/overlay/bubble.d.ts +16 -0
- package/dist/overlay/bubble.js +37 -0
- package/dist/overlay/ghost.d.ts +35 -0
- package/dist/overlay/ghost.js +508 -0
- package/dist/overlay/injector.d.ts +22 -0
- package/dist/overlay/injector.js +198 -0
- package/dist/plugin/interface.d.ts +134 -0
- package/dist/plugin/interface.js +1 -0
- package/dist/plugin/loader.d.ts +18 -0
- package/dist/plugin/loader.js +155 -0
- package/dist/plugin/registry.d.ts +50 -0
- package/dist/plugin/registry.js +234 -0
- package/dist/security/blacklist.d.ts +24 -0
- package/dist/security/blacklist.js +80 -0
- package/dist/security/filter.d.ts +2 -0
- package/dist/security/filter.js +20 -0
- package/dist/security/guard.d.ts +8 -0
- package/dist/security/guard.js +35 -0
- package/dist/security/ratelimit.d.ts +11 -0
- package/dist/security/ratelimit.js +57 -0
- package/dist/security/secrets.d.ts +75 -0
- package/dist/security/secrets.js +365 -0
- package/dist/sensors/actionability.d.ts +81 -0
- package/dist/sensors/actionability.js +303 -0
- package/dist/sensors/guard.d.ts +25 -0
- package/dist/sensors/guard.js +168 -0
- package/dist/sensors/mutations.d.ts +23 -0
- package/dist/sensors/mutations.js +93 -0
- package/dist/sensors/network.d.ts +67 -0
- package/dist/sensors/network.js +193 -0
- package/dist/sensors/operation_monitor.d.ts +80 -0
- package/dist/sensors/operation_monitor.js +203 -0
- package/dist/sensors/pacing.d.ts +44 -0
- package/dist/sensors/pacing.js +111 -0
- package/dist/sensors/thoughts.d.ts +2 -0
- package/dist/sensors/thoughts.js +59 -0
- package/dist/sensors/wait.d.ts +12 -0
- package/dist/sensors/wait.js +44 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +1687 -0
- package/dist/state/agent.d.ts +36 -0
- package/dist/state/agent.js +101 -0
- package/dist/state/cache.d.ts +16 -0
- package/dist/state/cache.js +92 -0
- package/dist/state/cache.test.d.ts +2 -0
- package/dist/state/cache.test.js +76 -0
- package/dist/state/delta.d.ts +71 -0
- package/dist/state/delta.js +234 -0
- package/dist/state/delta.test.d.ts +2 -0
- package/dist/state/delta.test.js +279 -0
- package/dist/state/groups.d.ts +15 -0
- package/dist/state/groups.js +80 -0
- package/dist/state/session.d.ts +30 -0
- package/dist/state/session.js +155 -0
- package/dist/tools/accessibility.d.ts +14 -0
- package/dist/tools/accessibility.js +32 -0
- package/dist/tools/ask.d.ts +14 -0
- package/dist/tools/ask.js +49 -0
- package/dist/tools/automation.d.ts +36 -0
- package/dist/tools/automation.js +218 -0
- package/dist/tools/browser_detect.d.ts +13 -0
- package/dist/tools/browser_detect.js +73 -0
- package/dist/tools/burst.d.ts +35 -0
- package/dist/tools/burst.js +344 -0
- package/dist/tools/canvas.d.ts +25 -0
- package/dist/tools/canvas.js +132 -0
- package/dist/tools/captcha.d.ts +38 -0
- package/dist/tools/captcha.js +209 -0
- package/dist/tools/click.d.ts +36 -0
- package/dist/tools/click.js +561 -0
- package/dist/tools/click_and_wait.d.ts +33 -0
- package/dist/tools/click_and_wait.js +149 -0
- package/dist/tools/clipboard.d.ts +29 -0
- package/dist/tools/clipboard.js +279 -0
- package/dist/tools/console.d.ts +21 -0
- package/dist/tools/console.js +107 -0
- package/dist/tools/cookies.d.ts +67 -0
- package/dist/tools/cookies.js +121 -0
- package/dist/tools/design_extract.d.ts +109 -0
- package/dist/tools/design_extract.js +641 -0
- package/dist/tools/dialog.d.ts +24 -0
- package/dist/tools/dialog.js +109 -0
- package/dist/tools/drag.d.ts +15 -0
- package/dist/tools/drag.js +29 -0
- package/dist/tools/emulation.d.ts +33 -0
- package/dist/tools/emulation.js +69 -0
- package/dist/tools/eval.d.ts +20 -0
- package/dist/tools/eval.js +92 -0
- package/dist/tools/fill.d.ts +41 -0
- package/dist/tools/fill.js +667 -0
- package/dist/tools/find.d.ts +30 -0
- package/dist/tools/find.js +60 -0
- package/dist/tools/geo.d.ts +19 -0
- package/dist/tools/geo.js +29 -0
- package/dist/tools/github/analyze.d.ts +4 -0
- package/dist/tools/github/analyze.js +113 -0
- package/dist/tools/github/cache.d.ts +21 -0
- package/dist/tools/github/cache.js +28 -0
- package/dist/tools/github/index.d.ts +4 -0
- package/dist/tools/github/index.js +4 -0
- package/dist/tools/github/issues.d.ts +9 -0
- package/dist/tools/github/issues.js +88 -0
- package/dist/tools/github/pr.d.ts +5 -0
- package/dist/tools/github/pr.js +88 -0
- package/dist/tools/github/rateLimiter.d.ts +4 -0
- package/dist/tools/github/rateLimiter.js +46 -0
- package/dist/tools/github/read.d.ts +34 -0
- package/dist/tools/github/read.js +74 -0
- package/dist/tools/github/repoContext.d.ts +20 -0
- package/dist/tools/github/repoContext.js +129 -0
- package/dist/tools/highlight.d.ts +20 -0
- package/dist/tools/highlight.js +140 -0
- package/dist/tools/hover.d.ts +19 -0
- package/dist/tools/hover.js +57 -0
- package/dist/tools/inspect.d.ts +17 -0
- package/dist/tools/inspect.js +125 -0
- package/dist/tools/integration.test.d.ts +2 -0
- package/dist/tools/integration.test.js +96 -0
- package/dist/tools/key.d.ts +25 -0
- package/dist/tools/key.js +173 -0
- package/dist/tools/macro_compiler.d.ts +7 -0
- package/dist/tools/macro_compiler.js +82 -0
- package/dist/tools/mouse.d.ts +21 -0
- package/dist/tools/mouse.js +62 -0
- package/dist/tools/navigate.d.ts +16 -0
- package/dist/tools/navigate.js +188 -0
- package/dist/tools/network_intercept.d.ts +17 -0
- package/dist/tools/network_intercept.js +151 -0
- package/dist/tools/office/index.d.ts +9 -0
- package/dist/tools/office/index.js +7 -0
- package/dist/tools/office/list.d.ts +15 -0
- package/dist/tools/office/list.js +41 -0
- package/dist/tools/office/parse.d.ts +20 -0
- package/dist/tools/office/parse.js +172 -0
- package/dist/tools/pdf.d.ts +22 -0
- package/dist/tools/pdf.js +42 -0
- package/dist/tools/performance.d.ts +12 -0
- package/dist/tools/performance.js +47 -0
- package/dist/tools/performance_test.d.ts +70 -0
- package/dist/tools/performance_test.js +128 -0
- package/dist/tools/plan.d.ts +39 -0
- package/dist/tools/plan.js +161 -0
- package/dist/tools/pointer.d.ts +35 -0
- package/dist/tools/pointer.js +522 -0
- package/dist/tools/read.d.ts +30 -0
- package/dist/tools/read.js +488 -0
- package/dist/tools/recording.d.ts +45 -0
- package/dist/tools/recording.js +124 -0
- package/dist/tools/response.d.ts +129 -0
- package/dist/tools/response.js +5 -0
- package/dist/tools/scrape.d.ts +24 -0
- package/dist/tools/scrape.js +140 -0
- package/dist/tools/screenshot.d.ts +40 -0
- package/dist/tools/screenshot.js +79 -0
- package/dist/tools/scroll.d.ts +23 -0
- package/dist/tools/scroll.js +196 -0
- package/dist/tools/select.d.ts +13 -0
- package/dist/tools/select.js +217 -0
- package/dist/tools/snapshot.d.ts +27 -0
- package/dist/tools/snapshot.js +99 -0
- package/dist/tools/storage.d.ts +18 -0
- package/dist/tools/storage.js +29 -0
- package/dist/tools/tabs.d.ts +77 -0
- package/dist/tools/tabs.js +342 -0
- package/dist/tools/thought.d.ts +16 -0
- package/dist/tools/thought.js +79 -0
- package/dist/tools/type.d.ts +65 -0
- package/dist/tools/type.js +1061 -0
- package/dist/tools/type_secret.d.ts +23 -0
- package/dist/tools/type_secret.js +229 -0
- package/dist/tools/upload.d.ts +19 -0
- package/dist/tools/upload.js +103 -0
- package/dist/tools/video_compiler.d.ts +24 -0
- package/dist/tools/video_compiler.js +199 -0
- package/dist/tools/viewport.d.ts +44 -0
- package/dist/tools/viewport.js +230 -0
- package/dist/tools/wait.d.ts +19 -0
- package/dist/tools/wait.js +202 -0
- package/dist/tools/wait_for.d.ts +23 -0
- package/dist/tools/wait_for.js +30 -0
- package/dist/tools/windows.d.ts +22 -0
- package/dist/tools/windows.js +57 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +12 -0
- package/docs/DEV_MODE.md +68 -0
- package/docs/DOCUMENTATION.md +532 -0
- package/docs/PLUGINS.md +538 -0
- package/docs/TOOLS.md +104 -0
- package/docs/dev_plugin.md +310 -0
- package/ext-dist/background.js +467 -0
- package/ext-dist/content.js +3089 -0
- package/ext-dist/dashboard.html +583 -0
- package/ext-dist/hud/hud.js +73 -0
- package/ext-dist/hud/index.html +20 -0
- package/ext-dist/manifest.json +77 -0
- package/ext-dist/sidepanel/sidepanel.js +25 -0
- package/ext-dist/sidepanel.html +547 -0
- package/ext-dist/styles.css +218 -0
- package/icon.png +0 -0
- package/mcp.json +796 -0
- package/package.json +113 -0
- package/server.json +23 -0
- package/smithery.yaml +11 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import CDP from "chrome-remote-interface";
|
|
2
|
+
export interface ConfirmResult {
|
|
3
|
+
applied: boolean;
|
|
4
|
+
before: Record<string, string>;
|
|
5
|
+
after: Record<string, string>;
|
|
6
|
+
attempts: number;
|
|
7
|
+
settleMs: number;
|
|
8
|
+
/** Confidence score (0-1) based on settle time and stability */
|
|
9
|
+
confidence: number;
|
|
10
|
+
/** Whether this is a degraded result due to timeout */
|
|
11
|
+
degraded?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ConfirmOptions {
|
|
14
|
+
settleMs?: number;
|
|
15
|
+
maxAttempts?: number;
|
|
16
|
+
retryIncrementMs?: number;
|
|
17
|
+
/** If true, requires explicit DOM confirmation before returning */
|
|
18
|
+
requireConfirmation?: boolean;
|
|
19
|
+
/** Minimum confidence threshold to consider successful */
|
|
20
|
+
minConfidence?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function confirmChange(session: CDP.Client, getState: () => Promise<Record<string, string>>, action: () => Promise<void>, options?: ConfirmOptions & {
|
|
23
|
+
precomputedBefore?: Record<string, string>;
|
|
24
|
+
verifyPasses?: number[];
|
|
25
|
+
checkSuccess?: (after: Record<string, string>) => boolean;
|
|
26
|
+
}): Promise<ConfirmResult>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { waitForDOMStable } from "../sensors/guard.js";
|
|
2
|
+
import { logDebug } from "../audit/logger.js";
|
|
3
|
+
function shallowEqual(a, b) {
|
|
4
|
+
const ka = Object.keys(a);
|
|
5
|
+
const kb = Object.keys(b);
|
|
6
|
+
if (ka.length !== kb.length)
|
|
7
|
+
return false;
|
|
8
|
+
return ka.every(k => a[k] === b[k]);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Calculate confidence score based on settle time and attempts
|
|
12
|
+
* Faster settle with fewer attempts = higher confidence
|
|
13
|
+
*/
|
|
14
|
+
function calculateConfidence(settleMs, attempts, maxAttempts) {
|
|
15
|
+
// Base confidence starts at 1.0 and decreases with attempts and settle time
|
|
16
|
+
let confidence = 1.0;
|
|
17
|
+
// Penalize multiple attempts
|
|
18
|
+
const attemptPenalty = (attempts - 1) / maxAttempts * 0.3;
|
|
19
|
+
confidence -= attemptPenalty;
|
|
20
|
+
// Penalize long settle times (anything over 200ms is slow)
|
|
21
|
+
const settlePenalty = Math.max(0, (settleMs - 50) / 500) * 0.4;
|
|
22
|
+
confidence -= settlePenalty;
|
|
23
|
+
// Ensure confidence stays in [0, 1] range
|
|
24
|
+
return Math.max(0, Math.min(1, confidence));
|
|
25
|
+
}
|
|
26
|
+
export async function confirmChange(session, getState, action, options) {
|
|
27
|
+
const passes = options?.verifyPasses ?? [16, 50, 100, 200, 500];
|
|
28
|
+
const maxAttempts = options?.maxAttempts ?? passes.length;
|
|
29
|
+
const requireConfirmation = options?.requireConfirmation ?? false;
|
|
30
|
+
const minConfidence = options?.minConfidence ?? 0.5;
|
|
31
|
+
const before = options?.precomputedBefore ?? await getState();
|
|
32
|
+
const startMs = Date.now();
|
|
33
|
+
await action();
|
|
34
|
+
let lastAfter = before;
|
|
35
|
+
let degraded = false;
|
|
36
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
37
|
+
const wait = attempt < passes.length ? passes[attempt] : (options?.settleMs ?? 16) + attempt * (options?.retryIncrementMs ?? 100);
|
|
38
|
+
await new Promise(r => setTimeout(r, wait));
|
|
39
|
+
await waitForDOMStable(session, 50, 200).catch(() => { });
|
|
40
|
+
const after = await getState();
|
|
41
|
+
lastAfter = after;
|
|
42
|
+
logDebug(`[confirmChange] [${wait}ms] Pass ${attempt + 1}: value=${JSON.stringify(after)} (before=${JSON.stringify(before)})`);
|
|
43
|
+
const isSuccess = options?.checkSuccess
|
|
44
|
+
? options.checkSuccess(after)
|
|
45
|
+
: !shallowEqual(before, after);
|
|
46
|
+
const confidence = calculateConfidence(wait, attempt + 1, maxAttempts);
|
|
47
|
+
if (isSuccess) {
|
|
48
|
+
// If requireConfirmation is true, continue to verify stability
|
|
49
|
+
if (requireConfirmation && attempt < maxAttempts - 1) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
// Check confidence threshold
|
|
53
|
+
if (confidence < minConfidence) {
|
|
54
|
+
console.warn("[confirmChange] Low confidence (" + confidence + ") below threshold (" + minConfidence + ")");
|
|
55
|
+
degraded = true;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
applied: true,
|
|
59
|
+
before,
|
|
60
|
+
after,
|
|
61
|
+
attempts: attempt + 1,
|
|
62
|
+
settleMs: wait,
|
|
63
|
+
confidence,
|
|
64
|
+
degraded
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// If we get here, change was not confirmed
|
|
69
|
+
const finalConfidence = calculateConfidence(passes[maxAttempts - 1], maxAttempts, maxAttempts);
|
|
70
|
+
return {
|
|
71
|
+
applied: false,
|
|
72
|
+
before,
|
|
73
|
+
after: lastAfter,
|
|
74
|
+
attempts: maxAttempts,
|
|
75
|
+
settleMs: passes[maxAttempts - 1],
|
|
76
|
+
confidence: finalConfidence,
|
|
77
|
+
degraded: true
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Weavetab — cdp/connector.ts
|
|
3
|
+
* CDP connection pool, browser launch, per-tab session wiring.
|
|
4
|
+
* V3: Two-factor lock validation, networkIdle with 5s fallback, SIGTERM cleanup.
|
|
5
|
+
* Weavetab by fy2ne
|
|
6
|
+
*/
|
|
7
|
+
import CDP from "chrome-remote-interface";
|
|
8
|
+
import type { Config } from "../config/loader.js";
|
|
9
|
+
export declare function getPort(): number | null;
|
|
10
|
+
export declare function getActiveEngine(): import("../config/loader.js").BrowserEngine;
|
|
11
|
+
export interface BrowserClient {
|
|
12
|
+
session: CDP.Client;
|
|
13
|
+
targetId: string;
|
|
14
|
+
url: string;
|
|
15
|
+
title: string;
|
|
16
|
+
overlayScriptId?: string;
|
|
17
|
+
overlayInstalled: boolean;
|
|
18
|
+
agentId: string;
|
|
19
|
+
browserContextId?: string;
|
|
20
|
+
/** Sticky pruning state: if true, all subsequent DOM reads by action tools (click, type, etc.) will also apply pruning. */
|
|
21
|
+
pruneActive?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function getOrConnect(config: Config): Promise<BrowserClient>;
|
|
24
|
+
export declare function getTabList(agentId?: string): Promise<any[]>;
|
|
25
|
+
export declare function connectToTab(targetId: string, port?: number, agentId?: string, browserContextId?: string): Promise<BrowserClient>;
|
|
26
|
+
/**
|
|
27
|
+
* Cancel analytics intervals and close the CDP WebSocket sessions without
|
|
28
|
+
* touching the browser process. Safe to call in server mode — the browser
|
|
29
|
+
* remains alive for the next client.
|
|
30
|
+
*/
|
|
31
|
+
export declare function cleanupIntervals(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Full cleanup: intervals + WebSocket sessions + Browser.close().
|
|
34
|
+
* Only safe to call when the browser should also be terminated (non-server mode,
|
|
35
|
+
* SIGINT, SIGTERM, explicit user-requested shutdown).
|
|
36
|
+
*/
|
|
37
|
+
export declare function cleanupAll(): Promise<void>;
|