hashbrown

ChatResourceRef

Represents the reactive chat resource, including current messages and control methods.

ChatResourceRef
@typeTools
Chat.AnyTool
@typeState
generatingError
Signal<Error | undefined>

Error emitted during generation events.

isGenerating
Signal<boolean>

Indicates whether the chat is currently generating assistant output.

isLoading
Signal<boolean>

Aggregate loading flag across transport, generation, and tool calls.

isReceiving
Signal<boolean>

Indicates whether the chat is currently receiving tokens.

isResuming
Signal<boolean>

Whether the resumed interaction is still running.

isRunningToolCalls
Signal<boolean>

Indicates whether the chat is running tool calls.

isSending
Signal<boolean>

Indicates whether the chat is currently sending a user message.

lastAssistantMessage
Signal<Chat.AssistantMessage<string, Tools> | undefined>

The last assistant message for the chat.

pendingInterrupts
Signal<PendingInterruptBatch | undefined>

The complete pending interrupt batch, including while claimed.

reload
() => boolean

Remove the last assistant response and re-send the previous user message. Returns true if a reload was performed.

sendingError
Signal<Error | undefined>

Transport/request error before generation events arrive.

sendMessage
(message: Chat.UserMessage) => void

Send a new user message to the chat.

setMessages
(messages: Chat.Message<string, Tools>[]) => void

Replace the current chat message history.

state
Signal<State | undefined>

The currently visible shared agent state.

stop
(clearStreamingMessage?: boolean) => void

Stops any currently-streaming message.