dsh-tinyasr 1.10.1 → 1.10.2
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 +6 -0
- package/client.js +15 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.10.2 — 7 December 2026
|
|
7
|
+
|
|
8
|
+
- Recovery housekeeping: the tap buffer stops growing at 310 s, an unclaimed transcript expires after
|
|
9
|
+
10 minutes, discards are logged (`tap discard`), and `tap`/`recover` lines carry the session tail so
|
|
10
|
+
a recovery can be traced to its conversation.
|
|
11
|
+
|
|
6
12
|
## 1.10.1 — 7 December 2026
|
|
7
13
|
|
|
8
14
|
- The recovery keeps the conversation captured when the recording started instead of reading it
|
package/client.js
CHANGED
|
@@ -800,6 +800,7 @@ window.__ModuleLoader__.load({
|
|
|
800
800
|
// conversation. Returning to that conversation inserts the text into the draft.
|
|
801
801
|
let tap = null
|
|
802
802
|
const pendingRecovery = new Map()
|
|
803
|
+
const PENDING_TTL_MS = 10 * 60 * 1000
|
|
803
804
|
const sessionOf = () => {
|
|
804
805
|
const node = document.querySelector('[data-conversation-session]')
|
|
805
806
|
const value = node?.getAttribute('data-conversation-session')
|
|
@@ -834,6 +835,7 @@ window.__ModuleLoader__.load({
|
|
|
834
835
|
// already belong to the conversation the user switched to.
|
|
835
836
|
const state = { media, audio, source, processor, chunks: [], length: 0, session: sessionOf() }
|
|
836
837
|
processor.onaudioprocess = (event) => {
|
|
838
|
+
if (state.length >= 16000 * 310) return // the recorder caps at 300 s; never grow past it
|
|
837
839
|
const block = event.inputBuffer.getChannelData(0)
|
|
838
840
|
const samples = audio.sampleRate === 16000 ? block : resample(block, audio.sampleRate)
|
|
839
841
|
const copy = new Float32Array(samples.length)
|
|
@@ -844,7 +846,7 @@ window.__ModuleLoader__.load({
|
|
|
844
846
|
source.connect(processor)
|
|
845
847
|
processor.connect(audio.destination)
|
|
846
848
|
tap = state
|
|
847
|
-
hello('tap', { stage: 'start', session: state.session.slice(
|
|
849
|
+
hello('tap', { stage: 'start', session: state.session.slice(-8) })
|
|
848
850
|
} catch (error) {
|
|
849
851
|
hello('tap', { stage: 'failed', message: String(error?.message ?? error).slice(0, 120) })
|
|
850
852
|
}
|
|
@@ -857,7 +859,7 @@ window.__ModuleLoader__.load({
|
|
|
857
859
|
try { state.source.disconnect() } catch {}
|
|
858
860
|
try { for (const track of state.media.getTracks()) track.stop() } catch {}
|
|
859
861
|
try { await state.audio.close() } catch {}
|
|
860
|
-
if (!keep) return null
|
|
862
|
+
if (!keep) { hello('tap', { stage: 'discard', ms: String(state.length * 1000 / 16000 | 0) }); return null }
|
|
861
863
|
const wav = encodeWav(state.chunks, state.length, 16000)
|
|
862
864
|
if (wav.length <= 44) return { text: '', session: state.session }
|
|
863
865
|
try {
|
|
@@ -874,6 +876,11 @@ window.__ModuleLoader__.load({
|
|
|
874
876
|
}
|
|
875
877
|
const waitingLogged = new Set()
|
|
876
878
|
const flushRecovery = () => {
|
|
879
|
+
if (pendingRecovery.size === 0) return
|
|
880
|
+
const now = Date.now()
|
|
881
|
+
for (const [key, entry] of pendingRecovery) {
|
|
882
|
+
if (now - entry.at > PENDING_TTL_MS) { pendingRecovery.delete(key); hello('recover', { stage: 'expired', session: key.slice(-8) }) }
|
|
883
|
+
}
|
|
877
884
|
if (pendingRecovery.size === 0) return
|
|
878
885
|
if (tap !== null) return
|
|
879
886
|
const session = sessionOf()
|
|
@@ -882,17 +889,17 @@ window.__ModuleLoader__.load({
|
|
|
882
889
|
for (const key of pendingRecovery.keys()) {
|
|
883
890
|
if (key !== session && !waitingLogged.has(key)) {
|
|
884
891
|
waitingLogged.add(key)
|
|
885
|
-
hello('recover', { stage: 'waiting', for: key.slice(
|
|
892
|
+
hello('recover', { stage: 'waiting', for: key.slice(-8), session: session.slice(-8) })
|
|
886
893
|
}
|
|
887
894
|
}
|
|
888
895
|
return
|
|
889
896
|
}
|
|
890
897
|
waitingLogged.delete(session)
|
|
891
898
|
if (document.querySelector('[data-voice-activity]') !== null) return
|
|
892
|
-
const
|
|
893
|
-
if (insertIntoComposer(text)) {
|
|
899
|
+
const entry = pendingRecovery.get(session)
|
|
900
|
+
if (insertIntoComposer(entry.text)) {
|
|
894
901
|
pendingRecovery.delete(session)
|
|
895
|
-
hello('recover', { stage: 'inserted', chars: String(text.length) })
|
|
902
|
+
hello('recover', { stage: 'inserted', chars: String(entry.text.length), session: session.slice(-8) })
|
|
896
903
|
}
|
|
897
904
|
}
|
|
898
905
|
const recoverCancelledTake = async () => {
|
|
@@ -903,8 +910,8 @@ window.__ModuleLoader__.load({
|
|
|
903
910
|
const session = result.session
|
|
904
911
|
if (session === '') { hello('recover', { stage: 'no-session', chars: String(text.length) }); return }
|
|
905
912
|
const previous = pendingRecovery.get(session)
|
|
906
|
-
pendingRecovery.set(session, previous === undefined ? text : `${previous} ${text}
|
|
907
|
-
hello('recover', { stage: 'stashed', chars: String(text.length), session: session.slice(
|
|
913
|
+
pendingRecovery.set(session, { text: previous === undefined ? text : `${previous.text} ${text}`, at: Date.now() })
|
|
914
|
+
hello('recover', { stage: 'stashed', chars: String(text.length), session: session.slice(-8) })
|
|
908
915
|
}
|
|
909
916
|
|
|
910
917
|
// Track the built-in recorder's phase so a dropped recording leaves evidence on the Host.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tinyasr",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
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.",
|