MCPcopy
hub / github.com/codeaashu/claude-code / findLastCompactBoundaryIndex

Function findLastCompactBoundaryIndex

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 1

isCompactBoundaryMessageFunction · 0.85

Tested by

no test coverage detected