@ckeditor/ckeditor5-ai 48.8.1-alpha.4 → 49.0.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 (388) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/aiactions/aiactions.d.ts +109 -73
  3. package/dist/aiactions/model/aiactionsinteraction.d.ts +58 -50
  4. package/dist/aiactions/model/aiactionsreply.d.ts +18 -11
  5. package/dist/aiassistant/adapters/aiadapter.d.ts +48 -48
  6. package/dist/aiassistant/adapters/aitextadapter.d.ts +133 -133
  7. package/dist/aiassistant/adapters/awstextadapter.d.ts +42 -42
  8. package/dist/aiassistant/adapters/openaitextadapter.d.ts +184 -184
  9. package/dist/aiassistant/aiassistant.d.ts +425 -436
  10. package/dist/aiassistant/aiassistantediting.d.ts +51 -51
  11. package/dist/aiassistant/aiassistantui.d.ts +50 -53
  12. package/dist/aiassistant/legacyerrors.d.ts +0 -4
  13. package/dist/aiassistant/ui/aiassistantcontroller.d.ts +106 -105
  14. package/dist/aiassistant/ui/form/aiformcontentarea.d.ts +43 -43
  15. package/dist/aiassistant/ui/form/aiformerrorview.d.ts +19 -19
  16. package/dist/aiassistant/ui/form/aiformpromptview.d.ts +38 -38
  17. package/dist/aiassistant/ui/form/aiformtoolbarview.d.ts +50 -50
  18. package/dist/aiassistant/ui/form/aiformview.d.ts +121 -121
  19. package/dist/aiassistant/ui/form/aihistorylistitemview.d.ts +13 -13
  20. package/dist/aiassistant/ui/form/aihistorylistview.d.ts +27 -27
  21. package/dist/aiassistant/ui/form/prompthistory.d.ts +15 -15
  22. package/dist/aiassistant/ui/showaiassistantcommand.d.ts +35 -35
  23. package/dist/aiassistant/utils/common-translations.d.ts +6 -6
  24. package/dist/aiassistant/utils/normalizecommandsconfig.d.ts +9 -9
  25. package/dist/aiballoon/aiballoon.d.ts +85 -89
  26. package/dist/aiballoon/ui/aiballoondisclaimerview.d.ts +17 -0
  27. package/dist/aiballoon/ui/aiballoontoolbarview.d.ts +56 -0
  28. package/dist/aiballoon/ui/aiballoonview.d.ts +74 -27
  29. package/dist/aiballoon/utils/contentwidth.d.ts +1 -0
  30. package/dist/aichat/aichat.d.ts +88 -87
  31. package/dist/aichat/aichatballoon.d.ts +88 -79
  32. package/dist/aichat/aichatcontroller.d.ts +284 -258
  33. package/dist/aichat/aichatui.d.ts +352 -328
  34. package/dist/aichat/model/aichatcontext.d.ts +655 -654
  35. package/dist/aichat/model/aichatconversation.d.ts +270 -269
  36. package/dist/aichat/model/aichatinteraction.d.ts +45 -49
  37. package/dist/aichat/ui/aichatballoonview.d.ts +73 -101
  38. package/dist/aichat/ui/aichatcontrolsview.d.ts +121 -125
  39. package/dist/aichat/ui/aichatfeedview.d.ts +145 -128
  40. package/dist/aichat/ui/aichatview.d.ts +42 -40
  41. package/dist/aichat/ui/controls/aichatchipsoverflowmanager.d.ts +73 -63
  42. package/dist/aichat/ui/controls/aichatcontextitembuttonview.d.ts +41 -41
  43. package/dist/aichat/ui/controls/aichatcontextpanelurlinputview.d.ts +79 -79
  44. package/dist/aichat/ui/controls/aichatcontextpanelview.d.ts +110 -100
  45. package/dist/aichat/ui/controls/aichatdropzoneview.d.ts +30 -0
  46. package/dist/aichat/ui/controls/aichatpromptcapabilitiesview.d.ts +72 -81
  47. package/dist/aichat/ui/controls/aichatpromptinputview.d.ts +50 -44
  48. package/dist/aichat/ui/controls/aichatpromptsuggestionslistview.d.ts +13 -13
  49. package/dist/aichat/ui/controls/resources/aichatcontextresourceslistview.d.ts +44 -44
  50. package/dist/aichat/ui/controls/resources/aichatcontextresourcesview.d.ts +52 -52
  51. package/dist/aichat/ui/controls/resources/aichatresourcelistitemview.d.ts +57 -56
  52. package/dist/aichat/ui/controls/resources/aichatresourcesballoonview.d.ts +104 -100
  53. package/dist/aichat/ui/controls/resources/aichatresourcessearchinputview.d.ts +53 -53
  54. package/dist/aichat/ui/feed/aichatfeedcontextchipsview.d.ts +22 -22
  55. package/dist/aichat/ui/feed/aichatfeedcustomelementview.d.ts +30 -34
  56. package/dist/aichat/ui/feed/aichatfeederroritemview.d.ts +30 -33
  57. package/dist/aichat/ui/feed/aichatfeedinteractionheaderview.d.ts +24 -24
  58. package/dist/aichat/ui/feed/aichatfeeditemview.d.ts +39 -39
  59. package/dist/aichat/ui/feed/aichatfeedreplyitemview.d.ts +40 -40
  60. package/dist/aichat/ui/feed/aichatfeedsuggestionitemactionsview.d.ts +62 -63
  61. package/dist/aichat/ui/feed/aichatfeedsuggestionitemview.d.ts +87 -82
  62. package/dist/aichat/ui/feed/aichatfeedusermessageitem.d.ts +33 -33
  63. package/dist/aichat/utils/eventnames.d.ts +8 -4
  64. package/dist/aichat/utils/parsesingleurl.d.ts +1 -0
  65. package/dist/aichat/utils/promisequeue.d.ts +26 -25
  66. package/dist/aichat/utils/readdatatransferfiles.d.ts +14 -0
  67. package/dist/aichat/utils/resolvepaste.d.ts +71 -0
  68. package/dist/aichathistory/aichathistory.d.ts +26 -26
  69. package/dist/aichathistory/aichathistorycontroller.d.ts +36 -35
  70. package/dist/aichathistory/aichathistoryui.d.ts +80 -89
  71. package/dist/aichathistory/model/aichathistoryconversations.d.ts +95 -102
  72. package/dist/aichathistory/model/aichathistoryitem.d.ts +52 -53
  73. package/dist/aichathistory/ui/aichathistorylistitemview.d.ts +41 -40
  74. package/dist/aichathistory/ui/aichathistorylistview.d.ts +28 -28
  75. package/dist/aichathistory/ui/aichathistorysectionlistview.d.ts +16 -16
  76. package/dist/aichathistory/ui/aichathistoryview.d.ts +33 -33
  77. package/dist/aichatshortcuts/aichatshortcuts.d.ts +295 -295
  78. package/dist/aichatshortcuts/ui/aichatshortcutsview.d.ts +24 -18
  79. package/dist/aichatshortcuts/ui/aichatshortcutview.d.ts +18 -18
  80. package/dist/aiconfig.d.ts +362 -227
  81. package/dist/aicore/aiconnector.d.ts +428 -334
  82. package/dist/aicore/aicore.d.ts +53 -0
  83. package/dist/aicore/aiediting.d.ts +103 -88
  84. package/dist/aicore/aierrorreporter.d.ts +101 -0
  85. package/dist/aicore/aigateway.d.ts +135 -0
  86. package/dist/aicore/errors/aicoreerror.d.ts +67 -0
  87. package/dist/aicore/errors/geterrorcode.d.ts +17 -0
  88. package/dist/aicore/errors/isaborterror.d.ts +12 -0
  89. package/dist/aicore/errors/normalizeerror.d.ts +23 -0
  90. package/dist/aicore/model/aicapabilities.d.ts +69 -53
  91. package/dist/aicore/model/aicontext.d.ts +116 -77
  92. package/dist/aicore/model/aicontextlibrary.d.ts +71 -0
  93. package/dist/aicore/model/aicontextref.d.ts +37 -0
  94. package/dist/aicore/model/aidefaultcontext.d.ts +83 -0
  95. package/dist/aicore/model/aieditorroot.d.ts +26 -0
  96. package/dist/aicore/model/aiinteraction.d.ts +162 -162
  97. package/dist/aicore/model/aimodels.d.ts +80 -76
  98. package/dist/aicore/model/aireply.d.ts +129 -121
  99. package/dist/aicore/model/airunresult.d.ts +43 -0
  100. package/dist/aicore/model/airunsinglerootresult.d.ts +104 -0
  101. package/dist/aicore/pipeline/airesponseapplier.d.ts +284 -296
  102. package/dist/aicore/pipeline/airesponseparser.d.ts +24 -23
  103. package/dist/aicore/ui/aidisclaimerview.d.ts +12 -13
  104. package/dist/aicore/ui/aidotsloader.d.ts +18 -0
  105. package/dist/aicore/ui/aiheaderview.d.ts +27 -28
  106. package/dist/aicore/ui/aimodelselectorview.d.ts +151 -0
  107. package/dist/aicore/ui/aiseparatorview.d.ts +25 -0
  108. package/dist/aicore/ui/aiskeleton.d.ts +43 -32
  109. package/dist/aicore/ui/aispinner.d.ts +10 -11
  110. package/dist/aicore/ui/suggestioncontainer/aiminitoolbarview.d.ts +55 -56
  111. package/dist/aicore/ui/suggestioncontainer/aisuggestionbodyview.d.ts +95 -80
  112. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontainerview.d.ts +45 -46
  113. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartheaderview.d.ts +67 -37
  114. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartstateview.d.ts +21 -31
  115. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentparttoolbarview.d.ts +46 -21
  116. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartview.d.ts +91 -58
  117. package/dist/aicore/ui/suggestioncontainer/aisuggestionheaderview.d.ts +26 -35
  118. package/dist/aicore/ui/suggestioncontainer/aisuggestionstreamablecontentview.d.ts +30 -27
  119. package/dist/aicore/ui/suggestioncontainer/aiwebsourcesview.d.ts +24 -24
  120. package/dist/aicore/utils/abortabletimeout.d.ts +11 -11
  121. package/dist/aicore/utils/aitabids.d.ts +11 -0
  122. package/dist/aicore/utils/builddocumentsuggestionsmap.d.ts +30 -0
  123. package/dist/aicore/utils/buttonclasses.d.ts +17 -8
  124. package/dist/aicore/utils/cleanupstreamingartifacts.d.ts +12 -0
  125. package/dist/aicore/utils/common-translations.d.ts +6 -6
  126. package/dist/aicore/utils/contentparttranslationkeys.d.ts +27 -0
  127. package/dist/aicore/utils/createresizebutton.d.ts +8 -9
  128. package/dist/aicore/utils/createstartconversationbutton.d.ts +7 -8
  129. package/dist/aicore/utils/documentposition.d.ts +37 -37
  130. package/dist/aicore/utils/documentrange.d.ts +41 -41
  131. package/dist/aicore/utils/eventnames.d.ts +5 -5
  132. package/dist/aicore/utils/geteditorconfig.d.ts +107 -0
  133. package/dist/aicore/utils/geteditorsfromcontext.d.ts +18 -0
  134. package/dist/aicore/utils/getmodeldisplaymode.d.ts +21 -0
  135. package/dist/aicore/utils/getoperationsfordocumentsuggestions.d.ts +20 -0
  136. package/dist/aicore/utils/getrootinfo.d.ts +45 -0
  137. package/dist/aicore/utils/getsuggestionpartsfromreply.d.ts +24 -18
  138. package/dist/aicore/utils/htmlparser.d.ts +23 -16
  139. package/dist/aicore/utils/htmlstreamer.d.ts +79 -79
  140. package/dist/aicore/utils/inlineroot.d.ts +1 -0
  141. package/dist/aicore/utils/istrackchangesenabled.d.ts +23 -0
  142. package/dist/aicore/utils/markoperationsasai.d.ts +21 -0
  143. package/dist/aicore/utils/replyactions.d.ts +13 -0
  144. package/dist/aicore/utils/scrollmanager.d.ts +24 -23
  145. package/dist/aicore/utils/showaitab.d.ts +1 -0
  146. package/dist/aidocumentprocessing/aidocumentprocessinggateway.d.ts +110 -0
  147. package/dist/aidocumentprocessing/model/aidocumentprocessingrunresult.d.ts +19 -0
  148. package/dist/aieditorintegration/aieditorintegration.d.ts +42 -32
  149. package/dist/aieditorintegration/aitogglebutton/aitogglebuttonui.d.ts +33 -34
  150. package/dist/aieditorintegration/aitogglebutton/toggleaicommand.d.ts +12 -12
  151. package/dist/aiquickactions/aiquickactions.d.ts +303 -252
  152. package/dist/aiquickactions/aiquickactionscommand.d.ts +10 -10
  153. package/dist/aiquickactions/aiquickactionsediting.d.ts +22 -22
  154. package/dist/aiquickactions/aiquickactionsui.d.ts +131 -124
  155. package/dist/aiquickactions/ui/aiquickactionsbuttoncreator.d.ts +57 -57
  156. package/dist/aiquickactions/ui/aiquickactionsdropdowncontentview.d.ts +45 -45
  157. package/dist/aiquickactions/ui/aiquickactionsdropdowncreator.d.ts +59 -59
  158. package/dist/aiquickactions/ui/aiquickactionsfilteredlistview.d.ts +0 -4
  159. package/dist/aiquickactions/ui/balloon/aiactionsballoonview.d.ts +73 -136
  160. package/dist/aiquickactions/ui/dropdownmenubuttonwithhighlightview.d.ts +24 -24
  161. package/dist/aireviewcore/aireviewcorecheckregistry.d.ts +37 -0
  162. package/dist/aireviewcore/aireviewcorecontroller.d.ts +48 -23
  163. package/dist/aireviewcore/aireviewcoreediting.d.ts +296 -224
  164. package/dist/aireviewcore/aireviewcoreui.d.ts +109 -85
  165. package/dist/aireviewcore/model/aichecksinglerootresult.d.ts +22 -0
  166. package/dist/aireviewcore/model/aireviewcheck.d.ts +49 -49
  167. package/dist/aireviewcore/model/aireviewchecklist.d.ts +29 -28
  168. package/dist/aireviewcore/model/aireviewcheckresult.d.ts +36 -35
  169. package/dist/aireviewcore/model/aireviewcheckresultchange.d.ts +62 -50
  170. package/dist/aireviewcore/model/aireviewcheckrun.d.ts +174 -147
  171. package/dist/aireviewcore/model/aireviewsystemcheckrun.d.ts +16 -16
  172. package/dist/aireviewcore/types.d.ts +30 -24
  173. package/dist/aireviewcore/ui/aireviewcoreabstractchecklistview.d.ts +50 -0
  174. package/dist/aireviewcore/ui/aireviewcorechecklistitemresultview.d.ts +53 -76
  175. package/dist/aireviewcore/ui/aireviewcorecompletereviewdropdown.d.ts +29 -0
  176. package/dist/aireviewcore/ui/aireviewcorecustomcheckview.d.ts +38 -56
  177. package/dist/aireviewcore/ui/aireviewcorefinishreviewbuttonview.d.ts +8 -9
  178. package/dist/aireviewcore/ui/aireviewcoregeneralerrorview.d.ts +20 -20
  179. package/dist/aireviewcore/ui/aireviewcorenavigationpanelview.d.ts +169 -0
  180. package/dist/aireviewcore/ui/aireviewcoreprogressbarview.d.ts +32 -0
  181. package/dist/aireviewcore/ui/aireviewcorepromptinputview.d.ts +25 -25
  182. package/dist/aireviewcore/ui/aireviewcorereviewchecklistview.d.ts +42 -23
  183. package/dist/aireviewcore/ui/aireviewcorereviewcommandlistitemview.d.ts +49 -39
  184. package/dist/aireviewcore/ui/aireviewcorereviewcompletedview.d.ts +13 -14
  185. package/dist/aireviewcore/ui/aireviewcoreuicheckresultsview.d.ts +114 -87
  186. package/dist/aireviewcore/ui/aireviewcoreview.d.ts +54 -50
  187. package/dist/aireviewcore/ui/changeevents.d.ts +49 -0
  188. package/dist/aireviewcore/ui/form/aireviewcoreformdropdown.d.ts +16 -16
  189. package/dist/aireviewcore/ui/form/aireviewcoreformmanager.d.ts +12 -12
  190. package/dist/aireviewcore/utils/openleaveconfirmationdialog.d.ts +21 -0
  191. package/dist/aireviewcore/utils/reviewcontentpart.d.ts +25 -0
  192. package/dist/aireviewmode/aireviewcheckdefinitions.d.ts +12 -12
  193. package/dist/aireviewmode/aireviewgateway.d.ts +172 -0
  194. package/dist/aireviewmode/aireviewmode.d.ts +260 -126
  195. package/dist/aireviewmode/aireviewmodecheckregistry.d.ts +46 -0
  196. package/dist/aireviewmode/aireviewmodecontroller.d.ts +24 -17
  197. package/dist/aireviewmode/aireviewmodeui.d.ts +17 -17
  198. package/dist/aireviewmode/model/aireviewcheckcustom.d.ts +16 -16
  199. package/dist/aireviewmode/model/aireviewcheckextra.d.ts +35 -30
  200. package/dist/aireviewmode/model/aireviewcustomcheckrun.d.ts +18 -17
  201. package/dist/aireviewmode/model/aireviewextracheckrun.d.ts +15 -15
  202. package/dist/aireviewmode/model/aireviewmodechecklist.d.ts +22 -18
  203. package/dist/aireviewmode/ui/aireviewmodecheckresultsview.d.ts +41 -0
  204. package/dist/aisdk/dataidassigner.d.ts +20 -0
  205. package/dist/aisdk/documentchanges.d.ts +165 -0
  206. package/dist/aisdk/documentchangesutils.d.ts +15 -0
  207. package/dist/aisdk/documentcompare.d.ts +171 -0
  208. package/dist/aisdk/documentcompareutils.d.ts +16 -0
  209. package/dist/aisdk/documentsnapshot.d.ts +48 -0
  210. package/dist/aisdk/extractselectionfromhtml.d.ts +27 -0
  211. package/dist/aisdk/validateoperations.d.ts +43 -0
  212. package/dist/aitabs/aitabs.d.ts +104 -84
  213. package/dist/aitabs/aitabsmainview.d.ts +70 -46
  214. package/dist/aitabs/tabs/aitabsview.d.ts +191 -188
  215. package/dist/aitranslate/aitranslate.d.ts +165 -129
  216. package/dist/aitranslate/aitranslatecheckregistry.d.ts +27 -0
  217. package/dist/aitranslate/aitranslatecontroller.d.ts +18 -15
  218. package/dist/aitranslate/aitranslategateway.d.ts +89 -0
  219. package/dist/aitranslate/aitranslateui.d.ts +17 -18
  220. package/dist/aitranslate/model/aitranslatecheck.d.ts +12 -12
  221. package/dist/aitranslate/model/aitranslatechecklist.d.ts +11 -11
  222. package/dist/aitranslate/model/aitranslatecheckrun.d.ts +24 -23
  223. package/dist/aitranslate/ui/aitranslatechecklistview.d.ts +28 -7
  224. package/dist/aitranslate/ui/aitranslatecheckresultsview.d.ts +11 -11
  225. package/dist/augmentation.d.ts +79 -63
  226. package/dist/errors.d.ts +0 -4
  227. package/dist/errorsmap.d.ts +5 -5
  228. package/dist/index-content.css +0 -96
  229. package/dist/index-editor.css +3948 -3291
  230. package/dist/index.css +3959 -3307
  231. package/dist/index.d.ts +83 -59
  232. package/dist/index.js +19 -6
  233. package/dist/translations/af.js +1 -1
  234. package/dist/translations/af.umd.js +1 -1
  235. package/dist/translations/ar.js +1 -1
  236. package/dist/translations/ar.umd.js +1 -1
  237. package/dist/translations/ast.js +1 -1
  238. package/dist/translations/ast.umd.js +1 -1
  239. package/dist/translations/az.js +1 -1
  240. package/dist/translations/az.umd.js +1 -1
  241. package/dist/translations/be.js +1 -1
  242. package/dist/translations/be.umd.js +1 -1
  243. package/dist/translations/bg.js +1 -1
  244. package/dist/translations/bg.umd.js +1 -1
  245. package/dist/translations/bn.js +1 -1
  246. package/dist/translations/bn.umd.js +1 -1
  247. package/dist/translations/bs.js +1 -1
  248. package/dist/translations/bs.umd.js +1 -1
  249. package/dist/translations/ca.js +1 -1
  250. package/dist/translations/ca.umd.js +1 -1
  251. package/dist/translations/cs.js +1 -1
  252. package/dist/translations/cs.umd.js +1 -1
  253. package/dist/translations/da.js +1 -1
  254. package/dist/translations/da.umd.js +1 -1
  255. package/dist/translations/de-ch.js +1 -1
  256. package/dist/translations/de-ch.umd.js +1 -1
  257. package/dist/translations/de.js +1 -1
  258. package/dist/translations/de.umd.js +1 -1
  259. package/dist/translations/el.js +1 -1
  260. package/dist/translations/el.umd.js +1 -1
  261. package/dist/translations/en-au.js +1 -1
  262. package/dist/translations/en-au.umd.js +1 -1
  263. package/dist/translations/en-gb.js +1 -1
  264. package/dist/translations/en-gb.umd.js +1 -1
  265. package/dist/translations/en.js +1 -1
  266. package/dist/translations/en.umd.js +1 -1
  267. package/dist/translations/eo.js +1 -1
  268. package/dist/translations/eo.umd.js +1 -1
  269. package/dist/translations/es-co.js +1 -1
  270. package/dist/translations/es-co.umd.js +1 -1
  271. package/dist/translations/es.js +1 -1
  272. package/dist/translations/es.umd.js +1 -1
  273. package/dist/translations/et.js +1 -1
  274. package/dist/translations/et.umd.js +1 -1
  275. package/dist/translations/eu.js +1 -1
  276. package/dist/translations/eu.umd.js +1 -1
  277. package/dist/translations/fa.js +1 -1
  278. package/dist/translations/fa.umd.js +1 -1
  279. package/dist/translations/fi.js +1 -1
  280. package/dist/translations/fi.umd.js +1 -1
  281. package/dist/translations/fr.js +1 -1
  282. package/dist/translations/fr.umd.js +1 -1
  283. package/dist/translations/gl.js +1 -1
  284. package/dist/translations/gl.umd.js +1 -1
  285. package/dist/translations/gu.js +1 -1
  286. package/dist/translations/gu.umd.js +1 -1
  287. package/dist/translations/he.js +1 -1
  288. package/dist/translations/he.umd.js +1 -1
  289. package/dist/translations/hi.js +1 -1
  290. package/dist/translations/hi.umd.js +1 -1
  291. package/dist/translations/hr.js +1 -1
  292. package/dist/translations/hr.umd.js +1 -1
  293. package/dist/translations/hu.js +1 -1
  294. package/dist/translations/hu.umd.js +1 -1
  295. package/dist/translations/hy.js +1 -1
  296. package/dist/translations/hy.umd.js +1 -1
  297. package/dist/translations/id.js +1 -1
  298. package/dist/translations/id.umd.js +1 -1
  299. package/dist/translations/it.js +1 -1
  300. package/dist/translations/it.umd.js +1 -1
  301. package/dist/translations/ja.js +1 -1
  302. package/dist/translations/ja.umd.js +1 -1
  303. package/dist/translations/jv.js +1 -1
  304. package/dist/translations/jv.umd.js +1 -1
  305. package/dist/translations/kk.js +1 -1
  306. package/dist/translations/kk.umd.js +1 -1
  307. package/dist/translations/km.js +1 -1
  308. package/dist/translations/km.umd.js +1 -1
  309. package/dist/translations/kn.js +1 -1
  310. package/dist/translations/kn.umd.js +1 -1
  311. package/dist/translations/ko.js +1 -1
  312. package/dist/translations/ko.umd.js +1 -1
  313. package/dist/translations/ku.js +1 -1
  314. package/dist/translations/ku.umd.js +1 -1
  315. package/dist/translations/lt.js +1 -1
  316. package/dist/translations/lt.umd.js +1 -1
  317. package/dist/translations/lv.js +1 -1
  318. package/dist/translations/lv.umd.js +1 -1
  319. package/dist/translations/ms.js +1 -1
  320. package/dist/translations/ms.umd.js +1 -1
  321. package/dist/translations/nb.js +1 -1
  322. package/dist/translations/nb.umd.js +1 -1
  323. package/dist/translations/ne.js +1 -1
  324. package/dist/translations/ne.umd.js +1 -1
  325. package/dist/translations/nl.js +1 -1
  326. package/dist/translations/nl.umd.js +1 -1
  327. package/dist/translations/no.js +1 -1
  328. package/dist/translations/no.umd.js +1 -1
  329. package/dist/translations/oc.js +1 -1
  330. package/dist/translations/oc.umd.js +1 -1
  331. package/dist/translations/pl.js +1 -1
  332. package/dist/translations/pl.umd.js +1 -1
  333. package/dist/translations/pt-br.js +1 -1
  334. package/dist/translations/pt-br.umd.js +1 -1
  335. package/dist/translations/pt.js +1 -1
  336. package/dist/translations/pt.umd.js +1 -1
  337. package/dist/translations/ro.js +1 -1
  338. package/dist/translations/ro.umd.js +1 -1
  339. package/dist/translations/ru.js +1 -1
  340. package/dist/translations/ru.umd.js +1 -1
  341. package/dist/translations/si.js +1 -1
  342. package/dist/translations/si.umd.js +1 -1
  343. package/dist/translations/sk.js +1 -1
  344. package/dist/translations/sk.umd.js +1 -1
  345. package/dist/translations/sl.js +1 -1
  346. package/dist/translations/sl.umd.js +1 -1
  347. package/dist/translations/sq.js +1 -1
  348. package/dist/translations/sq.umd.js +1 -1
  349. package/dist/translations/sr-latn.js +1 -1
  350. package/dist/translations/sr-latn.umd.js +1 -1
  351. package/dist/translations/sr.js +1 -1
  352. package/dist/translations/sr.umd.js +1 -1
  353. package/dist/translations/sv.js +1 -1
  354. package/dist/translations/sv.umd.js +1 -1
  355. package/dist/translations/th.js +1 -1
  356. package/dist/translations/th.umd.js +1 -1
  357. package/dist/translations/ti.js +1 -1
  358. package/dist/translations/ti.umd.js +1 -1
  359. package/dist/translations/tk.js +1 -1
  360. package/dist/translations/tk.umd.js +1 -1
  361. package/dist/translations/tr.js +1 -1
  362. package/dist/translations/tr.umd.js +1 -1
  363. package/dist/translations/tt.js +1 -1
  364. package/dist/translations/tt.umd.js +1 -1
  365. package/dist/translations/ug.js +1 -1
  366. package/dist/translations/ug.umd.js +1 -1
  367. package/dist/translations/uk.js +1 -1
  368. package/dist/translations/uk.umd.js +1 -1
  369. package/dist/translations/ur.js +1 -1
  370. package/dist/translations/ur.umd.js +1 -1
  371. package/dist/translations/uz.js +1 -1
  372. package/dist/translations/uz.umd.js +1 -1
  373. package/dist/translations/vi.js +1 -1
  374. package/dist/translations/vi.umd.js +1 -1
  375. package/dist/translations/zh-cn.js +1 -1
  376. package/dist/translations/zh-cn.umd.js +1 -1
  377. package/dist/translations/zh.js +1 -1
  378. package/dist/translations/zh.umd.js +1 -1
  379. package/package.json +32 -13
  380. package/dist/aichat/ui/controls/aichatcontrolsloaderview.d.ts +0 -12
  381. package/dist/aicore/ui/suggestioncontainer/aisuggestionloaderview.d.ts +0 -16
  382. package/dist/aicore/utils/geteditorfromcontext.d.ts +0 -19
  383. package/dist/aicore/utils/getoperationsfromreply.d.ts +0 -24
  384. package/dist/aiquickactions/ui/balloon/aiactionsballoondisclaimerview.d.ts +0 -17
  385. package/dist/aiquickactions/ui/balloon/aiactionsballoontoolbarview.d.ts +0 -37
  386. package/dist/aireviewcore/ui/aireviewcoreballoonsuggestionview.d.ts +0 -38
  387. package/dist/aitabs/tabs/tabbuttonview.d.ts +0 -47
  388. package/dist/aitabs/tabs/tabpanelview.d.ts +0 -44
