dsh-voice-mode 0.7.39 → 0.7.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +70 -44
- package/README.md +112 -39
- package/SECURITY.md +20 -16
- package/lib/client.js +4700 -914
- package/lib/index.js +1912 -402
- package/lib/sense-worker.mjs +5 -1
- package/lib/tts-vits-worker.cjs +21 -6
- package/package.json +5 -3
- package/scripts/check-anchors.mjs +12 -1
- package/scripts/prefetch.mjs +66 -26
package/README.en.md
CHANGED
|
@@ -16,11 +16,9 @@ interrupts playback and the running turn. No additional speech-service API key i
|
|
|
16
16
|
|
|
17
17
|

|
|
18
18
|
|
|
19
|
-
> **Current status
|
|
20
|
-
|
|
21
|
-
Host compatibility check: anchors, types and isolated runtime checks passed for dsh 0.2.2-rc.3 (including the client side). See the [compatibility record](../../docs/compat-contract.md) for evidence and unverified layers; this does not establish microphone or cross-platform acceptance.
|
|
19
|
+
> **Current status:** Supports 7 built-in online TTS presets with per-preset API keys, Xiaomi MiMo TTS, editable post-ASR replacement rules, a 4-tab settings panel, localized keyboard/touch guidance (including macOS keycap badges and `220ms` keyboard push-to-talk), and cross-platform worker isolation. Check npm and [Releases](https://github.com/qishuilalala/dsh-voice-mode/releases) for published versions.
|
|
22
20
|
>
|
|
23
|
-
>
|
|
21
|
+
> **Compatibility & verification boundaries:** Client injection anchors, host/client typechecks, and isolated runtime checks pass through `dsh 0.2.2-rc.5`. See the [compatibility contract](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/compat-contract.md) for the full host/OS/browser matrix and unverified layers, the [changelog](https://github.com/qishuilalala/dsh-voice-mode/blob/main/CHANGELOG.md), and the [roadmap](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/plan/roadmap-2026-10.md). CI does not replace real-device microphone or acoustic acceptance; the declared `dsh` range is `>=0.1.1-rc.2 <0.3.0-0`, and untested host versions are not guaranteed.
|
|
24
22
|
|
|
25
23
|
|
|
26
24
|
---
|
|
@@ -40,15 +38,15 @@ Host compatibility check: anchors, types and isolated runtime checks passed for
|
|
|
40
38
|
|
|
41
39
|
## ✨ Features
|
|
42
40
|
|
|
43
|
-
- **Voice mode**: toggle with the microphone button in the input toolbar or the global shortcut `Ctrl+Shift+V
|
|
44
|
-
- **Three interaction modes (switchable in settings or
|
|
45
|
-
- `toggle` (default) continuous listening: RMS VAD segmentation → streaming zipformer2 ASR (words appear as you speak, live caption preview) → automatic sentence split after 1500 ms of silence into the draft, consecutive segments joined into one message, then auto-sent after ~1.2 s more of silence (≈2.7 s total); hold `Ctrl` to force an immediate send
|
|
46
|
-
- `hold` push-to-talk: from idle, **just hold the mic button to start recording and release to send** (no need to tap in first; a short tap still enters/exits); after sending, voice mode exits on its own once the reply finishes (read aloud, if on); with auto-send off, releasing only leaves the text in the composer (not sent) and exits; if you hold without speaking it exits after ~25 s;
|
|
47
|
-
- `once` one-shot: talk like `toggle`; after sending, the mic turns off and voice mode exits once the reply finishes naturally; holding the mic button or pressing Ctrl interrupts the reply, resumes the mic, and keeps voice mode on for another utterance (with auto-send off: exits after the utterance, text stays in the draft)
|
|
41
|
+
- **Voice mode**: toggle with the microphone button in the input toolbar or the global shortcut `Ctrl+Shift+V` (`⌃ Control + ⇧ Shift + V` on macOS — note `Control`, not `⌘ Command`); with the caret in the composer, `Alt+Enter` (`⌥ Option + Return` on macOS) toggles it too, without inserting a newline; globally single-active (only one session is in voice mode at a time; switching sessions yields automatically)
|
|
42
|
+
- **Three interaction modes (switchable in settings, right-click menu, or touch `⋯` menu)**:
|
|
43
|
+
- `toggle` (default) continuous listening: RMS VAD segmentation → streaming zipformer2 ASR (words appear as you speak, live caption preview) → automatic sentence split after 1500 ms of silence into the draft, consecutive segments joined into one message, then auto-sent after ~1.2 s more of silence (≈2.7 s total); hold `Ctrl` (`⌃ Control` on macOS) while speaking to force an immediate send
|
|
44
|
+
- `hold` push-to-talk: from idle, **just hold the mic button to start recording and release to send** (no need to tap in first; a short tap still enters/exits); while voice mode is active, you can also **hold `Ctrl` (`⌃ Control` on macOS, ≥220 ms)** to record by keyboard and release to send; after sending, voice mode exits on its own once the reply finishes (read aloud, if on); with auto-send off, releasing only leaves the text in the composer (not sent) and exits; if you hold without speaking it exits after ~25 s; swipe up, `Esc`, window blur, or pressing another key combo cancels the segment; pauses do not split while held
|
|
45
|
+
- `once` one-shot: talk like `toggle`; after sending, the mic turns off and voice mode exits once the reply finishes naturally; holding the mic button or pressing `Ctrl` (`⌃ Control` on macOS) interrupts the reply, resumes the mic, and keeps voice mode on for another utterance (with auto-send off: exits after the utterance, text stays in the draft)
|
|
48
46
|
- **Read-aloud scope** (`readAloud`): `voice` (default) only replies in voice mode; `always` every reply in the visible session, typed ones included (with the session open in several tabs, only the last-viewed tab plays; switching sessions immediately stops the previous session and discards its queued speech); `off` never
|
|
49
|
-
- **The mic button is the status panel** (PR #16 by [@dyguests](https://github.com/dyguests)): green bars follow your voice while listening, blue bars follow playback while reading, a spinner while `once` waits for the reply, a check mark before it exits; orange dot = speech detected, red dot = error (hover for details). Right-click (or
|
|
50
|
-
- **Wake word (optional, off by default)**: after setting `wakeWord`, entering voice mode starts in standby, and recognition only begins once the wake word is spoken (e.g. `你好小D`). **You may say it together with your command** ("wake word, check the weather") — the wake word is stripped from the transcript/caption and never sent; matching is fault-tolerant (homophone substitutions, a wrong first char, leading fillers); 3-4 characters recommended; in standby the status bar live-shows "say '<word>' · what it heard". Boundaries (important): **toggle mode only** (inactive
|
|
51
|
-
- **Caption tiers
|
|
47
|
+
- **The mic button is the status panel** (PR #16 by [@dyguests](https://github.com/dyguests)): green bars follow your voice while listening, blue bars follow playback while reading, a spinner while `once` waits for the reply, a check mark before it exits; orange dot = speech detected, red dot = error (hover for details). Right-click (or keyboard menu key) on desktop, or tap the `⋯` button (or 450 ms idle long-press outside `hold` mode) on touch devices for quick settings. Turn off the status bar and captions to keep all voice UI on the button
|
|
48
|
+
- **Wake word (optional, off by default)**: after setting `wakeWord`, entering voice mode starts in standby, and recognition only begins once the wake word is spoken (e.g. `你好小D`). **You may say it together with your command** ("wake word, check the weather") — the wake word is stripped from the transcript/caption and never sent; matching is fault-tolerant (homophone substitutions, a wrong first char, leading fillers); 3-4 characters recommended; in standby the status bar live-shows "say '<word>' · what it heard". Boundaries (important): **toggle mode only** (inactive in `hold` mode; works normally when idle under `manual` or `detect` fallback); **it must be repeated after each completed utterance or barge-in** (if you only said the wake word, the engine keeps listening so you may pause before the command); **saying it while the agent is reading does not trigger** (barge-in is VAD-based and unrelated to the wake word)
|
|
49
|
+
- **Caption tiers**: `captionFontSize` 4 levels (0=12px / 1=14px / 2=18px / 3=24px) + `captionMaxWidth` 3 levels (0=50vw / 1=70vw / 2=90vw); adapts to narrow viewports and safe areas, with recent-sentence history after playback
|
|
52
50
|
- **Yield semantics (ADR-0008)**: `backchannelYield` on by default — saying `嗯 / 对 / right` while the AI is reading auto-pauses for 1.5 s; genuine speech still triggers hard barge-in; lets the LLM yield the turn
|
|
53
51
|
- **Output pipeline**: only the final answer's `text-delta` is read (reasoning/tool calls are skipped), streamed sentence-by-sentence (Edge cloud by default; local VITS / Kokoro, int8/fp32, optional) with a live caption overlay at the bottom-right; tool calls trigger a beep; the full text is still written to the chat; in voice mode a spoken-format system prompt is injected (short natural sentences, no Markdown decoration), and the reader side strips markers as well for a smoother listening experience
|
|
54
52
|
- **Barge-in**: three sensitivity levels of voice-onset detection → local mute + host synth queue invalidation (epoch) + running turn cancellation (the half-finished part is kept and naturally flows into your new message). With a wake word set, barge-in **remains speak-to-interrupt** (the gate is the VAD, not the wake word; the engine returns to standby afterwards)
|
|
@@ -60,21 +58,20 @@ Host compatibility check: anchors, types and isolated runtime checks passed for
|
|
|
60
58
|
|
|
61
59
|
---
|
|
62
60
|
|
|
63
|
-
## ⌨️ Interaction gestures
|
|
61
|
+
## ⌨️ Interaction gestures & shortcuts
|
|
64
62
|
|
|
65
|
-
Speaking to trigger a hard interruption stops playback and requests cancellation of the current running turn.
|
|
63
|
+
Speaking to trigger a hard interruption stops playback and requests cancellation of the current running turn. Pressing `Esc` once (or clicking stop) stops read-aloud only; double-pressing `Esc` exits voice mode.
|
|
66
64
|
|
|
67
|
-
|
|
|
68
|
-
| --- | --- |
|
|
69
|
-
|
|
|
70
|
-
| `Alt+Enter`
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
| Type in the input box | Auto-exit voice mode (draft is kept) |
|
|
65
|
+
| Action | Windows / Linux | macOS | Behaviour |
|
|
66
|
+
| --- | --- | --- | --- |
|
|
67
|
+
| Enter / exit voice mode | `Ctrl+Shift+V` | `⌃ Control + ⇧ Shift + V` | App-wide toggle (note: `Control` on macOS, not `⌘ Command`; customizable or clearable in Settings → Shortcuts). Clicking the mic button does not steal composer focus |
|
|
68
|
+
| Toggle from composer | `Alt+Enter` | `⌥ Option + Return` | Toggles voice mode while the caret is in the chat input without inserting a newline; leaves `Ctrl/⌘ + Enter` intact for sending |
|
|
69
|
+
| Continuous listening (`toggle`) | Speak directly; hold `Ctrl` to send now | Speak directly; hold `⌃ Control` to send now | Splits into draft after ~1500 ms silence and auto-sends after ~2.7 s total quiet; holding `Ctrl` / `⌃ Control` ≥250 ms while speaking sends immediately on release |
|
|
70
|
+
| Push-to-talk (`hold`) — pointer/touch | Hold the mic button | Hold the mic button | From idle, hold the mic button directly to record and release to send (auto-exits once the reply finishes); swipe up or press `Esc` to cancel; short tap enters/exits |
|
|
71
|
+
| Push-to-talk (`hold`) — keyboard | Hold `Ctrl` (≥220 ms) | Hold `⌃ Control` (≥220 ms) | While in voice mode, hold `Ctrl` / `⌃ Control` to record and release to send; pressing `Esc`, blurring the window, or pressing another key combo discards the segment |
|
|
72
|
+
| Interrupt / stop reading | Speak / hold `Ctrl` / `Esc` | Speak / hold `⌃ Control` / `Esc` | Under `auto`, speaking interrupts immediately; under `manual` (or `detect` without native AEC), hold mic or `Ctrl` / `⌃ Control` during playback to interrupt; `Esc` stops reading, double-`Esc` exits |
|
|
73
|
+
| Quick settings menu | Right-click mic (or Menu key) | Right-click / two-finger click mic | On touch devices, tap `⋯` next to the mic (or 450 ms idle long-press outside `hold` mode) |
|
|
74
|
+
| Type in the input box | Type in composer | Type in composer | Auto-exits voice mode while preserving the current draft |
|
|
78
75
|
|
|
79
76
|
---
|
|
80
77
|
|
|
@@ -131,16 +128,16 @@ If a wake word is configured, you land in standby first (the status bar prompts
|
|
|
131
128
|
- On dsh 0.1.7+ the values are stored in the plugin's own file `~/.dsh/voice-mode.settings.json` (under `$DSH_HOME`) and take precedence over same-named keys in the profile config. The first run migrates the old `voice-mode:` block from `settings.yaml(.imported)` once. To reset, set the file's content to `{}` (do not delete it).
|
|
132
129
|
|
|
133
130
|
|
|
134
|
-
### Full
|
|
131
|
+
### Full 35-key settings table
|
|
135
132
|
|
|
136
133
|
| Key | Default | Description |
|
|
137
134
|
| --- | --- | --- |
|
|
138
|
-
| `ttsEngine` | `edge` | Read-aloud engine: `edge` Microsoft cloud (default, fast) / `vits` local Chinese / `kokoro` local zh+en / `openai` any OpenAI-compatible server (see below); **applies live** |
|
|
135
|
+
| `ttsEngine` | `edge` | Read-aloud engine: `edge` Microsoft cloud (default, fast) / `vits` local Chinese / `kokoro` local zh+en / `openai` any OpenAI-compatible server / `mimo` Xiaomi MiMo (independent `mimoTts.apiKey`, see below); **applies live** |
|
|
139
136
|
| `kokoroModel` | `int8` | Kokoro precision: `int8` (default, 109 MB, CPU/low-bandwidth) / `fp32` (311 MB, better quality, GPU/large memory); same 103 voices; **applies live** |
|
|
140
137
|
| `voice` | per engine | Voice: 5 VITS speakers; 103 Kokoro voices (◀▶ stepper; 62/68/75/76 favourite males pinned); Edge ShortNames below. The inline "试听" button previews it at the current rate |
|
|
141
|
-
| `rate` | `1.1` | Reading speed multiplier (0.5 slow ~ 2.0 fast), **applies live**
|
|
138
|
+
| `rate` | `1.1` | Reading speed multiplier (0.5 slow ~ 2.0 fast), **applies live** |
|
|
142
139
|
| `interruptLevel` | `0` | Barge-in sensitivity (host-side VAD frame detection + echo gate): 0 high threshold (3 frames) / 1 medium (2 frames) / 2 low (1 frame) |
|
|
143
|
-
| `bargeInMode` | `detect` | Barge-in mode: `detect` auto-probes native echo cancellation (default;
|
|
140
|
+
| `bargeInMode` | `detect` | Barge-in mode: `detect` auto-probes native echo cancellation (default; switches playback to hold-to-interrupt when inactive) / `auto` force interrupt as soon as you speak (headphones / quiet rooms) / `manual` manual interrupt (recommended on loudspeakers: speak directly or say the wake word when idle, and hold mic/`Ctrl` to interrupt during playback; see ADR-0006) |
|
|
144
141
|
| `echoGateDb` | `6` | Fallback echo-gate threshold when native AEC is unavailable. Inactive with native AEC. Only on the fallback path, a higher value is more conservative; verify the device and barge-in mode before tuning |
|
|
145
142
|
| `silenceMs` | `1500` | Silence pause in ms that marks the end of a complete sentence |
|
|
146
143
|
| `idleTimeoutMinutes` | `5` | Minutes of inactivity before auto-exiting voice mode (reading, speech and a running turn renew the timer, subject to a two-hour cap since the last user activity) |
|
|
@@ -150,19 +147,26 @@ If a wake word is configured, you land in standby first (the status bar prompts
|
|
|
150
147
|
| `readAloud` | `voice` | What gets read aloud: `voice` only replies in voice mode; `always` every reply in the visible session, typed ones included; switching sessions stops the previous read-aloud; `off` never |
|
|
151
148
|
| `showStatusBar` | `true` | Voice status bar above the composer; when off, status lives on the mic button (timer below it, notices beside it) |
|
|
152
149
|
| `showCaptions` | `true` | Floating caption while reading aloud |
|
|
153
|
-
| `autoResume` | `false` | Auto-restore voice mode when switching back to your last voice session (off by default). When on: the next time you enter that session it auto-enters voice mode and restores it; when off, press `Ctrl+Shift+V` manually |
|
|
150
|
+
| `autoResume` | `false` | Auto-restore voice mode when switching back to your last voice session (off by default). When on: the next time you enter that session it auto-enters voice mode and restores it; when off, press `Ctrl+Shift+V` manually. While it is off, switching back to your last voice session shows a short grey hint about this next to the input box, once per browser |
|
|
154
151
|
| `shortcut` | `Ctrl+Shift+V` | Shortcut to enter / exit voice mode (modifiers Ctrl/Shift/Alt/Meta + one letter / digit / Enter / Space / Tab). In the "Shortcuts" group of the settings page, click "Record" and press the combo (`Esc` cancels, `Backspace` clears; a missing modifier or an unsupported key such as arrows / F-keys is flagged); **empty = disabled**, use the mic button instead; **applies immediately** |
|
|
155
152
|
| `composerShortcut` | `Alt+Enter` | Shortcut that toggles voice mode while the caret is in the composer (Option+Enter on Mac), no newline inserted; same format and recording as `shortcut`; **empty = disabled**; the settings card's own inputs are not intercepted; `Cmd/Ctrl+Enter` is not used; **applies immediately**. "Restore defaults" resets both shortcuts to `Ctrl+Shift+V` and `Alt+Enter` |
|
|
156
|
-
| `wakeWord` | empty (off) | Wake word (e.g. `你好小D`): speak it after entering to activate; empty = off. **May be said together with your command** — the wake word is stripped and never sent; fault-tolerant matching (edit distance ≤1 + a 3-char leading window absorbs homophones/fillers); **3-4 characters recommended** (single-char words get no tolerance; a 2-char word also absorbs any same-first-char 2-char word); must be repeated after each utterance split or barge-in; **
|
|
153
|
+
| `wakeWord` | empty (off) | Wake word (e.g. `你好小D`): speak it after entering to activate; empty = off. **May be said together with your command** — the wake word is stripped and never sent; fault-tolerant matching (edit distance ≤1 + a 3-char leading window absorbs homophones/fillers); **3-4 characters recommended** (single-char words get no tolerance; a 2-char word also absorbs any same-first-char 2-char word); must be repeated after each utterance split or barge-in; **inactive in hold-to-talk mode** (works normally when idle under `manual` or `detect` fallback); not triggered while the agent is reading |
|
|
157
154
|
| `spokenFormat` | `true` | Spoken-format system prompt: inject "short natural sentences, no Markdown decoration" into voice-mode replies only, **applies live** |
|
|
158
155
|
| `senseVoice` | `true` | Re-transcribe the finalized utterance with SenseVoice (punctuation + number normalization, more accurate; on by default). **Turning it off saves ~228 MB of models** and uses streaming recognition only (faster, less accurate) |
|
|
159
156
|
| `toolBeep` | `false` | Tool-call beep (off by default): when on, a short beep plays each time the agent calls a tool; off = silent |
|
|
160
157
|
| `senseITN` | `true` | SenseVoice inverse text normalization (number / date / currency; on by default) |
|
|
158
|
+
| `openaiPreset` | empty (manual) | Online TTS preset id (`siliconflow-cosyvoice2` / `siliconflow-fish` / `openrouter-openai` / `openai-official` / `groq-playai` / `selfhosted-kokoro` / `selfhosted-vllm`, or `custom`). Fills baseUrl/model and falls back to the preset voice when `voice` is empty; keys prefer settings card > `openaiTts.apiKeys[preset]` > `openaiTts.apiKey`; **applies live** |
|
|
159
|
+
| `openaiBaseUrl` | empty (preset/config) | Online TTS endpoint override configurable directly in the settings card (priority: settings > preset > `openaiTts.baseUrl`); pair with `custom` preset for any OpenAI-compatible server; **applies live** |
|
|
160
|
+
| `openaiModel` | empty | Online TTS model override (same priority as `openaiBaseUrl`); **applies live** |
|
|
161
|
+
| `openaiApiKey` | empty (config fallback) | Online TTS API key entered in the settings card; stored in the host-side `0600` settings file and **never sent back to the browser** (`GET /voice-mode/settings` returns empty string + `keys.*` booleans); priority: per-preset key > global key > `openaiTts.apiKeys[preset]` > `openaiTts.apiKey`; **applies live** |
|
|
162
|
+
| `openaiApiKeys` | `{}` (none) | Per-preset API keys: `{presetId: key}` map in the settings card; whichever preset is selected uses its own key without 401 mismatches when switching presets; empty entries fall back to the global key; **booleans only, never plaintext**; **applies live** |
|
|
163
|
+
| `mimoApiKey` | empty (config fallback) | Xiaomi MiMo API key (`api-key` header) entered in the settings card; host-only `0600` storage, never sent back to the browser; falls back to `mimoTts.apiKey`; **applies live** |
|
|
164
|
+
| `asrReplacements` | `[]` | Post-recognition correction table `[{from:[misheard], to:wanted}]` (≤200 rules / ≤12 KB UTF-8); applies to both partials and finals, editable in the settings card with hit counters; **applies live** |
|
|
161
165
|
| `captionFontSize` | `0` | Caption font tier 0=12px / 1=14px / 2=18px / 3=24px (default 0 is byte-equivalent to legacy) |
|
|
162
166
|
| `captionMaxWidth` | `1` | Caption width tier 0=50vw / 1=70vw / 2=90vw |
|
|
163
167
|
| `backchannelYield` | `true` | Yield semantics (ADR-0008); saying `嗯 / 对` while reading auto-pauses for 1.5 s; genuine speech still triggers hard barge-in; off = behavior identical to pre-change |
|
|
164
|
-
| `bargeInSalvage` | `true` | Barge-in salvage (
|
|
165
|
-
| `llmCorrect` | `false` | LLM correction (
|
|
168
|
+
| `bargeInSalvage` | `true` | Barge-in salvage (ADR-0012): when you speak to interrupt while the agent is reading aloud, keep what you said from speech onset to break confirmation and merge it into recognition (prevents swallowed break-in speech; off = discard pre-break audio; recommended off only on speakers without echo cancellation) |
|
|
169
|
+
| `llmCorrect` | `false` | LLM correction (off by default): before sending, run one LLM pass over the whole transcribed text (typos/homophones/punctuation only, meaning preserved; reuses the host configured model). On = about one extra second per message; falls back to the original text if correction fails or the model answers you instead of correcting |
|
|
166
170
|
| `yieldMs` | `1500` | Yield-window length (ms, 500-3000): how long TTS frames are dropped after `backchannelYield` triggers; if you really want to speak in the window the normal `hardBreak` takes over, and playback resumes when the window ends |
|
|
167
171
|
|
|
168
172
|
Effect timing, in four tiers: ① immediately — shortcut / composer shortcut / interaction mode / read-aloud scope / auto-send / captions / status bar / engine / voice / rate / spoken format (applies to later replies) / model mirror (next download attempt); ② next recognition — finalization re-transcription (SenseVoice) / ITN; ③ next utterance — silence threshold (endpoint; the send wait stays a fixed 1.2 s); ④ next time you enter voice mode — interrupt sensitivity / barge-in mode / echo gate / auto-resume / wake word / tool beep / caption font / caption width / backchannel yielding / yield window / barge-in salvage / LLM correction / idle timeout. Saved-but-not-yet-effective items are listed at the top of the settings card with their current effective values. Defaults come from the plugin config (`base` layer) — they follow the config unless explicitly changed.
|
|
@@ -202,10 +206,10 @@ You can also edit the `voice-mode:` section of `~/.dsh/settings.yaml` directly (
|
|
|
202
206
|
cacheDir: ~/.cache/dsh-voice-mode/models # overridable; platform default otherwise
|
|
203
207
|
# Defaults seeded for the settings (the settings panel overrides; the panel is authoritative):
|
|
204
208
|
voice: zh-CN-XiaoxiaoNeural
|
|
205
|
-
rate: 1.1
|
|
209
|
+
rate: 1.1
|
|
206
210
|
interruptLevel: 0
|
|
207
211
|
silenceMs: 1500
|
|
208
|
-
idleTimeoutMinutes: 5
|
|
212
|
+
idleTimeoutMinutes: 5
|
|
209
213
|
modelHost: https://huggingface.co
|
|
210
214
|
```
|
|
211
215
|
|
|
@@ -214,9 +218,9 @@ You can also edit the `voice-mode:` section of `~/.dsh/settings.yaml` directly (
|
|
|
214
218
|
> (`enabled/cacheDir` remain bundle-config-only).
|
|
215
219
|
> The plugin HTTP namespace is fixed to `/voice-mode` (matching the client bundle contract; not configurable).
|
|
216
220
|
|
|
217
|
-
### OpenAI-compatible TTS
|
|
221
|
+
### OpenAI-compatible & Xiaomi MiMo TTS (`ttsEngine: openai` / `mimo`)
|
|
218
222
|
|
|
219
|
-
Any server that implements OpenAI's `POST /v1/audio/speech` can read replies aloud: a self-hosted one on a GPU machine ([vLLM-Omni](https://github.com/vllm-project/vllm-omni), [Kokoro-FastAPI](https://github.com/remsky/Kokoro-FastAPI), LocalAI, ...) or a hosted API such as OpenAI
|
|
223
|
+
Any server that implements OpenAI's `POST /v1/audio/speech` can read replies aloud: a self-hosted one on a GPU machine ([vLLM-Omni](https://github.com/vllm-project/vllm-omni), [Kokoro-FastAPI](https://github.com/remsky/Kokoro-FastAPI), LocalAI, ...) or a hosted API such as SiliconFlow, OpenAI, [OpenRouter](https://openrouter.ai/docs/guides/overview/multimodal/tts), or Groq PlayAI. You can pick one of the **7 built-in presets** (or `custom`) and enter `openaiBaseUrl` / `openaiModel` / `openaiApiKey` directly in the **Settings card** (priority: settings card > preset > bundle config), or seed them in the bundle config below; keys remain host-only (`0600`) and are never returned to the browser. Xiaomi MiMo (`ttsEngine: mimo`) uses its own independent key (`mimoApiKey` in the card or `mimoTts.apiKey` in config) so keys never leak across providers:
|
|
220
224
|
|
|
221
225
|
```yaml
|
|
222
226
|
- id: voice-mode
|
|
@@ -238,6 +242,20 @@ Any server that implements OpenAI's `POST /v1/audio/speech` can read replies alo
|
|
|
238
242
|
|
|
239
243
|
Each sentence is one request (the queue already synthesizes sentence by sentence while the reply is still streaming, so in-sentence streaming would not start playback any sooner). `rate` is sent as `speed` when it is not 1. With a `fallback`, a failed or timed-out request makes that sentence (and the next 30 s) use the local engine, then the server is tried again, so a dead server does not cost a timeout per sentence. The text to be spoken goes to `baseUrl`, so pick a server you trust with your replies.
|
|
240
244
|
|
|
245
|
+
### Fixing misheard words (`asrReplacements`)
|
|
246
|
+
|
|
247
|
+
Recognizers keep mishearing some names and English words inside Chinese speech (a name such as "Sakina" can come out as "ski男"). The usual fix, hotwords, doesn't fit here: sherpa-onnx supports hotwords only for transducer models, the streaming zipformer works on Chinese characters and can't spell English words, and the SenseVoice model that produces the final text has no hotword input. Until a model with hotwords covers this, a replacement list is a stopgap: it rewrites the text after recognition, in partial and final results alike, so captions, the draft and the wake word all see the corrected text.
|
|
248
|
+
|
|
249
|
+
```yaml
|
|
250
|
+
- id: voice-mode
|
|
251
|
+
config:
|
|
252
|
+
asrReplacements:
|
|
253
|
+
- from: [ski男] # what the recognizer produced, one or more spellings
|
|
254
|
+
to: Sakina # what you want
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Matching is case-insensitive and ignores whitespace between Latin and CJK text ("ski 男" matches too). A spelling that starts or ends with a Latin letter or digit only matches a whole word, so `sina` leaves `Sinatra` alone; CJK text has no word boundaries, so a Chinese spelling matches as a substring. The longest spelling wins at each position and replaced text is not matched again. Keep entries to what you have actually seen misheard: a short or common spelling will also rewrite real words. The list is read from the plugin config, so a change takes effect with the next recognition request after the profile reloads.
|
|
258
|
+
|
|
241
259
|
---
|
|
242
260
|
|
|
243
261
|
## 🌐 API
|
|
@@ -288,6 +306,8 @@ flowchart LR
|
|
|
288
306
|
Edge[Edge cloud]
|
|
289
307
|
Vits[Local VITS WASM]
|
|
290
308
|
Kokoro[Local Kokoro<br/>native addon]
|
|
309
|
+
OpenAI[OpenAI-compatible TTS]
|
|
310
|
+
MiMo[Xiaomi MiMo TTS]
|
|
291
311
|
end
|
|
292
312
|
|
|
293
313
|
UI -->|audio f32 PCM<br/>POST /voice-mode/asr| ASR
|
|
@@ -300,16 +320,20 @@ flowchart LR
|
|
|
300
320
|
TTS -->|edge| Edge
|
|
301
321
|
TTS -->|vits| Vits
|
|
302
322
|
TTS -->|kokoro| Kokoro
|
|
323
|
+
TTS -->|openai| OpenAI
|
|
324
|
+
TTS -->|mimo| MiMo
|
|
303
325
|
Edge -.->|SSE audio frame| UI
|
|
304
326
|
Vits -.->|SSE audio frame| UI
|
|
305
327
|
Kokoro -.->|SSE audio frame| UI
|
|
328
|
+
OpenAI -.->|SSE audio frame| UI
|
|
329
|
+
MiMo -.->|SSE audio frame| UI
|
|
306
330
|
VAD -.->|wake-word / barge-in| Q
|
|
307
331
|
```
|
|
308
332
|
|
|
309
333
|
- Speech and reading only happen for the session pointed to by the global single-active pointer `activeVoiceSession`; other sessions pass through `llm/stream` with zero overhead (mode isolation)
|
|
310
334
|
- The `llm/stream` tap is lossless: every chunk passes through unchanged; segmentation/synthesis only observe and never block the model stream
|
|
311
335
|
- ASR runs host-side (sherpa-onnx WASM, zipformer2 Chinese streaming + SenseVoice finalization which adds punctuation); the browser only captures audio (`getUserMedia` 16k mono) and does endpoint detection
|
|
312
|
-
- Local TTS (VITS / native Kokoro) runs in an isolated child process (fork, auto-restart); barge-in kills the in-flight synthesis to release its worker resources
|
|
336
|
+
- Local TTS (VITS / lazily-loaded native Kokoro) runs in an isolated child process (fork, auto-restart); barge-in kills the in-flight synthesis to release its worker resources
|
|
313
337
|
- The TTS queue is per-session with an epoch version: old frames are all invalidated after a barge-in, so it is truly silent
|
|
314
338
|
|
|
315
339
|
---
|
|
@@ -320,7 +344,7 @@ flowchart LR
|
|
|
320
344
|
| --- | --- | --- |
|
|
321
345
|
| Recognition model | Cloud API (needs key) | **Local zipformer2 + SenseVoice** (zero key) |
|
|
322
346
|
| Multi-language | English-first | **SenseVoice auto-recognition + ITN** |
|
|
323
|
-
| TTS engine | Cloud TTS | **Edge cloud + local VITS/Kokoro
|
|
347
|
+
| TTS engine | Cloud TTS | **Edge cloud + local VITS/Kokoro + OpenAI-compatible / Xiaomi MiMo** |
|
|
324
348
|
| Barge-in detection | Basic VAD | **3 sensitivity levels + echo gate + yield semantics** |
|
|
325
349
|
| Caption a11y | None | **4 font tiers + 3 width tiers + theme-following** |
|
|
326
350
|
| Wake word | None | **Lightweight streaming match + prefix filler whitelist** |
|
|
@@ -334,8 +358,8 @@ An honest disclosure of what the plugin does (mapped to the awesome-dsh-plugin c
|
|
|
334
358
|
|
|
335
359
|
| Category | What it does | Where data goes |
|
|
336
360
|
| --- | --- | --- |
|
|
337
|
-
| **network** | (1)
|
|
338
|
-
| **fs-read / fs-write** | Model cache (Linux/macOS `~/.cache/dsh-voice-mode/models/`, Windows `%LOCALAPPDATA%\dsh-voice-mode\models\`); the dsh 0.1.7+ settings overlay `$DSH_HOME/voice-mode.settings.json
|
|
361
|
+
| **network** | (1) Default **Edge** TTS sends spoken reply text over WebSocket to Microsoft `speech.platform.bing.com`; (2) `ttsEngine: openai` sends spoken text to the selected preset or configured `openaiBaseUrl` / `openaiTts.baseUrl`; (3) `ttsEngine: mimo` sends spoken text to `mimoTts.baseUrl` (`https://api.xiaomimimo.com/v1` by default); (4) local VITS / Kokoro synthesize offline once models are downloaded from `huggingface.co` (or configured `hf-mirror.com`) with SHA256 digest checks; (5) registers loopback HTTP routes `/voice-mode/*` on the dsh host (loopback only by default; LAN needs `allowLan`) | Browser audio is sent only to the connected dsh host for local recognition (no third-party cloud ASR). Submitted transcripts and optional `llmCorrect` follow the host LLM configuration |
|
|
362
|
+
| **fs-read / fs-write** | Model cache (Linux/macOS `~/.cache/dsh-voice-mode/models/`, Windows `%LOCALAPPDATA%\dsh-voice-mode\models\`); the dsh 0.1.7+ settings overlay `$DSH_HOME/voice-mode.settings.json` (`0600`, API keys remain host-only and are never returned to the browser); **never touches your workspace files** | All local |
|
|
339
363
|
| **shell (child processes)** | Local TTS synthesis runs in a separate child process (`child_process.fork` → `lib/tts-vits-worker.cjs`); when the host is Electron (the official desktop app), it additionally probes and launches a real Node.js for Kokoro (`node -p …` to check the version). **It never executes user input and never builds shell command strings** | Local |
|
|
340
364
|
| **env** | Uses directory/runtime environment settings such as `DSH_HOME`, `LOCALAPPDATA`, `PATH` and optional `DSHVM_NODE`; this default speech path does not require an extra speech-service API key | — |
|
|
341
365
|
|
|
@@ -349,7 +373,7 @@ Also: the on-device recording fixture used for debugging is **off by default**;
|
|
|
349
373
|
|
|
350
374
|
### Compatibility declaration (what the plugin market's version filter reads)
|
|
351
375
|
|
|
352
|
-
`package.json` declares `engines.dsh = ">=0.1.1-rc.2 <0.3.0-0"`. This is an eligibility range, not evidence that every version in it has passed tests. The compatibility record lists tested releases through 0.2.2-rc.
|
|
376
|
+
`package.json` declares `engines.dsh = ">=0.1.1-rc.2 <0.3.0-0"`. This is an eligibility range, not evidence that every version in it has passed tests. The compatibility record lists tested releases through 0.2.2-rc.5 and the forms actually exercised. The default set deduplicates the support endpoints, the latest verified release on each version line, and upstream latest/next: currently 9 versions for anchors and host/client typechecks, with 8 runtime cores. Historical evidence remains available; use `verify-dual.sh --full` or explicit versions to rerun it. Compatibility-only verification does not trigger a release. The daily workflow compares upstream tags and opens an issue for uncovered versions; it does not automatically rerun the full matrix. `peerDependencies` lists `@deepseek-ai/cordis` and `react` supplied by the host.
|
|
353
377
|
|
|
354
378
|
## 🚧 Known limitations
|
|
355
379
|
|
|
@@ -420,7 +444,7 @@ After changing dependencies run `npm pack --dry-run`, `npm test` and `bash scrip
|
|
|
420
444
|
|
|
421
445
|
```sh
|
|
422
446
|
pnpm install && pnpm build # esbuild: lib/index.js (host) + lib/client.js (browser) + lib/msedge-tts.cjs
|
|
423
|
-
pnpm test #
|
|
447
|
+
pnpm test # runs unit tests, harnesses, structure guards, and pre-release checks via scripts/run-tests.mjs
|
|
424
448
|
bash scripts/smoke-runtime.sh <dsh-core-bin.js> <port> # boot an isolated dsh core: endpoints, mic button, settings page, i18n
|
|
425
449
|
bash scripts/full-e2e.sh <dsh-core-bin.js> <port> # real-LLM end to end: create → toggle → prompt → SSE audio frames
|
|
426
450
|
systemctl restart dsh # Linux; restart the dsh process on other platforms
|
|
@@ -457,4 +481,6 @@ Integration probes (`hold-e2e.js`, `spoken-prompt-rpc.sh`, `spoken-toggle-ui-che
|
|
|
457
481
|
|
|
458
482
|
## 📄 License
|
|
459
483
|
|
|
460
|
-
[MIT](./LICENSE)
|
|
484
|
+
[MIT](./LICENSE)
|
|
485
|
+
|
|
486
|
+
> Portions derived from [haoku123/dsh-voice](https://github.com/haoku123/dsh-voice) (see [`LICENSE`](./LICENSE)).
|