dsh-restart-button: One-Click Restart for DeepSeek Harness

Introduction

After running for an extended period, the DeepSeek Harness (DSH) desktop application and dsh web can occasionally experience issues such as freezing or missing windows following a restart, caused by environment pollution or abnormal process states. While manually quitting and reopening the application can resolve these issues, the process is cumbersome and prone to overlooking necessary environment cleanup. DSH adopts the Cordis plugin architecture, where plugins run with the permissions of the current process. This provides a solid foundation for adding restart capabilities without modifying DSH’s core logic.

This article introduces dsh-restart-button, a client-side plugin that provides one-click restart capability for DSH, supporting both desktop and Web modes.

Plugin Overview

dsh-restart-button is a client-side plugin for DeepSeek Harness, maintained by justin0406. It leverages Cordis patches and Web client injection to add a restart button next to the “Settings” button at the bottom of the DSH sidebar. When clicked, it displays a confirmation dialog, after which a background helper orchestrates the process exit and the launch of a new instance, ensuring reliable operation on both macOS and Windows.

Core Features

  • One-click restart: Triggers the restart workflow via a sidebar button in both the desktop application and dsh web mode.
  • Platform support:
  • macOS (desktop app and dsh web)
  • Windows (desktop app and dsh web)
  • Linux is not supported; the button will report unsupported-platform and will not perform any unintended actions.
  • Process cleanup:
  • The desktop application (Electron) exits through the standard quit flow, cleaning up related processes and LaunchServices registrations.
  • dsh web replaces the current service process tree; the page automatically refreshes by polling /api/dsh-restart/status when the hostPid changes.
  • Environment hygiene: Avoids inheriting variables such as ELECTRON_RUN_AS_NODE to prevent the new instance from failing to start in Node mode.
  • API endpoints:
  • GET|POST /api/dsh-restart/status: Returns the current status and diagnostic information.
  • POST /api/dsh-restart/restart: Initiates a restart; requires a token, with optional dryRun and delayMs parameters.

Installation and Enablement

dsh-restart-button is loaded through the Cordis plugin mechanism, consisting of two parts: a bundle patch and a client injection:

{
  "dsh": {
    "bundle": {
      "patch": "./cordis.patch.yml"
    },
    "client": {
      "platform": "web",
      "immediately": true,
      "inject": [
        "@deepseek-ai/dsh-client-locale",
        "@deepseek-ai/dsh-client-ui-layout",
        "@deepseek-ai/dsh-client-ui-sidebar"
      ]
    }
  }
}

After installation, the plugin automatically adds a restart button at the bottom of the sidebar, requiring no additional configuration.

Typical Usage

  1. In the DSH desktop application or dsh web, locate the restart button at the bottom of the sidebar (next to Settings).
  2. Click the button to display a confirmation dialog, which explains the current mode (the desktop application will fully quit).
  3. Once confirmed, the plugin sends a request via /api/dsh-restart/restart, and the background helper executes the exit and restart according to the platform-specific strategy.
  4. After the restart completes, the page or application will automatically return to an available state.

Use Cases and Notes

  • Use cases: Scenarios where DSH needs to be restarted periodically or on demand to clean up the environment, resolve freezes, or fix abnormal process states.
  • Notes:
  • The plugin runs with the permissions of the current DSH process. Please ensure the installed source code and license are trustworthy.
  • Linux is not currently supported, but the button will not trigger any unintended actions.
  • Confirm that the current session has been saved or does not require saving before restarting.

Summary

Through the Cordis plugin mechanism, dsh-restart-button provides DeepSeek Harness with cross-platform, controllable one-click restart capability, supporting both the desktop application and dsh web mode. By performing environment cleanup and process tree replacement, it ensures the system returns to an available state after restart, making it ideal for scenarios requiring frequent restarts or troubleshooting of anomalies.

Table of Contents | GitHub

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

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

Xiaoye