/** * MemoryMonitor — Real-time heap usage tracking. * * Monitors V8 heap usage at configurable intervals and fires a callback * when usage exceeds a threshold. Used internally for Pro diagnostics * and available to consumers for custom memory management. * * The monitor uses `timer.unref()` so it never prevents Node.js from exiting. */ export interface MemorySnapshot { /** V8 heap used (allocated objects) in MB */ heapUsedMB: number; /** V8 heap total (allocated by V8, including free slots) in MB */ heapTotalMB: number; /** RSS (Resident Set Size — total process memory) in MB */ rssMB: number; /** External memory (Buffers, etc.) in MB */ externalMB: number; /** ISO 8601 timestamp */ timestamp: string; } export interface MemoryMonitorOptions { /** * Polling interval in milliseconds. * @default 1000 */ intervalMs?: number; /** * Heap usage threshold in MB that triggers the warning callback. * @default 200 */ warningThresholdMB?: number; /** * Called when heap usage exceeds `warningThresholdMB`. * @default logs a console.warn message */ onWarning?: (snapshot: MemorySnapshot) => void; /** * Called on every interval tick (for logging / dashboards). */ onTick?: (snapshot: MemorySnapshot) => void; } export declare class MemoryMonitor { private timer; private readonly opts; constructor(options?: MemoryMonitorOptions); /** Start monitoring. Idempotent — safe to call multiple times. */ start(): void; /** Stop monitoring. */ stop(): void; /** Whether monitoring is currently active. */ get isRunning(): boolean; /** * Take a one-shot memory snapshot. * Static — can be called without an instance. */ static snapshot(): MemorySnapshot; /** * Format a snapshot as a human-readable string. * @example "Heap: 45.3 / 67.2 MB | RSS: 89.1 MB" */ static format(snap: MemorySnapshot): string; } //# sourceMappingURL=memory-monitor.d.ts.map