@cachly-dev/mcp-server 0.10.284 → 0.10.286

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/rolle.js CHANGED
@@ -1,13 +1,13 @@
1
- import{AsyncLocalStorage as T}from"node:async_hooks";import{mitgliedDarfSchreiben as O}from"./schluessel-klassen.js";const D=new Set(["admin","reviewer","contributor","viewer"]),M=6e4,m="https://cachly.dev/team";let h=null,$=()=>"";const p=new Map,g=new Map;function z(t){h=t.abruf,$=t.bereich??(()=>""),p.clear(),g.clear()}function W(){z({abruf:null}),d.clear()}function L(t){if(!t||typeof t!="object")return null;const e=t;if(typeof e.role!="string"||!D.has(e.role))return null;const n=e.can&&typeof e.can=="object"?e.can:{};return{role:e.role,source:typeof e.source=="string"?e.source:"",can:{learn:n.learn===!0,confirm:n.confirm===!0,withdraw:n.withdraw===!0,manage:n.manage===!0},review_mode:e.review_mode===!0,protection:typeof e.protection=="string"?e.protection:"",...e.knowledge&&typeof e.knowledge=="object"?{knowledge:e.knowledge}:{},...typeof e.min_mcp=="string"?{min_mcp:e.min_mcp}:{},...e.rooms===!0?{rooms:!0}:{}}}function x(t){return`${$()}|${t}`}async function q(t){if(!h||!t)return null;const e=x(t),n=p.get(e);if(n&&Date.now()-n.am<M)return n.auskunft;const o=g.get(e);return n?(o||S(e,t,n),n.auskunft):o||S(e,t,void 0)}function S(t,e,n){if(!h)return Promise.resolve(n?.auskunft??null);const o=h,r=(async()=>{try{const i=L(await o(`/api/v1/instances/${encodeURIComponent(e)}/role`));return p.set(t,{auskunft:i,am:Date.now()}),i}catch(i){return b(i).status===404?(p.set(t,{auskunft:null,am:Date.now()}),null):n?.auskunft??null}})().finally(()=>g.delete(t));return g.set(t,r),r}function P(t){return p.get(x(t))?.auskunft??null}function K(t,e,n){if(t&&typeof t=="object"){const o=n&&typeof n=="object"?n:{};Object.assign(t,{apiStatus:e,...typeof o.code=="string"?{apiCode:o.code}:{},...typeof o.role=="string"?{apiRole:o.role}:{},...typeof o.reason=="string"?{apiReason:o.reason}:{}})}return t}function b(t){const e=t&&typeof t=="object"?t:{},n=(u,a)=>typeof u=="string"?u:typeof a=="string"?a:void 0,o={},r=typeof e.apiStatus=="number"?e.apiStatus:typeof e.status=="number"?e.status:void 0;r!==void 0&&(o.status=r);const i=n(e.apiCode,e.code);i!==void 0&&(o.code=i);const s=n(e.apiRole,e.role);s!==void 0&&(o.role=s);const c=n(e.apiReason,e.reason);if(c!==void 0&&(o.reason=c),o.status===void 0){const u=/\((\d{3})\)|error (\d{3})/.exec(String(e.message??""));u&&(o.status=Number(u[1]??u[2]))}return o}const w=new WeakMap;function v(t){return t&&typeof t=="object"?w.get(t):void 0}function C(t){return v(t)?.access==="member"}function I(t){const e=v(t);return(e?.instanceId?P(e.instanceId)?.role:void 0)??e?.role??"contributor"}function Q(t,e){return!C(t)||O(e)}const X="member_access_unavailable";function Y(t,e){const n=e?` (Grund: ${e})`:"";return[`\u{1F512} Der Zugang fuer Mitglieder zu Brain "${t}" geht gerade nicht${n}.`,`Bitte den Besitzer des Brains oder einen Org-Admin fragen. Rollen und Zugang stehen unter ${m}.`,"(Member access to this brain is not available right now; ask the brain owner or an organisation admin.)"].join(`
2
- `)}const A="Das darf nur der Besitzer oder ein Admin.";function R(t){return`${A} Deine Rolle: ${t}.`}class U extends Error{rolle;constructor(e){super(R(e)),this.name="SchreibVerweigert",this.rolle=e}}function _(t){if(!t||typeof t!="object")return!1;const e=t;return/\bNOPERM\b/.test(String(e.message??""))?!0:Array.isArray(e.previousErrors)&&e.previousErrors.some(n=>_(n))}const k=new T;function F(t){const e=k.getStore();e&&(e.abgewiesen++,e.rolle=t)}async function ee(t){const e={abgewiesen:0};return{ergebnis:await k.run(e,t),abgewiesen:e.abgewiesen,rolle:e.rolle}}function te(t,e,n="contributor"){if(e<=0||t.includes(A))return t;const o=e===1?"1 Schreibbefehl":`${e} Schreibbefehle`;return`${t}
1
+ import{AsyncLocalStorage as T}from"node:async_hooks";import{mitgliedDarfSchreiben as O}from"./schluessel-klassen.js";const D=new Set(["admin","reviewer","contributor","viewer"]),M=6e4,m="https://cachly.dev/team";let g=null,$=()=>"";const p=new Map,h=new Map;function z(t){g=t.abruf,$=t.bereich??(()=>""),p.clear(),h.clear()}function W(){z({abruf:null}),d.clear()}function L(t){if(!t||typeof t!="object")return null;const e=t;if(typeof e.role!="string"||!D.has(e.role))return null;const n=e.can&&typeof e.can=="object"?e.can:{};return{role:e.role,source:typeof e.source=="string"?e.source:"",can:{learn:n.learn===!0,confirm:n.confirm===!0,withdraw:n.withdraw===!0,manage:n.manage===!0},review_mode:e.review_mode===!0,protection:typeof e.protection=="string"?e.protection:"",...e.knowledge&&typeof e.knowledge=="object"?{knowledge:e.knowledge}:{},...typeof e.min_mcp=="string"?{min_mcp:e.min_mcp}:{},...e.rooms===!0?{rooms:!0}:{}}}function x(t){return`${$()}|${t}`}async function q(t){if(!g||!t)return null;const e=x(t),n=p.get(e);if(n&&Date.now()-n.am<M)return n.auskunft;const r=h.get(e);return n?(r||S(e,t,n),n.auskunft):r||S(e,t,void 0)}function S(t,e,n){if(!g)return Promise.resolve(n?.auskunft??null);const r=g,o=(async()=>{try{const i=L(await r(`/api/v1/instances/${encodeURIComponent(e)}/role`));return p.set(t,{auskunft:i,am:Date.now()}),i}catch(i){return b(i).status===404?(p.set(t,{auskunft:null,am:Date.now()}),null):n?.auskunft??null}})().finally(()=>h.delete(t));return h.set(t,o),o}function P(t){return p.get(x(t))?.auskunft??null}function K(t,e,n){if(t&&typeof t=="object"){const r=n&&typeof n=="object"?n:{};Object.assign(t,{apiStatus:e,...typeof r.code=="string"?{apiCode:r.code}:{},...typeof r.role=="string"?{apiRole:r.role}:{},...typeof r.reason=="string"?{apiReason:r.reason}:{},...typeof r.grund=="string"?{apiGrund:r.grund}:{}})}return t}function b(t){const e=t&&typeof t=="object"?t:{},n=(u,a)=>typeof u=="string"?u:typeof a=="string"?a:void 0,r={},o=typeof e.apiStatus=="number"?e.apiStatus:typeof e.status=="number"?e.status:void 0;o!==void 0&&(r.status=o);const i=n(e.apiCode,e.code);i!==void 0&&(r.code=i);const s=n(e.apiRole,e.role);s!==void 0&&(r.role=s);const c=n(e.apiReason,e.reason);if(c!==void 0&&(r.reason=c),typeof e.apiGrund=="string"&&(r.grund=e.apiGrund),r.status===void 0){const u=/\((\d{3})\)|error (\d{3})/.exec(String(e.message??""));u&&(r.status=Number(u[1]??u[2]))}return r}const w=new WeakMap;function v(t){return t&&typeof t=="object"?w.get(t):void 0}function C(t){return v(t)?.access==="member"}function I(t){const e=v(t);return(e?.instanceId?P(e.instanceId)?.role:void 0)??e?.role??"contributor"}function Q(t,e){return!C(t)||O(e)}const X="member_access_unavailable";function Y(t,e){const n=e?` (Grund: ${e})`:"";return[`\u{1F512} Der Zugang fuer Mitglieder zu Brain "${t}" geht gerade nicht${n}.`,`Bitte den Besitzer des Brains oder einen Org-Admin fragen. Rollen und Zugang stehen unter ${m}.`,"(Member access to this brain is not available right now; ask the brain owner or an organisation admin.)"].join(`
2
+ `)}const A="Das darf nur der Besitzer oder ein Admin.";function R(t){return`${A} Deine Rolle: ${t}.`}class G extends Error{rolle;constructor(e){super(R(e)),this.name="SchreibVerweigert",this.rolle=e}}function _(t){if(!t||typeof t!="object")return!1;const e=t;return/\bNOPERM\b/.test(String(e.message??""))?!0:Array.isArray(e.previousErrors)&&e.previousErrors.some(n=>_(n))}const k=new T;function U(t){const e=k.getStore();e&&(e.abgewiesen++,e.rolle=t)}async function ee(t){const e={abgewiesen:0};return{ergebnis:await k.run(e,t),abgewiesen:e.abgewiesen,rolle:e.rolle}}function te(t,e,n="contributor"){if(e<=0||t.includes(A))return t;const r=e===1?"1 Schreibbefehl":`${e} Schreibbefehle`;return`${t}
3
3
 
4
- \u{1F512} ${R(n)} Nicht gespeichert: ${o} dieses Aufrufs.`}function y(t){return!!t&&typeof t.then=="function"}function G(t){return e=>{if(!_(e))return e;const n=t();return F(n),new U(n)}}function V(t,e){return Array.isArray(t)?t.map(n=>Array.isArray(n)&&n[0]?[e(n[0]),n[1]]:n):t}function Z(t,e){const n=new Map,o=new Proxy(t,{get(r,i){const s=Reflect.get(r,i,r);if(typeof s!="function")return s;if(n.has(i))return n.get(i);const c=(...u)=>{const a=s.apply(r,u);return a===r?o:i==="exec"&&y(a)?a.then(l=>V(l,e),l=>{throw e(l)}):y(a)?a.then(void 0,l=>{throw e(l)}):a};return n.set(i,c),c}});return o}function ne(t,e){const n={...e,access:"member"},o=G(()=>I(i)),r=new Map,i=new Proxy(t,{get(s,c){const u=Reflect.get(s,c,s);if(typeof u!="function")return u;if(r.has(c))return r.get(c);const a=(...l)=>{const f=u.apply(s,l);return f===s?i:y(f)?f.then(void 0,j=>{throw o(j)}):(c==="pipeline"||c==="multi")&&f&&typeof f=="object"?Z(f,o):f};return r.set(c,a),a}});return w.set(i,n),i}function re(t,e={}){w.set(t,{...e,access:"full"})}function N(t,e){const n=b(t);return n.role?n.role:n.code?.startsWith("role_")?n.code.slice(5):e}function E(t){return(t instanceof Error?t.message:String(t)).split(`
5
- `)[0].slice(0,300)}async function oe(t,e,n,o){let r;try{r=await t(`/api/v1/instances/${encodeURIComponent(e)}/learn`,{method:"POST",body:JSON.stringify({source:"mcp",...n})})}catch(c){const u=b(c);return u.status===403&&u.code==="group_forbidden"?[`\u{1F512} Du bist nicht Mitglied der Gruppe \`${n.group??""}\`. Nichts wurde gespeichert.`,`Gruppen setzt der Besitzer oder ein Admin unter ${m}.`].join(`
6
- `):u.status===409&&u.code==="topic_exists_team"?`\u26A0\uFE0F Nicht gespeichert: Das Thema \`${n.topic}\` gibt es schon als Team-Lektion. Bitte einen anderen Namen waehlen.`:u.status===403?[`\u{1F512} Deine Rolle (${N(c,o)}) darf in diesem Brain keine Lektionen speichern. Nichts wurde gespeichert.`,`Rollen setzt der Besitzer oder ein Admin unter ${m}.`].join(`
7
- `):`\u26A0\uFE0F Nicht gespeichert: Die API hat \`${n.topic}\` nicht angenommen (${E(c)}). Bitte noch einmal versuchen.`}const i=r?.topic||n.topic;if(r?.proposed)return[`\u{1F4DD} **Lesson submitted for review** \u2014 \`${i}\` is now a pending proposal.`,"","This team requires review before knowledge enters the Team Brain (org setting).","An org owner/admin can approve or reject it in the dashboard under **Team \u2192 Review**.","Until approved it will NOT surface in `smart_recall` / `team_recall`."].join(`
8
- `);const s=r?.room==="private"?" in your private room":r?.room==="group"?` in the room of group \`${n.group??""}\``:"";return[`\u2705 Lesson stored: \`${i}\` (${n.outcome})${s} \u2014 saved through the cachly API as a team member (role: ${o}).`,`\u{1F4A1} ${String(n.what_worked??"").slice(0,120)}`].join(`
9
- `)}async function ie(t,e,n,o){try{const r=await t(`/api/v1/instances/${encodeURIComponent(e)}/lessons/confirm`,{method:"POST",body:JSON.stringify(n)}),i=r?.review_level==="senior"?"\u{1F6E1}\uFE0F senior-reviewed":"\u2714\uFE0F peer-reviewed",s=Number(r?.endorsements??0);return`${i} \u2014 \`${r?.topic??n.topic}\` confirmed by **${r?.reviewed_by??"?"}** (role: ${o}, ${s} distinct endorsement${s===1?"":"s"}).
10
- \u{1F4C8} This lesson now ranks higher in \`smart_recall\` / \`team_recall\`.`}catch(r){const i=b(r);return i.status===403?[`\u{1F512} Bestaetigen duerfen nur reviewer und admin. Deine Rolle: ${N(r,o)}. Nichts wurde geaendert.`,`Rollen setzt der Besitzer oder ein Admin unter ${m}.`].join(`
4
+ \u{1F512} ${R(n)} Nicht gespeichert: ${r} dieses Aufrufs.`}function y(t){return!!t&&typeof t.then=="function"}function F(t){return e=>{if(!_(e))return e;const n=t();return U(n),new G(n)}}function V(t,e){return Array.isArray(t)?t.map(n=>Array.isArray(n)&&n[0]?[e(n[0]),n[1]]:n):t}function Z(t,e){const n=new Map,r=new Proxy(t,{get(o,i){const s=Reflect.get(o,i,o);if(typeof s!="function")return s;if(n.has(i))return n.get(i);const c=(...u)=>{const a=s.apply(o,u);return a===o?r:i==="exec"&&y(a)?a.then(l=>V(l,e),l=>{throw e(l)}):y(a)?a.then(void 0,l=>{throw e(l)}):a};return n.set(i,c),c}});return r}function ne(t,e){const n={...e,access:"member"},r=F(()=>I(i)),o=new Map,i=new Proxy(t,{get(s,c){const u=Reflect.get(s,c,s);if(typeof u!="function")return u;if(o.has(c))return o.get(c);const a=(...l)=>{const f=u.apply(s,l);return f===s?i:y(f)?f.then(void 0,j=>{throw r(j)}):(c==="pipeline"||c==="multi")&&f&&typeof f=="object"?Z(f,r):f};return o.set(c,a),a}});return w.set(i,n),i}function re(t,e={}){w.set(t,{...e,access:"full"})}function N(t,e){const n=b(t);return n.role?n.role:n.code?.startsWith("role_")?n.code.slice(5):e}function E(t){return(t instanceof Error?t.message:String(t)).split(`
5
+ `)[0].slice(0,300)}async function oe(t,e,n,r){let o;try{o=await t(`/api/v1/instances/${encodeURIComponent(e)}/learn`,{method:"POST",body:JSON.stringify({source:"mcp",...n})})}catch(c){const u=b(c);return u.status===403&&u.code==="group_forbidden"?[`\u{1F512} Du bist nicht Mitglied der Gruppe \`${n.group??""}\`. Nichts wurde gespeichert.`,`Gruppen setzt der Besitzer oder ein Admin unter ${m}.`].join(`
6
+ `):u.status===409&&u.code==="topic_exists_team"?`\u26A0\uFE0F Nicht gespeichert: Das Thema \`${n.topic}\` gibt es schon als Team-Lektion. Bitte einen anderen Namen waehlen.`:u.status===403?[`\u{1F512} Deine Rolle (${N(c,r)}) darf in diesem Brain keine Lektionen speichern. Nichts wurde gespeichert.`,`Rollen setzt der Besitzer oder ein Admin unter ${m}.`].join(`
7
+ `):`\u26A0\uFE0F Nicht gespeichert: Die API hat \`${n.topic}\` nicht angenommen (${E(c)}). Bitte noch einmal versuchen.`}const i=o?.topic||n.topic;if(o?.proposed)return[`\u{1F4DD} **Lesson submitted for review** \u2014 \`${i}\` is now a pending proposal.`,"","This team requires review before knowledge enters the Team Brain (org setting).","An org owner/admin can approve or reject it in the dashboard under **Team \u2192 Review**.","Until approved it will NOT surface in `smart_recall` / `team_recall`."].join(`
8
+ `);const s=o?.room==="private"?" in your private room":o?.room==="group"?` in the room of group \`${n.group??""}\``:"";return[`\u2705 Lesson stored: \`${i}\` (${n.outcome})${s} \u2014 saved through the cachly API as a team member (role: ${r}).`,`\u{1F4A1} ${String(n.what_worked??"").slice(0,120)}`].join(`
9
+ `)}async function ie(t,e,n,r){try{const o=await t(`/api/v1/instances/${encodeURIComponent(e)}/lessons/confirm`,{method:"POST",body:JSON.stringify(n)}),i=o?.review_level==="senior"?"\u{1F6E1}\uFE0F senior-reviewed":"\u2714\uFE0F peer-reviewed",s=Number(o?.endorsements??0);return`${i} \u2014 \`${o?.topic??n.topic}\` confirmed by **${o?.reviewed_by??"?"}** (role: ${r}, ${s} distinct endorsement${s===1?"":"s"}).
10
+ \u{1F4C8} This lesson now ranks higher in \`smart_recall\` / \`team_recall\`.`}catch(o){const i=b(o);return i.status===403?[`\u{1F512} Bestaetigen duerfen nur reviewer und admin. Deine Rolle: ${N(o,r)}. Nichts wurde geaendert.`,`Rollen setzt der Besitzer oder ein Admin unter ${m}.`].join(`
11
11
  `):i.status===404?`\u{1F4ED} No best-solution lesson found for \`${n.topic}\`.
12
12
 
13
- A lesson must exist (store one with \`team_learn\` / \`learn_from_attempts\`) before it can be confirmed.`:`\u26A0\uFE0F Nicht bestaetigt: Die API hat \`${n.topic}\` nicht angenommen (${E(r)}).`}}const B=25,d=new Set;function se(t,e,n){const o=[...new Set(n.map(r=>String(r).trim()).filter(r=>r&&r.length<=200))];for(let r=0;r<o.length;r+=B){const i=o.slice(r,r+B),s=t(`/api/v1/instances/${encodeURIComponent(e)}/lessons/recalled`,{method:"POST",body:JSON.stringify({topics:i})}).then(()=>{},()=>{}).finally(()=>{d.delete(s)});d.add(s)}}async function ue(){for(;d.size>0;)await Promise.all([...d])}export{B as ABRUF_HOECHSTENS,X as CODE_ZUGANG_NICHT_VERFUEGBAR,m as ROLLEN_SEITE,M as ROLLE_FRISCH_MS,A as SCHREIBVERBOT_ANFANG,U as SchreibVerweigert,ue as abrufMeldungenFertig,ne as alsMitgliedsSpeicher,L as alsRollenAuskunft,b as apiFehler,ie as bestaetigeUeberApi,Q as darfDirektSchreiben,q as holeRolle,ee as imWerkzeugLauf,C as istMitglied,_ as istNoPerm,oe as lerneUeberApi,K as markiereApiFehler,se as meldeAbrufe,re as merkeVollenZugang,te as mitAbweisungsHinweis,z as richteRolleEin,I as rolleFuer,P as rolleImSpeicher,R as schreibverbotText,W as setzeRollenZustandZurueck,Y as zugangNichtVerfuegbarText,v as zugangVon};
13
+ A lesson must exist (store one with \`team_learn\` / \`learn_from_attempts\`) before it can be confirmed.`:`\u26A0\uFE0F Nicht bestaetigt: Die API hat \`${n.topic}\` nicht angenommen (${E(o)}).`}}const B=25,d=new Set;function se(t,e,n){const r=[...new Set(n.map(o=>String(o).trim()).filter(o=>o&&o.length<=200))];for(let o=0;o<r.length;o+=B){const i=r.slice(o,o+B),s=t(`/api/v1/instances/${encodeURIComponent(e)}/lessons/recalled`,{method:"POST",body:JSON.stringify({topics:i})}).then(()=>{},()=>{}).finally(()=>{d.delete(s)});d.add(s)}}async function ue(){for(;d.size>0;)await Promise.all([...d])}export{B as ABRUF_HOECHSTENS,X as CODE_ZUGANG_NICHT_VERFUEGBAR,m as ROLLEN_SEITE,M as ROLLE_FRISCH_MS,A as SCHREIBVERBOT_ANFANG,G as SchreibVerweigert,ue as abrufMeldungenFertig,ne as alsMitgliedsSpeicher,L as alsRollenAuskunft,b as apiFehler,ie as bestaetigeUeberApi,Q as darfDirektSchreiben,q as holeRolle,ee as imWerkzeugLauf,C as istMitglied,_ as istNoPerm,oe as lerneUeberApi,K as markiereApiFehler,se as meldeAbrufe,re as merkeVollenZugang,te as mitAbweisungsHinweis,z as richteRolleEin,I as rolleFuer,P as rolleImSpeicher,R as schreibverbotText,W as setzeRollenZustandZurueck,Y as zugangNichtVerfuegbarText,v as zugangVon};
@@ -0,0 +1 @@
1
+ import{randomUUID as r}from"node:crypto";let n=r();function u(){return n}function s(t){n=t}function i(t=n){return`cachly:session:start:${t}`}function c(t,e=n){return typeof t!="string"||t===""||t===e}export{c as gehoertDieserSitzung,s as setzeSitzungsKennung,u as sitzungsKennung,i as startmarkenSchluessel};
package/glama.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://glama.ai/mcp/schemas/server.json",
3
- "version": "0.10.284",
3
+ "version": "0.10.286",
4
4
  "maintainers": [
5
5
  "HeinrichNebula"
6
6
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cachly-dev/mcp-server",
3
- "version": "0.10.284",
3
+ "version": "0.10.286",
4
4
  "mcpName": "io.github.cachly-dev/mcp-server",
5
5
  "description": "Explain it once. Every AI knows it. cachly keeps your project's rules, decisions and fixes for every AI tool, for you, your team and your company.",
6
6
  "type": "module",
package/server.json CHANGED
@@ -17,12 +17,12 @@
17
17
  "url": "https://github.com/cachly-dev/cachly-mcp",
18
18
  "source": "github"
19
19
  },
20
- "version": "0.10.284",
20
+ "version": "0.10.286",
21
21
  "packages": [
22
22
  {
23
23
  "registryType": "npm",
24
24
  "identifier": "@cachly-dev/mcp-server",
25
- "version": "0.10.284",
25
+ "version": "0.10.286",
26
26
  "runtimeHint": "npx",
27
27
  "transport": {
28
28
  "type": "stdio"