@mwillbanks/ast-mcp 0.1.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.
Files changed (61) hide show
  1. package/CONTRIBUTING.md +60 -0
  2. package/LICENSE +21 -0
  3. package/README.md +109 -0
  4. package/dist/ast-mcp-hook.js +7 -0
  5. package/dist/ast-mcp-hook.js.map +11 -0
  6. package/dist/ast-mcp-install.js +22 -0
  7. package/dist/ast-mcp-install.js.map +12 -0
  8. package/dist/ast-mcp.js +115 -0
  9. package/dist/ast-mcp.js.map +89 -0
  10. package/dprint.json +37 -0
  11. package/logo.svg +1 -0
  12. package/package.json +89 -0
  13. package/src/ast-bro/capability.ts +21 -0
  14. package/src/ast-bro/client.ts +47 -0
  15. package/src/ast-bro/result.ts +42 -0
  16. package/src/ast-bro/rewrite-capability.ts +9 -0
  17. package/src/ast-bro/tools.json +603 -0
  18. package/src/hook.ts +79 -0
  19. package/src/http-entry.ts +3 -0
  20. package/src/http.ts +138 -0
  21. package/src/index.ts +8 -0
  22. package/src/installer.ts +501 -0
  23. package/src/lifecycle.ts +10 -0
  24. package/src/managed-hook.ts +4 -0
  25. package/src/patch/aider.ts +224 -0
  26. package/src/patch/engine.ts +446 -0
  27. package/src/patch/languages.ts +36 -0
  28. package/src/runtime/atomic.ts +26 -0
  29. package/src/runtime/attributes.ts +70 -0
  30. package/src/runtime/file-delete.ts +96 -0
  31. package/src/runtime/file-read.ts +178 -0
  32. package/src/runtime/format.ts +56 -0
  33. package/src/runtime/hash.ts +11 -0
  34. package/src/runtime/locks.ts +87 -0
  35. package/src/runtime/paths.ts +73 -0
  36. package/src/runtime/process-input.ts +25 -0
  37. package/src/runtime/signals.ts +47 -0
  38. package/src/server.ts +13 -0
  39. package/src/stdio.ts +154 -0
  40. package/src/tools/ast-bro.ts +172 -0
  41. package/src/tools/files.ts +173 -0
  42. package/src/tools/index.ts +11 -0
  43. package/src/tools/lifecycle.ts +124 -0
  44. package/templates/AGENTS.md +56 -0
  45. package/templates/skills/ast-mcp/SKILL.md +96 -0
  46. package/templates/skills/ast-mcp/agents/openai.yaml +4 -0
  47. package/templates/skills/ast-mcp/evals/batch.evals.json +274 -0
  48. package/templates/skills/ast-mcp/evals/evals.json +1209 -0
  49. package/templates/skills/ast-mcp/evals/file-hash.evals.json +50 -0
  50. package/templates/skills/ast-mcp/evals/measure.ts +18 -0
  51. package/templates/skills/ast-mcp/evals/results.md +17 -0
  52. package/templates/skills/ast-mcp/evals/score.ts +417 -0
  53. package/templates/skills/ast-mcp/evals/semantic.ts +332 -0
  54. package/templates/skills/ast-mcp/evals/trigger-queries.json +22 -0
  55. package/templates/skills/ast-mcp/evals/validate.ts +99 -0
  56. package/templates/skills/ast-mcp/references/installation.md +40 -0
  57. package/templates/skills/ast-mcp/references/managed-hook.ts +3 -0
  58. package/templates/skills/ast-mcp/references/patch-state-machine.md +39 -0
  59. package/templates/skills/ast-mcp/references/tool-catalog.md +46 -0
  60. package/templates/skills/ast-mcp/scripts/check-install.ts +269 -0
  61. package/templates/skills/ast-mcp/scripts/managed-hook.ts +22 -0
