dsh-session-delete
Manifest validDeepSeek Harness plugin: right-click a session to move it to a recycle bin after DSH quits; undo pending deletions and restore entries
dsh-session-delete
A DeepSeek Harness (DSH) plugin that adds Delete this conversation… to the session right‑click menu. Deletion is deferred until DSH quits (the Host keeps the session log open while it runs), and the session is moved into a recycle bin instead of being erased. Pending deletions can be undone, and recycle-bin entries can be restored or purged from a sidebar panel.
Community plugin. Not affiliated with DeepSeek.
Features
- Right-click menu item on any session row (also available in the row's
⋯menu) - Deferred deletion: a detached helper waits for the Host process to exit, then moves the session log and projection cache into the recycle bin
- Undo pending deletion: while a session is queued, the same menu item becomes Undo delete
- Recycle bin panel: list deleted sessions, restore them to their original paths, or delete permanently / empty the bin
- Never erases session data: a queued session is copied into a backup folder first; only directories that actually contain a
session*.jsonl(.zstd)log are moved; the move is verified and rolled back on failure - Automatic daily backups: an additive mirror of
%USERPROFILE%\.dsh\sessions; backup files are never deleted, so sessions removed later remain recoverable - Startup safety net: if the helper is killed before it runs, the next Host start finishes the move before session logs are opened
- zh / en UI copy
Requirements
- DSH Desktop on Windows. The Host half works anywhere, but the deferred exit helper uses PowerShell, so the "delete after quit" step is Windows-only. On other platforms queued deletions are applied at the next start instead.
- Tested with DSH 0.2.2-rc.3.
Installation
-
Clone this repository anywhere:
git clone https://github.com/longsunny6/dsh-session-delete.git -
In DSH Desktop, open Plugins → Add plugin… and choose the cloned folder (local directory installation links the checkout, so
git pullupdates the plugin files). -
If the bundle row is not enabled, enable it.
-
Fully quit and reopen DSH Desktop so the Host half loads, then the page reloads with the client plugin.
Usage
- Right-click a session in the sidebar and choose 删除此对话… / Delete this conversation…, then confirm. The session stays in the list until you quit DSH.
- Changed your mind? The same menu item now shows 撤销删除 / Undo delete.
- Quit DSH completely. The helper waits for the Host to exit and moves the session into the recycle bin.
- Open More → 回收站 / Recycle bin in the sidebar (pin it with the pin action to keep it visible):
- 恢复 / Restore — moves the log and cache back; refresh the page (
Ctrl+R) to see the session in the list again - 永久删除 / Delete permanently or 清空回收站 / Empty recycle bin
- 恢复 / Restore — moves the log and cache back; refresh the page (
Cancel everything before quitting
Delete %USERPROFILE%\.dsh\session-delete-queue.json. The waiting helper notices the file is gone and exits.
How it works
| Piece | Role |
|---|---|
index.js | Host plugin. Registers authenticated routes on the DSH connection fetch channel: GET/POST/DELETE /api/session-delete (pending list, queue, cancel) and GET/POST /api/session-recycle-bin (list, restore, purge, empty). |
client.js | Browser module. Adds the session-row menu entry through the sidebar.workspaces.session.menu.item slot, a sidebar panel icon, and a main panel page. |
lib/recycle.js | Queue file and recycle-bin storage: move into <DSH_HOME>/session-recycle-bin/<timestamp>_<sessionId>/, with meta.json recording the original absolute paths, plus list/restore/purge. |
scripts/delete-sessions.ps1 | Detached PowerShell helper. Waits for the Host PID to exit, then moves queued sessions into the recycle bin. Single-instance lock; failed entries stay queued. |
Data locations (default DSH_HOME is %USERPROFILE%\.dsh):
- Pending queue:
session-delete-queue.json - Recycle bin:
session-recycle-bin/<entry>/log-0/,projection-cache.json,meta.json - Backups:
session-backups/<timestamp>_<sessionId>/(copy made when queued) andsession-backups/mirror/(daily additive mirror) - Log:
session-delete.log
The recycle bin never overwrites existing files on restore: if the original path is occupied, restore fails and the entry is kept.
Backups
Two independent layers protect the logs:
- Copy on queue — clicking Delete this conversation… first copies the session's log directory and projection cache to
<backup root>/<timestamp>_<sessionId>/. This happens before anything is moved, so even a crash between queueing and quitting leaves a full copy. - Daily mirror — 15 seconds after the Host starts, and every 24 hours, the plugin additively mirrors
<DSH_HOME>/sessionsinto<backup root>/mirror/. New and changed files are copied; files already in the mirror are never deleted, so a session deleted later can still be recovered from the mirror. The recycle-bin panel shows the last run and provides Back up now.
The backup root defaults to %USERPROFILE%\.dsh\session-backups (same drive). Set the environment variable DSH_SESSION_BACKUP_ROOT to a path on another drive before starting DSH, for example:
setx DSH_SESSION_BACKUP_ROOT "E:\dsh-session-backups"
Then restart DSH. Logs are copied byte-for-byte (.jsonl.zstd files are self-contained), and copies are never removed by the plugin; delete old folders yourself if disk usage matters.
Limitations
- Only Windows supports the "move after quit" step; elsewhere the move happens at the next DSH start.
- The default backup root is on the same drive as
DSH_HOME. PointDSH_SESSION_BACKUP_ROOTat another drive to survive drive failure. - Backups are never pruned automatically; the recycle bin and the backup folders consume disk space until you remove them.
- Queueing a very large session copies its log first, so the confirmation can take a moment to complete.
- Deleting a session's log does not edit the Host's workspace registry (
storages/workspace.json); stale session ids there are ignored by the session list and are harmless. - If DSH is restarted immediately after quitting, a short race is possible; the startup safety net retries.
- A session log can still be lost if another program deletes it outside this plugin. Keep the daily mirror on a separate drive for real protection.
Development
npm test # node --test; exercises lib/recycle.js against a temporary DSH_HOME
The unit tests do not need a DSH installation. The Host and client halves are loaded by DSH itself; installing the bundle is the integration test.
CI: .github/workflows/test.yml runs the unit tests on every push and pull request.
中文说明
这是一个给 DeepSeek Harness 的社区插件:会话右键菜单新增 删除此对话…。因为 DSH 运行时一直占用会话日志的写入句柄,插件把删除推迟到进程退出之后,并且移入回收站而不是直接抹掉。
- 安装:克隆仓库后,在 DSH 桌面端 插件 → Add plugin… 选择该目录;完全退出并重开 DSH。
- 使用:右键会话 → 删除此对话…;退出 DSH 后自动移入回收站;侧栏「更多 → 回收站」可恢复或永久删除。已排队的会话在菜单里显示 撤销删除。
- 安全:入队时先把会话日志复制到备份目录;只有真正含
session*.jsonl(.zstd)的目录才会被移动,移动后还会校验,失败自动回滚。 - 自动备份:启动 15 秒后及每 24 小时,把
%USERPROFILE%\.dsh\sessions增量镜像到备份目录,备份文件永不删除,之后被删除的会话仍可从镜像恢复。设置环境变量DSH_SESSION_BACKUP_ROOT可把备份放到其他盘。 - 数据:待删除队列
%USERPROFILE%\.dsh\session-delete-queue.json,回收站%USERPROFILE%\.dsh\session-recycle-bin\,备份%USERPROFILE%\.dsh\session-backups\,日志%USERPROFILE%\.dsh\session-delete.log。 - 限制:退出后自动执行仅支持 Windows;备份默认与 DSH 同一磁盘;回收站和备份占用磁盘直到手动清理。
License
Comments
Loading…
Similar plugins
by XXXXXQ-0206
Session recycle bin and permanent delete for DeepSeek Harness. Sidebar delete, restore, batch purge, and active-session protection.
★ 1
↓ 283/wk
MIT
JavaScript
Sep 29, 2026
dsh plugin --profile web add dsh-session-deleteby OliYogSothoth
Delete DeepSeek Harness sessions for good — via a recycle bin: move, restore, then the next start wipes the log, projection cache, spill files and workspace accounting.
★ 1
MIT
JavaScript
Nov 5, 2026
dsh plugin --profile web add dsh-plugin-session-purgeby jingmei2
Physically delete DeepSeek Harness Sessions through an undoable recycle bin: trash, restore, or purge for good.
★ 1
MIT
JavaScript
Nov 2, 2026
dsh plugin --profile web add @jingmei2/dsh-session-binby z1lyA
DSH plugin: manage archived DeepSeek Harness sessions — batch unarchive and safe permanent deletion with attachment reference scanning.
★ 0
MIT
JavaScript
Nov 3, 2026
dsh plugin --profile web add dsh-session-adminby overspread
DeepSeek Harness plugin: back up every session before deletion, batch-select sessions in the Web GUI, restore a backup in one click
★ 1
MIT
JavaScript
Oct 21, 2026
dsh plugin --profile web add dsh-session-backupA plugin for DeepSeek Harness (DSH) that adds a permanent "Delete session" action to the sidebar session menu
★ 0
Apache-2.0
JavaScript
dsh plugin --profile web add dsh-delete-sessions