dsh-session-delete: Delete Sessions in DSH Sidebar (Recoverable or Permanent)

Preface

The DeepSeek Harness (DSH) session row “…” menu comes with built-in pin, rename, fork, and archive functions, but lacks a delete option. Session data accumulates under $DSH_HOME/sessions/, and clearing it manually requires direct file manipulation. Although the protocol includes session/delete, it is designed primarily for external ACP agents; the host storage layer does not provide an API to “delete a session directory.”

@jackal-alex/dsh-session-delete (GitHub: jackal-Alex/dsh-session-delete, maintained by jackal-Alex) is a client-side plugin available in the community directory. It adds deletion capabilities to the sidebar: either moving the session directory to a recoverable trash bin, or permanently purging it after confirmation.

What is this

In one sentence: Delete DSH sessions from the session row menu—reversible via trash bin, or permanent removal.

The plugin does not declare @deepseek-ai/* in peerDependencies. The client only utilizes ctx.slots, and the host only utilizes ctx.webServer, avoiding the entire package being skipped due to peer mismatches in DSH 0.2+. The README states it has been tested and verified on DSH 0.2.0-rc.2 (Windows Desktop); the npm package version is 0.1.3, licensed under MIT.

The implementation works by moving the entire sessions/<workspace>/session-<id>/ directory out of $DSH_HOME/sessions and preserving a meta.json in $DSH_HOME/session-trash/<timestamp>/ to facilitate recovery. This aligns with the current reality that “the host does not provide a deletion API, so operations must be handled on the file system.”

Core Features

Menu Item Behavior
Delete Session Moves directory to session-trash, attaching a meta.json to record the original workspace and directory name.
Permanently Delete Session Moves to trash first, then immediately clears from trash; styled with red danger color and requires double confirmation.

Supplementary behaviors (all from the README):

  • Active sessions cannot be deleted: For example, if a log file is occupied on Windows causing a rename failure, the system will prompt the user to switch to another session before deleting, preventing half-deleted states.
  • Auto-refresh after deletion: Uses location.reload() so the sidebar no longer displays the deleted row.
  • Menu styling: Font size, line height, padding, hover, and danger colors are aligned with DSH’s native menu cells (13px / 20px / 34px / 6px 8px).

The host side also provides HTTP interfaces (list sessions, trash, delete, restore, purge) for use by scripts or future UIs. A GUI for the trash list and restoration is not yet provided; restoration is currently available via API.

Installation and Enablement

Installation commands are based on the README. Community directory page: https://www.skillhub.cn/plugins/jackal-Alex/dsh-session-delete.

# From npm (after release)
dsh plugin --profile desktop add @jackal-alex/dsh-session-delete

# From GitHub (requires git on local machine)
dsh plugin --profile desktop add github:jackal-Alex/dsh-session-delete

# Local development (symlink, hard refresh after changes)
dsh plugin --profile desktop add link:/path/to/dsh-session-delete

Note: There is a separate third-party package named dsh-session-delete on npm (author: vtxf, repo: vtxf/dsh-session-delete), which is unrelated to this project. This project’s npm package name is @jackal-alex/dsh-session-delete; please verify the scope and author name when installing.

After installation, restart DSH (the bundle is assembled at startup), then press Ctrl+Shift+R to hard refresh the page to load the client side.

Typical Usage

  1. Hover over any session row and click the “…” on the right.
  2. Select Delete Session and confirm.
  3. The session disappears from the list; files are located in ~/.dsh/session-trash/ (i.e., $DSH_HOME/session-trash/).

To Permanently Delete Session, select the corresponding item in the same menu and complete the secondary confirmation.

Restoring from Trash (API, no UI yet)

Send a POST request to the local DSH web service with the agreed headers:

curl -X POST http://127.0.0.1:19387/api/session-delete/restore \
  -H "content-type: application/json" -H "x-dsh-session-delete: 1" \
  -d '{"trashId":"<trash directory name>"}'

When querying session or trash lists, all requests (including GET) require the header x-dsh-session-delete: 1, and only loopback addresses (127.0.0.1 / ::1) are accepted. Example:

curl -s http://127.0.0.1:19387/api/session-delete/list -H "x-dsh-session-delete: 1"

Host route summary:

Method Path Function
GET /api/session-delete/list Lists sessions on disk
GET /api/session-delete/trash Lists trash items
POST /api/session-delete/delete {sessionId, mode?}, where mode: "purge" means move and clear immediately
POST /api/session-delete/restore {trashId} returns item to original location
POST /api/session-delete/purge {trashId} permanently deletes, irrecoverable

Applicable Scenarios and Notes

Who it is for: Users who keep many workspace sessions open in DSH for long periods, need to occasionally clean up the sidebar and disk space, and want the ability to recover from accidental deletions via a trash bin or API.

Known Limitations (from README):

  • No batch deletion; no GUI for the trash list (API is ready).
  • Only handles the sessions/<workspace>/session-<id>/ directory layout; flat or single-file compressed layouts are not covered in this version.
  • Permanent deletion is not a secure erase (no shred).
  • The list updates rely on a full page refresh after deletion.

Security and Trust: The plugin reads and writes session directories and the trash bin with the permissions of the current DSH process. Before installing, it is recommended to review the source code and MIT license on GitHub to ensure it aligns with how you handle local data. The DSH ecosystem emphasizes “Everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek / High-Flyer.

Conclusion

If you lack a “proper delete button in the sidebar” rather than having to manually delete sessions files, dsh-session-delete turns file-layer movement into reversible deletion with an optional permanent purge. For more information, see the community directory page and the repository README.

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

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

Xiaoye