dsh-session-archive: Session Archive and Recoverable Trash

Introduction

When managing agent sessions in DeepSeek Harness (DSH), deletion operations often wipe sessions directly from the workspace. Once a session is accidentally deleted or a rollback is needed, the only option is to rely on backups. Existing similar plugins either introduce ghost sessions, silently fail, or take over native services and cause startup interruptions. This plugin provides a controllable session archiving and trash mechanism: sessions are archived into a dedicated collection, deleted sessions land in a recoverable trash bin, and manual cleanup and restoration are supported.

What It Is

lakersoul/dsh-session-archive is a Web plugin for DSH, categorized under “Memory.” It does not replace any native service—instead, it consumes official APIs and provides archiving and trash management features through a settings.section seat on the settings page. The plugin has been verified on DSH 0.2.2-rc.5, covering 12 unit tests and 40 real-runtime end-to-end tests.

Core Features

Session Archiving

The archive operation moves a session out of the workspace and simultaneously removes it from both the archive collection and the workspace bookkeeping, preventing ghost rows from lingering. Archived sessions no longer appear in the sidebar’s normal list and instead move to the archive view.

Trash Management

Deletion does not directly remove files; instead, the complete session directory is relocated to the trash bin. The trash bin is independent of the sessions/ directory and resides under ~/.dsh/session-archive/trash/, using timestamp prefixes for natural ordering.

The trash bin enforces the following policies:

  • Entry count limit: 100
  • Total volume limit: 2 GB
  • Retention period: 30 days
  • Per-entry volume limit: 200 MB

When limits are exceeded, entries are not automatically evicted. Instead, a trash-full error is returned, listing candidates that can be cleaned up. If disk space is insufficient, the deletion is rejected rather than proceeding and reporting the error afterward.

Recovery & Purge

The restore operation moves files back to their original paths and re-attaches them to the workspace. If an ID collision is detected or timestamps do not match, the overwrite is refused. A full purge (purge) is irreversible and requires explicit confirmation.

Installation & Activation

The plugin is installed via install.mjs and requires a DSH restart.

node install.mjs --dry-run     # Pre-check changes
node install.mjs               # Standard installation
node install.mjs --remove      # Uninstall

After installation, restart DSH to load the plugin.

Typical Usage

Viewing Archived Sessions

Browse the list of archived sessions in the archive view on the settings page. Titles of cold sessions are backfilled via the host cache (up to 24 backfilled per list request; the rest are completed in subsequent calls).

Deleting to Trash

Select a session in the archive view and perform a deletion; the files are moved to the trash bin. If the session is currently running, the deletion is refused.

Restoring an Archived Session

Select an entry from the trash bin and restore it. Files are moved back to their original paths, and the session reappears in the normal sidebar.

Cleaning Up the Trash Bin

The trash bin entry displays the number of overdue entries and supports batch cleanup of the oldest items. A full purge requires specifying sessionIds or oldestCount.

Repairing Orphaned Sessions

sessionArchive.repairOrphans re-attaches orphaned sessions that exist on disk but have no workspace bookkeeping entry back to their original workspace.

Use Cases & Caveats

This plugin is suited for developers who need to retain sessions long-term, want recoverable accidental deletions, or prefer centralized management of historical sessions. The plugin runs with the permissions of the current DSH process. Before installing, review the source code and the license (MIT).

In Brief

By avoiding native service replacement, employing fail-loud error handling, and offering configurable trash bin policies, this plugin provides a robust session archiving and recovery solution. For more details, see:
- Plugin directory page
- GitHub repository

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye