dsh-reloader: Hot Reload and One-Click Restart for Desktop DSH

Preface

In the DeepSeek Harness (DSH) desktop version, the common practice for modifying plugins or adjusting the interface is to completely exit and restart the program. The desktop version treats window closure as “hiding to the tray” and pops up a confirmation during before-quit if tasks are running; there is no clean entry for “quit and return immediately.” With the advent of HMR, the host can reconcile profiles and reload plugins changed on disk, but such operations still require someone to integrate them into settings as one-click actions.

Below is an introduction to the community plugin dsh-reloader (Maintainer: kuroshio4396, GitHub: kuroshio4396/dsh-reloader). It targets the DSH Desktop (Electron packaged version) and provides two paths in the settings: “Reload Refresh” and “Auto Restart,” corresponding to refreshing plugins and the interface without closing the program, and completely terminating the process to be relaunched by an independent restarter, respectively.

What is this

dsh-reloader is a client-side plugin for DSH (engines.dsh is >=0.2.0 in package.json, MIT License, current version 1.0.0). Its responsibilities are focused:

  • Without closing the program: It allows the host to recompose the profile in the HMR queue, stop and reload plugins that have changed on disk, and then refresh the page to fetch data.
  • When a hard restart is needed: It terminates the entire Electron main process, and a PowerShell restarter detached from the job object restarts the desktop exe after a short delay.

The entry point is in the host interface: Settings → Reload & Restart.

Core Features

Reload Refresh

The behavior is similar to a forced refresh in a browser (the README compares it to Ctrl+F5), but the underlying mechanism is DSH profile reconcile, not merely clearing the cache.

  1. Calls ctx.hmr.reconcileProfile() within runExclusive, sharing the serial queue with other HMR changes.
  2. Plugins with files changed on disk are stopped, re-imported, and applied.
  3. The interface returns warnings, pending, and restartReason; pending indicates the number of modules that have been written to disk but require a full program restart to take effect.

Cost: The page will flash briefly, and the settings panel will close. If the reload replaces this plugin itself (file changes result in a new instance), memory state will be zeroed out, so the plugin writes results that need to be preserved to state.json.

When running dsh web in source mode, “Reload Refresh” is available; “Auto Restart” will prompt that it is not supported.

Auto Restart

Used for scenarios where the entire desktop process must be killed (e.g., some changes cannot take effect via HMR alone).

  1. After the frontend POSTs to the restart interface, the host uses launch-restarter.ps1 to invoke the restarter via WMI Win32_Process.Create (the parent process is WmiPrvSE.exe, avoiding being terminated along with Electron’s job object).
  2. The interface immediately returns ok, restarterPid, and delayMs (default delay 2500ms to allow the HTTP response to land first); the frontend can enter a countdown.
  3. The restarter verifies the process name is DeepSeek* in restart.ps1, uses taskkill /PID on the main process (without /T), waits for the host and child processes to exit, and then uses Start-Process to launch the exe.

Cost: The window will disappear for a few seconds, and ongoing tasks will be interrupted.

Installation and Activation

The plugin is installed into the desktop profile included with the desktop version, using the dsh.cmd bundled in the installation directory (the directory should contain DeepSeek Harness.exe):

# <Installation Directory> should contain DeepSeek Harness.exe
<Installation Directory>/resources/runtime/cli/bin/dsh.cmd plugin --profile desktop add "link:<absolute path to this repo>"

You can also install via git dependency:

<Installation Directory>/resources/runtime/cli/bin/dsh.cmd plugin --profile desktop add "https://github.com/kuroshio4396/dsh-reloader.git"

After installation, HMR usually loads the plugin immediately; if it does not load, you can click “Reload Refresh” once in the settings or manually restart the desktop version.

The maintainer provides a self-check script in the repository, which can be run when modifying code or troubleshooting integration issues:

node selfcheck.mjs

The README states that the self-check covers 13 items, including package fields, client module ID, cordis patch, API prefixes, and PowerShell script constraints.

Typical Usage

  1. Installed or modified other DSH plugins and want to apply changes without exiting the desktop: Open Settings → Reload & Restart and execute “Reload Refresh.”
  2. There are still pending items or the entire Electron process must be restarted: Use “Auto Restart” on the same page, wait for the countdown and the brief disappearance of the window, and the program will be relaunched.
  3. Developing this plugin or after forking: Run node selfcheck.mjs in the repository root directory to ensure routes, scripts, and packaging constraints are not broken.

The frontend detects /ping and selects an available prefix between /api/dsh-reloader/* registered in connection.fetch and /dsh-reloader/api/* on webServer, to be compatible with the desktop custom protocol and source mode.

Use Cases and Notes

Who is it for

  • Developers who frequently install and debug DSH plugins on the desktop version.
  • Users who need to minimize “quitting and reopening the entire program” but occasionally require a hard restart of the desktop version.

Environment and Limitations

  • “Auto Restart” is implemented for the Windows packaged version (PowerShell + WMI); do not rely on the restart chain in non-desktop packaging environments.
  • The plugin runs with the permissions of the current DSH process; before installation, please read the GitHub repository source code and MIT License to evaluate whether to include it in your desktop environment.
  • The community directory SkillHub Plugin Page has no official affiliation with DeepSeek or High-Flyer; it is solely community-collected information.

Conclusion

dsh-reloader consolidates “hot reload plugins and interface” and “complete restart of the desktop version” into two buttons on the settings page, bridging the gap between the DSH desktop version’s window-closing semantics and HMR capabilities. For further details on implementation (route mounting, HMR queue, restarter timing), you can read the repository README directly.

  • Directory Page: https://www.skillhub.cn/plugins/kuroshio4396/dsh-reloader
  • GitHub: https://github.com/kuroshio4396/dsh-reloader
羽毛球分组比赛记分
小程序二维码

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

Xiaoye