cvm-server 0.16.0-next.2 → 0.16.0-next.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.cjs +34 -17
- package/package.json +1 -1
package/main.cjs
CHANGED
|
@@ -3666,7 +3666,7 @@ function T(h2, r2, e) {
|
|
|
3666
3666
|
const t2 = h2.split(`
|
|
3667
3667
|
`), s2 = [];
|
|
3668
3668
|
let c2 = "", m = -1;
|
|
3669
|
-
const y2 = [],
|
|
3669
|
+
const y2 = [], g2 = /* @__PURE__ */ new Set();
|
|
3670
3670
|
let n2 = 0;
|
|
3671
3671
|
for (; n2 < t2.length; ) {
|
|
3672
3672
|
if (t2[n2].trim().startsWith("<mission>")) {
|
|
@@ -3692,8 +3692,8 @@ function T(h2, r2, e) {
|
|
|
3692
3692
|
continue;
|
|
3693
3693
|
}
|
|
3694
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` }),
|
|
3696
|
-
let k2 = "", u2 = "",
|
|
3695
|
+
F.test(i2) || s2.push({ line: n2 + 1, message: `Block id "${i2}" must be NN-kebab-case format` }), g2.has(i2) && s2.push({ line: n2 + 1, message: `Duplicate block id "${i2}"` }), g2.add(i2);
|
|
3696
|
+
let k2 = "", u2 = "", d2 = [], w2 = [], E3 = -1, l = false, x = false, N2 = false;
|
|
3697
3697
|
for (n2++; n2 < t2.length; ) {
|
|
3698
3698
|
const v2 = t2[n2].trim();
|
|
3699
3699
|
if (v2.startsWith("</block>")) {
|
|
@@ -3721,7 +3721,7 @@ function T(h2, r2, e) {
|
|
|
3721
3721
|
if (v2.startsWith("<red>")) {
|
|
3722
3722
|
for (x = true, n2++; n2 < t2.length && !t2[n2].trim().startsWith("</red>"); ) {
|
|
3723
3723
|
const f3 = t2[n2].trim().match(/^-\s*test:\s*(.+)/);
|
|
3724
|
-
f3 &&
|
|
3724
|
+
f3 && d2.push(f3[1].trim()), n2++;
|
|
3725
3725
|
}
|
|
3726
3726
|
n2 < t2.length && n2++;
|
|
3727
3727
|
continue;
|
|
@@ -3736,11 +3736,11 @@ function T(h2, r2, e) {
|
|
|
3736
3736
|
}
|
|
3737
3737
|
n2++;
|
|
3738
3738
|
}
|
|
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 ?
|
|
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 ? d2.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
3740
|
id: i2,
|
|
3741
3741
|
title: k2,
|
|
3742
3742
|
intro: u2,
|
|
3743
|
-
redTests:
|
|
3743
|
+
redTests: d2,
|
|
3744
3744
|
success: w2,
|
|
3745
3745
|
startLine: p2 + 1,
|
|
3746
3746
|
endLine: E3 + 1
|
|
@@ -3774,6 +3774,23 @@ class Y {
|
|
|
3774
3774
|
}
|
|
3775
3775
|
setupTools() {
|
|
3776
3776
|
this.server.tool(
|
|
3777
|
+
"server_info",
|
|
3778
|
+
{},
|
|
3779
|
+
async () => {
|
|
3780
|
+
const r2 = await this.vmManager.listPrograms(), e = await this.vmManager.listExecutions();
|
|
3781
|
+
return {
|
|
3782
|
+
content: [{
|
|
3783
|
+
type: "text",
|
|
3784
|
+
text: JSON.stringify({
|
|
3785
|
+
name: "cvm-server",
|
|
3786
|
+
version: this.version,
|
|
3787
|
+
programs: r2.length,
|
|
3788
|
+
executions: e.length
|
|
3789
|
+
}, null, 2)
|
|
3790
|
+
}]
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
), this.server.tool(
|
|
3777
3794
|
"load",
|
|
3778
3795
|
{
|
|
3779
3796
|
programId: zod.z.string(),
|
|
@@ -4142,15 +4159,15 @@ class Y {
|
|
|
4142
4159
|
const e = r$2.resolve(r2), t2 = await promises.readFile(e, "utf-8"), s2 = j(t2);
|
|
4143
4160
|
let c2;
|
|
4144
4161
|
if (s2.length === 0) {
|
|
4145
|
-
const
|
|
4146
|
-
if (!
|
|
4162
|
+
const g2 = T(t2, r2);
|
|
4163
|
+
if (!g2.valid)
|
|
4147
4164
|
return {
|
|
4148
4165
|
content: [{ type: "text", text: `Plan validation failed:
|
|
4149
|
-
${
|
|
4166
|
+
${g2.errors.map((i2) => `line ${i2.line}: ${i2.message}`).join(`
|
|
4150
4167
|
`)}` }],
|
|
4151
4168
|
isError: true
|
|
4152
4169
|
};
|
|
4153
|
-
const n2 =
|
|
4170
|
+
const n2 = g2.plan;
|
|
4154
4171
|
c2 = {
|
|
4155
4172
|
mission: n2.mission,
|
|
4156
4173
|
sourceFile: n2.sourceFile,
|
|
@@ -4166,20 +4183,20 @@ ${d2.errors.map((i2) => `line ${i2.line}: ${i2.message}`).join(`
|
|
|
4166
4183
|
}))
|
|
4167
4184
|
};
|
|
4168
4185
|
} else {
|
|
4169
|
-
const
|
|
4186
|
+
const g2 = r$2.dirname(e), n2 = T(t2, r2, { requireBlocks: false });
|
|
4170
4187
|
if (!n2.valid)
|
|
4171
4188
|
return {
|
|
4172
4189
|
content: [{ type: "text", text: `Index plan validation failed:
|
|
4173
|
-
${n2.errors.map((
|
|
4190
|
+
${n2.errors.map((d2) => `line ${d2.line}: ${d2.message}`).join(`
|
|
4174
4191
|
`)}` }],
|
|
4175
4192
|
isError: true
|
|
4176
4193
|
};
|
|
4177
4194
|
const a2 = n2.plan.mission, i2 = [], p2 = /* @__PURE__ */ new Set(), k2 = [e];
|
|
4178
4195
|
for (const u2 of s2) {
|
|
4179
|
-
const
|
|
4196
|
+
const d2 = r$2.resolve(g2, u2);
|
|
4180
4197
|
let w2;
|
|
4181
4198
|
try {
|
|
4182
|
-
w2 = await promises.readFile(
|
|
4199
|
+
w2 = await promises.readFile(d2, "utf-8");
|
|
4183
4200
|
} catch {
|
|
4184
4201
|
return {
|
|
4185
4202
|
content: [{ type: "text", text: `Error: Sub-file not found: ${u2}` }],
|
|
@@ -4196,7 +4213,7 @@ ${l}` }],
|
|
|
4196
4213
|
isError: true
|
|
4197
4214
|
};
|
|
4198
4215
|
}
|
|
4199
|
-
k2.push(
|
|
4216
|
+
k2.push(d2);
|
|
4200
4217
|
for (const l of E3.plan.blocks) {
|
|
4201
4218
|
if (p2.has(l.id))
|
|
4202
4219
|
return {
|
|
@@ -4211,7 +4228,7 @@ ${l}` }],
|
|
|
4211
4228
|
`),
|
|
4212
4229
|
success: l.success.map((x) => "- [ ] " + x).join(`
|
|
4213
4230
|
`),
|
|
4214
|
-
planRef: `See ${
|
|
4231
|
+
planRef: `See ${d2} lines ${l.startLine}-${l.endLine}`
|
|
4215
4232
|
});
|
|
4216
4233
|
}
|
|
4217
4234
|
}
|
|
@@ -4236,7 +4253,7 @@ ${l}` }],
|
|
|
4236
4253
|
valid: true,
|
|
4237
4254
|
blocks: c2.blocks.length,
|
|
4238
4255
|
path: y2,
|
|
4239
|
-
blockIds: c2.blocks.map((
|
|
4256
|
+
blockIds: c2.blocks.map((g2) => g2.id)
|
|
4240
4257
|
}, null, 2)
|
|
4241
4258
|
}]
|
|
4242
4259
|
};
|