diff --git a/src/lib/api.ts b/src/lib/api.ts index 6a749d9..60c95c2 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -96,6 +96,19 @@ export interface LanguageOption { export type MeetingStatus = "recording" | "transcribing" | "ready" | "recovering" | "error"; +// The four ordered phases of a background media import (import://progress). +export type ImportPhase = "prepare" | "transcribe" | "diarize" | "finalize"; + +// One `import://progress` tick. `state` is active (running), done (finished, +// `elapsedMs` set) or error (`error` message set) for the given `phase`. +export interface ImportProgress { + meetingId: MeetingId; + phase: ImportPhase; + state: "active" | "done" | "error"; + elapsedMs: number | null; + error: string | null; +} + export interface MeetingListItem { id: MeetingId; title: string; @@ -458,10 +471,12 @@ export const api = { invoke("reprocess_transcript", { meetingId, model, language }), // Manually add a meeting from an existing recording — a local audio/video // file path or a URL (YouTube/streaming page or direct media URL). Requires - // ffmpeg (and yt-dlp for URLs) on PATH; neither is bundled. Returns the new - // meeting's id once transcription + diarization have finished. - importMedia: (source: string, title?: string) => - invoke("import_media", { source, title }), + // ffmpeg (and yt-dlp for URLs) on PATH; neither is bundled. `model` overrides + // the Settings whisper model for this one import. Returns the new meeting's id + // *immediately*; transcode/transcribe/diarize run in the background and stream + // `import://progress` ticks, finishing with `transcript://finalized`. + importMedia: (source: string, title?: string, model?: string) => + invoke("import_media", { source, title, model }), resumeTranscription: (meetingId: MeetingId) => invoke("resume_transcription", { meetingId }), listMeetings: (filter?: MeetingFilter) => @@ -619,6 +634,9 @@ export const events = { onFinalized: ( cb: (p: { meetingId: string; segmentCount: number }) => void, ): Promise => listen("transcript://finalized", (e) => cb(e.payload as never)), + // Per-phase progress of a background media import (feeds the import tracker). + onImportProgress: (cb: (p: ImportProgress) => void): Promise => + listen("import://progress", (e) => cb(e.payload as never)), // Live diarization refined the speaker list mid-recording (FR-SPK): updated // labels/display names, including the mic speaker resolved to "You". onDiarizationUpdated: (