/** * Personal token-value scorecard (Spec 25 Q2). Turns paired WITH/WITHOUT cells * into the honest "does it help on YOUR repo?" verdict — the same metrics the * README Value Scorecard publishes (cost + round-trips at equal correctness), * measured locally. Pure + deterministic. */ import type { Cell } from './measure.js'; export type Verdict = 'helps' | 'break-even' | "doesn't help here"; /** * How the scorecard's numbers were produced: * - `measured` — a real WITH/WITHOUT agent pass (the `claude` arm). * - `estimate` — a deterministic, graph-derived proxy (no agent, no API key). * - `dry-run` — synthetic numbers from `--dry-run` (pipeline check only). * The mode travels with every serialized/rendered form so an estimate can never * be mistaken for a measured result (decision 66feae62). */ export type ProveMode = 'measured' | 'estimate' | 'dry-run'; /** Run-level provenance stamped onto a scorecard at command time. */ export interface ScorecardMeta { mode: ProveMode; /** ISO-8601 timestamp, stamped by the CLI (not the pure core). */ generatedAt: string; /** Short repo SHA the run was measured against, or null if unavailable. */ repoSha: string | null; /** Agent model for a measured/dry-run pass; null for an estimate. */ model: string | null; /** Number of orientation tasks the scorecard covers. */ tasks: number; } export interface Scorecard { costWithout: number; costWith: number; costDeltaPct: number; turnsWithout: number; turnsWith: number; turnsDeltaPct: number; correctWithout: number; correctWith: number; freshWithout: number; freshWith: number; /** * Independent samples per arm = tasks × runs (each task-run is one agent * invocation). NOT the `--runs` value, which is per-task; divide by * `meta.tasks` for runs-per-task. Named honestly so the JSON contract doesn't * claim "runs" when it means "samples". */ samplesPerArm: number; verdict: Verdict; } /** * Verdict rule, deliberately conservative and honest: * - if WITH is less correct than WITHOUT → "doesn't help here" (never trade accuracy) * - else if cost AND round-trips both improve by >5% → "helps" * - else if either regresses by >5% → "doesn't help here" * - otherwise → "break-even" */ export declare function verdict(sc: Omit): Verdict; export declare function computeScorecard(without: Cell, withCell: Cell): Scorecard; /** * Render the scorecard as a human-readable block for the terminal. `mode` * selects the banner and whether the noisy-sample caveat applies (it never does * for a deterministic `estimate`). Back-compat: `mock: true` still forces the * dry-run banner when `mode` is omitted. */ export declare function renderScorecard(sc: Scorecard, opts: { tasks: number; mock?: boolean; mode?: ProveMode; }): string; /** * Stable, documented JSON shape for `openlore prove --json` — an external/CI * contract (decision 581a90bf). `schemaVersion` gates the format; new fields * append without a bump. The key set is asserted in tests so it cannot drift. */ export interface SerializedScorecard { schemaVersion: 1; mode: ProveMode; generatedAt: string; repo: { sha: string | null; }; model: string | null; /** Independent samples per arm = tasks × runs (divide by `tasks` for runs-per-task). */ samplesPerArm: number; tasks: number; cost: { without: number; with: number; deltaPct: number; }; roundTrips: { without: number; with: number; deltaPct: number; }; freshTokens: { without: number; with: number; }; correctness: { without: number; with: number; }; verdict: Verdict; } /** * Round to 4 decimals (sub-cent) so the JSON contract carries no float noise, * and coerce a non-finite value (NaN/±Infinity — e.g. if a malformed agent JSON * ever yields a non-numeric cost) to 0 so it never serializes as `null` in a * field the schema declares `number`. */ export declare const money: (n: number) => number; /** Serialize a scorecard + run metadata into the stable `--json` shape. */ export declare function serializeScorecard(sc: Scorecard, meta: ScorecardMeta): SerializedScorecard; /** * Paste-ready markdown block matching the README Value Scorecard shape — wins and * losses both shown, honest verdict, plus a shields.io badge line a user can drop * into their own README. Same honest verdict as the terminal render. */ export declare function renderScorecardMarkdown(sc: Scorecard, meta: ScorecardMeta): string; /** * shields.io static badge URL summarizing the run by its headline signal * (round-trips Δ — the most consistent, hardest-to-game metric). Estimate/dry-run * runs are labeled as such in the badge so a shared badge never overclaims. */ export declare function scorecardBadgeUrl(sc: Scorecard, meta: ScorecardMeta): string; /** Markdown image for the badge (paste-ready). */ export declare function scorecardBadgeMarkdown(sc: Scorecard, meta: ScorecardMeta): string; //# sourceMappingURL=scorecard.d.ts.map