/** * Mint (or reuse) a pending Clerk CLI login without a TTY. * * MCP / agent hosts have no stdin/stdout TTY, so they must not wait for * `canLaunchInteractiveAuth` before creating `https://apiclaw.cloud/auth/cli?authId=…`. * Opening the browser is best-effort. whoami redeems Authorize; localhost * connection refused is OK. */ import type { PendingLogin } from "./cli-auth-redeem.js"; export declare const CLI_AUTH_START_PATH = "cliAuth:start"; export declare const PENDING_LOGIN_LOOPBACK_PORT = 41789; export type StartedPendingLogin = PendingLogin & { reused: boolean; }; export type CliAuthStartArgs = { state: string; challenge: string; port: number; fingerprint: string; appUrl: string; }; export type CliAuthStartResult = { authId: string; browserUrl: string; expiresAt: number; }; export type OpenBrowserSpawn = (command: string, args: readonly string[], options: { detached?: boolean; stdio?: "ignore"; }) => { unref: () => void; }; export type EnsurePendingLoginOptions = { /** Best-effort browser open. Default false — minting must not require a TTY. */ openBrowser?: boolean; port?: number; now?: number; fingerprint?: string; appUrl?: string; convexUrl?: string; start?: (args: CliAuthStartArgs) => Promise; /** Injected for tests. Defaults to process.platform. */ platform?: NodeJS.Platform; /** Injected for tests. Defaults to node:child_process spawn. */ spawn?: OpenBrowserSpawn; }; export declare function generatePkcePair(): { verifier: string; challenge: string; }; export declare function generateCliAuthState(): string; export declare function openBrowserBestEffort(url: string, options?: { platform?: NodeJS.Platform; spawn?: OpenBrowserSpawn; }): boolean; /** * Return an open pending login, or mint a new one. Never gated on TTY. * Always writes authId + PKCE verifier so whoami can redeem Authorize. */ export declare function ensurePendingLogin(options?: EnsurePendingLoginOptions): Promise; //# sourceMappingURL=pending-login-start.d.ts.map