Introduction¶
In DeepSeek Harness (DSH), a session is the primary unit of interaction and persistence. When you need to clean up old sessions, manage storage, or quickly reset the UI, the existing workflow often requires multiple clicks or manual file cleanup. DSH’s philosophy is “everything is a plugin,” and the community catalog provides an independent plugin ecosystem separate from the official offerings. Below is an introduction to a client-side plugin that adds three convenient capabilities to the Web UI: deleting sessions from the sidebar session menu, reloading the page or restarting the desktop app from the sidebar, and restoring previously deleted sessions from a backup directory.
Plugin Overview¶
- Name: dsh-session-revenant (DSH Session Revenant)
- Maintainer: Lingliqeye (GitHub: Lingliqeye)
- Core Capabilities: Session deletion with confirmation dialog (including size preview and optional backup), restore and delete from the backup list, sidebar page reload and app restart
- Use Cases: Developers who need fine-grained control over session lifecycle, storage usage, or need to refresh the UI without restarting the desktop app
Session Deletion & Backup¶
A Delete session entry appears at the bottom of the sidebar session menu. Clicking it opens a confirmation dialog:
- This session / Backup copy: Displays the current session’s disk usage (bytes and file count), as well as the size of the backup copy when “Create a backup” is selected. When unchecked, it shows “no backup.”
- Yes, delete / No: Two action buttons.
- Create a backup of this conversation: A checkbox, checked by default. When selected, the session is copied to the backup directory before deletion; when unchecked, the session is cleaned up directly with no copy retained.
The dialog reads sizes before performing any action, ensuring you see up-to-date information prior to deletion.
Backup Restoration & Deletion¶
The plugin page lists all copies in the backup directory, sorted by creation time in descending order. Each row displays the date, size, and provides Restore and Delete buttons.
- Each copy contains the session log and
meta.json, recording the origin, associated workspace, and whether it was archived or pinned. Projection caches and the workspace registry are not written into the backup. Caches are rebuilt upon restore, and the registry is not read back, so the backup size is close to the session log itself. - The copy also carries a
context.json, which stores the session title row read by the sidebar. If this file is missing, the session will display as “unnamed” on first open after restore. - On restore, the session returns to the state it was in when deleted: the same workspace, archival, and pinning status. The response includes
flags(the restored state) andproblems(items rejected by the registry). - If the session or its log directory already exists, the restore endpoint returns
409and makes no modifications. - If a directory is missing
meta.json(a legacy copy or a manually created folder), it is marked “no manifest” in the list and cannot be restored via the page; manual copying is required. - Delete of a backup copy prompts for confirmation and displays the number of bytes that will be freed. The deletion is irreversible; however, the session itself is unaffected.
After deletion, refreshing the page will show the restored session in the sidebar.
Auto-cleanup & Backup Paths¶
The plugin page provides a Delete backups older than 7 days toggle:
- Off (default): No automatic backup deletion; backups persist until manually removed.
- On: Scans the active backup directory every few hours and removes copies older than 7 days.
Backup directory path priority:
- The Backup directory field on the plugin page (absolute path)
- Environment variable
DSH_SESSION_DELETE_BACKUP - Default:
<DSH_HOME>/dsh-session-backups
Backups from older versions (prior to 1.1) are located at <DSH_HOME>/../备份/session-delete and can still be listed, restored, and deleted.
Sidebar Reload & Restart¶
Two controls appear at the bottom of the sidebar, in order:
- Reload page: Re-renders the interface within approximately one second, discarding all stale derived views (session list, search index, projections) without touching any process. Most “sidebar out of sync” scenarios can be resolved this way.
- Restart app: Shuts down and restarts the desktop application. This control is triggered via a
POST /dsh-session-revenant/restartrequest: - A confirmation dialog is shown first;
- The Host writes a detached Node helper process and returns immediately;
- The helper starts a watchdog, stops the main process via PID, and if the Host is still running, stops it as well, then restarts the app; if the helper exits unexpectedly, the watchdog attempts to restart the app.
Active conversations will be interrupted, but session history is already persisted to disk and will be restored automatically after the app restarts. Both controls can be hidden via toggles on the plugin page, so they only appear for those who need them.
API Endpoints¶
The plugin exposes a set of RESTful endpoints for direct invocation or integration. All endpoints require the header x-dsh-session-revenant-guard: 1; otherwise a 403 { "code": "untrusted-caller" } is returned. Failure responses follow the format { ok: false, error, code }.
-
POST /dsh-session-revenant/delete
{ "sessionId": "…", "backup": true }
backupdefaults totrue. -
POST /dsh-session-revenant/size
{ "sessionId": "…" }
Returns{ sessionBytes, files, backupBytes }. -
POST /dsh-session-revenant/restart
{}
Returns{ appPid, executable, helper, watchdogMs, delayMs }. -
GET /dsh-session-revenant/backups
Returns{ root, roots, backups: [{ id, sessionId, createdAt, workspacePath, restorable, legacy, bytes, files }] }. -
POST /dsh-session-revenant/restore
{ "backup": "<id>" }
Returns{ sessionId, restored, attachedTo, flags, problems, contextRow }; returns409if the session or log directory already exists. -
POST /dsh-session-revenant/discard
{ "backup": "<id>" }
Returns{ backupId, bytes, files }; returns404if the directory has already been deleted. -
POST /dsh-session-revenant/cleanup
{}or{ "days": 30 }
Returns{ root, days, removed: [{ id, bytes }], freed }; only cleans the active root directory. -
GET|POST /dsh-session-revenant/config
Returns{ restartAction, reloadAction, backupDir, autoClean }as well asbackupRootanddefaultBackupRoot. Preferences are stored insettings.jsonunder the DSH home directory, at the path$DSH_HOME/.session_reaperor~/.dsh/.session_reaper(when not set).
Installation & Activation¶
The plugin does not currently have an official installation command listed in its README. Please enable it on the DSH plugin page (or the corresponding catalog page), then configure feature toggles and the backup directory via the plugin page.
Use Cases & Cautions¶
- Suitable for developers and teams who need fine-grained control over session lifecycle and storage management.
- The plugin runs with the current DSH process permissions. Review the source code and license (MIT) before installing.
- The backup directory and active backup directory are managed by the plugin; upgrading DSH will not affect existing backups.
- API calls should be made from a trusted environment (the plugin page or a trusted script) to prevent access by unauthorized pages.
Closing¶
dsh-session-revenant provides day-to-day support for session deletion, backup restoration, and quick resets in DeepSeek Harness through three small yet practical capabilities. For more details and source code, visit:
- Catalog page: https://www.skillhub.cn/plugins/Lingliqeye/dsh-session-revenant
- GitHub: https://github.com/Lingliqeye/dsh-session-revenant