DSH Plugins Marketplace

DSH Plugins

Plugins

/

Sessions & Messages

/

dsh-session-md-purge

d

dsh-session-md-purge

Manifest valid

Adds a recoverable delete to the session context menu: the Host archives the session, detaches it from its project and moves the session directory plus the Markdown files that session wrote into $DSH_

UI (client)hasBundlePatch

dsh-session-md-purge

A DeepSeek Harness (DSH) plugin that makes deleting a session recoverable and cleans up the Markdown that session wrote.

It adds one red 删除会话 action to the session context menu. Selecting it:

  1. asks the Host which Markdown files the session wrote with the write, edit or apply_patch tools, and shows that list in a confirmation dialog;
  2. archives the session through the Workspace registry — the durable archive set is what hides a sidebar row, and it also refuses a session with running work;
  3. detaches the session from its project;
  4. moves the session directory and those Markdown files under $DSH_HOME/session-trash/<UTC stamp>/.

Nothing is hard-deleted, so a mistake can be undone by hand from the trash folder. A session with a running turn, subagent, task or active reminder is refused with HTTP 409 and left untouched.

Requirements

  • DSH 0.2.2-rc.1 or newer (engines.dsh). The plugin needs the authenticated connection.fetch Host bridge and the Workspace registry archive/detach API.
  • No npm dependencies. The optional zstd binary is used as a fast path to read the session log; without it the plugin falls back to the Host's session-query service.

Install

From a DSH profile, install the package from this repository:

dsh plugin --profile <profile> add github:Cui-CN/dsh-session-md-purge

Or use the prebuilt release tarball (no build step, no dependency install):

dsh plugin --profile <profile> add https://github.com/Cui-CN/dsh-session-md-purge/releases/latest/download/dsh-session-md-purge.tgz

In DSH Desktop, install through the app's plugin manager with the same source. Once the plugin market lists this repository, it can also be installed from the market UI.

After installing, refresh the page once so the client bundle loads. The action then appears in the session context menu.

What stays behind

$DSH_HOME/session-trash/<UTC stamp>/
  <session directory>          # moved as-is: log, lock and any other files
  md/<absolute path without the filesystem root>

For example $HOME/Documents/report.md lands at session-trash/<stamp>/md/Users/<name>/Documents/report.md, and a Windows C:\Users\<name>\Documents\report.md lands at session-trash/<stamp>/md/Users/<name>/Documents/report.md. Restoring is a plain file move; the archived session can be unarchived from the market/plugin UI or the workspace registry.

Client menu contract

The action is a data action, not a legacy component contribution: ctx.contextMenus.register({ id, target: 'session', order, resolve }) returns { id: 'delete', label, danger: true, separatorBefore: true, failureLabel, run }. The shared overlay dismisses the menu before calling run, so no menu remnant stays on screen while the preview request and the confirmation dialog run. Failures surface through ctx.contextMenus.notify(...).

The bundle declares dsh.client.inject for @deepseek-ai/dsh-client-ui-context-menu and @deepseek-ai/dsh-client-ui-workspace.

Host routes

RouteMethodsPurpose
/api/session.purge.previewGET, HEADExisting Markdown files, their total size, and live / archived flags
/api/session.purgePOST{ "sessionId": "..." }; archive, detach, move

Both are registered on ctx.connection.fetch (requestBody: 'buffered'), so the /api bridge performs browser/API authentication, Host/Origin trust checks and body limits, and the handler receives a Fetch Request and returns a Fetch Response. The routes answer 400 for a bad body or id, 404 for an unknown session, 409 for a session with running work, and 500 when the registry or the file move fails.

Scope and safety rails

  • Only .md files named by this session's own write/edit/apply_patch calls are candidates, and only when they resolve under $HOME, /tmp, /private/tmp or /var/folders (or under $HOME on Windows).
  • Application data and dependency trees are excluded even under $HOME: Library, .dsh, .Trash, .config, .cache, .local, .npm, .pnpm-store, plus any node_modules or .git segment.
  • The confirmation dialog lists every file that will move before anything happens.
  • A session with running work is refused; the Workspace registry archive gate is what enforces this.
  • The compressed-log decompressor runs with a 20 s timeout, so a wedged zstd child fails the request instead of holding the route open.
  • The preview caches its scan keyed by the log's mtime+size (at most 60 s), so the confirming click does not decompress the log twice and a stale list is never used after the log grows.
  • The client request uses a 30 s AbortSignal.timeout.

Tests

node --test test/*.test.js

The suite fakes the Connection Fetch router, Workspace registry and session-query services, and runs against a temporary $DSH_HOME; it never touches real sessions.

Publishing

See PUBLISHING.md for the plugin-market listing steps.

License

MIT

Comments

Loading…

Similar plugins

dsh-session-delete

Session management for DSH: archive or delete one session, archive/delete all sessions in a workspace, and restore archived sessions from the settings page — archiving backs up workspace metadata and

Sessions & MessagesManifest valid

★ 0

↓ 283/wk

dsh plugin --profile web add dsh-session-delete

Adds a Delete session item to the sidebar session row menu that permanently removes the session log directory, projection cache and archive/pin membership and drops its row from the sidebar, plus an a

Terminal & ClientsSessions & MessagesManifest valid

★ 0

dsh plugin --profile web add dsh-archive-workbench

by ashulam

Deletes a session from the sidebar session menu: its log and replay cache go to the Recycle Bin on Windows (a local trash folder elsewhere); a live session is queued for removal on the next start.

Terminal & ClientsSessions & MessagesManifest valid

★ 0

MIT

JavaScript

Oct 30, 2026

dsh plugin --profile web add dsh-session-delete

by wuuuuu123-32

Adds delete and batch delete to the session list menu; sessions go to the Windows Recycle Bin instead of being erased, and the files a session produced are listed first so you decide whether to remove

Sessions & MessagesManifest valid

★ 3

↓ 744/wk

MIT

JavaScript

Oct 17, 2026

dsh plugin --profile web add dsh-session-delete

by ozjxnxh

Adds delete and multi-select batch delete to the sidebar session menu, removing session chat logs with an automatic backup and one-click undo while leaving workspace files untouched.

Sessions & MessagesManifest valid

★ 0

MIT

JavaScript

Oct 29, 2026

dsh plugin --profile web add dsh-session-trash

by Baboo-ming

Permanently delete a DSH session from the sidebar session row menu (danger-styled) with a confirm modal and a seven-stage, independently-degrading deletion pipeline (validate → running guard → workspace ledger → archive set → on-disk logs → in-memory drop → broadcast).

Terminal & ClientsSessions & MessagesManifest valid

★ 3

↓ 772/wk

MIT

JavaScript

Oct 17, 2026

dsh plugin --profile web add dsh-session-delete