import { type AuthStorage } from "@oh-my-pi/pi-ai"; import { type LiveClientMessage, type LiveServerEvent } from "./protocol.js"; /** Callbacks emitted by the live WebRTC transport. */ export interface LiveTransportCallbacks { onEvent(event: LiveServerEvent): void; onOutputLevel(level: number): void; } /** Configuration required to establish a Codex live call. */ export interface LiveTransportOptions { authStorage: AuthStorage; sessionId: string; instructions: string; voice: string; callbacks: LiveTransportCallbacks; signal?: AbortSignal; /** * SDP offer from a caller-owned WebRTC peer (one Opus audio track plus an `oai-events` * data channel). When set, no native peer is created: the caller's peer carries the audio, * {@link CodexLiveTransport.sdpAnswer} holds the answer to apply to it, and this transport * keeps only the sideband. */ sdpOffer?: string; } /** Extracts the server-assigned `rtc_*` call ID from a signaling Location header. */ export declare function parseLiveCallId(location: string | null): string | undefined; /** Builds the Frameless Bidi sideband WebSocket URL for an accepted Codex call. */ export declare function buildLiveSidebandUrl(callId: string): string; /** WebRTC transport for a Codex Frameless Bidi live session, with a native or caller-owned media peer. */ export declare class CodexLiveTransport { #private; constructor(options: LiveTransportOptions); /** SDP answer for the caller's peer once a {@link LiveTransportOptions.sdpOffer} call has been signaled. */ get sdpAnswer(): string | undefined; /** Establish the media peer, perform Codex signaling, and wait for the data channel or sideband. */ connect(): Promise; /** Serialize one Frameless Bidi control message onto the call's sideband WebSocket. */ send(message: LiveClientMessage): Promise; /** Queue 16 kHz mono Float32 PCM for native Opus transmission. */ pushAudio(samples: Float32Array): void; /** Enable or disable the native audio source and discard partial input when muted. */ setMuted(muted: boolean): Promise; /** Stop sideband signaling and the native WebRTC media peer. Safe to call repeatedly. */ close(): Promise; }