dsh_plugin_refresh: Ready-to-Use Activation and Hot Reload for DSH Plugins Without Restart

Preface

In DeepSeek Harness (DSH), the typical workflow for installing plugins involves modifying the profile, waiting for the plugin-manager to persist changes, and then restarting the process to confirm that it “actually started.” Officially, when using an online profile with hmr composed, installations of brand new bundles can now take effect within the process. However, reinstalling dependencies with the same name, modifying files after a first-time import failure, or changing plugin code at the same path within node_modules often still require a “restart to take effect.” If you frequently test plugin installations, develop locally via link:, or rely on Web plugin page operations, these gaps will repeatedly occur.

Below is an introduction to the community-maintained Host-side plugin dsh_plugin_refresh (Maintainer: lixiaohao001, Category: Client). It monitors installed compositions, performs activation and deep reloads within the running process, and does not write to the profile manifest or patch layer. The plugin directory page is available at SkillHub, and the source code and documentation are on GitHub (MIT, current package version 0.1.0).

What is this

dsh_plugin_refresh is a DSH Host plugin. After installation, it automatically checks selected bundles by default. It redrives “selected but not mounted” bundles through the same official path used by the Web plugin page, and performs in-place deep reloads for plugin modules where the path remains unchanged but the file content has changed. It does not execute npm install/uninstall commands, nor does it modify your profile file content.

Three Types of Gaps It Fills

The README summarizes typical behaviors without this plugin in a table. The core points are as follows:

Scenario Without this plugin
Dependency name already exists in profile (reinstall, upgrade, local re-link) installBundle may return application: "restart-required" before reloading; selection is saved but not mounted.
Plugin fails on first import Node caches the failed module job; fixing the file still results in errors for the same URL until restart.
Plugin file modified at the same path (bundle rebuild, local development) Package is under node_modules; official hot reload ignores this directory by design, so the process runs old code.

Core Capabilities

A serialized pass is triggered after a startup delay, after every plugin-manager operation, and upon watch path changes (event-driven, supplemented by fingerprint polling).

  1. Deep Reload
    For online plugins where module files have changed but the path is unchanged, it cleans up ESM loadCache (Node 24 requires Map.prototype.delete) and CJS require.cache following steps similar to @deepseek-ai/dsh-hmr, re-imports, replaces the old generation in the registry, and reactivates on the original fiber, preserving the Loader Entry and config as much as possible.

  2. Auto Repair
    For bundles that are selected but have no running fiber: it discards poisoned module jobs, imports once to capture the real exception, and then re-drives the official composition path via pluginManager.setBundleEnabled(). If the bare specifier cannot be resolved (common for link: installations outside the profile), it switches to activating via the resolved file URL.

  3. Status Reporting
    Outputs a health table for each bundle (selected, running fiber, error) and bounded pass history, writes to logs, and is queryable via HTTP. The repairs[].probe.error in repair details is often more specific than the plugin-manager’s failed to import.

Compared to other “no-restart” solutions in the community, the README explicitly states the focus of this package: automatic, no third-party dependencies (only node: built-in modules), repairing first-time import failures, and supporting local link:. It does not provide a browser UI, nor does it replace plugin-manager for package operations. Furthermore, it touches Node loader internals and is sensitive to DSH / Node versions.

Installation and Activation

Install from GitHub (README original command, no npm release needed):

dsh plugin --profile desktop add github:lixiaohao001/dsh_plugin_refresh

For local development, you can install the repository path as a bundle (edit and run, no build step):

dsh plugin --profile desktop add /absolute/path/to/dsh_plugin_refresh

In an Agent session, you can also pass the same absolute path via the install_bundle of the plugin_manager tool. The package declares dsh.bundle.patch, which will be inserted as a profile bundle row with id: plugin-refresh and name: dsh_plugin_refresh.

Environment Requirements (from package.json and README)

  • Node: ^22.19.0 || >=24.0.0
  • DSH peer: @deepseek-ai/dsh >=0.2.0-rc.2 <0.3.0-0 (README badge indicates verification on desktop profile at 0.2.0-rc.2)
  • hmr, pluginManager, webServer, etc., are optional dependencies; if missing, the plugin will load and report items that cannot be completed.

