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.
Files changed (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +197 -2
  3. package/README.zh.md +166 -0
  4. package/cordis.patch.yml +20 -0
  5. package/icon.svg +6 -0
  6. package/lib/client.js +3607 -0
  7. package/lib/client.js.map +1 -0
  8. package/lib/node/brief.d.ts +23 -0
  9. package/lib/node/brief.js +110 -0
  10. package/lib/node/brief.js.map +1 -0
  11. package/lib/node/client/BundleConfigCard.d.ts +15 -0
  12. package/lib/node/client/BundleConfigCard.js +22 -0
  13. package/lib/node/client/BundleConfigCard.js.map +1 -0
  14. package/lib/node/client/PlayerBar.d.ts +45 -0
  15. package/lib/node/client/PlayerBar.js +83 -0
  16. package/lib/node/client/PlayerBar.js.map +1 -0
  17. package/lib/node/client/SettingsSectionCard.d.ts +14 -0
  18. package/lib/node/client/SettingsSectionCard.js +19 -0
  19. package/lib/node/client/SettingsSectionCard.js.map +1 -0
  20. package/lib/node/client/SpeakAction.d.ts +32 -0
  21. package/lib/node/client/SpeakAction.js +651 -0
  22. package/lib/node/client/SpeakAction.js.map +1 -0
  23. package/lib/node/client/SpeakerIcon.d.ts +11 -0
  24. package/lib/node/client/SpeakerIcon.js +5 -0
  25. package/lib/node/client/SpeakerIcon.js.map +1 -0
  26. package/lib/node/client/TtsSettingsForm.d.ts +27 -0
  27. package/lib/node/client/TtsSettingsForm.js +164 -0
  28. package/lib/node/client/TtsSettingsForm.js.map +1 -0
  29. package/lib/node/client/api.d.ts +89 -0
  30. package/lib/node/client/api.js +247 -0
  31. package/lib/node/client/api.js.map +1 -0
  32. package/lib/node/client/audio-bus.d.ts +29 -0
  33. package/lib/node/client/audio-bus.js +91 -0
  34. package/lib/node/client/audio-bus.js.map +1 -0
  35. package/lib/node/client/chat-text.d.ts +32 -0
  36. package/lib/node/client/chat-text.js +90 -0
  37. package/lib/node/client/chat-text.js.map +1 -0
  38. package/lib/node/client/highlight.d.ts +45 -0
  39. package/lib/node/client/highlight.js +198 -0
  40. package/lib/node/client/highlight.js.map +1 -0
  41. package/lib/node/client/index.d.ts +26 -0
  42. package/lib/node/client/index.js +89 -0
  43. package/lib/node/client/index.js.map +1 -0
  44. package/lib/node/client/locales.d.ts +19 -0
  45. package/lib/node/client/locales.js +180 -0
  46. package/lib/node/client/locales.js.map +1 -0
  47. package/lib/node/client/panel-visibility.d.ts +24 -0
  48. package/lib/node/client/panel-visibility.js +16 -0
  49. package/lib/node/client/panel-visibility.js.map +1 -0
  50. package/lib/node/client/settings-controller.d.ts +116 -0
  51. package/lib/node/client/settings-controller.js +201 -0
  52. package/lib/node/client/settings-controller.js.map +1 -0
  53. package/lib/node/client/settings-registration.d.ts +24 -0
  54. package/lib/node/client/settings-registration.js +21 -0
  55. package/lib/node/client/settings-registration.js.map +1 -0
  56. package/lib/node/client/slots.d.ts +48 -0
  57. package/lib/node/client/slots.js +15 -0
  58. package/lib/node/client/slots.js.map +1 -0
  59. package/lib/node/client/speech-cache.d.ts +59 -0
  60. package/lib/node/client/speech-cache.js +68 -0
  61. package/lib/node/client/speech-cache.js.map +1 -0
  62. package/lib/node/client/split-speech.d.ts +20 -0
  63. package/lib/node/client/split-speech.js +100 -0
  64. package/lib/node/client/split-speech.js.map +1 -0
  65. package/lib/node/client/status.d.ts +28 -0
  66. package/lib/node/client/status.js +60 -0
  67. package/lib/node/client/status.js.map +1 -0
  68. package/lib/node/client/stream-dispose.d.ts +119 -0
  69. package/lib/node/client/stream-dispose.js +249 -0
  70. package/lib/node/client/stream-dispose.js.map +1 -0
  71. package/lib/node/client/styles.d.ts +19 -0
  72. package/lib/node/client/styles.js +176 -0
  73. package/lib/node/client/styles.js.map +1 -0
  74. package/lib/node/client/use-audio-player.d.ts +44 -0
  75. package/lib/node/client/use-audio-player.js +102 -0
  76. package/lib/node/client/use-audio-player.js.map +1 -0
  77. package/lib/node/client/use-audio-queue.d.ts +44 -0
  78. package/lib/node/client/use-audio-queue.js +151 -0
  79. package/lib/node/client/use-audio-queue.js.map +1 -0
  80. package/lib/node/client/use-stream-player.d.ts +41 -0
  81. package/lib/node/client/use-stream-player.js +60 -0
  82. package/lib/node/client/use-stream-player.js.map +1 -0
  83. package/lib/node/edge-tts.d.ts +21 -0
  84. package/lib/node/edge-tts.js +111 -0
  85. package/lib/node/edge-tts.js.map +1 -0
  86. package/lib/node/index.d.ts +97 -0
  87. package/lib/node/index.js +463 -0
  88. package/lib/node/index.js.map +1 -0
  89. package/lib/node/normalize.d.ts +30 -0
  90. package/lib/node/normalize.js +72 -0
  91. package/lib/node/normalize.js.map +1 -0
  92. package/lib/node/settings.d.ts +186 -0
  93. package/lib/node/settings.js +74 -0
  94. package/lib/node/settings.js.map +1 -0
  95. package/lib/node/summarize.d.ts +29 -0
  96. package/lib/node/summarize.js +131 -0
  97. package/lib/node/summarize.js.map +1 -0
  98. package/lib/node/tool.d.ts +54 -0
  99. package/lib/node/tool.js +123 -0
  100. package/lib/node/tool.js.map +1 -0
  101. package/lib/node/tts.d.ts +127 -0
  102. package/lib/node/tts.js +361 -0
  103. package/lib/node/tts.js.map +1 -0
  104. package/lib/node/wav.d.ts +32 -0
  105. package/lib/node/wav.js +63 -0
  106. package/lib/node/wav.js.map +1 -0
  107. package/locale/en.json +6 -0
  108. package/locale/zh.json +6 -0
  109. package/package.json +122 -4
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Settings and route vocabulary shared by the Host and browser halves.
3
+ *
4
+ * Both bundles inline this file, so it must stay pure: constants and types
5
+ * only, no Node or DOM APIs. The namespace is the profile entry id the bundle
6
+ * patch inserts (`cordis.patch.yml`), and the route paths are the seam the two
7
+ * halves meet on.
8
+ * @module dsh-mimo-speak/settings
9
+ */
10
+ /** Settings namespace: the profile entry id of this plugin's loader row. */
11
+ export declare const MIMOSPEAK_NAMESPACE = "mimo-speak";
12
+ /**
13
+ * Key this plugin's configuration card registers under on the Plugins page's
14
+ * `plugins.bundle.config` keyed slot: the bundle's npm package name, which is
15
+ * the keying convention the Plugins page fixes for bundle-owned configuration
16
+ * (the page dispatches with `entryKey: pkg.name`).
17
+ */
18
+ export declare const MIMOSPEAK_PACKAGE_KEY = "dsh-mimo-speak";
19
+ /** Route prefix owned by this plugin on `ctx.webServer`. */
20
+ export declare const MIMOSPEAK_API_PREFIX = "/api/mimo-speak";
21
+ /** `GET` route reporting the resolved engine configuration without secrets. */
22
+ export declare const MIMOSPEAK_STATUS_PATH = "/api/mimo-speak/status";
23
+ /** `POST` route synthesizing one text into WAV audio. */
24
+ export declare const MIMOSPEAK_SYNTHESIZE_PATH = "/api/mimo-speak/synthesize";
25
+ /** `POST` route streaming one text as raw PCM chunks (SSE). */
26
+ export declare const MIMOSPEAK_SYNTHESIZE_STREAM_PATH = "/api/mimo-speak/synthesize-stream";
27
+ /** `POST` route running a short round-trip health check against the engine. */
28
+ export declare const MIMOSPEAK_TEST_PATH = "/api/mimo-speak/test";
29
+ /** POST text → a short spoken summary (used by the brief read scope). */
30
+ export declare const MIMOSPEAK_SUMMARY_PATH = "/api/mimo-speak/summary";
31
+ /** MiMo platform endpoint base; `/chat/completions` is appended. */
32
+ export declare const DEFAULT_BASE_URL = "https://api.xiaomimimo.com/v1";
33
+ /** MiMo TTS model id. */
34
+ export declare const DEFAULT_MODEL = "mimo-v2.5-tts";
35
+ /**
36
+ * MiMo model that clones a voice from a reference sample. Voice-clone
37
+ * requests must target this model; the reference audio goes into `audio.voice`
38
+ * as a `data:audio/wav;base64,…` URI, which the default TTS model rejects.
39
+ */
40
+ export declare const DEFAULT_CLONE_MODEL = "mimo-v2.5-tts-voiceclone";
41
+ /** Preset voice used when no clone sample is configured. */
42
+ export declare const DEFAULT_VOICE = "mimo_default";
43
+ /**
44
+ * Credential reference naming the MiMo API key inside the host credentials
45
+ * store; the literal key itself never lands in a configuration file.
46
+ */
47
+ export declare const DEFAULT_CREDENTIAL_REF = "MIMO_API_KEY";
48
+ /** Longest text one synthesis accepts, in characters. */
49
+ export declare const DEFAULT_MAX_CHARS = 2000;
50
+ /** Longest single playback chunk, in characters (pipeline building block). */
51
+ export declare const DEFAULT_CHUNK_CHARS = 120;
52
+ /** Upper bound on one upstream round-trip, in milliseconds. */
53
+ export declare const DEFAULT_TIMEOUT_MS = 60000;
54
+ /** PCM stream constants: MiMo streams 24 kHz / 16-bit / mono PCM. */
55
+ export declare const PCM_SAMPLE_RATE = 24000;
56
+ export declare const PCM_CHANNELS = 1;
57
+ export declare const PCM_BYTES_PER_SAMPLE = 2;
58
+ /** Fallback engine selection: no fallback, or Microsoft Edge TTS. */
59
+ export type FallbackEngine = 'none' | 'edge';
60
+ export declare const DEFAULT_FALLBACK_ENGINE: FallbackEngine;
61
+ /** Default Edge-TTS voice: Xiaoxiao, the standard mainland-Chinese female voice. */
62
+ export declare const DEFAULT_EDGE_VOICE = "zh-CN-XiaoxiaoNeural";
63
+ /** Read-scope modes: only prose, everything, or prose plus short code. */
64
+ export type ReadScope = 'text' | 'all' | 'smart' | 'brief';
65
+ export declare const DEFAULT_READ_SCOPE: ReadScope;
66
+ /** Sentence highlighting defaults to on; users can turn it off. */
67
+ export declare const DEFAULT_HIGHLIGHT = true;
68
+ /**
69
+ * The progress bar is off by default: the play/pause control is what the user
70
+ * reaches for, and the seekable track costs most of the panel's width for
71
+ * little gain on short replies.
72
+ */
73
+ export declare const DEFAULT_PROGRESS_BAR = false;
74
+ /** Stop reading as soon as something opens the microphone (avoids self-echo). */
75
+ export declare const DEFAULT_MUTE_WHILE_RECORDING = true;
76
+ /**
77
+ * The resolved settings section, as the settings form projects it. The API
78
+ * key is referenced, never stored: `apiKeyEnv` names a credential in the
79
+ * host credentials store, and its presence is reported only through
80
+ * {@link TtsStatusView}.
81
+ */
82
+ export interface TtsSettings {
83
+ /** Credential reference naming the MiMo API key in the credentials store. */
84
+ apiKeyEnv?: string | undefined;
85
+ /** Endpoint base; blank inherits {@link DEFAULT_BASE_URL}. */
86
+ baseUrl?: string | undefined;
87
+ /** Model id; blank inherits {@link DEFAULT_MODEL}. */
88
+ model?: string | undefined;
89
+ /** Preset voice name; blank inherits {@link DEFAULT_VOICE}. */
90
+ voice?: string | undefined;
91
+ /** Host-local WAV used as the voice-clone reference; blank uses the preset voice. */
92
+ voiceSamplePath?: string | undefined;
93
+ /** Default speaking-style phrase prepended as `<style>…</style>`. */
94
+ style?: string | undefined;
95
+ /** Longest accepted text, in characters. */
96
+ maxChars?: number | undefined;
97
+ /** Longest single playback chunk, in characters. */
98
+ chunkChars?: number | undefined;
99
+ /** Upper bound on one upstream round-trip, in milliseconds. */
100
+ timeoutMs?: number | undefined;
101
+ /** Read each newly finalized assistant reply aloud automatically. */
102
+ autoRead?: boolean | undefined;
103
+ /** Fallback engine used when MiMo synthesis fails. */
104
+ fallbackEngine?: FallbackEngine | undefined;
105
+ /** Edge-TTS voice used by the fallback engine. */
106
+ edgeVoice?: string | undefined;
107
+ /** Which parts of a reply are read aloud. */
108
+ readScope?: ReadScope | undefined;
109
+ /** Highlight the sentence being read inside the message. */
110
+ highlight?: boolean | undefined;
111
+ /** Show the seekable progress bar in the floating player. */
112
+ progressBar?: boolean | undefined;
113
+ muteWhileRecording?: boolean | undefined;
114
+ }
115
+ /** What `GET /api/mimo-speak/status` reports; safe to show in the UI verbatim. */
116
+ export interface TtsStatusView {
117
+ /** Whether the Host resolves a non-empty API key. */
118
+ configured: boolean;
119
+ /** Effective model id. */
120
+ model: string;
121
+ /** Effective preset voice. */
122
+ voice: string;
123
+ /** Whether the configured voice-clone sample is present on the Host. */
124
+ hasVoiceSample: boolean;
125
+ /** Effective endpoint base. */
126
+ baseUrl: string;
127
+ /** Whether newly finalized assistant replies are read aloud automatically. */
128
+ autoRead: boolean;
129
+ /** Total character budget the Host accepts per reply. */
130
+ maxChars: number;
131
+ /** Longest single playback chunk, in characters. */
132
+ chunkChars: number;
133
+ /** Fallback engine selection. */
134
+ fallbackEngine: FallbackEngine;
135
+ /** Edge-TTS voice used by the fallback engine. */
136
+ edgeVoice: string;
137
+ /** Which parts of a reply are read aloud. */
138
+ readScope: ReadScope;
139
+ /** Whether the sentence being read is highlighted in the message. */
140
+ highlight: boolean;
141
+ /** Whether the floating player shows a progress bar. */
142
+ progressBar: boolean;
143
+ muteWhileRecording: boolean;
144
+ }
145
+ /** Failure codes the synthesize route returns; the browser maps them to copy. */
146
+ export type TtsErrorCode = 'bad-request' | 'not-configured' | 'text-too-long' | 'voice-sample-unreadable' | 'timeout' | 'upstream-error' | 'invalid-audio';
147
+ /** JSON error body returned by this plugin's routes. */
148
+ export interface TtsErrorBody {
149
+ error: {
150
+ code: TtsErrorCode;
151
+ /** Provider- or host-supplied detail; safe to show, never contains secrets. */
152
+ message: string;
153
+ /** Upstream HTTP status, when the provider returned one. */
154
+ upstreamStatus?: number | undefined;
155
+ /** Upstream `param` field (MiMo's only actionable error hint). */
156
+ param?: string | undefined;
157
+ };
158
+ }
159
+ /** JSON body returned by the test route on success. */
160
+ export interface TtsTestResult {
161
+ ok: true;
162
+ /** Which engine answered: `mimo` or `edge`. */
163
+ engine: 'mimo' | 'edge';
164
+ /** Milliseconds from request start to the first audio byte. */
165
+ latencyMs: number;
166
+ /** Bytes of audio produced (decoded, after base64). */
167
+ audioBytes: number;
168
+ voice: string;
169
+ model?: string | undefined;
170
+ }
171
+ /** JSON body returned by `POST /api/mimo-speak/summary`. */
172
+ export interface TtsSummaryResult {
173
+ /** One or two sentences, ready to speak. */
174
+ summary: string;
175
+ }
176
+ /** JSON body accepted by `POST /api/mimo-speak/synthesize`. */
177
+ export interface TtsSynthesizeRequest {
178
+ /** Text to speak. Markdown is normalized Host-side before synthesis. */
179
+ text: string;
180
+ /** Style override (e.g. `开心`, `语速慢`); blank inherits the configured default. */
181
+ style?: string | undefined;
182
+ /** Preset-voice override; blank inherits the configured default. */
183
+ voice?: string | undefined;
184
+ }
185
+ /** Sample sentence the Plugins-page card's audition button speaks. */
186
+ export declare const AUDITION_TEXT = "\u4F60\u597D\uFF0C\u8FD9\u662F MiMo \u8BED\u97F3\u5408\u6210\u7684\u8BD5\u542C\u6548\u679C\u3002";
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Settings and route vocabulary shared by the Host and browser halves.
3
+ *
4
+ * Both bundles inline this file, so it must stay pure: constants and types
5
+ * only, no Node or DOM APIs. The namespace is the profile entry id the bundle
6
+ * patch inserts (`cordis.patch.yml`), and the route paths are the seam the two
7
+ * halves meet on.
8
+ * @module dsh-mimo-speak/settings
9
+ */
10
+ /** Settings namespace: the profile entry id of this plugin's loader row. */
11
+ export const MIMOSPEAK_NAMESPACE = 'mimo-speak';
12
+ /**
13
+ * Key this plugin's configuration card registers under on the Plugins page's
14
+ * `plugins.bundle.config` keyed slot: the bundle's npm package name, which is
15
+ * the keying convention the Plugins page fixes for bundle-owned configuration
16
+ * (the page dispatches with `entryKey: pkg.name`).
17
+ */
18
+ export const MIMOSPEAK_PACKAGE_KEY = 'dsh-mimo-speak';
19
+ /** Route prefix owned by this plugin on `ctx.webServer`. */
20
+ export const MIMOSPEAK_API_PREFIX = '/api/mimo-speak';
21
+ /** `GET` route reporting the resolved engine configuration without secrets. */
22
+ export const MIMOSPEAK_STATUS_PATH = `${MIMOSPEAK_API_PREFIX}/status`;
23
+ /** `POST` route synthesizing one text into WAV audio. */
24
+ export const MIMOSPEAK_SYNTHESIZE_PATH = `${MIMOSPEAK_API_PREFIX}/synthesize`;
25
+ /** `POST` route streaming one text as raw PCM chunks (SSE). */
26
+ export const MIMOSPEAK_SYNTHESIZE_STREAM_PATH = `${MIMOSPEAK_API_PREFIX}/synthesize-stream`;
27
+ /** `POST` route running a short round-trip health check against the engine. */
28
+ export const MIMOSPEAK_TEST_PATH = `${MIMOSPEAK_API_PREFIX}/test`;
29
+ /** POST text → a short spoken summary (used by the brief read scope). */
30
+ export const MIMOSPEAK_SUMMARY_PATH = `${MIMOSPEAK_API_PREFIX}/summary`;
31
+ /** MiMo platform endpoint base; `/chat/completions` is appended. */
32
+ export const DEFAULT_BASE_URL = 'https://api.xiaomimimo.com/v1';
33
+ /** MiMo TTS model id. */
34
+ export const DEFAULT_MODEL = 'mimo-v2.5-tts';
35
+ /**
36
+ * MiMo model that clones a voice from a reference sample. Voice-clone
37
+ * requests must target this model; the reference audio goes into `audio.voice`
38
+ * as a `data:audio/wav;base64,…` URI, which the default TTS model rejects.
39
+ */
40
+ export const DEFAULT_CLONE_MODEL = 'mimo-v2.5-tts-voiceclone';
41
+ /** Preset voice used when no clone sample is configured. */
42
+ export const DEFAULT_VOICE = 'mimo_default';
43
+ /**
44
+ * Credential reference naming the MiMo API key inside the host credentials
45
+ * store; the literal key itself never lands in a configuration file.
46
+ */
47
+ export const DEFAULT_CREDENTIAL_REF = 'MIMO_API_KEY';
48
+ /** Longest text one synthesis accepts, in characters. */
49
+ export const DEFAULT_MAX_CHARS = 2000;
50
+ /** Longest single playback chunk, in characters (pipeline building block). */
51
+ export const DEFAULT_CHUNK_CHARS = 120;
52
+ /** Upper bound on one upstream round-trip, in milliseconds. */
53
+ export const DEFAULT_TIMEOUT_MS = 60_000;
54
+ /** PCM stream constants: MiMo streams 24 kHz / 16-bit / mono PCM. */
55
+ export const PCM_SAMPLE_RATE = 24_000;
56
+ export const PCM_CHANNELS = 1;
57
+ export const PCM_BYTES_PER_SAMPLE = 2;
58
+ export const DEFAULT_FALLBACK_ENGINE = 'none';
59
+ /** Default Edge-TTS voice: Xiaoxiao, the standard mainland-Chinese female voice. */
60
+ export const DEFAULT_EDGE_VOICE = 'zh-CN-XiaoxiaoNeural';
61
+ export const DEFAULT_READ_SCOPE = 'smart';
62
+ /** Sentence highlighting defaults to on; users can turn it off. */
63
+ export const DEFAULT_HIGHLIGHT = true;
64
+ /**
65
+ * The progress bar is off by default: the play/pause control is what the user
66
+ * reaches for, and the seekable track costs most of the panel's width for
67
+ * little gain on short replies.
68
+ */
69
+ export const DEFAULT_PROGRESS_BAR = false;
70
+ /** Stop reading as soon as something opens the microphone (avoids self-echo). */
71
+ export const DEFAULT_MUTE_WHILE_RECORDING = true;
72
+ /** Sample sentence the Plugins-page card's audition button speaks. */
73
+ export const AUDITION_TEXT = '你好,这是 MiMo 语音合成的试听效果。';
74
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,gBAAgB,CAAA;AAErD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAA;AAErD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,oBAAoB,SAAS,CAAA;AAErE,yDAAyD;AACzD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,oBAAoB,aAAa,CAAA;AAE7E,+DAA+D;AAC/D,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,oBAAoB,oBAAoB,CAAA;AAE3F,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,oBAAoB,OAAO,CAAA;AACjE,yEAAyE;AACzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,oBAAoB,UAAU,CAAA;AAEvE,oEAAoE;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,+BAA+B,CAAA;AAE/D,yBAAyB;AACzB,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAA;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,CAAA;AAE7D,4DAA4D;AAC5D,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAA;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAA;AAEpD,yDAAyD;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA;AAErC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAEtC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAA;AAExC,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAA;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAA;AAC7B,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAA;AAIrC,MAAM,CAAC,MAAM,uBAAuB,GAAmB,MAAM,CAAA;AAE7D,oFAAoF;AACpF,MAAM,CAAC,MAAM,kBAAkB,GAAG,sBAAsB,CAAA;AAIxD,MAAM,CAAC,MAAM,kBAAkB,GAAc,OAAO,CAAA;AAEpD,mEAAmE;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAA;AACzC,iFAAiF;AACjF,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAA;AA6HhD,sEAAsE;AACtE,MAAM,CAAC,MAAM,aAAa,GAAG,uBAAuB,CAAA"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Model-written spoken summary for brief read-aloud.
3
+ *
4
+ * A mechanical "one sentence per paragraph" rule is predictable but stiff: it
5
+ * picks whichever sentence happens to come first, which is often a preamble
6
+ * rather than the point. A brief read-aloud should be *summarized*, then
7
+ * spoken — one or two sentences that carry the conclusion.
8
+ *
9
+ * This module asks the model the user already has configured (through the
10
+ * harness `llm` service) for that summary. It is a best-effort extra step: any
11
+ * missing service, missing selection or provider failure returns `undefined`,
12
+ * and the caller falls back to the offline extractive rule.
13
+ * @module dsh-mimo-speak/summarize
14
+ */
15
+ import type { Context } from '@deepseek-ai/cordis';
16
+ /**
17
+ * Turn model output into something worth speaking.
18
+ * @param raw - the assembled model text.
19
+ * @returns at most two sentences, without decoration.
20
+ */
21
+ export declare function polishSummary(raw: string): string;
22
+ /**
23
+ * Ask the configured model for a spoken summary.
24
+ * @param ctx - host context carrying the `llm` service.
25
+ * @param text - the reply text to condense.
26
+ * @param signal - aborts the request when the reader stops.
27
+ * @returns the summary, or undefined when no model answered.
28
+ */
29
+ export declare function summarizeForSpeech(ctx: Context, text: string, signal?: AbortSignal): Promise<string | undefined>;
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Model-written spoken summary for brief read-aloud.
3
+ *
4
+ * A mechanical "one sentence per paragraph" rule is predictable but stiff: it
5
+ * picks whichever sentence happens to come first, which is often a preamble
6
+ * rather than the point. A brief read-aloud should be *summarized*, then
7
+ * spoken — one or two sentences that carry the conclusion.
8
+ *
9
+ * This module asks the model the user already has configured (through the
10
+ * harness `llm` service) for that summary. It is a best-effort extra step: any
11
+ * missing service, missing selection or provider failure returns `undefined`,
12
+ * and the caller falls back to the offline extractive rule.
13
+ * @module dsh-mimo-speak/summarize
14
+ */
15
+ /** Longest reply text handed to the summarizer, in characters. */
16
+ const MAX_INPUT_CHARS = 6000;
17
+ /** Hard cap on the spoken summary, in characters. */
18
+ const MAX_SUMMARY_CHARS = 110;
19
+ /** Sentence terminators that end a summary sentence. */
20
+ const TERMINATORS = new Set(['。', '!', '?', ';', '!', '?', ';']);
21
+ /** How the summary must sound when read aloud. */
22
+ const SYSTEM = [
23
+ '你是朗读助手。把用户给你的这段助手回复浓缩成适合「听」的口播摘要。',
24
+ '要求:1–2 句,合计不超过 80 字;只讲结论、关键动作和必要的数字;',
25
+ '不要 Markdown、不要列表、不要代码、不要复述细节;',
26
+ '不要「好的」「以下是」这类开场;直接给内容。',
27
+ '使用与原文相同的语言。',
28
+ ].join('');
29
+ /**
30
+ * Read one service without declaring it as a plugin dependency.
31
+ *
32
+ * The plugin is useful even when nothing else is mounted, so the summary is an
33
+ * optional capability rather than a hard requirement: `reflect.get` resolves a
34
+ * service that exists without the cordis inject contract, and a plain property
35
+ * lookup covers hosts that expose services directly.
36
+ * @param ctx - host context.
37
+ * @param name - service name (`llm`, `agentDefaultModel`).
38
+ * @returns the service, or undefined when it is not mounted.
39
+ */
40
+ function serviceOf(ctx, name) {
41
+ try {
42
+ const reflect = ctx.reflect;
43
+ const value = reflect?.get?.(name);
44
+ if (value !== undefined && value !== null)
45
+ return value;
46
+ }
47
+ catch {
48
+ // Not reachable through reflect: try the plain property next.
49
+ }
50
+ try {
51
+ return (ctx[name] ?? undefined);
52
+ }
53
+ catch {
54
+ return undefined;
55
+ }
56
+ }
57
+ /**
58
+ * Turn model output into something worth speaking.
59
+ * @param raw - the assembled model text.
60
+ * @returns at most two sentences, without decoration.
61
+ */
62
+ export function polishSummary(raw) {
63
+ const cleaned = raw
64
+ .replace(/```[\s\S]*?```/gu, '')
65
+ .replace(/(\*\*|__|~~|`)/gu, '')
66
+ .replace(/^[\s#>]*[-+*•·]?\s*/gmu, '')
67
+ .replace(/\s+/gu, ' ')
68
+ .trim();
69
+ if (cleaned === '')
70
+ return '';
71
+ const sentences = [];
72
+ let buffer = '';
73
+ for (const character of cleaned) {
74
+ buffer += character;
75
+ if (TERMINATORS.has(character)) {
76
+ sentences.push(buffer.trim());
77
+ buffer = '';
78
+ if (sentences.length === 2)
79
+ break;
80
+ }
81
+ }
82
+ if (sentences.length === 0 && buffer.trim() !== '')
83
+ sentences.push(buffer.trim());
84
+ const joined = sentences.join('');
85
+ return joined.length <= MAX_SUMMARY_CHARS ? joined : `${joined.slice(0, MAX_SUMMARY_CHARS)}…`;
86
+ }
87
+ /**
88
+ * Ask the configured model for a spoken summary.
89
+ * @param ctx - host context carrying the `llm` service.
90
+ * @param text - the reply text to condense.
91
+ * @param signal - aborts the request when the reader stops.
92
+ * @returns the summary, or undefined when no model answered.
93
+ */
94
+ export async function summarizeForSpeech(ctx, text, signal) {
95
+ const trimmed = text.trim();
96
+ if (trimmed === '')
97
+ return undefined;
98
+ const llm = serviceOf(ctx, 'llm');
99
+ const selection = serviceOf(ctx, 'agentDefaultModel')?.currentSelection?.();
100
+ const provider = selection?.provider;
101
+ const model = selection?.model;
102
+ if (llm?.stream === undefined || provider === undefined || provider === '' || model === undefined || model === '') {
103
+ return undefined;
104
+ }
105
+ let assembled = '';
106
+ try {
107
+ const stream = llm.stream({
108
+ provider,
109
+ model,
110
+ messages: [{
111
+ role: 'user',
112
+ content: [{ type: 'text', text: trimmed.slice(0, MAX_INPUT_CHARS) }],
113
+ }],
114
+ system: SYSTEM,
115
+ temperature: 0.3,
116
+ maxTokens: 300,
117
+ ...(signal === undefined ? {} : { signal }),
118
+ });
119
+ for await (const chunk of stream) {
120
+ if (chunk.type === 'text-delta')
121
+ assembled += chunk.text;
122
+ }
123
+ }
124
+ catch {
125
+ // Any provider failure simply means "no summary": the caller stays offline.
126
+ return undefined;
127
+ }
128
+ const summary = polishSummary(assembled);
129
+ return summary === '' ? undefined : summary;
130
+ }
131
+ //# sourceMappingURL=summarize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summarize.js","sourceRoot":"","sources":["../../src/summarize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,kEAAkE;AAClE,MAAM,eAAe,GAAG,IAAI,CAAA;AAE5B,qDAAqD;AACrD,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAE7B,wDAAwD;AACxD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAEhE,kDAAkD;AAClD,MAAM,MAAM,GAAG;IACb,mCAAmC;IACnC,sCAAsC;IACtC,+BAA+B;IAC/B,wBAAwB;IACxB,aAAa;CACd,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAoBV;;;;;;;;;;GAUG;AACH,SAAS,SAAS,CAAI,GAAY,EAAE,IAAY;IAC9C,IAAI,CAAC;QACH,MAAM,OAAO,GAAI,GAAuE,CAAC,OAA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E,MAAM;YACd,WAAW,EAAE,GAAG;YAChB,SAAS,EAAE,GAAG;YACd,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;SAC5C,CAAC,CAAA;QACF,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;gBAAE,SAAS,IAAI,KAAK,CAAC,IAAI,CAAA;QAC1D,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,4EAA4E;QAC5E,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,MAAM,OAAO,GAAG,aAAa,CAAC,SAAS,CAAC,CAAA;IACxC,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAA;AAC7C,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Agent tool: text → speech WAV inside the session workspace.
3
+ *
4
+ * The tool only produces a file. Turning it into an actual voice message is the
5
+ * chat channel's job (each channel ships its own voice-send tool), so this
6
+ * plugin stays free of any IM-specific knowledge.
7
+ *
8
+ * Output goes to `<session cwd>/tts/`: channel-side发送工具通常只接受工作区内的
9
+ * 路径,写到别处(比如本插件的录音目录)会被拒绝。
10
+ * @module dsh-mimo-speak/tool
11
+ */
12
+ /** Tool name: `<vendor>-tts-say`, kept distinct from a chat channel's own voice tools. */
13
+ export declare const SAY_TOOL = "mimo-tts-say";
14
+ /** 合成产物在会话工作区里的子目录。 */
15
+ export declare const SPEECH_DIR = "tts";
16
+ /** 一个合成请求(与 Web 路由收到的是同一形状)。 */
17
+ export interface SayRequest {
18
+ text: string;
19
+ voice?: string;
20
+ style?: string;
21
+ }
22
+ /** 一次合成产物 + 实际生效的音色/风格。 */
23
+ export interface SayOutcome {
24
+ wav: Uint8Array;
25
+ model: string;
26
+ style: string;
27
+ voice: string;
28
+ }
29
+ export interface SayToolDeps {
30
+ synthesize(request: SayRequest): Promise<SayOutcome>;
31
+ log?(message: string): void;
32
+ }
33
+ /**
34
+ * 语音文件名:`speech-<YYYYMMDD-HHmmss>-<8位随机>.wav`。
35
+ * 带时间戳是为了让工作区里一眼看出先后,随机段防同秒覆盖。
36
+ */
37
+ export declare function speechFileName(now?: number, id?: string): string;
38
+ /**
39
+ * 规范 44 字节头 WAV 的时长(毫秒)。不是这个布局就返回 0,
40
+ * 不猜——宁可少给一个数字,也不给模型一个错的时长。
41
+ */
42
+ export declare function wavDurationMs(bytes: Uint8Array): number;
43
+ /** 工具定义:执行一次「合成 → 落盘」。 */
44
+ export declare function createSayTool(deps: SayToolDeps): {
45
+ name: string;
46
+ description: string;
47
+ parameters: Record<string, unknown>;
48
+ output: Record<string, unknown>;
49
+ execute(args: unknown, exec: unknown): Promise<{
50
+ path: string;
51
+ bytes: number;
52
+ durationMs: number;
53
+ }>;
54
+ };
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Agent tool: text → speech WAV inside the session workspace.
3
+ *
4
+ * The tool only produces a file. Turning it into an actual voice message is the
5
+ * chat channel's job (each channel ships its own voice-send tool), so this
6
+ * plugin stays free of any IM-specific knowledge.
7
+ *
8
+ * Output goes to `<session cwd>/tts/`: channel-side发送工具通常只接受工作区内的
9
+ * 路径,写到别处(比如本插件的录音目录)会被拒绝。
10
+ * @module dsh-mimo-speak/tool
11
+ */
12
+ import { randomUUID } from 'node:crypto';
13
+ import { mkdir, writeFile } from 'node:fs/promises';
14
+ import { join } from 'node:path';
15
+ /** Tool name: `<vendor>-tts-say`, kept distinct from a chat channel's own voice tools. */
16
+ export const SAY_TOOL = 'mimo-tts-say';
17
+ /** 合成产物在会话工作区里的子目录。 */
18
+ export const SPEECH_DIR = 'tts';
19
+ /**
20
+ * 语音文件名:`speech-<YYYYMMDD-HHmmss>-<8位随机>.wav`。
21
+ * 带时间戳是为了让工作区里一眼看出先后,随机段防同秒覆盖。
22
+ */
23
+ export function speechFileName(now = Date.now(), id = randomUUID()) {
24
+ const stamp = new Date(now).toISOString().replace(/\.\d{3}Z$/, '').replace(/[-:]/g, '').replace('T', '-');
25
+ return `speech-${stamp}-${id.replace(/-/g, '').slice(0, 8)}.wav`;
26
+ }
27
+ /**
28
+ * 规范 44 字节头 WAV 的时长(毫秒)。不是这个布局就返回 0,
29
+ * 不猜——宁可少给一个数字,也不给模型一个错的时长。
30
+ */
31
+ export function wavDurationMs(bytes) {
32
+ if (bytes.length < 44)
33
+ return 0;
34
+ const ascii = (offset, text) => {
35
+ for (let index = 0; index < text.length; index += 1) {
36
+ if (bytes[offset + index] !== text.charCodeAt(index))
37
+ return false;
38
+ }
39
+ return true;
40
+ };
41
+ if (!ascii(0, 'RIFF') || !ascii(8, 'WAVE') || !ascii(36, 'data'))
42
+ return 0;
43
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
44
+ const channels = view.getUint16(22, true);
45
+ const sampleRate = view.getUint32(24, true);
46
+ const bitsPerSample = view.getUint16(34, true);
47
+ const dataSize = view.getUint32(40, true);
48
+ if (channels === 0 || sampleRate === 0 || bitsPerSample === 0 || dataSize === 0)
49
+ return 0;
50
+ const frames = dataSize / ((bitsPerSample / 8) * channels);
51
+ return Math.round((frames / sampleRate) * 1000);
52
+ }
53
+ /** 工具定义:执行一次「合成 → 落盘」。 */
54
+ export function createSayTool(deps) {
55
+ return {
56
+ name: SAY_TOOL,
57
+ description: '把一段文字合成语音,写到当前会话工作区的 tts/ 目录,返回 wav 的绝对路径。'
58
+ + '用户要求「用语音回我 / 念出来」,或这段内容本身适合朗读时用它;平时的回复还是用文字,不要每条都合成。'
59
+ + '它只产出文件——要让用户真的听到,得把返回的 path 交给当前聊天渠道的发语音工具。',
60
+ parameters: {
61
+ type: 'object',
62
+ additionalProperties: false,
63
+ properties: {
64
+ text: {
65
+ type: 'string',
66
+ description: '要念出来的文字。支持多段,但会被截到设置的 maxChars;代码块与 markdown 会被清理成可朗读文本。',
67
+ },
68
+ voice: {
69
+ type: 'string',
70
+ description: '可选:临时换一个预置音色。不传就用插件页配置卡片里的默认音色(或克隆音色)。',
71
+ },
72
+ style: {
73
+ type: 'string',
74
+ description: '可选:说话风格,比如「开心」「语速慢」「东北话」。不传就用插件页配置卡片里的默认风格。',
75
+ },
76
+ },
77
+ required: ['text'],
78
+ },
79
+ output: {
80
+ schema: {
81
+ type: 'object',
82
+ additionalProperties: false,
83
+ properties: {
84
+ path: { type: 'string' },
85
+ bytes: { type: 'number' },
86
+ durationMs: { type: 'number' },
87
+ },
88
+ required: ['path', 'bytes', 'durationMs'],
89
+ },
90
+ render: (_args, value) => [
91
+ {
92
+ type: 'text',
93
+ text: `已合成语音:${value.path}(${value.bytes} 字节,约 ${(value.durationMs / 1000).toFixed(1)} 秒)。`
94
+ + '文件已写进工作区,还没发出去——要发就把它交给发语音的工具。',
95
+ },
96
+ ],
97
+ },
98
+ async execute(args, exec) {
99
+ const shape = (exec ?? {});
100
+ const cwd = shape.agent?.session?.header?.cwd;
101
+ if (typeof cwd !== 'string' || cwd === '') {
102
+ throw new Error('拿不到当前会话的工作区,语音文件没地方写。');
103
+ }
104
+ const input = (args ?? {});
105
+ const text = typeof input.text === 'string' ? input.text.trim() : '';
106
+ if (text === '')
107
+ throw new Error('缺少要念的文本(text)。');
108
+ const voice = typeof input.voice === 'string' && input.voice.trim() !== '' ? input.voice.trim() : undefined;
109
+ const style = typeof input.style === 'string' && input.style.trim() !== '' ? input.style.trim() : undefined;
110
+ shape.signal?.throwIfAborted?.();
111
+ const request = { text, ...(voice === undefined ? {} : { voice }), ...(style === undefined ? {} : { style }) };
112
+ const outcome = await deps.synthesize(request);
113
+ shape.signal?.throwIfAborted?.();
114
+ const dir = join(cwd, SPEECH_DIR);
115
+ await mkdir(dir, { recursive: true });
116
+ const path = join(dir, speechFileName());
117
+ await writeFile(path, outcome.wav);
118
+ deps.log?.(`[mimo-speak] 合成语音 ${path}(${outcome.wav.length} 字节)`);
119
+ return { path, bytes: outcome.wav.length, durationMs: wavDurationMs(outcome.wav) };
120
+ },
121
+ };
122
+ }
123
+ //# sourceMappingURL=tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../src/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAA;AAEtC,uBAAuB;AACvB,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAA;AA4B/B;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,IAAI,CAAC,GAAG,EAAE,EAAE,KAAa,UAAU,EAAE;IAChF,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACzG,OAAO,UAAU,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAA;AAClE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,CAAC,CAAA;IAC/B,MAAM,KAAK,GAAG,CAAC,MAAc,EAAE,IAAY,EAAW,EAAE;QACtD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YACpD,IAAI,KAAK,CAAC,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