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.

fix(speech): route Pro errors to License, actionable consent message (final review)

enesb421a5c26b17
diff --git a/docs/SERVER.md b/docs/SERVER.md
index 395fa3141..122d8ece3 100644
--- a/docs/SERVER.md
+++ b/docs/SERVER.md
@@ -151,7 +151,7 @@ would otherwise be blocked) — rebuild the renderer or update the rewrite.
### Dictation
-Voice-to-text input works in the browser via the **same core speech service** the desktop app uses. Dictate with ⌘⇧D (or the dock mic button), and transcribed text lands in the active terminal. **Browser constraints:** `getUserMedia` requires a **secure context** — HTTPS or `localhost`; the microphone permission prompt is the browser's own. **Model storage:** Downloaded models (tiny free tier; larger Pro models) are stored on the **server's data dir** under `speech-models/`, persisted across sessions and server restarts.
+Voice-to-text input works in the browser via the **same core speech service** the desktop app uses. Dictate with ⌘⇧D (or the dock mic button); transcribed text goes into the overlay's editable field and is sent only via explicit Send/Insert into the node that was selected when the overlay opened — nothing auto-submits. **Browser constraints:** `getUserMedia` requires a **secure context** — HTTPS or `localhost`; the microphone permission prompt is the browser's own. **Model storage:** Downloaded models (tiny free tier; larger Pro models) are stored on the **server's data dir** under `speech-models/`, persisted across sessions and server restarts.
## Documented deviations from the spec
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 67b09eebb..ebe508390 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -5908,7 +5908,15 @@ export function Canvas() {
{shortcutsOpen && <ShortcutsPanel onClose={() => setShortcutsOpen(false)} />}
{dictationOpen && (
- <DictationOverlay target={dictationTarget} onClose={() => setDictationOpen(false)} />
+ <DictationOverlay
+ target={dictationTarget}
+ onClose={() => setDictationOpen(false)}
+ onOpenLicense={() => {
+ setDictationOpen(false)
+ setSettingsSection('license')
+ setSettingsOpen(true)
+ }}
+ />
)}
{bugReportOpen && (
diff --git a/src/renderer/components/DictationOverlay.test.ts b/src/renderer/components/DictationOverlay.test.ts
index 3771bb5bc..cd1643e9e 100644
--- a/src/renderer/components/DictationOverlay.test.ts
+++ b/src/renderer/components/DictationOverlay.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { isAtRecordingCap } from './DictationOverlay'
+import { isAtRecordingCap, isProGateError } from './DictationOverlay'
// Base64 int16 PCM runs ~2.6 MB/min; WS_MAX_PAYLOAD (src/server/ws.ts) is 8 MiB, so an unbounded
// take would eventually blow the ws frame budget and drop the whole bridge. The 2:30 hard cap
@@ -18,3 +18,20 @@ describe('isAtRecordingCap', () => {
expect(isAtRecordingCap(200_000)).toBe(true)
})
})
+
+// SpeechService.transcribeNow throws `The ${info.id} model requires nodeterm Pro — the tiny
+// model is free.` for a Pro-gated model on a free account — DictationOverlay matches that shape
+// to show a "See nodeterm Pro" action beside the inline error, so pin the substring match here.
+describe('isProGateError', () => {
+ it('matches the Pro-gate error thrown by SpeechService', () => {
+ expect(isProGateError('The base model requires nodeterm Pro — the tiny model is free.')).toBe(
+ true
+ )
+ })
+
+ it('does not match an unrelated transcribe error', () => {
+ expect(isProGateError('Transcription failed.')).toBe(false)
+ expect(isProGateError('No speech detected.')).toBe(false)
+ expect(isProGateError('Download the base model in Settings → Speech first.')).toBe(false)
+ })
+})
diff --git a/src/renderer/components/DictationOverlay.tsx b/src/renderer/components/DictationOverlay.tsx
index 681fbef3d..11153f126 100644
--- a/src/renderer/components/DictationOverlay.tsx
+++ b/src/renderer/components/DictationOverlay.tsx
@@ -28,6 +28,15 @@ export interface DictationTarget {
interface DictationOverlayProps {
target: DictationTarget | null
onClose: () => void
+ /** Routes to Settings → License (same section SpeechSection's own Pro upsells use) — invoked
+ * from the "See nodeterm Pro" action shown beside a Pro-model transcribe error. */
+ onOpenLicense: () => void
+}
+
+/** A Pro-gated model was picked but the account isn't premium — see SpeechService.transcribeNow,
+ * which throws exactly this shape. Matched by substring since the model id is interpolated in. */
+export function isProGateError(message: string): boolean {
+ return message.includes('requires nodeterm Pro')
}
type Phase = 'idle' | 'recording' | 'transcribing' | 'text'
@@ -62,7 +71,7 @@ export function isAtRecordingCap(elapsedMs: number): boolean {
return elapsedMs >= MAX_RECORDING_MS
}
-export function DictationOverlay({ target, onClose }: DictationOverlayProps) {
+export function DictationOverlay({ target, onClose, onOpenLicense }: DictationOverlayProps) {
const { api } = useSession()
const addLocalUser = useChatSessions((s) => s.addLocalUser)
const chatWorking = useChatSessions((s) =>
@@ -137,7 +146,9 @@ export function DictationOverlay({ target, onClose }: DictationOverlayProps) {
try {
const ok = await window.nodeTerminal.speech.micConsent()
if (!ok) {
- setError('Microphone access was not granted.')
+ setError(
+ 'Microphone access was not granted — allow it in System Settings (or your browser site settings) and try again.'
+ )
return
}
} catch (err) {
@@ -325,7 +336,16 @@ export function DictationOverlay({ target, onClose }: DictationOverlayProps) {
)}
</div>
- {error && <div className="dictation__error">{error}</div>}
+ {error && (
+ <div className="dictation__error">
+ <span>{error}</span>
+ {isProGateError(error) && (
+ <button type="button" className="dictation__error-action" onClick={onOpenLicense}>
+ See nodeterm Pro
+ </button>
+ )}
+ </div>
+ )}
<div className="dictation__actions">
<button type="button" className="dictation__btn" onClick={copy} disabled={!hasText}>
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index e2f5f2459..8f591d45c 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -646,6 +646,10 @@ body,
}
.dictation__error {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
padding: 7px 10px;
border-radius: 8px;
font-size: 12px;
@@ -654,6 +658,18 @@ body,
border: 1px solid rgba(255, 69, 58, 0.35);
}
+.dictation__error-action {
+ flex-shrink: 0;
+ background: transparent;
+ border: none;
+ color: #0a84ff;
+ font-size: 12px;
+ font-weight: 500;
+ cursor: pointer;
+ padding: 0;
+ text-decoration: underline;
+}
+
.dictation__actions {
display: flex;
justify-content: flex-end;