dsh-autoresume
shengyvself
在 dsh-web 重启之后(或运行期间再次出现网络/瞬时故障时),自动给被打断的会话注入「继续(自动)」,让 agent 接着上次停下的位置继续跑——不需要用户手动点、不会丢上下文。触发场景:(1) 大模型拥挤 / 排队——上游限流 429(错误码 RATE_LIMIT / rate_limit_exceeded / too_many_requests),或返回 type=service_unavailable,或消息命中 "currently overloaded" / "please try again later" / "all endpoints are currently overloaded" / 5xx 等特征,属于"等一会儿就能恢复"的瞬时故障,自动接着跑。(2) 上游网络 / 服务端故障——错误码 SERVER / TIMEOUT / TRANSPORT / EMPTY_RESPONSE,或消息命中网络特征正则 NETWORK_FAILURE_PATTERN(upstream error / internal server error / service temporarily unavailable / timed out / fetch failed / ECONNRESET / ECONNREFUSED / ETIMEDOUT / socket hang up / network error / connection refused|reset|closed),支持 {error: {code, type, message}} 错误信封解包。(3) DSH web 重启 / 崩溃造成 turn 停在中间态——turn/start 后无 turn/end、step/start 后无 step/end、有 tool/call 但无对应 tool/result、或最后一个 turn/end 原因 = interrupted。不动的场景(避免误注入 / 死循环):最后事件是 assistant/message(已完成)、turn/end 原因=completed;cancelled,或非网络类 error(配置/模型错误如 UNKNOWN_MODEL / MISSING_CREDENTIAL / NO_ADAPTER / INVALID_MODEL_INFO);死循环守卫——上次注入「继续」之后若模型持续返回空内容(典型如某些隐身模型过载时),自动转 settled 不再注入,交还用户。守护窗口:默认 24h 扫描窗口 + 永久 liveWatch 守护(bootGraceMs 默认 Infinity)。配 targetSessionId 时只盯单会话(旧行为)。
Auto-resumes dsh sessions whose turn was left mid-flight by a web process restart or by a transient upstream failure, by injecting a 「继续(自动)」 ("continue (auto)") user message so the agent picks up exactly where it stopped — no manual click, no lost context. Triggering scenarios: (1) Upstream rate-limiting / overload — HTTP 429 with code RATE_LIMIT / rate_limit_exceeded / too_many_requests, or type=service_unavailable, or message containing "currently overloaded" / "please try again later" / "all endpoints are currently overloaded" / 5xx. (2) Upstream network / server faults — code SERVER / TIMEOUT / TRANSPORT / EMPTY_RESPONSE, or message matching NETWORK_FAILURE_PATTERN (upstream error / internal server error / service temporarily unavailable / timed out / fetch failed / ECONNRESET / ECONNREFUSED / ETIMEDOUT / socket hang up / network error / connection refused|reset|closed); supports DSH/OpenAI-style error envelopes {error: {code, type, message}}. (3) DSH web restart / crash leaving a turn mid-state — open turn/step without a matching end, pending tool/call without tool/result, or turn/end reason = interrupted. Skipped (avoid false positives / loops): assistant/message last, or turn/end reason=completed; cancelled, or non-network errors (config / model errors like UNKNOWN_MODEL / MISSING_CREDENTIAL / NO_ADAPTER); dead-loop guard — if the previous "continue" injection produced no content or tool calls and the same network error recurs (e.g. some stealth models returning empty under sustained overload), the plugin falls back to settled and hands the session back to the user. Guardian: 24h scan window + permanent liveWatch (bootGraceMs default Infinity). Set targetSessionId to watch a single session (legacy mode).
安装命令
dsh plugin --profile web add dsh-autoresume该命令来自上游目录,本站的自动审核尚未覆盖它——执行前请自行核对仓库。
安装后运行 dsh --profile web --dump-config 并重启对应 profile。插件会以你的本机权限运行第三方代码,安装前请检查源码。