import { z } from "zod";

/** Session summary appended to data/metadata/sessions.jsonl after every run. */
export const SessionLog = z.object({
  sessionId: z.string(),
  command: z.string(),
  modelId: z.string(),
  stage: z.enum(["stage1", "stage2-judge", "benchmark"]),
  promptVersion: z.string(),
  startedAt: z.iso.datetime(),
  endedAt: z.iso.datetime(),
  durationSeconds: z.number(),
  paragraphsTotal: z.number().int(),
  paragraphsProcessed: z.number().int(),
  paragraphsSkippedResume: z.number().int(),
  paragraphsErrored: z.number().int(),
  costUsd: z.number(),
  reasoningTokensTotal: z.number().int(),
  avgLatencyMs: z.number(),
  p95LatencyMs: z.number(),
  throughputPerMinute: z.number(),
  concurrency: z.number().int(),
  exitReason: z.enum([
    "complete",
    "interrupted",
    "budget_exhausted",
    "error_threshold",
  ]),
});
export type SessionLog = z.infer<typeof SessionLog>;
