import type { ValidationResult } from './validation.js'; export declare const EVOLUTION_LOOP_SCHEMA = "open-scaffold.evolution-loop.v1"; export declare const EVOLUTION_ATTEMPT_SCHEMA = "open-scaffold.evolution-attempt.v1"; export declare const EVOLUTION_FRONTIER_SCHEMA = "open-scaffold.evolution-frontier.v1"; export declare const EVOLUTION_NEXT_ACTION_PACKET_SCHEMA = "open-scaffold.evolution-next-action-packet.v1"; export declare const EVOLUTION_CONTROLLER_SIGNAL_SCHEMA = "open-scaffold.evolution-controller-signal.v1"; export declare const EVOLUTION_JUDGMENT_CHECKPOINT_SCHEMA = "open-scaffold.evolution-judgment-checkpoint.v1"; export declare const EVOLUTION_EFFICIENCY_REPORT_SCHEMA = "open-scaffold.evolution-efficiency-report.v1"; export declare const EVOLUTION_STRATEGIES: readonly ["manual", "greedy", "tournament", "novelty", "map_elites", "custom"]; export type EvolutionStrategy = (typeof EVOLUTION_STRATEGIES)[number]; export declare const EVOLUTION_DECISIONS: readonly ["promote", "reject", "retry", "block"]; export type EvolutionDecision = (typeof EVOLUTION_DECISIONS)[number]; export interface EvolutionSource { source: 'plan' | 'run'; sourcePath: string; planPath: string; planSlug: string; taskId: string | null; runId: string | null; runPacketPath: string | null; objective: string; constraints: string[]; acceptanceCriteria: string[]; sourceRefs: string[]; } export interface RenderEvolutionOptions { now?: Date; strategy?: EvolutionStrategy; } export interface EvolutionLoopFiles { loopId: string; loopJson: string; attemptsJsonl: string; frontierJson: string; } export interface WriteEvolutionResult { loopDir: string; loopPath: string; attemptsPath: string; frontierPath: string; loopId: string; } export interface RecordEvolutionAttemptOptions { runPath: string; evaluationPath?: string; receiptPaths?: string[]; evidencePaths?: string[]; decision: EvolutionDecision; score?: number; rationale: string; repairHypothesis?: EvolutionRepairHypothesis; usage?: EvolutionUsageSummary; now?: Date; } export interface RecordEvolutionAttemptResult { attempt: Record; frontierUpdated: boolean; attemptsPath: string; frontierPath: string; } export interface EvolutionRepairHypothesis { hypothesis: string; targetMetric?: string | null; expectedGain?: number | null; actualDelta?: number | null; } export interface EvolutionUsageSummary { totalTokens?: number | null; estimatedUsd?: number | null; source?: string | null; unavailableReason?: string | null; } export interface EvolutionAttemptRepairHypothesis { hypothesis: string; targetMetric: string | null; expectedGain: number | null; actualDelta: number | null; } export interface EvolutionAttemptUsageSummary { totalTokens: number | null; estimatedUsd: number | null; source: string | null; unavailableReason: string | null; } export declare function loadEvolutionSource(sourcePath: string, root?: string): EvolutionSource; export declare function renderEvolutionLoopFiles(source: EvolutionSource, options?: RenderEvolutionOptions): EvolutionLoopFiles; export declare function writeEvolutionLoop(sourcePath: string, outDir: string, root?: string, options?: RenderEvolutionOptions): WriteEvolutionResult; export type EvolutionCompareFormat = 'terminal' | 'markdown' | 'json'; export interface EvolutionCompareOptions { a?: string; b?: string; } export interface EvolutionCompareAttempt { attemptId: string; runId: string | null; taskId: string | null; recordedAt: string | null; decision: string | null; score: number | null; rationale: string; runPacket: string | null; evidenceRefs: string[]; adapterReceipts: string[]; evaluation: string | null; evaluationId: string | null; evaluationDecision: string | null; repairHypothesis: EvolutionAttemptRepairHypothesis | null; usage: EvolutionAttemptUsageSummary | null; boundary: Record; } export interface EvolutionCompareCriterionDelta { id: string; text: string; aStatus: string | null; bStatus: string | null; } export type EvolutionCompareResult = { kind: 'message'; loop: { loopDir: string; loopId: string | null; objective: string | null; strategy: string | null; attemptCount: number; }; message: string; } | { kind: 'comparison'; loop: { loopDir: string; loopId: string | null; objective: string | null; strategy: string | null; attemptCount: number; }; a: EvolutionCompareAttempt; b: EvolutionCompareAttempt; scoreDelta: number | null; evidence: { onlyInA: string[]; onlyInB: string[]; inBoth: string[]; }; evaluation: { a: { present: boolean; path: string | null; id: string | null; decision: string | null; }; b: { present: boolean; path: string | null; id: string | null; decision: string | null; }; }; acceptanceCriteria: { rows: EvolutionCompareCriterionDelta[]; aPresent: boolean; bPresent: boolean; }; boundaryDifferences: Array<{ field: string; a: unknown; b: unknown; }>; frontierHistory: Array<{ attemptId: string; runId: string | null; score: number | null; promotedAt: string | null; decision: string | null; }>; }; export declare function compareEvolutionLoop(loopDir: string, options?: EvolutionCompareOptions, root?: string): EvolutionCompareResult; export declare function renderEvolutionComparison(comparison: EvolutionCompareResult, format?: EvolutionCompareFormat): string; export type EvolutionAnalysisFormat = EvolutionCompareFormat; export type EvolutionAnalysisRecommendationAction = 'continue' | 'stop' | 'redesign' | 'inspect_scorer'; type EvolutionPlateauStatus = 'insufficient_data' | 'improving' | 'stagnating' | 'plateau' | 'regressed'; type EvolutionCriterionSensitivity = 'observed_positive' | 'observed_negative' | 'none' | 'unknown'; export interface EvolutionAnalysisDeltaRow { id: string; text: string; previousStatus?: string | null; frontierStatus?: string | null; currentStatus: string | null; } export interface EvolutionAnalysisCriterion { id: string; text: string; currentStatus: string | null; previousStatus: string | null; frontierStatus: string | null; sensitivity: EvolutionCriterionSensitivity; impossible: boolean; alwaysFailing: boolean; reasons: string[]; evidence: string[]; } export interface EvolutionNextActionPacket { schema: typeof EVOLUTION_NEXT_ACTION_PACKET_SCHEMA; loop: { loopDir: string; loopId: string | null; objective: string | null; }; recommendedAction: EvolutionAnalysisRecommendationAction; summary: string; reasons: string[]; resumeFrom: { currentAttemptId: string | null; currentRunId: string | null; currentEvaluation: string | null; frontierAttemptId: string | null; frontierRunId: string | null; }; plateau: { status: EvolutionPlateauStatus; noImprovementCount: number; currentScore: number | null; bestScore: number | null; }; acceptance: { currentPass: number; currentTotal: number; remainingFailures: Array<{ id: string; text: string; status: string | null; sensitivity: EvolutionCriterionSensitivity; impossible: boolean; alwaysFailing: boolean; reasons: string[]; evidence: string[]; }>; }; currentAttemptControl: { repairHypothesis: EvolutionAttemptRepairHypothesis | null; usage: EvolutionAttemptUsageSummary | null; budgetWarning: string | null; }; requiredNextFields: string[]; handoffChecklist: string[]; requirementQuestions: string[]; evidenceRefs: string[]; boundaryNotes: string[]; } export interface EvolutionControllerSignal { schema: typeof EVOLUTION_CONTROLLER_SIGNAL_SCHEMA; action: EvolutionAnalysisRecommendationAction; summary: string; reasons: string[]; resume: { currentAttemptId: string | null; frontierAttemptId: string | null; currentEvaluation: string | null; }; plateau: EvolutionNextActionPacket['plateau']; acceptance: { currentPass: number; currentTotal: number; remainingFailureIds: string[]; remainingFailures: EvolutionNextActionPacket['acceptance']['remainingFailures']; }; requiredNextFields: string[]; requirementQuestions: string[]; usageReceipt: { totalTokens: number | null; estimatedUsd: number | null; source: string | null; unavailableReason: string | null; completeness: { present: number; total: number; missing: string[]; ratio: number; }; }; warnings: string[]; evidenceRefs: string[]; boundaryNotes: string[]; } export type EvolutionJudgeAction = 'continue' | 'stop_impossible' | 'stop_blocked'; export interface EvolutionJudgeRuling { action: EvolutionJudgeAction; impossibleAcs?: string[]; rationale?: string; } export interface EvolutionJudgmentCheckpoint { schema: typeof EVOLUTION_JUDGMENT_CHECKPOINT_SCHEMA; action: EvolutionAnalysisRecommendationAction; retryAuthorized: { allow: boolean; mode: 'normal' | 'proof_only' | 'closeout_only' | 'blocked_by_packet' | 'stop'; reason: string; }; packet: EvolutionControllerSignal; judge: { present: boolean; action: EvolutionJudgeAction | null; impossibleAcs: string[]; rationale: string | null; }; requiredBeforeRetry: string[]; boundary: { judgment_checkpoint_only: true; does_not_execute_runtime: true; does_not_approve_work: true; human_owns_closeout_merge_publish_release: true; }; } export interface EvolutionAnalysisResult { kind: 'analysis'; loop: { loopDir: string; loopId: string | null; objective: string | null; strategy: string | null; attemptCount: number; }; plateau: { status: EvolutionPlateauStatus; threshold: number; noImprovementCount: number; currentScore: number | null; bestScore: number | null; bestAttemptId: string | null; fingerprintPlateau: boolean; scoreObserved: boolean; }; currentAttempt: { attemptId: string | null; runId: string | null; decision: string | null; score: number | null; evaluation: string | null; repairHypothesis: EvolutionAttemptRepairHypothesis | null; usage: EvolutionAttemptUsageSummary | null; }; previousAttempt: { attemptId: string | null; runId: string | null; decision: string | null; score: number | null; evaluation: string | null; repairHypothesis: EvolutionAttemptRepairHypothesis | null; usage: EvolutionAttemptUsageSummary | null; }; frontierAttempt: { attemptId: string | null; runId: string | null; decision: string | null; score: number | null; evaluation: string | null; repairHypothesis: EvolutionAttemptRepairHypothesis | null; usage: EvolutionAttemptUsageSummary | null; }; acceptanceSummary: { currentPass: number; currentTotal: number; frontierPass: number; frontierTotal: number; remainingFailures: string[]; }; criteria: EvolutionAnalysisCriterion[]; currentVsPrevious: { present: boolean; previousAttemptId: string | null; currentAttemptId: string | null; rows: EvolutionAnalysisDeltaRow[]; }; currentVsFrontier: { present: boolean; frontierAttemptId: string | null; currentAttemptId: string | null; rows: EvolutionAnalysisDeltaRow[]; }; recommendation: { action: EvolutionAnalysisRecommendationAction; summary: string; reasons: string[]; }; nextActionPacket: EvolutionNextActionPacket; notes: string[]; } export interface EvolutionAnalyzeOptions { plateauThreshold?: number; } export interface EvolutionAnalysisRenderOptions { compact?: boolean; } export declare function analyzeEvolutionLoop(loopDir: string, options?: EvolutionAnalyzeOptions, root?: string): EvolutionAnalysisResult; export declare function buildEvolutionControllerSignal(analysis: EvolutionAnalysisResult): EvolutionControllerSignal; export declare function buildEvolutionJudgmentCheckpoint(analysis: EvolutionAnalysisResult, judge?: EvolutionJudgeRuling | null): EvolutionJudgmentCheckpoint; export declare function renderEvolutionJudgmentCheckpoint(checkpoint: EvolutionJudgmentCheckpoint, format?: EvolutionAnalysisFormat): string; export declare function renderEvolutionAnalysis(analysis: EvolutionAnalysisResult, format?: EvolutionAnalysisFormat, options?: EvolutionAnalysisRenderOptions): string; export declare function recordEvolutionAttempt(loopDir: string, options: RecordEvolutionAttemptOptions, root?: string): RecordEvolutionAttemptResult; export declare function validateEvolutionLoopDir(loopDir: string, root?: string): ValidationResult; export {};