XSJUSTC/dsh-rewind 预览 preview

XSJUSTC/dsh-rewind

Plugin插件 Native原生 ⭐ 10 MIT Sessions & Context会话与上下文

DSH(DeepSeek Harness)对话回退插件——回退至任意用户消息,中断正在进行的回合,从聊天视图和模型上下文中隐藏尾部内容,发送前可自由取消。

Project Overview项目介绍

This is a native session rollback plugin built exclusively for DeepSeek Harness (DSH), designed to manage chat session context by rolling back the conversation to any point before a selected user message. It adds a rollback button to the action bar of every user message; when clicked, it immediately interrupts any ongoing model output, hides the target message and all subsequent content, and places the original message text into the editable input box. The model will only process the conversation history from before the rollback point, and users can cancel the rollback operation before sending a new message.

The plugin is targeted at DSH users who frequently adjust chat prompts, correct incorrect inputs, or test different interaction paths. A common use case is when a user spots an input error or wants to revise a prompt after receiving a model response: they just click the rollback button on the target user message, edit the prompt, and send it again. The plugin handles context truncation automatically, and the model generates new output based on the rolled-back history, making it much easier to manage long conversations that require repeated adjustments.

The plugin has no external npm dependencies and requires no build steps to run. Version 2.2.0 officially supports DSH 0.1.5-rc.2, and maintains compatibility with all earlier 0.1.x versions of DSH. To install, users clone the repository to their local machine, run the command dsh plugin --profile web add <absolute path of the cloned repo>, then restart the DSH process and refresh their browser page. It is open sourced under the MIT license, and rollback states are preserved across process restarts without modifying the original session log.

这是一个专为 DeepSeek Harness(DSH)开发的原生会话回退插件,用来管理聊天会话上下文,支持将会话回退到任意用户消息之前的状态。插件会在每条用户消息的操作栏添加回退按钮,点击后可打断正在输出的模型,隐藏目标消息及之后所有内容,将原消息文本填入可编辑的输入框,让模型只处理回退点之前的历史上下文。还支持在发送新内容前取消回退操作,恢复隐藏内容。

这款插件面向需要频繁调整对话提示、修正错误输入或者测试不同交互路径的 DSH 用户。典型工作流是:当你发现输入有误,或是在得到模型回复后想要修改提示词,只需点击目标用户消息旁的回退按钮,插件会自动完成上下文截断和内容整理,你编辑好提示词后重新发送即可,模型会基于回退后的历史生成新输出。对于需要反复调试的长对话场景,这款插件能大幅提升管理会话的效率。

该插件零外部依赖,无需构建步骤,当前 2.2.0 版本实测支持 DSH 0.1.5-rc.2,同时兼容 0.1.x 所有早期版本。安装方式为克隆仓库后,执行 dsh plugin --profile web add <仓库绝对路径>,之后重启 DSH 进程并刷新浏览器页面即可使用。它采用 MIT 许可证开源,回退状态会记录在会话日志中,进程重启后也能正确恢复,不会修改原始会话日志。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 note1 项提示
  • 10 stars - an early-stage project星标 10,属于早期项目
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 github:XSJUSTC/dsh-rewind

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

READMEREADME

@xsj/dsh-rewind

English | 简体中文

DSH(DeepSeek Harness)会话回退插件。永久 bundle 插件:宿主机半 + Web 客户端半,零依赖、零构建步骤。

功能

  • 每条用户消息的操作行(复制图标旁)出现 ↺ 回退 图标。点击后:
    • 若模型正在思考/输出,立即打断当前回合;
    • 该消息及其后的所有内容在聊天视图中隐藏(如同从未发生);
    • 该消息文本自动填入输入框,未发送、可编辑;
    • 该消息携带的图片也会重新挂回输入框(从会话日志读回原始字节,走官方附件入档流程,自动套用图片数量/大小限制);
    • 下一次发送时,模型只看到截断后的历史(回退点之前)+ 新消息。
  • 回退待发送期间:
    • 输入框上方出现提示横幅;
    • 发送按钮左侧出现 ✕「取消回溯」:点击后恢复被隐藏的消息,草稿保持不变,不发送任何内容。
  • 发送后(回退生效):被隐藏的消息永远不再出现在聊天视图,也不再进入模型上下文。
  • 仅用户消息可回退;DSH(助手)消息没有回退入口(Host 侧强制校验事件类型)。

