dsh-xiaomi-tts 2.3.3 → 2.3.4

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
@@ -1,198 +1,198 @@
1
- ![social](assets/social.png)
2
-
3
- # dsh-xiaomi-tts
4
-
5
- [![npm version](https://img.shields.io/npm/v/dsh-xiaomi-tts.svg)](https://www.npmjs.com/package/dsh-xiaomi-tts)
6
- [![GitHub stars](https://img.shields.io/github/stars/ppy-web/dsh-plugin-xiaomi-mimo-tts.svg)](https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts)
7
-
8
- <p><a href="README.md"><strong>中文说明 →</strong></a></p>
9
-
10
- Add Xiaomi MiMo TTS read-aloud playback to assistant replies in DeepSeek Harness Web.
11
-
12
- > Powered by Xiaomi MiMo TTS models to turn assistant replies into smooth, clear natural speech. MiMo TTS is currently free for a limited time; refer to Xiaomi MiMo for the current policy.
13
-
14
- ## Preview
15
-
16
- ![Xiaomi MiMo settings menu](assets/menu.png)
17
-
18
- ![Preset](assets/preset.png)
19
-
20
- ![Button](assets/image.png)
21
-
22
- ## Features
23
-
24
- - Shows a read-aloud button below each completed assistant reply body when needed; enabled by default.
25
- - Uses Xiaomi MiMo's currently limited-time-free TTS models: `mimo-v2.5-tts` outputs smooth, clear audio with selectable PCM streaming or complete MP3/WAV playback.
26
- - Uses `mimo-v2.5-tts-voicedesign` Voice Design to create the voice you want from a text description.
27
- - Lets you switch between the preset-voice model and the custom voice-design model under **Settings → Plugins → Plugin configuration**, and configure the API key, autoplay, voice, audio format, and voice description.
28
- - Presents built-in voices in a two-column selector using Xiaomi MiMo's official avatars, names, and summaries.
29
- - Keeps the API key on the DSH Host. The browser sends only the reply body text to a same-origin Host route.
30
- - Supports pause, resume, regeneration, and autoplay-blocked prompts. Automatic playback only triggers for the latest reply newly completed in the current run; opening messages from history does not play them.
31
- - Aggressively cleans speech text before sending it to TTS: URLs, file paths, code blocks, emoji, icons, and control characters are removed, and common Chinese punctuation is converted to ASCII punctuation.
32
-
33
- ## Requirements
34
-
35
- - `@deepseek-ai/dsh` `0.1.0-rc.7` or a compatible version
36
- - Node.js 22+
37
- - Xiaomi MiMo API Key
38
-
39
- Official Xiaomi MiMo TTS API reference: <https://mimo.mi.com/static/docs/api/audio/tts.md>
40
-
41
- ## Install
42
-
43
- Install from npm:
44
-
45
- ```bash
46
- dsh plugin --profile web add dsh-xiaomi-tts
47
- ```
48
-
49
- Install from a local directory:
50
-
51
- ```bash
52
- dsh plugin --profile web add ./dsh-plugin-xiaomi-mimo-tts
53
- ```
54
-
55
- Install from GitHub:
56
-
57
- ```bash
58
- dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
59
- ```
60
-
61
- After installation, restart `dsh web`, then open **Settings → Plugins → Plugin configuration → Xiaomi MiMo Read Aloud**, enter the API key, and save. The plugin automatically selects the endpoint from the API key prefix: `sk-` uses the standard endpoint and `tp-` uses the Token Plan-compatible endpoint.
62
-
63
- When updating or switching from the local development link to the npm package, stop DSH Web before changing the profile dependencies. This prevents a running Node process from holding the Windows Junction that pnpm needs to replace:
64
-
65
- ```powershell
66
- .\start\dsh-plugin-reinstall.bat 2.3.3
67
- ```
68
-
69
- The script stops DSH Web, removes the current plugin from the profile, installs the requested npm version, and starts DSH Web again. If you run the steps manually, keep the same order:
70
-
71
- ```powershell
72
- .\start\dsh-web-stop.bat
73
- dsh plugin --profile web remove dsh-xiaomi-tts
74
- dsh plugin --profile web add dsh-xiaomi-tts@2.3.3
75
- .\start\dsh-web-start.bat
76
- ```
77
-
78
- ## Configuration
79
-
80
- Available built-in voices for `mimo-v2.5-tts`:
81
-
82
- - Chinese female: `冰糖`, `茉莉`
83
- - Chinese male: `苏打`, `白桦`
84
- - English female: `Mia`, `Chloe`
85
- - English male: `Milo`, `Dean`
86
-
87
- Preset voices default to **PCM (streaming)**. A complete reply starts playing as soon as audio chunks arrive, reducing the wait, but pause and resume are unavailable; a failure before the first chunk falls back to MP3. **MP3 (complete audio)** and **WAV (complete audio)** wait for the whole file and support pause and resume. MP3 is smaller, while WAV preserves lossless audio at a larger size.
88
-
89
- Custom voice design with `mimo-v2.5-tts-voicedesign`
90
-
91
- The plugin provides common voice-description templates. The selector defaults to **Custom**, so users can edit and save the description directly. After switching to another template and back to **Custom**, the previously saved custom content is restored.
92
-
93
- ```text
94
- Young adult woman, bright and approachable voice, clear articulation, moderate pace, gentle and restrained emotional tone.
95
- ```
96
-
97
- It is recommended to describe age and gender, vocal texture, speaking pace, and emotional baseline, while avoiding scenes or actions. Preset-voice mode still uses the built-in voice configuration.
98
-
99
- Browsers may block autoplay. If that happens, click the read-aloud button first.
100
-
101
- ### Speech text preprocessing
102
-
103
- Read-aloud uses only the cleaned reply body and does not modify the assistant message shown in the chat. Markdown links keep their readable labels while their targets are removed; URLs, file paths, complete code blocks, emoji, icons, zero-width characters, and control characters are not sent to Xiaomi MiMo. Parentheses, brackets, book-title marks, quotation marks, and other non-boundary punctuation are removed; retained sentence-boundary punctuation is converted to ASCII. Only preset voices configured for PCM stream partial replies after accumulating at least 20 speakable characters. Completed replies are sent in one PCM/SSE request and play as chunks arrive. MP3 and WAV always request complete audio.
104
-
105
- Complete-audio responses are limited to 32 MiB for MP3 and 128 MiB for WAV by default. Advanced Cordis configuration can override these limits with `maxMp3AudioBytes` and `maxWavAudioBytes`. The Host enforces the response limit before JSON parsing and Base64 decoding.
106
-
107
- ## Privacy
108
-
109
- - The API key stays on the DSH Host and is never sent to the browser.
110
- - Reply text is sent to Xiaomi MiMo when speech is generated.
111
- - Audio stays in browser memory and is played through Web Audio or a temporary Blob URL; it is not persisted to disk.
112
-
113
- ## Feedback and support
114
-
115
- Please use [GitHub Issues](https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts/issues) for bug reports, feature requests, or feedback.
116
-
117
- ## Architecture
118
-
119
- - `src/index.ts`: Host entry; registers Schemastery settings, both voice-asset groups, and complete-audio plus PCM/SSE synthesis routes.
120
- - `src/shared.ts`: Shared Host/Client domain contracts, including settings types, defaults, text cleaning, sentence splitting, stream batching, and SSE parsing.
121
- - `src/client/index.tsx`: Web Client composition entry; binds DSH services, registers slots, injects styles, and owns controller lifecycles.
122
- - `src/client/conversation.tsx`: React conversation adapter; observes DSH conversation snapshots and renders read-aloud actions.
123
- - `src/client/settings-card.tsx`, `built-in-voice-picker.tsx`, and `voice-design-picker.tsx`: Plugin settings form, official built-in voice panel, and Voice Design voice selector UI.
124
- - `src/client/live-speech-controller.ts`, `pcm-audio-queue.ts`, and `playback-controller.ts`: Realtime speech state machine, Web Audio PCM scheduling, and complete-audio playback.
125
- - `src/client/settings-scope.ts`: Connects the DSH Settings Scope to React safely with `useSyncExternalStore`.
126
-
127
- ```mermaid
128
- flowchart TD
129
- DSH["DeepSeek Harness"]
130
-
131
- subgraph Host["Host plugin"]
132
- HI["src/index.ts<br/>Settings and routes"]
133
- SETTINGS["DSH Settings"]
134
- ROUTES["Complete audio / PCM SSE routes"]
135
- ASSETS["Voice assets"]
136
- end
137
-
138
- subgraph Shared["Shared domain layer"]
139
- SH["src/shared.ts<br/>Settings, text processing, sentence splitting, and SSE"]
140
- end
141
-
142
- subgraph Client["Web Client"]
143
- ENTRY["client/index.tsx<br/>Composition entry"]
144
- LOCALE["localization.ts"]
145
- STYLE["styles.ts"]
146
- SCOPE["settings-scope.ts<br/>useSyncExternalStore"]
147
- FORM["settings-card.tsx"]
148
- BUILTIN["built-in-voice-picker.tsx"]
149
- PICKER["voice-design-picker.tsx"]
150
- CONV["conversation.tsx<br/>Conversation observer and read-aloud button"]
151
-
152
- subgraph Audio["Audio runtime"]
153
- LIVE["live-speech-controller.ts<br/>Realtime speech state machine"]
154
- PCM["pcm-audio-queue.ts<br/>Web Audio PCM scheduling"]
155
- COMPLETE["playback-controller.ts<br/>Complete-audio playback"]
156
- end
157
- end
158
-
159
- API["Xiaomi MiMo API"]
160
-
161
- DSH --> HI
162
- DSH --> ENTRY
163
- SH --> HI
164
- SH --> SCOPE
165
- SH --> CONV
166
- SH --> LIVE
167
- HI --> SETTINGS
168
- HI --> ROUTES
169
- HI --> ASSETS
170
- ROUTES --> API
171
- ENTRY --> LOCALE
172
- ENTRY --> STYLE
173
- ENTRY --> SCOPE
174
- ENTRY --> FORM
175
- ENTRY --> CONV
176
- FORM --> BUILTIN
177
- FORM --> PICKER
178
- CONV --> LIVE
179
- CONV --> COMPLETE
180
- LIVE --> PCM
181
- LIVE --> ROUTES
182
- COMPLETE --> ROUTES
183
- ```
184
-
185
- ## Development
186
-
187
- ```bash
188
- pnpm install
189
- pnpm typecheck
190
- pnpm test
191
- pnpm pack:check
192
- ```
193
-
194
- `lib/` is generated output and is not committed during day-to-day development. Feature commits update source and tests only; when a version is packaged or published, `prepack` regenerates the release output. GitHub installs build it during installation through `prepare`.
195
-
196
- ## License
197
-
198
- MIT
1
+ ![social](assets/social.png)
2
+
3
+ # dsh-xiaomi-tts
4
+
5
+ [![npm version](https://img.shields.io/npm/v/dsh-xiaomi-tts.svg)](https://www.npmjs.com/package/dsh-xiaomi-tts)
6
+ [![GitHub stars](https://img.shields.io/github/stars/ppy-web/dsh-plugin-xiaomi-mimo-tts.svg)](https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts)
7
+
8
+ <p><a href="README.md"><strong>中文说明 →</strong></a></p>
9
+
10
+ Add Xiaomi MiMo TTS read-aloud playback to assistant replies in DeepSeek Harness Web.
11
+
12
+ > Powered by Xiaomi MiMo TTS models to turn assistant replies into smooth, clear natural speech. MiMo TTS is currently free for a limited time; refer to Xiaomi MiMo for the current policy.
13
+
14
+ ## Preview
15
+
16
+ ![Xiaomi MiMo settings menu](assets/menu.png)
17
+
18
+ ![Preset](assets/preset.png)
19
+
20
+ ![Button](assets/image.png)
21
+
22
+ ## Features
23
+
24
+ - Shows a read-aloud button below each completed assistant reply body when needed; enabled by default.
25
+ - Uses Xiaomi MiMo's currently limited-time-free TTS models: `mimo-v2.5-tts` outputs smooth, clear audio with selectable PCM streaming or complete MP3/WAV playback.
26
+ - Uses `mimo-v2.5-tts-voicedesign` Voice Design to create the voice you want from a text description.
27
+ - Lets you switch between the preset-voice model and the custom voice-design model under **Settings → Plugins → Plugin configuration**, and configure the API key, autoplay, voice, audio format, and voice description.
28
+ - Presents built-in voices in a two-column selector using Xiaomi MiMo's official avatars, names, and summaries.
29
+ - Keeps the API key on the DSH Host. The browser sends only the reply body text to a same-origin Host route.
30
+ - Supports pause, resume, regeneration, and autoplay-blocked prompts. Automatic playback only triggers for the latest reply newly completed in the current run; opening messages from history does not play them.
31
+ - Aggressively cleans speech text before sending it to TTS: URLs, file paths, code blocks, emoji, icons, and control characters are removed, and common Chinese punctuation is converted to ASCII punctuation.
32
+
33
+ ## Requirements
34
+
35
+ - `@deepseek-ai/dsh` `0.1.0-rc.7` or a compatible version
36
+ - Node.js 22+
37
+ - Xiaomi MiMo API Key
38
+
39
+ Official Xiaomi MiMo TTS API reference: <https://mimo.mi.com/static/docs/api/audio/tts.md>
40
+
41
+ ## Install
42
+
43
+ Install from npm:
44
+
45
+ ```bash
46
+ dsh plugin --profile web add dsh-xiaomi-tts
47
+ ```
48
+
49
+ Install from a local directory:
50
+
51
+ ```bash
52
+ dsh plugin --profile web add ./dsh-plugin-xiaomi-mimo-tts
53
+ ```
54
+
55
+ Install from GitHub:
56
+
57
+ ```bash
58
+ dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
59
+ ```
60
+
61
+ After installation, restart `dsh web`, then open **Settings → Plugins → Plugin configuration → Xiaomi MiMo Read Aloud**, enter the API key, and save. The plugin automatically selects the endpoint from the API key prefix: `sk-` uses the standard endpoint and `tp-` uses the Token Plan-compatible endpoint.
62
+
63
+ When updating or switching from the local development link to the npm package, stop DSH Web before changing the profile dependencies. This prevents a running Node process from holding the Windows Junction that pnpm needs to replace:
64
+
65
+ ```powershell
66
+ .\start\dsh-plugin-reinstall.bat 2.3.4
67
+ ```
68
+
69
+ The script stops DSH Web, removes the current plugin from the profile, installs the requested npm version, and starts DSH Web again. If you run the steps manually, keep the same order:
70
+
71
+ ```powershell
72
+ .\start\dsh-web-stop.bat
73
+ dsh plugin --profile web remove dsh-xiaomi-tts
74
+ dsh plugin --profile web add dsh-xiaomi-tts@2.3.4
75
+ .\start\dsh-web-start.bat
76
+ ```
77
+
78
+ ## Configuration
79
+
80
+ Available built-in voices for `mimo-v2.5-tts`:
81
+
82
+ - Chinese female: `冰糖`, `茉莉`
83
+ - Chinese male: `苏打`, `白桦`
84
+ - English female: `Mia`, `Chloe`
85
+ - English male: `Milo`, `Dean`
86
+
87
+ Preset voices default to **PCM (streaming)**. A complete reply starts playing as soon as audio chunks arrive, reducing the wait, but pause and resume are unavailable; a failure before the first chunk falls back to MP3. **MP3 (complete audio)** and **WAV (complete audio)** wait for the whole file and support pause and resume. MP3 is smaller, while WAV preserves lossless audio at a larger size.
88
+
89
+ Custom voice design with `mimo-v2.5-tts-voicedesign`
90
+
91
+ The plugin provides common voice-description templates. The selector defaults to **Custom**, so users can edit and save the description directly. After switching to another template and back to **Custom**, the previously saved custom content is restored.
92
+
93
+ ```text
94
+ Young adult woman, bright and approachable voice, clear articulation, moderate pace, gentle and restrained emotional tone.
95
+ ```
96
+
97
+ It is recommended to describe age and gender, vocal texture, speaking pace, and emotional baseline, while avoiding scenes or actions. Preset-voice mode still uses the built-in voice configuration.
98
+
99
+ Browsers may block autoplay. If that happens, click the read-aloud button first.
100
+
101
+ ### Speech text preprocessing
102
+
103
+ Read-aloud uses only the cleaned reply body and does not modify the assistant message shown in the chat. Markdown links keep their readable labels while their targets are removed; URLs, file paths, complete code blocks, emoji, icons, zero-width characters, and control characters are not sent to Xiaomi MiMo. Parentheses, brackets, book-title marks, quotation marks, and other non-boundary punctuation are removed; retained sentence-boundary punctuation is converted to ASCII. Only preset voices configured for PCM stream partial replies after accumulating at least 20 speakable characters. Completed replies are sent in one PCM/SSE request and play as chunks arrive. MP3 and WAV always request complete audio.
104
+
105
+ Complete-audio responses are limited to 32 MiB for MP3 and 128 MiB for WAV by default. Advanced Cordis configuration can override these limits with `maxMp3AudioBytes` and `maxWavAudioBytes`. The Host enforces the response limit before JSON parsing and Base64 decoding.
106
+
107
+ ## Privacy
108
+
109
+ - The API key stays on the DSH Host and is never sent to the browser.
110
+ - Reply text is sent to Xiaomi MiMo when speech is generated.
111
+ - Audio stays in browser memory and is played through Web Audio or a temporary Blob URL; it is not persisted to disk.
112
+
113
+ ## Feedback and support
114
+
115
+ Please use [GitHub Issues](https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts/issues) for bug reports, feature requests, or feedback.
116
+
117
+ ## Architecture
118
+
119
+ - `src/index.ts`: Host entry; registers Schemastery settings, both voice-asset groups, and complete-audio plus PCM/SSE synthesis routes.
120
+ - `src/shared.ts`: Shared Host/Client domain contracts, including settings types, defaults, text cleaning, sentence splitting, stream batching, and SSE parsing.
121
+ - `src/client/index.tsx`: Web Client composition entry; binds DSH services, registers slots, injects styles, and owns controller lifecycles.
122
+ - `src/client/conversation.tsx`: React conversation adapter; observes DSH conversation snapshots and renders read-aloud actions.
123
+ - `src/client/settings-card.tsx`, `built-in-voice-picker.tsx`, and `voice-design-picker.tsx`: Plugin settings form, official built-in voice panel, and Voice Design voice selector UI.
124
+ - `src/client/live-speech-controller.ts`, `pcm-audio-queue.ts`, and `playback-controller.ts`: Realtime speech state machine, Web Audio PCM scheduling, and complete-audio playback.
125
+ - `src/client/settings-scope.ts`: Connects the DSH Settings Scope to React safely with `useSyncExternalStore`.
126
+
127
+ ```mermaid
128
+ flowchart TD
129
+ DSH["DeepSeek Harness"]
130
+
131
+ subgraph Host["Host plugin"]
132
+ HI["src/index.ts<br/>Settings and routes"]
133
+ SETTINGS["DSH Settings"]
134
+ ROUTES["Complete audio / PCM SSE routes"]
135
+ ASSETS["Voice assets"]
136
+ end
137
+
138
+ subgraph Shared["Shared domain layer"]
139
+ SH["src/shared.ts<br/>Settings, text processing, sentence splitting, and SSE"]
140
+ end
141
+
142
+ subgraph Client["Web Client"]
143
+ ENTRY["client/index.tsx<br/>Composition entry"]
144
+ LOCALE["localization.ts"]
145
+ STYLE["styles.ts"]
146
+ SCOPE["settings-scope.ts<br/>useSyncExternalStore"]
147
+ FORM["settings-card.tsx"]
148
+ BUILTIN["built-in-voice-picker.tsx"]
149
+ PICKER["voice-design-picker.tsx"]
150
+ CONV["conversation.tsx<br/>Conversation observer and read-aloud button"]
151
+
152
+ subgraph Audio["Audio runtime"]
153
+ LIVE["live-speech-controller.ts<br/>Realtime speech state machine"]
154
+ PCM["pcm-audio-queue.ts<br/>Web Audio PCM scheduling"]
155
+ COMPLETE["playback-controller.ts<br/>Complete-audio playback"]
156
+ end
157
+ end
158
+
159
+ API["Xiaomi MiMo API"]
160
+
161
+ DSH --> HI
162
+ DSH --> ENTRY
163
+ SH --> HI
164
+ SH --> SCOPE
165
+ SH --> CONV
166
+ SH --> LIVE
167
+ HI --> SETTINGS
168
+ HI --> ROUTES
169
+ HI --> ASSETS
170
+ ROUTES --> API
171
+ ENTRY --> LOCALE
172
+ ENTRY --> STYLE
173
+ ENTRY --> SCOPE
174
+ ENTRY --> FORM
175
+ ENTRY --> CONV
176
+ FORM --> BUILTIN
177
+ FORM --> PICKER
178
+ CONV --> LIVE
179
+ CONV --> COMPLETE
180
+ LIVE --> PCM
181
+ LIVE --> ROUTES
182
+ COMPLETE --> ROUTES
183
+ ```
184
+
185
+ ## Development
186
+
187
+ ```bash
188
+ pnpm install
189
+ pnpm typecheck
190
+ pnpm test
191
+ pnpm pack:check
192
+ ```
193
+
194
+ `lib/` is generated output and is not committed during day-to-day development. Feature commits update source and tests only; when a version is packaged or published, `prepack` regenerates the release output. GitHub installs build it during installation through `prepare`.
195
+
196
+ ## License
197
+
198
+ MIT