在 DSH Web 侧边栏底部添加重启控件:宿主经自身的优雅退出通道退出,由检测到的进程守护(systemd、Kubernetes 或 Docker)拉起新进程,没有守护时插件自行拉起;右下角提示条轮询宿主 pid,直到新进程应答。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:androidly/dsh-restart-control
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
A DSH Web plugin that restarts the running host from the sidebar, and keeps reporting until a new process answers.
What it does
- A control at the sidebar foot. One click arms it (
Click again to restart), a second click sends the request. Arming expires after five seconds. - The host exits through its own graceful path. The plugin calls the launcher's
appExit(ctx.get('appExit')), so the Cordis fiber tree disposes before the process leaves — it does not kill the process outright. - A supervisor boots the replacement. systemd (
INVOCATION_ID), Kubernetes (KUBERNETES_SERVICE_HOST) and Docker (/.dockerenv) are detected; when one is present the plugin only exits and lets it restart the unit/container. With no supervisor detected, the plugin starts a detached successor itself: a shell waits two seconds for the port to be released, thenexecs the same executable and arguments with the same cwd and environment. - A frame-wide notice follows the restart. A bottom-right card reports
Restarting…, thenRestartedor the failure reason, withReload page/Retry/Dismiss. The attempt is stored inlocalStorage, so it survives the shell remounting during the reconnect, a page reload, and a second tab opened by the restarted process. - Completion is verified by pid, not by the response. The client reads the host pid before the request, then polls until a different pid answers. A dying process that still answers can never be reported as the successor. The poll gives up after 120 seconds and says so.
Requirements
- DSH with the Web app (
dsh web), version0.2.x. - The plugin needs the
webServerandconnectionservices, which the shipped Web composition provides. - Restarting only makes sense when something can start the host again: a supervisor, or the plugin's own relaunch path.
Install
Install it as a bundle from the DSH Web plugin manager (Plugin Manager → install bundle → this package or its directory).
For a manual profile install:
dsh plugin --profile <profile> add <path-or-git-url>
then add dsh-restart-control to dsh.profile.bundles in $DSH_HOME/profiles/<profile>/package.json and restart the host. A bundle is only composed when it is listed there; adding the dependency alone does not start it.
The route
The Host half registers one exact route on the composition's webServer:
| Method | Path | Result |
|---|---|---|
GET |
/restart-dsh |
{ pid, startedAt, pending } — the live process identity |
POST |
/restart-dsh |
202 { pid, startedAt, pending, supervisor, relaunch }, then the shutdown; 409 while a restart is already pending |
Every request first passes ctx.connection.requestRejection(req): the Host/Origin fence and the browser login cookie gate the caller before any state is read or any restart is scheduled. An unauthenticated request gets 401 and changes nothing.
Limits
- The control restarts the host; it does not reload the page for you. The notice offers a reload button because the WebSocket drops during the restart.
- A restart is process-wide: every live session in that host reconnects, and a turn in flight is interrupted.
- The supervisor detection is a heuristic. If you run the host under something else that restarts it, the exit path is still correct; if nothing would restart it, the relaunch path takes over.
License
MIT
中文
在 DSH Web 侧边栏底部添加重启控件,并持续汇报进度直到新进程应答。
- 点击一次进入确认态(5 秒后自动撤销),再次点击才发出重启请求。
- 宿主经自身的优雅退出通道(
ctx.get('appExit'))退出,先 dispose 插件树再退出进程。 - 检测 systemd / Kubernetes / Docker:有守护时只退出,由守护拉起;没有守护时插件自己起一个分离进程,等端口释放后以同样的命令行、cwd 与环境
exec。 - 右下角全帧提示条显示「正在重启 → 已重启 / 失败原因」,记录写入
localStorage,重连导致外壳重挂载、刷新页面、乃至重启后新开的标签页都能看到结果。 - 成功与否以 pid 判定:发请求前先读宿主 pid,轮询到不同的 pid 才算成功,120 秒未等到则报超时。
安装:在 DSH Web 的插件管理器里按 bundle 安装本包;或 dsh plugin --profile <profile> add <路径或 git 地址> 后,把 dsh-restart-control 加入 $DSH_HOME/profiles/<profile>/package.json 的 dsh.profile.bundles,再重启宿主。
路由 /restart-dsh 的每个请求都先过 ctx.connection.requestRejection:未通过 Host/Origin 围栏与登录 cookie 的请求返回 401,不读取任何状态、不触发重启。
链接
同类插件
zhu1090093659/dsh-web#packages/dsh-task-board★ 10172
侧边栏多列任务看板:卡片交给真实 DSH 智能体会话执行,支持 cron 定时(Host 侧到点执行,关浏览器也生效)。
zhu1090093659/dsh-web#packages/dsh-web-all★ 10172
DSH Web UI 插件与皮肤合集:任务看板、git 图、右侧面板、远程移动端 UI、桌宠、实时 token 统计与皮肤中心。
ccch1mneyyy/dsh-TUI★ 7101
Claude Code 风格全屏终端 UI:像素鲸鱼顶栏、实时工作状态行、思考流式展开。
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 6959
右下角常驻的小鲸鱼挂件:余额、今日已用与每轮对话消耗(含峰谷价),余额预警与今日预算的泡泡内容都可编辑;泡泡点击序列模块化自定义,支持并列加权 A/B、随机台词与随机图片;内置 30+ 厂商模板(OpenAI / OpenRouter / Kimi / 硅基流动 / 方舟 / 智谱 / MiniMax 等),按模型查余额与订阅额度;另有任务结束音效、导入音频、自定义角色与资源管理。数据全在本机,无遥测。
omdsh-dev/DSH-better-sidebar★ 4959
侧边栏完整工作台:内置文件渲染编辑、终端、Git 与子代理,支持三方插件注册新 Tab。
Devin-AXIS/deepseek-design#deepseek-idesign★ 1744
可视化设计工作室,支持网站、App 原型、海报、信息卡、报告和杂志的模板创建、元素编辑、选区级 AI 草稿衔接与导出。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。