dsh-client-auto-continue 0.14.2 → 0.15.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 CHANGED
@@ -78,7 +78,9 @@ Subagent sessions stay under their parent agent's control. The plugin skips them
78
78
 
79
79
  The host-side engine subscribes to the session event firehose inside the dsh host process — one engine shared by every browser tab. On an interruption it waits a **grace period** (default 3 s) — if the host starts a new turn by itself (`turn/start`), the auto-continue is cancelled — then sends the configured text through the agent registry (`agent.followup`, the same queue the Send button uses). When that queue already contains turns, the engine promotes only its newly inserted continuation before the host wakes the agent; it does not remove or reorder the queued user turns.
80
80
 
81
- On host boot it also scans the live sessions: a session whose last turn ended with a non-human reason **within the scan window** (default 15 minutes), with no later `turn/start` or user message, gets resumed automatically too (e.g. the host crashed while the browser was closed — the agent-loop resumes the session and the engine picks it up).
81
+ On host boot it also scans the live sessions: a session whose last turn ended with a non-human reason **within the scan window** (default 15 minutes), with no later `turn/start` or user message, gets resumed automatically too (e.g. the host crashed while the browser was closed — the agent-loop resumes the session and the engine picks it up). Persisted sessions the host never reloaded are enumerated from session storage and materialized into the registry first; a journal that stopped mid-turn is completed with an interrupted marker on read, so restart-orphaned turns are recovered the same way.
82
+
83
+ Storage scanning runs separately from live-session recovery. Each storage read has a five-second timeout, and the scan yields every 16 observations without waiting for the next polling interval. This lets recently interrupted sessions deep in the storage listing be reached within the startup window. Recovery restores the session's preset and recorded model; stopping the plugin cancels pending storage work.
82
84
 
83
85
  Startup recovery isolates failures per session. If history cannot be read or contains invalid events, that session is skipped for the current startup scan and an error is logged; other sessions can still recover, without losing a recovery slot. Invalid entries are not silently removed, since they could hide a manual stop or a newer turn. Valid empty histories and a registry that is still loading remain retryable within the scan window. Reloading a repaired session as a new session object also makes it eligible for scanning again. See [#58](https://github.com/HsiangNianian/dsh-auto-continue/issues/58).
84
86
 
@@ -98,12 +100,13 @@ DSH plugins install into a **profile** (`dsh web` → `web` profile). The comman
98
100
 
99
101
  | DSH runtime | Plugin version | Configuration entry point |
100
102
  | --- | --- | --- |
103
+ | **0.2.1-rc.2** | **0.14.3 verified** | **Plugins → dsh-client-auto-continue** |
101
104
  | **0.2.1-alpha.1** | **0.14.2 verified** | **Plugins → dsh-client-auto-continue** |
102
105
  | **0.2.0-rc.1** | **0.12.1 or newer** | **Plugins → dsh-client-auto-continue** |
103
106
  | **0.1.7-rc.2** | **0.11.9 or newer** | Same Plugins page |
104
107
  | Older hosts with the legacy settings API | Legacy UI retained | **Settings → Plugins → Plugin configuration** |
105
108
 
106
- DSH 0.1.0-rc.6 and earlier are unsupported. Automated settings and compatibility checks cover **0.1.7-rc.2**, **0.2.0-rc.1** and **0.2.1-alpha.1**; startup failure isolation is also checked against **0.2.0-rc.2** and **0.2.1-alpha.1**. Desktop app versions and embedded DSH runtime versions are different; use the runtime version when checking compatibility. For the CLI, run `dsh --version`; see [official DSH releases](https://github.com/deepseek-ai/deepseek-harness/releases) for available versions.
109
+ DSH 0.1.0-rc.6 and earlier are unsupported. Automated settings and compatibility checks cover **0.1.7-rc.2**, **0.2.0-rc.1**, **0.2.1-alpha.1** and **0.2.1-rc.2**; startup failure isolation is also checked against **0.2.0-rc.2** and **0.2.1-alpha.1**. Desktop app versions and embedded DSH runtime versions are different; use the runtime version when checking compatibility. For the CLI, run `dsh --version`; see [official DSH releases](https://github.com/deepseek-ai/deepseek-harness/releases) for available versions.
107
110
 
108
111
  **Plugins 0.11.9 and 0.12.0 are rejected by DSH 0.2.0-rc.1’s version check.** Upgrade the plugin to 0.12.1 or newer; its existing configuration-form integration works on this runtime. See [#50](https://github.com/HsiangNianian/dsh-auto-continue/issues/50).
109
112
 
@@ -210,7 +213,9 @@ On **DSH 0.1.7 / 0.2**, open **Plugins** from the main sidebar, choose **dsh-cli
210
213
 
211
214
  ![Auto-continue category settings on DSH 0.2](docs/screenshots/01-settings-section.png)
212
215
 
213
- Use **General**, **Retry strategy**, **Startup recovery**, **Continue text**, **Safety**, and **Status and logs** to find controls. Switching categories preserves unsaved changes. **Status and logs** contains today's activity and paused sessions.
216
+ Use **General**, **Retry strategy**, **Startup recovery**, **Continue text**, **Safety**, and **Status and logs** to find controls. Switching categories preserves unsaved changes. **Status and logs** contains today's activity, recent recovery attempts and paused sessions.
217
+
218
+ **Recent recovery attempts** groups the last 20 recovery prompts across the host by session, showing each session's count in that window, latest cause, time and consecutive count at the last send. It works with browser notifications off. Causes distinguish silent output, output limits, request errors, restart interruptions, loop-guard recovery and manual resume. Normal autonomous continuations are excluded. These are sent prompts, not proof of completion or a model-health score; repeated recovery is a reason to inspect the conversation and consider a handoff. The history contains no message text and resets when the plugin restarts.
214
219
 
215
220
  The header places the plugin status and GitHub invitation side by side on one shared charcoal background. The status shows the saved global setting; edits take effect when you click **Save**.
216
221
 
@@ -233,6 +238,7 @@ The browser mirrors DSH's active language into the internal `locale` field. Leav
233
238
  resumeCompletedTurns: false
234
239
  continueTextSilent: ''
235
240
  continueTextLoop: ''
241
+ continueTextInterrupted: ''
236
242
  continueTextMaxTokens: ''
237
243
  guardTools: true
238
244
  guardPendingText: ''
@@ -301,6 +307,7 @@ When migrating from the legacy settings file to DSH 0.1.7 / 0.2, move these valu
301
307
  | Continue text (silent turn) | `Continue. Your previous turn ended with internal reasoning only, ...` | Text sent to resume a silent turn (same placeholders) |
302
308
  | Autonomous loop (continue after every turn) | `off` | Continue normal completions after grace, bypassing recovery cooldown/cap; reasoning-only and explicit silent endings still consume the retry budget |
303
309
  | Continue text (autonomous loop) | `Continue` | Text sent on each autonomous-loop resume (same placeholders) |
310
+ | Continue text (harness restart) | `Continue. The harness was restarted while your previous turn was still running; …` | Text sent when the boot scan resumes a session that a harness restart closed mid-turn (same placeholders) |
304
311
  | Idempotency guard | `on` | Inspect the last tool call before resuming and steer the model (see What It Does) |
305
312
  | Loop guard | `on` | Detect a running turn spinning in place and restart it (see What It Does) |
306
313
  | Short-sentence max (chars) | `40` | A model message shorter than this counts as a short sentence (spinning signal) |
@@ -324,6 +331,8 @@ When migrating from the legacy settings file to DSH 0.1.7 / 0.2, move these valu
324
331
  | Max backoff (ms) | `300000` | Cap on the adaptive backoff interval |
325
332
  | Browser notifications | `off` | Notify about auto-continue events and successful settings saves; confirm switching notifications on or off |
326
333
 
334
+ Pausing auto-continue stops automatic follow-ups, but leaves the loop guard active. Disable **Loop guard** too if you want to stop automatic interruptions. Invisible-only text does not count as repeated visible output, and fresh tool calls reset the repeated-message streak; repeated tool calls with identical arguments and results are still checked independently.
335
+
327
336
  For a provider-specific error that is safe to resume (confirm first that manually sending "continue" recovers), add a narrow, stable fragment rather than disabling classification globally:
328
337
 
329
338
  ```yaml
@@ -335,7 +344,7 @@ For a provider-specific error that is safe to resume (confirm first that manuall
335
344
 
336
345
  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.
337
346
 
338
- `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.
347
+ `continueText` (and `continueTextMaxTokens`, `continueTextSilent`, `continueTextLoop`, `continueTextInterrupted`) 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)`. `continueTextInterrupted` is sent when the boot scan resumes a session that a harness restart had closed mid-turn; its default explains the restart and asks the model to verify external state before retrying. The guard texts accept `{tool}` and `{result}` (a truncated excerpt of the last tool output). The host engine currently leaves `{sessionTitle}` empty.
339
348
 
340
349
  ---
341
350
 
@@ -361,6 +370,7 @@ npm ci --prefix tests/fixtures/dsh-0.1.7
361
370
  npm ci --prefix tests/fixtures/dsh-0.2.0
362
371
  npm ci --prefix tests/fixtures/dsh-0.2.0-rc.2
363
372
  npm ci --prefix tests/fixtures/dsh-0.2.1
373
+ npm ci --prefix tests/fixtures/dsh-0.2.1-rc.2
364
374
  npm run typecheck
365
375
  npm run build
366
376
  npm test
@@ -369,6 +379,10 @@ npm run test:runtime
369
379
 
370
380
  `npm test` covers recovery, autonomous-loop limits and toggles, child-session exclusion, manual resume during pauses, startup scanning and malformed-session isolation, 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**, **0.2.0-rc.1** and **0.2.1-alpha.1** Settings, Loader and HTTP services. It also runs the actual 0.2 profile compatibility gate and checks client activation when one settings provider is absent. Startup recovery tests inject session read failures into real **0.2.0-rc.2** and **0.2.1-alpha.1** Session/Cordis/HTTP components and verify that healthy sessions still recover. These controlled faults do not imply that normal DSH loading produces malformed logs. The runtime harness controls agent events; it does not send requests to a model provider.
371
381
 
382
+ The rc.2 check also loads the published client settings service and verifies card save/reset, the composer toggle, locale synchronization and a fresh Host read, using snapshots without the removed `mode` field.
383
+
384
+ The rc.2 restart test uses real agent, query, and JSONL persistence services: it kills a host mid-turn, starts a fresh host without opening the conversation, and checks one recovery with the recorded model and matching prompt variables. The model adapter is deterministic; no external model requests are made.
385
+
372
386
  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.
373
387
 
374
388
  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.
package/README.zh.md CHANGED
@@ -78,7 +78,9 @@
78
78
 
79
79
  宿主侧引擎在 dsh 宿主进程内订阅会话事件 firehose——**多个浏览器标签页共享一个引擎**。检测到中断后先等待一个**宽限期**(默认 3 秒)——若宿主自行开启了新回合(`turn/start`), 自动继续即取消——然后经 agent 注册表(`agent.followup`, 与「发送」按钮同一个排队通道)发送配置的文本。若队列已有消息, 引擎会在宿主唤醒 agent 之前只把本次续跑消息移到队首, 不删除或重排用户消息。
80
80
 
81
- 宿主启动时还会扫描存活会话: 最后一个回合在**扫描时间窗**(默认 15 分钟)内以非人为原因结束、且其后没有新回合或用户消息的会话, 会被自动续跑(例如浏览器关闭期间宿主崩溃——agent-loop 恢复会话后引擎接着接手)。
81
+ 宿主启动时还会扫描存活会话: 最后一个回合在**扫描时间窗**(默认 15 分钟)内以非人为原因结束、且其后没有新回合或用户消息的会话, 会被自动续跑(例如浏览器关闭期间宿主崩溃——agent-loop 恢复会话后引擎接着接手)。宿主未重新加载的持久化会话会先从存储中枚举、物化为注册表里的 live agent; 止于轮次中间的日志在读取时会被补上一条 interrupted 标记, 重启遗留的进行中回合按同一规则恢复。
82
+
83
+ 存储扫描与存活会话恢复独立运行。每次存储读取最多等待 5 秒,每观察 16 个会话让出一次事件循环,无需等待下一次轮询;较早创建但最近中断的会话也能及时被扫描。恢复时保留会话的预设与已记录的模型,卸载插件会取消尚未完成的存储操作。
82
84
 
83
85
  启动恢复按会话隔离异常。历史无法读取或含有无效事件时,只在本次启动扫描中跳过该会话并记录错误,其他会话仍可恢复,也不会被它占用恢复名额。插件不会静默删除损坏记录,以免漏掉人工停止或更新的回合。合法的空历史、尚未就绪的会话注册表仍会在扫描窗口内重试;修复后的会话若重新加载为新的 Session 对象,也可再次参与扫描。详见 [#58](https://github.com/HsiangNianian/dsh-auto-continue/issues/58)。
84
86
 
@@ -98,12 +100,13 @@ DSH 插件安装进 **profile**(`dsh web` 对应 `web` profile)。下面的命
98
100
 
99
101
  | DSH 内核 | 插件版本 | 配置入口 |
100
102
  | --- | --- | --- |
103
+ | **0.2.1-rc.2** | **已验证 0.14.3** | **插件 → dsh-client-auto-continue** |
101
104
  | **0.2.1-alpha.1** | **已验证 0.14.2** | **插件 → dsh-client-auto-continue** |
102
105
  | **0.2.0-rc.1** | **0.12.1 或更新版本** | **插件 → dsh-client-auto-continue** |
103
106
  | **0.1.7-rc.2** | **0.11.9 或更新版本** | 同上,从主侧栏的插件页进入 |
104
107
  | 使用旧设置 API 的宿主 | 保留旧版设置界面兼容 | **设置 → 插件 → 插件配置** |
105
108
 
106
- 不支持 DSH 0.1.0-rc.6 及更早版本。自动化设置与兼容测试覆盖 **0.1.7-rc.2**、**0.2.0-rc.1** 和 **0.2.1-alpha.1**,另在 **0.2.0-rc.2** 和 **0.2.1-alpha.1** 上验证启动扫描的异常隔离。桌面应用版本不等于内置的 DSH 内核版本,请按内核版本判断兼容性;CLI 可运行 `dsh --version`,可用版本见 [DSH 官方 Releases](https://github.com/deepseek-ai/deepseek-harness/releases)。
109
+ 不支持 DSH 0.1.0-rc.6 及更早版本。自动化设置与兼容测试覆盖 **0.1.7-rc.2**、**0.2.0-rc.1**、**0.2.1-alpha.1** 和 **0.2.1-rc.2**,另在 **0.2.0-rc.2** 和 **0.2.1-alpha.1** 上验证启动扫描的异常隔离。桌面应用版本不等于内置的 DSH 内核版本,请按内核版本判断兼容性;CLI 可运行 `dsh --version`,可用版本见 [DSH 官方 Releases](https://github.com/deepseek-ai/deepseek-harness/releases)。
107
110
 
108
111
  **插件 0.11.9 和 0.12.0 会被 DSH 0.2.0-rc.1 的版本检查拦截。** 请升级到 0.12.1 或更新版本;现有配置表单接口可在该内核正常工作。详见 [#50](https://github.com/HsiangNianian/dsh-auto-continue/issues/50)。
109
112
 
@@ -210,7 +213,9 @@ dsh web
210
213
 
211
214
  ![DSH 0.2 中的自动继续分类设置](docs/screenshots/01-settings-section.zh.png)
212
215
 
213
- 通过**常规、重试策略、启动恢复、继续文本、安全保护、状态与日志**查找选项。切换分类会保留未保存的修改;**状态与日志**中可以查看今日统计和已暂停会话。
216
+ 通过**常规、重试策略、启动恢复、继续文本、安全保护、状态与日志**查找选项。切换分类会保留未保存的修改;**状态与日志**中可以查看今日统计、近期恢复尝试和已暂停会话。
217
+
218
+ **近期恢复尝试**按会话汇总宿主最近 20 次恢复提示,展示窗口内次数、最近原因、时间与最近发送时的连续次数,关闭浏览器通知也可查看。原因区分无可见输出、输出上限、请求错误、宿主重启中断、循环守卫恢复与手动续跑,不计正常自主续跑。记录只说明提示已发送,不代表任务完成,也不评估模型健康程度;反复恢复时应检查会话并考虑交接。历史不包含消息正文,重启插件后清空。
214
219
 
215
220
  顶部的插件状态和 GitHub 邀请入口并排显示,共用一整块黑灰色背景。状态展示已保存的全局开关;修改配置后点**保存**才生效。
216
221
 
@@ -233,6 +238,7 @@ DSH 0.1.7 / 0.2 将这些值保存在当前 profile patch 的 `auto-continue`
233
238
  resumeCompletedTurns: false
234
239
  continueTextSilent: ''
235
240
  continueTextLoop: ''
241
+ continueTextInterrupted: ''
236
242
  continueTextMaxTokens: ''
237
243
  guardTools: true
238
244
  guardPendingText: ''
@@ -301,6 +307,7 @@ auto-continue:
301
307
  | 无输出回合的继续文本 | `继续。你上一轮只输出了内部推理, ...` | 续跑无输出回合时发送的文本(支持相同占位符) |
302
308
  | 自主循环(每个回合后都续跑) | 关 | 正常完成后经过宽限期续跑,不受恢复冷却和上限限制;仅有推理和显式无输出结束仍消耗重试预算 |
303
309
  | 自主循环的继续文本 | `继续` | 自主循环续跑时发送的文本(支持相同占位符) |
310
+ | 宿主重启后恢复的继续文本 | `继续。宿主在你上一轮运行期间重启了; …` | 启动扫描恢复被重启中断的会话时发送的文本(支持相同占位符) |
304
311
  | 幂等护栏 | 开 | 续跑前检查上一步工具调用并给出指引(见「它做什么」) |
305
312
  | 循环守卫 | 开 | 检测运行中的回合空转并重启(见「它做什么」) |
306
313
  | 短句长度上限 (字符) | `40` | 模型消息文本短于该值计为一条短句(空转信号) |
@@ -324,6 +331,8 @@ auto-continue:
324
331
  | 最大退避间隔 (ms) | `300000` | 自适应退避的上限 |
325
332
  | 浏览器通知 | 关 | 自动继续事件和配置保存成功时通知;切换通知开关并保存后确认状态 |
326
333
 
334
+ 暂停自动继续会停止自动续跑,但循环守卫仍独立运行。如需停止自动打断,请同时关闭**循环守卫**。仅含不可见字符的正文不计入可见消息复读;新的工具调用会重置正文重复计数,而同工具、同参数、同结果的工具死循环仍独立检测。
335
+
327
336
  遇到确认可以安全续跑的 provider 专属错误时(先确认手动发送「继续」确实能恢复), 应添加足够具体、稳定的片段, 而不是全局关闭错误分类:
328
337
 
329
338
  ```yaml
@@ -335,7 +344,7 @@ auto-continue:
335
344
 
336
345
  匹配项是普通子串, 不是正则表达式。空行会被忽略; 任一行命中后会优先于内置永久错误规则。冷却与最大连续次数仍然生效。
337
346
 
338
- `continueText`(以及 `continueTextMaxTokens`、`continueTextSilent`、`continueTextLoop`)支持占位符 `{code}`、`{message}`、`{status}`、`{tool}`(失败前最后一次工具调用)、`{turn}`、`{errorCount}`(连续失败次数, 含本次)和 `{elapsed}`(距失败经过的时间, 如 `1m5s`)——例如 `继续 ({tool}: {code})` 会变成 `继续 (git push: UPSTREAM)`。护栏文本支持 `{tool}` 与 `{result}`(上一步工具输出的截断摘要)。当前宿主引擎会将 `{sessionTitle}` 替换为空字符串。
347
+ `continueText`(以及 `continueTextMaxTokens`、`continueTextSilent`、`continueTextLoop`、`continueTextInterrupted`)支持占位符 `{code}`、`{message}`、`{status}`、`{tool}`(失败前最后一次工具调用)、`{turn}`、`{errorCount}`(连续失败次数, 含本次)和 `{elapsed}`(距失败经过的时间, 如 `1m5s`)——例如 `继续 ({tool}: {code})` 会变成 `继续 (git push: UPSTREAM)`。`continueTextInterrupted` 在启动扫描恢复被宿主重启中断的会话时发送, 默认文本会说明重启并要求先核实外部状态再重试。护栏文本支持 `{tool}` 与 `{result}`(上一步工具输出的截断摘要)。当前宿主引擎会将 `{sessionTitle}` 替换为空字符串。
339
348
 
340
349
  ---
341
350
 
@@ -361,6 +370,7 @@ npm ci --prefix tests/fixtures/dsh-0.1.7
361
370
  npm ci --prefix tests/fixtures/dsh-0.2.0
362
371
  npm ci --prefix tests/fixtures/dsh-0.2.0-rc.2
363
372
  npm ci --prefix tests/fixtures/dsh-0.2.1
373
+ npm ci --prefix tests/fixtures/dsh-0.2.1-rc.2
364
374
  npm run typecheck
365
375
  npm run build
366
376
  npm test
@@ -369,6 +379,10 @@ npm run test:runtime
369
379
 
370
380
  `npm test` 覆盖错误恢复、自主循环上限与开关、子会话排除、暂停期间手动续跑、启动扫描及畸形会话隔离、队列顺序、统计、本地化、设置界面生命周期及保存期间继续编辑的情况。`npm run test:runtime` 使用已发布的 DSH **0.1.7-rc.2**、**0.2.0-rc.1** 和 **0.2.1-alpha.1** Settings、Loader、HTTP 组件,并运行真实的 0.2 profile 兼容检查及缺少其中一种设置服务时的客户端激活测试。启动恢复测试在真实的 **0.2.0-rc.2** 和 **0.2.1-alpha.1** Session、Cordis、HTTP 组件中注入会话读取故障,验证健康会话仍能恢复;这不代表正常的 DSH 加载流程会产生损坏日志。运行时测试使用受控的 agent 事件,不会向模型服务发送请求。
371
381
 
382
+ rc.2 测试还加载已发布的客户端设置服务,使用不再包含 `mode` 的真实快照,验证卡片保存/重置、会话开关、语言同步与重新读取宿主配置。
383
+
384
+ rc.2 重启测试使用真实的 agent、query 与 JSONL 持久化服务:在回合中强制结束宿主,启动新宿主且不打开会话,验证仅恢复一次,并沿用已记录的模型与对应提示变量。模型适配器使用确定性响应,不发送外部模型请求。
385
+
372
386
  修改链接的本地仓库后,运行 `npm run build` 写入最新的 `lib/` 产物,再重启 DSH 并刷新浏览器。开启 client HMR 的宿主可自动重新加载已构建的客户端包。
373
387
 
374
388
  CI 执行类型检查、构建、两组测试、已提交 `lib/` 产物校验及 [dsh-plugin-check](https://github.com/omdsh-dev/dsh-plugin-check),发布也受这些检查约束。更新界面文档时请参考[截图采集说明](docs/screenshots/README.md)。
package/lib/client.js CHANGED
@@ -29,6 +29,7 @@ __export(index_exports, {
29
29
  apply: () => apply,
30
30
  inject: () => inject,
31
31
  pausedSessions: () => pausedSessions,
32
+ readRecoveryAttempts: () => readRecoveryAttempts,
32
33
  readTodayStats: () => readTodayStats,
33
34
  resetTodayStats: () => resetTodayStats,
34
35
  unpauseSession: () => unpauseSession
@@ -42,6 +43,7 @@ var LOCALIZED_TEXT_DEFAULTS = {
42
43
  continueTextMaxTokens: "继续",
43
44
  continueTextSilent: "继续。你上一轮只输出了内部推理, 既没有回复也没有调用工具, 用户什么都没看到。每一轮都要以工具调用或可见回复结束。",
44
45
  continueTextLoop: "继续",
46
+ continueTextInterrupted: "继续。宿主在你上一轮运行期间重启了; 重启时未完成的工具调用已按「结果未知」收尾。从中断处继续, 重试可能有副作用的操作前先核实外部状态。",
45
47
  guardPendingText: "(上一步工具「{tool}」可能未完成, 先确认状态再继续, 不要重复执行)",
46
48
  guardDoneText: "(上一步工具「{tool}」已完成, 结果: {result}; 不要重复执行, 直接继续)",
47
49
  loopText: "(检测到你可能陷入循环, 请停止重复刚才的动作, 换一种方式继续)"
@@ -51,6 +53,7 @@ var LOCALIZED_TEXT_DEFAULTS = {
51
53
  continueTextMaxTokens: "Continue",
52
54
  continueTextSilent: "Continue. Your previous turn ended with internal reasoning only, with no message and no tool call, so nothing reached the user. Always finish a turn with a tool call or a visible answer.",
53
55
  continueTextLoop: "Continue",
56
+ continueTextInterrupted: "Continue. The harness was restarted while your previous turn was still running; tool calls pending at the restart are recorded with unknown outcomes. Resume where you left off, verifying external state before retrying anything that may have side effects.",
54
57
  guardPendingText: '(The previous tool "{tool}" may not have completed. Check its state before continuing and do not run it again.)',
55
58
  guardDoneText: '(The previous tool "{tool}" completed successfully. Result: {result}; do not run it again. Continue from there.)',
56
59
  loopText: "(You may be stuck in a loop. Stop repeating the last action and continue with a different approach.)"
@@ -125,7 +128,7 @@ var zh = {
125
128
  "composer.scope": "控制当前配置下所有会话的自动继续,修改立即保存。",
126
129
  "composer.saving": "正在保存自动继续设置…",
127
130
  "composer.saveFailed": "保存失败,请重试",
128
- "field.pausedHint": "恢复意外中断的会话。关闭并保存后,全局暂停恢复并取消已排队的继续。",
131
+ "field.pausedHint": "恢复意外中断的会话。关闭并保存后,全局暂停恢复并取消已排队的继续。循环守卫独立运行;如需停止自动打断,请同时关闭循环守卫。",
129
132
  "field.continueText": "继续文本",
130
133
  "field.continueTextHint": "中断后自动发送的消息内容。",
131
134
  "default.continueText": LOCALIZED_TEXT_DEFAULTS.zh.continueText,
@@ -142,6 +145,9 @@ var zh = {
142
145
  "field.continueTextSilent": "无输出回合的继续文本",
143
146
  "field.continueTextSilentHint": "回合只输出推理就结束时自动发送的文本, 支持与继续文本相同的占位符。",
144
147
  "default.continueTextSilent": LOCALIZED_TEXT_DEFAULTS.zh.continueTextSilent,
148
+ "field.continueTextInterrupted": "宿主重启后恢复的继续文本",
149
+ "field.continueTextInterruptedHint": "启动扫描恢复重启中断的会话时发送的文本, 默认说明重启并提醒先核实再重试。",
150
+ "default.continueTextInterrupted": LOCALIZED_TEXT_DEFAULTS.zh.continueTextInterrupted,
145
151
  "field.guardTools": "幂等护栏",
146
152
  "field.guardToolsHint": "续跑前检查上一步工具调用: 结果未确认时提示先确认状态, 已成功时提示不要重复执行, 避免重复 commit/调 API。",
147
153
  "field.guardPendingText": "结果未确认时的护栏文本",
@@ -157,7 +163,7 @@ var zh = {
157
163
  "field.maxConsecutive": "最大连续次数",
158
164
  "field.maxConsecutiveHint": "连续恢复尝试上限;用户介入或观察到有可见输出的成功回合后清零。正常完成后的自主循环接力不计入。",
159
165
  "field.scanOnBoot": "启动恢复扫描",
160
- "field.scanOnBootHint": "宿主启动后在扫描时间窗内等待延迟加载的中断会话,每个已就绪会话只检查一次。",
166
+ "field.scanOnBootHint": "宿主启动后在扫描时间窗内等待延迟加载的中断会话,未重新加载的持久化会话也会被物化一并检查,每个已就绪会话只检查一次。",
161
167
  "field.scanLimit": "扫描会话数",
162
168
  "field.scanLimitHint": "每次扫描最多恢复多少个符合条件的会话,优先最近活动的会话。",
163
169
  "field.freshMs": "扫描时间窗 (ms)",
@@ -200,6 +206,18 @@ var zh = {
200
206
  "stats.byCode": "按错误码统计",
201
207
  "stats.empty": "今天还没有自动继续记录。",
202
208
  "stats.reset": "清零",
209
+ "recovery.title": "近期恢复尝试",
210
+ "recovery.hint": "按会话汇总宿主最近 20 次恢复提示,重启插件后清空。正常自主续跑不计入。提示已发送不代表任务已完成;若反复恢复,请检查会话并考虑交接到新会话。",
211
+ "recovery.empty": "尚无恢复尝试。",
212
+ "recovery.count": "窗口内尝试",
213
+ "recovery.consecutive": "最近发送时连续次数",
214
+ "recovery.latest": "最近原因",
215
+ "recovery.reason.error": "请求错误",
216
+ "recovery.reason.max-tokens": "输出上限",
217
+ "recovery.reason.silent": "无可见输出",
218
+ "recovery.reason.interrupted": "宿主重启中断",
219
+ "recovery.reason.loop-guard": "循环守卫",
220
+ "recovery.reason.manual": "手动立即续跑",
203
221
  "pause.title": "已暂停会话",
204
222
  "pause.none": "没有暂停中的会话。",
205
223
  "pause.clearAll": "全部解除",
@@ -257,7 +275,7 @@ var en = {
257
275
  "composer.scope": "Controls auto-continue for all sessions in this profile. Changes save immediately.",
258
276
  "composer.saving": "Saving auto-continue setting…",
259
277
  "composer.saveFailed": "Could not save. Try again.",
260
- "field.pausedHint": "Resume interrupted sessions. Turn off and save to pause recovery globally and cancel queued continuations.",
278
+ "field.pausedHint": "Resume interrupted sessions. Turn off and save to pause recovery globally and cancel queued continuations. The loop guard stays active; turn it off separately to stop automatic interruptions.",
261
279
  "field.continueText": "Continue text",
262
280
  "field.continueTextHint": "Message automatically sent after an interruption.",
263
281
  "default.continueText": LOCALIZED_TEXT_DEFAULTS.en.continueText,
@@ -274,6 +292,9 @@ var en = {
274
292
  "field.continueTextSilent": "Continue text (silent turn)",
275
293
  "field.continueTextSilentHint": "Text sent when a turn ends with reasoning only; same placeholders as the continue text.",
276
294
  "default.continueTextSilent": LOCALIZED_TEXT_DEFAULTS.en.continueTextSilent,
295
+ "field.continueTextInterrupted": "Continue text (after harness restart)",
296
+ "field.continueTextInterruptedHint": "Text sent when the boot scan resumes a session interrupted by a restart; the default explains the restart and asks to verify before retrying.",
297
+ "default.continueTextInterrupted": LOCALIZED_TEXT_DEFAULTS.en.continueTextInterrupted,
277
298
  "field.guardTools": "Idempotency guard",
278
299
  "field.guardToolsHint": "Before resuming, inspect the last tool call: if its result is unconfirmed, tell the model to check state first; if it succeeded, tell it not to rerun — avoids duplicate commits / API calls.",
279
300
  "field.guardPendingText": "Guard text (unconfirmed result)",
@@ -289,7 +310,7 @@ var en = {
289
310
  "field.maxConsecutive": "Max consecutive",
290
311
  "field.maxConsecutiveHint": "Consecutive recovery-attempt cap; resets on user intervention or an observed completion with visible output. Normal autonomous-loop handoffs are exempt.",
291
312
  "field.scanOnBoot": "Scan on host startup",
292
- "field.scanOnBootHint": "Wait for delayed interrupted sessions during the startup scan window; inspect each settled session once.",
313
+ "field.scanOnBootHint": "Wait for delayed interrupted sessions during the startup scan window; persisted sessions the host never reloaded are materialized and inspected too; each settled session is inspected once.",
293
314
  "field.scanLimit": "Scan limit",
294
315
  "field.scanLimitHint": "Maximum eligible sessions to recover per pass, most recently active first.",
295
316
  "field.freshMs": "Scan window (ms)",
@@ -332,6 +353,18 @@ var en = {
332
353
  "stats.byCode": "By error code",
333
354
  "stats.empty": "No auto-continue activity today.",
334
355
  "stats.reset": "Reset",
356
+ "recovery.title": "Recent recovery attempts",
357
+ "recovery.hint": "Per-session counts from the last 20 recovery prompts across this host, cleared when the plugin restarts. Normal autonomous continuations are excluded. A sent prompt does not mean the task finished. If recovery keeps repeating, review the conversation and consider handing off to a fresh session.",
358
+ "recovery.empty": "No recovery attempts yet.",
359
+ "recovery.count": "Attempts in window",
360
+ "recovery.consecutive": "Consecutive at last send",
361
+ "recovery.latest": "Latest reason",
362
+ "recovery.reason.error": "Request error",
363
+ "recovery.reason.max-tokens": "Output limit",
364
+ "recovery.reason.silent": "No visible output",
365
+ "recovery.reason.interrupted": "Host restart interruption",
366
+ "recovery.reason.loop-guard": "Loop guard",
367
+ "recovery.reason.manual": "Manual resume",
335
368
  "pause.title": "Paused sessions",
336
369
  "pause.none": "No sessions paused.",
337
370
  "pause.clearAll": "Clear all",
@@ -407,7 +440,7 @@ var EMPTY_STATS = {
407
440
  looped: 0,
408
441
  byCode: {}
409
442
  };
410
- var state = { stats: EMPTY_STATS, paused: [] };
443
+ var state = { stats: EMPTY_STATS, paused: [], recoveryAttempts: [] };
411
444
  var listeners = /* @__PURE__ */ new Set();
412
445
  function pausedSessions() {
413
446
  return state.paused;
@@ -415,6 +448,9 @@ function pausedSessions() {
415
448
  function readTodayStats() {
416
449
  return state.stats;
417
450
  }
451
+ function readRecoveryAttempts() {
452
+ return state.recoveryAttempts;
453
+ }
418
454
  function resetTodayStats() {
419
455
  void postAction({ action: "reset-stats" });
420
456
  }
@@ -441,7 +477,8 @@ function handleEvent(event) {
441
477
  if (event.type === "state") {
442
478
  state = {
443
479
  stats: event.stats ?? EMPTY_STATS,
444
- paused: event.paused ?? []
480
+ paused: event.paused ?? [],
481
+ recoveryAttempts: event.recoveryAttempts ?? []
445
482
  };
446
483
  for (const listener of listeners) listener();
447
484
  } else if (event.type === "notice" && event.notice !== void 0) {
@@ -526,6 +563,9 @@ function startBridge() {
526
563
  }
527
564
 
528
565
  // src/client/settings-form.ts
566
+ function canWriteSettings(snapshot) {
567
+ return snapshot.status === "ready" && snapshot.writable && (snapshot.mode === void 0 || snapshot.mode === "host");
568
+ }
529
569
  function numberField(field, min = 0) {
530
570
  return {
531
571
  field,
@@ -592,7 +632,7 @@ var CardForm = class {
592
632
  const snapshot = this.scope.getSnapshot();
593
633
  return {
594
634
  available: snapshot.status === "ready",
595
- writable: snapshot.writable,
635
+ writable: canWriteSettings(snapshot),
596
636
  dirty: this.plan().length > 0,
597
637
  invalid: this.plan().some((item) => item.run === void 0),
598
638
  saving: this.saving,
@@ -641,7 +681,7 @@ var CardForm = class {
641
681
  const plan = this.plan();
642
682
  const writes = plan.flatMap((item) => item.run === void 0 ? [] : [item.run]);
643
683
  const snapshot = this.scope.getSnapshot();
644
- if (plan.length === 0 || this.saving || writes.length !== plan.length || snapshot.status !== "ready" || !snapshot.writable || snapshot.mode !== "host") return false;
684
+ if (plan.length === 0 || this.saving || writes.length !== plan.length || !canWriteSettings(snapshot)) return false;
645
685
  const edits = plan.map(({ field, staged }) => ({ field, staged }));
646
686
  this.saving = true;
647
687
  this.failed = false;
@@ -822,6 +862,7 @@ var css = `
822
862
  .dshAcPauseList { list-style: none; margin: 0; padding: 0; }
823
863
  .dshAcPauseList li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
824
864
  .dshAcPauseId { flex: 1; font: 12px ui-monospace, SFMono-Regular, monospace; }
865
+ .dshAcRecovery { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
825
866
  @container auto-continue-settings (max-width: 760px) {
826
867
  .dshAcHeaderFrame { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
827
868
  .dshAcRepositoryCopy { display: none; }
@@ -925,6 +966,7 @@ var AutoContinueSettingsCardController = class {
925
966
  booleanField("resumeCompletedTurns"),
926
967
  textField("continueTextLoop"),
927
968
  textField("continueTextSilent"),
969
+ textField("continueTextInterrupted"),
928
970
  booleanField("guardTools"),
929
971
  textField("guardPendingText"),
930
972
  textField("guardDoneText"),
@@ -964,6 +1006,7 @@ var AutoContinueSettingsCardController = class {
964
1006
  resumeCompletedTurns: this.form.field("resumeCompletedTurns"),
965
1007
  continueTextLoop: this.form.field("continueTextLoop"),
966
1008
  continueTextSilent: this.form.field("continueTextSilent"),
1009
+ continueTextInterrupted: this.form.field("continueTextInterrupted"),
967
1010
  guardTools: this.form.field("guardTools"),
968
1011
  guardPendingText: this.form.field("guardPendingText"),
969
1012
  guardDoneText: this.form.field("guardDoneText"),
@@ -998,7 +1041,7 @@ var AutoContinueSettingsCardController = class {
998
1041
  async save() {
999
1042
  const state2 = this.form.shell();
1000
1043
  const snapshot = this.scope.getSnapshot();
1001
- if (this.disposed || !state2.available || !state2.writable || !state2.dirty || state2.invalid || state2.saving || snapshot.mode !== "host") return;
1044
+ if (this.disposed || !state2.available || !state2.writable || !state2.dirty || state2.invalid || state2.saving) return;
1002
1045
  const sequence = ++this.saveSequence;
1003
1046
  const before = snapshot.value?.notify ?? DEFAULT_CONFIG.notify;
1004
1047
  const target = this.form.field("notify").text;
@@ -1020,7 +1063,7 @@ var AutoContinueSettingsCardController = class {
1020
1063
  return {
1021
1064
  visible: snapshot.status === "ready" && (snapshot.value?.showComposerToggle ?? DEFAULT_CONFIG.showComposerToggle),
1022
1065
  enabled: !(snapshot.value?.paused ?? DEFAULT_CONFIG.paused),
1023
- writable: snapshot.status === "ready" && snapshot.writable && snapshot.mode === "host",
1066
+ writable: canWriteSettings(snapshot),
1024
1067
  saving: this.composerSaving,
1025
1068
  failed: this.composerFailed
1026
1069
  };
@@ -1054,7 +1097,7 @@ var groups = [
1054
1097
  { id: "general", fields: ["paused", "showComposerToggle", "resumeSilentTurns", "resumeCompletedTurns", "notify"] },
1055
1098
  { id: "recovery", fields: ["graceMs", "cooldownMs", "maxConsecutive", "classify", "retryableErrorPatterns", "backoffFactor", "backoffMaxMs"] },
1056
1099
  { id: "startup", fields: ["scanOnBoot", "scanLimit", "freshMs"] },
1057
- { id: "prompts", fields: ["continueText", "continueTextMaxTokens", "continueTextSilent", "continueTextLoop", "guardPendingText", "guardDoneText", "loopText"] },
1100
+ { id: "prompts", fields: ["continueText", "continueTextMaxTokens", "continueTextSilent", "continueTextInterrupted", "continueTextLoop", "guardPendingText", "guardDoneText", "loopText"] },
1058
1101
  { id: "safety", fields: ["guardTools", "loopGuard", "loopShortChars", "loopWindowMs", "loopShortCount", "loopRepeatText", "loopToolRepeat"] },
1059
1102
  { id: "status", fields: ["verbose"] }
1060
1103
  ];
@@ -1063,6 +1106,7 @@ var textDefaults = {
1063
1106
  continueTextMaxTokens: "default.continueTextMaxTokens",
1064
1107
  continueTextSilent: "default.continueTextSilent",
1065
1108
  continueTextLoop: "default.continueTextLoop",
1109
+ continueTextInterrupted: "default.continueTextInterrupted",
1066
1110
  guardPendingText: "default.guardPendingText",
1067
1111
  guardDoneText: "default.guardDoneText",
1068
1112
  loopText: "default.loopText"
@@ -1129,6 +1173,8 @@ function LivePanels(props) {
1129
1173
  const hasStats = stats.sent + stats.skipped + stats.recovered + stats.failed + stats.gaveUp + stats.looped > 0;
1130
1174
  const codes = Object.entries(stats.byCode).sort((a, b) => b[1] - a[1]).slice(0, 5);
1131
1175
  const paused = pausedSessions();
1176
+ const attempts = readRecoveryAttempts();
1177
+ const sessions = [...new Set(attempts.map((attempt) => attempt.sessionId))];
1132
1178
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1133
1179
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "dshAcPanel", children: [
1134
1180
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcPanelHead", children: [
@@ -1186,6 +1232,32 @@ function LivePanels(props) {
1186
1232
  ] }) : null
1187
1233
  ] })
1188
1234
  ] }),
1235
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "dshAcPanel", children: [
1236
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dshAcPanelHead", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcPanelTitle", children: t("recovery.title") }) }),
1237
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dshAcHint", children: t("recovery.hint") }),
1238
+ sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dshAcHint", children: t("recovery.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "dshAcPauseList", children: sessions.map((sessionId) => {
1239
+ const recent = attempts.filter((attempt) => attempt.sessionId === sessionId);
1240
+ const latest = recent[0];
1241
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcRecovery", children: [
1242
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcPauseId", children: sessionId }),
1243
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
1244
+ t("recovery.count"),
1245
+ ": ",
1246
+ recent.length,
1247
+ " · ",
1248
+ t("recovery.consecutive"),
1249
+ ": ",
1250
+ latest.consecutive
1251
+ ] }),
1252
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
1253
+ t("recovery.latest"),
1254
+ ": ",
1255
+ t(`recovery.reason.${latest.reason}`)
1256
+ ] }),
1257
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("time", { className: "dshAcHint", dateTime: new Date(latest.at).toISOString(), children: new Date(latest.at).toLocaleString() })
1258
+ ] }) }, sessionId);
1259
+ }) })
1260
+ ] }),
1189
1261
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "dshAcPanel", children: [
1190
1262
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dshAcPanelHead", children: [
1191
1263
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dshAcPanelTitle", children: t("pause.title") }),
@@ -1344,7 +1416,7 @@ function mountSettings(ctx, scope) {
1344
1416
  const syncLocale = () => {
1345
1417
  const active = ctx.locale.getLocale().active;
1346
1418
  const snapshot = scope.getSnapshot();
1347
- if (snapshot.status !== "ready" || !snapshot.writable || snapshot.mode !== "host") return;
1419
+ if (!canWriteSettings(snapshot)) return;
1348
1420
  if (mirroredLocale !== active) {
1349
1421
  mirroredLocale = active;
1350
1422
  mirrorAttempts = 0;