import type { ProviderOptions } from '@ai-sdk/provider-utils'; import type { JSONValue } from '../utils/json'; export type MessageRole = 'system' | 'user' | 'assistant' | 'tool'; export type MessageContent = ContentText | ContentToolCall | ContentInvalidToolCall | ContentReasoning | ContentReasoningFile | ContentFile | ContentCitation | ContentCustom | ContentProvider; export interface ContentMetadata { providerMetadata?: Record; providerOptions?: ProviderOptions; } export type ContentCitation = ContentMetadata & { type: 'citation'; source?: string; url?: string; title?: string; startIndex?: number; endIndex?: number; text?: string; }; export type ContentText = ContentMetadata & { type: 'text'; text: string; }; export type ContentReasoning = ContentMetadata & { type: 'reasoning'; text: string; }; export interface ContentFileRef { id: string; fileName?: string; sizeBytes?: number; } export type ContentFile = ContentMetadata & { type: 'file'; mediaType?: string; data?: Uint8Array | ArrayBuffer | Buffer | string; fileRef?: ContentFileRef; }; export type ContentReasoningFile = ContentMetadata & { type: 'reasoning-file'; data: ContentFile['data']; mediaType: string; }; export type ContentCustom = ContentMetadata & { type: 'custom'; kind: `${string}.${string}`; }; export type ContentToolCall = ContentMetadata & { type: 'tool-call'; toolCallId: string; toolName: string; input: JSONValue; providerExecuted?: boolean; } & ({ state: 'pending'; } | { state: 'resolved'; output: JSONValue; canceled?: boolean; } | { state: 'rejected'; error: string; }); export type ContentInvalidToolCall = ContentMetadata & { type: 'invalid-tool-call'; toolCallId?: string; error?: string; args?: JSONValue; name?: string; }; export type ContentProvider = ContentMetadata & { type: 'provider'; value: Record; }; export interface Message { id?: string; type?: 'llm'; role: MessageRole; content: MessageContent[]; name?: string; providerOptions?: ProviderOptions; } export interface AgentMessageBase { type: 'agent'; } export interface CustomAgentMessages { ___dummyCustomMessage: { dummy: string; }; } export type CustomAgentMessage = { type: 'custom'; data: CustomAgentMessages[keyof CustomAgentMessages]; }; export type AgentMessage = Message | CustomAgentMessage; export type AgentDbMessage = { id: string; createdAt: Date; } & AgentMessage; export declare function stripHydratedFileData(message: T): T;