/** * @fileoverview Browser-side live dictation engine. * * `LiveTranscriber` streams microphone audio to a recognizer and reports two kinds * of text: `onPartial`, the in-progress guess that keeps changing while a phrase is * being spoken, and `onCommit`, a phrase the recognizer has settled on. Callers use * the first to type text into an input as it is being said, and the second to * finalize it. * * Two engines are supported. The browser's own `SpeechRecognition` is preferred when * present because it needs no model download; otherwise the package's bundled * Moonshine model runs the recognition entirely on-device. Chromium's recognizer * stops itself after a pause, so a session that is still meant to be listening is * restarted automatically. */ export type TranscriberEngine = "auto" | "webspeech" | "moonshine"; export interface LiveTranscriberOptions { /** Which recognizer to use. Default `auto` (browser first, Moonshine as fallback). */ engine?: TranscriberEngine; /** BCP-47 language tag for the browser recognizer. Default `en-US`. */ language?: string; /** Moonshine model name. Default `model/small`. */ model?: string; /** Fires continuously with the current in-progress phrase. */ onPartial?: (text: string) => void; /** Fires once per phrase the recognizer has settled on. */ onCommit?: (text: string) => void; /** Fires whenever the microphone starts or stops. */ onStateChange?: (listening: boolean) => void; onError?: (error: Error) => void; } /** True when this browser can dictate at all (either engine). */ export declare function isTranscriptionSupported(): boolean; export declare class LiveTranscriber { private options; private listening; /** Distinguishes a deliberate `stop()` from Chromium's idle auto-stop. */ private stopRequested; private recognition; private moonshine; constructor(options?: LiveTranscriberOptions); setOptions(options: LiveTranscriberOptions): void; isListening(): boolean; start(): Promise; stop(): Promise; toggle(): Promise; private setListening; private startWebSpeech; private startMoonshine; }