dsh-voice-mode 0.7.40 → 0.7.42

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 CHANGED
@@ -16,11 +16,9 @@ interrupts playback and the running turn. No additional speech-service API key i
16
16
 
17
17
  ![Real recording: streaming transcription → auto-send → sentence-by-sentence read-aloud with live captions](https://raw.githubusercontent.com/qishuilalala/dsh-voice-mode/HEAD/plugin/dsh-voice-mode/assets/demo-voice-flow.gif)
18
18
 
19
- > **Current status (2026-11-21):** v0.7.40 adds 7 online TTS presets with per-preset API keys, Xiaomi MiMo TTS, visual ASR replacement rules, a redesigned 4-tab settings panel, touch quick-settings menu, tab-switch draft finalization, and caption history. Check npm and Releases for availability.
20
-
21
- Host compatibility check: anchors, types and isolated runtime checks passed for dsh 0.2.2-rc.5 (including the client side). See the [compatibility record](../../docs/compat-contract.md) for evidence and unverified layers; this does not establish microphone or cross-platform acceptance.
19
+ > **Current status:** Supports 7 built-in online TTS presets with per-preset API keys, Xiaomi MiMo TTS, editable post-ASR replacement rules, a 4-tab settings panel, localized keyboard/touch guidance (including macOS keycap badges and `220ms` keyboard push-to-talk), and cross-platform worker isolation. Check npm and [Releases](https://github.com/qishuilalala/dsh-voice-mode/releases) for published versions.
22
20
  >
23
- > 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.
21
+ > **Compatibility & verification boundaries:** Client injection anchors, host/client typechecks, and isolated runtime checks pass through `dsh 0.2.2-rc.5`. See the [compatibility contract](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/compat-contract.md) for the full host/OS/browser matrix and unverified layers, the [changelog](https://github.com/qishuilalala/dsh-voice-mode/blob/main/CHANGELOG.md), and the [roadmap](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/plan/roadmap-2026-10.md). CI does not replace real-device microphone or acoustic acceptance; the declared `dsh` range is `>=0.1.1-rc.2 <0.3.0-0`, and untested host versions are not guaranteed.
24
22
 
25
23
 
26
24
  ---
@@ -40,15 +38,15 @@ Host compatibility check: anchors, types and isolated runtime checks passed for
40
38
 
41
39
  ## ✨ Features
42
40
 
43
- - **Voice mode**: toggle with the microphone button in the input toolbar or the global shortcut `Ctrl+Shift+V`; with the caret in the composer, `Alt+Enter` (`Option+Enter` on Mac) toggles it too, without inserting a newline; globally single-active (only one session is in voice mode at a time; switching sessions yields automatically)
44
- - **Three interaction modes (switchable in settings or by right-clicking the mic)**:
45
- - `toggle` (default) continuous listening: RMS VAD segmentation → streaming zipformer2 ASR (words appear as you speak, live caption preview) → automatic sentence split after 1500 ms of silence into the draft, consecutive segments joined into one message, then auto-sent after ~1.2 s more of silence (≈2.7 s total); hold `Ctrl` to force an immediate send
46
- - `hold` push-to-talk: from idle, **just hold the mic button to start recording and release to send** (no need to tap in first; a short tap still enters/exits); after sending, voice mode exits on its own once the reply finishes (read aloud, if on); with auto-send off, releasing only leaves the text in the composer (not sent) and exits; if you hold without speaking it exits after ~25 s; (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 finishes naturally; holding the mic button or pressing Ctrl interrupts the reply, resumes the mic, and keeps voice mode on for another utterance (with auto-send off: exits after the utterance, text stays in the draft)
41
+ - **Voice mode**: toggle with the microphone button in the input toolbar or the global shortcut `Ctrl+Shift+V` (`⌃ Control + ⇧ Shift + V` on macOS — note `Control`, not `⌘ Command`); with the caret in the composer, `Alt+Enter` (`⌥ Option + Return` on macOS) toggles it too, without inserting a newline; globally single-active (only one session is in voice mode at a time; switching sessions yields automatically)
42
+ - **Three interaction modes (switchable in settings, right-click menu, or touch `⋯` menu)**:
43
+ - `toggle` (default) continuous listening: RMS VAD segmentation → streaming zipformer2 ASR (words appear as you speak, live caption preview) → automatic sentence split after 1500 ms of silence into the draft, consecutive segments joined into one message, then auto-sent after ~1.2 s more of silence (≈2.7 s total); hold `Ctrl` (`⌃ Control` on macOS) while speaking to force an immediate send
44
+ - `hold` push-to-talk: from idle, **just hold the mic button to start recording and release to send** (no need to tap in first; a short tap still enters/exits); while voice mode is active, you can also **hold `Ctrl` (`⌃ Control` on macOS, ≥220 ms)** to record by keyboard and release to send; after sending, voice mode exits on its own once the reply finishes (read aloud, if on); with auto-send off, releasing only leaves the text in the composer (not sent) and exits; if you hold without speaking it exits after ~25 s; swipe up, `Esc`, window blur, or pressing another key combo cancels the segment; pauses do not split while held
45
+ - `once` one-shot: talk like `toggle`; after sending, the mic turns off and voice mode exits once the reply finishes naturally; holding the mic button or pressing `Ctrl` (`⌃ Control` on macOS) interrupts the reply, resumes the mic, and keeps voice mode on for another utterance (with auto-send off: exits after the utterance, text stays in the draft)
48
46
  - **Read-aloud scope** (`readAloud`): `voice` (default) only replies in voice mode; `always` every reply in the visible session, typed ones included (with the session open in several tabs, only the last-viewed tab plays; switching sessions immediately stops the previous session and discards its queued speech); `off` never
49
- - **The mic button is the status panel** (PR #16 by [@dyguests](https://github.com/dyguests)): green bars follow your voice while listening, blue bars follow playback while reading, a spinner while `once` waits for the reply, a check mark before it exits; orange dot = speech detected, red dot = error (hover for details). Right-click (or 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
- - **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
- - **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
47
+ - **The mic button is the status panel** (PR #16 by [@dyguests](https://github.com/dyguests)): green bars follow your voice while listening, blue bars follow playback while reading, a spinner while `once` waits for the reply, a check mark before it exits; orange dot = speech detected, red dot = error (hover for details). Right-click (or keyboard menu key) on desktop, or tap the `⋯` button (or 450 ms idle long-press outside `hold` mode) on touch devices for quick settings. Turn off the status bar and captions to keep all voice UI on the button
48
+ - **Wake word (optional, off by default)**: after setting `wakeWord`, entering voice mode starts in standby, and recognition only begins once the wake word is spoken (e.g. `你好小D`). **You may say it together with your command** ("wake word, check the weather") — the wake word is stripped from the transcript/caption and never sent; matching is fault-tolerant (homophone substitutions, a wrong first char, leading fillers); 3-4 characters recommended; in standby the status bar live-shows "say '<word>' · what it heard". Boundaries (important): **toggle mode only** (inactive in `hold` mode; works normally when idle under `manual` or `detect` fallback); **it must be repeated after each completed utterance or barge-in** (if you only said the wake word, the engine keeps listening so you may pause before the command); **saying it while the agent is reading does not trigger** (barge-in is VAD-based and unrelated to the wake word)
49
+ - **Caption tiers**: `captionFontSize` 4 levels (0=12px / 1=14px / 2=18px / 3=24px) + `captionMaxWidth` 3 levels (0=50vw / 1=70vw / 2=90vw); adapts to narrow viewports and safe areas, with recent-sentence history after playback
52
50
  - **Yield semantics (ADR-0008)**: `backchannelYield` on by default — saying `嗯 / 对 / right` while the AI is reading auto-pauses for 1.5 s; genuine speech still triggers hard barge-in; lets the LLM yield the turn
53
51
  - **Output pipeline**: only the final answer's `text-delta` is read (reasoning/tool calls are skipped), streamed sentence-by-sentence (Edge cloud by default; local VITS / Kokoro, int8/fp32, optional) with a live caption overlay at the bottom-right; tool calls trigger a beep; the full text is still written to the chat; in voice mode a spoken-format system prompt is injected (short natural sentences, no Markdown decoration), and the reader side strips markers as well for a smoother listening experience
54
52
  - **Barge-in**: three sensitivity levels of voice-onset detection → local mute + host synth queue invalidation (epoch) + running turn cancellation (the half-finished part is kept and naturally flows into your new message). With a wake word set, barge-in **remains speak-to-interrupt** (the gate is the VAD, not the wake word; the engine returns to standby afterwards)
@@ -60,21 +58,20 @@ Host compatibility check: anchors, types and isolated runtime checks passed for
60
58
 
61
59
  ---
62
60
 
63
- ## ⌨️ Interaction gestures
61
+ ## ⌨️ Interaction gestures & shortcuts
64
62
 
65
- Speaking to trigger a hard interruption stops playback and requests cancellation of the current running turn. The separate “stop reading” action only stops read-aloud; these are different actions.
63
+ Speaking to trigger a hard interruption stops playback and requests cancellation of the current running turn. Pressing `Esc` once (or clicking stop) stops read-aloud only; double-pressing `Esc` exits voice mode.
66
64
 
67
- | Gesture | Behaviour |
68
- | --- | --- |
69
- | Click the mic button / `Ctrl+Shift+V` | Enter / exit voice mode (clicking the button does not steal composer focus; while waiting for a reply or reading, one click stops reading and exits completely) |
70
- | `Alt+Enter` (`Option+Enter` on Mac) in the composer | Toggle voice mode with the caret in the input, no newline inserted; holding the key does not re-toggle; the settings card's own inputs are not intercepted; `Cmd/Ctrl+Enter` is left alone (the host uses it to send) |
71
- | Just speak, pause ~1500 ms (toggle) | Accumulate into draft, auto-send after ~2.7 s of quiet |
72
- | Hold `Ctrl` (toggle, ≥250 ms speech) | Force-send the current segment immediately |
73
- | **Hold the mic button (hold)** | From idle, hold to start recording right away, release to send and exit after the reply ends; swipe up / `Esc` / blur abandons the segment; <250 ms tap enters/exits; right-click only opens the quick menu |
74
- | Hold `Ctrl` (hold, ≥600 ms) | Keyboard push-to-talk, release to send |
75
- | Speak the wake word first (if configured) | Activate from standby into listening (then recognition and sending begin) |
76
- | Speak while AI is reading | Interrupt playback and cancel the running turn |
77
- | Type in the input box | Auto-exit voice mode (draft is kept) |
65
+ | Action | Windows / Linux | macOS | Behaviour |
66
+ | --- | --- | --- | --- |
67
+ | Enter / exit voice mode | `Ctrl+Shift+V` | `⌃ Control + ⇧ Shift + V` | App-wide toggle (note: `Control` on macOS, not `⌘ Command`; customizable or clearable in Settings → Shortcuts). Clicking the mic button does not steal composer focus |
68
+ | Toggle from composer | `Alt+Enter` | `⌥ Option + Return` | Toggles voice mode while the caret is in the chat input without inserting a newline; leaves `Ctrl/⌘ + Enter` intact for sending |
69
+ | Continuous listening (`toggle`) | Speak directly; hold `Ctrl` to send now | Speak directly; hold `⌃ Control` to send now | Splits into draft after ~1500 ms silence and auto-sends after ~2.7 s total quiet; holding `Ctrl` / `⌃ Control` ≥250 ms while speaking sends immediately on release |
70
+ | Push-to-talk (`hold`) — pointer/touch | Hold the mic button | Hold the mic button | From idle, hold the mic button directly to record and release to send (auto-exits once the reply finishes); swipe up or press `Esc` to cancel; short tap enters/exits |
71
+ | Push-to-talk (`hold`) — keyboard | Hold `Ctrl` (≥220 ms) | Hold `⌃ Control` (≥220 ms) | While in voice mode, hold `Ctrl` / `⌃ Control` to record and release to send; pressing `Esc`, blurring the window, or pressing another key combo discards the segment |
72
+ | Interrupt / stop reading | Speak / hold `Ctrl` / `Esc` | Speak / hold `⌃ Control` / `Esc` | Under `auto`, speaking interrupts immediately; under `manual` (or `detect` without native AEC), hold mic or `Ctrl` / `⌃ Control` during playback to interrupt; `Esc` stops reading, double-`Esc` exits |
73
+ | Quick settings menu | Right-click mic (or Menu key) | Right-click / two-finger click mic | On touch devices, tap `⋯` next to the mic (or 450 ms idle long-press outside `hold` mode) |
74
+ | Type in the input box | Type in composer | Type in composer | Auto-exits voice mode while preserving the current draft |
78
75
 
79
76
  ---
80
77
 
@@ -138,9 +135,9 @@ If a wake word is configured, you land in standby first (the status bar prompts
138
135
  | `ttsEngine` | `edge` | Read-aloud engine: `edge` Microsoft cloud (default, fast) / `vits` local Chinese / `kokoro` local zh+en / `openai` any OpenAI-compatible server / `mimo` Xiaomi MiMo (independent `mimoTts.apiKey`, see below); **applies live** |
139
136
  | `kokoroModel` | `int8` | Kokoro precision: `int8` (default, 109 MB, CPU/low-bandwidth) / `fp32` (311 MB, better quality, GPU/large memory); same 103 voices; **applies live** |
140
137
  | `voice` | per engine | Voice: 5 VITS speakers; 103 Kokoro voices (◀▶ stepper; 62/68/75/76 favourite males pinned); Edge ShortNames below. The inline "试听" button previews it at the current rate |
141
- | `rate` | `1.1` | Reading speed multiplier (0.5 slow ~ 2.0 fast), **applies live** (batch J 1.0→1.1) |
138
+ | `rate` | `1.1` | Reading speed multiplier (0.5 slow ~ 2.0 fast), **applies live** |
142
139
  | `interruptLevel` | `0` | Barge-in sensitivity (host-side VAD frame detection + echo gate): 0 high threshold (3 frames) / 1 medium (2 frames) / 2 low (1 frame) |
143
- | `bargeInMode` | `detect` | Barge-in mode: `detect` auto-probes native echo cancellation (default; switches playback to hold-to-interrupt when inactive) / `auto` force interrupt as soon as you speak (headphones / quiet rooms) / `manual` manual interrupt (recommended on loudspeakers: speak directly or say the wake word when idle, and hold mic/Ctrl to interrupt during playback). Batch 7O default, I10-exempt (ADR-0006) |
140
+ | `bargeInMode` | `detect` | Barge-in mode: `detect` auto-probes native echo cancellation (default; switches playback to hold-to-interrupt when inactive) / `auto` force interrupt as soon as you speak (headphones / quiet rooms) / `manual` manual interrupt (recommended on loudspeakers: speak directly or say the wake word when idle, and hold mic/`Ctrl` to interrupt during playback; see ADR-0006) |
144
141
  | `echoGateDb` | `6` | Fallback echo-gate threshold when native AEC is unavailable. Inactive with native AEC. Only on the fallback path, a higher value is more conservative; verify the device and barge-in mode before tuning |
145
142
  | `silenceMs` | `1500` | Silence pause in ms that marks the end of a complete sentence |
146
143
  | `idleTimeoutMinutes` | `5` | Minutes of inactivity before auto-exiting voice mode (reading, speech and a running turn renew the timer, subject to a two-hour cap since the last user activity) |
@@ -162,14 +159,14 @@ If a wake word is configured, you land in standby first (the status bar prompts
162
159
  | `openaiBaseUrl` | empty (preset/config) | Online TTS endpoint override configurable directly in the settings card (priority: settings > preset > `openaiTts.baseUrl`); pair with `custom` preset for any OpenAI-compatible server; **applies live** |
163
160
  | `openaiModel` | empty | Online TTS model override (same priority as `openaiBaseUrl`); **applies live** |
164
161
  | `openaiApiKey` | empty (config fallback) | Online TTS API key entered in the settings card; stored in the host-side `0600` settings file and **never sent back to the browser** (`GET /voice-mode/settings` returns empty string + `keys.*` booleans); priority: per-preset key > global key > `openaiTts.apiKeys[preset]` > `openaiTts.apiKey`; **applies live** |
165
- | `openaiApiKeys` | `{}` (none) | Per-preset keys (Q2: key follows the preset): `{presetId: key}` map in the settings card; whichever preset is selected uses its own key; empty entries fall back to the global key; **booleans only, never the plaintext**; **applies live** (refresh to use the new key) |
162
+ | `openaiApiKeys` | `{}` (none) | Per-preset API keys: `{presetId: key}` map in the settings card; whichever preset is selected uses its own key without 401 mismatches when switching presets; empty entries fall back to the global key; **booleans only, never plaintext**; **applies live** |
166
163
  | `mimoApiKey` | empty (config fallback) | Xiaomi MiMo API key (`api-key` header) entered in the settings card; host-only `0600` storage, never sent back to the browser; falls back to `mimoTts.apiKey`; **applies live** |
167
164
  | `asrReplacements` | `[]` | Post-recognition correction table `[{from:[misheard], to:wanted}]` (≤200 rules / ≤12 KB UTF-8); applies to both partials and finals, editable in the settings card with hit counters; **applies live** |
168
165
  | `captionFontSize` | `0` | Caption font tier 0=12px / 1=14px / 2=18px / 3=24px (default 0 is byte-equivalent to legacy) |
169
166
  | `captionMaxWidth` | `1` | Caption width tier 0=50vw / 1=70vw / 2=90vw |
170
167
  | `backchannelYield` | `true` | Yield semantics (ADR-0008); saying `嗯 / 对` while reading auto-pauses for 1.5 s; genuine speech still triggers hard barge-in; off = behavior identical to pre-change |
171
- | `bargeInSalvage` | `true` | Barge-in salvage (Issue #15 batch 1 / ADR-0012): when you speak to interrupt while the agent is reading aloud, keep what you said from speech onset to break confirmation and merge it into recognition (fixes swallowed break-in speech; off = discard pre-break audio; recommended off only on speakers without echo cancellation) |
172
- | `llmCorrect` | `false` | LLM correction (Issue #15 batch 4, off by default): before sending, run one LLM pass over the whole transcribed text (typos/homophones/punctuation only, meaning preserved; reuses the host configured model). On = about one extra second per message; falls back to the original text if correction fails or the model answers you instead of correcting |
168
+ | `bargeInSalvage` | `true` | Barge-in salvage (ADR-0012): when you speak to interrupt while the agent is reading aloud, keep what you said from speech onset to break confirmation and merge it into recognition (prevents swallowed break-in speech; off = discard pre-break audio; recommended off only on speakers without echo cancellation) |
169
+ | `llmCorrect` | `false` | LLM correction (off by default): before sending, run one LLM pass over the whole transcribed text (typos/homophones/punctuation only, meaning preserved; reuses the host configured model). On = about one extra second per message; falls back to the original text if correction fails or the model answers you instead of correcting |
173
170
  | `yieldMs` | `1500` | Yield-window length (ms, 500-3000): how long TTS frames are dropped after `backchannelYield` triggers; if you really want to speak in the window the normal `hardBreak` takes over, and playback resumes when the window ends |
174
171
 
175
172
  Effect timing, in four tiers: ① immediately — shortcut / composer shortcut / interaction mode / read-aloud scope / auto-send / captions / status bar / engine / voice / rate / spoken format (applies to later replies) / model mirror (next download attempt); ② next recognition — finalization re-transcription (SenseVoice) / ITN; ③ next utterance — silence threshold (endpoint; the send wait stays a fixed 1.2 s); ④ next time you enter voice mode — interrupt sensitivity / barge-in mode / echo gate / auto-resume / wake word / tool beep / caption font / caption width / backchannel yielding / yield window / barge-in salvage / LLM correction / idle timeout. Saved-but-not-yet-effective items are listed at the top of the settings card with their current effective values. Defaults come from the plugin config (`base` layer) — they follow the config unless explicitly changed.
@@ -209,10 +206,10 @@ You can also edit the `voice-mode:` section of `~/.dsh/settings.yaml` directly (
209
206
  cacheDir: ~/.cache/dsh-voice-mode/models # overridable; platform default otherwise
210
207
  # Defaults seeded for the settings (the settings panel overrides; the panel is authoritative):
211
208
  voice: zh-CN-XiaoxiaoNeural
212
- rate: 1.1 # batch J 1.0→1.1
209
+ rate: 1.1
213
210
  interruptLevel: 0
214
211
  silenceMs: 1500
215
- idleTimeoutMinutes: 5 # batch J 10→5
212
+ idleTimeoutMinutes: 5
216
213
  modelHost: https://huggingface.co
217
214
  ```
218
215
 
@@ -309,6 +306,8 @@ flowchart LR
309
306
  Edge[Edge cloud]
310
307
  Vits[Local VITS WASM]
311
308
  Kokoro[Local Kokoro<br/>native addon]
309
+ OpenAI[OpenAI-compatible TTS]
310
+ MiMo[Xiaomi MiMo TTS]
312
311
  end
313
312
 
314
313
  UI -->|audio f32 PCM<br/>POST /voice-mode/asr| ASR
@@ -321,16 +320,20 @@ flowchart LR
321
320
  TTS -->|edge| Edge
322
321
  TTS -->|vits| Vits
323
322
  TTS -->|kokoro| Kokoro
323
+ TTS -->|openai| OpenAI
324
+ TTS -->|mimo| MiMo
324
325
  Edge -.->|SSE audio frame| UI
325
326
  Vits -.->|SSE audio frame| UI
326
327
  Kokoro -.->|SSE audio frame| UI
328
+ OpenAI -.->|SSE audio frame| UI
329
+ MiMo -.->|SSE audio frame| UI
327
330
  VAD -.->|wake-word / barge-in| Q
328
331
  ```
329
332
 
330
333
  - Speech and reading only happen for the session pointed to by the global single-active pointer `activeVoiceSession`; other sessions pass through `llm/stream` with zero overhead (mode isolation)
331
334
  - The `llm/stream` tap is lossless: every chunk passes through unchanged; segmentation/synthesis only observe and never block the model stream
332
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
333
- - Local TTS (VITS / native Kokoro) runs in an isolated child process (fork, auto-restart); barge-in kills the in-flight synthesis to release its worker resources
336
+ - Local TTS (VITS / lazily-loaded native Kokoro) runs in an isolated child process (fork, auto-restart); barge-in kills the in-flight synthesis to release its worker resources
334
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
335
338
 
336
339
  ---
@@ -341,7 +344,7 @@ flowchart LR
341
344
  | --- | --- | --- |
342
345
  | Recognition model | Cloud API (needs key) | **Local zipformer2 + SenseVoice** (zero key) |
343
346
  | Multi-language | English-first | **SenseVoice auto-recognition + ITN** |
344
- | TTS engine | Cloud TTS | **Edge cloud + local VITS/Kokoro** (three-way switch) |
347
+ | TTS engine | Cloud TTS | **Edge cloud + local VITS/Kokoro + OpenAI-compatible / Xiaomi MiMo** |
345
348
  | Barge-in detection | Basic VAD | **3 sensitivity levels + echo gate + yield semantics** |
346
349
  | Caption a11y | None | **4 font tiers + 3 width tiers + theme-following** |
347
350
  | Wake word | None | **Lightweight streaming match + prefix filler whitelist** |
@@ -355,8 +358,8 @@ An honest disclosure of what the plugin does (mapped to the awesome-dsh-plugin c
355
358
 
356
359
  | Category | What it does | Where data goes |
357
360
  | --- | --- | --- |
358
- | **network** | (1) The default read-aloud engine **Edge** sends the **reply text to be spoken** over WebSocket to Microsoft `speech.platform.bing.com` (cloud synthesis — local VITS / Kokoro avoids this TTS request after its models are ready; host LLM traffic is separate); (2) downloads local models on first use from `huggingface.co` (or your configured mirror `hf-mirror.com`) with host restrictions and pinned digests for primary/listed files; auxiliary directories use manifest/presence checks; (3) with `ttsEngine: openai`, sends the text to be spoken to the configured `openaiTts.baseUrl` (and to nothing else); (4) registers loopback HTTP routes `/voice-mode/*` on the dsh host (loopback only by default; LAN needs `allowLan`) | Browser audio is sent to the configured dsh host for recognition; the plugin does not use an independent cloud ASR. Edge sends text to Microsoft. Submitted transcripts and optional LLM correction follow the host LLM configuration |
359
- | **fs-read / fs-write** | Model cache (Linux/macOS `~/.cache/dsh-voice-mode/models/`, Windows `%LOCALAPPDATA%\dsh-voice-mode\models\`); the dsh 0.1.7+ settings overlay `$DSH_HOME/voice-mode.settings.json`; **never touches your workspace files** | All local |
361
+ | **network** | (1) Default **Edge** TTS sends spoken reply text over WebSocket to Microsoft `speech.platform.bing.com`; (2) `ttsEngine: openai` sends spoken text to the selected preset or configured `openaiBaseUrl` / `openaiTts.baseUrl`; (3) `ttsEngine: mimo` sends spoken text to `mimoTts.baseUrl` (`https://api.xiaomimimo.com/v1` by default); (4) local VITS / Kokoro synthesize offline once models are downloaded from `huggingface.co` (or configured `hf-mirror.com`) with SHA256 digest checks; (5) registers loopback HTTP routes `/voice-mode/*` on the dsh host (loopback only by default; LAN needs `allowLan`) | Browser audio is sent only to the connected dsh host for local recognition (no third-party cloud ASR). Submitted transcripts and optional `llmCorrect` follow the host LLM configuration |
362
+ | **fs-read / fs-write** | Model cache (Linux/macOS `~/.cache/dsh-voice-mode/models/`, Windows `%LOCALAPPDATA%\dsh-voice-mode\models\`); the dsh 0.1.7+ settings overlay `$DSH_HOME/voice-mode.settings.json` (`0600`, API keys remain host-only and are never returned to the browser); **never touches your workspace files** | All local |
360
363
  | **shell (child processes)** | Local TTS synthesis runs in a separate child process (`child_process.fork` → `lib/tts-vits-worker.cjs`); when the host is Electron (the official desktop app), it additionally probes and launches a real Node.js for Kokoro (`node -p …` to check the version). **It never executes user input and never builds shell command strings** | Local |
361
364
  | **env** | Uses directory/runtime environment settings such as `DSH_HOME`, `LOCALAPPDATA`, `PATH` and optional `DSHVM_NODE`; this default speech path does not require an extra speech-service API key | — |
362
365
 
@@ -441,7 +444,7 @@ After changing dependencies run `npm pack --dry-run`, `npm test` and `bash scrip
441
444
 
442
445
  ```sh
443
446
  pnpm install && pnpm build # esbuild: lib/index.js (host) + lib/client.js (browser) + lib/msedge-tts.cjs
444
- pnpm test # 53 test files chained: unit tests + harnesses (fake browser driving the real engine) + structure guards + pre-release self-check (no network)
447
+ pnpm test # runs unit tests, harnesses, structure guards, and pre-release checks via scripts/run-tests.mjs
445
448
  bash scripts/smoke-runtime.sh <dsh-core-bin.js> <port> # boot an isolated dsh core: endpoints, mic button, settings page, i18n
446
449
  bash scripts/full-e2e.sh <dsh-core-bin.js> <port> # real-LLM end to end: create → toggle → prompt → SSE audio frames
447
450
  systemctl restart dsh # Linux; restart the dsh process on other platforms
@@ -478,4 +481,6 @@ Integration probes (`hold-e2e.js`, `spoken-prompt-rpc.sh`, `spoken-toggle-ui-che
478
481
 
479
482
  ## 📄 License
480
483
 
481
- [MIT](./LICENSE)
484
+ [MIT](./LICENSE)
485
+
486
+ > Portions derived from [haoku123/dsh-voice](https://github.com/haoku123/dsh-voice) (see [`LICENSE`](./LICENSE)).
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![npm version](https://img.shields.io/npm/v/dsh-voice-mode?style=flat-square&color=orange)](https://www.npmjs.com/package/dsh-voice-mode)
6
6
  [![CI](https://github.com/qishuilalala/dsh-voice-mode/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/qishuilalala/dsh-voice-mode/actions/workflows/ci.yml)
7
7
 
8
- DeepSeek Harness 语音双工对话模式:会话内一键进入 → 边说边出字的流式识别 → 停顿自动发送 → 最终答复按句合成后播放 + 实时字幕,开口即可打断(真 barge-in)。默认语音路径无需额外语音 API Key,识别在宿主端推理;宿主 LLM 的配置与费用另计。
8
+ DeepSeek Harness 语音双工对话插件:会话内一键进入 → 边说边出字的本地流式识别 → 停顿自动发送 → 最终答复按句合成播放 + 实时字幕,支持发声或按键打断。默认语音路径无需额外语音 API Key,识别在宿主端本地运行;宿主大模型的连接与费用由宿主自身配置决定。
9
9
 
10
10
  **中文** · [English](https://github.com/qishuilalala/dsh-voice-mode/blob/HEAD/plugin/dsh-voice-mode/README.en.md)
11
11
 
@@ -29,11 +29,9 @@ dsh ≥0.1.7 上按钮挂在发送键左侧(`conversation.input.activity`)
29
29
  - 状态条与字幕默认开启;两项都关掉即上图的「全部收进按钮」形态,此时录音计时显示在按钮下方、提示文字显示在按钮旁
30
30
 
31
31
 
32
- > **当前状态(2026-11-21)**:v0.7.40 新增 7 家在线 TTS 预设与逐预设密钥、小米 MiMo 朗读引擎、纠错词表可视化管理,并完成设置面板四分段重塑与触屏菜单、切页定稿、字幕回看等体验升级;可安装版本以 npm 徽章与 Releases 为准。
33
-
34
- 兼容跟进:最新 dsh 0.2.2-rc.5 的锚点、类型与隔离运行时复核通过(含客户端侧);完整证据和未验收层见[兼容契约](../../docs/compat-contract.md)。
32
+ > **当前状态**:支持 7 家在线 TTS 预设与逐预设独立密钥、小米 MiMo 语音合成、识别纠错词表可视化编辑、四分段设置面板,以及全模式键位提示(含 macOS 键帽本地化展示与 `220ms` 键盘按住说话)与跨平台兼容加固;可安装版本以 npm 徽章与 [Releases](https://github.com/qishuilalala/dsh-voice-mode/releases) 为准。
35
33
  >
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`,未测版本不保证。
34
+ > **兼容与验证边界**:最新 `dsh 0.2.2-rc.5` 的客户端注入锚点、双端类型检查与隔离运行态验证均已通过;完整版本矩阵、跨平台支持表与未覆盖边界见[兼容契约](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/compat-contract.md)。CI 通过不替代真实麦克风听感与全硬件验收;详见 [CHANGELOG](https://github.com/qishuilalala/dsh-voice-mode/blob/main/CHANGELOG.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
35
 
38
36
 
39
37
  ---
@@ -47,7 +45,7 @@ dsh ≥0.1.7 上按钮挂在发送键左侧(`conversation.input.activity`)
47
45
  - 本地 Kokoro(**中英混读**,103 音色;`int8` 默认约 109MB / 可选 `fp32` 约 311MB 的较大模型),经 `sherpa-onnx-node` **原生 addon** 运行(原生运行时,实际资源占用与稳定性需按设备验证);
48
46
  - Edge 云端为默认朗读引擎,也可在设置中重新选择(设置 `ttsEngine: edge`);设置面板「朗读引擎」热切换。
49
47
  - **Kokoro 音色全量 103 个**(F0 实测标定性别),四个常用男声置顶带编号;音色面板用 **下拉列表 + ◀▶ 步进**切换;
50
- - **增量传输**:partial 只传新增 0.9 秒,长段按住说话松手**秒出定稿**(不再整段重传重解码);
48
+ - **增量传输**:partial 只传新增 0.9 秒,长段按住说话松手后**快速完成定稿**(不再整段重传重解码);
51
49
  - **交互增强**:输入框旁**模式切换按钮**(持续聆听 ⇄ 按住说话,保存到设置);按住说模式下**按住才录、不按住不打断**;
52
50
  - **长段支持**:持续聆听连续多段自动拼成一条消息(内部按 30s 分块识别,跨块累积拼接),静音断句默认 1500 毫秒;按住说停顿不断句;
53
51
  - **朗读稳定性**:打断即终止在途合成释放 CPU;合成不阻塞宿主主线程,句间等待取决于模型与硬件;长朗读不触发空闲下线;
@@ -59,11 +57,11 @@ dsh ≥0.1.7 上按钮挂在发送键左侧(`conversation.input.activity`)
59
57
 
60
58
  ## ✨ 功能
61
59
 
62
- - **语音模式**:输入框工具排麦克风按钮或全局快捷键 `Ctrl+Shift+V` 进入/退出;光标在输入框里时还可按 `Alt+Enter`(Mac 为 `Option+Enter`)切换(不插入换行);全局单活(同一时刻仅一个会话处于语音模式,切换会话自动让出)
63
- - **三种交互模式(右键麦克风或设置可切换,切换即持久化)**:
64
- - `toggle`(默认)持续聆听:RMS VAD 分段 → zipformer2 流式识别(边说边出字,实时字幕预览)→ 静音约 1500 毫秒断句进草稿,连续多段拼成一条消息,再静音约 1.2 秒(合计约 2.7 秒)自动发送;按住 `Ctrl` 强制立即发送
65
- - `hold` 按住说话:空闲时**直接按住麦克风按钮就开始录音、松手即发**(不必先点一下进入;短按仍是进入/退出);发出后等回复结束(开朗读则读完)自动退出语音模式;关闭自动发送时松手只把文字留在输入框、不发送并直接退出;按住时没说话约 25 秒后兜底退出;滑出取消、`Esc`/失焦放弃本段;按住期间停顿不断句(上限 10 分钟);`Ctrl` 按住即录、松开即发
66
- - `once` 说完就关:像 `toggle` 一样说一段,发出后关麦,等回复自然朗读完自动退出语音模式;长按麦克风或按 Ctrl 打断后恢复收音、留在语音模式,下一轮自然读完再退出(关闭自动发送时:说完这一段即退出,文字留在草稿)
60
+ - **语音模式**:输入框工具栏麦克风按钮或全局快捷键 `Ctrl+Shift+V`(macOS 为 `⌃ Control + ⇧ Shift + V`)进入/退出;光标在输入框里时还可按 `Alt+Enter`(macOS 为 `⌥ Option + Return`)切换(不插入换行);全局单活(同一时刻仅一个会话处于语音模式,切换会话自动让出)
61
+ - **三种交互模式(右键麦克风、触屏 `⋯` 菜单或设置页可切换,切换即持久化)**:
62
+ - `toggle`(默认)持续聆听:RMS VAD 分段 → zipformer2 流式识别(边说边出字,实时字幕预览)→ 静音约 1500 毫秒断句进草稿,连续多段拼成一条消息,再静音约 1.2 秒(合计约 2.7 秒)自动发送;说话时按住 `Ctrl`(macOS 为 `⌃ Control`)强制立即发送
63
+ - `hold` 按住说话:空闲时**直接按住麦克风按钮就开始录音、松手即发**(不必先点一下进入;短按仍是进入/退出);已进入语音模式时也可**长按键盘 `Ctrl`(macOS 为 `⌃ Control`,约 0.22 秒起录,注意不是 `⌘ Command`)** 说话、松开即发;发出后等本轮回复结束(开朗读则读完)自动退出语音模式;关闭自动发送时松手只把文字留在输入框、不发送并直接退出;按住时没说话约 25 秒后兜底退出;上滑取消、`Esc`/失焦/组合按其他键自动放弃本段;按住期间停顿不断句(单次上限约 95 秒音频)
64
+ - `once` 说完就关:像 `toggle` 一样说一段,发出后关麦,等回复自然朗读完自动退出语音模式;长按麦克风或按 `Ctrl`(macOS `⌃ Control`)打断后恢复收音、留在语音模式,下一轮自然读完再退出(关闭自动发送时:说完这一段即退出,文字留在草稿)
67
65
  - **朗读范围**(`readAloud`):`voice`(默认)只朗读语音模式下的回复;`always` 当前可见会话的所有回复都朗读(含打字发的;同一会话开多个标签页只在最后看的那个上播;切换会话立即停下原会话朗读,待播内容一并作废);`off` 从不朗读
68
66
  - **唤醒词(可选,默认关)**:设置 `wakeWord` 后进入待机态,说出唤醒词才开始识别(如「你好小D」)。**可直接与命令连说**(「你好小D,帮我查天气」)——唤醒词会在定稿/字幕里自动剥掉、不进消息;匹配带容错(同音字替换「小莫→小墨」、首字错、前置语气词「呃/喂/我说」),建议 3-4 字;待机态状态条实时显示「说『x』开始 · 它听到的转写」,唤醒成败可自查。边界(重要):**仅 `toggle` 模式生效**(`hold` / 手动打断下唤醒词静默失效);**说完整一句后回到待机态需重说唤醒词**(只喊唤醒词、还没说命令时保持聆听,可停顿想好再说);**朗读期说唤醒词不触发**(打断由 VAD 开口即触发,与唤醒词无关)
69
67
  - **字幕档位**:`captionFontSize` 4 档(0=12px / 1=14px / 2=18px / 3=24px)+ `captionMaxWidth` 3 档(0=50vw / 1=70vw / 2=90vw),窄屏自适应
@@ -94,19 +92,18 @@ dsh plugin --profile web add dsh-voice-mode
94
92
 
95
93
  ---
96
94
 
97
- ## ⌨️ 操作手势
95
+ ## ⌨️ 操作手势与快捷键
98
96
 
99
- | 手势 | 作用 |
100
- | --- | --- |
101
- | `Ctrl+Shift+V` | 进入 / 退出语音模式(应用内) |
102
- | 输入框内 `Alt+Enter`(Mac 为 `Option+Enter`) | 光标在输入框里时进入 / 退出语音模式,不插入换行;长按不重复切换;设置卡片自己的输入框不拦截;`Cmd/Ctrl+Enter` 不占用(宿主用来发送) |
103
- | 直接说话 | `toggle`:边说边出字,停顿约 1500 毫秒断句进草稿、再静音约 1.2 秒(合计约 2.7 秒)自动发送;按住 `Ctrl` 强制立即发送 |
104
- | 按住麦克风按钮 | `hold`:空闲时直接按住即开始录音,松手发送并在回复结束后自动退出;短按仍是进入 / 退出;滑出 / `Esc` / 失焦放弃本段;右键只开快捷菜单 |
105
- | 点输入框旁模式按钮 | 在「持续聆听 ⇄ 按住说」间切换(保存到设置) |
106
- | 说唤醒词 | 待机态激活识别(配置后) |
107
- | AI 朗读时开口说话 | 打断朗读并取消当前回合 |
108
- | 点状态条「退出」 | 退出语音模式 |
109
- | 点字幕浮层「跳过」 | 跳过当前句朗读 |
97
+ | 场景 / 手势 | Windows / Linux | macOS | 作用说明 |
98
+ | --- | --- | --- | --- |
99
+ | 进入 / 退出语音模式 | `Ctrl+Shift+V` | `⌃ Control + ⇧ Shift + V` | 应用内切换(注意 macOS 默认是 `Control` 而非 `⌘ Command`;可在设置页点「录制」修改或留空停用) |
100
+ | 输入框内快速切换 | `Alt+Enter` | `⌥ Option + Return` | 光标在聊天输入框里时进入 / 退出语音模式,不插入换行;长按不重复切换;不占用 `Ctrl/⌘ + Enter` 发送键 |
101
+ | 持续聆听(`toggle`) | 直接说话;按住 `Ctrl` 立即发 | 直接说话;按住 `⌃ Control` 立即发 | 边说边出字,停顿约 1500ms 断句进草稿、再静音约 1.2 秒自动发送;说话时按住 `Ctrl` / `⌃ Control` ≥250ms 松开可立即发送 |
102
+ | 按住说话(`hold`)鼠标/触屏 | 按住麦克风按钮 | 按住麦克风按钮 | 未进入语音模式时**直接按住麦克风按钮即开始收音**,松手发送并在本轮回复结束后自动退出;短按仍是进入 / 退出;上滑或按 `Esc` 放弃本段 |
103
+ | 按住说话(`hold`)键盘 | 进入后长按 `Ctrl`(≥220ms) | 进入后长按 `⌃ Control`(≥220ms) | 已处于语音模式时按住 `Ctrl` / `⌃ Control` 说话、松开即发;按 `Esc`、切走窗口或组合按其他键会自动取消本段 |
104
+ | 手动打断 / 停止朗读 | 开口说话 / 按住 `Ctrl` / `Esc` | 开口说话 / 按住 `⌃ Control` / `Esc` | 自动打断下开口即停;手动打断(`manual`)下朗读期按住麦克风或 `Ctrl` / `⌃ Control` 打断;按一次 `Esc` 停播,连按两次 `Esc` 退出语音模式 |
105
+ | 快捷菜单 | 右键点击麦克风按钮(或菜单键) | 右键 / 双指点按麦克风按钮 | 触屏端可点麦克风旁 `⋯` 按钮(或空闲非按住态长按 450ms),快速切换交互模式、朗读范围、字幕、状态条与自动发送 |
106
+ | 跳过单句 / 退出 | 点字幕「跳过本句」/ 状态条「退出」 | 点字幕「跳过本句」/ 状态条「退出」 | 「跳过本句」仅跳过当前正在播的一句,不中断后续句子 |
110
107
 
111
108
  ---
112
109
 
@@ -126,7 +123,7 @@ dsh plugin --profile web add dsh-voice-mode
126
123
  | `voice` | 按引擎 | 音色:VITS 五说话人;Kokoro 103 个(下拉+◀▶,62 深沉/68 浑厚/75 清亮/76 磁性置顶);Edge 进入时自动加载全量 322 个。行内「试听」可即时预览 |
127
124
  | `rate` | `1.1` | 朗读语速倍率(0.5 慢速 ~ 2.0 快速),**即时生效** |
128
125
  | `interruptLevel` | `0` | 发声打断灵敏度(服务端 VAD 帧级检测 + 回声门控):0 高门槛(3 帧)/ 1 中(2 帧)/ 2 低(1 帧) |
129
- | `bargeInMode` | `detect` | 打断方式:`detect` 自动探测本机原生回声消除状态(默认;未生效时朗读期切为长按打断)/ `auto` 强制开口即打断(耳机、安静环境推荐)/ `manual` 手动打断(外放推荐:空闲时可直接说话或说唤醒词,AI 朗读中按住麦克风/Ctrl 打断)。批 7O 默认,I10 豁免(ADR-0006) |
126
+ | `bargeInMode` | `detect` | 打断方式:`detect` 自动探测本机原生回声消除状态(默认;未生效时朗读期切为长按打断)/ `auto` 强制开口即打断(耳机、安静环境推荐)/ `manual` 手动打断(外放推荐:空闲时可直接说话或说唤醒词,AI 朗读中按住麦克风/`Ctrl` 打断;参见 ADR-0006) |
130
127
  | `echoGateDb` | `6` | 无原生 AEC 时的回声门兜底阈值;原生 AEC 有效时不参与。仅在兜底路径中,增大更保守、减小更易触发;先确认设备与打断模式 |
131
128
  | `silenceMs` | `1500` | 说完整一句的静音停顿毫秒数 |
132
129
  | `idleTimeoutMinutes` | `5` | 无活动自动退出语音模式的分钟数(朗读计为活动) |
@@ -147,15 +144,15 @@ dsh plugin --profile web add dsh-voice-mode
147
144
  | `openaiBaseUrl` | 空(跟随预设/配置文件) | 在线 TTS 端点:**设置卡片里直接填**(无需改 profile YAML);优先级 设置 > 预设 > `openaiTts.baseUrl`;配合「自定义」可接任意 OpenAI 兼容平台;**即时生效** |
148
145
  | `openaiModel` | 空 | 在线 TTS 模型名覆盖(同上优先级);预设没列出的平台选「自定义」后填这里 |
149
146
  | `openaiApiKey` | 空(回落配置文件) | 在线 TTS 的 key:卡片里填,存宿主 0600 设置文件,**永不回传浏览器**;优先级 面板按预设key > 设置全局key > `openaiTts.apiKeys[预设id]` > `openaiTts.apiKey`;卡片「清除」显式清空;**即时生效** |
150
- | `openaiApiKeys` | `{}`(全未配) | Q2 Key 跟预设走:面板按预设 id 存的 key 表;选中哪个预设用哪把,切预设不再 401;空条目回落全局 key;**只回布尔表、不回传明文**;**即时生效**(保存刷新即用新 key) |
147
+ | `openaiApiKeys` | `{}`(全未配) | 按预设独立保存的密钥表:面板按预设 id 分别存 key,选中哪个预设自动使用对应密钥,切换预设不再因串用密钥报 401;空条目回落全局 key;**接口只返回是否已配置布尔表、永不回传明文**;**即时生效** |
151
148
  | `mimoApiKey` | 空(回落配置文件) | 小米 MiMo 的 key(走 `api-key` 头):卡片里填,同样只存宿主、不回传;留空回落 `mimoTts.apiKey` |
152
149
  | `asrReplacements` | `[]` | 纠错词表 `[{from:[听错写法],to:想要写法}]`(≤200 条 / ≤12KB UTF-8):转写后统一改写(中间结果+定稿);卡片显示「本次生效以来」命中次数;与 LLM 纠错串联;**即时生效** |
153
150
  | `senseVoice` | `true` | 定稿是否用 SenseVoice 重译(带标点 + 数字归一化,更准;默认开)。**关闭可省 ~228MB 模型**,只走流式识别(更快、精度下降) |
154
151
  | `captionFontSize` | `0` | 字幕字号档位 0=12px / 1=14px / 2=18px / 3=24px(默认 0 与现状字节等价) |
155
152
  | `captionMaxWidth` | `1` | 字幕宽度档位 0=50vw / 1=70vw / 2=90vw(视口 <686px 窄于 480px,≈686px 接近 480px,>686px 宽于 480px) |
156
153
  | `backchannelYield` | `true` | 让位语义(ADR-0008);朗读期说「嗯/对」自动让位 1.5s + 真要说走硬打断;关 = 行为等同改造前 |
157
- | `bargeInSalvage` | `true` | 打断语音抢救(Issue #15 批 1 / ADR-0012):AI 朗读时你开口打断,自动保留从开口到打断生效之间你说的话,并入识别继续发送(修「打断吃句」;关 = 丢弃打断前语音——仅外放且无回声消除的环境建议关) |
158
- | `llmCorrect` | `false` | LLM 纠错(Issue #15 批 4,默认关):发送前用大模型对整条语音文本做一次纠错(只改错别字/同音字/标点,保持原意;复用宿主已配置模型。开 = 每条消息多一次约 1 秒的纠错等待;纠错失败自动用原文;模型改成回答你而非纠错时同样回退原文) |
154
+ | `bargeInSalvage` | `true` | 打断语音抢救(ADR-0012):AI 朗读时你开口打断,自动保留从开口到打断生效之间你说的话,并入识别继续发送(避免打断瞬间吞字;关 = 丢弃打断前语音——仅外放且无回声消除的环境建议关) |
155
+ | `llmCorrect` | `false` | LLM 纠错(默认关):发送前用大模型对整条语音文本做一次纠错(只改错别字/同音字/标点,保持原意;复用宿主已配置模型。开 = 每条消息多一次约 1 秒的纠错等待;纠错失败自动用原文;模型改成回答你而非纠错时同样回退原文) |
159
156
  | `yieldMs` | `1500` | 让位窗口时长(ms,500-3000):`backchannelYield` 命中后 TTS 丢帧持续时长;窗口内用户真要说则由原 `hardBreak` 接管,窗口到点自动恢复播放 |
160
157
 
161
158
  生效时机分四档:① 即时——快捷键 / 输入框快捷键 / 交互模式 / 朗读范围 / 自动发送 / 字幕浮层 / 状态条 / 朗读引擎 / 音色 / 语速 / 口语化提示词(对后续回复生效)/ 模型镜像(下次下载尝试即生效);② 下次识别时——定稿重译(SenseVoice)/ 逆文本归一化;③ 下一段话——静音判定时长(断句端点;发送等待固定 1.2 秒不受影响);④ 下次进入语音模式——打断灵敏度 / 打断方式 / 回声门控 / 自动恢复 / 唤醒词 / 工具提示音 / 字幕字号 / 字幕宽度 / 短应答让位 / 让位窗口 / 打断语音抢救 / LLM 纠错 / 空闲时长。已保存但未生效的项会列在设置卡片顶部(含当前生效值)。设置项默认值由插件配置(`base` 层)提供。
@@ -273,30 +270,14 @@ dsh plugin --profile web add dsh-voice-mode
273
270
  MiMo **没有 `speed` 字段**:`rate` 不为 1 时会译成自然语言风格指令(「语速加快到约 1.2 倍」)随请求下发。失败/超时同样进入 30 秒冷却并回退本地,打断(barge-in)不记为失败。官方文档:<https://mimo.mi.com>。
274
271
 
275
272
 
276
- **真实链路实测(2026-11-19,真 key)**:
277
-
278
- - 鉴权头是 `api-key: sk-…`(官方 curl 示例口径,非 `Authorization: Bearer`);key 从控制台「API Keys」创建。
279
- - 可用模型 `mimo-v2.5-tts`(V2.5-TTS 系列未随 V2.5-Pro 下线)。
280
- - 返回为 base64,解码后是 **WAV:单声道 / 24kHz / 16bit**;实测约 30 字一句话得 5.8s 音频,合成耗时 2~5s。
281
- - **请求 `audio.format: mp3` 时服务端仍返回 WAV**(200 OK)。引擎按响应字节嗅探容器格式(`sniffAudioMime`),不信配置值,避免把 WAV 当 MP3 解码而播不出声。
282
- - 401 错误体是 JSON(`type: invalid_key`),错误消息经脱敏后才进日志。
283
- - 预置音色实测可用:`mimo_default`(中国集群落「冰糖」)、`冰糖`、`苏打`、`茉莉`、`白桦`、`Mia`、`Chloe`、`Milo`、`Dean`。
284
- ### 纠正听错的词(`asrReplacements`)
285
- ### 宿主级端到端验证(2026-11-19,隔离 profile)
273
+ **接入与协议说明**:
286
274
 
287
- 在 `/tmp` 下新建独立 `DSH_HOME` + `mt` profile(`dsh plugin --profile mt add <本地插件目录>` 装成本地 link),patch 用 `!!js process.env.MIMO_API_KEY` 引用 `.env` 里的真 key,`--port 3098` 起独立实例(不碰 3018):
275
+ - 鉴权请求头为 `api-key: sk-…`(非 `Authorization: Bearer`),密钥可在 MiMo 控制台创建。
276
+ - 可用模型为 `mimo-v2.5-tts`;预置音色包括 `mimo_default`、`冰糖`、`苏打`、`茉莉`、`白桦`、`Mia`、`Chloe`、`Milo`、`Dean`。
277
+ - 服务端实际返回单声道 24kHz 16bit WAV 音频(即使请求 `mp3` 也可能返回 WAV),插件会按响应头字节自动嗅探真实音频格式(`sniffAudioMime`),确保浏览器正常解码播放。
278
+ - 鉴权或接口报错消息均经过密钥脱敏后再记入宿主日志。
288
279
 
289
- | 验证点 | 结果 |
290
- |---|---|
291
- | 组合配置 | `--dump-config` 显示 `id: voice-mode` 段被 patch 覆盖,条目 id 是 `voice-mode`(`dsh-voice-mode` 是 name) |
292
- | 引擎选择 | `GET /voice-mode/config` → `ttsEngine: mimo`;`GET /voice-mode/models/status` → `tts: {engine: mimo, ready: true}` |
293
- | 真实合成 | `POST /voice-mode/preview {voice: mimo_default}` → **HTTP 200 / content-type: audio/wav / 199,724 B / WAV 24kHz 单声道 16bit / 4.16s / RMS 3561(有声)** |
294
- | MIME 修正生效 | `/config` 的 `audioMime: audio/wav`(嗅探结果,而非配置里的 wav 巧合) |
295
- | 路由无泄漏 | `GET /voice-mode/presets` 只含 baseUrl/model/voice 三字段(ADR-0013 边界,线上实证) |
296
-
297
- 验证后已 `kill` 实例并删除临时 `DSH_HOME` 与 `mimotest` profile,端口 3098/3099 已释放。
298
-
299
- **仍未做(需人)**:把正在跑的 web profile(3018)从 npm 0.7.35 换成本地构建并重启服务——重启会断开当前页面连接,需你决定时机。
280
+ ### 纠正听错的词(`asrReplacements`)
300
281
 
301
282
 
302
283
  识别器会把中文里夹的人名、英文词听错(例如「Sakina」听成「ski男」)。常规办法热词在这里用不上:sherpa-onnx 只有 transducer 模型支持热词,流式 zipformer 以汉字为单位、写不出英文词,出定稿的 SenseVoice 又没有热词入口。在有热词能力的模型能覆盖之前,替换表是权宜办法:识别之后改写文本,中间结果和定稿都改,所以字幕、草稿和唤醒词看到的都是改好的文本。
@@ -361,6 +342,8 @@ flowchart LR
361
342
  Edge[Edge 云端]
362
343
  Vits[本地 VITS WASM]
363
344
  Kokoro[本地 Kokoro<br/>原生 addon]
345
+ OpenAI[OpenAI 兼容端点]
346
+ MiMo[小米 MiMo 语音]
364
347
  end
365
348
 
366
349
  UI -->|audio f32 PCM<br/>POST /voice-mode/asr| ASR
@@ -373,17 +356,21 @@ flowchart LR
373
356
  TTS -->|edge| Edge
374
357
  TTS -->|vits| Vits
375
358
  TTS -->|kokoro| Kokoro
359
+ TTS -->|openai| OpenAI
360
+ TTS -->|mimo| MiMo
376
361
  Edge -.->|SSE audio frame| UI
377
362
  Vits -.->|SSE audio frame| UI
378
363
  Kokoro -.->|SSE audio frame| UI
364
+ OpenAI -.->|SSE audio frame| UI
365
+ MiMo -.->|SSE audio frame| UI
379
366
  VAD -.->|唤醒词/打断| Q
380
367
  ```
381
368
 
382
369
  - 识别在 **host 端本地运行**(zipformer2 中文 int8 WASM + SenseVoice 定稿,模型懒下载),音频不上传第三方;识别定稿由 SenseVoice 补标点;
383
- - 朗读默认 **Edge 云端**;本地 VITS 纯中文 / Kokoro 原生中英(跑在独立子进程、崩溃自愈)可选(隐私优先);
370
+ - 朗读默认 **Edge 云端**;可选离线本地引擎 VITS(纯中文)/ Kokoro(原生中英混读,跑在独立子进程、按需隔离加载原生模块),也可配置自备密钥的 OpenAI 兼容端点或小米 MiMo(失败自动回退本地);
384
371
  - 同一时间仅一个会话处于语音模式(全局单活);LLM 流被无损观察(不阻塞)。
385
372
 
386
- 详细架构决策:见 [`docs/adr/`](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/adr/README.md) 12 个 ADR。
373
+ 详细架构决策:见 [`docs/adr/`](https://github.com/qishuilalala/dsh-voice-mode/blob/main/docs/adr/README.md) 15 个 ADR。
387
374
 
388
375
  ---
389
376
 
@@ -393,7 +380,7 @@ flowchart LR
393
380
  | --- | --- | --- |
394
381
  | 识别模型 | 云端 API(需 key) | **本地 zipformer2 + SenseVoice**(零 key) |
395
382
  | 多语种 | 英文为主 | **SenseVoice 自动识别(zh/en/ja/ko/yue)+ ITN** |
396
- | 朗读引擎 | 云端 TTS | **Edge 云端 + 本地 VITS/Kokoro** 三选一 |
383
+ | 朗读引擎 | 云端 TTS | **Edge 云端 + 本地 VITS/Kokoro + OpenAI 兼容 / 小米 MiMo** 五类可选 |
397
384
  | 打断检测 | 基础 VAD | **三档灵敏度 + 回声门控 + 让位语义** |
398
385
  | 字幕 a11y | 无 | **4 档字号 + 3 档宽度 + 主题跟随** |
399
386
  | 唤醒词 | 无 | **轻量流式匹配 + 前缀语气词白名单** |
@@ -407,8 +394,8 @@ flowchart LR
407
394
 
408
395
  | 类别 | 具体行为 | 数据去向 |
409
396
  | --- | --- | --- |
410
- | **network** | Edge 将待朗读文本发往微软在线服务;`ttsEngine: openai` 时将待朗读文本发往配置的 `openaiTts.baseUrl`(不发往别处);本地模型从官方源或配置镜像下载,主要模型及清单内支持文件做摘要校验,辅助目录用清单/存在性检查;插件在宿主注册 `/voice-mode/*` 路由 | 浏览器音频发送到所连接的 dsh 宿主识别,不使用独立云 ASR;提交文本及可选 LLM 纠错遵循宿主配置。切换本地 TTS 不会让宿主 LLM 自动离线 |
411
- | **fs-read / fs-write** | 模型缓存(Linux/macOS `~/.cache/dsh-voice-mode/models/`,Windows `%LOCALAPPDATA%\dsh-voice-mode\models\`);dsh 0.1.7+ 的设置覆盖层 `$DSH_HOME/voice-mode.settings.json`;**不读写你的工作区文件** | 全部在本机 |
397
+ | **network** | `ttsEngine: edge` 将待朗读文本发往微软在线服务;`ttsEngine: openai` 将待朗读文本发往配置的预设或 `openaiBaseUrl` / `openaiTts.baseUrl`;`ttsEngine: mimo` 将待朗读文本发往 `mimoTts.baseUrl`(默认 `https://api.xiaomimimo.com/v1`);本地 VITS / Kokoro 下载完成后在宿主本机离线合成;本地模型首次从官方源或配置镜像下载并校验主文件 SHA256;插件在宿主注册 `/voice-mode/*` 路由 | 浏览器音频仅发送到所连接的 dsh 宿主识别,不使用独立云 ASR;提交文本及可选 `llmCorrect` 纠错遵循宿主已配置的大模型。切换本地 TTS 不会让宿主大模型自动离线 |
398
+ | **fs-read / fs-write** | 模型缓存(Linux/macOS `~/.cache/dsh-voice-mode/models/`,Windows `%LOCALAPPDATA%\dsh-voice-mode\models\`);dsh 0.1.7+ 的设置覆盖层 `$DSH_HOME/voice-mode.settings.json`(权限 `0600`,API 密钥只写宿主侧、永不回传浏览器);**不读写你的工作区文件** | 全部在本机 |
412
399
  | **shell(子进程)** | 本地 TTS 合成跑在独立子进程(`child_process.fork` → `lib/tts-vits-worker.cjs`);宿主为 Electron(官方桌面端)时,为 Kokoro 额外探测并启动一个真正的 Node.js(`node -p …` 探测版本,见 ADR/兼容契约)。**不执行用户输入、不经 shell 拼接命令** | 本机 |
413
400
  | **env** | 使用目录和运行时定位相关环境设置,如 `DSH_HOME`、`LOCALAPPDATA`、`PATH` 和可选 `DSHVM_NODE`;默认语音路径无需额外语音服务密钥 | 宿主 LLM 的配置和费用另计 |
414
401
 
@@ -456,8 +443,8 @@ flowchart LR
456
443
  | 识别到但不是我要说的 | 环境噪声或唤醒词误判:减少噪声并对比实时转写和定稿;`interruptLevel` 只影响打断,不提高识别准确率 |
457
444
  | 唤醒词唤不醒 | 先看待机态状态条的实时转写(它听到了什么):同音字 1 字内已自动容错;停顿约 1.5 秒(= 静音断句时长)再说,清掉待机段残留语音、从段首重新匹配;换一个转写稳定的词(建议 3-4 字) |
458
445
  | 打断后说话没反应(开了唤醒词) | 唤醒词只管「开始识别」的门:打断/每句断句后回到待机态,**需重说唤醒词**再继续说;待机态状态条会显示「说『x』开始」提示 |
459
- | 唤醒词完全没反应 | ① 确认交互模式是 `toggle`(`hold` 与手动打断下唤醒词不生效);② 确认 `bargeInMode`:`manual`(或 `detect` 在本机无原生回声消除时自动落 manual)会关闭常驻聆听 → 唤醒词失效,改回 `auto` 或按住麦克风/Ctrl;③ 朗读期说唤醒词不触发(先等 AI 说完);④ 看待机态实时转写,确认它听到了什么(同音字 1 字内已容错,建议 3-4 字词) |
460
- | 按住说话松手后没反应 | 确认交互模式为「按住说」且按住期间按钮高亮;松手后识别定稿约 1 秒内进入草稿 |
446
+ | 唤醒词完全没反应 | ① 确认交互模式是 `toggle`(`hold` 按住说话模式下唤醒词不生效;`manual` 手动打断与 `detect` 回落 `manual` 时空闲期唤醒词照常生效);② 朗读期说唤醒词不触发(朗读期打断只看 VAD 或手动长按);③ 看待机态状态条实时转写,确认识别到的字词(同音字 1 字内已容错,建议设置 3–4 字唤醒词) |
447
+ | 按住说话不知道按哪个键 / 松手后没反应 | 可直接**按住麦克风按钮**说话;用键盘时须先进入语音模式,再长按 **`Ctrl`(macOS 为 `⌃ Control`,注意不是 `⌘ Command`)** ≥0.22 秒,状态条提示「正在收音,松开发送」后再说话,松手约 1 秒内定稿进草稿 |
461
448
  | 打不断(朗读中开口无反应) | 将 `interruptLevel` 向 2 调整(2 最敏感,0 高门槛),确认麦克风与回声消除;仍不可靠时用按住说话。原生 AEC 有效时 `echoGateDb` 不参与门控,无原生 AEC 时才是兜底参数 |
462
449
  | 官方桌面端上选本地 Kokoro,设置里显示「加载失败」并提示需要 Node.js | 桌面端宿主是 Electron,Kokoro 的原生 addon 在其中不可用:在系统 PATH 上安装 Node.js ≥18(或设环境变量 `DSHVM_NODE` 指向它)后重试;或改用默认的 Edge / 本地 VITS(桌面端不受影响) |
463
450
  | 字幕被输入框挡住 | 默认 `captionMaxWidth=1`(70vw)+ `captionFontSize=0`(12px)在窄屏可能与底部输入框重叠;调高档位或点字幕浮层「×」收起 |
package/SECURITY.md CHANGED
@@ -1,28 +1,32 @@
1
1
  # 安全策略 / Security Policy
2
2
 
3
- 本文件适用于 **npm 包 `dsh-voice-mode`**(源码在仓库的 `plugin/dsh-voice-mode/` 目录)。仓库级说明见 [仓库安全策略](https://github.com/qishuilalala/dsh-voice-mode/security/policy)。
3
+ 本文件适用于 **npm 包 dsh-voice-mode**。完整仓库安全说明与历史扫描记录见 [仓库安全策略](https://github.com/qishuilalala/dsh-voice-mode/blob/main/SECURITY.md)。
4
4
 
5
5
  ## 支持的版本 / Supported versions
6
6
 
7
- 仅**最新发布版本**接受安全修复。`0.7.17` 及更早版本存在已知的安装/加载缺陷(见 CHANGELOG 0.7.18),已在 npm 标记为 deprecated,请升级到最新版本。
7
+ 仅**最新发布版本**接受安全修复。0.7.17 及更早版本存在已知的安装/加载缺陷,已在 npm 标记为 deprecated,请升级到最新版本。
8
8
 
9
- ## 权限与数据流
9
+ ## 权限、密钥与数据流 / Permissions, secrets & data flow
10
10
 
11
- - **麦克风**:仅在用户主动进入语音模式后申请录音权限;退出即释放。
12
- - **网络**:默认使用 Edge 云端朗读(微软在线服务);可切换为本地 VITS / Kokoro,完成模型下载后可在本机合成;宿主的 LLM 请求仍遵循其自身网络配置。
13
- - **本地推理**:浏览器音频发送到所连接的 dsh 宿主,由 zipformer2 流式识别与 SenseVoice 定稿;不使用独立云 ASR。宿主部署在远端时,音频会离开浏览器所在设备。
14
- - **模型下载**:主要识别模型合计约 390MB;选择本地朗读时还需额外下载相应模型。实际资源与下载状态见设置,完整缓存后可在宿主端推理。
15
- - **数据去向**:插件不向独立遥测服务上传录音或转写;转写发送后进入宿主对话,默认 Edge 朗读会向微软发送待朗读文本;「复制诊断信息」只含版本、运行状态、设置快照与各阶段耗时。
11
+ - **麦克风**:仅在用户主动进入语音模式后申请浏览器录音权限;退出语音模式、切换标签页或会话时释放麦克风。
12
+ - **语音识别(宿主本地)**:浏览器采集的音频仅发送到所连接的 DeepSeek Harness 宿主,在宿主端本地完成流式识别(zipformer2)与定稿重译(SenseVoice),不使用第三方云端 ASR。若宿主部署在远端服务器,音频会传输至该宿主服务器。
13
+ - **语音合成(按所选引擎)**:
14
+ - 默认 `edge` 将待朗读文本发往微软在线朗读服务;
15
+ - `openai` 将待朗读文本发往用户选定的在线预设或自定义接口地址;
16
+ - `mimo` 将待朗读文本发往小米 MiMo 接口(默认 `https://api.xiaomimimo.com/v1`);
17
+ - 本地 `vits` 与 `kokoro` 在模型下载完成后完全在宿主本机离线合成,不向外部发送待朗读文本。
18
+ - **密钥隔离与保护**:在设置面板填写的在线 TTS 密钥(OpenAI 兼容密钥、逐预设密钥表、小米 MiMo 密钥)仅以 `0600` 权限保存在宿主侧设置文件;读取接口只返回「是否已配置」的布尔值,永不向浏览器回传明文;远程合成请求禁用重定向并拒绝内嵌凭据的地址,宿主日志输出前自动对敏感令牌脱敏。
19
+ - **模型下载与诊断**:首次使用识别或本地合成时从 Hugging Face(或配置的镜像源)下载模型并校验主文件 SHA256 摘要;插件不上传遥测数据,「复制诊断」按钮仅包含版本号、运行状态、非敏感设置快照与阶段耗时,不含任何转写文本或密钥。宿主对话大模型及可选发送前纠错遵循宿主自身的模型与网络配置。
16
20
 
17
- ## 报告漏洞
21
+ ## 报告漏洞 / Reporting a vulnerability
18
22
 
19
- 请优先使用 GitHub 私密漏洞报告(Security → Report a vulnerability):https://github.com/qishuilalala/dsh-voice-mode/security/advisories/new
20
- (若该入口不可用,可在仓库开 issue 描述问题,但请勿在公开 issue 中放可利用细节。)
23
+ 请**不要**在公开 Issue 或讨论区披露可利用的漏洞细节。请通过 GitHub 私密漏洞报告入口提交:
21
24
 
22
- 我们会在 7 天内给出初步回应,修复发布走 patch 版本并在 CHANGELOG 与 Release 说明中标注。
25
+ - https://github.com/qishuilalala/dsh-voice-mode/security/advisories/new
23
26
 
24
- ## 依赖与供应链
27
+ 维护者会在收到报告后尽快确认并反馈修复计划;修复版本发布后将在变更日志与 Release 说明中同步披露。
25
28
 
26
- - 发布包内联的第三方代码(`msedge-tts` 及其传递依赖)版本在 `THIRD_PARTY_NOTICES.md` 中逐项列出,与 `pnpm-lock.yaml` 解析版本一致(由 `scripts/check-notices-versions.mjs` 机械校验)。
27
- - 仓库启用 Dependabot 维护依赖,并按 SHA 钉住的扫描器工作流做持续安全检查(`.github/workflows/hol-scanner.yml`)。
28
- - 0.7.33 已消除历史扫描命中;扫描通过不等于不存在漏洞。历史成因与处置见仓库安全策略。
29
+ ## 依赖与供应链 / Supply chain
30
+
31
+ - 发布包内联的第三方代码版本在 [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md) 中逐项列出,并由 CI 门禁校验与锁文件解析版本一致。
32
+ - 仓库启用 Dependabot 依赖监控与持续安全扫描工作流;自动化扫描通过不能替代人工安全审查,也不构成无漏洞承诺。
package/lib/client.js CHANGED
@@ -1996,17 +1996,28 @@ var zh = {
1996
1996
  ariaActive: "\u8BED\u97F3\u6A21\u5F0F\u8FDB\u884C\u4E2D",
1997
1997
  ariaEnter: "\u8FDB\u5165\u8BED\u97F3\u5BF9\u8BDD\u6A21\u5F0F",
1998
1998
  ariaPendingCancelHint: "\u518D\u6309\u4E00\u6B21\u53D6\u6D88",
1999
- titleHold: "\u8BED\u97F3\u6A21\u5F0F\u8FDB\u884C\u4E2D \xB7 \u6309\u4F4F\u8BF4\u8BDD\u3001\u677E\u624B\u53D1\u9001\uFF1B\u77ED\u6309\u9000\u51FA\uFF1BEsc/\u5931\u53BB\u7126\u70B9\u653E\u5F03\uFF1BCtrl+Shift+V \u9000\u51FA",
2000
- titleToggle: "\u8BED\u97F3\u6A21\u5F0F\u8FDB\u884C\u4E2D \xB7 \u70B9\u51FB\u9000\u51FA\uFF08Ctrl+Shift+V\uFF09\xB7 \u8BF4\u8BDD\u65F6\u6309\u4F4F Ctrl \u7ACB\u5373\u53D1\u9001",
2001
- titleEnter: "\u8FDB\u5165\u8BED\u97F3\u5BF9\u8BDD\u6A21\u5F0F\uFF08Ctrl+Shift+V\uFF09",
1999
+ titleHold: "\u6309\u4F4F\u8BF4\u8BDD\u6A21\u5F0F \xB7 \u6309\u4F4F\u9EA6\u514B\u98CE\u6216\u957F\u6309 Ctrl \u8BF4\u8BDD\uFF0C\u677E\u5F00\u53D1\u9001\uFF1BEsc \u653E\u5F03\u672C\u53E5\uFF0C\u53CC\u51FB Esc \u9000\u51FA",
2000
+ titleHoldMac: "\u6309\u4F4F\u8BF4\u8BDD\u6A21\u5F0F \xB7 \u6309\u4F4F\u9EA6\u514B\u98CE\u6216\u957F\u6309 \u2303 Control \u8BF4\u8BDD\uFF0C\u677E\u5F00\u53D1\u9001\uFF1BEsc \u653E\u5F03\u672C\u53E5\uFF0C\u53CC\u51FB Esc \u9000\u51FA",
2001
+ titleToggle: "\u6301\u7EED\u8046\u542C\u4E2D \xB7 \u8BF4\u8BDD\u65F6\u6309\u4F4F Ctrl \u677E\u5F00\u53EF\u7ACB\u5373\u53D1\u9001\uFF1B\u5355\u51FB Esc \u505C\u8BFB\uFF0C\u70B9\u51FB\u6216\u53CC\u51FB Esc \u9000\u51FA",
2002
+ titleToggleMac: "\u6301\u7EED\u8046\u542C\u4E2D \xB7 \u8BF4\u8BDD\u65F6\u6309\u4F4F \u2303 Control \u677E\u5F00\u53EF\u7ACB\u5373\u53D1\u9001\uFF1B\u5355\u51FB Esc \u505C\u8BFB\uFF0C\u70B9\u51FB\u6216\u53CC\u51FB Esc \u9000\u51FA",
2003
+ titleOnce: "\u8BF4\u5B8C\u5C31\u5173 \xB7 \u8BF4\u5B8C\u81EA\u52A8\u53D1\u9001\uFF0C\u56DE\u590D\u6717\u8BFB\u5B8C\u6BD5\u81EA\u52A8\u9000\u51FA\uFF1B\u5355\u51FB\u9EA6\u514B\u98CE\u6216\u53CC\u51FB Esc \u9000\u51FA",
2004
+ titleEnter: "\u8FDB\u5165\u8BED\u97F3\u5BF9\u8BDD\u6A21\u5F0F",
2005
+ titleEnterHold: "\u6309\u4F4F\u8BF4\u8BDD\uFF1A\u76F4\u63A5\u6309\u4F4F\u9EA6\u514B\u98CE\u5373\u53EF\u8BF4\u8BDD\uFF08\u677E\u624B\u53D1\u9001\uFF09\uFF0C\u6216\u6309\u5FEB\u6377\u952E\u8FDB\u5165\u8BED\u97F3\u6A21\u5F0F",
2006
+ titleShortcutSuffix: "\uFF08\u5FEB\u6377\u952E\uFF1A{keys}\uFF09",
2007
+ titleShortcutComposerSuffix: "\uFF08\u5FEB\u6377\u952E\uFF1A{keys}\uFF1B\u8F93\u5165\u6846\u5185\uFF1A{composerKeys}\uFF09",
2002
2008
  loadingModel: "\u6B63\u5728\u52A0\u8F7D\u6A21\u578B\u2026",
2003
2009
  listening: "\u8046\u542C\u4E2D\u2026",
2004
2010
  thinking: "\u601D\u8003\u4E2D\u2026",
2005
- barHold: "\u8BED\u97F3\u6A21\u5F0F \xB7 \u6309\u4F4F\u8BF4\u8BDD\uFF08\u77ED\u6309\u9000\u51FA\uFF09",
2011
+ barHold: "\u6309\u4F4F\u8BF4\u8BDD \xB7 \u6309\u4F4F\u9EA6\u514B\u98CE\u6309\u94AE\u6216\u957F\u6309 Ctrl \u8BF4\u8BDD\uFF0C\u677E\u5F00\u53D1\u9001\uFF08Esc \u53D6\u6D88\uFF09",
2012
+ barHoldMac: "\u6309\u4F4F\u8BF4\u8BDD \xB7 \u6309\u4F4F\u9EA6\u514B\u98CE\u6309\u94AE\u6216\u957F\u6309 \u2303 Control \u8BF4\u8BDD\uFF0C\u677E\u5F00\u53D1\u9001\uFF08Esc \u53D6\u6D88\uFF09",
2013
+ barHolding: "\u6B63\u5728\u6536\u97F3\uFF0C\u677E\u5F00\u53D1\u9001\uFF08\u4E0A\u6ED1\u6216\u6309 Esc \u53D6\u6D88\uFF09",
2014
+ barOnce: "\u8BF4\u5B8C\u5C31\u5173 \xB7 \u76F4\u63A5\u8BF4\u51FA\u4E00\u53E5\uFF0C\u505C\u987F\u81EA\u52A8\u53D1\u9001\uFF0C\u8BFB\u5B8C\u81EA\u52A8\u9000\u51FA",
2006
2015
  barListening: "\u8BED\u97F3\u6A21\u5F0F \xB7 \u8046\u542C\u4E2D\u2026",
2007
2016
  wakeWord: "\u5524\u9192\u8BCD",
2008
2017
  sayWake: "\u8BF4\u300C{wake}\u300D\u5F00\u59CB",
2009
2018
  reading: "\u6717\u8BFB\u4E2D\u2026",
2019
+ readingManual: "\u6717\u8BFB\u4E2D \xB7 \u6309\u4F4F\u9EA6\u514B\u98CE\u6216 Ctrl \u6253\u65AD",
2020
+ readingManualMac: "\u6717\u8BFB\u4E2D \xB7 \u6309\u4F4F\u9EA6\u514B\u98CE\u6216 \u2303 Control \u6253\u65AD",
2010
2021
  recognitionFail: "\u8BC6\u522B\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",
2011
2022
  holdTrimmedNotice: "\u6309\u4F4F\u8BF4\u8BDD\u8D85\u8FC7\u7EA6 48 \u79D2\uFF1A\u53EA\u8BC6\u522B\u4E86\u6700\u540E\u4E00\u6BB5\uFF08\u524D\u9762\u7684\u97F3\u9891\u5DF2\u4E22\u5F03\uFF09",
2012
2023
  utteranceTooLong: "\u8FD9\u6B21\u8BF4\u8BDD\u592A\u957F\uFF08\u8D85\u8FC7\u5355\u6B21\u4E0A\u9650\uFF0C\u7EA6 1 \u5206\u949F\uFF09\uFF1A\u5DF2\u8DF3\u8FC7\uFF0C\u8BF7\u5206\u6BB5\u518D\u8BF4\u4E00\u6B21",
@@ -2222,9 +2233,21 @@ var zh = {
2222
2233
  ttsRetryingNotice: "\u6717\u8BFB\u91CD\u8BD5\u4E2D\uFF08{attempt}/{max}\uFF09\u2026",
2223
2234
  tabPreemptedNotice: "\u8BED\u97F3\u6A21\u5F0F\u5DF2\u88AB\u53E6\u4E00\u6807\u7B7E\u9875\u63A5\u7BA1",
2224
2235
  firstUseToggle: "\u76F4\u63A5\u5F00\u53E3\u8BF4\u8BDD\uFF0C\u505C\u987F\u81EA\u52A8\u586B\u5165\u5E76\u53D1\u9001\uFF1BAI \u6717\u8BFB\u65F6\u5F00\u53E3\u6216\u957F\u6309\u9EA6\u514B\u98CE\u5373\u53EF\u6253\u65AD",
2225
- firstUseHold: "\u6309\u4F4F\u9EA6\u514B\u98CE\u6216 Ctrl \u8BF4\u8BDD\uFF0C\u677E\u624B\u53D1\u9001\uFF1B\u6309\u4F4F\u5411\u4E0A\u6ED1\u52A8\u53EF\u53D6\u6D88\u672C\u53E5",
2236
+ firstUseHold: "\u6309\u4F4F\u9EA6\u514B\u98CE\u6309\u94AE\u6216\u957F\u6309 Ctrl \u8BF4\u8BDD\uFF0C\u677E\u5F00\u53D1\u9001\uFF1B\u6309 Esc \u6216\u4E0A\u6ED1\u53EF\u53D6\u6D88\u672C\u53E5",
2237
+ firstUseHoldMac: "\u6309\u4F4F\u9EA6\u514B\u98CE\u6309\u94AE\uFF0C\u6216\u957F\u6309\u952E\u76D8\u5DE6\u4E0B\u89D2 \u2303 Control\uFF08Ctrl\uFF0C\u975E \u2318 Command\uFF09\u8BF4\u8BDD\uFF0C\u677E\u5F00\u53D1\u9001\uFF1BEsc \u53D6\u6D88",
2226
2238
  firstUseOnce: "\u76F4\u63A5\u8BF4\u51FA\u4E00\u53E5\uFF0C\u505C\u987F\u81EA\u52A8\u53D1\u9001\uFF0CAI \u6717\u8BFB\u5B8C\u81EA\u52A8\u9000\u51FA\u8BED\u97F3\u6A21\u5F0F",
2227
2239
  firstUseWake: "\u5148\u8BF4\u5524\u9192\u8BCD\u300C{wake}\u300D\u5F00\u542F\u8BC6\u522B\uFF08\u4E5F\u53EF\u8FDE\u7740\u6307\u4EE4\u4E00\u8D77\u8BF4\uFF09",
2240
+ modeInlineToggle: "\u8FDB\u5165\u540E\u76F4\u63A5\u5F00\u53E3\u8BF4\u8BDD\uFF0C\u505C\u987F\u81EA\u52A8\u53D1\u9001\uFF1B\u8BF4\u8BDD\u65F6\u6309\u4F4F Ctrl \u677E\u5F00\u53EF\u7ACB\u5373\u53D1\u9001",
2241
+ modeInlineToggleMac: "\u8FDB\u5165\u540E\u76F4\u63A5\u5F00\u53E3\u8BF4\u8BDD\uFF0C\u505C\u987F\u81EA\u52A8\u53D1\u9001\uFF1B\u8BF4\u8BDD\u65F6\u6309\u4F4F \u2303 Control \u677E\u5F00\u53EF\u7ACB\u5373\u53D1\u9001",
2242
+ modeInlineHold: "\u672A\u5F00\u542F\u65F6\u53EF\u76F4\u63A5\u6309\u4F4F\u9EA6\u514B\u98CE\u8BF4\u8BDD\uFF1B\u5F00\u542F\u540E\u4E5F\u53EF\u957F\u6309\u952E\u76D8 Ctrl \u8BF4\u8BDD\u3001\u677E\u5F00\u53D1\u9001\uFF0CEsc \u53D6\u6D88",
2243
+ modeInlineHoldMac: "\u672A\u5F00\u542F\u65F6\u53EF\u76F4\u63A5\u6309\u4F4F\u9EA6\u514B\u98CE\u8BF4\u8BDD\uFF1B\u5F00\u542F\u540E\u4E5F\u53EF\u957F\u6309\u952E\u76D8\u5DE6\u4E0B\u89D2 \u2303 Control\uFF08\u975E \u2318 Command\uFF09\u8BF4\u8BDD\u3001\u677E\u5F00\u53D1\u9001\uFF0CEsc \u53D6\u6D88",
2244
+ modeInlineOnce: "\u8FDB\u5165\u540E\u8BF4\u51FA\u4E00\u53E5\u5373\u81EA\u52A8\u53D1\u9001\uFF0C\u7B49\u672C\u8F6E\u56DE\u590D\u6717\u8BFB\u5B8C\u6BD5\u540E\u81EA\u52A8\u9000\u51FA\u8BED\u97F3\u6A21\u5F0F",
2245
+ bargeInInlineDetect: "\u81EA\u52A8\u68C0\u6D4B\u672C\u673A\u6D88\u56DE\u58F0\uFF1A\u8033\u673A/\u539F\u751F\u6D88\u56DE\u58F0\u6B63\u5E38\u65F6\u5F00\u53E3\u5373\u6253\u65AD\uFF0C\u5916\u653E\u65E0\u6D88\u56DE\u58F0\u65F6\u81EA\u52A8\u5207\u4E3A\u957F\u6309\u6253\u65AD",
2246
+ bargeInInlineAuto: "\u64AD\u653E\u56DE\u590D\u65F6\u76F4\u63A5\u5F00\u53E3\u8BF4\u8BDD\u5373\u53EF\u6253\u65AD\uFF08\u63A8\u8350\u4F69\u6234\u8033\u673A\u6216\u5B89\u9759\u73AF\u5883\u4F7F\u7528\uFF09",
2247
+ bargeInInlineManual: "\u5916\u653E\u63A8\u8350\uFF1A\u5E73\u65F6\u76F4\u63A5\u8BF4\u8BDD\uFF0CAI \u6717\u8BFB\u671F\u95F4\u9700\u6309\u4F4F\u9EA6\u514B\u98CE\u6216 Ctrl \u624D\u6253\u65AD\uFF0C\u907F\u514D\u626C\u58F0\u5668\u56DE\u58F0\u81EA\u6253\u65AD",
2248
+ bargeInInlineManualMac: "\u5916\u653E\u63A8\u8350\uFF1A\u5E73\u65F6\u76F4\u63A5\u8BF4\u8BDD\uFF0CAI \u6717\u8BFB\u671F\u95F4\u9700\u6309\u4F4F\u9EA6\u514B\u98CE\u6216 \u2303 Control \u624D\u6253\u65AD\uFF0C\u907F\u514D\u626C\u58F0\u5668\u56DE\u58F0\u81EA\u6253\u65AD",
2249
+ shortcutBuiltInNote: "\u5185\u7F6E\u6309\u952E\uFF1A\u6309\u4F4F\u8BF4\u8BDD\u4E0B\u957F\u6309 Ctrl \u8BF4\u8BDD\u3001\u677E\u5F00\u53D1\u9001\uFF1B\u6301\u7EED\u8046\u542C\u4E0B\u6309\u4F4F Ctrl \u677E\u5F00\u7ACB\u5373\u53D1\u9001\uFF1B\u5355\u51FB Esc \u505C\u6B62\u6717\u8BFB/\u53D6\u6D88\u672C\u53E5\uFF0C\u53CC\u51FB Esc \u9000\u51FA\u3002",
2250
+ shortcutBuiltInNoteMac: "\u5185\u7F6E\u6309\u952E\uFF08Mac\uFF09\uFF1A\u6309\u4F4F\u8BF4\u8BDD\u4E0B\u957F\u6309\u5DE6\u4E0B\u89D2 \u2303 Control\uFF08\u975E \u2318 Command\uFF09\u8BF4\u8BDD\u3001\u677E\u5F00\u53D1\u9001\uFF1B\u6301\u7EED\u8046\u542C\u4E0B\u6309\u4F4F \u2303 Control \u677E\u5F00\u7ACB\u5373\u53D1\u9001\uFF1B\u5355\u51FB Esc \u505C\u8BFB/\u53D6\u6D88\uFF0C\u53CC\u51FB Esc \u9000\u51FA\u3002",
2228
2251
  descBackchannelYield: "\u6717\u8BFB\u671F\u7528\u6237\u8BF4\u300C\u55EF/\u5BF9\u300D\u7B49\u77ED\u5E94\u7B54\u65F6\u81EA\u52A8\u8BA9\u4F4D\uFF08\u8DF3\u8FC7\u5F53\u524D TTS \u53E5 + \u77ED\u6682\u4E22\u5E27 1.5s\uFF1B\u771F\u8981\u8BF4\u5219\u539F hardBreak \u63A5\u7BA1\uFF1B\u5173 = \u4E0D\u8BA9\u4F4D\uFF0C\u884C\u4E3A\u7B49\u540C\u6539\u9020\u524D\uFF09\u3002\u4EC5\u300C\u6309\u4F4F\u8BF4\u8BDD\u300D\u6A21\u5F0F\u64AD\u653E\u671F\u53EF\u89E6\u53D1\uFF1A\u300C\u6301\u7EED\u8046\u542C\u300D\u6A21\u5F0F\u64AD\u653E\u671F\u4E0D\u8BC6\u522B\u8BED\u97F3\uFF0C\u5F00\u53E3\u8BF4\u8BDD\u6309\u6253\u65AD\u5904\u7406",
2229
2252
  // Issue #15 批 1 / ADR-0012:打断语音抢救。
2230
2253
  descBargeInSalvage: "AI \u6717\u8BFB\u65F6\u4F60\u5F00\u53E3\u6253\u65AD\uFF1A\u81EA\u52A8\u4FDD\u7559\u4ECE\u5F00\u53E3\u5230\u6253\u65AD\u751F\u6548\u4E4B\u95F4\u4F60\u8BF4\u7684\u8BDD\uFF0C\u5E76\u5165\u8BC6\u522B\u7EE7\u7EED\u53D1\u9001\uFF08\u4FEE\u300C\u6253\u65AD\u5403\u53E5\u300D\uFF1B\u5173 = \u4E22\u5F03\u6253\u65AD\u524D\u8BED\u97F3\u2014\u2014\u4EC5\u5916\u653E\u4E14\u65E0\u56DE\u58F0\u6D88\u9664\u7684\u73AF\u5883\u5EFA\u8BAE\u5173\uFF09",
@@ -2410,17 +2433,28 @@ var en = {
2410
2433
  ariaActive: "Voice mode active",
2411
2434
  ariaEnter: "Enter voice mode",
2412
2435
  ariaPendingCancelHint: "activate again to cancel",
2413
- titleHold: "Voice mode \xB7 hold to talk, release to send; tap to exit; Esc/blur cancels; Ctrl+Shift+V exits",
2414
- titleToggle: "Voice mode \xB7 click to exit (Ctrl+Shift+V) \xB7 hold Ctrl while speaking to send now",
2415
- titleEnter: "Enter voice mode (Ctrl+Shift+V)",
2436
+ titleHold: "Hold-to-talk mode \xB7 hold mic or Ctrl to speak, release to send; Esc cancels, double-Esc exits",
2437
+ titleHoldMac: "Hold-to-talk mode \xB7 hold mic or \u2303 Control to speak, release to send; Esc cancels, double-Esc exits",
2438
+ titleToggle: "Continuous listening \xB7 hold and release Ctrl while speaking to send now; Esc stops playback, click or double-Esc exits",
2439
+ titleToggleMac: "Continuous listening \xB7 hold and release \u2303 Control while speaking to send now; Esc stops playback, click or double-Esc exits",
2440
+ titleOnce: "One-shot mode \xB7 speak once to auto-send, exits after the reply finishes reading; click or double-Esc to exit",
2441
+ titleEnter: "Enter voice mode",
2442
+ titleEnterHold: "Hold to talk: press and hold the mic directly to speak (release to send), or use the shortcut to enter",
2443
+ titleShortcutSuffix: " (shortcut: {keys})",
2444
+ titleShortcutComposerSuffix: " (shortcut: {keys}; in composer: {composerKeys})",
2416
2445
  loadingModel: "Loading model\u2026",
2417
2446
  listening: "Listening\u2026",
2418
2447
  thinking: "Thinking\u2026",
2419
- barHold: "Voice mode \xB7 hold to talk (tap to exit)",
2448
+ barHold: "Hold to talk \xB7 hold the mic button or Ctrl to speak, release to send (Esc cancels)",
2449
+ barHoldMac: "Hold to talk \xB7 hold the mic button or \u2303 Control to speak, release to send (Esc cancels)",
2450
+ barHolding: "Recording \u2014 release to send (slide up or press Esc to cancel)",
2451
+ barOnce: "One-shot \xB7 speak your request; sends on pause and exits after reading",
2420
2452
  barListening: "Voice mode \xB7 listening\u2026",
2421
2453
  wakeWord: "Wake word",
2422
2454
  sayWake: 'Say "{wake}" to start',
2423
2455
  reading: "Reading aloud\u2026",
2456
+ readingManual: "Reading aloud \xB7 hold mic or Ctrl to interrupt",
2457
+ readingManualMac: "Reading aloud \xB7 hold mic or \u2303 Control to interrupt",
2424
2458
  recognitionFail: "Recognition failed, try again",
2425
2459
  holdTrimmedNotice: "Hold-to-talk exceeded about 48 s: only the last part was recognised (earlier audio was dropped)",
2426
2460
  utteranceTooLong: "That utterance was too long (over the per-utterance limit, about a minute): skipped \u2014 please speak it again in shorter parts",
@@ -2633,9 +2667,21 @@ var en = {
2633
2667
  ttsRetryingNotice: "Retrying read-aloud ({attempt}/{max})\u2026",
2634
2668
  tabPreemptedNotice: "Voice mode was taken over by another tab",
2635
2669
  firstUseToggle: "Speak directly \u2014 pauses commit and send; speak or hold the mic to interrupt replies",
2636
- firstUseHold: "Hold the mic button or Ctrl to speak, release to send, or slide up to cancel",
2670
+ firstUseHold: "Hold the mic button or Ctrl to speak, release to send; press Esc or slide up to cancel",
2671
+ firstUseHoldMac: "Hold the mic button or \u2303 Control (Ctrl, not \u2318 Command) to speak, release to send; Esc cancels",
2637
2672
  firstUseOnce: "Speak one request \u2014 it sends after a pause and exits once the reply finishes reading",
2638
2673
  firstUseWake: 'Say the wake word "{wake}" to start speaking (or say it together with your request)',
2674
+ modeInlineToggle: "Speak directly after entering \u2014 pauses auto-send; hold and release Ctrl while speaking to send now",
2675
+ modeInlineToggleMac: "Speak directly after entering \u2014 pauses auto-send; hold and release \u2303 Control while speaking to send now",
2676
+ modeInlineHold: "Hold the mic directly from idle, or enter voice mode and hold Ctrl to speak, release to send, Esc to cancel",
2677
+ modeInlineHoldMac: "Hold the mic directly from idle, or enter voice mode and hold \u2303 Control (not \u2318 Command) to speak, release to send, Esc to cancel",
2678
+ modeInlineOnce: "Speak one request to auto-send; exits voice mode automatically once the reply finishes reading",
2679
+ bargeInInlineDetect: "Probes native echo cancellation: speak to interrupt when active; switches to hold-to-interrupt on open speakers",
2680
+ bargeInInlineAuto: "Speak directly to interrupt playback (recommended with headphones or in quiet rooms)",
2681
+ bargeInInlineManual: "Best for speakers: speak normally when idle; hold mic or Ctrl during playback to interrupt without echo false triggers",
2682
+ bargeInInlineManualMac: "Best for speakers: speak normally when idle; hold mic or \u2303 Control during playback to interrupt without echo false triggers",
2683
+ shortcutBuiltInNote: "Built-in keys: hold Ctrl to speak in Hold-to-talk (release sends); hold and release Ctrl in Continuous mode to send now; Esc stops playback/cancels, double-Esc exits.",
2684
+ shortcutBuiltInNoteMac: "Built-in keys (Mac): hold \u2303 Control (not \u2318 Command) to speak in Hold-to-talk; hold and release \u2303 Control in Continuous mode to send now; Esc stops/cancels, double-Esc exits.",
2639
2685
  descBackchannelYield: 'When the user says a short answer like "mm-hmm/right" while the agent is reading aloud, yield automatically (skip the current TTS sentence + drop frames for 1.5s; if the user really wants to speak, the existing hardBreak takes over; off = no yielding, behavior matches before this change). Only triggers in hold-to-talk mode: in continuous-listening mode speech is not recognized during playback (speaking is treated as an interrupt)',
2640
2686
  // Issue #15 batch 1 / ADR-0012: barge-in speech salvage.
2641
2687
  descBargeInSalvage: "When you speak to interrupt while the agent is reading aloud, keep what you said from speech onset to break confirmation and merge it into recognition (fixes swallowed break-in speech; off = discard pre-break audio; recommended off only on speakers without echo cancellation)",
@@ -3115,6 +3161,40 @@ function pushCaptionHistory(history, text, max = CAPTION_HISTORY_MAX) {
3115
3161
  function shouldSkipDraftWriteback(quoteCount, attachCount) {
3116
3162
  return quoteCount > 0 || attachCount > 0;
3117
3163
  }
3164
+ var FIRST_USE_HINT_BASE = "dshvm-first-use-hint-seen";
3165
+ function firstUseHintKey(mode, base = FIRST_USE_HINT_BASE) {
3166
+ if (mode === "hold") return `${base}:hold`;
3167
+ if (mode === "once") return `${base}:once`;
3168
+ return base;
3169
+ }
3170
+ function formatShortcutForDisplay(raw, isMac) {
3171
+ const clean2 = String(raw ?? "").trim();
3172
+ if (!clean2) return "";
3173
+ const parts = clean2.split("+").map((p) => p.trim()).filter(Boolean);
3174
+ if (parts.length === 0) return "";
3175
+ const mapped = parts.map((p) => {
3176
+ const low = p.toLowerCase();
3177
+ if (isMac) {
3178
+ if (low === "ctrl" || low === "control") return "\u2303 Control";
3179
+ if (low === "alt" || low === "option") return "\u2325 Option";
3180
+ if (low === "shift") return "\u21E7 Shift";
3181
+ if (low === "cmd" || low === "meta" || low === "command") return "\u2318 Command";
3182
+ if (low === "enter" || low === "return") return "Return";
3183
+ if (low === "space") return "Space";
3184
+ if (low === "tab") return "Tab";
3185
+ return p.length === 1 ? p.toUpperCase() : p;
3186
+ }
3187
+ if (low === "ctrl" || low === "control") return "Ctrl";
3188
+ if (low === "alt" || low === "option") return "Alt";
3189
+ if (low === "shift") return "Shift";
3190
+ if (low === "cmd" || low === "meta" || low === "command") return "Win/Super";
3191
+ if (low === "enter" || low === "return") return "Enter";
3192
+ if (low === "space") return "Space";
3193
+ if (low === "tab") return "Tab";
3194
+ return p.length === 1 ? p.toUpperCase() : p;
3195
+ });
3196
+ return mapped.join(isMac ? " + " : "+");
3197
+ }
3118
3198
 
3119
3199
  // src/engine-kind.ts
3120
3200
  var TTS_ENGINE_KINDS = ["vits", "kokoro", "edge", "openai", "mimo"];
@@ -4284,6 +4364,7 @@ function presetVoiceLabel(full) {
4284
4364
  const i = full.lastIndexOf(":");
4285
4365
  return i >= 0 ? full.slice(i + 1) || full : full;
4286
4366
  }
4367
+ var IS_MAC_UI = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent || "");
4287
4368
  var t2 = {
4288
4369
  bg: "var(--dsw-alias-bg-layer-3)",
4289
4370
  bgOpen: "var(--dsw-alias-bg-layer-2)",
@@ -5030,7 +5111,23 @@ function ShortcutField({
5030
5111
  },
5031
5112
  children: recording ? t("shortcutCancel") : t("shortcutRecord")
5032
5113
  }
5033
- )
5114
+ ),
5115
+ IS_MAC_UI && draft.trim() ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
5116
+ "kbd",
5117
+ {
5118
+ style: {
5119
+ fontSize: 11,
5120
+ lineHeight: "20px",
5121
+ padding: "2px 7px",
5122
+ borderRadius: 6,
5123
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
5124
+ color: "var(--dsw-alias-label-secondary, var(--dsw-alias-label-tertiary))",
5125
+ background: "color-mix(in srgb, var(--dsw-alias-label-tertiary) 10%, transparent)",
5126
+ border: `1px solid ${t2.border}`
5127
+ },
5128
+ children: formatShortcutForDisplay(draft, true)
5129
+ }
5130
+ ) : null
5034
5131
  ] }),
5035
5132
  err || recording ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
5036
5133
  "span",
@@ -6509,19 +6606,22 @@ function VoiceSettingsCard({
6509
6606
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SegmentTabs, { active: tab, onChange: setTab }),
6510
6607
  tab === "input" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { role: "tabpanel", "aria-label": t("segInput"), children: [
6511
6608
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupTitle, { first: true, children: t("secInteraction") }),
6512
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Row, { name: "mode", desc: t("descMode"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
6513
- SegGroup,
6514
- {
6515
- score: scope,
6516
- field: "mode",
6517
- value: value.mode,
6518
- options: [
6519
- { v: "toggle", label: t("modeToggle") },
6520
- { v: "hold", label: t("modeHold") },
6521
- { v: "once", label: t("modeOnce") }
6522
- ]
6523
- }
6524
- ) }),
6609
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { name: "mode", desc: t("descMode"), children: [
6610
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
6611
+ SegGroup,
6612
+ {
6613
+ score: scope,
6614
+ field: "mode",
6615
+ value: value.mode,
6616
+ options: [
6617
+ { v: "toggle", label: t("modeToggle") },
6618
+ { v: "hold", label: t("modeHold") },
6619
+ { v: "once", label: t("modeOnce") }
6620
+ ]
6621
+ }
6622
+ ),
6623
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { fontSize: 11.5, lineHeight: "17px", color: t2.term }, children: value.mode === "hold" ? IS_MAC_UI ? t("modeInlineHoldMac") : t("modeInlineHold") : value.mode === "once" ? t("modeInlineOnce") : IS_MAC_UI ? t("modeInlineToggleMac") : t("modeInlineToggle") })
6624
+ ] }),
6525
6625
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Row, { name: "wakeWord", desc: t("descWakeWord"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextField, { score: scope, field: "wakeWord", value: value.wakeWord ?? "", placeholder: t("wakePlaceholder") }) }),
6526
6626
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Row, { name: "autoSend", desc: t("descAutoSend"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckRow, { field: "autoSend", checked: value.autoSend !== false, score: scope }) }),
6527
6627
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupTitle, { children: t("secInterrupt") }),
@@ -6538,25 +6638,31 @@ function VoiceSettingsCard({
6538
6638
  ]
6539
6639
  }
6540
6640
  ) }),
6541
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Row, { name: "bargeInMode", desc: t("descBargeIn"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
6542
- SegGroup,
6543
- {
6544
- score: scope,
6545
- field: "bargeInMode",
6546
- value: value.bargeInMode,
6547
- options: [
6548
- { v: "detect", label: t("bargeInDetect") },
6549
- { v: "auto", label: t("bargeInAuto") },
6550
- { v: "manual", label: t("bargeInManual") }
6551
- ]
6552
- }
6553
- ) }),
6641
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { name: "bargeInMode", desc: t("descBargeIn"), children: [
6642
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
6643
+ SegGroup,
6644
+ {
6645
+ score: scope,
6646
+ field: "bargeInMode",
6647
+ value: value.bargeInMode,
6648
+ options: [
6649
+ { v: "detect", label: t("bargeInDetect") },
6650
+ { v: "auto", label: t("bargeInAuto") },
6651
+ { v: "manual", label: t("bargeInManual") }
6652
+ ]
6653
+ }
6654
+ ),
6655
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { fontSize: 11.5, lineHeight: "17px", color: t2.term }, children: value.bargeInMode === "auto" ? t("bargeInInlineAuto") : value.bargeInMode === "manual" ? IS_MAC_UI ? t("bargeInInlineManualMac") : t("bargeInInlineManual") : t("bargeInInlineDetect") })
6656
+ ] }),
6554
6657
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Row, { name: "silenceMs", desc: t("descSilence"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberField, { score: scope, field: "silenceMs", value: value.silenceMs ?? 1500, min: 500, max: 3e4, step: 100 }) }),
6555
6658
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupTitle, { children: t("secShortcut") }),
6556
6659
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Row, { name: "shortcut", desc: t("descShortcut"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShortcutField, { score: scope, field: "shortcut", value: value.shortcut ?? "" }) }),
6557
6660
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Row, { name: "composerShortcut", desc: t("descComposerShortcut"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShortcutField, { score: scope, field: "composerShortcut", value: value.composerShortcut ?? "Alt+Enter" }) }),
6558
6661
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: 10, padding: "2px 0 6px" }, children: [
6559
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { flex: 1, fontSize: 11, lineHeight: "17px", color: "var(--dsw-alias-label-tertiary)" }, children: t("shortcutNote") }),
6662
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { flex: 1, fontSize: 11, lineHeight: "17px", color: "var(--dsw-alias-label-tertiary)", display: "flex", flexDirection: "column", gap: 3 }, children: [
6663
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("shortcutNote") }),
6664
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: IS_MAC_UI ? t("shortcutBuiltInNoteMac") : t("shortcutBuiltInNote") })
6665
+ ] }),
6560
6666
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
6561
6667
  "button",
