/**
 * CLI Cloud Command Group
 *
 * Provides subcommands for managing CrewlyAI Cloud connection:
 *   crewly cloud login [--token <token>]  — Authenticate with CrewlyAI Cloud
 *   crewly cloud status                   — Show current connection status
 *   crewly cloud logout                   — Disconnect from CrewlyAI Cloud
 *
 * The login flow supports three modes:
 * 1. Direct token login via --token flag
 * 2. Browser-based OAuth: starts a local HTTP callback server, opens the
 *    backend Google OAuth URL, receives the token via redirect, persists
 *    credentials to ~/.crewly/cloud/config.json, then calls POST /api/cloud/connect.
 * 3. Mobile/no-browser login via --no-browser flag: prints a URL for the user
 *    to open on their phone, which displays the token after OAuth for manual copy-paste.
 *
 * @module cli/commands/cloud
 */
import http from 'http';
/** Options for the login subcommand */
interface LoginOptions {
    token?: string;
    /** Commander.js sets this to false when --no-browser is passed */
    browser?: boolean;
}
/**
 * Shape of the credentials saved to config.json.
 *
 * Must match PersistedCloudConfig in cloud-client.service.ts so the backend
 * can load credentials saved by the CLI (and vice versa).
 */
interface CloudCredentials {
    cloudUrl: string;
    token: string;
    refreshToken?: string;
    tier: string;
    connectedAt: string;
}
/**
 * Save cloud credentials to ~/.crewly/cloud/config.json.
 *
 * Creates the directory hierarchy if it does not exist.
 *
 * @param token - JWT access token
 * @param refreshToken - Optional refresh token
 */
/**
 * Save cloud credentials to ~/.crewly/cloud/config.json.
 *
 * Creates the directory hierarchy if it does not exist. The format matches
 * PersistedCloudConfig so the backend's loadPersistedConfig() can read it.
 *
 * @param token - JWT access token
 * @param refreshToken - Optional refresh token for auto-renewal
 */
export declare function saveCloudCredentials(token: string, refreshToken?: string): void;
/**
 * Load cloud credentials from ~/.crewly/cloud/config.json.
 *
 * @returns The saved credentials, or null if the file does not exist or is invalid
 */
export declare function loadCloudCredentials(): CloudCredentials | null;
/**
 * Detect whether the current environment can open a browser.
 *
 * Returns false for SSH sessions, Docker containers, and Linux systems
 * without a display server. Returns true for macOS terminals and Linux
 * desktops with DISPLAY or WAYLAND_DISPLAY set.
 *
 * @returns true if browser can likely be opened
 */
export declare function canOpenBrowser(): boolean;
/**
 * Open a URL in the user's default browser.
 *
 * Uses `open` on macOS and `xdg-open` on Linux.
 *
 * @param url - The URL to open
 */
export declare function openBrowser(url: string): void;
/**
 * Start a temporary HTTP server to receive the OAuth callback.
 *
 * The server listens on a random port and resolves with the token and
 * refreshToken query parameters from the callback URL. It automatically
 * shuts down after receiving the callback or after a 120-second timeout.
 *
 * @returns An object containing the server instance, the port, and a
 *          promise that resolves with the received credentials
 */
export declare function startCallbackServer(): {
    server: http.Server;
    port: Promise<number>;
    credentials: Promise<{
        token: string;
        refreshToken?: string;
    }>;
};
/**
 * Prompt the user to paste a token from stdin.
 *
 * Creates a readline interface and waits for the user to paste the token
 * they copied from the mobile login page.
 *
 * @param prompt - The prompt message to display
 * @returns The trimmed user input
 */
export declare function promptForToken(prompt: string): Promise<string>;
/**
 * Handle the `crewly cloud login` subcommand.
 *
 * Supports three login modes:
 * 1. `--token <token>`: saves the token and calls POST /api/cloud/connect directly.
 * 2. `--no-browser`: prints a URL for mobile login, waits for user to paste token.
 * 3. Default: starts a local HTTP callback server, opens the browser to the
 *    backend OAuth URL, waits for the callback, saves credentials.
 *
 * @param options - Login command options (optional --token, --no-browser)
 */
export declare function loginCommand(options: LoginOptions): Promise<void>;
/**
 * Handle the `crewly cloud status` subcommand.
 *
 * Calls GET /api/cloud/status and displays the connection state,
 * tier, cloud URL, and last sync time with color-coded output.
 */
export declare function statusCommand(): Promise<void>;
/**
 * Handle the `crewly cloud logout` subcommand.
 *
 * Calls POST /api/cloud/disconnect to terminate the cloud session.
 */
export declare function logoutCommand(): Promise<void>;
export {};
//# sourceMappingURL=cloud.d.ts.map