dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
Long-session resource control for DeepSeek Harness: windowed history rendering in the web UI, DOM slimming, session weight monitoring and compaction guidance.
Long-session resource governor for DeepSeek Harness.
A conversation that keeps growing gets expensive long before anything
compacts it: every step re-sends the retained history, the session log grows
without bound, and the web UI has more history to draw. dsh-optimize
measures that growth and reports it, so a heavy session is a visible fact
rather than a surprise.
agent/pre-step.contextPressure projection on session events — the
authoritative token figure, and O(1) — so the estimate above is never the
only number kept.$DSH_HOME/storages/dsh-optimize/state.json.warnTokens, and again at
criticalTokens, with the measured range.compactAtTokens, through the sanctioned
ctx.agentPresets.serviceFor(agent, 'compaction') handle. The plugin decides
when; the harness engine keeps deciding what to summarise.optimize host service (snapshot(id), list(), flush()).It does not change the system prompt, the tool schemas, or the request prefix, does not write session events, and does not touch the session log.
dsh plugin --profile <profile> add dsh-optimize
Or from a checkout:
dsh plugin --profile <profile> add /path/to/dsh-optimize
The bundle patch ships the defaults; override them in your profile's patch
layer (~/.dsh/profiles/<profile>/cordis.patch.yml):
- id: dsh-optimize
config:
warnTokens: 120000
criticalTokens: 300000
autoCompact: false
compactAtTokens: 200000
compactCooldownMs: 300000
verbose: false
| Key | Default | Meaning |
|---|---|---|
warnTokens | 120000 | Estimated request weight that marks a session as heavy. |
criticalTokens | 300000 | Estimated request weight that marks a session as critical. |
autoCompact | false | Run the harness compaction engine over budget. |
compactAtTokens | 200000 | Measured weight at which automatic compaction may run. |
compactCooldownMs | 300000 | Minimum delay between two automatic compactions. |
verbose | false | Log every measured request, not only threshold crossings. |
The estimate is a range: Latin text is near four characters per token, CJK near
one and a half. The upper bound is the one compared against the thresholds, so
a mixed-language session errs towards reporting early. When the harness's
contextPressure projection is available, its number wins for the compaction
decision.
0.8 by default) or when the provider reports a context
overflow; this option only makes it fire earlier, at your budget.ctx.agentPresets.serviceFor(agent, 'compaction').thresholdRatio/retainRatio means editing the preset
row and re-mounting.busy and retried on a later check.The chat view mounts one DOM row per visible node of the loaded history and lays out every one of them; only the trajectory table virtualises. On a long session that is thousands of live rows.
content-visibility: auto and contain-intrinsic-size: auto 320px on
[data-chat-anchor-key], so the browser skips layout and paint for rows
outside the scrollport. React still reconciles them exactly as before, and
the remembered row height keeps scroll anchors stable.The switch is persisted in localStorage under dsh-optimize:lite. Nothing
about the session is hidden or unloaded: every row stays mounted and reachable.
contextPressure projection.MIT.