DDDMUC/dsh-delete-turn 预览 preview

DDDMUC/dsh-delete-turn

Per-message delete for DeepSeek Harness: remove a user message, one reply step, or a whole assistant reply from the derived model context via the official surface-replace contract, and hide it from the visible transcript without rewriting the append-only log.

Project Overview项目介绍

dsh-delete-turn is a DeepSeek Harness (DSH) native plugin that adds per-message deletion on top of the host's append-only session log, since the only official tool for shedding old context is whole-range /compact. It is installed via dsh plugin --profile web add dsh-delete-turn (or a local link: path for development), and after install or update the user must fully restart the DSH process and hard-refresh the browser; loading can be verified with dsh --profile web --dump-config, which prints a # == dsh-delete-turn section. The plugin attaches delete actions to user rows, reasoning and tool cards, injected-context lines, failed turns, and to the official conversation.chat.assistant-actions slot on assistant replies.

In practice the user hovers a message row, clicks a trash icon at the row's tail (the assistant reply's button sits next to copy/fork in the official action strip), confirms a dialog that spells out exactly what will be hidden, and then watches the target row collapse while the model context is rebuilt on the next request without that content. The original session log bytes are never overwritten: the host half appends an official surfaceOp: { op: 'replace', startSeq, endSeq } event with sourceEventSeqs referencing the shadowed seqs, and the browser half then folds those seqs away using data-chat-flow-* anchors and the standard useChat snapshot, so the hidden ledger survives reloads, restarts, and tab switches because it is replayed from the log itself on every session open.

The host half carries zero runtime dependencies and resolves every service through the cordis context, falling back to a live session snapshot when sessionQuery is absent. Verified against DSH 0.1.6-alpha.2 and 0.1.7-alpha.2 on the web profile under both WebKit and Chromium, with both session formats v3 and v4 supported and the v4 migration to plugin:dsh-delete-turn source tags recognised. Limitations are explicit: there is no un-delete, the system-prompt head is protected, running turns refuse the action, and the assistant action strip deletes an entire reply attempt, so single steps must be removed via the reasoning or tool card. Released under MIT.

dsh-delete-turn 是面向 DeepSeek Harness(DSH)的官方生态原生插件,专注于在客户端提供「消息级删除」能力。它通过 dsh plugin --profile web add dsh-delete-turn 命令安装到宿主,安装或更新后必须完全重启 DSH 进程,浏览器端需要硬刷新页面,并通过 dsh --profile web --dump-config 输出中的 # == dsh-delete-turn 段落验证加载。插件在用户消息行、思考卡、工具卡、注入上下文行、失败回合行通过 DOM 增强补上删除入口,并在官方助手回复的 conversation.chat.assistant-actions 槽位挂载按钮。

典型工作流是:悬停任意消息行点击尾部垃圾桶按钮,弹出确认弹窗并显示影响范围,点击「删除」后目标行折叠退场,下一轮请求重建模型上下文时该内容不再出现。它适用于需要从 append-only 会话日志中精确剔除说错话、发错提示词或模型答偏内容的用户,同时保证原始会话字节不被改写。助手操作条删除整条回复,思考卡 / 工具卡只删对应步骤,二者通过 data-chat-flow-* 锚点和官方 useChat 快照定位。

宿主半区零运行时依赖,全部服务经 cordis ctx 解析,会话格式 v3 / v4 兼容,已实测 DSH 0.1.6-alpha.2 与 0.1.7-alpha.2。被遮蔽内容不可撤销,过程行不单独提供入口,系统提示词头受保护。许可证为 MIT。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add dsh-delete-turn

把 DDDMUC/dsh-delete-turn 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-delete-turn

DeepSeek Harness 消息删除插件 —— 把一条消息从模型上下文里真正拿掉,同时从当前转录里隐藏它。 助手回复挂在官方 conversation.chat.assistant-actions 槽位;用户消息、注入上下文与工具调用卡由 DOM 增强补上入口。确认后经官方 surface-replace 契约追加替换事件:模型后续看到的历史里不再有这条内容,而原始会话日志一个字节都不改写。

