pub fn safe_cut(ctx: &[AgentMessage], initial_cut: usize) -> usizeExpand description
Earliest index at which ctx may be split so the kept suffix ctx[cut..]
has no orphaned tool result.
initial_cut is the caller’s preferred split (e.g. ctx.len() - keep); the
result is always <= initial_cut (clamped to ctx.len()). Returns 0 —
keep everything — when walking all the way back still can’t pair a kept
result with its call.