pub fn detect_pattern(
history: &[ToolCallRecord],
window_size: usize,
) -> PatternStateExpand description
Detect a pattern in a history of tool-call records.
Only the last window_size entries are examined.
Returns PatternState::Single for an empty or single-entry history.
§Why a free function?
The logic is stateless — window_size is the only parameter. A wrapper
struct added no encapsulation and hurt discoverability (KISS).