/**
 * BrokerTransport — HTTP/WS transport layer for communicating with the
 * agent-relay broker. Used internally by AgentRelayClient.
 *
 * Handles:
 * - HTTP requests with API key auth and structured error parsing
 * - WebSocket connection for real-time event streaming
 * - Event buffering, replay, and query (mirrors stdio client behavior)
 */
import type { BrokerEvent } from './protocol.js';
export declare class AgentRelayProtocolError extends Error {
    code: string;
    retryable: boolean;
    status?: number;
    data?: unknown;
    constructor(payload: {
        code: string;
        message: string;
        retryable?: boolean;
        status?: number;
        data?: unknown;
    });
}
export interface BrokerTransportOptions {
    baseUrl: string;
    apiKey?: string;
    /** Fetch implementation. Defaults to globalThis.fetch. */
    fetch?: typeof globalThis.fetch;
    /** Timeout in ms for HTTP requests. Default: 30000. */
    requestTimeoutMs?: number;
    /** Maximum number of events to buffer in memory for queryEvents/getLastEvent */
    maxBufferSize?: number;
}
export declare class BrokerTransport {
    private readonly baseUrl;
    private readonly apiKey?;
    private readonly fetchFn;
    private readonly requestTimeoutMs;
    private readonly maxBufferSize;
    private ws;
    private eventListeners;
    private eventBuffer;
    private reconnectTimer;
    private sinceSeq;
    private _connected;
    private _intentionalClose;
    constructor(options: BrokerTransportOptions);
    get connected(): boolean;
    get wsUrl(): string;
    request<T = unknown>(path: string, init?: RequestInit): Promise<T>;
    connect(sinceSeq?: number): void;
    private _connect;
    disconnect(): void;
    onEvent(listener: (event: BrokerEvent) => void): () => void;
    queryEvents(filter?: {
        kind?: string;
        name?: string;
        since?: number;
        limit?: number;
    }): BrokerEvent[];
    getLastEvent(kind: string, name?: string): BrokerEvent | undefined;
}
//# sourceMappingURL=transport.d.ts.map