/**
 * Bounded interactive Ricky CLI entry surface.
 *
 * Composes onboarding, local/BYOH execution, Cloud generation,
 * and runtime failure diagnosis into a single deterministic entrypoint.
 *
 * Design invariants:
 * - Local and Cloud paths are distinct and truthful — no silent fallback.
 * - Local failures surface runtime diagnosis guidance, not raw errors.
 * - Cloud failures surface bounded recovery guidance, not fake success.
 * - All side-effecting dependencies are injectable for deterministic tests.
 */
import type { OnboardingResult, RickyConfigStore } from '../cli/onboarding.js';
import type { RickyMode } from '../cli/mode-selector.js';
import type { CloudExecutor, CloudGenerateResult } from '../../../cloud/api/generate-endpoint.js';
import type { CloudGenerateRequest } from '../../../cloud/api/request-types.js';
import type { CloudWorkflowFlowDeps, CloudImplementationAgent, CloudOptionalIntegration } from '../flows/cloud-workflow-flow.js';
import type { CloudWorkflowSummary } from '../flows/workflow-summary.js';
import type { LocalWorkflowFlowDeps, LocalWorkflowFlowResult } from '../flows/local-workflow-flow.js';
import type { LocalExecutor, LocalResponse } from '../../../local/entrypoint.js';
import type { RawHandoff } from '../../../local/request-normalizer.js';
import type { Diagnosis, DiagnosticSignal } from '../../../runtime/diagnostics/failure-diagnosis.js';
import type { ConnectProviderOptions, ConnectProviderResult, StoredAuth } from '@agent-relay/cloud';
import type { ProviderStatus } from '../cli/mode-selector.js';
import { type PromptKit } from '../prompts/index.js';
import type { ClarificationQuestion } from '../../../product/spec-intake/index.js';
export interface InteractiveCliResult {
    /** Whether the interactive session completed without fatal errors. */
    ok: boolean;
    /** The resolved execution mode after onboarding. */
    mode: RickyMode;
    /** Onboarding output (banner, welcome, mode selection). */
    onboarding: OnboardingResult;
    /** Local execution result, if the local path was taken. */
    localResult?: LocalResponse;
    /** Cloud generation result, if the cloud path was taken. */
    cloudResult?: CloudGenerateResult;
    /** Guided Cloud readiness summary, if Cloud mode reached run confirmation. */
    cloudSummary?: CloudWorkflowSummary;
    /** Guided local workflow result, if local mode used the hand-holding flow. */
    localWorkflowResult?: LocalWorkflowFlowResult;
    /** Runtime diagnoses surfaced for local failures. */
    diagnoses: Diagnosis[];
    /** Recovery guidance lines surfaced to the user. */
    guidance: string[];
    /** True when Ricky only completed onboarding / mode selection and did not execute. */
    awaitingInput?: boolean;
}
export type ConnectToolChoice = 'cloud' | 'agents' | 'integrations';
export type RelayCloudConnectProvider = (options: ConnectProviderOptions) => Promise<ConnectProviderResult>;
export type RelayCloudAuthenticator = () => Promise<StoredAuth>;
export type CloudIntegrationConnectResult = {
    integration: CloudOptionalIntegration;
    status: 'link-opened' | 'link-created' | 'failed';
    url?: string;
    message?: string;
    endpoint?: string;
    statusCode?: number;
};
export type CloudIntegrationConnector = (integrations: CloudOptionalIntegration[]) => Promise<CloudIntegrationConnectResult[]>;
export interface InteractiveCliDeps extends CloudWorkflowFlowDeps {
    /** Onboarding runner — defaults to the real runOnboarding. */
    onboard?: (options: {
        input?: NodeJS.ReadableStream;
        output?: NodeJS.WritableStream;
        isTTY?: boolean;
        mode?: RickyMode;
        configStore?: RickyConfigStore;
        verbose?: boolean;
        signal?: AbortSignal;
    }) => Promise<OnboardingResult>;
    /** Caller workspace path for local artifact generation. Defaults to INIT_CWD or process.cwd(). */
    cwd?: string;
    /** Local executor for the BYOH path. */
    localExecutor?: LocalExecutor;
    /** Cloud executor for the hosted generation path. */
    cloudExecutor?: CloudExecutor;
    /** Diagnostic engine — defaults to the real diagnose function. */
    diagnoseFn?: (signal: DiagnosticSignal) => Diagnosis | null;
    /** The raw handoff to execute (spec, source, mode). */
    handoff?: RawHandoff;
    /** Whether a direct local handoff may ask dynamic clarification questions before retrying generation. */
    allowClarificationPrompts?: boolean;
    /** Optional injected clarification answer prompt for deterministic tests and alternate shells. */
    inputClarificationAnswer?: (input: {
        question: ClarificationQuestion;
        index: number;
        total: number;
    }) => Promise<string>;
    /** Cloud request context — required when mode is 'cloud'. */
    cloudRequest?: CloudGenerateRequest;
    /** Config store override for onboarding. */
    configStore?: RickyConfigStore;
    /** Provider status override for the compact first screen. */
    providerStatus?: ProviderStatus;
    /** Explicit mode override — skips interactive selection. */
    mode?: RickyMode;
    /** Overrides env/CLI derivation when tests inject Ricky-owned executors. */
    preferWorkforcePersonaWorkflowWriter?: undefined | boolean;
    /** Guided local prompt/runtime dependencies. Present only for interactive hand-holding mode. */
    localWorkflow?: Omit<LocalWorkflowFlowDeps, 'cwd' | 'runLocalFn'>;
    /** Optional injected prompt for Connect tools second-step selection. */
    selectConnectTools?: () => Promise<ConnectToolChoice[]>;
    /** Optional injected Inquirer prompt wrapper for deterministic prompt tests. */
    promptKit?: PromptKit;
    /** Optional injected prompt for selecting concrete optional integrations. */
    selectConnectIntegrations?: () => Promise<CloudOptionalIntegration[]>;
    /** Optional injected confirmation before launching Daytona-backed Cloud agent auth. */
    confirmCloudAgentProviderAuth?: (providers: CloudImplementationAgent[]) => Promise<boolean>;
    /** Optional injected Nango connect-link connector for Slack/GitHub/Notion/Linear. */
    connectCloudIntegrations?: CloudIntegrationConnector;
    /** Relay Cloud connector override for deterministic Connect tools tests. */
    connectProvider?: RelayCloudConnectProvider;
    /** Relay Cloud account login override for deterministic Connect tools tests. */
    ensureCloudAuthenticated?: RelayCloudAuthenticator;
    /** Cloud API URL override passed through to the Relay Cloud connector. */
    connectApiUrl?: string;
    /** Provider auth timeout override passed through to the Relay Cloud connector. */
    connectTimeoutMs?: number;
    /** Cloud auth reader override for deterministic guided Cloud tests. */
    readCloudAuth?: () => Promise<StoredAuth | null>;
    /** Cloud profile/workspace resolver override for deterministic guided Cloud tests. */
    resolveCloudWorkspace?: (auth: StoredAuth) => Promise<string | undefined>;
    /** Stream overrides for non-interactive / test contexts. */
    input?: NodeJS.ReadableStream;
    output?: NodeJS.WritableStream;
    isTTY?: boolean;
    verbose?: boolean;
    signal?: AbortSignal;
    /** Concise local-run progress updates for foreground CLI execution. */
    localProgress?: (message: string) => void;
    /**
     * Stop any active local-progress indicator (spinner) — called before
     * interactive prompts so they don't render underneath a still-spinning
     * spinner. Safe to call when no spinner is active.
     */
    localProgressStop?: () => void;
    /** Foreground local workflow stdout/stderr passthrough. */
    localRuntimeOutput?: (stream: 'stdout' | 'stderr', line: string) => void;
}
export declare function defaultCloudIntegrationConnector(integrations: CloudOptionalIntegration[]): Promise<CloudIntegrationConnectResult[]>;
/**
 * Run the interactive Ricky CLI session.
 *
 * 1. Runs onboarding (banner, welcome, mode selection).
 * 2. Based on the resolved mode, executes the local or cloud path.
 * 3. On local failure, surfaces runtime diagnosis guidance.
 * 4. On cloud failure, surfaces bounded recovery guidance.
 * 5. Returns a unified result contract.
 */
export declare function runInteractiveCli(deps?: InteractiveCliDeps): Promise<InteractiveCliResult>;
