* Check if a checkpoint exists for the given thread_id
(checkpointer: SqliteSaver, threadId: string)
| 8 | * Check if a checkpoint exists for the given thread_id |
| 9 | */ |
| 10 | async function checkpointExists(checkpointer: SqliteSaver, threadId: string): Promise<boolean> { |
| 11 | try { |
| 12 | const checkpoints = checkpointer.list({ configurable: { thread_id: threadId } }, { limit: 1 }); |
| 13 | const firstCheckpoint = await checkpoints.next(); |
| 14 | return !firstCheckpoint.done && firstCheckpoint.value !== undefined; |
| 15 | } catch (error) { |
| 16 | const errorMessage = error instanceof Error ? error.message : String(error); |
| 17 | logger.printTestLog(`Error checking checkpoint: ${errorMessage}`); |
| 18 | return false; |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Clear checkpoint for the given thread_id |
no outgoing calls
no test coverage detected