( agentType: string, scope: AgentMemoryScope, )
| 68 | } |
| 69 | |
| 70 | async function copySnapshotToLocal( |
| 71 | agentType: string, |
| 72 | scope: AgentMemoryScope, |
| 73 | ): Promise<void> { |
| 74 | const snapshotMemDir = getSnapshotDirForAgent(agentType) |
| 75 | const localMemDir = getAgentMemoryDir(agentType, scope) |
| 76 | |
| 77 | await mkdir(localMemDir, { recursive: true }) |
| 78 | |
| 79 | try { |
| 80 | const files = await readdir(snapshotMemDir, { withFileTypes: true }) |
| 81 | for (const dirent of files) { |
| 82 | if (!dirent.isFile() || dirent.name === SNAPSHOT_JSON) continue |
| 83 | const content = await readFile(join(snapshotMemDir, dirent.name), { |
| 84 | encoding: 'utf-8', |
| 85 | }) |
| 86 | await writeFile(join(localMemDir, dirent.name), content) |
| 87 | } |
| 88 | } catch (e) { |
| 89 | logForDebugging(`Failed to copy snapshot to local agent memory: ${e}`) |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | async function saveSyncedMeta( |
| 94 | agentType: string, |
no test coverage detected