Chat React
@witqq/agent-sdk/chat/react
Section titled “@witqq/agent-sdk/chat/react”React bindings for agent-sdk chat module.
Headless hooks and components that wrap IChatClient for building chat UIs with minimal boilerplate.
Classes
Section titled “Classes”RemoteChatClient
Section titled “RemoteChatClient”Defined in: chat/react/RemoteChatClient.ts:59
Client-side interface for interacting with a remote chat server. Fully self-contained — no shared base with IChatRuntime. Extends IProviderClient for provider CRUD (ISP). Used by React components and remote clients.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RemoteChatClient(
options):RemoteChatClient
Defined in: chat/react/RemoteChatClient.ts:70
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Accessors
Section titled “Accessors”activeSessionId
Section titled “activeSessionId”Get Signature
Section titled “Get Signature”get activeSessionId():
ChatId|null
Defined in: chat/react/RemoteChatClient.ts:115
Returns
Section titled “Returns”ChatId | null
Implementation of
Section titled “Implementation of”selectedProviderId
Section titled “selectedProviderId”Get Signature
Section titled “Get Signature”get selectedProviderId():
string|null
Defined in: chat/react/RemoteChatClient.ts:95
Returns
Section titled “Returns”string | null
Implementation of
Section titled “Implementation of”IChatClient.selectedProviderId
status
Section titled “status”Get Signature
Section titled “Get Signature”get status():
RuntimeStatus
Defined in: chat/react/RemoteChatClient.ts:78
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”abort()
Section titled “abort()”abort():
void
Defined in: chat/react/RemoteChatClient.ts:223
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”createProvider()
Section titled “createProvider()”createProvider(
config):Promise<ProviderConfig>
Defined in: chat/react/RemoteChatClient.ts:257
Parameters
Section titled “Parameters”config
Section titled “config”Omit<ProviderConfig, "id" | "createdAt">
Returns
Section titled “Returns”Promise<ProviderConfig>
Implementation of
Section titled “Implementation of”createSession()
Section titled “createSession()”createSession(
options):Promise<ChatSession<Record<string,unknown>>>
Defined in: chat/react/RemoteChatClient.ts:119
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Promise<ChatSession<Record<string, unknown>>>
Implementation of
Section titled “Implementation of”deleteProvider()
Section titled “deleteProvider()”deleteProvider(
id):Promise<void>
Defined in: chat/react/RemoteChatClient.ts:268
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”deleteSession()
Section titled “deleteSession()”deleteSession(
id):Promise<void>
Defined in: chat/react/RemoteChatClient.ts:141
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”dispose()
Section titled “dispose()”dispose():
Promise<void>
Defined in: chat/react/RemoteChatClient.ts:82
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”getContextStats()
Section titled “getContextStats()”getContextStats(
sessionId):Promise<ContextStats|null>
Defined in: chat/react/RemoteChatClient.ts:154
Fetch context window stats from server. Returns null if stats not available (e.g. no messages sent yet).
Parameters
Section titled “Parameters”sessionId
Section titled “sessionId”Returns
Section titled “Returns”Promise<ContextStats | null>
Implementation of
Section titled “Implementation of”getSession()
Section titled “getSession()”getSession(
id):Promise<ChatSession<Record<string,unknown>> |null>
Defined in: chat/react/RemoteChatClient.ts:128
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<ChatSession<Record<string, unknown>> | null>
Implementation of
Section titled “Implementation of”listBackends()
Section titled “listBackends()”listBackends():
Promise<BackendInfo[]>
Defined in: chat/react/RemoteChatClient.ts:243
Returns
Section titled “Returns”Promise<BackendInfo[]>
Implementation of
Section titled “Implementation of”listModels()
Section titled “listModels()”listModels():
Promise<ModelInfo[]>
Defined in: chat/react/RemoteChatClient.ts:237
Returns
Section titled “Returns”Promise<ModelInfo[]>
Implementation of
Section titled “Implementation of”listProviders()
Section titled “listProviders()”listProviders():
Promise<ProviderConfig[]>
Defined in: chat/react/RemoteChatClient.ts:251
Returns
Section titled “Returns”Promise<ProviderConfig[]>
Implementation of
Section titled “Implementation of”listSessions()
Section titled “listSessions()”listSessions(
_options?):Promise<ChatSession<Record<string,unknown>>[]>
Defined in: chat/react/RemoteChatClient.ts:135
Parameters
Section titled “Parameters”_options?
Section titled “_options?”Returns
Section titled “Returns”Promise<ChatSession<Record<string, unknown>>[]>
Implementation of
Section titled “Implementation of”onSelectionChange()
Section titled “onSelectionChange()”onSelectionChange(
callback): () =>void
Defined in: chat/react/RemoteChatClient.ts:105
Parameters
Section titled “Parameters”callback
Section titled “callback”Returns
Section titled “Returns”():
void
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”onSessionChange()
Section titled “onSessionChange()”onSessionChange(
callback): () =>void
Defined in: chat/react/RemoteChatClient.ts:277
Parameters
Section titled “Parameters”callback
Section titled “callback”() => void
Returns
Section titled “Returns”():
void
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”selectProvider()
Section titled “selectProvider()”selectProvider(
providerId):void
Defined in: chat/react/RemoteChatClient.ts:99
Parameters
Section titled “Parameters”providerId
Section titled “providerId”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”send()
Section titled “send()”send(
sessionId,message,options?):AsyncIterable<ChatEvent>
Defined in: chat/react/RemoteChatClient.ts:172
Send a message. Options are optional — the server handler resolves model and backend from provider selection state. Compare with IChatRuntime.send() where RuntimeSendOptions is required.
Parameters
Section titled “Parameters”sessionId
Section titled “sessionId”message
Section titled “message”string
options?
Section titled “options?”Returns
Section titled “Returns”AsyncIterable<ChatEvent>
Implementation of
Section titled “Implementation of”switchSession()
Section titled “switchSession()”switchSession(
id):Promise<ChatSession<Record<string,unknown>>>
Defined in: chat/react/RemoteChatClient.ts:161
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<ChatSession<Record<string, unknown>>>
Implementation of
Section titled “Implementation of”updateProvider()
Section titled “updateProvider()”updateProvider(
id,changes):Promise<void>
Defined in: chat/react/RemoteChatClient.ts:263
Parameters
Section titled “Parameters”string
changes
Section titled “changes”Partial<Omit<ProviderConfig, "id" | "createdAt">>
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Interfaces
Section titled “Interfaces”AuthFormProps
Section titled “AuthFormProps”Defined in: chat/react/auth/types.ts:8
Props passed to per-backend auth form components. Each backend implements its own form using these props.
Properties
Section titled “Properties”auth:
UseRemoteAuthReturn
Defined in: chat/react/auth/types.ts:10
The remote auth hook instance, pre-configured for this backend.
onAuthComplete()
Section titled “onAuthComplete()”onAuthComplete: () =>
void
Defined in: chat/react/auth/types.ts:12
Called when authentication completes successfully.
Returns
Section titled “Returns”void
BackendSelectorProps
Section titled “BackendSelectorProps”Defined in: chat/react/BackendSelector.ts:9
Props for the BackendSelector component.
Properties
Section titled “Properties”backends
Section titled “backends”backends:
BackendInfo[]
Defined in: chat/react/BackendSelector.ts:10
className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/BackendSelector.ts:12
onSelect()
Section titled “onSelect()”onSelect: (
name) =>void
Defined in: chat/react/BackendSelector.ts:11
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
ChatHeaderProps
Section titled “ChatHeaderProps”Defined in: chat/react/ChatHeader.ts:15
Props for the ChatHeader component.
Properties
Section titled “Properties”backends?
Section titled “backends?”
optionalbackends:BackendInfo[]
Defined in: chat/react/ChatHeader.ts:23
Available backends list.
BackendSelectorComponent?
Section titled “BackendSelectorComponent?”
optionalBackendSelectorComponent:ComponentType<BackendSelectorProps>
Defined in: chat/react/ChatHeader.ts:33
Slot override for BackendSelector.
hasProviders?
Section titled “hasProviders?”
optionalhasProviders:boolean
Defined in: chat/react/ChatHeader.ts:21
Whether providers are configured (hides model selector when true).
models?
Section titled “models?”
optionalmodels:ModelOption[]
Defined in: chat/react/ChatHeader.ts:25
Available models list.
ModelSelectorComponent?
Section titled “ModelSelectorComponent?”
optionalModelSelectorComponent:ComponentType<ModelSelectorProps>
Defined in: chat/react/ChatHeader.ts:35
Slot override for ModelSelector.
onBackendSelect()?
Section titled “onBackendSelect()?”
optionalonBackendSelect: (name) =>void
Defined in: chat/react/ChatHeader.ts:29
Backend selection handler.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onModelSelect()?
Section titled “onModelSelect()?”
optionalonModelSelect: (modelId) =>void
Defined in: chat/react/ChatHeader.ts:31
Model selection handler.
Parameters
Section titled “Parameters”modelId
Section titled “modelId”string
Returns
Section titled “Returns”void
selectedModel?
Section titled “selectedModel?”
optionalselectedModel:string
Defined in: chat/react/ChatHeader.ts:27
Currently selected model.
showBackendSelector?
Section titled “showBackendSelector?”
optionalshowBackendSelector:boolean
Defined in: chat/react/ChatHeader.ts:17
Whether to show backend selector. Default: false.
showModelSelector?
Section titled “showModelSelector?”
optionalshowModelSelector:boolean
Defined in: chat/react/ChatHeader.ts:19
Whether to show model selector. Default: true.
ChatInputAreaProps
Section titled “ChatInputAreaProps”Defined in: chat/react/ChatInputArea.ts:16
Props for the ChatInputArea component.
Properties
Section titled “Properties”activeProviderId?
Section titled “activeProviderId?”
optionalactiveProviderId:string
Defined in: chat/react/ChatInputArea.ts:30
Active provider ID.
ComposerComponent?
Section titled “ComposerComponent?”
optionalComposerComponent:ComponentType<ComposerProps>
Defined in: chat/react/ChatInputArea.ts:40
Slot override for Composer.
isGenerating?
Section titled “isGenerating?”
optionalisGenerating:boolean
Defined in: chat/react/ChatInputArea.ts:22
Whether generation is in progress.
models?
Section titled “models?”
optionalmodels:ModelOption[]
Defined in: chat/react/ChatInputArea.ts:28
Available models.
onSelectModel()?
Section titled “onSelectModel()?”
optionalonSelectModel: (modelId) =>void
Defined in: chat/react/ChatInputArea.ts:36
Model selection handler.
Parameters
Section titled “Parameters”modelId
Section titled “modelId”string
Returns
Section titled “Returns”void
onSelectProvider()?
Section titled “onSelectProvider()?”
optionalonSelectProvider: (id) =>void
Defined in: chat/react/ChatInputArea.ts:34
Provider selection handler.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onSend()
Section titled “onSend()”onSend: (
message) =>void
Defined in: chat/react/ChatInputArea.ts:18
Send message handler.
Parameters
Section titled “Parameters”message
Section titled “message”string
Returns
Section titled “Returns”void
onSettingsClick()?
Section titled “onSettingsClick()?”
optionalonSettingsClick: () =>void
Defined in: chat/react/ChatInputArea.ts:38
Settings button handler.
Returns
Section titled “Returns”void
onStop()?
Section titled “onStop()?”
optionalonStop: () =>void
Defined in: chat/react/ChatInputArea.ts:20
Stop generation handler.
Returns
Section titled “Returns”void
placeholder?
Section titled “placeholder?”
optionalplaceholder:string
Defined in: chat/react/ChatInputArea.ts:24
Placeholder text for the textarea.
ProviderModelSelectorComponent?
Section titled “ProviderModelSelectorComponent?”
optionalProviderModelSelectorComponent:ComponentType<ProviderModelSelectorProps>
Defined in: chat/react/ChatInputArea.ts:42
Slot override for ProviderModelSelector.
providers?
Section titled “providers?”
optionalproviders:ProviderConfig[]
Defined in: chat/react/ChatInputArea.ts:26
Available providers.
selectedModel?
Section titled “selectedModel?”
optionalselectedModel:string
Defined in: chat/react/ChatInputArea.ts:32
Selected model.
usage?
Section titled “usage?”
optionalusage:ChatUsage|null
Defined in: chat/react/ChatInputArea.ts:44
Token usage data to display.
ChatLayoutProps
Section titled “ChatLayoutProps”Defined in: chat/react/ChatLayout.ts:11
Props for the ChatLayout component.
Properties
Section titled “Properties”children
Section titled “children”children:
ReactNode
Defined in: chat/react/ChatLayout.ts:13
Main chat content (thread, input area, etc.).
className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/ChatLayout.ts:19
CSS class on the root element.
overlay?
Section titled “overlay?”
optionaloverlay:ReactNode|ReactNode[]
Defined in: chat/react/ChatLayout.ts:17
Modal/overlay content. Accepts a single node or array of nodes.
sidebar?
Section titled “sidebar?”
optionalsidebar:ReactNode
Defined in: chat/react/ChatLayout.ts:15
Sidebar content (thread list, session list, etc.).
ChatSettingsOverlayProps
Section titled “ChatSettingsOverlayProps”Defined in: chat/react/ChatSettingsOverlay.ts:13
Props for the ChatSettingsOverlay component.
Properties
Section titled “Properties”authBaseUrl?
Section titled “authBaseUrl?”
optionalauthBaseUrl:string
Defined in: chat/react/ChatSettingsOverlay.ts:21
Auth API base URL.
onAuthCompleted()?
Section titled “onAuthCompleted()?”
optionalonAuthCompleted: (backend) =>void
Defined in: chat/react/ChatSettingsOverlay.ts:29
Called when authentication succeeds. Parent should refresh providers.
Parameters
Section titled “Parameters”backend
Section titled “backend”string
Returns
Section titled “Returns”void
onClose()
Section titled “onClose()”onClose: () =>
void
Defined in: chat/react/ChatSettingsOverlay.ts:17
Close handler.
Returns
Section titled “Returns”void
onProviderCreated()?
Section titled “onProviderCreated()?”
optionalonProviderCreated: (provider) =>void
Defined in: chat/react/ChatSettingsOverlay.ts:23
Provider created handler.
Parameters
Section titled “Parameters”provider
Section titled “provider”backend
Section titled “backend”string
label?
Section titled “label?”string
string
Returns
Section titled “Returns”void
onProviderDeleted()?
Section titled “onProviderDeleted()?”
optionalonProviderDeleted: (id) =>void
Defined in: chat/react/ChatSettingsOverlay.ts:25
Provider deleted handler.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onProviderUpdated()?
Section titled “onProviderUpdated()?”
optionalonProviderUpdated: (id,changes) =>void
Defined in: chat/react/ChatSettingsOverlay.ts:27
Provider updated handler.
Parameters
Section titled “Parameters”string
changes
Section titled “changes”Partial<ProviderConfig>
Returns
Section titled “Returns”void
open:
boolean
Defined in: chat/react/ChatSettingsOverlay.ts:15
Whether the overlay is visible.
providers?
Section titled “providers?”
optionalproviders:ProviderConfig[]
Defined in: chat/react/ChatSettingsOverlay.ts:19
Available providers.
ProviderSettingsComponent?
Section titled “ProviderSettingsComponent?”
optionalProviderSettingsComponent:ComponentType<ProviderSettingsProps>
Defined in: chat/react/ChatSettingsOverlay.ts:31
Slot override for ProviderSettings.
ChatUIProps
Section titled “ChatUIProps”Defined in: chat/react/ChatUI.ts:80
Props for the ChatUI composite component.
Properties
Section titled “Properties”authBaseUrl?
Section titled “authBaseUrl?”
optionalauthBaseUrl:string
Defined in: chat/react/ChatUI.ts:96
Base URL for auth API (needed by ProviderSettings).
className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/ChatUI.ts:86
CSS class on the root element.
placeholder?
Section titled “placeholder?”
optionalplaceholder:string
Defined in: chat/react/ChatUI.ts:98
Placeholder text for the Composer textarea.
runtime
Section titled “runtime”runtime:
IChatClient
Defined in: chat/react/ChatUI.ts:82
The chat runtime or client instance. ChatUI wraps it in ChatProvider. Accepts IChatClient.
showBackendSelector?
Section titled “showBackendSelector?”
optionalshowBackendSelector:boolean
Defined in: chat/react/ChatUI.ts:92
Show the backend selector in header. Default: false.
showModelSelector?
Section titled “showModelSelector?”
optionalshowModelSelector:boolean
Defined in: chat/react/ChatUI.ts:90
Show the model selector header. Default: true.
showProviderSelector?
Section titled “showProviderSelector?”
optionalshowProviderSelector:boolean
Defined in: chat/react/ChatUI.ts:94
Show the provider selector near composer. Default: auto (true when providers available).
showSidebar?
Section titled “showSidebar?”
optionalshowSidebar:boolean
Defined in: chat/react/ChatUI.ts:88
Show the session sidebar. Default: true.
slots?
Section titled “slots?”
optionalslots:ChatUISlots
Defined in: chat/react/ChatUI.ts:84
Slot overrides for sub-components.
ChatUISlots
Section titled “ChatUISlots”Defined in: chat/react/ChatUI.ts:50
Slot overrides for ChatUI sub-components.
Properties
Section titled “Properties”authDialog?
Section titled “authDialog?”
optionalauthDialog:ReactNode
Defined in: chat/react/ChatUI.ts:70
Custom auth dialog element rendered when provided.
backendSelector?
Section titled “backendSelector?”
optionalbackendSelector:ComponentType<BackendSelectorProps>
Defined in: chat/react/ChatUI.ts:60
Replace the BackendSelector component.
composer?
Section titled “composer?”
optionalcomposer:ComponentType<ComposerProps>
Defined in: chat/react/ChatUI.ts:54
Replace the Composer component.
contextStats?
Section titled “contextStats?”
optionalcontextStats:ComponentType<ContextStatsDisplayProps>
Defined in: chat/react/ChatUI.ts:68
Replace the ContextStatsDisplay component.
modelSelector?
Section titled “modelSelector?”
optionalmodelSelector:ComponentType<ModelSelectorProps>
Defined in: chat/react/ChatUI.ts:58
Replace the ModelSelector component (used in header when no providers).
providerModelSelector?
Section titled “providerModelSelector?”
optionalproviderModelSelector:ComponentType<ProviderModelSelectorProps>
Defined in: chat/react/ChatUI.ts:64
Replace the unified ProviderModelSelector component (near composer).
providerSelector?
Section titled “providerSelector?”
optionalproviderSelector:ComponentType<ProviderSelectorProps>
Defined in: chat/react/ChatUI.ts:62
Replace the ProviderSelector component (legacy, use providerModelSelector).
providerSettings?
Section titled “providerSettings?”
optionalproviderSettings:ComponentType<ProviderSettingsProps>
Defined in: chat/react/ChatUI.ts:66
Replace the ProviderSettings component.
renderMessage()?
Section titled “renderMessage()?”
optionalrenderMessage: (message,index) =>ReactNode
Defined in: chat/react/ChatUI.ts:72
Custom message renderer (forwarded to ThreadProvider).
Parameters
Section titled “Parameters”message
Section titled “message”number
Returns
Section titled “Returns”ReactNode
renderThinkingBlock()?
Section titled “renderThinkingBlock()?”
optionalrenderThinkingBlock: (part,index) =>ReactNode
Defined in: chat/react/ChatUI.ts:76
Custom thinking block renderer (forwarded to ThreadProvider).
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
renderToolCall()?
Section titled “renderToolCall()?”
optionalrenderToolCall: (part,index) =>ReactNode
Defined in: chat/react/ChatUI.ts:74
Custom tool call renderer (forwarded to ThreadProvider).
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
thread?
Section titled “thread?”
optionalthread:ComponentType<ThreadProps>
Defined in: chat/react/ChatUI.ts:52
Replace the Thread component.
threadList?
Section titled “threadList?”
optionalthreadList:ComponentType<ThreadListProps>
Defined in: chat/react/ChatUI.ts:56
Replace the ThreadList (sidebar) component.
ChatUsage
Section titled “ChatUsage”Defined in: chat/react/useChat.ts:18
Token usage data from the last completed response.
Properties
Section titled “Properties”completionTokens
Section titled “completionTokens”completionTokens:
number
Defined in: chat/react/useChat.ts:20
model?
Section titled “model?”
optionalmodel:string
Defined in: chat/react/useChat.ts:22
promptTokens
Section titled “promptTokens”promptTokens:
number
Defined in: chat/react/useChat.ts:19
totalTokens
Section titled “totalTokens”totalTokens:
number
Defined in: chat/react/useChat.ts:21
ComposerProps
Section titled “ComposerProps”Defined in: chat/react/Composer.ts:11
Props for the Composer component.
Properties
Section titled “Properties”className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/Composer.ts:18
disabled?
Section titled “disabled?”
optionaldisabled:boolean
Defined in: chat/react/Composer.ts:15
isGenerating?
Section titled “isGenerating?”
optionalisGenerating:boolean
Defined in: chat/react/Composer.ts:14
maxRows?
Section titled “maxRows?”
optionalmaxRows:number
Defined in: chat/react/Composer.ts:17
onSend()
Section titled “onSend()”onSend: (
text) =>void
Defined in: chat/react/Composer.ts:12
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onStop()?
Section titled “onStop()?”
optionalonStop: () =>void
Defined in: chat/react/Composer.ts:13
Returns
Section titled “Returns”void
placeholder?
Section titled “placeholder?”
optionalplaceholder:string
Defined in: chat/react/Composer.ts:16
ContextStatsDisplayProps
Section titled “ContextStatsDisplayProps”Defined in: chat/react/ContextStatsDisplay.ts:5
Props for the ContextStatsDisplay component.
Properties
Section titled “Properties”className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/ContextStatsDisplay.ts:9
CSS class on the root element.
stats:
ContextStats|null
Defined in: chat/react/ContextStatsDisplay.ts:7
Context stats from runtime.getContextStats(sessionId). Null = nothing to display.
MarkdownRendererProps
Section titled “MarkdownRendererProps”Defined in: chat/react/MarkdownRenderer.ts:4
Props for the MarkdownRenderer component.
Properties
Section titled “Properties”content
Section titled “content”content:
string
Defined in: chat/react/MarkdownRenderer.ts:5
renderCode()?
Section titled “renderCode()?”
optionalrenderCode: (code,language?) =>ReactNode
Defined in: chat/react/MarkdownRenderer.ts:6
Parameters
Section titled “Parameters”string
language?
Section titled “language?”string
Returns
Section titled “Returns”ReactNode
renderLink()?
Section titled “renderLink()?”
optionalrenderLink: (href,text) =>ReactNode
Defined in: chat/react/MarkdownRenderer.ts:7
Parameters
Section titled “Parameters”string
string
Returns
Section titled “Returns”ReactNode
MessageProps
Section titled “MessageProps”Defined in: chat/react/Message.ts:16
Props for the Message component.
Properties
Section titled “Properties”message
Section titled “message”message:
ChatMessage
Defined in: chat/react/Message.ts:17
renderFile()?
Section titled “renderFile()?”
optionalrenderFile: (part,index) =>ReactNode
Defined in: chat/react/Message.ts:22
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
renderReasoning()?
Section titled “renderReasoning()?”
optionalrenderReasoning: (part,index) =>ReactNode
Defined in: chat/react/Message.ts:19
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
renderSource()?
Section titled “renderSource()?”
optionalrenderSource: (part,index) =>ReactNode
Defined in: chat/react/Message.ts:21
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
renderText()?
Section titled “renderText()?”
optionalrenderText: (part,index) =>ReactNode
Defined in: chat/react/Message.ts:18
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
renderToolCall()?
Section titled “renderToolCall()?”
optionalrenderToolCall: (part,index) =>ReactNode
Defined in: chat/react/Message.ts:20
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
ModelOption
Section titled “ModelOption”Defined in: chat/react/useModels.ts:5
Model display option returned by useModels (mapped from core ModelInfo).
Properties
Section titled “Properties”id:
string
Defined in: chat/react/useModels.ts:6
name:
string
Defined in: chat/react/useModels.ts:7
provider?
Section titled “provider?”
optionalprovider:string
Defined in: chat/react/useModels.ts:10
Provider/backend name for multi-provider context.
optionaltier:string
Defined in: chat/react/useModels.ts:8
ModelSelectorProps
Section titled “ModelSelectorProps”Defined in: chat/react/ModelSelector.ts:13
Props for the ModelSelector component.
Properties
Section titled “Properties”allowFreeText?
Section titled “allowFreeText?”
optionalallowFreeText:boolean
Defined in: chat/react/ModelSelector.ts:20
Allow free-text model input when models list is empty. Default: true.
className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/ModelSelector.ts:18
models
Section titled “models”models:
ModelOption[]
Defined in: chat/react/ModelSelector.ts:14
onSelect()
Section titled “onSelect()”onSelect: (
modelId) =>void
Defined in: chat/react/ModelSelector.ts:16
Parameters
Section titled “Parameters”modelId
Section titled “modelId”string
Returns
Section titled “Returns”void
placeholder?
Section titled “placeholder?”
optionalplaceholder:string
Defined in: chat/react/ModelSelector.ts:17
selectedModel?
Section titled “selectedModel?”
optionalselectedModel:string
Defined in: chat/react/ModelSelector.ts:15
PendingToolRequest
Section titled “PendingToolRequest”Defined in: chat/react/useToolApproval.ts:5
A pending tool call requiring user approval.
Properties
Section titled “Properties”messageId
Section titled “messageId”messageId:
string
Defined in: chat/react/useToolApproval.ts:9
toolArgs
Section titled “toolArgs”toolArgs:
Record<string,unknown>
Defined in: chat/react/useToolApproval.ts:8
toolCallId
Section titled “toolCallId”toolCallId:
string
Defined in: chat/react/useToolApproval.ts:6
toolName
Section titled “toolName”toolName:
string
Defined in: chat/react/useToolApproval.ts:7
PermissionDialogProps
Section titled “PermissionDialogProps”Defined in: chat/react/PermissionDialog.ts:5
Props for PermissionDialog.
Properties
Section titled “Properties”className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/PermissionDialog.ts:18
onApprove()
Section titled “onApprove()”onApprove: (
toolCallId) =>void
Defined in: chat/react/PermissionDialog.ts:9
Called when user approves a tool call.
Parameters
Section titled “Parameters”toolCallId
Section titled “toolCallId”string
Returns
Section titled “Returns”void
onApproveAll()?
Section titled “onApproveAll()?”
optionalonApproveAll: () =>void
Defined in: chat/react/PermissionDialog.ts:13
Optional: approve all pending at once.
Returns
Section titled “Returns”void
onDeny()
Section titled “onDeny()”onDeny: (
toolCallId) =>void
Defined in: chat/react/PermissionDialog.ts:11
Called when user denies a tool call.
Parameters
Section titled “Parameters”toolCallId
Section titled “toolCallId”string
Returns
Section titled “Returns”void
onDenyAll()?
Section titled “onDenyAll()?”
optionalonDenyAll: () =>void
Defined in: chat/react/PermissionDialog.ts:15
Optional: deny all pending at once.
Returns
Section titled “Returns”void
renderArgs()?
Section titled “renderArgs()?”
optionalrenderArgs: (args,toolName) =>ReactNode
Defined in: chat/react/PermissionDialog.ts:17
Custom renderer for tool arguments.
Parameters
Section titled “Parameters”Record<string, unknown>
toolName
Section titled “toolName”string
Returns
Section titled “Returns”ReactNode
requests
Section titled “requests”requests:
PendingToolRequest[]
Defined in: chat/react/PermissionDialog.ts:7
List of pending tool requests awaiting approval.
ProviderModelItem
Section titled “ProviderModelItem”Defined in: chat/react/ProviderModelSelector.ts:14
A unified item rendered in the ProviderModelSelector dropdown.
Properties
Section titled “Properties”id:
string
Defined in: chat/react/ProviderModelSelector.ts:15
label:
string
Defined in: chat/react/ProviderModelSelector.ts:16
sublabel?
Section titled “sublabel?”
optionalsublabel:string
Defined in: chat/react/ProviderModelSelector.ts:17
optionaltier:string
Defined in: chat/react/ProviderModelSelector.ts:18
type:
"model"|"provider"
Defined in: chat/react/ProviderModelSelector.ts:19
ProviderModelSelectorProps
Section titled “ProviderModelSelectorProps”Defined in: chat/react/ProviderModelSelector.ts:23
Props for the ProviderModelSelector component.
Properties
Section titled “Properties”activeProviderId?
Section titled “activeProviderId?”
optionalactiveProviderId:string
Defined in: chat/react/ProviderModelSelector.ts:29
Currently selected provider ID.
className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/ProviderModelSelector.ts:40
models?
Section titled “models?”
optionalmodels:ModelOption[]
Defined in: chat/react/ProviderModelSelector.ts:27
Available models. Used when providers is empty or undefined.
onSelectModel()?
Section titled “onSelectModel()?”
optionalonSelectModel: (modelId) =>void
Defined in: chat/react/ProviderModelSelector.ts:35
Called when a model is selected (fallback mode).
Parameters
Section titled “Parameters”modelId
Section titled “modelId”string
Returns
Section titled “Returns”void
onSelectProvider()?
Section titled “onSelectProvider()?”
optionalonSelectProvider: (id) =>void
Defined in: chat/react/ProviderModelSelector.ts:33
Called when a provider is selected.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onSettingsClick()?
Section titled “onSettingsClick()?”
optionalonSettingsClick: () =>void
Defined in: chat/react/ProviderModelSelector.ts:37
Called when settings gear is clicked.
Returns
Section titled “Returns”void
placeholder?
Section titled “placeholder?”
optionalplaceholder:string
Defined in: chat/react/ProviderModelSelector.ts:39
Placeholder text for the trigger button.
providers?
Section titled “providers?”
optionalproviders:ProviderConfig[]
Defined in: chat/react/ProviderModelSelector.ts:25
Configured providers (backend + model combos). When non-empty, provider mode is used.
selectedModel?
Section titled “selectedModel?”
optionalselectedModel:string
Defined in: chat/react/ProviderModelSelector.ts:31
Currently selected model ID (fallback mode).
ProviderSelectorProps
Section titled “ProviderSelectorProps”Defined in: chat/react/ProviderSelector.ts:13
Props for the ProviderSelector component.
Properties
Section titled “Properties”activeProviderId?
Section titled “activeProviderId?”
optionalactiveProviderId:string
Defined in: chat/react/ProviderSelector.ts:15
className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/ProviderSelector.ts:18
onSelect()
Section titled “onSelect()”onSelect: (
id) =>void
Defined in: chat/react/ProviderSelector.ts:16
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onSettingsClick()?
Section titled “onSettingsClick()?”
optionalonSettingsClick: () =>void
Defined in: chat/react/ProviderSelector.ts:17
Returns
Section titled “Returns”void
providers
Section titled “providers”providers:
ProviderConfig[]
Defined in: chat/react/ProviderSelector.ts:14
ProviderSettingsProps
Section titled “ProviderSettingsProps”Defined in: chat/react/ProviderSettings.ts:19
Props for the ProviderSettings component.
Properties
Section titled “Properties”authBaseUrl?
Section titled “authBaseUrl?”
optionalauthBaseUrl:string
Defined in: chat/react/ProviderSettings.ts:27
className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/ProviderSettings.ts:28
onAuthCompleted()?
Section titled “onAuthCompleted()?”
optionalonAuthCompleted: (backend) =>void
Defined in: chat/react/ProviderSettings.ts:26
Called when authentication succeeds (before configure step). Parent should refresh providers.
Parameters
Section titled “Parameters”backend
Section titled “backend”string
Returns
Section titled “Returns”void
onClose()?
Section titled “onClose()?”
optionalonClose: () =>void
Defined in: chat/react/ProviderSettings.ts:21
Returns
Section titled “Returns”void
onProviderCreated()?
Section titled “onProviderCreated()?”
optionalonProviderCreated: (p) =>void
Defined in: chat/react/ProviderSettings.ts:22
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onProviderDeleted()?
Section titled “onProviderDeleted()?”
optionalonProviderDeleted: (id) =>void
Defined in: chat/react/ProviderSettings.ts:23
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onProviderUpdated()?
Section titled “onProviderUpdated()?”
optionalonProviderUpdated: (id,changes) =>void
Defined in: chat/react/ProviderSettings.ts:24
Parameters
Section titled “Parameters”string
changes
Section titled “changes”label?
Section titled “label?”string
model?
Section titled “model?”string
Returns
Section titled “Returns”void
providers
Section titled “providers”providers:
ProviderConfig[]
Defined in: chat/react/ProviderSettings.ts:20
RemoteChatClientOptions
Section titled “RemoteChatClientOptions”Defined in: chat/react/RemoteChatClient.ts:48
Standard server endpoint contract. Server implementations expose these routes to work with RemoteChatClient.
POST {baseUrl}/sessions/create — Create session GET {baseUrl}/sessions/{id} — Get session GET {baseUrl}/sessions — List sessions DELETE {baseUrl}/sessions/{id} — Delete session GET {baseUrl}/sessions/{id}/context-stats — Get context window stats POST {baseUrl}/send — Send message (SSE stream response) POST {baseUrl}/abort — Abort current stream GET {baseUrl}/models — List models GET {baseUrl}/backends — List backends POST {baseUrl}/model/switch — Switch model POST {baseUrl}/provider/switch — Switch provider (backend + model) GET {baseUrl}/providers — List providers POST {baseUrl}/providers — Create provider PUT {baseUrl}/providers/{id} — Update provider DELETE {baseUrl}/providers/{id} — Delete provider
Properties
Section titled “Properties”baseUrl
Section titled “baseUrl”baseUrl:
string
Defined in: chat/react/RemoteChatClient.ts:50
Base URL for API endpoints (e.g. “/api” or “https://example.com/api”)
fetch()?
Section titled “fetch()?”
optionalfetch: {(input,init?):Promise<Response>; (input,init?):Promise<Response>; }
Defined in: chat/react/RemoteChatClient.ts:54
Custom fetch implementation for testability
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”URL | RequestInfo
RequestInit
Returns
Section titled “Returns”Promise<Response>
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”string | URL | Request
RequestInit
Returns
Section titled “Returns”Promise<Response>
headers?
Section titled “headers?”
optionalheaders:Record<string,string>
Defined in: chat/react/RemoteChatClient.ts:52
Optional headers for all requests (e.g. auth tokens)
ThinkingBlockProps
Section titled “ThinkingBlockProps”Defined in: chat/react/ThinkingBlock.ts:4
Props for the ThinkingBlock component.
Properties
Section titled “Properties”defaultOpen?
Section titled “defaultOpen?”
optionaldefaultOpen:boolean
Defined in: chat/react/ThinkingBlock.ts:7
isStreaming?
Section titled “isStreaming?”
optionalisStreaming:boolean
Defined in: chat/react/ThinkingBlock.ts:6
text:
string
Defined in: chat/react/ThinkingBlock.ts:5
ThreadListProps
Section titled “ThreadListProps”Defined in: chat/react/ThreadList.ts:45
Props for the ThreadList component.
Properties
Section titled “Properties”activeSessionId?
Section titled “activeSessionId?”
optionalactiveSessionId:string
Defined in: chat/react/ThreadList.ts:47
className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/ThreadList.ts:53
onCreate()?
Section titled “onCreate()?”
optionalonCreate: () =>void
Defined in: chat/react/ThreadList.ts:49
Returns
Section titled “Returns”void
onDelete()?
Section titled “onDelete()?”
optionalonDelete: (id) =>void
Defined in: chat/react/ThreadList.ts:50
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onSearchChange()?
Section titled “onSearchChange()?”
optionalonSearchChange: (query) =>void
Defined in: chat/react/ThreadList.ts:52
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onSelect()
Section titled “onSelect()”onSelect: (
id) =>void
Defined in: chat/react/ThreadList.ts:48
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
searchQuery?
Section titled “searchQuery?”
optionalsearchQuery:string
Defined in: chat/react/ThreadList.ts:51
sessions
Section titled “sessions”sessions:
SessionItem[]
Defined in: chat/react/ThreadList.ts:46
ThreadProps
Section titled “ThreadProps”Defined in: chat/react/Thread.ts:15
Props for the Thread component.
Properties
Section titled “Properties”autoScroll?
Section titled “autoScroll?”
optionalautoScroll:boolean
Defined in: chat/react/Thread.ts:18
className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/Thread.ts:19
isGenerating?
Section titled “isGenerating?”
optionalisGenerating:boolean
Defined in: chat/react/Thread.ts:17
messages
Section titled “messages”messages:
ChatMessage<unknown>[]
Defined in: chat/react/Thread.ts:16
virtualize?
Section titled “virtualize?”
optionalvirtualize:boolean|VirtualizeOptions
Defined in: chat/react/Thread.ts:25
Enable windowed rendering for large message lists.
Pass true for defaults or an options object.
When enabled, only visible messages (plus overscan) are mounted.
ThreadProviderProps
Section titled “ThreadProviderProps”Defined in: chat/react/ThreadSlots.ts:19
Props for ThreadProvider.
Extends
Section titled “Extends”Properties
Section titled “Properties”children
Section titled “children”children:
ReactNode
Defined in: chat/react/ThreadSlots.ts:20
renderMessage()?
Section titled “renderMessage()?”
optionalrenderMessage: (message,index) =>ReactNode
Defined in: chat/react/ThreadSlots.ts:11
Parameters
Section titled “Parameters”message
Section titled “message”number
Returns
Section titled “Returns”ReactNode
Inherited from
Section titled “Inherited from”ThreadSlotOverrides.renderMessage
renderThinkingBlock()?
Section titled “renderThinkingBlock()?”
optionalrenderThinkingBlock: (part,index) =>ReactNode
Defined in: chat/react/ThreadSlots.ts:13
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
Inherited from
Section titled “Inherited from”ThreadSlotOverrides.renderThinkingBlock
renderToolCall()?
Section titled “renderToolCall()?”
optionalrenderToolCall: (part,index) =>ReactNode
Defined in: chat/react/ThreadSlots.ts:12
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
Inherited from
Section titled “Inherited from”ThreadSlotOverrides.renderToolCall
ThreadSlotOverrides
Section titled “ThreadSlotOverrides”Defined in: chat/react/ThreadSlots.ts:10
Slot override functions for Thread customization.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”renderMessage()?
Section titled “renderMessage()?”
optionalrenderMessage: (message,index) =>ReactNode
Defined in: chat/react/ThreadSlots.ts:11
Parameters
Section titled “Parameters”message
Section titled “message”number
Returns
Section titled “Returns”ReactNode
renderThinkingBlock()?
Section titled “renderThinkingBlock()?”
optionalrenderThinkingBlock: (part,index) =>ReactNode
Defined in: chat/react/ThreadSlots.ts:13
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
renderToolCall()?
Section titled “renderToolCall()?”
optionalrenderToolCall: (part,index) =>ReactNode
Defined in: chat/react/ThreadSlots.ts:12
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”ReactNode
ToolCallViewProps
Section titled “ToolCallViewProps”Defined in: chat/react/ToolCallView.ts:5
Props for the ToolCallView component.
Properties
Section titled “Properties”onApprove()?
Section titled “onApprove()?”
optionalonApprove: () =>void
Defined in: chat/react/ToolCallView.ts:7
Returns
Section titled “Returns”void
onDeny()?
Section titled “onDeny()?”
optionalonDeny: () =>void
Defined in: chat/react/ToolCallView.ts:8
Returns
Section titled “Returns”void
part:
ToolCallPart
Defined in: chat/react/ToolCallView.ts:6
renderArgs()?
Section titled “renderArgs()?”
optionalrenderArgs: (args) =>ReactNode
Defined in: chat/react/ToolCallView.ts:9
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”ReactNode
renderResult()?
Section titled “renderResult()?”
optionalrenderResult: (result) =>ReactNode
Defined in: chat/react/ToolCallView.ts:10
Parameters
Section titled “Parameters”result
Section titled “result”unknown
Returns
Section titled “Returns”ReactNode
UsageBadgeProps
Section titled “UsageBadgeProps”Defined in: chat/react/UsageBadge.ts:5
Props for the UsageBadge component.
Properties
Section titled “Properties”className?
Section titled “className?”
optionalclassName:string
Defined in: chat/react/UsageBadge.ts:7
usage:
ChatUsage|null
Defined in: chat/react/UsageBadge.ts:6
UseApiKeyAuthOptions
Section titled “UseApiKeyAuthOptions”Defined in: chat/react/auth/useApiKeyAuth.ts:12
Options for useApiKeyAuth.
Properties
Section titled “Properties”baseUrl
Section titled “baseUrl”baseUrl:
string
Defined in: chat/react/auth/useApiKeyAuth.ts:14
Base URL of the auth server (e.g. “/api/auth”)
fetch()?
Section titled “fetch()?”
optionalfetch: {(input,init?):Promise<Response>; (input,init?):Promise<Response>; }
Defined in: chat/react/auth/useApiKeyAuth.ts:20
Optional fetch override (for testing)
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”URL | RequestInfo
RequestInit
Returns
Section titled “Returns”Promise<Response>
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”string | URL | Request
RequestInit
Returns
Section titled “Returns”Promise<Response>
headers?
Section titled “headers?”
optionalheaders:Record<string,string>
Defined in: chat/react/auth/useApiKeyAuth.ts:22
Optional headers for all requests
onAuthenticated()?
Section titled “onAuthenticated()?”
optionalonAuthenticated: (token) =>void
Defined in: chat/react/auth/useApiKeyAuth.ts:16
Called after successful authentication
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onError()?
Section titled “onError()?”
optionalonError: (error) =>void
Defined in: chat/react/auth/useApiKeyAuth.ts:18
Called on authentication error
Parameters
Section titled “Parameters”Error
Returns
Section titled “Returns”void
UseApiKeyAuthReturn
Section titled “UseApiKeyAuthReturn”Defined in: chat/react/auth/useApiKeyAuth.ts:26
Return value from useApiKeyAuth.
Properties
Section titled “Properties”error:
Error|null
Defined in: chat/react/auth/useApiKeyAuth.ts:28
reset()
Section titled “reset()”reset: () =>
void
Defined in: chat/react/auth/useApiKeyAuth.ts:32
Returns
Section titled “Returns”void
status
Section titled “status”status:
"error"|"idle"|"pending"|"authenticated"
Defined in: chat/react/auth/useApiKeyAuth.ts:27
submit()
Section titled “submit()”submit: (
key,apiBaseUrl?) =>Promise<void>
Defined in: chat/react/auth/useApiKeyAuth.ts:31
Submit an API key (and optional provider base URL).
Parameters
Section titled “Parameters”string
apiBaseUrl?
Section titled “apiBaseUrl?”string
Returns
Section titled “Returns”Promise<void>
token:
AuthToken|null
Defined in: chat/react/auth/useApiKeyAuth.ts:29
UseBackendsReturn
Section titled “UseBackendsReturn”Defined in: chat/react/useBackends.ts:6
Return type for the useBackends hook.
Properties
Section titled “Properties”backends
Section titled “backends”backends:
BackendInfo[]
Defined in: chat/react/useBackends.ts:7
error:
Error|null
Defined in: chat/react/useBackends.ts:9
isLoading
Section titled “isLoading”isLoading:
boolean
Defined in: chat/react/useBackends.ts:8
refresh()
Section titled “refresh()”refresh: () =>
void
Defined in: chat/react/useBackends.ts:10
Returns
Section titled “Returns”void
UseChatOptions
Section titled “UseChatOptions”Defined in: chat/react/useChat.ts:8
Options for the useChat hook.
Properties
Section titled “Properties”autoDismissMs?
Section titled “autoDismissMs?”
optionalautoDismissMs:number
Defined in: chat/react/useChat.ts:14
Auto-dismiss errors after this many ms (0 = disabled, default: 0).
onError()?
Section titled “onError()?”
optionalonError: (error) =>void
Defined in: chat/react/useChat.ts:12
Called on error during send.
Parameters
Section titled “Parameters”Error
Returns
Section titled “Returns”void
sessionId?
Section titled “sessionId?”
optionalsessionId:string
Defined in: chat/react/useChat.ts:10
Session ID. If omitted, a new session is created on first send.
UseChatReturn
Section titled “UseChatReturn”Defined in: chat/react/useChat.ts:26
Return value from useChat.
Properties
Section titled “Properties”clearError()
Section titled “clearError()”clearError: () =>
void
Defined in: chat/react/useChat.ts:42
Clear the error state.
Returns
Section titled “Returns”void
error:
Error|null
Defined in: chat/react/useChat.ts:40
Current error, if any.
isGenerating
Section titled “isGenerating”isGenerating:
boolean
Defined in: chat/react/useChat.ts:36
Whether the assistant is currently generating.
messages
Section titled “messages”messages:
ChatMessage<unknown>[]
Defined in: chat/react/useChat.ts:30
Ordered messages in the current session.
newSession()
Section titled “newSession()”newSession: () =>
Promise<string>
Defined in: chat/react/useChat.ts:46
Create a new session, resetting messages.
Returns
Section titled “Returns”Promise<string>
retryLastMessage()
Section titled “retryLastMessage()”retryLastMessage: () =>
Promise<void>
Defined in: chat/react/useChat.ts:44
Retry the last failed message. No-op if no error or no last user message.
Returns
Section titled “Returns”Promise<void>
sendMessage()
Section titled “sendMessage()”sendMessage: (
content) =>Promise<void>
Defined in: chat/react/useChat.ts:32
Send a user message and trigger assistant response.
Parameters
Section titled “Parameters”content
Section titled “content”string
Returns
Section titled “Returns”Promise<void>
sessionId
Section titled “sessionId”sessionId:
string|null
Defined in: chat/react/useChat.ts:28
Current session ID (null until session created).
status
Section titled “status”status:
RuntimeStatus
Defined in: chat/react/useChat.ts:38
Current runtime status.
stop()
Section titled “stop()”stop: () =>
void
Defined in: chat/react/useChat.ts:34
Abort the current generation.
Returns
Section titled “Returns”void
usage:
ChatUsage|null
Defined in: chat/react/useChat.ts:48
Token usage from the last completed response.
UseClaudeAuthOptions
Section titled “UseClaudeAuthOptions”Defined in: chat/react/auth/useClaudeAuth.ts:12
Options for useClaudeAuth.
Properties
Section titled “Properties”baseUrl
Section titled “baseUrl”baseUrl:
string
Defined in: chat/react/auth/useClaudeAuth.ts:14
Base URL of the auth server (e.g. “/api/auth”)
fetch()?
Section titled “fetch()?”
optionalfetch: {(input,init?):Promise<Response>; (input,init?):Promise<Response>; }
Defined in: chat/react/auth/useClaudeAuth.ts:20
Optional fetch override (for testing)
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”URL | RequestInfo
RequestInit
Returns
Section titled “Returns”Promise<Response>
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”string | URL | Request
RequestInit
Returns
Section titled “Returns”Promise<Response>
headers?
Section titled “headers?”
optionalheaders:Record<string,string>
Defined in: chat/react/auth/useClaudeAuth.ts:22
Optional headers for all requests
onAuthenticated()?
Section titled “onAuthenticated()?”
optionalonAuthenticated: (token) =>void
Defined in: chat/react/auth/useClaudeAuth.ts:16
Called after successful authentication
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onError()?
Section titled “onError()?”
optionalonError: (error) =>void
Defined in: chat/react/auth/useClaudeAuth.ts:18
Called on authentication error
Parameters
Section titled “Parameters”Error
Returns
Section titled “Returns”void
UseClaudeAuthReturn
Section titled “UseClaudeAuthReturn”Defined in: chat/react/auth/useClaudeAuth.ts:26
Return value from useClaudeAuth.
Properties
Section titled “Properties”authorizeUrl
Section titled “authorizeUrl”authorizeUrl:
string|null
Defined in: chat/react/auth/useClaudeAuth.ts:30
complete()
Section titled “complete()”complete: (
codeOrUrl) =>Promise<void>
Defined in: chat/react/auth/useClaudeAuth.ts:34
Complete OAuth after redirect. Pass the code or callback URL.
Parameters
Section titled “Parameters”codeOrUrl
Section titled “codeOrUrl”string
Returns
Section titled “Returns”Promise<void>
error:
Error|null
Defined in: chat/react/auth/useClaudeAuth.ts:28
reset()
Section titled “reset()”reset: () =>
void
Defined in: chat/react/auth/useClaudeAuth.ts:35
Returns
Section titled “Returns”void
start()
Section titled “start()”start: () =>
Promise<void>
Defined in: chat/react/auth/useClaudeAuth.ts:32
Start OAuth flow. Sets authorizeUrl for user redirect.
Returns
Section titled “Returns”Promise<void>
status
Section titled “status”status:
"error"|"idle"|"pending"|"authenticated"
Defined in: chat/react/auth/useClaudeAuth.ts:27
token:
AuthToken|null
Defined in: chat/react/auth/useClaudeAuth.ts:29
UseCopilotAuthOptions
Section titled “UseCopilotAuthOptions”Defined in: chat/react/auth/useCopilotAuth.ts:12
Options for useCopilotAuth.
Properties
Section titled “Properties”baseUrl
Section titled “baseUrl”baseUrl:
string
Defined in: chat/react/auth/useCopilotAuth.ts:14
Base URL of the auth server (e.g. “/api/auth”)
fetch()?
Section titled “fetch()?”
optionalfetch: {(input,init?):Promise<Response>; (input,init?):Promise<Response>; }
Defined in: chat/react/auth/useCopilotAuth.ts:20
Optional fetch override (for testing)
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”URL | RequestInfo
RequestInit
Returns
Section titled “Returns”Promise<Response>
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”string | URL | Request
RequestInit
Returns
Section titled “Returns”Promise<Response>
headers?
Section titled “headers?”
optionalheaders:Record<string,string>
Defined in: chat/react/auth/useCopilotAuth.ts:22
Optional headers for all requests
onAuthenticated()?
Section titled “onAuthenticated()?”
optionalonAuthenticated: (token) =>void
Defined in: chat/react/auth/useCopilotAuth.ts:16
Called after successful authentication
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onError()?
Section titled “onError()?”
optionalonError: (error) =>void
Defined in: chat/react/auth/useCopilotAuth.ts:18
Called on authentication error
Parameters
Section titled “Parameters”Error
Returns
Section titled “Returns”void
UseCopilotAuthReturn
Section titled “UseCopilotAuthReturn”Defined in: chat/react/auth/useCopilotAuth.ts:26
Return value from useCopilotAuth.
Properties
Section titled “Properties”deviceCode
Section titled “deviceCode”deviceCode:
string|null
Defined in: chat/react/auth/useCopilotAuth.ts:30
error:
Error|null
Defined in: chat/react/auth/useCopilotAuth.ts:28
reset()
Section titled “reset()”reset: () =>
void
Defined in: chat/react/auth/useCopilotAuth.ts:34
Returns
Section titled “Returns”void
start()
Section titled “start()”start: () =>
Promise<void>
Defined in: chat/react/auth/useCopilotAuth.ts:33
Start the device flow. Shows deviceCode and verificationUrl, then polls for completion.
Returns
Section titled “Returns”Promise<void>
status
Section titled “status”status:
"error"|"idle"|"pending"|"authenticated"
Defined in: chat/react/auth/useCopilotAuth.ts:27
token:
AuthToken|null
Defined in: chat/react/auth/useCopilotAuth.ts:29
verificationUrl
Section titled “verificationUrl”verificationUrl:
string|null
Defined in: chat/react/auth/useCopilotAuth.ts:31
UseMessagesOptions
Section titled “UseMessagesOptions”Defined in: chat/react/useMessages.ts:7
Options for the useMessages hook.
Properties
Section titled “Properties”sessionId
Section titled “sessionId”sessionId:
string
Defined in: chat/react/useMessages.ts:9
Session ID to observe.
UseMessagesReturn
Section titled “UseMessagesReturn”Defined in: chat/react/useMessages.ts:13
Return value from useMessages.
Properties
Section titled “Properties”isLoaded
Section titled “isLoaded”isLoaded:
boolean
Defined in: chat/react/useMessages.ts:17
Whether the session was found.
messages
Section titled “messages”messages:
ChatMessage<unknown>[]
Defined in: chat/react/useMessages.ts:15
Ordered messages in the session.
UseModelsReturn
Section titled “UseModelsReturn”Defined in: chat/react/useModels.ts:14
Return type for the useModels hook.
Properties
Section titled “Properties”error:
Error|null
Defined in: chat/react/useModels.ts:17
isLoading
Section titled “isLoading”isLoading:
boolean
Defined in: chat/react/useModels.ts:16
models
Section titled “models”models:
ModelOption[]
Defined in: chat/react/useModels.ts:15
refresh()
Section titled “refresh()”refresh: () =>
void
Defined in: chat/react/useModels.ts:18
Returns
Section titled “Returns”void
search()
Section titled “search()”search: (
query) =>ModelOption[]
Defined in: chat/react/useModels.ts:19
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”UseProvidersReturn
Section titled “UseProvidersReturn”Defined in: chat/react/useProviders.ts:24
Return type for the useProviders hook.
Properties
Section titled “Properties”createProvider()
Section titled “createProvider()”createProvider: (
config) =>Promise<void>
Defined in: chat/react/useProviders.ts:29
Parameters
Section titled “Parameters”config
Section titled “config”Omit<ProviderConfig, "id" | "createdAt">
Returns
Section titled “Returns”Promise<void>
deleteProvider()
Section titled “deleteProvider()”deleteProvider: (
id) =>Promise<void>
Defined in: chat/react/useProviders.ts:31
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
error:
Error|null
Defined in: chat/react/useProviders.ts:27
isLoading
Section titled “isLoading”isLoading:
boolean
Defined in: chat/react/useProviders.ts:26
providers
Section titled “providers”providers:
ProviderConfig[]
Defined in: chat/react/useProviders.ts:25
refresh()
Section titled “refresh()”refresh: () =>
void
Defined in: chat/react/useProviders.ts:28
Returns
Section titled “Returns”void
selectProvider()
Section titled “selectProvider()”selectProvider: (
id) =>void
Defined in: chat/react/useProviders.ts:32
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
updateProvider()
Section titled “updateProvider()”updateProvider: (
id,changes) =>Promise<void>
Defined in: chat/react/useProviders.ts:30
Parameters
Section titled “Parameters”string
changes
Section titled “changes”Partial<Omit<ProviderConfig, "id" | "createdAt">>
Returns
Section titled “Returns”Promise<void>
UseRemoteAuthOptions
Section titled “UseRemoteAuthOptions”Defined in: chat/react/useRemoteAuth.ts:24
Options for the useRemoteAuth hook.
Properties
Section titled “Properties”backend
Section titled “backend”backend:
RemoteAuthBackend
Defined in: chat/react/useRemoteAuth.ts:26
Auth backend to use
baseUrl
Section titled “baseUrl”baseUrl:
string
Defined in: chat/react/useRemoteAuth.ts:28
Base URL of the auth server (e.g. “http://localhost:3456/api/auth”)
fetch()?
Section titled “fetch()?”
optionalfetch: {(input,init?):Promise<Response>; (input,init?):Promise<Response>; }
Defined in: chat/react/useRemoteAuth.ts:32
Optional fetch override (for testing)
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”URL | RequestInfo
RequestInit
Returns
Section titled “Returns”Promise<Response>
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”string | URL | Request
RequestInit
Returns
Section titled “Returns”Promise<Response>
headers?
Section titled “headers?”
optionalheaders:Record<string,string>
Defined in: chat/react/useRemoteAuth.ts:34
Optional headers for all requests
onAuthenticated()?
Section titled “onAuthenticated()?”
optionalonAuthenticated: (token) =>void
Defined in: chat/react/useRemoteAuth.ts:30
Called after successful authentication
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
UseRemoteAuthReturn
Section titled “UseRemoteAuthReturn”Defined in: chat/react/useRemoteAuth.ts:38
Return value from useRemoteAuth.
Properties
Section titled “Properties”authorizeUrl
Section titled “authorizeUrl”authorizeUrl:
string|null
Defined in: chat/react/useRemoteAuth.ts:47
clearTokens()
Section titled “clearTokens()”clearTokens: () =>
Promise<void>
Defined in: chat/react/useRemoteAuth.ts:60
Returns
Section titled “Returns”Promise<void>
completeOAuth()
Section titled “completeOAuth()”completeOAuth: (
codeOrUrl) =>Promise<void>
Defined in: chat/react/useRemoteAuth.ts:48
Parameters
Section titled “Parameters”codeOrUrl
Section titled “codeOrUrl”string
Returns
Section titled “Returns”Promise<void>
deviceCode
Section titled “deviceCode”deviceCode:
string|null
Defined in: chat/react/useRemoteAuth.ts:43
error:
Error|null
Defined in: chat/react/useRemoteAuth.ts:40
loadSavedTokens()
Section titled “loadSavedTokens()”loadSavedTokens: () =>
Promise<void>
Defined in: chat/react/useRemoteAuth.ts:58
Returns
Section titled “Returns”Promise<void>
reset()
Section titled “reset()”reset: () =>
void
Defined in: chat/react/useRemoteAuth.ts:55
Returns
Section titled “Returns”void
savedProviders
Section titled “savedProviders”savedProviders:
string[]
Defined in: chat/react/useRemoteAuth.ts:57
start()
Section titled “start()”start: (
provider?) =>Promise<void>
Defined in: chat/react/useRemoteAuth.ts:52
Parameters
Section titled “Parameters”provider?
Section titled “provider?”Returns
Section titled “Returns”Promise<void>
startDeviceFlow()
Section titled “startDeviceFlow()”startDeviceFlow: () =>
Promise<void>
Defined in: chat/react/useRemoteAuth.ts:42
Returns
Section titled “Returns”Promise<void>
startOAuthFlow()
Section titled “startOAuthFlow()”startOAuthFlow: () =>
Promise<void>
Defined in: chat/react/useRemoteAuth.ts:46
Returns
Section titled “Returns”Promise<void>
status
Section titled “status”status:
RemoteAuthStatus
Defined in: chat/react/useRemoteAuth.ts:39
submitApiKey()
Section titled “submitApiKey()”submitApiKey: (
key,baseUrl?) =>Promise<void>
Defined in: chat/react/useRemoteAuth.ts:50
Parameters
Section titled “Parameters”string
baseUrl?
Section titled “baseUrl?”string
Returns
Section titled “Returns”Promise<void>
token:
AuthToken|null
Defined in: chat/react/useRemoteAuth.ts:54
useSavedToken()
Section titled “useSavedToken()”useSavedToken: (
provider) =>Promise<void>
Defined in: chat/react/useRemoteAuth.ts:59
Parameters
Section titled “Parameters”provider
Section titled “provider”Returns
Section titled “Returns”Promise<void>
verificationUrl
Section titled “verificationUrl”verificationUrl:
string|null
Defined in: chat/react/useRemoteAuth.ts:44
UseRemoteChatOptions
Section titled “UseRemoteChatOptions”Defined in: chat/react/useRemoteChat.ts:27
Options for useRemoteChat.
Properties
Section titled “Properties”authBaseUrl
Section titled “authBaseUrl”authBaseUrl:
string
Defined in: chat/react/useRemoteChat.ts:31
Base URL for auth API (e.g. “/api/auth”).
backend
Section titled “backend”backend:
RemoteAuthBackend
Defined in: chat/react/useRemoteChat.ts:33
Auth backend to use.
chatBaseUrl
Section titled “chatBaseUrl”chatBaseUrl:
string
Defined in: chat/react/useRemoteChat.ts:29
Base URL for chat API (e.g. “/api/chat”).
fetch()?
Section titled “fetch()?”
optionalfetch: {(input,init?):Promise<Response>; (input,init?):Promise<Response>; }
Defined in: chat/react/useRemoteChat.ts:37
Custom fetch for testability.
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”URL | RequestInfo
RequestInit
Returns
Section titled “Returns”Promise<Response>
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”string | URL | Request
RequestInit
Returns
Section titled “Returns”Promise<Response>
headers?
Section titled “headers?”
optionalheaders:Record<string,string>
Defined in: chat/react/useRemoteChat.ts:39
Optional headers for all requests.
onReady()?
Section titled “onReady()?”
optionalonReady: () =>void
Defined in: chat/react/useRemoteChat.ts:35
Called when lifecycle reaches “ready” phase.
Returns
Section titled “Returns”void
UseRemoteChatReturn
Section titled “UseRemoteChatReturn”Defined in: chat/react/useRemoteChat.ts:43
Return value from useRemoteChat.
Properties
Section titled “Properties”auth:
UseRemoteAuthReturn
Defined in: chat/react/useRemoteChat.ts:51
Auth sub-hook for manual auth control.
error:
Error|null
Defined in: chat/react/useRemoteChat.ts:53
Current error (null when no error).
logout()
Section titled “logout()”logout: () =>
Promise<void>
Defined in: chat/react/useRemoteChat.ts:57
Logout: clear tokens, dispose runtime, reset to unauthenticated.
Returns
Section titled “Returns”Promise<void>
newSession()
Section titled “newSession()”newSession: () =>
Promise<string>
Defined in: chat/react/useRemoteChat.ts:55
Create a new chat session. Returns session ID.
Returns
Section titled “Returns”Promise<string>
phase:
RemoteChatPhase
Defined in: chat/react/useRemoteChat.ts:45
Current lifecycle phase.
runtime
Section titled “runtime”runtime:
IChatClient<Record<string,unknown>> |null
Defined in: chat/react/useRemoteChat.ts:47
Chat client (null until phase = “ready”).
sessionId
Section titled “sessionId”sessionId:
string|null
Defined in: chat/react/useRemoteChat.ts:49
Initial session ID (null until phase = “ready”).
UseSessionsReturn
Section titled “UseSessionsReturn”Defined in: chat/react/useSessions.ts:14
Return type of useSessions hook.
Properties
Section titled “Properties”error:
Error|null
Defined in: chat/react/useSessions.ts:20
Last error from session fetch
loading
Section titled “loading”loading:
boolean
Defined in: chat/react/useSessions.ts:18
Whether initial load or refresh is in progress
refresh()
Section titled “refresh()”refresh: () =>
void
Defined in: chat/react/useSessions.ts:22
Manually trigger a refresh
Returns
Section titled “Returns”void
sessions
Section titled “sessions”sessions:
SessionInfo[]
Defined in: chat/react/useSessions.ts:16
Current session list (lightweight SessionInfo format)
UseSSEOptions
Section titled “UseSSEOptions”Defined in: chat/react/useSSE.ts:8
Options for the useSSE hook.
Properties
Section titled “Properties”
optionalbody:unknown
Defined in: chat/react/useSSE.ts:12
Request body for POST requests (JSON-serialized automatically)
headers?
Section titled “headers?”
optionalheaders:Record<string,string>
Defined in: chat/react/useSSE.ts:13
method?
Section titled “method?”
optionalmethod:"POST"|"GET"
Defined in: chat/react/useSSE.ts:10
HTTP method (default: “GET”)
onError()?
Section titled “onError()?”
optionalonError: (error) =>void
Defined in: chat/react/useSSE.ts:15
Parameters
Section titled “Parameters”Error
Returns
Section titled “Returns”void
onEvent()?
Section titled “onEvent()?”
optionalonEvent: (event) =>void
Defined in: chat/react/useSSE.ts:14
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
reconnect?
Section titled “reconnect?”
optionalreconnect:boolean
Defined in: chat/react/useSSE.ts:16
reconnectInterval?
Section titled “reconnectInterval?”
optionalreconnectInterval:number
Defined in: chat/react/useSSE.ts:17
UseSSEReturn
Section titled “UseSSEReturn”Defined in: chat/react/useSSE.ts:21
Return type for the useSSE hook.
Properties
Section titled “Properties”connect()
Section titled “connect()”connect: () =>
void
Defined in: chat/react/useSSE.ts:23
Returns
Section titled “Returns”void
disconnect()
Section titled “disconnect()”disconnect: () =>
void
Defined in: chat/react/useSSE.ts:24
Returns
Section titled “Returns”void
lastEvent
Section titled “lastEvent”lastEvent:
ChatEvent|null
Defined in: chat/react/useSSE.ts:25
status
Section titled “status”status:
SSEStatus
Defined in: chat/react/useSSE.ts:22
UseToolApprovalReturn
Section titled “UseToolApprovalReturn”Defined in: chat/react/useToolApproval.ts:13
Return value from useToolApproval.
Properties
Section titled “Properties”approve()
Section titled “approve()”approve: (
toolCallId) =>void
Defined in: chat/react/useToolApproval.ts:15
Parameters
Section titled “Parameters”toolCallId
Section titled “toolCallId”string
Returns
Section titled “Returns”void
deny()
Section titled “deny()”deny: (
toolCallId) =>void
Defined in: chat/react/useToolApproval.ts:16
Parameters
Section titled “Parameters”toolCallId
Section titled “toolCallId”string
Returns
Section titled “Returns”void
pendingRequests
Section titled “pendingRequests”pendingRequests:
PendingToolRequest[]
Defined in: chat/react/useToolApproval.ts:14
VirtualizeOptions
Section titled “VirtualizeOptions”Defined in: chat/react/useVirtualMessages.ts:4
Configuration for message list virtualization.
Properties
Section titled “Properties”estimatedItemHeight?
Section titled “estimatedItemHeight?”
optionalestimatedItemHeight:number
Defined in: chat/react/useVirtualMessages.ts:6
Estimated height of each message item in pixels (default: 80).
overscan?
Section titled “overscan?”
optionaloverscan:number
Defined in: chat/react/useVirtualMessages.ts:8
Number of extra items to render above and below the visible area (default: 3).
VirtualMessagesResult
Section titled “VirtualMessagesResult”Defined in: chat/react/useVirtualMessages.ts:12
Result of the useVirtualMessages hook.
Type Parameters
Section titled “Type Parameters”T
Properties
Section titled “Properties”bottomSpacerHeight
Section titled “bottomSpacerHeight”bottomSpacerHeight:
number
Defined in: chat/react/useVirtualMessages.ts:22
Height of the spacer below rendered items (px).
containerRef()
Section titled “containerRef()”containerRef: (
el) =>void
Defined in: chat/react/useVirtualMessages.ts:28
Ref callback to measure container on mount.
Parameters
Section titled “Parameters”HTMLElement | null
Returns
Section titled “Returns”void
endIndex
Section titled “endIndex”endIndex:
number
Defined in: chat/react/useVirtualMessages.ts:18
End index (exclusive) in the original array.
onScroll()
Section titled “onScroll()”onScroll: (
event) =>void
Defined in: chat/react/useVirtualMessages.ts:26
Scroll event handler to attach to the container.
Parameters
Section titled “Parameters”currentTarget
Section titled “currentTarget”{ clientHeight: number; scrollTop: number; }
currentTarget.clientHeight
Section titled “currentTarget.clientHeight”number
currentTarget.scrollTop
Section titled “currentTarget.scrollTop”number
Returns
Section titled “Returns”void
startIndex
Section titled “startIndex”startIndex:
number
Defined in: chat/react/useVirtualMessages.ts:16
Start index in the original array.
topSpacerHeight
Section titled “topSpacerHeight”topSpacerHeight:
number
Defined in: chat/react/useVirtualMessages.ts:20
Height of the spacer above rendered items (px).
totalHeight
Section titled “totalHeight”totalHeight:
number
Defined in: chat/react/useVirtualMessages.ts:24
Total estimated height of all items (px).
visibleItems
Section titled “visibleItems”visibleItems:
T[]
Defined in: chat/react/useVirtualMessages.ts:14
Slice of items to actually render.
Type Aliases
Section titled “Type Aliases”AuthFormComponent()
Section titled “AuthFormComponent()”AuthFormComponent = (
props) =>ReactNode
Defined in: chat/react/auth/types.ts:16
A backend auth form component.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”ReactNode
RemoteAuthBackend
Section titled “RemoteAuthBackend”RemoteAuthBackend =
"copilot"|"claude"|"vercel-ai"
Defined in: chat/react/useRemoteAuth.ts:18
Supported remote auth backends.
RemoteAuthStatus
Section titled “RemoteAuthStatus”RemoteAuthStatus =
"idle"|"pending"|"authenticated"|"error"
Defined in: chat/react/useRemoteAuth.ts:21
Auth status state machine: idle → pending → authenticated | error.
RemoteChatPhase
Section titled “RemoteChatPhase”RemoteChatPhase =
"initializing"|"unauthenticated"|"authenticating"|"creating"|"ready"|"error"
Defined in: chat/react/useRemoteChat.ts:18
Lifecycle phase for the useRemoteChat hook.
SSEStatus
Section titled “SSEStatus”SSEStatus =
"idle"|"connecting"|"open"|"closed"|"error"
Defined in: chat/react/useSSE.ts:5
Connection status of the SSE hook.
Functions
Section titled “Functions”BackendSelector()
Section titled “BackendSelector()”BackendSelector(
__namedParameters):ReactNode
Defined in: chat/react/BackendSelector.ts:23
Headless backend selector showing registered backends with active indicator. Uses data attributes for styling:
[data-backend-selector]on root[data-backend-item]on each item[data-backend-active="true"]on the active backend[data-backend-name]with backend name value
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ChatHeader()
Section titled “ChatHeader()”ChatHeader(
__namedParameters):ReactNode
Defined in: chat/react/ChatHeader.ts:42
Header area with backend and model selectors. Returns null when no selectors need to be shown.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ChatInputArea()
Section titled “ChatInputArea()”ChatInputArea(
__namedParameters):ReactNode
Defined in: chat/react/ChatInputArea.ts:50
Input area — unified selector + composer in a [data-chat-input-area] container.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ChatLayout()
Section titled “ChatLayout()”ChatLayout(
__namedParameters):ReactNode
Defined in: chat/react/ChatLayout.ts:30
Pure layout container — flex row with optional sidebar and overlay.
Renders [data-chat-ui] root with:
- overlay (rendered first for z-index stacking)
- sidebar (rendered before main content)
- children (main chat area)
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ChatProvider()
Section titled “ChatProvider()”ChatProvider(
__namedParameters):FunctionComponentElement<ProviderProps<IChatClient<Record<string,unknown>> |null>>
Defined in: chat/react/ChatProvider.ts:17
React context provider wrapping IChatClient. All chat hooks must be used within a ChatProvider.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”ChatProviderProps
Returns
Section titled “Returns”FunctionComponentElement<ProviderProps<IChatClient<Record<string, unknown>> | null>>
ChatSettingsOverlay()
Section titled “ChatSettingsOverlay()”ChatSettingsOverlay(
__namedParameters):ReactNode
Defined in: chat/react/ChatSettingsOverlay.ts:43
Settings modal — renders [data-provider-settings-overlay] when open.
Returns null when closed.
Backdrop click and Escape key close the overlay with exit animation.
Focus is trapped within the overlay content.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ChatUI()
Section titled “ChatUI()”ChatUI(
__namedParameters):ReactNode
Defined in: chat/react/ChatUI.ts:302
Composite chat component — complete AI chat interface in one import.
import { ChatUI } from "@witqq/agent-sdk/chat/react";
function App() { return <ChatUI runtime={myRuntime} />;}Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ClaudeAuthForm()
Section titled “ClaudeAuthForm()”ClaudeAuthForm(
__namedParameters):ReactNode
Defined in: chat/react/auth/ClaudeAuthForm.ts:12
Claude auth form — OAuth Authorization Code + PKCE.
Shows “Authenticate with Claude” button → authorize URL link + paste-code input + “Submit” button.
Co-located with the Claude backend.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
Composer()
Section titled “Composer()”Composer(
__namedParameters):ReactNode
Defined in: chat/react/Composer.ts:25
Headless composer component for sending messages. Includes auto-resizing textarea, send/stop buttons, and keyboard shortcuts.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ContextStatsDisplay()
Section titled “ContextStatsDisplay()”ContextStatsDisplay(
__namedParameters):ReactNode
Defined in: chat/react/ContextStatsDisplay.ts:27
Headless component displaying context window statistics.
When real usage data is available (realPromptTokens + modelContextWindow), displays actual token usage and model context window size. When real data is not yet available (before first API response), returns null.
All elements use data-* attributes for CSS styling — no inline styles.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
CopilotAuthForm()
Section titled “CopilotAuthForm()”CopilotAuthForm(
__namedParameters):ReactNode
Defined in: chat/react/auth/CopilotAuthForm.ts:12
Copilot (GitHub) auth form — device flow.
Shows “Authenticate with GitHub” button → device code + verification URL → “Waiting…” → ”✓ Authenticated” + “Continue →”.
Co-located with the Copilot backend.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
MarkdownRenderer()
Section titled “MarkdownRenderer()”MarkdownRenderer(
props):ReactNode
Defined in: chat/react/MarkdownRenderer.ts:213
Headless markdown renderer. Parses markdown text to semantic HTML elements via createElement. Supports headings, paragraphs, bold, italic, inline code, code blocks, links, blockquotes, and lists. No external dependencies.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”ReactNode
Message()
Section titled “Message()”Message(
props):ReactNode
Defined in: chat/react/Message.ts:72
Headless message component rendering ChatMessage parts. Wraps parts in a div with data-role and data-status attributes.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”ReactNode
ModelSelector()
Section titled “ModelSelector()”ModelSelector(
__namedParameters):ReactNode
Defined in: chat/react/ModelSelector.ts:27
Dropdown model selector with search and keyboard navigation. Falls back to a free-text input when models list is empty.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
PermissionDialog()
Section titled “PermissionDialog()”PermissionDialog(
__namedParameters):ReactNode
Defined in: chat/react/PermissionDialog.ts:29
Headless permission dialog component for tool approval flows.
Renders a list of pending tool calls with approve/deny buttons.
Uses data-* attributes for styling — no built-in styles.
Returns null when there are no pending requests.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ProviderModelSelector()
Section titled “ProviderModelSelector()”ProviderModelSelector(
__namedParameters):ReactNode
Defined in: chat/react/ProviderModelSelector.ts:47
Unified selector that shows providers when available, falls back to model list. Replaces the need for separate ProviderSelector + ModelSelector in ChatUI.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ProviderSelector()
Section titled “ProviderSelector()”ProviderSelector(
__namedParameters):ReactNode
Defined in: chat/react/ProviderSelector.ts:25
Headless dropdown for selecting a configured provider. Uses data attributes for styling hooks. Follows ModelSelector pattern.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ProviderSettings()
Section titled “ProviderSettings()”ProviderSettings(
__namedParameters):ReactNode
Defined in: chat/react/ProviderSettings.ts:50
Headless settings panel for managing providers. States: list (all providers), add (new provider flow), edit (existing).
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ThinkingBlock()
Section titled “ThinkingBlock()”ThinkingBlock(
__namedParameters):ReactNode
Defined in: chat/react/ThinkingBlock.ts:14
Headless thinking/reasoning block using native details/summary elements. Displays “Thinking…” while streaming, “Reasoning” when complete.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
Thread()
Section titled “Thread()”Thread(
__namedParameters):ReactNode
Defined in: chat/react/Thread.ts:33
Headless thread component wrapping a scrollable message list. Auto-scrolls to bottom when new messages arrive unless user has scrolled up. Shows a scroll-to-bottom button when scrolled up and an empty state when no messages.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ThreadList()
Section titled “ThreadList()”ThreadList(
__namedParameters):ReactNode
Defined in: chat/react/ThreadList.ts:59
Session sidebar component for listing, searching, creating, and deleting sessions.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ThreadProvider()
Section titled “ThreadProvider()”ThreadProvider(
__namedParameters):ReactNode
Defined in: chat/react/ThreadSlots.ts:28
Provides slot-based customization for Thread message rendering. Wrap a Thread in ThreadProvider to override how messages, tool calls, or thinking blocks are rendered.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
ToolCallView()
Section titled “ToolCallView()”ToolCallView(
__namedParameters):ReactNode
Defined in: chat/react/ToolCallView.ts:17
Headless tool call display component. Shows tool name, status, collapsible args/result, and approval buttons when needed.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
UsageBadge()
Section titled “UsageBadge()”UsageBadge(
__namedParameters):ReactNode
Defined in: chat/react/UsageBadge.ts:11
Compact token usage display. Shows prompt/completion/total tokens.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode
useApiKeyAuth()
Section titled “useApiKeyAuth()”useApiKeyAuth(
options):UseApiKeyAuthReturn
Defined in: chat/react/auth/useApiKeyAuth.ts:39
API key authentication. Sends key to server for validation and storage.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”useBackends()
Section titled “useBackends()”useBackends():
UseBackendsReturn
Defined in: chat/react/useBackends.ts:16
Hook for discovering registered backends and switching between them.
Returns
Section titled “Returns”useChat()
Section titled “useChat()”useChat(
options?):UseChatReturn
Defined in: chat/react/useChat.ts:56
Convenience hook for chat interaction. Wraps IChatRuntime with React state management and progressive streaming. Messages update in real-time as tokens arrive (not after full response).
Parameters
Section titled “Parameters”options?
Section titled “options?”UseChatOptions = {}
Returns
Section titled “Returns”useChatRuntime()
Section titled “useChatRuntime()”useChatRuntime():
IChatClient
Defined in: chat/react/ChatProvider.ts:27
Access the IChatClient from context. Must be used within a ChatProvider.
Returns
Section titled “Returns”Throws
Section titled “Throws”If used outside ChatProvider
useClaudeAuth()
Section titled “useClaudeAuth()”useClaudeAuth(
options):UseClaudeAuthReturn
Defined in: chat/react/auth/useClaudeAuth.ts:42
Claude OAuth + PKCE authentication. Two-step flow: start() gets authorizeUrl → user redirects → complete(code) finishes.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”useCopilotAuth()
Section titled “useCopilotAuth()”useCopilotAuth(
options):UseCopilotAuthReturn
Defined in: chat/react/auth/useCopilotAuth.ts:41
Copilot Device Flow authentication. Starts device flow on server, provides code/URL for user, polls until complete.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”useMessages()
Section titled “useMessages()”useMessages(
options):UseMessagesReturn
Defined in: chat/react/useMessages.ts:29
Reactive message list via useSyncExternalStore.
If the session supports subscribe/getSnapshot (reactive session), uses useSyncExternalStore for granular updates. Otherwise, falls back to polling via getSession().
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”useModels()
Section titled “useModels()”useModels():
UseModelsReturn
Defined in: chat/react/useModels.ts:25
Hook for fetching and searching available models from the chat runtime.
Returns
Section titled “Returns”useOptionalThreadSlots()
Section titled “useOptionalThreadSlots()”useOptionalThreadSlots():
ThreadSlotOverrides|null
Defined in: chat/react/ThreadSlots.ts:54
Access slot overrides if inside a ThreadProvider, or null if not. Safe to call without a ThreadProvider ancestor.
Returns
Section titled “Returns”ThreadSlotOverrides | null
useProviders()
Section titled “useProviders()”useProviders():
UseProvidersReturn
Defined in: chat/react/useProviders.ts:39
Hook for managing providers (backend + model combos). Requires an IChatClient with provider methods (e.g. RemoteChatClient).
Returns
Section titled “Returns”useRemoteAuth()
Section titled “useRemoteAuth()”useRemoteAuth(
options):UseRemoteAuthReturn
Defined in: chat/react/useRemoteAuth.ts:82
Server-delegated authentication hook.
Communicates with server auth handler endpoints (POST /auth/start, POST /auth/copilot/poll, etc.) instead of running auth flows in the browser. No node:crypto dependency since all crypto operations happen server-side.
Parameters
Section titled “Parameters”options
Section titled “options”Hook configuration
Returns
Section titled “Returns”Auth state and action methods
Example
Section titled “Example”const auth = useRemoteAuth({ backend: "copilot", baseUrl: "/api/auth", onAuthenticated: (token) => console.log("Authenticated:", token),});useRemoteChat()
Section titled “useRemoteChat()”useRemoteChat(
options):UseRemoteChatReturn
Defined in: chat/react/useRemoteChat.ts:79
Lifecycle hook: auth → runtime → session.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Example
Section titled “Example”const chat = useRemoteChat({ chatBaseUrl: "/api/chat", authBaseUrl: "/api/auth", backend: "copilot",});
if (chat.phase === "unauthenticated") { return <button onClick={() => chat.auth.start()}>Login</button>;}if (chat.phase === "ready" && chat.runtime) { return <ChatProvider runtime={chat.runtime}>...</ChatProvider>;}useSessions()
Section titled “useSessions()”useSessions():
UseSessionsReturn
Defined in: chat/react/useSessions.ts:43
Reactive session list hook.
Subscribes to runtime.onSessionChange() and refreshes the list automatically
on create, delete, and message send completion.
Returns
Section titled “Returns”useSSE()
Section titled “useSSE()”useSSE(
url,options?):UseSSEReturn
Defined in: chat/react/useSSE.ts:32
SSE transport hook using fetch (not EventSource). Parses text/event-stream format with support for multi-line data and event types.
Parameters
Section titled “Parameters”string | null
options?
Section titled “options?”UseSSEOptions = {}
Returns
Section titled “Returns”useThreadSlots()
Section titled “useThreadSlots()”useThreadSlots():
ThreadSlotOverrides
Defined in: chat/react/ThreadSlots.ts:42
Access slot overrides from ThreadProvider context.
Returns
Section titled “Returns”Throws
Section titled “Throws”If used outside a ThreadProvider
useToolApproval()
Section titled “useToolApproval()”useToolApproval(
messages,onApprove?,onDeny?):UseToolApprovalReturn
Defined in: chat/react/useToolApproval.ts:30
Hook that tracks tool calls requiring approval from messages.
Scans messages for ToolCallParts with status “requires_approval” and provides approve/deny callbacks. Currently state-only (no ChatEventBus integration).
Parameters
Section titled “Parameters”messages
Section titled “messages”ChatMessage<unknown>[]
Messages to scan for pending tool approvals
onApprove?
Section titled “onApprove?”(toolCallId) => void
Called when a tool call is approved
onDeny?
Section titled “onDeny?”(toolCallId) => void
Called when a tool call is denied
Returns
Section titled “Returns”useVirtualMessages()
Section titled “useVirtualMessages()”useVirtualMessages<
T>(items,options?):VirtualMessagesResult<T>
Defined in: chat/react/useVirtualMessages.ts:40
Hook providing windowed rendering for a list of items.
Only items within the visible viewport (plus overscan) are returned. Consumers render top/bottom spacer divs to preserve scroll position.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”readonly T[]
Full array of items
options?
Section titled “options?”VirtualizeOptions = {}
Virtualization config
Returns
Section titled “Returns”VercelAIAuthForm()
Section titled “VercelAIAuthForm()”VercelAIAuthForm(
__namedParameters):ReactNode
Defined in: chat/react/auth/VercelAIAuthForm.ts:11
Vercel AI auth form — API key + optional base URL.
Shows base URL input + API key input + “Connect” button.
Co-located with the Vercel AI backend.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”ReactNode