dsh-context-compression-improved 0.7.0-beta.1 → 0.8.0-beta.1

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