@ckeditor/ckeditor5-ai 48.0.1 → 48.1.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.
Files changed (195) hide show
  1. package/ckeditor5-metadata.json +1 -1
  2. package/dist/aiballoon/aiballoon.d.ts +8 -1
  3. package/dist/aichat/aichatcontroller.d.ts +15 -2
  4. package/dist/aichat/aichatui.d.ts +4 -3
  5. package/dist/aichat/model/aichatcontext.d.ts +99 -1
  6. package/dist/aichat/model/aichatconversation.d.ts +25 -3
  7. package/dist/aichat/model/aichatinteraction.d.ts +9 -0
  8. package/dist/aichat/ui/aichatfeedview.d.ts +12 -11
  9. package/dist/aichat/ui/aichatview.d.ts +3 -2
  10. package/dist/aichat/ui/controls/resources/aichatcontextresourcesview.d.ts +1 -1
  11. package/dist/aichat/ui/feed/aichatfeedsuggestionitemview.d.ts +1 -2
  12. package/dist/aichat/utils/eventnames.d.ts +1 -1
  13. package/dist/aichat/utils/promisequeue.d.ts +0 -3
  14. package/dist/aichathistory/aichathistoryui.d.ts +1 -6
  15. package/dist/aichathistory/ui/aichathistorylistitemview.d.ts +1 -0
  16. package/dist/aichathistory/ui/aichathistoryview.d.ts +3 -11
  17. package/dist/aiconfig.d.ts +8 -0
  18. package/dist/aicore/aiconnector.d.ts +37 -0
  19. package/dist/aicore/aiediting.d.ts +25 -12
  20. package/dist/aicore/model/aicontext.d.ts +18 -0
  21. package/dist/aicore/model/aiinteraction.d.ts +11 -3
  22. package/dist/aicore/model/aimodels.d.ts +6 -0
  23. package/dist/aicore/model/aireply.d.ts +25 -4
  24. package/dist/aicore/pipeline/airesponseapplier.d.ts +13 -0
  25. package/dist/{aichat/ui/aichatheaderview.d.ts → aicore/ui/aiheaderview.d.ts} +11 -9
  26. package/dist/aicore/ui/aiskeleton.d.ts +4 -0
  27. package/dist/aicore/ui/suggestioncontainer/aisuggestionbodyview.d.ts +11 -3
  28. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontainerview.d.ts +1 -2
  29. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartview.d.ts +1 -3
  30. package/dist/aicore/utils/abortabletimeout.d.ts +16 -0
  31. package/dist/aicore/utils/createstartconversationbutton.d.ts +11 -0
  32. package/dist/aicore/utils/geteditorfromcontext.d.ts +13 -0
  33. package/dist/aicore/utils/getoperationsfromreply.d.ts +3 -1
  34. package/dist/aicore/utils/htmlstreamer.d.ts +10 -10
  35. package/dist/aicore/utils/scrollmanager.d.ts +5 -1
  36. package/dist/aiquickactions/aiquickactions.d.ts +7 -14
  37. package/dist/aiquickactions/aiquickactionsui.d.ts +1 -1
  38. package/dist/aiquickactions/ui/balloon/aiactionsballoonview.d.ts +1 -1
  39. package/dist/aireviewcore/aireviewcoreediting.d.ts +29 -3
  40. package/dist/aireviewcore/model/aireviewcheckrun.d.ts +2 -0
  41. package/dist/aitabs/aitabs.d.ts +1 -5
  42. package/dist/aitabs/tabs/aitabsview.d.ts +36 -0
  43. package/dist/aitranslate/ui/aitranslatecheckresultsview.d.ts +1 -1
  44. package/dist/index-content.css +1 -0
  45. package/dist/index-editor.css +258 -235
  46. package/dist/index.css +258 -235
  47. package/dist/index.d.ts +8 -8
  48. package/dist/index.js +6 -6
  49. package/dist/translations/af.js +1 -1
  50. package/dist/translations/af.umd.js +1 -1
  51. package/dist/translations/ar.js +1 -1
  52. package/dist/translations/ar.umd.js +1 -1
  53. package/dist/translations/ast.js +1 -1
  54. package/dist/translations/ast.umd.js +1 -1
  55. package/dist/translations/az.js +1 -1
  56. package/dist/translations/az.umd.js +1 -1
  57. package/dist/translations/be.js +1 -1
  58. package/dist/translations/be.umd.js +1 -1
  59. package/dist/translations/bg.js +1 -1
  60. package/dist/translations/bg.umd.js +1 -1
  61. package/dist/translations/bn.js +1 -1
  62. package/dist/translations/bn.umd.js +1 -1
  63. package/dist/translations/bs.js +1 -1
  64. package/dist/translations/bs.umd.js +1 -1
  65. package/dist/translations/ca.js +1 -1
  66. package/dist/translations/ca.umd.js +1 -1
  67. package/dist/translations/cs.js +1 -1
  68. package/dist/translations/cs.umd.js +1 -1
  69. package/dist/translations/da.js +1 -1
  70. package/dist/translations/da.umd.js +1 -1
  71. package/dist/translations/de-ch.js +1 -1
  72. package/dist/translations/de-ch.umd.js +1 -1
  73. package/dist/translations/de.js +1 -1
  74. package/dist/translations/de.umd.js +1 -1
  75. package/dist/translations/el.js +1 -1
  76. package/dist/translations/el.umd.js +1 -1
  77. package/dist/translations/en-au.js +1 -1
  78. package/dist/translations/en-au.umd.js +1 -1
  79. package/dist/translations/en-gb.js +1 -1
  80. package/dist/translations/en-gb.umd.js +1 -1
  81. package/dist/translations/en.js +1 -1
  82. package/dist/translations/en.umd.js +1 -1
  83. package/dist/translations/eo.js +1 -1
  84. package/dist/translations/eo.umd.js +1 -1
  85. package/dist/translations/es-co.js +1 -1
  86. package/dist/translations/es-co.umd.js +1 -1
  87. package/dist/translations/es.js +1 -1
  88. package/dist/translations/es.umd.js +1 -1
  89. package/dist/translations/et.js +1 -1
  90. package/dist/translations/et.umd.js +1 -1
  91. package/dist/translations/eu.js +1 -1
  92. package/dist/translations/eu.umd.js +1 -1
  93. package/dist/translations/fa.js +1 -1
  94. package/dist/translations/fa.umd.js +1 -1
  95. package/dist/translations/fi.js +1 -1
  96. package/dist/translations/fi.umd.js +1 -1
  97. package/dist/translations/fr.js +1 -1
  98. package/dist/translations/fr.umd.js +1 -1
  99. package/dist/translations/gl.js +1 -1
  100. package/dist/translations/gl.umd.js +1 -1
  101. package/dist/translations/gu.js +1 -1
  102. package/dist/translations/gu.umd.js +1 -1
  103. package/dist/translations/he.js +1 -1
  104. package/dist/translations/he.umd.js +1 -1
  105. package/dist/translations/hi.js +1 -1
  106. package/dist/translations/hi.umd.js +1 -1
  107. package/dist/translations/hr.js +1 -1
  108. package/dist/translations/hr.umd.js +1 -1
  109. package/dist/translations/hu.js +1 -1
  110. package/dist/translations/hu.umd.js +1 -1
  111. package/dist/translations/hy.js +1 -1
  112. package/dist/translations/hy.umd.js +1 -1
  113. package/dist/translations/id.js +1 -1
  114. package/dist/translations/id.umd.js +1 -1
  115. package/dist/translations/it.js +1 -1
  116. package/dist/translations/it.umd.js +1 -1
  117. package/dist/translations/ja.js +1 -1
  118. package/dist/translations/ja.umd.js +1 -1
  119. package/dist/translations/jv.js +1 -1
  120. package/dist/translations/jv.umd.js +1 -1
  121. package/dist/translations/kk.js +1 -1
  122. package/dist/translations/kk.umd.js +1 -1
  123. package/dist/translations/km.js +1 -1
  124. package/dist/translations/km.umd.js +1 -1
  125. package/dist/translations/kn.js +1 -1
  126. package/dist/translations/kn.umd.js +1 -1
  127. package/dist/translations/ko.js +1 -1
  128. package/dist/translations/ko.umd.js +1 -1
  129. package/dist/translations/ku.js +1 -1
  130. package/dist/translations/ku.umd.js +1 -1
  131. package/dist/translations/lt.js +1 -1
  132. package/dist/translations/lt.umd.js +1 -1
  133. package/dist/translations/lv.js +1 -1
  134. package/dist/translations/lv.umd.js +1 -1
  135. package/dist/translations/ms.js +1 -1
  136. package/dist/translations/ms.umd.js +1 -1
  137. package/dist/translations/nb.js +1 -1
  138. package/dist/translations/nb.umd.js +1 -1
  139. package/dist/translations/ne.js +1 -1
  140. package/dist/translations/ne.umd.js +1 -1
  141. package/dist/translations/nl.js +1 -1
  142. package/dist/translations/nl.umd.js +1 -1
  143. package/dist/translations/no.js +1 -1
  144. package/dist/translations/no.umd.js +1 -1
  145. package/dist/translations/oc.js +1 -1
  146. package/dist/translations/oc.umd.js +1 -1
  147. package/dist/translations/pl.js +1 -1
  148. package/dist/translations/pl.umd.js +1 -1
  149. package/dist/translations/pt-br.js +1 -1
  150. package/dist/translations/pt-br.umd.js +1 -1
  151. package/dist/translations/pt.js +1 -1
  152. package/dist/translations/pt.umd.js +1 -1
  153. package/dist/translations/ro.js +1 -1
  154. package/dist/translations/ro.umd.js +1 -1
  155. package/dist/translations/ru.js +1 -1
  156. package/dist/translations/ru.umd.js +1 -1
  157. package/dist/translations/si.js +1 -1
  158. package/dist/translations/si.umd.js +1 -1
  159. package/dist/translations/sk.js +1 -1
  160. package/dist/translations/sk.umd.js +1 -1
  161. package/dist/translations/sl.js +1 -1
  162. package/dist/translations/sl.umd.js +1 -1
  163. package/dist/translations/sq.js +1 -1
  164. package/dist/translations/sq.umd.js +1 -1
  165. package/dist/translations/sr-latn.js +1 -1
  166. package/dist/translations/sr-latn.umd.js +1 -1
  167. package/dist/translations/sr.js +1 -1
  168. package/dist/translations/sr.umd.js +1 -1
  169. package/dist/translations/sv.js +1 -1
  170. package/dist/translations/sv.umd.js +1 -1
  171. package/dist/translations/th.js +1 -1
  172. package/dist/translations/th.umd.js +1 -1
  173. package/dist/translations/ti.js +1 -1
  174. package/dist/translations/ti.umd.js +1 -1
  175. package/dist/translations/tk.js +1 -1
  176. package/dist/translations/tk.umd.js +1 -1
  177. package/dist/translations/tr.js +1 -1
  178. package/dist/translations/tr.umd.js +1 -1
  179. package/dist/translations/tt.js +1 -1
  180. package/dist/translations/tt.umd.js +1 -1
  181. package/dist/translations/ug.js +1 -1
  182. package/dist/translations/ug.umd.js +1 -1
  183. package/dist/translations/uk.js +1 -1
  184. package/dist/translations/uk.umd.js +1 -1
  185. package/dist/translations/ur.js +1 -1
  186. package/dist/translations/ur.umd.js +1 -1
  187. package/dist/translations/uz.js +1 -1
  188. package/dist/translations/uz.umd.js +1 -1
  189. package/dist/translations/vi.js +1 -1
  190. package/dist/translations/vi.umd.js +1 -1
  191. package/dist/translations/zh-cn.js +1 -1
  192. package/dist/translations/zh-cn.umd.js +1 -1
  193. package/dist/translations/zh.js +1 -1
  194. package/dist/translations/zh.umd.js +1 -1
  195. package/package.json +12 -12
@@ -38,7 +38,7 @@
38
38
  "className": "AITranslate",
39
39
  "description": "Introduces AI-powered content translations with translated content preview, suggestions, and configurable list of languages",
40
40
  "docs": "features/ai/ckeditor-ai-overview.html",
41
- "path": "src/aitranslate/aitranslate.js"
41
+ "path": "src/aitranslate/aitranslate.ts"
42
42
  },
43
43
  {
44
44
  "name": "AI Quick Actions",
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module ai/aiballoon/aiballoon
7
7
  */
8
- import { ContextPlugin } from '@ckeditor/ckeditor5-core';
8
+ import { ContextPlugin, type Editor } from '@ckeditor/ckeditor5-core';
9
9
  import { AIEditing } from '../aicore/aiediting.js';
10
10
  import '../../theme/aiballoon/aiballoon.css';
11
11
  import { type ModelRange } from '@ckeditor/ckeditor5-engine';
@@ -26,6 +26,13 @@ export interface AIBalloonConfig {
26
26
  mainView: AIBalloonView;
27
27
  ranges: Array<ModelRange>;
28
28
  class: string;
29
+ /**
30
+ * The editor the balloon should anchor to. When provided (multi-root / multi-instance setups), it takes precedence over the
31
+ * focus-based heuristic used by {@link module:ai/aicore/utils/geteditorfromcontext~getEditorFromContext} — otherwise clicking a
32
+ * chat-sidebar suggestion chip routes the balloon to whichever editor happens to be focused, which collapses dialog positioning
33
+ * when the chip's target range lives on a different editor or root.
34
+ */
35
+ targetEditor?: Editor;
29
36
  }
30
37
  /**
31
38
  * The AI Balloon plugin provides a balloon dialog interface for displaying and interacting with AI suggestions.
@@ -147,8 +147,13 @@ export declare class AIChatController extends ContextPlugin {
147
147
  focusPromptInput(): void;
148
148
  /**
149
149
  * Creates a new, empty conversation.
150
+ *
151
+ * @param options Optional parameters for starting the conversation.
152
+ * @param options.modelId If provided, this model will be selected for the new conversation instead of the default one.
150
153
  */
151
- startConversation(): Promise<void>;
154
+ startConversation(options?: {
155
+ modelId?: string;
156
+ }): Promise<void>;
152
157
  /**
153
158
  * Submits a user message to the currently active conversation.
154
159
  */
@@ -162,8 +167,16 @@ export declare class AIChatController extends ContextPlugin {
162
167
  getGroupId(): string;
163
168
  /**
164
169
  * Starts an AI chat conversation safely, catching and logging any errors.
170
+ *
171
+ * @param options Options for starting the conversation.
172
+ * @param options.id Optional conversation ID. If provided, initializes an existing conversation.
173
+ * If not defined, starts a new conversation with a generated ID.
174
+ * @param options.modelId Optional model ID to use for the conversation. If not provided, the default model is used.
165
175
  */
166
- protected _startConversationSafely(id?: string): Promise<void>;
176
+ protected _startConversationSafely(options?: {
177
+ id?: string;
178
+ modelId?: string;
179
+ }): Promise<void>;
167
180
  }
168
181
  /**
169
182
  * Data for the message send by the user in the AI chat.
@@ -124,8 +124,8 @@ export declare class AIChatUI extends ContextPlugin {
124
124
  updateFeedItemAIReplySuggestionContent(options: {
125
125
  id: string;
126
126
  parts: Array<AISuggestionContentPartDefinition>;
127
- renderingStrategy?: AIContentRenderingStrategy;
128
127
  isDone?: boolean;
128
+ skipLoadingEffects?: boolean;
129
129
  }): Promise<void>;
130
130
  /**
131
131
  * Updates the state of a content part by its index.
@@ -238,7 +238,6 @@ export declare class AIChatUI extends ContextPlugin {
238
238
  * Clears the loading message of the chat feed.
239
239
  */
240
240
  clearLoadingMessage(): void;
241
- setIsMaximized(isMaximized: boolean): void;
242
241
  /**
243
242
  * Populates a source resource balloon with loaded resources.
244
243
  */
@@ -256,7 +255,9 @@ export declare class AIChatUI extends ContextPlugin {
256
255
  */
257
256
  focusPromptInput(useHighlight?: boolean): void;
258
257
  scrollFeedToSuggestion(replyId: string, partIndex: number): void;
259
- startAutoScroll(): void;
258
+ startAutoScroll(options?: {
259
+ smooth?: boolean;
260
+ }): void;
260
261
  disableControls(): void;
261
262
  enableControls(): void;
262
263
  }
@@ -2,8 +2,14 @@
2
2
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
+ /**
6
+ * @module ai/aichat/model/aichatcontext
7
+ * @publicApi
8
+ */
9
+ import { type Editor } from '@ckeditor/ckeditor5-core';
5
10
  import { type AIConnector, type AIUserMessage } from '../../aicore/aiconnector.js';
6
- import { type AIContextItemType, type AIContextTextResourceType, type AIContextItem, type AIContextItemRequestData, type AIToolContextItem } from '../../aicore/model/aicontext.js';
11
+ import { type AIEditingDocumentData } from '../../aicore/aiediting.js';
12
+ import { type AIContextItemType, type AIContextTextResourceType, type AIContextItem, type AIContextItemRequestData, type AIDocumentContextSlice, type AIToolContextItem } from '../../aicore/model/aicontext.js';
7
13
  export declare const AI_CONTEXT_MODEL_EVENT_NAMES: readonly ["contextItemAdded", "contextItemRemoved", "contextItemLoadingEnded", "contextSent", "error", "addContextOptionsChanged", "sourceResourcesLoaded", "resourceStateChanged", "uploadProgressChanged"];
8
14
  declare const AIChatContext_base: {
9
15
  new (): import("@ckeditor/ckeditor5-utils").Observable;
@@ -28,6 +34,41 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
28
34
  * without the standard deprecation policy. Check the changelog for migration guidance.
29
35
  */
30
36
  init(): void;
37
+ /**
38
+ * Returns the editor / root / content that a document with the given id was uploaded from, or `undefined` if no such mapping exists
39
+ * (e.g. single-document upload path, or the id is unknown).
40
+ *
41
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
42
+ * without the standard deprecation policy. Check the changelog for migration guidance.
43
+ */
44
+ getDocumentSource(documentId: string | undefined): AIChatContextDocumentSource | undefined;
45
+ /**
46
+ * Returns the source (editor / root / content / documentId) that a `data-id` in an AI response belongs to.
47
+ *
48
+ * Relied on by the suggestion balloon flow when a single reply's change groups span multiple uploaded documents.
49
+ *
50
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
51
+ * without the standard deprecation policy. Check the changelog for migration guidance.
52
+ */
53
+ getSourceByDataId(dataId: string | undefined): (AIChatContextDocumentSource & {
54
+ documentId: string;
55
+ }) | undefined;
56
+ /**
57
+ * Returns an `AIDocumentContextSlice` describing the position and bounds of a single uploaded document inside the concatenated
58
+ * reply context. Used by the apply/insert pipeline to diff and commit AI operations against the correct editor root.
59
+ *
60
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
61
+ * without the standard deprecation policy. Check the changelog for migration guidance.
62
+ */
63
+ getDocumentContextSlice(documentId: string | undefined): AIDocumentContextSlice | undefined;
64
+ /**
65
+ * Same as {@link #getDocumentContextSlice} but resolved via a `data-id` that appears in the uploaded documents. A convenience
66
+ * for AI response handling where the server returns `data-id` references rather than our internal document ids.
67
+ *
68
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
69
+ * without the standard deprecation policy. Check the changelog for migration guidance.
70
+ */
71
+ getDocumentContextSliceByDataId(dataId: string | undefined): AIDocumentContextSlice | undefined;
31
72
  /**
32
73
  * Returns the pending context items that will be sent to the AI endpoint in the next interaction.
33
74
  *
@@ -44,6 +85,27 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
44
85
  * without the standard deprecation policy. Check the changelog for migration guidance.
45
86
  */
46
87
  populateFromMessage(content: AIUserMessage['content'][0]): Promise<AIContextItem>;
88
+ /**
89
+ * Batch-loads document content items from a historical user message, matches each to a live editor root by
90
+ * {@link module:core/editor/editorconfig~RootConfig#label `label`} and
91
+ * {@link module:core/editor/editorconfig~RootConfig#description `description`}, and populates the internal
92
+ * document-source maps so historical replies can route modifications to the correct root.
93
+ *
94
+ * Returns the assembled `current-document` context item together with a `hasUnmatched` flag that the caller
95
+ * should propagate to reply `areActionsDisabled` so suggestions from documents whose source root cannot be found
96
+ * are shown with a "from previous session" note.
97
+ *
98
+ * For single-document messages this method delegates to the single-fetch path ({@link #populateFromMessage})
99
+ * and assumes the conversation relates to the first editor / first non-graveyard root — `name` and
100
+ * `description` are not required in the single-document case.
101
+ *
102
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
103
+ * without the standard deprecation policy. Check the changelog for migration guidance.
104
+ */
105
+ populateDocumentsFromUserMessage(messageContents: AIUserMessage['content'], editors: ReadonlyArray<Editor>): Promise<{
106
+ contextItem?: AIContextItem;
107
+ hasUnmatched: boolean;
108
+ }>;
47
109
  /**
48
110
  * Creates a context item from conversation content.
49
111
  */
@@ -149,6 +211,20 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
149
211
  end: number;
150
212
  htmlFragment: string;
151
213
  }>): Promise<void>;
