@easbot/memory 0.3.39 → 0.3.40
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 +19 -17
- package/README.md +18 -17
- 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 +11 -11
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +9 -9
- package/package.json +10 -10
- package/dist/chunks/cli-handler-HUTXCEXM.cjs +0 -1
- package/dist/chunks/cli-handler-TUILJT7W.mjs +0 -1
- package/dist/chunks/stdio-server-EEWPIACW.mjs +0 -1
package/README.en.md
CHANGED
|
@@ -6,7 +6,7 @@ Long-term memory library for the EASBOT ecosystem (v0.4.0). Provides layered mem
|
|
|
6
6
|
|
|
7
7
|
## Version
|
|
8
8
|
|
|
9
|
-
v0.3.
|
|
9
|
+
v0.3.40
|
|
10
10
|
## Features (v0.4.0)
|
|
11
11
|
|
|
12
12
|
- **10 op unified entry** (ADR 0069 +1 `sync`) — `recall / remember / forget / extract / consolidate / sync / graph_query / status / doctor / init`; MCP / CLI / Agent Tool share the same `executeOp(name, args, ctx)`.
|
|
@@ -91,24 +91,24 @@ await executeOp(
|
|
|
91
91
|
|
|
92
92
|
> **2026-09-23 PR-2 sync**: the `graph_query` v0.5 schema was simplified (aligned with `note.graph_query`):
|
|
93
93
|
>
|
|
94
|
-
> - The **agent tool main path** accepts
|
|
95
|
-
> -
|
|
96
|
-
> - `
|
|
97
|
-
> - `scope
|
|
94
|
+
> - The **agent tool main path** accepts a positive-integer `nodeId` (numeric strings included), plus optional `maxDepth` / `maxNodes` / `maxEdgesPerNode` / `relation` / `type`
|
|
95
|
+
> - Name-fragment `query` matching is retained only for the CLI `easbot memory graph query`; it is not exposed by the agent tool
|
|
96
|
+
> - `maxDepth` (default 2) / `maxNodes` (default 100) / `maxEdgesPerNode` (default 10, max 100) control the BFS budget
|
|
97
|
+
> - `scope` goes through the CLI (fine-grained filtering)
|
|
98
98
|
> - Agent tool `maxEdgesPerNode` fix: the service zod schema `graphQueryParamsSchema` declared this field in PR-2 (its earlier absence caused `.strict()` to reject it → recall/graph_query failures in agent context)
|
|
99
99
|
|
|
100
100
|
```typescript
|
|
101
101
|
// Agent tool main path (v0.5+): query neighbors by numeric nodeId
|
|
102
102
|
await executeOp(
|
|
103
103
|
'graph_query',
|
|
104
|
-
{ nodeId: 12, maxEdgesPerNode:
|
|
104
|
+
{ nodeId: 12, maxDepth: 2, maxNodes: 100, maxEdgesPerNode: 10 },
|
|
105
105
|
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
// CLI path (v0.4.1+, kept for compatibility): name fuzzy match + scope/type/relation filters
|
|
109
109
|
await executeOp(
|
|
110
110
|
'graph_query',
|
|
111
|
-
{ query: 'TS', scope: 'agent_only', type: 'class',
|
|
111
|
+
{ query: 'TS', scope: 'agent_only', type: 'class', maxDepth: 2 },
|
|
112
112
|
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
113
113
|
);
|
|
114
114
|
|
|
@@ -264,18 +264,20 @@ schema as-is** (it is no longer flattened into a shape map), so per-op required
|
|
|
264
264
|
fields, ranges and cross-field rules are expressed by the schema itself — no
|
|
265
265
|
secondary validation inside the plugin is needed.
|
|
266
266
|
|
|
267
|
-
| Op | Effective parameters
|
|
268
|
-
| ------------- |
|
|
269
|
-
| `recall` | `query` (required) / `limit` (default 10) / `category` / `minImportance` (1-10, inclusive) / `maxEdgesPerNode` (default 10, 1-100) / `includeGraph` / `includeShared` |
|
|
270
|
-
| `remember` | `content` (required) / `category` (required) / `importance` (required, 1-10) / `tags`
|
|
271
|
-
| `update` | `factId` (required) plus at least one of `content` / `category` / `importance` / `tags`
|
|
272
|
-
| `forget` | `factId` (required) / `dryRun` (default false) / `force` (default false)
|
|
273
|
-
| `extract` | `lastN` (default 10) / `fromMessageId`
|
|
274
|
-
| `graph_query` | `
|
|
275
|
-
| `status` | no extra parameters
|
|
267
|
+
| Op | Effective parameters |
|
|
268
|
+
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
269
|
+
| `recall` | `query` (required) / `limit` (default 10) / `category` / `minImportance` (1-10, inclusive) / `minScore` (0-1) / `maxEdgesPerNode` (default 10, 1-100) / `includeGraph` / `includeShared` |
|
|
270
|
+
| `remember` | `content` (required) / `category` (required) / `importance` (required, 1-10) / `tags` |
|
|
271
|
+
| `update` | `factId` (required) plus at least one of `content` / `category` / `importance` / `tags` |
|
|
272
|
+
| `forget` | `factId` (required) / `dryRun` (default false) / `force` (default false) |
|
|
273
|
+
| `extract` | `lastN` (default 10) / `fromMessageId` |
|
|
274
|
+
| `graph_query` | `nodeId` (required, positive integer) / `maxDepth` (default 2) / `maxNodes` (default 100) / `maxEdgesPerNode` (default 10) / `relation` / `type` |
|
|
275
|
+
| `status` | no extra parameters |
|
|
276
276
|
|
|
277
277
|
Tool return values are uniformly `ToolResult` (`{ output, title, metadata }`): `output` goes back
|
|
278
|
-
to the model, while `title` / `metadata` are consumed by the host UI and statistics.
|
|
278
|
+
to the model, while `title` / `metadata` are consumed by the host UI and statistics. For `remember`,
|
|
279
|
+
embedding is an optional enhancement: adapter, model, or network failures fall back to FTS-only
|
|
280
|
+
without blocking fact persistence or recall.
|
|
279
281
|
|
|
280
282
|
#### Distribution artifact generation
|
|
281
283
|
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ EASBOT 生态系统的长期记忆管理库(v0.4.0)。提供分层记忆、K
|
|
|
6
6
|
|
|
7
7
|
## 版本
|
|
8
8
|
|
|
9
|
-
v0.3.
|
|
9
|
+
v0.3.40
|
|
10
10
|
## 特性(v0.4.0)
|
|
11
11
|
|
|
12
12
|
- **10 op 统一入口**(ADR 0069 +1 sync):`recall / remember / forget / extract / consolidate / sync / graph_query / status / doctor / init`,MCP / CLI / Agent Tool 三端共享。
|
|
@@ -91,24 +91,24 @@ await executeOp(
|
|
|
91
91
|
|
|
92
92
|
> **2026-09-23 PR-2 同步**:graph_query v0.5 schema 已简化(与 note.graph_query 对齐):
|
|
93
93
|
>
|
|
94
|
-
> - **agent tool 主路径**只接受 `nodeId
|
|
95
|
-
> - `query
|
|
96
|
-
> - `
|
|
97
|
-
> - `scope
|
|
94
|
+
> - **agent tool 主路径**只接受 `nodeId`(正整数,支持数字字符串),并可传 `maxDepth` / `maxNodes` / `maxEdgesPerNode` / `relation` / `type`
|
|
95
|
+
> - `query` 节点名模糊匹配仅保留给 CLI `easbot memory graph query`,agent tool 不暴露
|
|
96
|
+
> - `maxDepth`(默认 2)/ `maxNodes`(默认 100)/ `maxEdgesPerNode`(默认 10,上限 100)控制 BFS 预算
|
|
97
|
+
> - `scope` 走 CLI(精细过滤)
|
|
98
98
|
> - agent tool 的 `maxEdgesPerNode` 修复:service zod schema `graphQueryParamsSchema` 在 PR-2 加上该字段声明(之前漏写导致 .strict() 拒字段 → recall/graph_query 在 agent context 失败)
|
|
99
99
|
|
|
100
100
|
```typescript
|
|
101
101
|
// agent tool 主路径(v0.5+):按 numeric nodeId 查邻居
|
|
102
102
|
await executeOp(
|
|
103
103
|
'graph_query',
|
|
104
|
-
{ nodeId: 12, maxEdgesPerNode:
|
|
104
|
+
{ nodeId: 12, maxDepth: 2, maxNodes: 100, maxEdgesPerNode: 10 },
|
|
105
105
|
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
// CLI 路径(v0.4.1+,保留兼容):name 模糊匹配 + scope/type/relation 过滤
|
|
109
109
|
await executeOp(
|
|
110
110
|
'graph_query',
|
|
111
|
-
{ query: 'TS', scope: 'agent_only', type: 'class',
|
|
111
|
+
{ query: 'TS', scope: 'agent_only', type: 'class', maxDepth: 2 },
|
|
112
112
|
{ agentId: 'agent-1', isTrustedLocal: true },
|
|
113
113
|
);
|
|
114
114
|
|
|
@@ -248,18 +248,19 @@ import {
|
|
|
248
248
|
shape map),因此 per-op 的必填 / 取值范围 / 跨字段约束**由 schema 直接表达**,
|
|
249
249
|
无需插件侧二次校验。
|
|
250
250
|
|
|
251
|
-
| op | 生效参数
|
|
252
|
-
| ------------- |
|
|
253
|
-
| `recall` | `query`(必填)/ `limit`(默认 10)/ `category` / `minImportance`(1-10,闭区间)/ `maxEdgesPerNode`(默认 10,1-100)/ `includeGraph` / `includeShared` |
|
|
254
|
-
| `remember` | `content`(必填)/ `category`(必填)/ `importance`(必填,1-10)/ `tags`
|
|
255
|
-
| `update` | `factId`(必填)+ `content` / `category` / `importance` / `tags`(至少一项)
|
|
256
|
-
| `forget` | `factId`(必填)/ `dryRun` / `force`
|
|
257
|
-
| `extract` | `lastN`(默认 10)/ `fromMessageId`
|
|
258
|
-
| `graph_query` | `
|
|
259
|
-
| `status` | 无额外参数
|
|
251
|
+
| op | 生效参数 |
|
|
252
|
+
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
253
|
+
| `recall` | `query`(必填)/ `limit`(默认 10)/ `category` / `minImportance`(1-10,闭区间)/ `minScore`(0-1)/ `maxEdgesPerNode`(默认 10,1-100)/ `includeGraph` / `includeShared` |
|
|
254
|
+
| `remember` | `content`(必填)/ `category`(必填)/ `importance`(必填,1-10)/ `tags` |
|
|
255
|
+
| `update` | `factId`(必填)+ `content` / `category` / `importance` / `tags`(至少一项) |
|
|
256
|
+
| `forget` | `factId`(必填)/ `dryRun` / `force` |
|
|
257
|
+
| `extract` | `lastN`(默认 10)/ `fromMessageId` |
|
|
258
|
+
| `graph_query` | `nodeId`(必填,正整数)/ `maxDepth`(默认 2)/ `maxNodes`(默认 100)/ `maxEdgesPerNode`(默认 10)/ `relation` / `type` |
|
|
259
|
+
| `status` | 无额外参数 |
|
|
260
260
|
|
|
261
261
|
工具返回值统一为 `ToolResult`(`{ output, title, metadata }`):`output` 回传模型,
|
|
262
|
-
`title` / `metadata` 供宿主 UI
|
|
262
|
+
`title` / `metadata` 供宿主 UI 与统计消费。`remember` 的 embedding 是可选增强:
|
|
263
|
+
适配器、模型或网络失败时自动降级为 FTS-only,不阻断事实写入与召回。
|
|
263
264
|
|
|
264
265
|
#### 分发产物自动生成
|
|
265
266
|
|
|
@@ -19,7 +19,7 @@ agentId via params**.
|
|
|
19
19
|
| `update` | Update an existing fact (atomic) | no | `factId` + at least one of `content` / `category` / `importance` / `tags` |
|
|
20
20
|
| `forget` | Delete one fact by `factId` | no | Single-fact delete only |
|
|
21
21
|
| `extract` | Aggregate facts / KG nodes for current session | no | Read-only; `sessionId` from ctx |
|
|
22
|
-
| `graph_query` | KG BFS neighbor expansion | no | `
|
|
22
|
+
| `graph_query` | KG BFS neighbor expansion | no | `nodeId` from a recall hit or prior graph result; use `recall` for fact search |
|
|
23
23
|
| `status` | Counts / fts / vector / schema | no | Diagnostic summary |
|
|
24
24
|
|
|
25
25
|
**Workspace init is automatic**: if the memory db does not yet exist when you call any op,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs'),chunkAVECFV5K_cjs=require('./chunk-AVECFV5K.cjs'),mcp=require('@easbot/mcp'),utils=require('@easbot/utils');var ie=utils.Log.create({service:"memory.format.truncate"}),X="**`";var Z=24e3,ee=25e3;async function $(e,n={}){let o=n.softLimit??Z,s=n.hardCeiling??ee,r=n.toolName??"memory",c=n.writeToDisk!==false;if(e.length<=o)return {content:e,truncated:false};let d=e.slice(0,s),t=d.lastIndexOf(`
|
|
2
2
|
${X}`),a=d.lastIndexOf(`
|
|
3
3
|
`),m;t>s*.5?m=t:a>0?m=a:m=-1;let u=m>0?d.slice(0,m):d,i=u+"\n\n... (output truncated to budget; the source above is complete and verbatim \u2014 treat it as already Read. For any area not covered, make ANOTHER `<tool>` targeting those names \u2014 do NOT Read these files.)";if(!c)return {content:i,truncated:true,outputPath:"",hint:"Make another recall / graph_query with narrower scope.",info:`... ${e.length-u.length}/${e.length} characters truncated ...`};try{let f=await utils.TruncateContent.truncate(e,{maxChars:Math.min(u.length,utils.TruncateContent.DEFAULT_MAX_CHARS),direction:"head",label:`${r}-output`});return f.truncated?{content:i,truncated:!0,outputPath:f.outputPath,hint:utils.TruncateContent.formatHint(f),info:`... ${f.removedLength}/${f.originalLength} characters truncated ...`}:{content:i,truncated:!0,outputPath:"",hint:"Make another recall / graph_query with narrower scope.",info:`... ${e.length-u.length}/${e.length} characters truncated ...`}}catch(f){return ie.warn("TruncateContent.truncate failed, returning without disk hint",{error:utils.errorMeta(f)}),{content:i,truncated:true,outputPath:"",hint:"Make another recall / graph_query with narrower scope.",info:`... ${e.length-u.length}/${e.length} characters truncated ...`}}}function w(e,n={}){let o=n.softLimit??Z,s=n.hardCeiling??ee;if(e.length<=o)return {content:e,truncated:false};let r=e.slice(0,s),c=r.lastIndexOf(`
|
|
4
4
|
${X}`),d=r.lastIndexOf(`
|
|
@@ -45,20 +45,20 @@ ${e.deletedIds.map(t=>` - ${t}`).join(`
|
|
|
45
45
|
`);return n.sync?w(r,{}).content:(await $(r,{toolName:o,writeToDisk:n.writeToDisk})).content}var v=20;async function L(e,n={}){let o=n.toolName??"memory_sync",r=[`**\`memory_sync:${e.dryRun?"DRY_RUN":"OK"}\`**`,"",`windowDays: ${e.windowDays} (threshold: ${e.archiveThreshold})`,"","## Stage A (db \u2192 .md)",`- generated: ${e.generatedCount}`,`- skipped (idempotent): ${e.skippedCount}`,`- failed (best-effort): ${e.failedGenerateCount}`,"","## Stage B (active/ \u2192 archive/)",`- ${e.dryRun?"would archive":"archived"}: ${e.archivedCount}`];if(e.archivedRecords.length>0){r.push("","### Archived records:");let d=e.archivedRecords.slice(0,v);for(let t of d)r.push(`- ${t.firstFactId} (${t.firstCreatedAt})`),r.push(` - source: \`${t.source}\``),r.push(` - target: \`${t.target}\``);e.archivedRecords.length>v&&r.push(`... and ${e.archivedRecords.length-v} more (use --json for full list)`);}r.push("",`duration: ${e.durationMs}ms`,"",I("sync",o));let c=r.join(`
|
|
46
46
|
`);return n.sync?w(c,{}).content:(await $(c,{toolName:o,writeToDisk:n.writeToDisk})).content}async function j(e,n={}){let o=n.toolName??"memory_doctor",s=`**\`memory_doctor:${e.healthy?"OK":"ISSUES"}\`**`,r=t=>t?"\u2705":"\u274C",c=e.checks.map(t=>`${r(t.passed)} ${t.name}: ${t.message}`).join(`
|
|
47
47
|
`),d=[s,"",c,"",I("doctor",o)].join(`
|
|
48
|
-
`);return n.sync?w(d,{}).content:(await $(d,{toolName:o,writeToDisk:n.writeToDisk})).content}async function R(e,n,o={}){let s=n,r=typeof s.kind=="string";switch((r?s:{kind:e}).kind){case "recall":{let d=r?{hits:s.hits,total:s.totalCount??s.total??0,truncated:s.truncated??false}:n;return A(d,{...o,query:s.query??o.query??"",agentId:s.agentId??o.agentId??"",scope:s.scope??o.scope??"agent_only"})}case "remember":{let d=r?{fact:s.fact,nodeIds:s.nodeIds}:n;return M(d,o)}case "forget":return _(r?s:n,o);case "graph_query":return N(r?s:n,o);case "status":return O(r?s:n,o);case "consolidate":return P(r?s:n,o);case "sync":return L(r?s:n,o);case "doctor":return j(r?s:n,o);default:throw new chunkAVECFV5K_cjs.a.UnsupportedOperationError({message:`renderOperationMarkdown: unsupported op "${e}"`,opName:e,renderer:"markdown"})}}var D=utils.Log.create({service:"memory.mcp.stdio"});function Te(e){let n=new Map,o=e.isRemote??true,s=!o;function r(t){let a=utils.Locale.resolveLocaleLang();return {agentId:t.agentId??e.agentId,isTrustedLocal:t.isTrustedLocal??s,remote:o,locale:a,dbPath:e.dbPath,workspaceDir:e.workspaceDir,rootDir:e.workspaceDir,config:
|
|
48
|
+
`);return n.sync?w(d,{}).content:(await $(d,{toolName:o,writeToDisk:n.writeToDisk})).content}async function R(e,n,o={}){let s=n,r=typeof s.kind=="string";switch((r?s:{kind:e}).kind){case "recall":{let d=r?{hits:s.hits,total:s.totalCount??s.total??0,truncated:s.truncated??false}:n;return A(d,{...o,query:s.query??o.query??"",agentId:s.agentId??o.agentId??"",scope:s.scope??o.scope??"agent_only"})}case "remember":{let d=r?{fact:s.fact,nodeIds:s.nodeIds}:n;return M(d,o)}case "forget":return _(r?s:n,o);case "graph_query":return N(r?s:n,o);case "status":return O(r?s:n,o);case "consolidate":return P(r?s:n,o);case "sync":return L(r?s:n,o);case "doctor":return j(r?s:n,o);default:throw new chunkAVECFV5K_cjs.a.UnsupportedOperationError({message:`renderOperationMarkdown: unsupported op "${e}"`,opName:e,renderer:"markdown"})}}var D=utils.Log.create({service:"memory.mcp.stdio"});function Te(e){let n=new Map,o=e.isRemote??true,s=!o;function r(t){let a=utils.Locale.resolveLocaleLang();return {agentId:t.agentId??e.agentId,isTrustedLocal:t.isTrustedLocal??s,remote:o,locale:a,dbPath:e.dbPath,workspaceDir:e.workspaceDir,rootDir:e.workspaceDir,config:chunk77ERAHDK_cjs.A({agentId:e.agentId,dbPath:e.dbPath})}}function c(t,a){return {content:[{type:"text",text:t}],isError:a}}function d(t){return mcp.formatFailClosed(t,s)}return n.set("recall",async t=>{try{let a=t,m=r({agentId:a.agentId}),u=await chunk77ERAHDK_cjs.z("recall",t,m);return {content:[{type:"text",text:await R("recall",u,{toolName:"memory_recall",query:a.query,agentId:a.agentId??e.agentId,scope:a.scope??"agent_only"})}]}}catch(a){return c(d(a),true)}}),n.set("remember",async t=>{try{let m=r({agentId:t.agentId}),u=await chunk77ERAHDK_cjs.z("remember",t,m);return {content:[{type:"text",text:await R("remember",u,{toolName:"memory_remember"})}]}}catch(a){return c(d(a),true)}}),n.set("update",async t=>{try{let m=r({agentId:t.agentId}),u=await chunk77ERAHDK_cjs.z("update",t,m),l=u.fieldsUpdated.length>0?u.fieldsUpdated.join(", "):"(no-op)",i=u.contentChanged?" (embedding rewritten)":"";return {content:[{type:"text",text:`Memory updated.
|
|
49
49
|
id: ${u.fact.id}
|
|
50
50
|
category: ${u.fact.category}
|
|
51
51
|
importance: ${u.fact.importance}
|
|
52
52
|
fields updated: ${l}${i}
|
|
53
53
|
updated_at: ${u.fact.updatedAt}
|
|
54
|
-
`}]}}catch(a){return c(d(a),true)}}),n.set("forget",async t=>{try{let m=r({agentId:t.agentId}),u=await
|
|
54
|
+
`}]}}catch(a){return c(d(a),true)}}),n.set("forget",async t=>{try{let m=r({agentId:t.agentId}),u=await chunk77ERAHDK_cjs.z("forget",t,m);return {content:[{type:"text",text:await R("forget",u,{toolName:"memory_forget"})}]}}catch(a){return c(d(a),true)}}),n.set("extract",async t=>{try{let m=r({agentId:t.agentId}),l=await chunk77ERAHDK_cjs.z("extract",t,m);return {content:[{type:"text",text:`Extract completed.
|
|
55
55
|
sessionId: ${t.sessionId??"(unknown)"}
|
|
56
56
|
extractedCount: ${l.extractedCount}
|
|
57
57
|
factIds: ${l.factIds.length>0?l.factIds.join(", "):"(none)"}
|
|
58
58
|
messageRange: ${l.messageRange.fromMessageId} -> ${l.messageRange.toMessageId}
|
|
59
|
-
`}]}}catch(a){return c(d(a),true)}}),n.set("consolidate",async t=>{try{let m=r({agentId:t.agentId,isTrustedLocal:!0}),u=await
|
|
59
|
+
`}]}}catch(a){return c(d(a),true)}}),n.set("consolidate",async t=>{try{let m=r({agentId:t.agentId,isTrustedLocal:!0}),u=await chunk77ERAHDK_cjs.z("consolidate",t,m);return {content:[{type:"text",text:await R("consolidate",u,{toolName:"memory_consolidate"})}]}}catch(a){return c(d(a),true)}}),n.set("sync",async t=>{try{let m=t.agentId?.trim();if(!m)return c(d(new Error("memory_sync: agentId is required (sync requires agentId, see ADR 0069)")),!0);let u=r({agentId:m,isTrustedLocal:!0}),l=await chunk77ERAHDK_cjs.z("sync",t,u);return {content:[{type:"text",text:await R("sync",l,{toolName:"memory_sync"})}]}}catch(a){return c(d(a),true)}}),n.set("graph_query",async t=>{try{let a=t,m=r({agentId:a.agentId}),u=await chunk77ERAHDK_cjs.z("graph_query",t,m);return {content:[{type:"text",text:await R("graph_query",u,{toolName:"memory_graph_query",scope:a.scope??"agent_only"})}]}}catch(a){return c(d(a),true)}}),n.set("status",async t=>{try{let m=r({agentId:(t??{}).agentId}),u=await chunk77ERAHDK_cjs.z("status",t,m),{renderKnowledgeStatus:l}=await import('@easbot/terminal'),i=u;return {content:[{type:"text",text:l({packageName:"memory",rootDir:i.workspaceDir??"",configPath:i.configPath??"",configExists:typeof i.configExists=="boolean"?i.configExists:!0,dbPath:i.dbPath??"",dbExists:typeof i.dbExists=="boolean"?i.dbExists:!0,dbSize:typeof i.dbSize=="number"?i.dbSize:void 0,indexState:i.indexState,schemaVersion:typeof i.schemaVersion=="number"?i.schemaVersion:void 0,extractionVersion:typeof i.extractionVersion=="number"?i.extractionVersion:void 0,lastSyncAt:i.lastSyncAt,vectorEnabled:typeof i.vectorEnabled=="boolean"?i.vectorEnabled:!1,embeddingDims:typeof i.embeddingDims=="number"?i.embeddingDims:void 0,llm:i.llm??{initialized:!1,capabilities:{}},backend:i.backend,healthy:typeof i.healthy=="boolean"?i.healthy:!0,recommendation:i.recommendation,dbStats:(()=>{let p=i.dbStats;if(p&&typeof p=="object"&&Object.keys(p).length>0)return {...p};let g=i.integrityStats;if(g&&typeof g=="object"&&Object.keys(g).length>0)return {...g}})(),extras:(()=>{let p={};if(typeof i.agentId=="string"&&(p.agent_id=i.agentId),typeof i.ftsAvailable=="boolean"&&(p.fts_available=i.ftsAvailable?"yes":"no"),i.factsByCategory&&typeof i.factsByCategory=="object")for(let[g,b]of Object.entries(i.factsByCategory))typeof b=="number"&&b>0&&(p[`facts/${g}`]=b);if(i.meta&&typeof i.meta=="object")for(let[g,b]of Object.entries(i.meta))b!==void 0&&(p[`meta/${g}`]=b);return Object.keys(p).length>0?p:void 0})()})}]}}catch(a){return c(d(a),true)}}),n.set("doctor",async t=>{try{let m=r({agentId:(t??{}).agentId,isTrustedLocal:!0}),u=await chunk77ERAHDK_cjs.z("doctor",t,m);return {content:[{type:"text",text:await R("doctor",u,{toolName:"memory_doctor"})}]}}catch(a){return c(d(a),true)}}),n.set("init",async t=>{try{let a=r({isTrustedLocal:!0}),u=await chunk77ERAHDK_cjs.z("init",t,a);return {content:[{type:"text",text:`Init complete.
|
|
60
60
|
dbPath: ${u.dbPath}
|
|
61
61
|
tablesCreated: ${u.tablesCreated}
|
|
62
62
|
migrationsApplied: ${u.migrationsApplied}
|
|
63
63
|
durationMs: ${u.durationMs}
|
|
64
|
-
`}]}}catch(a){return c(d(a),true)}}),n}var Ee={recall:
|
|
64
|
+
`}]}}catch(a){return c(d(a),true)}}),n}var Ee={recall:chunk77ERAHDK_cjs.c,remember:chunk77ERAHDK_cjs.d,update:chunk77ERAHDK_cjs.e,forget:chunk77ERAHDK_cjs.f,extract:chunk77ERAHDK_cjs.g,consolidate:chunk77ERAHDK_cjs.h,sync:chunk77ERAHDK_cjs.m,graph_query:chunk77ERAHDK_cjs.i,status:chunk77ERAHDK_cjs.j,doctor:chunk77ERAHDK_cjs.k,init:chunk77ERAHDK_cjs.l};function xe(e,n){let o=chunk77ERAHDK_cjs.x[e],s={title:o?.annotations?.defaultDescription??e,readOnlyHint:o?.annotations?.readOnlyHint??false,destructiveHint:o?.annotations?.destructiveHint??false,idempotentHint:o?.annotations?.idempotentHint??true,openWorldHint:false},r=Ee[e];return {name:e,description:o?.annotations?.defaultDescription??`memory op: ${e}`,inputSchema:r??{type:"object",properties:{},required:[],additionalProperties:false},annotations:s,handler:n}}exports.b=void 0;(o=>{async function e(s,r){let{getMemoryDbPath:c,getInstance:d}=await import('./interfaces-LDOE5ZTS.cjs'),a=r!==null&&typeof r=="object"&&"agentId"in r&&"dbPath"in r?r:{agentId:process.env.EASBOT_AGENT_ID??"default",dbPath:c(d().worktree),workspaceDir:d().worktree,isRemote:false};mcp.extendKnownErrorCodes(["AGENT_ID_REQUIRED","SESSION_ID_REQUIRED","CATEGORY_REQUIRED","IMPORTANCE_REQUIRED","TIMERANGE_REQUIRED","DRY_RUN_NO_DELETE"]);let m=new mcp.ToolRegistry,u=Te(a),l=Object.keys(chunk77ERAHDK_cjs.x);for(let h of l){let C=u.get(h);if(!C)throw new chunkAVECFV5K_cjs.a.MissingMcpHandlerError({message:`MemoryStdioServer.start: missing handler for tool "${h}"`,toolName:h});m.register(xe(h,C));}D.info("starting memory MCP stdio server",{id:s.id,name:s.name,toolCount:l.length,isRemote:a.isRemote??true});let i=await mcp.createAndStartStdioServer(s,m),f=null,p=new Promise(h=>{f=h;}),g=h=>{D.info("received signal, stopping MCP server",{signal:h}),f?.();},b=()=>g("SIGINT"),k=()=>g("SIGTERM"),F=(h,C)=>process.listeners(h).includes(C);F("SIGINT",b)||process.on("SIGINT",b),F("SIGTERM",k)||process.on("SIGTERM",k);try{await p;}finally{try{process.off("SIGINT",b),process.off("SIGTERM",k);}catch(h){D.warn("failed to remove signal handlers",{error:utils.errorMeta(h)});}try{await i.stop();}catch(h){D.warn("server.stop failed during cleanup",{error:utils.errorMeta(h)});}}return {id:s.id,name:s.name,version:s.version,tools:l}}o.start=e;function n(){return Object.keys(chunk77ERAHDK_cjs.x)}o.getToolNames=n;})(exports.b||(exports.b={}));exports.a=R;
|