Adds a restart control at the DSH Web sidebar foot: the host exits through its own graceful path and the detected supervisor (systemd, Kubernetes or Docker) boots the replacement, or the plugin starts one directly when it finds no supervisor; a frame-wide notice polls the host pid until a new process answers.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:androidly/dsh-restart-control
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
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,不读取任何状态、不触发重启。
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 10406
Task board for the dsh web GUI: a sidebar multi-column kanban whose cards run in real DSH agent sessions and can also be scheduled with cron expressions, executed host-side even with the browser closed.
zhu1090093659/dsh-web#packages/dsh-web-all★ 10406
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 7675
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7201
A fixed-corner whale widget for the DSH web GUI — balance, today's usage and per-turn cost with peak/off-peak pricing, editable balance-alert and daily-budget bubbles, a module-based custom bubble queue with A/B weighted choices and random lines or images, 30+ vendor templates (OpenAI, OpenRouter, Kimi, SiliconFlow, Ark, Zhipu, MiniMax and more) with per-model balance and subscription quota, plus task-end sound, imported audio, custom roles and a resource manager. Local-only, no telemetry.
omdsh-dev/DSH-better-sidebar★ 5142
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
Devin-AXIS/deepseek-design#deepseek-idesign★ 1816
Visual design studio for websites, app prototypes, posters, cards, reports, and magazines, with templates, direct element editing, selection-aware AI draft handoff, and export.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.