dsh-harness-restart: Add a restart entry to the DSH desktop title bar

Introduction

After DeepSeek Harness Desktop is packaged into an app, the native menu does not have an item for “Restart App and Host”; this is only available in the development version. Furthermore, plugins cannot insert items into the Electron native menu. To restart, you either have to manually end the process and double-click to start, or accept the fact that “once the shell exits, the Host goes with it as a subprocess”. dsh-harness-restart is a client bundle that solves this problem: it places a built-in restart button after the “More” launcher in the title bar menu strip. After confirmation, it restarts the app and Host. The maintainer is githublmk, and the category is Client.

What is this

One-sentence definition: Add a restart control to the DeepSeek Harness Desktop title bar. After clicking and confirming, restart the app and its Host.

The problem it solves is not “one more button”, but the missing restart path for the packaged desktop version, while ensuring that in the worst case the app won’t become unable to start (see “How it restarts” below for details).

Interface and Triggers

  • Only appears on the desktop. Requires the panel navigation to be located in the title bar (the layout where dsh-panel-titlebar moves the sidebar navigation into the title bar), or [data-windows-menu] to be at the top. Normal browser pages (dsh web) do not show—Restart is meaningless there.
  • Position is immediately after the right edge of the “More” launcher ([aria-haspopup]) +8px. It is re-measured every second as the sidebar folds, language switches, or window width changes; 168px is reserved on the right for window buttons, and it automatically hides if space is insufficient.
  • Interaction: Click to pop up a confirmation bubble (close by pressing Esc or clicking blank):

Restart App and Host?
Ongoing tasks will be interrupted, and the interface will automatically restore in a few seconds.
             [Cancel] [Restart]

After confirming, the button changes to “Restarting…”. When the request is rejected, the bubble reopens and explains the reason.
- Text is bilingual in Chinese and English, following the app language.

How it restarts

The Host is a subprocess of the desktop shell (Electron main). Once the shell dies, the Host is terminated along with it via the disconnect event, so the Host cannot “kill the shell and then relaunch the app”. The actual restart is completed by relaunch.mjs: it starts before killing the shell (detached from the parent process, with no pipes). After both the shell and Host have disappeared, it launches the app using a double-click equivalent (explorer.exe <app exe>) and confirms it is actually alive via the process table. If it fails, it retries; if it still fails, it falls back to direct launch.

Safety is a hard rule: Never kill the shell if the assistant’s ready flag cannot be obtained. The worst case is “button error, app as is”; it will never happen that the shell is killed but the app fails to start.

The executable path of the app is taken from the running Host’s process.execPath, not hardcoded to the install directory; the image name in tasklist also takes its basename from there.

The client will first GET the same route to verify the Host version. Old Host (e.g., loaded before an upgrade) will refuse to execute, avoiding a restart with mismatched halves.

Installation and Enablement

Installation is done via the bundle install command under the local profile:

# Install in local profile (links current directory)
plugin_manager install_bundle D:\path\to\dsh-harness-restart

cordis.patch.yml will insert a line:

- insert:
    - id: harness-restart
      name: 'dsh-harness-restart'
      config: {}

After installation, restart the app once (Host-side code and client bundle are both loaded at app startup). Refreshing the page is not enough, because the client bundle is a memory snapshot when the Host is activated; changing client.js also requires restarting the app.

Logs

Logs are all in %TEMP%\dsh-harness-restart\:

File Content
restart.log Complete timing of a restart: host: assistant ready → host: shell gone → relauncher: shell launch: application processes before=0 → launched through shell; application processes=6
client-probe.log Language source reported when the client mounts (active / documentLang / navigatorLanguage), used for troubleshooting text issues
launch-N.out.log / launch-N.err.log stdout/stderr of direct launch attempts (not produced when going through the explorer path)

Development and Verification

npm run check   # node --check for three entry points
npm test        # Headless React stub running the client: registration, text, version gate, POST, old version rejection

test/smoke-client.mjs runs the real client.js using a minimal React stub and a fake title bar DOM, requiring no browser. License is MIT.

Applicable Scenarios and Notes

Suitable for users who frequently restart the DSH app on Windows desktop and need a more reliable restart path than manually ending processes.

Several points must be clear:

  • Only available on Windows desktop; other environments return 409 desktop-only for the route.
  • Restart is “stop shell + relaunch”, not going through the shell’s graceful exit process: ongoing rounds will be interrupted (session logs are retained and remain after restart).
  • Automatic relaunch may fail in individual environments (process starts, window doesn’t appear). This can be seen in the logs; the fallback is manual double-click launch; future plans are to switch to the desktop shell’s built-in app.relaunch() recovery path.
  • The plugin runs with the permissions of the current dsh process. Before installing, check the source code and license (MIT), then decide whether to enable it in the profile.

Conclusion

The value of this bundle lies not in having an extra button, but in placing the act of “restarting the desktop” in an accessible position in the title bar, while constraining the risk to “app as is” using the ready flag gate.

Directory page: https://www.skillhub.cn/plugins/githublmk/dsh-harness-restart , Source code: https://github.com/githublmk/dsh-harness-restart .

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

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

Xiaoye