Configuration

ChatClientConfig

Passed to createChatClient(config). Every field is optional; the SDK falls back to mock/development defaults when omitted.

Minimum viable config

The two configs you'll actually start from:

import { createChatClient, tokenEndpointAuth, createProxyTransport } from 'gecx-chat';
import { createMockTransport } from 'gecx-chat/testing';

// Dev — no credentials, no backend
const devClient = createChatClient({
  transport: createMockTransport(),
});

// Production — your token endpoint + a proxy you control
const prodClient = createChatClient({
  auth: tokenEndpointAuth({ endpoint: '/api/chat-token' }),
  transport: createProxyTransport({ endpoint: '/api/chat' }),
});

Everything below is optional. Add fields as you need them.

Auth

OptionTypeDefaultDescription
authAuthProviderMock providerAuthentication provider. Use tokenEndpointAuth(), customAuth(), or googleTokenBrokerAuth(). Required in production.

Transport

OptionTypeDefaultDescription
transportChatTransportInline echo mockTransport for sending and streaming messages. Use createProxyTransport(), createSessionApiTransport(), createHttpTransport(), or createWebSocketTransport(). Required in production.

Storage

OptionTypeDefaultDescription
storageStorageAdapter | StorageConfigundefined (no persistence)Message and session persistence. Pass a StorageAdapter directly or a StorageConfig object with mode and consent.

StorageConfig shape:

FieldTypeValuesDescription
modestring'session', 'local', 'memory'session uses sessionStorage, local uses localStorage, memory is in-memory only.
consentstring'functional', 'none''none' forces memory-only storage regardless of mode.

Tools

OptionTypeDefaultDescription
toolsClientTool[][]Client-side tools the agent can invoke. Created with defineClientTool().
approvalHandlerToolApprovalHandlerundefinedGlobal approval handler for tool calls requiring user confirmation.

Capabilities

OptionTypeDefaultDescription
capabilitiesPartial<SessionCapabilities>See belowOverride default session capability flags.

Default SessionCapabilities:

FieldTypeDefault
streamingbooleantrue
richContentbooleantrue
fileUploadbooleantrue
handoffbooleantrue
clientToolsbooleantrue
citationsbooleantrue
suggestionChipsbooleantrue
markdownbooleantrue
a2uibooleanfalse
a2uiProtocolVersionsArray<'v0.9'>['v0.9']
a2uiCatalogIdsstring[][]
a2uiDataModelSyncstring'disabled'
partsPartCapabilitiesAll core + standard families at v1

Recovery

OptionTypeDefaultDescription
recoveryPartial<RecoveryPolicy>See belowRecovery policy for mid-turn transport disconnects.

Default RecoveryPolicy:

FieldTypeDefaultDescription
maxAttemptsnumber5Maximum reconnect attempts before giving up.
initialBackoffMsnumber500First-attempt backoff in milliseconds.
maxBackoffMsnumber15000Cap on per-attempt backoff after exponential growth.
jitterstring'equal'Jitter strategy: 'none', 'equal', or 'full'.
resumeModestring'resume'How to rejoin a partially-streamed turn: 'none', 'replay', or 'resume'.

Network

OptionTypeDefaultDescription
networkNetworkMode'auto' (browser)'auto' queues sends while offline; 'strict' surfaces NETWORK_OFFLINE immediately; 'off' disables the monitor.
multiTabMultiTabMode'leader' (when storage exists)'leader' runs transport in one tab; 'broadcast' runs per tab; 'off' disables coordination.

Identity

OptionTypeDefaultDescription
identityIdentityConfigundefinedIdentity bootstrap and cross-tab sync options.

IdentityConfig shape:

FieldTypeDefaultDescription
initialPartial<ChatIdentity>undefinedSeed identity fields at construction time.
syncAcrossTabsbooleantrue (when durable storage exists)Enable BroadcastChannel-based identity sync across tabs.

Governance

OptionTypeDefaultDescription
governanceDataGovernancePolicyDefaults (functional consent, session retention)Data governance policy: consent, retention, export, audit, and server-ack requirements.

