Skip to main content

Module session

Module session 

Source

Structs§

CheckpointState
Boundary recorded by the checkpoint tool for a later rewind.
CompactOutcome
Outcome of Session::compact for autocompact circuit breakers.
Session
A conversation session
SessionCost
Running USD estimate. Steps whose model has no known price are counted, not guessed.

Constants§

COMPACT_CONTINUATION_PREAMBLE
Preamble prepended to the post-compact summary carrier (full-replace).
SPILL_HEAD_CHARS
What stays in the transcript when an old tool body is spilled to disk: this many leading chars, then a pointer line. Under the shake cap, so neither prune nor shake cuts the pointer away.
SPILL_MARK
Marks a spilled body; a body that carries it is not spilled again.
TOOL_RESULT_MAX_CHARS
Soft cap on tool result bodies kept in the transcript (Unicode scalars).
TOOL_RESULT_PRUNE_CHARS
Cap for older tool results during compact (prune to ~2k chars). Recent tool dumps stay at TOOL_RESULT_MAX_CHARS so the model can still use the last step’s output; older steps shrink hard for TTFT.
TOOL_RESULT_SHAKE_CHARS
Harder shake when the session is still over ~¾ of the compact threshold.

Functions§

compact_summary_display_text
Human-facing compact card: drop the model preamble, keep the summary body.
default_system_prompt
Default system prompt for the main agent
format_compact_summary
Clean a compaction-model reply into a plain summary body.
format_compact_summary_content
Continuation carrier that replaces compacted history (full-replace).
is_compact_summary_text
True when a user message is a compact stub, not a real user turn.