MCPcopy Create free account
hub / github.com/Noumena-Network/code / findLastCompactBoundaryIndex

Function findLastCompactBoundaryIndex

src/utils/messages.ts:4718–4729  ·  view source on GitHub ↗
(messages: T[])

Source from the content-addressed store, hash-verified

4716 * @returns The index of the last compact boundary, or -1 if none found
4717 */
4718export 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).

Callers 1

Calls 1

isCompactBoundaryMessageFunction · 0.70

Tested by

no test coverage detected