Introduction¶
DSH (DeepSeek Harness) adopts an “everything is a plugin” architecture. Plugin updates require restarting the host to take effect, which introduces significant interruption costs during development. Every time a new version is released, manually updating plugins one by one is both time-consuming and prone to omissions.
dsh-aupdate is a scheduled updater designed for DSH plugins. It checks for new npm versions of installed plugins, installs them serially, applies changes in place without restarting DSH, and provides rollback capability.
Plugin Details¶
- Name: dsh-aupdate
- Maintainer: CalmSun
- Category: Workflow
- Description: Periodically checks for new npm versions of installed plugins, installs serially, applies in place without restarting DSH, and provides rollback capability
Installation & Activation¶
Click “Install” on the DSH plugin page and enter the GitHub URL:
https://github.com/CalmSun/dsh-aupdate
After installation, restart DSH (the host needs a new generation cycle to load it). Then adjust settings in the dsh-aupdate row on the plugin page.
This plugin queues itself last in the install list to avoid replacing itself mid-update.
Core Behavior¶
Check & Install¶
- Runs a cycle on schedule per
scheduleMode; after startup, waitsfirstDelayMinutesbefore the first run (checkOnStart) - Each cycle iterates over dependencies in the profile’s
package.json, querying only/-/package/<name>/dist-tags— it does not fetch the full packument @deepseek-ai/dsh-*packages read thenexttag; all others readlatest- Packages installed via
link:/file:/workspace:/portal:are always skipped - Installation uses the profile’s own
dsh plugin add, executed serially; this plugin itself is placed last - After installation, the version on disk is re-read; a change is only counted as successful if the version actually changed
- On successful install, HMR is triggered to apply changes in place; if a subtask is running, code is not swapped in this cycle
Scheduling Modes¶
scheduleMode supports four modes with independent parameters; switching modes does not lose values:
| Mode | Parameter | Description |
|---|---|---|
minutes |
intervalMinutes |
Every N minutes (default 1440, i.e. once per day) |
hours |
everyHours |
Every N hours, range 1–168 |
days |
everyDays |
Every N days, range 1–30 |
daily |
dailyAt |
Fixed time daily, 24-hour format HH:MM |
The timer works as “schedule the next run after the current one finishes” rather than a fixed-interval trigger: a single check cycle may take several minutes, and a fixed interval would cause two executions to overlap. If set to “03:00 daily” and 03:00 is already in progress or has passed, the next run is deferred to 03:00 the following day.
Failure Suppression¶
A failed package@version is recorded, and the same version will not be retried within suppressHours (default 6 hours; 0 means no suppression). The key is “package name + version” rather than package name alone: upgrading to a new version will still trigger a fresh attempt.
Without this, a bad version would cause every cycle to attempt installation, fail, flood the logs, and hold the pnpm lock — all for a guaranteed failure.
Update Policy¶
| Setting | Default | Description |
|---|---|---|
exclude |
[] |
Packages excluded from updates; once listed, they never participate in auto-updates |
allowMajor |
true |
When disabled, only upgrade within the same major version |
allowPrerelease |
false |
When disabled, pre-release versions are not installed; the next tag is unaffected |
idleOnly |
true |
Skip installation when busy (see next section) |
hotReload |
true |
Apply in place after install; otherwise wait for restart |
maxPerCycle |
0 |
Max packages to install per cycle; 0 means unlimited |
sessionIdleMinutes |
2 |
Minutes of session silence before considered idle; 0 means only check subtasks |
notify |
true |
Show a notification in the bottom-right corner when updatable versions are found, listing plugins and versions |
historyRetentionDays |
3 |
Retention period for update history in days; 0 = permanent |
logRetentionDays |
3 |
Retention period for runtime logs in days; 0 = permanent |
When to Act¶
“Is the system busy right now?” has two independent signals; if either is hit, the cycle is skipped:
- A subtask is running: swapping code would abort it, so if detected, wait
- The session was recently written to: if there’s a write under
$DSH_HOME/sessionswithinsessionIdleMinutes, someone is actively using it
Relying solely on agent.status is insufficient — in practice, status can remain running long after a turn ends. If auto-updates relied on it, they would never execute. Hence the second signal uses the session file’s mtime: that’s a fact on disk.
Only One Installation at a Time¶
dsh-aupdate will not run two cycles concurrently, but it cannot control others: a manual dsh plugin add from another window or process, or a click in the plugin marketplace, will collide with a scheduled cycle. Since pnpm’s lock is scoped to the profile directory, a collision results in EPERM.
Therefore, during installation, a .aupdate-install.lock file (containing the PID + timestamp) is placed in the profile directory. If the lock cannot be acquired, the process yields and reports “Another process is installing.” If the lock is older than 30 minutes, the holder is presumed crashed and the lock is taken over — otherwise a single crash would permanently block updates.
Snapshot Before Acting¶
When actually installing, the profile’s package.json, pnpm-lock.yaml, pnpm-workspace.yaml, and cordis.patch.yml are first copied to ~/.dsh/aupdate-snapshots/<timestamp>/, keeping only the 3 most recent.
Automatic restoration is intentionally not performed. Reverting an old manifest and letting pnpm reinstall is equivalent to using a longer, higher-risk operation to fix a possible failure. The snapshot is kept as evidence; whether to use it is a human decision.
Update History & Rollback¶
Each successful installation records: package name, from version, to version, and timestamp. History is stored in ~/.dsh/aupdate-history.json and is visible directly in the settings page, where you can click “Rollback” on the most recent update to reinstall the old version. Rollback only targets the specific installation made by this plugin.
The history panel has a fixed height and scrolls within its own container: even hundreds of entries only extend this panel, not the entire page.
For the same package, if from → to is identical and neither is a rollback record, only the latest entry is kept: otherwise, identical failure records would accumulate one per cycle, drowning the history and making the actual rollback point harder to find.
Periodic Cleanup¶
Update history and runtime logs are retained for 3 days by default. Cleanup runs before each scheduled check and on DSH startup; the settings page also has a “Clean Now” button.
Rollback records and the update they undo must be deleted or kept together: rollback eligibility is determined by tracing back which updates a rollback has consumed. If cleanup deletes only by time and happens to remove a rollback record while leaving its corresponding update, that already-rolled-back downgrade would become rollback-eligible again. Therefore, cleanup groups by “update + its rollback” and uses the newest timestamp in the group to decide retention — the entire group is deleted or kept together.
Settings Page¶
The plugin page row offers both a summary view and a full-page view. There is no Save button: every change is written to disk immediately, and the schedule is re-arranged right after — no restart required.
Check Plugins Instead of Typing Package Names¶
exclude previously required typing one package name per line. Now the full-page view presents a checklist that lists the plugins actually installed in this profile along with their installed versions:
- Packages excluded from auto-update: checked items never participate in auto-updates
- Searchable by name
- “Select All / Clear” only affects the currently filtered rows
About aupdate¶
At the bottom of the settings page is an “About aupdate” info group: version number (read from package.json), changelog link, source repository, issue tracker, plus a “Star it” and “Share” button.
Runtime Log¶
At the very bottom of the settings page is the Runtime Log card, showing what the plugin has recently written:
- Choose to display the last 100 / 200 / 500 / 1000 lines; default is 200
- Newest first: rendered in reverse chronological order
- Timestamps show “Month-Day HH:MM:SS” and are monospace-aligned
- Body text follows the “Display Language” setting: the file stores event codes and parameters, not finished sentences
- Enabling “Auto-refresh” pulls updates every 5 seconds
- The write queue is flushed before reading
- Timestamps are displayed in the local timezone; when the file exceeds 1 MB, a rotation notice is shown
Display Language¶
At the top of the settings page is “Display Language”: System / 中文 / English. Changes take effect immediately and are persisted to disk like all other settings. The choice is stored in ~/.dsh/aupdate-settings.json (key: lang).
Update Notifications¶
When updatable versions are detected, a notification appears in the bottom-right corner of the interface, listing plugin names and “current → new” versions; beyond 8 items, the remainder shows “and N more,” and the notification auto-dismisses after 15 seconds.
The notification lists package names and “current version → new version” one by one. If a package name is too long, the name side is truncated while versions remain intact; beyond 6 items, the list scrolls within the card.
The same batch of updates only triggers one notification: the batch’s signature is stored in localStorage, so refreshing the page will not re-trigger it. Disabling “Notify me when updates are found” suppresses all notifications.
The notification card features a dot badge at the top (Updated / Available), a title row with a × close button, a one-line note saying “Installed in place, no restart needed,” a scrollable plugin list, and a right-aligned “OK” primary button.
“Updated” is only shown after installation actually completes. lastRun.updates records “which new versions were found” — it has a value even when auto-install is disabled, when the idle threshold was hit, or when installation failed. Therefore, the badge, title, and “Last Run” stats card all reference installed (entries with !failed removed) to determine “how many were actually installed.”
“Last Run” Survives Restarts¶
The most recent cycle’s results (time, packages checked, updatable count, installed count, failure reasons) are now persisted to ~/.dsh/aupdate-lastrun.json and remain visible after DSH restart. Previously it was in-memory only; a single restart would reset it to “never run.”
Performance Optimizations¶
- Dist-tags only: 24 packages reduced from 2.88 MB to 655 B
- Installed versions cached by
package.jsonmtime+size; no more 24 synchronous disk reads per cycle - Dist-tags cached with a 10-minute TTL; event loop yielded between batches so the UI doesn’t drop frames
- A full cycle of 24 packages takes 3.7 s (all cache hits, no installs needed)
- Session idle detection is limited to 4 directory levels, one
readdirper level maxPerCyclecaps single-run duration: during install the pnpm lock is held the entire time; installing 20 in one cycle could lock the profile for tens of minutes; with a cap, the remainder carries over to the next cycle- Both history and failure tables are validated by
mtime+sizeinstead of “cache forever after first read”
Technical Details¶
Tool¶
plugin_updater: a single action entry point with parameter action (check / update / state / history).
Logging & Configuration¶
- Log file:
~/.dsh/aupdate.log, flushed after every write, auto-rotates when exceeding the size limit - Settings overrides stored in:
~/.dsh/aupdate-settings.json
API¶
Read/write via /api/dsh-aupdate/{state,run,rollback,logs}. All four endpoints must first pass the host’s connection admission (connection.admit / legacy host’s requestRejection); failure returns 401/403. If the connection service is unavailable or throws an error, a 503 is returned.
Use Cases¶
- Teams developing with DSH who need to update plugins frequently
- Scenarios with multiple plugins requiring periodic updates, where reducing manual effort is desired
- Scenarios requiring a rollback mechanism to prevent update-induced issues
Notes¶
- The plugin runs with the current dsh process’s permissions; verify the source code and license before installing
- Installation holds the pnpm lock; if another process is detected installing, a message “Another process is installing” is shown
- Update history and logs are retained for 3 days by default; adjustable via the settings page
Summary¶
dsh-aupdate significantly reduces the operational cost of DSH plugin updates through scheduled checks, serial installation, and in-place hot-reloading. Combined with rollback capability, failure suppression, and automatic yielding when busy, it enables automated plugin updates while maintaining system stability.
- Directory Page: https://www.skillhub.cn/plugins/CalmSun/dsh-aupdate
- GitHub: https://github.com/CalmSun/dsh-aupdate