MessagePartRuntime state and helpers for inspecting assistant-ui text, tool calls, data parts, reasoning, and custom message content.
API Reference
EnrichedPartState
Enriched part state passed to children render functions.
For tool-call parts, adds toolUI, addResult, and resume.
For data parts, adds dataRendererUI.
The render function is also invoked once with a synthetic empty text part
({ type: "text", text: "", status: { type: "running" } }) when the
assistant message has no parts yet but is in the running state, so a
loading indicator can render. Differentiate this from a real empty text
via part.status?.type === "running" && part.text === "".
EnrichedPartStatetype: "text"Identifies this part as a tool call.
status: MessagePartStatus | ToolCallMessagePartStatustype: "running"The tool call is waiting for UI or human input before continuing.
MessagePartRuntime
MessagePartRuntimeaddToolResult: (result: any | ToolResponse<any>) => voidresumeToolCall: (payload: unknown) => voidrespondToToolApproval: (response: { approved: boolean; reason?: string; }) => voidpath: MessagePartRuntimePathref: stringthreadSelector: MessagePartRuntimePath["threadSelector"]type: "main"
messageSelector: MessagePartRuntimePath["messageSelector"]type: "messageId"
messagePartSelector: MessagePartRuntimePath["messagePartSelector"]type: "index"
getState: () => MessagePartStatesubscribe: (callback: () => void) => Unsubscribe
MessagePartState
MessagePartStatetype: "text"Identifies this part as a tool call.
status: MessagePartStatus | ToolCallMessagePartStatustype: "running"The tool call is waiting for UI or human input before continuing.
PartState
PartStatetype: "text"Identifies this part as a tool call.
status: MessagePartStatus | ToolCallMessagePartStatustype: "running"The tool call is waiting for UI or human input before continuing.