@restregular/dsh-memory 0.14.2 → 0.14.3

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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  本项目的版本记录。安装 id 与 npm 版本一一对应。
4
4
 
5
+ ## 0.14.3 — 轨迹行图标按滚动容器裁剪
6
+
7
+ - **根因**:行左侧的年轮图标是 `shell.overlay` 里的 `position:fixed` 元素,不受轨迹表格 `overflow` 裁剪。行滚到表头/工具栏上方后,它的 `getBoundingClientRect()` 仍可能落在浏览器视口内,图标就留在原地,看起来“超出范围还显示”。
8
+ - **修复**:用 `row.closest('[class*="_tablePane"]')` 的上下边界,再扣掉 sticky 表头(`thead.getBoundingClientRect().bottom`)作为可见界;行不完全落在界内就不渲染标记。选中行的「记忆 N」徽标同样做这个裁剪。
9
+ - 回归测试:表头上方的 call-3 即使有审计也不标记;完全可见的 call-1 正常标记。
10
+
5
11
  ## 0.14.2 — 修复轨迹 callId 解析,审计页签不再全空;行内有审计图标
6
12
 
7
13
  - **根因**:Trajectory 把 `trajectoryVirtualRecordKey()` 的结果写入 `data-trajectory-row-key`,而该函数会先 `encodeURIComponent`,DOM 上实际是 `tool%00call%00<callId>`。旧解析按原始 `\0call\0` 分隔符找,永远拿不到 callId,详情页签就用空锚点查询,所以无论点哪条记录都没有审计内容;行徽标也因此从不出现。现在先 `decodeURIComponent` 再解析,并剥掉 `\0summary\0<kind>` 后缀;未编码的旧格式也继续兼容。
package/README.md CHANGED
@@ -375,7 +375,7 @@ GET /memory/api/anchor?session=<id>&turn=<n>&step=<n>&callId=<optional>
375
375
 
376
376
  DSH 自带的 Trajectory 面板是一个**纯投影**:它只声明 `conversation.trajectory.images` 一个子槽,没有行/列扩展点,选中状态也只存在组件内部。因此插件不能直接往轨迹表格里插审计行。当前采用的是一条不碰轨迹 React 树的组合:
377
377
 
378
- - **轨迹 → 记忆审计**:Trajectory 的选中行带有 `data-trajectory-row-key`。注意它在 DOM 上经过 `encodeURIComponent`(工具行实际是 `tool%00call%00<callId>`),插件会先解码再取 callId。有审计的调用行左侧会显示产品年轮线条图标;选中行右侧另有「记忆 N」徽标,点击按 `op:<callId>` 打开审计。
378
+ - **轨迹 → 记忆审计**:Trajectory 的选中行带有 `data-trajectory-row-key`。注意它在 DOM 上经过 `encodeURIComponent`(工具行实际是 `tool%00call%00<callId>`),插件会先解码再取 callId。有审计的调用行左侧会显示产品年轮线条图标;选中行右侧另有「记忆 N」徽标,点击按 `op:<callId>` 打开审计。两者都会按轨迹滚动容器(扣除 sticky 表头)裁剪,行滚出可视区后不会残留。
379
379
  - **轨迹详情页签**:点击轨迹里的任意记录后,右侧详情面板的页签行会多出一个「记忆审计」页签(用 `shell.overlay` 贴着详情面板,不改轨迹的 React 树)。它展示该记录 callId 对应的审计事件,底部按钮直接打开本会话的记忆审计面板;没有 callId 的记录明确提示无法精确过滤。
380
380
  - **记忆审计 → 轨迹**:审计详情里的「在轨迹中定位」把条目上的 `operationId`(记忆工具调用、触发召回的工具调用)交给 Trajectory 的 `openView('trajectory', callId)`。没有 `operationId` 的按轮/步事件先请求 `/anchor`,由 Host 从会话事件窗口里找该 turn/step 的第一个 `tool/call`;找不到就只切到轨迹页,不伪造定位。
381
381
  - **会话内的「记忆」视图**:与 Chat / 轨迹同一个 view ring,按当前会话展示审计;它直接使用宿主传给每个 view 的 `openView`,因此跳转是官方支持路径。它声明 `data-conversation-composer-overlay` 让壳层压住外层滚动,审计列表在自己的滚动容器里滚动,外层界面不需要跟着滚。主面板不在 view ring 内,通过 `conversation.session` 注册的 per-session store 调同一个 action;拿不到时退化为打开会话/轨迹页。
