import { spawn } from "node:child_process"; import { z } from "zod"; /** `POST /api/auth/device/code` (RFC 8628, section 3.2), parsed loosely: a newer cloud may say more. */ export declare const DeviceCodeSchema: z.ZodObject<{ device_code: z.ZodString; user_code: z.ZodString; verification_uri: z.ZodString; verification_uri_complete: z.ZodOptional; expires_in: z.ZodNumber; interval: z.ZodOptional; }, z.core.$loose>; export type DeviceCode = z.infer; /** What the person needs to approve the sign-in: the page (with the code in it when the cloud gives one) and the code. */ export interface SignInPrompt { url: string; code: string; expiresInSeconds: number; } export interface BrowserLoginOptions { /** The cloud, already resolved; nothing is sent to it under `SKILLHOOK_NO_CLOUD` or in plain http (`env` says). */ url: string; clientName?: string; /** Told once the sign-in started: show the page and the code, open the browser. */ onPrompt: (prompt: SignInPrompt) => void | Promise; /** The kill switch, and plain http only where it is allowed (`SKILLHOOK_CLOUD_ALLOW_INSECURE`), for the cloud and its page. */ env: NodeJS.ProcessEnv; fetchImpl?: typeof fetch; sleep?: (ms: number) => Promise; now?: () => number; } /** "skillhook CLI on mac-mini": how the key is named on the dashboard, where the person revokes it. */ export declare function defaultClientName(): string; /** * Starts a sign-in at `options.url`, tells `onPrompt` what to show, and polls until the person decided. Resolves with the * new key; rejects with a `CloudApiError` whose code says why not: `unsupported` (a cloud from before browser sign-in), * `denied`, `expired`, or what the cloud answered. Network trouble, 5xx and 429 answers only make it wait longer. */ export declare function browserLogin(options: BrowserLoginOptions): Promise<{ key: string; scope: string | null; }>; /** * Opens `url` in the person's browser without waiting for it (argv, never a shell). Not over SSH, where it would open on * the far machine's screen or nowhere, nor on Linux without a display: false then, and the caller's printed link is the * way. */ export declare function openBrowser(url: string, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, run?: typeof spawn): boolean;