import { app } from 'electron'; export interface AppMetricsProcessSnapshot { pid: number; type: string; workingSetKb: number | null; } export interface AppMetricsSnapshot { collectedAt: number; processes: AppMetricsProcessSnapshot[]; } export function collectAppMetricsSnapshot(): AppMetricsSnapshot { return { collectedAt: Date.now(), processes: app.getAppMetrics().map((metric) => ({ pid: metric.pid, type: metric.type, workingSetKb: metric.memory?.workingSetSize ?? null })) }; }