import { readPid } from '../config.js'; import { type ShutdownPolicy } from './shutdown-policy.js'; export declare const DAEMON_EXIT_POLL_INTERVAL_MS = 500; /** Canonical owner-scoped boundary for the daemon PID and shutdown policy. */ export declare const daemonRuntimeState: { claim(pid: number, policy: ShutdownPolicy): Promise; readPid: typeof readPid; readPolicy(expectedPid: number): Promise; resolveWaitTimeoutMs(expectedPid: number): Promise; release(expectedPid: number): Promise; }; interface WaitForDaemonExitOptions { timeoutMs?: number; pollIntervalMs?: number; now?: () => number; sleep?: (ms: number) => Promise; isRunning?: (pid: number) => boolean; } /** Wait for a known worker PID to exit without exceeding the shutdown policy. */ export declare function waitForDaemonExit(pid: number, options?: WaitForDaemonExitOptions): Promise; export type DaemonShutdownResult = { status: 'not-running'; pid: number | null; } | { status: 'stopped'; pid: number | null; timeoutMs?: number; cleanupError?: unknown; } | { status: 'timed-out'; pid: number; timeoutMs: number; }; export interface DaemonShutdownCoordinator { stopViaApi(requestShutdown: () => Promise): Promise; stopViaSignal(): Promise; } interface DaemonShutdownCoordinatorIo { runtimeState: Pick; isRunning(pid: number): boolean; kill(pid: number, signal: NodeJS.Signals): void; waitForExit(pid: number, timeoutMs: number): Promise; } /** Build the single lifecycle coordinator; low-level process I/O is injected here once. */ export declare function createDaemonShutdownCoordinator(io?: DaemonShutdownCoordinatorIo): DaemonShutdownCoordinator; export declare const daemonShutdownCoordinator: DaemonShutdownCoordinator; interface DaemonShutdownReporter { log(message: string): void; error(message: string): void; } /** Keep presentation at the command boundary while the coordinator owns lifecycle I/O. */ export declare function reportDaemonShutdownResult(result: DaemonShutdownResult, reporter?: DaemonShutdownReporter): boolean; export {}; //# sourceMappingURL=shutdown-wait.d.ts.map