Architecture / 事件流说明
August 19, 2026 · View on GitHub
Goal
In DeepSeek Harness 0.1.0-rc.7, manual /compact summarization target
resolution is configured ?? current ?? latest ?? agentTarget. An explicit
summarizationProvider / summarizationModel therefore overrides the
frontend's currently selected model. This bundle adds a hard override for the
manual conceptual compaction span only.
Why a host-plane interceptor?
Replacing or forking @deepseek-ai/dsh-compaction-basic would duplicate the
compact engine and break when upstream changes it. DSH profiles are Cordis
compositions, so the same effect can be achieved by observing two existing
events:
session/event(compaction/start/compaction/end) marks the exact span whose summarization request should be intercepted.llm/stream(waterfall order) lets middleware mutate the same options object that the LLM adapter will resolve, which is why changingoptions.provider/options.modelbefore yieldingnext()works.
Manual vs automatic compaction
The durable signature of an explicit /compact request is a
compaction/start session event whose data.turn === null. Automatic
compaction has a numeric turn. This bundle only tracks the former and never
touches regular chat turns, frozen LLM requests, or automatic compaction.
Event flow
session.appenddispatchessession/eventsynchronously before the summarization call, so activating the session never races the LLM request.- The
llm/streamhandler checkspurpose === 'compaction', the session id, the active marker, andObject.isFrozen(options)before mutating anything. agentDefaultModel.currentSelection()supplies the frontend-selected provider/model; if it is unavailable the stream passes through untouched.- The wrapper generator restores the caller's
provider/modelfields in afinallyonce delegation returns.
Compatibility boundaries
- The
compaction/startowner marker (turn: null) and thellm/streamcompaction request shape are rc.7 behavior; review before upgrading DSH. - The bundle is runtime-import-free by design.
Uninstall
dsh plugin --profile web remove @dsh-external/dsh-compaction-current-model
removes the inserted row and restores the default composition.