Introduction

During runtime, DSH Web processes may crash or be interrupted unexpectedly, resulting in session interruptions and service unavailability. Manually recovering services and checking health status is cumbersome and error-prone. This plugin addresses these issues by providing centralized settings storage, a Web Supervisor, and recovery mechanisms.

What Is This

It is the core of DSH Web, containing a monitoring daemon, settings storage, approval guard, and cross-machine synchronization engine. It combines four independent features into a single package. The plugin implements self-recovery and state persistence by running as a host+client inside dsh web and as a system daemon externally.

Core Features

  • DSH Web Supervisor (monitoring daemon): System-level monitoring (systemd), polls service status every 3 seconds, saves last known good (LKG) snapshots, detects crashes and performs automatic rollback, and generates health reports including Git Diff and logs.
  • Automatic Recovery: After DSH Web has been running for 8 seconds, automatically finds and resumes sessions that were interrupted within autoResumeWithin (default 5 minutes).
  • Automatic Reload: Browser-side client plugin that automatically reloads the page when the Web service restarts or the network disconnects.
  • Settings Storage: Provides a global settings.json store and Maestro settings cards for read/write access by other modules.
  • Approval Guard: Provides rule classification and approval entry points; check status via maestro_guard_status.
  • Cross-machine Synchronization: Provides backup, restore, retention policy GC, and two-machine synchronization features.

Installation and Enablement

Use the official command to install the plugin:

dsh plugin --profile web add @ddtcorex/dsh-maestro-core

If you need to specify a version, you can use:

dsh plugin --profile web add @ddtcorex/dsh-maestro-core@<version>

After installation, restart dsh web. This package includes cordis.patch.yml; do not manually copy it or add duplicate Row IDs.

Typical Usage

Manage it via command-line tools or the Systemd daemon:

# 启动守护进程(前台调试)
node packages/dsh-maestro-core/lib/index.js daemon

# 查看状态
node packages/dsh-maestro-core/lib/index.js status

# 恢复指定时间范围内的中断会话
node packages/dsh-maestro-core/lib/index.js resume --within 5m

Enable the Systemd daemon for system-level monitoring:

bash packages/dsh-maestro-core/scripts/install-systemd.sh
systemctl --user daemon-reload
systemctl --user enable --now dsh-web-supervisor
systemctl --user status dsh-web-supervisor

Applicable Scenarios and Notes

  • Environment requirements: Requires Node.js ^22.19.0 || >=24.0.0 and pnpm 11+, with DSH version 0.1.x or 0.2.x.
  • Build requirements: The lib/ directory is ignored by Git; after modifying source code, run pnpm build. Client build requires build-client.mjs.
  • Permission risks: The plugin runs with the current DSH process permissions; if the DSH process has elevated permissions, the plugin has the corresponding permissions as well. It is recommended to review the source code and license before installation.
  • Configuration: Telegram Bot Token is optional and used for notifications.

Conclusion

By integrating monitoring, storage, and synchronization capabilities into a single package, dsh-maestro-core reduces the maintenance complexity of DSH Web and improves system robustness.