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