/**
 * GPU VRAM Monitor
 *
 * Monitors GPU memory usage for local LLM inference.
 * Supports AMD (ROCm) and NVIDIA (nvidia-smi) GPUs.
 *
 * Features:
 * - Real-time VRAM monitoring
 * - Dynamic offloading recommendations
 * - Warning thresholds
 * - Multi-GPU support
 */
import { EventEmitter } from "events";
/**
 * GPU vendor types
 */
export type GPUVendor = "nvidia" | "amd" | "intel" | "apple" | "unknown";
/**
 * GPU information structure
 */
export interface GPUInfo {
    id: number;
    name: string;
    vendor: GPUVendor;
    vramTotal: number;
    vramUsed: number;
    vramFree: number;
    utilization: number;
    temperature?: number;
    powerDraw?: number;
}
/**
 * VRAM usage statistics
 */
export interface VRAMStats {
    totalVRAM: number;
    usedVRAM: number;
    freeVRAM: number;
    usagePercent: number;
    gpuCount: number;
    gpus: GPUInfo[];
    timestamp: Date;
}
/**
 * Offloading recommendation
 */
export interface OffloadRecommendation {
    shouldOffload: boolean;
    suggestedGpuLayers: number;
    maxGpuLayers: number;
    reason: string;
    estimatedVRAMUsage: number;
    safeVRAMLimit: number;
}
/**
 * Monitor configuration
 */
export interface GPUMonitorConfig {
    /** Polling interval in milliseconds */
    pollInterval: number;
    /** Warning threshold (percentage) */
    warningThreshold: number;
    /** Critical threshold (percentage) */
    criticalThreshold: number;
    /** Enable auto-polling */
    autoPoll: boolean;
    /** Safe VRAM buffer (MB) to keep free */
    safeBuffer: number;
}
/**
 * Default configuration
 */
export declare const DEFAULT_GPU_MONITOR_CONFIG: GPUMonitorConfig;
/**
 * GPU Memory Monitor
 *
 * Monitors GPU VRAM usage and provides recommendations for
 * model layer offloading to prevent OOM errors.
 */
export declare class GPUMonitor extends EventEmitter {
    private config;
    private pollTimer;
    private lastStats;
    private detectedVendor;
    constructor(config?: Partial<GPUMonitorConfig>);
    /**
     * Initialize monitor and detect GPU vendor
     */
    initialize(): Promise<GPUVendor>;
    /**
     * Detect GPU vendor
     */
    private detectGPUVendor;
    /**
     * Get current VRAM statistics
     */
    getStats(): Promise<VRAMStats>;
    /**
     * Query GPU information based on vendor
     */
    private queryGPUs;
    /**
     * Query NVIDIA GPUs via nvidia-smi
     */
    private queryNVIDIA;
    /**
     * Query AMD GPUs via rocm-smi or sysfs
     */
    private queryAMD;
    /**
     * Query Apple Silicon unified memory
     */
    private queryApple;
    /**
     * Query Intel GPUs
     */
    private queryIntel;
    /**
     * Generic GPU query (fallback)
     */
    private queryGeneric;
    /**
     * Check usage thresholds and emit warnings
     */
    private checkThresholds;
    /**
     * Calculate offloading recommendation for a model
     *
     * @param modelSizeMB - Model size in MB (e.g., 7000 for 7B Q4)
     * @param totalLayers - Total number of layers in the model
     * @param contextSize - Context size in tokens
     */
    calculateOffloadRecommendation(modelSizeMB: number, totalLayers?: number, contextSize?: number): OffloadRecommendation;
    /**
     * Get recommended GPU layers for common model sizes
     */
    getRecommendedLayers(modelSize: "3b" | "7b" | "13b" | "30b" | "70b"): Promise<number>;
    /**
     * Format stats for display
     */
    formatStats(): string;
    /**
     * Create ASCII progress bar
     */
    private createProgressBar;
    /**
     * Start automatic polling
     */
    startPolling(): void;
    /**
     * Stop automatic polling
     */
    stopPolling(): void;
    /**
     * Get detected vendor
     */
    getVendor(): GPUVendor;
    /**
     * Get last cached stats
     */
    getLastStats(): VRAMStats | null;
    /**
     * Update configuration
     */
    updateConfig(config: Partial<GPUMonitorConfig>): void;
    /**
     * Get configuration
     */
    getConfig(): GPUMonitorConfig;
    /**
     * Dispose monitor
     */
    dispose(): void;
}
/**
 * Get or create GPU monitor instance
 */
export declare function getGPUMonitor(config?: Partial<GPUMonitorConfig>): GPUMonitor;
/**
 * Initialize GPU monitor (async)
 */
export declare function initializeGPUMonitor(config?: Partial<GPUMonitorConfig>): Promise<GPUMonitor>;
/**
 * Reset GPU monitor singleton
 */
export declare function resetGPUMonitor(): void;
declare const _default: {
    GPUMonitor: typeof GPUMonitor;
    getGPUMonitor: typeof getGPUMonitor;
    initializeGPUMonitor: typeof initializeGPUMonitor;
    resetGPUMonitor: typeof resetGPUMonitor;
    DEFAULT_GPU_MONITOR_CONFIG: GPUMonitorConfig;
};
export default _default;
