import type { Host } from "../../host/host.js"; import { type FocusReply } from "./protocol.js"; import { type SessionRecord } from "./record.js"; export declare function sessionsDir(host: Pick): string; export declare function recordPaths(dir: string, pid: number): { json: string; sock: string; }; export declare function ensureSessionsDir(dir: string): void; export declare function writeRecord(dir: string, record: SessionRecord): void; /** Remove one viewer's record and socket. Paths are built here from the * directory and a pid, never taken from outside, so this can only ever * delete files a viewer wrote. */ export declare function removeRecord(dir: string, pid: number): void; export declare function listRecords(dir: string): SessionRecord[]; export type ProbeResult = { state: "live"; focus: FocusReply; } /** The process is alive but did not answer in time: a viewer suspended * with Ctrl+Z. Kept, never deleted. */ | { state: "not-responding"; } /** The process is gone. */ | { state: "stale"; }; export type ProbedRecord = { record: SessionRecord; result: ProbeResult; }; export declare function probe(dir: string, record: SessionRecord, timeoutMs?: number): Promise; export declare function probeAll(dir: string, timeoutMs?: number): Promise; /** Delete the records whose process is gone, and nothing else. */ export declare function removeStale(dir: string, probed: readonly ProbedRecord[]): SessionRecord[];