READMESource: main@7c5c1282
dsh-auto-resume
DSH 崩溃或者被系统杀掉之后重启,自动把没跑完的回合接上,不用再手打一句「继续」。
它怎么判断「没跑完」
会话开始跑一个回合 (turn/start) → 记一笔到 ~/.dsh/auto-resume/pending.json
回合正常结束 (turn/end) → 把这一笔删掉
进程崩了 → 这一笔留在磁盘上
下次启动 → 发现不是本进程写的、时间还很新 → 补一句「继续」
装
两种都行(CLI 会自动加进 profile 的 dsh.profile.bundles):
# 1) 直接从 GitHub 装
dsh plugin --profile web add github:MIOM-2025/dsh-auto-resume
# 2) 或者本地目录装(改代码方便)
git clone https://github.com/MIOM-2025/dsh-auto-resume ~/dsh-auto-resume
dsh plugin --profile web add link:~/dsh-auto-resume
装完验一下:
dsh --profile web --dump-config | grep -A3 auto-resume # 能看到条目就说明挂上了
装完要重启一次 DSH 才生效(崩一次再起来,正好就是它的舞台)。
配置(cordis.patch.yml)
| 键 | 默认 | 说明 |
|---|---|---|
| enabled | true | 总开关 |
| text | 见代码 | 补的那句话 |
| windowMinutes | 720 | 只接最近 12 小时内被打断的回合 |
| max | 2 | 一次最多接几个会话(按中断时间从新到旧) |
| delayMs | 5000 | 启动后等多久再补 |
| gapMs | 3000 | 会话之间间隔 |
| maxAttempts | 3 | 同一会话连续失败几次就放弃 |
| dir | ~/.dsh/auto-resume | 记录目录 |
看它干了什么
cat ~/.dsh/auto-resume/auto-resume.log
cat ~/.dsh/auto-resume/pending.json # {} = 当前没有中断的回合
什么会续、什么不会
| 情况 | 自动续? |
|---|---|
| DSH 进程被系统杀掉 / 意外退出,回合没跑完 | 会 |
| 模型报错、达到限额、没额度 | 不会。这类失败回合是正常收尾的(turn/end 写了),补一句只会白烧额度 |
| 回合已经答完 | 不会 |
| 你手动按了停止 | 不会 |
| 你自己已经回来接手了 | 不会 |
| 崩了又崩(同一会话连续 3 次) | 不会,收手等你看 |
注意
- 只接「回合中途」中断的会话。回合已经答完再崩,不会瞎补一句。
- 手动停止(cancel)会正常触发 turn/end,不会被当成崩溃。
- 如果某次中断其实你不想要了,起来之前删掉 pending.json 里那一项即可。
No comments yet. Be the first to write one.