dsh-lite-memory 0.18.43 → 0.18.45

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/client.js CHANGED
@@ -1074,6 +1074,8 @@ window.__ModuleLoader__.load({
1074
1074
  return { id: room.id, name: room.name, items, total: items.length, pages: Math.max(1, Math.ceil(items.length / PALACE_PAGE_SIZE)) };
1075
1075
  });
1076
1076
  };
1077
+ /** 房间预览按内容铺:1 条就 1 个槽,不拿虚位占地方。 */
1078
+ const palaceSlotCountOf = (total) => Math.min(PALACE_PREVIEW, Math.max(1, Number.isFinite(total) ? Math.floor(total) : 0));
1077
1079
  const palaceRoomPageOf = (records, roomId, page) => {
1078
1080
  const room = palaceRoomsOf(records).find((row) => row.id === roomId);
1079
1081
  if (!room) return { items: EMPTY, total: 0, pages: 0, page: 1 };
@@ -2026,8 +2028,8 @@ window.__ModuleLoader__.load({
2026
2028
  const PalaceRoomCard = (props) => {
2027
2029
  const room = props.room;
2028
2030
  const empty = room.total === 0;
2029
- const preview = room.items.slice(0, PALACE_PREVIEW);
2030
- const slots = Array.from({ length: PALACE_PREVIEW }, (_, index) => preview[index] || null);
2031
+ const preview = room.items.slice(0, palaceSlotCountOf(room.total));
2032
+ const slots = Array.from({ length: palaceSlotCountOf(room.total) }, (_, index) => preview[index] || null);
2031
2033
  return h('div', {
2032
2034
  role: 'listitem',
2033
2035
  style: { ...PANEL_CARD, padding: 0, position: 'relative', overflow: 'hidden', display: 'flex', width: '100%', flexDirection: 'column' },
@@ -3100,7 +3102,7 @@ window.__ModuleLoader__.load({
3100
3102
 
3101
3103
  // 测试缝:Node 里验引用投影,浏览器里没有任何副作用。
3102
3104
  if (typeof globalThis.__LITE_MEMORY_TEST__ === 'function') {
3103
- globalThis.__LITE_MEMORY_TEST__({ metaOf, citationOf, citationsOfMeta, citationsOfTurn, dedupe, undoRefOf, graphOf, ruleGraphOf, processingStatusOf, currentBodyOf, historyDiffsOf, MemoryPanel, MemoryGraph, MemoryPalace, TurnMemory, RefSection, displayKeyOf, readDisplaySettings, writeDisplaySettings, graphViewOf, viewModeOf, filterRecords, projectionOf, failureStateOf, evidenceTextOf, evidenceMetaOf, palaceRoomsOf, palaceRoomPageOf, palacePageWindow, palaceToggleOf, palaceMotionOf, palaceRoomIdOf, refMetaOf, explainKeyOf, explainModeOf, setExplainMode, recallLineOf, agoLabel, checkupOf, refSectionRowsOf, refDetailTitleOf, versionLine, titleCountsOf, rowKeyOf, rowKeepFlags, Row, conflictVisibleRows, conflictFactsOf });
3105
+ globalThis.__LITE_MEMORY_TEST__({ metaOf, citationOf, citationsOfMeta, citationsOfTurn, dedupe, undoRefOf, graphOf, ruleGraphOf, processingStatusOf, currentBodyOf, historyDiffsOf, MemoryPanel, MemoryGraph, MemoryPalace, TurnMemory, RefSection, displayKeyOf, readDisplaySettings, writeDisplaySettings, graphViewOf, viewModeOf, filterRecords, projectionOf, failureStateOf, evidenceTextOf, evidenceMetaOf, palaceRoomsOf, palaceRoomPageOf, palaceSlotCountOf, palacePageWindow, palaceToggleOf, palaceMotionOf, palaceRoomIdOf, refMetaOf, explainKeyOf, explainModeOf, setExplainMode, recallLineOf, agoLabel, checkupOf, refSectionRowsOf, refDetailTitleOf, versionLine, titleCountsOf, rowKeyOf, rowKeepFlags, Row, conflictVisibleRows, conflictFactsOf });
3104
3106
  }
3105
3107
 
3106
3108
  return {
package/docs/BENCH.md CHANGED
@@ -75,3 +75,17 @@ npm run bench:evolution # 实验规则/样例/检查点/回执的存储与投
75
75
  ## 效果评测
76
76
 
77
77
  §17.4 的 2×2 防污染实验要跑真实模型、固定评分,不在 CI 里,也没有预填改善百分比。`test/scenario.test.mjs` 与 `bench/evolution.mjs` 只证明场景边界、读取条件和成本上限;不声称模型更聪明。GitHub 上的功能主张只对应这些确定性测试和本地性能数字,模型侧效果等实跑后再写。
78
+
79
+ ## 增删改后基线(0.18.43)
80
+
81
+ 回执上限 256→64、`hits` 改记真实交付后的同一台机器重跑(macOS arm64,Node v24.16.0):
82
+
83
+ | 指标 | 0.18.41 | 0.18.43 |
84
+ | --- | --- | --- |
85
+ | 热快照 P50 / P95 | 67.1 / 84.6 ms | 70.3 / 85.7 ms |
86
+ | 单次注入字节 | 368 B | 365 B |
87
+ | 2000 次操作后 `state.json` | 406 KB | 406 KB |
88
+ | 热点层回执条数上限 | 256(实测 35.7 KB) | 64(约 9 KB) |
89
+
90
+ P50 差值在同机噪音范围内(同一进程内 3 次中位数),注入字节与状态体积未增长;
91
+ `state.json` 仍远低于 2 MiB 上限。命令:`npm run bench`。
@@ -0,0 +1,21 @@
1
+ # 0.18.44 — npm 包里不再装测试
2
+
3
+ ## 变化
4
+
5
+ - `package.json` 的 `files` 加 `!test`:测试留在仓库、CI 与本地 `npm test` 照常跑,只是不随 npm 包发出去。
6
+ - 依据:装到 profile 里的插件只运行 `index.js` / `store.js` / `state.js` / `view.js` / `anchor.js` / `learning.js` / `client.js`;`test/` 有 600 KB 解包体积,装完从不执行。
7
+
8
+ ## 数字
9
+
10
+ | 指标 | 0.18.43 | 0.18.44 |
11
+ | --- | --- | --- |
12
+ | tarball | 377.6 KB | 249.4 KB |
13
+ | 解包 | 1.4 MB | 856.1 KB |
14
+ | 文件数 | 97 | 71 |
15
+
16
+ 运行时行为、状态格式、接口与注入字节全部不变;`npm run bench` / `bench:evolution` 不受影响。测试仍在仓库:`test/` 与 CI 一个文件没少。
17
+
18
+ ## 验证
19
+
20
+ - `npm test`:21 个套件全绿(改动只涉及发布文件清单)。
21
+ - `npm pack --dry-run`:71 个文件,249.4 KB,`test/` 不在清单里,`index.js`/`client.js` 等入口仍在。
@@ -0,0 +1,16 @@
1
+ # 0.18.45 — 宫殿房间按内容铺槽位
2
+
3
+ ## 变化
4
+
5
+ - 房间预览槽位从固定 4 个改成 `min(4, max(1, 条数))`:1 条记录的房间只占 1 个槽,不再用 3 个虚位撑满一行。
6
+ - 空房间行为不变:仍然显示「还没有记录」,房间固定四间、位置不变。
7
+ - 新增纯函数 `palaceSlotCountOf`,槽位数量可单测,不依赖渲染。
8
+
9
+ ## 为什么
10
+
11
+ ROADMAP R1 明写「房间宽高由内容决定,去掉无意义空地」。此前 1–3 条的房间会画 1–3 个 28% 透明度的虚线空槽,占 46px 高,读起来像没加载完。
12
+
13
+ ## 验证
14
+
15
+ - `test/client.test.mjs`:新增槽位数断言(0/1/3/4/40 五个边界),22 项通过。
16
+ - `npm test`:21 个套件全绿;`node --check client.js` 通过;UI 文案 lint 与改动前同计数(3 错 21 警,均为既有误报)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-lite-memory",
3
- "version": "0.18.43",
3
+ "version": "0.18.45",
4
4
  "description": "On-demand memory for the DeepSeek Harness: nothing resident, at most three small cards on a real hit, bodies read on demand.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -37,8 +37,8 @@
37
37
  "!docs/ha-audit.md",
38
38
  "!docs/ROADMAP.md",
39
39
  "LICENSE",
40
- "bench",
41
- "test"
40
+ "!test",
41
+ "bench"
42
42
  ],
43
43
  "dsh": {
44
44
  "bundle": {