agentv 4.19.0 → 4.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{artifact-writer-YATMDPWI.js → artifact-writer-RFXWXUOV.js} +4 -4
- package/dist/{chunk-R2QDYORI.js → chunk-36HXBYUY.js} +25 -2
- package/dist/chunk-36HXBYUY.js.map +1 -0
- package/dist/{chunk-62M5MR5K.js → chunk-KJZ7PZCE.js} +19 -6
- package/dist/chunk-KJZ7PZCE.js.map +1 -0
- package/dist/{chunk-PTYQS37Y.js → chunk-LP4Y5D2Z.js} +161 -24
- package/dist/chunk-LP4Y5D2Z.js.map +1 -0
- package/dist/{chunk-IWI4AJRS.js → chunk-PHGEGHKR.js} +55 -10
- package/dist/chunk-PHGEGHKR.js.map +1 -0
- package/dist/{chunk-NL6P5MUH.js → chunk-ZNS74WKH.js} +3 -3
- package/dist/cli.js +5 -5
- package/dist/{dist-RTIUSC6L.js → dist-GURCO6IS.js} +7 -3
- package/dist/index.js +5 -5
- package/dist/{interactive-7AZMOH2V.js → interactive-GLRASSKM.js} +5 -5
- package/dist/{ts-eval-loader-XFQ6S4DT-S7P2UUBX.js → ts-eval-loader-32COE32J-TCT4RIRT.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-62M5MR5K.js.map +0 -1
- package/dist/chunk-IWI4AJRS.js.map +0 -1
- package/dist/chunk-PTYQS37Y.js.map +0 -1
- package/dist/chunk-R2QDYORI.js.map +0 -1
- /package/dist/{artifact-writer-YATMDPWI.js.map → artifact-writer-RFXWXUOV.js.map} +0 -0
- /package/dist/{chunk-NL6P5MUH.js.map → chunk-ZNS74WKH.js.map} +0 -0
- /package/dist/{dist-RTIUSC6L.js.map → dist-GURCO6IS.js.map} +0 -0
- /package/dist/{interactive-7AZMOH2V.js.map → interactive-GLRASSKM.js.map} +0 -0
- /package/dist/{ts-eval-loader-XFQ6S4DT-S7P2UUBX.js.map → ts-eval-loader-32COE32J-TCT4RIRT.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/src/evaluation/loaders/eval-yaml-transpiler.ts","../../../packages/core/src/evaluation/config.ts","../../../packages/core/src/evaluation/generators/rubric-generator.ts","../../../packages/core/src/evaluation/workspace/deps-scanner.ts","../../../packages/core/src/evaluation/cache/response-cache.ts","../../../packages/core/src/evaluation/results-repo.ts","../../../packages/core/src/benchmarks.ts","../../../packages/core/src/evaluation/baseline.ts","../../../packages/core/src/evaluation/category.ts","../../../packages/core/src/observability/otel-exporter.ts","../../../packages/core/src/import/claude-parser.ts","../../../packages/core/src/import/codex-parser.ts","../../../packages/core/src/import/codex-session-discovery.ts","../../../packages/core/src/import/session-discovery.ts","../../../packages/core/src/import/types.ts","../../../packages/core/src/import/transcript-provider.ts","../../../packages/core/src/index.ts"],"sourcesContent":["/**\n * EVAL.yaml → evals.json transpiler.\n *\n * Converts an AgentV EVAL.yaml file into Agent Skills evals.json format\n * for consumption by the skill-creator pipeline.\n *\n * Handles both `assertions:` (current) and `assert:` (deprecated alias).\n */\n\nimport { readFileSync } from 'node:fs';\nimport path from 'node:path';\nimport { parse } from 'yaml';\n\n// ---------------------------------------------------------------------------\n// evals.json output types\n// ---------------------------------------------------------------------------\n\nexport interface EvalsJsonCase {\n id: number;\n prompt: string;\n expected_output?: string;\n files?: string[];\n should_trigger?: boolean;\n assertions: string[];\n}\n\nexport interface EvalsJsonFile {\n skill_name: string;\n evals: EvalsJsonCase[];\n}\n\n// ---------------------------------------------------------------------------\n// Raw YAML input types (unvalidated)\n// ---------------------------------------------------------------------------\n\ntype RawContent =\n | string\n | Array<{ type?: string; value?: string; [key: string]: unknown }>\n | unknown;\n\ninterface RawMessage {\n role?: string;\n content?: RawContent;\n [key: string]: unknown;\n}\n\ninterface RawAssertEntry {\n type?: string;\n skill?: string;\n should_trigger?: boolean;\n criteria?: string;\n value?: string;\n name?: string;\n description?: string;\n command?: unknown;\n prompt?: string;\n rubrics?: unknown[];\n expected?: unknown[];\n fields?: unknown[];\n threshold?: number;\n budget?: number;\n [key: string]: unknown;\n}\n\ninterface RawTestCase {\n id?: string | number;\n criteria?: string;\n input?: string | RawMessage[] | { [key: string]: unknown };\n input_files?: string[];\n expected_output?: string | RawMessage[] | unknown;\n assertions?: RawAssertEntry[];\n /** @deprecated Use `assertions` instead */\n assert?: RawAssertEntry[];\n [key: string]: unknown;\n}\n\ninterface RawSuite {\n tests?: RawTestCase[];\n assertions?: RawAssertEntry[];\n /** @deprecated Use `assertions` instead */\n assert?: RawAssertEntry[];\n [key: string]: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// Assertion → natural language conversion\n// ---------------------------------------------------------------------------\n\n/**\n * Build an NL instruction string for a code grader that tells the grading agent\n * how to execute it via `agentv eval assert`.\n *\n * The `<agent_output>` and `<original_prompt>` placeholders are substituted\n * by the grading agent at evaluation time.\n */\nfunction codeGraderInstruction(graderName: string, description?: string): string {\n const desc = description ? ` This grader: ${description}.` : '';\n return `Run \\`agentv eval assert ${graderName} --agent-output <agent_output> --agent-input <original_prompt>\\` and check the result.${desc} The command accepts --agent-output (the agent's full response text) and --agent-input (the original user prompt). It returns JSON on stdout: {\"score\": 0-1, \"reasoning\": \"...\"}. A score >= 0.5 means pass (exit 0); below 0.5 means fail (exit 1).`;\n}\n\n/**\n * Derive a grader name from a command array by finding the first argument\n * with a recognised script extension (e.g. `['bun', 'run', '.agentv/graders/format-checker.ts']` → `'format-checker'`).\n */\nfunction deriveGraderNameFromCommand(command: unknown): string | undefined {\n if (!Array.isArray(command) || command.length === 0) return undefined;\n for (const arg of command) {\n if (typeof arg !== 'string') continue;\n const match = arg.match(/([^/]+)\\.(ts|js|mts|mjs)$/);\n if (match) return match[1] || undefined;\n }\n return undefined;\n}\n\nfunction assertionToNaturalLanguage(entry: RawAssertEntry): string | null {\n const type = entry.type;\n\n switch (type) {\n case 'skill-trigger':\n // Handled separately — not an NL assertion\n return null;\n\n case 'rubrics': {\n // criteria may be a string (NL) or array of rubric items\n if (typeof entry.criteria === 'string') {\n return entry.criteria;\n }\n return null;\n }\n\n case 'contains':\n return `Output contains '${entry.value}'`;\n\n case 'contains-any':\n case 'contains_any': {\n const values = Array.isArray(entry.value)\n ? (entry.value as string[]).join(\"', '\")\n : entry.value;\n return `Output contains any of: '${values}'`;\n }\n\n case 'contains-all':\n case 'contains_all': {\n const values = Array.isArray(entry.value)\n ? (entry.value as string[]).join(\"', '\")\n : entry.value;\n return `Output contains all of: '${values}'`;\n }\n\n case 'icontains':\n return `Output contains (case-insensitive) '${entry.value}'`;\n\n case 'regex':\n return `Output matches regex: ${entry.value}`;\n\n case 'equals':\n return `Output exactly equals: ${entry.value}`;\n\n case 'is-json':\n case 'is_json':\n return 'Output is valid JSON';\n\n case 'starts-with':\n case 'starts_with':\n return `Output starts with '${entry.value}'`;\n\n case 'ends-with':\n case 'ends_with':\n return `Output ends with '${entry.value}'`;\n\n case 'llm-grader':\n case 'llm_grader': {\n // Expand each rubric item to its own assertion string\n // Return the first one — callers handle arrays via assertionToNaturalLanguageList\n if (Array.isArray(entry.rubrics) && entry.rubrics.length > 0) {\n return null; // handled by list expansion below\n }\n return typeof entry.prompt === 'string' ? entry.prompt : null;\n }\n\n case 'tool-trajectory':\n case 'tool_trajectory': {\n const expectedArr = Array.isArray(entry.expected) ? entry.expected : [];\n const tools = (expectedArr as Array<{ tool?: string }>)\n .map((e) => e.tool)\n .filter(Boolean)\n .join(', ');\n return tools\n ? `Agent called tools in order: ${tools}`\n : 'Agent followed expected tool trajectory';\n }\n\n case 'code-grader':\n case 'code_grader': {\n const graderName = entry.name ?? deriveGraderNameFromCommand(entry.command) ?? 'code-grader';\n const desc = typeof entry.description === 'string' ? entry.description : undefined;\n return codeGraderInstruction(graderName, desc);\n }\n\n case 'field-accuracy':\n case 'field_accuracy': {\n const fieldPaths = Array.isArray(entry.fields)\n ? (entry.fields as Array<{ path?: string }>)\n .map((f) => f.path)\n .filter(Boolean)\n .join(', ')\n : '';\n return fieldPaths\n ? `Fields ${fieldPaths} match expected values`\n : 'Fields match expected values';\n }\n\n case 'latency':\n return typeof entry.threshold === 'number'\n ? `Response time under ${entry.threshold}ms`\n : 'Response time within threshold';\n\n case 'cost':\n return typeof entry.budget === 'number'\n ? `Cost under $${entry.budget}`\n : 'Cost within budget';\n\n case 'token-usage':\n case 'token_usage':\n return 'Token usage within limits';\n\n case 'execution-metrics':\n case 'execution_metrics':\n return 'Execution within metric bounds';\n\n default: {\n // Unknown type with a command → treat as code grader\n if (entry.command !== undefined && type) {\n return codeGraderInstruction(deriveGraderNameFromCommand(entry.command) ?? type);\n }\n // Fallback: try to produce something readable\n if (typeof entry.criteria === 'string') return entry.criteria;\n if (typeof entry.prompt === 'string') return entry.prompt;\n return type ? `${type} assertion` : null;\n }\n }\n}\n\n/**\n * Expand a single assertion entry into zero or more NL strings.\n * Most assertions produce exactly one string; llm-grader with rubrics expands to many.\n */\nfunction assertionToNaturalLanguageList(entry: RawAssertEntry): string[] {\n if (entry.type === 'llm-grader' || entry.type === 'llm_grader') {\n if (Array.isArray(entry.rubrics) && entry.rubrics.length > 0) {\n return (entry.rubrics as Array<{ outcome?: string; criteria?: string; id?: string }>)\n .map((r) => r.outcome ?? r.criteria ?? r.id)\n .filter((s): s is string => typeof s === 'string');\n }\n }\n const nl = assertionToNaturalLanguage(entry);\n return nl !== null ? [nl] : [];\n}\n\n/**\n * Extract skill-trigger entries from an assertion list.\n * Returns entries with type === 'skill-trigger'.\n */\nfunction extractTriggerAssertions(assertions: RawAssertEntry[]): RawAssertEntry[] {\n return assertions.filter((a) => a.type === 'skill-trigger');\n}\n\n/**\n * Collect all assertion entries for a test case, accepting both\n * `assertions` and deprecated `assert` key.\n */\nfunction resolveAssertions(rawCase: RawTestCase): RawAssertEntry[] {\n if (Array.isArray(rawCase.assertions)) return rawCase.assertions;\n if (Array.isArray(rawCase.assert)) return rawCase.assert;\n return [];\n}\n\n/**\n * Collect suite-level assertions (applied to every test).\n */\nfunction resolveSuiteAssertions(suite: RawSuite): RawAssertEntry[] {\n if (Array.isArray(suite.assertions)) return suite.assertions;\n if (Array.isArray(suite.assert)) return suite.assert;\n return [];\n}\n\n// ---------------------------------------------------------------------------\n// Input extraction\n// ---------------------------------------------------------------------------\n\ninterface ExtractedInput {\n prompt: string;\n files: string[];\n}\n\n/**\n * Extract prompt text and file paths from a test case input.\n *\n * Supports:\n * - String input → prompt, no files\n * - Message array with role: user and content blocks\n * - input_files shorthand (alongside string or message-array input)\n */\nfunction extractInput(rawCase: RawTestCase): ExtractedInput {\n const files: string[] = Array.isArray(rawCase.input_files)\n ? (rawCase.input_files as string[]).filter((f) => typeof f === 'string')\n : [];\n\n const input = rawCase.input;\n\n if (typeof input === 'string') {\n return { prompt: input, files };\n }\n\n if (Array.isArray(input)) {\n let prompt = '';\n for (const msg of input as RawMessage[]) {\n if (msg.role !== 'user') continue;\n if (typeof msg.content === 'string') {\n prompt = msg.content;\n } else if (Array.isArray(msg.content)) {\n for (const block of msg.content as Array<{ type?: string; value?: string }>) {\n if (block.type === 'text' && typeof block.value === 'string') prompt = block.value;\n else if (block.type === 'file' && typeof block.value === 'string')\n files.push(block.value);\n }\n }\n }\n return { prompt, files };\n }\n\n return { prompt: '', files };\n}\n\n/**\n * Flatten expected_output to a string.\n * Accepts string, message array (takes last assistant message content),\n * or any other value serialized to JSON.\n */\nfunction extractExpectedOutput(raw: unknown): string | undefined {\n if (raw === undefined || raw === null) return undefined;\n if (typeof raw === 'string') return raw;\n\n if (Array.isArray(raw)) {\n // Take the last assistant message content\n for (let i = raw.length - 1; i >= 0; i--) {\n const msg = raw[i] as RawMessage;\n if (typeof msg.content === 'string') return msg.content;\n }\n return undefined;\n }\n\n return JSON.stringify(raw);\n}\n\n// ---------------------------------------------------------------------------\n// Transpiler core\n// ---------------------------------------------------------------------------\n\n/**\n * Result of transpiling a single EVAL.yaml.\n * May produce multiple evals.json files (one per skill).\n */\nexport interface TranspileResult {\n /** Map from skill_name → EvalsJsonFile */\n files: Map<string, EvalsJsonFile>;\n /** Warning messages accumulated during transpilation */\n warnings: string[];\n}\n\n/**\n * Transpile a parsed EVAL.yaml object into one or more evals.json objects.\n *\n * @param suite Parsed YAML object (already loaded, no file I/O here)\n * @param source Source identifier for error messages (e.g. file path)\n */\nexport function transpileEvalYaml(suite: unknown, source = 'EVAL.yaml'): TranspileResult {\n const warnings: string[] = [];\n const files = new Map<string, EvalsJsonFile>();\n\n if (typeof suite !== 'object' || suite === null) {\n throw new Error(`Invalid EVAL.yaml: expected an object in '${source}'`);\n }\n\n const rawSuite = suite as RawSuite;\n\n if (!Array.isArray(rawSuite.tests)) {\n throw new Error(`Invalid EVAL.yaml: missing 'tests' array in '${source}'`);\n }\n\n if (rawSuite.assert !== undefined && rawSuite.assertions === undefined) {\n warnings.push(\"'assert' is deprecated at the suite level. Use 'assertions' instead.\");\n }\n\n const suiteAssertions = resolveSuiteAssertions(rawSuite);\n\n // Suite-level NL assertions (appended to every test)\n const suiteNlAssertions: string[] = suiteAssertions\n .filter((a) => a.type !== 'skill-trigger')\n .flatMap(assertionToNaturalLanguageList);\n\n /**\n * Helper: get or create the EvalsJsonFile for a skill.\n */\n function getSkillFile(skillName: string): EvalsJsonFile {\n const existing = files.get(skillName);\n if (existing) return existing;\n const created: EvalsJsonFile = { skill_name: skillName, evals: [] };\n files.set(skillName, created);\n return created;\n }\n\n const tests = rawSuite.tests as RawTestCase[];\n\n for (let idx = 0; idx < tests.length; idx++) {\n const rawCase = tests[idx];\n const caseAssertions = resolveAssertions(rawCase);\n\n if (rawCase.assert !== undefined && rawCase.assertions === undefined) {\n const caseId = rawCase.id ?? idx + 1;\n warnings.push(`Test '${caseId}': 'assert' is deprecated. Use 'assertions' instead.`);\n }\n\n // Collect NL assertions (not skill-trigger)\n const nlAssertions: string[] = [];\n\n // Prepend test-level criteria as NL assertion\n if (typeof rawCase.criteria === 'string' && rawCase.criteria.trim()) {\n nlAssertions.push(rawCase.criteria.trim());\n }\n\n for (const entry of caseAssertions) {\n if (entry.type !== 'skill-trigger') {\n nlAssertions.push(...assertionToNaturalLanguageList(entry));\n }\n }\n\n // Append suite-level NL assertions\n nlAssertions.push(...suiteNlAssertions);\n\n const triggerJudges = extractTriggerAssertions(caseAssertions);\n const { prompt, files: inputFiles } = extractInput(rawCase);\n const expectedOutput = extractExpectedOutput(rawCase.expected_output);\n\n // Build the numeric id (1-based index)\n const numericId = idx + 1;\n\n // Build the base case (without should_trigger — added per-skill below)\n const baseCase: Omit<EvalsJsonCase, 'should_trigger'> & { should_trigger?: boolean } = {\n id: numericId,\n prompt,\n ...(expectedOutput !== undefined && { expected_output: expectedOutput }),\n ...(inputFiles.length > 0 && { files: inputFiles }),\n assertions: nlAssertions,\n };\n\n if (triggerJudges.length === 0) {\n // No skill-trigger: place in dominant skill (or _no-skill)\n // Determine dominant skill by scanning all tests (first occurrence wins)\n // We defer this: record with a sentinel and resolve after all tests are processed.\n // For now, push to _no-skill; we'll re-assign at the end.\n const noSkillFile = getSkillFile('_no-skill');\n noSkillFile.evals.push({ ...baseCase });\n } else {\n // Place in each skill with the correct should_trigger value\n for (const tj of triggerJudges) {\n const skillName = typeof tj.skill === 'string' ? tj.skill : '_no-skill';\n const shouldTrigger = tj.should_trigger !== false; // default true\n const skillFile = getSkillFile(skillName);\n skillFile.evals.push({ ...baseCase, should_trigger: shouldTrigger });\n }\n }\n }\n\n // Re-assign _no-skill tests to the dominant skill (if one exists)\n const noSkillFile = files.get('_no-skill');\n if (noSkillFile && noSkillFile.evals.length > 0) {\n // Find the skill with the most tests (among real skills)\n let dominantSkill: string | null = null;\n let maxCount = 0;\n for (const [name, f] of files) {\n if (name !== '_no-skill' && f.evals.length > maxCount) {\n maxCount = f.evals.length;\n dominantSkill = name;\n }\n }\n\n if (dominantSkill) {\n const targetFile = getSkillFile(dominantSkill);\n for (const evalCase of noSkillFile.evals) {\n targetFile.evals.push(evalCase);\n }\n files.delete('_no-skill');\n }\n // else: keep _no-skill if there are no other skills\n }\n\n return { files, warnings };\n}\n\n// ---------------------------------------------------------------------------\n// File-level API\n// ---------------------------------------------------------------------------\n\n/**\n * Transpile an EVAL.yaml file into one or more evals.json objects.\n * Returns a map from output filename → JSON content.\n *\n * @param evalYamlPath Absolute path to the EVAL.yaml file\n */\nexport function transpileEvalYamlFile(evalYamlPath: string): TranspileResult {\n const content = readFileSync(evalYamlPath, 'utf8');\n const parsed = parse(content) as unknown;\n return transpileEvalYaml(parsed, path.basename(evalYamlPath));\n}\n\n/**\n * Determine the output filename(s) for a transpile result.\n * Single skill → \"evals.json\"\n * Multiple skills → \"<skill>.evals.json\"\n */\nexport function getOutputFilenames(result: TranspileResult): Map<string, string> {\n const names = new Map<string, string>();\n if (result.files.size === 1) {\n for (const [skill] of result.files) {\n names.set(skill, 'evals.json');\n }\n } else {\n for (const [skill] of result.files) {\n const safeName = skill.replace(/[^a-zA-Z0-9_-]/g, '_');\n names.set(skill, `${safeName}.evals.json`);\n }\n }\n return names;\n}\n","/**\n * Typed configuration file support for AgentV.\n *\n * Provides `defineConfig()` for use in `agentv.config.ts` files. Supports\n * auto-discovery, Zod validation, and IDE autocomplete.\n *\n * @example\n * ```typescript\n * // agentv.config.ts\n * import { defineConfig } from '@agentv/core';\n *\n * export default defineConfig({\n * execution: {\n * workers: 5,\n * maxRetries: 2,\n * agentTimeoutMs: 120_000,\n * },\n * output: {\n * format: 'jsonl',\n * dir: './results',\n * },\n * });\n * ```\n *\n * @module\n */\n\nimport { z } from 'zod';\n\n/**\n * Schema for AgentV project-level configuration.\n */\nconst AgentVConfigSchema = z.object({\n /** Default execution settings */\n execution: z\n .object({\n /** Number of parallel workers (default: 3) */\n workers: z.number().int().min(1).max(50).optional(),\n /** Maximum retries on failure (default: 2) */\n maxRetries: z.number().int().min(0).optional(),\n /** Agent timeout in milliseconds. No timeout if not set. */\n agentTimeoutMs: z.number().int().min(0).optional(),\n /** Enable verbose logging */\n verbose: z.boolean().optional(),\n /** Always keep temp workspaces after eval */\n keepWorkspaces: z.boolean().optional(),\n /** Write OTLP JSON trace to this path (supports {timestamp} placeholder) */\n otelFile: z.string().optional(),\n })\n .optional(),\n\n /** Output settings */\n output: z\n .object({\n /** Output format */\n format: z.enum(['jsonl', 'yaml', 'json', 'xml']).optional(),\n /** Output directory */\n dir: z.string().optional(),\n })\n .optional(),\n\n /** Response caching */\n cache: z\n .object({\n /** Enable response caching */\n enabled: z.boolean().optional(),\n /** Cache file path */\n path: z.string().optional(),\n })\n .optional(),\n\n /** Cost and duration limits */\n limits: z\n .object({\n /** Maximum cost per run in USD */\n maxCostUsd: z.number().min(0).optional(),\n /** Maximum duration per run in milliseconds */\n maxDurationMs: z.number().int().min(0).optional(),\n })\n .optional(),\n});\n\n/**\n * AgentV project-level configuration type.\n * Inferred from the Zod schema for full type safety.\n */\nexport type AgentVConfig = z.infer<typeof AgentVConfigSchema>;\n\n/**\n * Define a typed AgentV configuration.\n *\n * Use this in `agentv.config.ts` at your project root. The configuration\n * is validated at load time and provides full IDE autocomplete.\n *\n * @param config - Configuration object\n * @returns Validated configuration\n *\n * @example\n * ```typescript\n * import { defineConfig } from '@agentv/core';\n *\n * export default defineConfig({\n * execution: { workers: 5 },\n * output: { format: 'jsonl', dir: './results' },\n * limits: { maxCostUsd: 10.0 },\n * });\n * ```\n */\nexport function defineConfig(config: AgentVConfig): AgentVConfig {\n return AgentVConfigSchema.parse(config);\n}\n\n/**\n * Config file discovery order.\n * The first file found wins.\n */\nconst CONFIG_FILE_NAMES = [\n 'agentv.config.ts',\n 'agentv.config.js',\n 'agentv.config.mts',\n 'agentv.config.mjs',\n '.agentv/config.ts',\n '.agentv/config.js',\n] as const;\n\n/**\n * Discover and load an AgentV config file from the project root.\n *\n * Searches for config files in discovery order. Returns null if\n * no config file is found.\n *\n * @param projectRoot - Project root directory to search from\n * @returns Loaded and validated config, or null if not found\n */\nexport async function loadTsConfig(projectRoot: string): Promise<AgentVConfig | null> {\n const { existsSync } = await import('node:fs');\n const { pathToFileURL } = await import('node:url');\n const { join } = await import('node:path');\n\n for (const fileName of CONFIG_FILE_NAMES) {\n const filePath = join(projectRoot, fileName);\n if (!existsSync(filePath)) {\n continue;\n }\n\n try {\n const fileUrl = pathToFileURL(filePath).href;\n const mod = await import(fileUrl);\n const config = mod.default ?? mod;\n\n return AgentVConfigSchema.parse(config);\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to load config from ${filePath}: ${msg}`);\n }\n }\n\n return null;\n}\n","import { generateText } from 'ai';\nimport { z } from 'zod';\n\nimport type { Provider } from '../providers/types.js';\nimport type { RubricItem } from '../types.js';\n\nconst rubricItemSchema = z.object({\n id: z.string().describe('Short identifier for this rubric (e.g., clarity, completeness)'),\n outcome: z.string().describe('Concrete expected outcome for this rubric item'),\n weight: z.number().default(1.0).describe('Relative importance (default 1.0)'),\n required: z.boolean().default(true).describe('Whether this is a mandatory requirement'),\n});\n\nconst rubricGenerationSchema = z.object({\n rubrics: z.array(rubricItemSchema).describe('List of evaluation rubrics'),\n});\n\nexport interface GenerateRubricsOptions {\n readonly criteria: string;\n readonly question?: string;\n readonly referenceAnswer?: string;\n readonly provider: Provider;\n}\n\n/**\n * Generate rubrics from expected outcome using an LLM.\n */\nexport async function generateRubrics(\n options: GenerateRubricsOptions,\n): Promise<readonly RubricItem[]> {\n const { criteria, question, referenceAnswer, provider } = options;\n\n const prompt = buildPrompt(criteria, question, referenceAnswer);\n\n const model = provider.asLanguageModel?.();\n if (!model) {\n throw new Error('Provider does not support language model interface');\n }\n\n const system = `You are an expert at creating evaluation rubrics.\nYou must return a valid JSON object matching this schema:\n{\n \"rubrics\": [\n {\n \"id\": \"string (short identifier)\",\n \"outcome\": \"string (concrete expected outcome for this rubric item)\",\n \"weight\": number (default 1.0),\n \"required\": boolean (default true)\n }\n ]\n}`;\n\n let result: z.infer<typeof rubricGenerationSchema> | undefined;\n let lastError: Error | undefined;\n\n for (let attempt = 1; attempt <= 3; attempt++) {\n try {\n const { text } = await generateText({\n model,\n system,\n prompt,\n });\n\n const cleaned = text.replace(/```json\\n?|```/g, '').trim();\n result = rubricGenerationSchema.parse(JSON.parse(cleaned));\n break;\n } catch (e: unknown) {\n lastError = e instanceof Error ? e : new Error(String(e));\n // Continue to next attempt\n }\n }\n\n if (!result) {\n throw new Error(`Failed to parse generated rubrics after 3 attempts: ${lastError?.message}`);\n }\n\n return result.rubrics;\n}\n\nfunction buildPrompt(criteria: string, question?: string, referenceAnswer?: string): string {\n const parts: string[] = [\n 'You are an expert at creating evaluation rubrics.',\n 'Given the expected outcome (and optionally the question and reference answer),',\n 'generate a list of specific, measurable rubric items to evaluate whether an answer meets the expected outcome.',\n '',\n 'Each rubric should:',\n '- Be specific and testable',\n '- Have a short, descriptive ID',\n '- Include a clear expected outcome statement (what a good answer must demonstrate for this rubric)',\n '- Indicate if it is required (mandatory) or optional',\n '- Have an appropriate weight (default 1.0, use higher values for more important aspects)',\n '',\n 'Generate 3-7 rubric items that comprehensively cover the expected outcome.',\n '',\n '[[ ## criteria ## ]]',\n criteria,\n '',\n ];\n\n if (question && question.trim().length > 0) {\n parts.push('[[ ## question ## ]]', question, '');\n }\n\n if (referenceAnswer && referenceAnswer.trim().length > 0) {\n parts.push('[[ ## reference_answer ## ]]', referenceAnswer, '');\n }\n\n return parts.join('\\n');\n}\n","/**\n * Lightweight scanner that extracts git repo dependencies from eval YAML files\n * without performing full test/grader parsing.\n *\n * Used by `agentv workspace deps` to determine which repos CI needs to clone\n * before running evals.\n *\n * How it works:\n * 1. Reads each eval YAML file and parses it\n * 2. Extracts `workspace.repos` at suite-level and per-test level\n * 3. Resolves external workspace file references (string → file path)\n * 4. Deduplicates git repos by (url, ref)\n * 5. Returns a flat list of unique repo dependencies\n *\n * To extend: add support for new workspace source types by adding a branch\n * in `extractReposFromWorkspaceRaw()`.\n */\nimport { readFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { parse } from 'yaml';\n\nimport { interpolateEnv } from '../interpolation.js';\nimport type { RepoCheckout, RepoClone, RepoSource } from '../types.js';\nimport { parseRepoCheckout, parseRepoClone, parseRepoSource } from './repo-config-parser.js';\n\n/** A single git repo dependency discovered from eval files. */\nexport interface RepoDep {\n /** Git clone URL */\n readonly url: string;\n /** Checkout ref (branch, tag, SHA). undefined means HEAD. */\n readonly ref: string | undefined;\n /** Clone options (depth, filter, sparse) — first-wins on dedup collision */\n readonly clone: RepoClone | undefined;\n /** Checkout options (resolve, ancestor) — first-wins on dedup collision */\n readonly checkout: Omit<RepoCheckout, 'ref'> | undefined;\n /** Eval files that reference this repo */\n readonly usedBy: string[];\n}\n\n/** Full output of the deps scanner. */\nexport interface DepsScanResult {\n readonly repos: readonly RepoDep[];\n /** Files that failed to parse (non-fatal) */\n readonly errors: readonly { file: string; message: string }[];\n}\n\n/** Normalize a git URL for dedup: strip trailing .git and lowercase the host. */\nfunction normalizeGitUrl(url: string): string {\n let normalized = url.replace(/\\.git$/, '');\n // Lowercase the host portion of https:// URLs\n try {\n const parsed = new URL(normalized);\n parsed.hostname = parsed.hostname.toLowerCase();\n normalized = parsed.toString().replace(/\\/$/, '');\n } catch {\n // Not a valid URL (e.g., SSH shorthand) — use as-is\n }\n return normalized;\n}\n\n/**\n * Scan eval YAML files and collect unique git repo dependencies.\n * Non-YAML files and parse errors are collected in `errors` but don't stop scanning.\n *\n * Dedup strategy: repos are keyed by (normalized URL, ref). On collision,\n * clone/checkout options from the first occurrence win — this is intentional\n * since the manifest is advisory (CI can override clone options).\n */\nexport async function scanRepoDeps(evalFilePaths: readonly string[]): Promise<DepsScanResult> {\n const seen = new Map<string, RepoDep & { usedBy: string[] }>();\n const errors: { file: string; message: string }[] = [];\n\n for (const filePath of evalFilePaths) {\n try {\n const repos = await extractReposFromEvalFile(filePath);\n for (const repo of repos) {\n if (!repo.source || repo.source.type !== 'git') continue;\n const ref = repo.checkout?.ref;\n const key = `${normalizeGitUrl(repo.source.url)}\\0${ref ?? ''}`;\n const existing = seen.get(key);\n if (existing) {\n existing.usedBy.push(filePath);\n } else {\n const { ref: _ref, ...checkoutRest } = repo.checkout ?? {};\n const hasCheckout = Object.keys(checkoutRest).length > 0;\n seen.set(key, {\n url: repo.source.url,\n ref,\n clone: repo.clone,\n checkout: hasCheckout ? checkoutRest : undefined,\n usedBy: [filePath],\n });\n }\n }\n } catch (err) {\n errors.push({\n file: filePath,\n message: err instanceof Error ? err.message : String(err),\n });\n }\n }\n\n return { repos: [...seen.values()], errors };\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers — lightweight YAML extraction, no full test parsing\n// ---------------------------------------------------------------------------\n\ninterface RawRepo {\n source: RepoSource;\n checkout?: RepoCheckout;\n clone?: RepoClone;\n}\n\nasync function extractReposFromEvalFile(filePath: string): Promise<RawRepo[]> {\n const content = await readFile(filePath, 'utf8');\n const parsed = interpolateEnv(parse(content), process.env);\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return [];\n const obj = parsed as Record<string, unknown>;\n const evalFileDir = path.dirname(path.resolve(filePath));\n\n const repos: RawRepo[] = [];\n\n // Suite-level workspace\n const suiteRepos = await extractReposFromWorkspaceRaw(obj.workspace, evalFileDir);\n repos.push(...suiteRepos);\n\n // Per-test workspace\n const tests = Array.isArray(obj.tests) ? obj.tests : [];\n for (const test of tests) {\n if (test && typeof test === 'object' && !Array.isArray(test)) {\n const testObj = test as Record<string, unknown>;\n const testRepos = await extractReposFromWorkspaceRaw(testObj.workspace, evalFileDir);\n repos.push(...testRepos);\n }\n }\n\n return repos;\n}\n\n/**\n * Extract repos from a raw workspace value.\n * Handles both inline objects and string references to external workspace files.\n */\nasync function extractReposFromWorkspaceRaw(raw: unknown, evalFileDir: string): Promise<RawRepo[]> {\n if (typeof raw === 'string') {\n // External workspace file reference\n const workspaceFilePath = path.resolve(evalFileDir, raw);\n const content = await readFile(workspaceFilePath, 'utf8');\n const parsed = interpolateEnv(parse(content), process.env);\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return [];\n return extractReposFromObject(parsed as Record<string, unknown>);\n }\n if (raw && typeof raw === 'object' && !Array.isArray(raw)) {\n return extractReposFromObject(raw as Record<string, unknown>);\n }\n return [];\n}\n\nfunction extractReposFromObject(obj: Record<string, unknown>): RawRepo[] {\n const rawRepos = Array.isArray(obj.repos) ? obj.repos : [];\n const result: RawRepo[] = [];\n for (const r of rawRepos) {\n if (!r || typeof r !== 'object' || Array.isArray(r)) continue;\n const repo = r as Record<string, unknown>;\n const source = parseRepoSource(repo.source);\n if (!source) continue;\n result.push({\n source,\n checkout: parseRepoCheckout(repo.checkout),\n clone: parseRepoClone(repo.clone),\n });\n }\n return result;\n}\n","import { createHash } from 'node:crypto';\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport type { EvaluationCache } from '../orchestrator.js';\nimport type { ProviderResponse } from '../providers/types.js';\n\nconst DEFAULT_CACHE_PATH = '.agentv/cache';\n\n/**\n * File-based LLM response cache.\n * Stores provider responses as JSON files keyed by SHA-256 hash.\n * Directory structure: <cache_path>/<first-2-chars>/<full-hash>.json\n */\nexport class ResponseCache implements EvaluationCache {\n private readonly cachePath: string;\n\n constructor(cachePath?: string) {\n this.cachePath = cachePath ?? DEFAULT_CACHE_PATH;\n }\n\n async get(key: string): Promise<ProviderResponse | undefined> {\n const filePath = this.keyToPath(key);\n try {\n const data = await readFile(filePath, 'utf8');\n return JSON.parse(data) as ProviderResponse;\n } catch {\n return undefined;\n }\n }\n\n async set(key: string, value: ProviderResponse): Promise<void> {\n const filePath = this.keyToPath(key);\n const dir = path.dirname(filePath);\n await mkdir(dir, { recursive: true });\n await writeFile(filePath, JSON.stringify(value, null, 2), 'utf8');\n }\n\n private keyToPath(key: string): string {\n const prefix = key.slice(0, 2);\n return path.join(this.cachePath, prefix, `${key}.json`);\n }\n}\n\n/**\n * Determine whether caching should be active for a given run.\n *\n * Precedence:\n * 1. --no-cache CLI flag → always disabled\n * 2. --cache CLI flag OR execution.cache YAML → enabled\n * 3. Default → disabled (safe for variability testing)\n */\nexport function shouldEnableCache(params: {\n cliCache: boolean;\n cliNoCache: boolean;\n yamlCache?: boolean;\n}): boolean {\n if (params.cliNoCache) return false;\n return params.cliCache || params.yamlCache === true;\n}\n\n/**\n * Check whether caching should be skipped for a target with temperature > 0.\n * Non-deterministic responses should not be cached unless explicitly forced.\n */\nexport function shouldSkipCacheForTemperature(targetConfig: Record<string, unknown>): boolean {\n const temp = targetConfig.temperature;\n if (typeof temp === 'number' && temp > 0) {\n return true;\n }\n return false;\n}\n","import { execFile } from 'node:child_process';\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { cp, mkdtemp, readdir, rm, stat } from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { promisify } from 'node:util';\n\nimport { getAgentvHome } from '../paths.js';\nimport type { ResultsExportConfig } from './loaders/config-loader.js';\n\nconst execFileAsync = promisify(execFile);\n\nexport interface ResultsRepoCachePaths {\n readonly rootDir: string;\n readonly repoDir: string;\n readonly statusFile: string;\n}\n\nexport interface ResultsRepoStatus {\n readonly configured: boolean;\n readonly available: boolean;\n readonly repo?: string;\n readonly path?: string;\n readonly auto_push?: boolean;\n readonly branch_prefix?: string;\n readonly cache_dir?: string;\n readonly last_synced_at?: string;\n readonly last_error?: string;\n}\n\nexport interface CheckedOutResultsRepoBranch {\n readonly branchName: string;\n readonly baseBranch: string;\n readonly repoDir: string;\n}\n\nexport interface PreparedResultsRepoBranch extends CheckedOutResultsRepoBranch {\n readonly cleanup: () => Promise<void>;\n}\n\ntype PersistedStatus = {\n readonly last_synced_at?: string;\n readonly last_error?: string;\n};\n\nfunction sanitizeRepoSlug(repo: string): string {\n return repo.trim().replace(/[^A-Za-z0-9._-]+/g, '-');\n}\n\nfunction withFriendlyGitHubAuthError(error: unknown): Error {\n const message = error instanceof Error ? error.message : String(error);\n const lower = message.toLowerCase();\n if (\n lower.includes('authentication failed') ||\n lower.includes('could not read username') ||\n lower.includes('permission denied') ||\n lower.includes('not logged into any github hosts')\n ) {\n return new Error(`${message}. Run 'gh auth login' to authenticate.`);\n }\n return new Error(message);\n}\n\nexport function normalizeResultsExportConfig(\n config: ResultsExportConfig,\n): Required<ResultsExportConfig> {\n return {\n repo: config.repo.trim(),\n path: config.path.trim().replace(/^\\/+|\\/+$/g, ''),\n auto_push: config.auto_push === true,\n branch_prefix: config.branch_prefix?.trim() || 'eval-results',\n };\n}\n\nexport function resolveResultsRepoUrl(repo: string): string {\n if (repo.includes('://') || repo.startsWith('git@')) {\n return repo;\n }\n return `https://github.com/${repo}.git`;\n}\n\nexport function getResultsRepoCachePaths(repo: string): ResultsRepoCachePaths {\n const rootDir = path.join(getAgentvHome(), 'cache', 'results-repo', sanitizeRepoSlug(repo));\n return {\n rootDir,\n repoDir: path.join(rootDir, 'repo'),\n statusFile: path.join(rootDir, 'status.json'),\n };\n}\n\nfunction readPersistedStatus(statusFile: string): PersistedStatus {\n if (!existsSync(statusFile)) {\n return {};\n }\n\n try {\n return JSON.parse(readFileSync(statusFile, 'utf8')) as PersistedStatus;\n } catch {\n return {};\n }\n}\n\nfunction writePersistedStatus(statusFile: string, status: PersistedStatus): void {\n mkdirSync(path.dirname(statusFile), { recursive: true });\n writeFileSync(statusFile, `${JSON.stringify(status, null, 2)}\\n`, 'utf8');\n}\n\nasync function runCommand(\n executable: string,\n args: readonly string[],\n options?: { cwd?: string; check?: boolean },\n): Promise<{ stdout: string; stderr: string }> {\n try {\n const { stdout, stderr } = await execFileAsync(executable, [...args], {\n cwd: options?.cwd,\n env: process.env,\n });\n return { stdout, stderr };\n } catch (error) {\n if (options?.check === false && error && typeof error === 'object') {\n const execError = error as { stdout?: string; stderr?: string };\n return {\n stdout: execError.stdout ?? '',\n stderr: execError.stderr ?? '',\n };\n }\n throw withFriendlyGitHubAuthError(error);\n }\n}\n\nasync function runGit(\n args: readonly string[],\n options?: { cwd?: string; check?: boolean },\n): Promise<{ stdout: string; stderr: string }> {\n return runCommand('git', args, options);\n}\n\nasync function runGh(\n args: readonly string[],\n options?: { cwd?: string },\n): Promise<{ stdout: string; stderr: string }> {\n return runCommand('gh', args, options);\n}\n\nasync function resolveDefaultBranch(repoDir: string): Promise<string> {\n try {\n const { stdout } = await runGit(['symbolic-ref', 'refs/remotes/origin/HEAD'], { cwd: repoDir });\n const ref = stdout.trim();\n const prefix = 'refs/remotes/origin/';\n if (ref.startsWith(prefix)) {\n return ref.slice(prefix.length);\n }\n } catch {\n // Fall through to main/master probing.\n }\n\n for (const candidate of ['main', 'master']) {\n try {\n await runGit(['rev-parse', '--verify', `origin/${candidate}`], { cwd: repoDir });\n return candidate;\n } catch {\n // Try next candidate.\n }\n }\n\n return 'main';\n}\n\nasync function updateCacheRepo(repoDir: string, baseBranch: string): Promise<void> {\n await runGit(['fetch', 'origin', '--prune'], { cwd: repoDir });\n await runGit(['checkout', baseBranch], { cwd: repoDir });\n await runGit(['pull', '--ff-only', 'origin', baseBranch], { cwd: repoDir });\n}\n\nfunction updateStatusFile(config: ResultsExportConfig, patch: PersistedStatus): void {\n const cachePaths = getResultsRepoCachePaths(config.repo);\n const current = readPersistedStatus(cachePaths.statusFile);\n writePersistedStatus(cachePaths.statusFile, {\n ...current,\n ...patch,\n });\n}\n\nexport async function ensureResultsRepoClone(config: ResultsExportConfig): Promise<string> {\n const normalized = normalizeResultsExportConfig(config);\n const cachePaths = getResultsRepoCachePaths(normalized.repo);\n mkdirSync(cachePaths.rootDir, { recursive: true });\n\n if (!existsSync(cachePaths.repoDir)) {\n try {\n await runGit([\n 'clone',\n '--filter=blob:none',\n resolveResultsRepoUrl(normalized.repo),\n cachePaths.repoDir,\n ]);\n return cachePaths.repoDir;\n } catch (error) {\n updateStatusFile(normalized, { last_error: withFriendlyGitHubAuthError(error).message });\n throw withFriendlyGitHubAuthError(error);\n }\n }\n\n if (!existsSync(path.join(cachePaths.repoDir, '.git'))) {\n throw new Error(`Results repo cache is not a git repository: ${cachePaths.repoDir}`);\n }\n\n return cachePaths.repoDir;\n}\n\nexport function getResultsRepoStatus(config?: ResultsExportConfig): ResultsRepoStatus {\n if (!config) {\n return {\n configured: false,\n available: false,\n repo: '',\n cache_dir: '',\n };\n }\n\n const normalized = normalizeResultsExportConfig(config);\n const cachePaths = getResultsRepoCachePaths(normalized.repo);\n const persisted = readPersistedStatus(cachePaths.statusFile);\n\n return {\n configured: true,\n available: existsSync(cachePaths.repoDir),\n repo: normalized.repo,\n path: normalized.path,\n auto_push: normalized.auto_push,\n branch_prefix: normalized.branch_prefix,\n cache_dir: cachePaths.repoDir,\n last_synced_at: persisted.last_synced_at,\n last_error: persisted.last_error,\n };\n}\n\nexport async function syncResultsRepo(config: ResultsExportConfig): Promise<ResultsRepoStatus> {\n const normalized = normalizeResultsExportConfig(config);\n\n try {\n const repoDir = await ensureResultsRepoClone(normalized);\n const baseBranch = await resolveDefaultBranch(repoDir);\n await updateCacheRepo(repoDir, baseBranch);\n updateStatusFile(normalized, {\n last_synced_at: new Date().toISOString(),\n last_error: undefined,\n });\n } catch (error) {\n updateStatusFile(normalized, {\n last_error: withFriendlyGitHubAuthError(error).message,\n });\n throw withFriendlyGitHubAuthError(error);\n }\n\n return getResultsRepoStatus(normalized);\n}\n\nexport async function checkoutResultsRepoBranch(\n config: ResultsExportConfig,\n branchName: string,\n): Promise<CheckedOutResultsRepoBranch> {\n const normalized = normalizeResultsExportConfig(config);\n const repoDir = await ensureResultsRepoClone(normalized);\n const baseBranch = await resolveDefaultBranch(repoDir);\n await updateCacheRepo(repoDir, baseBranch);\n await runGit(['checkout', '-B', branchName, `origin/${baseBranch}`], { cwd: repoDir });\n updateStatusFile(normalized, { last_error: undefined });\n return {\n branchName,\n baseBranch,\n repoDir,\n };\n}\n\nexport async function prepareResultsRepoBranch(\n config: ResultsExportConfig,\n branchName: string,\n): Promise<PreparedResultsRepoBranch> {\n const normalized = normalizeResultsExportConfig(config);\n const cloneDir = await ensureResultsRepoClone(normalized);\n const baseBranch = await resolveDefaultBranch(cloneDir);\n await updateCacheRepo(cloneDir, baseBranch);\n\n const worktreeRoot = await mkdtemp(path.join(os.tmpdir(), 'agentv-results-repo-'));\n const worktreeDir = path.join(worktreeRoot, 'repo');\n await runGit(['worktree', 'add', '-B', branchName, worktreeDir, `origin/${baseBranch}`], {\n cwd: cloneDir,\n });\n\n return {\n branchName,\n baseBranch,\n repoDir: worktreeDir,\n cleanup: async () => {\n try {\n await runGit(['worktree', 'remove', '--force', worktreeDir], { cwd: cloneDir });\n } finally {\n await rm(worktreeRoot, { recursive: true, force: true }).catch(() => undefined);\n }\n },\n };\n}\n\nexport async function stageResultsArtifacts(params: {\n readonly repoDir: string;\n readonly sourceDir: string;\n readonly destinationDir: string;\n}): Promise<void> {\n rmSync(params.destinationDir, { recursive: true, force: true });\n mkdirSync(path.dirname(params.destinationDir), { recursive: true });\n await cp(params.sourceDir, params.destinationDir, { recursive: true });\n}\n\nexport function resolveResultsRepoRunsDir(config: ResultsExportConfig): string {\n const normalized = normalizeResultsExportConfig(config);\n return path.join(\n getResultsRepoCachePaths(normalized.repo).repoDir,\n ...normalized.path.split('/'),\n );\n}\n\nexport async function directorySizeBytes(targetPath: string): Promise<number> {\n const entry = await stat(targetPath);\n if (entry.isFile()) {\n return entry.size;\n }\n\n let total = 0;\n for (const child of await readdir(targetPath, { withFileTypes: true })) {\n total += await directorySizeBytes(path.join(targetPath, child.name));\n }\n return total;\n}\n\nexport async function commitAndPushResultsBranch(params: {\n readonly repoDir: string;\n readonly branchName: string;\n readonly commitMessage: string;\n}): Promise<boolean> {\n await runGit(['add', '--all'], { cwd: params.repoDir });\n\n const { stdout: diffStdout } = await runGit(['status', '--porcelain'], {\n cwd: params.repoDir,\n check: false,\n });\n if (diffStdout.trim().length === 0) {\n return false;\n }\n\n await runGit(['commit', '-m', params.commitMessage], { cwd: params.repoDir });\n await runGit(['push', '-u', 'origin', params.branchName], { cwd: params.repoDir });\n return true;\n}\n\nexport async function pushResultsRepoBranch(\n config: ResultsExportConfig,\n branchName: string,\n cwd?: string,\n): Promise<void> {\n const normalized = normalizeResultsExportConfig(config);\n await runGit(['push', '-u', 'origin', branchName], {\n cwd: cwd ?? getResultsRepoCachePaths(normalized.repo).repoDir,\n });\n updateStatusFile(normalized, {\n last_synced_at: new Date().toISOString(),\n last_error: undefined,\n });\n}\n\nexport async function createDraftResultsPr(params: {\n readonly repo: string;\n readonly repoDir: string;\n readonly baseBranch: string;\n readonly branchName: string;\n readonly title: string;\n readonly body: string;\n}): Promise<string> {\n const { stdout } = await runGh(\n [\n 'pr',\n 'create',\n '--draft',\n '--repo',\n params.repo,\n '--base',\n params.baseBranch,\n '--head',\n params.branchName,\n '--title',\n params.title,\n '--body',\n params.body,\n ],\n { cwd: params.repoDir },\n );\n return stdout.trim();\n}\n","/**\n * Benchmark registry for AgentV Studio multi-benchmark support.\n *\n * A Benchmark = any directory containing a `.agentv/` folder.\n * The registry lives at `~/.agentv/projects.yaml` and tracks registered benchmarks.\n *\n * YAML format:\n * benchmarks:\n * - id: my-app\n * name: My App\n * path: /home/user/projects/my-app\n * addedAt: \"2026-03-20T10:00:00Z\"\n * lastOpenedAt: \"2026-03-30T14:00:00Z\"\n *\n * To extend: use loadBenchmarkRegistry() / saveBenchmarkRegistry() for CRUD,\n * discoverBenchmarks() to scan a directory tree for `.agentv/` directories.\n */\n\nimport {\n copyFileSync,\n existsSync,\n mkdirSync,\n readFileSync,\n readdirSync,\n statSync,\n writeFileSync,\n} from 'node:fs';\nimport path from 'node:path';\n\nimport { parse as parseYaml, stringify as stringifyYaml } from 'yaml';\n\nimport { getAgentvConfigDir, getAgentvHome } from './paths.js';\n\n// ── Types ───────────────────────────────────────────────────────────────\n\nexport interface BenchmarkEntry {\n id: string;\n name: string;\n path: string;\n addedAt: string;\n lastOpenedAt: string;\n}\n\nexport interface BenchmarkRegistry {\n benchmarks: BenchmarkEntry[];\n}\n\n// ── Registry path ───────────────────────────────────────────────────────\n\nexport function getBenchmarksRegistryPath(): string {\n return path.join(getAgentvConfigDir(), 'projects.yaml');\n}\n\n/**\n * One-time migration: if projects.yaml exists at the old AGENTV_HOME location\n * but not in ~/.agentv, copy it over. This handles the case where users had\n * AGENTV_HOME set and projects.yaml was created there before the config/data split.\n */\nfunction migrateProjectsYaml(targetPath: string): void {\n const dataHome = getAgentvHome();\n const configDir = getAgentvConfigDir();\n if (dataHome === configDir) return;\n const legacyPath = path.join(dataHome, 'projects.yaml');\n if (!existsSync(legacyPath)) return;\n mkdirSync(path.dirname(targetPath), { recursive: true });\n copyFileSync(legacyPath, targetPath);\n}\n\n// ── Load / Save ─────────────────────────────────────────────────────────\n\nexport function loadBenchmarkRegistry(): BenchmarkRegistry {\n const registryPath = getBenchmarksRegistryPath();\n if (!existsSync(registryPath)) {\n migrateProjectsYaml(registryPath);\n }\n if (!existsSync(registryPath)) {\n return { benchmarks: [] };\n }\n try {\n const raw = readFileSync(registryPath, 'utf-8');\n const parsed = parseYaml(raw);\n if (!parsed || !Array.isArray(parsed.benchmarks)) {\n return { benchmarks: [] };\n }\n return { benchmarks: parsed.benchmarks as BenchmarkEntry[] };\n } catch {\n return { benchmarks: [] };\n }\n}\n\nexport function saveBenchmarkRegistry(registry: BenchmarkRegistry): void {\n const registryPath = getBenchmarksRegistryPath();\n const dir = path.dirname(registryPath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n writeFileSync(registryPath, stringifyYaml({ benchmarks: registry.benchmarks }), 'utf-8');\n}\n\n// ── CRUD operations ─────────────────────────────────────────────────────\n\n/**\n * Derive a URL-safe benchmark ID from a directory path.\n * Uses the directory basename, lowercased, with non-alphanumeric chars replaced by hyphens.\n * Appends a numeric suffix if the ID already exists in the registry.\n */\nexport function deriveBenchmarkId(dirPath: string, existingIds: string[]): string {\n const base = path\n .basename(dirPath)\n .toLowerCase()\n .replace(/[^a-z0-9-]/g, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '');\n let candidate = base || 'benchmark';\n let suffix = 2;\n while (existingIds.includes(candidate)) {\n candidate = `${base}-${suffix}`;\n suffix++;\n }\n return candidate;\n}\n\n/**\n * Register a benchmark by path. Returns the new entry, or the existing one if already registered.\n * Validates that the path exists and contains a `.agentv/` directory.\n */\nexport function addBenchmark(benchmarkPath: string): BenchmarkEntry {\n const absPath = path.resolve(benchmarkPath);\n if (!existsSync(absPath)) {\n throw new Error(`Directory not found: ${absPath}`);\n }\n if (!existsSync(path.join(absPath, '.agentv'))) {\n throw new Error(`No .agentv/ directory found in ${absPath}. Run an evaluation first.`);\n }\n\n const registry = loadBenchmarkRegistry();\n const existing = registry.benchmarks.find((p) => p.path === absPath);\n if (existing) {\n return existing;\n }\n\n const now = new Date().toISOString();\n const entry: BenchmarkEntry = {\n id: deriveBenchmarkId(\n absPath,\n registry.benchmarks.map((p) => p.id),\n ),\n name: path.basename(absPath),\n path: absPath,\n addedAt: now,\n lastOpenedAt: now,\n };\n registry.benchmarks.push(entry);\n saveBenchmarkRegistry(registry);\n return entry;\n}\n\n/**\n * Remove a benchmark by ID. Returns true if removed, false if not found.\n */\nexport function removeBenchmark(benchmarkId: string): boolean {\n const registry = loadBenchmarkRegistry();\n const idx = registry.benchmarks.findIndex((p) => p.id === benchmarkId);\n if (idx < 0) return false;\n registry.benchmarks.splice(idx, 1);\n saveBenchmarkRegistry(registry);\n return true;\n}\n\n/**\n * Look up a benchmark by ID. Returns undefined if not found.\n */\nexport function getBenchmark(benchmarkId: string): BenchmarkEntry | undefined {\n return loadBenchmarkRegistry().benchmarks.find((p) => p.id === benchmarkId);\n}\n\n/**\n * Update lastOpenedAt for a benchmark.\n */\nexport function touchBenchmark(benchmarkId: string): void {\n const registry = loadBenchmarkRegistry();\n const entry = registry.benchmarks.find((p) => p.id === benchmarkId);\n if (entry) {\n entry.lastOpenedAt = new Date().toISOString();\n saveBenchmarkRegistry(registry);\n }\n}\n\n// ── Discovery ───────────────────────────────────────────────────────────\n\n/**\n * Scan a directory tree (up to maxDepth levels) for directories containing `.agentv/`.\n * Returns absolute paths of discovered benchmark directories.\n */\nexport function discoverBenchmarks(rootDir: string, maxDepth = 2): string[] {\n const absRoot = path.resolve(rootDir);\n if (!existsSync(absRoot) || !statSync(absRoot).isDirectory()) {\n return [];\n }\n\n const results: string[] = [];\n\n function scan(dir: string, depth: number) {\n if (depth > maxDepth) return;\n\n // Check if this directory itself is a benchmark\n if (existsSync(path.join(dir, '.agentv'))) {\n results.push(dir);\n return; // Don't scan subdirectories of a benchmark\n }\n\n if (depth === maxDepth) return;\n\n try {\n const entries = readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n if (entry.name.startsWith('.') || entry.name === 'node_modules') continue;\n scan(path.join(dir, entry.name), depth + 1);\n }\n } catch {\n // Permission denied or other FS errors — skip\n }\n }\n\n scan(absRoot, 0);\n return results;\n}\n","import type { EvaluationResult, GraderResult } from './types.js';\n\n/**\n * Top-level fields to strip from baseline results.\n * Uses a denylist approach: new fields are auto-preserved.\n */\nconst STRIPPED_TOP_LEVEL_FIELDS = new Set([\n 'requests',\n 'trace',\n 'workspacePath',\n 'output',\n 'beforeAllOutput',\n 'beforeEachOutput',\n 'afterAllOutput',\n 'afterEachOutput',\n 'fileChanges',\n // Promoted execution metrics (debug, not needed for regression comparison)\n 'tokenUsage',\n 'costUsd',\n 'durationMs',\n 'startTime',\n 'endTime',\n]);\n\n/**\n * Fields to strip from grader results.\n */\nconst STRIPPED_EVALUATOR_FIELDS = new Set(['rawRequest', 'input']);\n\n/**\n * Trims an evaluator result for baseline storage.\n * Strips debug/audit fields while preserving scoring data.\n * Recursively trims nested grader results (for composites).\n */\nfunction trimEvaluatorResult(result: GraderResult): GraderResult {\n const trimmed: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(result)) {\n if (STRIPPED_EVALUATOR_FIELDS.has(key)) continue;\n if (key === 'scores' && Array.isArray(value)) {\n trimmed[key] = (value as GraderResult[]).map(trimEvaluatorResult);\n } else {\n trimmed[key] = value;\n }\n }\n return trimmed as unknown as GraderResult;\n}\n\n/**\n * Trims an EvaluationResult for baseline storage.\n * Strips large debug/audit fields (denylist approach) while preserving\n * all fields needed for regression comparison (scores, assertions, etc.).\n *\n * Returns a new object — the input is not mutated.\n */\nexport function trimBaselineResult(result: EvaluationResult): EvaluationResult {\n const trimmed: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(result)) {\n if (STRIPPED_TOP_LEVEL_FIELDS.has(key)) continue;\n if (key === 'scores' && Array.isArray(value)) {\n trimmed[key] = (value as GraderResult[]).map(trimEvaluatorResult);\n } else {\n trimmed[key] = value;\n }\n }\n return trimmed as unknown as EvaluationResult;\n}\n","/** Default category for eval files without subdirectory structure. */\nexport const DEFAULT_CATEGORY = 'Uncategorized';\n\n/**\n * Derive a human-readable category from an eval file's relative path.\n *\n * Strips the filename and any `evals` directory segments, then joins\n * remaining directories with `/`. Returns {@link DEFAULT_CATEGORY} for files\n * at the root level.\n */\nexport function deriveCategory(relativePath: string): string {\n const parts = relativePath.split(/[/\\\\]/);\n if (parts.length <= 1) {\n return DEFAULT_CATEGORY;\n }\n const dirs = parts.slice(0, -1).filter((d) => d !== 'evals');\n return dirs.length > 0 ? dirs.join('/') : DEFAULT_CATEGORY;\n}\n","import type {\n Message,\n ProviderStreamCallbacks,\n ProviderTokenUsage,\n} from '../evaluation/providers/types.js';\nimport type { EvaluationResult } from '../evaluation/types.js';\nimport type { OtelBackendPreset, OtelExportOptions } from './types.js';\n\nexport type { OtelExportOptions, OtelBackendPreset };\n\n// ---------------------------------------------------------------------------\n// Backend presets\n// ---------------------------------------------------------------------------\n\nexport const OTEL_BACKEND_PRESETS: Record<string, OtelBackendPreset> = {\n langfuse: {\n name: 'langfuse',\n endpoint: process.env.LANGFUSE_HOST\n ? `${process.env.LANGFUSE_HOST}/api/public/otel/v1/traces`\n : 'https://cloud.langfuse.com/api/public/otel/v1/traces',\n headers: (env) => {\n const pub = env.LANGFUSE_PUBLIC_KEY ?? '';\n const secret = env.LANGFUSE_SECRET_KEY ?? '';\n return { Authorization: `Basic ${Buffer.from(`${pub}:${secret}`).toString('base64')}` };\n },\n },\n braintrust: {\n name: 'braintrust',\n endpoint: 'https://api.braintrust.dev/otel/v1/traces',\n headers: (env) => {\n const headers: Record<string, string> = {\n Authorization: `Bearer ${env.BRAINTRUST_API_KEY ?? ''}`,\n };\n // x-bt-parent is required by Braintrust to associate traces with a project\n const parent =\n env.BRAINTRUST_PARENT ??\n (env.BRAINTRUST_PROJECT_ID ? `project_id:${env.BRAINTRUST_PROJECT_ID}` : undefined) ??\n (env.BRAINTRUST_PROJECT ? `project_name:${env.BRAINTRUST_PROJECT}` : undefined);\n if (parent) {\n headers['x-bt-parent'] = parent;\n }\n return headers;\n },\n },\n confident: {\n name: 'confident',\n endpoint: 'https://otel.confident-ai.com/v1/traces',\n headers: (env) => ({\n 'x-confident-api-key': env.CONFIDENT_API_KEY ?? '',\n }),\n },\n};\n\n// ---------------------------------------------------------------------------\n// OTel type aliases (resolved dynamically at init)\n// ---------------------------------------------------------------------------\n\n// biome-ignore lint/suspicious/noExplicitAny: OTel types loaded dynamically\ntype OtelApi = any;\n// biome-ignore lint/suspicious/noExplicitAny: OTel types loaded dynamically\ntype NodeTracerProvider = any;\n// biome-ignore lint/suspicious/noExplicitAny: OTel types loaded dynamically\ntype Tracer = any;\n\n// ---------------------------------------------------------------------------\n// Exporter\n// ---------------------------------------------------------------------------\n\nexport class OtelTraceExporter {\n private provider: NodeTracerProvider | null = null;\n private tracer: Tracer | null = null;\n private api: OtelApi | null = null;\n // biome-ignore lint/suspicious/noExplicitAny: OTel types loaded dynamically\n private W3CPropagator: any = null;\n\n constructor(private readonly options: OtelExportOptions) {}\n\n /** Initialize the OTel SDK. Returns false if OTel packages are not available. */\n async init(): Promise<boolean> {\n try {\n const [sdkTraceNode, resourcesMod, semconvMod, api, coreMod] = await Promise.all([\n import('@opentelemetry/sdk-trace-node'),\n import('@opentelemetry/resources'),\n import('@opentelemetry/semantic-conventions'),\n import('@opentelemetry/api'),\n import('@opentelemetry/core').catch(() => null),\n ]);\n\n const { NodeTracerProvider: Provider, SimpleSpanProcessor } = sdkTraceNode;\n const { resourceFromAttributes } = resourcesMod;\n const { ATTR_SERVICE_NAME } = semconvMod;\n\n const resource = resourceFromAttributes({\n [ATTR_SERVICE_NAME]: this.options.serviceName ?? 'agentv',\n });\n\n // biome-ignore lint/suspicious/noExplicitAny: OTel processor types loaded dynamically\n const processors: any[] = [];\n\n // Remote OTLP exporter (only when endpoint is configured)\n if (this.options.endpoint) {\n const otlpHttp = await import('@opentelemetry/exporter-trace-otlp-http');\n const { OTLPTraceExporter } = otlpHttp;\n const exporter = new OTLPTraceExporter({\n url: this.options.endpoint,\n headers: this.options.headers,\n });\n processors.push(new SimpleSpanProcessor(exporter));\n }\n\n // OTLP JSON file exporter\n if (this.options.otlpFilePath) {\n const { OtlpJsonFileExporter } = await import('./otlp-json-file-exporter.js');\n processors.push(\n new SimpleSpanProcessor(new OtlpJsonFileExporter(this.options.otlpFilePath)),\n );\n }\n\n if (processors.length === 0) {\n return false;\n }\n\n this.provider = new Provider({\n resource,\n spanProcessors: processors,\n });\n this.provider.register();\n this.api = api;\n this.tracer = api.trace.getTracer('agentv', '1.0.0');\n this.W3CPropagator = coreMod?.W3CTraceContextPropagator ?? null;\n return true;\n } catch {\n return false;\n }\n }\n\n /** Export a single evaluation result as an OTel trace. */\n async exportResult(result: EvaluationResult): Promise<void> {\n if (!this.tracer || !this.api) return;\n\n const api = this.api;\n const tracer = this.tracer;\n const captureContent = this.options.captureContent ?? false;\n\n // Determine timing\n const startHr = toHrTime(result.startTime ?? result.timestamp);\n const endHr = toHrTime(result.endTime ?? result.timestamp);\n\n // Support trace composition via W3C traceparent propagation\n let parentCtx = api.ROOT_CONTEXT;\n const traceparent = process.env.TRACEPARENT;\n if (traceparent && this.W3CPropagator) {\n try {\n const propagator = new this.W3CPropagator();\n parentCtx = propagator.extract(\n api.ROOT_CONTEXT,\n { traceparent, tracestate: process.env.TRACESTATE ?? '' },\n {\n get: (carrier: Record<string, string>, key: string) => carrier[key],\n keys: (carrier: Record<string, string>) => Object.keys(carrier),\n },\n );\n } catch {\n // Malformed TRACEPARENT — fall back to standalone trace\n }\n }\n\n tracer.startActiveSpan(\n 'agentv.eval',\n { startTime: startHr },\n parentCtx,\n (rootSpan: {\n setAttribute: (...args: unknown[]) => void;\n addEvent: (...args: unknown[]) => void;\n setStatus: (...args: unknown[]) => void;\n end: (...args: unknown[]) => void;\n }) => {\n // GenAI semantic convention attributes\n rootSpan.setAttribute('gen_ai.operation.name', 'evaluate');\n rootSpan.setAttribute('gen_ai.system', 'agentv');\n\n // Core attributes\n rootSpan.setAttribute('agentv.test_id', result.testId);\n rootSpan.setAttribute('agentv.target', result.target);\n if (result.suite) rootSpan.setAttribute('agentv.suite', result.suite);\n rootSpan.setAttribute('agentv.score', result.score);\n if (captureContent && result.output.length > 0) {\n const lastMsg = result.output[result.output.length - 1];\n const text =\n typeof lastMsg.content === 'string' ? lastMsg.content : JSON.stringify(lastMsg.content);\n rootSpan.setAttribute('agentv.output_text', text);\n }\n\n // Flat execution metrics\n if (result.durationMs != null)\n rootSpan.setAttribute('agentv.trace.duration_ms', result.durationMs);\n if (result.costUsd != null) rootSpan.setAttribute('agentv.trace.cost_usd', result.costUsd);\n if (result.tokenUsage) {\n if (result.tokenUsage.input != null) {\n rootSpan.setAttribute('agentv.trace.token_input', result.tokenUsage.input);\n }\n if (result.tokenUsage.output != null) {\n rootSpan.setAttribute('agentv.trace.token_output', result.tokenUsage.output);\n }\n if (result.tokenUsage.cached != null) {\n rootSpan.setAttribute('agentv.trace.token_cached', result.tokenUsage.cached);\n }\n }\n\n // Trace summary attributes (tool-specific)\n if (result.trace) {\n const t = result.trace;\n rootSpan.setAttribute('agentv.trace.event_count', t.eventCount);\n rootSpan.setAttribute(\n 'agentv.trace.tool_names',\n Object.keys(t.toolCalls).sort().join(','),\n );\n if (t.llmCallCount != null)\n rootSpan.setAttribute('agentv.trace.llm_call_count', t.llmCallCount);\n }\n\n // Child spans from output messages (--trace mode)\n if (result.output) {\n const parentCtx = api.trace.setSpan(api.context.active(), rootSpan);\n\n if (this.options.groupTurns) {\n const turns = groupMessagesIntoTurns(result.output);\n if (turns.length > 1) {\n for (const [i, turn] of turns.entries()) {\n api.context.with(parentCtx, () => {\n tracer.startActiveSpan(\n `agentv.turn.${i + 1}`,\n {},\n (turnSpan: {\n end: (...args: unknown[]) => void;\n }) => {\n const turnCtx = api.trace.setSpan(api.context.active(), turnSpan);\n for (const msg of turn.messages) {\n this.exportMessage(tracer, api, turnCtx, msg, captureContent);\n }\n turnSpan.end();\n },\n );\n });\n }\n } else {\n for (const msg of result.output) {\n this.exportMessage(tracer, api, parentCtx, msg, captureContent);\n }\n }\n } else {\n for (const msg of result.output) {\n this.exportMessage(tracer, api, parentCtx, msg, captureContent);\n }\n }\n }\n\n // Grader scores as span events\n if (result.scores) {\n for (const score of result.scores) {\n rootSpan.addEvent(`agentv.grader.${score.name}`, {\n 'agentv.grader.score': score.score,\n 'agentv.grader.type': score.type,\n ...(score.verdict ? { 'agentv.grader.verdict': score.verdict } : {}),\n });\n }\n }\n\n // Status\n if (result.error) {\n rootSpan.setStatus({ code: api.SpanStatusCode.ERROR, message: result.error });\n } else {\n rootSpan.setStatus({ code: api.SpanStatusCode.OK });\n }\n\n rootSpan.end(endHr);\n },\n );\n }\n\n /** Flush pending spans and shut down. */\n async shutdown(): Promise<void> {\n await this.provider?.shutdown();\n }\n\n /** Create a streaming observer for real-time span export */\n createStreamingObserver(): OtelStreamingObserver | null {\n if (!this.tracer || !this.api) return null;\n // Extract TRACEPARENT for trace composition\n let parentCtx: unknown;\n const traceparent = process.env.TRACEPARENT;\n if (traceparent && this.W3CPropagator) {\n try {\n const propagator = new this.W3CPropagator();\n parentCtx = propagator.extract(\n this.api.ROOT_CONTEXT,\n { traceparent, tracestate: process.env.TRACESTATE ?? '' },\n {\n get: (carrier: Record<string, string>, key: string) => carrier[key],\n keys: (carrier: Record<string, string>) => Object.keys(carrier),\n },\n );\n } catch {\n // Malformed TRACEPARENT — ignore\n }\n }\n return new OtelStreamingObserver(\n this.tracer,\n this.api,\n this.options.captureContent ?? false,\n parentCtx,\n );\n }\n\n // -----------------------------------------------------------------------\n // Private helpers\n // -----------------------------------------------------------------------\n\n private exportMessage(\n tracer: Tracer,\n api: OtelApi,\n parentCtx: unknown,\n msg: Message,\n captureContent: boolean,\n ): void {\n const isAssistant = msg.role === 'assistant';\n const model = msg.metadata?.model ? String(msg.metadata.model) : undefined;\n const spanName = isAssistant ? `chat ${model ?? 'unknown'}` : `gen_ai.message.${msg.role}`;\n\n const startHr = toHrTime(msg.startTime);\n const endHr = toHrTime(msg.endTime);\n\n api.context.with(parentCtx, () => {\n tracer.startActiveSpan(\n spanName,\n { startTime: startHr },\n parentCtx,\n (span: {\n setAttribute: (...args: unknown[]) => void;\n end: (...args: unknown[]) => void;\n }) => {\n if (isAssistant) {\n span.setAttribute('gen_ai.operation.name', 'chat');\n }\n if (model) {\n span.setAttribute('gen_ai.request.model', model);\n span.setAttribute('gen_ai.response.model', model);\n }\n\n // Per-span token usage (GenAI conventions)\n if (msg.tokenUsage) {\n if (msg.tokenUsage.input != null) {\n span.setAttribute('gen_ai.usage.input_tokens', msg.tokenUsage.input);\n }\n if (msg.tokenUsage.output != null) {\n span.setAttribute('gen_ai.usage.output_tokens', msg.tokenUsage.output);\n }\n if (msg.tokenUsage.cached != null) {\n span.setAttribute('gen_ai.usage.cache_read.input_tokens', msg.tokenUsage.cached);\n }\n }\n\n if (captureContent && msg.content != null) {\n span.setAttribute(\n 'gen_ai.output.messages',\n typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content),\n );\n }\n\n // Tool call child spans\n if (msg.toolCalls) {\n const msgCtx = api.trace.setSpan(api.context.active(), span);\n for (const tc of msg.toolCalls) {\n api.context.with(msgCtx, () => {\n tracer.startActiveSpan(\n `execute_tool ${tc.tool}`,\n {},\n msgCtx,\n (toolSpan: {\n setAttribute: (...args: unknown[]) => void;\n end: (...args: unknown[]) => void;\n }) => {\n toolSpan.setAttribute('gen_ai.tool.name', tc.tool);\n if (tc.id) toolSpan.setAttribute('gen_ai.tool.call.id', tc.id);\n\n if (captureContent) {\n if (tc.input != null) {\n toolSpan.setAttribute(\n 'gen_ai.tool.call.arguments',\n typeof tc.input === 'string' ? tc.input : JSON.stringify(tc.input),\n );\n }\n if (tc.output != null) {\n toolSpan.setAttribute(\n 'gen_ai.tool.call.result',\n typeof tc.output === 'string' ? tc.output : JSON.stringify(tc.output),\n );\n }\n }\n\n toolSpan.end();\n },\n );\n });\n }\n }\n\n span.end(endHr);\n },\n );\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Streaming observer\n// ---------------------------------------------------------------------------\n\n/**\n * Streaming observer that creates OTel spans in real-time during eval execution.\n * Spans are exported immediately via SimpleSpanProcessor as each tool call / LLM response completes.\n */\nexport class OtelStreamingObserver {\n // biome-ignore lint/suspicious/noExplicitAny: OTel span type loaded dynamically\n private rootSpan: any = null;\n // biome-ignore lint/suspicious/noExplicitAny: OTel context loaded dynamically\n private rootCtx: any = null;\n private observedChildSpans = false;\n private pendingMetrics: {\n durationMs?: number;\n costUsd?: number;\n tokenUsage?: ProviderTokenUsage;\n trace?: {\n eventCount: number;\n toolCalls: Record<string, number>;\n llmCallCount?: number;\n };\n } | null = null;\n\n constructor(\n private readonly tracer: Tracer,\n private readonly api: OtelApi,\n private readonly captureContent: boolean,\n // biome-ignore lint/suspicious/noExplicitAny: OTel context loaded dynamically\n private readonly parentCtx?: any,\n ) {}\n\n /** Create root eval span immediately (visible in backend right away) */\n startEvalCase(testId: string, target: string, evalSet?: string): void {\n this.pendingMetrics = null;\n this.observedChildSpans = false;\n const ctx = this.parentCtx ?? this.api.context.active();\n this.rootSpan = this.tracer.startSpan('agentv.eval', undefined, ctx);\n this.rootSpan.setAttribute('gen_ai.operation.name', 'evaluate');\n this.rootSpan.setAttribute('gen_ai.system', 'agentv');\n this.rootSpan.setAttribute('agentv.test_id', testId);\n this.rootSpan.setAttribute('agentv.target', target);\n if (evalSet) this.rootSpan.setAttribute('agentv.suite', evalSet);\n this.rootCtx = this.api.trace.setSpan(this.api.context.active(), this.rootSpan);\n }\n\n /** Create and immediately export a tool span */\n onToolCall(\n name: string,\n input: unknown,\n output: unknown,\n _durationMs: number,\n toolCallId?: string,\n ): void {\n if (!this.rootCtx) return;\n this.observedChildSpans = true;\n this.api.context.with(this.rootCtx, () => {\n const span = this.tracer.startSpan(`execute_tool ${name}`, undefined, this.rootCtx);\n span.setAttribute('gen_ai.tool.name', name);\n if (toolCallId) span.setAttribute('gen_ai.tool.call.id', toolCallId);\n if (this.captureContent) {\n if (input != null)\n span.setAttribute(\n 'gen_ai.tool.call.arguments',\n typeof input === 'string' ? input : JSON.stringify(input),\n );\n if (output != null)\n span.setAttribute(\n 'gen_ai.tool.call.result',\n typeof output === 'string' ? output : JSON.stringify(output),\n );\n }\n span.end();\n });\n }\n\n /** Create and immediately export an LLM span */\n onLlmCall(model: string, tokenUsage?: ProviderTokenUsage): void {\n if (!this.rootCtx) return;\n this.observedChildSpans = true;\n this.api.context.with(this.rootCtx, () => {\n const span = this.tracer.startSpan(`chat ${model}`, undefined, this.rootCtx);\n span.setAttribute('gen_ai.operation.name', 'chat');\n span.setAttribute('gen_ai.request.model', model);\n span.setAttribute('gen_ai.response.model', model);\n if (tokenUsage) {\n if (tokenUsage.input != null)\n span.setAttribute('gen_ai.usage.input_tokens', tokenUsage.input);\n if (tokenUsage.output != null)\n span.setAttribute('gen_ai.usage.output_tokens', tokenUsage.output);\n if (tokenUsage.cached != null)\n span.setAttribute('gen_ai.usage.cache_read.input_tokens', tokenUsage.cached);\n }\n span.end();\n });\n }\n\n /** Record final execution metrics before the root span is finalized. */\n recordEvalMetrics(result: {\n durationMs?: number;\n costUsd?: number;\n tokenUsage?: ProviderTokenUsage;\n trace?: {\n eventCount: number;\n toolCalls: Record<string, number>;\n llmCallCount?: number;\n };\n }): void {\n this.pendingMetrics = result;\n }\n\n /** Finalize root span with score/verdict after evaluation completes */\n finalizeEvalCase(score: number, error?: string): void {\n if (!this.rootSpan) return;\n this.rootSpan.setAttribute('agentv.score', score);\n if (this.pendingMetrics?.durationMs != null) {\n this.rootSpan.setAttribute('agentv.trace.duration_ms', this.pendingMetrics.durationMs);\n }\n if (this.pendingMetrics?.costUsd != null) {\n this.rootSpan.setAttribute('agentv.trace.cost_usd', this.pendingMetrics.costUsd);\n }\n if (this.pendingMetrics?.tokenUsage) {\n if (this.pendingMetrics.tokenUsage.input != null) {\n this.rootSpan.setAttribute(\n 'agentv.trace.token_input',\n this.pendingMetrics.tokenUsage.input,\n );\n }\n if (this.pendingMetrics.tokenUsage.output != null) {\n this.rootSpan.setAttribute(\n 'agentv.trace.token_output',\n this.pendingMetrics.tokenUsage.output,\n );\n }\n if (this.pendingMetrics.tokenUsage.cached != null) {\n this.rootSpan.setAttribute(\n 'agentv.trace.token_cached',\n this.pendingMetrics.tokenUsage.cached,\n );\n }\n }\n if (this.pendingMetrics?.trace) {\n this.rootSpan.setAttribute('agentv.trace.event_count', this.pendingMetrics.trace.eventCount);\n this.rootSpan.setAttribute(\n 'agentv.trace.tool_names',\n Object.keys(this.pendingMetrics.trace.toolCalls).sort().join(','),\n );\n if (this.pendingMetrics.trace.llmCallCount != null) {\n this.rootSpan.setAttribute(\n 'agentv.trace.llm_call_count',\n this.pendingMetrics.trace.llmCallCount,\n );\n }\n }\n if (error) {\n this.rootSpan.setStatus({ code: this.api.SpanStatusCode.ERROR, message: error });\n } else {\n this.rootSpan.setStatus({ code: this.api.SpanStatusCode.OK });\n }\n this.rootSpan.end();\n this.rootSpan = null;\n this.rootCtx = null;\n this.observedChildSpans = false;\n this.pendingMetrics = null;\n }\n\n /** Backfill child spans from the completed result when the provider emitted no live callbacks. */\n completeFromResult(result: EvaluationResult): void {\n this.recordEvalMetrics({\n durationMs: result.durationMs,\n costUsd: result.costUsd,\n tokenUsage: result.tokenUsage,\n trace: result.trace,\n });\n\n if (this.observedChildSpans || !this.rootCtx) {\n return;\n }\n\n const model =\n result.output.find((msg) => msg.role === 'assistant')?.metadata?.model ??\n result.target ??\n 'unknown';\n\n this.onLlmCall(String(model), result.tokenUsage);\n\n for (const message of result.output) {\n for (const toolCall of message.toolCalls ?? []) {\n this.onToolCall(\n toolCall.tool,\n toolCall.input,\n toolCall.output,\n toolCall.durationMs ?? 0,\n toolCall.id,\n );\n }\n }\n }\n\n /** Return the active eval span's trace ID and span ID for Braintrust trace bridging */\n getActiveSpanIds(): { parentSpanId: string; rootSpanId: string } | null {\n if (!this.rootSpan) return null;\n try {\n const spanCtx = this.rootSpan.spanContext?.() ?? this.rootSpan._spanContext;\n if (!spanCtx?.traceId || !spanCtx?.spanId) return null;\n return { parentSpanId: spanCtx.spanId, rootSpanId: spanCtx.traceId };\n } catch {\n return null;\n }\n }\n\n /** Get ProviderStreamCallbacks for passing to providers */\n getStreamCallbacks(): ProviderStreamCallbacks {\n return {\n onToolCallEnd: (name, input, output, durationMs, toolCallId) =>\n this.onToolCall(name, input, output, durationMs, toolCallId),\n onLlmCallEnd: (model, tokenUsage) => this.onLlmCall(model, tokenUsage),\n getActiveSpanIds: () => this.getActiveSpanIds(),\n };\n }\n}\n\n// ---------------------------------------------------------------------------\n// Turn grouping\n// ---------------------------------------------------------------------------\n\ninterface Turn {\n messages: Message[];\n}\n\nfunction groupMessagesIntoTurns(messages: readonly Message[]): Turn[] {\n const turns: Turn[] = [];\n let current: Message[] = [];\n for (const msg of messages) {\n if (msg.role === 'user' && current.length > 0) {\n turns.push({ messages: current });\n current = [];\n }\n current.push(msg);\n }\n if (current.length > 0) turns.push({ messages: current });\n return turns;\n}\n\n// ---------------------------------------------------------------------------\n// Utilities\n// ---------------------------------------------------------------------------\n\n/** Convert an optional ISO timestamp to an HrTime-compatible value (milliseconds). */\nfunction toHrTime(iso?: string): number | undefined {\n if (!iso) return undefined;\n return new Date(iso).getTime();\n}\n","/**\n * Claude Code session JSONL parser.\n *\n * Reads a Claude Code session transcript (~/.claude/projects/<encoded-path>/<uuid>.jsonl)\n * and converts it to AgentV's Message[] format.\n *\n * Each line is a JSON object with:\n * { type, message: { role, content }, sessionId, timestamp, uuid, requestId, ... }\n *\n * Supported event types:\n * user → Message { role: 'user' } (also contains tool_result blocks)\n * assistant → Message { role: 'assistant', toolCalls from tool_use content blocks }\n *\n * Skipped event types: progress, system, file-history-snapshot\n *\n * Key behaviors:\n * - tool_use blocks in assistant events → ToolCall (pending output)\n * - tool_result blocks in user events → matched to pending tool_use by tool_use_id\n * - Usage is cumulative per requestId; only the last value per requestId is used\n * - Streaming assistant events with the same requestId are deduplicated (keep latest)\n * - Subagent events (isSidechain: true) are filtered out in v1\n * - Duration is from first↔last event timestamp (including skipped types)\n * - cost_usd is null (Claude Code does not report per-session cost)\n */\n\nimport { normalizeToolCall } from '../evaluation/providers/normalize-tool-call.js';\nimport type { Message, ToolCall } from '../evaluation/providers/types.js';\nimport type { TranscriptEntry, TranscriptSource } from './types.js';\n\ninterface ClaudeEvent {\n readonly type: string;\n readonly requestId?: string;\n readonly isSidechain?: boolean;\n readonly message?: {\n readonly role?: string;\n readonly content?: string | readonly ClaudeContentBlock[];\n readonly usage?: ClaudeUsage;\n readonly model?: string;\n };\n readonly sessionId?: string;\n readonly timestamp?: string;\n readonly uuid?: string;\n readonly cwd?: string;\n}\n\ninterface ClaudeContentBlock {\n readonly type: string;\n readonly text?: string;\n readonly thinking?: string;\n readonly name?: string;\n readonly input?: unknown;\n readonly id?: string;\n readonly tool_use_id?: string;\n readonly content?: string | readonly { readonly type: string; readonly text?: string }[];\n}\n\ninterface ClaudeUsage {\n readonly input_tokens?: number;\n readonly output_tokens?: number;\n readonly cache_read_input_tokens?: number;\n}\n\nconst SKIPPED_TYPES = new Set(['progress', 'system', 'file-history-snapshot']);\n\nexport function parseClaudeSession(jsonl: string): TranscriptEntry {\n const messages: Message[] = [];\n let sessionId = '';\n let projectPath: string | undefined;\n let model: string | undefined;\n let startTimestamp: string | undefined;\n let endTimestamp: string | undefined;\n\n // Track usage per requestId — values are cumulative, so we only keep the last\n const usageByRequestId = new Map<string, ClaudeUsage>();\n\n // Track the last assistant message per requestId to deduplicate streaming updates\n let lastAssistantRequestId: string | undefined;\n let lastAssistantIdx = -1;\n\n // Track pending tool_use IDs for pairing with tool_result in user events\n const pendingToolCalls = new Map<string, { msgIdx: number; toolIdx: number }>();\n\n const lines = jsonl.split('\\n').filter((l) => l.trim().length > 0);\n\n for (const line of lines) {\n let event: ClaudeEvent;\n try {\n event = JSON.parse(line) as ClaudeEvent;\n } catch {\n continue;\n }\n\n if (!event.type) continue;\n\n // Track timestamps from ALL events (including skipped types) for accurate duration\n if (event.timestamp) {\n if (!startTimestamp) startTimestamp = event.timestamp;\n endTimestamp = event.timestamp;\n }\n\n // Skip non-message event types\n if (SKIPPED_TYPES.has(event.type)) continue;\n\n // Skip subagent events (v1: only process main conversation)\n if (event.isSidechain) continue;\n\n // Capture session metadata from first event\n if (!sessionId && event.sessionId) {\n sessionId = event.sessionId;\n }\n if (!projectPath && event.cwd) {\n projectPath = event.cwd;\n }\n\n switch (event.type) {\n case 'user': {\n const msg = event.message;\n if (!msg) break;\n\n const contentArr = msg.content;\n\n // User events can contain both tool_result blocks (responses to tool_use)\n // and text blocks. Process tool_results first, then extract text.\n if (Array.isArray(contentArr)) {\n for (const block of contentArr as readonly ClaudeContentBlock[]) {\n if (block.type === 'tool_result' && block.tool_use_id) {\n const pending = pendingToolCalls.get(block.tool_use_id);\n if (pending) {\n const existingMsg = messages[pending.msgIdx];\n const existingCalls = [...(existingMsg.toolCalls ?? [])];\n existingCalls[pending.toolIdx] = {\n ...existingCalls[pending.toolIdx],\n output: extractToolResultContent(block.content),\n };\n messages[pending.msgIdx] = { ...existingMsg, toolCalls: existingCalls };\n pendingToolCalls.delete(block.tool_use_id);\n }\n }\n }\n }\n\n // Extract text content for the user message\n const text = extractTextContent(contentArr);\n if (text !== undefined) {\n messages.push({ role: 'user', content: text });\n }\n break;\n }\n\n case 'assistant': {\n const msg = event.message;\n if (!msg) break;\n\n // Capture model from first assistant message\n if (!model && msg.model) {\n model = msg.model;\n }\n\n // Track usage (cumulative per requestId — last value wins)\n if (msg.usage && event.requestId) {\n usageByRequestId.set(event.requestId, msg.usage);\n }\n\n // Parse content array for text and tool_use blocks\n const { text, toolCalls } = extractAssistantContent(msg.content);\n\n // Deduplicate streaming assistant events with the same requestId\n if (\n event.requestId &&\n event.requestId === lastAssistantRequestId &&\n lastAssistantIdx >= 0\n ) {\n // Replace the previous partial message\n messages[lastAssistantIdx] = {\n role: 'assistant',\n content: text || undefined,\n toolCalls: toolCalls.length > 0 ? toolCalls : undefined,\n };\n // Re-register tool calls for pairing\n registerPendingToolCalls(toolCalls, lastAssistantIdx, pendingToolCalls);\n } else {\n // Only push if there's actual content or tool calls\n if (text || toolCalls.length > 0) {\n lastAssistantIdx = messages.length;\n messages.push({\n role: 'assistant',\n content: text || undefined,\n toolCalls: toolCalls.length > 0 ? toolCalls : undefined,\n });\n registerPendingToolCalls(toolCalls, lastAssistantIdx, pendingToolCalls);\n }\n }\n lastAssistantRequestId = event.requestId;\n break;\n }\n }\n }\n\n // Compute final usage from last-seen value per requestId\n let totalInputTokens = 0;\n let totalOutputTokens = 0;\n for (const usage of usageByRequestId.values()) {\n totalInputTokens += Number(usage.input_tokens ?? 0);\n totalOutputTokens += Number(usage.output_tokens ?? 0);\n }\n const hasUsage = usageByRequestId.size > 0;\n\n let durationMs: number | undefined;\n if (startTimestamp && endTimestamp) {\n durationMs = new Date(endTimestamp).getTime() - new Date(startTimestamp).getTime();\n }\n\n const source: TranscriptSource = {\n provider: 'claude',\n sessionId,\n projectPath,\n startedAt: startTimestamp,\n model,\n };\n\n return {\n messages,\n source,\n tokenUsage: hasUsage ? { input: totalInputTokens, output: totalOutputTokens } : undefined,\n durationMs,\n costUsd: null,\n };\n}\n\n/**\n * Register tool_use IDs from an assistant message for later pairing with tool_result.\n */\nfunction registerPendingToolCalls(\n toolCalls: ToolCall[],\n msgIdx: number,\n pending: Map<string, { msgIdx: number; toolIdx: number }>,\n): void {\n for (let i = 0; i < toolCalls.length; i++) {\n const id = toolCalls[i].id;\n if (id) {\n pending.set(id, { msgIdx, toolIdx: i });\n }\n }\n}\n\n/**\n * Extract text content from a message's content field.\n */\nfunction extractTextContent(\n content: string | readonly ClaudeContentBlock[] | undefined,\n): string | undefined {\n if (content === undefined || content === null) return undefined;\n if (typeof content === 'string') return content;\n\n const textParts: string[] = [];\n for (const block of content) {\n if (block.type === 'text' && block.text) {\n textParts.push(block.text);\n }\n }\n return textParts.length > 0 ? textParts.join('') : undefined;\n}\n\n/**\n * Extract text and tool_use calls from an assistant message's content array.\n * Note: tool_result blocks appear in user events, not here.\n */\nfunction extractAssistantContent(content: string | readonly ClaudeContentBlock[] | undefined): {\n text: string | undefined;\n toolCalls: ToolCall[];\n} {\n if (content === undefined || content === null) {\n return { text: undefined, toolCalls: [] };\n }\n if (typeof content === 'string') {\n return { text: content, toolCalls: [] };\n }\n\n const textParts: string[] = [];\n const toolCalls: ToolCall[] = [];\n\n for (const block of content) {\n switch (block.type) {\n case 'text':\n if (block.text) textParts.push(block.text);\n break;\n\n case 'tool_use':\n if (block.name) {\n toolCalls.push(\n normalizeToolCall('claude', {\n tool: block.name,\n input: block.input,\n id: block.id,\n }),\n );\n }\n break;\n\n // Skip thinking blocks and other types\n }\n }\n\n return {\n text: textParts.length > 0 ? textParts.join('') : undefined,\n toolCalls,\n };\n}\n\n/**\n * Extract text from a tool_result content field.\n */\nfunction extractToolResultContent(\n content: string | readonly { readonly type: string; readonly text?: string }[] | undefined,\n): string | undefined {\n if (content === undefined || content === null) return undefined;\n if (typeof content === 'string') return content;\n\n const parts: string[] = [];\n for (const block of content) {\n if (block.type === 'text' && block.text) {\n parts.push(block.text);\n }\n }\n return parts.length > 0 ? parts.join('') : undefined;\n}\n","/**\n * Codex CLI session JSONL parser.\n *\n * Reads a Codex CLI rollout transcript\n * (~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl) and converts it to AgentV's\n * Message[] format.\n *\n * Each line is a JSON object with one of these top-level types:\n * session_meta → session metadata (id, cwd, cli_version, model)\n * turn_context → per-turn context (model, cwd, turn_id)\n * event_msg → events: task_started, task_complete, user_message,\n * agent_message, token_count\n * response_item → conversation items: message, function_call,\n * function_call_output, reasoning, custom_tool_call,\n * custom_tool_call_output\n *\n * Key behaviors:\n * - response_item with type=message and role=user → user Message\n * - response_item with type=message and role=assistant → assistant Message\n * - response_item with type=function_call → ToolCall (pending output)\n * - response_item with type=function_call_output → matched to pending call by call_id\n * - response_item with type=reasoning → skipped (thinking tokens)\n * - response_item with role=developer → skipped (system prompt)\n * - session_meta → source metadata (session_id, cwd, version, model)\n * - turn_context → model name extraction\n * - Duration is from first↔last event timestamp\n * - cost_usd is null (Codex CLI does not report per-session cost)\n * - Token usage not available from rollout format (rate limit info only)\n *\n * To add a new response_item type: add a case to the switch in parseCodexSession().\n */\n\nimport { normalizeToolCall } from '../evaluation/providers/normalize-tool-call.js';\nimport type { Message, ToolCall } from '../evaluation/providers/types.js';\nimport type { TranscriptEntry, TranscriptSource } from './types.js';\n\ninterface CodexLine {\n readonly timestamp?: string;\n readonly type: string;\n readonly payload: Record<string, unknown>;\n}\n\nexport function parseCodexSession(jsonl: string): TranscriptEntry {\n const messages: Message[] = [];\n let sessionId = '';\n let cwd: string | undefined;\n let model: string | undefined;\n let version: string | undefined;\n let startTimestamp: string | undefined;\n let endTimestamp: string | undefined;\n\n // Track pending function calls by call_id\n const pendingCalls = new Map<string, { msgIdx: number; toolIdx: number }>();\n\n const lines = jsonl.split('\\n').filter((l) => l.trim().length > 0);\n\n for (const line of lines) {\n let entry: CodexLine;\n try {\n entry = JSON.parse(line) as CodexLine;\n } catch {\n continue;\n }\n\n if (!entry.type) continue;\n\n // Track timestamps for duration\n if (entry.timestamp) {\n if (!startTimestamp) startTimestamp = entry.timestamp;\n endTimestamp = entry.timestamp;\n }\n\n const payload = entry.payload ?? {};\n\n switch (entry.type) {\n case 'session_meta': {\n sessionId = String(payload.id ?? '');\n cwd = payload.cwd ? String(payload.cwd) : undefined;\n version = payload.cli_version ? String(payload.cli_version) : undefined;\n if (payload.model && !model) {\n model = String(payload.model);\n }\n break;\n }\n\n case 'turn_context': {\n if (payload.model && !model) {\n model = String(payload.model);\n }\n if (payload.cwd && !cwd) {\n cwd = String(payload.cwd);\n }\n break;\n }\n\n case 'response_item': {\n const itemType = String(payload.type ?? '');\n const role = String(payload.role ?? '');\n\n switch (itemType) {\n case 'message': {\n // Skip developer (system prompt) messages\n if (role === 'developer') break;\n\n const content = extractResponseItemContent(payload.content);\n if (role === 'user' && content) {\n messages.push({ role: 'user', content });\n } else if (role === 'assistant' && content) {\n messages.push({ role: 'assistant', content });\n }\n break;\n }\n\n case 'function_call': {\n const toolName = String(payload.name ?? '');\n const callId = String(payload.call_id ?? '');\n let input: unknown;\n if (typeof payload.arguments === 'string') {\n try {\n input = JSON.parse(payload.arguments);\n } catch {\n input = payload.arguments;\n }\n } else {\n input = payload.arguments;\n }\n\n const toolCall: ToolCall = normalizeToolCall('codex', {\n tool: toolName,\n input,\n id: callId,\n });\n const msgIdx = messages.length;\n messages.push({\n role: 'assistant',\n toolCalls: [toolCall],\n });\n\n if (callId) {\n pendingCalls.set(callId, { msgIdx, toolIdx: 0 });\n }\n break;\n }\n\n case 'custom_tool_call': {\n const toolName = String(payload.name ?? '');\n const callId = String(payload.call_id ?? '');\n let input: unknown;\n if (typeof payload.arguments === 'string') {\n try {\n input = JSON.parse(payload.arguments);\n } catch {\n input = payload.arguments;\n }\n } else {\n input = payload.arguments;\n }\n\n const toolCall: ToolCall = normalizeToolCall('codex', {\n tool: toolName,\n input,\n id: callId,\n });\n const msgIdx = messages.length;\n messages.push({\n role: 'assistant',\n toolCalls: [toolCall],\n });\n\n if (callId) {\n pendingCalls.set(callId, { msgIdx, toolIdx: 0 });\n }\n break;\n }\n\n case 'function_call_output':\n case 'custom_tool_call_output': {\n const callId = String(payload.call_id ?? '');\n const pending = pendingCalls.get(callId);\n if (pending) {\n const existingMsg = messages[pending.msgIdx];\n const existingCalls = [...(existingMsg.toolCalls ?? [])];\n existingCalls[pending.toolIdx] = {\n ...existingCalls[pending.toolIdx],\n output: payload.output,\n };\n messages[pending.msgIdx] = { ...existingMsg, toolCalls: existingCalls };\n pendingCalls.delete(callId);\n }\n break;\n }\n\n // Skip reasoning blocks (thinking tokens)\n case 'reasoning':\n break;\n }\n break;\n }\n\n // Skip event_msg types (task_started, task_complete, token_count, etc.)\n // They don't contain conversation content\n }\n }\n\n let durationMs: number | undefined;\n if (startTimestamp && endTimestamp) {\n durationMs = new Date(endTimestamp).getTime() - new Date(startTimestamp).getTime();\n }\n\n const source: TranscriptSource = {\n provider: 'codex',\n sessionId,\n cwd,\n startedAt: startTimestamp,\n model,\n version,\n };\n\n return {\n messages,\n source,\n // Codex rollout files don't include token counts (only rate limit info)\n tokenUsage: undefined,\n durationMs,\n costUsd: null,\n };\n}\n\n/**\n * Extract text content from a Codex response_item content array.\n * Content is typically: [{ type: \"input_text\"|\"output_text\", text: \"...\" }]\n */\nfunction extractResponseItemContent(content: unknown): string | undefined {\n if (typeof content === 'string') return content;\n if (!Array.isArray(content)) return undefined;\n\n const parts: string[] = [];\n for (const block of content) {\n if (typeof block === 'object' && block !== null) {\n const b = block as Record<string, unknown>;\n if (typeof b.text === 'string') {\n parts.push(b.text);\n }\n }\n }\n return parts.length > 0 ? parts.join('') : undefined;\n}\n","/**\n * Codex CLI session discovery.\n *\n * Scans ~/.codex/sessions/ for rollout JSONL files. Codex CLI stores sessions at:\n * ~/.codex/sessions/YYYY/MM/DD/rollout-<timestamp>-<uuid>.jsonl\n *\n * Sessions are returned sorted by modification time (most recent first).\n */\n\nimport { readdir, stat } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport path from 'node:path';\n\nexport interface CodexSession {\n /** UUID from the filename */\n readonly sessionId: string;\n /** Full path to the JSONL file */\n readonly filePath: string;\n /** Filename (e.g., rollout-2026-03-29T14-22-01-<uuid>.jsonl) */\n readonly filename: string;\n /** Last modification time */\n readonly updatedAt: Date;\n}\n\nexport interface CodexDiscoverOptions {\n /** Filter by date string (YYYY-MM-DD). */\n readonly date?: string;\n /** Maximum number of sessions to return (default: 10). */\n readonly limit?: number;\n /** Override the default ~/.codex/sessions directory. */\n readonly sessionsDir?: string;\n /** Return only the most recent session. */\n readonly latest?: boolean;\n}\n\nconst DEFAULT_SESSIONS_DIR = () => path.join(homedir(), '.codex', 'sessions');\n\nexport async function discoverCodexSessions(opts?: CodexDiscoverOptions): Promise<CodexSession[]> {\n const sessionsDir = opts?.sessionsDir ?? DEFAULT_SESSIONS_DIR();\n const limit = opts?.latest ? 1 : (opts?.limit ?? 10);\n\n const sessions: CodexSession[] = [];\n\n // Walk YYYY/MM/DD directory structure\n let yearDirs: string[];\n try {\n yearDirs = await readdir(sessionsDir);\n } catch {\n return [];\n }\n\n for (const year of yearDirs) {\n const yearPath = path.join(sessionsDir, year);\n let monthDirs: string[];\n try {\n monthDirs = await readdir(yearPath);\n } catch {\n continue;\n }\n\n for (const month of monthDirs) {\n const monthPath = path.join(yearPath, month);\n let dayDirs: string[];\n try {\n dayDirs = await readdir(monthPath);\n } catch {\n continue;\n }\n\n for (const day of dayDirs) {\n // Filter by date if specified\n if (opts?.date) {\n const dirDate = `${year}-${month}-${day}`;\n if (dirDate !== opts.date) continue;\n }\n\n const dayPath = path.join(monthPath, day);\n let files: string[];\n try {\n files = await readdir(dayPath);\n } catch {\n continue;\n }\n\n for (const file of files) {\n if (!file.startsWith('rollout-') || !file.endsWith('.jsonl')) continue;\n\n const filePath = path.join(dayPath, file);\n\n // Extract UUID from filename: rollout-<timestamp>-<uuid>.jsonl\n // UUID is the last segment before .jsonl\n const nameWithoutExt = file.replace(/\\.jsonl$/, '');\n const parts = nameWithoutExt.split('-');\n // UUID is typically the last 5 hyphen-separated segments (standard UUID format)\n const sessionId = parts.length >= 6 ? parts.slice(-5).join('-') : nameWithoutExt;\n\n let updatedAt: Date;\n try {\n const fileStat = await stat(filePath);\n updatedAt = fileStat.mtime;\n } catch {\n updatedAt = new Date(0);\n }\n\n sessions.push({ sessionId, filePath, filename: file, updatedAt });\n }\n }\n }\n }\n\n sessions.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());\n return sessions.slice(0, limit);\n}\n","/**\n * Claude Code session discovery.\n *\n * Scans ~/.claude/projects/ for session JSONL files. Claude Code stores\n * sessions at:\n * ~/.claude/projects/<encoded-project-path>/<uuid>.jsonl\n *\n * Where <encoded-project-path> is the absolute project path with `/` replaced\n * by `-` and prefixed with `-` (e.g., `-home-user-myproject`).\n *\n * Sessions are returned sorted by modification time (most recent first).\n */\n\nimport { readdir, stat } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport path from 'node:path';\n\nexport interface ClaudeSession {\n /** UUID of the session */\n readonly sessionId: string;\n /** Full path to the JSONL file */\n readonly filePath: string;\n /** Encoded project directory name */\n readonly projectDir: string;\n /** Last modification time */\n readonly updatedAt: Date;\n}\n\nexport interface ClaudeDiscoverOptions {\n /** Filter by session UUID (exact match). */\n readonly sessionId?: string;\n /** Filter by project path (substring match against encoded dir name). */\n readonly projectPath?: string;\n /** Maximum number of sessions to return (default: 10). */\n readonly limit?: number;\n /** Override the default ~/.claude/projects directory. */\n readonly projectsDir?: string;\n /** Return only the most recent session. */\n readonly latest?: boolean;\n}\n\nconst DEFAULT_PROJECTS_DIR = () => path.join(homedir(), '.claude', 'projects');\n\n/**\n * Encode a filesystem path to Claude Code's project directory format.\n * `/home/user/myproject` → `-home-user-myproject`\n */\nfunction encodeProjectPath(projectPath: string): string {\n return projectPath.replace(/\\//g, '-');\n}\n\nexport async function discoverClaudeSessions(\n opts?: ClaudeDiscoverOptions,\n): Promise<ClaudeSession[]> {\n const projectsDir = opts?.projectsDir ?? DEFAULT_PROJECTS_DIR();\n const limit = opts?.latest ? 1 : (opts?.limit ?? 10);\n\n let projectDirs: string[];\n try {\n projectDirs = await readdir(projectsDir);\n } catch {\n return [];\n }\n\n // Filter project directories if projectPath is specified\n if (opts?.projectPath) {\n const encoded = encodeProjectPath(opts.projectPath);\n projectDirs = projectDirs.filter((dir) => dir === encoded || dir.includes(encoded));\n }\n\n const sessions: ClaudeSession[] = [];\n\n for (const projectDir of projectDirs) {\n const dirPath = path.join(projectsDir, projectDir);\n\n let entries: string[];\n try {\n entries = await readdir(dirPath);\n } catch {\n continue;\n }\n\n for (const entry of entries) {\n if (!entry.endsWith('.jsonl')) continue;\n\n const sessionId = entry.replace(/\\.jsonl$/, '');\n\n // Filter by session ID if specified\n if (opts?.sessionId && sessionId !== opts.sessionId) continue;\n\n const filePath = path.join(dirPath, entry);\n\n let updatedAt: Date;\n try {\n const fileStat = await stat(filePath);\n updatedAt = fileStat.mtime;\n } catch {\n updatedAt = new Date(0);\n }\n\n sessions.push({\n sessionId,\n filePath,\n projectDir,\n updatedAt,\n });\n }\n }\n\n // Sort by modification time, most recent first\n sessions.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());\n\n return sessions.slice(0, limit);\n}\n","/**\n * Core types for the transcript import pipeline.\n *\n * A TranscriptEntry is the internal (camelCase) representation of a parsed\n * session. A TranscriptJsonLine is the on-disk (snake_case) wire format\n * written to .agentv/transcripts/*.jsonl files.\n *\n * Flow:\n * raw session JSONL → parser → TranscriptEntry (internal)\n * TranscriptEntry → toTranscriptJsonLines() → JSONL on disk\n * JSONL on disk → readTranscriptJsonl() → TranscriptJsonLine[]\n *\n * To add a new importer: write a parser that returns TranscriptEntry,\n * then use toTranscriptJsonLines() to serialize.\n */\n\nimport { readFile } from 'node:fs/promises';\n\nimport { toCamelCaseDeep, toSnakeCaseDeep } from '../evaluation/case-conversion.js';\nimport type { Message, ProviderTokenUsage } from '../evaluation/providers/types.js';\n\n/**\n * A parsed transcript: ordered messages plus session metadata (internal camelCase).\n */\nexport interface TranscriptEntry {\n readonly messages: Message[];\n readonly source: TranscriptSource;\n readonly tokenUsage?: ProviderTokenUsage;\n readonly durationMs?: number;\n readonly costUsd?: number | null;\n}\n\n/**\n * Metadata describing the origin of a transcript (internal camelCase).\n */\nexport interface TranscriptSource {\n readonly provider: string;\n readonly sessionId: string;\n readonly projectPath?: string;\n readonly startedAt?: string;\n readonly model?: string;\n readonly version?: string;\n readonly gitBranch?: string;\n readonly cwd?: string;\n}\n\n/**\n * One line in a transcript JSONL file (snake_case wire format).\n *\n * Each line captures one message within an ordered per-test transcript.\n * Consumers group all rows with the same `test_id` into a replayable session.\n */\nexport interface TranscriptJsonLine {\n readonly test_id: string;\n readonly target: string;\n readonly message_index: number;\n readonly role: string;\n readonly name?: string;\n readonly content?: unknown;\n readonly tool_calls?: readonly Record<string, unknown>[];\n readonly start_time?: string;\n readonly end_time?: string;\n readonly duration_ms?: number;\n readonly metadata?: Record<string, unknown>;\n readonly token_usage?: {\n readonly input: number;\n readonly output: number;\n readonly cached?: number;\n readonly reasoning?: number;\n };\n readonly transcript_token_usage?: {\n readonly input: number;\n readonly output: number;\n readonly cached?: number;\n readonly reasoning?: number;\n };\n readonly transcript_duration_ms?: number;\n readonly transcript_cost_usd?: number | null;\n readonly source: {\n readonly provider: string;\n readonly session_id: string;\n readonly model?: string;\n readonly timestamp?: string;\n readonly git_branch?: string;\n readonly cwd?: string;\n readonly version?: string;\n };\n}\n\n/**\n * Grouped replayable transcript reconstructed from per-message rows.\n */\nexport interface TranscriptReplayEntry {\n readonly testId: string;\n readonly target: string;\n readonly messages: readonly Message[];\n readonly tokenUsage?: ProviderTokenUsage;\n readonly durationMs?: number;\n readonly costUsd?: number | null;\n readonly source: TranscriptSource;\n}\n\n/**\n * Convert a parsed TranscriptEntry to per-message JSONL rows.\n */\nexport function toTranscriptJsonLines(\n entry: TranscriptEntry,\n options?: { testId?: string; target?: string },\n): TranscriptJsonLine[] {\n const source = {\n provider: entry.source.provider,\n session_id: entry.source.sessionId,\n model: entry.source.model,\n timestamp: entry.source.startedAt,\n git_branch: entry.source.gitBranch,\n cwd: entry.source.cwd ?? entry.source.projectPath,\n version: entry.source.version,\n };\n const transcriptTokenUsage = entry.tokenUsage\n ? {\n input: entry.tokenUsage.input,\n output: entry.tokenUsage.output,\n cached: entry.tokenUsage.cached,\n reasoning: entry.tokenUsage.reasoning,\n }\n : undefined;\n const testId = options?.testId ?? entry.source.sessionId;\n const target = options?.target ?? entry.source.provider;\n\n return entry.messages.map((message, index) => ({\n test_id: testId,\n target,\n message_index: index,\n ...(toSnakeCaseDeep(message) as Omit<\n TranscriptJsonLine,\n | 'test_id'\n | 'target'\n | 'message_index'\n | 'source'\n | 'transcript_token_usage'\n | 'transcript_duration_ms'\n | 'transcript_cost_usd'\n >),\n transcript_token_usage: transcriptTokenUsage,\n transcript_duration_ms: entry.durationMs,\n transcript_cost_usd: entry.costUsd,\n source,\n }));\n}\n\nfunction buildReplayMessage(line: TranscriptJsonLine): Message {\n const camelCased = toCamelCaseDeep(line) as {\n role: string;\n name?: string;\n content?: Message['content'];\n toolCalls?: Message['toolCalls'];\n startTime?: string;\n endTime?: string;\n durationMs?: number;\n metadata?: Record<string, unknown>;\n tokenUsage?: ProviderTokenUsage;\n };\n\n return {\n role: camelCased.role,\n name: camelCased.name,\n content: camelCased.content,\n toolCalls: camelCased.toolCalls,\n startTime: camelCased.startTime,\n endTime: camelCased.endTime,\n durationMs: camelCased.durationMs,\n metadata: camelCased.metadata,\n tokenUsage: camelCased.tokenUsage,\n };\n}\n\n/**\n * Group per-message transcript rows back into replayable conversations.\n */\nexport function groupTranscriptJsonLines(\n lines: readonly TranscriptJsonLine[],\n): TranscriptReplayEntry[] {\n const grouped = new Map<\n string,\n {\n target: string;\n tokenUsage?: ProviderTokenUsage;\n durationMs?: number;\n costUsd?: number | null;\n source: TranscriptSource;\n messages: { index: number; message: Message }[];\n }\n >();\n\n for (const line of lines) {\n const existing = grouped.get(line.test_id);\n const source: TranscriptSource = {\n provider: line.source.provider,\n sessionId: line.source.session_id,\n startedAt: line.source.timestamp,\n model: line.source.model,\n gitBranch: line.source.git_branch,\n cwd: line.source.cwd,\n version: line.source.version,\n };\n const transcriptTokenUsage = line.transcript_token_usage\n ? {\n input: line.transcript_token_usage.input,\n output: line.transcript_token_usage.output,\n cached: line.transcript_token_usage.cached,\n reasoning: line.transcript_token_usage.reasoning,\n }\n : undefined;\n\n if (existing) {\n existing.messages.push({ index: line.message_index, message: buildReplayMessage(line) });\n continue;\n }\n\n grouped.set(line.test_id, {\n target: line.target,\n tokenUsage: transcriptTokenUsage,\n durationMs: line.transcript_duration_ms,\n costUsd: line.transcript_cost_usd,\n source,\n messages: [{ index: line.message_index, message: buildReplayMessage(line) }],\n });\n }\n\n return [...grouped.entries()].map(([testId, entry]) => ({\n testId,\n target: entry.target,\n tokenUsage: entry.tokenUsage,\n durationMs: entry.durationMs,\n costUsd: entry.costUsd,\n source: entry.source,\n messages: entry.messages\n .sort((first, second) => first.index - second.index)\n .map((item) => item.message),\n }));\n}\n\n/**\n * Read a transcript JSONL file and parse each line into a TranscriptJsonLine.\n */\nexport async function readTranscriptJsonl(filePath: string): Promise<TranscriptJsonLine[]> {\n const text = await readFile(filePath, 'utf8');\n return text\n .split('\\n')\n .filter((line) => line.trim().length > 0)\n .map((line) => JSON.parse(line) as TranscriptJsonLine);\n}\n\n/**\n * Read a JSONL transcript file and return its raw text.\n * Throws if the file does not exist or cannot be read.\n */\nexport async function readTranscriptFile(filePath: string): Promise<string> {\n return readFile(filePath, 'utf8');\n}\n","/**\n * Transcript provider — replays pre-recorded session transcripts through the\n * evaluation pipeline without invoking any live agent.\n *\n * Used by `agentv eval --transcript <file>` to grade imported sessions.\n *\n * How it works:\n * 1. Reads a transcript JSONL file (produced by `agentv import`)\n * 2. Each invocation pops the next line from the transcript\n * 3. Returns a ProviderResponse with pre-populated output, token usage, etc.\n * 4. Graders run identically to live eval — they see the same ProviderResponse\n *\n * The provider name in results is set to the source provider from the transcript\n * (e.g., \"claude\", \"codex\", \"copilot\").\n */\n\nimport type { Provider, ProviderRequest, ProviderResponse } from '../evaluation/providers/types.js';\nimport type { TranscriptReplayEntry } from './types.js';\nimport { groupTranscriptJsonLines, readTranscriptJsonl } from './types.js';\n\nexport class TranscriptProvider implements Provider {\n readonly id: string;\n readonly kind = 'transcript' as const;\n readonly targetName: string;\n\n private entries: TranscriptReplayEntry[];\n private cursor = 0;\n\n constructor(targetName: string, entries: TranscriptReplayEntry[]) {\n this.targetName = targetName;\n this.id = `transcript:${targetName}`;\n this.entries = entries;\n }\n\n /**\n * Create a TranscriptProvider from a JSONL file path.\n */\n static async fromFile(filePath: string): Promise<TranscriptProvider> {\n const lines = await readTranscriptJsonl(filePath);\n if (lines.length === 0) {\n throw new Error(`Transcript file is empty: ${filePath}`);\n }\n const entries = groupTranscriptJsonLines(lines);\n const providerName = entries[0]?.source.provider ?? 'transcript';\n return new TranscriptProvider(providerName, entries);\n }\n\n get lineCount(): number {\n return this.entries.length;\n }\n\n async invoke(_request: ProviderRequest): Promise<ProviderResponse> {\n if (this.cursor >= this.entries.length) {\n throw new Error(\n `Transcript exhausted: ${this.entries.length} entr${this.entries.length === 1 ? 'y' : 'ies'} available but ` +\n `${this.cursor + 1} invocations attempted. Each transcript entry maps to one test case.`,\n );\n }\n\n const entry = this.entries[this.cursor++];\n\n return {\n output: entry.messages,\n tokenUsage: entry.tokenUsage\n ? {\n input: entry.tokenUsage.input,\n output: entry.tokenUsage.output,\n cached: entry.tokenUsage.cached,\n reasoning: entry.tokenUsage.reasoning,\n }\n : undefined,\n durationMs: entry.durationMs,\n costUsd: entry.costUsd ?? undefined,\n startTime: entry.source.startedAt,\n };\n }\n}\n","export * from './evaluation/content.js';\nexport * from './evaluation/types.js';\nexport * from './evaluation/trace.js';\nexport * from './evaluation/yaml-parser.js';\nexport {\n isAgentSkillsFormat,\n parseAgentSkillsEvals,\n} from './evaluation/loaders/agent-skills-parser.js';\nexport {\n loadConfig,\n type AgentVConfig as AgentVYamlConfig,\n type ResultsExportConfig,\n} from './evaluation/loaders/config-loader.js';\nexport {\n loadTsEvalFile,\n type TsEvalResult,\n} from './evaluation/loaders/ts-eval-loader.js';\nexport {\n transpileEvalYaml,\n transpileEvalYamlFile,\n getOutputFilenames,\n} from './evaluation/loaders/eval-yaml-transpiler.js';\nexport type {\n EvalsJsonCase,\n EvalsJsonFile,\n TranspileResult,\n} from './evaluation/loaders/eval-yaml-transpiler.js';\nexport * from './evaluation/file-utils.js';\nexport * from './evaluation/providers/index.js';\nexport * from './evaluation/graders.js';\nexport * from './evaluation/orchestrator.js';\nexport {\n evaluate,\n type AssertEntry,\n type ConversationTurnInput,\n type EvalConfig,\n type EvalTestInput,\n type EvalAssertionInput,\n type EvalRunResult,\n type EvalSummary,\n} from './evaluation/evaluate.js';\nexport type {\n AssertContext,\n AssertFn,\n AssertResult,\n} from './evaluation/assertions.js';\nexport {\n defineConfig,\n loadTsConfig,\n type AgentVConfig as AgentVTsConfig,\n} from './evaluation/config.js';\nexport * from './evaluation/generators/index.js';\nexport * from './evaluation/workspace/index.js';\nexport {\n ResponseCache,\n shouldEnableCache,\n shouldSkipCacheForTemperature,\n} from './evaluation/cache/response-cache.js';\nexport { toSnakeCaseDeep, toCamelCaseDeep } from './evaluation/case-conversion.js';\nexport {\n ensureResultsRepoClone,\n syncResultsRepo,\n getResultsRepoCachePaths,\n getResultsRepoStatus,\n normalizeResultsExportConfig,\n resolveResultsRepoRunsDir,\n resolveResultsRepoUrl,\n prepareResultsRepoBranch,\n checkoutResultsRepoBranch,\n stageResultsArtifacts,\n directorySizeBytes,\n commitAndPushResultsBranch,\n pushResultsRepoBranch,\n createDraftResultsPr,\n type CheckedOutResultsRepoBranch,\n type PreparedResultsRepoBranch,\n type ResultsRepoCachePaths,\n type ResultsRepoStatus,\n} from './evaluation/results-repo.js';\nexport {\n getAgentvConfigDir,\n getAgentvHome,\n getWorkspacesRoot,\n getSubagentsRoot,\n getTraceStateRoot,\n getWorkspacePoolRoot,\n} from './paths.js';\nexport {\n type BenchmarkEntry,\n type BenchmarkRegistry,\n loadBenchmarkRegistry,\n saveBenchmarkRegistry,\n addBenchmark,\n removeBenchmark,\n getBenchmark,\n touchBenchmark,\n discoverBenchmarks,\n deriveBenchmarkId,\n getBenchmarksRegistryPath,\n} from './benchmarks.js';\nexport { trimBaselineResult } from './evaluation/baseline.js';\nexport { DEFAULT_CATEGORY, deriveCategory } from './evaluation/category.js';\nexport * from './observability/index.js';\n\n// Registry exports\nexport {\n GraderRegistry,\n DeterministicAssertionGrader,\n} from './evaluation/registry/grader-registry.js';\nexport type {\n GraderDispatchContext,\n GraderFactoryFn,\n} from './evaluation/registry/grader-registry.js';\nexport { createBuiltinRegistry } from './evaluation/registry/builtin-graders.js';\nexport { discoverAssertions } from './evaluation/registry/assertion-discovery.js';\nexport {\n runContainsAssertion,\n runContainsAnyAssertion,\n runContainsAllAssertion,\n runIcontainsAssertion,\n runIcontainsAnyAssertion,\n runIcontainsAllAssertion,\n runStartsWithAssertion,\n runEndsWithAssertion,\n runRegexAssertion,\n runIsJsonAssertion,\n runEqualsAssertion,\n type AssertionResult,\n} from './evaluation/graders/assertions.js';\nexport { discoverGraders } from './evaluation/registry/grader-discovery.js';\n\n// Import pipeline\nexport * from './import/index.js';\n\nexport type AgentKernel = {\n status: string;\n};\n\nexport function createAgentKernel(): AgentKernel {\n return { status: 'stub' };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AASA,SAAS,oBAAoB;AAC7B,OAAO,UAAU;AACjB,SAAS,aAAa;AGMtB,SAAS,gBAAgB;AACzB,OAAOA,WAAU;AACjB,SAAS,SAAAC,cAAa;AClBtB,SAAS,OAAO,YAAAC,WAAU,iBAAiB;AAC3C,OAAOF,WAAU;ACFjB,SAAS,gBAAgB;AACzB,SAAS,YAAY,WAAW,gBAAAG,eAAc,QAAQ,qBAAqB;AAC3E,SAAS,IAAI,SAAS,SAAS,IAAI,YAAY;AAC/C,OAAO,QAAQ;AACf,OAAOH,WAAU;AACjB,SAAS,iBAAiB;ACa1B;EACE;EACA,cAAAI;EACA,aAAAC;EACA,gB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AI;QACR,yBAAyB,KAAK,QAAQ,MAAM,QAAQ,KAAK,QAAQ,WAAW,IAAI,MAAM,KAAK,kBACtF,KAAK,SAAS,CAAC;MACtB;IACF;AAEA,UAAM,QAAQ,KAAK,QAAQ,KAAK,QAAQ;AAExC,WAAO;MACL,QAAQ,MAAM;MACd,YAAY,MAAM,aACd;QACE,OAAO,MAAM,WAAW;QACxB,QAAQ,MAAM,WAAW;QACzB,QAAQ,MAAM,WAAW;QACzB,WAAW,MAAM,WAAW;MAC9B,IACA;MACJ,YAAY,MAAM;MAClB,SAAS,MAAM,WAAW;MAC1B,WAAW,MAAM,OAAO;IAC1B;EACF;AACF;AC8DO,SAAS,oBAAiC;AAC/C,SAAO,EAAE,QAAQ,OAAO;AAC1B;","names":["path","parse","readFile","readFileSync","existsSync","mkdirSync","writeFileSync","readdir","stat","homedir","noSkillFile","z","OtlpJsonFileExporter","parentCtx"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{ts-eval-loader-XFQ6S4DT-S7P2UUBX.js.map → ts-eval-loader-32COE32J-TCT4RIRT.js.map}
RENAMED
|
File without changes
|