214
+ /**
215
+ * Updates the current document in the pending context using multiple per-root documents.
216
+ * This is the multi-root / multi-instance counterpart of
217
+ * {@link module:ai/aichat/model/aichatcontext~AIChatContext#updateCurrentDocument `updateCurrentDocument()`}: it uploads the documents
218
+ * in a single batch request and writes the returned ids (plus content, version, sessionId and selection) into the pending
219
+ * `current-document` context item's `documents` array. The id → `{ editor, rootName, content }` mapping is also stashed internally
220
+ * so downstream consumers can resolve a `documentId` from a streamed AI response back to the source editor and root.
221
+ *
222
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
223
+ * without the standard deprecation policy. Check the changelog for migration guidance.
224
+ * @param documents Per-root document data to upload.
225
+ * @returns Promise that resolves when the documents are updated.
226
+ */
227
+ updateDocuments(documents: Array<AIEditingDocumentData>): Promise<void>;
152
228
  /**
153
229
  * @experimental **Experimental:** This is a production-ready API but may change in minor releases
154
230
  * without the standard deprecation policy. Check the changelog for migration guidance.
@@ -224,6 +300,28 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
224
300
  */
225
301
  addResourceToContext(source: AIContextProvider, resource: AIContextResource): Promise<void>;
226
302
  }
