export const AI_MODEL_STAGES = ['analysis', 'copy', 'image'] as const export type AiModelStage = typeof AI_MODEL_STAGES[number] export const AI_MODEL_TEST_PURPOSES = ['analysis-copy', ...AI_MODEL_STAGES] as const export type AiModelTestPurpose = typeof AI_MODEL_TEST_PURPOSES[number] export function aiModelTestStages(purpose: AiModelTestPurpose): AiModelStage[] { return purpose === 'analysis-copy' ? ['analysis', 'copy'] : [purpose] } export type AiModelDefaults = Record export const AI_MODEL_KINDS = ['text', 'vision', 'image', 'tts', 'asr', 'music', 'video', 'embedding', 'image-tool', 'three-d', 'other', 'unknown'] as const export type AiModelKind = typeof AI_MODEL_KINDS[number] export interface AiModelVerificationSummary { status: 'untested' | 'running' | 'passed' | 'failed' | 'unknown' | 'stale' id: string | null checkedAt: string | null requestId: string | null message: string | null canResume?: boolean canReconcile?: boolean reconciled?: boolean taskId?: string | null submissionKey?: string purpose?: AiModelTestPurpose verifiedReferenceImageCount?: number } export interface AiModelCapabilities { kind: AiModelKind allowedStages: AiModelStage[] source: 'upstream' | 'verified' | 'unknown' reason: string protocols?: Partial }>> combinedTextTest?: boolean } export interface AiModelCatalogEntry { key: string id: string enabled: boolean stages: AiModelStage[] present: boolean verification: Record capabilities: AiModelCapabilities } export interface AiModelProvider { id: string name: string baseUrl: string enabled: boolean credentialSource: 'encrypted' | 'environment' hasApiKey: boolean revision: number syncedAt: string | null models: AiModelCatalogEntry[] } export interface AiModelAdminState { providers: AiModelProvider[] defaults: AiModelDefaults revision: number encryptionConfigured: boolean legacyAvailable: boolean submissionCheck?: { idempotencyKey: string; modelKey: string; stage: AiModelTestPurpose; received: boolean } } export interface AiModelConfigurationInput { revision: number defaults: AiModelDefaults providers: Array<{ id: string; revision: number; models: Array<{ key: string; enabled: boolean; stages: AiModelStage[] }> }> } export interface AiModelChoice { value: string; label: string; providerName: string } export interface AiModelRuntimeState { configured: boolean models: Record defaults: Record modelOptions: Record legacyModels: Record } export interface AiModelBinding { providerId: string; modelKey: string; modelId: string; providerName: string; baseUrl: string; revision: number; protocolFingerprint?: string; verificationId?: string } export type AiModelBindings = Record