@cachly-dev/mcp-server 0.10.279 → 0.10.281
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/ambient-cli.js +4 -2
- package/dist/src/cli-argumente.js +1 -1
- package/dist/src/client-kopf.js +1 -0
- package/dist/src/handlers/brain.js +73 -68
- package/dist/src/handlers/share.js +11 -11
- package/dist/src/handlers/team.js +49 -43
- package/dist/src/import-docs.js +11 -0
- package/dist/src/index.js +127 -123
- package/dist/src/rolle.js +12 -0
- package/dist/src/schluessel-klassen.js +1 -0
- package/dist/src/speicher-zugang.js +1 -0
- package/dist/src/suchstatistik.js +1 -1
- package/dist/src/wissenssuche.js +7 -0
- package/glama.json +1 -1
- package/hooks/cachly-ambient-einblendung.mjs +40 -36
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/src/ambient-cli.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import{promptEinblendung as
|
|
2
|
-
`).map(n=>n.trim()).filter(n=>n.length>0);return{action:(o.find(n=>
|
|
1
|
+
import{promptEinblendung as f,holeBestand as g,sitzungsKontext as m,hookAusgabe as u,estimateTokens as h,frageAusPrompt as p}from"./einblendung.js";import{holeRegeln as w,merkeRegelLieferung as b,regelAbrufMitFetch as k,regelBlock as d}from"./firmenregeln.js";import{wissensAbrufMitFetch as _,wissensPlatz as x,wissensSucheMitApi as F}from"./wissenssuche.js";function P(e){const t=(e??"").trim();if(!t)return null;try{const o=JSON.parse(t);return o&&typeof o=="object"?o:null}catch{return null}}const S=new Set(["Edit","Write","MultiEdit","NotebookEdit"]);function v(e){const t=e.hook_event_name??"UserPromptSubmit";if(t==="SessionStart"||t==="Stop")return null;if(t==="PreToolUse"){if(e.tool_name&&!S.has(e.tool_name))return null;const r=e.tool_input?.file_path;if(typeof r!="string"||!r.trim())return null;const n=r.trim().replace(/\\/g,"/"),i=(e.cwd??"").replace(/\\/g,"/").replace(/\/+$/,"");return i&&n.toLowerCase().startsWith(i.toLowerCase()+"/")?n.slice(i.length+1):n}return p(e.prompt??"")||null}const a=/\b(fixed|resolved|behoben|gefixt|root cause (was|is|found)|the bug was|der fehler (lag|war)|ursache (war|gefunden)|now passes|tests? (are|is|sind) (green|grün)|deployed successfully)\b/i,y=/\b(could not|couldn't|cannot|can't|unable to|not (yet )?(fixed|resolved|working)|still (fail|red|broken|not|deadlock)\w*|unknown|unclear|gave up|nicht (behoben|gefixt|gel(ö|oe)st)|konnte (ich )?(\w+ )?nicht|noch nicht|weiterhin|unklar)\b/i;function j(e){const t=(e.last_assistant_message??"").trim();if(t.length<80||!a.test(t)||y.test(t))return null;const o=t.split(`
|
|
2
|
+
`).map(n=>n.trim()).filter(n=>n.length>0);return{action:(o.find(n=>a.test(n))??o[0]??t).slice(0,200),outcome:"success",details:t.slice(0,500),severity:"minor"}}function A(e){const t=e.action.toLowerCase().replace(/[^a-z0-9:\-_\s]/g,"").trim().split(/\s+/).slice(0,4).join("-");return{topic:t?t.includes(":")?t:`auto:${t}`:"auto:stop",outcome:e.outcome,what_worked:e.action,context:e.details,severity:e.severity,source:"ambient-stop",tags:["auto-learned"]}}const M=u,L=5e3;async function O(e,t){try{const o=P(e);if(!o)return"";const r=o.hook_event_name??"UserPromptSubmit";if(!t.cfg.jwt||!t.cfg.instanceId)return"";let n="";if(r==="SessionStart"){const[{lessons:i},s]=await Promise.all([g(t.cfg,{force:!0,fetchFn:t.fetchFn}),w(t.cfg.instanceId,k(t.cfg.apiUrl,t.cfg.jwt,t.fetchFn))]);n=m(i,s),d(s)&&n&&b(t.cfg.instanceId,s.hash,o.cwd??process.cwd())}else{const i=v(o);if(i===null)return"";const s=r==="PreToolUse"?Promise.resolve(null):x(i,F(t.cfg.instanceId,_(t.cfg.apiUrl,t.cfg.jwt,t.fetchFn),"prompt")),c=await f(i,t.cfg,{nebenlauf:t.nebenlauf,abrufMs:L,leser:r!=="PreToolUse",session:o.session_id??null,protokoll:t.protokoll,ereignis:r,editor:t.editor,fetchFn:t.fetchFn}),l=await s;n=l?.text?[l.text,c.kontext].filter(Boolean).join(`
|
|
3
|
+
|
|
4
|
+
`):c.kontext}if(!n)return"";try{t.onInject?.(h(n),r)}catch{}return u(r,n)}catch{return""}}export{L as PROMPT_ABRUF_MS,M as buildHookOutput,P as parseHookPayload,v as recallQueryFor,O as runEinblendung,A as stopLernanfrage,j as stopObservation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const s=["ambient-auffrischen","ambient-credit","ambient-recall","ambient-stats","autopilot","autosetup","badge","bench","claim","cls-ingest","demo","digest","doctor","export","health","index","init","invite","join","learn-git","openapi","publish","refer","setup","share","startwissen-import","status","tool-specs","uninstall","upgrade"];function u(e,n){return e===void 0||e===""?"server":e==="--help"||e==="-h"||e==="help"?"hilfe":e==="--version"||e==="-v"||e==="version"?"version":s.includes(e)?"server":n?"unbekannt":"server"}function r(e,n){const t=e.indexOf(`--${n}`);if(t===-1)return;const i=e[t+1];return i===void 0||i.startsWith("--")?void 0:i}function a(e,n){return n.filter(t=>e.includes(`--${t}`)&&r(e,t)===void 0)}const o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function f(e,n){const t=[];o.test(e.instanceId)||t.push(`The instance ID "${e.instanceId.slice(0,40)}" is not a UUID. Copy it from the dashboard (Instances > your brain).`);const i=e.apiKey.split(".").length===3;return!e.apiKey.startsWith("cky_")&&!i&&t.push('The API key does not look right. It starts with "cky_" (or is a JWT with three parts).'),n.includes(e.editor)||t.push(`Unknown editor "${e.editor}". Allowed: ${n.join(", ")}.`),t}export{s as BEKANNTE_BEFEHLE,a as flagsOhneWert,u as klassiereArgument,r as leseFlag,f as pruefeInitEingaben};
|
|
1
|
+
const s=["ambient-auffrischen","ambient-credit","ambient-recall","ambient-stats","autopilot","autosetup","badge","bench","claim","cls-ingest","demo","digest","doctor","export","health","index","init","import-docs","invite","join","learn-git","openapi","publish","refer","setup","share","startwissen-import","status","tool-specs","uninstall","upgrade"];function u(e,n){return e===void 0||e===""?"server":e==="--help"||e==="-h"||e==="help"?"hilfe":e==="--version"||e==="-v"||e==="version"?"version":s.includes(e)?"server":n?"unbekannt":"server"}function r(e,n){const t=e.indexOf(`--${n}`);if(t===-1)return;const i=e[t+1];return i===void 0||i.startsWith("--")?void 0:i}function a(e,n){return n.filter(t=>e.includes(`--${t}`)&&r(e,t)===void 0)}const o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function f(e,n){const t=[];o.test(e.instanceId)||t.push(`The instance ID "${e.instanceId.slice(0,40)}" is not a UUID. Copy it from the dashboard (Instances > your brain).`);const i=e.apiKey.split(".").length===3;return!e.apiKey.startsWith("cky_")&&!i&&t.push('The API key does not look right. It starts with "cky_" (or is a JWT with three parts).'),n.includes(e.editor)||t.push(`Unknown editor "${e.editor}". Allowed: ${n.join(", ")}.`),t}export{s as BEKANNTE_BEFEHLE,a as flagsOhneWert,u as klassiereArgument,r as leseFlag,f as pruefeInitEingaben};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const f="X-Cachly-Client";function l(t){return`mcp/${t}`}function d(t,s){try{const r=new URL(t),n=new URL(s);return r.origin===n.origin&&r.pathname.startsWith(n.pathname.replace(/\/+$/,"")||"/")}catch{return!1}}function i(t,s,r=globalThis){const n=r.fetch,a=n.bind(r);return r.fetch=((e,o)=>{const h=typeof e=="string"?e:e instanceof URL?e.href:e.url;if(!d(h,t()))return a(e,o);const c=new Headers(o?.headers??(e instanceof Request?e.headers:void 0));return c.has(f)||c.set(f,s),a(e,{...o,headers:c})}),()=>{r.fetch=n}}export{f as CLIENT_KOPF,l as clientKopfWert,i as installiereClientKopf,d as istApiAdresse};
|