/**
 * State Manager - Workflow state tracking and checkpointing
 *
 * Manages workflow state, checkpoints, and recovery for autonomous execution.
 *
 * Part of increment 0039: Ultra-Smart Next Command
 *
 * @module core/workflow/state-manager
 * @since v0.22.0
 */
import { WorkflowPhase } from './types.js';
/**
 * Checkpoint - Saved workflow state
 */
export interface Checkpoint {
    /** Unique checkpoint ID */
    id: string;
    /** Timestamp */
    timestamp: number;
    /** Increment ID */
    incrementId: string;
    /** Current workflow phase */
    phase: WorkflowPhase;
    /** Iteration count */
    iteration: number;
    /** Actions taken */
    actions: string[];
    /** Last successful action */
    lastAction?: string;
    /** Custom metadata */
    metadata?: Record<string, any>;
}
/**
 * State transition record
 */
export interface StateTransition {
    /** From phase */
    from: WorkflowPhase;
    /** To phase */
    to: WorkflowPhase;
    /** Timestamp */
    timestamp: number;
    /** Action that caused transition */
    action: string;
    /** Success flag */
    success: boolean;
}
/**
 * State Manager - Track workflow state and checkpoints
 */
export declare class StateManager {
    private checkpointDir;
    private maxCheckpoints;
    constructor(checkpointDir?: string, maxCheckpoints?: number);
    /**
     * Save checkpoint
     *
     * @param checkpoint - Checkpoint data
     */
    saveCheckpoint(checkpoint: Checkpoint): Promise<void>;
    /**
     * Load checkpoints for increment (sorted by timestamp, newest first)
     */
    loadCheckpoints(incrementId: string): Promise<Checkpoint[]>;
    /**
     * Get latest checkpoint for increment
     */
    getLatestCheckpoint(incrementId: string): Promise<Checkpoint | null>;
    /**
     * Delete checkpoint
     *
     * @param incrementId - Increment ID
     * @param checkpointId - Checkpoint ID
     */
    deleteCheckpoint(incrementId: string, checkpointId: string): Promise<void>;
    /**
     * Cleanup old checkpoints (keep only N most recent)
     *
     * @param incrementId - Increment ID
     */
    private cleanupOldCheckpoints;
    /**
     * Detect infinite loop (same phase repeated threshold times consecutively)
     */
    detectLoop(phaseHistory: WorkflowPhase[], threshold?: number): boolean;
    /**
     * Record state transition
     *
     * (For now, this is a no-op - will be used for analytics/debugging)
     *
     * @param transition - State transition record
     */
    recordTransition(transition: StateTransition): void;
}
//# sourceMappingURL=state-manager.d.ts.map