In DSH’s development ecosystem, plugins are core components, and their runtime stability directly affects development efficiency. When a plugin experiences exceptions or state inconsistency, manual rollbacks often carry the risk of omissions. dsh-guard is a companion watchdog plugin designed for this purpose. It provides rolling snapshots, automatic rollback on failure, and a local admin panel through automated mechanisms, mitigating runtime uncertainty.

This is a workflow plugin maintained by x2802490130-prog, released under the MIT License. It is part of the DeepSeek Harness ecosystem and aims to provide developers with a standardized plugin guarding solution.

Core Capabilities

This plugin mainly provides the following six capabilities:

  1. Rolling snapshots: Each archive operation retains the most recent N copies (default 5), with filenames including a timestamp and a reason. It also mirrors last-good for use by external launchers or scripts.
  2. Auto-save: After a plugin starts successfully and passes the grace period, an auto-save is triggered automatically (reason marked as auto).
  3. Automatic rollback: When a plugin runtime failure is detected, it rolls back automatically to the last-good state.
  4. Admin panel: Provides a web interface to view status, and manage snapshots and logs.
  5. Admin API: Provides RESTful endpoints for control.
  6. Event log: Records all snapshot and rollback operations, located in snapshotRoot/guard.log.

Configuration and Usage

The plugin is configured via YAML profile patch layers. The following is an example of key configuration items:

- id: dsh-guard
  config:
    snapshotRoot: D:\path\to\snapshots
    profileDir: C:\path\to\profiles\web
    sourceDirs: [D:\path\to\plugin-src]
    restartCommand: D:\path\to\restart.bat
    graceMs: 120000
    autoSaveDelayMs: 150000
    keepSnapshots: 5

Typical behavior:
- Rolling snapshots: By default, the last 5 snapshots are retained.
- Grace period: After a plugin starts, it must wait graceMs (default 120000ms) before auto-save is triggered, preventing accidental saves.
- Automatic rollback: It is triggered only when a plugin fails during runtime, and at most once per startup, preventing infinite loops.

Access methods:
- Admin panel: http://127.0.0.1:/dsh-guard
- Admin API: /api/dsh-guard/{status,snapshots,backups,log,save,rollback,restore}

Notes

  • Boot failures cannot be rescued: When the process crashes during the startup phase, the plugin cannot run and therefore cannot handle this scenario. Boot rescue is handled by an external launcher (for example, windows/launch-dsh.vbs in the dsh-balance-float repository).
  • Local access only: The admin panel and API listen only on the local loopback address and do not provide remote access.
  • Infinite loop prevention: Automatic rollback is triggered at most once per plugin start; after a rollback, a manual restart is required to trigger it again.

Summary

dsh-guard provides basic runtime guarding capabilities for DSH development, reducing maintenance costs during development through automated snapshot and rollback mechanisms.