dsh-plugin-session-delete: Adds "Delete Session" to the DSH sidebar

Preface

The DeepSeek Harness (DSH) Web UI sidebar’s session right-click menu has long only included entries such as pin, rename, fork, and archive. On DSH 0.1.7-rc.2 and nearby versions, there is no “Delete session” entry, and the host-side session controller has no delete RPC; the documentation for dsh-session-persistence-jsonl states explicitly: session files are not deleted, logs accumulate under root, waiting for external removal, and the seam provides no delete interface.

If you have tried many sessions, derived caches, and sub-agent branches locally, the sidebar will grow longer and longer, and the sessions/ and storages/ directories on disk will also remain indefinitely. The community plugin dsh-plugin-session-delete (maintainer: PanChengN, category: client) uses the official Slot mechanism to add a “Delete session” row to the menu, and implements “actually deleting from disk” as a host HTTP endpoint. This article introduces its purpose, deletion scope, installation method, and usage notes; the plugin is an unofficial community work and has no relation to DeepSeek officially.

What This Is

dsh-plugin-session-delete is a DSH bundle: the client half registers a menu row via sidebar.workspaces.session.menu.item (order 500); the host half registers POST /api/dsh-session-delete, cleaning up the session directory, derived cache, and workspace references under $DSH_HOME (default ~/.dsh) by session id, and deletes sub-agent sessions as well when conditions allow.

The repository root directory is the plugin directory (package.json is at the root), so no separate build is needed. The version referenced in the current material is 1.0.2, licensed under MIT © 2026 NIUpc.

Core Functionality

After installing and restarting DSH, right-click on a session in the workspace sidebar, and the menu will contain an additional row: “Delete session”. After confirmation, it calls the host API; if the deletion succeeds, the corresponding row in the sidebar will update and disappear (see “UI Update” below).

Deletion Scope (One Operation Cleans Four Places)

All paths are based on $DSH_HOME:

  1. sessions/<workspace>/<session-id>/ — session body and write lock
  2. storages/session_projcache/sessions/<id>.json — derived cache (title, etc.)
  3. storages/workspace.json — global.archivedSessionIds and each workspace’s sessionIds references
  4. Sub-agent sessions — when the runtime environment provides zlib.zstdDecompressSync, sessions whose header.parentSession points to the deleted session will be removed; when unavailable, they are skipped and the response includes zstd: false

Both on-disk forms of the session id (session-<uuid> and bare <uuid>) are recognized.

Host API

Deletion is handled by the host half. The request format is as follows:

POST /api/dsh-session-delete
content-type: application/json

{ "sessionId": "session-xxxxxxxx-...." }

Example of a successful response (field meanings are subject to the repository README):

{
  "ok": true,
  "sessionId": "session-....",
  "removedSessions": 1,
  "removedChildren": 0,
  "removedCaches": 1,
  "workspace": { "archived": 0, "groups": 1 },
  "emitted": 2,
  "zstd": true
}

Common failures: 400 missing-session-id, 400 invalid-json, 405 method-not-allowed, 500 <message>.

How the UI Updates After Deletion

After a successful deletion, the host sends the api-session/removed event to the client; the client’s ClientSessions.handleSessionRemoved removes that id from the list snapshot, and when the sidebar composes rows it directly skips ids without summaries, so the row disappears immediately. If the id is still in the snapshot after about 400ms, the client falls back to calling sessions.refresh() once, and does not do a full-page location.reload().

Plugin Composition (for Cross-checking the Source Code)

File Purpose
package.json Bundle manifest: dsh.bundle.patch + dsh.client
cordis.patch.yml Inserts the host row session-delete
index.js Host half: registers POST /api/dsh-session-delete
client.js Client half: registers the sidebar menu row
locale/{zh,en}.json Plugin card title and description
icon.svg Plugin card icon

The package name is @local/dsh-bundle-session-delete, the cordis row id is session-delete, and the HTTP route is /api/dsh-session-delete. Do not install two copies within the same profile (it will cause ambiguous-install or duplicate route registration).

Installation and Activation

There are two installation methods; the difference is whether the profile is bound to a local directory.

In the sidebar Plugins → Add plugin, fill in:

github:PanChengN/dsh-plugin-session-delete

You can also fill in https://github.com/PanChengN/dsh-plugin-session-delete. To pin a version, add #<tag>, for example:

github:PanChengN/dsh-plugin-session-delete#v1.0.1

Click Enable now, then restart DeepSeek Harness (new bundles’ browser modules require one process restart to enter the module table). After installation, the dependency is recorded in the profile, independent of any local clone directory, and the local directory can be deleted at any time.

Method B: Local Path (for Modifying Plugin Source Code)

In Add plugin, paste the absolute path of the clone directory. The CLI will refuse for the desktop profile:

$ dsh plugin --profile desktop add <...>
error: profile "desktop" is managed exclusively by the Electron application

This kind of installation writes link:<directory> into the profile; deleting the directory will cause a dangling reference. For everyday use, choose Method A. To migrate from B to A: first Remove the path-installed one in Plugins, then add it according to Method A and restart.

Typical Usage

  1. Install according to Method A and restart DSH.
  2. In the sidebar, find the session to clean up, right-click → Delete session, and confirm in the browser’s native confirmation dialog.
  3. The corresponding row in the sidebar should disappear; if troubleshooting is needed, check the host logs or compare against the removedSessions, removedCaches fields in the API response.

The menu confirmation dialog currently uses the browser’s native confirm(), not DSH’s built-in overlay style; the README notes that it does not hard-block deletion of “the conversation currently in progress”, only showing a confirmation prompt.

Uninstallation and Accidentally Deleted Directories

  • Git address installation: Simply Remove on the Plugins page.
  • Local path installation: You must first Disable / Remove in the GUI, then delete the clone directory; do not directly rm -rf the directory of an enabled plugin.

If the directory has been deleted but the profile still references it, startup may be abnormal, and logs may show a message about being unable to resolve @local/dsh-bundle-session-delete. The repository provides a rescue script (default dry-run, add --apply to write, and it backs up before making changes):

python3 dsh-plugin-session-delete/scripts/fix-stale-install.py
python3 dsh-plugin-session-delete/scripts/fix-stale-install.py --apply

When $DSH_HOME is not ~/.dsh, use --dsh-home /path. You can also follow the README’s “Manual Rescue” to edit package.json, cordis.yml, and remove dangling symbolic links.

Use Cases and Notes

Who it is for: Users who keep many sessions open in DSH over long periods, need to clean up both disk and session lists, and accept the maintenance pace of an unofficial plugin.

Runtime permissions: The plugin has the same permissions as the current DSH process, and can read and write sessions and storage under $DSH_HOME; before installation, please read the repository source code and the MIT license yourself to confirm the deletion behavior meets expectations.

Known limitations (from the README): the in-memory workspace membership on the host side will not be completely cleared until restart (the sidebar behavior is usually already normal); without zstd, the sub-agent session chain will not be deleted.

The DSH ecosystem emphasizes “everything is a plugin”; the plugin directory page is hosted on community sites such as SkillHub, and has no official affiliation with DeepSeek / High-Flyer.

Links

  • Directory page: https://www.skillhub.cn/plugins/PanChengN/dsh-plugin-session-delete
  • Source code and full documentation: https://github.com/PanChengN/dsh-plugin-session-delete
羽毛球分组比赛记分
小程序二维码

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

Xiaoye