dsh-plugin-ui-toggle
在 dsh Web UI 里直接开关插件:设置 → 插件 → 插件开关。
每一行对应 Loader 树里的一个插件条目。拨动开关后:
- 立即生效 —— 不用重启;
- 重启后仍然保留 —— 开关状态写在本 profile 的
cordis.patch.yml里,而这正是 dsh 启动时组装插件树用的那份文件。
零运行时依赖,无需构建。
安装
dsh plugin --profile web add github:Biobuilder-ai/dsh-plugin-ui-toggle然后重启 dsh web。本包在 manifest 里声明了 dsh.bundle,dsh plugin 会自己把它加进 dsh.profile.bundles。
为什么这样存
dsh 启动时会用 HMR 监听 profile 的 cordis.patch.yml(watchUserPatches)。所以本插件只做一件事:把 - id: <条目 id> / disabled: true|false 写进那个文件末尾的一段受管区块:
# >>> dsh-plugin-ui-toggle:begin — managed block, edited from the web UI
- id: "web-ui-git-graph"
disabled: true
# <<< dsh-plugin-ui-toggle:end写入本身就会触发补丁层重新应用,条目的 fiber 随之启动或退出——插件从不调用 Entry.update(),因此也从不回写组装出来的 cordis.yml。
两个标记之间以外的内容一个字节都不会动,手写的行和注释都原样保留。区块可以手工编辑,也可以整段删掉(等于清空所有覆盖)。
不能关的行
有几个条目关掉之后,这个开关面板自己就没了,只能手改文件才能救回来。它们在界面上标为「必需」,服务端也会拒绝(HTTP 409):dsh-plugin-ui-toggle、dsh-host-webserver、dsh-host-frontend-static、dsh-web-frontend、dsh-client-modules、dsh-api-gateway、dsh-client-ui-layout、dsh-client-ui-settings、dsh-client-ui-settings-plugins。
其余条目都可以关——包括后端能力插件。关掉不该关的东西会让对应功能消失,删掉受管区块里那一行即可还原。
HTTP 接口
同源,供 ./client 使用:
| 方法 | 路径 | 说明 |
|---|---|---|
GET | /ui-toggle/entries | 列出可打补丁的条目及其当前状态 |
POST | /ui-toggle/set | 请求体 { id, enabled },写入受管区块 |
id 是补丁用的短 id(web-ui-pet),不是 Loader 的限定路径(include:web-ui-pet)——applyEntryPatches 匹配的是前者。响应里的 path 字段带的才是限定路径,仅供显示。
组装方式
本包自带的 bundle patch 只插入一行 host 条目:
- insert:
- id: ui-toggle
name: 'dsh-plugin-ui-toggle'浏览器半边由 dsh.client manifest 加载,注册到 settings.plugins.tab 槽位。webServer 是通过 ctx.inject 取的,没有声明成必需服务,所以在 headless profile 里这一行照样能激活,只是什么都不贡献。
本地开发
把仓库 clone 到 profile 目录下的 plugins/,在 profile 的 package.json 里用 link: 声明:
"dsh-plugin-ui-toggle": "link:./plugins/dsh-plugin-ui-toggle"不要把包直接放进 node_modules/:下一次 pnpm install / dsh plugin install 会把它当多余目录清掉,profile 随即因为 cannot resolve profile bundle 起不来。声明成依赖之后,安装只会重建符号链接,dsh plugin 的 reconcile 也会自动把它保留在 dsh.profile.bundles 里。
环境要求
- 带 web profile 的 dsh(
@deepseek-ai/dsh-web-app) webServerhost 服务与settings.plugins.tab客户端槽位,标准 web 组装里都有
许可
MIT