dsh-session-deleter: Deleting Sessions and Single Messages in Web UI

Foreword

In DeepSeek Harness (DSH), the Session persistence plugin @deepseek-ai/dsh-session-persistence-jsonl only provides create, open, flush, stat, and list, lacking a delete interface. While the UI allows archiving Sessions, it cannot truly remove a record from the sidebar; Workspace writes only incidentally prune ids, subagent/catalog is append-only, and the client does not expose a delete service. Session directories and logs on disk accumulate indefinitely, yet the Harness core does not provide corresponding Web operations.

The community plugin dsh-session-deleter (maintainer ghgjkbf, Category: Memory) fills this gap by adding “whole Session deletion” and “single message-level” handling without modifying the Harness core: deletion defaults to a private trash bin, and permanent deletion requires secondary confirmation; message-side operations support shadow (line A) and truncate (line B), both of which are reversible. The following introduces its positioning, capabilities, and usage.

What is this

dsh-session-deleter is a DSH bundle plugin (npm package name dsh-session-deleter, current version 0.2.0, MIT license, requires Node >= 20). It mounts the /session-deleter route on the Harness’s built-in Web server and registers entries in multiple Web UI slots, allowing you to perform deletion operations on Sessions and messages from your browser without relying on deletion APIs not yet provided by the Harness.

SkillHub Directory Page: ghgjkbf/dsh-session-deleter. Source code and documentation: GitHub Repository. SkillHub is a community plugin directory and has no official affiliation with DeepSeek / Quantou (High-Flyer); the DSH ecosystem adheres to “everything is a plugin,” please review the source code and license yourself before installation.

Core Features

Whole Session: Trash, Restore, Permanent Deletion

The plugin provides three operations accessible from the UI (summarized from the README):

  1. Delete a whole Session — Moves the entire Session directory (including logs of various generations) to the trash bin; it is restorable.
  2. Restore — Moves the directory from the trash bin back to its original path; it refuses to overwrite if the target path is occupied.
  3. Delete permanently — The only irreversible step, and the only step that truly frees up disk space; it requires a second explicit click (or API passing confirm: true).

Design Principle: Reversibility by default. The first deletion request does not directly delete bytes; it uses rename on the same file system to move the item to the trash, atomically completing the substantive step of “destructive work.”

Single Message: Shadow and Truncate

In addition to whole Sessions, the plugin exposes message-level interfaces via HTTP (see Route Table below):

  • Shadow (line A): Append-only and fully reversible. Replaces a surface node in the model-visible fold with a developer/message tombstone, similar in mechanism to official compaction. The transcript UI may still display the original line (per surface conventions), but the tombstone does not feed into LLM-derived messages—i.e., it removes the item from the model context, not from the screen.
  • Truncate (line B): Removes events from the artifact by rebuilding the “retained frame-aligned prefix,” causing the transcript line to disappear as well; it preserves a .bak- backup for byte-level restoration. This is the only message operation that modifies existing bytes.

Security and Rejection Strategy

The plugin rejects requests it cannot complete safely, for example:

  • Running Session logs that are still being written to are not deleted under their writer.
  • The Session initiating the request cannot delete itself.
  • Session ids serving as path segments that look like path traversal are rejected before touching the disk.
  • Directories may contain multi-generation logs like v3, v4 simultaneously; the implementation does not hardcode file names.

When rewriting logs, each durable batch resends a checksummed Zstandard frame; .jsonl.zstd is a concatenation of independently decodable frames rather than a single stream, ensuring subsequent appends can still be identified by backend structure scanning.

UI Entries

Surface Slot Location Description
Sidebar Footer (next to Settings) sidebar.footer.action order: 20, always visible, no hover required
Session Selection Dialog shell.overlay Opened via the footer entry
Session “…” Menu sidebar.workspaces.session.menu.item order: 500, after pin/rename/fork/archive
Confirmation Dialog shell.overlay Full-frame overlay
Management Page settings.section order: 50 within Settings
Management Page (Same Content) shell.overlay order: 5, plugin-internal management overlay

The sidebar footer entry is the main entry point: DSH only draws “…” when the pointer hovers over a non-current Session row, so users who never hover might miss the plugin capabilities in the menu. The selector lists all deletable Sessions; running or current Sessions are shown but cannot be deleted.

Deletion and management related dialogs perform a dry run first: displaying directory, size, log generations, scope of impact, and residuals before executing the move.

The management page renders the same component in two places. The Shell’s Settings panel does not have a service directly openable from the client; “Manage Trash” in the selector and “Open Management Page” in the dialog open the management overlay (same content as the Settings section). It still attempts selectPanel("settings") on a best-effort basis to jump to Settings on builds where that key is registered.

Host Routes

The plugin serves under the path prefix /session-deleter on the Harness Web server:

