dsh-lite-memory 0.18.44 → 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 {
@@ -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.44",
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",