liangmianya/dsh-synapse
liangmianya/dsh-synapseDeepSeek Harness 的可视化非线性对话工作区:把会话、追问与分支变成可浏览、可拖拽的对话地图。
在侧栏会话菜单中加入「删除会话」,永久删除该会话的本地记录;正在运行的会话会被拒绝。
DSH(DeepSeek Harness)侧栏会话删除插件 —— 为当前运行时(0.2.0-rc.2)重写的版本,
替代插件市场里因 peer 版本范围(^0.1.0-rc.5)不兼容而装不上的 dsh-session-delete。
仓库:https://github.com/ljp888/dsh-session-delete-next
English | 中文
| 入口 | 菜单项 | 行为 |
|---|---|---|
会话行 … 菜单 | 删除会话 | 永久删除该会话的全部本地记录,不可恢复 |
要点:
409 live,对话框给出提示。api-session/removed 事件)。与旧版插件的关键差异:不再用 DOM 注入。0.2.0-rc.2 已开放官方扩展点,本插件走
标准 slot 机制,不会随侧栏结构变化而静默失效。
Host 半(index.js,纯 ESM)
inject: ['webServer'],其余服务(sessionPersistence / workspaceRegistry /
sessions / storageDomain)按请求用 ctx.get() 惰性获取,缺失时降级而不是拒绝加载。POST /dsh-session-delete-next/delete,请求体 { sessionId }。ctx.sessionPersistence.stat(id) 定位日志,locate(header).path 取路径,
删除其所在目录(含 session.lock);session.v<N>.jsonl[.zst|.zstd|.gz],
且目录必须位于持久化后端的 root 之内,否则拒绝;session_projcache 投影缓存;detachSession,并清除归档标记;ctx.emit('api-session/removed', id) 通知浏览器。Origin 直接 403。Client 半(client.js,手写浏览器 bundle,无需构建)
window.__ModuleLoader__.load({ id: '<包名>', factory }) 懒注册。sidebar.workspaces.session.menu.item(会话 … 菜单,order: 500,排在
pin/rename/fork/archive 之后);shell.overlay(确认对话框,独立于菜单生命周期)。useMenuOpenState() 关闭菜单;t() 来自 ctx.locale.register。最省事的方式是直接 clone 成 profile 的插件目录(<profile> 默认为 ~/.dsh/profiles/desktop):
git clone https://github.com/ljp888/dsh-session-delete-next.git \
~/.dsh/profiles/desktop/node_modules/dsh-session-delete-next
Windows PowerShell 对应写法:
git clone https://github.com/ljp888/dsh-session-delete-next.git `
"$env:USERPROFILE\.dsh\profiles\desktop\node_modules\dsh-session-delete-next"
然后手动复制文件也可以,步骤:
把整个包目录复制到 <profile>/node_modules/dsh-session-delete-next/
(<profile> 默认为 ~/.dsh/profiles/desktop)。
在 <profile>/cordis.patch.yml 追加一行挂载(此文件被 HMR 监听,保存后即热加载):
- insert:
- id: dsh-session-delete-next
name: dsh-session-delete-next
浏览器刷新一次即可看到菜单项。
不写入 profile 的
package.json:本包不在 npm 上,写成dependencies会让后续pnpm install/dsh plugin操作去 registry 拉取而失败。代价是将来在 profile 里跑pnpm install可能把这个目录剪掉,重装即可。
api-session/removed 自行收敛。~/.dsh/attachments/** 是内容寻址、跨会话共享的,删除会话不会动它。session.lock,rm 可能报 EBUSY;此时对话框会显示
原始错误且磁盘状态不变,重试即可。| 项目 | 结果 |
|---|---|
| 宿主端加载 + 路由注册 | ✅ ~/.dsh/logs/desktop-next.log:[dsh-session-delete-next] host ready: POST /dsh-session-delete-next/delete |
| profile 热加载(无需重启) | ✅ 追加 patch 行后 Loader 自动刷新,日志即出现上述行 |
侧栏 … 菜单出现「删除会话」 | ✅ 红色危险样式 + 分隔线,排在官方「归档会话」之后 |
| 中文 locale 解析 | ✅ 显示「删除会话」,不是原始 key |
| 确认对话框 | ✅ 标题、含会话名插值的正文、红色「永久删除」、取消 |
| 执行真正删除(成功路径) | ⚠️ 未执行 —— 原因见下 |
为什么没做破坏性实测:验证时侧栏只有一条会话,正是承载那次对话的活跃会话。
官方在 0.2.0-rc.2 没有公开「驱逐运行中会话」的 API,所以插件会拒绝删除它;
跑通「删除成功」路径需要一个非活跃会话当靶子,我不拿真实对话历史去赌。
想自行确认:新开一个会话 → 随便发一条消息 → 切回原会话 → 对那个测试会话执行删除。
删除成功的判据是 ~/.dsh/sessions/<项目目录>/<会话 id>/ 整个目录消失,且侧栏该行立即消失。
注:
index.js的 fail-closed 安全加固(sessions服务不可用时拒绝删除)不在 HMR 模块监听根内,需重启 DSH 才在运行实例中生效;之前的运行实例行为一致。
Adds the missing Delete session action to the sidebar session row menu of DSH
0.2.0-rc.2, replacing the marketplace dsh-session-delete whose peer range
(^0.1.0-rc.5) no longer resolves.
409 live) — they are never deleted.api-session/removed forwarded event.Unlike the original plugin this uses the official slots rather than DOM
injection: sidebar.workspaces.session.menu.item for the menu row and
shell.overlay for the dialog. Files are removed before any bookkeeping, so a
failure never leaves a session that is hidden but still on disk.
Install: clone this repository straight into the profile's plugin directory —
git clone https://github.com/ljp888/dsh-session-delete-next.git ~/.dsh/profiles/desktop/node_modules/dsh-session-delete-next
— then append the - insert: row to <profile>/cordis.patch.yml and refresh the
page. The profile package.json is deliberately left untouched because this
package is not published to npm.
MIT