import type { IControllerFilesystemUsage, IControllerSystemMetrics } from '../dist_ts_interfaces/index.js'; /** * One filesystem as the probe reports it. Shaped after * `@modelprofile.com/mcp-system`'s `IFilesystemStatus`, and read defensively: * the sampler never trusts a probe's numbers without checking them. */ interface IRawFilesystemUsage { mountPoint?: unknown; fsType?: unknown; available?: unknown; totalBytes?: unknown; usedBytes?: unknown; usedPercent?: unknown; reasons?: unknown; /** Cumulative counters of the disks behind the mount (`IFilesystemIo`). */ io?: unknown; ioUnavailableReason?: unknown; } interface IFilesystemSource { listFilesystems: () => Promise; } /** Shaped after `@modelprofile.com/mcp-system`'s `IIoPressure`, read as defensively. */ interface IRawIoPressure { someAvg10?: unknown; someAvg60?: unknown; fullAvg10?: unknown; fullAvg60?: unknown; } interface IIoPressureSource { readIoPressure: () => Promise; } interface ISystemMetricsSource { stop?: () => Promise; currentLoad: () => Promise<{ currentLoad: number; }>; mem: () => Promise<{ active: number; total: number; }>; networkInterfaces: () => Promise>; networkStats: (interfaces: string) => Promise>; } interface IRawSystemMetrics { cpuUsagePercent?: unknown; memoryUsedBytes?: unknown; memoryTotalBytes?: unknown; networkStats?: Array<{ rx_sec?: unknown; tx_sec?: unknown; }>; filesystems?: IRawFilesystemUsage[]; /** Disk activity per mount point, measured across consecutive listings. */ diskActivity?: ReadonlyMap; ioPressure?: IRawIoPressure | null; } type TDiskActivity = Pick; interface ISystemMetricsSamplerOptions { source?: ISystemMetricsSource; filesystemSource?: IFilesystemSource; ioPressureSource?: IIoPressureSource; now?: () => number; sampleTimeoutMs?: number; } export declare const normalizeSystemMetrics: (sampledAtArg: number, rawArg: IRawSystemMetrics) => IControllerSystemMetrics; export declare class SystemMetricsSampler { private readonly source; private readonly filesystemSource; private readonly now; private readonly sampleTimeoutMs; private readonly cpuRead; private readonly memoryRead; private readonly networkRead; private readonly filesystemRead; private readonly ioPressureRead; /** Each mount's disk counters from the last listing that reported them. */ private diskIoBaselines; private cachedSample; private inFlightSample; private stopped; private stopPromise; private recordingTimer; private recordingPromise; private recorder; private lastRecordedBucket; private lastPrunedBucket; constructor(optionsArg?: ISystemMetricsSamplerOptions); sample(): Promise; /** Collects history even when no browser has the Stats panel open. */ startRecording(recorderArg: { record: (metricsArg: IControllerSystemMetrics) => Promise; prune: () => Promise; }): void; private scheduleRecording; private recordOneSample; stop(): Promise; private readFreshSample; private readSourceMetrics; /** * Advances the disk counter baselines by one listing. A listing that did not * arrive leaves them untouched, so the next one still measures against them. */ private advanceDiskIoBaselines; private withTimeout; private readNetworkStats; } export {};