Analytics and Telemetry

OptionTypeDefaultDescription
analyticsProductAnalyticsConfigundefinedProduct analytics configuration and sink.
telemetrySessionTelemetrySinkundefinedLow-level session telemetry sink for observability pipelines.

Memory

OptionTypeDefaultDescription
memoryMemoryConfigundefined (memory disabled)Long-term memory. When omitted, no memory tools register, no interceptor installs, and no extractor runs.

MemoryConfig shape (excerpt — see Memory API reference for the full type):

FieldTypeDefaultDescription
adapterMemoryAdapterrequiredcreateLocalMemoryAdapter, createServerMemoryAdapter, or createHybridMemoryAdapter.
read.mode'inject' | 'recall' | 'hybrid' | 'off''inject'How saved facts reach the model.
write.toolbooleantrueRegister memory.save/update/delete tools.
write.extractor'heuristic' | 'llm' | ExtractorFn | falsefalseAuto-extract facts from completed turns.

Voice

OptionTypeDefaultDescription
voice'auto' | VoiceConfigundefined (no voice)When set, exposes chat.voice as a lazy getter. Configuring voice does not request the microphone or open a WebSocket — the provider factory runs only when something first reads session.voice. 'auto' picks a provider by environment (mock in test, web-audio mock in dev, Gemini Live in prod/staging).

Permissions

OptionTypeDefaultDescription
permissionProviderPermissionProviderBrowser provider when navigator exists; else noopDevice-permission provider (microphone, camera, screen, geolocation).

client.permissions is always available — defaults to createBrowserPermissionProvider() when navigator exists, otherwise createNoopPermissionProvider().

Signals (sentiment + intent)

OptionTypeDefaultDescription
signalsSignalsConfigundefined (signals disabled)Adapter list and escalation rules.

SignalsConfig shape:

FieldTypeDescription
adaptersSignalAdapter[]Pluggable classifiers. Ships: ruleAdapter, tfjsToxicityAdapter, modelToolAdapter, geminiAdapter, claudeAdapter, openaiAdapter.
escalationSignalEscalationRule[]Declarative rules. Each rule calls HandoffController.requestTransfer() with a stable idempotency key.

Agent graph

Agent graphs compose via createAgentGraphTransport(...) wrapping the host transport — there is no top-level agentGraph config field. See Agent Graph guide.

Governance — capability extensions

Sub-policyTypeDefaultDescription
governance.computerUseComputerUsePolicy{ enabled: false }Computer-use opt-in. enabled, allowlist, maxDurationMs, maxActionsPerSession, highRiskActions, killSwitch. See Computer-use.
governance.commerceCommerceGovernancePolicyundefinedStrict-mode commerce governance. Fails closed on PCI/PII (PAN/Luhn, CVV, SSN, email, phone, address, EIN) with COMMERCE_PII_LEAK.

Misc

OptionTypeDefaultDescription
environmentstring'development''production', 'staging', 'development', or 'test'. Controls validation strictness.
deploymentstringundefinedDeployment identifier passed to the transport.
preserveRawResponsesbooleanundefinedWhen true, raw transport events are stored on each ChatMessage.
retryRetryOptionsundefinedPer-send retry options (separate from recovery policy).
richContentRichContentRegistry | RichContentDefinition[]Default registry (all core + standard families at v1)Pre-built rich-content registry or array of definitions to register on top of defaults.

UseChatSessionOptions

Passed to the useChatSession() React hook.

OptionTypeDefaultDescription
clientChatClientundefinedPre-built client instance. Takes priority over config and context.
configChatClientConfigundefinedConfig for an internally-created client. Ignored if client is provided.
autoStartbooleantrueAutomatically create and start a session on mount.
onMessage(message: ChatMessage) => voidundefinedCallback fired on every new message.
onError(error: Error) => voidundefinedCallback fired on session errors.
onStatusChange(status: SessionStatus) => voidundefinedCallback fired on session status transitions.
onProductAnalyticsEvent(event: ProductAnalyticsEvent) => voidundefinedCallback fired on product analytics events.
Source: docs/reference/configuration.md