Skip to main content

dsh-plugin-guard

28Stars2Forks2Issues0Watchers

DeepSeek Harness installation safety net: automatic snapshot before installation, automatic rollback on startup failure, incompatible plugins automatically isolated with incident reports generated, triggering Agent analysis.

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
JavaScript
License
MIT
Branch
main
deepseek-harnessdsh-plugin

Install

cmdweb profile
$ dsh plugin --profile web add github:lxzy-7/dsh-plugin-guard

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin lxzy-7/dsh-plugin-guard for me: review the repository at https://github.com/lxzy-7/dsh-plugin-guard first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Pitch

A "plugin installation safety net" for DeepSeek Harness (DSH): automatically creates snapshots before installation, isolates bad plugins, and generates incident reports for AI to take over analysis. It doesn't judge whether plugins are good or bad—it only ensures "any change is reversible + failed startup auto-rollback + incidents aren't silently swallowed."

Core Capabilities

  • Pre-installation auto-snapshot: Before any DSH internal tool runs to install/uninstall/toggle plugins, it automatically creates a configuration snapshot for all profiles (doesn't block the call)
  • One-click or automatic rollback: Restores a profile's 4 configuration files to any snapshot and runs pnpm install --frozen-lockfile to restore node_modules
  • Startup guard: The boot-guard script creates a snapshot before starting dsh web, performs HTTP health checks after startup; on failure, automatically kills the process, rolls back, and retries once
  • Black screen/client crash detection: Starting from v0.3.1+, it confirms the web client truly renders successfully, distinguishing between "HTTP 200 but black screen with errors" and truly usable
  • Auto-isolate incompatible plugins: Starting from v0.3.2+, when both rollback and retry fail, it diagnoses the problematic plugin from startup logs and writes disabled: true to let the application at least start
  • Incident report automatically triggers Agent analysis: Any startup failure writes an "incident diagnosis report" and forces the AI to read it first in the next session's prompts

Technical Implementation

  • Language: JavaScript (ESM, Node 18+) + PowerShell (Windows guard script) + bash (macOS/Linux guard script)
  • Key dependencies: js-yaml (parsing cordis.patch.yml) + @deepseek-ai/schemastery (declaring settings.namespace schema) + Node built-in modules node:fs/node:http/node:child_process; client-side injects React components via ModuleLoader.load
  • Architecture pattern: Standard Cordis bundle plugin + out-of-process scripts (CLI + guard). Node side injects via tools.guard hook + systemPrompt.section, registers HTTP API via webServer.register, registers plugin's own settings card via settings.register('guard', schema); client-side lib/client.js registers three slots via slots.inject: settings.section / shell.overlay / settings.plugin.item
  • Entry files: src/index.js (Node side export apply) + lib/client.js (browser side export inject) + scripts/guard-cli.js (standalone CLI dsh-guard) + scripts/boot-guard.{sh,ps1} (guard startup script)

Use Cases

Users who tinker with plugins daily, frequently install/uninstall new features, and whose DSH's built-in dsh plugin add often results in "app crashes after installation." After installing this, even if you encounter a bad plugin, the next startup will automatically restore to a normal state—you no longer need to pay the "app won't start" cost for plugin experimentation. The incident report also lets the AI Agent automatically take over diagnosis, saving the effort of manually searching through logs.

Prerequisites & Compatibility

DependencyMinimum VersionDescription
Node.js>= 18package.json engines.node field; uses node: protocol built-in modules
DSHrc.7+ (recommended)Settings panel "Plugins → Plugin Config" card depends on settings.namespace introduced in rc.7; earlier versions fall back to working only via config.json path, backup management HTTP API still available
pnpmAny installed versionGuard script and rollback flow call pnpm install --frozen-lockfile; can manually specify pnpm path via DSH_GUARD_PNPM environment variable, otherwise auto-detect from PATH
PlatformWindows / macOS / LinuxCross-platform; Windows uses boot-guard.ps1 + rollback.cmd, other systems use boot-guard.sh + dsh-guard CLI
Native modulesNoneAll use Node built-in modules and js-yaml pure JS dependency, no native binding

Installation

dsh plugin --profile web add github:lxzy-7/dsh-plugin-guard

After installing to the web profile, restart dsh web to activate the bundle plugin, and it's recommended to use the boot-guard script to start for startup-level rollback protection.

Configuration Options

ConfigTypeDescriptionDefault Value
keepSnapshotsIntegerHow many historical snapshots to keep per profile; excess old snapshots are auto-cleaned10 (minimum 2, maximum 100)
portIntegerWeb port for health checks and incident reports (can be the same as dsh web's actual port)3080
DSH_HOME environment variablePathRoot directory for all guard state files; for multi-user/multi-instance isolation~/.dsh
DSH_GUARD_PNPM environment variableCommand pathForce override pnpm launcher lookup pathAuto-detect from PATH

All configuration items are in $DSH_HOME/guard/config.json, auto-created on first write. Regular users don't need to manually edit.

FAQ

Q: Does it need extra configuration after installation?

A: No. All configuration items have reasonable default values, and the config file is auto-generated on first write. It's recommended to check in DSH Settings → Backup Management page whether the snapshot retention count suits your needs.

Q: Plugin installation failed or got isolated, how to recover?

A: Isolation means the plugin is incompatible with the current DSH version, and rollback can't solve it. Two recovery options: ① upgrade the plugin to a compatible version; ② confirm you don't need it (keep disabled). To un-isolate, run dsh-guard quarantine --undo <plugin-id>, which removes the disabled: true line from cordis.patch.yml.

Q: Will data be lost due to rollback?

A: Only rolls back 5 configuration files + restores dependencies via pnpm install --frozen-lockfile, does NOT touch session logs, credentials, or user data under ~/.dsh. A pre-rollback snapshot is automatically saved before rollback, so rollback itself can also be undone with one click.

Q: How to uninstall?

A: Delete the guard line from cordis.patch.yml and restart dsh web. To completely clean up data, delete the $DSH_HOME/guard/ and $DSH_HOME/rollbacks/ directories.

Q: I changed dsh web's port (not default 3080), what to do?

A: Edit $DSH_HOME/guard/config.json to change the port field to the actual port; or temporarily override with dsh-guard health --port <N> / dsh-guard incident --port <N>.

Q: Why do bundle plugin modifications require restarting dsh web?

A: Because DSH loads bundle plugins into the profile layer stack once at web process startup. Runtime changes to cordis.patch.yml don't affect already-loaded instances—this is a DSH loading mechanism limitation.

Q: Does it execute third-party code within the DSH process?

A: Snapshots are pure file copies (5 config files + manifest), don't run any code, don't evaluate any behavior. Startup-level detection is done by the boot-guard script starting dsh web (DSH loads all installed plugins together), which is necessary for detecting "did the plugin break startup." During runtime, plugins never execute extra code, never modify configs.

Getting Started

Beginner — Regular users can enjoy "pre-installation auto-snapshot + failed startup auto-rollback" core protection with zero configuration after installation; advanced usage (CLI, quarantine, custom boot-guard launcher) is optional and can be learned when incidents occur.

Known Issues & Limitations

  • Auto-incident analysis only covers startup failure incidents; mid-conversation errors require actively calling dsh_rollback action=incident (or dsh-guard incident) to manually generate a report
  • Bundle plugin loading changes require restarting dsh web to take effect (DSH's own mechanism, not this plugin's limitation)
  • Corrupted session logs are data issues and not within rollback scope—rollback only covers 5 configuration files and node_modules
  • Health checks only look at HTTP / (200-499 = healthy), don't check specific business interfaces; client rendering crashes are only detected from v0.3.1+ (requires dsh-client-runtime cooperation to report heartbeats)
  • Auto-isolation (quarantine) only works for disableable plugins in cordis.patch.yml; regular npm dependency plugins cannot be auto-isolated
  • Version updates to DSH root directory (node_modules/.pnpm) cannot be undone via profile rollback; incident reports detect and clearly mark this situation

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/lxzy-7/dsh-plugin-guard)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory