diff --git a/src/providers/copilot.ts b/src/providers/copilot.ts index 9cb7983..f32738f 100644 --- a/src/providers/copilot.ts +++ b/src/providers/copilot.ts @@ -1,7 +1,8 @@ -import { readdir, readFile, stat } from 'fs/promises' +import { readdir, stat } from 'fs/promises' import { basename, dirname, join } from 'path' import { homedir } from 'os' +import { readSessionFile } from '../fs-utils.js' import { calculateCost } from '../models.js' import type { Provider, SessionSource, SessionParser, ParsedProviderCall } from './types.js' @@ -85,13 +86,8 @@ function parseCwd(yaml: string): string | null { function createParser(source: SessionSource, seenKeys: Set): SessionParser { return { async *parse(): AsyncGenerator { - let content: string - try { - content = await readFile(source.path, 'utf-8') - } catch { - return - } - + const content = await readSessionFile(source.path) + if (content === null) return const sessionId = basename(dirname(source.path)) const lines = content.split('\n').filter(l => l.trim()) let currentModel = '' @@ -177,11 +173,11 @@ async function discoverSessionsInDir(sessionStateDir: string): Promise