kinomoto-hakage
dsh-archived-sessions
dsh 已归档会话
- Stars
- 0
- Language
- JavaScript
- Created
- Aug 16, 2026
- Updated
- Aug 16, 2026
Introduction
dsh-archived-sessions
DSH(DeepSeek Harness)Web GUI 的「已归档会话」管理插件:在设置窗口按工作区(项目) 分组管理所有已归档的会话。
功能
- 设置侧边栏「已归档会话」入口(归档图标,需一键应用外壳补丁,见安装)
- 按工作区分组、展开/收起;工作区删除后会话进入「未分组」并标注原工作区名
- 分组标题显示归档时的工作区原名
- 显示归档时间(宿主账本 + 浏览器 localStorage 兜底)
- 每行复选框 + 全选/全不选 + 批量删除;逐条取消归档/删除
安装
方式一:从远程仓库拉取
dsh plugin --profile web add github:kinomoto-hakage/dsh-archived-sessions
dsh plugin 会在 profile 目录运行
pnpm add,并自动把声明了 dsh.bundle 的依赖加入 dsh.profile.bundles;
仓库已含构建产物 lib/,无需本机构建。
方式二:下载到本地后手动构建安装
git clone https://github.com/kinomoto-hakage/dsh-archived-sessions.git
cd dsh-archived-sessions
node scripts/build.mjs # 或 pnpm build(等价,零依赖)
dsh plugin --profile web add file:. # 从本地仓库根目录安装
或手动放置:把 lib、cordis.patch.yml、package.json 放入 profile 可解析的
node_modules/@local/dsh-client-ui-archived-sessions/,并在 profile 的
cordis.patch.yml(或 bundle 列表)插入:
- insert:
- id: ui-archived-sessions
name: '@local/dsh-client-ui-archived-sessions'
安装前若 profile 已有本插件的手工挂载行(上述 insert),需先删除,避免与 bundle 层重复注册。
外壳图标补丁(一次性)
设置侧边栏图标由官方外壳 dsh-client-ui-settings-general 的 navIcon(id) 硬编码,
插件无法自行注入。一键应用(幂等、备份、可预演):
node scripts/apply-shell-patch.mjs # 或 pnpm patch:shell;--dry-run 可预演
升级/重装该外壳包后需重新运行;卸载脚本会自动还原该补丁。
使用
- 会话菜单中「归档会话」(官方 workspace 侧边栏入口)
- 设置 → 「已归档会话」
- 展开/收起分组;勾选会话后「批量删除」,或逐条「取消归档」/「删除」
卸载
node scripts/uninstall.mjs --dry-run # 预演:只报告将要清理的内容
node scripts/uninstall.mjs # 实际卸载
node scripts/uninstall.mjs --keep-data # 保留宿主账本
Windows 下可双击 uninstall.cmd(任意目录可用;仓库删除后回退到 profile 内已安装副本)。
若由 dsh plugin 安装,先执行 dsh plugin --profile web remove @local/dsh-client-ui-archived-sessions
移除依赖登记,再运行以上脚本。卸载后重启 dsh 并清除浏览器 localStorage 键
dsh.archivedSessions.times.v1。
工作原理
- 宿主半区
src/index.js:轮询workspaceRegistry.archivedSessionIds,把归档时间与 当时的工作区名写入$DSH_HOME/storages/archived-sessions.json,经通用 Connection RPC 通道/archived-sessions(ledger.get)提供给浏览器。 - 浏览器半区
src/client/index.js:注册settings.section渲染管理界面; localStorage(dsh.archivedSessions.times.v1)在宿主账本不可用时兜底。
官方 workspace 域不保存归档时间,账本记录的是宿主/浏览器首次观察到归档的时刻 (宿主侧受 2 秒轮询间隔影响),并非服务端精确时间。
目录结构
├── src/ # 源码(index.js 宿主半区 / client/index.js 浏览器半区)
├── scripts/ # build.mjs / apply-shell-patch.mjs / uninstall.mjs
├── lib/ # 构建产物(由 src 生成并提交,便于直接安装)
├── cordis.patch.yml # bundle 补丁:插入 ui-archived-sessions 行
├── build.cmd / uninstall.cmd # Windows 启动器(任意目录可用)
├── package.json # dsh.bundle.patch / dsh.client 声明
└── LICENSE # Apache-2.0
说明
- 面向 DSH 0.1.0-rc.6;浏览器半区改动刷新页面生效,宿主半区需重启 dsh。
- 构建零依赖:仓库不提交
node_modules/ 锁文件,node scripts/build.mjs即可。 - 包名使用
@localscope(本地插件约定);发布 npm 需改名并去掉"private": true。