export type VoiceCaptureState = 'idle' | 'requestingPermission' | 'recording' | 'processing'; export type VoiceCaptureErrorCode = 'unsupported' | 'permissionDenied' | 'microphoneUnavailable' | 'recordingFailed' | 'invalidState' | 'cancelled'; export declare class VoiceCaptureError extends Error { readonly code: VoiceCaptureErrorCode; constructor(code: VoiceCaptureErrorCode, message: string, options?: ErrorOptions); } export interface VoiceCaptureOptions { /** BCP 47 locale used by browser speech recognition. Defaults to the document locale. */ language?: string; } export interface VoiceCaptureResult { durationMs: number; /** Present when this browser provides speech recognition and recognized speech. */ transcript?: string; } export interface VoiceCaptureSnapshot { state: VoiceCaptureState; audioLevel: number; durationMs: number; partialTranscript: string; } export interface VoiceCaptureObserver { onAudioLevel(level: number): void; onPartialTranscript(transcript: string): void; } export interface VoiceCaptureRecording { stop(): Promise<{ transcript?: string; }>; cancel(): void; } /** Injectable browser boundary for tests and non-standard web runtimes. */ export interface VoiceCaptureAdapter { readonly isSupported: boolean; readonly isTranscriptionSupported: boolean; start(options: VoiceCaptureOptions, observer: VoiceCaptureObserver): Promise; } /** * Framework-free browser voice capture with an observable state machine. * Call dispose() when the owning component or page is removed. */ export declare class VoiceCaptureSession { readonly isSupported: boolean; readonly isTranscriptionSupported: boolean; private readonly adapter; private readonly now; private readonly listeners; private snapshotValue; private recording?; private startedAt?; private timer?; private generation; constructor(adapter?: VoiceCaptureAdapter, now?: () => number); get snapshot(): VoiceCaptureSnapshot; subscribe(listener: (snapshot: VoiceCaptureSnapshot) => void): () => void; start(options?: VoiceCaptureOptions): Promise; stop(): Promise; cancel(): void; dispose(): void; private updateDuration; private reset; private clearTimer; private update; } export declare function browserVoiceCaptureAdapter(): VoiceCaptureAdapter; //# sourceMappingURL=voice-capture.d.ts.map