DeepSeek Harness Restart Plugin

Introduction

During the development and debugging of DeepSeek Harness (DSH), it is sometimes necessary to restart the dsh web process. This usually happens when configuration files are modified, the plugin host side is changed, ports or the workspace are adjusted, or session state needs to be cleared. The traditional approach is to open a terminal, manually stop the process, and restart it. The dsh-plugin-restart plugin provides a restart button in Settings, replacing the running service process with a single click and allowing the page to reconnect automatically.

Plugin Overview

The plugin is maintained by chenkui-luo and is released under the MIT License. It solves the problem of requiring terminal operations or reopening the desktop icon to restart by adding a restart card to the DSH settings UI. The plugin runs in DSH’s web context, does not require administrator privileges, and does not touch system configuration.

Installation and Enablement

To install, run the following command in a terminal:

dsh plugin --profile web add github:chenkui-luo/dsh-plugin-restart

After installation, refresh the page and open Settings to see the restart option.

Core Features

  • Process replacement and automatic reconnection: After clicking the button, the current dsh web process serving the page is replaced, and the page reconnects automatically.
  • No terminal operations required: The entire process is completed in the browser’s settings; no command-line terminal is needed.
  • Handles hot-reload failure scenarios: Provides a solution for cases that cannot be fixed by hot reloading, such as plugin host-side changes, configuration changes, port changes, or session-state clearing.
  • Security mechanism: Only authenticated same-origin loopback requests are supported; proxy-forwarded requests are not accepted.
  • Privilege control: No administrator privileges are required, and system configuration is not modified.

Usage Flow

After clicking the restart button in Settings, the following operations are performed in sequence in the background:

  1. Initiate the request: The page sends a POST /dsh-restart/restart request, which is an authenticated same-origin request.
  2. Start the helper process: The host side starts a detached helper process and responds to the request before stopping any service.
  3. Wait for port release: The helper waits until the port stops accepting connections.
  4. Launcher takeover: The launcher starts a new dsh web instance and writes the startup token file.
  5. Confirm replacement: The helper confirms that the new instance is ready, then allows the old process to exit.
  6. Page reconnection: The page detects the new instance ID on the next poll and reloads itself.

Notes

  • Conversation interruption: The restart interrupts the current in-progress conversation turn. This is standard behavior for a restart.
  • Port occupancy: If the port is occupied by a process that the launcher cannot identify (for example, a manually started dsh web), the restart takes over that port, including its process tree.
  • Error reporting: When critical files are missing, the button reports a clear error instead of pretending to work.

Logs and Configuration

Detailed logs of the restart process are saved locally:

%LOCALAPPDATA%\DeepSeekHarness\restart-plugin\logs\restart.log

The plugin supports the following environment variables:

Variable Purpose
DSH_RESTART_INSTALL_DIR Launcher runtime directory (default %LOCALAPPDATA%\DeepSeekHarness)
DSH_RESTART_DATA Private data directory for the plugin (default <INSTALL_DIR>\restart-plugin)
DSH_RESTART_LAUNCHER Points to an alternate launcher script (for portable installations or testing)

Conclusion

This plugin simplifies day-to-day DSH maintenance by automating the process replacement and reconnection workflow. For more details and source code, see the plugin catalog or the GitHub repository.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye