@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.
Files changed (246) hide show
  1. package/dist/aiactions/aiactions.d.ts +36 -1
  2. package/dist/aiactions/model/aiactionsinteraction.d.ts +7 -1
  3. package/dist/aiassistant/aiassistantui.d.ts +0 -3
  4. package/dist/aiballoon/aiballoon.d.ts +0 -1
  5. package/dist/aichat/aichatballoon.d.ts +7 -2
  6. package/dist/aichat/aichatcontroller.d.ts +12 -2
  7. package/dist/aichat/aichatui.d.ts +20 -6
  8. package/dist/aichat/model/aichatcontext.d.ts +29 -10
  9. package/dist/aichat/model/aichatconversation.d.ts +10 -1
  10. package/dist/aichat/model/aichatinteraction.d.ts +6 -1
  11. package/dist/aichat/ui/aichatballoonview.d.ts +14 -19
  12. package/dist/aichat/ui/aichatcontrolsview.d.ts +0 -9
  13. package/dist/aichat/ui/aichatfeedview.d.ts +5 -11
  14. package/dist/aichat/ui/aichatview.d.ts +0 -4
  15. package/dist/aichat/ui/controls/aichatdropzoneview.d.ts +4 -0
  16. package/dist/aichat/ui/controls/aichatpromptcapabilitiesview.d.ts +14 -29
  17. package/dist/aichat/ui/feed/aichatfeedsuggestionitemview.d.ts +7 -2
  18. package/dist/aichathistory/aichathistoryui.d.ts +0 -1
  19. package/dist/aichatshortcuts/aichatshortcuts.d.ts +2 -2
  20. package/dist/aiconfig.d.ts +109 -0
  21. package/dist/aicore/aiconnector.d.ts +78 -11
  22. package/dist/aicore/aicore.d.ts +53 -0
  23. package/dist/aicore/aiediting.d.ts +8 -2
  24. package/dist/aicore/aigateway.d.ts +43 -11
  25. package/dist/aicore/errors/normalizeerror.d.ts +4 -0
  26. package/dist/aicore/model/aicapabilities.d.ts +20 -5
  27. package/dist/aicore/model/aicontext.d.ts +57 -2
  28. package/dist/aicore/model/aicontextlibrary.d.ts +70 -0
  29. package/dist/aicore/model/aicontextref.d.ts +39 -0
  30. package/dist/aicore/model/aidefaultcontext.d.ts +95 -0
  31. package/dist/aicore/model/aieditorroot.d.ts +26 -0
  32. package/dist/aicore/model/aimodels.d.ts +11 -4
  33. package/dist/aicore/model/aireply.d.ts +12 -1
  34. package/dist/aicore/model/airunresult.d.ts +18 -73
  35. package/dist/aicore/model/airunsinglerootresult.d.ts +101 -0
  36. package/dist/aicore/ui/aidisclaimerview.d.ts +0 -1
  37. package/dist/aicore/ui/aiheaderview.d.ts +0 -1
  38. package/dist/aicore/ui/aimodelselectorview.d.ts +151 -0
  39. package/dist/aicore/ui/aiskeleton.d.ts +0 -1
  40. package/dist/aicore/ui/aispinner.d.ts +0 -1
  41. package/dist/aicore/ui/suggestioncontainer/aiminitoolbarview.d.ts +0 -1
  42. package/dist/aicore/ui/suggestioncontainer/aisuggestionbodyview.d.ts +20 -5
  43. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontainerview.d.ts +0 -1
  44. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartheaderview.d.ts +12 -1
  45. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartstateview.d.ts +4 -12
  46. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentparttoolbarview.d.ts +6 -1
  47. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartview.d.ts +11 -1
  48. package/dist/aicore/ui/suggestioncontainer/aisuggestionstreamablecontentview.d.ts +0 -1
  49. package/dist/aicore/utils/createandattachaibodycollection.d.ts +0 -1
  50. package/dist/aicore/utils/createresizebutton.d.ts +0 -1
  51. package/dist/aicore/utils/createstartconversationbutton.d.ts +0 -1
  52. package/dist/aicore/utils/geteditorconfig.d.ts +88 -0
  53. package/dist/aicore/utils/getmodeldisplaymode.d.ts +21 -0
  54. package/dist/aicore/utils/getsuggestionpartsfromreply.d.ts +4 -1
  55. package/dist/aicore/utils/htmlparser.d.ts +1 -0
  56. package/dist/aicore/utils/inlineroot.d.ts +1 -0
  57. package/dist/aicore/utils/tocontextrefrequestdata.d.ts +1 -0
  58. package/dist/aidocumentprocessing/aidocumentprocessinggateway.d.ts +48 -25
  59. package/dist/aidocumentprocessing/model/aidocumentprocessingrunresult.d.ts +2 -2
  60. package/dist/aieditorintegration/aitogglebutton/aitogglebuttonui.d.ts +0 -1
  61. package/dist/aiquickactions/aiquickactions.d.ts +60 -9
  62. package/dist/aiquickactions/aiquickactionsui.d.ts +10 -4
  63. package/dist/aiquickactions/ui/balloon/aiactionsballoonview.d.ts +6 -1
  64. package/dist/aireviewcore/aireviewcorecheckregistry.d.ts +2 -4
  65. package/dist/aireviewcore/aireviewcoreediting.d.ts +43 -6
  66. package/dist/aireviewcore/aireviewcoreui.d.ts +3 -10
  67. package/dist/aireviewcore/model/aichecksinglerootresult.d.ts +22 -0
  68. package/dist/aireviewcore/model/aireviewcheckresultchange.d.ts +12 -1
  69. package/dist/aireviewcore/model/aireviewcheckrun.d.ts +11 -1
  70. package/dist/aireviewcore/types.d.ts +7 -1
  71. package/dist/aireviewcore/ui/aireviewcoreballoonsuggestionview.d.ts +0 -2
  72. package/dist/aireviewcore/ui/aireviewcorechecklistitemresultview.d.ts +7 -0
  73. package/dist/aireviewcore/ui/aireviewcorecustomcheckview.d.ts +1 -19
  74. package/dist/aireviewcore/ui/aireviewcorefinishreviewbuttonview.d.ts +0 -1
  75. package/dist/aireviewcore/ui/aireviewcorereviewchecklistview.d.ts +0 -1
  76. package/dist/aireviewcore/ui/aireviewcorereviewcompletedview.d.ts +0 -1
  77. package/dist/aireviewcore/ui/aireviewcoreuicheckresultsview.d.ts +10 -8
  78. package/dist/aireviewcore/ui/aireviewcoreview.d.ts +3 -4
  79. package/dist/aireviewmode/aireviewgateway.d.ts +63 -44
  80. package/dist/aireviewmode/aireviewmode.d.ts +73 -5
  81. package/dist/aireviewmode/aireviewmodecheckregistry.d.ts +8 -1
  82. package/dist/aireviewmode/aireviewmodecontroller.d.ts +2 -1
  83. package/dist/aireviewmode/model/aireviewcheckextra.d.ts +7 -2
  84. package/dist/aireviewmode/model/aireviewcustomcheckrun.d.ts +2 -1
  85. package/dist/aitabs/aitabsmainview.d.ts +0 -1
  86. package/dist/aitabs/tabs/aitabsview.d.ts +0 -1
  87. package/dist/aitabs/tabs/tabbuttonview.d.ts +0 -1
  88. package/dist/aitranslate/aitranslatecontroller.d.ts +2 -1
  89. package/dist/aitranslate/aitranslategateway.d.ts +33 -21
  90. package/dist/aitranslate/aitranslateui.d.ts +0 -1
  91. package/dist/aitranslate/model/aitranslatecheckrun.d.ts +2 -1
  92. package/dist/augmentation.d.ts +2 -0
  93. package/dist/index-content.css +0 -97
  94. package/dist/index-editor.css +2640 -2631
  95. package/dist/index.css +36 -32
  96. package/dist/index.d.ts +17 -8
  97. package/dist/index.js +19 -19
  98. package/dist/translations/af.js +1 -1
  99. package/dist/translations/af.umd.js +1 -1
  100. package/dist/translations/ar.js +1 -1
  101. package/dist/translations/ar.umd.js +1 -1
  102. package/dist/translations/ast.js +1 -1
  103. package/dist/translations/ast.umd.js +1 -1
  104. package/dist/translations/az.js +1 -1
  105. package/dist/translations/az.umd.js +1 -1
  106. package/dist/translations/be.js +1 -1
  107. package/dist/translations/be.umd.js +1 -1
  108. package/dist/translations/bg.js +1 -1
  109. package/dist/translations/bg.umd.js +1 -1
  110. package/dist/translations/bn.js +1 -1
  111. package/dist/translations/bn.umd.js +1 -1
  112. package/dist/translations/bs.js +1 -1
  113. package/dist/translations/bs.umd.js +1 -1
  114. package/dist/translations/ca.js +1 -1
  115. package/dist/translations/ca.umd.js +1 -1
  116. package/dist/translations/cs.js +1 -1
  117. package/dist/translations/cs.umd.js +1 -1
  118. package/dist/translations/da.js +1 -1
  119. package/dist/translations/da.umd.js +1 -1
  120. package/dist/translations/de-ch.js +1 -1
  121. package/dist/translations/de-ch.umd.js +1 -1
  122. package/dist/translations/de.js +1 -1
  123. package/dist/translations/de.umd.js +1 -1
  124. package/dist/translations/el.js +1 -1
  125. package/dist/translations/el.umd.js +1 -1
  126. package/dist/translations/en-au.js +1 -1
  127. package/dist/translations/en-au.umd.js +1 -1
  128. package/dist/translations/en-gb.js +1 -1
  129. package/dist/translations/en-gb.umd.js +1 -1
  130. package/dist/translations/en.js +1 -1
  131. package/dist/translations/en.umd.js +1 -1
  132. package/dist/translations/eo.js +1 -1
  133. package/dist/translations/eo.umd.js +1 -1
  134. package/dist/translations/es-co.js +1 -1
  135. package/dist/translations/es-co.umd.js +1 -1
  136. package/dist/translations/es.js +1 -1
  137. package/dist/translations/es.umd.js +1 -1
  138. package/dist/translations/et.js +1 -1
  139. package/dist/translations/et.umd.js +1 -1
  140. package/dist/translations/eu.js +1 -1
  141. package/dist/translations/eu.umd.js +1 -1
  142. package/dist/translations/fa.js +1 -1
  143. package/dist/translations/fa.umd.js +1 -1
  144. package/dist/translations/fi.js +1 -1
  145. package/dist/translations/fi.umd.js +1 -1
  146. package/dist/translations/fr.js +1 -1
  147. package/dist/translations/fr.umd.js +1 -1
  148. package/dist/translations/gl.js +1 -1
  149. package/dist/translations/gl.umd.js +1 -1
  150. package/dist/translations/gu.js +1 -1
  151. package/dist/translations/gu.umd.js +1 -1
  152. package/dist/translations/he.js +1 -1
  153. package/dist/translations/he.umd.js +1 -1
  154. package/dist/translations/hi.js +1 -1
  155. package/dist/translations/hi.umd.js +1 -1
  156. package/dist/translations/hr.js +1 -1
  157. package/dist/translations/hr.umd.js +1 -1
  158. package/dist/translations/hu.js +1 -1
  159. package/dist/translations/hu.umd.js +1 -1
  160. package/dist/translations/hy.js +1 -1
  161. package/dist/translations/hy.umd.js +1 -1
  162. package/dist/translations/id.js +1 -1
  163. package/dist/translations/id.umd.js +1 -1
  164. package/dist/translations/it.js +1 -1
  165. package/dist/translations/it.umd.js +1 -1
  166. package/dist/translations/ja.js +1 -1
  167. package/dist/translations/ja.umd.js +1 -1
  168. package/dist/translations/jv.js +1 -1
  169. package/dist/translations/jv.umd.js +1 -1
  170. package/dist/translations/kk.js +1 -1
  171. package/dist/translations/kk.umd.js +1 -1
  172. package/dist/translations/km.js +1 -1
  173. package/dist/translations/km.umd.js +1 -1
  174. package/dist/translations/kn.js +1 -1
  175. package/dist/translations/kn.umd.js +1 -1
  176. package/dist/translations/ko.js +1 -1
  177. package/dist/translations/ko.umd.js +1 -1
  178. package/dist/translations/ku.js +1 -1
  179. package/dist/translations/ku.umd.js +1 -1
  180. package/dist/translations/lt.js +1 -1
  181. package/dist/translations/lt.umd.js +1 -1
  182. package/dist/translations/lv.js +1 -1
  183. package/dist/translations/lv.umd.js +1 -1
  184. package/dist/translations/ms.js +1 -1
  185. package/dist/translations/ms.umd.js +1 -1
  186. package/dist/translations/nb.js +1 -1
  187. package/dist/translations/nb.umd.js +1 -1
  188. package/dist/translations/ne.js +1 -1
  189. package/dist/translations/ne.umd.js +1 -1
  190. package/dist/translations/nl.js +1 -1
  191. package/dist/translations/nl.umd.js +1 -1
  192. package/dist/translations/no.js +1 -1
  193. package/dist/translations/no.umd.js +1 -1
  194. package/dist/translations/oc.js +1 -1
  195. package/dist/translations/oc.umd.js +1 -1
  196. package/dist/translations/pl.js +1 -1
  197. package/dist/translations/pl.umd.js +1 -1
  198. package/dist/translations/pt-br.js +1 -1
  199. package/dist/translations/pt-br.umd.js +1 -1
  200. package/dist/translations/pt.js +1 -1
  201. package/dist/translations/pt.umd.js +1 -1
  202. package/dist/translations/ro.js +1 -1
  203. package/dist/translations/ro.umd.js +1 -1
  204. package/dist/translations/ru.js +1 -1
  205. package/dist/translations/ru.umd.js +1 -1
  206. package/dist/translations/si.js +1 -1
  207. package/dist/translations/si.umd.js +1 -1
  208. package/dist/translations/sk.js +1 -1
  209. package/dist/translations/sk.umd.js +1 -1
  210. package/dist/translations/sl.js +1 -1
  211. package/dist/translations/sl.umd.js +1 -1
  212. package/dist/translations/sq.js +1 -1
  213. package/dist/translations/sq.umd.js +1 -1
  214. package/dist/translations/sr-latn.js +1 -1
  215. package/dist/translations/sr-latn.umd.js +1 -1
  216. package/dist/translations/sr.js +1 -1
  217. package/dist/translations/sr.umd.js +1 -1
  218. package/dist/translations/sv.js +1 -1
  219. package/dist/translations/sv.umd.js +1 -1
  220. package/dist/translations/th.js +1 -1
  221. package/dist/translations/th.umd.js +1 -1
  222. package/dist/translations/ti.js +1 -1
  223. package/dist/translations/ti.umd.js +1 -1
  224. package/dist/translations/tk.js +1 -1
  225. package/dist/translations/tk.umd.js +1 -1
  226. package/dist/translations/tr.js +1 -1
  227. package/dist/translations/tr.umd.js +1 -1
  228. package/dist/translations/tt.js +1 -1
  229. package/dist/translations/tt.umd.js +1 -1
  230. package/dist/translations/ug.js +1 -1
  231. package/dist/translations/ug.umd.js +1 -1
  232. package/dist/translations/uk.js +1 -1
  233. package/dist/translations/uk.umd.js +1 -1
  234. package/dist/translations/ur.js +1 -1
  235. package/dist/translations/ur.umd.js +1 -1
  236. package/dist/translations/uz.js +1 -1
  237. package/dist/translations/uz.umd.js +1 -1
  238. package/dist/translations/vi.js +1 -1
  239. package/dist/translations/vi.umd.js +1 -1
  240. package/dist/translations/zh-cn.js +1 -1
  241. package/dist/translations/zh-cn.umd.js +1 -1
  242. package/dist/translations/zh.js +1 -1
  243. package/dist/translations/zh.umd.js +1 -1
  244. package/package.json +30 -12
  245. package/dist/aireviewmode/model/aireviewrunresult.d.ts +0 -20
  246. package/dist/aitranslate/model/aitranslaterunresult.d.ts +0 -20
@@ -6,6 +6,9 @@
6
6
  * @module ai/aicore/model/aicontext
7
7
  * @publicApi
8
8
  */
9
+ import { type ObservableMixinConstructor } from "@ckeditor/ckeditor5-utils";
10
+ import { type AIEditorConfig } from "../utils/geteditorconfig.js";
11
+ import { type AIContextRef, type AIContextRefRequestData } from "./aicontextref.js";
9
12
  /**
10
13
  * The type of context item.
11
14
  *
@@ -20,9 +23,10 @@
20
23
  * * `'text'`: a text (plain text, Markdown, HTML, etc.),
21
24
  * * `'selection'`: a selection of text in the editor
22
25
  * (used by {@link module:ai/aiquickactions/aiquickactions~AIQuickActions AI Quick Actions} that pass the user selection
23
- * to the {@link module:ai/aichat/aichat~AIChat AI Chat}).
26
+ * to the {@link module:ai/aichat/aichat~AIChat AI Chat}),
27
+ * * `'context'`: a reference to an admin-managed context.
24
28
  */
25
- export type AIContextItemType = "mcp-tool-context" | "file" | "image" | "document" | "web-resource" | "text" | "selection";
29
+ export type AIContextItemType = "mcp-tool-context" | "file" | "image" | "document" | "web-resource" | "text" | "selection" | "context";
26
30
  /**
27
31
  * The type of text resource.
28
32
  */
