/**
 * Message router for incoming gateway messages.
 *
 * Dispatches incoming messages to appropriate handlers based on message type.
 * Errors in handlers are caught and logged, never crashing the router.
 */
import type { Message, MessageType, RequestMessage } from "@pocketcoder/shared";
import type { GatewayClient } from "./websocket-client.js";
/**
 * Handler function signature.
 * Receives the parsed request message and a send function for responses.
 * The handler can send one or more messages back (e.g., streaming events + final response).
 */
export type MessageHandler = (message: RequestMessage, send: (response: Message) => void) => Promise<void>;
export declare class MessageRouter {
    private handlers;
    private client;
    /** Register a handler for a specific message type */
    registerHandler(type: MessageType, handler: MessageHandler): void;
    /** Remove a handler for a specific message type */
    removeHandler(type: MessageType): void;
    /** Attach to a GatewayClient and start routing messages */
    attach(client: GatewayClient): void;
    /** Detach from the current GatewayClient */
    detach(): void;
    /** The bound message handler for the gateway client */
    private handleMessage;
    /** Send a generic error response */
    private sendErrorResponse;
}
//# sourceMappingURL=message-router.d.ts.map