/** * @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/aireviewcore/model/aireviewcheckrun */ import { type ObservableMixinConstructor } from "@ckeditor/ckeditor5-utils"; import { AIReviewCheckResult } from "./aireviewcheckresult.js"; import { AIReviewCheckResultChange } from "./aireviewcheckresultchange.js"; import { type AIReviewCheck } from "./aireviewcheck.js"; import { type AIReviewCoreChangeData, type AIDocumentData } from "../aireviewcoreediting.js"; import { type AIConnector } from "../../aicore/aiconnector.js"; import { AIContext } from "../../aicore/model/aicontext.js"; import { type Editor } from "@ckeditor/ckeditor5-core"; declare const AIReviewCheckRunBase: ObservableMixinConstructor; /** * Represents a single review check run and its results. */ export declare abstract class AIReviewCheckRun extends AIReviewCheckRunBase { /** * The status of the check run. */ status: AIReviewCheckRunStatus; /** * The check run ID. */ readonly id: string; /** * The call ID returned by the AI API when the check run is started. */ callId?: string; constructor(documentData: AIDocumentData, sourceCheck: AIReviewCheck, connector: AIConnector, params?: Array, args?: Record, context?: AIContext); /** * Returns the document data obtained at the time of the check run. */ get documentData(): AIDocumentData; /** * The check this run was constructed against. */ get sourceCheck(): AIReviewCheck; /** * Returns the number of successfully processed results. */ get processedResultsCount(): number; /** * Whether a proposed change was dropped because it would introduce block content into an inline root. */ get hasUnsupportedInlineChange(): boolean; /** * Returns the check title. */ get title(): string; /** * Returns the check subtitle. */ get subTitle(): string; /** * Returns the check ID. */ get reviewName(): string; /** * Whether the check run has any modifications (accepted or rejected changes). */ get hasModifications(): boolean; /** * Returns the current error that occurred during the check run, if any. */ get currentError(): Error | undefined; /** * Returns the list of results made by the check run. */ get results(): Array; /** * Updates the document data used for the check run. It allows to rerun the same check with different data. */ updateDocumentData(documentData: AIDocumentData): void; /** * Starts the check run resulting in an API call. After the call is finished, the status * and list of changes are updated. */ start(): Promise; /** * Restarts the check run by clearing previous results and starting a new run. */ restart(): Promise; addResultChanges(resultId: string, changes: Array): void; /** * Aborts the check run. */ abort(): void; isChangeActive(changeId: string): boolean; isAnyChangeActivated(): boolean; getActiveChanges(): Array; getChangeById(changeId: string): AIReviewCheckResultChange | undefined; markAllChangesAsAccepted(): void; markChangeAsAccepted(changeId: string): void; markChangeAsRejected(changeId: string): void; markChangeAsOutdated(changeId: string): void; markChangeAsPending(changeId: string): void; activateChange(changeId: string): void; deactivateChange(): void; forceReadyState(): void; /** * Sends the rating to an AI API for the review check run. * * If `changeId` is provided, the rating will be associated with that specific result, which * the change is a part of (since the result is splitted into multiple changes). The `resultId` * is used on the backend to track ratings for individual results. * If `changeId` is not provided, the rating will be send as general for the whole check run. * * The rating will not be send if: * - There is no `callId` (means the check run was not started or failed before getting the ID). * - There are no changes in the check run. * - The change with given `changeId` was already rated. * - The check run is not ready yet (still streaming), since we don't know the final number of changes * yet, which is required to send the rating. */ sendRating(changeId?: string): Promise; } export type AIReviewCheckRunUpdatedEvent = { name: "reviewCheckRunUpdated"; args: [{ status: AIReviewCheckRunStatus; run: AIReviewCheckRun; error?: Error; }]; }; export type AIReviewCheckResultAddedEvent = { name: "reviewCheckResultAdded"; args: [{ result: AIReviewCheckResult; source: AIReviewCheckRun; editor: Editor; rootName: string; }]; }; export type AIReviewCheckResultReadyEvent = { name: "reviewCheckResultReady"; args: [{ changes: Array; result: AIReviewCheckResult; source: AIReviewCheckRun; }]; }; export type AIReviewCheckResultChangeStatusUpdatedEvent = { name: "reviewCheckResultChangeStatusUpdated"; args: [{ change: AIReviewCheckResultChange; status: AIReviewCheckResultChange["status"]; }]; }; export type AIReviewCheckResultChangeActivatedEvent = { name: "reviewCheckResultActivated"; args: [{ change: AIReviewCheckResultChange; }]; }; export type AIReviewCheckResultChangeDeactivatedEvent = { name: "reviewCheckResultDeactivated"; args: [{ change: AIReviewCheckResultChange; }]; }; export type AIReviewCheckRunStatus = "initialized" | "loading" | "data" | "ready" | "error-chunk" | "error-general" | "aborted" | "finished" | "unmodified"; export {};