import type { SqliteDatabase } from '../sqlite/sqlite-driver.js'; import type { EvolutionEvaluation, EvolutionEvaluationInput, EvolutionProposal, EvolutionProposalInput, EvolutionTargetKind, EvolutionVerdict } from './evolution-types.js'; /** * Re-apply the evolution_evaluation table migration against an * already-open database. Used by tests that build their own DB * without the openStateDb pipeline. Idempotent. */ export declare function ensureEvolutionEvaluationTable(db: SqliteDatabase): void; /** * Compute the score_delta from before/after scores. Exported for * the service layer to use during proposal evaluation. */ export declare function computeScoreDelta(before: number, after: number): number; /** * Build a persisted EvolutionProposal from the input. The service * dimension) BEFORE calling this; the persisted shape always has * `target_count = 1` and `dimensions.length = 1`. */ export declare function buildProposal(id: string, input: EvolutionProposalInput, createdAt?: string): EvolutionProposal; /** * Insert a full EvolutionEvaluation row. The row's * `schema_version` is taken from the input (must equal * `peaks.evolution/1`); `created_at` is stamped from the server * clock here, so callers cannot backdate a row. */ export declare function insertEvolutionEvaluation(db: SqliteDatabase, evalRow: EvolutionEvaluationInput): void; /** * Read a single EvolutionEvaluation row by id; returns undefined if * absent. */ export declare function getEvolutionEvaluation(db: SqliteDatabase, id: string): EvolutionEvaluation | undefined; /** * List EvolutionEvaluation rows for a specific target. Filter by * `verdict` to scope the listing. */ export declare function listEvolutionEvaluationsByTarget(db: SqliteDatabase, opts: { target_kind: EvolutionTargetKind; target_release_id: string; verdict?: EvolutionVerdict; }): EvolutionEvaluation[]; /** * Update the verdict (and optional user_confirmation_pointer) of * an existing EvolutionEvaluation row. Returns the updated row, or * undefined if the id is absent. * * The service layer is responsible for enforcing that the * transition `revert` is always allowed and `keep` requires */ export declare function updateEvolutionVerdict(db: SqliteDatabase, id: string, verdict: EvolutionVerdict, userConfirmationPointer?: string): EvolutionEvaluation | undefined; /** * Test seam: produce a fresh id for an EvolutionEvaluation row. * Format: `eval-` (lowercase, 12 hex chars). Matches the Zod * `^eval-[0-9a-f-]{8,}$` pattern in EvolutionProposalSchema. */ export declare function newEvaluationId(): string;