cvm-server 0.16.0-next.1 → 0.16.0-next.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/main.cjs +373 -290
- package/package.json +4 -4
- package/programs/planexecutor.ts +11 -1
package/main.cjs
CHANGED
|
@@ -43,7 +43,7 @@ function n(T2) {
|
|
|
43
43
|
function t(T2) {
|
|
44
44
|
return T2 === null;
|
|
45
45
|
}
|
|
46
|
-
function S
|
|
46
|
+
function S(T2) {
|
|
47
47
|
return T2 !== null && typeof T2 == "object" && "type" in T2 && T2.type === "array";
|
|
48
48
|
}
|
|
49
49
|
function I$1(T2) {
|
|
@@ -59,15 +59,15 @@ function c(T2) {
|
|
|
59
59
|
return T2 !== null && typeof T2 == "object" && "type" in T2 && T2.type === "object-ref";
|
|
60
60
|
}
|
|
61
61
|
function u(T2) {
|
|
62
|
-
return _$1(T2) ? T2 : E$2(T2) || n(T2) ? T2.toString() : t(T2) ? "null" : I$1(T2) ? "undefined" : S
|
|
62
|
+
return _$1(T2) ? T2 : E$2(T2) || n(T2) ? T2.toString() : t(T2) ? "null" : I$1(T2) ? "undefined" : S(T2) ? `[array:${T2.elements.length}]` : i(T2) ? "[object Object]" : String(T2);
|
|
63
63
|
}
|
|
64
64
|
function M$2(T2) {
|
|
65
|
-
return n(T2) ? T2 : t(T2) || I$1(T2) ? false : E$2(T2) ? T2 !== 0 : _$1(T2) ? T2 !== "" : S
|
|
65
|
+
return n(T2) ? T2 : t(T2) || I$1(T2) ? false : E$2(T2) ? T2 !== 0 : _$1(T2) ? T2 !== "" : S(T2) || i(T2) ? true : !!T2;
|
|
66
66
|
}
|
|
67
67
|
function y$1(T2) {
|
|
68
|
-
return _$1(T2) ? "string" : E$2(T2) ? "number" : n(T2) ? "boolean" : t(T2) ? "null" : I$1(T2) ? "undefined" : S
|
|
68
|
+
return _$1(T2) ? "string" : E$2(T2) ? "number" : n(T2) ? "boolean" : t(T2) ? "null" : I$1(T2) ? "undefined" : S(T2) || L$1(T2) ? "array" : i(T2) || c(T2) ? "object" : "unknown";
|
|
69
69
|
}
|
|
70
|
-
function F$
|
|
70
|
+
function F$2(T2) {
|
|
71
71
|
if (E$2(T2)) return T2;
|
|
72
72
|
if (n(T2)) return T2 ? 1 : 0;
|
|
73
73
|
if (t(T2)) return 0;
|
|
@@ -76,9 +76,9 @@ function F$1(T2) {
|
|
|
76
76
|
const R2 = T2.trim();
|
|
77
77
|
return R2 === "" ? 0 : Number(R2);
|
|
78
78
|
}
|
|
79
|
-
return S
|
|
79
|
+
return S(T2) ? NaN : Number(T2);
|
|
80
80
|
}
|
|
81
|
-
function Y$
|
|
81
|
+
function Y$2(T2 = [], R2) {
|
|
82
82
|
return R2 ? { type: "array", elements: T2, properties: R2 } : { type: "array", elements: T2 };
|
|
83
83
|
}
|
|
84
84
|
function s() {
|
|
@@ -87,14 +87,14 @@ function s() {
|
|
|
87
87
|
function b$2(T2 = {}) {
|
|
88
88
|
return { type: "object", properties: T2 };
|
|
89
89
|
}
|
|
90
|
-
const f$2 = require("pino"), G$2 = require("fs"), D$
|
|
90
|
+
const f$2 = require("pino"), G$2 = require("fs"), D$1 = require("path");
|
|
91
91
|
let r = null;
|
|
92
|
-
function U$
|
|
92
|
+
function U$2() {
|
|
93
93
|
if (!r) {
|
|
94
94
|
const T2 = process.env.CVM_LOG_LEVEL || "info", R2 = process.env.CVM_LOG_FILE || ".cvm/cvm-debug.log";
|
|
95
95
|
let N2;
|
|
96
96
|
try {
|
|
97
|
-
const A2 = D$
|
|
97
|
+
const A2 = D$1.dirname(R2);
|
|
98
98
|
G$2.existsSync(A2) || G$2.mkdirSync(A2, { recursive: true }), N2 = f$2.destination(R2);
|
|
99
99
|
} catch {
|
|
100
100
|
N2 = process.stdout;
|
|
@@ -107,11 +107,11 @@ function U$1() {
|
|
|
107
107
|
}
|
|
108
108
|
const g = new Proxy({}, {
|
|
109
109
|
get(T2, R2) {
|
|
110
|
-
return U$
|
|
110
|
+
return U$2()[R2];
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
-
var d$
|
|
114
|
-
var y = (t2, e, i2) => e in t2 ? d$
|
|
113
|
+
var d$2 = Object.defineProperty;
|
|
114
|
+
var y = (t2, e, i2) => e in t2 ? d$2(t2, e, { enumerable: true, configurable: true, writable: true, value: i2 }) : t2[e] = i2;
|
|
115
115
|
var h$1 = (t2, e, i2) => y(t2, typeof e != "symbol" ? e + "" : e, i2);
|
|
116
116
|
function P(t2) {
|
|
117
117
|
const e = [], i2 = [];
|
|
@@ -238,7 +238,7 @@ const k = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
|
238
238
|
const l = e.currentAddress();
|
|
239
239
|
e.patchJumps(m.endTargets, l);
|
|
240
240
|
}
|
|
241
|
-
}, A$
|
|
241
|
+
}, A$2 = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
242
242
|
const a2 = e.currentAddress();
|
|
243
243
|
i2(t2.expression);
|
|
244
244
|
const m = {
|
|
@@ -345,7 +345,7 @@ const k = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
|
345
345
|
const g2 = e.currentAddress();
|
|
346
346
|
e.patchJumps(p2.breakTargets || [], g2), e.patchJumps(p2.continueTargets || [], l);
|
|
347
347
|
}
|
|
348
|
-
}, U = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
348
|
+
}, U$1 = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
349
349
|
const a2 = e.generateTempVar();
|
|
350
350
|
i2(t2.expression), e.emit(P$1.STORE, a2);
|
|
351
351
|
const c2 = [], m = [];
|
|
@@ -444,7 +444,7 @@ const k = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
|
444
444
|
s2.breakTargets = s2.breakTargets || [], s2.breakTargets.push(a2);
|
|
445
445
|
} else
|
|
446
446
|
i2.reportError(t2, "break statement not in loop");
|
|
447
|
-
}, F = (t2, e, i2) => {
|
|
447
|
+
}, F$1 = (t2, e, i2) => {
|
|
448
448
|
const s2 = e.findLoopContext();
|
|
449
449
|
if (s2 && s2.startAddress !== void 0) {
|
|
450
450
|
const a2 = e.emit(P$1.CONTINUE, -1);
|
|
@@ -453,22 +453,22 @@ const k = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
|
453
453
|
i2.reportError(t2, "continue statement not in loop");
|
|
454
454
|
}, L = {
|
|
455
455
|
[r__namespace.SyntaxKind.IfStatement]: k,
|
|
456
|
-
[r__namespace.SyntaxKind.WhileStatement]: A$
|
|
456
|
+
[r__namespace.SyntaxKind.WhileStatement]: A$2,
|
|
457
457
|
[r__namespace.SyntaxKind.ForOfStatement]: I,
|
|
458
458
|
[r__namespace.SyntaxKind.ForInStatement]: R,
|
|
459
459
|
[r__namespace.SyntaxKind.ForStatement]: C$1,
|
|
460
|
-
[r__namespace.SyntaxKind.SwitchStatement]: U,
|
|
460
|
+
[r__namespace.SyntaxKind.SwitchStatement]: U$1,
|
|
461
461
|
[r__namespace.SyntaxKind.Block]: _,
|
|
462
462
|
[r__namespace.SyntaxKind.VariableStatement]: b$1,
|
|
463
463
|
[r__namespace.SyntaxKind.ExpressionStatement]: N,
|
|
464
464
|
[r__namespace.SyntaxKind.ReturnStatement]: O,
|
|
465
465
|
[r__namespace.SyntaxKind.BreakStatement]: K,
|
|
466
|
-
[r__namespace.SyntaxKind.ContinueStatement]: F
|
|
466
|
+
[r__namespace.SyntaxKind.ContinueStatement]: F$1
|
|
467
467
|
}, J$1 = (t2, e, i2) => {
|
|
468
468
|
e.emit(P$1.PUSH, t2.text);
|
|
469
469
|
}, H = (t2, e, i2) => {
|
|
470
470
|
e.emit(P$1.PUSH, Number(t2.text));
|
|
471
|
-
}, D
|
|
471
|
+
}, D = (t2, e, i2) => {
|
|
472
472
|
e.emit(P$1.PUSH, true);
|
|
473
473
|
}, M$1 = (t2, e, i2) => {
|
|
474
474
|
e.emit(P$1.PUSH, false);
|
|
@@ -479,15 +479,15 @@ const k = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
|
479
479
|
e.emit(P$1.LOAD_REGEX, { pattern: c2, flags: m });
|
|
480
480
|
}, q$1 = (t2, e, i2) => {
|
|
481
481
|
t2.text === "undefined" ? e.emit(P$1.PUSH_UNDEFINED) : e.emit(P$1.LOAD, t2.text);
|
|
482
|
-
}, B
|
|
482
|
+
}, B = (t2, e, { compileExpression: i2 }) => {
|
|
483
483
|
e.emit(P$1.ARRAY_NEW), t2.elements.forEach((s2) => {
|
|
484
484
|
i2(s2), e.emit(P$1.ARRAY_PUSH);
|
|
485
485
|
});
|
|
486
486
|
}, V = (t2, e, { compileExpression: i2 }) => {
|
|
487
487
|
i2(t2.expression);
|
|
488
|
-
}, $$
|
|
488
|
+
}, $$2 = (t2, e, { compileExpression: i2 }) => {
|
|
489
489
|
t2.name.text === "length" ? (i2(t2.expression), e.emit(P$1.LENGTH)) : (i2(t2.expression), e.emit(P$1.PUSH, t2.name.text), e.emit(P$1.PROPERTY_GET));
|
|
490
|
-
}, j = (t2, e, { compileExpression: i2, reportError: s2 }) => {
|
|
490
|
+
}, j$1 = (t2, e, { compileExpression: i2, reportError: s2 }) => {
|
|
491
491
|
i2(t2.expression), t2.argumentExpression ? i2(t2.argumentExpression) : s2(t2, "Element access requires an index expression"), e.emit(P$1.ARRAY_GET);
|
|
492
492
|
}, v$1 = (t2, e, { compileExpression: i2 }) => {
|
|
493
493
|
switch (t2.operator) {
|
|
@@ -507,7 +507,7 @@ const k = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
|
507
507
|
r__namespace.isIdentifier(t2.operand) && (e.emit(P$1.PUSH, t2.operand.text), e.emit(P$1.DEC, false));
|
|
508
508
|
break;
|
|
509
509
|
}
|
|
510
|
-
}, Y = (t2, e, { compileExpression: i2 }) => {
|
|
510
|
+
}, Y$1 = (t2, e, { compileExpression: i2 }) => {
|
|
511
511
|
switch (t2.operator) {
|
|
512
512
|
case r__namespace.SyntaxKind.PlusPlusToken:
|
|
513
513
|
r__namespace.isIdentifier(t2.operand) && (e.emit(P$1.PUSH, t2.operand.text), e.emit(P$1.INC, true));
|
|
@@ -575,7 +575,7 @@ const k = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
|
575
575
|
e.patchJump(a2, m);
|
|
576
576
|
}, W$1 = (t2, e, { compileExpression: i2 }) => {
|
|
577
577
|
i2(t2.expression), e.emit(P$1.TYPEOF);
|
|
578
|
-
}, Q
|
|
578
|
+
}, Q = (t2, e, { compileExpression: i2, reportError: s2 }) => {
|
|
579
579
|
if (r__namespace.isPropertyAccessExpression(t2.expression) && r__namespace.isIdentifier(t2.expression.expression) && t2.expression.expression.text === "fs") {
|
|
580
580
|
const a2 = t2.expression.name.text;
|
|
581
581
|
if (a2 === "listFiles")
|
|
@@ -682,18 +682,18 @@ const k = (t2, e, { compileExpression: i2, compileStatement: s2 }) => {
|
|
|
682
682
|
}, ee$1 = {
|
|
683
683
|
[r__namespace.SyntaxKind.StringLiteral]: J$1,
|
|
684
684
|
[r__namespace.SyntaxKind.NumericLiteral]: H,
|
|
685
|
-
[r__namespace.SyntaxKind.TrueKeyword]: D
|
|
685
|
+
[r__namespace.SyntaxKind.TrueKeyword]: D,
|
|
686
686
|
[r__namespace.SyntaxKind.FalseKeyword]: M$1,
|
|
687
687
|
[r__namespace.SyntaxKind.NullKeyword]: G$1,
|
|
688
688
|
[r__namespace.SyntaxKind.RegularExpressionLiteral]: w,
|
|
689
689
|
[r__namespace.SyntaxKind.Identifier]: q$1,
|
|
690
|
-
[r__namespace.SyntaxKind.ArrayLiteralExpression]: B
|
|
690
|
+
[r__namespace.SyntaxKind.ArrayLiteralExpression]: B,
|
|
691
691
|
[r__namespace.SyntaxKind.BinaryExpression]: z,
|
|
692
692
|
[r__namespace.SyntaxKind.PrefixUnaryExpression]: v$1,
|
|
693
|
-
[r__namespace.SyntaxKind.PostfixUnaryExpression]: Y,
|
|
694
|
-
[r__namespace.SyntaxKind.CallExpression]: Q
|
|
695
|
-
[r__namespace.SyntaxKind.PropertyAccessExpression]: $$
|
|
696
|
-
[r__namespace.SyntaxKind.ElementAccessExpression]: j,
|
|
693
|
+
[r__namespace.SyntaxKind.PostfixUnaryExpression]: Y$1,
|
|
694
|
+
[r__namespace.SyntaxKind.CallExpression]: Q,
|
|
695
|
+
[r__namespace.SyntaxKind.PropertyAccessExpression]: $$2,
|
|
696
|
+
[r__namespace.SyntaxKind.ElementAccessExpression]: j$1,
|
|
697
697
|
[r__namespace.SyntaxKind.ConditionalExpression]: X$1,
|
|
698
698
|
[r__namespace.SyntaxKind.TypeOfExpression]: W$1,
|
|
699
699
|
[r__namespace.SyntaxKind.ParenthesizedExpression]: V,
|
|
@@ -778,8 +778,8 @@ function ie$1(t2) {
|
|
|
778
778
|
errors: e
|
|
779
779
|
};
|
|
780
780
|
}
|
|
781
|
-
var d$
|
|
782
|
-
var h = (s2, t2, n2) => t2 in s2 ? d$
|
|
781
|
+
var d$1 = Object.defineProperty;
|
|
782
|
+
var h = (s2, t2, n2) => t2 in s2 ? d$1(s2, t2, { enumerable: true, configurable: true, writable: true, value: n2 }) : s2[t2] = n2;
|
|
783
783
|
var a = (s2, t2, n2) => h(s2, typeof t2 != "symbol" ? t2 + "" : t2, n2);
|
|
784
784
|
class p {
|
|
785
785
|
constructor(t2) {
|
|
@@ -1042,7 +1042,7 @@ var b = (e, t2, r2) => X(e, typeof t2 != "symbol" ? t2 + "" : t2, r2);
|
|
|
1042
1042
|
function Z(e) {
|
|
1043
1043
|
return !!(e && typeof e == "object" && "type" in e && "message" in e);
|
|
1044
1044
|
}
|
|
1045
|
-
function d
|
|
1045
|
+
function d(e, t2) {
|
|
1046
1046
|
return e.stack.length < 1 ? {
|
|
1047
1047
|
type: "RuntimeError",
|
|
1048
1048
|
message: "Stack underflow",
|
|
@@ -1055,14 +1055,14 @@ const f2 = Z, ee = {
|
|
|
1055
1055
|
stackIn: 2,
|
|
1056
1056
|
stackOut: 1,
|
|
1057
1057
|
execute: (e, t2) => {
|
|
1058
|
-
const r2 = d
|
|
1058
|
+
const r2 = d(e, t2.op);
|
|
1059
1059
|
if (f2(r2)) return r2;
|
|
1060
|
-
const o = d
|
|
1060
|
+
const o = d(e, t2.op);
|
|
1061
1061
|
if (f2(o)) return o;
|
|
1062
1062
|
if (_$1(o) || _$1(r2))
|
|
1063
1063
|
e.stack.push(u(o) + u(r2));
|
|
1064
1064
|
else {
|
|
1065
|
-
const c2 = F$
|
|
1065
|
+
const c2 = F$2(o), s2 = F$2(r2);
|
|
1066
1066
|
e.stack.push(c2 + s2);
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
@@ -1071,11 +1071,11 @@ const f2 = Z, ee = {
|
|
|
1071
1071
|
stackIn: 2,
|
|
1072
1072
|
stackOut: 1,
|
|
1073
1073
|
execute: (e, t2) => {
|
|
1074
|
-
const r2 = d
|
|
1074
|
+
const r2 = d(e, t2.op);
|
|
1075
1075
|
if (f2(r2)) return r2;
|
|
1076
|
-
const o = d
|
|
1076
|
+
const o = d(e, t2.op);
|
|
1077
1077
|
if (f2(o)) return o;
|
|
1078
|
-
const c2 = F$
|
|
1078
|
+
const c2 = F$2(o), s2 = F$2(r2);
|
|
1079
1079
|
e.stack.push(c2 - s2);
|
|
1080
1080
|
}
|
|
1081
1081
|
},
|
|
@@ -1083,11 +1083,11 @@ const f2 = Z, ee = {
|
|
|
1083
1083
|
stackIn: 2,
|
|
1084
1084
|
stackOut: 1,
|
|
1085
1085
|
execute: (e, t2) => {
|
|
1086
|
-
const r2 = d
|
|
1086
|
+
const r2 = d(e, t2.op);
|
|
1087
1087
|
if (f2(r2)) return r2;
|
|
1088
|
-
const o = d
|
|
1088
|
+
const o = d(e, t2.op);
|
|
1089
1089
|
if (f2(o)) return o;
|
|
1090
|
-
const c2 = F$
|
|
1090
|
+
const c2 = F$2(o), s2 = F$2(r2);
|
|
1091
1091
|
e.stack.push(c2 * s2);
|
|
1092
1092
|
}
|
|
1093
1093
|
},
|
|
@@ -1095,11 +1095,11 @@ const f2 = Z, ee = {
|
|
|
1095
1095
|
stackIn: 2,
|
|
1096
1096
|
stackOut: 1,
|
|
1097
1097
|
execute: (e, t2) => {
|
|
1098
|
-
const r2 = d
|
|
1098
|
+
const r2 = d(e, t2.op);
|
|
1099
1099
|
if (f2(r2)) return r2;
|
|
1100
|
-
const o = d
|
|
1100
|
+
const o = d(e, t2.op);
|
|
1101
1101
|
if (f2(o)) return o;
|
|
1102
|
-
const c2 = F$
|
|
1102
|
+
const c2 = F$2(o), s2 = F$2(r2);
|
|
1103
1103
|
if (s2 === 0)
|
|
1104
1104
|
return {
|
|
1105
1105
|
type: "DivisionByZero",
|
|
@@ -1114,11 +1114,11 @@ const f2 = Z, ee = {
|
|
|
1114
1114
|
stackIn: 2,
|
|
1115
1115
|
stackOut: 1,
|
|
1116
1116
|
execute: (e, t2) => {
|
|
1117
|
-
const r2 = d
|
|
1117
|
+
const r2 = d(e, t2.op);
|
|
1118
1118
|
if (f2(r2)) return r2;
|
|
1119
|
-
const o = d
|
|
1119
|
+
const o = d(e, t2.op);
|
|
1120
1120
|
if (f2(o)) return o;
|
|
1121
|
-
const c2 = F$
|
|
1121
|
+
const c2 = F$2(o), s2 = F$2(r2);
|
|
1122
1122
|
e.stack.push(c2 % s2);
|
|
1123
1123
|
}
|
|
1124
1124
|
},
|
|
@@ -1126,9 +1126,9 @@ const f2 = Z, ee = {
|
|
|
1126
1126
|
stackIn: 1,
|
|
1127
1127
|
stackOut: 1,
|
|
1128
1128
|
execute: (e, t2) => {
|
|
1129
|
-
const r2 = d
|
|
1129
|
+
const r2 = d(e, t2.op);
|
|
1130
1130
|
if (f2(r2)) return r2;
|
|
1131
|
-
const o = F$
|
|
1131
|
+
const o = F$2(r2);
|
|
1132
1132
|
e.stack.push(-o);
|
|
1133
1133
|
}
|
|
1134
1134
|
},
|
|
@@ -1136,9 +1136,9 @@ const f2 = Z, ee = {
|
|
|
1136
1136
|
stackIn: 1,
|
|
1137
1137
|
stackOut: 1,
|
|
1138
1138
|
execute: (e, t2) => {
|
|
1139
|
-
const r2 = d
|
|
1139
|
+
const r2 = d(e, t2.op);
|
|
1140
1140
|
if (f2(r2)) return r2;
|
|
1141
|
-
const o = F$
|
|
1141
|
+
const o = F$2(r2);
|
|
1142
1142
|
e.stack.push(o);
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
@@ -1363,7 +1363,7 @@ const f2 = Z, ee = {
|
|
|
1363
1363
|
opcode: t2.op
|
|
1364
1364
|
};
|
|
1365
1365
|
o = c2.data;
|
|
1366
|
-
} else if (S
|
|
1366
|
+
} else if (S(r2))
|
|
1367
1367
|
o = r2;
|
|
1368
1368
|
else
|
|
1369
1369
|
return {
|
|
@@ -1418,9 +1418,9 @@ const f2 = Z, ee = {
|
|
|
1418
1418
|
}
|
|
1419
1419
|
};
|
|
1420
1420
|
function v(e, t2, r2) {
|
|
1421
|
-
const o = d
|
|
1421
|
+
const o = d(e, t2.op);
|
|
1422
1422
|
if (f2(o)) return o;
|
|
1423
|
-
const c2 = d
|
|
1423
|
+
const c2 = d(e, t2.op);
|
|
1424
1424
|
if (f2(c2)) return c2;
|
|
1425
1425
|
const s2 = r2(c2, o);
|
|
1426
1426
|
e.stack.push(s2);
|
|
@@ -1437,7 +1437,7 @@ const ne = {
|
|
|
1437
1437
|
if (L$1(r2) || c(r2))
|
|
1438
1438
|
return L$1(r2) && L$1(o) || c(r2) && c(o) ? r2.id === o.id : false;
|
|
1439
1439
|
{
|
|
1440
|
-
const c2 = F$
|
|
1440
|
+
const c2 = F$2(r2), s2 = F$2(o);
|
|
1441
1441
|
return !isNaN(c2) && !isNaN(s2) ? c2 === s2 : u(r2) === u(o);
|
|
1442
1442
|
}
|
|
1443
1443
|
})
|
|
@@ -1453,7 +1453,7 @@ const ne = {
|
|
|
1453
1453
|
if (L$1(r2) || c(r2))
|
|
1454
1454
|
return L$1(r2) && L$1(o) || c(r2) && c(o) ? r2.id !== o.id : true;
|
|
1455
1455
|
{
|
|
1456
|
-
const c2 = F$
|
|
1456
|
+
const c2 = F$2(r2), s2 = F$2(o);
|
|
1457
1457
|
return !isNaN(c2) && !isNaN(s2) ? c2 !== s2 : u(r2) !== u(o);
|
|
1458
1458
|
}
|
|
1459
1459
|
})
|
|
@@ -1462,7 +1462,7 @@ const ne = {
|
|
|
1462
1462
|
stackIn: 2,
|
|
1463
1463
|
stackOut: 1,
|
|
1464
1464
|
execute: (e, t2) => v(e, t2, (r2, o) => {
|
|
1465
|
-
const c2 = F$
|
|
1465
|
+
const c2 = F$2(r2), s2 = F$2(o);
|
|
1466
1466
|
return c2 < s2;
|
|
1467
1467
|
})
|
|
1468
1468
|
},
|
|
@@ -1470,7 +1470,7 @@ const ne = {
|
|
|
1470
1470
|
stackIn: 2,
|
|
1471
1471
|
stackOut: 1,
|
|
1472
1472
|
execute: (e, t2) => v(e, t2, (r2, o) => {
|
|
1473
|
-
const c2 = F$
|
|
1473
|
+
const c2 = F$2(r2), s2 = F$2(o);
|
|
1474
1474
|
return c2 > s2;
|
|
1475
1475
|
})
|
|
1476
1476
|
},
|
|
@@ -1478,7 +1478,7 @@ const ne = {
|
|
|
1478
1478
|
stackIn: 2,
|
|
1479
1479
|
stackOut: 1,
|
|
1480
1480
|
execute: (e, t2) => v(e, t2, (r2, o) => {
|
|
1481
|
-
const c2 = F$
|
|
1481
|
+
const c2 = F$2(r2), s2 = F$2(o);
|
|
1482
1482
|
return c2 <= s2;
|
|
1483
1483
|
})
|
|
1484
1484
|
},
|
|
@@ -1486,7 +1486,7 @@ const ne = {
|
|
|
1486
1486
|
stackIn: 2,
|
|
1487
1487
|
stackOut: 1,
|
|
1488
1488
|
execute: (e, t2) => v(e, t2, (r2, o) => {
|
|
1489
|
-
const c2 = F$
|
|
1489
|
+
const c2 = F$2(r2), s2 = F$2(o);
|
|
1490
1490
|
return c2 >= s2;
|
|
1491
1491
|
})
|
|
1492
1492
|
},
|
|
@@ -1505,9 +1505,9 @@ const ne = {
|
|
|
1505
1505
|
stackIn: 2,
|
|
1506
1506
|
stackOut: 1,
|
|
1507
1507
|
execute: (e, t2) => {
|
|
1508
|
-
const r2 = d
|
|
1508
|
+
const r2 = d(e, t2.op);
|
|
1509
1509
|
if (f2(r2)) return r2;
|
|
1510
|
-
const o = d
|
|
1510
|
+
const o = d(e, t2.op);
|
|
1511
1511
|
if (f2(o)) return o;
|
|
1512
1512
|
const c2 = M$2(o) ? r2 : o;
|
|
1513
1513
|
e.stack.push(c2);
|
|
@@ -1517,9 +1517,9 @@ const ne = {
|
|
|
1517
1517
|
stackIn: 2,
|
|
1518
1518
|
stackOut: 1,
|
|
1519
1519
|
execute: (e, t2) => {
|
|
1520
|
-
const r2 = d
|
|
1520
|
+
const r2 = d(e, t2.op);
|
|
1521
1521
|
if (f2(r2)) return r2;
|
|
1522
|
-
const o = d
|
|
1522
|
+
const o = d(e, t2.op);
|
|
1523
1523
|
if (f2(o)) return o;
|
|
1524
1524
|
const c2 = M$2(o) ? o : r2;
|
|
1525
1525
|
e.stack.push(c2);
|
|
@@ -1529,7 +1529,7 @@ const ne = {
|
|
|
1529
1529
|
stackIn: 1,
|
|
1530
1530
|
stackOut: 1,
|
|
1531
1531
|
execute: (e, t2) => {
|
|
1532
|
-
const r2 = d
|
|
1532
|
+
const r2 = d(e, t2.op);
|
|
1533
1533
|
if (f2(r2)) return r2;
|
|
1534
1534
|
const o = !M$2(r2);
|
|
1535
1535
|
e.stack.push(o);
|
|
@@ -1544,7 +1544,7 @@ const ne = {
|
|
|
1544
1544
|
stackIn: 0,
|
|
1545
1545
|
stackOut: 1,
|
|
1546
1546
|
execute: (e, t2) => {
|
|
1547
|
-
const r2 = Y$
|
|
1547
|
+
const r2 = Y$2(), o = e.heap.allocate("array", r2);
|
|
1548
1548
|
e.stack.push(o);
|
|
1549
1549
|
}
|
|
1550
1550
|
},
|
|
@@ -1568,7 +1568,7 @@ const ne = {
|
|
|
1568
1568
|
opcode: t2.op
|
|
1569
1569
|
};
|
|
1570
1570
|
c2 = s2.data;
|
|
1571
|
-
} else if (S
|
|
1571
|
+
} else if (S(o))
|
|
1572
1572
|
c2 = o;
|
|
1573
1573
|
else
|
|
1574
1574
|
return {
|
|
@@ -1609,7 +1609,7 @@ const ne = {
|
|
|
1609
1609
|
const u$1 = i2.data, y2 = u(r2), E3 = u$1.properties[y2] ?? s();
|
|
1610
1610
|
e.stack.push(E3);
|
|
1611
1611
|
return;
|
|
1612
|
-
} else if (S
|
|
1612
|
+
} else if (S(o))
|
|
1613
1613
|
c$1 = o;
|
|
1614
1614
|
else if (_$1(o)) {
|
|
1615
1615
|
let i2;
|
|
@@ -1679,7 +1679,7 @@ const ne = {
|
|
|
1679
1679
|
const u$1 = i2.data, y2 = u(o);
|
|
1680
1680
|
u$1.properties[y2] = r2, e.stack.push(c$1);
|
|
1681
1681
|
return;
|
|
1682
|
-
} else if (S
|
|
1682
|
+
} else if (S(c$1))
|
|
1683
1683
|
s2 = c$1;
|
|
1684
1684
|
else
|
|
1685
1685
|
return {
|
|
@@ -1733,7 +1733,7 @@ const ne = {
|
|
|
1733
1733
|
opcode: t2.op
|
|
1734
1734
|
};
|
|
1735
1735
|
o = c2.data;
|
|
1736
|
-
} else if (S
|
|
1736
|
+
} else if (S(r2))
|
|
1737
1737
|
o = r2;
|
|
1738
1738
|
else
|
|
1739
1739
|
return {
|
|
@@ -1765,7 +1765,7 @@ const ne = {
|
|
|
1765
1765
|
pc: e.pc,
|
|
1766
1766
|
opcode: t2.op
|
|
1767
1767
|
};
|
|
1768
|
-
const s2 = c$1.data, p2 = Y$
|
|
1768
|
+
const s2 = c$1.data, p2 = Y$2();
|
|
1769
1769
|
for (const i2 of s2.elements)
|
|
1770
1770
|
if (c(i2)) {
|
|
1771
1771
|
const u$1 = e.heap.get(i2.id);
|
|
@@ -1800,7 +1800,7 @@ const ne = {
|
|
|
1800
1800
|
pc: e.pc,
|
|
1801
1801
|
opcode: t2.op
|
|
1802
1802
|
};
|
|
1803
|
-
const s2 = c$1.data, p2 = Y$
|
|
1803
|
+
const s2 = c$1.data, p2 = Y$2();
|
|
1804
1804
|
for (const i2 of s2.elements)
|
|
1805
1805
|
if (c(i2)) {
|
|
1806
1806
|
const u$1 = e.heap.get(i2.id);
|
|
@@ -1831,7 +1831,7 @@ const ne = {
|
|
|
1831
1831
|
pc: e.pc,
|
|
1832
1832
|
opcode: t2.op
|
|
1833
1833
|
};
|
|
1834
|
-
const a2 = e.heap.get(c2.id).data, i2 = E$2(o) ? o : 0, u2 = r2 === void 0 ? a2.elements.length : E$2(r2) ? r2 : a2.elements.length, y2 = i2 < 0 ? Math.max(0, a2.elements.length + i2) : i2, E3 = u2 < 0 ? Math.max(0, a2.elements.length + u2) : u2, Y2 = a2.elements.slice(y2, E3), z2 = Y$
|
|
1834
|
+
const a2 = e.heap.get(c2.id).data, i2 = E$2(o) ? o : 0, u2 = r2 === void 0 ? a2.elements.length : E$2(r2) ? r2 : a2.elements.length, y2 = i2 < 0 ? Math.max(0, a2.elements.length + i2) : i2, E3 = u2 < 0 ? Math.max(0, a2.elements.length + u2) : u2, Y2 = a2.elements.slice(y2, E3), z2 = Y$2(Y2), B2 = e.heap.allocate("array", z2);
|
|
1835
1835
|
e.stack.push(B2);
|
|
1836
1836
|
}
|
|
1837
1837
|
},
|
|
@@ -1893,7 +1893,7 @@ function M(e, t2) {
|
|
|
1893
1893
|
if (typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e && typeof e == "object" && e.type === "array" && Array.isArray(e.elements))
|
|
1894
1894
|
return e;
|
|
1895
1895
|
if (Array.isArray(e)) {
|
|
1896
|
-
const r2 = Y$
|
|
1896
|
+
const r2 = Y$2();
|
|
1897
1897
|
return r2.elements = e.map((o) => M(o, t2)), t2.allocate("array", r2);
|
|
1898
1898
|
}
|
|
1899
1899
|
if (e && typeof e == "object" && e.type === "object" && e.properties)
|
|
@@ -1912,9 +1912,9 @@ const ie = {
|
|
|
1912
1912
|
stackIn: 2,
|
|
1913
1913
|
stackOut: 1,
|
|
1914
1914
|
execute: (e, t2) => {
|
|
1915
|
-
const r2 = d
|
|
1915
|
+
const r2 = d(e, t2.op);
|
|
1916
1916
|
if (f2(r2)) return r2;
|
|
1917
|
-
const o = d
|
|
1917
|
+
const o = d(e, t2.op);
|
|
1918
1918
|
if (f2(o)) return o;
|
|
1919
1919
|
e.stack.push(u(o) + u(r2));
|
|
1920
1920
|
}
|
|
@@ -1923,7 +1923,7 @@ const ie = {
|
|
|
1923
1923
|
stackIn: 1,
|
|
1924
1924
|
stackOut: 1,
|
|
1925
1925
|
execute: (e, t2) => {
|
|
1926
|
-
const r2 = d
|
|
1926
|
+
const r2 = d(e, t2.op);
|
|
1927
1927
|
if (f2(r2)) return r2;
|
|
1928
1928
|
if (!_$1(r2))
|
|
1929
1929
|
return {
|
|
@@ -1939,11 +1939,11 @@ const ie = {
|
|
|
1939
1939
|
stackIn: 1,
|
|
1940
1940
|
stackOut: 1,
|
|
1941
1941
|
execute: (e, t2) => {
|
|
1942
|
-
const r2 = d
|
|
1942
|
+
const r2 = d(e, t2.op);
|
|
1943
1943
|
if (f2(r2)) return r2;
|
|
1944
1944
|
if (_$1(r2))
|
|
1945
1945
|
e.stack.push(r2.length);
|
|
1946
|
-
else if (S
|
|
1946
|
+
else if (S(r2))
|
|
1947
1947
|
e.stack.push(r2.elements.length);
|
|
1948
1948
|
else if (L$1(r2)) {
|
|
1949
1949
|
const o = e.heap.get(r2.id);
|
|
@@ -1969,7 +1969,7 @@ const ie = {
|
|
|
1969
1969
|
stackIn: 1,
|
|
1970
1970
|
stackOut: 1,
|
|
1971
1971
|
execute: (e, t2) => {
|
|
1972
|
-
const r2 = d
|
|
1972
|
+
const r2 = d(e, t2.op);
|
|
1973
1973
|
if (f2(r2)) return r2;
|
|
1974
1974
|
if (!_$1(r2))
|
|
1975
1975
|
return {
|
|
@@ -1990,7 +1990,7 @@ const ie = {
|
|
|
1990
1990
|
stackIn: 1,
|
|
1991
1991
|
stackOut: 1,
|
|
1992
1992
|
execute: (e, t2) => {
|
|
1993
|
-
const r2 = d
|
|
1993
|
+
const r2 = d(e, t2.op);
|
|
1994
1994
|
if (f2(r2)) return r2;
|
|
1995
1995
|
e.stack.push(y$1(r2));
|
|
1996
1996
|
}
|
|
@@ -2008,10 +2008,10 @@ const ie = {
|
|
|
2008
2008
|
pc: e.pc,
|
|
2009
2009
|
opcode: t2.op
|
|
2010
2010
|
};
|
|
2011
|
-
const o = e.variables.get(r2) ?? 0, c2 = F$
|
|
2011
|
+
const o = e.variables.get(r2) ?? 0, c2 = F$2(o) + 1;
|
|
2012
2012
|
e.variables.set(r2, c2);
|
|
2013
2013
|
const s2 = t2.arg === true;
|
|
2014
|
-
e.stack.push(s2 ? F$
|
|
2014
|
+
e.stack.push(s2 ? F$2(o) : c2);
|
|
2015
2015
|
}
|
|
2016
2016
|
},
|
|
2017
2017
|
[P$1.DEC]: {
|
|
@@ -2026,10 +2026,10 @@ const ie = {
|
|
|
2026
2026
|
pc: e.pc,
|
|
2027
2027
|
opcode: t2.op
|
|
2028
2028
|
};
|
|
2029
|
-
const o = e.variables.get(r2) ?? 0, c2 = F$
|
|
2029
|
+
const o = e.variables.get(r2) ?? 0, c2 = F$2(o) - 1;
|
|
2030
2030
|
e.variables.set(r2, c2);
|
|
2031
2031
|
const s2 = t2.arg === true;
|
|
2032
|
-
e.stack.push(s2 ? F$
|
|
2032
|
+
e.stack.push(s2 ? F$2(o) : c2);
|
|
2033
2033
|
}
|
|
2034
2034
|
}
|
|
2035
2035
|
}, le = {
|
|
@@ -2113,7 +2113,7 @@ const ie = {
|
|
|
2113
2113
|
filter: i2.properties.filter
|
|
2114
2114
|
};
|
|
2115
2115
|
}
|
|
2116
|
-
} else e.stack.length >= 2 && typeof c$1 == "object" && c$1 !== null && !S
|
|
2116
|
+
} else e.stack.length >= 2 && typeof c$1 == "object" && c$1 !== null && !S(c$1) && (o = e.stack.pop()), r2 = e.stack.pop();
|
|
2117
2117
|
if (!_$1(r2))
|
|
2118
2118
|
return {
|
|
2119
2119
|
type: "RuntimeError",
|
|
@@ -2129,7 +2129,7 @@ const ie = {
|
|
|
2129
2129
|
opcode: t2.op
|
|
2130
2130
|
};
|
|
2131
2131
|
const s2 = e.fileSystem.listFiles(r2, o);
|
|
2132
|
-
if (S
|
|
2132
|
+
if (S(s2)) {
|
|
2133
2133
|
const p2 = e.heap.allocate("array", s2);
|
|
2134
2134
|
e.stack.push(p2);
|
|
2135
2135
|
} else
|
|
@@ -2258,7 +2258,7 @@ const ie = {
|
|
|
2258
2258
|
};
|
|
2259
2259
|
let c2;
|
|
2260
2260
|
r2 === "" ? c2 = o.split("") : c2 = o.split(r2);
|
|
2261
|
-
const s2 = Y$
|
|
2261
|
+
const s2 = Y$2(c2), p2 = e.heap.allocate("array", s2);
|
|
2262
2262
|
e.stack.push(p2);
|
|
2263
2263
|
}
|
|
2264
2264
|
},
|
|
@@ -2578,27 +2578,27 @@ const ie = {
|
|
|
2578
2578
|
}
|
|
2579
2579
|
}
|
|
2580
2580
|
};
|
|
2581
|
-
function A(e, t2) {
|
|
2581
|
+
function A$1(e, t2) {
|
|
2582
2582
|
if (L$1(e)) {
|
|
2583
2583
|
const r2 = t2.get(e.id);
|
|
2584
|
-
return r2 && r2.type === "array" ? r2.data.elements.map((c2) => A(c2, t2)) : null;
|
|
2584
|
+
return r2 && r2.type === "array" ? r2.data.elements.map((c2) => A$1(c2, t2)) : null;
|
|
2585
2585
|
}
|
|
2586
2586
|
if (c(e)) {
|
|
2587
2587
|
const r2 = t2.get(e.id);
|
|
2588
2588
|
if (r2 && r2.type === "object") {
|
|
2589
2589
|
const o = r2.data, c2 = {};
|
|
2590
2590
|
for (const [s2, p2] of Object.entries(o.properties))
|
|
2591
|
-
c2[s2] = A(p2, t2);
|
|
2591
|
+
c2[s2] = A$1(p2, t2);
|
|
2592
2592
|
return c2;
|
|
2593
2593
|
}
|
|
2594
2594
|
return null;
|
|
2595
2595
|
}
|
|
2596
|
-
if (S
|
|
2597
|
-
return e.elements.map((r2) => A(r2, t2));
|
|
2596
|
+
if (S(e))
|
|
2597
|
+
return e.elements.map((r2) => A$1(r2, t2));
|
|
2598
2598
|
if (i(e)) {
|
|
2599
2599
|
const r2 = {};
|
|
2600
2600
|
for (const [o, c2] of Object.entries(e.properties))
|
|
2601
|
-
r2[o] = A(c2, t2);
|
|
2601
|
+
r2[o] = A$1(c2, t2);
|
|
2602
2602
|
return r2;
|
|
2603
2603
|
}
|
|
2604
2604
|
if (!I$1(e))
|
|
@@ -2617,11 +2617,11 @@ const de = {
|
|
|
2617
2617
|
stackIn: 3,
|
|
2618
2618
|
stackOut: 1,
|
|
2619
2619
|
execute: (e, t2) => {
|
|
2620
|
-
const r2 = d
|
|
2620
|
+
const r2 = d(e, t2.op);
|
|
2621
2621
|
if (f2(r2)) return r2;
|
|
2622
|
-
const o = d
|
|
2622
|
+
const o = d(e, t2.op);
|
|
2623
2623
|
if (f2(o)) return o;
|
|
2624
|
-
const c$1 = d
|
|
2624
|
+
const c$1 = d(e, t2.op);
|
|
2625
2625
|
if (f2(c$1)) return c$1;
|
|
2626
2626
|
let s2;
|
|
2627
2627
|
if (c(c$1)) {
|
|
@@ -2651,9 +2651,9 @@ const de = {
|
|
|
2651
2651
|
stackIn: 2,
|
|
2652
2652
|
stackOut: 1,
|
|
2653
2653
|
execute: (e, t$1) => {
|
|
2654
|
-
const r2 = d
|
|
2654
|
+
const r2 = d(e, t$1.op);
|
|
2655
2655
|
if (f2(r2)) return r2;
|
|
2656
|
-
const o = d
|
|
2656
|
+
const o = d(e, t$1.op);
|
|
2657
2657
|
if (f2(o)) return o;
|
|
2658
2658
|
if (t(o) || I$1(o))
|
|
2659
2659
|
return {
|
|
@@ -2687,9 +2687,9 @@ const de = {
|
|
|
2687
2687
|
stackIn: 1,
|
|
2688
2688
|
stackOut: 1,
|
|
2689
2689
|
execute: (e, t2) => {
|
|
2690
|
-
const r2 = d
|
|
2690
|
+
const r2 = d(e, t2.op);
|
|
2691
2691
|
if (f2(r2)) return r2;
|
|
2692
|
-
const o = A(r2, e.heap);
|
|
2692
|
+
const o = A$1(r2, e.heap);
|
|
2693
2693
|
e.stack.push(JSON.stringify(o));
|
|
2694
2694
|
}
|
|
2695
2695
|
},
|
|
@@ -2697,7 +2697,7 @@ const de = {
|
|
|
2697
2697
|
stackIn: 1,
|
|
2698
2698
|
stackOut: 1,
|
|
2699
2699
|
execute: (e, t2) => {
|
|
2700
|
-
const r2 = d
|
|
2700
|
+
const r2 = d(e, t2.op);
|
|
2701
2701
|
if (f2(r2)) return r2;
|
|
2702
2702
|
if (c(r2)) {
|
|
2703
2703
|
const o = e.heap.get(r2.id);
|
|
@@ -2718,7 +2718,7 @@ const de = {
|
|
|
2718
2718
|
stackIn: 1,
|
|
2719
2719
|
stackOut: 0,
|
|
2720
2720
|
execute: (e, t2) => {
|
|
2721
|
-
const r2 = d
|
|
2721
|
+
const r2 = d(e, t2.op);
|
|
2722
2722
|
if (f2(r2)) return r2;
|
|
2723
2723
|
if (c(r2)) {
|
|
2724
2724
|
const o = e.heap.get(r2.id);
|
|
@@ -2943,9 +2943,9 @@ const de = {
|
|
|
2943
2943
|
stackOut: 1,
|
|
2944
2944
|
// Produces boolean result
|
|
2945
2945
|
execute: (e, t2) => {
|
|
2946
|
-
const r2 = d
|
|
2946
|
+
const r2 = d(e, t2.op);
|
|
2947
2947
|
if (f2(r2)) return r2;
|
|
2948
|
-
const o = d
|
|
2948
|
+
const o = d(e, t2.op);
|
|
2949
2949
|
if (f2(o)) return o;
|
|
2950
2950
|
if (typeof r2 != "string")
|
|
2951
2951
|
return {
|
|
@@ -2996,9 +2996,9 @@ const de = {
|
|
|
2996
2996
|
stackOut: 1,
|
|
2997
2997
|
// Produces array reference or null
|
|
2998
2998
|
execute: (e, t2) => {
|
|
2999
|
-
const r2 = d
|
|
2999
|
+
const r2 = d(e, t2.op);
|
|
3000
3000
|
if (f2(r2)) return r2;
|
|
3001
|
-
const o = d
|
|
3001
|
+
const o = d(e, t2.op);
|
|
3002
3002
|
if (f2(o)) return o;
|
|
3003
3003
|
if (typeof o != "string")
|
|
3004
3004
|
return {
|
|
@@ -3058,11 +3058,11 @@ const de = {
|
|
|
3058
3058
|
stackOut: 1,
|
|
3059
3059
|
// Produces new string
|
|
3060
3060
|
execute: (e, t2) => {
|
|
3061
|
-
const r2 = d
|
|
3061
|
+
const r2 = d(e, t2.op);
|
|
3062
3062
|
if (f2(r2)) return r2;
|
|
3063
|
-
const o = d
|
|
3063
|
+
const o = d(e, t2.op);
|
|
3064
3064
|
if (f2(o)) return o;
|
|
3065
|
-
const c$1 = d
|
|
3065
|
+
const c$1 = d(e, t2.op);
|
|
3066
3066
|
if (f2(c$1)) return c$1;
|
|
3067
3067
|
if (typeof c$1 != "string")
|
|
3068
3068
|
return {
|
|
@@ -3268,7 +3268,7 @@ class G {
|
|
|
3268
3268
|
return this.execute(o, s2, c2 || t2.fileSystem);
|
|
3269
3269
|
}
|
|
3270
3270
|
}
|
|
3271
|
-
class $ {
|
|
3271
|
+
let $$1 = class $ {
|
|
3272
3272
|
constructor() {
|
|
3273
3273
|
b(this, "sandboxPaths", []);
|
|
3274
3274
|
const t2 = process.env.CVM_SANDBOX_PATHS, r2 = process.env.CVM_SANDBOX_ROOT;
|
|
@@ -3281,7 +3281,7 @@ class $ {
|
|
|
3281
3281
|
);
|
|
3282
3282
|
}
|
|
3283
3283
|
listFiles(t2, r2 = {}) {
|
|
3284
|
-
const o = Y$
|
|
3284
|
+
const o = Y$2();
|
|
3285
3285
|
if (!this.isPathAllowed(t2))
|
|
3286
3286
|
return o;
|
|
3287
3287
|
try {
|
|
@@ -3339,14 +3339,14 @@ class $ {
|
|
|
3339
3339
|
return false;
|
|
3340
3340
|
}
|
|
3341
3341
|
}
|
|
3342
|
-
}
|
|
3343
|
-
new
|
|
3342
|
+
};
|
|
3343
|
+
new $$1();
|
|
3344
3344
|
class ve {
|
|
3345
3345
|
constructor(t2, r2) {
|
|
3346
3346
|
b(this, "vms", /* @__PURE__ */ new Map());
|
|
3347
3347
|
b(this, "storage");
|
|
3348
3348
|
b(this, "fileSystem");
|
|
3349
|
-
t2 ? this.storage = t2 : this.storage = E2.create(), this.fileSystem = r2 || new
|
|
3349
|
+
t2 ? this.storage = t2 : this.storage = E2.create(), this.fileSystem = r2 || new $$1();
|
|
3350
3350
|
}
|
|
3351
3351
|
/**
|
|
3352
3352
|
* Initialize the VMManager (connect to database)
|
|
@@ -3637,109 +3637,130 @@ class ve {
|
|
|
3637
3637
|
return t2;
|
|
3638
3638
|
}
|
|
3639
3639
|
}
|
|
3640
|
-
var
|
|
3641
|
-
var
|
|
3642
|
-
var
|
|
3643
|
-
const
|
|
3644
|
-
function
|
|
3645
|
-
const
|
|
3646
|
-
`)
|
|
3647
|
-
let
|
|
3648
|
-
|
|
3640
|
+
var U = Object.defineProperty;
|
|
3641
|
+
var A = (h2, r2, e) => r2 in h2 ? U(h2, r2, { enumerable: true, configurable: true, writable: true, value: e }) : h2[r2] = e;
|
|
3642
|
+
var $2 = (h2, r2, e) => A(h2, typeof r2 != "symbol" ? r2 + "" : r2, e);
|
|
3643
|
+
const F = /^\d{2}-[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
3644
|
+
function j(h2) {
|
|
3645
|
+
const r2 = h2.split(`
|
|
3646
|
+
`);
|
|
3647
|
+
let e = 0;
|
|
3648
|
+
for (; e < r2.length; ) {
|
|
3649
|
+
if (r2[e].trim().startsWith("<files>")) {
|
|
3650
|
+
const t2 = [];
|
|
3651
|
+
for (e++; e < r2.length && !r2[e].trim().startsWith("</files>"); ) {
|
|
3652
|
+
const s2 = r2[e].trim().match(/^-\s+(.+)/);
|
|
3653
|
+
if (s2) {
|
|
3654
|
+
const c2 = s2[1].trim();
|
|
3655
|
+
c2 && t2.push(c2);
|
|
3656
|
+
}
|
|
3657
|
+
e++;
|
|
3658
|
+
}
|
|
3659
|
+
return t2;
|
|
3660
|
+
}
|
|
3661
|
+
e++;
|
|
3662
|
+
}
|
|
3663
|
+
return [];
|
|
3664
|
+
}
|
|
3665
|
+
function T(h2, r2, e) {
|
|
3666
|
+
const t2 = h2.split(`
|
|
3667
|
+
`), s2 = [];
|
|
3668
|
+
let c2 = "", m = -1;
|
|
3669
|
+
const y2 = [], d2 = /* @__PURE__ */ new Set();
|
|
3649
3670
|
let n2 = 0;
|
|
3650
3671
|
for (; n2 < t2.length; ) {
|
|
3651
3672
|
if (t2[n2].trim().startsWith("<mission>")) {
|
|
3652
|
-
|
|
3673
|
+
m = n2;
|
|
3653
3674
|
const a2 = t2[n2].trim().replace("<mission>", "").replace("</mission>", "").trim();
|
|
3654
3675
|
if (t2[n2].trim().endsWith("</mission>")) {
|
|
3655
|
-
|
|
3676
|
+
c2 = a2, n2++;
|
|
3656
3677
|
break;
|
|
3657
3678
|
}
|
|
3658
|
-
const
|
|
3659
|
-
for (a2 &&
|
|
3660
|
-
|
|
3661
|
-
n2 < t2.length && n2++,
|
|
3679
|
+
const i2 = [];
|
|
3680
|
+
for (a2 && i2.push(a2), n2++; n2 < t2.length && !t2[n2].trim().startsWith("</mission>"); )
|
|
3681
|
+
i2.push(t2[n2]), n2++;
|
|
3682
|
+
n2 < t2.length && n2++, c2 = i2.join(`
|
|
3662
3683
|
`).trim();
|
|
3663
3684
|
break;
|
|
3664
3685
|
}
|
|
3665
3686
|
n2++;
|
|
3666
3687
|
}
|
|
3667
|
-
for (
|
|
3688
|
+
for (m === -1 ? ((e == null ? void 0 : e.requireMission) !== false && s2.push({ line: 0, message: "Missing <mission> tag" }), n2 = 0) : c2 || s2.push({ line: m + 1, message: "<mission> tag is empty" }); n2 < t2.length; ) {
|
|
3668
3689
|
const a2 = t2[n2].trim().match(/^<block\s+id="([^"]+)">/);
|
|
3669
3690
|
if (!a2) {
|
|
3670
3691
|
n2++;
|
|
3671
3692
|
continue;
|
|
3672
3693
|
}
|
|
3673
|
-
const
|
|
3674
|
-
|
|
3675
|
-
let k2 = "",
|
|
3694
|
+
const i2 = a2[1], p2 = n2;
|
|
3695
|
+
F.test(i2) || s2.push({ line: n2 + 1, message: `Block id "${i2}" must be NN-kebab-case format` }), d2.has(i2) && s2.push({ line: n2 + 1, message: `Duplicate block id "${i2}"` }), d2.add(i2);
|
|
3696
|
+
let k2 = "", u2 = "", g2 = [], w2 = [], E3 = -1, l = false, x = false, N2 = false;
|
|
3676
3697
|
for (n2++; n2 < t2.length; ) {
|
|
3677
|
-
const
|
|
3678
|
-
if (
|
|
3679
|
-
|
|
3698
|
+
const v2 = t2[n2].trim();
|
|
3699
|
+
if (v2.startsWith("</block>")) {
|
|
3700
|
+
E3 = n2, n2++;
|
|
3680
3701
|
break;
|
|
3681
3702
|
}
|
|
3682
|
-
const
|
|
3683
|
-
if (
|
|
3684
|
-
k2 =
|
|
3703
|
+
const S2 = v2.match(/^##\s+TDDAB-\d+:\s+(.+)/);
|
|
3704
|
+
if (S2) {
|
|
3705
|
+
k2 = S2[1], n2++;
|
|
3685
3706
|
continue;
|
|
3686
3707
|
}
|
|
3687
|
-
if (
|
|
3688
|
-
|
|
3689
|
-
const
|
|
3690
|
-
if (
|
|
3691
|
-
|
|
3708
|
+
if (v2.startsWith("<intro>")) {
|
|
3709
|
+
l = true;
|
|
3710
|
+
const f3 = [], M2 = v2.replace("<intro>", "").replace("</intro>", "").trim();
|
|
3711
|
+
if (v2.includes("</intro>")) {
|
|
3712
|
+
u2 = M2, n2++;
|
|
3692
3713
|
continue;
|
|
3693
3714
|
}
|
|
3694
|
-
for (
|
|
3695
|
-
|
|
3696
|
-
n2 < t2.length && n2++,
|
|
3715
|
+
for (M2 && f3.push(M2), n2++; n2 < t2.length && !t2[n2].trim().startsWith("</intro>"); )
|
|
3716
|
+
f3.push(t2[n2]), n2++;
|
|
3717
|
+
n2 < t2.length && n2++, u2 = f3.join(`
|
|
3697
3718
|
`).trim();
|
|
3698
3719
|
continue;
|
|
3699
3720
|
}
|
|
3700
|
-
if (
|
|
3701
|
-
for (
|
|
3702
|
-
const
|
|
3703
|
-
|
|
3721
|
+
if (v2.startsWith("<red>")) {
|
|
3722
|
+
for (x = true, n2++; n2 < t2.length && !t2[n2].trim().startsWith("</red>"); ) {
|
|
3723
|
+
const f3 = t2[n2].trim().match(/^-\s*test:\s*(.+)/);
|
|
3724
|
+
f3 && g2.push(f3[1].trim()), n2++;
|
|
3704
3725
|
}
|
|
3705
3726
|
n2 < t2.length && n2++;
|
|
3706
3727
|
continue;
|
|
3707
3728
|
}
|
|
3708
|
-
if (
|
|
3709
|
-
for (
|
|
3710
|
-
const
|
|
3711
|
-
|
|
3729
|
+
if (v2.startsWith("<success>")) {
|
|
3730
|
+
for (N2 = true, n2++; n2 < t2.length && !t2[n2].trim().startsWith("</success>"); ) {
|
|
3731
|
+
const f3 = t2[n2].trim().match(/^-\s*\[\s*\]\s*(.+)/);
|
|
3732
|
+
f3 && w2.push(f3[1].trim()), n2++;
|
|
3712
3733
|
}
|
|
3713
3734
|
n2 < t2.length && n2++;
|
|
3714
3735
|
continue;
|
|
3715
3736
|
}
|
|
3716
3737
|
n2++;
|
|
3717
3738
|
}
|
|
3718
|
-
|
|
3719
|
-
id:
|
|
3739
|
+
E3 === -1 && (s2.push({ line: p2 + 1, message: `Block "${i2}" never closed with </block>` }), E3 = t2.length - 1), l ? u2 || s2.push({ line: p2 + 1, message: `Block "${i2}" has empty <intro>` }) : s2.push({ line: p2 + 1, message: `Block "${i2}" missing <intro> tag` }), x ? g2.length === 0 && s2.push({ line: p2 + 1, message: `Block "${i2}" has <red> but no "- test:" lines` }) : s2.push({ line: p2 + 1, message: `Block "${i2}" missing <red> tag` }), N2 ? w2.length === 0 && s2.push({ line: p2 + 1, message: `Block "${i2}" has <success> but no "- [ ]" items` }) : s2.push({ line: p2 + 1, message: `Block "${i2}" missing <success> tag` }), y2.push({
|
|
3740
|
+
id: i2,
|
|
3720
3741
|
title: k2,
|
|
3721
|
-
intro:
|
|
3722
|
-
redTests:
|
|
3723
|
-
success:
|
|
3742
|
+
intro: u2,
|
|
3743
|
+
redTests: g2,
|
|
3744
|
+
success: w2,
|
|
3724
3745
|
startLine: p2 + 1,
|
|
3725
|
-
endLine:
|
|
3746
|
+
endLine: E3 + 1
|
|
3726
3747
|
});
|
|
3727
3748
|
}
|
|
3728
|
-
return
|
|
3749
|
+
return y2.length === 0 && (e == null ? void 0 : e.requireBlocks) !== false && !s2.some((a2) => a2.message.includes("block")) && s2.push({ line: 0, message: "No <block> tags found" }), s2.length > 0 ? { valid: false, plan: null, errors: s2 } : {
|
|
3729
3750
|
valid: true,
|
|
3730
|
-
plan: { mission:
|
|
3751
|
+
plan: { mission: c2, blocks: y2, sourceFile: r2 },
|
|
3731
3752
|
errors: []
|
|
3732
3753
|
};
|
|
3733
3754
|
}
|
|
3734
3755
|
const J = {
|
|
3735
3756
|
"@planexecutor": "planexecutor.ts"
|
|
3736
3757
|
};
|
|
3737
|
-
class
|
|
3758
|
+
class Y {
|
|
3738
3759
|
constructor(r2 = "0.0.1") {
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3760
|
+
$2(this, "server");
|
|
3761
|
+
$2(this, "transport", null);
|
|
3762
|
+
$2(this, "vmManager");
|
|
3763
|
+
$2(this, "version");
|
|
3743
3764
|
this.version = r2, this.vmManager = new ve(), this.server = new mcp_js.McpServer({
|
|
3744
3765
|
name: "cvm-server",
|
|
3745
3766
|
version: this.version
|
|
@@ -3758,14 +3779,14 @@ class Q {
|
|
|
3758
3779
|
programId: zod.z.string(),
|
|
3759
3780
|
source: zod.z.string()
|
|
3760
3781
|
},
|
|
3761
|
-
async ({ programId: r2, source:
|
|
3782
|
+
async ({ programId: r2, source: e }) => {
|
|
3762
3783
|
try {
|
|
3763
|
-
return await this.vmManager.loadProgram(r2,
|
|
3784
|
+
return await this.vmManager.loadProgram(r2, e), {
|
|
3764
3785
|
content: [{ type: "text", text: `Program loaded successfully: ${r2}` }]
|
|
3765
3786
|
};
|
|
3766
|
-
} catch (
|
|
3787
|
+
} catch (t2) {
|
|
3767
3788
|
return {
|
|
3768
|
-
content: [{ type: "text", text: `Error: ${
|
|
3789
|
+
content: [{ type: "text", text: `Error: ${t2 instanceof Error ? t2.message : "Unknown error"}` }],
|
|
3769
3790
|
isError: true
|
|
3770
3791
|
};
|
|
3771
3792
|
}
|
|
@@ -3776,35 +3797,35 @@ class Q {
|
|
|
3776
3797
|
programId: zod.z.string(),
|
|
3777
3798
|
filePath: zod.z.string()
|
|
3778
3799
|
},
|
|
3779
|
-
async ({ programId: r2, filePath:
|
|
3800
|
+
async ({ programId: r2, filePath: e }) => {
|
|
3780
3801
|
try {
|
|
3781
|
-
let
|
|
3782
|
-
const s2 = J[
|
|
3802
|
+
let t2;
|
|
3803
|
+
const s2 = J[e];
|
|
3783
3804
|
if (s2) {
|
|
3784
|
-
const
|
|
3785
|
-
|
|
3805
|
+
const m = r$2.dirname(url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("main.cjs", document.baseURI).href));
|
|
3806
|
+
t2 = r$2.join(m, "programs", s2);
|
|
3786
3807
|
} else
|
|
3787
|
-
|
|
3788
|
-
const c2 = await promises.readFile(
|
|
3808
|
+
t2 = r$2.resolve(e);
|
|
3809
|
+
const c2 = await promises.readFile(t2, "utf-8");
|
|
3789
3810
|
return await this.vmManager.loadProgram(r2, c2), {
|
|
3790
|
-
content: [{ type: "text", text: `Program loaded successfully from ${
|
|
3811
|
+
content: [{ type: "text", text: `Program loaded successfully from ${e}: ${r2}` }]
|
|
3791
3812
|
};
|
|
3792
|
-
} catch (
|
|
3793
|
-
if (
|
|
3794
|
-
const s2 =
|
|
3813
|
+
} catch (t2) {
|
|
3814
|
+
if (t2 instanceof Error) {
|
|
3815
|
+
const s2 = t2;
|
|
3795
3816
|
if (s2.code === "ENOENT")
|
|
3796
3817
|
return {
|
|
3797
|
-
content: [{ type: "text", text: `Error: File not found: ${
|
|
3818
|
+
content: [{ type: "text", text: `Error: File not found: ${e}` }],
|
|
3798
3819
|
isError: true
|
|
3799
3820
|
};
|
|
3800
3821
|
if (s2.code === "EACCES")
|
|
3801
3822
|
return {
|
|
3802
|
-
content: [{ type: "text", text: `Error: Permission denied: ${
|
|
3823
|
+
content: [{ type: "text", text: `Error: Permission denied: ${e}` }],
|
|
3803
3824
|
isError: true
|
|
3804
3825
|
};
|
|
3805
3826
|
}
|
|
3806
3827
|
return {
|
|
3807
|
-
content: [{ type: "text", text: `Error: ${
|
|
3828
|
+
content: [{ type: "text", text: `Error: ${t2 instanceof Error ? t2.message : "Unknown error"}` }],
|
|
3808
3829
|
isError: true
|
|
3809
3830
|
};
|
|
3810
3831
|
}
|
|
@@ -3816,10 +3837,10 @@ class Q {
|
|
|
3816
3837
|
executionId: zod.z.string(),
|
|
3817
3838
|
setCurrent: zod.z.boolean().optional()
|
|
3818
3839
|
},
|
|
3819
|
-
async ({ programId: r2, executionId:
|
|
3840
|
+
async ({ programId: r2, executionId: e, setCurrent: t2 = true }) => {
|
|
3820
3841
|
try {
|
|
3821
|
-
return await this.vmManager.startExecution(r2,
|
|
3822
|
-
content: [{ type: "text", text: `Execution started: ${
|
|
3842
|
+
return await this.vmManager.startExecution(r2, e), t2 && await this.vmManager.setCurrentExecutionId(e), {
|
|
3843
|
+
content: [{ type: "text", text: `Execution started: ${e}${t2 ? " (set as current)" : ""}` }]
|
|
3823
3844
|
};
|
|
3824
3845
|
} catch (s2) {
|
|
3825
3846
|
return {
|
|
@@ -3835,30 +3856,30 @@ class Q {
|
|
|
3835
3856
|
},
|
|
3836
3857
|
async ({ executionId: r2 }) => {
|
|
3837
3858
|
try {
|
|
3838
|
-
let
|
|
3839
|
-
if (!
|
|
3859
|
+
let e = r2;
|
|
3860
|
+
if (!e) {
|
|
3840
3861
|
const s2 = await this.vmManager.getCurrentExecutionId();
|
|
3841
3862
|
if (!s2)
|
|
3842
3863
|
return {
|
|
3843
3864
|
content: [{ type: "text", text: "No current execution set. Use list_executions to see available executions." }]
|
|
3844
3865
|
};
|
|
3845
|
-
|
|
3866
|
+
e = s2;
|
|
3846
3867
|
}
|
|
3847
|
-
const
|
|
3848
|
-
return
|
|
3849
|
-
content: [{ type: "text", text:
|
|
3850
|
-
} :
|
|
3851
|
-
content: [{ type: "text", text:
|
|
3852
|
-
} :
|
|
3853
|
-
content: [{ type: "text", text: `Error: ${
|
|
3868
|
+
const t2 = await this.vmManager.getNext(e);
|
|
3869
|
+
return t2.type === "completed" ? {
|
|
3870
|
+
content: [{ type: "text", text: t2.result !== void 0 ? `Execution completed with result: ${JSON.stringify(t2.result)}` : "Execution completed" }]
|
|
3871
|
+
} : t2.type === "waiting" ? {
|
|
3872
|
+
content: [{ type: "text", text: t2.message || "Waiting for input" }]
|
|
3873
|
+
} : t2.type === "error" ? {
|
|
3874
|
+
content: [{ type: "text", text: `Error: ${t2.error}` }],
|
|
3854
3875
|
isError: true
|
|
3855
3876
|
} : {
|
|
3856
3877
|
content: [{ type: "text", text: "Unexpected state" }],
|
|
3857
3878
|
isError: true
|
|
3858
3879
|
};
|
|
3859
|
-
} catch (
|
|
3880
|
+
} catch (e) {
|
|
3860
3881
|
return {
|
|
3861
|
-
content: [{ type: "text", text: `Error: ${
|
|
3882
|
+
content: [{ type: "text", text: `Error: ${e instanceof Error ? e.message : "Unknown error"}` }],
|
|
3862
3883
|
isError: true
|
|
3863
3884
|
};
|
|
3864
3885
|
}
|
|
@@ -3869,24 +3890,24 @@ class Q {
|
|
|
3869
3890
|
executionId: zod.z.string().optional(),
|
|
3870
3891
|
result: zod.z.string()
|
|
3871
3892
|
},
|
|
3872
|
-
async ({ executionId: r2, result:
|
|
3893
|
+
async ({ executionId: r2, result: e }) => {
|
|
3873
3894
|
try {
|
|
3874
|
-
let
|
|
3875
|
-
if (!
|
|
3895
|
+
let t2 = r2;
|
|
3896
|
+
if (!t2) {
|
|
3876
3897
|
const s2 = await this.vmManager.getCurrentExecutionId();
|
|
3877
3898
|
if (!s2)
|
|
3878
3899
|
return {
|
|
3879
3900
|
content: [{ type: "text", text: "Error: No current execution set" }],
|
|
3880
3901
|
isError: true
|
|
3881
3902
|
};
|
|
3882
|
-
|
|
3903
|
+
t2 = s2;
|
|
3883
3904
|
}
|
|
3884
|
-
return await this.vmManager.reportCCResult(
|
|
3905
|
+
return await this.vmManager.reportCCResult(t2, e), {
|
|
3885
3906
|
content: [{ type: "text", text: "Execution resumed" }]
|
|
3886
3907
|
};
|
|
3887
|
-
} catch (
|
|
3908
|
+
} catch (t2) {
|
|
3888
3909
|
return {
|
|
3889
|
-
content: [{ type: "text", text: `Error: ${
|
|
3910
|
+
content: [{ type: "text", text: `Error: ${t2 instanceof Error ? t2.message : "Unknown error"}` }],
|
|
3890
3911
|
isError: true
|
|
3891
3912
|
};
|
|
3892
3913
|
}
|
|
@@ -3898,23 +3919,23 @@ class Q {
|
|
|
3898
3919
|
},
|
|
3899
3920
|
async ({ executionId: r2 }) => {
|
|
3900
3921
|
try {
|
|
3901
|
-
let
|
|
3902
|
-
if (!
|
|
3922
|
+
let e = r2;
|
|
3923
|
+
if (!e) {
|
|
3903
3924
|
const s2 = await this.vmManager.getCurrentExecutionId();
|
|
3904
3925
|
if (!s2)
|
|
3905
3926
|
return {
|
|
3906
3927
|
content: [{ type: "text", text: "Error: No current execution set" }],
|
|
3907
3928
|
isError: true
|
|
3908
3929
|
};
|
|
3909
|
-
|
|
3930
|
+
e = s2;
|
|
3910
3931
|
}
|
|
3911
|
-
const
|
|
3932
|
+
const t2 = await this.vmManager.getExecutionStatus(e);
|
|
3912
3933
|
return {
|
|
3913
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
3934
|
+
content: [{ type: "text", text: JSON.stringify(t2, null, 2) }]
|
|
3914
3935
|
};
|
|
3915
|
-
} catch (
|
|
3936
|
+
} catch (e) {
|
|
3916
3937
|
return {
|
|
3917
|
-
content: [{ type: "text", text: `Error: ${
|
|
3938
|
+
content: [{ type: "text", text: `Error: ${e instanceof Error ? e.message : "Unknown error"}` }],
|
|
3918
3939
|
isError: true
|
|
3919
3940
|
};
|
|
3920
3941
|
}
|
|
@@ -3924,12 +3945,12 @@ class Q {
|
|
|
3924
3945
|
{},
|
|
3925
3946
|
async () => {
|
|
3926
3947
|
try {
|
|
3927
|
-
const r2 = await this.vmManager.listExecutions(),
|
|
3948
|
+
const r2 = await this.vmManager.listExecutions(), e = await this.vmManager.getCurrentExecutionId(), t2 = r2.map((s2) => ({
|
|
3928
3949
|
executionId: s2.id,
|
|
3929
3950
|
programId: s2.programId,
|
|
3930
3951
|
state: s2.state,
|
|
3931
3952
|
created: s2.created,
|
|
3932
|
-
isCurrent: s2.id ===
|
|
3953
|
+
isCurrent: s2.id === e,
|
|
3933
3954
|
summary: {
|
|
3934
3955
|
currentPrompt: s2.state === "AWAITING_COGNITIVE_RESULT" ? s2.ccPrompt : void 0,
|
|
3935
3956
|
tasksCompleted: 0
|
|
@@ -3937,7 +3958,7 @@ class Q {
|
|
|
3937
3958
|
}
|
|
3938
3959
|
}));
|
|
3939
3960
|
return {
|
|
3940
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
3961
|
+
content: [{ type: "text", text: JSON.stringify(t2, null, 2) }]
|
|
3941
3962
|
};
|
|
3942
3963
|
} catch (r2) {
|
|
3943
3964
|
return {
|
|
@@ -3953,29 +3974,29 @@ class Q {
|
|
|
3953
3974
|
},
|
|
3954
3975
|
async ({ executionId: r2 }) => {
|
|
3955
3976
|
try {
|
|
3956
|
-
let
|
|
3957
|
-
if (!
|
|
3958
|
-
const
|
|
3959
|
-
if (!
|
|
3977
|
+
let e = r2;
|
|
3978
|
+
if (!e) {
|
|
3979
|
+
const m = await this.vmManager.getCurrentExecutionId();
|
|
3980
|
+
if (!m)
|
|
3960
3981
|
return {
|
|
3961
3982
|
content: [{ type: "text", text: "Error: No current execution set" }],
|
|
3962
3983
|
isError: true
|
|
3963
3984
|
};
|
|
3964
|
-
|
|
3985
|
+
e = m;
|
|
3965
3986
|
}
|
|
3966
|
-
const
|
|
3967
|
-
executionId:
|
|
3968
|
-
programId:
|
|
3969
|
-
state:
|
|
3970
|
-
created:
|
|
3971
|
-
isCurrent:
|
|
3972
|
-
currentTask:
|
|
3973
|
-
prompt:
|
|
3974
|
-
attempts:
|
|
3975
|
-
firstAttemptAt:
|
|
3976
|
-
lastAttemptAt:
|
|
3987
|
+
const t2 = await this.vmManager.getExecutionWithAttempts(e), s2 = await this.vmManager.getCurrentExecutionId(), c2 = {
|
|
3988
|
+
executionId: t2.id,
|
|
3989
|
+
programId: t2.programId,
|
|
3990
|
+
state: t2.state,
|
|
3991
|
+
created: t2.created,
|
|
3992
|
+
isCurrent: t2.id === s2,
|
|
3993
|
+
currentTask: t2.state === "AWAITING_COGNITIVE_RESULT" ? {
|
|
3994
|
+
prompt: t2.ccPrompt,
|
|
3995
|
+
attempts: t2.attempts || 1,
|
|
3996
|
+
firstAttemptAt: t2.firstAttemptAt || t2.created,
|
|
3997
|
+
lastAttemptAt: t2.lastAttemptAt || t2.created
|
|
3977
3998
|
} : void 0,
|
|
3978
|
-
variables:
|
|
3999
|
+
variables: t2.variables,
|
|
3979
4000
|
stats: {
|
|
3980
4001
|
tasksCompleted: 0
|
|
3981
4002
|
// TODO: Track this
|
|
@@ -3984,9 +4005,9 @@ class Q {
|
|
|
3984
4005
|
return {
|
|
3985
4006
|
content: [{ type: "text", text: JSON.stringify(c2, null, 2) }]
|
|
3986
4007
|
};
|
|
3987
|
-
} catch (
|
|
4008
|
+
} catch (e) {
|
|
3988
4009
|
return {
|
|
3989
|
-
content: [{ type: "text", text: `Error: ${
|
|
4010
|
+
content: [{ type: "text", text: `Error: ${e instanceof Error ? e.message : "Unknown error"}` }],
|
|
3990
4011
|
isError: true
|
|
3991
4012
|
};
|
|
3992
4013
|
}
|
|
@@ -4001,9 +4022,9 @@ class Q {
|
|
|
4001
4022
|
return await this.vmManager.setCurrentExecutionId(r2), {
|
|
4002
4023
|
content: [{ type: "text", text: `Current execution set to: ${r2}` }]
|
|
4003
4024
|
};
|
|
4004
|
-
} catch (
|
|
4025
|
+
} catch (e) {
|
|
4005
4026
|
return {
|
|
4006
|
-
content: [{ type: "text", text: `Error: ${
|
|
4027
|
+
content: [{ type: "text", text: `Error: ${e instanceof Error ? e.message : "Unknown error"}` }],
|
|
4007
4028
|
isError: true
|
|
4008
4029
|
};
|
|
4009
4030
|
}
|
|
@@ -4014,10 +4035,10 @@ class Q {
|
|
|
4014
4035
|
executionId: zod.z.string(),
|
|
4015
4036
|
confirmToken: zod.z.string().optional()
|
|
4016
4037
|
},
|
|
4017
|
-
async ({ executionId: r2, confirmToken:
|
|
4038
|
+
async ({ executionId: r2, confirmToken: e }) => {
|
|
4018
4039
|
try {
|
|
4019
|
-
const
|
|
4020
|
-
return
|
|
4040
|
+
const t2 = `delete-${r2}-${Date.now()}`;
|
|
4041
|
+
return e ? e && e.startsWith(`delete-${r2}-`) ? (await this.vmManager.deleteExecution(r2), {
|
|
4021
4042
|
content: [{ type: "text", text: `Execution deleted: ${r2}` }]
|
|
4022
4043
|
}) : {
|
|
4023
4044
|
content: [{ type: "text", text: "Invalid confirmation token" }],
|
|
@@ -4028,13 +4049,13 @@ class Q {
|
|
|
4028
4049
|
text: JSON.stringify({
|
|
4029
4050
|
confirmationRequired: true,
|
|
4030
4051
|
message: `To delete execution '${r2}', call this tool again with the confirmation token`,
|
|
4031
|
-
token:
|
|
4052
|
+
token: t2
|
|
4032
4053
|
}, null, 2)
|
|
4033
4054
|
}]
|
|
4034
4055
|
};
|
|
4035
|
-
} catch (
|
|
4056
|
+
} catch (t2) {
|
|
4036
4057
|
return {
|
|
4037
|
-
content: [{ type: "text", text: `Error: ${
|
|
4058
|
+
content: [{ type: "text", text: `Error: ${t2 instanceof Error ? t2.message : "Unknown error"}` }],
|
|
4038
4059
|
isError: true
|
|
4039
4060
|
};
|
|
4040
4061
|
}
|
|
@@ -4049,13 +4070,13 @@ class Q {
|
|
|
4049
4070
|
return {
|
|
4050
4071
|
content: [{ type: "text", text: "No programs loaded" }]
|
|
4051
4072
|
};
|
|
4052
|
-
const
|
|
4053
|
-
programId:
|
|
4054
|
-
name:
|
|
4055
|
-
created:
|
|
4073
|
+
const e = r2.map((t2) => ({
|
|
4074
|
+
programId: t2.id,
|
|
4075
|
+
name: t2.name,
|
|
4076
|
+
created: t2.created
|
|
4056
4077
|
}));
|
|
4057
4078
|
return {
|
|
4058
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
4079
|
+
content: [{ type: "text", text: JSON.stringify(e, null, 2) }]
|
|
4059
4080
|
};
|
|
4060
4081
|
} catch (r2) {
|
|
4061
4082
|
return {
|
|
@@ -4070,10 +4091,10 @@ class Q {
|
|
|
4070
4091
|
programId: zod.z.string(),
|
|
4071
4092
|
confirmToken: zod.z.string().optional()
|
|
4072
4093
|
},
|
|
4073
|
-
async ({ programId: r2, confirmToken:
|
|
4094
|
+
async ({ programId: r2, confirmToken: e }) => {
|
|
4074
4095
|
try {
|
|
4075
|
-
const
|
|
4076
|
-
return
|
|
4096
|
+
const t2 = `delete-${r2}-${Date.now()}`;
|
|
4097
|
+
return e ? e && e.startsWith(`delete-${r2}-`) ? (await this.vmManager.deleteProgram(r2), {
|
|
4077
4098
|
content: [{ type: "text", text: `Program deleted: ${r2}` }]
|
|
4078
4099
|
}) : {
|
|
4079
4100
|
content: [{ type: "text", text: "Invalid confirmation token" }],
|
|
@@ -4084,13 +4105,13 @@ class Q {
|
|
|
4084
4105
|
text: JSON.stringify({
|
|
4085
4106
|
confirmationRequired: true,
|
|
4086
4107
|
message: `To delete program '${r2}', call this tool again with the confirmation token`,
|
|
4087
|
-
token:
|
|
4108
|
+
token: t2
|
|
4088
4109
|
}, null, 2)
|
|
4089
4110
|
}]
|
|
4090
4111
|
};
|
|
4091
|
-
} catch (
|
|
4112
|
+
} catch (t2) {
|
|
4092
4113
|
return {
|
|
4093
|
-
content: [{ type: "text", text: `Error: ${
|
|
4114
|
+
content: [{ type: "text", text: `Error: ${t2 instanceof Error ? t2.message : "Unknown error"}` }],
|
|
4094
4115
|
isError: true
|
|
4095
4116
|
};
|
|
4096
4117
|
}
|
|
@@ -4101,14 +4122,14 @@ class Q {
|
|
|
4101
4122
|
programId: zod.z.string(),
|
|
4102
4123
|
executionId: zod.z.string().optional()
|
|
4103
4124
|
},
|
|
4104
|
-
async ({ programId: r2, executionId:
|
|
4125
|
+
async ({ programId: r2, executionId: e }) => {
|
|
4105
4126
|
try {
|
|
4106
4127
|
return {
|
|
4107
|
-
content: [{ type: "text", text: `Execution started: ${await this.vmManager.restartExecution(r2,
|
|
4128
|
+
content: [{ type: "text", text: `Execution started: ${await this.vmManager.restartExecution(r2, e)} (set as current)` }]
|
|
4108
4129
|
};
|
|
4109
|
-
} catch (
|
|
4130
|
+
} catch (t2) {
|
|
4110
4131
|
return {
|
|
4111
|
-
content: [{ type: "text", text: `Error: ${
|
|
4132
|
+
content: [{ type: "text", text: `Error: ${t2 instanceof Error ? t2.message : "Unknown error"}` }],
|
|
4112
4133
|
isError: true
|
|
4113
4134
|
};
|
|
4114
4135
|
}
|
|
@@ -4118,48 +4139,110 @@ class Q {
|
|
|
4118
4139
|
{ filePath: zod.z.string() },
|
|
4119
4140
|
async ({ filePath: r2 }) => {
|
|
4120
4141
|
try {
|
|
4121
|
-
const
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4142
|
+
const e = r$2.resolve(r2), t2 = await promises.readFile(e, "utf-8"), s2 = j(t2);
|
|
4143
|
+
let c2;
|
|
4144
|
+
if (s2.length === 0) {
|
|
4145
|
+
const d2 = T(t2, r2);
|
|
4146
|
+
if (!d2.valid)
|
|
4147
|
+
return {
|
|
4148
|
+
content: [{ type: "text", text: `Plan validation failed:
|
|
4149
|
+
${d2.errors.map((i2) => `line ${i2.line}: ${i2.message}`).join(`
|
|
4126
4150
|
`)}` }],
|
|
4127
|
-
|
|
4151
|
+
isError: true
|
|
4152
|
+
};
|
|
4153
|
+
const n2 = d2.plan;
|
|
4154
|
+
c2 = {
|
|
4155
|
+
mission: n2.mission,
|
|
4156
|
+
sourceFile: n2.sourceFile,
|
|
4157
|
+
blocks: n2.blocks.map((a2) => ({
|
|
4158
|
+
id: a2.id,
|
|
4159
|
+
title: a2.title,
|
|
4160
|
+
intro: a2.intro,
|
|
4161
|
+
red: a2.redTests.map((i2) => "- " + i2).join(`
|
|
4162
|
+
`),
|
|
4163
|
+
success: a2.success.map((i2) => "- [ ] " + i2).join(`
|
|
4164
|
+
`),
|
|
4165
|
+
planRef: `See ${n2.sourceFile} lines ${a2.startLine}-${a2.endLine}`
|
|
4166
|
+
}))
|
|
4128
4167
|
};
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4168
|
+
} else {
|
|
4169
|
+
const d2 = r$2.dirname(e), n2 = T(t2, r2, { requireBlocks: false });
|
|
4170
|
+
if (!n2.valid)
|
|
4171
|
+
return {
|
|
4172
|
+
content: [{ type: "text", text: `Index plan validation failed:
|
|
4173
|
+
${n2.errors.map((g2) => `line ${g2.line}: ${g2.message}`).join(`
|
|
4174
|
+
`)}` }],
|
|
4175
|
+
isError: true
|
|
4176
|
+
};
|
|
4177
|
+
const a2 = n2.plan.mission, i2 = [], p2 = /* @__PURE__ */ new Set(), k2 = [e];
|
|
4178
|
+
for (const u2 of s2) {
|
|
4179
|
+
const g2 = r$2.resolve(d2, u2);
|
|
4180
|
+
let w2;
|
|
4181
|
+
try {
|
|
4182
|
+
w2 = await promises.readFile(g2, "utf-8");
|
|
4183
|
+
} catch {
|
|
4184
|
+
return {
|
|
4185
|
+
content: [{ type: "text", text: `Error: Sub-file not found: ${u2}` }],
|
|
4186
|
+
isError: true
|
|
4187
|
+
};
|
|
4188
|
+
}
|
|
4189
|
+
const E3 = T(w2, u2, { requireMission: false });
|
|
4190
|
+
if (!E3.valid) {
|
|
4191
|
+
const l = E3.errors.map((x) => `${u2} line ${x.line}: ${x.message}`).join(`
|
|
4192
|
+
`);
|
|
4193
|
+
return {
|
|
4194
|
+
content: [{ type: "text", text: `Plan validation failed in ${u2}:
|
|
4195
|
+
${l}` }],
|
|
4196
|
+
isError: true
|
|
4197
|
+
};
|
|
4198
|
+
}
|
|
4199
|
+
k2.push(g2);
|
|
4200
|
+
for (const l of E3.plan.blocks) {
|
|
4201
|
+
if (p2.has(l.id))
|
|
4202
|
+
return {
|
|
4203
|
+
content: [{ type: "text", text: `Error: Duplicate block id "${l.id}" in ${u2}` }],
|
|
4204
|
+
isError: true
|
|
4205
|
+
};
|
|
4206
|
+
p2.add(l.id), i2.push({
|
|
4207
|
+
id: l.id,
|
|
4208
|
+
title: l.title,
|
|
4209
|
+
intro: l.intro,
|
|
4210
|
+
red: l.redTests.map((x) => "- " + x).join(`
|
|
4137
4211
|
`),
|
|
4138
|
-
|
|
4212
|
+
success: l.success.map((x) => "- [ ] " + x).join(`
|
|
4139
4213
|
`),
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4214
|
+
planRef: `See ${g2} lines ${l.startLine}-${l.endLine}`
|
|
4215
|
+
});
|
|
4216
|
+
}
|
|
4217
|
+
}
|
|
4218
|
+
c2 = {
|
|
4219
|
+
mission: a2,
|
|
4220
|
+
sourceFile: e,
|
|
4221
|
+
sourceFiles: k2,
|
|
4222
|
+
blocks: i2
|
|
4223
|
+
};
|
|
4224
|
+
}
|
|
4225
|
+
const m = r$2.resolve(process.env.CVM_DATA_DIR || ".cvm");
|
|
4226
|
+
await promises.mkdir(m, { recursive: true });
|
|
4227
|
+
const y2 = r$2.resolve(m, "uplan.json");
|
|
4145
4228
|
try {
|
|
4146
|
-
await promises.rename(
|
|
4229
|
+
await promises.rename(y2, y2 + ".bak");
|
|
4147
4230
|
} catch {
|
|
4148
4231
|
}
|
|
4149
|
-
return await promises.writeFile(
|
|
4232
|
+
return await promises.writeFile(y2, JSON.stringify(c2, null, 2), "utf-8"), {
|
|
4150
4233
|
content: [{
|
|
4151
4234
|
type: "text",
|
|
4152
4235
|
text: JSON.stringify({
|
|
4153
4236
|
valid: true,
|
|
4154
4237
|
blocks: c2.blocks.length,
|
|
4155
|
-
path:
|
|
4156
|
-
blockIds: c2.blocks.map((
|
|
4238
|
+
path: y2,
|
|
4239
|
+
blockIds: c2.blocks.map((d2) => d2.id)
|
|
4157
4240
|
}, null, 2)
|
|
4158
4241
|
}]
|
|
4159
4242
|
};
|
|
4160
|
-
} catch (
|
|
4243
|
+
} catch (e) {
|
|
4161
4244
|
return {
|
|
4162
|
-
content: [{ type: "text", text: `Error: ${
|
|
4245
|
+
content: [{ type: "text", text: `Error: ${e instanceof Error ? e.message : "Unknown error"}` }],
|
|
4163
4246
|
isError: true
|
|
4164
4247
|
};
|
|
4165
4248
|
}
|
|
@@ -4251,7 +4334,7 @@ async function main() {
|
|
|
4251
4334
|
} else {
|
|
4252
4335
|
g.info("[CVM] Using MongoDB storage");
|
|
4253
4336
|
}
|
|
4254
|
-
cvmServer = new
|
|
4337
|
+
cvmServer = new Y(version);
|
|
4255
4338
|
await cvmServer.start();
|
|
4256
4339
|
g.info("CVM Server is running and ready to accept MCP connections");
|
|
4257
4340
|
process.on("SIGINT", async () => {
|