/**
 * Frontend WebSocket transport — thin adapter over `WebsocketRpcConnection`.
 *
 * Delegates request/response correlation, the durable queue, the heartbeat,
 * and `AbortSignal`-driven cancel to the underlying connection (the
 * canonical implementation is `FrontendWebsocketClient`). The transport's
 * own job is the `Transport` contract: route inbound server-pushed
 * messages into `peer.receive` and translate the connection's
 * `Promise<R>`/`ThrownJsonrpcError` shape into `JsonrpcResponseOrError`
 * envelopes. No parallel pending-request map.
 *
 * @module
 */
import type { JsonrpcNotification, JsonrpcRequest, JsonrpcRequestId, JsonrpcResponseOrError, JsonrpcErrorResponse } from '../http/jsonrpc.js';
import type { Transport, TransportSendOptions } from './transports.js';
/**
 * Minimal interface for a WebSocket connection, decoupled from the concrete Socket Cell.
 */
export interface WebsocketConnection {
    send: (data: object) => boolean;
    readonly connected: boolean;
    add_message_handler: (handler: (event: MessageEvent) => void) => () => void;
    add_error_handler: (handler: (event: Event) => void) => () => void;
}
/**
 * RPC-capable WebSocket connection — a `WebsocketConnection` that also
 * handles request/response correlation with timeout, queue,
 * `AbortSignal` cancel, and explicit-id support. Required by
 * `FrontendWebsocketTransport` so it can delegate the pending-map
 * bookkeeping to one canonical implementation
 * (`FrontendWebsocketClient`) instead of running a parallel one.
 *
 * Consumer wrappers around `FrontendWebsocketClient` (e.g. zzz's
 * `Socket`) implement this by adding a one-line delegate to the
 * underlying client's `request`.
 */
export interface WebsocketRpcConnection extends WebsocketConnection {
    request: (method: string, params: unknown, options?: {
        signal?: AbortSignal;
        queue?: boolean;
        id?: JsonrpcRequestId;
    }) => Promise<unknown>;
}
/**
 * Thin adapter over `WebsocketRpcConnection` (canonical implementation:
 * `FrontendWebsocketClient`). Routes inbound server-pushed requests and
 * notifications into the supplied `receive` callback; responses are owned
 * by the connection's own `request()` pending map and are ignored here.
 */
export declare class FrontendWebsocketTransport implements Transport {
    #private;
    readonly transport_name: "frontend_websocket_rpc";
    constructor(connection: WebsocketRpcConnection, receive: (data: unknown) => Promise<unknown>);
    send(message: JsonrpcRequest, options?: TransportSendOptions): Promise<JsonrpcResponseOrError>;
    send(message: JsonrpcNotification, options?: TransportSendOptions): Promise<JsonrpcErrorResponse | null>;
    is_ready(): boolean;
    /**
     * Detach the inbound message and error handlers registered on the
     * connection. Idempotent — subsequent calls no-op. Does not close the
     * underlying connection (that lifecycle is owned by the caller).
     *
     * @mutates this - clears the two stored unsubscribe references after invoking them
     */
    dispose(): void;
}
//# sourceMappingURL=transports_ws.d.ts.map