@yiln-dsh/dsh-plugin-delete-session
v0.4.5
Published
DSH bundle plugin that permanently deletes the current session or a selected batch after explicit confirmation.
Readme
@yiln-dsh/dsh-plugin-delete-session
Adds permanent-delete actions to the current session and session rows in the DSH Web GUI.
Behavior
- Adds a trash icon beside the current session title.
- Draws every control it contributes with the shipped counterpart's own
geometry, so the plugin is visually indistinguishable from the shell: the
session-header action is the header's own 28px icon button, the
batch-management action is the sidebar's round
.iconButton, the row action is the sameMenuItemButtoncell the shipped Pin/Rename/Fork/Archive rows use, and the confirmation card is the shippedModal(blurred mask, 24px layer-2 card, close button, Escape to dismiss, and 18px capsule buttons whose destructive action carries the error label color instead of a filled red). Icons come from the shipped icon set, resolved by name with a text fallback for a shell that predates them. - Adds a Delete session item to each ordinary session's three-dot menu — only while that row's own menu is open, so an unrelated popup (the composer's permission dropdown, for instance) never receives it — and reuses the destructive confirmation dialog. The product renders every menu through one primitives component, so the item is anchored to the menu box that actually sits against the row's action button rather than to the nearest open menu anywhere on the page.
- Adds a batch-management control beside the New Workspace action; management mode exposes a checkbox on each visible ordinary session plus Cancel and Delete selected controls.
- Sends selected sessions through one serialized Host operation, so active sessions are flushed and disposed safely before their persisted logs are removed.
- Requires an explicit confirmation before sending the destructive request.
- Flushes and disposes an active session before deleting its persisted log.
- Deletes the subagent sessions delegated from the deleted session, at every
depth, so no orphaned child transcript is left behind. Only sessions whose
header records
origin: "subagent"are followed: a session that merely names the deleted one as its fork parent stays untouched. - Reports the cascaded ids in
subagentSessionIds; a batch target already removed by an earlier cascade in the same request is acknowledged withalreadyRemovedinstead of failing. - Opens the next ordinary session when available, then re-reads the browser session list through the client session service's
refresh(), so the deleted rows disappear without reloading the whole page. The deletion goes through this plugin's own Host route, which the Session Controller never sees, so that pull is what updates the sidebar; a shell too old to exposerefresh()still falls back to the page reload. - Deletes the guarded per-session directory, including temporary files placed there by session-scoped features; it does not delete the workspace directory or content-addressed image objects, which may be shared by other sessions.
The plugin supports the stock per-session JSONL persistence backend, including
every committed Session format generation (session.jsonl and
session.vN.jsonl, each optionally zstd-compressed). Backends such as SQLite
that do not expose a per-session artifact location return a clear
unsupported-backend error instead of issuing a broad database deletion.
The Host wrapper records AgentHandle values returned by the public agent
factory so an active Web session can be torn down in the correct order. A
session that was already live before this plugin mounted, and whose teardown
handle was not observed, is refused rather than having only its file removed.
Restart dsh web after installing the plugin so newly opened sessions are
tracked by the plugin.
Install
The published package is @yiln-dsh/[email protected].
dsh plugin --profile web add file:/path/to/dsh-plugin-delete-sessionThe profile must be the web profile. Restart dsh web after installation.
