@goodandready/dsh-tts 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-tts contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # dsh-tts
2
+
3
+ Text-to-speech for the DeepSeek Harness Web GUI. When **Speak agent replies**
4
+ is on, each finished assistant turn is synthesized on the host and played in
5
+ the browser. API keys never reach the browser.
6
+
7
+ A later messenger hub can call the same host chain (`POST /dsh-tts/speak` or
8
+ the `speak_text` tool). This package does not talk to Telegram itself.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ # From npm (after a GitHub/npm release):
14
+ dsh plugin --profile web add @goodandready/dsh-tts
15
+
16
+ # From a local checkout:
17
+ dsh plugin --profile web add file:/path/to/dsh-tts
18
+ ```
19
+
20
+ Restart the Web UI, then hard-refresh the browser.
21
+
22
+ ## Configure
23
+
24
+ Settings -> **Speech**:
25
+
26
+ - **Speak agent replies** -- off by default.
27
+ - **Provider chain** -- pick a provider, paste its API key in that row, then
28
+ Save (or leave the key field). The value is written to the host credentials
29
+ store immediately and is never sent back to the browser. The row shows
30
+ **Configured** / **Not set**. Leave the field blank to keep an existing key.
31
+ Local providers (`edge`, `piper`, `espeak`) have no key field.
32
+ - A provider without a credential is skipped, not fatal.
33
+ - Piper / eSpeak / edge-tts binaries and the Piper model path.
34
+
35
+ Keys land in the same store the rest of DSH uses (credentials file, then the
36
+ process environment). The plugin stores names, never values:
37
+
38
+ ```text
39
+ OPENAI_API_KEY
40
+ ELEVENLABS_API_KEY
41
+ GEMINI_API_KEY
42
+ AZURE_SPEECH_KEY
43
+ GROQ_API_KEY
44
+ DEEPGRAM_API_KEY
45
+ OPENROUTER_API_KEY
46
+ ```
47
+
48
+ Put additional keys in the same pool (`<PROVIDER>_API_KEY_2`, ...) if you use
49
+ a key-rotation plugin.
50
+
51
+ ## Providers
52
+
53
+ | Key | Service | Default model / voice | Credential |
54
+ |---|---|---|---|
55
+ | `openai` | OpenAI Audio Speech | `gpt-4o-mini-tts` / `alloy` | `OPENAI_API_KEY` |
56
+ | `elevenlabs` | ElevenLabs | `eleven_multilingual_v2` | `ELEVENLABS_API_KEY` |
57
+ | `google` | Gemini TTS | `gemini-2.5-flash-preview-tts` / `Kore` | `GEMINI_API_KEY` |
58
+ | `azure` | Azure Speech | neural voice + region | `AZURE_SPEECH_KEY` + region |
59
+ | `groq` | Groq PlayAI | `playai-tts` | `GROQ_API_KEY` |
60
+ | `deepgram` | Deepgram Aura | `aura-asteria-en` | `DEEPGRAM_API_KEY` |
61
+ | `openrouter` | OpenRouter `/audio/speech` | `openai/gpt-4o-mini-tts-2025-12-15` | `OPENROUTER_API_KEY` |
62
+ | `edge` | Microsoft Edge Neural via `edge-tts` CLI | `ru-RU-SvetlanaNeural` | none |
63
+ | `piper` | local Piper | path to an ONNX model | none |
64
+ | `espeak` | eSpeak NG | voice `ru` | none |
65
+
66
+ Default chain: `edge` → `piper` → `espeak`. Deepgram Aura does not list Russian;
67
+ keep it below a Russian-capable voice if you speak Russian.
68
+
69
+ ### Free local / CLI providers
70
+
71
+ ```bash
72
+ pip install edge-tts # provides the `edge-tts` binary
73
+ # piper: install the Piper binary and point Settings at your .onnx model
74
+ sudo apt install espeak-ng # or the equivalent package on your OS
75
+ ```
76
+
77
+ ## Tool
78
+
79
+ `speak_text(text)` — synthesize with the same chain. The tool result is a short
80
+ status line; it does not inject audio into the model history.
81
+
82
+ ## Routes
83
+
84
+ | Route | Purpose |
85
+ |---|---|
86
+ | `GET /dsh-tts/status` | chain and whether auto-speak is on |
87
+ | `GET` or `PUT /dsh-tts/config` | settings plus configured/writable/ref per cloud provider. PUT may include keys; values are stored as credentials and never echoed. |
88
+ | `PUT` or `DELETE /dsh-tts/credential` | writes or clears one host credential immediately |
89
+ | `GET /dsh-tts/pending?after=` | audio produced for finished replies |
90
+ | `POST /dsh-tts/speak` | `{text}` -> `{ok, provider, mime, audioBase64}` |
91
+
92
+ ## Requirements
93
+
94
+ - DeepSeek Harness with the Web GUI
95
+ - Node 20+
96
+ - Optional: `edge-tts`, `piper`, `espeak-ng` for the free providers
97
+
98
+ ## License
99
+
100
+ MIT
@@ -0,0 +1,8 @@
1
+ # dsh-tts bundle layer.
2
+ #
3
+ # `name` must stay the full npm package name: the client-modules registry
4
+ # resolves the browser bundle by the loader entry name.
5
+ - insert:
6
+ - id: dsh-tts
7
+ name: '@goodandready/dsh-tts'
8
+ config: {}
package/lib/chain.js ADDED
@@ -0,0 +1,33 @@
1
+ // Fallback walk over a TTS provider chain. Pure: no cordis, no network.
2
+
3
+ function normalizeError(err) {
4
+ const cause = err?.cause?.message || err?.message || String(err)
5
+ return cause.slice(0, 200)
6
+ }
7
+
8
+ /**
9
+ * @param order {string[]}
10
+ * @param providers {Record<string, () => Promise<{ok, provider?, audio?, mime?, reason?}>>}
11
+ */
12
+ export async function runChain(order, providers) {
13
+ const t0 = Date.now()
14
+ const keys = (Array.isArray(order) ? order : []).filter((k) => typeof providers[k] === 'function')
15
+ const errors = []
16
+ for (const key of keys) {
17
+ try {
18
+ const out = await providers[key]()
19
+ if (out && out.ok && out.audio && out.audio.length > 0) {
20
+ return {
21
+ provider: out.provider || key,
22
+ audio: out.audio,
23
+ mime: out.mime || 'audio/mpeg',
24
+ tookMs: Date.now() - t0,
25
+ }
26
+ }
27
+ errors.push(`${(out && out.provider) || key}: ${(out && out.reason) || 'unknown'}`)
28
+ } catch (err) {
29
+ errors.push(`${key}: ${normalizeError(err)}`)
30
+ }
31
+ }
32
+ throw new Error(`all providers failed (${errors.join('; ')})`)
33
+ }
package/lib/client.js ADDED
@@ -0,0 +1,310 @@
1
+ window.__ModuleLoader__.load({
2
+ id: '@goodandready/dsh-tts',
3
+ factory: (require) => {
4
+ var module = { exports: {} }
5
+ var exports = module.exports
6
+ const React = require('react')
7
+ const NS = 'dsh-tts'
8
+ const PROVIDERS = [
9
+ 'openai', 'elevenlabs', 'google', 'azure', 'groq', 'deepgram', 'openrouter',
10
+ 'edge', 'piper', 'espeak',
11
+ ]
12
+ const CLOUD = {
13
+ openai: 1, elevenlabs: 1, google: 1, azure: 1, groq: 1, deepgram: 1, openrouter: 1,
14
+ }
15
+ const MODEL_HINT = {
16
+ openai: 'gpt-4o-mini-tts',
17
+ elevenlabs: 'eleven_multilingual_v2',
18
+ google: 'gemini-2.5-flash-preview-tts',
19
+ azure: 'region voice, e.g. en-US-JennyNeural',
20
+ groq: 'playai-tts',
21
+ deepgram: 'aura-asteria-en (no Russian)',
22
+ openrouter: 'openai/gpt-4o-mini-tts-2025-12-15',
23
+ edge: 'ru-RU-SvetlanaNeural',
24
+ piper: 'path to .onnx',
25
+ espeak: 'ru',
26
+ }
27
+
28
+ const SET_CSS =
29
+ '.dts-wrap{display:flex;flex-direction:column;gap:22px;padding:4px 0;max-width:720px}' +
30
+ '.dts-block{display:flex;flex-direction:column;gap:10px}' +
31
+ '.dts-h{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary)}' +
32
+ '.dts-sub{font-size:12px;color:var(--dsw-alias-label-secondary)}' +
33
+ '.dts-entry{display:flex;flex-direction:column;gap:8px;padding:10px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px}' +
34
+ '.dts-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}' +
35
+ '.dts-row select,.dts-row input,.dts-field input,.dts-field select{background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-primary);border-radius:6px;padding:6px 8px;font-size:13px}' +
36
+ '.dts-row .dts-model{flex:1;min-width:120px}' +
37
+ '.dts-row .dts-key{flex:1;min-width:180px}' +
38
+ '.dts-field{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--dsw-alias-label-secondary)}' +
39
+ '.dts-mini{border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-primary);border-radius:6px;width:28px;height:28px;cursor:pointer;flex:none}' +
40
+ '.dts-save{background:var(--dsw-alias-brand-primary);color:#fff;border:none;border-radius:6px;padding:7px 14px;font-size:13px;cursor:pointer}' +
41
+ '.dts-ok{font-size:12px;color:var(--dsw-alias-state-success-primary)}' +
42
+ '.dts-bad{font-size:12px;color:var(--dsw-alias-state-error-primary)}' +
43
+ '.dts-badge{font-size:11px;padding:2px 8px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);white-space:nowrap}' +
44
+ '.dts-badge-on{color:var(--dsw-alias-state-success-primary);border-color:currentColor}' +
45
+ '.dts-link{background:none;border:none;color:var(--dsw-alias-label-secondary);cursor:pointer;font-size:12px;padding:0}'
46
+
47
+ const setCssId = 'dsh-tts/settings.module.css'
48
+ if (typeof document !== 'undefined' && !document.querySelector('style[data-plugin-css="' + setCssId + '"]')) {
49
+ const tag = document.createElement('style')
50
+ tag.textContent = SET_CSS
51
+ tag.setAttribute('data-plugin', 'dsh-tts')
52
+ tag.dataset.pluginCss = setCssId
53
+ document.head.appendChild(tag)
54
+ }
55
+
56
+ const player = { audio: null, after: '', enabled: false }
57
+
58
+ function playItem(item) {
59
+ if (!item || item.error || !item.audioBase64) return
60
+ try {
61
+ if (player.audio) { try { player.audio.pause() } catch (e) { /* ignore */ } }
62
+ const bin = atob(item.audioBase64)
63
+ const bytes = new Uint8Array(bin.length)
64
+ for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i)
65
+ const blob = new Blob([bytes], { type: item.mime || 'audio/mpeg' })
66
+ const url = URL.createObjectURL(blob)
67
+ const audio = new Audio(url)
68
+ player.audio = audio
69
+ audio.onended = () => { URL.revokeObjectURL(url) }
70
+ audio.play().catch(() => { URL.revokeObjectURL(url) })
71
+ } catch (e) { /* autoplay policy or decode */ }
72
+ }
73
+
74
+ async function pollPending() {
75
+ try {
76
+ const st = await fetch('/dsh-tts/status', { cache: 'no-store' })
77
+ if (!st.ok) return
78
+ const meta = await st.json()
79
+ player.enabled = !!(meta && meta.speakReplies)
80
+ if (!player.enabled) return
81
+ const res = await fetch('/dsh-tts/pending?after=' + encodeURIComponent(player.after || ''), { cache: 'no-store' })
82
+ if (!res.ok) return
83
+ const data = await res.json()
84
+ const items = data && Array.isArray(data.items) ? data.items : []
85
+ for (let i = 0; i < items.length; i++) {
86
+ const item = items[i]
87
+ player.after = item.id
88
+ playItem(item)
89
+ }
90
+ } catch (e) { /* host restarting */ }
91
+ }
92
+
93
+ function credOf(map, provider) {
94
+ return (map && map[provider]) || { configured: false, writable: true, ref: '' }
95
+ }
96
+
97
+ function ChainEditor(props) {
98
+ const rows = Array.isArray(props.value) ? props.value : []
99
+ const change = (i, patch) => {
100
+ const next = rows.map((r, k) => (k === i ? Object.assign({}, r, patch) : r))
101
+ props.onChange(next)
102
+ }
103
+ const move = (i, delta) => {
104
+ const j = i + delta
105
+ if (j < 0 || j >= rows.length) return
106
+ const next = rows.slice()
107
+ const tmp = next[i]; next[i] = next[j]; next[j] = tmp
108
+ props.onChange(next)
109
+ }
110
+ const remove = (i) => props.onChange(rows.filter((_, k) => k !== i))
111
+ const add = () => props.onChange(rows.concat([{ provider: 'espeak', model: '', voice: '' }]))
112
+ return React.createElement('div', { className: 'dts-block' },
113
+ rows.map((row, i) => {
114
+ const cloud = !!CLOUD[row.provider]
115
+ const cred = credOf(props.credentials, row.provider)
116
+ const draft = (props.keyDrafts && props.keyDrafts[row.provider]) || ''
117
+ const badge = !cloud ? null
118
+ : (!cred.writable ? 'Set in environment' : (cred.configured ? 'Configured' : 'Not set'))
119
+ return React.createElement('div', { className: 'dts-entry', key: i },
120
+ React.createElement('div', { className: 'dts-row' },
121
+ React.createElement('select', {
122
+ value: row.provider, disabled: !props.writable,
123
+ onChange: (e) => change(i, { provider: e.target.value }),
124
+ }, PROVIDERS.map((p) => React.createElement('option', { key: p, value: p }, p))),
125
+ React.createElement('input', {
126
+ className: 'dts-model', value: row.model || '', disabled: !props.writable,
127
+ placeholder: MODEL_HINT[row.provider] || '', onChange: (e) => change(i, { model: e.target.value }),
128
+ }),
129
+ React.createElement('input', {
130
+ className: 'dts-model', value: row.voice || '', disabled: !props.writable,
131
+ placeholder: 'voice', onChange: (e) => change(i, { voice: e.target.value }),
132
+ }),
133
+ React.createElement('button', { type: 'button', className: 'dts-mini', title: 'Up', disabled: !props.writable, onClick: () => move(i, -1) }, '\u2191'),
134
+ React.createElement('button', { type: 'button', className: 'dts-mini', title: 'Down', disabled: !props.writable, onClick: () => move(i, 1) }, '\u2193'),
135
+ React.createElement('button', { type: 'button', className: 'dts-mini', title: 'Remove', disabled: !props.writable, onClick: () => remove(i) }, '\u00d7'),
136
+ ),
137
+ cloud ? React.createElement('div', { className: 'dts-row' },
138
+ React.createElement('input', {
139
+ className: 'dts-key', type: 'password', autoComplete: 'off',
140
+ value: draft, disabled: !props.writable || !cred.writable,
141
+ placeholder: cred.configured ? 'leave blank to keep' : 'paste API key',
142
+ onChange: (e) => props.onDraft(row.provider, e.target.value),
143
+ onBlur: (e) => props.onCommitKey(row.provider, e.target.value),
144
+ }),
145
+ React.createElement('span', { className: 'dts-badge' + (cred.configured ? ' dts-badge-on' : '') }, badge),
146
+ cred.configured && cred.writable ? React.createElement('button', {
147
+ type: 'button', className: 'dts-link', disabled: !props.writable,
148
+ onClick: () => props.onClearKey(row.provider),
149
+ }, 'Clear') : null,
150
+ ) : React.createElement('span', { className: 'dts-sub' }, 'Local / CLI provider — no API key'),
151
+ cloud && cred.ref ? React.createElement('span', { className: 'dts-sub' }, 'Stored as ' + cred.ref) : null,
152
+ )
153
+ }),
154
+ React.createElement('div', { className: 'dts-row' },
155
+ React.createElement('button', { type: 'button', className: 'dts-mini', title: 'Add provider', disabled: !props.writable, onClick: add }, '+'),
156
+ React.createElement('span', { className: 'dts-sub' }, 'Top to bottom is the fallback order. Cloud keys are saved to the host credentials store, never into plugin settings.'),
157
+ ),
158
+ )
159
+ }
160
+
161
+ function TtsSection() {
162
+ const [draft, setDraft] = React.useState(null)
163
+ const [credentials, setCredentials] = React.useState({})
164
+ const [keyDrafts, setKeyDrafts] = React.useState({})
165
+ const [saved, setSaved] = React.useState(false)
166
+ const [err, setErr] = React.useState('')
167
+ const writable = true
168
+
169
+ const applyPayload = (data) => {
170
+ const cfg = data && data.config ? data.config : {}
171
+ setDraft(JSON.parse(JSON.stringify(cfg)))
172
+ setCredentials(data && data.credentials ? data.credentials : {})
173
+ player.enabled = !!cfg.speakReplies
174
+ }
175
+
176
+ React.useEffect(() => {
177
+ let alive = true
178
+ fetch('/dsh-tts/config', { cache: 'no-store' }).then((res) => res.json()).then((data) => {
179
+ if (!alive) return
180
+ applyPayload(data)
181
+ }).catch((e) => { if (alive) setErr(String(e && e.message ? e.message : e)) })
182
+ return () => { alive = false }
183
+ }, [])
184
+
185
+ if (!draft) return React.createElement('div', { className: 'dts-wrap' }, 'Loading\u2026')
186
+
187
+ const setTop = (key, v) => setDraft((d) => Object.assign({}, d || {}, { [key]: v }))
188
+ const setDraftKey = (provider, value) => setKeyDrafts((d) => Object.assign({}, d, { [provider]: value }))
189
+
190
+ const commitKey = async (provider, raw) => {
191
+ const value = String(raw != null ? raw : ((keyDrafts && keyDrafts[provider]) || '')).trim()
192
+ if (!value) return
193
+ setErr('')
194
+ const res = await fetch('/dsh-tts/credential', {
195
+ method: 'PUT',
196
+ headers: { 'Content-Type': 'application/json' },
197
+ body: JSON.stringify({ provider: provider, value: value }),
198
+ })
199
+ const data = await res.json().catch(() => ({}))
200
+ if (!res.ok) throw new Error((data && data.error && data.error.message) || ('HTTP ' + res.status))
201
+ if (data && data.credentials) setCredentials(data.credentials)
202
+ setKeyDrafts((d) => Object.assign({}, d, { [provider]: '' }))
203
+ }
204
+
205
+ const clearKey = async (provider) => {
206
+ setErr('')
207
+ try {
208
+ const res = await fetch('/dsh-tts/credential', {
209
+ method: 'DELETE',
210
+ headers: { 'Content-Type': 'application/json' },
211
+ body: JSON.stringify({ provider: provider }),
212
+ })
213
+ const data = await res.json().catch(() => ({}))
214
+ if (!res.ok) throw new Error((data && data.error && data.error.message) || ('HTTP ' + res.status))
215
+ if (data && data.credentials) setCredentials(data.credentials)
216
+ setKeyDrafts((d) => Object.assign({}, d, { [provider]: '' }))
217
+ } catch (e) { setErr(String(e && e.message ? e.message : e)) }
218
+ }
219
+
220
+ const save = async () => {
221
+ setErr(''); setSaved(false)
222
+ if (!draft) return
223
+ try {
224
+ const keys = {}
225
+ Object.keys(keyDrafts || {}).forEach((p) => {
226
+ const v = String(keyDrafts[p] || '').trim()
227
+ if (v) keys[p] = v
228
+ })
229
+ const res = await fetch('/dsh-tts/config', {
230
+ method: 'PUT',
231
+ headers: { 'Content-Type': 'application/json' },
232
+ body: JSON.stringify(Object.assign({}, draft, { keys: keys })),
233
+ })
234
+ const data = await res.json().catch(() => ({}))
235
+ if (!res.ok) throw new Error((data && data.error && data.error.message) || ('HTTP ' + res.status))
236
+ applyPayload(data)
237
+ setKeyDrafts({})
238
+ setSaved(true); setTimeout(() => setSaved(false), 2000)
239
+ } catch (e) { setErr(String(e && e.message ? e.message : e)) }
240
+ }
241
+
242
+ const onCommitKey = (provider, raw) => {
243
+ commitKey(provider, raw).catch((e) => setErr(String(e && e.message ? e.message : e)))
244
+ }
245
+
246
+ const textField = (key, label, hint) => React.createElement('label', { className: 'dts-field' }, label,
247
+ React.createElement('input', {
248
+ value: draft && draft[key] !== undefined ? draft[key] : '', disabled: !writable,
249
+ onChange: (e) => setTop(key, e.target.value),
250
+ }),
251
+ React.createElement('span', { className: 'dts-sub' }, hint))
252
+
253
+ return React.createElement('div', { className: 'dts-wrap' },
254
+ React.createElement('div', { className: 'dts-block' },
255
+ React.createElement('div', { className: 'dts-h' }, 'Speech'),
256
+ React.createElement('label', { className: 'dts-row' },
257
+ React.createElement('input', {
258
+ type: 'checkbox', checked: !!(draft && draft.speakReplies), disabled: !writable,
259
+ onChange: (e) => setTop('speakReplies', e.target.checked),
260
+ }),
261
+ React.createElement('span', null, 'Speak agent replies'),
262
+ ),
263
+ React.createElement('div', { className: 'dts-sub' },
264
+ 'When on, each finished reply is synthesized on the host and played in this browser. Audio is not sent back to the model.'),
265
+ ),
266
+ React.createElement('div', { className: 'dts-block' },
267
+ React.createElement('div', { className: 'dts-h' }, 'Provider chain'),
268
+ React.createElement('div', { className: 'dts-sub' },
269
+ 'Pick a provider, paste its API key, and Save (or leave the key field). The key is written to the host credentials store immediately. The browser never reads it back.'),
270
+ React.createElement(ChainEditor, {
271
+ value: draft && draft.chain ? draft.chain : [], writable: writable,
272
+ credentials: credentials, keyDrafts: keyDrafts,
273
+ onChange: (v) => setTop('chain', v),
274
+ onDraft: setDraftKey,
275
+ onCommitKey: onCommitKey,
276
+ onClearKey: clearKey,
277
+ }),
278
+ ),
279
+ React.createElement('div', { className: 'dts-block' },
280
+ React.createElement('div', { className: 'dts-h' }, 'General'),
281
+ textField('language', 'Language', 'Hint for voices that need a locale (eSpeak, Azure SSML).'),
282
+ textField('piperModel', 'Piper model path', 'Absolute path to an ONNX model. Leave empty to skip Piper.'),
283
+ textField('piperBin', 'Piper binary', 'Looked up in PATH unless absolute.'),
284
+ textField('espeakBin', 'eSpeak binary', 'Usually espeak-ng.'),
285
+ textField('edgeBin', 'edge-tts binary', 'Python CLI from the edge-tts package.'),
286
+ textField('azureRegion', 'Azure region', 'Required for the azure provider, e.g. eastus.'),
287
+ ),
288
+ React.createElement('div', { className: 'dts-row' },
289
+ React.createElement('button', { type: 'button', className: 'dts-save', disabled: !writable, onClick: save }, 'Save'),
290
+ saved ? React.createElement('span', { className: 'dts-ok' }, 'Saved') : null,
291
+ err ? React.createElement('span', { className: 'dts-bad' }, err) : null,
292
+ ),
293
+ )
294
+ }
295
+
296
+ function registerSettings(ctx) {
297
+ ctx.slots.inject('settings.section', () => ctx.slots.register(
298
+ { name: 'settings.section', id: '@goodandready/dsh-tts', order: 32, label: () => 'Speech', inject: () => ({ ctx: ctx }) },
299
+ TtsSection,
300
+ ))
301
+ }
302
+
303
+ exports.inject = ['slots']
304
+ exports.apply = function apply(ctx) {
305
+ registerSettings(ctx)
306
+ setInterval(pollPending, 1000)
307
+ }
308
+ return module.exports
309
+ },
310
+ })