- Home
- Plugin
- Sessioni e messaggi
- dsh-session-manager
dsh-session-manager
xuanbao412/dsh-session-manager
Deletes DeepSeek Harness Sessions from the sidebar: choose recycle bin or permanent, confirm the choice once more, and the log directory, projection cache and Workspace record move to a bin you can restore from or purge. A management page lists every Session on disk for batch cleanup.
Installazione
dsh plugin --profile web add github:xuanbao412/dsh-session-managerREADME
dsh-session-manager
Delete Sessions from a DeepSeek Harness sidebar, with a recycle bin, batch cleanup, and two-step confirmation — as one installable plugin.
DSH ships no Session deletion: rows can be archived (hidden, files kept) but the log directory is never removed. This plugin adds a real delete path, plus a management page that lists every Session on disk, moves them to a recycle bin you can restore from, and purges the bin when you are sure.
Features
- Delete from the Session row — an entry in the row's
…menu (删除会话…) and a hover button on the row itself. - Choose the destination, then confirm it — the first dialog offers
取消 / 回收站 / 删除; picking either destination opens a second是 / 否dialog that spells out what will happen.回收站moves the Session to the bin,删除removes it outright. Nothing is touched until the second dialog is confirmed. - Recycle bin — a delete moves the log directory and the projection cache into
<DSH_HOME>/storages/session_trash/<sessionId>/instead of destroying them. Restore puts both back where they came from and re-attaches the Session to its Workspace. - Batch cleanup — check any number of Sessions in the management page and move them all to the bin at once; each id reports its own result, so one failure never aborts the rest. The same works inside the bin: select entries and restore or delete them in one go.
- Safe on running Sessions — the plugin asks the Workspace registry to stop the Session's activity (the same path the archive button uses), waits up to five seconds, then releases its in-memory entry so the log is not rewritten after deletion. If it will not stop, the delete is refused and nothing on disk changes.
- Management page — a
会话管理row in the sidebar's panel list opens a two-tab page: Sessions (titles, workspace, last-used time, running marker, batch actions) and Recycle bin (select, restore, delete forever, empty).
Install
The plugin has two halves: a host half that registers an HTTP route, and a browser half that
registers the slots. Both live in this one package, and package.json declares a dsh.bundle
manifest (cordis.patch.yml), so the package is installable as a bundle.
From GitHub
dsh plugin add https://github.com/xuanbao412/dsh-session-manager
Then restart the app. The bundle patch registers the host half; the browser half loads from the same package.
By hand
-
Copy the package into the profile's plugins directory:
<DSH_HOME>/profiles/<profile>/plugins/dsh-session-manager/ -
Declare it as a profile dependency so
pnpm installkeeps it. Edit<DSH_HOME>/profiles/<profile>/package.jsonand add:"dependencies": { "dsh-session-manager": "file:plugins/dsh-session-manager" }Then install (with the runtime's own pnpm, from the profile directory):
pnpm install --prefer-offline --ignore-scriptsThe install produces a snapshot under
node_modules/dsh-session-manager/; because the package declaresfiles, source edits need another install (or a copy overlib/). -
Add the plugin to the profile's
cordis.patch.yml:- insert: - id: session-manager name: dsh-session-manager -
Restart the app. Both halves load from the single
main/dsh.clientpair.
Upgrade from dsh-session-delete
dsh-session-delete (0.1.x) is superseded. Its host route prefix (/dsh-session-delete) is
kept, so a stale browser bundle cannot 404. To migrate: remove the old dependency and patch
entry, add this one, install, restart.
What a delete touches
| Path | Action |
|---|---|
<root>/--<project>--/<encoded-id>/ | moved into the bin (log/) |
<DSH_HOME>/storages/session_projcache/sessions/<id>.json | moved into the bin (projection.json) |
<DSH_HOME>/storages/workspace.json | the Session id is dropped (pin, archive flag, membership) |
| connected clients | api-session/removed is emitted so the row disappears immediately |
<root> is the persistence backend's root; without one, <DSH_HOME>/sessions is assumed.
Nothing is written to a system trash can: a purge is a plain recursive rm.
HTTP route
Every action is POST /dsh-session-delete/<action> with a JSON body. Responses are
{ ok: true, value } or { ok: false, error: { code, message, messageEn } }.
| Action | Body | Notes |
|---|---|---|
list | {} | { sessions, trash, trashDirectory } |
delete | { sessionId, mode? } | mode: "trash" (default) moves to the bin; "purge" deletes the log, its cache record and any older bin entry for that id, permanently |
delete-batch | { sessionIds: [...] } | up to 500 ids; { deleted, failed } |
restore | { sessionId } | |
restore-batch | { sessionIds: [...] } | up to 500 ids; { restored, failed } |
purge | { sessionId } | |
purge-batch | { sessionIds: [...] } | up to 500 ids; { purged, failed } |
empty-trash | {} | { purged, failed } |
Requests must come from an authenticated connection; anything else is answered with 403
before the body is read, so the route is not reachable from another local process. The guard
fails closed: when the connection service is missing, the route answers 403 rather than
falling through.
Durability
A deletion is a two-phase move. The bin entry's meta.json is written first with
state: "pending", the log and cache are moved next, and the record is rewritten as
state: "ready" only once both arrived. A crash in between leaves a pending entry that the
listing hides and restore refuses (rather than a log with no record), and a previous entry for
the same id is parked as .previous-<id>-<time> and put back if the new move fails.
Restores recompute the destination from the recorded Sessions root and project directory instead
of trusting the record's own path, so an edited meta.json cannot move a log outside the tree.
Mutation is serialised per Session id, which keeps two concurrent deletions from destroying each
other's move.
Known limits
- The stop wait is five seconds. A Session wedged in a tool call is reported as busy
(
session-busy) and left untouched; retry once it settles. - Deleting the Session you are looking at stops its turn first (the same stop path the archive button uses) and then closes its pane, so the panel falls back to the new-Session page. A shell that cannot report which Session is open keeps the old behaviour: the pane stays on 「会话不可用」 until you open another Session.
- Third-party caches keyed by Session id (cost meters, context stores) are not touched; they keep their records for deleted Sessions.
- The recycle bin is per profile, not per Workspace, and it is never emptied automatically.
Development
Host half: lib/index.js (Cordis plugin, inject = ['webServer']). Browser half:
lib/client.js (Module Loader bundle, require('react') only).
node --check lib/index.js
node --check lib/client.js
node test/offline.mjs # host: bin round-trip, batch, conflicts, running Sessions
node test/client-smoke.mjs # browser: registrations, dialogs, POST, panel markup
Both suites run on a plain Node 20+ with a temporary DSH_HOME; the browser suite stubs
window.__ModuleLoader__, react, and a minimal DOM.
License
MIT
Plugin correlati
billion-context
ranxianglei/billion-context
dsh-web-ui (dsh-chat-recovery)
zhu1090093659/dsh-web-ui
dsh-synapse
liangmianya/dsh-synapse
EduWork (dsh-side-chat)
ecnu/eduwork