/** * Error Pattern Matcher - Identifies common error patterns and provides recovery suggestions * * Based on Agent Harness theory: "Error recovery is primarily model-driven. * Failed tool executions return error messages as tool results to the model" */ export interface ErrorPattern { name: string; description: string; regex: RegExp; suggestion: string; autoRetry: boolean; maxRetries: number; severity: 'low' | 'medium' | 'high' | 'critical'; } export interface ErrorMatchResult { matched: boolean; pattern?: ErrorPattern; originalError: string; suggestion: string; shouldRetry: boolean; maxRetries: number; } export interface ErrorPatternMatcherConfig { enabled: boolean; patterns: ErrorPattern[]; defaultMaxRetries: number; logMatches: boolean; } export declare class ErrorPatternMatcher { private config; private matchHistory; constructor(config?: Partial); /** * Match error against known patterns */ matchError(error: string): ErrorMatchResult; /** * Get recovery suggestion for an error */ getRecoverySuggestion(error: string): string; /** * Check if error should be retried */ shouldRetry(error: string): boolean; /** * Get max retries for an error */ getMaxRetries(error: string): number; /** * Get error statistics */ getStats(): { totalMatches: number; byPattern: Map; topErrors: Array<{ name: string; count: number; }>; }; /** * Get error report as text */ getReportText(): string; /** * Reset match history */ reset(): void; /** * Add custom error pattern */ addPattern(pattern: ErrorPattern): void; /** * Remove error pattern by name */ removePattern(name: string): boolean; /** * Get all patterns */ getPatterns(): ErrorPattern[]; /** * Get config */ getConfig(): ErrorPatternMatcherConfig; /** * Update config */ setConfig(config: Partial): void; }