dsh-layers-hippocampus 1.6.5 → 1.6.6
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 +14 -0
- package/index.js +17 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -39,6 +39,20 @@ and the project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
39
39
|
监听:`autoNewSession` 整链已在 1.6.3 删除,本次用测试把这条边界**锁死**——源码扫描
|
|
40
40
|
禁止出现 `uiWorkspace` / `startSession(` / `sessionStorage` / `appendMode` /
|
|
41
41
|
`onSlot(` / `slots.register(` / `ctx.slots =`。会话控制交给外部路由插件。
|
|
42
|
+
- **Fixed — 上下文在每轮请求里被悄悄缩水(“从 10% 直接掉到 7%”)**。1.6.4 的
|
|
43
|
+
`guardRequest` 在**每一次** `agent/request` 上都把宿主 `toolResultPruner.pruneSession()`
|
|
44
|
+
委托执行了一遍。两处都错:
|
|
45
|
+
- 宿主用的预算是 **预设自己的**(ptc: `thresholdChars 8192` → 留 4k 头 + 1k 尾),
|
|
46
|
+
于是一次普通的 20 KB 文件读取在下一次请求就被腰斩;
|
|
47
|
+
- 宿主自己只在 compaction-basic 的 `context-overflow` 分支里调它
|
|
48
|
+
(`this.ctx.get('toolResultPruner')?.pruneSession(agent.session)`),
|
|
49
|
+
「溢出时裁剪」被我们变成了「每一轮都裁剪」。实测一次 pass 可掉 **~80k tokens**。
|
|
50
|
+
现在 Live Compact **只跑我们自己的保守裁剪**:单条 `tool/result` 超过
|
|
51
|
+
`context.liveCompact.thresholdChars`(默认 200,000 字符)才指针化,头部 4k / 尾部 2k
|
|
52
|
+
原样保留、中间换成 `deep_raw` 可取回的指针行。健康的对话**永远不会被改写**——
|
|
53
|
+
宿主压缩链路的裁剪仍由宿主在真溢出时负责。
|
|
54
|
+
新增回归用例锁定:请求里即使注入了假 `toolResultPruner`,`pruneSession` 的调用次数也必须为 0,
|
|
55
|
+
且一条 20k 字符的正常结果不产生任何 surface 改写。
|
|
42
56
|
- **Tests**:新增 `test/v165.micokernel.test.js`(8 例):`/memory` 注册与全部子命令返回
|
|
43
57
|
纯文本、**网络调用数为 0**、静默真的不注入提示、`resume` 在无交接时明确报错且服务接口
|
|
44
58
|
与它同源、`executeDream()` 先跑月记并把日记标进 `promoted`、`maintain()` 不再产出月记、
|
package/index.js
CHANGED
|
@@ -796,26 +796,23 @@ export function createRuntime({ ctx = null, config, options, clock, raw = null,
|
|
|
796
796
|
runtime.guardRequest = async ({ agent = null, config: requestConfig = null, signal = null } = {}) => {
|
|
797
797
|
const session = agent?.session ?? null;
|
|
798
798
|
// ---- 1. Live Compact ---------------------------------------------------
|
|
799
|
+
// ONLY our own conservative pass, on OUR threshold (200k chars by default).
|
|
800
|
+
//
|
|
801
|
+
// v1.6.5: this used to delegate to the host's `toolResultPruner` on EVERY
|
|
802
|
+
// request, which was wrong twice over:
|
|
803
|
+
// - the host prunes with the PRESET's budget (ptc: 8192 chars -> 4k head +
|
|
804
|
+
// 1k tail), so an ordinary 20 KB file read was silently cut down on the
|
|
805
|
+
// very next request;
|
|
806
|
+
// - the host itself only calls `pruneSession` on the `context-overflow`
|
|
807
|
+
// trigger inside compaction-basic. Calling it per request turned "prune at
|
|
808
|
+
// overflow" into "shrink every single turn" — exactly the reported
|
|
809
|
+
// "context drops from 10% to 7% over and over".
|
|
810
|
+
// Our pointerization keeps head/tail plus a `deep_raw` recoverable pointer and
|
|
811
|
+
// only fires on a genuinely oversized single result, so a healthy conversation
|
|
812
|
+
// is never rewritten.
|
|
799
813
|
const liveConfig = runtime.config?.context?.liveCompact ?? {};
|
|
800
814
|
if (liveConfig.enabled !== false && session) {
|
|
801
|
-
|
|
802
|
-
// into the ptc preset). Delegate when present; only fall back to our own
|
|
803
|
-
// surface surgery when the host has no pruner at all.
|
|
804
|
-
const hostPruner = (() => {
|
|
805
|
-
try {
|
|
806
|
-
return ctx?.get?.('toolResultPruner') ?? null;
|
|
807
|
-
} catch {
|
|
808
|
-
return null;
|
|
809
|
-
}
|
|
810
|
-
})();
|
|
811
|
-
if (hostPruner && typeof hostPruner.pruneSession === 'function') {
|
|
812
|
-
try {
|
|
813
|
-
await hostPruner.pruneSession(session);
|
|
814
|
-
runtime.lastLiveCompact = { source: 'host', at: memory.clock.now() };
|
|
815
|
-
} catch (error) {
|
|
816
|
-
runtime.logger?.warn?.(`hippocampus: host live-compact failed: ${asMemoryError(error).code}`);
|
|
817
|
-
}
|
|
818
|
-
} else {
|
|
815
|
+
try {
|
|
819
816
|
runtime.lastLiveCompact = {
|
|
820
817
|
source: 'hippocampus',
|
|
821
818
|
at: memory.clock.now(),
|
|
@@ -827,6 +824,8 @@ export function createRuntime({ ctx = null, config, options, clock, raw = null,
|
|
|
827
824
|
logger: runtime.logger,
|
|
828
825
|
}),
|
|
829
826
|
};
|
|
827
|
+
} catch (error) {
|
|
828
|
+
runtime.logger?.warn?.(`hippocampus: live compact failed: ${asMemoryError(error).code}`);
|
|
830
829
|
}
|
|
831
830
|
}
|
|
832
831
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-layers-hippocampus",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Layered long-term memory for DeepSeek Harness: append-only event log, rebuildable tag index, day diaries, independent semantic layer, L2.5 trend quarantine, offline knowledge graph and a Web UI panel.",
|
|
6
6
|
"type": "module",
|