import { EvolutionService, type EvolutionIntegrityError } from '../../services/evolution/evolution-service.js'; import { type EvolutionTargetKind } from '../../services/evolution/evolution-types.js'; import { type ProgramIO } from '../cli-helpers.js'; import { type ResultEnvelope } from 'peaks-loop-shared/result'; /** A parsed `--target ` flag. */ export interface EvolutionTarget { kind: EvolutionTargetKind; id: string; } /** * Parse `--target `. Returns the kind + id, or `null` on * failure. Validates `kind` against the EVOLUTION_TARGET_KINDS * union. */ export declare function parseTargetFlag(raw: string): EvolutionTarget | null; /** The shared `--target` parse failure envelope (`propose` + `status`). */ export declare function invalidTargetFailure(command: string, target: string): ResultEnvelope<{ target: string; }>; /** The shared "no such proposal" failure envelope. */ export declare function proposalNotFoundFailure(command: string, proposalId: string, nextActions: string[]): ResultEnvelope<{ proposalId: string; }>; /** * Helper: collect repeatable `--risk-tag` values into an array. * Commander's `collect` is not always available; we read * `previous` from the default value. */ export declare function collectRepeatable(value: string, previous: string[]): string[]; /** Upper bound of the 0..10 score scale used by proposal + evaluator scores. */ export declare const SCORE_SCALE_MAX = 10; /** True when `value` is a finite number on the 0..10 score scale. */ export declare function isScoreInRange(value: number): boolean; /** Inputs for {@link scoreRangeFailure}. */ export interface ScoreRangeFailureArgs { command: string; code: string; /** Message label, e.g. `before_score`. */ label: string; /** CLI flag named in the hint, e.g. `--before-score`. */ flag: string; /** `data` key carrying the raw value, e.g. `beforeScore`. */ key: string; /** The raw, unparsed flag value. */ raw: string; } /** The shared "[0, 10] finite number" validation failure envelope. */ export declare function scoreRangeFailure(args: ScoreRangeFailureArgs): ResultEnvelope>; /** The `--delta-min` validation failure envelope. */ export declare function deltaMinFailure(command: string, raw: string): ResultEnvelope>; /** Run `body` against a fresh EvolutionService, closing the DB after. */ export declare function withEvolutionDb(project: string | undefined, body: (svc: EvolutionService) => T): T; /** `await`-friendly sibling of {@link withEvolutionDb}. */ export declare function withEvolutionDbAsync(project: string | undefined, body: (svc: EvolutionService) => Promise): Promise; /** Params for {@link reportIntegrityFailure}. */ export interface IntegrityFailureReport { io: ProgramIO; command: string; error: EvolutionIntegrityError; nextActions: string[]; /** `options.json` — the caller's `--json` flag, possibly absent. */ asJson?: boolean | undefined; } /** Print an `EvolutionIntegrityError` envelope and set exit code 1. */ export declare function reportIntegrityFailure(report: IntegrityFailureReport): void; /** Params for {@link reportFailure}. */ export interface CommandFailureReport { io: ProgramIO; command: string; code: string; error: unknown; data: Record; nextActions: string[]; /** `options.json` — the caller's `--json` flag, possibly absent. */ asJson?: boolean | undefined; } /** Print a generic `_FAILED` envelope and set exit code 1. */ export declare function reportFailure(report: CommandFailureReport): void;