dsh-plugin-restart-control: "Reload Kernel" and "Restart Application" in DSH Settings Page

Preface

When modifying plugin combinations, tuning profile configurations, or iterating on plugin host code within DeepSeek Harness (DSH), you often need to make changes take effect. The official desktop version consists of an Electron shell and a host subprocess: plugins cannot access the shell’s IPC whitelist, nor can the host exit and restart on its own, otherwise it would trigger the crash recovery process. The community-maintained client plugin dsh-plugin-restart-control adds a Restart section to the settings page, providing two levels of operations achievable under official semantics: Reload Kernel (HMR recomposes the plugin tree) and Restart App (detached helper restarts the shell). The following introduces what it does, how to install and enable it, and the boundaries to be aware of during use.

What is this

dsh-plugin-restart-control is a client-side plugin for DSH, repository MerlinShieh/dsh-plugin-restart-control, maintained by MerlinShieh, MIT License. It exposes two levels in Settings → Restart, corresponding to the two paths used by DSH itself: hot reload without reopening the process, and completely terminating the shell before launching it again.

What the two levels do

Level Action Cost
Reload Kernel Triggers DSH’s HMR to recompose the entire plugin tree (re-reads config, remounts plugins) Takes seconds; process and window are retained; package version / native module changes do not take effect
Restart App Detached helper terminates the shell process and relaunches the same executable More thorough; interrupts running tasks; window is recreated

The implementation of Reload Kernel is the same as how dsh-market handles plugin start/stop: it appends or updates a timestamped comment (# dsh-plugin-restart-control: kernel reload marker …) to the current profile’s cordis.patch.yml. HMR detects the configuration layer change and recomposes the plugin tree; the plugin only adds or removes its own comment line without altering your existing configuration.

Restart App utilizes a detached helper: it launches the helper using process.execPath with ELECTRON_RUN_AS_NODE=1 (no separate Node installation required), first terminates the shell (shell exit disconnects host IPC, causing the host to close gracefully), forcefully kills the host if necessary, and waits for the port to be released before launching a new instance. The entire process terminates processes by PID to avoid taskkill /IM accidentally harming helpers with the same name.

Why these two levels instead of “One-click relaunch”

In the official desktop version, the IPC between the host and the Electron main process is a closed whitelist (dsh-desktop-host’s process.on("message") only recognizes shutdown / quit-inspection / update-tasks). Messages outside this whitelist cause the main process to directly receive SIGTERM. The main process treats the host’s active exit as a failure (dsh desktop host stopped, acknowledged an unrequested shutdown) and pops up a crash recovery dialog. Therefore, plugins cannot request the shell to execute app.relaunch(). This plugin provides the two strongest feasible levels under these constraints.

Installation and Enablement

dsh plugin add only packages the plugin into the profile; it does not automatically write to the profile’s bundle list. After installation, you must go to Settings → Plugins to turn on the switch for dsh-plugin-restart-control (equivalent to adding to dsh.profile.bundles), otherwise it will not be loaded; the official plugin manager will do this step for you.

Method 1: GitHub (Recommended)

dsh plugin --profile <profile> add "github:MerlinShieh/dsh-plugin-restart-control"

The package is resolved as dsh-plugin-restart-control. The README mentions that pnpm installation takes about 5 seconds in actual testing.

Method 2: Release tarball (Offline / Intranet)

dsh plugin --profile <profile> add https://github.com/MerlinShieh/dsh-plugin-restart-control/releases/download/v0.1.0/dsh-plugin-restart-control-0.1.0.tgz

Method 3: Official Desktop Version

The desktop version exclusively owns the desktop profile; external CLIs will report profile "desktop" is managed exclusively by the Electron application for it. Please go to Settings → Plugins → Add Plugin, enter any of the installation sources above, and then turn on the bundle switch.

Method 4: Local Path (Development Iteration)

pnpm add file:/absolute/path/to/dsh-plugin/restart-control

file: installation is a snapshot: you need to re-run pnpm add after changing source code; the plugin inside node_modules does not participate in HMR monitoring, so host half-zone code changes require Restart App.

The npm package has not been published yet; once published, you can use dsh plugin --profile <profile> add dsh-plugin-restart-control (supports version ranges and pnpm update).

Typical Usage

After installation, open Settings → Restart:

  1. Reload Kernel: Click to write the marker line and trigger hot reload; the interface will prompt “Plugin tree is recomposing”.
  2. Restart App: Click to enter a secondary confirmation (to avoid accidental task interruption); after confirmation, it prompts “Restarting”, and this page automatically restores after the app returns.
  3. View Restart Logs: The helper writes steps to $DSH_HOME/dsh-plugin-restart-control/restart.log. The settings page allows viewing the tail; this is the primary troubleshooting basis if a restart fails.

If there are currently running tasks, there will be an orange warning at the top of the section; Restart App will interrupt them.

Security and Compatibility

The control route only accepts: Loopback (or Host headers declared in webRuntime.trustedHosts) Host headers; Same-origin browser markers (Sec-Fetch-Site is not cross-site, Origin matches Host); POST requests with content-type: application/json, body limit 64 KiB. This is a barrier against DNS-rebinding / cross-site requests, not authentication.

peerDependencies uses range declarations (>=0.1.0-rc.6 <0.3.0-0), passing the official compatibility check on DSH 0.2.0-rc.2. The host half requires webServer and webRuntime; the client half requires slots and locale. In package.json, engines.dsh is >=0.2.0-rc.1 <0.3.0-0, Node >=20.

Use Cases and Notes

Who it is for: Developers who frequently start/stop plugins, modify patch configurations, or need to quickly apply plugin tree changes in DSH; use “Restart App” when a thorough Electron shell restart is needed (e.g., for native modules or already imported Node module issues).

Limitations you must know:

  • “Reload Kernel” is not equal to restarting the process: it does not reload modules already imported by Node, nor does it resolve native addon occupations; use “Restart App” if needed.
  • “Restart App” forcefully terminates the shell by PID, bypassing before-quit confirmation; running tasks will be interrupted.
  • Failure recovery is a streamlined version: the helper only writes logs, without a recovery page similar to dsh-market; if the app does not return automatically, please start it manually and check restart.log.
  • If cordis.patch.yml does not exist or is empty, “Reload Kernel” returns patch-missing and remains disabled.

The plugin runs under the current DSH process privileges; please review the repository source code and MIT license yourself before installation to ensure compliance with your environment policies. The DSH ecosystem is “everything is a plugin”; the community directory SkillHub Plugin Page is an independent site with no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-plugin-restart-control completes the DSH settings page with actionable “Reload Kernel + Restart App” levels, providing a reproducible path under the constraints of official IPC and host lifecycle, accompanied by task occupation alerts, secondary confirmations, and restart logs. For installation sources and details, see the GitHub Repository and SkillHub Directory Page.

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

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

Xiaoye