dsh-plugin-updater: Keep Plugins Up to Date and Hot-Reload Local Code

Introduction

The plugin ecosystem of DeepSeek Harness (DSH) follows a “everything is a plugin” design, and developers often use link: dependencies to install local working copies into a profile. However, during local development, changing a single line of code requires restarting the entire Harness, which is inefficient. At the same time, once plugins are installed via npm, there is no ongoing reminder about new versions. The dsh-plugin-updater plugin solves both problems: it checks the npm registry for updates and reports them, while also allowing locally developed plugins to take effect immediately after changes without restarting Harness.

What It Is

dsh-plugin-updater is a DSH workflow plugin developed by maintainer keycapai. It checks the npm registry to compare installed versions and monitors file changes in local development directories. When changes are detected, it makes new code take effect immediately by clearing the Node module cache, re-importing, and restarting the fiber. By default, it only checks and reports without modifying the profile on its own; updates must be triggered manually or via a command.

Core Features

1. Check for npm Registry Updates

The plugin compares installed plugins against the latest versions available in the registry, listing “installed version vs. latest version.” Auto-installation is disabled by default to avoid replacing running code in the background. It only checks and reports—installation is left to the user’s decision.

2. Hot-Reload Local Development Plugins

Local plugins are installed into the profile via link: dependencies, with node_modules pointing to the working directory. Node’s ESM module cache is keyed by URL, so even after a change, a re-import still returns the old module object. The plugin watches the directory the profile points to, and upon detecting a change, it performs the following steps:

  1. Removes the corresponding module from the running Node module cache (using Map.prototype.delete.call(loadCache, url) to clear the full cache);
  2. Clears the CJS require.cache;
  3. Re-imports the module, reading the latest code from disk;
  4. Stops the old fiber, activates the new module with the original configuration, and places the new fiber back where the loader expects it.

Same process, same profile, new code. If the new code throws an error, the old module graph and old plugin object are restored, keeping the Host unaffected.

3. Tool Commands

After installation, a plugin_update tool is provided. Common commands include:

  • status: Lists each plugin’s type (registry / local dev / tarball / git), installed version, whether a new version is available, and the last refresh result for local plugins.
  • check: Immediately re-queries the registry (read-only network call, no disk writes).
  • refresh: Refreshes local plugins in place; target can be a package name or an absolute directory—omit it to refresh all.
  • update: Installs updated registry versions (modifies the profile; defaults to dryRun: true which only reports).
  • watch / unwatch: Enable/disable “auto-refresh on change.”

The most common everyday usage: watchLocal is enabled by default—just make changes, save, and the plugin refreshes itself.

4. Settings Page UI

In DSH’s “Settings → Plugins,” the Plugin Updates card allows you to:

  • Toggles: check npm registry / only check and update enabled plugins / auto-refresh local plugins on change / auto-install updates.
  • Check frequency: a number input in minutes, applied on Enter or blur, taking effect immediately without a restart.
  • Installed plugins: each plugin’s type (npm / local / tarball / git), installed version, and when a new version is available, it displays → new version.
  • Check now: Triggers an immediate re-check (uses the network).
  • Local development: Lists plugins loaded from working copies and whether the watcher is running.

The settings page configuration items (such as check frequency and toggles) are .volatile() fields—changes are written directly into the running fiber’s config and take effect without restarting the plugin.

Installation and Enabling

After installing via npm, inject cordis.patch.yml into the profile:

npm install dsh-plugin-updater
dsh profile patch cordis.patch.yml

After installation, enable the Plugin Updates card in “Settings → Plugins.”

Typical Usage

  1. Install the plugin and enable it.
  2. In the Plugin Updates card under “Settings → Plugins,” set the check frequency (e.g., 30 minutes) and toggle auto-refresh for local plugins.
  3. During local development, simply modify plugin code and save—the plugin will auto-refresh without restarting Harness.
  4. To check for updates, click “Check now” on the settings page, or run plugin_update check in the terminal.

Use Cases and Notes

  • Suitable for scenarios involving frequent npm plugin updates or local development of DSH plugins.
  • The plugin runs with the current dsh process permissions. Review the source code and license before installing.
  • This plugin only refreshes local development plugins. Plugins installed from the registry require a dsh restart to load new code after an update.
  • This plugin does not refresh itself—modifying its own source code requires a dsh restart.
  • The --expose-internals flag is required. The Desktop version of Host includes this flag by default; otherwise, hot refresh is unavailable.

Conclusion

dsh-plugin-updater keeps plugins up to date and enables hot-reloading of local code, reducing restart operations during development and improving efficiency. For more details, visit:
- Catalog page
- GitHub repository

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

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

Xiaoye