Foreword

The core design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” During development or operations, you may sometimes need to restart a service without entering the terminal, calling systemctl, or directly manipulating processes. dsh-restart-control is a plugin maintained by the developer darkchaox. It adds a controlled “Restart DSH” section to the DSH Web interface, allowing administrators to send restart requests through a browser. The plugin automatically selects the most appropriate method to execute the restart based on the host environment.

Core Features

The plugin primarily provides the following capabilities:

  • Web UI section: Adds a “Restart DSH” section to the DSH Web settings page, providing a confirmation button, status display, and refresh functionality.
  • Cross-platform support: Supports Windows, macOS, and Linux, and requires no root, sudo, or shell execution permissions.
  • External manager integration: Works with external service managers such as systemd, PM2, Docker, and Windows Service.
  • Security sandbox: Browser requests are restricted to the settings namespace and only allow submission of fixed-format state. No arbitrary shell commands or file operations are executed.
  • Reliable confirmation: Uses the bootId mechanism to confirm that the service actually went through a restart, preventing false success states.

Installation and Enablement

Before installation, ensure that the official DSH CLI is installed and that you are using the web profile.

Official installation command:

dsh plugin --profile web install darkchaox/dsh-restart-control

After installation, restart DSH and refresh the Web settings page to see the new “Restart DSH” section.

Usage

Basic Operation Flow

  1. Find the “Restart DSH” section on the DSH Web settings page.
  2. Click the “Restart DSH” button.
  3. Confirm that the current Web connection will briefly disconnect, then click “Confirm restart”.
  4. The plugin saves the scheduled state and performs the restart according to the environment variable configuration.
  5. After DSH reconnects, the UI polls the state until it detects a new bootId and marks it as “Restart successful”.

Restart Mode Configuration

The plugin uses the environment variable DSH_RESTART_CONTROL_MODE to control its behavior. If not set, the default is auto.

auto (recommended for manual startup):
* Windows: directly uses the built-in portable helper.
* macOS / Linux: if systemd is detected, uses external; otherwise, uses portable.

portable:
* Starts the built-in helper, waits for the current DSH process to exit, and then relaunches DSH using the original executable, arguments, working directory, and environment.
* Suitable for environments that are started manually.

external:
* After saving the scheduled state, exits the process with exit code 75 without starting a child process itself.
* Suitable for environments where managers such as systemd, PM2, Docker, or Windows Service are responsible for automatic restarts.

Configuration examples:

In PowerShell 7 (must be set in the same session):

$env:DSH_RESTART_CONTROL_MODE = 'portable'
# 在此執行原本的 DSH 啟動命令

In Docker Compose:

services:
  dsh:
    environment:
      DSH_RESTART_CONTROL_MODE: external
    restart: on-failure

Applicable Scenarios and Notes

Applicable scenarios:
* Administrators who need to quickly restart DSH through the Web interface.
* Production environments that already use PM2, Docker, or Windows Service.
* Container environments where you want to restart a service without root privileges.

Notes:
* Do not mix modes: If automatic restart is already configured in Docker, systemd, or Windows Service, explicitly set DSH_RESTART_CONTROL_MODE=external to avoid the portable helper and the external manager launching multiple DSH processes at the same time.
* Permission requirements: The plugin runs with the permissions of the current DSH process and does not require additional system-level permissions.
* Privacy and security: This plugin does not send data to an external cloud, does not require an API key, and completes all state management locally.

Conclusion

dsh-restart-control enables a cross-platform, secure DSH restart flow through simple Web actions. While preserving control, it minimizes dependence on elevated environment permissions. See its GitHub repository for more details.