/**
 * Performance Manager
 *
 * Central orchestrator for all performance optimizations:
 * - Coordinates lazy loading, caching, and request optimization
 * - Provides unified API for performance monitoring
 * - Manages performance budgets and thresholds
 */
import { EventEmitter } from 'events';
import { LazyLoader } from './lazy-loader.js';
import { ToolCache, ToolCacheStats } from './tool-cache.js';
import { RequestOptimizer, RequestStats } from './request-optimizer.js';
export interface PerformanceConfig {
    /** Enable performance optimizations */
    enabled: boolean;
    /** Enable lazy loading */
    lazyLoading: boolean;
    /** Enable tool caching */
    toolCaching: boolean;
    /** Enable request optimization */
    requestOptimization: boolean;
    /** Enable API caching */
    apiCaching: boolean;
    /** Performance budget in ms */
    budgetMs: number;
    /** Enable performance logging */
    enableMetrics: boolean;
    /** Metrics retention count */
    metricsRetention: number;
}
export interface PerformanceMetrics {
    timestamp: number;
    operation: string;
    duration: number;
    cached: boolean;
    success: boolean;
    metadata?: Record<string, unknown>;
}
export interface PerformanceSummary {
    lazyLoader: {
        totalModules: number;
        loadedModules: number;
        totalLoadTime: number;
        averageLoadTime: number;
    };
    toolCache: ToolCacheStats;
    requestOptimizer: RequestStats;
    apiCache: {
        hits: number;
        misses: number;
        hitRate: number;
        entries: number;
    };
    overall: {
        totalOperations: number;
        cachedOperations: number;
        cacheHitRate: number;
        averageDuration: number;
        estimatedTimeSaved: number;
    };
}
export declare class PerformanceManager extends EventEmitter {
    private config;
    private lazyLoader;
    private toolCache;
    private requestOptimizer;
    private apiCache;
    private metrics;
    private initialized;
    constructor(config?: Partial<PerformanceConfig>);
    /**
     * Initialize all performance systems
     */
    initialize(): Promise<void>;
    /**
     * Record a performance metric
     */
    recordMetric(metric: Omit<PerformanceMetrics, 'timestamp'>): void;
    /**
     * Measure an async operation
     */
    measure<T>(operation: string, fn: () => Promise<T>, metadata?: Record<string, unknown>): Promise<T>;
    /**
     * Get performance summary
     */
    getSummary(): PerformanceSummary;
    /**
     * Get recent metrics
     */
    getMetrics(limit?: number): PerformanceMetrics[];
    /**
     * Get slow operations
     */
    getSlowOperations(thresholdMs?: number): PerformanceMetrics[];
    /**
     * Clear all caches
     */
    clearCaches(): void;
    /**
     * Invalidate caches for a file
     */
    invalidateForFile(filePath: string): void;
    /**
     * Reset all statistics
     */
    resetStats(): void;
    /**
     * Get lazy loader instance
     */
    getLazyLoader(): LazyLoader | null;
    /**
     * Get tool cache instance
     */
    getToolCache(): ToolCache | null;
    /**
     * Get request optimizer instance
     */
    getRequestOptimizer(): RequestOptimizer | null;
    /**
     * Update configuration
     */
    updateConfig(config: Partial<PerformanceConfig>): void;
    /**
     * Dispose all resources
     */
    dispose(): void;
    private setupLazyLoaderEvents;
    private setupToolCacheEvents;
    private setupRequestOptimizerEvents;
}
export declare function getPerformanceManager(config?: Partial<PerformanceConfig>): PerformanceManager;
export declare function initializePerformanceManager(config?: Partial<PerformanceConfig>): Promise<PerformanceManager>;
export declare function resetPerformanceManager(): void;
/**
 * Measure an async operation with automatic recording
 */
export declare function measureOperation<T>(operation: string, fn: () => Promise<T>, metadata?: Record<string, unknown>): Promise<T>;
/**
 * Get a quick performance summary
 */
export declare function getPerformanceSummary(): PerformanceSummary;
