DeepSeek Harness Plugin

tongqing1130-png/dsh-session-delete

Stars ★ 0 Category Sessions & Messages Added 2026-11-16

Adds a "Delete conversation" item to the DSH session sidebar menu: it removes the session from disk, from the in-memory session table and from workspace references instead of archiving it, behind a native confirmation modal. Refuses any target outside $DSH_HOME/sessions/<workspace>/<session-id>. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

Install

# from a prebuilt release tarball

dsh plugin --profile web add "https://github.com/tongqing1130-png/dsh-session-delete/releases/latest/download/dsh-session-delete.tgz"

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:tongqing1130-png/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 原生只能「归档」会话,归档后日志仍留在磁盘上。这个插件在会话右键菜单里插一项删除对话:原生 MenuItemButton 危险色 + 原生 Modal 二次确认,确认后把会话从磁盘目录、内存会话表、工作区引用三处一起清掉,列表即时消失,不用重启 DSH。

右键会话 → 🗑 删除对话 → 「彻底删除这个对话?」→ 删除对话

安装

方式一:插件市场(推荐)

设置 → 插件市场 → 搜索 dsh-session-delete → 安装 → 重启一次 DSH。

装好后它出现在「已安装」列表里,右侧开关可随时开 / 关(热切换,不用重启)。

方式二:手动挂载(本地开发)

cd ~/.dsh/profiles/desktop                  # Windows: C:\Users\<你>\.dsh\profiles\desktop
mkdir -p local-plugins && cd local-plugins
git clone https://github.com/tongqing1130-png/dsh-session-delete.git

在 profile 的 package.json 里加依赖(link: 让 node_modules 变软链,改源码立即生效):

{
  "dependencies": {
    "dsh-session-delete": "link:./local-plugins/dsh-session-delete"
  },
  "dsh": {
    "profile": {
      "bundles": ["...", "dsh-session-delete"]
    }
  }
}

再在 profile 根目录 cordis.patch.yml 末尾追加一行覆盖行(不要写 - insert:,会和包自带的 insert 重复挂载导致 404):

- id: dsh-session-delete
  disabled: false

然后 pnpm install,重启 DSH。

它是怎么删的

步骤 做什么
1 agents.get(id).cancel() —— 会话还在跑就先取消
2 sessions.liveEntryFor(...).detach() —— 从内存会话表移除并广播 session/disposed
3 定位磁盘目录:扫 sessions/*/<id>;IM 会话的 id 含 : @,目录名是 im~003A... 编码形式,靠 persistence.locate() 兜底
4 assertSafeDir() 结构校验:只允许删 $DSH_HOME/sessions/<工作区键>/<会话 id> 这一层,其余一律拒
5 rmWithRetry():EBUSY / EPERM / EACCES / ENOTEMPTY 退避重试 8 次,仍失败则改名成 <dir>.deleting-<ts>,不阻塞后续
6 工作区清理:registry.unarchiveSession() / unpinSession() + 逐实体 ws.detachSession()
7 纯内存、尚未落盘的会话直接按 memoryOnly: true 算删成功

会话 id 只接受 ^[A-Za-z0-9._:@-]{3,200}$,HTTP 路由只接受 localhost Host,不对外暴露。

HTTP 接口

方法 路径 说明
GET /session-delete/api/ping 存活探针,返回 build 标记
GET /session-delete/api/list 会话清单(id / 标题 / 磁盘路径 / onDisk)
POST /session-delete/api/delete { sessionId } → { ok, removed, diskRemoved, memoryOnly?, cancelled, detached }

浏览器控制台兜底:__dshListSessions() / __dshDeleteSession(id)。

目录结构

dsh-session-delete/
├─ package.json          dsh.bundle + dsh.client 声明,市场识别用
├─ cordis.patch.yml      bundle 层挂载行(insert id = dsh-session-delete)
├─ icon.svg              市场卡片图标(跟随主题色)
├─ lib/index.js          宿主半边:HTTP 路由 + 删除逻辑
├─ lib/client.js        界面半边:插槽菜单项 + 原生确认框
├─ INSTALL.md           安装与结构详解(含市场三件套规则)
└─ LICENSE              MIT

改代码后的生效方式

  • 界面半边 lib/client.js:浏览器 Ctrl+Shift+R 硬刷新。
  • 宿主半边 lib/index.js:改 package.json 或 cordis.patch.yml 的内容触发 HMR reconcile(只 touch 改 mtime 会被跳过);涉及 ESM 缓存时重启 DSH 最稳。

兼容

  • DSH >= 0.2(用到 sessions.liveEntryFor / slots / shell.overlay 插槽)
  • Node >= 20,无第三方依赖

License

MIT © 2026 Dizrt1001

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.