Repository navigation
The plugin no longer only enforces an absolute ceiling. It now offers two triggers, and you pick one: a fixed token count, or a share of the routed model's context window.
# take the current version from the Releases page
dsh plugin --profile desktop add https://github.com/AllShadowAnan/dsh-context-compressor/releases/download/v1.1.0/dsh-context-compressor-1.1.0.tgzThe two triggers
| Absolute ceiling | Share of window | |
|---|---|---|
| Setting | a token count | a percentage, 5–95 |
| Threshold | fixed | routed model's declared window × percentage |
| Good for | a cost and latency budget, mixed routing, endpoints whose declared window is a guess | compact earlier to save cost, or later to keep more context |
They are mutually exclusive. Only the selected one is computed, and the Settings page renders only the field that belongs to it. The other value stays in the config, so switching back restores it.
Ratio mode is what DSH's own compaction-basic already does with the percentage hard-coded at 80%. This exposes the number; it does not replace the built-in policy, which still fires on its own terms.
Worth knowing
Ratio mode is inert until the window is known. A session that has logged no request/context has no declared window, and the plugin does nothing rather than guess. The readout shows — for the resolved ceiling in that state.
mode is a closed set. It is declared union([const('absolute'), const('ratio')]) rather than a bare string, so a typo in a config file is rejected at load instead of silently turning the plugin into a no-op. contextRatioPercent is bounded to 5–95.
The readout warns about a tail that is too large. If retainTokens is not smaller than the ceiling, a compaction would have nothing left to summarize. The live readout says so rather than failing quietly.
The page uses SegmentedControl, the primitive DSH already ships, instead of a hand-rolled control.
Do not install from the releases/latest alias. pnpm caches a remote tarball's resolution by URL, and that URL never changes — so it keeps installing whichever version you first got from it, and --force does not make it re-resolve. Use the versioned URL above, which is reproducible anyway. Clicking the alias in a browser is fine: there it is always the newest release.
Upgrading
Nothing to do. mode defaults to absolute and contextRatioPercent to 80, so an existing config behaves exactly as before until you change it.
Verification
47 tests (was 31), including the harness's own volatileForm / projectForm / isVolatilePath run against the new union field. CI green on Linux.
Note for plugin authors
Editing a plugin's own source requires an application restart. The host half is Node code loaded at boot, and the browser bundle's bytes are read and cached at boot; reinstalling or touching the profile manifest does not re-evaluate an already-loaded module, and a page refresh is not enough. The README now documents this.