# dsh-archive-workbench **Archive Workbench** — session deletion + archive management for DeepSeek Harness. [中文](README.md) | **English** DeepSeek Harness can only **archive** a session (hide it, nothing is deleted from disk), and it has no convenient place to browse archived sessions. This plugin adds both: 1. **Permanently delete a session** — the sidebar session "..." menu gains a "Delete session" row that actually removes the log from disk instead of just hiding it. 2. **Archived sessions panel** — a sidebar icon opens a full-page list of archived sessions, each row offering **Restore** or **Delete**. --- ## Features ### 1. Session menu: delete a session At the bottom of any session row's "..." menu (after `Copy Session ID`, behind a separator): > Pin → Rename → Fork → Archive → Copy Session ID → **Delete session** A confirmation dialog appears; confirming deletes permanently: - The session's **own** log directory (`~/.dsh/sessions///`) - Its projection cache (`~/.dsh/storages/session_projcache/sessions/.json`) - Its id from the archive/pin sets (so no dangling "ghost row" survives a restart) - Notifies the frontend to **remove the row immediately** (no page refresh needed) **Archived sessions are supported too** — the menu row does not distinguish state. ### 2. Archived sessions panel The sidebar icon bar (beside "Plugins" and "Schedules") gains an **archive icon** that opens a full-page list in the main area: ``` Archived sessions 2 Archived sessions appear here. Restore or delete them at any time. ┌─────────────────────────────────────────────────────────┐ │ Session title [Restore] [Delete] │ │ session-cf676d08-1890-427e-aa64-34a910d31600 │ └─────────────────────────────────────────────────────────┘ ``` - Each row shows **title + raw session id** (shows "Untitled" when no title is available) - **Restore**: calls the official `unarchiveSession`; the row disappears immediately and the session returns to its original workspace position - **Delete**: reuses the same confirmation dialog and deletes permanently - Order: **most recently archived first** - Empty state: "No archived sessions" > Note: the official client does have an archived-session entry (the "View options" button at the top of the sidebar → show archived). But it is buried, and it offers no restore/delete buttons — restoring means going back to the session row's "..." menu. This panel puts both actions in one place. --- ## Install **Option 1: Plugin market** (recommended) In DeepSeek Harness, open Settings → Plugins and search for `dsh-archive-workbench`. **Option 2: Command line** ```bash dsh plugin add dsh-archive-workbench ``` **Option 3: Install straight from GitHub** ```bash dsh plugin add https://github.com/CHYMZXS/dsh-archive-workbench ``` **Option 4: Local development directory** ```bash dsh plugin add /path/to/dsh-archive-workbench ``` **Restart DeepSeek Harness once after installing** (the plugin ships Host-side code, so a first install needs a restart). --- ## Known limitations ### A session that is currently resident (important) DeepSeek Harness exposes **no public API** that evicts a single session from memory. So for a session that was opened **during this run** and is still resident, deleting its files is not enough — it may write its log straight back. The plugin handles it like this: 1. Calls the official `archiveSession({ stopActivity: true })` to stop its running work and gate further writes 2. Waits for it to go idle (up to 8 seconds) 3. Deletes the files 4. **Re-checks repeatedly** (up to 6 times) to confirm the file did not reappear If the file is still recreated, the plugin **reports an explicit error** rather than claiming a success it did not get: > the session is still resident in this application and keeps recreating its log; restart the application and delete it again **Recommendation**: to delete a session you are using or just used, **restart the app first** — after a restart it is cold, and deletion is clean. ### Attachments are not deleted Images/attachments under `~/.dsh/attachments/` are **not** deleted. They are content-addressed and shared globally, so several sessions may reference the same object — deleting per session would corrupt the others. ### Subagent sessions Sessions created by a subagent **do not** appear in the sidebar and therefore cannot be deleted from the UI. This is official behavior. --- ## How it works The plugin is built entirely on official extension points and **modifies no official code**: | Part | Official extension point used | |---|---| | Delete menu row | `sidebar.workspaces.session.menu.item` slot (reserved for plugins; order 500) | | Confirmation dialog | `shell.overlay` slot + official `Modal` / `Button` | | Panel icon | `sidebar.panellist` slot (order 20) | | Panel page | `main` keyed slot (key = `dsh-archive-workbench-archived`) | | Delete action | Host half registers a private route via `ctx.webServer.register()`; the client calls it with `fetch` | | Row removal | Emits the official `api-session/removed` event (on the official forwarding allowlist) | | Restore | Official `uiWorkspace.unarchiveSession()` | | Projection cache cleanup | Official `storageDomain` `table.delete()` | Deletion logic lives in the Host half (`index.js`); the UI lives in the client half (`client.js`). They communicate over one private HTTP route. --- ## Development ```bash git clone https://github.com/CHYMZXS/dsh-archive-workbench cd dsh-archive-workbench dsh plugin add . ``` Edits to `client.js` hot-reload automatically; edits to `index.js` (Host half) need an app restart. --- ## License MIT