版本兼容性

  • v2.4.0 实测支持 dsh 0.1.5-rc.2,并保留对 0.1.x 早期版本的兼容——事件流读取优先官方 snapshotEvents() / eventAt(),旧宿主自动回退 session.events。
  • v2.4.0 修复「模型输出没有被隐藏」(本版主要修复):
    • 成因:本插件只接管了 conversation.chat.node 的 user / steering 两个渲染器,因此只有这两类行会被打上 data-xsj-seq 标记;模型的 assistant-step 输出、工具调用、context 等行走官方渲染器,从来没有标记。此前隐藏判定对未标记的行一律「不隐藏」,于是提交区间后只藏住了提问、回答仍然留在屏幕上。
    • 修法:未标记的行不再被放弃,而是按 DOM 顺序从前一条已标记行继承判定——它属于其所跟随的那一轮。仅对「前面完全没有证据」的前导行才回退到后方证据。这个前向归属是必须的:若改成「后面有隐藏就算隐藏」,区间上方那条回答会被误藏(开发过程中确实踩到,已由 test/hiding.test.mjs 覆盖)。
    • 驱动卸载时还原 DOM:隐藏是直接写 DOM 的,此前 teardown 只清定时器与 observer。切换会话或 composer 重挂载会把隐藏行留给下一个视图(凭空出现空白行)。现在 teardown 会释放所有带本插件标记的行,且只释放这些行,不影响其他特性设置的 display。
    • 区分「没数据」与「没有区间」:冷加载(刷新 / 切会话)时驱动先于 /state 返回而运行,此前二者无法区分,导致每次加载都会闪现已被回退掉的尾巴;若 /state 请求失败,则永久保持可见——界面看到的消息模型其实看不见。现在按会话记录 fetched / fetchFailed:未拿到答复时保持当前判定不动并重试,拿到后才据实隐藏;本地刚记录下的 mark 仍会立即生效。
    • Host:agent/disposed 不再泄漏补丁:ensurePatched 会在 session 实例上装一个闭包了 st.ranges 的 deriveMessages 覆盖,而 disposed 此前直接丢弃状态记录,使该覆盖无人可解——会话会永久继续按已回退的区间过滤模型上下文,且跨插件重载存活。现在与 evictIfNeeded 同规则,先解挂再丢弃。
    • ensurePatched 改为自愈:不再只信 st.patched 标志,而是比对实际安装的方法与记录的包装器,不一致就重新安装(幂等),避免标志与实际脱节后静默停止对模型隐藏。
    • 图片引用只缓存命中结果:引用一旦进入 append-only 日志就不会消失,命中可长期有效;未命中则不然——缓存未命中会让 /image 对一个日志里确实存在的 id 返回 404,表现为回退时图片被静默丢弃。
  • v2.3.0 变更:
    • 回退时同步回填图片:Host 半新增 /api/xsj-rewind/image 端点,依 attachmentId 从会话日志读回原始字节;客户端构造成 File 后通过 composer 的隐藏文件输入重新入档,自动触发官方的图片数量/大小校验。
    • 修复图片消息的连锁渲染崩溃:@deepseek-ai/dsh-client-ui-attachment 客户端半在 0.1.5-rc.2 只导出 apply/inject(不再有 ImageGallery 组件),此前引用它会让含图片的用户消息抛错,并被 React 错误边界放大到前后相邻的整片消息(表现为大范围回退按钮消失)。现改用官方同款 renderMessageImages prop(路由到 conversation.message.images 槽位)。
    • 加固槽位注册:slots 服务改为防御性获取并逐席位 try/catch。此前任一次注册冲突(如客户端 HMR 重载竞态)都会中断整个 apply(),导致「样式已注入但渲染器全丢」。
    • DOM 隐藏驱动更保守:未打戳的行不继承相邻行的隐藏判定,避免刚发送的消息在打戳完成前被误隐藏。(v2.4.0 修正:该保守策略同时导致模型输出永远不被隐藏,见上方 v2.4.0 说明。)
    • 图片回填串行化:多次回退不再争用同一个文件输入。
    • Host 半的 attachments 服务改为运行时解析(ctx.get),缺少附件 provider 时插件仍能正常挂载,仅图片端点降级返回 501。
    • 资源上限:会话状态表、图片引用缓存均设有容量上限;图片响应与 attachmentId 长度增加校验。
  • v2.2.0 变更:
    • 适配 0.1.5-rc.2:primitives.MessageText 已被移除,用户气泡文本改用与官方相同的 projectUserText() 渲染(自动获得 @引用/会话 chip 高亮);
    • 客户端 inject 声明更新:移除已废弃的 @deepseek-ai/dsh-client-runtime;
    • 清理冗余与调试残留代码(调试日志、无效的 fuzzy 会话解析、两处死代码)。
  • 旧版(≤2.1.2)在 dsh 0.1.5-rc.2 上的已知症状:用户消息行渲染崩溃、回退按钮不出现——请升级到 ≥2.3.0。

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

← 上一个 Prev dsh-claude 下一个 Next dsh-budget →