@mwillbanks/ast-mcp 0.2.1 → 0.3.0
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/CONTRIBUTING.md +13 -0
- package/README.md +18 -14
- package/dist/ast-mcp.js +183 -137
- package/dist/ast-mcp.js.map +58 -42
- package/package.json +17 -11
- package/src/ast-bro/capability.ts +20 -10
- package/src/ast-bro/tools.json +22 -2
- package/src/cli.ts +10 -7
- package/src/config-cli.ts +166 -19
- package/src/config-migrate.ts +223 -0
- package/src/config-registry.ts +321 -0
- package/src/config-schema-common.ts +81 -0
- package/src/config-v2-schema.ts +97 -0
- package/src/config.ts +375 -149
- package/src/helpers/ast-bro.ts +1 -7
- package/src/helpers/config.ts +12 -3
- package/src/helpers/installer.ts +8 -0
- package/src/helpers/mcp-schema.ts +105 -4
- package/src/host-smoke.ts +182 -0
- package/src/http.ts +8 -3
- package/src/installer-transport.ts +6 -4
- package/src/installer.ts +192 -51
- package/src/patch/engine.ts +555 -279
- package/src/patch/languages.ts +9 -0
- package/src/patch/strategy/aiderBlock.ts +110 -0
- package/src/patch/strategy/ast.ts +170 -0
- package/src/patch/strategy.ts +61 -0
- package/src/runtime/approval.ts +438 -0
- package/src/runtime/dependencies.ts +1 -1
- package/src/runtime/document-inspection.ts +78 -0
- package/src/runtime/file-capabilities.ts +250 -0
- package/src/runtime/file-delete.ts +122 -20
- package/src/runtime/file-read.ts +142 -14
- package/src/runtime/file-rename.ts +7 -6
- package/src/runtime/format.ts +65 -27
- package/src/runtime/path-policy.ts +557 -0
- package/src/runtime/path-utils.ts +40 -0
- package/src/runtime/paths.ts +204 -43
- package/src/server.ts +2 -1
- package/src/tools/ast-bro.ts +197 -76
- package/src/tools/configuration.ts +450 -0
- package/src/tools/configured.ts +49 -21
- package/src/tools/files.ts +177 -73
- package/src/tools/index.ts +2 -0
- package/src/tools/lifecycle.ts +89 -45
- package/templates/AGENTS.md +15 -17
- package/templates/skills/ast-mcp/SKILL.md +50 -34
- package/templates/skills/ast-mcp/evals/batch.evals.json +9 -9
- package/templates/skills/ast-mcp/evals/evals.json +221 -9
- package/templates/skills/ast-mcp/evals/measure.ts +27 -4
- package/templates/skills/ast-mcp/evals/score.test.ts +46 -3
- package/templates/skills/ast-mcp/evals/score.ts +87 -0
- package/templates/skills/ast-mcp/evals/semantic.test.ts +209 -28
- package/templates/skills/ast-mcp/evals/semantic.ts +151 -37
- package/templates/skills/ast-mcp/references/installation.md +12 -12
- package/templates/skills/ast-mcp/references/patch-state-machine.md +15 -14
- package/templates/skills/ast-mcp/references/tool-catalog.md +16 -10
- package/templates/skills/ast-mcp/scripts/check-install.ts +8 -17
- package/src/ast-bro/rewrite-capability.ts +0 -9
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import {
|
|
4
|
+
type FileOperationPolicy,
|
|
4
5
|
type Invocation,
|
|
5
6
|
type EvalCase as SemanticEvalCase,
|
|
6
7
|
verifyEvaluation,
|
|
@@ -39,14 +40,18 @@ type TranscriptCall = {
|
|
|
39
40
|
|
|
40
41
|
export type TranscriptScore = {
|
|
41
42
|
astMcpOutputChars: number;
|
|
43
|
+
batchDensity: number;
|
|
44
|
+
callsPerModelTurn: number;
|
|
42
45
|
errors: string[];
|
|
43
46
|
evaluatedCases: number;
|
|
44
47
|
execBatches: number;
|
|
45
48
|
mutationCalls: number;
|
|
49
|
+
parallelReadOnlyCalls: number;
|
|
46
50
|
passed: boolean;
|
|
47
51
|
session: string;
|
|
48
52
|
toolCalls: Record<string, number>;
|
|
49
53
|
unscoredBatches: number;
|
|
54
|
+
validationErrorCodes: Record<string, number>;
|
|
50
55
|
verifiedAssertions: number;
|
|
51
56
|
};
|
|
52
57
|
|
|
@@ -341,6 +346,7 @@ function evaluateCase(
|
|
|
341
346
|
calls: TranscriptCall[],
|
|
342
347
|
evaluation: EvalCase | undefined,
|
|
343
348
|
roots: string[],
|
|
349
|
+
fileOperationPolicy: FileOperationPolicy,
|
|
344
350
|
errors: string[],
|
|
345
351
|
) {
|
|
346
352
|
if (!evaluation) {
|
|
@@ -363,6 +369,7 @@ function evaluateCase(
|
|
|
363
369
|
evaluationInvocations(calls),
|
|
364
370
|
evaluationText(calls),
|
|
365
371
|
roots,
|
|
372
|
+
fileOperationPolicy,
|
|
366
373
|
);
|
|
367
374
|
for (const error of semanticErrors) errors.push(`eval ${evalId} ${error}`);
|
|
368
375
|
return !executionFailed && semanticErrors.length === 0
|
|
@@ -374,6 +381,7 @@ function evaluateGroups(
|
|
|
374
381
|
grouped: GroupedEvaluations,
|
|
375
382
|
cases: Map<number, EvalCase>,
|
|
376
383
|
roots: string[],
|
|
384
|
+
fileOperationPolicy: FileOperationPolicy,
|
|
377
385
|
errors: string[],
|
|
378
386
|
): EvaluationResult {
|
|
379
387
|
let evaluatedCases = 0;
|
|
@@ -385,6 +393,7 @@ function evaluateGroups(
|
|
|
385
393
|
calls,
|
|
386
394
|
cases.get(evalId),
|
|
387
395
|
roots,
|
|
396
|
+
fileOperationPolicy,
|
|
388
397
|
errors,
|
|
389
398
|
);
|
|
390
399
|
}
|
|
@@ -411,9 +420,54 @@ function validateStrictMatrix(
|
|
|
411
420
|
}
|
|
412
421
|
}
|
|
413
422
|
|
|
423
|
+
function targetCount(value: unknown, key = ""): number {
|
|
424
|
+
if (Array.isArray(value))
|
|
425
|
+
return [
|
|
426
|
+
"filePaths",
|
|
427
|
+
"paths",
|
|
428
|
+
"symbols",
|
|
429
|
+
"files",
|
|
430
|
+
"checks",
|
|
431
|
+
"selectors",
|
|
432
|
+
].includes(key)
|
|
433
|
+
? value.length
|
|
434
|
+
: Math.max(0, ...value.map((item) => targetCount(item)));
|
|
435
|
+
if (!value || typeof value !== "object") return 0;
|
|
436
|
+
const record = value as Record<string, unknown>;
|
|
437
|
+
const own = key === "files" ? Object.keys(record).length : 0;
|
|
438
|
+
return Math.max(
|
|
439
|
+
own,
|
|
440
|
+
...Object.entries(record).map(([childKey, child]) =>
|
|
441
|
+
targetCount(child, childKey),
|
|
442
|
+
),
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function invocationTargetCount(invocation: Invocation): number {
|
|
447
|
+
try {
|
|
448
|
+
return targetCount(JSON.parse(invocation.input));
|
|
449
|
+
} catch {
|
|
450
|
+
const match = invocation.input.match(
|
|
451
|
+
/(?:filePaths|paths|symbols)\s*:\s*\[([^\]]*)\]/s,
|
|
452
|
+
);
|
|
453
|
+
return match?.[1]?.trim() ? match[1].split(",").filter(Boolean).length : 0;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function validationErrorCodes(calls: Map<string, TranscriptCall>) {
|
|
458
|
+
const codes: Record<string, number> = {};
|
|
459
|
+
for (const call of calls.values()) {
|
|
460
|
+
const text = outputText(call.output?.output);
|
|
461
|
+
for (const match of text.matchAll(/["']code["']\s*:\s*["']([^"']+)["']/g))
|
|
462
|
+
codes[match[1]] = (codes[match[1]] ?? 0) + 1;
|
|
463
|
+
}
|
|
464
|
+
return codes;
|
|
465
|
+
}
|
|
466
|
+
|
|
414
467
|
export async function scoreTranscript(
|
|
415
468
|
sessionPath: string,
|
|
416
469
|
strict = false,
|
|
470
|
+
fileOperationPolicy: FileOperationPolicy = {},
|
|
417
471
|
): Promise<TranscriptScore> {
|
|
418
472
|
const collector = await collectTranscript(sessionPath);
|
|
419
473
|
const toolCalls: Record<string, number> = {};
|
|
@@ -426,6 +480,7 @@ export async function scoreTranscript(
|
|
|
426
480
|
grouped,
|
|
427
481
|
cases,
|
|
428
482
|
[...collector.roots],
|
|
483
|
+
fileOperationPolicy,
|
|
429
484
|
collector.errors,
|
|
430
485
|
);
|
|
431
486
|
validateStrictMatrix(
|
|
@@ -439,16 +494,48 @@ export async function scoreTranscript(
|
|
|
439
494
|
(toolCalls.file_patch ?? 0) +
|
|
440
495
|
(toolCalls.file_write ?? 0) +
|
|
441
496
|
(toolCalls.file_rename ?? 0);
|
|
497
|
+
const invocations = [...collector.calls.values()].flatMap(
|
|
498
|
+
(call) => call.invocations,
|
|
499
|
+
);
|
|
500
|
+
const batched = invocations.filter(
|
|
501
|
+
(invocation) => invocationTargetCount(invocation) > 1,
|
|
502
|
+
).length;
|
|
503
|
+
const statefulTools = new Set([
|
|
504
|
+
"file_chattr",
|
|
505
|
+
"file_delete",
|
|
506
|
+
"file_patch",
|
|
507
|
+
"file_rename",
|
|
508
|
+
"file_write",
|
|
509
|
+
"find_related",
|
|
510
|
+
"index",
|
|
511
|
+
"search",
|
|
512
|
+
]);
|
|
513
|
+
const parallelReadOnlyCalls = invocations.filter(
|
|
514
|
+
(invocation) =>
|
|
515
|
+
invocation.concurrent &&
|
|
516
|
+
!statefulTools.has(invocation.tool) &&
|
|
517
|
+
!(
|
|
518
|
+
invocation.tool === "run" &&
|
|
519
|
+
/(?:["']write["']|\bwrite)\s*:\s*true/.test(invocation.input)
|
|
520
|
+
),
|
|
521
|
+
).length;
|
|
442
522
|
return {
|
|
443
523
|
astMcpOutputChars: outputChars,
|
|
524
|
+
batchDensity: invocations.length === 0 ? 0 : batched / invocations.length,
|
|
525
|
+
callsPerModelTurn:
|
|
526
|
+
collector.calls.size === 0
|
|
527
|
+
? 0
|
|
528
|
+
: invocations.length / collector.calls.size,
|
|
444
529
|
errors: collector.errors,
|
|
445
530
|
evaluatedCases: result.evaluatedCases,
|
|
446
531
|
execBatches: collector.calls.size,
|
|
447
532
|
mutationCalls,
|
|
533
|
+
parallelReadOnlyCalls,
|
|
448
534
|
passed: collector.errors.length === 0,
|
|
449
535
|
session: sessionPath,
|
|
450
536
|
toolCalls,
|
|
451
537
|
unscoredBatches: grouped.unscoredBatches,
|
|
538
|
+
validationErrorCodes: validationErrorCodes(collector.calls),
|
|
452
539
|
verifiedAssertions: result.verifiedAssertions,
|
|
453
540
|
};
|
|
454
541
|
}
|
|
@@ -1,6 +1,170 @@
|
|
|
1
1
|
import { expect, test } from "bun:test";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
2
4
|
import { verifyEvaluation } from "./semantic";
|
|
3
5
|
|
|
6
|
+
test("semantic evaluator scopes declared batches and file-operation paths", () => {
|
|
7
|
+
const evaluation = {
|
|
8
|
+
assertions: ["Uses declared files property."],
|
|
9
|
+
expected_output: "verification output",
|
|
10
|
+
files: [],
|
|
11
|
+
forbidden_tools: [],
|
|
12
|
+
id: 97,
|
|
13
|
+
required_tools: ["file_write"],
|
|
14
|
+
};
|
|
15
|
+
const legacy = verifyEvaluation(
|
|
16
|
+
evaluation,
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
index: 0,
|
|
20
|
+
input: '{ files: {}, "/outside.ts": { content: "legacy" } }',
|
|
21
|
+
tool: "file_write",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
"verification output",
|
|
25
|
+
["/workspace"],
|
|
26
|
+
);
|
|
27
|
+
expect(legacy).toContain("file_write has empty or schema-incomplete input");
|
|
28
|
+
const nested = verifyEvaluation(
|
|
29
|
+
evaluation,
|
|
30
|
+
[
|
|
31
|
+
{
|
|
32
|
+
index: 0,
|
|
33
|
+
input:
|
|
34
|
+
'{ wrapper: { files: { "/outside.ts": { content: "nested" } } } }',
|
|
35
|
+
tool: "file_write",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
"verification output",
|
|
39
|
+
["/workspace"],
|
|
40
|
+
);
|
|
41
|
+
expect(nested).toContain("file_write has empty or schema-incomplete input");
|
|
42
|
+
|
|
43
|
+
for (const [tool, input] of [
|
|
44
|
+
[
|
|
45
|
+
"file_patch",
|
|
46
|
+
JSON.stringify({
|
|
47
|
+
files: {
|
|
48
|
+
"/workspace/file.ts": {
|
|
49
|
+
astRules: [{ fix: "new", pattern: "old" }],
|
|
50
|
+
expectedSha256: "a".repeat(64),
|
|
51
|
+
patchStrategy: "ast",
|
|
52
|
+
preview: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
"file_delete",
|
|
59
|
+
JSON.stringify({
|
|
60
|
+
files: {
|
|
61
|
+
"/workspace/file.ts": {
|
|
62
|
+
expectedSha256: "a".repeat(64),
|
|
63
|
+
forceReferences: true,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
],
|
|
68
|
+
] as const) {
|
|
69
|
+
const ordered = verifyEvaluation(
|
|
70
|
+
{ ...evaluation, required_tools: [tool] },
|
|
71
|
+
[{ index: 0, input, tool }],
|
|
72
|
+
"verification output",
|
|
73
|
+
["/workspace"],
|
|
74
|
+
);
|
|
75
|
+
expect(ordered).not.toContain(
|
|
76
|
+
`${tool} has empty or schema-incomplete input`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const forceFirstBatch = `{"files":{"/outside-one.ts":{"forceReferences":true,"expectedSha256":"${"a".repeat(64)}"},"/outside-two.ts":{"forceReferences":true,"expectedSha256":"${"b".repeat(64)}"}}}`;
|
|
81
|
+
const batchErrors = verifyEvaluation(
|
|
82
|
+
{
|
|
83
|
+
...evaluation,
|
|
84
|
+
assertions: ["Uses one keyed batch."],
|
|
85
|
+
required_tools: ["file_delete"],
|
|
86
|
+
},
|
|
87
|
+
[{ index: 0, input: forceFirstBatch, tool: "file_delete" }],
|
|
88
|
+
"verification output",
|
|
89
|
+
["/workspace"],
|
|
90
|
+
);
|
|
91
|
+
expect(batchErrors).toContain(
|
|
92
|
+
"file_delete input escapes transcript file-operation roots: /outside-one.ts",
|
|
93
|
+
);
|
|
94
|
+
expect(batchErrors).toContain(
|
|
95
|
+
"file_delete input escapes transcript file-operation roots: /outside-two.ts",
|
|
96
|
+
);
|
|
97
|
+
expect(batchErrors).not.toContain(
|
|
98
|
+
"assertion not proven: Uses one keyed batch.",
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const previewFirstErrors = verifyEvaluation(
|
|
102
|
+
{ ...evaluation, required_tools: ["file_patch"] },
|
|
103
|
+
[
|
|
104
|
+
{
|
|
105
|
+
index: 0,
|
|
106
|
+
input: `{"files":{"/outside-preview.ts":{"preview":true,"expectedSha256":"${"a".repeat(64)}","patchStrategy":"ast","astRules":[{"pattern":"old","fix":"new"}]}}}`,
|
|
107
|
+
tool: "file_patch",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
"verification output",
|
|
111
|
+
["/workspace"],
|
|
112
|
+
);
|
|
113
|
+
expect(previewFirstErrors).toContain(
|
|
114
|
+
"file_patch input escapes transcript file-operation roots: /outside-preview.ts",
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const temporaryPath = path.join(os.tmpdir(), "ast-mcp-eval.ts");
|
|
118
|
+
expect(
|
|
119
|
+
verifyEvaluation(
|
|
120
|
+
evaluation,
|
|
121
|
+
[
|
|
122
|
+
{
|
|
123
|
+
index: 0,
|
|
124
|
+
input: JSON.stringify({
|
|
125
|
+
files: { [temporaryPath]: { content: "temporary" } },
|
|
126
|
+
}),
|
|
127
|
+
tool: "file_write",
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
"verification output",
|
|
131
|
+
["/workspace"],
|
|
132
|
+
),
|
|
133
|
+
).toEqual([]);
|
|
134
|
+
expect(
|
|
135
|
+
verifyEvaluation(
|
|
136
|
+
evaluation,
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
index: 0,
|
|
140
|
+
input: JSON.stringify({
|
|
141
|
+
files: { "/etc/ast-mcp-eval.ts": { content: "unrestricted" } },
|
|
142
|
+
}),
|
|
143
|
+
tool: "file_write",
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
"verification output",
|
|
147
|
+
["/workspace"],
|
|
148
|
+
{ allowAnyPath: true },
|
|
149
|
+
),
|
|
150
|
+
).toEqual([]);
|
|
151
|
+
|
|
152
|
+
const astErrors = verifyEvaluation(
|
|
153
|
+
{
|
|
154
|
+
...evaluation,
|
|
155
|
+
assertions: [],
|
|
156
|
+
required_tools: ["map"],
|
|
157
|
+
},
|
|
158
|
+
[{ index: 0, input: '{ paths: ["/etc"] }', tool: "map" }],
|
|
159
|
+
"verification output",
|
|
160
|
+
["/workspace"],
|
|
161
|
+
{ allowAnyPath: true },
|
|
162
|
+
);
|
|
163
|
+
expect(astErrors).toContain(
|
|
164
|
+
"map input escapes transcript workspace roots: /etc",
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
|
|
4
168
|
const evaluation = {
|
|
5
169
|
assertions: ["Reports each source and destination result."],
|
|
6
170
|
expected_output: "reports each source and destination result",
|
|
@@ -17,7 +181,12 @@ test("rename evaluator accepts root-relative runtime results", () => {
|
|
|
17
181
|
{
|
|
18
182
|
index: 0,
|
|
19
183
|
input: JSON.stringify({
|
|
20
|
-
|
|
184
|
+
files: {
|
|
185
|
+
"source.txt": {
|
|
186
|
+
destination: "renamed.txt",
|
|
187
|
+
expectedSha256: "hash",
|
|
188
|
+
},
|
|
189
|
+
},
|
|
21
190
|
}),
|
|
22
191
|
tool: "file_rename",
|
|
23
192
|
},
|
|
@@ -42,13 +211,15 @@ test("rename evaluator rejects incomplete per-file results", () => {
|
|
|
42
211
|
{
|
|
43
212
|
index: 0,
|
|
44
213
|
input: JSON.stringify({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
214
|
+
files: {
|
|
215
|
+
"/tmp/ast-mcp-root/one.txt": {
|
|
216
|
+
destination: "/tmp/ast-mcp-root/one-new.txt",
|
|
217
|
+
expectedSha256: "hash",
|
|
218
|
+
},
|
|
219
|
+
"/tmp/ast-mcp-root/two.txt": {
|
|
220
|
+
destination: "/tmp/ast-mcp-root/two-new.txt",
|
|
221
|
+
expectedSha256: "hash",
|
|
222
|
+
},
|
|
52
223
|
},
|
|
53
224
|
}),
|
|
54
225
|
tool: "file_rename",
|
|
@@ -121,7 +292,7 @@ test("semantic evaluator proves every supported assertion shape", () => {
|
|
|
121
292
|
),
|
|
122
293
|
).toEqual([]);
|
|
123
294
|
};
|
|
124
|
-
const patch = `{ "src/file.ts": { expectedSha256: "${"a".repeat(64)}", patchStrategy: "ast", astRules: [{ pattern: "old", fix: "next", expectedMatches: 1 }], preview: true } }`;
|
|
295
|
+
const patch = `{ files: { "src/file.ts": { expectedSha256: "${"a".repeat(64)}", patchStrategy: "ast", astRules: [{ pattern: "old", fix: "next", expectedMatches: 1 }], preview: true } } }`;
|
|
125
296
|
|
|
126
297
|
verify(
|
|
127
298
|
"Does not overwrite an existing destination.",
|
|
@@ -129,9 +300,11 @@ test("semantic evaluator proves every supported assertion shape", () => {
|
|
|
129
300
|
invocation(
|
|
130
301
|
"file_rename",
|
|
131
302
|
JSON.stringify({
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
303
|
+
files: {
|
|
304
|
+
"source.txt": {
|
|
305
|
+
destination: "destination.txt",
|
|
306
|
+
expectedSha256: "a".repeat(64),
|
|
307
|
+
},
|
|
135
308
|
},
|
|
136
309
|
}),
|
|
137
310
|
),
|
|
@@ -176,34 +349,42 @@ test("semantic evaluator proves every supported assertion shape", () => {
|
|
|
176
349
|
[
|
|
177
350
|
"file_write",
|
|
178
351
|
JSON.stringify({
|
|
179
|
-
|
|
180
|
-
|
|
352
|
+
files: {
|
|
353
|
+
"src/a.ts": { content: "a" },
|
|
354
|
+
"src/b.ts": { content: "b" },
|
|
355
|
+
},
|
|
181
356
|
}),
|
|
182
357
|
],
|
|
183
358
|
[
|
|
184
359
|
"file_chattr",
|
|
185
360
|
JSON.stringify({
|
|
186
|
-
|
|
187
|
-
|
|
361
|
+
files: {
|
|
362
|
+
"src/a.ts": { chattr: { chmod: 384 } },
|
|
363
|
+
"src/b.ts": { chattr: { chmod: 384 } },
|
|
364
|
+
},
|
|
188
365
|
}),
|
|
189
366
|
],
|
|
190
367
|
[
|
|
191
368
|
"file_delete",
|
|
192
369
|
JSON.stringify({
|
|
193
|
-
|
|
194
|
-
|
|
370
|
+
files: {
|
|
371
|
+
"src/a.ts": { expectedSha256: "a".repeat(64) },
|
|
372
|
+
"src/b.ts": { expectedSha256: "b".repeat(64) },
|
|
373
|
+
},
|
|
195
374
|
}),
|
|
196
375
|
],
|
|
197
376
|
[
|
|
198
377
|
"file_rename",
|
|
199
378
|
JSON.stringify({
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
379
|
+
files: {
|
|
380
|
+
"src/a.ts": {
|
|
381
|
+
destination: "src/a-new.ts",
|
|
382
|
+
expectedSha256: "a".repeat(64),
|
|
383
|
+
},
|
|
384
|
+
"src/b.ts": {
|
|
385
|
+
destination: "src/b-new.ts",
|
|
386
|
+
expectedSha256: "b".repeat(64),
|
|
387
|
+
},
|
|
207
388
|
},
|
|
208
389
|
}),
|
|
209
390
|
],
|
|
@@ -214,7 +395,7 @@ test("semantic evaluator proves every supported assertion shape", () => {
|
|
|
214
395
|
invocation("file_hash", '{ filePaths: ["src/a.ts"] }', 0),
|
|
215
396
|
invocation(
|
|
216
397
|
"file_write",
|
|
217
|
-
JSON.stringify({ "src/a.ts": { content: "next" } }),
|
|
398
|
+
JSON.stringify({ files: { "src/a.ts": { content: "next" } } }),
|
|
218
399
|
1,
|
|
219
400
|
),
|
|
220
401
|
]);
|
|
@@ -230,7 +411,7 @@ test("semantic evaluator proves every supported assertion shape", () => {
|
|
|
230
411
|
verify("Uses an Aider block.", [
|
|
231
412
|
invocation(
|
|
232
413
|
"file_patch",
|
|
233
|
-
`{ "README.md": { expectedSha256: "${"a".repeat(64)}", patchStrategy: "aider_block", aiderBlocks: [{ search: "old", replace: "new" }] } }`,
|
|
414
|
+
`{ files: { "README.md": { expectedSha256: "${"a".repeat(64)}", patchStrategy: "aider_block", aiderBlocks: [{ search: "old", replace: "new" }] } } }`,
|
|
234
415
|
),
|
|
235
416
|
]);
|
|
236
417
|
verify("Reports verification output.", []);
|
|
@@ -275,7 +456,7 @@ test("semantic evaluator reports every validation failure class", () => {
|
|
|
275
456
|
"file_hash has empty or schema-incomplete input",
|
|
276
457
|
"required tool sequence is concurrent and cannot be proven",
|
|
277
458
|
"required tool sequence is not satisfied at: file_write",
|
|
278
|
-
"file_write input escapes transcript
|
|
459
|
+
"file_write input escapes transcript file-operation roots: /etc/out.txt",
|
|
279
460
|
"output does not prove file result: required.txt",
|
|
280
461
|
"expected output not proven: expected transport behavior",
|
|
281
462
|
"assertion not proven: Uses bounded lines.",
|