/** * Wraps a browser {@link WebSocket} so every `message` listener receives payloads * after {@link normalizeRealtimeEvent} has been applied to the frame. * * The OpenAI Agents `OpenAIRealtimeWebSocket` transport parses each incoming frame * twice: once inside `_onMessage` and again in its own `message` listener for audio, * interruption, and response sequencing. Overriding `_onMessage` alone does not affect * that second parse, so normalization must happen before any SDK listener runs. * * This wrapper intercepts `addEventListener` / `removeEventListener` for `message` * only; all other behavior is delegated to the underlying socket. */ export declare class GrokNormalizingWebSocket { private readonly inner; private readonly messageWrappers; constructor(url: string | URL, protocols?: string | string[]); get binaryType(): BinaryType; set binaryType(value: BinaryType); get bufferedAmount(): number; get extensions(): string; get onclose(): ((this: WebSocket, ev: CloseEvent) => unknown) | null; set onclose(value: ((this: WebSocket, ev: CloseEvent) => unknown) | null); get onerror(): ((this: WebSocket, ev: Event) => unknown) | null; set onerror(value: ((this: WebSocket, ev: Event) => unknown) | null); get onmessage(): ((this: WebSocket, ev: MessageEvent) => unknown) | null; set onmessage(value: ((this: WebSocket, ev: MessageEvent) => unknown) | null); get onopen(): ((this: WebSocket, ev: Event) => unknown) | null; set onopen(value: ((this: WebSocket, ev: Event) => unknown) | null); get protocol(): string; get readyState(): number; get url(): string; close(code?: number, reason?: string): void; send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void; dispatchEvent(event: Event): boolean; /** * Builds a `message` handler that applies Grok/OpenAI shape normalization * before invoking the SDK's listener. */ private wrapMessageListener; } /** * Opens a realtime WebSocket with Grok/xAI protocol headers and incoming * message normalization compatible with the OpenAI Agents transport. * * @param url - WebSocket URL (e.g. xAI realtime endpoint). * @param protocols - Subprotocol list; must include `realtime` and the xAI secret subprotocol. * @returns A socket compatible with {@link WebSocket} for the Agents SDK transport. */ export declare function createGrokNormalizingWebSocket(url: string | URL, protocols: string | string[]): WebSocket; //# sourceMappingURL=grokNormalizingWebSocket.d.ts.map