(messages: T[])
| 4616 | * @returns The index of the last compact boundary, or -1 if none found |
| 4617 | */ |
| 4618 | export function findLastCompactBoundaryIndex< |
| 4619 | T extends Message | NormalizedMessage, |
| 4620 | >(messages: T[]): number { |
| 4621 | // Scan backwards to find the most recent compact boundary |
| 4622 | for (let i = messages.length - 1; i >= 0; i--) { |
| 4623 | const message = messages[i] |
| 4624 | if (message && isCompactBoundaryMessage(message)) { |
| 4625 | return i |
| 4626 | } |
| 4627 | } |
| 4628 | return -1 // No boundary found |
| 4629 | } |
| 4630 | |
| 4631 | /** |
| 4632 | * Returns messages from the last compact boundary onward (including the boundary). |
no test coverage detected