303
+ /**
304
+ * A uploaded-document source stored on the chat context, keyed by the id returned by the `/documents/batch` endpoint.
305
+ *
306
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
307
+ * without the standard deprecation policy. Check the changelog for migration guidance.
308
+ */
309
+ export type AIChatContextDocumentSource = {
310
+ editor: Editor;
311
+ rootName: string;
312
+ content: string;
313
+ version: number;
314
+ /**
315
+ * The `label` of the source editor root at upload time; used to match historical documents back to a live root when loading a
316
+ * conversation from history.
317
+ */
318
+ name?: string;
319
+ /**
320
+ * The `description` of the source editor root at upload time; used alongside {@link #name} to disambiguate roots that share
321
+ * the same label.
322
+ */
323
+ description?: string;
324
+ };
227
325
  export type AIChatContextItemAddedEvent = {
228
326
  name: 'contextItemAdded';
229
327
  args: [
@@ -5,10 +5,11 @@
5
5
  /**
6
6
  * @module ai/aichat/model/aichatconversation
7
7
  */
8
- import { CKEditorError } from '@ckeditor/ckeditor5-utils';
8
+ import { CKEditorError, type Locale } from '@ckeditor/ckeditor5-utils';
9
9
  import type { AIConnector, AIModelData } from '../../aicore/aiconnector.js';
10
- import { AIChatContext, type AIChatContextConfig, type AIContextProvider, type AIContextResource, type AIContextResourceState } from './aichatcontext.js';
11
- import { type AIToolContextItem, type AIContextItem } from '../../aicore/model/aicontext.js';
10
+ import { AIChatContext, type AIChatContextConfig, type AIChatContextDocumentSource, type AIContextProvider, type AIContextResource, type AIContextResourceState } from './aichatcontext.js';
11
+ import { type AIEditingDocumentData } from '../../aicore/aiediting.js';
12
+ import { type AIToolContextItem, type AIContextItem, type AIDocumentContextSlice } from '../../aicore/model/aicontext.js';
12
13
  import { AICapabilities, type AICapabilitiesConfig } from '../../aicore/model/aicapabilities.js';
13
14
  import type { AIModels } from '../../aicore/model/aimodels.js';
14
15
  import { type Editor } from '@ckeditor/ckeditor5-core';
@@ -135,6 +136,21 @@ export declare class AIChatConversation extends /* #__PURE__ */ AIChatConversati
135
136
  htmlFragment: string;
136
137
  }>;
137
138
  }): Promise<void>;
