/** * An in-memory recordings API for the Meetings preview: a few meetings in * every state, one full transcript with named and unnamed speakers, people * and models. Edits apply to the fixture so naming and moving work. */ import type { ListRecordingModelsResponse, Recording, RecordingLiveSegment, RecordingNote, RecordingNoteKind, RecordingPerson, RecordingSpeaker, RecordingTranscriptSegment, RecordingTranscriptVersion, } from "@opengeni/contracts"; import type { RecordingsClientLike } from "../recordings"; const WORKSPACE = "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"; const ME = "user:ingrid"; const SALES_WORKSPACE = "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e"; /** The viewer's own Only me meeting stored in the Sales workspace. */ export const ELSEWHERE_RECORDING_ID = "3e2d1c0b-9a8f-4e7d-8c6b-5a4f3e2d1c0b"; const NOW = Date.now(); const minutes = (count: number) => count * 60_000; const iso = (offset: number) => new Date(NOW - offset).toISOString(); /** What the live preview has heard so far in the meeting being recorded. */ export const LIVE_LINES: readonly [track: number, seconds: number, text: string][] = [ [0, 4, "Morning, everyone. Let's keep this one short."], [1, 9, "Morning. I can start with the release."], [1, 13, "The build went out last night and the error rate is flat."], [0, 21, "Good. Anything blocking the migration?"], [1, 25, "Only the review on the schema change. I'll ping Tomas after this."], [0, 33, "Great, then let's look at the onboarding numbers."], ]; export const LIVE_RECORDING_ID = "3d4e5f6a-7b8c-4d9e-8f0a-1b2c3d4e5f60"; /** A meeting whose transcript failed before its audio was prepared. */ export const FAILED_RECORDING_ID = "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e"; function version( recordingId: string, number: number, state: RecordingTranscriptVersion["state"], extra: Partial = {}, ): RecordingTranscriptVersion { return { id: `${recordingId}-v${number}`, recordingId, versionNumber: number, providerId: "elevenlabs", model: "scribe_v2", options: {}, state, isCurrent: state === "complete", languages: state === "complete" ? ["en"] : [], diarized: true, diarization: "provider", audioMilliseconds: 0, segmentCount: 0, costUsd: null, requestedBySubjectId: ME, errorCode: null, createdAt: iso(minutes(40)), completedAt: state === "complete" ? iso(minutes(38)) : null, ...extra, }; } function recording( id: string, title: string, startedOffset: number, durationMilliseconds: number, extra: Partial = {}, ): Recording { return { id, workspaceId: WORKSPACE, ownerSubjectId: ME, visibility: "private", title, purpose: "meeting", state: "ready", startedAt: iso(startedOffset), captureEndedAt: iso(startedOffset - durationMilliseconds), durationMilliseconds, errorCode: null, externalRef: null, audioDeletedAt: null, metadata: {}, transcription: {}, tracks: [ { trackNumber: 0, kind: "audio", source: "microphone", mimeType: "audio/webm", chunkCount: 12, totalBytes: 2_400_000, durationMilliseconds, playable: true, video: null, live: null, }, { trackNumber: 1, kind: "audio", source: "system", mimeType: "audio/webm", chunkCount: 12, totalBytes: 2_400_000, durationMilliseconds, playable: true, video: null, live: null, }, ], transcript: version(id, 1, "complete"), createdAt: iso(startedOffset), updatedAt: iso(startedOffset - durationMilliseconds), ...extra, }; } /** Its audio is uploaded, but the worker hasn't made a playable copy yet. */ function unprepared(meeting: Recording): Recording { return { ...meeting, tracks: meeting.tracks.map((track) => ({ ...track, playable: false })) }; } const LINES: Array<[label: string, seconds: number, text: string]> = [ [ "track-0", 2, "Morning, everyone. Let's start with the onboarding numbers, then the pricing page.", ], ["speaker_0", 9, "Sure. Sign-ups are up eleven percent week over week, mostly from the docs."], [ "speaker_0", 16, "Activation is flat, though. People connect a repository and then stall at the first run.", ], [ "speaker_1", 27, "That matches the session replays. The empty state after connecting doesn't say what to do next.", ], [ "track-0", 38, "Can we put a suggested first task right there? Something that finishes in under a minute.", ], ["speaker_1", 47, "Yes. I can have a draft by Thursday, with two or three starter tasks."], [ "speaker_0", 58, "I'd keep it to one. Three choices is how we got the stall in the first place.", ], ["track-0", 71, "Fair. One suggested task, and a link to the full list for people who want it."], ["speaker_2", 80, "Works for me."], ["track-0", 96, "Pricing page next. Tomas, where did we land on the annual discount?"], [ "speaker_0", 104, "Two months free on annual. Finance is fine with it as long as we show the monthly price first.", ], [ "speaker_2", 118, "Then the comparison table needs a toggle. I'll mock both versions so we can pick.", ], ["track-0", 131, "Great. Let's review both on Monday and ship the one that reads clearer."], ["speaker_0", 140, "I'll send the numbers before then."], ]; const TOMAS = "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e"; /** * The ready meeting's notes, as an agent writes them: an overview, topics with * nested points, then Decisions and Action items. Speakers and people are * mentions (`speaker: