/** * @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 { type AIConnector } from '../aiconnector.js'; import { AIReply } from './aireply.js'; import { type Editor } from '@ckeditor/ckeditor5-core'; declare const AIInteraction_base: { new (): import("@ckeditor/ckeditor5-utils").Emitter; prototype: import("@ckeditor/ckeditor5-utils").Emitter; }; /** * An interaction is a single request to the AI endpoint. It is created when a user message is sent and finishes when the * all responses are received (interaction is finished) or interaction is stopped (by an error or directly by the user). * * An interaction hosts a collection of {@link #replies} and fires various events that may be handled to update the UI accordingly. * * @experimental **Experimental:** This is a production-ready API but may change in minor releases * without the standard deprecation policy. Check the changelog for migration guidance. */ export declare abstract class AIInteraction extends /* #__PURE__ */ AIInteraction_base { /** * The unique ID of the interaction. */ readonly id: string; /** * The replies created for this interaction. */ replies: Array; /** * The current reply being returned by the AI endpoint and handled by `AIInteraction`. This property is set when the interaction * is started and becomes `undefined` when the interaction is {@link #stop stopped}. It changes as data for new replies are received * from the AI endpoint. */ currentReply?: AIReply; constructor({ connector, editor }: AIInteractionOptions); /** * Stops the interaction. It marks the last reply as done and aborts the current request to the AI endpoint. * * @experimental **Experimental:** This is a production-ready API but may change in minor releases * without the standard deprecation policy. Check the changelog for migration guidance. */ stop(): void; /** * Gets a reply by its ID. * * @experimental **Experimental:** This is a production-ready API but may change in minor releases * without the standard deprecation policy. Check the changelog for migration guidance. */ getReply(id: string): AIReply | undefined; /** * Destroys the interaction. It marks the last reply as done and aborts the current request to the AI endpoint. * * @experimental **Experimental:** This is a production-ready API but may change in minor releases * without the standard deprecation policy. Check the changelog for migration guidance. */ destroy(): void; /** * Creates a reply and adds it to the interaction. * * @experimental **Experimental:** This is a production-ready API but may change in minor releases * without the standard deprecation policy. Check the changelog for migration guidance. */ createReply(options: ConstructorParameters[0]): AIReply; } export type AIInteractionOptions = { connector: AIConnector; editor?: Editor; }; export type AIToolData = { /** * Name of the AI tool which returned the data. */ toolName: string; /** * Data type. * * * `'result'` – if the AI tool returned final results of its execution. * * `'notification'` – if the AI tool returned a notification (e.g., progress update). */ type: 'result' | 'notification'; /** * Data returned by the tool. * * Content depends on the AI tool implementation. */ data?: Record; /** * Additional parameters returned by the tool. * * Content depends on the AI tool implementation. * * Available only if `type` is `'result'`. */ attributes?: Record; }; /** * An event emitted by {@link module:ai/aicore/model/aiinteraction~AIInteraction} when started, which means that * the request to the AI endpoint has been sent. * * @eventName ~AIInteraction#interactionStarted */ export type AIInteractionStartedEvent = { name: 'interactionStarted'; args: [interaction: TInteraction]; }; /** * An event emitted by {@link module:ai/aicore/model/aiinteraction~AIInteraction} when a user stopped * the current interaction. * * @eventName ~AIInteraction#interactionStopped */ export type AIInteractionStoppedEvent = { name: 'interactionStopped'; args: [interaction: TInteraction]; }; /** * An event emitted by {@link module:ai/aicore/model/aiinteraction~AIInteraction} when an interaction * ran out of content to process or crashed during processing. * * @eventName ~AIInteraction#interactionFinished */ export type AIInteractionFinishedEvent = { name: 'interactionFinished'; args: [interaction: TInteraction]; }; /** * An event emitted by {@link module:ai/aicore/model/aiinteraction~AIInteraction} when it is destroyed. * * @eventName ~AIInteraction#interactionDestroyed */ export type AIInteractionDestroyedEvent = { name: 'interactionDestroyed'; args: [interaction: TInteraction]; }; /** * An event emitted by an {@link module:ai/aicore/model/aiinteraction~AIInteraction} when an AI reply is added to the * interaction (usually because received from the AI endpoint). * * @eventName ~AIInteraction#replyCreated */ export type AIInteractionReplyCreatedEvent = { name: 'replyCreated'; args: [reply: AIReply]; }; /** * An event emitted by an {@link module:ai/aicore/model/aiinteraction~AIInteraction} when * the title of the conversation needs to be updated. */ export type AISetConversationTitleEvent = { name: 'setConversationTitle'; args: [title: string, shouldAnimate?: boolean]; }; /** * An event emitted by an {@link module:ai/aicore/model/aiinteraction~AIInteraction} when * the web search was performed. */ export type AIWebSearchStartedEvent = { name: 'webSearchStarted'; args: [interaction: TInteraction]; }; /** * An event emitted by an {@link module:ai/aicore/model/aiinteraction~AIInteraction} when * the web search was performed. */ export type AIWebSearchFinishedEvent = { name: 'webSearchFinished'; args: [interaction: TInteraction]; }; /** * An event emitted by an {@link module:ai/aicore/model/aiinteraction~AIInteraction} when * the reasoning was performed. */ export type AIReasoningStartedEvent = { name: 'reasoningStarted'; args: [interaction: TInteraction]; }; /** * An event emitted by an {@link module:ai/aicore/model/aiinteraction~AIInteraction} when * the reasoning was performed. */ export type AIReasoningFinishedEvent = { name: 'reasoningFinished'; args: [interaction: TInteraction]; }; /** * An event emitted by an {@link module:ai/aicore/model/aiinteraction~AIInteraction} when * data from an AI tool is received. */ export type AIToolDataReceivedEvent = { name: 'toolDataReceived'; args: [ toolData: AIToolData, interaction: TInteraction ]; }; export {};