dsh-power-switch: Graceful Exit for DSH Sidebar and Windows Boot Mode Switching

Introduction

When using DeepSeek Harness (DSH) to run the Web UI, the local dsh web process often needs to be terminated manually in the terminal or force-killed via the Task Manager. Force-killing risks losing unsaved sessions and settings. If you wish to launch it as a “standalone application window” or a “standard browser tab” on the next start, you typically have to modify shortcuts or startup parameters yourself. The dsh-power-switch introduced below, released by community maintainer SanYe-SanJiu, provides a one-click process termination button in the sidebar on the DSH client side and allows switching the startup mode for the next launch via a plugin card in the settings page. It supports Windows only.

What is this

dsh-power-switch is a client-side plugin for DSH (Category: Web UI / Process-related capabilities). It does two things: closes the local dsh web process via DSH’s built-in graceful exit path; and allows selecting whether the next launch should be an application window or a standard browser tab on the corresponding card in Settings → Plugins. Upon saving, it updates the desktop shortcut and restarts DSH. The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and the MIT license on GitHub before installation.

Maintainer and Repository: SanYe-SanJiu/dsh-power-switch. Community Directory Page: SkillHub Plugin Entry. The DSH ecosystem emphasizes “Everything is a plugin”; SkillHub and similar sites are independent community sites and have no official affiliation with DeepSeek or High-Flyer.

Core Features

Process Termination (Sidebar)

A ⏻ button appears at the bottom of the Web UI sidebar. Clicking it triggers a confirmation. After confirmation, it terminates the local process via DSH’s official graceful exit channels (such as ctx.appExit) instead of calling a shell force-kill, allowing sessions and settings to be persisted to disk first.

Startup Mode Switching (Settings → Plugins)

On the plugin card with the same name, you can switch between “Application Window” and “Standard Tab”. Pressing it once saves the setting. The plugin will update the Windows desktop shortcut (relying on Windows Script Host and .lnk) and restart DSH according to the startup method recorded by the host. If the current environment cannot safely restart, the plugin will explicitly refuse while keeping the service available.

Application window mode relies on desktop shortcuts; there is no equivalent implementation for macOS / Linux yet. The package.json declares "os": ["win32"], preventing installation on non-Windows platforms to avoid silent failure of the main functionality.

Environment and Version Requirements

Item Requirement
Operating System Windows 10 or higher
DSH >=0.1.6-alpha.2 <0.1.7-0 \|\| >=0.1.7-0 <0.2.0-0 \|\| >=0.2.0-0 <0.3.0-0 (see engines.dsh in the package)
Node.js >=20
Windows Script Host The desktop shortcut layer requires cscript.exe / wscript.exe; if disabled by Group Policy or antivirus software, the card will provide explanatory text. The shutdown button, settings area, and mode switches are unaffected.

The README states that verification has been performed on versions such as 0.1.6-alpha.2, the 0.1.7 line, and 0.2.0-rc.2.

Installation and Activation

Before installation, please cd into the DeepSeek Harness directory. The following three commands are equivalent, differing only in how DSH is invoked (global dsh, node apps\cli\lib\bin.js after building from source, or pnpm dsh when unbuilt):

dsh plugin --profile web add github:SanYe-SanJiu/dsh-power-switch#v1.1.9

--profile web is required (corresponding to dsh web / dsh --profile web). The package declares dsh.bundle.patch, which will automatically write to the profile’s dsh.profile.bundles upon installation, eliminating the need to manually edit JSON.

Two common scenarios when installation fails:

  1. If ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION appears, relax the pnpm release age policy for that command (must use kebab-case):
dsh plugin --profile web add github:SanYe-SanJiu/dsh-power-switch --config.minimum-release-age=0
  1. If the network is slow and github: fetch times out, increase the fetch timeout (example combined with the previous line):
dsh plugin --profile web add github:SanYe-SanJiu/dsh-power-switch --config.minimum-release-age=0 --config.fetchTimeout=600000

After installation, restart DSH once and open Settings → Plugins: The DSH power button card should appear in the list, and the ⏻ button should appear at the bottom of the sidebar.

When tracking the main branch without pinning a version (different from pinning v1.1.9):

dsh plugin --profile web add github:SanYe-SanJiu/dsh-power-switch

For local development, you can install using the link:<absolute path to this repo> format. See the repository README for details.

Typical Usage

  1. Daily Exit: Click ⏻ at the bottom of the Web UI sidebar, confirm in the dialog box, and wait for DSH to perform a graceful exit and terminate the process.
  2. Change Startup Method: Go to Settings → Plugins, find the DSH power button card, and switch between Application Window / Standard Tab. After saving, the shortcut is updated and DSH restarts automatically.
  3. Before Uninstalling: If currently in Application Window mode and you wish to immediately restore the original startup method, switch back to Standard Tab on the card before uninstalling; otherwise, the host-side logic will also restore the original shortcut when double-clicking the shortcut next time. Uninstall command:
dsh plugin --profile web remove dsh-power-switch

Verify successful installation: The profile’s dsh.profile.bundles contains the plugin, and node_modules\dsh-power-switch is a regular directory (a symbolic link or junction for link: installations).

Use Cases and Caveats

  • Suitable for: Users primarily using DSH Web UI on Windows who want to safely exit dsh web from within the interface and occasionally switch between “opening a window like a desktop app” and “browser tab”.
  • Not suitable for: macOS / Linux users (the package declares no support); restricted environments where Windows Script Host cannot be used—in this case, mode switching and shortcut-related capabilities are limited, but sidebar termination and the plugin settings area remain available.
  • Security habits: The plugin has the same permissions as DSH; only install from the GitHub repository mentioned above or a ref you trust, and read cordis.patch.yml and client injection logic before installation.
  • Discrepancy with introduction: The community description stating “closing the process in app mode automatically closes the current page, while tab mode does not” is consistent with the README’s emphasis on “graceful exit of the entire dsh web process”—what exits is the host process, not just a specific browser tab; specific UI behavior depends on the DSH version you are using.

Conclusion

dsh-power-switch consolidates “safely exiting local DSH” and “how to launch next time on Windows” into the sidebar and plugin settings card, reducing manual operations with terminals and shortcuts. The current release version is v1.1.9 (MIT).

  • Directory Page: https://www.skillhub.cn/plugins/SanYe-SanJiu/dsh-power-switch
  • Source Code and Full Documentation: https://github.com/SanYe-SanJiu/dsh-power-switch
羽毛球分组比赛记分
小程序二维码

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

Xiaoye