import { type ClientVoiceInputConfig, type OpenGeniClient } from "@opengeni/sdk"; import { type VoiceRecordingStore } from "../voice-recording-store.js"; export type VoiceInputStatus = "idle" | "requesting-permission" | "recording" | "saving" | "transcribing" | "retrying" | "recovered" | "transcript-ready" | "error"; export type UseVoiceInputOptions = { client: VoiceInputClient | null; workspaceId: string; capability: ClientVoiceInputConfig | null; enabled: boolean; value: string; setValue: (value: string) => void; focusInput: () => void; disabled?: boolean | undefined; /** Test/embed seam. Production defaults to the origin-scoped IndexedDB store. */ createRecordingStore?: (() => VoiceRecordingStore) | undefined; createRecordingId?: (() => string) | undefined; createOwnerId?: (() => string) | undefined; now?: (() => Date) | undefined; /** Test/embed seam. Production uses bounded exponential recovery backoff. */ automaticRetryDelayMilliseconds?: number | undefined; }; type ResumableVoiceInputClient = Pick; type VoiceInputClient = Pick & Partial; export type UseVoiceInputResult = { status: VoiceInputStatus; error: string | null; available: boolean; /** Live mic stream while recording; null once stopped/cancelled. */ stream: MediaStream | null; recordingId: string | null; durationSeconds: number; /** Wall-clock start of the current capture (epoch ms), or null when not recording. */ recordingStartedAt: number | null; /** Capture stops and transcribes automatically after this many seconds. */ maxRecordingSeconds: number | null; locallySaved: boolean; hasRecoverableRecording: boolean; savedTranscript: string | null; start: () => Promise; /** Stop capture, durably settle the final chunk, then transcribe into the draft. */ stop: () => void; /** Retry finalization/transcription from the already-persisted recording. */ retry: () => void; /** Explicitly insert a durably saved transcript whose prior handoff may be uncertain. */ insertSavedTranscript: () => Promise; /** * Cancel active work without losing speech: a recording longer than a few * seconds and any stopped/transcribing recording stay locally recoverable. */ cancel: () => void; /** Intentionally delete the current durable recording. */ discard: () => Promise; }; export declare const VOICE_RECORDING_TIMESLICE_MILLISECONDS = 5000; export declare const VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS = 5000; export declare const VOICE_RECORDING_OWNER_STALE_MILLISECONDS = 30000; export declare const VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS = 600; export declare const VOICE_RECORDING_RESUMABLE_CLIENT_MAX_DURATION_SECONDS: number; export declare const VOICE_RECORDING_RECOVERY_STATUS_POLL_MILLISECONDS = 2000; export declare const VOICE_RECORDING_RECOVERY_MAX_MUTATION_DELAY_MILLISECONDS = 30000; export declare function transcriptionRecoveryMutationDelayMilliseconds(retryAfterMilliseconds: number | undefined, attempt: number, random?: () => number): number; export declare function useVoiceInput({ client, workspaceId, capability, enabled, value, setValue, focusInput, disabled, createRecordingStore, createRecordingId, createOwnerId, now, automaticRetryDelayMilliseconds, }: UseVoiceInputOptions): UseVoiceInputResult; export {};