(messages: T[])
| 4716 | * @returns The index of the last compact boundary, or -1 if none found |
| 4717 | */ |
| 4718 | export function findLastCompactBoundaryIndex< |
| 4719 | T extends Message | NormalizedMessage, |
| 4720 | >(messages: T[]): number { |
| 4721 | // Scan backwards to find the most recent compact boundary |
| 4722 | for (let i = messages.length - 1; i >= 0; i--) { |
| 4723 | const message = messages[i] |
| 4724 | if (message && isCompactBoundaryMessage(message)) { |
| 4725 | return i |
| 4726 | } |
| 4727 | } |
| 4728 | return -1 // No boundary found |
| 4729 | } |
| 4730 | |
| 4731 | /** |
| 4732 | * Returns messages from the last compact boundary onward (including the boundary). |
no test coverage detected