Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

TanStackMessageMetadata.md

339 lines6.4 KB

Defined in: packages/ai/src/types.ts:723

Shape of metadata.tanstack on a message. createdAt is an ISO-8601 string.

Properties

continues?

optional continues?: string;

Defined in: packages/ai/src/types.ts:795

On an assistant wire row that exists only to keep the block order: the id of the assistant row before it. Our server joins the two rows into one message with a blockOrder map. See uiMessagesToWire.


createdAt?

optional createdAt?: string;

Defined in: packages/ai/src/types.ts:724


finishReason?

optional finishReason?: "length" | "stop" | "content_filter" | "tool_calls" | null;

Defined in: packages/ai/src/types.ts:733

Why the model call of this assistant message ended. A 'length' message stopped at the output limit, so its tool calls are not complete.


loopStopped?

optional loopStopped?: boolean;

Defined in: packages/ai/src/types.ts:735

See TanStackRunMetadata.loopStopped. Set on the last assistant message of the run.


model?

optional model?: string;

Defined in: packages/ai/src/types.ts:725


reasoningItem?

optional reasoningItem?: boolean;

Defined in: packages/ai/src/types.ts:753

The model call of this assistant message sent a reasoning item. The OpenAI Responses adapter sets it. A replay that lost that reasoning item sends the message without its item ids, because the API refuses a msg_/fc_ item without the reasoning item that made it.


responseId?

optional responseId?: string;

Defined in: packages/ai/src/types.ts:728


responseItems?

optional responseItems?: object[];

Defined in: packages/ai/src/types.ts:741

The provider's answer items of this assistant message, in order, for a same-model replay. The OpenAI Responses adapter keeps each output message item's id and phase (commentary or final_answer).

id

id: string;

phase?

optional phase?: string;

textLength?

optional textLength?: number;

UTF-16 text length, retaining item boundaries when adjacent text is merged.


run?

optional run?: object;

Defined in: packages/ai/src/types.ts:761

The chat run that produced this assistant message. withPersistence sets id. reconstructChat with includeRuns: true adds the finished run's timings, in epoch ms.

finishedAt?

optional finishedAt?: number;

id

id: string;

startedAt?

optional startedAt?: number;

runId?

optional runId?: string;

Defined in: packages/ai/src/types.ts:755

Parent chat run that produced this assistant message.


signature?

optional signature?: string;

Defined in: packages/ai/src/types.ts:765

Thinking signature for a role: 'reasoning' fan-out message.


source?

optional source?: MessageSource;

Defined in: packages/ai/src/types.ts:726


stopReason?

optional stopReason?: "error" | "aborted";

Defined in: packages/ai/src/types.ts:727


structuredOutput?

optional structuredOutput?: object;

Defined in: packages/ai/src/types.ts:781

data?

optional data?: unknown;

errorMessage?

optional errorMessage?: string;

partial?

optional partial?: unknown;

raw?

optional raw?: string;

reasoning?

optional reasoning?: string;

status?

optional status?: "error" | "complete" | "streaming";

subagent?

optional subagent?: SubagentWireInfo;

Defined in: packages/ai/src/types.ts:763

Card data on a child wire message. See uiMessagesToWire.


toolCallMetadata?

optional toolCallMetadata?: Record<string, unknown>;

Defined in: packages/ai/src/types.ts:767

Per-tool-call provider metadata keyed by tool call id (e.g. Gemini thoughtSignature).


toolResult?

optional toolResult?: object;

Defined in: packages/ai/src/types.ts:768

content?

optional content?: ContentPart<unknown, unknown, unknown, unknown, unknown>[];

createdAt?

optional createdAt?: string;

id?

optional id?: string;

toolResultKind?

optional toolResultKind?: "text";

Defined in: packages/ai/src/types.ts:780

'text' on a tool result whose tool returned a string. Its content is then that string, not JSON, so a reader keeps '42' as '42'. A result without it is JSON text, or plain text that does not parse.


toolResultOutcome?

optional toolResultOutcome?: ToolResultOutcome;

Defined in: packages/ai/src/types.ts:774

Outcome of a cancelled or denied tool result; when present, the UI state is error.


uiResources?

optional uiResources?: UIResourcePart[];

Defined in: packages/ai/src/types.ts:789