Introduction¶
If you use DSH via the Web interface, you’ve likely encountered moments where the page freezes, becomes unresponsive, or where you need to restart the process after installing a new plugin or modifying a configuration to see changes. The conventional approach is to return to the terminal, find the process occupying port 3080, kill it, and then manually start DSH, while also having to refresh the browser page yourself.
dsh-restart-web consolidates these actions into a single button in the settings panel: clicking it safely restarts the entire DSH process. The browser automatically refreshes and reconnects after about 5 seconds, so you don’t need to leave the Web interface at any point. DSH’s philosophy is “Everything is a plugin,” and small interface-level features like this are perfect for being filled in by plugins.
Below is an introduction to its features, installation methods, and working principles.
What is it¶
dsh-restart-web is a DSH plugin maintained by shaoyi1991, released under the MIT license, with the current version being 1.0.0. It does one thing: it adds a “Restart” entry in the DSH Web settings panel; clicking it safely restarts the entire DSH process.
Looking at package.json, its dsh.client configuration has platform set to web and injects @deepseek-ai/dsh-client-runtime, making it a client-side plugin targeting the Web platform.
Core Features¶
- Adds a “Restart” button in the DSH Web settings panel; clicking it safely restarts the entire DSH process, and the browser automatically refreshes and reconnects after 5 seconds.
- Cross-platform support: macOS/Linux uses
lsof+kill+ process group escape, Windows usesnetstat+taskkill. - The restart logic is an independent Node.js script (
lib/restart.js), started as a detached process, unaffected by DSH’s exit cleanup. - Gets the absolute path using
process.execPath+process.argv[1], does not rely on PATH, and is compatible with DSH installed via npx. - The restart is triggered by the host plugin (
lib/index.js) viaPOST /api/dsh-restart.
Installation and Enablement¶
Standard installation command:
dsh plugin --profile web add dsh-restart-web
You can also install from GitHub:
dsh plugin --profile web add github:shaoyi1991/dsh-restart-web
Note that after installation, you need to restart DSH once for it to take effect. Afterward, open Settings → Restart in the Web UI to see and use this entry.
How it Works¶
First, let’s look at the overall flow:
Web Interface (Settings → Restart)
│
▼ POST /api/dsh-restart
Host Plugin (lib/index.js)
│
├── macOS/Linux: Use bash set -m → Start restart.js in new process group
└── Windows: Use node directly → Start restart.js (detached mode)
│
├── 1. Wait 2 seconds (to allow HTTP response to return normally)
├── 2. Kill the process occupying port 3080
├── 3. Start new DSH: node bin.js web
└── 4. Exit (DSH continues running)
After clicking the button, the request is first sent to the POST /api/dsh-restart endpoint in the host plugin lib/index.js, which then pulls up the restart script lib/restart.js. The script will first wait 2 seconds to allow the HTTP response to return normally, then kill the process occupying port 3080, start a new DSH with node bin.js web, and finally exit itself, allowing the new process to continue serving.
There are two design points worth elaborating on.
Why not call the dsh command directly¶
DSH is usually installed via npx. In a subprocess’s clean environment, dsh is not in PATH, so calling it directly would fail. The plugin instead uses process.execPath + process.argv[1] to get the absolute paths of the Node executable and the script, avoiding reliance on PATH, ensuring it can restart regardless of how DSH was installed.
Why is set -m needed¶
When DSH exits, it automatically cleans up all child process groups (kill(-pid, SIGKILL)). If the restart script is still in the original process group, it will be killed along with the old process when it exits, making a restart impossible. On macOS/Linux, the plugin uses bash set -m to move lib/restart.js into a new process group to avoid this cleanup. Windows does not have this issue, so the restart script can be started directly in detached mode.
Use Cases and Notes¶
Suitable scenarios:
- Quick recovery when DSH freezes or becomes unresponsive;
- Need to reload after installing a new plugin or modifying configuration;
- High memory usage, wanting to release memory by restarting.
Note: The plugin runs with the permissions of the current dsh process. The restart action will directly kill the process occupying port 3080 and restart DSH using node bin.js web. It is recommended to read the source code and license (MIT) before installing to ensure everything is in order.
Conclusion¶
dsh-restart-web solves a very small but high-frequency problem: turning the “return to terminal to find process, kill, restart, and refresh page” sequence into a single click of a button in the settings panel. If you use DSH in your browser often, it is worth installing one as a backup.
- GitHub: https://github.com/shaoyi1991/dsh-restart-web
- Community Directory: https://www.skillhub.cn/plugins/shaoyi1991/dsh-restart-web (The community directory is an independent site, with no official affiliation to DeepSeek or Huanshan)