Introduction

DSH provides the “Archive Session” feature, but archived sessions are hidden from the workspace list, with neither a restore entry nor a physical deletion entry. This causes archived sessions to accumulate on disk, consuming space and preventing cleanup. This plugin adds a sidebar entry to fill the missing restore and permanent deletion capabilities.

Core Features

  • Sidebar Entry: Adds a “History Archive” entry to the sidebar, following the DSH sidebar style.
  • Session List: Lists all archived sessions, displaying their actual session titles and archive times.
  • One-Click Restore: Click the “Restore” button in the panel to unarchive a session and return it to the workspace list.
  • Physical Delete: Click the “Delete” button in the panel; after a confirmation prompt, the session is permanently deleted (unrecoverable).
  • Real-Time Updates: Archiving, restoring, and deletion do not require page refreshes. When the panel is open, it refreshes automatically and polls for archive status updates every 3 seconds.

Safety and Deletion Semantics

Physical deletion is irreversible. The plugin executes the following steps in order; if any step fails, it does not leave a “half-deleted” session:

  1. Archive marker: Remove the session from the workspace storage domain’s archivedSessionIds.
  2. Workspace record: Remove the session from the sessionIds roster of each workspace entity.
  3. Storage directory: Delete $DSH_HOME/sessions/<project>/<session-id>/ (including session.v3.jsonl.zstd).
  4. Projection cache: Clean the session’s index entry in storages/session_projcache.json and its per-session cache files.

Safety constraints:
* Archived sessions only: Only archived sessions can be deleted; sessions in use cannot be reached for deletion until they are archived.
* Path validation: Before deletion, validate paths with a realpath check and reject any path outside $DSH_HOME/sessions. It does not follow symbolic links that escape this directory.
* ID validation: Session IDs are format-validated first (reject .., path separators, and overly long input).
* Attachment retention: Shared content-addressed attachments ($DSH_HOME/attachments) are not reclaimed because they may be referenced by other sessions.

Installation and Usage

Use pnpm to install:

pnpm add dsh-archive-manager

After installation, the “History Archive” entry appears in the DSH Web GUI sidebar.

Rebuild Client Artifacts

If you need to regenerate the client code:

node build-client.mjs

Notes

  • Irreversible operation: Once a session is physically deleted, its data cannot be recovered.
  • Permission requirements: The plugin runs with the permissions of the current DSH process; review the source code and license before installing.
  • Archived only: Only archived sessions can be deleted; regular workspace sessions cannot be deleted directly.

Summary

This plugin resolves the issue that DSH archived sessions cannot be restored or cleaned up by providing a secure physical deletion capability through a sidebar management interface.

GitHub Repository | Plugin Directory