/** * Keep `apiclaw auth login` in front of the human until Clerk writes * session_token. Printing the login URL is not success. Poll whoami / * the session file, reprint the URL every few seconds, and wait for * the loopback callback. Do not return success until one of those * proves the session exists or the callback arrived so exchange can * write it. */ export declare const LOGIN_URL_REPRINT_MS = 4000; export declare const LOGIN_SESSION_POLL_MS = 1000; export declare const LOGIN_WAIT_TIMEOUT_MS: number; export declare function loginWaitReprintLines(loginUrl: string): string[]; /** Loopback tab after Authorize. Session is not written until the CLI exchanges. */ export declare function loopbackCallbackSuccessHtml(): string; /** * True when the session file has a usable token that is not the * `--force` token we are replacing. */ export declare function isFreshLoginSession(current: { sessionToken?: string; } | null | undefined, previousToken?: string): boolean; export type LoginWaitSuccess = { ok: true; source: "session"; } | { ok: true; source: "callback"; callback: T; }; export type LoginWaitFailure = { ok: false; reason: "timeout" | "callback_error"; error?: Error; }; export type LoginWaitResult = LoginWaitSuccess | LoginWaitFailure; export interface WaitUntilSessionOrCallbackOptions { loginUrl: string; hasSession: () => boolean; callback: Promise; timeoutMs?: number; reprintMs?: number; pollMs?: number; now?: () => number; sleep?: (ms: number) => Promise; onReprint: (lines: string[]) => void; /** Default true: print the URL immediately, then every reprintMs. */ reprintImmediately?: boolean; } export declare function waitUntilSessionOrCallback(options: WaitUntilSessionOrCallbackOptions): Promise>; //# sourceMappingURL=login-wait.d.ts.map