@@ -1,691 +1,692 @@
1
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
- */
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
5
  /**
6
- * @module ai/aichat/model/aichatcontext
7
- * @publicApi
8
- */
9
- import { type Editor } from '@ckeditor/ckeditor5-core';
10
- 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
+ * @module ai/aichat/model/aichatcontext
7
+ * @publicApi
8
+ */
9
+ import { type Editor } from "@ckeditor/ckeditor5-core";
10
+ import { type AIConnector, type AIUserMessage } from "../../aicore/aiconnector.js";
11
+ import { AIContext, type AIContextItemType, type AIContextTextResourceType, type AIContextItem, type AIContextItemRequestData, type AIToolContextItem } from "../../aicore/model/aicontext.js";
12
12
  export declare const AI_CONTEXT_MODEL_EVENT_NAMES: readonly ["contextItemAdded", "contextItemRemoved", "contextItemLoadingEnded", "contextSent", "error", "addContextOptionsChanged", "sourceResourcesLoaded", "resourceStateChanged", "uploadProgressChanged"];
13
- declare const AIChatContext_base: {
14
- new (): import("@ckeditor/ckeditor5-utils").Observable;
15
- prototype: import("@ckeditor/ckeditor5-utils").Observable;
16
- };
17
13
  /**
18
- * Manages the context of the current conversation.
19
- *
20
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
21
- * without the standard deprecation policy. Check the changelog for migration guidance.
22
- */
23
- export declare class AIChatContext extends /* #__PURE__ */ AIChatContext_base {
24
- constructor({ connector, config, ownerId }: {
25
- connector: AIConnector;
26
- config?: AIChatContextConfig;
27
- ownerId: string;
28
- });
29
- /**
30
- * Initializes the context.
31
- *
32
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
33
- * without the standard deprecation policy. Check the changelog for migration guidance.
34
- */
35
- 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
- /**
57
- * Returns the pending context items that will be sent to the AI endpoint in the next interaction.
58
- *
59
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
60
- * without the standard deprecation policy. Check the changelog for migration guidance.
61
- * @returns Map of pending context items keyed by their uiId
62
- */
63
- getPendingContextItems(): Map<string, AIContextItem>;
64
- /**
65
- * Populates context items from message data.
66
- * This method converts user message content to context items and adds them to the conversation context.
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
- populateFromMessage(content: AIUserMessage['content'][0]): Promise<AIContextItem>;
72
- /**
73
- * Creates a context item from conversation content.
74
- */
75
- private _createContextItemFromContent;
76
- /**
77
- * Returns all context items that have been sent to the AI endpoint in the current conversation.
78
- *
79
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
80
- * without the standard deprecation policy. Check the changelog for migration guidance.
81
- * @returns Map of sent context items keyed by their uiId
82
- */
83
- getSentContextItems(): Map<string, AIContextItem>;
84
- /**
85
- * Removes a context item from the pending context.
86
- * Read-only items cannot be removed and the method returns early.
87
- *
88
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
89
- * without the standard deprecation policy. Check the changelog for migration guidance.
90
- * @param uiId The unique identifier of the context item to remove
91
- */
92
- removeFromContext(uiId: string): void;
93
- /**
94
- * Clears all pending context items and adds the current document to the conversation context if it exists.
95
- *
96
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
97
- * without the standard deprecation policy. Check the changelog for migration guidance.
98
- */
99
- clearPendingContextItems(): void;
100
- /**
101
- * Adds context items to the conversation context and clears the pending context items.
102
- *
103
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
104
- * without the standard deprecation policy. Check the changelog for migration guidance.
105
- */
106
- addToConversationContext(contextItems: Map<string, AIContextItem>): void;
107
- /**
108
- * Checks if the current document is in the pending context.
109
- *
110
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
111
- * without the standard deprecation policy. Check the changelog for migration guidance.
112
- * @returns True if the current document is in pending context, false otherwise
113
- */
114
- isCurrentDocumentInContext(): boolean;
115
- /**
116
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
117
- * without the standard deprecation policy. Check the changelog for migration guidance.
118
- */
119
- isSelectionInContext(): boolean;
120
- /**
121
- * Checks if the current document is in the conversation context.
122
- *
123
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
124
- * without the standard deprecation policy. Check the changelog for migration guidance.
125
- * @returns True if the current document is in conversation context, false otherwise
126
- */
127
- isCurrentDocumentInConversation(): boolean;
128
- /**
129
- * Converts context items to request data format for API endpoint.
130
- * This static method transforms the internal context item format to the format expected by the AI connector.
131
- *
132
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
133
- * without the standard deprecation policy. Check the changelog for migration guidance.
134
- * @param contextItems Map of context items to convert
135
- * @returns Array of context items in API request format
136
- */
137
- static mapContextItemsToRequestData(contextItems: Map<string, AIContextItem>): Array<AIContextItemRequestData>;
138
- /**
139
- * Adds files to the context by uploading them and creating context items.
140
- * This method handles multiple files concurrently and tracks upload progress.
141
- *
142
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
143
- * without the standard deprecation policy. Check the changelog for migration guidance.
144
- * @param files Array of File objects to upload and add to context
145
- * @param [attributes] Optional attributes object containing resourceId and label for tracking purposes and context chips
146
- * @param [type] Context item type, defaults to 'file' to indicate that the file is being added as a file or text
147
- * @returns Promise that resolves when all files are processed
148
- */
149
- addFilesToContext(files: Array<File>, attributes?: {
150
- resourceId: string;
151
- label: string;
152
- }, type?: 'file' | 'text'): Promise<void>;
153
- /**
154
- * Adds the current document to the pending context.
155
- * If the document is already in context, this method returns early without changes.
156
- *
157
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
158
- * without the standard deprecation policy. Check the changelog for migration guidance.
159
- * @param label Display label for the current document
160
- */
161
- 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
- /**
178
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
179
- * without the standard deprecation policy. Check the changelog for migration guidance.
180
- */
181
- addSelectionToContext(selection: string): void;
182
- /**
183
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
184
- * without the standard deprecation policy. Check the changelog for migration guidance.
185
- */
186
- removeSelectionFromContext(): void;
187
- /**
188
- * Adds a URL to the context by uploading it and creating a context item.
189
- * This method handles URL upload with proper error handling and progress tracking.
190
- *
191
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
192
- * without the standard deprecation policy. Check the changelog for migration guidance.
193
- * @param url The URL to upload and add to context
194
- * @param [attributes] Optional attributes object containing resourceId and label for tracking purposes and context chips
195
- * @returns Promise that resolves when the URL is processed
196
- */
197
- addUrlToContext(url: string, attributes?: {
198
- resourceId: string;
199
- label: string;
200
- }): Promise<void>;
201
- /**
202
- * Adds an AI tool context item to the pending context items.
203
- *
204
- * Note, that these context items are ignored by the CKEditor AI agent and should be handled by your backend AI tool.
205
- *
206
- * The object which is passed as a parameter can contain the following properties:
207
- * ```ts
208
- * {
209
- * // Must be set to `'mcp-tool-context'`.
210
- * type: 'mcp-tool-context',
211
- *
212
- * // The name of the MCP server.
213
- * mcpServerName: string;
214
- *
215
- * // The data for the tool. Can be anything.
216
- * data: Record<string, any>;
217
- *
218
- * // The label of the item used to display it in the chat UI.
219
- * label: string;
220
- *
221
- * // Optional, 1-21 characters. Auto-generated if omitted.
222
- * id?: string;
223
- *
224
- * // The name of the tool. Omit to send context to all tools on the server.
225
- * toolName?: string;
226
- * }
227
- * ```
228
- *
229
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
230
- * without the standard deprecation policy. Check the changelog for migration guidance.
231
- */
232
- addToolItemToContext(contextItem: AIToolContextItem): void;
233
- /**
234
- * Loads resources for a given source provider with the specified query.
235
- * This method calls the source's {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources}
236
- * callback and updates resource states.
237
- *
238
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
239
- * without the standard deprecation policy. Check the changelog for migration guidance.
240
- * @param sourceId The unique identifier of the source provider
241
- * @param query Search query to filter resources
242
- * @param uid Unique identifier for the request to prevent race conditions
243
- * @returns Promise resolving to array of resources with context state
244
- */
245
- loadSourceResources(sourceId: string, query: string, uid: string): Promise<Array<AIContextResourceState>>;
246
- /**
247
- * @experimental **Experimental:** This is a production-ready API but may change in minor releases
248
- * without the standard deprecation policy. Check the changelog for migration guidance.
249
- */
250
- addResourceToContext(source: AIContextProvider, resource: AIContextResource): Promise<void>;
14
+ * Manages the context of the current conversation.
15
+ *
16
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
17
+ * without the standard deprecation policy. Check the changelog for migration guidance.
18
+ */
19
+ export declare class AIChatContext extends AIContext {
20
+ constructor({ connector, config, ownerId }: {
21
+ connector: AIConnector;
22
+ config?: AIChatContextConfig;
23
+ ownerId: string;
24
+ });
25
+ /**
26
+ * Initializes the context.
27
+ *
28
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
29
+ * without the standard deprecation policy. Check the changelog for migration guidance.
30
+ */
31
+ init(): void;
32
+ /**
33
+ * Returns the pending context items that will be sent to the AI endpoint in the next interaction.
34
+ *
35
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
36
+ * without the standard deprecation policy. Check the changelog for migration guidance.
37
+ * @returns Map of pending context items keyed by their uiId
38
+ */
39
+ getPendingContextItems(): ReadonlyMap<string, AIContextItem>;
40
+ /**
41
+ * Populates context items from a historical user message. Documents are batch-loaded and assembled into a single
42
+ * `current-document` context item whose `documents` array carries per-root metadata used downstream
43
+ * (notably by `AIReply`) to route modifications back to the source editor and root; non-document content items
44
+ * are turned into one context item each.
45
+ *
46
+ * The context references carried by the message are restored as pending items, so they keep being attached to
47
+ * every following message the way they were before the conversation was read back from history.
48
+ *
49
+ * Returns the assembled context items together with `unmatchedDocumentIds` — the IDs of documents that could
50
+ * not be matched to a live editor root via `attributes.channelId` (compared against the editor's
51
+ * `collaboration.channelId` config) and `attributes.rootName`. Callers resolve a per-document outdated reason
52
+ * from these IDs so suggestions from unmatched roots render as outdated while their matched siblings stay
53
+ * actionable.
54
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
55
+ * without the standard deprecation policy. Check the changelog for migration guidance.
56
+ */
57
+ populateFromMessage(messageContents: AIUserMessage["content"], editors: ReadonlyArray<Editor>, defaultContextIds?: Set<string>): Promise<{
58
+ contextItems: Map<string, AIContextItem>;
59
+ hasUnmatched: boolean;
60
+ unmatchedDocumentIds: Set<string>;
61
+ }>;
62
+ /**
63
+ * Creates a context item from a single non-document conversation content entry. Document content items are
64
+ * handled separately by {@link #_populateDocumentContextItem} because they need batch loading and per-root
65
+ * matching.
66
+ */
67
+ private _createContextItemFromContent;
68
+ /**
69
+ * Returns all context items that have been sent to the AI endpoint in the current conversation.
70
+ *
71
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
72
+ * without the standard deprecation policy. Check the changelog for migration guidance.
73
+ * @returns Map of sent context items keyed by their uiId
74
+ */
75
+ getSentContextItems(): ReadonlyMap<string, AIContextItem>;
76
+ /**
77
+ * Removes a context item from the pending context.
78
+ * Read-only items cannot be removed and the method returns early.
79
+ *
80
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
81
+ * without the standard deprecation policy. Check the changelog for migration guidance.
82
+ * @param uiId The unique identifier of the context item to remove
83
+ */
84
+ removeFromContext(uiId: string): void;
85
+ /**
86
+ * Clears all pending context items, then re-adds the current document and the context references
87
+ * (`type: 'context'`) as read-only and hidden pending items, so that they are sent with the following messages.
88
+ * A context reference that is already read-only and hidden is left untouched.
89
+ *
90
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
91
+ * without the standard deprecation policy. Check the changelog for migration guidance.
92
+ */
93
+ clearPendingContextItems(): void;
94
+ /**
95
+ * Adds context items to the conversation context and clears the pending context items.
96
+ *
97
+ * A context reference never becomes a conversation item. It stays pending for as long as it is attached, which is
98
+ * what keeps it sent with every message and reported as being in context, so a second record of it could only go
99
+ * stale once it stops being attached.
100
+ *
101
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
102
+ * without the standard deprecation policy. Check the changelog for migration guidance.
103
+ */
104
+ addToConversationContext(contextItems: Map<string, AIContextItem>): void;
105
+ /**
106
+ * Checks if the current document is in the pending context.
107
+ *
108
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
109
+ * without the standard deprecation policy. Check the changelog for migration guidance.
110
+ * @returns True if the current document is in pending context, false otherwise
111
+ */
112
+ isCurrentDocumentInContext(): boolean;
113
+ /**
114
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
115
+ * without the standard deprecation policy. Check the changelog for migration guidance.
116
+ */
117
+ isSelectionInContext(): boolean;
118
+ /**
119
+ * Checks if the current document is in the conversation context.
120
+ *
121
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
122
+ * without the standard deprecation policy. Check the changelog for migration guidance.
123
+ * @returns True if the current document is in conversation context, false otherwise
124
+ */
125
+ isCurrentDocumentInConversation(): boolean;
126
+ /**
127
+ * Converts context items to request data format for API endpoint.
128
+ * This static method transforms the internal context item format to the format expected by the AI connector.
129
+ *
130
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
131
+ * without the standard deprecation policy. Check the changelog for migration guidance.
132
+ * @param contextItems Map of context items to convert
133
+ * @returns Array of context items in API request format
134
+ */
135
+ static mapContextItemsToRequestData(contextItems: Map<string, AIContextItem>): Array<AIContextItemRequestData>;
136
+ /**
137
+ * Adds files to the context by uploading them and creating context items.
138
+ * This method handles multiple files concurrently and tracks upload progress.
139
+ *
140
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
141
+ * without the standard deprecation policy. Check the changelog for migration guidance.
142
+ * @param files Array of File objects to upload and add to context
143
+ * @param [attributes] Optional attributes object containing resourceId and label for tracking purposes and context chips
144
+ * @param [type] Context item type, defaults to 'file' to indicate that the file is being added as a file or text
145
+ * @returns Promise that resolves when all files are processed
146
+ */
147
+ addFilesToContext(files: Array<File>, attributes?: {
148
+ resourceId: string;
149
+ label: string;
150
+ }, type?: "file" | "text"): Promise<void>;
151
+ /**
152
+ * Adds the current document to the pending context.
153
+ * If the document is already in context, this method returns early without changes.
154
+ *
155
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
156
+ * without the standard deprecation policy. Check the changelog for migration guidance.
157
+ * @param label Display label for the current document
158
+ */
159
+ addCurrentDocumentToContext(label: string): void;
160
+ /**
161
+ * Returns context item for current document context, or undefined if the document context is not added.
162
+ */
163
+ getCurrentDocumentContext(): AIContextItem | undefined;
164
+ /**
165
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
166
+ * without the standard deprecation policy. Check the changelog for migration guidance.
167
+ */
168
+ addSelectionToContext(selection: string): void;
169
+ /**
170
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
171
+ * without the standard deprecation policy. Check the changelog for migration guidance.
172
+ */
173
+ removeSelectionFromContext(): void;
174
+ /**
175
+ * Adds a reference to an admin-managed context from the Context Library to the pending context items.
176
+ *
177
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
178
+ * without the standard deprecation policy. Check the changelog for migration guidance.
179
+ * @param libraryContextId The identifier of the context to attach.
180
+ * @param [label] The label displayed on the context chip. Defaults to `libraryContextId`.
181
+ */
182
+ addLibraryContextToContext(libraryContextId: string, label?: string): void;
183
+ /**
184
+ * Adds a URL to the context by uploading it and creating a context item.
185
+ * This method handles URL upload with proper error handling and progress tracking.
186
+ *
187
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
188
+ * without the standard deprecation policy. Check the changelog for migration guidance.
189
+ * @param url The URL to upload and add to context
190
+ * @param [attributes] Optional attributes object containing resourceId and label for tracking purposes and context chips
191
+ * @returns Promise that resolves when the URL is processed
192
+ */
193
+ addUrlToContext(url: string, attributes?: {
194
+ resourceId: string;
195
+ label: string;
196
+ }): Promise<void>;
197
+ /**
198
+ * Adds an AI tool context item to the pending context items.
199
+ *
200
+ * Note, that these context items are ignored by the CKEditor AI agent and should be handled by your backend AI tool.
201
+ *
202
+ * The object which is passed as a parameter can contain the following properties:
203
+ * ```ts
204
+ * {
205
+ * // Must be set to `'mcp-tool-context'`.
206
+ * type: 'mcp-tool-context',
207
+ *
208
+ * // The name of the MCP server.
209
+ * mcpServerName: string;
210
+ *
211
+ * // The data for the tool. Can be anything.
212
+ * data: Record<string, any>;
213
+ *
214
+ * // The label of the item used to display it in the chat UI.
215
+ * label: string;
216
+ *
217
+ * // Optional, 1-21 characters. Auto-generated if omitted.
218
+ * id?: string;
219
+ *
220
+ * // The name of the tool. Omit to send context to all tools on the server.
221
+ * toolName?: string;
222
+ * }
223
+ * ```
224
+ *
225
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
226
+ * without the standard deprecation policy. Check the changelog for migration guidance.
227
+ */
228
+ addToolItemToContext(contextItem: AIToolContextItem): void;
229
+ /**
230
+ * Loads resources for a given source provider with the specified query.
231
+ * This method calls the source's {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources}
232
+ * callback and updates resource states.
233
+ *
234
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
235
+ * without the standard deprecation policy. Check the changelog for migration guidance.
236
+ * @param sourceId The unique identifier of the source provider
237
+ * @param query Search query to filter resources
238
+ * @param uid Unique identifier for the request to prevent race conditions
239
+ * @returns Promise resolving to array of resources with context state
240
+ */
241
+ loadSourceResources(sourceId: string, query: string, uid: string): Promise<Array<AIContextResourceState>>;
242
+ /**
243
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
244
+ * without the standard deprecation policy. Check the changelog for migration guidance.
245
+ */
246
+ addResourceToContext(source: AIContextProvider, resource: AIContextResource): Promise<void>;
247
+ /**
248
+ * Toggles the visibility of the add current document option in the add context options.
249
+ *
250
+ * By default, the option is visible if the current document is not in the context or conversation.
251
+ *
252
+ * There's an option to force the visibility of the option by passing `true` or `false` to the method.
253
+ *
254
+ * @experimental **Experimental:** This is a production-ready API but may change in minor releases
255
+ * without the standard deprecation policy. Check the changelog for migration guidance.
256
+ * @param isVisible Whether to force-show or force-hide the option.
257
+ * @default undefined
258
+ */
259
+ toggleAddCurrentDocumentOptionVisibility(isVisible?: boolean): void;
251
260
  }
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
- /**
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").
271
- */
272
- description?: string;
273
- };
274
261
  export type AIChatContextItemAddedEvent = {
275
- name: 'contextItemAdded';
276
- args: [
277
- {
278
- contextItem: AIContextItem;
279
- isLoading: boolean;
280
- }
281
- ];
262
+ name: "contextItemAdded";
263
+ args: [{
264
+ contextItem: AIContextItem;
265
+ isLoading: boolean;
266
+ }];
282
267
  };
