Preface¶
When running dsh web with DeepSeek Harness (DSH), modifying profiles, swapping bundles, or troubleshooting host-side issues often requires terminating the entire process and restarting it. While using Ctrl+C in the terminal and manually restarting works, if the WebUI connection drops, the state of the sidebar and the current page is lost. If you want to “restart with a single click and have the page automatically return,” it cannot be achieved within the Node process alone—dsh web is a single process, and once it exits, the UI disconnects. It must be restarted by an external daemon after exit.
Below is an introduction to the community plugin dsh-web-restart (maintainer: DEVbyQIN). It adds a “Restart DSH” button to the WebUI sidebar and includes companion scripts for launchd LaunchAgents and Dock icons on macOS. The plugin itself cannot self-bootstrap after the process dies; the restart button and the external daemon are two complementary halves, and neither can be missing.
What is this¶
dsh-web-restart is a DSH profile bundle: it registers restart HTTP endpoints and optional slash commands on the host side, and injects sidebar buttons, full-screen masks, and recovery polling into the WebUI on the client side. The repository also provides launchd installation scripts and AppleScript source code for a Dock App under launcher/macos/, used for automatic restarts after crashes or manual exits, and login auto-start.
- Directory Page: skillhub.cn/plugins/DEVbyQIN/dsh-web-restart
- Source & Docs: github.com/DEVbyQIN/dsh-web-restart
- License: MIT (see repo LICENSE)
The community plugin directory is an independent site with no official affiliation with DeepSeek / High-Flyer. Please review the source code and license yourself before installing.
Core Features¶
| Capability | Description |
|---|---|
| WebUI Restart Button | “⇄ Restart DSH” at the bottom of the sidebar, with a two-step confirmation to prevent accidental touches; triggers a full-screen mask, and after the process exits, an external daemon restarts it, while the page polls for recovery and auto-refreshes. |
| Dual-Channel Trigger | Prefers DSH official RPC (remote.commands.execute("/restart")), falls back to same-origin fetch. |
| launchd Daemon | KeepAlive automatically restarts dsh web after a crash or exit; login auto-start is configurable. |
| Dock Icon | Can compile a .app via AppleScript; clicking it launches and opens the browser. |
| Optional Token | Host endpoint supports Authorization / X-Dsh-Restart-Token validation. |
The host side (index.mjs) registers the same-origin POST /api/_dsh/restart. Upon a hit, it returns 202 and delays execution to allow the response to flush to disk before exiting. The default mode: "exit" performs a process.exit(), handing control to launchd’s KeepAlive for a restart; mode: "exec" spawns a new dsh web within the same process and unrefs it, suitable for scenarios without an external daemon or when running manually from a terminal. The client side (lib/client.js) uses the sidebar.footer.action slot, mounts the mask on documentElement, and polls the service for recovery every 2 seconds, without relying on window.confirm (which may be silently disabled in embedded WebViews).
Installation & Activation¶
The plugin is installed into the DSH web profile, rather than via dsh plugin add using the plugin name.
Install from GitHub (Recommended)¶
Run the following in the profile directory ~/.dsh/profiles/web/:
cd ~/.dsh/profiles/web
pnpm add "dsh-web-restart@github:<your-username>/<repo-name>"
Add the bundle name to the end of the dsh.profile.bundles array in ~/.dsh/profiles/web/package.json:
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"@deepseek-ai/dsh-web-app",
"dsh-web-restart"
]
}
}
Restart dsh web to apply the changes.
Local Link (For Development)¶
cd ~/.dsh/profiles/web
pnpm add "link:/absolute/path/to/dsh-web-restart"
Similarly, add "dsh-web-restart" to the bundles array and restart to apply.
Overriding Default Configuration¶
You can override mode, token, flushMs, enableCommand, etc. in the profile’s cordis.patch.yml, for example:
- id: web-restart
name: dsh-web-restart
token: my-secret
Typical Usage¶
Restart within WebUI¶
- Ensure the
dsh-web-restartprofile is enabled anddsh webhas been restarted. - On macOS, if you want it to return automatically after exit, complete the launchd installation in the next section first (only for
mode: "exec"and no daemon scenarios where you rely on same-process spawn, though the README emphasizes using it with launchd). - Open the WebUI, click “⇄ Restart DSH” at the bottom of the sidebar, and follow the two-step confirmation.
- The screen displays “Restarting DSH…”. After the external daemon starts the process, the client polls roughly every 2 seconds and auto-refreshes the page upon recovery.
macOS: launchd Daemon¶
The installation script copies the startup logic to ~/Library/Application Support/dsh-web/ (to avoid issues where launchd cannot read scripts in paths like ~/Documents under TCC), and automatically detects the paths for node and dsh; you can override them using NODE_BIN, DSH_ENTRY, and DSH_HOME.
chmod +x launcher/macos/*.sh
launcher/macos/dsh-web-control.sh install
Common control commands:
| Command | Function |
|---|---|
dsh-web-control.sh status |
Check launchd status |
dsh-web-control.sh restart |
Manual restart |
dsh-web-control.sh stop / start |
Stop / Start (Stopping does not disable auto-start) |
dsh-web-control.sh uninstall |
Uninstall |
Log paths: ~/.dsh/dsh-web.launchd.log and ~/.dsh/dsh-web.launchd.err.log.
Dock / Launchpad Icon¶
Compile an App using the AppleScript in the repository:
mkdir -p build
osacompile -o build/DSH.app launcher/macos/DSH-Web-Launcher.applescript
cp -R build/DSH.app /Applications/
Alternatively, create a new Automator “Application” that runs a shell script calling ~/Library/Application Support/dsh-web/dsh-web-start.sh, waits for sleep 3, then runs open http://127.0.0.1:3080. Save it as DSH.app and drag it to the Dock or Launchpad.
Scenarios & Notes¶
Suitable for scenarios involving long-term local development with dsh web on macOS, where you need to quickly restart the entire process after modifying bundles while minimizing interaction with the terminal. The launchd and Dock scripts are tailored for macOS; environments like Linux can still use the WebUI button and host endpoint, but “automatic restart after exit” requires a self-configured external daemon like systemd. The repository README uses macOS launchd as the complete example.
The plugin runs with the permissions of the current dsh web process; if a token is configured, avoid committing the secret to public repositories. Restarting interrupts all Web connections and ongoing sessions; please assess the impact before using in production or shared environments.
Development Self-Tests (from README):
node --check index.mjs lib/client.js
node validate.mjs
Conclusion¶
dsh-web-restart splits “one-click WebUI restart” and “macOS external restart” into two clear halves: the button handles orderly exit and frontend recovery experience, while launchd handles the return after the process dies. In the DSH ecosystem where “everything is a plugin,” it fills a very small but high-frequency step in local web operations.
- Directory Page: https://www.skillhub.cn/plugins/DEVbyQIN/dsh-web-restart
- GitHub: https://github.com/DEVbyQIN/dsh-web-restart