Session management for DeepSeek Harness: list every stored session with its on-disk size, search by title, session id, kind tag, workspace or agent preset, and group them by age or by workspace. Permanently delete one or many at once — the log artifact, the workspace account entry and the search index rows — behind a two-step confirm, with a re-check after every deletion. Subagent sessions can be shown on demand; Side Chat threads stay hidden, and sessions live in the current app run are refused until restart.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:BakaCirno233/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) 插件:在 设置 → 会话管理 中列出所有会话,并永久删除不需要的会话。
功能
删除语义
- 删除该会话的持久化日志(
~/.dsh/sessions/<项目>/<session-id>/) - 从所有工作区的会话账目中摘除(
workspaceRegistry.detachSession) - 搜索索引(SQLite FTS)在下一次查询时自动同步清理
- 两步确认防误删;删除前后都会校验,删除后验证持久化列表不再包含该会话
- 每次删除都写日志(成功
info、异常warn);工作区账目摘除失败会作为warnings回传界面,而不是被静默吞掉
活动会话限制:本次启动中打开过的会话(包括正在查看的当前会话)会被拒绝删除——活动 Agent 会重写日志,删除不彻底。重启应用后这些会话变成冷会话,即可正常删除。历史会话(此前运行留下的)随时可直接删除。
列表与批量操作
- 子代理会话:DSH 的会话列表默认隐藏
origin: "subagent"的会话。勾选 「显示子代理会话 (N)」 即可列出它们(N 是当前被隐藏的数量)。 - 侧边对话隔离:better-sidebar 的 Side Chat 线程同样带
subagent标记,但它们不是子代理。本插件按Side:标题前缀识别,永远不显示——删掉它会让侧边栏那个对话标签页变成孤儿。 - 搜索:匹配标题、会话 ID、类型标签(
子代理/subagent、主会话/main)、工作区路径、以及 agent preset(qq-chat、cordis等)。输入子代理(或其前缀agent)会自动放开隐藏,一次列出全部子代理会话。 - 分组:下拉切换 按时间(今天 / 近 7 天 / 近 30 天 / 更早)或 按工作区(会话创建时的
cwd,按会话数量降序;无 cwd 的归入「未知工作区」)。 - 批量选中:整组勾选 / 全选 / 单行勾选三级。选中范围严格跟随屏幕上可见的条目——被搜索词或隐藏开关过滤掉的会话不会混进批量删除。分组标题右侧显示该组数量与合计占用。
- 批量删除:逐个串行请求并显示进度(
删除中 12/357),单条失败只计入失败数、不中断整批,结束后汇总成功与部分失败。 - 占用大小:每行显示该会话日志文件的体积,便于判断先清理哪个。
安全设计
- 删目录有守卫:递归删除会话目录前校验「目录名 == 会话 id」(DSH 一直如此命名)。一旦路径形态变化导致不匹配,就只删日志文件并记一条
warn,绝不盲目rm -r——那可能带走整个工作区分组。 - 定位失败不再假装成功:
sessionPersistence.locate()抛错时返回失败,而不是当成「没有产物」。 - 状态未知即禁用:host 列表接口不可用时,界面显示错误提示并禁用所有删除按钮,不会把「拿不到活动状态」当成「全都是冷会话」。
- 请求有超时:前端请求 20 秒超时(
AbortController),host 无响应不会把界面永久锁死。
兼容性
| 宿主 | 状态 |
|---|---|
DSH Desktop 2.0.18 / 内核 0.2.1-rc.2 |
✅ 已验证(安装门禁与所用 API 均通过) |
DSH Desktop 2.0.10 / 内核 0.1.5-rc.2 |
✅ 已验证(sessionPersistence.list() 返回 snapshot,本插件按 snapshot.header 读取) |
内核 < 0.1.5-rc.2 |
❌ 不支持。该代 list() 返回的是裸 header,本插件取不到 id |
宿主代次由
package.json的engines.dsh(>=0.1.5-rc.2 <0.3.0-0)统一声明。DSH 的安装门禁优先读engines.dsh,存在该字段时peerDependencies里的@deepseek-ai/dsh-*不再参与判断——内核升代只改这一处即可,不必逐条改 peer。这条下界来自 2.0.10 的服务语义变化:
sessionPersistence改为按SessionHandle(create/open)寻址,list()返回{ header, sizeBytes, revision }快照。若你的 DSH 更老,请先确认list()的返回结构再装。
安装
在目标 profile 的 package.json(例如 ~/.dsh/profiles/desktop/package.json)中加入依赖与 bundle:
{
"dependencies": {
"dsh-session-delete": "github:BakaCirno233/dsh-session-delete"
},
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"@deepseek-ai/dsh-web-app",
"…其他插件…",
"dsh-session-delete"
]
}
}
}
然后在 profile 目录执行 pnpm install,重启 DSH 应用。
使用:设置(齿轮)→ 会话管理。
本地开发(file: 依赖)
"dependencies": {
"dsh-session-delete": "file:<本仓库的绝对路径>"
}
pnpm install 后改 lib/ 里的代码,重启应用即可生效。
注意:
file:依赖在 profile 的node_modules下是副本而不是符号链接。改完仓库代码后需要重新pnpm install(或手动把lib/*.js复制过去),否则运行的仍是旧代码。
结构
lib/index.js— Host 半部:在本地webServer注册两个路由POST /api/session-delete/list→{ sessions: [{ sessionId, live, running, sizeBytes?, agentPreset?, cwd? }] }POST /api/session-delete/delete→{ ok, code?, message?, warnings? }- 文件删除直接使用
node:fs/promises(rm),无需子进程 - 列表结果带 5 秒缓存,避免反复刷新时重复扫描全部会话;删除成功后立即失效
lib/client.js— 浏览器半部:settings.section的「会话管理」页,通过fetch调用宿主路由cordis.patch.yml— 把宿主插件行插入组合(宿主半部)package.json的dsh.client声明让 Web 端自动发现lib/client.js
更新记录
2026-10-26 — 兼容 DSH 2.0.18(内核 0.2.1-rc.2)
修复
- 安装被拒(界面提示宿主版本不对):
peerDependencies里的^0.1.0-rc.5在语义化版本下封顶于0.2.0-0,而 DSH 2.0.18 的内核是0.2.1-rc.2,6 条@deepseek-ai/dsh-*peer 全部不满足,安装 preflight 因此拒绝。现在改用engines.dsh(>=0.1.5-rc.2 <0.3.0-0)统一声明宿主代次;6 条 peer 同步更新为^0.1.5-rc.2 || ^0.2.0-rc.2(仅供包管理器参考,门禁以engines.dsh为准)。 - 版本号
1.0.0→1.0.1:宿主按精确版本判断是否更新,不 bump 的话 pnpm 会认为装上的还是旧版。
验证
- 用宿主自带的
evaluatePluginCompatibility()(@deepseek-ai/dsh-app-boot,运行版本0.2.1-rc.2)实测:旧 manifest 被上述 6 条拒绝,新 manifest 通过。 - 复核
0.2.1-rc.2的相关 API:sessionPersistence.list()仍返回{ header, sizeBytes, revision }、locate()仍返回{ kind, path }、webServer.register({ kind: "exact", path, handler })、workspaceRegistry.detachSession()、客户端settings.section槽位与window.__ModuleLoader__协议均未变。
2026-09-14 — 兼容 DSH 2.0.10(内核 0.1.5-rc.2)
兼容
- DSH 2.0.10 改动了
sessionPersistence.list()的返回结构:从 header 数组变为 snapshot 对象数组({ header, sizeBytes, revision })。直读 snapshot 的id会拿到undefined。现在改走snapshot.header取出 id/cwd/agentPreset,sizeBytes则直接取 snapshot 自带的(后端已经stat好了,删掉了独立的sizeOf函数)。
修复
- 递归删除会话目录缺少守卫:现在要求目录名等于会话 id,否则只删日志文件并记录警告
sessionPersistence.locate()失败不再被当作「没有产物」而静默返回成功- 工作区账目摘除(
detachSession)失败不再被吞掉,改为回传warnings并写日志 - host 状态探测失败时,不再把全部会话渲染成可删除
新增
- 「显示子代理会话 (N)」开关;Side Chat 线程始终隐藏
- 批量选中(整组 / 全选 / 单行)与批量删除,带实时进度与失败计数
- 搜索:标题、会话 ID、类型标签、工作区路径、agent preset
- 分组:按时间或按工作区,均支持整组选中并显示组合计
- 列表显示会话占用大小;host 列表接口新增
sizeBytes/agentPreset/cwd - 删除操作写日志(成功
info/ 异常warn)
改进
- 前端请求加 20 秒超时,避免 host 无响应时界面锁死
- host 列表接口加 5 秒缓存,删除后立即失效
License
Links
More in this category
Minglink/dsh-infinite-gen-4★ 3781
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.
ranxianglei/billion-context★ 3598
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).
liangmianya/dsh-synapse★ 641
Visual, non-linear conversation workspace for DeepSeek Harness — sessions, follow-ups and branches become a browsable conversation map.
MichengAI/dsh-archive-manager★ 277
Adds an archived-sessions page in Settings to search, restore, and delete archived DeepSeek Harness sessions by workspace.
Nwflower/dsh-chat-import★ 275
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★ 227
In-place conversation rewind in the same session window without forking (Claude Code /rewind semantics): a per-message ↶ button cuts the model context back to any user message, with an optional Claude-Code-style file restore from disk-persisted before-backups.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.