v0.1.2
dsh-diff-stat v0.1.2
Fourth release. The per-turn summary card now survives a session reload. The Web client opens every session on a tail page (the last 50 message boundaries), and a turn whose
turn/startlies outside that window used to publish nodiff-statturn data — the card silently vanished on older turns in production (short clean sessions were unaffected, which made it look environment-dependent). The accumulator now folds its engine matches — the same pattern the stock turn-tail uses — so a window-truncated turn publishes whatever the window holds, and older history pages enlarge the fold as they arrive.
Install / 安装
# from npm / 从 npm 安装
dsh plugin --profile web add dsh-diff-stat
# or from GitHub / 或从 GitHub 安装
dsh plugin --profile web add github:HaoyueQin/dsh-diff-statUninstall:
dsh plugin --profile web remove dsh-diff-statHighlights / 亮点
- Turn card survives window truncation: the conversation window loads only the last 50 message boundaries (
PAGE_MESSAGES), and a turn whose start is outside that window reached the accumulator with update matches only — the engine runs nostart/updatefor those, the definition's state stayed unset, andbuildLocationDatareturned null, so nodiff-statdata and no card.buildLocationDatanow folds the context's matches (the same best-effort pattern the stock turn-tail'stailDatauses), recovering the card for truncated turns; a call whosetool/callsettled outside the window cannot contribute, and prepending older pages enlarges the fold automatically. - One derivation, no drift: the engine's incremental
updatepath and the window fold share a singleapplyUpdateStatefunction, so both derive identical data by construction — no second state machine to keep in sync.
Fixes / 修复
- Window-truncated turns publish their card again: root edit/write turns reopened on a tail page (production norm: long sessions, page refresh, session reopen) previously showed no summary card while the tail row rendered empty (even the stock produced-files chip was data-starved). Root mutations accumulate as before; a windowed turn publishes whatever settled inside the window, in settlement order with the same seq filter.
- Empty-data turns stay uncarded: a turn with no change tool calls and no code dispatch still publishes empty facts, so the claim decision (and the stock fall-through) behaves exactly as before.
- Edge: residual events at the window start publish their own (partial) turn data, keyed by the event's authoritative turn field — never mislabeled.
Infrastructure / 基建
- No new check-script assertions: the fold lives in the module that value-imports the runtime (
isAppendSurfaceEvent), which the alignment check script cannot import directly (known limitation, §5-11). The fix is verified against real production sessions: the reported session's turn 1/2 cards restored, the PTC windowed turn restored, live turns unchanged, zero console errors. - Known boundary: a PTC turn whose
run_coderoot blocks were themselves window-truncated cannot join its dispatch sub-calls (the chat tool tree is truncated the same way); standard mode is fully recovered.
中文说明
第四个版本。本版修复了「轮末文件变更汇总卡在生产环境的历史轮次上不显示」的根因:Web 打开/刷新会话时只加载最后 50 条消息边界(PAGE_MESSAGES)作为窗口,窗口起点落在某轮 turn/start 之外时,累积器(diff-stat)只有该轮的 update 匹配、引擎不执行 start/update → context.state 缺省 → buildLocationData 返回 null → diff-stat turn data 不发布 → 轮末卡静默消失(干净短会话窗口覆盖全程,不受影响——所以此前表现得像「环境相关」)。修复后 buildLocationData 改为从 context 的 matches 折叠推导(与 stock turn-tail 的 tailData 同款模式):窗口裁剪的轮次也能发布窗口内推导的数据,上滚加载旧窗口时自动补全。
本次排查同时闭环了多轮实测:生产环境插件与本地构建逐字节一致(排除版本漂移)、R1 行内徽标始终正常(排除客户端加载)、live 抓包确认参数与 view 形态(排除数据形态问题)、浏览器 fiber 探针直接对比了修复前后 diff-stat turn data(UNDEF → 含真实 hunk)与卡片 DOM。
已知边界:①裁剪轮显示的是窗口内「尽力而为」的变更集合,工具调用配对在窗口外时无法补全;②PTC 历史轮若其 run_code 根块同样被窗口裁剪,卡依赖的工具树 join 为空(标准模式已完整恢复);③折叠逻辑位于含 runtime 值导入的模块,check 脚本无法直接覆盖(已记录,组件级测试为后续项)。