@chatpanel/events 0.361.1 → 0.362.0
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 +3 -1
- package/speaker-turns.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/events",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.362.0",
|
|
4
4
|
"description": "The canonical ChatPanel event-log and capability contracts — typed durable facts, clock-free deterministic linearization, schema upcasting, and the invariants the replay harness asserts. Pure, dependency-free ESM shared by the ChatPanel extension, gateway and bridge.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -263,6 +263,7 @@
|
|
|
263
263
|
"./voice-intents.js": "./voice-intents.js",
|
|
264
264
|
"./voice-speaker.js": "./voice-speaker.js",
|
|
265
265
|
"./speaker-cluster.js": "./speaker-cluster.js",
|
|
266
|
+
"./speaker-turns.js": "./speaker-turns.js",
|
|
266
267
|
"./link-noise.js": "./link-noise.js",
|
|
267
268
|
"./link-protocol.js": "./link-protocol.js",
|
|
268
269
|
"./voice-channels.js": "./voice-channels.js",
|
|
@@ -597,6 +598,7 @@
|
|
|
597
598
|
"voice-intents.js",
|
|
598
599
|
"voice-speaker.js",
|
|
599
600
|
"speaker-cluster.js",
|
|
601
|
+
"speaker-turns.js",
|
|
600
602
|
"link-noise.js",
|
|
601
603
|
"link-protocol.js",
|
|
602
604
|
"voice-channels.js",
|
package/speaker-turns.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=Object.freeze([[],[1],[2],[3],[1,2],[1,3],[2,3]]);function p(r=[],{minMs:a=300,gapMs:o=250}={}){const s=new Map;for(const t of r)if(!(!t||!(t.end>t.start)))for(const n of i[t.id]||[]){const c=s.get(n)||[],e=c[c.length-1];e&&t.start-e.end<=o/1e3?e.end=Math.max(e.end,t.end):c.push({local:n,start:t.start,end:t.end}),s.set(n,c)}const l=[];for(const t of s.values())for(const n of t)(n.end-n.start)*1e3>=a&&l.push(n);return l.sort((t,n)=>t.start-n.start||t.local-n.local)}function d(r=[]){const a=new Map;for(const o of r)a.set(o.local,(a.get(o.local)||0)+(o.end-o.start));return[...a.entries()].map(([o,s])=>({local:o,seconds:s})).sort((o,s)=>s.seconds-o.seconds||o.local-s.local)}function h(r=[]){return d(r)[0]?.local??null}function x(r,a,o,s=16e3){const l=[];let t=0;for(const e of a){if(e.local!==o)continue;const f=Math.max(0,Math.round(e.start*s)),u=Math.min(r.length,Math.round(e.end*s));u>f&&(l.push(r.subarray(f,u)),t+=u-f)}const n=new Float32Array(t);let c=0;for(const e of l)n.set(e,c),c+=e.length;return n}export{i as POWERSET,x as audioOfLocal,h as mainLocal,d as timeByLocal,p as turnsFromSpans};
|