dyhyfjn
dsh-rollback-withdraw
Trae-style withdraw for DeepSeek Harness Web — one-click rollback of workspace code + conversation (git commits or hard-link snapshots). 会话撤回插件
- Stars
- 1
- Language
- JavaScript
- Created
- Aug 15, 2026
- Updated
- Aug 15, 2026
Introduction
dsh-rollback-withdraw
Trae-style withdraw for DeepSeek Harness Web. A one-click rollback button on every user question and assistant answer that rewinds both the workspace code and the conversation itself (memory, trajectory, goals) to the state before that message.
What it does
Every completed turn in a DSH web session becomes a rollback point. Click the undo icon next to any message and the workspace files are restored to the last completed turn before it, while the session is forked at that point and the rolled-back conversation opens automatically — exactly as if that exchange never happened.
- Workspace code — restored via the best available backend (see below).
- Conversation — the session is forked at the boundary and the child (rolled-back) session is opened; model memory, trajectory, goals and subagent lineage all match that point in time.
- First-class git integration — when the workspace is a git repository, checkpoints are real commits, and a withdraw is a
git reset --hard+ a safegit clean.
Features
- Withdraw on every message — under every user bubble and on the final assistant message of each completed turn.
- Two restore backends, chosen automatically:
- Git mode (default on, one-click toggle): every turn end is committed as
rollback checkpoint <seq>; a withdraw restores viagit reset --hard+git cleanthat preserves dependency/build directories. Space-efficient and aligned with normal git workflows. - File-snapshot mode: otherwise, hard-link snapshots are taken at every turn end — unchanged files share a single copy across snapshots, so keeping hundreds of turns costs almost nothing.
- Git mode (default on, one-click toggle): every turn end is committed as
- Per-workspace toggle — the git-branch icon in the session header turns git auto-commit on/off; the choice persists in
.dsh-rollback/config.json. - Loads automatically — packaged as a web-profile bundle (
dsh.bundle+dsh.client), it starts with the client; no re-activation after restarts. - Two-step confirm — click once to arm (button turns red), click again to execute, so a rollback is never accidental.
Requirements
| Item | Notes |
|---|---|
| OS | Windows (uses robocopy + PowerShell 5.1+); other platforms planned |
| Git | optional — only needed for git mode |
| DSH | web profile (dsh web) |
Installation
# from npm
dsh plugin --profile web add dsh-rollback-withdraw
# or from this repository
dsh plugin --profile web add github:dyhyfjn/dsh-rollback-withdraw
# or a local build
npm pack && dsh plugin --profile web add ./dsh-rollback-withdraw-0.1.0.tgz
Restart the web app afterwards — plugin-set changes take effect on restart.
Usage
- Chat with the agent as usual; a rollback point is recorded automatically after every completed turn.
- Hover a message and click the undo icon — click once to arm ("confirm"), click again to execute.
- The workspace is restored and the UI switches to the forked, rolled-back session. Continue from there.
The git-branch icon in the session header shows git-mode status:
- lit (brand color + green dot) = git auto-commit on;
- dimmed = off, or the workspace is not a git repository (tooltip explains);
- disabled when the workspace has no git repo.
How it works
- The host half listens to
session/eventand records a checkpoint at everyturn/end— a git commit, or a hard-link snapshot under<workspace>/.dsh-rollback/snap/<session>/<seq>/. - Client buttons talk to the host through a same-origin HTTP route
/rollback/rpc(the static-plugin channel that replaces the dynamicharness.handle). - A withdraw validates the boundary (the last
turn/endbefore the message), restores the files, then the client forks the session at that sequence and opens the child. - The first message of a session cannot be withdrawn (there is no prior turn); messages from before the plugin was installed have no snapshot — the button explains why.
Configuration
| Key | Where | Default | Meaning |
|---|---|---|---|
gitAutoCommit | <workspace>/.dsh-rollback/config.json | true | use git commits as rollback points when the workspace is a git repo |
Ignored paths (never snapshotted, committed, or deleted): node_modules, .git, dist, build, .next, .venv, __pycache__, .idea, .vscode, coverage, *.pyc, *.log, … (see IGNORE_DIRS / IGNORE_FILES in lib/index.js).
Security note
/rollback/rpc is a same-origin, unauthenticated route on the localhost web server — this tool assumes personal, localhost-only usage. Do not expose the harness port to untrusted networks.
Limitations
- Windows first (robocopy + PowerShell); macOS/Linux fallbacks are planned.
- Git mode performs a whole-repository
git reset --hard+git clean(ignored directories preserved) — untracked non-ignored files are deleted on rollback. - Withdrawing an assistant answer also rewinds the preceding question (rollback returns to the last completed turn end); the platform's fork primitive only cuts at turn boundaries.
- The source session stays in the sidebar as a branch; there is no auto-archive.
Development
npm pack # produce the publishable tarball
node --check lib/index.js lib/client.js # syntax gate
License
MIT — see LICENSE.