Introduction¶
When performing long-running workflows in the DeepSeek Harness (DSH) desktop client, two types of needs often arise: letting the Agent pull up a new desktop process after modifying configuration or installing a plugin, and not wanting to manually exit and reopen the client every time. The official tray menu usually only has Open and Exit, and the Host side doesn’t have an out-of-the-box “Restart Desktop Shell” tool. dsh-desktop-restart registers a restart_dsh tool in the Host and performs a targeted patch on lib/main.js inside the desktop’s app.asar, adding a “Restart DeepSeek Harness” option to the tray, which works in conjunction with the two restart channels on the Host side.
Overview¶
dsh-desktop-restart is maintained by community maintainer liangzz1998 and is categorized as a “Workflow” in SkillHub. Its positioning can be summarized as: the Host plugin (lib/index.js) provides restart_dsh, along with a patch script targeting the DSH desktop app.asar, enabling the main process to support graceful restarts and falling back to a PowerShell helper via WMI when there is no handshake. Version is 0.1.0, license MIT, runtime requirement Node.js >= 20.
Core Features¶
restart_dsh and the Two Restart Channels¶
The Host plugin registers the restart_dsh tool. Actual restarts are divided into two paths, summarized in a table in the README.
| Channel | Trigger Condition | Method |
|---|---|---|
| Graceful | Received desktop-restart-capable handshake from main process |
Host → Main Process desktop-restart → Delayed app.relaunch() + Exit |
| Fallback | No handshake (e.g., DSH update overwrote patch) | Use WMI Win32_Process.Create to launch tools/restart-helper.ps1 outside the DSH process tree, delay ending the desktop shell process, and after it exits, relaunch it using the same exe |
The reason for using WMI for the fallback is explained in the README: if the Host spawns the helper directly, the helper belongs to the Host’s child process. When the desktop shell is terminated, the process tree is taken away with it, and testing shows it fails after Stop-Process but before the restart. The process created by WMI is parented by WmiPrvSE.exe, which is not inside the DSH tree, so the helper can still complete the launch after the shell exits.
Both channels go through Host’s own shutdown process (subprocesses like MCP, Blender server, etc. will be tidied up together), rather than a hard kill of the entire machine.
Tray Menu Patch¶
The patch only modifies lib/main.js inside app.asar, totaling 5 places: add “Restart DeepSeek Harness” to the tray menu; implement restartDesktopApplication() (app.relaunch() + confirmation-free exit); Host event validator accepts desktop-restart; Main process executes restart when receiving desktop-restart (can be delayed); Send desktop-restart-capable handshake to Host after Host is ready.
The implementation appends the new main.js to the end of asar (4-byte aligned), modifying only the size / offset / integrity hash in the corresponding record in the header JSON; the old and new values have the same bit count, the header length remains unchanged, other files in asar and native modules in app.asar.unpacked are not modified, and no repacking of the whole package is needed.
Tools and Script Files¶
lib/index.js— Host plugin entrytools/patch-desktop-asar.mjs— Patchapply/status/reverttools/restart-helper.ps1— Fallback restart helper打补丁.cmd/检查补丁.cmd/还原补丁.cmd— Double-click entry points (readsNODEenvironment variable if node is not found)
Installation and Activation¶
The collected information does not provide a unified dsh plugin add type command; the maintainer describes in the README “Status (Installation 2026-11-15)” installing the plugin into the desktop profile: pointing to this plugin directory (junction) in dsh.profile.bundles and link: dependencies in package.json.
The steps for patching and activation are as follows.
- Apply patch to
resources/app.asarunder the DSH installation directory (required for first time or after upgrade). You can double-click打补丁.cmddirectly, or execute in the plugin directory:
node tools/patch-desktop-asar.mjs apply
-
The patch is idempotent: it will skip if already patched. Use
检查补丁.cmdornode tools/patch-desktop-asar.mjs statusto check the status. -
Effective Condition: Must restart DSH once after patching. If the current process still loads the old
main.js, the new tray menu item will not appear; the handshake and graceful channel also rely on the new main process logic.
A full DSH upgrade will replace app.asar, the tray item will disappear, and restart_dsh will fall back to the fallback channel; the README notes that when dryRun:true, it will clearly prompt that the patch is missing. Recovery is the same as the initial patching:
node tools/patch-desktop-asar.mjs apply
If you need to restore to the official original state, you can double-click 还原补丁.cmd or execute node tools/patch-desktop-asar.mjs revert, then restart DSH (the file length will be truncated back).
Installation and patching read/write app.asar under the local DSH process permissions. You should read the repository source code and MIT license before operating, and confirm that the installation path and backup strategy fit your environment.
Typical Usage¶
- Agent Side: On the desktop profile already loaded with this plugin, the Agent calls the Host tool
restart_dshto trigger the restart; graceful channel if handshake exists, otherwise WMI +restart-helper.ps1. - User Side: Right-click the tray to use “Restart DeepSeek Harness” (appears after the patch is effective and DSH has been restarted).
- After DSH Upgrade: First
applythe patch, then restart DSH; avoid long-term reliance solely on the fallback path. - Check and Rollback: Use
statusto check the patch; userevertthen restart to return to the unmodified state.
Applicable Scenarios and Notes¶
Suitable for running automation workflows on Windows desktop DSH, or scenarios where Agent or tray requires a one-click soft restart. Not suitable to treat “Restart” as a cost-free operation: the README states that restarts interrupt the current round of conversation (session records are preserved, resuming after restart). Only handles the desktop side; the tool will error on dsh web form. The patch relies on text anchors of the current version main.js; if DSH major version changes related code, apply will reject execution due to missing anchors and will not corrupt files.
The plugin runs with the current DSH/Host process permissions and performs binary-level modifications on app.asar, which is a highly sensitive operation. The SkillHub directory is an independent site with no official affiliation to DeepSeek/Fangfang; this plugin is also a community repository. Please verify the source code and version (0.1.0) yourself before use.
Conclusion¶
dsh-desktop-restart converges “Restart Desktop Harness” into the Host tool restart_dsh and an optional tray entry, using handshake + WMI fallback to cover patch failure. Directory page: https://www.skillhub.cn/plugins/liangzz1998/dsh-desktop-restart, Source code and full description: https://github.com/liangzz1998/dsh-desktop-restart.