@restregular/dsh-memory 0.25.11 → 0.25.12
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/CHANGELOG.md +7 -0
- package/README.md +5 -0
- package/lib/tools/index.js +11 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
本项目的版本记录。安装 id 与 npm 版本一一对应。
|
|
4
4
|
|
|
5
|
+
## 0.25.12 — `memory_save.supersedes` 明确要求传「完整 id」
|
|
6
|
+
|
|
7
|
+
- **问题**:`supersedes` 的参数说明只有一句英文 `Record id this corrects/replaces`,没说要传完整 id。而检索 / 列表 / 摘要 / 规则索引里显示的 id 全是 **8 位短 id**(`shortId`),`memory_get` 也接受 8 位前缀 —— 模型很容易把短 id 直接塞给 `supersedes`;provider 那边是按 id **精确查找**目标记录(`records.get(id)`),短 id 必然查不到,只会得到 `SUPERSEDES_UNKNOWN`,报错里也没有提示「你用了短 id」。
|
|
8
|
+
- **口径**:`supersedes` 的 schema 说明改成明确的中文说明 —— 必须传**完整 id(36 位 UUID)**,不能传 `memory_search` / `memory_list` / 摘要 / 规则索引里的 8 位短 id;手头只有短 id 时先用 `memory_get` 取回(它结果里每段首行的 `[id]` 就是完整 id)。同时把语义写清楚:旧记录标记为「已修正」,默认退出检索 / 规则 / 自动召回,`memory_get` 仍可查历史。
|
|
9
|
+
- README 第 2 节「存一条记忆」补同一段说明;`SaveArgs.supersedes` 的注释同步(行为不变,仍是精确 id 查找,不会静默接受短 id)。
|
|
10
|
+
- 测试:`source/tool-memory/test/tools.test.ts` 增加守卫用例 —— `supersedes` 的说明里必须出现「完整 id」「8 位短 id」「memory_get」,防止以后再被改回一句模糊英文。全套 505 tests(新增 1)/ 504 pass / 1 skipped(`memory-local/test/multiprocess.test.ts` 需真起子进程)。
|
|
11
|
+
|
|
5
12
|
## 0.25.11 — 「记忆权限」浮窗里能直接看到真实键;摘要里的自定义作用域补 `custom:` 前缀
|
|
6
13
|
|
|
7
14
|
- **浮窗露出完整键**:显示名与真实键不一致时(项目别名 → 完整路径、会话短 id → 完整 uuid、自定义名 → 裸键),作用域行的名字下面多一行等宽小字,就是完整键。**不做手工截断**——键保持原样,放不下由 CSS 按容器宽度省略(`text-overflow:ellipsis`),窗口变宽就多显示几个字符。名义上相同(例如没有别名的项目作用域 `project:D:\w` 显示名就是键)则不再重复一行。
|
package/README.md
CHANGED
|
@@ -193,6 +193,11 @@ memory_save({
|
|
|
193
193
|
})
|
|
194
194
|
```
|
|
195
195
|
|
|
196
|
+
**`supersedes` 要传完整 id(0.25.12)**:它是「这条新记忆修正 / 替换掉哪条旧记录」,provider 按 id **精确查找**
|
|
197
|
+
目标记录,所以必须给**完整 id**(36 位 UUID)——不能用 `memory_search` / `memory_list` / 摘要 / 规则索引里显示的
|
|
198
|
+
8 位短 id(那些是短 id,传进去会被 `SUPERSEDES_UNKNOWN` 拒绝)。手头只有短 id 时先 `memory_get`,它结果里每段
|
|
199
|
+
首行的 `[id]` 就是完整 id。旧记录会被标记为「已修正」,默认不再出现在检索、规则和自动召回里,但 `memory_get` 仍能查到。
|
|
200
|
+
|
|
196
201
|
### 3. 检索、取全文、列出、忘记
|
|
197
202
|
|
|
198
203
|
```jsonc
|
package/lib/tools/index.js
CHANGED
|
@@ -459,6 +459,15 @@ function withheldReasonFor(
|
|
|
459
459
|
return 'read-disabled'
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
+
/**
|
|
463
|
+
* memory_save 的 supersedes 参数说明(模型可见)。
|
|
464
|
+
* 检索 / 列表 / 摘要 / 规则索引里给的 id 都是 8 位短 id,而 supersedes 在 provider
|
|
465
|
+
* 里是**按 id 精确查找**(records.get(id)),传短 id 只会得到 SUPERSEDES_UNKNOWN。
|
|
466
|
+
* 所以必须明确要求「完整 id」,并给出拿完整 id 的路径(memory_get 首行就是完整 id)。
|
|
467
|
+
*/
|
|
468
|
+
const SUPERSEDES_PARAM_DESCRIPTION =
|
|
469
|
+
'被这条新记忆修正 / 替换掉的旧记录 id。必须传**完整 id**(36 位 UUID),不能传 memory_search / memory_list / 摘要 / 规则索引里显示的 8 位短 id;手头只有短 id 时先用 memory_get 取回 —— 它结果里每段首行的 [id] 就是完整 id。旧记录会被标记为「已修正」,默认不再出现在检索、规则和自动召回里,但 memory_get 仍能查到。'
|
|
470
|
+
|
|
462
471
|
/** memory_* 的 description 参数说明(模型可见)。 */
|
|
463
472
|
const DESCRIPTION_PARAM_DESCRIPTION =
|
|
464
473
|
'本次调用要做什么(一句话,给用户看)。本会话「记忆范围」为普通限制时必填:审批范围外记忆时,弹窗会把它展示给用户。'
|
|
@@ -730,6 +739,7 @@ function resolveScope(
|
|
|
730
739
|
|
|
731
740
|
|
|
732
741
|
|
|
742
|
+
|
|
733
743
|
|
|
734
744
|
|
|
735
745
|
|
|
@@ -780,7 +790,7 @@ export function memorySaveTool(opts )
|
|
|
780
790
|
kind: { type: 'string', enum: ['fact', 'decision', 'preference', 'procedure', 'note', 'rule', 'state'] },
|
|
781
791
|
tags: { type: 'array', items: { type: 'string' } },
|
|
782
792
|
importance: { type: 'number', description: '0~1, higher = more important' },
|
|
783
|
-
supersedes: { type: 'string', description:
|
|
793
|
+
supersedes: { type: 'string', description: SUPERSEDES_PARAM_DESCRIPTION },
|
|
784
794
|
expiresAt: { type: 'number', description: '过期时间(毫秒时间戳)。kind=state 不传时按设置里的默认 TTL(7 天)' },
|
|
785
795
|
ttlMs: { type: 'number', description: '相对有效期(毫秒)。与 expiresAt 二选一,expiresAt 优先' },
|
|
786
796
|
triggers: { type: 'array', items: { type: 'string' }, description: '流程触发词(kind=procedure):工具名/关键词/路径;缺省用 tags' },
|