DeepSHPlugins
dsh-undo 專案預覽
GITHUB / COMMUNITY PROJECT

dsh-undo

會話與訊息TypeScriptMIT

dsh-undo:受 opencode 等編碼 Agent 啟發的上下文撤銷/重做外掛——為每個根 agent 增加 undo / redo 兩個工具,把模型上下文回滾到上一個已完成步驟的末尾,也可重做。

4 StarsLingLambda 更新時間 2026-08-15
訪問 GitHub 倉庫
dsh-undo 專案預覽

專案介紹

中文

dsh-undo:受 opencode 等編碼 Agent 啟發的上下文撤銷/重做外掛——為每個根 agent 增加 undo / redo 兩個工具,把模型上下文回滾到上一個已完成步驟的末尾,也可重做。

English

dsh-undo: context undo/redo inspired by opencode and friends — adds undo / redo tools to every root agent, rolling model context back to the end of the last completed step.

專案資訊與收錄訊號

快照 2026-09-11
作者 / 組織
LingLambda
倉庫
LingLambda/dsh-undo
GitHub Stars
4
Forks
1
開發語言
TypeScript
許可證
MIT
最近推送
2026-08-15
Manifest
資料中檢測到宣告

公開倉庫不自動等於可商用;許可證與當前相容性以原專案文件為準。Manifest 和資料評分不構成安裝安全認證。

資料評分

62/ 100
維護活躍
81
文件與實用資訊
100
生態關注度
26
安裝便捷訊號
75
專案宣告訊號
100

README 含完整安裝與使用說明;關注度尚低(4)。

評分來自已有資料快照的五維模型,僅作瀏覽參考,不是實際使用評測或安全檢測結論。

安裝與使用

所有專案資料與許可均以對應 GitHub 倉庫為準。

dsh plugin add github:LingLambda/dsh-undo

複製命令不會自動執行。請先閱讀倉庫文件,確認環境要求與許可證。

專案截圖

倉庫 README

GitHub 原文

已儲存的倉庫文件快照;文件抓取時間未記錄,可能與上方目錄介紹處於不同版本。安裝前請核對當前倉庫說明。

儲存庫檔案保留原文,指令與授權文字不作自動改寫。

dsh-undo

English | 中文

[!WARNING]
Forward-looking preview: this release is not usable with any currently published DeepSeek Harness version. It depends on unreleased Harness support for durable surface/rewind / surface/restore events and the conversation.chat.user-actions WebUI slot. Installing it today will make /undo fail closed with an upgrade message. Publish this package only to preview and coordinate the future integration; do not present it as production-ready until the matching Harness release exists. look for <https://github.com/deepseek-ai/deepseek-harness/discussions/467/>

Durable, multi-level undo/redo for DeepSeek Harness (dsh). It rewinds model context by real user turn and restores workspace files changed by tools in that turn.

The commands are handled locally and are never sent to the model:

  • /undo rewinds the latest visible real user message and every surface message after it.
  • /undo <user-seq> rewinds from a specific visible user message, including all later turns.
  • /redo restores the latest active rewind. Repeated undo and redo operations use LIFO order.

The WebUI client contributes an undo action to finalized real-user message bubbles. The action invokes /undo <user-seq>; the Host validates that the addressed message is still a legal rewind target.

How It Works

Harness sessions remain append-only. Undo appends a dedicated surface/rewind control event for the exact current surface suffix; redo appends surface/restore for the newest active rewind. The original message nodes, message IDs, tool-call correlations, and log events are retained. Session replay reconstructs the same visible surface and redo stack after restart.

Before and after each top-level tool execution, the plugin records a workspace tree using an isolated hidden Git directory under ~/.dsh/dsh-undo/snapshots/. It does not create commits, switch branches, or modify the repository's own Git index. Undo restores only files touched by tools in the selected user turns; redo restores the pre-undo tree. Patch and redo metadata are stored per session so file redo can survive a Host restart.

Workspace tracking includes tracked files and untracked files up to 2 MiB. Files ignored by the repository and larger untracked files are left untouched. A small two-phase journal reconciles interrupted file operations against the durable active-rewind stack after restart. If the session has no Git workspace, context undo/redo still works and the command reports that file restoration is unavailable.

Background jobs returned by top-level tools are associated with their user turn. Undo requests termination for jobs started in the removed turns. Redo restores context and files but cannot restart terminated processes.

Requirements

This plugin requires a Harness version that supports:

  • Durable surface/rewind and surface/restore session events.
  • The conversation.chat.user-actions client slot for the WebUI action.

Older Harness releases fail closed: /undo reports that a compatible Harness upgrade is required instead of writing replacement assistant messages or copying transcript events.

Limits

  • File restoration is limited to the detected Git workspace. It never restores files outside that root.
  • Network requests, database writes, remote API calls, already-exited processes, and other external effects cannot be undone.
  • Background jobs started through nested tool dispatches or child agents may not be associated with the root user turn.
  • Undo signals recorded top-level background jobs but does not wait indefinitely for process exit.
  • New ordinary surface output invalidates active redo history according to Harness surface semantics.

Install

The package is a dsh bundle. package.json points dsh.bundle to cordis.patch.yml, which activates the Host plugin, and exposes a WebUI Client bundle.

From npm:

dsh plugin --profile demo add dsh-undo

From git (the prepare script builds lib/ during installation; authorize the build in the profile's pnpm-workspace.yaml first):

dsh plugin --profile demo add github:LingLambda/dsh-undo#<sha>

For local development against a Harness checkout, load the Host source with an overlay:

pnpm dsh web --patch ./cordis.patch.yml --patch /absolute/path/to/dsh-undo/overlay.yml
- insert:
    - id: undo
      name: /absolute/path/to/dsh-undo/src/index.ts

Usage

/undo
/undo 42
/redo

Use /undo for the latest user turn, the action on an older user bubble to rewind from that point, and /redo to restore the most recent rewind.

Develop

corepack yarn install
corepack yarn typecheck
corepack yarn test
corepack yarn build

License

MIT

使用前核對

安裝步驟、相容版本與授權範圍以原專案當前文件為準。Stars 和評分是快照中的導航訊號。

安裝與排錯 · 專案問題反饋

同類專案