Bundle
dsh-plugin-session-delete
Delete the current session from the conversation header — removes the live session and its persisted directory
- Source
- chuling-lingling
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 8 hours ago
Readme
# dsh-plugin-session-delete 给 DeepSeek Harness (dsh) 补上**删除会话**能力 —— 入口只有一个:会话页面顶部 **Session log 左边的「Trash」胶囊按钮**(垃圾桶图标 + 文字,与 Session log 同款式同排设计),删除当前会话。 ## 它解决什么问题 dsh 0.1 没有删除会话的功能:侧边栏三点菜单只有 重命名 / 分叉 / 归档,API 没有 delete 路由,JSONL 持久层是 append-only 的。归档只是隐藏,数据一直留在磁盘上。这个插件把删除补齐:**同时移除内存中的会话和 `~/.dsh/sessions/<项目>/<会话ID>/` 磁盘目录**,删除后会话从所有打开的页面上实时消失,重启后也不会复活。 ## 工作原理 dsh 的三点菜单(重命名/分叉/归档)是内置前端的硬编码数组,没有开放插槽;会话头部的工具区有官方开放插槽 `conversation.session.header.utilities`(Session log 就在那里),删除按钮注册在同一排: - **宿主端**(本插件的 node 半边):注册设置命名空间 `session-delete` 作为删除队列(内部通道,不在设置页渲染卡片);浏览器把会话 ID 写进 `pending`,宿主逐个处理 —— 从会话仓库摘除(触发 `session/disposed` 事件,API 代理会把它推给所有打开的客户端,侧边栏实时移除),再删除磁盘目录。 - **浏览器端**(本插件的 web 半边,经 `dsh.client` 声明分发):在会话头部 `conversation.session.header.utilities` 插槽注册 Trash 按钮,删除**当前会话**。 ## 使用 打开会话 → 顶部标题行、Session log 按钮左边 → Trash → 确认 → 会话删除,界面自动切走。 删除会同时从列表和磁盘上消失;正在运行的会话会被强制终止。设置页没有删除入口。 ## 环境要求 / 安装 / 卸载 ```bash # 从 GitHub 直接安装(推荐) dsh plugin --profile web add github:chuling-lingling/dsh-plugin-session-delete # 卸载 dsh plugin --profile web remove dsh-plugin-session-delete ``` 安装后重启 `dsh web` 即可生效。前置要求:dsh 0.1.x、pnpm(`npm install -g pnpm`)。 ## 安全设计 - 会话 ID 先过白名单校验(`session-` 前缀 + 受限字符集)才会接触文件系统,没有路径注入面 - 删除"刚创建的会话"时目录可能晚于删除落盘,插件会延迟复查一次,保证目录不会漏网 - 单次队列上限 50 个,处理结果写入 `log`(最近 50 条,在 `~/.dsh/settings.yaml` 的 `session-delete` 段)供核查 - 一切失败(会话不存在、目录缺失、删除出错)都降级为日志行,不会中断队列 ## 已知边界 - 删除**不可恢复**,确认弹窗是唯一防线 - 侧边栏三点菜单(重命名/分叉/归档)是内置前端的硬编码菜单,插件体系没有开放插槽;删除按钮放在了会话头部操作区 - 头部按钮只在非空白会话显示(空白会话的头部本身是隐藏的);空白会话发一条消息后即可删除 - 当前打开着的、被删除的会话,其聊天视图会随之失效并自动切换 - 没有批量列表:要删其他会话,打开那个会话再点 Trash,彻底程度与原先设置卡片相同(同一条删除队列) ## 包内容 / 发布 `lib/index.js`(宿主半边)+ `lib/client.js`(浏览器半边)+ `cordis.patch.yml` + `package.json`(`dsh.bundle` 注册插件行,`dsh.client` 声明浏览器模块)。发布流程与 reasoning-efforts 插件一致:`npm pack --dry-run` 检查后 `npm publish`。 ## 变更记录 - **0.3.0** 去掉设置页「会话删除」卡片;只保留聊天页 Trash,删除仍走同一队列(内存 + 磁盘) - **0.2.2** 按钮移入 Session log 所在的头部工具插槽,两者同排相邻,间距精确 1cm(38px) - **0.2.1** 按钮改为与 Session log 同款的胶囊设计(垃圾桶图标 16px + “Trash” 文字,悬停效果,与 Session log 保留间距) - **0.2.0** 新增会话头部删除按钮(Session log 左边的垃圾桶小按钮,官方 `conversation.session.header.actions` 插槽) - **0.1.0** 初始版本:设置卡片 + 删除队列;内存摘除 + 磁盘目录删除;创建窗口边缘情况的延迟复查 ## 许可证 MIT
Install
dsh plugin --profile web add github:chuling-lingling/dsh-plugin-session-delete
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-plugin-session-delete from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.