import type { AsrBackendId } from '../config.js'; import type { VoiceInputState } from './voice-flow.js'; export type VoiceToggleAction = 'start' | 'stop' | 'ignore'; export type MicrophoneClickDecision = { action: 'ignore'; } | { action: 'stop'; } | { action: 'unavailable'; } | { action: 'start'; backend: AsrBackendId; }; /** Map a stored backend ID to a recognized capture backend, or null if unknown. */ export declare function resolveCaptureBackend(value: string): AsrBackendId | null; export declare function voiceToggleAction(state: VoiceInputState): VoiceToggleAction; export declare function decideMicrophoneClick(options: { state: VoiceInputState; asrBackend: string; browserAvailable: { webSpeech: boolean; mediaRecorder: boolean; }; }): MicrophoneClickDecision; /** Drop a MediaRecorder create() that finished after unmount or an explicit cancel. */ export declare function shouldAbandonPendingCapture(mounted: boolean, cancelled: boolean): boolean; /** Reuse an asynchronous operation while the same keyed operation is in flight. */ export declare function reuseInFlightPromise(inFlight: { current: { key: TKey; promise: Promise; } | null; }, key: TKey, operation: () => Promise): Promise; /** Check whether a media capture was superseded by a newer start generation. */ export declare function isSupersededMediaCapture(latestGeneration: number, generation: number): boolean; /** * Prefer the recognition session's own text. When the browser emits no final * result, recover the live draft slice written by interim updates. */ export declare function webSpeechCommittedTranscript(options: { sessionText: string; sessionDraft: string; baseDraft: string; }): string;