/**
 * Repair Coordinator Module
 *
 * Coordinates auto-repair orchestration for bash execution errors.
 * Detects error patterns that can be repaired and manages repair attempts.
 *
 * Integrates with the RepairEngine from src/agent/repair to provide
 * intelligent automated program repair capabilities.
 */
import { EventEmitter } from "events";
import { RepairResult as EngineRepairResult, RepairConfig as EngineRepairConfig, TestExecutor, CommandExecutor, FileReader, FileWriter } from "../repair/index.js";
/**
 * Configuration for the RepairCoordinator
 */
export interface RepairConfig {
    /** Whether auto-repair is enabled */
    enabled: boolean;
    /** Maximum number of repair attempts per error */
    maxAttempts: number;
    /** Timeout for each repair attempt in milliseconds */
    timeout: number;
    /** Patterns that trigger auto-repair */
    patterns: RegExp[];
    /** Engine configuration passed to RepairEngine */
    engineConfig?: Partial<EngineRepairConfig>;
}
/**
 * Default repair patterns that can be auto-repaired
 */
export declare const DEFAULT_REPAIR_PATTERNS: RegExp[];
/**
 * Default configuration for RepairCoordinator
 */
export declare const DEFAULT_REPAIR_CONFIG: RepairConfig;
/**
 * Result from a repair attempt
 */
export interface RepairResult {
    /** Whether a repair was attempted */
    attempted: boolean;
    /** Whether the repair was successful */
    success: boolean;
    /** List of fixes that were applied */
    fixes: string[];
    /** Human-readable message about the repair */
    message: string;
    /** Number of attempts made */
    attempts?: number;
    /** Duration of the repair process in milliseconds */
    duration?: number;
    /** Detailed results from the repair engine */
    engineResults?: EngineRepairResult[];
}
/**
 * Events emitted by RepairCoordinator
 */
export interface RepairCoordinatorEvents {
    "repair:start": {
        errorOutput: string;
        command?: string;
    };
    "repair:success": {
        fixes: string[];
        attempts: number;
    };
    "repair:failed": {
        reason: string;
        attempts: number;
    };
    "repair:error": {
        error: string;
    };
    "repair:enabled": {
        enabled: boolean;
    };
    "repair:patterns:updated": {
        patterns: RegExp[];
    };
}
/**
 * RepairCoordinator - Orchestrates auto-repair for bash execution errors
 *
 * This class serves as the coordination layer between bash execution
 * and the underlying RepairEngine, providing:
 * - Error pattern detection
 * - Repair attempt management
 * - Configuration management
 * - Event-based progress tracking
 */
export declare class RepairCoordinator extends EventEmitter {
    private apiKey?;
    private baseURL?;
    private config;
    private repairEngine;
    private attemptCounts;
    constructor(config?: Partial<RepairConfig>, apiKey?: string | undefined, baseURL?: string | undefined);
    /**
     * Initialize the repair engine lazily
     */
    private getRepairEngine;
    /**
     * Enable or disable auto-repair
     */
    setRepairEnabled(enabled: boolean): void;
    /**
     * Check if auto-repair is enabled
     */
    isRepairEnabled(): boolean;
    /**
     * Check if an error output is repairable based on configured patterns
     */
    isRepairableError(output: string): boolean;
    /**
     * Get the error type that matched, if any
     */
    getMatchedErrorType(output: string): string | null;
    /**
     * Attempt to repair an error
     *
     * @param errorOutput - The error output from bash execution
     * @param command - Optional command that produced the error
     * @returns RepairResult with details about the repair attempt
     */
    attemptRepair(errorOutput: string, command?: string): Promise<RepairResult>;
    /**
     * Configure repair patterns
     *
     * @param patterns - New patterns to use for error detection
     * @param mode - 'replace' replaces all patterns, 'append' adds to existing
     */
    configurePatterns(patterns: RegExp[], mode?: "replace" | "append"): void;
    /**
     * Add a single pattern to the repair patterns
     */
    addPattern(pattern: RegExp): void;
    /**
     * Remove a pattern from the repair patterns
     */
    removePattern(pattern: RegExp): boolean;
    /**
     * Get current repair patterns
     */
    getPatterns(): RegExp[];
    /**
     * Set external executors for the repair engine
     */
    setExecutors(executors: {
        testExecutor?: TestExecutor;
        commandExecutor?: CommandExecutor;
        fileReader?: FileReader;
        fileWriter?: FileWriter;
    }): void;
    /**
     * Get current configuration
     */
    getConfig(): RepairConfig;
    /**
     * Update configuration
     */
    updateConfig(config: Partial<RepairConfig>): void;
    /**
     * Reset attempt counts for all errors
     */
    resetAttemptCounts(): void;
    /**
     * Reset attempt count for a specific error
     */
    resetAttemptCount(errorOutput: string): void;
    /**
     * Get repair statistics from the engine
     */
    getStatistics(): import("../repair/types.js").RepairStats | null;
    /**
     * Get repair history from the engine
     */
    getHistory(): import("../repair/types.js").RepairSession[];
    /**
     * Clear repair history
     */
    clearHistory(): void;
    /**
     * Dispose and cleanup resources
     */
    dispose(): void;
    /**
     * Create a unique key for an error to track attempts
     */
    private createErrorKey;
}
/**
 * Create a RepairCoordinator instance
 */
export declare function createRepairCoordinator(config?: Partial<RepairConfig>, apiKey?: string, baseURL?: string): RepairCoordinator;
/**
 * Get the global RepairCoordinator instance
 */
export declare function getRepairCoordinator(apiKey?: string, baseURL?: string): RepairCoordinator;
/**
 * Reset the global RepairCoordinator instance
 */
export declare function resetRepairCoordinator(): void;
export type { TestExecutor, CommandExecutor, FileReader, FileWriter, } from "../repair/index.js";
