import { z } from 'zod'; import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; import type { ModelCapability } from '../contract/capability'; import type { Model } from '../model/catalog'; import type { ResolvedLlmModel } from '../model/model-requester-impl'; import type { ProtocolBaseId, ResolvedAdapterIdentity } from './protocol-base'; export const ProtocolSchema = z.enum(['anthropic', 'openai', 'openai_responses', 'google-genai']); export type Protocol = z.infer; export interface ProtocolProviderOptions { readonly reasoningKey?: string; readonly defaultMaxTokens?: number; readonly supportEfforts?: readonly string[]; readonly offEffort?: string; readonly adaptiveThinking?: boolean; readonly betaApi?: boolean; readonly metadata?: Readonly>; readonly vertexai?: boolean; readonly project?: string; readonly location?: string; } export interface ProtocolAdapterConfig { readonly protocol: Protocol; readonly providerType?: string; readonly baseUrl?: string; readonly modelName: string; readonly apiKey?: string; readonly defaultHeaders?: Readonly>; readonly providerOptions?: ProtocolProviderOptions; } export interface IProtocolAdapterRegistry { readonly _serviceBrand: undefined; supportedProtocols(): readonly Protocol[]; resolveAdapterIdentity(protocol: Protocol, providerType?: string): ResolvedAdapterIdentity; resolveProviderBaseId(protocol: Protocol, providerType?: string): ProtocolBaseId; resolveCapability( protocol: Protocol, modelName: string, providerType?: string, ): ModelCapability; resolve(model: Model): ResolvedLlmModel; } export const IProtocolAdapterRegistry: ServiceIdentifier = createDecorator('protocolAdapterRegistry');