dsh-client-auto-continue 0.4.4 → 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 +12 -5
- package/README.zh.md +12 -5
- package/lib/client.js +455 -22
- 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 -0
- package/lib/types/client/settings-card.d.ts +3 -1
- 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:
|
|
@@ -161,13 +164,15 @@ dsh web
|
|
|
161
164
|
|
|
162
165
|
## Configuration
|
|
163
166
|
|
|
164
|
-
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.
|
|
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).
|
|
165
168
|
|
|
166
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:
|
|
167
170
|
|
|
168
171
|
```yaml
|
|
169
172
|
auto-continue:
|
|
173
|
+
paused: false
|
|
170
174
|
continueText: '继续'
|
|
175
|
+
continueTextMaxTokens: '继续'
|
|
171
176
|
graceMs: 3000
|
|
172
177
|
cooldownMs: 20000
|
|
173
178
|
maxConsecutive: 3
|
|
@@ -194,7 +199,9 @@ auto-continue:
|
|
|
194
199
|
|
|
195
200
|
| Field | Default | Description |
|
|
196
201
|
| --- | --- | --- |
|
|
202
|
+
| Pause auto-continue | `off` | Global pause: no live or scan auto-send fires, queued pending sends are cancelled |
|
|
197
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) |
|
|
198
205
|
| Grace period (ms) | `3000` | Wait after an interruption; cancelled if the host recovers on its own |
|
|
199
206
|
| Cooldown (ms) | `20000` | Min interval between auto-continues per session (failed attempts count too) |
|
|
200
207
|
| Max consecutive | `3` | Max consecutive auto-continues; stops until a user intervenes or a turn completes |
|
|
@@ -209,7 +216,7 @@ auto-continue:
|
|
|
209
216
|
| Max backoff (ms) | `300000` | Cap on the adaptive backoff interval |
|
|
210
217
|
| Browser notifications | `off` | Notify when auto-continue fires, gives up, or hits a permanent error |
|
|
211
218
|
|
|
212
|
-
`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)`.
|
|
213
220
|
|
|
214
221
|
---
|
|
215
222
|
|
|
@@ -219,7 +226,7 @@ The plugin is browser-only and touches **no files, credentials, or network beyon
|
|
|
219
226
|
|
|
220
227
|
- It opens the same two read-only event streams the web UI already uses (no extra server, no third-party endpoints)
|
|
221
228
|
- The only write it ever performs is `sessions.prompt` — the same call the Send button makes — with the text you configured
|
|
222
|
-
- 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
|
|
223
230
|
- Browser notifications are opt-in (`notify` setting) and permission is requested on first use only
|
|
224
231
|
|
|
225
232
|
---
|
|
@@ -230,7 +237,7 @@ The plugin is browser-only and touches **no files, credentials, or network beyon
|
|
|
230
237
|
npm run typecheck # tsc --noEmit
|
|
231
238
|
npm run build # lib/client.js + lib/index.js + lib/types
|
|
232
239
|
npm run watch # rebuild on change; host HMR hot-reloads without a page refresh
|
|
233
|
-
npm run test # node tests/simulate.mjs —
|
|
240
|
+
npm run test # node tests/simulate.mjs — 22 behavioral scenarios
|
|
234
241
|
```
|
|
235
242
|
|
|
236
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
|
插件监听实时事件流, 对以下情况作出反应:
|
|
@@ -157,13 +160,15 @@ dsh web
|
|
|
157
160
|
|
|
158
161
|
## 配置
|
|
159
162
|
|
|
160
|
-
所有参数都可以在 GUI 里配置——无需改文件或控制台。打开 **设置 → 插件**, 找到 **dsh-client-auto-continue** 的配置卡片,
|
|
163
|
+
所有参数都可以在 GUI 里配置——无需改文件或控制台。打开 **设置 → 插件**, 找到 **dsh-client-auto-continue** 的配置卡片, 和其他插件的配置放在一起。除了下面的字段, 卡片还带一个**统计面板**(今日活动, 可一键清零)和**已暂停会话**列表(每个都可单独解除)。
|
|
161
164
|
|
|
162
165
|
**或者跳过 GUI, 直接编辑配置文件** — 引擎从 `~/.dsh/settings.yaml` 读取插件段落(所有插件的设置都在这一个文件里), 因此无论是否打过补丁都能用。文件被监听、自动重读, 改动即时生效; 若已打开的页面没反应, 重启 `dsh web` 即可。没填写的字段会回落到下表中的默认值:
|
|
163
166
|
|
|
164
167
|
```yaml
|
|
165
168
|
auto-continue:
|
|
169
|
+
paused: false
|
|
166
170
|
continueText: '继续'
|
|
171
|
+
continueTextMaxTokens: '继续'
|
|
167
172
|
graceMs: 3000
|
|
168
173
|
cooldownMs: 20000
|
|
169
174
|
maxConsecutive: 3
|
|
@@ -190,7 +195,9 @@ auto-continue:
|
|
|
190
195
|
|
|
191
196
|
| 字段 | 默认 | 说明 |
|
|
192
197
|
| --- | --- | --- |
|
|
198
|
+
| 暂停自动继续 | 关 | 全局暂停: 实时与扫描都不再自动发送, 已排队的待发送也会取消 |
|
|
193
199
|
| 继续文本 | `继续` | 中断后自动发送的消息内容 |
|
|
200
|
+
| 超限时的继续文本 | `继续` | 达到输出 token 上限时自动发送的文本(支持相同占位符) |
|
|
194
201
|
| 宽限期 (ms) | `3000` | 中断后等待的时长; 期间宿主自行恢复则取消 |
|
|
195
202
|
| 冷却时间 (ms) | `20000` | 同一会话两次自动「继续」的最小间隔(失败尝试也计入) |
|
|
196
203
|
| 最大连续次数 | `3` | 同一会话连续自动「继续」上限; 超过后停止, 直到用户介入或成功回合 |
|
|
@@ -205,7 +212,7 @@ auto-continue:
|
|
|
205
212
|
| 最大退避间隔 (ms) | `300000` | 自适应退避的上限 |
|
|
206
213
|
| 浏览器通知 | 关 | 自动继续成功 / 放弃 / 遇到永久性错误时弹通知 |
|
|
207
214
|
|
|
208
|
-
`continueText` 支持占位符 `{code}`、`{message}`、`{status}`、`{tool}`(失败前最后一次工具调用)和 `{
|
|
215
|
+
`continueText`(以及 `continueTextMaxTokens`)支持占位符 `{code}`、`{message}`、`{status}`、`{tool}`(失败前最后一次工具调用)、`{turn}`、`{errorCount}`(连续失败次数, 含本次)、`{sessionTitle}`(来自会话列表)和 `{elapsed}`(距失败经过的时间, 如 `1m5s`)——例如 `继续 ({tool}: {code})` 会变成 `继续 (git push: UPSTREAM)`。
|
|
209
216
|
|
|
210
217
|
---
|
|
211
218
|
|
|
@@ -215,7 +222,7 @@ auto-continue:
|
|
|
215
222
|
|
|
216
223
|
- 只复用 webui 本身就在用的两条只读事件流(无额外服务、无第三方端点)
|
|
217
224
|
- 唯一会执行的写入是 `sessions.prompt`——与点「发送」按钮完全相同的调用, 内容为你配置的文本
|
|
218
|
-
- 浏览器存储仅限于少量 `localStorage`
|
|
225
|
+
- 浏览器存储仅限于少量 `localStorage` 键: 跨标签页协调时间戳、会话级暂停、每日统计计数
|
|
219
226
|
- 浏览器通知是可选开启的(`notify` 设置), 仅在首次使用时请求一次权限
|
|
220
227
|
|
|
221
228
|
---
|
|
@@ -226,7 +233,7 @@ auto-continue:
|
|
|
226
233
|
npm run typecheck # tsc --noEmit
|
|
227
234
|
npm run build # lib/client.js + lib/index.js + lib/types
|
|
228
235
|
npm run watch # 监听变更自动重建; 宿主 HMR 免刷新热重载
|
|
229
|
-
npm run test # node tests/simulate.mjs —
|
|
236
|
+
npm run test # node tests/simulate.mjs — 22 个行为场景
|
|
230
237
|
```
|
|
231
238
|
|
|
232
239
|
`npm run watch` 运行时, profile 的 client-hmr 行每 500ms 轮询 `lib/client.js` 并在浏览器中热重载插件——改代码无需重启服务。
|