dsh-context-compression-improved 0.5.5 → 0.5.7

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.
Files changed (162) hide show
  1. package/.gitattributes +2 -2
  2. package/.githooks/pre-push +37 -37
  3. package/.github/workflows/ci.yml +39 -39
  4. package/CHANGELOG.ja.md +169 -169
  5. package/CHANGELOG.ko.md +167 -167
  6. package/CHANGELOG.md +314 -304
  7. package/CHANGELOG.zh.md +152 -152
  8. package/CONTRIBUTING.md +22 -22
  9. package/LICENSE +21 -21
  10. package/README.ja.md +85 -85
  11. package/README.ko.md +85 -85
  12. package/README.md +94 -85
  13. package/README.zh.md +85 -85
  14. package/SECURITY.md +18 -18
  15. package/THIRD_PARTY_NOTICES.md +14 -14
  16. package/docs/compat-0.1.5-report.md +77 -77
  17. package/docs/installation.ja.md +78 -78
  18. package/docs/installation.ko.md +78 -78
  19. package/docs/installation.md +103 -103
  20. package/docs/installation.zh.md +100 -100
  21. package/docs/repair-log.md +657 -657
  22. package/eslint.config.js +30 -30
  23. package/package.json +164 -160
  24. package/packages/selector/LICENSE +21 -21
  25. package/packages/selector/README.md +26 -21
  26. package/packages/selector/README.zh.md +24 -19
  27. package/packages/selector/THIRD_PARTY_NOTICES.md +32 -32
  28. package/packages/selector/cordis.patch.yml +27 -27
  29. package/packages/selector/docs/history-tool-call-working-set-spec.md +112 -112
  30. package/packages/selector/docs/native-tool-result-selector-spec.md +34 -34
  31. package/packages/selector/docs/subagent-cache-reuse-spec.md +46 -46
  32. package/packages/selector/dsh.plugin.json +16 -16
  33. package/packages/selector/lib/client.js +733 -0
  34. package/packages/selector/lib/style.css +46 -46
  35. package/packages/selector/package.json +114 -114
  36. package/packages/selector/screenshots.json +3 -3
  37. package/packages/selector/src/client/CompressionProfileControls.tsx +226 -226
  38. package/packages/selector/src/client/CompressionProfileSelector.module.css +170 -170
  39. package/packages/selector/src/client/CompressionProfileSelector.tsx +83 -83
  40. package/packages/selector/src/client/CustomPolicyEditor.tsx +216 -216
  41. package/packages/selector/src/client/EstimatorControls.tsx +277 -277
  42. package/packages/selector/src/client/decode.ts +49 -49
  43. package/packages/selector/src/client/index.ts +178 -149
  44. package/packages/selector/src/client/locales/de.ts +98 -0
  45. package/packages/selector/src/client/locales/es.ts +98 -0
  46. package/packages/selector/src/client/locales/fr.ts +98 -0
  47. package/packages/selector/src/client/locales/it.ts +98 -0
  48. package/packages/selector/src/client/locales/ja.ts +98 -0
  49. package/packages/selector/src/client/locales/ko.ts +98 -0
  50. package/packages/selector/src/client/locales/ru.ts +98 -0
  51. package/packages/selector/src/client/locales.ts +196 -196
  52. package/packages/selector/src/client/preset-options.ts +88 -88
  53. package/packages/selector/src/client/settings-section.tsx +124 -124
  54. package/packages/selector/src/css-modules.d.ts +6 -6
  55. package/packages/selector/src/deepseek-v4-tokenizer.ts +205 -205
  56. package/packages/selector/src/estimator-catalog.ts +104 -104
  57. package/packages/selector/src/index.ts +463 -463
  58. package/packages/selector/src/invariant.ts +113 -113
  59. package/packages/selector/src/preset-overlay.ts +626 -626
  60. package/packages/selector/src/profiles.ts +394 -394
  61. package/packages/selector/src/pruner/content.ts +201 -201
  62. package/packages/selector/src/pruner/session.ts +94 -94
  63. package/packages/selector/src/pruner/state.ts +50 -50
  64. package/packages/selector/src/pruner/tuning.ts +23 -23
  65. package/packages/selector/src/pruner/types.ts +78 -78
  66. package/packages/selector/src/pruner.ts +2402 -2402
  67. package/packages/selector/src/runtime/adaptive-cost.ts +205 -205
  68. package/packages/selector/src/runtime/audit.ts +286 -286
  69. package/packages/selector/src/runtime/config.ts +706 -706
  70. package/packages/selector/src/runtime/custom-policy.ts +278 -278
  71. package/packages/selector/src/runtime/deepseek-official-pricing.ts +298 -298
  72. package/packages/selector/src/runtime/deepseek-v4-vision-tokens.ts +254 -254
  73. package/packages/selector/src/runtime/measurement.ts +436 -436
  74. package/packages/selector/src/runtime/reducers.ts +1674 -1674
  75. package/packages/selector/src/runtime/retrieve.ts +457 -457
  76. package/packages/selector/src/runtime/session-events.ts +30 -30
  77. package/packages/selector/src/runtime/tail-trim.ts +166 -166
  78. package/packages/selector/src/runtime/token-count.ts +72 -72
  79. package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +188 -188
  80. package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +149 -149
  81. package/packages/selector/src/runtime/tokenpilot/advisor.ts +419 -419
  82. package/packages/selector/src/runtime/tokenpilot/benefit.ts +200 -200
  83. package/packages/selector/src/runtime/tokenpilot/dedup.ts +81 -81
  84. package/packages/selector/src/runtime/tokenpilot/estimator.ts +151 -151
  85. package/packages/selector/src/runtime/tokenpilot/locator.ts +128 -128
  86. package/packages/selector/src/runtime/tokenpilot/read-state.ts +98 -98
  87. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +303 -303
  88. package/packages/selector/src/runtime/toolclass.ts +103 -103
  89. package/packages/selector/src/runtime/types.ts +346 -346
  90. package/packages/selector/src/runtime/value.ts +48 -48
  91. package/packages/selector/tests/advisor-report.host.spec.ts +223 -223
  92. package/packages/selector/tests/auto-compact.client.spec.tsx +213 -213
  93. package/packages/selector/tests/built/client-artifact.spec.ts +59 -59
  94. package/packages/selector/tests/cache-prefix-audit.spec.ts +123 -123
  95. package/packages/selector/tests/code-skeleton.client.spec.ts +90 -90
  96. package/packages/selector/tests/custom-contract.client.spec.ts +204 -204
  97. package/packages/selector/tests/estimator-catalog.spec.ts +70 -70
  98. package/packages/selector/tests/estimator-channel.client.spec.tsx +252 -252
  99. package/packages/selector/tests/estimator-route-registration.host.spec.ts +188 -188
  100. package/packages/selector/tests/host-preset-overlay.host.spec.ts +206 -206
  101. package/packages/selector/tests/preset-options-write.client.spec.ts +206 -206
  102. package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +201 -201
  103. package/packages/selector/tests/preset-overlay.host.spec.ts +246 -246
  104. package/packages/selector/tests/profiles.client.spec.tsx +434 -434
  105. package/packages/selector/tests/public/package-contract.client.spec.ts +78 -78
  106. package/packages/selector/tests/runtime/adaptive-cost.spec.ts +167 -167
  107. package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +232 -232
  108. package/packages/selector/tests/runtime/advisor-invariant.spec.ts +272 -272
  109. package/packages/selector/tests/runtime/advisor.spec.ts +226 -226
  110. package/packages/selector/tests/runtime/audit.spec.ts +274 -274
  111. package/packages/selector/tests/runtime/auto-compact-config.spec.ts +523 -523
  112. package/packages/selector/tests/runtime/char-basis.spec.ts +30 -30
  113. package/packages/selector/tests/runtime/code-skeleton.spec.ts +152 -152
  114. package/packages/selector/tests/runtime/deepseek-official-pricing.spec.ts +186 -186
  115. package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +122 -122
  116. package/packages/selector/tests/runtime/deepseek-v4-vision-tokens.spec.ts +122 -122
  117. package/packages/selector/tests/runtime/deprecated-preset-options.spec.ts +96 -96
  118. package/packages/selector/tests/runtime/fixtures/profile-baseline.json +273 -273
  119. package/packages/selector/tests/runtime/fixtures/tokenizer-golden.json +106 -106
  120. package/packages/selector/tests/runtime/fixtures/vision-golden.json +459 -459
  121. package/packages/selector/tests/runtime/frequency-longstrings.spec.ts +74 -74
  122. package/packages/selector/tests/runtime/html-reducer.spec.ts +212 -212
  123. package/packages/selector/tests/runtime/line-mapping.spec.ts +153 -153
  124. package/packages/selector/tests/runtime/prose-reducers.spec.ts +133 -133
  125. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +2724 -2724
  126. package/packages/selector/tests/runtime/read-input-cap.spec.ts +33 -33
  127. package/packages/selector/tests/runtime/search-reducer.spec.ts +110 -110
  128. package/packages/selector/tests/runtime/session-events.spec.ts +27 -27
  129. package/packages/selector/tests/runtime/sidechannel.spec.ts +241 -241
  130. package/packages/selector/tests/runtime/toc-and-bundled.spec.ts +159 -159
  131. package/packages/selector/tests/runtime/tokenizer-golden.spec.ts +53 -53
  132. package/packages/selector/tests/runtime/tokenpilot/benefit.spec.ts +217 -217
  133. package/packages/selector/tests/runtime/tokenpilot/dedup.spec.ts +52 -52
  134. package/packages/selector/tests/runtime/tokenpilot/estimator.spec.ts +79 -79
  135. package/packages/selector/tests/runtime/tokenpilot/locator.spec.ts +76 -76
  136. package/packages/selector/tests/runtime/tokenpilot/profile-baseline.spec.ts +116 -116
  137. package/packages/selector/tests/runtime/tokenpilot/read-state.spec.ts +82 -82
  138. package/packages/selector/tests/runtime/toolclass.spec.ts +156 -156
  139. package/packages/selector/tests/runtime/value.spec.ts +23 -23
  140. package/packages/selector/tests/settings-seat.client.spec.ts +118 -118
  141. package/packages/selector/tests/standing-generation.host.spec.ts +697 -697
  142. package/packages/selector/tests/subagent-cache-reuse.host.spec.ts +253 -253
  143. package/packages/selector/tests/support/cache-prefix-audit.ts +105 -105
  144. package/packages/selector/tests/support/mock-adapter.ts +37 -37
  145. package/packages/selector/tests/support/ui-primitives.tsx +34 -34
  146. package/packages/selector/tsconfig.json +11 -11
  147. package/packages/selector/tsdown.client.config.ts +102 -102
  148. package/packages/selector/tsdown.config.ts +20 -20
  149. package/pnpm-workspace.yaml +66 -66
  150. package/scripts/capture-profile-baseline.mjs +42 -42
  151. package/scripts/generate-tokenizer-fixtures.py +81 -81
  152. package/scripts/generate-vision-fixtures.py +208 -208
  153. package/scripts/packed-components-smoke.mjs +732 -732
  154. package/scripts/packed-install-e2e.mjs +1273 -1273
  155. package/scripts/toolclass-corpus-replay.mjs +281 -281
  156. package/scripts/verify-release.mjs +317 -317
  157. package/tests/TEST_INVENTORY.md +41 -41
  158. package/tsconfig.base.json +18 -18
  159. package/tsconfig.json +7 -7
  160. package/tsconfig.tests.json +15 -15
  161. package/vitest.built.config.ts +9 -9
  162. package/vitest.config.ts +43 -43
