import type { TelemetryRow, TelemetrySnapshot } from "../metrics"; import type { DebugAuditFile } from "../audit"; import type { BatchReprocessStatus } from "../batchReprocess"; import type { SttAuditIngestionWarning } from "../sttAuditIngestion"; /** Events an adapter emits and SofyaTranscriber forwards publicly. */ export type TranscriptionAdapterEventName = "recognizing" | "recognized" | "recognized_diarization" | "error" | "stopped" | "connected" | "disconnected" | "reconnecting" | "reconnected" | "resilience_status" | "recovery_warning" | "capacity_warning" | "telemetry" | "telemetry_row" | "batch_reprocess_status" | "stt_session"; export type TranscriptionAdapterListener = (detail?: any) => void; /** * Minimal lifecycle and event contract every adapter implements (ADR-0007). * Start and stop keep their current return behavior. */ export interface TranscriptionAdapter { startTranscription(mediaStream: MediaStream): void | Promise; stopTranscription(): Promise; pauseTranscription(): void; resumeTranscription(): void; on(event: TranscriptionAdapterEventName, listener: TranscriptionAdapterListener): unknown; off(event: TranscriptionAdapterEventName, listener: TranscriptionAdapterListener): unknown; } export interface TranscriptionDiagnostics { getResilienceStatus(): unknown; getSttSessionId(): string | null; getSttSessionIds(): string[]; getTelemetrySnapshot(): TelemetrySnapshot | null; getTelemetryRows(): TelemetryRow[]; clearTelemetryRows(): void; resetTelemetry(): void; } export type Capability = ({ supported: true; } & T) | { supported: false; }; export interface TranscriptionCapabilities { batchReprocess: Exclude(): Promise; getStatus(): BatchReprocessStatus; getRemainingTime(): number | null; }>, { supported: false; }> | UnsupportedBatchReprocess; auditIngestion: Capability<{ ingest(audit: DebugAuditFile): Promise; }>; } /** * Unsupported Batch reprocess, keeping each provider's pre-seam behavior: * `rejection: "generic"` rejects `reprocessAudio()` with the plain Error * (Whisper Batch); otherwise the typed * `BatchReprocessError("UNSUPPORTED_PROVIDER")` (Oracle). * `reportsStatus` emits the `unsupported` status when listeners attach. */ export interface UnsupportedBatchReprocess { supported: false; rejection?: "generic"; reportsStatus?: boolean; } /** Composed internal service returned by the Factory. */ export interface TranscriptionService { lifecycle: TranscriptionAdapter; diagnostics: TranscriptionDiagnostics; capabilities: TranscriptionCapabilities; } /** Behavior-preserving defaults for adapters without diagnostics. */ export declare const defaultDiagnostics: () => TranscriptionDiagnostics; /** Completes partial diagnostics with defaults, without mutating the source. */ export declare const composeDiagnostics: (partial: Partial) => TranscriptionDiagnostics; //# sourceMappingURL=TranscriptionService.d.ts.map