dsh-xiaomi-tts 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-xiaomi-tts contributors
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/README.en.md ADDED
@@ -0,0 +1,47 @@
1
+ # dsh-xiaomi-tts
2
+
3
+ [中文说明](README.md)
4
+
5
+ Xiaomi MiMo text-to-speech controls for finalized assistant messages in DeepSeek Harness Web.
6
+
7
+ ## Screenshots
8
+
9
+ ![Xiaomi MiMo settings menu](assets/menu.png)
10
+
11
+ ![Read aloud button](assets/play.png)
12
+
13
+ ![Pause button](assets/pause.png)
14
+
15
+ ## Features
16
+
17
+ - Adds a read-aloud button to the assistant message action strip.
18
+ - Uses Xiaomi MiMo's official `mimo-v2.5-tts` Chat Completions-compatible API.
19
+ - Configures the API key, autoplay, built-in voice, MP3/WAV format, and reading instruction under **Settings → Plugins → Plugin configuration**.
20
+ - Keeps the API key on the DSH Host. The browser sends only the response text to a same-origin plugin route.
21
+ - Supports pause, resume, regeneration, request errors, and browser autoplay rejection.
22
+ - The settings card is collapsed by default and expands on click.
23
+
24
+ Official Xiaomi MiMo TTS reference: <https://mimo.mi.com/static/docs/api/audio/tts.md>
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ dsh plugin --profile web add dsh-xiaomi-tts
30
+ ```
31
+
32
+ Restart `dsh web`, then open **Settings → Plugins → Plugin configuration** and save a Xiaomi MiMo API key.
33
+
34
+ ## Development
35
+
36
+ ```bash
37
+ pnpm install
38
+ pnpm typecheck
39
+ pnpm test
40
+ pnpm pack:check
41
+ ```
42
+
43
+ The response text is sent to Xiaomi MiMo when speech is generated. Review Xiaomi's privacy and data-handling terms before using the plugin with sensitive content.
44
+
45
+ ## License
46
+
47
+ MIT
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # dsh-xiaomi-tts
2
+
3
+ 为 DeepSeek Harness Web 的助手回复添加 Xiaomi MiMo TTS 语音朗读。
4
+
5
+ ## 界面预览
6
+
7
+ 设置菜单中的插件配置默认收起,点击标题即可展开;助手回复操作栏会显示朗读、暂停和继续按钮。
8
+
9
+ ![Xiaomi MiMo 设置菜单](assets/menu.png)
10
+
11
+ ![朗读按钮](assets/play.png)
12
+
13
+ ![暂停按钮](assets/pause.png)
14
+
15
+ ## 功能
16
+
17
+ - 在每条已完成助手回复正文下方的操作栏中添加“朗读”按钮。
18
+ - 调用 Xiaomi MiMo 官方 `mimo-v2.5-tts` 接口,把回复正文转成 MP3 或 WAV 并播放。
19
+ - 在 **设置 → 插件 → 插件配置** 中配置 API Key、自动播报、音色、格式和朗读指令。
20
+ - API Key 仅由 DSH Host 读取,浏览器只向同源 Host 路由提交回复正文。
21
+ - 支持暂停、继续、重新生成,以及浏览器自动播放被拦截时的提示。
22
+ - 设置卡片默认折叠,减少插件配置占用的页面空间。
23
+
24
+ > 当前版本聚焦官方内置音色模型 `mimo-v2.5-tts`,暂不提供 Voice Design 与 Voice Clone 配置。
25
+
26
+ ## 环境要求
27
+
28
+ - `@deepseek-ai/dsh` `0.1.0-rc.7` 或兼容版本
29
+ - Node.js 22+
30
+ - Xiaomi MiMo API Key
31
+
32
+ 官方 TTS API 文档:<https://mimo.mi.com/static/docs/api/audio/tts.md>
33
+
34
+ ## 安装
35
+
36
+ 从 npm 安装:
37
+
38
+ ```bash
39
+ dsh plugin --profile web add dsh-xiaomi-tts
40
+ ```
41
+
42
+ 从本地目录安装:
43
+
44
+ ```bash
45
+ dsh plugin --profile web add ./dsh-plugin-xiaomi-mimo-tts
46
+ ```
47
+
48
+ 从 GitHub 安装:
49
+
50
+ ```bash
51
+ dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
52
+ ```
53
+
54
+ 安装后重启 `dsh web`,打开 **设置 → 插件 → 插件配置 → Xiaomi MiMo 语音朗读**,填写 API Key 并保存。
55
+
56
+ ## 配置
57
+
58
+ 可用内置音色:
59
+
60
+ - 中文女声:`冰糖`、`茉莉`
61
+ - 中文男声:`苏打`、`白桦`
62
+ - 英文女声:`Mia`、`Chloe`
63
+ - 英文男声:`Milo`、`Dean`
64
+
65
+ 设置卡片默认收起。点击“Xiaomi MiMo 语音朗读”标题后,可配置:
66
+
67
+ - API Key
68
+ - 是否自动播报新回复
69
+ - 内置音色
70
+ - MP3/WAV 输出格式
71
+ - 朗读风格指令
72
+
73
+ 默认配置位于 `cordis.patch.yml`,用户设置会覆盖 composition 默认值。
74
+
75
+ ## 自动播报说明
76
+
77
+ 浏览器通常要求页面先发生一次用户交互,才允许带声音的自动播放。如果浏览器拒绝 `audio.play()`,插件不会绕过浏览器策略,点击回复下方的朗读按钮即可播放。
78
+
79
+ 为避免刚启用插件或打开历史会话时批量朗读旧消息,自动播报只处理插件加载后短时间内新挂载的回复操作项。
80
+
81
+ ## 安全设计
82
+
83
+ - `apiKey` 的 Schemastery schema 标记为 `role('secret')`。
84
+ - 设置描述通过 DSH wire 传到浏览器时会脱敏。
85
+ - Host 使用 API Key 请求 `https://api.xiaomimimo.com/v1/chat/completions`。
86
+ - 音频响应不会持久化到磁盘,浏览器使用临时 Blob URL 播放并在切换时释放。
87
+ - Host 路由限制请求体大小、正文长度和请求超时。
88
+
89
+ 请注意:回复正文会发送给 Xiaomi MiMo 服务,请在使用前确认内容符合你的隐私与合规要求。
90
+
91
+ ## 开发
92
+
93
+ ```bash
94
+ pnpm install
95
+ pnpm typecheck
96
+ pnpm test
97
+ pnpm pack:check
98
+ ```
99
+
100
+ ## 许可证
101
+
102
+ MIT
@@ -0,0 +1,148 @@
1
+ # dsh-xiaomi-tts
2
+
3
+ 为 DeepSeek Harness Web 的助手回复添加 Xiaomi MiMo TTS 语音朗读。
4
+
5
+ ## 功能
6
+
7
+ - 在每条已完成助手回复正文下方的操作栏中添加“朗读”按钮。
8
+ - 调用 Xiaomi MiMo 官方 `mimo-v2.5-tts` 接口,把回复正文转成 MP3 或 WAV 并播放。
9
+ - 在 **设置 → 插件 → 插件配置** 中配置:
10
+ - Xiaomi MiMo API Key
11
+ - 是否自动播报新回复
12
+ - 内置音色
13
+ - MP3/WAV 输出格式
14
+ - 朗读风格指令
15
+ - API Key 仅由 DSH Host 读取,请求 Xiaomi MiMo 也从 Host 发出;Key 不会交给浏览器代码。
16
+ - 支持暂停、继续、重新生成,以及浏览器自动播放被拦截时的提示。
17
+
18
+ > 当前版本聚焦官方内置音色模型 `mimo-v2.5-tts`,暂不提供 Voice Design 与 Voice Clone 配置。
19
+
20
+ ## 环境要求
21
+
22
+ - `@deepseek-ai/dsh` `0.1.0-rc.7` 或兼容版本
23
+ - Node.js 22+(建议使用 DSH 当前支持的 Node.js 版本)
24
+ - Xiaomi MiMo API Key
25
+
26
+ 官方 TTS API 文档:<https://mimo.mi.com/static/docs/api/audio/tts.md>
27
+
28
+ ## 从本地目录安装
29
+
30
+ 在插件仓库父目录执行:
31
+
32
+ ```bash
33
+ dsh plugin --profile web add ./dsh-plugin-xiaomi-mimo-tts
34
+ ```
35
+
36
+ 然后重启 `dsh web`。插件属于 Web profile 的 composition layer,安装命令会自动把声明了 `dsh.bundle` 的包加入 profile bundles。
37
+
38
+ 开发过程中修改源码后:
39
+
40
+ ```bash
41
+ cd dsh-plugin-xiaomi-mimo-tts
42
+ pnpm install
43
+ pnpm build
44
+ ```
45
+
46
+ 之后重启当前 `dsh web`,或在使用支持插件 HMR 的源码开发环境时触发相应重载。
47
+
48
+ ## 从 GitHub 安装
49
+
50
+ 发布仓库后可执行:
51
+
52
+ ```bash
53
+ dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
54
+ ```
55
+
56
+ Git 安装会运行 `prepare` 生成 `lib/`。如果 pnpm 阻止依赖构建,请根据 DSH 输出,把本包加入该 profile 的 `pnpm-workspace.yaml` `allowBuilds`,再重新安装。
57
+
58
+ ## 从 npm 安装
59
+
60
+ ```bash
61
+ dsh plugin --profile web add dsh-xiaomi-tts
62
+ ```
63
+
64
+ ## 配置
65
+
66
+ 打开:
67
+
68
+ ```text
69
+ 设置 → 插件 → 插件配置 → Xiaomi MiMo 语音朗读
70
+ ```
71
+
72
+ 填写 API Key,选择音色与格式,再保存。为避免从浏览器读取或显示敏感信息,设置卡不会回显当前密钥;输入新值并保存才会替换已有密钥。
73
+
74
+ 可用内置音色:
75
+
76
+ - 中文女声:`冰糖`、`茉莉`
77
+ - 中文男声:`苏打`、`白桦`
78
+ - 英文女声:`Mia`、`Chloe`
79
+ - 英文男声:`Milo`、`Dean`
80
+
81
+ 默认配置位于 `cordis.patch.yml`:
82
+
83
+ ```yaml
84
+ config:
85
+ apiKey: ''
86
+ baseURL: 'https://api.xiaomimimo.com/v1'
87
+ model: 'mimo-v2.5-tts'
88
+ voice: '冰糖'
89
+ format: 'mp3'
90
+ autoPlay: false
91
+ instruction: '请用自然、清晰、语速适中的语气朗读。'
92
+ maxTextLength: 12000
93
+ requestTimeoutMs: 120000
94
+ ```
95
+
96
+ 用户设置层会覆盖这些 composition 默认值。
97
+
98
+ ## 自动播报说明
99
+
100
+ 浏览器通常要求页面先发生一次用户交互,才允许带声音的自动播放。因此:
101
+
102
+ - 开启自动播报后,新完成的回复会尝试生成并播放语音;
103
+ - 如果浏览器拒绝 `audio.play()`,插件不会绕过浏览器策略;
104
+ - 用户点击该回复下方的朗读按钮即可播放。
105
+
106
+ 为避免刚启用插件或刚打开历史会话时批量朗读旧消息,自动播报仅在插件加载后的短时间窗口中尝试处理新挂载的回复操作项。
107
+
108
+ ## 安全设计
109
+
110
+ - `apiKey` 的 Schemastery schema 标记为 `role('secret')`。
111
+ - 设置描述通过 DSH wire 传到浏览器时会脱敏。
112
+ - 浏览器只向同源 Host 路由提交需要朗读的正文。
113
+ - Host 使用 API Key 请求 `https://api.xiaomimimo.com/v1/chat/completions`。
114
+ - 音频响应不会持久化到磁盘;Host 直接把音频字节返回浏览器,浏览器使用临时 Blob URL 播放并在切换时释放。
115
+ - Host 路由限制请求体大小、正文长度和请求超时。
116
+
117
+ 请注意:回复正文会发送给 Xiaomi MiMo 服务。请在使用前确认内容符合你的隐私与合规要求。
118
+
119
+ ## 开发
120
+
121
+ ```bash
122
+ pnpm install
123
+ pnpm typecheck
124
+ pnpm test
125
+ pnpm pack:check
126
+ ```
127
+
128
+ 项目结构:
129
+
130
+ ```text
131
+ src/index.ts Host:settings namespace、MiMo 请求、同源音频路由
132
+ src/client/index.tsx Web Client:消息操作按钮、设置卡片、音频播放
133
+ cordis.patch.yml DSH bundle patch
134
+ ```
135
+
136
+ ## 发布到 GitHub / npm 前
137
+
138
+ 1. 确认包名在 npm 可用,或改为你自己的 scope,例如 `@your-name/dsh-xiaomi-tts`。
139
+ 2. 同步修改:
140
+ - `package.json.name`
141
+ - `cordis.patch.yml` 中的 row `name`
142
+ - `tsdown.config.ts` 中的 `PACKAGE_ID`
143
+ 3. 执行 `pnpm test && pnpm pack:check`。
144
+ 4. 提交 `src/`、构建配置、文档;npm 发布包会包含构建后的 `lib/`。
145
+
146
+ ## 许可证
147
+
148
+ MIT
Binary file
Binary file
Binary file
@@ -0,0 +1,15 @@
1
+ # Xiaomi MiMo TTS for DSH Web.
2
+ # The one row activates both the Host half and the package's dsh.client Web half.
3
+ - insert:
4
+ - id: xiaomi-mimo-tts
5
+ name: 'dsh-xiaomi-tts'
6
+ config:
7
+ apiKey: ''
8
+ baseURL: 'https://api.xiaomimimo.com/v1'
9
+ model: 'mimo-v2.5-tts'
10
+ voice: '冰糖'
11
+ format: 'mp3'
12
+ autoPlay: false
13
+ instruction: '请用自然、清晰、语速适中的语气朗读。'
14
+ maxTextLength: 12000
15
+ requestTimeoutMs: 120000
@@ -0,0 +1,39 @@
1
+ import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client';
2
+ export declare const inject: string[];
3
+ declare const zh: {
4
+ readonly 'action.play': "朗读回复";
5
+ readonly 'action.pause': "暂停朗读";
6
+ readonly 'action.resume': "继续朗读";
7
+ readonly 'action.loading': "正在生成语音";
8
+ readonly 'action.retry': "重新生成语音";
9
+ readonly 'error.noText': "这条回复没有可朗读的正文。";
10
+ readonly 'error.request': "语音生成失败。";
11
+ readonly 'error.play': "浏览器阻止了自动播放,请点击朗读按钮。";
12
+ readonly 'settings.title': "Xiaomi MiMo 语音朗读";
13
+ readonly 'settings.description': "在助手回复操作栏中使用 Xiaomi MiMo TTS 生成并播放语音。";
14
+ readonly 'settings.apiKey': "API Key";
15
+ readonly 'settings.apiKeyHint': "密钥保存在 DSH 设置文件中,传到浏览器前会被脱敏。";
16
+ readonly 'settings.apiKeyStatus': "只有输入新值并保存时才会替换现有密钥。";
17
+ readonly 'settings.autoPlay': "自动播报新回复";
18
+ readonly 'settings.autoPlayHint': "浏览器可能因为自动播放策略而拒绝;拒绝后可手动点击朗读。";
19
+ readonly 'settings.voice': "内置音色";
20
+ readonly 'settings.format': "音频格式";
21
+ readonly 'settings.instruction': "朗读风格指令";
22
+ readonly 'settings.save': "保存";
23
+ readonly 'settings.saving': "保存中…";
24
+ readonly 'settings.saved': "已保存";
25
+ readonly 'settings.failed': "保存失败,请重试。";
26
+ readonly 'settings.readOnly': "当前 DSH 设置为只读。";
27
+ readonly 'settings.secretPlaceholder': "输入新的 Xiaomi MiMo API Key";
28
+ readonly 'settings.expand': "展开设置";
29
+ readonly 'settings.collapse': "收起设置";
30
+ };
31
+ type LocaleKey = keyof typeof zh;
32
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
33
+ interface LocaleNamespaceMap {
34
+ 'xiaomi-mimo-tts': LocaleKey;
35
+ }
36
+ }
37
+ export declare function apply(ctx: ClientContext): void;
38
+ export {};
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAuC,MAAM,wCAAwC,CAAA;AAMhH,eAAO,MAAM,MAAM,UAMlB,CAAA;AA+BD,QAAA,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BE,CAAA;AA+BV,KAAK,SAAS,GAAG,MAAM,OAAO,EAAE,CAAA;AAIhC,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,iBAAiB,EAAE,SAAS,CAAA;KAC7B;CACF;AAkXD,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAgD9C"}