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
90 lines • 2.26 kB
TypeScript
/**
* Resource Leak Detector
* Identifies and prevents common resource leaks that cause crashes
*/
import { EventEmitter } from 'events';
export interface LeakDetection {
type: 'memory' | 'handles' | 'eventListeners' | 'timers' | 'promises';
severity: 'low' | 'medium' | 'high' | 'critical';
count: number;
threshold: number;
description: string;
recommendations: string[];
}
export interface ResourceSnapshot {
timestamp: number;
memoryUsage: NodeJS.MemoryUsage;
activeHandles: number;
activeRequests: number;
eventListenerCount: number;
timerCount: number;
}
export declare class ResourceLeakDetector extends EventEmitter {
private static instance;
private monitoringInterval;
private snapshots;
private maxSnapshots;
private thresholds;
static getInstance(): ResourceLeakDetector;
/**
* Start leak detection monitoring
*/
startMonitoring(): void;
/**
* Stop monitoring
*/
stopMonitoring(): void;
/**
* Take a resource usage snapshot
*/
private takeSnapshot;
/**
* Get active handle count
*/
private getActiveHandles;
/**
* Get active request count
*/
private getActiveRequests;
/**
* Estimate event listener count
*/
private getEventListenerCount;
/**
* Get active timer count (approximate)
*/
private getTimerCount;
/**
* Analyze for potential leaks
*/
private analyzeLeaks;
/**
* Detect memory leaks through growth pattern analysis
*/
private detectMemoryLeak;
/**
* Log leak detection
*/
private logLeakDetection;
/**
* Get current resource status
*/
getCurrentStatus(): ResourceSnapshot | null;
/**
* Get resource history
*/
getResourceHistory(): ResourceSnapshot[];
/**
* Force immediate leak analysis
*/
performLeakAnalysis(): LeakDetection[];
/**
* Update detection thresholds
*/
updateThresholds(thresholds: Partial<typeof this.thresholds>): void;
/**
* Attempt automatic leak mitigation
*/
attemptLeakMitigation(detection: LeakDetection): boolean;
}
//# sourceMappingURL=resource-leak-detector.d.ts.map