{"version":3,"file":"report-json.mjs","names":[],"sources":["../../../../../../../ai/src/eval/report-json.ts"],"sourcesContent":["import type { EvalReport } from \"../contracts/agent/eval.type\";\n\n/**\n * Serialize an {@link EvalReport} to a pretty-printed JSON string — a\n * round-trippable snapshot suitable for committing as the next run's\n * baseline (`agent.eval({ baseline: fromJSON(...) })`).\n *\n * Pure. The whole report is emitted verbatim; `result` payloads,\n * per-case `scores`, timings, and any attached `regression` block are all\n * preserved, so a parsed report drives regression diffing exactly as the\n * in-memory one would.\n *\n * @example\n * await writeFile(\"./eval/baseline.json\", toJSON(report));\n */\nexport function toJSON(report: EvalReport): string {\n  return JSON.stringify(report, undefined, 2);\n}\n\n/**\n * Parse a string produced by {@link toJSON} back into an\n * {@link EvalReport}. The inverse of `toJSON` — `fromJSON(toJSON(r))`\n * reproduces `r`'s data (functions such as scorers were never part of the\n * serialized report, so the round-trip is over plain data only).\n *\n * @example\n * const baseline = fromJSON(await readFile(\"./eval/baseline.json\", \"utf8\"));\n */\nexport function fromJSON<TOutput = unknown>(serialized: string): EvalReport<TOutput> {\n  return JSON.parse(serialized) as EvalReport<TOutput>;\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,SAAgB,OAAO,QAA4B;CACjD,OAAO,KAAK,UAAU,QAAQ,QAAW,CAAC;AAC5C;;;;;;;;;;AAWA,SAAgB,SAA4B,YAAyC;CACnF,OAAO,KAAK,MAAM,UAAU;AAC9B"}