/*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ import type { IDictionary } from "jodit/esm/types/index"; import type { IAIArtifact } from "./artifacts"; import type { IToolCall, IToolResult } from "./tools"; import type { MessageRole } from "./types"; /** * Represents a single message in a conversation */ export interface IAIMessage { /** Unique message identifier */ readonly id: string; /** Role of the message sender */ readonly role: MessageRole; /** Message content */ readonly content: string; /** Timestamp when message was created */ readonly timestamp: number; /** Optional tool calls requested by assistant */ readonly toolCalls?: Readonly; readonly toolResults?: Readonly; /** Optional artifacts generated by AI: image, audio etc. */ readonly artifacts?: IAIArtifact[]; } /** * Response from AI API */ export interface IAIResponse { /** Unique message ID for the response */ responseId: string; /** Response content */ content: string; /** Optional tool calls requested by AI */ toolCalls?: IToolCall[]; /** Whether the response is complete */ finished: boolean; /** Optional metadata from API */ metadata?: IDictionary; /** Optional artifacts generated by AI: image, audio etc. */ artifacts?: IAIArtifact[]; } export type AIStreamEvent = { type: 'created'; response: IAIResponse; } | { type: 'text-delta'; delta: string; } | { type: 'completed'; response: IAIResponse; } | { type: 'error'; error: Error; };