dsh-session-ops: Centralized DSH Web Session Archiving, Restoration, and Soft Delete

Preface

Running agents long-term in DeepSeek Harness (DSH) Web accumulates a large number of sessions. The official sidebar typically only offers an archive entry for a single session, with no page to view “Active / Archived” sessions in one place, nor an interface to bring archived sessions back to the sidebar with one click. If you want to batch organize sessions, or delete them while keeping logs for manual recovery, additional capabilities are needed. The community plugin dsh-session-ops (maintainer lxl8182, category: Memory) adds a page under Settings → Session Management, providing one-click archive, one-click restore, and one-click delete; deletion moves session logs into a recycle directory instead of wiping the disk.

What Is This

dsh-session-ops is a session management plugin for DSH Web: it calls the official archive API from the browser side, and the server side provides restore and “soft delete” interfaces. Zero build, zero extra dependencies — lib/index.js and lib/client.js are handwritten JavaScript; the host side uses only Node built-in modules, and the browser side only require('react').

Core Features

Settings Page and Session Tabs

The plugin registers a dsh-session-ops block in settings, showing two tabs: Active and Archived, supporting single-row and batch operations. Batch operations execute sequentially (deletion moves directories on disk, avoiding unreadable errors caused by concurrency), and the list is refreshed only once after all operations complete.

Archive

The browser side directly calls the official ctx.workspaces.archiveSession(id). The session disappears from the sidebar, and its logs are fully preserved in the corresponding directory under <DSH_HOME>/sessions/.

Restore

Issue POST /dsh-session-ops/restore for an archived session. The plugin removes the session id from the workspace domain’s archivedSessionIds, and moves the log directory from <DSH_HOME>/deleted-sessions/<session id>/ back to its original location (if deletion was previously performed). It prioritizes the new host’s public ctx.workspaceRegistry.unarchiveSession(sessionId); for older hosts without this interface, it falls back to updating via the storage domain and syncing the registry in-memory cache path; if the shape cannot be recognized, it returns registry-shape-unknown without writing to disk.

Delete (Move to Recycle Directory)

POST /dsh-session-ops/delete first archives (the list updates immediately), then renames the session log directory to <DSH_HOME>/deleted-sessions/<session id>/, and writes .dsh-session-ops.json metadata (including sessionId, originalPath, cwd, deletedAt, etc.) for use during restoration. Cases where no log directory exists on disk, or it’s already in the recycle directory, return a clear reason (such as no-artifact, already-deleted, log-in-use), with corresponding explanations shown on the page.

Action Implementation Highlights
Archive Official archiveSession; logs untouched
Restore Unarchive + optionally move logs back from the recycle directory
Delete Move directory to deleted-sessions after archiving; not a disk wipe

Installation and Activation

Install from GitHub (command from the project README):

dsh plugin --profile web add github:lxl8182/dsh-session-ops

Or install from a local directory:

dsh plugin --profile web add /path/to/dsh-session-ops

After installation, simply restart dsh web. The plugin injects host routes and the client settings page via cordis.patch.yml.

Typical Usage

  1. Open DSH Web Settings → Session Management (the session management page registered by the plugin).
  2. Select sessions in the Active tab and use one-click archive; when needed, use one-click restore in the Archived tab.
  3. When you no longer need to keep the sidebar entry but still want to keep the logs, use one-click delete; logs go to <DSH_HOME>/deleted-sessions/. To completely clean up the disk, you need to manually delete the corresponding folder under that directory.
  4. Running sessions refuse deletion (session-running); if the log is occupied by a process and cannot be moved, the page will prompt you to restart before deleting.

Server interfaces (POST only, request body { sessionId }, max 8 KiB):

  • POST /dsh-session-ops/delete
  • POST /dsh-session-ops/restore

Session ids must match ^[A-Za-z0-9][A-Za-z0-9-]{7,127}$. On failure, ok: false is mostly HTTP 409; see the README interface table for specific error / reason details.

Use Cases and Notes

Suitable for: Developers who frequently open multiple sessions in DSH Web, need to view active/archived lists centrally, and want deletion to be recoverable rather than directly wiping the disk.

Important to know:

  • The plugin runs in the same process and the same local HTTP surface as DSH; the endpoint is unauthenticated, consistent with other DSH local interfaces — any process that can access 127.0.0.1:<port> can call it. Please review the source code and MIT license yourself before installing.
  • The recycle directory has no capacity limit and no automatic cleanup; sessionIds in workspace.json may still retain ids after deletion (masked by archivedSessionIds), which is a known behavior documented in the README.
  • If you have modified the root of session-persistence-jsonl via cordis.patch.yml in your deployment, the session scan path must be consistent with it.
  • Whether the session appears immediately in the sidebar after restoration depends on the host’s persistent cache; in individual cases, DSH must be restarted. If a recycle directory left by an older version of deletion has no metadata, restoration relies on inferring from the log header cwd; if that fails, you need to manually move the directory.

Conclusion

dsh-session-ops supplements centralized session management beyond the DSH Web sidebar: archive, restore, and soft delete by moving into deleted-sessions. The DeepSeek Harness ecosystem emphasizes “everything is a plugin”; community directories such as SkillHub are independent sites with no official affiliation with DeepSeek / High-Flyer (幻方).

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

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

Xiaoye