/**
 * Stale process detection and recovery (#1850).
 *
 * Finds and kills zombie DollhouseMCP processes that squat on the console
 * port after their session has ended. Used by bindAndListen in server.ts
 * when EADDRINUSE occurs.
 *
 * Extracted to a standalone module so it can be tested without importing
 * the full Express server and its dependency chain.
 */
export interface KillStaleProcessOutcome {
    killed: boolean;
    reason: 'inspect_failed' | 'different_user' | 'not_dollhouse_process' | 'active_host_parent' | 'terminated' | 'already_dead' | 'still_alive' | 'signal_failed';
    pid: number;
    parentPid?: number;
    command?: string;
    parentCommand?: string;
    detail?: string;
}
export interface KillStaleProcessOptions {
    allowActiveHostParent?: boolean;
}
export declare function isRecognizedMcpHostParent(command: string): boolean;
/**
 * Find the PID of the process listening on a given port.
 * Uses lsof on macOS/Linux. Returns null if not found or on error.
 *
 * Timeout: 1s — lsof on localhost is typically <100ms. The 1s ceiling
 * handles slow NFS-mounted /dev/fd or overloaded CI runners without
 * delaying startup noticeably.
 */
export declare function findPidOnPort(port: number): Promise<number | null>;
/**
 * Kill a stale process holding a port. Sends SIGTERM, waits briefly,
 * then SIGKILL if still alive. Only kills DollhouseMCP processes
 * (verified by checking the command line and user ownership).
 *
 * Timeout: 1s for ps verification. Kill wait: 300ms × 10 polls = 3s
 * before escalating to SIGKILL. Total worst case: ~4s.
 */
export declare function killStaleProcess(pid: number, port: number): Promise<boolean>;
export declare function killStaleProcessDetailed(pid: number, port: number, options?: KillStaleProcessOptions): Promise<KillStaleProcessOutcome>;
/**
 * Detect and recover from a stale process squatting on the port.
 * Compares the port holder's PID against the leader lock file to determine
 * if it's a squatter. Returns true if the squatter was killed.
 *
 * Timeouts: lsof 1s, ps 1s, SIGTERM wait 3s — max ~5s total.
 */
export declare function recoverStalePort(port: number): Promise<boolean>;
//# sourceMappingURL=StaleProcessRecovery.d.ts.map