pub fn push_content_chunk(chunks: &mut Vec<Value>, chunk: Value)Expand description
Append one ACP ContentChunk value to a transcript item’s chunk list,
merging it into the previous chunk when the two are the same text stream.
Agents stream text one token at a time, so a long turn arrives as
thousands of chunks that differ only in content.text. Stored separately
they cost far more memory than the text they carry: each chunk is its own
pair of nested serde_json::Value maps. Merging them keeps one chunk per
run of text, which is what every reader of chunks already reconstructs.
Two chunks merge only when nothing but the text differs: both are objects
whose content.type is "text" with a string content.text, their
messageId values are equal (both absent counts as equal), and every
other top-level key (such as meta) and every other content key (such
as annotations) is identical. Anything else is pushed as its own chunk.