dsh-context-compression-improved 0.6.5 → 0.7.0-beta.2

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 (70) hide show
  1. package/.github/workflows/ci.yml +39 -39
  2. package/CHANGELOG.ja.md +217 -211
  3. package/CHANGELOG.ko.md +211 -205
  4. package/CHANGELOG.md +392 -350
  5. package/CHANGELOG.zh.md +196 -190
  6. package/README.md +97 -96
  7. package/README.zh.md +86 -85
  8. package/eslint.config.js +76 -30
  9. package/package.json +3 -1
  10. package/packages/selector/dsh.plugin.json +1 -1
  11. package/packages/selector/lib/client.js +747 -3
  12. package/packages/selector/lib/index.js +92 -1
  13. package/packages/selector/lib/{advisor-state.js → intent-gate.js} +91 -3
  14. package/packages/selector/lib/profiles.d.ts +9 -0
  15. package/packages/selector/lib/pruner.d.ts +59 -0
  16. package/packages/selector/lib/pruner.js +410 -8
  17. package/packages/selector/src/client/decode.ts +53 -49
  18. package/packages/selector/src/client/index.ts +30 -0
  19. package/packages/selector/src/client/locales/de.ts +98 -0
  20. package/packages/selector/src/client/locales/es.ts +98 -0
  21. package/packages/selector/src/client/locales/fr.ts +98 -0
  22. package/packages/selector/src/client/locales/it.ts +98 -0
  23. package/packages/selector/src/client/locales/ja.ts +98 -0
  24. package/packages/selector/src/client/locales/ko.ts +98 -0
  25. package/packages/selector/src/client/locales/ru.ts +98 -0
  26. package/packages/selector/src/deepseek-v4-tokenizer.ts +205 -205
  27. package/packages/selector/src/index.ts +418 -411
  28. package/packages/selector/src/preset-overlay.ts +629 -626
  29. package/packages/selector/src/profiles.ts +414 -394
  30. package/packages/selector/src/pruner/content.ts +198 -198
  31. package/packages/selector/src/pruner/state.ts +57 -50
  32. package/packages/selector/src/pruner.ts +2665 -2421
  33. package/packages/selector/src/runtime/audit.ts +303 -286
  34. package/packages/selector/src/runtime/config.ts +731 -706
  35. package/packages/selector/src/runtime/reducers.ts +1674 -1674
  36. package/packages/selector/src/runtime/summary-command.ts +133 -0
  37. package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +233 -188
  38. package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +204 -149
  39. package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -0
  40. package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -0
  41. package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -0
  42. package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -0
  43. package/packages/selector/src/runtime/tokenpilot/locator.ts +128 -128
  44. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +306 -303
  45. package/packages/selector/src/runtime/types.ts +358 -346
  46. package/packages/selector/tests/auto-compact.client.spec.tsx +214 -213
  47. package/packages/selector/tests/built/client-artifact.spec.ts +61 -59
  48. package/packages/selector/tests/code-skeleton.client.spec.ts +94 -93
  49. package/packages/selector/tests/custom-contract.client.spec.ts +223 -222
  50. package/packages/selector/tests/estimator-channel.client.spec.tsx +252 -252
  51. package/packages/selector/tests/preset-options-write.client.spec.ts +188 -187
  52. package/packages/selector/tests/profiles.client.spec.tsx +436 -434
  53. package/packages/selector/tests/runtime/audit.spec.ts +275 -274
  54. package/packages/selector/tests/runtime/auto-compact-config.spec.ts +523 -523
  55. package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +122 -122
  56. package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -0
  57. package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -0
  58. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +5 -0
  59. package/packages/selector/tests/runtime/summary-command.spec.ts +154 -0
  60. package/packages/selector/tests/standing-generation.host.spec.ts +15 -35
  61. package/scripts/packed-components-smoke.mjs +734 -732
  62. package/scripts/packed-install-e2e.mjs +1275 -1273
  63. package/scripts/verify-release.mjs +318 -317
  64. package/tests/TEST_INVENTORY.md +41 -41
  65. package/tsconfig.tests.json +17 -15
  66. package/vitest.config.ts +57 -43
  67. package/.agents-stash-064.patch +0 -39
  68. package/_dsh_devdeps.json +0 -50
  69. package/_verify064/package/package.json +0 -162
  70. package/_verify064/package/packages/selector/src/client/index.ts +0 -232
