/**
 * @module        sessionDaemon
 * @description   会话守护进程，管理持久化 ACP 会话的后台服务
 *
 * @author        eddy
 * @organization  wykj
 * @ownership     wykj/eddy
 *
 * @created       2026-03-31
 * @updated       2026-04-03
 *
 * @role          daemon
 * @layer         daemon
 * @boundedContext session-management
 */
export interface DaemonRequest {
    id?: number;
    method: 'ensureSession' | 'startRun' | 'inspect' | 'stopSession' | 'clearRun' | 'cancelRun' | 'shutdown' | 'subscribeRun';
    params: Record<string, unknown>;
}
export interface DaemonResponse {
    id?: number;
    ok: boolean;
    data?: unknown;
    error?: string;
}
/**
 * Event frame sent on a subscribeRun socket. NDJSON stream until the run
 * settles (complete/error) then daemon closes the socket.
 */
export type DaemonEvent = {
    event: 'text';
    text: string;
} | {
    event: 'tool_use';
    id: string;
    title: string;
    kind: string;
    status: string;
} | {
    event: 'tool_update';
    id: string;
    status: string;
} | {
    event: 'usage';
    used: number;
    size: number;
} | {
    event: 'complete';
    stopReason: string;
} | {
    event: 'error';
    error: string;
};
export declare class SessionDaemon {
    private socketPath;
    private pidFile;
    private server;
    private pollTimer;
    private runtime;
    private ctx;
    private clients;
    constructor(socketPath?: string, pidFile?: string);
    start(): Promise<void>;
    private handleClient;
    private handleMessage;
    /**
     * Long-lived subscription: hooks listener on the session's accumulator, pipes
     * structured events as NDJSON. Socket stays open until 'complete' fires or
     * client disconnects.
     */
    private handleSubscribeRun;
    private dispatch;
    private pollSessions;
    private shuttingDown;
    /** trigger:触发源(SIGTERM/SIGINT 信号 或 'command' socket 命令),记录到审计便于排查"会话为何被关"。 */
    private shutdown;
    private send;
    private log;
}
//# sourceMappingURL=sessionDaemon.d.ts.map