最近会话 · Recent Sessions for DSH
在 DeepSeek Harness Web 界面的左侧栏底部,常驻一个可折叠的「最近会话」分栏: 按最近活动时间倒序列出你最近互动过的会话,点一行直接切回该会话。
A persistent, collapsible recent-sessions panel for the DeepSeek Harness Web sidebar.
功能
- 常驻展开:在左侧栏底部(Settings 正上方)占真实布局高度,默认展开,不浮在内容上。
- 可折叠:点标题行折叠/展开,选择记在浏览器
localStorage,刷新后保持。 - 最近互动优先:按会话最近活动时间倒序,最多 8 条;自动排除子代理会话与从未提问的空白会话。
- 一行直达:点任意会话行即切回该会话(等价于在侧栏点会话)。
- 运行中指示:正在运行的会话在标题前显示 ⏳,并以 CSS 动画旋转;遵循
prefers-reduced-motion(系统开启「减少动态效果」时停转)。 - 实时更新:直接订阅 Harness 的会话目录快照,会话活动变化即时反映。
- 跟随界面:中英文文案、明暗主题(只用
--dsw-alias-*主题 token);侧栏收成 56px 竖条时缩成时钟图标,点击可展开侧栏。
侧栏底部示意(展开状态):
┌─ 左侧栏 ────────────────────┐
│ 品牌 / 新建会话 │
│ 工作区与会话浏览(原有区域) │
│ │
├─────────────────────────────┤
│ 🕐 最近会话 8 ⌄ │
│ ⏳ 项目重构方案讨论 3 分钟前 │
│ 数据库迁移脚本 2 小时前 │
│ 周报整理 昨天 │
├─────────────────────────────┤
│ ⚙ 设置 │
└─────────────────────────────┘
安装
环境要求
- 已安装 DeepSeek Harness 的 Web GUI 版本;
本插件在
0.2.2-rc.1上验证,0.2.1-rc.5亦可运行。 - 无 npm 依赖、无构建步骤(插件就是一个纯 JavaScript 的 Client bundle)。
方式一:让 Harness 助手安装(推荐)
git clone https://github.com/LoneyKnight/dsh-recent-sessions-panel.git
然后在 DeepSeek Harness 的对话里让助手把这个目录装到当前 profile:
用
plugin_manager的install_bundle安装C:\path\to\dsh-recent-sessions-panel(填克隆下来的绝对路径)
安装成功返回 application: applied,左侧栏底部即可看到「最近会话」分栏。
方式二:手动安装(高级)
在 profile 的
package.json依赖中加入指向本仓库的 link,例如:"@local/recent-sessions-panel": "link:C:/path/to/dsh-recent-sessions-panel"把
"@local/recent-sessions-panel"加入同一文件里的dsh.profile.bundles数组。在 profile 目录执行
pnpm install,然后重启 DeepSeek Harness。
卸载
在插件管理面板停用/移除该 bundle,或让助手执行 plugin_manager → remove_bundle,
目标为 @local/recent-sessions-panel。
使用
- 分栏始终显示在左侧栏底部;点标题行(或右侧箭头)折叠/展开。
- 点会话行切回对应会话。
- 运行中的会话标题前会出现旋转的 ⏳。
- 侧栏收起时,行内图标变为一个时钟按钮;点击会展开侧栏并显示分栏。
设计说明
- 席位:注册到
sidebar.footer.action(additive 席位),因此不会替换 Harness 自带的 工作区/会话浏览区。该席位位于侧栏 footer 的 flex 纵向容器中、Settings 之上,所以能拿到 真实布局高度:展开时列表把上方浏览区向上压缩,折叠后让出空间。 - 为什么不改
sidebar.workspaces:那是「替换席位」,注册进去会整体顶掉自带工作区浏览器。 - 数据:读取槽位框架的根级
useSessionsHook(Session Controller 的会话目录快照), 不额外请求 Host;排序时间取目录行的updatedAt。 - 导航:走 Client 服务
uiWorkspace.openSession(sessionId),与侧栏点会话行等价。 - 样式:组件内联
<style>,颜色全部使用--dsw-alias-*主题 token,随明暗主题切换。 - 文案:通过 Client locale 服务注册
zh/en两套字典。 - 折叠状态:
localStorage键dsh.recent-sessions.collapsed(1折叠 /0展开)。
仓库结构
| 文件 | 作用 |
|---|---|
package.json |
bundle 清单:dsh.bundle.patch + dsh.client(Web 模块、激活顺序、显示资源) |
cordis.patch.yml |
插入一行 Host 插件(无 Host 行为,仅承载 bundle) |
index.js |
Host 半区:apply() 为空,功能全部在浏览器端 |
client.js |
浏览器半区:注册 sidebar.footer.action 席位,渲染常驻分栏 |
locale/zh.json、locale/en.json |
插件管理面板显示的标题/描述 |
icon.svg |
原创图标(蓝底白色时钟) |
可调参数
都在 client.js:
| 想要 | 改哪里 |
|---|---|
| 列表条数 | MAX_ROWS(默认 8) |
| 列表高度上限 | STYLES 中 .dsh-recent-list 的 max-height(默认 224px) |
| 运行中符号 | RUNNING_BADGE(默认 ⏳) |
| 旋转速度 | .dsh-recent-running 的 animation: dsh-recent-spin 1.1s ... |
| 折叠持久化键 | COLLAPSED_KEY |
开发
本插件通过 link 方式安装到 profile 后,修改 client.js 保存即可:dsh-client-hmr 的文件
监听会在约 1 秒内把新版本热加载进已打开的页面,无需重启。提交前可做语法检查:
node --check client.js
node --check index.js
兼容性与限制
- 依赖 Harness 的 Client 槽位(
sidebar.footer.action)与根级 Hook(useSessions、uiWorkspace);Harness 大版本升级后如相关接口变化,可能需要小幅适配。 - 仅 Web GUI 生效;纯 CLI/无浏览器环境不显示。
- 未提供自动化测试(UI 插件,依赖人工验证)。
English
Recent Sessions adds a persistent, collapsible "Recent sessions" section to the bottom of
the DeepSeek Harness Web sidebar (above Settings). It lists up to eight conversations you
interacted with most recently, with relative timestamps; running conversations show a
spinning ⏳; clicking a row opens that session. The section is expanded by default, can be
collapsed from its header, and remembers that choice in localStorage.
Install: clone the repo, then let the Harness assistant run plugin_manager →
install_bundle with the cloned directory as the target (or add it as a link: dependency
in your profile and include the package name in dsh.profile.bundles). No npm dependencies
or build step required.
License
MIT © 2026 LoneyKnight
No comments yet. Be the first to write one.