DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

gongyehuahe /

gongyehuahe/dsh-session-cleanup

Verified

DSH plugin: delete sessions from the Web UI, with sizes, confirmation and full cleanup.

★ 1 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@0c2f60f0

dsh-session-cleanup

Deletes sessions in the DSH Web UI for good — DSH itself can only archive them.

  • Size first. The session menu row shows how much disk space the session occupies, and the confirmation dialog breaks it down into its session log and its projection cache.
  • Confirmation. Nothing is removed until the dialog's danger button is pressed; the dialog states that the action cannot be undone.
  • Thorough. Deletion removes the session log directory (<home>/sessions/<project>/<id>/), the projection cache (<home>/storages/session_projcache/sessions/<id>.json), detaches the id from every workspace and clears its archived/pinned flags, then prunes the project directory when its last session is gone.
  • Session storage panel. Settings → Session cleanup lists every session the Host can still reach, sorted by size (including orphan log directories, stray projection caches, and live sessions that have no files left), and offers the same deletion dialog per row.

Install

This repository is the plugin package. Install it from the git spec:

plugin_manager install_bundle target="github:gongyehuahe/dsh-session-cleanup"

or, from a shell in the DSH profile directory:

pnpm add "github:gongyehuahe/dsh-session-cleanup"

Then reload the plugin row (disable/enable) and refresh the Web UI page.

The npm name dsh-session-cleanup belongs to an unrelated package, so install from this repository rather than from the registry. A local clone works too: point install_bundle at the directory.

Usage

  • Right-click a session → Delete session: the row shows the session's size and the dialog reports the log/cache breakdown before anything is removed.
  • Settings → Session cleanup: a full table sorted by size, with the same dialog per row.

Deleting a session that is open

DSH keeps every session it has opened in memory for the lifetime of the process, and its session list prefers a live session over the stored one. Removing only the files would therefore leave an undead row that can no longer be opened and cannot be deleted again.

Deletion therefore runs in this order when the session is live:

  1. evict it from the in-process session store (the same detach capability the owning fiber uses), so the sidebar drops it immediately;
  2. close its write handle, draining buffered events and releasing the directory lock;
  3. remove the projection cache through the cache's own storage table — disposing a session checkpoints its projections, so an unlink alone is written back a moment later;
  4. remove the log directory and the workspace bookkeeping.

If the session cannot be evicted (an unknown Host build), nothing is deleted and the request fails with session-live: restart DSH and delete it then.

Safety

  • A session that still has running work is refused with session-busy; the check is the same workspace/session-activity waterfall archiveSession uses.
  • A session whose files are still open cannot be removed by the OS; that comes back as session-in-use instead of a partial delete, and the workspace bookkeeping is only touched after the files are gone.
  • A projection cache that cannot be cleared is reported as cache-busy rather than left behind silently.
  • The id is validated (session-<uuid>) and the log directory must be named after the id and live under <home>/sessions before anything is deleted.
  • The browser half talks to POST /session-cleanup/api, which only answers same-origin, loopback/trusted requests.

Requirements

  • DSH with the Web UI (desktop app or dsh web).
  • Node.js 18 or newer (no third-party dependencies).

Layout

File Purpose
index.js Host half: the JSON endpoint, size measurement, deletion, workspace bookkeeping
client.js Browser half: the session menu row, the confirmation dialog, the settings panel
cordis.patch.yml The loader row inserted into the profile
locale/{en,zh}.json Plugin title and description
icon.svg Plugin icon
test/integration.mjs Integration tests: a throwaway DSH home and the real HTTP handler

Development

npm test     # integration tests against a temporary DSH home
npm run check

Licence

MIT

—/ 5

No ratings yet

Verified DSH bundle

Commit 0c2f60f02cf3

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout