akira399/dsh-session-delete

从侧边栏对话菜单中永久删除 DSH 会话,无需归档隐藏,直接物理删除。

Project Overview项目介绍

dsh-session-delete is a native plugin built specifically for DSH that fills a real gap in the official client: while the stock sidebar menu only offers "Archive session", which merely hides the conversation while leaving its log files on disk, this plugin adds a brand-new "Delete session / 删除对话" entry directly underneath the archive action. Once the user confirms, the plugin uses the official sessionPersistence.locate() API to resolve ~/.dsh/sessions/<workspace-key>/session-<uuid>/, recursively removes the log directory from the filesystem, and refreshes the sidebar through the official store and event frames. It is a hard, unrecoverable delete, not a soft delete, soft mark, or tombstone.

The architecture follows DSH's documented host + client split, with lib/index.js registering a localhost-only POST /session-delete/api/delete route and lib/client.js watching the rendered role="menu" DOM to clone-inject the new item. The sessionId is resolved against three sources — the official snapshot stores ctx.sessions.list and ctx.workspaces.list, the sidebar row order, and the row's aria-label title — and is then re-validated against the strict session-<uuid> regex to prevent path traversal. For sessions currently open in memory, the plugin calls the official agents service to abort the in-flight turn, then detaches the session through the standard sessions.detach() path so the official host/session-removed frame is broadcast and the file cannot be "resurrected" by in-memory logs.

Installation is a single shell command — npx -p @deepseek-ai/dsh dsh plugin --profile web add <owner>/dsh-session-delete, optionally github:<owner>/dsh-session-delete — followed by restarting dsh web for the menu injection to take effect. The plugin ships zero third-party runtime dependencies and relies only on Node built-ins plus the official DSH injected services, so there is nothing else to configure. Users should note three caveats up front: the menu injection depends on the official "Archive session / 归档会话" label and may need updating after major DSH upgrades, attachments such as images are shared across sessions and are intentionally not removed, and deletion is permanent — the README places full responsibility for any data loss on the user. Subagent sessions under subagents/ are stored independently and must be deleted one by one. The project is released under the MIT license, declares the dsh-plugin GitHub topic, and exposes a bundle-manifest, making it a first-party extension to the DSH ecosystem.

dsh-session-delete 是一款面向 DSH 的原生插件,专门补齐官方客户端"只归档不删除"的缺口。它在侧边栏会话行 ··· 菜单的「归档对话」下方注入一项「删除对话」入口,点击确认后会通过 sessionPersistence.locate() 定位 ~/.dsh/sessions/<workspace-key>/session-<uuid>/ 目录并递归删除日志文件,属于物理层面的不可恢复删除,不是隐藏或软删除。插件采用 host + client 双端架构,host 半端注册本地路由 POST /session-delete/api/delete,client 半端监听 role="menu" DOM 并在官方快照 store 与侧边栏行序、aria-label 三重校验后定位 sessionId。

典型使用流程:通过 npx -p @deepseek-ai/dsh dsh plugin --profile web add <owner>/dsh-session-delete 安装并重启 dsh web,鼠标悬停目标会话行点击 ···,选择新出现的「删除对话 / Delete session」,二次确认后会话行立刻从列表消失。对于仍在运行中的会话,插件会先取消当前 turn,再走官方 detach() 摘除内存会话并广播 host/session-removed 帧,避免被内存日志"复活"。附件作为跨会话共享资源不会被一起删除,记账信息(workspace.json 的会话席位与全局归档集合)则会同步清理。

插件零第三方运行时依赖,仅使用 Node 内置模块与官方注入服务。已知限制:依赖官方菜单文本「归档会话 / Archive session」,客户端升级若调整该菜单文案需要同步适配;极少数情况下内存摘除不可用,需重启 DSH 才能删除打开中的会话。删除操作不可恢复,README 明确将数据损失责任归于使用者。项目以 MIT 协议发布,仓库声明 dsh-plugin 主题并提供 bundle-manifest,是 DSH 生态内的原生扩展。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:akira399/dsh-session-delete

把 akira399/dsh-session-delete 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-session-delete

在 DSH 侧边栏对话菜单中真正永久删除会话 —— 从文件系统层面删除会话日志,而不是像归档那样仅仅隐藏。

DSH 官方客户端目前只提供「归档会话」(把会话从列表隐藏,日志文件仍留在磁盘)。本插件在会话行 ··· 菜单的「归档对话」下方新增「删除对话」入口:点击并确认后,会话的日志文件会从磁盘彻底删除,不可恢复。

