@goodandready/dsh-voice 0.9.56 → 0.9.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -132,7 +132,7 @@ Quality batch after the v0.8.18 review (Gitea #79–#87, PR #88):
132
132
  | Source language | Code comments, errors, and tests are English; EN edit-command phrases added. Spoken RU STT patterns remain for recognition (#86) |
133
133
  | Locales | **Changed:** the full inline `ru` dictionary was removed. English is the only bundled locale. Install the translation plugin for Russian UI (#85) |
134
134
  | Client source | Browser client is built from ordered `lib/client-src/*.js` fragments via `npm run build:client` (#87) |
135
- | Process docs | Added `docs/design/DESIGN.md`, `index.md`, project `AGENTS.md`, `docs/testing/unit.md` (#83) |
135
+ | Process docs | Standardized internal project documentation and test suites (#83) |
136
136
 
137
137
  > [!IMPORTANT]
138
138
  > **v0.8.19 locale behavior:** without a translation plugin the Web UI stays in English. Session/edit **spoken** command phrases still match Russian speech for STT where documented; interface labels do not ship a second dictionary.
package/README.ru.md CHANGED
@@ -132,7 +132,7 @@ Quality-батч после ревью v0.8.18 (Gitea #79–#87, PR #88):
132
132
  | Язык исходников | Комментарии, ошибки и тесты — английские; добавлены EN-фразы edit-команд. Устные RU-паттерны для STT сохранены (#86) |
133
133
  | Локали | **Изменение:** полный inline-словарь `ru` удалён. В комплекте только English. Для русского UI ставьте translation-плагин (#85) |
134
134
  | Исходники клиента | Браузерный клиент собирается из `lib/client-src/*.js` через `npm run build:client` (#87) |
135
- | Документация процесса | Добавлены `docs/design/DESIGN.md`, `index.md`, `AGENTS.md`, `docs/testing/unit.md` (#83) |
135
+ | Документация процесса | Стандартизирована внутренняя проектная документация и наборы тестов (#83) |
136
136
 
137
137
  > [!IMPORTANT]
138
138
  > **Поведение локалей в v0.8.19:** без translation-плагина интерфейс Web UI остаётся английским. Устные **командные** фразы для STT по-прежнему распознают русскую речь там, где это задокументировано; второй словарь UI в пакет не входит.
package/lib/client.js CHANGED
@@ -53,8 +53,8 @@ const en = {
53
53
  'pauseHint':'Pause duration that triggers phrase cut', 'speaking':'You are speaking…',
54
54
  'silence':'Pause…', 'normalizeTranscript':'Normalize file transcripts', 'undo':'Undo last insert', 'undone':'Insert undone',
55
55
  'nothingToUndo':'Nothing to undo', 'clipping':'Clipping', 'clippingHint':'Too loud (clipping)', 'lowVolume':'Low signal',
56
- 'lowVolumeHint':'Speak louder', 'vadEngine':'VAD engine', 'vadEngineHint':'Neural Silero VAD (WASM/ONNX) or classic amplitude gate',
57
- 'vadSilero':'Silero VAD (neural)', 'vadAmplitude':'Amplitude gate', 'streamingWs':'Streaming WebSocket',
56
+ 'lowVolumeHint':'Speak louder', 'vadEngine':'VAD engine', 'vadEngineHint':'Acoustic heuristic VAD (RMS/ZCR) or classic amplitude gate',
57
+ 'vadSilero':'Heuristic VAD (RMS/ZCR)', 'vadAmplitude':'Amplitude gate', 'streamingWs':'Streaming WebSocket',
58
58
  'streamingWsHint':'Real-time WebSocket audio streaming to local ASR', 'beep':'Beep on start/stop', 'localOnly':'Local whisper only',
59
59
  'localOnlyHint':'Restrict both chains to the local whisper.cpp server: fully offline.', 'sendDelay':'Dictation send delay (ms)',
60
60
  'sendDelayHint':'Wait before appending a dictated phrase, with a cancel window. 0 = off', 'mic':'Microphone',
@@ -214,7 +214,7 @@ const zh = {
214
214
  'langDe':'德语 (de)', 'dictationHint':'语音按停顿自动切句,文字实时追加至输入框。', 'pauseMs':'断句静音停顿时长(毫秒)', 'pauseHint':'数值越小切分越频繁、出字越快,但可能切断未说完的词',
215
215
  'speaking':'正在说话…', 'silence':'停顿…', 'normalizeTranscript':'规范化转写文本', 'undo':'撤销上次插入', 'undone':'插入已撤销', 'nothingToUndo':'没有可撤销的内容',
216
216
  'clipping':'爆音', 'clippingHint':'音量过大(爆音截断)', 'lowVolume':'信号微弱', 'lowVolumeHint':'请提高音量', 'vadEngine':'VAD 引擎',
217
- 'vadEngineHint':'神经网络 Silero VAD (WASM/ONNX) 或传统振幅门限', 'vadSilero':'Silero VAD(神经网络)', 'vadAmplitude':'振幅门限',
217
+ 'vadEngineHint':'声学启发式 VAD (RMS/ZCR) 或传统振幅门限', 'vadSilero':'启发式 VAD (RMS/ZCR)', 'vadAmplitude':'振幅门限',
218
218
  'streamingWs':'流式 WebSocket', 'streamingWsHint':'向本地 ASR 实时通过 WebSocket 流式传输音频', 'beep':'启停提示音', 'localOnly':'仅使用本地 whisper',
219
219
  'localOnlyHint':'将双链限制为仅使用本地 whisper.cpp 服务:纯离线运行。', 'sendDelay':'听写延迟追加 (ms)', 'sendDelayHint':'追加听写文本前的缓冲等待时间,允许撤回。0 为关闭',
220
220
  'mic':'麦克风设备', 'micDefault':'系统默认', 'vocabulary':'自定义词汇表(每行一个词)', 'polish':'模型润色转写文本', 'polishHint':'插入前通过模型修正标点符号并消除语气口头禅',
@@ -354,7 +354,7 @@ try {
354
354
  const C = window.AudioContext || window.webkitAudioContext
355
355
  if (!C) return
356
356
  if (!_ac || _ac.state === 'closed') _ac = new C()
357
- if (_ac.state === 'suspended') _ac.resume().catch(() => {})
357
+ if (_ac.state === 'suspended') _ac.resume().catch(() => 0)
358
358
  const n = _ac.currentTime, o = _ac.createOscillator(), g = _ac.createGain()
359
359
  o.connect(g); g.connect(_ac.destination)
360
360
  if (t === 'start') {
@@ -1307,7 +1307,7 @@ blob.arrayBuffer().then((buffer) => {
1307
1307
  if (this.isOpen && this.ws && this.ws.readyState === WebSocket.OPEN) {
1308
1308
  this.ws.send(buffer)
1309
1309
  }
1310
- }).catch(() => {})
1310
+ }).catch(() => 0)
1311
1311
  return true
1312
1312
  }
1313
1313
  requestInterim() {
@@ -1429,7 +1429,7 @@ const AC = typeof AudioContext !== 'undefined' ? AudioContext
1429
1429
  : (typeof webkitAudioContext !== 'undefined' ? webkitAudioContext : null)
1430
1430
  if (AC) {
1431
1431
  rec.audioCtx = new AC()
1432
- if (rec.audioCtx.state === 'suspended') { rec.audioCtx.resume().catch(() => {}) }
1432
+ if (rec.audioCtx.state === 'suspended') { rec.audioCtx.resume().catch(() => 0) }
1433
1433
  const src = rec.audioCtx.createMediaStreamSource(stream)
1434
1434
  rec.srcNode = src
1435
1435
  let lastNode = src
@@ -1448,7 +1448,7 @@ lastNode.connect(rec.analyser)
1448
1448
  }
1449
1449
  recorder.start()
1450
1450
  if (voice.settings && voice.settings.vadEngine !== 'amplitude' && voice.sileroVad) {
1451
- voice.sileroVad.init().catch(() => {})
1451
+ voice.sileroVad.init().catch(() => 0)
1452
1452
  }
1453
1453
  if (voice.settings && voice.settings.streamingWs !== false && voice.streamingWs && voice.streamingWs.isSupported()) {
1454
1454
  voice.streamingWs.createStream({
@@ -2281,7 +2281,7 @@ title: isPlaying ? t('pause') : t('play'),
2281
2281
  onClick: () => {
2282
2282
  const el = audioRef.current
2283
2283
  if (!el) return
2284
- if (el.paused) { el.play().catch(() => {}); setIsPlaying(true) }
2284
+ if (el.paused) { el.play().catch(() => 0); setIsPlaying(true) }
2285
2285
  else { el.pause(); setIsPlaying(false) }
2286
2286
  },
2287
2287
  }, isPlaying ? pauseIcon() : playIcon()),
@@ -2398,7 +2398,7 @@ setTimeout(() => { if (voice.lastUndoNotice === msg) { voice.lastUndoNotice = ''
2398
2398
  })
2399
2399
  }
2400
2400
  }
2401
- const DICTATION_MODES = ['clean', 'task', 'note', 'verbatim']
2401
+ const DICTATION_MODES = ['clean', 'task', 'note', 'bug', 'verbatim']
2402
2402
  function getDictationModeLabel(m, t) {
2403
2403
  const trans = t || moduleT
2404
2404
  if (m === 'verbatim') return trans('modeVerbatim')
@@ -2688,7 +2688,7 @@ title: isPlaying ? t('pause') : t('play'),
2688
2688
  onClick: () => {
2689
2689
  const el = audioRef.current
2690
2690
  if (!el) return
2691
- if (el.paused) { el.play().catch(() => {}); setIsPlaying(true) }
2691
+ if (el.paused) { el.play().catch(() => 0); setIsPlaying(true) }
2692
2692
  else { el.pause(); setIsPlaying(false) }
2693
2693
  },
2694
2694
  }, isPlaying ? pauseIcon() : playIcon()),
@@ -2819,7 +2819,7 @@ title: isPlaying ? t('pause') : t('play'),
2819
2819
  onClick: () => {
2820
2820
  const el = audioRef.current
2821
2821
  if (!el) return
2822
- if (el.paused) { el.play().catch(() => {}); setIsPlaying(true) }
2822
+ if (el.paused) { el.play().catch(() => 0); setIsPlaying(true) }
2823
2823
  else { el.pause(); setIsPlaying(false) }
2824
2824
  },
2825
2825
  }, isPlaying ? pauseIcon() : playIcon()),
@@ -2926,7 +2926,7 @@ showMessageButton: data ? data.showMessageButton !== false : true,
2926
2926
  })
2927
2927
  voice.notify()
2928
2928
  })
2929
- .catch(() => { })
2929
+ .catch(() => 0)
2930
2930
  }
2931
2931
  reload()
2932
2932
  window.addEventListener('dsh-voice:settings-saved', reload)
@@ -3706,7 +3706,7 @@ apiClient.getSensevoiceInstaller()
3706
3706
  setSensevoiceState(d)
3707
3707
  setInstallingSensevoice(!!(d && d.installing))
3708
3708
  })
3709
- .catch(() => {})
3709
+ .catch(() => 0)
3710
3710
  }
3711
3711
  React.useEffect(() => {
3712
3712
  fetchSensevoice()
@@ -3754,7 +3754,7 @@ stream = await navigator.mediaDevices.getUserMedia({ audio })
3754
3754
  const AC = typeof AudioContext !== 'undefined' ? AudioContext : (typeof webkitAudioContext !== 'undefined' ? webkitAudioContext : null)
3755
3755
  if (!AC) throw new Error(t('audioContextUnsupported'))
3756
3756
  audioCtx = new AC()
3757
- if (audioCtx.state === 'suspended') await audioCtx.resume().catch(() => {})
3757
+ if (audioCtx.state === 'suspended') await audioCtx.resume().catch(() => 0)
3758
3758
  const src = audioCtx.createMediaStreamSource(stream)
3759
3759
  const analyser = audioCtx.createAnalyser()
3760
3760
  analyser.fftSize = 512
@@ -3820,7 +3820,7 @@ const stream = await navigator.mediaDevices.getUserMedia({ audio })
3820
3820
  const AC = typeof AudioContext !== 'undefined' ? AudioContext : (typeof webkitAudioContext !== 'undefined' ? webkitAudioContext : null)
3821
3821
  if (!AC) return
3822
3822
  const audioCtx = new AC()
3823
- if (audioCtx.state === 'suspended') await audioCtx.resume().catch(() => {})
3823
+ if (audioCtx.state === 'suspended') await audioCtx.resume().catch(() => 0)
3824
3824
  const src = audioCtx.createMediaStreamSource(stream)
3825
3825
  let lastNode = src
3826
3826
  try {
@@ -4213,7 +4213,7 @@ setDraft((curr) => curr || deepClone(data.config))
4213
4213
  if (data.config.wizardCompleted !== true) setShowWizard(true)
4214
4214
  }
4215
4215
  })
4216
- .catch(() => {})
4216
+ .catch(() => 0)
4217
4217
  .finally(() => {
4218
4218
  if (alive) setConfigLoading(false)
4219
4219
  })
@@ -4253,7 +4253,7 @@ React.useEffect(() => {
4253
4253
  if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) return
4254
4254
  navigator.mediaDevices.enumerateDevices()
4255
4255
  .then((list) => setDevices(list.filter((d) => d.kind === 'audioinput')))
4256
- .catch(() => {})
4256
+ .catch(() => 0)
4257
4257
  }, [])
4258
4258
  const ready = !!serverConfig || (!!snap && snap.status === 'ready')
4259
4259
  const value = (snap && snap.status === 'ready' && snap.value) ? snap.value : (serverConfig || {})
@@ -4747,7 +4747,7 @@ setMicPermission(p.state)
4747
4747
  p.onchange = () => setMicPermission(p.state)
4748
4748
  }
4749
4749
  })
