dsh-archived: DeepSeek Harness Archived Session Management

Preface

DeepSeek Harness (DSH) does not natively provide an interface for deleting archived sessions. The archive operation can only unarchive, while logs and projection caches remain on disk indefinitely. The dsh-archived plugin fills this gap by providing UI and RPC interfaces, ensuring that session logs, projection caches, and archive indexes can be thoroughly cleaned up.

Plugin Introduction

This is a memory-type plugin primarily used for managing DSH’s archived sessions. It adds delete, restore, and cleanup capabilities to DSH’s “Settings → Archived” page, and handles complex states such as index residue and host contract checks.

Core Features

The plugin implements the following core capabilities:

  1. Session deletion: Supports single deletion and batch deletion. Defaults to the “trash” mechanism (30-day auto-expiration), with a “permanent deletion” option also available.
  2. Trash management: Supports restoring sessions from the trash or emptying the trash. The number of sessions in the trash and disk usage are always displayed at the top.
  3. Disk usage display: Lists the disk usage of each session.
  4. Stale session scanning: Supports scanning and cleaning up sessions that haven’t been touched for a specified number of days (archive mode only).
  5. Directory access: Provides an “open folder” feature to open the session directory directly in the system file manager.
  6. Security boundary checks:
    • Only accepts archived IDs, refuses to delete unarchived sessions.
    • Refuses to delete running sessions, or parent sessions that have running sub-agent descendants.
    • Handles index residue, preventing anomalies caused by having only indexes without files.
    • Performs host contract checks to ensure host API availability.

Installation and Activation

The installation command is as follows:

dsh plugin --profile web add dsh-archived

Prerequisites: Requires DSH 0.2.0-rc.1 or higher. The plugin does not support DSH 0.1.x.

Typical Usage

After installation, the plugin automatically mounts to the Settings -> Archived page.

UI Operations

  1. Navigate to the “Settings → Archived” page.
  2. Use the search box or workspace group filter to find sessions.
  3. Select the sessions to delete, then click “Delete” or “Batch Delete”.
  4. In the trash area at the top, you can click “Restore Latest” or “Empty Trash”.

API Calls

Manage sessions via RPC calls:

# Delete session (to trash or permanent deletion)
POST /api/dsh-archived/delete
Body: { "sessionId": "...", "mode": "quarantine" | "forever" }

# Batch delete
POST /api/dsh-archived/delete-all
Body: { "mode": "quarantine", "ids": ["id1", "id2"] }

# Restore from trash
POST /api/dsh-archived/restore
Body: { "sessionId": "..." }

# Scan stale sessions (read-only)
POST /api/dsh-archived/sweep/scan
Body: { "days": 30 }

Notes

  1. 24-hour hard protection: Logs written within the last 24 hours will never be listed or deleted, regardless of the day setting.
  2. Host state impact: If the host still holds the session in memory, the deletion operation will be temporarily delayed (written to deferred.json) until the host releases the session (usually after a restart).
  3. Does not modify host data: The plugin does not modify the host’s schedule.json or message_feedback.json.
  4. Stale cleanup strategy: Stale session cleanup only goes to the trash, never permanent deletion.
  5. Permission requirements: The plugin runs with the permissions of the current DSH process. Please review the source code and license before installation.

Summary

dsh-archived solves the problem of archived sessions in DSH not being thoroughly cleaned up, providing a complete management solution from UI to RPC. For developers who need to maintain long-term session records, this is an essential cleanup tool.

More Resources:
* GitHub Repository
* Community Directory

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

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

Xiaoye