dsh-voice-mode 0.7.35 → 0.7.37
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 +7 -7
- package/README.md +9 -9
- package/lib/client.js +25 -9
- package/lib/index.js +10 -3
- package/package.json +4 -3
package/README.en.md
CHANGED
|
@@ -16,9 +16,9 @@ interrupts playback and the running turn. No additional speech-service API key i
|
|
|
16
16
|
|
|
17
17
|

|
|
18
18
|
|
|
19
|
-
> **Current status (2026-
|
|
19
|
+
> **Current status (2026-11-12):** v0.7.36 covers dsh 0.2.2-rc.2, verified through 0.2.2-rc.2. Check npm and Releases for availability.
|
|
20
20
|
|
|
21
|
-
Host compatibility check
|
|
21
|
+
Host compatibility check: anchors, types and isolated runtime checks passed for dsh 0.2.2-rc.2 (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.
|
|
22
22
|
>
|
|
23
23
|
> CI results do not establish real-device audio quality or compatibility with every host version. See the [changelog](https://github.com/qishuilalala/dsh-voice-mode/blob/main/CHANGELOG.md), [compatibility evidence](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/compat-contract.md), and [roadmap](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/plan/roadmap-2026-10.md). The declared dsh range is `>=0.1.1-rc.2 <0.3.0-0`; untested versions are not guaranteed.
|
|
24
24
|
|
|
@@ -44,8 +44,8 @@ Host compatibility check (2026-10-30): anchors, types and isolated runtime check
|
|
|
44
44
|
- **Three interaction modes (switchable in settings or by right-clicking the mic)**:
|
|
45
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
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; (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
|
|
47
|
-
- `once` one-shot: talk like `toggle`; after sending, the mic turns off and voice mode exits once the reply
|
|
48
|
-
- **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
|
|
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)
|
|
48
|
+
- **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
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 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
|
|
50
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 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)
|
|
51
51
|
- **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
|
|
@@ -146,8 +146,8 @@ If a wake word is configured, you land in standby first (the status bar prompts
|
|
|
146
146
|
| `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) |
|
|
147
147
|
| `modelHost` | default | Model download host (use `https://hf-mirror.com` on mainland networks) |
|
|
148
148
|
| `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) |
|
|
149
|
-
| `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
|
|
150
|
-
| `readAloud` | `voice` | What gets read aloud: `voice` only replies in voice mode; `always` every reply in the visible session, typed ones included; `off` never |
|
|
149
|
+
| `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 finishes naturally; manual interruption resumes the mic and keeps voice mode on |
|
|
150
|
+
| `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
151
|
| `showStatusBar` | `true` | Voice status bar above the composer; when off, status lives on the mic button (timer below it, notices beside it) |
|
|
152
152
|
| `showCaptions` | `true` | Floating caption while reading aloud |
|
|
153
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 |
|
|
@@ -325,7 +325,7 @@ Also: the on-device recording fixture used for debugging is **off by default**;
|
|
|
325
325
|
|
|
326
326
|
### Compatibility declaration (what the plugin market's version filter reads)
|
|
327
327
|
|
|
328
|
-
`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-
|
|
328
|
+
`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.2 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.
|
|
329
329
|
|
|
330
330
|
## 🚧 Known limitations
|
|
331
331
|
|
package/README.md
CHANGED
|
@@ -22,16 +22,16 @@ DeepSeek Harness 语音双工对话模式:会话内一键进入 → 边说边
|
|
|
22
22
|
dsh ≥0.1.7 上按钮挂在发送键左侧(`conversation.input.activity`),更早的版本仍在输入框右侧。状态全部画在按钮上:
|
|
23
23
|
|
|
24
24
|
- **聆听**:绿色三根竖条,随麦克风音量跳动;**朗读中**:蓝色五根竖条,随播放音量跳动;**按住说话**:红色
|
|
25
|
-
- **说完就关**(`mode: once
|
|
25
|
+
- **说完就关**(`mode: once`):发出后关麦、转圈等回复,自然读完显示对勾并自动退出;长按麦克风或按 Ctrl 打断后恢复收音并留在语音模式
|
|
26
26
|
- **检测到说话**:右上角橙点;**出错**:左上角红点(悬停看原因)
|
|
27
27
|
- **点击**:平时进入/退出;不在语音模式但正在朗读(`readAloud: always`)时点一下 = 停止朗读;等待回复或朗读期间单击 = 停止朗读并完全退出。点按钮不会抢走输入框的光标
|
|
28
28
|
- **右键菜单**(鼠标右键或键盘菜单键;触屏长按仍是按住说话):交互模式、朗读回复范围、字幕浮层、状态条、自动发送
|
|
29
29
|
- 状态条与字幕默认开启;两项都关掉即上图的「全部收进按钮」形态,此时录音计时显示在按钮下方、提示文字显示在按钮旁
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
> **当前状态(2026-
|
|
32
|
+
> **当前状态(2026-11-12)**:v0.7.36 覆盖 dsh 0.2.2-rc.2,对外「已验证至」0.2.2-rc.2;可安装版本以 npm 徽章与 Releases 为准。
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
兼容跟进:最新 dsh 0.2.2-rc.2 的锚点、类型与隔离运行时复核通过(含客户端侧);完整证据和未验收层见[兼容契约](../../docs/compat-contract.md)。
|
|
35
35
|
>
|
|
36
36
|
> CI 通过不代表真实听感、所有硬件或所有宿主版本均已验证。详见 [CHANGELOG](https://github.com/qishuilalala/dsh-voice-mode/blob/main/CHANGELOG.md)、[兼容证据](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/compat-contract.md)和[后续路线图](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/plan/roadmap-2026-10.md)。包声明范围为 `>=0.1.1-rc.2 <0.3.0-0`,未测版本不保证。
|
|
37
37
|
|
|
@@ -40,7 +40,7 @@ dsh ≥0.1.7 上按钮挂在发送键左侧(`conversation.input.activity`)
|
|
|
40
40
|
|
|
41
41
|
## 🤝 Fork 增强(本仓库新增)
|
|
42
42
|
|
|
43
|
-
本仓库在上游 [haoku123/dsh-voice](https://github.com/haoku123/dsh-voice) 基础上加入了大量增强,核心如下(完整清单见 git 历史与
|
|
43
|
+
本仓库在上游 [haoku123/dsh-voice](https://github.com/haoku123/dsh-voice) 基础上加入了大量增强,核心如下(完整清单见 git 历史与[旧账本档案](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/rules/archive/STATE-until-2026-11-12.md)):
|
|
44
44
|
|
|
45
45
|
- **朗读默认 Edge 云端;本地 TTS 可选(隐私优先)**:本地合成不向独立在线 TTS 服务发送回复文本,宿主 LLM 的网络请求不受此选项控制——
|
|
46
46
|
- 本地 VITS(WASM 运行时,`sherpa-onnx-vits-zh-ll`,纯中文,5 说话人);
|
|
@@ -63,8 +63,8 @@ dsh ≥0.1.7 上按钮挂在发送键左侧(`conversation.input.activity`)
|
|
|
63
63
|
- **三种交互模式(右键麦克风或设置可切换,切换即持久化)**:
|
|
64
64
|
- `toggle`(默认)持续聆听:RMS VAD 分段 → zipformer2 流式识别(边说边出字,实时字幕预览)→ 静音约 1500 毫秒断句进草稿,连续多段拼成一条消息,再静音约 1.2 秒(合计约 2.7 秒)自动发送;按住 `Ctrl` 强制立即发送
|
|
65
65
|
- `hold` 按住说话:空闲时**直接按住麦克风按钮就开始录音、松手即发**(不必先点一下进入;短按仍是进入/退出);发出后等回复结束(开朗读则读完)自动退出语音模式;关闭自动发送时松手只把文字留在输入框、不发送并直接退出;按住时没说话约 25 秒后兜底退出;滑出取消、`Esc`/失焦放弃本段;按住期间停顿不断句(上限 10 分钟);`Ctrl` 按住即录、松开即发
|
|
66
|
-
- `once` 说完就关:像 `toggle`
|
|
67
|
-
- **朗读范围**(`readAloud`):`voice`(默认)只朗读语音模式下的回复;`always`
|
|
66
|
+
- `once` 说完就关:像 `toggle` 一样说一段,发出后关麦,等回复自然朗读完自动退出语音模式;长按麦克风或按 Ctrl 打断后恢复收音、留在语音模式,下一轮自然读完再退出(关闭自动发送时:说完这一段即退出,文字留在草稿)
|
|
67
|
+
- **朗读范围**(`readAloud`):`voice`(默认)只朗读语音模式下的回复;`always` 当前可见会话的所有回复都朗读(含打字发的;同一会话开多个标签页只在最后看的那个上播;切换会话立即停下原会话朗读,待播内容一并作废);`off` 从不朗读
|
|
68
68
|
- **唤醒词(可选,默认关)**:设置 `wakeWord` 后进入待机态,说出唤醒词才开始识别(如「你好小D」)。**可直接与命令连说**(「你好小D,帮我查天气」)——唤醒词会在定稿/字幕里自动剥掉、不进消息;匹配带容错(同音字替换「小莫→小墨」、首字错、前置语气词「呃/喂/我说」),建议 3-4 字;待机态状态条实时显示「说『x』开始 · 它听到的转写」,唤醒成败可自查。边界(重要):**仅 `toggle` 模式生效**(`hold` / 手动打断下唤醒词静默失效);**说完整一句后回到待机态需重说唤醒词**(只喊唤醒词、还没说命令时保持聆听,可停顿想好再说);**朗读期说唤醒词不触发**(打断由 VAD 开口即触发,与唤醒词无关)
|
|
69
69
|
- **字幕档位**:`captionFontSize` 4 档(0=12px / 1=14px / 2=18px / 3=24px)+ `captionMaxWidth` 3 档(0=50vw / 1=70vw / 2=90vw),窄屏自适应
|
|
70
70
|
- **让位语义**(ADR-0008):`backchannelYield` 默认开—— 朗读期用户插话「嗯/对」自动让位 1.5s,真要说走硬打断;让 LLM 主动让出话轮(人格层让位);关掉恢复改造前行为
|
|
@@ -133,8 +133,8 @@ dsh plugin --profile web add dsh-voice-mode
|
|
|
133
133
|
| `modelHost` | 默认源 | 模型下载源(国内网络填 `https://hf-mirror.com`) |
|
|
134
134
|
| `autoSend` | `true` | 静音到点自动发送(连续多段拼成一条消息);关闭则只进草稿(按住 `Ctrl` / hold 松手仍会发送) |
|
|
135
135
|
| `autoResume` | `false` | 切回上次语音会话时自动恢复语音模式(默认关)。开启后:下次进入语音会话即自动进入语音模式 + 恢复上次会话;关闭则需手动按 `Ctrl+Shift+V` 重新进入 |
|
|
136
|
-
| `mode` | `toggle` | 交互模式:`toggle` 持续聆听 + 1500ms 静音断句;`hold` 按住说话、松手发送(短按退出);`once`
|
|
137
|
-
| `readAloud` | `voice` | 朗读范围:`voice` 仅语音模式下的回复;`always`
|
|
136
|
+
| `mode` | `toggle` | 交互模式:`toggle` 持续聆听 + 1500ms 静音断句;`hold` 按住说话、松手发送(短按退出);`once` 说一段、回复自然读完自动退出;手动打断后恢复收音并留在语音模式 |
|
|
137
|
+
| `readAloud` | `voice` | 朗读范围:`voice` 仅语音模式下的回复;`always` 当前可见会话的所有回复(含打字发送,切换会话即停止原朗读);`off` 从不朗读 |
|
|
138
138
|
| `showStatusBar` | `true` | 输入框上方的语音状态条;关闭后状态只显示在麦克风按钮上(计时在按钮下方、提示在按钮旁) |
|
|
139
139
|
| `showCaptions` | `true` | 朗读时的字幕浮层 |
|
|
140
140
|
| `shortcut` | `Ctrl+Shift+V` | 进入 / 退出语音模式的快捷键(修饰键 Ctrl/Shift/Alt/Meta + 一个字母 / 数字 / Enter / Space / Tab);设置页「快捷键」分组里可点「录制」直接按组合键录入(`Esc` 取消、`Backspace` 清空,缺修饰键或方向键 / F 键等不支持的键会提示);**留空 = 禁用快捷键**,改用麦克风按钮;**即时生效** |
|
|
@@ -312,7 +312,7 @@ flowchart LR
|
|
|
312
312
|
|
|
313
313
|
### 兼容声明(插件市场的版本筛选依据)
|
|
314
314
|
|
|
315
|
-
`package.json` 声明 `engines.dsh = ">=0.1.1-rc.2 <0.3.0-0"`。这是版本准入范围,不代表区间内每个版本都已实测。兼容记录列出了截至 0.2.2-
|
|
315
|
+
`package.json` 声明 `engines.dsh = ">=0.1.1-rc.2 <0.3.0-0"`。这是版本准入范围,不代表区间内每个版本都已实测。兼容记录列出了截至 0.2.2-rc.2 的已测版本及实际测试形态。默认验证集按“支持区间两端 + 每条小版本线最新已验证版 + latest/next”去重,当前为 9 版锚点/双类型检查、8 核心冒烟。历史实证保留,可用 `verify-dual.sh --full` 或显式版本复验;纯补验不发版。每日工作流比对上游标签并为未覆盖版本开 issue,不会自动跑完整矩阵。`peerDependencies` 声明宿主提供的 `@deepseek-ai/cordis` 与 `react`。
|
|
316
316
|
|
|
317
317
|
## 🚧 已知限制
|
|
318
318
|
|
package/lib/client.js
CHANGED
|
@@ -1350,7 +1350,7 @@ function createAsrEngine(config, sessionId) {
|
|
|
1350
1350
|
const myStopSeq = startSeq;
|
|
1351
1351
|
const wasActive = active;
|
|
1352
1352
|
active = false;
|
|
1353
|
-
if (!wasActive) {
|
|
1353
|
+
if (!wasActive && !stream && !audioCtx) {
|
|
1354
1354
|
setState("idle");
|
|
1355
1355
|
return;
|
|
1356
1356
|
}
|
|
@@ -3993,7 +3993,7 @@ function telemetryDeltas(tel) {
|
|
|
3993
3993
|
}
|
|
3994
3994
|
return out;
|
|
3995
3995
|
}
|
|
3996
|
-
var BUILD_TAG = "
|
|
3996
|
+
var BUILD_TAG = "c170edf";
|
|
3997
3997
|
var TELEMETRY_FLAG = "dsh-voice-mode.telemetry";
|
|
3998
3998
|
var telemetryEnabled = typeof localStorage !== "undefined" && localStorage.getItem(TELEMETRY_FLAG) === "1";
|
|
3999
3999
|
console.log("[dsh-voice] build=" + BUILD_TAG);
|
|
@@ -4706,7 +4706,9 @@ function createVoiceBus(basePath = BASE_PATH2, ctx) {
|
|
|
4706
4706
|
});
|
|
4707
4707
|
source.addEventListener("focus", (e) => {
|
|
4708
4708
|
try {
|
|
4709
|
-
|
|
4709
|
+
const tabId = JSON.parse(e.data).tabId ?? null;
|
|
4710
|
+
if (focusOwnerTab === TAB_ID && tabId !== null && tabId !== TAB_ID && focusedSessionId !== null && (activeSessionId === null || activeSessionId === focusedSessionId)) doSkipAudio(focusedSessionId);
|
|
4711
|
+
focusOwnerTab = tabId;
|
|
4710
4712
|
} catch {
|
|
4711
4713
|
}
|
|
4712
4714
|
});
|
|
@@ -4776,6 +4778,7 @@ function createVoiceBus(basePath = BASE_PATH2, ctx) {
|
|
|
4776
4778
|
source.addEventListener("tts-idle", (e) => {
|
|
4777
4779
|
try {
|
|
4778
4780
|
const ev = JSON.parse(e.data);
|
|
4781
|
+
if (ev.sessionId && ev.turn !== void 0 && ev.turn < (currentTurn.get(ev.sessionId) ?? ev.turn)) return;
|
|
4779
4782
|
if (ev.sessionId === activeSessionId && !ui.ttsDrained) {
|
|
4780
4783
|
ui.ttsDrained = true;
|
|
4781
4784
|
notify();
|
|
@@ -5090,6 +5093,7 @@ function createVoiceBus(basePath = BASE_PATH2, ctx) {
|
|
|
5090
5093
|
if (sessionId === null) {
|
|
5091
5094
|
const { changed, focused } = focusRelease(focusOwners, owner);
|
|
5092
5095
|
if (!changed) return;
|
|
5096
|
+
if (focusedSessionId !== focused) doSkipAudio(focusedSessionId);
|
|
5093
5097
|
focusedSessionId = focused;
|
|
5094
5098
|
if (focused !== null) {
|
|
5095
5099
|
if (typeof document === "undefined" || document.visibilityState === "visible") postFocus(focused);
|
|
@@ -5099,6 +5103,7 @@ function createVoiceBus(basePath = BASE_PATH2, ctx) {
|
|
|
5099
5103
|
return;
|
|
5100
5104
|
}
|
|
5101
5105
|
focusClaim(focusOwners, owner, sessionId);
|
|
5106
|
+
if (focusedSessionId !== null && focusedSessionId !== sessionId) doSkipAudio(focusedSessionId);
|
|
5102
5107
|
focusedSessionId = sessionId;
|
|
5103
5108
|
if (typeof document === "undefined" || document.visibilityState === "visible") postFocus(sessionId);
|
|
5104
5109
|
},
|
|
@@ -5668,7 +5673,7 @@ function MicButton({
|
|
|
5668
5673
|
onceRef.current = o;
|
|
5669
5674
|
setOnceWaiting(true);
|
|
5670
5675
|
void engineRef.current?.stop();
|
|
5671
|
-
bus.setUi({ partial: "", levels: [], isSpeech: void 0 });
|
|
5676
|
+
bus.setUi({ partial: "", levels: [], isSpeech: void 0, ttsDrained: false });
|
|
5672
5677
|
checkOnce();
|
|
5673
5678
|
};
|
|
5674
5679
|
const exitMode = async (reason) => {
|
|
@@ -5751,6 +5756,11 @@ function MicButton({
|
|
|
5751
5756
|
sessionId: sid
|
|
5752
5757
|
});
|
|
5753
5758
|
const hardBreak = async () => {
|
|
5759
|
+
const resumeOnce = bootNow().mode === "once" && onceRef.current !== null;
|
|
5760
|
+
if (resumeOnce) {
|
|
5761
|
+
clearOnce();
|
|
5762
|
+
resetIdle();
|
|
5763
|
+
}
|
|
5754
5764
|
bus.skipAudio();
|
|
5755
5765
|
bus.unduckAudio();
|
|
5756
5766
|
cancelAutoSend();
|
|
@@ -5774,7 +5784,13 @@ function MicButton({
|
|
|
5774
5784
|
signal: AbortSignal.timeout(3e3)
|
|
5775
5785
|
}).catch(() => {
|
|
5776
5786
|
});
|
|
5777
|
-
if (
|
|
5787
|
+
if (resumeOnce) {
|
|
5788
|
+
const eng = engineRef.current;
|
|
5789
|
+
void eng?.start().then(() => {
|
|
5790
|
+
if (engineRef.current !== eng || localRef.current !== "on" || !mountedRef.current) return;
|
|
5791
|
+
if (manualHoldRef.current || toggleHoldRef.current) eng.beginHeld();
|
|
5792
|
+
}).catch(() => bus.setUi({ error: t("micUnavailable") }));
|
|
5793
|
+
} else if (engineRef.current && !engineRef.current.holding) await engineRef.current.discardSegment();
|
|
5778
5794
|
await cancelP;
|
|
5779
5795
|
bus.setUi({ partial: "\u2026" });
|
|
5780
5796
|
if (breakDotsTimerRef.current) clearTimeout(breakDotsTimerRef.current);
|
|
@@ -6236,7 +6252,7 @@ function MicButton({
|
|
|
6236
6252
|
return;
|
|
6237
6253
|
}
|
|
6238
6254
|
const eng = engineRef.current;
|
|
6239
|
-
if (e.key === "Control" && !e.shiftKey && !e.altKey && !e.metaKey && !e.repeat && eng && !onceRef.current) {
|
|
6255
|
+
if (e.key === "Control" && !e.shiftKey && !e.altKey && !e.metaKey && !e.repeat && eng && (!onceRef.current || bootNow().mode === "once")) {
|
|
6240
6256
|
ctrlHoldStart = Date.now();
|
|
6241
6257
|
otherKeyDuringCtrl = false;
|
|
6242
6258
|
if (bootNow().mode === "hold") {
|
|
@@ -6246,7 +6262,7 @@ function MicButton({
|
|
|
6246
6262
|
setHolding(true);
|
|
6247
6263
|
eng.beginHeld();
|
|
6248
6264
|
}, 600);
|
|
6249
|
-
} else if (bootNow().bargeInMode === "manual" && bus.ui.playing) {
|
|
6265
|
+
} else if (bootNow().bargeInMode === "manual" && bus.ui.playing || bootNow().mode === "once" && onceRef.current) {
|
|
6250
6266
|
manualHoldRef.current = true;
|
|
6251
6267
|
setHolding(true);
|
|
6252
6268
|
eng.beginHeld();
|
|
@@ -6473,14 +6489,14 @@ function MicButton({
|
|
|
6473
6489
|
}, 250);
|
|
6474
6490
|
}
|
|
6475
6491
|
}
|
|
6476
|
-
} else if (localRef.current === "on" && bus.ui.playing && !onceRef.current) {
|
|
6492
|
+
} else if (localRef.current === "on" && (bus.ui.playing && !onceRef.current || bootNow().mode === "once" && onceRef.current)) {
|
|
6477
6493
|
toggleHoldRef.current = true;
|
|
6478
6494
|
setHolding(true);
|
|
6479
6495
|
const eng = engineRef.current;
|
|
6480
6496
|
eng?.beginHeld();
|
|
6481
6497
|
breakTimerRef.current = setTimeout(() => {
|
|
6482
6498
|
breakTimerRef.current = null;
|
|
6483
|
-
if (holdPtrRef.current && bus.ui.playing) void breakRef.current?.();
|
|
6499
|
+
if (holdPtrRef.current && (bus.ui.playing || onceRef.current)) void breakRef.current?.();
|
|
6484
6500
|
}, 250);
|
|
6485
6501
|
}
|
|
6486
6502
|
};
|
package/lib/index.js
CHANGED
|
@@ -1155,6 +1155,7 @@ function splitSentences(chunk) {
|
|
|
1155
1155
|
let lastEnd = 0;
|
|
1156
1156
|
while ((m = re.exec(chunk)) !== null) {
|
|
1157
1157
|
const end = m.index + m[0].length;
|
|
1158
|
+
if (m[0] === "." && end === chunk.length && /\d/.test(chunk[m.index - 1] ?? "")) continue;
|
|
1158
1159
|
sentences.push(chunk.slice(start, end));
|
|
1159
1160
|
start = end;
|
|
1160
1161
|
lastEnd = end;
|
|
@@ -1683,7 +1684,7 @@ var TtsQueue = class {
|
|
|
1683
1684
|
q.epoch++;
|
|
1684
1685
|
q.pending.length = 0;
|
|
1685
1686
|
}
|
|
1686
|
-
this.engine.interrupt?.();
|
|
1687
|
+
if (![...this.queues].some(([sid, other]) => sid !== sessionId && other.busy)) this.engine.interrupt?.();
|
|
1687
1688
|
}
|
|
1688
1689
|
/** 会话退出/被抢占时彻底清理其队列(防止 Map 长期累积)。 */
|
|
1689
1690
|
prune(sessionId) {
|
|
@@ -3216,6 +3217,11 @@ function apply(ctx, config) {
|
|
|
3216
3217
|
if (sessionId === null || sessionId === activeVoiceSession || tapInFlight.has(sessionId)) return;
|
|
3217
3218
|
dropTurnTables(sessionId);
|
|
3218
3219
|
};
|
|
3220
|
+
const stopFocusReading = (sessionId) => {
|
|
3221
|
+
if (sessionId === null) return;
|
|
3222
|
+
queue.cancel(sessionId);
|
|
3223
|
+
turnGen.set(sessionId, (turnGen.get(sessionId) ?? 0) + 1);
|
|
3224
|
+
};
|
|
3219
3225
|
const sessions = ctx.get("sessions");
|
|
3220
3226
|
const limiter = new RateLimiter();
|
|
3221
3227
|
const limiterPrune = setInterval(() => limiter.prune(Date.now(), 6e4), 6e4);
|
|
@@ -3391,7 +3397,7 @@ function apply(ctx, config) {
|
|
|
3391
3397
|
// 单句重试耗尽被跳过:显式下行(客户端提示 + 诊断),不再静默丢句。
|
|
3392
3398
|
// streak = 连续被跳过的句数:客户端据此区分偶发抖动与「云端整体不可用」(如服务端拒绝握手)。
|
|
3393
3399
|
onSkip: (sessionId, text, streak) => broadcast("tts-skip", { sessionId, text: text.slice(0, 80), streak }),
|
|
3394
|
-
onIdle: (sessionId) => broadcast("tts-idle", { sessionId }),
|
|
3400
|
+
onIdle: (sessionId) => broadcast("tts-idle", { sessionId, turn: turnOfSession.get(sessionId)?.turn }),
|
|
3395
3401
|
// R15(Issue #15 Important-2 host 侧接线):onIdle 降级为「候选空闲」——「队列排空」不等于
|
|
3396
3402
|
// 「回合结束」。带工具调用的回合会在工具执行期间把队列排空一次,据此发 tts-idle 会让
|
|
3397
3403
|
// mode:once 在空档里提前 exitMode(麦克风熄灭、后半段回复永不朗读)。置 true 后 tts-idle
|
|
@@ -3497,7 +3503,7 @@ function apply(ctx, config) {
|
|
|
3497
3503
|
setTurn(sessionId, state, turn);
|
|
3498
3504
|
},
|
|
3499
3505
|
vset.readAloud !== "off",
|
|
3500
|
-
() => readMuted.has(sessionId)
|
|
3506
|
+
() => readMuted.has(sessionId) || turnGen.get(sessionId) !== gen
|
|
3501
3507
|
);
|
|
3502
3508
|
});
|
|
3503
3509
|
ctx.on("agent/turn-stopping", ({ agent }) => queue.noteTurnEnd(agent.id));
|
|
@@ -4065,6 +4071,7 @@ function apply(ctx, config) {
|
|
|
4065
4071
|
focusedSessionId = null;
|
|
4066
4072
|
focusedTabId = null;
|
|
4067
4073
|
}
|
|
4074
|
+
if (prevFocus !== null && prevFocus !== focusedSessionId) stopFocusReading(prevFocus);
|
|
4068
4075
|
if (prevFocus !== null && prevFocus !== focusedSessionId) reclaimFocusState(prevFocus);
|
|
4069
4076
|
broadcast("focus", { sessionId: focusedSessionId, tabId: focusedTabId });
|
|
4070
4077
|
respondJson2(res, 200, { ok: true, sessionId: focusedSessionId, tabId: focusedTabId });
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "dsh-voice-mode",
|
|
3
3
|
"description": "Voice plugin for DeepSeek Harness: local streaming speech recognition into editable drafts, sentence-by-sentence read-aloud with captions, and voice interruption. Edge online or local VITS/Kokoro TTS; host compatibility is bounded by engines.dsh.",
|
|
4
4
|
"icon": "./icon.svg",
|
|
5
|
-
"version": "0.7.
|
|
5
|
+
"version": "0.7.37",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"repository": {
|
|
@@ -47,8 +47,9 @@
|
|
|
47
47
|
],
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "node build.mjs",
|
|
50
|
+
"check:lib-drift": "node scripts/check-lib-drift.mjs",
|
|
50
51
|
"prepack": "node build.mjs",
|
|
51
|
-
"test": "node
|
|
52
|
+
"test": "node scripts/run-tests.mjs",
|
|
52
53
|
"verify:client": "node test/verify-client.mjs",
|
|
53
54
|
"prefetch": "node scripts/prefetch.mjs",
|
|
54
55
|
"list-voices": "node scripts/list-voices.mjs",
|
|
@@ -103,7 +104,7 @@
|
|
|
103
104
|
"@types/react": "^19.3.0",
|
|
104
105
|
"esbuild": "^0.28.2",
|
|
105
106
|
"msedge-tts": "^2.1.1",
|
|
106
|
-
"playwright-core": "1.
|
|
107
|
+
"playwright-core": "1.65.0",
|
|
107
108
|
"typescript": "^5.9.2"
|
|
108
109
|
},
|
|
109
110
|
"keywords": [
|