dsh-session-delete: Add "Delete Session" to the DSH Web Sidebar

Preface

In the DeepSeek Harness (DSH) Web client’s session row menu, the built-in actions typically include renaming, forking, and archiving sessions. Archiving only hides the session from the list, leaving the logs and projection caches on disk; if you truly want to remove a session from Harness while keeping the data retrievable from the system trash, additional client capabilities are required. The following introduces the community plugin dsh-session-delete (npm package name @jerrrrrywang/dsh-session-delete), maintained by jerrywang21-debug and categorized as a client plugin.

What is this

This plugin registers an independent deletion entry on the session list of the DSH Web interface: it adds a “Delete Session” (删除会话) option to the session row’s ⋯ menu and adds a trash can button to the hover area at the end of the row. Upon confirmation, the session disappears from the Harness list, and the session logs and projection caches are moved to the system trash (~/.Trash on macOS by default) instead of being irreversibly erased from the disk. The DSH ecosystem emphasizes “Everything is a plugin”; the plugin catalog page is hosted on the SkillHub community site and is not officially affiliated with DeepSeek / High-Flyer.

Interface and Interaction

  1. Menu Item: “Delete Session” is located below “Archive Session” (order: 500) and is highlighted in red.
  2. Hover Button: A trash can icon (order: 300, placed after archive and pin), with a tooltip.
  3. Secondary Confirmation: A confirmation box for dangerous operations; the “Permanently Delete” button is clickable only after checking the confirmation item. The box displays the disk usage of the session.
  4. Deletion Success: A description box provides the path within the trash for easy manual retrieval.
  5. Deletion Rejection: A description box displays the reason returned by the host (e.g., the session is currently running a turn).
  6. If the deleted session is the currently open one, the main area will release the selection first to avoid continuing to display a non-existent session.

Data Actually Modified During Deletion

The plugin handles data per session according to the DSH storage layout:

Target Processing Method
session.v<N>.jsonl.zstd and artifacts in the same directory under <DSH_HOME>/sessions/<projectKey>/<session ID>/ Move to trash
<DSH_HOME>/storages/session_projcache/sessions/<session ID>.json Move to trash
pinnedSessionIds[], archivedSessionIds[], and workspaces[*].sessionIds[] in <DSH_HOME>/storages/workspace.json Remove in-place (index, not the session entity)
Content-addressed attachments in <DSH_HOME>/attachments/v1/objects/ Do not delete (may be shared by multiple sessions)

The project directory key (projectKey) is lossy encoded and cannot be reverse-derived from the session ID; the plugin locates the directory by scanning the project buckets under sessions/. Same-volume moves use rename; for cross-volume moves (EXDEV), it copies first and deletes the original directory after confirmation. Filenames in the trash include a YYYYMMDD-HHMMSS timestamp to prevent overwriting by subsequent deletions.

Relationship with Built-in Capabilities

Built-in archiving retains data and only hides the list item; this plugin’s “Delete” removes the session from Harness and moves related files to the trash. The plugin is an independent package: it registers only via official slots sidebar.workspaces.session.menu.item, sidebar.workspaces.session.row.action, and shell.overlay using ctx.slots.inject(). The HTTP routes are /api2/session-delete-trash/{inspect,delete}; all IDs have the session-delete-trash.* prefix and do not reuse pin / rename / fork / archive. The host side relies only on built-in node: modules, and the browser side uses react and official primitives provided by the Module Loader, requiring no additional build steps.

Security and Running Sessions

The self-built JSON interface has three restrictions: it accepts only POST; it accepts only Content-Type: application/json; and it accepts only loopback Host (trusted hostnames can be appended via the environment variable DSH_SESSION_DELETE_TRUSTED_HOSTS, comma-separated). The request body limit is 64 KiB; the session ID must match ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$, and path escaping plus a check that “the result is still under the sessions root directory” are performed. Deletion is rejected when agents.get(id).status === 'running'; sessions that are open but not running can be deleted.

Installation and Activation

One-click Installation (Recommended): Search for dsh-session-delete in the DSH Web plugin market, or run in the terminal:

dsh plugin --profile <profile> add @jerrrrrywang/dsh-session-delete

This package is a DSH bundle (package.json points dsh.bundle.patch to the internal cordis.patch.yml). Choose either the bundle or a manually written cordis.patch.yml insert; do not use both simultaneously, otherwise the host side may throw errors due to duplicate route registration.

A. Install as Bundle (Recommended): Add the dependency to the profile’s package.json and list the package name in dsh.profile.bundles, for example:

{
  "dependencies": {
    "@jerrrrrywang/dsh-session-delete": "link:/Users/jerry/Desktop/DeepSeek工作区/dsh-session-delete"
  },
  "dsh": {
    "profile": {
      "bundles": ["...", "@jerrrrrywang/dsh-session-delete"]
    }
  }
}

Then run pnpm install (or it will be handled together when installing/updating via the plugin market).

B. Manual Insert: Add the following to the profile’s cordis.patch.yml:

- insert:
    - id: session-delete
      name: '@jerrrrrywang/dsh-session-delete'

dsh.client.platform is already declared as web. Both halves are loaded at application startup; the current DSH Desktop build has no available HMR, so DSH needs to be restarted after installation; simply refreshing the page is insufficient.

Version and Engine (from package.json): Package version 0.1.0, Node >=22, DSH >=0.2.0-rc.2, License MIT.

Configuration

Environment Variable Default Effect
DSH_SESSION_DELETE_TRASH macOS ~/.Trash; other platforms <DSH_HOME>/trash Customize trash directory
DSH_SESSION_DELETE_TRUSTED_HOSTS Empty Append trusted hostnames (comma-separated) for non-loopback deployments

Typical Usage

  1. After installing and restarting DSH, find the target session in the sidebar.
  2. Click the ⋯ at the end of the row to select “Delete Session”, or hover and click the trash can icon.
  3. In the confirmation box, check the confirmation item, view the displayed disk usage, then click “Permanently Delete”.
  4. According to the trash path in the completion prompt, use the system file manager to restore from the trash if needed (whether macOS Finder supports “Put Back” depends on Finder’s own metadata; the plugin does not write this metadata).

Use Cases and Notes

Suitable for DSH users who need to clean up sessions in the Web interface but want logs and projection caches to remain recoverable from the trash. The plugin reads and writes <DSH_HOME> and the trash path with the permissions of the current DSH process. Before installing, you should review the GitHub source code and the MIT license yourself.

Known limitations (from the README):

  • Running sessions cannot be deleted.
  • For loaded idle sessions, object copies may remain in the process after deletion; the disk and list are cleaned, but it is completely released after restarting DSH.
  • If the workspace registry is unavailable, modifications to workspace.json may be rolled back, leaving IDs pointing to non-existent sessions; the grouping view will not render them.
  • Only effective for the Web interface; the host half is a no-op in headless profiles.

The upstream test command is node --test (zero-dependency node:test, covering storage, host routing, and client slot flows).

Conclusion

dsh-session-delete uses official slots and independent APIs to add “Delete Session” to DSH Web, moving session logs and projection caches to a recoverable trash, while avoiding shared attachments and running sessions. Catalog page: https://www.skillhub.cn/plugins/jerrywang21-debug/dsh-session-delete; Source code and docs: https://github.com/jerrywang21-debug/dsh-session-delete.

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

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

Xiaoye