@ckeditor/ckeditor5-ai 48.1.0-alpha.4 → 48.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aichat/aichatcontroller.d.ts +1 -1
- package/dist/aichat/model/aichatcontext.d.ts +7 -58
- package/dist/aichat/model/aichatconversation.d.ts +6 -20
- package/dist/aicore/aiconnector.d.ts +4 -0
- package/dist/aicore/aiediting.d.ts +2 -1
- package/dist/index.js +6 -6
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/package.json +12 -12
|
@@ -162,7 +162,7 @@ export declare class AIChatController extends ContextPlugin {
|
|
|
162
162
|
* Returns the ID under which conversations are grouped. All created conversations will have this `groupId` set. Conversation history
|
|
163
163
|
* will fetch conversations with such `groupId`.
|
|
164
164
|
*
|
|
165
|
-
*
|
|
165
|
+
* This is equal to the channelId passed in context/editor configuration.
|
|
166
166
|
*/
|
|
167
167
|
getGroupId(): string;
|
|
168
168
|
/**
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { type Editor } from '@ckeditor/ckeditor5-core';
|
|
10
10
|
import { type AIConnector, type AIUserMessage } from '../../aicore/aiconnector.js';
|
|
11
|
-
import { type AIEditingDocumentData } from '../../aicore/aiediting.js';
|
|
12
11
|
import { type AIContextItemType, type AIContextTextResourceType, type AIContextItem, type AIContextItemRequestData, type AIDocumentContextSlice, type AIToolContextItem } from '../../aicore/model/aicontext.js';
|
|
13
12
|
export declare const AI_CONTEXT_MODEL_EVENT_NAMES: readonly ["contextItemAdded", "contextItemRemoved", "contextItemLoadingEnded", "contextSent", "error", "addContextOptionsChanged", "sourceResourcesLoaded", "resourceStateChanged", "uploadProgressChanged"];
|
|
14
13
|
declare const AIChatContext_base: {
|
|
@@ -34,14 +33,6 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
|
|
|
34
33
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
35
34
|
*/
|
|
36
35
|
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
36
|
/**
|
|
46
37
|
* Returns the source (editor / root / content / documentId) that a `data-id` in an AI response belongs to.
|
|
47
38
|
*
|
|
@@ -55,15 +46,8 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
|
|
|
55
46
|
}) | undefined;
|
|
56
47
|
/**
|
|
57
48
|
* Returns an `AIDocumentContextSlice` describing the position and bounds of a single uploaded document inside the concatenated
|
|
58
|
-
* reply context
|
|
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.
|
|
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.
|
|
67
51
|
*
|
|
68
52
|
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
69
53
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
@@ -85,27 +69,6 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
|
|
|
85
69
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
86
70
|
*/
|
|
87
71
|
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
|
-
}>;
|
|
109
72
|
/**
|
|
110
73
|
* Creates a context item from conversation content.
|
|
111
74
|
*/
|
|
@@ -206,25 +169,11 @@ export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
|
|
|
206
169
|
* @param version Version number of the document for change tracking
|
|
207
170
|
* @returns Promise that resolves when the document is updated
|
|
208
171
|
*/
|
|
209
|
-
updateCurrentDocument(content: string | undefined, version: number, sessionId: string | null, selections: Array<{
|
|
172
|
+
updateCurrentDocument(content: string | undefined, version: number, sessionId: string | null, channelId: string, rootName: string, selections: Array<{
|
|
210
173
|
start: number;
|
|
211
174
|
end: number;
|
|
212
175
|
htmlFragment: string;
|
|
213
176
|
}>): 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>;
|
|
228
177
|
/**
|
|
229
178
|
* @experimental **Experimental:** This is a production-ready API but may change in minor releases
|
|
230
179
|
* without the standard deprecation policy. Check the changelog for migration guidance.
|
|
@@ -312,13 +261,13 @@ export type AIChatContextDocumentSource = {
|
|
|
312
261
|
content: string;
|
|
313
262
|
version: number;
|
|
314
263
|
/**
|
|
315
|
-
* The `
|
|
316
|
-
* conversation from history.
|
|
264
|
+
* The document's stored `name` — the source root's identifier as reported when the document was uploaded.
|
|
317
265
|
*/
|
|
318
266
|
name?: string;
|
|
319
267
|
/**
|
|
320
|
-
* The `description
|
|
321
|
-
*
|
|
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").
|
|
322
271
|
*/
|
|
323
272
|
description?: string;
|
|
324
273
|
};
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
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
|
|
11
|
-
import { type
|
|
12
|
-
import { type AIToolContextItem, type AIContextItem, type AIDocumentContextSlice } from '../../aicore/model/aicontext.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';
|
|
13
12
|
import { AICapabilities, type AICapabilitiesConfig } from '../../aicore/model/aicapabilities.js';
|
|
14
13
|
import type { AIModels } from '../../aicore/model/aimodels.js';
|
|
15
14
|
import { type Editor } from '@ckeditor/ckeditor5-core';
|
|
@@ -124,33 +123,20 @@ export declare class AIChatConversation extends /* #__PURE__ */ AIChatConversati
|
|
|
124
123
|
*/
|
|
125
124
|
addCurrentDocumentToContext(label: string): void;
|
|
126
125
|
/**
|
|
127
|
-
* Updates the current document in the context to contain the
|
|
126
|
+
* Updates the current document in the context to contain the necessary data.
|
|
128
127
|
*/
|
|
129
|
-
updateCurrentDocumentInContext({ content, version, sessionId, selections }: {
|
|
128
|
+
updateCurrentDocumentInContext({ content, version, sessionId, channelId, rootName, selections }: {
|
|
130
129
|
content: string | undefined;
|
|
131
130
|
version: number;
|
|
132
131
|
sessionId: string | null;
|
|
132
|
+
channelId: string;
|
|
133
|
+
rootName: string;
|
|
133
134
|
selections: Array<{
|
|
134
135
|
start: number;
|
|
135
136
|
end: number;
|
|
136
137
|
htmlFragment: string;
|
|
137
138
|
}>;
|
|
138
139
|
}): 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;
|
|
154
140
|
/**
|
|
155
141
|
* Returns the content of the current interaction's document.
|
|
156
142
|
*/
|
|
@@ -244,6 +244,8 @@ export type AIFetchDocumentReply = {
|
|
|
244
244
|
attributes?: {
|
|
245
245
|
version: number;
|
|
246
246
|
sessionId: string | null;
|
|
247
|
+
channelId?: string;
|
|
248
|
+
rootName?: string;
|
|
247
249
|
};
|
|
248
250
|
name?: string;
|
|
249
251
|
description?: string;
|
|
@@ -252,6 +254,8 @@ export type AIUploadDocumentData = {
|
|
|
252
254
|
content: string | undefined;
|
|
253
255
|
version: number;
|
|
254
256
|
sessionId: string | null;
|
|
257
|
+
channelId: string;
|
|
258
|
+
rootName: string;
|
|
255
259
|
selections: Array<{
|
|
256
260
|
start: number;
|
|
257
261
|
end: number;
|
|
@@ -33,7 +33,7 @@ export declare class AIEditing extends ContextPlugin {
|
|
|
33
33
|
/**
|
|
34
34
|
* Returns the data and version of each document (one entry per editor root, excluding `$graveyard`).
|
|
35
35
|
*
|
|
36
|
-
* `
|
|
36
|
+
* `rootName` and `channelId` identify the source of each entry so callers can remap AI modifications back to the editor and root
|
|
37
37
|
* they came from.
|
|
38
38
|
*/
|
|
39
39
|
getDocumentData(): Promise<Array<AIEditingDocumentData>>;
|
|
@@ -65,6 +65,7 @@ export type AIEditingDocumentData = {
|
|
|
65
65
|
content: string;
|
|
66
66
|
version: number;
|
|
67
67
|
sessionId: string;
|
|
68
|
+
channelId: string;
|
|
68
69
|
selections: Array<{
|
|
69
70
|
markerName: string;
|
|
70
71
|
start: number;
|