@restregular/dsh-memory 0.9.9 → 0.9.10
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.md +4 -0
- package/lib/tools/apply.js +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -349,6 +349,10 @@ tools/build-single-package.mjs 构建(产物契约检查 + 可选加载验证)
|
|
|
349
349
|
|
|
350
350
|
## 版本
|
|
351
351
|
|
|
352
|
+
- **0.9.10** —— 修复 `memory_get` 没有注册:
|
|
353
|
+
- `memoryTools()` 一直有 `memory_get` 的实现,但工具注册层漏了 `register(tools.memory_get, …)`,所以模型侧只能看到 save/search/forget/list 四个工具。
|
|
354
|
+
- 现在注册完整五个工具;`memory_get` 输出完整 id、作用域、类型、标签和全文,找不到的 id 单独列出。
|
|
355
|
+
- 新增静态守卫测试:`memoryTools` 里的每个工具都必须在 `apply.ts` 注册,防止再次“实现了但没注册”。
|
|
352
356
|
- **0.9.9** —— 收敛自动召回作用域与相关性:
|
|
353
357
|
- 自动召回只检索 **global + 当前会话 + 当前工作区** 三个标准作用域。
|
|
354
358
|
- 不再把 `inject.extraScopes` 的自定义作用域或 fork 父会话带进自动召回;普通每轮召回仍按原配置。
|
package/lib/tools/apply.js
CHANGED
|
@@ -120,6 +120,17 @@ export function apply(ctx , config = {}) {
|
|
|
120
120
|
const summary = scopeSummary(value, agent)
|
|
121
121
|
return summary ? `${body}\n${summary}` : body
|
|
122
122
|
})
|
|
123
|
+
|
|
124
|
+
register(tools.memory_get, (value, _args, exec) => {
|
|
125
|
+
const agent = (exec )?.agent
|
|
126
|
+
const body = value.records.map((r) => {
|
|
127
|
+
const tags = Array.isArray(r.tags) && r.tags.length > 0 ? ` · ${r.tags.join(', ')}` : ''
|
|
128
|
+
return `[${r.id}] (${renderScope(r.scope, agent)}/${r.kind}${tags})\n${r.content}`
|
|
129
|
+
}).join('\n\n')
|
|
130
|
+
const missing = value.missing.length > 0 ? `未找到:${value.missing.join(', ')}` : ''
|
|
131
|
+
if (body === '') return missing || '没有找到记忆。'
|
|
132
|
+
return missing === '' ? body : `${body}\n\n${missing}`
|
|
133
|
+
})
|
|
123
134
|
}
|
|
124
135
|
|
|
125
136
|
|