package/CHANGELOG.md CHANGED
@@ -1,350 +1,392 @@
1
- # Changelog
2
-
3
- All notable changes use this file. The project follows semantic versioning after `0.1.0`.
4
-
5
- ## 0.6.5 - 2026-09-29
6
-
7
- ### Fixed
8
-
9
- - Dev-dependency alignment to the Harness 0.1.7 line: 46 of the 48 `@deepseek-ai/dsh-*`
10
- dev-dependencies moved from the precise `0.1.5-rc.2` pin to the precise `0.1.7-rc.2` pin,
11
- and `pnpm-lock.yaml` was regenerated from a clean tree. Typecheck, build, test, lint, and
12
- `verify:release` now run against the real 0.1.7-rc.2 baseline instead of validating the
13
- 0.1.7 adaptations against 0.1.5 inputs (a false green). Two packages have no 0.1.7-line
14
- release at all and keep their install-time pinned values: `@deepseek-ai/dsh-agent-presets`
15
- (`0.1.6-alpha.2`) and `@deepseek-ai/dsh-code-runtime` (`0.1.5-rc.3`). `react-dom` gained an
16
- explicit `^18.2.0` dev-dependency so a fresh resolution cannot pair React-DOM 19 with
17
- React 18 under the test suites.
18
- - The test-host settings seam was rebuilt against the real 0.1.7 host: `SettingsProvider`
19
- no longer exists in `@deepseek-ai/dsh-settings` (replaced by the declarative
20
- `SettingsForms`), while the plugin keeps the legacy `ctx.settings.get(ns)` read as a
21
- host-shape fallback. The specs now mount a vendored copy of the 0.1.5-rc.2 provider
22
- (`tests/helpers/legacy-settings/`) to exercise exactly that fallback, and the
23
- legacy-namespace registrar narrows the service at the seam. The live DeepSeek harness test
24
- registers the provider through the 0.1.7 adapter seam instead of the removed
25
- self-contained `llm-deepseek` plugin.
26
- - Test adaptations surfaced by the real baseline: the compaction-engine fixtures pass
27
- `headroomTokens: 0` (0.1.7-rc.2 defaults a 65536-token compaction headroom, which swallows
28
- the fixtures' 1k-token probe windows), and the tool-result asset assertion follows the
29
- first-class `role: 'tool'` message shape (no wrapping `tool-result` content block).
30
- - Release gates re-pinned to the official 0.1.7 release: `verify-release.mjs` and the packed
31
- E2E now assert selector peers `>=0.1.7-rc.1 <0.2.0-0`, and the packed E2E's official-harness
32
- clone asserts tag `dsh-v0.1.7-rc.2` (commit `477b4f42`, tree `e3e63253`).
33
- - `packages/selector/dsh.plugin.json` now carries the release version (0.6.5; every earlier
34
- 0.6.x shipped it frozen at 0.1.0) and declares the honest engine range
35
- `>=0.1.7-rc.1 <0.2.0-0`.
36
- - Lint debt from the 0.6.3 manual adaptations cleared: unused imports/locals removed in
37
- `src/index.ts`, `src/client/index.ts`, `src/pruner.ts`, and three host specs; the
38
- standing-generation staging-leftover scan now scopes to the spec's own store so a
39
- concurrently publishing spec cannot fail it.
40
-
41
- ## 0.6.4 - 2026-09-26
42
-
43
- ### Fixed
44
-
45
- - The client locale binder is eager: switching the host locale now re-renders the
46
- compression settings UI without a remount.
47
- - Released from a stash and never committed to any branch (the working tree that published it
48
- was lost); compat/0.1.7 restored the exact content in 0.6.5 and byte-verified it against
49
- the registry tarball before continuing.
50
-
51
- ## 0.5.4 - 2026-09-20
52
-
53
- ### Fixed
54
-
55
- - The install surface declares `@deepseek-ai/schemastery` as a runtime dependency. The packaged
56
- runtime imports it unconditionally (`import z from '@deepseek-ai/schemastery'` in
57
- `packages/selector/lib/index.js`, `lib/pruner.js` and `lib/advisor-state.js`), but 0.5.3
58
- declared it nowhere a consumer install reads: the shipped root manifest listed only
59
- `@huggingface/tokenizers` and `js-yaml`, and `packages/selector/package.json` listed it as a
60
- peer, which no package manager consults for a nested package it installs. Resolution therefore
61
- depended on an unrelated installed package hoisting `@deepseek-ai/schemastery` into the
62
- profile. In a clean install the import fell through to the Harness installation's
63
- shared-module fallback at `$DSH_HOME/profiles/node_modules`; where that fallback held no built
64
- package, every plugin entry failed to load and the host booted without the Bundle layer. Both
65
- manifests now pin `3.18.2`, the version this release is built and tested against, and the
66
- selector package no longer claims a peer obligation it does not have.
67
-
68
- ### Added
69
-
70
- - `verify:release` derives the install-surface dependencies from the bare specifiers the
71
- packaged runtime files import, instead of naming `@huggingface/tokenizers` and `js-yaml` by
72
- hand. Which packages ship with the plugin and which the Harness installation provides is a
73
- reviewed list, and an import whose provider is in neither manifest fails the gate with the
74
- missing name. The gate was added as a negative control against the unfixed manifests, where it
75
- failed on `@deepseek-ai/schemastery`.
76
-
77
- ## 0.5.3 - 2026-09-20
78
-
79
- ### Fixed
80
-
81
- - The Bundle patch no longer sets the retired review route flag. `reviewQueueRoute` was
82
- removed from the plugin's Config schema when the review gate was retired, but it stayed in
83
- `packages/selector/cordis.patch.yml`, where it advertised a route that can never register.
84
- Hosts tolerate the unknown key today (the plugin loads and serves — verified on a live host),
85
- so this is a stale-config defect rather than a break, but it would break on any host that
86
- validates plugin config strictly.
87
- - Generated artifacts are pinned to LF (`packages/selector/lib/** text eol=lf`). With
88
- `core.autocrlf=true` every checkout rewrote the committed `lib/**` to CRLF, so any branch
89
- switch or merge left the whole artifact directory reported as modified with EOL-only
90
- differences. Nothing was ever committed from that state, but it made every tree look dirty
91
- and it would hide a real artifact change.
92
-
93
- ### Added
94
-
95
- - A negative-control contract pin on the Bundle patch: it fails when a retired config key is
96
- set in the patch (asserted on key-setting lines, so the explanatory comment may still name
97
- the key), and it requires the live `estimatorCatalogRoute` flag to stay wired.
98
-
99
- ### Tests
100
-
101
- - The client seat contract also pins the older-host degradation: a host that does not declare
102
- the seat rejects the registration at the slot boundary, and `apply()` must swallow it and
103
- warn instead of taking every settings entry down with it.
104
-
105
- ## 0.5.2 - 2026-09-20
106
-
107
- ### Changed
108
-
109
- - The human-gated review pipeline (beta) is **retired**. Its semantics are replaced by
110
- advice: the benefit model still prices every pass as ONE merged mutation, but the band it
111
- computes (`profitable` / `high-impact` / `slow-payback` / `unpriceable` / `not-worth-it`)
112
- is now published as a `reduction-advice` audit record and snapshotted onto the advisor
113
- report route — it never withholds, delays, or rewrites a reduction. The gate contradicted
114
- the feature's own requirement (a reduction must never block automatic processing) and, with
115
- the shipped defaults (`reviewMode` on plus a 4,000-token high-impact threshold against an
116
- 8,192-token fresh trigger), diverted 100% of a fresh batch into human review, leaving the
117
- automatic path effectively off for anyone who opted in. The advice thresholds are now
118
- module constants (α `0.1`, high-impact `4,000` tokens): nothing acts on them, so they are
119
- no longer settings.
120
- - Removed with the gate: the review queue and its `storageDomain` adapter, the process-wide
121
- registry, the `review-queue` / `review-decide` HTTP routes and the `reviewQueueRoute`
122
- deployment flag, the `shell.overlay` client panel, the `reviewMode` /
123
- `reviewTimeoutTurns` / `cacheHitDiscountAlpha` / `reviewHighImpactTokens` settings keys,
124
- and the `review-outcome` audit kind. The four settings keys stay ACCEPTED and IGNORED by
125
- both decoders — an existing document (the live one carries `reviewMode: false`) still loads
126
- and still renders its settings card — and never reach the resolved policy. The read-only
127
- `GET .../advisor-report` route additionally serves `lastAdvice`.
128
-
129
- ### Added
130
-
131
- - Regression pins for the retirement: a host-integration spec drives the exact settings that
132
- used to divert everything (`reviewMode: true`, `reviewHighImpactTokens: 1`) and asserts the
133
- fresh batch LANDS, described by a `high-impact` advice record; a deprecation-contract spec
134
- pins accept-and-ignore for the retired keys on both the runtime parser and the browser
135
- decoder.
136
-
137
- ### Rollback
138
-
139
- - Reinstall the last release that still ships the gate: `npm dist-tag add
140
- dsh-context-compression-improved@0.5.1 dsh-0.1.5 --registry https://registry.npmjs.org/`
141
- then `dsh plugin --profile web add dsh-context-compression-improved@0.5.1`.
142
-
143
- ## 0.5.1 - 2026-09-20
144
-
145
- ### Fixed
146
-
147
- - Concurrent preset-overlay composition of one identity no longer fails on Windows.
148
- Publication is now serialized per destination path, and when the atomic rename still
149
- loses the race the destination is confirmed to already carry this staging file's
150
- `{mtimeMs, size}` standing key before the publish reports success. Windows `MoveFileEx`
151
- reports that lost race as `EPERM`/`EBUSY` where POSIX `rename` simply replaces the
152
- destination, which made `standingKeyFor()` throw during concurrent session start. A
153
- destination that does not match still fails loudly, so a silently reused generation
154
- stays forbidden.
155
- - Release-gate and test repairs that had been hiding this and other pre-existing red
156
- gates: stale identifiers and a retired audit reason in the packed smokes, a stale
157
- client-inject expectation, and Windows-only spawn traps (`git` and multi-line
158
- `node -e` scripts were routed through `cmd.exe`, which rewrote their arguments).
159
-
160
- ## 0.5.0 - 2026-09-20
161
-
162
- ### Added
163
-
164
- - Advisory relevance advisor (statistics and suggestions only, default off): at every turn
165
- boundary a fire-and-forget pass summarizes the session's tail-task semantics from the
166
- most recent `todo/write` event (falling back to recent user text), incrementally scores
167
- historical tool-result candidates for content-and-comment relevance against the current
168
- task, and computes a prefix-decay figure (character-pressure-weighted mean relevance).
169
- Low-relevance old segments are marked `recertified` as suggestions for later
170
- history-aggressiveness decisions — nothing this round consumes them, and advisor output
171
- can never suppress, delay, or rewrite any reduction that would land (pinned by a
172
- dedicated invariant test). Configure through the `presetOptions.advisor*` settings keys
173
- (`advisorMode` `''|'host'|'direct'`, default `''`; the direct channel reuses the
174
- estimator endpoint; `SideChannel` gained an optional overrides parameter so the
175
- estimator's transport is shared without sharing its configuration). Observability: new
176
- `advisor-outcome` audit records (content-free, one per phase: summary / scoring / decay)
177
- and a read-only `GET .../advisor-report?sessionId=` HTTP route (opt-in deployment flag
178
- `advisorReportRoute`, mirroring the review routes). Client UI is intentionally absent
179
- this round.
180
-
181
- ## 0.4.0 - 2026-09-20
182
-
183
- ### Fixed
184
-
185
- - The plugin no longer depends on the routed model id: every planning gate now decides on
186
- the character basis (Unicode code points via `characterPressure` / `pressureCost`) instead
187
- of exact tokenizer counts, so a route without a bundled tokenizer (the live
188
- `deepseek-flash`) lands rewrites again instead of silently skipping. Token thresholds keep
189
- their names and values (converted at the documented 4.0 chars/token convention, frozen
190
- profile baseline untouched); token figures become telemetry, labelled honestly by the new
191
- `measurementBasis` field on rewrite audit records (`exact-tokenizer` vs `characters`,
192
- with `tokenizerId: 'characters'` / `tokenizerRevision: 'chars-per-token-4.0'` when derived).
193
- Rollback: `git revert 7a1972a` restores the exact-tokenizer gates as a single unit; confirm
194
- no later change re-introduced a model-id split that relies on this commit first.
195
-
196
- ### Added
197
-
198
- - Batch-level benefit pricing (R1): a review pass is priced as ONE merged mutation — the
199
- tail KV-cache refill penalty is paid once per batch instead of per candidate, so real
200
- batches (5×50k with a 64k tail) reach the auto band instead of all dropping.
201
- - Original-event line mapping (R9a): terminal normalization returns folded lines that each
202
- carry their 1-based original-event line number; `retrieve` reads raw events, so printed
203
- ranges resolve to the right lines.
204
- - Document skeleton and universal prose keep (R8/R8b): structured documents keep headings,
205
- section first/last lines, list starts and table headers; every other non-code text keeps
206
- head AND tail with an R9 line-range marker (prose was previously head-only truncated).
207
- - Two-tier search folding (R10, fixes D8): a lossless per-file L1 locator plus a
208
- water-filled L2 content quota.
209
- - Non-adjacent frequency folding (R11): separated exact repeats (up to 8.37% of large
210
- results) fold to first occurrence plus one counted marker.
211
- - Long-string placeholders (R12): base64/hex/UUID blobs become length summaries with a
212
- 16-char recognition prefix.
213
- - Two-stage HTML reduction (R13, fixes D9): `html-slim` then `html-skeleton`, line-aligned
214
- so original line numbers survive.
215
- - R9b anchors: contiguous masks cite original line ranges, scatter masks report
216
- `lines 1-N scanned, K kept`, and every retrieve hint carries a pasteable
217
- `{"ref":…,"start_line":N,"max_lines":80}`.
218
- - Document census: omitted-document summaries list section headings instead of a constant
219
- `0 error, 0 warn, N info` histogram.
220
-
221
- ## 0.3.1 - 2026-09-18
222
-
223
- ### Changed
224
-
225
- - The runtime package is merged into the selector package: one install brings the whole
226
- stack, the repository root is the install surface (`name`, `main`, `types`, `exports` with
227
- `./pruner` and `./invariant`, `dependencies`, `dsh`), and the toolchain, scripts and CI were
228
- swept to the single package. The verified estimator-catalog registration (dual prefix, guarded
229
- two-channel activation, per-request service resolution, visible lifecycle lines) was replayed
230
- onto this line with a host-side guard; the settings schema that `ab2175a` had downgraded to
231
- `z.any()` is restored, so the daily Custom defaults are published again.
232
- - 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.
233
- - 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.
234
- - 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`.
235
- - 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.
236
- - 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.
237
-
238
- ### Fixed
239
-
240
- - 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.
241
- - `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.
242
- - 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).
243
-
244
-
245
- ### Added
246
-
247
- - 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).
248
- - 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).
249
- - No-net-savings guard: replacements whose text is not smaller than the original are rejected even when the exact tokenizer reports a token saving.
250
- - Recovery exemption: recovery-tool output is permanently exempt from every reduction pass via a unified per-session exemption set, preventing compress-restore oscillation.
251
- - 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.
252
- - 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.
253
- - 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.
254
- - New audit records: `summary-locator` and `estimator-outcome`; the rewrite record covers dedup via the `dedupe-pointer` reducer. Audit field allowlists are unchanged.
255
- - Simplified Chinese and English copy for the new profile and estimator card; unit and golden coverage under `packages/runtime/tests/tokenpilot/`.
256
-
257
- - 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.
258
- - Settings-UI toggle for the gate in the selector settings section, with Simplified Chinese and English copy.
259
- - Browser/runtime decode parity for the new section, confirm-on-write contract tests for `saveCodeSkeleton`, and a full-document parity matrix extension.
260
-
261
- ### Changed
262
-
263
- - 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.
264
- - This repository is now maintained as an improved fork of `WilliamShi666/dsh-context-compression-selector`; documentation ships in English, Simplified Chinese, Japanese, and Korean.
265
-
266
- ## 0.1.0 - 2026-09-03
267
-
268
- ### Added
269
-
270
- - Stable release of DeepSeek V4 Flash Vision tokenizer integration for `deepseek-v4-flash-vision-exp`, including exact text counting and bounded image-token estimates.
271
- - User-configurable model-driven Auto Compact threshold in the selector settings section.
272
- - Auto Compact threshold linkage for each standard profile's History / micro-compact watermarks and related compression parameters.
273
-
274
- ### Changed
275
-
276
- - The threshold editor now uses one direct numeric input; the slider and fixed quick-value buttons were removed.
277
- - Runtime session-event access supports both the established Harness `events` accessor and the newer `snapshotEvents()` public API.
278
-
279
- ## 0.1.0-beta.4 - 2026-09-02
280
-
281
- ### Fixed
282
-
283
- - 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.
284
-
285
- ## 0.1.0-beta.3 - 2026-09-01
286
-
287
- ### Scope
288
-
289
- 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`.
290
-
291
- ### Added
292
-
293
- - 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.
294
- - 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.
295
- - `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.
296
- - 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.
297
- - 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.
298
- - `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.
299
- - 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.
300
- - 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`.
301
-
302
- ### Known limitations
303
-
304
- - 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.
305
- - 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.
306
- - Custom remains manual token mode; its History parameters do not follow the Auto Compact watermark.
307
- - 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.
308
-
309
- ### Deferred
310
-
311
- - Audit `modality` field and the tokenizer artifact SHA-256 inside audit records (the audits already carry the routed provider/model and tokenizer identity).
312
- - Publishing the (now complete) runtime skip-reason taxonomy as a user-facing documentation table.
313
- - Custom-profile display of the A/D watermarks and an above-D warning; Custom remains fully manual.
314
- - Vision token breakdown UI and promotion of image estimates to exact measurement.
315
-
316
- ## 0.1.0-beta.2 - 2026-08-28
317
-
318
- ### Fixed
319
-
320
- - Resolve the official DeepSeek V4 Flash tokenizer route so Fresh and Aggregate can evaluate tool results for the supported V4 models.
321
- - 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.
322
- - Disable Harness-native head/middle/tail tool-result pruning whenever a selector profile is active, leaving the selector as the sole tool-result compactor.
323
-
324
- ### Changed
325
-
326
- - Protect the newest 10 agent tool calls and a 64,000-token tool-result tail window before History/microcompact rewrites older results.
327
-
328
- ## 0.1.0-beta.1 - 2026-08-27
329
-
330
- ### Added
331
-
332
- - One-install DeepSeek Harness Product Bundle backed by a separate exact-version runtime package.
333
- - Web profile selector with preset-stable settings and an explicit built-in Minimal exception.
334
- - Fresh, Aggregate, routine/capacity-aware History, Native tool-result pruning, and default-off Custom TailTrim.
335
- - Standard-event TailTrim protocol using `compaction/prune` plus recoverable `user/message` replacement.
336
- - Plugin-owned `context_compression_retrieve` recovery tool.
337
- - Structured, content-free policy, evaluation, rewrite, failure, and Native auto-compact audit records.
338
- - Pinned official DeepSeek V4 tokenizer assets with runtime SHA-256 validation and upstream license.
339
- - Public-API component E2E, preset/Minimal, and parent/fork/spawn cache-prefix regression tests.
340
-
341
- ### Compatibility
342
-
343
- - Verified against DeepSeek Harness `dsh-v0.1.1-rc.2` public packages.
344
- - Exact tokenizer mapping is currently limited to `deepseek-v4-flash` and `deepseek-v4-pro`.
345
-
346
- ### Known limitations
347
-
348
- - Adaptive ordinary History fails closed when public request-level route/cache evidence is incomplete; capacity pressure remains a separate safety override.
349
- - Cache-prefix tests prove native fork inheritance and identical serialized prefixes, not a provider-specific cache allocation or a guaranteed DeepSeek cache hit.
350
- - 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.7.0-beta.2 - 2026-10-01
6
+
7
+ ### Added
8
+
9
+ - Merged the turn-tail intent summary feature onto this line (previously released
10
+ as 0.7.0-beta.1 from the feat/intent-summary line): nine-language dictionaries
11
+ and the intent-summary fold pipeline now ship together. See 0.7.0-beta.1 below.
12
+
13
+ ### Fixed
14
+
15
+ - CHANGELOG.zh/ja/ko carried unresolved conflict markers committed during the
16
+ 0.6.5-closure merge; the sections are reconstructed clean.
17
+
18
+ ## Unreleased
19
+
20
+ ### Added
21
+
22
+ - 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). Dictionaries are type-checked against `ContextCompressionLocaleKey`; labels are self-described and fall back to English per key. Client-only, host-agnostic.
23
+
24
+ ## 0.7.0-beta.1 - 2026-09-27
25
+
26
+ ### Added
27
+
28
+ - Turn-tail intent summary (`intentSummary.enabled`, default off): when the
29
+ growth gate passes (live surface > 45% of the context window AND more than
30
+ 50K tokens grown since the last fold), the turn-boundary postflight masks
31
+ the consumed increment to semantic-role records — read-class tool results
32
+ become one-line target/scale records via the shared `classifyToolSource()`
33
+ classifier plus a write-class layer, write-class results keep skeleton
34
+ heads plus verbatim error lines — and spends ONE summary-writer LLM call
35
+ (todolist-anchored, JSON-only, fail-open). The staged fold lands on the
36
+ next pressure round through the ordinary plan/apply machinery as per-
37
+ candidate `intent-summary` blocks: the first carries the LLM summary
38
+ segment, consulted-record lines, and verbatim error lines; the rest carry
39
+ their mask line and a seq-range provenance footer. Fold-once: folded seqs
40
+ (and anything carrying the `INTENT_FOLD_MARKER`) are never re-candidated.
41
+ Rewrite audits carry `intent-summary-outcome` records with retention ratio
42
+ and summary-call credit accounting.
43
+ - `/ctx-summary off|on|status`: session-scoped temporary override for the
44
+ gate (settings are session-frozen, so "temporary" can only live in runtime
45
+ state); dies with the process, never crosses sessions, and reports the
46
+ override, observed settings flag, gate constants, and the last landed fold.
47
+ ## 0.6.5 - 2026-09-29
48
+
49
+ ### Fixed
50
+
51
+ - Dev-dependency alignment to the Harness 0.1.7 line: 46 of the 48 `@deepseek-ai/dsh-*`
52
+ dev-dependencies moved from the precise `0.1.5-rc.2` pin to the precise `0.1.7-rc.2` pin,
53
+ and `pnpm-lock.yaml` was regenerated from a clean tree. Typecheck, build, test, lint, and
54
+ `verify:release` now run against the real 0.1.7-rc.2 baseline instead of validating the
55
+ 0.1.7 adaptations against 0.1.5 inputs (a false green). Two packages have no 0.1.7-line
56
+ release at all and keep their install-time pinned values: `@deepseek-ai/dsh-agent-presets`
57
+ (`0.1.6-alpha.2`) and `@deepseek-ai/dsh-code-runtime` (`0.1.5-rc.3`). `react-dom` gained an
58
+ explicit `^18.2.0` dev-dependency so a fresh resolution cannot pair React-DOM 19 with
59
+ React 18 under the test suites.
60
+ - The test-host settings seam was rebuilt against the real 0.1.7 host: `SettingsProvider`
61
+ no longer exists in `@deepseek-ai/dsh-settings` (replaced by the declarative
62
+ `SettingsForms`), while the plugin keeps the legacy `ctx.settings.get(ns)` read as a
63
+ host-shape fallback. The specs now mount a vendored copy of the 0.1.5-rc.2 provider
64
+ (`tests/helpers/legacy-settings/`) to exercise exactly that fallback, and the
65
+ legacy-namespace registrar narrows the service at the seam. The live DeepSeek harness test
66
+ registers the provider through the 0.1.7 adapter seam instead of the removed
67
+ self-contained `llm-deepseek` plugin.
68
+ - Test adaptations surfaced by the real baseline: the compaction-engine fixtures pass
69
+ `headroomTokens: 0` (0.1.7-rc.2 defaults a 65536-token compaction headroom, which swallows
70
+ the fixtures' 1k-token probe windows), and the tool-result asset assertion follows the
71
+ first-class `role: 'tool'` message shape (no wrapping `tool-result` content block).
72
+ - Release gates re-pinned to the official 0.1.7 release: `verify-release.mjs` and the packed
73
+ E2E now assert selector peers `>=0.1.7-rc.1 <0.2.0-0`, and the packed E2E's official-harness
74
+ clone asserts tag `dsh-v0.1.7-rc.2` (commit `477b4f42`, tree `e3e63253`).
75
+ - `packages/selector/dsh.plugin.json` now carries the release version (0.6.5; every earlier
76
+ 0.6.x shipped it frozen at 0.1.0) and declares the honest engine range
77
+ `>=0.1.7-rc.1 <0.2.0-0`.
78
+ - Lint debt from the 0.6.3 manual adaptations cleared: unused imports/locals removed in
79
+ `src/index.ts`, `src/client/index.ts`, `src/pruner.ts`, and three host specs; the
80
+ standing-generation staging-leftover scan now scopes to the spec's own store so a
81
+ concurrently publishing spec cannot fail it.
82
+
83
+ ## 0.6.4 - 2026-09-26
84
+
85
+ ### Fixed
86
+
87
+ - The client locale binder is eager: switching the host locale now re-renders the
88
+ compression settings UI without a remount.
89
+ - Released from a stash and never committed to any branch (the working tree that published it
90
+ was lost); compat/0.1.7 restored the exact content in 0.6.5 and byte-verified it against
91
+ the registry tarball before continuing.
92
+
93
+ ## 0.5.4 - 2026-09-20
94
+
95
+ ### Fixed
96
+
97
+ - The install surface declares `@deepseek-ai/schemastery` as a runtime dependency. The packaged
98
+ runtime imports it unconditionally (`import z from '@deepseek-ai/schemastery'` in
99
+ `packages/selector/lib/index.js`, `lib/pruner.js` and `lib/advisor-state.js`), but 0.5.3
100
+ declared it nowhere a consumer install reads: the shipped root manifest listed only
101
+ `@huggingface/tokenizers` and `js-yaml`, and `packages/selector/package.json` listed it as a
102
+ peer, which no package manager consults for a nested package it installs. Resolution therefore
103
+ depended on an unrelated installed package hoisting `@deepseek-ai/schemastery` into the
104
+ profile. In a clean install the import fell through to the Harness installation's
105
+ shared-module fallback at `$DSH_HOME/profiles/node_modules`; where that fallback held no built
106
+ package, every plugin entry failed to load and the host booted without the Bundle layer. Both
107
+ manifests now pin `3.18.2`, the version this release is built and tested against, and the
108
+ selector package no longer claims a peer obligation it does not have.
109
+
110
+ ### Added
111
+
112
+ - `verify:release` derives the install-surface dependencies from the bare specifiers the
113
+ packaged runtime files import, instead of naming `@huggingface/tokenizers` and `js-yaml` by
114
+ hand. Which packages ship with the plugin and which the Harness installation provides is a
115
+ reviewed list, and an import whose provider is in neither manifest fails the gate with the
116
+ missing name. The gate was added as a negative control against the unfixed manifests, where it
117
+ failed on `@deepseek-ai/schemastery`.
118
+
119
+ ## 0.5.3 - 2026-09-20
120
+
121
+ ### Fixed
122
+
123
+ - The Bundle patch no longer sets the retired review route flag. `reviewQueueRoute` was
124
+ removed from the plugin's Config schema when the review gate was retired, but it stayed in
125
+ `packages/selector/cordis.patch.yml`, where it advertised a route that can never register.
126
+ Hosts tolerate the unknown key today (the plugin loads and serves — verified on a live host),
127
+ so this is a stale-config defect rather than a break, but it would break on any host that
128
+ validates plugin config strictly.
129
+ - Generated artifacts are pinned to LF (`packages/selector/lib/** text eol=lf`). With
130
+ `core.autocrlf=true` every checkout rewrote the committed `lib/**` to CRLF, so any branch
131
+ switch or merge left the whole artifact directory reported as modified with EOL-only
132
+ differences. Nothing was ever committed from that state, but it made every tree look dirty
133
+ and it would hide a real artifact change.
134
+
135
+ ### Added
136
+
137
+ - A negative-control contract pin on the Bundle patch: it fails when a retired config key is
138
+ set in the patch (asserted on key-setting lines, so the explanatory comment may still name
139
+ the key), and it requires the live `estimatorCatalogRoute` flag to stay wired.
140
+
141
+ ### Tests
142
+
143
+ - The client seat contract also pins the older-host degradation: a host that does not declare
144
+ the seat rejects the registration at the slot boundary, and `apply()` must swallow it and
145
+ warn instead of taking every settings entry down with it.
146
+
147
+ ## 0.5.2 - 2026-09-20
148
+
149
+ ### Changed
150
+
151
+ - The human-gated review pipeline (beta) is **retired**. Its semantics are replaced by
152
+ advice: the benefit model still prices every pass as ONE merged mutation, but the band it
153
+ computes (`profitable` / `high-impact` / `slow-payback` / `unpriceable` / `not-worth-it`)
154
+ is now published as a `reduction-advice` audit record and snapshotted onto the advisor
155
+ report route — it never withholds, delays, or rewrites a reduction. The gate contradicted
156
+ the feature's own requirement (a reduction must never block automatic processing) and, with
157
+ the shipped defaults (`reviewMode` on plus a 4,000-token high-impact threshold against an
158
+ 8,192-token fresh trigger), diverted 100% of a fresh batch into human review, leaving the
159
+ automatic path effectively off for anyone who opted in. The advice thresholds are now
160
+ module constants (α `0.1`, high-impact `4,000` tokens): nothing acts on them, so they are
161
+ no longer settings.
162
+ - Removed with the gate: the review queue and its `storageDomain` adapter, the process-wide
163
+ registry, the `review-queue` / `review-decide` HTTP routes and the `reviewQueueRoute`
164
+ deployment flag, the `shell.overlay` client panel, the `reviewMode` /
165
+ `reviewTimeoutTurns` / `cacheHitDiscountAlpha` / `reviewHighImpactTokens` settings keys,
166
+ and the `review-outcome` audit kind. The four settings keys stay ACCEPTED and IGNORED by
167
+ both decoders — an existing document (the live one carries `reviewMode: false`) still loads
168
+ and still renders its settings card — and never reach the resolved policy. The read-only
169
+ `GET .../advisor-report` route additionally serves `lastAdvice`.
170
+
171
+ ### Added
172
+
173
+ - Regression pins for the retirement: a host-integration spec drives the exact settings that
174
+ used to divert everything (`reviewMode: true`, `reviewHighImpactTokens: 1`) and asserts the
175
+ fresh batch LANDS, described by a `high-impact` advice record; a deprecation-contract spec
176
+ pins accept-and-ignore for the retired keys on both the runtime parser and the browser
177
+ decoder.
178
+
179
+ ### Rollback
180
+
181
+ - Reinstall the last release that still ships the gate: `npm dist-tag add
182
+ dsh-context-compression-improved@0.5.1 dsh-0.1.5 --registry https://registry.npmjs.org/`
183
+ then `dsh plugin --profile web add dsh-context-compression-improved@0.5.1`.
184
+
185
+ ## 0.5.1 - 2026-09-20
186
+
187
+ ### Fixed
188
+
189
+ - Concurrent preset-overlay composition of one identity no longer fails on Windows.
190
+ Publication is now serialized per destination path, and when the atomic rename still
191
+ loses the race the destination is confirmed to already carry this staging file's
192
+ `{mtimeMs, size}` standing key before the publish reports success. Windows `MoveFileEx`
193
+ reports that lost race as `EPERM`/`EBUSY` where POSIX `rename` simply replaces the
194
+ destination, which made `standingKeyFor()` throw during concurrent session start. A
195
+ destination that does not match still fails loudly, so a silently reused generation
196
+ stays forbidden.
197
+ - Release-gate and test repairs that had been hiding this and other pre-existing red
198
+ gates: stale identifiers and a retired audit reason in the packed smokes, a stale
199
+ client-inject expectation, and Windows-only spawn traps (`git` and multi-line
200
+ `node -e` scripts were routed through `cmd.exe`, which rewrote their arguments).
201
+
202
+ ## 0.5.0 - 2026-09-20
203
+
204
+ ### Added
205
+
206
+ - Advisory relevance advisor (statistics and suggestions only, default off): at every turn
207
+ boundary a fire-and-forget pass summarizes the session's tail-task semantics from the
208
+ most recent `todo/write` event (falling back to recent user text), incrementally scores
209
+ historical tool-result candidates for content-and-comment relevance against the current
210
+ task, and computes a prefix-decay figure (character-pressure-weighted mean relevance).
211
+ Low-relevance old segments are marked `recertified` as suggestions for later
212
+ history-aggressiveness decisions — nothing this round consumes them, and advisor output
213
+ can never suppress, delay, or rewrite any reduction that would land (pinned by a
214
+ dedicated invariant test). Configure through the `presetOptions.advisor*` settings keys
215
+ (`advisorMode` `''|'host'|'direct'`, default `''`; the direct channel reuses the
216
+ estimator endpoint; `SideChannel` gained an optional overrides parameter so the
217
+ estimator's transport is shared without sharing its configuration). Observability: new
218
+ `advisor-outcome` audit records (content-free, one per phase: summary / scoring / decay)
219
+ and a read-only `GET .../advisor-report?sessionId=` HTTP route (opt-in deployment flag
220
+ `advisorReportRoute`, mirroring the review routes). Client UI is intentionally absent
221
+ this round.
222
+
223
+ ## 0.4.0 - 2026-09-20
224
+
225
+ ### Fixed
226
+
227
+ - The plugin no longer depends on the routed model id: every planning gate now decides on
228
+ the character basis (Unicode code points via `characterPressure` / `pressureCost`) instead
229
+ of exact tokenizer counts, so a route without a bundled tokenizer (the live
230
+ `deepseek-flash`) lands rewrites again instead of silently skipping. Token thresholds keep
231
+ their names and values (converted at the documented 4.0 chars/token convention, frozen
232
+ profile baseline untouched); token figures become telemetry, labelled honestly by the new
233
+ `measurementBasis` field on rewrite audit records (`exact-tokenizer` vs `characters`,
234
+ with `tokenizerId: 'characters'` / `tokenizerRevision: 'chars-per-token-4.0'` when derived).
235
+ Rollback: `git revert 7a1972a` restores the exact-tokenizer gates as a single unit; confirm
236
+ no later change re-introduced a model-id split that relies on this commit first.
237
+
238
+ ### Added
239
+
240
+ - Batch-level benefit pricing (R1): a review pass is priced as ONE merged mutation — the
241
+ tail KV-cache refill penalty is paid once per batch instead of per candidate, so real
242
+ batches (5×50k with a 64k tail) reach the auto band instead of all dropping.
243
+ - Original-event line mapping (R9a): terminal normalization returns folded lines that each
244
+ carry their 1-based original-event line number; `retrieve` reads raw events, so printed
245
+ ranges resolve to the right lines.
246
+ - Document skeleton and universal prose keep (R8/R8b): structured documents keep headings,
247
+ section first/last lines, list starts and table headers; every other non-code text keeps
248
+ head AND tail with an R9 line-range marker (prose was previously head-only truncated).
249
+ - Two-tier search folding (R10, fixes D8): a lossless per-file L1 locator plus a
250
+ water-filled L2 content quota.
251
+ - Non-adjacent frequency folding (R11): separated exact repeats (up to 8.37% of large
252
+ results) fold to first occurrence plus one counted marker.
253
+ - Long-string placeholders (R12): base64/hex/UUID blobs become length summaries with a
254
+ 16-char recognition prefix.
255
+ - Two-stage HTML reduction (R13, fixes D9): `html-slim` then `html-skeleton`, line-aligned
256
+ so original line numbers survive.
257
+ - R9b anchors: contiguous masks cite original line ranges, scatter masks report
258
+ `lines 1-N scanned, K kept`, and every retrieve hint carries a pasteable
259
+ `{"ref":…,"start_line":N,"max_lines":80}`.
260
+ - Document census: omitted-document summaries list section headings instead of a constant
261
+ `0 error, 0 warn, N info` histogram.
262
+
263
+ ## 0.3.1 - 2026-09-18
264
+
265
+ ### Changed
266
+
267
+ - The runtime package is merged into the selector package: one install brings the whole
268
+ stack, the repository root is the install surface (`name`, `main`, `types`, `exports` with
269
+ `./pruner` and `./invariant`, `dependencies`, `dsh`), and the toolchain, scripts and CI were
270
+ swept to the single package. The verified estimator-catalog registration (dual prefix, guarded
271
+ two-channel activation, per-request service resolution, visible lifecycle lines) was replayed
272
+ onto this line with a host-side guard; the settings schema that `ab2175a` had downgraded to
273
+ `z.any()` is restored, so the daily Custom defaults are published again.
274
+ - 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.
275
+ - 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.
276
+ - 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`.
277
+ - 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.
278
+ - 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.
279
+
280
+ ### Fixed
281
+
282
+ - 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.
283
+ - `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.
284
+ - 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).
285
+
286
+
287
+ ### Added
288
+
289
+ - 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).
290
+ - 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).
291
+ - No-net-savings guard: replacements whose text is not smaller than the original are rejected even when the exact tokenizer reports a token saving.
292
+ - Recovery exemption: recovery-tool output is permanently exempt from every reduction pass via a unified per-session exemption set, preventing compress-restore oscillation.
293
+ - 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.
294
+ - 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.
295
+ - 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.
296
+ - New audit records: `summary-locator` and `estimator-outcome`; the rewrite record covers dedup via the `dedupe-pointer` reducer. Audit field allowlists are unchanged.
297
+ - Simplified Chinese and English copy for the new profile and estimator card; unit and golden coverage under `packages/runtime/tests/tokenpilot/`.
298
+
299
+ - 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.
300
+ - Settings-UI toggle for the gate in the selector settings section, with Simplified Chinese and English copy.
301
+ - Browser/runtime decode parity for the new section, confirm-on-write contract tests for `saveCodeSkeleton`, and a full-document parity matrix extension.
302
+
303
+ ### Changed
304
+
305
+ - 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.
306
+ - This repository is now maintained as an improved fork of `WilliamShi666/dsh-context-compression-selector`; documentation ships in English, Simplified Chinese, Japanese, and Korean.
307
+
308
+ ## 0.1.0 - 2026-09-03
309
+
310
+ ### Added
311
+
312
+ - Stable release of DeepSeek V4 Flash Vision tokenizer integration for `deepseek-v4-flash-vision-exp`, including exact text counting and bounded image-token estimates.
313
+ - User-configurable model-driven Auto Compact threshold in the selector settings section.
314
+ - Auto Compact threshold linkage for each standard profile's History / micro-compact watermarks and related compression parameters.
315
+
316
+ ### Changed
317
+
318
+ - The threshold editor now uses one direct numeric input; the slider and fixed quick-value buttons were removed.
319
+ - Runtime session-event access supports both the established Harness `events` accessor and the newer `snapshotEvents()` public API.
320
+
321
+ ## 0.1.0-beta.4 - 2026-09-02
322
+
323
+ ### Fixed
324
+
325
+ - 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.
326
+
327
+ ## 0.1.0-beta.3 - 2026-09-01
328
+
329
+ ### Scope
330
+
331
+ 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`.
332
+
333
+ ### Added
334
+
335
+ - 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.
336
+ - 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.
337
+ - `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.
338
+ - 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.
339
+ - 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.
340
+ - `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.
341
+ - 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.
342
+ - 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`.
343
+
344
+ ### Known limitations
345
+
346
+ - 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.
347
+ - 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.
348
+ - Custom remains manual token mode; its History parameters do not follow the Auto Compact watermark.
349
+ - 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.
350
+
351
+ ### Deferred
352
+
353
+ - Audit `modality` field and the tokenizer artifact SHA-256 inside audit records (the audits already carry the routed provider/model and tokenizer identity).
354
+ - Publishing the (now complete) runtime skip-reason taxonomy as a user-facing documentation table.
355
+ - Custom-profile display of the A/D watermarks and an above-D warning; Custom remains fully manual.
356
+ - Vision token breakdown UI and promotion of image estimates to exact measurement.
357
+
358
+ ## 0.1.0-beta.2 - 2026-08-28
359
+
360
+ ### Fixed
361
+
362
+ - Resolve the official DeepSeek V4 Flash tokenizer route so Fresh and Aggregate can evaluate tool results for the supported V4 models.
363
+ - 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.
364
+ - Disable Harness-native head/middle/tail tool-result pruning whenever a selector profile is active, leaving the selector as the sole tool-result compactor.
365
+
366
+ ### Changed
367
+
368
+ - Protect the newest 10 agent tool calls and a 64,000-token tool-result tail window before History/microcompact rewrites older results.
369
+
370
+ ## 0.1.0-beta.1 - 2026-08-27
371
+
372
+ ### Added
373
+
374
+ - One-install DeepSeek Harness Product Bundle backed by a separate exact-version runtime package.
375
+ - Web profile selector with preset-stable settings and an explicit built-in Minimal exception.
376
+ - Fresh, Aggregate, routine/capacity-aware History, Native tool-result pruning, and default-off Custom TailTrim.
377
+ - Standard-event TailTrim protocol using `compaction/prune` plus recoverable `user/message` replacement.
378
+ - Plugin-owned `context_compression_retrieve` recovery tool.
379
+ - Structured, content-free policy, evaluation, rewrite, failure, and Native auto-compact audit records.
380
+ - Pinned official DeepSeek V4 tokenizer assets with runtime SHA-256 validation and upstream license.
381
+ - Public-API component E2E, preset/Minimal, and parent/fork/spawn cache-prefix regression tests.
382
+
383
+ ### Compatibility
384
+
385
+ - Verified against DeepSeek Harness `dsh-v0.1.1-rc.2` public packages.
386
+ - Exact tokenizer mapping is currently limited to `deepseek-v4-flash` and `deepseek-v4-pro`.
387
+
388
+ ### Known limitations
389
+
390
+ - Adaptive ordinary History fails closed when public request-level route/cache evidence is incomplete; capacity pressure remains a separate safety override.
391
+ - Cache-prefix tests prove native fork inheritance and identical serialized prefixes, not a provider-specific cache allocation or a guaranteed DeepSeek cache hit.
392
+ - Settings snapshots and first-exposure decisions are process-local to the mounted runtime.