(memoryPath: string)
| 96 | } |
| 97 | |
| 98 | export async function readMemoriesFile(memoryPath: string): Promise<Memory[]> { |
| 99 | try { |
| 100 | const content = await fs.readFile(memoryPath, 'utf-8'); |
| 101 | return normalizeMemories(JSON.parse(content)); |
| 102 | } catch { |
| 103 | return []; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | export async function writeMemoriesFile(memoryPath: string, memories: Memory[]): Promise<void> { |
| 108 | await fs.mkdir(path.dirname(memoryPath), { recursive: true }); |
no test coverage detected