@@ -0,0 +1,50 @@
1
+ [
2
+ {
3
+ "assertions": [
4
+ "Uses file_hash for an AST-capable file when only SHA-256 is required.",
5
+ "Does not retrieve file content.",
6
+ "Preserves the returned canonical path, size, and hash."
7
+ ],
8
+ "category": "positive",
9
+ "expected_output": "Routes the hash-only request to file_hash even though the target is AST-capable.",
10
+ "files": [],
11
+ "forbidden_tools": ["file_read"],
12
+ "id": 71,
13
+ "prompt": "Get a fresh whole-file SHA-256 for src/server.ts immediately before a guarded patch without reading its source content.",
14
+ "required_tools": ["file_hash"],
15
+ "surface": "file_hash",
16
+ "variant": "fresh-patch-hash"
17
+ },
18
+ {
19
+ "assertions": [
20
+ "Batches all paths in one schema-valid file_hash call.",
21
+ "Accepts AST-capable and non-AST files.",
22
+ "Does not request any file content."
23
+ ],
24
+ "category": "variant",
25
+ "expected_output": "Uses one batched file_hash request for all five paths.",
26
+ "files": [],
27
+ "forbidden_tools": ["file_read"],
28
+ "id": 72,
29
+ "prompt": "Refresh guarded-edit hashes for five mixed AST and non-AST files in one operation.",
30
+ "required_tools": ["file_hash"],
31
+ "surface": "file_hash",
32
+ "variant": "batched-hashes"
33
+ },
34
+ {
35
+ "assertions": [
36
+ "Does not call file_hash when source content is required.",
37
+ "Uses show for the named AST symbol.",
38
+ "Does not fall back to file_read."
39
+ ],
40
+ "category": "negative",
41
+ "expected_output": "Uses show for source content and does not call file_hash.",
42
+ "files": [],
43
+ "forbidden_tools": ["file_hash", "file_read"],
44
+ "id": 73,
45
+ "prompt": "Show the implementation body of createServer in src/server.ts.",
46
+ "required_tools": ["show"],
47
+ "surface": "file_hash",
48
+ "variant": "content-near-miss"
49
+ }
50
+ ]
@@ -0,0 +1,18 @@
1
+ import { scoreTranscript } from "./score";
2
+
3
+ const args = process.argv.slice(2);
4
+ const strict = args[0] === "--strict";
5
+ const sessionPaths = strict ? args.slice(1) : args;
6
+
7
+ if (sessionPaths.length === 0) {
8
+ console.error(
9
+ "Usage: bun run templates/skills/ast-mcp/evals/measure.ts <session.jsonl> [...session.jsonl]",
10
+ );
11
+ process.exit(2);
12
+ }
13
+
14
+ for (const sessionPath of sessionPaths) {
15
+ const result = await scoreTranscript(sessionPath, strict);
16
+ console.log(JSON.stringify(result));
17
+ if (!result.passed) process.exitCode = 1;
18
+ }
@@ -0,0 +1,17 @@
1
+ # Skill evaluation results
2
+
3
+ The historical table below records candidate-prompt review notes, not executable agent benchmark scores. The current automated suite contains 90 cases across 25 MCP surfaces, including keyed `file_write`/`file_patch` batches, ordered same-file operations, positive/variant/negative routing, and JSON-RPC request/notification arrays. `evals:check` validates the fixture matrix; `bun run evals:measure -- <session.jsonl>` inventories direct and statically visible nested calls, while `bun run evals:score -- <session.jsonl>` associates one `ast-mcp-eval:<id>` marker from a user evaluation prompt or direct harness record with following direct MCP calls and their successful per-call outputs. Marked nested `exec` evidence and calls carrying multiple markers fail closed because their results cannot be isolated reliably. Batch unit tests, the live MCP registry test, and the Streamable HTTP transport test validate runtime behavior.
4
+
5
+ | Surface | Scenario | Baseline | First candidate | Final candidate |
6
+ | ----------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- | ----------------------------------------------- |
7
+ | Skill | TypeScript method rename | 4/6: safe AST workflow, but no concrete MCP installation recovery or first-party hash tool | 5/6: correct workflow, but invented invalid `impact.mode: "both"` | 6/6 after documenting valid modes and rerunning |
8
+ | Skill | MCP unavailable for Claude and Copilot | 2/5: stopped safely but did not install or name the package | 5/5 | 5/5 |
9
+ | AGENTS.md | TypeScript + duplicated unsupported text + new JSON file | Not applicable: prior surface was one paragraph | 6/6 | 6/6 |
10
+ | Description | Four trigger and four near-miss queries | Not evaluated: prior description covered only generic editing | 8/8 correct classifications | 8/8 |
11
+ | file_patch | Dual-purpose AST/Aider batch routing and lower-level run boundary | Not measured | Structural contract only: 4/4 fixture cases | Agent execution score not yet measured |
12
+
13
+ ## Runtime evidence
14
+
15
+ The requested prior session recorded 28 `file_patch`, 17 `file_write`, and 8 `file_hash` calls across 212 ast-mcp-containing exec batches, with approximately 1,038,254 ast-mcp output characters. The follow-up session now records 56 `file_patch`, 13 `file_write`, and 51 `file_hash` calls across 254 batches, with approximately 1,001,670 ast-mcp output characters and 69 mutation calls. This latest transcript includes implementation, remediation, and validation work rather than a matched task control, so it is not evidence of a regression or token-quality score. The measurement command is reproducible, while a real effectiveness claim still requires matched tasks scored for required/forbidden routing, token counts, and wall time. The stdio probe initially returned no responses for a JSON-RPC array; the native stdio adapter and end-to-end test now cover that path. The new `file_patch` preview path is covered by AST/Aider unit tests and the schema/eval matrix.
16
+
17
+ The failed first-candidate assertion was converted into a permanent eval assertion requiring schema-valid arguments. The historical rename response used `impact.mode: "all"`, direct intelligence tools, bounded AST previews, exact match counts, stale-context rebuilds, and post-write verification. Its former `file_read` hash behavior is superseded by the current contract: AST inspection stays in intelligence tools and fresh guarded-edit hashes come from `file_hash`. The installation response used `@mwillbanks/ast-mcp`, explicit local host targets, reconnect verification, and authorization before package download. The AGENTS response selected AST rules for TypeScript, unique Aider blocks for duplicated unsupported text, and `file_write` only for the new file.
@@ -0,0 +1,417 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import {
4
+ type Invocation,
5
+ type EvalCase as SemanticEvalCase,
6
+ verifyEvaluation,
7
+ } from "./semantic";
8
+
9
+ type EvalCase = SemanticEvalCase;
10
+
11
+ type RecordPayload = {
12
+ call_id?: string;
13
+ content?: unknown;
14
+ cwd?: string;
15
+ input?: unknown;
16
+ isError?: boolean;
17
+ name?: string;
18
+ output?: unknown;
19
+ role?: string;
20
+ type?: string;
21
+ workspace_roots?: string[];
22
+ };
23
+
24
+ type TranscriptRecord = {
25
+ payload?: RecordPayload;
26
+ type?: string;
27
+ };
28
+
29
+ type TranscriptCall = {
30
+ evalIds: number[];
31
+ id: string;
32
+ invocations: Invocation[];
33
+ output?: RecordPayload;
34
+ source: string;
35
+ tools: string[];
36
+ verifiable: boolean;
37
+ };
38
+
39
+ export type TranscriptScore = {
40
+ astMcpOutputChars: number;
41
+ errors: string[];
42
+ evaluatedCases: number;
43
+ execBatches: number;
44
+ mutationCalls: number;
45
+ passed: boolean;
46
+ session: string;
47
+ toolCalls: Record<string, number>;
48
+ unscoredBatches: number;
49
+ verifiedAssertions: number;
50
+ };
51
+
52
+ const directToolPrefix = "mcp__ast_mcp__";
53
+ const evalPattern = /ast-mcp-eval:(\d+)/g;
54
+
55
+ function inputText(input: unknown) {
56
+ return typeof input === "string" ? input : JSON.stringify(input ?? {});
57
+ }
58
+
59
+ function messageText(content: unknown) {
60
+ if (typeof content === "string") return content;
61
+ if (!Array.isArray(content)) return "";
62
+ return content
63
+ .map((item) =>
64
+ item && typeof item === "object" && "text" in item
65
+ ? String((item as { text?: unknown }).text ?? "")
66
+ : "",
67
+ )
68
+ .join("\n");
69
+ }
70
+
71
+ function executableSource(source: string) {
72
+ let state: "code" | "line" | "block" | "single" | "double" | "template" =
73
+ "code";
74
+ let escaped = false;
75
+ let masked = "";
76
+ for (let index = 0; index < source.length; index += 1) {
77
+ const character = source[index];
78
+ const next = source[index + 1];
79
+ if (state === "line") {
80
+ if (character === "\n") {
81
+ state = "code";
82
+ masked += character;
83
+ } else masked += " ";
84
+ continue;
85
+ }
86
+ if (state === "block") {
87
+ if (character === "*" && next === "/") {
88
+ masked += " ";
89
+ index += 1;
90
+ state = "code";
91
+ } else masked += character === "\n" ? "\n" : " ";
92
+ continue;
93
+ }
94
+ if (state !== "code") {
95
+ masked += character === "\n" ? "\n" : " ";
96
+ if (escaped) escaped = false;
97
+ else if (character === "\\") escaped = true;
98
+ else if (
99
+ (state === "single" && character === "'") ||
100
+ (state === "double" && character === '"') ||
101
+ (state === "template" && character === "`")
102
+ )
103
+ state = "code";
104
+ continue;
105
+ }
106
+ if (character === "/" && next === "/") {
107
+ masked += " ";
108
+ index += 1;
109
+ state = "line";
110
+ } else if (character === "/" && next === "*") {
111
+ masked += " ";
112
+ index += 1;
113
+ state = "block";
114
+ } else if (character === "'") {
115
+ masked += " ";
116
+ state = "single";
117
+ } else if (character === '"') {
118
+ masked += " ";
119
+ state = "double";
120
+ } else if (character === "`") {
121
+ masked += " ";
122
+ state = "template";
123
+ } else masked += character;
124
+ }
125
+ return masked;
126
+ }
127
+ function isInsidePromiseAll(source: string, position: number) {
128
+ const executable = executableSource(source);
129
+ const promise = executable.lastIndexOf("Promise.all", position);
130
+ if (promise < 0) return false;
131
+ const open = executable.indexOf("(", promise);
132
+ if (open < 0 || open >= position) return false;
133
+ let depth = 1;
134
+ for (let index = open + 1; index < position; index += 1) {
135
+ if (executable[index] === "(") depth += 1;
136
+ else if (executable[index] === ")") depth -= 1;
137
+ }
138
+ return depth > 0;
139
+ }
140
+
141
+ function extractExecInvocations(source: string) {
142
+ const invocations: Array<Omit<Invocation, "index">> = [];
143
+ const expression = /tools\.mcp__ast_mcp__(\w+)\s*\(/g;
144
+ for (const match of executableSource(source).matchAll(expression)) {
145
+ const open = (match.index ?? 0) + match[0].length - 1;
146
+ let depth = 1;
147
+ let quote = "";
148
+ let escaped = false;
149
+ let end = open + 1;
150
+ for (; end < source.length && depth > 0; end += 1) {
151
+ const character = source[end];
152
+ if (quote) {
153
+ if (escaped) escaped = false;
154
+ else if (character === "\\") escaped = true;
155
+ else if (character === quote) quote = "";
156
+ continue;
157
+ }
158
+ if (character === '"' || character === "'" || character === "`") {
159
+ quote = character;
160
+ continue;
161
+ }
162
+ if (character === "(") depth += 1;
163
+ else if (character === ")") depth -= 1;
164
+ }
165
+ if (depth !== 0) continue;
166
+ invocations.push({
167
+ concurrent: isInsidePromiseAll(source, match.index ?? 0),
168
+ input: source.slice(open + 1, end - 1).trim(),
169
+ tool: match[1],
170
+ });
171
+ }
172
+ return invocations;
173
+ }
174
+
175
+ function outputText(output: unknown) {
176
+ const values = Array.isArray(output) ? output : [output];
177
+ return values
178
+ .map((value) => {
179
+ if (typeof value === "string") return value;
180
+ if (value && typeof value === "object" && "text" in value)
181
+ return String((value as { text?: unknown }).text ?? "");
182
+ return JSON.stringify(value ?? "");
183
+ })
184
+ .join("\n");
185
+ }
186
+
187
+ function outputFailed(payload: RecordPayload) {
188
+ if (payload.isError) return true;
189
+ const output = payload.output;
190
+ if (!output || typeof output !== "object") return false;
191
+ return (
192
+ "isError" in output && (output as { isError?: unknown }).isError === true
193
+ );
194
+ }
195
+
196
+ async function loadCases() {
197
+ const directory = import.meta.dir;
198
+ const [primary, fileHash, batch] = await Promise.all(
199
+ ["evals.json", "file-hash.evals.json", "batch.evals.json"].map((file) =>
200
+ readFile(path.join(directory, file), "utf8").then(JSON.parse),
201
+ ),
202
+ );
203
+ return [
204
+ ...(primary as { evals: EvalCase[] }).evals,
205
+ ...(fileHash as EvalCase[]),
206
+ ...(batch as EvalCase[]),
207
+ ];
208
+ }
209
+
210
+ export async function scoreTranscript(
211
+ sessionPath: string,
212
+ strict = false,
213
+ ): Promise<TranscriptScore> {
214
+ const errors: string[] = [];
215
+ const calls = new Map<string, TranscriptCall>();
216
+ const knownCallIds = new Set<string>();
217
+ const outputs = new Map<string, RecordPayload>();
218
+ const roots = new Set<string>();
219
+ const toolCalls: Record<string, number> = {};
220
+ let invocationIndex = 0;
221
+ let activeEvalIds: number[] = [];
222
+ const lines = (await readFile(sessionPath, "utf8"))
223
+ .split(String.fromCharCode(10))
224
+ .filter(Boolean);
225
+
226
+ for (const [index, line] of lines.entries()) {
227
+ let record: TranscriptRecord;
228
+ try {
229
+ record = JSON.parse(line) as TranscriptRecord;
230
+ } catch {
231
+ errors.push(`line ${index + 1}: invalid JSON`);
232
+ continue;
233
+ }
234
+
235
+ const payload = record.payload;
236
+ if (record.type === "turn_context") {
237
+ if (typeof payload?.cwd === "string")
238
+ roots.add(path.resolve(payload.cwd));
239
+ for (const root of payload?.workspace_roots ?? [])
240
+ roots.add(path.resolve(root));
241
+ continue;
242
+ }
243
+ if (
244
+ record.type === "response_item" &&
245
+ payload?.type === "message" &&
246
+ payload.role === "user"
247
+ ) {
248
+ activeEvalIds = [
249
+ ...new Set(
250
+ [...messageText(payload.content).matchAll(evalPattern)].map((match) =>
251
+ Number(match[1]),
252
+ ),
253
+ ),
254
+ ];
255
+ if (activeEvalIds.length > 1)
256
+ errors.push(
257
+ "user evaluation prompt carries multiple eval markers; evidence must be isolated per case",
258
+ );
259
+ continue;
260
+ }
261
+
262
+ if (
263
+ record.type === "response_item" &&
264
+ payload?.type === "custom_tool_call" &&
265
+ typeof payload.call_id === "string" &&
266
+ typeof payload.name === "string"
267
+ ) {
268
+ knownCallIds.add(payload.call_id);
269
+ if (calls.has(payload.call_id)) {
270
+ errors.push(`duplicate call ID: ${payload.call_id}`);
271
+ continue;
272
+ }
273
+ const source = inputText(payload.input);
274
+ const rawInvocations = payload.name.startsWith(directToolPrefix)
275
+ ? [
276
+ {
277
+ input: source,
278
+ tool: payload.name.slice(directToolPrefix.length),
279
+ },
280
+ ]
281
+ : payload.name === "exec"
282
+ ? extractExecInvocations(source)
283
+ : [];
284
+ if (rawInvocations.length === 0) continue;
285
+ const invocations = rawInvocations.map((invocation) => ({
286
+ ...invocation,
287
+ index: invocationIndex++,
288
+ }));
289
+ const evalIds = [
290
+ ...new Set([
291
+ ...activeEvalIds,
292
+ ...[...source.matchAll(evalPattern)].map((match) => Number(match[1])),
293
+ ]),
294
+ ];
295
+ if (evalIds.length > 1)
296
+ errors.push(
297
+ `call ${payload.call_id} carries multiple eval markers; evidence must be isolated per case`,
298
+ );
299
+ calls.set(payload.call_id, {
300
+ evalIds,
301
+ id: payload.call_id,
302
+ invocations,
303
+ source,
304
+ tools: invocations.map((invocation) => invocation.tool),
305
+ verifiable: payload.name.startsWith(directToolPrefix),
306
+ });
307
+ continue;
308
+ }
309
+
310
+ if (
311
+ record.type === "response_item" &&
312
+ payload?.type === "custom_tool_call_output" &&
313
+ typeof payload.call_id === "string"
314
+ ) {
315
+ if (outputs.has(payload.call_id))
316
+ errors.push(`duplicate output ID: ${payload.call_id}`);
317
+ else outputs.set(payload.call_id, payload);
318
+ }
319
+ }
320
+
321
+ let outputChars = 0;
322
+ for (const call of calls.values()) {
323
+ const output = outputs.get(call.id);
324
+ if (!output) {
325
+ errors.push(`missing output for call ID: ${call.id}`);
326
+ continue;
327
+ }
328
+ call.output = output;
329
+ if (outputFailed(output)) errors.push(`failed call ID: ${call.id}`);
330
+ const text = outputText(output.output);
331
+ outputChars += text.length;
332
+ if (call.tools.length > 0 && text.length === 0)
333
+ errors.push(`empty output for ast-mcp call ID: ${call.id}`);
334
+ for (const invocation of call.invocations)
335
+ toolCalls[invocation.tool] = (toolCalls[invocation.tool] ?? 0) + 1;
336
+ }
337
+
338
+ for (const outputId of outputs.keys())
339
+ if (!knownCallIds.has(outputId))
340
+ errors.push(`unmatched output ID: ${outputId}`);
341
+
342
+ const cases = new Map(
343
+ (await loadCases()).map((evaluation) => [evaluation.id, evaluation]),
344
+ );
345
+ let evaluatedCases = 0;
346
+ let unscoredBatches = 0;
347
+ let verifiedAssertions = 0;
348
+ const evaluations = new Map<number, TranscriptCall[]>();
349
+ for (const call of calls.values()) {
350
+ if (call.evalIds.length === 0) {
351
+ unscoredBatches += 1;
352
+ continue;
353
+ }
354
+ if (call.evalIds.length > 1) continue;
355
+ for (const evalId of call.evalIds) {
356
+ const evaluationCalls = evaluations.get(evalId) ?? [];
357
+ evaluationCalls.push(call);
358
+ evaluations.set(evalId, evaluationCalls);
359
+ }
360
+ }
361
+
362
+ for (const [evalId, evaluationCalls] of evaluations) {
363
+ evaluatedCases += 1;
364
+ const evaluation = cases.get(evalId);
365
+ if (!evaluation) {
366
+ errors.push(`unknown eval ID: ${evalId}`);
367
+ continue;
368
+ }
369
+ if (evaluationCalls.some((call) => !call.verifiable)) {
370
+ errors.push(
371
+ `eval ${evalId} uses nested exec evidence that cannot be bound to individual MCP results`,
372
+ );
373
+ continue;
374
+ }
375
+ const executionFailed = evaluationCalls.some(
376
+ (call) => !call.output || outputFailed(call.output),
377
+ );
378
+ if (executionFailed)
379
+ errors.push(`eval ${evalId} has no successful execution output`);
380
+ const text = evaluationCalls
381
+ .map((call) => outputText(call.output?.output))
382
+ .join(String.fromCharCode(10));
383
+ const invocations = evaluationCalls
384
+ .flatMap((call) => call.invocations)
385
+ .sort((left, right) => left.index - right.index);
386
+ const semanticErrors = verifyEvaluation(evaluation, invocations, text, [
387
+ ...roots,
388
+ ]);
389
+ for (const error of semanticErrors) errors.push(`eval ${evalId} ${error}`);
390
+ if (!executionFailed && semanticErrors.length === 0)
391
+ verifiedAssertions += evaluation.assertions.length;
392
+ }
393
+
394
+ if (strict && evaluatedCases === 0)
395
+ errors.push("strict scoring requires at least one ast-mcp-eval marker");
396
+ if (strict && evaluatedCases > 0)
397
+ for (const evaluation of cases.values())
398
+ if (!evaluations.has(evaluation.id))
399
+ errors.push(
400
+ `strict scoring requires complete evaluation matrix; missing eval ${evaluation.id}`,
401
+ );
402
+
403
+ const mutationCalls =
404
+ (toolCalls.file_patch ?? 0) + (toolCalls.file_write ?? 0);
405
+ return {
406
+ astMcpOutputChars: outputChars,
407
+ errors,
408
+ evaluatedCases,
409
+ execBatches: calls.size,
410
+ mutationCalls,
411
+ passed: errors.length === 0,
412
+ session: sessionPath,
413
+ toolCalls,
414
+ unscoredBatches,
415
+ verifiedAssertions,
416
+ };
417
+ }