MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / getSelectedCompactionIndex

Function getSelectedCompactionIndex

shared/thread-history.ts:108–128  ·  view source on GitHub ↗
(pathEntries: SessionPathEntry[], revealedCompactions: number)

Source from the content-addressed store, hash-verified

106}
107
108function getSelectedCompactionIndex(pathEntries: SessionPathEntry[], revealedCompactions: number) {
109 if (revealedCompactions < 0) {
110 return -1
111 }
112
113 let remainingCompactionsToSkip = revealedCompactions
114
115 for (let index = pathEntries.length - 1; index >= 0; index -= 1) {
116 if (pathEntries[index]?.type !== 'compaction') {
117 continue
118 }
119
120 if (remainingCompactionsToSkip === 0) {
121 return index
122 }
123
124 remainingCompactionsToSkip -= 1
125 }
126
127 return -1
128}
129
130function findEntryIndexById(pathEntries: SessionPathEntry[], entryId: string) {
131 for (let index = 0; index < pathEntries.length; index += 1) {

Callers 1

buildThreadHistorySliceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected