liuyun847/dsh-host-restart ↗★ 0
dsh-host-restart
DSH 宿主插件:给模型一个 restart_dsh 工具 —— 写重启标记并用 WMI 启动脱离 dsh 进程树的驱动脚本,杀掉当前 dsh 后由常驻看门狗拉起新进程,新进程再用 sessionController 恢复原会话并注入「已重启」继续对话 适合需要让模型自主重启DSH宿主并无缝继续对话的自动化任务。
インストール
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:liuyun847/dsh-host-restartドキュメント
README 全文を読む ↗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,越大越不容易截断本轮输出)。