dsh-context-compression-improved 0.2.2 → 0.2.4

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 (52) hide show
  1. package/.github/workflows/ci.yml +39 -39
  2. package/CHANGELOG.md +137 -135
  3. package/README.md +112 -103
  4. package/package.json +142 -138
  5. package/packages/selector/README.md +31 -26
  6. package/packages/selector/README.zh.md +31 -26
  7. package/packages/selector/dsh.plugin.json +16 -16
  8. package/packages/selector/lib/client.d.ts +228 -228
  9. package/packages/selector/lib/client.js +1462 -1462
  10. package/packages/selector/lib/config.js +856 -842
  11. package/packages/selector/lib/index.d.ts +37 -37
  12. package/packages/selector/lib/index.js +693 -645
  13. package/packages/selector/lib/invariant.js +70 -70
  14. package/packages/selector/lib/pruner.d.ts +728 -683
  15. package/packages/selector/lib/pruner.js +4765 -3807
  16. package/packages/selector/lib/style.css +46 -46
  17. package/packages/selector/lib/tail-trim.js +136 -136
  18. package/packages/selector/package.json +15 -7
  19. package/packages/selector/src/client/index.ts +111 -111
  20. package/packages/selector/src/preset-overlay.ts +60 -1
  21. package/packages/selector/src/pruner/content.ts +18 -5
  22. package/packages/selector/src/pruner/types.ts +23 -5
  23. package/packages/selector/src/pruner.ts +164 -154
  24. package/packages/selector/src/runtime/adaptive-cost.ts +23 -12
  25. package/packages/selector/src/runtime/audit.ts +18 -2
  26. package/packages/selector/src/runtime/config.ts +30 -1
  27. package/packages/selector/src/runtime/measurement.ts +31 -2
  28. package/packages/selector/src/runtime/reducers.ts +1115 -97
  29. package/packages/selector/src/runtime/tokenpilot/dedup.ts +1 -1
  30. package/packages/selector/src/runtime/tokenpilot/locator.ts +1 -1
  31. package/packages/selector/src/runtime/tokenpilot/read-state.ts +23 -2
  32. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +275 -0
  33. package/packages/selector/src/runtime/toolclass.ts +103 -0
  34. package/packages/selector/src/runtime/types.ts +16 -0
  35. package/packages/selector/tests/preset-overlay.host.spec.ts +256 -243
  36. package/packages/selector/tests/runtime/adaptive-cost.spec.ts +7 -7
  37. package/packages/selector/tests/runtime/audit.spec.ts +44 -1
  38. package/packages/selector/tests/runtime/char-basis.spec.ts +30 -0
  39. package/packages/selector/tests/runtime/code-skeleton.spec.ts +14 -3
  40. package/packages/selector/tests/runtime/frequency-longstrings.spec.ts +74 -0
  41. package/packages/selector/tests/runtime/html-reducer.spec.ts +212 -0
  42. package/packages/selector/tests/runtime/line-mapping.spec.ts +153 -0
  43. package/packages/selector/tests/runtime/prose-reducers.spec.ts +133 -0
  44. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +198 -27
  45. package/packages/selector/tests/runtime/read-input-cap.spec.ts +33 -0
  46. package/packages/selector/tests/runtime/search-reducer.spec.ts +110 -0
  47. package/packages/selector/tests/runtime/sidechannel.spec.ts +241 -0
  48. package/packages/selector/tests/runtime/toc-and-bundled.spec.ts +159 -0
  49. package/packages/selector/tests/runtime/tokenpilot/read-state.spec.ts +24 -0
  50. package/packages/selector/tests/runtime/toolclass.spec.ts +156 -0
  51. package/packages/selector/tests/standing-generation.host.spec.ts +642 -631
  52. package/scripts/toolclass-corpus-replay.mjs +273 -0
