Archived Session Delete
A DeepSeek Harness (dsh) plugin that permanently deletes archived sessions with a two-step confirm, from the sidebar row hover strip and the "⋯" more-menu. It stops the session's running work and removes its log and projection-cache record from disk.
Screenshots
| Hover the delete button | Armed, click again to confirm |
|---|---|
![]() |
![]() |
Install
dsh plugin --profile web add dsh-plugin-delete-archived
Installing from source runs tsup and produces dist/index.js (Host) and dist/client.js (Web). Restart the Harness afterwards.
Usage
The control renders only while the row's session is archived, in two places:
- Hover strip — a trash icon after the archive and pin cells.
- "⋯" more-menu — a "Delete archived session" row that dismisses the menu on click.
Both reuse the shipped IconTrashOutlineRegular, Tooltip and MenuItemButton, so they match the native controls.
Deleting takes two deliberate clicks:
- The first click arms the control — it turns red, the label becomes Permanently delete, and it stays armed for 3 seconds.
- A click while armed deletes the session. After the arm lapses, a click simply re-arms.
A confirmed click POSTs to POST /api/session.archiveDelete, which:
- re-checks the archived precondition (
409otherwise); - asks
workspace/session-stopto cancel whatever the session still runs; - waits (bounded, 5 s) on the agent's
whenIdle()barrier; - flushes buffered events to disk;
- removes the session log directory;
- clears the workspace accounting, pin and projection-cache rows, then emits
api-session/removed.
Archiving vs. deleting
- Plain archive refuses a session with running work.
- Stop-and-archive stops the work but does not wait for it, and keeps the files.
- Neither variant disposes the agent or deletes anything.
Deletion runs its own stop → wait-for-idle → flush → remove sequence, so a session must be archived first.
Runtime limit
A plugin cannot fully dispose an agent another fiber owns, so a just-deleted session whose agent is still live stays in the Host's in-memory session/list until the next restart.
The plugin hides this: the files are already gone, the archive entry stays as the agent/pre-step gate, the response carries agentStillLive: true so the client keeps its optimistic row removal, and a startup sweep drops the stale entry later. A cold session (no live agent) is retired in one step.
Develop
pnpm install
pnpm build # tsup -> dist/
pnpm typecheck # tsc --noEmit
pnpm test # node --test
pnpm format # biome check --write
| Path | Purpose |
|---|---|
src/index.ts |
Host half: delete route, stop/idle/flush/remove, cleanup, startup sweep. |
src/client.ts |
Client half: the two-step control, arm timer and overlay notice. |
src/locale.ts |
Namespace, route and message dictionaries. |
cordis.patch.yml |
Bundle patch that inserts the Host row. |
License
Copyright (c) Cnily03. All rights reserved.
Licensed under the MIT License.


No comments yet. Be the first to write one.