@weavetab/mcp 2.5.0-beta.1 → 2.5.0-beta.2
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 +1 -0
- package/LICENSE +2 -2
- package/README.md +208 -43
- package/SECURITY.md +3 -3
- package/TROUBLESHOOTING.md +1 -1
- package/dist/cdp/bridge.d.ts +10 -0
- package/dist/cdp/bridge.js +284 -78
- package/dist/cdp/connector.d.ts +5 -3
- package/dist/cdp/connector.js +188 -71
- package/dist/cdp/lock.d.ts +9 -6
- package/dist/cdp/lock.js +72 -59
- package/dist/cdp/omni_broker.d.ts +1 -0
- package/dist/cdp/omni_broker.js +12 -6
- package/dist/cdp/profiles.d.ts +10 -0
- package/dist/cdp/profiles.js +65 -0
- package/dist/cdp/walker.js +50 -0
- package/dist/cli/plugin.d.ts +0 -2
- package/dist/cli/plugin.js +31 -683
- package/dist/cli/updater.js +2 -2
- package/dist/config/loader.d.ts +25 -6
- package/dist/config/loader.js +133 -20
- package/dist/index.js +48 -52
- package/dist/overlay/ghost.js +2 -2
- package/dist/overlay/injector.js +1 -3
- package/dist/plugin/extension_bridge.d.ts +40 -0
- package/dist/plugin/extension_bridge.js +158 -0
- package/dist/plugin/interface.d.ts +78 -16
- package/dist/plugin/loader.d.ts +4 -0
- package/dist/plugin/loader.js +178 -57
- package/dist/plugin/registry.js +11 -1
- package/dist/plugin/storage.d.ts +51 -0
- package/dist/plugin/storage.js +164 -0
- package/dist/server.js +213 -121
- package/dist/state/session.d.ts +2 -2
- package/dist/state/session.js +33 -13
- package/dist/tools/browser_detect.d.ts +2 -1
- package/dist/tools/browser_detect.js +6 -3
- package/dist/tools/burst.d.ts +1 -0
- package/dist/tools/burst.js +4 -6
- package/dist/tools/click.js +23 -28
- package/dist/tools/clipboard.js +31 -24
- package/dist/tools/navigate.d.ts +1 -1
- package/dist/tools/navigate.js +28 -10
- package/dist/tools/tabs.d.ts +10 -10
- package/dist/tools/tabs.js +47 -39
- package/dist/tools/type.js +2 -2
- package/docs/DOCUMENTATION.md +63 -6
- package/docs/architecture/blind-injection.md +20 -0
- package/docs/architecture/dual-injection.md +32 -0
- package/docs/architecture/overview.md +49 -0
- package/docs/architecture/security.md +35 -0
- package/docs/architecture/transport.md +37 -0
- package/docs/captcha-stealth/captcha-solver.md +75 -0
- package/docs/captcha-stealth/stealth-physics.md +60 -0
- package/docs/cli/cli-commands.md +44 -0
- package/docs/cli/cli-flags.md +20 -0
- package/docs/cli/cli-introduction.md +20 -0
- package/docs/cli/cli-scripting.md +32 -0
- package/docs/cli/g-ide/ide-antigravity.md +24 -0
- package/docs/cli/g-ide/ide-claude-code.md +24 -0
- package/docs/cli/g-ide/ide-claude-desktop.md +32 -0
- package/docs/cli/g-ide/ide-cursor.md +31 -0
- package/docs/cli/g-ide/ide-generic.md +34 -0
- package/docs/cli/g-ide/ide-opencode.md +24 -0
- package/docs/cli/g-ide/ide-vscode-copilot.md +24 -0
- package/docs/cli/g-ide/ide-windsurf.md +24 -0
- package/docs/configuration/config-locations.md +24 -0
- package/docs/configuration/configuration.md +73 -0
- package/docs/configuration/env-variables.md +19 -0
- package/docs/configuration/folders.md +54 -0
- package/docs/desktop-automation/electron-apps.md +162 -0
- package/docs/get-started/installation.md +47 -0
- package/docs/get-started/introduction.md +60 -0
- package/docs/get-started/quickstart.md +54 -0
- package/docs/get-started/setup-wizard.md +26 -0
- package/docs/skills-ecosystem/skills-overview.md +35 -0
- package/docs/skills-ecosystem/skills-recipes.md +36 -0
- package/docs/tools/tools.md +293 -0
- package/docs/troubleshooting/trouble-browser.md +27 -0
- package/docs/troubleshooting/trouble-config.md +20 -0
- package/docs/troubleshooting/trouble-loop.md +31 -0
- package/ext-dist/content.js +0 -1
- package/mcp.json +8 -6
- package/package.json +11 -5
- package/server.json +3 -3
- package/docs/DEV_MODE.md +0 -68
- package/docs/PLUGINS.md +0 -538
- package/docs/TOOLS.md +0 -104
- package/docs/dev_plugin.md +0 -310
package/dist/plugin/registry.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { readFileSync, existsSync } from "node:fs";
|
|
2
2
|
import { join, dirname } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
const _require = createRequire(import.meta.url);
|
|
6
|
+
function getVersion() {
|
|
7
|
+
try {
|
|
8
|
+
return _require("../../package.json").version || "2.4.0";
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return "2.4.0";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
4
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
5
15
|
const __dirname = dirname(__filename);
|
|
6
16
|
// ---------------------------------------------------------------------------
|
|
@@ -142,7 +152,7 @@ export async function checkNpmPackageExists(pkgName) {
|
|
|
142
152
|
const res = await fetch(`https://registry.npmjs.org/${encodedName}`, {
|
|
143
153
|
method: "HEAD",
|
|
144
154
|
signal: AbortSignal.timeout(3000),
|
|
145
|
-
headers: { "User-Agent":
|
|
155
|
+
headers: { "User-Agent": `Weavetab/${getVersion()}` },
|
|
146
156
|
});
|
|
147
157
|
return res.status === 200;
|
|
148
158
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for isolated plugin file and key-value storage.
|
|
3
|
+
*/
|
|
4
|
+
export interface IPluginStorage {
|
|
5
|
+
get<T = any>(key: string, defaultValue?: T): Promise<T | null>;
|
|
6
|
+
set<T = any>(key: string, value: T): Promise<void>;
|
|
7
|
+
delete(key: string): Promise<boolean>;
|
|
8
|
+
getJSON<T = any>(filename: string): Promise<T | null>;
|
|
9
|
+
setJSON<T = any>(filename: string, data: T): Promise<void>;
|
|
10
|
+
getPath(subpath?: string): string;
|
|
11
|
+
list(subpath?: string): Promise<string[]>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates an isolated storage sandbox for a plugin under:
|
|
15
|
+
* ~/.weavetab/plugins/<plugin-name>/
|
|
16
|
+
*/
|
|
17
|
+
export declare class PluginStorageManager implements IPluginStorage {
|
|
18
|
+
readonly pluginName: string;
|
|
19
|
+
private readonly pluginDir;
|
|
20
|
+
private readonly configPath;
|
|
21
|
+
private readonly kvStorePath;
|
|
22
|
+
private inMemoryKV;
|
|
23
|
+
constructor(pluginName: string);
|
|
24
|
+
/**
|
|
25
|
+
* Returns the absolute path to the plugin's isolated directory.
|
|
26
|
+
*/
|
|
27
|
+
getDirectory(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the absolute path to the plugin's config.json.
|
|
30
|
+
*/
|
|
31
|
+
getConfigPath(): string;
|
|
32
|
+
private ensureDir;
|
|
33
|
+
/**
|
|
34
|
+
* Loads the plugin's isolated config.json. If it does not exist and a defaultConfig is provided,
|
|
35
|
+
* writes the default config to ~/.weavetab/plugins/<plugin-name>/config.json.
|
|
36
|
+
*/
|
|
37
|
+
loadConfig(defaultConfig?: Record<string, any>): Record<string, any>;
|
|
38
|
+
/**
|
|
39
|
+
* Saves updated configuration to ~/.weavetab/plugins/<plugin-name>/config.json.
|
|
40
|
+
*/
|
|
41
|
+
saveConfig(configData: Record<string, any>): void;
|
|
42
|
+
private loadKV;
|
|
43
|
+
private persistKV;
|
|
44
|
+
get<T = any>(key: string, defaultValue?: T): Promise<T | null>;
|
|
45
|
+
set<T = any>(key: string, value: T): Promise<void>;
|
|
46
|
+
delete(key: string): Promise<boolean>;
|
|
47
|
+
getPath(subpath?: string): string;
|
|
48
|
+
getJSON<T = any>(filename: string): Promise<T | null>;
|
|
49
|
+
setJSON<T = any>(filename: string, data: T): Promise<void>;
|
|
50
|
+
list(subpath?: string): Promise<string[]>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { GLOBAL_CONFIG_DIR } from "../config/loader.js";
|
|
4
|
+
import { logDebug } from "../audit/logger.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates an isolated storage sandbox for a plugin under:
|
|
7
|
+
* ~/.weavetab/plugins/<plugin-name>/
|
|
8
|
+
*/
|
|
9
|
+
export class PluginStorageManager {
|
|
10
|
+
pluginName;
|
|
11
|
+
pluginDir;
|
|
12
|
+
configPath;
|
|
13
|
+
kvStorePath;
|
|
14
|
+
inMemoryKV = null;
|
|
15
|
+
constructor(pluginName) {
|
|
16
|
+
this.pluginName = pluginName;
|
|
17
|
+
// Sanitize plugin name for safe filesystem directory creation
|
|
18
|
+
const safeName = pluginName.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
19
|
+
this.pluginDir = path.join(GLOBAL_CONFIG_DIR, "plugins", safeName);
|
|
20
|
+
this.configPath = path.join(this.pluginDir, "config.json");
|
|
21
|
+
this.kvStorePath = path.join(this.pluginDir, "storage.json");
|
|
22
|
+
this.ensureDir(this.pluginDir);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns the absolute path to the plugin's isolated directory.
|
|
26
|
+
*/
|
|
27
|
+
getDirectory() {
|
|
28
|
+
return this.pluginDir;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns the absolute path to the plugin's config.json.
|
|
32
|
+
*/
|
|
33
|
+
getConfigPath() {
|
|
34
|
+
return this.configPath;
|
|
35
|
+
}
|
|
36
|
+
ensureDir(dir) {
|
|
37
|
+
if (!fs.existsSync(dir)) {
|
|
38
|
+
try {
|
|
39
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
logDebug(`[Weavetab PluginStorage] Failed to create dir ${dir}:`, e);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Loads the plugin's isolated config.json. If it does not exist and a defaultConfig is provided,
|
|
48
|
+
* writes the default config to ~/.weavetab/plugins/<plugin-name>/config.json.
|
|
49
|
+
*/
|
|
50
|
+
loadConfig(defaultConfig = {}) {
|
|
51
|
+
try {
|
|
52
|
+
if (fs.existsSync(this.configPath)) {
|
|
53
|
+
const raw = fs.readFileSync(this.configPath, "utf-8").trim();
|
|
54
|
+
if (raw) {
|
|
55
|
+
return JSON.parse(raw);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// If config.json doesn't exist yet, save default config
|
|
59
|
+
this.ensureDir(this.pluginDir);
|
|
60
|
+
fs.writeFileSync(this.configPath, JSON.stringify(defaultConfig, null, 2), "utf-8");
|
|
61
|
+
logDebug(`[Weavetab PluginStorage] Created default config for "${this.pluginName}" at: ${this.configPath}`);
|
|
62
|
+
return { ...defaultConfig };
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
logDebug(`[Weavetab PluginStorage] Error loading config for "${this.pluginName}":`, e);
|
|
66
|
+
return { ...defaultConfig };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Saves updated configuration to ~/.weavetab/plugins/<plugin-name>/config.json.
|
|
71
|
+
*/
|
|
72
|
+
saveConfig(configData) {
|
|
73
|
+
try {
|
|
74
|
+
this.ensureDir(this.pluginDir);
|
|
75
|
+
fs.writeFileSync(this.configPath, JSON.stringify(configData, null, 2), "utf-8");
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
logDebug(`[Weavetab PluginStorage] Error saving config for "${this.pluginName}":`, e);
|
|
79
|
+
throw e;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
loadKV() {
|
|
83
|
+
if (this.inMemoryKV !== null)
|
|
84
|
+
return this.inMemoryKV;
|
|
85
|
+
try {
|
|
86
|
+
if (fs.existsSync(this.kvStorePath)) {
|
|
87
|
+
const raw = fs.readFileSync(this.kvStorePath, "utf-8").trim();
|
|
88
|
+
this.inMemoryKV = raw ? JSON.parse(raw) : {};
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
this.inMemoryKV = {};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
this.inMemoryKV = {};
|
|
96
|
+
}
|
|
97
|
+
return this.inMemoryKV || {};
|
|
98
|
+
}
|
|
99
|
+
persistKV() {
|
|
100
|
+
try {
|
|
101
|
+
this.ensureDir(this.pluginDir);
|
|
102
|
+
fs.writeFileSync(this.kvStorePath, JSON.stringify(this.inMemoryKV || {}, null, 2), "utf-8");
|
|
103
|
+
}
|
|
104
|
+
catch (e) {
|
|
105
|
+
logDebug(`[Weavetab PluginStorage] Failed to persist KV for "${this.pluginName}":`, e);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async get(key, defaultValue) {
|
|
109
|
+
const kv = this.loadKV();
|
|
110
|
+
return key in kv ? kv[key] : defaultValue !== undefined ? defaultValue : null;
|
|
111
|
+
}
|
|
112
|
+
async set(key, value) {
|
|
113
|
+
const kv = this.loadKV();
|
|
114
|
+
kv[key] = value;
|
|
115
|
+
this.persistKV();
|
|
116
|
+
}
|
|
117
|
+
async delete(key) {
|
|
118
|
+
const kv = this.loadKV();
|
|
119
|
+
if (key in kv) {
|
|
120
|
+
delete kv[key];
|
|
121
|
+
this.persistKV();
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
getPath(subpath = "") {
|
|
127
|
+
const resolved = path.resolve(this.pluginDir, subpath);
|
|
128
|
+
// Security check: ensure subpath does not escape the plugin directory
|
|
129
|
+
if (!resolved.startsWith(this.pluginDir)) {
|
|
130
|
+
throw new Error(`Security Violation: Path "${subpath}" attempts to escape plugin directory.`);
|
|
131
|
+
}
|
|
132
|
+
return resolved;
|
|
133
|
+
}
|
|
134
|
+
async getJSON(filename) {
|
|
135
|
+
const filePath = this.getPath(filename);
|
|
136
|
+
if (!fs.existsSync(filePath))
|
|
137
|
+
return null;
|
|
138
|
+
try {
|
|
139
|
+
const raw = fs.readFileSync(filePath, "utf-8");
|
|
140
|
+
return JSON.parse(raw);
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
logDebug(`[Weavetab PluginStorage] Error reading JSON from "${filePath}":`, e);
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async setJSON(filename, data) {
|
|
148
|
+
const filePath = this.getPath(filename);
|
|
149
|
+
const parent = path.dirname(filePath);
|
|
150
|
+
this.ensureDir(parent);
|
|
151
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), "utf-8");
|
|
152
|
+
}
|
|
153
|
+
async list(subpath = "") {
|
|
154
|
+
const targetDir = this.getPath(subpath);
|
|
155
|
+
if (!fs.existsSync(targetDir))
|
|
156
|
+
return [];
|
|
157
|
+
try {
|
|
158
|
+
return fs.readdirSync(targetDir);
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|