283
268
  export type AIChatContextItemRemovedEvent = {
284
- name: 'contextItemRemoved';
285
- args: [
286
- {
287
- uiId: string;
288
- type?: AIContextItemType;
289
- }
290
- ];
269
+ name: "contextItemRemoved";
270
+ args: [{
271
+ uiId: string;
272
+ type?: AIContextItemType;
273
+ }];
291
274
  };
292
275
  export type AIChatContextSentEvent = {
293
- name: 'contextSent';
294
- args: [
295
- {
296
- contextItems: Array<AIContextItem>;
297
- }
298
- ];
276
+ name: "contextSent";
277
+ args: [{
278
+ contextItems: Array<AIContextItem>;
279
+ }];
299
280
  };
300
281
  export type AIChatContextAddContextOptionsChangedEvent = {
301
- name: 'addContextOptionsChanged';
302
- args: [
303
- {
304
- options: AIAddContextOptionsState;
305
- }
306
- ];
282
+ name: "addContextOptionsChanged";
283
+ args: [{
284
+ options: AIAddContextOptionsState;
285
+ }];
307
286
  };
308
287
  export type AIChatContextUploadProgressChangedEvent = {
309
- name: 'uploadProgressChanged';
310
- args: [
311
- {
312
- isUploadInProgress: boolean;
313
- }
314
- ];
288
+ name: "uploadProgressChanged";
289
+ args: [{
290
+ isUploadInProgress: boolean;
291
+ }];
315
292
  };
