dsh-webdav-sync: Back Up DSH Sessions and Environments to WebDAV

Introduction

When developing agents in DeepSeek Harness (DSH), session logs and the plugin environment within profiles often remain localized to the machine: compressed logs under $DSH_HOME/sessions, along with package.json, lock files, and Cordis patches for each profile. These are difficult to fully recover after switching machines or reinstalling. Manually copying directories is prone to missing files and fails to determine “which version is the latest” across multiple devices.

The community plugin dsh-webdav-sync (Maintainer: alfredhuang211, Category: Memory) syncs these two types of data to any WebDAV service, supports incremental backup and restoration, and handles conflicts using generation / rev and three-way comparison. The reference implementation in the repository is v0.2.2, which has been verified for dual-source sync and forced recovery on the web profile of dsh 0.2.0-rc.1. It has zero additional runtime dependencies (utilizing Node’s built-in zstd and fetch) and provides both host-side logic and a settings page client.

What is this?

dsh-webdav-sync is a DSH plugin that backs up session logs and plugin environments to WebDAV and can restore them from remote storage. It does not register slash commands, so a webdav-sync entry will not appear in the + / / menu of the session window. Daily configuration is done via Settings → WebDAV Sync; outside the UI, it can be accessed via same-origin HTTP routes registered by the plugin or via curl calls.

Sync Scope

The following three categories are the sources explicitly handled by the plugin; node_modules are considered re-installable artifacts and are never synced.

Source Content Description
Sessions $DSH_HOME/sessions/**/*.jsonl.zstd Byte-level sync; upon restoration, the destination directory is recalculated based on the cwd in the log header.
Plugin Environment Profile’s package.json, cordis.patch.yml, pnpm-lock.yaml, pnpm-workspace.yaml, $DSH_HOME/cordis.patch.yml (optional), plugin market state (optional) The “essence” files of the environment, excluding node_modules.
Plugin Inventory Auto-generated environment/inventory.json Name, version, and enabled status of each plugin; versions are read from node_modules by the plugin (the host inventory API does not contain version numbers).

Versioning and Conflicts

The remote manifest.json uses a v2 structure: the entire backup has a generation (increments only when changes occur), and each entry has a sha1, rev (increments only when content changes), updatedAt, and the last writing device information.

The decision rules (lib/versioning.js) are summarized as follows:

  1. sha1 is identical → Consistent, no action taken.
  2. If the local machine possesses base (the common ancestor from the last sync) and only one end has changed relative to the base → Advance that end, not counted as a conflict.
  3. Both ends have changed relative to the base → Conflict, handled according to conflictPolicy:
    - prefer-newer (Default): Compare rev first, then updatedAt, and finally converge using the lexicographical order of device, ensuring consistent conclusions on both ends;
    - Other options: keep-local / keep-remote / keep-both / manual.
  4. The losing side is defaulted to be saved as a .conflict-<device>-r<version> copy, never silently discarded.

Security and Recovery Boundaries

The plugin’s README specifies several strict boundaries which users are advised to read before use:

  • Neither push nor pull deletes local sessions.
  • Overwriting local files is conditional on “the local file has not been modified relative to the base”; files modified locally require an explicit pullOverwrite, or must be overwritten via “Cloud Priority” (POST /pull?force=1).
  • Before overwriting environment files, a .bak-<timestamp> is written; running sessions are excluded from overwriting.
  • The sync process strips the plugin’s own configuration lines from both sides to prevent changing the WebDAV target back to an old machine after cross-machine restoration; the local line is preserved during restoration (new addresses entered after switching machines will not be overwritten by old values from the cloud).
  • node_modules are never touched.

After restoring package.json / pnpm-lock.yaml, dependencies need to be reinstalled: click “Install Dependencies” on the settings page (equivalent to POST /webdav-sync/install), or execute the following in the local profile directory:

cd $DSH_HOME/profiles/<profile> && pnpm install

Installation and Activation

CLI / web or Custom Profiles (Commands from the repository README):

# After publishing to npm
dsh plugin --profile web add dsh-webdav-sync

# Install from GitHub source (pnpm git protocol, builds/links based on local source)
dsh plugin --profile web add github:alfredhuang211/dsh-webdav-sync

Desktop: The desktop profile is hosted by Electron, and the CLI will reject the above operations; installation must be done via the App’s internal plugin market. The package.json declares engines.dsh as >=0.2.0-rc.1 <0.3.0, Node >=22, and peer dependencies including @deepseek-ai/cordis, @deepseek-ai/dsh, and @deepseek-ai/dsh-settings of the same version range.

The community plugin directory site SkillHub has no official affiliation with DeepSeek or High-Flyer. Please inspect the source code and MIT license yourself before installation. The plugin accesses local files and WebDAV with the current dsh process privileges; Credentials should only be provided to trusted endpoints.

Typical Usage

Settings Page

Open Settings → WebDAV Sync and configure connection, sync content, and versioning/conflict policies via the three sets of forms. The status panel displays the local device name, cloud generation, file count, pending upload/recovery/conflict counts, etc. Common buttons include: Save, Status/Version, Test Connection, Dry Run, Backup Now, Restore from Cloud, Cloud Priority, Install Dependencies.

This plugin does not register slash commands; for scripts or automation, use the same-origin HTTP routes described in the README (the request initial line passes through the ctx.connection.requestRejection trust barrier).

Development and Self-Testing

Testing methods within the repository:

pnpm install   # Only for @deepseek-ai/schemastery
node --test test/*.test.mjs

The README documents 43 test cases, covering version ordering and three-way comparison, WebDAV paths and directory creation, conflict policies, dual-source end-to-end, force recovery, running session skipping, and authentication failure.

Use Cases and Notes

Suitable for developers who need to align DSH sessions and profile environments across multiple machines or environments and are willing to store backups on self-hosted or third-party WebDAV services (such as NAS or cloud drive WebDAV gateways). If you only need a one-time export of sessions without involving environment management and conflict merging, manual copying or other tools may still be selected based on needs; the value of this plugin lies in its dual-source support, inventory versioning, and recoverable conflict policies.

Note: WebDAV account and URL are written into plugin configuration and used by the sync logic; please ensure server-side TLS and access control. Desktop and CLI installation paths differ; do not force CLI dsh plugin add on the desktop profile.

Conclusion

dsh-webdav-sync pushes compressed session logs and essential plugin environment files to WebDAV, uses manifest v2 and three-way comparison to converge versions across multiple devices, and provides a complete path for backup, dry runs, recovery, and dependency installation on the settings page. For further information, please refer to the SkillHub directory page and the GitHub repository README.

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

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

Xiaoye