@gjsify/vad 0.64.30 → 0.64.32

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.
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";const e=`silero-v5`,t=`https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models`,n=[{id:`silero-v5`,files:[{file:`silero_vad_v5.onnx`,url:`${t}/silero_vad_v5.onnx`,bytes:2313101,sha256:`6b99cbfd39246b6706f98ec13c7c50c6b299181f2474fa05cbc8046acc274396`}],license:`MIT`,redistributable:!0,sampleRate:16e3,windowSize:512,description:`Silero VAD v5 (2.2 MiB) — the default. Takes input/state/sr; 16 kHz, 512-sample windows.`},{id:`silero-v4`,files:[{file:`silero_vad.onnx`,url:`${t}/silero_vad.onnx`,bytes:643854,sha256:`9e2449e1087496d8d4caba907f23e0bd3f78d91fa552479bb9c23ac09cbb1fd6`}],license:`MIT`,redistributable:!0,sampleRate:16e3,windowSize:512,description:`Silero VAD v4 (0.6 MiB) — smaller and older. Only its 16 kHz branch is covered here.`}];function findVadModel(t=e){return n.find(e=>e.id===t)}function requireVadModel(t=e){let r=findVadModel(t);if(r===void 0)throw RangeError(`Unknown VAD model '${t}' — known ids: ${n.map(e=>e.id).join(`, `)}`);return r}export{e as DEFAULT_VAD_MODEL,n as VAD_MODELS,findVadModel,requireVadModel};
1
+ import"./_virtual/_rolldown/runtime.js";import{requireCatalogEntry as e}from"@gjsify/model-store/catalog";const t=`silero-v5`;function vadEntry(t,n,r){let{capability:i,...a}=e(`speech`,t);return{...a,sampleRate:n,windowSize:r}}const n=[vadEntry(`silero-v5`,16e3,512),vadEntry(`silero-v4`,16e3,512)];function findVadModel(e=t){return n.find(t=>t.id===e)}function requireVadModel(e=t){let r=findVadModel(e);if(r===void 0)throw RangeError(`Unknown VAD model '${e}' — known ids: ${n.map(e=>e.id).join(`, `)}`);return r}export{t as DEFAULT_VAD_MODEL,n as VAD_MODELS,findVadModel,requireVadModel};
package/lib/esm/models.js CHANGED
@@ -1 +1 @@
1
- import"./_virtual/_rolldown/runtime.js";import{hasVadBackend as e}from"./backend.js";import{DEFAULT_VAD_MODEL as t,VAD_MODELS as n}from"./model-manifest.js";import{join as r}from"node:path";import{ModelStore as i,userCacheDir as a}from"@gjsify/model-store";const o=new i({capability:`speech`,models:n,defaultModel:t,legacyDirs:()=>[r(a(),`gjsify`,`speech-models`)]});function modelCacheDir(){return o.cacheDir}function modelDir(e=t){return o.cachePath(e)}function available(n=t){return o.require(n),e()?o.availability(n):`unavailable`}function listModels(){return n.map(e=>({entry:e,availability:available(e.id)}))}function installedModels(){return o.installed()}function install(n=t,r={}){let i;try{i=o.require(n)}catch(e){return Promise.reject(e)}if(!e())return Promise.reject(Error(`install('${i.id}'): no native VAD engine on this host, so a model would be unusable — gate on available() and show describeVadBackend() instead.`));let{onProgress:a}=r;return o.install(i.id,{signal:r.signal,force:r.force,fetch:r.fetchImpl,monitor:a===void 0?void 0:e=>e.addEventListener(`downloadprogress`,e=>{let{receivedBytes:t,totalBytes:n}=e;a({modelId:i.id,received:t,total:n})})}).then(e=>e.files[i.files[0].file])}function uninstall(e=t){o.require(e);try{return o.uninstall(e)}catch{return!1}}function resolveModel(e=t){if(e.includes(`/`)||e.includes(`\\`))return e;let n=o.require(e),r=o.locate(n.id);if(r===void 0){let e=n.files.reduce((e,t)=>e+t.bytes,0);throw Error(`VAD model '${n.id}' is not cached (${o.cachePath(n.id)}) — await install('${n.id}') first, or pass a directory containing a model file. ${e} bytes from ${n.files[0].url}.`)}return r.files[n.files[0].file]}export{available,install,installedModels,listModels,modelCacheDir,modelDir,resolveModel,uninstall};
1
+ import"./_virtual/_rolldown/runtime.js";import{hasVadBackend as e}from"./backend.js";import{DEFAULT_VAD_MODEL as t,VAD_MODELS as n}from"./model-manifest.js";import{join as r}from"node:path";import{ModelStore as i,userCacheDir as a}from"@gjsify/model-store";const o=new i({capability:`speech`,models:n,defaultModel:t,legacyDirs:()=>[r(a(),`gjsify`,`speech-models`)],huggingFaceCache:!1});function modelCacheDir(){return o.cacheDir}function modelDir(e=t){return o.cachePath(e)}function available(n=t){return o.require(n),e()?o.availability(n):`unavailable`}function listModels(){return n.map(e=>({entry:e,availability:available(e.id)}))}function installedModels(){return o.installed()}function install(n=t,r={}){let i;try{i=o.require(n)}catch(e){return Promise.reject(e)}if(!e())return Promise.reject(Error(`install('${i.id}'): no native VAD engine on this host, so a model would be unusable — gate on available() and show describeVadBackend() instead.`));let{onProgress:a}=r;return o.install(i.id,{signal:r.signal,force:r.force,fetch:r.fetchImpl,monitor:a===void 0?void 0:e=>e.addEventListener(`downloadprogress`,e=>{let{receivedBytes:t,totalBytes:n}=e;a({modelId:i.id,received:t,total:n})})}).then(e=>e.files[i.files[0].file])}function uninstall(e=t){o.require(e);try{return o.uninstall(e)}catch{return!1}}function resolveModel(e=t){if(e.includes(`/`)||e.includes(`\\`))return e;let n=o.require(e),r=o.locate(n.id);if(r===void 0){let e=n.files.reduce((e,t)=>e+t.bytes,0);throw Error(`VAD model '${n.id}' is not cached (${o.cachePath(n.id)}) — await install('${n.id}') first, or pass a directory containing a model file. ${e} bytes from ${n.files[0].url}.`)}return r.files[n.files[0].file]}export{available,install,installedModels,listModels,modelCacheDir,modelDir,resolveModel,uninstall};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/vad",
3
- "version": "0.64.30",
3
+ "version": "0.64.32",
4
4
  "description": "Voice activity detection for GJS: Silero on sherpa-onnx, reporting when speech starts and when a stretch of speech has ended after 300 ms of silence. Takes PCM from @gjsify/media-capture or any async iterable of chunks, and downloads its model on first use instead of bundling one.",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -35,17 +35,17 @@
35
35
  "speech"
36
36
  ],
37
37
  "dependencies": {
38
- "@gjsify/model-store": "^0.64.30",
39
- "@gjsify/path": "^0.64.30",
40
- "@gjsify/sherpa-native": "^0.64.30",
41
- "@gjsify/utils": "^0.64.30"
38
+ "@gjsify/model-store": "^0.64.32",
39
+ "@gjsify/path": "^0.64.32",
40
+ "@gjsify/sherpa-native": "^0.64.32",
41
+ "@gjsify/utils": "^0.64.32"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@girs/gio-2.0": "5.4.0",
45
45
  "@girs/gjs": "5.4.0",
46
46
  "@girs/glib-2.0": "5.4.0",
47
- "@gjsify/cli": "^0.64.30",
48
- "@gjsify/unit": "^0.64.30",
47
+ "@gjsify/cli": "^0.64.32",
48
+ "@gjsify/unit": "^0.64.32",
49
49
  "@types/node": "^25.9.2",
50
50
  "typescript": "^6.0.3"
51
51
  },