openclaw-cascade-plugin 1.0.12 → 1.0.14
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/dist/grpc-client.d.ts +17 -0
- package/dist/grpc-client.d.ts.map +1 -0
- package/dist/grpc-client.js +154 -0
- package/dist/grpc-client.js.map +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -54
- package/dist/index.js.map +1 -1
- package/dist/test-utils/mocks.d.ts +6 -4
- package/dist/test-utils/mocks.d.ts.map +1 -1
- package/dist/test-utils/mocks.js +24 -14
- package/dist/test-utils/mocks.js.map +1 -1
- package/dist/tools/desktop-automation.d.ts +2 -7
- package/dist/tools/desktop-automation.d.ts.map +1 -1
- package/dist/tools/desktop-automation.js +64 -123
- package/dist/tools/desktop-automation.js.map +1 -1
- package/dist/tools/index.d.ts +3 -10
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -17
- package/dist/tools/index.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +13 -2
- package/proto/cascade.proto +297 -0
- package/PHASE1_SUMMARY.md +0 -191
- package/PHASE3_SUMMARY.md +0 -195
- package/dist/cascade-client.d.ts +0 -53
- package/dist/cascade-client.d.ts.map +0 -1
- package/dist/cascade-client.js +0 -179
- package/dist/cascade-client.js.map +0 -1
- package/dist/python-manager.d.ts +0 -59
- package/dist/python-manager.d.ts.map +0 -1
- package/dist/python-manager.js +0 -190
- package/dist/python-manager.js.map +0 -1
- package/dist/tools/api-tools.d.ts +0 -9
- package/dist/tools/api-tools.d.ts.map +0 -1
- package/dist/tools/api-tools.js +0 -102
- package/dist/tools/api-tools.js.map +0 -1
- package/dist/tools/sandbox-tools.d.ts +0 -9
- package/dist/tools/sandbox-tools.d.ts.map +0 -1
- package/dist/tools/sandbox-tools.js +0 -79
- package/dist/tools/sandbox-tools.js.map +0 -1
- package/dist/tools/web-automation.d.ts +0 -9
- package/dist/tools/web-automation.d.ts.map +0 -1
- package/dist/tools/web-automation.js +0 -471
- package/dist/tools/web-automation.js.map +0 -1
- package/jest.setup.js +0 -19
- package/openclaw-cascade-plugin-1.0.0.tgz +0 -0
- package/openclaw-cascade-plugin-1.0.10.tgz +0 -0
- package/openclaw-cascade-plugin-1.0.11.tgz +0 -0
- package/openclaw-cascade-plugin-1.0.12.tgz +0 -0
- package/openclaw-cascade-plugin-1.0.4.tgz +0 -0
- package/openclaw-cascade-plugin-1.0.6.tgz +0 -0
- package/openclaw-cascade-plugin-1.0.7.tgz +0 -0
- package/openclaw-cascade-plugin-1.0.8.tgz +0 -0
- package/openclaw-cascade-plugin-1.0.9.tgz +0 -0
- package/scripts/postinstall.js +0 -84
- package/src/a2a-client.ts +0 -66
- package/src/cascade-client.test.ts +0 -400
- package/src/cascade-client.ts +0 -198
- package/src/config.test.ts +0 -189
- package/src/config.ts +0 -137
- package/src/index.ts +0 -202
- package/src/python-manager.test.ts +0 -187
- package/src/python-manager.ts +0 -230
- package/src/test-utils/helpers.ts +0 -107
- package/src/test-utils/index.ts +0 -2
- package/src/test-utils/mocks.ts +0 -101
- package/src/tools/a2a-tools.ts +0 -162
- package/src/tools/api-tools.ts +0 -110
- package/src/tools/desktop-automation.test.ts +0 -308
- package/src/tools/desktop-automation.ts +0 -366
- package/src/tools/index.ts +0 -13
- package/src/tools/response-helpers.ts +0 -78
- package/src/tools/sandbox-tools.ts +0 -83
- package/src/tools/tool-registry.ts +0 -51
- package/src/tools/web-automation.test.ts +0 -177
- package/src/tools/web-automation.ts +0 -518
- package/src/types/index.ts +0 -133
- package/src/wsl.ts +0 -53
- package/tsconfig.json +0 -27
package/dist/cascade-client.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cascade MCP Client
|
|
3
|
-
*
|
|
4
|
-
* Handles communication with Cascade MCP server via stdio JSON-RPC
|
|
5
|
-
*/
|
|
6
|
-
export declare class CascadeMcpClient {
|
|
7
|
-
private pythonPath;
|
|
8
|
-
private env;
|
|
9
|
-
private process;
|
|
10
|
-
private messageId;
|
|
11
|
-
private pendingRequests;
|
|
12
|
-
private isInitialized;
|
|
13
|
-
private readonly REQUEST_TIMEOUT;
|
|
14
|
-
private buffer;
|
|
15
|
-
constructor(pythonPath: string, env: NodeJS.ProcessEnv);
|
|
16
|
-
/**
|
|
17
|
-
* Start the MCP client and initialize connection
|
|
18
|
-
*/
|
|
19
|
-
start(): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Call a tool by name with arguments
|
|
22
|
-
*/
|
|
23
|
-
callTool(name: string, args: Record<string, any>): Promise<any>;
|
|
24
|
-
/**
|
|
25
|
-
* List all available tools
|
|
26
|
-
*/
|
|
27
|
-
listTools(): Promise<any[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Check if client is connected
|
|
30
|
-
*/
|
|
31
|
-
isConnected(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Stop the MCP client
|
|
34
|
-
*/
|
|
35
|
-
stop(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Handle incoming data from stdout
|
|
38
|
-
*/
|
|
39
|
-
private handleData;
|
|
40
|
-
/**
|
|
41
|
-
* Send a JSON-RPC request
|
|
42
|
-
*/
|
|
43
|
-
private sendRequest;
|
|
44
|
-
/**
|
|
45
|
-
* Handle incoming JSON-RPC response
|
|
46
|
-
*/
|
|
47
|
-
private handleResponse;
|
|
48
|
-
/**
|
|
49
|
-
* Reject all pending requests
|
|
50
|
-
*/
|
|
51
|
-
private rejectAllPending;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=cascade-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cascade-client.d.ts","sourceRoot":"","sources":["../src/cascade-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,qBAAa,gBAAgB;IASzB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,GAAG;IATb,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,eAAe,CAA8D;IACrF,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,MAAM,CAAM;gBAGV,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,CAAC,UAAU;IAGhC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA0C5B;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAQrE;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IASjC;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,IAAI,IAAI,IAAI;IAYZ;;OAEG;IACH,OAAO,CAAC,UAAU;IAclB;;OAEG;YACW,WAAW;IAkCzB;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAMzB"}
|
package/dist/cascade-client.js
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Cascade MCP Client
|
|
4
|
-
*
|
|
5
|
-
* Handles communication with Cascade MCP server via stdio JSON-RPC
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.CascadeMcpClient = void 0;
|
|
9
|
-
const child_process_1 = require("child_process");
|
|
10
|
-
class CascadeMcpClient {
|
|
11
|
-
constructor(pythonPath, env) {
|
|
12
|
-
this.pythonPath = pythonPath;
|
|
13
|
-
this.env = env;
|
|
14
|
-
this.process = null;
|
|
15
|
-
this.messageId = 0;
|
|
16
|
-
this.pendingRequests = new Map();
|
|
17
|
-
this.isInitialized = false;
|
|
18
|
-
this.REQUEST_TIMEOUT = 30000; // 30 seconds
|
|
19
|
-
this.buffer = '';
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Start the MCP client and initialize connection
|
|
23
|
-
*/
|
|
24
|
-
async start() {
|
|
25
|
-
try {
|
|
26
|
-
// Spawn Cascade MCP server
|
|
27
|
-
this.process = (0, child_process_1.spawn)(this.pythonPath, ['-m', 'mcp_server.cli'], {
|
|
28
|
-
env: { ...process.env, ...this.env },
|
|
29
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
30
|
-
});
|
|
31
|
-
// Handle stdout for JSON-RPC responses
|
|
32
|
-
if (this.process.stdout) {
|
|
33
|
-
this.process.stdout.on('data', (data) => {
|
|
34
|
-
this.handleData(data.toString());
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
// Handle stderr
|
|
38
|
-
if (this.process.stderr) {
|
|
39
|
-
this.process.stderr.on('data', (data) => {
|
|
40
|
-
console.error('Cascade MCP stderr:', data.toString());
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
// Handle process errors
|
|
44
|
-
this.process.on('error', (error) => {
|
|
45
|
-
console.error('Cascade MCP process error:', error);
|
|
46
|
-
this.rejectAllPending(error);
|
|
47
|
-
});
|
|
48
|
-
// Initialize MCP connection
|
|
49
|
-
await this.sendRequest('initialize', {
|
|
50
|
-
protocolVersion: '2024-11-05',
|
|
51
|
-
capabilities: {},
|
|
52
|
-
clientInfo: { name: 'openclaw-cascade', version: '1.0.0' }
|
|
53
|
-
});
|
|
54
|
-
this.isInitialized = true;
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
this.stop();
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Call a tool by name with arguments
|
|
63
|
-
*/
|
|
64
|
-
async callTool(name, args) {
|
|
65
|
-
if (!this.isInitialized) {
|
|
66
|
-
throw new Error('MCP client not initialized. Call start() first.');
|
|
67
|
-
}
|
|
68
|
-
return this.sendRequest('tools/call', { name, arguments: args });
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* List all available tools
|
|
72
|
-
*/
|
|
73
|
-
async listTools() {
|
|
74
|
-
if (!this.isInitialized) {
|
|
75
|
-
throw new Error('MCP client not initialized. Call start() first.');
|
|
76
|
-
}
|
|
77
|
-
const result = await this.sendRequest('tools/list', {});
|
|
78
|
-
return result.tools || [];
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Check if client is connected
|
|
82
|
-
*/
|
|
83
|
-
isConnected() {
|
|
84
|
-
return this.isInitialized && this.process !== null && !this.process.killed;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Stop the MCP client
|
|
88
|
-
*/
|
|
89
|
-
stop() {
|
|
90
|
-
this.rejectAllPending(new Error('Client stopped'));
|
|
91
|
-
if (this.process && !this.process.killed) {
|
|
92
|
-
this.process.kill();
|
|
93
|
-
}
|
|
94
|
-
this.process = null;
|
|
95
|
-
this.isInitialized = false;
|
|
96
|
-
this.buffer = '';
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Handle incoming data from stdout
|
|
100
|
-
*/
|
|
101
|
-
handleData(data) {
|
|
102
|
-
this.buffer += data;
|
|
103
|
-
// Process complete lines
|
|
104
|
-
const lines = this.buffer.split('\n');
|
|
105
|
-
this.buffer = lines.pop() || ''; // Keep incomplete line in buffer
|
|
106
|
-
for (const line of lines) {
|
|
107
|
-
if (line.trim()) {
|
|
108
|
-
this.handleResponse(line);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Send a JSON-RPC request
|
|
114
|
-
*/
|
|
115
|
-
async sendRequest(method, params) {
|
|
116
|
-
const id = ++this.messageId;
|
|
117
|
-
const request = { jsonrpc: '2.0', id, method, params };
|
|
118
|
-
return new Promise((resolve, reject) => {
|
|
119
|
-
// Set timeout
|
|
120
|
-
const timeoutId = setTimeout(() => {
|
|
121
|
-
this.pendingRequests.delete(id);
|
|
122
|
-
reject(new Error(`Request ${method} timed out after ${this.REQUEST_TIMEOUT}ms`));
|
|
123
|
-
}, this.REQUEST_TIMEOUT);
|
|
124
|
-
// Store pending request
|
|
125
|
-
this.pendingRequests.set(id, {
|
|
126
|
-
resolve: (result) => {
|
|
127
|
-
clearTimeout(timeoutId);
|
|
128
|
-
resolve(result);
|
|
129
|
-
},
|
|
130
|
-
reject: (error) => {
|
|
131
|
-
clearTimeout(timeoutId);
|
|
132
|
-
reject(error);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
// Send request
|
|
136
|
-
if (this.process?.stdin) {
|
|
137
|
-
this.process.stdin.write(JSON.stringify(request) + '\n');
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
this.pendingRequests.delete(id);
|
|
141
|
-
clearTimeout(timeoutId);
|
|
142
|
-
reject(new Error('Process stdin not available'));
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Handle incoming JSON-RPC response
|
|
148
|
-
*/
|
|
149
|
-
handleResponse(line) {
|
|
150
|
-
try {
|
|
151
|
-
const response = JSON.parse(line);
|
|
152
|
-
if (response.id && this.pendingRequests.has(response.id)) {
|
|
153
|
-
const { resolve, reject } = this.pendingRequests.get(response.id);
|
|
154
|
-
this.pendingRequests.delete(response.id);
|
|
155
|
-
if (response.error) {
|
|
156
|
-
reject(new Error(response.error.message || 'Unknown error'));
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
resolve(response.result);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
catch (e) {
|
|
164
|
-
// Ignore parse errors for non-JSON lines
|
|
165
|
-
console.debug('Failed to parse MCP response:', line.substring(0, 100));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Reject all pending requests
|
|
170
|
-
*/
|
|
171
|
-
rejectAllPending(error) {
|
|
172
|
-
for (const [_id, { reject }] of this.pendingRequests) {
|
|
173
|
-
reject(error);
|
|
174
|
-
}
|
|
175
|
-
this.pendingRequests.clear();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
exports.CascadeMcpClient = CascadeMcpClient;
|
|
179
|
-
//# sourceMappingURL=cascade-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cascade-client.js","sourceRoot":"","sources":["../src/cascade-client.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,iDAAoD;AAEpD,MAAa,gBAAgB;IAQ3B,YACU,UAAkB,EAClB,GAAsB;QADtB,eAAU,GAAV,UAAU,CAAQ;QAClB,QAAG,GAAH,GAAG,CAAmB;QATxB,YAAO,GAAwB,IAAI,CAAC;QACpC,cAAS,GAAG,CAAC,CAAC;QACd,oBAAe,GAAG,IAAI,GAAG,EAAmD,CAAC;QAC7E,kBAAa,GAAG,KAAK,CAAC;QACb,oBAAe,GAAG,KAAK,CAAC,CAAC,aAAa;QAC/C,WAAM,GAAG,EAAE,CAAC;IAKjB,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,CAAC;YACH,2BAA2B;YAC3B,IAAI,CAAC,OAAO,GAAG,IAAA,qBAAK,EAAC,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE;gBAC9D,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE;gBACpC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;aAChC,CAAC,CAAC;YAEH,uCAAuC;YACvC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBACxB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;oBAC9C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,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manager.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Python Manager - Handles Python environment detection and installation
|
|
3
|
-
*/
|
|
4
|
-
import { CascadePluginConfig } from './types';
|
|
5
|
-
export declare class PythonManager {
|
|
6
|
-
private config;
|
|
7
|
-
private readonly MIN_PYTHON_VERSION;
|
|
8
|
-
constructor(config: CascadePluginConfig);
|
|
9
|
-
/**
|
|
10
|
-
* Find or install Python for Cascade
|
|
11
|
-
* Priority: 1) Configured path 2) Auto-detect 3) Auto-install
|
|
12
|
-
*/
|
|
13
|
-
findOrInstallPython(): Promise<string>;
|
|
14
|
-
/**
|
|
15
|
-
* Auto-detect Python in common locations
|
|
16
|
-
*/
|
|
17
|
-
private autoDetectPython;
|
|
18
|
-
/**
|
|
19
|
-
* Get list of Python commands to try
|
|
20
|
-
*/
|
|
21
|
-
private getPythonCandidates;
|
|
22
|
-
/**
|
|
23
|
-
* Check if Python command is valid and meets version requirements
|
|
24
|
-
*/
|
|
25
|
-
isValidPython(cmd: string): Promise<boolean>;
|
|
26
|
-
/**
|
|
27
|
-
* Parse Python version from version string
|
|
28
|
-
*/
|
|
29
|
-
parsePythonVersion(versionOutput: string): number;
|
|
30
|
-
/**
|
|
31
|
-
* Execute command and return stdout
|
|
32
|
-
*/
|
|
33
|
-
private execAsync;
|
|
34
|
-
/**
|
|
35
|
-
* Auto-install Python based on platform
|
|
36
|
-
*/
|
|
37
|
-
private installPython;
|
|
38
|
-
/**
|
|
39
|
-
* Install Python on Windows
|
|
40
|
-
*/
|
|
41
|
-
private installPythonWindows;
|
|
42
|
-
/**
|
|
43
|
-
* Download Python installer for Windows
|
|
44
|
-
*/
|
|
45
|
-
private downloadPythonInstaller;
|
|
46
|
-
/**
|
|
47
|
-
* Run Python installer on Windows
|
|
48
|
-
*/
|
|
49
|
-
private runPythonInstaller;
|
|
50
|
-
/**
|
|
51
|
-
* Install Python on macOS using Homebrew
|
|
52
|
-
*/
|
|
53
|
-
private installPythonMacOS;
|
|
54
|
-
/**
|
|
55
|
-
* Install Python on Linux using apt
|
|
56
|
-
*/
|
|
57
|
-
private installPythonLinux;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=python-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"python-manager.d.ts","sourceRoot":"","sources":["../src/python-manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,qBAAa,aAAa;IAGZ,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAQ;gBAEvB,MAAM,EAAE,mBAAmB;IAE/C;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;IAoB5C;;OAEG;YACW,gBAAgB;IAY9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA4C3B;;OAEG;IACG,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUlD;;OAEG;IACH,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM;IASjD;;OAEG;IACH,OAAO,CAAC,SAAS;IAYjB;;OAEG;YACW,aAAa;IAU3B;;OAEG;YACW,oBAAoB;IAalC;;OAEG;YACW,uBAAuB;IAMrC;;OAEG;YACW,kBAAkB;IAIhC;;OAEG;YACW,kBAAkB;IAoBhC;;OAEG;YACW,kBAAkB;CAmBjC"}
|
package/dist/python-manager.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Python Manager - Handles Python environment detection and installation
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PythonManager = void 0;
|
|
7
|
-
const child_process_1 = require("child_process");
|
|
8
|
-
const path_1 = require("path");
|
|
9
|
-
class PythonManager {
|
|
10
|
-
constructor(config) {
|
|
11
|
-
this.config = config;
|
|
12
|
-
this.MIN_PYTHON_VERSION = 3.10;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Find or install Python for Cascade
|
|
16
|
-
* Priority: 1) Configured path 2) Auto-detect 3) Auto-install
|
|
17
|
-
*/
|
|
18
|
-
async findOrInstallPython() {
|
|
19
|
-
// 1. Check configured path
|
|
20
|
-
if (this.config.cascadePythonPath) {
|
|
21
|
-
if (await this.isValidPython(this.config.cascadePythonPath)) {
|
|
22
|
-
return this.config.cascadePythonPath;
|
|
23
|
-
}
|
|
24
|
-
console.warn(`Configured Python path ${this.config.cascadePythonPath} is not valid, searching...`);
|
|
25
|
-
}
|
|
26
|
-
// 2. Auto-detect in common locations
|
|
27
|
-
const detected = await this.autoDetectPython();
|
|
28
|
-
if (detected) {
|
|
29
|
-
return detected;
|
|
30
|
-
}
|
|
31
|
-
// 3. Auto-install
|
|
32
|
-
console.log('Python not found. Installing...');
|
|
33
|
-
return this.installPython();
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Auto-detect Python in common locations
|
|
37
|
-
*/
|
|
38
|
-
async autoDetectPython() {
|
|
39
|
-
const candidates = this.getPythonCandidates();
|
|
40
|
-
for (const cmd of candidates) {
|
|
41
|
-
if (await this.isValidPython(cmd)) {
|
|
42
|
-
return cmd;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Get list of Python commands to try
|
|
49
|
-
*/
|
|
50
|
-
getPythonCandidates() {
|
|
51
|
-
const candidates = [
|
|
52
|
-
'python3.12',
|
|
53
|
-
'python3.11',
|
|
54
|
-
'python3.10',
|
|
55
|
-
'python3',
|
|
56
|
-
];
|
|
57
|
-
if (process.platform === 'win32') {
|
|
58
|
-
// Windows-specific paths
|
|
59
|
-
const localAppData = process.env.LOCALAPPDATA || '';
|
|
60
|
-
const programFiles = process.env.ProgramFiles || '';
|
|
61
|
-
candidates.push((0, path_1.join)(localAppData, 'Programs', 'Python', 'Python312', 'python.exe'), (0, path_1.join)(localAppData, 'Programs', 'Python', 'Python311', 'python.exe'), (0, path_1.join)(localAppData, 'Programs', 'Python', 'Python310', 'python.exe'), (0, path_1.join)(programFiles, 'Python312', 'python.exe'), (0, path_1.join)(programFiles, 'Python311', 'python.exe'), (0, path_1.join)(programFiles, 'Python310', 'python.exe'), 'python.exe', 'python');
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
// Unix-like paths
|
|
65
|
-
candidates.push('/usr/bin/python3.12', '/usr/bin/python3.11', '/usr/bin/python3.10', '/usr/bin/python3', '/usr/local/bin/python3.12', '/usr/local/bin/python3.11', '/usr/local/bin/python3.10', '/usr/local/bin/python3', '/opt/homebrew/bin/python3.12', '/opt/homebrew/bin/python3.11', '/opt/homebrew/bin/python3.10', '/opt/homebrew/bin/python3');
|
|
66
|
-
}
|
|
67
|
-
return candidates;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Check if Python command is valid and meets version requirements
|
|
71
|
-
*/
|
|
72
|
-
async isValidPython(cmd) {
|
|
73
|
-
try {
|
|
74
|
-
const { stdout } = await this.execAsync(`${cmd} --version`);
|
|
75
|
-
const version = this.parsePythonVersion(stdout);
|
|
76
|
-
return version >= this.MIN_PYTHON_VERSION;
|
|
77
|
-
}
|
|
78
|
-
catch {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Parse Python version from version string
|
|
84
|
-
*/
|
|
85
|
-
parsePythonVersion(versionOutput) {
|
|
86
|
-
const match = versionOutput.match(/Python (\d+)\.(\d+)/);
|
|
87
|
-
if (!match)
|
|
88
|
-
return 0;
|
|
89
|
-
const major = parseInt(match[1], 10);
|
|
90
|
-
const minor = parseInt(match[2], 10);
|
|
91
|
-
return major + minor / 100;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Execute command and return stdout
|
|
95
|
-
*/
|
|
96
|
-
execAsync(command) {
|
|
97
|
-
return new Promise((resolve, reject) => {
|
|
98
|
-
(0, child_process_1.exec)(command, (error, stdout, stderr) => {
|
|
99
|
-
if (error) {
|
|
100
|
-
reject(error);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
resolve({ stdout, stderr });
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Auto-install Python based on platform
|
|
110
|
-
*/
|
|
111
|
-
async installPython() {
|
|
112
|
-
if (process.platform === 'win32') {
|
|
113
|
-
return this.installPythonWindows();
|
|
114
|
-
}
|
|
115
|
-
else if (process.platform === 'darwin') {
|
|
116
|
-
return this.installPythonMacOS();
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
return this.installPythonLinux();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Install Python on Windows
|
|
124
|
-
*/
|
|
125
|
-
async installPythonWindows() {
|
|
126
|
-
try {
|
|
127
|
-
const installerPath = await this.downloadPythonInstaller();
|
|
128
|
-
await this.runPythonInstaller(installerPath);
|
|
129
|
-
return 'python';
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
throw new Error(`Failed to install Python on Windows: ${error instanceof Error ? error.message : 'Unknown error'}. ` +
|
|
133
|
-
'Please install Python 3.10+ manually from https://python.org');
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Download Python installer for Windows
|
|
138
|
-
*/
|
|
139
|
-
async downloadPythonInstaller() {
|
|
140
|
-
// In production, this would download from python.org
|
|
141
|
-
// For now, we assume the user needs to install manually
|
|
142
|
-
throw new Error('Automatic installation not implemented. Please install Python manually.');
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Run Python installer on Windows
|
|
146
|
-
*/
|
|
147
|
-
async runPythonInstaller(installerPath) {
|
|
148
|
-
await this.execAsync(`"${installerPath}" /quiet InstallAllUsers=0 PrependPath=1`);
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Install Python on macOS using Homebrew
|
|
152
|
-
*/
|
|
153
|
-
async installPythonMacOS() {
|
|
154
|
-
// Check if brew is available
|
|
155
|
-
try {
|
|
156
|
-
await this.execAsync('which brew');
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
throw new Error('Homebrew not found. Please install Homebrew first: https://brew.sh');
|
|
160
|
-
}
|
|
161
|
-
try {
|
|
162
|
-
await this.execAsync('brew install python@3.12');
|
|
163
|
-
return '/usr/local/bin/python3.12';
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
throw new Error(`Failed to install Python via Homebrew: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Install Python on Linux using apt
|
|
171
|
-
*/
|
|
172
|
-
async installPythonLinux() {
|
|
173
|
-
// Check if apt is available
|
|
174
|
-
try {
|
|
175
|
-
await this.execAsync('which apt');
|
|
176
|
-
}
|
|
177
|
-
catch {
|
|
178
|
-
throw new Error('apt not found. Please install Python 3.10+ manually using your package manager.');
|
|
179
|
-
}
|
|
180
|
-
try {
|
|
181
|
-
await this.execAsync('sudo apt-get update && sudo apt-get install -y python3.12 python3.12-venv');
|
|
182
|
-
return '/usr/bin/python3.12';
|
|
183
|
-
}
|
|
184
|
-
catch (error) {
|
|
185
|
-
throw new Error(`Failed to install Python via apt: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
exports.PythonManager = PythonManager;
|
|
190
|
-
//# sourceMappingURL=python-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"python-manager.js","sourceRoot":"","sources":["../src/python-manager.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iDAAqC;AACrC,+BAA4B;AAG5B,MAA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,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,SAAS,CAAC,2EAA2E,CAAC,CAAC;YAClG,OAAO,qBAAqB,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,qCAAqC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAChG,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA7ND,sCA6NC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API Tools
|
|
3
|
-
*
|
|
4
|
-
* 2 tools for web API calls and search
|
|
5
|
-
*/
|
|
6
|
-
import { ToolRegistry } from './tool-registry';
|
|
7
|
-
import { CascadeMcpClient } from '../cascade-client';
|
|
8
|
-
export declare function registerApiTools(registry: ToolRegistry, getClient: () => Promise<CascadeMcpClient>): void;
|
|
9
|
-
//# sourceMappingURL=api-tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-tools.d.ts","sourceRoot":"","sources":["../../src/tools/api-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIrD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAkGzG"}
|
package/dist/tools/api-tools.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* API Tools
|
|
4
|
-
*
|
|
5
|
-
* 2 tools for web API calls and search
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.registerApiTools = registerApiTools;
|
|
9
|
-
const response_helpers_1 = require("./response-helpers");
|
|
10
|
-
function registerApiTools(registry, getClient) {
|
|
11
|
-
// 1. cascade_web_search
|
|
12
|
-
registry.register({
|
|
13
|
-
name: 'cascade_web_search',
|
|
14
|
-
description: 'Search the web for information',
|
|
15
|
-
inputSchema: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
query: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
description: 'Search query'
|
|
21
|
-
},
|
|
22
|
-
top_k: {
|
|
23
|
-
type: 'integer',
|
|
24
|
-
default: 5,
|
|
25
|
-
description: 'Number of results to return'
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
required: ['query']
|
|
29
|
-
},
|
|
30
|
-
handler: async (args) => {
|
|
31
|
-
try {
|
|
32
|
-
if (!args.query) {
|
|
33
|
-
return (0, response_helpers_1.errorResponse)('query is required');
|
|
34
|
-
}
|
|
35
|
-
const result = await (await getClient()).callTool('web_search', {
|
|
36
|
-
query: args.query,
|
|
37
|
-
top_k: args.top_k || 5
|
|
38
|
-
});
|
|
39
|
-
return (0, response_helpers_1.formatSuccess)(result);
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to search web', 'Check your network connection and API key if required');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
// 2. cascade_call_http_api
|
|
47
|
-
registry.register({
|
|
48
|
-
name: 'cascade_call_http_api',
|
|
49
|
-
description: 'Execute an HTTP API request',
|
|
50
|
-
inputSchema: {
|
|
51
|
-
type: 'object',
|
|
52
|
-
properties: {
|
|
53
|
-
method: {
|
|
54
|
-
type: 'string',
|
|
55
|
-
enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
|
|
56
|
-
description: 'HTTP method'
|
|
57
|
-
},
|
|
58
|
-
url: {
|
|
59
|
-
type: 'string',
|
|
60
|
-
description: 'Full URL to call'
|
|
61
|
-
},
|
|
62
|
-
headers: {
|
|
63
|
-
type: 'object',
|
|
64
|
-
description: 'Optional HTTP headers',
|
|
65
|
-
additionalProperties: { type: 'string' }
|
|
66
|
-
},
|
|
67
|
-
body: {
|
|
68
|
-
type: 'object',
|
|
69
|
-
description: 'Optional request body (as JSON)'
|
|
70
|
-
},
|
|
71
|
-
timeout: {
|
|
72
|
-
type: 'number',
|
|
73
|
-
default: 30,
|
|
74
|
-
description: 'Request timeout in seconds'
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
required: ['method', 'url']
|
|
78
|
-
},
|
|
79
|
-
handler: async (args) => {
|
|
80
|
-
try {
|
|
81
|
-
if (!args.method) {
|
|
82
|
-
return (0, response_helpers_1.errorResponse)('method is required');
|
|
83
|
-
}
|
|
84
|
-
if (!args.url) {
|
|
85
|
-
return (0, response_helpers_1.errorResponse)('url is required');
|
|
86
|
-
}
|
|
87
|
-
const result = await (await getClient()).callTool('call_http_api', {
|
|
88
|
-
method: args.method,
|
|
89
|
-
url: args.url,
|
|
90
|
-
headers: args.headers,
|
|
91
|
-
body: args.body,
|
|
92
|
-
timeout: args.timeout || 30
|
|
93
|
-
});
|
|
94
|
-
return (0, response_helpers_1.formatSuccess)(result);
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
return (0, response_helpers_1.errorResponse)(error instanceof Error ? error.message : 'Failed to call API', 'Verify the URL is correct and the API is accessible');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=api-tools.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-tools.js","sourceRoot":"","sources":["../../src/tools/api-tools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAOH,4CAk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;iBAC5B,CAAC,CAAC;gBACH,OAAO,IAAA,gCAAa,EAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,IAAA,gCAAa,EAClB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,EAC7D,qDAAqD,CACtD,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sandbox Tools
|
|
3
|
-
*
|
|
4
|
-
* 1 tool for executing Python code in sandbox
|
|
5
|
-
*/
|
|
6
|
-
import { ToolRegistry } from './tool-registry';
|
|
7
|
-
import { CascadeMcpClient } from '../cascade-client';
|
|
8
|
-
export declare function registerSandboxTools(registry: ToolRegistry, getClient: () => Promise<CascadeMcpClient>): void;
|
|
9
|
-
//# sourceMappingURL=sandbox-tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-tools.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIrD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAuE7G"}
|