/** * One live dictation session: microphone → WebRTC → realtime transcription. * The browser talks to the transcription service directly with a short-lived * ephemeral token minted by the backend — audio and transcripts never touch * OpenCX servers, and the real API key never reaches the browser. * * WebRTC (not WebSocket) because the browser stack handles Opus encoding, * jitter buffering and echo cancellation natively — no PCM plumbing, lowest * practical latency. * * Errors are CODES (the widget renders them through its translation table). */ export type DictationSessionState = 'idle' | 'connecting' | 'listening' | 'stopped' | 'error'; export type DictationErrorCode = /** No getUserMedia, permission denied, or no device. */ 'microphone' /** Mint, handshake, or transport failure. */ | 'unavailable'; export interface DictationMint { token: string; expiresAt: string; model: string; } export declare class DictationSession { private readonly mintToken; private readonly onDelta; private readonly onState; private readonly onError; private readonly onLevel; private state; private pc; private dc; private stream; private audioContext; private levelRaf; private timers; private loggedParseFailure; constructor({ mintToken, onDelta, onState, onError, onLevel, }: { mintToken: () => Promise; onDelta: (delta: string) => void; onState: (state: DictationSessionState) => void; onError: (code: DictationErrorCode) => void; onLevel?: (level: number) => void; }); start(): Promise; stop(): void; private requestMicrophone; private handleServerEvent; private startLevelMeter; private isTornDown; private fail; private teardown; private setState; } //# sourceMappingURL=dictation-session.d.ts.map