139
+ /**
140
+ * Updates the documents in the context to contain the provided content and version.
141
+ */
142
+ updateDocumentsInContext(documents: Array<AIEditingDocumentData>): Promise<void>;
143
+ /**
144
+ * Returns the source (editor / root / content / documentId) that a `data-id` in an AI response belongs to.
145
+ */
146
+ getSourceByDataId(dataId: string | undefined): (AIChatContextDocumentSource & {
147
+ documentId: string;
148
+ }) | undefined;
149
+ /**
150
+ * Returns the `AIDocumentContextSlice` describing a single uploaded document — used by the apply/insert pipeline to diff against
151
+ * and commit operations to the correct editor root.
152
+ */
153
+ getDocumentContextSliceByDataId(dataId: string | undefined): AIDocumentContextSlice | undefined;
138
154
  /**
139
155
  * Returns the content of the current interaction's document.
140
156
  */
@@ -276,6 +292,12 @@ export type AIChatConversationOptions = {
276
292
  connector: AIConnector;
277
293
  chatModels: AIModels;
278
294
  getEditor?: () => Editor;
295
+ getEditors?: () => Array<Editor>;
296
+ /**
297
+ * Locale forwarded to {@link module:ai/aichat/model/aichatinteraction~AIChatInteraction interactions} (and through them to
298
+ * replies) for translating internal user-facing strings — see {@link module:ai/aicore/model/aiinteraction~AIInteractionOptions}.
299
+ */
300
+ locale?: Locale;
279
301
  conversationId: string;
280
302
  group: string;
281
303
  selectedModelId?: string;
@@ -9,6 +9,7 @@
9
9
  import { type AICapabilitiesConfig } from '../../aicore/model/aicapabilities.js';
10
10
  import { AIInteraction, type AIInteractionOptions } from '../../aicore/model/aiinteraction.js';
11
11
  import { type AIContextItem } from '../../aicore/model/aicontext.js';
12
+ import { type AIReply } from '../../aicore/model/aireply.js';
12
13
  export declare class AIChatInteraction extends AIInteraction {
13
14
  /**
14
15
  * The user message that was sent to the AI endpoint.
@@ -35,6 +36,14 @@ export declare class AIChatInteraction extends AIInteraction {
35
36
  */
36
37
  readonly attributes?: Record<string, unknown>;
37
38
  constructor(options: AIChatInteractionOptions);
39
+ /**
40
+ * @inheritDoc
41
+ *
42
+ * For multi-root / multi-instance conversations, the `documentContextContent` is the concatenation of all uploaded documents'
43
+ * HTML. The server can send a single modification-delta stream whose `data-id`s span several source documents, so the reply needs
44
+ * a combined view when computing change groups. The single-document path keeps the base behavior.
45
+ */
46
+ createReply(options: Parameters<AIInteraction['createReply']>[0]): AIReply;
38
47
  }
39
48
  export type AIChatInteractionOptions = {
40
49
  conversationId: string;
@@ -28,20 +28,14 @@ export declare class AIChatFeedView extends View {
28
28
  * A collection of feed items.
29
29
  */
30
30
  readonly children: ViewCollection<AIChatFeedItemView>;
31
- /**
32
- * The pending state of the feed. It indicates whether the feed is currently processing
33
- * a response, meaning there is an active interaction.
34
- *
35
- * @observable
36
- */
37
- isPending: boolean;
38
31
  /**
39
32
  * The loading message displayed when the feed is processing a response.
40
33
  *
34
+ * When set, it gets displayed together with a loader spinner.
35
+ *
41
36
  * @observable
42
37
  */
43
38
  loadingMessage: string;
44
- isLoadingSkeletonVisible: boolean;
45
39
  /**
46
40
  * @observable
47
41
  */
@@ -72,11 +66,11 @@ export declare class AIChatFeedView extends View {
72
66
  abortSignal: AbortSignal;
73
67
  }): Promise<void>;
74
68
  updateWebSources(id: string, sources: Array<AISource>): Promise<void>;
75
- updateSuggestionItem({ id, parts, renderingStrategy, abortSignal }: {
69
+ updateSuggestionItem({ id, parts, abortSignal, skipLoadingEffects }: {
76
70
  id: string;
77
71
  parts: Array<AISuggestionContentPartDefinition>;
78
- renderingStrategy: AIContentRenderingStrategy;
79
72
  abortSignal: AbortSignal;
73
+ skipLoadingEffects?: boolean;
80
74
  }): Promise<void>;
81
75
  updateSuggestionPartState({ id, index, state }: {
82
76
  id: string;
@@ -110,6 +104,9 @@ export declare class AIChatFeedView extends View {
110
104
  */
111
105
  hasItem(id: string): boolean;
112
106
  scrollToSuggestion(replyId: string, partIndex: number): void;
107
+ /**
108
+ * Sets the loading message of the chat feed.
109
+ */
113
110
  setLoadingMessage(message: string): void;
114
111
  /**
115
112
  * Toggles the loading skeleton in the feed.
@@ -117,8 +114,12 @@ export declare class AIChatFeedView extends View {
117
114
  toggleLoadingSkeleton(isLoading: boolean): void;
118
115
  /**
119
116
  * Starts the auto-scrolling of the feed.
117
+ *
118
+ * @param options.smooth When `false`, the scroll jumps instantly instead of animating. Defaults to `true`.
120
119
  */
121
- startAutoScroll(): void;
120
+ startAutoScroll(options?: {
121
+ smooth?: boolean;
122
+ }): void;
122
123
  /**
123
124
  * Stops the auto-scrolling of the feed.
124
125
  */
@@ -6,9 +6,10 @@
6
6
  * @module ai/aichat/ui/aichatview
7
7
  */
8
8
  import { type Locale } from '@ckeditor/ckeditor5-utils';
9
- import { type FormHeaderView, View } from '@ckeditor/ckeditor5-ui';
9
+ import { View } from '@ckeditor/ckeditor5-ui';
10
10
  import { AIChatFeedView } from './aichatfeedview.js';
11
11
  import { AIChatControlsView } from './aichatcontrolsview.js';
12
+ import { AIHeaderView } from '../../aicore/ui/aiheaderview.js';
12
13
  import { AIDisclaimerView } from '../../aicore/ui/aidisclaimerview.js';
13
14
  import { type AIContextProvider, type AIContextResourceState } from '../../aichat/model/aichatcontext.js';
14
15
  import '../../../theme/common/ainotification.css';
@@ -21,7 +22,7 @@ import '../../../theme/common/aitrackchanges.css';
21
22
  * It contains the header, feed and controls views.
22
23
  */
23
24
  export declare class AIChatView extends View {
24
- chatHeader: FormHeaderView;
25
+ chatHeader: AIHeaderView;
25
26
  chatFeed: AIChatFeedView;
26
27
  chatControls: AIChatControlsView;
27
28
  chatDisclaimer: AIDisclaimerView;
@@ -20,7 +20,7 @@ export declare class AIChatContextResourcesView extends View {
20
20
  * Creates a new AI context resources view.
21
21
  *
22
22
  * @param locale The locale instance for internationalization
23
- * @param source The AI context provider source for this resources view
23
+ * @param options.source The AI context provider source for this resources view.
24
24
  */
25
25
  constructor(locale: Locale, options: {
26
26
  source: AIContextProvider;
@@ -12,7 +12,6 @@ import { type AISuggestionActionName } from './aichatfeedsuggestionitemactionsvi
12
12
  import { type AIReplyChangeGroupState } 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
- import { type AIContentRenderingStrategy } from '../../../aicore/ui/suggestioncontainer/aisuggestionstreamablecontentview.js';
16
15
  import { type BodyCollection } from '@ckeditor/ckeditor5-ui';
17
16
  /**
18
17
  * A view for an AI suggestion item in the AI chat feed.
@@ -39,8 +38,8 @@ export declare class AIChatFeedSuggestionItemView extends AIChatFeedItemView {
39
38
  */
40
39
  updateContent(options: {
41
40
  parts: Array<AISuggestionContentPartDefinition>;
42
- renderingStrategy: AIContentRenderingStrategy;
43
41
  abortSignal: AbortSignal;
42
+ skipLoadingEffects?: boolean;
44
43
  }): Promise<void>;
45
44
  /**
46
45
  * Updates the state of a content part by its index.
@@ -2,4 +2,4 @@
2
2
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- export declare const AI_CHAT_UI_EVENT_NAMES: readonly ["showChangeInText", "insertSuggestion", "applySuggestion", "rejectSuggestion", "mouseOverSuggestion", "mouseLeaveSuggestion", "toggleSuggestionDisplayMode", "like", "dislike", "startConversation", "resizeTabs", "sendUserMessage", "abortPromptStream", "addDocumentToContext", "addFileToContext", "addUrlToContext", "executeCustomItemCallback", "addResourceToContext", "removeContextItem", "loadSourceResources", "toggleWebSearch", "toggleReasoning", "selectModel"];
5
+ export declare const AI_CHAT_UI_EVENT_NAMES: readonly ["showChangeInText", "insertSuggestion", "applySuggestion", "rejectSuggestion", "mouseOverSuggestion", "mouseLeaveSuggestion", "toggleSuggestionDisplayMode", "like", "dislike", "startConversation", "sendUserMessage", "abortPromptStream", "addDocumentToContext", "addFileToContext", "addUrlToContext", "executeCustomItemCallback", "addResourceToContext", "removeContextItem", "loadSourceResources", "toggleWebSearch", "toggleReasoning", "selectModel"];
@@ -6,9 +6,6 @@ declare const PromiseQueue_base: {
6
6
  new (): import("@ckeditor/ckeditor5-utils").Emitter;
7
7
  prototype: import("@ckeditor/ckeditor5-utils").Emitter;
8
8
  };
9
- /**
10
- * @module ai/aichat/utils/promisequeue
11
- */
12
9
  export declare class PromiseQueue extends PromiseQueue_base {
13
10
  isProcessing: boolean;
14
11
  /**
@@ -8,7 +8,7 @@
8
8
  import { type Context, type Editor, ContextPlugin } from '@ckeditor/ckeditor5-core';
9
9
  import { AITabs } from '../aitabs/aitabs.js';
10
10
  import '../../theme/aichat/aichathistory.css';
11
- export declare const AI_CHAT_HISTORY_UI_EVENT_NAMES: readonly ["showConversationHistory", "removeConversation", "editConversationTitle", "setConversationPinned", "selectConversation", "openChat", "resizeTabs"];
11
+ export declare const AI_CHAT_HISTORY_UI_EVENT_NAMES: readonly ["showConversationHistory", "removeConversation", "editConversationTitle", "setConversationPinned", "selectConversation", "startConversation"];
12
12
  export declare class AIChatHistoryUI extends ContextPlugin {
13
13
  /**
14
14
  * @inheritDoc
@@ -58,7 +58,6 @@ export declare class AIChatHistoryUI extends ContextPlugin {
58
58
  * Hides the error message in the history view.
59
59
  */
60
60
  hideError(): void;
61
- setIsMaximized(isMaximized: boolean): void;
62
61
  }
63
62
  export type AIChatHistoryItemData = {
64
63
  id: string;
@@ -105,7 +104,3 @@ export type AIChatHistoryUISetPinnedEvent = {
105
104
  }
106
105
  ];
107
106
  };
108
- export type AIChatHistoryUIOpenChatEvent = {
109
- name: 'openChat';
110
- args: [];
111
- };
@@ -16,6 +16,7 @@ interface AIChatHistoryListItemViewConfig {
16
16
  declare const AIChatHistoryListItemView_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof ListItemView, import("@ckeditor/ckeditor5-collaboration-core").ConfirmApi>;
17
17
  export declare class AIChatHistoryListItemView extends /* #__PURE__ -- @preserve */ AIChatHistoryListItemView_base {
18
18
  id: string;
19
+ title: string;
19
20
  isVisible: boolean;
20
21
  pinned: boolean;
21
22
  isEdit: boolean;
@@ -6,19 +6,11 @@
6
6
  * @module ai/aichathistory/ui/aichathistoryview
7
7
  */
8
8
  import { type Locale } from '@ckeditor/ckeditor5-utils';
9
- import { View, ButtonView } from '@ckeditor/ckeditor5-ui';
9
+ import { View } from '@ckeditor/ckeditor5-ui';
10
+ import { AIHeaderView } from '../../aicore/ui/aiheaderview.js';
10
11
  import { type AIChatHistoryCategoryData } from '../aichathistoryui.js';
11
12
  export declare class AIChatHistoryView extends View {
12
- /**
13
- * The button to resize the chat view.
14
- */
15
- readonly resizeButton?: ButtonView;
16
- /**
17
- * Indicates whether the tabs view is maximized.
18
- *
19
- * @observable
20
- */
21
- isMaximized: boolean;
13
+ headerView: AIHeaderView;
22
14
  hasItems: boolean;
23
15
  isLoading: boolean;
24
16
  errorMessage: string;
@@ -138,6 +138,14 @@ export interface AIContainerBase {
138
138
  * Whether the AI interface should be visible when the editor is created.
139
139
  */
140
140
  visibleByDefault?: boolean;
141
+ /**
142
+ * When `true`, clicking the active tab button collapses the panel and toggles the
143
+ * `ck-ai-tabs_collapsed` CSS class on the AI tabs DOM element. Clicking the tab again expands
144
+ * it back. When `false`, clicking the active tab button is a no-op.
145
+ *
146
+ * Defaults to `false`.
147
+ */
148
+ collapsible?: boolean;
141
149
  }
142
150
  /**
143
151
  * The configuration of the AI user interface container in the sidebar mode. Provide an existing DOM
@@ -63,6 +63,16 @@ export declare class AIConnector extends ContextPlugin {
63
63
  * Gets a document from the AI API for a specific conversation.
64
64
  */
65
65
  uploadDocument(conversationId: string, content: string, attributes?: Record<string, unknown>): AIUploadRequest;
66
+ /**
67
+ * Uploads multiple documents to the AI API for a specific conversation in a single batch request.
68
+ *
69
+ * The endpoint returns an array of replies in the same order as the input documents.
70
+ */
71
+ uploadDocuments(conversationId: string, documents: Array<AIUploadDocumentData>): AIBatchUploadRequest;
72
+ /**
73
+ * Fetches multiple documents by their IDs from a conversation in a single batch request.
74
+ */
75
+ fetchDocuments(conversationId: string, documentIds: Array<string>): AIBatchFetchDocumentsRequest;
66
76
  /**
67
77
  * Fetches the list of conversations from the AI API.
68
78
  */
@@ -183,6 +193,7 @@ export type AIMessageEventModificationDelta = {
183
193
  data: {
184
194
  id: string;
185
195
  textDelta: string;
196
+ documentId: string;
186
197
  };
187
198
  };
188
199
  export type AIMessageEventMcpToolNotification = {
@@ -234,6 +245,25 @@ export type AIFetchDocumentReply = {
234
245
  version: number;
235
246
  sessionId: string | null;
236
247
  };
248
+ name?: string;
249
+ description?: string;
250
+ };
251
+ export type AIUploadDocumentData = {
252
+ content: string | undefined;
253
+ version: number;
254
+ sessionId: string | null;
255
+ selections: Array<{
256
+ start: number;
257
+ end: number;
258
+ htmlFragment: string;
259
+ }>;
260
+ name?: string;
261
+ description?: string;
262
+ };
263
+ export type AIBatchFetchDocumentsReply = Array<AIFetchDocumentReply>;
264
+ export type AIBatchFetchDocumentsRequest = {
265
+ getDocuments: () => Promise<AIBatchFetchDocumentsReply>;
266
+ abortController: AbortController;
237
267
  };
238
268
  export type AIFetchDocumentRequest = {
239
269
  getDocument: () => Promise<AIFetchDocumentReply>;
@@ -246,6 +276,13 @@ export type AIUploadRequest = {
246
276
  getId: () => Promise<AIUploadReply>;
247
277
  abortController: AbortController;
248
278
  };
279
+ export type AIBatchUploadReply = Array<{
280
+ id: string;
281
+ }>;
282
+ export type AIBatchUploadRequest = {
283
+ getIds: () => Promise<AIBatchUploadReply>;
284
+ abortController: AbortController;
285
+ };
249
286
  export type AIConversationItem = {
250
287
  id: string;
251
288
  title: string;
@@ -31,19 +31,12 @@ export declare class AIEditing extends ContextPlugin {
31
31
  */
32
32
  get sessionId(): string;
33
33
  /**
34
- * Returns the data and version of the current document.
34
+ * Returns the data and version of each document (one entry per editor root, excluding `$graveyard`).
35
+ *
36
+ * `editor` and `rootName` identify the source of each entry so callers can remap AI modifications back to the editor and root
37
+ * they came from.
35
38
  */
36
- getDocumentData(): Promise<{
37
- content: string;
38
- version: number;
39
- sessionId: string;
40
- selections: Array<{
41
- markerName: string;
42
- start: number;
43
- end: number;
44
- htmlFragment: string;
45
- }>;
46
- }>;
39
+ getDocumentData(): Promise<Array<AIEditingDocumentData>>;
47
40
  afterInit(): Promise<void>;
48
41
  /**
49
42
  * Displays a fake visual selection on given ranges.
@@ -61,6 +54,26 @@ export declare class AIEditing extends ContextPlugin {
61
54
  hideFakeVisualSelection(id: string): void;
62
55
  modelToDataWithIds(modelFragment: ModelDocumentFragment): Promise<string>;
63
56
  }
57
+ /**
58
+ * A single document entry returned by {@link module:ai/aicore/aiediting~AIEditing#getDocumentData `AIEditing#getDocumentData()`}. One
59
+ * entry per editor model root (excluding `$graveyard`); `editor` + `rootName` identify the source root so callers can route AI
60
+ * modifications back to the correct place.
61
+ */
62
+ export type AIEditingDocumentData = {
63
+ editor: Editor;
64
+ rootName: string;
65
+ content: string;
66
+ version: number;
67
+ sessionId: string;
68
+ selections: Array<{
69
+ markerName: string;
70
+ start: number;
71
+ end: number;
72
+ htmlFragment: string;
73
+ }>;
74
+ name?: string;
75
+ description?: string;
76
+ };
64
77
  type FakeSelectionData = {
65
78
  /**
66
79
  * Ranges on which fake selection should be shown.
@@ -6,6 +6,24 @@
6
6
  * @module ai/aicore/model/aicontext
7
7
  * @publicApi
8
8
  */
9
+ import type { Editor } from '@ckeditor/ckeditor5-core';
10
+ /**
11
+ * Locates a `data-id` from AI chat document HTML in a specific editor model root (multi-editor / multi-root contexts).
12
+ */
13
+ export type AIDataIdDocumentSource = {
14
+ editor: Editor;
15
+ rootName: string;
16
+ };
17
+ /**
18
+ * One concatenation segment of the AI chat document HTML (single editor model root). The post-AI portion of the merged document that
19
+ * belongs to this slice is recovered by routing each top-level child via `AIReply#dataIdDocumentSources`, not by index.
20
+ */
21
+ export type AIDocumentContextSlice = {
22
+ editor: Editor;
23
+ rootName: string;
24
+ html: string;
25
+ version: number;
26
+ };
9
27
  /**
10
28
  * The type of context item.
11
29
  *