@ckeditor/ckeditor5-ai 48.1.1 → 48.2.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 (205) hide show
  1. package/dist/aiactions/model/aiactionsinteraction.d.ts +3 -0
  2. package/dist/aiactions/model/aiactionsreply.d.ts +7 -0
  3. package/dist/aiballoon/aiballoon.d.ts +2 -5
  4. package/dist/aichat/aichatballoon.d.ts +4 -0
  5. package/dist/aichat/aichatcontroller.d.ts +9 -3
  6. package/dist/aichat/aichatui.d.ts +11 -0
  7. package/dist/aichat/model/aichatcontext.d.ts +29 -62
  8. package/dist/aichat/model/aichatconversation.d.ts +18 -23
  9. package/dist/aichat/model/aichatinteraction.d.ts +0 -9
  10. package/dist/aichat/ui/aichatballoonview.d.ts +4 -0
  11. package/dist/aichat/ui/aichatcontrolsview.d.ts +5 -0
  12. package/dist/aichat/ui/aichatfeedview.d.ts +8 -0
  13. package/dist/aichat/ui/aichatview.d.ts +1 -0
  14. package/dist/aichat/ui/controls/aichatcontextpanelview.d.ts +4 -0
  15. package/dist/aichat/ui/controls/aichatdropzoneview.d.ts +26 -0
  16. package/dist/aichat/ui/controls/resources/aichatresourcesballoonview.d.ts +4 -0
  17. package/dist/aichat/utils/eventnames.d.ts +1 -1
  18. package/dist/aichat/utils/parsesingleurl.d.ts +5 -0
  19. package/dist/aichat/utils/readdatatransferfiles.d.ts +14 -0
  20. package/dist/aichat/utils/resolvepaste.d.ts +71 -0
  21. package/dist/aichatshortcuts/ui/aichatshortcutsview.d.ts +6 -0
  22. package/dist/aiconfig.d.ts +1 -1
  23. package/dist/aicore/aiconnector.d.ts +22 -0
  24. package/dist/aicore/aiediting.d.ts +14 -5
  25. package/dist/aicore/aigateway.d.ts +63 -0
  26. package/dist/aicore/model/aicontext.d.ts +4 -20
  27. package/dist/aicore/model/aiinteraction.d.ts +7 -1
  28. package/dist/aicore/model/aireply.d.ts +20 -17
  29. package/dist/aicore/model/airunresult.d.ts +95 -0
  30. package/dist/aicore/pipeline/airesponseapplier.d.ts +3 -15
  31. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartheaderview.d.ts +4 -0
  32. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentparttoolbarview.d.ts +4 -0
  33. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartview.d.ts +4 -0
  34. package/dist/aicore/utils/{geteditorfromcontext.d.ts → geteditorsfromcontext.d.ts} +1 -2
  35. package/dist/aicore/utils/getoperationsfromreply.d.ts +6 -4
  36. package/dist/aicore/utils/getsuggestionpartsfromreply.d.ts +6 -3
  37. package/dist/aicore/utils/htmlparser.d.ts +8 -2
  38. package/dist/aiquickactions/aiquickactions.d.ts +4 -4
  39. package/dist/aiquickactions/aiquickactionsui.d.ts +1 -1
  40. package/dist/aiquickactions/ui/aiquickactionsdropdowncontentview.d.ts +2 -2
  41. package/dist/aireviewcore/aireviewcorecheckregistry.d.ts +34 -0
  42. package/dist/aireviewcore/aireviewcorecontroller.d.ts +31 -6
  43. package/dist/aireviewcore/aireviewcoreediting.d.ts +1 -1
  44. package/dist/aireviewcore/model/aireviewcheckrun.d.ts +4 -0
  45. package/dist/aireviewmode/aireviewgateway.d.ts +161 -0
  46. package/dist/aireviewmode/aireviewmode.d.ts +60 -2
  47. package/dist/aireviewmode/aireviewmodecheckregistry.d.ts +39 -0
  48. package/dist/aireviewmode/aireviewmodecontroller.d.ts +7 -2
  49. package/dist/aireviewmode/model/aireviewmodechecklist.d.ts +4 -0
  50. package/dist/aireviewmode/model/aireviewrunresult.d.ts +20 -0
  51. package/dist/aitranslate/aitranslatecheckregistry.d.ts +27 -0
  52. package/dist/aitranslate/aitranslatecontroller.d.ts +2 -2
  53. package/dist/augmentation.d.ts +11 -1
  54. package/dist/index-content.css +1 -1
  55. package/dist/index-editor.css +212 -8
  56. package/dist/index.css +212 -8
  57. package/dist/index.d.ts +7 -3
  58. package/dist/index.js +6 -6
  59. package/dist/translations/af.js +1 -1
  60. package/dist/translations/af.umd.js +1 -1
  61. package/dist/translations/ar.js +1 -1
  62. package/dist/translations/ar.umd.js +1 -1
  63. package/dist/translations/ast.js +1 -1
  64. package/dist/translations/ast.umd.js +1 -1
  65. package/dist/translations/az.js +1 -1
  66. package/dist/translations/az.umd.js +1 -1
  67. package/dist/translations/be.js +1 -1
  68. package/dist/translations/be.umd.js +1 -1
  69. package/dist/translations/bg.js +1 -1
  70. package/dist/translations/bg.umd.js +1 -1
  71. package/dist/translations/bn.js +1 -1
  72. package/dist/translations/bn.umd.js +1 -1
  73. package/dist/translations/bs.js +1 -1
  74. package/dist/translations/bs.umd.js +1 -1
  75. package/dist/translations/ca.js +1 -1
  76. package/dist/translations/ca.umd.js +1 -1
  77. package/dist/translations/cs.js +1 -1
  78. package/dist/translations/cs.umd.js +1 -1
  79. package/dist/translations/da.js +1 -1
  80. package/dist/translations/da.umd.js +1 -1
  81. package/dist/translations/de-ch.js +1 -1
  82. package/dist/translations/de-ch.umd.js +1 -1
  83. package/dist/translations/de.js +1 -1
  84. package/dist/translations/de.umd.js +1 -1
  85. package/dist/translations/el.js +1 -1
  86. package/dist/translations/el.umd.js +1 -1
  87. package/dist/translations/en-au.js +1 -1
  88. package/dist/translations/en-au.umd.js +1 -1
  89. package/dist/translations/en-gb.js +1 -1
  90. package/dist/translations/en-gb.umd.js +1 -1
  91. package/dist/translations/en.js +1 -1
  92. package/dist/translations/en.umd.js +1 -1
  93. package/dist/translations/eo.js +1 -1
  94. package/dist/translations/eo.umd.js +1 -1
  95. package/dist/translations/es-co.js +1 -1
  96. package/dist/translations/es-co.umd.js +1 -1
  97. package/dist/translations/es.js +1 -1
  98. package/dist/translations/es.umd.js +1 -1
  99. package/dist/translations/et.js +1 -1
  100. package/dist/translations/et.umd.js +1 -1
  101. package/dist/translations/eu.js +1 -1
  102. package/dist/translations/eu.umd.js +1 -1
  103. package/dist/translations/fa.js +1 -1
  104. package/dist/translations/fa.umd.js +1 -1
  105. package/dist/translations/fi.js +1 -1
  106. package/dist/translations/fi.umd.js +1 -1
  107. package/dist/translations/fr.js +1 -1
  108. package/dist/translations/fr.umd.js +1 -1
  109. package/dist/translations/gl.js +1 -1
  110. package/dist/translations/gl.umd.js +1 -1
  111. package/dist/translations/gu.js +1 -1
  112. package/dist/translations/gu.umd.js +1 -1
  113. package/dist/translations/he.js +1 -1
  114. package/dist/translations/he.umd.js +1 -1
  115. package/dist/translations/hi.js +1 -1
  116. package/dist/translations/hi.umd.js +1 -1
  117. package/dist/translations/hr.js +1 -1
  118. package/dist/translations/hr.umd.js +1 -1
  119. package/dist/translations/hu.js +1 -1
  120. package/dist/translations/hu.umd.js +1 -1
  121. package/dist/translations/hy.js +1 -1
  122. package/dist/translations/hy.umd.js +1 -1
  123. package/dist/translations/id.js +1 -1
  124. package/dist/translations/id.umd.js +1 -1
  125. package/dist/translations/it.js +1 -1
  126. package/dist/translations/it.umd.js +1 -1
  127. package/dist/translations/ja.js +1 -1
  128. package/dist/translations/ja.umd.js +1 -1
  129. package/dist/translations/jv.js +1 -1
  130. package/dist/translations/jv.umd.js +1 -1
  131. package/dist/translations/kk.js +1 -1
  132. package/dist/translations/kk.umd.js +1 -1
  133. package/dist/translations/km.js +1 -1
  134. package/dist/translations/km.umd.js +1 -1
  135. package/dist/translations/kn.js +1 -1
  136. package/dist/translations/kn.umd.js +1 -1
  137. package/dist/translations/ko.js +1 -1
  138. package/dist/translations/ko.umd.js +1 -1
  139. package/dist/translations/ku.js +1 -1
  140. package/dist/translations/ku.umd.js +1 -1
  141. package/dist/translations/lt.js +1 -1
  142. package/dist/translations/lt.umd.js +1 -1
  143. package/dist/translations/lv.js +1 -1
  144. package/dist/translations/lv.umd.js +1 -1
  145. package/dist/translations/ms.js +1 -1
  146. package/dist/translations/ms.umd.js +1 -1
  147. package/dist/translations/nb.js +1 -1
  148. package/dist/translations/nb.umd.js +1 -1
  149. package/dist/translations/ne.js +1 -1
  150. package/dist/translations/ne.umd.js +1 -1
  151. package/dist/translations/nl.js +1 -1
  152. package/dist/translations/nl.umd.js +1 -1
  153. package/dist/translations/no.js +1 -1
  154. package/dist/translations/no.umd.js +1 -1
  155. package/dist/translations/oc.js +1 -1
  156. package/dist/translations/oc.umd.js +1 -1
  157. package/dist/translations/pl.js +1 -1
  158. package/dist/translations/pl.umd.js +1 -1
  159. package/dist/translations/pt-br.js +1 -1
  160. package/dist/translations/pt-br.umd.js +1 -1
  161. package/dist/translations/pt.js +1 -1
  162. package/dist/translations/pt.umd.js +1 -1
  163. package/dist/translations/ro.js +1 -1
  164. package/dist/translations/ro.umd.js +1 -1
  165. package/dist/translations/ru.js +1 -1
  166. package/dist/translations/ru.umd.js +1 -1
  167. package/dist/translations/si.js +1 -1
  168. package/dist/translations/si.umd.js +1 -1
  169. package/dist/translations/sk.js +1 -1
  170. package/dist/translations/sk.umd.js +1 -1
  171. package/dist/translations/sl.js +1 -1
  172. package/dist/translations/sl.umd.js +1 -1
  173. package/dist/translations/sq.js +1 -1
  174. package/dist/translations/sq.umd.js +1 -1
  175. package/dist/translations/sr-latn.js +1 -1
  176. package/dist/translations/sr-latn.umd.js +1 -1
  177. package/dist/translations/sr.js +1 -1
  178. package/dist/translations/sr.umd.js +1 -1
  179. package/dist/translations/sv.js +1 -1
  180. package/dist/translations/sv.umd.js +1 -1
  181. package/dist/translations/th.js +1 -1
  182. package/dist/translations/th.umd.js +1 -1
  183. package/dist/translations/ti.js +1 -1
  184. package/dist/translations/ti.umd.js +1 -1
  185. package/dist/translations/tk.js +1 -1
  186. package/dist/translations/tk.umd.js +1 -1
  187. package/dist/translations/tr.js +1 -1
  188. package/dist/translations/tr.umd.js +1 -1
  189. package/dist/translations/tt.js +1 -1
  190. package/dist/translations/tt.umd.js +1 -1
  191. package/dist/translations/ug.js +1 -1
  192. package/dist/translations/ug.umd.js +1 -1
  193. package/dist/translations/uk.js +1 -1
  194. package/dist/translations/uk.umd.js +1 -1
  195. package/dist/translations/ur.js +1 -1
  196. package/dist/translations/ur.umd.js +1 -1
  197. package/dist/translations/uz.js +1 -1
  198. package/dist/translations/uz.umd.js +1 -1
  199. package/dist/translations/vi.js +1 -1
  200. package/dist/translations/vi.umd.js +1 -1
  201. package/dist/translations/zh-cn.js +1 -1
  202. package/dist/translations/zh-cn.umd.js +1 -1
  203. package/dist/translations/zh.js +1 -1
  204. package/dist/translations/zh.umd.js +1 -1
  205. package/package.json +12 -12
