dsh-mimo-speak 0.0.0-stage → 0.1.2
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/README.md +197 -2
- package/README.zh.md +166 -0
- package/cordis.patch.yml +20 -0
- package/icon.svg +6 -0
- package/lib/client.js +3607 -0
- package/lib/client.js.map +1 -0
- package/lib/node/brief.d.ts +23 -0
- package/lib/node/brief.js +110 -0
- package/lib/node/brief.js.map +1 -0
- package/lib/node/client/BundleConfigCard.d.ts +15 -0
- package/lib/node/client/BundleConfigCard.js +22 -0
- package/lib/node/client/BundleConfigCard.js.map +1 -0
- package/lib/node/client/PlayerBar.d.ts +45 -0
- package/lib/node/client/PlayerBar.js +83 -0
- package/lib/node/client/PlayerBar.js.map +1 -0
- package/lib/node/client/SettingsSectionCard.d.ts +14 -0
- package/lib/node/client/SettingsSectionCard.js +19 -0
- package/lib/node/client/SettingsSectionCard.js.map +1 -0
- package/lib/node/client/SpeakAction.d.ts +32 -0
- package/lib/node/client/SpeakAction.js +651 -0
- package/lib/node/client/SpeakAction.js.map +1 -0
- package/lib/node/client/SpeakerIcon.d.ts +11 -0
- package/lib/node/client/SpeakerIcon.js +5 -0
- package/lib/node/client/SpeakerIcon.js.map +1 -0
- package/lib/node/client/TtsSettingsForm.d.ts +27 -0
- package/lib/node/client/TtsSettingsForm.js +164 -0
- package/lib/node/client/TtsSettingsForm.js.map +1 -0
- package/lib/node/client/api.d.ts +89 -0
- package/lib/node/client/api.js +247 -0
- package/lib/node/client/api.js.map +1 -0
- package/lib/node/client/audio-bus.d.ts +29 -0
- package/lib/node/client/audio-bus.js +91 -0
- package/lib/node/client/audio-bus.js.map +1 -0
- package/lib/node/client/chat-text.d.ts +32 -0
- package/lib/node/client/chat-text.js +90 -0
- package/lib/node/client/chat-text.js.map +1 -0
- package/lib/node/client/highlight.d.ts +45 -0
- package/lib/node/client/highlight.js +198 -0
- package/lib/node/client/highlight.js.map +1 -0
- package/lib/node/client/index.d.ts +26 -0
- package/lib/node/client/index.js +89 -0
- package/lib/node/client/index.js.map +1 -0
- package/lib/node/client/locales.d.ts +19 -0
- package/lib/node/client/locales.js +180 -0
- package/lib/node/client/locales.js.map +1 -0
- package/lib/node/client/panel-visibility.d.ts +24 -0
- package/lib/node/client/panel-visibility.js +16 -0
- package/lib/node/client/panel-visibility.js.map +1 -0
- package/lib/node/client/settings-controller.d.ts +116 -0
- package/lib/node/client/settings-controller.js +201 -0
- package/lib/node/client/settings-controller.js.map +1 -0
- package/lib/node/client/settings-registration.d.ts +24 -0
- package/lib/node/client/settings-registration.js +21 -0
- package/lib/node/client/settings-registration.js.map +1 -0
- package/lib/node/client/slots.d.ts +48 -0
- package/lib/node/client/slots.js +15 -0
- package/lib/node/client/slots.js.map +1 -0
- package/lib/node/client/speech-cache.d.ts +59 -0
- package/lib/node/client/speech-cache.js +68 -0
- package/lib/node/client/speech-cache.js.map +1 -0
- package/lib/node/client/split-speech.d.ts +20 -0
- package/lib/node/client/split-speech.js +100 -0
- package/lib/node/client/split-speech.js.map +1 -0
- package/lib/node/client/status.d.ts +28 -0
- package/lib/node/client/status.js +60 -0
- package/lib/node/client/status.js.map +1 -0
- package/lib/node/client/stream-dispose.d.ts +119 -0
- package/lib/node/client/stream-dispose.js +249 -0
- package/lib/node/client/stream-dispose.js.map +1 -0
- package/lib/node/client/styles.d.ts +19 -0
- package/lib/node/client/styles.js +176 -0
- package/lib/node/client/styles.js.map +1 -0
- package/lib/node/client/use-audio-player.d.ts +44 -0
- package/lib/node/client/use-audio-player.js +102 -0
- package/lib/node/client/use-audio-player.js.map +1 -0
- package/lib/node/client/use-audio-queue.d.ts +44 -0
- package/lib/node/client/use-audio-queue.js +151 -0
- package/lib/node/client/use-audio-queue.js.map +1 -0
- package/lib/node/client/use-stream-player.d.ts +41 -0
- package/lib/node/client/use-stream-player.js +60 -0
- package/lib/node/client/use-stream-player.js.map +1 -0
- package/lib/node/edge-tts.d.ts +21 -0
- package/lib/node/edge-tts.js +111 -0
- package/lib/node/edge-tts.js.map +1 -0
- package/lib/node/index.d.ts +97 -0
- package/lib/node/index.js +463 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/normalize.d.ts +30 -0
- package/lib/node/normalize.js +72 -0
- package/lib/node/normalize.js.map +1 -0
- package/lib/node/settings.d.ts +186 -0
- package/lib/node/settings.js +74 -0
- package/lib/node/settings.js.map +1 -0
- package/lib/node/summarize.d.ts +29 -0
- package/lib/node/summarize.js +131 -0
- package/lib/node/summarize.js.map +1 -0
- package/lib/node/tool.d.ts +54 -0
- package/lib/node/tool.js +123 -0
- package/lib/node/tool.js.map +1 -0
- package/lib/node/tts.d.ts +127 -0
- package/lib/node/tts.js +361 -0
- package/lib/node/tts.js.map +1 -0
- package/lib/node/wav.d.ts +32 -0
- package/lib/node/wav.js +63 -0
- package/lib/node/wav.js.map +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +122 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 F-YXL <170423531+F-YXL@users.noreply.github.com>
|
|
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.md
CHANGED
|
@@ -1,3 +1,198 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-mimo-speak
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
[](https://github.com/F-YXL/dsh-mimo-speak/actions/workflows/ci.yml)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
8
|
+
[](https://nodejs.org)
|
|
9
|
+
|
|
10
|
+
Reads assistant replies out loud in [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), using Xiaomi MiMo TTS.
|
|
11
|
+
|
|
12
|
+
It adds a speaker button to every finalized reply and a settings card on the Plugins page and in Settings. Click the button and the reply plays through an inline player. The MiMo API key never leaves the host: the browser sends text, the host sends back WAV.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
**From npm (recommended — enables in-app update prompts):**
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
dsh plugin --profile desktop add dsh-mimo-speak
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use the `web` profile for the web app (`dsh plugin --profile web add dsh-mimo-speak`), then refresh the page. Installing from the npm registry is what lets DSH mark the bundle updatable: its refresh then offers new versions in place. No build permission to grant — the package ships a prebuilt `lib/` and has no install scripts.
|
|
23
|
+
|
|
24
|
+
**Pinned release:**
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
dsh plugin --profile desktop add dsh-mimo-speak@0.1.2
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**From GitHub (development / pre-release):**
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
dsh plugin --profile desktop add github:F-YXL/dsh-mimo-speak
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
> Installs from `github:`, a git tag, a path, or a tarball are recorded with that spec and are **not** updatable inside DSH — they never show an "update available" prompt. To update one, remove and re-add it (settings under the `mimo-speak` namespace survive). Prefer the npm install above for automatic update prompts.
|
|
37
|
+
|
|
38
|
+
The plugin also shows up in the in-app plugin market (Plugins → Discover), because the repo carries the `dsh-plugin` topic.
|
|
39
|
+
|
|
40
|
+
After installing, open Plugins → dsh-mimo-speak (or Settings → MiMo read-aloud), paste the MiMo API key and press Audition. You should hear the sample voice. A speaker button appears under each finalized reply from then on.
|
|
41
|
+
|
|
42
|
+
### Updating
|
|
43
|
+
|
|
44
|
+
- **npm install**: DSH's Plugins page marks the bundle updatable. Refresh shows **Update available** and the bundle page offers the new version in one click.
|
|
45
|
+
- **git/path/tarball install**: no in-app prompt by design. Re-add the same spec to update, or switch to the npm channel once to get prompts from then on.
|
|
46
|
+
|
|
47
|
+
## What it does
|
|
48
|
+
|
|
49
|
+
The settings card holds the API key (write-only, stored in the host credential store), endpoint, model, one of nine preset voices or a voice-clone sample, default style, character budget and timeout. Audition speaks a sample using the card's current, unsaved edits. The same settings appear both on the Plugins-page card and in DSH's Settings panel; each keeps its own draft and saves through the same host credential store.
|
|
50
|
+
|
|
51
|
+
Each finalized reply gets a speaker button. Before reading, the plugin strips code blocks, URLs and formatting marks, then plays what is left. The progress bar is off by default; turn it on for a draggable, keyboard-seekable track (←/→, Home/End). Stop means stop: in-flight requests are aborted, queued audio is dropped, and `Esc` does the same.
|
|
52
|
+
|
|
53
|
+
Read scopes: `brief` (the conversation model summarizes the reply into a sentence or two first), `text` (prose only), `smart` (prose plus short code), `all`.
|
|
54
|
+
|
|
55
|
+
There is also an agent tool, `mimo-tts-say`. It synthesizes speech into `<session workspace>/tts/speech-<timestamp>-<random>.wav` and returns the path. It writes a file; sending it as a voice message is up to the chat channel.
|
|
56
|
+
|
|
57
|
+
If MiMo fails and the `edge-tts` CLI is installed, the plugin can retry with a Microsoft Edge neural voice.
|
|
58
|
+
|
|
59
|
+
## Requirements
|
|
60
|
+
|
|
61
|
+
- DeepSeek Harness `0.2.2-rc.1` (the package declares `engines.dsh: ">=0.2.2-rc.1 <0.3.0"`)
|
|
62
|
+
- Node.js `>= 22.19`
|
|
63
|
+
- A MiMo API key from https://api.xiaomimimo.com, needed at runtime only
|
|
64
|
+
|
|
65
|
+
## Install from source or tarball
|
|
66
|
+
|
|
67
|
+
From a checkout. `lib/` is committed prebuilt, so build is only needed after you edit `src/`:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
git clone https://github.com/F-YXL/dsh-mimo-speak.git
|
|
71
|
+
cd dsh-mimo-speak
|
|
72
|
+
dsh plugin --profile <profile> add ./dsh-mimo-speak
|
|
73
|
+
dsh --profile <profile> --dump-config | grep mimo-speak # expect a "# == dsh-mimo-speak" layer
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
From a packed tarball:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
npm pack
|
|
80
|
+
dsh plugin --profile <profile> add ./dsh-mimo-speak-0.1.2.tgz
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Both source and tarball installs are `updatable: false` inside DSH (no update prompt). Use the npm install for update prompts.
|
|
84
|
+
|
|
85
|
+
## Configure
|
|
86
|
+
|
|
87
|
+
| Field | Default | Notes |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `apiKeyEnv` | `MIMO_API_KEY` | credential **reference**, not the key itself |
|
|
90
|
+
| `baseUrl` | `https://api.xiaomimimo.com/v1` | `/chat/completions` is appended |
|
|
91
|
+
| `model` | `mimo-v2.5-tts` | switches to `mimo-v2.5-tts-voiceclone` automatically when a clone sample is set |
|
|
92
|
+
| `voice` | `mimo_default` | preset: `mimo_default`, 冰糖, 茉莉, 苏打, 白桦, Mia, Chloe, Milo, Dean |
|
|
93
|
+
| `voiceSamplePath` | — | host-local WAV, 24 kHz / 16-bit / mono, 5–15 s |
|
|
94
|
+
| `style` | — | e.g. `开心`, `语速慢`, `东北话`; empty lets the model decide |
|
|
95
|
+
| `maxChars` | `2000` | longer text is clamped at a sentence boundary |
|
|
96
|
+
| `chunkChars` | `120` | size of one playback chunk |
|
|
97
|
+
| `timeoutMs` | `60000` | |
|
|
98
|
+
| `autoRead` | `false` | read each newly finalized reply automatically |
|
|
99
|
+
| `readScope` | `smart` | `brief` / `text` / `smart` / `all` |
|
|
100
|
+
| `fallbackEngine` | `none` | `none` or `edge` |
|
|
101
|
+
| `edgeVoice` | `zh-CN-XiaoxiaoNeural` (Xiaoxiao) | any `edge-tts` voice id |
|
|
102
|
+
|
|
103
|
+
To keep the key out of the profile config, override the row in your profile's `cordis.patch.yml`:
|
|
104
|
+
|
|
105
|
+
```yaml
|
|
106
|
+
- id: mimo-speak
|
|
107
|
+
config:
|
|
108
|
+
apiKey: !!js process.env.MIMO_API_KEY
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Security
|
|
112
|
+
|
|
113
|
+
The API key is written through the host credential store (`credentials/set`) and never ends up in a repo file, a log line or the browser. Every `/api/mimo-speak/*` route passes `ctx.connection.requestRejection` first, so a request from outside the app's trusted origin is refused before any key is used. Request bodies are capped at 1 MiB; overlong text is cut at a sentence boundary.
|
|
114
|
+
|
|
115
|
+
`npm run check:privacy` scans every tracked file for credentials, home paths and email addresses, plus names or hostnames you list in the git-ignored `.privacy-markers`. `npm run check:privacy:history` also walks every blob and commit identity in the history, because `git log -p` publishes the past too. CI runs the file scan on every push.
|
|
116
|
+
|
|
117
|
+
If you find a vulnerability, use [SECURITY.md](./SECURITY.md), not a public issue.
|
|
118
|
+
|
|
119
|
+
## Development
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
npm install
|
|
123
|
+
npm run build # tsc -> lib/node, tsdown -> lib/client.js
|
|
124
|
+
npm test # 90 unit tests (node --test)
|
|
125
|
+
node scripts/stub-e2e.mjs # full HTTP round-trip against a local stub, no key needed
|
|
126
|
+
MIMO_API_KEY=... node scripts/live-e2e.mjs # one real request against the MiMo platform
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`lib/` is committed on purpose, so `dsh plugin add` needs no build step. After editing `src/`, run `npm run build` and commit `lib/` in the same commit; CI fails when the committed build output is stale.
|
|
130
|
+
|
|
131
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for commit conventions and the version-pinning workflow, [MAINTAINING.md](./MAINTAINING.md) for release steps (npm publish + GitHub Release).
|
|
132
|
+
|
|
133
|
+
## Pinning to a dsh release
|
|
134
|
+
|
|
135
|
+
The package pins one set of `@deepseek-ai/dsh-*` dependencies; npm will not pick a matching build for the host. Two declarations do the gating:
|
|
136
|
+
|
|
137
|
+
- `dsh.compatibility.dshReleases` lists the releases this build supports (`{ "0.2.2-rc.1": "compatible" }`). The installer refuses or warns when the host version is not on the list.
|
|
138
|
+
- `engines.dsh` is an npm-style range (`>=0.2.2-rc.1 <0.3.0`).
|
|
139
|
+
|
|
140
|
+
Two things to watch:
|
|
141
|
+
|
|
142
|
+
1. All `@deepseek-ai/dsh-*` packages share one release version (`0.2.2-rc.1`), but `@deepseek-ai/cordis` and `@deepseek-ai/schemastery` have their own (`~4.1.0` / `~3.19.0` here). Bumping everything together 404s.
|
|
143
|
+
2. Since `0.2.0`, `dsh-scope` is a peer of `dsh-session` / `dsh-api-remotes` and must be in both `peerDependencies` and `devDependencies`, or `npm install` fails with `ERESOLVE`.
|
|
144
|
+
|
|
145
|
+
Use the script instead of editing version numbers by hand:
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
node scripts/pin-dsh-version.mjs <release> # rewrite package.json, print next steps
|
|
149
|
+
node scripts/pin-dsh-version.mjs <release> --install # ... and run npm install
|
|
150
|
+
node scripts/pin-dsh-version.mjs <release> --self # ... and bump this plugin's version too
|
|
151
|
+
node scripts/pin-dsh-version.mjs <release> --dry-run # preview only
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## How it maps to the plugin spec
|
|
155
|
+
|
|
156
|
+
| Spec | Where it lands here |
|
|
157
|
+
|---|---|
|
|
158
|
+
| [Packaging & installing plugins](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.1/docs/user/develop/basic/publish.zh.md) (bundle) | `package.json` declares `dsh.bundle.patch` + `cordis.patch.yml` inserts the `id: mimo-speak` row; the same package carries the `dsh.client` browser half |
|
|
159
|
+
| [Plugin configuration](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.1/docs/user/develop/basic/config.zh.md) (no hardcoded knobs) | every parameter is a Schemastery Config field with `.volatile()`; the key is `role('credential-ref')` |
|
|
160
|
+
| [Instant config forms](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.1/docs/cookbook/adding-a-settings-card.zh.md) | `ctx.configForms` (`mimo-speak` namespace) + the standard `SettingsFormModel` form |
|
|
161
|
+
| [Web client slots](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.1/docs/subsystems/slots.zh.md) | three seats: `plugins.bundle.config`, `settings.section` and `conversation.chat.assistant-actions` |
|
|
162
|
+
| [Web server](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.1/docs/subsystems/web-server.zh.md) | five routes under `/api/mimo-speak/*`, each behind `ctx.connection.requestRejection` (Host/Origin + browser auth), so a bare LAN request cannot spend your API quota |
|
|
163
|
+
| [Client module system](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.2-rc.1/packages/client/modules/README.zh.md) | `lib/client.js` is a lazy-CJS factory (`window.__ModuleLoader__.load`); the build-time purity gate keeps cross-plugin imports type-only |
|
|
164
|
+
|
|
165
|
+
## MiMo wire format
|
|
166
|
+
|
|
167
|
+
`POST {baseUrl}/chat/completions`, header `api-key: <key>`, body:
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"model": "mimo-v2.5-tts",
|
|
172
|
+
"audio": { "format": "wav", "voice": "mimo_default" },
|
|
173
|
+
"messages": [{ "role": "assistant", "content": "<style>开心</style>要说的话" }]
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Voice cloning switches to `mimo-v2.5-tts-voiceclone` and puts the reference audio in `audio.voice` as a data URI:
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"model": "mimo-v2.5-tts-voiceclone",
|
|
182
|
+
"audio": { "format": "wav", "voice": "data:audio/wav;base64,<base64 wav>" },
|
|
183
|
+
"messages": [{ "role": "assistant", "content": "要说的话" }]
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The response carries base64 audio in `choices[0].message.audio.data` — either a RIFF container (passed through) or raw PCM (wrapped into a 24 kHz / 16-bit / mono WAV by the plugin).
|
|
188
|
+
|
|
189
|
+
## Known limits
|
|
190
|
+
|
|
191
|
+
- Reading is **per message**: the action row belongs to one finalized reply, so reasoning blocks and tool calls are not read. Code blocks become "代码略".
|
|
192
|
+
- Text longer than `maxChars` is read from the start and cut at a sentence boundary, with a hint next to the action row.
|
|
193
|
+
- Desktop (Electron) goes through the IPC fetch bridge; the route paths are unchanged.
|
|
194
|
+
- Voice **input** is the official `@deepseek-ai/dsh-experimental-voice-input-bundle`, not this plugin. This one stops speaking as soon as the microphone opens, so the two do not feed back into each other.
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
[MIT](./LICENSE) © F-YXL. Commercial use is permitted — that is what MIT means.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# dsh-mimo-speak
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
把助手回复「读出来」的 DSH 插件:**「插件」页与「设置」页里的配置卡片** + **每条已定稿助手回复动作行里的音量按钮** + **带可拖动进度条的内联播放器**。语音由小米 MiMo TTS(`mimo-v2.5-tts`)合成,API Key 只存在于宿主侧,浏览器只发送文本、收到 WAV。
|
|
6
|
+
|
|
7
|
+
面向 **deepseek-harness `0.2.2-rc.1`**(`engines.dsh: ">=0.2.2-rc.1 <0.3.0"`)。
|
|
8
|
+
|
|
9
|
+
## 功能
|
|
10
|
+
|
|
11
|
+
1. **「插件」页 → dsh-mimo-speak 详情页的配置卡片**
|
|
12
|
+
- API Key(只写输入框:粘贴即经官方 `credentials/set` 通道存入宿主凭据存储,页面不回显;显示「已配置/未配置」,清空保存不改动已存密钥)
|
|
13
|
+
- 接口地址(默认 `https://api.xiaomimimo.com/v1`)、模型(默认 `mimo-v2.5-tts`)
|
|
14
|
+
- 预置音色(官方 9 音色下拉:mimo_default、冰糖、茉莉、苏打、白桦、Mia、Chloe、Milo、Dean)/ 音色克隆样本(宿主本地 WAV 路径,24 kHz / 16 bit / 单声道,5–15 s)
|
|
15
|
+
- 默认风格(如「开心」「语速慢」「东北话」;留空由模型自行判断,推荐)、单次最大字符数、请求超时
|
|
16
|
+
- **试听**:用卡片当前(含未保存修改)的风格/音色合成一句示例,内联播放
|
|
17
|
+
- 标准表单行为:脏值预览、「已覆盖/恢复默认」徽标、保存/放弃、只读部署提示
|
|
18
|
+
- 同一套设置也出现在 **DSH「设置 → MiMo 朗读」** 页面;两处共用同一表单行为、各自独立保存草稿,互不覆盖
|
|
19
|
+
2. **每条已定稿助手回复底部的音量按钮**
|
|
20
|
+
- 点击 → 宿主合成(Markdown 归一化:不朗读代码块/URL/标记符号)→ 自动播放
|
|
21
|
+
- **进度条可关(默认关)**:关掉只留播放/停止按钮;打开才有可拖动进度条(指针拖拽、单击定位、键盘 ←→/Home/End)
|
|
22
|
+
- **停止是真取消**:中断在途请求、作废本轮、清空已排程音频;`Esc` 同样生效
|
|
23
|
+
- 同时只有一条在播;播放中动作行不再悬停淡出
|
|
24
|
+
- 失败就地提示(未配置/超时/上游拒绝/无文本等稳定错误码 → 本地化文案)
|
|
25
|
+
3. **朗读范围四档**:简要播报(先摘要再念:用当前对话模型把回复浓缩成 1–2 句口播摘要,约 80 字;模型不可用时退回规则摘要)/ 只读正文 / 智能(正文+短代码)/ 全部
|
|
26
|
+
4. **Agent 工具 `mimo-tts-say`**
|
|
27
|
+
- 参数:`text`(必填)、`voice`、`style`(可选覆盖)
|
|
28
|
+
- 行为:合成 → 写 `<会话工作区>/tts/speech-<时间戳>-<8位随机>.wav` → 返回绝对路径 + 字节数 + 时长
|
|
29
|
+
- **只产出文件,不发消息**:要真的发出去,把返回的 path 交给当前聊天渠道自己的发语音工具
|
|
30
|
+
- 为什么写进工作区:渠道侧的发送工具通常只接受工作区内的路径
|
|
31
|
+
5. **安全边界**:密钥只在宿主;`/api/mimo-speak/*` 路由先过 Connection 信任栅栏;请求体 1 MiB 上限;文本超预算在句末截断朗读开头。工具和网页朗读共用同一套 settings/凭据,不额外存密钥。
|
|
32
|
+
|
|
33
|
+
## 安装
|
|
34
|
+
|
|
35
|
+
**从 npm 安装(推荐 —— 开启应用内更新提醒):**
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
dsh plugin --profile desktop add dsh-mimo-speak
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Web 端改用 `web` profile(`dsh plugin --profile web add dsh-mimo-speak`),然后刷新页面。从 npm registry 安装是让 DSH 把该 bundle 标记为「可更新」的前提:此后刷新会在原位提示新版本。无需构建授权 —— 本包自带预构建的 `lib/` 且没有 install 脚本。
|
|
42
|
+
|
|
43
|
+
**钉住某个版本:**
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
dsh plugin --profile desktop add dsh-mimo-speak@0.1.2
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**从 GitHub 安装(开发 / 预发布):**
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
dsh plugin --profile desktop add github:F-YXL/dsh-mimo-speak
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> 从 `github:`、git tag、本地路径或 tarball 安装会以该 spec 记录,并且在 DSH 内**不可更新** —— 永远不会出现「可更新」提醒。要更新就移除后重装(`mimo-speak` 命名空间下的设置会保留)。想要自动更新提醒,请用上面的 npm 安装。
|
|
56
|
+
|
|
57
|
+
仓库公开后,它也会出现在应用内的「插件市场 / Discover」里(仓库带了 `dsh-plugin` topic,市场会自动收录)。
|
|
58
|
+
|
|
59
|
+
安装后,打开「插件 → dsh-mimo-speak」(或「设置 → MiMo 朗读」),粘贴 MiMo API Key 并点「试听」,应能听到示例音。此后每条已定稿回复下会出现音量按钮。
|
|
60
|
+
|
|
61
|
+
### 更新
|
|
62
|
+
|
|
63
|
+
- **npm 安装**:DSH「插件」页把该 bundle 标记为可更新。刷新后显示「可更新」,详情页一键升级到新版本。
|
|
64
|
+
- **git / 路径 / tarball 安装**:设计上无应用内提醒。重新添加同一 spec 即更新;或切到 npm 通道一次,此后即有提醒。
|
|
65
|
+
|
|
66
|
+
不想把密钥写进配置文件时,在 profile 的 `cordis.patch.yml` 里覆写该行:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
- id: mimo-speak
|
|
70
|
+
config:
|
|
71
|
+
apiKey: !!js process.env.MIMO_API_KEY
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 从源码或 tarball 构建
|
|
75
|
+
|
|
76
|
+
从源码构建请见英文「Install from source or tarball」一节;本包自带预构建的 `lib/` 且没有 install 脚本,无需 pnpm 构建授权。
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
git clone https://github.com/F-YXL/dsh-mimo-speak.git
|
|
80
|
+
cd dsh-mimo-speak
|
|
81
|
+
dsh plugin --profile <profile> add ./dsh-mimo-speak
|
|
82
|
+
dsh --profile <profile> --dump-config | grep mimo-speak # 应看到 "# == dsh-mimo-speak" 层
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
源码与 tarball 安装在 DSH 内同样是 `updatable: false`(无更新提醒)。要更新提醒请用 npm 安装。
|
|
86
|
+
|
|
87
|
+
## 与官方语音输入插件配合
|
|
88
|
+
|
|
89
|
+
语音指令的识别交给官方组合包,本插件只负责播报,两者互补:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# 版本要与宿主对齐:DSH 0.2.2-rc.1 → 钉到同版本
|
|
93
|
+
dsh plugin --profile <profile> add @deepseek-ai/dsh-experimental-voice-input-bundle@0.2.2-rc.1
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
它是本地 SenseVoice 转写(首次使用下载运行时),识别结果插入输入框草稿,不会自动发送。本插件检测到麦克风被打开时会立即停止朗读,所以「说完 → 发送 → 自动朗读回复」这条链路不会把播报录进去。
|
|
97
|
+
|
|
98
|
+
## 目录
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
dsh-mimo-speak/
|
|
102
|
+
├── package.json # dsh.bundle + dsh.client manifest,engines.dsh 锁 >=0.2.2-rc.1 <0.3.0
|
|
103
|
+
├── cordis.patch.yml # bundle 层:插入 id: mimo-speak 行(两侧共用)
|
|
104
|
+
├── tsconfig.json # tsc → lib/node(Node 半侧 + 类型)
|
|
105
|
+
├── tsdown.config.ts # 官方 clientBundle 的树外复刻 → lib/client.js
|
|
106
|
+
├── icon.svg locale/{zh,en}.json
|
|
107
|
+
├── src/
|
|
108
|
+
│ ├── index.ts # Host 插件:Config schema + Web 路由
|
|
109
|
+
│ ├── tts.ts # MiMo TTS 客户端(/chat/completions + audio 输出块)
|
|
110
|
+
│ ├── wav.ts normalize.ts# PCM→WAV 封装;Markdown→可朗读文本
|
|
111
|
+
│ ├── settings.ts # 两侧共享:命名空间/路由/默认值/线格式类型
|
|
112
|
+
│ └── client/ # 浏览器半侧:三个 slot 席位、播放器、配置卡片
|
|
113
|
+
├── tests/ # 90 项单测(node --test)
|
|
114
|
+
└── scripts/
|
|
115
|
+
├── stub-e2e.mjs # 本地桩服务端到端(无需真实密钥)
|
|
116
|
+
├── live-e2e.mjs # 真实 MiMo API 端到端(需 MIMO_API_KEY)
|
|
117
|
+
└── check-privacy.mjs # 推送前的隐私扫描
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## 构建与测试
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
npm install
|
|
124
|
+
npm test # 90 项单测
|
|
125
|
+
npm run build # tsc + tsdown → lib/
|
|
126
|
+
node scripts/stub-e2e.mjs # 真实 HTTP 桩端到端(96,044 字节 WAV)
|
|
127
|
+
npm run check:privacy # 隐私扫描,必须 0 命中
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 适配版本与「按版本选适配」
|
|
131
|
+
|
|
132
|
+
**分发不会按宿主版本自动下载对应适配版本。** 本插件打包时把 `@deepseek-ai/dsh-*` 依赖锁死在某一个 release(当前 0.2.2-rc.1),别人拉到的就是同一份 `package.json`。真正的版本闸门是两处兼容性声明:
|
|
133
|
+
|
|
134
|
+
- `dsh.compatibility.dshReleases`:官方字段,精确列出本包适配的 release。安装器/市场在对方 dsh 版本不在白名单时**拒绝或警告**。
|
|
135
|
+
- `engines.dsh`:npm 风格的范围闸门(当前 `>=0.2.2-rc.1 <0.3.0`)。
|
|
136
|
+
|
|
137
|
+
运行时实际用的 `@deepseek-ai/dsh-*` 实例由**宿主 dsh 自带**,插件代码只是复用宿主环境里的版本。想让旧版 dsh 也能用,得单独发一份 pin 回旧版本的包(`scripts/pin-dsh-version.mjs` 一键生成),即「多版本并行发布」。
|
|
138
|
+
|
|
139
|
+
三个容易踩的坑:
|
|
140
|
+
|
|
141
|
+
1. `@deepseek-ai/dsh-*` 整条线共用同一个 release 版本号。
|
|
142
|
+
2. `@deepseek-ai/cordis` 与 `@deepseek-ai/schemastery` 是独立版本号,不跟随 release。
|
|
143
|
+
3. `0.2.0` 起 `dsh-scope` 成为 peer 依赖,需同时写在 `peerDependencies` 与 `devDependencies` 里,否则 `npm install` 报 `ERESOLVE`。
|
|
144
|
+
|
|
145
|
+
## MiMo 线格式
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
POST {baseUrl}/chat/completions
|
|
149
|
+
头:api-key: <key>
|
|
150
|
+
体:{ "model": "mimo-v2.5-tts",
|
|
151
|
+
"audio": { "format": "wav", "voice": "mimo_default" },
|
|
152
|
+
"messages": [{ "role": "assistant", "content": "<style>开心</style>要说的话" }] }
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
音色克隆时切到 `mimo-v2.5-tts-voiceclone` 模型,参考音频以 Data URI 放进 `audio.voice`。响应 `choices[0].message.audio.data` 为 base64 音频(RIFF 或裸 PCM,裸 PCM 由插件包成 24 kHz / 16 bit / mono WAV)。
|
|
156
|
+
|
|
157
|
+
## 已知边界
|
|
158
|
+
|
|
159
|
+
- 按**消息**朗读:动作行属于该条已定稿回复,朗读其正文(不读思考块与工具调用);代码块以「代码略」代替。
|
|
160
|
+
- 文本超过「单次最大字符数」时朗读开头并在句末截断。
|
|
161
|
+
- Desktop(Electron)走 IPC 桥接 fetch,路由路径不变。
|
|
162
|
+
- 语音输入(麦克风)是官方 `@deepseek-ai/dsh-experimental-voice-input-bundle` 的职责,本插件不重复实现。
|
|
163
|
+
|
|
164
|
+
## 许可证
|
|
165
|
+
|
|
166
|
+
[MIT](./LICENSE) © F-YXL。**MIT 允许商用**——这是它和「禁止商用」许可证的关键区别;如果你需要禁止商用,请自行更换为 PolyForm Noncommercial 等非开源许可证。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# dsh-mimo-speak bundle layer: one row carries both halves of the plugin.
|
|
2
|
+
#
|
|
3
|
+
# `id: mimo-speak` is the profile entry id — it is also the settings namespace the
|
|
4
|
+
# browser half edits through ctx.configForms, so keep it stable.
|
|
5
|
+
#
|
|
6
|
+
# The row's bare package specifier is what mounts the `./client` browser half
|
|
7
|
+
# (see the client-modules README): the Host loader imports `dsh-mimo-speak`
|
|
8
|
+
# (Node entry) and the Web module system ships `dsh-mimo-speak/client`.
|
|
9
|
+
#
|
|
10
|
+
# To keep the API key out of this file entirely, paste it into the plugin's
|
|
11
|
+
# card on the Plugins page (stored via `credentials/set` under the reference
|
|
12
|
+
# below). To resolve it from the environment in your own override layer
|
|
13
|
+
# instead, override the reference's value there:
|
|
14
|
+
#
|
|
15
|
+
# - id: mimo-speak
|
|
16
|
+
# config:
|
|
17
|
+
# apiKey: !!js process.env.MIMO_API_KEY
|
|
18
|
+
- insert:
|
|
19
|
+
- id: mimo-speak
|
|
20
|
+
name: 'dsh-mimo-speak'
|
package/icon.svg
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" fill="none">
|
|
2
|
+
<rect x="2" y="2" width="44" height="44" rx="12" fill="#6157F5"/>
|
|
3
|
+
<path d="M14 29h5l7 6V13l-7 6h-5a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1z" fill="#fff"/>
|
|
4
|
+
<path d="M30.5 18.5a8.5 8.5 0 0 1 0 11" stroke="#fff" stroke-width="2.6" stroke-linecap="round"/>
|
|
5
|
+
<path d="M35 14a14.5 14.5 0 0 1 0 20" stroke="#fff" stroke-width="2.6" stroke-linecap="round" opacity="0.75"/>
|
|
6
|
+
</svg>
|