cvm-server 0.3.2 → 0.3.3
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/main.js +77 -118
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -4,9 +4,9 @@ const stdio_js = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
|
4
4
|
const zod = require("zod");
|
|
5
5
|
const t = require("typescript");
|
|
6
6
|
const fs = require("fs");
|
|
7
|
-
const s = require("path");
|
|
7
|
+
const s$1 = require("path");
|
|
8
8
|
const mongodb = require("mongodb");
|
|
9
|
-
const h = require("os");
|
|
9
|
+
const h$1 = require("os");
|
|
10
10
|
const dotenv = require("dotenv");
|
|
11
11
|
function _interopNamespaceDefault(e) {
|
|
12
12
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -25,74 +25,74 @@ function _interopNamespaceDefault(e) {
|
|
|
25
25
|
return Object.freeze(n);
|
|
26
26
|
}
|
|
27
27
|
const t__namespace = /* @__PURE__ */ _interopNamespaceDefault(t);
|
|
28
|
-
const s__namespace = /* @__PURE__ */ _interopNamespaceDefault(s);
|
|
29
|
-
const h__namespace = /* @__PURE__ */ _interopNamespaceDefault(h);
|
|
28
|
+
const s__namespace = /* @__PURE__ */ _interopNamespaceDefault(s$1);
|
|
29
|
+
const h__namespace = /* @__PURE__ */ _interopNamespaceDefault(h$1);
|
|
30
30
|
const dotenv__namespace = /* @__PURE__ */ _interopNamespaceDefault(dotenv);
|
|
31
|
-
var a = /* @__PURE__ */ ((
|
|
32
|
-
function l$2(
|
|
33
|
-
const
|
|
34
|
-
let u2 = false,
|
|
31
|
+
var a$1 = /* @__PURE__ */ ((i3) => (i3.PUSH = "PUSH", i3.POP = "POP", i3.LOAD = "LOAD", i3.STORE = "STORE", i3.CONCAT = "CONCAT", i3.JUMP = "JUMP", i3.JUMP_IF = "JUMP_IF", i3.CALL = "CALL", i3.RETURN = "RETURN", i3.CC = "CC", i3.PRINT = "PRINT", i3.HALT = "HALT", i3))(a$1 || {});
|
|
32
|
+
function l$2(i3) {
|
|
33
|
+
const p2 = [], r2 = [];
|
|
34
|
+
let u2 = false, c = false;
|
|
35
35
|
const o = t__namespace.createSourceFile(
|
|
36
36
|
"program.ts",
|
|
37
|
-
|
|
37
|
+
i3,
|
|
38
38
|
t__namespace.ScriptTarget.Latest,
|
|
39
39
|
true
|
|
40
40
|
);
|
|
41
41
|
function s2(e) {
|
|
42
|
-
if (t__namespace.isFunctionDeclaration(e) && e.name && e.name.text === "main" && (u2 = true, e.parameters.length > 0 &&
|
|
42
|
+
if (t__namespace.isFunctionDeclaration(e) && e.name && e.name.text === "main" && (u2 = true, e.parameters.length > 0 && p2.push("main() must not have parameters")), t__namespace.isExpressionStatement(e) && e.parent === o) {
|
|
43
43
|
const n = e.expression;
|
|
44
|
-
t__namespace.isCallExpression(n) && t__namespace.isIdentifier(n.expression) && n.expression.text === "main" && (
|
|
44
|
+
t__namespace.isCallExpression(n) && t__namespace.isIdentifier(n.expression) && n.expression.text === "main" && (c = true);
|
|
45
45
|
}
|
|
46
46
|
if (t__namespace.isCallExpression(e) && t__namespace.isIdentifier(e.expression)) {
|
|
47
47
|
const n = e.expression.text;
|
|
48
|
-
["setTimeout", "fetch", "require", "import"].includes(n) &&
|
|
48
|
+
["setTimeout", "fetch", "require", "import"].includes(n) && p2.push(`Unsupported function: ${n}`);
|
|
49
49
|
}
|
|
50
50
|
t__namespace.forEachChild(e, s2);
|
|
51
51
|
}
|
|
52
|
-
return s2(o), u2 ||
|
|
52
|
+
return s2(o), u2 || p2.push("Program must have a main() function"), u2 && !c && p2.push("main() must be called at the top level"), p2.length === 0 && r2.push({ op: a$1.HALT }), {
|
|
53
53
|
bytecode: r2,
|
|
54
|
-
errors:
|
|
54
|
+
errors: p2,
|
|
55
55
|
hasMain: u2
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
function m$1(
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
58
|
+
function m$1(i3) {
|
|
59
|
+
const p2 = l$2(i3);
|
|
60
|
+
if (p2.errors.length > 0)
|
|
61
61
|
return {
|
|
62
62
|
success: false,
|
|
63
63
|
bytecode: [],
|
|
64
|
-
errors:
|
|
64
|
+
errors: p2.errors
|
|
65
65
|
};
|
|
66
|
-
const r2 = [], u2 = t__namespace.createSourceFile("program.ts",
|
|
67
|
-
function
|
|
66
|
+
const r2 = [], u2 = t__namespace.createSourceFile("program.ts", i3, t__namespace.ScriptTarget.Latest, true);
|
|
67
|
+
function c(s2) {
|
|
68
68
|
if (t__namespace.isExpressionStatement(s2)) {
|
|
69
69
|
const e = s2.expression;
|
|
70
70
|
t__namespace.isCallExpression(e) && t__namespace.isPropertyAccessExpression(e.expression) && e.expression.expression.getText() === "console" && e.expression.name.getText() === "log" ? (e.arguments.forEach((n) => {
|
|
71
71
|
o(n);
|
|
72
|
-
}), r2.push({ op: a.PRINT })) : t__namespace.isCallExpression(e) && t__namespace.isIdentifier(e.expression) && e.expression.text === "CC" && (e.arguments.length > 0 && o(e.arguments[0]), r2.push({ op: a.CC }), r2.push({ op: a.POP }));
|
|
72
|
+
}), r2.push({ op: a$1.PRINT })) : t__namespace.isCallExpression(e) && t__namespace.isIdentifier(e.expression) && e.expression.text === "CC" && (e.arguments.length > 0 && o(e.arguments[0]), r2.push({ op: a$1.CC }), r2.push({ op: a$1.POP }));
|
|
73
73
|
} else if (t__namespace.isVariableStatement(s2)) {
|
|
74
74
|
const e = s2.declarationList.declarations[0];
|
|
75
|
-
e.initializer && (o(e.initializer), r2.push({ op: a.STORE, arg: e.name.getText() }));
|
|
75
|
+
e.initializer && (o(e.initializer), r2.push({ op: a$1.STORE, arg: e.name.getText() }));
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
function o(s2) {
|
|
79
|
-
t__namespace.isStringLiteral(s2) ? r2.push({ op: a.PUSH, arg: s2.text }) : t__namespace.isIdentifier(s2) ? r2.push({ op: a.LOAD, arg: s2.text }) : t__namespace.isCallExpression(s2) && t__namespace.isIdentifier(s2.expression) && s2.expression.text === "CC" ? (s2.arguments.length > 0 && o(s2.arguments[0]), r2.push({ op: a.CC })) : t__namespace.isBinaryExpression(s2) && s2.operatorToken.kind === t__namespace.SyntaxKind.PlusToken && (o(s2.left), o(s2.right), r2.push({ op: a.CONCAT }));
|
|
79
|
+
t__namespace.isStringLiteral(s2) ? r2.push({ op: a$1.PUSH, arg: s2.text }) : t__namespace.isIdentifier(s2) ? r2.push({ op: a$1.LOAD, arg: s2.text }) : t__namespace.isCallExpression(s2) && t__namespace.isIdentifier(s2.expression) && s2.expression.text === "CC" ? (s2.arguments.length > 0 && o(s2.arguments[0]), r2.push({ op: a$1.CC })) : t__namespace.isBinaryExpression(s2) && s2.operatorToken.kind === t__namespace.SyntaxKind.PlusToken && (o(s2.left), o(s2.right), r2.push({ op: a$1.CONCAT }));
|
|
80
80
|
}
|
|
81
81
|
return u2.forEachChild((s2) => {
|
|
82
82
|
var e;
|
|
83
83
|
t__namespace.isFunctionDeclaration(s2) && ((e = s2.name) == null ? void 0 : e.text) === "main" && s2.body && s2.body.statements.forEach((n) => {
|
|
84
|
-
|
|
84
|
+
c(n);
|
|
85
85
|
});
|
|
86
|
-
}), r2.push({ op: a.HALT }), {
|
|
86
|
+
}), r2.push({ op: a$1.HALT }), {
|
|
87
87
|
success: true,
|
|
88
88
|
bytecode: r2,
|
|
89
89
|
errors: []
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
var l$1 = Object.defineProperty;
|
|
93
|
-
var d = (
|
|
94
|
-
var r = (
|
|
95
|
-
|
|
93
|
+
var d = (i3, t2, e) => t2 in i3 ? l$1(i3, t2, { enumerable: true, configurable: true, writable: true, value: e }) : i3[t2] = e;
|
|
94
|
+
var r = (i3, t2, e) => d(i3, typeof t2 != "symbol" ? t2 + "" : t2, e);
|
|
95
|
+
class p {
|
|
96
96
|
constructor(t2) {
|
|
97
97
|
r(this, "connected", false);
|
|
98
98
|
r(this, "programsDir");
|
|
@@ -142,7 +142,7 @@ let p$1 = class p {
|
|
|
142
142
|
throw o;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
}
|
|
145
|
+
}
|
|
146
146
|
let w$1 = class w {
|
|
147
147
|
constructor(t2) {
|
|
148
148
|
r(this, "client");
|
|
@@ -199,7 +199,7 @@ class g {
|
|
|
199
199
|
switch (e) {
|
|
200
200
|
case "file": {
|
|
201
201
|
const o = (t2 == null ? void 0 : t2.dataDir) || process.env.CVM_DATA_DIR || s__namespace.join(h__namespace.homedir(), ".cvm");
|
|
202
|
-
return new p
|
|
202
|
+
return new p(o);
|
|
203
203
|
}
|
|
204
204
|
case "mongodb": {
|
|
205
205
|
const o = (t2 == null ? void 0 : t2.mongoUri) || process.env.MONGODB_URI || "mongodb://localhost:27017/cvm";
|
|
@@ -211,9 +211,9 @@ class g {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
var m = Object.defineProperty;
|
|
214
|
-
var w2 = (
|
|
215
|
-
var u = (
|
|
216
|
-
class i {
|
|
214
|
+
var w2 = (p2, s2, t2) => s2 in p2 ? m(p2, s2, { enumerable: true, configurable: true, writable: true, value: t2 }) : p2[s2] = t2;
|
|
215
|
+
var u = (p2, s2, t2) => w2(p2, typeof s2 != "symbol" ? s2 + "" : s2, t2);
|
|
216
|
+
let i$1 = class i {
|
|
217
217
|
execute(s2, t2) {
|
|
218
218
|
const e = {
|
|
219
219
|
pc: (t2 == null ? void 0 : t2.pc) ?? 0,
|
|
@@ -226,31 +226,31 @@ class i {
|
|
|
226
226
|
for (; e.status === "running" && e.pc < s2.length; ) {
|
|
227
227
|
const r2 = s2[e.pc];
|
|
228
228
|
switch (r2.op) {
|
|
229
|
-
case a.HALT:
|
|
229
|
+
case a$1.HALT:
|
|
230
230
|
e.status = "complete";
|
|
231
231
|
break;
|
|
232
|
-
case a.PUSH:
|
|
232
|
+
case a$1.PUSH:
|
|
233
233
|
e.stack.push(r2.arg), e.pc++;
|
|
234
234
|
break;
|
|
235
|
-
case a.POP:
|
|
235
|
+
case a$1.POP:
|
|
236
236
|
e.stack.pop(), e.pc++;
|
|
237
237
|
break;
|
|
238
|
-
case a.LOAD:
|
|
238
|
+
case a$1.LOAD:
|
|
239
239
|
e.stack.push(e.variables.get(r2.arg) ?? ""), e.pc++;
|
|
240
240
|
break;
|
|
241
|
-
case a.STORE:
|
|
242
|
-
const
|
|
243
|
-
e.variables.set(r2.arg,
|
|
241
|
+
case a$1.STORE:
|
|
242
|
+
const c = e.stack.pop();
|
|
243
|
+
e.variables.set(r2.arg, c), e.pc++;
|
|
244
244
|
break;
|
|
245
|
-
case a.CONCAT:
|
|
246
|
-
const o = e.stack.pop(),
|
|
247
|
-
e.stack.push(
|
|
245
|
+
case a$1.CONCAT:
|
|
246
|
+
const o = e.stack.pop(), a2 = e.stack.pop();
|
|
247
|
+
e.stack.push(a2 + o), e.pc++;
|
|
248
248
|
break;
|
|
249
|
-
case a.PRINT:
|
|
249
|
+
case a$1.PRINT:
|
|
250
250
|
const g2 = e.stack.pop();
|
|
251
251
|
e.output.push(g2), e.pc++;
|
|
252
252
|
break;
|
|
253
|
-
case a.CC:
|
|
253
|
+
case a$1.CC:
|
|
254
254
|
e.ccPrompt = e.stack.pop(), e.status = "waiting_cc";
|
|
255
255
|
break;
|
|
256
256
|
default:
|
|
@@ -271,7 +271,7 @@ class i {
|
|
|
271
271
|
};
|
|
272
272
|
return this.execute(e, r2);
|
|
273
273
|
}
|
|
274
|
-
}
|
|
274
|
+
};
|
|
275
275
|
class l {
|
|
276
276
|
constructor(s2) {
|
|
277
277
|
u(this, "vms", /* @__PURE__ */ new Map());
|
|
@@ -324,8 +324,8 @@ class l {
|
|
|
324
324
|
created: /* @__PURE__ */ new Date()
|
|
325
325
|
};
|
|
326
326
|
await this.storage.saveExecution(r2);
|
|
327
|
-
const
|
|
328
|
-
this.vms.set(t2,
|
|
327
|
+
const c = new i$1();
|
|
328
|
+
this.vms.set(t2, c);
|
|
329
329
|
}
|
|
330
330
|
/**
|
|
331
331
|
* Get next action from execution (Claude polls this)
|
|
@@ -340,13 +340,13 @@ class l {
|
|
|
340
340
|
if (!e)
|
|
341
341
|
throw new Error(`Program not found: ${t2.programId}`);
|
|
342
342
|
let r2 = this.vms.get(s2);
|
|
343
|
-
r2 || (r2 = new i(), this.vms.set(s2, r2));
|
|
344
|
-
const
|
|
343
|
+
r2 || (r2 = new i$1(), this.vms.set(s2, r2));
|
|
344
|
+
const c = {
|
|
345
345
|
pc: 0,
|
|
346
346
|
stack: [],
|
|
347
347
|
variables: /* @__PURE__ */ new Map(),
|
|
348
348
|
output: []
|
|
349
|
-
}, o = r2.execute(e.bytecode,
|
|
349
|
+
}, o = r2.execute(e.bytecode, c);
|
|
350
350
|
if (t2.pc = o.pc, t2.stack = o.stack, t2.variables = Object.fromEntries(o.variables), t2.output = o.output, o.status === "complete")
|
|
351
351
|
return t2.state = "COMPLETED", await this.storage.saveExecution(t2), this.vms.delete(s2), {
|
|
352
352
|
type: "completed",
|
|
@@ -390,8 +390,8 @@ class l {
|
|
|
390
390
|
const r2 = await this.storage.getProgram(e.programId);
|
|
391
391
|
if (!r2)
|
|
392
392
|
throw new Error(`Program not found: ${e.programId}`);
|
|
393
|
-
let
|
|
394
|
-
|
|
393
|
+
let c = this.vms.get(s2);
|
|
394
|
+
c || (c = new i$1(), this.vms.set(s2, c));
|
|
395
395
|
const o = {
|
|
396
396
|
pc: e.pc,
|
|
397
397
|
stack: e.stack,
|
|
@@ -399,7 +399,7 @@ class l {
|
|
|
399
399
|
status: "waiting_cc",
|
|
400
400
|
output: e.output,
|
|
401
401
|
ccPrompt: void 0
|
|
402
|
-
}, a2 =
|
|
402
|
+
}, a2 = c.resume(o, t2, r2.bytecode);
|
|
403
403
|
e.pc = a2.pc, e.stack = a2.stack, e.variables = Object.fromEntries(a2.variables), e.output = a2.output, a2.status === "complete" ? (e.state = "COMPLETED", this.vms.delete(s2)) : a2.status === "error" ? (e.state = "ERROR", e.error = a2.error, this.vms.delete(s2)) : a2.status === "waiting_cc" ? (e.state = "AWAITING_COGNITIVE_RESULT", e.ccPrompt = a2.ccPrompt) : e.state = "RUNNING", await this.storage.saveExecution(e);
|
|
404
404
|
}
|
|
405
405
|
/**
|
|
@@ -419,15 +419,15 @@ class l {
|
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
var
|
|
423
|
-
var
|
|
424
|
-
var
|
|
425
|
-
class
|
|
422
|
+
var a = Object.defineProperty;
|
|
423
|
+
var i2 = (o, r2, t2) => r2 in o ? a(o, r2, { enumerable: true, configurable: true, writable: true, value: t2 }) : o[r2] = t2;
|
|
424
|
+
var s = (o, r2, t2) => i2(o, typeof r2 != "symbol" ? r2 + "" : r2, t2);
|
|
425
|
+
class h {
|
|
426
426
|
constructor() {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
this.vmManager = new l(), this.server = new mcp_js.McpServer({
|
|
427
|
+
s(this, "server");
|
|
428
|
+
s(this, "transport", null);
|
|
429
|
+
s(this, "vmManager");
|
|
430
|
+
console.error("[CVM Debug] Creating CVMMcpServer instance..."), this.vmManager = new l(), this.server = new mcp_js.McpServer({
|
|
431
431
|
name: "cvm-server",
|
|
432
432
|
version: "1.0.0"
|
|
433
433
|
}), this.setupTools();
|
|
@@ -439,7 +439,7 @@ class f {
|
|
|
439
439
|
return "1.0.0";
|
|
440
440
|
}
|
|
441
441
|
setupTools() {
|
|
442
|
-
this.server.tool(
|
|
442
|
+
console.error("[CVM Debug] Setting up tools..."), this.server.tool(
|
|
443
443
|
"load",
|
|
444
444
|
{
|
|
445
445
|
programId: zod.z.string(),
|
|
@@ -450,9 +450,9 @@ class f {
|
|
|
450
450
|
return await this.vmManager.loadProgram(r2, t2), {
|
|
451
451
|
content: [{ type: "text", text: `Program loaded successfully: ${r2}` }]
|
|
452
452
|
};
|
|
453
|
-
} catch (
|
|
453
|
+
} catch (e) {
|
|
454
454
|
return {
|
|
455
|
-
content: [{ type: "text", text: `Error: ${
|
|
455
|
+
content: [{ type: "text", text: `Error: ${e instanceof Error ? e.message : "Unknown error"}` }],
|
|
456
456
|
isError: true
|
|
457
457
|
};
|
|
458
458
|
}
|
|
@@ -468,9 +468,9 @@ class f {
|
|
|
468
468
|
return await this.vmManager.startExecution(r2, t2), {
|
|
469
469
|
content: [{ type: "text", text: `Execution started: ${t2}` }]
|
|
470
470
|
};
|
|
471
|
-
} catch (
|
|
471
|
+
} catch (e) {
|
|
472
472
|
return {
|
|
473
|
-
content: [{ type: "text", text: `Error: ${
|
|
473
|
+
content: [{ type: "text", text: `Error: ${e instanceof Error ? e.message : "Unknown error"}` }],
|
|
474
474
|
isError: true
|
|
475
475
|
};
|
|
476
476
|
}
|
|
@@ -512,9 +512,9 @@ class f {
|
|
|
512
512
|
return await this.vmManager.reportCCResult(r2, t2), {
|
|
513
513
|
content: [{ type: "text", text: "Execution resumed" }]
|
|
514
514
|
};
|
|
515
|
-
} catch (
|
|
515
|
+
} catch (e) {
|
|
516
516
|
return {
|
|
517
|
-
content: [{ type: "text", text: `Error: ${
|
|
517
|
+
content: [{ type: "text", text: `Error: ${e instanceof Error ? e.message : "Unknown error"}` }],
|
|
518
518
|
isError: true
|
|
519
519
|
};
|
|
520
520
|
}
|
|
@@ -539,59 +539,18 @@ class f {
|
|
|
539
539
|
}
|
|
540
540
|
);
|
|
541
541
|
}
|
|
542
|
-
async start() {
|
|
543
|
-
await this.vmManager.initialize(), this.transport = new stdio_js.StdioServerTransport(), await this.server.connect(this.transport);
|
|
542
|
+
async start(r2) {
|
|
543
|
+
await this.vmManager.initialize(), this.transport = r2 || new stdio_js.StdioServerTransport(), await this.server.connect(this.transport);
|
|
544
544
|
}
|
|
545
545
|
async stop() {
|
|
546
546
|
this.transport && (await this.transport.close(), this.transport = null), await this.vmManager.dispose();
|
|
547
547
|
}
|
|
548
|
-
// For testing - direct
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
load: async ({ programId: n, source: e }) => {
|
|
552
|
-
try {
|
|
553
|
-
return await this.vmManager.loadProgram(n, e), { content: [{ type: "text", text: `Program loaded successfully: ${n}` }] };
|
|
554
|
-
} catch (s2) {
|
|
555
|
-
return { content: [{ type: "text", text: s2 instanceof Error ? s2.message : "Unknown error" }], isError: true };
|
|
556
|
-
}
|
|
557
|
-
},
|
|
558
|
-
start: async ({ programId: n, executionId: e }) => {
|
|
559
|
-
try {
|
|
560
|
-
return await this.vmManager.startExecution(n, e), { content: [{ type: "text", text: `Execution started: ${e}` }] };
|
|
561
|
-
} catch (s2) {
|
|
562
|
-
return { content: [{ type: "text", text: s2 instanceof Error ? s2.message : "Unknown error" }], isError: true };
|
|
563
|
-
}
|
|
564
|
-
},
|
|
565
|
-
getTask: async ({ executionId: n }) => {
|
|
566
|
-
try {
|
|
567
|
-
const e = await this.vmManager.getNext(n);
|
|
568
|
-
return e.type === "completed" ? { content: [{ type: "text", text: "Execution completed" }] } : e.type === "waiting" ? { content: [{ type: "text", text: e.message || "Waiting for input" }] } : { content: [{ type: "text", text: `Error: ${e.error}` }], isError: true };
|
|
569
|
-
} catch (e) {
|
|
570
|
-
return { content: [{ type: "text", text: e instanceof Error ? e.message : "Unknown error" }], isError: true };
|
|
571
|
-
}
|
|
572
|
-
},
|
|
573
|
-
submitTask: async ({ executionId: n, result: e }) => {
|
|
574
|
-
try {
|
|
575
|
-
return await this.vmManager.reportCCResult(n, e), { content: [{ type: "text", text: "Execution resumed" }] };
|
|
576
|
-
} catch (s2) {
|
|
577
|
-
return { content: [{ type: "text", text: s2 instanceof Error ? s2.message : "Unknown error" }], isError: true };
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
status: async ({ executionId: n }) => {
|
|
581
|
-
try {
|
|
582
|
-
const e = await this.vmManager.getExecutionStatus(n);
|
|
583
|
-
return { content: [{ type: "text", text: JSON.stringify(e, null, 2) }] };
|
|
584
|
-
} catch (e) {
|
|
585
|
-
return { content: [{ type: "text", text: e instanceof Error ? e.message : "Unknown error" }], isError: true };
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
}[r2];
|
|
589
|
-
if (!u2)
|
|
590
|
-
throw new Error(`Tool not found: ${r2}`);
|
|
591
|
-
return await u2(t2);
|
|
548
|
+
// For testing - expose VMManager for direct testing
|
|
549
|
+
getVMManager() {
|
|
550
|
+
return this.vmManager;
|
|
592
551
|
}
|
|
593
552
|
}
|
|
594
|
-
dotenv__namespace.config({ path: s.resolve(__dirname, "../../../.env") });
|
|
553
|
+
dotenv__namespace.config({ path: s$1.resolve(__dirname, "../../../.env") });
|
|
595
554
|
function loadConfig() {
|
|
596
555
|
const env = process.env.NODE_ENV || "development";
|
|
597
556
|
const storageType = process.env.CVM_STORAGE_TYPE || "file";
|
|
@@ -683,13 +642,13 @@ async function main() {
|
|
|
683
642
|
});
|
|
684
643
|
if (config.storage.type === "file") {
|
|
685
644
|
const dataDir = config.storage.dataDir || ".cvm";
|
|
686
|
-
const fullPath = s.resolve(process.cwd(), dataDir);
|
|
645
|
+
const fullPath = s$1.resolve(process.cwd(), dataDir);
|
|
687
646
|
logger2.info(`[CVM] Initializing file storage in: ${fullPath}`);
|
|
688
647
|
logger2.warn(`[CVM] ⚠️ Remember to add '${dataDir}/' to your .gitignore file!`);
|
|
689
648
|
} else {
|
|
690
649
|
logger2.info("[CVM] Using MongoDB storage");
|
|
691
650
|
}
|
|
692
|
-
cvmServer = new
|
|
651
|
+
cvmServer = new h();
|
|
693
652
|
await cvmServer.start();
|
|
694
653
|
logger2.info("CVM Server is running and ready to accept MCP connections");
|
|
695
654
|
process.on("SIGINT", async () => {
|