A reference to the UI chat resource.
API
interface UiChatResourceRef<Tools extends Chat.AnyTool, State = unknown> extends Resource<UiChatMessage<Tools>[]> {readonly isResuming: Signal<boolean>;lastAssistantMessage: Signal <
UiAssistantMessage <Tools> | undefined
>;readonly pendingInterrupts: Signal<PendingInterruptBatch | undefined>;reload: () => boolean;resendMessages: () => void;resume(options: ResumeOptions): void;sendMessage: (message: Chat.UserMessage) => void;setMessages: (messages: Chat.Message<s.Infer<UiChatMessageOutput>, Tools>[]) => void;setState(state: State): void;readonly state: Signal<State | undefined>;stop: (clearStreamingMessage?: boolean) => void;}UiChatResourceRef
@typeToolsChat.AnyTool@typeStateisResuming
Signal<boolean>Whether the resumed interaction is still running.
lastAssistantMessage
Signal<UiAssistantMessage<Tools> | undefined>The last assistant message for the UI chat resource.
pendingInterrupts
Signal<PendingInterruptBatch | undefined>The complete pending interrupt batch, including while claimed.
reload
() => booleanRemove the last assistant response and resend the preceding history.
resendMessages
() => voidCause current messages to be resent. Can be used after an error in chat.
sendMessage
(message: Chat.UserMessage) => voidSend a new user message to the chat.
setMessages
(messages: Chat.Message<s.Infer<UiChatMessageOutput>, Tools>[]) => voidReplace the current chat history.
state
Signal<State | undefined>The currently visible shared agent state.
stop
(clearStreamingMessage?: boolean) => voidStops any currently-streaming message.