export interface Message { id: string; spaceId?: string; threadId: string; role: Role; contentParts: ContentPart[]; toolCalls?: ToolCall[]; toolResults?: ToolResult[]; attachments?: Attachment[]; createdAt: string; status?: "pending" | "streaming" | "completed" | "error"; error?: { code: string; message: string; }; userId?: string; replyToId?: string; metadata?: Record; } export interface ToolCall { id: string; name: string; arguments: unknown; state?: "requested" | "running" | "succeeded" | "failed"; } export interface ToolResult { callId: string; ok: boolean; result?: unknown; error?: { code: string; message: string; }; elapsedMs?: number; } export type Role = "user" | "assistant" | "tool" | "system"; export type ContentPart = { type: "text"; text: string; } | { type: "image"; url: string; caption?: string; } | { type: "file"; url: string; name: string; mimeType: string; size?: number; } | { type: "json"; data: unknown; }; export interface Attachment { id?: string; kind: "image" | "file"; url: string; name?: string; mimeType?: string; size?: number; }