dsh-client-auto-continue 0.12.1 → 0.12.2

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
@@ -42,11 +42,11 @@ Automatic recovery for [DeepSeek Harness](https://github.com/deepseek-ai/deepsee
42
42
  - **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. Provider-specific exceptions can be opted into with literal custom retryable patterns; turn classification off to resume everything
43
43
  - **Adaptive backoff** — consecutive failures wait longer each time (cooldown × factor: 20s → 40s → 80s…), capped at the max backoff, instead of hammering a broken upstream
44
44
  - **English / Chinese localization** — the settings card, built-in resume / guard / loop text, and browser notifications follow DSH's active UI language (initially selected from the browser language). Only `en` and `zh` are supported; other languages fall back to Chinese. Switching languages updates built-in defaults without overwriting custom text
45
- - **Templated continue text** — `continueText` supports `{code}` `{message}` `{status}` `{tool}` `{turn}` `{errorCount}` `{sessionTitle}` `{elapsed}` placeholders, so the resume message can carry the failure context ("Continue ({tool} failed: {code})"); a **separate template** fires on `max-tokens` (e.g. "Continue the output without repeating anything already generated")
45
+ - **Templated continue text** — `continueText` supports `{code}` `{message}` `{status}` `{tool}` `{turn}` `{errorCount}` `{elapsed}` placeholders, so the resume message can carry the failure context ("Continue ({tool} failed: {code})"); a **separate template** fires on `max-tokens` (e.g. "Continue the output without repeating anything already generated")
46
46
  - **Idempotency guard** — before resuming, the plugin inspects the last tool call: if its result is unconfirmed (the turn died mid-tool, e.g. a `git push` that may have gone through), the resume message tells the model to check state first and not to rerun; if the tool is confirmed done, it says so and asks not to repeat it; a failed tool gets no guard (retrying it is the point). Both guard texts are configurable (`{tool}` / `{result}` placeholders)
47
47
  - **Silent turn resume** — recover an observed model step or reasoning-only response that completes without visible output. A no-op turn with no model activity is left alone. Text, tool calls, images and extension blocks count as visible, including streamed output. Unobserved turns are not guessed to be silent. Explicit `no-visible-output` markers also recover after restart. Disabling **Resume silent turns** cancels queued silent sends; silent turns never reset the retry cap, even while the option is off.
48
48
  - **Autonomous loop** — off by default (`resumeCompletedTurns`). When enabled, normally completed turns continue after the grace period, without the recovery cooldown or attempt cap. Reasoning-only turns and explicit `no-visible-output` endings still consume the recovery budget and obey backoff. Global pause, session pause, manual Stop and disabling the option stop the loop. Its prompt is separate from the loop guard’s prompt (`continueTextLoop`, default `Continue`).
49
- - **Pause** — a global **Pause auto-continue** toggle in the settings card stops automatic sends from live events and startup scanning; per-session pauses (e.g. via a notification button) suspend only one session until they expire. The **Resume now** notification button is the one explicit exception: pressing it is the user asking for exactly one send, pause or not
49
+ - **Pause** — a global **Pause auto-continue** toggle in the settings card stops automatic sends from live events and startup scanning; per-session pauses (e.g. via a notification button) suspend only one session until they expire. **Resume now** requests one send even when both pauses are active. It leaves the pauses in place, so later automatic recovery and autonomous-loop sends remain paused
50
50
  - **Notification buttons** — notifications carry **Resume now** (send immediately, ignoring cooldown, the consecutive cap and any pause) and **Pause this session 1h** actions
51
51
  - **Loop guard** — watches **running** turns too. Four signals trip the guard, which cancels the turn and restarts it with a configurable loop text ("stop repeating, try another way"): the model repeating the **exact same message** several times (any length — e.g. "Let me test variants of the regex…" ×7), repeated near-duplicate paragraphs **inside one streamed assistant message**, many short messages inside a short time window with no tool call in between (the "Let me read…" spin), or the same tool called repeatedly with the **same arguments and the same results** (a changed argument or result counts as progress). The cancel carries an internal marker so it is never confused with a user stop — the restart only happens for guard-initiated cancels. Thresholds, the time window and the loop text are configurable
52
52
  - **Stats panel** — the settings card shows today's auto-continue count, recoveries, failures, permanent skips, give-ups and loop breaks, broken down by error code, with a one-click reset
@@ -61,10 +61,11 @@ It watches the live event streams and reacts to:
61
61
  | `turn/end` → `max-tokens` | Output token ceiling reached |
62
62
  | `turn/end` → `completed` / `no-visible-output` with no visible output | Observed model activity without visible output, or an explicit silent-ending marker |
63
63
  | `turn/end` → `completed` | Continue a normal completion only when autonomous loop is enabled |
64
- | `host/agent-error` | Agent failure with no turn position (only network/timeout-class messages auto-resume) |
65
64
 
66
65
  **Recovery stops for:** manual Stop, policy rejection (`blocked`), paused sessions, subagent sessions and the consecutive-attempt cap. A new turn or manual user message cancels a queued continuation. Live `interrupted` markers are left to the startup recovery scan. Recoverable failures during cooldown are **deferred**, not discarded. If an interrupted session already has queued turns, the continuation runs first and the existing turns retain their order behind it. The loop guard can separately cancel and restart a running turn that is repeating itself.
67
66
 
67
+ Subagent sessions stay under their parent agent's control. The plugin skips them during live recovery and startup scanning, ignores **Resume now** for them, and leaves them out of loop-guard cancellation. Any queued recovery is cancelled when a session is identified as a subagent.
68
+
68
69
  ---
69
70
 
70
71
  ## How It Works
@@ -254,6 +255,7 @@ When migrating from the legacy settings file to DSH 0.1.7 / 0.2, move these valu
254
255
  ![Expanded Auto continue configuration on DSH 0.2](docs/screenshots/02-settings-card.png)
255
256
 
256
257
  - 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
258
+ - If you edit or reset a field while a save is in progress, the newer draft stays in the card. Click **Save** again after the current save finishes to apply it
257
259
  - A field you changed shows an **Overridden** badge with a per-field **Reset to default** button that removes the override and restores the inherited value (normally the built-in default)
258
260
  - Boolean fields are **tri-state**: *Inherit* (use the default) / *On* / *Off*
259
261
  - Invalid drafts (non-numbers, values below the minimum) block the save with a hint
@@ -310,7 +312,7 @@ For a provider-specific error that is safe to resume (confirm first that manuall
310
312
 
311
313
  Patterns are literal substrings, not regular expressions. Blank lines are ignored; any matching line wins before the built-in permanent-error rules. Cooldown and consecutive-attempt limits still apply.
312
314
 
313
- `continueText` (and `continueTextMaxTokens`, `continueTextSilent`, `continueTextLoop`) 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. `Continue ({tool}: {code})` becomes `Continue (git push: UPSTREAM)`. The guard texts accept `{tool}` and `{result}` (a truncated excerpt of the last tool output).
315
+ `continueText` (and `continueTextMaxTokens`, `continueTextSilent`, `continueTextLoop`) accept the placeholders `{code}`, `{message}`, `{status}`, `{tool}` (last tool call before the failure), `{turn}`, `{errorCount}` (consecutive failures including this one) and `{elapsed}` (time since the failure, e.g. `1m5s`) — e.g. `Continue ({tool}: {code})` becomes `Continue (git push: UPSTREAM)`. The guard texts accept `{tool}` and `{result}` (a truncated excerpt of the last tool output). The host engine currently leaves `{sessionTitle}` empty.
314
316
 
315
317
  ---
316
318
 
@@ -340,9 +342,9 @@ npm test
340
342
  npm run test:runtime
341
343
  ```
342
344
 
343
- `npm test` covers recovery, autonomous-loop limits and toggles, startup scanning, queue ordering, statistics, localization and settings UI lifecycle. `npm run test:runtime` uses published DSH **0.1.7-rc.2** and **0.2.0-rc.1** Settings, Loader and HTTP services. It also runs the actual 0.2 profile compatibility gate and checks client activation with Cordis 4.0.4 when one settings provider is absent. The runtime harness controls agent events; it does not send requests to a model provider.
345
+ `npm test` covers recovery, autonomous-loop limits and toggles, child-session exclusion, manual resume during pauses, startup scanning, queue ordering, statistics, localization, settings UI lifecycle and edits made during pending saves. `npm run test:runtime` uses published DSH **0.1.7-rc.2** and **0.2.0-rc.1** Settings, Loader and HTTP services. It also runs the actual 0.2 profile compatibility gate and checks client activation with Cordis 4.0.4 when one settings provider is absent. The runtime harness controls agent events; it does not send requests to a model provider.
344
346
 
345
- `npm run watch` rebuilds local changes. If the host has client HMR enabled, it can reload the linked client bundle; otherwise restart DSH and refresh the browser after rebuilding.
347
+ After editing a linked checkout, run `npm run build` to write the updated `lib/` files, then restart DSH and refresh the browser. Hosts with client HMR enabled can reload a rebuilt client bundle automatically.
346
348
 
347
349
  CI typechecks, rebuilds, runs both test suites, verifies committed `lib/` artifacts and runs [dsh-plugin-check](https://github.com/omdsh-dev/dsh-plugin-check). The same checks gate releases. See [screenshot capture notes](docs/screenshots/README.md) when updating the UI documentation.
348
350
 
package/README.zh.md CHANGED
@@ -42,11 +42,11 @@
42
42
  - **错误分类** — 临时性错误(网络 / 超时 / 5xx / 429 等)自动续跑; 永久性错误跳过并通知, 因为重试也没用。判定为永久性的条件: HTTP 状态码 401/403, 或 code/message 命中认证、凭据/API Key、余额/配额、模型不存在、上下文长度/超限等关键词。provider 专属例外可由用户显式填写普通文本匹配; 关闭分类后则全部自动继续
43
43
  - **自适应退避** — 连续失败时等待时间递增(冷却 × 系数: 20s → 40s → 80s…), 有上限, 不再对故障上游狂轰滥炸
44
44
  - **中英文本地化** — 设置卡片、内置续跑 / 护栏 / 循环文案以及浏览器通知都跟随 DSH 当前界面语言(初始值来自浏览器语言)。只支持 `en` 和 `zh`, 其他语言回落中文; 切换语言只会替换内置默认值, 不会覆盖用户自定义文本
45
- - **模板化继续文本** — `continueText` 支持 `{code}` `{message}` `{status}` `{tool}` `{turn}` `{errorCount}` `{sessionTitle}` `{elapsed}` 占位符, 续跑消息可携带失败上下文(如「继续 (git push 失败: UPSTREAM)」); 达到 `max-tokens` 时使用**另一套模板**(如「继续输出, 不要重复已生成的内容」)
45
+ - **模板化继续文本** — `continueText` 支持 `{code}` `{message}` `{status}` `{tool}` `{turn}` `{errorCount}` `{elapsed}` 占位符, 续跑消息可携带失败上下文(如「继续 (git push 失败: UPSTREAM)」); 达到 `max-tokens` 时使用**另一套模板**(如「继续输出, 不要重复已生成的内容」)
46
46
  - **幂等护栏** — 续跑前检查上一步工具调用: 结果未确认(回合在工具执行中途夭折, 如 `git push` 可能已经推上去了)时, 续跑消息会提示模型先确认状态、不要重复执行; 工具已确认成功时说明已完成、请勿重复; 工具失败则不加护栏(重试本来就是目的)。两段护栏文本都可配置(支持 `{tool}` / `{result}` 占位符)
47
47
  - **无输出回合续跑** — 已观察到模型步骤或推理回复,但回合正常结束且没有可见输出时自动恢复。没有模型活动的空回合不会触发;文本、工具调用、图片、扩展块和已显示的流式内容均算可见输出。未观察到开始的回合不会被猜测为静默。启动后也能恢复显式的 `no-visible-output` 标记。关闭开关会取消排队中的静默续跑;即使开关关闭,静默回合也不会清零重试上限。
48
48
  - **自主循环** — 默认关闭(`resumeCompletedTurns`)。开启后,正常完成的回合经过宽限期便会续跑,不受恢复冷却和次数上限约束。仅有推理的回合和显式 `no-visible-output` 仍消耗重试预算并遵守退避。全局暂停、会话暂停、手动停止或关闭该选项都会停止循环。自主循环使用单独的提示文本 `continueTextLoop`(默认 `继续`),与循环守卫的提示文本不同。
49
- - **暂停** — 设置卡片里的全局 **暂停自动继续** 开关会停止实时事件与启动扫描触发的自动发送; 会话级暂停(如通过通知按钮)只挂起单个会话, 到期自动恢复。唯一的显式例外是通知里的 **立即续跑** 按钮——按下它等于用户明确要求发送这一次, 不受暂停限制
49
+ - **暂停** — 设置卡片里的全局 **暂停自动继续** 开关会停止实时事件与启动扫描触发的自动发送; 会话级暂停(如通过通知按钮)只挂起单个会话, 到期自动恢复。即使两种暂停同时生效,通知里的 **立即续跑** 仍可发送一次。发送后保留暂停状态,后续自动恢复和自主循环仍受暂停约束
50
50
  - **通知按钮** — 通知带 **立即续跑**(无视冷却、连续上限与暂停, 马上发送)和 **暂停该会话 1 小时** 按钮
51
51
  - **循环守卫** — 连**运行中的回合**也盯着, 四个信号都会触发守卫(取消当前回合并用可配置的循环提示文本重启, 「停止重复, 换一种方式」): 模型**连续输出完全相同的消息**(不限长度, 如 "Let me test variants of the regex…" 连续 7 遍)、单条流式 assistant 消息内部出现连续近似重复段落、短时间内连续多条短句且期间无工具调用(典型的「Let me read…」空转)、或同一工具被连续反复调用且**参数与结果都相同**(参数或结果有变化视为有进展)。取消带有内部来源标记, 绝不会与用户手动停止混淆——只有守卫发起的取消才会重启。阈值、时间窗与提示文本都可配置
52
52
  - **统计面板** — 设置卡片展示今日自动继续次数、恢复成功、继续后失败、永久性跳过、达上限停止、循环打断, 按错误码统计, 可一键清零
@@ -61,10 +61,11 @@
61
61
  | `turn/end` → `max-tokens` | 达到输出 token 上限 |
62
62
  | `turn/end` → `completed` / `no-visible-output` 且无可见输出 | 已观察到模型活动但没有可见输出,或收到显式无输出结束标记 |
63
63
  | `turn/end` → `completed` | 仅在开启自主循环时续跑正常完成的回合 |
64
- | `host/agent-error` | 无回合位置的 Agent 失败(仅网络/超时类消息自动续跑) |
65
64
 
66
65
  **恢复会停止于:**用户手动停止、策略拒绝(`blocked`)、暂停、子代理会话以及连续次数上限。新回合开始或用户手动发送消息会取消待发送的继续提示;实时 `interrupted` 标记交给启动扫描处理。冷却期间出现的可恢复错误会**延后重试,不会直接丢弃**。已有排队消息时,续跑消息先执行,原有消息随后按原顺序处理。循环守卫则可以单独打断并重启正在重复动作的回合。
67
66
 
67
+ 子代理会话由父代理管理。插件会在实时恢复和启动扫描中跳过它们,忽略对它们发起的 **立即续跑**,循环守卫也不会打断它们。识别出子代理会话时,已排队的恢复操作会被取消。
68
+
68
69
  ---
69
70
 
70
71
  ## 工作原理
@@ -254,6 +255,7 @@ auto-continue:
254
255
  ![DSH 0.2 中展开后的自动继续配置](docs/screenshots/02-settings-card.zh.png)
255
256
 
256
257
  - 修改是**暂存式**的——点「保存」之前不会写入磁盘; 有待保存草稿时卡片显示「未保存」徽章, 「放弃」可丢弃草稿
258
+ - 保存期间继续修改或重置字段时,新的草稿会保留在卡片中;等待当前保存结束后,再点一次「保存」即可应用
257
259
  - 改动过的字段会带「已覆盖」徽章, 并有逐字段的「恢复默认」按钮(移除覆盖项,恢复继承值,通常为内置默认值)
258
260
  - 布尔字段是三态:**继承**(用默认)/ 开 / 关
259
261
  - 非法输入(非数字、小于最小值)会阻止保存并给出提示
@@ -310,7 +312,7 @@ auto-continue:
310
312
 
311
313
  匹配项是普通子串, 不是正则表达式。空行会被忽略; 任一行命中后会优先于内置永久错误规则。冷却与最大连续次数仍然生效。
312
314
 
313
- `continueText`(以及 `continueTextMaxTokens`、`continueTextSilent`、`continueTextLoop`)支持占位符 `{code}`、`{message}`、`{status}`、`{tool}`(失败前最后一次工具调用)、`{turn}`、`{errorCount}`(连续失败次数, 含本次)、`{sessionTitle}`(来自会话列表)和 `{elapsed}`(距失败经过的时间, 如 `1m5s`)——例如 `继续 ({tool}: {code})` 会变成 `继续 (git push: UPSTREAM)`。护栏文本支持 `{tool}` 与 `{result}`(上一步工具输出的截断摘要)。
315
+ `continueText`(以及 `continueTextMaxTokens`、`continueTextSilent`、`continueTextLoop`)支持占位符 `{code}`、`{message}`、`{status}`、`{tool}`(失败前最后一次工具调用)、`{turn}`、`{errorCount}`(连续失败次数, 含本次)和 `{elapsed}`(距失败经过的时间, 如 `1m5s`)——例如 `继续 ({tool}: {code})` 会变成 `继续 (git push: UPSTREAM)`。护栏文本支持 `{tool}` 与 `{result}`(上一步工具输出的截断摘要)。当前宿主引擎会将 `{sessionTitle}` 替换为空字符串。
314
316
 
315
317
  ---
316
318
 
@@ -340,9 +342,9 @@ npm test
340
342
  npm run test:runtime
341
343
  ```
342
344
 
343
- `npm test` 覆盖错误恢复、自主循环上限与开关、启动扫描、队列顺序、统计、本地化以及设置界面的生命周期。`npm run test:runtime` 使用已发布的 DSH **0.1.7-rc.2** 和 **0.2.0-rc.1** Settings、Loader、HTTP 组件,并运行真实的 0.2 profile 兼容检查,以及 Cordis 4.0.4 中缺少其中一种设置服务时的客户端激活测试。运行时测试使用受控的 agent 事件,不会向模型服务发送请求。
345
+ `npm test` 覆盖错误恢复、自主循环上限与开关、子会话排除、暂停期间手动续跑、启动扫描、队列顺序、统计、本地化、设置界面生命周期及保存期间继续编辑的情况。`npm run test:runtime` 使用已发布的 DSH **0.1.7-rc.2** 和 **0.2.0-rc.1** Settings、Loader、HTTP 组件,并运行真实的 0.2 profile 兼容检查,以及 Cordis 4.0.4 中缺少其中一种设置服务时的客户端激活测试。运行时测试使用受控的 agent 事件,不会向模型服务发送请求。
344
346
 
345
- `npm run watch` 监听本地代码并重新构建。宿主开启 client HMR 时可以热重载链接的客户端包;否则构建后重启 DSH 并刷新浏览器。
347
+ 修改链接的本地仓库后,运行 `npm run build` 写入最新的 `lib/` 产物,再重启 DSH 并刷新浏览器。开启 client HMR 的宿主可自动重新加载已构建的客户端包。
346
348
 
347
349
  CI 执行类型检查、构建、两组测试、已提交 `lib/` 产物校验及 [dsh-plugin-check](https://github.com/omdsh-dev/dsh-plugin-check),发布也受这些检查约束。更新界面文档时请参考[截图采集说明](docs/screenshots/README.md)。
348
350
 
package/lib/client.js CHANGED
@@ -580,7 +580,7 @@ var CardForm = class {
580
580
  const plan = this.plan();
581
581
  const writes = plan.flatMap((item) => item.run === void 0 ? [] : [item.run]);
582
582
  if (plan.length === 0 || this.saving || writes.length !== plan.length) return;
583
- const fields = new Set(plan.map((item) => item.field));
583
+ const edits = plan.map(({ field, staged }) => ({ field, staged }));
584
584
  this.saving = true;
585
585
  this.failed = false;
586
586
  this.publish();
@@ -589,7 +589,9 @@ var CardForm = class {
589
589
  landed = await write() && landed;
590
590
  }
591
591
  if (landed) {
592
- for (const field of fields) this.staged.delete(field);
592
+ for (const { field, staged } of edits) {
593
+ if (this.staged.get(field) === staged) this.staged.delete(field);
594
+ }
593
595
  }
594
596
  this.saving = false;
595
597
  this.failed = !landed;
@@ -606,14 +608,14 @@ var CardForm = class {
606
608
  for (const [field, staged] of this.staged) {
607
609
  const spec = this.specOf(field);
608
610
  if (staged.clear) {
609
- if (this.stored(field)) plan.push({ field, run: () => this.clear(field) });
611
+ if (this.stored(field)) plan.push({ field, staged, run: () => this.clear(field) });
610
612
  continue;
611
613
  }
612
614
  if (staged.text === spec.format(this.sectionValue(field))) continue;
613
615
  const write = spec.parse(staged.text);
614
- if (write === void 0) plan.push({ field, run: void 0 });
615
- else if (write.kind === "clear") plan.push({ field, run: () => this.clear(field) });
616
- else plan.push({ field, run: () => this.store(field, write.value) });
616
+ if (write === void 0) plan.push({ field, staged, run: void 0 });
617
+ else if (write.kind === "clear") plan.push({ field, staged, run: () => this.clear(field) });
618
+ else plan.push({ field, staged, run: () => this.store(field, write.value) });
617
619
  }
618
620
  return plan;
619
621
  }