dsh-reload: Hot Reload DSH Plugins and Skills without Restart

Introduction

When developing plugins or Skills in DeepSeek Harness (DSH), modifying lib/index.js or Skill files on disk often requires restarting the application to see the effects. While DSH comes with HMR, testing on actual hosts reveals that third-party plugins installed by users in the profile’s node_modules are usually not automatically reloaded; nor does the Skill registry refresh itself based on TTL. The dsh-reload (maintained by louisyeaaah) introduced below uses two tools and two slash commands to encapsulate “modify code → immediate reload → rollback on failure” and “forced Skill rediscovery + invisibility diagnostics” into a workflow-type plugin.

What is this

dsh-reload is a DSH community plugin categorized as a workflow. It provides:

Tool / Command Function
reload_plugin For loaded plugins: clear module cache → release old fiber → re-run entry.init(); if any step fails, roll back to the old module. It can also activate “registered but not running” entries.
reload_skill Force Skill rediscovery (clear registry cache and broadcast skills/change), report additions/deletions/modifications, and diagnose why a specific Skill is invisible.
/reload-plugin Same as reload_plugin, manually entered in the Composer.
/reload-skill Same as reload_skill.

The plugin also bundles a Skill (skills/dsh-reload/SKILL.md) which is registered via ctx.skills.register() during apply(); it also includes a backup filesystem skill provider to mitigate issues with Skill lists in certain environments (see DESIGN.md in the repository for design details).

Why it is needed (Gaps with built-in HMR)

The README summarizes three types of gaps (measured on live hosts, evidence in DESIGN.md §6):

  1. Plugin source code is not watched: The profile’s HMR configuration has root: [], so editing plugin files does not trigger monitoring.
  2. HMR auto-reload skips node_modules: loadDependencies() returns immediately for modules with URLs containing /node_modules/. Plugins installed by users in <profile>/node_modules/<pkg>/ have an empty dependency set and will not be partially reloaded. Official plugins in the monorepo linked to packages/* via symlinks behave differently.
  3. No TTL for Skill registry: The directory is only cleared when the provider actively calls invalidate(); if the filesystem provider throws an error on list() for a specific root, it may cause a whole batch of Skills to become invisible.

reload_plugin addresses the first two types; reload_skill addresses the third type and includes diagnostics.

Environment and Limitations

  • DSH: Targets 0.2.0-rc.2 host internal APIs (cordis 4.0.4, @deepseek-ai/dsh-tools / dsh-commands 0.2.0-rc.2). package.json declares peer: >=0.2.0-rc.1 <0.3.0-0.
  • Node: engines.node is >=22.0.0; verified by the author on Node 24.18.1 / Electron 44.0.0.
  • Host-side only: Browser-side plugin code will not be reloaded (see repository Limitations).

Before installing or enabling, please check the GitHub source and the MIT license yourself; the plugin runs with the current DSH process permissions.

Installation

dsh plugin --profile <profile> <args> passes arguments to pnpm in the profile directory. The following commands are from the official README.

1. Install from GitHub

dsh plugin --profile <profile> add github:louisyeaaah/dsh-reload

2. Install from release tarball (no build required, URL pinned to tag)

dsh plugin --profile <profile> add "https://github.com/louisyeaaah/dsh-reload/releases/download/v0.1.4/dsh-reload-0.1.4.tgz"

3. From npm (after release)

dsh plugin --profile <profile> add dsh-reload

4. In-app: Open Plugin Manager / dsh-market and install dsh-reload. The package’s dsh.bundle.patch points to cordis.patch.yml, where the insert lines for id: tool-reload register the aforementioned tools and commands.

For local development, you can use the repository’s scripts/install.sh [profile] (default profile: desktop) to copy artifacts and merge patches; the documentation states that new patch lines can be hot-assembled without restart (approx. 4s), and you can self-check with reload_plugin({}).

Typical Usage

You can operate according to the README examples in sessions or tool calls:

reload_plugin({})                                     # List plugin entries: package name, entry id, running status
reload_plugin({ name: 'dsh-video' })                  # Reload by package name (entry id also works, e.g., 'tool-video')
reload_plugin({ name: 'dsh-video', dryRun: true })    # Preview modules to be cleared without making changes
reload_skill({ name: 'my-skill' })                    # Force rediscovery and diagnose this Skill

Supplementary behaviors:

  • reload_plugin({ filter: '@deepseek-ai/' }) can list a broader scope (defaults to visible third-party, local, and non-running entries).
  • reload_skill() without name only refreshes; reload_skill({ cwd: '/path/to/repo' }) uses an absolute path to resolve the project Skill root (~ expansion is not supported).
  • Manual input: /reload-plugin dsh-video, /reload-skill my-skill.

When reload succeeds, the report lists the module URLs that were cleared from cache and re-evaluated, the time taken, and whether the tool list changed; if it fails, it restores the cache and reinitializes the old module to avoid half-loaded states. Only own modules under the target plugin package root are cleared (excluding nested node_modules); shared dependencies remain in the cache.

Applicable Scenarios

  • You are developing or debugging third-party DSH plugins within a profile and want to verify tools / services / commands / prompts immediately after modifying lib/*.js without restarting the Electron application.
  • Skills exist on disk but are not visible in the session directory; you need to force refresh the registry and view diagnostic information.
  • You need to activate plugin entries that are installed but failed to start.

It is not suitable for scenarios expecting “hot updates for browser UI plugins”; nor should it replace compatibility checks for upstream DSH versions and peer dependencies.

Reference Links

dsh-reload turns plugin hot-reloading and Skill rediscovery into a repeatable workflow, suitable for shortening the local iteration loop in the DSH “everything is a plugin” ecosystem.

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

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

Xiaoye