@mastra/core
Version:
1 lines • 100 kB
Source Map (JSON)
{"version":3,"file":"provider-registry-Da4zkpBA.cjs","names":["GATEWAY_AUTH_HEADER","MASTRA_USER_AGENT","MastraModelGateway","MastraError","createAnthropic","createOpenRouter","staticRegistryJson","shouldEnableGateway","getGatewayId","createRequire","ModelsDevGateway","NetlifyGateway","getCapabilityFileName","shouldWriteToSrc"],"sources":["../src/llm/model/gateways/mastra.ts","../src/llm/model/provider-registry.json","../src/llm/model/provider-registry.ts"],"sourcesContent":["import { createAnthropic } from '@ai-sdk/anthropic-v6';\nimport { createOpenRouter } from '@openrouter/ai-sdk-provider-v6';\nimport { MastraError } from '../../../error/index.js';\nimport { PROVIDER_REGISTRY } from '../provider-registry.js';\nimport { MastraModelGateway } from './base.js';\nimport type { ProviderConfig, GatewayLanguageModel } from './base.js';\nimport { GATEWAY_AUTH_HEADER, MASTRA_USER_AGENT } from './constants.js';\n\nexport interface MastraGatewayConfig {\n apiKey?: string;\n baseUrl?: string;\n customFetch?: typeof globalThis.fetch;\n}\n\n/**\n * Builds the headers for the OAuth gateway paths. The gateway credential lives in a reserved\n * internal header, so caller-provided headers must not be able to replace it — including via a\n * differently-cased spelling, since HTTP header names are case-insensitive.\n */\nfunction withGatewayAuthHeader(apiKey: string, headers?: Record<string, string>): Record<string, string> {\n const reserved = GATEWAY_AUTH_HEADER.toLowerCase();\n const result: Record<string, string> = { 'User-Agent': MASTRA_USER_AGENT };\n for (const [key, value] of Object.entries(headers ?? {})) {\n if (key.toLowerCase() === reserved) continue;\n result[key] = value;\n }\n result[GATEWAY_AUTH_HEADER] = `Bearer ${apiKey}`;\n return result;\n}\n\n/**\n * Whether the Gateway serves Observational Memory for a given API key.\n *\n * Gateway keys come in two shapes with different memory behaviour:\n * - project keys (`msk_…`) are served with server-side Observational Memory;\n * - organization keys (`msk-gateway-…`, `mskv2_…`) are served by a gateway without\n * the memory API, so memory has to stay local.\n *\n * Anything unrecognised (including a missing key) reports `false`: memory is never\n * assumed to be handled remotely unless the key says so.\n */\nexport function gatewayServesObservationalMemory(apiKey: string | undefined): boolean {\n if (typeof apiKey !== 'string' || apiKey.length === 0) return false;\n if (apiKey.startsWith('msk-gateway-') || apiKey.startsWith('mskv2_')) return false;\n return apiKey.startsWith('msk_');\n}\n\nexport class MastraGateway extends MastraModelGateway {\n readonly id = 'mastra';\n readonly name = 'Gateway';\n\n constructor(private config?: MastraGatewayConfig) {\n super();\n }\n\n private getBaseUrl(): string {\n const raw = this.config?.baseUrl ?? process.env['MASTRA_GATEWAY_URL'] ?? 'https://gateway-api.mastra.ai';\n // Trim trailing slashes with a loop; the equivalent /\\/+$/ regex is quadratic on long runs of '/'.\n let end = raw.length;\n while (end > 0 && raw[end - 1] === '/') end--;\n return raw.slice(0, end).replace(/\\/v1$/, '');\n }\n\n override shouldEnable(): boolean {\n return !!(this.config?.apiKey ?? process.env['MASTRA_GATEWAY_API_KEY']);\n }\n\n /**\n * Gateway v2 deployments are signaled by MASTRA_GATEWAY_VERSION=v2 (set by the platform)\n * or by a v2 (organization) API key prefix, which predates the env var signal.\n * Keep in sync with isGatewayV2 in @mastra/server's gateway-memory-client.\n * Public so the server can ask a registered gateway instance for its\n * effective v2 state (the instance may carry a v2 key via config.apiKey\n * that env-only checks cannot see).\n */\n isV2(): boolean {\n if (process.env['MASTRA_GATEWAY_VERSION'] === 'v2') return true;\n const key = this.config?.apiKey ?? process.env['MASTRA_GATEWAY_API_KEY'];\n return !!key && (key.startsWith('msk-gateway-') || key.startsWith('mskv2_'));\n }\n\n async fetchProviders(): Promise<Record<string, ProviderConfig>> {\n const isV2 = this.isV2();\n const openrouterConfig = PROVIDER_REGISTRY['openrouter'];\n let models = openrouterConfig?.models ?? [];\n if (isV2) {\n const apiKey = await this.getApiKey();\n const response = await (this.config?.customFetch ?? fetch)(`${this.getBaseUrl()}/v1/models`, {\n headers: this.config?.customFetch ? withGatewayAuthHeader(apiKey) : { Authorization: `Bearer ${apiKey}` },\n signal: AbortSignal.timeout(10_000),\n });\n if (!response.ok) throw new Error(`Gateway model catalog unavailable (${response.status})`);\n const body: unknown = await response.json();\n if (!body || typeof body !== 'object' || !('data' in body) || !Array.isArray(body.data)) {\n throw new Error('Gateway model catalog has an invalid response');\n }\n // The Mastra gateway model uses the OpenAI-compatible chat transport.\n // Models offered only through another endpoint cannot be selected here.\n models = body.data\n .filter(\n (item): item is { id: string; endpoints: string[] } =>\n !!item &&\n typeof item === 'object' &&\n typeof item.id === 'string' &&\n Array.isArray(item.endpoints) &&\n item.endpoints.includes('chat'),\n )\n .map(item => item.id);\n }\n\n const providers = {\n mastra: {\n apiKeyEnvVar: 'MASTRA_GATEWAY_API_KEY',\n apiKeyHeader: 'Authorization',\n name: 'Gateway',\n gateway: 'mastra',\n models: [...models],\n // Static release dates describe the bundled registry, not the live v2 catalog.\n modelReleaseDates: isV2 ? undefined : openrouterConfig?.modelReleaseDates,\n docUrl: 'https://mastra.ai/docs/gateway',\n },\n };\n\n return providers;\n }\n\n async buildUrl(_modelId: string): Promise<string> {\n return `${this.getBaseUrl()}/v1`;\n }\n\n async getApiKey(): Promise<string> {\n const apiKey = this.config?.apiKey ?? process.env['MASTRA_GATEWAY_API_KEY'];\n if (!apiKey) {\n throw new MastraError({\n id: 'MASTRA_GATEWAY_NO_API_KEY',\n domain: 'LLM',\n category: 'UNKNOWN',\n text: 'Missing MASTRA_GATEWAY_API_KEY environment variable',\n });\n }\n return apiKey;\n }\n\n resolveLanguageModel({\n modelId,\n providerId,\n apiKey,\n headers,\n }: {\n modelId: string;\n providerId: string;\n apiKey: string;\n headers?: Record<string, string>;\n }): GatewayLanguageModel {\n const baseURL = `${this.getBaseUrl()}/v1`;\n const fullModelId = `${providerId}/${modelId}`;\n\n if (this.config?.customFetch && providerId === 'anthropic') {\n // Anthropic OAuth path: use native Anthropic SDK (sends /messages, not /chat/completions)\n return createAnthropic({\n apiKey: 'oauth-gateway-placeholder',\n baseURL,\n headers: withGatewayAuthHeader(apiKey, headers),\n fetch: this.config.customFetch as any,\n })(modelId) as unknown as GatewayLanguageModel;\n }\n\n if (this.config?.customFetch) {\n // Non-Anthropic OAuth path: gateway key in GATEWAY_AUTH_HEADER, customFetch owns Authorization\n return createOpenRouter({\n apiKey: 'oauth-gateway-placeholder',\n baseURL,\n headers: withGatewayAuthHeader(apiKey, headers),\n fetch: this.config.customFetch,\n }).chat(fullModelId) as unknown as GatewayLanguageModel;\n }\n\n // API key path: gateway key goes via Authorization (standard flow)\n return createOpenRouter({\n apiKey,\n baseURL,\n headers: {\n 'User-Agent': MASTRA_USER_AGENT,\n ...headers,\n },\n }).chat(fullModelId) as unknown as GatewayLanguageModel;\n }\n}\n","","/**\n * Runtime provider registry loader\n * Loads provider data from JSON file and exports typed interfaces\n */\n\nimport fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport os from 'node:os';\nimport path from 'node:path';\nimport type { Provider, ModelForProvider, ModelRouterModelId } from '../index.js';\nimport { getCapabilityFileName } from './capability-file.js';\nimport type { ProviderCapabilityFile } from './capability-file.js';\nimport type { ModelReasoningOption, ProviderConfig, MastraModelGatewayInterface } from './gateways/base.js';\nimport { getGatewayId, shouldEnableGateway } from './gateways/gateway-helpers.js';\nimport { MastraGateway } from './gateways/mastra.js';\nimport { ModelsDevGateway } from './gateways/models-dev.js';\nimport { NetlifyGateway } from './gateways/netlify.js';\nimport staticRegistryJson from './provider-registry.json';\n// Sourced from the package entry point so that `ProviderModelsMap` augmentations\n// declared against `@mastra/core/llm` flow into these derived types.\nimport type { ProviderModels } from './provider-types.generated.js';\n\n// Re-export types for convenience\nexport type { Provider, ModelForProvider, ModelRouterModelId, ProviderModels };\nexport type { AttachmentCapabilities, ModelReasoningOption } from './gateways/base.js';\n\ninterface RegistryData {\n providers: Record<string, ProviderConfig>;\n models: Record<string, string[]>;\n version: string;\n}\n\n// JSON imports widen string literals to `string`, so fields like\n// `modelOverrides[*].shape` don't match their literal-union types.\nconst staticRegistry = staticRegistryJson as RegistryData;\n\n/**\n * Check if running in offline/air-gapped mode.\n * When MASTRA_OFFLINE is set to 'true' or '1', all network fetches for provider data are skipped.\n */\nexport function isOfflineMode(): boolean {\n const value = process.env.MASTRA_OFFLINE;\n return value === 'true' || value === '1';\n}\n\nfunction getEnabledGatewayIds(gateways: MastraModelGatewayInterface[]): Set<string> {\n const enabledGatewayIds = new Set<string>();\n\n for (const gateway of gateways) {\n const enabled = shouldEnableGateway(gateway);\n if (enabled) {\n enabledGatewayIds.add(getGatewayId(gateway));\n }\n }\n\n return enabledGatewayIds;\n}\n\nfunction sanitizeRegistryDataForRuntime(data: RegistryData, enabledGatewayIds: Set<string>): RegistryData {\n const providers = Object.fromEntries(\n Object.entries(data.providers).filter(([, config]) => enabledGatewayIds.has(config.gateway)),\n );\n\n const models = Object.fromEntries(Object.entries(data.models).filter(([providerId]) => providerId in providers));\n\n return {\n ...data,\n providers,\n models,\n };\n}\n\n// In-memory cache for dynamic loading mode\nlet registryData: RegistryData | null = null;\n\n// Cache file helpers (dev mode only)\n// Use functions so we don't call os.homedir() at top level, which\n// causes an error in sandboxed environments when you merely\n// import @mastra/core. In those sandboxes, if you just don't use these\n// functions then you don't hit these errors.\nconst CACHE_DIR = () => path.join(os.homedir(), '.cache', 'mastra');\nconst CACHE_FILE = () => path.join(CACHE_DIR(), 'gateway-refresh-time');\nconst GLOBAL_PROVIDER_REGISTRY_JSON = () => path.join(CACHE_DIR(), 'provider-registry.json');\nconst GLOBAL_PROVIDER_TYPES_DTS = () => path.join(CACHE_DIR(), 'provider-types.generated.d.ts');\nconst GLOBAL_CAPABILITIES_DIR = () => path.join(CACHE_DIR(), 'capabilities');\n\nlet modelRouterCacheFailed = false;\n\n/**\n * Write a file atomically using the write-to-temp-then-rename pattern (synchronous version).\n * This prevents file corruption when multiple processes write to the same file concurrently.\n *\n * @param filePath - The target file path\n * @param content - The content to write\n * @param encoding - The encoding to use (default: 'utf-8')\n */\nfunction atomicWriteFileSync(filePath: string, content: string, encoding: BufferEncoding = 'utf-8'): void {\n // Use random suffix to avoid collisions between concurrent writes\n const randomSuffix = Math.random().toString(36).substring(2, 15);\n const tempPath = `${filePath}.${process.pid}.${Date.now()}.${randomSuffix}.tmp`;\n\n try {\n fs.writeFileSync(tempPath, content, encoding);\n fs.renameSync(tempPath, filePath);\n } catch (error) {\n try {\n fs.unlinkSync(tempPath);\n } catch {\n // Ignore cleanup errors\n }\n throw error;\n }\n}\n\n/**\n * Syncs provider files from global cache to local dist/ directory if needed.\n * Compares file contents to determine if copy is necessary.\n * Validates JSON before copying to prevent propagating corrupted files.\n */\nfunction syncGlobalCacheToLocal(): void {\n try {\n // Check if global cache files exist\n const globalJsonExists = fs.existsSync(GLOBAL_PROVIDER_REGISTRY_JSON());\n const globalDtsExists = fs.existsSync(GLOBAL_PROVIDER_TYPES_DTS());\n\n if (!globalJsonExists && !globalDtsExists) {\n // No global cache, nothing to sync\n return;\n }\n\n // Use getPackageRoot() to find the correct location in node_modules or local dev\n const packageRoot = getPackageRoot();\n const localJsonPath = path.join(packageRoot, 'dist', 'provider-registry.json');\n const localDtsPath = path.join(packageRoot, 'dist', 'llm', 'model', 'provider-types.generated.d.ts');\n\n // Ensure local dist directory exists\n fs.mkdirSync(path.dirname(localJsonPath), { recursive: true });\n fs.mkdirSync(path.dirname(localDtsPath), { recursive: true });\n\n // Sync JSON file if global exists and differs from local\n if (globalJsonExists) {\n const globalJsonContent = fs.readFileSync(GLOBAL_PROVIDER_REGISTRY_JSON(), 'utf-8');\n\n // Validate JSON before copying to prevent propagating corrupted files.\n // Silently delete on corruption — the next gateway sync will rewrite a\n // valid file, so logging here just creates noise when an older mastra\n // version (without the digit-quoting fix) shares the global cache.\n try {\n JSON.parse(globalJsonContent);\n } catch {\n try {\n fs.unlinkSync(GLOBAL_PROVIDER_REGISTRY_JSON());\n } catch {\n // Ignore deletion errors\n }\n return;\n }\n\n let shouldCopyJson = true;\n\n if (fs.existsSync(localJsonPath)) {\n const localJsonContent = fs.readFileSync(localJsonPath, 'utf-8');\n shouldCopyJson = globalJsonContent !== localJsonContent;\n }\n\n if (shouldCopyJson) {\n // Use atomic write to prevent corruption from concurrent writes\n atomicWriteFileSync(localJsonPath, globalJsonContent, 'utf-8');\n }\n }\n\n // Capabilities are loaded lazily per-provider by loadProviderAttachmentModels().\n // The global cache dir is included in findCapabilitiesDirs() so no bulk sync is needed.\n\n // Sync .d.ts file if global exists and differs from local\n if (globalDtsExists) {\n const globalDtsContent = fs.readFileSync(GLOBAL_PROVIDER_TYPES_DTS(), 'utf-8');\n\n // Validate .d.ts content: check for unquoted provider names that start with a digit\n // (e.g. \"readonly 302ai:\" instead of \"readonly '302ai':\"), which produces invalid TypeScript.\n // This can happen if the global cache was written by an older version without the quoting fix.\n // Silently delete on corruption — the next gateway sync will rewrite a valid file.\n if (/readonly\\s+\\d/.test(globalDtsContent)) {\n try {\n fs.unlinkSync(GLOBAL_PROVIDER_TYPES_DTS());\n } catch {\n // Ignore deletion errors\n }\n // Don't sync corrupted .d.ts file; fall through to keep existing local file\n } else {\n let shouldCopyDts = true;\n\n if (fs.existsSync(localDtsPath)) {\n const localDtsContent = fs.readFileSync(localDtsPath, 'utf-8');\n shouldCopyDts = globalDtsContent !== localDtsContent;\n }\n\n if (shouldCopyDts) {\n // Use atomic write to prevent corruption from concurrent writes\n atomicWriteFileSync(localDtsPath, globalDtsContent, 'utf-8');\n }\n }\n }\n } catch {\n // Silent fail - fall back to existing files. Sync errors are recoverable\n // on the next call and don't need to be surfaced to users.\n }\n}\n\nfunction getLastRefreshTimeFromDisk(): Date | null {\n try {\n if (!fs.existsSync(CACHE_FILE())) {\n return null;\n }\n const timestamp = fs.readFileSync(CACHE_FILE(), 'utf-8').trim();\n return new Date(parseInt(timestamp, 10));\n } catch (err) {\n console.warn('[GatewayRegistry] Failed to read cache file:', err);\n modelRouterCacheFailed = true;\n return null;\n }\n}\n\nfunction saveLastRefreshTimeToDisk(date: Date): void {\n try {\n if (!fs.existsSync(CACHE_DIR())) {\n fs.mkdirSync(CACHE_DIR(), { recursive: true });\n }\n fs.writeFileSync(CACHE_FILE(), date.getTime().toString(), 'utf-8');\n } catch (err) {\n modelRouterCacheFailed = true;\n console.warn('[GatewayRegistry] Failed to write cache file:', err);\n }\n}\n\nfunction getPackageRoot(): string {\n try {\n // Use require.resolve to find the package root reliably\n const require = createRequire(import.meta.url || 'file://');\n const packageJsonPath = require.resolve('@mastra/core/package.json');\n return path.dirname(packageJsonPath);\n } catch {\n // Fallback to cwd if we can't resolve the package\n return process.cwd();\n }\n}\n\nfunction loadRegistry(useDynamicLoading: boolean, customGateways: MastraModelGatewayInterface[] = []): RegistryData {\n const enabledGatewayIds = getEnabledGatewayIds([\n new ModelsDevGateway({}),\n new NetlifyGateway(),\n new MastraGateway(),\n ...customGateways,\n ]);\n\n // Production: use static import (bundled at build time)\n if (!useDynamicLoading) {\n return sanitizeRegistryDataForRuntime(staticRegistry, enabledGatewayIds);\n }\n\n // Dynamic loading mode: check in-memory cache first. The registry proxy calls this on every\n // property access, so the disk sync below must only run when the data actually gets (re)loaded.\n // In-process refreshes reset registryData, so they still sync and reload.\n if (registryData) {\n return registryData;\n }\n\n // Dynamic loading mode: sync global cache to local before loading\n syncGlobalCacheToLocal();\n\n // Dynamic loading mode: load from file system for live updates\n const packageRoot = getPackageRoot();\n const possiblePaths: string[] = [\n // Built: in dist/ relative to package root (first priority - what gets distributed)\n path.join(packageRoot, 'dist', 'provider-registry.json'),\n // Development: in src/ relative to package root\n path.join(packageRoot, 'src', 'llm', 'model', 'provider-registry.json'),\n // Fallback: relative to cwd (for monorepo setups)\n path.join(process.cwd(), 'packages/core/src/llm/model/provider-registry.json'),\n path.join(process.cwd(), 'src/llm/model/provider-registry.json'),\n ];\n\n const errors: string[] = [];\n\n for (const jsonPath of possiblePaths) {\n try {\n const content = fs.readFileSync(jsonPath, 'utf-8');\n const parsed = JSON.parse(content) as RegistryData;\n registryData = sanitizeRegistryDataForRuntime(parsed, enabledGatewayIds);\n return registryData;\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : String(err);\n errors.push(`${jsonPath}: ${errorMessage}`);\n\n // If the file exists but has corrupted JSON (not ENOENT), delete it and fall back to static registry\n // This handles cases where concurrent writes corrupted the file before the atomic write fix\n const isFileNotFound = err instanceof Error && 'code' in err && (err as NodeJS.ErrnoException).code === 'ENOENT';\n const isJsonParseError = err instanceof SyntaxError;\n\n if (!isFileNotFound && isJsonParseError) {\n console.warn(\n `[GatewayRegistry] Detected corrupted provider-registry.json at ${jsonPath}. ` +\n `Deleting corrupted file and falling back to static registry.`,\n );\n try {\n fs.unlinkSync(jsonPath);\n } catch {\n // Ignore deletion errors\n }\n // Fall back to static registry (bundled at build time)\n registryData = sanitizeRegistryDataForRuntime(staticRegistry, enabledGatewayIds);\n return registryData;\n }\n\n continue;\n }\n }\n\n // If all paths failed, fall back to static registry instead of throwing\n // This provides a more graceful degradation\n console.warn(\n `[GatewayRegistry] Could not load provider registry from any path. Falling back to static registry.\\n` +\n `Tried paths:\\n${errors.join('\\n')}`,\n );\n registryData = sanitizeRegistryDataForRuntime(staticRegistry, enabledGatewayIds);\n return registryData;\n}\n\n// Export registry data via Proxy for lazy loading\nexport const PROVIDER_REGISTRY = new Proxy({} as Record<string, ProviderConfig>, {\n get(_target, prop: string) {\n const registry = GatewayRegistry.getInstance();\n const providers = registry.getProviders();\n return providers[prop];\n },\n ownKeys() {\n const registry = GatewayRegistry.getInstance();\n const providers = registry.getProviders();\n return Object.keys(providers);\n },\n has(_target, prop: string) {\n const registry = GatewayRegistry.getInstance();\n const providers = registry.getProviders();\n return prop in providers;\n },\n getOwnPropertyDescriptor(_target, prop) {\n const registry = GatewayRegistry.getInstance();\n const providers = registry.getProviders();\n if (prop in providers) {\n return {\n enumerable: true,\n configurable: true,\n };\n }\n return undefined;\n },\n}) as Record<Provider, ProviderConfig>;\n\nexport const PROVIDER_MODELS = new Proxy({} as ProviderModels, {\n get(_target, prop: string) {\n const registry = GatewayRegistry.getInstance();\n const models = registry.getModels();\n return models[prop];\n },\n ownKeys() {\n const registry = GatewayRegistry.getInstance();\n const models = registry.getModels();\n return Object.keys(models);\n },\n has(_target, prop: string) {\n const registry = GatewayRegistry.getInstance();\n const models = registry.getModels();\n return prop in models;\n },\n getOwnPropertyDescriptor(_target, prop) {\n const registry = GatewayRegistry.getInstance();\n const models = registry.getModels();\n if (prop in models) {\n return {\n enumerable: true,\n configurable: true,\n };\n }\n return undefined;\n },\n});\n\n/**\n * Parse a model string to extract provider and model ID\n * Examples:\n * \"openai/gpt-4o\" -> { provider: \"openai\", modelId: \"gpt-4o\" }\n * \"fireworks/accounts/etc/model\" -> { provider: \"fireworks\", modelId: \"accounts/etc/model\" }\n * \"gpt-4o\" -> { provider: null, modelId: \"gpt-4o\" }\n */\nexport function parseModelString(modelString: string): { provider: string | null; modelId: string } {\n const firstSlashIndex = modelString.indexOf('/');\n\n if (firstSlashIndex !== -1) {\n // Has at least one slash - extract everything before first slash as provider\n const provider = modelString.substring(0, firstSlashIndex);\n const modelId = modelString.substring(firstSlashIndex + 1);\n\n if (provider && modelId) {\n return {\n provider,\n modelId,\n };\n }\n }\n\n // No slash or invalid format\n return {\n provider: null,\n modelId: modelString,\n };\n}\n\n/**\n * Get provider configuration by provider ID\n */\nexport function getProviderConfig(providerId: string): ProviderConfig | undefined {\n const registry = GatewayRegistry.getInstance();\n return registry.getProviderConfig(providerId);\n}\n\n/**\n * Check if a provider is registered\n */\nexport function isProviderRegistered(providerId: string): boolean {\n const registry = GatewayRegistry.getInstance();\n return registry.isProviderRegistered(providerId);\n}\n\n/**\n * Get all registered provider IDs\n */\nexport function getRegisteredProviders(): string[] {\n const registry = GatewayRegistry.getInstance();\n const providers = registry.getProviders();\n return Object.keys(providers);\n}\n\n// ---------------------------------------------------------------------------\n// Provider capabilities (per-model attachment / modality metadata)\n// ---------------------------------------------------------------------------\n\ntype CapabilityDimension = 'attachment' | 'temperature' | 'structuredOutput';\n\nconst providerCapCaches: Record<CapabilityDimension, Map<string, string[] | null>> = {\n attachment: new Map(),\n temperature: new Map(),\n structuredOutput: new Map(),\n};\n\nconst capabilityOverrides: Partial<Record<CapabilityDimension, Record<string, boolean>>> = {\n // DeepSeek's native endpoint rejects response_format for this routed model even\n // though models.dev currently reports structured_output support.\n structuredOutput: {\n 'deepseek/deepseek-v4-pro': false,\n },\n temperature: {\n // Bedrock-hosted grok-4.6 rejects `temperature` (HTTP 400 \"This model doesn't\n // support the temperature field\"), even though direct xai (`xai/grok-4.6`) accepts\n // it. Bedrock diverges from the underlying vendor here, so the vendor fallback below\n // is not enough — pin it explicitly. See mastra-ai/mastra#23319.\n 'aws-bedrock/grok-4.6': false,\n },\n};\n\n/**\n * AI SDK provider ids that differ from this registry's provider keys. Provider instances\n * (e.g. `@ai-sdk/amazon-bedrock`) expose their own `provider` string, which we map onto\n * the capability-file provider key before resolving.\n */\nconst PROVIDER_ALIASES: Record<string, string> = {\n 'amazon-bedrock': 'aws-bedrock',\n};\n\n/** Bedrock model-id region prefixes (cross-region inference profiles). */\nconst BEDROCK_REGION_PREFIX = /^(global|us-gov|us|eu|apac|jp|au|in)\\./;\n\n/** Underlying vendor segment carried by fully-qualified Bedrock model ids. */\nconst BEDROCK_VENDOR_SEGMENT =\n /^(?!openai\\.gpt-oss-)(anthropic|xai|meta|amazon|cohere|mistral|ai21|deepseek|openai)\\.(.+)$/;\n\n/** Fallback vendor lookup for short Bedrock ids (`claude-sonnet-5`) that omit the vendor. */\nconst BEDROCK_VENDOR_BY_PREFIX: Array<[RegExp, string]> = [\n [/^claude/, 'anthropic'],\n [/^grok/, 'xai'],\n [/^llama/, 'meta'],\n [/^(nova|titan)/, 'amazon'],\n [/^command/, 'cohere'],\n [/^(mistral|mixtral|pixtral)/, 'mistral'],\n [/^jamba/, 'ai21'],\n [/^deepseek/, 'deepseek'],\n];\n\n/**\n * Resolve a Bedrock model id to its underlying vendor and short model id.\n *\n * Bedrock ids arrive in several shapes: a router short id (`claude-sonnet-5`), or a\n * provider-instance id with a region prefix and vendor segment\n * (`us.anthropic.claude-sonnet-5`, `us.xai.grok-4.6`). We strip the region prefix, peel\n * off the vendor segment when present, and otherwise infer the vendor from the model-name\n * prefix so the capability data of the underlying provider can be consulted.\n */\nfunction resolveBedrockVendorModel(modelId: string): { vendor: string | null; shortId: string } {\n const withoutRegion = modelId.replace(BEDROCK_REGION_PREFIX, '');\n\n const segmentMatch = withoutRegion.match(BEDROCK_VENDOR_SEGMENT);\n if (segmentMatch) {\n return { vendor: segmentMatch[1]!, shortId: segmentMatch[2]! };\n }\n\n for (const [pattern, vendor] of BEDROCK_VENDOR_BY_PREFIX) {\n if (pattern.test(withoutRegion)) return { vendor, shortId: withoutRegion };\n }\n\n return { vendor: null, shortId: withoutRegion };\n}\n\nfunction isDirectory(dir: string): boolean {\n try {\n return fs.existsSync(dir) && fs.statSync(dir).isDirectory();\n } catch {\n return false;\n }\n}\n\nfunction findCapabilitiesDirs(useDynamicLoading: boolean): string[] {\n const packageRoot = getPackageRoot();\n const distCapabilitiesDir = path.join(packageRoot, 'dist', 'capabilities');\n const sourceCapabilitiesDir = path.join(packageRoot, 'src', 'llm', 'model', 'capabilities');\n const workspaceSourceCapabilitiesDir = path.join(process.cwd(), 'packages/core/src/llm/model/capabilities');\n\n const dirs: string[] = [];\n\n // In dynamic mode, prefer the global cache so fresher gateway-synced data wins.\n if (useDynamicLoading) {\n const globalCapDir = GLOBAL_CAPABILITIES_DIR();\n if (isDirectory(globalCapDir)) dirs.push(globalCapDir);\n }\n\n if (isDirectory(distCapabilitiesDir)) dirs.push(distCapabilitiesDir);\n\n // Published packages only include dist/. Source fallbacks are for local workspace/dev\n // runs where @mastra/core may resolve through a stale partial dist while checked-in\n // source capability files are available.\n if (isDirectory(sourceCapabilitiesDir)) dirs.push(sourceCapabilitiesDir);\n if (workspaceSourceCapabilitiesDir !== sourceCapabilitiesDir && isDirectory(workspaceSourceCapabilitiesDir)) {\n dirs.push(workspaceSourceCapabilitiesDir);\n }\n\n return dirs;\n}\n\nlet capabilitiesDirCache: string[] | undefined;\n\n/** Parsed capability file cache — avoids re-reading JSON per dimension. */\nconst parsedCapFileCache = new Map<string, ProviderCapabilityFile | null>();\n\nfunction loadProviderCapabilityFile(provider: string, useDynamicLoading: boolean): ProviderCapabilityFile | null {\n if (parsedCapFileCache.has(provider)) return parsedCapFileCache.get(provider)!;\n\n if (capabilitiesDirCache === undefined) {\n capabilitiesDirCache = findCapabilitiesDirs(useDynamicLoading);\n }\n\n for (const capabilitiesDir of capabilitiesDirCache) {\n const filePath = path.join(capabilitiesDir, getCapabilityFileName(provider));\n try {\n const content = fs.readFileSync(filePath, 'utf-8');\n const data = JSON.parse(content) as ProviderCapabilityFile;\n parsedCapFileCache.set(provider, data);\n return data;\n } catch {\n continue;\n }\n }\n\n parsedCapFileCache.set(provider, null);\n return null;\n}\n\nfunction loadProviderCapability(\n provider: string,\n dimension: CapabilityDimension,\n useDynamicLoading: boolean,\n): string[] | null {\n const cache = providerCapCaches[dimension];\n if (cache.has(provider)) return cache.get(provider)!;\n\n const file = loadProviderCapabilityFile(provider, useDynamicLoading);\n const models = file?.[dimension] ?? null;\n cache.set(provider, models);\n return models;\n}\n\nfunction getProviderCapabilitySupport(\n provider: string,\n modelId: string,\n dimension: CapabilityDimension,\n useDynamicLoading: boolean,\n): boolean | undefined {\n const models = loadProviderCapability(provider, dimension, useDynamicLoading);\n if (!models) return undefined;\n return models.includes(modelId);\n}\n\n/**\n * Whether the provider's model list enumerates this model. Capability arrays only\n * hold models with the capability set, so a model that supports nothing would be\n * absent from all of them — the registry's model list is the real membership signal.\n */\nfunction providerListsModel(provider: string, modelId: string): boolean {\n return GatewayRegistry.getInstance().getModels()[provider]?.includes(modelId) ?? false;\n}\n\nfunction modelSupportsCapability(modelRouterId: string, dimension: CapabilityDimension): boolean | undefined {\n const parsed = parseModelString(modelRouterId);\n const provider = parsed.provider ? (PROVIDER_ALIASES[parsed.provider] ?? parsed.provider) : parsed.provider;\n let modelId = parsed.modelId;\n\n // Bedrock provider instances carry region/vendor-qualified ids\n // (`us.anthropic.claude-sonnet-5`); reduce to the short id the registry uses so both\n // the override map and the capability files resolve consistently with router ids.\n let bedrockVendor: string | null = null;\n if (provider === 'aws-bedrock') {\n const resolved = resolveBedrockVendorModel(modelId);\n bedrockVendor = resolved.vendor;\n modelId = resolved.shortId;\n }\n\n const canonicalRouterId = provider ? `${provider}/${modelId}` : modelId;\n const override =\n capabilityOverrides[dimension]?.[canonicalRouterId] ?? capabilityOverrides[dimension]?.[modelRouterId];\n if (override !== undefined) return override;\n\n if (!provider) return undefined;\n\n const registry = GatewayRegistry.getInstance();\n const useDynamicLoading = registry['useDynamicLoading'];\n const directSupport = getProviderCapabilitySupport(provider, modelId, dimension, useDynamicLoading);\n\n // Positive direct match wins immediately.\n if (directSupport === true) return true;\n\n // The provider actually serving the request is authoritative. If it publishes\n // capability data for this dimension and lists the model, its `false` stands —\n // a gateway can lack capabilities the upstream provider offers directly\n // (OpenRouter has no image-capable endpoint for `deepseek/deepseek-v4-flash`\n // even though DeepSeek's own API does).\n //\n // Fall back to the underlying provider's capability file when the gateway\n // never answered: either it has no data for this dimension at all (Netlify and\n // custom gateways only implement `fetchProviders()`), or it doesn't enumerate\n // the nested model (e.g. `openrouter/anthropic/claude-sonnet-4-6`).\n const gatewayAnswered = directSupport !== undefined && providerListsModel(provider, modelId);\n const nestedProviderDelimiter = modelId.indexOf('/');\n if (nestedProviderDelimiter !== -1 && !gatewayAnswered) {\n const nestedProvider = modelId.substring(0, nestedProviderDelimiter);\n const nestedModelId = modelId.substring(nestedProviderDelimiter + 1);\n if (nestedProvider && nestedModelId) {\n const nestedSupport = getProviderCapabilitySupport(nestedProvider, nestedModelId, dimension, useDynamicLoading);\n if (nestedSupport !== undefined) return nestedSupport;\n }\n }\n\n // Bedrock has no capability file of its own. When the direct lookup is inconclusive,\n // fall back to the underlying vendor's authoritative file (Claude → anthropic,\n // grok → xai) so Bedrock-hosted models inherit the vendor's sampling-param facts.\n if (provider === 'aws-bedrock' && directSupport === undefined && bedrockVendor) {\n const vendorSupport = getProviderCapabilitySupport(bedrockVendor, modelId, dimension, useDynamicLoading);\n if (vendorSupport !== undefined) return vendorSupport;\n }\n\n return directSupport;\n}\n\nfunction loadReasoningByModel(provider: string): Record<string, ModelReasoningOption[]> | undefined {\n const useDynamicLoading = GatewayRegistry.getInstance()['useDynamicLoading'];\n return loadProviderCapabilityFile(provider, useDynamicLoading)?.reasoning;\n}\n\ntype ReasoningSource = { provider: string; modelId: string };\n\nfunction splitNestedModelId(modelId: string): ReasoningSource | undefined {\n const delimiter = modelId.indexOf('/');\n if (delimiter <= 0 || delimiter === modelId.length - 1) return undefined;\n return { provider: modelId.substring(0, delimiter), modelId: modelId.substring(delimiter + 1) };\n}\n\nfunction reasoningSourcesInPrecedence(provider: string, modelId: string): ReasoningSource[] {\n if (provider === 'aws-bedrock') {\n const { vendor, shortId } = resolveBedrockVendorModel(modelId);\n return [\n { provider, modelId },\n { provider, modelId: shortId },\n ...(vendor ? [{ provider: vendor, modelId: shortId }] : []),\n ];\n }\n const nested = splitNestedModelId(modelId);\n if (!nested) return [{ provider, modelId }];\n return [{ provider, modelId }, { provider: `${provider}/${nested.provider}`, modelId: nested.modelId }, nested];\n}\n\nfunction sourceAnswersForModel({ provider, modelId }: ReasoningSource): boolean {\n const reasoningByModel = loadReasoningByModel(provider);\n if (!reasoningByModel) return false;\n return Object.hasOwn(reasoningByModel, modelId) || providerListsModel(provider, modelId);\n}\n\n/**\n * The reasoning controls a model accepts: effort values, a token budget, or an on/off toggle.\n * Returns `[]` when the provider data lists the model without reasoning controls, and `undefined`\n * when no provider data describes the model. The first source that publishes reasoning data and\n * lists the model answers for it: the provider itself, then a gateway's per-provider data, then\n * the nested or Bedrock vendor's data.\n */\nexport function getModelReasoningOptions(modelRouterId: string): ModelReasoningOption[] | undefined {\n const parsed = parseModelString(modelRouterId);\n if (!parsed.provider) return undefined;\n const provider = PROVIDER_ALIASES[parsed.provider] ?? parsed.provider;\n const answeringSource = reasoningSourcesInPrecedence(provider, parsed.modelId).find(sourceAnswersForModel);\n if (!answeringSource) return undefined;\n return loadReasoningByModel(answeringSource.provider)?.[answeringSource.modelId] ?? [];\n}\n\n/** @internal Reset capability caches. For testing only. */\nexport function _resetCapabilityCaches(): void {\n for (const cache of Object.values(providerCapCaches)) cache.clear();\n parsedCapFileCache.clear();\n capabilitiesDirCache = undefined;\n}\n\n/**\n * Check whether a model supports image/file attachments.\n * Returns `true` if the model is listed, `false` if the provider is known but\n * the model isn't listed, or `undefined` when no data exists for the provider.\n */\nexport function modelSupportsAttachments(modelRouterId: string): boolean | undefined {\n return modelSupportsCapability(modelRouterId, 'attachment');\n}\n\n/**\n * Check whether a model supports the `temperature` sampling parameter.\n * Returns `true` if the model is listed, `false` if the provider is known but\n * the model isn't listed, or `undefined` when no data exists for the provider.\n */\nexport function modelSupportsTemperature(modelRouterId: string): boolean | undefined {\n return modelSupportsCapability(modelRouterId, 'temperature');\n}\n\n/**\n * Check whether a model supports native structured output.\n * Returns `true` if the model is listed, `false` if the provider is known but\n * the model isn't listed, or `undefined` when no data exists for the provider.\n */\nexport function modelSupportsStructuredOutput(modelRouterId: string): boolean | undefined {\n return modelSupportsCapability(modelRouterId, 'structuredOutput');\n}\n\n/**\n * Type guard to check if a string is a valid OpenAI-compatible model ID\n */\nexport function isValidModelId(modelId: string): modelId is ModelRouterModelId {\n const { provider } = parseModelString(modelId);\n return provider !== null && isProviderRegistered(provider);\n}\n\nexport interface GatewayRegistryOptions {\n /**\n * Enable dynamic loading from file system instead of using static bundled registry.\n * Required for syncGateways() and auto-refresh to work.\n * Defaults to true when MASTRA_DEV=true, false otherwise.\n */\n useDynamicLoading?: boolean;\n}\n\n/**\n * GatewayRegistry - Manages dynamic loading and refreshing of provider data from gateways\n * Singleton class that handles runtime updates to the provider registry\n */\nexport class GatewayRegistry {\n private static instance: GatewayRegistry | null = null;\n private lastRefreshTime: Date | null = null;\n private refreshInterval: NodeJS.Timeout | null = null;\n private isRefreshing = false;\n private useDynamicLoading: boolean;\n private customGateways: MastraModelGatewayInterface[] = [];\n\n private constructor(options: GatewayRegistryOptions = {}) {\n const isDev = process.env.MASTRA_DEV === 'true' || process.env.MASTRA_DEV === '1';\n this.useDynamicLoading = options.useDynamicLoading ?? isDev;\n }\n\n /**\n * Get the singleton instance\n */\n static getInstance(options?: GatewayRegistryOptions): GatewayRegistry {\n if (!GatewayRegistry.instance) {\n GatewayRegistry.instance = new GatewayRegistry(options);\n return GatewayRegistry.instance;\n }\n\n if (options?.useDynamicLoading === true) {\n GatewayRegistry.instance.useDynamicLoading = true;\n }\n\n return GatewayRegistry.instance;\n }\n\n /**\n * Register custom gateways for type generation\n * @param gateways - Array of custom gateway instances\n */\n registerCustomGateways(gateways: MastraModelGatewayInterface[]): void {\n this.customGateways = gateways;\n }\n\n /**\n * Get all registered custom gateways\n */\n getCustomGateways(): MastraModelGatewayInterface[] {\n return this.customGateways;\n }\n\n /**\n * Sync providers from all gateways\n * Requires dynamic loading to be enabled (useDynamicLoading=true).\n * @param forceRefresh - Force refresh even if recently synced\n * @param writeToSrc - Write to src/ directory in addition to dist/ (useful for manual generation in repo)\n */\n async syncGateways(forceRefresh = false, writeToSrc = false): Promise<void> {\n // Only allow sync when dynamic loading is enabled or when explicitly writing to src (build script)\n if (!this.useDynamicLoading && !writeToSrc) {\n // console.debug('[GatewayRegistry] Skipping sync (dynamic loading disabled, registry is static)');\n return;\n }\n\n // Skip all network fetches when running in offline/air-gapped mode\n if (isOfflineMode()) {\n return;\n }\n\n if (this.isRefreshing && !forceRefresh) {\n // console.debug('[GatewayRegistry] Sync already in progress, skipping...');\n return;\n }\n\n this.isRefreshing = true;\n\n try {\n // console.debug('[GatewayRegistry] Starting gateway sync...');\n\n // Import gateway classes and generation functions\n const { ModelsDevGateway } = await import('./gateways/models-dev.js');\n const { NetlifyGateway } = await import('./gateways/netlify.js');\n const { MastraGateway } = await import('./gateways/mastra.js');\n const { fetchProvidersFromGateways, writeRegistryFiles } = await import('./registry-generator.js');\n\n // Initialize default gateways. Mastra Gateway is dynamic-only and should not be written into checked-in static artifacts.\n const defaultGateways = [\n new ModelsDevGateway({}),\n new NetlifyGateway(),\n ...(writeToSrc ? [] : [new MastraGateway()]),\n ];\n\n // Combine default and custom gateways\n const gateways = [...defaultGateways, ...this.customGateways];\n\n // Fetch provider data\n const {\n providers,\n models,\n attachmentCapabilities,\n temperatureCapabilities,\n structuredOutputCapabilities,\n reasoningCapabilities,\n failedGateways,\n } = await fetchProvidersFromGateways(gateways);\n\n // If any gateway failed, skip writing to prevent partial results from\n // overwriting the complete bundled registry. The existing static registry\n // already contains all provider data, so a partial write would only\n // remove providers (e.g. writing only Netlify providers when models.dev\n // is down strips all direct providers like openai, anthropic, etc.).\n if (failedGateways.length > 0) {\n return;\n }\n\n // Get package root for file paths\n const packageRoot = getPackageRoot();\n\n // Write to global cache first (so all projects can benefit)\n try {\n fs.mkdirSync(CACHE_DIR(), { recursive: true });\n await writeRegistryFiles(\n GLOBAL_PROVIDER_REGISTRY_JSON(),\n GLOBAL_PROVIDER_TYPES_DTS(),\n providers,\n models,\n attachmentCapabilities,\n temperatureCapabilities,\n structuredOutputCapabilities,\n reasoningCapabilities,\n );\n // console.debug(`[GatewayRegistry] ✅ Updated global cache at ${CACHE_DIR()}`);\n } catch (error) {\n console.warn('[GatewayRegistry] Failed to write to global cache:', error);\n }\n\n // Write to dist/ (the bundled location that gets distributed)\n const distJsonPath = path.join(packageRoot, 'dist', 'provider-registry.json');\n const distTypesPath = path.join(packageRoot, 'dist', 'llm', 'model', 'provider-types.generated.d.ts');\n\n await writeRegistryFiles(\n distJsonPath,\n distTypesPath,\n providers,\n models,\n attachmentCapabilities,\n temperatureCapabilities,\n structuredOutputCapabilities,\n reasoningCapabilities,\n );\n // console.debug(`[GatewayRegistry] ✅ Updated registry files in dist/`);\n\n // Copy to src/ only when explicitly requested (e.g., running the generation script)\n const shouldWriteToSrc = writeToSrc;\n if (shouldWriteToSrc) {\n const srcJsonPath = path.join(packageRoot, 'src', 'llm', 'model', 'provider-registry.json');\n const srcTypesPath = path.join(packageRoot, 'src', 'llm', 'model', 'provider-types.generated.d.ts');\n\n // Copy the already-generated files\n await fs.promises.copyFile(distJsonPath, srcJsonPath);\n await fs.promises.copyFile(distTypesPath, srcTypesPath);\n\n const distCapDir = path.join(packageRoot, 'dist', 'capabilities');\n const srcCapDir = path.join(packageRoot, 'src', 'llm', 'model', 'capabilities');\n if (fs.existsSync(distCapDir)) {\n await fs.promises.mkdir(srcCapDir, { recursive: true });\n const capFiles = fs.readdirSync(distCapDir).filter(f => f.endsWith('.json'));\n for (const file of capFiles) {\n await fs.promises.copyFile(path.join(distCapDir, file), path.join(srcCapDir, file));\n }\n }\n // console.debug(`[GatewayRegistry] ✅ Copied registry files to src/ (${writeToSrc ? 'manual' : 'dynamic loading'})`);\n }\n\n // Clear the in-memory cache to force reload (dynamic loading only)\n if (this.useDynamicLoading) {\n registryData = null;\n for (const cache of Object.values(providerCapCaches)) cache.clear();\n parsedCapFileCache.clear();\n capabilitiesDirCache = undefined;\n }\n\n this.lastRefreshTime = new Date();\n saveLastRefreshTimeToDisk(this.lastRefreshTime);\n // console.debug(`[GatewayRegistry] ✅ Gateway sync completed at ${this.lastRefreshTime.toISOString()}`);\n } catch {\n // Silently ignore — the bundled registry already contains all\n // model data so a failed sync is non-critical.\n } finally {\n this.isRefreshing = false;\n }\n }\n\n /**\n * Get the last refresh time (from memory or disk cache)\n */\n getLastRefreshTime(): Date | null {\n return this.lastRefreshTime || getLastRefreshTimeFromDisk();\n }\n\n /**\n * Start auto-refresh on an interval\n * Requires dynamic loading to be enabled (useDynamicLoading=true).\n * @param intervalMs - Interval in milliseconds (default: 1 hour)\n */\n startAutoRefresh(intervalMs = 60 * 60 * 1000): void {\n // Only allow auto-refresh when dynamic loading is enabled\n if (!this.useDynamicLoading) {\n // console.debug('[GatewayRegistry] Skipping auto-refresh (dynamic loading disabled, registry is static)');\n return;\n }\n\n // Skip auto-refresh when running in offline/air-gapped mode\n if (isOfflineMode()) {\n return;\n }\n\n if (this.refreshInterval) {\n // console.debug('[GatewayRegistry] Auto-refresh already running');\n return;\n }\n\n // console.debug(`[GatewayRegistry] Starting auto-refresh (interval: ${intervalMs}ms)`);\n\n // Check if we need to run an immediate sync\n const lastRefresh = getLastRefreshTimeFromDisk();\n const now = Date.now();\n const shouldRefresh = !modelRouterCacheFailed && (!lastRefresh || now - lastRefresh.getTime() > intervalMs);\n\n if (shouldRefresh) {\n this.syncGateways().catch(() => {});\n }\n\n this.refreshInterval = setInterval(() => {\n if (modelRouterCacheFailed && this.refreshInterval) {\n clearInterval(this.refreshInterval);\n this.refreshInterval = null;\n return;\n }\n this.syncGateways().catch(() => {});\n }, intervalMs);\n\n // Prevent the interval from keeping the process alive\n if (this.refreshInterval.unref) {\n this.refreshInterval.unref();\n }\n }\n\n /**\n * Stop auto-refresh\n */\n stopAutoRefresh(): void {\n if (this.refreshInterval) {\n clearInterval(this.refreshInterval);\n this.refreshInterval = null;\n // console.debug('[GatewayRegistry] Auto-refresh stopped');\n }\n }\n\n /**\n * Get provider configuration by ID\n */\n getProviderConfig(providerId: string): ProviderConfig | undefined {\n const data = loadRegistry(this.useDynamicLoading, this.customGateways);\n return data.providers[providerId];\n }\n\n /**\n * Check if a provider is registered\n */\n isProviderRegistered(providerId: string): boolean {\n const data = loadRegistry(this.useDynamicLoading, this.customGateways);\n return providerId in data.providers;\n }\n\n /**\n * Get all registered providers\n */\n getProviders(): Record<string, ProviderConfig> {\n const data = loadRegistry(this.useDynamicLoading, this.customGateways);\n return data.providers;\n }\n\n /**\n * Get all models\n */\n getModels(): Record<string, string[]> {\n return loadRegistry(this.useDynamicLoading, this.customGateways).models;\n }\n}\n\n// Auto-start refresh if enabled\n// Defaults to enabled when MASTRA_DEV=true (which enables dynamic loading by default)\n// Disabled entirely when MASTRA_OFFLINE is set (air-gapped/offline environments)\nconst isDev = process.env.MASTRA_DEV === 'true' || process.env.MASTRA_DEV === '1';\nconst autoRefreshEnabled =\n !isOfflineMode() &&\n (process.env.MASTRA_AUTO_REFRESH_PROVIDERS === 'true' ||\n (process.env.MASTRA_AUTO_REFRESH_PROVIDERS !== 'false' && isDev));\n\nif (autoRefreshEnabled) {\n // console.debug('[GatewayRegistry] Auto-refresh enabled');\n GatewayRegistry.getInstance({ useDynamicLoading: isDev }).startAutoRefresh();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,SAAS,sBAAsB,QAAgB,SAA0D;CACvG,MAAM,WAAWA,gBAAAA,oBAAoB,YAAY;CACjD,MAAM,SAAiC,EAAE,cAAcC,gBAAAA,kBAAkB;CACzE,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,WAAW,CAAC,CAAC,GAAG;EACxD,IAAI,IAAI,YAAY,MAAM,UAAU;EACpC,OAAO,OAAO;CAChB;CACA,OAAOD,gBAAAA,uBAAuB,UAAU;CACxC,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,iCAAiC,QAAqC;CACpF,IAAI,OAAO,WAAW,YAAY,OAAO,WAAW,GAAG,OAAO;CAC9D,IAAI,OAAO,WAAW,cAAc,KAAK,OAAO,WAAW,QAAQ,GAAG,OAAO;CAC7E,OAAO,OAAO,WAAW,MAAM;AACjC;AAEA,IAAa,gBAAb,cAAmCE,gBAAAA,mBAAmB;CAIhC;CAHpB,KAAc;CACd,OAAgB;CAEhB,YAAY,QAAsC;EAChD,MAAM;EADY,KAAA,SAAA;CAEpB;CAEA,aAA6B;EAC3B,MAAM,MAAM,KAAK,QAAQ,WAAW,QAAQ,IAAI,yBAAyB;EAEzE,IAAI,MAAM,IAAI;EACd,OAAO,MAAM,KAAK,IAAI,MAAM,OAAO,KAAK;EACxC,OAAO,IAAI,MAAM,GAAG,GAAG,CAAC,CAAC,QAAQ,SAAS,EAAE;CAC9C;CAEA,eAAiC;EAC/B,OAAO,CAAC,EAAE,KAAK,QAAQ,UAAU,QAAQ,IAAI;CAC/C;;;;;;;;;CAUA,OAA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