Configuration

Override config in the profile patch for the plugin-refresh row. The default values for common fields are geared towards “check upon installation, repair immediately, reload immediately”:

Field Default Meaning
autoCheck true Check after startup and after every plugin-manager operation.
autoRepair true Redrive bundles that are newly installed/enabled but have no running fiber.
deepReload true Perform deep reload for modules with changed files at the same path.
watchProfile true Watch profile patch and manifest.
devWatch [] Additional absolute paths to watch (for development).
devReload true Deep reload when devWatch changes.
pollIntervalMs 2000 Fingerprint polling interval; 0 disables it.
debounceMs 400 Merge multiple changes within a short time.
startupDelayMs 1200 Delay for the first check after the application is ready.
route /api/plugin-refresh HTTP prefix; empty string disables the interface.
verbose false Whether to log “no-op” passes.

Example of watching your own plugin directory during development:

- id: plugin-refresh
  config:
    devWatch:
      - /absolute/path/to/my-plugin/lib

Typical Usage

Daily: Wait for automatic pass after installing other plugins

Keep the default autoCheck / autoRepair / deepReload. After installing or enabling a bundle, there is no need to manually restart DSH; if anomalies persist, check the status interface (see below).

Manually trigger check or reload

HTTP binds only to loopback addresses, consistent with the DSH Web server; POST requires same-origin requests (browser) or clients without an Origin header.

Method Path Function
GET /api/plugin-refresh/status Config, latest pass, bundle health, history.
GET /api/plugin-refresh/status?detail=1 Append snapshot of each entry module.
POST /api/plugin-refresh/check Execute one pass immediately.
POST /api/plugin-refresh/repair?bundle=<name> Repair specified bundle; omit parameter to process all unhealthy bundles.
POST /api/plugin-refresh/reload?path=<absolute path> Deep reload for the plugin owning that path.

After modifying plugin source code, you can POST reload (README example port is 19387, subject to your local Web port):

Invoke-WebRequest -Uri 'http://127.0.0.1:19387/api/plugin-refresh/reload?path=<my-plugin>/lib' -Method POST

If the self-replacement or other plugin replacement succeeds in place, the generation in /status will change, making it easy to confirm if a hot reload occurred.

Reading status for troubleshooting

  • Pass-level error: The check process itself failed.
  • repairs[].probe.error: The real import reason.
  • repairs[].purgedModules > 0: Failed module jobs have been cleared.
  • repairs[].rebound: Launched via resolved file URL.
  • health[].needsRepair === true: Selected but no running fiber.

Use Cases and Cautions

Suitable for: Frequently installing/upgrading plugins within the same DSH process, using local link: for joint debugging of Host plugins, or needing to verify behavior immediately after modifying bundles at the same path within node_modules.

Must be aware:

  • The plugin runs with the permissions of the current DSH process; please read the source code and MIT license before installation, and install only from trusted sources.
  • If replacement causes the resolved package directory to change (e.g., switching to a different version directory under node_modules), a restart may still be required; deep reload only covers content changes of files at the same path.
  • After Host-side activation, browser modules still depend on dsh-client-modules / dsh-client-hmr; if the client is not updated, the page may require a manual refresh.
  • The status route has no additional authentication (loopback only) and exposes plugin names and paths; in sensitive environments, set route to "" to disable it.
  • Repairs for each bundle are limited to once approximately every 15 seconds to avoid loops with plugin-manager events.

The DSH ecosystem emphasizes “everything is a plugin”; community directories like SkillHub are independent of DeepSeek / High-Flyer and are not official app stores.

Conclusion

dsh_plugin_refresh reduces “restarting after plugin installation” to a default automatic check, repair, and deep reload process, covering edge cases like first-time import failures and link: local installations. If you are iterating on plugins in a desktop profile, you can install via the command above and check bundle health using /api/plugin-refresh/status.

  • Directory Page: https://www.skillhub.cn/plugins/lixiaohao001/dsh_plugin_refresh
  • Repository: https://github.com/lixiaohao001/dsh_plugin_refresh
羽毛球分组比赛记分
小程序二维码

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

Xiaoye