export declare class WizardError extends Error {
    readonly context?: Record<string, unknown> | undefined;
    constructor(message: string, context?: Record<string, unknown> | undefined);
}
interface WizardAbortOptions {
    message?: string;
    error?: Error | WizardError;
    exitCode?: number;
    /**
     * Forwarded to {@link WizardUI.cancel} — surfaces a "Manual setup guide"
     * link in the Outro for cases like an unsupported framework version where
     * we want to point the user at docs to recover.
     */
    cancelOptions?: {
        docsUrl?: string;
    };
}
export declare function registerCleanup(fn: () => void): void;
/**
 * Register a cleanup that MUST run before any cleanup registered via the
 * regular `registerCleanup`. Use this for restorers that resurrect a
 * pre-run artifact (e.g. the previous setup report) which any later
 * cleanup might clobber by writing a fresh stub at the same canonical
 * path. Priority cleanups run in the order they were registered with
 * each other, but always before the FIFO queue.
 *
 * Ordering invariant: priority cleanups run first so the user's
 * pre-existing on-disk state is restored before any other cleanup
 * (which might write to the same paths) gets a chance to fire.
 */
export declare function registerPriorityCleanup(fn: () => void): void;
export declare function clearCleanup(): void;
/**
 * Graceful end-of-run exit for screens that have ALREADY shown their
 * own terminal UI (OutroScreen, McpScreen standalone, SlackScreen
 * standalone, LogoutScreen) and just need to shut down analytics and
 * exit.
 *
 * Sequence: cleanup -> emit run_completed -> analytics + Sentry flush
 * -> process.exit. NO `cancel()` UI step — the calling screen's
 * render is already on the terminal and we don't want to clobber it
 * with a second outro.
 *
 * Why this exists: every screen that called `process.exit(0)`
 * directly was firing a `wizardCapture('outro action', …)` (or
 * similar) and then immediately tearing down the process — the
 * analytics event got enqueued AFTER any prior flush and was
 * silently dropped. Routing through this helper guarantees the
 * trailing event makes it out.
 *
 * Use {@link wizardAbort} for FAILURE paths (it shows the error
 * outro). Use this for SUCCESS / user-initiated graceful exits where
 * the screen's own UI is the user-facing message.
 */
export declare function wizardSuccessExit(exitCode?: number): Promise<never>;
/**
 * Returns the wizard-wide AbortController, creating it on first access.
 * Consumers should pass `getWizardAbortController().signal` into any
 * abortable async API (fetch, agent SDK query, etc.) so a single abort
 * call from the SIGINT / Ctrl+C handler unwinds every in-flight operation.
 */
export declare function getWizardAbortController(): AbortController;
/**
 * Convenience: returns the wizard-wide abort signal. Equivalent to
 * `getWizardAbortController().signal` but reads more naturally at call sites
 * that just need the signal (e.g. `fetch(url, { signal: getWizardAbortSignal() })`).
 */
export declare function getWizardAbortSignal(): AbortSignal;
/**
 * Abort the wizard-wide controller. Idempotent — calling on an already-aborted
 * controller is a no-op. Use from graceful-exit / SIGINT handlers to cancel
 * every in-flight async operation in one shot.
 */
export declare function abortWizard(reason?: string): void;
/**
 * Reset the wizard-wide controller. Test-only — production runs are
 * one-shot processes so there's no need to reset between runs.
 */
export declare function resetWizardAbortController(): void;
export declare function isWizardAbortInProgress(): boolean;
/**
 * Test-only — production runs are one-shot processes that exit at the
 * end of `wizardAbort`, so the flag never needs to be reset. Tests that
 * mock `process.exit` (so `wizardAbort` returns instead of terminating)
 * must call this between cases or the flag leaks across the suite.
 */
export declare function _resetWizardAbortInProgressForTests(): void;
export declare function wizardAbort(options?: WizardAbortOptions): Promise<never>;
export {};
