Skip to Content

message

Module: @vibex/core/message

Message Types - AI SDK v6 Compatible

VibeX adopts a parts-based message format aligned with AI SDK v6. This provides structured content types for text, tools, reasoning, and artifacts.

Interfaces

TextPart

View source

Message Types - AI SDK v6 Compatible

VibeX adopts a parts-based message format aligned with AI SDK v6. This provides structured content types for text, tools, reasoning, and artifacts.

Properties:

NameTypeDescription
type"text"
textstring

ToolCallPart

View source

Tool call part - when an agent invokes a tool

Properties:

NameTypeDescription
type"tool-call"
toolCallIdstring
toolNamestring
argsRecord<string, unknown>
status"pending" | "running" | "completed" | "failed" | "pending-approval"(optional)

ToolResultPart

View source

Tool result part - the output from a tool

Properties:

NameTypeDescription
type"tool-result"
toolCallIdstring
toolNamestring
resultunknown
isErrorboolean(optional)

ReasoningPart

View source

Reasoning part - for chain-of-thought or thinking

Properties:

NameTypeDescription
type"reasoning"
textstring

ArtifactPart

View source

Artifact reference part - VibeX-specific for document/file references

Properties:

NameTypeDescription
type"artifact"
artifactIdstring
titlestring(optional)
versionnumber(optional)
artifactType"document" | "code" | "data" | "image" | "file"(optional)
previewstring(optional)
action"created" | "updated" | "referenced"(optional)

PlanUpdatePart

View source

Plan update part - VibeX-specific for plan/task changes

Properties:

NameTypeDescription
type"plan-update"
planIdstring
action"created" | "updated" | "completed" | "failed"
summarystring(optional)
tasksAffectedstring[](optional)

FilePart

View source

File part - for file attachments

Properties:

NameTypeDescription
type"file"
fileIdstring
filenamestring
mimeTypestring
urlstring(optional)
sizenumber(optional)

StepStartPart

View source

Step start part - marks the beginning of a multi-step process

Properties:

NameTypeDescription
type"step-start"
stepIdstring
stepNamestring
agentNamestring(optional)

ModelMessage

View source

Model message - minimal format for LLM APIs (AI SDK CoreMessage compatible)

Properties:

NameTypeDescription
roleMessageRole
contentstring | XMessagePart[]

XMessage

View source

VibeX message - full server-side message with metadata and parts

This is the canonical message format used throughout VibeX. It supports both legacy content and new parts format.

Properties:

NameTypeDescription
idstringUnique message identifier (optional)
roleMessageRoleRole of the message sender
partsXMessagePart[]Message parts - structured content (v6 format)
Preferred over content for new code. (optional)
contentstring | unknown[]Legacy content field (optional)
metadataobjectMessage metadata (optional)

Types

XMessagePart

View source

Union of all message part types

type XMessagePart = | TextPart | ToolCallPart | ToolResultPart | ReasoningPart | ArtifactPart | PlanUpdatePart | FilePart | StepStartPart

MessageRole

View source

Message role types

type MessageRole = "system" | "user" | "assistant" | "tool"

Message

View source

Alias for XMessage

type Message = XMessage

ChatStatus

View source

Granular message/chat status

type ChatStatus = | "idle" // No activity | "submitted" // Request sent, waiting for response | "streaming" // Actively receiving response | "awaiting-approval" // Tool call needs human approval | "error"

Functions

getTextFromParts

View source

Extract text content from message parts

function getTextFromParts(parts: XMessagePart[]): string

Parameters:

NameTypeDescription
partsXMessagePart[]

createTextMessage

View source

Create a simple text message

function createTextMessage(role: MessageRole, text: string, metadata?: XMessage["metadata"]): XMessage

Parameters:

NameTypeDescription
roleMessageRole
textstring
metadataXMessage["metadata"] (optional)

hasPendingApproval

View source

Check if message has pending tool approvals

function hasPendingApproval(message: XMessage): boolean

Parameters:

NameTypeDescription
messageXMessage

getToolCalls

View source

Get all tool calls from a message

function getToolCalls(message: XMessage): ToolCallPart[]

Parameters:

NameTypeDescription
messageXMessage

getArtifacts

View source

Get all artifacts from a message

function getArtifacts(message: XMessage): ArtifactPart[]

Parameters:

NameTypeDescription
messageXMessage

contentToParts

View source

Convert legacy content to parts format

function contentToParts(content: string | unknown[] | undefined): XMessagePart[]

Parameters:

NameTypeDescription
contentstring | unknown[] | undefined

normalizeMessage

View source

Normalize a message to always have parts

function normalizeMessage(message: XMessage): XMessage

Parameters:

NameTypeDescription
messageXMessage