import { deleteAppState, readAppState, writeAppState, } from "@agent-native/core/application-state"; export interface StoredResumableSession { providerId: string; sessionId: string; meta: Record; bytesUploaded: number; lastCommittedIndex?: number; } const key = (recordingId: string) => `resumable-session-${recordingId}`; export async function getResumableSession( recordingId: string, ): Promise { const raw = await readAppState(key(recordingId)); if (!raw || typeof raw !== "object") return null; return raw as unknown as StoredResumableSession; } export async function setResumableSession( recordingId: string, session: StoredResumableSession, ): Promise { await writeAppState( key(recordingId), session as unknown as Record, ); } export async function deleteResumableSession( recordingId: string, ): Promise { await deleteAppState(key(recordingId)); }