assistant-cloud/ai-sdk

The AI SDK message format adapter and run telemetry extraction that the assistant-ui runtime and useCloudChat share, typed against UIMessage without loading the ai runtime.

ai is an optional peer of this entry and only its types are used, so the entry loads without the ai runtime. AISDKMessageLike and AISDKStorageFormat are the shapes the two exports accept: a message as an AI SDK integration holds it, or as the cloud stored it under the ai-sdk/v6 format, which drops the id. See Run reports for what the extracted fields mean.

API Reference

aiSDKV6FormatAdapter

The stored form of an AI SDK message: the message without its id.

const aiSDKV6FormatAdapter: MessageFormatAdapter<
  UIMessage,
  AISDKStorageFormat
>;

extractAISDKRunTelemetry

Reads the run report fields out of the assistant messages of one run. A run the AI SDK streamed as one message is one element; a run the cloud stored as several assistant rows is aggregated, step by step, in order. Returns null when no assistant message is present. Status reads completed when the run produced text or tool calls, as a live finish with reason tool-calls does; an integration that observed the finish event overrides it.

extractAISDKRunTelemetry
messagesreadonly AISDKMessageLike[]