dsh-voice-mode 0.7.43 → 0.7.45
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 +185 -394
- package/README.md +176 -406
- package/SECURITY.md +2 -2
- package/THIRD_PARTY_NOTICES.md +31 -2
- package/lib/client.js +316 -191
- package/lib/index.d.ts +127 -0
- package/lib/index.js +1304 -609
- package/lib/tts-vits-worker.cjs +1 -1
- package/package.json +9 -2
- package/scripts/check-anchors.mjs +42 -3
package/README.en.md
CHANGED
|
@@ -1,486 +1,277 @@
|
|
|
1
1
|
# dsh-voice-mode
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/dsh-voice-mode)
|
|
4
|
+
[](https://www.npmjs.com/package/dsh-voice-mode)
|
|
5
|
+
[](https://github.com/qishuilalala/dsh-voice-mode/actions/workflows/hol-scanner.yml)
|
|
6
6
|
[](https://github.com/qishuilalala/dsh-voice-mode/actions/workflows/ci.yml)
|
|
7
|
+
[](https://github.com/qishuilalala/dsh-voice-mode/blob/main/plugin/dsh-voice-mode/LICENSE)
|
|
7
8
|
|
|
8
|
-
Full-duplex voice conversation
|
|
9
|
-
spoken answer. Streamed zipformer2 ASR → editable draft → auto send → the
|
|
10
|
-
final reply is read out sentence-by-sentence via Edge TTS, and your voice
|
|
11
|
-
interrupts playback and the running turn. No additional speech-service API key is needed for the default path; the host LLM has its own configuration and costs.
|
|
9
|
+
Full-duplex voice conversation plugin for **DeepSeek Harness (DSH)** across Web and official Desktop: local host-side streaming speech recognition (ASR / STT) into an editable draft, sentence-by-sentence TTS read-aloud with live captions, and instant voice or keyboard barge-in. No extra speech-service API key is required on the default path; the host LLM uses its own configured model and billing.
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
[简体中文](https://github.com/qishuilalala/dsh-voice-mode/blob/main/plugin/dsh-voice-mode/README.md) · **English** · [Changelog](https://github.com/qishuilalala/dsh-voice-mode/blob/main/CHANGELOG.md) · [Compatibility Contract](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/compat-contract.md)
|
|
14
12
|
|
|
15
13
|

|
|
16
14
|
|
|
17
|
-

|
|
18
|
-
|
|
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.
|
|
20
|
-
>
|
|
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.
|
|
22
|
-
|
|
23
|
-
|
|
24
15
|
---
|
|
25
16
|
|
|
26
|
-
##
|
|
17
|
+
## Key Capabilities
|
|
27
18
|
|
|
28
|
-
- **
|
|
29
|
-
- **
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **
|
|
33
|
-
- **
|
|
19
|
+
- **Host-side streaming speech recognition (ASR / STT)**: runs `zipformer2` streaming recognition and optional `SenseVoice` finalization (punctuation + inverse text normalization) locally via `sherpa-onnx`. Words stream into the composer draft as you speak, split after ~1.5 s of silence, and auto-send after ~1.2 s more quiet (or stay in the draft as dictation when auto-send is off).
|
|
20
|
+
- **Three interaction modes**: **Continuous listening (`toggle`)**, **Push-to-talk (`hold`, via pointer/touch on the mic button or holding `Ctrl` / macOS `⌃ Control`)**, and **One-shot (`once`)** — switchable live from Settings, right-click menu, or touch `⋯` menu.
|
|
21
|
+
- **Five read-aloud TTS engines**: Microsoft Edge online TTS by default; fully offline local Chinese `vits` and bilingual zh+en `kokoro` (103 voices); 7 built-in OpenAI-compatible online presets (with independent per-preset API keys) plus custom endpoints; and Xiaomi MiMo TTS — with automatic 30-second local fallback on remote timeout or failure.
|
|
22
|
+
- **Live caption overlay & compact button UI**: bottom-right caption overlay with 4 font-size tiers, 3 width tiers, mobile safe-area inset handling, and recent 8-sentence history; turning off both the status bar and captions folds all voice indicators, timers, and error badges onto the single mic button.
|
|
23
|
+
- **True barge-in & backchannel yielding**: speaking during playback cancels queued audio and the running turn while salvaging the 250 ms pre-onset speech buffer so initial syllables are not swallowed; short backchannels (`right`, `嗯`, `对`) pause playback for 1.5 s instead of aborting the reply; loudspeaker setups without native echo cancellation automatically degrade to hold-to-interrupt.
|
|
24
|
+
- **Editable post-ASR replacements & wake word**: maintain custom post-recognition replacement rules with hit counters right inside the Settings panel, with optional pre-send LLM typo correction and standby wake-word activation.
|
|
34
25
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
---
|
|
26
|
+

|
|
38
27
|
|
|
39
|
-
|
|
40
|
-
|
|
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)
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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)
|
|
53
|
-
- **Lazy model download with progress**: the zipformer2 Chinese streaming model (~160 MB, `.part` resumable) is downloaded on first use with live progress in the status bar; `npm run prefetch` can pre-download it
|
|
54
|
-
- **Resilience and diagnostics**: mic-denied red hint, visible model-download failure, TTS unreachable status hint (auto retry), failed submit keeps the text in the draft, SSE auto-reconnect; the status bar also hints when the recognition / barge-in detect channel fails several times in a row or the state sync drops (self-healing transient failures stay quiet); when SenseVoice finalization takes over 2 s the status bar counts up "recognizing… Ns"; a "copy diagnostics" button copies version / runtime state / settings snapshot / phase timings in one click — **never any transcript text** (privacy)
|
|
55
|
-
- **Settings**: location depends on your dsh version (see Settings below), with voice / rate / interrupt sensitivity / silence pause / idle timeout / model mirror / auto send / interaction mode / wake word / ITN / caption tiers / yield semantics / yield window / barge-in salvage / LLM correction; **voices are previewable** (the "试听/Preview" button synthesizes and plays the current voice at the current rate (first use may download or load a model), no need to enter voice mode; custom ShortNames are previewable too)
|
|
56
|
-
- **Interface language**: follows dsh's language setting (Settings → General → Language) and **switches instantly, no reload** — the settings page, voice status bar, captions, voice names/gender/accent and error messages all follow it, and the LLM spoken-style prompt is chosen in English or Chinese accordingly. Dictionaries are registered in dsh's official locale service under the `voice-mode` namespace, so community language packs can add more languages (missing ones fall back to English). The plugin's name and description in the Plugins page are localized too.
|
|
57
|
-
- **Idle exit**: auto-exit and mic release after 5 minutes of inactivity (reading, speech and a running turn renew the timer, subject to a two-hour cap since the last user activity)
|
|
28
|
+

|
|
58
29
|
|
|
59
30
|
---
|
|
60
31
|
|
|
61
|
-
##
|
|
32
|
+
## Installation & Quick Start
|
|
62
33
|
|
|
63
|
-
|
|
64
|
-
|
|
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 |
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## 🚀 Quick Start (model download time varies)
|
|
79
|
-
|
|
80
|
-
**Requirements**: dsh web (the plugin declares Node ≥18; the host may require a newer version), a modern browser (Chrome / Edge / Firefox, supporting `getUserMedia` and Web Audio).
|
|
34
|
+
**Requirements**: DeepSeek Harness `>=0.1.1-rc.2 <0.3.0-0` (verified across client injection anchors, dual host/client typechecks, and isolated runtime smoke tests from `0.1.1-rc.2` through `0.2.3-alpha.2`), Node.js `>=18.0.0`, and a modern browser supporting `getUserMedia` + Web Audio (Chrome / Edge / Firefox / Safari 16+) or the official DSH Desktop app.
|
|
81
35
|
|
|
82
36
|
```sh
|
|
83
|
-
# Option 1: from npm (recommended)
|
|
37
|
+
# Option 1: Install from npm (recommended; replace "web" with your target profile if needed)
|
|
84
38
|
dsh plugin --profile web add dsh-voice-mode
|
|
85
|
-
# Equivalent via npx if the dsh CLI is not installed locally:
|
|
86
|
-
npx -y @deepseek-ai/dsh plugin --profile web add dsh-voice-mode
|
|
87
39
|
|
|
88
|
-
#
|
|
89
|
-
dsh plugin --profile web add
|
|
40
|
+
# Equivalent via npx when the dsh CLI is not installed globally:
|
|
41
|
+
npx -y @deepseek-ai/dsh plugin --profile web add dsh-voice-mode
|
|
90
42
|
|
|
91
|
-
# Option
|
|
43
|
+
# Option 2: Build and install from source (Node.js 22.18+ on the 22.x line and pnpm 11)
|
|
92
44
|
git clone https://github.com/qishuilalala/dsh-voice-mode.git
|
|
93
|
-
cd dsh-voice-mode/plugin/dsh-voice-mode
|
|
45
|
+
cd dsh-voice-mode/plugin/dsh-voice-mode
|
|
46
|
+
pnpm install --frozen-lockfile
|
|
47
|
+
pnpm run build
|
|
94
48
|
dsh plugin --profile web add .
|
|
95
49
|
```
|
|
96
50
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
- **Linux with a configured systemd service**: restart the actual service (for example, `systemctl restart dsh` only if that is its name). The install command above targets the web profile; use your actual profile for other deployments.
|
|
100
|
-
- **Windows / macOS / manual hosting**: restart your dsh process (kill and run `dsh web` again, or restart it in your service manager)
|
|
101
|
-
|
|
102
|
-
**Optional**: pre-download the ASR model to reduce the download wait on the first voice-mode entry:
|
|
103
|
-
|
|
104
|
-
```sh
|
|
105
|
-
npm run prefetch # run inside the plugin dir; writes to the platform cache dir
|
|
106
|
-
# or specify the cache location: node scripts/prefetch.mjs --cache-dir /where/ever/models
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**First run**:
|
|
51
|
+
Restart the DSH host process after installing or updating the bundle. On first entry into voice mode, the plugin lazily downloads the local recognition models (~160 MB streaming model + optional ~228 MB SenseVoice model, with `.part` resume and live progress in the status bar; users in mainland China can set `modelHost` to `https://hf-mirror.com`, or pre-download via `npm run prefetch` inside the package directory).
|
|
110
52
|
|
|
111
|
-
|
|
112
|
-
2. Choose how to speak: just talk and let the ~1500 ms pause split and ~2.7 s of quiet auto-send (toggle); or hold the mic button and release to send (hold)
|
|
113
|
-
3. The AI answer is read sentence-by-sentence with a caption overlay at the bottom-right; click "Skip" or just start speaking to interrupt
|
|
114
|
-
4. Click "Exit" in the status bar (or press `Ctrl+Shift+V` again) to leave voice mode
|
|
53
|
+
---
|
|
115
54
|
|
|
116
|
-
|
|
55
|
+
## Gestures & Shortcuts (Windows / Linux vs macOS)
|
|
117
56
|
|
|
118
|
-
|
|
57
|
+
| Action | Windows / Linux | macOS | Behaviour |
|
|
58
|
+
| --- | --- | --- | --- |
|
|
59
|
+
| Enter / exit voice mode | `Ctrl+Shift+V` | `⌃ Control + ⇧ Shift + V` | App-wide toggle (uses `Control` on macOS by default, not `⌘ Command`; customizable or clearable in Settings → Shortcuts) |
|
|
60
|
+
| Toggle from composer | `Alt+Enter` | `⌥ Option + Return` | Toggles voice mode while focused in the chat composer without inserting a newline; leaves `Ctrl/⌘ + Enter` intact for sending |
|
|
61
|
+
| 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 ~1.2 s more quiet; hold `Ctrl` / `⌃ Control` ≥250 ms while speaking to send immediately on release |
|
|
62
|
+
| Push-to-talk (`hold`) — pointer/touch | Hold the mic button, release to send | Hold the mic button, release to send | From idle, **hold the mic button directly to start recording**, release to send, and voice mode auto-exits once the reply finishes; swipe up or press `Esc` to cancel |
|
|
63
|
+
| Push-to-talk (`hold`) — keyboard | Hold `Ctrl` (≥220 ms) | Hold `⌃ Control` (≥220 ms) | While voice mode is active, hold `Ctrl` / `⌃ Control` to record continuously and release to send; `Esc`, window blur, or pressing another key combo cancels the segment |
|
|
64
|
+
| One-shot (`once`) | Speak one turn; auto-exits after reply | Speak one turn; auto-exits after reply | Turns off the mic after sending and exits once read-aloud finishes; holding mic or `Ctrl` / `⌃ Control` during playback interrupts and resumes listening |
|
|
65
|
+
| 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; `Esc` stops reading, double-`Esc` exits |
|
|
66
|
+
| Quick settings menu | Right-click mic button (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) to switch modes, read-aloud scope, captions, status bar, and auto-send |
|
|
119
67
|
|
|
120
68
|
---
|
|
121
69
|
|
|
122
|
-
##
|
|
70
|
+
## Settings Panel & Full 36-Key Reference
|
|
123
71
|
|
|
124
|
-
**
|
|
72
|
+
**Universal entry on every DSH version: Settings → Voice Mode**. Secondary entry points by host version:
|
|
125
73
|
|
|
126
|
-
- dsh
|
|
127
|
-
- dsh 0.1.6-alpha
|
|
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).
|
|
74
|
+
- `dsh <= 0.1.5`: Settings → Plugins → Plugin config → Voice Mode
|
|
75
|
+
- `dsh >= 0.1.6-alpha`: Left sidebar **Plugins** → installed `dsh-voice-mode` → "Voice Mode" card on its detail page (on `0.1.7+`, values persist in `$DSH_HOME/voice-mode.settings.json` with `0600` permissions; to reset to defaults, replace its content with `{}` rather than deleting the file)
|
|
129
76
|
|
|
77
|
+

|
|
130
78
|
|
|
131
|
-
###
|
|
79
|
+
### Settings Reference (36 Keys)
|
|
132
80
|
|
|
133
81
|
| Key | Default | Description |
|
|
134
82
|
| --- | --- | --- |
|
|
135
|
-
| `ttsEngine` | `edge` | Read-aloud engine: `edge` Microsoft
|
|
136
|
-
| `kokoroModel` | `int8` | Kokoro precision: `int8` (default, 109 MB, CPU
|
|
137
|
-
| `voice` | per engine | Voice: 5 VITS speakers; 103 Kokoro voices (◀▶ stepper
|
|
138
|
-
| `rate` | `1.1` |
|
|
139
|
-
| `interruptLevel` | `0` | Barge-in sensitivity (host
|
|
140
|
-
| `bargeInMode` | `detect` | Barge-in mode: `detect`
|
|
141
|
-
| `echoGateDb` | `6` | Fallback echo-gate threshold
|
|
142
|
-
| `silenceMs` | `1500` | Silence
|
|
143
|
-
| `idleTimeoutMinutes` | `5` | Minutes of inactivity before auto-exiting voice mode (
|
|
144
|
-
| `modelHost` |
|
|
145
|
-
| `autoSend` | `true` | Auto-send
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `shortcut` | `Ctrl+Shift+V` |
|
|
152
|
-
| `composerShortcut` | `Alt+Enter` | Shortcut
|
|
153
|
-
| `wakeWord` | empty (off) |
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `senseITN` | `true` | SenseVoice inverse text normalization (
|
|
158
|
-
| `openaiPreset` | empty (manual) |
|
|
159
|
-
| `openaiBaseUrl` | empty (preset/config) | Online TTS
|
|
160
|
-
| `openaiModel` | empty | Online TTS model override (same priority as `openaiBaseUrl`); **applies live** |
|
|
161
|
-
| `openaiApiKey` | empty (config fallback) |
|
|
162
|
-
| `openaiApiKeys` | `{}`
|
|
163
|
-
| `mimoApiKey` | empty (config fallback) | Xiaomi MiMo API key (`api-key` header
|
|
164
|
-
| `asrReplacements` | `[]` | Post-
|
|
165
|
-
| `captionFontSize` | `0` | Caption font tier 0
|
|
166
|
-
| `captionMaxWidth` | `1` | Caption width tier 0
|
|
167
|
-
| `backchannelYield` | `true` |
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
###
|
|
175
|
-
|
|
176
|
-
> **Desktop (Electron) note**:
|
|
177
|
-
|
|
178
|
-
|
|
83
|
+
| `ttsEngine` | `edge` | Read-aloud engine: `edge` Microsoft online (default) / `vits` local Chinese / `kokoro` local zh+en / `openai` OpenAI-compatible server / `mimo` Xiaomi MiMo; **applies live** |
|
|
84
|
+
| `kokoroModel` | `int8` | Kokoro model precision: `int8` (default, ~109 MB, CPU-friendly) / `fp32` (~311 MB, higher fidelity); shares 103 voices; **applies live** |
|
|
85
|
+
| `voice` | per engine | Voice id: 5 VITS speakers; 103 Kokoro voices (dropdown + ◀▶ stepper, popular male voices `62/68/75/76` pinned); 322 Edge voices; inline "Preview" button synthesizes a sample live; **applies live** |
|
|
86
|
+
| `rate` | `1.1` | Playback speed multiplier (`0.5` slow – `2.0` fast); **applies live** |
|
|
87
|
+
| `interruptLevel` | `0` | Barge-in sensitivity (host VAD frame count + echo gate): `0` high threshold (3 frames) / `1` medium (2 frames) / `2` low (1 frame) |
|
|
88
|
+
| `bargeInMode` | `detect` | Barge-in mode: `detect` probes native browser echo cancellation (falls back to hold-to-interrupt during playback when inactive) / `auto` speak-to-interrupt (headphones) / `manual` hold mic or `Ctrl` to interrupt (loudspeakers) |
|
|
89
|
+
| `echoGateDb` | `6` | Fallback echo-gate threshold (`3`–`12` dB) used only when native AEC is unavailable |
|
|
90
|
+
| `silenceMs` | `1500` | Silence duration in milliseconds (`500`–`30000`) that ends a spoken sentence |
|
|
91
|
+
| `idleTimeoutMinutes` | `5` | Minutes of inactivity before auto-exiting voice mode (`1`–`120`; playback and running turns renew activity, capped at 2 hours) |
|
|
92
|
+
| `modelHost` | empty (official) | Model download mirror override (e.g. `https://hf-mirror.com` for mainland China); applies on the next download attempt |
|
|
93
|
+
| `autoSend` | `true` | Auto-send after silence (consecutive segments join into one message); when off, transcripts stay in the draft (holding `Ctrl` or releasing in `hold` still sends); **applies live** |
|
|
94
|
+
| `autoResume` | `false` | Automatically re-enter voice mode when switching back to your last active voice session (off by default) |
|
|
95
|
+
| `mode` | `toggle` | Interaction mode: `toggle` continuous listening / `hold` push-to-talk / `once` single turn then auto-exit; **applies live** |
|
|
96
|
+
| `readAloud` | `voice` | Read-aloud scope: `voice` only in voice mode / `always` all replies in the visible session (including typed prompts) / `off` never; **applies live** |
|
|
97
|
+
| `showStatusBar` | `true` | Show the voice status bar above the composer; when off, indicators fold onto the mic button; **applies live** |
|
|
98
|
+
| `showCaptions` | `true` | Show the floating live caption overlay during playback; **applies live** |
|
|
99
|
+
| `shortcut` | `Ctrl+Shift+V` | App-wide shortcut to enter/exit voice mode (modifier + letter/digit/Enter/Space/Tab; supports live recording in Settings, empty = disabled); **applies live** |
|
|
100
|
+
| `composerShortcut` | `Alt+Enter` | Shortcut to toggle voice mode while focused in the composer (`Option+Return` on macOS, no newline inserted, empty = disabled); **applies live** |
|
|
101
|
+
| `wakeWord` | empty (off) | Standby wake word (e.g. `你好小D`, 3–4 chars recommended): active in `toggle` standby only, can be spoken continuously with the command (prefix stripped), resets to standby after each utterance or barge-in |
|
|
102
|
+
| `toolBeep` | `false` | Play a short subtle beep when the agent invokes a tool (off by default) |
|
|
103
|
+
| `spokenFormat` | `true` | Inject a spoken-style prompt ("short natural sentences, no Markdown formatting") into active voice-mode replies only; **applies live** |
|
|
104
|
+
| `senseVoice` | `true` | Re-transcribe finalized segments with SenseVoice for punctuation and ITN (disabling saves ~228 MB of model downloads and uses streaming zipformer only) |
|
|
105
|
+
| `senseITN` | `true` | SenseVoice inverse text normalization (normalizes spoken numbers, dates, and currencies) |
|
|
106
|
+
| `openaiPreset` | empty (manual) | Built-in online TTS preset: `siliconflow-cosyvoice2` / `siliconflow-fish` / `openrouter-openai` / `openai-official` / `groq-playai` / `selfhosted-kokoro` / `selfhosted-vllm` (or `custom`); **applies live** |
|
|
107
|
+
| `openaiBaseUrl` | empty (preset/config) | Online TTS base URL override (priority: settings panel > preset > bundle config); **applies live** |
|
|
108
|
+
| `openaiModel` | empty (preset/config) | Online TTS model override (same priority as `openaiBaseUrl`); **applies live** |
|
|
109
|
+
| `openaiApiKey` | empty (config fallback) | Global fallback API key for OpenAI-compatible TTS (`0600` host-only storage, never returned to the browser); **applies live** |
|
|
110
|
+
| `openaiApiKeys` | `{}` | Per-preset API key map (`{presetId: key}` stored host-side; switching presets automatically switches keys without 401 mismatches; API exposes booleans only); **applies live** |
|
|
111
|
+
| `mimoApiKey` | empty (config fallback) | Dedicated Xiaomi MiMo API key (`api-key` header, isolated from OpenAI keys, host-only `0600` storage); **applies live** |
|
|
112
|
+
| `asrReplacements` | `[]` | Post-ASR replacement rules `[{from:[misheard], to:target}]` (up to 200 rules / 12 KB, rewrites partials and finals with hit counters); **applies live** |
|
|
113
|
+
| `captionFontSize` | `0` | Caption font-size tier: `0`=12px / `1`=14px / `2`=18px / `3`=24px |
|
|
114
|
+
| `captionMaxWidth` | `1` | Caption max-width tier: `0`=50vw / `1`=70vw / `2`=90vw |
|
|
115
|
+
| `backchannelYield` | `true` | Backchannel yielding: short acknowledgements during playback pause TTS briefly instead of triggering a hard barge-in |
|
|
116
|
+
| `yieldMs` | `1500` | Backchannel yield window in milliseconds (`500`–`3000`) before playback resumes automatically |
|
|
117
|
+
| `bargeInSalvage` | `true` | Barge-in speech salvage: merges 250 ms pre-onset audio from the playback ring buffer into the new ASR segment so initial words are preserved |
|
|
118
|
+
| `llmCorrect` | `false` | Optional pre-send LLM pass to fix homophones/typos/punctuation using the host's configured model (falls back to raw transcript on error or timeout) |
|
|
119
|
+
|
|
120
|
+
**Four effect-timing tiers**: ① **Immediate** (shortcuts, interaction mode, read-aloud scope, auto-send, caption/status-bar toggles, TTS engine/preset/keys/voice/rate, replacement rules, spoken-format prompt, model mirror) ② **Next recognition** (SenseVoice finalization, ITN) ③ **Next utterance** (silence threshold) ④ **Next voice-mode entry** (barge-in sensitivity/mode, echo gate, wake word, caption dimensions, idle timeout). Pending changes display a banner at the top of the settings card showing their **current effective values**.
|
|
121
|
+
|
|
122
|
+
### Local Voices & Common Edge Voices
|
|
123
|
+
|
|
124
|
+
> **Official Desktop (Electron) note**: Electron's V8 sandbox disallows external native buffers used by Kokoro's addon, so the plugin automatically spawns a system Node.js (`>=18` on `PATH`, or pointed to by `DSHVM_NODE`) for local `kokoro`. If standalone Node.js is not installed, use `edge` or pure-WASM local `vits`.
|
|
125
|
+
|
|
126
|
+
- **Local VITS (Chinese, 5 speakers)**: `suyingxue`, `gunian`, `fushiyu`, `bingjiao`, `bazong`
|
|
127
|
+
- **Local Kokoro (zh+en bilingual, 103 voices)**: pinned male voices `62`, `68`, `75`, `76`; common Mandarin female voices `48` (`zf_xiaobei`), `49` (`zf_xiaoni`), `50` (`zf_xiaoxiao`), `51` (`zf_xiaoyi`)
|
|
128
|
+
- **Common Edge ShortNames** (run `node scripts/list-voices.mjs` in the package directory to list all 322 voices):
|
|
129
|
+
|
|
130
|
+
| Edge ShortName | Description |
|
|
179
131
|
| --- | --- |
|
|
180
|
-
| `zh-CN-XiaoxiaoNeural` | Xiaoxiao · Female (default) |
|
|
181
|
-
| `zh-CN-XiaoyiNeural` | Xiaoyi · Female |
|
|
182
|
-
| `zh-CN-YunxiNeural` | Yunxi · Male |
|
|
183
|
-
| `zh-CN-YunjianNeural` | Yunjian · Male |
|
|
184
|
-
| `zh-CN-YunyangNeural` | Yunyang · Male |
|
|
185
|
-
| `zh-CN-
|
|
186
|
-
| `zh-
|
|
187
|
-
| `zh-
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `zh-TW-HsiaoYuNeural` | HsiaoYu · Taiwanese Mandarin · Female |
|
|
191
|
-
| `zh-TW-YunJheNeural` | YunJhe · Taiwanese Mandarin · Male |
|
|
192
|
-
| `en-US-AriaNeural` | Aria · English · Female |
|
|
193
|
-
| `en-US-GuyNeural` | Guy · English · Male |
|
|
132
|
+
| `zh-CN-XiaoxiaoNeural` | Xiaoxiao · Mandarin Female (default) |
|
|
133
|
+
| `zh-CN-XiaoyiNeural` | Xiaoyi · Mandarin Female |
|
|
134
|
+
| `zh-CN-YunxiNeural` | Yunxi · Mandarin Male |
|
|
135
|
+
| `zh-CN-YunjianNeural` | Yunjian · Mandarin Male |
|
|
136
|
+
| `zh-CN-YunyangNeural` | Yunyang · Mandarin Male |
|
|
137
|
+
| `zh-CN-liaoning-XiaobeiNeural` | Xiaobei · Northeastern Mandarin Female |
|
|
138
|
+
| `zh-HK-HiuMaanNeural` | HiuMaan · Cantonese Female |
|
|
139
|
+
| `zh-TW-HsiaoYuNeural` | HsiaoYu · Taiwanese Mandarin Female |
|
|
140
|
+
| `en-US-AriaNeural` | Aria · English Female |
|
|
141
|
+
| `en-US-GuyNeural` | Guy · English Male |
|
|
194
142
|
|
|
195
143
|
---
|
|
196
144
|
|
|
197
|
-
##
|
|
145
|
+
## Advanced YAML Configuration (`settings.yaml` / `cordis.patch.yml`)
|
|
146
|
+
|
|
147
|
+
In addition to configuring everything in the GUI Settings panel, you can seed defaults in your host configuration (`enabled`, `cacheDir`, and `allowLan` are host-config-only; runtime settings prioritize the GUI Settings file):
|
|
198
148
|
|
|
199
|
-
|
|
149
|
+
### OpenAI-Compatible TTS (`ttsEngine: openai`)
|
|
200
150
|
|
|
201
151
|
```yaml
|
|
202
152
|
- id: voice-mode
|
|
203
153
|
name: dsh-voice-mode
|
|
204
154
|
config:
|
|
205
|
-
enabled: true
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
155
|
+
enabled: true
|
|
156
|
+
ttsEngine: openai
|
|
157
|
+
voice: vivian
|
|
158
|
+
openaiTts:
|
|
159
|
+
baseUrl: http://127.0.0.1:8091/v1
|
|
160
|
+
apiKey: ''
|
|
161
|
+
apiKeys:
|
|
162
|
+
siliconflow-cosyvoice2: ''
|
|
163
|
+
openrouter-openai: ''
|
|
164
|
+
openai-official: ''
|
|
165
|
+
model: Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice
|
|
166
|
+
voice: vivian
|
|
167
|
+
responseFormat: mp3
|
|
168
|
+
timeoutMs: 8000
|
|
169
|
+
fallback: kokoro
|
|
170
|
+
fallbackVoice: zf_xiaobei
|
|
171
|
+
instructions: ''
|
|
214
172
|
```
|
|
215
173
|
|
|
216
|
-
|
|
217
|
-
> come from the **settings panel**; the bundle config only seeds defaults for those keys
|
|
218
|
-
> (`enabled/cacheDir` remain bundle-config-only).
|
|
219
|
-
> The plugin HTTP namespace is fixed to `/voice-mode` (matching the client bundle contract; not configurable).
|
|
220
|
-
|
|
221
|
-
### OpenAI-compatible & Xiaomi MiMo TTS (`ttsEngine: openai` / `mimo`)
|
|
174
|
+
### Xiaomi MiMo TTS (`ttsEngine: mimo`)
|
|
222
175
|
|
|
223
|
-
|
|
176
|
+
Xiaomi MiMo uses `POST /v1/chat/completions` audio output with an `api-key` header and keeps its credential strictly isolated from `openaiTts` (official docs: <https://mimo.mi.com>):
|
|
224
177
|
|
|
225
178
|
```yaml
|
|
226
179
|
- id: voice-mode
|
|
227
180
|
name: dsh-voice-mode
|
|
228
181
|
config:
|
|
229
|
-
ttsEngine:
|
|
230
|
-
voice:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
model:
|
|
235
|
-
voice:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
182
|
+
ttsEngine: mimo
|
|
183
|
+
voice: 冰糖
|
|
184
|
+
mimoTts:
|
|
185
|
+
apiKey: ''
|
|
186
|
+
baseUrl: https://api.xiaomimimo.com/v1
|
|
187
|
+
model: mimo-v2.5-tts
|
|
188
|
+
voice: mimo_default
|
|
189
|
+
instructions: ''
|
|
190
|
+
responseFormat: wav
|
|
191
|
+
timeoutMs: 8000
|
|
192
|
+
fallback: kokoro
|
|
193
|
+
fallbackVoice: zf_xiaobei
|
|
241
194
|
```
|
|
242
195
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
### Fixing misheard words (`asrReplacements`)
|
|
196
|
+
### Post-ASR Replacement Rules (`asrReplacements`)
|
|
246
197
|
|
|
247
|
-
|
|
198
|
+
Editable live in **Settings → Voice Mode → Advanced → Recognition replacements** (applies immediately), or seeded in YAML:
|
|
248
199
|
|
|
249
200
|
```yaml
|
|
250
201
|
- id: voice-mode
|
|
202
|
+
name: dsh-voice-mode
|
|
251
203
|
config:
|
|
252
204
|
asrReplacements:
|
|
253
|
-
- from: [ski男]
|
|
254
|
-
to: Sakina
|
|
205
|
+
- from: [ski男, ski 男]
|
|
206
|
+
to: Sakina
|
|
255
207
|
```
|
|
256
208
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
---
|
|
260
|
-
|
|
261
|
-
## 🌐 API
|
|
262
|
-
|
|
263
|
-
| Route | Description |
|
|
264
|
-
| --- | --- |
|
|
265
|
-
| `GET /voice-mode/stream` | SSE: `event: audio` (`{sessionId, seq, text, audio(base64 MP3)}`), `event: mode` (global single-active ownership), `event: tool` (beep), `event: asr-progress / asr-ready / asr-error / tts-error` |
|
|
266
|
-
| `POST /voice-mode/toggle` | `{sessionId, on}` enter/exit voice mode (globally single-active) |
|
|
267
|
-
| `POST /voice-mode/asr` | Raw f32 LE 16k PCM payload → `{text}` (streaming zipformer2); returns `202 {loading}` until the model is ready; `?reset=1` discards the in-flight segment (used on wake-word hit) |
|
|
268
|
-
| `POST /voice-mode/cancel` | `{sessionId}` invalidates the TTS queue and drops the in-flight ASR segment |
|
|
269
|
-
| `POST /voice-mode/preview` | `{voice, rate?}` one-shot synthesis preview → `audio/mpeg` (400 missing voice / voice too long; 502 synthesis failure, e.g. invalid ShortName; 403 when the plugin's `enabled=false`). Does not require voice mode to be active; uses an isolated synthesis connection and does not affect the reading queue |
|
|
270
|
-
| `GET /voice-mode/config` | Client bootstrap parameters (silence threshold / sensitivity / voice and rate, etc.) — includes the ASR-side fields `senseITN` / `senseVoice` / `captionFontSize` / `captionMaxWidth` / `backchannelYield` / `yieldMs` / `bargeInSalvage` / `llmCorrect` |
|
|
271
|
-
| `POST /voice-mode/correct` | `{text}` one LLM correction pass before sending (typos/homophones/punctuation only; reuses the host-configured model) → `{text}`; on failure/timeout/no model it falls back to the original text and never blocks sending |
|
|
272
|
-
| `GET /voice-mode/voices` | Full Edge voice list (fetched when Edge is selected in settings; the client falls back to the common list on network failure) |
|
|
273
|
-
| `GET /voice-mode` | Health check `{ok, name, enabled, active}` |
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## 💾 Model & cache
|
|
278
|
-
|
|
279
|
-
- Recognition model: `csukuangfj/sherpa-onnx-streaming-zipformer-zh-int8-2025-06-30` (encoder ≈154 MB / decoder / joiner / tokens, ~160 MB total), running host-side via sherpa-onnx (Node WASM, Apache-2.0, natively cross-platform)
|
|
280
|
-
- Cache directory defaults by platform:
|
|
281
|
-
- **Windows**: `%LOCALAPPDATA%\dsh-voice-mode\models`
|
|
282
|
-
- **macOS / Linux**: `~/.cache/dsh-voice-mode/models`
|
|
283
|
-
- both overridable via `cacheDir`
|
|
284
|
-
- Downloads use `.part` resume (single-file models only); `huggingface.co` falls back to `hf-mirror.com` on failure (configurable via `modelHost`)
|
|
285
|
-
- A 120 s idle watchdog guards downloads: any received bytes reset it, a stalled upstream is aborted and the next source tried, and closing the panel aborts in-flight downloads
|
|
286
|
-
- Main model files are SHA256-pinned; within one process a file whose size+inode+ctime is unchanged is not re-verified (the cache is in memory only, so the first run after a restart verifies in full); the Kokoro espeak-ng-data tree is judged complete by manifest file sizes / file count, and once first downloaded Kokoro works fully offline
|
|
209
|
+
Rules starting or ending with ASCII letters/digits match whole words only (`sina` will not alter `Sinatra`), while CJK rules match longest-first substrings in a single pass across partial captions, composer drafts, and wake-word checks.
|
|
287
210
|
|
|
288
211
|
---
|
|
289
212
|
|
|
290
|
-
##
|
|
291
|
-
|
|
292
|
-
```mermaid
|
|
293
|
-
flowchart LR
|
|
294
|
-
subgraph Client[Browser Client]
|
|
295
|
-
Mic[Microphone 16kHz<br/>AudioWorklet<br/>echoCancellation:true] --> VAD[Client-side VAD<br/>RMS segmentation]
|
|
296
|
-
VAD -->|partial 0.9s| UI[Statusbar + caption overlay]
|
|
297
|
-
end
|
|
298
|
-
|
|
299
|
-
subgraph Host[dsh.host]
|
|
300
|
-
ASR[zipformer2 streaming ASR<br/>host-side WASM]
|
|
301
|
-
SV[SenseVoice finalization<br/>+ ITN + punctuation]
|
|
302
|
-
Tap[llm/stream tap<br/>observe-only]
|
|
303
|
-
Seg[sentence segmenter]
|
|
304
|
-
Q[TtsQueue<br/>epoch barge-in]
|
|
305
|
-
TTS{Engine}
|
|
306
|
-
Edge[Edge cloud]
|
|
307
|
-
Vits[Local VITS WASM]
|
|
308
|
-
Kokoro[Local Kokoro<br/>native addon]
|
|
309
|
-
OpenAI[OpenAI-compatible TTS]
|
|
310
|
-
MiMo[Xiaomi MiMo TTS]
|
|
311
|
-
end
|
|
312
|
-
|
|
313
|
-
UI -->|audio f32 PCM<br/>POST /voice-mode/asr| ASR
|
|
314
|
-
ASR --> SV
|
|
315
|
-
SV --> Draft[composer draft<br/>autoSend]
|
|
316
|
-
Draft --> Tap
|
|
317
|
-
Tap --> Seg
|
|
318
|
-
Seg --> Q
|
|
319
|
-
Q --> TTS
|
|
320
|
-
TTS -->|edge| Edge
|
|
321
|
-
TTS -->|vits| Vits
|
|
322
|
-
TTS -->|kokoro| Kokoro
|
|
323
|
-
TTS -->|openai| OpenAI
|
|
324
|
-
TTS -->|mimo| MiMo
|
|
325
|
-
Edge -.->|SSE audio frame| UI
|
|
326
|
-
Vits -.->|SSE audio frame| UI
|
|
327
|
-
Kokoro -.->|SSE audio frame| UI
|
|
328
|
-
OpenAI -.->|SSE audio frame| UI
|
|
329
|
-
MiMo -.->|SSE audio frame| UI
|
|
330
|
-
VAD -.->|wake-word / barge-in| Q
|
|
331
|
-
```
|
|
213
|
+
## Architecture & Host HTTP Routes
|
|
332
214
|
|
|
333
|
-
-
|
|
334
|
-
- The `llm/stream` tap is lossless: every chunk passes through unchanged; segmentation/synthesis only observe and never block the model stream
|
|
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
|
|
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
|
|
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
|
|
215
|
+

|
|
338
216
|
|
|
339
|
-
|
|
217
|
+
- **Single-active session isolation**: only the session referenced by `activeVoiceSession` engages ASR/TTS; all other sessions pass through `llm/stream` with zero overhead.
|
|
218
|
+
- **Lossless stream tap**: observes final answer `text-delta` chunks without blocking chat rendering, skipping reasoning blocks, tool calls, and fenced code blocks.
|
|
219
|
+
- **Epoch invalidation**: every barge-in increments the per-session queue epoch and aborts in-flight synthesis so stale audio frames never play.
|
|
340
220
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
|
344
|
-
|
|
|
345
|
-
|
|
|
346
|
-
|
|
|
347
|
-
|
|
|
348
|
-
|
|
|
349
|
-
|
|
|
350
|
-
|
|
|
351
|
-
|
|
|
221
|
+
| Host HTTP Route | Description |
|
|
222
|
+
| --- | --- |
|
|
223
|
+
| `GET /voice-mode` | Health check returning `{ok, name, enabled, active}` |
|
|
224
|
+
| `GET /voice-mode/stream` | SSE stream for audio chunks, session mode sync, model download progress, and error codes |
|
|
225
|
+
| `POST /voice-mode/toggle` | Enter or exit voice mode (validates session existence and tab ownership) |
|
|
226
|
+
| `POST /voice-mode/asr` | Accepts `16kHz` mono `Float32` PCM deltas and returns streaming transcripts, finals, or VAD speech flags |
|
|
227
|
+
| `POST /voice-mode/cancel` | Invalidates the TTS queue and optionally cancels the running agent turn |
|
|
228
|
+
| `POST /voice-mode/preview` | Isolated one-shot voice synthesis preview |
|
|
229
|
+
| `POST /voice-mode/correct` | Pre-send LLM transcript correction (falls back to original text on failure/timeout) |
|
|
230
|
+
| `GET /voice-mode/config` | Client bootstrap configuration snapshot |
|
|
231
|
+
| `GET /voice-mode/voices` | Available voice catalog |
|
|
352
232
|
|
|
353
233
|
---
|
|
354
234
|
|
|
355
|
-
##
|
|
356
|
-
|
|
357
|
-
An honest disclosure of what the plugin does (mapped to the awesome-dsh-plugin capability scan: `network / fs-read / fs-write / shell / env`):
|
|
235
|
+
## Permissions, Privacy & Security
|
|
358
236
|
|
|
359
|
-
|
|
|
237
|
+
| Capability | Plugin Behaviour | Data Destination |
|
|
360
238
|
| --- | --- | --- |
|
|
361
|
-
| **network** |
|
|
362
|
-
| **fs-read / fs-write** |
|
|
363
|
-
| **shell (child
|
|
364
|
-
| **env** |
|
|
365
|
-
|
|
366
|
-
Also: the on-device recording fixture used for debugging is **off by default**; the plugin sends no telemetry. See [`SECURITY.md`](https://github.com/qishuilalala/dsh-voice-mode/blob/main/SECURITY.md) for the threat model and how to report vulnerabilities.
|
|
367
|
-
|
|
368
|
-
### Third-party models and services
|
|
369
|
-
|
|
370
|
-
- **Local models are not shipped in the package**: the ASR (streaming zipformer, SenseVoice re-transcription), VAD and local TTS (VITS / Kokoro) models are **downloaded on first use from Hugging Face (or your configured mirror)** into a local cache; they come from export repositories in the [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) ecosystem (`csukuangfj/*`). Each model is licensed by its **original authors** — this plugin's MIT license does **not** cover them; verify the upstream licenses before commercial use (the model list is under "Model & cache"; the constants are in `src/asr-host.ts` / `src/tts-local.ts`).
|
|
371
|
-
- **The Edge cloud read-aloud is a third-party online service**: the default engine uses the Microsoft Edge browser "Read Aloud" endpoint via [`msedge-tts`](https://github.com/Migushthe2nd/MsEdgeTTS). It is not an officially supported Microsoft API — **availability, rate limits and terms are Microsoft's** and may change at any time. For stability/compliance-sensitive use, switch to local VITS / Kokoro (offline).
|
|
372
|
-
- Licenses of the third-party code inlined into the published package (`msedge-tts` and its dependencies) are in [`THIRD_PARTY_NOTICES.md`](./THIRD_PARTY_NOTICES.md); `pnpm audit` checks known high+ advisories and does not establish the absence of undisclosed or untracked vulnerabilities (CI `audit` job keeps watching).
|
|
239
|
+
| **network** | `edge` sends spoken reply text to Microsoft's Read Aloud service; `openai` / `mimo` send spoken text to your selected preset or custom endpoint; local `vits` / `kokoro` synthesize completely offline after downloading SHA256-pinned models from Hugging Face (or your configured mirror); `/voice-mode/*` binds to host loopback by default | Microphone audio goes only to your connected DSH host for local ASR (no cloud ASR). Chat prompts follow your host LLM setup |
|
|
240
|
+
| **fs-read / fs-write** | Reads/writes the model cache (`~/.cache/dsh-voice-mode/models/` on macOS/Linux, `%LOCALAPPDATA%\dsh-voice-mode\models\` on Windows) and `$DSH_HOME/voice-mode.settings.json` (`0600`); **never accesses workspace files** | Local machine |
|
|
241
|
+
| **shell (child process)** | Runs local TTS in a dedicated `child_process.fork` worker; under Electron desktop, probes system Node.js for Kokoro; **never interpolates shell strings or user input** | Local machine |
|
|
242
|
+
| **env** | Reads path/runtime environment variables (`DSH_HOME`, `LOCALAPPDATA`, `PATH`, optional `DSHVM_NODE`) | Local machine |
|
|
373
243
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
## 🚧 Known limitations
|
|
379
|
-
|
|
380
|
-
- Barge-in relies on browser echo cancellation (`echoCancellation`); loud speaker volume may leak into the mic (a self-built NLMS canceller only kicks in as a fallback when native AEC is unavailable)
|
|
381
|
-
- `Ctrl+Shift+V` overrides the browser's "paste as plain text" shortcut (normal `Ctrl+V` paste still works)
|
|
382
|
-
- The recognition model prioritizes Simplified Chinese; recognition quality is affected by ambient noise
|
|
383
|
-
- Browser autoplay policy: reading requires prior user interaction on the page (clicking the mic satisfies it); if the browser blocks playback and the status bar shows no hint, make sure the page is foregrounded and not muted
|
|
384
|
-
- **The wake word is a lightweight implementation** (text matching on the streaming transcript, not a dedicated KWS engine): it may lag or misfire in noisy environments; the wake word itself never enters the chat (the buffer is dropped on hit)
|
|
385
|
-
- In hold mode, switching windows/tabs while holding **abandons the segment** (prevents continuous recording); come back and hold again
|
|
386
|
-
- The hero (new-session empty state) has no voice entry: voice mode is a session-level feature; enter a session first and use the mic button in the input toolbar
|
|
387
|
-
- Entering/exiting voice mode, reading/writing settings and preview all rely on `AbortSignal.timeout` (Chrome 103+ / Firefox 100+ / Safari 16+); on older browsers these actions immediately show a failure hint — an expected degradation
|
|
388
|
-
- **Cloud read-aloud (Edge) depends on a Microsoft online service**: the server side may change its handshake or limits at any time (it did on 2026-10-15 — see CHANGELOG 0.7.24). If several sentences in a row fail, the status bar/toast suggests switching to local VITS / Kokoro, which the settings panel does in one click
|
|
389
|
-
- `spokenFormat` is injected through the official `system-prompt/assemble` waterfall; if the current session uses a **complete prompt** (persona `complete: true` agent preset) it is not injected (the official `complete` contract wins)
|
|
390
|
-
- Local Kokoro needs about 1 s to rebuild its engine before the next sentence after a barge-in (the price of killing in-flight synthesis)
|
|
391
|
-
- **Apple Safari / iOS**: needs **HTTPS or localhost** (a secure context is mandatory; the mic is unavailable on `http://` LAN IPs); grant the mic on first entry (iOS: Settings → Safari → Microphone if denied); recognition and read-aloud pause while backgrounded or locked and resume on return (sentences may be lost)
|
|
392
|
-
- **Security note**: the plugin's HTTP surface (`/voice-mode/*`) follows the host's security model — do not expose the dsh port to the public internet; behind a reverse proxy, authenticate at the proxy (e.g. basic auth)
|
|
244
|
+
- In Voice Mode, select **Copy diagnostics** in the status bar above the chat input. To show the bar, use **Settings → Voice Mode → Display & interaction**. The snapshot includes a build hash, runtime state, selected settings, and any available stage timings. It contains no audio or transcript text. The plugin sends no telemetry.
|
|
245
|
+
- API keys are stored host-only (`0600`) and never returned to browsers; third-party notices for bundled code are listed in [THIRD_PARTY_NOTICES.md](https://github.com/qishuilalala/dsh-voice-mode/blob/main/plugin/dsh-voice-mode/THIRD_PARTY_NOTICES.md), and vulnerability reporting is documented in [SECURITY.md](https://github.com/qishuilalala/dsh-voice-mode/blob/main/SECURITY.md).
|
|
246
|
+
- Downloaded speech models from the [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) ecosystem remain under their upstream model licenses (not covered by this package's MIT license).
|
|
393
247
|
|
|
394
248
|
---
|
|
395
249
|
|
|
396
|
-
##
|
|
250
|
+
## Troubleshooting
|
|
397
251
|
|
|
398
|
-
| Symptom |
|
|
252
|
+
| Symptom | Resolution |
|
|
399
253
|
| --- | --- |
|
|
400
|
-
|
|
|
401
|
-
|
|
|
402
|
-
|
|
|
403
|
-
|
|
|
404
|
-
|
|
|
405
|
-
|
|
|
406
|
-
|
|
|
407
|
-
| Poor recognition | Reduce background noise and compare partial/final text. `interruptLevel` controls barge-in, not recognition accuracy |
|
|
408
|
-
| Hold mode has no effect | Make sure hold mode is active and you're in voice mode (button shows `按住说话`); the browser window must be in the foreground |
|
|
409
|
-
| Preview button reports synthesis failure | Edge TTS unreachable (overseas) or the ShortName doesn't exist: verify the name (`node scripts/list-voices.mjs` lists all) and retry later |
|
|
410
|
-
| Caption is hidden behind the input box | Default `captionMaxWidth=1` (70vw) + `captionFontSize=0` (12px) can overlap the bottom input on narrow viewports; raise the tier or click the caption's `×` to dismiss |
|
|
411
|
-
| Yield behavior is wrong (saying `嗯` doesn't pause / real speech gets hard-barge) | Short backchannel words (`嗯 / 对`) auto-pause 1.5 s then reading resumes; continuing to speak triggers hard barge-in; disable `backchannelYield` to restore pre-change behavior (ADR-0008) |
|
|
412
|
-
| Says `嗯` but no yield happens | Confirm `backchannelYield=true` (default on); in hold mode, continuing to talk within 1.5 s of release triggers hard barge-in |
|
|
413
|
-
| Auto-exits after 5 minutes idle (don't want) | Raise `idleTimeoutMinutes` (default 5 min; reading, the AI speaking and a running turn all count as activity, and background tabs renew too; it still exits 2 hours after your last real action) |
|
|
414
|
-
| Mic button spins forever | The host not answering times out after 8 s; click the mic again while it spins to cancel entering, leaving no voice session behind |
|
|
415
|
-
|
|
416
|
-
---
|
|
417
|
-
|
|
418
|
-
## 🛣️ Roadmap
|
|
419
|
-
|
|
420
|
-
The [current roadmap](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/plan/roadmap-2026-10.md) defines priorities, candidate admission, acceptance gates and rollback conditions.
|
|
421
|
-
|
|
422
|
-
1. Close confirmed defects and validate one real ASR → editable draft → send → TTS workflow.
|
|
423
|
-
2. Address the highest-loss experience problems: dropped speech, unintended sends, edit conflicts and recovery.
|
|
424
|
-
3. Make model updates and fallback controlled; evaluate new models or protocols only against a measured bottleneck. A new backend is optional, not a delivery promise.
|
|
425
|
-
|
|
426
|
-
Client-side VAD, WebSocket migration, voice cloning and broad tool integration are not approved near-term work. The [historical backlog](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/competitive/backlog.md) preserves earlier research; its old Ready labels and estimates are not current commitments.
|
|
254
|
+
| Clicking mic shows permission denied | Allow microphone access in the browser address bar (or iOS Settings → Safari → Microphone); non-loopback origins require `HTTPS` |
|
|
255
|
+
| Model download is slow or stalls | Downloads resume automatically via `.part` files; in mainland China set `modelHost` to `https://hf-mirror.com` in Settings → Advanced |
|
|
256
|
+
| Unsure how to trigger push-to-talk | From idle, **hold the mic button directly**; for keyboard push-to-talk, enter voice mode first and hold **`Ctrl` (bottom-left `⌃ Control` on macOS, not `⌘ Command`)** for ≥220 ms until the status bar shows recording |
|
|
257
|
+
| Default Edge TTS has no audio | Edge relies on Microsoft's online service; switch to offline local `vits` / `kokoro` or a configured online preset in Settings → Read-aloud (`0.7.23` and earlier are deprecated due to an upstream handshake change — upgrade to latest) |
|
|
258
|
+
| Desktop Kokoro asks for Node.js | Install Node.js `>=18` on system `PATH` (or set `DSHVM_NODE`) and restart the desktop app, or switch to `vits` / `edge` |
|
|
259
|
+
| Loudspeaker echo interrupts playback | Default `detect` switches to hold-to-interrupt when native AEC is absent; you can also set `bargeInMode` to `manual` or `interruptLevel` to `0` |
|
|
260
|
+
| Wake word does not trigger | Ensure interaction mode is `toggle` (`hold` disables wake word); after each utterance or barge-in the session returns to standby — check the live standby transcript in the status bar |
|
|
427
261
|
|
|
428
262
|
---
|
|
429
263
|
|
|
430
|
-
##
|
|
264
|
+
## Development & License
|
|
431
265
|
|
|
432
|
-
Use Node.js 22.18+ on the 22.x line and pnpm 11 for
|
|
433
|
-
|
|
434
|
-
### Dependency discipline (important)
|
|
435
|
-
|
|
436
|
-
- **Runtime dependencies** (`dependencies`): `@deepseek-ai/schemastery`, `sherpa-onnx`, `sherpa-onnx-node` — external at runtime, resolved from the registry.
|
|
437
|
-
- **`msedge-tts` is a build-time `devDependency`** and is inlined together with all of its transitive dependencies into `lib/msedge-tts.cjs` (ADR-0011): it ships a `preinstall: npx only-allow pnpm` that pnpm 11 rejects, and its `require("buffer/index")` breaks under dsh ≥0.1.7's resolver. Inlined packages are listed in `THIRD_PARTY_NOTICES.md`; the inlined `axios` is pinned `>=1.20.0` via `pnpm-workspace.yaml` overrides, and CI runs `pnpm audit`.
|
|
438
|
-
- **Host framework packages** (`@deepseek-ai/cordis`, `react`) → `peerDependencies` (provided by the dsh runtime; putting them in `dependencies` would make dshmarket treat the plugin as shadowing host versions).
|
|
439
|
-
- **Type-only references** (`@deepseek-ai/dsh-settings` / `dsh-host-webserver` / `dsh-llm` / `dsh-system-prompt`) are `devDependencies` used for type checking only; no runtime imports between instances.
|
|
440
|
-
|
|
441
|
-
After changing dependencies run `npm pack --dry-run`, `npm test` and `bash scripts/verify-install.sh` (fresh install of the packed tarball with pnpm + npm).
|
|
442
|
-
|
|
443
|
-
### Build & test
|
|
266
|
+
Use Node.js 22.18+ on the 22.x line and pnpm 11 for local development. See the [contribution guide](https://github.com/qishuilalala/dsh-voice-mode/blob/main/CONTRIBUTING.md#本地开发) for the full workflow.
|
|
444
267
|
|
|
445
268
|
```sh
|
|
446
|
-
|
|
447
|
-
pnpm
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
269
|
+
cd plugin/dsh-voice-mode
|
|
270
|
+
pnpm install --frozen-lockfile
|
|
271
|
+
pnpm run check:lib-drift # check committed bundles before build overwrites lib
|
|
272
|
+
pnpm run build # builds lib/index.js, lib/index.d.ts, lib/client.js, and workers
|
|
273
|
+
pnpm run typecheck # dual host + browser TypeScript checks
|
|
274
|
+
pnpm test # unit tests, structure guards, and doc-consistency gates
|
|
451
275
|
```
|
|
452
276
|
|
|
453
|
-
|
|
454
|
-
> must copy `lib/client.js` to `<profile>/node_modules/dsh-voice-mode/lib/` and restart dsh before
|
|
455
|
-
> the browser picks up the new bundle.
|
|
456
|
-
|
|
457
|
-
### Structure
|
|
458
|
-
|
|
459
|
-
```
|
|
460
|
-
src/index.ts host: single-active pointer, llm/stream tap, SSE, settings registration, spoken-style prompt injection
|
|
461
|
-
src/asr-host.ts host: zipformer2 streaming ASR + SenseVoice finalization + lazy model download (.part resume)
|
|
462
|
-
src/models.ts host: model download/verification (SHA256 pinning + host allowlist + path checks)
|
|
463
|
-
src/security.ts host: rate limiter and guards
|
|
464
|
-
src/tts-local.ts host: local TTS engines (VITS WASM / Kokoro native addon, child-process management)
|
|
465
|
-
src/tts-runtime.ts host: picks a real Node for the Kokoro child under Electron hosts
|
|
466
|
-
src/tts-queue.ts host: per-session TTS queue + epoch barge-in + consecutive-failure streak
|
|
467
|
-
src/settings-store.ts, settings-http-scope.ts host: ≥0.1.7 settings self-persistence (ADR-0009)
|
|
468
|
-
src/segmenter.ts host: sentence segmentation + text sanitizing
|
|
469
|
-
src/asr.ts client: capture, VAD segmentation, incremental recognition, wake word, hold-to-talk gate
|
|
470
|
-
src/client.tsx client: mic button + mode toggle + status bar + caption overlay + barge-in
|
|
471
|
-
src/strings.ts, i18n.ts, error-text.ts client: zh/en dictionary + official locale service + stable error-code texts
|
|
472
|
-
src/voice-catalog.ts, voice-labels.ts voice catalog (single source) + per-language labels
|
|
473
|
-
src/errors.ts, prompts.ts stable error codes; LLM spoken-style prompts and preview sentences
|
|
474
|
-
test/*.test.mjs unit tests, harnesses and structure guards (see `npm test`)
|
|
475
|
-
scripts/ smoke-runtime.sh, full-e2e.sh, verify-install.sh, verify-dual.sh (version matrix), list-voices.mjs, prefetch.mjs
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
Integration probes (`hold-e2e.js`, `spoken-prompt-rpc.sh`, `spoken-toggle-ui-check.js`) live in the repo root `test/`, outside this npm package.
|
|
479
|
-
|
|
480
|
-
---
|
|
481
|
-
|
|
482
|
-
## 📄 License
|
|
483
|
-
|
|
484
|
-
[MIT](./LICENSE)
|
|
485
|
-
|
|
486
|
-
> Portions derived from [haoku123/dsh-voice](https://github.com/haoku123/dsh-voice) (see [`LICENSE`](./LICENSE)).
|
|
277
|
+
Released under the [MIT License](https://github.com/qishuilalala/dsh-voice-mode/blob/main/plugin/dsh-voice-mode/LICENSE), with early foundations derived from [haoku123/dsh-voice](https://github.com/haoku123/dsh-voice) (MIT).
|