Preface

In the default behavior of the DeepSeek Harness (DSH) desktop client, clicking the window close button usually only minimizes the application to the tray, while the process continues running in the background. For scenarios where the process must be fully terminated (such as system maintenance, clearing memory, or specific restart workflows), this is often not direct enough. The dsh-plugin-power-button plugin adds separate shutdown and restart entry points to the right of the sidebar user button, enabling one-click full exit and verification of restart status.

Function Overview

  • Location and entry point: The button is located at the far right of the user (account) button at the bottom of the sidebar, and clicking it only provides the “Shut Down” and “Restart” options.
  • Full exit: Clicking “Shut Down” terminates the Electron shell process, causing the window and taskbar tray icon to disappear simultaneously, unlike normal window minimization.
  • Automatic restart and verification: “Restart” first performs a full exit; after the Web port is released, it automatically relaunches DSH and verifies whether the port is listening again.
  • Work confirmation: If an active session, queued messages, or background tasks are detected, a secondary confirmation dialog appears first; even if the status query fails, it is treated as having work and requires confirmation.
  • Environment restriction: Limited to the Windows 10/11 desktop client. On non-desktop clients (such as dsh web) or non-Windows platforms, the button is automatically hidden and API calls are rejected.
  • Security mechanism: The API requires an application/json Content-Type, same-origin requests, and a nonce generated at startup to prevent malicious shutdown via cross-site scripting. It uses Node scripts instead of PowerShell for execution, avoiding interception by security software.

Installation and Enablement

Before using it, ensure that the environment meets the following dependencies:
* Node.js >= 20
* DSH desktop version >= 0.2.0-rc.1

Run the following command to install the plugin:

dsh plugin --profile desktop add github:WovenJunct/dsh-plugin-power-button

After installation, restart DSH and refresh the page. A ⏻ button will appear to the right of the user button in the lower-left sidebar.

Cautions

  • Interrupted reply: Force-terminating the process interrupts an in-progress reply, and the session log may lose the last segment.
  • Restart risk: In extreme cases (e.g., security software intercepts the assistant process), the restart may shut down without starting again; check the logs.
  • Log location: All operation logs are recorded in %USERPROFILE%\.dsh\dsh-plugin-power-button.log.

Summary

By using process ownership controls and secure interface validation, the plugin provides Windows desktop users with a controllable process management entry point. For details, see the GitHub repository.