Expand description
The request view: the provider decorator that rewrites
req.messages under a byte budget, and the mirror zoom reads.
The decorator sits outside everything else on the request path, as paste expansion does: the engine clones the session into the request untouched, the decorator projects it, the session keeps every message (SPEC.md §6). Requests carry the full history, so the decorator’s mirror is exactly the log as of the last request — a resumed session rebuilds it wholesale on the first call.
Past the budget the aged prefix is covered by the stepped
compaction block (crate::compact): sections tiling [0, cut),
appended only at flushes so the request prefix stays cache-stable
between them. This module owns the cut and the sections; the
summarizer seam and the section writers live in
crate::compact.
Structs§
- LogContent
- The log’s own wire bytes by category — each message counted once, the content the billed split re-sends once per request. The system prompt, the skills section, and the tool definitions ride every request but live in no message, so they have no figure here.
- Skill
Text - A skill whose body pins: a tool result carrying one stays whole in the block instead of compacting to a digest. Set on the mirror at wiring time, from the same discovery the prompt renders.
- Transcript
- The mirror: the log as the last request carried it, the stepped compaction state over it, and the benchmark counters. Shared between the decorator (which refreshes it) and the zoom tool (which reads the log).
- Transcript
Settings - The view’s settings.
- Transcript
Stats - The compaction’s benchmark snapshot: what the view has been doing,
and what the providers’ own usage says about the prefix cache. All
counters run from the transcript’s construction; a resumed session
keeps its run continuous by folding the saved counters in with
TranscriptStats::carry. The struct is the saved shape: the frontend serializes it into the session file verbatim. - Transcript
View - The transcript as a
ModelProvider: wrapsinner, rewrites every request’s messages through the stepped view, and refreshes the shared mirror first. A configuredSummarizerupgrades the new sections’ stand-ins in a background task after the request went out — never inside it, never under the mirror’s lock, so a slow or failing worker delays nothing. - Usage
Breakdown - The session’s token usage, split by what it bought. The five input
categories share each request’s reported input tokens in proportion
to their wire bytes (tool definitions ride with the calls that
use them); the model’s generated output tokens all land on
model_output_tokens, which also carries the assistant text the history re-sends. The compaction block travels as a user message and counts there.
Enums§
- Worker
Outcome - How one summarizer call ended, as
Transcript::record_worker_callcounts it.