export declare const EVOLUTION_MODES: readonly ["off", "manual", "shadow", "guarded"]; export type EvolutionMode = (typeof EVOLUTION_MODES)[number]; export interface AutomationPolicy { turnInterval: number; cooldownMs: number; dailyTokenBudget: number; dailyCostBudgetUsd: number; estimatedTokensPerReview: number; estimatedCostPerReviewUsd: number; maxTriggerFingerprints: number; } export interface AutomationState { schemaVersion: 1; mode: EvolutionMode; promotionScope: "session" | "workspace"; usageDay: string; tokensUsed: number; costUsedUsd: number; lastReviewAt?: number; triggerFingerprints: string[]; } export type AutomationTrigger = { type: "turn"; turnIndex: number; fingerprint: string; } | { type: "compaction"; fingerprint: string; }; export type ReviewDecision = { review: true; } | { review: false; reason: "mode" | "interval" | "duplicate" | "cooldown" | "budget"; }; export declare const DEFAULT_AUTOMATION_POLICY: Readonly; export declare function defaultAutomationState(now?: number): AutomationState; export declare function shouldReview(trigger: AutomationTrigger, state: AutomationState, policy: AutomationPolicy, now?: number): ReviewDecision; export declare function recordAutomationReview(state: AutomationState, trigger: Pick, policy: AutomationPolicy, now?: number): AutomationState; export declare function loadAutomationState(agentDir: string, now?: number): Promise; export declare function saveAutomationState(agentDir: string, state: AutomationState): Promise; export declare function updateAutomationState(agentDir: string, update: (state: AutomationState) => AutomationState, now?: number): Promise; export declare function reserveAutomationReview(agentDir: string, trigger: AutomationTrigger, policy: AutomationPolicy, now?: number): Promise<{ reserved: boolean; state: AutomationState; }>; export declare function runWithGuardedAuthorization(agentDir: string, scope: AutomationState["promotionScope"], task: () => Promise): Promise;