dsh-session-guard 4.2.10 → 4.2.11

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/CHANGELOG.md CHANGED
@@ -1,367 +1,381 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.2.11 (2026-11-17)
4
+
5
+ - **修复 issue #3:峰期新会话的请求级 hold 没有手动放行入口**。峰期(如 09:00–12:00)新建会话发第一条消息,请求在 `agent/request` 被 `deferrals.hold()` 挂起;但 step 门只在 `step > 1` 才拉,首条请求停在 step 1,**step 门从未参与**。于是:
6
+ - 按钮显示「暂停会话」(`pausedStep=false`),点一下只是登记 `manualPause`、按钮翻成「继续会话」;
7
+ - 再点触发 `stepResume()`,而 `stepGate.release()` 因无门可放返回 `{released:false}`,**连 bypass 都不置**;
8
+ - 结果请求纹丝不动,只能等退峰 `releaseAll`、abort 或卸载插件才解除。
9
+ - **修法三处**:
10
+ 1. `bridge.stepResume()` 现在同时结算**请求级 hold**(`deferrals.settle(id, reason, 'release')`,让挂住的 promise 以原 config 继续发出)并清掉延后记录;且**只要用户显式要继续就置 bypass**,不论门来自 step 级还是请求级——否则下一个请求立刻被同一峰期再挂一次,「继续」退化成「点一下放一条」的假放行。
11
+ 2. `request-guard` 新增 `isBypassed` 依赖,判定顺序里在「峰期 + 官方源」之后认这个 bypass(fail-open:探测抛错则退回正常拦截,不得当作已放行)。`wiring` 把 step 门的 bypass 集合接进去——step 门与请求门共用同一个「本峰已被用户手动放行」的事实。
12
+ 3. 状态投影新增 `requestHeld` / `requestHeldSince` / `pausedAny`,`/state` 的 `paused` 增补 `request` / `any` 并新增 `requestGate`;`readPauseState()` 认这三处,按钮在请求级 hold 时正确显示「继续会话」。
13
+ - **顺带修掉报告未提的一个细节**:旧代码点第二次会把 `manualPause` 一并删掉,按钮**又翻回「暂停会话」**,表现为「点两下、按钮闪回去、请求还在挂」。现在 bypass 与 manual 的取舍明确:显式继续 → 置 bypass;显式暂停 → 撤销 bypass(原语义保留)。
14
+ - **测试**:`bridge.test.mjs` 新增 5 例(请求级 hold 结算 / 无门也置 bypass / 自动释放不置 bypass / 状态投影认 requestHeld / 无 hold 时行为不变);`request-guard.test.mjs` 新增 3 例(bypass 会话放行 / 只对指定会话生效 / 探测抛错 fail-open 到正常拦截)。契约测试同步新增字段。
15
+ - **全量**:286 tests / 286 pass / 0 fail(lint 干净、build 通过)。
16
+
3
17
  ## 4.2.10
4
18
 
5
19
  - 终端面(dsh-tui / Desktop 命令面板同源):/guard 终端面 + 拉门时向会话追加 plugin 源消息(TUI 一行反馈)。
