import type { EvoPaths } from "./paths.ts"; import { type SessionDigestMetrics, type SessionTaskClass } from "./recorder/digest.ts"; import type { EvaluationArtifactRef, Proposal, TrialState } from "./types.ts"; export interface ComparisonRates { toolErrorRate: number | null; verificationPassRate: number | null; assistantTurnsPerTask: number | null; followUpsPerTask: number | null; tokensPerTask: number | null; } export interface ComparisonTotals extends SessionDigestMetrics { sessions: number; } export interface ComparisonCohort { bundleDigest: string; sessions: Array<{ sessionId: string; sourceDigest: string; taskClass: SessionTaskClass; }>; totals: ComparisonTotals; rates: ComparisonRates; } export interface TrialComparison { schemaVersion: 1; proposalId: string; revision: number; diffDigest: string; generatedAt: string; trialStartedAt: string; change: { changedPaths: string[]; expectedEffect: string; }; matching: { taskClasses: SessionTaskClass[]; excludedBeforeSessions: number; }; sufficiency: { status: "sufficient" | "insufficient"; minimumSessionsPerCohort: number; reasons: string[]; }; before: ComparisonCohort; after: ComparisonCohort; delta: ComparisonRates; evidenceDigest: string; } export interface StoredTrialComparison { comparison: TrialComparison; proposal: Proposal; reference: EvaluationArtifactRef; reused: boolean; } export declare function trialEvidenceDigest(corpusDigest: string, comparisonDigest: string): string; export declare function renderTrialComparisonMarkdown(comparison: TrialComparison): string; export declare function buildTrialComparison(paths: EvoPaths, proposal: Proposal, trial: TrialState): Promise; export declare function storeTrialComparison(paths: EvoPaths, proposal: Proposal, trial: TrialState, now?: () => Date): Promise; export declare const TRIAL_METRIC_DIRECTIONS: { readonly toolErrorRate: "lower"; readonly verificationPassRate: "higher"; readonly assistantTurnsPerTask: "lower"; readonly followUpsPerTask: "lower"; readonly tokensPerTask: "lower"; }; export type TrialMetricName = keyof typeof TRIAL_METRIC_DIRECTIONS; export declare function isTrialMetricName(value: string): value is TrialMetricName; export declare function parseTrialDurationDays(value: string): number | undefined; interface TrialContract { primaryMetric?: string; minimumEffect: Record; } export interface TrialContractGate { allowed: boolean; reasons: string[]; } export interface ContractMetricRegression { metric: TrialMetricName; primary: boolean; reason: string; } /** * Every frozen-contract metric regression: the primary metric plus each other * pre-registered metric in minimumEffect acts as a guardrail. A regression at * least as large as a metric's frozen minimum effect fires, so a proposal that * improves its primary metric while tanking a guardrail still gets caught. */ export declare function contractMetricRegressions(contract: TrialContract | undefined, comparison: TrialComparison): ContractMetricRegression[]; /** * Deterministic keep-gate: sufficiency must hold, the primary metric must have * improved by at least the frozen minimum effect, and no pre-registered * guardrail metric may have regressed beyond its own frozen effect size. Model * recommendations can veto a keep but can never substitute for this gate. */ export declare function evaluateTrialContractGate(contract: TrialContract | undefined, comparison: TrialComparison): TrialContractGate; /** * Machine rollback trigger: the primary metric regressed by at least the frozen * minimum effect. Returns the reason, or undefined when no trigger fires. */ export declare function primaryMetricRegression(contract: TrialContract | undefined, comparison: TrialComparison): string | undefined; export {}; //# sourceMappingURL=comparison.d.ts.map