dsh-autorestart
重启不丢工作:等所有对话空闲后自动重启,重启后接着干、不中断;已有守护的机器交给守护重启,绝不双开。 还顺手治一个常见毛病:反复启动攒下的过期登录 cookie 会把请求头撑爆、让 DSH 起不来,插件在每次重启前先清掉它们。 每次重启前自动备份配置和已装插件,默认留 2 份、最多 10 份,旧的和不完整的自动清理。 这份备份不会被自动使用:插件不监视宿主、不自动还原,它只是给你留一份可以手工翻回去的存档。 所有工作完成后倒数关机,晚上无需人值守。 桌面客户端可用;dsh web 托管端已在 WSL(有 systemd)上验证;Windows 上的 web、无 systemd 的 WSL、原生
安装
dsh plugin --profile web add dsh-autorestart
沙箱测试结果
| 阶段 | 结果 |
|---|---|
| 1 安装 | ✓ |
| 2 列装 | ✓ |
| 3 挂载 | ✓ |
| 4 启动 | — |
四阶段在隔离沙箱里跑:安装(有网)→ 列装 → 挂载 → 启动(后三步断网)。
README
dsh-autorestart
Restart DeepSeek Harness without losing the work that is currently running.




Chinese version: [README.zh.md](docs/README.zh.md)
Current version: 0.9.2
What it does
Three small things, all around restarting.
1. The restart is queued. An agent asks for a restart; the plugin does not cut off the conversations that are still running. It waits until every one of them is idle, restarts the host, and picks the interrupted work back up — the sessions resume and a goal is re-armed. When several conversations ask at once the requests are merged into one restart, and every requester is woken afterwards. A goal-carrying session cannot block the restart forever: its goal is disarmed before the restart (the running round still finishes) and re-armed after it.
2. It backs up before each restart. The configuration and the local link: plugin directories are saved under ~/.dsh/storages/dsh-autorestart/backups/. At most maxBackups copies are kept (default 2, range 2–10); old and incomplete ones are pruned. A snapshot that cannot be removed (for example because a file inside it is locked) is reported in backupHygiene.error rather than silently kept, so the count can briefly exceed the limit.
3. It clears the login cookies. Every launch leaves a dsh-auth-* entry behind; they pile up until the request header overflows (~16 KB), the server answers 431, and the client can only say Web authentication failed. The plugin clears those stale credentials before each restart and records the outcome in last-cookie-clear.json.
There is also a countdown shutdown: a moon button at the bottom of the sidebar waits for every conversation to finish, counts down on screen, and powers the machine off.
What it does not do
- It does not watch the host and does not decide whether a restart came back.
- It does not restore anything on its own. The backup is never applied automatically; it is there for you to inspect or roll back by hand. The one exception is the start-at-login supervisor, if you installed it: that separate process rolls the last snapshot back when the host refuses to start.
- There is nothing left to run by hand. If the host will not start, use its own crash dialog or reinstall the plugin.
Tools for the agent
Tool · What it does
continuum_restart · Queue a graceful restart (waits for every conversation to be idle)
continuum_status · Phase, generation, queued requests, which sessions are blocking
continuum_cancel_restart · Withdraw a queued request (scope: "mine" or "all")
continuum_park_goal · Disarm a goal so a queued restart can proceed
continuum_recover_now · Retry post-restart recovery immediately
continuum_handoff · Hand an over-limit session off to a fresh one
continuum_supervisor · Inspect or install the self-starting supervisor
Configuration
The settings page writes these; the defaults are the ones in the code.
Key · Default · Meaning
restartMode · app · app = ask the desktop client to relaunch itself; command = run your own restart command
restartCommand · '' · The command used when restartMode is command; supports the {pid}, {ppid} and {app} placeholders
settleMs · 2000 · How long the host must stay quiet before the restart may start
restartGraceMs · 0 · Extra wait after the last conversation went idle, before the host is really restarted — a dropdown: 0 / 5 / 10 / 20 / 30 / 60 seconds. 0 = no extra wait
queuedGraceMs · 60000 · How long a queued inbox message may sit before it stops blocking the restart. A running conversation always blocks
forceRestartWhenBusy · false · Interrupt a running conversation instead of waiting. The default never interrupts a session
deferPollMs · 3000 · Poll interval while waiting for the conversations to go idle
relaunchDelaySeconds · 2 · How long the detached helper waits before it kills the app
backupOnRestart · true · Take a snapshot before every restart
backupIncludePlugins · true · Include the locally linked plugins in that snapshot (~117 MB here, ~3 s). false keeps only the configuration files
maxBackups · 2 · How many snapshots to keep (2–10)
restartCommandTimeoutMs · 30000 · How long the restart command may run before the plugin stops waiting for it
showSleepButton · true · Show the countdown-shutdown button
sleepCountdownSeconds · 20 · Countdown length before powering off — a dropdown: 0 / 10 / 20 / 30 / 60 seconds
sleepCommand · '' · Override the power-off command
resumeOnBoot · true · Resume interrupted sessions after a restart
recoveryDelayMs · 6000 · Wait before the first resume attempt
maxResumeAttempts · 2 · Resume attempts per session, counted across boots
maxSessions · 4 · How many sessions are resumed per boot
continuationText · '' · Override the continuation prompt text
stateFile · '' · Path of the checkpoint file. Empty = <DSH_HOME>/storages/dsh-autorestart/state.json
autoReloadPage · true · Reload the web page after a restart
blockManualRestart · true · Refuse an agent that tries to kill or relaunch DSH by hand, and point it at continuum_restart instead
healthPath · /__dsh_autorestart/health · Health check route: the boot id, the pid, the phase and the self-check flags
enabled · `tr
…(truncated)
以上内容来自 npm 上的 README,我们只做格式化,不改内容。
版本
npm 上共发布:25,最后更新 2026-11-05