@cachly-dev/mcp-server 0.10.247 → 0.10.249
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/dist/src/doppel-kandidat.js +1 -1
- package/dist/src/handlers/brain.js +60 -60
- package/dist/src/handlers/fedbrain.js +39 -38
- package/dist/src/handlers/team.js +32 -32
- package/dist/src/rangfolge-stellschrauben.js +1 -1
- package/dist/src/tools.js +1 -1
- package/dist/src/utils.js +1 -1
- package/glama.json +1 -1
- package/hooks/cachly-ambient-einblendung.mjs +8 -8
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{kosinus as
|
|
1
|
+
import{kosinus as y}from"./bedeutung.js";import{DOPPEL_SCHWELLE as L,NAH_ANZAHL as P,NAH_UNTERGRENZE as _}from"./rangfolge-stellschrauben.js";import{istTeamweit as S,teamweitLesbar as T}from"./utils.js";const f="cachly:doppel:kandidaten",k=40,A=14,O=30,H=90*86400,I=1500,$=6,x=864e5,b={doppel:null,nahe:[]},D=t=>typeof t.what_worked=="string"?t.what_worked.trim().length:0;function w(t,e,o,n=L){return t.topic===e.topic||!(o>=n)||D(t)<k||D(e)<k?!1:!(t.ersetzt===e.topic||t.ersetzt_durch===e.topic||e.ersetzt===t.topic||e.ersetzt_durch===t.topic)}function z(t,e){let o=null;for(const n of e)w(t,n.lektion,n.naehe)&&(!o||n.naehe>o.naehe)&&(o={topic:n.lektion.topic,naehe:n.naehe});return o}function g(t){if(!t)return null;try{const e=JSON.parse(t);return e&&typeof e=="object"?e:null}catch{return null}}const d=t=>Math.round(t*1e3)/1e3;function v(t,e,o){return e.filter(n=>n.lektion.topic!==o&&w(t,n.lektion,n.naehe,_)).sort((n,i)=>i.naehe-n.naehe).slice(0,P).map(n=>({topic:n.lektion.topic,naehe:d(n.naehe)}))}async function M(t,e,o,n,i=new Date){try{await n.aktualisiere(t);const r=n.aehnlichste(o,$+1).filter(c=>c.topic!==e.topic&&c.naehe>=_);let a=null,l=[];if(r.length>0){const c=await t.mget(...r.map(m=>`cachly:lesson:best:${m.topic}`)),p=r.flatMap((m,N)=>{const E=T(c[N]);return E?[{lektion:{...E,topic:m.topic},naehe:m.naehe}]:[]});a=z(e,p),l=v(e,p,a?.topic)}const s=await t.hgetall(f),h=Object.entries(s).filter(([c,p])=>c===e.topic||i.getTime()-Date.parse(String(g(p)?.am??""))>O*x||!g(p)).map(([c])=>c);if(h.length>0&&await t.hdel(f,...h),!a)return{doppel:null,nahe:l};const u={neu:e.topic,alt:a.topic,naehe:d(a.naehe),am:i.toISOString()};return S(e)&&(await t.hset(f,e.topic,JSON.stringify({alt:u.alt,naehe:u.naehe,am:u.am})),await t.expire(f,H)),{doppel:u,nahe:l}}catch{return b}}async function C(t,e,o,n,i=new Date){return(await M(t,e,o,n,i)).doppel}async function F(t,e=I){let o;const n=new Promise(i=>{o=setTimeout(()=>i(null),e),o.unref?.()});try{return await Promise.race([t,n])}finally{o&&clearTimeout(o)}}function B(t,e=""){return!t||e.includes(`\`${t.alt}\``)?"":`\u267B\uFE0F Says almost the same as \`${t.alt}\` (similarity ${t.naehe.toFixed(2)}). If this is the newer version: write the same lesson again with \`ersetzt="${t.alt}"\` and \`grund\`. If it is a separate matter: nothing to do.`}function J(t,e=""){const o=t.filter(i=>!e.includes(`\`${i.topic}\``));return o.length===0?"":`\u{1F50E} Older lessons on the same subject: ${o.map(i=>`\`${i.topic}\` (${i.naehe.toFixed(2)})`).join(", ")}. Does this one replace one of them? If so: write it again with \`ersetzt="<topic>"\` and \`grund\` \u2014 recall then shows this one as current. If not: nothing to do.`}async function K(t,e,o=new Date){try{const n=await t.hgetall(f),i=new Map(e.map(a=>[a.topic,a])),r=[];for(const[a,l]of Object.entries(n)){const s=g(l);if(!s||typeof s.alt!="string")continue;const h=String(s.am??"");if(!(o.getTime()-Date.parse(h)<=A*x))continue;const u=i.get(a),c=i.get(s.alt),p=Number(s.naehe);!u||!c||!w(u,c,p)||r.push({neu:a,alt:s.alt,naehe:p,am:h})}return r.sort((a,l)=>l.naehe-a.naehe)}catch{return[]}}function U(t){const e=[];for(let o=0;o<t.length;o++)for(let n=o+1;n<t.length;n++){const i=t[o],r=t[n],a=y(i.vektor,r.vektor);if(!w(i.lektion,r.lektion,a))continue;const l=String(i.lektion.ts??"")>=String(r.lektion.ts??""),[s,h]=l?[i.lektion,r.lektion]:[r.lektion,i.lektion];e.push({neu:s.topic,alt:h.topic,naehe:d(a)})}return e.sort((o,n)=>n.naehe-o.naehe)}export{A as DOPPEL_BRIEFING_TAGE,O as DOPPEL_HALTEN_TAGE,k as DOPPEL_MINDEST_TEXT,f as DOPPEL_SCHLUESSEL,H as DOPPEL_TTL_S,I as DOPPEL_WARTE_MS,b as KEINE_NACHBARN,B as doppelHinweis,U as doppelPaare,K as leseDoppelKandidaten,F as mitFrist,J as nahHinweis,C as pruefeDoppelung,M as pruefeNachbarn,z as waehleDoppelKandidat,v as waehleNahe,w as zaehltAlsDoppelung};
|