/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ import { Element, Document } from '../utils/htmlparser.js'; import { type Editor } from '@ckeditor/ckeditor5-core'; import { type AISuggestionContentPartDefinition } from '../utils/getsuggestionpartsfromreply.js'; import type { AISource } from '../aiconnector.js'; /** * The type of the reply. It can be one of the following: * * * `modification`: A content change suggestion made by the AI endpoint. * * `text`: A generic text response. */ export type AIReplyType = 'modification' | 'text'; declare const AIReply_base: { new (): import("@ckeditor/ckeditor5-utils").Observable; prototype: import("@ckeditor/ckeditor5-utils").Observable; }; /** * Represents a single reply from the AI endpoint. * * A reply's {@link #content} can be updated using the {@link #appendContent} method. */ export declare class AIReply extends /* #__PURE__ */ AIReply_base { /** * The ID of the reply. */ readonly id: string; /** * The ID of the interaction that the reply belongs to. */ readonly interactionId: string; /** * The type of the reply. */ readonly type: AIReplyType; /** * The content of the reply as received from AI endpoint. * * @observable */ content: string; /** * The sources of the reply. Used for web search reply. */ sources: Array; /** * The parsed content of the reply. * * This property is automatically updated after reply {@link #content} changes. You can add a listener to `replyContentUpdated` event * in order to react to these changes. * * Note, that this property type is not DOM Document, but a simplified version provided by `domhandler` library. */ parsedContent: Document; /** * Whether the reply is done. The reply is done once the AI endpoint emitted the last chunk of the content * that matches the reply's type. * * @observable */ isDone: boolean; /** * @inheritDoc */ constructor({ type, content, isDone, interactionId, areActionsDisabled, documentContextContent, editor, id }: { type: AIReplyType; interactionId: string; areActionsDisabled?: boolean; content?: string; isDone?: boolean; documentContextContent?: string; editor?: Editor; id?: string; }); /** * Appends new content to the reply. * * See {@link #content} for more information. */ appendContent(content: string): void; /** * Destroys the reply. */ destroy(): void; } /** * An event emitted by an {@link module:ai/aicore/model/aireply~AIReply} when it's * {@link module:ai/aicore/model/aireply~AIReply#content} gets updated or the reply is marked as done. * * @eventName ~AIReply#replyContentUpdated */ export type AIReplyContentUpdatedEvent = { name: 'replyContentUpdated'; args: [ reply: AIReply, updatedChangeGroups?: Array ]; }; export type AIReplyHotNode = { node: Element; id: string; type: AISuggestionContentPartDefinition['type']; anchorId?: string | null; }; export type AIReplyChangeGroup = { readonly changes: Array; readonly index: number; state: AIReplyChangeGroupState; }; export type AIReplyChangeGroupState = 'pending' | 'accepted' | 'rejected' | 'outdated'; export {};