export type RowKind = "llm" | "tool" | "error" | "wait" | "reply"; export type PaperRow = { id: string; kind: RowKind; /** Minutes since the run began. */ minute: number; /** The one-line text the paper shows. */ text: string; /** Tool rows: the tool name and whether an identical call came before. */ tool?: string; repeated?: boolean; /** Error rows: the message. */ error?: string; /** Wait rows: seconds spent at the approval prompt. */ seconds?: number; /** Llm rows: input tokens the call sent. */ inputTokens?: number; }; export type Mark = { rowId: string; note: string; }; export type Check = { kind: "trace"; name: string; count: "toolCalls" | "errors" | "llmCalls"; where?: { tool?: string; repeated?: boolean; message?: string; }; max: number; } | { kind: "metric"; name: string; metric: "activeSeconds" | "llmCalls"; full: number; zero: number; } | { kind: "goal"; name: string; goal: string; mustPass: boolean; }; export type JudgeVerdict = { grader: string; score: number; reasoning: string; /** What the person said about the judge's verdict, once they said it. */ agreed: boolean | null; }; export type Mode = { kind: "paper"; } | { kind: "typing"; what: "note" | "verdict" | "goal" | "cap"; buffer: string; } | { kind: "judges"; cursor: number; } | { kind: "rules"; }; export type PaperState = { rows: PaperRow[]; cursor: number; /** The first row drawn; the paper scrolls to keep the cursor visible. */ top: number; marks: Mark[]; verdict: string; checks: Check[]; judges: JudgeVerdict[]; mode: Mode; message: string; done: boolean; }; export type PaperAction = { kind: "up"; } | { kind: "down"; } | { kind: "pageUp"; } | { kind: "pageDown"; } | { kind: "startNote"; } | { kind: "startVerdict"; } | { kind: "startGoal"; } | { kind: "unmark"; } | { kind: "makeRule"; } | { kind: "type"; text: string; } | { kind: "backspace"; } | { kind: "submit"; } | { kind: "cancel"; } | { kind: "openJudges"; } | { kind: "openRules"; } | { kind: "agree"; } | { kind: "disagree"; } | { kind: "back"; } | { kind: "quit"; }; type Event = { type: string; timestamp: string; [key: string]: unknown; }; /** One paper row per thing a teacher would mark: an LLM call, a tool call, * an error, a wait at the approval prompt, and the final reply. */ export declare function rowsFromEvents(events: Event[]): PaperRow[]; export declare function fmtSeconds(seconds: number): string; /** The check a mark on this row suggests. The teacher's X becomes a filter * and a bound; the note becomes the check's name. */ export declare function checkForMark(row: PaperRow, note: string): Check; /** The verdict at the bottom of the paper becomes the run's time cap. */ export declare function checkForVerdict(verdict: string, capSeconds: number): Check; export type CheckResult = { check: Check; score: number; detail: string; }; export declare function runCheck(check: Check, rows: PaperRow[]): CheckResult; /** Run time minus the waits at the prompt: what the guard clock would say. */ export declare function activeSeconds(rows: PaperRow[]): number; export declare function initialPaper(rows: PaperRow[], judges: JudgeVerdict[]): PaperState; export declare function markOn(state: PaperState, rowId: string): Mark | undefined; export declare function reducePaper(state: PaperState, action: PaperAction, pageRows: number): PaperState; /** Agreement per grader, over the verdicts the person has answered. */ export declare function agreement(judges: JudgeVerdict[]): { answered: number; agreed: number; }; export {};