import type { SessionEventWriterConnection } from "../rpc/session-event-connection.ts";
export interface ControlConnection {
    readonly id: number;
    send(record: object): void;
    /** The raw socket writer, for an endpoint that orders this connection's output through a record writer. */
    readonly transport: SessionEventWriterConnection;
}
export type ControlCommand = Readonly<Record<string, unknown>> & {
    readonly type: string;
    readonly id?: unknown;
};
export interface ControlServerHandlers {
    /** `null`: the command already answered on its own (through the endpoint's record writer). */
    command(connection: ControlConnection, command: ControlCommand): Promise<object | null>;
    /** An authenticated connection is about to send its first line. */
    opened?(connection: ControlConnection): void;
    /** Writes a command's answer; without it the answer goes straight to the socket. */
    respond?(connection: ControlConnection, answer: object): void;
    closed(connection: ControlConnection): void;
    listenerError(error: Error): void;
}
export interface ControlServer {
    close(): Promise<void>;
}
export declare function listenControlSocket(socketPath: string, secret: Uint8Array, handlers: ControlServerHandlers): Promise<ControlServer>;
export declare function failure(id: unknown, command: string, error: string): object;
export declare function success(id: unknown, command: string, data?: unknown): object;
//# sourceMappingURL=session-control-server.d.ts.map