/** * Plain helpers for meeting UIs (web, phone, embedders): words for a recording's state, clock * times, speaker names and colors, and the transcript grouped into turns. * No React here, so each rule is tested on its own. */ import { type Recording, type RecordingSpeaker, type RecordingTrack, type RecordingTranscriptSegment, type RecordingTranscriptionModel, type RecordingTranscriptVersion } from "@opengeni/contracts"; import type { RecorderSnapshot, RecordingUploadStatus } from "@opengeni/sdk/recordings"; import { type OpenGeniText } from "./messages/runtime.js"; /** "4:07", "1:02:09". Never negative; rounds down to the second. */ export declare function formatClock(milliseconds: number): string; /** "45 sec", "12 min", "1 h 5 min": a recording's length in a list, in `msg`'s language. */ export declare function formatDuration(milliseconds: number, msg?: OpenGeniText): string; export type MeetingPhase = { kind: "uploading"; } | { kind: "transcribing"; version: RecordingTranscriptVersion | null; } | { kind: "ready"; version: RecordingTranscriptVersion; } | { kind: "failed"; version: RecordingTranscriptVersion | null; } | { kind: "no_transcript"; }; /** * Where a recording is in its life, from the reader's side. A recording still * capturing is "uploading" (kept for compatibility; it reads "In progress"): * it is still being recorded, or its last audio is still on its way from the * device that recorded it. That device knows which, so it asks * {@link meetingHereStatus}. A failed re-run leaves an older complete version * current, so the transcript stays readable. */ export declare function meetingPhase(recording: Recording): MeetingPhase; /** * What this device's recorder knows about one meeting that the server can't * yet: it is recording (or paused) here, or it was stopped here and its last * few seconds of audio are on their way, which a person reads as Transcribing. * The audio uploads while it records, so nothing is left to "upload" after * Stop unless the connection is down or the server refused it. Null when this * device isn't recording that meeting, or when capture failed before Stop * finished it; the server's {@link meetingPhase} says the rest. * * A meeting recorded here earlier (before a reload, a restart, or a move to * another page) is finished in the background from the audio kept here: it is * `uploading` until the server has it all, then `transcribing`, and * `upload_failed` when the server refused it, keeping the audio here for a retry. */ export type MeetingHereStatus = "recording" | "paused" | "uploading" | "transcribing" | "waiting_for_connection" | "upload_failed"; export declare function meetingHereStatus(recorder: (Pick & { uploads?: Readonly> | undefined; }) | null, recordingId: string, online?: boolean): MeetingHereStatus | null; /** The upload failure this device's recorder holds for a meeting, current or earlier. */ export declare function meetingUploadFailure(recorder: (Pick & { uploads?: Readonly> | undefined; }) | null, recordingId: string): { code: string; message: string; } | null; /** * What to say while a meeting is transcribed: a short one is done in a minute * or two; a long one takes a while (its words may be timed on our side), so * the line says how much audio it is and that the reader needn't wait. */ export declare function transcribingText(durationMilliseconds: number, msg?: OpenGeniText): string; /** Refusals that credits, or a model that doesn't use them, fix. */ export declare function transcriptNeedsCredits(code: string | null | undefined): boolean; /** * The model to transcribe a failed meeting with instead, as its one direct * fix: usable here, not the one that failed (nor its provider, when the * provider was the problem), and for a credit refusal one that uses no * credits. A subscription comes first, then a model the deployment covers, * then the workspace's own key. Null when no other model would help. */ export declare function transcriptFixModel(code: string | null | undefined, failed: { providerId: string; model: string; } | null, models: readonly RecordingTranscriptionModel[]): RecordingTranscriptionModel | null; /** The one-word state a list row shows, or null when there is nothing to say. */ export declare function meetingStatusLabel(phase: MeetingPhase, msg?: OpenGeniText): { label: string; tone: "progress" | "danger" | "neutral"; } | null; /** * Plain words for a transcription error code, with what to do about it. The * codes are the worker's: its own (`missing_provider_key`, `invalid_audio`, * ...) and the provider's, prefixed `provider_`. `model` names the model the * version ran and its provider, when the caller knows them, so a missing key * says which provider isn't connected rather than that none is. Its funding * says who can connect it (the deployment's own key is its operator's), and * `pinned` that the deployment offers no other model to try instead. */ export declare function transcriptErrorText(code: string | null, msg?: OpenGeniText, model?: { modelName: string; providerName: string; funding?: string | undefined; pinned?: boolean | undefined; } | null): string; /** * The name to show for a speaker: the person or plain name someone gave it, * else "Speaker 2" for a model's label, or the track's role for a track label. */ export declare function speakerDisplayName(label: string | null, speakers: readonly RecordingSpeaker[], tracks: readonly RecordingTrack[], msg?: OpenGeniText): string; /** "Speaker 2", "Microphone" or "Shared audio" for an unnamed label, in `msg`'s language. */ export declare function defaultSpeakerName(label: string, tracks: readonly RecordingTrack[], msg?: OpenGeniText): string; /** * A live preview lane's name when the microphone is the person recording * (computer or tab audio beside it): `ownerName` for the microphone and * "Others" for the computer or tab audio. Null otherwise, when lanes are * named by their source. */ export declare function ownerLiveLaneName(tracks: readonly { trackNumber: number; source: RecordingTrack["source"]; }[], trackNumber: number, ownerName: string, msg?: OpenGeniText): string | null; /** True when the label has a name of its own: a person, a plain name, or a suggestion. */ export declare function speakerIsNamed(label: string, speakers: readonly RecordingSpeaker[]): boolean; /** * A stable color slot (1-6, the chart palette) per speaker label, in order of * first appearance so the first voice is always the same hue. */ export declare function speakerColorSlots(segments: readonly RecordingTranscriptSegment[]): Map; export type TranscriptTurn = { /** First segment index; stable across edits that keep the order. */ key: number; speakerLabel: string | null; startMilliseconds: number; endMilliseconds: number; segments: RecordingTranscriptSegment[]; }; /** * Consecutive segments of one speaker read as one turn, the way a person reads * a transcript. A long pause starts a new turn even for the same voice, so a * timestamp is never far from the words it marks. */ export declare function groupTranscriptTurns(segments: readonly RecordingTranscriptSegment[], maxGapMilliseconds?: number): TranscriptTurn[]; /** The segment playing at `milliseconds`, or the last one that started before it. */ export declare function activeSegmentIndex(segments: readonly RecordingTranscriptSegment[], milliseconds: number): number | null; /** "ElevenLabs Scribe v2 · English · 3 speakers" style facts for a version. */ export declare function versionSummary(version: RecordingTranscriptVersion, modelName: string | null, locale?: string): string[]; /** * "English" for "en" or a provider's "eng", named in `locale` ("engelsk" in Norwegian); * the code itself when no name is known. */ export declare function languageName(code: string, locale?: string): string; /** * A short, readable default title for a new recording, in local time and the * app's own date words and 24-hour clock: "Meeting, 23 Oct, 14:05". */ export declare function defaultMeetingTitle(now: Date, msg?: OpenGeniText): string; /** * The title to show for a meeting. One started without a title carries the * server's stand-in, "Recording 2026-10-26 11:15 UTC"; it shows as a * recorder would have named it, in the viewer's language and time. */ export declare function meetingTitle(recording: Pick, msg?: OpenGeniText): string; /** A finished stretch of live text on one track, as the live preview shows it. */ export type LiveTranscriptLine = { trackNumber: number; startMilliseconds: number; /** When it ended; without it the line is taken as a moment at its start. */ endMilliseconds?: number; text: string; }; /** Consecutive live lines from one track, read as one turn. */ export type LiveTranscriptTurn = { key: string; trackNumber: number; startMilliseconds: number; texts: string[]; }; /** Consecutive lines from one track read as one turn. */ export declare function groupLiveTurns(lines: readonly LiveTranscriptLine[]): LiveTranscriptTurn[]; /** * Without headphones the microphone also hears the others in a call from the * speakers, so the live preview would show their words twice: from computer * audio, and again as if the person recording said them. Leave out a * microphone line when most of its words (at least two, and 70%) were heard * in computer audio at the same moment. The preview's text comes a sentence * at a time, so a line that also holds the person's own words stays whole. * The transcript does the same word by word once the recording is done. */ export declare function withoutLiveMicrophoneEchoes(lines: readonly Line[], tracks: readonly { trackNumber: number; source: RecordingTrack["source"]; }[]): Line[]; /** * Joins a turn's pieces into readable text. Streaming providers send pieces * that end in a trailing ellipsis while they wait, or a space before a full * stop; joined naively those read as "between you…." or "dog .". */ export declare function tidyLiveText(pieces: readonly string[]): string; /** Words still being heard, without the provider's "still listening" ellipsis. */ export declare function tidyPartialText(text: string): string;