Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat(meetings): register tinfoil-realtime meeting provider

Alcahestad38ed49ff1a
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index a328ed081..4ff828d59 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -19,12 +19,10 @@ const CortiStreaming = require("./cortiStreaming");
const OpenAIRealtimeStreaming = require("./openaiRealtimeStreaming");
const { getCortiToken } = require("./cortiAuth");
const { createTinfoilRealtimeSocket } = require("./tinfoilSecureClient");
+const { TINFOIL_REALTIME_MODEL } = require("./tinfoilRealtimeStreaming");
const { getTinfoilChatModels } = require("./tinfoilCatalog");
const { transcribeWithTinfoil } = require("./tinfoilTranscription");
const AudioStorageManager = require("./audioStorage");
-
-// Tinfoil's only realtime STT model — fallback when the renderer omits one.
-const TINFOIL_REALTIME_MODEL = "voxtral-mini-4b-realtime";
const liveSpeakerIdentifier = require("./liveSpeakerIdentifier");
const MeetingEchoLeakDetector = require("./meetingEchoLeakDetector");
const { partitionPendingMicFinals, isWithinRetractWindow } = require("./meetingMicHoldback");
@@ -54,19 +52,10 @@ const {
resolveContextSileroEnabled,
} = require("./whisperVadConfig");
-const STREAMING_CLIENT_BY_PROVIDER = {
- "openai-realtime": OpenAIRealtimeStreaming,
- "assemblyai-realtime": AssemblyAiStreaming,
- "deepgram-realtime": DeepgramStreaming,
- "corti-realtime": CortiStreaming,
-};
-const ALLOWED_MEETING_PROVIDERS = new Set([
- "local",
- "openai-realtime",
- "assemblyai-realtime",
- "deepgram-realtime",
- "corti-realtime",
-]);
+const {
+ STREAMING_CLIENT_BY_PROVIDER,
+ ALLOWED_MEETING_PROVIDERS,
+} = require("./meetingStreamingProviders");
// Meeting capture runs at 24 kHz (see meetingRecordingStore AudioContext); cloud
// streaming providers must be told the true PCM rate or they misread the audio.
diff --git a/src/helpers/meetingStreamingProviders.js b/src/helpers/meetingStreamingProviders.js
new file mode 100644
index 000000000..f14cf91f7
--- /dev/null
+++ b/src/helpers/meetingStreamingProviders.js
@@ -0,0 +1,19 @@
+const OpenAIRealtimeStreaming = require("./openaiRealtimeStreaming");
+const AssemblyAiStreaming = require("./assemblyAiStreaming");
+const DeepgramStreaming = require("./deepgramStreaming");
+const CortiStreaming = require("./cortiStreaming");
+const { TinfoilRealtimeStreaming } = require("./tinfoilRealtimeStreaming");
+
+const STREAMING_CLIENT_BY_PROVIDER = {
+ "openai-realtime": OpenAIRealtimeStreaming,
+ "assemblyai-realtime": AssemblyAiStreaming,
+ "deepgram-realtime": DeepgramStreaming,
+ "corti-realtime": CortiStreaming,
+ "tinfoil-realtime": TinfoilRealtimeStreaming,
+};
+
+// Derived from the registry so an allowed provider can never lack a client
+// class and silently fall through to the OpenAI default.
+const ALLOWED_MEETING_PROVIDERS = new Set(["local", ...Object.keys(STREAMING_CLIENT_BY_PROVIDER)]);
+
+module.exports = { STREAMING_CLIENT_BY_PROVIDER, ALLOWED_MEETING_PROVIDERS };
diff --git a/test/helpers/meetingStreamingProviders.test.js b/test/helpers/meetingStreamingProviders.test.js
new file mode 100644
index 000000000..ccbd4a263
--- /dev/null
+++ b/test/helpers/meetingStreamingProviders.test.js
@@ -0,0 +1,42 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+
+const load = () => import("../../src/helpers/meetingStreamingProviders.js");
+
+test("tinfoil-realtime resolves to the Tinfoil client, never the OpenAI default", async () => {
+ const { STREAMING_CLIENT_BY_PROVIDER } = await load();
+ const { TinfoilRealtimeStreaming } = await import("../../src/helpers/tinfoilRealtimeStreaming.js");
+ const OpenAIRealtimeStreaming = (await import("../../src/helpers/openaiRealtimeStreaming.js"))
+ .default;
+
+ assert.equal(STREAMING_CLIENT_BY_PROVIDER["tinfoil-realtime"], TinfoilRealtimeStreaming);
+ assert.notEqual(STREAMING_CLIENT_BY_PROVIDER["tinfoil-realtime"], OpenAIRealtimeStreaming);
+});
+
+test("every allowed realtime provider has a streaming client (no silent OpenAI fallback)", async () => {
+ const { STREAMING_CLIENT_BY_PROVIDER, ALLOWED_MEETING_PROVIDERS } = await load();
+
+ for (const provider of ALLOWED_MEETING_PROVIDERS) {
+ if (provider === "local") continue;
+ assert.equal(
+ typeof STREAMING_CLIENT_BY_PROVIDER[provider],
+ "function",
+ `${provider} is allowed but would fall through to the OpenAI default class`
+ );
+ }
+});
+
+test("allow-list accepts tinfoil-realtime and local", async () => {
+ const { ALLOWED_MEETING_PROVIDERS } = await load();
+
+ assert.equal(ALLOWED_MEETING_PROVIDERS.has("tinfoil-realtime"), true);
+ assert.equal(ALLOWED_MEETING_PROVIDERS.has("local"), true);
+});
+
+test("allow-list rejects unknown and batch-only providers", async () => {
+ const { ALLOWED_MEETING_PROVIDERS } = await load();
+
+ for (const provider of ["tinfoil", "openai", "mistral-realtime", "grok-stt", "", undefined]) {
+ assert.equal(ALLOWED_MEETING_PROVIDERS.has(provider), false, `${provider} must be rejected`);
+ }
+});