dsh-layers-hippocampus 1.9.20 → 1.9.22
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 +41 -0
- package/index.js +44 -5
- package/package.json +1 -1
- package/src/context/windowGuard.js +27 -0
- package/ui/client.js +11 -18
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,47 @@ All notable changes to `dsh-layers-hippocampus` are documented here.
|
|
|
4
4
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
5
5
|
and the project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [1.9.22] — 2026-12-02
|
|
8
|
+
|
|
9
|
+
**侧栏图标又变回按钮了:直接 `register` 在冷启动时会被丢掉。**
|
|
10
|
+
|
|
11
|
+
重启 DSH 之后(新进程、新端口),实时槽位树里 `sidebar.panellist` 的 8 个占用者中**没有**
|
|
12
|
+
`hippocampus-panel`,footer 的「记忆」按钮又出现了 —— 说明那对入口这次根本没注册上。
|
|
13
|
+
|
|
14
|
+
原因:1.9.17 把成对注册改成了**直接 `slots.register`**(当时的依据是 `main` 占用者显示
|
|
15
|
+
`active:false`,误判成 inject 包装回收了注册)。直接注册在 `apply()` 里立即执行,而声明这两个
|
|
16
|
+
座位的 factory 在冷启动时还没实例化 → 注册进了一个尚不存在的座位,被静默丢弃。而
|
|
17
|
+
`slots.inject(key, cb)` 的全部意义就是**等座位出现再回调**,dsh-context 与
|
|
18
|
+
dsh-plugin-tool-management 都是这么写的,它们的占用者长期 `active:true`。
|
|
19
|
+
|
|
20
|
+
- **Fixed**:`main` + `sidebar.panellist` 回到 `mount()`(inject 包装),删除 `mountDirect`。
|
|
21
|
+
昨天那个 `active:false` 的真因是面板抛错(#310,已在 1.9.20 修复),不是 inject。
|
|
22
|
+
- **Tests**:`clientSlot`/`v150.ui` 的注入清单回到 6 条;`v1102.seats` 增加
|
|
23
|
+
「不得存在 mountDirect 直注册路径」断言。全套 **750/750**。
|
|
24
|
+
|
|
25
|
+
## [1.9.21] — 2026-12-01
|
|
26
|
+
|
|
27
|
+
**宿主报了两个窗口,谁小听谁的(这次是 262,144 赢了 1,048,576)。**
|
|
28
|
+
|
|
29
|
+
一次真实的拒绝(我们的本地 fail-fast,不是 provider 收费后才报):
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
request does not fit the model window: 449021 tokens (prompt 417021 + reserved 32000)
|
|
33
|
+
>= 262144 (window source: host)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
而同一时刻 `/stats` 报的是 `nativeTokenLimit: 1048576`。同一个宿主,两套窗口:
|
|
37
|
+
`llm.resolveModelInfo().context.contextWindow` 说 1M,请求守卫按 256k 执行——**被执行的永远是
|
|
38
|
+
小的那个**。旧代码把先答的那个(resolveModelInfo)钉死,`tokenMeter.contextPressure().contextWindow`
|
|
39
|
+
只在"没人答"时当兜底,于是插件按 40% 算、永不交接,会话一路涨到 418k 才在门口炸掉。
|
|
40
|
+
|
|
41
|
+
- **Fixed**:`windowGuard.pickWindow()` 收集本次请求里所有窗口候选(model-info / token-meter),
|
|
42
|
+
**取最小**;`resolveWindow` 只负责命名来源。两个 surfaces 再打架也不会乐观。
|
|
43
|
+
- **Observable**:`MEM_E_CONTEXT_EXCEEDED` 的 details 现在带 `windowCandidates`
|
|
44
|
+
(每个数字 + 来源),下次现场直接能看出是谁在说 1M。
|
|
45
|
+
- **Tests**:新增 `test/v1921.window.test.js` 4 例(最小者胜、顺序无关、垃圾值忽略、全无则返回 null)。
|
|
46
|
+
全套 **750/750**。
|
|
47
|
+
|
|
7
48
|
## [1.9.20] — 2026-12-01
|
|
8
49
|
|
|
9
50
|
**真正的根因:`useLayers` 在提前 return 之后才调用 → React #310 → 宿主卸载面板。**
|
package/index.js
CHANGED
|
@@ -45,7 +45,7 @@ import { isLowValley, nextLowValleyStart, windowInfo } from './src/priceWindow.j
|
|
|
45
45
|
import { DreamTimer } from './src/dreamTimer.js';
|
|
46
46
|
import { probeCompression, resolveEngine } from './src/compression.js';
|
|
47
47
|
import { LIVE_COMPACT_DEFAULTS, liveCompactSession } from './src/context/liveCompact.js';
|
|
48
|
-
import { FOLD_HARD_STOP_RATIO, foldBlocked } from './src/context/windowGuard.js';
|
|
48
|
+
import { FOLD_HARD_STOP_RATIO, foldBlocked, pickWindow } from './src/context/windowGuard.js';
|
|
49
49
|
import { createHandoffCoordinator, FORCE, HANDOFF_STATUS } from './src/handoff/coordinator.js';
|
|
50
50
|
import { deliverNotice } from './src/handoff/notice.js';
|
|
51
51
|
import { decideOwnership, OWNERSHIP_MODE } from './src/context/ownership.js';
|
|
@@ -86,7 +86,7 @@ export { resolveConfig, DEFAULT_CONFIG };
|
|
|
86
86
|
* of letting a raw 404 reach the user.
|
|
87
87
|
*/
|
|
88
88
|
export const CAPABILITIES = Object.freeze({
|
|
89
|
-
version: '1.9.
|
|
89
|
+
version: '1.9.22',
|
|
90
90
|
spaces: true,
|
|
91
91
|
memories: true,
|
|
92
92
|
transferConsent: true,
|
|
@@ -250,6 +250,32 @@ export function createRuntime({ ctx = null, config, options, clock, raw = null,
|
|
|
250
250
|
getReservedTokens: () => hostProbes.reservedTokens,
|
|
251
251
|
},
|
|
252
252
|
});
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* v1.9.21: the host exposes MORE THAN ONE window and they disagree.
|
|
256
|
+
*
|
|
257
|
+
* 2026-12-01: `llm.resolveModelInfo()` said 1,048,576 for the live model while the
|
|
258
|
+
* provider's request guard refused the same request at 262,144 — and it was the
|
|
259
|
+
* SMALLER number that was enforced. The old code locked in whichever surface
|
|
260
|
+
* answered first and used `tokenMeter.contextPressure().contextWindow` only as a
|
|
261
|
+
* fallback, so the plugin measured 40% of a window it did not have, never handed
|
|
262
|
+
* over, and every turn died at the provider.
|
|
263
|
+
*
|
|
264
|
+
* Every candidate seen during THIS request is recorded, and the smallest wins.
|
|
265
|
+
*/
|
|
266
|
+
const hostWindowCandidates = new Map();
|
|
267
|
+
const noteWindow = ({ provider = null, model = null, window = null, source = 'host' } = {}) => {
|
|
268
|
+
const value = Number(window);
|
|
269
|
+
if (!Number.isFinite(value) || value <= 0) return;
|
|
270
|
+
hostWindowCandidates.set(`${source}:${provider ?? '*'}:${model ?? '*'}`, {
|
|
271
|
+
source,
|
|
272
|
+
provider,
|
|
273
|
+
model,
|
|
274
|
+
window: Math.round(value),
|
|
275
|
+
});
|
|
276
|
+
const best = pickWindow([...hostWindowCandidates.values()]);
|
|
277
|
+
if (best) hostProbes.window = { ...best, candidates: [...hostWindowCandidates.values()] };
|
|
278
|
+
};
|
|
253
279
|
options = withHostProbes(options);
|
|
254
280
|
// v1.5.6 physical split: multi-space lives in dsh-orchestrator. `orchestrator` is a
|
|
255
281
|
// test/embedding override; the Host supplies the real service through `ctx.get`.
|
|
@@ -1457,6 +1483,7 @@ export function createRuntime({ ctx = null, config, options, clock, raw = null,
|
|
|
1457
1483
|
// only fires on a genuinely oversized single result, so a healthy conversation
|
|
1458
1484
|
// is never rewritten.
|
|
1459
1485
|
// ---- 2. refresh the probes --------------------------------------------
|
|
1486
|
+
hostWindowCandidates.clear();
|
|
1460
1487
|
const provider = requestConfig?.provider ?? null;
|
|
1461
1488
|
const model = requestConfig?.model ?? null;
|
|
1462
1489
|
const reserved = Number.isFinite(requestConfig?.maxTokens) ? requestConfig.maxTokens : null;
|
|
@@ -1473,7 +1500,9 @@ export function createRuntime({ ctx = null, config, options, clock, raw = null,
|
|
|
1473
1500
|
const info = await llm.resolveModelInfo(provider, model, signal ?? undefined);
|
|
1474
1501
|
const window = info?.context?.contextWindow ?? null;
|
|
1475
1502
|
if (Number.isFinite(window) && window > 0) {
|
|
1476
|
-
|
|
1503
|
+
// v1.9.21: a CANDIDATE, not the answer — the provider's request guard may
|
|
1504
|
+
// enforce something smaller (see noteWindow).
|
|
1505
|
+
noteWindow({ provider, model, window, source: 'model-info' });
|
|
1477
1506
|
}
|
|
1478
1507
|
if (Number.isFinite(info?.defaultMaxTokens)) {
|
|
1479
1508
|
// The adapter's own default is what an unspecified request asks for.
|
|
@@ -1500,8 +1529,16 @@ export function createRuntime({ ctx = null, config, options, clock, raw = null,
|
|
|
1500
1529
|
// let 854k tokens look small.
|
|
1501
1530
|
const candidates = [pressure.pressureTokens, pressure.projectedTokens].filter((value) => Number.isFinite(value));
|
|
1502
1531
|
if (candidates.length > 0) hostProbes.usedTokens = Math.max(...candidates);
|
|
1503
|
-
if (Number.isFinite(pressure.contextWindow) && pressure.contextWindow > 0
|
|
1504
|
-
|
|
1532
|
+
if (Number.isFinite(pressure.contextWindow) && pressure.contextWindow > 0) {
|
|
1533
|
+
// v1.9.21: this surface is the one the host's own request guard enforces, so
|
|
1534
|
+
// it must be able to LOWER the window (it used to be consulted only when
|
|
1535
|
+
// nothing else had answered, which is exactly backwards).
|
|
1536
|
+
noteWindow({
|
|
1537
|
+
provider: provider ?? 'host',
|
|
1538
|
+
model: model ?? 'host',
|
|
1539
|
+
window: pressure.contextWindow,
|
|
1540
|
+
source: 'token-meter',
|
|
1541
|
+
});
|
|
1505
1542
|
}
|
|
1506
1543
|
} catch (error) {
|
|
1507
1544
|
hostProbes.lastError = asMemoryError(error).code;
|
|
@@ -1777,6 +1814,8 @@ export function createRuntime({ ctx = null, config, options, clock, raw = null,
|
|
|
1777
1814
|
projectedTokens: state.projectedTokens,
|
|
1778
1815
|
window: state.nativeTokenLimit,
|
|
1779
1816
|
windowSource: state.windowSource,
|
|
1817
|
+
// v1.9.21: every window the host reported for THIS request, smallest one used.
|
|
1818
|
+
windowCandidates: hostProbes.window?.candidates ?? null,
|
|
1780
1819
|
ratio: state.ratio,
|
|
1781
1820
|
handoff: handoff?.handoff?.summaryEventId ?? null,
|
|
1782
1821
|
liveCompact: runtime.lastLiveCompact ?? null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-layers-hippocampus",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.22",
|
|
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",
|
|
@@ -84,6 +84,33 @@ function positive(value) {
|
|
|
84
84
|
return Number.isFinite(value) && value > 0 ? Math.round(value) : null;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* v1.9.21: the host has SEVERAL window surfaces, and they can disagree.
|
|
89
|
+
*
|
|
90
|
+
* 2026-12-01: `llm.resolveModelInfo()` advertised 1,048,576 for the live model while
|
|
91
|
+
* the provider's own request guard refused the same request at 262,144
|
|
92
|
+
* ("request does not fit the model window … window source: host"). The plugin
|
|
93
|
+
* measured 418k / 1,048,576 = 40% and never handed over; every turn was rejected.
|
|
94
|
+
*
|
|
95
|
+
* The rule is therefore: never assume more room than the SMALLEST number any host
|
|
96
|
+
* surface reports. `resolveWindow` still names the winner; this picks the numbers.
|
|
97
|
+
*
|
|
98
|
+
* @param {Array<{source?: string, provider?: string|null, model?: string|null, window?: number}>} candidates
|
|
99
|
+
* @returns {{source?: string, provider?: string|null, model?: string|null, window: number}|null}
|
|
100
|
+
*/
|
|
101
|
+
export function pickWindow(candidates) {
|
|
102
|
+
const valid = (Array.isArray(candidates) ? candidates : [])
|
|
103
|
+
.map((entry) => ({
|
|
104
|
+
source: entry?.source ?? 'host',
|
|
105
|
+
provider: entry?.provider ?? null,
|
|
106
|
+
model: entry?.model ?? null,
|
|
107
|
+
window: positive(entry?.window),
|
|
108
|
+
}))
|
|
109
|
+
.filter((entry) => entry.window !== null);
|
|
110
|
+
if (valid.length === 0) return null;
|
|
111
|
+
return valid.reduce((best, entry) => (entry.window < best.window ? entry : best), valid[0]);
|
|
112
|
+
}
|
|
113
|
+
|
|
87
114
|
function clampCount(value) {
|
|
88
115
|
return Number.isFinite(value) && value > 0 ? Math.round(value) : 0;
|
|
89
116
|
}
|
package/ui/client.js
CHANGED
|
@@ -5719,22 +5719,15 @@ h(
|
|
|
5719
5719
|
}
|
|
5720
5720
|
};
|
|
5721
5721
|
|
|
5722
|
-
// v1.9.
|
|
5723
|
-
//
|
|
5724
|
-
//
|
|
5725
|
-
//
|
|
5726
|
-
//
|
|
5727
|
-
//
|
|
5728
|
-
//
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
if (typeof slots.register !== 'function') return;
|
|
5732
|
-
slots.register({ name, ...options }, component);
|
|
5733
|
-
} catch (error) {
|
|
5734
|
-
report(`register ${name}`, error);
|
|
5735
|
-
}
|
|
5736
|
-
};
|
|
5737
|
-
|
|
5722
|
+
// v1.9.22: BOTH halves go through `slots.inject`, exactly like
|
|
5723
|
+
// dsh-context and dsh-plugin-tool-management. v1.9.17 switched to a direct
|
|
5724
|
+
// `slots.register` because a `main` occupant came back `active:false`; that
|
|
5725
|
+
// reading was a symptom of the panel THROWING (#310), not of the inject
|
|
5726
|
+
// wrapper. A direct registration runs before the shell has instantiated the
|
|
5727
|
+
// factory that declares these seats, so on a cold boot the entries were
|
|
5728
|
+
// dropped entirely — the sidebar went back to a footer button. `inject`
|
|
5729
|
+
// defers until the seat exists, which is the whole point of the API.
|
|
5730
|
+
//
|
|
5738
5731
|
// Every seat below was verified live through
|
|
5739
5732
|
// `cordis_inspect_query(client, Slots, listSubTree)` — and the list is
|
|
5740
5733
|
// pinned by `test/v1102.seats.test.js`, because a seat name is an open
|
|
@@ -5745,8 +5738,8 @@ h(
|
|
|
5745
5738
|
// sidebar.footer.action fallback entry (hides once the icon renders)
|
|
5746
5739
|
// shell.overlay the fallback sheet that entry opens
|
|
5747
5740
|
// settings.section the settings page
|
|
5748
|
-
|
|
5749
|
-
|
|
5741
|
+
mount('main', { key: MEMORY_PANEL_ID }, MemoryPanelHost);
|
|
5742
|
+
mount('sidebar.panellist', { id: MEMORY_PANEL_ID, order: 60, label: '海马体记忆' }, MemoryPanelIcon);
|
|
5750
5743
|
mount('sidebar.footer.action', { id: 'hippocampus-resume', order: 31, label: '续接' }, SidebarResumeButton);
|
|
5751
5744
|
mount('sidebar.footer.action', { id: 'hippocampus-open', order: 30, label: '海马体记忆' }, SidebarMemoryAction);
|
|
5752
5745
|
mount('shell.overlay', { id: 'hippocampus-overlay', order: 30, label: '海马体记忆' }, MemoryOverlay);
|