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
>;getRecoveryConfiguration(): ConversationRecoveryConfiguration;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
>;lastRunFinishReason: Signal <
FinishReason | undefined
>;lastRunResult: Signal <
JsonValue | undefined
>;lastRunUsage: Signal <
readonly TokenUsage [] | undefined
>;readonly pendingConversationRecovery: Signal<PendingConversationRecovery | undefined>;readonly pendingInterrupts: Signal<PendingInterruptBatch | undefined>;readonly recovery: Signal<ConversationRecoveryState>;reload: () => boolean;restoreConversation(snapshot: ConversationSnapshot<State>, options: ConversationRestoreOptions): void;resume(options: ResumeOptions): void;resumeConversationRecovery(options: ResumeConversationRecoveryOptions): void;sendingError: Signal <
Error | undefined
>;sendMessage: (message: Chat.UserMessageInput) => void;setMessages: (messages: Chat.MessageInput<string, Tools>[]) => void;setState(state: State): void;readonly state: Signal<State | undefined>;stop: (clearStreamingMessage?: boolean) => void;readonly subagents: Signal<readonly SubagentRun$1[]>;}@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<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.
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.
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.
Signal<PendingConversationRecovery | undefined>The inert browser recovery batch awaiting explicit settlement.
Signal<PendingInterruptBatch | undefined>The complete pending interrupt batch, including while claimed.
Signal<ConversationRecoveryState>The local recovery revision and whether an explicit restore is required.
() => 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.UserMessageInput) => voidSend a new user message to the chat.
(messages: Chat.MessageInput<string, Tools>[]) => voidReplace the current chat message history.
Signal<State | undefined>The currently visible shared agent state.
(clearStreamingMessage?: boolean) => voidStops any currently-streaming message.
Signal<readonly SubagentRun$1[]>Observed native subagent invocations in the current conversation.