@todoforai/voiceloop 0.1.17 → 0.1.18
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/package.json +1 -1
- package/src/voice-agent.js +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@todoforai/voiceloop",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "Fast, interruptible browser voice agent: VAD → STT → LLM → TTS with real barge-in, echo filtering, streaming first-sentence TTS and tap-to-seek. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/voice-agent.js
CHANGED
|
@@ -1961,6 +1961,9 @@ const CDN_PIPER_WASM = `${CDN}@diffusionstudio/piper-wasm@1.0.0/build/piper_phon
|
|
|
1961
1961
|
// literal specifier is resolved by Vite's import analysis BEFORE it checks /* @vite-ignore */ —
|
|
1962
1962
|
// which fails since onnxruntime-web isn't installed as a dependency.
|
|
1963
1963
|
const ORT_SPECIFIER = 'onnxruntime-web';
|
|
1964
|
+
// Dynamic import by URL, hidden from bundlers: Hermes (React Native) rejects `import(expr)` at
|
|
1965
|
+
// bytecode compile time, so the syntax can't appear in this file even on paths RN never takes.
|
|
1966
|
+
const importUrl = new Function('u', 'return import(u)');
|
|
1964
1967
|
|
|
1965
1968
|
// OPFS blob cache — same 'piper' directory and url-basename filenames as the lib's own cache, so
|
|
1966
1969
|
// models already downloaded through the lib are reused (and vice versa).
|
|
@@ -2013,7 +2016,7 @@ export class PiperTTS extends StreamingTTS {
|
|
|
2013
2016
|
if (typeof document !== 'undefined' && !document.getElementById('vl-importmap')) {
|
|
2014
2017
|
const { loadVoiceDeps } = await import('./deps.js'); await loadVoiceDeps();
|
|
2015
2018
|
}
|
|
2016
|
-
return
|
|
2019
|
+
return importUrl(CDN_PIPER);
|
|
2017
2020
|
})();
|
|
2018
2021
|
}
|
|
2019
2022
|
|
|
@@ -2043,8 +2046,8 @@ export class PiperTTS extends StreamingTTS {
|
|
|
2043
2046
|
const path = lib.PATH_MAP[voiceId];
|
|
2044
2047
|
if (!path) throw new Error(`unknown Piper voice: ${voiceId}`);
|
|
2045
2048
|
const [ort, phonMod, cfgBlob, modelBlob] = await Promise.all([
|
|
2046
|
-
|
|
2047
|
-
|
|
2049
|
+
importUrl(ORT_SPECIFIER),
|
|
2050
|
+
importUrl(CDN_PIPER_PHONEMIZE),
|
|
2048
2051
|
opfsCachedFetch(`${lib.HF_BASE}/${path}.json`),
|
|
2049
2052
|
opfsCachedFetch(`${lib.HF_BASE}/${path}`, this._onModelProgress),
|
|
2050
2053
|
]);
|