pub fn pair(history: Vec<Option<Message>>, pairing: Pairing) -> PairedExpand description
The one rule for when a tool call is answered.
None is a turn the caller emptied; it ends waiting calls like a turn.
- A result answers the first call of the turn before it still waiting with its id; a result nothing waits for is dropped.
- A turn that ended in an error or was aborted is kept; its calls wait for nothing.
- A call still waiting at a user message with more than results, the
next turn or the end gets a
close_pendingresult, before the user message’s own content. - Adjacent non-empty user messages become one, and a system message arriving while calls wait is held until they are answered.