@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
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {b,a,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-
|
|
1
|
+
import {b,a,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function y(o){let r=o.agentId?.trim();if(!r)throw new NameErrors.MissingFieldError({field:"agentId",message:"graph_query: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let n=await d.getRootDir();return z("graph_query",{...o.query?{query:o.query}:{},...o.nodeId?{nodeId:o.nodeId}:{},...o.maxDepth!==void 0?{maxDepth:o.maxDepth}:{},...o.maxNodes?{maxNodes:o.maxNodes}:{},...o.maxEdgesPerNode!==void 0?{maxEdgesPerNode:o.maxEdgesPerNode}:{}},B(r,n))}function I(o){let r=o,n=[b("graph",{totalNodes:r.totalNodes??r.nodes.length},"KG query (scope={{scope}}, {{totalNodes}} node(s)):")];if(r.nodes.length===0)return n.push(a("graph","(no nodes matched)")),n.join(`
|
|
2
2
|
`);n.push(`nodes (${r.nodes.length}):`);for(let e of r.nodes){e.ownerAgentId?` [owner=${e.ownerAgentId}]`:" [shared]";n.push(c("graph",{id:String(e.id),name:e.name,type:e.type}," - #{{id}} {{name}} ({{type}})"));}n.push(`edges (${r.edges.length}):`);for(let e of r.edges)n.push(` - #${e.id} ${e.source} --${e.relation}--> ${e.target}`);return n.join(`
|
|
3
3
|
`)}function w(o){let r={};for(let n=0;n<o.length;n++){let e=o[n];if(e===void 0)continue;let s=o[n+1];if(e==="--agent")n++;else if(e==="--query")r.query=s,n++;else if(e==="--node-id")r.nodeId=Number(s),n++;else if(e==="--max-depth"||e==="--depth"){let t=Number(s);Number.isFinite(t)&&t>=1&&t<=5&&(r.maxDepth=Math.floor(t)),n++;}else if(e==="--max-nodes")r.maxNodes=Number(s),n++;else if(e==="--max-edges-per-node"){let t=Number(s);Number.isFinite(t)&&t>=1&&t<=100&&(r.maxEdgesPerNode=Math.floor(t)),n++;}else e==="--json"?r.json=true:(e==="--help"||e==="-h")&&(r.help=true);}return r}export{I as formatGraphText,w as parseGraphOptions,y as runGraph};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z,B}from'./chunk-
|
|
1
|
+
import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import {j}from'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';async function g(o){let t=await d.getRootDir(),e=o.agentId?.trim()??"";return z("init",{workspaceDir:t,dbPath:j(t),force:o.force??false},B(e,t))}function I(o){let t={};for(let e=0;e<o.length;e++){let n=o[e];n!==void 0&&(n==="--agent"?e++:n==="--force"?t.force=true:n==="--json"?t.json=true:(n==="--help"||n==="-h")&&(t.help=true));}return t}export{I as parseInitOptions,g as runInit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs'),chunkGCVKM3RJ_cjs=require('./chunk-GCVKM3RJ.cjs');require('./chunk-R32346OA.cjs');async function m(o){let t=await chunkNHRRIJFK_cjs.d.getRootDir(),e=o.agentId?.trim()??"";return chunk77ERAHDK_cjs.z("init",{workspaceDir:t,dbPath:chunkGCVKM3RJ_cjs.j(t),force:o.force??false},chunk77ERAHDK_cjs.B(e,t))}function g(o){let t={};for(let e=0;e<o.length;e++){let n=o[e];n!==void 0&&(n==="--agent"?e++:n==="--force"?t.force=true:n==="--json"?t.json=true:(n==="--help"||n==="-h")&&(t.help=true));}return t}exports.parseInitOptions=g;exports.runInit=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('./chunk-URADAZYW.cjs');var chunkIP7VEKQY_cjs=require('./chunk-IP7VEKQY.cjs');require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs'),chunkGCVKM3RJ_cjs=require('./chunk-GCVKM3RJ.cjs'),chunkR32346OA_cjs=require('./chunk-R32346OA.cjs'),path=require('path'),fs=require('fs'),url=require('url'),mcp=require('@easbot/mcp'),utils=require('@easbot/utils');function A(i){let t={};for(let o=0;o<i.length;o++){let e=i[o];e!==void 0&&(e==="--help"||e==="-h"?t.help=true:e==="--json"&&(t.json=true));}return t}async function E(i){let t=await chunkNHRRIJFK_cjs.d.getRootDir(),o=chunkGCVKM3RJ_cjs.j(t),e="0.0.0";try{let r=path.dirname(url.fileURLToPath(chunkR32346OA_cjs.d));for(let n=0;n<8;n++){try{let a=JSON.parse(fs.readFileSync(path.join(r,"package.json"),"utf-8"));if(a?.name==="@easbot/memory"&&typeof a.version=="string"){e=a.version;break}}catch{}let s=path.dirname(r);if(s===r||s==="."||n===7)break;r=s;}}catch{}let u={id:"easbot-memory-mcp",name:"EASBot Memory MCP",version:e,transportType:mcp.ServerTransportType.STDIO};await utils.Filesystem.mkdir(path.dirname(o));let c=new chunkIP7VEKQY_cjs.e(o);await c.initialize(),c.close();let{MemoryStdioServer:d}=await import('./stdio-server-
|
|
1
|
+
'use strict';require('./chunk-URADAZYW.cjs');var chunkIP7VEKQY_cjs=require('./chunk-IP7VEKQY.cjs');require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs'),chunkGCVKM3RJ_cjs=require('./chunk-GCVKM3RJ.cjs'),chunkR32346OA_cjs=require('./chunk-R32346OA.cjs'),path=require('path'),fs=require('fs'),url=require('url'),mcp=require('@easbot/mcp'),utils=require('@easbot/utils');function A(i){let t={};for(let o=0;o<i.length;o++){let e=i[o];e!==void 0&&(e==="--help"||e==="-h"?t.help=true:e==="--json"&&(t.json=true));}return t}async function E(i){let t=await chunkNHRRIJFK_cjs.d.getRootDir(),o=chunkGCVKM3RJ_cjs.j(t),e="0.0.0";try{let r=path.dirname(url.fileURLToPath(chunkR32346OA_cjs.d));for(let n=0;n<8;n++){try{let a=JSON.parse(fs.readFileSync(path.join(r,"package.json"),"utf-8"));if(a?.name==="@easbot/memory"&&typeof a.version=="string"){e=a.version;break}}catch{}let s=path.dirname(r);if(s===r||s==="."||n===7)break;r=s;}}catch{}let u={id:"easbot-memory-mcp",name:"EASBot Memory MCP",version:e,transportType:mcp.ServerTransportType.STDIO};await utils.Filesystem.mkdir(path.dirname(o));let c=new chunkIP7VEKQY_cjs.e(o);await c.initialize(),c.close();let{MemoryStdioServer:d}=await import('./stdio-server-AHIGDFUH.cjs'),g=process.env.EASBOT_AGENT_ID?.trim()||"default",M=await d.start(u,{agentId:g,dbPath:o,workspaceDir:t,isRemote:false});return {rootDir:t,tools:M.tools}}exports.parseMcpOptions=A;exports.runMcp=E;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-QF5S5MG7.mjs';import {e}from'./chunk-YJLHS7JB.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import {j}from'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {dirname,join}from'path';import {readFileSync}from'fs';import {fileURLToPath}from'url';import {ServerTransportType}from'@easbot/mcp';import {Filesystem}from'@easbot/utils';function E(i){let t={};for(let o=0;o<i.length;o++){let e=i[o];e!==void 0&&(e==="--help"||e==="-h"?t.help=true:e==="--json"&&(t.json=true));}return t}async function I(i){let t=await d.getRootDir(),o=j(t),e$1="0.0.0";try{let r=dirname(fileURLToPath(import.meta.url));for(let n=0;n<8;n++){try{let a=JSON.parse(readFileSync(join(r,"package.json"),"utf-8"));if(a?.name==="@easbot/memory"&&typeof a.version=="string"){e$1=a.version;break}}catch{}let s=dirname(r);if(s===r||s==="."||n===7)break;r=s;}}catch{}let y={id:"easbot-memory-mcp",name:"EASBot Memory MCP",version:e$1,transportType:ServerTransportType.STDIO};await Filesystem.mkdir(dirname(o));let c=new e(o);await c.initialize(),c.close();let{MemoryStdioServer:u}=await import('./stdio-server-
|
|
1
|
+
import'./chunk-QF5S5MG7.mjs';import {e}from'./chunk-YJLHS7JB.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import {j}from'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {dirname,join}from'path';import {readFileSync}from'fs';import {fileURLToPath}from'url';import {ServerTransportType}from'@easbot/mcp';import {Filesystem}from'@easbot/utils';function E(i){let t={};for(let o=0;o<i.length;o++){let e=i[o];e!==void 0&&(e==="--help"||e==="-h"?t.help=true:e==="--json"&&(t.json=true));}return t}async function I(i){let t=await d.getRootDir(),o=j(t),e$1="0.0.0";try{let r=dirname(fileURLToPath(import.meta.url));for(let n=0;n<8;n++){try{let a=JSON.parse(readFileSync(join(r,"package.json"),"utf-8"));if(a?.name==="@easbot/memory"&&typeof a.version=="string"){e$1=a.version;break}}catch{}let s=dirname(r);if(s===r||s==="."||n===7)break;r=s;}}catch{}let y={id:"easbot-memory-mcp",name:"EASBot Memory MCP",version:e$1,transportType:ServerTransportType.STDIO};await Filesystem.mkdir(dirname(o));let c=new e(o);await c.initialize(),c.close();let{MemoryStdioServer:u}=await import('./stdio-server-5HTVIDF7.mjs'),M=process.env.EASBOT_AGENT_ID?.trim()||"default",d$1=await u.start(y,{agentId:M,dbPath:o,workspaceDir:t,isRemote:false});return {rootDir:t,tools:d$1.tools}}export{E as parseMcpOptions,I as runMcp};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function b(e){if(!e.query?.trim())throw new NameErrors.MissingFieldError({field:"query",message:"recall: --query is required"});let n=e.agentId?.trim();if(!n)throw new NameErrors.MissingFieldError({field:"agentId",message:"recall: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let i=await d.getRootDir();return z("recall",{query:e.query,maxResults:e.limit??10,category:e.category,minImportance:e.minImportance,...e.minScore!==void 0?{minScore:e.minScore}:{},...e.includeGraph!==void 0?{includeGraph:e.includeGraph}:{},...e.maxDepth!==void 0?{maxDepth:e.maxDepth}:{},...e.maxEdgesPerNode!==void 0?{maxEdgesPerNode:e.maxEdgesPerNode}:{},...e.includeShared!==void 0?{includeShared:e.includeShared}:{}},B(n,i))}function x(e){let n=e;if(n.total===0)return a("memory.recall.empty",{fallback:"(no facts)"});let i=[a("memory.recall.summary",{vars:{total:n.total},fallback:`Found ${n.total} fact(s):`})];for(let r of n.hits)i.push(a("memory.recall.item",{vars:{id:r.memoryId,category:r.category,importance:String(r.importance),score:r.score.toFixed(3),content:r.snippet},fallback:" - {{id}} [{{category}}/imp={{importance}}/score={{score}}] {{content}}"}));return i.join(`
|
|
2
2
|
`)}function N(e){let n={};for(let i=0;i<e.length;i++){let r=e[i];if(r===void 0)continue;let o=e[i+1];if(r==="--agent")i++;else if(r==="--query")n.query=o,i++;else if(r==="--limit")n.limit=Number(o),i++;else if(r==="--category")n.category=o,i++;else if(r==="--min-importance")n.minImportance=Number(o),i++;else if(r==="--min-score"){let t=Number(o);Number.isFinite(t)&&t>=0&&t<=1&&(n.minScore=t),i++;}else if(r==="--include-graph")n.includeGraph=true;else if(r==="--depth"||r==="--max-depth"){let t=Number(o);Number.isFinite(t)&&t>=1&&t<=5&&(n.maxDepth=Math.floor(t)),i++;}else if(r==="--max-edges-per-node"){let t=Number(o);Number.isFinite(t)&&t>=1&&t<=100&&(n.maxEdgesPerNode=Math.floor(t)),i++;}else r==="--include-shared"?n.includeShared=true:r==="--json"?n.json=true:(r==="--help"||r==="-h")&&(n.help=true);}return n}export{x as formatRecallText,N as parseRecallOptions,b as runRecall};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunkWQB4D6DZ_cjs=require('./chunk-WQB4D6DZ.cjs'),
|
|
1
|
+
'use strict';var chunkWQB4D6DZ_cjs=require('./chunk-WQB4D6DZ.cjs'),chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function y(e){if(!e.query?.trim())throw new utils.NameErrors.MissingFieldError({field:"query",message:"recall: --query is required"});let n=e.agentId?.trim();if(!n)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"recall: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let i=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("recall",{query:e.query,maxResults:e.limit??10,category:e.category,minImportance:e.minImportance,...e.minScore!==void 0?{minScore:e.minScore}:{},...e.includeGraph!==void 0?{includeGraph:e.includeGraph}:{},...e.maxDepth!==void 0?{maxDepth:e.maxDepth}:{},...e.maxEdgesPerNode!==void 0?{maxEdgesPerNode:e.maxEdgesPerNode}:{},...e.includeShared!==void 0?{includeShared:e.includeShared}:{}},chunk77ERAHDK_cjs.B(n,i))}function b(e){let n=e;if(n.total===0)return chunkWQB4D6DZ_cjs.a("memory.recall.empty",{fallback:"(no facts)"});let i=[chunkWQB4D6DZ_cjs.a("memory.recall.summary",{vars:{total:n.total},fallback:`Found ${n.total} fact(s):`})];for(let r of n.hits)i.push(chunkWQB4D6DZ_cjs.a("memory.recall.item",{vars:{id:r.memoryId,category:r.category,importance:String(r.importance),score:r.score.toFixed(3),content:r.snippet},fallback:" - {{id}} [{{category}}/imp={{importance}}/score={{score}}] {{content}}"}));return i.join(`
|
|
2
2
|
`)}function x(e){let n={};for(let i=0;i<e.length;i++){let r=e[i];if(r===void 0)continue;let o=e[i+1];if(r==="--agent")i++;else if(r==="--query")n.query=o,i++;else if(r==="--limit")n.limit=Number(o),i++;else if(r==="--category")n.category=o,i++;else if(r==="--min-importance")n.minImportance=Number(o),i++;else if(r==="--min-score"){let t=Number(o);Number.isFinite(t)&&t>=0&&t<=1&&(n.minScore=t),i++;}else if(r==="--include-graph")n.includeGraph=true;else if(r==="--depth"||r==="--max-depth"){let t=Number(o);Number.isFinite(t)&&t>=1&&t<=5&&(n.maxDepth=Math.floor(t)),i++;}else if(r==="--max-edges-per-node"){let t=Number(o);Number.isFinite(t)&&t>=1&&t<=100&&(n.maxEdgesPerNode=Math.floor(t)),i++;}else r==="--include-shared"?n.includeShared=true:r==="--json"?n.json=true:(r==="--help"||r==="-h")&&(n.help=true);}return n}exports.formatRecallText=b;exports.parseRecallOptions=x;exports.runRecall=y;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var
|
|
1
|
+
'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function y(r){if(!r.content?.trim())throw new utils.NameErrors.MissingFieldError({field:"content",message:"remember: --content is required"});if(!r.category?.trim())throw new utils.NameErrors.MissingFieldError({field:"category",message:"remember: --category is required"});if(r.importance===void 0)throw new utils.NameErrors.MissingFieldError({field:"importance",message:"remember: --importance is required (1-10)"});let e=r.agentId?.trim();if(!e)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"remember: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("remember",{content:r.content,category:r.category,importance:r.importance,tags:r.tags,sessionId:r.sessionId},chunk77ERAHDK_cjs.B(e,t))}function w(r){let e=r,t=[chunk4GSXSIV5_cjs.b("remember",{},"Memory persisted:"),chunk4GSXSIV5_cjs.c("remember",{id:e.fact.id,category:e.fact.category,importance:String(e.fact.importance??5)}," - id={{id}} category={{category}} importance={{importance}}"),` - createdAt: ${e.fact.createdAt}`];return e.deduplicated&&t.push(" - (deduplicated; no new fact inserted)"),t.join(`
|
|
2
2
|
`)}function h(r){let e={};for(let t=0;t<r.length;t++){let i=r[t];if(i===void 0)continue;let n=r[t+1];i==="--agent"&&n!==void 0?t++:i==="--content"&&n!==void 0?(e.content=n,t++):i==="--category"&&n!==void 0?(e.category=n,t++):i==="--importance"&&n!==void 0?(e.importance=Number(n),t++):i==="--tag"&&n!==void 0?(e.tags=[...e.tags??[],n],t++):i==="--session"&&n!==void 0?(e.sessionId=n,t++):i==="--json"?e.json=true:(i==="--help"||i==="-h")&&(e.help=true);}return e}exports.formatRememberText=w;exports.parseRememberOptions=h;exports.runRemember=y;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-
|
|
1
|
+
import {b,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function w(r){if(!r.content?.trim())throw new NameErrors.MissingFieldError({field:"content",message:"remember: --content is required"});if(!r.category?.trim())throw new NameErrors.MissingFieldError({field:"category",message:"remember: --category is required"});if(r.importance===void 0)throw new NameErrors.MissingFieldError({field:"importance",message:"remember: --importance is required (1-10)"});let e=r.agentId?.trim();if(!e)throw new NameErrors.MissingFieldError({field:"agentId",message:"remember: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await d.getRootDir();return z("remember",{content:r.content,category:r.category,importance:r.importance,tags:r.tags,sessionId:r.sessionId},B(e,t))}function h(r){let e=r,t=[b("remember",{},"Memory persisted:"),c("remember",{id:e.fact.id,category:e.fact.category,importance:String(e.fact.importance??5)}," - id={{id}} category={{category}} importance={{importance}}"),` - createdAt: ${e.fact.createdAt}`];return e.deduplicated&&t.push(" - (deduplicated; no new fact inserted)"),t.join(`
|
|
2
2
|
`)}function I(r){let e={};for(let t=0;t<r.length;t++){let i=r[t];if(i===void 0)continue;let n=r[t+1];i==="--agent"&&n!==void 0?t++:i==="--content"&&n!==void 0?(e.content=n,t++):i==="--category"&&n!==void 0?(e.category=n,t++):i==="--importance"&&n!==void 0?(e.importance=Number(n),t++):i==="--tag"&&n!==void 0?(e.tags=[...e.tags??[],n],t++):i==="--session"&&n!==void 0?(e.sessionId=n,t++):i==="--json"?e.json=true:(i==="--help"||i==="-h")&&(e.help=true);}return e}export{h as formatRememberText,I as parseRememberOptions,w as runRemember};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');async function l(n){let e=await chunkNHRRIJFK_cjs.d.getRootDir(),t=n.agentId?.trim()??"default";return chunk77ERAHDK_cjs.z("status",{},chunk77ERAHDK_cjs.B(t,e))}function m(n){return ""}function g(n){let e={};for(let t=0;t<n.length;t++){let o=n[t];if(o===void 0)continue;n[t+1];o==="--agent"?t++:o==="--json"?e.json=true:(o==="--help"||o==="-h")&&(e.help=true);}return e}exports.formatStatusText=m;exports.parseStatusOptions=g;exports.runStatus=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z,B}from'./chunk-
|
|
1
|
+
import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';async function m(n){let e=await d.getRootDir(),t=n.agentId?.trim()??"default";return z("status",{},B(t,e))}function g(n){return ""}function x(n){let e={};for(let t=0;t<n.length;t++){let o=n[t];if(o===void 0)continue;n[t+1];o==="--agent"?t++:o==="--json"?e.json=true:(o==="--help"||o==="-h")&&(e.help=true);}return e}export{g as formatStatusText,x as parseStatusOptions,m as runStatus};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as MemoryStdioServer}from'./chunk-LM6WT4CO.mjs';import'./chunk-LQ4OZPZI.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';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk4CMSRWL3_cjs=require('./chunk-4CMSRWL3.cjs');require('./chunk-77ERAHDK.cjs'),require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs'),require('./chunk-NHRRIJFK.cjs'),require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');Object.defineProperty(exports,"MemoryStdioServer",{enumerable:true,get:function(){return chunk4CMSRWL3_cjs.b}});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var
|
|
1
|
+
'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function h(e){let n=e.agentId?.trim();if(!n)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"sync: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let r=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("sync",{windowDays:e.windowDays,dryRun:e.dryRun??false},chunk77ERAHDK_cjs.B(n,r))}function C(e){let n=e;return [chunk4GSXSIV5_cjs.b("sync",{windowDays:String(n.windowDays),dryRun:String(n.dryRun)},"sync complete (windowDays={{windowDays}}, dryRun={{dryRun}}):"),chunk4GSXSIV5_cjs.c("sync",{generatedCount:String(n.generatedCount),skippedCount:String(n.skippedCount),failedGenerateCount:String(n.failedGenerateCount),archivedCount:String(n.archivedCount),archiveThreshold:n.archiveThreshold}," - generated: {{generatedCount}}, skipped: {{skippedCount}}, failed: {{failedGenerateCount}}, archived: {{archivedCount}} (threshold: {{archiveThreshold}})"),` - duration: ${n.durationMs}ms`].join(`
|
|
2
2
|
`)}function b(e){let n={};for(let r=0;r<e.length;r++){let t=e[r];if(t===void 0)continue;let i=e[r+1];if(t==="--agent")r++;else if(t==="--window-days"){let o=Number(i);if(Number.isNaN(o)||o<1||o>3650)throw new utils.NameErrors.InvalidArgumentError({param:"window-days",message:`--window-days must be an integer in [1, 3650], got: ${i??"(empty)"}`});n.windowDays=o,r++;}else t==="--dry-run"?n.dryRun=true:t==="--json"?n.json=true:(t==="--help"||t==="-h")&&(n.help=true);}return n}exports.formatSyncText=C;exports.parseSyncOptions=b;exports.runSync=h;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b as b$1,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-
|
|
1
|
+
import {b as b$1,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function C(e){let n=e.agentId?.trim();if(!n)throw new NameErrors.MissingFieldError({field:"agentId",message:"sync: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let r=await d.getRootDir();return z("sync",{windowDays:e.windowDays,dryRun:e.dryRun??false},B(n,r))}function b(e){let n=e;return [b$1("sync",{windowDays:String(n.windowDays),dryRun:String(n.dryRun)},"sync complete (windowDays={{windowDays}}, dryRun={{dryRun}}):"),c("sync",{generatedCount:String(n.generatedCount),skippedCount:String(n.skippedCount),failedGenerateCount:String(n.failedGenerateCount),archivedCount:String(n.archivedCount),archiveThreshold:n.archiveThreshold}," - generated: {{generatedCount}}, skipped: {{skippedCount}}, failed: {{failedGenerateCount}}, archived: {{archivedCount}} (threshold: {{archiveThreshold}})"),` - duration: ${n.durationMs}ms`].join(`
|
|
2
2
|
`)}function S(e){let n={};for(let r=0;r<e.length;r++){let t=e[r];if(t===void 0)continue;let i=e[r+1];if(t==="--agent")r++;else if(t==="--window-days"){let o=Number(i);if(Number.isNaN(o)||o<1||o>3650)throw new NameErrors.InvalidArgumentError({param:"window-days",message:`--window-days must be an integer in [1, 3650], got: ${i??"(empty)"}`});n.windowDays=o,r++;}else t==="--dry-run"?n.dryRun=true:t==="--json"?n.json=true:(t==="--help"||t==="-h")&&(n.help=true);}return n}export{b as formatSyncText,S as parseSyncOptions,C as runSync};
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';var chunkR32346OA_cjs=require('./chunks/chunk-R32346OA.cjs'),fs=require('fs'),path=require('path'),url=require('url'),terminal=require('@easbot/terminal');var N=path.dirname(url.fileURLToPath(chunkR32346OA_cjs.d));function C(){try{let t=path.join(N,"..","package.json");return JSON.parse(fs.readFileSync(t,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var u=new Set(["DEBUG","INFO","WARN","ERROR"]);function D(t){let o={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<t.length;s++){let e=t[s];if(e)if(e==="--cwd"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.cwd=n,s++);}else if(e.startsWith("--cwd="))o.cwd=e.slice(6);else if(e==="--config"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.configPath=n,s++);}else if(e.startsWith("--config="))o.configPath=e.slice(9);else if(e==="--log-level"&&s+1<t.length){let n=t[s+1];if(n&&!n.startsWith("-")){let c=n.toUpperCase();u.has(c)&&(o.logLevel=c,s++);}}else if(e.startsWith("--log-level=")){let n=e.slice(12).toUpperCase();u.has(n)&&(o.logLevel=n);}else e==="--print-logs"?o.printLogs=true:e==="--debug"&&(o.debug=true);}return o}async function R(){let t=process.argv.slice(2),o=C(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let e=D(t),{Log:n}=await import('@easbot/utils'),{getXdgData:c}=await import('./chunks/interfaces-LDOE5ZTS.cjs'),L=path.join(c(),"memory","log");if(await n.init({logDir:L,print:e.printLogs,dev:e.debug||false,level:e.logLevel}),t.length===0){let{renderBanner:a}=await import('./chunks/cli-handler-
|
|
2
|
+
'use strict';var chunkR32346OA_cjs=require('./chunks/chunk-R32346OA.cjs'),fs=require('fs'),path=require('path'),url=require('url'),terminal=require('@easbot/terminal');var N=path.dirname(url.fileURLToPath(chunkR32346OA_cjs.d));function C(){try{let t=path.join(N,"..","package.json");return JSON.parse(fs.readFileSync(t,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var u=new Set(["DEBUG","INFO","WARN","ERROR"]);function D(t){let o={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<t.length;s++){let e=t[s];if(e)if(e==="--cwd"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.cwd=n,s++);}else if(e.startsWith("--cwd="))o.cwd=e.slice(6);else if(e==="--config"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.configPath=n,s++);}else if(e.startsWith("--config="))o.configPath=e.slice(9);else if(e==="--log-level"&&s+1<t.length){let n=t[s+1];if(n&&!n.startsWith("-")){let c=n.toUpperCase();u.has(c)&&(o.logLevel=c,s++);}}else if(e.startsWith("--log-level=")){let n=e.slice(12).toUpperCase();u.has(n)&&(o.logLevel=n);}else e==="--print-logs"?o.printLogs=true:e==="--debug"&&(o.debug=true);}return o}async function R(){let t=process.argv.slice(2),o=C(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let e=D(t),{Log:n}=await import('@easbot/utils'),{getXdgData:c}=await import('./chunks/interfaces-LDOE5ZTS.cjs'),L=path.join(c(),"memory","log");if(await n.init({logDir:L,print:e.printLogs,dev:e.debug||false,level:e.logLevel}),t.length===0){let{renderBanner:a}=await import('./chunks/cli-handler-F67HXX57.cjs');a();return}if(t[0]==="--help"||t[0]==="-h"){let{renderHelp:a}=await import('./chunks/cli-handler-F67HXX57.cjs');a();return}if(t[0]==="--version"||t[0]==="-v"){terminal.printHuman([terminal.formatInfo(o)]);return}let i=e.cwd??process.cwd(),{handleMemoryCli:b}=await import('./chunks/cli-handler-F67HXX57.cjs'),{setInstanceAdapter:v}=await import('./chunks/interfaces-LDOE5ZTS.cjs');v({directory:i,worktree:i});let{setAdapterRegistry:y}=await import('@easbot/llm'),{getGlobal:r,getInstance:p}=await import('./chunks/interfaces-LDOE5ZTS.cjs');y({config:void 0,instance:{getDirectory:()=>p().directory,getWorktree:()=>p().worktree},global:{home:r().Path.home,data:r().Path.data,cache:r().Path.cache,config:r().Path.config,state:r().Path.state,log:r().Path.log,bin:r().Path.bin},installation:{getVersion:()=>o,getChannel:()=>"local",getUserAgent:()=>`easbot-memory/${o}`}});let d=n.create({service:"memory.cli.standalone"}),l;try{let{readFileSync:a}=await import('fs'),{join:g}=await import('path'),m=g(i,".easbot","protocol.json"),O=a(m,"utf-8");l=JSON.parse(O)?.metadata?.agentId?.trim()||void 0,d.debug("standalone CLI: resolved hostAgentId from protocol.json",{hostAgentId:l,protocolPath:m});}catch(a){let{errorMeta:g}=await import('@easbot/utils');d.errorDegradable("standalone CLI: read protocol.json failed; hostAgentId stays undefined",{cwd:i,error:g(a)});}let f=await b(t,{version:o,cwd:i,agentId:l});f.code!==0&&(process.exitCode=f.code);}R().catch(async t=>{try{let{Log:o,errorMeta:s}=await import('@easbot/utils');o.create({service:"memory.cli.standalone"}).error("memory CLI crashed",{error:s(t)});}catch{console.error(t);}process.exitCode=1;}).finally(async()=>{try{let{Log:t}=await import('@easbot/utils');await t.close();}catch{}process.exit(process.exitCode??0);});
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {readFileSync}from'fs';import {dirname,join}from'path';import {fileURLToPath}from'url';import {printHuman,formatInfo}from'@easbot/terminal';var E=dirname(fileURLToPath(import.meta.url));function N(){try{let t=join(E,"..","package.json");return JSON.parse(readFileSync(t,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var h=new Set(["DEBUG","INFO","WARN","ERROR"]);function C(t){let o={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<t.length;s++){let e=t[s];if(e)if(e==="--cwd"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.cwd=n,s++);}else if(e.startsWith("--cwd="))o.cwd=e.slice(6);else if(e==="--config"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.configPath=n,s++);}else if(e.startsWith("--config="))o.configPath=e.slice(9);else if(e==="--log-level"&&s+1<t.length){let n=t[s+1];if(n&&!n.startsWith("-")){let c=n.toUpperCase();h.has(c)&&(o.logLevel=c,s++);}}else if(e.startsWith("--log-level=")){let n=e.slice(12).toUpperCase();h.has(n)&&(o.logLevel=n);}else e==="--print-logs"?o.printLogs=true:e==="--debug"&&(o.debug=true);}return o}async function D(){let t=process.argv.slice(2),o=N(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let e=C(t),{Log:n}=await import('@easbot/utils'),{getXdgData:c}=await import('./chunks/interfaces-OFM2XGSG.mjs'),w=join(c(),"memory","log");if(await n.init({logDir:w,print:e.printLogs,dev:e.debug||false,level:e.logLevel}),t.length===0){let{renderBanner:a}=await import('./chunks/cli-handler-
|
|
2
|
+
import {readFileSync}from'fs';import {dirname,join}from'path';import {fileURLToPath}from'url';import {printHuman,formatInfo}from'@easbot/terminal';var E=dirname(fileURLToPath(import.meta.url));function N(){try{let t=join(E,"..","package.json");return JSON.parse(readFileSync(t,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var h=new Set(["DEBUG","INFO","WARN","ERROR"]);function C(t){let o={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<t.length;s++){let e=t[s];if(e)if(e==="--cwd"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.cwd=n,s++);}else if(e.startsWith("--cwd="))o.cwd=e.slice(6);else if(e==="--config"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.configPath=n,s++);}else if(e.startsWith("--config="))o.configPath=e.slice(9);else if(e==="--log-level"&&s+1<t.length){let n=t[s+1];if(n&&!n.startsWith("-")){let c=n.toUpperCase();h.has(c)&&(o.logLevel=c,s++);}}else if(e.startsWith("--log-level=")){let n=e.slice(12).toUpperCase();h.has(n)&&(o.logLevel=n);}else e==="--print-logs"?o.printLogs=true:e==="--debug"&&(o.debug=true);}return o}async function D(){let t=process.argv.slice(2),o=N(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let e=C(t),{Log:n}=await import('@easbot/utils'),{getXdgData:c}=await import('./chunks/interfaces-OFM2XGSG.mjs'),w=join(c(),"memory","log");if(await n.init({logDir:w,print:e.printLogs,dev:e.debug||false,level:e.logLevel}),t.length===0){let{renderBanner:a}=await import('./chunks/cli-handler-EA6B2IET.mjs');a();return}if(t[0]==="--help"||t[0]==="-h"){let{renderHelp:a}=await import('./chunks/cli-handler-EA6B2IET.mjs');a();return}if(t[0]==="--version"||t[0]==="-v"){printHuman([formatInfo(o)]);return}let i=e.cwd??process.cwd(),{handleMemoryCli:L}=await import('./chunks/cli-handler-EA6B2IET.mjs'),{setInstanceAdapter:b}=await import('./chunks/interfaces-OFM2XGSG.mjs');b({directory:i,worktree:i});let{setAdapterRegistry:v}=await import('@easbot/llm'),{getGlobal:r,getInstance:p}=await import('./chunks/interfaces-OFM2XGSG.mjs');v({config:void 0,instance:{getDirectory:()=>p().directory,getWorktree:()=>p().worktree},global:{home:r().Path.home,data:r().Path.data,cache:r().Path.cache,config:r().Path.config,state:r().Path.state,log:r().Path.log,bin:r().Path.bin},installation:{getVersion:()=>o,getChannel:()=>"local",getUserAgent:()=>`easbot-memory/${o}`}});let d=n.create({service:"memory.cli.standalone"}),l;try{let{readFileSync:a}=await import('fs'),{join:g}=await import('path'),m=g(i,".easbot","protocol.json"),y=a(m,"utf-8");l=JSON.parse(y)?.metadata?.agentId?.trim()||void 0,d.debug("standalone CLI: resolved hostAgentId from protocol.json",{hostAgentId:l,protocolPath:m});}catch(a){let{errorMeta:g}=await import('@easbot/utils');d.errorDegradable("standalone CLI: read protocol.json failed; hostAgentId stays undefined",{cwd:i,error:g(a)});}let f=await L(t,{version:o,cwd:i,agentId:l});f.code!==0&&(process.exitCode=f.code);}D().catch(async t=>{try{let{Log:o,errorMeta:s}=await import('@easbot/utils');o.create({service:"memory.cli.standalone"}).error("memory CLI crashed",{error:s(t)});}catch{console.error(t);}process.exitCode=1;}).finally(async()=>{try{let{Log:t}=await import('@easbot/utils');await t.close();}catch{}process.exit(process.exitCode??0);});
|
package/dist/index.cjs
CHANGED
|
@@ -1,38 +1,42 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
`),s=await utils.TruncateContent.truncate(
|
|
1
|
+
'use strict';var chunk4CMSRWL3_cjs=require('./chunks/chunk-4CMSRWL3.cjs');require('./chunks/chunk-URADAZYW.cjs');var chunkBHGAFQCX_cjs=require('./chunks/chunk-BHGAFQCX.cjs'),chunk77ERAHDK_cjs=require('./chunks/chunk-77ERAHDK.cjs'),chunkIP7VEKQY_cjs=require('./chunks/chunk-IP7VEKQY.cjs'),chunkEKSLNNMF_cjs=require('./chunks/chunk-EKSLNNMF.cjs'),chunkAVECFV5K_cjs=require('./chunks/chunk-AVECFV5K.cjs'),chunkNHRRIJFK_cjs=require('./chunks/chunk-NHRRIJFK.cjs'),chunkGCVKM3RJ_cjs=require('./chunks/chunk-GCVKM3RJ.cjs'),chunkR32346OA_cjs=require('./chunks/chunk-R32346OA.cjs'),types=require('@easbot/types'),_=require('jieba-wasm'),utils=require('@easbot/utils'),plugin=require('@easbot/plugin'),crypto=require('crypto'),llm=require('@easbot/llm'),fs=require('fs'),terminal=require('@easbot/terminal'),zod=require('zod');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ___namespace=/*#__PURE__*/_interopNamespace(_);var pr=["user_preference","task_context","technical_fact","decision","relationship","reminder","error_pattern","workflow","exploration_finding","experience_summary","tool_usage","skill_creation","test","other"];var M=utils.Log.create({service:"memory.tokenizer"}),h=false,bt=utils.loadTextFile("./assets/jieba_dict.txt",chunkR32346OA_cjs.d);async function kr(e){if(!h)try{M.debug("Initializing jieba tokenizer");let r=bt();if(___namespace.with_dict(r),M.debug("Built-in dictionary loaded"),e?.dictPath&&e.dictPath.length>0)for(let t of e.dictPath)await It(t);h=!0,M.debug("Jieba tokenizer initialized successfully");}catch(r){M.error("Failed to initialize jieba tokenizer",{error:utils.errorMeta(r)}),M.warn("Using fallback tokenization (space-based)");}}async function It(e){if(!h)throw new chunkAVECFV5K_cjs.a.TokenizerNotInitializedError({message:"Tokenizer not initialized"});try{let r=await utils.Filesystem.readText(e);M.debug("Loading custom dictionary",{dictPath:e}),___namespace.with_dict(r),M.debug("Custom dictionary loaded successfully",{dictPath:e});}catch(r){M.warn("Failed to load custom dictionary",{dictPath:e,error:utils.errorMeta(r)});}}function kt(e){if(!h)return e.split(/\s+/).filter(Boolean);try{return ___namespace.cut(e)}catch(r){return M.warn("Tokenization failed, using fallback",{error:utils.errorMeta(r)}),e.split(/\s+/).filter(Boolean)}}function ht(e){if(!h)return e.split(/\s+/).filter(Boolean);try{return ___namespace.cut_for_search(e)}catch(r){return M.warn("Tokenization for search failed, using fallback",{error:utils.errorMeta(r)}),e.split(/\s+/).filter(Boolean)}}function hr(e,r,t){if(h)try{___namespace.add_word(e,r,t),M.debug("Word added to dictionary",{word:e,freq:r,tag:t});}catch(o){M.warn("Failed to add word",{word:e,error:utils.errorMeta(o)});}}function _r(){return h}async function Er(){h=false,M.debug("Tokenizer closed");}function wr(e){if(!h)return e.split(/\s+/).filter(Boolean).join(" ");try{return kt(e).join(" ")}catch(r){return M.warn("Tokenization failed, using fallback",{error:utils.errorMeta(r)}),e.split(/\s+/).filter(Boolean).join(" ")}}function Rr(e){if(!h)return e.split(/\s+/).filter(Boolean).join(" ");try{return ht(e).join(" ")}catch(r){return M.warn("Tokenization for search failed, using fallback",{error:utils.errorMeta(r)}),e.split(/\s+/).filter(Boolean).join(" ")}}var ee="memory",te="0.3.40",Y={name:ee,version:te,description:"EASBot memory plugin: lifecycle hooks and memory tool",entry:"./index.mjs",capabilities:["hooks","tools"]};async function E(){return chunkNHRRIJFK_cjs.d.exists()}function x(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 _e(e){if(typeof e!="object"||e===null)return {};let r=e.extras;return typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{}}function Ee(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 S(e,r){let t={..._e(e),..._e(r)};return {agentId:x(r,["agentId"])??Ee(e)??Ee(r)??x(e,["agentId"])??x(r,["agent"])??x(e,["agent"])??"",sessionId:x(r,["sessionId"])??x(e,["sessionId"]),toolName:x(e,["toolName","tool","name"])??x(r,["toolName"]),error:x(e,["error","message"])??x(r,["error"]),messagePreview:x(e,["messagePreview"])??x(r,["messagePreview"]),contextPreview:x(e,["contextPreview","text","prompt"])??x(r,["contextPreview"]),extras:t}}function H(e){let r=chunkGCVKM3RJ_cjs.f().worktree,t=chunkGCVKM3RJ_cjs.j(r),o=e.trim()||"memory-plugin";return {agentId:o,isTrustedLocal:true,remote:false,locale:"en-US",dbPath:t,workspaceDir:r,rootDir:r,config:chunk77ERAHDK_cjs.A({agentId:o,dbPath:t,workspaceDir:r})}}function b(e,r){return {modified:false,input:e,output:{...r}}}function we(e,r){return x(e,[r])}var re=utils.Log.create({service:"memory.plugin.hook"}),Oe=1200;function Rt(e,r){let t=e;for(let n of [t?.query,r.query])if(typeof n=="string"&&n.trim().length>0)return n;return we(e,"userMessage")??""}var K=async(e,r)=>{let t=plugin.HookEvent.ContextCollect,o=S(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 E())return re.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,d=Rt(e,o.extras);if(d.trim().length===0)return re.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 chunk77ERAHDK_cjs.z("recall",{query:d,maxResults:n},H(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 utils.TruncateContent.truncate(i,{maxChars:Math.min(Oe*4,utils.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=utils.errorMeta(p);return re.warn("memory context collect hook failed",{error:i}),{modified:false,input:e,output:{hook:t,ok:false,error:i.message,fragments:[]}}}};var Pe=utils.Log.create({service:"memory.plugin.hook"}),Ht=200,j=async(e,r)=>{let t=plugin.HookEvent.SessionCompacting,o=S(e,r);if(!o.agentId.trim())return b(e,{hook:t,ok:false,error:"pre compact: agentId is required"});if(!await E())return Pe.debug("pre-compact: memory not configured, skip recall"),b(e,{hook:t,ok:true,context:[],logLine:"memory not configured"});let d=(o.contextPreview??o.messagePreview??"").slice(0,Ht).replace(/\s+/g," ").trim(),p=typeof o.extras.topK=="number"?o.extras.topK:3;if(!d)return b(e,{hook:t,ok:true,context:[],logLine:"pre compact: empty context preview; skipping recall injection"});try{let i=await chunk77ERAHDK_cjs.z("recall",{query:d,maxResults:p,minImportance:5},H(o.agentId));if(i.hits.length===0)return b(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 b(e,{hook:t,ok:!0,context:[a],logLine:`pre compact: injected ${i.hits.length} facts before compaction`})}catch(i){let s=utils.errorMeta(i);return Pe.warn("memory pre compact hook failed",{error:s}),b(e,{hook:t,ok:false,error:s.message})}};var Se=utils.Log.create({service:"memory.plugin.hook"}),At=8,q=async(e,r)=>{let t=plugin.HookEvent.ToolFailure,o=S(e,r);if(!o.agentId.trim())return b(e,{hook:t,ok:false,error:"tool failure: agentId is required"});if(!o.toolName?.trim()||!o.error?.trim())return b(e,{hook:t,ok:false,error:"tool failure: toolName and error are required"});if(!await E())return Se.debug("tool.failure: memory not configured, skip remember"),b(e,{hook:t,ok:true,logLine:"memory not configured"});let n=crypto.createHash("sha256").update(`${o.toolName}:${o.error}`).digest("hex").slice(0,At),d=o.messagePreview?o.messagePreview.slice(0,200).replace(/\s+/g," ").trim():"",p=[`[error_pattern] tool=${o.toolName}`,`[error] ${o.error}`,d?`[preview] ${d}`:"",`[errHash] ${n}`].filter(Boolean).join(`
|
|
5
|
+
`);try{let i=await chunk77ERAHDK_cjs.z("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},H(o.agentId));return b(e,{hook:t,ok:!0,logLine:`tool failure: wrote error_pattern fact ${i.fact.id} (tool=${o.toolName}, errHash=${n})`})}catch(i){let s=utils.errorMeta(i);return Se.warn("memory tool failure hook failed",{error:s}),b(e,{hook:t,ok:false,error:s.message})}};var k=utils.Log.create({service:"memory.plugin.extract"}),He=2e3,Yt=4096,Kt=6e4,jt=5,Te="memory",ve=["memory","read","glob","grep"];function qt(e){return (e??[]).filter(r=>r.type==="text"&&!r.synthetic&&!r.ignored).map(r=>r.text??"").join("")}async function Bt(e,r){let t=[];for(let n of await e.messagesByParent(r)){if(n.role!=="assistant")continue;let d=n.parts.filter(p=>p.type==="text").map(p=>p.text??"").join("");d&&t.push({role:"assistant",content:d});}let o=await e.message(r);if(o&&o.role==="user"){let n=qt(o.parts);n&&t.push({role:"user",content:n});}return t}async function Ut(e){if(e.length===0)return "";let r=`### Our Conversation
|
|
6
6
|
|
|
7
|
-
`;for(let t of e){let o=utils.Token.estimate(t.content),n=t.content,
|
|
7
|
+
`;for(let t of e){let o=utils.Token.estimate(t.content),n=t.content,d=false;if(o>He){n=t.content.slice(-8e3),d=true;}d?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 zt(){let r=(await llm.Agent.get(Te))?.prompt?.trim();if(!r)throw new Error(`memory extract: agent "${Te}" has no prompt (\u8BB0\u5FC6\u89C4\u8303\u7F3A\u5931)`);return r}async function Vt(e,r,t,o,n){let d=o.agent||await llm.Agent.defaultAgent(),p=d?await llm.Agent.get(d):void 0;if(!p)throw new Error(`memory extract: agent not found (${d})`);let i=o.model??await llm.Provider.defaultModel(),s=typeof i=="string"?llm.Provider.parseModel(i):i,a=await llm.Provider.getModel(s.providerId,s.modelId),u=await t.get();if(!u)throw new Error(`memory extract: session not found (${e.sessionId})`);let l=r.identity?.();if(!l)throw new Error("memory extract: identity capability unavailable");let{metadata:y,initialized:m}=await l.protocol(),$=u.contextMode??types.DefaultContextMode,je=await zt(),qe=await l.staticPrompt({agent:p,model:{providerId:a.providerId,modelId:a.api?.id??a.id},workspaceDir:u.directory,mode:$}),Be=await l.environment({agent:p,model:{providerId:a.providerId,modelId:a.api?.id??a.id},mode:$}),Ue=[utils.Markdown.replaceVariables(je,y),...qe.map(Q=>Q.content),...Be],ze=await t.tools({agent:p.name,model:{providerId:a.providerId,modelId:a.api?.id??a.id},toolFilter:Q=>ve.includes(Q)}),Ve=`Review the conversation below and decide what is worth remembering. Store it with the \`memory\` tool.
|
|
14
14
|
|
|
15
|
-
${await Gt(n)}`,ie=await llm.LanguageProvider.generate({user:{id:utils.Identifier.ascending("message"),sessionId:e.sessionId,model:o.model??{providerId:a.providerId,modelId:a.api?.id??a.id}},sessionId:e.sessionId,agent:c,system:Ge,model:a,temperature:llm.Provider.LIMITS.TEMPERATURE.SUMMARY,maxOutputTokens:Ft,messages:[{role:"user",content:[{type:"text",text:je}]}],tools:Ye,activeTools:Se,stopWhen:ai.stepCountIs(5),abort:new AbortController().signal});return x.debug("memory extract finished",{sessionId:e.sessionId,outputLength:ie.text.length}),ie.text}async function Z(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){x.error("memory part status update failed",{error:utils.errorMeta(l),status:n.status});}}async function Te(e,r){let t=e;if(!t.userMessageId)return x.debug("loop.end: no userMessageId, skip"),{modified:false,input:e};if(!await h())return x.debug("loop.end: memory not configured, skip extract"),{modified:false,input:e};let o=`${t.sessionId}:${t.userMessageId}`;if(x.debug("loop.end: memory extract started",{loopKey:o,step:t.step,result:t.result}),r.agent&&await llm.Agent.isSubagent(r.agent))return x.debug("loop.end: skip memory extract, subagent",{loopKey:o}),{modified:false,input:e};let n=r.session?.(t.sessionId);if(!n)return x.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 x.debug("loop.end: user message not found, skip",{loopKey:o}),{modified:false,input:e};if(l.parts.some(p=>p.type==="memory"))return x.debug("loop.end: skip memory extract, already processed"),{modified:false,input:e};let c=utils.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 $t(n,t.userMessageId);return a.some(p=>p.role==="assistant"&&p.content)?(jt(t,r,n,l,a).then(p=>Z(n,t.userMessageId,s,m,{status:"completed",result:p})).catch(p=>(x.error("memory extract failed",{error:utils.errorMeta(p)}),Z(n,t.userMessageId,s,m,{status:"failed",error:utils.errorMeta(p).message}))),{modified:false,input:e}):(x.debug("loop.end: skip memory extract, no assistant text content",{loopKey:o}),await Z(n,t.userMessageId,s,m,{status:"skipped",reason:"No assistant text content"}),{modified:false,input:e})}var w=[{event:plugin.HookEvent.ContextCollect,handler:G},{event:plugin.HookEvent.SessionCompacting,handler:Y},{event:plugin.HookEvent.ToolFailure,handler:j},{event:plugin.HookEvent.LoopEnd,handler:Te}];function C(){return w.map(({event:e,handler:r})=>({event:e,hooks:[{type:"function",handler:r}]}))}var A=utils.Log.create({service:"memory.plugin.tool"}),oe="memory",ne=["recall","remember","update","forget","extract","graph_query","status"],Jt=500,Ne="Access EASBot long-term memory via `operation` (recall / remember / update / forget / extract / graph_query / status).",te=zod.z.enum(["user_preference","task_context","technical_fact","decision","relationship","reminder","error_pattern","workflow","exploration_finding","experience_summary","tool_usage","skill_creation","test","other"]),Ce=zod.z.discriminatedUnion("operation",[zod.z.object({operation:zod.z.literal("recall"),query:zod.z.string().describe("Search query text"),limit:utils.Schema.positiveInt.optional().default(10).describe("Max results (default 10)"),category:te.optional().describe("Filter by memory category"),minImportance:utils.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:utils.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:zod.z.boolean().optional().default(false).describe("Include KG neighbor subgraph (default false; pass true to get BFS neighbors alongside hits)"),includeShared:zod.z.boolean().optional().default(false).describe("Include shared KG nodes from other agents (requires trusted local; default false)")}).strict(),zod.z.object({operation:zod.z.literal("remember"),content:zod.z.string().describe("Memory content"),category:te.describe("Memory category"),importance:utils.Schema.positiveInt.describe("Importance 1-10 (service layer enforces range)"),tags:utils.Schema.stringArray.optional().describe("Optional tags (string[])")}).strict(),zod.z.object({operation:zod.z.literal("update"),factId:zod.z.string().describe("Target fact id (must belong to ctx.agentId)"),content:zod.z.string().optional().describe("New content (triggers embedding rewrite + FTS reindex)"),category:te.optional().describe("New category"),importance:utils.Schema.positiveInt.optional().describe("New importance 1-10"),tags:utils.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`"}),zod.z.object({operation:zod.z.literal("forget"),factId:zod.z.string().describe("Target fact id to delete (required; must belong to ctx.agentId)"),dryRun:zod.z.boolean().optional().default(false).describe("Preview without deleting (returns matched count, never deletes)"),force:zod.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(),zod.z.object({operation:zod.z.literal("extract"),lastN:utils.Schema.positiveInt.optional().default(10).describe("Recent messages (default 10)"),fromMessageId:zod.z.string().optional().describe("Process messages after this id")}).strict(),zod.z.object({operation:zod.z.literal("graph_query"),query:zod.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:utils.Schema.positiveInt.optional().default(2).describe("BFS depth for neighbor expansion (default 2; service range [1, 5])"),maxNodes:utils.Schema.nonNegativeInt.optional().default(100).describe("Max nodes returned after BFS (default 100; service max 500)"),maxEdgesPerNode:utils.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:zod.z.string().optional().describe('Edge relation filter (e.g. "uses"; single-value exact match; differs from note.graph_query relationTypes[])'),type:zod.z.string().optional().describe('Node type filter for root node (e.g. "decision"; only affects CLI query path; nodeId path bypasses)')}).strict(),zod.z.object({operation:zod.z.literal("status")}).strict()]),ae=Ce;function Xt(){try{let e=utils.loadTextFile("./memory.txt",chunkR32346OA_cjs.d)();return e.trim().length>0?e:Ne}catch(e){return A.warn("memory tool description unavailable, using fallback",{error:utils.errorMeta(e)}),Ne}}function Zt(e){let r=e.agent?.trim();if(!r)throw new utils.NameErrors.MissingFieldError({message:"memory tool: agentId is required (ctx.agent must be set)",field:"agentId"});return r}function er(e){if(e?.sessionId?.trim())return e.sessionId;throw new utils.NameErrors.MissingFieldError({message:"memory tool: sessionId is required (ctx.sessionId must be set)",field:"sessionId"})}async function tr(e,r){let t=chunkGCVKM3RJ_cjs.j(e);if(!fs.existsSync(t)){A.debug("memory db not found, auto-initializing",{dbPath:t,workspaceDir:e});try{await chunkKWSPFECY_cjs.z("init",{workspaceDir:e,force:!1},r);}catch(o){throw new utils.NameErrors.OperationFailedError({message:`memory tool: auto-init failed (${utils.errorMeta(o).message}). Try running \`easbot memory init\` manually.`,operation:"memory-auto-init"})}}}async function rr(){if(!(chunkEKSLNNMF_cjs.a.isInitialized()&&chunkEKSLNNMF_cjs.a.capabilities().graph))try{let e=await chunkNHRRIJFK_cjs.d.getMemoryJson();chunkEKSLNNMF_cjs.a.init({models:{embedding:e?.embedding_model??void 0,graph:e?.graph_model??void 0}});}catch(e){A.warn("memory Llm init failed; KG extraction will be skipped",{error:utils.errorMeta(e)});}}var L=plugin.createTool({description:Xt(),args:Ce,isEnabled:()=>chunkNHRRIJFK_cjs.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=Zt(r),l=r.worktree||r.directory||process.cwd(),c=chunkGCVKM3RJ_cjs.j(l),m={agentId:n,isTrustedLocal:!0,remote:!1,locale:utils.Locale.resolveLocaleLang(),dbPath:c,workspaceDir:l,rootDir:l,config:chunkKWSPFECY_cjs.A({agentId:n,dbPath:c,workspaceDir:l}),signal:r.abort};switch(await rr(),await tr(l,m),o){case "recall":{let s=await chunkKWSPFECY_cjs.z("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:Jt},m);return {output:await chunkSEKBFDEC_cjs.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 chunkKWSPFECY_cjs.z("remember",{content:t.content,category:t.category,importance:t.importance,tags:t.tags,sessionId:r.sessionId},m);return {output:`<memory_result>
|
|
15
|
+
${await Ut(n)}`,v=await llm.Loop.run({user:{id:utils.Identifier.ascending("message"),sessionId:e.sessionId,model:o.model??{providerId:a.providerId,modelId:a.api?.id??a.id}},sessionId:e.sessionId,agent:p,system:Ue,model:a,temperature:llm.Provider.LIMITS.TEMPERATURE.SUMMARY,maxOutputTokens:Yt,messages:[{role:"user",content:[{type:"text",text:Ve}]}],tools:ze,activeTools:ve,maxSteps:jt,abort:AbortSignal.timeout(Kt)});return k.debug("memory extract finished",{sessionId:e.sessionId,outputLength:v.text.length,steps:v.steps,toolCalls:v.toolCalls.length,cost:v.cost}),v.text}async function oe(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(d){k.error("memory part status update failed",{error:utils.errorMeta(d),status:n.status});}}async function Ne(e,r){let t=e;if(!t.userMessageId)return k.debug("loop.end: no userMessageId, skip"),{modified:false,input:e};if(!await E())return k.debug("loop.end: memory not configured, skip extract"),{modified:false,input:e};let o=`${t.sessionId}:${t.userMessageId}`;if(k.debug("loop.end: memory extract started",{loopKey:o,step:t.step,result:t.result}),r.agent&&await llm.Agent.isSubagent(r.agent))return k.debug("loop.end: skip memory extract, subagent",{loopKey:o}),{modified:false,input:e};let n=r.session?.(t.sessionId);if(!n)return k.debug("loop.end: skip memory extract, session capability unavailable",{loopKey:o}),{modified:false,input:e};let d=await n.message(t.userMessageId);if(!d)return k.debug("loop.end: user message not found, skip",{loopKey:o}),{modified:false,input:e};if(d.parts.some(l=>l.type==="memory"))return k.debug("loop.end: skip memory extract, already processed"),{modified:false,input:e};let p=utils.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 Bt(n,t.userMessageId);return a.some(l=>l.role==="assistant"&&l.content)?(Vt(t,r,n,d,a).then(l=>oe(n,t.userMessageId,s,i,{status:"completed",result:l})).catch(l=>(k.error("memory extract failed",{error:utils.errorMeta(l)}),oe(n,t.userMessageId,s,i,{status:"failed",error:utils.errorMeta(l).message}))),{modified:false,input:e}):(k.debug("loop.end: skip memory extract, no assistant text content",{loopKey:o}),await oe(n,t.userMessageId,s,i,{status:"skipped",reason:"No assistant text content"}),{modified:false,input:e})}var R=[{event:plugin.HookEvent.ContextCollect,handler:K},{event:plugin.HookEvent.SessionCompacting,handler:j},{event:plugin.HookEvent.ToolFailure,handler:q},{event:plugin.HookEvent.LoopEnd,handler:Ne}];function A(){return R.map(({event:e,handler:r})=>({event:e,hooks:[{type:"function",handler:r}]}))}async function Ae(e,r){return utils.trimKnowledgeResult(e,{...r,dataDir:r.dataDir??chunkGCVKM3RJ_cjs.h()})}var Le={listPaths:["hits","hits.*.nodes","hits.*.nodes.*.edges","nodes","edges","factIds","entities","relations"],fieldPaths:["hits.*.content","hits.*.fact.content","hits.*.snippet"]};var L=utils.Log.create({service:"memory.plugin.tool"}),ie="memory",me=["recall","remember","update","forget","extract","graph_query","status"],ar=500,$e="Access EASBot long-term memory via `operation` (recall / remember / update / forget / extract / graph_query / status).",ae=zod.z.enum(["user_preference","task_context","technical_fact","decision","relationship","reminder","error_pattern","workflow","exploration_finding","experience_summary","tool_usage","skill_creation","test","other"]),Ge=zod.z.discriminatedUnion("operation",[zod.z.object({operation:zod.z.literal("recall"),query:zod.z.string().describe("Search query text"),limit:utils.Schema.positiveInt.optional().default(10).describe("Max results (default 10)"),category:ae.optional().describe("Filter by memory category"),minImportance:utils.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:zod.z.number().min(0).max(1).optional().describe("Minimum relevance score filter (default 0; range [0, 1])"),maxEdgesPerNode:utils.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:zod.z.boolean().optional().default(false).describe("Include KG neighbor subgraph (default false; pass true to get BFS neighbors alongside hits)"),includeShared:zod.z.boolean().optional().default(false).describe("Include shared KG nodes from other agents (requires trusted local; default false)")}).strict(),zod.z.object({operation:zod.z.literal("remember"),content:zod.z.string().describe("Memory content"),category:ae.describe("Memory category"),importance:utils.Schema.positiveInt.describe("Importance 1-10 (service layer enforces range)"),tags:utils.Schema.stringArray.optional().describe("Optional tags (string[])")}).strict(),zod.z.object({operation:zod.z.literal("update"),factId:zod.z.string().describe("Target fact id (must belong to ctx.agentId)"),content:zod.z.string().optional().describe("New content (triggers embedding rewrite + FTS reindex)"),category:ae.optional().describe("New category"),importance:utils.Schema.positiveInt.optional().describe("New importance 1-10"),tags:utils.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`"}),zod.z.object({operation:zod.z.literal("forget"),factId:zod.z.string().describe("Target fact id to delete (required; must belong to ctx.agentId)"),dryRun:zod.z.boolean().optional().default(false).describe("Preview without deleting (returns matched count, never deletes)"),force:zod.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(),zod.z.object({operation:zod.z.literal("extract"),lastN:utils.Schema.positiveInt.optional().default(10).describe("Recent messages (default 10)"),fromMessageId:zod.z.string().optional().describe("Process messages after this id")}).strict(),zod.z.object({operation:zod.z.literal("graph_query"),nodeId:utils.Schema.positiveInt.describe("KG node ID to start BFS from; get it from a recall hit or a prior graph_query result"),maxDepth:utils.Schema.positiveInt.optional().default(2).describe("BFS depth for neighbor expansion (default 2; service range [1, 5])"),maxNodes:utils.Schema.nonNegativeInt.optional().default(100).describe("Max nodes returned after BFS (default 100; service max 500)"),maxEdgesPerNode:utils.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:zod.z.string().optional().describe('Edge relation filter (e.g. "uses"; single-value exact match; differs from note.graph_query relationTypes[])'),type:zod.z.string().optional().describe('Node type filter for root node (e.g. "decision"; only affects CLI query path; nodeId path bypasses)')}).strict(),zod.z.object({operation:zod.z.literal("status")}).strict()]),de=Ge;function sr(){try{let e=utils.loadTextFile("./memory.txt",chunkR32346OA_cjs.d)();return e.trim().length>0?e:$e}catch(e){return L.warn("memory tool description unavailable, using fallback",{error:utils.errorMeta(e)}),$e}}function ir(e){let r=e.protocolMetadata?.agentId?.trim()||e.agent?.trim();if(!r)throw new utils.NameErrors.MissingFieldError({message:"memory tool: agentId is required (ctx.protocolMetadata.agentId or ctx.agent must be set)",field:"agentId"});return r}function mr(e){if(e?.sessionId?.trim())return e.sessionId;throw new utils.NameErrors.MissingFieldError({message:"memory tool: sessionId is required (ctx.sessionId must be set)",field:"sessionId"})}async function dr(e,r){let t=chunkGCVKM3RJ_cjs.j(e);if(!fs.existsSync(t)){L.debug("memory db not found, auto-initializing",{dbPath:t,workspaceDir:e});try{await chunk77ERAHDK_cjs.z("init",{workspaceDir:e,force:!1},r);}catch(o){throw new utils.NameErrors.OperationFailedError({message:`memory tool: auto-init failed (${utils.errorMeta(o).message}). Try running \`easbot memory init\` manually.`,operation:"memory-auto-init"})}}}async function lr(){if(!(chunkEKSLNNMF_cjs.a.isInitialized()&&chunkEKSLNNMF_cjs.a.capabilities().graph))try{let e=await chunkNHRRIJFK_cjs.d.getMemoryJson();chunkEKSLNNMF_cjs.a.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:utils.errorMeta(e)});}}async function V(e,r,t){let o=`memory_${e}`,n=await Ae(r,{toolName:o,paths:Le}),d=utils.trimEdgesForLLM(n.result),p=await t(d),i=await llm.Truncate.output(p,{contentType:"output",toolName:o}),s=utils.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 D=plugin.createTool({description:sr(),args:Ge,isEnabled:()=>chunkNHRRIJFK_cjs.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=ir(r),d=r.worktree||r.directory||process.cwd(),p=chunkGCVKM3RJ_cjs.j(d),i={agentId:n,isTrustedLocal:!0,remote:!1,locale:utils.Locale.resolveLocaleLang(),dbPath:p,workspaceDir:d,rootDir:d,config:chunk77ERAHDK_cjs.A({agentId:n,dbPath:p,workspaceDir:d}),signal:r.abort};switch(await lr(),await dr(d,i),o){case "recall":{let s=await chunk77ERAHDK_cjs.z("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:ar},i),a={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($=>$.id)??[],nodes:m.nodes}))},{output:u,truncated:l,outputPath:y}=await V("recall",a,m=>chunk4CMSRWL3_cjs.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:l,...l&&y?{outputPath:y}:{}}}}case "remember":{let s=await chunk77ERAHDK_cjs.z("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
|
|
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 chunk77ERAHDK_cjs.z("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
|
|
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 chunk77ERAHDK_cjs.z("forget",{factId:t.factId,dryRun:t.dryRun,force:t.force},i),{output:a,truncated:u,outputPath:l}=await V("forget",s,y=>chunk4CMSRWL3_cjs.a("forget",y,{toolName:"memory_forget"}));return {output:a,title:"Memory: forget",metadata:{operation:"forget",enabled:!0,agentId:n,truncated:u,...u&&l?{outputPath:l}:{}}}}case "extract":{let s=mr(r),a=await chunk77ERAHDK_cjs.z("extract",{sessionId:s,lastN:t.lastN,fromMessageId:t.fromMessageId},i),{output:u,truncated:l,outputPath:y}=await V("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:l,...l&&y?{outputPath:y}:{},total:a.extractedCount}}}case "graph_query":{let s=await chunk77ERAHDK_cjs.z("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,truncated:u,outputPath:l}=await V("graph_query",s,y=>chunk4CMSRWL3_cjs.a("graph_query",y,{toolName:"memory_graph_query"}));return {output:a,title:"Memory: graph_query",metadata:{operation:"graph_query",enabled:!0,agentId:n,truncated:u,...u&&l?{outputPath:l}:{}}}}case "status":{let a=await chunk77ERAHDK_cjs.z("status",{},i);return {output:terminal.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 l={};if(typeof a.agentId=="string"&&(l.agent_id=a.agentId),typeof a.ftsAvailable=="boolean"&&(l.fts_available=a.ftsAvailable?"yes":"no"),a.factsByCategory&&typeof a.factsByCategory=="object")for(let[y,m]of Object.entries(a.factsByCategory))typeof m=="number"&&m>0&&(l[`facts/${y}`]=m);if(a.meta&&typeof a.meta=="object")for(let[y,m]of Object.entries(a.meta))m!==void 0&&(l[`meta/${y}`]=m);return Object.keys(l).length>0?l:void 0})()}),title:"Memory: status",metadata:{operation:"status",enabled:!0,agentId:n}}}}}catch(n){if(utils.ServiceError.isInstance(n))try{return {output:utils.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(d){return L.error("memory tool ServiceErrorBus formatting failed",{error:utils.errorMeta(d)}),{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 L.error("memory tool execution failed",{operation:o,error:utils.errorMeta(n)}),{output:`<memory_result>
|
|
37
41
|
Error: ${utils.errorMeta(n).message}
|
|
38
|
-
</memory_result>`,title:`Memory: ${o} (error)`,metadata:{operation:o,enabled:true}}}}});var F=async e=>({hooks:
|
|
42
|
+
</memory_result>`,title:`Memory: ${o} (error)`,metadata:{operation:o,enabled:true}}}}});var F=async e=>({hooks:A(),tools:{[Y.name]:D}});var Ye=[plugin.HookEvent.ContextCollect,plugin.HookEvent.SessionCompacting,plugin.HookEvent.ToolFailure,plugin.HookEvent.LoopEnd];var Ke={name:"memory.plugin",async init(){return {isEnabled:()=>true,handlers:R.map(({event:e,handler:r})=>({name:e,handler:r}))}}};Object.defineProperty(exports,"MemoryStdioServer",{enumerable:true,get:function(){return chunk4CMSRWL3_cjs.b}});Object.defineProperty(exports,"renderOperationMarkdown",{enumerable:true,get:function(){return chunk4CMSRWL3_cjs.a}});Object.defineProperty(exports,"COMMANDS_HELP",{enumerable:true,get:function(){return chunkBHGAFQCX_cjs.a}});Object.defineProperty(exports,"handleMemoryCli",{enumerable:true,get:function(){return chunkBHGAFQCX_cjs.d}});Object.defineProperty(exports,"renderBanner",{enumerable:true,get:function(){return chunkBHGAFQCX_cjs.b}});Object.defineProperty(exports,"renderHelp",{enumerable:true,get:function(){return chunkBHGAFQCX_cjs.c}});Object.defineProperty(exports,"ALL_OPS",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.y}});Object.defineProperty(exports,"GraphStore",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.a}});Object.defineProperty(exports,"OP_REGISTRY",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.x}});Object.defineProperty(exports,"consolidate",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.r}});Object.defineProperty(exports,"doctor",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.v}});Object.defineProperty(exports,"executeOp",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.z}});Object.defineProperty(exports,"extract",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.q}});Object.defineProperty(exports,"forget",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.p}});Object.defineProperty(exports,"graphQuery",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.t}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.w}});Object.defineProperty(exports,"recall",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.b}});Object.defineProperty(exports,"remember",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.n}});Object.defineProperty(exports,"status",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.u}});Object.defineProperty(exports,"sync",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.s}});Object.defineProperty(exports,"update",{enumerable:true,get:function(){return chunk77ERAHDK_cjs.o}});Object.defineProperty(exports,"LATEST_SCHEMA_VERSION",{enumerable:true,get:function(){return chunkIP7VEKQY_cjs.a}});Object.defineProperty(exports,"MIGRATIONS",{enumerable:true,get:function(){return chunkIP7VEKQY_cjs.b}});Object.defineProperty(exports,"MemoryDatabaseManager",{enumerable:true,get:function(){return chunkIP7VEKQY_cjs.e}});Object.defineProperty(exports,"readCurrentSchemaVersion",{enumerable:true,get:function(){return chunkIP7VEKQY_cjs.d}});Object.defineProperty(exports,"runMigrations",{enumerable:true,get:function(){return chunkIP7VEKQY_cjs.c}});Object.defineProperty(exports,"Llm",{enumerable:true,get:function(){return chunkEKSLNNMF_cjs.a}});Object.defineProperty(exports,"DEFAULT_MEMORY_JSON",{enumerable:true,get:function(){return chunkNHRRIJFK_cjs.b}});Object.defineProperty(exports,"MEMORY_JSON_REL_PATH",{enumerable:true,get:function(){return chunkNHRRIJFK_cjs.c}});Object.defineProperty(exports,"MemoryCache",{enumerable:true,get:function(){return chunkNHRRIJFK_cjs.d}});Object.defineProperty(exports,"MemoryJsonSchema",{enumerable:true,get:function(){return chunkNHRRIJFK_cjs.a}});Object.defineProperty(exports,"getGlobal",{enumerable:true,get:function(){return chunkGCVKM3RJ_cjs.c}});Object.defineProperty(exports,"getHomeDir",{enumerable:true,get:function(){return chunkGCVKM3RJ_cjs.g}});Object.defineProperty(exports,"getInstance",{enumerable:true,get:function(){return chunkGCVKM3RJ_cjs.f}});Object.defineProperty(exports,"getMemoryDbPath",{enumerable:true,get:function(){return chunkGCVKM3RJ_cjs.j}});Object.defineProperty(exports,"getMemoryDir",{enumerable:true,get:function(){return chunkGCVKM3RJ_cjs.i}});Object.defineProperty(exports,"getXdgData",{enumerable:true,get:function(){return chunkGCVKM3RJ_cjs.h}});Object.defineProperty(exports,"resetGlobalAdapter",{enumerable:true,get:function(){return chunkGCVKM3RJ_cjs.b}});Object.defineProperty(exports,"resetInstanceAdapter",{enumerable:true,get:function(){return chunkGCVKM3RJ_cjs.e}});Object.defineProperty(exports,"setGlobalAdapter",{enumerable:true,get:function(){return chunkGCVKM3RJ_cjs.a}});Object.defineProperty(exports,"setInstanceAdapter",{enumerable:true,get:function(){return chunkGCVKM3RJ_cjs.d}});Object.defineProperty(exports,"GRAPH_ENTITY_TYPE_DEFINITIONS",{enumerable:true,get:function(){return types.GRAPH_ENTITY_TYPE_DEFINITIONS}});Object.defineProperty(exports,"GRAPH_RELATION_TYPE_DEFINITIONS",{enumerable:true,get:function(){return types.GRAPH_RELATION_TYPE_DEFINITIONS}});exports.MEMORY_CATEGORIES=pr;exports.MEMORY_HOOK_BINDINGS=R;exports.MEMORY_HOOK_EVENTS=Ye;exports.MEMORY_PLUGIN_ID=ee;exports.MEMORY_PLUGIN_MANIFEST=Y;exports.MEMORY_PLUGIN_VERSION=te;exports.MEMORY_TOOL_ARGS=de;exports.MEMORY_TOOL_ID=ie;exports.MEMORY_TOOL_OPS=me;exports.MemoryPlugin=F;exports.MemoryPluginEntry=F;exports.MemoryPluginHook=Ke;exports.MemoryTool=D;exports.addWord=hr;exports.closeTokenizer=Er;exports.createMemoryHookMatchers=A;exports.initTokenizer=kr;exports.isInitialized=_r;exports.loadCustomDict=It;exports.toFtsTokens=wr;exports.toFtsTokensForSearch=Rr;exports.tokenize=kt;exports.tokenizeForSearch=ht;
|
package/dist/index.d.cts
CHANGED
|
@@ -638,7 +638,7 @@ declare namespace MemoryCache {
|
|
|
638
638
|
declare const MemoryPlugin: Plugin;
|
|
639
639
|
|
|
640
640
|
declare const MEMORY_PLUGIN_ID = "memory";
|
|
641
|
-
declare const MEMORY_PLUGIN_VERSION = "0.3.
|
|
641
|
+
declare const MEMORY_PLUGIN_VERSION = "0.3.40";
|
|
642
642
|
declare const MEMORY_PLUGIN_MANIFEST: PluginManifest;
|
|
643
643
|
|
|
644
644
|
declare function createMemoryHookMatchers(): HookMatcher[];
|
|
@@ -679,6 +679,7 @@ declare const MEMORY_TOOL_ARGS: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
679
679
|
other: "other";
|
|
680
680
|
}>>;
|
|
681
681
|
minImportance: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>;
|
|
682
|
+
minScore: z.ZodOptional<z.ZodNumber>;
|
|
682
683
|
maxEdgesPerNode: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
683
684
|
includeGraph: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
684
685
|
includeShared: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -736,7 +737,7 @@ declare const MEMORY_TOOL_ARGS: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
736
737
|
fromMessageId: z.ZodOptional<z.ZodString>;
|
|
737
738
|
}, z.core.$strict>, z.ZodObject<{
|
|
738
739
|
operation: z.ZodLiteral<"graph_query">;
|
|
739
|
-
|
|
740
|
+
nodeId: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
|
|
740
741
|
maxDepth: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
741
742
|
maxNodes: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
742
743
|
maxEdgesPerNode: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
@@ -767,6 +768,7 @@ declare const MemoryTool: _easbot_types.ToolDefinition & {
|
|
|
767
768
|
other: "other";
|
|
768
769
|
}>>;
|
|
769
770
|
minImportance: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>;
|
|
771
|
+
minScore: z.ZodOptional<z.ZodNumber>;
|
|
770
772
|
maxEdgesPerNode: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
771
773
|
includeGraph: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
772
774
|
includeShared: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -824,7 +826,7 @@ declare const MemoryTool: _easbot_types.ToolDefinition & {
|
|
|
824
826
|
fromMessageId: z.ZodOptional<z.ZodString>;
|
|
825
827
|
}, z.core.$strict>, z.ZodObject<{
|
|
826
828
|
operation: z.ZodLiteral<"graph_query">;
|
|
827
|
-
|
|
829
|
+
nodeId: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
|
|
828
830
|
maxDepth: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
829
831
|
maxNodes: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
830
832
|
maxEdgesPerNode: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -638,7 +638,7 @@ declare namespace MemoryCache {
|
|
|
638
638
|
declare const MemoryPlugin: Plugin;
|
|
639
639
|
|
|
640
640
|
declare const MEMORY_PLUGIN_ID = "memory";
|
|
641
|
-
declare const MEMORY_PLUGIN_VERSION = "0.3.
|
|
641
|
+
declare const MEMORY_PLUGIN_VERSION = "0.3.40";
|
|
642
642
|
declare const MEMORY_PLUGIN_MANIFEST: PluginManifest;
|
|
643
643
|
|
|
644
644
|
declare function createMemoryHookMatchers(): HookMatcher[];
|
|
@@ -679,6 +679,7 @@ declare const MEMORY_TOOL_ARGS: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
679
679
|
other: "other";
|
|
680
680
|
}>>;
|
|
681
681
|
minImportance: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>;
|
|
682
|
+
minScore: z.ZodOptional<z.ZodNumber>;
|
|
682
683
|
maxEdgesPerNode: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
683
684
|
includeGraph: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
684
685
|
includeShared: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -736,7 +737,7 @@ declare const MEMORY_TOOL_ARGS: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
736
737
|
fromMessageId: z.ZodOptional<z.ZodString>;
|
|
737
738
|
}, z.core.$strict>, z.ZodObject<{
|
|
738
739
|
operation: z.ZodLiteral<"graph_query">;
|
|
739
|
-
|
|
740
|
+
nodeId: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
|
|
740
741
|
maxDepth: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
741
742
|
maxNodes: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
742
743
|
maxEdgesPerNode: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
@@ -767,6 +768,7 @@ declare const MemoryTool: _easbot_types.ToolDefinition & {
|
|
|
767
768
|
other: "other";
|
|
768
769
|
}>>;
|
|
769
770
|
minImportance: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>;
|
|
771
|
+
minScore: z.ZodOptional<z.ZodNumber>;
|
|
770
772
|
maxEdgesPerNode: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
771
773
|
includeGraph: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
772
774
|
includeShared: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -824,7 +826,7 @@ declare const MemoryTool: _easbot_types.ToolDefinition & {
|
|
|
824
826
|
fromMessageId: z.ZodOptional<z.ZodString>;
|
|
825
827
|
}, z.core.$strict>, z.ZodObject<{
|
|
826
828
|
operation: z.ZodLiteral<"graph_query">;
|
|
827
|
-
|
|
829
|
+
nodeId: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>;
|
|
828
830
|
maxDepth: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
829
831
|
maxNodes: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|
|
830
832
|
maxEdgesPerNode: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>>;
|