The Web mode of DSH provides a graphical interface for agent development, but in session management, users can typically only view or archive sessions and lack a direct entry point to delete session logs and workspace registrations. This can lead to directory bloat and affect retrieval efficiency. The dsh-delete-session plugin solves this problem by integrating a “Delete Session” capability directly into the overflow menu of the session list.
Plugin Overview¶
This is a client and host plugin for the DeepSeek Harness (DSH) Web mode. It is maintained by SMWHff and aims to provide a “Delete Session” function for the session list in the Web interface. When triggered, it thoroughly cleans up the log directory on disk and the workspace records that reference the session.
Core Features¶
- Menu Integration: Appends a “Delete Session” option at the end of the ellipsis menu on the right side of each row in the session list.
- Safety Confirmation: Clicking it opens a product-level risk confirmation dialog. Users must check “I understand this operation is irreversible” before confirming.
- Cleanup Mechanism: Completely deletes the session log directory (
sessions/<project>/<sessionId>/) and removes the session registration from workspace records. - Status Feedback: Provides toast success/failure feedback; if the currently open session is deleted, the selection is cleared and the UI returns to the empty state.
- Runtime Protection: Deletion is rejected while running, with a prompt to wait for completion. The execution order is to first flush buffered events to disk, then detach.
- Event Forwarding: The
session/disposedevent published by detach is forwarded by the host API proxy ashost/session-removed, and the session is automatically removed from the lists of open clients.
Installation and Enablement¶
Install the plugin using pnpm:
pnpm dsh plugin --profile web add file:/path/to/dsh-delete-session
After installation, restart the Web surface and refresh the page to obtain the new window.__DSH_BOOT__ graph.
Typical Usage¶
- In the session list of the DSH Web interface, locate the target session row and click the ellipsis menu on the right.
- Select “Delete Session” at the end of the menu.
- In the confirmation dialog, check “I understand this operation is irreversible” and click Confirm.
- Wait for the session agent to finish running before attempting deletion.
How It Works¶
- Host Side: The plugin registers a strict Typert Remote for
deleteSession/deleteusing the same pattern asdsh-open-in-vscode. The Gateway can resolve the call without an@Remotemarker table. - Client Side: Because the session row menu in the current build has no native slot, the plugin uses a legacy adapter pattern. It identifies the session row ellipsis button (via aria-label template matching) and uses a
MutationObserverto inject a “Delete Session” row into the menu when the portal menu is opened. The session identity resolution priority is: unique match on display title -> disambiguate same-named sessions by DOM position -> fall back to the current session only when resolution fails and the row is the currently selected row.
Notes¶
- Dependencies: The plugin depends on the runtime session list snapshot (
displayTitle,blank,current) and the workspace locale templatesactions.session.ariaandmenu.archiveSession. It also depends on thearia-selectedmarker of the session row[role="treeitem"]. - Maintenance: If future official versions change these contracts, update the identification logic at the top of
src/client/session-menu.ts. - Permissions and Review: The plugin runs with the permissions of the current dsh process. The source code and license should be reviewed before installation.
This plugin provides session cleanup capabilities for the DSH Web mode and reduces the manual maintenance burden. For more details and source code, refer to: