dsh-client-auto-continue 0.11.9 → 0.12.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
@@ -8,7 +8,7 @@
8
8
  <h1 align="center">dsh-auto-continue</h1>
9
9
 
10
10
  <p align="center">
11
- <em>DSH Web UI plugin — when a request is interrupted by a network error or any other non-human cause, it automatically sends “Continue” for you.</em>
11
+ <em>Recover interrupted DSH sessions automatically, with an optional loop to continue after successful turns.</em>
12
12
  </p>
13
13
 
14
14
  <p align="center">
@@ -33,7 +33,7 @@
33
33
 
34
34
  ## What It Does
35
35
 
36
- For [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh web`): whenever a request in the web GUI gets interrupted by a **non-human cause**, the plugin simulates the user typing **“Continue”** and sends it, so the agent keeps working without manual intervention. The message enters the session log exactly like a manual prompt — the model sees it, and the interrupted work resumes. Since 0.8.0 the engine runs **inside the host process** (single instance), so it keeps watching even with every browser tab closed, and multiple open tabs can never double-send.
36
+ Automatic recovery for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), in the Web UI and desktop app. When a recoverable failure interrupts a session, the plugin sends your configured continuation prompt through DSH. The engine runs **inside the host process**, so it keeps watching while browser tabs are closed; all tabs share that engine. Recovery is enabled by default. Continuing after successful turns is a separate, **opt-in autonomous loop**.
37
37
 
38
38
  ![demo](docs/demo.svg)
39
39
 
@@ -45,7 +45,8 @@ For [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh we
45
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")
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
- - **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. The **Resume now** notification button is the one explicit exception: pressing it is the user asking for exactly one send, pause or not
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
50
  - **Notification buttons** — notifications carry **Resume now** (send immediately, ignoring cooldown, the consecutive cap and any pause) and **Pause this session 1h** actions
50
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
51
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
@@ -58,16 +59,17 @@ It watches the live event streams and reacts to:
58
59
  | `turn/end` → `error` | Turn failed (model / network / timeout, …) |
59
60
  | `turn/end` → `interrupted` | Crash-orphaned turn left behind by a host restart (recovered by the startup scan) |
60
61
  | `turn/end` → `max-tokens` | Output token ceiling reached |
61
- | `turn/end` → `completed` / `no-visible-output` with no visible output | Turn ended normally with reasoning only: no text, no tool call |
62
+ | `turn/end` → `completed` / `no-visible-output` with no visible output | Observed model activity without visible output, or an explicit silent-ending marker |
63
+ | `turn/end` → `completed` | Continue a normal completion only when autonomous loop is enabled |
62
64
  | `host/agent-error` | Agent failure with no turn position (only network/timeout-class messages auto-resume) |
63
65
 
64
- **Never auto-continues:** user-aborted turns (`aborted`) or policy rejections (`blocked`); live `interrupted` turn-ends too — that marker is only written by crash repair when the host reloads, so orphaned turns are recovered by the startup scan, not the live path; sessions the host already resumed itself; running sessions; subagent sessions; anything inside the cooldown / consecutive-cap windows (configurable in the settings card, below). If an interrupted session already has queued turns, the continuation runs first and the existing turns retain their order behind it.
66
+ **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.
65
67
 
66
68
  ---
67
69
 
68
70
  ## How It Works
69
71
 
70
- The host-side engine subscribes to the session event firehose inside the dsh host process — exactly one engine, regardless of how many tabs are open (the duplicate-send class of bugs cannot exist by construction). 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.
72
+ 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.
71
73
 
72
74
  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).
73
75
 
@@ -81,23 +83,35 @@ The diagram summarizes the automatic recovery path, the loop-guard restart path,
81
83
 
82
84
  ## Quick Start
83
85
 
84
- DSH plugins install into a **profile** (`dsh web` → `web` profile). Install, restart `dsh web`, done.
86
+ DSH plugins install into a **profile** (`dsh web` → `web` profile). The commands below install into the web profile; restart `dsh web` after installation. In the desktop app, install through its **Plugins** page instead.
85
87
 
86
- > **Use the latest DSH (recommended: 0.1.2-alpha.4 or newer).** Run `dsh --version` before installing. Plugin v0.11.1 supports the settings API used by DSH 0.1.2-alpha.2+ (including alpha.3 and alpha.4) while retaining compatibility with DSH 0.1.0-rc.7 through 0.1.1; rc.6 and earlier remain unsupported (`list slot ... requires options.id`). Preview releases may appear on the [official DSH releases page](https://github.com/deepseek-ai/deepseek-harness/releases) before the public npm tag catches up.
88
+ ### Compatibility
87
89
 
88
- Plugin v0.11.9 drops the host engine's dependency on the legacy `settings` register/get namespace: entry config is injected directly via `apply(ctx, config)` and merged with schema defaults, fixing the host-half startup failure on the newer settings API (the client's `configForms` support is unchanged).
90
+ | DSH runtime | Plugin version | Configuration entry point |
91
+ | --- | --- | --- |
92
+ | **0.2.0-rc.1** | **0.12.1 or newer** | **Plugins → dsh-client-auto-continue → Auto continue** |
93
+ | **0.1.7-rc.2** | **0.11.9 or newer** | Same Plugins page |
94
+ | Older hosts with the legacy settings API | Legacy UI retained | **Settings → Plugins → Plugin configuration** |
95
+
96
+ DSH 0.1.0-rc.6 and earlier are unsupported. Automated runtime checks cover **0.1.7-rc.2** and **0.2.0-rc.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.
89
97
 
90
- Plugin v0.11.8 also supports DSH 0.1.7-alpha.2's `configForms` API. Open **Plugins → dsh-client-auto-continue** for its settings; older DSH versions retain **Settings → Plugins**. This fixes the startup error `pending (waiting for service: settingsScope)` on the newer API.
98
+ **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).
99
+
100
+ On current DSH, **Settings → Built-in plugins** is a component inventory, not the configuration editor. Use the main **Plugins** page. The screenshots below use **DSH 0.2.0-rc.1 + plugin 0.12.1**. If you previously installed with a symlink or hand-written loader entry, see [Migrating an older installation](#migrating-an-older-installation).
91
101
 
92
102
  ### From npm (recommended)
93
103
 
94
104
  Published as [`dsh-client-auto-continue`](https://www.npmjs.com/package/dsh-client-auto-continue):
95
105
 
96
106
  ```bash
97
- dsh plugin --profile web add dsh-client-auto-continue
107
+ dsh plugin --profile web add dsh-client-auto-continue@latest
98
108
  dsh web
99
109
  ```
100
110
 
111
+ ### Updating an installed plugin
112
+
113
+ Let active work finish and stop DSH. Run the npm command above again to replace the installed version with `@latest`, then restart DSH and reload the browser. Existing configuration overrides remain in the profile. For a desktop installation, update the plugin from that app’s **Plugins** page and restart the app; updating the CLI’s `web` profile does not update the desktop profile.
114
+
101
115
  ### Directly from GitHub (no clone needed)
102
116
 
103
117
  Installs straight from the repository's default branch — built artifacts are committed, so no local clone or build step:
@@ -111,107 +125,148 @@ dsh web
111
125
 
112
126
  ### From this repository
113
127
 
114
- Requires Node.js ≥ 18.
128
+ Use Node.js 22, the version used by CI.
115
129
 
116
130
  ```bash
117
131
  git clone https://github.com/HsiangNianian/dsh-auto-continue.git
118
132
  cd dsh-auto-continue
119
- npm install
133
+ npm ci
120
134
  npm run build
121
135
 
122
136
  # the package carries its own cordis.patch.yml (dsh.bundle.patch),
123
137
  # so the plugin row registers itself
124
- dsh plugin --profile web add link:$(pwd)
138
+ dsh plugin --profile web add "link:$(pwd)"
125
139
 
126
140
  dsh web
127
141
  ```
128
142
 
129
- ### Manual (no pnpm / dsh plugin needed)
143
+ ### Migrating an older installation
130
144
 
131
- ```bash
132
- ln -sfn "$(pwd)" ~/.dsh/profiles/node_modules/dsh-client-auto-continue
133
- # then append to ~/.dsh/profiles/web/cordis.patch.yml:
134
- # - insert:
135
- # - id: auto-continue
136
- # name: 'dsh-client-auto-continue'
137
- dsh web
138
- ```
145
+ A manual loader entry can start the engine without registering a bundle in the **Plugins** page. Use the profile's package manager to install the bundle; a symlink and `insert` entry alone are no longer the recommended setup.
139
146
 
140
- > Switching from a manual install to `dsh plugin add`? Remove the manual `insert` entry first — the bundle patch registers the row and a duplicate would conflict.
147
+ 1. Let active work finish, then stop `dsh web`. Back up `package.json`, `cordis.patch.yml` and `pnpm-lock.yaml` in `~/.dsh/profiles/web/`, plus `~/.dsh/settings.yaml` if it exists. If you set `DSH_HOME`, use that directory instead of `~/.dsh`.
148
+ 2. Keep your existing auto-continue values. Remove only the manually added `auto-continue` row **inside an `insert` list** (and the list if it becomes empty). The installed bundle supplies that row. A top-level `- id: auto-continue` with `config:` is a configuration override: **keep it**.
149
+ 3. Install with either the npm or GitHub command above. In the profile's `package.json`, `dsh.profile.bundles` should now include `dsh-client-auto-continue`, alongside the existing DSH bundles. If it already does and the plugin appears in **Plugins**, this part is already complete.
150
+ 4. On DSH 0.1.7 / 0.2, merge any saved values from the old `settings.yaml` → `auto-continue` section or the removed row's `config` into the profile's `cordis.patch.yml`. For example, a custom cooldown becomes:
141
151
 
142
- > **Settings exposure:** since DSH 0.1.0-rc.7 the web settings surface is **registry-driven** — every namespace a plugin registers is served, so the settings card works out of the box, no vendor patch needed (the plugin requires rc.7+, see Quick Start).
152
+ ```yaml
153
+ - id: auto-continue
154
+ config:
155
+ cooldownMs: 45000 # example: preserve your own saved value
156
+ ```
157
+
158
+ Merge into an existing override instead of adding another one. Keep unrelated settings intact. DSH 0.1.7 / 0.2 reads this entry config; editing the old `settings.yaml` section will not update the new form.
159
+ 5. Start `dsh web` again and reload the browser. Open **Plugins → dsh-client-auto-continue**, expand **Auto continue**, and check that your values are present. Save a change and reload to confirm it persists.
160
+
161
+ The `include:auto-continue` label in **Built-in plugins** is a normal loader prefix. It does not, by itself, indicate a legacy install or a duplicate engine.
143
162
 
144
163
  ### Verify & uninstall
145
164
 
146
165
  ```bash
147
- dsh --profile web --dump-config | grep auto-continue # config layer mounted
166
+ dsh --profile web --dump-config | grep -A 4 'id: auto-continue'
148
167
  ```
149
168
 
150
- In the browser console (Ctrl/Cmd+Shift+I): `[auto-continue] 已启动(文本="继续", …)` — every detection and auto-send is logged.
169
+ The composed config should contain one `id: auto-continue` entry. In **Plugins → dsh-client-auto-continue**, check that the component is **Running** and that expanding **Auto continue** shows editable fields. With verbose logging enabled, engine activity appears in the terminal running DSH.
151
170
 
152
171
  ```bash
153
172
  dsh plugin --profile web remove dsh-client-auto-continue # npm / repo install
154
- # or remove the symlink + the insert entry # manual install
173
+ # also remove this plugin's config override from cordis.patch.yml, if present
155
174
  dsh web
156
175
  ```
157
176
 
158
177
  ---
159
178
 
179
+ ## Troubleshooting
180
+
181
+ - **“Skipping profile bundle” / “incompatible with dsh 0.2.0-rc.1”:** update to plugin 0.12.1 or newer in the profile the app actually uses, then restart it. A version exemption is not needed for this fix.
182
+ - **Enabled, but no configuration fields:** open the main **Plugins** page, select the package and expand **Auto continue**. The Built-in plugins status page has no editable fields.
183
+ - **`/api/auto-continue-bridge` returns 404:** check the DSH startup log and composed config to confirm the host component loaded. Refreshing the settings card cannot start a missing host component.
184
+
185
+ ---
186
+
160
187
  ## Configuration
161
188
 
162
- Everything is configurable from the GUI — no file or console edits needed. Open **Settings → Plugins → Plugin configuration**. **Auto Continue** appears as a collapsed card alongside the other plugins; click the card or its right-hand chevron to expand the full configuration in place. Besides the fields below, the expanded 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).
189
+ On **DSH 0.1.7 / 0.2**, open **Plugins** from the main sidebar, choose **dsh-client-auto-continue**, then expand the **Auto continue** card. This is separate from **Settings → Built-in plugins**, which only lists component status. Older DSH versions use **Settings → Plugins → Plugin configuration**.
190
+
191
+ ![DSH 0.2 Plugins page with the Auto continue card collapsed](docs/screenshots/01-settings-section.png)
192
+
193
+ Click the card header or its right-hand chevron to show the fields. The expanded card also contains a live **stats panel** (today's activity with a reset button) and **paused sessions** (each with a resume button).
163
194
 
164
195
  The settings card groups controls by handoff, safety, recovery, loop breaking, and live status. Its header also keeps the open-source repository and a **Star on GitHub** shortcut within reach.
165
196
 
166
- DSH 0.1.7 stores these values in the `auto-continue` entry's config in the active profile patch. The GUI applies edits live without restarting the engine. Older hosts use the `auto-continue` section in `~/.dsh/settings.yaml`; the YAML example below shows that legacy format. Omitted fields use the defaults below.
197
+ DSH 0.1.7 / 0.2 stores these values in the `auto-continue` entry's config in the active profile patch (`~/.dsh/profiles/web/cordis.patch.yml` for the default web profile). **Save** applies changes live without restarting the engine. Omitted fields use the defaults below.
167
198
 
168
199
  Startup recovery polls every three seconds for sessions that load late, up to `freshMs` after the engine starts. Each settled session history is inspected once. `scanLimit` limits eligible recoveries per pass, so healthy or permanent-error sessions cannot crowd out interrupted ones. Pausing suspends recovery within the same window; unloading cancels the poller.
169
200
 
170
- The browser mirrors DSH's active language into the internal `locale` field. Leave the six localized text fields empty or omit them to follow that language automatically; any non-empty value is treated as your own template and is never rewritten when the language changes:
201
+ The browser mirrors DSH's active language into the internal `locale` field. Leave the seven localized text fields empty or omit them to follow that language automatically; any non-empty value is treated as your own template and is never rewritten when the language changes:
202
+
203
+ ```yaml
204
+ - id: auto-continue
205
+ config:
206
+ locale: 'en' # normally managed by the browser
207
+ paused: false
208
+ continueText: ''
209
+ resumeSilentTurns: true
210
+ resumeCompletedTurns: false
211
+ continueTextSilent: ''
212
+ continueTextLoop: ''
213
+ continueTextMaxTokens: ''
214
+ guardTools: true
215
+ guardPendingText: ''
216
+ guardDoneText: ''
217
+ graceMs: 3000
218
+ cooldownMs: 20000
219
+ maxConsecutive: 3
220
+ scanOnBoot: true
221
+ scanLimit: 8
222
+ freshMs: 900000
223
+ verbose: true
224
+ classify: true
225
+ retryableErrorPatterns: ''
226
+ backoffFactor: 2
227
+ backoffMaxMs: 300000
228
+ notify: false
229
+ loopGuard: true
230
+ loopShortChars: 40
231
+ loopWindowMs: 30000
232
+ loopShortCount: 12
233
+ loopRepeatText: 4
234
+ loopToolRepeat: 5
235
+ loopText: ''
236
+ ```
237
+
238
+ <details>
239
+ <summary>Configuration files on older DSH versions</summary>
240
+
241
+ Older hosts store user settings in `~/.dsh/settings.yaml` under the plugin namespace instead of a profile entry:
171
242
 
172
243
  ```yaml
173
244
  auto-continue:
174
- locale: 'en' # normally managed by the browser
175
- paused: false
176
- continueText: ''
177
- resumeSilentTurns: true
178
- continueTextSilent: ''
179
- continueTextMaxTokens: ''
180
- guardTools: true
181
- guardPendingText: ''
182
- guardDoneText: ''
183
- graceMs: 3000
184
- cooldownMs: 20000
185
- maxConsecutive: 3
186
- scanOnBoot: true
187
- scanLimit: 8
188
- freshMs: 900000
189
- verbose: true
190
- classify: true
191
- retryableErrorPatterns: ''
192
- backoffFactor: 2
193
- backoffMaxMs: 300000
194
- notify: false
195
- loopGuard: true
196
- loopShortChars: 40
197
- loopWindowMs: 30000
198
- loopShortCount: 12
199
- loopRepeatText: 4
200
- loopToolRepeat: 5
201
- loopText: ''
245
+ cooldownMs: 45000
202
246
  ```
203
247
 
248
+ When migrating from the legacy settings file to DSH 0.1.7 / 0.2, move these values into the profile entry's `config` as described in [Migrating an older installation](#migrating-an-older-installation).
249
+
250
+ </details>
251
+
204
252
  **How the card works:**
205
253
 
206
- ![The collapsed Auto Continue card in the plugin configuration list](docs/screenshots/02-settings-card.png)
254
+ ![Expanded Auto continue configuration on DSH 0.2](docs/screenshots/02-settings-card.png)
207
255
 
208
256
  - 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
209
- - A field you changed shows an **Overridden** badge with a per-field **Reset to default** button that restores the built-in value
257
+ - 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)
210
258
  - Boolean fields are **tri-state**: *Inherit* (use the default) / *On* / *Off*
211
259
  - Invalid drafts (non-numbers, values below the minimum) block the save with a hint
212
260
  - In a read-only deployment the card shows the stored values but disables every control
213
261
  - Changes apply immediately after Save and persist in the active profile config (or `~/.dsh/settings.yaml` on older hosts)
214
262
 
263
+ <details>
264
+ <summary>Live status and the Save / Discard buttons</summary>
265
+
266
+ ![Live status and save controls at the bottom of the DSH 0.2 configuration card](docs/screenshots/07-card-panels.png)
267
+
268
+ </details>
269
+
215
270
  | Field | Default | Description |
216
271
  | --- | --- | --- |
217
272
  | Pause auto-continue | `off` | Global pause: no live or scan auto-send fires, queued pending sends are cancelled |
@@ -219,6 +274,8 @@ auto-continue:
219
274
  | Continue text (max tokens) | `Continue` | Text sent when the output token ceiling is reached (same placeholders) |
220
275
  | Resume silent turns | `on` | Resume a turn that ended normally with reasoning only (no text, no tool call); does not reset the consecutive count |
221
276
  | Continue text (silent turn) | `Continue. Your previous turn ended with internal reasoning only, ...` | Text sent to resume a silent turn (same placeholders) |
277
+ | 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 |
278
+ | Continue text (autonomous loop) | `Continue` | Text sent on each autonomous-loop resume (same placeholders) |
222
279
  | Idempotency guard | `on` | Inspect the last tool call before resuming and steer the model (see What It Does) |
223
280
  | Loop guard | `on` | Detect a running turn spinning in place and restart it (see What It Does) |
224
281
  | Short-sentence max (chars) | `40` | A model message shorter than this counts as a short sentence (spinning signal) |
@@ -230,12 +287,12 @@ auto-continue:
230
287
  | Guard text (unconfirmed result) | `(The previous tool "{tool}" may not have completed. Check its state before continuing and do not run it again.)` | Appended when the last tool may have partially executed; `{tool}` placeholder |
231
288
  | Guard text (tool succeeded) | `(The previous tool "{tool}" completed successfully. Result: {result}; do not run it again. Continue from there.)` | Appended when the last tool is confirmed done; `{tool}` / `{result}` placeholders |
232
289
  | Grace period (ms) | `3000` | Wait after an interruption; cancelled if the host recovers on its own |
233
- | Cooldown (ms) | `20000` | Min interval between auto-continues per session (failed attempts count too) |
234
- | Max consecutive | `3` | Max consecutive auto-continues; stops until a user intervenes or a turn completes with visible output |
290
+ | Cooldown (ms) | `20000` | Min interval between recovery attempts per session; failures during cooldown wait for the remaining interval, then grace |
291
+ | Max consecutive | `3` | Consecutive recovery-attempt cap; resets on user intervention or an observed completion with visible output. Normal autonomous-loop handoffs are exempt |
235
292
  | Scan on host startup | `on` | Recover interrupted sessions that become available during the startup window |
236
293
  | Scan limit | `8` | Maximum eligible recoveries per pass, most recently active first |
237
294
  | Scan window (ms) | `900000` | Maximum interruption age and duration of startup polling |
238
- | Verbose logs | `on` | `[auto-continue]` console logs |
295
+ | Verbose logs | `on` | `[auto-continue]` engine logs in the DSH terminal |
239
296
  | Classify errors | `on` | Auto-resume transient failures only; auth / balance / model errors are skipped and notified |
240
297
  | Custom retryable errors | empty | One case-insensitive literal per line; matching the error code, HTTP status, or message explicitly overrides the built-in classifier |
241
298
  | Backoff factor | `2` | Cooldown multiplier per consecutive failure (2 = 20s → 40s → 80s…) |
@@ -245,42 +302,49 @@ auto-continue:
245
302
  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:
246
303
 
247
304
  ```yaml
248
- auto-continue:
249
- retryableErrorPatterns: |-
250
- Upstream rejected the request as invalid
305
+ - id: auto-continue
306
+ config:
307
+ retryableErrorPatterns: |-
308
+ Upstream rejected the request as invalid
251
309
  ```
252
310
 
253
311
  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.
254
312
 
255
- `continueText` (and `continueTextMaxTokens`, `continueTextSilent`) 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).
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).
256
314
 
257
315
  ---
258
316
 
259
317
  ## Privacy & permissions
260
318
 
261
- The plugin is browser-only and touches **no files, credentials, or network beyond the dsh host**:
319
+ The recovery engine runs inside the DSH host. The browser provides the configuration card, live status and optional notifications:
262
320
 
263
- - It opens the same two read-only event streams the web UI already uses (no extra server, no third-party endpoints)
264
- - The engine's **only automatic write** is `sessions.prompt` — the same call the Send button makes — with the text you configured (saving the settings card writes the `auto-continue` section of `~/.dsh/settings.yaml` through the normal settings API, exactly like any other setting)
265
- - No browser storage at all: the single host-side engine keeps its cooldowns, send caps, pauses and stats in process memory
321
+ - The engine reads session events and history through DSH's services. The browser talks to that host; the plugin adds no third-party service or credential store
322
+ - Recovery sends your configured text through `agent.followup`. The loop guard can cancel a looping turn through `agent.cancel` before sending its recovery prompt. Resumed agents continue with the session's existing tools and permissions
323
+ - Saving configuration uses DSH's settings API: the active profile patch on DSH 0.1.7 / 0.2, or `~/.dsh/settings.yaml` on older hosts
324
+ - Retry counters, cooldown timestamps, per-session pauses and stats stay in host process memory and reset when the engine restarts. The global `paused` setting is saved with your other configuration
266
325
  - Browser notifications are opt-in (`notify` setting) and permission is requested on first use only
267
326
 
268
327
  ---
269
328
 
270
329
  ## Development
271
330
 
272
- The CI runtime test uses the published DSH 0.1.7 packages to check the HTTP bridge and live settings through the real Loader. Run `npm ci --prefix tests/fixtures/dsh-0.1.7` once, then `npm run test:runtime` after building.
331
+ Use Node.js 22. Install both pinned runtime fixtures to reproduce CI locally:
273
332
 
274
333
  ```bash
275
- npm run typecheck # tsc --noEmit
276
- npm run build # lib/client.js + lib/index.js + lib/types
277
- npm run watch # rebuild on change; host HMR hot-reloads without a page refresh
278
- npm run test # node tests/simulate-host.mjs — 15 host-side behavioral scenarios
334
+ npm ci
335
+ npm ci --prefix tests/fixtures/dsh-0.1.7
336
+ npm ci --prefix tests/fixtures/dsh-0.2.0
337
+ npm run typecheck
338
+ npm run build
339
+ npm test
340
+ npm run test:runtime
279
341
  ```
280
342
 
281
- 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.
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.
344
+
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.
282
346
 
283
- CI installs from the lockfile, typechecks, rebuilds and verifies committed artifacts, runs the host and client simulations (including legacy settings scopes and DSH 0.1.7 configuration forms through Cordis), then runs [dsh-plugin-check](https://github.com/omdsh-dev/dsh-plugin-check). The same health check gates releases.
347
+ 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.
284
348
 
285
349
  ---
286
350