import type { EvolutionLoopEvent, Principle, PrincipleDetectorSpec, PrincipleEvaluatorLevel, PrincipleSuggestedRule } from './evolution-types.js'; export interface EvolutionReducer { emit(_event: EvolutionLoopEvent): void; emitSync(_event: EvolutionLoopEvent): void; getEventLog(): EvolutionLoopEvent[]; getCandidatePrinciples(): Principle[]; getProbationPrinciples(): Principle[]; getActivePrinciples(): Principle[]; getPrincipleById(_id: string): Principle | null; promote(_principleId: string, _reason?: string): void; deprecate(_principleId: string, _reason: string): void; rollbackPrinciple(_principleId: string, _reason: string): void; recordProbationFeedback(_principleId: string, _success: boolean): void; /** * Creates a new principle with generalized trigger/action from diagnostician. * Called after diagnostician analysis to create principle directly. */ createPrincipleFromDiagnosis(params: { painId: string; painType: 'tool_failure' | 'subagent_error' | 'user_frustration'; triggerPattern: string; action: string; source: string; evaluability?: PrincipleEvaluatorLevel; detectorMetadata?: PrincipleDetectorSpec; /** Highly abstracted principle text — if absent, falls back to action-based title */ abstractedPrinciple?: string; /** Associated core axiom (e.g., "T-01") */ coreAxiomId?: string; priority?: 'P0' | 'P1' | 'P2'; scope?: 'general' | 'domain'; domain?: string; suggestedRules?: PrincipleSuggestedRule[]; }): string | null; getStats(): { candidateCount: number; probationCount: number; activeCount: number; deprecatedCount: number; lastPromotedAt: string | null; }; } export declare class EvolutionReducerImpl implements EvolutionReducer { private readonly streamPath; private readonly lockTargetPath; private readonly blacklistPath; private readonly principlesPath; private readonly workspaceDir; private readonly stateDir; private readonly memoryEvents; private readonly principles; private readonly failureStreak; private lastPromotedAt; private isReplaying; constructor(opts: { workspaceDir: string; stateDir?: string; }); emit(event: EvolutionLoopEvent): void; emitSync(event: EvolutionLoopEvent): void; getEventLog(): EvolutionLoopEvent[]; getCandidatePrinciples(): Principle[]; getProbationPrinciples(): Principle[]; getActivePrinciples(): Principle[]; getPrincipleById(id: string): Principle | null; promote(principleId: string, reason?: string): void; deprecate(principleId: string, reason: string): void; rollbackPrinciple(principleId: string, reason: string): void; recordProbationFeedback(principleId: string, success: boolean): void; /** * Creates a new principle with generalized trigger/action from diagnostician. * Called after diagnostician analysis to create principle directly (no intermediate overfitted principle). * @returns the new principle ID, or null if creation failed */ createPrincipleFromDiagnosis(params: { painId: string; painType: 'tool_failure' | 'subagent_error' | 'user_frustration'; triggerPattern: string; action: string; source: string; evaluability?: PrincipleEvaluatorLevel; detectorMetadata?: PrincipleDetectorSpec; abstractedPrinciple?: string; coreAxiomId?: string; priority?: 'P0' | 'P1' | 'P2'; scope?: 'general' | 'domain'; domain?: string; suggestedRules?: PrincipleSuggestedRule[]; }): string | null; private syncPrincipleToFile; private static detectPrincipleLanguage; private static formatPrincipleForFile; getStats(): { candidateCount: number; probationCount: number; activeCount: number; deprecatedCount: number; lastPromotedAt: string | null; }; private ensureDirs; private loadFromStream; private applyEvent; private onCandidateCreated; private onPrinciplePromoted; private onPrincipleDeprecated; private onPrincipleRolledBack; private onPainDetected; private updateFailureStreakFromPain; private nextPrincipleId; private getByStatus; private sweepExpiredProbation; private persistBlacklist; private loadBlacklist; private isBlacklisted; } export declare function stableContentHash(input: string): string;