@restregular/dsh-memory 0.14.6 → 0.14.7
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 +1 -2
- package/lib/inject/apply.js +18 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
本项目的版本记录。安装 id 与 npm 版本一一对应。
|
|
4
4
|
|
|
5
|
+
## 0.14.7 — memory_search / 无 description 的工具不再触发自动召回
|
|
6
|
+
|
|
7
|
+
- **根因**:`tool/call` 的高风险召回信号不看 `description` 是否存在,直接把工具名 + 参数拼进匹配文本。`memory_search` 的 `query` 一旦含标签(包括默认的记忆标签),就会排队一次 `before_high_risk_tool` 信号;下一步强制召回,和已经注入的摘要/正文重复。
|
|
8
|
+
- **修复**:只有带非空 `description` 的工具调用才允许触发高风险召回;`memory_*` 工具一律跳过(它本身就在读记忆)。工具失败信号保持原行为,不受此限制。
|
|
9
|
+
- 记忆工具调用仍保留一条 `stage: tool_call` 的审计锚点,只用于轨迹关联,**不会排队召回**。
|
|
10
|
+
- 回归测试:`memory_search`、无 `description` 的 `write` / `ops_bash` 都不产生 `signal_queued`;`memory_search` 的轨迹锚点仍在。
|
|
11
|
+
|
|
5
12
|
## 0.14.6 — 审计记忆 ID 跳转后自动展开并滚到目标记录
|
|
6
13
|
|
|
7
14
|
- **现象**:在审计详情里点某个记忆 ID,会切到记录页,但目标记录没有展开,看起来像没跳成功。
|
package/README.md
CHANGED
|
@@ -200,8 +200,7 @@ memory_forget({ "id": "3f2a9c1d" }) // 按内容删:memory_forget({ q
|
|
|
200
200
|
| 行为召回 | 可见文本 / 任务 / 命令 / 工具失败 | 命中标签后,在**下一个** `agent/pre-step` 定向检索;工具失败优先用该工具自己的 description |
|
|
201
201
|
|
|
202
202
|
行为召回只检索 **global + 当前会话 + 当前工作区**,不把自定义作用域或 fork 父会话带进来。
|
|
203
|
-
匹配源包括可见 assistant 文本、todo、`command/run`、`goal/change
|
|
204
|
-
name / description / 参数,以及工具失败描述;**不读取隐藏思维链**。
|
|
203
|
+
匹配源包括可见 assistant 文本、todo、`command/run`、`goal/change`、带 `description` 的 `tool/call`,以及工具失败描述;**没有 `description` 的工具调用不触发**,`memory_*` 工具一律不触发(`memory_search` 本身在取记忆,再召回一次只会重复注入)。**不读取隐藏思维链**。
|
|
205
204
|
|
|
206
205
|
### 规则会跟进旧会话
|
|
207
206
|
|
package/lib/inject/apply.js
CHANGED
|
@@ -413,20 +413,27 @@ export function apply(ctx , config = {}) {
|
|
|
413
413
|
const args = typeof data.arguments === 'string'
|
|
414
414
|
? data.arguments
|
|
415
415
|
: (() => { try { return JSON.stringify(data.arguments ?? '') } catch { return '' } })()
|
|
416
|
-
|
|
416
|
+
// 工具调用必须有显式的 description 才允许触发高风险召回:
|
|
417
|
+
// 没有 description 的工具(memory_search、memory_*、以及其它不带该字段的
|
|
418
|
+
// 工具)不应该因为参数/工具名里恰好出现标签就再注入一次记忆——尤其
|
|
419
|
+
// memory_search 本身就是取记忆,再触发一次会把摘要/正文重复塞进上下文。
|
|
420
|
+
const rawDescription = toolCallDescription(data.arguments)
|
|
421
|
+
const description = auto.useToolDescription ? rawDescription : undefined
|
|
417
422
|
rememberCallMeta(data.callId, tool, description)
|
|
418
423
|
const turn = typeof data.turn === 'number' ? data.turn : undefined
|
|
419
424
|
const step = typeof data.step === 'number' ? data.step : undefined
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
425
|
+
if (!MEMORY_TOOL_NAMES.has(tool) && rawDescription !== undefined && rawDescription !== '') {
|
|
426
|
+
observeSignal(sessionId, highRiskSignal(tool, args, {
|
|
427
|
+
tags,
|
|
428
|
+
...(description !== undefined ? { description } : {}),
|
|
429
|
+
...(callId !== undefined ? { callId } : {}),
|
|
430
|
+
useToolDescription: auto.useToolDescription,
|
|
431
|
+
maxQueryChars: auto.maxQueryChars,
|
|
432
|
+
}), {
|
|
433
|
+
...(turn !== undefined ? { turn } : {}),
|
|
434
|
+
...(step !== undefined ? { step } : {}),
|
|
435
|
+
})
|
|
436
|
+
}
|
|
430
437
|
return
|
|
431
438
|
}
|
|
432
439
|
if (type === 'tool/result') {
|