agentv 4.22.0 → 4.24.0-next.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-S7S6K3XA.js → artifact-writer-7CKE5ILM.js} +4 -4
- package/dist/{chunk-GMMIWIBF.js → chunk-AYXP3MTM.js} +12 -11
- package/dist/chunk-AYXP3MTM.js.map +1 -0
- package/dist/{chunk-762UZSGR.js → chunk-D5HCHBPT.js} +8 -9
- package/dist/chunk-D5HCHBPT.js.map +1 -0
- package/dist/{chunk-4YZDPAGZ.js → chunk-HL3MTSIW.js} +81 -32
- package/dist/chunk-HL3MTSIW.js.map +1 -0
- package/dist/{chunk-CM2AVQAM.js → chunk-KTHVVL7Q.js} +7 -5
- package/dist/chunk-KTHVVL7Q.js.map +1 -0
- package/dist/{chunk-5QF7PKZ4.js → chunk-TRA6SVUM.js} +37 -28
- package/dist/chunk-TRA6SVUM.js.map +1 -0
- package/dist/cli.js +5 -5
- package/dist/{dist-6LNJDZAI.js → dist-IA3D556U.js} +5 -3
- package/dist/index.js +5 -5
- package/dist/{interactive-7LC5WFP3.js → interactive-YXXNDPKI.js} +5 -5
- package/dist/studio/assets/index-DY-K3PKr.css +1 -0
- package/dist/studio/assets/{index-SZVrc1UE.js → index-DZpM1lzZ.js} +25 -25
- package/dist/studio/assets/{index-BVSHI8Eo.js → index-jBBmFdWd.js} +1 -1
- package/dist/studio/index.html +2 -2
- package/dist/{ts-eval-loader-PA4YFM5D-2DKQQQOZ.js → ts-eval-loader-SYQYQPMC-FKU23VX3.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-4YZDPAGZ.js.map +0 -1
- package/dist/chunk-5QF7PKZ4.js.map +0 -1
- package/dist/chunk-762UZSGR.js.map +0 -1
- package/dist/chunk-CM2AVQAM.js.map +0 -1
- package/dist/chunk-GMMIWIBF.js.map +0 -1
- package/dist/studio/assets/index-DcpbFwI5.css +0 -1
- /package/dist/{artifact-writer-S7S6K3XA.js.map → artifact-writer-7CKE5ILM.js.map} +0 -0
- /package/dist/{dist-6LNJDZAI.js.map → dist-IA3D556U.js.map} +0 -0
- /package/dist/{interactive-7LC5WFP3.js.map → interactive-YXXNDPKI.js.map} +0 -0
- /package/dist/{ts-eval-loader-PA4YFM5D-2DKQQQOZ.js.map → ts-eval-loader-SYQYQPMC-FKU23VX3.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-D5HCHBPT.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_THRESHOLD
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HL3MTSIW.js";
|
|
8
8
|
|
|
9
9
|
// src/commands/eval/artifact-writer.ts
|
|
10
10
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
@@ -439,7 +439,8 @@ function buildIndexArtifactEntry(result, options) {
|
|
|
439
439
|
grading_path: toRelativeArtifactPath(options.outputDir, options.gradingPath),
|
|
440
440
|
timing_path: toRelativeArtifactPath(options.outputDir, options.timingPath),
|
|
441
441
|
output_path: options.outputPath ? toRelativeArtifactPath(options.outputDir, options.outputPath) : void 0,
|
|
442
|
-
input_path: options.inputPath ? toRelativeArtifactPath(options.outputDir, options.inputPath) : void 0
|
|
442
|
+
input_path: options.inputPath ? toRelativeArtifactPath(options.outputDir, options.inputPath) : void 0,
|
|
443
|
+
metadata: result.metadata
|
|
443
444
|
};
|
|
444
445
|
}
|
|
445
446
|
function buildResultIndexArtifact(result) {
|
|
@@ -464,7 +465,8 @@ function buildResultIndexArtifact(result) {
|
|
|
464
465
|
timing_path: path2.posix.join(artifactSubdir, "timing.json"),
|
|
465
466
|
input_path: input ? path2.posix.join(artifactSubdir, "input.md") : void 0,
|
|
466
467
|
output_path: hasResponse ? path2.posix.join(artifactSubdir, "outputs", "response.md") : void 0,
|
|
467
|
-
response_path: hasResponse ? path2.posix.join(artifactSubdir, "outputs", "response.md") : void 0
|
|
468
|
+
response_path: hasResponse ? path2.posix.join(artifactSubdir, "outputs", "response.md") : void 0,
|
|
469
|
+
metadata: result.metadata
|
|
468
470
|
};
|
|
469
471
|
}
|
|
470
472
|
async function writeJsonlFile(filePath, records) {
|
|
@@ -688,4 +690,4 @@ export {
|
|
|
688
690
|
writePerTestArtifacts,
|
|
689
691
|
writeArtifactsFromResults
|
|
690
692
|
};
|
|
691
|
-
//# sourceMappingURL=chunk-
|
|
693
|
+
//# sourceMappingURL=chunk-KTHVVL7Q.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 },\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 const benchmark = buildBenchmarkArtifact(results, options?.evalFile, options?.experiment);\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\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 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): 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 },\n run_summary: runSummary,\n per_grader_summary: perEvaluatorSummary,\n notes,\n };\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 },\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\n const benchmark = buildBenchmarkArtifact(results, options?.evalFile, options?.experiment);\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,EAC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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;AAG1E,QAAM,YAAY,uBAAuB,SAAS,SAAS,UAAU,SAAS,UAAU;AACxF,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"]}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
resolveWorkspaceOrFilePath,
|
|
16
16
|
toSnakeCaseDeep,
|
|
17
17
|
writeArtifactsFromResults
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-KTHVVL7Q.js";
|
|
19
19
|
import {
|
|
20
20
|
ResponseCache,
|
|
21
21
|
RunBudgetTracker,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
shouldSkipCacheForTemperature,
|
|
32
32
|
stageResultsArtifacts,
|
|
33
33
|
syncResultsRepo
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-D5HCHBPT.js";
|
|
35
35
|
import {
|
|
36
36
|
CLI_PLACEHOLDERS,
|
|
37
37
|
COMMON_TARGET_SETTINGS,
|
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
loadConfig,
|
|
53
53
|
loadTestSuite,
|
|
54
54
|
normalizeLineEndings,
|
|
55
|
+
parseYamlValue,
|
|
55
56
|
readTargetDefinitions,
|
|
56
57
|
readTestSuiteMetadata,
|
|
57
58
|
resolveFileReference,
|
|
@@ -62,7 +63,7 @@ import {
|
|
|
62
63
|
subscribeToCopilotSdkLogEntries,
|
|
63
64
|
subscribeToPiLogEntries,
|
|
64
65
|
toCamelCaseDeep
|
|
65
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-HL3MTSIW.js";
|
|
66
67
|
|
|
67
68
|
// src/commands/eval/shared.ts
|
|
68
69
|
import { constants } from "node:fs";
|
|
@@ -178,7 +179,7 @@ async function findRepoRoot(start) {
|
|
|
178
179
|
// package.json
|
|
179
180
|
var package_default = {
|
|
180
181
|
name: "agentv",
|
|
181
|
-
version: "4.
|
|
182
|
+
version: "4.24.0-next.1",
|
|
182
183
|
description: "CLI entry point for AgentV",
|
|
183
184
|
type: "module",
|
|
184
185
|
repository: {
|
|
@@ -2351,6 +2352,17 @@ function formatVerdict(score, verdict) {
|
|
|
2351
2352
|
const color = verdict === "PASS" ? ANSI_GREEN2 : verdict === "FAIL" ? ANSI_RED2 : ANSI_YELLOW2;
|
|
2352
2353
|
return ` | ${color}${ANSI_BOLD}${verdictLabel}${ANSI_RESET2}`;
|
|
2353
2354
|
}
|
|
2355
|
+
function formatDurations(durationMs, totalDurationMs) {
|
|
2356
|
+
if (durationMs === void 0 && totalDurationMs === void 0) {
|
|
2357
|
+
return "";
|
|
2358
|
+
}
|
|
2359
|
+
if (durationMs !== void 0 && totalDurationMs !== void 0) {
|
|
2360
|
+
const normalizedTotalMs = Math.max(durationMs, totalDurationMs);
|
|
2361
|
+
return ` | ${durationMs}/${normalizedTotalMs}ms`;
|
|
2362
|
+
}
|
|
2363
|
+
const singleDurationMs = durationMs ?? totalDurationMs;
|
|
2364
|
+
return singleDurationMs !== void 0 ? ` | ${singleDurationMs}ms` : "";
|
|
2365
|
+
}
|
|
2354
2366
|
var ProgressDisplay = class {
|
|
2355
2367
|
workers = /* @__PURE__ */ new Map();
|
|
2356
2368
|
totalTests = 0;
|
|
@@ -2395,14 +2407,14 @@ var ProgressDisplay = class {
|
|
|
2395
2407
|
case "completed": {
|
|
2396
2408
|
const icon = progress.verdict === "FAIL" ? "\u26A0\uFE0F" : progress.verdict === "ERROR" ? "\u274C" : "\u2705";
|
|
2397
2409
|
console.log(
|
|
2398
|
-
`${countPrefix} ${icon} ${progress.testId}${targetSuffix}${formatVerdict(progress.score, progress.verdict)}`
|
|
2410
|
+
`${countPrefix} ${icon} ${progress.testId}${targetSuffix}${formatVerdict(progress.score, progress.verdict)}${formatDurations(progress.durationMs, progress.totalDurationMs)}`
|
|
2399
2411
|
);
|
|
2400
2412
|
break;
|
|
2401
2413
|
}
|
|
2402
2414
|
case "failed": {
|
|
2403
2415
|
const failIcon = progress.verdict === "ERROR" ? "\u274C" : "\u26A0\uFE0F";
|
|
2404
2416
|
console.log(
|
|
2405
|
-
`${countPrefix} ${failIcon} ${progress.testId}${targetSuffix}${formatVerdict(progress.score, progress.verdict)}${progress.error ? `: ${progress.error}` : ""}`
|
|
2417
|
+
`${countPrefix} ${failIcon} ${progress.testId}${targetSuffix}${formatVerdict(progress.score, progress.verdict)}${formatDurations(progress.durationMs, progress.totalDurationMs)}${progress.error ? `: ${progress.error}` : ""}`
|
|
2406
2418
|
);
|
|
2407
2419
|
break;
|
|
2408
2420
|
}
|
|
@@ -2765,31 +2777,24 @@ function formatMatrixSummary(results) {
|
|
|
2765
2777
|
// ../../packages/core/dist/evaluation/validation/index.js
|
|
2766
2778
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
2767
2779
|
import path14 from "node:path";
|
|
2768
|
-
import { parse } from "yaml";
|
|
2769
2780
|
import { readFile as readFile22, readdir, stat as stat2 } from "node:fs/promises";
|
|
2770
2781
|
import path22 from "node:path";
|
|
2771
|
-
import { parse as parse2 } from "yaml";
|
|
2772
2782
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
2773
2783
|
import path32 from "node:path";
|
|
2774
|
-
import { parse as parse3 } from "yaml";
|
|
2775
2784
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
2776
2785
|
import path42 from "node:path";
|
|
2777
|
-
import { parse as parse4 } from "yaml";
|
|
2778
2786
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
2779
|
-
import { parse as parse5 } from "yaml";
|
|
2780
2787
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
2781
2788
|
import path52 from "node:path";
|
|
2782
|
-
import { parse as parse6 } from "yaml";
|
|
2783
2789
|
import { access as access4, readFile as readFile7 } from "node:fs/promises";
|
|
2784
2790
|
import path62 from "node:path";
|
|
2785
|
-
import { parse as parse7 } from "yaml";
|
|
2786
2791
|
var SCHEMA_EVAL_V2 = "agentv-eval-v2";
|
|
2787
2792
|
var SCHEMA_TARGETS_V2 = "agentv-targets-v2.2";
|
|
2788
2793
|
var SCHEMA_CONFIG_V2 = "agentv-config-v2";
|
|
2789
2794
|
async function detectFileType(filePath) {
|
|
2790
2795
|
try {
|
|
2791
2796
|
const content = await readFile2(filePath, "utf8");
|
|
2792
|
-
const parsed =
|
|
2797
|
+
const parsed = parseYamlValue(content);
|
|
2793
2798
|
if (Array.isArray(parsed)) {
|
|
2794
2799
|
return "cases";
|
|
2795
2800
|
}
|
|
@@ -2865,7 +2870,9 @@ var KNOWN_TOP_LEVEL_FIELDS = /* @__PURE__ */ new Set([
|
|
|
2865
2870
|
"assertions",
|
|
2866
2871
|
"evaluators",
|
|
2867
2872
|
"preprocessors",
|
|
2868
|
-
"workspace"
|
|
2873
|
+
"workspace",
|
|
2874
|
+
"metadata",
|
|
2875
|
+
"governance"
|
|
2869
2876
|
]);
|
|
2870
2877
|
var DEPRECATED_TOP_LEVEL_FIELDS = /* @__PURE__ */ new Map([
|
|
2871
2878
|
["eval_cases", "'eval_cases' is deprecated. Use 'tests' instead."],
|
|
@@ -2940,7 +2947,7 @@ async function validateEvalFile(filePath) {
|
|
|
2940
2947
|
let parsed;
|
|
2941
2948
|
try {
|
|
2942
2949
|
const content = await readFile22(absolutePath, "utf8");
|
|
2943
|
-
parsed = interpolateEnv(
|
|
2950
|
+
parsed = interpolateEnv(parseYamlValue(content), process.env);
|
|
2944
2951
|
} catch (error) {
|
|
2945
2952
|
errors.push({
|
|
2946
2953
|
severity: "error",
|
|
@@ -3216,7 +3223,7 @@ async function validateWorkspaceConfig(workspace, evalFilePath, errors, location
|
|
|
3216
3223
|
const workspacePath = path22.resolve(path22.dirname(evalFilePath), workspace);
|
|
3217
3224
|
try {
|
|
3218
3225
|
const workspaceContent = await readFile22(workspacePath, "utf8");
|
|
3219
|
-
const parsedWorkspace = interpolateEnv(
|
|
3226
|
+
const parsedWorkspace = interpolateEnv(parseYamlValue(workspaceContent), process.env);
|
|
3220
3227
|
if (!isObject(parsedWorkspace)) {
|
|
3221
3228
|
errors.push({
|
|
3222
3229
|
severity: "error",
|
|
@@ -3618,7 +3625,7 @@ async function validateCasesFile(filePath) {
|
|
|
3618
3625
|
let parsed;
|
|
3619
3626
|
try {
|
|
3620
3627
|
const content = await readFile3(absolutePath, "utf8");
|
|
3621
|
-
parsed =
|
|
3628
|
+
parsed = parseYamlValue(content);
|
|
3622
3629
|
} catch (error) {
|
|
3623
3630
|
errors.push({
|
|
3624
3631
|
severity: "error",
|
|
@@ -3907,7 +3914,7 @@ async function validateTargetsFile(filePath) {
|
|
|
3907
3914
|
let parsed;
|
|
3908
3915
|
try {
|
|
3909
3916
|
const content = await readFile4(absolutePath, "utf8");
|
|
3910
|
-
parsed =
|
|
3917
|
+
parsed = parseYamlValue(content);
|
|
3911
3918
|
} catch (error) {
|
|
3912
3919
|
errors.push({
|
|
3913
3920
|
severity: "error",
|
|
@@ -4122,7 +4129,7 @@ async function validateConfigFile(filePath) {
|
|
|
4122
4129
|
const errors = [];
|
|
4123
4130
|
try {
|
|
4124
4131
|
const content = await readFile5(filePath, "utf8");
|
|
4125
|
-
const parsed =
|
|
4132
|
+
const parsed = parseYamlValue(content);
|
|
4126
4133
|
if (typeof parsed !== "object" || parsed === null) {
|
|
4127
4134
|
errors.push({
|
|
4128
4135
|
severity: "error",
|
|
@@ -4275,7 +4282,7 @@ async function validateFileReferences(evalFilePath) {
|
|
|
4275
4282
|
let parsed;
|
|
4276
4283
|
try {
|
|
4277
4284
|
const content = await readFile6(absolutePath, "utf8");
|
|
4278
|
-
parsed =
|
|
4285
|
+
parsed = parseYamlValue(content);
|
|
4279
4286
|
} catch {
|
|
4280
4287
|
return errors;
|
|
4281
4288
|
}
|
|
@@ -4393,7 +4400,7 @@ async function validateWorkspacePaths(evalFilePath) {
|
|
|
4393
4400
|
let parsed;
|
|
4394
4401
|
try {
|
|
4395
4402
|
const content = await readFile7(absolutePath, "utf8");
|
|
4396
|
-
parsed =
|
|
4403
|
+
parsed = parseYamlValue(content);
|
|
4397
4404
|
} catch {
|
|
4398
4405
|
return errors;
|
|
4399
4406
|
}
|
|
@@ -4404,7 +4411,7 @@ async function validateWorkspacePaths(evalFilePath) {
|
|
|
4404
4411
|
const workspaceFilePath = path62.resolve(evalDir, workspaceRaw);
|
|
4405
4412
|
try {
|
|
4406
4413
|
const wsContent = await readFile7(workspaceFilePath, "utf8");
|
|
4407
|
-
const wsParsed =
|
|
4414
|
+
const wsParsed = parseYamlValue(wsContent);
|
|
4408
4415
|
if (isObject5(wsParsed)) {
|
|
4409
4416
|
const wsDir = path62.dirname(workspaceFilePath);
|
|
4410
4417
|
await validateWorkspaceObject(wsParsed, wsDir, absolutePath, "workspace", errors);
|
|
@@ -5298,7 +5305,9 @@ async function runSingleEvalFile(params) {
|
|
|
5298
5305
|
error: event.error,
|
|
5299
5306
|
targetLabel: inlineTargetLabel,
|
|
5300
5307
|
score: event.score,
|
|
5301
|
-
verdict
|
|
5308
|
+
verdict,
|
|
5309
|
+
durationMs: event.durationMs,
|
|
5310
|
+
totalDurationMs: event.evalRunDurationMs
|
|
5302
5311
|
});
|
|
5303
5312
|
}
|
|
5304
5313
|
});
|
|
@@ -5435,7 +5444,7 @@ async function runEvalCommand(input) {
|
|
|
5435
5444
|
const useFileExport = !!options.otelFile;
|
|
5436
5445
|
if (options.exportOtel || useFileExport) {
|
|
5437
5446
|
try {
|
|
5438
|
-
const { OtelTraceExporter, OTEL_BACKEND_PRESETS } = await import("./dist-
|
|
5447
|
+
const { OtelTraceExporter, OTEL_BACKEND_PRESETS } = await import("./dist-IA3D556U.js");
|
|
5439
5448
|
let endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
|
|
5440
5449
|
let headers = {};
|
|
5441
5450
|
if (options.otelBackend) {
|
|
@@ -5634,7 +5643,7 @@ async function runEvalCommand(input) {
|
|
|
5634
5643
|
const activeTestFiles = resolvedTestFiles.filter((f) => fileMetadata.has(f));
|
|
5635
5644
|
let transcriptProviderFactory;
|
|
5636
5645
|
if (options.transcript) {
|
|
5637
|
-
const { TranscriptProvider } = await import("./dist-
|
|
5646
|
+
const { TranscriptProvider } = await import("./dist-IA3D556U.js");
|
|
5638
5647
|
const transcriptProvider = await TranscriptProvider.fromFile(options.transcript);
|
|
5639
5648
|
const totalTests = [...fileMetadata.values()].reduce(
|
|
5640
5649
|
(sum, meta) => sum + meta.testCases.length,
|
|
@@ -5803,7 +5812,7 @@ async function runEvalCommand(input) {
|
|
|
5803
5812
|
if (usesDefaultArtifactWorkspace && allResults.length > 0) {
|
|
5804
5813
|
const evalFile = activeTestFiles.length === 1 ? activeTestFiles[0] : "";
|
|
5805
5814
|
if (isResumeAppend) {
|
|
5806
|
-
const { writePerTestArtifacts } = await import("./artifact-writer-
|
|
5815
|
+
const { writePerTestArtifacts } = await import("./artifact-writer-7CKE5ILM.js");
|
|
5807
5816
|
await writePerTestArtifacts(allResults, runDir, {
|
|
5808
5817
|
experiment: normalizeExperimentName(options.experiment)
|
|
5809
5818
|
});
|
|
@@ -6026,4 +6035,4 @@ export {
|
|
|
6026
6035
|
getCategories,
|
|
6027
6036
|
filterByCategory
|
|
6028
6037
|
};
|
|
6029
|
-
//# sourceMappingURL=chunk-
|
|
6038
|
+
//# sourceMappingURL=chunk-TRA6SVUM.js.map
|