dsh-message-cleaner
DSH Web GUI 插件:在会话输入框上方提供历史消息记录面板,支持按条删除、原位恢复与内置节点导航条,让长会话的管理像编辑文档一样简单。
- Stars
- 1
- Language
- JavaScript
- Created
- Aug 25, 2026
- Updated
- Aug 25, 2026
Introduction
dsh-message-cleaner — 历史消息记录 / Conversation History
DSH Web GUI 插件:在会话输入框上方提供历史消息记录面板,支持按条删除、原位恢复与内置节点导航条,让长会话的管理像编辑文档一样简单。
A DSH Web GUI plugin that adds a conversation-history panel above the composer: per-exchange delete, in-place restore, and a built-in node rail.
English summary below · English
功能一览
| 功能 | 说明 |
|---|---|
| 📜 完整历史列表 | 列出会话中你发送的每一条消息(含未加载进当前窗口的更早历史),显示时间与文本预览;模型回复与工具调用归并为所属消息下的子记录,可展开查看 |
| 🔍 搜索与排序 | 关键字过滤;最新在前 / 最早在前切换 |
| 🎯 点击定位 | 点击条目滚动定位到对话中的该消息并高亮闪烁;未加载时自动翻页(最多 30 页) |
| 📋 复制 / ↑↓ 回溯 | 一键复制文本;输入框聚焦时按 ↑/↓ 在历史消息间回溯后重发 |
| 🗑 按条删除 | ✕ 两次确认删除:该消息与其模型回复(含工具链)一并移除,其他消息不受影响;已删除条目以删除线留档 |
| ↩ 原位恢复 | 已删除的交换回到原位置显示——原始时间戳、回合尾栏(时间 · 用时 · 首 token · tok/s)、产物芯片全部保留;模型上下文同步还原 |
| 🧭 内置节点导航条 | 对话流右侧悬浮药丸导航条:悬停预览、点击定位、滚轮逐条跳转、滚动跟随高亮、「加载更早历史」 |
删除与恢复如何保证会话完整性
- 删除采用与原生压缩相同的 surface 影子替换:只追加空内容墓碑事件(
surfaceOp: replace+ 完整溯源),日志只增不改;同时从对话视图与模型上下文中移除。 - 工具卡片锚定在
tool/call事件上,删除会连带隐藏其全部伴侣事件——中断回合没有结果的孤儿工具卡也不会残留。 - 恢复是双轨设计:
- 视图层翻转抑制——原始行从未离开日志,只是被 CSS 隐藏,恢复即原位重新显示;
- 模型上下文在日志尾部重放一个自带完整事件族的全新回合(turn 号避让、id/callId 一致性重写),绝不与原上下文合并冲突。
- 即使旧墓碑已被后续链式删除或原生压缩掩埋,沿引用链传递展开仍能找到原始事件——很早删除的消息同样可恢复。
安装
# 从 npm 安装(推荐,预构建免构建授权)
dsh plugin --profile web add @stone129/dsh-message-cleaner
# 从 GitHub 安装
dsh plugin --profile web add https://github.com/SsTtone1/dsh-message-cleaner
# 卸载
dsh plugin --profile web remove @stone129/dsh-message-cleaner
安装后重启 web profile 生效。
- 替代 dsh-history 时请先禁用/移除 dsh-history,避免两个面板并存。
- 本插件会自动覆写 @vlln/dsh-navbar 的导航条(该插件可保留安装,其导航条不再显示)。
使用
打开任意会话,点击输入框上方的「历史消息记录」栏展开面板:
- 点击条目 → 定位到对话中的消息;
▸N→ 展开该消息的回复与工具子记录;- ⧉ → 复制文本;✕ → 两次确认删除;↩ → 两次确认恢复已删除的交换;
- 输入框聚焦按 ↑/↓ 回溯历史草稿。
HTTP API(fenced,仅本机信任来源)
| 方法 | 路径 | 入参 | 说明 |
|---|---|---|---|
| POST | /fmc/api/list-messages | { sessionId } | 全量用户消息 + 视图抑制数据 + 可恢复删除组 |
| POST | /fmc/api/delete-messages | { sessionId, seqs } | 按条删除(每条含其模型回复);空选择拒绝 NO_SELECTION |
| POST | /fmc/api/restore-messages | { sessionId, tombstoneSeqs } | 恢复删除组:模型上下文重放 + 视图原位还原 |
会话运行中拒绝删除/恢复(BUSY);未激活会话仅可查看/定位(SESSION_NOT_LIVE)。
文件结构
lib/index.mjs Host 半:/fmc/api 路由 + 分析/交换解析/删除/恢复逻辑(零依赖)
lib/client.js Client 半:历史面板 + 内置节点导航条
cordis.patch.yml bundle 挂载声明
dsh.plugin.json DSH 插件清单(host/client 入口)
要求
- DSH ≥ 0.1.1(web profile)
- 无第三方运行时依赖(host 端零依赖,client 经 ModuleLoader 注入 react)
License
MIT
English
dsh-message-cleaner adds a conversation-history panel to the DSH web UI. It lists every message you sent (including history not yet loaded), with search, sorting, locate-and-flash navigation, copy, ↑/↓ draft recall, per-exchange delete, in-place restore, and a built-in node rail on the right side of the chat flow.
- Delete removes a message together with its whole exchange (model replies, tool calls/results) via the same surface shadow-replacement the native compaction uses — the append-only log stays intact while the record leaves both the view and the model context.
- Restore flips view suppression back so the original rows reappear at their original position with original timestamps and turn stats, and replays the exchange as a self-contained fresh turn at the log tail so the model regains the context.
- The built-in node rail replaces @vlln/dsh-navbar's rail: hover previews, click-to-locate, wheel stepping, scroll-follow highlight, windowed display, load-older button.
Install: dsh plugin --profile web add https://github.com/SsTtone1/dsh-message-cleaner, then restart the web profile.