dsh-voice-mode 0.7.26 → 0.7.27
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 +13 -5
- package/README.md +27 -6
- package/lib/client.js +541 -77
- package/lib/index.js +165 -22
- package/package.json +2 -2
package/README.en.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](./LICENSE)
|
|
4
4
|
[](https://github.com/qishuilalala/dsh-voice-mode/releases)
|
|
5
5
|
[](https://www.npmjs.com/package/dsh-voice-mode)
|
|
6
|
-
[](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/rules/STATE.md)
|
|
7
7
|
|
|
8
8
|
Full-duplex voice conversation mode for DeepSeek Harness (dsh): speak, get a
|
|
9
9
|
spoken answer. Streamed zipformer2 ASR → editable draft → auto send → the
|
|
@@ -16,7 +16,9 @@ interrupts playback and the running turn. No API key.
|
|
|
16
16
|
|
|
17
17
|

|
|
18
18
|
|
|
19
|
-
> **
|
|
19
|
+
> **Latest releases**: **v0.7.27** — the mic button becomes the status panel, right-click quick settings, one-shot mode and always-read (PR #16 by @dyguests); **v0.7.26** — issue #15 feedback addressed (barge-in no longer swallows speech, speaking during a running task steers it, live transcript in the composer, send delay decoupled from the silence threshold, optional LLM correction, visible settings timing, silent-failure notices). Full history in the [CHANGELOG](https://github.com/qishuilalala/dsh-voice-mode/blob/main/CHANGELOG.md).
|
|
20
|
+
>
|
|
21
|
+
> **Runtime changes (v0.7.18 – v0.7.24)**: (1) **Settings work on every dsh version** — fixed the settings page and persistence on dsh 0.1.7+ (Settings → Voice Mode page, writes survive restarts); (2) **i18n rebuilt** — the UI follows dsh's official language setting, zh/en fully consistent, switching needs no refresh; (3) **fixed fresh npm/pnpm installs and the dsh ≥0.1.7 installed-form "failed to import"** (0.7.17 and earlier are affected — upgrade to ≥0.7.18); (4) **local Kokoro fixed under the official desktop (Electron) app** — needs Node.js ≥18 on PATH (or set `DSHVM_NODE`); (5) **v0.7.24: Edge cloud read-aloud restored** — since 2026-10-15 Microsoft's service rejects the old handshake (v0.7.23 and earlier are silent on the default Edge engine; local VITS / Kokoro are unaffected), so the inlined msedge-tts is bumped to 2.1.0; when read-aloud **fails several sentences in a row** the plugin now suggests switching to a local engine; plus host hardening (`/models/retry` is same-origin POST only, model-tree path checks, raw error strings no longer sent downstream). Compatible with dsh up to 0.2.1-rc.2 (from 0.2.1-alpha.4/5 the Settings entry moved into the "Account menu" popover at the bottom of the sidebar; both of this plugin's entry points still work).
|
|
20
22
|
|
|
21
23
|
---
|
|
22
24
|
|
|
@@ -36,9 +38,12 @@ interrupts playback and the running turn. No API key.
|
|
|
36
38
|
## ✨ Features
|
|
37
39
|
|
|
38
40
|
- **Voice mode**: toggle with the microphone button in the input toolbar or the global shortcut `Ctrl+Shift+V`; globally single-active (only one session is in voice mode at a time; switching sessions yields automatically)
|
|
39
|
-
- **
|
|
41
|
+
- **Three interaction modes (switchable in settings or by right-clicking the mic)**:
|
|
40
42
|
- `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
|
|
41
43
|
- `hold` push-to-talk: short tap to enter/exit, **hold the mic button to talk, release to send** (swipe up to cancel, `Esc`/blur abandons the segment; pauses do not split while held, up to 10 min); hold `Ctrl` to record-by-keyboard, release to send
|
|
44
|
+
- `once` one-shot: talk like `toggle`; after sending, the mic turns off and voice mode exits once the reply has been read aloud (with auto-send off: exits after the utterance, text stays in the draft)
|
|
45
|
+
- **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); `off` never
|
|
46
|
+
- **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 the keyboard menu key) for quick settings; touch long-press stays push-to-talk. Turn off the status bar and captions to keep all voice UI on the button
|
|
42
47
|
- **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 with `hold` / manual barge-in); **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)
|
|
43
48
|
- **Caption tiers (batch 3)**: `captionFontSize` 4 levels (0=12px / 1=14px / 2=18px / 3=24px) + `captionMaxWidth` 3 levels (0=50vw / 1=70vw / 2=90vw); adapts to narrow viewports
|
|
44
49
|
- **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
|
|
@@ -135,7 +140,10 @@ If a wake word is configured, you land in standby first (the status bar prompts
|
|
|
135
140
|
| `idleTimeoutMinutes` | `5` | Minutes of inactivity before auto-exiting voice mode (reading counts as activity; batch J 10→5) |
|
|
136
141
|
| `modelHost` | default | Model download host (use `https://hf-mirror.com` on mainland networks) |
|
|
137
142
|
| `autoSend` | `true` | Auto-send once quiet (consecutive segments join into one message); when off, text only goes to the draft (hold `Ctrl` / release in hold mode still sends) |
|
|
138
|
-
| `mode` | `toggle` | Interaction mode: `toggle` continuous listening + 1500 ms silence split; `hold` push-to-talk, release to send (short tap exits) |
|
|
143
|
+
| `mode` | `toggle` | Interaction mode: `toggle` continuous listening + 1500 ms silence split; `hold` push-to-talk, release to send (short tap exits); `once` one utterance, then exit after the reply is read aloud |
|
|
144
|
+
| `readAloud` | `voice` | What gets read aloud: `voice` only replies in voice mode; `always` every reply in the visible session, typed ones included; `off` never |
|
|
145
|
+
| `showStatusBar` | `true` | Voice status bar above the composer; when off, status lives on the mic button (timer below it, notices beside it) |
|
|
146
|
+
| `showCaptions` | `true` | Floating caption while reading aloud |
|
|
139
147
|
| `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 |
|
|
140
148
|
| `shortcut` | `Ctrl+Shift+V` | Shortcut to enter / exit voice mode (modifiers Ctrl/Shift/Alt/Meta + one letter key); **empty = disabled**, use the mic button instead |
|
|
141
149
|
| `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; **toggle mode only**; not triggered while the agent is reading |
|
|
@@ -376,7 +384,7 @@ After changing dependencies run `npm pack --dry-run`, `npm test` and `bash scrip
|
|
|
376
384
|
|
|
377
385
|
```sh
|
|
378
386
|
pnpm install && pnpm build # esbuild: lib/index.js (host) + lib/client.js (browser) + lib/msedge-tts.cjs
|
|
379
|
-
pnpm test #
|
|
387
|
+
pnpm test # 52 test files chained: unit tests + harnesses (fake browser driving the real engine) + structure guards + pre-release self-check (no network)
|
|
380
388
|
bash scripts/smoke-runtime.sh <dsh-core-bin.js> <port> # boot an isolated dsh core: endpoints, mic button, settings page, i18n
|
|
381
389
|
bash scripts/full-e2e.sh <dsh-core-bin.js> <port> # real-LLM end to end: create → toggle → prompt → SSE audio frames
|
|
382
390
|
systemctl restart dsh # Linux; restart the dsh process on other platforms
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](LICENSE)
|
|
4
4
|
[](https://github.com/qishuilalala/dsh-voice-mode/releases)
|
|
5
5
|
[](https://www.npmjs.com/package/dsh-voice-mode)
|
|
6
|
-
[](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/rules/STATE.md)
|
|
7
7
|
|
|
8
8
|
DeepSeek Harness 语音双工对话模式:会话内一键进入 → 边说边出字的流式识别 → 停顿自动发送 → 最终答复按句流式朗读 + 实时字幕,开口即可打断(真 barge-in)。无需 API Key,识别模型在本地宿主端推理。
|
|
9
9
|
|
|
@@ -15,7 +15,23 @@ DeepSeek Harness 语音双工对话模式:会话内一键进入 → 边说边
|
|
|
15
15
|
|
|
16
16
|

|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
### 麦克风按钮即状态面板(PR #16,[@dyguests](https://github.com/dyguests) 贡献)
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
dsh ≥0.1.7 上按钮挂在发送键左侧(`conversation.input.activity`),更早的版本仍在输入框右侧。状态全部画在按钮上:
|
|
23
|
+
|
|
24
|
+
- **聆听**:绿色三根竖条,随麦克风音量跳动;**朗读中**:蓝色五根竖条,随播放音量跳动;**按住说话**:红色
|
|
25
|
+
- **说完就关**(`mode: once`):发出后关麦、转圈等回复,读完显示对勾并自动退出
|
|
26
|
+
- **检测到说话**:右上角橙点;**出错**:左上角红点(悬停看原因)
|
|
27
|
+
- **点击**:平时进入/退出;不在语音模式但正在朗读(`readAloud: always`)时点一下 = 停止朗读
|
|
28
|
+
- **右键菜单**(鼠标右键或键盘菜单键;触屏长按仍是按住说话):交互模式、朗读回复范围、字幕浮层、状态条、自动发送
|
|
29
|
+
- 状态条与字幕默认开启;两项都关掉即上图的「全部收进按钮」形态,此时录音计时显示在按钮下方、提示文字显示在按钮旁
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
> **最近两版**:**v0.7.27** 麦克风按钮即状态面板 + 右键快捷设置 + 说完就关 + 总是朗读(PR #16,@dyguests 贡献);**v0.7.26** issue #15 体验反馈处置(打断不吃句、运行中插话、实时回填输入框、发送延迟解耦、可选 LLM 纠错、设置生效可见、静默故障提示)。完整记录见 [CHANGELOG](https://github.com/qishuilalala/dsh-voice-mode/blob/main/CHANGELOG.md)。
|
|
33
|
+
>
|
|
34
|
+
> **运行时变更(v0.7.18 ~ v0.7.24)**:① **设置面全版本打通**——dsh 0.1.7+ 上设置页与持久化修复(Settings → 语音模式 专属页、写入与重启保留);② **国际化重做**——界面语言跟随 dsh 官方语言设置,中/英文完整一致、切换无需刷新;③ **修复 npm/pnpm 全新安装失败与 dsh ≥0.1.7 已安装形态「failed to import」**(0.7.17 及更早版本受影响,请升级到 ≥0.7.18);④ **官方桌面端(Electron)下本地 Kokoro 修复**——需系统 PATH 上有 Node.js ≥18(或设 `DSHVM_NODE`);⑤ **v0.7.24:恢复 Edge 云端朗读**——微软服务端自 2026-10-15 起拒绝旧版握手(v0.7.23 及更早的默认 Edge 朗读无声,本地 VITS / Kokoro 不受影响),内联的 msedge-tts 升到 2.1.0;朗读**连续失败时**会提示切换本地引擎;另有 host 加固(`/models/retry` 仅同源 POST、模型树路径校验、错误原文不下行)。兼容 dsh 至 0.2.1-rc.2(0.2.1-alpha.4/5 起设置入口移入侧栏底部「Account menu」弹出层,本插件两处入口仍有效)。
|
|
19
35
|
|
|
20
36
|
---
|
|
21
37
|
|
|
@@ -41,9 +57,11 @@ DeepSeek Harness 语音双工对话模式:会话内一键进入 → 边说边
|
|
|
41
57
|
## ✨ 功能
|
|
42
58
|
|
|
43
59
|
- **语音模式**:输入框工具排麦克风按钮或全局快捷键 `Ctrl+Shift+V` 进入/退出;全局单活(同一时刻仅一个会话处于语音模式,切换会话自动让出)
|
|
44
|
-
-
|
|
60
|
+
- **三种交互模式(右键麦克风或设置可切换,切换即持久化)**:
|
|
45
61
|
- `toggle`(默认)持续聆听:RMS VAD 分段 → zipformer2 流式识别(边说边出字,实时字幕预览)→ 静音约 1500 毫秒断句进草稿,连续多段拼成一条消息,再静音约 1.2 秒(合计约 2.7 秒)自动发送;按住 `Ctrl` 强制立即发送
|
|
46
62
|
- `hold` 按住说话:短按进入/退出,**按住麦克风按钮说话、松手即发**(滑出取消、`Esc`/失焦放弃本段);按住期间停顿不断句(上限 10 分钟);`Ctrl` 按住即录、松开即发
|
|
63
|
+
- `once` 说完就关:像 `toggle` 一样说一段,发出后关麦,等回复朗读完自动退出语音模式(关闭自动发送时:说完这一段即退出,文字留在草稿)
|
|
64
|
+
- **朗读范围**(`readAloud`):`voice`(默认)只朗读语音模式下的回复;`always` 当前可见会话的所有回复都朗读(含打字发的;同一会话开多个标签页只在最后看的那个上播);`off` 从不朗读
|
|
47
65
|
- **唤醒词(可选,默认关)**:设置 `wakeWord` 后进入待机态,说出唤醒词才开始识别(如「你好小D」)。**可直接与命令连说**(「你好小D,帮我查天气」)——唤醒词会在定稿/字幕里自动剥掉、不进消息;匹配带容错(同音字替换「小莫→小墨」、首字错、前置语气词「呃/喂/我说」),建议 3-4 字;待机态状态条实时显示「说『x』开始 · 它听到的转写」,唤醒成败可自查。边界(重要):**仅 `toggle` 模式生效**(`hold` / 手动打断下唤醒词静默失效);**说完整一句后回到待机态需重说唤醒词**(只喊唤醒词、还没说命令时保持聆听,可停顿想好再说);**朗读期说唤醒词不触发**(打断由 VAD 开口即触发,与唤醒词无关)
|
|
48
66
|
- **字幕档位**:`captionFontSize` 4 档(0=12px / 1=14px / 2=18px / 3=24px)+ `captionMaxWidth` 3 档(0=50vw / 1=70vw / 2=90vw),窄屏自适应
|
|
49
67
|
- **让位语义**(ADR-0008):`backchannelYield` 默认开—— 朗读期用户插话「嗯/对」自动让位 1.5s,真要说走硬打断;让 LLM 主动让出话轮(人格层让位);关掉恢复改造前行为
|
|
@@ -111,7 +129,10 @@ bundle 插件安装后需重启 dsh 生效(Linux:`systemctl restart dsh`;
|
|
|
111
129
|
| `modelHost` | 默认源 | 模型下载源(国内网络填 `https://hf-mirror.com`) |
|
|
112
130
|
| `autoSend` | `true` | 静音到点自动发送(连续多段拼成一条消息);关闭则只进草稿(按住 `Ctrl` / hold 松手仍会发送) |
|
|
113
131
|
| `autoResume` | `false` | 切回上次语音会话时自动恢复语音模式(默认关)。开启后:下次进入语音会话即自动进入语音模式 + 恢复上次会话;关闭则需手动按 `Ctrl+Shift+V` 重新进入 |
|
|
114
|
-
| `mode` | `toggle` | 交互模式:`toggle` 持续聆听 + 1500ms 静音断句;`hold`
|
|
132
|
+
| `mode` | `toggle` | 交互模式:`toggle` 持续聆听 + 1500ms 静音断句;`hold` 按住说话、松手发送(短按退出);`once` 说一段、回复读完自动退出 |
|
|
133
|
+
| `readAloud` | `voice` | 朗读范围:`voice` 仅语音模式下的回复;`always` 当前可见会话的所有回复(含打字发送);`off` 从不朗读 |
|
|
134
|
+
| `showStatusBar` | `true` | 输入框上方的语音状态条;关闭后状态只显示在麦克风按钮上(计时在按钮下方、提示在按钮旁) |
|
|
135
|
+
| `showCaptions` | `true` | 朗读时的字幕浮层 |
|
|
115
136
|
| `shortcut` | `Ctrl+Shift+V` | 进入 / 退出语音模式的快捷键(修饰键 Ctrl/Shift/Alt/Meta + 一个字母键);**留空 = 禁用快捷键**,改用麦克风按钮 |
|
|
116
137
|
| `wakeWord` | 空(关) | 唤醒词(如「你好小D」):进入后先说唤醒词激活,避免误触;空 = 关闭。**可与命令连说**,词头自动剥掉不进消息;匹配带容错(编辑距离 ≤1 + 前 3 字符前导窗口,吸收同音字/语气词);**建议 3-4 字**——单字词无容错、2 字词的容错会连带吸收所有同首字的 2 字词(如「小莫」也会唤醒「小张」),介意误唤醒用 3 字以上;每句断句或打断后回待机需重说;**仅 toggle 模式生效**(hold / 手动打断下不生效);朗读期说唤醒词不触发 |
|
|
117
138
|
| `toolBeep` | `false` | 工具调用提示音(默认关):开启后 AI 调用工具时「滴」一声;关闭则全程静默 |
|
|
@@ -125,7 +146,7 @@ bundle 插件安装后需重启 dsh 生效(Linux:`systemctl restart dsh`;
|
|
|
125
146
|
| `llmCorrect` | `false` | LLM 纠错(Issue #15 批 4,默认关):发送前用大模型对整条语音文本做一次纠错(只改错别字/同音字/标点,保持原意;复用宿主已配置模型。开 = 每条消息多一次约 1 秒的纠错等待;纠错失败自动用原文) |
|
|
126
147
|
| `yieldMs` | `1500` | 让位窗口时长(ms,500-3000):`backchannelYield` 命中后 TTS 丢帧持续时长;窗口内用户真要说则由原 `hardBreak` 接管,窗口到点自动恢复播放 |
|
|
127
148
|
|
|
128
|
-
生效时机分四档:① 即时——朗读引擎 / 音色 / 语速 / 口语化提示词(对后续回复生效)/ 模型镜像(下次下载尝试即生效);② 下次识别时——定稿重译(SenseVoice)/ 逆文本归一化;③ 下一段话——静音判定时长(断句端点;发送等待固定 1.2 秒不受影响);④ 下次进入语音模式——打断灵敏度 / 打断方式 / 回声门控 / 快捷键 / 自动发送 / 自动恢复 / 交互模式 / 唤醒词 / 工具提示音 / 字幕字号 / 字幕宽度 / 短应答让位 / 让位窗口 / 打断语音抢救 / LLM 纠错 / 空闲时长。已保存但未生效的项会列在设置卡片顶部(含当前生效值)。设置项默认值由插件配置(`base` 层)提供。
|
|
149
|
+
生效时机分四档:① 即时——朗读引擎 / 音色 / 语速 / 口语化提示词(对后续回复生效)/ 朗读范围 / 状态条 / 字幕浮层 / 模型镜像(下次下载尝试即生效);② 下次识别时——定稿重译(SenseVoice)/ 逆文本归一化;③ 下一段话——静音判定时长(断句端点;发送等待固定 1.2 秒不受影响);④ 下次进入语音模式——打断灵敏度 / 打断方式 / 回声门控 / 快捷键 / 自动发送 / 自动恢复 / 交互模式 / 唤醒词 / 工具提示音 / 字幕字号 / 字幕宽度 / 短应答让位 / 让位窗口 / 打断语音抢救 / LLM 纠错 / 空闲时长。已保存但未生效的项会列在设置卡片顶部(含当前生效值)。设置项默认值由插件配置(`base` 层)提供。
|
|
129
150
|
|
|
130
151
|
### 本地音色(VITS / Kokoro)
|
|
131
152
|
|
|
@@ -345,7 +366,7 @@ flowchart LR
|
|
|
345
366
|
|
|
346
367
|
```sh
|
|
347
368
|
pnpm install && pnpm build # esbuild:lib/index.js(host)+ lib/client.js(browser)
|
|
348
|
-
pnpm test #
|
|
369
|
+
pnpm test # 52 个测试文件串联:单测 + 台架(假浏览器驱动真引擎)+ 结构守卫 + 发布前自检(无需网络)
|
|
349
370
|
systemctl restart dsh # 本机加载新 host 代码;其他平台重启 dsh 进程
|
|
350
371
|
```
|
|
351
372
|
|