import type { DeviceAuthPollResult, DeviceAuthPrefill, DeviceAuthStart } from "../types/api.js"; /** * Refuse to run the device flow against anything but an https bland.ai host. * The flow is unauthenticated and ends with an api_key crossing the wire, so * a bad --base-url (typo, MITM, or a misconfigured proxy) must not silently * send that key somewhere else. */ export declare function assertDeviceAuthBaseUrl(baseUrl: string): void; declare const PREFILL_KEYS: readonly ["name", "first_name", "last_name", "email", "phone"]; /** * Assemble the /start `prefill` body from whatever the caller collected about * the human (CLI flags, MCP tool args). Trims and drops empty fields, nothing * more: the server owns validation and silently discards invalid values, so a * bad email or phone here must never block the sign-up. Returns undefined when * nothing usable remains so callers omit the field entirely. */ export declare function buildDeviceAuthPrefill(input: Partial>): DeviceAuthPrefill | undefined; /** Start a device authorization flow. Unauthenticated — no API key required or sent. */ export declare function startDeviceAuth(baseUrl: string, clientName?: string, prefill?: DeviceAuthPrefill): Promise; export interface PollDeviceAuthTick { /** The interval (seconds) about to be used before the next poll. */ interval: number; /** Milliseconds remaining until `deadline`, for display purposes. */ msRemaining: number; } export interface PollDeviceAuthOptions { /** Seconds to wait between polls; increases if the server sends SLOW_DOWN. */ interval: number; /** Epoch ms after which polling gives up even if the server never reports "expired". */ deadline: number; /** Called right before each wait, so callers can update a spinner/countdown. */ onTick?: (tick: PollDeviceAuthTick) => void; } export type DeviceAuthApproved = Extract; /** * One poll, no waiting. The blocking `pollDeviceAuth` below owns the pacing * for the interactive CLI, but an MCP tool call has to return promptly, so * the agent drives the loop itself and calls this once per `interval`. * * Returns the server's own shape, including `pending`, rather than throwing * on it: to the caller, "not yet" is a normal answer, not a failure. A 429 * SLOW_DOWN comes back as `pending` carrying the server's new interval, so * the agent slows down without needing to know the status code. */ export type DeviceAuthPollOnceResult = DeviceAuthPollResult | { status: "pending"; interval?: number; expires_in?: number; }; export declare function pollDeviceAuthOnce(baseUrl: string, deviceCode: string): Promise; /** * Poll the device authorization endpoint until the user approves it, the * code expires, or `deadline` passes. Honors 429 SLOW_DOWN by backing off to * the server-supplied interval rather than a fixed backoff. */ export declare function pollDeviceAuth(baseUrl: string, deviceCode: string, options: PollDeviceAuthOptions): Promise; export {}; //# sourceMappingURL=deviceAuth.d.ts.map