import { z } from 'zod'; export { IndependentEvaluatorResultSchema, RegressionSkepticResultSchema, type IndependentEvaluatorResult, type RegressionSkepticResult } from './evolution-constraints.js'; /** * EvolutionEvaluation — spec §4.4 / §6. * * The Darwin-style ratchet stores one row per evolution round. The * table is the durable evidence of the round; the in-memory * `EvolutionProposal` is the create payload; the in-memory * `EvolutionEvaluation` is the post-skeptic aggregation. * * Hard rules from spec §6.1 (enforced at the service layer, NOT * only in the Zod schema — defense in depth): * * 1. Single editable asset per round (target_count === 1). * 2. Single optimization dimension per round (dimensions.length === 1). * 3. Independent-context evaluation (author_id !== evaluator_id). * 4. Regression skeptic (skeptic_id !== evaluator_id and * skeptic_id !== author_id; skeptic is a SEPARATE agent). * 5. Score delta threshold (score_delta >= score_delta_min). * 6. User confirmation (user_confirmation_pointer is set on `keep`). * 7. No self-scored evolution (the author cannot be the scorer). * * Out of scope (deferred to later slices): * - Crystallization event integration (M5). * - Revert audit trail table (M5 / M7). */ export declare const EvolutionTargetKindSchema: z.ZodEnum<{ loop: "loop"; bee: "bee"; gate: "gate"; policy: "policy"; evaluator: "evaluator"; }>; export type EvolutionTargetKind = z.infer; export declare const EVOLUTION_TARGET_KINDS: readonly EvolutionTargetKind[]; export declare const EvolutionVerdictSchema: z.ZodEnum<{ keep: "keep"; revert: "revert"; "needs-user-decision": "needs-user-decision"; }>; export type EvolutionVerdict = z.infer; export declare const EVOLUTION_VERDICTS: readonly EvolutionVerdict[]; /** * EvolutionProposal — the create payload. * * `single_object` and `single_optimization_dimension` are boolean * markers the LLM must declare at proposal time. The service layer * rejects proposals that violate them. The `target_count` is always * 1; `dimensions` is always length 1. * * `before_score` / `after_score` are per-dimension scores on the * 0..10 scale; the proposal is rejected at `keep` time when * `after_score - before_score < score_delta_min` (default 1.0). */ export declare const EvolutionProposalInputSchema: z.ZodObject<{ target_kind: z.ZodEnum<{ loop: "loop"; bee: "bee"; gate: "gate"; policy: "policy"; evaluator: "evaluator"; }>; target_release_id: z.ZodString; optimization_dimension: z.ZodString; before_snapshot: z.ZodDefault>; after_snapshot: z.ZodDefault>; diff: z.ZodDefault>; before_score: z.ZodNumber; after_score: z.ZodNumber; score_delta_min: z.ZodDefault; author_id: z.ZodString; single_object: z.ZodLiteral; single_optimization_dimension: z.ZodLiteral; rubric: z.ZodDefault>; red_lines: z.ZodDefault>; source_traces: z.ZodDefault>; }, z.core.$strip>; export type EvolutionProposalInput = z.input; /** * The PERSISTED proposal shape — adds `dimensions` (a length-1 * array) and `target_count` (always 1) for storage. The * `optimization_dimension` scalar is normalized into the * `dimensions` array on persist. */ export declare const EvolutionProposalSchema: z.ZodObject<{ target_kind: z.ZodEnum<{ loop: "loop"; bee: "bee"; gate: "gate"; policy: "policy"; evaluator: "evaluator"; }>; target_release_id: z.ZodString; optimization_dimension: z.ZodString; before_snapshot: z.ZodDefault>; after_snapshot: z.ZodDefault>; diff: z.ZodDefault>; before_score: z.ZodNumber; after_score: z.ZodNumber; score_delta_min: z.ZodDefault; author_id: z.ZodString; single_object: z.ZodLiteral; single_optimization_dimension: z.ZodLiteral; rubric: z.ZodDefault>; red_lines: z.ZodDefault>; source_traces: z.ZodDefault>; id: z.ZodString; dimensions: z.ZodArray; target_count: z.ZodLiteral<1>; schema_version: z.ZodDefault>; created_at: z.ZodString; score_delta: z.ZodNumber; }, z.core.$strip>; export type EvolutionProposal = z.infer; /** * The full evolution evaluation row as persisted. Differs from the * proposal in that it carries the evaluator + skeptic verdicts, the * `score_delta` (computed), and the final `verdict` aggregation. * * Field semantics — see spec §4.4 for full prose. Highlights: * * - `user_confirmation_pointer` is a path/ID to a user choice * confirmation is the final gate). * - `brief_pointer` is a path/ID to the evidence brief used in * the recommendation (spec §4.7 / §10 RL-7). */ export declare const EvolutionEvaluationInputSchema: z.ZodObject<{ id: z.ZodString; proposal: z.ZodObject<{ target_kind: z.ZodEnum<{ loop: "loop"; bee: "bee"; gate: "gate"; policy: "policy"; evaluator: "evaluator"; }>; target_release_id: z.ZodString; optimization_dimension: z.ZodString; before_snapshot: z.ZodDefault>; after_snapshot: z.ZodDefault>; diff: z.ZodDefault>; before_score: z.ZodNumber; after_score: z.ZodNumber; score_delta_min: z.ZodDefault; author_id: z.ZodString; single_object: z.ZodLiteral; single_optimization_dimension: z.ZodLiteral; rubric: z.ZodDefault>; red_lines: z.ZodDefault>; source_traces: z.ZodDefault>; id: z.ZodString; dimensions: z.ZodArray; target_count: z.ZodLiteral<1>; schema_version: z.ZodDefault>; created_at: z.ZodString; score_delta: z.ZodNumber; }, z.core.$strip>; evaluator_id: z.ZodString; skeptic_id: z.ZodString; evaluator_result: z.ZodObject<{ score: z.ZodNumber; riskTags: z.ZodDefault>; refuteParagraph: z.ZodString; }, z.core.$strip>; skeptic_result: z.ZodObject<{ driftRisks: z.ZodDefault>; overfitRisks: z.ZodDefault>; safetyRegressionRisks: z.ZodDefault>; blocker: z.ZodOptional; }, z.core.$strip>; verdict: z.ZodEnum<{ keep: "keep"; revert: "revert"; "needs-user-decision": "needs-user-decision"; }>; user_confirmation_pointer: z.ZodOptional; brief_pointer: z.ZodOptional; schema_version: z.ZodDefault>; created_at: z.ZodString; }, z.core.$strip>; export type EvolutionEvaluationInput = z.input; /** * The PERSISTED evolution evaluation row. Differs from the input * in that `score_delta` is computed and stored. */ export declare const EvolutionEvaluationSchema: z.ZodObject<{ id: z.ZodString; proposal: z.ZodObject<{ target_kind: z.ZodEnum<{ loop: "loop"; bee: "bee"; gate: "gate"; policy: "policy"; evaluator: "evaluator"; }>; target_release_id: z.ZodString; optimization_dimension: z.ZodString; before_snapshot: z.ZodDefault>; after_snapshot: z.ZodDefault>; diff: z.ZodDefault>; before_score: z.ZodNumber; after_score: z.ZodNumber; score_delta_min: z.ZodDefault; author_id: z.ZodString; single_object: z.ZodLiteral; single_optimization_dimension: z.ZodLiteral; rubric: z.ZodDefault>; red_lines: z.ZodDefault>; source_traces: z.ZodDefault>; id: z.ZodString; dimensions: z.ZodArray; target_count: z.ZodLiteral<1>; schema_version: z.ZodDefault>; created_at: z.ZodString; score_delta: z.ZodNumber; }, z.core.$strip>; evaluator_id: z.ZodString; skeptic_id: z.ZodString; evaluator_result: z.ZodObject<{ score: z.ZodNumber; riskTags: z.ZodDefault>; refuteParagraph: z.ZodString; }, z.core.$strip>; skeptic_result: z.ZodObject<{ driftRisks: z.ZodDefault>; overfitRisks: z.ZodDefault>; safetyRegressionRisks: z.ZodDefault>; blocker: z.ZodOptional; }, z.core.$strip>; verdict: z.ZodEnum<{ keep: "keep"; revert: "revert"; "needs-user-decision": "needs-user-decision"; }>; user_confirmation_pointer: z.ZodOptional; brief_pointer: z.ZodOptional; schema_version: z.ZodDefault>; created_at: z.ZodString; score_delta: z.ZodNumber; }, z.core.$strip>; export type EvolutionEvaluation = z.infer; /** * Default for `score_delta_min` per spec §6.1 #5. */ export declare const EVOLUTION_DEFAULT_DELTA_MIN = 1; /** * Convenience: strict-parse an unknown payload into an * EvolutionEvaluation row. Throws ZodError on failure. */ export declare function parseEvolutionEvaluation(input: unknown): EvolutionEvaluation; /** * Convenience: safe-parse that returns a Result-like shape so * callers (CLI / service layer) can render findings without * try/catch noise. */ export declare function safeParseEvolutionEvaluation(input: unknown): { ok: true; row: EvolutionEvaluation; } | { ok: false; findings: Array<{ path: string; message: string; }>; }; /** * Convenience: strict-parse an unknown payload into an * EvolutionProposal. Throws ZodError on failure. */ export declare function parseEvolutionProposal(input: unknown): EvolutionProposal;