Skip to main content

Module history_summary

Module history_summary 

Source
Expand description

What an agent was last asked, read from its GLOBAL transcript zone.

“My Agents” needs a preview, a last-activity time and an honest empty state for every agent, whether or not it was launched in this channel and whether or not a pane is open. The per-block output.state.json it used to read is no longer written; the history lives under agent:<defId>:current (or, once archived, agent:<defId>:archive:<ms>) in the shared transcript store, keyed by agent id and written by every channel.

The output file there is the provider’s raw NDJSON stream and can be gigabytes (most of it stream_event deltas), so it is never loaded whole: the newest user prompt is found by reading backwards in fixed chunks, up to a cap, and the result is remembered until the file changes. Spec: SPEC_MY_AGENTS_TILES_AUTH_AND_HISTORY_2026_10_03.md §5.3.

Structs§

AgentHistory

Enums§

HistoryRead
What the transcript store knows about one agent.

Constants§

CHUNK 🔒
Bytes read per backwards step.
MAX_LINE 🔒
A single line longer than this is skipped rather than carried across chunks.
MAX_SCAN 🔒
The most of a transcript’s tail one lookup reads. Real transcripts put the newest user prompt well inside the last two chunks; past this the answer is “none recent”, not a longer read.
MEMO_CAP 🔒
Remembered results kept before the memo is reset.

Functions§

contains 🔒
history_store 🔒
The store to read: the process-global transcript store, or in tests the one the current thread installed.
is_scaffolding 🔒
Text the harness puts in the user turn that the user did not type.
memo 🔒
newest_zone_with_output 🔒
(zone, size, modts) of the agent’s current zone if it has output, else of its newest archive that does.
read_agent_history
Read what definition_id’s transcript says, falling back to its newest archive when the current zone is empty.
read_histories
History for each distinct agent id, read on the blocking pool. Empty when no transcript store is installed, which callers treat as “use the old source”.
scan_tail_for_prompt 🔒
The newest real user prompt within the last MAX_SCAN bytes of output, or an empty string if there is none.
user_prompt_in_line 🔒
The text of a real user prompt if line is one: a user record that is not a tool result, not from a sub-agent, and not startup or injected scaffolding.

Type Aliases§

MemoKey 🔒
MemoVal 🔒