@goodandready/dsh-voice 0.9.58 → 0.9.59
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 +3 -3
- package/README.ru.md +2 -2
- package/README.zh.md +1 -1
- package/lib/host-routes.js +56 -0
- package/lib/http-util.js +1 -1
- package/lib/index.js +2 -1
- package/lib/provider-registry.js +41 -0
- package/lib/server-routes.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ graph LR
|
|
|
73
73
|
---
|
|
74
74
|
|
|
75
75
|
## ✨ Key Features
|
|
76
|
-
- 🎙️ **
|
|
76
|
+
- 🎙️ **5 Dictation Post-Processing Modes (#264, #346)**: Verbatim (0 LLM calls, raw STT), Clean text (punctuation & filler removal), Agent task (structured problem/goals/criteria), Bug report (structured problem/repro steps/expected), and Note (key thoughts & actions). Customizable prompt templates with 1-click default restore.
|
|
77
77
|
- ⚡ **Dynamic Context-Aware Lexicon Boosting (#167)**: Gathers technical identifiers, code tokens, and vocabulary from composer drafts, recent chat history, and open code blocks, passing them as hints to Deepgram (`&keywords=...`), Groq, local-whisper, and SenseVoice.
|
|
78
78
|
- 🎯 **Voice Action Macros (#167)**: User-defined spoken trigger phrases (e.g. "review code", "run tests") expand into structured prompt templates with `{text}` argument replacement.
|
|
79
79
|
|
|
@@ -101,7 +101,7 @@ graph LR
|
|
|
101
101
|
|
|
102
102
|
---
|
|
103
103
|
|
|
104
|
-
## 📝
|
|
104
|
+
## 📝 Architecture & Features (0.9.x)
|
|
105
105
|
|
|
106
106
|
10-point feature epic & SenseVoice 1-Click Installer (Issue #129):
|
|
107
107
|
|
|
@@ -235,7 +235,7 @@ Open **Settings → Plugins → Plugin settings → Voice** in the Web UI:
|
|
|
235
235
|
Registers `transcribe_audio(file_path, language?)` in `ctx.tools`, allowing agents to analyze audio files, interview recordings, and voice notes directly from disk. Path containment is strictly enforced against allowed directories (`allowedAudioDirs`, `~/.dsh`, `tmpdir`, `cwd`) with symlink traversal escape prevention and magic-byte audio format validation.
|
|
236
236
|
|
|
237
237
|
### Internal HTTP & WebSocket Endpoints
|
|
238
|
-
* `
|
|
238
|
+
* `WebSocket /dsh-voice/ws/stream` — RFC 6455 WebSocket streaming channel (HTTP Upgrade) for real-time dictation with interim transcription previews (`{ type: 'interim', text }`) and final transcript dispatch (`{ type: 'final', text, action, provider }`). Authenticated via `hasSameOrigin` or `x-dsh-voice-token` (#282, #292).
|
|
239
239
|
* `POST /dsh-voice/transcribe` — `{ dataBase64, mimeType, mode }` → `{ ok, text, provider, tookMs }`
|
|
240
240
|
* `POST /dsh-voice/polish` — `{ text }` → `{ ok, text }`
|
|
241
241
|
* `GET /dsh-voice/status` — Returns daemon status, active chains, SenseVoice and `effectiveSensevoiceProvider`. Emits `sessionToken` exclusively to verified same-origin callers (#292).
|
package/README.ru.md
CHANGED
|
@@ -73,7 +73,7 @@ graph LR
|
|
|
73
73
|
---
|
|
74
74
|
|
|
75
75
|
## ✨ Ключевые возможности
|
|
76
|
-
- 🎙️ **
|
|
76
|
+
- 🎙️ **5 режимов диктовки (#264, #346)**: «Дословно» (0 вызовов LLM, чистый STT), «Чистый текст» (пунктуация и удаление мусорных слов), «Задача агенту» (структурированная формулировка проблемы, целей и критериев), «Отчёт о баге» (структурированные шаги воспроизведения и ошибки) и «Заметка» (ключевые мысли и задачи). Настраиваемые шаблоны с кнопкой сброса к стандартам.
|
|
77
77
|
- ⚡ **Контекстный бустинг лексикона (#167)**: сбор терминов и идентификаторов из активного черновика, последних сообщений чата и блоков кода в DOM, с передачей в Deepgram (`&keywords`), Groq (`prompt`), local-whisper и SenseVoice.
|
|
78
78
|
- 🎯 **Голосовые макросы (#167)**: настраиваемые шаблоны голосовых действий («сделай ревью», «запусти тесты»), автоматически раскрывающиеся в структурированные промпты с подстановкой `{text}`.
|
|
79
79
|
|
|
@@ -101,7 +101,7 @@ graph LR
|
|
|
101
101
|
|
|
102
102
|
---
|
|
103
103
|
|
|
104
|
-
## 📝
|
|
104
|
+
## 📝 Архитектура и возможности (0.9.x)
|
|
105
105
|
|
|
106
106
|
Пакет из 10 улучшений и установка SenseVoice в 1 клик (Issue #129):
|
|
107
107
|
|
package/README.zh.md
CHANGED
|
@@ -73,7 +73,7 @@ graph LR
|
|
|
73
73
|
---
|
|
74
74
|
|
|
75
75
|
## ✨ 核心亮点
|
|
76
|
-
- 🎙️ **
|
|
76
|
+
- 🎙️ **5 种听写后处理模式 (#264, #346)**:逐字直录(0 次 LLM 调用)、清爽文本(整理标点符号与语气词)、智能体任务(结构化问题、目标与验收标准)、缺陷报告(问题概要与复现步骤)、便签备忘(要点与行动项)。支持自定义提示词模板与一键重置。
|
|
77
77
|
- ⚡ **动态会话上下文词汇增强 (#167)**:自动提取输入框草稿、会话消息与代码块中的专业术语,透传给 Deepgram、Groq、local-whisper 与 SenseVoice 识别引擎。
|
|
78
78
|
- 🎯 **语音动作宏指令 (#167)**:语音短语(如“做代码审查”、“运行测试”)自动展开为带有 `{text}` 参数替换的结构化提示词模板。
|
|
79
79
|
|
package/lib/host-routes.js
CHANGED
|
@@ -5,6 +5,7 @@ import { resolveSensevoiceProvider } from './sensevoice-installer.js'
|
|
|
5
5
|
import { applyVoiceMacros } from './macros.js'
|
|
6
6
|
import { createSyntheticWav } from './wav.js'
|
|
7
7
|
import { handleWsUpgrade } from './ws-framer.js'
|
|
8
|
+
import { defaultProviderRegistry } from './providers.js'
|
|
8
9
|
|
|
9
10
|
function writeJson(res, status, obj) {
|
|
10
11
|
res.writeHead(status, { 'content-type': 'application/json' })
|
|
@@ -22,6 +23,7 @@ export function registerHostRoutes(ctx, deps) {
|
|
|
22
23
|
extractVoiceActions,
|
|
23
24
|
applyJargonDictionary,
|
|
24
25
|
KNOWN_KEYS,
|
|
26
|
+
resolveKey,
|
|
25
27
|
} = deps
|
|
26
28
|
|
|
27
29
|
const {
|
|
@@ -33,6 +35,46 @@ export function registerHostRoutes(ctx, deps) {
|
|
|
33
35
|
startSensevoice,
|
|
34
36
|
} = daemons
|
|
35
37
|
|
|
38
|
+
let cachedHealth = null
|
|
39
|
+
let cachedHealthAt = 0
|
|
40
|
+
|
|
41
|
+
async function getProviderHealth(cfg) {
|
|
42
|
+
const now = Date.now()
|
|
43
|
+
if (cachedHealth && (now - cachedHealthAt < 30000)) {
|
|
44
|
+
return cachedHealth
|
|
45
|
+
}
|
|
46
|
+
const activeKeys = new Set()
|
|
47
|
+
for (const entry of (cfg?.dictation?.chain || [])) {
|
|
48
|
+
if (entry?.provider) activeKeys.add(entry.provider)
|
|
49
|
+
}
|
|
50
|
+
for (const entry of (cfg?.message?.chain || [])) {
|
|
51
|
+
if (entry?.provider) activeKeys.add(entry.provider)
|
|
52
|
+
}
|
|
53
|
+
const health = await defaultProviderRegistry.checkHealth({ resolveKey, cfg }, { keys: Array.from(activeKeys) })
|
|
54
|
+
const customList = Array.isArray(cfg?.customProviders) ? cfg.customProviders : []
|
|
55
|
+
for (const spec of customList) {
|
|
56
|
+
const key = String(spec && spec.key || '').trim()
|
|
57
|
+
if (key && activeKeys.has(key) && !health[key]) {
|
|
58
|
+
const configured = Boolean(spec.baseURL && spec.model)
|
|
59
|
+
let hasKey = true
|
|
60
|
+
if (spec.keyEnv) {
|
|
61
|
+
const k = await resolveKey?.(spec.keyEnv)
|
|
62
|
+
hasKey = Boolean(k)
|
|
63
|
+
}
|
|
64
|
+
health[key] = {
|
|
65
|
+
key,
|
|
66
|
+
configured,
|
|
67
|
+
hasKey,
|
|
68
|
+
ok: configured && hasKey,
|
|
69
|
+
reason: !configured ? 'missing baseURL or model' : (!hasKey ? `no ${spec.keyEnv}` : null),
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
cachedHealth = health
|
|
74
|
+
cachedHealthAt = now
|
|
75
|
+
return health
|
|
76
|
+
}
|
|
77
|
+
|
|
36
78
|
ctx.effect(() => ctx.webServer.register({
|
|
37
79
|
kind: 'exact',
|
|
38
80
|
path: '/dsh-voice/status',
|
|
@@ -44,6 +86,7 @@ export function registerHostRoutes(ctx, deps) {
|
|
|
44
86
|
const sensevoiceOk = await sensevoiceAlive()
|
|
45
87
|
const whisperError = whisperOk ? null : getWhisperError()
|
|
46
88
|
const sensevoiceError = sensevoiceOk ? null : getSensevoiceError()
|
|
89
|
+
const providerHealth = await getProviderHealth(cfg)
|
|
47
90
|
writeJson(res, 200, {
|
|
48
91
|
ok: true,
|
|
49
92
|
sessionToken: hasSameOrigin(req) ? getVoiceSessionToken() : null,
|
|
@@ -106,6 +149,7 @@ export function registerHostRoutes(ctx, deps) {
|
|
|
106
149
|
vadEngine: cfg.vadEngine || 'silero',
|
|
107
150
|
streamingWs: cfg.streamingWs !== false,
|
|
108
151
|
voiceMacros: Array.isArray(cfg.voiceMacros) ? cfg.voiceMacros : [],
|
|
152
|
+
providerHealth,
|
|
109
153
|
providerStats: statsTracker.get(),
|
|
110
154
|
recentDiagnostics: typeof statsTracker.getDiagnostics === 'function' ? statsTracker.getDiagnostics() : [],
|
|
111
155
|
})
|
|
@@ -379,6 +423,18 @@ export function registerHostRoutes(ctx, deps) {
|
|
|
379
423
|
},
|
|
380
424
|
}), 'dsh-voice: /transcribe route')
|
|
381
425
|
|
|
426
|
+
ctx.effect(() => ctx.webServer.register({
|
|
427
|
+
kind: 'exact',
|
|
428
|
+
path: '/dsh-voice/providers/health',
|
|
429
|
+
handler: async (req, res) => {
|
|
430
|
+
if (req.method !== 'GET') { writeJson(res, 405, { ok: false, error: { code: 'method', message: 'GET only' } }); return }
|
|
431
|
+
if (!isTrustedCaller(req)) { writeJson(res, 403, { ok: false, error: { code: 'forbidden', message: 'forbidden source origin' } }); return }
|
|
432
|
+
const cfg = live()
|
|
433
|
+
const health = await getProviderHealth(cfg)
|
|
434
|
+
writeJson(res, 200, { ok: true, health })
|
|
435
|
+
},
|
|
436
|
+
}), 'dsh-voice: provider health route')
|
|
437
|
+
|
|
382
438
|
ctx.effect(() => ctx.webServer.register({
|
|
383
439
|
kind: 'exact',
|
|
384
440
|
path: '/dsh-voice/vad/status',
|
package/lib/http-util.js
CHANGED
|
@@ -237,7 +237,7 @@ export function hasSameOrigin(req) {
|
|
|
237
237
|
// DeepSeek Desktop shell or authenticated DSH session on loopback/same-host
|
|
238
238
|
const remote = req.socket?.remoteAddress || req.connection?.remoteAddress || ''
|
|
239
239
|
if (isDesktopShellRequest(req)) return true
|
|
240
|
-
if (hasDshAuthCookie(req) &&
|
|
240
|
+
if (hasDshAuthCookie(req) && isLoopback(remote)) return true
|
|
241
241
|
|
|
242
242
|
return false
|
|
243
243
|
}
|
package/lib/index.js
CHANGED
|
@@ -61,13 +61,14 @@ export function apply(ctx, baseConfig) {
|
|
|
61
61
|
triggerAutostart()
|
|
62
62
|
|
|
63
63
|
const statsTracker = createStatsTracker()
|
|
64
|
-
const { transcribe, polishText } = createServerPipeline({ ctx, live, statsTracker })
|
|
64
|
+
const { resolveKey, transcribe, polishText } = createServerPipeline({ ctx, live, statsTracker })
|
|
65
65
|
|
|
66
66
|
registerServerRoutes(ctx, {
|
|
67
67
|
NS,
|
|
68
68
|
live,
|
|
69
69
|
daemons,
|
|
70
70
|
statsTracker,
|
|
71
|
+
resolveKey,
|
|
71
72
|
transcribe,
|
|
72
73
|
polishText,
|
|
73
74
|
getSettingsService: () => settingsService,
|
package/lib/provider-registry.js
CHANGED
|
@@ -339,6 +339,14 @@ export class OpenAICompatibleProvider extends SpeechToTextProvider {
|
|
|
339
339
|
return { valid: true }
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
+
async healthcheck({ resolveKey } = {}) {
|
|
343
|
+
if (this.spec?.keyEnv) {
|
|
344
|
+
const key = await resolveKey?.(this.spec.keyEnv)
|
|
345
|
+
if (!key) return { ok: false, reason: `no ${this.spec.keyEnv}` }
|
|
346
|
+
}
|
|
347
|
+
return { ok: true }
|
|
348
|
+
}
|
|
349
|
+
|
|
342
350
|
async transcribe(deps, req) {
|
|
343
351
|
const { resolveKey, fetchImpl } = deps
|
|
344
352
|
const { bytes, mime, lang, signal, models, effectivePrompt } = req
|
|
@@ -456,6 +464,39 @@ export class ProviderRegistry {
|
|
|
456
464
|
return Array.from(this.providers.keys())
|
|
457
465
|
}
|
|
458
466
|
|
|
467
|
+
/**
|
|
468
|
+
* Check configuration and health for providers (#347).
|
|
469
|
+
* @param {{ resolveKey?: Function, cfg?: object }} deps
|
|
470
|
+
* @param {{ keys?: string[] }} [options]
|
|
471
|
+
* @returns {Promise<Record<string, { key: string, configured: boolean, hasKey: boolean, ok: boolean, reason: string|null }>>}
|
|
472
|
+
*/
|
|
473
|
+
async checkHealth(deps = {}, options = {}) {
|
|
474
|
+
const { resolveKey, cfg } = deps
|
|
475
|
+
const keysToCheck = options.keys || this.keys()
|
|
476
|
+
const result = {}
|
|
477
|
+
for (const key of keysToCheck) {
|
|
478
|
+
const provider = this.get(key)
|
|
479
|
+
if (!provider) continue
|
|
480
|
+
const validRes = typeof provider.validateConfig === 'function' ? provider.validateConfig(cfg) : { valid: true }
|
|
481
|
+
let hcRes = { ok: true }
|
|
482
|
+
if (typeof provider.healthcheck === 'function') {
|
|
483
|
+
try {
|
|
484
|
+
hcRes = await provider.healthcheck({ resolveKey, cfg })
|
|
485
|
+
} catch (err) {
|
|
486
|
+
hcRes = { ok: false, reason: String(err?.message || err) }
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
result[key] = {
|
|
490
|
+
key,
|
|
491
|
+
configured: Boolean(validRes.valid),
|
|
492
|
+
hasKey: Boolean(hcRes.ok),
|
|
493
|
+
ok: Boolean(validRes.valid && hcRes.ok),
|
|
494
|
+
reason: (!validRes.valid ? validRes.reason : hcRes.reason) || null,
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return result
|
|
498
|
+
}
|
|
499
|
+
|
|
459
500
|
/**
|
|
460
501
|
* Build execution runners for runChain(), applying presets and customProviders.
|
|
461
502
|
*/
|
package/lib/server-routes.js
CHANGED
|
@@ -14,6 +14,7 @@ export function registerServerRoutes(ctx, deps) {
|
|
|
14
14
|
live,
|
|
15
15
|
daemons,
|
|
16
16
|
statsTracker,
|
|
17
|
+
resolveKey,
|
|
17
18
|
transcribe,
|
|
18
19
|
polishText,
|
|
19
20
|
getSettingsService,
|
|
@@ -27,6 +28,7 @@ export function registerServerRoutes(ctx, deps) {
|
|
|
27
28
|
live,
|
|
28
29
|
daemons,
|
|
29
30
|
statsTracker,
|
|
31
|
+
resolveKey,
|
|
30
32
|
transcribe,
|
|
31
33
|
polishText,
|
|
32
34
|
sessionCommand,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-voice",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.59",
|
|
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",
|