/**
 * Phoenix ID — the typed surface commands use. Every route the account backend
 * exposes is a function here; no command builds a URL or reads a token itself.
 */
import { type PhoenixSession } from './client.js';
export { PHOENIX_ID_BASE, PhoenixApiError, clearSession, readSession, sessionFilePath, writeSession, type PhoenixSession, } from './client.js';
export interface DeviceAuthorization {
    device_code: string;
    user_code: string;
    verification_uri: string;
    verification_uri_complete: string;
    expires_in: number;
    interval: number;
}
export interface WhoAmI {
    userId: string;
    email: string;
    valid: true;
    /** Hosted OAuth profile image, when Phoenix ID stores one for this user. */
    avatar_url?: string;
}
/**
 * RFC 8628 poll outcomes. `pending` and `slow_down` are normal states of a
 * login in progress, not failures — the server signals them through the error
 * body, and this is where that wire detail stops.
 */
export type DevicePoll = {
    status: 'authorized';
    access_token: string;
    user: {
        email: string;
        id: string;
        /** Hosted OAuth profile image, when the provider exposed one to Phoenix ID. */
        avatar_url?: string;
        /** Google-style alias some providers use for the same field. */
        picture?: string;
    };
} | {
    status: 'pending';
} | {
    status: 'slow_down';
} | {
    status: 'expired';
} | {
    status: 'denied';
};
export declare function startDeviceAuthorization(): Promise<DeviceAuthorization>;
export declare function pollDeviceToken(deviceCode: string): Promise<DevicePoll>;
export declare function fetchWhoAmI(token?: string): Promise<WhoAmI>;
/**
 * Best-effort fill of the session's hosted avatar (PHNX-3547): sessions written
 * before the CLI tracked avatars have none, so ask `/api/v1/auth/me` and merge
 * a hosted `avatar_url` into the persisted session — future publishes then
 * stamp the OAuth profile image instead of only a Gravatar hash. A no-op when
 * signed out, when an avatar is already stored, or when the server exposes
 * none; network/server failures are swallowed (the share attribution falls
 * back to Gravatar/initials either way).
 */
export declare function refreshSessionAvatar(): Promise<void>;
export interface SpaceSummary {
    id: string;
    slug: string;
    name: string;
    organization_id: string | null;
    owner_user_id: string;
    invite_code?: string;
    user_role: 'owner' | 'admin' | 'member';
    created_at: string;
}
export interface SpaceMember {
    user_id: string;
    email: string;
    name?: string;
    avatar_url?: string;
    role: 'owner' | 'admin' | 'member';
    joined_at: string;
}
export interface SpaceInvite {
    id: string;
    space_id: string;
    email: string;
    role: 'admin' | 'member';
    invite_code: string;
    created_at: string;
}
export type CreateInviteResult = {
    invited: true;
    email: string;
    role: string;
    member_added: true;
} | {
    invited: true;
    email: string;
    role: string;
    invite_code: string;
    member_added: false;
};
export declare const listSpaces: () => Promise<SpaceSummary[]>;
export declare const createSpace: (input: {
    name: string;
    slug: string;
}) => Promise<SpaceSummary>;
export declare const getSpace: (id: string) => Promise<SpaceSummary>;
export declare const listSpaceMembers: (id: string) => Promise<SpaceMember[]>;
export declare const createSpaceInvite: (id: string, input: {
    email: string;
    role: "admin" | "member";
}) => Promise<CreateInviteResult>;
export declare const listSpaceInvites: (id: string) => Promise<SpaceInvite[]>;
export declare const revokeSpaceInvite: (id: string, inviteId: string) => Promise<{
    revoked: true;
}>;
export declare const updateSpaceMemberRole: (id: string, userId: string, role: "admin" | "member") => Promise<{
    user_id: string;
    role: string;
    updated: true;
}>;
export declare const removeSpaceMember: (id: string, userId: string) => Promise<void>;
export declare const deleteSpace: (id: string) => Promise<void>;
export interface Subscription {
    tierName?: string;
    [key: string]: unknown;
}
export declare const fetchSubscription: (agent?: string) => Promise<Subscription>;
/** `Design Team` → `design-team`; the slug a space gets when the user gives only a name. */
export declare function slugify(name: string): string;
/** Resolve a space by id, slug, or name from a list the caller already fetched. */
export declare function resolveSpaceFromList(spaces: SpaceSummary[], ref?: string): SpaceSummary | null;
/** Resolve a member by email or user id from a list the caller already fetched. */
export declare function resolveMemberFromList(members: SpaceMember[], ref: string): SpaceMember | null;
export type { PhoenixSession as Session };
