dsh-app-control: Safely Restart and Update DSH Desktop in Session

Preface

When developing plugins or troubleshooting issues in DeepSeek Harness (DSH), it is often necessary to restart the desktop application, install new plugin versions, or verify that processes and plugin versions are functioning correctly. If these operations are triggered by scripts or models within the DSH session, it is easy to stumble into pitfalls regarding the Windows process tree, batch file line endings, and plugin loading: for instance, the application closes but nothing reopens it, or a tool registers successfully but never actually executes. Below is an introduction to the client-side plugin dsh-app-control, released by maintainer cheng-wj. It exposes three tools to the model, implementing predictable restarts, updates, and health checks on Windows.

What is this

dsh-app-control is a DSH plugin. Repository: cheng-wj/dsh-app-control, Community Directory Page: skillhub.cn Plugin Page. Description: Restarts, updates, and inspects the DeepSeek Harness desktop application (Windows) from the model side. License: MIT; package.json indicates version 1.0.0, requiring Node >=18, DSH >=0.1.7-rc, and supports win32 only.

The plugin’s core value lies not just in “being able to restart,” but in ensuring the restart does not kill the calling chain—restarting DSH from within a session requires avoiding multiple independent failure points, where any single failure could result in the application closing and failing to reopen without any obvious error.

Three Model Tools

Tool Function Interrupts Session?
dsh_status Lists DSH processes, python memory bridge, and installed plugin versions (compared against the latest in the registry) No, read-only
dsh_restart Cleanly closes all DSH processes and automatically reopens them after confirming exit Yes
dsh_update Installs a specified plugin version (bypassing already-installed issues), then restarts Yes

The model can call these directly. Typical interactions include “Help me restart DSH” → dsh_restart; “dshmarket update failed” → dsh_status first, then dsh_update with input like dshmarket@1.66.44; “Memory plugin not working” → dsh_status to check if the python bridge process is running.

Installation and Activation

dsh plugin add is fundamentally equivalent to pnpm add and accepts Git repositories, local directories, and tarballs. This plugin is not published to npm; GitHub is the distribution channel. Please review the source code and license before installing; the plugin runs with the permissions of the current DSH process.

dsh plugin --profile desktop add git+https://github.com/cheng-wj/dsh-app-control.git

This installs a snapshot of the repository. The README notes that when installing from Git, the CRLF in assets/dsh-tools.bat is preserved by .gitattributes, allowing the three tools to register correctly. To upgrade, re-run add.

dsh plugin --profile desktop add link:"C:\Users\ZY\Documents\deepseek-harness\DefaultWorkspace\dsh-app-control-plugin"

link: creates a soft link to the directory. After modifying src/index.js, simply restart to apply changes without repackaging.

Method 3: Tarball Offline Distribution

Download the .tgz from Releases, or package it yourself and run:

dsh plugin --profile desktop add "C:\path\to\dsh-app-control-1.0.0.tgz"

Suitable for intranet distribution or archived snapshots.

Configuration

Add configuration to the plugin line in the profile’s cordis.patch.yml, for example:

- dsh-app-control:
    delaySeconds: 10   # Countdown seconds, leaving room for cancellation
    profile: desktop   # Default profile for dsh_update

dsh_restart and dsh_update can also override delaySeconds via call parameters; passing 0 indicates an immediate restart.

Implementation Highlights (Why a Dedicated Plugin is Needed)

The README lists the following issues as design motivations for the plugin; the first three have been triggered in real-world development.

  1. taskkill /T kills the caller: If the scheduling script is a child process of DSH, /T traverses the process tree upwards and terminates itself, leaving no one to handle the reopening. Solution: Use WMI Win32_Process.Create to launch the scheduler so the parent process is WmiPrvSE.exe, which is outside the DSH tree.
  2. Batch start does not truly detach: New processes inherit the cmd console; closing the “black window” sends a CTRL_CLOSE_EVENT to Electron. Reopening the app also goes through WMI to avoid console sharing.
  3. .bat must use CRLF: With pure LF, cmd.exe offsets for call :LABEL are incorrect, and the script can silently stop midway (process closed, not reopened, no error). The plugin checks CR/LF byte counts before running and repairs them if necessary.
  4. cmd.exe treats = as an argument separator: --delay=5 becomes two arguments. Parsing requires matching the bare --delay and taking the value from the next argument; update with an empty package name validates the package list before closing the app.
  5. Plugin installed but apply() never executed: Config must be a schemastery Schema; peer dependencies should be resolved lazily/optionally, otherwise the Loader might silently skip the entire line. Diagnostics can reference %DSH_HOME%\dsh-app-control\logs\apply-trace.log.

At runtime, scripts under assets are copied to $DSH_HOME/dsh-app-control/scripts/, and logs are written to $DSH_HOME/dsh-app-control/logs/ to avoid writing into node_modules.

Applicable Scenarios and Notes

  • Suitable for: On Windows desktop DSH, letting the model or you perform status checks, controlled countdown restarts, and plugin updates with version numbers within a conversation.
  • Platform: Windows only; on non-Windows hosts, tools still register but return a clear error upon invocation.
  • Session: dsh_restart / dsh_update interrupt the current conversation; save your work before use.
  • Single Instance: Electron’s single-instance behavior causes duplicate launches to fall back to the existing instance; reopen failures might occur without a popup, requiring log inspection.
  • Ecosystem: DSH adheres to “everything is a plugin”; skillhub.cn is a community directory and has no official affiliation with DeepSeek / Hithink RoyalFlush.

Conclusion

dsh-app-control consolidates “restarting desktop DSH, updating plugins, and checking processes and versions” into three model tools, handling common self-destruction and silent failure issues on Windows by using WMI to escape the process tree. For installation, use the command from the README: dsh plugin --profile desktop add git+https://github.com/cheng-wj/dsh-app-control.git; for details and a complete explanation of the five pitfalls, please refer to the repository README.

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

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

Xiaoye