Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(speech): shared model catalog + speech settings (desktop-dictation Task 1)

enesea22e06e078c
diff --git a/src/shared/speech.test.ts b/src/shared/speech.test.ts
new file mode 100644
index 000000000..bb4a9dcd8
--- /dev/null
+++ b/src/shared/speech.test.ts
@@ -0,0 +1,27 @@
+import { describe, expect, it } from 'vitest'
+import { WHISPER_MODELS, whisperModel, WHISPER_DOWNLOAD_BASE } from './speech'
+import { DEFAULT_SETTINGS } from './types'
+
+describe('whisper model catalog', () => {
+ it('matches the spec table exactly', () => {
+ expect(WHISPER_MODELS.map((m) => m.id)).toEqual(['tiny', 'base', 'small', 'large-v3-turbo'])
+ expect(WHISPER_MODELS.map((m) => m.file)).toEqual([
+ 'ggml-tiny.bin', 'ggml-base.bin', 'ggml-small.bin', 'ggml-large-v3-turbo.bin',
+ ])
+ // Only tiny is free — the Pro split the spec mandates.
+ expect(WHISPER_MODELS.filter((m) => !m.pro).map((m) => m.id)).toEqual(['tiny'])
+ })
+
+ it('looks up by id and rejects unknowns', () => {
+ expect(whisperModel('base')?.approxMB).toBe(142)
+ expect(whisperModel('nope')).toBeUndefined()
+ })
+
+ it('download base is the whisper.cpp HF repo', () => {
+ expect(WHISPER_DOWNLOAD_BASE).toBe('https://huggingface.co/ggerganov/whisper.cpp/resolve/main/')
+ })
+
+ it('speech settings default to free local dictation', () => {
+ expect(DEFAULT_SETTINGS.speech).toEqual({ engine: 'whisper', model: 'tiny', language: 'auto' })
+ })
+})
diff --git a/src/shared/speech.ts b/src/shared/speech.ts
new file mode 100644
index 000000000..58265ebb7
--- /dev/null
+++ b/src/shared/speech.ts
@@ -0,0 +1,21 @@
+/** Downloadable whisper.cpp models (ggml files on HuggingFace). `pro` marks
+ * the paid tier — tiny stays free (the desktop mirror of mobile's split). */
+export interface WhisperModelInfo {
+ id: string
+ file: string
+ approxMB: number
+ pro: boolean
+}
+
+export const WHISPER_MODELS: WhisperModelInfo[] = [
+ { id: 'tiny', file: 'ggml-tiny.bin', approxMB: 75, pro: false },
+ { id: 'base', file: 'ggml-base.bin', approxMB: 142, pro: true },
+ { id: 'small', file: 'ggml-small.bin', approxMB: 466, pro: true },
+ { id: 'large-v3-turbo', file: 'ggml-large-v3-turbo.bin', approxMB: 1600, pro: true },
+]
+
+export const WHISPER_DOWNLOAD_BASE = 'https://huggingface.co/ggerganov/whisper.cpp/resolve/main/'
+
+export function whisperModel(id: string): WhisperModelInfo | undefined {
+ return WHISPER_MODELS.find((m) => m.id === id)
+}
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 87bd14359..f5326a163 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -440,6 +440,14 @@ export interface ClaudeAccount {
createdAt: number
}
+export interface SpeechSettings {
+ engine: 'whisper' | 'cloud'
+ /** WhisperModelInfo id — meaningful while engine === 'whisper'. */
+ model: string
+ /** BCP-47-ish hint or 'auto'. */
+ language: string
+}
+
/** User-configurable application settings (settings.json). */
export interface Settings {
fontSize: number
@@ -503,6 +511,8 @@ export interface Settings {
/** Keep a standing relay host connection so a paired phone can reach this Mac from anywhere
* (end-to-end encrypted). Pro-only; default off. Toggle in Settings → Phone. */
phoneAccessEnabled: boolean
+ /** Dictation (desktop/server). Written as a whole object by the renderer. */
+ speech: SpeechSettings
}
export const DEFAULT_SETTINGS: Settings = {
@@ -539,7 +549,8 @@ export const DEFAULT_SETTINGS: Settings = {
// (settings hydrate merges over DEFAULT_SETTINGS) — a deliberate behavior change.
claudePermissionMode: 'auto',
telemetryEnabled: false,
- phoneAccessEnabled: false
+ phoneAccessEnabled: false,
+ speech: { engine: 'whisper', model: 'tiny', language: 'auto' },
}
export interface SettingsApi {