@weavetab/mcp 2.5.0-beta.0 → 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 +288 -68
- package/dist/cdp/connector.d.ts +5 -3
- package/dist/cdp/connector.js +188 -74
- package/dist/cdp/extension.js +0 -1
- package/dist/cdp/helpers.js +0 -2
- 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/lifecycle/mission_manager.d.ts +0 -1
- package/dist/lifecycle/mission_manager.js +0 -3
- package/dist/overlay/ghost.d.ts +4 -0
- package/dist/overlay/ghost.js +118 -94
- package/dist/overlay/injector.d.ts +1 -1
- package/dist/overlay/injector.js +1 -15
- 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 +217 -151
- 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 -5
- 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/read.js +1 -1
- 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 +126 -101
- package/mcp.json +8 -15
- package/package.json +11 -5
- package/server.json +3 -3
- package/dist/tools/plan.d.ts +0 -39
- package/dist/tools/plan.js +0 -161
- 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
|
@@ -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
|
+
}
|