import { ToolCall, ContentPart, Attachment } from "./Message"; export interface PostUserMessage { type: string; threadId: string; contentParts: ContentPart[]; attachments?: Attachment[]; parameters?: Record; context?: { spaceId?: string; userId?: string; }; } export interface PostUserMessageResponse { ok: boolean; messageId: string; } export interface Control { type: "control"; threadId: string; action: "abort" | "retry" | "regenerate"; targetMessageId?: string; } export type ServerEvent = { type: "assistant_started"; threadId: string; messageId: string; } | { type: "assistant_delta"; threadId: string; messageId: string; delta: ContentPart; } | { type: "assistant_tool_call"; threadId: string; messageId: string; toolCall: ToolCall; } | { type: "assistant_completed"; threadId: string; messageId: string; usage?: TokenUsage; } | { type: "error"; threadId: string; messageId?: string; code: string; message: string; }; export interface TokenUsage { inputTokens?: number; outputTokens?: number; totalTokens?: number; model?: string; latencyMs?: number; }