import type { DiscussionCapture, DiscussionProcessingProgress } from './types.js'; export interface RecoveredTranscriptSegment { text: string; startedAtMs: number; endedAtMs: number; speakerLabel?: string; correctedByUser?: boolean; rawText?: string; track?: 'mix' | 'mic' | 'system'; isGapPlaceholder?: boolean; } export interface TranscriptionCheckpoint { segments: RecoveredTranscriptSegment[]; language?: string; } export interface ProcessingRun { discussion_id: string; run_id: string; audio_sha256: string | null; base_transcript_revision: number; force_audio: number; retry_stage: string | null; attempt_count: number; next_attempt_at: number | null; lease_owner: string | null; lease_until: number | null; } export declare const PROCESSING_MAX_ATTEMPTS = 3; export declare function getProcessingRun(id: string): ProcessingRun | undefined; /** A new original-audio generation leaves published transcript/summary revisions untouched. */ export declare function createProcessingRun(capture: DiscussionCapture, forceAudio?: boolean): ProcessingRun; export declare function ensureProcessingRun(capture: DiscussionCapture, alignSource?: boolean): ProcessingRun; export declare function resetProcessingRetry(id: string): void; export declare function processingProgress(id: string): DiscussionProcessingProgress | undefined; export declare function claimSealingCapture(owner: string, now: number): DiscussionCapture | null; export declare function renewSealingLease(id: string, owner: string): boolean; export declare function releaseSealingLease(id: string, owner: string): void; export declare function assertProcessingRun(run: ProcessingRun, owner: string, signal: AbortSignal): void; export declare function readCheckpoint(runId: string, start: number, end: number): TranscriptionCheckpoint | undefined; export declare function saveCheckpoint(runId: string, start: number, end: number, result: TranscriptionCheckpoint): void; export declare function saveFailedCheckpoint(runId: string, start: number, end: number, attemptCount: number, errorMessage: string): void; export declare function listConfirmedCheckpoints(runId: string): Array<{ startedAtMs: number; endedAtMs: number; result: TranscriptionCheckpoint; }>; export declare function isTransientProcessingError(error: unknown, depth?: number): boolean; /** Persist bounded retries instead of sleeping inside a worker and blocking other recordings. */ export declare function failOrRetryProcessing(capture: DiscussionCapture, stage: 'transcript_sealing' | 'organization', error: unknown): DiscussionCapture | null; /** Race the signal as well as passing it downstream, so an uncooperative provider cannot hold the worker. */ export declare function withProcessingDeadline(work: (signal: AbortSignal) => Promise, parent: AbortSignal, timeoutMs: number): Promise;