@@ -9,6 +9,7 @@ import { AIInteraction, type AIInteractionOptions } from '../../aicore/model/aii
9
9
  import { type AIConnectorRequest } from '../../aicore/aiconnector.js';
10
10
  import { type AIActionsNames, type AIActionDefinition } from '../aiactions.js';
11
11
  import { type AIContextItem } from '../../aicore/model/aicontext.js';
12
+ import type { Editor } from '@ckeditor/ckeditor5-core';
12
13
  import { AIActionsReply } from './aiactionsreply.js';
13
14
  export declare class AIActionsInteraction extends AIInteraction {
14
15
  /**
@@ -53,4 +54,6 @@ export declare class AIActionsInteraction extends AIInteraction {
53
54
  export type AIActionsInteractionOptions = {
54
55
  content: string;
55
56
  version: number;
57
+ editor: Editor;
58
+ rootName: string;
56
59
  } & AIActionDefinition & AIInteractionOptions;
@@ -12,5 +12,12 @@ import { AIReply, type AIReplyChangeGroup } from '../../aicore/model/aireply.js'
12
12
  * where suggestions are presented as single change groups without context merging.
13
13
  */
14
14
  export declare class AIActionsReply extends AIReply {
15
+ /**
16
+ * Routes incoming modification-delta content to the single synthetic document that AI Actions wires up in
17
+ * {@link module:ai/aiactions/model/aiactionsinteraction~AIActionsInteraction#createReply `createReply`}. The
18
+ * server does not stamp `documentId` on AI Actions streams (it's a single-editor flow with no routing key on
19
+ * the wire), so the default `'text'` would land in the wrong bucket and the modification pipeline would skip it.
20
+ */
21
+ appendContent(content: string, documentId?: string): void;
15
22
  protected _getDifferentChangeGroups(oldGroups: Array<AIReplyChangeGroup>, newGroups: Array<AIReplyChangeGroup>): Array<AIReplyChangeGroup>;
16
23
  }
@@ -27,12 +27,9 @@ export interface AIBalloonConfig {
27
27
  ranges: Array<ModelRange>;
28
28
  class: string;
29
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.
30
+ * The editor the balloon should anchor to.
34
31
  */
35
- targetEditor?: Editor;
32
+ targetEditor: Editor;
36
33
  }
37
34
  /**
38
35
  * The AI Balloon plugin provides a balloon dialog interface for displaying and interacting with AI suggestions.
@@ -59,6 +59,10 @@ export declare class AIChatBalloon extends Plugin {
59
59
  abortSignal?: AbortSignal;
60
60
  keepErrors?: boolean;
61
61
  }): Promise<void>;
62
+ /**
63
+ * Clears the content of the suggestion part displayed in the balloon.
64
+ */
65
+ clearContent(): void;
62
66
  /**
63
67
  * Sets the state of the suggestion part displayed in the balloon (accepted, rejected, pending, etc.).
64
68
  */
@@ -6,7 +6,7 @@
6
6
  * @module ai/aichat/aichatcontroller
7
7
  * @publicApi
8
8
  */
9
- import { ContextPlugin } from '@ckeditor/ckeditor5-core';
9
+ import { ContextPlugin, Editor } from '@ckeditor/ckeditor5-core';
10
10
  import { AIConnector } from '../aicore/aiconnector.js';
11
11
  import { AIChatConversation, type AIChatInteractionCreatedEvent } from './model/aichatconversation.js';
12
12
  import { type AIInteractionReplyCreatedEvent, type AIToolData } from '../aicore/model/aiinteraction.js';
@@ -26,6 +26,12 @@ export declare class AIChatController extends ContextPlugin {
26
26
  * Active conversation (currently open and visible in UI).
27
27
  */
28
28
  activeConversation?: AIChatConversation;
29
+ /**
30
+ * Whether the chat controller has finished its initialization (models loaded, conversation started).
31
+ *
32
+ * @observable
33
+ */
34
+ isConversationReady: boolean;
29
35
  /**
30
36
  * @inheritDoc
31
37
  */
@@ -49,7 +55,7 @@ export declare class AIChatController extends ContextPlugin {
49
55
  /**
50
56
  * @inheritDoc
51
57
  */
52
- afterInit(): Promise<void>;
58
+ afterInit(): void;
53
59
  /**
54
60
  * @inheritDoc
55
61
  */
@@ -130,7 +136,7 @@ export declare class AIChatController extends ContextPlugin {
130
136
  * @experimental **Experimental:** This is a production-ready API but may change in minor releases
131
137
  * without the standard deprecation policy. Check the changelog for migration guidance.
132
138
  */
133
- addSelectionToChatContext(): Promise<void>;
139
+ addSelectionToChatContext(editor: Editor): Promise<void>;
134
140
  /**
135
141
  * Removes current document selection from the conversation context.
136
142
  *
@@ -11,6 +11,7 @@ import { type AIAddContextOptionsState, type AIContextProvider, type AIContextRe
11
11
  import { type AIContextItem } from '../aicore/model/aicontext.js';
12
12
  import { type Document } from '../aicore/utils/htmlparser.js';
13
13
  import { type AICapabilitiesConfig } from '../aicore/model/aicapabilities.js';
14
+ import { type AIChatInputPaste } from './utils/resolvepaste.js';
14
15
  import { type AIReply, type AIReplyChangeGroupState } from '../aicore/model/aireply.js';
15
16
  import { type AISuggestionContentPartDefinition } from '../aicore/utils/getsuggestionpartsfromreply.js';
16
17
  import { type AIChatConversationInitializedEvent } from './model/aichatconversation.js';
@@ -309,6 +310,16 @@ export type AIChatUIAddUrlToContextEvent = {
309
310
  string
310
311
  ];
311
312
  };
313
+ /**
314
+ * An event fired when the user pastes content into the prompt input. Carries a DOM-free
315
+ * payload that the controller classifies and dispatches.
316
+ */
317
+ export type AIChatUIPromptInputPasteEvent = {
318
+ name: 'promptInputPaste';
319
+ args: [
320
+ paste: AIChatInputPaste
321
+ ];
322
+ };
312
323
  /**
313
324
  * An event fired when the user wants to execute a custom item callback.
314
325
  */
@@ -2,13 +2,8 @@
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';
10
5
  import { type AIConnector, type AIUserMessage } from '../../aicore/aiconnector.js';
11
- import { type AIContextItemType, type AIContextTextResourceType, type AIContextItem, type AIContextItemRequestData, type AIDocumentContextSlice, type AIToolContextItem } from '../../aicore/model/aicontext.js';
6
+ import { type AIContextItemType, type AIContextTextResourceType, type AIContextItem, type AIContextItemRequestData, type AIToolContextItem } from '../../aicore/model/aicontext.js';
12
7
  export declare const AI_CONTEXT_MODEL_EVENT_NAMES: readonly ["contextItemAdded", "contextItemRemoved", "contextItemLoadingEnded", "contextSent", "error", "addContextOptionsChanged", "sourceResourcesLoaded", "resourceStateChanged", "uploadProgressChanged"];
13
8
  declare const AIChatContext_base: {
14
9
  new (): import("@ckeditor/ckeditor5-utils").Observable;
@@ -33,26 +28,6 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
33
28
  * without the standard deprecation policy. Check the changelog for migration guidance.
34
29
  */
35
30
  init(): void;
36
- /**
37
- * Returns the source (editor / root / content / documentId) that a `data-id` in an AI response belongs to.
38
- *
39
- * Relied on by the suggestion balloon flow when a single reply's change groups span multiple uploaded documents.
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
- getSourceByDataId(dataId: string | undefined): (AIChatContextDocumentSource & {
45
- documentId: string;
46
- }) | undefined;
47
- /**
48
- * Returns an `AIDocumentContextSlice` describing the position and bounds of a single uploaded document inside the concatenated
49
- * reply context, resolved via a `data-id` that appears in the uploaded documents. A convenience for AI response handling where
50
- * the server returns `data-id` references rather than internal document ids.
51
- *
52
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
53
- * without the standard deprecation policy. Check the changelog for migration guidance.
54
- */
55
- getDocumentContextSliceByDataId(dataId: string | undefined): AIDocumentContextSlice | undefined;
56
31
  /**
57
32
  * Returns the pending context items that will be sent to the AI endpoint in the next interaction.
58
33
  *
@@ -159,21 +134,6 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
159
134
  * @param label Display label for the current document
160
135
  */
161
136
  addCurrentDocumentToContext(label: string): void;
162
- /**
163
- * Updates the current document in the pending context with new content and version.
164
- * This method uploads the document content and updates the context item accordingly.
165
- *
166
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
167
- * without the standard deprecation policy. Check the changelog for migration guidance.
168
- * @param content The document content to upload, or undefined to skip
169
- * @param version Version number of the document for change tracking
170
- * @returns Promise that resolves when the document is updated
171
- */
172
- updateCurrentDocument(content: string | undefined, version: number, sessionId: string | null, channelId: string, rootName: string, selections: Array<{
173
- start: number;
174
- end: number;
175
- htmlFragment: string;
176
- }>): Promise<void>;
177
137
  /**
178
138
  * @experimental **Experimental:** This is a production-ready API but may change in minor releases
179
139
  * without the standard deprecation policy. Check the changelog for migration guidance.
@@ -248,29 +208,20 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
248
208
  * without the standard deprecation policy. Check the changelog for migration guidance.
249
209
  */
250
210
  addResourceToContext(source: AIContextProvider, resource: AIContextResource): Promise<void>;
251
- }
252
- /**
253
- * A uploaded-document source stored on the chat context, keyed by the id returned by the `/documents/batch` endpoint.
254
- *
255
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
256
- * without the standard deprecation policy. Check the changelog for migration guidance.
257
- */
258
- export type AIChatContextDocumentSource = {
259
- editor: Editor;
260
- rootName: string;
261
- content: string;
262
- version: number;
263
- /**
264
- * The document's stored `name` — the source root's identifier as reported when the document was uploaded.
265
- */
266
- name?: string;
267
211
  /**
268
- * The document's stored `description`, taken from the source root's
269
- * {@link module:core/editor/editorconfig~RootConfig root configuration}. The AI service uses descriptions to
270
- * semantically distinguish roots when a user scopes a request to a specific area (e.g. "edit the title").
212
+ * Toggles the visibility of the add current document option in the add context options.
213
+ *
214
+ * By default, the option is visible if the current document is not in the context or conversation.
215
+ *
216
+ * There's an option to force the visibility of the option by passing `true` or `false` to the method.
217
+ *
218
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
219
+ * without the standard deprecation policy. Check the changelog for migration guidance.
220
+ * @param isVisible Whether to force-show or force-hide the option.
221
+ * @default undefined
271
222
  */
272
- description?: string;
273
- };
223
+ toggleAddCurrentDocumentOptionVisibility(isVisible?: boolean): void;
224
+ }
274
225
  export type AIChatContextItemAddedEvent = {
275
226
  name: 'contextItemAdded';
276
227
  args: [
@@ -462,6 +413,22 @@ export type AIChatContextConfig = {
462
413
  * @default 7
463
414
  */
464
415
  searchInputVisibleFrom?: number;
416
+ /**
417
+ * Configures how paste interactions in the AI Chat input are handled.
418
+ */
419
+ paste?: AIChatContextPasteConfig;
420
+ };
421
+ /**
422
+ * Configuration for paste handling in the AI Chat input.
423
+ */
424
+ export type AIChatContextPasteConfig = {
425
+ /**
426
+ * Minimum length of the pasted plain text (in characters) that triggers conversion to a
427
+ * `.txt` context item. Pasted text shorter than this lands inline in the input as usual.
428
+ *
429
+ * @default 1500
430
+ */
431
+ textThreshold?: number;
465
432
  };
466
433
  /**
467
434
  * The configuration of a custom option in the AI Chat menu for adding external resources to the prompt context.
@@ -84,11 +84,16 @@ export declare class AIChatConversation extends /* #__PURE__ */ AIChatConversati
84
84
  /**
85
85
  * Loads a conversation from the backend using the provided conversation ID.
86
86
  */
87
- load(conversationId: string, sessionId: string): Promise<AIChatConversation>;
87
+ load(conversationId: string): Promise<AIChatConversation>;
88
88
  /**
89
89
  * Processes messages to create interactions and replies.
90
90
  */
91
91
  private _processMessagesToInteractions;
92
+ /**
93
+ * Resumes an in-progress stream for a message that was still streaming when the conversation was loaded.
94
+ * Runs in the background - events propagate through the normal event system.
95
+ */
96
+ private _resumeStream;
92
97
  /**
93
98
  * Handles a user interaction by creating a new interaction and starting it.
94
99
  */
@@ -99,12 +104,13 @@ export declare class AIChatConversation extends /* #__PURE__ */ AIChatConversati
99
104
  /**
100
105
  * Creates a new interaction and stores it in the conversation.
101
106
  */
102
- createInteraction({ userMessage, contextItems, capabilities, modelId, attributes }: {
107
+ createInteraction({ userMessage, contextItems, capabilities, modelId, attributes, channelsToEditors }: {
103
108
  userMessage: string;
104
109
  contextItems: Map<string, AIContextItem>;
105
110
  capabilities: AICapabilitiesConfig;
106
111
  modelId: string;
107
112
  attributes?: Record<string, unknown>;
113
+ channelsToEditors: Map<string, Editor>;
108
114
  }): AIChatInteraction;
109
115
  /**
110
116
  * Gets an interaction in the conversation by its ID.
@@ -119,28 +125,14 @@ export declare class AIChatConversation extends /* #__PURE__ */ AIChatConversati
119
125
  */
120
126
  get lastInteraction(): AIChatInteraction | undefined;
121
127
  /**
122
- * Adds a current document to the context.
128
+ * Cancels the reply stream of the {@link #lastInteraction last interaction}.
129
+ * No-op when the last interaction has no `messageId` yet.
123
130
  */
124
- addCurrentDocumentToContext(label: string): void;
125
- /**
126
- * Updates the current document in the context to contain the necessary data.
127
- */
128
- updateCurrentDocumentInContext({ content, version, sessionId, channelId, rootName, selections }: {
129
- content: string | undefined;
130
- version: number;
131
- sessionId: string | null;
132
- channelId: string;
133
- rootName: string;
134
- selections: Array<{
135
- start: number;
136
- end: number;
137
- htmlFragment: string;
138
- }>;
139
- }): Promise<void>;
131
+ cancelLastInteractionStream(): void;
140
132
  /**
141
- * Returns the content of the current interaction's document.
133
+ * Adds a current document to the context.
142
134
  */
143
- getCurrentDocumentContext(): string;
135
+ addCurrentDocumentToContext(label: string): void;
144
136
  /**
145
137
  * Adds a selection to the context.
146
138
  */
@@ -277,8 +269,6 @@ export type AIChatConversationModelSelectedEvent = {
277
269
  export type AIChatConversationOptions = {
278
270
  connector: AIConnector;
279
271
  chatModels: AIModels;
280
- getEditor?: () => Editor;
281
- getEditors?: () => Array<Editor>;
282
272
  /**
283
273
  * Locale forwarded to {@link module:ai/aichat/model/aichatinteraction~AIChatInteraction interactions} (and through them to
284
274
  * replies) for translating internal user-facing strings — see {@link module:ai/aicore/model/aiinteraction~AIInteractionOptions}.
@@ -288,5 +278,10 @@ export type AIChatConversationOptions = {
288
278
  group: string;
289
279
  selectedModelId?: string;
290
280
  isFromHistory: boolean;
281
+ /**
282
+ * Returns the session id of the given editor. Used by the conversation when detecting whether a stored
283
+ * AI chat reply was created during the current editing session of its source editor.
284
+ */
285
+ getSessionId: (editor: Editor) => string;
291
286
  };
292
287
  export {};
@@ -9,7 +9,6 @@
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';
13
12
  export declare class AIChatInteraction extends AIInteraction {
14
13
  /**
15
14
  * The user message that was sent to the AI endpoint.
@@ -36,14 +35,6 @@ export declare class AIChatInteraction extends AIInteraction {
36
35
  */
37
36
  readonly attributes?: Record<string, unknown>;
38
37
  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;
47
38
  }
48
39
  export type AIChatInteractionOptions = {
49
40
  conversationId: string;
@@ -75,6 +75,10 @@ export declare class AIChatBalloonView extends AIBalloonView {
75
75
  abortSignal?: AbortSignal;
76
76
  keepErrors?: boolean;
77
77
  }): Promise<void>;
78
+ /**
79
+ * Clears the content of the suggestion part displayed in the balloon.
80
+ */
81
+ clearContent(): void;
78
82
  /**
79
83
  * Sets the state of the suggestion part displayed in the balloon.
80
84
  */
@@ -41,7 +41,12 @@ export declare class AIChatControlsView extends View {
41
41
  constructor(locale: Locale, options: {
42
42
  bodyCollection: BodyCollection;
43
43
  contextResourcesSearchInputVisibleFrom?: number;
44
+ filesEnabled: boolean;
44
45
  });
46
+ /**
47
+ * @inheritDoc
48
+ */
49
+ render(): void;
45
50
  /**
46
51
  * Adds an item chip to the current context list.
47
52
  */
@@ -20,6 +20,14 @@ import { AIChatFeedCustomElementView } from './feed/aichatfeedcustomelementview.
20
20
  import { type AIReplyChangeGroupState } from '../../aicore/model/aireply.js';
21
21
  import { type AISource } from '../../aicore/aiconnector.js';
22
22
  import '../../../theme/aichat/aichatfeed.css';
23
+ import '../../../theme/aichat/aichatcontent/_base.css';
24
+ import '../../../theme/aichat/aichatcontent/_typography.css';
25
+ import '../../../theme/aichat/aichatcontent/_link.css';
26
+ import '../../../theme/aichat/aichatcontent/_code.css';
27
+ import '../../../theme/aichat/aichatcontent/_list.css';
28
+ import '../../../theme/aichat/aichatcontent/_table.css';
29
+ import '../../../theme/aichat/aichatcontent/_blockquote.css';
30
+ import '../../../theme/aichat/aichatcontent/_hr.css';
23
31
  /**
24
32
  * A view that displays the chat feed with various items.
25
33
  */
@@ -29,6 +29,7 @@ export declare class AIChatView extends View {
29
29
  constructor(locale: Locale, options: {
30
30
  showResizeButton: boolean;
31
31
  contextResourcesSearchInputVisibleFrom?: number;
32
+ filesEnabled: boolean;
32
33
  });
33
34
  /**
34
35
  * Populates a source resource balloon with loaded resources.
@@ -76,6 +76,10 @@ export declare class AIChatContextPanelView extends View {
76
76
  * Shows the URL balloon panel.
77
77
  */
78
78
  showUrlBalloonPanel(): void;
79
+ /**
80
+ * Closes every balloon owned by this view — add-context, URL form, and source resource balloons.
81
+ */
82
+ hideAllBalloons(): void;
79
83
  /**
80
84
  * Populates a source resource balloon with loaded resources.
81
85
  */
@@ -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/aichat/ui/controls/aichatdropzoneview
7
+ */
8
+ import { View } from '@ckeditor/ckeditor5-ui';
9
+ import { type Locale } from '@ckeditor/ckeditor5-utils';
10
+ /**
11
+ * Encapsulates the drop overlay and drag-and-drop listeners independently of the target
12
+ * element, which is supplied later via {@link #attach}. A drop fires `'promptInputPaste'`
13
+ * with an {@link AIChatInputPaste} payload, so the controller dispatches paste and drop
14
+ * through one listener.
15
+ */
16
+ export declare class AIChatDropZoneView extends View {
17
+ constructor(locale: Locale);
18
+ attach(target: HTMLElement): void;
19
+ }
20
+ /**
21
+ * Fired on `dragenter` over the drop target so the parent can dismiss open balloons.
22
+ */
23
+ export type AIChatDropZoneEnterEvent = {
24
+ name: 'dragEnter';
25
+ args: [];
26
+ };
@@ -85,6 +85,10 @@ export declare class AIChatResourcesBalloonView {
85
85
  * @param sourceId The unique identifier of the source balloon to close
86
86
  */
87
87
  closeSourceResourceBalloon(sourceId: string): void;
88
+ /**
89
+ * Closes every open source resource balloon.
90
+ */
91
+ closeAll(): void;
88
92
  /**
89
93
  * Checks if any resource balloon is currently visible.
90
94
  *
@@ -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", "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", "promptInputPaste", "abortPromptStream", "addDocumentToContext", "addFileToContext", "addUrlToContext", "executeCustomItemCallback", "addResourceToContext", "removeContextItem", "loadSourceResources", "toggleWebSearch", "toggleReasoning", "selectModel"];
@@ -0,0 +1,5 @@
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
+ export {};
@@ -0,0 +1,14 @@
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/aichat/utils/readdatatransferfiles
7
+ */
8
+ /**
9
+ * Detect directories — `dataTransfer.files` alone exposes them as zero-byte `File`s, so we probe `items` via `webkitGetAsEntry()`.
10
+ */
11
+ export declare function readDataTransferFiles(dataTransfer: DataTransfer): {
12
+ files: Array<File>;
13
+ hasDirectory: boolean;
14
+ };
@@ -0,0 +1,71 @@
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
+ * Domain payload built by the view layer from a `ClipboardEvent` or `DragEvent`. Keeps DOM
7
+ * types inside the view; downstream code sees only data.
8
+ */
9
+ export type AIChatInputPaste = {
10
+ files: ReadonlyArray<File>;
11
+ plainText: string;
12
+ /**
13
+ * `true` when the source `DataTransfer` carried at least one directory entry.
14
+ */
15
+ hasDirectory: boolean;
16
+ /**
17
+ * Bypasses {@link AIChatPasteOptions#longTextThreshold}: any non-empty text attaches.
18
+ * Used by drag-and-drop so dropped text isn't lost.
19
+ */
20
+ forceTextAttachment: boolean;
21
+ /**
22
+ * Suppresses the textarea's default paste behaviour. Called by the controller when it
23
+ * has fully handled the input (e.g. attached long pasted text as a file).
24
+ */
25
+ preventDefault: () => void;
26
+ };
27
+ type AIChatPasteOptions = {
28
+ /**
29
+ * Localized label for the long-text attachment, without extension (e.g. `Pasted Text`).
30
+ * Rendered as `<label>.txt` when the long-text branch fires.
31
+ */
32
+ pastedTextLabel: string;
33
+ /**
34
+ * Minimum plain-text length (in characters) to trigger the long-text branch.
35
+ */
36
+ longTextThreshold?: number;
37
+ /**
38
+ * Mirrors `ai.chat.context.files.enabled`. Gates the file, image, and long-text branches.
39
+ */
40
+ filesEnabled: boolean;
41
+ /**
42
+ * Mirrors `ai.chat.context.urls.enabled`. Gates the URL branch.
43
+ */
44
+ urlsEnabled: boolean;
45
+ };
46
+ /**
47
+ * Result returned by {@link resolvePaste}.
48
+ *
49
+ * Possible shapes:
50
+ * * `{ type: 'file', files }`: one or more files (multi-select clipboard paste).
51
+ * * `{ type: 'text', files }`: single-element array, serialized as text by the model.
52
+ * * `{ type: 'url', url }`: a URL to add to context.
53
+ *
54
+ * `null` means "no action" (plain text below threshold, no URL match, or files all unusable).
55
+ * The controller is responsible for suppressing the source event's default — `resolvePaste`
56
+ * itself is side-effect-free with respect to DOM events.
57
+ */
58
+ type AIChatPasteResult = {
59
+ type: 'file' | 'text';
60
+ files: Array<File>;
61
+ } | {
62
+ type: 'url';
63
+ url: string;
64
+ };
65
+ /**
66
+ * Runs the paste detection ladder, synthesizes the right `File`s (or extracts the URL), and
67
+ * returns the action the controller should dispatch, or `null` for "nothing to do". Pure with
68
+ * respect to DOM events — the controller decides whether to suppress the source default.
69
+ */
70
+ export declare function resolvePaste(paste: AIChatInputPaste, options: AIChatPasteOptions): AIChatPasteResult | null;
71
+ export {};
@@ -16,6 +16,12 @@ export declare class AIChatShortcutsView extends View {
16
16
  * The list view that displays the shortcuts.
17
17
  */
18
18
  listView: ListView;
19
+ /**
20
+ * Whether the shortcuts can be executed. When `false`, all shortcut buttons are disabled.
21
+ *
22
+ * @observable
23
+ */
24
+ isEnabled: boolean;
19
25
  /**
20
26
  * @inheritDoc
21
27
  */
@@ -82,7 +82,7 @@ export interface AIConfig {
82
82
  * ClassicEditor.create( {
83
83
  * ai: {
84
84
  * models: {
85
- * defaultModelId: 'gpt-5',
85
+ * defaultModelId: 'gpt-5.4',
86
86
  * displayedModels: [ 'gpt', 'claude' ],
87
87
  * showModelSelector: true
88
88
  * }
@@ -121,6 +121,22 @@ export declare class AIConnector extends ContextPlugin {
121
121
  * Deletes a web resource from a conversation.
122
122
  */
123
123
  deleteWebResource(conversationId: string, webResourceId: string): AIDeleteWebResourceRequest;
124
+ /**
125
+ * Cancels an in-progress assistant message stream via the v1.1 DELETE endpoint.
126
+ */
127
+ cancelStream(conversationId: string, messageId: string): AICancelStreamRequest;
128
+ /**
129
+ * Reconnects to a version 1.1 assistant reply stream and replays events after the last SSE event received
130
+ * by the client.
131
+ *
132
+ * If the reply was cancelled, replay includes any preserved reply events that were already produced, followed
133
+ * by the final error event that closes the stream.
134
+ *
135
+ * @param conversationId ID of the conversation that owns the message.
136
+ * @param messageId ID of the assistant message whose stream should be resumed.
137
+ * @param lastEventId Last SSE event ID received by the client. Use `0-0` to replay the stream from the beginning.
138
+ */
139
+ resumeStream(conversationId: string, messageId: string, lastEventId?: string): AIConnectorQueryAssistantRequest;
124
140
  /**
125
141
  * Sends a request to the AI API '/reviews/system/{reviewName}/calls' endpoint and returns a response stream reader.
126
142
  */
@@ -230,6 +246,10 @@ export type AIConnectorQueryAssistantRequest = {
230
246
  getStream: () => Promise<AIConnectorQueryAssistantReply>;
231
247
  abortController: AbortController;
232
248
  };
249
+ export type AICancelStreamRequest = {
250
+ execute: () => Promise<void>;
251
+ abortController: AbortController;
252
+ };
233
253
  export type AIConnectorQueryAssistantData = {
234
254
  message: string;
235
255
  conversationId: string;
@@ -354,9 +374,11 @@ export type AIAssistantMessage = {
354
374
  type: 'text' | 'modification' | 'mcp-tool-result';
355
375
  content: string;
356
376
  toolName?: string;
377
+ documentId?: string;
357
378
  } | AISource>;
358
379
  id: string;
359
380
  role: 'assistant';
381
+ status?: 'streaming' | 'completed' | 'cancelled' | 'error';
360
382
  };
361
383
  export type AIConversationMessage = AIUserMessage | AIAssistantMessage;
362
384
  export type AIGetConversationReply = {