@chatpanel/events 0.396.3 → 0.405.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/agent-capabilities.js +1 -0
- package/agent-thread.js +3 -3
- package/client-prefs.js +1 -1
- package/index.js +1 -1
- package/markdown-render.js +0 -0
- package/note-blank.js +1 -0
- package/note-link.js +1 -0
- package/note-recall.js +7 -0
- package/package.json +13 -1
- package/prefetch.js +4 -4
- package/settings-registry.js +1 -1
- package/speech-language.js +1 -1
- package/subject-match.js +1 -0
- package/turn-gather.js +1 -1
- package/weather-tool.js +7 -7
- package/web-address.js +1 -0
package/speech-language.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const N=Object.freeze(["bg","hr","cs","da","nl","en","et","fi","fr","de","el","hu","it","lv","lt","mt","pl","pt","ro","sk","sl","es","sv","ru","uk"]),O="onnx-community/whisper-large-v3-turbo",w="bodhan-ai/indic-transcribe-core",T=Object.freeze(["en","hi","te","ta","kn","ml","mr","bn","gu","pa","ur","as","or","ne","sa","sd","ks","kok","mai","mni","brx","doi","sat","bho"]),A="en",E=Object.freeze([["en","English","English"],["hi","Hindi","हिन्दी"],["te","Telugu","తెలుగు"],["ta","Tamil","தமிழ்"],["kn","Kannada","ಕನ್ನಡ"],["ml","Malayalam","മലയാളം"],["mr","Marathi","मराठी"],["bn","Bengali","বাংলা"],["gu","Gujarati","ગુજરાતી"],["pa","Punjabi","ਪੰਜਾਬੀ"],["ur","Urdu","اردو"],["es","Spanish","Español"],["pt","Portuguese","Português"],["fr","French","Français"],["de","German","Deutsch"],["it","Italian","Italiano"],["nl","Dutch","Nederlands"],["pl","Polish","Polski"],["ro","Romanian","Română"],["sv","Swedish","Svenska"],["da","Danish","Dansk"],["fi","Finnish","Suomi"],["cs","Czech","Čeština"],["hu","Hungarian","Magyar"],["el","Greek","Ελληνικά"],["ru","Russian","Русский"],["uk","Ukrainian","Українська"],["tr","Turkish","Türkçe"],["ar","Arabic","العربية"],["zh","Chinese","中文"],["ja","Japanese","日本語"],["ko","Korean","한국어"],["id","Indonesian","Bahasa Indonesia"],["vi","Vietnamese","Tiếng Việt"]].map(([n,e,t])=>Object.freeze({code:n,name:e,native:t,parakeet:N.includes(n)}))),S=new Map(E.map(n=>[n.code,n]));function y(n){return S.get(b(n))||null}function v(n){const e=b(n);return S.get(e)?.name||e}function b(n){const e=String(n||"").trim().toLowerCase();if(!e)return"";const t=e.split(/[-_]/)[0];if(/^[a-z]{2,3}$/.test(t)&&(S.has(t)||t.length===2))return t;for(const a of E)if(a.name.toLowerCase()===e)return a.code;return""}function m(n){const e=[];for(const t of Array.isArray(n)?n:String(n||"").split(/[\s,]+/)){const a=b(t);if(a&&!e.includes(a)&&e.push(a),e.length>=12)break}return e}function L(n,{engine:e="",englishOnly:t=!1}={}){const a=m(n),r=o=>t||e==="coreml-tdt"?o==="en":e==="parakeet-tdt"?N.includes(o):e==="indic-canary"?T.includes(o):!0;return{covered:a.filter(r),missing:a.filter(o=>!r(o))}}function _(n,e={},{indic:t=!0}={}){const a=m(n);return t&&a.some(r=>f.has(r))&&a.every(r=>T.includes(r))?e?.id===w||e?.engine==="indic-canary"?null:w:L(a,e).missing.length?O:null}const j=1.5,$=.8,D=.9,G=.5;function U({scores:n={},allowed:e=[],seconds:t=0,last:a=null,logits:r=!0}={}){const o=m(e),i=Object.entries(n).filter(([d,l])=>Number.isFinite(l)&&(!o.length||o.includes(d)));if(!i.length)return{lang:a||o[0]||null,confidence:0,inherited:!0};let u;if(r){const d=Math.max(...i.map(([,s])=>s)),l=i.map(([s,h])=>[s,Math.exp(h-d)]),p=l.reduce((s,[,h])=>s+h,0);u=l.map(([s,h])=>[s,h/p])}else{const d=i.reduce((l,[,p])=>l+Math.max(0,p),0)||1;u=i.map(([l,p])=>[l,Math.max(0,p)/d])}u.sort((d,l)=>l[1]-d[1]);const[g,c]=u[0];return!o.length&&c<G&&g!==(a||"en")?{lang:a||"en",confidence:c,inherited:!0}:a&&g!==a&&t<j&&c<$?{lang:a,confidence:c,inherited:!0}:a&&g!==a&&f.has(g)&&f.has(a)&&c<D?{lang:a,confidence:c,inherited:!0}:{lang:g,confidence:c,inherited:!1}}const z=[[/[ఀ-౿]/g,["te"]],[/[-]/g,["ta"]],[/[ಀ-]/g,["kn"]],[/[ഀ-ൿ]/g,["ml"]],[/[ঀ-]/g,["bn"]],[/[-૿]/g,["gu"]],[/[-]/g,["pa"]],[/[ऀ-ॿ]/g,["hi","mr"]],[/[-ۿ]/g,["ar","ur"]],[/[Ѐ-ӿ]/g,["ru","uk","bg"]],[/[Ͱ-Ͽ]/g,["el"]],[/[-ヿ]/g,["ja"]],[/[가-]/g,["ko"]],[/[一-鿿]/g,["zh","ja"]]],M={en:"the and is are was were you that this with have for not but what they will would there their about which",es:"el la los las que de y en es por con para una pero como más está muy también porque cuando sí hay",pt:"o os as que de e em é não com para uma mas como mais está muito também porque quando você isso então",fr:"le la les des et est une que pour pas dans avec mais vous nous très aussi parce cette sont",de:"der die das und ist nicht ein eine mit auf für ich sie wir auch aber noch wenn dass sind",it:"il lo la gli che di e è non per una con ma come più sono anche perché questo quando",nl:"de het een en is niet van dat met voor op ook maar wij zijn als dit wat",pl:"i w nie to się na że jest z do jak ale tak co już czy",ro:"și în este nu că pe cu la un o mai dar pentru sunt care",sv:"och att det är som en på för med inte har jag vi men",hi:"hai hain nahi nahin kya aur bhi toh mein ko ka ki ke yeh woh hum aap kuch lekin matlab accha haan kyun raha rahe karna",te:"ledu undi nenu meeru memu emi enti ani kani chala avunu kaadu cheppu cheyyali vachindi ayyindi ikkada akkada"},R=Object.fromEntries(Object.entries(M).map(([n,e])=>[n,new Set(e.split(" "))]));function H(n,{allowed:e=[],last:t=null}={}){const a=m(e),r=s=>!a.length||a.includes(s),o={lang:t||(a.length===1?a[0]:null),confidence:0,inherited:!0},i=String(n||""),u=(i.match(new RegExp("\\p{L}","gu"))||[]).length;if(!u)return o;for(const[s,h]of z){const k=(i.match(s)||[]).length;if(k/u>=.5)return{lang:h.find(r)||h[0],confidence:k/u,inherited:!1}}const g=i.toLowerCase().match(new RegExp("\\p{L}+","gu"))||[],c=[];for(const[s,h]of Object.entries(R)){if(!r(s))continue;let k=0;for(const I of g)h.has(I)&&k++;k&&c.push([s,k])}if(c.sort((s,h)=>h[1]-s[1]),!c.length||c[0][1]<2)return o;const[d,l]=c[0],p=c[1]?.[1]||0;return l<1.5*p?o:{lang:d,confidence:l/(l+p),inherited:!1}}function q(n,e=A){const t=b(n),a=b(e);return!!t&&!!a&&t!==a}const C=new Set(["hi","te","ta","kn","ml","mr","bn","gu","pa","ur","ar","ru","uk","el","zh","ja","ko"]);function W(n,e){const t=b(e);if(f.has(t))return!1;if(!C.has(t))return!0;const a=String(n||""),r=(a.match(/[\p{L}\p{M}]/gu)||[]).length,o=(a.match(new RegExp("\\p{Script=Latin}","gu"))||[]).length;return!r||o/r<.5}function B(n){const e=String(n?.text||"").trim(),t=String(n?.en||"").trim();if(!t||t===e)return e;const a=v(n?.lang);return`${t} (said${a?` in ${a}`:""}: ${e})`}function K(n={}){const e=n?.translateWith;return{languages:m(n?.languages),translate:n?.translate!==!1,translateWith:typeof e=="string"?e.trim():""}}function V(n){if(!n?.active)return null;const e=(n.available||[]).find(t=>t.id===n.active)||{};return{id:n.active,label:e.label||n.active,engine:e.engine||"",englishOnly:/\.en$/.test(n.active)}}const x=n=>{const e=n.map(v);return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`};function Y({languages:n=[],engine:e=null,switched:t=null,indic:a=!0}={}){if(t)return{tone:"ok",text:t.to===w?`Speech model switched to Indic-Transcribe — it hears Indian languages far better than ${t.fromLabel}.`:`Speech model switched to Whisper Large v3 Turbo so every listed language is heard — ${t.fromLabel} hears only European languages.`,action:"undo"};const r=m(n);if(!r.length)return null;if(e&&_(r,e,{indic:a})===w){const i=r.filter(g=>f.has(g)),{missing:u}=L(r,e);return{tone:u.length?"warn":"muted",text:u.length?`${e.label} cannot hear ${x(u)}. Indic-Transcribe hears ${x(i)} well — accept its licence to download it (about 1.5 GB, runs on this computer).`:`Indic-Transcribe hears ${x(i)} far more accurately than ${e.label} (Telugu: about 22 % errors against 37 %). Accept its licence to download it (about 1.5 GB, runs on this computer).`,action:"license",model:w}}if(!e){const i=r.filter(u=>y(u)&&!y(u).parakeet);return i.length?{tone:"muted",text:`${x(i)} need${i.length===1?"s":""} a Whisper speech model. Chap switches to one when the gateway is running.`}:null}const{missing:o}=L(r,e);return o.length?{tone:"warn",text:`${e.label} cannot hear ${x(o)} — those lines would come out as the wrong words.`,action:"switch"}:null}const f=new Set(["hi","te","ta","kn","ml","mr","bn","gu","pa","ur"]);function P(n){const e=m(n);return e.some(t=>f.has(t))?e.filter(t=>t!=="en"):e}function J(n,e){const t=b(e);if(!C.has(t))return t||null;const a=String(n||""),r=(a.match(/[\p{L}\p{M}]/gu)||[]).length,o=(a.match(new RegExp("\\p{Script=Latin}","gu"))||[]).length;return r&&o/r>=.8?"en":t}function Q(n=[]){const e=m(n),t=e.filter(a=>f.has(a));return t.length>=2?`Speech models often mix up ${x(t)}. List only the ones actually spoken in your meetings — one Indian language with English works best.`:e.length?null:"Speak an Indian language? Add it here — detection on its own often mistakes Telugu for Hindi, Tamil or English."}const F=Object.freeze(E.map(n=>n.code)),X=.8,Z=2;function ee(n=[]){const e=m(n);return e.some(t=>f.has(t))?P(["en",...e]):[...F]}export{G as ANY_LANGUAGE_CONFIDENCE,F as AUTO_LANGUAGES,X as AUTO_LEARN_CONFIDENCE,Z as AUTO_LEARN_SECONDS,T as INDIC_ENGINE_LANGUAGES,w as INDIC_SPEECH_MODEL,D as INDIC_SWITCH_CONFIDENCE,E as MEETING_LANGUAGES,N as PARAKEET_LANGUAGES,$ as SHORT_CLIP_CONFIDENCE,j as SHORT_CLIP_S,A as TRANSLATE_TARGET,O as WIDE_SPEECH_MODEL,ee as autoCandidates,K as captureLanguageOptions,Y as coverageNote,P as decodeLanguages,H as detectTextLanguage,y as languageInfo,v as languageName,Q as languagesHint,B as lineForModel,J as lineLanguage,W as localTranslatable,_ as modelForLanguages,q as needsTranslation,b as normalizeLanguage,m as normalizeLanguages,U as pickSegmentLanguage,L as speechCoverage,V as sttEngineOf};
|
|
1
|
+
const N=Object.freeze(["bg","hr","cs","da","nl","en","et","fi","fr","de","el","hu","it","lv","lt","mt","pl","pt","ro","sk","sl","es","sv","ru","uk"]),v="onnx-community/whisper-large-v3-turbo",x="bodhan-ai/indic-transcribe-core",I=Object.freeze(["en","hi","te","ta","kn","ml","mr","bn","gu","pa","ur","as","or","ne","sa","sd","ks","kok","mai","mni","brx","doi","sat","bho"]),A="en",k=Object.freeze([["en","English","English"],["hi","Hindi","हिन्दी"],["te","Telugu","తెలుగు"],["ta","Tamil","தமிழ்"],["kn","Kannada","ಕನ್ನಡ"],["ml","Malayalam","മലയാളം"],["mr","Marathi","मराठी"],["bn","Bengali","বাংলা"],["gu","Gujarati","ગુજરાતી"],["pa","Punjabi","ਪੰਜਾਬੀ"],["ur","Urdu","اردو"],["es","Spanish","Español"],["pt","Portuguese","Português"],["fr","French","Français"],["de","German","Deutsch"],["it","Italian","Italiano"],["nl","Dutch","Nederlands"],["pl","Polish","Polski"],["ro","Romanian","Română"],["sv","Swedish","Svenska"],["da","Danish","Dansk"],["fi","Finnish","Suomi"],["cs","Czech","Čeština"],["hu","Hungarian","Magyar"],["el","Greek","Ελληνικά"],["ru","Russian","Русский"],["uk","Ukrainian","Українська"],["tr","Turkish","Türkçe"],["ar","Arabic","العربية"],["zh","Chinese","中文"],["ja","Japanese","日本語"],["ko","Korean","한국어"],["id","Indonesian","Bahasa Indonesia"],["vi","Vietnamese","Tiếng Việt"]].map(([n,e,r])=>Object.freeze({code:n,name:e,native:r,parakeet:N.includes(n)}))),w=new Map(k.map(n=>[n.code,n]));function T(n){return w.get(E(n))||null}function y(n){const e=E(n);return w.get(e)?.name||e}function E(n){const e=String(n||"").trim().toLowerCase();if(!e)return"";const r=e.split(/[-_]/)[0];if(/^[a-z]{2,3}$/.test(r)&&(w.has(r)||r.length===2))return r;for(const t of k)if(t.name.toLowerCase()===e)return t.code;return""}function d(n){const e=[];for(const r of Array.isArray(n)?n:String(n||"").split(/[\s,]+/)){const t=E(r);if(t&&!e.includes(t)&&e.push(t),e.length>=12)break}return e}function L(n,{engine:e="",englishOnly:r=!1}={}){const t=d(n),o=a=>r||e==="coreml-tdt"?a==="en":e==="parakeet-tdt"?N.includes(a):e==="indic-canary"?I.includes(a):!0;return{covered:t.filter(o),missing:t.filter(a=>!o(a))}}function j(n,e={},{indic:r=!0}={}){const t=d(n);return r&&t.some(o=>f.has(o))&&t.every(o=>I.includes(o))?e?.id===x||e?.engine==="indic-canary"?null:x:L(t,e).missing.length?v:null}const R=1.5,P=.8,G=.9,$=.5;function Z({scores:n={},allowed:e=[],seconds:r=0,last:t=null,logits:o=!0}={}){const a=d(e),s=Object.entries(n).filter(([p,u])=>Number.isFinite(u)&&(!a.length||a.includes(p)));if(!s.length)return{lang:t||a[0]||null,confidence:0,inherited:!0};let c;if(o){const p=Math.max(...s.map(([,l])=>l)),u=s.map(([l,h])=>[l,Math.exp(h-p)]),m=u.reduce((l,[,h])=>l+h,0);c=u.map(([l,h])=>[l,h/m])}else{const p=s.reduce((u,[,m])=>u+Math.max(0,m),0)||1;c=s.map(([u,m])=>[u,Math.max(0,m)/p])}c.sort((p,u)=>u[1]-p[1]);const[g,i]=c[0];return!a.length&&i<$&&g!==(t||"en")?{lang:t||"en",confidence:i,inherited:!0}:t&&g!==t&&r<R&&i<P?{lang:t,confidence:i,inherited:!0}:t&&g!==t&&f.has(g)&&f.has(t)&&i<G?{lang:t,confidence:i,inherited:!0}:{lang:g,confidence:i,inherited:!1}}const z=[[/[ఀ-౿]/g,["te"]],[/[-]/g,["ta"]],[/[ಀ-]/g,["kn"]],[/[ഀ-ൿ]/g,["ml"]],[/[ঀ-]/g,["bn"]],[/[-૿]/g,["gu"]],[/[-]/g,["pa"]],[/[ऀ-ॿ]/g,["hi","mr"]],[/[-ۿ]/g,["ar","ur"]],[/[Ѐ-ӿ]/g,["ru","uk","bg"]],[/[Ͱ-Ͽ]/g,["el"]],[/[-ヿ]/g,["ja"]],[/[가-]/g,["ko"]],[/[一-鿿]/g,["zh","ja"]]],M={en:"the and is are was were you that this with have for not but what they will would there their about which",es:"el la los las que de y en es por con para una pero como más está muy también porque cuando sí hay",pt:"o os as que de e em é não com para uma mas como mais está muito também porque quando você isso então",fr:"le la les des et est une que pour pas dans avec mais vous nous très aussi parce cette sont",de:"der die das und ist nicht ein eine mit auf für ich sie wir auch aber noch wenn dass sind",it:"il lo la gli che di e è non per una con ma come più sono anche perché questo quando",nl:"de het een en is niet van dat met voor op ook maar wij zijn als dit wat",pl:"i w nie to się na że jest z do jak ale tak co już czy",ro:"și în este nu că pe cu la un o mai dar pentru sunt care",sv:"och att det är som en på för med inte har jag vi men",hi:"hai hain nahi nahin kya aur bhi toh mein ko ka ki ke yeh woh hum aap kuch lekin matlab accha haan kyun raha rahe karna",te:"ledu undi nenu meeru memu emi enti ani kani chala avunu kaadu cheppu cheyyali vachindi ayyindi ikkada akkada"},H=Object.fromEntries(Object.entries(M).map(([n,e])=>[n,new Set(e.split(" "))]));function ee(n,{allowed:e=[],last:r=null}={}){const t=d(e),o=l=>!t.length||t.includes(l),a={lang:r||(t.length===1?t[0]:null),confidence:0,inherited:!0},s=String(n||""),c=(s.match(new RegExp("\\p{L}","gu"))||[]).length;if(!c)return a;for(const[l,h]of z){const S=(s.match(l)||[]).length;if(S/c>=.5)return{lang:h.find(o)||h[0],confidence:S/c,inherited:!1}}const g=s.toLowerCase().match(new RegExp("\\p{L}+","gu"))||[],i=[];for(const[l,h]of Object.entries(H)){if(!o(l))continue;let S=0;for(const _ of g)h.has(_)&&S++;S&&i.push([l,S])}if(i.sort((l,h)=>h[1]-l[1]),!i.length||i[0][1]<2)return a;const[p,u]=i[0],m=i[1]?.[1]||0;return u<1.5*m?a:{lang:p,confidence:u/(u+m),inherited:!1}}function ne(n,e=A){const r=E(n),t=E(e);return!!r&&!!t&&r!==t}const C=new Set(["hi","te","ta","kn","ml","mr","bn","gu","pa","ur","ar","ru","uk","el","zh","ja","ko"]);function te(n,e){const r=E(e);if(f.has(r))return!1;if(!C.has(r))return!0;const t=String(n||""),o=(t.match(/[\p{L}\p{M}]/gu)||[]).length,a=(t.match(new RegExp("\\p{Script=Latin}","gu"))||[]).length;return!o||a/o<.5}function re(n){const e=String(n?.text||"").trim(),r=String(n?.en||"").trim();if(!r||r===e)return e;const t=y(n?.lang);return`${r} (said${t?` in ${t}`:""}: ${e})`}function ae(n={}){const e=n?.translateWith;return{languages:d(n?.languages),translate:n?.translate!==!1,translateWith:typeof e=="string"?e.trim():""}}function oe(n){if(!n?.active)return null;const e=(n.available||[]).find(r=>r.id===n.active)||{};return{id:n.active,label:e.label||n.active,engine:e.engine||"",englishOnly:/\.en$/.test(n.active)}}const b=n=>{const e=n.map(y);return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`};function ie({languages:n=[],engine:e=null,switched:r=null,indic:t=!0}={}){if(r)return{tone:"ok",text:r.to===x?`Speech model switched to Indic-Transcribe — it hears Indian languages far better than ${r.fromLabel}.`:`Speech model switched to Whisper Large v3 Turbo so every listed language is heard — ${r.fromLabel} hears only European languages.`,action:"undo"};const o=d(n);if(!o.length)return null;if(e&&j(o,e,{indic:t})===x){const s=o.filter(g=>f.has(g)),{missing:c}=L(o,e);return{tone:c.length?"warn":"muted",text:c.length?`${e.label} cannot hear ${b(c)}. Indic-Transcribe hears ${b(s)} well — accept its licence to download it (about 1.5 GB, runs on this computer).`:`Indic-Transcribe hears ${b(s)} far more accurately than ${e.label} (Telugu: about 22 % errors against 37 %). Accept its licence to download it (about 1.5 GB, runs on this computer).`,action:"license",model:x}}if(!e){const s=o.filter(c=>T(c)&&!T(c).parakeet);return s.length?{tone:"muted",text:`${b(s)} need${s.length===1?"s":""} a Whisper speech model. Chap switches to one when the gateway is running.`}:null}const{missing:a}=L(o,e);return a.length?{tone:"warn",text:`${e.label} cannot hear ${b(a)} — those lines would come out as the wrong words.`,action:"switch"}:null}const f=new Set(["hi","te","ta","kn","ml","mr","bn","gu","pa","ur"]);function W(n){const e=d(n);return e.some(r=>f.has(r))?e.filter(r=>r!=="en"):e}function se(n,e){const r=E(e);if(!C.has(r))return r||null;const t=String(n||""),o=(t.match(/[\p{L}\p{M}]/gu)||[]).length,a=(t.match(new RegExp("\\p{Script=Latin}","gu"))||[]).length;return o&&a/o>=.8?"en":r}const F={te:"ఐ థింక్ ఇట్ ఇట్స్ విల్ దట్ దాట్ దట్స్ ద ది ఈజ్ ఇస్ ఈస్ ఇజ్ ఆర్ వీ వి యూ యు యువర్ టు ఆఫ్ ఇన్ ఆన్ విత్ ఫర్ హౌ వాట్ వై వెన్ వేర్ హూ దెమ్ దే దేర్ దెర్ దిస్ దీస్ దోస్ కెన్ కేన్ క్యాన్ షుడ్ వుడ్ కుడ్ నీడ్ గో డూ డు హావ్ హ్యావ్ హేవ్ బి బీ అవర్ అస్ ఇఫ్ నాట్ డోంట్ దెన్ దాన్ ఫ్రమ్ అబౌట్ గోయింగ్ వాంట్ బికాస్ బికాజ్ వాస్ వాజ్ మై హీ షీ ఎట్ గెట్ విచ్ వితౌట్ ఇంటు వీఆర్ ఐయామ్ యామ్ ఈవెన్ ఐదర్ నౌ",hi:"थिंक इट इट्स विल दैट दैट्स द इज़ इज आर वी यू योर टू ऑफ ऑन विद फॉर हाउ व्हाट वाय व्हाय वेन व्हेन वेयर हू देम देयर दिस दीज़ दीज दोज़ कैन शुड वुड कुड नीड गो डू हैव बी आवर अस इफ नॉट डोंट देन दैन फ्रॉम अबाउट गोइंग वांट बिकॉज़ बिकॉज वॉज़ माय शी एट गेट विच विदाउट इंटू ईवन नाउ"},U={te:new RegExp("\\p{Script=Telugu}","u"),hi:new RegExp("\\p{Script=Devanagari}","u")},O=n=>n.normalize("NFC").replace(/[़]/g,""),D=Object.fromEntries(Object.entries(F).map(([n,e])=>[n,new Set(e.split(" ").map(O))])),B={te:"సో బట్ అండ్ ఆండ్ లైక్ రైట్ ఓకే యా యూనో అవుట్ అప్ లెట్స్ ఆల్ సమ్ మోర్ వెరీ జస్ట్ ఆల్సో"},q=Object.fromEntries(Object.entries(B).map(([n,e])=>[n,new Set(e.split(" ").map(O))])),K={te:"్"},V=2,Y=.3,J=3;function Q(n){const e=String(n||"").split(/[\s\p{P}]+/u).filter(Boolean);let r={words:0,english:0,shaped:0,share:0,script:null};for(const[t,o]of Object.entries(U)){const a=e.filter(i=>o.test(i)).map(O);if(a.length<=r.words)continue;const s=a.filter(i=>D[t].has(i)).length,c=K[t],g=c?a.filter(i=>D[t].has(i)||q[t]?.has(i)||i.endsWith(c)).length:s;r={words:a.length,english:s,shaped:g,share:s/a.length,script:t}}return r}function ce(n){const e=Q(n);return e.english>=V&&e.share>=Y||e.script==="te"&&e.words>=J&&e.shaped===e.words}function le(n=[]){const e=d(n),r=e.filter(t=>f.has(t));return r.length>=2?`Speech models often mix up ${b(r)}. List only the ones actually spoken in your meetings — one Indian language with English works best.`:e.length?null:"Speak an Indian language? Add it here — detection on its own often mistakes Telugu for Hindi, Tamil or English."}const X=Object.freeze(k.map(n=>n.code)),ue=.8,he=2;function ge(n=[]){const e=d(n);return e.some(r=>f.has(r))?W(["en",...e]):[...X]}export{$ as ANY_LANGUAGE_CONFIDENCE,X as AUTO_LANGUAGES,ue as AUTO_LEARN_CONFIDENCE,he as AUTO_LEARN_SECONDS,I as INDIC_ENGINE_LANGUAGES,x as INDIC_SPEECH_MODEL,G as INDIC_SWITCH_CONFIDENCE,k as MEETING_LANGUAGES,N as PARAKEET_LANGUAGES,P as SHORT_CLIP_CONFIDENCE,R as SHORT_CLIP_S,V as SPELLED_ENGLISH_MIN,Y as SPELLED_ENGLISH_SHARE,J as SPELLED_SHAPE_MIN,A as TRANSLATE_TARGET,v as WIDE_SPEECH_MODEL,ge as autoCandidates,ae as captureLanguageOptions,ie as coverageNote,W as decodeLanguages,ee as detectTextLanguage,ce as isSpelledEnglish,T as languageInfo,y as languageName,le as languagesHint,re as lineForModel,se as lineLanguage,te as localTranslatable,j as modelForLanguages,ne as needsTranslation,E as normalizeLanguage,d as normalizeLanguages,Z as pickSegmentLanguage,L as speechCoverage,Q as spelledEnglish,oe as sttEngineOf};
|
package/subject-match.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=r=>String(r||"").toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").match(/[\p{L}\p{N}]+/gu)||[];function g(r,l){if(Math.abs(r.length-l.length)>2)return 3;let h=Array.from({length:l.length+1},(n,e)=>e);for(let n=1;n<=r.length;n++){const e=[n];for(let t=1;t<=l.length;t++)e[t]=Math.min(h[t]+1,e[t-1]+1,h[t-1]+(r[n-1]===l[t-1]?0:1));h=e}return h[l.length]}function a(r,l){const h=o(l).filter(e=>e.length>3);if(!h.length)return!0;const n=new Set(o(r));return h.every(e=>n.has(e)||[...n].some(t=>t.length>3&&g(e,t)<=(e.length>=8?2:1)))}export{a as namesSubject};
|
package/turn-gather.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{prefetchAttachment as
|
|
1
|
+
import{namesSubject as B}from"./subject-match.js";import{prefetchAttachment as Q,prefetchBudgetMs as L,prefetchMissed as U,lookupResult as T,lookupLabel as D,runResearchItem as V,resolvedOf as X}from"./prefetch.js";import{shapePageRead as Y}from"./page-context.js";import{createTurnEvents as Z}from"./turn-events.js";const tt=Object.freeze({concurrency:3,searches:6,researchMs:25e3});function O(o){const s=String(o||"");return!s.trim()||/^(error\b|\w+ failed\b|\{"error")/i.test(s)||/could not answer|now call web_search/i.test(s)}function $(o){return(o?.input?.action||o?.tool)==="web_search"}function et(o,s=""){return $(o)||/web search/i.test(String(s||""))}const nt=o=>`error: ${String(o?.message||o).slice(0,80)}`;async function ot(o,s,y){const c=new Array(o.length);let l=0;return await Promise.all(Array.from({length:Math.max(1,Math.min(s,o.length))},async()=>{for(;l<o.length;){const u=l++;c[u]=await y(o[u],u)}})),c}async function ut(o,{execute:s,fetched:y=null,deadline:c=null,events:l=Z(),now:u=()=>Date.now(),limits:z={},budget:S={searches:0},remember:C={},signal:v=null,read:G=null,rerank:H=null,attach:b=!0,page:d=null}={}){const k={...tt,...z},w=(Array.isArray(o)?o:[]).filter(t=>t&&typeof t=="object"&&t.tool);if(typeof s!="function"||!w.length)return{results:[],attachments:[],steps:[],found:!1};async function E(t,a){const J=u(),p=(e,n={})=>({item:t,status:e,text:"",note:"",ms:Math.max(0,u()-J),attachment:null,cached:!1,...n});if(v?.aborted)return p("skipped",{why:"stopped"});if(t.kind==="research"){const e=typeof c=="function"?c(k.researchMs):null;try{const n=await V(t,{execute:s,until:e?.promise||null,now:u,read:G,rerank:H,onActivity:i=>l.custom("activity",i)});return n.attachment&&b&&l.custom("attachment",{attachment:n.attachment}),p(n.status,{text:n.text,note:n.note,attachment:b?n.attachment:null})}finally{e?.cancel?.()}}if($(t)){if(S.searches>=k.searches)return p("skipped",{why:"over the turn's search budget"});S.searches+=1}const K=l.toolStart({name:t.tool,input:t.input,label:t.label||""}),x=e=>(l.toolResult({toolCallId:K,name:t.tool,status:e.status,label:e.status==="ok"?D(t,e.note):t.label||"",ms:e.ms,content:e.text,note:e.note}),e),R=(e,n="")=>b?Q(t,e,{now:u()+a,note:n}):null,q=async(e,n="")=>{if(t.kind!=="page"||!d)return{text:e,note:n};const i=await Y(e,{...d,question:t.ask||d.question||"",queries:[d.query].filter(Boolean),now:u}).catch(()=>null);return i?.context?{text:i.text,note:i.note||n}:{text:e,note:n}};let m=null;try{m=y?.lookup?.(t.tool,t.input)||null}catch{m=null}if(m&&typeof m.text=="string"&&m.text){try{y.use?.(m.id)}catch{}const e=await q(m.text),n=R(e.text,e.note),i=x(p("cached",{text:e.text,note:e.note,attachment:n,cached:!0}));return n&&l.custom("attachment",{attachment:n}),i}let r="",h="";const g=typeof c=="function"?c(L(t)):null;try{const e=Promise.resolve().then(()=>s(t.tool,t.input,{prefetched:!0})),n=g?.promise?await Promise.race([e,Promise.resolve(g.promise).then(()=>{throw new Error("prefetch timed out")})]):await e;({text:r,note:h}=T(n))}catch(e){return x(p(nt(e)))}finally{g?.cancel?.()}const M=(e,n)=>!!t.about&&et(t,n)&&!B(e,t.about);let _=t.input;if(O(r)||M(r,h)){const e=t.retry;let n=null;if(e?.input&&!v?.aborted){const P=typeof c=="function"?c(L(t)):null;try{const j=Promise.resolve().then(()=>s(t.tool,e.input,{prefetched:!0}));n=T(P?.promise?await Promise.race([j,Promise.resolve(P.promise).then(()=>{throw new Error("prefetch timed out")})]):await j)}catch{n=null}finally{P?.cancel?.()}}const i=n?X(n.text)||n.text:"";if(!(n&&!O(n.text)&&!M(n.text,n.note)&&(!e.context||B(i,e.context))))return x(p("skipped",M(r,h)?{why:`the result did not name ${t.about}`}:{}));({text:r,note:h}=n),_=e.input}try{y?.remember?.({tool:t.tool,input:_,text:r,...C})}catch{}({text:r,note:h}=await q(r,h));const A=R(r,h),N=x(p("ok",{text:r,note:h,attachment:A}));return A&&l.custom("attachment",{attachment:A}),N}const f=new Array(w.length),I=t=>t&&(t.status==="ok"||t.status==="cached")&&!U(t.text),W=w.map((t,a)=>({item:t,i:a})).filter(t=>!t.item.fallback);await ot(W,k.concurrency,async({item:t,i:a})=>{f[a]=await E(t,a)});for(const[t,a]of w.entries())a.fallback&&(f[t]=f.some(I)?{item:a,status:"skipped",text:"",note:"",ms:0,attachment:null,cached:!1,why:"an earlier look-up answered"}:await E(a,t));const F=f.filter(t=>t&&!(t.status==="skipped"&&t.why));return{results:f,attachments:f.map(t=>t?.attachment).filter(Boolean),steps:F.map(t=>({tool:t.item.kind==="research"?"research":t.item.tool,input:t.item.input,kind:t.item.kind,label:t.status==="ok"?D(t.item,t.note):t.item.label||"",status:t.status,ms:t.ms,prefetched:!0,...t.text?{result:t.text}:{},...t.note?{note:t.note}:{}})),found:f.some(I)}}export{tt as GATHER_LIMITS,ut as gatherItems,O as isMiss,$ as isWebSearch};
|
package/weather-tool.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{getWeather as f,isHere as d}from"./weather.js";const
|
|
1
|
+
import{getWeather as f,isHere as d}from"./weather.js";import{namesSubject as w}from"./subject-match.js";const S="weather",p="For weather, call `weather` FIRST — it answers the whole question in one request. Only fall back to web_search if it tells you to. Report the location it says it resolved, because a bare town name can geocode to the wrong place.";function v({fetchJson:h,search:a=null}={}){if(typeof h!="function")throw new Error("weatherToolProvider: fetchJson required");return{specs:[{name:"weather",annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!0},description:"Current conditions and a short forecast for one place, in a single request. Use this for any weather question instead of searching. Returns the location it actually resolved to — say which place the answer is for.",parameters:{type:"object",properties:{location:{type:"string",description:'A place, as the user said it. Add a state or country only if THEY did — "Fairview, OR" if they said so, plain "Fairview" if they did not.'}},required:["location"],additionalProperties:!1}}],system:p,async execute(c,n){if(c!=="weather")return JSON.stringify({error:`Unknown tool: ${c}`});const u=String(n?.location||"").trim(),s=d(u)?"":u,i=await f(s,{fetchJson:h});if(!i.ok){const t=s||"my area";if(typeof a=="function"){const o=`weather in ${t}`,e=await Promise.resolve().then(()=>a(o)).catch(()=>null),r=typeof e=="string"?e:e?.text,l=g(r,{place:s});if(l)return{text:`Weather for "${t}", from a web search for "${o}" (the weather service did not know the place). Report it as the forecast for the place the sources name; say which place that is.
|
|
2
2
|
|
|
3
|
-
`+
|
|
4
|
-
`).filter(
|
|
5
|
-
`)){const
|
|
6
|
-
`);return
|
|
3
|
+
`+l,note:"ChatPanel · web search"}}return`The weather service could not answer for "${t}" (${i.reason}). Now call web_search for "weather in ${t}" and answer from the results — do not tell the user a tool failed.`}return{text:i.text,note:"ChatPanel · wttr.in"}}}}const y=/(?:-?\d{1,3}\s?°|°\s?[FC]\b|\b(?:high|low|feels like|currently|tonight|today|tomorrow)\b.*\d|\b(?:rain|showers|snow|sunny|sun|cloud(?:y|s)?|overcast|fog|clear|storm|wind|humidity|breeze)\b)/i;function g(h,{maxChars:a=1600,place:c=""}={}){const n=String(h||"");if(!n.trim()||c&&!w(n,c))return"";const u=n.replace(/<svg[\s\S]*?<\/svg>/gi," ").replace(/<[^>]+>/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\]\((?:https?:)?[^)]*\)/g,"]"),s=(/(?:^|\n)Sources:\n([\s\S]*?)(?:\n---|\n\n#|$)/.exec(n)?.[1]||"").split(`
|
|
4
|
+
`).filter(e=>/^\[\d+\]/.test(e.trim())).slice(0,5),i=new Set,t=[];for(const e of u.split(`
|
|
5
|
+
`)){const r=e.replace(/[\t ]+/g," ").replace(/^[\s\d.,#*[\]-]{0,6}/,"").trim();if(r.length<4||r.length>200||!y.test(r)||/citation rules|cite it inline|sources section/i.test(r))continue;const l=r.toLowerCase();i.has(l)||(i.add(l),t.push(`- ${r}`))}if(!t.some(e=>/\d\s?°|°\s?[FC]/.test(e)))return"";let o=t.join(`
|
|
6
|
+
`);return o.length>a&&(o=o.slice(0,a).replace(/\n[^\n]*$/,"")),s.length?`${o}
|
|
7
7
|
|
|
8
8
|
Sources:
|
|
9
|
-
${
|
|
10
|
-
`)}`:
|
|
9
|
+
${s.join(`
|
|
10
|
+
`)}`:o}export{S as WEATHER_TOOL_NAME,p as WEATHER_TOOL_SYSTEM,g as weatherFromSearch,v as weatherToolProvider};
|
package/web-address.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,24}(?::\d{1,5})?(?:[/?#].*)?$/i,i=/\.(?:html?|md|markdown|txt|pdf|png|jpe?g|gif|webp|svg|js|mjs|json|css|csv|zip)$/i;function e(s){const t=String(s??"").trim();if(!t)return null;if(/^(?:https?:\/\/|mailto:)/i.test(t))return t;if(/^[a-z][a-z0-9+.-]*:(?!\d)/i.test(t)||t.startsWith("//"))return null;const n=t.split(/[/?#]/)[0];return!r.test(t)||i.test(n)?null:`https://${t}`}export{e as externalUrl};
|