Expand description
A bounded, agent-consumable render of a session: the actual conversation
(not a lossy summary), but with tool-output bulk folded to head+tail and an
optional total budget that keeps the recent tail. This is what a caller (an
agent via MCP, or show --window) reads to know what another session is
doing without flooding its own context. The four things that make it
parseable: an orientation header, role labels, tool CALLS kept but tool
RESULTS folded, and a drill-down hint to show <id> --full.
Structs§
Constants§
- TURN_
SCHEMA - Schema id for a single drilled-down turn (
session_windowwithturn). - TURN_
TEXT_ CAP - Char cap for a single drilled-down turn’s full text, sized to stay inside the
MCP text-content window;
clippedreports when the original was longer. - WINDOW_
SCHEMA - Schema id for the JSON window returned over MCP. Bump the version ONLY on a breaking change to field names or semantics, so a consuming agent can rely on the contract.
Functions§
- render_
turn_ json - Render ONE turn’s full RETAINED text as JSON (schema
TURN_SCHEMA) - the drill-down forsession_window(id, turn=i). “Full” means untruncated by the window’s folding/cap; tool outputs are already capped at parse time, so this recovers folded-out lines, not adapter-dropped bulk. Bounded toTURN_TEXT_CAPchars for MCP transport;clippedandbytesreport the true size.Noneifiis out of range. - render_
window - Render the bounded window for
session. - render_
window_ json - Render
sessionas the versioned, agent-parseable JSON window (schemaWINDOW_SCHEMA): orientation header, role-labelled turns with tool output folded, the recent tail kept withinbudget_chars. Pure and deterministic for a fixed (session, opts) - the MCP layer handles neutralization and the final size guard.