/** * Machine-level system stats for the hub's GET /api/system-stats endpoint. * * Everything is BEST-EFFORT and INDEPENDENTLY degradable: each source runs in * its own subprocess (or falls back to a Node builtin) and a failure yields a * null field, never an error — the hub can run inside a Seatbelt wrap where * `ps`/`pmset` are denied, and a phone checking the machine's health must * still get every field that IS readable. Rate fields (CPU %, network B/s, * hub CPU %) are sampled from the DELTA between consecutive calls: the hub is * resident, so it keeps the last counter snapshot in memory; the first call * after boot has no baseline and reports null (clients poll, the second call * has real values). */ export interface VolumeStats { totalBytes: number; usedBytes: number; availableBytes: number; } export interface SystemStats { collectedAt: number; host: { hostname: string; /** e.g. "15.8 (24H23)" — null when `sw_vers` is unavailable. */ osVersion: string | null; /** Hardware model id, e.g. "Mac14,9". */ model: string | null; /** Chip description from the CPU table, e.g. "Apple M2 Pro". */ chip: string | null; }; uptimeS: number; cpu: { cores: number; /** Delta of os.cpus() idle/total across calls; null before a baseline exists. */ usagePct: number | null; loadAvg: [number, number, number]; }; memory: { totalBytes: number; /** free+speculative+inactive+purgeable pages (≈ Activity Monitor's "available"); os.freemem() fallback. */ availableBytes: number | null; usedBytes: number | null; swapTotalBytes: number | null; swapUsedBytes: number | null; }; storage: { root: VolumeStats | null; /** Same object as `root` is omitted (null) — one boot volume is the norm on macOS. */ home: VolumeStats | null; }; battery: { present: boolean; percent: number | null; powerSource: "ac" | "battery" | null; /** Raw pmset wording: charging / discharging / charged / finishing charge … */ status: string | null; remainingMin: number | null; }; power: { /** True while something holds PreventUserIdleSystemSleep — the machine will not idle-sleep. */ preventSleep: boolean | null; /** Processes holding that assertion (e.g. ["Amphetamine"]). */ sleepHolders: string[]; /** Thermal CPU speed limit (100 = full speed; null = no reading recorded). */ cpuSpeedLimitPct: number | null; }; network: { /** Non-internal IPv4 addresses (Node builtin, always available). */ addresses: string[]; ssid: string | null; /** Summed over all interfaces except lo0, delta across calls. */ rxBytesPerS: number | null; txBytesPerS: number | null; }; processes: { hub: { pid: number; rssBytes: number; cpuPct: number | null; }; /** One entry per registered bridge; rss/cpuPct via `ps` (approximate), null when denied. */ bridges: Array<{ id: string; workspace: string | null; pid: number | null; rssBytes: number | null; cpuPct: number | null; }>; }; hub: { version: string; uptimeS: number; instances: number; }; } export interface BridgeProcessInfo { id: string; pid: number | null; workspace: string | null; } export interface VmStatPageCounts { pageSizeBytes: number; free: number; speculative: number; inactive: number; purgeable: number; } export declare function parseVmStatOutput(out: string): VmStatPageCounts | null; export declare function parseSwapUsage(out: string): { totalBytes: number; usedBytes: number; } | null; export declare function parsePmsetBattery(out: string): { present: boolean; percent: number | null; powerSource: "ac" | "battery" | null; status: string | null; remainingMin: number | null; }; export declare function parsePmsetTherm(out: string): number | null; export declare function parseSleepAssertions(out: string): { active: boolean | null; holders: string[]; }; export declare function parseNetstatIfaceBytes(out: string): { rx: number; tx: number; } | null; /** Wi-Fi device name (e.g. "en0") from `networksetup -listallhardwareports`. */ export declare function parseWifiDevice(out: string): string | null; export declare function parseAirportNetwork(out: string): string | null; export declare function resetSystemStatsStateForTest(): void; export interface HubMeta { version: string; instances: number; } export declare function collectSystemStats(bridges: BridgeProcessInfo[], hubMeta: HubMeta): Promise; //# sourceMappingURL=system-stats.d.ts.map