rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:sczHiccup/dsh-session-deleter
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
一个给 DeepSeek Harness 用的会话删除插件:在确认风险之后,彻底删除一个会话。
中文 | English
DeepSeek Harness 的侧栏只能「归档」会话,归档只是把会话从导航里隐藏,会话日志仍然留在磁盘上。
@deepseek-ai/dsh-session-persistence-jsonl 的文档明确写着:没有任何东西会删除会话文件,持久化接口也没有删除 API。
这个插件补上这一步:确认之后停止仍在运行的工作,并删除该会话自己的日志与投影缓存。
... 菜单里的「删除会话」 —— 与内置的「重命名 / 归档 / 固定」同处一个菜单,带危险色与分隔线。Esc、点遮罩、取消关闭,并在关闭后把焦点还给原控件。parentSession 指向它的子会话(子代理产生的会话,可跨多层)会一并删除。这些子会话在 UI 里没有独立入口,父会话消失后没人能再访问它们,留着只会变成不可见的磁盘残留。插件是一个本地 bundle,需要一个已安装的 DeepSeek Harness 环境。
git clone https://github.com/sczHiccup/dsh-session-deleter.git
然后让当前的 Harness Agent 把它装进当前 profile:
plugin_manager → action: install_bundle → target: <本仓库目录的绝对路径>
安装后 Harness 会按 cordis.patch.yml 插入插件行,效果对当前 profile 的每个会话生效,并在重启后保留。若界面没有立刻出现按钮,刷新一次页面即可。
... → 「删除会话」。高级用户也可以直接在输入框执行(与 UI 共用同一实现):
/delete-session <sessionId>
会删除:
| 内容 | 路径 |
|---|---|
| 会话日志(含历史格式代) | <DSH_HOME>/sessions/--<cwd>--/<sessionId>/session[.vN].jsonl[.zstd] |
| 子代理后代会话的日志 | 同上,对每个 parentSession 指向它的子会话递归处理 |
| 投影检查点缓存 | <DSH_HOME>/storages/session_projcache/sessions/<sessionId>.json(含子会话) |
| 侧栏导航入口 | 通过 Workspace 归档移出导航 |
不会删除:
dsh-session-query-sqlite 是派生库,会自动清理已消失的来源。删除操作只在 Host 侧执行,并且刻意保守:
workspaceRegistry.archiveSession(id, { stopActivity: true }) —— 和用户自己点「停止并归档」是同一套 provider,而不是自己造一套中断逻辑。--…-- 或 _no-cwd、目录名匹配会话 id、目录内只有会话日志 / session.lock / 临时文件」的目录;任何不符合的情况都会拒绝并如实报告。rmdir(非递归)收尾;目录里若还有别的文件,它会原样保留。unarchiveSession 收回。若进程先退出,下一次启动的清扫会把这些指向空会话的标记收掉,归档集合不会永久增长。sessionIds 视图会先把失效项过滤掉,看它永远发现不了残留)。没有失效记账时不会写任何状态。0.2.2-rc.3 上实机验证(最初面向 0.2.2-rc.1 编写),使用公开服务:commands、sessionPersistence、workspaceRegistry、storageDomain,以及客户端 slots、contextMenus、sessions、remote.commands。workspace.json 的 archivedSessionIds 与 sessionIds 均不再残留。--dsw-alias-* 主题令牌(危险按钮的遮罩用了 color-mix 混合令牌,随明暗主题变化)。running;取不到时只是少一条警告,删除逻辑不变。plugin_manager → action: set_plugin → target: include:session-deleter → enabled: false
plugin_manager → action: remove_bundle → target: @local/session-deleter
仓库根目录就是插件包本身:
package.json # bundle 清单 + dsh.client 声明
cordis.patch.yml # Loader 补丁(插入插件行)
index.js # Host 半:/delete-session 命令与真正的删除逻辑
client.js # Client 半:按钮、菜单项、确认弹窗
locale/{en,zh}.json # 插件管理器里显示的标题与说明
icon.svg # 插件图标
没有构建步骤,改完文件让插件行重启即可(Plugin Manager 操作会触发重载):
node --check index.js
node --check client.js
A session deleter plugin for DeepSeek Harness. Archiving a session only hides it from navigation — its log stays on disk, and the shipped persistence backend states that nothing deletes session files. This plugin adds that step behind an explicit risk confirmation.
... menu, beside the built-in rename / archive / pin actions.It removes the session's own JSONL log directory and its persisted projection checkpoint, and hides the session from navigation. Shared content-addressed attachments and the derived full-text index are left alone.
Every destructive step is guarded: it only touches a directory that proves to be the documented per-session layout, deletes files from an allow-list, finishes with a non-recursive rmdir, re-reads persistence afterwards and reports leftovers instead of claiming success. A live agent keeps its persistence handle and can write the log or the projection checkpoint back, so the same guarded removal runs again at 1.2s, 5s, 20s, 60s, and 180s. Archiving is only the way to stop running work and hide the session. A session whose Agent is still resident keeps appearing in the Host session list even after its log is gone, and runtime exposes no way to dispose another owner's Agent, so the archive mark is deliberately kept until nothing holds that session any more. Both leftovers of that design are reclaimed on the next start: the plugin reads the durable Workspace state and the projection-cache domain, and drops archive marks and cached checkpoints whose session is neither stored nor live. It also repairs the Workspace account itself: the registry only re-checks membership when its record mutates, so a deletion re-runs that decision (a title write that keeps the title) and the startup pass does the same for any account that still names a session which is neither stored nor live. Nothing is written when there is nothing stale. The durable archive set, the cache, and the workspace accounts therefore never grow without bound.
Verified on DeepSeek Harness 0.2.2-rc.3 (originally written for 0.2.2-rc.1). A real deletion through the UI removed the session's log directory and projection checkpoint, hid the session through the archive mark, kept that mark and the workspace account while the session's Agent stayed resident, and the next start reclaimed both, leaving archivedSessionIds and the workspace sessionIds clean.
Licensed under MIT.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek、deepseek-harness。