dsh-xiaomi-tts 2.3.4 → 3.0.1-alpha
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 +59 -13
- package/README.md +98 -76
- package/assets/audio/auto-off01.mp3 +0 -0
- package/assets/audio/auto-off02.mp3 +0 -0
- package/assets/audio/auto-off03.mp3 +0 -0
- package/assets/audio/auto-on01.mp3 +0 -0
- package/assets/audio/auto-on02.mp3 +0 -0
- package/assets/audio/auto-on03.mp3 +0 -0
- package/assets/audio/off01.mp3 +0 -0
- package/assets/audio/off02.mp3 +0 -0
- package/assets/audio/off03.mp3 +0 -0
- package/assets/audio/on01.mp3 +0 -0
- package/assets/audio/on02.mp3 +0 -0
- package/assets/audio/on03.mp3 +0 -0
- package/assets/audio/on04.mp3 +0 -0
- package/assets/menu.png +0 -0
- package/assets/preset.png +0 -0
- package/assets/setting.png +0 -0
- package/assets/ui/api-key-whale.png +0 -0
- package/assets/ui/mixer-whale.png +0 -0
- package/assets/ui/preview-whale.png +0 -0
- package/assets/ui/toggle-characters.png +0 -0
- package/lib/client/conversation-state.d.ts +39 -0
- package/lib/client/conversation-state.d.ts.map +1 -0
- package/lib/client/conversation.d.ts +21 -8
- package/lib/client/conversation.d.ts.map +1 -1
- package/lib/client/dsh-compat.d.ts +28 -0
- package/lib/client/dsh-compat.d.ts.map +1 -0
- package/lib/client/index.d.ts +2 -2
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/live-speech-controller.d.ts +7 -0
- package/lib/client/live-speech-controller.d.ts.map +1 -1
- package/lib/client/local-speech-controller.d.ts +51 -0
- package/lib/client/local-speech-controller.d.ts.map +1 -0
- package/lib/client/local-voice-picker.d.ts +14 -0
- package/lib/client/local-voice-picker.d.ts.map +1 -0
- package/lib/client/localization.d.ts +103 -65
- package/lib/client/localization.d.ts.map +1 -1
- package/lib/client/pcm-audio-queue.d.ts +1 -0
- package/lib/client/pcm-audio-queue.d.ts.map +1 -1
- package/lib/client/pcm-play-service.d.ts +18 -0
- package/lib/client/pcm-play-service.d.ts.map +1 -0
- package/lib/client/playback-controller.d.ts +6 -3
- package/lib/client/playback-controller.d.ts.map +1 -1
- package/lib/client/playback-types.d.ts +1 -1
- package/lib/client/playback-types.d.ts.map +1 -1
- package/lib/client/playback.d.ts +1 -0
- package/lib/client/playback.d.ts.map +1 -1
- package/lib/client/preview-player.d.ts +40 -0
- package/lib/client/preview-player.d.ts.map +1 -0
- package/lib/client/settings-card.d.ts +2 -2
- package/lib/client/settings-card.d.ts.map +1 -1
- package/lib/client/settings-scope.d.ts +2 -2
- package/lib/client/settings-scope.d.ts.map +1 -1
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.d.ts.map +1 -1
- package/lib/client/toggle-sound-player.d.ts +13 -0
- package/lib/client/toggle-sound-player.d.ts.map +1 -0
- package/lib/client-api.d.ts +13 -0
- package/lib/client-api.d.ts.map +1 -0
- package/lib/client-api.js +1 -0
- package/lib/client.js +2164 -529
- package/lib/client.js.map +1 -1
- package/lib/conversation-state.js +25 -0
- package/lib/debug-console-0u5uTAfX.js +6 -0
- package/lib/debug-console.d.ts +3 -0
- package/lib/debug-console.d.ts.map +1 -0
- package/lib/index.d.ts +7 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +189 -10
- package/lib/pcm-stream.d.ts +4 -0
- package/lib/pcm-stream.d.ts.map +1 -0
- package/lib/pcm-stream.js +91 -0
- package/lib/settings-compat-B_MTrCCL.js +18 -0
- package/lib/settings-compat.d.ts +16 -0
- package/lib/settings-compat.d.ts.map +1 -0
- package/lib/settings-compat.js +3 -0
- package/lib/{shared-CIx9nBxX.js → shared-BfEte3bu.js} +51 -3
- package/lib/shared.d.ts +27 -2
- package/lib/shared.d.ts.map +1 -1
- package/lib/shared.js +2 -2
- package/package.json +140 -104
package/README.en.md
CHANGED
|
@@ -24,6 +24,7 @@ Add Xiaomi MiMo TTS read-aloud playback to assistant replies in DeepSeek Harness
|
|
|
24
24
|
- Shows a read-aloud button below each completed assistant reply body when needed; enabled by default.
|
|
25
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
26
|
- Uses `mimo-v2.5-tts-voicedesign` Voice Design to create the voice you want from a text description.
|
|
27
|
+
- Supports bidirectional browser-speech fallback for both MiMo models, using every offline or online voice exposed by the browser with MiMo first, local first, or disabled strategies.
|
|
27
28
|
- 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
29
|
- Presents built-in voices in a two-column selector using Xiaomi MiMo's official avatars, names, and summaries.
|
|
29
30
|
- Keeps the API key on the DSH Host. The browser sends only the reply body text to a same-origin Host route.
|
|
@@ -32,11 +33,13 @@ Add Xiaomi MiMo TTS read-aloud playback to assistant replies in DeepSeek Harness
|
|
|
32
33
|
|
|
33
34
|
## Requirements
|
|
34
35
|
|
|
35
|
-
- `@deepseek-ai/dsh` `0.1.
|
|
36
|
-
- Node.js 22+
|
|
37
|
-
- Xiaomi MiMo API Key
|
|
36
|
+
- `@deepseek-ai/dsh` `0.1.2-rc.1` (the verified host for `V3.0.1-alpha`)
|
|
37
|
+
- Node.js 22+
|
|
38
|
+
- Xiaomi MiMo API Key
|
|
39
|
+
|
|
40
|
+
Verified reliable combinations: `V3.0.0` + `0.1.1-rc.2`, and `V3.0.1-alpha` + `0.1.2-rc.1`. `V3.0.0` cannot show or play the read-aloud button on `0.1.2-rc.1`; `V3.0.1-alpha` cannot show the settings menu on `0.1.1-rc.2`. Do not mix these combinations.
|
|
38
41
|
|
|
39
|
-
Official Xiaomi MiMo TTS API reference: <https://mimo.mi.com/
|
|
42
|
+
Official Xiaomi MiMo TTS API reference: <https://mimo.mi.com/models/zh-CN/mimo-v2.5-tts>
|
|
40
43
|
|
|
41
44
|
## Install
|
|
42
45
|
|
|
@@ -62,18 +65,22 @@ After installation, restart `dsh web`, then open **Settings → Plugins → Plug
|
|
|
62
65
|
|
|
63
66
|
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
67
|
|
|
65
|
-
```powershell
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
```powershell
|
|
69
|
+
pnpm pack
|
|
70
|
+
.\start\dsh-plugin-reinstall.bat .\dsh-xiaomi-tts-3.0.1-alpha.tgz
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`3.0.1-alpha` is not published to npm yet, so validate it from the local tarball. The first argument also accepts a complete npm spec; a plain version such as `3.0.0` remains shorthand for `dsh-xiaomi-tts@3.0.0`. The script strictly stops DSH Web, removes old packages and residual links, installs, checks `dump-config`, starts DSH Web, and runs HTTP/profile validation. If you run the steps manually, keep the same order:
|
|
70
74
|
|
|
71
75
|
```powershell
|
|
72
76
|
.\start\dsh-web-stop.bat
|
|
73
|
-
dsh plugin --profile web remove dsh-xiaomi-tts
|
|
74
|
-
dsh plugin --profile web add dsh-xiaomi-tts
|
|
75
|
-
.\start\dsh-web-start.bat
|
|
76
|
-
|
|
77
|
+
dsh plugin --profile web remove dsh-xiaomi-tts
|
|
78
|
+
dsh plugin --profile web add .\dsh-xiaomi-tts-3.0.1-alpha.tgz
|
|
79
|
+
.\start\dsh-web-start.bat
|
|
80
|
+
pnpm profile:check
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
These helpers default to the `web` profile at `127.0.0.1:3080`; override them with `DSH_HOME`, `DSH_WEB_HOST`, and `DSH_WEB_PORT`. In development Junction mode, set `DSH_PROFILE_EXPECT_CHECKOUT` before `pnpm profile:check` to also compare the on-disk and served client-bundle SHA256 values.
|
|
77
84
|
|
|
78
85
|
## Configuration
|
|
79
86
|
|
|
@@ -96,6 +103,12 @@ Young adult woman, bright and approachable voice, clear articulation, moderate p
|
|
|
96
103
|
|
|
97
104
|
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
105
|
|
|
106
|
+
**Browser local fallback speech**
|
|
107
|
+
|
|
108
|
+
The browser voice and fallback strategy stay at the bottom of the settings card for both models. MiMo first falls back from the currently selected MiMo model to the browser voice; local first tries the current MiMo model if browser speech fails; disabling local speech uses only MiMo. The picker lists every voice exposed by the browser Web Speech API and labels each one Offline or Online from its `localService` flag. Available online voices depend on the browser, operating system, and network speech services.
|
|
109
|
+
|
|
110
|
+
The list orders all offline voices first, followed by online Chinese (`zh-*`), online English (`en-*`), and other online voices. Each browser-speech segment waits for 2 minutes by default; a timeout stops it and falls back to MiMo when the selected strategy permits.
|
|
111
|
+
|
|
99
112
|
Browsers may block autoplay. If that happens, click the read-aloud button first.
|
|
100
113
|
|
|
101
114
|
### Speech text preprocessing
|
|
@@ -104,6 +117,34 @@ Read-aloud uses only the cleaned reply body and does not modify the assistant me
|
|
|
104
117
|
|
|
105
118
|
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
119
|
|
|
120
|
+
## Third-party plugin integration
|
|
121
|
+
|
|
122
|
+
Web client plugins can optionally use this plugin's PCM streaming playback capability. The recommended integration is one line at the point where speech is needed:
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
ctx.get('xiaomiMimoTts')?.play('Welcome back')
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Do not declare `xiaomiMimoTts` as a required `inject` service, and do not import `dsh-xiaomi-tts` at runtime. `ctx.get()` resolves the capability on every call. If this plugin is not installed, is not ready yet, or is later removed, it returns `undefined` and the third-party plugin remains fully available.
|
|
129
|
+
|
|
130
|
+
`play()` returns immediately and is best effort; it never throws to the caller. It always uses `/plugins/xiaomi-mimo-tts/synthesize-stream` with the `mimo-v2.5-tts` PCM16 stream and reuses the API key, built-in voice, base URL, timeout, and text-length limit saved in this plugin. A disabled plugin, settings that are not ready, empty text, missing configuration, network errors, or browser autoplay blocking are silently skipped or logged by this plugin. New third-party speech interrupts current read-aloud playback, and normal read-aloud playback that starts later stops the third-party speech. To stop it explicitly, call `ctx.get('xiaomiMimoTts')?.stop()`.
|
|
131
|
+
|
|
132
|
+
For TypeScript hints, a third-party project may use a type-only import and declare this package as an optional peer dependency. Neither is required for the one-line call above:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import type { XiaomiMimoTtsService } from 'dsh-xiaomi-tts/client-api'
|
|
136
|
+
|
|
137
|
+
const tts = ctx.get('xiaomiMimoTts') as XiaomiMimoTtsService | undefined
|
|
138
|
+
tts?.play('Welcome back')
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"peerDependencies": { "dsh-xiaomi-tts": "^3.0.1-alpha" },
|
|
144
|
+
"peerDependenciesMeta": { "dsh-xiaomi-tts": { "optional": true } }
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
107
148
|
## Privacy
|
|
108
149
|
|
|
109
150
|
- The API key stays on the DSH Host and is never sent to the browser.
|
|
@@ -118,6 +159,7 @@ Please use [GitHub Issues](https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts
|
|
|
118
159
|
|
|
119
160
|
- `src/index.ts`: Host entry; registers Schemastery settings, both voice-asset groups, and complete-audio plus PCM/SSE synthesis routes.
|
|
120
161
|
- `src/shared.ts`: Shared Host/Client domain contracts, including settings types, defaults, text cleaning, sentence splitting, stream batching, and SSE parsing.
|
|
162
|
+
- `src/client-api.ts`: Optional PCM playback Service type contract for third-party Web client plugins.
|
|
121
163
|
- `src/client/index.tsx`: Web Client composition entry; binds DSH services, registers slots, injects styles, and owns controller lifecycles.
|
|
122
164
|
- `src/client/conversation.tsx`: React conversation adapter; observes DSH conversation snapshots and renders read-aloud actions.
|
|
123
165
|
- `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.
|
|
@@ -191,6 +233,10 @@ pnpm test
|
|
|
191
233
|
pnpm pack:check
|
|
192
234
|
```
|
|
193
235
|
|
|
236
|
+
Before release, use isolated `DSH_HOME` directories and validate the reliable combinations: `V3.0.0` + `0.1.1-rc.2`, and `V3.0.1-alpha` + `0.1.2-rc.1`. CI uses one packed artifact and sequentially checks both DSH versions for installation, Host composition, the status route, the settings namespace, and client-bundle registration. Browser menus and audio playback remain manual pre-release checks.
|
|
237
|
+
|
|
238
|
+
Use `pnpm build` for release output; it does not emit MiMoTTS Host or browser console traces. Use `pnpm build:debug` when diagnosing the PCM streaming path; that build enables the `[MiMoTTS Host]`, `[MiMoTTS Stream]`, `[MiMoTTS Audio]`, and `[MiMoTTS Service]` logs on both sides.
|
|
239
|
+
|
|
194
240
|
`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
241
|
|
|
196
242
|
## License
|
package/README.md
CHANGED
|
@@ -11,31 +11,61 @@
|
|
|
11
11
|
|
|
12
12
|
<p><a href="README.en.md"><strong>English README →</strong></a></p>
|
|
13
13
|
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [预览](#预览)
|
|
17
|
+
- [功能](#功能)
|
|
18
|
+
- [环境要求](#环境要求)
|
|
19
|
+
- [安装与使用](#安装与使用)
|
|
20
|
+
- [配置](#配置)
|
|
21
|
+
- [朗读文本处理](#朗读文本处理)
|
|
22
|
+
- [三方插件联动](#三方插件联动)
|
|
23
|
+
- [隐私](#隐私)
|
|
24
|
+
- [反馈与支持](#反馈与支持)
|
|
25
|
+
- [架构](#架构)
|
|
26
|
+
- [开发](#开发)
|
|
27
|
+
- [推荐插件](#推荐插件)
|
|
28
|
+
- [许可证](#许可证)
|
|
29
|
+
|
|
14
30
|
## 预览
|
|
15
31
|
| 预置音色 | 自定义音色 |
|
|
16
32
|
|:---:|:---:|
|
|
17
33
|
|  |  |
|
|
18
|
-
|
|
|
34
|
+
| 设置界面 | UI示例 |
|
|
35
|
+
|  |  |
|
|
19
36
|
|
|
20
37
|
## 功能
|
|
21
38
|
|
|
22
39
|
- 在对话操作栏中显示“朗读”按钮(默认开启)。
|
|
23
40
|
- 使用 `mimo-v2.5-tts` 输出流畅、清晰的音频;可选择 PCM 流式播放或 MP3/WAV 完整音频。
|
|
24
41
|
- 使用 `mimo-v2.5-tts-voicedesign` 通过文字描述创造你想要的声音。
|
|
42
|
+
- 两种 MiMo 模型都支持浏览器语音双向兜底,使用浏览器提供的离线或在线音色,并支持“MiMo 优先 / 本地优先 / 关闭本地语音”三种策略。
|
|
25
43
|
- 支持切换预置音色/自定义音色模型,配置 API Key、自动播报、音色、音频格式和音色描述。
|
|
26
44
|
- 丰富的自定义音色模板,自由切换和修改。
|
|
27
45
|
- 自动清洗需要朗读的文本:移除网址、文件路径、代码块、表情符号、图标和控制字符等。
|
|
28
46
|
|
|
29
47
|
## 环境要求
|
|
30
48
|
|
|
31
|
-
- `@deepseek-ai/dsh` `0.1.
|
|
32
|
-
- Node.js 22+
|
|
33
|
-
- Xiaomi MiMo API Key
|
|
49
|
+
- `@deepseek-ai/dsh` `0.1.2-rc.1`(与插件 `V3.0.1-alpha` 配套)
|
|
50
|
+
- Node.js 22+
|
|
51
|
+
- Xiaomi MiMo API Key
|
|
52
|
+
|
|
53
|
+
已验证的可靠组合:`V3.0.0` + `0.1.1-rc.2`;`V3.0.1-alpha` + `0.1.2-rc.1`。`V3.0.0` 在 `0.1.2-rc.1` 下无法显示播放按钮或播放,`V3.0.1-alpha` 在 `0.1.1-rc.2` 下无法显示设置菜单,因此不要交叉组合。
|
|
34
54
|
|
|
35
|
-
官方 TTS API 文档:<https://mimo.mi.com/
|
|
55
|
+
官方 TTS API 文档:<https://mimo.mi.com/models/zh-CN/mimo-v2.5-tts>
|
|
36
56
|
|
|
37
57
|
## 安装与使用
|
|
38
58
|
|
|
59
|
+
从 [DSH 插件市场](https://github.com/dsh-market/dsh-market) 安装 **(推荐)**:
|
|
60
|
+
|
|
61
|
+
1. 尚未安装插件市场时,先执行以下命令并重启 `dsh web`:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
dsh plugin --profile web add dshmarket
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
2. 打开 **设置 → 插件市场**,搜索 `dsh-xiaomi-tts` 并点击安装。
|
|
68
|
+
|
|
39
69
|
从 npm 安装 **(推荐)**:
|
|
40
70
|
|
|
41
71
|
```bash
|
|
@@ -60,18 +90,22 @@ dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
|
|
|
60
90
|
|
|
61
91
|
> 更新或从本地开发版切换到 npm 版时,必须先停止 DSH Web,避免 Windows Junction 被运行中的 Node 进程占用:
|
|
62
92
|
|
|
63
|
-
```powershell
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
93
|
+
```powershell
|
|
94
|
+
pnpm pack
|
|
95
|
+
.\start\dsh-plugin-reinstall.bat .\dsh-xiaomi-tts-3.0.1-alpha.tgz
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`3.0.1-alpha` 尚未发布到 npm,验证该版本必须使用本地 tarball。脚本第一参数也接受完整 npm spec;纯版本号(例如 `3.0.0`)会继续解析为 `dsh-xiaomi-tts@3.0.0`。脚本会严格执行停止、清理旧包/残留链接、安装、`dump-config`、启动及 HTTP/profile 校验。若手动操作,请保持相同顺序:
|
|
68
99
|
|
|
69
100
|
```powershell
|
|
70
101
|
.\start\dsh-web-stop.bat
|
|
71
|
-
dsh plugin --profile web remove dsh-xiaomi-tts
|
|
72
|
-
dsh plugin --profile web add dsh-xiaomi-tts
|
|
73
|
-
.\start\dsh-web-start.bat
|
|
74
|
-
|
|
102
|
+
dsh plugin --profile web remove dsh-xiaomi-tts
|
|
103
|
+
dsh plugin --profile web add .\dsh-xiaomi-tts-3.0.1-alpha.tgz
|
|
104
|
+
.\start\dsh-web-start.bat
|
|
105
|
+
pnpm profile:check
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
这些辅助脚本默认使用 `web` profile、`127.0.0.1:3080`;可用 `DSH_HOME`、`DSH_WEB_HOST` 和 `DSH_WEB_PORT` 覆盖。开发 Junction 模式下,设置 `DSH_PROFILE_EXPECT_CHECKOUT` 后运行 `pnpm profile:check`,还会核对磁盘和服务端客户端 bundle 的 SHA256。
|
|
75
109
|
|
|
76
110
|
## 配置
|
|
77
111
|
|
|
@@ -94,12 +128,35 @@ dsh plugin --profile web add dsh-xiaomi-tts@2.3.4
|
|
|
94
128
|
|
|
95
129
|
建议包含年龄段与性别、声音质感、语速节奏和情绪底色,不写场景或动作。预置音色模式仍使用原来的内置音色配置。
|
|
96
130
|
|
|
131
|
+
**浏览器本地兜底语音**
|
|
132
|
+
|
|
133
|
+
预置音色和 Voice Design 均支持三种策略:“MiMo 优先”在 MiMo 失败时改用浏览器语音;“本地优先”先用浏览器语音,失败时再尝试 MiMo;“关闭本地语音”仅使用 MiMo。可选音色来自浏览器 Web Speech API,是否离线及实际可用范围取决于浏览器、操作系统和网络服务。
|
|
134
|
+
|
|
97
135
|
|
|
98
136
|
## 朗读文本处理
|
|
99
137
|
|
|
100
|
-
|
|
138
|
+
插件只朗读清理后的正文,不会修改聊天记录。处理时会保留 Markdown 链接标题,移除链接地址、文件路径、代码块、表情及不可见字符,并统一朗读标点。
|
|
139
|
+
|
|
140
|
+
PCM 模式会在回复生成时分段流式朗读,已完成的回复则一次请求并边接收边播放;MP3 和 WAV 会等待完整音频。默认响应上限为 MP3 32 MiB、WAV 128 MiB,可通过 `maxMp3AudioBytes` 和 `maxWavAudioBytes` 调整。
|
|
141
|
+
|
|
142
|
+
## 三方插件联动
|
|
101
143
|
|
|
102
|
-
|
|
144
|
+
Web 客户端插件可以按需调用本插件的 PCM 流式播放能力。推荐直接在需要播放的位置写一行:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
ctx.get('xiaomiMimoTts')?.play('欢迎回来')
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
请通过 `ctx.get()` 动态获取这项可选能力,不要声明为必需的 `inject` 服务。插件未安装或未就绪时调用会安全跳过;`play()` 使用用户已保存的 MiMo 设置播放 PCM 流,`stop()` 可主动停止。新播放会自动打断当前朗读。
|
|
151
|
+
|
|
152
|
+
需要 TypeScript 类型提示时可仅导入类型:
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
import type { XiaomiMimoTtsService } from 'dsh-xiaomi-tts/client-api'
|
|
156
|
+
|
|
157
|
+
const tts = ctx.get('xiaomiMimoTts') as XiaomiMimoTtsService | undefined
|
|
158
|
+
tts?.play('欢迎回来')
|
|
159
|
+
```
|
|
103
160
|
|
|
104
161
|
## 隐私
|
|
105
162
|
|
|
@@ -113,68 +170,19 @@ dsh plugin --profile web add dsh-xiaomi-tts@2.3.4
|
|
|
113
170
|
|
|
114
171
|
## 架构
|
|
115
172
|
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
- `src/client/conversation.tsx`:React 会话适配层,订阅 DSH 会话快照并渲染朗读操作。
|
|
120
|
-
- `src/client/settings-card.tsx`、`built-in-voice-picker.tsx` 与 `voice-design-picker.tsx`:插件设置表单、官方内置音色面板和 Voice Design 音色选择 UI。
|
|
121
|
-
- `src/client/live-speech-controller.ts`、`pcm-audio-queue.ts` 与 `playback-controller.ts`:分别管理实时朗读状态机、Web Audio PCM 调度和完整音频播放。
|
|
122
|
-
- `src/client/settings-scope.ts`:使用 `useSyncExternalStore` 将 DSH Settings Scope 安全接入 React。
|
|
173
|
+
- **共享层**:统一配置、文本清理、分段和 SSE 契约。
|
|
174
|
+
- **Host 插件**:管理设置与静态资源,并代理 MiMo 完整音频和 PCM 流式请求。
|
|
175
|
+
- **Web Client**:提供设置与朗读入口,负责播放状态、浏览器语音兜底和第三方播放服务。
|
|
123
176
|
|
|
124
177
|
```mermaid
|
|
125
|
-
flowchart
|
|
126
|
-
DSH["
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
subgraph Shared["共享领域层"]
|
|
136
|
-
SH["src/shared.ts<br/>配置、文本处理、分句与 SSE"]
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
subgraph Client["Web Client"]
|
|
140
|
-
ENTRY["client/index.tsx<br/>组合入口"]
|
|
141
|
-
LOCALE["localization.ts"]
|
|
142
|
-
STYLE["styles.ts"]
|
|
143
|
-
SCOPE["settings-scope.ts<br/>useSyncExternalStore"]
|
|
144
|
-
FORM["settings-card.tsx"]
|
|
145
|
-
PICKER["voice-design-picker.tsx"]
|
|
146
|
-
CONV["conversation.tsx<br/>会话观察与朗读按钮"]
|
|
147
|
-
|
|
148
|
-
subgraph Audio["音频运行时"]
|
|
149
|
-
LIVE["live-speech-controller.ts<br/>流式语音状态机"]
|
|
150
|
-
PCM["pcm-audio-queue.ts<br/>Web Audio PCM 调度"]
|
|
151
|
-
COMPLETE["playback-controller.ts<br/>完整音频播放"]
|
|
152
|
-
end
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
API["Xiaomi MiMo API"]
|
|
156
|
-
|
|
157
|
-
DSH --> HI
|
|
158
|
-
DSH --> ENTRY
|
|
159
|
-
SH --> HI
|
|
160
|
-
SH --> SCOPE
|
|
161
|
-
SH --> CONV
|
|
162
|
-
SH --> LIVE
|
|
163
|
-
HI --> SETTINGS
|
|
164
|
-
HI --> ROUTES
|
|
165
|
-
HI --> ASSETS
|
|
166
|
-
ROUTES --> API
|
|
167
|
-
ENTRY --> LOCALE
|
|
168
|
-
ENTRY --> STYLE
|
|
169
|
-
ENTRY --> SCOPE
|
|
170
|
-
ENTRY --> FORM
|
|
171
|
-
ENTRY --> CONV
|
|
172
|
-
FORM --> PICKER
|
|
173
|
-
CONV --> LIVE
|
|
174
|
-
CONV --> COMPLETE
|
|
175
|
-
LIVE --> PCM
|
|
176
|
-
LIVE --> ROUTES
|
|
177
|
-
COMPLETE --> ROUTES
|
|
178
|
+
flowchart LR
|
|
179
|
+
DSH["DSH Web"] --> CLIENT["Web Client<br/>设置与播放"]
|
|
180
|
+
THIRD["第三方 Web 插件"] -. "ctx.get('xiaomiMimoTts')" .-> CLIENT
|
|
181
|
+
CLIENT -->|"完整音频 / PCM 流"| HOST["Host 插件<br/>设置与 API 代理"]
|
|
182
|
+
HOST --> MIMO["Xiaomi MiMo API"]
|
|
183
|
+
CLIENT -->|"本地语音兜底"| SPEECH["浏览器 Web Speech API"]
|
|
184
|
+
SHARED["共享层<br/>配置、文本处理、SSE"] -.-> CLIENT
|
|
185
|
+
SHARED -.-> HOST
|
|
178
186
|
```
|
|
179
187
|
|
|
180
188
|
## 开发
|
|
@@ -186,8 +194,22 @@ pnpm test
|
|
|
186
194
|
pnpm pack:check
|
|
187
195
|
```
|
|
188
196
|
|
|
197
|
+
发布前使用互相隔离的 `DSH_HOME`,按可靠组合验证:`V3.0.0` + `0.1.1-rc.2`,以及 `V3.0.1-alpha` + `0.1.2-rc.1`。CI 使用同一个打包产物依次对两个 DSH 版本执行自动安装、Host、状态路由、settings namespace 和客户端 bundle smoke;浏览器菜单与音频播放仍需发布前人工验证。
|
|
198
|
+
|
|
199
|
+
日常发布构建使用 `pnpm build`,不会输出 MiMoTTS 的 Host 或浏览器控制台追踪。排查 PCM 流式链路时使用 `pnpm build:debug`,该构建会同时启用 `[MiMoTTS Host]`、`[MiMoTTS Stream]`、`[MiMoTTS Audio]` 和 `[MiMoTTS Service]` 日志。
|
|
200
|
+
|
|
189
201
|
`lib/` 是构建产物,不纳入日常代码提交。提交功能时只更新源码和测试;升级版本并执行 `pnpm pack` 或 `pnpm publish` 时,`prepack` 会自动重新生成发布包。直接从 GitHub 安装时,`prepare` 会在安装阶段构建该产物。
|
|
190
202
|
|
|
203
|
+
## 推荐插件
|
|
204
|
+
|
|
205
|
+
推荐配合本插件一起食用:
|
|
206
|
+
|
|
207
|
+
- [dsh-whale-musume](https://github.com/Sutera-Diffusus/dsh-whale-musume#readme):元气鲸鱼娘桌宠。
|
|
208
|
+
- [dsh-plugin-uisfx](https://github.com/XanthanL/dsh-plugin-uisfx#readme):语义化 UI 音效。
|
|
209
|
+
- [dsh-codex-timeline](https://github.com/Wine-Red/dsh-codex-timeline#readme):Codex 风格时间线与会话搜索。
|
|
210
|
+
- [dsh-dream-skin](https://github.com/RevolutionLA/dsh-dream-skin#readme):原生换肤、背景壁纸、强调色、主题包 。
|
|
211
|
+
|
|
212
|
+
|
|
191
213
|
## 许可证
|
|
192
214
|
|
|
193
215
|
MIT
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/assets/menu.png
CHANGED
|
Binary file
|
package/assets/preset.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface LegacyConversationNodeCompat {
|
|
2
|
+
readonly kind: string;
|
|
3
|
+
readonly messageId?: string;
|
|
4
|
+
readonly blocks: readonly {
|
|
5
|
+
readonly kind: string;
|
|
6
|
+
readonly text?: string;
|
|
7
|
+
}[];
|
|
8
|
+
readonly turn: number;
|
|
9
|
+
readonly step: number;
|
|
10
|
+
readonly time: number;
|
|
11
|
+
readonly interrupted?: true;
|
|
12
|
+
}
|
|
13
|
+
export interface LegacyConversationSliceCompat {
|
|
14
|
+
readonly nodes: readonly LegacyConversationNodeCompat[];
|
|
15
|
+
readonly partial: {
|
|
16
|
+
readonly turn: number;
|
|
17
|
+
readonly step: number;
|
|
18
|
+
readonly blocks: readonly {
|
|
19
|
+
readonly kind: string;
|
|
20
|
+
readonly text?: string;
|
|
21
|
+
}[];
|
|
22
|
+
} | null;
|
|
23
|
+
}
|
|
24
|
+
export interface SessionSnapshotCompat {
|
|
25
|
+
readonly running?: boolean;
|
|
26
|
+
readonly nodes?: unknown;
|
|
27
|
+
readonly partial?: unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface ChatSnapshotCompat {
|
|
30
|
+
readonly legacy: LegacyConversationSliceCompat;
|
|
31
|
+
}
|
|
32
|
+
export interface ConversationCompatState {
|
|
33
|
+
readonly legacy: LegacyConversationSliceCompat;
|
|
34
|
+
readonly running: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const EMPTY_LEGACY_CONVERSATION: LegacyConversationSliceCompat;
|
|
37
|
+
/** Normalize the old ConversationSnapshot and the new ChatSnapshot without version checks. */
|
|
38
|
+
export declare function resolveConversationCompatState(chatLegacy: unknown, sessionSnapshot: unknown, ownerSession: unknown): ConversationCompatState;
|
|
39
|
+
//# sourceMappingURL=conversation-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-state.d.ts","sourceRoot":"","sources":["../../src/client/conversation-state.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC7E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,IAAI,CAAA;CAC5B;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,KAAK,EAAE,SAAS,4BAA4B,EAAE,CAAA;IACvD,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,MAAM,EAAE,SAAS;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAC9E,GAAG,IAAI,CAAA;CACT;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,6BAA6B,CAAA;CAC/C;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,6BAA6B,CAAA;IAC9C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAED,eAAO,MAAM,yBAAyB,EAAE,6BAGtC,CAAA;AAeF,8FAA8F;AAC9F,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,OAAO,EACnB,eAAe,EAAE,OAAO,EACxB,YAAY,EAAE,OAAO,GACpB,uBAAuB,CAazB"}
|
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
|
-
import type { ConversationSnapshot, SettingsScope } from '@deepseek-ai/dsh-client-runtime/client';
|
|
3
2
|
import type { TtsSettings } from '../shared.js';
|
|
3
|
+
import { type ChatSnapshotCompat, type SessionSnapshotCompat } from './conversation-state.js';
|
|
4
|
+
import type { SettingsScopeCompat } from './dsh-compat.js';
|
|
4
5
|
import type { Translate } from './localization.js';
|
|
5
|
-
import { LiveSpeechController, PlaybackController } from './playback.js';
|
|
6
|
+
import { LiveSpeechController, LocalSpeechController, PlaybackController } from './playback.js';
|
|
7
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
8
|
+
interface SessionStandardProps {
|
|
9
|
+
useChat: <T>(selector: (snapshot: ChatSnapshotCompat) => T) => T;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
6
12
|
interface SessionPlaybackObserverProps {
|
|
7
13
|
sessionId: string;
|
|
8
|
-
session
|
|
14
|
+
session?: unknown;
|
|
15
|
+
messageId?: string;
|
|
16
|
+
useSession?: <T>(selector: (snapshot: SessionSnapshotCompat) => T) => T;
|
|
17
|
+
useChat?: <T>(selector: (snapshot: ChatSnapshotCompat) => T) => T;
|
|
9
18
|
playback: PlaybackController;
|
|
10
19
|
live: LiveSpeechController;
|
|
11
|
-
|
|
20
|
+
local: LocalSpeechController;
|
|
21
|
+
settings: SettingsScopeCompat<TtsSettings>;
|
|
12
22
|
}
|
|
13
23
|
/** Own the active-session boundary and feed its partial assistant output into realtime speech. */
|
|
14
|
-
export declare function SessionPlaybackObserver({ sessionId, session, playback, live, settings }: SessionPlaybackObserverProps): null;
|
|
24
|
+
export declare function SessionPlaybackObserver({ sessionId, session, useSession, useChat, playback, live, local, settings }: SessionPlaybackObserverProps): null;
|
|
15
25
|
interface ReadAloudActionProps {
|
|
16
26
|
sessionId: string;
|
|
17
27
|
messageId: string;
|
|
18
|
-
|
|
28
|
+
session?: unknown;
|
|
29
|
+
useSession?: <T>(selector: (snapshot: SessionSnapshotCompat) => T) => T;
|
|
30
|
+
useChat?: <T>(selector: (snapshot: ChatSnapshotCompat) => T) => T;
|
|
19
31
|
playback: PlaybackController;
|
|
20
32
|
live: LiveSpeechController;
|
|
21
|
-
|
|
33
|
+
local: LocalSpeechController;
|
|
34
|
+
settings: SettingsScopeCompat<TtsSettings>;
|
|
22
35
|
t: Translate;
|
|
23
36
|
}
|
|
24
|
-
export declare function ReadAloudAction({ sessionId, messageId, useSession, playback, live, settings, t }: ReadAloudActionProps): ReactElement | null;
|
|
37
|
+
export declare function ReadAloudAction({ sessionId, messageId, session, useSession, useChat, playback, live, local, settings, t }: ReadAloudActionProps): ReactElement | null;
|
|
25
38
|
export {};
|
|
26
39
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/client/conversation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/client/conversation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAUzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAI/F,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,oBAAoB;QAC5B,OAAO,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,CAAC,KAAK,CAAC,CAAA;KACjE;CACF;AAoFD,UAAU,4BAA4B;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,CAAC,KAAK,CAAC,CAAA;IACvE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,CAAC,KAAK,CAAC,CAAA;IACjE,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,oBAAoB,CAAA;IAC1B,KAAK,EAAE,qBAAqB,CAAA;IAC5B,QAAQ,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAA;CAC3C;AAED,kGAAkG;AAClG,wBAAgB,uBAAuB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,4BAA4B,GAAG,IAAI,CAsGxJ;AAED,UAAU,oBAAoB;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,CAAC,KAAK,CAAC,CAAA;IACvE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,CAAC,KAAK,CAAC,CAAA;IACjE,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,oBAAoB,CAAA;IAC1B,KAAK,EAAE,qBAAqB,CAAA;IAC5B,QAAQ,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAA;IAC1C,CAAC,EAAE,SAAS,CAAA;CACb;AAED,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,oBAAoB,GAAG,YAAY,GAAG,IAAI,CAmIrK"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
/** Stable structural subset shared by the supported DSH settings implementations. */
|
|
3
|
+
export interface SettingsScopeSnapshotCompat<T> {
|
|
4
|
+
readonly status: 'loading' | 'ready' | 'unavailable';
|
|
5
|
+
readonly value: T | undefined;
|
|
6
|
+
readonly base: unknown;
|
|
7
|
+
readonly user: unknown;
|
|
8
|
+
readonly revision: number | undefined;
|
|
9
|
+
readonly writable: boolean;
|
|
10
|
+
readonly mode: 'host' | 'memory';
|
|
11
|
+
}
|
|
12
|
+
/** Avoid tying the published client declarations to the removed client-runtime package. */
|
|
13
|
+
export interface SettingsScopeCompat<T> {
|
|
14
|
+
getSnapshot(): SettingsScopeSnapshotCompat<T>;
|
|
15
|
+
subscribe(listener: () => void): () => void;
|
|
16
|
+
set(field: string, value: unknown): Promise<void>;
|
|
17
|
+
unset(field: string): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
interface ClientSlotRegistryCompat {
|
|
20
|
+
inject(name: string, register: () => void): void;
|
|
21
|
+
register(options: Readonly<Record<string, unknown>>, component: unknown): (() => void) | Iterable<() => void>;
|
|
22
|
+
}
|
|
23
|
+
/** The slots service moved out of client-runtime in 0.1.2; its used surface stayed stable. */
|
|
24
|
+
export type ClientContextCompat = Context & {
|
|
25
|
+
readonly slots: ClientSlotRegistryCompat;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=dsh-compat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dsh-compat.d.ts","sourceRoot":"","sources":["../../src/client/dsh-compat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,qFAAqF;AACrF,MAAM,WAAW,2BAA2B,CAAC,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,aAAa,CAAA;IACpD,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;CACjC;AAED,2FAA2F;AAC3F,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,WAAW,IAAI,2BAA2B,CAAC,CAAC,CAAC,CAAA;IAC7C,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;IAC3C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACpC;AAED,UAAU,wBAAwB;IAChC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;IAChD,QAAQ,CACN,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1C,SAAS,EAAE,OAAO,GACjB,CAAC,MAAM,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,CAAA;CACvC;AAED,8FAA8F;AAC9F,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG;IAC1C,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAA;CACzC,CAAA"}
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ClientContextCompat } from './dsh-compat.js';
|
|
2
2
|
/** Client services required by this plugin. */
|
|
3
3
|
export declare const inject: string[];
|
|
4
4
|
/** Register the Web action, settings card, locale dictionaries, and styles. */
|
|
5
|
-
export declare function apply(ctx:
|
|
5
|
+
export declare function apply(ctx: ClientContextCompat): void;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,+CAA+C;AAC/C,eAAO,MAAM,MAAM,UAMlB,CAAA;AA4BD,+EAA+E;AAC/E,wBAAgB,KAAK,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAkEpD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LiveSpeechCursor } from '../shared.js';
|
|
1
2
|
import type { LiveMessageIdentity, PlaybackStatus } from './playback-types.js';
|
|
2
3
|
export declare class LiveSpeechController {
|
|
3
4
|
private readonly audio;
|
|
@@ -15,8 +16,13 @@ export declare class LiveSpeechController {
|
|
|
15
16
|
private audioBusy;
|
|
16
17
|
private blockedTurn;
|
|
17
18
|
private completed;
|
|
19
|
+
private audioStarted;
|
|
20
|
+
private fallbackHandler;
|
|
18
21
|
private onStateChange;
|
|
22
|
+
private beforePlayback;
|
|
19
23
|
setStateChangeListener(listener: (sessionId: string, messageId: string, status: PlaybackStatus) => void): void;
|
|
24
|
+
setFallbackHandler(handler: ((cursor: LiveSpeechCursor, text: string) => void) | null): void;
|
|
25
|
+
setBeforePlayback(handler: (() => void) | null): void;
|
|
20
26
|
setMaxPausedPcmBytes(value: number): void;
|
|
21
27
|
pause(sessionId: string): Promise<boolean>;
|
|
22
28
|
resume(sessionId: string): Promise<boolean>;
|
|
@@ -30,6 +36,7 @@ export declare class LiveSpeechController {
|
|
|
30
36
|
hasHandled(sessionId: string, identity: Pick<LiveMessageIdentity, 'turn' | 'step'> | null): boolean;
|
|
31
37
|
cancelSession(sessionId: string): void;
|
|
32
38
|
cancel(): void;
|
|
39
|
+
interrupt(): void;
|
|
33
40
|
dispose(): Promise<void>;
|
|
34
41
|
private reset;
|
|
35
42
|
private advanceSegment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-speech-controller.d.ts","sourceRoot":"","sources":["../../src/client/live-speech-controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"live-speech-controller.d.ts","sourceRoot":"","sources":["../../src/client/live-speech-controller.ts"],"names":[],"mappings":"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"}
|