/**
 * Self-Healing
 *
 * Recognizes error patterns and applies automatic fix strategies.
 * Escalates after max attempts.
 */
import { EventEmitter } from 'events';
export interface ErrorPattern {
    name: string;
    pattern: RegExp;
    strategy: HealingStrategy;
    priority: number;
}
export type HealingStrategy = 'retry' | 'retry_with_backoff' | 'change_permissions' | 'install_dependency' | 'fix_syntax' | 'escalate' | 'custom';
export interface HealingResult {
    healed: boolean;
    strategy: HealingStrategy;
    attempts: number;
    error?: string;
    fixApplied?: string;
}
export interface ToolContext {
    toolName: string;
    args: Record<string, unknown>;
    workingDirectory: string;
}
export declare class SelfHealing extends EventEmitter {
    private patterns;
    private customStrategies;
    constructor();
    /**
     * Add a custom error pattern
     */
    addPattern(pattern: ErrorPattern): void;
    /**
     * Register a custom healing strategy
     */
    registerStrategy(name: string, handler: (error: Error, context: ToolContext) => Promise<boolean>): void;
    /**
     * Attempt to heal an error
     */
    attemptHeal(error: Error, context: ToolContext, maxAttempts?: number, retryAction?: () => Promise<unknown>): Promise<HealingResult>;
    /**
     * Match an error to a pattern (without healing)
     */
    matchPattern(error: Error): ErrorPattern | null;
    /**
     * Get all registered patterns
     */
    getPatterns(): ErrorPattern[];
}
export declare function getSelfHealing(): SelfHealing;
export declare function resetSelfHealing(): void;
