MCPcopy Create free account
hub / github.com/microsoft/AI-Engineering-Coach / parseCLIEventsFileAsync

Function parseCLIEventsFileAsync

src/core/parser-vscode-cli.ts:429–456  ·  view source on GitHub ↗
(
  eventsPath: string,
  wsId: string,
  wsName: string,
  customInstructionsBytes?: number,
  onProgress?: (bytesRead: number, totalBytes: number) => void,
)

Source from the content-addressed store, hash-verified

427 * longer blocks the worker for minutes or freezes the host progress bar (issue #106).
428 */
429export async function parseCLIEventsFileAsync(
430 eventsPath: string,
431 wsId: string,
432 wsName: string,
433 customInstructionsBytes?: number,
434 onProgress?: (bytesRead: number, totalBytes: number) => void,
435): Promise<Session | null> {
436 const state = createInitialCliState(wsId);
437
438 let sawAnyEvent = false;
439 try {
440 await forEachJsonlLineAsync(eventsPath, (line) => {
441 if (!line.trim()) return;
442 const event = parseCLIEventLine(line);
443 if (event) {
444 handleCliEvent(event, state, wsId);
445 sawAnyEvent = true;
446 }
447 }, onProgress);
448 } catch (e) {
449 recordFailedFile('parser-vscode-cli', eventsPath, e);
450 return null;
451 }
452
453 if (!sawAnyEvent) return null;
454
455 return finalizeCliSession(state, wsId, wsName, customInstructionsBytes);
456}
457

Callers 2

Calls 6

forEachJsonlLineAsyncFunction · 0.90
recordFailedFileFunction · 0.90
createInitialCliStateFunction · 0.85
parseCLIEventLineFunction · 0.85
handleCliEventFunction · 0.85
finalizeCliSessionFunction · 0.85

Tested by

no test coverage detected