Properties
Message.metadata key holding {threadId, runIds}: the runs that produced the reply.
Functions
The events compacted as AG-UI's reference client does (compactEvents in @ag-ui/client, AG-UI serialization §Compaction): each text message's and tool call's deltas become one …_CONTENT / TOOL_CALL_ARGS event, events that arrived mid-stream follow the stream they interrupted, and each run's state events become one STATE_SNAPSHOT from the last snapshot on (deltas with no snapshot before them stay as they are). Collapsed events keep the metadata of what they replace (merged key by key) and the time of the last one. Like the reference, it reorders (a run's state moves to its end, mid-stream events after their stream), so it suits archiving finished runs; keep the log as recorded for event-level replay.