In the DSH development environment, when the web host process becomes unresponsive or a hot reload of configuration is required, you often have to restart the process manually from a terminal. The dsh-restart plugin adds a dedicated Restart page to the DSH web settings panel, letting developers start or stop the host process directly from the browser without switching to a terminal.
What Is This¶
dsh-restart is a DeepSeek Harness (DSH) plugin maintained by DWJZ. It adds a restart page to the web settings panel, addressing the inconvenience of restarting the host process in a web environment. The plugin is released under the MIT License.
Installation and Activation¶
Install the plugin with the following command:
dsh plugin --profile web add github:DWJZ/dsh-restart
After installation, you must restart the host once for the Restart page to appear in the settings panel.
Core Features¶
1. Panel Controls and API¶
The plugin provides two buttons in the web settings panel: Restart and Stop. Under the hood, it registers three route endpoints:
GET /dsh-restart/status: Check the current process status.POST /dsh-restart/restart: Trigger a host restart.POST /dsh-restart/stop: Stop the host process.
2. Keyboard Shortcut Support¶
Besides the buttons, the plugin also supports keyboard shortcuts:
* macOS: Cmd + Shift + K
* Windows: Ctrl + Shift + K
After restarting, the page automatically polls the status and reloads when the boot id changes.
How It Works¶
Process Replacement Mechanism¶
The restart functionality is implemented via a detached helper. Upon receiving a request, the old process waits 400 milliseconds before exiting, and the helper waits for the port to be released before starting the new process. The new process uses the exact same startup command (including the Node binary path, execArgv, absolute path, argv, and all other parameters), thereby avoiding EADDRINUSE errors caused by the old port still being occupied.
Stop Mechanism¶
The stop operation directly sends a SIGTERM signal. This ensures that sessions are properly refreshed rather than being force-killed.
Plugin Loading Mechanism¶
If the plugin is in an “installed but not activated” state, it will be automatically loaded on the next host startup.
Notes¶
- Linux Keyboard Shortcut Limitation: On Linux, web-based keyboard shortcuts cannot be bound. This happens because the browser’s allowlist rejects the primary+alt key combination, preventing the plugin from registering the shortcut.
- Session Persistence: The restart operation retains session data, so the page will still be present after a restart.
- Permissions and Origin: The plugin runs with the permissions of the current dsh process. Please review the source code and license before installation.
Summary¶
dsh-restart simplifies DSH web host operations through a visual page and keyboard shortcuts. For more details, see the GitHub repository.