/** * AI Model selection — three-level resolution. * * The user can pick which Bedrock model handles their AI insights via * (in order of precedence): * * 1. `--model ` CLI flag * 2. `cdkInsights:aiModel` context entry in `cdk.json` * 3. `ai.model` field in `.cdk-insights.json` user config * 4. Server-side default (no modelId sent → backend picks) * * Aliases are friendly names like `mistral-14b` rather than raw Bedrock * IDs (`mistral.ministral-3-14b-instruct`); the resolver translates the * alias to the Bedrock ID on the way out so the wire format stays stable. * * Tier gating: each model is gated to one of `free` / `pro` / `team`. * If the resolved alias is above the user's tier, the resolver returns * the tier's default with a warning rather than failing — the analysis * still runs, just on a model the user is allowed to use. */ import type { Tier } from '../../config/featureGating'; export type AiModelAlias = 'nova-lite' | 'mistral-14b' | 'haiku-4-5' | 'sonnet-4-6'; export interface AiModelDefinition { /** Friendly alias used in flags and config */ alias: AiModelAlias; /** AWS Bedrock model identifier sent on the wire */ bedrockModelId: string; /** Human-readable name shown in CLI output */ displayName: string; /** Lowest tier that may select this model */ minTier: Tier; /** * Quota multiplier. A model with multiplier 2 deducts 2 insights per * call from the user's monthly quota. Keeps the per-insight unit cost * roughly aligned across the registry — Pro user's 5,000 insights can * be spent as 5K × Mistral or 1.25K × Haiku, their choice. */ quotaMultiplier: number; /** Short description for CLI help / model picker */ description: string; } export declare const AI_MODEL_REGISTRY: Record; export declare const TIER_DEFAULT_MODEL: Record; export declare const isAiModelAlias: (value: unknown) => value is AiModelAlias; export interface ResolveAiModelArgs { /** `--model` flag, if any */ flag?: string; /** `cdkInsights:aiModel` from cdk.json, if any */ cdkContext?: string; /** `ai.model` from .cdk-insights.json user config */ userConfig?: string; /** User's current tier — gates which models are allowed */ tier?: Tier; } export interface ResolvedAiModel { /** Resolved model alias */ alias: AiModelAlias; /** Bedrock ID to send on the wire */ bedrockModelId: string; /** Source of the resolution, for logging */ source: 'flag' | 'cdkContext' | 'userConfig' | 'tierDefault'; /** True if the user's preference was downgraded due to tier gating */ downgradedFromTierGate: boolean; /** Original alias the user tried to pick (only set when downgraded) */ requestedAlias?: AiModelAlias; } /** * Walk the resolution sources in precedence order, validate each candidate * against tier gating, and return the resolved model. Falls back to the * tier default (or `mistral-14b` if no tier supplied) when nothing matches. */ export declare const resolveAiModel: (args: ResolveAiModelArgs) => ResolvedAiModel; /** * Lists the models the given tier is allowed to use, sorted by min-tier * then by quota multiplier. Used by the CLI to render help text. */ export declare const getAvailableModelsForTier: (tier: Tier) => AiModelDefinition[];