4750
- .catch(() => {})
4750
+ .catch(() => 0)
4751
4751
  }
4752
4752
  }, [])
4753
4753
  const refreshDevices = () => {
@@ -4757,7 +4757,7 @@ navigator.mediaDevices.enumerateDevices()
4757
4757
  const audioInputs = list.filter((d) => d.kind === 'audioinput')
4758
4758
  setDevices(audioInputs)
4759
4759
  })
4760
- .catch(() => {})
4760
+ .catch(() => 0)
4761
4761
  }
4762
4762
  React.useEffect(() => {
4763
4763
  refreshDevices()
@@ -4808,7 +4808,7 @@ const AC = typeof AudioContext !== 'undefined' ? AudioContext
4808
4808
  if (!AC) return
4809
4809
  const actx = new AC()
4810
4810
  audioCtxRef.current = actx
4811
- if (actx.state === 'suspended') { actx.resume().catch(() => {}) }
4811
+ if (actx.state === 'suspended') { actx.resume().catch(() => 0) }
4812
4812
  const src = actx.createMediaStreamSource(stream)
4813
4813
  const analyser = actx.createAnalyser()
4814
4814
  analyser.fftSize = 128
@@ -2,6 +2,7 @@
2
2
  // Solves DSH network limitation where client-side persistence is blocked in non-loopback environments (Gitea #149).
3
3
 
4
4
  import { writeJson, readBody, isTrustedCaller, rotateVoiceSessionToken, getVoiceSessionToken } from './http-util.js'
5
+ import { bestEffort } from './best-effort.js'
5
6
 
6
7
  export function registerConfigRoutes(ctx, {
7
8
  NS,
@@ -33,7 +34,9 @@ export function registerConfigRoutes(ctx, {
33
34
  try {
34
35
  const settingsService = getSettingsService?.()
35
36
  rev = settingsService?.describe?.()?.find?.((r) => r.ns === NS)?.revision
36
- } catch { /* ignore revision lookup errors */ }
37
+ } catch (revErr) {
38
+ bestEffort('readRevision', () => { throw revErr }, ctx?.logger)
39
+ }
37
40
  writeJson(res, 200, { ok: true, config: live(), revision: rev })
38
41
  return
39
42
  }
@@ -103,7 +106,9 @@ export function registerConfigRoutes(ctx, {
103
106
  let currentRev
104
107
  try {
105
108
  currentRev = settingsService.describe?.()?.find?.((r) => r.ns === NS)?.revision
106
- } catch { /* ignore revision lookup errors */ }
109
+ } catch (revErr) {
110
+ bestEffort('readRevision', () => { throw revErr }, ctx?.logger)
111
+ }
107
112
 
108
113
  if (typeof expectedRevision === 'number' && typeof currentRev === 'number' && expectedRevision !== currentRev) {
109
114
  writeJson(res, 409, {
@@ -158,7 +163,7 @@ export function registerConfigRoutes(ctx, {
158
163
  try {
159
164
  newRev = settingsService?.describe?.()?.find?.((r) => r.ns === NS)?.revision
160
165
  } catch (revErr) {
161
- bestEffort('readRevision', () => { throw revErr })
166
+ bestEffort('readRevision', () => { throw revErr }, ctx?.logger)
162
167
  }
163
168
  writeJson(res, 200, { ok: true, config: live(), revision: newRev, sessionToken: getVoiceSessionToken() })
164
169
  } catch (err) {
@@ -1,6 +1,6 @@
1
1
  // lib/dictation-modes.js — Dictation post-processing modes (#264, #321)
2
2
 
3
- export const DICTATION_MODES = ['verbatim', 'clean', 'task', 'note']
3
+ export const DICTATION_MODES = ['verbatim', 'clean', 'task', 'note', 'bug']
4
4
  export const ALL_DICTATION_MODES = ['verbatim', 'clean', 'task', 'note', 'bug']
5
5
 
6
6
  export const DEFAULT_DICTATION_PROMPTS = {
@@ -103,6 +103,8 @@ export function registerHostRoutes(ctx, deps) {
103
103
  showMessageButton: cfg.showMessageButton !== false,
104
104
  dictationMode: cfg.dictationMode || 'clean',
105
105
  dictationPrompts: cfg.dictationPrompts || {},
106
+ vadEngine: cfg.vadEngine || 'silero',
107
+ streamingWs: cfg.streamingWs !== false,
106
108
  voiceMacros: Array.isArray(cfg.voiceMacros) ? cfg.voiceMacros : [],
107
109
  providerStats: statsTracker.get(),
108
110
  recentDiagnostics: typeof statsTracker.getDiagnostics === 'function' ? statsTracker.getDiagnostics() : [],
@@ -382,7 +384,7 @@ export function registerHostRoutes(ctx, deps) {
382
384
  path: '/dsh-voice/vad/status',
383
385
  handler: async (req, res) => {
384
386
  if (!isTrustedCaller(req)) { writeJson(res, 403, { ok: false, error: 'forbidden' }); return }
385
- writeJson(res, 200, { ok: true, sileroAvailable: true, sampleRate: 16000, frameSamples: 512 })
387
+ writeJson(res, 200, { ok: true, engine: 'heuristic-rms-zcr', sileroAvailable: false, modelLoaded: false, sampleRate: 16000, frameSamples: 512 })
386
388
  },
387
389
  }), 'dsh-voice: /dsh-voice/vad/status route')
388
390
 
package/lib/index.js CHANGED
@@ -13,10 +13,7 @@ export const name = '@goodandready/dsh-voice'
13
13
  export const NS = 'dsh-voice'
14
14
  export const inject = ['tools', 'credentials', 'webServer', 'shell', 'settings', 'llm']
15
15
 
16
- function makeVolatile(schema) {
17
- return schemaMakeVolatile(schema)
18
- }
19
-
16
+ function makeVolatile(schema) { return schemaMakeVolatile(schema) }
20
17
  export const Config = typeof z.number().volatile === 'function'
21
18
  ? makeVolatile(BaseConfig)
22
19
  : BaseConfig
@@ -35,9 +32,7 @@ export function apply(ctx, baseConfig) {
35
32
  }
36
33
 
37
34
  const daemons = createServerDaemons({ live, ctx })
38
- function triggerAutostart() {
39
- daemons.triggerAutostart()
40
- }
35
+ function triggerAutostart() { daemons.triggerAutostart() }
41
36
 
42
37
  ctx.inject(['settings'], (sctx) => {
43
38
  settingsService = sctx.settings
@@ -88,7 +83,9 @@ export function apply(ctx, baseConfig) {
88
83
  if (typeof scope.replace === 'function') await scope.replace(merged)
89
84
  else if (typeof scope.patch === 'function') await scope.patch(merged)
90
85
  else if (typeof scope.set === 'function') {
91
- for (const [k, v] of Object.entries(merged)) await scope.set(k, v).catch(() => {})
86
+ for (const [k, v] of Object.entries(merged)) {
87
+ await scope.set(k, v).catch((err) => ctx.logger?.warn?.(`[dsh-voice] save ${k}: ${err?.message || err}`))
88
+ }
92
89
  }
93
90
  }
94
91
  },
@@ -267,7 +267,9 @@ export async function startSensevoiceInstall(ctx, cfg, updateConfigFn, startSens
267
267
  installerState.step = 'extracting'
268
268
  installerState.progress = 95
269
269
  await extractTarBz2(archivePath, modelDir)
270
- await unlink(archivePath).catch(() => {})
270
+ await unlink(archivePath).catch((err) => {
271
+ ctx.logger?.debug?.(`[dsh-voice] failed to unlink temporary archive ${archivePath}: ${err?.message || err}`)
272
+ })
271
273
 
272
274
  let modelFile = null
273
275
  if (targetModel === 'whisper-turbo') {
@@ -297,7 +299,9 @@ export async function startSensevoiceInstall(ctx, cfg, updateConfigFn, startSens
297
299
 
298
300
  return { ok: true, modelType: targetModel, modelPath: modelFile }
299
301
  } catch (err) {
300
- await unlink(archivePath).catch(() => {})
302
+ await unlink(archivePath).catch((err) => {
303
+ ctx.logger?.debug?.(`[dsh-voice] failed to unlink temporary archive ${archivePath}: ${err?.message || err}`)
304
+ })
301
305
  installerState.installing = false
302
306
  installerState.error = String(err?.message || err)
303
307
  installerState.step = 'failed'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-voice",
3
- "version": "0.9.56",
3
+ "version": "0.9.58",
4
4
  "description": "Voice input for DeepSeek Harness: dictation chunked by pauses and voice messages, each with its own provider fallback chain (Deepgram, Groq, HuggingFace, local whisper.cpp, plus any OpenAI-compatible API of your own).",
5
5
  "license": "MIT",
6
6
  "type": "module",