MessagePartRuntime

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 === "".

EnrichedPartState
type"text"

Identifies this part as a tool call.

statusMessagePartStreamStatus

EnrichedPartState["status"]
type"running"

The tool call is waiting for UI or human input before continuing.

MessagePartRuntime

MessagePartRuntime
addToolResult(result: any | ToolResponse<any>) => void

resumeToolCall(payload: unknown) => void

respondToToolApproval(response: ToolApprovalResponse) => void

pathMessagePartRuntimePath

MessagePartRuntimePath
refstring

threadSelectorMessagePartRuntimePath["threadSelector"]

MessagePartRuntimePath["threadSelector"]
type"main"

messageSelectorMessagePartRuntimePath["messageSelector"]

MessagePartRuntimePath["messageSelector"]
type"messageId"

messagePartSelectorMessagePartRuntimePath["messagePartSelector"]

MessagePartRuntimePath["messagePartSelector"]
type"index"

getState() => MessagePartState

subscribe(callback: () => void) => Unsubscribe

MessagePartState

MessagePartState
type"text"

Identifies this part as a tool call.

statusMessagePartStreamStatus

MessagePartState["status"]
type"running"

The tool call is waiting for UI or human input before continuing.

PartState

PartState
type"text"

Identifies this part as a tool call.

statusMessagePartStreamStatus

PartState["status"]
type"running"

The tool call is waiting for UI or human input before continuing.