liuyun847/dsh-host-restart ↗★ 0

dsh-host-restart

为模型提供重启宿主并恢复原会话的工具 适合需要让模型自主重启DSH宿主并无缝继续对话的自动化任务。

套件
dsh-host-restart
相容性
待驗證
Harness 依賴範圍
^0.1.5-rc.1
Cordis 依賴範圍
^4.0.1
版本
0.1.0
最近更新
2026年9月26日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:liuyun847/dsh-host-restart

2. 文件与配置

位置作用
~/.dsh/profiles/web/plugins/dsh-host-restart/lib/index.js插件本体:注册工具 + 启动时消费标记并注入
~/.dsh/profiles/web/plugins/dsh-host-restart/cordis.patch.yml本包自己的注册行 id: restart-dsh(包层 patch:本包是组合包,由 profile 的 dsh.profile.bundles 加载;改它不需要重启,但不会自己触发重组合,见 §7 末段)
C:\run\tools\dsh-restart.ps1驱动脚本:解析本实例身份 → 只杀本实例 dsh → 探看门狗(在就换手+触发,不在就自行拉起)→ 等就绪(退出码 4 = 身份确定不了,一个都不杀)
C:\run\tools\dsh-restart.log插件与脚本共用的流程日志(超过 1MB 截断保留尾部)
~/.dsh/storages/dsh-restart/pending.json重启标记;成功注入即删,陈旧/失败改名归档为 pending.-.json
C:\run\tools\dsh-selflaunch-out.log / dsh-selflaunch-err.log脚本自行拉起 dsh 时的 stdout/stderr(每轮覆盖写,不是追加)。默认与 -LogFile 同目录,可用 -SelfLaunchLogDir 覆盖
C:\run\tools\dsh-last-url.txt最近一次自起 dsh 的带 token 完整 URL(覆盖写、只保留最近一次)。用途:清 cookie / 换浏览器时取一次;重启日志里只记"已取得带 token 的 URL",不留 token 明文
C:\Users\MLTZ\Desktop\kill_dsh.bat桌面人工用的"杀 web 实例"脚本(判据是命令行含 dsh\lib\bin.js 且含 web,跨实例)。驱动脚本不再调用它,只按本实例身份杀进程
C:\run\tools\dsh-restart.lock驱动脚本的锁文件(单实例保护)。退出后故意不删:判据是"里面记的 pid 是否还活着",所以残留无害、也不会阻塞下次重启

⚠ 源码在 plugins\ 下,但真正被加载的是 node_modules\ 里的那份拷贝(含包内 cordis.patch.yml)。 pnpm 对 file: 本地依赖做的是实体拷贝而非 junction(node_modules\dsh-host-restart 是独立目录), 而且源目录内容变了它仍可能报 Already up to date 直接跳过同步 —— 必须 dshpm remove 再 add。 完整流程见 §7,已因此踩过一次坑(§8 第 3 条)。

启停:Web 侧栏「插件」页 →「已安装」区里本卡的总开关(写 dsh.profile.bundles); 点开卡片后每一行还有行级开关(向 profile 的 cordis.patch.yml 写 disabled 覆盖 —— profile 层在包层之后应用,所以覆写优先)。

插件配置(包内 cordis.patch.yml 的 config 段,全部可选;profile 层可按 id 覆写): waitSeconds(默认 6) / bootDelayMs(4000) / staleMs(600000) / controllerWaitMs(30000) / restartScript / logFile / pendingDir / psExe / wmiExec(仅测试注入的启动原语,见 §6)。 非法值会 fail loud(抛错、不注册工具)。

工具参数:note(追加到注入文案末尾)、wait_seconds(2–60,默认 6,越大越不容易截断本轮输出)。