import { z } from "zod"; import { LabelOutput } from "./label.ts"; /** Multi-model agreement result for a single paragraph. */ export const ConsensusResult = z.object({ paragraphId: z.uuid(), finalLabel: LabelOutput, method: z.enum(["unanimous", "majority", "judge-resolved", "unresolved"]), categoryAgreement: z.object({ votes: z.record(z.string(), z.number()), // category → count agreed: z.boolean(), }), specificityAgreement: z.object({ votes: z.record(z.string(), z.number()), // level → count agreed: z.boolean(), spread: z.number(), // max - min among votes }), stage1ModelIds: z.array(z.string()), stage2JudgeModelId: z.string().nullable(), confidence: z.number().min(0).max(1), }); export type ConsensusResult = z.infer;