Skip to main content

unit_boundaries

Function unit_boundaries 

Source
pub fn unit_boundaries(messages: &[Message]) -> Vec<Range<usize>>
Expand description

Partition history into indivisible conversational transactions.

A new user turn starts a unit only when no tool call is awaiting a result. This keeps an assistant call, every correlated result, and the trailing answer on the same side of every compression/render boundary. Malformed recovery input is kept together until its open calls close, which is safer than manufacturing an orphaned result.