功能特性

  • ✅ 真实物理删除:通过官方 sessionPersistence.locate() 定位会话目录并递归删除日志文件,非隐藏、非标记删除
  • ✅ 运行中的会话也能删:自动取消正在进行的回复 → 从内存摘除 → 删除文件,删除后不会被内存日志"复活"
  • ✅ 记账同步清理:workspace.json 的会话席位与全局归档集合一并清除,不留脏数据
  • ✅ 即时刷新:删除后会话行立即消失,无需刷新页面(复用官方 store 刷新与事件帧)
  • ✅ 二次确认:删除前弹出确认框,显示会话标题并明确提示不可恢复
  • ✅ 识别准确:依据官方快照 store + 侧边栏行序 + 标题三重校验定位会话,避免误删
  • ✅ 零依赖:仅使用 Node 内置模块与注入的官方服务,无第三方运行时依赖

使用场景

  • 清理不再需要的实验性对话、临时会话,释放磁盘空间
  • 删除包含敏感内容的会话,确保日志从磁盘彻底消失
  • 归档无法满足的"彻底删除"需求(归档只是隐藏,文件仍可被搜索/导出找回)

安装

npx -p @deepseek-ai/dsh dsh plugin --profile web add <owner>/dsh-session-delete

安装完成后重启 dsh web 生效。

也可以从 GitHub 仓库地址安装:npx -p @deepseek-ai/dsh dsh plugin --profile web add github:<owner>/dsh-session-delete

使用

  1. 在左侧对话列表找到目标会话,将鼠标移到该行,点击行尾的 ··· 按钮;
  2. 菜单中「归档对话」下方点击「删除对话」(英文界面为 Delete session);
  3. 在确认弹窗中点击「确定」;
  4. 会话行立即从列表消失,磁盘上的会话日志已永久删除。

删除正在运行的会话时,会先中止该会话的回复再执行删除。

工作原理

DSH 官方没有为会话行菜单提供扩展 slot,本插件采用 host + client 双半端实现:

  • Host 半端(lib/index.js):注册本地路由 POST /session-delete/api/delete。
    • 校验 sessionId(严格 session-<uuid> 格式,杜绝路径穿越)与请求来源(仅 localhost);
    • 若会话在内存中(打开/运行):通过官方 agents 服务取消当前 turn,再通过 sessions store 的标准 detach() 路径摘除内存会话(触发官方 host/session-removed 帧),防止内存日志把文件"复活";
    • 通过官方 sessionPersistence.locate() 定位会话目录(~/.dsh/sessions/<workspace-key>/session-<uuid>/),递归删除;
    • 通过官方 workspaceRegistry 的操作队列清理记账(workspace 的 sessionIds 席位与全局归档集合),前端经官方 domain/changed 帧自动同步。
  • Client 半端(lib/client.js):监听会话菜单渲染 DOM(role="menu"),在「归档会话」下方克隆注入「删除对话」项;点击时依据官方快照 store(ctx.sessions.list / ctx.workspaces.list,与 UI 渲染同一份数据)+ 侧边栏行序定位 sessionId,并以行标题(aria-label)二次校验;确认后调用删除路由,成功后通过官方 ctx.sessions / ctx.workspaces 运行时服务刷新列表。

安全与边界

  • 删除请求仅接受来自 localhost 的访问(DSH Web 同源页面);
  • sessionId 严格校验为 session-<uuid> 格式,杜绝路径穿越;
  • 附件(图片等)是跨会话共享资源,不随会话删除,避免破坏其他会话的引用;
  • 运行中会话的删除需要先中止其回复(不可恢复的操作,确认框中已明确提示);
  • 删除的是目标会话本身;其子代理会话(subagents/)各自独立存储,如需一并删除请逐个操作。

已知限制

  • 菜单注入依赖官方客户端的 DOM 结构与「归档会话 / Archive session」菜单文本,DSH 官方升级若调整该菜单结构,本插件可能需要同步适配;
  • 会话的查询/投影缓存不强制清理,官方缓存机制会在下次读取时自愈。

常见问题

问题 说明
点击后提示"无法识别该会话" 侧边栏行与数据快照短暂不一致时可能出现;刷新页面后重试即可(控制台会输出诊断信息)
提示"该会话当前处于打开状态且无法从内存移除" 极少数情况下内存摘除不可用,重启 DSH 后即可正常删除
删除后磁盘占用没有减少 附件为跨会话共享资源,不会被删除;仅会话日志目录被移除

免责声明

删除操作不可恢复,请确认后再点击。使用本插件造成的任何数据损失由使用者自行承担;本插件仅提供删除功能,不构成任何担保。

License

MIT

← 上一个 Prev dsh-github-mcp 下一个 Next dsh-deepseek-monitor →