hashbrown

UiChatResourceRef

A reference to the UI chat resource.

UiChatResourceRef
@typeTools
Chat.AnyTool
@typeState

The components offered to the model on the next request: the components option until setComponents replaces them.

isResuming
Signal<boolean>

Whether the resumed interaction is still running.

lastAssistantMessage
Signal<UiAssistantMessage<Tools> | undefined>

The last assistant message for the UI chat resource.

lastRunFinishReason
Signal<FinishReason | undefined>

Why the model stopped in the last run that completed, such as length when the answer was cut off by a token limit, or undefined when the server did not say. Cleared when the next run starts.

lastRunResult
Signal<JsonValue | undefined>

The return value the agent attached to the last run that completed (AG-UI's RUN_FINISHED.result), or undefined when it attached none. Cleared when the next run starts. Interrupted, cancelled, and failed runs never set it.

lastRunUsage
Signal<readonly TokenUsage[] | undefined>

The token usage of the last run that completed (AG-UI's RUN_FINISHED.usage), one entry per provider and model, or undefined when the server reported none. Cleared when the next run starts, so a turn that calls tools reports only its final run.

pendingConversationRecovery
Signal<PendingConversationRecovery | undefined>

The inert browser recovery batch awaiting explicit settlement.

pendingInterrupts
Signal<PendingInterruptBatch | undefined>

The complete pending interrupt batch, including while claimed.

recovery
Signal<ConversationRecoveryState>

The local recovery revision and whether an explicit restore is required.

reload
() => boolean

Remove the last assistant response and resend the preceding history.

resendMessages
() => void

Cause current messages to be resent. Can be used after an error in chat.

sendMessage
(message: Chat.UserMessageInput) => void

Send a new user message to the chat.

setMessages
(messages: Chat.MessageInput<s.Infer<UiChatMessageOutput>, Tools>[]) => void

Replace the current chat history.

state
Signal<State | undefined>

The currently visible shared agent state.

stop
(clearStreamingMessage?: boolean) => void

Stops any currently-streaming message.

subagents
Signal<readonly SubagentRun$1[]>

Observed native subagent invocations in the current conversation.