Skip to content

FallbackCapableProvider

A provider that can notify listeners when it swaps its underlying implementation (a fallback chain).

Defined in: src/core/types/providers.ts:702

A provider that can notify listeners when it swaps its underlying implementation (a fallback chain).

Remarks

CompositeVoice duck-types pipeline providers against this interface and, when onFallback is present, bridges each notification to the 'provider.fallback' SDK event.

See

ProviderFallbackInfo for the notification payload

Methods

onFallback()

onFallback(callback): void | () => void;

Defined in: src/core/types/providers.ts:712

Register a callback invoked whenever the chain fails over to another provider.

Parameters

ParameterTypeDescription
callback(info) => voidInvoked with a ProviderFallbackInfo per swap.

Returns

void | () => void

An unsubscribe function when the implementation supports it. Callers that outlive the chain (the documented reuse pattern, where one chain is shared across many agents) must call it on teardown.


setReconnectHeaderSource()?

optional setReconnectHeaderSource(source): void | () => void;

Defined in: src/core/types/providers.ts:728

Register a source for the cached audio container header, re-injected into a replacement provider after an internal failover reconnect.

Parameters

ParameterTypeDescription
source() => ArrayBuffer | nullReturns the cached header, or null when unavailable.

Returns

void | () => void

An unsubscribe function when the implementation supports it. Callers that outlive the chain must call it on teardown so a disposed agent’s AudioHeaderCache is not reused on a later failover.

Remarks

Optional — only meaningful for chains that stream container-format audio (WebM/OGG/WAV). CompositeVoice wires this to its AudioHeaderCache when present.

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency