export type ProcessInfo = { pid: number; name: string; command: string; cpu: number; mem: number; started: string; }; export type ProcessSnapshot = { ts: number; activeApp: string; activeWindowTitle: string; processes: ProcessInfo[]; /** * The enumeration hit MAX_PROCESSES and is a window onto the machine, not the * whole of it. Absence from a truncated window is not evidence of exit, so * the differ must not infer exits from it. */ truncated: boolean; }; export type ProcessChanges = { newProcesses: ProcessInfo[]; exitedProcesses: ProcessInfo[]; appSwitch: { from: string; to: string; } | null; highCpu: ProcessInfo[]; }; /** * Capture a privacy-minimized snapshot of running processes. macOS also reports * the active window; Windows omits command-line arguments; Linux uses ps. */ export declare function captureProcesses(): Promise; /** Graph identity for a process. Must match runtimeStableId, which lowercases * the name — a PID-keyed differ reports a same-name respawn as new while the * graph sees no change at all, and the two disagree forever. */ export declare function processKey(proc: ProcessInfo): string; /** * Compute changes between two successive process snapshots. * * Keyed by name rather than PID so the diff matches the identity the graph * stores. Short-lived helpers that respawn under the same name — a console * host, a shell — no longer register as a create plus an exit on every tick. */ export declare function processChanges(prev: ProcessSnapshot, curr: ProcessSnapshot): ProcessChanges; /** * Track which process NAMES are currently running so exited ones can be * tombstoned in the graph. Runtime nodes are keyed by NAME, not PID, so a single * PID exiting is not enough (another process of the same name may still run). * * Stamps every current name to `now`, then returns the names that have been * ABSENT for longer than `graceMs` — so one noisy or missed snapshot never * tombstones a live process — removing each from the map so it is emitted once * and re-seeds if it reappears. Pure and timer-free, so it is unit-testable. * * A truncated snapshot only ever stamps: it is a window onto the machine, so a * live process that slips below the cap is absent from the view without having * exited, and the grace window cannot tell those apart. */ export declare function reconcileRuntimeSeen(lastSeen: Map, snapshot: ProcessSnapshot, now: number, graceMs: number): string[];