/** * Auth token rotator — manage a pool of authenticated sessions for multi-account crawls. * * Use case: crawl the same app as admin+user+guest in one crawl job to discover * role-specific screens that only appear when authenticated with different privileges. * Each session is a Playwright storageState JSON string. * * Sessions are checked out (locked) before use and returned after the page is done. * Round-robin assignment with stale-session eviction after maxAgeMs. */ export interface SessionEntry { id: string; role: string; storageState: string; createdAt: number; checkedOutAt: number | null; requestCount: number; } export interface SessionPoolOpts { sessions: Array<{ role: string; storageState: string; }>; maxAgeMs?: number; maxRequestsPerSession?: number; } export declare class AuthTokenRotator { private pool; private readonly maxAgeMs; private readonly maxRequests; constructor(opts: SessionPoolOpts); /** Get the next available session. Returns null if all are checked out. */ checkout(): SessionEntry | null; /** Return a session to the pool after use. */ checkin(sessionId: string, updatedStorageState?: string): void; /** Get all available sessions (for parallel crawl setup). */ getAll(): ReadonlyArray; /** Stats for monitoring. */ stats(): { total: number; available: number; checkedOut: number; stale: number; }; /** Add a new session to the pool at runtime. */ addSession(role: string, storageState: string): string; }