tianyaZTY/dsh-hot-plugin-host
Web UI 运行时插件加载:监视热目录,运行中安装/更新客户端插件 bundle,所有页面即时生效,免重启。附子智能体看板示例。
已收录
1
Dev
Bundle 已验证
功能介绍
Web UI 运行时插件加载:监视热目录,运行中安装/更新客户端插件 bundle,所有页面即时生效,免重启。附子智能体看板示例。
适合
- 客户端插件 bundle 频繁变更的本地 Web UI 开发。
- 希望 UI 挂件或看板在所有已打开页面即时更新、无需反复重启 DSH 的开发者。
- 需要按标准 Loader 生命周期原型开发 Cordis 客户端插件的团队。
不适合
- 热目录可能包含不可信内容的生产或共享环境。
- 服务端插件,或依赖客户端模块表之外模块的 bundle。
- 无法执行首次重启以加载宿主插件的环境。
README
dsh-hot-plugin-host
Runtime plugin loading for DeepSeek Harness Web — no restarts.
The DSH loader tree is composed at boot, so adding a static client plugin (a UI panel, a widget, a dashboard) normally requires restarting dsh web. This plugin fixes that: it watches a hot directory and installs/updates client plugin bundles at runtime on every open page.
write a bundle → ~/.dsh/hot-plugins/<id>/client.js
↓ (host polls every 1.5s)
/ hot-plugins/list + SSE events + bundle serving
↓ (browser half)
fetch → __ModuleLoader__.load → loader.create (full cordis fiber lifecycle)
↓
the plugin goes live on every open page — no restart, no refresh
Updates work the same way (overwrite the file → invalidate + live refresh). Delete the directory → the plugin disappears on next page load.
Install
# from this repo
mkdir -p ~/.dsh/profiles/web/node_modules
ln -s "$PWD" ~/.dsh/profiles/web/node_modules/dsh-hot-plugin-host
# add "dsh-hot-plugin-host" to dsh.profile.bundles in
# ~/.dsh/profiles/web/package.json
Then restart dsh web once (the host itself is a boot plugin). From then on, every future plugin ships through the hot dir with zero restarts.
npm:
dsh-hot-plugin-host(once published)
Usage
Drop a bundle into the hot directory:
mkdir -p ~/.dsh/hot-plugins/my-widget
cp examples/demo-widget/client.js ~/.dsh/hot-plugins/my-widget/
# within ~1.5s it is live on every open page
A hot bundle is the same __ModuleLoader__.load format as a boot bundle:
window.__ModuleLoader__.load({
id: "my-widget", // must equal the directory name
factory: (require) => {
// require() only modules in the client table: react, react/jsx-runtime,
// @deepseek-ai/dsh-client-runtime/client, ...
const inject = ["sessions", "slots", "locale"];
function apply(ctx) { /* full plugin powers: ctx.slots.register(...) */ }
exports.apply = apply;
exports.inject = inject;
return module.exports;
}
});
- id:
[A-Za-z0-9@._-], single path segment, no/ - routes:
GET /hot-plugins/list,GET /hot-plugins/events(SSE),GET /hot-plugins/<id>/client.js - hot dir:
DSH_HOT_PLUGINSenv override, default~/.dsh/hot-plugins(auto-created)
Examples
| Example | Description |
|---|---|
packages/dsh-client-ui-subagent-dashboard |
Subagent dashboard in the right column: live status, expandable details, background jobs, one-click open of the child session transcript. Ships as its own npm package; also works as a hot bundle. |
examples/demo-widget |
Minimal self-contained hot bundle: a live status chip. |
Security
The hot directory is a trust boundary, equivalent to the boot bundles list (a hot plugin gets full client-side service access). Local development machines only — never point it at untrusted content.
How it works
-
Host half (
lib/index.js): registers/hot-pluginsroutes onctx.webServer(list / SSE / bundle), polls the hot dir (mtime+size → rev), broadcastschangeevents. -
Browser half (
lib/client.js): injectsloader; reconciles on connect (list), subscribes to SSE, fetches changed bundles, executes them via the standard module loader, then mounts them withloader.create— the exact mechanism the officialdsh-cordis-client-runneruses for dynamic packages, giving hot plugins the full fiber lifecycle (activation gating, effect cleanup, status projection).
Related
- dsh-market — the community plugin market UI inside DSH (browse/search/one-click install)
- awesome-dsh-plugin — the curated registry this project is listed in
MIT
常见问题常见问题
在启用了 DSH 的终端中执行已验证命令 dsh plugin --profile default add github:tianyaZTY/dsh-hot-plugin-host。命令会解析公开 package 元数据,并保持插件与本页展示的目录身份一致。
兼容性以页面上展示的 bundle 与 profile 状态为准。如果某个 profile 尚未检测到,请先保持禁用,并在生产启用前阅读仓库文档。
GitHub 链接和 activity 元数据是 release 与维护状态的来源。新版本发布后重新查看本页,确认目录已经观察到最新版本。