import type { AudioCaptureMetrics, BrowserNetworkMetrics, BufferingMetrics, ConnectionMetrics, RecoveryMetrics, SessionMetrics, TranscriptUiMetrics, TranscriptionMetricsProvider, TranscriptionMetricsSnapshot } from "../metrics/types"; export type SessionReportProvider = TranscriptionMetricsProvider; export type DebugAuditConfig = { enabled: boolean; advancedMetrics: boolean; autoDownload: boolean; fileName: string | null; label: string | null; metadata: Record | null; }; export type DebugAuditEvent = { name: string; detail: unknown; timestamp: number; }; export type DebugTranscriptEntry = { text: string; timestamp: number; }; export type DebugAuditStatus = Partial & Record & { timestamp: number; }; export type DebugAuditCheckpoint = { timestamp: number; resilienceStatus: SessionReportResilienceStatus | null; metricsSnapshot: TranscriptionMetricsSnapshot | null; }; export type DebugAuditFinalDigest = { digest: string; timestamp: number; }; export type DebugAuditState = DebugAuditConfig & { sessionId: string; createdAt: number; startedAt: number | null; stoppedAt: number | null; requestedProvider: SessionReportProvider; resolvedProvider: SessionReportProvider; phases: SessionReportPhase[]; incidents: SessionReportIncident[]; transcriptMilestones: SessionReportTranscriptMilestone[]; checkpoints: DebugAuditCheckpoint[]; finalDigests: DebugAuditFinalDigest[]; }; export type DebugAuditFile = { schemaVersion: 2; kind: "sofya-transcriber-debug-audit"; sessionId: string; label: string | null; generatedAt: string; createdAt: string; startedAt: string | null; stoppedAt: string | null; sessionDurationMs: number | null; requestedProvider: SessionReportProvider; resolvedProvider: SessionReportProvider; sttSessionIds: string[]; metadata: Record | null; environment: { userAgent: string | null; locationHref: string | null; }; report: SessionReport; }; export type SessionReportSupportFlags = { transcriptUi: boolean; session: boolean; connection: boolean; recovery: boolean; buffering: boolean; browserNetwork: boolean; audioCapture: boolean; }; export type SessionReportSummaryOutcome = "healthy" | "degraded_recovered" | "degraded_unrecovered" | "failed"; export type SessionReportOutcome = SessionReportSummaryOutcome; export type SessionReportHealthStatus = "inactive" | "healthy" | "degraded" | "critical" | "unsupported"; export type SessionReportFindingSeverity = "info" | "warning" | "critical"; export type SessionReportPhaseType = "created" | "ready" | "started" | "connected" | "reconnecting" | "reconnected" | "disconnected" | "stopped"; export type SessionReportIncidentType = "offline" | "online" | "buffering_started" | "buffering_cleared" | "drain_started" | "drain_completed" | "drain_stalled" | "error" | "fatal_error" | "terminal_disconnect"; export type SessionReportTranscriptMilestoneType = "first_partial" | "first_final" | "last_final" | "first_diarization"; export type SessionReportFindingCode = "terminal_disconnect_observed" | "buffer_not_drained_after_recovery" | "drain_stalled" | "duplicate_final_transcripts" | "high_partial_latency" | "high_final_latency" | "slow_recovery" | "high_peak_buffer" | "offline_flaps_detected" | "audio_clipping_detected" | "audio_callback_gaps_detected"; export type SessionReportHealthGroupName = "transcriptUi" | "session" | "connection" | "recovery" | "buffering" | "browserNetwork" | "audioCapture"; export type SessionReportMetricValue = string | number | boolean | null; export type SessionReportSummary = { outcome: SessionReportSummaryOutcome; sessionDurationMs: number | null; partialTranscriptCount: number | null; finalTranscriptCount: number | null; diarizationCount: number | null; avgFirstPartialLatencyMs: number | null; p95FirstPartialLatencyMs: number | null; avgFinalLatencyMs: number | null; p95FinalLatencyMs: number | null; avgStabilizationLatencyMs: number | null; p95StabilizationLatencyMs: number | null; reconnectCount: number | null; recoverySuccessCount: number | null; terminalDisconnectCount: number | null; avgRecoveryDurationMs: number | null; p95RecoveryDurationMs: number | null; peakBufferedAudioBytes: number | null; bufferingDurationMs: number | null; drainingDurationMs: number | null; bufferStallCount: number | null; drainExitReason: BufferingMetrics["drainExitReason"]; finishDeliveryState: BufferingMetrics["finishDeliveryState"]; offlineDurationMs: number | null; flapCount: number | null; rttMs: number | null; downlinkMbps: number | null; clippingEventCount: number | null; silenceRatio: number | null; speechActivityRatio: number | null; audioCallbackGapCount: number | null; longestAudioCallbackGapMs: number | null; }; export type SessionReportHealthGroup = { supported: boolean; status: SessionReportHealthStatus; reasons: string[]; }; export type SessionReportGroupHealth = SessionReportHealthGroup; export type SessionReportHealth = Record; export type SessionReportPhase = { type: SessionReportPhaseType; timestamp: number; }; export type SessionReportTimelinePhase = SessionReportPhase; export type SessionReportIncident = { type: SessionReportIncidentType; timestamp: number; endedAt: number | null; detail: unknown; }; export type SessionReportTimelineIncident = SessionReportIncident; export type SessionReportTranscriptMilestone = { type: SessionReportTranscriptMilestoneType; timestamp: number; text: string | null; }; export type SessionReportTimeline = { phases: SessionReportPhase[]; incidents: SessionReportIncident[]; transcriptMilestones: SessionReportTranscriptMilestone[]; }; export type SessionReportFinding = { code: SessionReportFindingCode; severity: SessionReportFindingSeverity; message: string; }; export type SessionReportDashboardCard = { status: SessionReportHealthStatus; headline: string; metrics: Record; }; export type SessionReportTranscriptCard = SessionReportDashboardCard; export type SessionReportConnectionCard = SessionReportDashboardCard; export type SessionReportRecoveryCard = SessionReportDashboardCard; export type SessionReportBufferingCard = SessionReportDashboardCard; export type SessionReportNetworkCard = SessionReportDashboardCard; export type SessionReportAudioCard = SessionReportDashboardCard; export type SessionReportDashboard = { heroStats: { outcome: SessionReportSummaryOutcome; sessionDurationMs: number | null; finalTranscriptCount: number | null; reconnectCount: number | null; peakBufferedAudioBytes: number | null; offlineDurationMs: number | null; }; cards: { transcript: SessionReportTranscriptCard; connection: SessionReportConnectionCard; recovery: SessionReportRecoveryCard; buffering: SessionReportBufferingCard; network: SessionReportNetworkCard; audio: SessionReportAudioCard; }; }; export type SessionReportSession = { sessionId: string; label: string | null; requestedProvider: SessionReportProvider; resolvedProvider: SessionReportProvider; createdAt: string; startedAt: string | null; stoppedAt: string | null; durationMs: number | null; hasStarted: boolean; hasStopped: boolean; }; export type SessionReport = { schemaVersion: 2; generatedAt: string; session: SessionReportSession; summary: SessionReportSummary; health: SessionReportHealth; timeline: SessionReportTimeline; findings: SessionReportFinding[]; dashboard: SessionReportDashboard; }; export type SessionReportResilienceStatus = { timestamp?: number; connectionState?: ConnectionMetrics["connectionState"] | null; websocketState?: ConnectionMetrics["websocketState"] | null; browserOnline?: boolean | null; hasConnectedOnce?: boolean | null; isRecovering?: boolean | null; isBufferingAudio?: boolean | null; isDrainingAudio?: boolean | null; transportBufferedAmountBytes?: number | null; pendingBufferedAudioBytes?: number | null; pendingBufferedAudioChunks?: number | null; persistedBufferedAudioBytes?: number | null; persistedBufferedAudioSegments?: number | null; totalBufferedAudioBytes?: number | null; bufferingStartedAt?: number | null; drainStartedAt?: number | null; lastDrainProgressAt?: number | null; drainCycles?: number | null; drainExitReason?: BufferingMetrics["drainExitReason"]; reconnectAttempt?: number | null; nextReconnectDelayMs?: number | null; finishDeliveryState?: BufferingMetrics["finishDeliveryState"]; maxReconnectAttempts?: number | null; remainingReconnectAttempts?: number | null; lastDisconnect?: { code?: number; reason?: string; wasClean?: boolean; errorMessage?: string; } | null; }; export type BuildSessionReportInput = { auditState: DebugAuditState; resilienceStatus: SessionReportResilienceStatus | DebugAuditStatus | null; metricsSnapshot: TranscriptionMetricsSnapshot | null; now: number; }; export type BuildSessionReportOutput = { report: SessionReport; }; export declare const REPORT_THRESHOLDS: { readonly highPartialLatencyMs: 1500; readonly highFinalLatencyMs: 4000; readonly slowRecoveryMs: 5000; readonly highPeakBufferBytes: 262144; readonly offlineFlaps: 2; }; export type MetricsGroups = { transcriptUi: TranscriptUiMetrics | null; session: SessionMetrics | null; connection: ConnectionMetrics | null; recovery: RecoveryMetrics | null; buffering: BufferingMetrics | null; browserNetwork: BrowserNetworkMetrics | null; audioCapture: AudioCaptureMetrics | null; }; export declare const getMetricsGroups: (metricsSnapshot: TranscriptionMetricsSnapshot | null) => MetricsGroups; //# sourceMappingURL=types.d.ts.map