closed Segments
fun <T> closedSegments(items: List<T>, now: Instant, timestamp: (T) -> Instant, size: (T) -> Int = { 1 }): List<List<T>>
The closed conversation segments in items (a single stream, e.g. one channel), each a time-ordered sub-list. now is the reference "current time" used to decide whether the trailing segment has settled; a now preceding the last item leaves that segment open. size weights each item against maxSize; the default counts items. Both accessors are invoked exactly once per item.