package/CHANGELOG.md CHANGED
@@ -1,304 +1,314 @@
1
- # Changelog
2
-
3
- All notable changes use this file. The project follows semantic versioning after `0.1.0`.
4
-
5
- ## 0.5.4 - 2026-09-20
6
-
7
- ### Fixed
8
-
9
- - The install surface declares `@deepseek-ai/schemastery` as a runtime dependency. The packaged
10
- runtime imports it unconditionally (`import z from '@deepseek-ai/schemastery'` in
11
- `packages/selector/lib/index.js`, `lib/pruner.js` and `lib/advisor-state.js`), but 0.5.3
12
- declared it nowhere a consumer install reads: the shipped root manifest listed only
13
- `@huggingface/tokenizers` and `js-yaml`, and `packages/selector/package.json` listed it as a
14
- peer, which no package manager consults for a nested package it installs. Resolution therefore
15
- depended on an unrelated installed package hoisting `@deepseek-ai/schemastery` into the
16
- profile. In a clean install the import fell through to the Harness installation's
17
- shared-module fallback at `$DSH_HOME/profiles/node_modules`; where that fallback held no built
18
- package, every plugin entry failed to load and the host booted without the Bundle layer. Both
19
- manifests now pin `3.18.2`, the version this release is built and tested against, and the
20
- selector package no longer claims a peer obligation it does not have.
21
-
22
- ### Added
23
-
24
- - `verify:release` derives the install-surface dependencies from the bare specifiers the
25
- packaged runtime files import, instead of naming `@huggingface/tokenizers` and `js-yaml` by
26
- hand. Which packages ship with the plugin and which the Harness installation provides is a
27
- reviewed list, and an import whose provider is in neither manifest fails the gate with the
28
- missing name. The gate was added as a negative control against the unfixed manifests, where it
29
- failed on `@deepseek-ai/schemastery`.
30
-
31
- ## 0.5.3 - 2026-09-20
32
-
33
- ### Fixed
34
-
35
- - The Bundle patch no longer sets the retired review route flag. `reviewQueueRoute` was
36
- removed from the plugin's Config schema when the review gate was retired, but it stayed in
37
- `packages/selector/cordis.patch.yml`, where it advertised a route that can never register.
38
- Hosts tolerate the unknown key today (the plugin loads and serves — verified on a live host),
39
- so this is a stale-config defect rather than a break, but it would break on any host that
40
- validates plugin config strictly.
41
- - Generated artifacts are pinned to LF (`packages/selector/lib/** text eol=lf`). With
42
- `core.autocrlf=true` every checkout rewrote the committed `lib/**` to CRLF, so any branch
43
- switch or merge left the whole artifact directory reported as modified with EOL-only
44
- differences. Nothing was ever committed from that state, but it made every tree look dirty
45
- and it would hide a real artifact change.
46
-
47
- ### Added
48
-
49
- - A negative-control contract pin on the Bundle patch: it fails when a retired config key is
50
- set in the patch (asserted on key-setting lines, so the explanatory comment may still name
51
- the key), and it requires the live `estimatorCatalogRoute` flag to stay wired.
52
-
53
- ### Tests
54
-
55
- - The client seat contract also pins the older-host degradation: a host that does not declare
56
- the seat rejects the registration at the slot boundary, and `apply()` must swallow it and
57
- warn instead of taking every settings entry down with it.
58
-
59
- ## 0.5.2 - 2026-09-20
60
-
61
- ### Changed
62
-
63
- - The human-gated review pipeline (beta) is **retired**. Its semantics are replaced by
64
- advice: the benefit model still prices every pass as ONE merged mutation, but the band it
65
- computes (`profitable` / `high-impact` / `slow-payback` / `unpriceable` / `not-worth-it`)
66
- is now published as a `reduction-advice` audit record and snapshotted onto the advisor
67
- report route — it never withholds, delays, or rewrites a reduction. The gate contradicted
68
- the feature's own requirement (a reduction must never block automatic processing) and, with
69
- the shipped defaults (`reviewMode` on plus a 4,000-token high-impact threshold against an
70
- 8,192-token fresh trigger), diverted 100% of a fresh batch into human review, leaving the
71
- automatic path effectively off for anyone who opted in. The advice thresholds are now
72
- module constants (α `0.1`, high-impact `4,000` tokens): nothing acts on them, so they are
73
- no longer settings.
74
- - Removed with the gate: the review queue and its `storageDomain` adapter, the process-wide
75
- registry, the `review-queue` / `review-decide` HTTP routes and the `reviewQueueRoute`
76
- deployment flag, the `shell.overlay` client panel, the `reviewMode` /
77
- `reviewTimeoutTurns` / `cacheHitDiscountAlpha` / `reviewHighImpactTokens` settings keys,
78
- and the `review-outcome` audit kind. The four settings keys stay ACCEPTED and IGNORED by
79
- both decoders — an existing document (the live one carries `reviewMode: false`) still loads
80
- and still renders its settings card — and never reach the resolved policy. The read-only
81
- `GET .../advisor-report` route additionally serves `lastAdvice`.
82
-
83
- ### Added
84
-
85
- - Regression pins for the retirement: a host-integration spec drives the exact settings that
86
- used to divert everything (`reviewMode: true`, `reviewHighImpactTokens: 1`) and asserts the
87
- fresh batch LANDS, described by a `high-impact` advice record; a deprecation-contract spec
88
- pins accept-and-ignore for the retired keys on both the runtime parser and the browser
89
- decoder.
90
-
91
- ### Rollback
92
-
93
- - Reinstall the last release that still ships the gate: `npm dist-tag add
94
- dsh-context-compression-improved@0.5.1 dsh-0.1.5 --registry https://registry.npmjs.org/`
95
- then `dsh plugin --profile web add dsh-context-compression-improved@0.5.1`.
96
-
97
- ## 0.5.1 - 2026-09-20
98
-
99
- ### Fixed
100
-
101
- - Concurrent preset-overlay composition of one identity no longer fails on Windows.
102
- Publication is now serialized per destination path, and when the atomic rename still
103
- loses the race the destination is confirmed to already carry this staging file's
104
- `{mtimeMs, size}` standing key before the publish reports success. Windows `MoveFileEx`
105
- reports that lost race as `EPERM`/`EBUSY` where POSIX `rename` simply replaces the
106
- destination, which made `standingKeyFor()` throw during concurrent session start. A
107
- destination that does not match still fails loudly, so a silently reused generation
108
- stays forbidden.
109
- - Release-gate and test repairs that had been hiding this and other pre-existing red
110
- gates: stale identifiers and a retired audit reason in the packed smokes, a stale
111
- client-inject expectation, and Windows-only spawn traps (`git` and multi-line
112
- `node -e` scripts were routed through `cmd.exe`, which rewrote their arguments).
113
-
114
- ## 0.5.0 - 2026-09-20
115
-
116
- ### Added
117
-
118
- - Advisory relevance advisor (statistics and suggestions only, default off): at every turn
119
- boundary a fire-and-forget pass summarizes the session's tail-task semantics from the
120
- most recent `todo/write` event (falling back to recent user text), incrementally scores
121
- historical tool-result candidates for content-and-comment relevance against the current
122
- task, and computes a prefix-decay figure (character-pressure-weighted mean relevance).
123
- Low-relevance old segments are marked `recertified` as suggestions for later
124
- history-aggressiveness decisions — nothing this round consumes them, and advisor output
125
- can never suppress, delay, or rewrite any reduction that would land (pinned by a
126
- dedicated invariant test). Configure through the `presetOptions.advisor*` settings keys
127
- (`advisorMode` `''|'host'|'direct'`, default `''`; the direct channel reuses the
128
- estimator endpoint; `SideChannel` gained an optional overrides parameter so the
129
- estimator's transport is shared without sharing its configuration). Observability: new
130
- `advisor-outcome` audit records (content-free, one per phase: summary / scoring / decay)
131
- and a read-only `GET .../advisor-report?sessionId=` HTTP route (opt-in deployment flag
132
- `advisorReportRoute`, mirroring the review routes). Client UI is intentionally absent
133
- this round.
134
-
135
- ## 0.4.0 - 2026-09-20
136
-
137
- ### Fixed
138
-
139
- - The plugin no longer depends on the routed model id: every planning gate now decides on
140
- the character basis (Unicode code points via `characterPressure` / `pressureCost`) instead
141
- of exact tokenizer counts, so a route without a bundled tokenizer (the live
142
- `deepseek-flash`) lands rewrites again instead of silently skipping. Token thresholds keep
143
- their names and values (converted at the documented 4.0 chars/token convention, frozen
144
- profile baseline untouched); token figures become telemetry, labelled honestly by the new
145
- `measurementBasis` field on rewrite audit records (`exact-tokenizer` vs `characters`,
146
- with `tokenizerId: 'characters'` / `tokenizerRevision: 'chars-per-token-4.0'` when derived).
147
- Rollback: `git revert 7a1972a` restores the exact-tokenizer gates as a single unit; confirm
148
- no later change re-introduced a model-id split that relies on this commit first.
149
-
150
- ### Added
151
-
152
- - Batch-level benefit pricing (R1): a review pass is priced as ONE merged mutation — the
153
- tail KV-cache refill penalty is paid once per batch instead of per candidate, so real
154
- batches (5×50k with a 64k tail) reach the auto band instead of all dropping.
155
- - Original-event line mapping (R9a): terminal normalization returns folded lines that each
156
- carry their 1-based original-event line number; `retrieve` reads raw events, so printed
157
- ranges resolve to the right lines.
158
- - Document skeleton and universal prose keep (R8/R8b): structured documents keep headings,
159
- section first/last lines, list starts and table headers; every other non-code text keeps
160
- head AND tail with an R9 line-range marker (prose was previously head-only truncated).
161
- - Two-tier search folding (R10, fixes D8): a lossless per-file L1 locator plus a
162
- water-filled L2 content quota.
163
- - Non-adjacent frequency folding (R11): separated exact repeats (up to 8.37% of large
164
- results) fold to first occurrence plus one counted marker.
165
- - Long-string placeholders (R12): base64/hex/UUID blobs become length summaries with a
166
- 16-char recognition prefix.
167
- - Two-stage HTML reduction (R13, fixes D9): `html-slim` then `html-skeleton`, line-aligned
168
- so original line numbers survive.
169
- - R9b anchors: contiguous masks cite original line ranges, scatter masks report
170
- `lines 1-N scanned, K kept`, and every retrieve hint carries a pasteable
171
- `{"ref":…,"start_line":N,"max_lines":80}`.
172
- - Document census: omitted-document summaries list section headings instead of a constant
173
- `0 error, 0 warn, N info` histogram.
174
-
175
- ## 0.3.1 - 2026-09-18
176
-
177
- ### Changed
178
-
179
- - The runtime package is merged into the selector package: one install brings the whole
180
- stack, the repository root is the install surface (`name`, `main`, `types`, `exports` with
181
- `./pruner` and `./invariant`, `dependencies`, `dsh`), and the toolchain, scripts and CI were
182
- swept to the single package. The verified estimator-catalog registration (dual prefix, guarded
183
- two-channel activation, per-request service resolution, visible lifecycle lines) was replayed
184
- onto this line with a host-side guard; the settings schema that `ab2175a` had downgraded to
185
- `z.any()` is restored, so the daily Custom defaults are published again.
186
- - Adapt to the official DeepSeek Harness `v0.1.5-rc.2` on this branch. All `@deepseek-ai/dsh-*` dev dependencies and the pinned e2e host set move from `0.1.1-rc.2` to `0.1.5-rc.2` (cordis `4.0.2`, schemastery `3.18.2`), including the new split packages (`dsh-session-projection`, `dsh-session-persistence`, `dsh-atomic-write`, `dsh-home-paths`, `dsh-sandbox`, and related) and the `dsh-client-store` client stack.
187
- - Surface replace operations now use the v3 `startSeq`/`endSeq` shape with branded `SessionSeq` values; `compaction/prune` manifests keep the durable `start`/`end` fields. Events are resolved from surface nodes by seq lookup instead of array indexing.
188
- - The client bundle no longer imports the removed `@deepseek-ai/dsh-client-runtime`: settings types now come from `@deepseek-ai/dsh-client-ui-settings` and the session hooks merge from `@deepseek-ai/dsh-client-ui-session`. `engines.dsh >=0.1.5-alpha.1 <0.2.0-0` is declared in both package manifests and `dsh.plugin.json`.
189
- - Harness 0.1.5 no longer exposes the session `agentPreset` to the browser, so the client can no longer detect Minimal-only sessions; the selector stays selectable and the old unavailable banner is unreachable.
190
- - Test batteries updated for 0.1.5 semantics: cordis plugin starts require `.await()`, the Token Meter requires a mounted `SessionProjectionRegistry`, assistant events carry `stream: []`, and settings namespaces are plain strings.
191
-
192
- ### Fixed
193
-
194
- - The estimator card no longer demands an API key on the Harness host channel. Selecting the host channel shows the live provider/model dropdowns, names the route that would actually run (explicit override, else the session default), and renders neither a key field nor a second manual model input: the base URL, the model text field, and the write-only key belong to the direct endpoint channel alone.
195
- - `presetOptions` writes are path-addressed. Writing the whole section replaced it, so touching any second estimator field (a provider, a model, an endpoint) deleted `estimatorMode` and every sibling override — silently switching the estimator back off while the panel still reported a successful save. Each field now writes only itself, `undefined` clears exactly the field it names, and the confirmation read validates the same field set instead of the mode alone.
196
- - New coverage: `packages/selector/tests/preset-options-write.client.spec.ts` (path-scoped writes, sibling preservation, explicit clears, no-op patches, uncommitted-write reporting) and `packages/selector/tests/estimator-channel.client.spec.tsx` (per-channel fields, catalog dropdowns, manual fallback).
197
-
198
-
199
- ### Added
200
-
201
- - New `tokenpilot-inspired` profile: a TokenPilot-paper-inspired capability matrix layered on the Balanced thresholds, selected explicitly from the settings UI; every pre-existing profile keeps a byte-identical resolved policy (enforced by a captured-baseline golden test).
202
- - Byte-identical repeated tool-result dedup: an oversized repeat is replaced with a pointer to the first occurrence's append-only original event (`dedupe-pointer`), with a per-session SHA-256 index (2,048-entry insertion-order eviction, hash+seq metadata only).
203
- - No-net-savings guard: replacements whose text is not smaller than the original are rejected even when the exact tokenizer reports a token saving.
204
- - Recovery exemption: recovery-tool output is permanently exempt from every reduction pass via a unified per-session exemption set, preventing compress-restore oscillation.
205
- - Auto Compact summary locator: after `compaction/end`, the landed summary checkpoint gains an Exact Sources block (shadowed seq range, spill files, touched files) so summarized-away details stay recoverable; skipped when it would locate nothing concrete.
206
- - Read-state semantics: a historical read whose file was later mutated is `superseded` and takes the small whole-result placeholder; optional error/warn/info clustering of omitted lines is appended to historical placeholders.
207
- - Optional residual-utility estimator (three channels: off / Harness host model / direct OpenAI-compatible endpoint) with per-session exponential backoff, strict timeout, advisory-only verdicts consumed by the next pressure pass, and numeric-only `estimator-outcome` audits. The estimator card appears only while the new profile is selected; the API key is write-only in settings and never enters the frozen policy, audits, or logs.
208
- - New audit records: `summary-locator` and `estimator-outcome`; the rewrite record covers dedup via the `dedupe-pointer` reducer. Audit field allowlists are unchanged.
209
- - Simplified Chinese and English copy for the new profile and estimator card; unit and golden coverage under `packages/runtime/tests/tokenpilot/`.
210
-
211
- - Orthogonal code-skeleton compression gate (`codeSkeleton.enabled`, default off): the first exposure of an oversized fresh source-code tool result can keep an imports-and-declarations skeleton with bodies elided and error lines preserved, falling back to the original head pruning. The gate is independent of every profile and gated on exact tokenizer measurement.
212
- - Settings-UI toggle for the gate in the selector settings section, with Simplified Chinese and English copy.
213
- - Browser/runtime decode parity for the new section, confirm-on-write contract tests for `saveCodeSkeleton`, and a full-document parity matrix extension.
214
-
215
- ### Changed
216
-
217
- - Added an ESLint flat-config baseline (`pnpm lint`, enforced in CI) and a `pnpm test:watch` TDD loop; removed dead imports and hardened two error paths surfaced by the lint baseline.
218
- - This repository is now maintained as an improved fork of `WilliamShi666/dsh-context-compression-selector`; documentation ships in English, Simplified Chinese, Japanese, and Korean.
219
-
220
- ## 0.1.0 - 2026-09-03
221
-
222
- ### Added
223
-
224
- - Stable release of DeepSeek V4 Flash Vision tokenizer integration for `deepseek-v4-flash-vision-exp`, including exact text counting and bounded image-token estimates.
225
- - User-configurable model-driven Auto Compact threshold in the selector settings section.
226
- - Auto Compact threshold linkage for each standard profile's History / micro-compact watermarks and related compression parameters.
227
-
228
- ### Changed
229
-
230
- - The threshold editor now uses one direct numeric input; the slider and fixed quick-value buttons were removed.
231
- - Runtime session-event access supports both the established Harness `events` accessor and the newer `snapshotEvents()` public API.
232
-
233
- ## 0.1.0-beta.4 - 2026-09-02
234
-
235
- ### Fixed
236
-
237
- - Support the official DeepSeek Harness `dsh-v0.1.2-alpha.5` public API while retaining compatibility with the existing `0.1.1-rc.2` peer range. The plugin now owns the two small immutable-value helpers that the newer Harness no longer exports, and uses the same public `context-compression` namespace literal accepted by both Settings implementations. No Harness core code is modified.
238
-
239
- ## 0.1.0-beta.3 - 2026-09-01
240
-
241
- ### Scope
242
-
243
- This is a staged release. Exact **text-class** token counting for `deepseek-v4-flash-vision-exp`, best-effort bounded **vision-class image** estimates, and the Auto Compact threshold/UI/audit work are delivered. Exact image measurement remains **BLOCKED upstream**: the current measurement seam exposes neither the adapter's projected request-image dimensions nor the absolute serialized position, so estimates cannot be promoted to `exact-tokenizer`.
244
-
245
- ### Added
246
-
247
- - DeepSeek V4 Flash Vision support for `deepseek-v4-flash-vision-exp` via a separately bundled official tokenizer pinned at `deepseek-ai/DeepSeek-V4-Flash-Vision-Exp` revision `6821d6ad3681a4b137b066b76094fa82ebd0a380`. Text, reasoning, tool-call arguments, and pure-text tool results are counted exactly; image-bearing tool-result candidates stay fail-open.
248
- - Vision image-token arithmetic ported line-by-line from the official `inference/image_processor.py` (patch size 14, downsample 3, 384-token cap, min pixels 147456, 8:1 aspect clamp, and position-dependent alignment padding), validated against golden fixtures generated by executing the official Python implementation. Valid intrinsic dimensions now produce `tokenizer-estimate` at the midpoint of all four alignment residues with a 384-token per-image upper bound; malformed or unevaluable dimensions use a documented 256-token fallback. Mixed text/image surfaces aggregate exact text and estimated images without promoting them to exact.
249
- - `autoCompact.thresholdPercent` setting (default 80, integer 50–90, step 1) with one shared validation contract across the settings UI, the persisted schema, and the runtime resolver. The editor lives inside the context-compression selector settings section.
250
- - Standard-profile History linkage to the Auto Compact watermark: `A = floor(C × a)` rescales the History trigger, minimum reclaim, and recent-token tail; `D = floor(A × 0.875)` replaces the fixed 0.7 capacity-pressure ratio as the micro-compact last-chance gate; one batch must justify its cache break by pulling the complete request back below the deadline. Defaults at 80% reproduce the previous numbers exactly.
251
- - The preset overlay writes the saved threshold into the generated `compaction-basic` composition as `thresholdRatio` (with `retainRatio` pinned at 0.16) and, from the same read, into the plugin runtime's deployment config as `autoCompactThresholdPercent`, so one standing generation never runs Auto Compact and micro compact on two different thresholds. Any generation-identity change — threshold, source, or module paths, including equal-length ones — produces a new standing composition generation. Deterministic identity-derived stamps use an 8-hex whole-second window; equal-prefix identities can collide in that first window on a coarse filesystem, so the overlay observes the staging file's real `mtimeMs+size` key and escalates to later hash windows before the atomic rename. Content, permissions, and the final unique stamp are complete before publication; already-running sessions keep their frozen policy.
252
- - `policy-resolved` audits now record the Auto Compact coordination facts (threshold percent, `A`, `D`, parameter source — including `deployment-override`/`mixed` when deployment config replaces linked History watermarks), the routed provider/model, and the bundled tokenizer identity.
253
- - Persisted settings reject present-but-invalid sections (`profile: null`, `custom: null`, own-property `undefined`) before any schema default can absorb them; a malformed stored document freezes the session losslessly (`profile: off`, audited as `settingsInvalidFallback: lossless-off`) instead of silently enabling the lossy Balanced default. The browser decoder applies the same rule and canonicalizes legacy Custom v1/v2 documents to the same v3 document the runtime resolver produces.
254
- - The History planner returns a discriminated outcome, and `component-evaluation` audits distinguish the full skip taxonomy: `below-profile-trigger`, `below-micro-deadline`, `exact-tokenizer-unavailable`, `no-safe-candidates` (only recovery-tool output or already-cleared results), `protected-working-set` (everything inside the protected tail), `insufficient-reclaim` and `cannot-reach-deadline-target` (with the reached/required token numbers), `adaptive-cost-rejected`, and `recovery-tool-unavailable`.
255
-
256
- ### Known limitations
257
-
258
- - Images never claim exact counts. The official expansion depends on the absolute prompt position (system prompt, chat-template framing, adapter image handles) and on the adapter's final request-image projection (including per-route `imagePixelBudget`/`imageDetail` overrides and byte-cap reprojection), none of which is exposed through the current measurement seam. Intrinsic/default estimates may therefore differ materially from provider accounting. Upstream capability requests remain projected request-image dimensions and the absolute serialized position exposed to token-meter extensions.
259
- - History skips the whole batch whenever any tool-result candidate lacks an exact count, including image-bearing candidates, even though sibling text candidates are individually exact.
260
- - Custom remains manual token mode; its History parameters do not follow the Auto Compact watermark.
261
- - A vision token breakdown UI is not shipped; image estimates and the intrinsic alignment diagnostic are available on the measured token view, while lossy rewrite proofs still require exact counts.
262
-
263
- ### Deferred
264
-
265
- - Audit `modality` field and the tokenizer artifact SHA-256 inside audit records (the audits already carry the routed provider/model and tokenizer identity).
266
- - Publishing the (now complete) runtime skip-reason taxonomy as a user-facing documentation table.
267
- - Custom-profile display of the A/D watermarks and an above-D warning; Custom remains fully manual.
268
- - Vision token breakdown UI and promotion of image estimates to exact measurement.
269
-
270
- ## 0.1.0-beta.2 - 2026-08-28
271
-
272
- ### Fixed
273
-
274
- - Resolve the official DeepSeek V4 Flash tokenizer route so Fresh and Aggregate can evaluate tool results for the supported V4 models.
275
- - Run Cache Strict History at the real request boundary once its configured capacity-pressure condition is met; trigger the capacity condition at 70% routed-context utilization.
276
- - Disable Harness-native head/middle/tail tool-result pruning whenever a selector profile is active, leaving the selector as the sole tool-result compactor.
277
-
278
- ### Changed
279
-
280
- - Protect the newest 10 agent tool calls and a 64,000-token tool-result tail window before History/microcompact rewrites older results.
281
-
282
- ## 0.1.0-beta.1 - 2026-08-27
283
-
284
- ### Added
285
-
286
- - One-install DeepSeek Harness Product Bundle backed by a separate exact-version runtime package.
287
- - Web profile selector with preset-stable settings and an explicit built-in Minimal exception.
288
- - Fresh, Aggregate, routine/capacity-aware History, Native tool-result pruning, and default-off Custom TailTrim.
289
- - Standard-event TailTrim protocol using `compaction/prune` plus recoverable `user/message` replacement.
290
- - Plugin-owned `context_compression_retrieve` recovery tool.
291
- - Structured, content-free policy, evaluation, rewrite, failure, and Native auto-compact audit records.
292
- - Pinned official DeepSeek V4 tokenizer assets with runtime SHA-256 validation and upstream license.
293
- - Public-API component E2E, preset/Minimal, and parent/fork/spawn cache-prefix regression tests.
294
-
295
- ### Compatibility
296
-
297
- - Verified against DeepSeek Harness `dsh-v0.1.1-rc.2` public packages.
298
- - Exact tokenizer mapping is currently limited to `deepseek-v4-flash` and `deepseek-v4-pro`.
299
-
300
- ### Known limitations
301
-
302
- - Adaptive ordinary History fails closed when public request-level route/cache evidence is incomplete; capacity pressure remains a separate safety override.
303
- - Cache-prefix tests prove native fork inheritance and identical serialized prefixes, not a provider-specific cache allocation or a guaranteed DeepSeek cache hit.
304
- - Settings snapshots and first-exposure decisions are process-local to the mounted runtime.
1
+ # Changelog
2
+
3
+ All notable changes use this file. The project follows semantic versioning after `0.1.0`.
4
+
5
+ ## 0.5.7 - 2026-10-01
6
+
7
+ ### Added
8
+
9
+ - Japanese (`ja`) and Korean (`ko`) UI locale dictionaries, plus the fr/de/it/ru/es dictionaries ported from main — the selector settings section now speaks nine languages (zh / en / de / es / fr / it / ja / ko / ru). Host 0.1.5-rc.2 `dsh-client-locale` carries `addLanguage`, so the extras register via the untyped overload plus `addLanguage` (fallback `en`); labels are self-described, and one failed registration warns instead of sinking activation. Client-only, host-agnostic.
10
+
11
+ ### Fixed
12
+
13
+ - Stale `package-contract` assertion: `engines.dsh` was narrowed to `>=0.1.5-rc.1 <0.1.6-0` by the 0.5.6 release, but the test still expected the wide `<0.2.0-0` range — the spec now matches the shipped manifest.
14
+
15
+ ## 0.5.4 - 2026-09-20
16
+
17
+ ### Fixed
18
+
19
+ - The install surface declares `@deepseek-ai/schemastery` as a runtime dependency. The packaged
20
+ runtime imports it unconditionally (`import z from '@deepseek-ai/schemastery'` in
21
+ `packages/selector/lib/index.js`, `lib/pruner.js` and `lib/advisor-state.js`), but 0.5.3
22
+ declared it nowhere a consumer install reads: the shipped root manifest listed only
23
+ `@huggingface/tokenizers` and `js-yaml`, and `packages/selector/package.json` listed it as a
24
+ peer, which no package manager consults for a nested package it installs. Resolution therefore
25
+ depended on an unrelated installed package hoisting `@deepseek-ai/schemastery` into the
26
+ profile. In a clean install the import fell through to the Harness installation's
27
+ shared-module fallback at `$DSH_HOME/profiles/node_modules`; where that fallback held no built
28
+ package, every plugin entry failed to load and the host booted without the Bundle layer. Both
29
+ manifests now pin `3.18.2`, the version this release is built and tested against, and the
30
+ selector package no longer claims a peer obligation it does not have.
31
+
32
+ ### Added
33
+
34
+ - `verify:release` derives the install-surface dependencies from the bare specifiers the
35
+ packaged runtime files import, instead of naming `@huggingface/tokenizers` and `js-yaml` by
36
+ hand. Which packages ship with the plugin and which the Harness installation provides is a
37
+ reviewed list, and an import whose provider is in neither manifest fails the gate with the
38
+ missing name. The gate was added as a negative control against the unfixed manifests, where it
39
+ failed on `@deepseek-ai/schemastery`.
40
+
41
+ ## 0.5.3 - 2026-09-20
42
+
43
+ ### Fixed
44
+
45
+ - The Bundle patch no longer sets the retired review route flag. `reviewQueueRoute` was
46
+ removed from the plugin's Config schema when the review gate was retired, but it stayed in
47
+ `packages/selector/cordis.patch.yml`, where it advertised a route that can never register.
48
+ Hosts tolerate the unknown key today (the plugin loads and serves — verified on a live host),
49
+ so this is a stale-config defect rather than a break, but it would break on any host that
50
+ validates plugin config strictly.
51
+ - Generated artifacts are pinned to LF (`packages/selector/lib/** text eol=lf`). With
52
+ `core.autocrlf=true` every checkout rewrote the committed `lib/**` to CRLF, so any branch
53
+ switch or merge left the whole artifact directory reported as modified with EOL-only
54
+ differences. Nothing was ever committed from that state, but it made every tree look dirty
55
+ and it would hide a real artifact change.
56
+
57
+ ### Added
58
+
59
+ - A negative-control contract pin on the Bundle patch: it fails when a retired config key is
60
+ set in the patch (asserted on key-setting lines, so the explanatory comment may still name
61
+ the key), and it requires the live `estimatorCatalogRoute` flag to stay wired.
62
+
63
+ ### Tests
64
+
65
+ - The client seat contract also pins the older-host degradation: a host that does not declare
66
+ the seat rejects the registration at the slot boundary, and `apply()` must swallow it and
67
+ warn instead of taking every settings entry down with it.
68
+
69
+ ## 0.5.2 - 2026-09-20
70
+
71
+ ### Changed
72
+
73
+ - The human-gated review pipeline (beta) is **retired**. Its semantics are replaced by
74
+ advice: the benefit model still prices every pass as ONE merged mutation, but the band it
75
+ computes (`profitable` / `high-impact` / `slow-payback` / `unpriceable` / `not-worth-it`)
76
+ is now published as a `reduction-advice` audit record and snapshotted onto the advisor
77
+ report route — it never withholds, delays, or rewrites a reduction. The gate contradicted
78
+ the feature's own requirement (a reduction must never block automatic processing) and, with
79
+ the shipped defaults (`reviewMode` on plus a 4,000-token high-impact threshold against an
80
+ 8,192-token fresh trigger), diverted 100% of a fresh batch into human review, leaving the
81
+ automatic path effectively off for anyone who opted in. The advice thresholds are now
82
+ module constants (α `0.1`, high-impact `4,000` tokens): nothing acts on them, so they are
83
+ no longer settings.
84
+ - Removed with the gate: the review queue and its `storageDomain` adapter, the process-wide
85
+ registry, the `review-queue` / `review-decide` HTTP routes and the `reviewQueueRoute`
86
+ deployment flag, the `shell.overlay` client panel, the `reviewMode` /
87
+ `reviewTimeoutTurns` / `cacheHitDiscountAlpha` / `reviewHighImpactTokens` settings keys,
88
+ and the `review-outcome` audit kind. The four settings keys stay ACCEPTED and IGNORED by
89
+ both decoders — an existing document (the live one carries `reviewMode: false`) still loads
90
+ and still renders its settings card — and never reach the resolved policy. The read-only
91
+ `GET .../advisor-report` route additionally serves `lastAdvice`.
92
+
93
+ ### Added
94
+
95
+ - Regression pins for the retirement: a host-integration spec drives the exact settings that
96
+ used to divert everything (`reviewMode: true`, `reviewHighImpactTokens: 1`) and asserts the
97
+ fresh batch LANDS, described by a `high-impact` advice record; a deprecation-contract spec
98
+ pins accept-and-ignore for the retired keys on both the runtime parser and the browser
99
+ decoder.
100
+
101
+ ### Rollback
102
+
103
+ - Reinstall the last release that still ships the gate: `npm dist-tag add
104
+ dsh-context-compression-improved@0.5.1 dsh-0.1.5 --registry https://registry.npmjs.org/`
105
+ then `dsh plugin --profile web add dsh-context-compression-improved@0.5.1`.
106
+
107
+ ## 0.5.1 - 2026-09-20
108
+
109
+ ### Fixed
110
+
111
+ - Concurrent preset-overlay composition of one identity no longer fails on Windows.
112
+ Publication is now serialized per destination path, and when the atomic rename still
113
+ loses the race the destination is confirmed to already carry this staging file's
114
+ `{mtimeMs, size}` standing key before the publish reports success. Windows `MoveFileEx`
115
+ reports that lost race as `EPERM`/`EBUSY` where POSIX `rename` simply replaces the
116
+ destination, which made `standingKeyFor()` throw during concurrent session start. A
117
+ destination that does not match still fails loudly, so a silently reused generation
118
+ stays forbidden.
119
+ - Release-gate and test repairs that had been hiding this and other pre-existing red
120
+ gates: stale identifiers and a retired audit reason in the packed smokes, a stale
121
+ client-inject expectation, and Windows-only spawn traps (`git` and multi-line
122
+ `node -e` scripts were routed through `cmd.exe`, which rewrote their arguments).
123
+
124
+ ## 0.5.0 - 2026-09-20
125
+
126
+ ### Added
127
+
128
+ - Advisory relevance advisor (statistics and suggestions only, default off): at every turn
129
+ boundary a fire-and-forget pass summarizes the session's tail-task semantics from the
130
+ most recent `todo/write` event (falling back to recent user text), incrementally scores
131
+ historical tool-result candidates for content-and-comment relevance against the current
132
+ task, and computes a prefix-decay figure (character-pressure-weighted mean relevance).
133
+ Low-relevance old segments are marked `recertified` as suggestions for later
134
+ history-aggressiveness decisions — nothing this round consumes them, and advisor output
135
+ can never suppress, delay, or rewrite any reduction that would land (pinned by a
136
+ dedicated invariant test). Configure through the `presetOptions.advisor*` settings keys
137
+ (`advisorMode` `''|'host'|'direct'`, default `''`; the direct channel reuses the
138
+ estimator endpoint; `SideChannel` gained an optional overrides parameter so the
139
+ estimator's transport is shared without sharing its configuration). Observability: new
140
+ `advisor-outcome` audit records (content-free, one per phase: summary / scoring / decay)
141
+ and a read-only `GET .../advisor-report?sessionId=` HTTP route (opt-in deployment flag
142
+ `advisorReportRoute`, mirroring the review routes). Client UI is intentionally absent
143
+ this round.
144
+
145
+ ## 0.4.0 - 2026-09-20
146
+
147
+ ### Fixed
148
+
149
+ - The plugin no longer depends on the routed model id: every planning gate now decides on
150
+ the character basis (Unicode code points via `characterPressure` / `pressureCost`) instead
151
+ of exact tokenizer counts, so a route without a bundled tokenizer (the live
152
+ `deepseek-flash`) lands rewrites again instead of silently skipping. Token thresholds keep
153
+ their names and values (converted at the documented 4.0 chars/token convention, frozen
154
+ profile baseline untouched); token figures become telemetry, labelled honestly by the new
155
+ `measurementBasis` field on rewrite audit records (`exact-tokenizer` vs `characters`,
156
+ with `tokenizerId: 'characters'` / `tokenizerRevision: 'chars-per-token-4.0'` when derived).
157
+ Rollback: `git revert 7a1972a` restores the exact-tokenizer gates as a single unit; confirm
158
+ no later change re-introduced a model-id split that relies on this commit first.
159
+
160
+ ### Added
161
+
162
+ - Batch-level benefit pricing (R1): a review pass is priced as ONE merged mutation — the
163
+ tail KV-cache refill penalty is paid once per batch instead of per candidate, so real
164
+ batches (5×50k with a 64k tail) reach the auto band instead of all dropping.
165
+ - Original-event line mapping (R9a): terminal normalization returns folded lines that each
166
+ carry their 1-based original-event line number; `retrieve` reads raw events, so printed
167
+ ranges resolve to the right lines.
168
+ - Document skeleton and universal prose keep (R8/R8b): structured documents keep headings,
169
+ section first/last lines, list starts and table headers; every other non-code text keeps
170
+ head AND tail with an R9 line-range marker (prose was previously head-only truncated).
171
+ - Two-tier search folding (R10, fixes D8): a lossless per-file L1 locator plus a
172
+ water-filled L2 content quota.
173
+ - Non-adjacent frequency folding (R11): separated exact repeats (up to 8.37% of large
174
+ results) fold to first occurrence plus one counted marker.
175
+ - Long-string placeholders (R12): base64/hex/UUID blobs become length summaries with a
176
+ 16-char recognition prefix.
177
+ - Two-stage HTML reduction (R13, fixes D9): `html-slim` then `html-skeleton`, line-aligned
178
+ so original line numbers survive.
179
+ - R9b anchors: contiguous masks cite original line ranges, scatter masks report
180
+ `lines 1-N scanned, K kept`, and every retrieve hint carries a pasteable
181
+ `{"ref":…,"start_line":N,"max_lines":80}`.
182
+ - Document census: omitted-document summaries list section headings instead of a constant
183
+ `0 error, 0 warn, N info` histogram.
184
+
185
+ ## 0.3.1 - 2026-09-18
186
+
187
+ ### Changed
188
+
189
+ - The runtime package is merged into the selector package: one install brings the whole
190
+ stack, the repository root is the install surface (`name`, `main`, `types`, `exports` with
191
+ `./pruner` and `./invariant`, `dependencies`, `dsh`), and the toolchain, scripts and CI were
192
+ swept to the single package. The verified estimator-catalog registration (dual prefix, guarded
193
+ two-channel activation, per-request service resolution, visible lifecycle lines) was replayed
194
+ onto this line with a host-side guard; the settings schema that `ab2175a` had downgraded to
195
+ `z.any()` is restored, so the daily Custom defaults are published again.
196
+ - Adapt to the official DeepSeek Harness `v0.1.5-rc.2` on this branch. All `@deepseek-ai/dsh-*` dev dependencies and the pinned e2e host set move from `0.1.1-rc.2` to `0.1.5-rc.2` (cordis `4.0.2`, schemastery `3.18.2`), including the new split packages (`dsh-session-projection`, `dsh-session-persistence`, `dsh-atomic-write`, `dsh-home-paths`, `dsh-sandbox`, and related) and the `dsh-client-store` client stack.
197
+ - Surface replace operations now use the v3 `startSeq`/`endSeq` shape with branded `SessionSeq` values; `compaction/prune` manifests keep the durable `start`/`end` fields. Events are resolved from surface nodes by seq lookup instead of array indexing.
198
+ - The client bundle no longer imports the removed `@deepseek-ai/dsh-client-runtime`: settings types now come from `@deepseek-ai/dsh-client-ui-settings` and the session hooks merge from `@deepseek-ai/dsh-client-ui-session`. `engines.dsh >=0.1.5-alpha.1 <0.2.0-0` is declared in both package manifests and `dsh.plugin.json`.
199
+ - Harness 0.1.5 no longer exposes the session `agentPreset` to the browser, so the client can no longer detect Minimal-only sessions; the selector stays selectable and the old unavailable banner is unreachable.
200
+ - Test batteries updated for 0.1.5 semantics: cordis plugin starts require `.await()`, the Token Meter requires a mounted `SessionProjectionRegistry`, assistant events carry `stream: []`, and settings namespaces are plain strings.
201
+
202
+ ### Fixed
203
+
204
+ - The estimator card no longer demands an API key on the Harness host channel. Selecting the host channel shows the live provider/model dropdowns, names the route that would actually run (explicit override, else the session default), and renders neither a key field nor a second manual model input: the base URL, the model text field, and the write-only key belong to the direct endpoint channel alone.
205
+ - `presetOptions` writes are path-addressed. Writing the whole section replaced it, so touching any second estimator field (a provider, a model, an endpoint) deleted `estimatorMode` and every sibling override — silently switching the estimator back off while the panel still reported a successful save. Each field now writes only itself, `undefined` clears exactly the field it names, and the confirmation read validates the same field set instead of the mode alone.
206
+ - New coverage: `packages/selector/tests/preset-options-write.client.spec.ts` (path-scoped writes, sibling preservation, explicit clears, no-op patches, uncommitted-write reporting) and `packages/selector/tests/estimator-channel.client.spec.tsx` (per-channel fields, catalog dropdowns, manual fallback).
207
+
208
+
209
+ ### Added
210
+
211
+ - New `tokenpilot-inspired` profile: a TokenPilot-paper-inspired capability matrix layered on the Balanced thresholds, selected explicitly from the settings UI; every pre-existing profile keeps a byte-identical resolved policy (enforced by a captured-baseline golden test).
212
+ - Byte-identical repeated tool-result dedup: an oversized repeat is replaced with a pointer to the first occurrence's append-only original event (`dedupe-pointer`), with a per-session SHA-256 index (2,048-entry insertion-order eviction, hash+seq metadata only).
213
+ - No-net-savings guard: replacements whose text is not smaller than the original are rejected even when the exact tokenizer reports a token saving.
214
+ - Recovery exemption: recovery-tool output is permanently exempt from every reduction pass via a unified per-session exemption set, preventing compress-restore oscillation.
215
+ - Auto Compact summary locator: after `compaction/end`, the landed summary checkpoint gains an Exact Sources block (shadowed seq range, spill files, touched files) so summarized-away details stay recoverable; skipped when it would locate nothing concrete.
216
+ - Read-state semantics: a historical read whose file was later mutated is `superseded` and takes the small whole-result placeholder; optional error/warn/info clustering of omitted lines is appended to historical placeholders.
217
+ - Optional residual-utility estimator (three channels: off / Harness host model / direct OpenAI-compatible endpoint) with per-session exponential backoff, strict timeout, advisory-only verdicts consumed by the next pressure pass, and numeric-only `estimator-outcome` audits. The estimator card appears only while the new profile is selected; the API key is write-only in settings and never enters the frozen policy, audits, or logs.
218
+ - New audit records: `summary-locator` and `estimator-outcome`; the rewrite record covers dedup via the `dedupe-pointer` reducer. Audit field allowlists are unchanged.
219
+ - Simplified Chinese and English copy for the new profile and estimator card; unit and golden coverage under `packages/runtime/tests/tokenpilot/`.
220
+
221
+ - Orthogonal code-skeleton compression gate (`codeSkeleton.enabled`, default off): the first exposure of an oversized fresh source-code tool result can keep an imports-and-declarations skeleton with bodies elided and error lines preserved, falling back to the original head pruning. The gate is independent of every profile and gated on exact tokenizer measurement.
222
+ - Settings-UI toggle for the gate in the selector settings section, with Simplified Chinese and English copy.
223
+ - Browser/runtime decode parity for the new section, confirm-on-write contract tests for `saveCodeSkeleton`, and a full-document parity matrix extension.
224
+
225
+ ### Changed
226
+
227
+ - Added an ESLint flat-config baseline (`pnpm lint`, enforced in CI) and a `pnpm test:watch` TDD loop; removed dead imports and hardened two error paths surfaced by the lint baseline.
228
+ - This repository is now maintained as an improved fork of `WilliamShi666/dsh-context-compression-selector`; documentation ships in English, Simplified Chinese, Japanese, and Korean.
229
+
230
+ ## 0.1.0 - 2026-09-03
231
+
232
+ ### Added
233
+
234
+ - Stable release of DeepSeek V4 Flash Vision tokenizer integration for `deepseek-v4-flash-vision-exp`, including exact text counting and bounded image-token estimates.
235
+ - User-configurable model-driven Auto Compact threshold in the selector settings section.
236
+ - Auto Compact threshold linkage for each standard profile's History / micro-compact watermarks and related compression parameters.
237
+
238
+ ### Changed
239
+
240
+ - The threshold editor now uses one direct numeric input; the slider and fixed quick-value buttons were removed.
241
+ - Runtime session-event access supports both the established Harness `events` accessor and the newer `snapshotEvents()` public API.
242
+
243
+ ## 0.1.0-beta.4 - 2026-09-02
244
+
245
+ ### Fixed
246
+
247
+ - Support the official DeepSeek Harness `dsh-v0.1.2-alpha.5` public API while retaining compatibility with the existing `0.1.1-rc.2` peer range. The plugin now owns the two small immutable-value helpers that the newer Harness no longer exports, and uses the same public `context-compression` namespace literal accepted by both Settings implementations. No Harness core code is modified.
248
+
249
+ ## 0.1.0-beta.3 - 2026-09-01
250
+
251
+ ### Scope
252
+
253
+ This is a staged release. Exact **text-class** token counting for `deepseek-v4-flash-vision-exp`, best-effort bounded **vision-class image** estimates, and the Auto Compact threshold/UI/audit work are delivered. Exact image measurement remains **BLOCKED upstream**: the current measurement seam exposes neither the adapter's projected request-image dimensions nor the absolute serialized position, so estimates cannot be promoted to `exact-tokenizer`.
254
+
255
+ ### Added
256
+
257
+ - DeepSeek V4 Flash Vision support for `deepseek-v4-flash-vision-exp` via a separately bundled official tokenizer pinned at `deepseek-ai/DeepSeek-V4-Flash-Vision-Exp` revision `6821d6ad3681a4b137b066b76094fa82ebd0a380`. Text, reasoning, tool-call arguments, and pure-text tool results are counted exactly; image-bearing tool-result candidates stay fail-open.
258
+ - Vision image-token arithmetic ported line-by-line from the official `inference/image_processor.py` (patch size 14, downsample 3, 384-token cap, min pixels 147456, 8:1 aspect clamp, and position-dependent alignment padding), validated against golden fixtures generated by executing the official Python implementation. Valid intrinsic dimensions now produce `tokenizer-estimate` at the midpoint of all four alignment residues with a 384-token per-image upper bound; malformed or unevaluable dimensions use a documented 256-token fallback. Mixed text/image surfaces aggregate exact text and estimated images without promoting them to exact.
259
+ - `autoCompact.thresholdPercent` setting (default 80, integer 50–90, step 1) with one shared validation contract across the settings UI, the persisted schema, and the runtime resolver. The editor lives inside the context-compression selector settings section.
260
+ - Standard-profile History linkage to the Auto Compact watermark: `A = floor(C × a)` rescales the History trigger, minimum reclaim, and recent-token tail; `D = floor(A × 0.875)` replaces the fixed 0.7 capacity-pressure ratio as the micro-compact last-chance gate; one batch must justify its cache break by pulling the complete request back below the deadline. Defaults at 80% reproduce the previous numbers exactly.
261
+ - The preset overlay writes the saved threshold into the generated `compaction-basic` composition as `thresholdRatio` (with `retainRatio` pinned at 0.16) and, from the same read, into the plugin runtime's deployment config as `autoCompactThresholdPercent`, so one standing generation never runs Auto Compact and micro compact on two different thresholds. Any generation-identity change — threshold, source, or module paths, including equal-length ones — produces a new standing composition generation. Deterministic identity-derived stamps use an 8-hex whole-second window; equal-prefix identities can collide in that first window on a coarse filesystem, so the overlay observes the staging file's real `mtimeMs+size` key and escalates to later hash windows before the atomic rename. Content, permissions, and the final unique stamp are complete before publication; already-running sessions keep their frozen policy.
262
+ - `policy-resolved` audits now record the Auto Compact coordination facts (threshold percent, `A`, `D`, parameter source — including `deployment-override`/`mixed` when deployment config replaces linked History watermarks), the routed provider/model, and the bundled tokenizer identity.
263
+ - Persisted settings reject present-but-invalid sections (`profile: null`, `custom: null`, own-property `undefined`) before any schema default can absorb them; a malformed stored document freezes the session losslessly (`profile: off`, audited as `settingsInvalidFallback: lossless-off`) instead of silently enabling the lossy Balanced default. The browser decoder applies the same rule and canonicalizes legacy Custom v1/v2 documents to the same v3 document the runtime resolver produces.
264
+ - The History planner returns a discriminated outcome, and `component-evaluation` audits distinguish the full skip taxonomy: `below-profile-trigger`, `below-micro-deadline`, `exact-tokenizer-unavailable`, `no-safe-candidates` (only recovery-tool output or already-cleared results), `protected-working-set` (everything inside the protected tail), `insufficient-reclaim` and `cannot-reach-deadline-target` (with the reached/required token numbers), `adaptive-cost-rejected`, and `recovery-tool-unavailable`.
265
+
266
+ ### Known limitations
267
+
268
+ - Images never claim exact counts. The official expansion depends on the absolute prompt position (system prompt, chat-template framing, adapter image handles) and on the adapter's final request-image projection (including per-route `imagePixelBudget`/`imageDetail` overrides and byte-cap reprojection), none of which is exposed through the current measurement seam. Intrinsic/default estimates may therefore differ materially from provider accounting. Upstream capability requests remain projected request-image dimensions and the absolute serialized position exposed to token-meter extensions.
269
+ - History skips the whole batch whenever any tool-result candidate lacks an exact count, including image-bearing candidates, even though sibling text candidates are individually exact.
270
+ - Custom remains manual token mode; its History parameters do not follow the Auto Compact watermark.
271
+ - A vision token breakdown UI is not shipped; image estimates and the intrinsic alignment diagnostic are available on the measured token view, while lossy rewrite proofs still require exact counts.
272
+
273
+ ### Deferred
274
+
275
+ - Audit `modality` field and the tokenizer artifact SHA-256 inside audit records (the audits already carry the routed provider/model and tokenizer identity).
276
+ - Publishing the (now complete) runtime skip-reason taxonomy as a user-facing documentation table.
277
+ - Custom-profile display of the A/D watermarks and an above-D warning; Custom remains fully manual.
278
+ - Vision token breakdown UI and promotion of image estimates to exact measurement.
279
+
280
+ ## 0.1.0-beta.2 - 2026-08-28
281
+
282
+ ### Fixed
283
+
284
+ - Resolve the official DeepSeek V4 Flash tokenizer route so Fresh and Aggregate can evaluate tool results for the supported V4 models.
285
+ - Run Cache Strict History at the real request boundary once its configured capacity-pressure condition is met; trigger the capacity condition at 70% routed-context utilization.
286
+ - Disable Harness-native head/middle/tail tool-result pruning whenever a selector profile is active, leaving the selector as the sole tool-result compactor.
287
+
288
+ ### Changed
289
+
290
+ - Protect the newest 10 agent tool calls and a 64,000-token tool-result tail window before History/microcompact rewrites older results.
291
+
292
+ ## 0.1.0-beta.1 - 2026-08-27
293
+
294
+ ### Added
295
+
296
+ - One-install DeepSeek Harness Product Bundle backed by a separate exact-version runtime package.
297
+ - Web profile selector with preset-stable settings and an explicit built-in Minimal exception.
298
+ - Fresh, Aggregate, routine/capacity-aware History, Native tool-result pruning, and default-off Custom TailTrim.
299
+ - Standard-event TailTrim protocol using `compaction/prune` plus recoverable `user/message` replacement.
300
+ - Plugin-owned `context_compression_retrieve` recovery tool.
301
+ - Structured, content-free policy, evaluation, rewrite, failure, and Native auto-compact audit records.
302
+ - Pinned official DeepSeek V4 tokenizer assets with runtime SHA-256 validation and upstream license.
303
+ - Public-API component E2E, preset/Minimal, and parent/fork/spawn cache-prefix regression tests.
304
+
305
+ ### Compatibility
306
+
307
+ - Verified against DeepSeek Harness `dsh-v0.1.1-rc.2` public packages.
308
+ - Exact tokenizer mapping is currently limited to `deepseek-v4-flash` and `deepseek-v4-pro`.
309
+
310
+ ### Known limitations
311
+
312
+ - Adaptive ordinary History fails closed when public request-level route/cache evidence is incomplete; capacity pressure remains a separate safety override.
313
+ - Cache-prefix tests prove native fork inheritance and identical serialized prefixes, not a provider-specific cache allocation or a guaranteed DeepSeek cache hit.
314
+ - Settings snapshots and first-exposure decisions are process-local to the mounted runtime.