import { type TranscriptionAdapter, type TranscriptionDiagnostic, type TranscriptionErrorCode, type TranscriptionEvent, type TranscriptionLifecycleStatus, type TranscriptionPolicyBlockReason, type TranscriptionTargetSelection, type WorkspaceTranscriptionPolicy } from "@opengeni/sdk"; import { type OpenGeniText } from "../messages/runtime.js"; export type TranscriptionControlState = { status: TranscriptionLifecycleStatus; generation: number; localSessionId: string | null; providerSessionId: string | null; lastSequence: number; partial: string; error: { code: TranscriptionErrorCode; recoverable: boolean; } | null; acceptedFinalIds: string[]; audioMilliseconds: number; costUsd: number | null; }; export declare const INITIAL_TRANSCRIPTION_CONTROL_STATE: TranscriptionControlState; export type TranscriptionControlAction = { type: "start"; generation: number; localSessionId: string; } | { type: "event"; generation: number; event: TranscriptionEvent; } | { type: "start.failed"; generation: number; code: TranscriptionErrorCode; } | { type: "cancel"; generation: number; } | { type: "cancel.settled"; generation: number; } | { type: "reset"; }; export type TranscriptionControlTransition = { state: TranscriptionControlState; /** A newly accepted final to append to the current editable draft once. */ commit: string | null; }; export declare function transitionTranscriptionControl(state: TranscriptionControlState, action: TranscriptionControlAction): TranscriptionControlTransition; export declare function appendFinalTranscript(draft: string, transcript: string): string; export type UseTranscriptionOptions = { adapter: TranscriptionAdapter | null; policy: WorkspaceTranscriptionPolicy; selection?: TranscriptionTargetSelection | undefined; value: string; setValue: (value: string) => void; focusInput: () => void; disabled?: boolean | undefined; createLocalSessionId?: (() => string) | undefined; lifecycleTimeouts?: Partial | undefined; /** Receives the exact diagnostic emitted by the transcription transport. */ onDiagnostic?: ((diagnostic: TranscriptionDiagnostic) => void) | undefined; }; export type TranscriptionLifecycleTimeouts = { startMs: number; cleanupMs: number; }; export type UseTranscriptionResult = { state: TranscriptionControlState; available: boolean; unavailableReason: TranscriptionPolicyBlockReason | "adapter_missing" | "composer_disabled" | null; start: () => Promise; cancel: () => Promise; reset: () => void; }; export declare function useTranscription({ adapter, policy, selection, value, setValue, focusInput, disabled, createLocalSessionId, lifecycleTimeouts, onDiagnostic, }: UseTranscriptionOptions): UseTranscriptionResult; export declare function normalizeTranscriptionErrorCode(code: unknown): TranscriptionErrorCode; export declare function normalizeTranscriptionDiagnostic(t: OpenGeniText, diagnostic: unknown): TranscriptionDiagnostic;