Retr67/dsh-plugin-manager ↗★ 1
dsh-plugin-manager
DeepSeek Harness (DSH) 插件管理器:在 WebUI 里可视化查看、临时打开/关闭其他插件,热生效并可跨重启保持。
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Retr67/dsh-plugin-manager说明文档
阅读完整 README ↗dsh-plugin-manager
DeepSeek Harness (DSH) 插件管理器:在 WebUI 设置 → 插件 → 插件管理 里可视化查看、临时打开、关闭其他插件。
- 入口位于 设置 → 插件 → 插件管理(作为
settings.plugins.tab槽位注册的一个标签页,与自带的「可配置」标签并列)。 - 用户插件(可开关):你在
profile/package.json里安装的社区插件 + 你自己在cordis.patch.yml里加的条目(如 MCP 桥梁)。 - 系统组件(只读):DSH 自带的 host/web 基础设施,只展示、不提供开关,避免误关导致 Harness 起不来。
- 开关热生效:走 Cordis loader 的
entry.update({ disabled }),与官方 dsh-market 主题开关同一条路径,无需重启。 - 跨重启保持:被关闭的插件 id 记在
/.plugin-manager/state.json,下次启动时自动回放为关闭,直到你把它打开。 - 「全部恢复开启」按钮可一键清空所有保持关闭的插件。
环境要求
- DeepSeek Harness (dsh)(≥ 0.1.0-rc.x)
- Node.js ≥ 22
- pnpm(dsh 插件管理依赖;若未安装,
dsh plugin会提示)
安装(一键命令)
方式 A:从本地仓库 / 路径安装(开发、离线)
# 在仓库目录外执行, 换成仓库的绝对路径
dsh plugin --profile web add file:
例如(PowerShell / CMD):
dsh plugin --profile web add file:D:\dsh-plugin-manager
或直接运行仓库内的一键脚本:
# Windows
.\install.ps1
# macOS / Linux / Git Bash
./install.sh
方式 B:从 GitHub 安装(开源发布后)
dsh plugin --profile web add github:/
dsh plugin add会自动完成三件事:① 安装依赖;② 把插件写进package.json的dependencies;③ 检测到包声明了dsh.bundle后,自动把它加进dsh.profile.bundles(即插件会在下次启动时被 DSH 加载)。
换 profile
默认安装在 web profile;换别的 profile 用 --profile :
dsh plugin --profile myprofile add file:D:\dsh-plugin-manager
安装后
重启 dsh,然后在 设置 → 插件 → 插件管理 即可看到面板。
卸载
dsh plugin --profile web remove dsh-plugin-manager
结构
dsh-plugin-manager/
├── package.json # dsh.bundle + dsh.client 声明
├── cordis.patch.yml # 挂载 plugin-manager 主机条目
├── dsh/
│ ├── index.js # 主机端:HTTP API + loader 枚举/开关 + 状态持久化
│ └── client.js # 浏览器端:注册 设置→插件→插件管理 标签页(React)
├── install.ps1 # Windows 一键安装脚本
├── install.sh # POSIX 一键安装脚本
├── README.md
└── LICENSE # MIT
与官方机制的关系
- 不对
package.json的dsh.profile.bundles做热增删(那需要重启生效),而是对运行中的 loader entry 做热开关——这是 dsh-market 主题切换验证过的做法。 - 状态持久化、启动回放、自愈守卫(
internal/plugin事件)同样移植自 dsh-market。 - group 插件(如把某个插件包包裹成 group 的宿主)无法直接置
disabled,管理器会自动改为开关其子条目。
HTTP API(同源校验)
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /plugin-manager/list | 返回插件列表与开关状态 |
| POST | /plugin-manager/toggle | { id, enabled } 热开关某个插件 |
| POST | /plugin-manager/reset | 恢复所有被保持关闭的插件 |
POST 接口(toggle/reset)做了 Origin === Host 的同源校验;GET 列表是只读、且只暴露在回环地址绑定的 web server 上,不再要求 Origin 头(同源 GET fetch 默认不携带 Origin,要求它会导致面板报 untrusted origin)。
安全
- 主机端仅使用 node 内置模块(fs/os/path),无网络调用、无子进程、无 eval。
- 客户端用 React 渲染插件名(自动转义,无 XSS),所有请求都是同源 fetch。
- 管理器自己(
plugin-manager)不会被关闭;系统组件不会提供开关。
License
MIT