ai-debug-local-mcp
Version:
🎯 ENHANCED AI GUIDANCE v4.1.2: Dramatically improved tool descriptions help AI users choose the right tools instead of 'close enough' options. Ultra-fast keyboard automation (10x speed), universal recording, multi-ecosystem debugging support, and compreh
86 lines • 2.17 kB
TypeScript
/**
* Tool Execution Safety System
* Provides isolation, timeouts, and retry mechanisms for tool execution
*/
export interface ExecutionOptions {
timeout?: number;
maxRetries?: number;
retryDelay?: number;
circuitBreakerThreshold?: number;
}
export interface ExecutionResult<T = any> {
success: boolean;
result?: T;
error?: Error;
executionTime: number;
retryCount: number;
circuitBreakerTriggered: boolean;
}
export declare class ToolExecutionSafetyWrapper {
private static instance;
private circuitBreakers;
private executionMetrics;
static getInstance(): ToolExecutionSafetyWrapper;
/**
* Execute a tool with safety wrapper including timeouts, retries, and circuit breaker
*/
executeTool<T>(toolName: string, handler: () => Promise<T>, options?: ExecutionOptions): Promise<ExecutionResult<T>>;
/**
* Create timeout promise that rejects after specified time
*/
private createTimeoutPromise;
/**
* Check if error is critical (shouldn't retry)
*/
private isCriticalError;
/**
* Get or create circuit breaker for tool
*/
private getCircuitBreaker;
/**
* Record successful execution
*/
private recordSuccess;
/**
* Record failed execution
*/
private recordFailure;
/**
* Get or create execution metrics for tool
*/
private getOrCreateMetrics;
/**
* Get execution statistics for monitoring
*/
getExecutionStats(): ExecutionStats;
/**
* Reset circuit breaker for a tool
*/
resetCircuitBreaker(toolName: string): void;
/**
* Sleep utility for retry delays
*/
private sleep;
}
/**
* Execution metrics interface
*/
interface ExecutionMetrics {
toolName: string;
successCount: number;
failureCount: number;
lastExecutionTime: number;
lastError: string | null;
}
/**
* Execution statistics interface
*/
interface ExecutionStats {
tools: {
[key: string]: ExecutionMetrics;
};
totalTools: number;
circuitBreakersOpen: number;
}
export {};
//# sourceMappingURL=tool-execution-safety.d.ts.map