Skip to content

ProviderRegistry

Defined in: core/src/provider/provider.registry.ts:28

Holds the set of registered provider instances and re-emits their events as its own event. Instances are set up lazily via promises resolved by ProviderRegistry.list.

new ProviderRegistry(services?): ProviderRegistry;

Defined in: core/src/provider/provider.registry.ts:33

Parameter Type
services Services

ProviderRegistry

EventEmitter.constructor

destroy: Promise<void>;

Defined in: core/src/provider/provider.registry.ts:133

Promise<void>


emit<K>(event, ...args): void;

Defined in: core/src/utils/utils.eventemitter.ts:62

Invokes all listeners for event synchronously, without awaiting async listeners.

Type Parameter
K extends "event"
Parameter Type
event K
args Parameters<ProviderInstanceEvents[K]>

void

EventEmitter.emit


emitAsync<K>(event, ...args): Promise<void>;

Defined in: core/src/utils/utils.eventemitter.ts:73

Invokes all listeners for event and awaits them concurrently via Promise.all.

Type Parameter
K extends "event"
Parameter Type
event K
args Parameters<ProviderInstanceEvents[K]>

Promise<void>

EventEmitter.emitAsync


get(id): Promise<
| ProviderInstance
| undefined>;

Defined in: core/src/provider/provider.registry.ts:88

Resolves to the instance with the given id, or undefined if none matches.

Parameter Type
id string

Promise< | ProviderInstance | undefined>


getByType(type): Promise<ProviderInstance[]>;

Defined in: core/src/provider/provider.registry.ts:81

Resolves to all instances created from the given provider type.

Parameter Type
type ProviderType

Promise<ProviderInstance[]>


list(): Promise<ProviderInstance[]>;

Defined in: core/src/provider/provider.registry.ts:71

Resolves to all registered instances, awaiting any still setting up.

Promise<ProviderInstance[]>


on<K>(
event,
callback,
options?): () => void;

Defined in: core/src/utils/utils.eventemitter.ts:21

Registers callback for event. Returns an unsubscribe function; passing options.abortSignal also removes the listener when that signal aborts.

Type Parameter
K extends "event"
Parameter Type
event K
callback EventListener<Parameters<ProviderInstanceEvents[K]>>
options OnOptions

() => void

EventEmitter.on


once<K>(
event,
callback,
options?): () => void;

Defined in: core/src/utils/utils.eventemitter.ts:45

Like on, but the listener is removed after firing once.

Type Parameter
K extends "event"
Parameter Type
event K
callback EventListener<Parameters<ProviderInstanceEvents[K]>>
options OnOptions

() => void

EventEmitter.once


ready(): Promise<void>;

Defined in: core/src/provider/provider.registry.ts:76

Resolves once every registered instance has finished setting up.

Promise<void>


register<TConfig>(type, config): Promise<void>;

Defined in: core/src/provider/provider.registry.ts:42

Validates config against the type’s schema, sets up the instance, and starts re-emitting its events. Throws ProviderConfigValidationError if config is invalid.

Type Parameter
TConfig extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>
Parameter Type
type ProviderType<TConfig>
config output<TConfig>

Promise<void>


toActions(): Promise<Record<string, Action>>;

Defined in: core/src/provider/provider.registry.ts:102

Every provider’s actions keyed by the safe, deduped function name from allocateActionNames.

Promise<Record<string, Action>>


toTools(): Promise<Record<string, Tool>>;

Defined in: core/src/provider/provider.registry.ts:121

Every callable thing the providers expose, bound into neutral Tools over this registry’s services — ready to hand to a sandbox or agent that has no Services of its own.

Wider than ProviderRegistry.toActions: it also carries a search and a get tool per entity type. Actions are the verbs and entities the nouns, and something driving a conversation needs both — an agent that can only call actions has no way to find the record an action needs the id of.

toActions deliberately stays actions-only. It backs the HTTP action routes, and entities already have their own routes there; widening it would publish every entity twice.

Promise<Record<string, Tool>>