316
293
  export type AIAddContextOptionsState = {
317
- document: {
318
- enabled: boolean;
319
- isHidden: boolean;
320
- };
321
- urls: {
322
- enabled: boolean;
323
- };
324
- files: {
325
- enabled: boolean;
326
- };
327
- sources: Array<AIContextProviderState>;
328
- customItems: Array<AIContextCustomItem>;
294
+ document: {
295
+ enabled: boolean;
296
+ isHidden: boolean;
297
+ };
298
+ urls: {
299
+ enabled: boolean;
300
+ };
301
+ files: {
302
+ enabled: boolean;
303
+ };
304
+ sources: Array<AIContextProviderState>;
305
+ customItems: Array<AIContextCustomItem>;
329
306
  };
330
307
  export type AIContextProviderState = AIContextProvider & {
331
- resources: Array<AIContextResourceState>;
308
+ resources: Array<AIContextResourceState>;
332
309
  };
333
310
  export type AIContextResourceState = AIContextResource & {
334
- isInContext?: boolean;
311
+ isInContext?: boolean;
335
312
  };
336
313
  /**
337
- * The configuration of the AI Chat menu for adding resources to the prompt context.
338
- *
339
- * This menu allows users to attach additional resources (files, documents, URLs) to their AI chat prompts,
340
- * providing the AI with more context for generating responses. The properties defined in this config are set
341
- * in the `config.ai.chat.context` namespace.
342
- *
343
- * It also allows to change the minimal number of items in the context adding menu required to show the search input
344
- * using `config.ai.chat.context.searchInputVisibleFrom` option.
345
- *
346
- * ```ts
347
- * ClassicEditor
348
- * .create( {
349
- * ai: {
350
- * chat: {
351
- * context: {
352
- * // Allow for adding the current document content to the conversation context.
353
- * document: { enabled: true },
354
- *
355
- * // Allow for adding URLs (web pages, blogs, etc.) to the conversation context.
356
- * urls: { enabled: false },
357
- *
358
- * // Allow for uploading files (PDF, Word, etc.) to the conversation context.
359
- * files: { enabled: true },
360
- *
361
- * // Configuration of external resources (files, text, etc.) to the conversation context.
362
- * sources: [
363
- * {
364
- * id: 'my-docs',
365
- * label: 'My Documents',
366
- * getResources: ( query ) => fetchMyDocuments( query ),
367
- * getData: ( id ) => fetchDocumentContent( id )
368
- * }
369
- * ],
370
- *
371
- * // The minimum number of resources to show the search input.
372
- * searchInputVisibleFrom: 5
373
- * }
374
- * }
375
- * }
376
- * } )
377
- * .then( ... )
378
- * .catch( ... );
379
- * ```
380
- *
381
- * * The {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#document},
382
- * {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#urls}, and
383
- * {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#files} properties configure the **built-in** options in the context menu.
384
- * Each option can be enabled or disabled using the `enabled` boolean property. See their respective documentation for more details.
385
- *
386
- * * The {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#sources} property introduces customizable menus to the
387
- * conversation context user interface that display a list of **external** resources that can be attached to the AI prompt.
388
- * The user can search resources and the minimal number of resources required to show the search input can be configured using
389
- * the {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#searchInputVisibleFrom} option.
390
- * See {@link module:ai/aichat/model/aichatcontext~AIContextProvider} and {@link module:ai/aichat/model/aichatcontext~AIContextResource}
391
- * to learn more.
392
- */
314
+ * The configuration of the AI Chat menu for adding resources to the prompt context.
315
+ *
316
+ * This menu allows users to attach additional resources (files, documents, URLs) to their AI chat prompts,
317
+ * providing the AI with more context for generating responses. The properties defined in this config are set
318
+ * in the `config.ai.chat.context` namespace.
319
+ *
320
+ * It also allows to change the minimal number of items in the context adding menu required to show the search input
321
+ * using `config.ai.chat.context.searchInputVisibleFrom` option.
322
+ *
323
+ * ```ts
324
+ * ClassicEditor
325
+ * .create( {
326
+ * ai: {
327
+ * chat: {
328
+ * context: {
329
+ * // Allow for adding the current document content to the conversation context.
330
+ * document: { enabled: true },
331
+ *
332
+ * // Allow for adding URLs (web pages, blogs, etc.) to the conversation context.
333
+ * urls: { enabled: false },
334
+ *
335
+ * // Allow for uploading files (PDF, Word, etc.) to the conversation context.
336
+ * files: { enabled: true },
337
+ *
338
+ * // Configuration of external resources (files, text, etc.) to the conversation context.
339
+ * sources: [
340
+ * {
341
+ * id: 'my-docs',
342
+ * label: 'My Documents',
343
+ * getResources: ( query ) => fetchMyDocuments( query ),
344
+ * getData: ( id ) => fetchDocumentContent( id )
345
+ * }
346
+ * ],
347
+ *
348
+ * // The minimum number of resources to show the search input.
349
+ * searchInputVisibleFrom: 5
350
+ * }
351
+ * }
352
+ * }
353
+ * } )
354
+ * .then( ... )
355
+ * .catch( ... );
356
+ * ```
357
+ *
358
+ * * The {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#document},
359
+ * {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#urls}, and
360
+ * {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#files} properties configure the **built-in** options in the context menu.
361
+ * Each option can be enabled or disabled using the `enabled` boolean property. See their respective documentation for more details.
362
+ *
363
+ * * The {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#sources} property introduces customizable menus to the
364
+ * conversation context user interface that display a list of **external** resources that can be attached to the AI prompt.
365
+ * The user can search resources and the minimal number of resources required to show the search input can be configured using
366
+ * the {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#searchInputVisibleFrom} option.
367
+ * See {@link module:ai/aichat/model/aichatcontext~AIContextProvider} and {@link module:ai/aichat/model/aichatcontext~AIContextResource}
368
+ * to learn more.
369
+ */
393
370
  export type AIChatContextConfig = {
394
- /**
395
- * When this option is enabled (default), adding the editor document to the context of the conversation becomes possible.
396
- * This allows the AI to interact with the content of the entire document if the user asks for it
397
- * (e.g. "Write an introduction to the document." or "Shorten headings to make them more concise.").
398
- *
399
- * **Note**: When set `true`, the document content will be automatically added to the context of the new conversation. The user
400
- * can still remove it using the user interface before sending the message if needed.
401
- *
402
- * **Note**: When set to `false`, the {@link module:ai/aiquickactions/aiquickactions~AIQuickActions AI Quick Actions} that use AI Chat
403
- * will be disabled and removed from the UI. The selection can’t be sent to AI Chat without sending the entire document.
404
- *
405
- * @default true
406
- */
407
- document?: {
408
- enabled: boolean;
409
- };
410
- /**
411
- * When this option is enabled (default), adding URLs to the context of the conversation becomes possible.
412
- * This allows the AI to interact with the content of the URLs (e.g. web pages, blog posts, etc.) if the user adds them to the context
413
- * (e.g. "Write a very brief summary of the linked blog post.").
414
- *
415
- * @default true
416
- */
417
- urls?: {
418
- enabled: boolean;
419
- };
420
- /**
421
- * When this option is enabled (default), adding files to the context of the conversation becomes possible.
422
- * This allows the AI to interact with the content of the files (e.g. Word documents, PDF files, etc.) if the user adds them
423
- * to the context (e.g. "Write a very brief summary of the attached Word document.").
424
- *
425
- * @default true
426
- */
427
- files?: {
428
- enabled: boolean;
429
- };
430
- /**
431
- * The configuration of the custom options in the context menu.
432
- *
433
- * Each configured {@link module:ai/aichat/model/aichatcontext~AIContextProvider} represents a single menu option that, when clicked,
434
- * displays a list of available resources that can be attached to the AI prompt.
435
- *
436
- * {@link module:ai/aichat/model/aichatcontext~AIContextProvider Learn more about the configuration of custom resources}.
437
- */
438
- sources?: Array<AIContextProvider>;
439
- /**
440
- * When this option is enabled, the selection made in the editor will always be added to the context.
441
- *
442
- * By default, the selection is added to the context only after user explicitly requests it by clicking "Ask AI" button.
443
- *
444
- * **Note**: This setting will have no effect if the feature is configured to
445
- * {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#document disallow setting document as the conversation context}.
446
- *
447
- * @default false
448
- */
449
- alwaysAddSelection?: boolean;
450
- /**
451
- * The configuration of the custom items in the context menu.
452
- *
453
- * Each configured {@link module:ai/aichat/model/aichatcontext~AIContextCustomItem} represents a single menu option that, when clicked,
454
- * will execute a custom callback (e.g. opening a file manager).
455
- *
456
- * {@link module:ai/aichat/model/aichatcontext~AIContextCustomItem Learn more about the configuration of custom items}.
457
- */
458
- customItems?: Array<AIContextCustomItem>;
459
- /**
460
- * The minimum number of resources to show the search input.
461
- *
462
- * @default 7
463
- */
464
- searchInputVisibleFrom?: number;
371
+ /**
372
+ * When this option is enabled (default), adding the editor document to the context of the conversation becomes possible.
373
+ * This allows the AI to interact with the content of the entire document if the user asks for it
374
+ * (e.g. "Write an introduction to the document." or "Shorten headings to make them more concise.").
375
+ *
376
+ * **Note**: When set `true`, the document content will be automatically added to the context of the new conversation. The user
377
+ * can still remove it using the user interface before sending the message if needed.
378
+ *
379
+ * **Note**: When set to `false`, the {@link module:ai/aiquickactions/aiquickactions~AIQuickActions AI Quick Actions} that use AI Chat
380
+ * will be disabled and removed from the UI. The selection can’t be sent to AI Chat without sending the entire document.
381
+ *
382
+ * @default true
383
+ */
384
+ document?: {
385
+ enabled: boolean;
386
+ };
387
+ /**
388
+ * When this option is enabled (default), adding URLs to the context of the conversation becomes possible.
389
+ * This allows the AI to interact with the content of the URLs (e.g. web pages, blog posts, etc.) if the user adds them to the context
390
+ * (e.g. "Write a very brief summary of the linked blog post.").
391
+ *
392
+ * @default true
393
+ */
394
+ urls?: {
395
+ enabled: boolean;
396
+ };
397
+ /**
398
+ * When this option is enabled (default), adding files to the context of the conversation becomes possible.
399
+ * This allows the AI to interact with the content of the files (e.g. Word documents, PDF files, etc.) if the user adds them
400
+ * to the context (e.g. "Write a very brief summary of the attached Word document.").
401
+ *
402
+ * @default true
403
+ */
404
+ files?: {
405
+ enabled: boolean;
406
+ };
407
+ /**
408
+ * When this option is enabled, the contexts available to the current token are offered in the context picker as a
409
+ * built-in source, excluding any context referenced by the global `ai.defaultContext` configuration.
410
+ *
411
+ * @default false
412
+ */
413
+ contextLibrary?: {
414
+ enabled: boolean;
415
+ };
416
+ /**
417
+ * The configuration of the custom options in the context menu.
418
+ *
419
+ * Each configured {@link module:ai/aichat/model/aichatcontext~AIContextProvider} represents a single menu option that, when clicked,
420
+ * displays a list of available resources that can be attached to the AI prompt.
421
+ *
422
+ * {@link module:ai/aichat/model/aichatcontext~AIContextProvider Learn more about the configuration of custom resources}.
423
+ */
424
+ sources?: Array<AIContextProvider>;
425
+ /**
426
+ * When this option is enabled, the selection made in the editor will always be added to the context.
427
+ *
428
+ * By default, the selection is added to the context only after user explicitly requests it by clicking "Ask AI" button.
429
+ *
430
+ * **Note**: This setting will have no effect if the feature is configured to
431
+ * {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#document disallow setting document as the conversation context}.
432
+ *
433
+ * @default false
434
+ */
435
+ alwaysAddSelection?: boolean;
436
+ /**
437
+ * The configuration of the custom items in the context menu.
438
+ *
439
+ * Each configured {@link module:ai/aichat/model/aichatcontext~AIContextCustomItem} represents a single menu option that, when clicked,
440
+ * will execute a custom callback (e.g. opening a file manager).
441
+ *
442
+ * {@link module:ai/aichat/model/aichatcontext~AIContextCustomItem Learn more about the configuration of custom items}.
443
+ */
444
+ customItems?: Array<AIContextCustomItem>;
445
+ /**
446
+ * The minimum number of resources to show the search input.
447
+ *
448
+ * @default 7
449
+ */
450
+ searchInputVisibleFrom?: number;
451
+ /**
452
+ * Configures how paste interactions in the AI Chat input are handled.
453
+ */
454
+ paste?: AIChatContextPasteConfig;
455
+ };
456
+ /**
457
+ * Configuration for paste handling in the AI Chat input.
458
+ */
459
+ export type AIChatContextPasteConfig = {
460
+ /**
461
+ * Minimum length of the pasted plain text (in characters) that triggers conversion to a
462
+ * `.txt` context item. Pasted text shorter than this lands inline in the input as usual.
463
+ *
464
+ * @default 1500
465
+ */
466
+ textThreshold?: number;
465
467
  };
466
468
  /**
467
- * The configuration of a custom option in the AI Chat menu for adding external resources to the prompt context.
468
- *
469
- * A `AIContextProvider` represents a single menu option that, when clicked, displays a list of available
470
- * resources that can be attached to the AI prompt. The {@link module:ai/aichat/model/aichatcontext~AIContextProvider#label} is displayed
471
- * as the menu option text, and the optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#icon} can be used to provide
472
- * a visual representation.
473
- *
474
- * The {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources} callback is called when the user clicks on the menu
475
- * option and should return an array of {@link module:ai/aichat/model/aichatcontext~AIContextResource available resources}.
476
- * Resources returned by this callback are displayed as a list and each resource comes with an optional
477
- * {@link module:ai/aichat/model/aichatcontext~AIContextResource#data} property that:
478
- * * When present, it will be used as is.
479
- * * When `undefined`, for instance, because the resource content is large and obtaining it along with the list is expensive,
480
- * the data will be retrieved using the optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getData} callback on
481
- * demand the moment the user selects this particular resource.
482
- *
483
- * The optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#useDefaultFiltering} property controls whether the
484
- * built-in search filtering should be applied to the resources returned by `getResources()`.
485
- * * When set to `true`, the resources will be filtered based on the user's search query.
486
- * * When set to `false`, all resources will be displayed regardless of the search query, allowing the provider to handle filtering
487
- * internally within the `getResources()` callback.
488
- *
489
- * ```ts
490
- * {
491
- * // The unique identifier of the provider.
492
- * id: 'knowledge-base',
493
- *
494
- * // The human-readable name of the provider.
495
- * label: 'Knowledge Base',
496
- *
497
- * // (Optional) The SVG string of the provider's icon. If not provided, a generic icon will be used instead.
498
- * icon: '<svg xmlns="http://www.w3.org/2000/svg">...</svg>',
499
- *
500
- * // Whether to use the built-in search filtering.
501
- * useDefaultFiltering: false,
502
- *
503
- * // The async callback to retrieve the list of available resources. Usually involves fetching data from a database or an external API
504
- * // but here we use a simple array of resources for demonstration purposes.
505
- * getResources: async ( query ) => [
506
- * // Texts in various formats
507
- * {
508
- * id: 'text1',
509
- * type: 'text',
510
- * label: 'Internal note in plain text format',
511
- * data: {
512
- * content: 'Lorem ipsum dolor sit amet...',
513
- * type: 'text'
514
- * }
515
- * },
516
- * {
517
- * id: 'text2',
518
- * type: 'text',
519
- * label: 'Internal note in Markdown format',
520
- * data: {
521
- * content: '## Markdown note\n\n**Lorem ipsum** dolor sit amet...',
522
- * type: 'markdown'
523
- * }
524
- * },
525
- * {
526
- * id: 'text3',
527
- * type: 'text',
528
- * label: 'Internal note in HTML format',
529
- * data: {
530
- * content: '<h2>HTML note</h2><p>Lorem ipsum dolor sit amet...</p>',
531
- * type: 'html'
532
- * }
533
- * },
534
- * {
535
- * id: 'text4',
536
- * type: 'text',
537
- * label: 'Internal note (fetched on demand)',
469
+ * The configuration of a custom option in the AI Chat menu for adding external resources to the prompt context.
470
+ *
471
+ * A `AIContextProvider` represents a single menu option that, when clicked, displays a list of available
472
+ * resources that can be attached to the AI prompt. The {@link module:ai/aichat/model/aichatcontext~AIContextProvider#label} is displayed
473
+ * as the menu option text, and the optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#icon} can be used to provide
474
+ * a visual representation.
475
+ *
476
+ * The {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources} callback is called when the user clicks on the menu
477
+ * option and should return an array of {@link module:ai/aichat/model/aichatcontext~AIContextResource available resources}.
478
+ * Resources returned by this callback are displayed as a list and each resource comes with an optional
479
+ * {@link module:ai/aichat/model/aichatcontext~AIContextResource#data} property that:
480
+ * * When present, it will be used as is.
481
+ * * When `undefined`, for instance, because the resource content is large and obtaining it along with the list is expensive,
482
+ * the data will be retrieved using the optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getData} callback on
483
+ * demand the moment the user selects this particular resource.
484
+ *
485
+ * The optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#useDefaultFiltering} property controls whether the
486
+ * built-in search filtering should be applied to the resources returned by `getResources()`.
487
+ * * When set to `true`, the resources will be filtered based on the user's search query.
488
+ * * When set to `false`, all resources will be displayed regardless of the search query, allowing the provider to handle filtering
489
+ * internally within the `getResources()` callback.
490
+ *
491
+ * ```ts
492
+ * {
493
+ * // The unique identifier of the provider.
494
+ * id: 'knowledge-base',
495
+ *
496
+ * // The human-readable name of the provider.
497
+ * label: 'Knowledge Base',
498
+ *
499
+ * // (Optional) The SVG string of the provider's icon. If not provided, a generic icon will be used instead.
500
+ * icon: '<svg xmlns="http://www.w3.org/2000/svg">...</svg>',
501
+ *
502
+ * // Whether to use the built-in search filtering.
503
+ * useDefaultFiltering: false,
504
+ *
505
+ * // The async callback to retrieve the list of available resources. Usually involves fetching data from a database or an external API
506
+ * // but here we use a simple array of resources for demonstration purposes.
507
+ * getResources: async ( query ) => [
508
+ * // Texts in various formats
509
+ * {
510
+ * id: 'text1',
511
+ * type: 'text',
512
+ * label: 'Internal note in plain text format',
513
+ * data: {
514
+ * content: 'Lorem ipsum dolor sit amet...',
515
+ * type: 'text'
516
+ * }
517
+ * },
518
+ * {
519
+ * id: 'text2',
520
+ * type: 'text',
521
+ * label: 'Internal note in Markdown format',
522
+ * data: {
523
+ * content: '## Markdown note\n\n**Lorem ipsum** dolor sit amet...',
524
+ * type: 'markdown'
525
+ * }
526
+ * },
527
+ * {
528
+ * id: 'text3',
529
+ * type: 'text',
530
+ * label: 'Internal note in HTML format',
531
+ * data: {
532
+ * content: '<h2>HTML note</h2><p>Lorem ipsum dolor sit amet...</p>',
533
+ * type: 'html'
534
+ * }
535
+ * },
536
+ * {
537
+ * id: 'text4',
538
+ * type: 'text',
539
+ * label: 'Internal note (fetched on demand)',
538
540
 
539
- * // Note: Since `data` property is not provided, the content will be retrieved using the `getData()` callback (see below).
540
- * // This, for instance, prevents fetching large resources along with the list of resources.
541
- * },
542
- *
543
- * // URLs to resources in different formats
544
- * {
545
- * id: 'url1',
546
- * type: 'web-resource',
547
- * label: 'Blog post in Markdown',
548
- * data: 'https://example.com/blog-post.md'
549
- * },
550
- * {
551
- * id: 'url2',
552
- * type: 'web-resource',
553
- * label: 'Company brochure in PDF',
554
- * data: 'https://example.com/brochure.pdf'
555
- * },
556
- * {
557
- * id: 'url3',
558
- * type: 'web-resource',
559
- * label: 'Company website in HTML',
560
- * data: 'https://example.com/index.html'
561
- * },
562
- * {
563
- * id: 'url4',
564
- * type: 'web-resource',
565
- * label: 'Terms of service in plain text',
566
- * data: 'https://example.com/terms-of-service.txt'
567
- * },
568
- *
569
- * // ...
570
- * ],
571
- *
572
- * // (Optional) Callback to retrieve the content of resources without `data` property provided by `getResources()` callback.
573
- * // When the user picks a specific resource, the content will be fetched on demand (from database or external API) by this callback.
574
- * // This prevents fetching large resources along with the list of resources.
575
- * getData: async ( id ) => fetchDocumentContent( id )
576
- * }
577
- * ```
578
- */
541
+ * // Note: Since `data` property is not provided, the content will be retrieved using the `getData()` callback (see below).
542
+ * // This, for instance, prevents fetching large resources along with the list of resources.
543
+ * },
544
+ *
545
+ * // URLs to resources in different formats
546
+ * {
547
+ * id: 'url1',
548
+ * type: 'web-resource',
549
+ * label: 'Blog post in Markdown',
550
+ * data: 'https://example.com/blog-post.md'
551
+ * },
552
+ * {
553
+ * id: 'url2',
554
+ * type: 'web-resource',
555
+ * label: 'Company brochure in PDF',
556
+ * data: 'https://example.com/brochure.pdf'
557
+ * },
558
+ * {
559
+ * id: 'url3',
560
+ * type: 'web-resource',
561
+ * label: 'Company website in HTML',
562
+ * data: 'https://example.com/index.html'
563
+ * },
564
+ * {
565
+ * id: 'url4',
566
+ * type: 'web-resource',
567
+ * label: 'Terms of service in plain text',
568
+ * data: 'https://example.com/terms-of-service.txt'
569
+ * },
570
+ *
571
+ * // ...
572
+ * ],
573
+ *
574
+ * // (Optional) Callback to retrieve the content of resources without `data` property provided by `getResources()` callback.
575
+ * // When the user picks a specific resource, the content will be fetched on demand (from database or external API) by this callback.
576
+ * // This prevents fetching large resources along with the list of resources.
577
+ * getData: async ( id ) => fetchDocumentContent( id )
578
+ * }
579
+ * ```
580
+ */
579
581
  export type AIContextProvider = {
580
- /**
581
- * The unique identifier of the provider.
582
- */
583
- id: string;
584
- /**
585
- * (Optional) The SVG string of the provider's icon. If not provided, a generic icon will be used instead.
586
- */
587
- icon?: string;
588
- /**
589
- * The human-readable name of the provider.
590
- */
591
- label: string;
592
- /**
593
- * Whether to use the built-in search filtering for resources returned by
594
- * {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources}.
595
- */
596
- useDefaultFiltering?: boolean;
597
- /**
598
- * The callback to retrieve the list of available resources. Usually involves fetching data from a database or an external API.
599
- */
600
- getResources: (query?: string) => Promise<Array<AIContextResource>>;
601
- /**
602
- * The optional callback to retrieve the content of {@link module:ai/aichat/model/aichatcontext~AIContextResource resources}
603
- * without `data` property provided by {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources} callback.
604
- *
605
- * It helps to prevent fetching large resources along with the list of resources.
606
- *
607
- * Usually involves fetching data from a database or an external API.
608
- */
609
- getData?: (id: string) => Promise<string>;
582
+ /**
583
+ * The unique identifier of the provider.
584
+ */
585
+ id: string;
586
+ /**
587
+ * (Optional) The SVG string of the provider's icon. If not provided, a generic icon will be used instead.
588
+ */
589
+ icon?: string;
590
+ /**
591
+ * The human-readable name of the provider.
592
+ */
593
+ label: string;
594
+ /**
595
+ * Whether to use the built-in search filtering for resources returned by
596
+ * {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources}.
597
+ */
598
+ useDefaultFiltering?: boolean;
599
+ /**
600
+ * The callback to retrieve the list of available resources. Usually involves fetching data from a database or an external API.
601
+ */
602
+ getResources: (query?: string) => Promise<Array<AIContextResource>>;
603
+ /**
604
+ * The optional callback to retrieve the content of {@link module:ai/aichat/model/aichatcontext~AIContextResource resources}
605
+ * without `data` property provided by {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getResources} callback.
606
+ *
607
+ * It helps to prevent fetching large resources along with the list of resources.
608
+ *
609
+ * Usually involves fetching data from a database or an external API.
610
+ */
611
+ getData?: (id: string) => Promise<string>;
610
612
  };
611
613
  /**
612
- * An individual resource item within a {@link module:ai/aichat/model/aichatcontext~AIContextProvider}.
613
- *
614
- * Represents a single selectable item in the resources list displayed when a user clicks on a custom
615
- * context menu option. The {@link module:ai/aichat/model/aichatcontext~AIContextResource#label} is displayed to the user as the
616
- * resource name, and the {@link module:ai/aichat/model/aichatcontext~AIContextResource#type}
617
- * indicates what kind of context item this represents (file, document, or URL).
618
- *
619
- * When selected, the resource will be attached to the AI prompt to provide additional context for
620
- * generating responses. If the {@link module:ai/aichat/model/aichatcontext~AIContextResource#data} property is provided,
621
- * it contains the content of the resource. If {@link module:ai/aichat/model/aichatcontext~AIContextResource#data} is `undefined`,
622
- * the content will be retrieved using the {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getData} callback from the parent
623
- * {@link module:ai/aichat/model/aichatcontext~AIContextProvider} when the resource is selected by the user.
624
- *
625
- * ```ts
626
- * {
627
- * id: 'user-guide-intro',
628
- * type: 'text',
629
- * label: 'User Guide - Introduction',
630
- * data: {
631
- * content: '<p>Lorem ipsum dolor sit amet...</p>',
632
- * type: 'html'
633
- * }
634
- * }
635
- * ```
636
- */
614
+ * An individual resource item within a {@link module:ai/aichat/model/aichatcontext~AIContextProvider}.
615
+ *
616
+ * Represents a single selectable item in the resources list displayed when a user clicks on a custom
617
+ * context menu option. The {@link module:ai/aichat/model/aichatcontext~AIContextResource#label} is displayed to the user as the
618
+ * resource name, and the {@link module:ai/aichat/model/aichatcontext~AIContextResource#type}
619
+ * indicates what kind of context item this represents (file, document, or URL).
620
+ *
621
+ * When selected, the resource will be attached to the AI prompt to provide additional context for
622
+ * generating responses. If the {@link module:ai/aichat/model/aichatcontext~AIContextResource#data} property is provided,
623
+ * it contains the content of the resource. If {@link module:ai/aichat/model/aichatcontext~AIContextResource#data} is `undefined`,
624
+ * the content will be retrieved using the {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getData} callback from the parent
625
+ * {@link module:ai/aichat/model/aichatcontext~AIContextProvider} when the resource is selected by the user.
626
+ *
627
+ * ```ts
628
+ * {
629
+ * id: 'user-guide-intro',
630
+ * type: 'text',
631
+ * label: 'User Guide - Introduction',
632
+ * data: {
633
+ * content: '<p>Lorem ipsum dolor sit amet...</p>',
634
+ * type: 'html'
635
+ * }
636
+ * }
637
+ * ```
638
+ */
637
639
  export type AIContextResource = {
638
- /**
639
- * The unique identifier of the resource.
640
- */
641
- id: string;
642
- /**
643
- * The type of the resource.
644
- */
645
- type: AIContextItemType;
646
- /**
647
- * The human-readable name of the resource.
648
- */
649
- label: string;
650
- /**
651
- * The content of the resource.
652
- *
653
- * **Note**: When `undefined`, for instance, because the resource content is large and obtaining it should be done on demand,
654
- * the content will be retrieved using the optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getData} callback
655
- * from the parent {@link module:ai/aichat/model/aichatcontext~AIContextProvider} when the resource is selected by the user.
656
- *
657
- * **Note**: For the `'text'` {@link module:ai/aichat/model/aichatcontext~AIContextResource#type resource type}, `data` should be in the
658
- * {@link module:ai/aichat/model/aichatcontext~AIContextTextResource} format.
659
- */
660
- data?: string | File | AIContextTextResource;
640
+ /**
641
+ * The unique identifier of the resource.
642
+ */
643
+ id: string;
644
+ /**
645
+ * The type of the resource.
646
+ */
647
+ type: AIContextItemType;
648
+ /**
649
+ * The human-readable name of the resource.
650
+ */
651
+ label: string;
652
+ /**
653
+ * The content of the resource.
654
+ *
655
+ * **Note**: When `undefined`, for instance, because the resource content is large and obtaining it should be done on demand,
656
+ * the content will be retrieved using the optional {@link module:ai/aichat/model/aichatcontext~AIContextProvider#getData} callback
657
+ * from the parent {@link module:ai/aichat/model/aichatcontext~AIContextProvider} when the resource is selected by the user.
658
+ *
659
+ * **Note**: For the `'text'` {@link module:ai/aichat/model/aichatcontext~AIContextResource#type resource type}, `data` should be in the
660
+ * {@link module:ai/aichat/model/aichatcontext~AIContextTextResource} format.
661
+ */
662
+ data?: string | File | AIContextTextResource;
661
663
  };
662
664
  /**
663
- * A text resource that can be used as a context item. For instance:
664
- *
665
- * ```ts
666
- * {
667
- * content: '<h2>HTML note</h2><p>Lorem ipsum dolor sit amet...</p>',
668
- * type: 'html'
669
- * }
670
- * ```
671
- */
665
+ * A text resource that can be used as a context item. For instance:
666
+ *
667
+ * ```ts
668
+ * {
669
+ * content: '<h2>HTML note</h2><p>Lorem ipsum dolor sit amet...</p>',
670
+ * type: 'html'
671
+ * }
672
+ * ```
673
+ */
672
674
  export type AIContextTextResource = {
673
- /**
674
- * The content of the text resource.
675
- */
676
- content: string;
677
- /**
678
- * The type of the text resource.
679
- */
680
- type: AIContextTextResourceType;
675
+ /**
676
+ * The content of the text resource.
677
+ */
678
+ content: string;
679
+ /**
680
+ * The type of the text resource.
681
+ */
682
+ type: AIContextTextResourceType;
681
683
  };
682
684
  /**
683
- * A custom item in the context menu, e.g. a button opening external file manager.
684
- */
685
+ * A custom item in the context menu, e.g. a button opening external file manager.
686
+ */
685
687
  export type AIContextCustomItem = {
686
- id: string;
687
- label: string;
688
- icon?: string;
689
- callback: () => void;
688
+ id: string;
689
+ label: string;
690
+ icon?: string;
691
+ callback: () => void;
690
692
  };
691
- export {};