in agents/agents-features/agents-features-snapshot/src/commonMain/kotlin/ai/koog/agents/snapshot/providers/file/FilePersistencyStorageProvider.kt [70:91]
override suspend fun getCheckpoints(agentId: String, filter: AgentCheckpointPredicateFilter?): List<AgentCheckpointData> {
val agentDir = agentCheckpointsDir(agentId)
if (!fs.exists(agentDir)) {
return emptyList()
}
val checkpoints = fs.list(agentDir).mapNotNull { path ->
try {
val content = fs.readText(path)
json.decodeFromString<AgentCheckpointData>(content)
} catch (_: Exception) {
null
}
}
if (filter != null) {
return checkpoints.filter { filter.check(it) }
}
return checkpoints
}