@ds-hu/dsh-better-voice-input 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/NOTICE +31 -0
- package/README.en.md +129 -0
- package/README.md +112 -2
- package/cordis.patch.yml +34 -0
- package/docs/ARCHITECTURE.md +318 -0
- package/docs/CONTRACTS.md +437 -0
- package/docs/DETAIL.md +83 -0
- package/docs/DETAIL.zh.md +68 -0
- package/docs/VERIFICATION.md +85 -0
- package/docs/preview-en.svg +100 -0
- package/docs/preview-settings-en.svg +69 -0
- package/docs/preview-settings.svg +69 -0
- package/docs/preview.svg +100 -0
- package/icon.svg +9 -0
- package/lib/index.js +2 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +85 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 the dsh-better-voice-input authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
dsh-better-voice-input
|
|
2
|
+
Copyright (c) 2026 the dsh-better-voice-input authors
|
|
3
|
+
|
|
4
|
+
The `icon.svg` and `docs/preview*.svg` artwork is original to this project and is
|
|
5
|
+
distributed under the same MIT license as the rest of the package.
|
|
6
|
+
|
|
7
|
+
This project is a plugin for DeepSeek Harness and extends the official
|
|
8
|
+
experimental voice input bundle. The DeepSeek Harness packages it integrates
|
|
9
|
+
with are licensed under the MIT License:
|
|
10
|
+
https://github.com/deepseek-ai/deepseek-harness
|
|
11
|
+
|
|
12
|
+
The local-model runtime uses sherpa-onnx through the `sherpa-onnx-node` npm
|
|
13
|
+
package. sherpa-onnx is Copyright (c) 2023-2026 k2-fsa and is licensed under the
|
|
14
|
+
Apache License, Version 2.0:
|
|
15
|
+
https://github.com/k2-fsa/sherpa-onnx
|
|
16
|
+
|
|
17
|
+
Local speech models are downloaded by the user's explicit request from the
|
|
18
|
+
upstream sherpa-onnx model releases on Hugging Face, not redistributed in this
|
|
19
|
+
package. Each model keeps its own license and attribution, which the settings
|
|
20
|
+
page links to:
|
|
21
|
+
https://huggingface.co/csukuangfj
|
|
22
|
+
|
|
23
|
+
The provider/model list follows BryceWG/BiBi-Keyboard ("说点啥"), an Android
|
|
24
|
+
voice-input project licensed under the Apache License, Version 2.0. Only its
|
|
25
|
+
public model/provider list and public vendor API facts were used as a reference;
|
|
26
|
+
no Android implementation or user-interface code was copied:
|
|
27
|
+
https://github.com/BryceWG/BiBi-Keyboard
|
|
28
|
+
|
|
29
|
+
Cloud providers are implemented against each vendor's public HTTP API; their
|
|
30
|
+
names and trademarks belong to their owners. No endorsement by any vendor is
|
|
31
|
+
implied.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Better voice input
|
|
2
|
+
|
|
3
|
+
[中文 →](README.md)
|
|
4
|
+
|
|
5
|
+
**21 speech-recognition services for the DeepSeek Harness Web GUI, plus a DeepSeek-App-style
|
|
6
|
+
hold-to-talk composer with live streaming text, a fly-to-composer animation and a configurable
|
|
7
|
+
keyboard shortcut.**
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## What you get
|
|
12
|
+
|
|
13
|
+
- **21 speech-recognition services.** 14 cloud APIs (OpenAI, Volcengine, DashScope, Tencent Cloud,
|
|
14
|
+
Zhipu, ElevenLabs, Gemini, SiliconFlow, Soniox, StepAudio, Cohere, OpenRouter, Xiaomi MiMo,
|
|
15
|
+
DeepSeek) and 7 model families that run on your machine (SenseVoice, FunASR Nano, Qwen3-ASR,
|
|
16
|
+
Parakeet, GigaAM, FireRedASR, X-ASR). Pick one in the Plugins settings page and switch whenever
|
|
17
|
+
you like.
|
|
18
|
+
- **Hold the composer to talk.** Desktop and touch share one hold detector: hold the input box to
|
|
19
|
+
get a full-screen recording overlay with a live waveform; slide up into the cancel zone and
|
|
20
|
+
release to discard, release anywhere else to transcribe. With a streaming model (X-ASR) the
|
|
21
|
+
transcript appears live above the overlay while you speak and flies into the composer on release.
|
|
22
|
+
- **Configurable shortcut.** Record a key combination (for example `Ctrl+Shift+Space`) in the
|
|
23
|
+
settings and hold it to dictate from anywhere in a conversation; `Esc` cancels, releasing
|
|
24
|
+
inserts.
|
|
25
|
+
- **Never fights the keyboard.** On phones, holding the composer while the caret is in the input
|
|
26
|
+
and the virtual keyboard is open no longer starts recording (which used to push the keyboard
|
|
27
|
+
away and shift the overlay). Dismiss the keyboard and hold to talk; live text can be switched
|
|
28
|
+
off in settings.
|
|
29
|
+
- **Your choice on release.** The transcript is inserted into the draft by default; a setting makes
|
|
30
|
+
release send the message instead.
|
|
31
|
+
- **Self-hosted friendly.** The OpenAI-compatible entry takes any base URL and model name and lets
|
|
32
|
+
the API key stay empty, so a local X-ASR model exposed as an OpenAI
|
|
33
|
+
`/v1/audio/transcriptions` endpoint just works.
|
|
34
|
+
- **Offline local models.** The 7 local families run entirely on this machine once downloaded —
|
|
35
|
+
audio never leaves it, and no GPU is required.
|
|
36
|
+
- **Keys stay on the host.** API keys entered in the settings page are written to the local config
|
|
37
|
+
file and only ever shown masked.
|
|
38
|
+
|
|
39
|
+
## Settings
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
1. After installing, enable this plugin in **Plugins** and open its detail page → **Settings**.
|
|
44
|
+
2. Both lists are master-detail: pick a model first, then only that model's form appears, so a
|
|
45
|
+
phone never scrolls through every field at once.
|
|
46
|
+
3. Pick a cloud service and paste its API key (environment variables work as a fallback; the
|
|
47
|
+
OpenAI-compatible self-hosted entry may stay empty), or download a local model. Under
|
|
48
|
+
*Interaction* you can turn live text off; under *Shortcut* you can record a key combination.
|
|
49
|
+
4. Back in a conversation, put the caret where the text should go and hold the composer (or hold
|
|
50
|
+
the shortcut).
|
|
51
|
+
|
|
52
|
+
## Cloud services
|
|
53
|
+
|
|
54
|
+
| Provider | Default model | Environment variable |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| SiliconFlow | `FunAudioLLM/SenseVoiceSmall` | `SILICONFLOW_API_KEY` |
|
|
57
|
+
| Volcengine | `bigmodel` (flash) | `VOLCENGINE_API_KEY` |
|
|
58
|
+
| ElevenLabs | `scribe_v3` | `ELEVENLABS_API_KEY` |
|
|
59
|
+
| OpenAI / OpenAI-compatible | `gpt-transcribe` (editable) | `OPENAI_API_KEY` (optional) |
|
|
60
|
+
| OpenRouter | `qwen/qwen3-asr-1.7b` | `OPENROUTER_API_KEY` |
|
|
61
|
+
| DashScope (Alibaba Cloud) | `qwen-audio-3.1-asr-flash` | `DASHSCOPE_API_KEY` |
|
|
62
|
+
| DeepSeek | service default | `DEEPSEEK_API_KEY` |
|
|
63
|
+
| Google Gemini | `gemini-3.5-transcribe` | `GEMINI_API_KEY` |
|
|
64
|
+
| Xiaomi MiMo | `mimo-v2.5-asr` | `MIMO_API_KEY` |
|
|
65
|
+
| Tencent Cloud | engine `16k_zh` | `TENCENT_ASR_APP_ID` / `TENCENT_ASR_SECRET_ID` / `TENCENT_ASR_SECRET_KEY` |
|
|
66
|
+
| Soniox | `stt-async-v6` | `SONIOX_API_KEY` |
|
|
67
|
+
| StepAudio | `stepaudio-2.5-asr` | `STEPFUN_API_KEY` |
|
|
68
|
+
| Zhipu GLM | `glm-asr-2512` | `ZHIPU_API_KEY` |
|
|
69
|
+
| Cohere | `cohere-transcribe-03-2026` | `COHERE_API_KEY` |
|
|
70
|
+
|
|
71
|
+
Most services accept a custom base URL (proxies, regional endpoints) and their documented model
|
|
72
|
+
and language-hint options. The OpenAI-compatible entry can point at a fully self-hosted gateway
|
|
73
|
+
(for example a local X-ASR model exposed through an OpenAI endpoint) with no API key at all.
|
|
74
|
+
|
|
75
|
+
## Local models
|
|
76
|
+
|
|
77
|
+
| Family | Languages | Variants |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| SenseVoice | auto, zh, en, ja, ko, yue | small int8 / small full |
|
|
80
|
+
| FunASR Nano | auto, zh, en | nano int8 / multilingual int8 |
|
|
81
|
+
| Qwen3-ASR | auto, zh, en, and more | 0.6B int8 / 1.7B int8 |
|
|
82
|
+
| Parakeet | en | 0.6B v2 int8 / v3 int8 |
|
|
83
|
+
| GigaAM | ru | v3 Russian |
|
|
84
|
+
| FireRedASR | zh, en | FireRedASR2 CTC int8 |
|
|
85
|
+
| X-ASR | zh, en | streaming 480 ms |
|
|
86
|
+
|
|
87
|
+
Models are downloaded on first use and verified file by file; the settings page shows each
|
|
88
|
+
variant's download size and links its upstream license.
|
|
89
|
+
|
|
90
|
+
## Install
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
dsh plugin --profile <profile> add @ds-hu/dsh-better-voice-input
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Then add the bundle to that profile's `dsh.profile.bundles` and restart `dsh web`:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{ "dsh": { "profile": { "bundles": ["…", "@ds-hu/dsh-better-voice-input"] } } }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Keep the official **Voice input** bundle enabled (this plugin extends its speech-to-text registry)
|
|
103
|
+
and enable **Better voice input**. The official mic button can be disabled; the two recording
|
|
104
|
+
entries do not interfere with each other.
|
|
105
|
+
|
|
106
|
+
## Requirements
|
|
107
|
+
|
|
108
|
+
- DeepSeek Harness **>= 0.2.2-rc.5 < 0.3.0**, Node.js **>= 20.19**.
|
|
109
|
+
- A browser with `getUserMedia` (the DSH Web GUI) for hold-to-talk.
|
|
110
|
+
- Local models need disk space (a few hundred MB up to ~2 GB depending on the variant) and a CPU;
|
|
111
|
+
no GPU required.
|
|
112
|
+
|
|
113
|
+
## Privacy
|
|
114
|
+
|
|
115
|
+
Speech is sent only to the service you selected: the cloud endpoint you configured, or a local
|
|
116
|
+
model running on your own machine. There is no telemetry and no third-party relay. API keys live in
|
|
117
|
+
the host config file (`0600`) and the browser only sees masks. Local models come from the upstream
|
|
118
|
+
sherpa-onnx repositories and are verified against pinned digests.
|
|
119
|
+
|
|
120
|
+
## Documentation
|
|
121
|
+
|
|
122
|
+
- [Architecture](docs/ARCHITECTURE.md) — technical design, component boundaries, HTTP API
|
|
123
|
+
- [Module contracts](docs/CONTRACTS.md)
|
|
124
|
+
- [Verification record](docs/VERIFICATION.md) — CI gates and the real download + inference runs for all 11 local variants
|
|
125
|
+
- [NOTICE](NOTICE) — third-party attribution and model licenses
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT.
|
package/README.md
CHANGED
|
@@ -1,3 +1,113 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 更好的语音输入
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English →](README.en.md)
|
|
4
|
+
|
|
5
|
+
为 DeepSeek Harness 的 Web GUI 增加 **21 个语音识别服务**,并把输入框变成 DeepSeek App 那样
|
|
6
|
+
**按住说话**的录音入口:支持实时流式转写、浮层文字落位动画,以及可自定义的快捷键长按。
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
## 功能
|
|
11
|
+
|
|
12
|
+
- **21 个语音识别服务。** 14 家云端接口(OpenAI、火山引擎、阿里云百炼、腾讯云、智谱、
|
|
13
|
+
ElevenLabs、Gemini、SiliconFlow、Soniox、阶跃星辰、Cohere、OpenRouter、小米 MiMo、
|
|
14
|
+
DeepSeek),加上 7 个在本机运行的模型系列(SenseVoice、FunASR Nano、Qwen3-ASR、Parakeet、
|
|
15
|
+
GigaAM、FireRedASR、X-ASR)。在插件面板里选中即用,随时切换。
|
|
16
|
+
- **按住输入框说话。** 桌面与触屏共用同一套长按判定:按住输入框出现全屏录音浮层与实时波形,
|
|
17
|
+
上滑离开取消区、松手取消,其他位置松手开始转写。挑中支持流式的模型(X-ASR)时,转写文字会
|
|
18
|
+
在录音过程中实时出现在浮层上方,松手后从屏幕中间平滑飞入输入框。
|
|
19
|
+
- **自定义快捷键。** 除按住输入框外,还可以在设置里录一个组合键(例如 `Ctrl+Shift+Space`),
|
|
20
|
+
长按它随时开始语音输入;`Esc` 取消,松手插入。桌面、移动端行为一致。
|
|
21
|
+
- **不打扰输入法。** 手机点开键盘、光标在输入框里时,长按输入框不会再触发录音(避免键盘被推走、
|
|
22
|
+
浮层错位);收起键盘后按住即可录音。提供开关可实时显示识别文字。
|
|
23
|
+
- **松手之后由你决定。** 默认把识别结果插入草稿光标处,也可以在设置里改成松手直接发送。
|
|
24
|
+
- **自部署也能用。** OpenAI 兼容服务可填任意 base URL 与模型名,API Key 允许留空,直接把本地
|
|
25
|
+
X-ASR 之类以 OpenAI `/v1/audio/transcriptions` 暴露的模型接进来。
|
|
26
|
+
- **本地模型可离线。** 7 个本地系列下载后完全在本机推理,音频不出机器;不需要 GPU。
|
|
27
|
+
- **密钥留在本机。** 设置页里填写的 API Key 只写到本机配置文件,界面始终只显示掩码。
|
|
28
|
+
|
|
29
|
+
## 设置
|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
1. 安装后在 **Plugins** 面板启用本插件,打开详情页 → **设置**。
|
|
34
|
+
2. 云端/本地两个列表都是「先选模型、再显示设置」:点选一个模型后才展开它自己的表单,
|
|
35
|
+
移动端不必在几十个输入框之间找。
|
|
36
|
+
3. 选择云端服务并填写 API Key(也支持环境变量兜底;OpenAI 兼容的自部署服务可留空),
|
|
37
|
+
或下载一个本地模型;在「交互」里可以关闭实时文字、在「快捷键」里录一个组合键。
|
|
38
|
+
4. 回到对话,把光标放到要插入文字的位置,按住输入框(或长按快捷键)说话。
|
|
39
|
+
|
|
40
|
+
## 云端服务
|
|
41
|
+
|
|
42
|
+
| 供应商 | 默认模型 | 环境变量 |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| SiliconFlow 硅基流动 | `FunAudioLLM/SenseVoiceSmall` | `SILICONFLOW_API_KEY` |
|
|
45
|
+
| 火山引擎 | `bigmodel`(flash) | `VOLCENGINE_API_KEY` |
|
|
46
|
+
| ElevenLabs | `scribe_v3` | `ELEVENLABS_API_KEY` |
|
|
47
|
+
| OpenAI / OpenAI 兼容 | `gpt-transcribe`(可自定义) | `OPENAI_API_KEY`(可留空) |
|
|
48
|
+
| OpenRouter | `qwen/qwen3-asr-1.7b` | `OPENROUTER_API_KEY` |
|
|
49
|
+
| 阿里云百炼 | `qwen-audio-3.1-asr-flash` | `DASHSCOPE_API_KEY` |
|
|
50
|
+
| DeepSeek | 服务默认 | `DEEPSEEK_API_KEY` |
|
|
51
|
+
| Google Gemini | `gemini-3.5-transcribe` | `GEMINI_API_KEY` |
|
|
52
|
+
| 小米 MiMo | `mimo-v2.5-asr` | `MIMO_API_KEY` |
|
|
53
|
+
| 腾讯云 | 引擎 `16k_zh` | `TENCENT_ASR_APP_ID` / `TENCENT_ASR_SECRET_ID` / `TENCENT_ASR_SECRET_KEY` |
|
|
54
|
+
| Soniox | `stt-async-v6` | `SONIOX_API_KEY` |
|
|
55
|
+
| 阶跃星辰 | `stepaudio-2.5-asr` | `STEPFUN_API_KEY` |
|
|
56
|
+
| 智谱 GLM | `glm-asr-2512` | `ZHIPU_API_KEY` |
|
|
57
|
+
| Cohere | `cohere-transcribe-03-2026` | `COHERE_API_KEY` |
|
|
58
|
+
|
|
59
|
+
多数服务支持自定义 base URL(代理、区域端点)与文档化的 model、语言提示等选项;OpenAI 兼容
|
|
60
|
+
一项可以完整指向自建网关(例如把本地 X-ASR 模型以 OpenAI 接口暴露),无需 API Key。
|
|
61
|
+
|
|
62
|
+
## 本地模型
|
|
63
|
+
|
|
64
|
+
| 系列 | 语言 | 变体 |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
| SenseVoice | auto、zh、en、ja、ko、yue | small int8 / small full |
|
|
67
|
+
| FunASR Nano | auto、zh、en | nano int8 / 多语 int8 |
|
|
68
|
+
| Qwen3-ASR | auto、zh、en 等 | 0.6B int8 / 1.7B int8 |
|
|
69
|
+
| Parakeet | en | 0.6B v2 int8 / v3 int8 |
|
|
70
|
+
| GigaAM | ru | v3 Russian |
|
|
71
|
+
| FireRedASR | zh、en | FireRedASR2 CTC int8 |
|
|
72
|
+
| X-ASR | zh、en | 流式 480 ms |
|
|
73
|
+
|
|
74
|
+
模型首次使用时下载到本机并逐文件校验,设置页会给出下载体积与上游许可证链接。
|
|
75
|
+
|
|
76
|
+
## 安装
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
dsh plugin --profile <profile> add @ds-hu/dsh-better-voice-input
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
把 bundle 加入该 profile 的 `dsh.profile.bundles`,重启 `dsh web`:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{ "dsh": { "profile": { "bundles": ["…", "@ds-hu/dsh-better-voice-input"] } } }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
保持官方**语音输入** bundle 启用(本插件扩展它的语音识别注册表),再启用**更好的语音输入**。
|
|
89
|
+
官方的麦克风按钮可以关闭,两者的录音入口互不影响。
|
|
90
|
+
|
|
91
|
+
## 环境要求
|
|
92
|
+
|
|
93
|
+
- DeepSeek Harness **>= 0.2.2-rc.5 < 0.3.0**,Node.js **>= 20.19**。
|
|
94
|
+
- 使用按住说话需要支持 `getUserMedia` 的浏览器(DSH Web GUI);流式实时文字还需要
|
|
95
|
+
`AudioWorklet`,不支持时自动退回整段识别,功能不受影响。
|
|
96
|
+
- 本地模型需要磁盘空间(视变体约几百 MB 到 2 GB)与 CPU,无需 GPU。
|
|
97
|
+
|
|
98
|
+
## 隐私
|
|
99
|
+
|
|
100
|
+
语音只会发送到你选中的服务:你配置的云端接口,或本地模型(完全在本机)。插件没有遥测,也没有
|
|
101
|
+
第三方中转。API Key 保存在本机配置文件(权限 `0600`),浏览器只看到掩码。本地模型从 sherpa-onnx
|
|
102
|
+
上游仓库下载,并按固定摘要校验。
|
|
103
|
+
|
|
104
|
+
## 文档
|
|
105
|
+
|
|
106
|
+
- [架构说明](docs/ARCHITECTURE.md)(技术路线、组件边界、HTTP 接口)
|
|
107
|
+
- [模块契约](docs/CONTRACTS.md)
|
|
108
|
+
- [验证记录](docs/VERIFICATION.md):CI 门禁、11 个本地变体的真实下载+推理运行记录
|
|
109
|
+
- [NOTICE](NOTICE):第三方归属与模型许可证
|
|
110
|
+
|
|
111
|
+
## 许可证
|
|
112
|
+
|
|
113
|
+
MIT。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# The @ds-hu/dsh-better-voice-input bundle patch: four independently switchable components.
|
|
2
|
+
#
|
|
3
|
+
# Component rows (each one is a switch on the bundle's page in the Plugins panel):
|
|
4
|
+
# bvi-service shared service + settings page: provider config store, same-origin API,
|
|
5
|
+
# provider catalog / selection / preparation relay, preferences
|
|
6
|
+
# bvi-cloud more speech models · cloud: 14 cloud ASR providers registered into ctx.speechToText
|
|
7
|
+
# bvi-local more speech models · local: 7 downloadable sherpa-onnx models on the same seam
|
|
8
|
+
# bvi-input better voice input: DeepSeek-App-style hold-to-talk composer interaction
|
|
9
|
+
#
|
|
10
|
+
# Dependency: this bundle EXTENDS the official experimental voice input bundle
|
|
11
|
+
# (@deepseek-ai/dsh-experimental-voice-input-bundle). Keep that bundle enabled: its
|
|
12
|
+
# `speech-to-text` row supplies ctx.speechToText, the registry every model row here
|
|
13
|
+
# registers into, and our service relays selection/preparation through it. We
|
|
14
|
+
# deliberately do not insert those rows again (a second service instance would fail).
|
|
15
|
+
#
|
|
16
|
+
# Row config:
|
|
17
|
+
# bvi-service dataRoot absolute state directory (config.json, preferences)
|
|
18
|
+
# bvi-local dataRoot absolute model directory (downloaded sherpa-onnx models)
|
|
19
|
+
- insert:
|
|
20
|
+
- id: bvi-service
|
|
21
|
+
name: '@ds-hu/dsh-bvi-service'
|
|
22
|
+
config:
|
|
23
|
+
dataRoot: !!js dshHomePath('better-voice-input')
|
|
24
|
+
|
|
25
|
+
- id: bvi-cloud
|
|
26
|
+
name: '@ds-hu/dsh-bvi-cloud'
|
|
27
|
+
|
|
28
|
+
- id: bvi-local
|
|
29
|
+
name: '@ds-hu/dsh-bvi-local'
|
|
30
|
+
config:
|
|
31
|
+
dataRoot: !!js dshHomePath('better-voice-input', 'models')
|
|
32
|
+
|
|
33
|
+
- id: bvi-input
|
|
34
|
+
name: '@ds-hu/dsh-bvi-input'
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# Architecture — better voice input for DSH
|
|
2
|
+
|
|
3
|
+
Status: design of record for v0.1. Everything here is plain ESM JavaScript, no build step.
|
|
4
|
+
|
|
5
|
+
## 1. Product
|
|
6
|
+
|
|
7
|
+
The official experimental voice input bundle (`@deepseek-ai/dsh-experimental-voice-input-bundle`,
|
|
8
|
+
v0.2.2-rc.5) exposes one speech-to-text provider ("SenseVoice 本地识别") and one recorder UI.
|
|
9
|
+
This bundle extends exactly those two seams:
|
|
10
|
+
|
|
11
|
+
1. **组件一 · 更多语音识别模型** — 21 providers registered into the official
|
|
12
|
+
`ctx.speechToText` registry: 14 cloud APIs plus 7 local sherpa-onnx models. The list follows
|
|
13
|
+
`BryceWG/BiBi-Keyboard` ("说点啥"); only its model/provider list is used as a reference, its
|
|
14
|
+
Android implementation and UI are not copied.
|
|
15
|
+
2. **组件二 · 更好的语音输入** — a DeepSeek-App-style hold-to-talk composer: long-press the
|
|
16
|
+
input box (one pointer-based hold detection for mouse, touch and pen), a full-screen
|
|
17
|
+
recording overlay, slide up to cancel, release to transcribe and insert (default) or send.
|
|
18
|
+
|
|
19
|
+
The bundle **depends on** the official bundle. It never inserts the official rows: a second
|
|
20
|
+
`speech-to-text` row would create a second `ctx.speechToText` service instance and fail. Our
|
|
21
|
+
settings page says so explicitly when the service is missing.
|
|
22
|
+
|
|
23
|
+
## 2. Components (one switch each in the Plugins panel)
|
|
24
|
+
|
|
25
|
+
| Row id | Package | Kind | Responsibility |
|
|
26
|
+
| --- | --- | --- | --- |
|
|
27
|
+
| `bvi-service` | `@ds-hu/dsh-bvi-service` | host + client | Config store, same-origin HTTP API (catalog, selection, preparation, transcription, preferences), the bundle's own settings page in Plugins |
|
|
28
|
+
| `bvi-cloud` | `@ds-hu/dsh-bvi-cloud` | host | 14 cloud providers on `ctx.speechToText` |
|
|
29
|
+
| `bvi-local` | `@ds-hu/dsh-bvi-local` | host | 7 sherpa-onnx providers with managed model download + worker process |
|
|
30
|
+
| `bvi-input` | `@ds-hu/dsh-bvi-input` | client (+ no-op host) | Long-press gesture, full-screen overlay, audio capture, transcript insertion |
|
|
31
|
+
|
|
32
|
+
`@ds-hu/dsh-bvi-core` is a library dependency of `service`, `cloud` and `local` (never a row):
|
|
33
|
+
domain catalogs, config store primitives, WAV utilities, request builders.
|
|
34
|
+
|
|
35
|
+
Dependency direction: `bundle -> {service, cloud, local, input}`, `{service, cloud, local} -> core`.
|
|
36
|
+
`input` talks to `service` over the same-origin HTTP API, so it does not depend on the official
|
|
37
|
+
client UI being enabled.
|
|
38
|
+
|
|
39
|
+
The two model catalogs ship as **data-only** modules inside core (`core/lib/catalog/cloud.js` and
|
|
40
|
+
`core/lib/catalog/local.js`): the service renders its settings page from that metadata without
|
|
41
|
+
depending on either row package, while the request code (cloud adapters) and recognizer
|
|
42
|
+
configuration (local worker adapters) stay in their owning packages. All packages are released at
|
|
43
|
+
one version, so catalog edits and their adapters ship together.
|
|
44
|
+
|
|
45
|
+
## 3. Host design
|
|
46
|
+
|
|
47
|
+
### 3.1 Speech provider contract (official seam)
|
|
48
|
+
|
|
49
|
+
Each provider implements the official interface, unchanged:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
{
|
|
53
|
+
info: { id, name, location: 'cloud' | 'host-local', languages: [...], setupEstimate?, downloadSources? },
|
|
54
|
+
preparation?: { snapshot(), subscribe(fn), prepare(options), cancel() }, // local models only
|
|
55
|
+
transcribe({ audio: Uint8Array, language }, signal) -> { text, audioSeconds, inferenceSeconds },
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`ctx.speechToText.register(provider)` is called inside `apply()` and cleaned up by `ctx.effect`.
|
|
60
|
+
Provider rows inject `speechToText`; while absent the row stays inactive (not failed), and the
|
|
61
|
+
settings page reports the missing official dependency.
|
|
62
|
+
|
|
63
|
+
### 3.2 Config store (`core`)
|
|
64
|
+
|
|
65
|
+
- Location: `<dataRoot>/config.json` (`dataRoot` comes from the row config, default
|
|
66
|
+
`$DSH_HOME/better-voice-input`). Directory `0700`, file `0600`, atomic write
|
|
67
|
+
(`.tmp` + `rename`), JSON schema version field.
|
|
68
|
+
- Shape:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"version": 1,
|
|
73
|
+
"providers": {
|
|
74
|
+
"bvi-cloud-openai": { "apiKey": "...", "baseURL": "https://api.openai.com/v1", "model": "gpt-4o-transcribe" }
|
|
75
|
+
},
|
|
76
|
+
"local": { "bvi-local-funasr-nano": { "variant": "nano-int8" } },
|
|
77
|
+
"preferences": { "releaseAction": "insert", "holdDelayMs": 280, "cancelDistancePx": 72, "hintDismissed": false }
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
- Providers read their own entry at transcription time (`readConfig()`); env fallback names are
|
|
82
|
+
part of each provider descriptor (e.g. `OPENAI_API_KEY`). Config changes apply to the next
|
|
83
|
+
recording without a plugin restart.
|
|
84
|
+
- Seconds never leak: `GET /state` returns masked keys (`sk-…4f2a`) only; updates accept a new
|
|
85
|
+
value or `{ "clear": true }`.
|
|
86
|
+
|
|
87
|
+
### 3.3 Cloud providers (`cloud`)
|
|
88
|
+
|
|
89
|
+
- One provider per vendor, id `bvi-cloud-<vendor>`, `location: 'cloud'`.
|
|
90
|
+
- A vendor descriptor in `core` (id, names, languages, default endpoint/model, credential fields,
|
|
91
|
+
env names, docs URL) is the single source for both the provider implementation and the
|
|
92
|
+
settings page.
|
|
93
|
+
- Audio: recordings arrive as canonical 16 kHz mono PCM16 WAV. The WAV -> PCM conversion and
|
|
94
|
+
provider-specific container/base64 handling live in the request builder of each adapter.
|
|
95
|
+
Providers that need a different container get an adapter-specific conversion path documented
|
|
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.
|
|
101
|
+
- Failures throw `Error` messages that the service relays to the UI (no secrets, bounded length).
|
|
102
|
+
|
|
103
|
+
### 3.4 Local providers (`local`)
|
|
104
|
+
|
|
105
|
+
- One provider per model family (id `bvi-local-<family>`), `location: 'host-local'`;
|
|
106
|
+
`preparation.snapshot()/subscribe()` drive the download UI through the official shape
|
|
107
|
+
(`phase: unprepared | downloading | checking | loading | ready | standby | failed | ...`).
|
|
108
|
+
- Model catalog in `core`: per family the variants, file list (name/bytes/sha256), pinned
|
|
109
|
+
upstream URLs (HuggingFace revision URLs), language set, setup estimate, and a
|
|
110
|
+
`downloadSources` origin list (`https://huggingface.co`, `https://hf-mirror.com`).
|
|
111
|
+
- Download: streaming fetch -> sha256 -> atomic rename, cancelled through `AbortSignal`,
|
|
112
|
+
progress throttled; verified files are reused.
|
|
113
|
+
- Inference runs in a **child process** (`packages/local/lib/worker/entry.js`, one per family
|
|
114
|
+
variant), which loads `sherpa-onnx-node`, owns that family's recognizer configuration
|
|
115
|
+
(`worker/adapters.js`) and speaks a private loopback HTTP protocol (ephemeral port bound to
|
|
116
|
+
`127.0.0.1`, a per-worker 64-hex bearer token passed through the child environment, JSON
|
|
117
|
+
envelopes) like the official SenseVoice provider. `worker/runtime.js` in the parent owns the
|
|
118
|
+
handshake, a serial decode queue, inference/idle timeouts, crash restart and termination on
|
|
119
|
+
plugin unload or variant switch. Switching variants stops the old worker before starting the new
|
|
120
|
+
one; only the selected family is resident at a time.
|
|
121
|
+
- Streaming (v0.2): X-ASR's `OnlineRecognizer` is also served incrementally. The worker gains
|
|
122
|
+
four authenticated loopback routes (`/stream/start|chunk|finish|cancel`, PCM16LE 16 kHz);
|
|
123
|
+
`worker/runtime.js` forwards them and `provider.js` exposes the optional `bviStreaming`
|
|
124
|
+
extension described in `docs/CONTRACTS.md`. The recognizer configuration is unchanged — the
|
|
125
|
+
streaming path reuses the exact X-ASR config. Other families stay batch-only.
|
|
126
|
+
- VAD: the shared Silero VAD asset is downloaded alongside the model and used to cut long
|
|
127
|
+
recordings into 15–24 s segments for the families that truncate long inputs (FunASR Nano,
|
|
128
|
+
Qwen3-ASR); the others decode the whole utterance. Exact per-family configuration, language
|
|
129
|
+
mapping and streaming tail protocol: `docs/research/local-models.md`.
|
|
130
|
+
- Provisioning: `lib/provision/{download,archive,install}.js` implement source fallback, `.part`
|
|
131
|
+
files, streaming SHA-256, atomic renames, zip extraction (no new dependency) with a
|
|
132
|
+
path-traversal whitelist, and per-variant install state. Model data lives in
|
|
133
|
+
`core/lib/catalog/local.js`.
|
|
134
|
+
|
|
135
|
+
### 3.5 Service HTTP API (`service`)
|
|
136
|
+
|
|
137
|
+
Registered as eleven exact Fetch routes through `ctx.connection.fetch.register({ path, methods,
|
|
138
|
+
requestBody: 'buffered', fetch })` (`inject = ['connection']`), each under
|
|
139
|
+
`/api/better-voice-input/`. The connection layer owns the Host/Origin fence and browser
|
|
140
|
+
authentication (owner Peer only), so the handlers carry no hand-written same-origin check; the
|
|
141
|
+
WAV body is still capped before decoding. Success is HTTP 2xx with `{ ok: true, ... }`; failure is
|
|
142
|
+
a 4xx/5xx with `{ ok: false, code, message }`.
|
|
143
|
+
|
|
144
|
+
| Method + path | Purpose |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `GET /state` | provider views from `ctx.speechToText.snapshot()`, masked config, cloud metadata, local install state, preferences, limits, dependency status |
|
|
147
|
+
| `POST /config` | `{ providerId, values }` — validate against the field descriptor and persist |
|
|
148
|
+
| `POST /select` | `{ providerId, language }` — `ctx.speechToText.configure(patch)` |
|
|
149
|
+
| `POST /prepare` | `{ providerId, downloadSource? }` — `ctx.speechToText.prepare(...)` |
|
|
150
|
+
| `POST /cancel-preparation` | `{ providerId }` |
|
|
151
|
+
| `POST /transcribe?language=auto` | raw `audio/wav` body (≤ `limits.maxAudioBytes`) — canonical WAV validation then `ctx.speechToText.transcribe`, returns `{ ok: true, text, audioSeconds, inferenceSeconds }` |
|
|
152
|
+
| `POST /preferences` | partial preferences (`releaseAction`, `holdDelayMs`, `cancelDistancePx`, `hintDismissed`, `composerHint`, `streaming`, `shortcut`) |
|
|
153
|
+
| `POST /stream/start` | `{ providerId?, language? }` — open a live session for a `streaming` provider |
|
|
154
|
+
| `POST /stream/chunk?session=…` | raw PCM16LE mono 16 kHz, ≤ 1 MiB — `{ partial }` |
|
|
155
|
+
| `POST /stream/finish?session=…` | final `{ text, audioSeconds, inferenceSeconds }` |
|
|
156
|
+
| `POST /stream/cancel?session=…` | abort + dispose |
|
|
157
|
+
|
|
158
|
+
Streaming sessions are held in memory by the `api` closure (max four, 120 s idle TTL, disposed
|
|
159
|
+
on row unload), so no browser state outlives a recording and no Host file is written. A JSON
|
|
160
|
+
`{ audioBase64 }` body is also accepted on `/transcribe` for tests and as a fallback
|
|
161
|
+
carrier; base64 is decoded and validated the same way. `GET /state` is polled by the settings page
|
|
162
|
+
(1.5 s) while a preparation is running and once on open. It is cheap: in-memory snapshot + one
|
|
163
|
+
small file read.
|
|
164
|
+
|
|
165
|
+
### 3.6 Settings page (`service` client half)
|
|
166
|
+
|
|
167
|
+
Registered into `plugins.bundle.config` keyed by `@ds-hu/dsh-better-voice-input`, following the
|
|
168
|
+
official `VoicePreparation` page pattern. Sections:
|
|
169
|
+
|
|
170
|
+
1. **依赖状态** — official speech-to-text service present? selected provider + language.
|
|
171
|
+
2. **云端服务** — master-detail: a compact provider list (name + configured badge) plus the
|
|
172
|
+
detail card of the **selected** provider only (API key write-only + masked, base URL, model,
|
|
173
|
+
vendor fields, env hint, docs link, save). Nothing is flattened all at once, so a phone only
|
|
174
|
+
scrolls through the list it is choosing from.
|
|
175
|
+
3. **本地模型** — same master-detail pattern: model list (name, variant, install badge) and a
|
|
176
|
+
detail pane with variant selector, download / cancel / retry, progress, languages and
|
|
177
|
+
disk/memory estimate.
|
|
178
|
+
4. **交互** — release action (insert draft / send, default insert), hold delay, slide-up cancel
|
|
179
|
+
distance, composer placeholder hint (`composerHint`, default on: “发消息或按住说话”), live
|
|
180
|
+
streaming display toggle (`streaming`, default on), first-run hint reset.
|
|
181
|
+
5. **快捷键** — enable/disable, record a long-press combination, show its label (e.g.
|
|
182
|
+
`Ctrl+Shift+Space`); validation rejects bare letters/space.
|
|
183
|
+
6. **说明** — audio destination per provider (cloud upload vs local), dependency on the
|
|
184
|
+
official plugin, where data is written.
|
|
185
|
+
|
|
186
|
+
Only theme tokens (`--dsw-*`) are used; controls are written locally (no Harness client imports).
|
|
187
|
+
|
|
188
|
+
## 4. Browser design — hold to talk (`input` client half)
|
|
189
|
+
|
|
190
|
+
### 4.1 Registration
|
|
191
|
+
|
|
192
|
+
`lib/client.js` is a lazy-CJS module. Inside `apply(ctx)`, after `ctx.inject(['slots','locale'])`:
|
|
193
|
+
|
|
194
|
+
- register locale dictionaries (zh/en) via `ctx.locale.register(NS, ...)`;
|
|
195
|
+
- `ctx.slots.inject('conversation.input.overlay', () => ctx.slots.register({ name: 'conversation.input.overlay', id: 'bvi-input', locale: NS }, VoiceGesture))`.
|
|
196
|
+
|
|
197
|
+
`conversation.input.overlay` is a session-scoped list slot rendered inside the composer card, so
|
|
198
|
+
the component receives `inputActions` (captureInsertion/insertText/setDraft/submit) and renders a
|
|
199
|
+
zero-size anchor. The overlay itself portals to `document.body` (fixed overlay; sanctioned by the
|
|
200
|
+
slot contract). The slot id is stable, so re-registration on graph updates is idempotent.
|
|
201
|
+
|
|
202
|
+
### 4.2 Gesture detection (unified desktop + touch)
|
|
203
|
+
|
|
204
|
+
- A capture-phase `pointerdown` on the composer card (`[data-composer-card]`) starts a hold
|
|
205
|
+
candidate. Pointer events cover mouse, touch and pen with one code path.
|
|
206
|
+
- Start conditions: primary button only; not inside an interactive control (`button`, `a`,
|
|
207
|
+
`input`, `select`, `[role=button]`, `[contenteditable=false]`); composer editable and not
|
|
208
|
+
disabled; no active session; not while a transcript is being inserted.
|
|
209
|
+
- **Focused-editor guard (v0.2)**: on touch/pen the hold never starts when the composer editor
|
|
210
|
+
has focus or the virtual keyboard is open (`visualViewport` height materially shorter than
|
|
211
|
+
`innerHeight`). The keyboard would otherwise be pushed away mid-gesture, moving the overlay
|
|
212
|
+
and losing the user's cursor. Desktop mouse users keep the gesture while the editor is focused
|
|
213
|
+
(no software keyboard). A first tap focuses the editor as usual; the user dismisses the
|
|
214
|
+
keyboard (tap outside / back) and then holds to speak.
|
|
215
|
+
- Hold window: default 280 ms (`preferences.holdDelayMs`), movement <= 8 px, pointer not
|
|
216
|
+
released/cancelled, window not blurred.
|
|
217
|
+
- On hold commit: suppress `contextmenu`/`selectstart`, clear the text selection, add a
|
|
218
|
+
`user-select: none` / `touch-action: none` class to the editor for the session, start the
|
|
219
|
+
microphone pipeline, show the overlay.
|
|
220
|
+
- While recording: `pointermove` drives the slide-up distance; release -> finish, slide-up past
|
|
221
|
+
`cancelDistancePx` -> cancel state (with hysteresis: re-arm below 60 %), `pointercancel`,
|
|
222
|
+
Escape, window blur and tab hide cancel. Page scroll is prevented during the session.
|
|
223
|
+
- Desktop and mobile share this exact state machine; the only platform-specific inputs are the
|
|
224
|
+
pointer events themselves and optional `navigator.vibrate(10)`.
|
|
225
|
+
- **Keyboard shortcut (v0.2)**: `preferences.shortcut` (e.g. hold `Ctrl+Shift+Space`) starts the
|
|
226
|
+
same hold flow from a `keydown` (`event.code` + modifiers, no repeat) and releases on `keyup`;
|
|
227
|
+
Escape cancels. It only fires while a composer exists and the active element is the composer,
|
|
228
|
+
its card or `document.body` — settings inputs and other forms keep typing normally. The
|
|
229
|
+
shortcut hold duration is the same `holdDelayMs`. Because the pipeline is shared, insert/send,
|
|
230
|
+
cancel, streaming and toasts behave identically for pointer and keyboard triggers.
|
|
231
|
+
|
|
232
|
+
### 4.3 Overlay states (DeepSeek App replication)
|
|
233
|
+
|
|
234
|
+
Full-screen (100dvh, safe-area aware), portal to body:
|
|
235
|
+
|
|
236
|
+
| State | Background | Status text | Visual |
|
|
237
|
+
| --- | --- | --- | --- |
|
|
238
|
+
| preparing | blue gradient | `正在准备麦克风…` | dim waveform placeholder |
|
|
239
|
+
| recording | deep navy -> electric blue gradient | `松手插入,上滑取消` (or `松手发送,…`) | live waveform bars |
|
|
240
|
+
| cancel-armed | deep maroon -> red gradient | `松手取消` | waveform bars in red |
|
|
241
|
+
| transcribing | last gradient | `正在识别…` | soft pulsing dots |
|
|
242
|
+
| streaming | recording gradient | `松手插入,上滑取消` | live cumulative transcript above the waveform, updating as chunks arrive |
|
|
243
|
+
| settling | recording gradient fading | — | final line cloned into a `.bvi-flight` element and flown to the composer input (~360 ms), then inserted |
|
|
244
|
+
| error | last gradient | failure sentence | dismiss on tap/release |
|
|
245
|
+
|
|
246
|
+
Motion: 160 ms fade in, 200 ms gradient crossfade, waveform driven by a 60 fps meter from the
|
|
247
|
+
audio worklet. Typography: system UI for chrome, a serif stack for the status line to match the
|
|
248
|
+
reference; text is centered around 38 % of the viewport height, waveform band around 62 %.
|
|
249
|
+
|
|
250
|
+
### 4.4 Audio pipeline
|
|
251
|
+
|
|
252
|
+
- `getUserMedia({ audio: { channelCount: 1, echoCancellation: true, noiseSuppression: true,
|
|
253
|
+
autoGainControl: true } })`; AudioContext kept alive (unlocked from the initial pointer gesture
|
|
254
|
+
so iOS/desktop autoplay policies are satisfied), AudioWorklet (inline blob module) captures
|
|
255
|
+
Float32 frames and posts RMS/peak meter values at ~30 Hz.
|
|
256
|
+
- Two capture modes share one microphone: **batch** keeps `MediaRecorder` and produces the
|
|
257
|
+
canonical WAV at release; **streaming** (v0.2, selected provider declares `streaming`) taps the
|
|
258
|
+
AudioWorklet Float32 frames, downsamples to 16 kHz, chunks every ~200 ms and POSTs them to
|
|
259
|
+
`/stream/chunk`. If `AudioWorklet` is unavailable the recording transparently falls back to
|
|
260
|
+
batch. The waveform meter works in both modes.
|
|
261
|
+
- Stop: disconnect tracks, resample to 16 kHz linear interpolation, encode canonical mono PCM16
|
|
262
|
+
WAV (44-byte header), enforce `limits.maxAudioBytes`/`maxDurationSeconds`.
|
|
263
|
+
- The recording limit auto-finishes the take instead of dropping it.
|
|
264
|
+
- Permission errors and pipeline failures close the overlay and show a localized inline notice
|
|
265
|
+
above the composer; one sentence, no modal.
|
|
266
|
+
|
|
267
|
+
### 4.5 Result handling
|
|
268
|
+
|
|
269
|
+
- Streaming: `finish` returns the final transcript; a DOM flight clone animates the last live
|
|
270
|
+
line into the composer, then the normal insertion runs (reduced-motion skips the animation).
|
|
271
|
+
Slide-up cancel or Escape calls `/stream/cancel` and inserts nothing.
|
|
272
|
+
- `insert` (default): `inputActions.insertText(text, inputActions.captureInsertion())`; if the
|
|
273
|
+
draft moved concurrently, fall back to `setDraft(current + text)`; empty/whitespace -> notice.
|
|
274
|
+
- `send`: insert with the same guards, then `inputActions.submit()` on the next microtask.
|
|
275
|
+
- Cancel: abort fetch + stop capture, no text.
|
|
276
|
+
- While a take is running, a second long-press is ignored.
|
|
277
|
+
|
|
278
|
+
## 5. Data, privacy, security
|
|
279
|
+
|
|
280
|
+
- Audio leaves the host only if the selected provider is a cloud provider, sent by that
|
|
281
|
+
provider's own request; local models keep audio in the worker process. The settings page states
|
|
282
|
+
this per provider (`location`).
|
|
283
|
+
- API keys live in `<dataRoot>/config.json` (0600) and are never returned unmasked; environment
|
|
284
|
+
fallbacks are read-only.
|
|
285
|
+
- The HTTP API is same-origin only, validates content type/length, caps base64 audio to the
|
|
286
|
+
provider-neutral WAV limit, and does not accept provider selection outside the registry.
|
|
287
|
+
- No model-facing tools, no session events, no changes to the user's profile outside
|
|
288
|
+
`ctx.speechToText.configure()` (the documented seam for selection).
|
|
289
|
+
|
|
290
|
+
## 6. Testing and release
|
|
291
|
+
|
|
292
|
+
- `npm test` runs `node --test`: core store/WAV/HTTP/provider-factory invariants, per-provider
|
|
293
|
+
request/response adapters against a local mock HTTP server, service API/host against a fake
|
|
294
|
+
`speechToText` service, local catalog/provision/worker protocol and recognizer-config builders
|
|
295
|
+
(no native load), both browser entries loaded in a `vm` harness (factory contract, placement,
|
|
296
|
+
gesture state machine, WAV encoder, preference handling), streaming session relays and the
|
|
297
|
+
optional-credential path, and one cross-component test that holds the 21-provider and
|
|
298
|
+
release/documentation contracts together.
|
|
299
|
+
- `npm run lint` is part of `npm run check`; CI (`.github/workflows/ci.yml`) is the only place
|
|
300
|
+
these run, on Node 20 and 22.
|
|
301
|
+
- `.github/workflows/release.yml` publishes core -> service/cloud/local/input -> bundle on a `v*`
|
|
302
|
+
tag, then creates the GitHub release.
|
|
303
|
+
- Optional `workflow_dispatch` smoke workflows: `local-models-smoke.yml` downloads a pinned model
|
|
304
|
+
(or every family, one dispatch at a time) and runs one real transcription;
|
|
305
|
+
`openai-compat-smoke.yml` downloads the pinned X-ASR model, serves it through a local
|
|
306
|
+
OpenAI-compatible `/v1/audio/transcriptions` endpoint, drives the real `bvi-cloud-openai`
|
|
307
|
+
adapter with an **empty API key**, and asserts the transcript plus the absence of an
|
|
308
|
+
authorization header. Neither runs on PRs. Evidence is recorded in `docs/VERIFICATION.md`.
|
|
309
|
+
|
|
310
|
+
## 7. Non-goals for v0.2
|
|
311
|
+
|
|
312
|
+
- Cloud-side streaming: only providers with a native incremental recognizer stream live (currently
|
|
313
|
+
local X-ASR); cloud vendors stay batch because their streaming transports are WebSocket
|
|
314
|
+
protocols that deserve their own adapters.
|
|
315
|
+
- Selecting a browser microphone device (system default only).
|
|
316
|
+
- Downloading models in the browser; all model I/O stays on the host.
|
|
317
|
+
- Replacing the official recording component (both can coexist; keep the official bundle's
|
|
318
|
+
`ui-voice-input` row on when you want its microphone picker and setup dialog).
|