import type { AIModelInsert, AIModelRow } from '../ai-model.schema'; import { type AIProviderInsert, type AIProviderRow } from '../ai-provider.schema'; import type { CredentialInsert, CredentialRow } from '../credential.schema'; export interface AIConfigProviderCatalogEntry { id: string; displayName: string; aliases?: string[]; defaultBaseUrl?: string; defaultModels?: string[]; defaultModelType?: string; } export interface AIConfigModel { id: string; name: string; enabled: boolean; capabilities: string[]; modelType?: string; isCustom?: boolean; } export interface AIConfigProviderState { id: string; enabled: boolean; apiKey?: string; baseUrl?: string; credentialId?: string; credentialLabel?: string; credentialIsDefault?: boolean; models: AIConfigModel[]; selectedModelId?: string; } export interface AIConfigUpdate { enabled?: boolean; apiKey?: string; baseUrl?: string; supportsBackend?: string; rotationPolicy?: string; credentialId?: string; credentialLabel?: string; credentialBaseUrl?: string; models?: AIConfigModel[]; } export interface BuildAIConfigProviderStateMapOptions { catalog?: readonly AIConfigProviderCatalogEntry[]; providerRows: Array & Record>; credentialRows: Array & Record>; modelRows: Array & Record>; fallbackToCatalogModels?: boolean; } export interface AIConfigCredentialSelection { providerId: string; credential: Partial & Record; credentialId?: string; credentialLabel?: string; apiKey: string; baseUrl?: string; proxyUrl?: string; isDefault: boolean; } export interface AIConfigBackendCredentialSelection extends AIConfigCredentialSelection { backend: string; } export interface AIConfigMutationPlan { providerId: string; providerPayload?: AIProviderInsert; credentialPayload?: CredentialInsert; modelUpserts: AIModelInsert[]; modelDeleteIds: string[]; } export interface AIConfigDisconnectPlan { providerId: string; credentialDeleteIds: string[]; } export declare const UNDEFINEDS_AI_PROVIDER_ID = "undefineds"; export declare const UNDEFINEDS_AI_PROVIDER_DISPLAY_NAME = "undefineds"; export declare const UNDEFINEDS_AI_BASE_URL = "https://api.undefineds.co/v1"; export declare const LINX_LITE_MODEL_ID = "linx-lite"; export declare const LINX_MODEL_ID = "linx"; export declare const DEFAULT_LINX_MODEL_ID = "linx-lite"; export declare const UNDEFINEDS_AI_MODEL_IDS: readonly ["linx-lite", "linx"]; interface AIConfigRepositoryDb { select(): { from(resource: unknown): { execute(): Promise; }; }; findById(resource: unknown, id: string): Promise; updateById(resource: unknown, id: string, data: Record): Promise; } export declare function getAIConfigProviderCatalog(): readonly AIConfigProviderCatalogEntry[]; export declare function getAIConfigProviderMetadata(providerId: string): AIConfigProviderCatalogEntry; export declare function normalizeAIConfigResourceId(raw?: string | null): string; export declare function normalizeAIConfigModelId(raw?: string | null, providerId?: string | null): string; export declare function normalizeAIConfigProviderId(raw?: string | null): string; export declare function sameAIConfigProviderFamily(left?: string | null, right?: string | null): boolean; export declare function getAIConfigProviderFamilyIds(providerId: string): string[]; export declare function getAIConfigProviderIdsForBackend(backend: string): string[]; export declare function getAIConfigDefaultBaseUrl(providerId: string): string | undefined; export declare function createAIConfigCredentialId(): string; export declare function aiConfigProviderRef(providerId: string): string; export declare function aiConfigModelRef(providerId: string, modelId?: string): string; export declare function selectAIConfigCredential(providerId: string, credentialRows: Array & Record>, providerRows?: Array & Record>, options?: { rotationPolicy?: string; }): AIConfigCredentialSelection | undefined; export declare function selectAIConfigCredentialForBackend(backend: string, credentialRows: Array & Record>, providerRows?: Array & Record>): AIConfigBackendCredentialSelection | undefined; export declare const aiConfigRepository: { loadCredentialForBackend(db: AIConfigRepositoryDb, backend: string): Promise; markCredentialUsed(db: AIConfigRepositoryDb, selection: Pick | undefined, usedAt?: Date): Promise; }; export declare function aiConfigProviderUri(providerId: string): string; export declare function aiConfigModelUri(modelId: string, providerId?: string): string; export declare function buildAIConfigProviderStateMap(options: BuildAIConfigProviderStateMapOptions): Record; export declare function buildAIConfigMutationPlan(input: { providerId: string; currentProviderRows: Array & Record>; currentCredentialRows: Array & Record>; currentModelRows: Array & Record>; updates: AIConfigUpdate; }): AIConfigMutationPlan; export declare function buildAIConfigDisconnectPlan(input: { providerId: string; currentCredentialRows: Array & Record>; }): AIConfigDisconnectPlan; export {};