DSH Hub

Frog755/dsh-client-auto-retry

dsh-client-auto-retry

UIDesktop1 GitHub stars· updated 2026-08-20

dsh-client-auto-retry is a community DeepSeek Harness plugin. Read the repository README before installing.

Install

npx -y @deepseek-ai/dsh plugin --profile web add @frog755/dsh-client-auto-retry

Restart `dsh web` after install. Bundle APIs can change during the developer preview.

README badge

dsh-client-auto-retry DSH Hub badge
[![DSH Hub](https://dshhub.dev/badge/dsh-client-auto-retry.svg)](https://dshhub.dev/plugins/dsh-client-auto-retry)

Paste this into your README. The star count updates with every catalog sync.

From the README

Excerpt from Frog755/dsh-client-auto-retry, cleaned of badges and images.

@frog755/dsh-client-auto-retry

DSH 客户端插件:检测到回合被中断 / 出错 / 超长(max-tokens)时,自动发送「继续」重试。 只做自动重试,不做模型 / provider 切换。自带设置卡片。

English version: README-EN.md


它能做什么

DeepSeek Harness(DSH)的回合(turn)偶尔会因为网络抖动、provider 报错、超时、 或输出达到 token 上限而中断。大多数情况下模型其实已经跑完大部分内容,只要再发一句 「继续」就能接着完成,完全不需要人工介入、也不需要切换模型。

这个插件就是干这件事的:

  1. 监听会话事件流(api.events.mux);
  2. 发现 turn/endreason.kind 属于 error / interrupted / max-tokens 时, 等一个宽限期(默认 5 秒,给 host 留出重连/恢复的时间);
  3. 宽限期后向该会话自动发送「继续」(可配置文本);
  4. 带冷却期、连续次数上限、启动时扫描最近被中断的会话等防护措施,避免失控循环。

安装

方式 A:通过 npm 安装(推荐)

在 DSH 的 profile 目录(例如 ~/.dsh/profiles/web)里执行:

pnpm add @frog755/dsh-client-auto-retry

然后编辑该目录下的 package.json,把 @frog755/dsh-client-auto-retry 加入 dsh.profile.bundles (插件自带的 cordis.patch.yml 会以 bundle 层的形式把 auto-retry 行插入插件清单):

{
  "dependencies": {
    "@frog755/dsh-client-auto-retry": "^0.3.0"
  },
  "dsh": {
    "profile": {
      "bundles": [
        "@deepseek-ai/dsh-base",
        "@deepseek-ai/dsh-web-app",
        // ... 其他 bundle ...
        "@frog755/dsh-client-auto-retry"
      ]
    }
  }
}

然后:

pnpm install

重启 DeepSeek Harness(Host 侧插件只在进程内加载一次),再刷新浏览器页面即可。

方式 B:本地 link 开发调试

{
  "dependencies": {
    "@frog755/dsh-client-auto-retry": "link:C:/Users/frog/.dsh/projects/dsh-client-auto-retry"
  }
}

改完 lib/ 下的文件后刷新页面即可(Client 侧即时生效);Host 侧 lib/index.js 的改动需要重启。

设置项

设置入口:设置 → 通用 → 断联自动重试。所有项都实时生效(applies: "live")。

字段默认值含义
graceMs5000宽限期:中断后等多少毫秒再自动发送「继续」
cooldownMs20000冷却期:同一会话两次自动继续的最小间隔
maxConsecutive5最多连续自动继续次数,超过后停下等人工介入
continueText继续自动发送的文本内容
scanOnBoottrue页面加载时扫描最近被中断的会话并恢复
freshMs900000扫描窗口:只恢复此时间段内被中断的会话(毫秒)
verbosetrue在浏览器控制台输出 [auto-retry] 调试日志

工作原理

flowchart LR
    A[api.events.mux 事件流] --> B{turn/end?}
    B -- "error / interrupted / max-tokens" --> C[schedule: 宽限期 graceMs]
    B -- "completed / aborted / blocked" --> D[重置连续计数]
    C --> E{冷却期已过? 未超上限?}
    E -- 否 --> F[跳过, 等人工]
    E -- 是 --> G[fire: sessions.prompt 发送「继续」]
    G --> H[连续次数 +1]
    A --> I[user/message 到来] --> D
    A --> J[scanOnBoot: 启动扫描最近中断会话] --> C

核心逻辑都在 lib/client.jsAutoRetryRunner 里;lib/index.js(Host 半边) 只负责注册设置 schema。

兼容性说明(重点)

📖 详细版见 docs/COMPATIBILITY.md(含排查步骤与修改点索引)。

已适配版本

本插件是针对 DSH 0.1.0-rc.7(web 端 profile;desktop runtime 同版本)编写并验证的。 不同版本 / 不同形态的 DSH(桌面端 App、更新或更旧的 rc、社区构建)接口可能不同, 装不上或不生效时请按下表逐个核对。

插件依赖的 DSH API 面

Related plugins