dsh-tinyasr 1.6.0 → 1.7.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/CHANGELOG.md +14 -0
- package/README.md +19 -0
- package/index.js +5 -0
- package/lib/mobile-bridge.js +66 -0
- package/lib/routes.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this plugin. Entries up to 1.11.0 are local pre-release iterations of the
|
|
4
4
|
1.0 line; the public package starts at 1.2.0.
|
|
5
5
|
|
|
6
|
+
## 1.7.1 — 6 December 2026
|
|
7
|
+
|
|
8
|
+
- `/api/tinyasr/state` reports whether the mobile voice bridge is installed, which makes the mobile
|
|
9
|
+
path verifiable from the desktop after a restart.
|
|
10
|
+
|
|
11
|
+
## 1.7.0 — 6 December 2026
|
|
12
|
+
|
|
13
|
+
- Mobile voice works with the local recognizer: the plugin bridges the DSH speech registry to the
|
|
14
|
+
call shape the mobile plugin's `host` provider expects (`resolve()` without a request and
|
|
15
|
+
`transcribe(audio, { signal })`). The provider choice on the phone stays zero-configuration, and
|
|
16
|
+
the audio never leaves the computer.
|
|
17
|
+
- `lib/mobile-bridge.js` with unit tests, including one against the real `dsh-mobile-plugin`
|
|
18
|
+
`host.js` when the plugin is installed.
|
|
19
|
+
|
|
6
20
|
## 1.6.0 — 6 December 2026
|
|
7
21
|
|
|
8
22
|
- The cleanup model is an explicit choice, not the chat's model: the default is
|
package/README.md
CHANGED
|
@@ -161,6 +161,25 @@ dsh plugin --profile <profile> add dsh-tinyasr
|
|
|
161
161
|
| Правка DeepSeek | ~1–3 с |
|
|
162
162
|
| Загрузка модели при старте процесса | ~0,12 с |
|
|
163
163
|
|
|
164
|
+
## Мобильный телефон
|
|
165
|
+
|
|
166
|
+
Голосовой ввод в мобильном приложении DSH (плагин `dsh-mobile-plugin`) по умолчанию идёт через
|
|
167
|
+
провайдера **«宿主语音识别» (host)** — то есть через распознавание, установленное на компьютере.
|
|
168
|
+
Плагин добавляет совместимость между этим провайдером и реестром речи DSH, поэтому телефон
|
|
169
|
+
использует **тот же локальный tinyasr**, что и микрофон в браузере: без облака, без ключей и без
|
|
170
|
+
отправки аудио наружу.
|
|
171
|
+
|
|
172
|
+
Порядок:
|
|
173
|
+
|
|
174
|
+
1. Подключите телефон к DSH (кнопка подключения в мобильном плагине) и откройте на телефоне
|
|
175
|
+
настройки голосового ввода.
|
|
176
|
+
2. Выберите провайдера **«宿主语音识别»** — он уже стоит по умолчанию.
|
|
177
|
+
3. Язык оставьте **auto**: движок сам определяет русский или английский (стратегия `ru-first`).
|
|
178
|
+
|
|
179
|
+
Ограничения этого пути: мобильный провайдер `host` принимает записи до 120 секунд и 8 МБ, а в
|
|
180
|
+
списке языков панели нет русского — поэтому «auto» и есть правильный выбор. Аудио обрабатывается
|
|
181
|
+
на компьютере и в облако не уходит.
|
|
182
|
+
|
|
164
183
|
## Требования
|
|
165
184
|
|
|
166
185
|
- macOS на Apple Silicon (arm64): сборка `tinyasr-cli`/`tinyasr-serve` под эту машину.
|
package/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import { Glossary } from './lib/glossary.js'
|
|
|
24
24
|
import { SettingsStore } from './lib/settings.js'
|
|
25
25
|
import { registerRoutes } from './lib/routes.js'
|
|
26
26
|
import { registerLiveRoutes } from './lib/live.js'
|
|
27
|
+
import { installMobileVoiceBridge } from './lib/mobile-bridge.js'
|
|
27
28
|
import { ResidentWorker } from './lib/worker.js'
|
|
28
29
|
|
|
29
30
|
/** Expand `~` in a configured path; a literal `~` directory is never intended. */
|
|
@@ -510,6 +511,10 @@ export function apply(ctx, config) {
|
|
|
510
511
|
const settings = new SettingsStore(resolved.settingsPath)
|
|
511
512
|
const glossary = new Glossary(resolved.glossaryPath)
|
|
512
513
|
const provider = new TinyAsrProvider(ctx, resolved, ctx.logger, { settings, glossary })
|
|
514
|
+
// Let the mobile plugin's `host` voice provider reach this recognizer.
|
|
515
|
+
const speech = typeof ctx.get === 'function' ? ctx.get('speechToText') : ctx.speechToText
|
|
516
|
+
ctx.effect(() => installMobileVoiceBridge(speech))
|
|
517
|
+
provider.mobileBridge = speech?.__tinyasrBridge === true
|
|
513
518
|
ctx.effect(() => {
|
|
514
519
|
const unregister = ctx.speechToText.register({
|
|
515
520
|
info: provider.info,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility bridge between the DSH speech registry and the mobile plugin's
|
|
3
|
+
* `host` voice provider.
|
|
4
|
+
*
|
|
5
|
+
* The mobile plugin (dsh-mobile-plugin) delegates voice recognition to the host
|
|
6
|
+
* through `ctx.speechToText` using an older shape:
|
|
7
|
+
*
|
|
8
|
+
* service.resolve() -> a provider-like object with `.id` and `.transcribe(audio, opts)`
|
|
9
|
+
* service.transcribe(audioBuffer, opts) -> `{text}`
|
|
10
|
+
*
|
|
11
|
+
* The current registry (0.2.x) instead exposes:
|
|
12
|
+
*
|
|
13
|
+
* resolve({ audio, providerId?, language? }) -> { provider, audio, language }
|
|
14
|
+
* transcribe({ provider, audio, language }, signal) -> result
|
|
15
|
+
*
|
|
16
|
+
* Without adaptation the mobile "host" provider resolves to `undefined` and its
|
|
17
|
+
* transcription call throws, so the phone silently depends on cloud providers.
|
|
18
|
+
* This wrapper accepts both shapes and never changes the registry for the other
|
|
19
|
+
* callers: a request-shaped call passes straight through.
|
|
20
|
+
*
|
|
21
|
+
* @param {object} service - the `speechToText` registry service.
|
|
22
|
+
* @returns {() => void} remover that restores the original methods.
|
|
23
|
+
*/
|
|
24
|
+
export function installMobileVoiceBridge(service) {
|
|
25
|
+
if (service === undefined || service === null) return () => {}
|
|
26
|
+
if (typeof service.resolve !== 'function' || typeof service.transcribe !== 'function') return () => {}
|
|
27
|
+
if (service.__tinyasrBridge === true) return () => {}
|
|
28
|
+
|
|
29
|
+
const originalResolve = service.resolve
|
|
30
|
+
const originalTranscribe = service.transcribe
|
|
31
|
+
const resolve = originalResolve.bind(service)
|
|
32
|
+
const transcribe = originalTranscribe.bind(service)
|
|
33
|
+
|
|
34
|
+
const signalOf = (value) => {
|
|
35
|
+
if (value instanceof AbortSignal) return value
|
|
36
|
+
if (value !== null && typeof value === 'object' && value.signal instanceof AbortSignal) return value.signal
|
|
37
|
+
return new AbortController().signal
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// What the mobile bridge believes a resolved provider looks like.
|
|
41
|
+
const legacy = {
|
|
42
|
+
get id() {
|
|
43
|
+
try { return String(service.snapshot()?.selection?.providerId ?? '') } catch { return '' }
|
|
44
|
+
},
|
|
45
|
+
get info() {
|
|
46
|
+
try { return service.snapshot()?.providers?.find(entry => entry.id === legacy.id) ?? {} } catch { return {} }
|
|
47
|
+
},
|
|
48
|
+
transcribe(audio, options) {
|
|
49
|
+
return transcribe(resolve({ audio }), signalOf(options))
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
service.resolve = (request) => (request === undefined ? legacy : resolve(request))
|
|
54
|
+
service.transcribe = (spec, signal) => {
|
|
55
|
+
const raw = ArrayBuffer.isView(spec) || spec instanceof ArrayBuffer
|
|
56
|
+
return raw ? transcribe(resolve({ audio: spec }), signalOf(signal)) : transcribe(spec, signal)
|
|
57
|
+
}
|
|
58
|
+
service.__tinyasrBridge = true
|
|
59
|
+
|
|
60
|
+
return () => {
|
|
61
|
+
if (service.__tinyasrBridge !== true) return
|
|
62
|
+
service.resolve = originalResolve
|
|
63
|
+
service.transcribe = originalTranscribe
|
|
64
|
+
delete service.__tinyasrBridge
|
|
65
|
+
}
|
|
66
|
+
}
|
package/lib/routes.js
CHANGED
|
@@ -179,6 +179,7 @@ export function registerRoutes(ctx, { config, settings, glossary, provider, logg
|
|
|
179
179
|
autoLanguages: config.autoLanguages,
|
|
180
180
|
strategy: config.strategy,
|
|
181
181
|
polishDefault: { provider: config.polishProvider, model: config.polishModel },
|
|
182
|
+
mobileBridge: provider.mobileBridge === true,
|
|
182
183
|
})
|
|
183
184
|
} catch (error) {
|
|
184
185
|
logger?.warn?.('tinyasr: settings read failed', error)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tinyasr",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"description": "Offline Russian and English dictation for the DeepSeek Harness Web GUI through the local tinyasr recognizer, with an optional model cleanup pass.",
|