dsh-version-guard: Escaping the DSH Process to Fall Back to the Profile After Plugin Conflicts

Introduction

DeepSeek Harness (DSH) plugins are installed in the profile directory, and the dsh.profile.bundles field in package.json determines which ones are loaded at startup. After installing a problematic plugin, the common result is a crash during startup—the window won’t open, or it flashes and exits. Since this plugin was installed within DSH, and the interface itself is broken, there is no way to uninstall it from within DSH, creating a deadlock.

While the community already has plugin management and marketplace installation capabilities, these all assume DSH can still start normally. The following introduces the dsh-version-guard by maintainer skyjjgw: it automatically records rollback points while DSH is healthy, and after DSH crashes, uses a separate process to open a recovery page to revert the profile configuration to the last successfully started version. The repository is categorized under admin-security, currently at version 0.1.1, and is MIT licensed.

What is this

dsh-version-guard records plugin versions and configuration snapshots; after a plugin conflict causes a DSH crash, it can roll back to the previous working state in a process that does not load any DSH code (Out-of-process rollback).

The most critical design point is this: the recovery capability is not placed inside the object being recovered. The offline recovery page does not import any @deepseek-ai/* code, relying only on Node and the profile directory, so it works even when a plugin has broken DSH.

Core Features

Automatic Rollback Points

When DSH is still healthy, a rollback point is automatically recorded after every successful startup. This includes:

  • The plugin manifest and the version of each plugin;
  • A snapshot of the configuration file that determines which plugins to load.

The determination of a “successful startup” is not simply “the port is listening,” but rather marks the boot record as successful and creates a rollback point only after the HTTP service sends a request to itself and receives a response.

Offline Recovery

When DSH cannot start, launch the recovery service via dsh-version-guard.cmd or node lib/bin/version-guard.js to operate via a browser. The recovery page allows you to:

  • View current plugin versions (required version / actual installed version / lockfile locked version, enabled status, and reasons);
  • Manage version rollback points (compare, rollback, delete; retains the last 30 by default);
  • One-click rescue or dry-run (dry-run only calculates which version would be reverted to without modifying files);
  • Disable / re-enable / lock versions for individual plugins;
  • Explicitly click to execute “Sync Dependencies” (pnpm install --ignore-scripts).

Rollback Coverage

Rollback points cover the files that define what the profile is:

File Description
package.json Dependency versions + dsh.profile.bundles
cordis.patch.yml User patch layer (plugin enable/disable and config overrides)
pnpm-lock.yaml Actually resolved versions

It does not copy node_modules; it does not touch sessions, keys, or other settings; it does not snapshot or write back .dsh-market/state.json. Plugin enable/disable is based on cordis.patch.yml, sharing the same state as the official plugin manager.

Composition Overview

Component Location Function
Host Plugin lib/host/index.js Writes boot records, creates rollback points after successful startup, mounts recovery page HTTP API
Settings Page lib/client/client.js “Version Guard” page in DSH settings
Offline Recovery lib/recovery/ + lib/bin/version-guard.js Recovery service detached from the DSH process
Shared Core lib/core/ Snapshotting, restoration, version identification, plugin enable/disable, pnpm invocation

Data is written to .dsh-version-guard/ under the profile directory (containing boot.json, guard.lock, snapshots/).

Installation and Enablement

When DSH is available, use the official plugin command to install it to the profile you actually use (using web as an example below):

dsh plugin --profile web add github:skyjjgw/dsh-version-guard

Restart DSH after installation. The repository already includes a runnable lib/ directory, requiring no additional build, and is not published to npm. Please save a copy of this repository before a failure occurs, so you can directly run dsh-version-guard.cmd or node lib/bin/version-guard.js; the offline entry does not depend on DSH starting successfully.

Alternatively, you can place the entire directory in the DSH plugin directory, use a link: dependency in the profile’s package.json, add dsh-version-guard to dsh.profile.bundles, and run pnpm install --ignore-scripts in the profile directory. Place dsh-version-guard.cmd in a convenient location (e.g., Desktop); it will look for the Node runtime bundled with DSH and does not require the user to install Node separately.

The runtime environment requires Node >=22.19.0 (see engines in package.json).

Typical Usage

Double-click dsh-version-guard.cmd and click “One-click Rescue” on the browser offline recovery page. It will find the rollback point from the last successful startup, first record the current state as a new rollback point, then write back package.json, cordis.patch.yml, pnpm-lock.yaml, etc. If plugin versions have changed, it will prompt you to click “Sync Dependencies Now” to run pnpm install. Then close the page and restart DSH.

Command Line

dsh-version-guard.cmd --rescue --dry-run    :: Dry run, do not change anything
dsh-version-guard.cmd --rescue              :: Direct rollback
dsh-version-guard.cmd --status              :: View plugin versions and boot health status
dsh-version-guard.cmd --list                :: List all profiles
dsh-version-guard.cmd --install             :: Sync dependencies (equivalent to "Sync Dependencies Now" on the recovery page)

When You Don’t Want a Full Rollback

In the “Current Plugin Versions” section of the recovery page, click “Disable” for the suspicious plugin. Disabling writes disabled: true to the corresponding entry in cordis.patch.yml; it does not delete dependencies, change bundles, or delete files, and can be “Re-enabled” at any time.

When DSH is Still Available

A “Version Guard” page will appear in the settings, embedding the same recovery capabilities; the host provides write operations via the /dsh-version-guard/* route with a request token generated by the current process.

Applicable Scenarios and Notes

Who it is for: DSH users who frequently try installing community plugins, worry that a single conflict might prevent DSH from opening completely, and need reversible rollbacks at the profile layer.

Things you must know:

  • The plugin runs within the DSH process with the current user’s privileges; before installation, you should read the GitHub Source and the MIT license to judge whether you trust the maintainer skyjjgw.
  • It does not roll back the DSH application body version, only plugins and profile configuration.
  • Dependency synchronization requires network access; if the versions in the rollback point are no longer available locally, you must be online to reinstall them.
  • Two consecutive incomplete startups will be judged as a crash loop, and the console will print rescue instructions.
  • Even if the “Version Guard” page is not present in settings (host not loaded), the offline recovery page remains usable.

The community plugin directory SkillHub and DeepSeek / High-Flyer have no official affiliation; the DSH ecosystem is “everything is a plugin,” and this tool is a community-maintained security/operations supplement.

Links

  • Directory Page: https://www.skillhub.cn/plugins/skyjjgw/dsh-version-guard
  • Repository: https://github.com/skyjjgw/dsh-version-guard

By following the steps above, installing the version guard while DSH is healthy and keeping dsh-version-guard.cmd, you effectively leave a safety net for the profile that allows reverting plugin combination changes without relying on the DSH interface.

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

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

Xiaoye