dsh-client-auto-continue 0.4.3 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -6
- package/README.zh.md +34 -6
- package/lib/client.js +458 -28
- package/lib/client.js.map +2 -2
- package/lib/index.js +5 -1
- package/lib/types/client/engine.d.ts +77 -3
- package/lib/types/client/index.d.ts +1 -0
- package/lib/types/client/locales.d.ts +18 -1
- package/lib/types/client/settings-card.d.ts +6 -4
- package/lib/types/index.d.ts +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,10 @@ For [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh we
|
|
|
39
39
|
|
|
40
40
|
- **Error classification** — transient failures (network / timeout / 5xx / 429…) are auto-resumed; permanent ones are **skipped** and notified, because retrying them never helps. A failure counts as permanent when its HTTP status is 401/403 or its code/message matches auth, credential/API-key, balance/quota, unknown-model, or context-length/overflow keywords. Turn classification off to resume everything
|
|
41
41
|
- **Adaptive backoff** — consecutive failures wait longer each time (cooldown × factor: 20s → 40s → 80s…), capped at the max backoff, instead of hammering a broken upstream
|
|
42
|
-
- **Templated continue text** — `continueText` supports `{code}` `{message}` `{status}` `{tool}` `{turn}` placeholders, so the resume message can carry the failure context ("继续 (git push failed: UPSTREAM)")
|
|
42
|
+
- **Templated continue text** — `continueText` supports `{code}` `{message}` `{status}` `{tool}` `{turn}` `{errorCount}` `{sessionTitle}` `{elapsed}` placeholders, so the resume message can carry the failure context ("继续 (git push failed: UPSTREAM)"); a **separate template** fires on `max-tokens` (e.g. "继续输出, 不要重复已生成的内容")
|
|
43
|
+
- **Pause** — a global **Pause auto-continue** toggle in the settings card stops everything (live + scan) instantly; per-session pauses (e.g. via a notification button) suspend only one session until they expire
|
|
44
|
+
- **Notification buttons** — notifications carry **Resume now** (send immediately, ignoring cooldown and the consecutive cap) and **Pause this session 1h** actions
|
|
45
|
+
- **Stats panel** — the settings card shows today's auto-continue count, recoveries, failures, permanent skips and give-ups, broken down by error code, with a one-click reset
|
|
43
46
|
- **Browser notifications** — optional alerts when auto-continue fires, gives up, or hits a permanent error; the browser asks for permission on first use, and nothing is shown again after a denial
|
|
44
47
|
|
|
45
48
|
It watches the live event streams and reacts to:
|
|
@@ -139,7 +142,9 @@ dsh web
|
|
|
139
142
|
> global `npm i -g @deepseek-ai/dsh` install, and the invoking directory's
|
|
140
143
|
> own. If you installed from this repository instead, the same script is
|
|
141
144
|
> `node scripts/patch-expose.mjs` at the repo root. The auto-continue engine
|
|
142
|
-
> itself works without this patch — it only gates the GUI settings section
|
|
145
|
+
> itself works without this patch — it only gates the GUI settings section;
|
|
146
|
+
> until then, configure everything directly in `~/.dsh/settings.yaml`
|
|
147
|
+
> (see [Configuration](#configuration)).
|
|
143
148
|
|
|
144
149
|
### Verify & uninstall
|
|
145
150
|
|
|
@@ -159,7 +164,29 @@ dsh web
|
|
|
159
164
|
|
|
160
165
|
## Configuration
|
|
161
166
|
|
|
162
|
-
Everything is configurable from the GUI — no file or console edits needed. Open **Settings →
|
|
167
|
+
Everything is configurable from the GUI — no file or console edits needed. Open **Settings → Plugins** and find the **dsh-client-auto-continue** configuration card, right where every other plugin's config lives. Besides the fields below, the card shows a live **stats panel** (today's activity with a reset button) and the list of **paused sessions** (each with a per-session resume button).
|
|
168
|
+
|
|
169
|
+
**Or skip the GUI and edit the config file directly** — the engine reads the plugin's section from `~/.dsh/settings.yaml` (one shared file for every plugin's sections), so this works in any install, patched or not. The file is watched and re-read automatically, so changes apply live; restart `dsh web` if a page that was already open doesn't pick them up. Fields you leave out fall back to the defaults in the table below:
|
|
170
|
+
|
|
171
|
+
```yaml
|
|
172
|
+
auto-continue:
|
|
173
|
+
paused: false
|
|
174
|
+
continueText: '继续'
|
|
175
|
+
continueTextMaxTokens: '继续'
|
|
176
|
+
graceMs: 3000
|
|
177
|
+
cooldownMs: 20000
|
|
178
|
+
maxConsecutive: 3
|
|
179
|
+
scanOnBoot: true
|
|
180
|
+
scanLimit: 8
|
|
181
|
+
freshMs: 900000
|
|
182
|
+
reconnectScanDelayMs: 5000
|
|
183
|
+
reconnectBackoffMs: 3000
|
|
184
|
+
verbose: true
|
|
185
|
+
classify: true
|
|
186
|
+
backoffFactor: 2
|
|
187
|
+
backoffMaxMs: 300000
|
|
188
|
+
notify: false
|
|
189
|
+
```
|
|
163
190
|
|
|
164
191
|
**How the card works:**
|
|
165
192
|
|
|
@@ -172,7 +199,9 @@ Everything is configurable from the GUI — no file or console edits needed. Ope
|
|
|
172
199
|
|
|
173
200
|
| Field | Default | Description |
|
|
174
201
|
| --- | --- | --- |
|
|
202
|
+
| Pause auto-continue | `off` | Global pause: no live or scan auto-send fires, queued pending sends are cancelled |
|
|
175
203
|
| Continue text | `继续` | Text automatically sent after an interruption |
|
|
204
|
+
| Continue text (max tokens) | `继续` | Text sent when the output token ceiling is reached (same placeholders) |
|
|
176
205
|
| Grace period (ms) | `3000` | Wait after an interruption; cancelled if the host recovers on its own |
|
|
177
206
|
| Cooldown (ms) | `20000` | Min interval between auto-continues per session (failed attempts count too) |
|
|
178
207
|
| Max consecutive | `3` | Max consecutive auto-continues; stops until a user intervenes or a turn completes |
|
|
@@ -187,7 +216,7 @@ Everything is configurable from the GUI — no file or console edits needed. Ope
|
|
|
187
216
|
| Max backoff (ms) | `300000` | Cap on the adaptive backoff interval |
|
|
188
217
|
| Browser notifications | `off` | Notify when auto-continue fires, gives up, or hits a permanent error |
|
|
189
218
|
|
|
190
|
-
`continueText`
|
|
219
|
+
`continueText` (and `continueTextMaxTokens`) accept the placeholders `{code}`, `{message}`, `{status}`, `{tool}` (last tool call before the failure), `{turn}`, `{errorCount}` (consecutive failures including this one), `{sessionTitle}` (from the session list) and `{elapsed}` (time since the failure, e.g. `1m5s`) — e.g. `继续 ({tool}: {code})` becomes `继续 (git push: UPSTREAM)`.
|
|
191
220
|
|
|
192
221
|
---
|
|
193
222
|
|
|
@@ -197,7 +226,7 @@ The plugin is browser-only and touches **no files, credentials, or network beyon
|
|
|
197
226
|
|
|
198
227
|
- It opens the same two read-only event streams the web UI already uses (no extra server, no third-party endpoints)
|
|
199
228
|
- The only write it ever performs is `sessions.prompt` — the same call the Send button makes — with the text you configured
|
|
200
|
-
- Browser storage is limited to small `localStorage` keys
|
|
229
|
+
- Browser storage is limited to small `localStorage` keys: cross-tab coordination stamps, per-session pauses, and the daily stats counters
|
|
201
230
|
- Browser notifications are opt-in (`notify` setting) and permission is requested on first use only
|
|
202
231
|
|
|
203
232
|
---
|
|
@@ -208,7 +237,7 @@ The plugin is browser-only and touches **no files, credentials, or network beyon
|
|
|
208
237
|
npm run typecheck # tsc --noEmit
|
|
209
238
|
npm run build # lib/client.js + lib/index.js + lib/types
|
|
210
239
|
npm run watch # rebuild on change; host HMR hot-reloads without a page refresh
|
|
211
|
-
npm run test # node tests/simulate.mjs —
|
|
240
|
+
npm run test # node tests/simulate.mjs — 22 behavioral scenarios
|
|
212
241
|
```
|
|
213
242
|
|
|
214
243
|
While `npm run watch` runs, the profile's client-hmr row polls `lib/client.js` every 500 ms and hot-reloads the plugin in the browser — no server restart needed for code changes.
|
package/README.zh.md
CHANGED
|
@@ -39,7 +39,10 @@
|
|
|
39
39
|
|
|
40
40
|
- **错误分类** — 临时性错误(网络 / 超时 / 5xx / 429 等)自动续跑; 永久性错误跳过并通知, 因为重试也没用。判定为永久性的条件: HTTP 状态码 401/403, 或 code/message 命中认证、凭据/API Key、余额/配额、模型不存在、上下文长度/超限等关键词。关闭分类后则全部自动继续
|
|
41
41
|
- **自适应退避** — 连续失败时等待时间递增(冷却 × 系数: 20s → 40s → 80s…), 有上限, 不再对故障上游狂轰滥炸
|
|
42
|
-
- **模板化继续文本** — `continueText` 支持 `{code}` `{message}` `{status}` `{tool}` `{turn}` 占位符, 续跑消息可携带失败上下文(如「继续 (git push 失败: UPSTREAM)」)
|
|
42
|
+
- **模板化继续文本** — `continueText` 支持 `{code}` `{message}` `{status}` `{tool}` `{turn}` `{errorCount}` `{sessionTitle}` `{elapsed}` 占位符, 续跑消息可携带失败上下文(如「继续 (git push 失败: UPSTREAM)」); 达到 `max-tokens` 时使用**另一套模板**(如「继续输出, 不要重复已生成的内容」)
|
|
43
|
+
- **暂停** — 设置卡片里的全局 **暂停自动继续** 开关可立即停掉一切(实时 + 扫描); 会话级暂停(如通过通知按钮)只挂起单个会话, 到期自动恢复
|
|
44
|
+
- **通知按钮** — 通知带 **立即续跑**(无视冷却与连续上限, 马上发送)和 **暂停该会话 1 小时** 按钮
|
|
45
|
+
- **统计面板** — 设置卡片展示今日自动继续次数、恢复成功、继续后失败、永久性跳过、达上限停止, 按错误码分布, 可一键清零
|
|
43
46
|
- **浏览器通知** — 可选: 自动继续成功 / 放弃 / 遇到永久性错误时弹出提醒; 首次使用时请求权限, 被拒绝后不再打扰
|
|
44
47
|
|
|
45
48
|
插件监听实时事件流, 对以下情况作出反应:
|
|
@@ -136,7 +139,8 @@ dsh web
|
|
|
136
139
|
> 无需猜测 profile 路径), 并覆盖所有可达的 dsh 安装: profile 链接副本、全局
|
|
137
140
|
> `npm i -g @deepseek-ai/dsh` 安装、以及当前目录的安装。若是从本仓库安装,
|
|
138
141
|
> 同一脚本在仓库根目录执行 `node scripts/patch-expose.mjs` 即可。自动续跑引擎
|
|
139
|
-
> 本身不依赖这个补丁——它只影响 GUI
|
|
142
|
+
> 本身不依赖这个补丁——它只影响 GUI 设置区是否可见; 在此之前, 可以直接在
|
|
143
|
+
> `~/.dsh/settings.yaml` 里配置全部参数(见 [配置](#配置))。
|
|
140
144
|
|
|
141
145
|
### 验证与卸载
|
|
142
146
|
|
|
@@ -156,7 +160,29 @@ dsh web
|
|
|
156
160
|
|
|
157
161
|
## 配置
|
|
158
162
|
|
|
159
|
-
所有参数都可以在 GUI 里配置——无需改文件或控制台。打开 **设置 →
|
|
163
|
+
所有参数都可以在 GUI 里配置——无需改文件或控制台。打开 **设置 → 插件**, 找到 **dsh-client-auto-continue** 的配置卡片, 和其他插件的配置放在一起。除了下面的字段, 卡片还带一个**统计面板**(今日活动, 可一键清零)和**已暂停会话**列表(每个都可单独解除)。
|
|
164
|
+
|
|
165
|
+
**或者跳过 GUI, 直接编辑配置文件** — 引擎从 `~/.dsh/settings.yaml` 读取插件段落(所有插件的设置都在这一个文件里), 因此无论是否打过补丁都能用。文件被监听、自动重读, 改动即时生效; 若已打开的页面没反应, 重启 `dsh web` 即可。没填写的字段会回落到下表中的默认值:
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
auto-continue:
|
|
169
|
+
paused: false
|
|
170
|
+
continueText: '继续'
|
|
171
|
+
continueTextMaxTokens: '继续'
|
|
172
|
+
graceMs: 3000
|
|
173
|
+
cooldownMs: 20000
|
|
174
|
+
maxConsecutive: 3
|
|
175
|
+
scanOnBoot: true
|
|
176
|
+
scanLimit: 8
|
|
177
|
+
freshMs: 900000
|
|
178
|
+
reconnectScanDelayMs: 5000
|
|
179
|
+
reconnectBackoffMs: 3000
|
|
180
|
+
verbose: true
|
|
181
|
+
classify: true
|
|
182
|
+
backoffFactor: 2
|
|
183
|
+
backoffMaxMs: 300000
|
|
184
|
+
notify: false
|
|
185
|
+
```
|
|
160
186
|
|
|
161
187
|
**卡片操作说明:**
|
|
162
188
|
|
|
@@ -169,7 +195,9 @@ dsh web
|
|
|
169
195
|
|
|
170
196
|
| 字段 | 默认 | 说明 |
|
|
171
197
|
| --- | --- | --- |
|
|
198
|
+
| 暂停自动继续 | 关 | 全局暂停: 实时与扫描都不再自动发送, 已排队的待发送也会取消 |
|
|
172
199
|
| 继续文本 | `继续` | 中断后自动发送的消息内容 |
|
|
200
|
+
| 超限时的继续文本 | `继续` | 达到输出 token 上限时自动发送的文本(支持相同占位符) |
|
|
173
201
|
| 宽限期 (ms) | `3000` | 中断后等待的时长; 期间宿主自行恢复则取消 |
|
|
174
202
|
| 冷却时间 (ms) | `20000` | 同一会话两次自动「继续」的最小间隔(失败尝试也计入) |
|
|
175
203
|
| 最大连续次数 | `3` | 同一会话连续自动「继续」上限; 超过后停止, 直到用户介入或成功回合 |
|
|
@@ -184,7 +212,7 @@ dsh web
|
|
|
184
212
|
| 最大退避间隔 (ms) | `300000` | 自适应退避的上限 |
|
|
185
213
|
| 浏览器通知 | 关 | 自动继续成功 / 放弃 / 遇到永久性错误时弹通知 |
|
|
186
214
|
|
|
187
|
-
`continueText` 支持占位符 `{code}`、`{message}`、`{status}`、`{tool}`(失败前最后一次工具调用)和 `{
|
|
215
|
+
`continueText`(以及 `continueTextMaxTokens`)支持占位符 `{code}`、`{message}`、`{status}`、`{tool}`(失败前最后一次工具调用)、`{turn}`、`{errorCount}`(连续失败次数, 含本次)、`{sessionTitle}`(来自会话列表)和 `{elapsed}`(距失败经过的时间, 如 `1m5s`)——例如 `继续 ({tool}: {code})` 会变成 `继续 (git push: UPSTREAM)`。
|
|
188
216
|
|
|
189
217
|
---
|
|
190
218
|
|
|
@@ -194,7 +222,7 @@ dsh web
|
|
|
194
222
|
|
|
195
223
|
- 只复用 webui 本身就在用的两条只读事件流(无额外服务、无第三方端点)
|
|
196
224
|
- 唯一会执行的写入是 `sessions.prompt`——与点「发送」按钮完全相同的调用, 内容为你配置的文本
|
|
197
|
-
- 浏览器存储仅限于少量 `localStorage`
|
|
225
|
+
- 浏览器存储仅限于少量 `localStorage` 键: 跨标签页协调时间戳、会话级暂停、每日统计计数
|
|
198
226
|
- 浏览器通知是可选开启的(`notify` 设置), 仅在首次使用时请求一次权限
|
|
199
227
|
|
|
200
228
|
---
|
|
@@ -205,7 +233,7 @@ dsh web
|
|
|
205
233
|
npm run typecheck # tsc --noEmit
|
|
206
234
|
npm run build # lib/client.js + lib/index.js + lib/types
|
|
207
235
|
npm run watch # 监听变更自动重建; 宿主 HMR 免刷新热重载
|
|
208
|
-
npm run test # node tests/simulate.mjs —
|
|
236
|
+
npm run test # node tests/simulate.mjs — 22 个行为场景
|
|
209
237
|
```
|
|
210
238
|
|
|
211
239
|
`npm run watch` 运行时, profile 的 client-hmr 行每 500ms 轮询 `lib/client.js` 并在浏览器中热重载插件——改代码无需重启服务。
|