/** * Model Registry - Provider Adapter Layer * * Maps "provider/model" strings to framework-compatible model runtimes. * The current implementation delegates to provider adapters while maintaining * control over the public API surface. * * Project-scoped: each project gets its own provider namespace. * Auto-initialized providers from env vars are shared across all projects * but resolve credentials lazily per-request via AsyncLocalStorage so each * project uses its own API keys. * * @module */ import type { ModelRuntime } from "./types.js"; /** Public API contract for model provider factory. */ export type ModelProviderFactory = (modelId: string) => ModelRuntime; export type ModelProviderRegistrationDisposer = () => void; /** * Register a custom model provider factory for the active project scope or * application bootstrap. * * Registration inside a project source context is isolated to that context. * Registration during application bootstrap, outside a project context, is a * default visible to every project unless the project registers an override. * * @example * ```ts * const unregister = registerModelProvider( * "custom", * (id) => createCustomRuntime(id), * ); * * // Call during teardown when the registration is no longer needed. * unregister(); * ``` */ export declare function registerModelProvider(name: string, factory: ModelProviderFactory): ModelProviderRegistrationDisposer; /** * Resolve a "provider/model" string to a framework-compatible model runtime. * * Auto-initializes providers from environment on first call. * * @example * ```ts * const model = resolveModel("openai/gpt-4o"); * ``` */ export declare function resolveModel(modelString: string): ModelRuntime; /** * Check whether a model provider is available in the current scope. * * Project overrides, application bootstrap defaults, and framework-provided * shared providers are all considered. */ export declare function hasModelProvider(name: string): boolean; /** * Get provider names available in the current scope. * * The result includes project overrides, application bootstrap defaults, and * framework-provided shared providers without duplicates. */ export declare function getRegisteredModelProviders(): string[]; /** * Eagerly verify that the resolved model's runtime is available. * * Provider runtimes can expose an idempotent `prepare()` hook to perform work * that must fail before an HTTP response stream is created. Runtimes without a * preparation phase require no action. */ export declare function ensureModelReady(model: ModelRuntime, abortSignal?: AbortSignal): Promise; /** Clear all registered model providers and reset lazy built-ins (for testing). */ export declare function clearModelProviders(): void; //# sourceMappingURL=model-registry.d.ts.map