中文 · English


中文

用户消息行上的删除按钮
▲ 悬停消息行时出现的删除按钮(复制按钮右侧)

为什么需要它

DSH 的会话日志是 append-only 的:说错话、发错提示词、模型答偏了,这些内容会一直留在模型上下文里,污染后续每一轮。官方只提供了「压缩」(/compact)这种整段摘要机制,没有单条消息级别的删除。

这个插件把删除放回消息本身:

  • 用户消息 → 删这一条;
  • 思考卡 / 工具调用卡 → 删这一步(该步的 assistant/message 与它请求的 tool/result 一起走,工具配对永不悬空);
  • 助手回复(官方操作条)→ 删这条回复连同它的思考、工具调用与注入上下文(你的提问保留);
  • 注入上下文行、失败回合行 → 同样有删除入口。

特性

  • 模型上下文级删除 —— 追加一条官方 surfaceOp: { op: 'replace', startSeq, endSeq } 替换事件,被遮蔽的内容不再进入 deriveMessages();与宿主 /compact 同一套官方契约
  • 转录级隐藏 —— 客户端按 data-chat-flow-* 锚点与官方 useChat 快照定位行,删除后折叠退场;刷新、重启 DSH、换标签页后依旧隐藏
  • 日志即台账 —— 隐藏依据直接从日志里的替换事件重建(替换事件的消息 source 标记为本插件),不依赖 localStorage、不需要预检,也不会和其它插件(如压缩)的替换混淆
  • 原生视觉 —— 复用官方 primitives 的 Modal / Button 与主题 token,明暗主题自动适配;图标与全部文案为原创
  • 中英双语 —— 弹窗、提示、错误原因随系统语言即时切换
  • 安全边界 —— 只接受回环地址且 Host 为本机的请求;目标必须是当前 surface 节点、不能碰系统提示词头、回合进行中拒绝、已被删除的目标拒绝并给出机器原因码

截图

删除确认弹窗
▲ 删除前确认:说明影响范围,原始日志不改写

删除后该行消失
▲ 删除后:该行从转录中消失,后续内容自然上移

安装

# npm 安装(web profile)
dsh plugin --profile web add dsh-delete-turn

# 本地工作区(开发)
dsh plugin --profile web add link:/path/to/dsh-delete-turn

安装后需要完全重启 DSH 进程(宿主侧插件树只在启动时读取)。浏览器端 bundle 由宿主按请求动态 serve,重启后硬刷新页面即可生效。核实是否加载:

dsh --profile web --dump-config   # 应出现 "# == dsh-delete-turn" 段落

使用

  1. 悬停任意消息行,点击行尾的垃圾桶按钮;助手回复的按钮在官方操作条(复制 / 分叉旁边)。
  2. 确认弹窗会说明这次删除的影响范围,点「删除」。
  3. 目标行折叠退场;模型上下文在下一轮请求重建时不再包含它。

工作原理

UI(官方槽按钮 / DOM 增强按钮)
  → 确认弹窗
  → POST /dsh-delete-turn/delete { sessionId, mode, seq? / messageId? / turn? }
宿主:
  sessionQuery.readSession() 读完整日志(live 优先)
  自实现 surface fold → 当前 surface 节点 + 历史替换遮蔽集
  校验(当前节点 / 区间干净 / 回合已闭合 / 不碰系统头)
  session.append('user/message', 短标记占位, {
    surfaceOp: { op: 'replace', startSeq, endSeq },
    sourceEventSeqs: [被遮蔽的全部 seq],
  })
  等待官方 session/flush 持久化检查点
  → 返回 { hidden: [{ seq, mode }] }
客户端:
  useChat 快照把 data-chat-flow-key 映射到节点,按 hidden 集合折叠行
  GET /dsh-delete-turn/state 在每次打开会话时重建 hidden 集合

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev feishu-dsh-plugin 下一个 Next dsh-plugins →