@goodandready/dsh-tts 0.4.0 → 0.4.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/lib/index.js CHANGED
@@ -560,6 +560,8 @@ export function apply(ctx, config) {
560
560
  storeProviderKey,
561
561
  clearProviderKey,
562
562
  pending,
563
+ getSettingsApi: () => settingsApi,
564
+ validateConfig: (obj) => Config(obj),
563
565
  })
564
566
 
565
567
  ctx.effect(() => () => {
package/lib/routes.js CHANGED
@@ -21,6 +21,8 @@ export function registerHttpRoutes(ctx, api) {
21
21
  storeProviderKey,
22
22
  clearProviderKey,
23
23
  pending,
24
+ getSettingsApi,
25
+ validateConfig,
24
26
  } = api
25
27
  ctx.effect(() => ctx.webServer.register({
26
28
  kind: 'exact',
@@ -270,6 +272,7 @@ export function registerHttpRoutes(ctx, api) {
270
272
  writeJson(res, 403, { ok: false, error: { code: 'forbidden', message: 'dsh-tts: settings writes are same-origin only' } })
271
273
  return
272
274
  }
275
+ const settingsApi = typeof getSettingsApi === 'function' ? getSettingsApi() : null
273
276
  if (!settingsApi) {
274
277
  writeJson(res, 503, { ok: false, error: { code: 'settings', message: 'settings not ready' } })
275
278
  return
@@ -290,7 +293,7 @@ export function registerHttpRoutes(ctx, api) {
290
293
  const keys = pendingKeyWrites(payload && payload.keys)
291
294
  const stripped = stripSecretsFromConfig(payload)
292
295
  let parsed
293
- try { parsed = Config(stripped) } catch (e) {
296
+ try { parsed = validateConfig(stripped) } catch (e) {
294
297
  writeJson(res, 400, { ok: false, error: { code: 'schema', message: String(e && e.message || e) } })
295
298
  return
296
299
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-tts",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Text-to-speech for DeepSeek Harness: speak agent replies in the Web UI with a provider fallback chain (OpenAI, ElevenLabs, Google, Azure, Groq, Deepgram, OpenRouter, Edge, Piper, eSpeak).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,7 +41,9 @@
41
41
  "url": "https://github.com/GooDAnDReaDY/dsh-tts/issues"
42
42
  },
43
43
  "scripts": {
44
- "test": "node --test test/*.test.mjs"
44
+ "test": "node --test test/*.test.mjs",
45
+ "build:client": "node scripts/build-client.mjs",
46
+ "pretest": "node scripts/build-client.mjs"
45
47
  },
46
48
  "dsh": {
47
49
  "bundle": {
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ // Concatenate lib/client-src fragments into lib/client.js (single ModuleLoader entry).
3
+ import { readdir, readFile, writeFile } from 'node:fs/promises'
4
+ import path from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+
7
+ const root = path.dirname(path.dirname(fileURLToPath(import.meta.url)))
8
+ const srcDir = path.join(root, 'lib', 'client-src')
9
+ const outFile = path.join(root, 'lib', 'client.js')
10
+
11
+ const files = (await readdir(srcDir)).filter((f) => f.endsWith('.js')).sort()
12
+ if (files.length === 0) throw new Error('no client-src fragments')
13
+ let out = ''
14
+ for (const f of files) {
15
+ out += await readFile(path.join(srcDir, f), 'utf8')
16
+ if (!out.endsWith('\n')) out += '\n'
17
+ }
18
+ await writeFile(outFile, out, 'utf8')
19
+ console.log(`built lib/client.js from ${files.length} fragments (${out.length} bytes)`)