dsh-session-delete
Adds the missing Delete session action to the DSH Web sidebar.
Each Session's "…" menu gains a red Delete session row (order 500, after archive). Choosing it opens a confirmation dialog; confirming permanently removes that Session's local data and drops the row from every connected page.
Install
git clone https://github.com/The932/dsh-session-delete
dsh plugin --profile desktop add "link:<repo path>"
Or point the Harness Plugin Manager at the cloned directory (Add → install from
a local package directory) and enable the dsh-session-delete bundle. Restart
the Harness once after installation; then refresh the page if the row does not
appear immediately.
Requirements: the Web profile (dsh Desktop or a Web build) with the shipped
Session Controller, Workspace and Locale plugins — that is the default
composition. Developed and tested on Windows with the Desktop build.
What is deleted
| Data | Location |
|---|---|
| Session log | <sessionPersistence.root>/<project-encoding>/<sessionId>/ (the whole directory) |
| Cached view state | <DSH_HOME>/storages/session_projcache/sessions/<sessionId>.json[*] |
Nothing else is touched. Workspace ordering, pin and archive sets may keep the old id; they are id sets and simply skip an id with no Session.
Behavior
- The action is for the user only. The agent gets no tool for it: deletion is irreversible, so it stays behind an explicit confirmation.
- A running Session is refused with a message; stop it first.
- A Session that is still live in this Host process (for example one opened in this run) is removed from the list immediately, and its log directory is deleted as soon as the Host can release it. A durable tombstone retries every 15 seconds and once more on the next start.
- After a successful delete the sidebar row disappears through the shipped
api-session/removedrelay, and the conversation panel is cleared when it was showing that Session.
Endpoint
POST /dsh-session-delete/api with {"sessionId": "..."}, same-origin, gated by
ctx.connection.requestRejection() (fails closed when the trust fence is
unavailable). Session ids are validated against
^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$ before any path is built, and every removal
is confined to a <root>/<one-level>/<id> path.
Tests
node tests/core.test.mjs
node tests/host.test.mjs
core.test.mjs exercises the storage logic against temporary directories:
identity validation, directory discovery, selective removal, the projection
cache, the outside-the-root refusal, and the tombstone document. host.test.mjs
drives the real request handler through a fake Cordis context: the trust fence,
the request body, every refusal code, storage deletion, tombstone cleanup, the
deferred sweep on activation, and the forwarded removal event.
Run the files directly — node --test spawns child processes, which the
workspace sandbox blocks.
Files
index.js— Host half: the authenticated endpoint and the deferred sweep.client.js— browser half: the menu row, the dialog, and the styles.core.js— path-safe storage operations, shared with the tests.cordis.patch.yml— the bundle patch that inserts the Host row.
No comments yet. Be the first to write one.