import { type ConfigContext } from "./config.js"; import { CliError } from "./error-codes.js"; import { type InteractivePrompts } from "./interactive.js"; /** * Links a phone to the signed-in Relay account, so the same account signs in * to the Relay app (owner, 2026-09-26: "You can link your phone number in the * console or via the CLI. Once linked, it is your own account for the Relay * app too."). Optional; tool approvals from connected agents reach an owner * only in the Relay app (approvals.ts, noOwnerLine), so linking is how they arrive. * * Relay-Auth texts and checks the code (branch phone-link-20260926): * POST {auth}/api/auth/phone-link/send-otp {phoneNumber} * POST {auth}/api/auth/phone-link/verify {phoneNumber, code} * → {status: "attached" | "merged", user: {id, phoneNumber, phoneNumberVerified}} * with the Console session this computer already holds as the bearer, the * way `relay login` reads the session (bearer plugin). "merged" means the * number already had a Relay app account and the two are now one, so the * saved session is read again and saved the way `relay login` saves it. */ /** Relay-Auth's own validator (src/auth.ts phoneNumberValidator). */ export declare const E164: RegExp; /** Relay-Auth's codes are six digits (Telnyx Verify). */ export declare const OTP: RegExp; export declare class PhoneLinkRefusal extends CliError { readonly authCode: string | undefined; constructor(message: string, authCode: string | undefined); } export interface PhoneLinkDependencies { context: ConfigContext; apiURL?: string; fetch?: typeof globalThis.fetch; /** Present only when a person is at a terminal and may be asked. */ prompts?: InteractivePrompts; stderr: (value: string) => void; } export interface PhoneLinkResult { ok: true; status: "code_sent" | "attached" | "merged"; phone_number: string; user?: { id: string; }; /** "refreshed" after a merge: this computer's Console sign-in was read again and saved. */ session?: "refreshed" | "unchanged"; } export declare function linkPhone(options: { number?: string; code?: string; }, deps: PhoneLinkDependencies): Promise; /** The sentence a person reads after a link. */ export declare const phoneLinkSentence: (result: PhoneLinkResult) => string | undefined; //# sourceMappingURL=phone-link.d.ts.map