/**
 * Daemon IPC: a tiny Unix-socket RPC server that lets a TUI ask the
 * running daemon "what subscriptions are active?".
 *
 * Protocol: newline-delimited JSON. Each request is one line of
 * `{id, method, params?}`; each response is `{id, result | error}`.
 *
 * Kept deliberately small - no msgpack, no schema validation library,
 * no auth. The socket lives inside `.nanocoder/` so it inherits the
 * project root's filesystem permissions.
 *
 * See `agents/2026-05-20-skills-unification-plan.md` step 19.
 */
import type { Subscription } from '../events/types.js';
export interface IpcRequest {
    id: number;
    method: 'listSubscriptions' | 'ping' | 'shutdown';
    params?: unknown;
}
export interface IpcResponse {
    id: number;
    result?: unknown;
    error?: string;
}
export interface IpcHandlers {
    listSubscriptions(): Subscription[];
    /**
     * Optional - if supplied, the IPC server exposes a `shutdown` method
     * that triggers a graceful daemon stop. Lets clients ask the daemon
     * to wind down its own event loop without relying on SIGTERM (which
     * is force-kill on Windows).
     */
    shutdown?: () => void | Promise<void>;
}
export declare class DaemonIpcServer {
    private readonly socketPath;
    private readonly handlers;
    private server;
    /** All connected sockets - used to force-close on stop(). */
    private readonly clients;
    constructor(socketPath: string, handlers: IpcHandlers);
    start(): Promise<void>;
    stop(): Promise<void>;
    private attachClient;
    private handleLine;
    private respond;
}
/**
 * Minimal client for the TUI side. Sends a single request and resolves on
 * the matching response.
 */
export declare class DaemonIpcClient {
    private readonly socketPath;
    private socket;
    private nextId;
    private readonly pending;
    private buffer;
    constructor(socketPath: string);
    connect(): Promise<void>;
    disconnect(): Promise<void>;
    listSubscriptions(): Promise<Subscription[]>;
    ping(): Promise<string>;
    /**
     * Ask the daemon to shut down. Returns when the daemon has acknowledged
     * the request (not when it has finished stopping). The caller should
     * then poll the lockfile / process for actual termination.
     */
    shutdown(): Promise<{
        accepted: true;
    }>;
    private request;
    private handleData;
    private handleClose;
}
//# sourceMappingURL=ipc.d.ts.map