DeepSeek Harness 插件

dsh-preset-switcher

DSH web plugin: switch the current session's agent preset (mode) at any time, even after the conversation has already started - the stock UI refuses that. Provides a session-header dropdown plus a(英文原文)

跳到安装方式

来源信息

GitHub 仓库
jeffcwj/dsh-preset-switcher
最近更新
2026年8月17日
分类
自动化与任务
GitHub stars
0
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/jeffcwj/dsh-preset-switcher
插件名:dsh-preset-switcher
作者:jeffcwj

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器2 个文件
README.md来源说明 · 只读预览

dsh-preset-switcher

> [English](#english) | 中文

---

<img width="656" height="350" alt="image" src="https://github.com/user-attachments/assets/c9ecdb1a-446e-48a8-825d-a3e495ff773b" />

概述

DSH Web 插件:在任何时候切换当前会话的代理预设(模式),包括对话已经开始之后 — 原生 UI 不允许这样做("已开始的对话的代理预设已固定")。

核心功能

  • 顶部下拉菜单:会话标题操作栏中的「当前模式 ▾」按钮,列出所有预设(如 standard=标准模式、code=PTC 模式、minimal=极简模式、cordis=创造模式),用 ✓ 标记当前预设,点击即切换。
  • 失效预设修复:如果会话记录的预设已被删除(自定义预设被移除),恢复将失败导致会话不可用。下拉菜单中的「修复失效模式会话」操作(及 repair API)会扫描所有会话日志并重写失效引用 — 最后一个 agent-preset/selected 事件,否则是标题 — 重置为默认预设,操作前自动备份日志并跳过活跃会话。切换未加载的会话时若引用失效也会自动修复。
  • 受控路由POST /preset-switch/api,参数 { method: 'list' | 'switch' | 'repair', sessionId, presetId, target? }(回环/可信主机限制,与 dsh-sounds 相同)。

工作原理

原生 API(agentPresets.select)通过空白会话检查来保护切换操作。本插件底层调用同一原子原语 — agentPresets.recompose(agent.ctx, presetId) — 将代理的作用域重新链接到目标预设的常驻挂载点。新组合在链接移动前确保完成,因此损坏的预设不会影响会话。成功后插件追加与代理记录相同的 agent-preset/selected 会话事件,使投影和标题标签同步更新。

限制:仅已加载的活跃会话可切换;子代理拥有的会话将被拒绝;新的工具集/人设从下一个模型步骤生效。

安装 / 更新

dsh plugin --profile web add C:\Users\Lenovo\.dsh\plugins\dsh-preset-switcher
# 重启 dsh web(profile 启动时合并 cordis.patch.yml):
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\restart-web.ps1

文件结构

文件说明
cordis.patch.ymlBundle 补丁:将插件行插入 profile 的 cordis 树(dsh.bundle.patch
lib/index.js服务端:受控 /preset-switch/api 路由(list / switch / repair)及会话日志修复逻辑
lib/client.js浏览器端:顶部下拉菜单(ClientModuleSystem bundle,React 通过 module-table externals)
scripts/restart-web.ps1(终止+重启+探测)、inspect-session.mjs / repair-session.mjs(独立日志工具)

许可证

MIT

---

<a id="english"></a>

dsh-preset-switcher

> English | [中文](#概述)

---

Overview

DSH web plugin: switch the current session's agent preset (mode) at any time, including after the conversation has already started — the stock UI refuses that ("a started conversation's agent preset is fixed").

Features

  • Header dropdown: a "当前模式 ▾" button in the session header action row lists every preset (e.g. standard=标准模式, code=PTC 模式, minimal=极简模式, cordis=创造模式), marks the session's current one with ✓, and switches on click.
  • Stale-preset repair: if a session's recorded preset was deleted (a custom preset removed), resume fails and the session becomes unusable. The dropdown's "修复失效模式会话" action (and repair API) scans every session log and rewrites stale references — the last agent-preset/selected event, else the header — to the default preset, backing up the log first and skipping live sessions. Switching a not-loaded session whose reference is stale auto-repairs it too.
  • Fenced route: POST /preset-switch/api with { method: 'list' | 'switch' | 'repair', sessionId, presetId, target? } (loopback/trusted-host fence, same as dsh-sounds).

How it works

The stock API (agentPresets.select) guards its swap with a blank-session check. This plugin calls the same atomic primitive underneath — agentPresets.recompose(agent.ctx, presetId) — which re-links the agent's scope to the target preset's standing mount. The new composition is ensured before the link moves, so a broken preset leaves the session untouched. On success the plugin appends the same agent-preset/selected session event the proxy records, so projections and the header label follow.

Limits: only live (currently loaded) sessions can switch; subagent-owned sessions are refused; the new toolset/persona applies from the next model step.

Install / update

dsh plugin --profile web add C:\Users\Lenovo\.dsh\plugins\dsh-preset-switcher
# restart dsh web afterwards (profile boot merges cordis.patch.yml):
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\restart-web.ps1

Layout

FileDescription
cordis.patch.ymlBundle patch: inserts the plugin row into the profile's cordis tree (dsh.bundle.patch).
lib/index.jsHost half: the fenced /preset-switch/api routes (list / switch / repair) and the session-log repair logic.
lib/client.jsBrowser half: the header dropdown (ClientModuleSystem bundle, React via module-table externals).
scripts/restart-web.ps1 (kill + restart + probe), inspect-session.mjs / repair-session.mjs (standalone log tools).

License

MIT