Introduction¶
During the development preview phase of DeepSeek Harness (DSH), frequent process restarts and terminations are part of daily development. The official interface currently does not provide a direct power control entry point, so developers often need to rely on the command line or system process manager to terminate processes. dsh-header-controls is a static web plugin that injects “Restart” and “Sign Out” capsule buttons on the left side of the session log, replicating the interaction experience of the official layout to address this pain point.
Core Features¶
This plugin provides the following capabilities:
- One-click restart: No secondary confirmation is required. After clicking the button, the current dsh process exits gracefully, and a pure Node.js helper restarts the service based on the configuration. The page automatically polls and refreshes, so there is no need to manually open a new tab.
- Two-step sign-out confirmation: After clicking the sign-out button, the button turns red and enters a confirmation state. A second click is required to actually shut down the entire dsh process, preventing accidental clicks.
- Pure Node.js restart helper: The restart logic is implemented in
lib/relaunch-helper.cjs. It does not rely on PowerShell or any third-party libraries and operates by reading the system environment directly. - Theme awareness: The plugin detects the page’s
data-dsh-maid-atelierattribute and automatically switches to a deep-sea blue color scheme under the corresponding theme; otherwise, it uses the default style. - Security validation: The host route only allows
loopbackaccess and enforces validation of the custom request headerx-dsh-header-controls: 1to prevent CSRF attacks.
Installation and Activation¶
The installation process requires manual steps and does not rely on the existing plugin manager.
- Clone the repository locally:
git clone https://github.com/kgwdonkey/dsh-header-controls.git
- Create a plugin link in the DSH profile directory. For example on Windows (administrator privileges or developer mode required):
mklink /J "%USERPROFILE%\.dsh\profiles\node_modules\dsh-header-controls" "<克隆到的路径>"
Linux or macOS users should use the `ln -s` command to create a symbolic link.
- Append a registration entry to the end of the
cordis.patch.ymlfile in the profile directory:
- $insert: node_modules/dsh-header-controls/lib/index.js
- Restart DSH. The new button will appear in the upper-right area of the session page (to the left of the Session log).
Usage¶
The operation logic for restart and sign-out is as follows:
- Restart: Click the capsule button directly. The system exits the current process, then automatically starts it again and refreshes the page. The whole process takes about 10-30 seconds, depending on startup speed.
- Sign Out: After clicking the button, it turns red and enters a confirmation state. Click it again to shut down the dsh process. After it is closed, restart it via the desktop shortcut.
Configuration and Notes¶
The plugin relies on the DSH startup configuration file to perform restart operations.
- Configuration reading: The restart helper reads
%LOCALAPPDATA%\DeepSeekHarness\launcher.config.jsonand obtains parameters such asnode(execution path),repo(repository path),profile,port, andhost. - Default fallback: If the configuration file is missing or some content is absent, the plugin uses default fallback values (for example,
node=process.execPath,profile=web, etc.). - System shim: If DSH has no prebuilt artifacts, the plugin falls back to the system-installed
dshcommand shim to start the service. - Supported environment: This plugin is currently applicable to the DSH dev preview version (0.1.0-rc.x, web profile).
Conclusion¶
dsh-header-controls achieves fine-grained control over DSH processes with minimal code. If you are developing with the DSH web profile and prefer managing service status through interface buttons rather than the command line, this plugin can significantly improve development efficiency.