@ckeditor/ckeditor5-ai 48.3.1 → 48.4.0-alpha.0
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
|
@@ -9,10 +9,11 @@ import { type Locale } from "@ckeditor/ckeditor5-utils";
|
|
|
9
9
|
import { AIChatFeedItemView, type AIChatItemViewOptions } from "./aichatfeeditemview.js";
|
|
10
10
|
import { type AISuggestionContentPartDefinition } from "../../../aicore/utils/getsuggestionpartsfromreply.js";
|
|
11
11
|
import { type AISuggestionActionName } from "./aichatfeedsuggestionitemactionsview.js";
|
|
12
|
-
import { type AIReplyChangeGroupState } from "../../../aicore/model/aireply.js";
|
|
12
|
+
import { type AIReplyChangeGroupState, type AIReplyChangeGroupOutdatedReason } from "../../../aicore/model/aireply.js";
|
|
13
13
|
import { type AISource } from "../../../aicore/aiconnector.js";
|
|
14
14
|
import { type AISuggestionBodyViewContentPartView } from "../../../aicore/ui/suggestioncontainer/aisuggestioncontentpartview.js";
|
|
15
15
|
import { type BodyCollection } from "@ckeditor/ckeditor5-ui";
|
|
16
|
+
import { type AISuggestionGating } from "../../../aicore/ui/suggestioncontainer/aisuggestionbodyview.js";
|
|
16
17
|
/**
|
|
17
18
|
* A view for an AI suggestion item in the AI chat feed.
|
|
18
19
|
*
|
|
@@ -44,7 +45,7 @@ export declare class AIChatFeedSuggestionItemView extends AIChatFeedItemView {
|
|
|
44
45
|
/**
|
|
45
46
|
* Updates the state of a content part by its index.
|
|
46
47
|
*/
|
|
47
|
-
updatePartState(index: number, state: AIReplyChangeGroupState): void;
|
|
48
|
+
updatePartState(index: number, state: AIReplyChangeGroupState, outdatedReason?: AIReplyChangeGroupOutdatedReason): void;
|
|
48
49
|
/**
|
|
49
50
|
* Sets the part active or not (active parts are those currently previewed in a dialog by the user).
|
|
50
51
|
*
|
|
@@ -55,6 +56,10 @@ export declare class AIChatFeedSuggestionItemView extends AIChatFeedItemView {
|
|
|
55
56
|
updateSources(sources: Array<AISource>): void;
|
|
56
57
|
getPartView(index: number): AISuggestionBodyViewContentPartView | null;
|
|
57
58
|
/**
|
|
59
|
+
* Applies the gating state to this suggestion's body view.
|
|
60
|
+
*/
|
|
61
|
+
setGating(gating: AISuggestionGating): void;
|
|
62
|
+
/**
|
|
58
63
|
* Marks the suggestion as done and additionally updates the visibility of the actions view
|
|
59
64
|
* depending if any suggestion parts are actionable.
|
|
60
65
|
*/
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type Context, type Editor, ContextPlugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
9
9
|
import { AITabs } from "../aitabs/aitabs.js";
|
|
10
|
-
import "../../theme/aichat/aichathistory.css";
|
|
11
10
|
export declare const AI_CHAT_HISTORY_UI_EVENT_NAMES: readonly ["showConversationHistory", "removeConversation", "editConversationTitle", "setConversationPinned", "selectConversation", "startConversation"];
|
|
12
11
|
export declare class AIChatHistoryUI extends ContextPlugin {
|
|
13
12
|
/**
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* @publicApi
|
|
8
8
|
*/
|
|
9
9
|
import { AIChatUI } from "../aichat/aichatui.js";
|
|
10
|
+
import { AICore } from "../aicore/aicore.js";
|
|
10
11
|
import { ContextPlugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
11
|
-
import "../../theme/aichatshortcuts/aichatshortcuts.css";
|
|
12
12
|
/**
|
|
13
13
|
* The type of the shortcut.
|
|
14
14
|
*
|
|
@@ -28,7 +28,7 @@ export declare class AIChatShortcuts extends ContextPlugin {
|
|
|
28
28
|
/**
|
|
29
29
|
* @inheritDoc
|
|
30
30
|
*/
|
|
31
|
-
static get requires(): PluginDependenciesOf<[AIChatUI]>;
|
|
31
|
+
static get requires(): PluginDependenciesOf<[AIChatUI, AICore]>;
|
|
32
32
|
/**
|
|
33
33
|
* @inheritDoc
|
|
34
34
|
*/
|
package/dist/aiconfig.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { type AIQuickActionsConfig } from "./aiquickactions/aiquickactions.js";
|
|
|
13
13
|
import { type AITranslateConfig } from "./aitranslate/aitranslate.js";
|
|
14
14
|
import { type AIModelsConfig } from "./aicore/model/aimodels.js";
|
|
15
15
|
import { type AIReviewModeConfig } from "./aireviewmode/aireviewmode.js";
|
|
16
|
+
import { type AIDefaultContext } from "./aicore/model/aidefaultcontext.js";
|
|
16
17
|
/**
|
|
17
18
|
* The configuration for all AI-related functionalities.
|
|
18
19
|
*
|
|
@@ -44,6 +45,88 @@ export interface AIConfig {
|
|
|
44
45
|
*/
|
|
45
46
|
serviceUrl?: string;
|
|
46
47
|
/**
|
|
48
|
+
* A list of context references that are automatically attached to AI features.
|
|
49
|
+
* Each entry references an administrator-managed context, which is a reusable
|
|
50
|
+
* collection of prompts and files defined through the AI service and identified by its `id`.
|
|
51
|
+
*
|
|
52
|
+
* **Note:** The headless gateway APIs
|
|
53
|
+
* ({@link module:ai/aireviewmode/aireviewgateway~AIReviewGateway},
|
|
54
|
+
* {@link module:ai/aitranslate/aitranslategateway~AITranslateGateway}, and
|
|
55
|
+
* {@link module:ai/aidocumentprocessing/aidocumentprocessinggateway~AIDocumentProcessingGateway}) are
|
|
56
|
+
* config-independent by design and do **not** apply this option. Pass their context references explicitly through
|
|
57
|
+
* the `contexts` run option instead.
|
|
58
|
+
*
|
|
59
|
+
* Each entry is a context reference optionally narrowed down to specific features via `features`. When
|
|
60
|
+
* `features` is omitted, the entry is attached to **every** AI feature:
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* ClassicEditor
|
|
64
|
+
* .create( {
|
|
65
|
+
* // ... Other configuration options ...
|
|
66
|
+
* ai: {
|
|
67
|
+
* defaultContext: [
|
|
68
|
+
* // Attached to every AI feature.
|
|
69
|
+
* { id: 'style-guide' },
|
|
70
|
+
*
|
|
71
|
+
* // Attached only to the `translate.*` quick actions and to every review command.
|
|
72
|
+
* {
|
|
73
|
+
* id: 'glossary',
|
|
74
|
+
* features: {
|
|
75
|
+
* quickActions: /^translate\./,
|
|
76
|
+
* review: true
|
|
77
|
+
* }
|
|
78
|
+
* }
|
|
79
|
+
* ]
|
|
80
|
+
* }
|
|
81
|
+
* } )
|
|
82
|
+
* .then( ... )
|
|
83
|
+
* .catch( ... );
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* Read more in {@link module:ai/aicore/model/aidefaultcontext~AIDefaultContext}.
|
|
87
|
+
*
|
|
88
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
89
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
90
|
+
*/
|
|
91
|
+
defaultContext?: AIDefaultContext;
|
|
92
|
+
/**
|
|
93
|
+
* Extra HTTP headers that the AI service should attach when it fetches document images that live behind
|
|
94
|
+
* authentication (for example a private CDN or a token-protected asset server) during image analysis.
|
|
95
|
+
*
|
|
96
|
+
* The value is a list of entries, each pairing a `domain` with the `headers` to attach. A header set is attached when
|
|
97
|
+
* the image URL starts with the entry's `domain`.
|
|
98
|
+
*
|
|
99
|
+
* Because the match is a plain string prefix, always scope each `domain` to a full origin ending with a slash, for
|
|
100
|
+
* example `https://assets.example.com/`, so it cannot match a look-alike host such as `https://assets.example.com.incorrect.example/`.
|
|
101
|
+
*
|
|
102
|
+
* It is applied only to the AI Chat message flow and the document processing flow, as these are the only cases where
|
|
103
|
+
* the AI service works with images embedded in the document.
|
|
104
|
+
*
|
|
105
|
+
* ```ts
|
|
106
|
+
* ClassicEditor.create( {
|
|
107
|
+
* ai: {
|
|
108
|
+
* extraHttpHeaders: [
|
|
109
|
+
* { domain: 'https://assets.example.com/', headers: { authorization: 'Bearer <token>' } }
|
|
110
|
+
* ]
|
|
111
|
+
* }
|
|
112
|
+
* } );
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* Because authorization tokens expire and rotate, the value can also be a function. It is called for every request,
|
|
116
|
+
* so it can return fresh headers each time:
|
|
117
|
+
*
|
|
118
|
+
* ```ts
|
|
119
|
+
* ClassicEditor.create( {
|
|
120
|
+
* ai: {
|
|
121
|
+
* extraHttpHeaders: () => ( [
|
|
122
|
+
* { domain: 'https://assets.example.com/', headers: { authorization: `Bearer ${ getFreshToken() }` } }
|
|
123
|
+
* ] )
|
|
124
|
+
* }
|
|
125
|
+
* } );
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
extraHttpHeaders?: AIExtraHttpHeaders | (() => AIExtraHttpHeaders);
|
|
129
|
+
/**
|
|
47
130
|
* The configuration of the {@link module:ai/aiassistant/aiassistant~AIAssistant AI Assistant feature}.
|
|
48
131
|
*
|
|
49
132
|
* Read more in {@link module:ai/aiassistant/aiassistant~AIAssistantConfig}.
|
|
@@ -243,3 +326,29 @@ export interface AIContainerCustom extends AIContainerBase {
|
|
|
243
326
|
* * {@link module:ai/aiconfig~AIContainerCustom} - the AI user interface is displayed in a custom way.
|
|
244
327
|
*/
|
|
245
328
|
export type AIContainerConfig = AIContainerSidebar | AIContainerOverlay | AIContainerCustom;
|
|
329
|
+
/**
|
|
330
|
+
* If fetching some resources (for example images) used during AI image analysis requires passing an additional
|
|
331
|
+
* authorization factor in the form of additional HTTP headers:
|
|
332
|
+
*
|
|
333
|
+
* ```
|
|
334
|
+
* extraHttpHeaders: [
|
|
335
|
+
* { domain: 'https://ckeditor.com/', headers: { authorization: 'Bearer xxx' } },
|
|
336
|
+
* { domain: 'https://example.com/', headers: { authorization: 'Bearer xxx' } }
|
|
337
|
+
* ]
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* See {@link module:ai/aiconfig~AIConfig#extraHttpHeaders}.
|
|
341
|
+
*/
|
|
342
|
+
export type AIExtraHttpHeaders = Array<{
|
|
343
|
+
/**
|
|
344
|
+
* The origin the headers apply to. Matched as a plain string prefix against the image URL, so it should be a full
|
|
345
|
+
* origin ending with a slash, for example `https://assets.example.com/`.
|
|
346
|
+
*/
|
|
347
|
+
domain: string;
|
|
348
|
+
/**
|
|
349
|
+
* The HTTP headers to attach for the matching `domain`.
|
|
350
|
+
*/
|
|
351
|
+
headers: {
|
|
352
|
+
[header: string]: string;
|
|
353
|
+
};
|
|
354
|
+
}>;
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { type Editor, type Context, ContextPlugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
6
6
|
import { CloudServices } from "@ckeditor/ckeditor5-cloud-services";
|
|
7
|
-
import { type
|
|
7
|
+
import { type AIContextRequestPart, type AIContextItemType } from "./model/aicontext.js";
|
|
8
|
+
import { type AIContextRef, type AIContextRefRequestData } from "./model/aicontextref.js";
|
|
8
9
|
import { type AICapabilitiesRequestData } from "./model/aicapabilities.js";
|
|
9
10
|
import type { AIActionsNames } from "../aiactions/aiactions.js";
|
|
11
|
+
import { type AIEditorConfig } from "./utils/geteditorconfig.js";
|
|
10
12
|
/**
|
|
11
13
|
* A plugin that handles communication with the AI API.
|
|
12
14
|
*/
|
|
@@ -43,11 +45,11 @@ export declare class AIConnector extends ContextPlugin {
|
|
|
43
45
|
/**
|
|
44
46
|
* Sends a request to the /actions/custom/calls endpoint and returns a response stream reader.
|
|
45
47
|
*/
|
|
46
|
-
executeCustomAction({ content, message, model, outputFormat }: AIConnectorExecuteCustomActionData): AIConnectorRequest;
|
|
48
|
+
executeCustomAction({ content, message, model, outputFormat, contexts }: AIConnectorExecuteCustomActionData): AIConnectorRequest;
|
|
47
49
|
/**
|
|
48
50
|
* Sends a request to the /actions/system/{actionName}/calls endpoint and returns a response stream reader.
|
|
49
51
|
*/
|
|
50
|
-
executeAction({ actionName, content, args }: AIConnectorExecuteActionData): AIConnectorRequest;
|
|
52
|
+
executeAction({ actionName, content, args, contexts }: AIConnectorExecuteActionData): AIConnectorRequest;
|
|
51
53
|
/**
|
|
52
54
|
* Uploads a file to the AI API for a specific conversation.
|
|
53
55
|
*/
|
|
@@ -102,6 +104,10 @@ export declare class AIConnector extends ContextPlugin {
|
|
|
102
104
|
*/
|
|
103
105
|
getModels(language?: string): AIModelRequest;
|
|
104
106
|
/**
|
|
107
|
+
* Returns the list of contexts available to the current token.
|
|
108
|
+
*/
|
|
109
|
+
listContexts(params?: AIListContextsParams): AIListContextsRequest;
|
|
110
|
+
/**
|
|
105
111
|
* Deletes a file from a conversation.
|
|
106
112
|
*/
|
|
107
113
|
deleteFile(conversationId: string, fileId: string): AIDeleteFileRequest;
|
|
@@ -132,15 +138,15 @@ export declare class AIConnector extends ContextPlugin {
|
|
|
132
138
|
/**
|
|
133
139
|
* Sends a request to the AI API '/reviews/system/{reviewName}/calls' endpoint and returns a response stream reader.
|
|
134
140
|
*/
|
|
135
|
-
callSystemReview({ reviewName, content, args }: AIConnectorSystemReviewData): AIConnectorRequest;
|
|
141
|
+
callSystemReview({ reviewName, content, args, contexts }: AIConnectorSystemReviewData): AIConnectorRequest;
|
|
136
142
|
/**
|
|
137
143
|
* Sends a request to the AI API '/documents/process' endpoint and returns the parsed JSON reply.
|
|
138
144
|
*/
|
|
139
|
-
processDocument({
|
|
145
|
+
processDocument({ content, prompt, model, capabilities, contexts }: AIConnectorProcessDocumentData): AIConnectorProcessDocumentRequest;
|
|
140
146
|
/**
|
|
141
147
|
* Sends a request to the AI API '/reviews/custom/calls' endpoint and returns a response stream reader.
|
|
142
148
|
*/
|
|
143
|
-
callCustomReview({ content, prompt, model }: AIConnectorCustomReviewData): AIConnectorRequest;
|
|
149
|
+
callCustomReview({ content, prompt, model, contexts }: AIConnectorCustomReviewData): AIConnectorRequest;
|
|
144
150
|
upsertAIChatRating(conversationId: string, messageId: string, rating: AIRating): AIUpdateRating;
|
|
145
151
|
upsertAIActionRating(actionName: string, callId: string, rating: AIRating): AIUpdateRating;
|
|
146
152
|
upsertCustomAIActionRating(callId: string, rating: AIRating): AIUpdateRating;
|
|
@@ -249,7 +255,7 @@ export type AICancelStreamRequest = {
|
|
|
249
255
|
export type AIConnectorQueryAssistantData = {
|
|
250
256
|
message: string;
|
|
251
257
|
conversationId: string;
|
|
252
|
-
parts: Array<
|
|
258
|
+
parts: Array<AIContextRequestPart>;
|
|
253
259
|
capabilities: AICapabilitiesRequestData | undefined;
|
|
254
260
|
model: string;
|
|
255
261
|
attributes?: Record<string, unknown>;
|
|
@@ -341,6 +347,7 @@ export type AIUserMessageContent = {
|
|
|
341
347
|
type: AIContextItemType;
|
|
342
348
|
content: string;
|
|
343
349
|
mcpServerName: string;
|
|
350
|
+
editorConfig?: AIEditorConfig;
|
|
344
351
|
toolName?: string;
|
|
345
352
|
data?: Record<string, any>;
|
|
346
353
|
name?: string;
|
|
@@ -408,6 +415,49 @@ export type AIModelRequest = {
|
|
|
408
415
|
}>;
|
|
409
416
|
abortController: AbortController;
|
|
410
417
|
};
|
|
418
|
+
/**
|
|
419
|
+
* A single context available to the current token, as returned by {@link module:ai/aicore/aiconnector~AIConnector#listContexts}.
|
|
420
|
+
*
|
|
421
|
+
* A context is an admin-managed, named collection of prompts and files. It is referenced elsewhere by its `id` through an
|
|
422
|
+
* {@link module:ai/aicore/model/aicontextref~AIContextRef}.
|
|
423
|
+
*/
|
|
424
|
+
export type AIContextData = {
|
|
425
|
+
/**
|
|
426
|
+
* The stable identifier of the context. This is the value referenced by an
|
|
427
|
+
* {@link module:ai/aicore/model/aicontextref~AIContextRef}.
|
|
428
|
+
*/
|
|
429
|
+
id: string;
|
|
430
|
+
/**
|
|
431
|
+
* The human-readable name of the context.
|
|
432
|
+
*/
|
|
433
|
+
name?: string;
|
|
434
|
+
/**
|
|
435
|
+
* The optional description of the context.
|
|
436
|
+
*/
|
|
437
|
+
description?: string;
|
|
438
|
+
/**
|
|
439
|
+
* The optional custom attributes attached to the context.
|
|
440
|
+
*/
|
|
441
|
+
attributes?: Record<string, unknown>;
|
|
442
|
+
};
|
|
443
|
+
export type AIListContextsParams = {
|
|
444
|
+
/**
|
|
445
|
+
* The cursor of the page to fetch. When not specified, the first page is fetched.
|
|
446
|
+
*/
|
|
447
|
+
cursor?: string;
|
|
448
|
+
/**
|
|
449
|
+
* The number of items to fetch.
|
|
450
|
+
*/
|
|
451
|
+
limit?: number;
|
|
452
|
+
/**
|
|
453
|
+
* Determines the direction of sorting.
|
|
454
|
+
*/
|
|
455
|
+
order?: "desc" | "asc";
|
|
456
|
+
};
|
|
457
|
+
export type AIListContextsRequest = {
|
|
458
|
+
getContexts: () => Promise<Array<AIContextData>>;
|
|
459
|
+
abortController: AbortController;
|
|
460
|
+
};
|
|
411
461
|
export type AIDeleteFileRequest = {
|
|
412
462
|
execute: () => Promise<void>;
|
|
413
463
|
abortController: AbortController;
|
|
@@ -422,9 +472,10 @@ export type AIDeleteWebResourceRequest = {
|
|
|
422
472
|
};
|
|
423
473
|
export type AIConnectorExecuteCustomActionData = {
|
|
424
474
|
content: string;
|
|
425
|
-
message
|
|
475
|
+
message?: string;
|
|
426
476
|
model: string;
|
|
427
477
|
outputFormat: "plainText" | "html";
|
|
478
|
+
contexts?: Array<AIContextRef>;
|
|
428
479
|
};
|
|
429
480
|
export type AIConnectorExecuteActionData = {
|
|
430
481
|
actionName: AIActionsNames;
|
|
@@ -432,6 +483,7 @@ export type AIConnectorExecuteActionData = {
|
|
|
432
483
|
args?: {
|
|
433
484
|
language?: string;
|
|
434
485
|
};
|
|
486
|
+
contexts?: Array<AIContextRef>;
|
|
435
487
|
};
|
|
436
488
|
export type AIConnectorSystemReviewData = {
|
|
437
489
|
reviewName: string;
|
|
@@ -439,19 +491,34 @@ export type AIConnectorSystemReviewData = {
|
|
|
439
491
|
args?: {
|
|
440
492
|
language?: string;
|
|
441
493
|
};
|
|
494
|
+
contexts?: Array<AIContextRef>;
|
|
442
495
|
};
|
|
443
496
|
export type AIConnectorCustomReviewData = {
|
|
444
497
|
content: string;
|
|
445
|
-
prompt
|
|
498
|
+
prompt?: string;
|
|
446
499
|
model: string;
|
|
500
|
+
contexts?: Array<AIContextRef>;
|
|
501
|
+
};
|
|
502
|
+
export type AIConnectorProcessDocumentContentDocument = {
|
|
503
|
+
type: "document";
|
|
504
|
+
content: string;
|
|
505
|
+
selection?: Array<{
|
|
506
|
+
start: number;
|
|
507
|
+
end: number;
|
|
508
|
+
}>;
|
|
447
509
|
};
|
|
448
510
|
export type AIConnectorProcessDocumentData = {
|
|
449
|
-
|
|
511
|
+
content: Array<AIConnectorProcessDocumentContentDocument | AIContextRefRequestData>;
|
|
450
512
|
prompt: string;
|
|
451
513
|
model: string;
|
|
514
|
+
capabilities?: AICapabilitiesRequestData;
|
|
515
|
+
contexts?: Array<AIContextRef>;
|
|
452
516
|
};
|
|
453
517
|
export type AIConnectorProcessDocumentReply = {
|
|
454
|
-
|
|
518
|
+
documents: Array<{
|
|
519
|
+
document: string;
|
|
520
|
+
summary: string;
|
|
521
|
+
}>;
|
|
455
522
|
summary?: string;
|
|
456
523
|
};
|
|
457
524
|
export type AIConnectorProcessDocumentRequest = {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ai/aicore/aicore
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { ContextPlugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
10
|
+
import { AIConnector } from "./aiconnector.js";
|
|
11
|
+
import { AIModels } from "./model/aimodels.js";
|
|
12
|
+
import { AIContextLibrary } from "./model/aicontextlibrary.js";
|
|
13
|
+
/**
|
|
14
|
+
* A shared, context-level home for cross-feature AI state.
|
|
15
|
+
*
|
|
16
|
+
* It owns a single {@link module:ai/aicore/model/aimodels~AIModels} instance so the model list is
|
|
17
|
+
* fetched once and shared across all AI features (chat, quick actions, review mode, gateway) instead
|
|
18
|
+
* of each feature building its own. Access it via {@link #models}.
|
|
19
|
+
*
|
|
20
|
+
* It owns a single {@link module:ai/aicore/model/aicontextlibrary~AIContextLibrary} instance
|
|
21
|
+
* so the list of contexts available to the current token is fetched once and shared. Access it via
|
|
22
|
+
* {@link #contextLibrary}.
|
|
23
|
+
*/
|
|
24
|
+
export declare class AICore extends ContextPlugin {
|
|
25
|
+
/**
|
|
26
|
+
* The shared model registry — fetched once and shared across all AI features.
|
|
27
|
+
*/
|
|
28
|
+
models: AIModels;
|
|
29
|
+
/**
|
|
30
|
+
* The shared context library, fetched once and shared across all AI features.
|
|
31
|
+
*/
|
|
32
|
+
contextLibrary: AIContextLibrary;
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
static get pluginName(): "AICore";
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
static override get isOfficialPlugin(): true;
|
|
41
|
+
/**
|
|
42
|
+
* @inheritDoc
|
|
43
|
+
*/
|
|
44
|
+
static override get isPremiumPlugin(): true;
|
|
45
|
+
/**
|
|
46
|
+
* @inheritDoc
|
|
47
|
+
*/
|
|
48
|
+
static get requires(): PluginDependenciesOf<[AIConnector]>;
|
|
49
|
+
/**
|
|
50
|
+
* @inheritDoc
|
|
51
|
+
*/
|
|
52
|
+
init(): void;
|
|
53
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type ModelRange, type ModelDocumentFragment } from "@ckeditor/ckeditor5-engine";
|
|
9
9
|
import { ContextPlugin, type Context, Editor } from "@ckeditor/ckeditor5-core";
|
|
10
|
+
import { type AIEditorConfig } from "./utils/geteditorconfig.js";
|
|
10
11
|
export declare const AI_VISUAL_SELECTION_MARKER_NAME = "ai-selection";
|
|
11
12
|
export declare class AIEditing extends ContextPlugin {
|
|
12
13
|
/**
|
|
@@ -40,8 +41,11 @@ export declare class AIEditing extends ContextPlugin {
|
|
|
40
41
|
*
|
|
41
42
|
* `rootName` and `channelId` identify the source of each entry so callers can remap AI modifications back to the editor and root
|
|
42
43
|
* they came from.
|
|
44
|
+
*
|
|
45
|
+
* Note, that this method is async and does significant processing if the editor data is big or custom output processor is registered.
|
|
46
|
+
* If you just want to fetch the session id or document version, use {@link #getSessionId} and {@link #getEditorsVersions}.
|
|
43
47
|
*/
|
|
44
|
-
getDocumentData(): Promise<Array<AIEditingDocumentData>>;
|
|
48
|
+
getDocumentData(channelIds?: Set<string>): Promise<Array<AIEditingDocumentData>>;
|
|
45
49
|
afterInit(): void;
|
|
46
50
|
/**
|
|
47
51
|
* Displays a fake visual selection on given ranges.
|
|
@@ -57,7 +61,7 @@ export declare class AIEditing extends ContextPlugin {
|
|
|
57
61
|
* @param id ID of the fake visual selection to remove.
|
|
58
62
|
*/
|
|
59
63
|
hideFakeVisualSelection(id: string): void;
|
|
60
|
-
modelToDataWithIds(modelFragment: ModelDocumentFragment, editor: Editor): Promise<string>;
|
|
64
|
+
modelToDataWithIds(modelFragment: ModelDocumentFragment, editor: Editor, rootName?: string): Promise<string>;
|
|
61
65
|
}
|
|
62
66
|
/**
|
|
63
67
|
* A single document entry returned by {@link module:ai/aicore/aiediting~AIEditing#getDocumentData `AIEditing#getDocumentData()`}. One
|
|
@@ -77,6 +81,8 @@ export type AIEditingDocumentData = {
|
|
|
77
81
|
end: number;
|
|
78
82
|
htmlFragment: string;
|
|
79
83
|
}>;
|
|
84
|
+
selectionSignature: string;
|
|
85
|
+
editorConfig: AIEditorConfig;
|
|
80
86
|
name?: string;
|
|
81
87
|
description?: string;
|
|
82
88
|
};
|
|
@@ -8,10 +8,13 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { ContextPlugin, type PluginDependenciesOf, type Editor } from "@ckeditor/ckeditor5-core";
|
|
10
10
|
import { DocumentCompare } from "@ckeditor/ckeditor5-collaboration-core";
|
|
11
|
+
import { AICore } from "./aicore.js";
|
|
12
|
+
import { type AIModels } from "./model/aimodels.js";
|
|
11
13
|
import { AIResponseApplier } from "./pipeline/airesponseapplier.js";
|
|
12
|
-
import { type
|
|
13
|
-
import { type AIModelData } from "./aiconnector.js";
|
|
14
|
+
import { type AIEditorRoot } from "./model/aieditorroot.js";
|
|
14
15
|
import { type AIOperationSource } from "./utils/markoperationsasai.js";
|
|
16
|
+
import type { AIRunResult } from "./model/airunresult.js";
|
|
17
|
+
import { type AIContextRef } from "./model/aicontextref.js";
|
|
15
18
|
/**
|
|
16
19
|
* How AI run changes are applied to the editor when using {@link module:ai/aicore/aigateway~AIGateway#apply}.
|
|
17
20
|
*/
|
|
@@ -35,6 +38,13 @@ export type AIRunBaseOptions = {
|
|
|
35
38
|
* An `AbortSignal` that cancels the run when aborted. Aborted runs resolve with `status: 'aborted'`.
|
|
36
39
|
*/
|
|
37
40
|
signal?: AbortSignal;
|
|
41
|
+
/**
|
|
42
|
+
* Context references attached to the request.
|
|
43
|
+
*
|
|
44
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
45
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
46
|
+
*/
|
|
47
|
+
contexts?: Array<AIContextRef>;
|
|
38
48
|
};
|
|
39
49
|
export type AIGatewayApplyOptions = {
|
|
40
50
|
/**
|
|
@@ -54,6 +64,11 @@ export type AIGatewayApplyOptions = {
|
|
|
54
64
|
* plugin uses this attribute to display the suggestion as AI-generated.
|
|
55
65
|
*/
|
|
56
66
|
aiSource?: AIOperationSource;
|
|
67
|
+
/**
|
|
68
|
+
* Restrict the apply to a subset of the result's per-root entries. Each entry's `channelId` and `rootName` must match
|
|
69
|
+
* a per-root sub-result in the passed `AIRunResult`. When omitted, every entry in `result.results` is applied.
|
|
70
|
+
*/
|
|
71
|
+
roots?: Array<AIEditorRoot>;
|
|
57
72
|
};
|
|
58
73
|
/**
|
|
59
74
|
* Base plugin exposing common methods for end-to-end public AI API.
|
|
@@ -66,7 +81,16 @@ export declare class AIGateway extends ContextPlugin {
|
|
|
66
81
|
/**
|
|
67
82
|
* @inheritDoc
|
|
68
83
|
*/
|
|
69
|
-
static get requires(): PluginDependenciesOf<[DocumentCompare]>;
|
|
84
|
+
static get requires(): PluginDependenciesOf<[DocumentCompare, AICore]>;
|
|
85
|
+
/**
|
|
86
|
+
* The shared model registry. Exposed here so headless gateways are self-sufficient — integrators can
|
|
87
|
+
* discover and resolve models (`getAvailableModels()`, `getModel()`, `resolveModel()`, …) without
|
|
88
|
+
* reaching for the `AICore` plugin directly.
|
|
89
|
+
*
|
|
90
|
+
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
91
|
+
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
92
|
+
*/
|
|
93
|
+
get models(): AIModels;
|
|
70
94
|
/**
|
|
71
95
|
* @inheritDoc
|
|
72
96
|
*/
|
|
@@ -76,16 +100,24 @@ export declare class AIGateway extends ContextPlugin {
|
|
|
76
100
|
*/
|
|
77
101
|
static override get isPremiumPlugin(): true;
|
|
78
102
|
/**
|
|
79
|
-
*
|
|
103
|
+
* Applies an AI run result to editor content. Accepts the whole `AIRunResult` — per-root sub-results targeting
|
|
104
|
+
* the same editor are batched into one `model.change()` block, so all of that editor's roots become a single
|
|
105
|
+
* undoable step. An optional `options.roots` filter restricts the apply to a subset of the sub-results without the
|
|
106
|
+
* caller having to unpack or repack the result.
|
|
80
107
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
*
|
|
108
|
+
* Refuses the call up front only on whole-run failures (`result.error` set or empty `result.results`). Per-root
|
|
109
|
+
* failures on an otherwise successful run are validated after the filter, so the caller can filter around the
|
|
110
|
+
* failed roots via `options.roots` and still apply the completed ones. If any *included* sub-result fails
|
|
111
|
+
* validation the whole call throws before touching any editor, so partial applies can't leave content in a
|
|
112
|
+
* mixed state.
|
|
113
|
+
*
|
|
114
|
+
* `options.roots` is validated at the call boundary — an explicitly empty array throws
|
|
115
|
+
* `ai-gateway-apply-empty-roots`, and any entry that does not match a per-root sub-result in
|
|
116
|
+
* `result.results` throws `ai-gateway-apply-root-not-found`.
|
|
87
117
|
*
|
|
88
|
-
*
|
|
118
|
+
* Also throws `ai-gateway-apply-invalid-status` when the whole run failed or when any included sub-result's
|
|
119
|
+
* `status` is not `'completed'`, and `ai-no-track-changes` when `options.applyMethod` is `'suggest'` and any
|
|
120
|
+
* targeted editor is missing the `TrackChanges` plugin.
|
|
89
121
|
*
|
|
90
122
|
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
91
123
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
@@ -10,6 +10,10 @@ import { CKEditorError } from "@ckeditor/ckeditor5-utils";
|
|
|
10
10
|
* Wraps an arbitrary thrown value in a {@link module:utils/ckeditorerror~CKEditorError} with the given `errorName`,
|
|
11
11
|
* unless it already is a `CKEditorError`.
|
|
12
12
|
*
|
|
13
|
+
* If the thrown value carries a `data` field (as backend API errors do — see {@link module:ai/aicore/aiconnector~AIConnector}),
|
|
14
|
+
* it is attached to the wrapped error as `data.backendData` so consumers can inspect the backend's structured response
|
|
15
|
+
* (for example `issues[]` describing which fields failed validation).
|
|
16
|
+
*
|
|
13
17
|
* @param error The thrown value to normalize.
|
|
14
18
|
* @param errorName The `error-name` used when wrapping a non-`CKEditorError`.
|
|
15
19
|
* @param context The error context (typically the plugin instance) used by the watchdog.
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module ai/aicore/model/aicapabilities
|
|
7
|
+
* @publicApi
|
|
7
8
|
*/
|
|
8
9
|
import { type EmitterMixinConstructor } from "@ckeditor/ckeditor5-utils";
|
|
9
10
|
declare const AICapabilitiesBase: EmitterMixinConstructor;
|
|
10
|
-
export declare const
|
|
11
|
+
export declare const AI_CAPABILITIES_MODEL_EVENT_NAMES: readonly ["capabilitiesUpdated"];
|
|
11
12
|
/**
|
|
12
13
|
* Manages the AI capabilities configuration and state.
|
|
13
14
|
*/
|
|
@@ -28,10 +29,13 @@ export declare class AICapabilities extends AICapabilitiesBase {
|
|
|
28
29
|
*/
|
|
29
30
|
getCapabilitiesConfig(): AICapabilitiesConfig;
|
|
30
31
|
/**
|
|
31
|
-
* Converts capabilities configuration to
|
|
32
|
-
*
|
|
32
|
+
* Converts a capabilities configuration to the wire-shape consumed by the AI API endpoints.
|
|
33
|
+
*
|
|
34
|
+
* Accepts either the simple chat-style config (`isWebSearchEnabled` / `isReasoningEnabled`) or the advanced
|
|
35
|
+
* per-call directive (`webSearch` / `reasoning`, where `reasoning` may also be a level string such as `'low'`
|
|
36
|
+
* or `'minimal'`).
|
|
33
37
|
*/
|
|
34
|
-
static getCapabilitiesRequestData(config: AICapabilitiesConfig | undefined): AICapabilitiesRequestData;
|
|
38
|
+
static getCapabilitiesRequestData(config: AICapabilitiesConfig | AICapabilitiesConfigAdvanced | undefined): AICapabilitiesRequestData;
|
|
35
39
|
/**
|
|
36
40
|
* Toggles the web search enabled state.
|
|
37
41
|
*/
|
|
@@ -57,8 +61,19 @@ export type AICapabilitiesConfig = {
|
|
|
57
61
|
isWebSearchEnabled: boolean;
|
|
58
62
|
isReasoningEnabled: boolean;
|
|
59
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Reasoning level accepted by the AI service. Controls how much effort the model is allowed to spend
|
|
66
|
+
* on reasoning before producing the final reply.
|
|
67
|
+
*/
|
|
68
|
+
export type AIReasoningLevel = "minimal" | "low" | "balanced" | "thorough" | "maximum";
|
|
69
|
+
export type AICapabilitiesConfigAdvanced = {
|
|
70
|
+
webSearch?: boolean;
|
|
71
|
+
reasoning?: boolean | AIReasoningLevel;
|
|
72
|
+
};
|
|
60
73
|
export type AICapabilitiesRequestData = {
|
|
61
74
|
webSearch?: object;
|
|
62
|
-
reasoning?:
|
|
75
|
+
reasoning?: {
|
|
76
|
+
level?: AIReasoningLevel;
|
|
77
|
+
};
|
|
63
78
|
};
|
|
64
79
|
export {};
|