MCPcopy Create free account
hub / github.com/WJX20/claude-code / enrichLogs

Function enrichLogs

src/utils/sessionStorage.ts:5078–5106  ·  view source on GitHub ↗
(
  allLogs: LogOption[],
  startIndex: number,
  count: number,
)

Source from the content-addressed store, hash-verified

5076 * index where scanning stopped (for progressive loading to continue from).
5077 */
5078export async function enrichLogs(
5079 allLogs: LogOption[],
5080 startIndex: number,
5081 count: number,
5082): Promise<{ logs: LogOption[]; nextIndex: number }> {
5083 const result: LogOption[] = []
5084 const readBuf = Buffer.alloc(LITE_READ_BUF_SIZE)
5085 let i = startIndex
5086
5087 while (i < allLogs.length && result.length < count) {
5088 const log = allLogs[i]!
5089 i++
5090
5091 const enriched = await enrichLog(log, readBuf)
5092 if (enriched) {
5093 result.push(enriched)
5094 }
5095 }
5096
5097 const scanned = i - startIndex
5098 const filtered = scanned - result.length
5099 if (filtered > 0) {
5100 logForDebugging(
5101 `/resume: enriched ${scanned} sessions, ${filtered} filtered out, ${result.length} visible (${allLogs.length - i} remaining on disk)`,
5102 )
5103 }
5104
5105 return { logs: result, nextIndex: i }
5106}

Callers 5

loadMessageLogsFunction · 0.85
ResumeConversationFunction · 0.85

Calls 2

enrichLogFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected