export interface ProcessInfo { ppid: number; command: string; } export interface ProcessProbe { /** Parent pid + command for a pid, or null if the pid is gone/unreadable. */ info(pid: number): ProcessInfo | null; /** Whether the pid still exists. */ isAlive(pid: number): boolean; } export interface ClientIdentity { pid: number; command: string; } /** Reads process info via `ps`. Unavailable on Windows, which has no `ps`. */ export declare const systemProcessProbe: ProcessProbe; /** * Walk up from `startPid`'s parent and return the first ancestor that isn't * launch plumbing, or null if there is none. */ export declare function resolveClientIdentity(startPid: number, probe: ProcessProbe, maxDepth?: number): ClientIdentity | null; export interface ClientWatcherOptions { /** How often to check the client is still alive (default: 60s). */ pollIntervalMs?: number; probe?: ProcessProbe; logStderr?: (message: string) => void; } /** * Polls the resolved client's liveness and calls back once, when it dies. * Does nothing at all when no client could be resolved. */ export declare class ClientWatcher { private readonly options; private timer; private readonly probe; private readonly pollIntervalMs; private readonly logStderr; private client; constructor(options?: ClientWatcherOptions); getClient(): ClientIdentity | null; /** * Resolve the client and start watching. Returns the client it will watch, * or null if none could be resolved (in which case nothing is watched). */ start(startPid: number, onClientGone: (client: ClientIdentity) => void): ClientIdentity | null; stop(): void; } //# sourceMappingURL=client-watcher.d.ts.map