MCPcopy Create free account
hub / github.com/Railly/agentfiles / parseAllConversationsAsync

Function parseAllConversationsAsync

src/conversations/parser.ts:275–298  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

273}
274
275export async function parseAllConversationsAsync(): Promise<ConversationItem[]> {
276 const metas = collectMeta();
277 const conversations: ConversationItem[] = [];
278 const BATCH_SIZE = 20;
279
280 metas.sort((a, b) => b.fileSize - a.fileSize);
281
282 for (let i = 0; i < metas.length; i += BATCH_SIZE) {
283 const batch = metas.slice(i, i + BATCH_SIZE);
284 const results = await Promise.all(
285 batch.map((meta) =>
286 meta.fileSize > MAX_FILE_SIZE
287 ? parseFileAsync(meta)
288 : Promise.resolve(parseFileSync(meta))
289 )
290 );
291 for (const r of results) {
292 if (r) conversations.push(r);
293 }
294 }
295
296 conversations.sort((a, b) => (b.lastTimestamp || "").localeCompare(a.lastTimestamp || ""));
297 return conversations;
298}

Callers 1

refreshAsyncMethod · 0.90

Calls 5

collectMetaFunction · 0.85
parseFileAsyncFunction · 0.85
parseFileSyncFunction · 0.85
sliceMethod · 0.80
sortMethod · 0.45

Tested by

no test coverage detected