@ckeditor/ckeditor5-ai 48.3.1 → 48.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aiactions/aiactions.d.ts +36 -1
- package/dist/aiactions/model/aiactionsinteraction.d.ts +7 -1
- package/dist/aiassistant/aiassistantui.d.ts +0 -3
- package/dist/aiballoon/aiballoon.d.ts +0 -1
- package/dist/aichat/aichatballoon.d.ts +7 -2
- package/dist/aichat/aichatcontroller.d.ts +12 -2
- package/dist/aichat/aichatui.d.ts +20 -6
- package/dist/aichat/model/aichatcontext.d.ts +29 -10
- package/dist/aichat/model/aichatconversation.d.ts +10 -1
- package/dist/aichat/model/aichatinteraction.d.ts +6 -1
- package/dist/aichat/ui/aichatballoonview.d.ts +14 -19
- package/dist/aichat/ui/aichatcontrolsview.d.ts +0 -9
- package/dist/aichat/ui/aichatfeedview.d.ts +5 -11
- package/dist/aichat/ui/aichatview.d.ts +0 -4
- package/dist/aichat/ui/controls/aichatdropzoneview.d.ts +4 -0
- package/dist/aichat/ui/controls/aichatpromptcapabilitiesview.d.ts +14 -29
- package/dist/aichat/ui/feed/aichatfeedsuggestionitemview.d.ts +7 -2
- package/dist/aichathistory/aichathistoryui.d.ts +0 -1
- package/dist/aichatshortcuts/aichatshortcuts.d.ts +2 -2
- package/dist/aiconfig.d.ts +109 -0
- package/dist/aicore/aiconnector.d.ts +78 -11
- package/dist/aicore/aicore.d.ts +53 -0
- package/dist/aicore/aiediting.d.ts +8 -2
- package/dist/aicore/aigateway.d.ts +43 -11
- package/dist/aicore/errors/normalizeerror.d.ts +4 -0
- package/dist/aicore/model/aicapabilities.d.ts +20 -5
- package/dist/aicore/model/aicontext.d.ts +57 -2
- package/dist/aicore/model/aicontextlibrary.d.ts +70 -0
- package/dist/aicore/model/aicontextref.d.ts +39 -0
- package/dist/aicore/model/aidefaultcontext.d.ts +95 -0
- package/dist/aicore/model/aieditorroot.d.ts +26 -0
- package/dist/aicore/model/aimodels.d.ts +11 -4
- package/dist/aicore/model/aireply.d.ts +12 -1
- package/dist/aicore/model/airunresult.d.ts +18 -73
- package/dist/aicore/model/airunsinglerootresult.d.ts +101 -0
- package/dist/aicore/ui/aidisclaimerview.d.ts +0 -1
- package/dist/aicore/ui/aiheaderview.d.ts +0 -1
- package/dist/aicore/ui/aimodelselectorview.d.ts +151 -0
- package/dist/aicore/ui/aiskeleton.d.ts +0 -1
- package/dist/aicore/ui/aispinner.d.ts +0 -1
- package/dist/aicore/ui/suggestioncontainer/aiminitoolbarview.d.ts +0 -1
- package/dist/aicore/ui/suggestioncontainer/aisuggestionbodyview.d.ts +20 -5
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontainerview.d.ts +0 -1
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartheaderview.d.ts +12 -1
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartstateview.d.ts +4 -12
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentparttoolbarview.d.ts +6 -1
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartview.d.ts +11 -1
- package/dist/aicore/ui/suggestioncontainer/aisuggestionstreamablecontentview.d.ts +0 -1
- package/dist/aicore/utils/createandattachaibodycollection.d.ts +0 -1
- package/dist/aicore/utils/createresizebutton.d.ts +0 -1
- package/dist/aicore/utils/createstartconversationbutton.d.ts +0 -1
- package/dist/aicore/utils/geteditorconfig.d.ts +88 -0
- package/dist/aicore/utils/getmodeldisplaymode.d.ts +21 -0
- package/dist/aicore/utils/getsuggestionpartsfromreply.d.ts +4 -1
- package/dist/aicore/utils/htmlparser.d.ts +1 -0
- package/dist/aicore/utils/inlineroot.d.ts +1 -0
- package/dist/aicore/utils/tocontextrefrequestdata.d.ts +1 -0
- package/dist/aidocumentprocessing/aidocumentprocessinggateway.d.ts +48 -25
- package/dist/aidocumentprocessing/model/aidocumentprocessingrunresult.d.ts +2 -2
- package/dist/aieditorintegration/aitogglebutton/aitogglebuttonui.d.ts +0 -1
- package/dist/aiquickactions/aiquickactions.d.ts +60 -9
- package/dist/aiquickactions/aiquickactionsui.d.ts +10 -4
- package/dist/aiquickactions/ui/balloon/aiactionsballoonview.d.ts +6 -1
- package/dist/aireviewcore/aireviewcorecheckregistry.d.ts +2 -4
- package/dist/aireviewcore/aireviewcoreediting.d.ts +43 -6
- package/dist/aireviewcore/aireviewcoreui.d.ts +3 -10
- package/dist/aireviewcore/model/aichecksinglerootresult.d.ts +22 -0
- package/dist/aireviewcore/model/aireviewcheckresultchange.d.ts +12 -1
- package/dist/aireviewcore/model/aireviewcheckrun.d.ts +11 -1
- package/dist/aireviewcore/types.d.ts +7 -1
- package/dist/aireviewcore/ui/aireviewcoreballoonsuggestionview.d.ts +0 -2
- package/dist/aireviewcore/ui/aireviewcorechecklistitemresultview.d.ts +7 -0
- package/dist/aireviewcore/ui/aireviewcorecustomcheckview.d.ts +1 -19
- package/dist/aireviewcore/ui/aireviewcorefinishreviewbuttonview.d.ts +0 -1
- package/dist/aireviewcore/ui/aireviewcorereviewchecklistview.d.ts +0 -1
- package/dist/aireviewcore/ui/aireviewcorereviewcompletedview.d.ts +0 -1
- package/dist/aireviewcore/ui/aireviewcoreuicheckresultsview.d.ts +10 -8
- package/dist/aireviewcore/ui/aireviewcoreview.d.ts +3 -4
- package/dist/aireviewmode/aireviewgateway.d.ts +63 -44
- package/dist/aireviewmode/aireviewmode.d.ts +73 -5
- package/dist/aireviewmode/aireviewmodecheckregistry.d.ts +8 -1
- package/dist/aireviewmode/aireviewmodecontroller.d.ts +2 -1
- package/dist/aireviewmode/model/aireviewcheckextra.d.ts +7 -2
- package/dist/aireviewmode/model/aireviewcustomcheckrun.d.ts +2 -1
- package/dist/aitabs/aitabsmainview.d.ts +0 -1
- package/dist/aitabs/tabs/aitabsview.d.ts +0 -1
- package/dist/aitabs/tabs/tabbuttonview.d.ts +0 -1
- package/dist/aitranslate/aitranslatecontroller.d.ts +2 -1
- package/dist/aitranslate/aitranslategateway.d.ts +33 -21
- package/dist/aitranslate/aitranslateui.d.ts +0 -1
- package/dist/aitranslate/model/aitranslatecheckrun.d.ts +2 -1
- package/dist/augmentation.d.ts +2 -0
- package/dist/index-content.css +0 -97
- package/dist/index-editor.css +2640 -2631
- package/dist/index.css +36 -32
- package/dist/index.d.ts +17 -8
- package/dist/index.js +19 -19
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/package.json +30 -12
- package/dist/aireviewmode/model/aireviewrunresult.d.ts +0 -20
- package/dist/aitranslate/model/aitranslaterunresult.d.ts +0 -20
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type Locale } from "@ckeditor/ckeditor5-utils";
|
|
9
9
|
import { ButtonView } from "@ckeditor/ckeditor5-ui";
|
|
10
|
-
import "../../../theme/aireviewcore/aireviewcore-review-completed.css";
|
|
11
10
|
export declare class AIReviewCoreFinishReviewButtonView extends ButtonView {
|
|
12
11
|
constructor(buttonLabel: string, locale?: Locale);
|
|
13
12
|
}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import type { Locale } from "@ckeditor/ckeditor5-utils";
|
|
9
9
|
import { ListItemView } from "@ckeditor/ckeditor5-ui";
|
|
10
10
|
import type { AIReviewCheck } from "../model/aireviewcheck.js";
|
|
11
|
-
import "../../../theme/aireviewcore/aireviewcore-check-list.css";
|
|
12
11
|
export declare class AIReviewCoreReviewCheckListView extends ListItemView {
|
|
13
12
|
constructor(locale: Locale);
|
|
14
13
|
/**
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type Locale } from "@ckeditor/ckeditor5-utils";
|
|
9
9
|
import { ListItemView } from "@ckeditor/ckeditor5-ui";
|
|
10
|
-
import "../../../theme/aireviewcore/aireviewcore-review-completed.css";
|
|
11
10
|
export type AIReviewCoreReviewCompletedViewContents = {
|
|
12
11
|
headerText: string;
|
|
13
12
|
emptyResultsText: string;
|
|
@@ -10,9 +10,6 @@ import { ListItemView, ViewCollection } from "@ckeditor/ckeditor5-ui";
|
|
|
10
10
|
import { type AIReviewCheckResultChange } from "../model/aireviewcheckresultchange.js";
|
|
11
11
|
import { AIDisclaimerView } from "../../aicore/ui/aidisclaimerview.js";
|
|
12
12
|
import { AIReviewCoreReviewCheckListItemResultsView } from "./aireviewcorechecklistitemresultview.js";
|
|
13
|
-
import "../../../theme/aireviewcore/aireviewcore-check-run.css";
|
|
14
|
-
import "../../../theme/aireviewcore/aireviewcore-check-run-result.css";
|
|
15
|
-
import "../../../theme/aireviewcore/aireviewcore-review-completed.css";
|
|
16
13
|
export type AIReviewCoreUICheckResultsViewContents = {
|
|
17
14
|
generalErrorText: string;
|
|
18
15
|
};
|
|
@@ -59,14 +56,17 @@ export declare class AIReviewCoreUICheckResultsView extends ListItemView {
|
|
|
59
56
|
isResultReady: boolean;
|
|
60
57
|
isError: boolean;
|
|
61
58
|
showErrorMessage: boolean;
|
|
62
|
-
errorType: "chunk" | "general" | undefined;
|
|
59
|
+
errorType: "chunk" | "general" | "unsupported-inline" | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Whether "accept all" is enabled — pushed by the controller. Combined with the panel's own error state.
|
|
62
|
+
*
|
|
63
|
+
* @observable
|
|
64
|
+
*/
|
|
65
|
+
isAcceptAllEnabled: boolean;
|
|
63
66
|
constructor(locale: Locale, contents: AIReviewCoreUICheckResultsViewContents);
|
|
64
67
|
clearResults(): void;
|
|
65
68
|
getResults(): ViewCollection<AIReviewCoreReviewCheckListItemResultsView>;
|
|
66
|
-
addResult(result:
|
|
67
|
-
contentDiffed: string;
|
|
68
|
-
id: string;
|
|
69
|
-
}): void;
|
|
69
|
+
addResult(result: AIReviewCheckResultChange): void;
|
|
70
70
|
hideResult(id: string, status: AIReviewCheckResultChange["status"]): void;
|
|
71
71
|
showResult(id: string, status: AIReviewCheckResultChange["status"]): void;
|
|
72
72
|
/**
|
|
@@ -76,8 +76,10 @@ export declare class AIReviewCoreUICheckResultsView extends ListItemView {
|
|
|
76
76
|
*/
|
|
77
77
|
setTitle(title: string, subtitle?: string): void;
|
|
78
78
|
showChunkErrorMessage(): void;
|
|
79
|
+
showUnsupportedInlineChangeMessage(): void;
|
|
79
80
|
showGeneralErrorMessage(): void;
|
|
80
81
|
resetErrorState(): void;
|
|
82
|
+
setAcceptAllEnabled(isEnabled: boolean): void;
|
|
81
83
|
}
|
|
82
84
|
export type AIAbortReviewStreamEvent = {
|
|
83
85
|
name: "abortReviewStream";
|
|
@@ -11,6 +11,7 @@ import { type AIReviewCoreReviewCheckListView } from "./aireviewcorereviewcheckl
|
|
|
11
11
|
import { type AIReviewCoreReviewCompletedView } from "./aireviewcorereviewcompletedview.js";
|
|
12
12
|
import { AIReviewCoreGeneralErrorView } from "./aireviewcoregeneralerrorview.js";
|
|
13
13
|
import { type AIReviewCoreUICheckResultsView } from "./aireviewcoreuicheckresultsview.js";
|
|
14
|
+
import { type AIReviewCheckResultChange } from "../model/aireviewcheckresultchange.js";
|
|
14
15
|
export declare class AIReviewCoreView extends View {
|
|
15
16
|
/**
|
|
16
17
|
* The header of the AI Review Core.
|
|
@@ -40,10 +41,7 @@ export declare class AIReviewCoreView extends View {
|
|
|
40
41
|
});
|
|
41
42
|
showReviewCheckListView(): void;
|
|
42
43
|
showReviewCheckResultsView(): void;
|
|
43
|
-
addCheckRunResult(result:
|
|
44
|
-
contentDiffed: string;
|
|
45
|
-
id: string;
|
|
46
|
-
}): void;
|
|
44
|
+
addCheckRunResult(result: AIReviewCheckResultChange): void;
|
|
47
45
|
showReviewCompletedView(): void;
|
|
48
46
|
showActionsWhenResultIsReady(): void;
|
|
49
47
|
showNoChangesView(): void;
|
|
@@ -51,4 +49,5 @@ export declare class AIReviewCoreView extends View {
|
|
|
51
49
|
showGeneralReviewCoreErrorView(errorMessage: string): void;
|
|
52
50
|
showGeneralResultsErrorView(): void;
|
|
53
51
|
showChunkErrorView(): void;
|
|
52
|
+
showUnsupportedInlineChangeView(): void;
|
|
54
53
|
}
|
|
@@ -7,12 +7,16 @@
|
|
|
7
7
|
* @publicApi
|
|
8
8
|
*/
|
|
9
9
|
import { ContextPlugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
10
|
-
import { AIConnector
|
|
10
|
+
import { AIConnector } from "../aicore/aiconnector.js";
|
|
11
11
|
import { AIReviewCoreEditing } from "../aireviewcore/aireviewcoreediting.js";
|
|
12
12
|
import { AIReviewModeCheckRegistry } from "./aireviewmodecheckregistry.js";
|
|
13
13
|
import { AIEditing } from "../aicore/aiediting.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { type AIRunResult } from "../aicore/model/airunresult.js";
|
|
15
|
+
import { type AICheckRunSingleRootResult } from "../aireviewcore/model/aichecksinglerootresult.js";
|
|
16
|
+
import { AIGateway, type AIRunBaseOptions, type AIGatewayApplyOptions } from "../aicore/aigateway.js";
|
|
17
|
+
import { AICore } from "../aicore/aicore.js";
|
|
18
|
+
import { type AIModels } from "../aicore/model/aimodels.js";
|
|
19
|
+
import { type AIEditorRoot } from "../aicore/model/aieditorroot.js";
|
|
16
20
|
/**
|
|
17
21
|
* Review command data.
|
|
18
22
|
*/
|
|
@@ -30,7 +34,7 @@ export interface AIReviewCommandData {
|
|
|
30
34
|
*/
|
|
31
35
|
description: string;
|
|
32
36
|
/**
|
|
33
|
-
* Selectable parameters for parameterized commands (e.g. `length`, `tone`). One of these
|
|
37
|
+
* Selectable parameters for parameterized commands (e.g. `length`, `tone`). One of these IDs can be
|
|
34
38
|
* passed as `options.parameterId` when invoking the command.
|
|
35
39
|
*/
|
|
36
40
|
parameters?: Array<{
|
|
@@ -38,17 +42,31 @@ export interface AIReviewCommandData {
|
|
|
38
42
|
label: string;
|
|
39
43
|
}>;
|
|
40
44
|
}
|
|
41
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Roots filter shared by both `AIReviewRunOptions` and `AIReviewCustomRunOptions`.
|
|
47
|
+
*/
|
|
48
|
+
export type AIReviewRootsOption = {
|
|
49
|
+
/**
|
|
50
|
+
* The roots to run the review against. When omitted, every visible root across every editor in the current
|
|
51
|
+
* {@link module:core/context~Context `Context`} is reviewed. When provided, only the listed roots are reviewed;
|
|
52
|
+
* the order of entries in `roots` is treated as a set-membership filter and does not affect the payload order.
|
|
53
|
+
*
|
|
54
|
+
* Each entry's `channelId` must match an editor's `collaboration.channelId`; `rootName` must match a live,
|
|
55
|
+
* visible (non-`$graveyard`) root within that editor.
|
|
56
|
+
*/
|
|
57
|
+
roots?: Array<AIEditorRoot>;
|
|
58
|
+
};
|
|
59
|
+
export type AIReviewRunOptions = AIReviewRootsOption & {
|
|
42
60
|
/**
|
|
43
61
|
* Id of one of the values in {@link module:ai/aireviewmode/aireviewgateway~AIReviewCommandData#parameters}.
|
|
44
62
|
* Applicable to parameterized commands (e.g. `length`, `tone`), ignored otherwise.
|
|
45
63
|
*/
|
|
46
64
|
parameterId?: string;
|
|
47
65
|
};
|
|
48
|
-
export type AIReviewCustomRunOptions = {
|
|
66
|
+
export type AIReviewCustomRunOptions = AIReviewRootsOption & {
|
|
49
67
|
/**
|
|
50
68
|
* The model that will be used to run the custom command.
|
|
51
|
-
* The
|
|
69
|
+
* The IDs of an AI models can be acquired via {@link module:ai/aicore/model/aimodels~AIModels#getAvailableModels}.
|
|
52
70
|
*/
|
|
53
71
|
model?: string;
|
|
54
72
|
};
|
|
@@ -68,7 +86,16 @@ export declare class AIReviewGateway extends ContextPlugin {
|
|
|
68
86
|
/**
|
|
69
87
|
* @inheritDoc
|
|
70
88
|
*/
|
|
71
|
-
static get requires(): PluginDependenciesOf<[AIReviewCoreEditing, AIReviewModeCheckRegistry, AIConnector, AIEditing, AIGateway]>;
|
|
89
|
+
static get requires(): PluginDependenciesOf<[AIReviewCoreEditing, AIReviewModeCheckRegistry, AIConnector, AIEditing, AIGateway, AICore]>;
|
|
90
|
+
/**
|
|
91
|
+
* The shared model registry. Exposed here so headless gateways are self-sufficient — integrators can
|
|
92
|
+
* discover and resolve models (`getAvailableModels()`, `getModel()`, `resolveModel()`, …) without
|
|
93
|
+
* reaching for the `AICore` plugin directly.
|
|
94
|
+
*
|
|
95
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
96
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
97
|
+
*/
|
|
98
|
+
get models(): AIModels;
|
|
72
99
|
/**
|
|
73
100
|
* @inheritDoc
|
|
74
101
|
*/
|
|
@@ -92,62 +119,54 @@ export declare class AIReviewGateway extends ContextPlugin {
|
|
|
92
119
|
*/
|
|
93
120
|
getAllCommands(): Promise<Array<AIReviewCommandData>>;
|
|
94
121
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* {@link module:ai/aireviewmode/aireviewmode~AIReviewModeConfig#extraCommands `ai.review.extraCommands`}
|
|
101
|
-
*
|
|
102
|
-
* This is a convenience proxy to the {@link module:ai/aicore/aigateway~AIGateway#getAvailableModels} method.
|
|
103
|
-
*
|
|
104
|
-
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
105
|
-
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
106
|
-
*/
|
|
107
|
-
getAvailableModels(): Promise<Array<AIModelData>>;
|
|
108
|
-
/**
|
|
109
|
-
* Runs the given review command and returns
|
|
110
|
-
* the {@link module:ai/aireviewmode/model/aireviewrunresult~AIReviewRunResult detailed result}.
|
|
122
|
+
* Runs the given review command against every visible root across every editor in the current
|
|
123
|
+
* {@link module:core/context~Context `Context`} and returns an
|
|
124
|
+
* {@link module:ai/aicore/model/airunresult~AIRunResult} — a container with one
|
|
125
|
+
* {@link module:ai/aireviewcore/model/aichecksinglerootresult~AICheckRunSingleRootResult} per root and whole-run
|
|
126
|
+
* `status` / `error`. Accepts built-in commands and extra commands configured via
|
|
127
|
+
* {@link module:ai/aireviewmode/aireviewmode~AIReviewModeConfig#extraCommands `ai.review.extraCommands`}.
|
|
111
128
|
*
|
|
112
|
-
*
|
|
113
|
-
* to the editor use {@link #applyReview}. Accepts built-in commands and extra commands configured
|
|
114
|
-
* via {@link module:ai/aireviewmode/aireviewmode~AIReviewModeConfig#extraCommands `ai.review.extraCommands`}
|
|
129
|
+
* To insert or suggest changes back to the editor, pass the returned result to {@link #applyReview}.
|
|
115
130
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
131
|
+
* When the `roots` option is provided, its entries are validated at the call boundary; an entry that does not
|
|
132
|
+
* resolve to a live, visible (non-`$graveyard`) root throws `ai-reviewcoreediting-root-not-found`, and an
|
|
133
|
+
* explicitly empty `roots` array throws `ai-reviewcoreediting-empty-roots`.
|
|
119
134
|
*
|
|
120
135
|
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
121
136
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
122
137
|
* @param commandId Id of a command returned by {@link #getAllCommands}.
|
|
123
|
-
* @param options Optional `parameterId
|
|
138
|
+
* @param options Optional `parameterId`, `roots` filter, and `signal` to allow aborting the run.
|
|
124
139
|
*/
|
|
125
|
-
runReview(commandId: string, options?: AIReviewHeadlessRunOptions): Promise<
|
|
140
|
+
runReview(commandId: string, options?: AIReviewHeadlessRunOptions): Promise<AIRunResult<AICheckRunSingleRootResult>>;
|
|
126
141
|
/**
|
|
127
|
-
* Runs the `custom` review command
|
|
128
|
-
*
|
|
142
|
+
* Runs the `custom` review command against every visible root across every editor in the current
|
|
143
|
+
* {@link module:core/context~Context `Context`} and returns an
|
|
144
|
+
* {@link module:ai/aicore/model/airunresult~AIRunResult}.
|
|
129
145
|
*
|
|
130
|
-
* The command requires a prompt to run, and optional model
|
|
131
|
-
*
|
|
146
|
+
* The command requires a prompt to run, and optional model ID. The list of available models can be discovered
|
|
147
|
+
* via {@link module:ai/aicore/model/aimodels~AIModels#getAvailableModels}.
|
|
132
148
|
*
|
|
133
149
|
* Analogical to {@link #runReview} but restricted to the `custom` command only.
|
|
134
150
|
*
|
|
135
151
|
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
136
152
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
137
153
|
* @param prompt The prompt to run the `custom` command with.
|
|
138
|
-
* @param options Optional `model` (optional override),
|
|
154
|
+
* @param options Optional `model` (optional override), `roots` filter, and `signal` to allow aborting the run.
|
|
139
155
|
*/
|
|
140
|
-
runCustomReview(prompt: string, options?: AIReviewHeadlessCustomRunOptions): Promise<
|
|
156
|
+
runCustomReview(prompt: string, options?: AIReviewHeadlessCustomRunOptions): Promise<AIRunResult<AICheckRunSingleRootResult>>;
|
|
141
157
|
/**
|
|
142
|
-
* Applies
|
|
143
|
-
* as direct changes or as track
|
|
158
|
+
* Applies a review run result (produced by {@link #runReview} or {@link #runCustomReview}) to the editor content,
|
|
159
|
+
* either as direct changes or as track-changes suggestions. Each per-root sub-result is applied to the root
|
|
160
|
+
* identified by its own `channelId` and `rootName`. Pass `options.roots` to restrict the apply to a subset of
|
|
161
|
+
* roots — the filter is symmetric with the one accepted by {@link #runReview} / {@link #runCustomReview}.
|
|
144
162
|
*
|
|
145
|
-
*
|
|
163
|
+
* By default the apply is stamped with `aiSource: 'review'`; pass `options.aiSource` to override.
|
|
146
164
|
*
|
|
147
165
|
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
148
166
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
149
|
-
* @param result The result
|
|
150
|
-
* @param
|
|
167
|
+
* @param result The result returned by {@link #runReview} or {@link #runCustomReview}.
|
|
168
|
+
* @param options Apply options forwarded to {@link module:ai/aicore/aigateway~AIGateway#apply}, including the
|
|
169
|
+
* `applyMethod` and an optional `roots` filter.
|
|
151
170
|
*/
|
|
152
|
-
applyReview(result:
|
|
171
|
+
applyReview(result: AIRunResult<AICheckRunSingleRootResult>, options: AIGatewayApplyOptions): void;
|
|
153
172
|
}
|
|
@@ -11,6 +11,7 @@ import { AIReviewModeUI } from "./aireviewmodeui.js";
|
|
|
11
11
|
import { AIReviewCoreEditing } from "../aireviewcore/aireviewcoreediting.js";
|
|
12
12
|
import { AIReviewModeController } from "./aireviewmodecontroller.js";
|
|
13
13
|
import { type AIReviewCommandData, type AIReviewCustomRunOptions, AIReviewGateway, type AIReviewRunOptions } from "./aireviewgateway.js";
|
|
14
|
+
import { type AIContextRef } from "../aicore/model/aicontextref.js";
|
|
14
15
|
/**
|
|
15
16
|
* The AI Review Mode feature.
|
|
16
17
|
*
|
|
@@ -43,7 +44,7 @@ export declare class AIReviewMode extends ContextPlugin {
|
|
|
43
44
|
* the full UI-driven flow.
|
|
44
45
|
*
|
|
45
46
|
* Preconditions:
|
|
46
|
-
* - The command must be available in the UI. Not available commands or unknown
|
|
47
|
+
* - The command must be available in the UI. Not available commands or unknown IDs throw `ai-reviewmode-unknown-command`.
|
|
47
48
|
* - The `commandId` must point at a built-in system command or an extra command configured via
|
|
48
49
|
* {@link module:ai/aireviewmode/aireviewmode~AIReviewModeConfig#extraCommands `ai.review.extraCommands`}.
|
|
49
50
|
* The built-in `custom` command throws `ai-reviewmode-not-a-system-command`. Use {@link #startCustomReview} instead
|
|
@@ -68,8 +69,8 @@ export declare class AIReviewMode extends ContextPlugin {
|
|
|
68
69
|
* Preconditions:
|
|
69
70
|
* - The `custom` command must be available in the UI. If not, the method throws `ai-reviewmode-unknown-command`.
|
|
70
71
|
* - A model must be resolvable from `options.model` or the command's default. Otherwise the method throws
|
|
71
|
-
* `ai-reviewmode-missing-custom-command-model`. Use {@link module:ai/
|
|
72
|
-
* for valid model
|
|
72
|
+
* `ai-reviewmode-missing-custom-command-model`. Use {@link module:ai/aicore/model/aimodels~AIModels#getAvailableModels}
|
|
73
|
+
* for valid model IDs.
|
|
73
74
|
*
|
|
74
75
|
* The returned promise resolves once the review run is dispatched to the controller. The command itself
|
|
75
76
|
* continues to run asynchronously and the UI reflects its progress. Stream-phase failures surface via
|
|
@@ -79,7 +80,7 @@ export declare class AIReviewMode extends ContextPlugin {
|
|
|
79
80
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
80
81
|
* @param prompt The prompt to run the `custom` command with.
|
|
81
82
|
* @param options Optional `model` to run command with this specific model, instead of the default one.
|
|
82
|
-
* Use {@link module:ai/
|
|
83
|
+
* Use {@link module:ai/aicore/model/aimodels~AIModels#getAvailableModels} for valid model IDs.
|
|
83
84
|
*/
|
|
84
85
|
startCustomReview(prompt: string, options?: AIReviewCustomRunOptions): Promise<void>;
|
|
85
86
|
/**
|
|
@@ -153,6 +154,12 @@ export interface AIReviewModeConfig {
|
|
|
153
154
|
* description: 'Expand abbreviations in the document.',
|
|
154
155
|
* prompt: 'Suggest expansions for abbreviations in the document.',
|
|
155
156
|
* model: 'gpt-5-2' // Optional, if not set, default model will be used.
|
|
157
|
+
* },
|
|
158
|
+
* {
|
|
159
|
+
* id: 'style-guide',
|
|
160
|
+
* label: 'Style Guide',
|
|
161
|
+
* description: 'Check the document against the style guide.',
|
|
162
|
+
* context: { id: 'style-guide', promptId: 'review-rules' }
|
|
156
163
|
* }
|
|
157
164
|
* ]
|
|
158
165
|
* }
|
|
@@ -184,10 +191,71 @@ export interface AIReviewModeConfig {
|
|
|
184
191
|
*/
|
|
185
192
|
extraCommands?: Array<AIReviewCustomCommand>;
|
|
186
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* An extra review command definition.
|
|
196
|
+
*
|
|
197
|
+
* The command needs a prompt source, provided in one of three ways:
|
|
198
|
+
*
|
|
199
|
+
* * an inline `prompt` string - sent as the prompt,
|
|
200
|
+
* * a `context` reference - the referenced context drives the command (for example through a prompt it contains),
|
|
201
|
+
* * both - the inline `prompt` is used and the `context` is attached as additional reference material (for example a file).
|
|
202
|
+
*
|
|
203
|
+
* The `model` property is optional. If not specified, the default model is used.
|
|
204
|
+
*
|
|
205
|
+
* ```ts
|
|
206
|
+
* {
|
|
207
|
+
* id: 'improve-captions',
|
|
208
|
+
* label: 'Improve Captions',
|
|
209
|
+
* description: 'Improve image captions in the document.',
|
|
210
|
+
* prompt: 'Suggest improvements for the image captions in the document.'
|
|
211
|
+
* }
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* The same command using a `context` reference instead of an inline `prompt`:
|
|
215
|
+
*
|
|
216
|
+
* ```ts
|
|
217
|
+
* {
|
|
218
|
+
* id: 'improve-captions',
|
|
219
|
+
* label: 'Improve Captions',
|
|
220
|
+
* description: 'Improve image captions in the document.',
|
|
221
|
+
* context: { id: 'style-guide', promptId: 'improve-captions' }
|
|
222
|
+
* }
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* An inline `prompt` combined with a `context` that attaches a single file as reference material:
|
|
226
|
+
*
|
|
227
|
+
* ```ts
|
|
228
|
+
* {
|
|
229
|
+
* id: 'improve-captions',
|
|
230
|
+
* label: 'Improve Captions',
|
|
231
|
+
* description: 'Improve image captions in the document.',
|
|
232
|
+
* prompt: 'Suggest improvements for the image captions in the document.',
|
|
233
|
+
* context: { id: 'style-guide', fileId: 'caption-examples' }
|
|
234
|
+
* }
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
187
237
|
export type AIReviewCustomCommand = {
|
|
188
238
|
id: string;
|
|
189
239
|
label: string;
|
|
190
240
|
description: string;
|
|
191
|
-
prompt: string;
|
|
192
241
|
model?: string;
|
|
242
|
+
/**
|
|
243
|
+
* The prompt to be sent to the AI model when the command is executed.
|
|
244
|
+
*
|
|
245
|
+
* At least one prompt source is required: an inline `prompt`, a `context` that carries a prompt (a whole context
|
|
246
|
+
* or a `promptId` reference), or both. A `context` that references only a single file (`fileId`) cannot drive the
|
|
247
|
+
* command on its own and must be combined with an inline `prompt`.
|
|
248
|
+
*/
|
|
249
|
+
readonly prompt?: string;
|
|
250
|
+
/**
|
|
251
|
+
* A context reference attached to the command.
|
|
252
|
+
*
|
|
253
|
+
* When no inline `prompt` is provided, the referenced context drives the command (a whole context or a `promptId`
|
|
254
|
+
* reference). When combined with an inline `prompt`, it is attached as additional reference material (for example
|
|
255
|
+
* a single file).
|
|
256
|
+
*
|
|
257
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
258
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
259
|
+
*/
|
|
260
|
+
readonly context?: AIContextRef;
|
|
193
261
|
};
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module ai/aireviewmode/aireviewmodecheckregistry
|
|
7
7
|
*/
|
|
8
|
-
import { type Context, type Editor } from "@ckeditor/ckeditor5-core";
|
|
8
|
+
import { type Context, type Editor, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
9
9
|
import { CKEditorError } from "@ckeditor/ckeditor5-utils";
|
|
10
|
+
import { AICore } from "../aicore/aicore.js";
|
|
11
|
+
import { AIConnector } from "../aicore/aiconnector.js";
|
|
12
|
+
import { AIErrorSink } from "../aicore/aierrorreporter.js";
|
|
10
13
|
import { AIReviewCoreCheckRegistry } from "../aireviewcore/aireviewcorecheckregistry.js";
|
|
11
14
|
import { type AIReviewCheckExtraDefinition } from "../aireviewcore/types.js";
|
|
12
15
|
import { AIReviewModeCheckList } from "./model/aireviewmodechecklist.js";
|
|
@@ -25,6 +28,10 @@ export declare class AIReviewModeCheckRegistry extends AIReviewCoreCheckRegistry
|
|
|
25
28
|
/**
|
|
26
29
|
* @inheritDoc
|
|
27
30
|
*/
|
|
31
|
+
static override get requires(): PluginDependenciesOf<[AIConnector, AIErrorSink, AICore]>;
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
28
35
|
constructor(context: Context | Editor);
|
|
29
36
|
/**
|
|
30
37
|
* The error captured during the last models fetch, or `null` if the fetch succeeded
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { AIReviewCoreController } from "../aireviewcore/aireviewcorecontroller.js";
|
|
6
6
|
import { AIErrorSink } from "../aicore/aierrorreporter.js";
|
|
7
|
+
import { AICore } from "../aicore/aicore.js";
|
|
7
8
|
import { AIReviewModeCheckRegistry } from "./aireviewmodecheckregistry.js";
|
|
8
9
|
import type { PluginDependenciesOf, Context, Editor } from "@ckeditor/ckeditor5-core";
|
|
9
10
|
export declare class AIReviewModeController extends AIReviewCoreController {
|
|
@@ -14,7 +15,7 @@ export declare class AIReviewModeController extends AIReviewCoreController {
|
|
|
14
15
|
/**
|
|
15
16
|
* @inheritDoc
|
|
16
17
|
*/
|
|
17
|
-
static get requires(): PluginDependenciesOf<[AIErrorSink, AIReviewModeCheckRegistry]>;
|
|
18
|
+
static get requires(): PluginDependenciesOf<[AIErrorSink, AIReviewModeCheckRegistry, AICore]>;
|
|
18
19
|
/**
|
|
19
20
|
* @inheritDoc
|
|
20
21
|
*/
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type AIReviewCheckExtraDefinition } from "../../aireviewcore/types.js";
|
|
9
9
|
import { type AIModelData } from "../../aicore/aiconnector.js";
|
|
10
|
+
import { type AIContextRef } from "../../aicore/model/aicontextref.js";
|
|
10
11
|
import { AIReviewCheck } from "../../aireviewcore/model/aireviewcheck.js";
|
|
11
12
|
/**
|
|
12
13
|
* Represents the extra check that can be added via
|
|
@@ -20,9 +21,13 @@ export declare class AIReviewCheckExtra extends AIReviewCheck {
|
|
|
20
21
|
*/
|
|
21
22
|
isExtra: boolean;
|
|
22
23
|
/**
|
|
23
|
-
* The prompt text for this extra check run.
|
|
24
|
+
* The prompt text for this extra check run. Not set when the check references a prompt through {@link #context}.
|
|
24
25
|
*/
|
|
25
|
-
prompt: string;
|
|
26
|
+
prompt: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The context reference used instead of an inline {@link #prompt}.
|
|
29
|
+
*/
|
|
30
|
+
context: AIContextRef | undefined;
|
|
26
31
|
/**
|
|
27
32
|
* The model for this extra check run.
|
|
28
33
|
*/
|
|
@@ -9,12 +9,13 @@ import { AIReviewCheckRun } from "../../aireviewcore/model/aireviewcheckrun.js";
|
|
|
9
9
|
import { type AIConnector } from "../../aicore/aiconnector.js";
|
|
10
10
|
import { type AIDocumentData } from "../../aireviewcore/aireviewcoreediting.js";
|
|
11
11
|
import { type AIReviewCheck } from "../../aireviewcore/model/aireviewcheck.js";
|
|
12
|
+
import { type AIContextRef } from "../../aicore/model/aicontextref.js";
|
|
12
13
|
/**
|
|
13
14
|
* Represents a single custom review check
|
|
14
15
|
* ({@link module:ai/aireviewmode/model/aireviewcheckcustom~AIReviewCheckCustom}) run and its results.
|
|
15
16
|
*/
|
|
16
17
|
export declare class AIReviewCustomCheckRun extends AIReviewCheckRun {
|
|
17
|
-
constructor(prompt: string, model: string, documentData: AIDocumentData, sourceCheck: AIReviewCheck, connector: AIConnector);
|
|
18
|
+
constructor(prompt: string | undefined, model: string, documentData: AIDocumentData, sourceCheck: AIReviewCheck, connector: AIConnector, contexts?: Array<AIContextRef>);
|
|
18
19
|
/**
|
|
19
20
|
* @inheritDoc
|
|
20
21
|
*/
|
|
@@ -10,7 +10,6 @@ import { View, type ViewCollection } from "@ckeditor/ckeditor5-ui";
|
|
|
10
10
|
import { type ArrayOrItem, type Locale } from "@ckeditor/ckeditor5-utils";
|
|
11
11
|
import { TabButtonView } from "./tabbuttonview.js";
|
|
12
12
|
import { TabPanelView } from "./tabpanelview.js";
|
|
13
|
-
import "../../../theme/aitabs/tabs/tabsview.css";
|
|
14
13
|
export declare const AI_TABS_POSITIONS: readonly ["top", "left", "right"];
|
|
15
14
|
/**
|
|
16
15
|
* A view component that manages the tabs and their panels.
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import { ButtonView } from "@ckeditor/ckeditor5-ui";
|
|
9
9
|
import { type ArrayOrItem, type Locale } from "@ckeditor/ckeditor5-utils";
|
|
10
10
|
import type { AI_TABS_POSITIONS } from "./aitabsview.js";
|
|
11
|
-
import "../../../theme/aitabs/tabs/tabbuttonview.css";
|
|
12
11
|
/**
|
|
13
12
|
* A button that toggles the visibility of a tab in the tabs view component.
|
|
14
13
|
*/
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @module ai/aitranslate/aitranslatecontroller
|
|
7
7
|
*/
|
|
8
8
|
import { AIReviewCoreController } from "../aireviewcore/aireviewcorecontroller.js";
|
|
9
|
+
import { AICore } from "../aicore/aicore.js";
|
|
9
10
|
import { AIErrorSink } from "../aicore/aierrorreporter.js";
|
|
10
11
|
import { AITranslateCheckRegistry } from "./aitranslatecheckregistry.js";
|
|
11
12
|
import type { PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
@@ -17,5 +18,5 @@ export declare class AITranslateController extends AIReviewCoreController {
|
|
|
17
18
|
/**
|
|
18
19
|
* @inheritDoc
|
|
19
20
|
*/
|
|
20
|
-
static get requires(): PluginDependenciesOf<[AIErrorSink, AITranslateCheckRegistry]>;
|
|
21
|
+
static get requires(): PluginDependenciesOf<[AIErrorSink, AITranslateCheckRegistry, AICore]>;
|
|
21
22
|
}
|
|
@@ -9,14 +9,21 @@
|
|
|
9
9
|
import { ContextPlugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
10
10
|
import { AIConnector } from "../aicore/aiconnector.js";
|
|
11
11
|
import { AIReviewCoreEditing } from "../aireviewcore/aireviewcoreediting.js";
|
|
12
|
-
import {
|
|
12
|
+
import type { AIRunResult } from "../aicore/model/airunresult.js";
|
|
13
|
+
import type { AICheckRunSingleRootResult } from "../aireviewcore/model/aichecksinglerootresult.js";
|
|
13
14
|
import { AIEditing } from "../aicore/aiediting.js";
|
|
14
|
-
import { AIGateway, type AIGatewayApplyOptions } from "../aicore/aigateway.js";
|
|
15
|
-
|
|
15
|
+
import { AIGateway, type AIGatewayApplyOptions, type AIRunBaseOptions } from "../aicore/aigateway.js";
|
|
16
|
+
import { type AIEditorRoot } from "../aicore/model/aieditorroot.js";
|
|
17
|
+
export type AITranslateRunOptions = AIRunBaseOptions & {
|
|
16
18
|
/**
|
|
17
|
-
*
|
|
19
|
+
* The roots to translate. When omitted, every non-`$graveyard` root across every editor in the current
|
|
20
|
+
* `Context` is translated. When provided, only the listed roots are translated; the order of entries in
|
|
21
|
+
* `roots` is treated as a set-membership filter and does not affect the payload order.
|
|
22
|
+
*
|
|
23
|
+
* Each entry's `channelId` must match an editor's `collaboration.channelId`; `rootName` must match a
|
|
24
|
+
* non-`$graveyard` root within that editor.
|
|
18
25
|
*/
|
|
19
|
-
|
|
26
|
+
roots?: Array<AIEditorRoot>;
|
|
20
27
|
};
|
|
21
28
|
/**
|
|
22
29
|
* Headless, stateless public API for running AI translations end-to-end.
|
|
@@ -42,15 +49,20 @@ export declare class AITranslateGateway extends ContextPlugin {
|
|
|
42
49
|
*/
|
|
43
50
|
static override get isPremiumPlugin(): true;
|
|
44
51
|
/**
|
|
45
|
-
* Translates
|
|
46
|
-
*
|
|
52
|
+
* Translates every non-`$graveyard` root across every editor in the current `Context` into the given language and
|
|
53
|
+
* returns one {@link module:ai/aireviewcore/model/aichecksinglerootresult~AICheckRunSingleRootResult result} per root. Each
|
|
54
|
+
* result carries its own `channelId` and `rootName`, identifying the editor/root it belongs to.
|
|
47
55
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
56
|
+
* Each per-root result can then be processed independently. To insert or suggest changes back to the editor,
|
|
57
|
+
* pass the full array (or any caller-filtered subset) to {@link #applyTranslate}.
|
|
50
58
|
*
|
|
51
|
-
*
|
|
59
|
+
* Each per-root {@link module:ai/aireviewcore/model/aichecksinglerootresult~AICheckRunSingleRootResult} always resolves —
|
|
52
60
|
* transport, parsing and merge failures are surfaced via `status: 'error'` plus the `error` field, not thrown.
|
|
53
|
-
* Aborts (via `options.signal`) are reported as `status: 'aborted'
|
|
61
|
+
* Aborts (via `options.signal`) are reported as `status: 'aborted'` on every per-root entry.
|
|
62
|
+
*
|
|
63
|
+
* When the `roots` option is provided, its entries are validated at the call boundary. An entry that does not
|
|
64
|
+
* resolve to a live, non-`$graveyard` root throws `ai-reviewcoreediting-root-not-found`; an empty `roots` array
|
|
65
|
+
* throws `ai-reviewcoreediting-empty-roots`.
|
|
54
66
|
*
|
|
55
67
|
* The target language is not restricted to a predefined list and is forwarded to the translate endpoint as-is.
|
|
56
68
|
* See the {@glink features/ai/ckeditor-ai-translate#supported-languages supported languages} guide.
|
|
@@ -58,20 +70,20 @@ export declare class AITranslateGateway extends ContextPlugin {
|
|
|
58
70
|
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
59
71
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
60
72
|
* @param language The target language to translate the content into.
|
|
61
|
-
* @param options Optional `signal` to allow aborting the run.
|
|
73
|
+
* @param options Optional `roots` filter and `signal` to allow aborting the run.
|
|
62
74
|
*/
|
|
63
|
-
runTranslate(language: string, options?: AITranslateRunOptions): Promise<
|
|
75
|
+
runTranslate(language: string, options?: AITranslateRunOptions): Promise<AIRunResult<AICheckRunSingleRootResult>>;
|
|
64
76
|
/**
|
|
65
|
-
* Applies
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
77
|
+
* Applies a translate run result (produced by {@link #runTranslate}) to the editor content, either as direct
|
|
78
|
+
* changes or as track-changes suggestions. Each per-root sub-result is applied to the root identified by its own
|
|
79
|
+
* `channelId` and `rootName`. Pass `options.roots` to restrict the apply to a subset of roots — the filter is
|
|
80
|
+
* symmetric with the one accepted by {@link #runTranslate}.
|
|
69
81
|
*
|
|
70
82
|
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
71
83
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
72
|
-
* @param result The result
|
|
73
|
-
* @param options Apply options forwarded to {@link module:ai/aicore/aigateway~AIGateway#apply}
|
|
74
|
-
* `applyMethod`
|
|
84
|
+
* @param result The result returned by {@link #runTranslate}.
|
|
85
|
+
* @param options Apply options forwarded to {@link module:ai/aicore/aigateway~AIGateway#apply}, including the
|
|
86
|
+
* `applyMethod` and an optional `roots` filter.
|
|
75
87
|
*/
|
|
76
|
-
applyTranslate(result:
|
|
88
|
+
applyTranslate(result: AIRunResult<AICheckRunSingleRootResult>, options: AIGatewayApplyOptions): void;
|
|
77
89
|
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { AIReviewCoreUI } from "../aireviewcore/aireviewcoreui.js";
|
|
6
6
|
import { AIReviewCoreView } from "../aireviewcore/ui/aireviewcoreview.js";
|
|
7
|
-
import "../../theme/aitranslate/aitranslate.css";
|
|
8
7
|
export declare class AITranslateUI extends AIReviewCoreUI {
|
|
9
8
|
/**
|
|
10
9
|
* @inheritDoc
|
|
@@ -9,6 +9,7 @@ import { type AIConnector } from "../../aicore/aiconnector.js";
|
|
|
9
9
|
import { type AIDocumentData } from "../../aireviewcore/aireviewcoreediting.js";
|
|
10
10
|
import { type AIReviewCheck } from "../../aireviewcore/model/aireviewcheck.js";
|
|
11
11
|
import { AIReviewSystemCheckRun } from "../../aireviewcore/model/aireviewsystemcheckrun.js";
|
|
12
|
+
import { type AIContextRef } from "../../aicore/model/aicontextref.js";
|
|
12
13
|
/**
|
|
13
14
|
* Represents a single translate check run and its results.
|
|
14
15
|
*/
|
|
@@ -16,7 +17,7 @@ export declare class AITranslateCheckRun extends AIReviewSystemCheckRun {
|
|
|
16
17
|
/**
|
|
17
18
|
* @inheritDoc
|
|
18
19
|
*/
|
|
19
|
-
constructor(documentData: AIDocumentData, sourceCheck: AIReviewCheck, connector: AIConnector, title: string, params?: Array<string>, args?: Record<string, any>);
|
|
20
|
+
constructor(documentData: AIDocumentData, sourceCheck: AIReviewCheck, connector: AIConnector, title: string, params?: Array<string>, args?: Record<string, any>, contexts?: Array<AIContextRef>);
|
|
20
21
|
/**
|
|
21
22
|
* @inheritDoc
|
|
22
23
|
*/
|