import type { AmplitudeAuthResult } from './oauth.js';
import { type AmplitudeUserInfo } from '../lib/api.js';
import type { AmplitudeZone } from '../lib/constants.js';
export type SignupAttemptStatus = 'success' | 'requires_redirect' | 'signup_error' | 'user_fetch_failed' | 'wrapper_exception'
/**
 * Direct signup produced fresh tokens, but the caller's downstream
 * `fetchAmplitudeUser` still failed and it opened a browser OAuth flow
 * to recover. Distinguishes this rare edge case from a primary-path
 * browser OAuth (which never fires this event).
 */
 | 'browser_fallback_after_signup';
export declare const AGENTIC_SIGNUP_ATTEMPTED_EVENT = "agentic signup attempted";
export type AgenticSignupAttemptedProperties = {
    status: SignupAttemptStatus;
    zone: AmplitudeZone;
    'has env with api key'?: boolean;
    'user fetch retry count'?: number;
};
export declare const trackSignupAttempt: (properties: AgenticSignupAttemptedProperties) => void;
export interface SignupOrAuthInput {
    email: string | null;
    fullName: string | null;
    zone: AmplitudeZone;
}
/**
 * Result of {@link performSignupOrAuth}. Extends {@link AmplitudeAuthResult}
 * with the user profile fetched inside the function, so callers can skip a
 * redundant `fetchAmplitudeUser` call.
 *
 * `userInfo` is:
 * - populated on the direct-signup success path when the internal fetch
 *   (with provisioning retry) succeeded
 * - `null` on the pending-sentinel path (internal fetch failed) — the
 *   caller is responsible for fetching userInfo itself in that case
 */
export type PerformSignupOrAuthResult = AmplitudeAuthResult & {
    userInfo: AmplitudeUserInfo | null;
    /**
     * Provisioning `dashboard_url` (browser magic link). May contain secrets —
     * do not log or emit on NDJSON.
     */
    dashboardUrl: string | null;
};
/**
 * Attempt direct signup via the headless provisioning endpoint.
 *
 * Returns the new account's tokens (and userInfo, when the internal fetch
 * succeeded) on success; returns `null` when:
 * - email or fullName is missing
 * - the endpoint returns `requires_redirect` / `needs_information` / `error`
 * - the direct-signup network call itself errors
 *
 * On success, also fetches the real user profile and persists the
 * `StoredUser` + tokens to `~/.ampli.json` so downstream
 * `resolveCredentials()` can populate `session.credentials` via the
 * standard path. Falls back to the `id:'pending'` sentinel if the
 * user fetch fails. The user fetch retries briefly on the "no env with
 * API key yet" case to absorb post-signup provisioning lag.
 *
 * This function does NOT fall back to `performAmplitudeAuth()`. Callers
 * that want OAuth fallback (e.g. the TUI path) must call it explicitly
 * when this returns null. Agent/CI modes typically skip OAuth and let
 * `resolveNonInteractiveCredentials` handle cached-token resolution.
 */
export declare function performSignupOrAuth(input: SignupOrAuthInput): Promise<PerformSignupOrAuthResult | null>;
