Bundle
@zhuyh-sai7n/dsh-plugin-manager
三方插件管理:在 Web 设置里管理第三方插件的启用/禁用、启用方案保存与切换、以及添加插件。
- Source
- sorry123maker
- License
- MIT
- Updated
- Updated 19 days ago
Readme
# @zhuyh-sai7n/dsh-plugin-manager
[](https://www.npmjs.com/package/@zhuyh-sai7n/dsh-plugin-manager)
[](https://www.npmjs.com/package/@zhuyh-sai7n/dsh-plugin-manager)
三方插件管理中心 —— 在 DeepSeek Harness 的 Web UI 设置里新增一个「三方插件管理」页面,集中管理当前 profile 的第三方插件。
## 仓库 / Repository
https://github.com/sorry123maker/dsh-plugin-manager
## 功能 / Features
- **插件列表**:读取 profile 的 `dsh.profile.bundles`,过滤掉 `@deepseek-ai/*` 内置 bundle 与自身,展示每个第三方插件的启用状态与加载状态。
- **启用开关 + 应用**:每个插件一个开关;点击「应用」把改动写回 profile 的 `cordis.patch.yml` 补丁层(`{ id, disabled: true }` 条目)。该文件被 dsh 的 `watchUserPatches` + HMR 热监听,因此「应用」后**即时热重载生效、无需重启**;插件仍保留在列表里,状态变为「关闭」。
- **方案(启用状态快照)**:把当前启用状态保存为命名方案;支持查看当前方案、切换方案、删除方案。切换方案会立即应用到插件启用状态。
- **添加插件**:输入包名或任意 pnpm 可接受的 spec(如 `dsh-salary-cat`、`github:owner/repo`),等价执行 `dsh plugin --profile <profile> add <spec>`;添加后默认启用,**需重启 `dsh web` 才进入 loader 树**。
## 安装 / Install
在目标 profile(通常是 `web`)中安装:
```bash
dsh plugin --profile web add @zhuyh-sai7n/dsh-plugin-manager
```
然后重启 `dsh web`(本插件自身也要进 loader 树):
```bash
dsh web
```
重启后打开 Web UI → 设置 → 「三方插件管理」。
> 也支持其它 profile:把命令里的 `web` 换成你的 profile 名即可。
## 使用 / Usage
1. 打开设置里的「三方插件管理」,看到当前 profile 的三方插件列表。
2. 拨动某个插件的开关,点击「应用」,改动即时热重载生效。
3. 在「方案」区输入名称并「保存当前为方案」,之后可在方案列表里一键「切换」或「删除」。
4. 在「添加插件」输入包名,点击「添加」;完成后重启 `dsh web` 生效。
## 工作原理 / How it works
- **列表来源**:profile 的 `package.json` 里 `dsh.profile.bundles`。这是 dsh 实际的 bundle 补丁层清单——只有声明了 `dsh.bundle.patch` 的包才会在 `dsh plugin add` 时被 reconcile 进这里,因此它精确对应「真正的三方插件」。
- **禁用机制**:写 `{ id: <row-id>, disabled: true }` 到 profile 的 `cordis.patch.yml`。dsh 启动时用 `watchUserPatches` + HMR 监听这个文件,改动会即时重放补丁层——Host 条目原地重启、Client 条目从启动图移除,所以无需重启。
- **添加机制**:复用当前 harness 自身的 Node 启动参数(`process.execArgv` + 入口)拉起 dsh CLI,执行 `dsh plugin --profile <profile> add <spec>`,由 dsh 内部转发给 pnpm 并 reconcile bundles。
- **无第三方依赖**:本包只 import `node:` 内置模块,不依赖任何 npm 包,避免 `link:` 安装时依赖解析失败的问题。
## 状态落盘位置 / Persisted state
| 数据 | 位置 |
| --- | --- |
| 禁用态 | `~/.dsh/profiles/<profile>/cordis.patch.yml` |
| 方案 | `~/.dsh/profiles/<profile>/.dsh-plugin-manager.json` |
## 文件布局 / Layout
- `src/index.js` —— Host 半:读取 profile 配置、写回禁用补丁、执行添加、持久化方案,通过 `/plugin-manager/*` 路由暴露 JSON API。
- `src/client.js` —— Client 半:往 `settings.section` 注册「三方插件管理」页面。
- `cordis.patch.yml` —— 本 bundle 的宿主组合补丁(插入 `plugin-manager` 行)。
## 已知限制 / Limitations
- **新增插件需重启** `dsh web` 才会进入 loader 树(本插件自身同理);禁用/启用则是热重载、无需重启。
- 禁用补丁的读写用文本级处理,只识别块式 `- id: <row-id>` 紧跟 `disabled: true` 的条目;用户的其它补丁内容(含 `!!js` 表达式)保持原样不动,但不会自动清理用户手写的非标准格式禁用条目。
- 「三方」的判定是启发式的:过滤 `@deepseek-ai/*` 前缀,其余视为第三方。未声明 `dsh.bundle` 的普通依赖不是插件,不会出现在列表里。
## License
MIT
Install
dsh plugin --profile web add github:sorry123maker/dsh-plugin-manager#0d38d32d6b0796071c0c39ff86ddb49fbf699c51
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install zhuyh-sai7n-dsh-plugin-manager from the hub