/** * The order an agent server lists threads and runs in, and the cursor that pages through it. The * regional gateway reads both, so a cursor one region gave pages every region the same way. */ /** A page of a list, newest first, and the cursor of the page after it. */ export interface ListPage { /** The page's records, newest first. */ items: T[]; /** Asks for the page after this one, as `cursor`. Absent on the last page. */ nextCursor?: string; } /** A record as a list places it: by its last write, then its id. */ interface Listed { id?: unknown; updatedAt?: unknown; createdAt?: unknown; } /** Where a record falls in a list. */ interface Place { at: string; id: string; } /** Every list's order: the newest written first, and by id among records written at the same time. */ export declare function newestFirst(a: Listed, b: Listed): number; /** The cursor of the page after one that ends with `record`. */ export declare function cursorAfter(record: Listed): string; /** The place a cursor names, or `undefined` for one no list gave. */ export declare function readCursor(cursor: string): Place | undefined; /** Whether `record` comes after `place`, so belongs to the pages after the cursor that names it. */ export declare function isAfter(record: Listed, place: Place): boolean; /** * The page of the records `keep` takes, after `after`, from a store that lists newest written first. * It reads more of the store until the page is full or the store ends. Until the store ends, only * records newer than the oldest one read are placed for sure: another written in that same instant * may be unread yet, and come before them by id. */ export declare function pageOf(list: (limit: number) => Promise | R[], keep: (record: R) => boolean, limit: number, after: Place | undefined): Promise>; export {};