package/lib/client.js CHANGED
@@ -2184,6 +2184,30 @@ window.__ModuleLoader__.load({
2184
2184
  }
2185
2185
  }
2186
2186
 
2187
+ /**
2188
+ * 轨迹行可见区域:表格滚动容器(`_tablePane`)的上下边界,再扣掉 sticky 表头。
2189
+ * fixed 定位的浮层不会被表格的 overflow 裁剪,所以必须自己做这个裁剪;
2190
+ * 否则行滚到表头/工具栏上方后,图标还会留在原地。
2191
+ */
2192
+ function trajectoryRowClip(row) {
2193
+ try {
2194
+ if (!row || typeof row.closest !== 'function') return null
2195
+ const pane = row.closest('[class*="_tablePane"]')
2196
+ if (!pane) return null
2197
+ const paneRect = pane.getBoundingClientRect()
2198
+ if (paneRect.height <= 0) return null
2199
+ const table = row.closest('table')
2200
+ const head = table && typeof table.querySelector === 'function' ? table.querySelector('thead') : null
2201
+ const headRect = head ? head.getBoundingClientRect() : null
2202
+ return {
2203
+ top: Math.max(paneRect.top, headRect ? headRect.bottom : paneRect.top),
2204
+ bottom: paneRect.bottom,
2205
+ }
2206
+ } catch {
2207
+ return null
2208
+ }
2209
+ }
2210
+
2187
2211
  /**
2188
2212
  * `conversation.session` 注册时把 per-session store 交给 slot 服务;服务把实例
2189
2213
  * 放在 `_stores` 的 handle 记录里,按 session id 解析。这是主面板唯一能拿到
@@ -3662,6 +3686,11 @@ window.__ModuleLoader__.load({
3662
3686
  return
3663
3687
  }
3664
3688
  const rect = row.getBoundingClientRect()
3689
+ const clip = trajectoryRowClip(row)
3690
+ if (clip !== null && (rect.top < clip.top - 0.5 || rect.bottom > clip.bottom + 0.5)) {
3691
+ setBadge(null)
3692
+ return
3693
+ }
3665
3694
  const position = {
3666
3695
  top: Math.max(4, rect.top + 4),
3667
3696
  left: Math.max(8, Math.min(window.innerWidth - 132, rect.right - 122)),
@@ -3750,18 +3779,22 @@ window.__ModuleLoader__.load({
3750
3779
  try {
3751
3780
  if (disposed || typeof document === 'undefined' || typeof window === 'undefined') return
3752
3781
  const sessionId = currentSessionId()
3753
- if (sessionId === undefined) { setMarks([]); return }
3782
+ if (sessionId === undefined) { setMarks((prev) => prev.length === 0 ? prev : []); return }
3754
3783
  const rows = [...document.querySelectorAll('tr[data-trajectory-row-key]')]
3755
- if (rows.length === 0) { setMarks([]); return }
3784
+ if (rows.length === 0) { setMarks((prev) => prev.length === 0 ? prev : []); return }
3756
3785
  const visible = new Map()
3757
3786
  for (const row of rows) {
3758
3787
  const callId = trajectoryRowCallId(row)
3759
3788
  if (callId === undefined) continue
3760
3789
  const rect = row.getBoundingClientRect()
3761
3790
  if (rect.bottom < 0 || rect.top > window.innerHeight || rect.height <= 0) continue
3791
+ // fixed 浮层不受表格 overflow 裁剪:行必须完整落在滚动容器(扣掉
3792
+ // sticky 表头)内,否则行滚到表头上方时图标会留在原地。
3793
+ const clip = trajectoryRowClip(row)
3794
+ if (clip !== null && (rect.top < clip.top - 0.5 || rect.bottom > clip.bottom + 0.5)) continue
3762
3795
  visible.set(callId, rect)
3763
3796
  }
3764
- if (visible.size === 0) { setMarks([]); return }
3797
+ if (visible.size === 0) { setMarks((prev) => prev.length === 0 ? prev : []); return }
3765
3798
  const cached = cacheRef.current.get(sessionId)
3766
3799
  const now = Date.now()
3767
3800
  if (cached && cached.pending === true) return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-memory",
3
- "version": "0.14.2",
3
+ "version": "0.14.3",
4
4
  "description": "DeepSeek Harness 记忆系统(单包单入口):JSONL 存储 + 本地向量检索(BGE-M3)+ 五个模型工具 + 自动召回注入 + 管理面板。",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",