@@ -67,10 +71,61 @@ export type AIContextItemRequestData = {
67
71
  start: number;
68
72
  end: number;
69
73
  }>;
74
+ editorConfig?: AIEditorConfig;
70
75
  };
76
+ /**
77
+ * A single entry in a request `content`/`parts` array: either a resolved context item or a
78
+ * {@link module:ai/aicore/model/aicontextref~AIContextRefRequestData tagged reference} to an admin-managed context.
79
+ */
80
+ export type AIContextRequestPart = AIContextItemRequestData | AIContextRefRequestData;
71
81
  export type AIToolRequestData = {
72
82
  type: "mcp-tool-context";
73
83
  mcpServerName: string;
74
84
  toolName?: string;
75
85
  data: Record<string, any>;
76
86
  };
87
+ declare const AIContextBase: ObservableMixinConstructor;
88
+ /**
89
+ * A set of context references attached to an AI request.
90
+ *
91
+ * It is the base context model shared by all AI features: features that do not manage interactive context
92
+ * (Review, Translate, Quick Actions) use it directly, as the result of
93
+ * {@link module:ai/aicore/model/aicontextlibrary~AIContextLibrary#resolveContext}, while
94
+ * {@link module:ai/aichat/model/aichatcontext~AIChatContext} extends it with the chat-specific context state.
95
+ */
96
+ export declare class AIContext extends AIContextBase {
97
+ /**
98
+ * @param refs The context references to hold.
99
+ */
100
+ constructor(refs?: Array<AIContextRef>);
101
+ /**
102
+ * The context references, in resolution order. Returns a copy - mutating it does not affect the context.
103
+ */
104
+ get refs(): Array<AIContextRef>;
105
+ /**
106
+ * Whether the context holds no references.
107
+ */
108
+ get isEmpty(): boolean;
109
+ /**
110
+ * Returns a new context with the given references appended. The original context is left unchanged. Used to fold in
111
+ * a feature's own reference (for example a review check's `context`).
112
+ */
113
+ cloneWith(...refs: Array<AIContextRef>): AIContext;
114
+ /**
115
+ * Returns the request parts to send: the context's references followed by the given message parts. This is where the
116
+ * leading references applied to every message are merged with a message's own context items.
117
+ */
118
+ toRequestParts(parts?: Array<AIContextRequestPart>): Array<AIContextRequestPart>;
119
+ /**
120
+ * Merges the identifiers of this context's references into the given `message.attributes`, so they can be read
121
+ * back from history to keep the references' pills hidden. Returns the given attributes unchanged when the context
122
+ * holds no references.
123
+ */
124
+ toMessageAttributes(attributes?: Record<string, unknown>): Record<string, unknown> | undefined;
125
+ /**
126
+ * Reads back the default context reference identifiers stored by {@link #toMessageAttributes} from a historical
127
+ * message's `attributes`.
128
+ */
129
+ static getDefaultContextIds(attributes?: Record<string, unknown>): Set<string>;
130
+ }
131
+ export {};
@@ -0,0 +1,70 @@
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/model/aicontextlibrary
7
+ * @publicApi
8
+ */
9
+ import { type AIConnector, type AIContextData } from "../aiconnector.js";
10
+ import { type AIContextRef } from "./aicontextref.js";
11
+ import { type AIContext } from "./aicontext.js";
12
+ import { type AIDefaultContext, type AIDefaultContextFeature } from "./aidefaultcontext.js";
13
+ /**
14
+ * Stores the list of contexts available to the current token, acquired from the AI connector.
15
+ *
16
+ * A single instance is shared across all AI features (see {@link module:ai/aicore/aicore~AICore#contextLibrary}),
17
+ * so the context list is fetched once and reused instead of each feature requesting it separately.
18
+ */
19
+ export declare class AIContextLibrary {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ constructor({ connector, defaultContext }: {
24
+ connector: AIConnector;
25
+ defaultContext?: AIDefaultContext;
26
+ });
27
+ /**
28
+ * Returns the list of all contexts available to the current token.
29
+ */
30
+ getAllContexts(): Promise<Array<AIContextData>>;
31
+ /**
32
+ * Returns the list of contexts that features may offer as user-selectable, which corresponds to
33
+ * {@link #getAllContexts all contexts} narrowed down by the global `ai.defaultContext` configuration.
34
+ *
35
+ * Any context referenced by `ai.defaultContext` is treated as config-managed and is **not** offered as a
36
+ * manually-selectable item. The exclusion is by context ID regardless of the reference granularity or which
37
+ * features the entry targets: an entry configured only for another feature (for example `features: { review: true }`)
38
+ * is still excluded from every picker, even where it is not attached automatically. This is deliberate - default
39
+ * contexts are owned by the configuration, not offered as picker items anywhere. Integrators who want a context
40
+ * available in a feature's picker simply leave it out of `ai.defaultContext`.
41
+ */
42
+ getAvailableContexts(): Promise<Array<AIContextData>>;
43
+ /**
44
+ * Adds the context resolved for a feature invocation to the given context and returns it.
45
+ *
46
+ * It resolves the entries of the global `ai.defaultContext` configuration that apply to the given `feature` (narrowed
47
+ * by `ids` where a feature uses a `RegExp` filter), appends any `extraContexts` the caller supplies (for example a
48
+ * quick action's or review check's own `context`, or the contexts injected into a chat conversation), and adds the
49
+ * result to `context`.
50
+ *
51
+ * The caller passes its own context model, so a feature can resolve straight into it — for example
52
+ * {@link module:ai/aichat/model/aichatcontext~AIChatContext} for chat, or a fresh
53
+ * {@link module:ai/aicore/model/aicontext~AIContext} for review, translate and quick actions.
54
+ *
55
+ * @param feature The feature the context is resolved for.
56
+ * @param ids The IDs matched against a feature's `RegExp` filter.
57
+ * @param extraContexts References to append after the resolved default context, in order.
58
+ * @param idScopedOnly When set, resolves only the entries that the given `IDs` make applicable.
59
+ * Used to add the id-specific increment to a context that already carries the
60
+ * always-applicable default context.
61
+ * @param context The context to add the resolved references to. Returned as-is for chaining.
62
+ */
63
+ resolveContext<T extends AIContext>({ feature, ids, extraContexts, idScopedOnly, context }: {
64
+ feature: AIDefaultContextFeature;
65
+ ids?: Array<string>;
66
+ extraContexts?: Array<AIContextRef>;
67
+ idScopedOnly?: boolean;
68
+ context: T;
69
+ }): T;
70
+ }
@@ -0,0 +1,39 @@
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/model/aicontextref
7
+ * @publicApi
8
+ */
9
+ /**
10
+ * A reference to a context or to a single item within a context.
11
+ *
12
+ * * `{ id }` — attaches all prompts and files from the context.
13
+ * * `{ id, fileId }` — attaches a single file from the context.
14
+ * * `{ id, promptId }` — attaches a single prompt from the context.
15
+ *
16
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
17
+ * without the standard deprecation policy. Check the changelog for migration guidance.
18
+ */
19
+ export type AIContextRef = {
20
+ id: string;
21
+ } | {
22
+ id: string;
23
+ fileId: string;
24
+ } | {
25
+ id: string;
26
+ promptId: string;
27
+ };
28
+ /**
29
+ * The request shape of a {@link module:ai/aicore/model/aicontextref~AIContextRef context reference}.
30
+ *
31
+ * The AI service expects a `type` discriminator, as a reference can share a request array with entries of other
32
+ * types. It is added when the request is built, so it is not part of the reference shape the integrator provides.
33
+ *
34
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
35
+ * without the standard deprecation policy. Check the changelog for migration guidance.
36
+ */
37
+ export type AIContextRefRequestData = AIContextRef & {
38
+ type: "context";
39
+ };
@@ -0,0 +1,95 @@
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/model/aidefaultcontext
7
+ * @publicApi
8
+ */
9
+ import { type AIContextRef } from "./aicontextref.js";
10
+ /**
11
+ * Identifiers of the AI features that a {@link module:ai/aicore/model/aidefaultcontext~AIDefaultContextEntry
12
+ * default context entry} can target.
13
+ *
14
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
15
+ * without the standard deprecation policy. Check the changelog for migration guidance.
16
+ */
17
+ export type AIDefaultContextFeature = "chat" | "quickActions" | "review" | "translate";
18
+ /**
19
+ * Narrows down which invocations of the AI features a
20
+ * {@link module:ai/aicore/model/aidefaultcontext~AIDefaultContextEntry default context entry} applies to.
21
+ *
22
+ * Each key targets one AI feature. When a key is omitted, the entry is **not** applied to that feature. A value
23
+ * of `true` applies the entry to every invocation of the feature, while a `RegExp` applies it only when one of
24
+ * the invocation IDs matches:
25
+ *
26
+ * * `chat` - the ID of the {@link module:ai/aichatshortcuts/aichatshortcuts~AIChatShortcutChatDefinition chat shortcut}
27
+ * used to start a conversation. A matching `RegExp` attaches the entry to that conversation, so it applies to the
28
+ * shortcut's message **and** to the conversation's later messages. A conversation not started by a matching shortcut
29
+ * (for example one started with a free-form message) receives the entry only when the value is `true`.
30
+ * * `quickActions` - the ID of the quick action or of its group,
31
+ * * `review` - the ID of the review command,
32
+ * * `translate` - the ID of the target language.
33
+ *
34
+ * ```ts
35
+ * // Attach to all review commands, but only to the `translate.*` quick actions.
36
+ * {
37
+ * review: true,
38
+ * quickActions: /^translate\./
39
+ * }
40
+ * ```
41
+ *
42
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
43
+ * without the standard deprecation policy. Check the changelog for migration guidance.
44
+ */
45
+ export interface AIDefaultContextFeatures {
46
+ /**
47
+ * Whether the entry is attached to the AI Chat messages. Provide a `RegExp` to attach it when a conversation is
48
+ * started with an {@link module:ai/aichatshortcuts/aichatshortcuts~AIChatShortcutChatDefinition AI Chat shortcut}
49
+ * whose ID matches: the entry is folded into that conversation, so it applies to the shortcut's message and to its
50
+ * later messages as well. A conversation not started by a matching shortcut receives the entry only when the value
51
+ * is `true`.
52
+ */
53
+ chat?: boolean | RegExp;
54
+ /**
55
+ * Whether the entry is attached to AI Quick Action requests. Provide a `RegExp` to attach it only to actions
56
+ * whose ID, or the ID of their group, matches.
57
+ */
58
+ quickActions?: boolean | RegExp;
59
+ /**
60
+ * Whether the entry is attached to AI Review requests. Provide a `RegExp` to attach it only to review commands
61
+ * whose ID matches.
62
+ */
63
+ review?: boolean | RegExp;
64
+ /**
65
+ * Whether the entry is attached to AI Translate requests. Provide a `RegExp` to attach it only to translations
66
+ * whose target language ID matches.
67
+ */
68
+ translate?: boolean | RegExp;
69
+ }
70
+ /**
71
+ * A single entry of the {@link module:ai/aiconfig~AIConfig#defaultContext global default context}.
72
+ *
73
+ * It is a {@link module:ai/aicore/model/aicontextref~AIContextRef context reference} optionally narrowed down to
74
+ * specific features via `features`. When `features` is omitted, the entry is attached to **every** AI feature.
75
+ *
76
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
77
+ * without the standard deprecation policy. Check the changelog for migration guidance.
78
+ */
79
+ export type AIDefaultContextEntry = AIContextRef & {
80
+ /**
81
+ * The features the entry is attached to. When omitted, the entry is attached to every AI feature.
82
+ */
83
+ features?: AIDefaultContextFeatures;
84
+ };
85
+ /**
86
+ * The shape accepted by {@link module:ai/aiconfig~AIConfig#defaultContext}.
87
+ *
88
+ * A list of {@link module:ai/aicore/model/aidefaultcontext~AIDefaultContextEntry context references} attached
89
+ * automatically to AI feature invocations triggered through the editor UI. Each entry can target all features or a
90
+ * subset of them. The headless gateway APIs are config-independent and do not apply it.
91
+ *
92
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
93
+ * without the standard deprecation policy. Check the changelog for migration guidance.
94
+ */
95
+ export type AIDefaultContext = Array<AIDefaultContextEntry>;
@@ -0,0 +1,26 @@
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/model/aieditorroot
7
+ * @publicApi
8
+ */
9
+ /**
10
+ * Uniquely identifies a single root within an editor instance.
11
+ *
12
+ * `channelId` selects the editor (matches the `collaboration.channelId` config of the editor instance).
13
+ * `rootName` selects the root within that editor.
14
+ *
15
+ * Use this type whenever an API needs to target a specific root in a multi-root or multi-editor setup.
16
+ */
17
+ export type AIEditorRoot = {
18
+ /**
19
+ * The channel ID of the editor that owns the root. Matches the `collaboration.channelId` config of that editor.
20
+ */
21
+ channelId: string;
22
+ /**
23
+ * The name of the root within the editor.
24
+ */
25
+ rootName: string;
26
+ };
@@ -49,9 +49,9 @@ export declare class AIModels extends AIModelsBase {
49
49
  /**
50
50
  * Returns a list of available models.
51
51
  */
52
- getAll(): Promise<Array<AIModelData>>;
52
+ getAllModels(): Promise<Array<AIModelData>>;
53
53
  /**
54
- * Returns a list of available models, which corresponds to {@link #getAll all models} narrowed down
54
+ * Returns a list of available models, which corresponds to {@link #getAllModels all models} narrowed down
55
55
  * by the `ai.models.displayedModels` configuration.
56
56
  *
57
57
  * By default, only models marked with `recommended: true` are returned. However, models explicitly
@@ -61,11 +61,12 @@ export declare class AIModels extends AIModelsBase {
61
61
  */
62
62
  getAvailableModels(): Promise<Array<AIModelData>>;
63
63
  /**
64
- * Returns a specific AI model from among {@link #getAll all models} by its id.
64
+ * Returns the model with the given id, falling back to the {@link #getDefault default model} when the id
65
+ * is missing or not recognized. Returns `null` only when there are no models at all.
65
66
  *
66
67
  * **Note:** `'auto'` id always matches the `'agent*'` model.
67
68
  */
68
- getModel(modelId?: string): Promise<AIModelData | null>;
69
+ resolveModel(modelId?: string): Promise<AIModelData | null>;
69
70
  /**
70
71
  * Returns default AI model among the {@link #getAvailableModels available models} accounting for the
71
72
  * `ai.models.defaultModelId` configuration.
@@ -77,5 +78,11 @@ export declare class AIModels extends AIModelsBase {
77
78
  * Checks whether the given model is available among the {@link #getAvailableModels available models}.
78
79
  */
79
80
  isAvailable(model: AIModelData): Promise<boolean>;
81
+ /**
82
+ * Returns the model with the given id, or `null` if no such model exists.
83
+ *
84
+ * Unlike {@link #resolveModel}, this does **not** fall back to the default model.
85
+ */
86
+ getModel(modelId: string): Promise<AIModelData | null>;
80
87
  }
