dsh-client-auto-continue 0.4.4 → 0.5.1

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 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
@@ -185,6 +190,12 @@ auto-continue:
185
190
 
186
191
  **How the card works:**
187
192
 
193
+ ![Settings → Plugins](docs/screenshots/05-plugins-view.png)
194
+
195
+ ![Card fields](docs/screenshots/06-card-fields.png)
196
+
197
+ ![Stats & paused sessions](docs/screenshots/07-card-panels.png)
198
+
188
199
  - Edits are **staged** — nothing reaches the disk until you hit **Save**; an unsaved badge marks the card while drafts are pending, and **Discard** drops them
189
200
  - A field you changed shows an **Overridden** badge with a per-field **Reset to default** button that restores the built-in value
190
201
  - Boolean fields are **tri-state**: *Inherit* (use the default) / *On* / *Off*
@@ -194,7 +205,9 @@ auto-continue:
194
205
 
195
206
  | Field | Default | Description |
196
207
  | --- | --- | --- |
208
+ | Pause auto-continue | `off` | Global pause: no live or scan auto-send fires, queued pending sends are cancelled |
197
209
  | Continue text | `继续` | Text automatically sent after an interruption |
210
+ | Continue text (max tokens) | `继续` | Text sent when the output token ceiling is reached (same placeholders) |
198
211
  | Grace period (ms) | `3000` | Wait after an interruption; cancelled if the host recovers on its own |
199
212
  | Cooldown (ms) | `20000` | Min interval between auto-continues per session (failed attempts count too) |
200
213
  | Max consecutive | `3` | Max consecutive auto-continues; stops until a user intervenes or a turn completes |
@@ -209,7 +222,7 @@ auto-continue:
209
222
  | Max backoff (ms) | `300000` | Cap on the adaptive backoff interval |
210
223
  | Browser notifications | `off` | Notify when auto-continue fires, gives up, or hits a permanent error |
211
224
 
212
- `continueText` accepts the placeholders `{code}`, `{message}`, `{status}`, `{tool}` (last tool call before the failure) and `{turn}` — e.g. `继续 ({tool}: {code})` becomes `继续 (git push: UPSTREAM)`.
225
+ `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
226
 
214
227
  ---
215
228
 
@@ -219,7 +232,7 @@ The plugin is browser-only and touches **no files, credentials, or network beyon
219
232
 
220
233
  - It opens the same two read-only event streams the web UI already uses (no extra server, no third-party endpoints)
221
234
  - 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 for cross-tab coordination
235
+ - Browser storage is limited to small `localStorage` keys: cross-tab coordination stamps, per-session pauses, and the daily stats counters
223
236
  - Browser notifications are opt-in (`notify` setting) and permission is requested on first use only
224
237
 
225
238
  ---
@@ -230,7 +243,7 @@ The plugin is browser-only and touches **no files, credentials, or network beyon
230
243
  npm run typecheck # tsc --noEmit
231
244
  npm run build # lib/client.js + lib/index.js + lib/types
232
245
  npm run watch # rebuild on change; host HMR hot-reloads without a page refresh
233
- npm run test # node tests/simulate.mjs — 15 behavioral scenarios
246
+ npm run test # node tests/simulate.mjs — 22 behavioral scenarios
234
247
  ```
235
248
 
236
249
  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
@@ -181,6 +186,12 @@ auto-continue:
181
186
 
182
187
  **卡片操作说明:**
183
188
 
189
+ ![设置 → 插件](docs/screenshots/05-plugins-view.png)
190
+
191
+ ![卡片字段](docs/screenshots/06-card-fields.png)
192
+
193
+ ![统计与暂停会话](docs/screenshots/07-card-panels.png)
194
+
184
195
  - 修改是**暂存式**的——点「保存」之前不会写入磁盘; 有待保存草稿时卡片显示「未保存」徽章, 「放弃」可丢弃草稿
185
196
  - 改动过的字段会带「已覆盖」徽章, 并有逐字段的「恢复默认」按钮(回到内置默认值)
186
197
  - 布尔字段是三态:**继承**(用默认)/ 开 / 关
@@ -190,7 +201,9 @@ auto-continue:
190
201
 
191
202
  | 字段 | 默认 | 说明 |
192
203
  | --- | --- | --- |
204
+ | 暂停自动继续 | 关 | 全局暂停: 实时与扫描都不再自动发送, 已排队的待发送也会取消 |
193
205
  | 继续文本 | `继续` | 中断后自动发送的消息内容 |
206
+ | 超限时的继续文本 | `继续` | 达到输出 token 上限时自动发送的文本(支持相同占位符) |
194
207
  | 宽限期 (ms) | `3000` | 中断后等待的时长; 期间宿主自行恢复则取消 |
195
208
  | 冷却时间 (ms) | `20000` | 同一会话两次自动「继续」的最小间隔(失败尝试也计入) |
196
209
  | 最大连续次数 | `3` | 同一会话连续自动「继续」上限; 超过后停止, 直到用户介入或成功回合 |
@@ -205,7 +218,7 @@ auto-continue:
205
218
  | 最大退避间隔 (ms) | `300000` | 自适应退避的上限 |
206
219
  | 浏览器通知 | 关 | 自动继续成功 / 放弃 / 遇到永久性错误时弹通知 |
207
220
 
208
- `continueText` 支持占位符 `{code}`、`{message}`、`{status}`、`{tool}`(失败前最后一次工具调用)和 `{turn}`——例如 `继续 ({tool}: {code})` 会变成 `继续 (git push: UPSTREAM)`。
221
+ `continueText`(以及 `continueTextMaxTokens`)支持占位符 `{code}`、`{message}`、`{status}`、`{tool}`(失败前最后一次工具调用)、`{turn}`、`{errorCount}`(连续失败次数, 含本次)、`{sessionTitle}`(来自会话列表)和 `{elapsed}`(距失败经过的时间, 如 `1m5s`)——例如 `继续 ({tool}: {code})` 会变成 `继续 (git push: UPSTREAM)`。
209
222
 
210
223
  ---
211
224
 
@@ -215,7 +228,7 @@ auto-continue:
215
228
 
216
229
  - 只复用 webui 本身就在用的两条只读事件流(无额外服务、无第三方端点)
217
230
  - 唯一会执行的写入是 `sessions.prompt`——与点「发送」按钮完全相同的调用, 内容为你配置的文本
218
- - 浏览器存储仅限于少量 `localStorage` 键(跨标签页协调用)
231
+ - 浏览器存储仅限于少量 `localStorage` 键: 跨标签页协调时间戳、会话级暂停、每日统计计数
219
232
  - 浏览器通知是可选开启的(`notify` 设置), 仅在首次使用时请求一次权限
220
233
 
221
234
  ---
@@ -226,7 +239,7 @@ auto-continue:
226
239
  npm run typecheck # tsc --noEmit
227
240
  npm run build # lib/client.js + lib/index.js + lib/types
228
241
  npm run watch # 监听变更自动重建; 宿主 HMR 免刷新热重载
229
- npm run test # node tests/simulate.mjs — 15 个行为场景
242
+ npm run test # node tests/simulate.mjs — 22 个行为场景
230
243
  ```
231
244
 
232
245
  `npm run watch` 运行时, profile 的 client-hmr 行每 500ms 轮询 `lib/client.js` 并在浏览器中热重载插件——改代码无需重启服务。