dsh-moving-context:在 DeepSeek Harness 工作区间移动会话

前言

DeepSeek Harness(DSH)默认只提供 attachSession / detachSession / insertSessionBefore,没有跨工作区移动会话的能力,界面上也没有拖拽入口。对于需要在多个工作区之间整理对话的用户,这一点比较约束。dsh-moving-context 插件在 DSH 官方接口的基础上补上了这个缺口,提供了 CLI、图形插件与 skill 三种调用方式,让会话可以在工作区之间自由移动。

这是什么

dsh-moving-context 是一个为 DeepSeek Harness 提供会话跨工作区移动能力的插件与工具集。维护者是 muzi18273909375-cell,分类为客户端插件。它通过修改会话目录的第一帧 header cwd、工作区成员表(workspace.json)以及侧栏显示的 projcache,让会话在三个位置保持一致,并在重启后真正出现在目标工作区中。

核心功能

  • 插件(图形):在侧栏会话行的 ⋯ 菜单中新增「移动此聊天…」选项,选择目标工作区后即时生效。
  • 命令行:支持 --list 查看工作区与会话,--move … --to … 执行移动,--dry 预演,--verify 校验,--json 输出机器可读格式。
  • skill:将命令行逻辑打包为 skill,供 agent 自主调用。
  • 安全与回滚:会话 ID 白名单、写入原子化、失败自动回滚、备份目录保存原始会话与配置。

安装与启用

0. Node.js 版本

运行前需满足 Node.js ≥ 22.15(内置 zstd)。

# Windows
winget install OpenJS.NodeJS.LTS
node -v
# macOS(或 nvm)
brew install node
node -v

1. 拉取代码

git clone https://github.com/muzi18273909375-cell/dsh-moving-context.git
cd dsh-moving-context
node src/move-session.mjs --help

2. 安装图形插件

Windows

xcopy /E /I . "%USERPROFILE%\.dsh\plugins\dsh-moving-context"
# 编辑 %USERPROFILE%\.dsh\profiles\desktop\package.json:
#   dependencies 里加       "dsh-moving-context": "link:C:/Users/<你的用户名>/.dsh/plugins/dsh-moving-context"
#   dsh.profile.bundles 里加 "dsh-moving-context"
cd "%USERPROFILE%\.dsh\profiles\desktop"
pnpm install

macOS

mkdir -p ~/.dsh/plugins && cp -r . ~/.dsh/plugins/dsh-moving-context
# 编辑 ~/.dsh/profiles/desktop/package.json:
#   dependencies 里加       "dsh-moving-context": "link:/Users/<你的用户名>/.dsh/plugins/dsh-moving-context"
#   dsh.profile.bundles 里加 "dsh-moving-context"
cd ~/.dsh/profiles/desktop && pnpm install

安装完成后完全退出 DeepSeek Harness 再打开。插件在启动时加载,装完不重启不会出现。

3. 安装 skill(可选)

xcopy /E /I skill "%USERPROFILE%\.dsh\skills\dsh-moving-context"
mkdir -p ~/.dsh/skills/dsh-moving-context && cp -r skill/. ~/.dsh/skills/dsh-moving-context/

4. 验证

node src/move-session.mjs --list

界面上:侧栏会话行右侧 ⋯ → 菜单中有「移动此聊天…」。

典型用法

插件方式(无需退出工作台)

  1. 在侧栏会话行右侧点击 ⋯。
  2. 选择「移动此聊天…」。
  3. 在弹出的工作区列表中选择目标工作区。

命令行方式(需完全退出 DSH)

# 1) 列出工作区与会话
node src/move-session.mjs --list

# 2) 预演(不写盘)
node src/move-session.mjs --move "会话标题关键词" --to "目标工作区名称" --dry

# 3) 执行移动(支持逗号分隔多个会话)
node src/move-session.mjs --move session-90d0ddd1,session-60c6acee --to 6dd9307b-a7bf-45aa-9730-f2ba5aeff5a2

# 4) 校验会话
node src/move-session.mjs --verify session-90d0ddd1

skill 方式(agent 自调)

将 skill 目录放入 ~/.dsh/skills/dsh-moving-context 后,agent 可直接调用其提供的命令行接口。

适用场景与注意事项

  • 适合:需要在不同工作区间整理会话、批量迁移会话、让 agent 自主管理会话位置。
  • 注意事项:
  • 命令行方式必须完全退出 DeepSeek Harness 再运行,否则可能被内存中的旧状态覆盖 workspace.json。
  • 插件方式会在运行时通过内存成员表与索引重建生效,无需退出。
  • 插件接口为本地回环,不接受跨域请求,仅接受 application/json。
  • 第一帧必须恰好只有一行 header,否则会话可能被过滤掉且无报错。
  • 路径比较使用 realpath,Windows 上注意全角字符与大小写差异。
  • 建议在执行前用 --dry 预演,并在 session-move-backup/ 中保留备份以备回滚。

总结

dsh-moving-context 在 DeepSeek Harness 缺失的会话跨工作区移动能力上提供了完整的三种调用方式,兼顾图形操作与脚本化能力。通过修改会话目录、工作区成员表与侧栏缓存三处数据,并在安全与回滚机制上做了加固,使得会话搬家既可控又可追溯。安装与使用流程清晰,适合需要在多工作区间维护会话结构的用户。

  • 目录页:https://www.skillhub.cn/plugins/muzi18273909375-cell/dsh-moving-context
  • GitHub:https://github.com/muzi18273909375-cell/dsh-moving-context
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