dsh-recycle-bin: Workspace Session Recycle Bin with 14-Day Retention

Preface

When doing long-term agent or project development in DeepSeek Harness (DSH), the sidebar workspace tends to accumulate a large number of sessions. The official “Archive” feature can hide sessions from the list, but there is no complete workflow for “permanent deletion” or “recovery from accidental deletion.” Users wanting to free up space often hesitate, fearing they might need to dig through logs later, so they simply keep the sessions or manually manipulate files under DSH_HOME.

dsh-recycle-bin is a community-maintained DSH plugin that moves workspace sessions into a recycle bin. By default, it retains them for 14 days before automatically deleting them permanently; during this period, they can be restored at any time or deleted immediately. The following section describes what it does, how to install and use it, as well as the deletion mechanism and known limitations.

What is this

The plugin hooks into webServer routes on the Host side and registers slots such as sidebar.panellist, main, sidebar.session.row.hover, and shell.overlay on the client. It adds a recycle bin entry at the bottom of the sidebar (above Settings). Sessions can be moved into the recycle bin via drag-and-drop, hover buttons, or dropping into the panel. Under the hood, it calls the official workspaceRegistry.archiveSession; the session disappears from the workspace list first and then enters the recycle bin state.

Environment Requirements

Requires DeepSeek Harness 0.2.x. The author developed and verified this on 0.2.1-rc.2; older versions of Harness may lack the slots and routing capabilities relied upon by this plugin.

Core Functions

Move to Recycle Bin

Four methods are supported (The README mentions “three,” including sub-categories, but here they are broken down by actual operation):

  1. Drag to the sidebar recycle bin icon: Drag a workspace session row to the recycle bin icon at the bottom of the sidebar; the entire sidebar entry (icon + text) serves as the drop target.
  2. Bottom center drop zone: While dragging a session, a 236×52 “Release to move to recycle bin” overlay (shell.overlay) appears in the center at the bottom of the screen (shell.overlay). Releasing the mouse moves it in; the overlay disappears after release. The position at the bottom center is chosen to avoid obscuring the last few rows of the sidebar and to reduce accidental drops.
  3. Drag into the recycle bin panel: After opening the recycle bin panel, drag the session to an empty area within the panel.
  4. Hover button: Hover the mouse over the session row and click “Move to recycle bin” in the overlay.

Running sessions cannot be moved; a prompt will appear saying “The session is running, please stop it before moving to the recycle bin,” and the current turn will not be interrupted. Sessions that are open but not running a turn will release the UI occupancy before archiving.

On failure, the bottom drop block will display the reason for about 6 seconds and write to <DSH_HOME>/recycle-bin/host.log; cross-site validation failures are logged as guard-reject with full request headers.

Operations within the Recycle Bin

  • Restore: Unarchives the session, returning it to the original workspace.
  • Delete immediately: Requires a secondary confirmation (the second step is “Confirm permanent deletion,” valid within 5 seconds).
  • Empty recycle bin: Also requires a secondary confirmation.
  • Automatic cleanup: Scans once every hour; items older than 14 days are permanently deleted. A scan also runs approximately 5 seconds after application startup to catch up on items that expired while the application was shut down.

What “Permanent Deletion” Actually Does

DSH currently lacks an official Host API for “deleting sessions” (sessionPersistence only has create/open/flush/stat/list; neither sessionController nor workspaceRegistry has a delete session method). Therefore, “permanent deletion” is a file-level operation:

  1. If the session is still running a turn, the operation is rejected with a prompt to stop it first.
  2. Attempt to acquire a write handle via sessionPersistence.open(id, 'write') (retry 3 times at 200ms intervals); if acquisition fails, it degrades to direct file deletion and logs force-delete in recycle-bin/host.log.
  3. Delete <DSH_HOME>/sessions/<workspace-bucket>/<sessionId>/ (including session.v4.jsonl.zstd, etc.) and verify the directory is gone.
  4. Delete <DSH_HOME>/storages/session_projcache/sessions/<sessionId>.json (preview cache).
  5. Detach from the sessionIds of each workspace; if the lock was acquired successfully, remove from the archive set; if the lock failed, keep the archive flag to prevent the session from reappearing as an “ungrouped” empty shell before restart.
  6. Emit api-session/removed, and the UI immediately removes the corresponding row.

