import { appendEnv } from "../append-env.js";
import { AI_GATEWAY_API_KEY_ENV_VAR } from "../ai-gateway-api-key.js";
import type { Prompter, SelectOption } from "../prompter.js";
import { validateGatewayApiKey, type GatewayKeyValidation } from "../validate-gateway-key.js";
import { getVercelAuthStatus } from "../vercel-project.js";
import type { GatewayCredentialSource } from "#internal/resolve-model-endpoint-status.js";
import { runLinkFlow, type LinkFlowResult } from "./link.js";
export type ProviderConnection = "project" | "own-key" | "external";
/**
 * How the agent's model is backed right now, as far as the local directory
 * shows: a linked Vercel project, a gateway credential in an env file, or
 * nothing detectable. An external provider (own ANTHROPIC_API_KEY etc.)
 * leaves no marker eve owns, so it reads as `unset`.
 */
export type ModelProviderStatus = {
    kind: "unset";
} | {
    kind: "gateway-project";
    projectName: string;
    teamName?: string;
} | {
    kind: "gateway-key";
    envKey: typeof AI_GATEWAY_API_KEY_ENV_VAR | "VERCEL_OIDC_TOKEN";
    /** Where the credential lives — an env file, or the shell for a key. */
    source: GatewayCredentialSource;
};
export declare const PROVIDER_QUESTION = "Which model provider do you want to use?";
export declare const EXTERNAL_PROVIDER_INSTRUCTIONS_TITLE = "Using another model provider";
export declare const EXTERNAL_PROVIDER_INSTRUCTIONS: readonly string[];
/** Injected for tests; defaults to the real link flow, env write, and key check. */
export interface ProviderFlowDeps {
    getVercelAuthStatus: typeof getVercelAuthStatus;
    runLinkFlow: typeof runLinkFlow;
    appendEnv: typeof appendEnv;
    validateGatewayApiKey: typeof validateGatewayApiKey;
}
export type ProviderFlowResult = LinkFlowResult | {
    kind: "external-provider";
};
type AcceptedGatewayKeyValidation = Exclude<GatewayKeyValidation, {
    kind: "invalid";
}>;
/** A provider choice, including the accepted evidence for an inline key. */
export type ProviderPickerChoice = {
    kind: "project";
} | {
    kind: "external";
} | {
    kind: "inline-key";
    key: string;
    validation: AcceptedGatewayKeyValidation;
};
/** Private Dev TUI request for the provider's one-screen chooser. */
export interface ProviderPickerRequest {
    message: string;
    options: readonly SelectOption<ProviderConnection>[];
    initialValue: ProviderConnection;
    validateInlineKey(key: string, signal: AbortSignal): Promise<GatewayKeyValidation>;
}
/** Renderer-owned provider chooser; only the Dev TUI invokes this flow. */
export type ProviderPicker = (request: ProviderPickerRequest) => Promise<ProviderPickerChoice | undefined>;
/**
 * THE PROVIDER FLOW behind the dev TUI `/model` menu's provider row
 * (`eve link` keeps {@link runLinkFlow}'s shape). One question chooses a
 * project-backed AI Gateway connection, an `AI_GATEWAY_API_KEY`, or an
 * external provider. The project branch runs the link flow in create-or-link
 * mode, so a project-less agent can create its first project rather than
 * dead-end on an empty list.
 */
export declare function runProviderFlow(input: {
    appRoot: string;
    prompter: Prompter;
    signal?: AbortSignal;
    picker?: ProviderPicker;
    /** The detected provider, so the chooser can mark and describe the active row. */
    currentProvider?: ModelProviderStatus;
    deps?: Partial<ProviderFlowDeps>;
}): Promise<ProviderFlowResult>;
export {};
