messages is the ordered timeline. Each message has role (user or assistant) and parts. A part is one block in the message, such as text or thinking.
See useWebChat for the full type list.
State
Use these fields to drive the composer, spinner, and error banner:Errors
error is the last failure from load, send, retry, or action. Show error.message.
sendMessage, respondToAction, sendAction, and retryMessage do not throw. A try/catch around them does not run.
Wait for the result and read error on that call:
error is a WebChatPlanLimitError. The HTTP status is 402. Read reason (agents, channels, or conversations) and show message.
Text
Start withtype === 'text'. That is the visible body of the row.
Thinking
isRunning is true for the whole agent turn. typing is present only while the agent types. Assistant messages can also include thinking parts before text arrives.
run is an alias for the same snapshot: isRunning is run.isRunning, and typing is run.typing.
Show a status line while the turn runs:
thinking parts next to text: