dsh-archive-sessions
v1.2.5
Published
会话管理:搜索已归档的会话记录、查看它们占用了多少磁盘,然后多选恢复或永久删除 / Session Manager for DeepSeek Harness: search archived sessions, see their on-disk size, then restore or permanently delete them with multi-select.
Maintainers
Readme
dsh-archive-sessions
会话管理 —— 在设置里搜索已归档的会话记录,看它们占了多少磁盘,然后多选恢复或永久删除。
A Session Manager page inside Settings that lists archived Harness sessions and lets you inspect, restore, and permanently delete them — with search, sorting, and multi-select batch actions.
What it does
- Archived-only view — unarchived sessions are never shown; the page is the place where archived records are managed.
- Search — filters the list by title, workspace path, or session id (literal, case-insensitive).
- Sort — click
CreatedorSizein the header; the largest sessions are one click away, which is usually why this page gets opened. - Multi-select — select all (of the current list) / per-row checkboxes, then act on the selection. A selection survives a search change; the toolbar and the confirm sentence say how many selected records are not currently listed.
- Restore — unarchives the selected sessions; they return to the conversation list in their workspace.
- Delete — permanently removes the durable session log, its projection-cache checkpoint, and its workspace membership entry. Destructive actions ask for confirmation (Cancel holds focus, Escape closes) and show the reclaimed size afterwards.
- Size and totals — each row shows the on-disk size of the session log; the line above the table totals what is currently listed.
Safety model
Reading these before trusting the delete button is worthwhile; each one is enforced in the host half, not in the page.
- The routes are authenticated or refused. Every request goes through the host's
connection.requestRejection(Host/Origin check plus browser authentication). A composition that mounts noconnectionservice cannot authenticate the call, so the request is rejected — absence fails closed rather than opening a data-destroying endpoint. - Only archived sessions can be deleted. The endpoint re-reads the archived set and refuses (
not-archived) for any id outside it. An unarchived conversation keeps its log even if a client asks by id. - A session with work in flight is refused, not stopped. The check reads the live
agent.statusand the recorded turn boundary, so a turn parked on an approval or a question is caught too. An idle resident session (opened, no turn running) stays deletable. Only resident sessions are asked: a log left behind by a crash is not "busy". - A session the process still holds frees its bytes now, and its row on the next start. The harness keeps opened/restored sessions in memory, lists them from that memory, and exposes no public unload API — only the owner of an
AgentHandlecan dispose one. So the log, projection checkpoint and workspace membership go immediately, while the archive entry stays: an empty ghost must not fall back into the conversation list. The queued id lets the next start drop the entry too. - A session whose log cannot be removed yet is queued. Same queue path: if the directory is still held (Windows write handle), the id is retried at the next start and on teardown.
- Best-effort steps report instead of failing silently. Removing the pin, the workspace membership, or the projection checkpoint cannot fail the delete (the log is already gone), but each failure is returned as a
warningsentry and shown on the page. - Residue does not survive a restart, and does not need one. The startup drain and the per-list sweep both remove workspace membership, projection checkpoints, and archive entries whose Session no longer exists anywhere — a deleted session leaves nothing behind, on disk or in the sidebar.
Behavior and limits worth knowing
- Deletion is real and immediate for a cold session: the log directory under
~/.dsh/sessions/<workspace>/<session-id>/, itssession_projcachecheckpoint, its WorkspacesessionIdsentry, and its archive entry are removed in one request — the row leaves the archived group at once. - A resident session is deleted in two stages: the log and cache go at once (space is freed, nothing is restorable from disk), and the archived row disappears at the next start, when the process no longer holds the Session. Until then it stays in the archived group rather than falling back into the conversation list — the failure mode of clearing the entry while the Session is still live.
- Content search is not available: the shipped full-text backend is not mounted for the main query service (
openAt: never), so search covers metadata only. A literal-content search could be added on top ofsessionQuery.filterEvents, at the cost of reading every archived log. - The page cannot archive. Archiving belongs to the conversation list; this page only manages what is already archived, so it lists nothing else.
Configuration
Both roots are resolved at request time, in this order:
- the row's own
config(sessionsRoot,storageRoot), - the
configEditorview of the@deepseek-ai/dsh-session-persistence-jsonl/@deepseek-ai/dsh-storage-jsonrows (root), $DSH_HOME—~/.dsh/sessionsand~/.dsh/storages.
- id: session-manager
name: 'dsh-archive-sessions'
config:
sessionsRoot: 'D:\dsh-data\sessions'
storageRoot: 'D:\dsh-data\storages'Files
| File | Role |
|---|---|
| index.js | Host half: registers /session-manager/{list,restore,delete} on the host webServer; reads the corpus through ctx.sessionQuery, the archived set through the live workspace domain, edits workspace membership, removes storage directories. |
| client.js | Web half: registers the settings.section page, its settings.section.icon nav glyph, and its styles. |
| test/host.test.mjs | Node test suite for the pure host logic (id validation, directory indexing, tombstone queue, per-id result handling). |
| cordis.patch.yml | Inserts the session-manager Loader row. |
| locale/en.json, locale/zh.json | Display metadata shown by Plugin Manager and Settings. |
| icon.svg | Original line-style mark. |
Install
From npm:
npm i dsh-archive-sessionsThen add it to a profile's dsh.profile.bundles list (its cordis.patch.yml inserts the Loader row). Installing the package directory through Plugin Manager (install_bundle) works too.
Host-side code changes require an app restart; client code reloads with the page when the host re-serves the bundle.
Develop
npm test # node --test "test/**/*.test.mjs" (no dependencies)
npm run check # node --check on both halves
npm pack # → dsh-archive-sessions-1.2.0.tgz(package/ 为根)The tarball contains exactly the files list plus LICENSE.
License
MIT © 2026 xiaobaga281
