dsh-session-guard 4.3.0 → 4.4.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/CHANGELOG.md CHANGED
@@ -1,402 +1,415 @@
1
- # Changelog
2
-
3
- ## 4.3.0 (2026-11-19)
4
-
5
- - **内置 2027 全年放假表:34 条 = 29 放假日 + 5 调休补班日**(国务院公告 `content_7085102`,经 holiday-cn 机读;快照指纹 `sha256:8f999d47…9780331af`)。此前内置档只有 2026,2027 完全依赖联网抓取——离线部署、或钉了 `DSH_SESSION_GUARD_HOLIDAY_FETCH=0` 的机器,在 2027 会把春节 10 天长假与 5 个补班周末全判成普通工作日。现在内置打底,**不联网也有正确的休息日语义**。
6
- - 5 个补班日:`2027-01-31`(日)、`2027-02-14`(日)、`2027-05-08`(六)、`2027-09-26`(日)、`2027-10-09`(六)——全部落周末,照常走入峰窗口;春节 2/5–2/13、国庆 10/1–10/7 全天非峰。
7
- - 联网行为不变:远端指纹与内置一致时只记核对时间(不写盘);不一致则在 24h 预算内覆盖内置并落缓存——**内置是兜底,不是枷锁**。
8
- - **测试**:新增 `BUILTIN_2027` 结构断言(34/29/5、补班日必须落周末、春节与国庆连续段、年份自洽、**指纹钉住快照**——上游改表即红,提示同步内置档);`BUILTIN_TABLES` 双年与排序去重断言;store 夹具整体迁到 2028(2026/2027 都已内置,只有 2028 还能测「内置缺表 → 联网补」),并补断「断网档下 2027 春节补班仍被识别」。
9
- - 一并带上 bump 到 4.2.13 后未发布的内容:pt-BR 语言包(运行词典 + package 元数据 + README/INSTALL/CHANGELOG 镜像)、peer 声明面追加 `0.2.2-rc.2`…`rc.5`。
10
- - **全量**:291 tests / 291 pass / 0 fail(lint 干净)。
11
-
12
- ## 4.2.12 (2026-11-17)
13
-
14
- - **修复 issue #4:4.2.11 的 `requestHeld` 投影是死的,按钮永远显示「暂停会话」**。4.2.11 给 `bridge.state()` 加了请求级 hold 投影,但判定入口是 `typeof deferrals.has === 'function'`;而 `index.js` 传给 `createBridge` 的 deferrals 只是个晚绑定壳,**只有 `settle` / `clearDeferred` 两个方法**。于是:
15
- - `st.requestHeld` 恒为 `false`,`/state` 里派生自它的 `paused.request` / `paused.any` / `requestGate.held` 全是 `false`;
16
- - 客户端 `readPauseState()` 恰好只认这三处、不读顶层 `held`,所以峰期被挂起时按钮仍是「暂停会话」;
17
- - 用户点一下只是登记 `manualPause`(按钮翻成「继续会话」),再点才真正放行 —— **表现为「要点两下」**。
18
- - **修法**:壳补齐 `has` / `list` 两个转发方法,未就绪时返回中性值(`false` / `[]`)而不是抛错 —— 构造期 `deferralsRef` 还是 `null`,而 `/state` 随时可能被读到。
19
- - **不变量钉死**:新增 `tests/bridge-deferrals-shell.test.mjs`,从 `bridge.js` 源码里抽出**所有** `deferrals.<name>` 读取点,逐一断言 `index.js` 的壳里有同名键。以后 `bridge.js` 多读一个方法,测试立刻红 —— 不需要有人记得回来同步改壳。这正是 4.2.11 漏掉的那道防线。
20
- - **全量**:289 tests / 289 pass / 0 fail(lint 干净)。
21
- - i18n: add Portuguese (pt-BR) locale — runtime dictionary, package metadata and README/INSTALL/CHANGELOG mirrors.
22
-
23
- ## 4.2.11 (2026-11-17)
24
-
25
- - **修复 issue #3:峰期新会话的请求级 hold 没有手动放行入口**。峰期(如 09:00–12:00)新建会话发第一条消息,请求在 `agent/request` 被 `deferrals.hold()` 挂起;但 step 门只在 `step > 1` 才拉,首条请求停在 step 1,**step 门从未参与**。于是:
26
- - 按钮显示「暂停会话」(`pausedStep=false`),点一下只是登记 `manualPause`、按钮翻成「继续会话」;
27
- - 再点触发 `stepResume()`,而 `stepGate.release()` 因无门可放返回 `{released:false}`,**连 bypass 都不置**;
28
- - 结果请求纹丝不动,只能等退峰 `releaseAll`、abort 或卸载插件才解除。
29
- - **修法三处**:
30
- 1. `bridge.stepResume()` 现在同时结算**请求级 hold**(`deferrals.settle(id, reason, 'release')`,让挂住的 promise 以原 config 继续发出)并清掉延后记录;且**只要用户显式要继续就置 bypass**,不论门来自 step 级还是请求级——否则下一个请求立刻被同一峰期再挂一次,「继续」退化成「点一下放一条」的假放行。
31
- 2. `request-guard` 新增 `isBypassed` 依赖,判定顺序里在「峰期 + 官方源」之后认这个 bypass(fail-open:探测抛错则退回正常拦截,不得当作已放行)。`wiring` 把 step 门的 bypass 集合接进去——step 门与请求门共用同一个「本峰已被用户手动放行」的事实。
32
- 3. 状态投影新增 `requestHeld` / `requestHeldSince` / `pausedAny`,`/state` 的 `paused` 增补 `request` / `any` 并新增 `requestGate`;`readPauseState()` 认这三处,按钮在请求级 hold 时正确显示「继续会话」。
33
- - **顺带修掉报告未提的一个细节**:旧代码点第二次会把 `manualPause` 一并删掉,按钮**又翻回「暂停会话」**,表现为「点两下、按钮闪回去、请求还在挂」。现在 bypass 与 manual 的取舍明确:显式继续 → 置 bypass;显式暂停 → 撤销 bypass(原语义保留)。
34
- - **测试**:`bridge.test.mjs` 新增 5 例(请求级 hold 结算 / 无门也置 bypass / 自动释放不置 bypass / 状态投影认 requestHeld / 无 hold 时行为不变);`request-guard.test.mjs` 新增 3 例(bypass 会话放行 / 只对指定会话生效 / 探测抛错 fail-open 到正常拦截)。契约测试同步新增字段。
35
- - **全量**:286 tests / 286 pass / 0 fail(lint 干净、build 通过)。
36
-
37
- ## 4.2.10
38
-
39
- - 终端面(dsh-tui / Desktop 命令面板同源):/guard 终端面 + 拉门时向会话追加 plugin 源消息(TUI 一行反馈)。
40
-
41
- 4.2.3: host enumeration addendum for DSH 0.2.1-rc.3 (declaration-only bump; contract plane zero diff).
42
-
43
- ## 4.2.2 (2026-10-18)
44
-
45
- - hosts: 追加 0.2.1-rc.2 声明面枚举(34/34 @deepseek-ai/* 宿主 peer 逐包 npm 实测 rc.2 在版;本插件不触 ctx.web provider 与 conversation.input.model.label 槽,代码零改动,纯元数据发版;农场 rc.2 格挂账待命)
46
-
47
- All notable changes to `dsh-session-guard` are recorded here. Versions follow semver.
48
-
49
- - [English changelog](./CHANGELOG.md)
50
- - [日本語 changelog](./CHANGELOG.ja.md)
51
- - [한국어 changelog](./CHANGELOG.ko.md)
52
- - [Changelog en français](./CHANGELOG.fr.md)
53
- - [Changelog auf Deutsch](./CHANGELOG.de.md)
54
- - [Changelog in italiano](./CHANGELOG.it.md)
55
- - [Changelog на русском](./CHANGELOG.ru.md)
56
- - [Changelog en español](./CHANGELOG.es.md)
57
- - [Changelog em português](./CHANGELOG.pt.md)
58
-
59
- ## 4.2.1 — 2026-10-17 (host enumeration: +0.2.1-rc.1)
60
-
61
- ### Fixed
62
- - `engines.dsh` and the four `@deepseek-ai/dsh-client-*` peers append `|| 0.2.1-rc.1` (16-host exact enumeration),
63
- so the host compatibility gate accepts DSH `0.2.1-rc.1`.
64
- - `dsh.plugin.json` `engines.dsh` aligned to the same 16-host enumeration (was the range `>=0.2.0-rc.1 <0.2.1-0`);
65
- the gate only reads `package.json`, but the two lists must not diverge.
66
- - README compatibility statements (zh/de/es/fr/it/ru) synced to the enumeration. No behaviour change in this release.
67
-
68
- ## 4.2.0 — 2026-10-17
69
-
70
- ### Added
71
- - 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).
72
- - 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).
73
-
74
- ### Changed
75
- - 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.
76
-
77
- ### Fixed
78
- - Family claim rank 1 -> 2, aligned with the frozen weighted rank ladder (single source _tools/family-rank.mjs).
79
-
80
- ## 4.1.16 — 2026-10-14 (metadata alignment; backfill the missing 4.1.15 entry)
81
-
82
- ### Fixed
83
-
84
- - `dsh.plugin.json` now carries the same version as `package.json`. The published 4.1.15 tarball
85
- still said 4.1.14 (verified by downloading it from the registry), so the two manifests disagreed in a released artifact.
86
- - No behaviour change in this release.
87
- - Test suite repaired: the structural pin in `tests/settings-bridge.test.mjs` still demanded the
88
- retired gear entry, so the suite had been red since 4.1.15; it now asserts the opposite (absence).
89
-
90
- ## 4.1.15 — 2026-10-08 (backfilled: this entry was never written at release time)
91
-
92
- ### Removed
93
-
94
- - The shell-level `shell.overlay` slot injection: the fixed bottom-right gear button and its
95
- positioned floating layer are gone (`src/client/shell-overlay.tsx` deleted). The settings entry
96
- now relies on the host settings page alone.
97
-
98
- ## 4.1.14 — 2026-10-08
99
-
100
- ### Removed
101
-
102
- ## 4.1.13 — 2026-10-08
103
-
104
- ### Fixed — bridge descriptor skeleton on ≤0.1.5 (five-cell gate catch, 2026-10-08)
105
-
106
- - **Host describe `value` is a field skeleton on ≤0.1.5** (0.1.0/0.1.5 empirical):
107
- the old host generations serialize `descriptor.value` as `{enabled:{},…,officialProviders:{}}`
108
- (one empty object per schema field) while the real merged config lives in
109
- `descriptor.base` (combined defaults) + `descriptor.user` (user layer).
110
- `BridgeDocHandle` consumed `value` verbatim, so `officialProviders` arrived as
111
- `{}` — truthy non-array, invisible to `?? []` — and `ListRow`'s
112
- `values.join` threw, crashing the whole `dsh-family.tab` slot (guard card +
113
- IT card + TL nav all died together). `descriptorPlainValue()` now detects the
114
- skeleton (object whose every own value is an empty plain object — impossible
115
- for guard's scalar/array config) and rebuilds the effective value as
116
- `{...base, ...user}` (shallow merge is exact for guard's flat config).
117
- - **Card-field sanitization (defense in depth)**: any card render error kills
118
- the entire family tab slot on these hosts, so `ListRow` inputs are now
119
- sanitized at the call sites (`toList()` — non-arrays become `[]`) and the
120
- `拦截方式` select falls back to `hold` for any non-`error` value. A malformed
121
- descriptor may degrade one field, never the tab.
122
- - Verified on the five-cell farm gate: describe replays on 0.1.0/0.1.5 now
123
- yield plain merged values; the seeded `stepGateTimeoutMs: 321123` reads back
124
- through the bridge on ≤0.1.5 and natively (configForms) on 0.1.7.
125
-
126
- ## 4.1.12 — 2026-10-08
127
-
128
- ### Added — settings webServer bridge (M4/T20-b): dual-track card data plane
129
-
130
- - **Top-level card registration refactor (prerequisite)**: the three settings
131
- faces (`dsh-family.tab`, `plugins.bundle.config`, `settings.plugin.item`,
132
- `shell.overlay`) were registered inside the `onScope` callback of the dual
133
- scoped-inject waist — on ≤0.1.5 that callback never fires (settingsScope fiber
134
- never resolves; 0.1.0/0.1.1 lack both services), so the cards never registered
135
- and a bridge would have had no consumer. All registrations now run at apply
136
- top level with a `scopeRef` live reference; the callback degrades to a pure
137
- data arm (perm-gate `client/index.ts` L166-257 shape).
138
- - **Server bridge** (`src/settings-bridge.js`): `describe`/`mutate` endpoints at
139
- `/api/session-guard/settings/*` (POST-only, `{ok,value|error}` envelope,
140
- redacted describe filtered to the plugin ns, ops forwarded to the host
141
- settings service with `expectedRevision` optimistic concurrency, 256 KB cap).
142
- Registration is fail-open (error log, never blocks plugin load).
143
- - **Client bridge handle** (`src/client/settings-bridge.ts`): `BridgeDocHandle`
144
- implements the same `SettingsScope` face as the native handles
145
- (getSnapshot/subscribe/set/unset); describe misses retry within a bounded
146
- budget (settings service resolving later than card mount) before landing on
147
- `unavailable`. Card faces read `scopeRef.scope ?? bridgeScope()` — native
148
- first, bridge fallback (perm-gate T13b dual-track). **Generation split in the
149
- data arm (five-cell empirical, 2026-10-08 night)**: on 0.1.2/0.1.5 the
150
- `settingsScope` handle is write-alive but read-dead — `set()` persists to
151
- settings.yaml while `getSnapshot().value` stays `undefined`, so that arm
152
- deliberately leaves `scopeRef` empty and the card falls to the bridge (bridge
153
- mutate lands in the same host service; describe heals the read path).
154
-
155
- ### Corrected — 4.1.11 publication note
156
-
157
- - The 4.1.11 entry said "none of 4.1.5-4.1.10 was published to npm"; **4.1.5
158
- was published** (npm registry confirms `4.1.5` in versions, and `latest`
159
- pointed at it until this release line). 4.1.6-4.1.10 indeed never shipped.
160
- The earlier claim came from reading the npmmirror mirror instead of the
161
- authoritative registry (registry-pin discipline, B2+).
162
-
163
- ## 4.1.11 — 2026-10-08
164
-
165
- ### Fixed — family-section takeover rebuilt (4.1.5 → 4.1.11 arc; none of 4.1.5-4.1.10 was published to npm)
166
-
167
- - **4.1.5 "half backfill" root cause**: the takeover body read `props.hooks.tabs`,
168
- but the host's `bindInjectHooks` strips an inject face's `hooks` key into
169
- `use<Tab>` props on every generation — the component threw, the slot abdicated,
170
- and the takeover body never rendered anywhere. It now reads the `useTabs`
171
- compartment first, with a raw-hooks `useState`/`useEffect` fallback.
172
- - **Apply-time inject registration (4.1.10)**: the slots core fires inject
173
- factories only on declaration events (= the settings panel opening), so the
174
- grace-delayed registration of 4.1.7/4.1.8 waited for a declaration that never
175
- came. The `settings.section` inject now registers at apply time.
176
- - **Deferred yield-election (4.1.11)**: ≤0.1.7 shells give every same-id section
177
- entry its own nav row — the old "priority-10 shadow stays invisible" assumption
178
- produced a double 起子插件设置 row on all five farm cells. The factory now waits
179
- 500 ms after the declaration batch and stands down when a `dsh-family` entry is
180
- already seated (thinking-levels head); it takes over only when TL is absent.
181
- Verified single-row on all five farm cells (0.1.0 → 0.1.7), pairing with
182
- dsh-thinking-levels 4.2.0-beta.26's symmetric stand-down.
183
-
184
- ## 4.0.0 — 2026-09-29
185
-
186
- ### Changed
187
- - **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.
188
- - `@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).
189
-
190
- ### Fixed
191
- - `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).
192
- - 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.
193
- - v4 source-kind static gates (`tests/source-kind.test.mjs`) are now tracked and run in `npm test` (248 tests).
194
-
195
- ## 3.2.4 — 2026-09-27
196
-
197
- ### Fixed
198
- - **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:
199
- - delayed-resume notice injection (`src/wiring.js`);
200
- - auto-retry notice injection (`src/retry.js`);
201
- - pause-resume followup (`src/pause-gate.js`, ```kind: `plugin:${pluginId}````).
202
- - **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.
203
- `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'`.
204
-
205
- ## 0.4.0 — 2026-09-18 (mis-versioned; superseded by 3.0.0)
206
-
207
- ### Fixed
208
-
209
- - **Version identity.** This line was published as `0.4.0` while `dsh.plugin.json` and this
210
- changelog already said `3.0.0` — one artifact with two version numbers. `package.json` is now
211
- `3.0.0`, so the package version, the manifest version and the changelog agree. `0.4.0` is kept
212
- here as a historical record because npm versions are immutable; `dist-tag dsh-0.1.5` should be
213
- repointed to `3.0.0` once it is published.
214
- - **Docs.** README/INSTALL (zh/en/ja/ko) no longer describe the sibling line as living on `main`.
215
- The 0.1.2 line's release branch is **`legacy/0.1.2`** (npm dist-tag `dsh-0.1.2`, version `0.3.1`);
216
- `main` is frozen at `0.2.0-beta.1`. The duplicated branch fragment in the INSTALL.zh/ja/ko install
217
- command is fixed, explicit dist-tag install commands are documented, and "2.x / 3.x" is
218
- now marked as a **line nickname** rather than a version number.
219
-
220
- ### Notes
221
-
222
- - **No source changes** relative to `3.0.0`; `0.4.0` is a packaging-only publish of the same tree.
223
-
224
- ## 3.0.0 — 2026-09-14
225
-
226
- ### Changed
227
-
228
- - **DSH v0.1.5-rc.2 dedicated line (`compat/0.1.5`).** `engines.dsh` and the `dsh-client-*`
229
- peer ranges narrow to `>=0.1.5-rc.2 <0.2.0-0` (strict-semver prerelease matching means the
230
- old `>=0.1.0-rc.7` range never matches `0.1.5-rc.2`); `dsh.plugin.json` gains `engines.dsh`.
231
- The 2.x / 0.2.x line on `main` keeps serving DSH 0.1.0-rc.7 … 0.1.2-rc.1.
232
- - **`session.events` → `snapshotEvents()`.** DSH 0.1.5 removed the `session.events` array
233
- accessor (compatibility-guide §20.3). `pause-gate.js` now reads session events through a
234
- dual-path helper: `snapshotEvents()` first, the legacy `events` array as a defensive
235
- fallback, `null` (fail-open) when neither exists. Affects `findToolOutcome` and
236
- `lastUserPrompt` only; event-type matching is unchanged.
237
-
238
- ### Unchanged
239
-
240
- - Zero changes on every other integration seam: the self-held webServer prefix route
241
- (`/session-guard/rpc`), `settings.register`, the `settings.plugin.item` card slot,
242
- client injections, and `llm.listConfigurableProviders()` are all verified intact against
243
- the published 0.1.5-rc.2 bundle (`tools/check-api-drift.ps1`, 12/12 required assertions).
244
-
245
- ### Pending
246
-
247
- - Live smoke on a real DSH 0.1.5-rc.2 host (same status as the perm-gate 0.1.5 line).
248
-
249
- ## 0.2.0-beta.2 — 2026-09-13
250
-
251
- ### Fixed (DSH 0.1.5 compat — `compat/0.1.5` branch)
252
-
253
- - **Dual-path resume enqueue.** DSH 0.1.5 turns the Inbox into an agent-loop read-only
254
- projection, so `agent.followup` may no longer exist. The resume flow now tries
255
- `agent.followup` first, falls back to `agent.send`, and degrades to a warn (never throws)
256
- when neither is available — a failed enqueue can no longer break resume.
257
- - **Resume messages carry `source.form: 'instructions'`** per the 0.1.5 `ContextFormed`
258
- message-source contract (`kind: 'plugin'` is a built-in kind; older DSH versions ignore
259
- the extra field).
260
- - **`webServer.register` is wrapped in try/catch**: a failed route registration now logs an
261
- error instead of throwing out of `apply` and breaking host plugin loading.
262
- - Verified against the 0.1.5-rc.2 source: the `WebRoute` contract (exact/prefix + SSE) is
263
- unchanged, so client `fetch('/session-guard/...')` paths need no `/api` prefix.
264
-
265
- ## 0.2.0-beta.1 — 2026-09-10
266
-
267
- ### Added
268
-
269
- - **Step-level gate (`agent/pre-step`).** During peak hours the turn is now held **before** the
270
- next step's model request instead of being interrupted at a turn boundary: the session keeps
271
- running until the next `agent/pre-step`, where the gate holds it (setting `stepLevelPause`, on by
272
- default). The turn resumes **in place** off-peak — no followup message needed. Hold conditions:
273
- peak (Beijing time) + not weekend + `step > 1` + official target provider (`providerGuard`) +
274
- not request-held + not bypassed in this peak window. New module `src/step-gate.js` (pure
275
- `decideStepHold` + hold / release / abort / timeout engine).
276
- - **`stepResume` port + RPC + `/resume`.** `sessionGuard.stepResume(sessionId, {bypass})`,
277
- `POST /session-guard/rpc {action:'stepResume'}` and `/resume` all release the gate; a manual
278
- resume also stops gating that session for the rest of the peak window.
279
- - **Timeout escalation.** `stepGateTimeoutMs` (default 300000) releases the gate and escalates to a
280
- turn-level **force** pause, so a long peak neither deadlocks nor drips one step every five minutes.
281
- - **"⏸ Pause session" button** (client, slot `conversation.input.right`, id `session-guard-pause`,
282
- order 20 — left of input-traffic's freeze button). It polls `/session-guard/state` once a second,
283
- stays disabled while nothing is held, and calls `stepResume` when it is. The status badge moved to
284
- order 40 and now reports the number of step-held sessions.
285
- - **New settings**: `stepLevelPause`, `stepGateTimeoutMs`.
286
- - **New state**: `GET /session-guard/state` now returns `paused: { step, turn }` and
287
- `stepGate: { held, since, bypass }`; `/status` returns `stepHeld`; `/diag` returns `stepGate`.
288
- The service port's `state().paused` stays boolean for compatibility (new field `pausedStep`).
289
-
290
- ### Fixed
291
-
292
- - **Deadlock between a held step and a turn-level pause.** `pauseTask` / `resumeTask` /
293
- `cancelTask` now release the step gate first: a step hold sits at `agent/pre-step`, where no
294
- `assistant/message` or `tool/result` can ever arrive, so a `safe` pause used to wait forever and
295
- never persisted `paused`.
296
-
297
- ### Changed
298
-
299
- - **Peak entry no longer interrupts running turns** when `stepLevelPause` is on (`onEnterPeak` arms
300
- the step gate instead of calling `stopNextTurn`); with it off the previous turn-level behaviour is
301
- unchanged.
302
- - input-traffic's freeze button label is now **"Freeze & append"** (`冻结追加` / `凍結して追加` /
303
- `동결 후 추가`), and its resume label **"Resume & append"** (`恢复追加` / `再開して追加` /
304
- `재개 후 추가`) — it freezes the turn and keeps queued messages, distinct from the pause button.
305
- - **The pause button is a toggle now**: "Pause session" / "Resume session" (no disabled grey state).
306
- Clicking "Pause session" calls the new `stepPause` action, which holds the session at the **next
307
- step boundary** (step 1 included, regardless of peak or provider); "Resume session" calls
308
- `stepResume`. New port method `sessionGuard.stepPause(sessionId)`.
309
- - **SSE push**: new route `GET /session-guard/events?session=<id>` pushes step-gate state changes the
310
- moment they happen, so peak auto-holds flip the button to "Resume session" without waiting for a
311
- poll; the 10s `/session-guard/state` poll remains as a fallback. `/state` now reports
312
- `paused.manual` and `stepGate.manual`.
313
- - **Styling aligned** with input-traffic's composer button (24px height, 6px radius, 12px font, the
314
- same border/hover/pressed tokens) for both the pause button and the status badge; styles are
315
- injected once via `<style data-plugin-css="session-guard-client">`.
316
-
317
- ## Unreleased
318
-
319
- ### Added
320
-
321
- - **Official-source two-dimensional guard (peak × target provider).** Peak hours now block only
322
- requests whose target route is a DeepSeek official source; local/third-party providers keep
323
- running. Verdict order: explicit `officialProviders` id list → live `baseURL` endpoint →
324
- catalog builtin endpoint (pi-ai's `deepseek`) → builtin id (`deepseek-official`); each verdict
325
- reports `matchedBy`. New modules: `src/provider.js` (pure), `src/provider-directory.js`,
326
- `src/deferrals.js`, `src/request-guard.js`, `src/targets.js`, `src/wiring.js`.
327
- - **Request-level backstop (`agent/request`).** Covers sessions started after peak entry and
328
- sessions switched to an official source mid-run — the 30s tick only handled sessions that were
329
- already `running` at the transition. Default `hold` mode suspends the request without an error
330
- and releases it at the exact off-peak instant (`msUntilOffPeak`); `error` mode throws a
331
- recognizable `PEAK_DEFERRED` failure and records a deferral for off-peak resume.
332
- - **New settings**: `providerGuard`, `officialProviders`, `officialBaseURLs`, `deferredResume`,
333
- `deferredResumeText`, `deferredMode`, `deferredMaxHoldMs` (default 6h), `guardSubagents`.
334
- - **New routes**: `GET /session-guard/provider?provider=<id>` (verdict diagnostics);
335
- `/session-guard/status` now reports `providerGuard` / `held` / `deferred`;
336
- `/session-guard/state` reports the session's last target.
337
- - **Drift guard** `tools/check-api-drift.ps1` asserting the required APIs exist on
338
- `dsh-v0.1.1-rc.2` / `dsh-v0.1.2-rc.1` / `dsh-v0.1.3-alpha.2` / `dsh-v0.1.5-alpha.1`.
339
-
340
- ### Changed
341
-
342
- - **DSH dual-version support (0.1.0-rc.7 … 0.1.2-rc.1).** One artifact now covers both
343
- `dsh-v0.1.1-rc.2` and `dsh-v0.1.2-rc.1`. The `tool/result` call-id dual read
344
- (`content[].toolCallId` first, `source.callId` fallback — both forms appear in replay logs of
345
- both versions) is extracted to the dependency-free `src/tool-call-id.js` with unit tests.
346
- `dsh.client.inject` no longer names `@deepseek-ai/dsh-client-runtime` (removed in 0.1.2) or
347
- `@deepseek-ai/dsh-client-ui-slots` (not a dynamic client row); peer ranges widened to
348
- `>=0.1.0-rc.7 <0.2.0-0` and the removed package dropped. Added `engines.dsh` and a
349
- version-compatibility table to the README (ZH/EN).
350
- - **Settings surface stays on the intersection API**: `settings.register` + `settings.get` only;
351
- `installSection` (0.1.2+) and the removed `installSettingsSection` are never used. Optional
352
- APIs (`model/selection`, `llm.listConfigurableProviders`, `settings.get`) are feature-probed and
353
- degrade instead of throwing.
354
- - **`src/retry.js` short-circuits only the exact `PEAK_DEFERRED` sentinel.** 429 / `RATE_LIMIT` /
355
- `TRANSPORT` / timeout failures remain transient, so DSH's global retry (`dsh-llm-retry` on
356
- `agent/request-error`) and this plugin's own retry semantics are unchanged. `dsh-llm-retry`
357
- itself is never touched.
358
- - Badge distinguishes "peak · official only" from "peak · all paused".
359
-
360
- ## 0.1.4 — 2026-09-09
361
-
362
- ### Changed
363
-
364
- - **Public beta release** of the dual-version line (`0.1.4-beta.1`): version metadata, README
365
- compatibility table and package metadata aligned for the beta channel.
366
-
367
- ## 0.1.3 — 2026-09-09
368
-
369
- ### Fixed
370
-
371
- - **package.json encoding restored**: description was corrupted (GB2312 bytes misread as UTF-8); rewritten with correct Chinese text.
372
- - **Missing metadata**: added `repository`, `homepage` fields.
373
- - **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`.
374
- - Added `dsh.plugin.json` manifest.
375
-
376
- ## 0.1.2 — 2026-08-28
377
-
378
- ### Fixed
379
-
380
- - **Peak timezone fixed**: 峰谷判定固定北京时间 (`BILLING_TIMEZONE`),周末判定用配置时区。
381
-
382
- ## 0.1.1 — 2026-08-24
383
-
384
- ### Added
385
-
386
- - **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.
387
- - **Freeze/gate yield**: retry skips when `isFrozen(sessionId)` is true (queueLocked / paused / taskControl paused), never bypasses the session gate.
388
-
389
- ### Changed
390
-
391
- - `sessionGuard` redundant port now exposes `state(sessionId)` returning `{ queueLocked, lockReason, paused, taskControlAvailable, taskControl }`.
392
- - HTTP route `GET /session-guard/diag` returns runtime diagnostics including retry state.
393
-
394
- ### Fixed
395
-
396
- - Weekend detection now uses `Intl.DateTimeFormat` with the configured timezone instead of bare `getUTCDay()`, fixing an 8-hour boundary bug for Beijing timezone.
397
-
398
- ## 0.1.0 — 2026-08-18
399
-
400
- ### Added
401
-
402
- - 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).
1
+ # Changelog
2
+
3
+ ## 4.4.1 (2026-11-25)
4
+
5
+ - feat(guide): 「重新查看引导」入口从卡底移到卡顶(`sgCardBody` 首位、`GuidePanel` 之前),与其他八个接了统一引导的插件同形态。跳过标记与三步正文逐字未动(`dsh.guide.session-guard.skipped`)。
6
+
7
+ ## 4.4.0 (2026-11-24)
8
+
9
+ - **新增首次使用引导(3 步)**:设置卡首次打开时先教三件事——它会替你踩刹车(峰期暂停、退峰续跑、周末模式)、判定口径按官方源(默认只拦 DeepSeek 官方源)、状态永远可见(输入框右侧徽标 + 手动暂停按钮)。写在卡片最上方,不打断既有表单。
10
+ - **引导支持十语外壳 + 恒定可见的 Skip**:标题 / 跳过 / 上一步 / 下一步 / 开始使用 / 重新查看引导七个词自带 zh·en·ja·ko·fr·de·it·ru·es·pt 十语,按 `<html lang>` 取词,认不出的语言落 en——绝不出现空白。步骤正文当前为 zh / en,其它语种走回退链落 en。
11
+ - **重开入口**:卡片底部恒定一行「重新查看引导」,跳过或看完之后就地重开,不需要清浏览器存储。跳过与「开始使用」都写 `dsh.guide.session-guard.skipped`,即「看过就不再自动弹」。
12
+ - **引导件是跨插件统一件**:`src/client/guide.tsx` 由 `mine-dsh-plugins/_tools/guide-kit/guide.tsx` 生成(顶部有勿手改横幅),九个自有插件共用同一套交互。样式注入与存储访问全部能力探测 + try/catch,引导本身绝不成为卡面渲染的失败点。
13
+ - **新增语言守卫棘轮**:`tests/locale-guard.mjs` + `tests/_locale-baseline.json` 钉住硬编码 CJK 计数只降不升;引导件两个文件按设计登记白名单(引导外壳刻意独立于插件字典)。
14
+ - **全量**:293 tests / 293 pass / 0 fail。
15
+
16
+ ## 4.3.0 (2026-11-19)
17
+
18
+ - **内置 2027 全年放假表:34 条 = 29 放假日 + 5 调休补班日**(国务院公告 `content_7085102`,经 holiday-cn 机读;快照指纹 `sha256:8f999d47…9780331af`)。此前内置档只有 2026,2027 完全依赖联网抓取——离线部署、或钉了 `DSH_SESSION_GUARD_HOLIDAY_FETCH=0` 的机器,在 2027 会把春节 10 天长假与 5 个补班周末全判成普通工作日。现在内置打底,**不联网也有正确的休息日语义**。
19
+ - 5 个补班日:`2027-01-31`(日)、`2027-02-14`(日)、`2027-05-08`(六)、`2027-09-26`(日)、`2027-10-09`(六)——全部落周末,照常走入峰窗口;春节 2/5–2/13、国庆 10/1–10/7 全天非峰。
20
+ - 联网行为不变:远端指纹与内置一致时只记核对时间(不写盘);不一致则在 24h 预算内覆盖内置并落缓存——**内置是兜底,不是枷锁**。
21
+ - **测试**:新增 `BUILTIN_2027` 结构断言(34/29/5、补班日必须落周末、春节与国庆连续段、年份自洽、**指纹钉住快照**——上游改表即红,提示同步内置档);`BUILTIN_TABLES` 双年与排序去重断言;store 夹具整体迁到 2028(2026/2027 都已内置,只有 2028 还能测「内置缺表 → 联网补」),并补断「断网档下 2027 春节补班仍被识别」。
22
+ - 一并带上 bump 到 4.2.13 后未发布的内容:pt-BR 语言包(运行词典 + package 元数据 + README/INSTALL/CHANGELOG 镜像)、peer 声明面追加 `0.2.2-rc.2`…`rc.5`。
23
+ - **全量**:291 tests / 291 pass / 0 fail(lint 干净)。
24
+
25
+ ## 4.2.12 (2026-11-17)
26
+
27
+ - **修复 issue #4:4.2.11 的 `requestHeld` 投影是死的,按钮永远显示「暂停会话」**。4.2.11 给 `bridge.state()` 加了请求级 hold 投影,但判定入口是 `typeof deferrals.has === 'function'`;而 `index.js` 传给 `createBridge` 的 deferrals 只是个晚绑定壳,**只有 `settle` / `clearDeferred` 两个方法**。于是:
28
+ - `st.requestHeld` 恒为 `false`,`/state` 里派生自它的 `paused.request` / `paused.any` / `requestGate.held` 全是 `false`;
29
+ - 客户端 `readPauseState()` 恰好只认这三处、不读顶层 `held`,所以峰期被挂起时按钮仍是「暂停会话」;
30
+ - 用户点一下只是登记 `manualPause`(按钮翻成「继续会话」),再点才真正放行 —— **表现为「要点两下」**。
31
+ - **修法**:壳补齐 `has` / `list` 两个转发方法,未就绪时返回中性值(`false` / `[]`)而不是抛错 —— 构造期 `deferralsRef` 还是 `null`,而 `/state` 随时可能被读到。
32
+ - **不变量钉死**:新增 `tests/bridge-deferrals-shell.test.mjs`,从 `bridge.js` 源码里抽出**所有** `deferrals.<name>` 读取点,逐一断言 `index.js` 的壳里有同名键。以后 `bridge.js` 多读一个方法,测试立刻红 —— 不需要有人记得回来同步改壳。这正是 4.2.11 漏掉的那道防线。
33
+ - **全量**:289 tests / 289 pass / 0 fail(lint 干净)。
34
+ - i18n: add Portuguese (pt-BR) locale — runtime dictionary, package metadata and README/INSTALL/CHANGELOG mirrors.
35
+
36
+ ## 4.2.11 (2026-11-17)
37
+
38
+ - **修复 issue #3:峰期新会话的请求级 hold 没有手动放行入口**。峰期(如 09:00–12:00)新建会话发第一条消息,请求在 `agent/request` 被 `deferrals.hold()` 挂起;但 step 门只在 `step > 1` 才拉,首条请求停在 step 1,**step 门从未参与**。于是:
39
+ - 按钮显示「暂停会话」(`pausedStep=false`),点一下只是登记 `manualPause`、按钮翻成「继续会话」;
40
+ - 再点触发 `stepResume()`,而 `stepGate.release()` 因无门可放返回 `{released:false}`,**连 bypass 都不置**;
41
+ - 结果请求纹丝不动,只能等退峰 `releaseAll`、abort 或卸载插件才解除。
42
+ - **修法三处**:
43
+ 1. `bridge.stepResume()` 现在同时结算**请求级 hold**(`deferrals.settle(id, reason, 'release')`,让挂住的 promise 以原 config 继续发出)并清掉延后记录;且**只要用户显式要继续就置 bypass**,不论门来自 step 级还是请求级——否则下一个请求立刻被同一峰期再挂一次,「继续」退化成「点一下放一条」的假放行。
44
+ 2. `request-guard` 新增 `isBypassed` 依赖,判定顺序里在「峰期 + 官方源」之后认这个 bypass(fail-open:探测抛错则退回正常拦截,不得当作已放行)。`wiring` 把 step 门的 bypass 集合接进去——step 门与请求门共用同一个「本峰已被用户手动放行」的事实。
45
+ 3. 状态投影新增 `requestHeld` / `requestHeldSince` / `pausedAny`,`/state` 的 `paused` 增补 `request` / `any` 并新增 `requestGate`;`readPauseState()` 认这三处,按钮在请求级 hold 时正确显示「继续会话」。
46
+ - **顺带修掉报告未提的一个细节**:旧代码点第二次会把 `manualPause` 一并删掉,按钮**又翻回「暂停会话」**,表现为「点两下、按钮闪回去、请求还在挂」。现在 bypass 与 manual 的取舍明确:显式继续 → 置 bypass;显式暂停 → 撤销 bypass(原语义保留)。
47
+ - **测试**:`bridge.test.mjs` 新增 5 例(请求级 hold 结算 / 无门也置 bypass / 自动释放不置 bypass / 状态投影认 requestHeld / 无 hold 时行为不变);`request-guard.test.mjs` 新增 3 例(bypass 会话放行 / 只对指定会话生效 / 探测抛错 fail-open 到正常拦截)。契约测试同步新增字段。
48
+ - **全量**:286 tests / 286 pass / 0 fail(lint 干净、build 通过)。
49
+
50
+ ## 4.2.10
51
+
52
+ - 终端面(dsh-tui / Desktop 命令面板同源):/guard 终端面 + 拉门时向会话追加 plugin 源消息(TUI 一行反馈)。
53
+
54
+ 4.2.3: host enumeration addendum for DSH 0.2.1-rc.3 (declaration-only bump; contract plane zero diff).
55
+
56
+ ## 4.2.2 (2026-10-18)
57
+
58
+ - hosts: 追加 0.2.1-rc.2 声明面枚举(34/34 @deepseek-ai/* 宿主 peer 逐包 npm 实测 rc.2 在版;本插件不触 ctx.web provider 与 conversation.input.model.label 槽,代码零改动,纯元数据发版;农场 rc.2 格挂账待命)
59
+
60
+ All notable changes to `dsh-session-guard` are recorded here. Versions follow semver.
61
+
62
+ - [English changelog](./CHANGELOG.md)
63
+ - [日本語 changelog](./CHANGELOG.ja.md)
64
+ - [한국어 changelog](./CHANGELOG.ko.md)
65
+ - [Changelog en français](./CHANGELOG.fr.md)
66
+ - [Changelog auf Deutsch](./CHANGELOG.de.md)
67
+ - [Changelog in italiano](./CHANGELOG.it.md)
68
+ - [Changelog на русском](./CHANGELOG.ru.md)
69
+ - [Changelog en español](./CHANGELOG.es.md)
70
+ - [Changelog em português](./CHANGELOG.pt.md)
71
+
72
+ ## 4.2.1 — 2026-10-17 (host enumeration: +0.2.1-rc.1)
73
+
74
+ ### Fixed
75
+ - `engines.dsh` and the four `@deepseek-ai/dsh-client-*` peers append `|| 0.2.1-rc.1` (16-host exact enumeration),
76
+ so the host compatibility gate accepts DSH `0.2.1-rc.1`.
77
+ - `dsh.plugin.json` `engines.dsh` aligned to the same 16-host enumeration (was the range `>=0.2.0-rc.1 <0.2.1-0`);
78
+ the gate only reads `package.json`, but the two lists must not diverge.
79
+ - README compatibility statements (zh/de/es/fr/it/ru) synced to the enumeration. No behaviour change in this release.
80
+
81
+ ## 4.2.0 — 2026-10-17
82
+
83
+ ### Added
84
+ - 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).
85
+ - 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).
86
+
87
+ ### Changed
88
+ - 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.
89
+
90
+ ### Fixed
91
+ - Family claim rank 1 -> 2, aligned with the frozen weighted rank ladder (single source _tools/family-rank.mjs).
92
+
93
+ ## 4.1.16 — 2026-10-14 (metadata alignment; backfill the missing 4.1.15 entry)
94
+
95
+ ### Fixed
96
+
97
+ - `dsh.plugin.json` now carries the same version as `package.json`. The published 4.1.15 tarball
98
+ still said 4.1.14 (verified by downloading it from the registry), so the two manifests disagreed in a released artifact.
99
+ - No behaviour change in this release.
100
+ - Test suite repaired: the structural pin in `tests/settings-bridge.test.mjs` still demanded the
101
+ retired gear entry, so the suite had been red since 4.1.15; it now asserts the opposite (absence).
102
+
103
+ ## 4.1.15 — 2026-10-08 (backfilled: this entry was never written at release time)
104
+
105
+ ### Removed
106
+
107
+ - The shell-level `shell.overlay` slot injection: the fixed bottom-right gear button and its
108
+ positioned floating layer are gone (`src/client/shell-overlay.tsx` deleted). The settings entry
109
+ now relies on the host settings page alone.
110
+
111
+ ## 4.1.14 — 2026-10-08
112
+
113
+ ### Removed
114
+
115
+ ## 4.1.13 — 2026-10-08
116
+
117
+ ### Fixed — bridge descriptor skeleton on ≤0.1.5 (five-cell gate catch, 2026-10-08)
118
+
119
+ - **Host describe `value` is a field skeleton on ≤0.1.5** (0.1.0/0.1.5 empirical):
120
+ the old host generations serialize `descriptor.value` as `{enabled:{},…,officialProviders:{}}`
121
+ (one empty object per schema field) while the real merged config lives in
122
+ `descriptor.base` (combined defaults) + `descriptor.user` (user layer).
123
+ `BridgeDocHandle` consumed `value` verbatim, so `officialProviders` arrived as
124
+ `{}` — truthy non-array, invisible to `?? []` — and `ListRow`'s
125
+ `values.join` threw, crashing the whole `dsh-family.tab` slot (guard card +
126
+ IT card + TL nav all died together). `descriptorPlainValue()` now detects the
127
+ skeleton (object whose every own value is an empty plain object — impossible
128
+ for guard's scalar/array config) and rebuilds the effective value as
129
+ `{...base, ...user}` (shallow merge is exact for guard's flat config).
130
+ - **Card-field sanitization (defense in depth)**: any card render error kills
131
+ the entire family tab slot on these hosts, so `ListRow` inputs are now
132
+ sanitized at the call sites (`toList()` — non-arrays become `[]`) and the
133
+ `拦截方式` select falls back to `hold` for any non-`error` value. A malformed
134
+ descriptor may degrade one field, never the tab.
135
+ - Verified on the five-cell farm gate: describe replays on 0.1.0/0.1.5 now
136
+ yield plain merged values; the seeded `stepGateTimeoutMs: 321123` reads back
137
+ through the bridge on ≤0.1.5 and natively (configForms) on 0.1.7.
138
+
139
+ ## 4.1.12 — 2026-10-08
140
+
141
+ ### Added — settings webServer bridge (M4/T20-b): dual-track card data plane
142
+
143
+ - **Top-level card registration refactor (prerequisite)**: the three settings
144
+ faces (`dsh-family.tab`, `plugins.bundle.config`, `settings.plugin.item`,
145
+ `shell.overlay`) were registered inside the `onScope` callback of the dual
146
+ scoped-inject waist — on ≤0.1.5 that callback never fires (settingsScope fiber
147
+ never resolves; 0.1.0/0.1.1 lack both services), so the cards never registered
148
+ and a bridge would have had no consumer. All registrations now run at apply
149
+ top level with a `scopeRef` live reference; the callback degrades to a pure
150
+ data arm (perm-gate `client/index.ts` L166-257 shape).
151
+ - **Server bridge** (`src/settings-bridge.js`): `describe`/`mutate` endpoints at
152
+ `/api/session-guard/settings/*` (POST-only, `{ok,value|error}` envelope,
153
+ redacted describe filtered to the plugin ns, ops forwarded to the host
154
+ settings service with `expectedRevision` optimistic concurrency, 256 KB cap).
155
+ Registration is fail-open (error log, never blocks plugin load).
156
+ - **Client bridge handle** (`src/client/settings-bridge.ts`): `BridgeDocHandle`
157
+ implements the same `SettingsScope` face as the native handles
158
+ (getSnapshot/subscribe/set/unset); describe misses retry within a bounded
159
+ budget (settings service resolving later than card mount) before landing on
160
+ `unavailable`. Card faces read `scopeRef.scope ?? bridgeScope()` — native
161
+ first, bridge fallback (perm-gate T13b dual-track). **Generation split in the
162
+ data arm (five-cell empirical, 2026-10-08 night)**: on 0.1.2/0.1.5 the
163
+ `settingsScope` handle is write-alive but read-dead — `set()` persists to
164
+ settings.yaml while `getSnapshot().value` stays `undefined`, so that arm
165
+ deliberately leaves `scopeRef` empty and the card falls to the bridge (bridge
166
+ mutate lands in the same host service; describe heals the read path).
167
+
168
+ ### Corrected — 4.1.11 publication note
169
+
170
+ - The 4.1.11 entry said "none of 4.1.5-4.1.10 was published to npm"; **4.1.5
171
+ was published** (npm registry confirms `4.1.5` in versions, and `latest`
172
+ pointed at it until this release line). 4.1.6-4.1.10 indeed never shipped.
173
+ The earlier claim came from reading the npmmirror mirror instead of the
174
+ authoritative registry (registry-pin discipline, B2+).
175
+
176
+ ## 4.1.11 — 2026-10-08
177
+
178
+ ### Fixed — family-section takeover rebuilt (4.1.5 → 4.1.11 arc; none of 4.1.5-4.1.10 was published to npm)
179
+
180
+ - **4.1.5 "half backfill" root cause**: the takeover body read `props.hooks.tabs`,
181
+ but the host's `bindInjectHooks` strips an inject face's `hooks` key into
182
+ `use<Tab>` props on every generation — the component threw, the slot abdicated,
183
+ and the takeover body never rendered anywhere. It now reads the `useTabs`
184
+ compartment first, with a raw-hooks `useState`/`useEffect` fallback.
185
+ - **Apply-time inject registration (4.1.10)**: the slots core fires inject
186
+ factories only on declaration events (= the settings panel opening), so the
187
+ grace-delayed registration of 4.1.7/4.1.8 waited for a declaration that never
188
+ came. The `settings.section` inject now registers at apply time.
189
+ - **Deferred yield-election (4.1.11)**: ≤0.1.7 shells give every same-id section
190
+ entry its own nav row — the old "priority-10 shadow stays invisible" assumption
191
+ produced a double 起子插件设置 row on all five farm cells. The factory now waits
192
+ 500 ms after the declaration batch and stands down when a `dsh-family` entry is
193
+ already seated (thinking-levels head); it takes over only when TL is absent.
194
+ Verified single-row on all five farm cells (0.1.0 → 0.1.7), pairing with
195
+ dsh-thinking-levels 4.2.0-beta.26's symmetric stand-down.
196
+
197
+ ## 4.0.0 — 2026-09-29
198
+
199
+ ### Changed
200
+ - **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.
201
+ - `@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).
202
+
203
+ ### Fixed
204
+ - `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).
205
+ - 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.
206
+ - v4 source-kind static gates (`tests/source-kind.test.mjs`) are now tracked and run in `npm test` (248 tests).
207
+
208
+ ## 3.2.4 — 2026-09-27
209
+
210
+ ### Fixed
211
+ - **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:
212
+ - delayed-resume notice injection (`src/wiring.js`);
213
+ - auto-retry notice injection (`src/retry.js`);
214
+ - pause-resume followup (`src/pause-gate.js`, ```kind: `plugin:${pluginId}````).
215
+ - **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.
216
+ `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'`.
217
+
218
+ ## 0.4.0 — 2026-09-18 (mis-versioned; superseded by 3.0.0)
219
+
220
+ ### Fixed
221
+
222
+ - **Version identity.** This line was published as `0.4.0` while `dsh.plugin.json` and this
223
+ changelog already said `3.0.0` — one artifact with two version numbers. `package.json` is now
224
+ `3.0.0`, so the package version, the manifest version and the changelog agree. `0.4.0` is kept
225
+ here as a historical record because npm versions are immutable; `dist-tag dsh-0.1.5` should be
226
+ repointed to `3.0.0` once it is published.
227
+ - **Docs.** README/INSTALL (zh/en/ja/ko) no longer describe the sibling line as living on `main`.
228
+ The 0.1.2 line's release branch is **`legacy/0.1.2`** (npm dist-tag `dsh-0.1.2`, version `0.3.1`);
229
+ `main` is frozen at `0.2.0-beta.1`. The duplicated branch fragment in the INSTALL.zh/ja/ko install
230
+ command is fixed, explicit dist-tag install commands are documented, and "2.x / 3.x" is
231
+ now marked as a **line nickname** rather than a version number.
232
+
233
+ ### Notes
234
+
235
+ - **No source changes** relative to `3.0.0`; `0.4.0` is a packaging-only publish of the same tree.
236
+
237
+ ## 3.0.0 — 2026-09-14
238
+
239
+ ### Changed
240
+
241
+ - **DSH v0.1.5-rc.2 dedicated line (`compat/0.1.5`).** `engines.dsh` and the `dsh-client-*`
242
+ peer ranges narrow to `>=0.1.5-rc.2 <0.2.0-0` (strict-semver prerelease matching means the
243
+ old `>=0.1.0-rc.7` range never matches `0.1.5-rc.2`); `dsh.plugin.json` gains `engines.dsh`.
244
+ The 2.x / 0.2.x line on `main` keeps serving DSH 0.1.0-rc.7 … 0.1.2-rc.1.
245
+ - **`session.events` → `snapshotEvents()`.** DSH 0.1.5 removed the `session.events` array
246
+ accessor (compatibility-guide §20.3). `pause-gate.js` now reads session events through a
247
+ dual-path helper: `snapshotEvents()` first, the legacy `events` array as a defensive
248
+ fallback, `null` (fail-open) when neither exists. Affects `findToolOutcome` and
249
+ `lastUserPrompt` only; event-type matching is unchanged.
250
+
251
+ ### Unchanged
252
+
253
+ - Zero changes on every other integration seam: the self-held webServer prefix route
254
+ (`/session-guard/rpc`), `settings.register`, the `settings.plugin.item` card slot,
255
+ client injections, and `llm.listConfigurableProviders()` are all verified intact against
256
+ the published 0.1.5-rc.2 bundle (`tools/check-api-drift.ps1`, 12/12 required assertions).
257
+
258
+ ### Pending
259
+
260
+ - Live smoke on a real DSH 0.1.5-rc.2 host (same status as the perm-gate 0.1.5 line).
261
+
262
+ ## 0.2.0-beta.2 — 2026-09-13
263
+
264
+ ### Fixed (DSH 0.1.5 compat — `compat/0.1.5` branch)
265
+
266
+ - **Dual-path resume enqueue.** DSH 0.1.5 turns the Inbox into an agent-loop read-only
267
+ projection, so `agent.followup` may no longer exist. The resume flow now tries
268
+ `agent.followup` first, falls back to `agent.send`, and degrades to a warn (never throws)
269
+ when neither is available — a failed enqueue can no longer break resume.
270
+ - **Resume messages carry `source.form: 'instructions'`** per the 0.1.5 `ContextFormed`
271
+ message-source contract (`kind: 'plugin'` is a built-in kind; older DSH versions ignore
272
+ the extra field).
273
+ - **`webServer.register` is wrapped in try/catch**: a failed route registration now logs an
274
+ error instead of throwing out of `apply` and breaking host plugin loading.
275
+ - Verified against the 0.1.5-rc.2 source: the `WebRoute` contract (exact/prefix + SSE) is
276
+ unchanged, so client `fetch('/session-guard/...')` paths need no `/api` prefix.
277
+
278
+ ## 0.2.0-beta.1 — 2026-09-10
279
+
280
+ ### Added
281
+
282
+ - **Step-level gate (`agent/pre-step`).** During peak hours the turn is now held **before** the
283
+ next step's model request instead of being interrupted at a turn boundary: the session keeps
284
+ running until the next `agent/pre-step`, where the gate holds it (setting `stepLevelPause`, on by
285
+ default). The turn resumes **in place** off-peak — no followup message needed. Hold conditions:
286
+ peak (Beijing time) + not weekend + `step > 1` + official target provider (`providerGuard`) +
287
+ not request-held + not bypassed in this peak window. New module `src/step-gate.js` (pure
288
+ `decideStepHold` + hold / release / abort / timeout engine).
289
+ - **`stepResume` port + RPC + `/resume`.** `sessionGuard.stepResume(sessionId, {bypass})`,
290
+ `POST /session-guard/rpc {action:'stepResume'}` and `/resume` all release the gate; a manual
291
+ resume also stops gating that session for the rest of the peak window.
292
+ - **Timeout escalation.** `stepGateTimeoutMs` (default 300000) releases the gate and escalates to a
293
+ turn-level **force** pause, so a long peak neither deadlocks nor drips one step every five minutes.
294
+ - **"⏸ Pause session" button** (client, slot `conversation.input.right`, id `session-guard-pause`,
295
+ order 20 — left of input-traffic's freeze button). It polls `/session-guard/state` once a second,
296
+ stays disabled while nothing is held, and calls `stepResume` when it is. The status badge moved to
297
+ order 40 and now reports the number of step-held sessions.
298
+ - **New settings**: `stepLevelPause`, `stepGateTimeoutMs`.
299
+ - **New state**: `GET /session-guard/state` now returns `paused: { step, turn }` and
300
+ `stepGate: { held, since, bypass }`; `/status` returns `stepHeld`; `/diag` returns `stepGate`.
301
+ The service port's `state().paused` stays boolean for compatibility (new field `pausedStep`).
302
+
303
+ ### Fixed
304
+
305
+ - **Deadlock between a held step and a turn-level pause.** `pauseTask` / `resumeTask` /
306
+ `cancelTask` now release the step gate first: a step hold sits at `agent/pre-step`, where no
307
+ `assistant/message` or `tool/result` can ever arrive, so a `safe` pause used to wait forever and
308
+ never persisted `paused`.
309
+
310
+ ### Changed
311
+
312
+ - **Peak entry no longer interrupts running turns** when `stepLevelPause` is on (`onEnterPeak` arms
313
+ the step gate instead of calling `stopNextTurn`); with it off the previous turn-level behaviour is
314
+ unchanged.
315
+ - input-traffic's freeze button label is now **"Freeze & append"** (`冻结追加` / `凍結して追加` /
316
+ `동결 후 추가`), and its resume label **"Resume & append"** (`恢复追加` / `再開して追加` /
317
+ `재개 후 추가`) — it freezes the turn and keeps queued messages, distinct from the pause button.
318
+ - **The pause button is a toggle now**: "Pause session" / "Resume session" (no disabled grey state).
319
+ Clicking "Pause session" calls the new `stepPause` action, which holds the session at the **next
320
+ step boundary** (step 1 included, regardless of peak or provider); "Resume session" calls
321
+ `stepResume`. New port method `sessionGuard.stepPause(sessionId)`.
322
+ - **SSE push**: new route `GET /session-guard/events?session=<id>` pushes step-gate state changes the
323
+ moment they happen, so peak auto-holds flip the button to "Resume session" without waiting for a
324
+ poll; the 10s `/session-guard/state` poll remains as a fallback. `/state` now reports
325
+ `paused.manual` and `stepGate.manual`.
326
+ - **Styling aligned** with input-traffic's composer button (24px height, 6px radius, 12px font, the
327
+ same border/hover/pressed tokens) for both the pause button and the status badge; styles are
328
+ injected once via `<style data-plugin-css="session-guard-client">`.
329
+
330
+ ## Unreleased
331
+
332
+ ### Added
333
+
334
+ - **Official-source two-dimensional guard (peak × target provider).** Peak hours now block only
335
+ requests whose target route is a DeepSeek official source; local/third-party providers keep
336
+ running. Verdict order: explicit `officialProviders` id list → live `baseURL` endpoint →
337
+ catalog builtin endpoint (pi-ai's `deepseek`) → builtin id (`deepseek-official`); each verdict
338
+ reports `matchedBy`. New modules: `src/provider.js` (pure), `src/provider-directory.js`,
339
+ `src/deferrals.js`, `src/request-guard.js`, `src/targets.js`, `src/wiring.js`.
340
+ - **Request-level backstop (`agent/request`).** Covers sessions started after peak entry and
341
+ sessions switched to an official source mid-run — the 30s tick only handled sessions that were
342
+ already `running` at the transition. Default `hold` mode suspends the request without an error
343
+ and releases it at the exact off-peak instant (`msUntilOffPeak`); `error` mode throws a
344
+ recognizable `PEAK_DEFERRED` failure and records a deferral for off-peak resume.
345
+ - **New settings**: `providerGuard`, `officialProviders`, `officialBaseURLs`, `deferredResume`,
346
+ `deferredResumeText`, `deferredMode`, `deferredMaxHoldMs` (default 6h), `guardSubagents`.
347
+ - **New routes**: `GET /session-guard/provider?provider=<id>` (verdict diagnostics);
348
+ `/session-guard/status` now reports `providerGuard` / `held` / `deferred`;
349
+ `/session-guard/state` reports the session's last target.
350
+ - **Drift guard** `tools/check-api-drift.ps1` asserting the required APIs exist on
351
+ `dsh-v0.1.1-rc.2` / `dsh-v0.1.2-rc.1` / `dsh-v0.1.3-alpha.2` / `dsh-v0.1.5-alpha.1`.
352
+
353
+ ### Changed
354
+
355
+ - **DSH dual-version support (0.1.0-rc.7 … 0.1.2-rc.1).** One artifact now covers both
356
+ `dsh-v0.1.1-rc.2` and `dsh-v0.1.2-rc.1`. The `tool/result` call-id dual read
357
+ (`content[].toolCallId` first, `source.callId` fallback — both forms appear in replay logs of
358
+ both versions) is extracted to the dependency-free `src/tool-call-id.js` with unit tests.
359
+ `dsh.client.inject` no longer names `@deepseek-ai/dsh-client-runtime` (removed in 0.1.2) or
360
+ `@deepseek-ai/dsh-client-ui-slots` (not a dynamic client row); peer ranges widened to
361
+ `>=0.1.0-rc.7 <0.2.0-0` and the removed package dropped. Added `engines.dsh` and a
362
+ version-compatibility table to the README (ZH/EN).
363
+ - **Settings surface stays on the intersection API**: `settings.register` + `settings.get` only;
364
+ `installSection` (0.1.2+) and the removed `installSettingsSection` are never used. Optional
365
+ APIs (`model/selection`, `llm.listConfigurableProviders`, `settings.get`) are feature-probed and
366
+ degrade instead of throwing.
367
+ - **`src/retry.js` short-circuits only the exact `PEAK_DEFERRED` sentinel.** 429 / `RATE_LIMIT` /
368
+ `TRANSPORT` / timeout failures remain transient, so DSH's global retry (`dsh-llm-retry` on
369
+ `agent/request-error`) and this plugin's own retry semantics are unchanged. `dsh-llm-retry`
370
+ itself is never touched.
371
+ - Badge distinguishes "peak · official only" from "peak · all paused".
372
+
373
+ ## 0.1.4 — 2026-09-09
374
+
375
+ ### Changed
376
+
377
+ - **Public beta release** of the dual-version line (`0.1.4-beta.1`): version metadata, README
378
+ compatibility table and package metadata aligned for the beta channel.
379
+
380
+ ## 0.1.3 — 2026-09-09
381
+
382
+ ### Fixed
383
+
384
+ - **package.json encoding restored**: description was corrupted (GB2312 bytes misread as UTF-8); rewritten with correct Chinese text.
385
+ - **Missing metadata**: added `repository`, `homepage` fields.
386
+ - **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`.
387
+ - Added `dsh.plugin.json` manifest.
388
+
389
+ ## 0.1.2 — 2026-08-28
390
+
391
+ ### Fixed
392
+
393
+ - **Peak timezone fixed**: 峰谷判定固定北京时间 (`BILLING_TIMEZONE`),周末判定用配置时区。
394
+
395
+ ## 0.1.1 — 2026-08-24
396
+
397
+ ### Added
398
+
399
+ - **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.
400
+ - **Freeze/gate yield**: retry skips when `isFrozen(sessionId)` is true (queueLocked / paused / taskControl paused), never bypasses the session gate.
401
+
402
+ ### Changed
403
+
404
+ - `sessionGuard` redundant port now exposes `state(sessionId)` returning `{ queueLocked, lockReason, paused, taskControlAvailable, taskControl }`.
405
+ - HTTP route `GET /session-guard/diag` returns runtime diagnostics including retry state.
406
+
407
+ ### Fixed
408
+
409
+ - Weekend detection now uses `Intl.DateTimeFormat` with the configured timezone instead of bare `getUTCDay()`, fixing an 8-hour boundary bug for Beijing timezone.
410
+
411
+ ## 0.1.0 — 2026-08-18
412
+
413
+ ### Added
414
+
415
+ - 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).