@@ -1,39 +1,39 @@
1
- name: ci
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- pull_request:
7
-
8
- permissions:
9
- contents: read
10
-
11
- jobs:
12
- verify:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
16
- - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
17
- with:
18
- version: 11.7.0
19
- - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
20
- with:
21
- node-version: 22.19.0
22
- cache: pnpm
23
- - run: pnpm install --frozen-lockfile
24
- - run: pnpm lint
25
- - run: pnpm typecheck
26
- - run: pnpm build
27
- # scripts/ is compiled to the gitignored scripts-dist/, and nothing above this
28
- # point builds it. Without this step verify:release and test:e2e:packed both
29
- # die with MODULE_NOT_FOUND on a clean checkout — which is what kept this
30
- # workflow red on every push to main while the same gates passed locally,
31
- # where scripts-dist/ had been built by hand once.
32
- - run: pnpm build:scripts
33
- - run: pnpm test
34
- - run: pnpm --filter dsh-context-compression-improved test
35
- - run: pnpm test:built
36
- - run: pnpm verify:release
37
- - run: pnpm pack:dry-run
38
- - run: pnpm test:e2e:packed
39
- - run: pnpm audit --audit-level high
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main, feat/backport-015-functional]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ verify:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
16
+ - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
17
+ with:
18
+ version: 11.7.0
19
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
20
+ with:
21
+ node-version: 22.19.0
22
+ cache: pnpm
23
+ - run: pnpm install --frozen-lockfile
24
+ - run: pnpm lint
25
+ - run: pnpm typecheck
26
+ - run: pnpm build
27
+ # scripts/ is compiled to the gitignored scripts-dist/, and nothing above this
28
+ # point builds it. Without this step verify:release and test:e2e:packed both
29
+ # die with MODULE_NOT_FOUND on a clean checkout — which is what kept this
30
+ # workflow red on every push to main while the same gates passed locally,
31
+ # where scripts-dist/ had been built by hand once.
32
+ - run: pnpm build:scripts
33
+ - run: pnpm test
34
+ - run: pnpm --filter dsh-context-compression-improved test
35
+ - run: pnpm test:built
36
+ - run: pnpm verify:release
37
+ - run: pnpm pack:dry-run
38
+ - run: pnpm test:e2e:packed
39
+ - run: pnpm audit --audit-level high
package/CHANGELOG.md CHANGED
@@ -1,135 +1,137 @@
1
- # Changelog
2
-
3
- All notable changes use this file. The project follows semantic versioning after `0.1.0`.
4
-
5
- ## 0.1.1
6
-
7
- ### Added
8
-
9
- - TypeScript toolchain for `scripts/`: `verify-release`, `packed-components-smoke`, and `packed-install-e2e` are now `.ts` sources compiled to `scripts-dist/` via `tsc`, eliminating the last three non-TS source files in the repository.
10
-
11
- ### Changed
12
-
13
- - `package.json` scripts `test:e2e:packed` and `verify:release` now run compiled outputs from `scripts-dist/`.
14
- - Estimator catalog route registration hardened: `asWebServer` returns the service itself (D7 fix), and the estimator UI preserves its section heading when inactive instead of hiding behind an invisible gate (U1 fix).
15
- - Framework documentation corrected: row-level `inject: [webServer]` is not load-bearing (Y22); `isolate()` does not exist in any DSH package.
16
-
17
- ### Fixed
18
-
19
- - The estimator catalog route was never registered since day one because `asWebServer` detached `register` from its service (D7).
20
- - The estimator section silently disappeared when a non-TokenPilot profile was active, with no hint about why or how to enable it (U1).
21
-
22
- ## Unreleased
23
-
24
- ### Added
25
-
26
- - 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).
27
- - 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).
28
- - No-net-savings guard: replacements whose text is not smaller than the original are rejected even when the exact tokenizer reports a token saving.
29
- - Recovery exemption: recovery-tool output is permanently exempt from every reduction pass via a unified per-session exemption set, preventing compress-restore oscillation.
30
- - 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.
31
- - 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.
32
- - 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.
33
- - New audit records: `summary-locator` and `estimator-outcome`; the rewrite record covers dedup via the `dedupe-pointer` reducer. Audit field allowlists are unchanged.
34
- - Simplified Chinese and English copy for the new profile and estimator card; unit and golden coverage under `packages/runtime/tests/tokenpilot/`.
35
-
36
- - 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.
37
- - Settings-UI toggle for the gate in the selector settings section, with Simplified Chinese and English copy.
38
- - Browser/runtime decode parity for the new section, confirm-on-write contract tests for `saveCodeSkeleton`, and a full-document parity matrix extension.
39
-
40
- ### Changed
41
-
42
- - 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.
43
- - This repository is now maintained as an improved fork of `WilliamShi666/dsh-context-compression-selector`; documentation ships in English, Simplified Chinese, Japanese, and Korean.
44
-
45
- ### Fixed
46
-
47
- - 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.
48
- - `presetOptions` writes preserve their siblings. `settingsScope.set('presetOptions', patch)` replaces the whole section, so touching any second estimator field (a provider, a model, an endpoint) deleted `estimatorMode` and every other override — silently switching the estimator back off while the panel still reported a successful save. The patch is now merged over the stored section, `undefined` clears exactly the field it names, an unchanged patch writes nothing, and the confirmation read compares the same fields instead of the channel alone.
49
- - New coverage: `packages/selector/tests/preset-options-write.client.spec.ts` (merged 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).
50
-
51
- ## 0.1.0 - 2026-09-03
52
-
53
- ### Added
54
-
55
- - Stable release of DeepSeek V4 Flash Vision tokenizer integration for `deepseek-v4-flash-vision-exp`, including exact text counting and bounded image-token estimates.
56
- - User-configurable model-driven Auto Compact threshold in the selector settings section.
57
- - Auto Compact threshold linkage for each standard profile's History / micro-compact watermarks and related compression parameters.
58
-
59
- ### Changed
60
-
61
- - The threshold editor now uses one direct numeric input; the slider and fixed quick-value buttons were removed.
62
- - Runtime session-event access supports both the established Harness `events` accessor and the newer `snapshotEvents()` public API.
63
-
64
- ## 0.1.0-beta.4 - 2026-09-02
65
-
66
- ### Fixed
67
-
68
- - 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.
69
-
70
- ## 0.1.0-beta.3 - 2026-09-01
71
-
72
- ### Scope
73
-
74
- 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`.
75
-
76
- ### Added
77
-
78
- - 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.
79
- - 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.
80
- - `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.
81
- - 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.
82
- - 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.
83
- - `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.
84
- - 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.
85
- - 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`.
86
-
87
- ### Known limitations
88
-
89
- - 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.
90
- - 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.
91
- - Custom remains manual token mode; its History parameters do not follow the Auto Compact watermark.
92
- - 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.
93
-
94
- ### Deferred
95
-
96
- - Audit `modality` field and the tokenizer artifact SHA-256 inside audit records (the audits already carry the routed provider/model and tokenizer identity).
97
- - Publishing the (now complete) runtime skip-reason taxonomy as a user-facing documentation table.
98
- - Custom-profile display of the A/D watermarks and an above-D warning; Custom remains fully manual.
99
- - Vision token breakdown UI and promotion of image estimates to exact measurement.
100
-
101
- ## 0.1.0-beta.2 - 2026-08-28
102
-
103
- ### Fixed
104
-
105
- - Resolve the official DeepSeek V4 Flash tokenizer route so Fresh and Aggregate can evaluate tool results for the supported V4 models.
106
- - 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.
107
- - Disable Harness-native head/middle/tail tool-result pruning whenever a selector profile is active, leaving the selector as the sole tool-result compactor.
108
-
109
- ### Changed
110
-
111
- - Protect the newest 10 agent tool calls and a 64,000-token tool-result tail window before History/microcompact rewrites older results.
112
-
113
- ## 0.1.0-beta.1 - 2026-08-27
114
-
115
- ### Added
116
-
117
- - One-install DeepSeek Harness Product Bundle backed by a separate exact-version runtime package.
118
- - Web profile selector with preset-stable settings and an explicit built-in Minimal exception.
119
- - Fresh, Aggregate, routine/capacity-aware History, Native tool-result pruning, and default-off Custom TailTrim.
120
- - Standard-event TailTrim protocol using `compaction/prune` plus recoverable `user/message` replacement.
121
- - Plugin-owned `context_compression_retrieve` recovery tool.
122
- - Structured, content-free policy, evaluation, rewrite, failure, and Native auto-compact audit records.
123
- - Pinned official DeepSeek V4 tokenizer assets with runtime SHA-256 validation and upstream license.
124
- - Public-API component E2E, preset/Minimal, and parent/fork/spawn cache-prefix regression tests.
125
-
126
- ### Compatibility
127
-
128
- - Verified against DeepSeek Harness `dsh-v0.1.1-rc.2` public packages.
129
- - Exact tokenizer mapping is currently limited to `deepseek-v4-flash` and `deepseek-v4-pro`.
130
-
131
- ### Known limitations
132
-
133
- - Adaptive ordinary History fails closed when public request-level route/cache evidence is incomplete; capacity pressure remains a separate safety override.
134
- - Cache-prefix tests prove native fork inheritance and identical serialized prefixes, not a provider-specific cache allocation or a guaranteed DeepSeek cache hit.
135
- - 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.1.1
6
+
7
+ ### Added
8
+
9
+ - TypeScript toolchain for `scripts/`: `verify-release`, `packed-components-smoke`, and `packed-install-e2e` are now `.ts` sources compiled to `scripts-dist/` via `tsc`, eliminating the last three non-TS source files in the repository.
10
+
11
+ ### Changed
12
+
13
+ - `package.json` scripts `test:e2e:packed` and `verify:release` now run compiled outputs from `scripts-dist/`.
14
+ - Estimator catalog route registration hardened: `asWebServer` returns the service itself (D7 fix), and the estimator UI preserves its section heading when inactive instead of hiding behind an invisible gate (U1 fix).
15
+ - Framework documentation corrected: row-level `inject: [webServer]` is not load-bearing (Y22); `isolate()` does not exist in any DSH package.
16
+
17
+ ### Fixed
18
+
19
+ - The estimator catalog route was never registered since day one because `asWebServer` detached `register` from its service (D7).
20
+ - The estimator section silently disappeared when a non-TokenPilot profile was active, with no hint about why or how to enable it (U1).
21
+
22
+ ## 0.2.4 — 2026-10-01
23
+
24
+ > memorax-absorb backport line: R8-R13 runtime reductions, S1 sidechannel relevance, GF-1 read gutter, TokenPilot-inspired profile, byte-identical dedup, recovery exemption, auto-compact summary locator, residual-utility estimator, code-skeleton gate. Merge-back of `feat/backport-015-functional` into the 0.1.2 host line, plus win32 test-portability fixes.
25
+
26
+ ### Added
27
+
28
+ - 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).
29
+ - 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).
30
+ - No-net-savings guard: replacements whose text is not smaller than the original are rejected even when the exact tokenizer reports a token saving.
31
+ - Recovery exemption: recovery-tool output is permanently exempt from every reduction pass via a unified per-session exemption set, preventing compress-restore oscillation.
32
+ - 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.
33
+ - 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.
34
+ - 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.
35
+ - New audit records: `summary-locator` and `estimator-outcome`; the rewrite record covers dedup via the `dedupe-pointer` reducer. Audit field allowlists are unchanged.
36
+ - Simplified Chinese and English copy for the new profile and estimator card; unit and golden coverage under `packages/selector/tests/runtime/tokenpilot/`.
37
+
38
+ - 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.
39
+ - Settings-UI toggle for the gate in the selector settings section, with Simplified Chinese and English copy.
40
+ - Browser/runtime decode parity for the new section, confirm-on-write contract tests for `saveCodeSkeleton`, and a full-document parity matrix extension.
41
+
42
+ ### Changed
43
+
44
+ - 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.
45
+ - This repository is now maintained as an improved fork of `WilliamShi666/dsh-context-compression-selector`; documentation ships in English, Simplified Chinese, Japanese, and Korean.
46
+
47
+ ### Fixed
48
+
49
+ - 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.
50
+ - `presetOptions` writes preserve their siblings. `settingsScope.set('presetOptions', patch)` replaces the whole section, so touching any second estimator field (a provider, a model, an endpoint) deleted `estimatorMode` and every other override — silently switching the estimator back off while the panel still reported a successful save. The patch is now merged over the stored section, `undefined` clears exactly the field it names, an unchanged patch writes nothing, and the confirmation read compares the same fields instead of the channel alone.
51
+ - New coverage: `packages/selector/tests/preset-options-write.client.spec.ts` (merged 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).
52
+
53
+ ## 0.1.0 - 2026-09-03
54
+
55
+ ### Added
56
+
57
+ - Stable release of DeepSeek V4 Flash Vision tokenizer integration for `deepseek-v4-flash-vision-exp`, including exact text counting and bounded image-token estimates.
58
+ - User-configurable model-driven Auto Compact threshold in the selector settings section.
59
+ - Auto Compact threshold linkage for each standard profile's History / micro-compact watermarks and related compression parameters.
60
+
61
+ ### Changed
62
+
63
+ - The threshold editor now uses one direct numeric input; the slider and fixed quick-value buttons were removed.
64
+ - Runtime session-event access supports both the established Harness `events` accessor and the newer `snapshotEvents()` public API.
65
+
66
+ ## 0.1.0-beta.4 - 2026-09-02
67
+
68
+ ### Fixed
69
+
70
+ - 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.
71
+
72
+ ## 0.1.0-beta.3 - 2026-09-01
73
+
74
+ ### Scope
75
+
76
+ 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`.
77
+
78
+ ### Added
79
+
80
+ - 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.
81
+ - 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.
82
+ - `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.
83
+ - 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.
84
+ - 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.
85
+ - `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.
86
+ - 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.
87
+ - 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`.
88
+
89
+ ### Known limitations
90
+
91
+ - 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.
92
+ - 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.
93
+ - Custom remains manual token mode; its History parameters do not follow the Auto Compact watermark.
94
+ - 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.
95
+
96
+ ### Deferred
97
+
98
+ - Audit `modality` field and the tokenizer artifact SHA-256 inside audit records (the audits already carry the routed provider/model and tokenizer identity).
99
+ - Publishing the (now complete) runtime skip-reason taxonomy as a user-facing documentation table.
100
+ - Custom-profile display of the A/D watermarks and an above-D warning; Custom remains fully manual.
101
+ - Vision token breakdown UI and promotion of image estimates to exact measurement.
102
+
103
+ ## 0.1.0-beta.2 - 2026-08-28
104
+
105
+ ### Fixed
106
+
107
+ - Resolve the official DeepSeek V4 Flash tokenizer route so Fresh and Aggregate can evaluate tool results for the supported V4 models.
108
+ - 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.
109
+ - Disable Harness-native head/middle/tail tool-result pruning whenever a selector profile is active, leaving the selector as the sole tool-result compactor.
110
+
111
+ ### Changed
112
+
113
+ - Protect the newest 10 agent tool calls and a 64,000-token tool-result tail window before History/microcompact rewrites older results.
114
+
115
+ ## 0.1.0-beta.1 - 2026-08-27
116
+
117
+ ### Added
118
+
119
+ - One-install DeepSeek Harness Product Bundle backed by a separate exact-version runtime package.
120
+ - Web profile selector with preset-stable settings and an explicit built-in Minimal exception.
121
+ - Fresh, Aggregate, routine/capacity-aware History, Native tool-result pruning, and default-off Custom TailTrim.
122
+ - Standard-event TailTrim protocol using `compaction/prune` plus recoverable `user/message` replacement.
123
+ - Plugin-owned `context_compression_retrieve` recovery tool.
124
+ - Structured, content-free policy, evaluation, rewrite, failure, and Native auto-compact audit records.
125
+ - Pinned official DeepSeek V4 tokenizer assets with runtime SHA-256 validation and upstream license.
126
+ - Public-API component E2E, preset/Minimal, and parent/fork/spawn cache-prefix regression tests.
127
+
128
+ ### Compatibility
129
+
130
+ - Verified against DeepSeek Harness `dsh-v0.1.1-rc.2` public packages.
131
+ - Exact tokenizer mapping is currently limited to `deepseek-v4-flash` and `deepseek-v4-pro`.
132
+
133
+ ### Known limitations
134
+
135
+ - Adaptive ordinary History fails closed when public request-level route/cache evidence is incomplete; capacity pressure remains a separate safety override.
136
+ - Cache-prefix tests prove native fork inheritance and identical serialized prefixes, not a provider-specific cache allocation or a guaranteed DeepSeek cache hit.
137
+ - Settings snapshots and first-exposure decisions are process-local to the mounted runtime.