6
-
7
- 4.2.3: host enumeration addendum for DSH 0.2.1-rc.3 (declaration-only bump; contract plane zero diff).
8
-
9
- ## 4.2.2 (2026-10-18)
10
-
11
- - hosts: 追加 0.2.1-rc.2 声明面枚举(34/34 @deepseek-ai/* 宿主 peer 逐包 npm 实测 rc.2 在版;本插件不触 ctx.web provider 与 conversation.input.model.label 槽,代码零改动,纯元数据发版;农场 rc.2 格挂账待命)
12
-
13
- All notable changes to `dsh-session-guard` are recorded here. Versions follow semver.
14
-
15
- - [English changelog](./CHANGELOG.md)
16
- - [日本語 changelog](./CHANGELOG.ja.md)
17
- - [한국어 changelog](./CHANGELOG.ko.md)
18
- - [Changelog en français](./CHANGELOG.fr.md)
19
- - [Changelog auf Deutsch](./CHANGELOG.de.md)
20
- - [Changelog in italiano](./CHANGELOG.it.md)
21
- - [Changelog на русском](./CHANGELOG.ru.md)
22
- - [Changelog en español](./CHANGELOG.es.md)
23
-
24
- ## 4.2.1 — 2026-10-17 (host enumeration: +0.2.1-rc.1)
25
-
26
- ### Fixed
27
- - `engines.dsh` and the four `@deepseek-ai/dsh-client-*` peers append `|| 0.2.1-rc.1` (16-host exact enumeration),
28
- so the host compatibility gate accepts DSH `0.2.1-rc.1`.
29
- - `dsh.plugin.json` `engines.dsh` aligned to the same 16-host enumeration (was the range `>=0.2.0-rc.1 <0.2.1-0`);
30
- the gate only reads `package.json`, but the two lists must not diverge.
31
- - README compatibility statements (zh/de/es/fr/it/ru) synced to the enumeration. No behaviour change in this release.
32
-
33
- ## 4.2.0 — 2026-10-17
34
-
35
- ### Added
36
- - Statutory-holiday awareness (src/holidays.js + src/holiday-store.js). Builtin 2026 finalized snapshot: 39 rows = 33 rest days + 6 make-up workdays (source: holiday-cn, State Council notices). Strict parse (zero-padded dates, boolean isOffDay, cross-year rows rejected); sha256 fingerprint over the decision fields only — upstream copy/reorder edits cause no false churn. The cache file $DSH_HOME/.dsh/session-guard/holidays/<year>.json self-verifies its fingerprint at load: mismatch discards the cache (builtin fallback) and triggers a re-fetch. Auto refresh: startup check + hourly ensureFresh; relevant years = Beijing current year, Nov/Dec also add next year (the State Council publishes next year in late December, so it lands without a release); jsDelivr primary, raw.githubusercontent fallback, 10 s timeout; refetch only on fingerprint change, then atomic tmp+rename write; 24 h no-refetch budget; consistent hits only bump the check timestamp; fail-open end to end. DSH_SESSION_GUARD_HOLIDAY_FETCH=0 pins offline/builtin mode (tests ride it).
37
- - Declarative settings switches holidayMode and holidayAutoFetch (both default on; auto-form on 0.1.7+). /session-guard/status now exposes holidayMode + holidays[] per year (source / fingerprint / fetchedAt / entry count).
38
-
39
- ### Changed
40
- - weekendMode upgraded to rest-day semantics: statutory holidays (including ones landing on workdays) are off-peak all day; make-up-workday weekends enter peak gating normally; nextOffPeakInstant lookahead widened 7 -> 14 days and is table-aware. holidayMap rides cfg via readCfg, so shouldPause consumers (scheduler tick / request-guard / step-gate / wiring release timers) pick it up with zero signature churn.
41
-
42
- ### Fixed
43
- - Family claim rank 1 -> 2, aligned with the frozen weighted rank ladder (single source _tools/family-rank.mjs).
44
-
45
- ## 4.1.16 — 2026-10-14 (metadata alignment; backfill the missing 4.1.15 entry)
46
-
47
- ### Fixed
48
-
49
- - `dsh.plugin.json` now carries the same version as `package.json`. The published 4.1.15 tarball
50
- still said 4.1.14 (verified by downloading it from the registry), so the two manifests disagreed in a released artifact.
51
- - No behaviour change in this release.
52
- - Test suite repaired: the structural pin in `tests/settings-bridge.test.mjs` still demanded the
53
- retired gear entry, so the suite had been red since 4.1.15; it now asserts the opposite (absence).
54
-
55
- ## 4.1.15 — 2026-10-08 (backfilled: this entry was never written at release time)
56
-
57
- ### Removed
58
-
59
- - The shell-level `shell.overlay` slot injection: the fixed bottom-right gear button and its
60
- positioned floating layer are gone (`src/client/shell-overlay.tsx` deleted). The settings entry
61
- now relies on the host settings page alone.
62
-
63
- ## 4.1.14 — 2026-10-08
64
-
65
- ### Removed
66
-
67
- ## 4.1.13 — 2026-10-08
68
-
69
- ### Fixed — bridge descriptor skeleton on ≤0.1.5 (five-cell gate catch, 2026-10-08)
70
-
71
- - **Host describe `value` is a field skeleton on ≤0.1.5** (0.1.0/0.1.5 empirical):
72
- the old host generations serialize `descriptor.value` as `{enabled:{},…,officialProviders:{}}`
73
- (one empty object per schema field) while the real merged config lives in
74
- `descriptor.base` (combined defaults) + `descriptor.user` (user layer).
75
- `BridgeDocHandle` consumed `value` verbatim, so `officialProviders` arrived as
76
- `{}` — truthy non-array, invisible to `?? []` — and `ListRow`'s
77
- `values.join` threw, crashing the whole `dsh-family.tab` slot (guard card +
78
- IT card + TL nav all died together). `descriptorPlainValue()` now detects the
79
- skeleton (object whose every own value is an empty plain object — impossible
80
- for guard's scalar/array config) and rebuilds the effective value as
81
- `{...base, ...user}` (shallow merge is exact for guard's flat config).
82
- - **Card-field sanitization (defense in depth)**: any card render error kills
83
- the entire family tab slot on these hosts, so `ListRow` inputs are now
84
- sanitized at the call sites (`toList()` — non-arrays become `[]`) and the
85
- `拦截方式` select falls back to `hold` for any non-`error` value. A malformed
86
- descriptor may degrade one field, never the tab.
87
- - Verified on the five-cell farm gate: describe replays on 0.1.0/0.1.5 now
88
- yield plain merged values; the seeded `stepGateTimeoutMs: 321123` reads back
89
- through the bridge on ≤0.1.5 and natively (configForms) on 0.1.7.
90
-
91
- ## 4.1.12 — 2026-10-08
92
-
93
- ### Added — settings webServer bridge (M4/T20-b): dual-track card data plane
94
-
95
- - **Top-level card registration refactor (prerequisite)**: the three settings
96
- faces (`dsh-family.tab`, `plugins.bundle.config`, `settings.plugin.item`,
97
- `shell.overlay`) were registered inside the `onScope` callback of the dual
98
- scoped-inject waist — on ≤0.1.5 that callback never fires (settingsScope fiber
99
- never resolves; 0.1.0/0.1.1 lack both services), so the cards never registered
100
- and a bridge would have had no consumer. All registrations now run at apply
101
- top level with a `scopeRef` live reference; the callback degrades to a pure
102
- data arm (perm-gate `client/index.ts` L166-257 shape).
103
- - **Server bridge** (`src/settings-bridge.js`): `describe`/`mutate` endpoints at
104
- `/api/session-guard/settings/*` (POST-only, `{ok,value|error}` envelope,
105
- redacted describe filtered to the plugin ns, ops forwarded to the host
106
- settings service with `expectedRevision` optimistic concurrency, 256 KB cap).
107
- Registration is fail-open (error log, never blocks plugin load).
108
- - **Client bridge handle** (`src/client/settings-bridge.ts`): `BridgeDocHandle`
109
- implements the same `SettingsScope` face as the native handles
110
- (getSnapshot/subscribe/set/unset); describe misses retry within a bounded
111
- budget (settings service resolving later than card mount) before landing on
112
- `unavailable`. Card faces read `scopeRef.scope ?? bridgeScope()` — native
113
- first, bridge fallback (perm-gate T13b dual-track). **Generation split in the
114
- data arm (five-cell empirical, 2026-10-08 night)**: on 0.1.2/0.1.5 the
115
- `settingsScope` handle is write-alive but read-dead — `set()` persists to
116
- settings.yaml while `getSnapshot().value` stays `undefined`, so that arm
117
- deliberately leaves `scopeRef` empty and the card falls to the bridge (bridge
118
- mutate lands in the same host service; describe heals the read path).
119
-
120
- ### Corrected — 4.1.11 publication note
121
-
122
- - The 4.1.11 entry said "none of 4.1.5-4.1.10 was published to npm"; **4.1.5
123
- was published** (npm registry confirms `4.1.5` in versions, and `latest`
124
- pointed at it until this release line). 4.1.6-4.1.10 indeed never shipped.
125
- The earlier claim came from reading the npmmirror mirror instead of the
126
- authoritative registry (registry-pin discipline, B2+).
127
-
128
- ## 4.1.11 — 2026-10-08
129
-
130
- ### Fixed — family-section takeover rebuilt (4.1.5 → 4.1.11 arc; none of 4.1.5-4.1.10 was published to npm)
131
-
132
- - **4.1.5 "half backfill" root cause**: the takeover body read `props.hooks.tabs`,
133
- but the host's `bindInjectHooks` strips an inject face's `hooks` key into
134
- `use<Tab>` props on every generation — the component threw, the slot abdicated,
135
- and the takeover body never rendered anywhere. It now reads the `useTabs`
136
- compartment first, with a raw-hooks `useState`/`useEffect` fallback.
137
- - **Apply-time inject registration (4.1.10)**: the slots core fires inject
138
- factories only on declaration events (= the settings panel opening), so the
139
- grace-delayed registration of 4.1.7/4.1.8 waited for a declaration that never
140
- came. The `settings.section` inject now registers at apply time.
141
- - **Deferred yield-election (4.1.11)**: ≤0.1.7 shells give every same-id section
142
- entry its own nav row — the old "priority-10 shadow stays invisible" assumption
143
- produced a double 起子插件设置 row on all five farm cells. The factory now waits
144
- 500 ms after the declaration batch and stands down when a `dsh-family` entry is
145
- already seated (thinking-levels head); it takes over only when TL is absent.
146
- Verified single-row on all five farm cells (0.1.0 → 0.1.7), pairing with
147
- dsh-thinking-levels 4.2.0-beta.26's symmetric stand-down.
148
-
149
- ## 4.0.0 — 2026-09-29
150
-
151
- ### Changed
152
- - **DSH 0.2.0 line adaptation**: `engines.dsh` and the four `@deepseek-ai/dsh-client-*` peers move to `>=0.2.0-rc.1 <0.2.1-0` (replacing the 0.1.7 ranges); npm dist-tag `dsh-0.2.0`; manifest version aligned to `4.0.0`. The plugin-facing API surface (manifest / settings / HMR / slots / session v4) is unchanged from 0.1.7 — no runtime code changes.
153
- - `@deepseek-ai/cordis` peer floor aligned to `^4.0.4` (the 0.2.0-rc.1 host UI packages declare `~4.0.4`; the previous `^4.0.1` accepted it but understated the floor).
154
-
155
- ### Fixed
156
- - `src/client/family-section.tsx` landed in version control (it had existed only in the working tree since 3.2.x, so a clean checkout could not build).
157
- - eslint flat config: dropped the core `no-unused-vars` rule — it mis-flags TS type-signature parameters; the typescript-eslint variant is kept, and the lint baseline is green again.
158
- - v4 source-kind static gates (`tests/source-kind.test.mjs`) are now tracked and run in `npm test` (248 tests).
159
-
160
- ## 3.2.4 — 2026-09-27
161
-
162
- ### Fixed
163
- - **Session format v4 adaptation (host >= 0.1.7-rc.1)**: the three session-writing paths no longer use the retired `source: { kind: 'plugin', plugin: 'session-guard' }` signature, which the v4 host rejects with `SessionFormatError` (whole round fails). All three now use the producer-owned kind:
164
- - delayed-resume notice injection (`src/wiring.js`);
165
- - auto-retry notice injection (`src/retry.js`);
166
- - pause-resume followup (`src/pause-gate.js`, ```kind: `plugin:${pluginId}````).
167
- - **tool-result v4 native adaptation (N1)**: `findToolOutcome` in `src/pause-gate.js` now reads the v4 first-class `role:'tool'` message (`toolCallId`/`isError` at message top level) first; the v3 `tool-result` block path is kept as historical fallback. Without this, a failed tool at pause time was reported as completed on resume ("do not re-run") — a silent wrong decision. `src/tool-call-id.js` reads the native top-level id first; stale 0.1.1/0.1.2-era header notes corrected to the three-shape generation table.
168
- `form` and all other fields are unchanged; the host's own v3-to-v4 migration lifts existing legacy rows, so no historical data is rewritten. Evidence: `@deepseek-ai/dsh-session-format-v3-to-v4@0.1.7-rc.2` validates only that `source.kind` is non-empty and not `'plugin'`.
169
-
170
- ## 0.4.0 — 2026-09-18 (mis-versioned; superseded by 3.0.0)
171
-
172
- ### Fixed
173
-
174
- - **Version identity.** This line was published as `0.4.0` while `dsh.plugin.json` and this
175
- changelog already said `3.0.0` — one artifact with two version numbers. `package.json` is now
176
- `3.0.0`, so the package version, the manifest version and the changelog agree. `0.4.0` is kept
177
- here as a historical record because npm versions are immutable; `dist-tag dsh-0.1.5` should be
178
- repointed to `3.0.0` once it is published.
179
- - **Docs.** README/INSTALL (zh/en/ja/ko) no longer describe the sibling line as living on `main`.
180
- The 0.1.2 line's release branch is **`legacy/0.1.2`** (npm dist-tag `dsh-0.1.2`, version `0.3.1`);
181
- `main` is frozen at `0.2.0-beta.1`. The duplicated branch fragment in the INSTALL.zh/ja/ko install
182
- command is fixed, explicit dist-tag install commands are documented, and "2.x / 3.x" is
183
- now marked as a **line nickname** rather than a version number.
184
-
185
- ### Notes
186
-
187
- - **No source changes** relative to `3.0.0`; `0.4.0` is a packaging-only publish of the same tree.
188
-
189
- ## 3.0.0 — 2026-09-14
190
-
191
- ### Changed
192
-
193
- - **DSH v0.1.5-rc.2 dedicated line (`compat/0.1.5`).** `engines.dsh` and the `dsh-client-*`
194
- peer ranges narrow to `>=0.1.5-rc.2 <0.2.0-0` (strict-semver prerelease matching means the
195
- old `>=0.1.0-rc.7` range never matches `0.1.5-rc.2`); `dsh.plugin.json` gains `engines.dsh`.
196
- The 2.x / 0.2.x line on `main` keeps serving DSH 0.1.0-rc.7 … 0.1.2-rc.1.
197
- - **`session.events` → `snapshotEvents()`.** DSH 0.1.5 removed the `session.events` array
198
- accessor (compatibility-guide §20.3). `pause-gate.js` now reads session events through a
199
- dual-path helper: `snapshotEvents()` first, the legacy `events` array as a defensive
200
- fallback, `null` (fail-open) when neither exists. Affects `findToolOutcome` and
201
- `lastUserPrompt` only; event-type matching is unchanged.
202
-
203
- ### Unchanged
204
-
205
- - Zero changes on every other integration seam: the self-held webServer prefix route
206
- (`/session-guard/rpc`), `settings.register`, the `settings.plugin.item` card slot,
207
- client injections, and `llm.listConfigurableProviders()` are all verified intact against
208
- the published 0.1.5-rc.2 bundle (`tools/check-api-drift.ps1`, 12/12 required assertions).
209
-
210
- ### Pending
211
-
212
- - Live smoke on a real DSH 0.1.5-rc.2 host (same status as the perm-gate 0.1.5 line).
213
-
214
- ## 0.2.0-beta.2 — 2026-09-13
215
-
216
- ### Fixed (DSH 0.1.5 compat — `compat/0.1.5` branch)
217
-
218
- - **Dual-path resume enqueue.** DSH 0.1.5 turns the Inbox into an agent-loop read-only
219
- projection, so `agent.followup` may no longer exist. The resume flow now tries
220
- `agent.followup` first, falls back to `agent.send`, and degrades to a warn (never throws)
221
- when neither is available — a failed enqueue can no longer break resume.
222
- - **Resume messages carry `source.form: 'instructions'`** per the 0.1.5 `ContextFormed`
223
- message-source contract (`kind: 'plugin'` is a built-in kind; older DSH versions ignore
224
- the extra field).
225
- - **`webServer.register` is wrapped in try/catch**: a failed route registration now logs an
226
- error instead of throwing out of `apply` and breaking host plugin loading.
227
- - Verified against the 0.1.5-rc.2 source: the `WebRoute` contract (exact/prefix + SSE) is
228
- unchanged, so client `fetch('/session-guard/...')` paths need no `/api` prefix.
229
-
230
- ## 0.2.0-beta.1 — 2026-09-10
231
-
232
- ### Added
233
-
234
- - **Step-level gate (`agent/pre-step`).** During peak hours the turn is now held **before** the
235
- next step's model request instead of being interrupted at a turn boundary: the session keeps
236
- running until the next `agent/pre-step`, where the gate holds it (setting `stepLevelPause`, on by
237
- default). The turn resumes **in place** off-peak — no followup message needed. Hold conditions:
238
- peak (Beijing time) + not weekend + `step > 1` + official target provider (`providerGuard`) +
239
- not request-held + not bypassed in this peak window. New module `src/step-gate.js` (pure
240
- `decideStepHold` + hold / release / abort / timeout engine).
241
- - **`stepResume` port + RPC + `/resume`.** `sessionGuard.stepResume(sessionId, {bypass})`,
242
- `POST /session-guard/rpc {action:'stepResume'}` and `/resume` all release the gate; a manual
243
- resume also stops gating that session for the rest of the peak window.
244
- - **Timeout escalation.** `stepGateTimeoutMs` (default 300000) releases the gate and escalates to a
245
- turn-level **force** pause, so a long peak neither deadlocks nor drips one step every five minutes.
246
- - **"⏸ Pause session" button** (client, slot `conversation.input.right`, id `session-guard-pause`,
247
- order 20 — left of input-traffic's freeze button). It polls `/session-guard/state` once a second,
248
- stays disabled while nothing is held, and calls `stepResume` when it is. The status badge moved to
249
- order 40 and now reports the number of step-held sessions.
250
- - **New settings**: `stepLevelPause`, `stepGateTimeoutMs`.
251
- - **New state**: `GET /session-guard/state` now returns `paused: { step, turn }` and
252
- `stepGate: { held, since, bypass }`; `/status` returns `stepHeld`; `/diag` returns `stepGate`.
253
- The service port's `state().paused` stays boolean for compatibility (new field `pausedStep`).
254
-
255
- ### Fixed
256
-
257
- - **Deadlock between a held step and a turn-level pause.** `pauseTask` / `resumeTask` /
258
- `cancelTask` now release the step gate first: a step hold sits at `agent/pre-step`, where no
259
- `assistant/message` or `tool/result` can ever arrive, so a `safe` pause used to wait forever and
260
- never persisted `paused`.
261
-
262
- ### Changed
263
-
264
- - **Peak entry no longer interrupts running turns** when `stepLevelPause` is on (`onEnterPeak` arms
265
- the step gate instead of calling `stopNextTurn`); with it off the previous turn-level behaviour is
266
- unchanged.
267
- - input-traffic's freeze button label is now **"Freeze & append"** (`冻结追加` / `凍結して追加` /
268
- `동결 후 추가`), and its resume label **"Resume & append"** (`恢复追加` / `再開して追加` /
269
- `재개 후 추가`) — it freezes the turn and keeps queued messages, distinct from the pause button.
270
- - **The pause button is a toggle now**: "Pause session" / "Resume session" (no disabled grey state).
271
- Clicking "Pause session" calls the new `stepPause` action, which holds the session at the **next
272
- step boundary** (step 1 included, regardless of peak or provider); "Resume session" calls
273
- `stepResume`. New port method `sessionGuard.stepPause(sessionId)`.
274
- - **SSE push**: new route `GET /session-guard/events?session=<id>` pushes step-gate state changes the
275
- moment they happen, so peak auto-holds flip the button to "Resume session" without waiting for a
276
- poll; the 10s `/session-guard/state` poll remains as a fallback. `/state` now reports
277
- `paused.manual` and `stepGate.manual`.
278
- - **Styling aligned** with input-traffic's composer button (24px height, 6px radius, 12px font, the
279
- same border/hover/pressed tokens) for both the pause button and the status badge; styles are
280
- injected once via `<style data-plugin-css="session-guard-client">`.
281
-
282
- ## Unreleased
283
-
284
- ### Added
285
-
286
- - **Official-source two-dimensional guard (peak × target provider).** Peak hours now block only
287
- requests whose target route is a DeepSeek official source; local/third-party providers keep
288
- running. Verdict order: explicit `officialProviders` id list → live `baseURL` endpoint →
289
- catalog builtin endpoint (pi-ai's `deepseek`) → builtin id (`deepseek-official`); each verdict
290
- reports `matchedBy`. New modules: `src/provider.js` (pure), `src/provider-directory.js`,
291
- `src/deferrals.js`, `src/request-guard.js`, `src/targets.js`, `src/wiring.js`.
292
- - **Request-level backstop (`agent/request`).** Covers sessions started after peak entry and
293
- sessions switched to an official source mid-run — the 30s tick only handled sessions that were
294
- already `running` at the transition. Default `hold` mode suspends the request without an error
295
- and releases it at the exact off-peak instant (`msUntilOffPeak`); `error` mode throws a
296
- recognizable `PEAK_DEFERRED` failure and records a deferral for off-peak resume.
297
- - **New settings**: `providerGuard`, `officialProviders`, `officialBaseURLs`, `deferredResume`,
298
- `deferredResumeText`, `deferredMode`, `deferredMaxHoldMs` (default 6h), `guardSubagents`.
299
- - **New routes**: `GET /session-guard/provider?provider=<id>` (verdict diagnostics);
300
- `/session-guard/status` now reports `providerGuard` / `held` / `deferred`;
301
- `/session-guard/state` reports the session's last target.
302
- - **Drift guard** `tools/check-api-drift.ps1` asserting the required APIs exist on
303
- `dsh-v0.1.1-rc.2` / `dsh-v0.1.2-rc.1` / `dsh-v0.1.3-alpha.2` / `dsh-v0.1.5-alpha.1`.
304
-
305
- ### Changed
306
-
307
- - **DSH dual-version support (0.1.0-rc.7 … 0.1.2-rc.1).** One artifact now covers both
308
- `dsh-v0.1.1-rc.2` and `dsh-v0.1.2-rc.1`. The `tool/result` call-id dual read
309
- (`content[].toolCallId` first, `source.callId` fallback — both forms appear in replay logs of
310
- both versions) is extracted to the dependency-free `src/tool-call-id.js` with unit tests.
311
- `dsh.client.inject` no longer names `@deepseek-ai/dsh-client-runtime` (removed in 0.1.2) or
312
- `@deepseek-ai/dsh-client-ui-slots` (not a dynamic client row); peer ranges widened to
313
- `>=0.1.0-rc.7 <0.2.0-0` and the removed package dropped. Added `engines.dsh` and a
314
- version-compatibility table to the README (ZH/EN).
315
- - **Settings surface stays on the intersection API**: `settings.register` + `settings.get` only;
316
- `installSection` (0.1.2+) and the removed `installSettingsSection` are never used. Optional
317
- APIs (`model/selection`, `llm.listConfigurableProviders`, `settings.get`) are feature-probed and
318
- degrade instead of throwing.
319
- - **`src/retry.js` short-circuits only the exact `PEAK_DEFERRED` sentinel.** 429 / `RATE_LIMIT` /
320
- `TRANSPORT` / timeout failures remain transient, so DSH's global retry (`dsh-llm-retry` on
321
- `agent/request-error`) and this plugin's own retry semantics are unchanged. `dsh-llm-retry`
322
- itself is never touched.
323
- - Badge distinguishes "peak · official only" from "peak · all paused".
324
-
325
- ## 0.1.4 — 2026-09-09
326
-
327
- ### Changed
328
-
329
- - **Public beta release** of the dual-version line (`0.1.4-beta.1`): version metadata, README
330
- compatibility table and package metadata aligned for the beta channel.
331
-
332
- ## 0.1.3 — 2026-09-09
333
-
334
- ### Fixed
335
-
336
- - **package.json encoding restored**: description was corrupted (GB2312 bytes misread as UTF-8); rewritten with correct Chinese text.
337
- - **Missing metadata**: added `repository`, `homepage` fields.
338
- - **peerDependencies corrected**: removed pinned `dsh-llm` exact version; added `cordis`, `dsh-client-runtime`, `dsh-client-locale`, `dsh-client-ui-settings`, `dsh-client-ui-slots` as optional peers matching `dsh.client.inject`.
339
- - Added `dsh.plugin.json` manifest.
340
-
341
- ## 0.1.2 — 2026-08-28
342
-
343
- ### Fixed
344
-
345
- - **Peak timezone fixed**: 峰谷判定固定北京时间 (`BILLING_TIMEZONE`),周末判定用配置时区。
346
-
347
- ## 0.1.1 — 2026-08-24
348
-
349
- ### Added
350
-
351
- - **Backend auto-retry (D9)**: `turn/end` transient failures (error/429/max-tokens) trigger adaptive-backoff `followup(retryText)` resume; permanent failures (auth/balance/model/context limit) stop; user intervention or successful turn resets consecutive failure count.
352
- - **Freeze/gate yield**: retry skips when `isFrozen(sessionId)` is true (queueLocked / paused / taskControl paused), never bypasses the session gate.
353
-
354
- ### Changed
355
-
356
- - `sessionGuard` redundant port now exposes `state(sessionId)` returning `{ queueLocked, lockReason, paused, taskControlAvailable, taskControl }`.
357
- - HTTP route `GET /session-guard/diag` returns runtime diagnostics including retry state.
358
-
359
- ### Fixed
360
-
361
- - Weekend detection now uses `Intl.DateTimeFormat` with the configured timezone instead of bare `getUTCDay()`, fixing an 8-hour boundary bug for Beijing timezone.
362
-
363
- ## 0.1.0 — 2026-08-18
364
-
365
- ### Added
366
-
367
- - Initial release: peak auto-pause (global), weekend mode, per-session freeze/resume via `sessionGuard` redundant port + RPC bridge, custom session gate (`agent.cancel keepInbox + goals.pause + session/event safe boundary + followup resume`), settings panel (Settings → Plugins → session-guard).
20
+
21
+ 4.2.3: host enumeration addendum for DSH 0.2.1-rc.3 (declaration-only bump; contract plane zero diff).
22
+
23
+ ## 4.2.2 (2026-10-18)
24
+
25
+ - hosts: 追加 0.2.1-rc.2 声明面枚举(34/34 @deepseek-ai/* 宿主 peer 逐包 npm 实测 rc.2 在版;本插件不触 ctx.web provider 与 conversation.input.model.label 槽,代码零改动,纯元数据发版;农场 rc.2 格挂账待命)
26
+
27
+ All notable changes to `dsh-session-guard` are recorded here. Versions follow semver.
28
+
29
+ - [English changelog](./CHANGELOG.md)
30
+ - [日本語 changelog](./CHANGELOG.ja.md)
31
+ - [한국어 changelog](./CHANGELOG.ko.md)
32
+ - [Changelog en français](./CHANGELOG.fr.md)
33
+ - [Changelog auf Deutsch](./CHANGELOG.de.md)
34
+ - [Changelog in italiano](./CHANGELOG.it.md)
35
+ - [Changelog на русском](./CHANGELOG.ru.md)
36
+ - [Changelog en español](./CHANGELOG.es.md)
37
+
38
+ ## 4.2.1 — 2026-10-17 (host enumeration: +0.2.1-rc.1)
39
+
40
+ ### Fixed
41
+ - `engines.dsh` and the four `@deepseek-ai/dsh-client-*` peers append `|| 0.2.1-rc.1` (16-host exact enumeration),
42
+ so the host compatibility gate accepts DSH `0.2.1-rc.1`.
43
+ - `dsh.plugin.json` `engines.dsh` aligned to the same 16-host enumeration (was the range `>=0.2.0-rc.1 <0.2.1-0`);
44
+ the gate only reads `package.json`, but the two lists must not diverge.
45
+ - README compatibility statements (zh/de/es/fr/it/ru) synced to the enumeration. No behaviour change in this release.
46
+
47
+ ## 4.2.0 — 2026-10-17
48
+
49
+ ### Added
50
+ - Statutory-holiday awareness (src/holidays.js + src/holiday-store.js). Builtin 2026 finalized snapshot: 39 rows = 33 rest days + 6 make-up workdays (source: holiday-cn, State Council notices). Strict parse (zero-padded dates, boolean isOffDay, cross-year rows rejected); sha256 fingerprint over the decision fields only — upstream copy/reorder edits cause no false churn. The cache file $DSH_HOME/.dsh/session-guard/holidays/<year>.json self-verifies its fingerprint at load: mismatch discards the cache (builtin fallback) and triggers a re-fetch. Auto refresh: startup check + hourly ensureFresh; relevant years = Beijing current year, Nov/Dec also add next year (the State Council publishes next year in late December, so it lands without a release); jsDelivr primary, raw.githubusercontent fallback, 10 s timeout; refetch only on fingerprint change, then atomic tmp+rename write; 24 h no-refetch budget; consistent hits only bump the check timestamp; fail-open end to end. DSH_SESSION_GUARD_HOLIDAY_FETCH=0 pins offline/builtin mode (tests ride it).
51
+ - Declarative settings switches holidayMode and holidayAutoFetch (both default on; auto-form on 0.1.7+). /session-guard/status now exposes holidayMode + holidays[] per year (source / fingerprint / fetchedAt / entry count).
52
+
53
+ ### Changed
54
+ - weekendMode upgraded to rest-day semantics: statutory holidays (including ones landing on workdays) are off-peak all day; make-up-workday weekends enter peak gating normally; nextOffPeakInstant lookahead widened 7 -> 14 days and is table-aware. holidayMap rides cfg via readCfg, so shouldPause consumers (scheduler tick / request-guard / step-gate / wiring release timers) pick it up with zero signature churn.
55
+
56
+ ### Fixed
57
+ - Family claim rank 1 -> 2, aligned with the frozen weighted rank ladder (single source _tools/family-rank.mjs).
58
+
59
+ ## 4.1.16 — 2026-10-14 (metadata alignment; backfill the missing 4.1.15 entry)
60
+
61
+ ### Fixed
62
+
63
+ - `dsh.plugin.json` now carries the same version as `package.json`. The published 4.1.15 tarball
64
+ still said 4.1.14 (verified by downloading it from the registry), so the two manifests disagreed in a released artifact.
65
+ - No behaviour change in this release.
66
+ - Test suite repaired: the structural pin in `tests/settings-bridge.test.mjs` still demanded the
67
+ retired gear entry, so the suite had been red since 4.1.15; it now asserts the opposite (absence).
68
+
69
+ ## 4.1.15 — 2026-10-08 (backfilled: this entry was never written at release time)
70
+
71
+ ### Removed
72
+
73
+ - The shell-level `shell.overlay` slot injection: the fixed bottom-right gear button and its
74
+ positioned floating layer are gone (`src/client/shell-overlay.tsx` deleted). The settings entry
75
+ now relies on the host settings page alone.
76
+
77
+ ## 4.1.14 — 2026-10-08
78
+
79
+ ### Removed
80
+
81
+ ## 4.1.13 — 2026-10-08
82
+
83
+ ### Fixed — bridge descriptor skeleton on ≤0.1.5 (five-cell gate catch, 2026-10-08)
84
+
85
+ - **Host describe `value` is a field skeleton on ≤0.1.5** (0.1.0/0.1.5 empirical):
86
+ the old host generations serialize `descriptor.value` as `{enabled:{},…,officialProviders:{}}`
87
+ (one empty object per schema field) while the real merged config lives in
88
+ `descriptor.base` (combined defaults) + `descriptor.user` (user layer).
89
+ `BridgeDocHandle` consumed `value` verbatim, so `officialProviders` arrived as
90
+ `{}` — truthy non-array, invisible to `?? []` — and `ListRow`'s
91
+ `values.join` threw, crashing the whole `dsh-family.tab` slot (guard card +
92
+ IT card + TL nav all died together). `descriptorPlainValue()` now detects the
93
+ skeleton (object whose every own value is an empty plain object — impossible
94
+ for guard's scalar/array config) and rebuilds the effective value as
95
+ `{...base, ...user}` (shallow merge is exact for guard's flat config).
96
+ - **Card-field sanitization (defense in depth)**: any card render error kills
97
+ the entire family tab slot on these hosts, so `ListRow` inputs are now
98
+ sanitized at the call sites (`toList()` — non-arrays become `[]`) and the
99
+ `拦截方式` select falls back to `hold` for any non-`error` value. A malformed
100
+ descriptor may degrade one field, never the tab.
101
+ - Verified on the five-cell farm gate: describe replays on 0.1.0/0.1.5 now
102
+ yield plain merged values; the seeded `stepGateTimeoutMs: 321123` reads back
103
+ through the bridge on ≤0.1.5 and natively (configForms) on 0.1.7.
104
+
105
+ ## 4.1.12 — 2026-10-08
106
+
107
+ ### Added — settings webServer bridge (M4/T20-b): dual-track card data plane
108
+
109
+ - **Top-level card registration refactor (prerequisite)**: the three settings
110
+ faces (`dsh-family.tab`, `plugins.bundle.config`, `settings.plugin.item`,
111
+ `shell.overlay`) were registered inside the `onScope` callback of the dual
112
+ scoped-inject waist — on ≤0.1.5 that callback never fires (settingsScope fiber
113
+ never resolves; 0.1.0/0.1.1 lack both services), so the cards never registered
114
+ and a bridge would have had no consumer. All registrations now run at apply
115
+ top level with a `scopeRef` live reference; the callback degrades to a pure
116
+ data arm (perm-gate `client/index.ts` L166-257 shape).
117
+ - **Server bridge** (`src/settings-bridge.js`): `describe`/`mutate` endpoints at
118
+ `/api/session-guard/settings/*` (POST-only, `{ok,value|error}` envelope,
119
+ redacted describe filtered to the plugin ns, ops forwarded to the host
120
+ settings service with `expectedRevision` optimistic concurrency, 256 KB cap).
121
+ Registration is fail-open (error log, never blocks plugin load).
122
+ - **Client bridge handle** (`src/client/settings-bridge.ts`): `BridgeDocHandle`
123
+ implements the same `SettingsScope` face as the native handles
124
+ (getSnapshot/subscribe/set/unset); describe misses retry within a bounded
125
+ budget (settings service resolving later than card mount) before landing on
126
+ `unavailable`. Card faces read `scopeRef.scope ?? bridgeScope()` — native
127
+ first, bridge fallback (perm-gate T13b dual-track). **Generation split in the
128
+ data arm (five-cell empirical, 2026-10-08 night)**: on 0.1.2/0.1.5 the
129
+ `settingsScope` handle is write-alive but read-dead — `set()` persists to
130
+ settings.yaml while `getSnapshot().value` stays `undefined`, so that arm
131
+ deliberately leaves `scopeRef` empty and the card falls to the bridge (bridge
132
+ mutate lands in the same host service; describe heals the read path).
133
+
134
+ ### Corrected — 4.1.11 publication note
135
+
136
+ - The 4.1.11 entry said "none of 4.1.5-4.1.10 was published to npm"; **4.1.5
137
+ was published** (npm registry confirms `4.1.5` in versions, and `latest`
138
+ pointed at it until this release line). 4.1.6-4.1.10 indeed never shipped.
139
+ The earlier claim came from reading the npmmirror mirror instead of the
140
+ authoritative registry (registry-pin discipline, B2+).
141
+
142
+ ## 4.1.11 — 2026-10-08
143
+
144
+ ### Fixed — family-section takeover rebuilt (4.1.5 → 4.1.11 arc; none of 4.1.5-4.1.10 was published to npm)
145
+
146
+ - **4.1.5 "half backfill" root cause**: the takeover body read `props.hooks.tabs`,
147
+ but the host's `bindInjectHooks` strips an inject face's `hooks` key into
148
+ `use<Tab>` props on every generation — the component threw, the slot abdicated,
149
+ and the takeover body never rendered anywhere. It now reads the `useTabs`
150
+ compartment first, with a raw-hooks `useState`/`useEffect` fallback.
151
+ - **Apply-time inject registration (4.1.10)**: the slots core fires inject
152
+ factories only on declaration events (= the settings panel opening), so the
153
+ grace-delayed registration of 4.1.7/4.1.8 waited for a declaration that never
154
+ came. The `settings.section` inject now registers at apply time.
155
+ - **Deferred yield-election (4.1.11)**: ≤0.1.7 shells give every same-id section
156
+ entry its own nav row — the old "priority-10 shadow stays invisible" assumption
157
+ produced a double 起子插件设置 row on all five farm cells. The factory now waits
158
+ 500 ms after the declaration batch and stands down when a `dsh-family` entry is
159
+ already seated (thinking-levels head); it takes over only when TL is absent.
160
+ Verified single-row on all five farm cells (0.1.0 → 0.1.7), pairing with
161
+ dsh-thinking-levels 4.2.0-beta.26's symmetric stand-down.
162
+
163
+ ## 4.0.0 — 2026-09-29
164
+
165
+ ### Changed
166
+ - **DSH 0.2.0 line adaptation**: `engines.dsh` and the four `@deepseek-ai/dsh-client-*` peers move to `>=0.2.0-rc.1 <0.2.1-0` (replacing the 0.1.7 ranges); npm dist-tag `dsh-0.2.0`; manifest version aligned to `4.0.0`. The plugin-facing API surface (manifest / settings / HMR / slots / session v4) is unchanged from 0.1.7 — no runtime code changes.
167
+ - `@deepseek-ai/cordis` peer floor aligned to `^4.0.4` (the 0.2.0-rc.1 host UI packages declare `~4.0.4`; the previous `^4.0.1` accepted it but understated the floor).
168
+
169
+ ### Fixed
170
+ - `src/client/family-section.tsx` landed in version control (it had existed only in the working tree since 3.2.x, so a clean checkout could not build).
171
+ - eslint flat config: dropped the core `no-unused-vars` rule — it mis-flags TS type-signature parameters; the typescript-eslint variant is kept, and the lint baseline is green again.
172
+ - v4 source-kind static gates (`tests/source-kind.test.mjs`) are now tracked and run in `npm test` (248 tests).
173
+
174
+ ## 3.2.4 — 2026-09-27
175
+
176
+ ### Fixed
177
+ - **Session format v4 adaptation (host >= 0.1.7-rc.1)**: the three session-writing paths no longer use the retired `source: { kind: 'plugin', plugin: 'session-guard' }` signature, which the v4 host rejects with `SessionFormatError` (whole round fails). All three now use the producer-owned kind:
178
+ - delayed-resume notice injection (`src/wiring.js`);
179
+ - auto-retry notice injection (`src/retry.js`);
180
+ - pause-resume followup (`src/pause-gate.js`, ```kind: `plugin:${pluginId}````).
181
+ - **tool-result v4 native adaptation (N1)**: `findToolOutcome` in `src/pause-gate.js` now reads the v4 first-class `role:'tool'` message (`toolCallId`/`isError` at message top level) first; the v3 `tool-result` block path is kept as historical fallback. Without this, a failed tool at pause time was reported as completed on resume ("do not re-run") — a silent wrong decision. `src/tool-call-id.js` reads the native top-level id first; stale 0.1.1/0.1.2-era header notes corrected to the three-shape generation table.
182
+ `form` and all other fields are unchanged; the host's own v3-to-v4 migration lifts existing legacy rows, so no historical data is rewritten. Evidence: `@deepseek-ai/dsh-session-format-v3-to-v4@0.1.7-rc.2` validates only that `source.kind` is non-empty and not `'plugin'`.
183
+
184
+ ## 0.4.0 — 2026-09-18 (mis-versioned; superseded by 3.0.0)
185
+
186
+ ### Fixed
187
+
188
+ - **Version identity.** This line was published as `0.4.0` while `dsh.plugin.json` and this
189
+ changelog already said `3.0.0` — one artifact with two version numbers. `package.json` is now
190
+ `3.0.0`, so the package version, the manifest version and the changelog agree. `0.4.0` is kept
191
+ here as a historical record because npm versions are immutable; `dist-tag dsh-0.1.5` should be
192
+ repointed to `3.0.0` once it is published.
193
+ - **Docs.** README/INSTALL (zh/en/ja/ko) no longer describe the sibling line as living on `main`.
194
+ The 0.1.2 line's release branch is **`legacy/0.1.2`** (npm dist-tag `dsh-0.1.2`, version `0.3.1`);
195
+ `main` is frozen at `0.2.0-beta.1`. The duplicated branch fragment in the INSTALL.zh/ja/ko install
196
+ command is fixed, explicit dist-tag install commands are documented, and "2.x / 3.x" is
197
+ now marked as a **line nickname** rather than a version number.
198
+
199
+ ### Notes
200
+
201
+ - **No source changes** relative to `3.0.0`; `0.4.0` is a packaging-only publish of the same tree.
202
+
203
+ ## 3.0.0 — 2026-09-14
204
+
205
+ ### Changed
206
+
207
+ - **DSH v0.1.5-rc.2 dedicated line (`compat/0.1.5`).** `engines.dsh` and the `dsh-client-*`
208
+ peer ranges narrow to `>=0.1.5-rc.2 <0.2.0-0` (strict-semver prerelease matching means the
209
+ old `>=0.1.0-rc.7` range never matches `0.1.5-rc.2`); `dsh.plugin.json` gains `engines.dsh`.
210
+ The 2.x / 0.2.x line on `main` keeps serving DSH 0.1.0-rc.7 … 0.1.2-rc.1.
211
+ - **`session.events` → `snapshotEvents()`.** DSH 0.1.5 removed the `session.events` array
212
+ accessor (compatibility-guide §20.3). `pause-gate.js` now reads session events through a
213
+ dual-path helper: `snapshotEvents()` first, the legacy `events` array as a defensive
214
+ fallback, `null` (fail-open) when neither exists. Affects `findToolOutcome` and
215
+ `lastUserPrompt` only; event-type matching is unchanged.
216
+
217
+ ### Unchanged
218
+
219
+ - Zero changes on every other integration seam: the self-held webServer prefix route
220
+ (`/session-guard/rpc`), `settings.register`, the `settings.plugin.item` card slot,
221
+ client injections, and `llm.listConfigurableProviders()` are all verified intact against
222
+ the published 0.1.5-rc.2 bundle (`tools/check-api-drift.ps1`, 12/12 required assertions).
223
+
224
+ ### Pending
225
+
226
+ - Live smoke on a real DSH 0.1.5-rc.2 host (same status as the perm-gate 0.1.5 line).
227
+
228
+ ## 0.2.0-beta.2 — 2026-09-13
229
+
230
+ ### Fixed (DSH 0.1.5 compat — `compat/0.1.5` branch)
231
+
232
+ - **Dual-path resume enqueue.** DSH 0.1.5 turns the Inbox into an agent-loop read-only
233
+ projection, so `agent.followup` may no longer exist. The resume flow now tries
234
+ `agent.followup` first, falls back to `agent.send`, and degrades to a warn (never throws)
235
+ when neither is available — a failed enqueue can no longer break resume.
236
+ - **Resume messages carry `source.form: 'instructions'`** per the 0.1.5 `ContextFormed`
237
+ message-source contract (`kind: 'plugin'` is a built-in kind; older DSH versions ignore
238
+ the extra field).
239
+ - **`webServer.register` is wrapped in try/catch**: a failed route registration now logs an
240
+ error instead of throwing out of `apply` and breaking host plugin loading.
241
+ - Verified against the 0.1.5-rc.2 source: the `WebRoute` contract (exact/prefix + SSE) is
242
+ unchanged, so client `fetch('/session-guard/...')` paths need no `/api` prefix.
243
+
244
+ ## 0.2.0-beta.1 — 2026-09-10
245
+
246
+ ### Added
247
+
248
+ - **Step-level gate (`agent/pre-step`).** During peak hours the turn is now held **before** the
249
+ next step's model request instead of being interrupted at a turn boundary: the session keeps
250
+ running until the next `agent/pre-step`, where the gate holds it (setting `stepLevelPause`, on by
251
+ default). The turn resumes **in place** off-peak — no followup message needed. Hold conditions:
252
+ peak (Beijing time) + not weekend + `step > 1` + official target provider (`providerGuard`) +
253
+ not request-held + not bypassed in this peak window. New module `src/step-gate.js` (pure
254
+ `decideStepHold` + hold / release / abort / timeout engine).
255
+ - **`stepResume` port + RPC + `/resume`.** `sessionGuard.stepResume(sessionId, {bypass})`,
256
+ `POST /session-guard/rpc {action:'stepResume'}` and `/resume` all release the gate; a manual
257
+ resume also stops gating that session for the rest of the peak window.
258
+ - **Timeout escalation.** `stepGateTimeoutMs` (default 300000) releases the gate and escalates to a
259
+ turn-level **force** pause, so a long peak neither deadlocks nor drips one step every five minutes.
260
+ - **"⏸ Pause session" button** (client, slot `conversation.input.right`, id `session-guard-pause`,
261
+ order 20 — left of input-traffic's freeze button). It polls `/session-guard/state` once a second,
262
+ stays disabled while nothing is held, and calls `stepResume` when it is. The status badge moved to
263
+ order 40 and now reports the number of step-held sessions.
264
+ - **New settings**: `stepLevelPause`, `stepGateTimeoutMs`.
265
+ - **New state**: `GET /session-guard/state` now returns `paused: { step, turn }` and
266
+ `stepGate: { held, since, bypass }`; `/status` returns `stepHeld`; `/diag` returns `stepGate`.
267
+ The service port's `state().paused` stays boolean for compatibility (new field `pausedStep`).
268
+
269
+ ### Fixed
270
+
271
+ - **Deadlock between a held step and a turn-level pause.** `pauseTask` / `resumeTask` /
272
+ `cancelTask` now release the step gate first: a step hold sits at `agent/pre-step`, where no
273
+ `assistant/message` or `tool/result` can ever arrive, so a `safe` pause used to wait forever and
274
+ never persisted `paused`.
275
+
276
+ ### Changed
277
+
278
+ - **Peak entry no longer interrupts running turns** when `stepLevelPause` is on (`onEnterPeak` arms
279
+ the step gate instead of calling `stopNextTurn`); with it off the previous turn-level behaviour is
280
+ unchanged.
281
+ - input-traffic's freeze button label is now **"Freeze & append"** (`冻结追加` / `凍結して追加` /
282
+ `동결 후 추가`), and its resume label **"Resume & append"** (`恢复追加` / `再開して追加` /
283
+ `재개 후 추가`) — it freezes the turn and keeps queued messages, distinct from the pause button.
284
+ - **The pause button is a toggle now**: "Pause session" / "Resume session" (no disabled grey state).
285
+ Clicking "Pause session" calls the new `stepPause` action, which holds the session at the **next
286
+ step boundary** (step 1 included, regardless of peak or provider); "Resume session" calls
287
+ `stepResume`. New port method `sessionGuard.stepPause(sessionId)`.
288
+ - **SSE push**: new route `GET /session-guard/events?session=<id>` pushes step-gate state changes the
289
+ moment they happen, so peak auto-holds flip the button to "Resume session" without waiting for a
290
+ poll; the 10s `/session-guard/state` poll remains as a fallback. `/state` now reports
291
+ `paused.manual` and `stepGate.manual`.
292
+ - **Styling aligned** with input-traffic's composer button (24px height, 6px radius, 12px font, the
293
+ same border/hover/pressed tokens) for both the pause button and the status badge; styles are
294
+ injected once via `<style data-plugin-css="session-guard-client">`.
295
+
296
+ ## Unreleased
297
+
298
+ ### Added
299
+
300
+ - **Official-source two-dimensional guard (peak × target provider).** Peak hours now block only
301
+ requests whose target route is a DeepSeek official source; local/third-party providers keep
302
+ running. Verdict order: explicit `officialProviders` id list → live `baseURL` endpoint →
303
+ catalog builtin endpoint (pi-ai's `deepseek`) → builtin id (`deepseek-official`); each verdict
304
+ reports `matchedBy`. New modules: `src/provider.js` (pure), `src/provider-directory.js`,
305
+ `src/deferrals.js`, `src/request-guard.js`, `src/targets.js`, `src/wiring.js`.
306
+ - **Request-level backstop (`agent/request`).** Covers sessions started after peak entry and
307
+ sessions switched to an official source mid-run — the 30s tick only handled sessions that were
308
+ already `running` at the transition. Default `hold` mode suspends the request without an error
309
+ and releases it at the exact off-peak instant (`msUntilOffPeak`); `error` mode throws a
310
+ recognizable `PEAK_DEFERRED` failure and records a deferral for off-peak resume.
311
+ - **New settings**: `providerGuard`, `officialProviders`, `officialBaseURLs`, `deferredResume`,
312
+ `deferredResumeText`, `deferredMode`, `deferredMaxHoldMs` (default 6h), `guardSubagents`.
313
+ - **New routes**: `GET /session-guard/provider?provider=<id>` (verdict diagnostics);
314
+ `/session-guard/status` now reports `providerGuard` / `held` / `deferred`;
315
+ `/session-guard/state` reports the session's last target.
316
+ - **Drift guard** `tools/check-api-drift.ps1` asserting the required APIs exist on
317
+ `dsh-v0.1.1-rc.2` / `dsh-v0.1.2-rc.1` / `dsh-v0.1.3-alpha.2` / `dsh-v0.1.5-alpha.1`.
318
+
319
+ ### Changed
320
+
321
+ - **DSH dual-version support (0.1.0-rc.7 … 0.1.2-rc.1).** One artifact now covers both
322
+ `dsh-v0.1.1-rc.2` and `dsh-v0.1.2-rc.1`. The `tool/result` call-id dual read
323
+ (`content[].toolCallId` first, `source.callId` fallback — both forms appear in replay logs of
324
+ both versions) is extracted to the dependency-free `src/tool-call-id.js` with unit tests.
325
+ `dsh.client.inject` no longer names `@deepseek-ai/dsh-client-runtime` (removed in 0.1.2) or
326
+ `@deepseek-ai/dsh-client-ui-slots` (not a dynamic client row); peer ranges widened to
327
+ `>=0.1.0-rc.7 <0.2.0-0` and the removed package dropped. Added `engines.dsh` and a
328
+ version-compatibility table to the README (ZH/EN).
329
+ - **Settings surface stays on the intersection API**: `settings.register` + `settings.get` only;
330
+ `installSection` (0.1.2+) and the removed `installSettingsSection` are never used. Optional
331
+ APIs (`model/selection`, `llm.listConfigurableProviders`, `settings.get`) are feature-probed and
332
+ degrade instead of throwing.
333
+ - **`src/retry.js` short-circuits only the exact `PEAK_DEFERRED` sentinel.** 429 / `RATE_LIMIT` /
334
+ `TRANSPORT` / timeout failures remain transient, so DSH's global retry (`dsh-llm-retry` on
335
+ `agent/request-error`) and this plugin's own retry semantics are unchanged. `dsh-llm-retry`
336
+ itself is never touched.
337
+ - Badge distinguishes "peak · official only" from "peak · all paused".
338
+
339
+ ## 0.1.4 — 2026-09-09
340
+
341
+ ### Changed
342
+
343
+ - **Public beta release** of the dual-version line (`0.1.4-beta.1`): version metadata, README
344
+ compatibility table and package metadata aligned for the beta channel.
345
+
346
+ ## 0.1.3 — 2026-09-09
347
+
348
+ ### Fixed
349
+
350
+ - **package.json encoding restored**: description was corrupted (GB2312 bytes misread as UTF-8); rewritten with correct Chinese text.
351
+ - **Missing metadata**: added `repository`, `homepage` fields.
352
+ - **peerDependencies corrected**: removed pinned `dsh-llm` exact version; added `cordis`, `dsh-client-runtime`, `dsh-client-locale`, `dsh-client-ui-settings`, `dsh-client-ui-slots` as optional peers matching `dsh.client.inject`.
353
+ - Added `dsh.plugin.json` manifest.
354
+
355
+ ## 0.1.2 — 2026-08-28
356
+
357
+ ### Fixed
358
+
359
+ - **Peak timezone fixed**: 峰谷判定固定北京时间 (`BILLING_TIMEZONE`),周末判定用配置时区。
360
+
361
+ ## 0.1.1 — 2026-08-24
362
+
363
+ ### Added
364
+
365
+ - **Backend auto-retry (D9)**: `turn/end` transient failures (error/429/max-tokens) trigger adaptive-backoff `followup(retryText)` resume; permanent failures (auth/balance/model/context limit) stop; user intervention or successful turn resets consecutive failure count.
366
+ - **Freeze/gate yield**: retry skips when `isFrozen(sessionId)` is true (queueLocked / paused / taskControl paused), never bypasses the session gate.
367
+
368
+ ### Changed
369
+
370
+ - `sessionGuard` redundant port now exposes `state(sessionId)` returning `{ queueLocked, lockReason, paused, taskControlAvailable, taskControl }`.
371
+ - HTTP route `GET /session-guard/diag` returns runtime diagnostics including retry state.
372
+
373
+ ### Fixed
374
+
375
+ - Weekend detection now uses `Intl.DateTimeFormat` with the configured timezone instead of bare `getUTCDay()`, fixing an 8-hour boundary bug for Beijing timezone.
376
+
377
+ ## 0.1.0 — 2026-08-18
378
+
379
+ ### Added
380
+
381
+ - Initial release: peak auto-pause (global), weekend mode, per-session freeze/resume via `sessionGuard` redundant port + RPC bridge, custom session gate (`agent.cancel keepInbox + goals.pause + session/event safe boundary + followup resume`), settings panel (Settings → Plugins → session-guard).