@easbot/memory 0.3.27 → 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 +33 -7
- package/README.md +27 -7
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/package.json +9 -9
package/README.en.md
CHANGED
|
@@ -6,8 +6,7 @@ Long-term memory library for the EASBOT ecosystem, providing per-agent fact stor
|
|
|
6
6
|
|
|
7
7
|
## Version
|
|
8
8
|
|
|
9
|
-
v0.3.
|
|
10
|
-
|
|
9
|
+
v0.3.28
|
|
11
10
|
## Features (v0.4.0)
|
|
12
11
|
|
|
13
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)`.
|
|
@@ -92,13 +91,25 @@ await executeOp(
|
|
|
92
91
|
|
|
93
92
|
```typescript
|
|
94
93
|
// Only this Agent's nodes (default; MCP entry enforces)
|
|
95
|
-
await executeOp(
|
|
94
|
+
await executeOp(
|
|
95
|
+
'graph_query',
|
|
96
|
+
{ agentId: 'agent-1', kind: 'nodes', scope: 'agent_only' },
|
|
97
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
98
|
+
);
|
|
96
99
|
|
|
97
100
|
// Only shared nodes
|
|
98
|
-
await executeOp(
|
|
101
|
+
await executeOp(
|
|
102
|
+
'graph_query',
|
|
103
|
+
{ agentId: 'agent-1', kind: 'nodes', scope: 'shared_only' },
|
|
104
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
105
|
+
);
|
|
99
106
|
|
|
100
107
|
// This Agent + shared (trusted local only; MCP entry rejects)
|
|
101
|
-
await executeOp(
|
|
108
|
+
await executeOp(
|
|
109
|
+
'graph_query',
|
|
110
|
+
{ agentId: 'agent-1', kind: 'nodes', scope: 'both' },
|
|
111
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
112
|
+
);
|
|
102
113
|
|
|
103
114
|
// v0.4.1+: omitting agentId → fallback 'default', global KG view (trusted local only)
|
|
104
115
|
await executeOp('graph_query', { kind: 'nodes', scope: 'both' }, { isTrustedLocal: true });
|
|
@@ -140,7 +151,17 @@ Four ops — `graph_query` / `status` / `doctor` / `init` — have made `agentId
|
|
|
140
151
|
### services (9 op business layer)
|
|
141
152
|
|
|
142
153
|
```typescript
|
|
143
|
-
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';
|
|
144
165
|
```
|
|
145
166
|
|
|
146
167
|
### operations (9 op registry + executeOp)
|
|
@@ -158,7 +179,12 @@ import { renderOperationMarkdown } from '@easbot/memory/format/render';
|
|
|
158
179
|
### hooks (4 hook types)
|
|
159
180
|
|
|
160
181
|
```typescript
|
|
161
|
-
import type {
|
|
182
|
+
import type {
|
|
183
|
+
PreCompactHook,
|
|
184
|
+
SessionStartHook,
|
|
185
|
+
SessionEndHook,
|
|
186
|
+
PostToolFailureHook,
|
|
187
|
+
} from '@easbot/memory/hooks';
|
|
162
188
|
```
|
|
163
189
|
|
|
164
190
|
## CLI / MCP dual entry (v0.4 stage 4)
|
package/README.md
CHANGED
|
@@ -6,8 +6,7 @@ EASBOT 生态系统的长期记忆管理库(v0.4.0)。提供分层记忆、K
|
|
|
6
6
|
|
|
7
7
|
## 版本
|
|
8
8
|
|
|
9
|
-
v0.3.
|
|
10
|
-
|
|
9
|
+
v0.3.28
|
|
11
10
|
## 特性(v0.4.0)
|
|
12
11
|
|
|
13
12
|
- **10 op 统一入口**(ADR 0069 +1 sync):`recall / remember / forget / extract / consolidate / sync / graph_query / status / doctor / init`,MCP / CLI / Agent Tool 三端共享。
|
|
@@ -100,16 +99,32 @@ await executeOp(
|
|
|
100
99
|
|
|
101
100
|
```typescript
|
|
102
101
|
// agent tool 主路径(v0.5+):按 numeric nodeId 查邻居
|
|
103
|
-
await executeOp(
|
|
102
|
+
await executeOp(
|
|
103
|
+
'graph_query',
|
|
104
|
+
{ nodeId: 12, maxEdgesPerNode: 20 },
|
|
105
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
106
|
+
);
|
|
104
107
|
|
|
105
108
|
// CLI 路径(v0.4.1+,保留兼容):name 模糊匹配 + scope/type/relation 过滤
|
|
106
|
-
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
|
+
);
|
|
107
114
|
|
|
108
115
|
// 只看共享节点
|
|
109
|
-
await executeOp(
|
|
116
|
+
await executeOp(
|
|
117
|
+
'graph_query',
|
|
118
|
+
{ query: 'TS', scope: 'shared_only' },
|
|
119
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
120
|
+
);
|
|
110
121
|
|
|
111
122
|
// 本 Agent + 共享(trusted local only;MCP 入口会拒绝)
|
|
112
|
-
await executeOp(
|
|
123
|
+
await executeOp(
|
|
124
|
+
'graph_query',
|
|
125
|
+
{ query: 'TS', scope: 'both' },
|
|
126
|
+
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
127
|
+
);
|
|
113
128
|
|
|
114
129
|
// v0.4.1+:不传 agentId → fallback 'default',全局 KG 视图(trusted local only)
|
|
115
130
|
await executeOp('graph_query', { query: 'TS', scope: 'both' }, { isTrustedLocal: true });
|
|
@@ -168,7 +183,12 @@ import { renderOperationMarkdown } from '@easbot/memory/format/render';
|
|
|
168
183
|
### hooks(4 hook 类型)
|
|
169
184
|
|
|
170
185
|
```typescript
|
|
171
|
-
import type {
|
|
186
|
+
import type {
|
|
187
|
+
PreCompactHook,
|
|
188
|
+
SessionStartHook,
|
|
189
|
+
SessionEndHook,
|
|
190
|
+
PostToolFailureHook,
|
|
191
|
+
} from '@easbot/memory/hooks';
|
|
172
192
|
```
|
|
173
193
|
|
|
174
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/
|
|
64
|
-
"@easbot/
|
|
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",
|