/**
 * WakeSocketServer — Server-side Unix domain socket that receives
 * wake signals from the listener daemon.
 *
 * Part of RFC: Persistent Listener Daemon Architecture (Phase 1).
 *
 * The daemon sends a 1-byte signal (\x01) when a new inbox entry is written.
 * The server picks this up immediately (event-driven, no polling) and routes
 * the message via ThreadlineRouter.
 *
 * Security:
 * - Socket created with 0600 permissions (owner only)
 * - Peer credentials verified via SO_PEERCRED (Linux) / LOCAL_PEERCRED (macOS)
 * - Socket path resolved via fs.realpathSync() to prevent symlink attacks
 */
import { EventEmitter } from 'node:events';
export interface WakeSocketEvents {
    /** New inbox entry available */
    wake: () => void;
    /** Peer agent disconnected — evaluate failover */
    'failover-trigger': () => void;
    error: (err: Error) => void;
    'client-connected': () => void;
    'client-disconnected': () => void;
}
export declare class WakeSocketServer extends EventEmitter {
    private server;
    private socketPath;
    private clients;
    private wakeCount;
    constructor(stateDir: string);
    /**
     * Start listening on the Unix domain socket.
     *
     * Recovery sequence on EADDRINUSE:
     *   1. Pre-unlink any existing socket file (cleans up after unclean exits).
     *   2. If listen() fires EADDRINUSE anyway, probe the socket: a live peer
     *      will accept our connect; a stale file will refuse with ENOENT/ECONNREFUSED.
     *   3. If no live peer, force-unlink and retry listen once.
     *
     * This handles the "stale listener.sock after crash" failure mode without
     * clobbering a genuinely running second instance.
     */
    start(): void;
    private attemptListen;
    /**
     * EADDRINUSE recovery: probe the socket. If we can connect, a live peer
     * is bound — propagate the error. If connect refuses/fails, the socket is
     * stale; force-unlink and retry listen once.
     */
    private probeAndRetry;
    /**
     * Stop the socket server and clean up.
     */
    stop(): void;
    /**
     * Get the number of wake signals received.
     */
    get totalWakes(): number;
    /**
     * Check if daemon is connected.
     */
    get isDaemonConnected(): boolean;
}
//# sourceMappingURL=WakeSocketServer.d.ts.map