/**
 * @fileoverview RalphStatusParser - RALPH_STATUS block parsing and circuit breaker
 *
 * Parses structured RALPH_STATUS blocks from Claude Code output
 * and manages the circuit breaker state machine.
 *
 * Extracted from ralph-tracker.ts as part of domain splitting.
 *
 * @module ralph-status-parser
 */
import { EventEmitter } from 'node:events';
import type { RalphStatusBlock, CircuitBreakerStatus } from './types.js';
/**
 * RalphStatusParser - Parses RALPH_STATUS blocks and manages circuit breaker.
 *
 * Events emitted:
 * - `statusBlockDetected` - When a complete RALPH_STATUS block is parsed
 * - `circuitBreakerUpdate` - When circuit breaker state changes
 * - `exitGateMet` - When dual-condition exit gate is met
 */
export declare class RalphStatusParser extends EventEmitter {
    /** Circuit breaker state tracking */
    private _circuitBreaker;
    /** Buffer for RALPH_STATUS block lines */
    private _statusBlockBuffer;
    /** Flag indicating we're inside a RALPH_STATUS block */
    private _inStatusBlock;
    /** Last parsed RALPH_STATUS block */
    private _lastStatusBlock;
    /** Count of completion indicators detected (for dual-condition exit) */
    private _completionIndicators;
    /** Whether dual-condition exit gate has been met */
    private _exitGateMet;
    /** Cumulative files modified across all iterations */
    private _totalFilesModified;
    /** Cumulative tasks completed across all iterations */
    private _totalTasksCompleted;
    /** Current cycle count (fed by parent) */
    private _cycleCount;
    constructor();
    /**
     * Process a line for status block detection and completion indicators.
     * Main entry point - call this for each trimmed line.
     */
    processLine(line: string): void;
    /**
     * Set the current cycle count (fed by parent for circuit breaker tracking).
     */
    setCycleCount(cycleCount: number): void;
    /**
     * Notify of iteration progress (for circuit breaker reset on progress).
     * Called by parent when iteration count changes.
     */
    notifyIterationProgress(currentIteration: number): void;
    /**
     * Get current circuit breaker status.
     */
    get circuitBreakerStatus(): CircuitBreakerStatus;
    /**
     * Get last parsed RALPH_STATUS block.
     */
    get lastStatusBlock(): RalphStatusBlock | null;
    /**
     * Get cumulative stats from status blocks.
     */
    get cumulativeStats(): {
        filesModified: number;
        tasksCompleted: number;
        completionIndicators: number;
    };
    /**
     * Whether dual-condition exit gate has been met.
     */
    get exitGateMet(): boolean;
    /**
     * Manually reset circuit breaker to CLOSED state.
     * Use when user acknowledges the issue is resolved.
     *
     * @fires circuitBreakerUpdate
     */
    resetCircuitBreaker(): void;
    /**
     * Reset status parser state (soft reset).
     * Clears status block buffer and completion indicators.
     * Keeps circuit breaker state (it tracks across iterations).
     */
    reset(): void;
    /**
     * Full reset - clears all state including circuit breaker.
     */
    fullReset(): void;
    /**
     * Clean up all resources.
     */
    destroy(): void;
    /**
     * Process a line for RALPH_STATUS block detection.
     * Buffers lines between ---RALPH_STATUS--- and ---END_RALPH_STATUS---
     * then parses the complete block.
     *
     * @param line - Single line to process (already trimmed)
     * @fires statusBlockDetected - When a complete block is parsed
     */
    private processStatusBlockLine;
    /**
     * Parse buffered RALPH_STATUS block lines into structured data.
     *
     * P1-004: Enhanced with schema validation and error recovery
     *
     * @param lines - Array of lines between block markers
     * @fires statusBlockDetected - When parsing succeeds
     */
    private parseStatusBlock;
    /**
     * Handle a parsed RALPH_STATUS block.
     * Updates circuit breaker, checks exit conditions.
     *
     * @param block - Parsed status block
     * @fires statusBlockDetected - With the block data
     * @fires circuitBreakerUpdate - If state changes
     * @fires exitGateMet - If dual-condition exit triggered
     */
    private handleStatusBlock;
    /**
     * Update circuit breaker state based on iteration results.
     *
     * @param hasProgress - Whether this iteration made progress
     * @param testsStatus - Current test status
     * @param status - Overall status from RALPH_STATUS
     * @fires circuitBreakerUpdate - If state changes
     */
    private updateCircuitBreaker;
    private _handleProgressDetected;
    private _handleNoProgress;
    /**
     * Check line for completion indicators (natural language patterns).
     * Used for dual-condition exit gate.
     *
     * @param line - Line to check
     */
    private detectCompletionIndicators;
}
//# sourceMappingURL=ralph-status-parser.d.ts.map