agentv 4.26.0-next.1 → 4.26.1
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/dist/{artifact-writer-EX6SOLA5.js → artifact-writer-VRDVTNSX.js} +6 -4
- package/dist/{chunk-NLS5DS52.js → chunk-6BAB3XBI.js} +2 -2
- package/dist/{chunk-NLS5DS52.js.map → chunk-6BAB3XBI.js.map} +1 -1
- package/dist/{chunk-63LUDTLO.js → chunk-JA4WQNE6.js} +18 -9
- package/dist/chunk-JA4WQNE6.js.map +1 -0
- package/dist/{chunk-A5INWVY3.js → chunk-TWBKRGXR.js} +43 -7
- package/dist/chunk-TWBKRGXR.js.map +1 -0
- package/dist/{chunk-ZGEGRM5T.js → chunk-VOOYHYPR.js} +30 -5
- package/dist/chunk-VOOYHYPR.js.map +1 -0
- package/dist/{chunk-4QP2SFRS.js → chunk-XBUHMRX2.js} +68 -6
- package/dist/{chunk-4QP2SFRS.js.map → chunk-XBUHMRX2.js.map} +1 -1
- package/dist/cli.js +20 -5
- package/dist/cli.js.map +1 -1
- package/dist/{dist-SGFUYCY5.js → dist-COH43OLQ.js} +10 -4
- package/dist/index.js +5 -5
- package/dist/{interactive-CCOGDYRK.js → interactive-YMKWKPD7.js} +5 -5
- package/dist/studio/assets/index-BGFW04Lj.css +1 -0
- package/dist/studio/assets/{index-DRYeLvWd.js → index-DLabAPXU.js} +1 -1
- package/dist/studio/assets/{index-qd53QYOH.js → index-inPa17Qe.js} +17 -17
- package/dist/studio/index.html +2 -2
- package/dist/{ts-eval-loader-E6N374V2-VMFNVF5J.js → ts-eval-loader-BZ54W52K-KLIY3S3N.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-63LUDTLO.js.map +0 -1
- package/dist/chunk-A5INWVY3.js.map +0 -1
- package/dist/chunk-ZGEGRM5T.js.map +0 -1
- package/dist/studio/assets/index-DttU4JJk.css +0 -1
- /package/dist/{artifact-writer-EX6SOLA5.js.map → artifact-writer-VRDVTNSX.js.map} +0 -0
- /package/dist/{dist-SGFUYCY5.js.map → dist-COH43OLQ.js.map} +0 -0
- /package/dist/{interactive-CCOGDYRK.js.map → interactive-YMKWKPD7.js.map} +0 -0
- /package/dist/{ts-eval-loader-E6N374V2-VMFNVF5J.js.map → ts-eval-loader-BZ54W52K-KLIY3S3N.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
toTranscriptJsonLines
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6BAB3XBI.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_THRESHOLD
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VOOYHYPR.js";
|
|
8
8
|
|
|
9
9
|
// src/commands/eval/artifact-writer.ts
|
|
10
10
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
@@ -135,13 +135,29 @@ async function aggregateRunDir(runDir, options) {
|
|
|
135
135
|
const timingPath = path2.join(runDir, "timing.json");
|
|
136
136
|
await writeFile(timingPath, `${JSON.stringify(timing, null, 2)}
|
|
137
137
|
`, "utf8");
|
|
138
|
-
const
|
|
138
|
+
const plannedTestCount = options?.plannedTestCount ?? await readPlannedTestCount(path2.join(runDir, "benchmark.json"));
|
|
139
|
+
const benchmark = buildBenchmarkArtifact(
|
|
140
|
+
results,
|
|
141
|
+
options?.evalFile,
|
|
142
|
+
options?.experiment,
|
|
143
|
+
plannedTestCount
|
|
144
|
+
);
|
|
139
145
|
const benchmarkPath = path2.join(runDir, "benchmark.json");
|
|
140
146
|
await writeFile(benchmarkPath, `${JSON.stringify(benchmark, null, 2)}
|
|
141
147
|
`, "utf8");
|
|
142
148
|
const targetSet = new Set(results.map((r) => r.target ?? "unknown"));
|
|
143
149
|
return { benchmarkPath, timingPath, testCount: results.length, targetCount: targetSet.size };
|
|
144
150
|
}
|
|
151
|
+
async function readPlannedTestCount(benchmarkPath) {
|
|
152
|
+
try {
|
|
153
|
+
const raw = await readFile(benchmarkPath, "utf8");
|
|
154
|
+
const parsed = JSON.parse(raw);
|
|
155
|
+
const value = parsed.metadata?.planned_test_count;
|
|
156
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
157
|
+
} catch {
|
|
158
|
+
return void 0;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
145
161
|
function computeStats(values) {
|
|
146
162
|
if (values.length === 0) {
|
|
147
163
|
return { mean: 0, stddev: 0 };
|
|
@@ -277,7 +293,7 @@ function buildTimingArtifact(results) {
|
|
|
277
293
|
}
|
|
278
294
|
};
|
|
279
295
|
}
|
|
280
|
-
function buildBenchmarkArtifact(results, evalFile = "", experiment) {
|
|
296
|
+
function buildBenchmarkArtifact(results, evalFile = "", experiment, plannedTestCount) {
|
|
281
297
|
const targetSet = /* @__PURE__ */ new Set();
|
|
282
298
|
const testIdSet = /* @__PURE__ */ new Set();
|
|
283
299
|
for (const result of results) {
|
|
@@ -349,13 +365,26 @@ function buildBenchmarkArtifact(results, evalFile = "", experiment) {
|
|
|
349
365
|
timestamp,
|
|
350
366
|
targets,
|
|
351
367
|
tests_run: testIds,
|
|
352
|
-
experiment
|
|
368
|
+
experiment,
|
|
369
|
+
planned_test_count: plannedTestCount
|
|
353
370
|
},
|
|
354
371
|
run_summary: runSummary,
|
|
355
372
|
per_grader_summary: perEvaluatorSummary,
|
|
356
373
|
notes
|
|
357
374
|
};
|
|
358
375
|
}
|
|
376
|
+
async function writeInitialBenchmarkArtifact(runDir, options) {
|
|
377
|
+
await mkdir(runDir, { recursive: true });
|
|
378
|
+
const stub = buildBenchmarkArtifact(
|
|
379
|
+
[],
|
|
380
|
+
options.evalFile,
|
|
381
|
+
options.experiment,
|
|
382
|
+
options.plannedTestCount
|
|
383
|
+
);
|
|
384
|
+
const benchmarkPath = path2.join(runDir, "benchmark.json");
|
|
385
|
+
await writeFile(benchmarkPath, `${JSON.stringify(stub, null, 2)}
|
|
386
|
+
`, "utf8");
|
|
387
|
+
}
|
|
359
388
|
function buildAggregateGradingArtifact(results) {
|
|
360
389
|
const assertions = [];
|
|
361
390
|
for (const result of results) {
|
|
@@ -656,7 +685,13 @@ async function writeArtifactsFromResults(results, outputDir, options) {
|
|
|
656
685
|
const timing = buildTimingArtifact(results);
|
|
657
686
|
await writeFile(timingPath, `${JSON.stringify(timing, null, 2)}
|
|
658
687
|
`, "utf8");
|
|
659
|
-
const
|
|
688
|
+
const plannedTestCount = options?.plannedTestCount ?? await readPlannedTestCount(benchmarkPath);
|
|
689
|
+
const benchmark = buildBenchmarkArtifact(
|
|
690
|
+
results,
|
|
691
|
+
options?.evalFile,
|
|
692
|
+
options?.experiment,
|
|
693
|
+
plannedTestCount
|
|
694
|
+
);
|
|
660
695
|
await writeFile(benchmarkPath, `${JSON.stringify(benchmark, null, 2)}
|
|
661
696
|
`, "utf8");
|
|
662
697
|
await writeJsonlFile(indexPath, indexRecords);
|
|
@@ -682,6 +717,7 @@ export {
|
|
|
682
717
|
buildGradingArtifact,
|
|
683
718
|
buildTimingArtifact,
|
|
684
719
|
buildBenchmarkArtifact,
|
|
720
|
+
writeInitialBenchmarkArtifact,
|
|
685
721
|
buildAggregateGradingArtifact,
|
|
686
722
|
buildIndexArtifactEntry,
|
|
687
723
|
buildResultIndexArtifact,
|
|
@@ -690,4 +726,4 @@ export {
|
|
|
690
726
|
writePerTestArtifacts,
|
|
691
727
|
writeArtifactsFromResults
|
|
692
728
|
};
|
|
693
|
-
//# sourceMappingURL=chunk-
|
|
729
|
+
//# sourceMappingURL=chunk-TWBKRGXR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/eval/artifact-writer.ts","../src/utils/case-conversion.ts","../src/commands/eval/result-layout.ts"],"sourcesContent":["import { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport {\n DEFAULT_THRESHOLD,\n type EvaluationResult,\n type GraderResult,\n toTranscriptJsonLines,\n} from '@agentv/core';\nimport { toSnakeCaseDeep } from '../../utils/case-conversion.js';\nimport { RESULT_INDEX_FILENAME } from './result-layout.js';\n\nexport function buildTestTargetKey(testId?: string, target?: string): string {\n return `${testId ?? 'unknown'}::${target ?? 'unknown'}`;\n}\n\n// Deduplication helper — keeps the last entry per (test_id, target) pair.\nexport function deduplicateByTestIdTarget(\n results: readonly EvaluationResult[],\n): EvaluationResult[] {\n const seen = new Map<string, number>();\n for (let i = 0; i < results.length; i++) {\n seen.set(buildTestTargetKey(results[i].testId, results[i].target), i);\n }\n const deduped: EvaluationResult[] = [];\n for (let i = 0; i < results.length; i++) {\n const key = buildTestTargetKey(results[i].testId, results[i].target);\n if (seen.get(key) === i) {\n deduped.push(results[i]);\n }\n }\n return deduped;\n}\n\nexport async function aggregateRunDir(\n runDir: string,\n options?: { evalFile?: string; experiment?: string; plannedTestCount?: number },\n): Promise<{ benchmarkPath: string; timingPath: string; testCount: number; targetCount: number }> {\n const indexPath = path.join(runDir, RESULT_INDEX_FILENAME);\n const content = await readFile(indexPath, 'utf8');\n const allResults = parseJsonlResults(content);\n const results = deduplicateByTestIdTarget(allResults);\n\n const timing = buildTimingArtifact(results);\n const timingPath = path.join(runDir, 'timing.json');\n await writeFile(timingPath, `${JSON.stringify(timing, null, 2)}\\n`, 'utf8');\n\n // Preserve `planned_test_count` from any pre-existing benchmark.json (e.g.\n // the stub written at run start, or from the original run when this is a\n // resume) unless an explicit value was passed.\n const plannedTestCount =\n options?.plannedTestCount ?? (await readPlannedTestCount(path.join(runDir, 'benchmark.json')));\n\n const benchmark = buildBenchmarkArtifact(\n results,\n options?.evalFile,\n options?.experiment,\n plannedTestCount,\n );\n const benchmarkPath = path.join(runDir, 'benchmark.json');\n await writeFile(benchmarkPath, `${JSON.stringify(benchmark, null, 2)}\\n`, 'utf8');\n\n const targetSet = new Set(results.map((r) => r.target ?? 'unknown'));\n return { benchmarkPath, timingPath, testCount: results.length, targetCount: targetSet.size };\n}\n\nasync function readPlannedTestCount(benchmarkPath: string): Promise<number | undefined> {\n try {\n const raw = await readFile(benchmarkPath, 'utf8');\n const parsed = JSON.parse(raw) as { metadata?: { planned_test_count?: number } };\n const value = parsed.metadata?.planned_test_count;\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n } catch {\n return undefined;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Artifact interfaces (snake_case to match skill-creator conventions)\n// ---------------------------------------------------------------------------\n\nexport interface GradingArtifact {\n readonly assertions: readonly {\n readonly text: string;\n readonly passed: boolean;\n readonly evidence: string;\n }[];\n readonly summary: {\n readonly passed: number;\n readonly failed: number;\n readonly total: number;\n readonly pass_rate: number;\n };\n readonly execution_metrics: {\n readonly tool_calls: Record<string, number>;\n readonly total_tool_calls: number;\n readonly errors_encountered: number;\n };\n readonly graders?: readonly {\n readonly name: string;\n readonly type: string;\n readonly score: number;\n readonly reasoning: string;\n readonly [key: string]: unknown;\n }[];\n readonly workspace_changes?: {\n readonly files_modified: number;\n readonly files_created: number;\n readonly diff_summary: string;\n };\n readonly conversation?: {\n readonly turns: number;\n readonly conversation_id: string;\n };\n}\n\nexport interface TimingArtifact {\n readonly total_tokens: number;\n readonly duration_ms: number;\n readonly total_duration_seconds: number;\n readonly token_usage: {\n readonly input: number;\n readonly output: number;\n readonly reasoning: number;\n };\n}\n\nexport interface BenchmarkArtifact {\n readonly metadata: {\n readonly eval_file: string;\n readonly timestamp: string;\n readonly targets: readonly string[];\n readonly tests_run: readonly string[];\n readonly experiment?: string;\n /**\n * Total number of test cases the run was planned to execute (across all\n * targets and eval files). Written at run start so an interrupted run\n * can be diagnosed as resumable when `tests_run.length < planned_test_count`,\n * even if every recorded row has `execution_status: ok`.\n */\n readonly planned_test_count?: number;\n };\n readonly run_summary: Record<\n string,\n {\n readonly pass_rate: { readonly mean: number; readonly stddev: number };\n readonly time_seconds: { readonly mean: number; readonly stddev: number };\n readonly tokens: { readonly mean: number; readonly stddev: number };\n readonly tool_calls?: { readonly mean: number; readonly stddev: number };\n readonly cost_usd?: { readonly mean: number; readonly stddev: number };\n }\n >;\n readonly per_grader_summary?: Record<string, { readonly mean: number; readonly stddev: number }>;\n readonly notes: readonly string[];\n}\n\nexport interface AggregateGradingArtifact {\n readonly assertions: readonly {\n readonly test_id: string;\n readonly text: string;\n readonly passed: boolean;\n readonly evidence: string;\n }[];\n readonly summary: {\n readonly passed: number;\n readonly failed: number;\n readonly total: number;\n readonly pass_rate: number;\n };\n}\n\nexport interface IndexArtifactEntry {\n readonly timestamp: string;\n readonly test_id: string;\n readonly suite?: string;\n readonly category?: string;\n readonly conversation_id?: string;\n readonly experiment?: string;\n readonly score: number;\n readonly target: string;\n readonly scores?: readonly Record<string, unknown>[];\n readonly execution_status?: string;\n readonly error?: string;\n readonly failure_stage?: string;\n readonly failure_reason_code?: string;\n readonly workspace_path?: string;\n readonly grading_path: string;\n readonly timing_path: string;\n readonly output_path?: string;\n readonly input_path?: string;\n readonly response_path?: string;\n /** Case-level metadata pass-through (governance taxonomies, skill tags, etc.). */\n readonly metadata?: Record<string, unknown>;\n}\n\nexport type ResultIndexArtifact = IndexArtifactEntry;\n\n// ---------------------------------------------------------------------------\n// Statistics helpers\n// ---------------------------------------------------------------------------\n\nfunction computeStats(values: readonly number[]): { mean: number; stddev: number } {\n if (values.length === 0) {\n return { mean: 0, stddev: 0 };\n }\n const mean = values.reduce((sum, v) => sum + v, 0) / values.length;\n const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / values.length;\n return {\n mean: Math.round(mean * 1000) / 1000,\n stddev: Math.round(Math.sqrt(variance) * 1000) / 1000,\n };\n}\n\nfunction computePassRate(result: EvaluationResult): number {\n const scores = result.scores;\n if (scores && scores.length > 0) {\n const passed = scores.filter((s) => s.score >= DEFAULT_THRESHOLD).length;\n return passed / scores.length;\n }\n return (result.score ?? 0) >= DEFAULT_THRESHOLD ? 1.0 : 0.0;\n}\n\n// ---------------------------------------------------------------------------\n// Tool-call counting from trace data\n// ---------------------------------------------------------------------------\n\nfunction countToolCalls(result: EvaluationResult): {\n toolCalls: Record<string, number>;\n total: number;\n} {\n const toolCalls: Record<string, number> = {};\n let total = 0;\n\n const trace = result.trace as\n | { steps?: readonly { toolName?: string; type?: string }[] }\n | undefined;\n\n if (trace?.steps) {\n for (const step of trace.steps) {\n if (step.toolName || step.type === 'tool') {\n const name = step.toolName ?? 'unknown';\n toolCalls[name] = (toolCalls[name] ?? 0) + 1;\n total += 1;\n }\n }\n }\n\n return { toolCalls, total };\n}\n\n// ---------------------------------------------------------------------------\n// Workspace change parsing from fileChanges diff\n// ---------------------------------------------------------------------------\n\nfunction parseWorkspaceChanges(\n fileChanges: string | undefined,\n): GradingArtifact['workspace_changes'] | undefined {\n if (!fileChanges) {\n return undefined;\n }\n\n let filesModified = 0;\n let filesCreated = 0;\n\n const lines = fileChanges.split('\\n');\n for (const line of lines) {\n if (line.startsWith('--- /dev/null')) {\n filesCreated += 1;\n } else if (line.startsWith('--- a/')) {\n filesModified += 1;\n }\n }\n\n const summaryLines = lines.slice(0, 20);\n const diffSummary =\n lines.length > 20\n ? `${summaryLines.join('\\n')}\\n... (${lines.length - 20} more lines)`\n : fileChanges;\n\n return {\n files_modified: filesModified,\n files_created: filesCreated,\n diff_summary: diffSummary,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Build assertions from evaluation result (skill-creator compatible)\n// ---------------------------------------------------------------------------\n\nfunction buildAssertions(result: EvaluationResult): GradingArtifact['assertions'] {\n if (!result.assertions) return [];\n return result.assertions.map((a) => ({\n text: a.text,\n passed: a.passed,\n evidence: a.evidence ?? '',\n }));\n}\n\n// ---------------------------------------------------------------------------\n// Build graders list\n// ---------------------------------------------------------------------------\n\nfunction buildEvaluators(scores: readonly GraderResult[] | undefined): GradingArtifact['graders'] {\n if (!scores || scores.length === 0) {\n return undefined;\n }\n\n return scores.map((s) => ({\n name: s.name,\n type: s.type,\n score: s.score,\n reasoning: '',\n weight: s.weight,\n verdict: s.verdict,\n assertions: s.assertions,\n details: s.details,\n }));\n}\n\n// ---------------------------------------------------------------------------\n// Public artifact builders\n// ---------------------------------------------------------------------------\n\nexport function buildGradingArtifact(result: EvaluationResult): GradingArtifact {\n const assertions = buildAssertions(result);\n const passed = assertions.filter((e) => e.passed).length;\n const failed = assertions.filter((e) => !e.passed).length;\n const total = assertions.length;\n\n const { toolCalls, total: totalToolCalls } = countToolCalls(result);\n const errorsEncountered = result.error ? 1 : 0;\n\n return {\n assertions,\n summary: {\n passed,\n failed,\n total,\n pass_rate: total > 0 ? Math.round((passed / total) * 1000) / 1000 : 0,\n },\n execution_metrics: {\n tool_calls: toolCalls,\n total_tool_calls: totalToolCalls,\n errors_encountered: errorsEncountered,\n },\n graders: buildEvaluators(result.scores),\n workspace_changes: parseWorkspaceChanges(result.fileChanges),\n conversation: result.conversationId\n ? {\n turns: result.trace\n ? ((result.trace as { steps?: readonly unknown[] }).steps?.length ?? 0)\n : 0,\n conversation_id: result.conversationId,\n }\n : undefined,\n };\n}\n\nexport function buildTimingArtifact(results: readonly EvaluationResult[]): TimingArtifact {\n let totalInput = 0;\n let totalOutput = 0;\n let totalReasoning = 0;\n let totalDurationMs = 0;\n\n for (const result of results) {\n const usage = result.tokenUsage as\n | { input?: number; output?: number; reasoning?: number }\n | undefined;\n if (usage) {\n totalInput += usage.input ?? 0;\n totalOutput += usage.output ?? 0;\n totalReasoning += usage.reasoning ?? 0;\n }\n if (result.durationMs != null) {\n totalDurationMs += result.durationMs;\n }\n }\n\n return {\n total_tokens: totalInput + totalOutput,\n duration_ms: totalDurationMs,\n total_duration_seconds: Math.round((totalDurationMs / 1000) * 1000) / 1000,\n token_usage: {\n input: totalInput,\n output: totalOutput,\n reasoning: totalReasoning,\n },\n };\n}\n\nexport function buildBenchmarkArtifact(\n results: readonly EvaluationResult[],\n evalFile = '',\n experiment?: string,\n plannedTestCount?: number,\n): BenchmarkArtifact {\n const targetSet = new Set<string>();\n const testIdSet = new Set<string>();\n for (const result of results) {\n targetSet.add(result.target ?? 'unknown');\n testIdSet.add(result.testId ?? 'unknown');\n }\n\n const targets = [...targetSet].sort();\n const testIds = [...testIdSet].sort();\n\n const runSummary: BenchmarkArtifact['run_summary'] = {};\n const notes: string[] = [];\n\n for (const target of targets) {\n const targetResults = results.filter((r) => r.target === target);\n\n const passRates = targetResults.map(computePassRate);\n const timings = targetResults\n .filter((r) => r.durationMs != null)\n .map((r) => (r.durationMs as number) / 1000);\n const tokens = targetResults\n .filter((r) => r.tokenUsage != null)\n .map((r) => {\n const usage = r.tokenUsage as { input?: number; output?: number };\n return (usage.input ?? 0) + (usage.output ?? 0);\n });\n\n const entry: Record<string, unknown> = {\n pass_rate: computeStats(passRates),\n time_seconds: computeStats(timings),\n tokens: computeStats(tokens),\n };\n\n // Optional tool_calls stats from trace data\n const toolCallCounts = targetResults.map((r) => countToolCalls(r).total);\n if (toolCallCounts.some((c) => c > 0)) {\n entry.tool_calls = computeStats(toolCallCounts);\n }\n\n // Optional cost stats\n const costs = targetResults.filter((r) => r.costUsd != null).map((r) => r.costUsd as number);\n if (costs.length > 0) {\n entry.cost_usd = computeStats(costs);\n }\n\n runSummary[target] = entry as (typeof runSummary)[string];\n }\n\n // Per-grader summary across all results\n const evaluatorScores = new Map<string, number[]>();\n for (const result of results) {\n if (result.scores) {\n for (const score of result.scores) {\n const key = `${score.name}:${score.type}`;\n if (!evaluatorScores.has(key)) {\n evaluatorScores.set(key, []);\n }\n evaluatorScores.get(key)?.push(score.score);\n }\n }\n }\n\n let perEvaluatorSummary: Record<string, { mean: number; stddev: number }> | undefined;\n if (evaluatorScores.size > 0) {\n perEvaluatorSummary = {};\n for (const [key, scores] of evaluatorScores) {\n perEvaluatorSummary[key] = computeStats(scores);\n }\n }\n\n const errorCount = results.filter(\n (r) => r.executionStatus != null && r.executionStatus === 'execution_error',\n ).length;\n if (errorCount > 0) {\n notes.push(\n `${errorCount} test(s) had execution errors and are included in pass_rate as failures`,\n );\n }\n if (results.length === 0) {\n notes.push('No results to summarize');\n }\n\n const firstResult = results[0];\n const timestamp = firstResult?.timestamp ?? new Date().toISOString();\n\n return {\n metadata: {\n eval_file: evalFile,\n timestamp,\n targets,\n tests_run: testIds,\n experiment,\n planned_test_count: plannedTestCount,\n },\n run_summary: runSummary,\n per_grader_summary: perEvaluatorSummary,\n notes,\n };\n}\n\n/**\n * Write a stub `benchmark.json` at the start of a run, before any tests\n * have executed. Carries `planned_test_count` so an interrupted run can\n * still be detected as resumable even when every recorded row has\n * `execution_status: ok`.\n *\n * The end-of-run write (writeArtifactsFromResults / aggregateRunDir)\n * overwrites this file with the full summary; preserve `planned_test_count`\n * by passing it through.\n */\nexport async function writeInitialBenchmarkArtifact(\n runDir: string,\n options: {\n evalFile: string;\n plannedTestCount: number;\n experiment?: string;\n },\n): Promise<void> {\n await mkdir(runDir, { recursive: true });\n const stub = buildBenchmarkArtifact(\n [],\n options.evalFile,\n options.experiment,\n options.plannedTestCount,\n );\n const benchmarkPath = path.join(runDir, 'benchmark.json');\n await writeFile(benchmarkPath, `${JSON.stringify(stub, null, 2)}\\n`, 'utf8');\n}\n\nexport function buildAggregateGradingArtifact(\n results: readonly EvaluationResult[],\n): AggregateGradingArtifact {\n const assertions: AggregateGradingArtifact['assertions'][number][] = [];\n\n for (const result of results) {\n if (!result.assertions) continue;\n const testId = result.testId ?? 'unknown';\n for (const a of result.assertions) {\n assertions.push({\n test_id: testId,\n text: a.text,\n passed: a.passed,\n evidence: a.evidence ?? '',\n });\n }\n }\n\n const passed = assertions.filter((a) => a.passed).length;\n const failed = assertions.filter((a) => !a.passed).length;\n const total = assertions.length;\n\n return {\n assertions,\n summary: {\n passed,\n failed,\n total,\n pass_rate: total > 0 ? Math.round((passed / total) * 1000) / 1000 : 0,\n },\n };\n}\n\nfunction safeArtifactPathSegment(value: string | undefined, fallback: string): string {\n const trimmed = value?.trim();\n if (!trimmed) {\n return fallback;\n }\n return trimmed.replace(/[/\\\\:*?\"<>|]/g, '_');\n}\n\nfunction safeTestId(testId: string | undefined): string {\n return safeArtifactPathSegment(testId, 'unknown');\n}\n\nfunction getSuite(result: EvaluationResult): string | undefined {\n return result.suite;\n}\n\nfunction buildArtifactSubdir(result: EvaluationResult): string {\n const segments = [];\n const evalSet = getSuite(result);\n if (evalSet) {\n segments.push(safeArtifactPathSegment(evalSet, 'default'));\n }\n segments.push(safeTestId(result.testId));\n return path.posix.join(...segments);\n}\n\nfunction formatOutputMarkdown(output: readonly { role: string; content?: unknown }[]): string {\n return output.map((msg) => `@[${msg.role}]:\\n${String(msg.content ?? '')}`).join('\\n\\n');\n}\n\nfunction extractInput(result: EvaluationResult): string | null {\n const input = (result as unknown as Record<string, unknown>).input;\n if (!input) return null;\n if (typeof input === 'string') return input;\n if (Array.isArray(input) && input.length > 0) {\n return formatOutputMarkdown(input as { role: string; content?: unknown }[]);\n }\n return null;\n}\n\nfunction toRelativeArtifactPath(outputDir: string, filePath: string): string {\n return path.relative(outputDir, filePath).split(path.sep).join('/');\n}\n\nexport function buildIndexArtifactEntry(\n result: EvaluationResult,\n options: {\n outputDir: string;\n gradingPath: string;\n timingPath: string;\n outputPath?: string;\n inputPath?: string;\n },\n): IndexArtifactEntry {\n return {\n timestamp: result.timestamp,\n test_id: result.testId ?? 'unknown',\n suite: getSuite(result),\n category: result.category,\n conversation_id: result.conversationId,\n score: result.score,\n target: result.target ?? 'unknown',\n scores: result.scores\n ? (toSnakeCaseDeep(result.scores) as IndexArtifactEntry['scores'])\n : undefined,\n execution_status: result.executionStatus,\n error: result.error,\n failure_stage: result.failureStage,\n failure_reason_code: result.failureReasonCode,\n workspace_path: result.workspacePath,\n grading_path: toRelativeArtifactPath(options.outputDir, options.gradingPath),\n timing_path: toRelativeArtifactPath(options.outputDir, options.timingPath),\n output_path: options.outputPath\n ? toRelativeArtifactPath(options.outputDir, options.outputPath)\n : undefined,\n input_path: options.inputPath\n ? toRelativeArtifactPath(options.outputDir, options.inputPath)\n : undefined,\n metadata: result.metadata,\n };\n}\n\nexport function buildResultIndexArtifact(result: EvaluationResult): ResultIndexArtifact {\n const artifactSubdir = buildArtifactSubdir(result);\n const input = extractInput(result);\n const hasResponse = Array.isArray(result.output) && result.output.length > 0;\n\n return {\n timestamp: result.timestamp,\n test_id: result.testId ?? 'unknown',\n suite: getSuite(result),\n category: result.category,\n conversation_id: result.conversationId,\n score: result.score,\n target: result.target ?? 'unknown',\n scores: result.scores\n ? (toSnakeCaseDeep(result.scores) as IndexArtifactEntry['scores'])\n : undefined,\n execution_status: result.executionStatus,\n error: result.error,\n failure_stage: result.failureStage,\n failure_reason_code: result.failureReasonCode,\n workspace_path: result.workspacePath,\n grading_path: path.posix.join(artifactSubdir, 'grading.json'),\n timing_path: path.posix.join(artifactSubdir, 'timing.json'),\n input_path: input ? path.posix.join(artifactSubdir, 'input.md') : undefined,\n output_path: hasResponse\n ? path.posix.join(artifactSubdir, 'outputs', 'response.md')\n : undefined,\n response_path: hasResponse\n ? path.posix.join(artifactSubdir, 'outputs', 'response.md')\n : undefined,\n metadata: result.metadata,\n };\n}\n\nasync function writeJsonlFile(filePath: string, records: readonly unknown[]): Promise<void> {\n const content =\n records.length === 0\n ? ''\n : `${records.map((record) => JSON.stringify(toSnakeCaseDeep(record))).join('\\n')}\\n`;\n await writeFile(filePath, content, 'utf8');\n}\n\n// ---------------------------------------------------------------------------\n// Snake_case to camelCase conversion for reading JSONL files\n// ---------------------------------------------------------------------------\n\nfunction toCamelCase(str: string): string {\n return str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());\n}\n\nfunction toCamelCaseDeep(obj: unknown): unknown {\n if (obj === null || obj === undefined) {\n return obj;\n }\n if (Array.isArray(obj)) {\n return obj.map((item) => toCamelCaseDeep(item));\n }\n if (typeof obj === 'object') {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n result[toCamelCase(key)] = toCamelCaseDeep(value);\n }\n return result;\n }\n return obj;\n}\n\ntype ParsedEvaluationResult = Record<string, unknown> & {\n timestamp: string;\n testId: string;\n score: number;\n assertions: EvaluationResult['assertions'];\n target: string;\n output: EvaluationResult['output'];\n executionStatus: EvaluationResult['executionStatus'];\n};\n\nconst EXECUTION_STATUSES = new Set<EvaluationResult['executionStatus']>([\n 'ok',\n 'quality_failure',\n 'execution_error',\n]);\n\nfunction isAssertionEntry(value: unknown): value is EvaluationResult['assertions'][number] {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return false;\n }\n\n const candidate = value as { text?: unknown; passed?: unknown; evidence?: unknown };\n return (\n typeof candidate.text === 'string' &&\n typeof candidate.passed === 'boolean' &&\n (candidate.evidence === undefined || typeof candidate.evidence === 'string')\n );\n}\n\nfunction isOutputMessage(value: unknown): value is EvaluationResult['output'][number] {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return false;\n }\n\n const candidate = value as { role?: unknown };\n return typeof candidate.role === 'string';\n}\n\nfunction isExecutionStatus(value: unknown): value is EvaluationResult['executionStatus'] {\n return (\n typeof value === 'string' &&\n EXECUTION_STATUSES.has(value as EvaluationResult['executionStatus'])\n );\n}\n\nfunction normalizeParsedResult(value: unknown): ParsedEvaluationResult | undefined {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return undefined;\n }\n\n const result = value as Record<string, unknown>;\n return {\n ...result,\n timestamp: typeof result.timestamp === 'string' ? result.timestamp : new Date(0).toISOString(),\n testId: typeof result.testId === 'string' ? result.testId : 'unknown',\n score: typeof result.score === 'number' ? result.score : 0,\n assertions: Array.isArray(result.assertions) ? result.assertions.filter(isAssertionEntry) : [],\n target: typeof result.target === 'string' ? result.target : 'unknown',\n output: Array.isArray(result.output) ? result.output.filter(isOutputMessage) : [],\n executionStatus: isExecutionStatus(result.executionStatus) ? result.executionStatus : 'ok',\n };\n}\n\n// ---------------------------------------------------------------------------\n// JSONL parsing\n// ---------------------------------------------------------------------------\n\nexport function parseJsonlResults(content: string): EvaluationResult[] {\n const results: EvaluationResult[] = [];\n const lines = content.split('\\n');\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed.length === 0) {\n continue;\n }\n try {\n const parsed = JSON.parse(trimmed);\n // JSONL files from AgentV use snake_case; convert back to camelCase\n const camelCased = toCamelCaseDeep(parsed);\n const normalized = normalizeParsedResult(camelCased);\n if (normalized) {\n results.push(normalized);\n }\n } catch {\n // Skip malformed lines\n }\n }\n return results;\n}\n\n// ---------------------------------------------------------------------------\n// Artifact writer — reads JSONL and writes all three artifact types\n// ---------------------------------------------------------------------------\n\nexport async function writeArtifacts(\n jsonlPath: string,\n outputDir: string,\n options?: { evalFile?: string; experiment?: string },\n): Promise<{\n testArtifactDir: string;\n timingPath: string;\n benchmarkPath: string;\n indexPath: string;\n}> {\n const content = await readFile(jsonlPath, 'utf8');\n const results = parseJsonlResults(content);\n\n return writeArtifactsFromResults(results, outputDir, options);\n}\n\nfunction buildTranscriptMessageLines(results: readonly EvaluationResult[]): string {\n const lines: string[] = [];\n\n for (const result of results) {\n const transcriptLines = toTranscriptJsonLines(\n {\n messages: [...(result.input ?? []), ...result.output],\n source: {\n provider: result.target,\n sessionId: result.conversationId ?? result.testId,\n startedAt: result.timestamp,\n },\n tokenUsage: result.tokenUsage,\n durationMs: result.durationMs,\n costUsd: result.costUsd,\n },\n {\n testId: result.testId,\n target: result.target,\n },\n );\n\n lines.push(...transcriptLines.map((line) => JSON.stringify(line)));\n }\n\n return lines.length > 0 ? `${lines.join('\\n')}\\n` : '';\n}\n\nexport async function writePerTestArtifacts(\n results: readonly EvaluationResult[],\n outputDir: string,\n options?: { experiment?: string },\n): Promise<void> {\n await mkdir(outputDir, { recursive: true });\n for (const result of results) {\n const grading = buildGradingArtifact(result);\n const timing = buildTimingArtifact([result]);\n const artifactSubdir = buildArtifactSubdir(result);\n const testDir = path.join(outputDir, artifactSubdir);\n await mkdir(testDir, { recursive: true });\n await writeFile(\n path.join(testDir, 'grading.json'),\n `${JSON.stringify(grading, null, 2)}\\n`,\n 'utf8',\n );\n await writeFile(\n path.join(testDir, 'timing.json'),\n `${JSON.stringify(timing, null, 2)}\\n`,\n 'utf8',\n );\n\n const input = extractInput(result);\n if (input) {\n await writeFile(path.join(testDir, 'input.md'), input, 'utf8');\n }\n if (result.output && result.output.length > 0) {\n const outputsDir = path.join(testDir, 'outputs');\n await mkdir(outputsDir, { recursive: true });\n await writeFile(\n path.join(outputsDir, 'response.md'),\n formatOutputMarkdown(result.output),\n 'utf8',\n );\n }\n }\n}\n\nexport async function writeArtifactsFromResults(\n results: readonly EvaluationResult[],\n outputDir: string,\n options?: { evalFile?: string; experiment?: string; plannedTestCount?: number },\n): Promise<{\n testArtifactDir: string;\n timingPath: string;\n benchmarkPath: string;\n indexPath: string;\n}> {\n const testArtifactDir = outputDir;\n const timingPath = path.join(outputDir, 'timing.json');\n const benchmarkPath = path.join(outputDir, 'benchmark.json');\n const indexPath = path.join(outputDir, RESULT_INDEX_FILENAME);\n await mkdir(outputDir, { recursive: true });\n const indexRecords: ResultIndexArtifact[] = [];\n\n // Write per-test grading artifacts\n for (const result of results) {\n const grading = buildGradingArtifact(result);\n const timing = buildTimingArtifact([result]);\n const artifactSubdir = buildArtifactSubdir(result);\n const testDir = path.join(outputDir, artifactSubdir);\n const gradingPath = path.join(testDir, 'grading.json');\n const perTestTimingPath = path.join(testDir, 'timing.json');\n await mkdir(testDir, { recursive: true });\n await writeFile(gradingPath, `${JSON.stringify(grading, null, 2)}\\n`, 'utf8');\n await writeFile(perTestTimingPath, `${JSON.stringify(timing, null, 2)}\\n`, 'utf8');\n\n const input = extractInput(result);\n if (input) {\n await writeFile(path.join(testDir, 'input.md'), input, 'utf8');\n }\n\n if (result.output && result.output.length > 0) {\n const outputsDir = path.join(testDir, 'outputs');\n await mkdir(outputsDir, { recursive: true });\n await writeFile(\n path.join(outputsDir, 'response.md'),\n formatOutputMarkdown(result.output),\n 'utf8',\n );\n }\n\n indexRecords.push({\n ...buildResultIndexArtifact(result),\n experiment: options?.experiment,\n });\n }\n\n // Write aggregate timing\n const timing = buildTimingArtifact(results);\n await writeFile(timingPath, `${JSON.stringify(timing, null, 2)}\\n`, 'utf8');\n\n // Write benchmark — preserve `planned_test_count` from the run-start stub\n // (or from the original run when this is a resume) unless an explicit\n // value was passed by the caller.\n const plannedTestCount = options?.plannedTestCount ?? (await readPlannedTestCount(benchmarkPath));\n const benchmark = buildBenchmarkArtifact(\n results,\n options?.evalFile,\n options?.experiment,\n plannedTestCount,\n );\n await writeFile(benchmarkPath, `${JSON.stringify(benchmark, null, 2)}\\n`, 'utf8');\n\n await writeJsonlFile(indexPath, indexRecords);\n\n // Write transcript JSONL (auto-generated on every eval run)\n const transcriptPath = path.join(outputDir, 'transcript.jsonl');\n await writeFile(transcriptPath, buildTranscriptMessageLines(results), 'utf8');\n\n return { testArtifactDir, timingPath, benchmarkPath, indexPath };\n}\n","/**\n * Converts a camelCase string to snake_case.\n * Examples:\n * testId -> test_id\n * outputText -> output_text\n * conversationId -> conversation_id\n *\n * Note: Keys that start with an uppercase letter are treated as proper nouns\n * and returned unchanged (e.g., \"Read\", \"Edit\" for tool names).\n */\nfunction toSnakeCase(str: string): string {\n // Don't convert keys that start with uppercase (proper nouns/tool names)\n if (/^[A-Z]/.test(str)) {\n return str;\n }\n return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);\n}\n\n/**\n * Recursively converts all keys in an object from camelCase to snake_case.\n * This is used to convert TypeScript internal representations to snake_case\n * for Python ecosystem compatibility in JSONL output files.\n *\n * Conversion rules:\n * - Object keys: camelCase -> snake_case\n * - Array elements: recursively converted\n * - Primitives: returned unchanged\n * - null/undefined: returned unchanged\n *\n * @param obj - The object to convert (can be any JSON-serializable value)\n * @returns A new object with all keys converted to snake_case\n */\nexport function toSnakeCaseDeep(obj: unknown): unknown {\n if (obj === null || obj === undefined) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map((item) => toSnakeCaseDeep(item));\n }\n\n if (typeof obj === 'object') {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n const snakeKey = toSnakeCase(key);\n result[snakeKey] = toSnakeCaseDeep(value);\n }\n return result;\n }\n\n return obj;\n}\n","import { existsSync, statSync } from 'node:fs';\nimport path from 'node:path';\n\nexport const RESULT_INDEX_FILENAME = 'index.jsonl';\nexport const RESULT_RUNS_DIRNAME = 'runs';\nexport const DEFAULT_EXPERIMENT_NAME = 'default';\n\nexport function normalizeExperimentName(experiment?: string): string {\n const trimmed = experiment?.trim();\n if (!trimmed) {\n return DEFAULT_EXPERIMENT_NAME;\n }\n if (!/^[A-Za-z0-9._-]+$/.test(trimmed)) {\n throw new Error(\n `Invalid experiment name \"${trimmed}\". Use only letters, numbers, \".\", \"_\" and \"-\".`,\n );\n }\n return trimmed;\n}\n\nexport function createRunDirName(timestamp = new Date()): string {\n return timestamp.toISOString().replace(/[:.]/g, '-');\n}\n\nexport function buildDefaultRunDir(\n cwd: string,\n experiment?: string,\n timestamp = new Date(),\n): string {\n return path.join(\n cwd,\n '.agentv',\n 'results',\n RESULT_RUNS_DIRNAME,\n normalizeExperimentName(experiment),\n createRunDirName(timestamp),\n );\n}\n\nexport function buildDefaultIndexPath(cwd: string, experiment?: string): string {\n return path.join(buildDefaultRunDir(cwd, experiment), RESULT_INDEX_FILENAME);\n}\n\nexport function resolveRunIndexPath(runDir: string): string {\n return path.join(runDir, RESULT_INDEX_FILENAME);\n}\n\nexport function isRunManifestPath(filePath: string): boolean {\n return path.basename(filePath) === RESULT_INDEX_FILENAME;\n}\n\nexport function resolveExistingRunPrimaryPath(runDir: string): string | undefined {\n const indexPath = resolveRunIndexPath(runDir);\n if (existsSync(indexPath)) {\n return indexPath;\n }\n\n return undefined;\n}\n\nexport function isDirectoryPath(filePath: string): boolean {\n try {\n return statSync(filePath).isDirectory();\n } catch {\n return false;\n }\n}\n\nexport function resolveWorkspaceOrFilePath(filePath: string): string {\n if (!isDirectoryPath(filePath)) {\n return filePath;\n }\n\n const existing = resolveExistingRunPrimaryPath(filePath);\n if (!existing) {\n throw new Error(`Result workspace is missing ${RESULT_INDEX_FILENAME}: ${filePath}`);\n }\n\n return existing;\n}\n\nexport function resolveRunManifestPath(filePath: string): string {\n if (isDirectoryPath(filePath)) {\n return resolveWorkspaceOrFilePath(filePath);\n }\n\n if (!isRunManifestPath(filePath)) {\n throw new Error(\n `Expected a run workspace directory or ${RESULT_INDEX_FILENAME} manifest: ${filePath}`,\n );\n }\n\n return filePath;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,OAAO,UAAU,iBAAiB;AAC3C,OAAOA,WAAU;;;ACSjB,SAAS,YAAY,KAAqB;AAExC,MAAI,SAAS,KAAK,GAAG,GAAG;AACtB,WAAO;AAAA,EACT;AACA,SAAO,IAAI,QAAQ,UAAU,CAAC,WAAW,IAAI,OAAO,YAAY,CAAC,EAAE;AACrE;AAgBO,SAAS,gBAAgB,KAAuB;AACrD,MAAI,QAAQ,QAAQ,QAAQ,QAAW;AACrC,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,QAAQ,GAAG,GAAG;AACtB,WAAO,IAAI,IAAI,CAAC,SAAS,gBAAgB,IAAI,CAAC;AAAA,EAChD;AAEA,MAAI,OAAO,QAAQ,UAAU;AAC3B,UAAM,SAAkC,CAAC;AACzC,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,YAAM,WAAW,YAAY,GAAG;AAChC,aAAO,QAAQ,IAAI,gBAAgB,KAAK;AAAA,IAC1C;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACnDA,SAAS,YAAY,gBAAgB;AACrC,OAAO,UAAU;AAEV,IAAM,wBAAwB;AAC9B,IAAM,sBAAsB;AAC5B,IAAM,0BAA0B;AAEhC,SAAS,wBAAwB,YAA6B;AACnE,QAAM,UAAU,YAAY,KAAK;AACjC,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AACA,MAAI,CAAC,oBAAoB,KAAK,OAAO,GAAG;AACtC,UAAM,IAAI;AAAA,MACR,4BAA4B,OAAO;AAAA,IAC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G,OAAO,MAAM;AAAA,IAC/D;AAEA,QAAI,OAAO,UAAU,OAAO,OAAO,SAAS,GAAG;AAC7C,YAAM,aAAaA,MAAK,KAAK,SAAS,SAAS;AAC/C,YAAM,MAAM,YAAY,EAAE,WAAW,KAAK,CAAC;AAC3C,YAAM;AAAA,QACJA,MAAK,KAAK,YAAY,aAAa;AAAA,QACnC,qBAAqB,OAAO,MAAM;AAAA,QAClC;AAAA,MACF;AAAA,IACF;AAEA,iBAAa,KAAK;AAAA,MAChB,GAAG,yBAAyB,MAAM;AAAA,MAClC,YAAY,SAAS;AAAA,IACvB,CAAC;AAAA,EACH;AAGA,QAAM,SAAS,oBAAoB,OAAO;AAC1C,QAAM,UAAU,YAAY,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAAA,GAAM,MAAM;AAK1E,QAAM,mBAAmB,SAAS,oBAAqB,MAAM,qBAAqB,aAAa;AAC/F,QAAM,YAAY;AAAA,IAChB;AAAA,IACA,SAAS;AAAA,IACT,SAAS;AAAA,IACT;AAAA,EACF;AACA,QAAM,UAAU,eAAe,GAAG,KAAK,UAAU,WAAW,MAAM,CAAC,CAAC;AAAA,GAAM,MAAM;AAEhF,QAAM,eAAe,WAAW,YAAY;AAG5C,QAAM,iBAAiBA,MAAK,KAAK,WAAW,kBAAkB;AAC9D,QAAM,UAAU,gBAAgB,4BAA4B,OAAO,GAAG,MAAM;AAE5E,SAAO,EAAE,iBAAiB,YAAY,eAAe,UAAU;AACjE;","names":["path","path","timing"]}
|
|
@@ -5980,7 +5980,7 @@ async function expandFileReferences(tests, evalFileDir) {
|
|
|
5980
5980
|
return expanded;
|
|
5981
5981
|
}
|
|
5982
5982
|
|
|
5983
|
-
// ../../packages/core/dist/chunk-
|
|
5983
|
+
// ../../packages/core/dist/chunk-JNBHD34F.js
|
|
5984
5984
|
import path46 from "node:path";
|
|
5985
5985
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
5986
5986
|
import { existsSync as existsSync6 } from "node:fs";
|
|
@@ -18647,7 +18647,7 @@ var RequestError = class _RequestError extends Error {
|
|
|
18647
18647
|
}
|
|
18648
18648
|
};
|
|
18649
18649
|
|
|
18650
|
-
// ../../packages/core/dist/chunk-
|
|
18650
|
+
// ../../packages/core/dist/chunk-JNBHD34F.js
|
|
18651
18651
|
import { exec as execCallback } from "node:child_process";
|
|
18652
18652
|
import { readdirSync, statSync } from "node:fs";
|
|
18653
18653
|
import { readFile as readFile22, readdir as readdir2, stat as stat2 } from "node:fs/promises";
|
|
@@ -22891,6 +22891,24 @@ function runEqualsAssertion(output, value) {
|
|
|
22891
22891
|
]
|
|
22892
22892
|
};
|
|
22893
22893
|
}
|
|
22894
|
+
var tracked = /* @__PURE__ */ new Set();
|
|
22895
|
+
function trackChild(child) {
|
|
22896
|
+
tracked.add(child);
|
|
22897
|
+
child.once("close", () => {
|
|
22898
|
+
tracked.delete(child);
|
|
22899
|
+
});
|
|
22900
|
+
}
|
|
22901
|
+
function killAllTrackedChildren(signal = "SIGTERM") {
|
|
22902
|
+
for (const child of tracked) {
|
|
22903
|
+
try {
|
|
22904
|
+
child.kill(signal);
|
|
22905
|
+
} catch {
|
|
22906
|
+
}
|
|
22907
|
+
}
|
|
22908
|
+
}
|
|
22909
|
+
function trackedChildCount() {
|
|
22910
|
+
return tracked.size;
|
|
22911
|
+
}
|
|
22894
22912
|
function toContentArray(content) {
|
|
22895
22913
|
if (!Array.isArray(content)) return void 0;
|
|
22896
22914
|
let hasNonText = false;
|
|
@@ -23393,6 +23411,7 @@ var ClaudeCliProvider = class {
|
|
|
23393
23411
|
spawnOptions.cwd = options.cwd;
|
|
23394
23412
|
}
|
|
23395
23413
|
const child = spawn(this.config.executable, options.args, spawnOptions);
|
|
23414
|
+
trackChild(child);
|
|
23396
23415
|
let stdout = "";
|
|
23397
23416
|
let stderr = "";
|
|
23398
23417
|
let timedOut = false;
|
|
@@ -25400,6 +25419,7 @@ var CopilotCliProvider = class {
|
|
|
25400
25419
|
const agentProcess = spawn2(executable, args, {
|
|
25401
25420
|
stdio: ["pipe", "pipe", "inherit"]
|
|
25402
25421
|
});
|
|
25422
|
+
trackChild(agentProcess);
|
|
25403
25423
|
await waitForProcessSpawn(agentProcess, executable, this.targetName);
|
|
25404
25424
|
const toolCallsInProgress = /* @__PURE__ */ new Map();
|
|
25405
25425
|
const completedToolCalls = [];
|
|
@@ -27364,6 +27384,7 @@ async function defaultPiRunner(options) {
|
|
|
27364
27384
|
env: options.env,
|
|
27365
27385
|
stdio: ["pipe", "pipe", "pipe"]
|
|
27366
27386
|
});
|
|
27387
|
+
trackChild(child);
|
|
27367
27388
|
let stdout = "";
|
|
27368
27389
|
let stderr = "";
|
|
27369
27390
|
let timedOut = false;
|
|
@@ -28317,6 +28338,7 @@ function spawnVsCode(vscodeCmd, args, options) {
|
|
|
28317
28338
|
shell: useShell,
|
|
28318
28339
|
detached: false
|
|
28319
28340
|
});
|
|
28341
|
+
trackChild(child);
|
|
28320
28342
|
child.on("error", (error40) => {
|
|
28321
28343
|
const label = options?.label ?? "spawn";
|
|
28322
28344
|
const renderedArgs = args.map((value) => JSON.stringify(value)).join(" ");
|
|
@@ -34020,7 +34042,7 @@ async function loadTestSuite(evalFilePath, repoRoot, options) {
|
|
|
34020
34042
|
return { tests: await loadTestsFromAgentSkills(evalFilePath) };
|
|
34021
34043
|
}
|
|
34022
34044
|
if (format === "typescript") {
|
|
34023
|
-
const { loadTsEvalSuite: loadTsEvalSuite2 } = await import("./ts-eval-loader-
|
|
34045
|
+
const { loadTsEvalSuite: loadTsEvalSuite2 } = await import("./ts-eval-loader-BZ54W52K-KLIY3S3N.js");
|
|
34024
34046
|
return loadTsEvalSuite2(evalFilePath, resolveToAbsolutePath(repoRoot), options);
|
|
34025
34047
|
}
|
|
34026
34048
|
const { tests, parsed, suiteWorkspacePath } = await loadTestsFromYaml(
|
|
@@ -34055,7 +34077,7 @@ async function loadTests(evalFilePath, repoRoot, options) {
|
|
|
34055
34077
|
return loadTestsFromAgentSkills(evalFilePath);
|
|
34056
34078
|
}
|
|
34057
34079
|
if (format === "typescript") {
|
|
34058
|
-
const { loadTsEvalSuite: loadTsEvalSuite2 } = await import("./ts-eval-loader-
|
|
34080
|
+
const { loadTsEvalSuite: loadTsEvalSuite2 } = await import("./ts-eval-loader-BZ54W52K-KLIY3S3N.js");
|
|
34059
34081
|
const suite = await loadTsEvalSuite2(evalFilePath, resolveToAbsolutePath(repoRoot), options);
|
|
34060
34082
|
return suite.tests;
|
|
34061
34083
|
}
|
|
@@ -37878,6 +37900,9 @@ export {
|
|
|
37878
37900
|
runRegexAssertion,
|
|
37879
37901
|
runIsJsonAssertion,
|
|
37880
37902
|
runEqualsAssertion,
|
|
37903
|
+
trackChild,
|
|
37904
|
+
killAllTrackedChildren,
|
|
37905
|
+
trackedChildCount,
|
|
37881
37906
|
consumeClaudeLogEntries,
|
|
37882
37907
|
subscribeToClaudeLogEntries,
|
|
37883
37908
|
normalizeToolCall,
|
|
@@ -37949,4 +37974,4 @@ export {
|
|
|
37949
37974
|
loadTsEvalFile,
|
|
37950
37975
|
loadTsEvalSuite
|
|
37951
37976
|
};
|
|
37952
|
-
//# sourceMappingURL=chunk-
|
|
37977
|
+
//# sourceMappingURL=chunk-VOOYHYPR.js.map
|