81
88
  export {};
@@ -76,11 +76,12 @@ export declare class AIReply extends _AIReplyBase {
76
76
  /**
77
77
  * @inheritDoc
78
78
  */
79
- constructor({ type, isDone, isComplete, interactionId, areActionsDisabled, isFromHistory, documentContextContent, locale, id, channelsToEditors }: {
79
+ constructor({ type, isDone, isComplete, interactionId, areActionsDisabled, outdatedReasonByDocumentId, isFromHistory, documentContextContent, locale, id, channelsToEditors }: {
80
80
  type: AIReplyType;
81
81
  interactionId: string;
82
82
  channelsToEditors: Map<string, Editor>;
83
83
  areActionsDisabled?: boolean;
84
+ outdatedReasonByDocumentId?: ReadonlyMap<string, AIReplyChangeGroupOutdatedReason>;
84
85
  isFromHistory?: boolean;
85
86
  isDone?: boolean;
86
87
  isComplete?: boolean;
@@ -126,6 +127,16 @@ export type AIReplyChangeGroup = {
126
127
  readonly rootName: string;
127
128
  index: number;
128
129
  state: AIReplyChangeGroupState;
130
+ outdatedReason?: AIReplyChangeGroupOutdatedReason;
129
131
  };
130
132
  export type AIReplyChangeGroupState = "pending" | "accepted" | "rejected" | "outdated";
133
+ /**
134
+ * The reason why a change group became {@link ~AIReplyChangeGroupState `'outdated'`}. It selects which
135
+ * tooltip is shown on the "Outdated" pill.
136
+ *
137
+ * - `'content-removed'` - the targeted content was removed, or its root is no longer loaded.
138
+ * - `'editor-removed'` - the target editor is gone or destroyed.
139
+ * - `'session-changed'` - the suggestion was loaded from a previous session, so it can no longer be applied.
140
+ */
141
+ export type AIReplyChangeGroupOutdatedReason = "content-removed" | "editor-removed" | "session-changed";
131
142
  export {};
@@ -6,90 +6,35 @@
6
6
  * @module ai/aicore/model/airunresult
7
7
  * @publicApi
8
8
  */
9
- import { type Editor } from "@ckeditor/ckeditor5-core";
9
+ import type { AIRunSingleRootResult, AIRunStatus } from "./airunsinglerootresult.js";
10
10
  import { type CKEditorError } from "@ckeditor/ckeditor5-utils";
11
11
  /**
12
- * The status of an AI run, reported by the {@link module:ai/aicore/model/airunresult~AIRunResult#status `status`}.
12
+ * Container returned by any per-root AI run. Wraps one
13
+ * {@link module:ai/aicore/model/airunsinglerootresult~AIRunSingleRootResult} (or feature-specific subclass) per root
14
+ * when the run completes successfully; on whole-run failures (transport / parse errors or abort) the `results` array
15
+ * stays empty and the outcome is described by `status` and `error`.
13
16
  */
14
- export type AIRunStatus = "initialized" | "completed" | "aborted" | "error";
15
- /**
16
- * The shape of the data accepted by the {@link module:ai/aicore/model/airunresult~AIRunResult} constructor.
17
- */
18
- export type AIRunResultInput = {
19
- /**
20
- * The editor that is the source of content for the AI run.
21
- */
22
- editor: Editor;
23
- /**
24
- * Name of the editor root the AI run targets.
25
- */
26
- rootName: string;
27
- /**
28
- * Collaboration channel id captured at the start of the run.
29
- */
30
- channelId?: string;
17
+ export declare class AIRunResult<SubResultType extends AIRunSingleRootResult = AIRunSingleRootResult> {
18
+ constructor(results?: Array<SubResultType>);
31
19
  /**
32
- * AI editing session id captured at the start of the run.
20
+ * Marks the run as aborted. Reflected via {@link #status}. No-op when the run has already errored — a
21
+ * concrete error is more informative to the integrator than a subsequent abort.
33
22
  */
34
- sessionId: string;
35
- };
36
- /**
37
- * The result of an AI run.
38
- */
39
- export declare class AIRunResult {
40
- constructor(data: AIRunResultInput);
23
+ abort(): void;
41
24
  /**
42
- * Outcome of the run. Anything other than `'completed'` means the run did not finish successfully — see {@link #error} for details.
25
+ * Outcome of the whole run driven explicitly by the runner. Per-root sub-results carry their own
26
+ * `status` / `error`; consult {@link #results} for per-root outcomes.
43
27
  */
44
28
  get status(): AIRunStatus;
29
+ set status(value: AIRunStatus);
45
30
  /**
46
- * The editor the AI run was performed against.
47
- */
48
- get editor(): Editor;
49
- /**
50
- * Name of the editor root the AI run targeted.
51
- */
52
- get rootName(): string;
53
- /**
54
- * Collaboration channel id captured at the start of the run.
55
- */
56
- get channelId(): string | undefined;
57
- /**
58
- * AI editing session id captured at the start of the run.
59
- */
60
- get sessionId(): string;
61
- /**
62
- * Document version captured when the run started. `undefined` until the run starts.
63
- */
64
- get documentVersion(): number | undefined;
65
- set documentVersion(value: number);
66
- /**
67
- * The pre-run document snapshot as captured at the time the run started, with `data-id` attributes preserved.
68
- * `undefined` until the run starts.
69
- */
70
- get contentRawOld(): string | undefined;
71
- set contentRawOld(value: string);
72
- /**
73
- * The post-run document snapshot with all returned suggestions merged in, with `data-id` attributes preserved.
74
- * Equals {@link #contentRawOld} when the run produced no suggestions. `undefined` until the run completes.
75
- */
76
- get contentRawNew(): string | undefined;
77
- set contentRawNew(value: string);
78
- /**
79
- * The {@link #contentRawOld} with `data-id` attributes stripped. Suitable for surfacing to end-users.
80
- */
81
- get contentOld(): string;
82
- /**
83
- * The {@link #contentRawNew} with `data-id` attributes stripped. Suitable for surfacing to end-users.
84
- */
85
- get contentNew(): string;
86
- /**
87
- * The error that caused the run to fail.
31
+ * The error that caused the whole run to fail. Undefined when the run completed successfully or was aborted.
88
32
  */
89
33
  get error(): Error | undefined;
90
- set error(value: CKEditorError | undefined);
34
+ set error(value: CKEditorError);
35
+ get results(): Array<SubResultType>;
91
36
  /**
92
- * Marks the run as aborted. Reflected via {@link #status}.
37
+ * Appends one or more per-root sub-results to the multi.
93
38
  */
94
- abort(): void;
39
+ addResult(...results: Array<SubResultType>): void;
95
40
  }
@@ -0,0 +1,101 @@
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/model/airunsinglerootresult
7
+ * @publicApi
8
+ */
9
+ import { type Editor } from "@ckeditor/ckeditor5-core";
10
+ import { type CKEditorError } from "@ckeditor/ckeditor5-utils";
11
+ /**
12
+ * The status of an AI run, reported by the {@link module:ai/aicore/model/airunsinglerootresult~AIRunSingleRootResult#status `status`}.
13
+ */
14
+ export type AIRunStatus = "initialized" | "completed" | "aborted" | "error";
15
+ /**
16
+ * The shape of the data accepted by the {@link module:ai/aicore/model/airunsinglerootresult~AIRunSingleRootResult} constructor.
17
+ */
18
+ export type AIRunSingleRootResultInput = {
19
+ /**
20
+ * The editor that is the source of content for the AI run.
21
+ */
22
+ editor: Editor;
23
+ /**
24
+ * Name of the editor root the AI run targets.
25
+ */
26
+ rootName: string;
27
+ /**
28
+ * Collaboration channel id captured at the start of the run.
29
+ */
30
+ channelId?: string;
31
+ /**
32
+ * AI editing session id captured at the start of the run.
33
+ */
34
+ sessionId: string;
35
+ };
36
+ /**
37
+ * The result of an AI run.
38
+ */
39
+ export declare class AIRunSingleRootResult {
40
+ constructor(data: AIRunSingleRootResultInput);
41
+ /**
42
+ * Outcome of the run. Anything other than `'completed'` means the run did not finish successfully — see {@link #error} for details.
43
+ */
44
+ get status(): AIRunStatus;
45
+ /**
46
+ * The editor the AI run was performed against.
47
+ */
48
+ get editor(): Editor;
49
+ /**
50
+ * Name of the editor root the AI run targeted.
51
+ */
52
+ get rootName(): string;
53
+ /**
54
+ * Collaboration channel id captured at the start of the run.
55
+ */
56
+ get channelId(): string | undefined;
57
+ /**
58
+ * AI editing session id captured at the start of the run.
59
+ */
60
+ get sessionId(): string;
61
+ /**
62
+ * Document version captured when the run started. `undefined` until the run starts.
63
+ */
64
+ get documentVersion(): number | undefined;
65
+ set documentVersion(value: number);
66
+ /**
67
+ * The pre-run document snapshot as captured at the time the run started, with `data-id` attributes preserved.
68
+ * `undefined` until the run starts.
69
+ */
70
+ get contentRawOld(): string | undefined;
71
+ set contentRawOld(value: string);
72
+ /**
73
+ * The post-run document snapshot with all returned suggestions merged in, with `data-id` attributes preserved.
74
+ * Equals {@link #contentRawOld} when the run produced no suggestions. `undefined` until the run completes.
75
+ */
76
+ get contentRawNew(): string | undefined;
77
+ set contentRawNew(value: string);
78
+ /**
79
+ * The {@link #contentRawOld} with `data-id` attributes stripped. Suitable for surfacing to end-users.
80
+ */
81
+ get contentOld(): string;
82
+ /**
83
+ * The {@link #contentRawNew} with `data-id` attributes stripped. Suitable for surfacing to end-users.
84
+ */
85
+ get contentNew(): string;
86
+ /**
87
+ * The error that caused the run to fail.
88
+ */
89
+ get error(): Error | undefined;
90
+ set error(value: CKEditorError | undefined);
91
+ /**
92
+ * Whether applying the result dropped the change because it would introduce block structure an inline root cannot
93
+ * accept. When `true`, the run completed but {@link module:ai/aicore/aigateway~AIGateway#apply} applied nothing.
94
+ */
95
+ get droppedUnsupportedInlineChange(): boolean;
96
+ set droppedUnsupportedInlineChange(value: boolean);
97
+ /**
98
+ * Marks the run as aborted. Reflected via {@link #status}.
99
+ */
100
+ abort(): void;
101
+ }
@@ -7,7 +7,6 @@
7
7
  */
8
8
  import { type Locale } from "@ckeditor/ckeditor5-utils";
9
9
  import { View } from "@ckeditor/ckeditor5-ui";
10
- import "../../../theme/common/aidisclaimer.css";
11
10
  /**
12
11
  * The disclaimer view of the AI plugin.
13
12
  *
@@ -7,7 +7,6 @@
7
7
  */
8
8
  import { type Locale } from "@ckeditor/ckeditor5-utils";
9
9
  import { type ButtonView, FormHeaderView, type View } from "@ckeditor/ckeditor5-ui";
10
- import "../../../theme/common/aiheader.css";
11
10
  export declare class AIHeaderView extends FormHeaderView {
12
11
  /**
13
12
  * The button to resize the chat view.