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/lib/client.js ADDED
@@ -0,0 +1,553 @@
1
+ window.__ModuleLoader__.load({ id: "dsh-xiaomi-tts", factory: (require) => {
2
+ var module = { exports: {} }; var exports = module.exports;
3
+ //#region rolldown:runtime
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
21
+ value: mod,
22
+ enumerable: true
23
+ }) : target, mod));
24
+
25
+ //#endregion
26
+ let react = require("react");
27
+ react = __toESM(react);
28
+ let __deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
29
+ __deepseek_ai_dsh_client_ui_primitives = __toESM(__deepseek_ai_dsh_client_ui_primitives);
30
+ let react_jsx_runtime = require("react/jsx-runtime");
31
+ react_jsx_runtime = __toESM(react_jsx_runtime);
32
+
33
+ //#region src/client/index.tsx
34
+ const inject = [
35
+ "slots",
36
+ "locale",
37
+ "connection",
38
+ "remote",
39
+ "settingsScope"
40
+ ];
41
+ const NS = "xiaomi-mimo-tts";
42
+ const SETTINGS_NAMESPACE = "xiaomi-mimo-tts";
43
+ const TTS_ROUTE = "/plugins/xiaomi-mimo-tts/synthesize";
44
+ const zh = {
45
+ "action.play": "朗读回复",
46
+ "action.pause": "暂停朗读",
47
+ "action.resume": "继续朗读",
48
+ "action.loading": "正在生成语音",
49
+ "action.retry": "重新生成语音",
50
+ "error.noText": "这条回复没有可朗读的正文。",
51
+ "error.request": "语音生成失败。",
52
+ "error.play": "浏览器阻止了自动播放,请点击朗读按钮。",
53
+ "settings.title": "Xiaomi MiMo 语音朗读",
54
+ "settings.description": "在助手回复操作栏中使用 Xiaomi MiMo TTS 生成并播放语音。",
55
+ "settings.apiKey": "API Key",
56
+ "settings.apiKeyHint": "密钥保存在 DSH 设置文件中,传到浏览器前会被脱敏。",
57
+ "settings.apiKeyStatus": "只有输入新值并保存时才会替换现有密钥。",
58
+ "settings.autoPlay": "自动播报新回复",
59
+ "settings.autoPlayHint": "浏览器可能因为自动播放策略而拒绝;拒绝后可手动点击朗读。",
60
+ "settings.voice": "内置音色",
61
+ "settings.format": "音频格式",
62
+ "settings.instruction": "朗读风格指令",
63
+ "settings.save": "保存",
64
+ "settings.saving": "保存中…",
65
+ "settings.saved": "已保存",
66
+ "settings.failed": "保存失败,请重试。",
67
+ "settings.readOnly": "当前 DSH 设置为只读。",
68
+ "settings.secretPlaceholder": "输入新的 Xiaomi MiMo API Key",
69
+ "settings.expand": "展开设置",
70
+ "settings.collapse": "收起设置"
71
+ };
72
+ const en = {
73
+ "action.play": "Read aloud",
74
+ "action.pause": "Pause speech",
75
+ "action.resume": "Resume speech",
76
+ "action.loading": "Generating speech",
77
+ "action.retry": "Generate speech again",
78
+ "error.noText": "This response has no readable body text.",
79
+ "error.request": "Speech generation failed.",
80
+ "error.play": "The browser blocked autoplay. Click Read aloud to play it.",
81
+ "settings.title": "Xiaomi MiMo text to speech",
82
+ "settings.description": "Generate and play Xiaomi MiMo TTS audio from assistant message actions.",
83
+ "settings.apiKey": "API Key",
84
+ "settings.apiKeyHint": "Stored in DSH settings and redacted before settings are sent to the browser.",
85
+ "settings.apiKeyStatus": "An existing key changes only when you save a new value.",
86
+ "settings.autoPlay": "Automatically read new responses",
87
+ "settings.autoPlayHint": "The browser may reject autoplay; use the message action if it does.",
88
+ "settings.voice": "Built-in voice",
89
+ "settings.format": "Audio format",
90
+ "settings.instruction": "Reading style instruction",
91
+ "settings.save": "Save",
92
+ "settings.saving": "Saving…",
93
+ "settings.saved": "Saved",
94
+ "settings.failed": "Save failed. Try again.",
95
+ "settings.readOnly": "DSH settings are read-only.",
96
+ "settings.secretPlaceholder": "Enter a new Xiaomi MiMo API key",
97
+ "settings.expand": "Expand settings",
98
+ "settings.collapse": "Collapse settings"
99
+ };
100
+ function isRecord(value) {
101
+ return value !== null && typeof value === "object" && !Array.isArray(value);
102
+ }
103
+ function decodeSettings(value) {
104
+ if (!isRecord(value)) return void 0;
105
+ const decoded = {};
106
+ if (typeof value.apiKey === "string") decoded.apiKey = value.apiKey;
107
+ if (typeof value.baseURL === "string") decoded.baseURL = value.baseURL;
108
+ if (typeof value.model === "string") decoded.model = value.model;
109
+ if (typeof value.voice === "string") decoded.voice = value.voice;
110
+ if (value.format === "mp3" || value.format === "wav") decoded.format = value.format;
111
+ if (typeof value.autoPlay === "boolean") decoded.autoPlay = value.autoPlay;
112
+ if (typeof value.instruction === "string") decoded.instruction = value.instruction;
113
+ if (typeof value.maxTextLength === "number") decoded.maxTextLength = value.maxTextLength;
114
+ if (typeof value.requestTimeoutMs === "number") decoded.requestTimeoutMs = value.requestTimeoutMs;
115
+ return decoded;
116
+ }
117
+ function useSettingsSnapshot(scope) {
118
+ return (0, react.useSyncExternalStore)((listener) => scope.subscribe(listener), () => scope.getSnapshot(), () => scope.getSnapshot());
119
+ }
120
+ function formatStartupError(error) {
121
+ return error instanceof Error ? error.message : String(error);
122
+ }
123
+ function safeSlotInject(ctx, name, register) {
124
+ try {
125
+ ctx.slots.inject(name, () => {
126
+ try {
127
+ return register();
128
+ } catch (error) {
129
+ ctx.logger.error(`dsh-xiaomi-tts: ${name} contribution disabled: ${formatStartupError(error)}`);
130
+ return () => {};
131
+ }
132
+ });
133
+ } catch (error) {
134
+ ctx.logger.error(`dsh-xiaomi-tts: ${name} injection disabled: ${formatStartupError(error)}`);
135
+ }
136
+ }
137
+ function messageText(snapshot, messageId) {
138
+ for (const node of snapshot.nodes) {
139
+ if (node.kind !== "assistant" || node.messageId !== messageId) continue;
140
+ return (0, __deepseek_ai_dsh_client_ui_primitives.extractMarkdownPlainText)(node.blocks.filter((block) => block.kind === "text").map((block) => block.text).join("\n\n")).trim();
141
+ }
142
+ return "";
143
+ }
144
+ function messageTime(snapshot, messageId) {
145
+ for (const node of snapshot.nodes) if (node.kind === "assistant" && node.messageId === messageId) return node.time;
146
+ return null;
147
+ }
148
+ var PlaybackController = class {
149
+ autoPlayArmedAt = Date.now();
150
+ view = {
151
+ messageId: null,
152
+ status: "idle",
153
+ error: null
154
+ };
155
+ listeners = /* @__PURE__ */ new Set();
156
+ current = null;
157
+ request = null;
158
+ generation = 0;
159
+ get autoPlayArmed() {
160
+ return Date.now() - this.autoPlayArmedAt < 3e4;
161
+ }
162
+ getSnapshot = () => this.view;
163
+ subscribe = (listener) => {
164
+ this.listeners.add(listener);
165
+ return () => this.listeners.delete(listener);
166
+ };
167
+ async toggle(messageId, text, automatic) {
168
+ if (this.view.messageId === messageId && this.current !== null) {
169
+ if (this.current.audio.paused) try {
170
+ await this.current.audio.play();
171
+ this.publish({
172
+ messageId,
173
+ status: "playing",
174
+ error: null
175
+ });
176
+ } catch {
177
+ this.publish({
178
+ messageId,
179
+ status: "paused",
180
+ error: automatic ? "autoplay-blocked" : "play-failed"
181
+ });
182
+ }
183
+ else {
184
+ this.current.audio.pause();
185
+ this.publish({
186
+ messageId,
187
+ status: "paused",
188
+ error: null
189
+ });
190
+ }
191
+ return;
192
+ }
193
+ if (text.length === 0) {
194
+ this.publish({
195
+ messageId,
196
+ status: "error",
197
+ error: "no-text"
198
+ });
199
+ return;
200
+ }
201
+ this.stopCurrent();
202
+ const generation = ++this.generation;
203
+ const controller = new AbortController();
204
+ this.request = controller;
205
+ this.publish({
206
+ messageId,
207
+ status: "loading",
208
+ error: null
209
+ });
210
+ try {
211
+ const response = await fetch(TTS_ROUTE, {
212
+ method: "POST",
213
+ headers: { "content-type": "application/json" },
214
+ body: JSON.stringify({ text }),
215
+ signal: controller.signal
216
+ });
217
+ if (!response.ok) {
218
+ let message = `${response.status}`;
219
+ try {
220
+ const body = await response.json();
221
+ if (typeof body.message === "string") message = body.message;
222
+ else if (typeof body.error === "string") message = body.error;
223
+ } catch {}
224
+ throw new Error(message);
225
+ }
226
+ const blob = await response.blob();
227
+ if (generation !== this.generation) return;
228
+ const url = URL.createObjectURL(blob);
229
+ const audio = new Audio(url);
230
+ this.current = {
231
+ url,
232
+ audio
233
+ };
234
+ this.request = null;
235
+ audio.addEventListener("ended", () => {
236
+ if (this.current?.audio === audio) this.publish({
237
+ messageId,
238
+ status: "idle",
239
+ error: null
240
+ });
241
+ });
242
+ audio.addEventListener("error", () => {
243
+ if (this.current?.audio === audio) this.publish({
244
+ messageId,
245
+ status: "error",
246
+ error: "play-failed"
247
+ });
248
+ });
249
+ try {
250
+ await audio.play();
251
+ this.publish({
252
+ messageId,
253
+ status: "playing",
254
+ error: null
255
+ });
256
+ } catch {
257
+ this.publish({
258
+ messageId,
259
+ status: "paused",
260
+ error: automatic ? "autoplay-blocked" : "play-failed"
261
+ });
262
+ }
263
+ } catch (error) {
264
+ if (controller.signal.aborted || generation !== this.generation) return;
265
+ this.request = null;
266
+ this.publish({
267
+ messageId,
268
+ status: "error",
269
+ error: error instanceof Error ? error.message : String(error)
270
+ });
271
+ }
272
+ }
273
+ dispose() {
274
+ this.generation += 1;
275
+ this.stopCurrent();
276
+ this.listeners.clear();
277
+ }
278
+ stopCurrent() {
279
+ this.request?.abort();
280
+ this.request = null;
281
+ if (this.current !== null) {
282
+ this.current.audio.pause();
283
+ this.current.audio.removeAttribute("src");
284
+ URL.revokeObjectURL(this.current.url);
285
+ this.current = null;
286
+ }
287
+ }
288
+ publish(view) {
289
+ this.view = view;
290
+ for (const listener of this.listeners) listener();
291
+ }
292
+ };
293
+ function ReadAloudAction({ messageId, useSession, playback, settings, t }) {
294
+ const message = useSession((snapshot) => ({
295
+ text: messageText(snapshot, messageId),
296
+ time: messageTime(snapshot, messageId)
297
+ }));
298
+ const text = message.text;
299
+ const settingsSnapshot = useSettingsSnapshot(settings);
300
+ const view = (0, react.useSyncExternalStore)(playback.subscribe, playback.getSnapshot, playback.getSnapshot);
301
+ const autoPlayed = (0, react.useRef)(false);
302
+ (0, react.useEffect)(() => {
303
+ if (autoPlayed.current || settingsSnapshot.value?.autoPlay !== true || message.time === null || message.time < playback.autoPlayArmedAt) return;
304
+ autoPlayed.current = true;
305
+ const cancel = window.setTimeout(() => {
306
+ if (playback.autoPlayArmed) playback.toggle(messageId, text, true);
307
+ }, 0);
308
+ return () => window.clearTimeout(cancel);
309
+ }, [
310
+ message.time,
311
+ messageId,
312
+ playback,
313
+ settingsSnapshot.value?.autoPlay,
314
+ text
315
+ ]);
316
+ const mine = view.messageId === messageId;
317
+ const status = mine ? view.status : "idle";
318
+ const label = status === "loading" ? t("action.loading") : status === "playing" ? t("action.pause") : status === "paused" ? t("action.resume") : status === "error" ? t("action.retry") : t("action.play");
319
+ const error = mine ? view.error : null;
320
+ const errorText = error === null ? null : error === "no-text" ? t("error.noText") : error === "autoplay-blocked" || error === "play-failed" ? t("error.play") : t("error.request");
321
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__deepseek_ai_dsh_client_ui_primitives.Tooltip, {
322
+ label,
323
+ side: "bottom",
324
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
325
+ type: "button",
326
+ className: "xmimo-tts-action",
327
+ "aria-label": label,
328
+ "aria-pressed": status === "playing",
329
+ disabled: status === "loading",
330
+ onClick: () => {
331
+ playback.toggle(messageId, text, false);
332
+ },
333
+ children: status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__deepseek_ai_dsh_client_ui_primitives.IconLoadingOutline16, { className: "xmimo-tts-spin" }) : status === "playing" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__deepseek_ai_dsh_client_ui_primitives.IconPauseOutline16, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__deepseek_ai_dsh_client_ui_primitives.IconPlayOutline16, {})
334
+ })
335
+ }), errorText === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
336
+ className: "xmimo-tts-inline-error",
337
+ role: "status",
338
+ children: errorText
339
+ })] });
340
+ }
341
+ function SettingsCard({ scope, t }) {
342
+ const snapshot = useSettingsSnapshot(scope);
343
+ const value = snapshot.value;
344
+ const [apiKey, setApiKey] = (0, react.useState)("");
345
+ const [autoPlay, setAutoPlay] = (0, react.useState)(value?.autoPlay ?? false);
346
+ const [voice, setVoice] = (0, react.useState)(value?.voice ?? "冰糖");
347
+ const [format, setFormat] = (0, react.useState)(value?.format ?? "mp3");
348
+ const [instruction, setInstruction] = (0, react.useState)(value?.instruction ?? "");
349
+ const [state, setState] = (0, react.useState)("idle");
350
+ const [open, setOpen] = (0, react.useState)(false);
351
+ (0, react.useEffect)(() => {
352
+ if (value === void 0) return;
353
+ setAutoPlay(value.autoPlay ?? false);
354
+ setVoice(value.voice ?? "冰糖");
355
+ setFormat(value.format ?? "mp3");
356
+ setInstruction(value.instruction ?? "");
357
+ }, [value]);
358
+ if (snapshot.status === "unavailable") return null;
359
+ const save = async () => {
360
+ setState("saving");
361
+ try {
362
+ await scope.set("autoPlay", autoPlay);
363
+ await scope.set("voice", voice);
364
+ await scope.set("format", format);
365
+ await scope.set("instruction", instruction);
366
+ if (apiKey.trim().length > 0) await scope.set("apiKey", apiKey.trim());
367
+ setApiKey("");
368
+ setState("saved");
369
+ } catch {
370
+ setState("failed");
371
+ }
372
+ };
373
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
374
+ className: open ? "xmimo-tts-card xmimo-tts-card-open" : "xmimo-tts-card",
375
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
376
+ type: "button",
377
+ className: "xmimo-tts-card-header",
378
+ "aria-expanded": open,
379
+ "aria-label": `${t(open ? "settings.collapse" : "settings.expand")}: ${t("settings.title")}`,
380
+ onClick: () => {
381
+ setOpen((current) => !current);
382
+ },
383
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
384
+ className: "xmimo-tts-card-head-text",
385
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
386
+ className: "xmimo-tts-card-title",
387
+ children: t("settings.title")
388
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
389
+ className: "xmimo-tts-card-description",
390
+ children: t("settings.description")
391
+ })]
392
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: open ? "xmimo-tts-chevron xmimo-tts-chevron-open" : "xmimo-tts-chevron" })]
393
+ }), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
394
+ className: "xmimo-tts-card-body",
395
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
396
+ className: "xmimo-tts-grid",
397
+ children: [
398
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
399
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("settings.apiKey") }),
400
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
401
+ type: "password",
402
+ value: apiKey,
403
+ autoComplete: "off",
404
+ placeholder: t("settings.secretPlaceholder"),
405
+ disabled: !snapshot.writable,
406
+ onChange: (event) => {
407
+ setApiKey(event.target.value);
408
+ setState("idle");
409
+ }
410
+ }),
411
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("settings.apiKeyStatus") }),
412
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("settings.apiKeyHint") })
413
+ ] }),
414
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
415
+ className: "xmimo-tts-checkbox-row",
416
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
417
+ type: "checkbox",
418
+ checked: autoPlay,
419
+ disabled: !snapshot.writable,
420
+ onChange: (event) => {
421
+ setAutoPlay(event.target.checked);
422
+ setState("idle");
423
+ }
424
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("settings.autoPlay") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("settings.autoPlayHint") })] })]
425
+ }),
426
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("settings.voice") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
427
+ value: voice,
428
+ disabled: !snapshot.writable,
429
+ onChange: (event) => {
430
+ setVoice(event.target.value);
431
+ setState("idle");
432
+ },
433
+ children: [
434
+ "冰糖",
435
+ "茉莉",
436
+ "苏打",
437
+ "白桦",
438
+ "Mia",
439
+ "Chloe",
440
+ "Milo",
441
+ "Dean"
442
+ ].map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
443
+ value: item,
444
+ children: item
445
+ }, item))
446
+ })] }),
447
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("settings.format") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
448
+ value: format,
449
+ disabled: !snapshot.writable,
450
+ onChange: (event) => {
451
+ setFormat(event.target.value);
452
+ setState("idle");
453
+ },
454
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
455
+ value: "mp3",
456
+ children: "MP3"
457
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
458
+ value: "wav",
459
+ children: "WAV"
460
+ })]
461
+ })] }),
462
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
463
+ className: "xmimo-tts-wide",
464
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("settings.instruction") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
465
+ value: instruction,
466
+ rows: 3,
467
+ disabled: !snapshot.writable,
468
+ onChange: (event) => {
469
+ setInstruction(event.target.value);
470
+ setState("idle");
471
+ }
472
+ })]
473
+ })
474
+ ]
475
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
476
+ className: "xmimo-tts-card-actions",
477
+ children: [
478
+ !snapshot.writable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("settings.readOnly") }) : null,
479
+ state === "saved" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("settings.saved") }) : null,
480
+ state === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
481
+ className: "xmimo-tts-failed",
482
+ children: t("settings.failed")
483
+ }) : null,
484
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
485
+ type: "button",
486
+ disabled: !snapshot.writable || state === "saving",
487
+ onClick: () => {
488
+ save();
489
+ },
490
+ children: state === "saving" ? t("settings.saving") : t("settings.save")
491
+ })
492
+ ]
493
+ })]
494
+ }) : null]
495
+ });
496
+ }
497
+ function apply(ctx) {
498
+ const locale = ctx.locale;
499
+ const t = locale.bind(NS);
500
+ ctx.effect(() => locale.register(NS, {
501
+ zh,
502
+ en
503
+ }), "xiaomi-mimo-tts: dictionaries");
504
+ const scope = ctx.settingsScope.bind({
505
+ namespace: SETTINGS_NAMESPACE,
506
+ decode: decodeSettings
507
+ });
508
+ const playback = new PlaybackController();
509
+ ctx.effect(() => () => playback.dispose(), "xiaomi-mimo-tts: playback");
510
+ ctx.effect(() => {
511
+ const style = document.createElement("style");
512
+ style.dataset.plugin = NS;
513
+ style.textContent = `
514
+ .xmimo-tts-action{display:inline-flex;flex:0 0 28px;align-items:center;justify-content:center;width:28px;height:28px;box-sizing:border-box;padding:0;border:0;border-radius:6px;color:var(--dsw-alias-label-tertiary);background:transparent;cursor:pointer}
515
+ .xmimo-tts-action:hover,.xmimo-tts-action[aria-pressed=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-fill-l2)}
516
+ .xmimo-tts-action:disabled{cursor:wait;opacity:.65}.xmimo-tts-spin{animation:xmimo-spin 1s linear infinite}@keyframes xmimo-spin{to{transform:rotate(360deg)}}
517
+ .xmimo-tts-inline-error{max-width:220px;color:var(--dsw-alias-state-danger-primary);font-size:12px}
518
+ .xmimo-tts-card{list-style:none;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-l1);overflow:hidden}.xmimo-tts-card-header{display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border:0;color:inherit;text-align:left;background:transparent;font:inherit;cursor:pointer}.xmimo-tts-card-header:hover{background:var(--dsw-alias-interactive-bg-hover)}.xmimo-tts-card-head-text{display:flex;min-width:0;flex-direction:column;gap:4px}.xmimo-tts-card-title{font-size:15px;font-weight:600}.xmimo-tts-card-description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:18px}.xmimo-tts-chevron{flex:none;color:var(--dsw-alias-label-tertiary);transition:transform 160ms ease}.xmimo-tts-chevron-open{transform:rotate(180deg)}.xmimo-tts-card-body{padding:0 16px 16px}
519
+ .xmimo-tts-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:16px}.xmimo-tts-grid label{display:flex;min-width:0;flex-direction:column;gap:6px;font-size:13px}.xmimo-tts-grid input,.xmimo-tts-grid select,.xmimo-tts-grid textarea{box-sizing:border-box;width:100%;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:8px 10px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-l2);font:inherit}.xmimo-tts-grid small{color:var(--dsw-alias-label-tertiary)}
520
+ .xmimo-tts-wide{grid-column:1/-1}.xmimo-tts-checkbox-row{flex-direction:row!important;align-items:flex-start!important}.xmimo-tts-checkbox-row input{width:auto!important;margin-top:3px}.xmimo-tts-checkbox-row span{display:flex;flex-direction:column;gap:4px}
521
+ .xmimo-tts-card-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:16px;font-size:12px;color:var(--dsw-alias-label-tertiary)}.xmimo-tts-card-actions button{border:0;border-radius:8px;padding:8px 14px;color:var(--dsw-alias-label-on-color);background:var(--dsw-alias-state-business-primary);cursor:pointer}.xmimo-tts-card-actions button:disabled{cursor:not-allowed;opacity:.55}.xmimo-tts-failed{color:var(--dsw-alias-state-danger-primary)}
522
+ @media(max-width:720px){.xmimo-tts-grid{grid-template-columns:1fr}.xmimo-tts-wide{grid-column:auto}}
523
+ `;
524
+ document.head.appendChild(style);
525
+ return () => style.remove();
526
+ }, "xiaomi-mimo-tts: styles");
527
+ safeSlotInject(ctx, "conversation.chat.assistant-actions", () => ctx.slots.register({
528
+ name: "conversation.chat.assistant-actions",
529
+ id: "xiaomi-mimo-tts",
530
+ order: 20,
531
+ locale: NS,
532
+ inject: () => ({
533
+ playback,
534
+ settings: scope,
535
+ t
536
+ })
537
+ }, ReadAloudAction));
538
+ safeSlotInject(ctx, "settings.plugin.item", () => ctx.slots.register({
539
+ name: "settings.plugin.item",
540
+ key: SETTINGS_NAMESPACE,
541
+ locale: NS,
542
+ inject: () => ({
543
+ scope,
544
+ t
545
+ })
546
+ }, SettingsCard));
547
+ }
548
+
549
+ //#endregion
550
+ exports.apply = apply;
551
+ exports.inject = inject;
552
+ return module.exports; } });
553
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","names":["en: Record<keyof typeof zh, string>","decoded: TtsSettings","Tooltip","IconLoadingOutline16","IconPauseOutline16","IconPlayOutline16","IconChevronDownOutline14"],"sources":["../src/client/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\nimport { useEffect, useRef, useState, useSyncExternalStore } from 'react'\nimport {\n IconLoadingOutline16,\n IconPauseOutline16,\n IconPlayOutline16,\n IconChevronDownOutline14,\n Tooltip,\n extractMarkdownPlainText,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { ClientContext, ConversationSnapshot, SettingsScope } from '@deepseek-ai/dsh-client-runtime/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings-plugins/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\n\nexport const inject = [\n 'slots',\n 'locale',\n 'connection',\n 'remote',\n 'settingsScope',\n]\n\nconst NS = 'xiaomi-mimo-tts'\nconst SETTINGS_NAMESPACE = 'xiaomi-mimo-tts'\nconst TTS_ROUTE = '/plugins/xiaomi-mimo-tts/synthesize'\n\ninterface TtsSettings {\n apiKey?: string\n baseURL?: string\n model?: string\n voice?: string\n format?: 'mp3' | 'wav'\n autoPlay?: boolean\n instruction?: string\n maxTextLength?: number\n requestTimeoutMs?: number\n}\n\ntype PlaybackStatus = 'idle' | 'loading' | 'playing' | 'paused' | 'error'\n\ninterface PlaybackView {\n messageId: string | null\n status: PlaybackStatus\n error: string | null\n}\n\ninterface SynthesizedAudio {\n url: string\n audio: HTMLAudioElement\n}\n\nconst zh = {\n 'action.play': '朗读回复',\n 'action.pause': '暂停朗读',\n 'action.resume': '继续朗读',\n 'action.loading': '正在生成语音',\n 'action.retry': '重新生成语音',\n 'error.noText': '这条回复没有可朗读的正文。',\n 'error.request': '语音生成失败。',\n 'error.play': '浏览器阻止了自动播放,请点击朗读按钮。',\n 'settings.title': 'Xiaomi MiMo 语音朗读',\n 'settings.description': '在助手回复操作栏中使用 Xiaomi MiMo TTS 生成并播放语音。',\n 'settings.apiKey': 'API Key',\n 'settings.apiKeyHint': '密钥保存在 DSH 设置文件中,传到浏览器前会被脱敏。',\n 'settings.apiKeyStatus': '只有输入新值并保存时才会替换现有密钥。',\n 'settings.autoPlay': '自动播报新回复',\n 'settings.autoPlayHint': '浏览器可能因为自动播放策略而拒绝;拒绝后可手动点击朗读。',\n 'settings.voice': '内置音色',\n 'settings.format': '音频格式',\n 'settings.instruction': '朗读风格指令',\n 'settings.save': '保存',\n 'settings.saving': '保存中…',\n 'settings.saved': '已保存',\n 'settings.failed': '保存失败,请重试。',\n 'settings.readOnly': '当前 DSH 设置为只读。',\n 'settings.secretPlaceholder': '输入新的 Xiaomi MiMo API Key',\n 'settings.expand': '展开设置',\n 'settings.collapse': '收起设置',\n} as const\n\nconst en: Record<keyof typeof zh, string> = {\n 'action.play': 'Read aloud',\n 'action.pause': 'Pause speech',\n 'action.resume': 'Resume speech',\n 'action.loading': 'Generating speech',\n 'action.retry': 'Generate speech again',\n 'error.noText': 'This response has no readable body text.',\n 'error.request': 'Speech generation failed.',\n 'error.play': 'The browser blocked autoplay. Click Read aloud to play it.',\n 'settings.title': 'Xiaomi MiMo text to speech',\n 'settings.description': 'Generate and play Xiaomi MiMo TTS audio from assistant message actions.',\n 'settings.apiKey': 'API Key',\n 'settings.apiKeyHint': 'Stored in DSH settings and redacted before settings are sent to the browser.',\n 'settings.apiKeyStatus': 'An existing key changes only when you save a new value.',\n 'settings.autoPlay': 'Automatically read new responses',\n 'settings.autoPlayHint': 'The browser may reject autoplay; use the message action if it does.',\n 'settings.voice': 'Built-in voice',\n 'settings.format': 'Audio format',\n 'settings.instruction': 'Reading style instruction',\n 'settings.save': 'Save',\n 'settings.saving': 'Saving…',\n 'settings.saved': 'Saved',\n 'settings.failed': 'Save failed. Try again.',\n 'settings.readOnly': 'DSH settings are read-only.',\n 'settings.secretPlaceholder': 'Enter a new Xiaomi MiMo API key',\n 'settings.expand': 'Expand settings',\n 'settings.collapse': 'Collapse settings',\n}\n\ntype LocaleKey = keyof typeof zh\n\ntype Translate = (key: LocaleKey) => string\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n 'xiaomi-mimo-tts': LocaleKey\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\nfunction decodeSettings(value: unknown): TtsSettings | undefined {\n if (!isRecord(value)) return undefined\n const decoded: TtsSettings = {}\n if (typeof value.apiKey === 'string') decoded.apiKey = value.apiKey\n if (typeof value.baseURL === 'string') decoded.baseURL = value.baseURL\n if (typeof value.model === 'string') decoded.model = value.model\n if (typeof value.voice === 'string') decoded.voice = value.voice\n if (value.format === 'mp3' || value.format === 'wav') decoded.format = value.format\n if (typeof value.autoPlay === 'boolean') decoded.autoPlay = value.autoPlay\n if (typeof value.instruction === 'string') decoded.instruction = value.instruction\n if (typeof value.maxTextLength === 'number') decoded.maxTextLength = value.maxTextLength\n if (typeof value.requestTimeoutMs === 'number') decoded.requestTimeoutMs = value.requestTimeoutMs\n return decoded\n}\n\nfunction useSettingsSnapshot<T>(scope: SettingsScope<T>) {\n return useSyncExternalStore(\n (listener) => scope.subscribe(listener),\n () => scope.getSnapshot(),\n () => scope.getSnapshot(),\n )\n}\n\nfunction formatStartupError(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n\nfunction safeSlotInject(\n ctx: ClientContext,\n name: 'conversation.chat.assistant-actions' | 'settings.plugin.item',\n register: () => (() => void) | Iterable<() => void>,\n): void {\n try {\n ctx.slots.inject(name, () => {\n try {\n return register()\n } catch (error) {\n ctx.logger.error(`dsh-xiaomi-tts: ${name} contribution disabled: ${formatStartupError(error)}`)\n return () => {}\n }\n })\n } catch (error) {\n ctx.logger.error(`dsh-xiaomi-tts: ${name} injection disabled: ${formatStartupError(error)}`)\n }\n}\n\nfunction messageText(snapshot: ConversationSnapshot, messageId: string): string {\n for (const node of snapshot.nodes) {\n if (node.kind !== 'assistant' || node.messageId !== messageId) continue\n const markdown = node.blocks\n .filter((block) => block.kind === 'text')\n .map((block) => block.text)\n .join('\\n\\n')\n return extractMarkdownPlainText(markdown).trim()\n }\n return ''\n}\n\nfunction messageTime(snapshot: ConversationSnapshot, messageId: string): number | null {\n for (const node of snapshot.nodes) {\n if (node.kind === 'assistant' && node.messageId === messageId) return node.time\n }\n return null\n}\n\nclass PlaybackController {\n readonly autoPlayArmedAt = Date.now()\n private view: PlaybackView = { messageId: null, status: 'idle', error: null }\n private readonly listeners = new Set<() => void>()\n private current: SynthesizedAudio | null = null\n private request: AbortController | null = null\n private generation = 0\n\n get autoPlayArmed(): boolean {\n return Date.now() - this.autoPlayArmedAt < 30000\n }\n\n getSnapshot = (): PlaybackView => this.view\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener)\n return () => this.listeners.delete(listener)\n }\n\n async toggle(messageId: string, text: string, automatic: boolean): Promise<void> {\n if (this.view.messageId === messageId && this.current !== null) {\n if (this.current.audio.paused) {\n try {\n await this.current.audio.play()\n this.publish({ messageId, status: 'playing', error: null })\n } catch {\n this.publish({ messageId, status: 'paused', error: automatic ? 'autoplay-blocked' : 'play-failed' })\n }\n } else {\n this.current.audio.pause()\n this.publish({ messageId, status: 'paused', error: null })\n }\n return\n }\n\n if (text.length === 0) {\n this.publish({ messageId, status: 'error', error: 'no-text' })\n return\n }\n\n this.stopCurrent()\n const generation = ++this.generation\n const controller = new AbortController()\n this.request = controller\n this.publish({ messageId, status: 'loading', error: null })\n\n try {\n const response = await fetch(TTS_ROUTE, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ text }),\n signal: controller.signal,\n })\n if (!response.ok) {\n let message = `${response.status}`\n try {\n const body = await response.json() as { message?: unknown; error?: unknown }\n if (typeof body.message === 'string') message = body.message\n else if (typeof body.error === 'string') message = body.error\n } catch {}\n throw new Error(message)\n }\n\n const blob = await response.blob()\n if (generation !== this.generation) return\n const url = URL.createObjectURL(blob)\n const audio = new Audio(url)\n this.current = { url, audio }\n this.request = null\n audio.addEventListener('ended', () => {\n if (this.current?.audio === audio) this.publish({ messageId, status: 'idle', error: null })\n })\n audio.addEventListener('error', () => {\n if (this.current?.audio === audio) this.publish({ messageId, status: 'error', error: 'play-failed' })\n })\n\n try {\n await audio.play()\n this.publish({ messageId, status: 'playing', error: null })\n } catch {\n this.publish({ messageId, status: 'paused', error: automatic ? 'autoplay-blocked' : 'play-failed' })\n }\n } catch (error) {\n if (controller.signal.aborted || generation !== this.generation) return\n this.request = null\n this.publish({\n messageId,\n status: 'error',\n error: error instanceof Error ? error.message : String(error),\n })\n }\n }\n\n dispose(): void {\n this.generation += 1\n this.stopCurrent()\n this.listeners.clear()\n }\n\n private stopCurrent(): void {\n this.request?.abort()\n this.request = null\n if (this.current !== null) {\n this.current.audio.pause()\n this.current.audio.removeAttribute('src')\n URL.revokeObjectURL(this.current.url)\n this.current = null\n }\n }\n\n private publish(view: PlaybackView): void {\n this.view = view\n for (const listener of this.listeners) listener()\n }\n}\n\ninterface ReadAloudActionProps {\n messageId: string\n useSession: <T>(selector: (snapshot: ConversationSnapshot) => T) => T\n playback: PlaybackController\n settings: SettingsScope<TtsSettings>\n t: Translate\n}\n\nfunction ReadAloudAction({ messageId, useSession, playback, settings, t }: ReadAloudActionProps): ReactElement {\n const message = useSession((snapshot) => ({\n text: messageText(snapshot, messageId),\n time: messageTime(snapshot, messageId),\n }))\n const text = message.text\n const settingsSnapshot = useSettingsSnapshot(settings)\n const view = useSyncExternalStore(playback.subscribe, playback.getSnapshot, playback.getSnapshot)\n const autoPlayed = useRef(false)\n\n useEffect(() => {\n if (autoPlayed.current || settingsSnapshot.value?.autoPlay !== true || message.time === null || message.time < playback.autoPlayArmedAt) return\n autoPlayed.current = true\n const cancel = window.setTimeout(() => {\n if (playback.autoPlayArmed) void playback.toggle(messageId, text, true)\n }, 0)\n return () => window.clearTimeout(cancel)\n }, [message.time, messageId, playback, settingsSnapshot.value?.autoPlay, text])\n const mine = view.messageId === messageId\n const status = mine ? view.status : 'idle'\n const label = status === 'loading'\n ? t('action.loading')\n : status === 'playing'\n ? t('action.pause')\n : status === 'paused'\n ? t('action.resume')\n : status === 'error'\n ? t('action.retry')\n : t('action.play')\n const error = mine ? view.error : null\n const errorText = error === null\n ? null\n : error === 'no-text'\n ? t('error.noText')\n : error === 'autoplay-blocked' || error === 'play-failed'\n ? t('error.play')\n : t('error.request')\n\n return (\n <>\n <Tooltip label={label} side=\"bottom\">\n <button\n type=\"button\"\n className=\"xmimo-tts-action\"\n aria-label={label}\n aria-pressed={status === 'playing'}\n disabled={status === 'loading'}\n onClick={() => { void playback.toggle(messageId, text, false) }}\n >\n {status === 'loading'\n ? <IconLoadingOutline16 className=\"xmimo-tts-spin\" />\n : status === 'playing'\n ? <IconPauseOutline16 />\n : <IconPlayOutline16 />}\n </button>\n </Tooltip>\n {errorText === null ? null : <span className=\"xmimo-tts-inline-error\" role=\"status\">{errorText}</span>}\n </>\n )\n}\n\ninterface SettingsCardProps {\n scope: SettingsScope<TtsSettings>\n t: Translate\n}\n\nfunction SettingsCard({ scope, t }: SettingsCardProps): ReactElement | null {\n const snapshot = useSettingsSnapshot(scope)\n const value = snapshot.value\n const [apiKey, setApiKey] = useState('')\n const [autoPlay, setAutoPlay] = useState(value?.autoPlay ?? false)\n const [voice, setVoice] = useState(value?.voice ?? '冰糖')\n const [format, setFormat] = useState<'mp3' | 'wav'>(value?.format ?? 'mp3')\n const [instruction, setInstruction] = useState(value?.instruction ?? '')\n const [state, setState] = useState<'idle' | 'saving' | 'saved' | 'failed'>('idle')\n const [open, setOpen] = useState(false)\n\n useEffect(() => {\n if (value === undefined) return\n setAutoPlay(value.autoPlay ?? false)\n setVoice(value.voice ?? '冰糖')\n setFormat(value.format ?? 'mp3')\n setInstruction(value.instruction ?? '')\n }, [value])\n\n if (snapshot.status === 'unavailable') return null\n\n const save = async (): Promise<void> => {\n setState('saving')\n try {\n await scope.set('autoPlay', autoPlay)\n await scope.set('voice', voice)\n await scope.set('format', format)\n await scope.set('instruction', instruction)\n if (apiKey.trim().length > 0) await scope.set('apiKey', apiKey.trim())\n setApiKey('')\n setState('saved')\n } catch {\n setState('failed')\n }\n }\n\n return (\n <li className={open ? 'xmimo-tts-card xmimo-tts-card-open' : 'xmimo-tts-card'}>\n <button\n type=\"button\"\n className=\"xmimo-tts-card-header\"\n aria-expanded={open}\n aria-label={`${t(open ? 'settings.collapse' : 'settings.expand')}: ${t('settings.title')}`}\n onClick={() => { setOpen((current) => !current) }}\n >\n <span className=\"xmimo-tts-card-head-text\">\n <span className=\"xmimo-tts-card-title\">{t('settings.title')}</span>\n <span className=\"xmimo-tts-card-description\">{t('settings.description')}</span>\n </span>\n <IconChevronDownOutline14 className={open ? 'xmimo-tts-chevron xmimo-tts-chevron-open' : 'xmimo-tts-chevron'} />\n </button>\n {open ? <div className=\"xmimo-tts-card-body\">\n <div className=\"xmimo-tts-grid\">\n <label>\n <span>{t('settings.apiKey')}</span>\n <input\n type=\"password\"\n value={apiKey}\n autoComplete=\"off\"\n placeholder={t('settings.secretPlaceholder')}\n disabled={!snapshot.writable}\n onChange={(event) => { setApiKey(event.target.value); setState('idle') }}\n />\n <small>{t('settings.apiKeyStatus')}</small>\n <small>{t('settings.apiKeyHint')}</small>\n </label>\n <label className=\"xmimo-tts-checkbox-row\">\n <input\n type=\"checkbox\"\n checked={autoPlay}\n disabled={!snapshot.writable}\n onChange={(event) => { setAutoPlay(event.target.checked); setState('idle') }}\n />\n <span>\n <strong>{t('settings.autoPlay')}</strong>\n <small>{t('settings.autoPlayHint')}</small>\n </span>\n </label>\n <label>\n <span>{t('settings.voice')}</span>\n <select value={voice} disabled={!snapshot.writable} onChange={(event) => { setVoice(event.target.value); setState('idle') }}>\n {['冰糖', '茉莉', '苏打', '白桦', 'Mia', 'Chloe', 'Milo', 'Dean'].map((item) => <option key={item} value={item}>{item}</option>)}\n </select>\n </label>\n <label>\n <span>{t('settings.format')}</span>\n <select value={format} disabled={!snapshot.writable} onChange={(event) => { setFormat(event.target.value as 'mp3' | 'wav'); setState('idle') }}>\n <option value=\"mp3\">MP3</option>\n <option value=\"wav\">WAV</option>\n </select>\n </label>\n <label className=\"xmimo-tts-wide\">\n <span>{t('settings.instruction')}</span>\n <textarea value={instruction} rows={3} disabled={!snapshot.writable} onChange={(event) => { setInstruction(event.target.value); setState('idle') }} />\n </label>\n </div>\n <div className=\"xmimo-tts-card-actions\">\n {!snapshot.writable ? <span>{t('settings.readOnly')}</span> : null}\n {state === 'saved' ? <span>{t('settings.saved')}</span> : null}\n {state === 'failed' ? <span className=\"xmimo-tts-failed\">{t('settings.failed')}</span> : null}\n <button type=\"button\" disabled={!snapshot.writable || state === 'saving'} onClick={() => { void save() }}>\n {state === 'saving' ? t('settings.saving') : t('settings.save')}\n </button>\n </div>\n </div> : null}\n </li>\n )\n}\n\nexport function apply(ctx: ClientContext): void {\n const locale = ctx.locale as unknown as {\n bind(namespace: string): Translate\n register(namespace: string, dictionaries: { zh: typeof zh; en: typeof en }): () => void\n }\n const t = locale.bind(NS)\n ctx.effect(() => locale.register(NS, { zh, en }), 'xiaomi-mimo-tts: dictionaries')\n\n const scope = ctx.settingsScope.bind<TtsSettings>({\n namespace: SETTINGS_NAMESPACE,\n decode: decodeSettings,\n })\n const playback = new PlaybackController()\n\n ctx.effect(() => () => playback.dispose(), 'xiaomi-mimo-tts: playback')\n\n ctx.effect(() => {\n const style = document.createElement('style')\n style.dataset.plugin = NS\n style.textContent = `\n .xmimo-tts-action{display:inline-flex;flex:0 0 28px;align-items:center;justify-content:center;width:28px;height:28px;box-sizing:border-box;padding:0;border:0;border-radius:6px;color:var(--dsw-alias-label-tertiary);background:transparent;cursor:pointer}\n .xmimo-tts-action:hover,.xmimo-tts-action[aria-pressed=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-fill-l2)}\n .xmimo-tts-action:disabled{cursor:wait;opacity:.65}.xmimo-tts-spin{animation:xmimo-spin 1s linear infinite}@keyframes xmimo-spin{to{transform:rotate(360deg)}}\n .xmimo-tts-inline-error{max-width:220px;color:var(--dsw-alias-state-danger-primary);font-size:12px}\n .xmimo-tts-card{list-style:none;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-l1);overflow:hidden}.xmimo-tts-card-header{display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border:0;color:inherit;text-align:left;background:transparent;font:inherit;cursor:pointer}.xmimo-tts-card-header:hover{background:var(--dsw-alias-interactive-bg-hover)}.xmimo-tts-card-head-text{display:flex;min-width:0;flex-direction:column;gap:4px}.xmimo-tts-card-title{font-size:15px;font-weight:600}.xmimo-tts-card-description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:18px}.xmimo-tts-chevron{flex:none;color:var(--dsw-alias-label-tertiary);transition:transform 160ms ease}.xmimo-tts-chevron-open{transform:rotate(180deg)}.xmimo-tts-card-body{padding:0 16px 16px}\n .xmimo-tts-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:16px}.xmimo-tts-grid label{display:flex;min-width:0;flex-direction:column;gap:6px;font-size:13px}.xmimo-tts-grid input,.xmimo-tts-grid select,.xmimo-tts-grid textarea{box-sizing:border-box;width:100%;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:8px 10px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-l2);font:inherit}.xmimo-tts-grid small{color:var(--dsw-alias-label-tertiary)}\n .xmimo-tts-wide{grid-column:1/-1}.xmimo-tts-checkbox-row{flex-direction:row!important;align-items:flex-start!important}.xmimo-tts-checkbox-row input{width:auto!important;margin-top:3px}.xmimo-tts-checkbox-row span{display:flex;flex-direction:column;gap:4px}\n .xmimo-tts-card-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:16px;font-size:12px;color:var(--dsw-alias-label-tertiary)}.xmimo-tts-card-actions button{border:0;border-radius:8px;padding:8px 14px;color:var(--dsw-alias-label-on-color);background:var(--dsw-alias-state-business-primary);cursor:pointer}.xmimo-tts-card-actions button:disabled{cursor:not-allowed;opacity:.55}.xmimo-tts-failed{color:var(--dsw-alias-state-danger-primary)}\n @media(max-width:720px){.xmimo-tts-grid{grid-template-columns:1fr}.xmimo-tts-wide{grid-column:auto}}\n `\n document.head.appendChild(style)\n return () => style.remove()\n }, 'xiaomi-mimo-tts: styles')\n\n safeSlotInject(ctx, 'conversation.chat.assistant-actions', () => ctx.slots.register({\n name: 'conversation.chat.assistant-actions',\n id: 'xiaomi-mimo-tts',\n order: 20,\n locale: NS,\n inject: () => ({ playback, settings: scope, t }),\n }, ReadAloudAction))\n\n safeSlotInject(ctx, 'settings.plugin.item', () => ctx.slots.register({\n name: 'settings.plugin.item',\n key: SETTINGS_NAMESPACE,\n locale: NS,\n inject: () => ({ scope, t }),\n }, SettingsCard))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS;CACpB;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,KAAK;AACX,MAAM,qBAAqB;AAC3B,MAAM,YAAY;AA2BlB,MAAM,KAAK;CACT,eAAe;CACf,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,gBAAgB;CAChB,iBAAiB;CACjB,cAAc;CACd,kBAAkB;CAClB,wBAAwB;CACxB,mBAAmB;CACnB,uBAAuB;CACvB,yBAAyB;CACzB,qBAAqB;CACrB,yBAAyB;CACzB,kBAAkB;CAClB,mBAAmB;CACnB,wBAAwB;CACxB,iBAAiB;CACjB,mBAAmB;CACnB,kBAAkB;CAClB,mBAAmB;CACnB,qBAAqB;CACrB,8BAA8B;CAC9B,mBAAmB;CACnB,qBAAqB;CACtB;AAED,MAAMA,KAAsC;CAC1C,eAAe;CACf,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,gBAAgB;CAChB,iBAAiB;CAC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B,CAAC;AAEpB,gBAAe,KAAK,8BAA8B,IAAI,MAAM,SAAS;EACnE,MAAM;EACN,KAAK;EACL,QAAQ;EACR,eAAe;GAAE;GAAO;GAAG;EAC5B,EAAE,aAAa,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import z from '@deepseek-ai/schemastery';
3
+ export declare const name = "xiaomi-mimo-tts";
4
+ export declare const inject: string[];
5
+ export declare const XIAOMI_MIMO_TTS_SETTINGS_NAMESPACE: import("@deepseek-ai/dsh-settings").SettingsNamespace;
6
+ export declare const TTS_ROUTE = "/plugins/xiaomi-mimo-tts/synthesize";
7
+ export declare const Config: z<Schemastery.ObjectS<{
8
+ apiKey: z<string, string>;
9
+ baseURL: z<string, string>;
10
+ model: z<string, string>;
11
+ voice: z<string, string>;
12
+ format: z<"mp3" | "wav", "mp3" | "wav">;
13
+ autoPlay: z<boolean, boolean>;
14
+ instruction: z<string, string>;
15
+ maxTextLength: z<number, number>;
16
+ requestTimeoutMs: z<number, number>;
17
+ }>, Schemastery.ObjectT<{
18
+ apiKey: z<string, string>;
19
+ baseURL: z<string, string>;
20
+ model: z<string, string>;
21
+ voice: z<string, string>;
22
+ format: z<"mp3" | "wav", "mp3" | "wav">;
23
+ autoPlay: z<boolean, boolean>;
24
+ instruction: z<string, string>;
25
+ maxTextLength: z<number, number>;
26
+ requestTimeoutMs: z<number, number>;
27
+ }>>;
28
+ export type Config = ReturnType<typeof Config>;
29
+ export declare function apply(ctx: Context, config: Config): void;
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAGxC,eAAO,MAAM,IAAI,oBAAoB,CAAA;AACrC,eAAO,MAAM,MAAM,UAAgB,CAAA;AAEnC,eAAO,MAAM,kCAAkC,uDAAuC,CAAA;AACtF,eAAO,MAAM,SAAS,wCAAwC,CAAA;AAE9D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;GAUjB,CAAA;AAEF,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAA;AAuD9C,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAyJxD"}