DSH Plugins Marketplace

DSH Plugins

Plugins

/

dsh-timefold

s

dsh-timefold

Manifest valid

DSH Session Rollback + File Snapshot Plugin: fork rollback, shadow git restore, complete message action bar (copy/rollback/edit/rerun/delete). Compatible with DSH 0.2.2-rc.x

UI (client)hasBundlePatchMachine translated

dsh-timefold

DSH(DeepSeek Harness)的会话回退 + 文件快照插件。给每条你发过的消息加一个回退按钮:对话分叉回去,工作区文件也回到那一刻。

面向 DSH 0.2.2-rc.x,macOS / Windows 均可。

它解决的问题

DSH 自带的消息撤回只处理对话,不碰文件。市面上的两个方案各有短板:

对话回退文件回退回填输入框原会话保留
dsh-rewind-plugin原地 replace只认记录到的编辑✗ 有 bug✗
dsh-recall-pluginfork✅ 影子 git 快照✅✅
dsh-timefoldfork✅ 影子 git 快照✅ 且失败可见✅

本项目 fork 自 dsh-recall-plugin 2.6.7,吸收了 dsh-rewind 的交互思路,并修掉两者已知缺陷。

功能

每条你自己发的消息下方,鼠标悬停出现操作行:

按钮作用
⏱ 时间消息发送时刻
⧉ 复制复制消息正文
↶ 回退选择「回退文件与对话」或「仅回退对话」,fork 出新分支
✎ 编辑就地改写后重新发送(不动文件)
↻ 重跑回到消息之前并立即重发原文(文件和对话一起回退)
✕ 删除回到消息之前,草稿留空不发送

所有回退都是 fork:原会话保留为父分支,随时可切回,不是真删。

文件为什么能完整还原

每条消息发送时,工作区被快照进一个独立的影子 git 仓库(--git-dir / --work-tree 分离,完全不碰项目自身的 .git)。

这比「记录工具调用事件」强的地方在于:不管文件是被 write、edit 改的,还是被 bash 里的 mv/cp/sed -i、IDE 手动保存、甚至别的进程改的,只要在快照时刻之后变过,都能还原到字节级一致。

默认排除 .gitignore 里的内容、以及基础排除表(node_modules/、dist/、build/ 等),避免快照体积失控。

修掉的缺陷

rewind issue #94:回退后输入框不回填

dsh-rewind-plugin 的回填链路有三处静默失败:

  1. 读文本发生在回退命令之后 —— 宿主 nodes.filter() 已把目标节点从事件区间剔除,读回 undefined 就静默 return
  2. 宿主 conversation.input.for(scope) 在 session binding 失效时抛 retained Session scope,异常被空 catch 吞掉
  3. 8 次重试耗尽后静默放弃,界面上毫无痕迹

本项目的处理:

  • 文本在 fork 之前抓取(来自 React 组件的 node.data.content,天然早于执行)
  • 写入口按 actions.setDraft → shell.setDraft → DOM execCommand('insertText') 降级逐级兜底
  • 写完回读 shell.snapshot.draft 校验(宿主的 Lexical 在文本相同时会提前 return,不校验会误判成功)
  • 全部失败 → 日志 + toast 提示,绝不静默

recall:孤儿快照清理不掉

会话删除后,快照可能残留,且「立即 gc」也清不掉。根因是 rebuildOrphans() 把找不到归属的 git tag 强行标成当前活会话,loadIndex() 再次兜底填同一个 id,saveIndex() 把污染固化进 index.json。于是 sweep 逻辑认为这些快照属于活会话,永不回收。

本项目的处理:

  • rebuildOrphans() 不再编造归属,无主 tag 记为空归属
  • loadIndex() 归属只认磁盘原值,空就是空
  • 新增 reloadIndex():清掉只加载一次的守卫,强制从磁盘重读,用于纠正历史污染
  • sweepDeletedSessions() 改为先重读磁盘,并把空归属快照按孤儿直接回收;有名有姓的要内存与磁盘都查不到才删

安装

插件依赖宿主为 DSH 桌面版(dsh >= 0.2.2-rc.1 < 0.3.0)。

从本地源码

# 1. 放到你喜欢的位置
cd ~/Documents
git clone <this-repo> dsh-timefold

