dsh-session-trash
v0.1.1
Published
Session trash bin for DeepSeek Harness: move sessions to trash, restore or permanently delete (adds three-dot menu entry).
Readme
dsh-session-trash
Session trash bin for DeepSeek Harness — delete sessions into a trash bin; restore or permanently delete from the bin.
DeepSeek Harness itself has no session-deletion feature (its persistence layer deliberately exposes no deletion API; session logs only ever grow). This plugin implements trash-bin semantics by moving the session log directory — it never touches the persistence layer internals and never patches the host.
中文说明见文末(Chinese docs at the bottom)。
Features
- Move to trash: the session disappears from the sidebar list (Harness' search index reconciles automatically) and its log directory moves to
$DSH_HOME/trash/entries/<sessionId>/. - Restore: the log moves back; the session reappears in the official list and its workspace.
- Permanently delete: delete an entry inside the trash bin = logs are removed for good, unrecoverable.
- Empty trash: permanently delete all entries at once (with confirmation).
- Entry points:
- Sidebar footer Trash button (
sidebar.footer.actionofficial slot, with entry-count badge); - Move to trash icon button next to the session title in the conversation header (
conversation.session.header.actionssession-scoped slot); - Move to trash as the 4th item in the session three-dot menu (same column as Rename / Fork / Archive) — Harness exposes no public session-row menu slot, so the plugin wraps
dsh-client-ui-primitives'HoverCardto inject the item (detectscontent.props.node.idplus the innerMenurename/fork/archive signature); when the signature does not match it silently degrades and never breaks the native menu.
- Sidebar footer Trash button (
Important design constraint
- Running / in-memory (live) sessions are refused. The JSONL persistence layer's append path uses
open(path, "a"), which would recreate the file at the original location — a moved-away live session would "resurrect" and leave a stale trash copy. Harness keeps every session opened during a run in memory until restart, so sessions opened in the current run need a dsh restart before they can be trashed. - Trash manifest:
$DSH_HOME/trash/manifest.json(atomic writes); entries:$DSH_HOME/trash/entries/<sessionId>/. - List titles come from the session log (latest
session/titleevent, else the firstuser/messagetext); logs are multi-frame zstd — decoded frame-by-frame with an output cap to avoid memory spikes.
HTTP API (host side, registered via ctx.webServer)
Prefix /dsh-session-trash, all POST with JSON:
| Action | Body | Returns |
|---|---|---|
| /api/list | {} | { ok, entries[] } (id/title/cwd/movedAt/size) |
| /api/trash | { sessionId } | { ok, entry }; live/running → 409 |
| /api/restore | { id } | { ok, entry } |
| /api/purge | { id } | { ok } |
| /api/empty | {} | { ok } |
Install
dsh plugin --profile web add dsh-session-trashor from a local tarball: dsh plugin --profile web add ./dsh-session-trash-0.1.1.tgz
Build (development)
npm install --legacy-peer-deps # local toolchain (typescript / tsdown)
npm run build # host only (tsc)
npm run build:client # client only (tsdown)Host deps are junction-linked from the dsh runtime (build.sh auto-probes DSH_CHECKOUT or dsh on PATH).
Technical notes
- Resource registrations are attached with
ctx.effectso hot reloads never leave stale routes. - The three-dot menu injection reads the primitives exports via
ctx.modules.loadCacheand swaps theHoverCardproperty in place (the workspace package resolves the component through namespace property access at render time); a polling reinstall self-heals HMR rebuilds. - If host stdout is invisible, apply failures are written to
$DSH_HOME/super-injector/session-trash-apply.log.
中文说明
DeepSeek Harness 会话回收站:删除会话先进回收站,回收站内可恢复或永久删除。
- 入口:侧边栏底部「回收站」(带数量徽标)、会话头部垃圾桶按钮、三点菜单第 4 项「移到回收站」。
- 存储:日志目录移动到
$DSH_HOME/trash/entries/<会话id>/,清单在$DSH_HOME/trash/manifest.json。 - 约束:正在运行或本次运行打开过的会话(仍驻留内存)拒绝移入——DSH 持久层会在原位置重建文件导致会话"复活",请重启 dsh 后回收。
- 卸载:
dsh plugin --profile web remove dsh-session-trash。
