dsh-safe-restart
DiscoveredGraceful restart for DeepSeek Harness: asks the main window to close, waits for every Electron process to exit, then relaunches, so sessions flush and plugin bundles compose instead of being killed mi
dsh-safe-restart
优雅重启 DeepSeek Harness —— 别再任务管理器里强杀了。
宿主退出时要做完三件事:把内存里的会话写回磁盘、写完插件 bundle 组合、释放 pnpm/文件锁。强杀(结束进程)会把这些做到一半,留下的典型后遗症:
- 会话记录半截 → 下一次请求直接报
messages[N]: missing field role - 插件更新中断 → 市场里留下
incomplete-build-cancelled - 环境/锁残留 → git、验收命令莫名其妙失败
这个插件把「优雅重启」做成一个工具调用。
装
dsh plugin --profile web add dsh-safe-restart
仅 Windows(依赖 Win32 API 发关闭消息)。
用
safe_restart {}
流程:
- 先回一句话(不然你看到的是"连接被断开")
- 3 秒后,由一个独立进程给主窗口发
WM_CLOSE(等价于点右上角关闭) - 轮询等所有 Electron 进程真正退出(默认 30 秒)
- 等 2 秒释放端口,再重新拉起
只想看看现状、不动手:
safe_restart { "dryRun": true }
超时也退不掉、又确实要强杀(最后手段):
safe_restart { "force": true }
为什么活儿要交给独立进程
重启会把宿主进程杀掉 —— 而插件就跑在里面。所以插件只负责"派活":把自己要等的东西(PID、exe 路径)交给 lib/helper.mjs,让它 detached 地在外面等、在外面拉起。
配置
| 键 | 默认 | 说明 |
|---|---|---|
exePath | 空(自动探测) | DSH 可执行文件路径 |
timeoutSec | 30 | 等退出的秒数 |
logPath | 系统临时目录 | helper 的日志 |
安全设计
- 找不到主窗口时不会硬杀,只提示你从托盘退出
force必须显式传,且会先说明"这一步才可能弄坏数据"- helper 缺参数直接
exit 2,不会瞎发关闭消息
已知限制
- 只支持 Windows
- 重启后端口可能变化是 DSH 自身行为,与本插件无关
- 如果 DSH 以管理员权限运行、而插件进程不是,
WM_CLOSE可能发不进去
License
MIT
Comments
Loading…
Similar plugins
by Eason-22
DeepSeek Harness plugin: restart without losing work, with an idle-aware graceful restart and automatic session resume after the host comes back. Built-in restart supports the Windows desktop app only
★ 2
MIT
JavaScript
Nov 7, 2026
dsh plugin --profile web add dsh-autorestartby PPsz-qqq
DeepSeek Harness plugin: one-click restart button in the top-right of the session header (Windows desktop + dsh web). 一键重启 DeepSeek Harness 客户端。
★ 5
↓ 104/wk
MIT
JavaScript
Oct 3, 2026
dsh plugin --profile web add dsh-restart-buttonby StvLi
Never-interrupt, resumable lifecycle for DeepSeek Harness (dsh): graceful restart + client auto-reconnect + cross-restart goal continuation.
★ 5
↓ 72/wk
MIT
JavaScript
Sep 2, 2026
dsh plugin --profile web add dsh-phoenixby StarMoon-win
Sidebar restart button for DeepSeek Harness Desktop: one click fully quits and reopens the app.
★ 0
MIT
JavaScript
Oct 20, 2026
dsh plugin --profile web add dsh-restartby w17her
Reload, restart, or shut down the DeepSeek Harness desktop app from inside its window.
★ 0
MIT
JavaScript
Oct 27, 2026
dsh plugin --profile web add @local/dsh-power-controlby IHS470
DeepSeek Harness restart button in the DSH desktop window title bar
★ 3
↓ 167/wk
MIT
JavaScript
Oct 3, 2026
dsh plugin --profile web add dsh-plugin-restart