import { type ProcessIdentity } from "./processes.js"; export declare const SERVER_LOCK_SCHEMA: "pi-workflows.server-lock.v1"; /** Grace between the graceful stop request and the forced stop. */ export declare const SERVER_STOP_GRACE_MS = 5000; /** One lock record names the server process and fences a reused process ID. */ export type ServerLockRecord = ProcessIdentity & { serverId: string; }; export type RecordedServerStop = { pid: number; serverId: string; /** True when the process ignored the graceful request and a forced stop followed. */ forced: boolean; /** True when the recorded process no longer holds its start identity. */ exited: boolean; }; export declare function serverDirectoryPath(databasePath: string): string; export declare function serverLockPath(databasePath: string): string; export declare function isServerLockRecord(value: unknown): value is ServerLockRecord; /** Read the recorded server, or return undefined for a missing or unusable lock file. */ export declare function readServerLock(lockPath: string): ServerLockRecord | undefined; export declare function writeServerLock(lockPath: string, record: ServerLockRecord): void; /** * Stop the server named by the lock file when the recorded process still has its start * identity. A client whose package version differs from the running server cannot send a * stop request, so the lock file is the only path to that stale process. A record whose * process is gone, or whose process ID now belongs to another process, stops nothing. */ export declare function stopRecordedServer(lockPath: string, options?: { graceMs?: number; }): Promise;