(encoded: string)
| 88 | } |
| 89 | |
| 90 | export function decodeConversationCursor(encoded: string): ConversationCursor | null { |
| 91 | try { |
| 92 | const json = new TextDecoder().decode(base64urlDecode(encoded)); |
| 93 | const parsed: unknown = JSON.parse(json); |
| 94 | const cursor = conversationCursorSchema.safeParse(parsed); |
| 95 | return cursor.success ? cursor.data : null; |
| 96 | } catch { |
| 97 | return null; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Extract plain text from an array of content blocks. |