/** * @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 */ /** * @module ai/aicore/model/airunsinglerootresult * @publicApi */ import { type Editor } from "@ckeditor/ckeditor5-core"; import { type CKEditorError } from "@ckeditor/ckeditor5-utils"; /** * The status of an AI run, reported by the {@link module:ai/aicore/model/airunsinglerootresult~AIRunSingleRootResult#status `status`}. */ export type AIRunStatus = "initialized" | "completed" | "aborted" | "error"; /** * The shape of the data accepted by the {@link module:ai/aicore/model/airunsinglerootresult~AIRunSingleRootResult} constructor. */ export type AIRunSingleRootResultInput = { /** * The editor that is the source of content for the AI run. */ editor: Editor; /** * Name of the editor root the AI run targets. */ rootName: string; /** * Collaboration channel id captured at the start of the run. */ channelId?: string; /** * AI editing session id captured at the start of the run. */ sessionId: string; }; /** * The result of an AI run. */ export declare class AIRunSingleRootResult { constructor(data: AIRunSingleRootResultInput); /** * Outcome of the run. Anything other than `'completed'` means the run did not finish successfully — see {@link #error} for details. */ get status(): AIRunStatus; /** * The editor the AI run was performed against. */ get editor(): Editor; /** * Name of the editor root the AI run targeted. */ get rootName(): string; /** * Collaboration channel id captured at the start of the run. */ get channelId(): string | undefined; /** * AI editing session id captured at the start of the run. */ get sessionId(): string; /** * Document version captured when the run started. `undefined` until the run starts. */ get documentVersion(): number | undefined; set documentVersion(value: number); /** * The pre-run document snapshot as captured at the time the run started, with `data-id` attributes preserved. * `undefined` until the run starts. */ get contentRawOld(): string | undefined; set contentRawOld(value: string); /** * The post-run document snapshot with all returned suggestions merged in, with `data-id` attributes preserved. * Equals {@link #contentRawOld} when the run produced no suggestions. `undefined` until the run completes. */ get contentRawNew(): string | undefined; set contentRawNew(value: string); /** * The {@link #contentRawOld} with `data-id` attributes stripped. Suitable for surfacing to end-users. */ get contentOld(): string; /** * The {@link #contentRawNew} with `data-id` attributes stripped. Suitable for surfacing to end-users. */ get contentNew(): string; /** * The error that caused the run to fail. * * When the failure originated in the AI service backend, its structured response (for example, an `issues` * list describing which fields failed validation) is available under `error.data.backendData`. */ get error(): Error | undefined; set error(value: CKEditorError | undefined); /** * Whether applying the result dropped the change because it would introduce block structure an inline root cannot * accept. When `true`, the run completed but {@link module:ai/aicore/aigateway~AIGateway#apply} applied nothing. */ get droppedUnsupportedInlineChange(): boolean; set droppedUnsupportedInlineChange(value: boolean); /** * Marks the run as aborted. Reflected via {@link #status}. */ abort(): void; }