my-dsh-plugin/agent-mode-switcher ↗★ 0
dsh-agent-mode-switcher
DeepSeek Harness plugin: switch the current conversation's agent preset (mode) after the model finishes answering, and keep chatting in the same session
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:my-dsh-plugin/agent-mode-switcher说明文档
阅读完整 README ↗dsh-agent-mode-switcher
DeepSeek Harness 插件:模型回答完毕后,在当前会话中切换 agent preset(模式), 并继续同一段对话。
功能
会话标题栏本来就展示当前会话运行的模式(agent preset)——标准模式 / PTC 模式 /
极简模式或自定义预设。在原生 harness 里,对话一旦开始这个标签就只读,因为
agentPreset.select 会拒绝所有非空白会话。本插件:
- 替换随附的标题栏标签,变成可交互的切换芯片(同一个
conversation.session.header.actions单元格,idagent-preset)。 - 选择其他模式走标准
agentPreset.selectRPC,把当前会话的 agent 重新组装到 目标 preset。会话、历史与 workspace 原地不动——只换工具/提示词组合,并且 选择会写进会话日志,resume 或 fork 时重建同一模式。select 的应答会立即 更新会话摘要(与随附 seat 的做法一致),标题栏芯片无需刷新页面即可显示 新模式。 - 模型回答中芯片禁用,宿主在回合运行期间也会拒绝切换。新建的空白会话 (hero 阶段会隐藏会话标题栏)会在输入框工具行里出现一个紧凑切换器, 显示部署默认模式,直到选定模式为止。
依赖
harness 目前还没有随上游发布「空闲会话可切换模式」的能力,所以今天需要一个
打了随附补丁的 deepseek-harness 源码检出。未打补丁的 harness 对已开始的
会话仍会回答 agent-preset-locked,切换器无法改模式。
安装
插件本身不需要构建。 仓库把构建好的 host 入口和浏览器 bundle 提交在
lib/ 里,安装就是克隆/拉取加一条 CLI 命令——不需要在本仓库 pnpm install,
不需要 prepare 脚本,也不需要 allowBuilds 审批。整个流程里唯一要构建的是
第 1 步给 harness 打补丁后的 harness 自身。
1. 给 harness 打补丁
在本仓库目录下,对 deepseek-harness 源码检出执行:
node scripts/apply-patch.mjs /path/to/deepseek-harness
cd /path/to/deepseek-harness
npm run build:lib:host
补丁(patches/dsh-agent-preset-mid-conversation-switch.patch)把
agentPreset.select 的守卫从「仅空白」放宽为「未在运行回合」,让已开始但空闲
的会话也能切换模式。它是纯增量改动——空白会话的既有行为不变。
2. 安装插件(无需构建)
本地克隆(推荐迭代用)——以 link 方式安装,直接使用已提交的 lib/;
在克隆里 git pull 即可更新插件,无需任何构建:
git clone https://github.com/my-dsh-plugin/agent-mode-switcher.git
pnpm dsh plugin add --profile web /path/to/agent-mode-switcher
(dsh CLI 来自你的 harness 检出;若 DSH_HOME 不是默认的 ~/.dsh,请设置。)
直接走 git——pnpm 拉取仓库并使用已提交的 lib/,不会执行构建脚本:
pnpm dsh plugin add --profile web github:my-dsh-plugin/agent-mode-switcher
dsh plugin add 会添加依赖并整理 dsh.profile.bundles 列表。手动等价做法是
编辑 profile 的 package.json: