@ds-hu/dsh-better-voice-input 0.1.0 → 0.3.0

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
@@ -2,8 +2,9 @@
2
2
 
3
3
  [中文 →](README.md)
4
4
 
5
- **21 speech-recognition services for the DeepSeek Harness Web GUI, plus a DeepSeek-App-style
6
- hold-to-talk composer.**
5
+ **21 speech-recognition services for the DeepSeek Harness Web GUI — 7 of them with live
6
+ streaming — plus a DeepSeek-App-style hold-to-talk composer with a fly-to-composer animation and
7
+ a configurable keyboard shortcut.**
7
8
 
8
9
  ![Hold the composer to talk: blue recording overlay and red cancel overlay](https://raw.githubusercontent.com/ds-hu/dsh-better-voice-input/main/docs/preview-en.svg)
9
10
 
@@ -16,9 +17,25 @@ hold-to-talk composer.**
16
17
  you like.
17
18
  - **Hold the composer to talk.** Desktop and touch share one hold detector: hold the input box to
18
19
  get a full-screen recording overlay with a live waveform; slide up into the cancel zone and
19
- release to discard, release anywhere else to transcribe.
20
+ release to discard, release anywhere else to transcribe. With a streaming model the transcript
21
+ appears live above the overlay while you speak and flies into the composer on release.
22
+ - **7 models stream live.** Local **X-ASR** (480 ms incremental decoding) plus six cloud services
23
+ with realtime WebSocket channels: **ElevenLabs, Soniox, DashScope, OpenAI Realtime /
24
+ OpenAI-compatible, Volcengine and Tencent Cloud**. The realtime model is configured separately
25
+ from the batch model (the `streamModel` / `streamResourceId` fields in settings). If the live
26
+ channel fails, the same recording is retranscribed through the batch path, so no take is lost.
27
+ - **Configurable shortcut.** Record a key combination (for example `Ctrl+Shift+Space`) in the
28
+ settings and hold it to dictate from anywhere in a conversation; `Esc` cancels, releasing
29
+ inserts.
30
+ - **Never fights the keyboard.** On phones, holding the composer while the caret is in the input
31
+ and the virtual keyboard is open no longer starts recording (which used to push the keyboard
32
+ away and shift the overlay). Dismiss the keyboard and hold to talk; live text can be switched
33
+ off in settings.
20
34
  - **Your choice on release.** The transcript is inserted into the draft by default; a setting makes
21
35
  release send the message instead.
36
+ - **Self-hosted friendly.** The OpenAI-compatible entry takes any base URL and model name and lets
37
+ the API key stay empty, so a local X-ASR model exposed as an OpenAI
38
+ `/v1/audio/transcriptions` endpoint just works.
22
39
  - **Offline local models.** The 7 local families run entirely on this machine once downloaded —
23
40
  audio never leaves it, and no GPU is required.
24
41
  - **Keys stay on the host.** API keys entered in the settings page are written to the local config
@@ -26,35 +43,42 @@ hold-to-talk composer.**
26
43
 
27
44
  ## Settings
28
45
 
29
- ![Settings page: pick a speech service, download a local model, choose the release behavior](https://raw.githubusercontent.com/ds-hu/dsh-better-voice-input/main/docs/preview-settings.svg)
46
+ ![Settings page: pick a speech service, download a local model, choose the release behavior](https://raw.githubusercontent.com/ds-hu/dsh-better-voice-input/main/docs/preview-settings-en.svg)
30
47
 
31
48
  1. After installing, enable this plugin in **Plugins** and open its detail page → **Settings**.
32
- 2. Pick a cloud service and paste its API key (environment variables work as a fallback), or
33
- download a local model.
34
- 3. Optionally change *on release* from **insert draft** to **send**.
35
- 4. Back in a conversation, put the caret where the text should go and hold the composer.
49
+ 2. The page is split into three tabs — Services, Models and Interaction — with the dependency
50
+ status and tab bar pinned at the top. Both lists are master-detail: pick an entry first, and
51
+ only that entry's form expands in place, so a phone never scrolls through every field at once.
52
+ 3. Pick a cloud service and paste its API key (environment variables work as a fallback; the
53
+ OpenAI-compatible self-hosted entry may stay empty), or download a local model. Under
54
+ *Interaction* you can turn live text off; under *Shortcut* you can record a key combination.
55
+ 4. Back in a conversation, put the caret where the text should go and hold the composer (or hold
56
+ the shortcut).
36
57
 
37
58
  ## Cloud services
38
59
 
39
- | Provider | Default model | Environment variable |
40
- | --- | --- | --- |
41
- | SiliconFlow | `FunAudioLLM/SenseVoiceSmall` | `SILICONFLOW_API_KEY` |
42
- | Volcengine | `bigmodel` (flash) | `VOLCENGINE_API_KEY` |
43
- | ElevenLabs | `scribe_v3` | `ELEVENLABS_API_KEY` |
44
- | OpenAI | `gpt-transcribe` | `OPENAI_API_KEY` |
45
- | OpenRouter | `qwen/qwen3-asr-1.7b` | `OPENROUTER_API_KEY` |
46
- | DashScope (Alibaba Cloud) | `qwen-audio-3.1-asr-flash` | `DASHSCOPE_API_KEY` |
47
- | DeepSeek | service default | `DEEPSEEK_API_KEY` |
48
- | Google Gemini | `gemini-3.5-transcribe` | `GEMINI_API_KEY` |
49
- | Xiaomi MiMo | `mimo-v2.5-asr` | `MIMO_API_KEY` |
50
- | Tencent Cloud | engine `16k_zh` | `TENCENT_ASR_APP_ID` / `TENCENT_ASR_SECRET_ID` / `TENCENT_ASR_SECRET_KEY` |
51
- | Soniox | `stt-async-v6` | `SONIOX_API_KEY` |
52
- | StepAudio | `stepaudio-2.5-asr` | `STEPFUN_API_KEY` |
53
- | Zhipu GLM | `glm-asr-2512` | `ZHIPU_API_KEY` |
54
- | Cohere | `cohere-transcribe-03-2026` | `COHERE_API_KEY` |
55
-
56
- Every service accepts a custom base URL (proxies, regional endpoints) and its documented model,
57
- language-hint and hotword options.
60
+ | Provider | Default batch model | Realtime model | Environment variable |
61
+ | --- | --- | --- | --- |
62
+ | SiliconFlow | `FunAudioLLM/SenseVoiceSmall` | — | `SILICONFLOW_API_KEY` |
63
+ | Volcengine | `bigmodel` (flash) | `volc.seedasr.sauc.duration` resource | `VOLCENGINE_API_KEY` |
64
+ | ElevenLabs | `scribe_v3` | `scribe_v3_live` | `ELEVENLABS_API_KEY` |
65
+ | OpenAI / OpenAI-compatible | `gpt-transcribe` (editable) | `gpt-4o-mini-transcribe` | `OPENAI_API_KEY` (optional) |
66
+ | OpenRouter | `qwen/qwen3-asr-1.7b` | — | `OPENROUTER_API_KEY` |
67
+ | DashScope (Alibaba Cloud) | `qwen-audio-3.1-asr-flash` | `qwen3-asr-flash-realtime` | `DASHSCOPE_API_KEY` |
68
+ | DeepSeek | service default | — | `DEEPSEEK_API_KEY` |
69
+ | Google Gemini | `gemini-3.5-transcribe` | — | `GEMINI_API_KEY` |
70
+ | Xiaomi MiMo | `mimo-v2.5-asr` | — | `MIMO_API_KEY` |
71
+ | Tencent Cloud | engine `16k_zh` | engine `16k_zh` | `TENCENT_ASR_APP_ID` / `TENCENT_ASR_SECRET_ID` / `TENCENT_ASR_SECRET_KEY` |
72
+ | Soniox | `stt-async-v6` | `stt-rt-v6` | `SONIOX_API_KEY` |
73
+ | StepAudio | `stepaudio-2.5-asr` | — | `STEPFUN_API_KEY` |
74
+ | Zhipu GLM | `glm-asr-2512` | — | `ZHIPU_API_KEY` |
75
+ | Cohere | `cohere-transcribe-03-2026` | — | `COHERE_API_KEY` |
76
+
77
+ Most services accept a custom base URL (proxies, regional endpoints) and their documented model
78
+ and language-hint options. The OpenAI-compatible entry can point at a fully self-hosted gateway
79
+ (for example a local X-ASR model exposed through an OpenAI endpoint) with no API key at all. The
80
+ realtime model is configured independently from the batch model; "—" means the vendor has no
81
+ public realtime websocket yet and stays batch-only.
58
82
 
59
83
  ## Local models
60
84
 
package/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  [English →](README.en.md)
4
4
 
5
- 为 DeepSeek Harness 的 Web GUI 增加 **21 个语音识别服务**,并把输入框变成 DeepSeek App 那样
6
- **按住说话**的录音入口。
5
+ 为 DeepSeek Harness 的 Web GUI 增加 **21 个语音识别服务**(其中 **7 个支持实时流式转写**),并把
6
+ 输入框变成 DeepSeek App 那样**按住说话**的录音入口:支持浮层文字落位动画、可自定义的快捷键长按。
7
7
 
8
8
  ![按住输入框说话:蓝色录音浮层与上滑取消的红色浮层](https://raw.githubusercontent.com/ds-hu/dsh-better-voice-input/main/docs/preview.svg)
9
9
 
@@ -14,8 +14,19 @@
14
14
  DeepSeek),加上 7 个在本机运行的模型系列(SenseVoice、FunASR Nano、Qwen3-ASR、Parakeet、
15
15
  GigaAM、FireRedASR、X-ASR)。在插件面板里选中即用,随时切换。
16
16
  - **按住输入框说话。** 桌面与触屏共用同一套长按判定:按住输入框出现全屏录音浮层与实时波形,
17
- 上滑离开取消区、松手取消,其他位置松手开始转写。
17
+ 上滑离开取消区、松手取消,其他位置松手开始转写。挑中支持实时流式的模型时,转写文字会在
18
+ 录音过程中实时出现在浮层上方,松手后从屏幕中间平滑飞入输入框。
19
+ - **7 个模型支持实时流式。** 本地 **X-ASR**(480 ms 增量解码),加上 6 家带实时 WebSocket 通道的
20
+ 云端服务:**ElevenLabs、Soniox、阿里云百炼、OpenAI Realtime / OpenAI 兼容、火山引擎、腾讯云**。
21
+ 实时通道与批量模型分开配置(设置页里的「流式模型 / 流式资源 ID」字段),实时失败会自动改用
22
+ 整段录音走批量识别,不会丢话。
23
+ - **自定义快捷键。** 除按住输入框外,还可以在设置里录一个组合键(例如 `Ctrl+Shift+Space`),
24
+ 长按它随时开始语音输入;`Esc` 取消,松手插入。桌面、移动端行为一致。
25
+ - **不打扰输入法。** 手机点开键盘、光标在输入框里时,长按输入框不会再触发录音(避免键盘被推走、
26
+ 浮层错位);收起键盘后按住即可录音。提供开关可实时显示识别文字。
18
27
  - **松手之后由你决定。** 默认把识别结果插入草稿光标处,也可以在设置里改成松手直接发送。
28
+ - **自部署也能用。** OpenAI 兼容服务可填任意 base URL 与模型名,API Key 允许留空,直接把本地
29
+ X-ASR 之类以 OpenAI `/v1/audio/transcriptions` 暴露的模型接进来。
19
30
  - **本地模型可离线。** 7 个本地系列下载后完全在本机推理,音频不出机器;不需要 GPU。
20
31
  - **密钥留在本机。** 设置页里填写的 API Key 只写到本机配置文件,界面始终只显示掩码。
21
32
 
@@ -24,30 +35,35 @@
24
35
  ![设置页:选择语音服务、下载本地模型、选择松手行为](https://raw.githubusercontent.com/ds-hu/dsh-better-voice-input/main/docs/preview-settings.svg)
25
36
 
26
37
  1. 安装后在 **Plugins** 面板启用本插件,打开详情页 → **设置**。
27
- 2. 选择云端服务并填写 API Key(也支持环境变量兜底),或下载一个本地模型。
28
- 3. 需要的话,把「松手之后」从 **插入草稿** 改为 **直接发送**。
29
- 4. 回到对话,把光标放到要插入文字的位置,按住输入框说话。
38
+ 2. 设置页按「服务 / 模型 / 交互」分为三个分区,依赖状态与分区切换固定在顶部;
39
+ 云端/本地列表都是「先点选、再在行内展开表单」,移动端不必在几十个输入框之间找。
40
+ 3. 选择云端服务并填写 API Key(也支持环境变量兜底;OpenAI 兼容的自部署服务可留空),
41
+ 或下载一个本地模型;在「交互」里可以关闭实时文字、在「快捷键」里录一个组合键。
42
+ 4. 回到对话,把光标放到要插入文字的位置,按住输入框(或长按快捷键)说话。
30
43
 
31
44
  ## 云端服务
32
45
 
33
- | 供应商 | 默认模型 | 环境变量 |
34
- | --- | --- | --- |
35
- | SiliconFlow 硅基流动 | `FunAudioLLM/SenseVoiceSmall` | `SILICONFLOW_API_KEY` |
36
- | 火山引擎 | `bigmodel`(flash) | `VOLCENGINE_API_KEY` |
37
- | ElevenLabs | `scribe_v3` | `ELEVENLABS_API_KEY` |
38
- | OpenAI | `gpt-transcribe` | `OPENAI_API_KEY` |
39
- | OpenRouter | `qwen/qwen3-asr-1.7b` | `OPENROUTER_API_KEY` |
40
- | 阿里云百炼 | `qwen-audio-3.1-asr-flash` | `DASHSCOPE_API_KEY` |
41
- | DeepSeek | 服务默认 | `DEEPSEEK_API_KEY` |
42
- | Google Gemini | `gemini-3.5-transcribe` | `GEMINI_API_KEY` |
43
- | 小米 MiMo | `mimo-v2.5-asr` | `MIMO_API_KEY` |
44
- | 腾讯云 | 引擎 `16k_zh` | `TENCENT_ASR_APP_ID` / `TENCENT_ASR_SECRET_ID` / `TENCENT_ASR_SECRET_KEY` |
45
- | Soniox | `stt-async-v6` | `SONIOX_API_KEY` |
46
- | 阶跃星辰 | `stepaudio-2.5-asr` | `STEPFUN_API_KEY` |
47
- | 智谱 GLM | `glm-asr-2512` | `ZHIPU_API_KEY` |
48
- | Cohere | `cohere-transcribe-03-2026` | `COHERE_API_KEY` |
49
-
50
- 所有服务都支持自定义 base URL(代理、区域端点),以及各家文档化的 model、语言提示、热词等选项。
46
+ | 供应商 | 默认批量模型 | 实时流式模型 | 环境变量 |
47
+ | --- | --- | --- | --- |
48
+ | SiliconFlow 硅基流动 | `FunAudioLLM/SenseVoiceSmall` | — | `SILICONFLOW_API_KEY` |
49
+ | 火山引擎 | `bigmodel`(flash) | 资源 ID `volc.seedasr.sauc.duration` | `VOLCENGINE_API_KEY` |
50
+ | ElevenLabs | `scribe_v3` | `scribe_v3_live` | `ELEVENLABS_API_KEY` |
51
+ | OpenAI / OpenAI 兼容 | `gpt-transcribe`(可自定义) | `gpt-4o-mini-transcribe` | `OPENAI_API_KEY`(可留空) |
52
+ | OpenRouter | `qwen/qwen3-asr-1.7b` | — | `OPENROUTER_API_KEY` |
53
+ | 阿里云百炼 | `qwen-audio-3.1-asr-flash` | `qwen3-asr-flash-realtime` | `DASHSCOPE_API_KEY` |
54
+ | DeepSeek | 服务默认 | — | `DEEPSEEK_API_KEY` |
55
+ | Google Gemini | `gemini-3.5-transcribe` | — | `GEMINI_API_KEY` |
56
+ | 小米 MiMo | `mimo-v2.5-asr` | — | `MIMO_API_KEY` |
57
+ | 腾讯云 | 引擎 `16k_zh` | 引擎 `16k_zh` | `TENCENT_ASR_APP_ID` / `TENCENT_ASR_SECRET_ID` / `TENCENT_ASR_SECRET_KEY` |
58
+ | Soniox | `stt-async-v6` | `stt-rt-v6` | `SONIOX_API_KEY` |
59
+ | 阶跃星辰 | `stepaudio-2.5-asr` | — | `STEPFUN_API_KEY` |
60
+ | 智谱 GLM | `glm-asr-2512` | — | `ZHIPU_API_KEY` |
61
+ | Cohere | `cohere-transcribe-03-2026` | — | `COHERE_API_KEY` |
62
+
63
+ 多数服务支持自定义 base URL(代理、区域端点)与文档化的 model、语言提示等选项;OpenAI 兼容
64
+ 一项可以完整指向自建网关(例如把本地 X-ASR 模型以 OpenAI 接口暴露),无需 API Key。
65
+ 实时流式模型独立于批量模型配置;「—」表示该供应商暂无公开的实时 WebSocket 接口,仍可正常
66
+ 批量识别。
51
67
 
52
68
  ## 本地模型
53
69
 
@@ -81,7 +97,8 @@ dsh plugin --profile <profile> add @ds-hu/dsh-better-voice-input
81
97
  ## 环境要求
82
98
 
83
99
  - DeepSeek Harness **>= 0.2.2-rc.5 < 0.3.0**,Node.js **>= 20.19**。
84
- - 使用按住说话需要支持 `getUserMedia` 的浏览器(DSH Web GUI)。
100
+ - 使用按住说话需要支持 `getUserMedia` 的浏览器(DSH Web GUI);流式实时文字还需要
101
+ `AudioWorklet`,不支持时自动退回整段识别,功能不受影响。
85
102
  - 本地模型需要磁盘空间(视变体约几百 MB 到 2 GB)与 CPU,无需 GPU。
86
103
 
87
104
  ## 隐私
@@ -1,6 +1,6 @@
1
1
  # Architecture — better voice input for DSH
2
2
 
3
- Status: design of record for v0.1. Everything here is plain ESM JavaScript, no build step.
3
+ Status: design of record for v0.3. Everything here is plain ESM JavaScript, no build step.
4
4
 
5
5
  ## 1. Product
6
6
 
@@ -94,7 +94,23 @@ settings page reports the missing official dependency.
94
94
  provider-specific container/base64 handling live in the request builder of each adapter.
95
95
  Providers that need a different container get an adapter-specific conversion path documented
96
96
  in `docs/research/cloud-providers.md`.
97
+ - Credentials are optional per field: `bvi-cloud-openai` doubles as the OpenAI-compatible
98
+ self-hosted entry (editable `baseURL`/`model`, empty `apiKey` → no `Authorization` header), so a
99
+ local X-ASR gateway exposed as an OpenAI `/v1/audio/transcriptions` server can be selected
100
+ directly.
97
101
  - Failures throw `Error` messages that the service relays to the UI (no secrets, bounded length).
102
+ - Realtime (v0.3): six vendors also expose a live websocket channel through the optional
103
+ `provider.bviStreaming` extension — ElevenLabs, Soniox, DashScope, OpenAI Realtime,
104
+ Volcengine and Tencent. `lib/catalog.js` joins each `streaming: true` record with its protocol
105
+ module; `lib/streaming/session.js` owns the vendor-neutral lifecycle (credential resolution,
106
+ language check, `ws` handshake with a 10 s timeout, cumulative partials, one terminal state,
107
+ 15 s finish deadline), `lib/streaming/socket.js` is the only `ws` import, and each vendor file
108
+ is a pure frame codec (`url/headers/open/push/finish/message/close`) that sends and parses its
109
+ own protocol through the session's `emit.send`/`emit.partial`/`emit.final`/`emit.fail`
110
+ callbacks. A failed live take is not fatal: the input component retranscribes the same
111
+ recording through the batch path, so `streaming: true` never means "live text or nothing".
112
+ Protocol table and settings fields: `docs/CONTRACTS.md`; wire details:
113
+ `docs/research/cloud-providers.md` §0.2 and each vendor section.
98
114
 
99
115
  ### 3.4 Local providers (`local`)
100
116
 
@@ -114,6 +130,11 @@ settings page reports the missing official dependency.
114
130
  handshake, a serial decode queue, inference/idle timeouts, crash restart and termination on
115
131
  plugin unload or variant switch. Switching variants stops the old worker before starting the new
116
132
  one; only the selected family is resident at a time.
133
+ - Streaming (v0.2): X-ASR's `OnlineRecognizer` is also served incrementally. The worker gains
134
+ four authenticated loopback routes (`/stream/start|chunk|finish|cancel`, PCM16LE 16 kHz);
135
+ `worker/runtime.js` forwards them and `provider.js` exposes the optional `bviStreaming`
136
+ extension described in `docs/CONTRACTS.md`. The recognizer configuration is unchanged — the
137
+ streaming path reuses the exact X-ASR config. Other families stay batch-only.
117
138
  - VAD: the shared Silero VAD asset is downloaded alongside the model and used to cut long
118
139
  recordings into 15–24 s segments for the families that truncate long inputs (FunASR Nano,
119
140
  Qwen3-ASR); the others decode the whole utterance. Exact per-family configuration, language
@@ -125,7 +146,7 @@ settings page reports the missing official dependency.
125
146
 
126
147
  ### 3.5 Service HTTP API (`service`)
127
148
 
128
- Registered as seven exact Fetch routes through `ctx.connection.fetch.register({ path, methods,
149
+ Registered as eleven exact Fetch routes through `ctx.connection.fetch.register({ path, methods,
129
150
  requestBody: 'buffered', fetch })` (`inject = ['connection']`), each under
130
151
  `/api/better-voice-input/`. The connection layer owns the Host/Origin fence and browser
131
152
  authentication (owner Peer only), so the handlers carry no hand-written same-origin check; the
@@ -140,9 +161,15 @@ a 4xx/5xx with `{ ok: false, code, message }`.
140
161
  | `POST /prepare` | `{ providerId, downloadSource? }` — `ctx.speechToText.prepare(...)` |
141
162
  | `POST /cancel-preparation` | `{ providerId }` |
142
163
  | `POST /transcribe?language=auto` | raw `audio/wav` body (≤ `limits.maxAudioBytes`) — canonical WAV validation then `ctx.speechToText.transcribe`, returns `{ ok: true, text, audioSeconds, inferenceSeconds }` |
143
- | `POST /preferences` | `{ releaseAction?, holdDelayMs?, cancelDistancePx?, hintDismissed?, composerHint? }` |
144
-
145
- A JSON `{ audioBase64 }` body is also accepted on `/transcribe` for tests and as a fallback
164
+ | `POST /preferences` | partial preferences (`releaseAction`, `holdDelayMs`, `cancelDistancePx`, `hintDismissed`, `composerHint`, `streaming`, `shortcut`) |
165
+ | `POST /stream/start` | `{ providerId?, language? }` — open a live session for a `streaming` provider |
166
+ | `POST /stream/chunk?session=…` | raw PCM16LE mono 16 kHz, ≤ 1 MiB — `{ partial }` |
167
+ | `POST /stream/finish?session=…` | final `{ text, audioSeconds, inferenceSeconds }` |
168
+ | `POST /stream/cancel?session=…` | abort + dispose |
169
+
170
+ Streaming sessions are held in memory by the `api` closure (max four, 120 s idle TTL, disposed
171
+ on row unload), so no browser state outlives a recording and no Host file is written. A JSON
172
+ `{ audioBase64 }` body is also accepted on `/transcribe` for tests and as a fallback
146
173
  carrier; base64 is decoded and validated the same way. `GET /state` is polled by the settings page
147
174
  (1.5 s) while a preparation is running and once on open. It is cheap: in-memory snapshot + one
148
175
  small file read.
@@ -153,14 +180,19 @@ Registered into `plugins.bundle.config` keyed by `@ds-hu/dsh-better-voice-input`
153
180
  official `VoicePreparation` page pattern. Sections:
154
181
 
155
182
  1. **依赖状态** — official speech-to-text service present? selected provider + language.
156
- 2. **云端服务** — one card per vendor: configured/unconfigured badge, API key (write-only +
157
- masked display), base URL, model, vendor-specific fields, env fallback hint, docs link.
158
- 3. **本地模型** — one card per family: variant selector, download / cancel / progress, runtime
159
- readiness, languages and disk/memory estimate.
183
+ 2. **云端服务** — master-detail: a compact provider list (name + configured badge) plus the
184
+ detail card of the **selected** provider only (API key write-only + masked, base URL, model,
185
+ vendor fields, env hint, docs link, save). Nothing is flattened all at once, so a phone only
186
+ scrolls through the list it is choosing from.
187
+ 3. **本地模型** — same master-detail pattern: model list (name, variant, install badge) and a
188
+ detail pane with variant selector, download / cancel / retry, progress, languages and
189
+ disk/memory estimate.
160
190
  4. **交互** — release action (insert draft / send, default insert), hold delay, slide-up cancel
161
- distance, composer placeholder hint (`composerHint`, default on: “发消息或按住说话”), first-run
162
- hint reset.
163
- 5. **说明** — audio destination per provider (cloud upload vs local), dependency on the
191
+ distance, composer placeholder hint (`composerHint`, default on: “发消息或按住说话”), live
192
+ streaming display toggle (`streaming`, default on), first-run hint reset.
193
+ 5. **快捷键** — enable/disable, record a long-press combination, show its label (e.g.
194
+ `Ctrl+Shift+Space`); validation rejects bare letters/space.
195
+ 6. **说明** — audio destination per provider (cloud upload vs local), dependency on the
164
196
  official plugin, where data is written.
165
197
 
166
198
  Only theme tokens (`--dsw-*`) are used; controls are written locally (no Harness client imports).
@@ -186,6 +218,12 @@ slot contract). The slot id is stable, so re-registration on graph updates is id
186
218
  - Start conditions: primary button only; not inside an interactive control (`button`, `a`,
187
219
  `input`, `select`, `[role=button]`, `[contenteditable=false]`); composer editable and not
188
220
  disabled; no active session; not while a transcript is being inserted.
221
+ - **Focused-editor guard (v0.2)**: on touch/pen the hold never starts when the composer editor
222
+ has focus or the virtual keyboard is open (`visualViewport` height materially shorter than
223
+ `innerHeight`). The keyboard would otherwise be pushed away mid-gesture, moving the overlay
224
+ and losing the user's cursor. Desktop mouse users keep the gesture while the editor is focused
225
+ (no software keyboard). A first tap focuses the editor as usual; the user dismisses the
226
+ keyboard (tap outside / back) and then holds to speak.
189
227
  - Hold window: default 280 ms (`preferences.holdDelayMs`), movement <= 8 px, pointer not
190
228
  released/cancelled, window not blurred.
191
229
  - On hold commit: suppress `contextmenu`/`selectstart`, clear the text selection, add a
@@ -196,6 +234,12 @@ slot contract). The slot id is stable, so re-registration on graph updates is id
196
234
  Escape, window blur and tab hide cancel. Page scroll is prevented during the session.
197
235
  - Desktop and mobile share this exact state machine; the only platform-specific inputs are the
198
236
  pointer events themselves and optional `navigator.vibrate(10)`.
237
+ - **Keyboard shortcut (v0.2)**: `preferences.shortcut` (e.g. hold `Ctrl+Shift+Space`) starts the
238
+ same hold flow from a `keydown` (`event.code` + modifiers, no repeat) and releases on `keyup`;
239
+ Escape cancels. It only fires while a composer exists and the active element is the composer,
240
+ its card or `document.body` — settings inputs and other forms keep typing normally. The
241
+ shortcut hold duration is the same `holdDelayMs`. Because the pipeline is shared, insert/send,
242
+ cancel, streaming and toasts behave identically for pointer and keyboard triggers.
199
243
 
200
244
  ### 4.3 Overlay states (DeepSeek App replication)
201
245
 
@@ -207,6 +251,8 @@ Full-screen (100dvh, safe-area aware), portal to body:
207
251
  | recording | deep navy -> electric blue gradient | `松手插入,上滑取消` (or `松手发送,…`) | live waveform bars |
208
252
  | cancel-armed | deep maroon -> red gradient | `松手取消` | waveform bars in red |
209
253
  | transcribing | last gradient | `正在识别…` | soft pulsing dots |
254
+ | streaming | recording gradient | `松手插入,上滑取消` | live cumulative transcript above the waveform, updating as chunks arrive |
255
+ | settling | recording gradient fading | — | final line cloned into a `.bvi-flight` element and flown to the composer input (~360 ms), then inserted |
210
256
  | error | last gradient | failure sentence | dismiss on tap/release |
211
257
 
212
258
  Motion: 160 ms fade in, 200 ms gradient crossfade, waveform driven by a 60 fps meter from the
@@ -219,6 +265,12 @@ reference; text is centered around 38 % of the viewport height, waveform band ar
219
265
  autoGainControl: true } })`; AudioContext kept alive (unlocked from the initial pointer gesture
220
266
  so iOS/desktop autoplay policies are satisfied), AudioWorklet (inline blob module) captures
221
267
  Float32 frames and posts RMS/peak meter values at ~30 Hz.
268
+ - Two capture modes share one microphone: **batch** keeps `MediaRecorder` and produces the
269
+ canonical WAV at release; **streaming** (v0.3, selected provider declares `streaming` — local
270
+ X-ASR or one of the six cloud realtime vendors) taps the AudioWorklet Float32 frames,
271
+ downsamples to 16 kHz, chunks every ~200 ms and POSTs them to `/stream/chunk`. If
272
+ `AudioWorklet` is unavailable, or `/stream/start` fails, the recording transparently falls
273
+ back to batch. The waveform meter works in both modes.
222
274
  - Stop: disconnect tracks, resample to 16 kHz linear interpolation, encode canonical mono PCM16
223
275
  WAV (44-byte header), enforce `limits.maxAudioBytes`/`maxDurationSeconds`.
224
276
  - The recording limit auto-finishes the take instead of dropping it.
@@ -227,6 +279,12 @@ reference; text is centered around 38 % of the viewport height, waveform band ar
227
279
 
228
280
  ### 4.5 Result handling
229
281
 
282
+ - Streaming: `finish` returns the final transcript; a DOM flight clone animates the last live
283
+ line into the composer, then the normal insertion runs (reduced-motion skips the animation).
284
+ Slide-up cancel or Escape calls `/stream/cancel` and inserts nothing. If the live session
285
+ fails or times out (handshake, vendor error, 15 s finish deadline), the same recording is
286
+ retranscribed through `/transcribe` and inserted normally; the user sees live text only when
287
+ the channel actually works.
230
288
  - `insert` (default): `inputActions.insertText(text, inputActions.captureInsertion())`; if the
231
289
  draft moved concurrently, fall back to `setDraft(current + text)`; empty/whitespace -> notice.
232
290
  - `send`: insert with the same guards, then `inputActions.submit()` on the next microtask.
@@ -251,19 +309,25 @@ reference; text is centered around 38 % of the viewport height, waveform band ar
251
309
  request/response adapters against a local mock HTTP server, service API/host against a fake
252
310
  `speechToText` service, local catalog/provision/worker protocol and recognizer-config builders
253
311
  (no native load), both browser entries loaded in a `vm` harness (factory contract, placement,
254
- gesture state machine, WAV encoder, preference handling), and one cross-component test that
255
- holds the 21-provider and release/documentation contracts together.
312
+ gesture state machine, WAV encoder, preference handling), streaming session relays and the
313
+ optional-credential path, the six cloud realtime frame codecs against the shared session
314
+ harness (no network: fake socket + fake protocol), and one cross-component test that holds the
315
+ 21-provider and release/documentation contracts together.
256
316
  - `npm run lint` is part of `npm run check`; CI (`.github/workflows/ci.yml`) is the only place
257
317
  these run, on Node 20 and 22.
258
318
  - `.github/workflows/release.yml` publishes core -> service/cloud/local/input -> bundle on a `v*`
259
319
  tag, then creates the GitHub release.
260
- - Optional `workflow_dispatch` smoke workflow (`local-models-smoke.yml`) downloads a pinned model
261
- (or every family, one dispatch at a time) and runs one real transcription; it never runs on PRs.
262
- Evidence for every catalog variant is recorded in `docs/VERIFICATION.md`.
320
+ - Optional `workflow_dispatch` smoke workflows: `local-models-smoke.yml` downloads a pinned model
321
+ (or every family, one dispatch at a time) and runs one real transcription;
322
+ `openai-compat-smoke.yml` downloads the pinned X-ASR model, serves it through a local
323
+ OpenAI-compatible `/v1/audio/transcriptions` endpoint, drives the real `bvi-cloud-openai`
324
+ adapter with an **empty API key**, and asserts the transcript plus the absence of an
325
+ authorization header. Neither runs on PRs. Evidence is recorded in `docs/VERIFICATION.md`.
263
326
 
264
- ## 7. Non-goals for v0.1
327
+ ## 7. Non-goals for v0.3
265
328
 
266
- - Streaming/partial transcripts (the reference app also shows no partial text).
329
+ - Realtime channels for vendors without a documented public websocket (the other eight cloud
330
+ entries) — they stay batch-only; `streaming` is a per-record catalog fact, not a universal mode.
267
331
  - Selecting a browser microphone device (system default only).
268
332
  - Downloading models in the browser; all model I/O stays on the host.
269
333
  - Replacing the official recording component (both can coexist; keep the official bundle's