/** * Reading a dropped `route --json` verdict, so quality can stand beside cost. * * The bill is arithmetic: every figure in it comes from records already on * disk, and it can say exactly what a cheaper model would have saved. It can * say nothing at all about whether that model still does the job. That answer * costs provider calls and a credential, which is why `trazum route` exists * and why no surface that only reads a log will ever produce it. * * This is the bridge between the two, and it is deliberately one-directional: * the measurement is made where the credential is, written out as the * `routing-measurement` contract, and read back here by a pure function that * touches no network and holds no key. A reader who has run `route` once can * carry the verdict to any surface that prices the same workload. * * It was not possible to write until the document was worth reading. Before * the JSON-text sweep, `route --json` printed the whole `EvalReport` — every * case input and three model answers per case — so a bridge would have been a * feature for carrying prompt text into a browser. The document carries the * measurement and nothing else now, and `conform` is what says so rather than * this file's own reading: the contract validates, the bridge only maps. */ import type { EvalVerdict } from './evaluate.js'; /** What a dropped routing measurement says, mapped onto what a bill can match. */ export interface DroppedVerdict { /** The workload the measurement was made on, or null when it was unlabelled. */ label: string | null; /** * The model those calls go to today, from the bill's own slice. * * Not the model that answered. `route` builds its baseline provider from * the environment, so the model in the measurement is whatever * `TRAZUM_LLM_MODEL` names, and it is only the log's model when the reader * configured it that way. Pairing on it matched nothing on a real run * against an OpenAI-compatible endpoint — `evaluation.model` said * `stub-strong` while the log said `claude-opus-5` — and the bill would * have shown no verdict at all with no explanation. */ model: string; /** * The model that actually answered, when it is not the one the log records. * * Null when they agree, which is the ordinary case. Not null is worth * saying out loud rather than smoothing over: a verdict measured on a * stand-in is a weaker claim about this workload than one measured on the * model the workload actually uses, and only this field can tell the * difference. */ measuredOn: string | null; /** The model measured against it. */ candidateModel: string; verdict: EvalVerdict; /** The model's agreement with itself. The yardstick the other rate is read against. */ selfAgreement: number; /** Agreement between the two models, same prompt on both sides. */ crossAgreement: number; /** Cases the measurement covered, so a two-case verdict cannot pose as a hundred. */ cases: number; /** Calls it cost to reach. */ callsMade: number; /** * What the measurement's own bill priced the route at, when the document * carried it. Null rather than zero when it did not: a saving nobody * measured is not a saving of nothing. */ savingUsd: number | null; } /** * What the bridge did with a file. * * `null` is not a failure: it means the file is not a routing measurement at * all, and the caller should go on treating it as whatever else it was. A * refusal is the other case — it looked like one and could not be read — and * it names what is missing, because a refusal with nothing after it is * indistinguishable from a bug. */ export type BridgeReading = { kind: 'verdict'; verdict: DroppedVerdict; } | { kind: 'refusal'; because: string; }; /** * Reads a dropped `trazum route --json` document. * * Returns null when the text is something else entirely. Validation is * `conform`'s, against the published `routing-measurement` contract, so this * function cannot drift from the schema a connector author builds against — * and a document that fails carries the contract's own sentences back to the * reader rather than a second opinion written here. */ export declare function readDroppedVerdict(text: string): BridgeReading | null; /** * Whether a verdict describes the route a given slice of the bill is offering. * * Both halves must agree or the pairing is a lie: the same workload, the same * model it goes to now, and the same candidate. A verdict measured on `chat` * shown against `summarise`'s saving would be the exact fault this repository * keeps finding in itself — a number describing something other than what was * measured — and matching on the model alone would produce it on any log with * two workloads on one model. */ export declare function verdictMatchesSlice(verdict: DroppedVerdict, slice: { label: string; model: string; route: { candidate: { id: string; }; } | null; }): boolean; //# sourceMappingURL=verdict-bridge.d.ts.map