# 2. 在 desktop profile 里加 file: 依赖
cd ~/.dsh/profiles/desktop
# 编辑 package.json:dependencies 加入
#   "dsh-timefold": "file:/绝对路径/dsh-timefold"
# dsh.profile.bundles 追加 "dsh-timefold"

pnpm install

注意:不要用 dsh plugin --profile desktop add ... —— 桌面 profile 由 Electron 应用独占管理,该命令会被拒绝。改 package.json + pnpm install 是正确路径。

file: 依赖是硬链接复制,改源码后必须 rm -rf node_modules/dsh-timefold && pnpm install 才会同步。

重启生效

装完 ⌘Q 完全退出(关窗口不算),等 5 秒再打开。插件改动桌面版不会热重载。

配置

~/.dsh/profiles/desktop/cordis.patch.yml 里按 id: timefold 覆盖:

- insert:
    - id: timefold
      name: 'dsh-timefold'
      config:
        gcSnaps: 50                   # 每积累多少快照触发一次 git gc
        gcHours: 24                   # 距上次 gc 超过多少小时触发
        maxFileBytes: 8388608         # 超过该大小的文件不进快照
        maxWorkspaceBytes: 268435456  # 单工作区快照总量上限,超限停用该工作区
        scanBudgetMs: 10000           # 快照前扫描时间预算
        refillDraft: true             # 回退后把原文回填输入框

设置页也有可视化面板(插件配置卡片 + 快照管理)。

快照存储

默认路径 ~/.dsh/dsh-timefold-snapshots/<工作区哈希>/:

index.json     快照索引(id / time / root / sessionId)
git/.git       影子裸仓库
exclude.txt    排除表

root.txt 记录该库对应的工作区绝对路径。

home 不可写时退化到项目内的 .dsh-timefold-snapshots(该目录已在排除表中,不会自我快照)。

已知边界

  • 快照只在消息发送时创建。插件启用前的历史消息没有快照,不显示回退按钮
  • 单个工作区超过 maxWorkspaceBytes 会停用该工作区的快照(并在设置页提示)
  • 只支持 DSH 0.2.2-rc.x;0.3.0 起锚点可能变化

致谢

License

MIT。详见 LICENSE,其中保留了上游 dsh-recall-plugin 的版权声明。

Comments

Loading…

Similar plugins

dsh-retrace

by daha1216

DeepSeek Harness 会话时光机(fork):消息撤回/编辑重发/重新生成 + 产物版本化,适配 DSH 0.1.5+ 与插件服务机制

Development & InfrastructureTerminal & ClientsManifest valid

★ 2

MIT

JavaScript

Nov 7, 2026

dsh plugin --profile web add dsh-retrace

by TheHeartFickle

DSH 会话管理插件 —— 对话回退 + 归档会话,长会话可回滚、可整理。

Sessions & MessagesManifest valid

★ 0

MIT

JavaScript

Sep 29, 2026

dsh plugin --profile web add @the-heart-fickle/dsh-session-manager

by keepermttl

DeepSeek Harness 归档会话管理插件:查看/恢复已归档会话(回到原工作区分组)+ 右上角一键关闭 dsh。MIT 许可,欢迎收录到任何插件合集,注明出处即可。

Sessions & MessagesManifest valid

★ 4

MIT

TypeScript

Sep 26, 2026

dsh plugin --profile web add @dsh-external/dsh-archive-viewer

by Movingtoleveltwo

A production-ready UI Rewind/Revert plugin for DSH. Features inline prompt editing and a flawless dual-engine state recovery system (Workspace ShadowGit + External Tracker) with full support for forke

UI & ExperienceSessions & MessagesManifest valid

★ 1

MIT

JavaScript

Oct 4, 2026

dsh plugin --profile web add dsh-revert

by kinggod899

DeepSeek Harness (DSH) plugin: rewrite assistant replies in the persisted session log in place, so later turns read your version. DSH 插件:就地改写会话落盘记录里的助手回复,后续轮次读到的是改写后的版本。

Manifest valid

★ 0

MIT

JavaScript

Oct 15, 2026

dsh plugin --profile web add @local/dsh-reply-forge-v2

by Anionex

deepseek harness对话和代码状态回退插件 | DSH — rewind conversation and workspace state, powered by a persistent Change Ledger

Sessions & MessagesManifest valid

★ 150

↓ 1.6k/wk

BSD-3-Clause

JavaScript

Nov 12, 2026

dsh plugin --profile web add @anionex/dsh-turn-rewind