import { ApiCaller } from '../api/api-caller'; import { DictationErrorCode } from '../dictation/dictation-session'; import { WidgetConfig } from '../types/widget-config'; import { PrimitiveState } from '../utils/PrimitiveState'; export type DictationStatus = 'idle' | 'connecting' | 'listening'; export type DictationCtxState = { status: DictationStatus; /** Last failure, cleared on the next start. */ error: DictationErrorCode | null; }; /** * Where dictated text lands. The widget composer is a plain textarea whose * value is React state, so the target is just "what is there now" and "set * it". Text is appended after whatever the visitor already typed; a manual * edit inside the dictated region ends the session (their edit wins). */ export interface DictationTarget { getValue: () => string; setValue: (value: string) => void; /** Fired for the spoken "send message" command, after the text is final. */ onSend?: (() => void) | undefined; } /** * Voice dictation for the composer: mic → realtime transcription → the * textarea, with the spoken-command grammar ("new line", * "scratch that", "send it") and paced word reveal. One session per widget; * `start` on a live session restarts it against the new target. */ export declare class DictationCtx { state: PrimitiveState; /** 0..1 mic level — read inside a rAF loop, never during render. */ readonly levelRef: { current: number; }; private readonly api; private readonly config; private readonly mintCache; private session; private target; private language; /** Composer content when dictation started — dictated text follows it. */ private prefix; private raw; private processed; private displayed; private dripTimer; private silenceTimer; constructor({ api, config }: { api: ApiCaller; config: WidgetConfig; }); isActive: () => boolean; /** Fire-and-forget token pre-mint (mic hover) so the click starts instantly. */ prewarm: () => void; start: (target: DictationTarget) => void; stop: (options?: { executeFinalCommand?: boolean; }) => void; private mintToken; /** Applied text = prefix + dictated. A mismatch means the visitor edited. */ private isConsistent; private applyDisplayed; /** Process the transcript and apply the outcome. Shared by the delta path, * the silence timer, and (with `final`) teardown. Returns the control. */ private ingest; private stopSilenceTimer; private teardown; } //# sourceMappingURL=dictation.ctx.d.ts.map