Chat Core
chat/core
Section titled “chat/core”Interfaces
Section titled “Interfaces”ChatSessionMetadata
Section titled “ChatSessionMetadata”Defined in: chat/types.ts:127
Session metadata tracking usage statistics and custom extensions.
Updated automatically by session stores on each addMessage() call.
The generic TCustom parameter allows type-safe application-specific
metadata via the custom field.
Type Parameters
Section titled “Type Parameters”TCustom
Section titled “TCustom”TCustom extends Record<string, unknown> = Record<string, unknown>
Shape of the custom field (defaults to Record<string, unknown>)
Properties
Section titled “Properties”custom?
Section titled “custom?”
optionalcustom:TCustom
Defined in: chat/types.ts:135
Application-specific metadata — typed via the TCustom generic parameter
messageCount
Section titled “messageCount”messageCount:
number
Defined in: chat/types.ts:129
Number of messages in the session (updated by session store)
optionaltags:string[]
Defined in: chat/types.ts:133
Optional tags for session categorization and filtering
totalTokens
Section titled “totalTokens”totalTokens:
number
Defined in: chat/types.ts:131
Total token count across all messages in the session
Functions
Section titled “Functions”chatEventToAgentEvent()
Section titled “chatEventToAgentEvent()”chatEventToAgentEvent(
event):AgentEvent|null
Defined in: chat/bridge.ts:101
Map a ChatEvent back to an AgentEvent for accumulator consumption. Returns null for events that don’t map to accumulator-relevant AgentEvents.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”AgentEvent | null
extractToolResults()
Section titled “extractToolResults()”extractToolResults(
message):ToolResult[]
Defined in: chat/conversion.ts:121
Extract ToolResults from ToolCallParts that have results
Parameters
Section titled “Parameters”message
Section titled “message”Returns
Section titled “Returns”References
Section titled “References”adaptAgentEvents
Section titled “adaptAgentEvents”Re-exports adaptAgentEvents
agentEventToChatEvent
Section titled “agentEventToChatEvent”Re-exports agentEventToChatEvent
ChatEvent
Section titled “ChatEvent”Re-exports ChatEvent
ChatEventType
Section titled “ChatEventType”Re-exports ChatEventType
ChatId
Section titled “ChatId”Re-exports ChatId
ChatIdLike
Section titled “ChatIdLike”Re-exports ChatIdLike
ChatMessage
Section titled “ChatMessage”Re-exports ChatMessage
ChatMessageMetadata
Section titled “ChatMessageMetadata”Re-exports ChatMessageMetadata
ChatMessageStatus
Section titled “ChatMessageStatus”Re-exports ChatMessageStatus
ChatMiddleware
Section titled “ChatMiddleware”Re-exports ChatMiddleware
ChatMiddlewareContext
Section titled “ChatMiddlewareContext”Re-exports ChatMiddlewareContext
ChatRole
Section titled “ChatRole”Re-exports ChatRole
ChatSession
Section titled “ChatSession”Re-exports ChatSession
ChatSessionConfig
Section titled “ChatSessionConfig”Re-exports ChatSessionConfig
createChatId
Section titled “createChatId”Re-exports createChatId
createTextMessage
Section titled “createTextMessage”Re-exports createTextMessage
FilePart
Section titled “FilePart”Re-exports FilePart
fromAgentMessage
Section titled “fromAgentMessage”Re-exports fromAgentMessage
getMessageReasoning
Section titled “getMessageReasoning”Re-exports getMessageReasoning
getMessageText
Section titled “getMessageText”Re-exports getMessageText
getMessageToolCalls
Section titled “getMessageToolCalls”Re-exports getMessageToolCalls
IChatProvider
Section titled “IChatProvider”Re-exports IChatProvider
isChatEvent
Section titled “isChatEvent”Re-exports isChatEvent
isChatMessage
Section titled “isChatMessage”Re-exports isChatMessage
isChatSession
Section titled “isChatSession”Re-exports isChatSession
isFilePart
Section titled “isFilePart”Re-exports isFilePart
isMessagePart
Section titled “isMessagePart”Re-exports isMessagePart
isObservableSession
Section titled “isObservableSession”Re-exports isObservableSession
isReasoningPart
Section titled “isReasoningPart”Re-exports isReasoningPart
isSourcePart
Section titled “isSourcePart”Re-exports isSourcePart
isTextPart
Section titled “isTextPart”Re-exports isTextPart
isToolCallPart
Section titled “isToolCallPart”Re-exports isToolCallPart
MessagePart
Section titled “MessagePart”Re-exports MessagePart
MessageStatus
Section titled “MessageStatus”Re-exports MessageStatus
ObservableSession
Section titled “ObservableSession”Re-exports ObservableSession
PartStatus
Section titled “PartStatus”Re-exports PartStatus
ReasoningPart
Section titled “ReasoningPart”Re-exports ReasoningPart
RuntimeSendOptions
Section titled “RuntimeSendOptions”Re-exports RuntimeSendOptions
RuntimeStatus
Section titled “RuntimeStatus”Re-exports RuntimeStatus
SendMessageOptions
Section titled “SendMessageOptions”Re-exports SendMessageOptions
SessionInfo
Section titled “SessionInfo”Re-exports SessionInfo
SessionStatus
Section titled “SessionStatus”Re-exports SessionStatus
SourcePart
Section titled “SourcePart”Re-exports SourcePart
TextPart
Section titled “TextPart”Re-exports TextPart
toAgentMessage
Section titled “toAgentMessage”Re-exports toAgentMessage
toAgentMessages
Section titled “toAgentMessages”Re-exports toAgentMessages
toChatId
Section titled “toChatId”Re-exports toChatId
ToolCallPart
Section titled “ToolCallPart”Re-exports ToolCallPart
ToolCallStatus
Section titled “ToolCallStatus”Re-exports ToolCallStatus