Method Path Purpose
GET /health Active root path and current Session id
GET /inventory All stored Sessions (bytes, generations, title)
GET /plan?sessionId=… Dry run: consequences, residuals, blocking factors
POST /delete {sessionId, force?} → Move to trash
GET /trash Trash entries, orphan detection, size
POST /restore {id} → Move back
POST /purge {id, confirm: true} → Delete bytes
GET /ledger?limit= Append-only operation log
GET /messages?sessionId=… Message list and live/shadowed status
POST /messages/shadow {sessionId, seq} → tombstone single item (line A)
POST /messages/unshadow {sessionId, tombstoneSeq} → Revert shadow
POST /messages/truncate {sessionId, throughSeq} → Truncate tail (line B)
POST /messages/untruncate {sessionId, backupPath} → Restore from backup

Installation and Enablement

The README in the fetched materials does not provide a standalone CLI installation line like dsh plugin add …; the SkillHub page marks it as “Installable,” but the specific installation method depends on your current DSH version’s bundle / market flow. Please read the repository source code before installation.

After enabling, optional configuration is passed via the config in the bundle line (excerpt from README):

- insert:
    - id: session-deleter
      name: 'dsh-session-deleter'
      config:
        sessionRoot: 'D:/somewhere/sessions'
        trashRoot: 'D:/somewhere/trash'
        protectCurrentSession: true
        refuseLiveSessions: true

Default values:

  • sessionRoot: <DSH_HOME|~/.dsh>/sessions
  • trashRoot: <home>/session-trash/sessions

When uninstalling: simply remove the bundle line and the npm package; directories already held in the trash bin remain and can be restored manually—manifest.json records the original path for each entry.

Disk State

  • <home>/session-trash/sessions/ — One held directory corresponding to each deletion, plus a manifest.json.
  • <home>/session-trash/ledger.jsonl — One line per operation phase, append-only; if the last line is torn due to a crash when reading, it is discarded rather than treated as corruption.

Typical Usage

Delete Session from Web UI

  1. Open the Session selector at the bottom of the sidebar (next to Settings), or use the delete item in the “…” menu for a non-current Session.
  2. View the dry run plan in the confirmation dialog (directory, size, generations, impact, and residuals).
  3. After confirming, the Session directory is moved to the trash; if needed, Restore from the management page or overlay, or Permanently Delete with a second confirmation to free space.

Running or current Sessions cannot be deleted; if protectCurrentSession / refuseLiveSessions are configured as true (default semantics above), it aligns with the protection strategy in the README.

Dry Run and Delete via HTTP (Example)

Assuming the plugin is mounted on the Harness Web service, you can check the inventory and perform a dry run first (paths are relative to /session-deleter under the site root):

GET /session-deleter/inventory
GET /session-deleter/plan?sessionId=<your session id>
POST /session-deleter/delete
Content-Type: application/json

{"sessionId": "<your session id>"}

Permanently purging an item from the trash (irrecoverable):

POST /session-deleter/purge
Content-Type: application/json

{"id": "<trash entry id>", "confirm": true}

For message-level operations, you must first GET /messages?sessionId=… to obtain the seq, then call /messages/shadow or /messages/truncate as needed; revert using /messages/unshadow and /messages/untruncate respectively (truncate requires backupPath).

Maintainer Verification Scripts

The repository provides verification commands against real Session tree copies (not mock plugin logic), for example:

node tools/verify-host.mjs "$DSH_HOME/sessions"
node tools/verify-http.mjs
node tools/verify-client.mjs

For the full list and environment variable descriptions, see the Verification section in the GitHub README.

Scenarios and Notes

Who it is for: Developers who accumulate a large number of Sessions on local or self-hosted DSH over long periods and need to “delete and occasionally retrieve” like a desktop application; scenarios requiring disk cleanup without modifying the Harness, or fine-grained pruning of messages within a Session (model context vs. UI display).

Important Notes:

  • The plugin reads and writes sessionRoot, trashRoot, and the trash bin with the current DSH process privileges; check the source code and MIT license before installation to ensure the paths and backup strategies are acceptable.
  • Only purge (and truncate’s modification of the artifact) irreversibly changes or deletes bytes; other Session deletions are reversible from the trash bin by default.
  • Shadow does not delete the line on the screen, while Truncate does; understand the Shadow vs. truncate section in the README before choosing.
  • Community directory and GitHub stars (0 as of data fetching) do not imply official endorsement; version and behavior are subject to the repository CHANGELOG and tag 0.2.0.

Conclusion

dsh-session-deleter fills the missing deletion capability between the DSH Web UI and the Session persistence layer: whole Sessions go to the trash bin by default, and permanent deletion requires explicit confirmation; messages support reversible shadow and backup-enabled truncate. If you are maintaining local Session directories or need controllable message pruning, you can integrate it via bundle after reviewing the source code.

  • Directory Page: https://www.skillhub.cn/plugins/ghgjkbf/dsh-session-deleter
  • GitHub: https://github.com/ghgjkbf/dsh-session-deleter
羽毛球分组比赛记分
小程序二维码

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

Xiaoye