dsh-xiaomi-tts 2.3.0 → 2.3.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/README.en.md +5 -3
- package/README.md +80 -13
- package/assets/image.png +0 -0
- package/lib/client/conversation.d.ts +26 -0
- package/lib/client/conversation.d.ts.map +1 -0
- package/lib/client/index.d.ts +0 -51
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/live-speech-controller.d.ts +44 -0
- package/lib/client/live-speech-controller.d.ts.map +1 -0
- package/lib/client/localization.d.ts +66 -0
- package/lib/client/localization.d.ts.map +1 -0
- package/lib/client/pcm-audio-queue.d.ts +21 -0
- package/lib/client/pcm-audio-queue.d.ts.map +1 -0
- package/lib/client/playback-controller.d.ts +29 -0
- package/lib/client/playback-controller.d.ts.map +1 -0
- package/lib/client/playback-types.d.ts +17 -0
- package/lib/client/playback-types.d.ts.map +1 -0
- package/lib/client/playback.d.ts +4 -0
- package/lib/client/playback.d.ts.map +1 -0
- package/lib/client/settings-card.d.ts +11 -0
- package/lib/client/settings-card.d.ts.map +1 -0
- package/lib/client/settings-scope.d.ts +6 -0
- package/lib/client/settings-scope.d.ts.map +1 -0
- package/lib/client/styles.d.ts +2 -0
- package/lib/client/styles.d.ts.map +1 -0
- package/lib/client/voice-design-picker.d.ts +14 -0
- package/lib/client/voice-design-picker.d.ts.map +1 -0
- package/lib/client.js +675 -384
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +281 -4
- package/lib/{shared-DQA9zfpt.js → shared-9qFFYsWe.js} +73 -8
- package/lib/shared.d.ts +24 -1
- package/lib/shared.d.ts.map +1 -1
- package/lib/shared.js +2 -2
- package/package.json +3 -1
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAYxC,gCAAgC;AAChC,eAAO,MAAM,IAAI,oBAAoB,CAAA;AAErC,6CAA6C;AAC7C,eAAO,MAAM,MAAM,UAAgB,CAAA;AAEnC,uDAAuD;AACvD,eAAO,MAAM,kCAAkC,uDAA4C,CAAA;AAE3F,sCAAsC;AACtC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAcjB,CAAA;AAEF,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAA;AA4O9C,iEAAiE;AACjE,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CA4WxD"}
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { C as prepareTtsText, a as TTS_API_KEY_STATUS_ROUTE, b as isNewerTtsVersion, c as TTS_ROUTE, d as TTS_UNINSTALL_ROUTE, f as TTS_UPDATE_ROUTE, g as TTS_VOICE_DESIGN_PRESETS, h as TTS_VOICE_DESIGN_ASSET_ROUTE, l as TTS_SETTINGS_NAMESPACE, n as DEFAULT_TTS_SETTINGS, o as TTS_FORMATS, p as TTS_VERSION, s as TTS_MODELS, u as TTS_STREAM_ROUTE, w as resolveTtsBaseURL, x as isSupportedTtsApiKey } from "./shared-9qFFYsWe.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import {
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
import { join } from "node:path";
|
|
4
7
|
import z from "@deepseek-ai/schemastery";
|
|
5
8
|
import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
|
|
6
9
|
|
|
7
10
|
//#region src/index.ts
|
|
8
11
|
const packageJson = createRequire(import.meta.url)("../package.json");
|
|
9
12
|
const USER_AGENT = typeof packageJson.version === "string" ? `dsh-xiaomi-tts/${packageJson.version}` : "dsh-xiaomi-tts";
|
|
13
|
+
const PACKAGE_NAME = "dsh-xiaomi-tts";
|
|
14
|
+
const WEB_PROFILE_NAME = "web";
|
|
15
|
+
const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-xiaomi-tts/latest";
|
|
10
16
|
/** Cordis plugin identifier. */
|
|
11
17
|
const name = "xiaomi-mimo-tts";
|
|
12
18
|
/** Host services required by this plugin. */
|
|
@@ -68,9 +74,201 @@ function apiErrorMessage(status, parsed) {
|
|
|
68
74
|
const detail = typeof parsed?.error === "string" ? parsed.error : parsed?.error?.message ?? parsed?.message;
|
|
69
75
|
return detail && detail.length > 0 ? detail : `Xiaomi MiMo TTS request failed (HTTP ${status})`;
|
|
70
76
|
}
|
|
77
|
+
function webProfileDirectory() {
|
|
78
|
+
return join(process.env.DSH_HOME?.trim() || join(homedir(), ".dsh"), "profiles", WEB_PROFILE_NAME);
|
|
79
|
+
}
|
|
80
|
+
function readWebProfileManifest() {
|
|
81
|
+
const path = join(webProfileDirectory(), "package.json");
|
|
82
|
+
if (!existsSync(path)) return void 0;
|
|
83
|
+
try {
|
|
84
|
+
return JSON.parse(readFileSync(path, "utf8").replace(/^\uFEFF/u, ""));
|
|
85
|
+
} catch {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function resolveDshCommand() {
|
|
90
|
+
const entry = process.argv[1];
|
|
91
|
+
if (typeof entry === "string" && /[\\/]node_modules[\\/]@deepseek-ai[\\/]dsh[\\/]lib[\\/]bin\.js$/iu.test(entry)) return {
|
|
92
|
+
command: process.execPath,
|
|
93
|
+
args: [entry]
|
|
94
|
+
};
|
|
95
|
+
const executable = process.execPath.split(/[\\/]/u).at(-1) ?? "";
|
|
96
|
+
if (/^dsh(?:\.exe)?$/iu.test(executable)) return {
|
|
97
|
+
command: process.execPath,
|
|
98
|
+
args: []
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
async function latestTtsVersion() {
|
|
102
|
+
try {
|
|
103
|
+
const response = await fetch(NPM_LATEST_URL, {
|
|
104
|
+
headers: {
|
|
105
|
+
accept: "application/json",
|
|
106
|
+
"user-agent": USER_AGENT
|
|
107
|
+
},
|
|
108
|
+
signal: AbortSignal.timeout(8e3)
|
|
109
|
+
});
|
|
110
|
+
if (!response.ok) return null;
|
|
111
|
+
const body = await response.json();
|
|
112
|
+
return typeof body.version === "string" ? body.version : null;
|
|
113
|
+
} catch {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function scheduleProfileLinkCleanup(profileRoot) {
|
|
118
|
+
const cleanupScript = String.raw`
|
|
119
|
+
const { lstatSync, rmSync } = require('node:fs')
|
|
120
|
+
const { join } = require('node:path')
|
|
121
|
+
const [parentPidSource, profileRoot, packageName] = process.argv.slice(1)
|
|
122
|
+
const parentPid = Number(parentPidSource)
|
|
123
|
+
const linkPath = join(profileRoot, 'node_modules', packageName)
|
|
124
|
+
let cleanupAttempts = 0
|
|
125
|
+
|
|
126
|
+
function cleanupLink() {
|
|
127
|
+
cleanupAttempts += 1
|
|
128
|
+
try {
|
|
129
|
+
const item = lstatSync(linkPath)
|
|
130
|
+
if (!item.isSymbolicLink()) process.exit(2)
|
|
131
|
+
rmSync(linkPath, { force: true })
|
|
132
|
+
process.exit(0)
|
|
133
|
+
} catch (error) {
|
|
134
|
+
if (error && error.code === 'ENOENT') process.exit(0)
|
|
135
|
+
if (cleanupAttempts >= 40) process.exit(1)
|
|
136
|
+
setTimeout(cleanupLink, 500)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function waitForParentExit() {
|
|
141
|
+
try {
|
|
142
|
+
process.kill(parentPid, 0)
|
|
143
|
+
setTimeout(waitForParentExit, 1000)
|
|
144
|
+
} catch {
|
|
145
|
+
cleanupLink()
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
waitForParentExit()
|
|
150
|
+
`;
|
|
151
|
+
return new Promise((resolve, reject) => {
|
|
152
|
+
const child = spawn(process.execPath, [
|
|
153
|
+
"-e",
|
|
154
|
+
cleanupScript,
|
|
155
|
+
String(process.pid),
|
|
156
|
+
profileRoot,
|
|
157
|
+
PACKAGE_NAME
|
|
158
|
+
], {
|
|
159
|
+
cwd: profileRoot,
|
|
160
|
+
env: {
|
|
161
|
+
...process.env,
|
|
162
|
+
CI: "true"
|
|
163
|
+
},
|
|
164
|
+
windowsHide: true,
|
|
165
|
+
detached: true,
|
|
166
|
+
stdio: "ignore"
|
|
167
|
+
});
|
|
168
|
+
child.once("error", reject);
|
|
169
|
+
child.once("spawn", () => {
|
|
170
|
+
child.unref();
|
|
171
|
+
resolve();
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
async function uninstallFromWebProfile() {
|
|
176
|
+
const manifest = readWebProfileManifest();
|
|
177
|
+
if (manifest === void 0) return {
|
|
178
|
+
ok: false,
|
|
179
|
+
output: "",
|
|
180
|
+
error: "DSH Web profile manifest was not found or could not be read."
|
|
181
|
+
};
|
|
182
|
+
if (!(Object.hasOwn(manifest.dependencies ?? {}, PACKAGE_NAME) || manifest.dsh?.profile?.bundles?.includes(PACKAGE_NAME) === true)) try {
|
|
183
|
+
await scheduleProfileLinkCleanup(webProfileDirectory());
|
|
184
|
+
return {
|
|
185
|
+
ok: true,
|
|
186
|
+
output: "The plugin was already removed from the Web profile; link cleanup is scheduled after this process exits."
|
|
187
|
+
};
|
|
188
|
+
} catch (error) {
|
|
189
|
+
return {
|
|
190
|
+
ok: false,
|
|
191
|
+
output: "",
|
|
192
|
+
error: error instanceof Error ? error.message : String(error)
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
const dsh = resolveDshCommand();
|
|
196
|
+
if (dsh === void 0) return {
|
|
197
|
+
ok: false,
|
|
198
|
+
output: "",
|
|
199
|
+
error: "Could not resolve the running DSH executable."
|
|
200
|
+
};
|
|
201
|
+
const result = await new Promise((resolve) => {
|
|
202
|
+
const child = spawn(dsh.command, [
|
|
203
|
+
...dsh.args,
|
|
204
|
+
"plugin",
|
|
205
|
+
"--profile",
|
|
206
|
+
WEB_PROFILE_NAME,
|
|
207
|
+
"remove",
|
|
208
|
+
PACKAGE_NAME,
|
|
209
|
+
"--lockfile-only"
|
|
210
|
+
], {
|
|
211
|
+
cwd: webProfileDirectory(),
|
|
212
|
+
env: {
|
|
213
|
+
...process.env,
|
|
214
|
+
CI: "true"
|
|
215
|
+
},
|
|
216
|
+
windowsHide: true,
|
|
217
|
+
stdio: [
|
|
218
|
+
"ignore",
|
|
219
|
+
"pipe",
|
|
220
|
+
"pipe"
|
|
221
|
+
]
|
|
222
|
+
});
|
|
223
|
+
let output = "";
|
|
224
|
+
child.stdout?.setEncoding("utf8");
|
|
225
|
+
child.stderr?.setEncoding("utf8");
|
|
226
|
+
child.stdout?.on("data", (chunk) => {
|
|
227
|
+
output += chunk;
|
|
228
|
+
});
|
|
229
|
+
child.stderr?.on("data", (chunk) => {
|
|
230
|
+
output += chunk;
|
|
231
|
+
});
|
|
232
|
+
child.once("error", (error) => {
|
|
233
|
+
resolve({
|
|
234
|
+
ok: false,
|
|
235
|
+
output: output.trim(),
|
|
236
|
+
error: error.message
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
child.once("close", (code) => {
|
|
240
|
+
resolve({
|
|
241
|
+
ok: code === 0,
|
|
242
|
+
output: output.trim(),
|
|
243
|
+
...code === 0 ? {} : { error: `DSH plugin removal exited with code ${String(code)}.` }
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
if (!result.ok) return result;
|
|
248
|
+
const updatedManifest = readWebProfileManifest();
|
|
249
|
+
if (updatedManifest === void 0 || Object.hasOwn(updatedManifest.dependencies ?? {}, PACKAGE_NAME) || updatedManifest.dsh?.profile?.bundles?.includes(PACKAGE_NAME) === true) return {
|
|
250
|
+
ok: false,
|
|
251
|
+
output: result.output,
|
|
252
|
+
error: "DSH did not remove the plugin from the Web profile."
|
|
253
|
+
};
|
|
254
|
+
try {
|
|
255
|
+
await scheduleProfileLinkCleanup(webProfileDirectory());
|
|
256
|
+
return {
|
|
257
|
+
ok: true,
|
|
258
|
+
output: result.output
|
|
259
|
+
};
|
|
260
|
+
} catch (error) {
|
|
261
|
+
return {
|
|
262
|
+
ok: false,
|
|
263
|
+
output: result.output,
|
|
264
|
+
error: error instanceof Error ? error.message : String(error)
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
}
|
|
71
268
|
/** Register the TTS settings and same-origin synthesis route. */
|
|
72
269
|
function apply(ctx, config) {
|
|
73
270
|
let current = () => config;
|
|
271
|
+
let uninstalling;
|
|
74
272
|
const voicePresetAssets = new Map(TTS_VOICE_DESIGN_PRESETS.map((preset) => {
|
|
75
273
|
return [`${TTS_VOICE_DESIGN_ASSET_ROUTE}/${preset.id}.webp`, readFileSync(new URL(`../assets/voice-presets/${preset.id}.webp`, import.meta.url))];
|
|
76
274
|
}));
|
|
@@ -86,6 +284,85 @@ function apply(ctx, config) {
|
|
|
86
284
|
if (value.format !== "mp3" && value.format !== "wav") throw new Error("format must be mp3 or wav");
|
|
87
285
|
}
|
|
88
286
|
});
|
|
287
|
+
ctx.effect(() => ctx.webServer.register({
|
|
288
|
+
kind: "exact",
|
|
289
|
+
path: TTS_UPDATE_ROUTE,
|
|
290
|
+
async handler(req, res) {
|
|
291
|
+
if (req.method !== "GET") {
|
|
292
|
+
res.setHeader("allow", "GET");
|
|
293
|
+
json(res, 405, { error: "method-not-allowed" });
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const latest = await latestTtsVersion();
|
|
297
|
+
json(res, 200, {
|
|
298
|
+
currentVersion: TTS_VERSION,
|
|
299
|
+
latestVersion: latest,
|
|
300
|
+
updateAvailable: latest !== null && isNewerTtsVersion(latest, TTS_VERSION)
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}), "xiaomi-mimo-tts: update status route");
|
|
304
|
+
ctx.effect(() => ctx.webServer.register({
|
|
305
|
+
kind: "exact",
|
|
306
|
+
path: TTS_API_KEY_STATUS_ROUTE,
|
|
307
|
+
handler(req, res) {
|
|
308
|
+
if (req.method !== "GET") {
|
|
309
|
+
res.setHeader("allow", "GET");
|
|
310
|
+
json(res, 405, { error: "method-not-allowed" });
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const apiKey = current().apiKey.trim();
|
|
314
|
+
json(res, 200, {
|
|
315
|
+
configured: apiKey.length > 0,
|
|
316
|
+
supported: apiKey.length > 0 && isSupportedTtsApiKey(apiKey)
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}), "xiaomi-mimo-tts: API key status route");
|
|
320
|
+
ctx.effect(() => ctx.webServer.register({
|
|
321
|
+
kind: "exact",
|
|
322
|
+
path: TTS_UNINSTALL_ROUTE,
|
|
323
|
+
async handler(req, res) {
|
|
324
|
+
if (req.method !== "POST") {
|
|
325
|
+
res.setHeader("allow", "POST");
|
|
326
|
+
json(res, 405, {
|
|
327
|
+
ok: false,
|
|
328
|
+
error: "method-not-allowed"
|
|
329
|
+
});
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
const fetchSite = req.headers["sec-fetch-site"];
|
|
333
|
+
if (fetchSite !== void 0 && fetchSite !== "same-origin") {
|
|
334
|
+
json(res, 403, {
|
|
335
|
+
ok: false,
|
|
336
|
+
error: "same-origin-required"
|
|
337
|
+
});
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (!(req.headers["content-type"] ?? "").toLowerCase().startsWith("application/json")) {
|
|
341
|
+
json(res, 415, {
|
|
342
|
+
ok: false,
|
|
343
|
+
error: "application-json-required"
|
|
344
|
+
});
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
try {
|
|
348
|
+
await readJsonBody(req, 1024);
|
|
349
|
+
} catch {
|
|
350
|
+
json(res, 400, {
|
|
351
|
+
ok: false,
|
|
352
|
+
error: "invalid-json"
|
|
353
|
+
});
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
uninstalling ??= uninstallFromWebProfile();
|
|
357
|
+
const result = await uninstalling;
|
|
358
|
+
if (!result.ok) uninstalling = void 0;
|
|
359
|
+
json(res, result.ok ? 200 : 500, {
|
|
360
|
+
ok: result.ok,
|
|
361
|
+
requiresRestart: result.ok,
|
|
362
|
+
...result.error === void 0 ? {} : { error: result.error }
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}), "xiaomi-mimo-tts: self-uninstall route");
|
|
89
366
|
ctx.effect(() => ctx.webServer.register({
|
|
90
367
|
kind: "prefix",
|
|
91
368
|
path: TTS_VOICE_DESIGN_ASSET_ROUTE,
|
|
@@ -147,7 +424,7 @@ function apply(ctx, config) {
|
|
|
147
424
|
const controller = new AbortController();
|
|
148
425
|
const timeout = setTimeout(() => controller.abort(), options.requestTimeoutMs);
|
|
149
426
|
try {
|
|
150
|
-
const endpoint = `${normalizeBaseURL(options.baseURL)}/chat/completions`;
|
|
427
|
+
const endpoint = `${normalizeBaseURL(resolveTtsBaseURL(options.apiKey, options.baseURL))}/chat/completions`;
|
|
151
428
|
const response = await fetch(endpoint, {
|
|
152
429
|
method: "POST",
|
|
153
430
|
redirect: "error",
|
|
@@ -268,7 +545,7 @@ function apply(ctx, config) {
|
|
|
268
545
|
req.once("aborted", abortOnDisconnect);
|
|
269
546
|
res.once("close", abortOnDisconnect);
|
|
270
547
|
try {
|
|
271
|
-
const response = await fetch(`${normalizeBaseURL(options.baseURL)}/chat/completions`, {
|
|
548
|
+
const response = await fetch(`${normalizeBaseURL(resolveTtsBaseURL(options.apiKey, options.baseURL))}/chat/completions`, {
|
|
272
549
|
method: "POST",
|
|
273
550
|
redirect: "error",
|
|
274
551
|
headers: {
|
|
@@ -5,8 +5,45 @@ const TTS_SETTINGS_NAMESPACE = "xiaomi-mimo-tts";
|
|
|
5
5
|
const TTS_ROUTE = "/plugins/xiaomi-mimo-tts/synthesize";
|
|
6
6
|
/** Same-origin route that proxies MiMo PCM16 server-sent audio chunks. */
|
|
7
7
|
const TTS_STREAM_ROUTE = "/plugins/xiaomi-mimo-tts/synthesize-stream";
|
|
8
|
+
/** Same-origin route that removes this plugin from the DSH Web profile. */
|
|
9
|
+
const TTS_UNINSTALL_ROUTE = "/plugins/xiaomi-mimo-tts/uninstall";
|
|
10
|
+
/** Same-origin route that checks the published npm version. */
|
|
11
|
+
const TTS_UPDATE_ROUTE = "/plugins/xiaomi-mimo-tts/update";
|
|
12
|
+
/** Keep the UI version visible without making the browser bundle load package.json. */
|
|
13
|
+
const TTS_VERSION = "2.3.2";
|
|
14
|
+
const SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;
|
|
15
|
+
/** Return true only when `candidate` is a strictly newer semantic version. */
|
|
16
|
+
function isNewerTtsVersion(candidate, current) {
|
|
17
|
+
const left = SEMVER.exec(candidate.trim());
|
|
18
|
+
const right = SEMVER.exec(current.trim());
|
|
19
|
+
if (left === null || right === null) return false;
|
|
20
|
+
for (let index = 1; index <= 3; index++) {
|
|
21
|
+
const difference = Number(left[index]) - Number(right[index]);
|
|
22
|
+
if (difference !== 0) return difference > 0;
|
|
23
|
+
}
|
|
24
|
+
const leftPre = left[4]?.split(".") ?? [];
|
|
25
|
+
const rightPre = right[4]?.split(".") ?? [];
|
|
26
|
+
if (leftPre.length === 0 || rightPre.length === 0) return leftPre.length === 0 && rightPre.length > 0;
|
|
27
|
+
for (let index = 0; index < Math.max(leftPre.length, rightPre.length); index++) {
|
|
28
|
+
const a = leftPre[index];
|
|
29
|
+
const b = rightPre[index];
|
|
30
|
+
if (a === void 0) return false;
|
|
31
|
+
if (b === void 0) return true;
|
|
32
|
+
if (a === b) continue;
|
|
33
|
+
const aNumber = /^\d+$/u.test(a);
|
|
34
|
+
const bNumber = /^\d+$/u.test(b);
|
|
35
|
+
if (aNumber && bNumber) return Number(a) > Number(b);
|
|
36
|
+
if (aNumber !== bNumber) return !aNumber;
|
|
37
|
+
return a > b;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
/** Same-origin route that reports API key configuration status without exposing the key. */
|
|
42
|
+
const TTS_API_KEY_STATUS_ROUTE = "/plugins/xiaomi-mimo-tts/api-key-status";
|
|
8
43
|
/** Same-origin prefix used by the Web client to load voice-design preset icons. */
|
|
9
44
|
const TTS_VOICE_DESIGN_ASSET_ROUTE = "/plugins/xiaomi-mimo-tts/voice-presets";
|
|
45
|
+
/** Default Xiaomi endpoint for Token Plan API keys. */
|
|
46
|
+
const TOKEN_PLAN_TTS_BASE_URL = "https://token-plan-cn.xiaomimimo.com/v1";
|
|
10
47
|
/** Supported built-in Xiaomi MiMo voices. */
|
|
11
48
|
const TTS_VOICES = [
|
|
12
49
|
"冰糖",
|
|
@@ -88,10 +125,12 @@ const TTS_PUNCTUATION = {
|
|
|
88
125
|
"?": "?",
|
|
89
126
|
";": ";",
|
|
90
127
|
"、": ",",
|
|
128
|
+
"(": ",",
|
|
129
|
+
")": ",",
|
|
91
130
|
" ": " "
|
|
92
131
|
};
|
|
93
132
|
/** Decorative punctuation can make TTS emit non-speech artifacts, so omit it entirely. */
|
|
94
|
-
const TTS_NON_SPEECH_PUNCTUATION = /[()
|
|
133
|
+
const TTS_NON_SPEECH_PUNCTUATION = /[()\[\]【】[]〔〕〖〗{}{}「」『』《》〈〉“”‘’"'`<>:…—–-~]/gu;
|
|
95
134
|
const TTS_URL_PATTERN = /\b(?:https?|ftp):\/\/[^\s<>()]+|\bwww\.[^\s<>()]+|\b(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+(?:com|cn|net|org|io|ai|dev|me|co|edu|gov|xyz|tech|info|app|site|link)(?:[/:?#][^\s<>()]*)?/giu;
|
|
96
135
|
const TTS_WINDOWS_PATH_PATTERN = /(?:\b[A-Za-z]:[\\/]|\\\\)(?:[A-Za-z0-9._ -]+[\\/])*(?:[A-Za-z0-9._ -]+)/gu;
|
|
97
136
|
const TTS_UNIX_PATH_PATTERN = /\/(?:[A-Za-z0-9._-]+\/)*(?:[A-Za-z0-9._-]+)/gu;
|
|
@@ -109,7 +148,7 @@ function removeTtsSymbols(value) {
|
|
|
109
148
|
return value.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF]/g, " ").replace(/(?:\p{Extended_Pictographic}|\p{Emoji_Presentation}|\p{Regional_Indicator}|\p{Emoji_Modifier}|\p{So}|\uFE0E|\uFE0F|\u200D|\u20E3)/gu, " ");
|
|
110
149
|
}
|
|
111
150
|
function normalizeTtsPunctuation(value) {
|
|
112
|
-
return value.replace(TTS_NON_SPEECH_PUNCTUATION, "").replace(/[
|
|
151
|
+
return value.replace(TTS_NON_SPEECH_PUNCTUATION, "").replace(/[,。!?;、() ]/gu, (character) => TTS_PUNCTUATION[character] ?? character).replace(/(^|\s)[,;:!?]+(?=\s|$)/g, "$1").replace(/([,;:])\s*([.!?])/g, "$2").replace(/\s+([,.;:!?])/g, "$1");
|
|
113
152
|
}
|
|
114
153
|
/**
|
|
115
154
|
* Prepare assistant text for speech synthesis without changing the chat transcript.
|
|
@@ -166,16 +205,18 @@ function classifyLiveSpeechTransition(current, next) {
|
|
|
166
205
|
if (current === null || current.sessionId !== next.sessionId || current.turn !== next.turn) return "new-turn";
|
|
167
206
|
return current.step === next.step ? "same-step" : "same-turn";
|
|
168
207
|
}
|
|
169
|
-
/** Serializes sentence requests and makes cancellation independent from the playback backend. */
|
|
170
208
|
var AbortableSentenceQueue = class {
|
|
171
209
|
pending = [];
|
|
172
210
|
current = null;
|
|
173
211
|
revision = 0;
|
|
174
|
-
|
|
212
|
+
busy = false;
|
|
213
|
+
constructor(start, options = {}) {
|
|
175
214
|
this.start = start;
|
|
215
|
+
this.options = options;
|
|
176
216
|
}
|
|
177
217
|
enqueue(sentence) {
|
|
178
218
|
this.pending.push(sentence);
|
|
219
|
+
this.setBusy(true);
|
|
179
220
|
this.pump();
|
|
180
221
|
}
|
|
181
222
|
cancel() {
|
|
@@ -183,23 +224,38 @@ var AbortableSentenceQueue = class {
|
|
|
183
224
|
this.pending.length = 0;
|
|
184
225
|
this.current?.abort();
|
|
185
226
|
this.current = null;
|
|
227
|
+
this.setBusy(false);
|
|
186
228
|
}
|
|
187
229
|
async pump() {
|
|
188
230
|
if (this.current !== null) return;
|
|
189
231
|
const sentence = this.pending.shift();
|
|
190
|
-
if (sentence === void 0)
|
|
232
|
+
if (sentence === void 0) {
|
|
233
|
+
this.setBusy(false);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
191
236
|
const revision = this.revision;
|
|
192
237
|
const controller = new AbortController();
|
|
193
238
|
this.current = controller;
|
|
194
239
|
try {
|
|
195
240
|
await this.start(sentence, controller.signal);
|
|
196
241
|
} catch (error) {
|
|
197
|
-
if (!controller.signal.aborted)
|
|
242
|
+
if (!controller.signal.aborted && revision === this.revision) {
|
|
243
|
+
this.pending.length = 0;
|
|
244
|
+
this.revision += 1;
|
|
245
|
+
this.options.onError?.(error);
|
|
246
|
+
}
|
|
198
247
|
} finally {
|
|
199
248
|
if (this.current === controller) this.current = null;
|
|
200
|
-
if (revision === this.revision) this.pump();
|
|
249
|
+
if (revision === this.revision) if (this.pending.length > 0) this.pump();
|
|
250
|
+
else this.setBusy(false);
|
|
251
|
+
else this.setBusy(false);
|
|
201
252
|
}
|
|
202
253
|
}
|
|
254
|
+
setBusy(busy) {
|
|
255
|
+
if (this.busy === busy) return;
|
|
256
|
+
this.busy = busy;
|
|
257
|
+
this.options.onBusyChange?.(busy);
|
|
258
|
+
}
|
|
203
259
|
};
|
|
204
260
|
/** Defaults shared by the Schemastery config and the Web settings form. */
|
|
205
261
|
const DEFAULT_TTS_SETTINGS = {
|
|
@@ -217,6 +273,15 @@ const DEFAULT_TTS_SETTINGS = {
|
|
|
217
273
|
maxTextLength: 12e3,
|
|
218
274
|
requestTimeoutMs: 12e4
|
|
219
275
|
};
|
|
276
|
+
/** Select the Xiaomi endpoint from the API key while preserving custom settings for other keys. */
|
|
277
|
+
function resolveTtsBaseURL(apiKey, configuredBaseURL) {
|
|
278
|
+
return apiKey.trim().startsWith("tp-") ? TOKEN_PLAN_TTS_BASE_URL : configuredBaseURL;
|
|
279
|
+
}
|
|
280
|
+
/** Whether an API key selects one of the Xiaomi endpoints supported by this plugin. */
|
|
281
|
+
function isSupportedTtsApiKey(apiKey) {
|
|
282
|
+
const normalized = apiKey.trim();
|
|
283
|
+
return normalized.startsWith("sk-") || normalized.startsWith("tp-");
|
|
284
|
+
}
|
|
220
285
|
/** Resolve an optional settings snapshot into the values used by the form. */
|
|
221
286
|
function resolveTtsSettings(value) {
|
|
222
287
|
const resolved = {
|
|
@@ -232,4 +297,4 @@ function resolveTtsSettings(value) {
|
|
|
232
297
|
}
|
|
233
298
|
|
|
234
299
|
//#endregion
|
|
235
|
-
export { resolveTtsSettings as _,
|
|
300
|
+
export { prepareTtsText as C, splitCompletedTtsSentences as E, parseSseRecords as S, resolveTtsSettings as T, batchTtsStreamText as _, TTS_API_KEY_STATUS_ROUTE as a, isNewerTtsVersion as b, TTS_ROUTE as c, TTS_UNINSTALL_ROUTE as d, TTS_UPDATE_ROUTE as f, TTS_VOICE_DESIGN_PRESETS as g, TTS_VOICE_DESIGN_ASSET_ROUTE as h, TOKEN_PLAN_TTS_BASE_URL as i, TTS_SETTINGS_NAMESPACE as l, TTS_VOICES as m, DEFAULT_TTS_SETTINGS as n, TTS_FORMATS as o, TTS_VERSION as p, MIN_TTS_STREAM_CHARACTERS as r, TTS_MODELS as s, AbortableSentenceQueue as t, TTS_STREAM_ROUTE as u, classifyLiveSpeechTransition as v, resolveTtsBaseURL as w, isSupportedTtsApiKey as x, countTtsSpeechCharacters as y };
|
package/lib/shared.d.ts
CHANGED
|
@@ -4,8 +4,20 @@ export declare const TTS_SETTINGS_NAMESPACE = "xiaomi-mimo-tts";
|
|
|
4
4
|
export declare const TTS_ROUTE = "/plugins/xiaomi-mimo-tts/synthesize";
|
|
5
5
|
/** Same-origin route that proxies MiMo PCM16 server-sent audio chunks. */
|
|
6
6
|
export declare const TTS_STREAM_ROUTE = "/plugins/xiaomi-mimo-tts/synthesize-stream";
|
|
7
|
+
/** Same-origin route that removes this plugin from the DSH Web profile. */
|
|
8
|
+
export declare const TTS_UNINSTALL_ROUTE = "/plugins/xiaomi-mimo-tts/uninstall";
|
|
9
|
+
/** Same-origin route that checks the published npm version. */
|
|
10
|
+
export declare const TTS_UPDATE_ROUTE = "/plugins/xiaomi-mimo-tts/update";
|
|
11
|
+
/** Keep the UI version visible without making the browser bundle load package.json. */
|
|
12
|
+
export declare const TTS_VERSION = "2.3.2";
|
|
13
|
+
/** Return true only when `candidate` is a strictly newer semantic version. */
|
|
14
|
+
export declare function isNewerTtsVersion(candidate: string, current: string): boolean;
|
|
15
|
+
/** Same-origin route that reports API key configuration status without exposing the key. */
|
|
16
|
+
export declare const TTS_API_KEY_STATUS_ROUTE = "/plugins/xiaomi-mimo-tts/api-key-status";
|
|
7
17
|
/** Same-origin prefix used by the Web client to load voice-design preset icons. */
|
|
8
18
|
export declare const TTS_VOICE_DESIGN_ASSET_ROUTE = "/plugins/xiaomi-mimo-tts/voice-presets";
|
|
19
|
+
/** Default Xiaomi endpoint for Token Plan API keys. */
|
|
20
|
+
export declare const TOKEN_PLAN_TTS_BASE_URL = "https://token-plan-cn.xiaomimimo.com/v1";
|
|
9
21
|
/** Supported built-in Xiaomi MiMo voices. */
|
|
10
22
|
export declare const TTS_VOICES: readonly ["冰糖", "茉莉", "苏打", "白桦", "Mia", "Chloe", "Milo", "Dean"];
|
|
11
23
|
/** TTS models supported by this plugin. */
|
|
@@ -96,15 +108,22 @@ export type LiveSpeechTransition = 'same-step' | 'same-turn' | 'new-turn';
|
|
|
96
108
|
/** Decide whether a live assistant update extends one message, advances within a turn, or starts a new turn. */
|
|
97
109
|
export declare function classifyLiveSpeechTransition(current: LiveSpeechCursor | null, next: LiveSpeechCursor): LiveSpeechTransition;
|
|
98
110
|
/** Serializes sentence requests and makes cancellation independent from the playback backend. */
|
|
111
|
+
export interface AbortableSentenceQueueOptions {
|
|
112
|
+
onBusyChange?: (busy: boolean) => void;
|
|
113
|
+
onError?: (error: unknown) => void;
|
|
114
|
+
}
|
|
99
115
|
export declare class AbortableSentenceQueue {
|
|
100
116
|
private readonly start;
|
|
117
|
+
private readonly options;
|
|
101
118
|
private readonly pending;
|
|
102
119
|
private current;
|
|
103
120
|
private revision;
|
|
104
|
-
|
|
121
|
+
private busy;
|
|
122
|
+
constructor(start: (sentence: string, signal: AbortSignal) => Promise<void>, options?: AbortableSentenceQueueOptions);
|
|
105
123
|
enqueue(sentence: string): void;
|
|
106
124
|
cancel(): void;
|
|
107
125
|
private pump;
|
|
126
|
+
private setBusy;
|
|
108
127
|
}
|
|
109
128
|
export interface TtsSettings {
|
|
110
129
|
enabled?: boolean;
|
|
@@ -138,6 +157,10 @@ export interface ResolvedTtsSettings {
|
|
|
138
157
|
}
|
|
139
158
|
/** Defaults shared by the Schemastery config and the Web settings form. */
|
|
140
159
|
export declare const DEFAULT_TTS_SETTINGS: ResolvedTtsSettings;
|
|
160
|
+
/** Select the Xiaomi endpoint from the API key while preserving custom settings for other keys. */
|
|
161
|
+
export declare function resolveTtsBaseURL(apiKey: string, configuredBaseURL: string): string;
|
|
162
|
+
/** Whether an API key selects one of the Xiaomi endpoints supported by this plugin. */
|
|
163
|
+
export declare function isSupportedTtsApiKey(apiKey: string): boolean;
|
|
141
164
|
/** Resolve an optional settings snapshot into the values used by the form. */
|
|
142
165
|
export declare function resolveTtsSettings(value: TtsSettings | undefined): ResolvedTtsSettings;
|
|
143
166
|
//# sourceMappingURL=shared.d.ts.map
|
package/lib/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,oBAAoB,CAAA;AAEvD,6EAA6E;AAC7E,eAAO,MAAM,SAAS,wCAAwC,CAAA;AAE9D,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,+CAA+C,CAAA;AAE5E,mFAAmF;AACnF,eAAO,MAAM,4BAA4B,2CAA2C,CAAA;AAEpF,6CAA6C;AAC7C,eAAO,MAAM,UAAU,mEAAoE,CAAA;AAE3F,2CAA2C;AAC3C,eAAO,MAAM,UAAU,yDAA0D,CAAA;AAEjF,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAEhD,kFAAkF;AAClF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU3B,CAAA;AAEV,+BAA+B;AAC/B,eAAO,MAAM,WAAW,yBAA0B,CAAA;AAElD,MAAM,MAAM,SAAS,GAAG,OAAO,WAAW,CAAC,MAAM,CAAC,CAAA;AAElD,sFAAsF;AACtF,eAAO,MAAM,yBAAyB,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,oBAAoB,CAAA;AAEvD,6EAA6E;AAC7E,eAAO,MAAM,SAAS,wCAAwC,CAAA;AAE9D,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,+CAA+C,CAAA;AAE5E,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,uCAAuC,CAAA;AAEvE,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,oCAAoC,CAAA;AAEjE,uFAAuF;AACvF,eAAO,MAAM,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1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as prepareTtsText, E as splitCompletedTtsSentences, S as parseSseRecords, T as resolveTtsSettings, _ as batchTtsStreamText, a as TTS_API_KEY_STATUS_ROUTE, b as isNewerTtsVersion, c as TTS_ROUTE, d as TTS_UNINSTALL_ROUTE, f as TTS_UPDATE_ROUTE, g as TTS_VOICE_DESIGN_PRESETS, h as TTS_VOICE_DESIGN_ASSET_ROUTE, i as TOKEN_PLAN_TTS_BASE_URL, l as TTS_SETTINGS_NAMESPACE, m as TTS_VOICES, n as DEFAULT_TTS_SETTINGS, o as TTS_FORMATS, p as TTS_VERSION, r as MIN_TTS_STREAM_CHARACTERS, s as TTS_MODELS, t as AbortableSentenceQueue, u as TTS_STREAM_ROUTE, v as classifyLiveSpeechTransition, w as resolveTtsBaseURL, x as isSupportedTtsApiKey, y as countTtsSpeechCharacters } from "./shared-9qFFYsWe.js";
|
|
2
2
|
|
|
3
|
-
export { AbortableSentenceQueue, DEFAULT_TTS_SETTINGS, MIN_TTS_STREAM_CHARACTERS, TTS_FORMATS, TTS_MODELS, TTS_ROUTE, TTS_SETTINGS_NAMESPACE, TTS_STREAM_ROUTE, TTS_VOICES, TTS_VOICE_DESIGN_ASSET_ROUTE, TTS_VOICE_DESIGN_PRESETS, batchTtsStreamText, classifyLiveSpeechTransition, countTtsSpeechCharacters, parseSseRecords, prepareTtsText, resolveTtsSettings, splitCompletedTtsSentences };
|
|
3
|
+
export { AbortableSentenceQueue, DEFAULT_TTS_SETTINGS, MIN_TTS_STREAM_CHARACTERS, TOKEN_PLAN_TTS_BASE_URL, TTS_API_KEY_STATUS_ROUTE, TTS_FORMATS, TTS_MODELS, TTS_ROUTE, TTS_SETTINGS_NAMESPACE, TTS_STREAM_ROUTE, TTS_UNINSTALL_ROUTE, TTS_UPDATE_ROUTE, TTS_VERSION, TTS_VOICES, TTS_VOICE_DESIGN_ASSET_ROUTE, TTS_VOICE_DESIGN_PRESETS, batchTtsStreamText, classifyLiveSpeechTransition, countTtsSpeechCharacters, isNewerTtsVersion, isSupportedTtsApiKey, parseSseRecords, prepareTtsText, resolveTtsBaseURL, resolveTtsSettings, splitCompletedTtsSentences };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-xiaomi-tts",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Xiaomi MiMo text-to-speech controls for DeepSeek Harness Web assistant messages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -61,6 +61,8 @@
|
|
|
61
61
|
"typecheck": "tsc --noEmit",
|
|
62
62
|
"test": "pnpm run build && node --test test/*.test.mjs",
|
|
63
63
|
"release:check": "pnpm run test",
|
|
64
|
+
"prepare": "pnpm run build",
|
|
65
|
+
"prepack": "pnpm run build",
|
|
64
66
|
"pack:check": "pnpm pack --dry-run"
|
|
65
67
|
},
|
|
66
68
|
"peerDependencies": {
|