Skip to content

Function: createTestProviderContext()

Makaio Framework


Makaio Framework / ai-adapters-core / createTestProviderContext

createTestProviderContext(definition?): object

Defined in: ../../../adapters/core/src/utils/resolveTestConfig.ts:43

Build an unresolved provider context for conformance tests.

When a provider definition is supplied, builds credential refs in env:VAR_NAME format from credentialEnvVars. Connectors resolve these refs locally via resolveConnectorCredentials(). Otherwise returns a minimal sentinel.

Optional provider definition to build credential refs from

object[] = ...

Runtime-populated model catalog for this provider.

At boot the registry service merges lab definitions with provider-specific overrides and injects the result here. Static provider packages and fixtures should omit this field from ProviderDefinitionInput; the registry service owns the content. Defaults to [] on parsed definitions so runtime callers never need to handle undefined.

Record<string, string> = ...

Environment variable names for credential fields.

Maps credential field names (matching the adapter’s credentialSchema keys) to environment variable names. Used as last-resort fallback when credentials are not provided via saved config or runtime input.

Example

`{ apiKey: 'ANTHROPIC_API_KEY' }` or `{ token: 'COPILOT_TOKEN' }`

string = ...

Default model identifier for general-purpose tasks (e.g., 'claude-sonnet-4-5'). Optional — providers with fully dynamic model discovery may omit this.

"allowlist" | "show-all" = ...

Recommended default filter mode applied when a provider record is first created.

  • 'show-all' — all models visible by default (curated providers like Anthropic).
  • 'allowlist' — all models hidden by default (firehose providers like OpenRouter).

Defaults to 'show-all' in the sync service when omitted.

string = ...

Short human-readable description of the provider.

{ anthropic?: string; openai?: string; } = ...

Wire protocol endpoints for this provider.

Maps each supported protocol to a base URL. Omit for SDK-only providers (e.g., GitHub Copilot) that communicate through a proprietary transport.

string = ...

string = ...

string = ...

Fast/cheap model for cost-sensitive operations (e.g., 'claude-haiku-4-5'). Used for subagent exploration and background processing. Falls back to defaultModel when omitted.

string = ...

Stable provider identifier used for persistence and matching (e.g., 'anthropic', 'z-ai').

Acts as the primary key across all provider-related storage and bus messages. Must be unique across all registered provider packages.

string = ...

Display name shown in the UI (e.g., 'Anthropic', 'Z.AI').

Fresh unresolved provider context per call to prevent cross-test mutation leaks

optional credentialEnvVars?: Record<string, string>

Maps credential keys to environment variable names for subprocess adapters. E.g., { apiKey: 'ANTHROPIC_API_KEY' }.

credentialRefs: Record<string, string & $brand<"CredentialRef">>

Credential references resolved at the connector layer, not on the bus.

definitionId: string

Provider definition ID (e.g., 'anthropic', 'alibaba').

optional endpointOverrides?: object

Endpoint URL overrides keyed by protocol.

optional anthropic?: string

optional openai?: string

providerConfigId: string

Provider config UUID. Links back to the ProviderConfig that produced this context.