@easbot/memory 0.3.39 → 0.3.41
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/README.en.md +22 -18
- package/README.md +20 -18
- package/dist/assets/txt/src/plugin/tool/memory.txt +1 -1
- package/dist/chunks/{chunk-SEKBFDEC.cjs → chunk-4CMSRWL3.cjs} +5 -5
- package/dist/chunks/{chunk-KWSPFECY.cjs → chunk-77ERAHDK.cjs} +15 -15
- package/dist/chunks/{chunk-SAGLLJTU.cjs → chunk-BHGAFQCX.cjs} +1 -1
- package/dist/chunks/{chunk-HTBMVZF7.mjs → chunk-LM6WT4CO.mjs} +1 -1
- package/dist/chunks/{chunk-IPUFIEKC.mjs → chunk-LQ4OZPZI.mjs} +15 -15
- package/dist/chunks/{chunk-7RA6RQGC.mjs → chunk-NBPDJQIR.mjs} +1 -1
- package/dist/chunks/cli-handler-EA6B2IET.mjs +1 -0
- package/dist/chunks/cli-handler-F67HXX57.cjs +1 -0
- package/dist/chunks/{consolidate-JMXYI3NF.mjs → consolidate-I5KIRN4Q.mjs} +1 -1
- package/dist/chunks/{consolidate-TYCVXZFF.cjs → consolidate-V5B7US3A.cjs} +1 -1
- package/dist/chunks/{doctor-3W3MVUZF.mjs → doctor-GYFZEOFU.mjs} +1 -1
- package/dist/chunks/{doctor-GRS3CZWD.cjs → doctor-WB5IFSAX.cjs} +1 -1
- package/dist/chunks/{extract-IKAJ3GHK.cjs → extract-NKDG4CRZ.cjs} +1 -1
- package/dist/chunks/{extract-XT6HBENH.mjs → extract-PRZC6J42.mjs} +1 -1
- package/dist/chunks/{forget-GXJPG4P4.cjs → forget-HMP73OMP.cjs} +1 -1
- package/dist/chunks/{forget-2OAYPXCB.mjs → forget-ZETWU236.mjs} +1 -1
- package/dist/chunks/{graph-LJYAUA3C.cjs → graph-RPU4LN35.cjs} +1 -1
- package/dist/chunks/{graph-2AL2R3KO.mjs → graph-XCIX6M4X.mjs} +1 -1
- package/dist/chunks/{init-M5CEJUEY.mjs → init-65BD6AXC.mjs} +1 -1
- package/dist/chunks/{init-OFCTBJGM.cjs → init-EB7XE4QK.cjs} +1 -1
- package/dist/chunks/{mcp-OKBJHIXH.cjs → mcp-EPQG2OIZ.cjs} +1 -1
- package/dist/chunks/{mcp-OWOAIP2Z.mjs → mcp-KUQ55KNY.mjs} +1 -1
- package/dist/chunks/{recall-ZEDO4S5I.mjs → recall-ARCQ5XUX.mjs} +1 -1
- package/dist/chunks/{recall-K3DU2S23.cjs → recall-SEYESB2W.cjs} +1 -1
- package/dist/chunks/{remember-FR7JL2ZC.cjs → remember-22SZ6PPM.cjs} +1 -1
- package/dist/chunks/{remember-TEAHLG4E.mjs → remember-KAVRIPMH.mjs} +1 -1
- package/dist/chunks/{status-KLQSENQX.cjs → status-6724XOPA.cjs} +1 -1
- package/dist/chunks/{status-BGRJ224S.mjs → status-SKORJWEX.mjs} +1 -1
- package/dist/chunks/stdio-server-5HTVIDF7.mjs +1 -0
- package/dist/chunks/{stdio-server-ME6A6STR.cjs → stdio-server-AHIGDFUH.cjs} +1 -1
- package/dist/chunks/{sync-QZCZXNNN.cjs → sync-RNULQHQD.cjs} +1 -1
- package/dist/chunks/{sync-2D3E4DPE.mjs → sync-UVNIQMEQ.mjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +20 -16
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +20 -16
- package/package.json +10 -10
- package/dist/chunks/cli-handler-HUTXCEXM.cjs +0 -1
- package/dist/chunks/cli-handler-TUILJT7W.mjs +0 -1
- package/dist/chunks/stdio-server-EEWPIACW.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,38 +1,42 @@
|
|
|
1
|
-
import {a}from'./chunks/chunk-
|
|
2
|
-
`),s=await TruncateContent.truncate(
|
|
1
|
+
import {a}from'./chunks/chunk-LM6WT4CO.mjs';export{b as MemoryStdioServer,a as renderOperationMarkdown}from'./chunks/chunk-LM6WT4CO.mjs';import'./chunks/chunk-QF5S5MG7.mjs';export{a as COMMANDS_HELP,d as handleMemoryCli,b as renderBanner,c as renderHelp}from'./chunks/chunk-NBPDJQIR.mjs';import {A,z as z$1}from'./chunks/chunk-LQ4OZPZI.mjs';export{y as ALL_OPS,a as GraphStore,x as OP_REGISTRY,r as consolidate,v as doctor,z as executeOp,q as extract,p as forget,t as graphQuery,w as init,b as recall,n as remember,u as status,s as sync,o as update}from'./chunks/chunk-LQ4OZPZI.mjs';export{a as LATEST_SCHEMA_VERSION,b as MIGRATIONS,e as MemoryDatabaseManager,d as readCurrentSchemaVersion,c as runMigrations}from'./chunks/chunk-YJLHS7JB.mjs';import {a as a$1}from'./chunks/chunk-HH7EA2UE.mjs';export{a as Llm}from'./chunks/chunk-HH7EA2UE.mjs';import {a as a$2}from'./chunks/chunk-AJDMZTCQ.mjs';import {d}from'./chunks/chunk-SE3F5YQE.mjs';export{b as DEFAULT_MEMORY_JSON,c as MEMORY_JSON_REL_PATH,d as MemoryCache,a as MemoryJsonSchema}from'./chunks/chunk-SE3F5YQE.mjs';import {j as j$1,f,h as h$1}from'./chunks/chunk-HX3TV7FD.mjs';export{c as getGlobal,g as getHomeDir,f as getInstance,j as getMemoryDbPath,i as getMemoryDir,h as getXdgData,b as resetGlobalAdapter,e as resetInstanceAdapter,a as setGlobalAdapter,d as setInstanceAdapter}from'./chunks/chunk-HX3TV7FD.mjs';import'./chunks/chunk-S4DPVKMV.mjs';import {DefaultContextMode}from'@easbot/types';export{GRAPH_ENTITY_TYPE_DEFINITIONS,GRAPH_RELATION_TYPE_DEFINITIONS}from'@easbot/types';import*as E from'jieba-wasm';import {Log,loadTextFile,Schema,Locale,ServiceError,ServiceErrorBus,errorMeta,TruncateContent,Identifier,NameErrors,trimEdgesForLLM,formatKnowledgeTruncationHint,Markdown,trimKnowledgeResult,Token,Filesystem}from'@easbot/utils';import {HookEvent,createTool}from'@easbot/plugin';import {createHash}from'crypto';import {Agent,Truncate,Provider,Loop}from'@easbot/llm';import {existsSync}from'fs';import {renderKnowledgeStatus}from'@easbot/terminal';import {z}from'zod';var ur=["user_preference","task_context","technical_fact","decision","relationship","reminder","error_pattern","workflow","exploration_finding","experience_summary","tool_usage","skill_creation","test","other"];var x=Log.create({service:"memory.tokenizer"}),_=false,It=loadTextFile("./assets/jieba_dict.txt",import.meta.url);async function hr(e){if(!_)try{x.debug("Initializing jieba tokenizer");let r=It();if(E.with_dict(r),x.debug("Built-in dictionary loaded"),e?.dictPath&&e.dictPath.length>0)for(let t of e.dictPath)await kt(t);_=!0,x.debug("Jieba tokenizer initialized successfully");}catch(r){x.error("Failed to initialize jieba tokenizer",{error:errorMeta(r)}),x.warn("Using fallback tokenization (space-based)");}}async function kt(e){if(!_)throw new a$2.TokenizerNotInitializedError({message:"Tokenizer not initialized"});try{let r=await Filesystem.readText(e);x.debug("Loading custom dictionary",{dictPath:e}),E.with_dict(r),x.debug("Custom dictionary loaded successfully",{dictPath:e});}catch(r){x.warn("Failed to load custom dictionary",{dictPath:e,error:errorMeta(r)});}}function ht(e){if(!_)return e.split(/\s+/).filter(Boolean);try{return E.cut(e)}catch(r){return x.warn("Tokenization failed, using fallback",{error:errorMeta(r)}),e.split(/\s+/).filter(Boolean)}}function _t(e){if(!_)return e.split(/\s+/).filter(Boolean);try{return E.cut_for_search(e)}catch(r){return x.warn("Tokenization for search failed, using fallback",{error:errorMeta(r)}),e.split(/\s+/).filter(Boolean)}}function _r(e,r,t){if(_)try{E.add_word(e,r,t),x.debug("Word added to dictionary",{word:e,freq:r,tag:t});}catch(o){x.warn("Failed to add word",{word:e,error:errorMeta(o)});}}function Er(){return _}async function wr(){_=false,x.debug("Tokenizer closed");}function Rr(e){if(!_)return e.split(/\s+/).filter(Boolean).join(" ");try{return ht(e).join(" ")}catch(r){return x.warn("Tokenization failed, using fallback",{error:errorMeta(r)}),e.split(/\s+/).filter(Boolean).join(" ")}}function Or(e){if(!_)return e.split(/\s+/).filter(Boolean).join(" ");try{return _t(e).join(" ")}catch(r){return x.warn("Tokenization for search failed, using fallback",{error:errorMeta(r)}),e.split(/\s+/).filter(Boolean).join(" ")}}var te="memory",re="0.3.40",K={name:te,version:re,description:"EASBot memory plugin: lifecycle hooks and memory tool",entry:"./index.mjs",capabilities:["hooks","tools"]};async function w(){return d.exists()}function b(e,r){if(typeof e!="object"||e===null)return;let t=e;for(let o of r){let n=t[o];if(typeof n=="string"&&n.length>0)return n}}function Ee(e){if(typeof e!="object"||e===null)return {};let r=e.extras;return typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{}}function we(e){if(typeof e!="object"||e===null)return;let r=e.protocolMetadata;if(typeof r!="object"||r===null)return;let t=r.agentId;return typeof t=="string"&&t.length>0?t:void 0}function H(e,r){let t={...Ee(e),...Ee(r)};return {agentId:b(r,["agentId"])??we(e)??we(r)??b(e,["agentId"])??b(r,["agent"])??b(e,["agent"])??"",sessionId:b(r,["sessionId"])??b(e,["sessionId"]),toolName:b(e,["toolName","tool","name"])??b(r,["toolName"]),error:b(e,["error","message"])??b(r,["error"]),messagePreview:b(e,["messagePreview"])??b(r,["messagePreview"]),contextPreview:b(e,["contextPreview","text","prompt"])??b(r,["contextPreview"]),extras:t}}function T(e){let r=f().worktree,t=j$1(r),o=e.trim()||"memory-plugin";return {agentId:o,isTrustedLocal:true,remote:false,locale:"en-US",dbPath:t,workspaceDir:r,rootDir:r,config:A({agentId:o,dbPath:t,workspaceDir:r})}}function I(e,r){return {modified:false,input:e,output:{...r}}}function Re(e,r){return b(e,[r])}var oe=Log.create({service:"memory.plugin.hook"}),Pe=1200;function Ot(e,r){let t=e;for(let n of [t?.query,r.query])if(typeof n=="string"&&n.trim().length>0)return n;return Re(e,"userMessage")??""}var j=async(e,r)=>{let t=HookEvent.ContextCollect,o=H(e,r);if(!o.agentId.trim())return {modified:false,input:e,output:{hook:t,ok:false,error:"context collect: agentId is required",fragments:[]}};if(!await w())return oe.debug("context.collect: memory not configured, skip recall"),{modified:false,input:e,output:{hook:t,ok:true,fragments:[],logLine:"memory not configured"}};let n=typeof o.extras.topK=="number"?o.extras.topK:5,l=Ot(e,o.extras);if(l.trim().length===0)return oe.debug("context.collect: empty query, skip recall"),{modified:false,input:e,output:{hook:t,ok:true,fragments:[],logLine:"context collect: empty query"}};try{let p=await z$1("recall",{query:l,maxResults:n},T(o.agentId));if(p.hits.length===0)return {modified:!1,input:e,output:{hook:t,ok:!0,fragments:[],logLine:"context collect: no facts found"}};let i=p.hits.map(u=>`- [${u.category}/imp=${u.importance}] ${u.snippet}`).join(`
|
|
2
|
+
`),s=await TruncateContent.truncate(i,{maxChars:Math.min(Pe*4,TruncateContent.DEFAULT_MAX_CHARS),label:"memory recall fragments"}),a={id:"memory:recall",title:"Relevant Memory",content:s.content,source:"memory",order:10,markers:["<memory-recall>","</memory-recall>"]};return {modified:!1,input:e,output:{hook:t,ok:!0,fragments:[a],logLine:`context collect: contributed ${p.hits.length} facts${s.truncated?" (truncated; full content saved for agent read-back)":""}`}}}catch(p){let i=errorMeta(p);return oe.warn("memory context collect hook failed",{error:i}),{modified:false,input:e,output:{hook:t,ok:false,error:i.message,fragments:[]}}}};var Se=Log.create({service:"memory.plugin.hook"}),Tt=200,q=async(e,r)=>{let t=HookEvent.SessionCompacting,o=H(e,r);if(!o.agentId.trim())return I(e,{hook:t,ok:false,error:"pre compact: agentId is required"});if(!await w())return Se.debug("pre-compact: memory not configured, skip recall"),I(e,{hook:t,ok:true,context:[],logLine:"memory not configured"});let l=(o.contextPreview??o.messagePreview??"").slice(0,Tt).replace(/\s+/g," ").trim(),p=typeof o.extras.topK=="number"?o.extras.topK:3;if(!l)return I(e,{hook:t,ok:true,context:[],logLine:"pre compact: empty context preview; skipping recall injection"});try{let i=await z$1("recall",{query:l,maxResults:p,minImportance:5},T(o.agentId));if(i.hits.length===0)return I(e,{hook:t,ok:!0,context:[],logLine:"pre compact: no facts matched query"});let s=i.hits.map(u=>`- [${u.category}/imp=${u.importance}] ${u.snippet.slice(0,150)}`),a=`[memory:pre-compact recall top-${i.hits.length} (imp>=5)]
|
|
3
3
|
${s.join(`
|
|
4
|
-
`)}`;return
|
|
5
|
-
`);try{let
|
|
4
|
+
`)}`;return I(e,{hook:t,ok:!0,context:[a],logLine:`pre compact: injected ${i.hits.length} facts before compaction`})}catch(i){let s=errorMeta(i);return Se.warn("memory pre compact hook failed",{error:s}),I(e,{hook:t,ok:false,error:s.message})}};var He=Log.create({service:"memory.plugin.hook"}),Lt=8,B=async(e,r)=>{let t=HookEvent.ToolFailure,o=H(e,r);if(!o.agentId.trim())return I(e,{hook:t,ok:false,error:"tool failure: agentId is required"});if(!o.toolName?.trim()||!o.error?.trim())return I(e,{hook:t,ok:false,error:"tool failure: toolName and error are required"});if(!await w())return He.debug("tool.failure: memory not configured, skip remember"),I(e,{hook:t,ok:true,logLine:"memory not configured"});let n=createHash("sha256").update(`${o.toolName}:${o.error}`).digest("hex").slice(0,Lt),l=o.messagePreview?o.messagePreview.slice(0,200).replace(/\s+/g," ").trim():"",p=[`[error_pattern] tool=${o.toolName}`,`[error] ${o.error}`,l?`[preview] ${l}`:"",`[errHash] ${n}`].filter(Boolean).join(`
|
|
5
|
+
`);try{let i=await z$1("remember",{content:p,category:"error_pattern",importance:6,tags:["post-tool-failure",`tool:${o.toolName}`,`err:${n}`],sessionId:o.sessionId,msgId:typeof o.extras.msgId=="string"?o.extras.msgId:void 0},T(o.agentId));return I(e,{hook:t,ok:!0,logLine:`tool failure: wrote error_pattern fact ${i.fact.id} (tool=${o.toolName}, errHash=${n})`})}catch(i){let s=errorMeta(i);return He.warn("memory tool failure hook failed",{error:s}),I(e,{hook:t,ok:false,error:s.message})}};var h=Log.create({service:"memory.plugin.extract"}),Te=2e3,Kt=4096,jt=6e4,qt=5,ve="memory",Ce=["memory","read","glob","grep"];function Bt(e){return (e??[]).filter(r=>r.type==="text"&&!r.synthetic&&!r.ignored).map(r=>r.text??"").join("")}async function Ut(e,r){let t=[];for(let n of await e.messagesByParent(r)){if(n.role!=="assistant")continue;let l=n.parts.filter(p=>p.type==="text").map(p=>p.text??"").join("");l&&t.push({role:"assistant",content:l});}let o=await e.message(r);if(o&&o.role==="user"){let n=Bt(o.parts);n&&t.push({role:"user",content:n});}return t}async function zt(e){if(e.length===0)return "";let r=`### Our Conversation
|
|
6
6
|
|
|
7
|
-
`;for(let t of e){let o=Token.estimate(t.content),n=t.content,l=false;if(o>
|
|
7
|
+
`;for(let t of e){let o=Token.estimate(t.content),n=t.content,l=false;if(o>Te){n=t.content.slice(-8e3),l=true;}l?r+=`**${t.role==="user"?"User":"Me"}**: ${n}
|
|
8
8
|
|
|
9
9
|
[Content truncated from ${o} tokens]
|
|
10
10
|
|
|
11
11
|
`:r+=`**${t.role==="user"?"User":"Me"}**: ${n||"(empty)"}
|
|
12
12
|
|
|
13
|
-
`;}return r}async function
|
|
13
|
+
`;}return r}async function Vt(){let r=(await Agent.get(ve))?.prompt?.trim();if(!r)throw new Error(`memory extract: agent "${ve}" has no prompt (\u8BB0\u5FC6\u89C4\u8303\u7F3A\u5931)`);return r}async function Wt(e,r,t,o,n){let l=o.agent||await Agent.defaultAgent(),p=l?await Agent.get(l):void 0;if(!p)throw new Error(`memory extract: agent not found (${l})`);let i=o.model??await Provider.defaultModel(),s=typeof i=="string"?Provider.parseModel(i):i,a=await Provider.getModel(s.providerId,s.modelId),u=await t.get();if(!u)throw new Error(`memory extract: session not found (${e.sessionId})`);let d=r.identity?.();if(!d)throw new Error("memory extract: identity capability unavailable");let{metadata:M,initialized:m}=await d.protocol(),G=u.contextMode??DefaultContextMode,qe=await Vt(),Be=await d.staticPrompt({agent:p,model:{providerId:a.providerId,modelId:a.api?.id??a.id},workspaceDir:u.directory,mode:G}),Ue=await d.environment({agent:p,model:{providerId:a.providerId,modelId:a.api?.id??a.id},mode:G}),ze=[Markdown.replaceVariables(qe,M),...Be.map(X=>X.content),...Ue],Ve=await t.tools({agent:p.name,model:{providerId:a.providerId,modelId:a.api?.id??a.id},toolFilter:X=>Ce.includes(X)}),We=`Review the conversation below and decide what is worth remembering. Store it with the \`memory\` tool.
|
|
14
14
|
|
|
15
|
-
${await Yt(n)}`,me=await LanguageProvider.generate({user:{id:Identifier.ascending("message"),sessionId:e.sessionId,model:o.model??{providerId:a.providerId,modelId:a.api?.id??a.id}},sessionId:e.sessionId,agent:c,system:Ye,model:a,temperature:Provider.LIMITS.TEMPERATURE.SUMMARY,maxOutputTokens:Dt,messages:[{role:"user",content:[{type:"text",text:qe}]}],tools:je,activeTools:ve,stopWhen:stepCountIs(5),abort:new AbortController().signal});return b.debug("memory extract finished",{sessionId:e.sessionId,outputLength:me.text.length}),me.text}async function ee(e,r,t,o,n){try{await e.updatePart({...t,messageId:r,status:n.status,time:{start:o,end:Date.now()},...n.result!==void 0?{result:n.result}:{},...n.error!==void 0?{error:n.error}:{},...n.reason!==void 0?{reason:n.reason}:{}});}catch(l){b.error("memory part status update failed",{error:errorMeta(l),status:n.status});}}async function Ne(e,r){let t=e;if(!t.userMessageId)return b.debug("loop.end: no userMessageId, skip"),{modified:false,input:e};if(!await E())return b.debug("loop.end: memory not configured, skip extract"),{modified:false,input:e};let o=`${t.sessionId}:${t.userMessageId}`;if(b.debug("loop.end: memory extract started",{loopKey:o,step:t.step,result:t.result}),r.agent&&await Agent.isSubagent(r.agent))return b.debug("loop.end: skip memory extract, subagent",{loopKey:o}),{modified:false,input:e};let n=r.session?.(t.sessionId);if(!n)return b.debug("loop.end: skip memory extract, session capability unavailable",{loopKey:o}),{modified:false,input:e};let l=await n.message(t.userMessageId);if(!l)return b.debug("loop.end: user message not found, skip",{loopKey:o}),{modified:false,input:e};if(l.parts.some(p=>p.type==="memory"))return b.debug("loop.end: skip memory extract, already processed"),{modified:false,input:e};let c=Identifier.ascending("part"),m=Date.now(),s={id:c,type:"memory",status:"in_progress",time:{start:m}};await n.updatePart({...s,messageId:t.userMessageId});let a=await Gt(n,t.userMessageId);return a.some(p=>p.role==="assistant"&&p.content)?(qt(t,r,n,l,a).then(p=>ee(n,t.userMessageId,s,m,{status:"completed",result:p})).catch(p=>(b.error("memory extract failed",{error:errorMeta(p)}),ee(n,t.userMessageId,s,m,{status:"failed",error:errorMeta(p).message}))),{modified:false,input:e}):(b.debug("loop.end: skip memory extract, no assistant text content",{loopKey:o}),await ee(n,t.userMessageId,s,m,{status:"skipped",reason:"No assistant text content"}),{modified:false,input:e})}var R=[{event:HookEvent.ContextCollect,handler:Y},{event:HookEvent.SessionCompacting,handler:j},{event:HookEvent.ToolFailure,handler:q},{event:HookEvent.LoopEnd,handler:Ne}];function A(){return R.map(({event:e,handler:r})=>({event:e,hooks:[{type:"function",handler:r}]}))}var L=Log.create({service:"memory.plugin.tool"}),ne="memory",ae=["recall","remember","update","forget","extract","graph_query","status"],Xt=500,Ce="Access EASBot long-term memory via `operation` (recall / remember / update / forget / extract / graph_query / status).",re=z.enum(["user_preference","task_context","technical_fact","decision","relationship","reminder","error_pattern","workflow","exploration_finding","experience_summary","tool_usage","skill_creation","test","other"]),Ae=z.discriminatedUnion("operation",[z.object({operation:z.literal("recall"),query:z.string().describe("Search query text"),limit:Schema.positiveInt.optional().default(10).describe("Max results (default 10)"),category:re.optional().describe("Filter by memory category"),minImportance:Schema.positiveInt.optional().refine(e=>e===void 0||e>=1&&e<=10,{message:"minImportance must be in [1, 10] (inclusive); the service uses `WHERE importance >= ?` SQL"}).describe("INCLUSIVE `>=` filter on 1-10 importance scale; e.g. `5` keeps importance 5"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max edges per KG neighbor node returned by recall (default 10; range [1, 100])"),includeGraph:z.boolean().optional().default(false).describe("Include KG neighbor subgraph (default false; pass true to get BFS neighbors alongside hits)"),includeShared:z.boolean().optional().default(false).describe("Include shared KG nodes from other agents (requires trusted local; default false)")}).strict(),z.object({operation:z.literal("remember"),content:z.string().describe("Memory content"),category:re.describe("Memory category"),importance:Schema.positiveInt.describe("Importance 1-10 (service layer enforces range)"),tags:Schema.stringArray.optional().describe("Optional tags (string[])")}).strict(),z.object({operation:z.literal("update"),factId:z.string().describe("Target fact id (must belong to ctx.agentId)"),content:z.string().optional().describe("New content (triggers embedding rewrite + FTS reindex)"),category:re.optional().describe("New category"),importance:Schema.positiveInt.optional().describe("New importance 1-10"),tags:Schema.stringArray.optional().describe("New tags (string[]; empty array clears tags)")}).strict().refine(e=>e.content!==void 0||e.category!==void 0||e.importance!==void 0||e.tags!==void 0,{message:"update requires at least one of: `content`, `category`, `importance`, `tags`"}),z.object({operation:z.literal("forget"),factId:z.string().describe("Target fact id to delete (required; must belong to ctx.agentId)"),dryRun:z.boolean().optional().default(false).describe("Preview without deleting (returns matched count, never deletes)"),force:z.boolean().optional().default(false).describe("Skip KG reference check and delete anyway (required when fact is referenced by other facts; use after dryRun confirms the match)")}).strict(),z.object({operation:z.literal("extract"),lastN:Schema.positiveInt.optional().default(10).describe("Recent messages (default 10)"),fromMessageId:z.string().optional().describe("Process messages after this id")}).strict(),z.object({operation:z.literal("graph_query"),query:z.string().min(1).describe('**Node name fragment** (NOT natural-language query): used to locate a single root node by case-insensitive `LIKE %name%` match against the `nodes.name` column. After matching, the service performs BFS neighbor expansion automatically. Pass only short identifiers \u2014 e.g. an entity name like "easbot" or "decision-0034" as it appears in `nodes.name`. Tags and relation types live on edges, not on node names, so searching for them here returns 0 nodes \u2014 `recall` is the right tool for natural-language fact search.'),maxDepth:Schema.positiveInt.optional().default(2).describe("BFS depth for neighbor expansion (default 2; service range [1, 5])"),maxNodes:Schema.nonNegativeInt.optional().default(100).describe("Max nodes returned after BFS (default 100; service max 500)"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max edges per BFS neighbor node (default 10; range [1, 100])"),relation:z.string().optional().describe('Edge relation filter (e.g. "uses"; single-value exact match; differs from note.graph_query relationTypes[])'),type:z.string().optional().describe('Node type filter for root node (e.g. "decision"; only affects CLI query path; nodeId path bypasses)')}).strict(),z.object({operation:z.literal("status")}).strict()]),se=Ae;function Zt(){try{let e=loadTextFile("./memory.txt",import.meta.url)();return e.trim().length>0?e:Ce}catch(e){return L.warn("memory tool description unavailable, using fallback",{error:errorMeta(e)}),Ce}}function er(e){let r=e.agent?.trim();if(!r)throw new NameErrors.MissingFieldError({message:"memory tool: agentId is required (ctx.agent must be set)",field:"agentId"});return r}function tr(e){if(e?.sessionId?.trim())return e.sessionId;throw new NameErrors.MissingFieldError({message:"memory tool: sessionId is required (ctx.sessionId must be set)",field:"sessionId"})}async function rr(e,r){let t=j$1(e);if(!existsSync(t)){L.debug("memory db not found, auto-initializing",{dbPath:t,workspaceDir:e});try{await z$1("init",{workspaceDir:e,force:!1},r);}catch(o){throw new NameErrors.OperationFailedError({message:`memory tool: auto-init failed (${errorMeta(o).message}). Try running \`easbot memory init\` manually.`,operation:"memory-auto-init"})}}}async function or(){if(!(a$1.isInitialized()&&a$1.capabilities().graph))try{let e=await d.getMemoryJson();a$1.init({models:{embedding:e?.embedding_model??void 0,graph:e?.graph_model??void 0}});}catch(e){L.warn("memory Llm init failed; KG extraction will be skipped",{error:errorMeta(e)});}}var F=createTool({description:Zt(),args:Ae,isEnabled:()=>d.exists(),execute:async(e,r)=>{let t=e,o=t.operation;try{await r.ask({permission:"memory",patterns:o==="recall"?[t.query]:["*"],always:["*"],metadata:{operation:o}});let n=er(r),l=r.worktree||r.directory||process.cwd(),c=j$1(l),m={agentId:n,isTrustedLocal:!0,remote:!1,locale:Locale.resolveLocaleLang(),dbPath:c,workspaceDir:l,rootDir:l,config:A$1({agentId:n,dbPath:c,workspaceDir:l}),signal:r.abort};switch(await or(),await rr(l,m),o){case "recall":{let s=await z$1("recall",{query:t.query,maxResults:t.limit,category:t.category,minImportance:t.minImportance,maxEdgesPerNode:t.maxEdgesPerNode,includeGraph:t.includeGraph??!1,includeShared:t.includeShared??!1,snippetMaxChars:Xt},m);return {output:await a("recall",{kind:"recall",query:t.query,agentId:m.agentId,scope:"agent_only",totalCount:s.total,truncated:s.truncated,hits:s.hits.map(i=>({fact:{id:i.memoryId,agentId:i.agentId,category:i.category,content:i.content,importance:i.importance,tags:i.tags??null,source:i.source,sessionId:i.sessionId??null,msgId:i.msgId??null,parentMsgId:i.parentMsgId??null,filePath:i.filePath??null,createdAt:i.createdAt,updatedAt:i.updatedAt??i.createdAt,truncated:i.content.length>200},score:i.score,source:"hybrid",snippet:i.snippet,nodeIds:i.nodes?.map(p=>p.id)??[],nodes:i.nodes}))},{toolName:"memory_recall"}),title:`Memory: recall (${t.query})`,metadata:{operation:"recall",enabled:!0,agentId:n,query:t.query}}}case "remember":{let s=await z$1("remember",{content:t.content,category:t.category,importance:t.importance,tags:t.tags,sessionId:r.sessionId},m);return {output:`<memory_result>
|
|
15
|
+
${await zt(n)}`,C=await Loop.run({user:{id:Identifier.ascending("message"),sessionId:e.sessionId,model:o.model??{providerId:a.providerId,modelId:a.api?.id??a.id}},sessionId:e.sessionId,agent:p,system:ze,model:a,temperature:Provider.LIMITS.TEMPERATURE.SUMMARY,maxOutputTokens:Kt,messages:[{role:"user",content:[{type:"text",text:We}]}],tools:Ve,activeTools:Ce,maxSteps:qt,abort:AbortSignal.timeout(jt)});return h.debug("memory extract finished",{sessionId:e.sessionId,outputLength:C.text.length,steps:C.steps,toolCalls:C.toolCalls.length,cost:C.cost}),C.text}async function ne(e,r,t,o,n){try{await e.updatePart({...t,messageId:r,status:n.status,time:{start:o,end:Date.now()},...n.result!==void 0?{result:n.result}:{},...n.error!==void 0?{error:n.error}:{},...n.reason!==void 0?{reason:n.reason}:{}});}catch(l){h.error("memory part status update failed",{error:errorMeta(l),status:n.status});}}async function Ae(e,r){let t=e;if(!t.userMessageId)return h.debug("loop.end: no userMessageId, skip"),{modified:false,input:e};if(!await w())return h.debug("loop.end: memory not configured, skip extract"),{modified:false,input:e};let o=`${t.sessionId}:${t.userMessageId}`;if(h.debug("loop.end: memory extract started",{loopKey:o,step:t.step,result:t.result}),r.agent&&await Agent.isSubagent(r.agent))return h.debug("loop.end: skip memory extract, subagent",{loopKey:o}),{modified:false,input:e};let n=r.session?.(t.sessionId);if(!n)return h.debug("loop.end: skip memory extract, session capability unavailable",{loopKey:o}),{modified:false,input:e};let l=await n.message(t.userMessageId);if(!l)return h.debug("loop.end: user message not found, skip",{loopKey:o}),{modified:false,input:e};if(l.parts.some(d=>d.type==="memory"))return h.debug("loop.end: skip memory extract, already processed"),{modified:false,input:e};let p=Identifier.ascending("part"),i=Date.now(),s={id:p,type:"memory",status:"in_progress",time:{start:i}};await n.updatePart({...s,messageId:t.userMessageId});let a=await Ut(n,t.userMessageId);return a.some(d=>d.role==="assistant"&&d.content)?(Wt(t,r,n,l,a).then(d=>ne(n,t.userMessageId,s,i,{status:"completed",result:d})).catch(d=>(h.error("memory extract failed",{error:errorMeta(d)}),ne(n,t.userMessageId,s,i,{status:"failed",error:errorMeta(d).message}))),{modified:false,input:e}):(h.debug("loop.end: skip memory extract, no assistant text content",{loopKey:o}),await ne(n,t.userMessageId,s,i,{status:"skipped",reason:"No assistant text content"}),{modified:false,input:e})}var O=[{event:HookEvent.ContextCollect,handler:j},{event:HookEvent.SessionCompacting,handler:q},{event:HookEvent.ToolFailure,handler:B},{event:HookEvent.LoopEnd,handler:Ae}];function L(){return O.map(({event:e,handler:r})=>({event:e,hooks:[{type:"function",handler:r}]}))}async function Le(e,r){return trimKnowledgeResult(e,{...r,dataDir:r.dataDir??h$1()})}var De={listPaths:["hits","hits.*.nodes","hits.*.nodes.*.edges","nodes","edges","factIds","entities","relations"],fieldPaths:["hits.*.content","hits.*.fact.content","hits.*.snippet"]};var D=Log.create({service:"memory.plugin.tool"}),me="memory",le=["recall","remember","update","forget","extract","graph_query","status"],sr=500,Ge="Access EASBot long-term memory via `operation` (recall / remember / update / forget / extract / graph_query / status).",se=z.enum(["user_preference","task_context","technical_fact","decision","relationship","reminder","error_pattern","workflow","exploration_finding","experience_summary","tool_usage","skill_creation","test","other"]),Ye=z.discriminatedUnion("operation",[z.object({operation:z.literal("recall"),query:z.string().describe("Search query text"),limit:Schema.positiveInt.optional().default(10).describe("Max results (default 10)"),category:se.optional().describe("Filter by memory category"),minImportance:Schema.positiveInt.optional().refine(e=>e===void 0||e>=1&&e<=10,{message:"minImportance must be in [1, 10] (inclusive); the service uses `WHERE importance >= ?` SQL"}).describe("INCLUSIVE `>=` filter on 1-10 importance scale; e.g. `5` keeps importance 5"),minScore:z.number().min(0).max(1).optional().describe("Minimum relevance score filter (default 0; range [0, 1])"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max edges per KG neighbor node returned by recall (default 10; range [1, 100])"),includeGraph:z.boolean().optional().default(false).describe("Include KG neighbor subgraph (default false; pass true to get BFS neighbors alongside hits)"),includeShared:z.boolean().optional().default(false).describe("Include shared KG nodes from other agents (requires trusted local; default false)")}).strict(),z.object({operation:z.literal("remember"),content:z.string().describe("Memory content"),category:se.describe("Memory category"),importance:Schema.positiveInt.describe("Importance 1-10 (service layer enforces range)"),tags:Schema.stringArray.optional().describe("Optional tags (string[])")}).strict(),z.object({operation:z.literal("update"),factId:z.string().describe("Target fact id (must belong to ctx.agentId)"),content:z.string().optional().describe("New content (triggers embedding rewrite + FTS reindex)"),category:se.optional().describe("New category"),importance:Schema.positiveInt.optional().describe("New importance 1-10"),tags:Schema.stringArray.optional().describe("New tags (string[]; empty array clears tags)")}).strict().refine(e=>e.content!==void 0||e.category!==void 0||e.importance!==void 0||e.tags!==void 0,{message:"update requires at least one of: `content`, `category`, `importance`, `tags`"}),z.object({operation:z.literal("forget"),factId:z.string().describe("Target fact id to delete (required; must belong to ctx.agentId)"),dryRun:z.boolean().optional().default(false).describe("Preview without deleting (returns matched count, never deletes)"),force:z.boolean().optional().default(false).describe("Skip KG reference check and delete anyway (required when fact is referenced by other facts; use after dryRun confirms the match)")}).strict(),z.object({operation:z.literal("extract"),lastN:Schema.positiveInt.optional().default(10).describe("Recent messages (default 10)"),fromMessageId:z.string().optional().describe("Process messages after this id")}).strict(),z.object({operation:z.literal("graph_query"),nodeId:Schema.positiveInt.describe("KG node ID to start BFS from; get it from a recall hit or a prior graph_query result"),maxDepth:Schema.positiveInt.optional().default(2).describe("BFS depth for neighbor expansion (default 2; service range [1, 5])"),maxNodes:Schema.nonNegativeInt.optional().default(100).describe("Max nodes returned after BFS (default 100; service max 500)"),maxEdgesPerNode:Schema.positiveInt.optional().default(10).refine(e=>e===void 0||e>=1&&e<=100,{message:"maxEdgesPerNode must be in [1, 100]"}).describe("Max edges per BFS neighbor node (default 10; range [1, 100])"),relation:z.string().optional().describe('Edge relation filter (e.g. "uses"; single-value exact match; differs from note.graph_query relationTypes[])'),type:z.string().optional().describe('Node type filter for root node (e.g. "decision"; only affects CLI query path; nodeId path bypasses)')}).strict(),z.object({operation:z.literal("status")}).strict()]),de=Ye;function ir(){try{let e=loadTextFile("./memory.txt",import.meta.url)();return e.trim().length>0?e:Ge}catch(e){return D.warn("memory tool description unavailable, using fallback",{error:errorMeta(e)}),Ge}}function mr(e){let r=e.protocolMetadata?.agentId?.trim()||e.agent?.trim();if(!r)throw new NameErrors.MissingFieldError({message:"memory tool: agentId is required (ctx.protocolMetadata.agentId or ctx.agent must be set)",field:"agentId"});return r}function lr(e){if(e?.sessionId?.trim())return e.sessionId;throw new NameErrors.MissingFieldError({message:"memory tool: sessionId is required (ctx.sessionId must be set)",field:"sessionId"})}async function dr(e,r){let t=j$1(e);if(!existsSync(t)){D.debug("memory db not found, auto-initializing",{dbPath:t,workspaceDir:e});try{await z$1("init",{workspaceDir:e,force:!1},r);}catch(o){throw new NameErrors.OperationFailedError({message:`memory tool: auto-init failed (${errorMeta(o).message}). Try running \`easbot memory init\` manually.`,operation:"memory-auto-init"})}}}async function cr(){if(!(a$1.isInitialized()&&a$1.capabilities().graph))try{let e=await d.getMemoryJson();a$1.init({models:{embedding:e?.embedding_model??void 0,graph:e?.graph_model??void 0}});}catch(e){D.warn("memory Llm init failed; KG extraction will be skipped",{error:errorMeta(e)});}}async function W(e,r,t){let o=`memory_${e}`,n=await Le(r,{toolName:o,paths:De}),l=trimEdgesForLLM(n.result),p=await t(l),i=await Truncate.output(p,{contentType:"output",toolName:o}),s=formatKnowledgeTruncationHint(n,o);return i.truncated?{output:`${i.content}
|
|
16
|
+
|
|
17
|
+
[Full output truncated: ${i.outputPath}]`,truncated:true,outputPath:i.outputPath}:{output:s?`${i.content}
|
|
18
|
+
|
|
19
|
+
${s}`:i.content,truncated:false}}var F=createTool({description:ir(),args:Ye,isEnabled:()=>d.exists(),execute:async(e,r)=>{let t=e,o=t.operation;try{await r.ask({permission:"memory",patterns:o==="recall"?[t.query]:["*"],always:["*"],metadata:{operation:o}});let n=mr(r),l=r.worktree||r.directory||process.cwd(),p=j$1(l),i={agentId:n,isTrustedLocal:!0,remote:!1,locale:Locale.resolveLocaleLang(),dbPath:p,workspaceDir:l,rootDir:l,config:A({agentId:n,dbPath:p,workspaceDir:l}),signal:r.abort};switch(await cr(),await dr(l,i),o){case "recall":{let s=await z$1("recall",{query:t.query,maxResults:t.limit,category:t.category,minImportance:t.minImportance,minScore:t.minScore,maxEdgesPerNode:t.maxEdgesPerNode,includeGraph:t.includeGraph??!1,includeShared:t.includeShared??!1,snippetMaxChars:sr},i),a$1={kind:"recall",query:t.query,agentId:i.agentId,scope:"agent_only",totalCount:s.total,truncated:s.truncated,hits:s.hits.map(m=>({fact:{id:m.memoryId,agentId:m.agentId,category:m.category,content:m.content,importance:m.importance,tags:m.tags??null,source:m.source,sessionId:m.sessionId??null,msgId:m.msgId??null,parentMsgId:m.parentMsgId??null,filePath:m.filePath??null,createdAt:m.createdAt,updatedAt:m.updatedAt??m.createdAt,truncated:m.content.length>200},score:m.score,source:"hybrid",snippet:m.snippet,nodeIds:m.nodes?.map(G=>G.id)??[],nodes:m.nodes}))},{output:u,truncated:d,outputPath:M}=await W("recall",a$1,m=>a("recall",m,{toolName:"memory_recall"}));return {output:u,title:`Memory: recall (${t.query})`,metadata:{operation:"recall",enabled:!0,agentId:n,query:t.query,truncated:d,...d&&M?{outputPath:M}:{}}}}case "remember":{let s=await z$1("remember",{content:t.content,category:t.category,importance:t.importance,tags:t.tags,sessionId:r.sessionId},i);return {output:`<memory_result>
|
|
16
20
|
Memory saved.
|
|
17
21
|
id: ${s.fact.id}
|
|
18
22
|
category: ${s.fact.category}
|
|
19
23
|
importance: ${t.importance}
|
|
20
24
|
linked nodes: ${s.nodeIds?.length??0}
|
|
21
|
-
</memory_result>`,title:"Memory saved",metadata:{operation:"remember",enabled:!0,agentId:n,memoryId:s.fact.id,category:s.fact.category,importance:t.importance}}}case "update":{let s=await z$1("update",{factId:t.factId,content:t.content,category:t.category,importance:t.importance,tags:t.tags},
|
|
25
|
+
</memory_result>`,title:"Memory saved",metadata:{operation:"remember",enabled:!0,agentId:n,memoryId:s.fact.id,category:s.fact.category,importance:t.importance}}}case "update":{let s=await z$1("update",{factId:t.factId,content:t.content,category:t.category,importance:t.importance,tags:t.tags},i),a=s.fieldsUpdated.length>0?s.fieldsUpdated.join(", "):"(no-op)",u=s.contentChanged?" (embedding rewritten)":"";return {output:`<memory_result>
|
|
22
26
|
Memory updated.
|
|
23
27
|
id: ${s.fact.id}
|
|
24
28
|
category: ${s.fact.category}
|
|
25
29
|
importance: ${s.fact.importance}
|
|
26
|
-
fields updated: ${a}${
|
|
30
|
+
fields updated: ${a}${u}
|
|
27
31
|
updated_at: ${s.fact.updatedAt}
|
|
28
|
-
</memory_result>`,title:"Memory updated",metadata:{operation:"update",enabled:!0,agentId:n,memoryId:s.fact.id,category:s.fact.category,importance:s.fact.importance}}}case "forget":{let s=await z$1("forget",{factId:t.factId,dryRun:t.dryRun,force:t.force},
|
|
32
|
+
</memory_result>`,title:"Memory updated",metadata:{operation:"update",enabled:!0,agentId:n,memoryId:s.fact.id,category:s.fact.category,importance:s.fact.importance}}}case "forget":{let s=await z$1("forget",{factId:t.factId,dryRun:t.dryRun,force:t.force},i),{output:a$1,truncated:u,outputPath:d}=await W("forget",s,M=>a("forget",M,{toolName:"memory_forget"}));return {output:a$1,title:"Memory: forget",metadata:{operation:"forget",enabled:!0,agentId:n,truncated:u,...u&&d?{outputPath:d}:{}}}}case "extract":{let s=lr(r),a=await z$1("extract",{sessionId:s,lastN:t.lastN,fromMessageId:t.fromMessageId},i),{output:u,truncated:d,outputPath:M}=await W("extract",a,async m=>`<memory_result>
|
|
29
33
|
Extract completed.
|
|
30
34
|
sessionId: ${s}
|
|
31
|
-
extractedCount: ${
|
|
32
|
-
factIds: ${
|
|
33
|
-
messageRange: ${
|
|
34
|
-
</memory_result
|
|
35
|
+
extractedCount: ${m.extractedCount}
|
|
36
|
+
factIds: ${m.factIds.length>0?m.factIds.join(", "):"(none)"}
|
|
37
|
+
messageRange: ${m.messageRange.fromMessageId} -> ${m.messageRange.toMessageId}
|
|
38
|
+
</memory_result>`);return {output:u,title:"memory: extract",metadata:{operation:"extract",enabled:!0,agentId:n,truncated:d,...d&&M?{outputPath:M}:{},total:a.extractedCount}}}case "graph_query":{let s=await z$1("graph_query",{nodeId:t.nodeId,maxDepth:t.maxDepth,maxNodes:t.maxNodes,maxEdgesPerNode:t.maxEdgesPerNode,...t.relation!==void 0?{relation:t.relation}:{},...t.type!==void 0?{type:t.type}:{}},i),{output:a$1,truncated:u,outputPath:d}=await W("graph_query",s,M=>a("graph_query",M,{toolName:"memory_graph_query"}));return {output:a$1,title:"Memory: graph_query",metadata:{operation:"graph_query",enabled:!0,agentId:n,truncated:u,...u&&d?{outputPath:d}:{}}}}case "status":{let a=await z$1("status",{},i);return {output:renderKnowledgeStatus({packageName:"memory",rootDir:a.workspaceDir??"",configPath:a.configPath??"",configExists:typeof a.configExists=="boolean"?a.configExists:!0,dbPath:a.dbPath,dbExists:typeof a.dbExists=="boolean"?a.dbExists:!0,dbSize:a.dbSize,indexState:a.indexState,schemaVersion:a.schemaVersion,extractionVersion:a.extractionVersion,lastSyncAt:a.lastSyncAt,vectorEnabled:a.vectorEnabled,embeddingDims:a.embeddingDims,llm:a.llm??{initialized:!1,capabilities:{}},backend:a.backend,healthy:a.healthy,recommendation:a.recommendation,dbStats:a.dbStats??a.integrityStats,extras:(()=>{let d={};if(typeof a.agentId=="string"&&(d.agent_id=a.agentId),typeof a.ftsAvailable=="boolean"&&(d.fts_available=a.ftsAvailable?"yes":"no"),a.factsByCategory&&typeof a.factsByCategory=="object")for(let[M,m]of Object.entries(a.factsByCategory))typeof m=="number"&&m>0&&(d[`facts/${M}`]=m);if(a.meta&&typeof a.meta=="object")for(let[M,m]of Object.entries(a.meta))m!==void 0&&(d[`meta/${M}`]=m);return Object.keys(d).length>0?d:void 0})()}),title:"Memory: status",metadata:{operation:"status",enabled:!0,agentId:n}}}}}catch(n){if(ServiceError.isInstance(n))try{return {output:ServiceErrorBus.toMarkdown(n,{tool:"memory",operation:o,resultTag:"<memory_result>",pack:"memory"}),title:`Memory: ${o} (${n.data.code})`,metadata:{operation:o,enabled:!0,businessErrorCode:n.data.code}}}catch(l){return D.error("memory tool ServiceErrorBus formatting failed",{error:errorMeta(l)}),{output:`<memory_result>
|
|
35
39
|
Error: ${n.data.message}
|
|
36
|
-
</memory_result>`,title:`Memory: ${o} (${n.data.code})`,metadata:{operation:o,enabled:true,businessErrorCode:n.data.code}}}return
|
|
40
|
+
</memory_result>`,title:`Memory: ${o} (${n.data.code})`,metadata:{operation:o,enabled:true,businessErrorCode:n.data.code}}}return D.error("memory tool execution failed",{operation:o,error:errorMeta(n)}),{output:`<memory_result>
|
|
37
41
|
Error: ${errorMeta(n).message}
|
|
38
|
-
</memory_result>`,title:`Memory: ${o} (error)`,metadata:{operation:o,enabled:true}}}}});var
|
|
42
|
+
</memory_result>`,title:`Memory: ${o} (error)`,metadata:{operation:o,enabled:true}}}}});var $=async e=>({hooks:L(),tools:{[K.name]:F}});var Ke=[HookEvent.ContextCollect,HookEvent.SessionCompacting,HookEvent.ToolFailure,HookEvent.LoopEnd];var je={name:"memory.plugin",async init(){return {isEnabled:()=>true,handlers:O.map(({event:e,handler:r})=>({name:e,handler:r}))}}};export{ur as MEMORY_CATEGORIES,O as MEMORY_HOOK_BINDINGS,Ke as MEMORY_HOOK_EVENTS,te as MEMORY_PLUGIN_ID,K as MEMORY_PLUGIN_MANIFEST,re as MEMORY_PLUGIN_VERSION,de as MEMORY_TOOL_ARGS,me as MEMORY_TOOL_ID,le as MEMORY_TOOL_OPS,$ as MemoryPlugin,$ as MemoryPluginEntry,je as MemoryPluginHook,F as MemoryTool,_r as addWord,wr as closeTokenizer,L as createMemoryHookMatchers,hr as initTokenizer,Er as isInitialized,kt as loadCustomDict,Rr as toFtsTokens,Or as toFtsTokensForSearch,ht as tokenize,_t as tokenizeForSearch};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easbot/memory",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.41",
|
|
4
4
|
"description": "Memory management library for EASBOT ecosystem - 智能记忆管理库,支持混合搜索、中英文分词、增量索引",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"ai": "^6.0.253",
|
|
54
54
|
"better-sqlite3": "^13.0.3",
|
|
55
55
|
"jieba-wasm": "^2.4.0",
|
|
56
|
-
"@easbot/database": "0.3.
|
|
57
|
-
"@easbot/
|
|
58
|
-
"@easbot/
|
|
59
|
-
"@easbot/
|
|
60
|
-
"@easbot/
|
|
61
|
-
"@easbot/utils": "0.3.
|
|
62
|
-
"@easbot/llm": "0.3.
|
|
63
|
-
"@easbot/local-model-sdk": "0.3.
|
|
64
|
-
"@easbot/ollama-sdk": "0.3.
|
|
56
|
+
"@easbot/database": "0.3.41",
|
|
57
|
+
"@easbot/plugin": "0.3.41",
|
|
58
|
+
"@easbot/terminal": "0.3.41",
|
|
59
|
+
"@easbot/mcp": "0.3.41",
|
|
60
|
+
"@easbot/types": "0.3.41",
|
|
61
|
+
"@easbot/utils": "0.3.41",
|
|
62
|
+
"@easbot/llm": "0.3.41",
|
|
63
|
+
"@easbot/local-model-sdk": "0.3.41",
|
|
64
|
+
"@easbot/ollama-sdk": "0.3.41"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/node": "^25.9.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkSAGLLJTU_cjs=require('./chunk-SAGLLJTU.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');Object.defineProperty(exports,"COMMANDS_HELP",{enumerable:true,get:function(){return chunkSAGLLJTU_cjs.a}});Object.defineProperty(exports,"handleMemoryCli",{enumerable:true,get:function(){return chunkSAGLLJTU_cjs.d}});Object.defineProperty(exports,"mapMemoryDoctor",{enumerable:true,get:function(){return chunkSAGLLJTU_cjs.e}});Object.defineProperty(exports,"renderBanner",{enumerable:true,get:function(){return chunkSAGLLJTU_cjs.b}});Object.defineProperty(exports,"renderHelp",{enumerable:true,get:function(){return chunkSAGLLJTU_cjs.c}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as COMMANDS_HELP,d as handleMemoryCli,e as mapMemoryDoctor,b as renderBanner,c as renderHelp}from'./chunk-7RA6RQGC.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as MemoryStdioServer}from'./chunk-HTBMVZF7.mjs';import'./chunk-IPUFIEKC.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';
|