export type PendingType = 'addMessage' | 'commitSession'; export interface PendingEntry { type: PendingType; sessionId: string; payload: Record; createdAt: number; retries: number; dedupKey: string; } interface PendingListItem { filename: string; entry: PendingEntry; } /** * Enqueue a failed operation to local disk. */ export declare function enqueue(type: PendingType, sessionId: string, payload: Record, options?: { createdAt?: number; }): Promise<{ ok: boolean; path?: string; deduped?: boolean; dedupKey: string; error?: string; }>; /** * List all pending queue entries sorted by createdAt ascending. */ export declare function listPending(): Promise; /** * Atomically claim a pending file for replay. Only the process that successfully * renames the file may send the HTTP replay. */ export declare function claimForReplay(filename: string): Promise; /** * Remove a pending entry after successful replay. */ export declare function dequeue(filename: string): Promise; /** * Increment retry count on a pending entry. Returns false if max retries exceeded. */ export declare function incrementRetry(filename: string, entry: PendingEntry): Promise; /** * Clean up stale entries older than TTL. */ export declare function cleanStale(): Promise; export interface ReplaySummary { replayed: number; failed: number; skipped: number; deferred: number; } type FetchJSON = (path: string, init: RequestInit, options?: { timeoutMs?: number; actorPeerId?: string; }) => Promise<{ ok: boolean; status?: number; result?: Record | null; error?: { message?: string; code?: string; details?: { retryable?: boolean; }; }; traceId: string | undefined; }>; /** * Replay pending entries. Call this during session-start when the server is * healthy. Each run processes at most OPENVIKING_PENDING_REPLAY_LIMIT items so * a just-recovered server is not hit with an unbounded replay burst. */ export declare function replayPending(fetchJSON: FetchJSON, log: (stage: string, data: unknown) => void): Promise; export {}; //# sourceMappingURL=pending-queue.d.ts.map