Pack keeps whole messages newest-first until the budget is full, then returns them chronologically. The newest message is always kept, even if it alone exceeds the budget. Two clean-up passes then keep the wire well-formed: dropDanglingToolCalls drops an assistant whose tool_calls weren't all answer
(history []Message, budget int)
source not stored for this graph (policy: none)