@easbot/memory 0.3.26 → 0.3.28
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 +35 -5
- package/README.md +29 -5
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/package.json +9 -9
package/README.en.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
Long-term memory library for the EASBOT ecosystem, providing per-agent fact storage, hybrid search, KG scope filtering, and a 9-op unified execution interface.
|
|
6
6
|
|
|
7
|
+
## Version
|
|
8
|
+
|
|
9
|
+
v0.3.28
|
|
7
10
|
## Features (v0.4.0)
|
|
8
11
|
|
|
9
12
|
- **9 op unified entry** — `recall / remember / forget / extract / consolidate / graph_query / status / doctor / init`; MCP / CLI / Agent Tool share the same `executeOp(name, args, ctx)`.
|
|
@@ -88,13 +91,25 @@ await executeOp(
|
|
|
88
91
|
|
|
89
92
|
```typescript
|
|
90
93
|
// Only this Agent's nodes (default; MCP entry enforces)
|
|
91
|
-
await executeOp(
|
|
94
|
+
await executeOp(
|
|
95
|
+
'graph_query',
|
|
96
|
+
{ agentId: 'agent-1', kind: 'nodes', scope: 'agent_only' },
|
|
97
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
98
|
+
);
|
|
92
99
|
|
|
93
100
|
// Only shared nodes
|
|
94
|
-
await executeOp(
|
|
101
|
+
await executeOp(
|
|
102
|
+
'graph_query',
|
|
103
|
+
{ agentId: 'agent-1', kind: 'nodes', scope: 'shared_only' },
|
|
104
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
105
|
+
);
|
|
95
106
|
|
|
96
107
|
// This Agent + shared (trusted local only; MCP entry rejects)
|
|
97
|
-
await executeOp(
|
|
108
|
+
await executeOp(
|
|
109
|
+
'graph_query',
|
|
110
|
+
{ agentId: 'agent-1', kind: 'nodes', scope: 'both' },
|
|
111
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
112
|
+
);
|
|
98
113
|
|
|
99
114
|
// v0.4.1+: omitting agentId → fallback 'default', global KG view (trusted local only)
|
|
100
115
|
await executeOp('graph_query', { kind: 'nodes', scope: 'both' }, { isTrustedLocal: true });
|
|
@@ -136,7 +151,17 @@ Four ops — `graph_query` / `status` / `doctor` / `init` — have made `agentId
|
|
|
136
151
|
### services (9 op business layer)
|
|
137
152
|
|
|
138
153
|
```typescript
|
|
139
|
-
import {
|
|
154
|
+
import {
|
|
155
|
+
recall,
|
|
156
|
+
remember,
|
|
157
|
+
forget,
|
|
158
|
+
extract,
|
|
159
|
+
consolidate,
|
|
160
|
+
graphQuery,
|
|
161
|
+
status,
|
|
162
|
+
doctor,
|
|
163
|
+
init,
|
|
164
|
+
} from '@easbot/memory/services';
|
|
140
165
|
```
|
|
141
166
|
|
|
142
167
|
### operations (9 op registry + executeOp)
|
|
@@ -154,7 +179,12 @@ import { renderOperationMarkdown } from '@easbot/memory/format/render';
|
|
|
154
179
|
### hooks (4 hook types)
|
|
155
180
|
|
|
156
181
|
```typescript
|
|
157
|
-
import type {
|
|
182
|
+
import type {
|
|
183
|
+
PreCompactHook,
|
|
184
|
+
SessionStartHook,
|
|
185
|
+
SessionEndHook,
|
|
186
|
+
PostToolFailureHook,
|
|
187
|
+
} from '@easbot/memory/hooks';
|
|
158
188
|
```
|
|
159
189
|
|
|
160
190
|
## CLI / MCP dual entry (v0.4 stage 4)
|
package/README.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
EASBOT 生态系统的长期记忆管理库(v0.4.0)。提供分层记忆、KG scope 三档隔离、9 op 统一调度、混合搜索与可观测治理。
|
|
6
6
|
|
|
7
|
+
## 版本
|
|
8
|
+
|
|
9
|
+
v0.3.28
|
|
7
10
|
## 特性(v0.4.0)
|
|
8
11
|
|
|
9
12
|
- **10 op 统一入口**(ADR 0069 +1 sync):`recall / remember / forget / extract / consolidate / sync / graph_query / status / doctor / init`,MCP / CLI / Agent Tool 三端共享。
|
|
@@ -96,16 +99,32 @@ await executeOp(
|
|
|
96
99
|
|
|
97
100
|
```typescript
|
|
98
101
|
// agent tool 主路径(v0.5+):按 numeric nodeId 查邻居
|
|
99
|
-
await executeOp(
|
|
102
|
+
await executeOp(
|
|
103
|
+
'graph_query',
|
|
104
|
+
{ nodeId: 12, maxEdgesPerNode: 20 },
|
|
105
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
106
|
+
);
|
|
100
107
|
|
|
101
108
|
// CLI 路径(v0.4.1+,保留兼容):name 模糊匹配 + scope/type/relation 过滤
|
|
102
|
-
await executeOp(
|
|
109
|
+
await executeOp(
|
|
110
|
+
'graph_query',
|
|
111
|
+
{ query: 'TS', scope: 'agent_only', type: 'class', depth: 2 },
|
|
112
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
113
|
+
);
|
|
103
114
|
|
|
104
115
|
// 只看共享节点
|
|
105
|
-
await executeOp(
|
|
116
|
+
await executeOp(
|
|
117
|
+
'graph_query',
|
|
118
|
+
{ query: 'TS', scope: 'shared_only' },
|
|
119
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
120
|
+
);
|
|
106
121
|
|
|
107
122
|
// 本 Agent + 共享(trusted local only;MCP 入口会拒绝)
|
|
108
|
-
await executeOp(
|
|
123
|
+
await executeOp(
|
|
124
|
+
'graph_query',
|
|
125
|
+
{ query: 'TS', scope: 'both' },
|
|
126
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
127
|
+
);
|
|
109
128
|
|
|
110
129
|
// v0.4.1+:不传 agentId → fallback 'default',全局 KG 视图(trusted local only)
|
|
111
130
|
await executeOp('graph_query', { query: 'TS', scope: 'both' }, { isTrustedLocal: true });
|
|
@@ -164,7 +183,12 @@ import { renderOperationMarkdown } from '@easbot/memory/format/render';
|
|
|
164
183
|
### hooks(4 hook 类型)
|
|
165
184
|
|
|
166
185
|
```typescript
|
|
167
|
-
import type {
|
|
186
|
+
import type {
|
|
187
|
+
PreCompactHook,
|
|
188
|
+
SessionStartHook,
|
|
189
|
+
SessionEndHook,
|
|
190
|
+
PostToolFailureHook,
|
|
191
|
+
} from '@easbot/memory/hooks';
|
|
168
192
|
```
|
|
169
193
|
|
|
170
194
|
## CLI / MCP 双入口(v0.4 stage 4 落地)
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';var chunkM2YU5LAI_cjs=require('./chunks/chunk-M2YU5LAI.cjs'),fs=require('fs'),path=require('path'),url=require('url'),terminal=require('@easbot/terminal');
|
|
2
|
+
'use strict';var chunkM2YU5LAI_cjs=require('./chunks/chunk-M2YU5LAI.cjs'),fs=require('fs'),path=require('path'),url=require('url'),terminal=require('@easbot/terminal');var R=path.dirname(url.fileURLToPath(chunkM2YU5LAI_cjs.b));function S(){try{let t=path.join(R,"..","package.json");return JSON.parse(fs.readFileSync(t,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var h=new Set(["DEBUG","INFO","WARN","ERROR"]);function D(t){let n={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 o=t[s+1];o&&!o.startsWith("-")&&(n.cwd=o,s++);}else if(e.startsWith("--cwd="))n.cwd=e.slice(6);else if(e==="--config"&&s+1<t.length){let o=t[s+1];o&&!o.startsWith("-")&&(n.configPath=o,s++);}else if(e.startsWith("--config="))n.configPath=e.slice(9);else if(e==="--log-level"&&s+1<t.length){let o=t[s+1];if(o&&!o.startsWith("-")){let l=o.toUpperCase();h.has(l)&&(n.logLevel=l,s++);}}else if(e.startsWith("--log-level=")){let o=e.slice(12).toUpperCase();h.has(o)&&(n.logLevel=o);}else e==="--print-logs"?n.printLogs=true:e==="--debug"&&(n.debug=true);}return n}async function W(){let t=process.argv.slice(2),n=S(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let e=D(t),{Log:o}=await import('@easbot/utils'),{getXdgData:l}=await import('./chunks/interfaces-Q5OGU5EK.cjs'),w=path.join(l(),"memory","log");if(await o.init({logDir:w,print:e.printLogs,dev:e.debug||false,level:e.logLevel}),t.length===0){let{renderBanner:i}=await import('./chunks/cli-handler-PG4IBTY2.cjs');i();return}if(t[0]==="--help"||t[0]==="-h"){let{renderHelp:i}=await import('./chunks/cli-handler-PG4IBTY2.cjs');i();return}if(t[0]==="--version"||t[0]==="-v"){terminal.printHuman([terminal.formatInfo(n)]);return}let r=e.cwd??process.cwd(),{handleMemoryCli:L}=await import('./chunks/cli-handler-PG4IBTY2.cjs'),{setInstanceAdapter:b}=await import('./chunks/interfaces-Q5OGU5EK.cjs');b({directory:r,worktree:r});let{Llm:v}=await import('./chunks/llm-7LQGYSUE.cjs'),{bootstrapLlm:y,setAdapterRegistry:O}=await import('@easbot/llm'),{getGlobal:a,getInstance:g}=await import('./chunks/interfaces-Q5OGU5EK.cjs');O({config:void 0,instance:{getDirectory:()=>g().directory,getWorktree:()=>g().worktree},global:{home:a().Path.home,data:a().Path.data,cache:a().Path.cache,config:a().Path.config,state:a().Path.state,log:a().Path.log,bin:a().Path.bin},installation:{getVersion:()=>n,getChannel:()=>"local",getUserAgent:()=>`easbot-memory/${n}`}}),await y({target:v,cwd:r,subConfigPath:".easbot/memory.json",embedding:true,graph:true});let p=o.create({service:"memory-cli-standalone"}),c;try{let{readFileSync:i}=await import('fs'),{join:I}=await import('path'),f=I(r,".easbot","protocol.json"),P=i(f,"utf-8");c=JSON.parse(P)?.metadata?.agentId?.trim()||void 0,p.debug("standalone CLI: resolved hostAgentId from protocol.json",{hostAgentId:c,protocolPath:f});}catch(i){p.debug("standalone CLI: read protocol.json failed; hostAgentId stays undefined",{cwd:r,error:i instanceof Error?i.message:String(i)});}let d=await L(t,{version:n,cwd:r,agentId:c});d.code!==0&&(process.exitCode=d.code);}W().catch(t=>{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';
|
|
2
|
+
import {readFileSync}from'fs';import {dirname,join}from'path';import {fileURLToPath}from'url';import {printHuman,formatInfo}from'@easbot/terminal';var C=dirname(fileURLToPath(import.meta.url));function R(){try{let t=join(C,"..","package.json");return JSON.parse(readFileSync(t,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var m=new Set(["DEBUG","INFO","WARN","ERROR"]);function S(t){let n={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 o=t[s+1];o&&!o.startsWith("-")&&(n.cwd=o,s++);}else if(e.startsWith("--cwd="))n.cwd=e.slice(6);else if(e==="--config"&&s+1<t.length){let o=t[s+1];o&&!o.startsWith("-")&&(n.configPath=o,s++);}else if(e.startsWith("--config="))n.configPath=e.slice(9);else if(e==="--log-level"&&s+1<t.length){let o=t[s+1];if(o&&!o.startsWith("-")){let l=o.toUpperCase();m.has(l)&&(n.logLevel=l,s++);}}else if(e.startsWith("--log-level=")){let o=e.slice(12).toUpperCase();m.has(o)&&(n.logLevel=o);}else e==="--print-logs"?n.printLogs=true:e==="--debug"&&(n.debug=true);}return n}async function D(){let t=process.argv.slice(2),n=R(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let e=S(t),{Log:o}=await import('@easbot/utils'),{getXdgData:l}=await import('./chunks/interfaces-LPJU4KS3.mjs'),u=join(l(),"memory","log");if(await o.init({logDir:u,print:e.printLogs,dev:e.debug||false,level:e.logLevel}),t.length===0){let{renderBanner:i}=await import('./chunks/cli-handler-ETHJPZPG.mjs');i();return}if(t[0]==="--help"||t[0]==="-h"){let{renderHelp:i}=await import('./chunks/cli-handler-ETHJPZPG.mjs');i();return}if(t[0]==="--version"||t[0]==="-v"){printHuman([formatInfo(n)]);return}let r=e.cwd??process.cwd(),{handleMemoryCli:w}=await import('./chunks/cli-handler-ETHJPZPG.mjs'),{setInstanceAdapter:L}=await import('./chunks/interfaces-LPJU4KS3.mjs');L({directory:r,worktree:r});let{Llm:b}=await import('./chunks/llm-UHTBU2HA.mjs'),{bootstrapLlm:v,setAdapterRegistry:y}=await import('@easbot/llm'),{getGlobal:a,getInstance:g}=await import('./chunks/interfaces-LPJU4KS3.mjs');y({config:void 0,instance:{getDirectory:()=>g().directory,getWorktree:()=>g().worktree},global:{home:a().Path.home,data:a().Path.data,cache:a().Path.cache,config:a().Path.config,state:a().Path.state,log:a().Path.log,bin:a().Path.bin},installation:{getVersion:()=>n,getChannel:()=>"local",getUserAgent:()=>`easbot-memory/${n}`}}),await v({target:b,cwd:r,subConfigPath:".easbot/memory.json",embedding:true,graph:true});let p=o.create({service:"memory-cli-standalone"}),c;try{let{readFileSync:i}=await import('fs'),{join:O}=await import('path'),f=O(r,".easbot","protocol.json"),I=i(f,"utf-8");c=JSON.parse(I)?.metadata?.agentId?.trim()||void 0,p.debug("standalone CLI: resolved hostAgentId from protocol.json",{hostAgentId:c,protocolPath:f});}catch(i){p.debug("standalone CLI: read protocol.json failed; hostAgentId stays undefined",{cwd:r,error:i instanceof Error?i.message:String(i)});}let d=await w(t,{version:n,cwd:r,agentId:c});d.code!==0&&(process.exitCode=d.code);}D().catch(t=>{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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easbot/memory",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.28",
|
|
4
4
|
"description": "Memory management library for EASBOT ecosystem - 智能记忆管理库,支持混合搜索、中英文分词、增量索引",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"better-sqlite3": "^13.0.3",
|
|
55
55
|
"jieba-wasm": "^2.4.0",
|
|
56
56
|
"xdg-basedir": "^5.1.0",
|
|
57
|
-
"@easbot/database": "0.3.
|
|
58
|
-
"@easbot/mcp": "0.3.
|
|
59
|
-
"@easbot/terminal": "0.3.
|
|
60
|
-
"@easbot/types": "0.3.
|
|
61
|
-
"@easbot/utils": "0.3.
|
|
62
|
-
"@easbot/local-model-sdk": "0.3.
|
|
63
|
-
"@easbot/llm": "0.3.
|
|
64
|
-
"@easbot/ollama-sdk": "0.3.
|
|
57
|
+
"@easbot/database": "0.3.28",
|
|
58
|
+
"@easbot/mcp": "0.3.28",
|
|
59
|
+
"@easbot/terminal": "0.3.28",
|
|
60
|
+
"@easbot/types": "0.3.28",
|
|
61
|
+
"@easbot/utils": "0.3.28",
|
|
62
|
+
"@easbot/local-model-sdk": "0.3.28",
|
|
63
|
+
"@easbot/llm": "0.3.28",
|
|
64
|
+
"@easbot/ollama-sdk": "0.3.28"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/node": "^25.9.5",
|