Introduction

Native modules in DeepSeek Harness (such as sharp and node-pty) are locked by the operating system while running, so directly overwriting the files can cause an EBUSY error. In container environments, a main process exit means container destruction, so regular hot replacement does not work. dsh-auto-update solves the automatic upgrade challenge for Harness on Windows, Linux/macOS, and container environments through a three-stage design of “staging + detached subprocess replacement after exit”.

Core Features

  • Overcoming file-lock and container limitations: Only staging is performed while running; after the main process exits and releases file handles, an atomic replacement is performed. It intelligently detects container environments and avoids triggering process.exit(0).
  • Cross-platform symlink adaptation: Supports restart addressing for Windows (dsh.cmd) and Linux/macOS (bin/dsh).
  • Safety and concurrency control: Includes a built-in atomic concurrency lock to prevent multiple concurrent update processes from corrupting the environment.
  • Lightweight interaction: Integrated into the Web interface, providing a capsule badge to display version status and an entry point for manually triggering updates.

Installation and Enablement

After the plugin is installed, configuration is automatically injected. If custom parameters are required, you can adjust them in ~/.dsh/profiles/web/cordis.patch.yml.

dsh plugin add dsh-auto-update

Typical Usage

  • Startup check: When the plugin starts, it automatically checks for the latest npm version and stages it.
  • Web interaction: A capsule badge appears in the bottom-right corner of the Web panel; click it to view version differences or manually trigger an update.
  • Automatic application: When Harness exits normally, the plugin automatically applies the staged update. The Web panel also provides an “Update and Restart” button.
  • Container environments: When a container environment is detected, the process-exit logic is disabled, and the UI prompts to update via the image.

Example configuration:

- insert:
  - id: auto-update
    name: 'dsh-auto-update'
    config:
      distTag: latest
      checkOnStart: true
      checkIntervalMinutes: 240
      autoStage: true
      applyOnExit: true
      relaunch: false

Notes

  • Requires Node.js >= 20.
  • Requires permission for global npm installation.
  • process.exit(0) is prohibited in container environments.
  • Native module updates must wait until the main process fully exits and releases file handles.

Conclusion

This plugin is maintained by a1113622001 and is open-sourced under the MIT license. It is suitable for scenarios requiring long-running, unattended operation of Harness.