MiMo TTS speech synthesis for DeepSeek Harness: a speak button on finalized assistant messages with an inline player (draggable progress bar), a plugin-page configuration card with preview playback, and a voice-history settings page.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:1497105876/dsh-mimotts
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
把助手回复"读出来"的 DSH 插件:"插件"页里的配置卡片 + 每条已定稿助手回复动作行里的音量按钮 + 带可拖动进度条的内联播放器 + 设置页里的"语音历史"。语音默认由小米 MiMo 的 mimo-v2.5-tts-voicedesign 按一段固定音色描述合成,失败时自动降级到 mimo-v2.5-tts 预置音色;API Key 只存在于宿主侧,浏览器只发送文本、收到 WAV。
面向 deepseek-harness 0.2.0-rc.2(engines.dsh: ">=0.2.0-rc.2 <0.3.0"),完全按照官方插件规范实现:
| 官方规范条目 | 本插件的落点 |
|---|---|
| 打包与安装插件(bundle 组合包) | package.json 声明 dsh.bundle.patch + cordis.patch.yml 插入 id: mimotts 行;同包携带 dsh.client 浏览器半侧(裸包名行同时挂载 Host/Client 两侧) |
| 插件配置(无硬编码可调参数) | 可调参数走 Schemastery Config + .volatile()(合成方式/音色描述/预置音色/克隆样本/风格/字数/超时);接口地址与模型专门写死为小米 MiMo;密钥 role('secret') |
| 即时配置表单 | ctx.configForms(mimotts 命名空间)+ SettingsFormModel 标准表单;ctx.settings.configure({ auto: false }) 关闭自动页策略,配置卡片自己注册进官方 plugins.bundle.config(key = npm 包名) |
| Web Client Slots | plugins.bundle.config(插件页配置卡)+ conversation.chat.assistant-actions(消息动作行)+ settings.section(语音历史页)三个席位,ctx.slots.inject 贡献、effect 生命周期托管;跨插件只 import type 取 slot 声明 |
| Web Server 子系统 | ctx.webServer.register 挂 /api/mimotts/status、/api/mimotts/synthesize 两条路由,入口先过 ctx.connection.requestRejection 信任栅栏(Host/Origin + 浏览器鉴权),LAN 裸请求无法白嫖 API 额度 |
| 客户端模块系统 | lib/client.js 为 lazy-CJS factory(window.__ModuleLoader__.load({ id, factory })),外部仅平台模块(react / cordis / client-store / ui-primitives),跨插件只经 Cordis 服务与 import type(构建期 purity gate 强制) |
| extension-cookbook · UI 插件 | 业务数据不进组件 props 面:文本经 useChat 从 Conversation binding 派生,配置经 configForms,合成经宿主路由,文案经 ctx.locale(zh/en 双语) |
功能
- 「插件」页 → @gw/dsh-mimotts 详情页的配置卡片(官方
plugins.bundle.config席位,key = 包名)- API Key(只写输入框:粘贴即经官方
credentials/set通道存入宿主凭据存储,页面不回显;显示"已配置/未配置",清空保存不改动已存密钥) - 只服务小米 MiMo:接口地址固定
https://api.xiaomimimo.com/v1,模型固定mimo-v2.5-tts-voicedesign(降级mimo-v2.5-tts),两者都不再提供配置入口 - 合成方式与兜底顺序:优先级固定为 音色克隆 → 音色设计 → 预置音色,默认选中克隆。手动选哪个就从哪一级开始,失败只往下掉、绝不往上爬;上游报错/超时/无音频才降级,本地错误(没配密钥、空文本)直接停。克隆没选样本时会跳过克隆直接落到设计
- 音色克隆:样本库弹窗里填本地 mp3/wav 路径添加,文件复制进
<数据根>/clone-samples/(原文件不动),选中即用;可命名、删除。样本 ≤7 MB(官方限制 base64 后 ≤10 MB) - 音色描述:多行文本框,默认是一段固定的少女音描述,可改;留空回落到内置默认,旁边「恢复默认」随时可一键还原。音色设计模式下它就是请求里的
user消息 - 音色历史:描述框旁的「历史」按钮打开小窗,列出手动保存过的音色(只在你点「保存当前」时才存,不自动保存);选中即填回描述框,再保存卡片才生效。存的数据在
<profile 数据目录>/mimotts-recordings/voices/,跟语音历史同一根目录、不进 git - 预置音色(官方 9 音色下拉:mimo_default、冰糖、茉莉、苏打、白桦、Mia、Chloe、Milo、Dean)/ 默认风格——只在预置音色模式及降级时生效
- 单次最大字符数、请求超时
- 试听:用卡片当前(含未保存修改)的模式/描述/风格/音色合成一句示例,内联播放
- 标准表单行为:脏值预览、"已覆盖/恢复默认"徽标、保存/放弃、只读部署提示
- API Key(只写输入框:粘贴即经官方
- 每条已定稿助手回复底部的音量按钮(位于该消息动作行,复制/分支之间)
- 点击 → 宿主合成(Markdown 归一化:不朗读代码块/URL/标记符号)→ 自动播放
- 播放器浮层:播放/暂停 + 可拖动进度条(pointer 拖拽、单击定位、键盘 ←→/Home/End) + 时间读数
- 同时只有一条在播;播放中动作行不再悬停淡出
- 失败就地提示(未配置/超时/上游拒绝/无文本等稳定错误码 → 本地化文案)
- 设置 → 语音历史
- 每次朗读自动保存;按文本分组、多版本并列
- 逐版本回放、「重新合成」(用当前配置重读并保留旧版本对比)、「删除」
- Agent 工具
mimo-tts-gw-say(tools服务在的组合里注册)- 参数:
text(必填)、voice、style(可选覆盖) - 行为:合成 → 写
<会话工作区>/tts/speech-<时间戳>-<8位随机>.wav→ 返回绝对路径 + 字节数 + 时长;同一份音频再追加进「语音历史」 - 只产出文件,不发消息:要真的发出去,把返回的 path 交给聊天渠道的发语音工具(QQ 通道是
qq_chat_gw_send_voice) - 为什么写进工作区:渠道侧的发送工具通常只接受工作区内的路径,写到录音目录会被拒
- 工具描述里写清了「用户要求语音回复、或内容适合朗读时才用」,平时的回复还是文字
- 参数:
- 安全边界:密钥只在宿主;
/api/mimotts/*路由先过 Connection 信任栅栏;请求体 1MiB 上限;文本超预算在句末截断朗读开头。工具和网页朗读共用同一套 settings/凭据,不额外存密钥。
目录
dsh-mimotts/
├── package.json # dsh.bundle + dsh.client manifest,engines.dsh 锁 0.2.0
├── cordis.patch.yml # bundle 层:插入 id: mimotts 行(两侧共用)
├── tsconfig.json # tsc → lib/node(Node 半侧 + 类型)
├── tsdown.config.ts # 官方 clientBundle 的树外复刻 → lib/client.js
├── icon.svg locale/{zh,en}.json
├── src/
│ ├── index.ts # Host 插件:Config schema + 两条 Web 路由
│ ├── tts.ts # MiMo TTS 客户端(/chat/completions + audio 输出块)
│ ├── wav.ts normalize.ts# PCM→WAV 封装;Markdown→可朗读文本
│ ├── settings.ts # 两侧共享:命名空间/路由/默认值/线格式类型
│ └── client/
│ ├── index.ts # 浏览器插件:三个 slot 席位注册
│ ├── SpeakAction.tsx # 消息动作行的音量按钮 + 浮层播放器
│ ├── PlayerBar.tsx # 可拖动进度条(role=slider,指针+键盘)
│ ├── BundleConfigCard.tsx + settings-controller.ts # 插件页配置卡片
│ ├── RecordingsPage.tsx + RecordingsList.tsx # 语音历史设置页
│ ├── chat-text.ts # 从 Chat snapshot 取该消息的可朗读文本
│ ├── use-audio-player.ts # 播放引擎(单活播放器)
│ ├── api.ts status.ts slots.ts locales.ts styles.ts SpeakerIcon.tsx
├── tests/ # 46 项单测(node --test)
└── scripts/
├── stub-e2e.mjs # 本地桩服务端到端(无需真实密钥)
└── live-e2e.mjs # 真实 MiMo API 端到端(需 MIMO_API_KEY)
构建与安装
npm install # 装依赖(无 prepare 钩子,需手动构建)
npm test # 46 项单测
node scripts/stub-e2e.mjs
安装进 DSH profile(源码 checkout):
dsh plugin --profile demo add ./dsh-mimotts
# pnpm≥10 首次 git/本地源码安装需要为构建授权:把 dsh-mimotts 写入
# 该 profile 的 pnpm-workspace.yaml → allowBuilds: { dsh-mimotts: true },再重试
dsh --profile demo --dump-config # 应能看到 "# == dsh-mimotts" 层
dsh --profile demo
打开 http://127.0.0.1:3080:「插件」页 → @gw/dsh-mimotts 卡片里填入 API Key(试听可即时验证),随后每条已定稿回复下都会出现音量按钮;设置 → 语音历史 管理已保存的朗读。
不想把密钥写进配置文件时,在 profile 的 cordis.patch.yml 里覆写该行:
- id: mimotts
config:
apiKey: !!js process.env.MIMO_API_KEY
适配版本与「按版本选适配」
分发不会按宿主版本自动下载对应适配版本。 本插件打包时把 @deepseek-ai/dsh-* 依赖锁死在某一个 release(当前 0.2.0-rc.2),别人拉到的就是同一份 package.json;npm 不会"看对方 dsh 版本 → 选不同版本的 dsh-* 依赖"。真正的版本闸门是 dsh 的两处兼容性声明:
dsh.compatibility.dshReleases:官方字段,精确列出本包适配的 release(如{ "0.2.0-rc.2": "compatible" })。安装器/市场在对方 dsh 版本不在白名单时拒绝或警告,而不是自动换一个适配版本。engines.dsh:npm 风格的范围闸门(当前>=0.2.0-rc.2 <0.3.0),语义与上面互补。
运行时实际用的 @deepseek-ai/dsh-* 实例由宿主 dsh 自带(客户端半从平台模块表取 cordis/store/slots/primitives,Host 半由 Node 按宿主 node_modules 解析),插件代码只是复用宿主环境里的版本——只要代码用的 API 在该 dsh 版本里存在即可。想让 0.1.7 的 dsh 也能用,得单独发一份 pin 回 0.1.7-rc.2 的包(下方脚本一键生成),即"多版本并行发布",用户按自己的 dsh 版本装对应那份。
本插件跟随 deepseek-harness 的 release,但 dsh 的包版本规则有两点容易踩坑:
@deepseek-ai/dsh-*整条线共用同一个 release 版本号(0.2.0-rc.2 的所有 dsh-* 包都标 0.2.0-rc.2)。@deepseek-ai/cordis与@deepseek-ai/schemastery是独立版本号,不跟随 release(0.2.0-rc.2 时代仍是 cordis~4.0.4、schemastery~3.18.4),无脑把全部依赖改成同一个 release 会 404。0.2.0-rc.2起dsh-scope成为 peer 依赖:dsh-session/dsh-api-remotes把@deepseek-ai/dsh-scope列为 peer,需与 cordis 一样同时写在peerDependencies与devDependencies里,否则npm install报 ERESOLVE。
要把插件重新对准另一个 dsh release,不要手改版本号,用脚本:
node scripts/pin-dsh-version.mjs <release> # 改 package.json(dsh-* + engines.dsh)并打印后续步骤
node scripts/pin-dsh-version.mjs <release> --install # 改完顺手跑 npm install
node scripts/pin-dsh-version.mjs <release> --self # 顺便把插件自身 version 也改成 release
node scripts/pin-dsh-version.mjs <release> --dry-run # 只预览不写文件
脚本会自动:把 @deepseek-ai/dsh-*(含 dsh-scope)在 peer / dev 两处改到目标 release;把 engines.dsh 推进到 >=<release> <次版本+1>.0;把 dsh.compatibility.dshReleases 同步写成 { "<release>": "compatible" };并去 npm 查该 release 配套的 cordis / schemastery 区间(也可用 --cordis=... / --schemastery=... 手动指定,跳过网络)。改完 package.json 后跑 npm install 让 node_modules / package-lock.json 跟上,再 npm run build && npm test。
MiMo TTS 线格式
统一 POST {baseUrl}/chat/completions,头 api-key: <key>;响应 choices[0].message.audio.data 是 base64 音频(RIFF 或裸 PCM,裸 PCM 由插件包成 24kHz/16bit/mono WAV)。
音色设计(默认)——音色描述在 user,要念的正文在 assistant,audio 里不带 voice:
{
"model": "mimo-v2.5-tts-voicedesign",
"audio": { "format": "wav" },
"messages": [
{ "role": "user", "content": "高中女生,干净清甜真人少女声……" },
{ "role": "assistant", "content": "要说的话" }
]
}
预置音色(手动选择或设计失败时自动降级):
{
"model": "mimo-v2.5-tts",
"audio": { "format": "wav", "voice": "mimo_default" },
"messages": [{ "role": "assistant", "content": "<style>开心</style>要说的话" }]
}
音色克隆:
{
"model": "mimo-v2.5-tts-voiceclone",
"audio": { "format": "wav", "voice": "data:audio/mpeg;base64,<样本 base64>" },
"messages": [
{ "role": "user", "content": "可选风格指令" },
{ "role": "assistant", "content": "要说的话" }
]
}
注意官方现行协议是 audio.voice 传 data: URI,旧的 voice_audio 字段已弃用(本插件这次一并修正)。降级只在上游报错/超时/无音频时触发一次。
关于 Studio 的音色库:官网 Studio 的 /open-apis/tts/v2/generate 支持把设计好的音色注册成 voiceId 当预置音色用,但那是带登录态的私有接口,公开 API 的 audio.voice 只收 9 个预置 ID。本插件走公开 API,所以采用"每次带同一段描述"的方式复现该音色;同一描述不保证跨次音色完全一致。
已知边界
- 按消息朗读:动作行属于该条已定稿回复,朗读其正文(不读思考块与工具调用);代码块以"代码略"代替。
- 文本超过"单次最大字符数"时朗读开头并在句末截断(动作行旁有提示)。
- Desktop(Electron)走 IPC 桥接 fetch,路由路径不变。
- 语音输入(麦克风)是官方
voice-input组合包的职责,与本插件互补不冲突。
验证记录
tsc全量类型检查通过(对着 0.2.0-rc.2 的真实 .d.ts)node --test:19/19 通过(请求形状/PCM 封装/Markdown 归一化/文本提取/错误码映射)scripts/stub-e2e.mjs:真实 HTTP 桩端到端通过(96,044 字节 WAV)- MiMo 实机协议探测通过(与官方
mimo-tts-wavskill 同一契约,115,244 字节 WAV);scripts/live-e2e.mjs可对真实 API 跑完整引擎链路
Links
More in this category
Yuuyuko-uu/dsh-tts-bridge★ 270
Reads DSH conversations aloud using the DeepSeek web page's built-in read-aloud, driven by a small browser extension.
Fishsb/dsh-voice-prompt-enhancer★ 136
Rewrites a composer draft into a clearer, structured prompt (5 modes, model fallback chain, optional multi-round memory) and adds stop-on-silence, hotkey and filler-word cleanup to DSH voice input; transcription stays with the official speechToText, the plugin ships no engine.
cloudoyx/any-audio★ 75
DSH has its own audio workstation too: real recordings, multiple TTS engines, genuine sound effects and local singing synthesis, with every generated sound landing as its own clip on one visible timeline that you can audition, balance and fine-tune track by track. Use it for scoring animation, producing audiobooks and radio drama, composing and mixing on your own, making ASMR, and whatever else you come up with.
PolinniZhong/dsh-omi-voice★ 75
In-chat read-aloud for DeepSeek Harness: tap to read, pause and resume AI replies with natural Doubao TTS voices (BYOK), reading only the final answer with code, tables and diagrams filtered; local engine, plugin keeps no API key.
ppy-web/dsh-plugin-xiaomi-mimo-tts★ 73
Voice Studio for DSH with 10+ cloud and local speech engines (Xiaomi MiMo, Doubao, Breeze, DeepSeek, local MOSS-Nano, browser speech, external adapters) plus cloud ASR, smart text filtering, live subtitles and voice orbs, /director multi-role WAV drama studio, and desktop pet, novel, QQ Bot, dsh-Go, and AI Passport integrations. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
1624318455/dsh-plugin-tts★ 66
Reads assistant replies aloud via free Edge TTS or your own RVC voice models: read-aloud buttons + auto-read, adaptive chunked progressive playback (gapless long reads), one-click voice-pack installs from a registry, and a portable RVC runtime.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.