Represents the reactive chat resource, including current messages and control methods.
API
interface ChatResourceRef<Tools extends Chat.AnyTool, State = unknown> extends Resource<Chat.Message<string, Tools>[]> {generatingError: Signal <
Error | undefined
>;isGenerating: Signal <boolean>;isLoading: Signal <boolean>;isReceiving: Signal <boolean>;readonly isResuming: Signal<boolean>;isRunningToolCalls: Signal <boolean>;isSending: Signal <boolean>;lastAssistantMessage: Signal <
Chat.AssistantMessage <string, Tools> | undefined
>;readonly pendingInterrupts: Signal<PendingInterruptBatch | undefined>;reload: () => boolean;resume(options: ResumeOptions): void;sendingError: Signal <
Error | undefined
>;sendMessage: (message: Chat.UserMessage) => void;setMessages: (messages: Chat.Message<string, Tools>[]) => void;setState(state: State): void;readonly state: Signal<State | undefined>;stop: (clearStreamingMessage?: boolean) => void;}@typeToolsChat.AnyTool@typeStateSignal<Error | undefined>Error emitted during generation events.
Signal<boolean>Indicates whether the chat is currently generating assistant output.
Signal<boolean>Aggregate loading flag across transport, generation, and tool calls.
Signal<boolean>Indicates whether the chat is currently receiving tokens.
Signal<boolean>Whether the resumed interaction is still running.
Signal<boolean>Indicates whether the chat is running tool calls.
Signal<boolean>Indicates whether the chat is currently sending a user message.
Signal<Chat.AssistantMessage<string, Tools> | undefined>The last assistant message for the chat.
Signal<PendingInterruptBatch | undefined>The complete pending interrupt batch, including while claimed.
() => booleanRemove the last assistant response and re-send the previous user message. Returns true if a reload was performed.
Signal<Error | undefined>Transport/request error before generation events arrive.
(message: Chat.UserMessage) => voidSend a new user message to the chat.
(messages: Chat.Message<string, Tools>[]) => voidReplace the current chat message history.
Signal<State | undefined>The currently visible shared agent state.
(clearStreamingMessage?: boolean) => voidStops any currently-streaming message.