// A TRANSPARENT RUN's shapes (plans/umtool-redesign.md, R3): what // /research/runs/
/ and GET /api/research/runs/
/ show of // one sweep run -- read from its trace.jsonl, or projected from turns.jsonl for // a run made before the trace (lib/research/runs-view.ts). Types only: safe // for a client component. export type RunCite = { citation?: string; kind?: string; channel?: string; video?: string; start?: number; end?: number; url?: string; label?: string; quote?: string; }; /** One quote check: kept, refused (a later round may fix it), or dropped, with why. */ export type RunCheck = { quote: string; cite: RunCite; ok: boolean; reason: string | null; /** extract (the pipeline's window check) · check (a strict round) · strict · drop · final (kept). */ stage: string; dropped: boolean; claim: string | null; round: number | null; }; export type RunFinding = { section: string; claim: string; cites: RunCite[] }; /** A tool call a turn made (the turns projection: its input in a line). */ export type RunCall = { name: string; summary: string; chars: number | null; error: boolean }; export type RunEnumeration = { query: string; n: number; ids: string[]; partial: boolean; unreached: string[]; total: number | null; posts: number; }; export type RunBatch = { k: number; of: number | null; ids: string[]; /** The extractor's own lines; null when the run kept none (before the trace). */ lines: string[] | null; model: string | null; usd: number | null; cut: boolean; }; export type RunStepKind = "scope" | "terms" | "turn" | "enumerate" | "batch" | "group" | "findings" | "checks" | "end" | "triage"; /** R6: the triage a sweep escalated (its trace's `triage` line): the tiers before this run. */ export type RunTriage = { owner: string; k: number; /** The triage run's page (`/series//triage/`). */ href: string; candidates: string[]; flagged: string[]; dismissed: number; escalated: boolean; why: string | null; model: string | null; cost: { tier0: number; tier1: number } | null; }; export type RunStep = { /** Stable within the run: `scope`, `t3`, `r0` (a repair turn), `e2`, `b1`, `checks` … */ id: string; kind: RunStepKind; /** The left column: `t3`, `b1`, or `—`. */ t: string; label: string; sub: string | null; /** The run's spend once this step was done (cumulative), when known. */ usd: number | null; /** This step's own spend, when known. */ stepUsd: number | null; /** Not recorded: the trace did not exist yet (an old run's quote checks). */ gap: boolean; detail: { /** Key / value rows (the scope, the end). */ facts: [string, string][]; /** The model's own words this turn. */ text: string | null; calls: RunCall[]; enumerations: RunEnumeration[]; batches: RunBatch[]; reads: { tool: string; ids: string[] }[]; checks: RunCheck[]; findings: RunFinding[]; notes: string[]; /** R6: the triage this sweep escalates (a `triage` step). */ triage?: RunTriage; }; }; /** One run of the iteration (a trace's or a turns file's run start). */ export type RunSummary = { index: number; startedAt: string | null; steps: number; usd: number | null; status: string | null }; export type RunCoverage = { matched: number; read: number; partial: boolean; unreached: string[] }; export type RunView = { article: string; n: number; /** `i3`. */ label: string; kind: string; /** The iteration's status (queued, running, done, failed, cancelled). */ status: string; /** The shown run is the iteration's last and it is still going: the page polls. */ live: boolean; /** trace: trace.jsonl; turns: projected from turns.jsonl (a run before R3); none: nothing recorded yet. */ from: "trace" | "turns" | "none"; runs: RunSummary[]; /** The run shown, 1-based. */ run: number; header: { question: string | null; title: string | null; task: string | null; model: string | null; extractor: string | null; channels: string[]; dateFrom: string | null; dateTo: string | null; sourceLabel: string | null; startedAt: string | null; endedAt: string | null; minutes: number | null; /** This run's spend. */ usd: number | null; /** The iteration's recorded spend (every run, as the usage says). */ iterationUsd: number; checks: { name: string; ok: boolean; detail: string | null }[]; coverage: RunCoverage | null; kept: number | null; dropped: number | null; /** Refused by a strict round (and then repaired or dropped). */ refused: number | null; seed: { chars: number } | null; error: string | null; summary: string | null; }; steps: RunStep[]; /** What the page must say about how this was read (several run starts, an untraced run). */ notes: string[]; /** The kept findings "Open as a board" makes quotes of (the iteration's report). */ findings: number; /** The run's board (`
-run`), when one was opened. */ board: { id: string; quotes: number } | null; };