@chatpanel/events 0.453.1 → 0.455.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/chap-face.js +1 -0
- package/package.json +5 -1
- package/speech-remote.js +1 -0
package/chap-face.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const k="#2046f5",w=Object.freeze(["idle","listening","thinking","speaking","muted"]),b=[38,59],m=4.2,l=.15;function _({state:t="idle",t:n=0,level:e=0,still:h=!1}={}){const o=w.includes(t)?t:"idle",c=((n+1.3)%m+m)%m,f=h?1:c<l?Math.max(.08,Math.abs(c-l/2)/(l/2)):1,u=o==="listening"?Math.min(Math.max(Number(e)||0,0),1):0,x=h?0:o==="thinking"?3*Math.sin(n*1.9):o==="listening"?3*u:0,y=o==="thinking"&&!h?-4:0,a=24*((o==="muted"?.45:1)*f*(1+.12*u)),M=b.map(s=>({x:s+x,y:50+(24-a)/2+y,w:12,h:a,r:Math.min(6,a/2)}));let $=null;if(o==="speaking"){const s=n*2*Math.PI,d=h?.5:(.55+.45*Math.sin(s*7.3))*(.6+.4*Math.sin(s*2.9+1.1)),r=3+9*Math.min(Math.max(d,0),1);$={x:46.5+x,y:84-r/2,w:16,h:r,r:Math.min(16,r)/2}}return{eyes:M,mouth:$}}const i=t=>Math.round(t*10)/10,g=(t,n)=>`<rect x="${i(t.x)}" y="${i(t.y)}" width="${i(t.w)}" height="${i(t.h)}" rx="${i(t.r)}" fill="${n}"/>`;function P(t,{plate:n=k,body:e="#fff",label:h="Chap"}={}){const o=[...t.eyes.map(c=>g(c,n)),t.mouth?g(t.mouth,n):""];return`<svg viewBox="0 0 128 128" role="img" aria-label="${h}"><rect width="128" height="128" rx="28" fill="${n}"/><rect x="22" y="28" width="84" height="72" rx="32" fill="${e}"/>${o.join("")}</svg>`}function S(t){const n=t.eyes[0].h/24,e=n>.66?"▮":n>.3?"▬":"‿",h=t.eyes[0].x-38,o=h>1.5?` ${e} ${e}`:h<-1.5?`${e} ${e} `:`${e} ${e} `,c=t.mouth?t.mouth.h>8?"O":t.mouth.h>5?"o":"-":" ";return`(${o}${c})`}export{k as CHAP_COBALT,w as CHAP_STATES,P as chapFaceSvg,S as chapFaceText,_ as chapPose};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/events",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.455.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",
|
|
@@ -129,6 +129,8 @@
|
|
|
129
129
|
"./meeting-analyzers.js": "./meeting-analyzers.js",
|
|
130
130
|
"./meeting-insights.js": "./meeting-insights.js",
|
|
131
131
|
"./meeting-followup.js": "./meeting-followup.js",
|
|
132
|
+
"./chap-face.js": "./chap-face.js",
|
|
133
|
+
"./speech-remote.js": "./speech-remote.js",
|
|
132
134
|
"./meeting-insight-prompts.js": "./meeting-insight-prompts.js",
|
|
133
135
|
"./meeting-shape.js": "./meeting-shape.js",
|
|
134
136
|
"./meeting-speakers.js": "./meeting-speakers.js",
|
|
@@ -491,6 +493,8 @@
|
|
|
491
493
|
"meeting-analyzers.js",
|
|
492
494
|
"meeting-insights.js",
|
|
493
495
|
"meeting-followup.js",
|
|
496
|
+
"chap-face.js",
|
|
497
|
+
"speech-remote.js",
|
|
494
498
|
"meeting-insight-prompts.js",
|
|
495
499
|
"meeting-shape.js",
|
|
496
500
|
"meeting-speakers.js",
|
package/speech-remote.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isVoiceId as s,vendorOf as d}from"./endpoint-jobs.js";const m="eleven_flash_v2_5",a=24e3,c=2500;function h(n){const o=String(n||"");let e=/^el:([^/]{1,80})\/([A-Za-z0-9_-]{1,64})$/.exec(o);return e?{kind:"elevenlabs",endpoint:e[1],voice:e[2]}:(e=/^link:([^/]{1,120})(?:\/(.{1,64}))?$/.exec(o),e?{kind:"link",computer:e[1],voice:e[2]||null}:{kind:"local",id:o})}function u({kind:n,endpoint:o,voice:e,computer:i}={}){return n==="elevenlabs"&&o&&s(e)?`el:${o}/${e}`:n==="link"&&i?`link:${i}${e?`/${e}`:""}`:""}const p=Object.freeze({elevenlabs:"What Chap says aloud is sent to ElevenLabs to be voiced, with your API key.",link:"What Chap says aloud is voiced by your computer, over the Link."});function y({ep:n,voice:o,text:e,model:i=null}={}){const t=String(e||"").trim().slice(0,c);if(!t||!n?.apiKey||!s(o))return null;const r=String(n.baseUrl||"https://api.elevenlabs.io/v1").replace(/\/+$/,""),l=i||(typeof n.model=="string"&&/^eleven_/.test(n.model)&&!/scribe|sts/.test(n.model)?n.model:m);return{url:`${r}/text-to-speech/${o}/stream?output_format=pcm_${a}`,method:"POST",headers:{"xi-api-key":n.apiKey,"content-type":"application/json",accept:"audio/pcm"},body:JSON.stringify({text:t,model_id:l}),audio:{encoding:"pcm16le",rate:a,channels:1}}}function b({voice:n=null,text:o}={}){const e=String(o||"").trim().slice(0,c);return e?{method:"POST",path:"/v1/audio/speech",headers:{"content-type":"application/json"},body:JSON.stringify({input:e,response_format:"wav",...n?{voice:n}:{}}),audio:{encoding:"wav"}}:null}function k({endpoints:n=[],voices:o={},computers:e=[]}={}){const i=[];for(const t of n){if(!t?.id||d(t)!=="elevenlabs")continue;const r=Array.isArray(o[t.id])?o[t.id]:[];i.push({kind:"elevenlabs",title:t.name||"ElevenLabs",endpoint:t.id,note:p.elevenlabs,options:r.map(l=>({value:u({kind:"elevenlabs",endpoint:t.id,voice:l.id}),label:l.name,...l.note?{note:l.note}:{}}))})}for(const t of e)t?.key&&i.push({kind:"link",title:t.name||"Your computer",note:p.link,options:[{value:u({kind:"link",computer:t.key}),label:`${t.name||"Your computer"}'s voice`}]});return i}export{a as ELEVENLABS_PCM_RATE,m as ELEVENLABS_SPEECH_MODEL,p as SPEECH_EGRESS_NOTE,y as elevenLabsSpeechRequest,b as linkSpeechRequest,h as parseSpeechVoice,k as remoteSpeechChoices,u as speechVoiceValue};
|