Delete a session and its transcript permanently from the sidebar menu, with a confirmation step and a refusal to touch a running session. Archive only hides a session; this removes it. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:yukre/dsh-session-delete
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
给 DeepSeek Harness 的侧栏会话右键菜单新增一项 「删除会话…」,永久删除该会话及其对话日志。
为什么需要它
DSH 内置的 归档 (Archive) 与真正的 删除 (Delete) 是两件不同的事。归档只往工作区注册表写一个隐藏标记,会话日志一字不动、可随时取消归档恢复。DSH 也没有提供删除单个会话的 API:
SessionPersistence只有create / open / flush / stat / list,没有 deleteWorkspaceRegistry.delete(id)删的是工作区,且注释明确「保留目录与全部会话日志」
本插件补上这个缺口,并与归档严格分开:归档是隐藏,删除是清除。
| 归档(内置) | 删除(本插件) | |
|---|---|---|
| 效果 | 从侧栏隐藏 | 从磁盘移除 |
| 会话日志 | 完整保留 | 永久删除 |
| 可恢复 | 可以 | 不可撤销 |
| 释放磁盘 | 否 | 是 |
使用方法
- 鼠标移到左侧会话列表中的目标会话上,点行尾 「…」 菜单
- 选择 「删除会话…」
- 确认框显示该会话标题,确认后立即删除
安全设计
- 必须在确认框中确认:显示会话标题,并明确提示不可撤销、同时提示"只想隐藏请用归档"
- 运行中的会话禁止删除(
SESSION_RUNNING),避免在日志仍被写入时删除导致损坏 - 当前打开的会话禁止删除(
SESSION_OPEN),避免界面持有已消失的会话 - 会话 ID 白名单校验:只允许单段安全字符,拒绝
..、/、绝对路径 - 路径越界防护:解析后必须仍在会话根目录内
- 同源校验:要求 JSON Content-Type 且 Origin 与 Host 一致,跨站请求被拒
删除的是什么
~/.dsh/sessions/<工作区编码>/<会话ID>/
session.v4.jsonl.zstd 对话日志
session.lock 写入锁文件(无数据)
删除即移除该会话目录。会话列表由扫描该目录树得出,因此删除后无需重建索引;Host 端还会发出 api-session/removed 通知,让侧栏立即移除该行。
安装状态
已作为 bundle 安装进 desktop profile,并写入正式配置(dsh.profile.bundles)。
- Host 端(删除接口):已生效并实测通过
- Client 端(菜单入口):需重启 DeepSeek Harness 后才会出现在浏览器中
验证记录
Host 删除接口在真实运行环境中验证通过(使用独立测试目录,验证后已清理):
| 场景 | 结果 |
|---|---|
| 正常删除测试会话 | ✅ 200 {"ok":true,...},目录已移除 |
| 不存在的会话 | ✅ 409 NOT_FOUND |
| 无 Origin 头 | ✅ 403 BAD_ORIGIN |
| 跨站 Origin | ✅ 403 BAD_ORIGIN |
路径穿越 ../../etc |
✅ 409 BAD_SESSION_ID |
| 非 JSON Content-Type | ✅ 403 |
| GET 方法 | ✅ 405 METHOD_NOT_ALLOWED |
| 运行中会话 | ✅ 409 SESSION_RUNNING,未删除 |
限制
- 删除不可恢复,没有回收站
- 被删会话的附件、worktree 等关联数据不会被连带清理
- 会话级搜索索引可能残留指向已删日志的条目(不影响正常使用)
- 若后端不是 JSONL(Desktop 默认是),本插件不适用
卸载
在插件管理中停用或移除 dsh-session-delete 即可,不影响 DSH 本体,也不影响已归档/未归档的任何会话。
Links
More in this category
ranxianglei/billion-context★ 7661
The official billion-context plugin: a context-compression plugin for small context windows (a 100K context is enough), token savings (5x fewer tokens), and month-long single sessions (billions of tokens).
Minglink/dsh-infinite-gen-4★ 4374
System-prompt armor plugin for DeepSeek models: appends an unconditional-compliance prompt section at order 100, exposes a profile tool with calibration metadata, and shows a realtime armor-status badge driven by a session projection.
liangmianya/dsh-synapse★ 723
Visual, non-linear conversation workspace for DeepSeek Harness — sessions, follow-ups and branches become a browsable conversation map.
MichengAI/dsh-archive-manager★ 367
Adds an archived-sessions page in Settings to search, restore, and delete archived DeepSeek Harness sessions by workspace.
Nwflower/dsh-chat-import★ 317
Import full-fidelity chat histories from 13 coding agents (Claude Code, Codex, ChatGPT, Cursor, Gemini, opencode, and more) as resumable DeepSeek Harness sessions, with reverse export back to Claude Code.
SiriLee/dsh-rewind★ 279
Conversation rewind: one click back to any earlier user message, in the same window — no new branch, no leftover copy; the target message is refilled into the composer, with optional workspace-file restore — the full Claude Code /rewind semantics.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.