6562
6668
  {
@@ -7054,7 +7160,7 @@ function telemetryDeltas(tel) {
7054
7160
  }
7055
7161
  return out;
7056
7162
  }
7057
- var BUILD_TAG = "118c5b9";
7163
+ var BUILD_TAG = "b23d887";
7058
7164
  var TELEMETRY_FLAG = "dsh-voice-mode.telemetry";
7059
7165
  var telemetryEnabled = (() => {
7060
7166
  try {
@@ -9534,9 +9640,9 @@ function MicButton({
9534
9640
  micReadyRef.current = true;
9535
9641
  setLocalMode("on");
9536
9642
  resetIdle();
9537
- if (!bus.ui.error && !bus.ui.notice && takeOnceHint(FIRST_USE_HINT_KEY)) {
9643
+ if (!bus.ui.error && !bus.ui.notice && takeOnceHint(firstUseHintKey(cfg.mode, FIRST_USE_HINT_KEY))) {
9538
9644
  const wake = cfg.wakeWord.trim();
9539
- const guide = cfg.mode === "hold" ? t("firstUseHold") : wake ? t("firstUseWake", { wake }) : cfg.mode === "once" ? t("firstUseOnce") : t("firstUseToggle");
9645
+ const guide = cfg.mode === "hold" ? IS_MAC ? t("firstUseHoldMac") : t("firstUseHold") : wake ? t("firstUseWake", { wake }) : cfg.mode === "once" ? t("firstUseOnce") : t("firstUseToggle");
9540
9646
  bus.setNotice(guide);
9541
9647
  }
9542
9648
  if (pendingHoldRef.current) {
@@ -9781,7 +9887,7 @@ function MicButton({
9781
9887
  holdCtrlRef.current = true;
9782
9888
  setHolding(true);
9783
9889
  eng.beginHeld();
9784
- }, 600);
9890
+ }, 220);
9785
9891
  } else if (bootNow().bargeInMode === "manual" && bus.ui.playing || bootNow().mode === "once" && onceRef.current) {
9786
9892
  manualHoldRef.current = true;
9787
9893
  setHolding(true);
@@ -9796,6 +9902,12 @@ function MicButton({
9796
9902
  clearTimeout(ctrlTimer);
9797
9903
  ctrlTimer = null;
9798
9904
  }
9905
+ if (holdCtrlRef.current) {
9906
+ holdCtrlRef.current = false;
9907
+ setHolding(false);
9908
+ engineRef.current?.endHeld(true);
9909
+ bus.setUi({ partial: "" });
9910
+ }
9799
9911
  }
9800
9912
  };
9801
9913
  const onKeyUp = (e) => {
@@ -9937,6 +10049,12 @@ function MicButton({
9937
10049
  const phaseRef = (0, import_react3.useRef)("");
9938
10050
  phaseRef.current = livePhase;
9939
10051
  const [holding, setHolding] = (0, import_react3.useState)(false);
10052
+ (0, import_react3.useEffect)(() => {
10053
+ bus.setUi({ holding });
10054
+ return () => {
10055
+ bus.setUi({ holding: false });
10056
+ };
10057
+ }, [bus, holding]);
9940
10058
  const reading = local === "off" && bus.ui.playing;
9941
10059
  const showTurn = onceWaiting || bootNow().showStatusBar === false && bus.ui.state !== "speech" && (bus.ui.playing || bus.ui.turn === "agent-speaking");
9942
10060
  const label = on && showTurn ? bus.ui.playing ? t("reading") : t("thinking") : reading ? t("stopReading") : on ? busy ? (
@@ -10242,7 +10360,10 @@ function MicButton({
10242
10360
  setMenuOpen(false);
10243
10361
  if (refocus) (menuTriggerRef.current ?? btnRef.current)?.focus();
10244
10362
  }, []);
10245
- const title = bus.ui.error ? String(bus.ui.error) : reading ? t("stopReading") : on ? holdMode ? t("titleHold") : t("titleToggle") : t("titleEnter");
10363
+ const shortcutDisp = formatShortcutForDisplay(bootNow().shortcut, IS_MAC);
10364
+ const composerDisp = formatShortcutForDisplay(bootNow().composerShortcut, IS_MAC);
10365
+ const shortcutSuffix = shortcutDisp && composerDisp ? t("titleShortcutComposerSuffix", { keys: shortcutDisp, composerKeys: composerDisp }) : shortcutDisp ? t("titleShortcutSuffix", { keys: shortcutDisp }) : composerDisp ? t("titleShortcutSuffix", { keys: composerDisp }) : "";
10366
+ const title = bus.ui.error ? String(bus.ui.error) : reading ? t("stopReading") : on ? `${holdMode ? IS_MAC ? t("titleHoldMac") : t("titleHold") : bootNow().mode === "once" ? t("titleOnce") : IS_MAC ? t("titleToggleMac") : t("titleToggle")}${shortcutDisp ? t("titleShortcutSuffix", { keys: shortcutDisp }) : ""}` : `${holdMode ? t("titleEnterHold") : t("titleEnter")}${shortcutSuffix}`;
10246
10367
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
10247
10368
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dshvm-mic-group", "data-dshvm": "mic-group", children: [
10248
10369
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
@@ -10419,7 +10540,8 @@ function VoiceStatusBar({ bus, sessionId }) {
10419
10540
  }, [b.ui.state]);
10420
10541
  const isActive = b.active === sessionId;
10421
10542
  if (!isActive || b.ui.boot?.showStatusBar === false) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, {});
10422
- const stateText = b.ui.state === "loading-model" ? t("loadingModel") : b.ui.state === "transcribing" ? transcribingSec >= 2 ? t("recognizingSec").replace("{sec}", String(transcribingSec)) : t("recognizing") : b.ui.state === "wake" ? t("sayWake").replace("{wake}", b.ui.wakeWord || t("wakeWord")) : b.ui.state === "speech" ? b.ui.mode === "hold" ? t("holdDots") : t("listening") : b.ui.playing ? t("reading") : b.ui.turn === "agent-speaking" ? b.ui.ttsNotice || t("thinking") : b.ui.mode === "hold" ? t("barHold") : t("barListening");
10543
+ const manualBargeIn = b.ui.boot?.bargeInMode === "manual" || b.ui.bargeInDetectFallback === true;
10544
+ const stateText = b.ui.state === "loading-model" ? t("loadingModel") : b.ui.state === "transcribing" ? transcribingSec >= 2 ? t("recognizingSec").replace("{sec}", String(transcribingSec)) : t("recognizing") : b.ui.holding ? t("barHolding") : b.ui.state === "wake" ? t("sayWake").replace("{wake}", b.ui.wakeWord || t("wakeWord")) : b.ui.state === "speech" ? b.ui.mode === "hold" ? t("holdDots") : t("listening") : b.ui.playing ? manualBargeIn ? IS_MAC ? t("readingManualMac") : t("readingManual") : t("reading") : b.ui.turn === "agent-speaking" ? b.ui.ttsNotice || t("thinking") : b.ui.mode === "hold" ? IS_MAC ? t("barHoldMac") : t("barHold") : b.ui.mode === "once" ? t("barOnce") : t("barListening");
10423
10545
  const bars = Array.from({ length: WAVE_BARS }, (_, i) => b.ui.levels[i] ?? 0);
10424
10546
  const botBars = Array.from({ length: WAVE_BARS }, (_, i) => b.ui.botLevels[i] ?? 0);
10425
10547
  const telParts = [];
@@ -10445,8 +10567,9 @@ function VoiceStatusBar({ bus, sessionId }) {
10445
10567
  `AEC delay=${Math.round(b.ui.echoDelayMs ?? 0)}ms floor=${el.floorRms.toFixed(4)} resid=${el.residualRms.toFixed(4)}`
10446
10568
  );
10447
10569
  }
10448
- const displayText = b.ui.error ? b.ui.error : b.ui.sseDown ? t("sseReconnect") : b.ui.notice ? b.ui.notice : b.ui.idleWarn ? t("idleWarn30s") : b.ui.state === "loading-model" || b.ui.model ? b.ui.model ? `${t("loadingModel")} ${b.ui.model.file} ${b.ui.model.percent}%` : stateText : b.ui.playing || b.ui.turn === "agent-speaking" ? stateText : b.ui.state === "wake" && b.ui.partial ? `${stateText} \xB7 ${b.ui.partial}` : b.ui.partial ? b.ui.partial : b.ui.ttsNotice ? b.ui.ttsNotice : stateText;
10449
- const hasBadges = b.ui.isSpeech === true || Boolean(b.ui.ttsNotice) || b.ui.aecOff === true;
10570
+ const displayText = b.ui.error ? b.ui.error : b.ui.sseDown ? t("sseReconnect") : b.ui.state === "loading-model" || b.ui.model ? b.ui.model ? `${t("loadingModel")} ${b.ui.model.file} ${b.ui.model.percent}%` : stateText : b.ui.holding ? b.ui.partial || stateText : b.ui.notice ? b.ui.notice : b.ui.idleWarn ? t("idleWarn30s") : b.ui.playing || b.ui.turn === "agent-speaking" ? stateText : b.ui.state === "wake" && b.ui.partial ? `${stateText} \xB7 ${b.ui.partial}` : b.ui.partial ? b.ui.partial : b.ui.ttsNotice ? b.ui.ttsNotice : stateText;
10571
+ const showAecBadge = b.ui.aecOff === true && b.ui.boot?.bargeInMode !== "manual";
10572
+ const hasBadges = b.ui.isSpeech === true || Boolean(b.ui.ttsNotice) || showAecBadge;
10450
10573
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
10451
10574
  "div",
10452
10575
  {
@@ -10644,7 +10767,7 @@ function VoiceStatusBar({ bus, sessionId }) {
10644
10767
  children: b.ui.ttsNotice
10645
10768
  }
10646
10769
  ),
10647
- b.ui.aecOff === true && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
10770
+ showAecBadge && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
10648
10771
  "span",
10649
10772
  {
10650
10773
  "aria-hidden": "true",
package/lib/index.js CHANGED
@@ -2897,17 +2897,28 @@ var en = {
2897
2897
  ariaActive: "Voice mode active",
2898
2898
  ariaEnter: "Enter voice mode",
2899
2899
  ariaPendingCancelHint: "activate again to cancel",
2900
- titleHold: "Voice mode \xB7 hold to talk, release to send; tap to exit; Esc/blur cancels; Ctrl+Shift+V exits",
2901
- titleToggle: "Voice mode \xB7 click to exit (Ctrl+Shift+V) \xB7 hold Ctrl while speaking to send now",
2902
- titleEnter: "Enter voice mode (Ctrl+Shift+V)",
2900
+ titleHold: "Hold-to-talk mode \xB7 hold mic or Ctrl to speak, release to send; Esc cancels, double-Esc exits",
2901
+ titleHoldMac: "Hold-to-talk mode \xB7 hold mic or \u2303 Control to speak, release to send; Esc cancels, double-Esc exits",
2902
+ titleToggle: "Continuous listening \xB7 hold and release Ctrl while speaking to send now; Esc stops playback, click or double-Esc exits",
2903
+ titleToggleMac: "Continuous listening \xB7 hold and release \u2303 Control while speaking to send now; Esc stops playback, click or double-Esc exits",
2904
+ titleOnce: "One-shot mode \xB7 speak once to auto-send, exits after the reply finishes reading; click or double-Esc to exit",
2905
+ titleEnter: "Enter voice mode",
2906
+ titleEnterHold: "Hold to talk: press and hold the mic directly to speak (release to send), or use the shortcut to enter",
2907
+ titleShortcutSuffix: " (shortcut: {keys})",
2908
+ titleShortcutComposerSuffix: " (shortcut: {keys}; in composer: {composerKeys})",
2903
2909
  loadingModel: "Loading model\u2026",
2904
2910
  listening: "Listening\u2026",
2905
2911
  thinking: "Thinking\u2026",
2906
- barHold: "Voice mode \xB7 hold to talk (tap to exit)",
2912
+ barHold: "Hold to talk \xB7 hold the mic button or Ctrl to speak, release to send (Esc cancels)",
2913
+ barHoldMac: "Hold to talk \xB7 hold the mic button or \u2303 Control to speak, release to send (Esc cancels)",
2914
+ barHolding: "Recording \u2014 release to send (slide up or press Esc to cancel)",
2915
+ barOnce: "One-shot \xB7 speak your request; sends on pause and exits after reading",
2907
2916
  barListening: "Voice mode \xB7 listening\u2026",
2908
2917
  wakeWord: "Wake word",
2909
2918
  sayWake: 'Say "{wake}" to start',
2910
2919
  reading: "Reading aloud\u2026",
2920
+ readingManual: "Reading aloud \xB7 hold mic or Ctrl to interrupt",
2921
+ readingManualMac: "Reading aloud \xB7 hold mic or \u2303 Control to interrupt",
2911
2922
  recognitionFail: "Recognition failed, try again",
2912
2923
  holdTrimmedNotice: "Hold-to-talk exceeded about 48 s: only the last part was recognised (earlier audio was dropped)",
2913
2924
  utteranceTooLong: "That utterance was too long (over the per-utterance limit, about a minute): skipped \u2014 please speak it again in shorter parts",
@@ -3120,9 +3131,21 @@ var en = {
3120
3131
  ttsRetryingNotice: "Retrying read-aloud ({attempt}/{max})\u2026",
3121
3132
  tabPreemptedNotice: "Voice mode was taken over by another tab",
3122
3133
  firstUseToggle: "Speak directly \u2014 pauses commit and send; speak or hold the mic to interrupt replies",
3123
- firstUseHold: "Hold the mic button or Ctrl to speak, release to send, or slide up to cancel",
3134
+ firstUseHold: "Hold the mic button or Ctrl to speak, release to send; press Esc or slide up to cancel",
3135
+ firstUseHoldMac: "Hold the mic button or \u2303 Control (Ctrl, not \u2318 Command) to speak, release to send; Esc cancels",
3124
3136
  firstUseOnce: "Speak one request \u2014 it sends after a pause and exits once the reply finishes reading",
3125
3137
  firstUseWake: 'Say the wake word "{wake}" to start speaking (or say it together with your request)',
3138
+ modeInlineToggle: "Speak directly after entering \u2014 pauses auto-send; hold and release Ctrl while speaking to send now",
3139
+ modeInlineToggleMac: "Speak directly after entering \u2014 pauses auto-send; hold and release \u2303 Control while speaking to send now",
3140
+ modeInlineHold: "Hold the mic directly from idle, or enter voice mode and hold Ctrl to speak, release to send, Esc to cancel",
3141
+ modeInlineHoldMac: "Hold the mic directly from idle, or enter voice mode and hold \u2303 Control (not \u2318 Command) to speak, release to send, Esc to cancel",
3142
+ modeInlineOnce: "Speak one request to auto-send; exits voice mode automatically once the reply finishes reading",
3143
+ bargeInInlineDetect: "Probes native echo cancellation: speak to interrupt when active; switches to hold-to-interrupt on open speakers",
3144
+ bargeInInlineAuto: "Speak directly to interrupt playback (recommended with headphones or in quiet rooms)",
3145
+ bargeInInlineManual: "Best for speakers: speak normally when idle; hold mic or Ctrl during playback to interrupt without echo false triggers",
3146
+ bargeInInlineManualMac: "Best for speakers: speak normally when idle; hold mic or \u2303 Control during playback to interrupt without echo false triggers",
3147
+ shortcutBuiltInNote: "Built-in keys: hold Ctrl to speak in Hold-to-talk (release sends); hold and release Ctrl in Continuous mode to send now; Esc stops playback/cancels, double-Esc exits.",
3148
+ shortcutBuiltInNoteMac: "Built-in keys (Mac): hold \u2303 Control (not \u2318 Command) to speak in Hold-to-talk; hold and release \u2303 Control in Continuous mode to send now; Esc stops/cancels, double-Esc exits.",
3126
3149
  descBackchannelYield: 'When the user says a short answer like "mm-hmm/right" while the agent is reading aloud, yield automatically (skip the current TTS sentence + drop frames for 1.5s; if the user really wants to speak, the existing hardBreak takes over; off = no yielding, behavior matches before this change). Only triggers in hold-to-talk mode: in continuous-listening mode speech is not recognized during playback (speaking is treated as an interrupt)',
3127
3150
  // Issue #15 batch 1 / ADR-0012: barge-in speech salvage.
3128
3151
  descBargeInSalvage: "When you speak to interrupt while the agent is reading aloud, keep what you said from speech onset to break confirmation and merge it into recognition (fixes swallowed break-in speech; off = discard pre-break audio; recommended off only on speakers without echo cancellation)",
@@ -24,7 +24,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
 
25
25
  // src/tts-vits-worker.ts
26
26
  var import_sherpa_onnx = __toESM(require("sherpa-onnx"), 1);
27
- var import_sherpa_onnx_node = __toESM(require("sherpa-onnx-node"), 1);
28
27
 
29
28
  // src/segmenter.ts
30
29
  function sanitizeForTts(text) {
@@ -33,7 +32,17 @@ function sanitizeForTts(text) {
33
32
 
34
33
  // src/tts-vits-worker.ts
35
34
  var { createOfflineTts } = import_sherpa_onnx.default;
36
- var { OfflineTts, GenerationConfig } = import_sherpa_onnx_node.default;
35
+ var cachedNativeSherpa = null;
36
+ async function loadNativeSherpa() {
37
+ if (cachedNativeSherpa) return cachedNativeSherpa;
38
+ const mod = await import("sherpa-onnx-node");
39
+ const resolved = mod.default ?? mod;
40
+ if (!resolved || typeof resolved.OfflineTts !== "function") {
41
+ throw new Error("sherpa-onnx-node native addon is unavailable on this platform");
42
+ }
43
+ cachedNativeSherpa = resolved;
44
+ return resolved;
45
+ }
37
46
  var send = (msg) => {
38
47
  if (typeof process.send === "function") process.send(msg);
39
48
  };
@@ -41,8 +50,9 @@ var wasmTts = null;
41
50
  var nativeTts = null;
42
51
  var initKind = "vits";
43
52
  var initPaths = {};
44
- function createEngine() {
53
+ async function createEngine() {
45
54
  if (initKind === "kokoro") {
55
+ const { OfflineTts } = await loadNativeSherpa();
46
56
  nativeTts = new OfflineTts({
47
57
  model: {
48
58
  kokoro: {
@@ -83,12 +93,12 @@ function createEngine() {
83
93
  function reply(id, payload) {
84
94
  send({ id: typeof id === "number" ? id : 0, ...payload });
85
95
  }
86
- process.on("message", (msg) => {
96
+ async function handleMessage(msg) {
87
97
  try {
88
98
  if (msg.type === "init") {
89
99
  initKind = msg.kind === "kokoro" ? "kokoro" : "vits";
90
100
  initPaths = msg.paths;
91
- createEngine();
101
+ await createEngine();
92
102
  reply(msg.id, { ok: true });
93
103
  return;
94
104
  }
@@ -113,6 +123,7 @@ process.on("message", (msg) => {
113
123
  reply(msg.id, { ok: false, error: "tts child not initialized" });
114
124
  return;
115
125
  }
126
+ const { GenerationConfig } = await loadNativeSherpa();
116
127
  const gc = new GenerationConfig({ sid, speed, silenceScale: 0.2 });
117
128
  audio = nativeTts.generate({ text, generationConfig: gc });
118
129
  } else {
@@ -144,4 +155,8 @@ process.on("message", (msg) => {
144
155
  } catch (e) {
145
156
  reply(typeof msg?.id === "number" ? msg.id : 0, { ok: false, error: String(e) });
146
157
  }
158
+ }
159
+ var msgChain = Promise.resolve();
160
+ process.on("message", (msg) => {
161
+ msgChain = msgChain.then(() => handleMessage(msg));
147
162
  });
package/locale/en.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Voice Mode",
4
- "description": "Full-duplex voice conversation for DeepSeek Harness: local streaming speech recognition (no API key) fills an editable draft, replies are read aloud sentence by sentence with live captions, and speaking interrupts the reply."
4
+ "description": "Full-duplex voice mode for DeepSeek Harness: local streaming speech-to-text, push-to-talk, sentence read-aloud TTS (Edge, OpenAI, MiMo, offline VITS/Kokoro), live captions, and voice barge-in.",
5
+ "detail": "README.en.md"
5
6
  }
6
7
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "语音模式",
4
- "description": "DeepSeek Harness 的语音双工插件:本地流式识别(无需 API Key)实时转写进草稿,回复按句朗读并带实时字幕,开口即可打断。"
4
+ "description": "DeepSeek Harness 全双工语音对话插件:本地流式识别输入、按住说话、回复按句朗读(Edge / OpenAI / MiMo / 离线 VITS 与 Kokoro)、实时字幕与发声打断。",
5
+ "detail": "README.md"
5
6
  }
6
7
  }
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "dsh-voice-mode",
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.",
3
+ "description": "Full-duplex voice plugin for DeepSeek Harness (DSH): local streaming ASR/STT, push-to-talk, sentence read-aloud TTS with live captions, and voice barge-in (Edge, OpenAI, MiMo, offline VITS/Kokoro). · DSH 全双工语音对话插件:本地流式语音识别输入、按住说话、逐句语音合成朗读、实时字幕与发声打断。",
4
4
  "icon": "./icon.svg",
5
- "version": "0.7.40",
5
+ "version": "0.7.42",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/qishuilalala/dsh-voice-mode.git"
10
+ "url": "git+https://github.com/qishuilalala/dsh-voice-mode.git",
11
+ "directory": "plugin/dsh-voice-mode"
11
12
  },
12
13
  "homepage": "https://github.com/qishuilalala/dsh-voice-mode#readme",
13
14
  "bugs": {
@@ -110,31 +111,57 @@
110
111
  "keywords": [
111
112
  "dsh",
112
113
  "dsh-plugin",
114
+ "dsh-bundle",
115
+ "deepseek",
113
116
  "deepseek-harness",
114
117
  "voice",
115
118
  "voice-mode",
119
+ "voice-input",
120
+ "voice-chat",
121
+ "voice-assistant",
116
122
  "speech",
117
- "asr",
118
- "tts",
119
- "speech-to-text",
120
- "text-to-speech",
121
- "speech-recognition",
122
123
  "full-duplex",
123
- "duplex",
124
+ "push-to-talk",
125
+ "dictation",
126
+ "read-aloud",
124
127
  "barge-in",
125
- "captions",
126
128
  "wake-word",
127
- "local-asr",
129
+ "captions",
130
+ "live-captions",
128
131
  "on-device",
132
+ "offline",
133
+ "asr",
134
+ "stt",
135
+ "speech-to-text",
136
+ "speech-recognition",
137
+ "tts",
138
+ "text-to-speech",
139
+ "local-asr",
140
+ "sherpa-onnx",
129
141
  "zipformer2",
130
142
  "sensevoice",
131
- "kokoro",
143
+ "edge-tts",
132
144
  "msedge-tts",
133
- "chinese",
145
+ "vits",
146
+ "kokoro",
147
+ "openai-tts",
148
+ "mimo",
134
149
  "语音",
150
+ "语音模式",
151
+ "语音输入",
152
+ "语音对话",
153
+ "语音识别",
154
+ "语音转文字",
155
+ "听写",
156
+ "语音合成",
157
+ "文字转语音",
158
+ "朗读",
159
+ "按住说话",
160
+ "实时字幕",
135
161
  "字幕",
136
162
  "打断",
137
- "中文",
163
+ "唤醒词",
164
+ "离线语音",
138
165
  "本地识别"
139
166
  ],
140
167
  "publishConfig": {
@@ -28,7 +28,18 @@ import { fileURLToPath } from 'node:url'
28
28
  const here = dirname(fileURLToPath(import.meta.url))
29
29
  const pkg = JSON.parse(readFileSync(join(here, '..', 'package.json'), 'utf8'))
30
30
  const anchors = pkg?.dsh?.client?.inject ?? []
31
- const targets = process.argv.slice(2).length ? process.argv.slice(2) : ['0.1.1-rc.2', '0.1.2-alpha.4']
31
+ const DEFAULT_TARGETS = [
32
+ '0.1.1-rc.2',
33
+ '0.1.2-rc.1',
34
+ '0.1.5-rc.3',
35
+ '0.1.6-alpha.2',
36
+ '0.1.7-rc.2',
37
+ '0.2.0-rc.2',
38
+ '0.2.1-rc.5',
39
+ '0.2.2-rc.1',
40
+ '0.2.2-rc.5',
41
+ ]
42
+ const targets = process.argv.slice(2).length ? process.argv.slice(2) : DEFAULT_TARGETS
32
43
 
33
44
  if (anchors.length === 0) {
34
45
  console.error('package.json 未声明 dsh.client.inject 锚点')