Skip to main content

Module conversation_window

Module conversation_window 

Source
Expand description

The window a conversation is cut to when it is held or handed over.

One window, applied at every boundary. The transport’s copy of a seat’s conversation lives in one, and a Connected cuts a resume’s whole transcript to one before it rides an update - so a read that was 2.5 GiB on the seat #2150 was filed from is not copied per subscriber. The fan-out’s ring is sized from the same caps, because a ring exists to fill a copy that is behind.

A window is bounded by frames and by bytes. The count alone let a giant seat’s window weigh 319 MiB (measured 2026-10-17 on the seat #1637 was filed from, in the frames a read serves - CONVERSATION_CAP_BYTES names the basis, and why the file’s own lines read as about half of it) - and it is not the window’s own weight that bites: a page is cut from the window, so a ceiling ABOVE the newest twenty turns changes nothing a reader feels. CONVERSATION_CAP_BYTES carries where the byte ceiling’s number comes from and what it deliberately changes on the seats that reach it: a page there is the window whole rather than the newest twenty turns, and the history above it is reached the way any window’s is, a more below the floor answered from the transcript.

And both cuts land on a turn’s first frame. A window starting part-way through a turn serves its first turn with the head missing, so what the cap sheds is counted to a frame a turn opens at - one cut, shared by both entry points, and crate::conversation_turns is where a turn opens. The one case with no whole turn to land on is a turn heavier than both ceilings and their slack: there the cut is made inside it, and the frames it keeps are the newest ones.

Re-exports§

use forge_primitives::Message; 🔒

Structs§

Budget 🔒
The two ceilings one cut answers to, as a value.
Counted 🔒
A writer that only counts, so weighing a frame does not allocate a copy of it.
Shed
What a window’s cut shed: the frames it dropped, and the thinking growth the drop took out of the newest turn.
Window
One conversation’s newest window, and what each frame in it weighs.

Constants§

CONVERSATION_CAP
How many messages one copy of a conversation keeps.
CONVERSATION_CAP_BYTES
How many bytes one copy of a conversation keeps, as frames weigh on the wire.
CONVERSATION_SLACK
How far past the cap a copy may grow before the drop runs.
CONVERSATION_SLACK_BYTES
How far past the byte cap a copy may grow before the drop runs. A quarter of the cap, as the count’s slack is, and it is also the room a turn crossing the byte line is kept whole in.
WINDOW 🔒
The ceilings the shipped window answers to.

Functions§

front_of 🔒
Where the window’s front moves to in messages: the first frame of the oldest turn it keeps.
line_by_bytes 🔒
The first frame of sizes whose tail weighs no more than cap.
thinking_in 🔒
The thinking growth a run of frames stands for: the sum of the deltas on the turn’s own counters among them.
turn_counter 🔒
The growth a frame stands for when it is the turn’s own thinking counter, not a dispatched sub-agent’s.
weighted_from 🔒
What sizes[from..] weighs together.
wire_bytes 🔒
What a frame weighs on the wire: its JSON, which is what a page carries.