/** * Did it work? — the plan held to the log that came after it. * * Every optimisation tool says what you *would* save; almost none says what * you *did*. This module takes a saved plan and a newer report and answers * per action, with **three outcomes and never two**: the change arrived, the * change did not arrive, or *it cannot be told* — because the workload * vanished, the fields the detection needs stopped being recorded, or the * log simply cannot see the thing (tokens do not say which tier billed * them). The third outcome is the honest one, and the one every other tool * renders as the first. * * **Differences are attributed, not just stated.** A predicted saving that * did not appear in the bill is decomposed against the plan's recorded * baseline: the calls moved, the output per call moved, the input per call * moved — measured ratios with names, never a single number that blames * nobody. And a plan priced under one catalogue verified under another says * so: the tool must not blame a team for a saving that arithmetic revoked. * * Browser-safe like everything here: two documents in, one verdict out. */ import type { UsageProfileReport } from './usage.js'; import type { PlanAction, PlanDocument } from './plan.js'; export type VerifyOutcome = 'arrived' | 'not-arrived' | 'cannot-tell'; /** * Why an action cannot be told. The distinction matters to the gate: a * workload that vanished is the world's doing; a log that stopped recording * the fields the detection needs is the team's, and "not recorded" must not * read as "fixed". */ export type CannotTellReason = 'workload-vanished' | 'fields-stopped' | 'tier-not-recorded'; export interface VerifiedAction { /** The plan's action, verbatim — the prediction being judged. */ action: PlanAction; outcome: VerifyOutcome; reason: CannotTellReason | null; /** * What the newer log measured for this slice, per kind: where the money * sits now, the new retry bill, the new cache delta. Keys are stable. */ observed: Record; /** * The world's movement between the two logs, from the plan's recorded * baseline: never a verdict, always the measured before and after. */ attribution: { calls?: { before: number; after: number; }; inputPerCallTokens?: { before: number; after: number; }; outputPerCallTokens?: { before: number; after: number; }; } | null; /** * Whether this action fails `--gate`. `not-arrived` always does; * `cannot-tell` does only for `fields-stopped` — a team that degraded its * own log must not pass the gate on the strength of the silence. A * vanished workload and an unrecordable tier fail nothing. */ gateFailing: boolean; } export interface PlanVerification { schemaVersion: 1; /** When the plan was made, when it carries the stamp. */ planCreatedAt: string | null; /** The catalogue that priced the plan, and the one pricing this check. */ planPricing: string; currentPricing: string; /** * True when those differ: every dollar comparison here is then two * measurements under two price lists, and the rendering must say so * rather than let a repricing read as a team's failure. */ pricesChanged: boolean; actions: VerifiedAction[]; arrived: number; notArrived: number; cannotTell: number; gateFailures: number; } export declare function verifyPlan(plan: PlanDocument & { createdAt?: string; }, report: UsageProfileReport, options: { currentPricingLastReviewed: string; }): PlanVerification; //# sourceMappingURL=verify.d.ts.map