Interface: AIAdapterDefinition<TBus, TConnector, TAgent>
Makaio Framework / ai-adapters-core / AIAdapterDefinition
Interface: AIAdapterDefinition<TBus, TConnector, TAgent>
Section titled “Interface: AIAdapterDefinition<TBus, TConnector, TAgent>”Defined in: ../../../adapters/core/src/types/ai-adapter-definition.ts:29
Definition for registering adapters with the runtime.
Extends AdapterDefinitionContract with narrowed generic type parameters
so the providers array and createAdapter factory are typed against the
concrete adapter, connector, and bus types for this implementation.
Used for dynamic adapter loading and registry.
Example
Section titled “Example”export const adapterDefinition: AIAdapterDefinition<OpenAINodeBus, OpenAINodeConnector, OpenAIAgent> = { name: 'openai-node', displayName: 'OpenAI', description: 'OpenAI chat completions with streaming and tool calling', createAdapter: (options) => createOpenAINodeAdapter({ adapterId: options?.adapterId }),};Extends
Section titled “Extends”AdapterDefinitionContract<AIAdapter<TBus,TConnector,TAgent>,AIAdapterInitOptions>
Type Parameters
Section titled “Type Parameters”TBus extends ScopedBus<string> = ScopedBus<string>
The scoped bus type for this adapter
TConnector
Section titled “TConnector”TConnector extends AIAgentConnector<TBus> = AIAgentConnector<TBus>
The connector type
TAgent
Section titled “TAgent”TAgent extends AIAgent<TBus, TConnector> = AIAgent<TBus, TConnector>
The agent type
Properties
Section titled “Properties”adapterConfigSchema?
Section titled “adapterConfigSchema?”
readonlyoptionaladapterConfigSchema?:ZodObject<Readonly<{[k:string]:$ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>; }>,$strip>
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:136
Zod schema for adapter-level configuration.
Used by the settings.adapter.getConfigSchema bus handler to generate
JSON Schema for UI form rendering. Currently a seam — no adapter populates
this yet, but it is correctly placed on the definition contract for future
adapter-level configuration UI.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.adapterConfigSchema
clientId?
Section titled “clientId?”
readonlyoptionalclientId?:undefined
Defined in: ../../../adapters/core/src/types/ai-adapter-definition.ts:50
Adapter definitions declare client compatibility through clients.
AIAdapterInitOptions.clientId remains the runtime-selected client
override passed to adapter factories for existing client-backed adapters.
Overrides
Section titled “Overrides”AdapterDefinitionContract.clientId
clients?
Section titled “clients?”
readonlyoptionalclients?: readonlyAdapterClientRef[]
Defined in: ../../../adapters/core/src/types/ai-adapter-definition.ts:42
Client packages this adapter can delegate to.
Each reference names a client extension by stable ID and declares the
compatible client package version range. Runtime initialization still
receives a selected clientId through AIAdapterInitOptions; this
definition field is the adapter-to-client capability declaration.
createAdapter
Section titled “createAdapter”
readonlycreateAdapter: (options?) =>Promise<AIAdapter<TBus,TConnector,TAgent>>
Defined in: ../../../adapters/core/src/types/ai-adapter-definition.ts:61
Factory that creates and initializes the adapter instance.
Inherits the typed AIAdapterInitOptions parameter from the base
contract’s TOptions generic, carrying platform defaults, log import
config, and provider definitions injected at runtime.
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional initialization options injected by the runtime.
Returns
Section titled “Returns”Promise<AIAdapter<TBus, TConnector, TAgent>>
The initialized adapter instance.
Overrides
Section titled “Overrides”AdapterDefinitionContract.createAdapter
defaultPresetId?
Section titled “defaultPresetId?”
readonlyoptionaldefaultPresetId?:string
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:180
Identifier of the default provider preset for this adapter.
When omitted, the runtime or user selects the preset.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.defaultPresetId
defaultTimeouts
Section titled “defaultTimeouts”
readonlydefaultTimeouts:RequiredTimeoutConfig
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:162
Required timeout defaults for all adapter operations.
The config factory should read these values instead of importing a parallel constant, making this contract the single source of truth for adapter timeout behavior.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.defaultTimeouts
description?
Section titled “description?”
readonlyoptionaldescription?:string
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:127
Short description of what this adapter does.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.description
displayName?
Section titled “displayName?”
readonlyoptionaldisplayName?:string
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:125
Human-readable display name shown in the UI (e.g., 'Claude Code').
When omitted, the subsystem falls back to AdapterManifest.displayName.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.displayName
helpLinks?
Section titled “helpLinks?”
readonlyoptionalhelpLinks?: readonlyobject[]
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:168
External help links for this adapter (e.g., documentation, support).
Displayed in the adapter settings UI when present.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.helpLinks
instructions?
Section titled “instructions?”
readonlyoptionalinstructions?:string
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:174
Setup or usage instructions shown in the adapter configuration UI.
May contain Markdown-formatted text.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.instructions
readonlyname:string
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:119
Stable machine identifier for this adapter (e.g., 'claude-code').
Must match AdapterManifest.name on the paired manifest entry.
Used as the primary key in adapter registries.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.name
protocol?
Section titled “protocol?”
readonlyoptionalprotocol?:"anthropic"|"openai"
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:196
Active wire protocol used by this adapter at runtime.
This is the singular runtime-active protocol consumed by the subsystem
to route requests. The serializable counterpart (AdapterManifest.protocols)
may declare additional protocols for discovery-time use.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.protocol
providerConfigSchema?
Section titled “providerConfigSchema?”
readonlyoptionalproviderConfigSchema?:ZodObject<Readonly<{[k:string]:$ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>; }>,$strip>
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:149
Default config schema applied to all providers unless overridden per-provider via AdapterProviderRef.configSchema.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.providerConfigSchema
providerCredentialSchema?
Section titled “providerCredentialSchema?”
readonlyoptionalproviderCredentialSchema?:ZodObject<Readonly<{[k:string]:$ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>; }>,$strip>
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:154
Default credential schema applied to all providers unless overridden per-provider via AdapterProviderRef.credentialSchema.
Inherited from
Section titled “Inherited from”AdapterDefinitionContract.providerCredentialSchema
providers
Section titled “providers”
readonlyproviders: readonlyAdapterProviderRef[]
Defined in: ../../../packages/contracts/src/extension/adapter-definition.ts:144
Provider IDs this adapter can serve.
Each entry declares a provider by definition ID with optional schema overrides. The adapter subsystem resolves these to full ProviderDefinitionInput objects at boot from the provider registry.