DocsReact Corecore-typesMessagePart
Package: @hexos/react-core

Discriminated union of structured content parts within an AgentMessage.

Enables rich message rendering: text blocks, tool call/result pairs, reasoning (extended thinking), and inline images. The type field discriminates each variant.

Related: ToolCallState tracks tool execution progress, MessageBubble renders parts, ReasoningDisplay shows reasoning blocks.

type MessagePart = | { type: 'text'; content: string }
  | { type: 'tool-call'; toolCallId: string; toolName: string; args: unknown; state: ToolCallState }
  | { type: 'tool-result'; toolCallId: string; result: unknown }
  | { type: 'reasoning'; content: string; isVisible: boolean }
  | { type: 'image'; url: string; alt?: string }