State is recorded in <DSH_HOME>/recycle-bin/state.json (id, title, workspace, move-in time). Deleting this file is equivalent to clearing the recycle bin records; it will not restore sessions that have already been physically deleted.

Installation and Activation

In the DSH ecosystem, plugins are usually installed as profile bundles via the Harness plugin_manager, rather than via CLI commands fabricated in this text. The installation target must use the specifications provided in the source material.

Method 1: Install via GitHub address (Harness supports pnpm github: specs)

Call plugin_manager’s install_bundle within Harness, filling the target with:

github:EnhydraLutristus/dsh-recycle-bin

After installation, the Loader entry will be include:dsh-recycle-bin, and a recycle bin icon should appear at the bottom of the sidebar. If it does not appear, press Ctrl+R to refresh; if it still does not appear, disable and then enable the plugin again in the plugin manager.

Method 2: Install from a local directory (For code modification or version pinning)

After cloning the repository, fill the target for install_bundle with the absolute path of the cloned directory (local installation is link:; changes take effect after disabling/enabling once). The clone address in the material is:

git clone https://github.com/EnhydraLutristus/dsh-recycle-bin.git

Update: For local installations, use git pull; otherwise, re-execute install_bundle (GitHub spec). After updating, it is recommended to disable and then enable the plugin in the plugin manager.

Re-enabling entries: Use plugin_manager’s set_plugin, with target set to include:dsh-recycle-bin.

Typical Usage

  1. Install and confirm that the recycle bin icon appears in the sidebar; clicking it switches the main area to the recycle bin panel.
  2. For sessions no longer needed: Drag to the recycle bin icon, drag into the bottom “Release to move to recycle bin” area, drag into an empty area of the panel, or use the hover “Move to recycle bin”.
  3. If deleted by mistake or still needed: Click restore in the recycle bin panel.
  4. If sure you don’t need it: Use the secondary confirmation “Delete immediately” in the recycle bin, or wait for the 14-day automatic cleanup.

Online Self-Check (Use the actual runtime GUI port):

GET http://127.0.0.1:<current-gui-port>/dsh-recycle-bin/list

The request header must include x-dsh-recycle-bin: 1; it should return something like {"ok":true,"retentionDays":14,"items":[...]}. Without this header, it returns 403 (used to block cross-site forged requests).

Use Cases and Notes

Who it is for: DSH users with many workspace sessions who need “archive first, recoverable, periodic auto-cleanup.” It complements the official archive feature by adding recycle bin UI, retention periods, and file-level cleanup.

Operation and Trust: The plugin reads and writes session directories and state files under DSH_HOME with the permissions of the current DSH process. Please review the source code and license (package.json indicates MIT) before installing. The community directory SkillHub is an independent site and has no official affiliation with DeepSeek / Hiall.

Known Limitations (Excerpted from README):

  • Deletion bypasses the official API. If Host storage or locking mechanisms change in the future, purgeFiles in lib/index.js may need modification.
  • The session-query-sqlite search index is not included in the deletion scope; historical searches may still point to deleted sessions.
  • Permanent deletion is irreversible.
  • Sessions in the recycle bin remain archived on the workspace side (intentional design; archiving is automatically removed upon restore).
  • Drag-and-drop recognition relies on the payload written to dataTransfer by the session row; if it cannot be recognized, accidental deletion will not occur, and you can use the hover button instead.
  • The bottom drop block only appears when dragging a session; dragging plain text or system files will not trigger it.

Icon disappears after cold boot: If you encounter “works on hot install, but no entry after restart,” check if package.json’s exports includes "./package.json": "./package.json", and check if dsh.client.immediately was misused, causing later-installed plugins to be crowded out of the first-screen batch. The README has specific explanations for these two points.

Conclusion

dsh-recycle-bin connects “remove from list, temporary storage, restore, expiration or manual cleanup” into a single actionable workflow, and clearly documents the file-level implementation and boundaries under the absence of an official deletion API. For installation or issues, see the GitHub Repository and the SkillHub Directory Page.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye