fn fold_subagent_sidecars(
messages: &mut Vec<SessionMessage>,
sidecars: Vec<(String, Vec<SessionMessage>)>,
links: &HashMap<String, SidecarLink>,
session_id: &str,
)Expand description
Insert each dispatch’s sidecar frames under the first row its chain answers. Appending them at the end would put them at the newest edge of the resumed window, ahead of the main rows.
A nested dispatch is named by a call inside its parent’s sidecar, never by the transcript, so its chain is walked to the first dispatch the transcript answers and every row is stamped with that card. Resolution happens before any splice, which is what makes the child independent of the parent’s read order; a block whose parent body was read then emits inside the row that fired it, and one whose parent was not read follows the owner’s anchor.