@webiny/ai-powerups 6.4.12-beta.5 → 6.5.0-beta.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 (336) hide show
  1. package/admin/Extension.js +7 -1
  2. package/admin/Extension.js.map +1 -1
  3. package/admin/domain/modelRoles.d.ts +17 -0
  4. package/admin/domain/modelRoles.js +8 -0
  5. package/admin/domain/modelRoles.js.map +1 -0
  6. package/admin/features/compareEntryRevisions/CompareEntryRevisionsGateway.d.ts +12 -0
  7. package/admin/features/compareEntryRevisions/CompareEntryRevisionsGateway.js +46 -0
  8. package/admin/features/compareEntryRevisions/CompareEntryRevisionsGateway.js.map +1 -0
  9. package/admin/features/compareEntryRevisions/CompareEntryRevisionsRepository.d.ts +11 -0
  10. package/admin/features/compareEntryRevisions/CompareEntryRevisionsRepository.js +18 -0
  11. package/admin/features/compareEntryRevisions/CompareEntryRevisionsRepository.js.map +1 -0
  12. package/admin/features/compareEntryRevisions/CompareEntryRevisionsUseCase.d.ts +11 -0
  13. package/admin/features/compareEntryRevisions/CompareEntryRevisionsUseCase.js +18 -0
  14. package/admin/features/compareEntryRevisions/CompareEntryRevisionsUseCase.js.map +1 -0
  15. package/admin/features/compareEntryRevisions/abstractions.d.ts +32 -0
  16. package/admin/features/compareEntryRevisions/abstractions.js +7 -0
  17. package/admin/features/compareEntryRevisions/abstractions.js.map +1 -0
  18. package/admin/features/compareEntryRevisions/feature.d.ts +1 -0
  19. package/admin/features/compareEntryRevisions/feature.js +15 -0
  20. package/admin/features/compareEntryRevisions/feature.js.map +1 -0
  21. package/admin/features/compareEntryRevisions/index.d.ts +2 -0
  22. package/admin/features/compareEntryRevisions/index.js +2 -0
  23. package/admin/features/feature.js +4 -0
  24. package/admin/features/feature.js.map +1 -1
  25. package/admin/features/generateEntryContent/GenerateEntryContentGateway.d.ts +12 -0
  26. package/admin/features/generateEntryContent/GenerateEntryContentGateway.js +45 -0
  27. package/admin/features/generateEntryContent/GenerateEntryContentGateway.js.map +1 -0
  28. package/admin/features/generateEntryContent/GenerateEntryContentUseCase.d.ts +11 -0
  29. package/admin/features/generateEntryContent/GenerateEntryContentUseCase.js +18 -0
  30. package/admin/features/generateEntryContent/GenerateEntryContentUseCase.js.map +1 -0
  31. package/admin/features/generateEntryContent/abstractions.d.ts +24 -0
  32. package/admin/features/generateEntryContent/abstractions.js +6 -0
  33. package/admin/features/generateEntryContent/abstractions.js.map +1 -0
  34. package/admin/features/generateEntryContent/feature.d.ts +1 -0
  35. package/admin/features/generateEntryContent/feature.js +13 -0
  36. package/admin/features/generateEntryContent/feature.js.map +1 -0
  37. package/admin/features/generateEntryContent/index.d.ts +3 -0
  38. package/admin/features/generateEntryContent/index.js +2 -0
  39. package/admin/features/generatePageContent/GeneratePageContentGateway.js +2 -0
  40. package/admin/features/generatePageContent/GeneratePageContentGateway.js.map +1 -1
  41. package/admin/features/generatePageContent/abstractions.d.ts +1 -0
  42. package/admin/features/generatePageContent/abstractions.js.map +1 -1
  43. package/admin/features/listCapabilities/ListCapabilitiesGateway.d.ts +12 -0
  44. package/admin/features/listCapabilities/ListCapabilitiesGateway.js +34 -0
  45. package/admin/features/listCapabilities/ListCapabilitiesGateway.js.map +1 -0
  46. package/admin/features/listCapabilities/ListCapabilitiesRepository.d.ts +13 -0
  47. package/admin/features/listCapabilities/ListCapabilitiesRepository.js +27 -0
  48. package/admin/features/listCapabilities/ListCapabilitiesRepository.js.map +1 -0
  49. package/admin/features/listCapabilities/ListCapabilitiesUseCase.d.ts +10 -0
  50. package/admin/features/listCapabilities/ListCapabilitiesUseCase.js +18 -0
  51. package/admin/features/listCapabilities/ListCapabilitiesUseCase.js.map +1 -0
  52. package/admin/features/listCapabilities/abstractions.d.ts +28 -0
  53. package/admin/features/listCapabilities/abstractions.js +7 -0
  54. package/admin/features/listCapabilities/abstractions.js.map +1 -0
  55. package/admin/features/listCapabilities/feature.d.ts +3 -0
  56. package/admin/features/listCapabilities/feature.js +21 -0
  57. package/admin/features/listCapabilities/feature.js.map +1 -0
  58. package/admin/features/listCapabilities/index.d.ts +3 -0
  59. package/admin/features/listCapabilities/index.js +2 -0
  60. package/admin/features/listModels/ListModelsGateway.js +18 -1
  61. package/admin/features/listModels/ListModelsGateway.js.map +1 -1
  62. package/admin/features/listModels/abstractions.d.ts +2 -0
  63. package/admin/features/listModels/abstractions.js.map +1 -1
  64. package/admin/features/settings/shared/abstractions.d.ts +58 -25
  65. package/admin/features/settings/shared/abstractions.js.map +1 -1
  66. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.d.ts +2 -2
  67. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js +3 -4
  68. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js.map +1 -1
  69. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.js +13 -1
  70. package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.js.map +1 -1
  71. package/admin/presentation/AiPowerUpsSettings/feature.js +6 -2
  72. package/admin/presentation/AiPowerUpsSettings/feature.js.map +1 -1
  73. package/admin/presentation/AiPowerUpsSettings/hasUsableModel.d.ts +13 -0
  74. package/admin/presentation/AiPowerUpsSettings/hasUsableModel.js +9 -0
  75. package/admin/presentation/AiPowerUpsSettings/hasUsableModel.js.map +1 -0
  76. package/admin/presentation/AiPowerUpsSettings/index.d.ts +1 -0
  77. package/admin/presentation/AiPowerUpsSettings/index.js +1 -0
  78. package/admin/presentation/AiPowerUpsSettings/settingsGroup.d.ts +6 -0
  79. package/admin/presentation/AiPowerUpsSettings/settingsGroup.js.map +1 -1
  80. package/admin/presentation/AiPromptFormFactory/AiPromptFormFactory.d.ts +20 -0
  81. package/admin/presentation/AiPromptFormFactory/AiPromptFormFactory.js +108 -0
  82. package/admin/presentation/AiPromptFormFactory/AiPromptFormFactory.js.map +1 -0
  83. package/admin/presentation/AiPromptFormFactory/abstractions.d.ts +14 -0
  84. package/admin/presentation/AiPromptFormFactory/abstractions.js +5 -0
  85. package/admin/presentation/AiPromptFormFactory/abstractions.js.map +1 -0
  86. package/admin/presentation/AiPromptFormFactory/feature.d.ts +1 -0
  87. package/admin/presentation/AiPromptFormFactory/feature.js +11 -0
  88. package/admin/presentation/AiPromptFormFactory/feature.js.map +1 -0
  89. package/admin/presentation/CapabilitiesSettings.d.ts +39 -0
  90. package/admin/presentation/CapabilitiesSettings.js +104 -0
  91. package/admin/presentation/CapabilitiesSettings.js.map +1 -0
  92. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsDialog.d.ts +9 -0
  93. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsDialog.js +118 -0
  94. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsDialog.js.map +1 -0
  95. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsDrawer.d.ts +9 -0
  96. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsDrawer.js +72 -0
  97. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsDrawer.js.map +1 -0
  98. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsMenuItem.d.ts +4 -0
  99. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsMenuItem.js +21 -0
  100. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsMenuItem.js.map +1 -0
  101. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsOverlays.d.ts +2 -0
  102. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsOverlays.js +17 -0
  103. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsOverlays.js.map +1 -0
  104. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsPresenter.d.ts +25 -0
  105. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsPresenter.js +90 -0
  106. package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsPresenter.js.map +1 -0
  107. package/admin/presentation/CmsCompareEntryRevisions/Extension.d.ts +2 -0
  108. package/admin/presentation/CmsCompareEntryRevisions/Extension.js +16 -0
  109. package/admin/presentation/CmsCompareEntryRevisions/Extension.js.map +1 -0
  110. package/admin/presentation/CmsCompareEntryRevisions/abstractions.d.ts +29 -0
  111. package/admin/presentation/CmsCompareEntryRevisions/abstractions.js +5 -0
  112. package/admin/presentation/CmsCompareEntryRevisions/abstractions.js.map +1 -0
  113. package/admin/presentation/CmsCompareEntryRevisions/feature.d.ts +3 -0
  114. package/admin/presentation/CmsCompareEntryRevisions/feature.js +17 -0
  115. package/admin/presentation/CmsCompareEntryRevisions/feature.js.map +1 -0
  116. package/admin/presentation/CmsContentGeneration/CmsGenerateContentButton.d.ts +4 -0
  117. package/admin/presentation/CmsContentGeneration/CmsGenerateContentButton.js +27 -0
  118. package/admin/presentation/CmsContentGeneration/CmsGenerateContentButton.js.map +1 -0
  119. package/admin/presentation/CmsContentGeneration/CmsGenerateContentDialog.d.ts +5 -0
  120. package/admin/presentation/CmsContentGeneration/CmsGenerateContentDialog.js +106 -0
  121. package/admin/presentation/CmsContentGeneration/CmsGenerateContentDialog.js.map +1 -0
  122. package/admin/presentation/CmsContentGeneration/CmsGenerateContentPresenter.d.ts +29 -0
  123. package/admin/presentation/CmsContentGeneration/CmsGenerateContentPresenter.js +120 -0
  124. package/admin/presentation/CmsContentGeneration/CmsGenerateContentPresenter.js.map +1 -0
  125. package/admin/presentation/CmsContentGeneration/Extension.d.ts +2 -0
  126. package/admin/presentation/CmsContentGeneration/Extension.js +27 -0
  127. package/admin/presentation/CmsContentGeneration/Extension.js.map +1 -0
  128. package/admin/presentation/CmsContentGeneration/abstractions.d.ts +20 -0
  129. package/admin/presentation/CmsContentGeneration/abstractions.js +5 -0
  130. package/admin/presentation/CmsContentGeneration/abstractions.js.map +1 -0
  131. package/admin/presentation/CmsContentGeneration/feature.d.ts +3 -0
  132. package/admin/presentation/CmsContentGeneration/feature.js +17 -0
  133. package/admin/presentation/CmsContentGeneration/feature.js.map +1 -0
  134. package/admin/presentation/CmsEntryWizard/CmsEntryWizard.d.ts +4 -0
  135. package/admin/presentation/CmsEntryWizard/CmsEntryWizard.js +113 -0
  136. package/admin/presentation/CmsEntryWizard/CmsEntryWizard.js.map +1 -0
  137. package/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.d.ts +4 -0
  138. package/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.js +19 -0
  139. package/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.js.map +1 -0
  140. package/admin/presentation/CmsEntryWizard/Extension.d.ts +2 -0
  141. package/admin/presentation/CmsEntryWizard/Extension.js +10 -0
  142. package/admin/presentation/CmsEntryWizard/Extension.js.map +1 -0
  143. package/admin/presentation/ConnectionsSettings.d.ts +25 -0
  144. package/admin/presentation/ConnectionsSettings.js +52 -0
  145. package/admin/presentation/ConnectionsSettings.js.map +1 -0
  146. package/admin/presentation/ModelRolesSettings.d.ts +29 -0
  147. package/admin/presentation/ModelRolesSettings.js +67 -0
  148. package/admin/presentation/ModelRolesSettings.js.map +1 -0
  149. package/admin/presentation/ProjectsSettings.js +4 -4
  150. package/admin/presentation/ProjectsSettings.js.map +1 -1
  151. package/admin/presentation/ProvidersSettings.js +1 -1
  152. package/admin/presentation/ProvidersSettings.js.map +1 -1
  153. package/admin/presentation/WbContentGeneration/GenerateContentButton.js +2 -2
  154. package/admin/presentation/WbContentGeneration/GenerateContentButton.js.map +1 -1
  155. package/admin/presentation/WbContentGeneration/GenerateContentDialog.d.ts +2 -2
  156. package/admin/presentation/WbContentGeneration/GenerateContentDialog.js +2 -2
  157. package/admin/presentation/WbContentGeneration/GenerateContentDialog.js.map +1 -1
  158. package/admin/presentation/WbContentGeneration/GenerateContentPresenter.d.ts +4 -12
  159. package/admin/presentation/WbContentGeneration/GenerateContentPresenter.js +12 -94
  160. package/admin/presentation/WbContentGeneration/GenerateContentPresenter.js.map +1 -1
  161. package/admin/presentation/modelRoles.d.ts +10 -0
  162. package/admin/presentation/modelRoles.js +23 -0
  163. package/admin/presentation/modelRoles.js.map +1 -0
  164. package/api/Extension.js +16 -0
  165. package/api/Extension.js.map +1 -1
  166. package/api/features/AiImageEnrichment/AiImageEnrichmentTask.d.ts +10 -8
  167. package/api/features/AiImageEnrichment/AiImageEnrichmentTask.js +37 -42
  168. package/api/features/AiImageEnrichment/AiImageEnrichmentTask.js.map +1 -1
  169. package/api/features/AiImageEnrichment/capability.d.ts +13 -0
  170. package/api/features/AiImageEnrichment/capability.js +19 -0
  171. package/api/features/AiImageEnrichment/capability.js.map +1 -0
  172. package/api/features/AiImageEnrichment/feature.js +2 -0
  173. package/api/features/AiImageEnrichment/feature.js.map +1 -1
  174. package/api/features/AiPromptContext/AiPromptContextBuilder.d.ts +8 -1
  175. package/api/features/AiPromptContext/AiPromptContextBuilder.js +46 -2
  176. package/api/features/AiPromptContext/AiPromptContextBuilder.js.map +1 -1
  177. package/api/features/AiPromptContext/abstractions.d.ts +3 -0
  178. package/api/features/AiPromptContext/abstractions.js +9 -1
  179. package/api/features/AiPromptContext/abstractions.js.map +1 -1
  180. package/api/features/AiPromptContext/index.d.ts +1 -1
  181. package/api/features/AiPromptContext/index.js +1 -1
  182. package/api/features/Capabilities/CapabilitiesHandler.d.ts +28 -0
  183. package/api/features/Capabilities/CapabilitiesHandler.js +56 -0
  184. package/api/features/Capabilities/CapabilitiesHandler.js.map +1 -0
  185. package/api/features/Capabilities/ListAiCapabilitiesUseCase.d.ts +18 -0
  186. package/api/features/Capabilities/ListAiCapabilitiesUseCase.js +28 -0
  187. package/api/features/Capabilities/ListAiCapabilitiesUseCase.js.map +1 -0
  188. package/api/features/Capabilities/ResolveAiCapabilityUseCase.d.ts +30 -0
  189. package/api/features/Capabilities/ResolveAiCapabilityUseCase.js +88 -0
  190. package/api/features/Capabilities/ResolveAiCapabilityUseCase.js.map +1 -0
  191. package/api/features/Capabilities/abstractions.d.ts +77 -0
  192. package/api/features/Capabilities/abstractions.js +7 -0
  193. package/api/features/Capabilities/abstractions.js.map +1 -0
  194. package/api/features/Capabilities/composeSystemPrompt.d.ts +14 -0
  195. package/api/features/Capabilities/composeSystemPrompt.js +13 -0
  196. package/api/features/Capabilities/composeSystemPrompt.js.map +1 -0
  197. package/api/features/Capabilities/feature.d.ts +4 -0
  198. package/api/features/Capabilities/feature.js +15 -0
  199. package/api/features/Capabilities/feature.js.map +1 -0
  200. package/api/features/Capabilities/index.d.ts +5 -0
  201. package/api/features/Capabilities/index.js +3 -0
  202. package/api/features/Capabilities/types.d.ts +86 -0
  203. package/api/features/Capabilities/types.js +4 -0
  204. package/api/features/Capabilities/types.js.map +1 -0
  205. package/api/features/CmsCompareEntryRevisions/CmsCompareEntryRevisionsUseCase.d.ts +20 -0
  206. package/api/features/CmsCompareEntryRevisions/CmsCompareEntryRevisionsUseCase.js +82 -0
  207. package/api/features/CmsCompareEntryRevisions/CmsCompareEntryRevisionsUseCase.js.map +1 -0
  208. package/api/features/CmsCompareEntryRevisions/abstractions.d.ts +18 -0
  209. package/api/features/CmsCompareEntryRevisions/abstractions.js +5 -0
  210. package/api/features/CmsCompareEntryRevisions/abstractions.js.map +1 -0
  211. package/api/features/CmsCompareEntryRevisions/capability.d.ts +13 -0
  212. package/api/features/CmsCompareEntryRevisions/capability.js +64 -0
  213. package/api/features/CmsCompareEntryRevisions/capability.js.map +1 -0
  214. package/api/features/CmsCompareEntryRevisions/feature.d.ts +4 -0
  215. package/api/features/CmsCompareEntryRevisions/feature.js +13 -0
  216. package/api/features/CmsCompareEntryRevisions/feature.js.map +1 -0
  217. package/api/features/CmsCompareEntryRevisions/index.d.ts +2 -0
  218. package/api/features/CmsCompareEntryRevisions/index.js +2 -0
  219. package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.d.ts +33 -0
  220. package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.js +84 -0
  221. package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.js.map +1 -0
  222. package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentUseCase.d.ts +27 -0
  223. package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentUseCase.js +133 -0
  224. package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentUseCase.js.map +1 -0
  225. package/api/features/CmsGenerateEntryContent/abstractions.d.ts +36 -0
  226. package/api/features/CmsGenerateEntryContent/abstractions.js +5 -0
  227. package/api/features/CmsGenerateEntryContent/abstractions.js.map +1 -0
  228. package/api/features/CmsGenerateEntryContent/buildPrompt.d.ts +2 -0
  229. package/api/features/CmsGenerateEntryContent/buildPrompt.js +61 -0
  230. package/api/features/CmsGenerateEntryContent/buildPrompt.js.map +1 -0
  231. package/api/features/CmsGenerateEntryContent/capability.d.ts +17 -0
  232. package/api/features/CmsGenerateEntryContent/capability.js +17 -0
  233. package/api/features/CmsGenerateEntryContent/capability.js.map +1 -0
  234. package/api/features/CmsGenerateEntryContent/feature.d.ts +4 -0
  235. package/api/features/CmsGenerateEntryContent/feature.js +15 -0
  236. package/api/features/CmsGenerateEntryContent/feature.js.map +1 -0
  237. package/api/features/CmsGenerateEntryContent/index.d.ts +1 -0
  238. package/api/features/CmsGenerateEntryContent/index.js +1 -0
  239. package/api/features/CmsGenerateEntryContent/injectDynamicZoneTypenames.d.ts +2 -0
  240. package/api/features/CmsGenerateEntryContent/injectDynamicZoneTypenames.js +30 -0
  241. package/api/features/CmsGenerateEntryContent/injectDynamicZoneTypenames.js.map +1 -0
  242. package/api/features/CmsResolveImageTool/CmsResolveImageTool.d.ts +14 -0
  243. package/api/features/CmsResolveImageTool/CmsResolveImageTool.js +27 -0
  244. package/api/features/CmsResolveImageTool/CmsResolveImageTool.js.map +1 -0
  245. package/api/features/CmsResolveImageTool/feature.d.ts +4 -0
  246. package/api/features/CmsResolveImageTool/feature.js +11 -0
  247. package/api/features/CmsResolveImageTool/feature.js.map +1 -0
  248. package/api/features/Connections/ConnectionsGraphQLMapper.d.ts +20 -0
  249. package/api/features/Connections/ConnectionsGraphQLMapper.js +37 -0
  250. package/api/features/Connections/ConnectionsGraphQLMapper.js.map +1 -0
  251. package/api/features/Connections/ConnectionsHandler.d.ts +25 -0
  252. package/api/features/Connections/ConnectionsHandler.js +84 -0
  253. package/api/features/Connections/ConnectionsHandler.js.map +1 -0
  254. package/api/features/Connections/feature.d.ts +4 -0
  255. package/api/features/Connections/feature.js +13 -0
  256. package/api/features/Connections/feature.js.map +1 -0
  257. package/api/features/Connections/index.d.ts +2 -0
  258. package/api/features/Connections/index.js +1 -0
  259. package/api/features/Connections/legacyProviders.d.ts +26 -0
  260. package/api/features/Connections/legacyProviders.js +9 -0
  261. package/api/features/Connections/legacyProviders.js.map +1 -0
  262. package/api/features/Connections/types.d.ts +36 -0
  263. package/api/features/Connections/types.js +0 -0
  264. package/api/features/GetSettings/GetSettingsRepository.js +1 -1
  265. package/api/features/GetSettings/GetSettingsRepository.js.map +1 -1
  266. package/api/features/GetSettings/index.d.ts +1 -0
  267. package/api/features/GetSettings/index.js +1 -0
  268. package/api/features/ModelRoles/ModelRolesHandler.d.ts +15 -0
  269. package/api/features/ModelRoles/ModelRolesHandler.js +68 -0
  270. package/api/features/ModelRoles/ModelRolesHandler.js.map +1 -0
  271. package/api/features/ModelRoles/feature.d.ts +4 -0
  272. package/api/features/ModelRoles/feature.js +11 -0
  273. package/api/features/ModelRoles/feature.js.map +1 -0
  274. package/api/features/ModelRoles/index.d.ts +4 -0
  275. package/api/features/ModelRoles/index.js +2 -0
  276. package/api/features/ModelRoles/roles.d.ts +16 -0
  277. package/api/features/ModelRoles/roles.js +9 -0
  278. package/api/features/ModelRoles/roles.js.map +1 -0
  279. package/api/features/ModelRoles/types.d.ts +21 -0
  280. package/api/features/ModelRoles/types.js +7 -0
  281. package/api/features/ModelRoles/types.js.map +1 -0
  282. package/api/features/Providers/ProvidersHandler.js.map +1 -1
  283. package/api/features/Providers/types.d.ts +2 -2
  284. package/api/features/UpdateSettings/UpdateSettingsRepository.js +2 -2
  285. package/api/features/UpdateSettings/UpdateSettingsRepository.js.map +1 -1
  286. package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.d.ts +4 -3
  287. package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.js +25 -15
  288. package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.js.map +1 -1
  289. package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.d.ts +3 -5
  290. package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.js +16 -23
  291. package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.js.map +1 -1
  292. package/api/features/WbGeneratePageContent/abstractions.d.ts +1 -0
  293. package/api/features/WbGeneratePageContent/abstractions.js.map +1 -1
  294. package/api/features/WbGeneratePageContent/capability.d.ts +16 -0
  295. package/api/features/WbGeneratePageContent/capability.js +17 -0
  296. package/api/features/WbGeneratePageContent/capability.js.map +1 -0
  297. package/api/features/WbGeneratePageContent/feature.js +2 -0
  298. package/api/features/WbGeneratePageContent/feature.js.map +1 -1
  299. package/api/features/WbTranslatePage/LexicalParser.d.ts +10 -0
  300. package/api/features/WbTranslatePage/LexicalParser.js +37 -0
  301. package/api/features/WbTranslatePage/LexicalParser.js.map +1 -0
  302. package/api/features/WbTranslatePage/WbTranslatePageDecorator.d.ts +29 -0
  303. package/api/features/WbTranslatePage/WbTranslatePageDecorator.js +143 -0
  304. package/api/features/WbTranslatePage/WbTranslatePageDecorator.js.map +1 -0
  305. package/api/features/WbTranslatePage/abstractions/LexicalParser.d.ts +7 -0
  306. package/api/features/WbTranslatePage/abstractions/LexicalParser.js +5 -0
  307. package/api/features/WbTranslatePage/abstractions/LexicalParser.js.map +1 -0
  308. package/api/features/WbTranslatePage/capability.d.ts +13 -0
  309. package/api/features/WbTranslatePage/capability.js +19 -0
  310. package/api/features/WbTranslatePage/capability.js.map +1 -0
  311. package/api/features/WbTranslatePage/feature.d.ts +4 -0
  312. package/api/features/WbTranslatePage/feature.js +15 -0
  313. package/api/features/WbTranslatePage/feature.js.map +1 -0
  314. package/api/features/WbTranslatePage/index.d.ts +2 -0
  315. package/api/features/WbTranslatePage/index.js +2 -0
  316. package/api/features/shared/abstractions.d.ts +6 -1
  317. package/api/features/shared/abstractions.js.map +1 -1
  318. package/api/features/shared/modelId.d.ts +11 -0
  319. package/api/features/shared/modelId.js +4 -0
  320. package/api/features/shared/modelId.js.map +1 -0
  321. package/api/graphql/BaseGraphQLSchema.js +58 -1
  322. package/api/graphql/BaseGraphQLSchema.js.map +1 -1
  323. package/api/graphql/CmsCompareEntryRevisionsSchema.d.ts +8 -0
  324. package/api/graphql/CmsCompareEntryRevisionsSchema.js +68 -0
  325. package/api/graphql/CmsCompareEntryRevisionsSchema.js.map +1 -0
  326. package/api/types.d.ts +3 -0
  327. package/api/types.js +3 -0
  328. package/{api/features/WbGeneratePageContent → domain}/LlmJsonResponse.d.ts +1 -0
  329. package/{api/features/WbGeneratePageContent → domain}/LlmJsonResponse.js +3 -0
  330. package/domain/LlmJsonResponse.js.map +1 -0
  331. package/exports/admin/ai-powerups.d.ts +1 -0
  332. package/exports/admin/ai-powerups.js +1 -0
  333. package/exports/api/ai-powerups.d.ts +2 -0
  334. package/exports/api/ai-powerups.js +2 -0
  335. package/package.json +33 -26
  336. package/api/features/WbGeneratePageContent/LlmJsonResponse.js.map +0 -1
@@ -0,0 +1,82 @@
1
+ import { Ai } from "@webiny/api-core/features/ai/index.js";
2
+ import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
3
+ import { ModelToAstConverter } from "@webiny/api-headless-cms/features/contentModel/ModelToAstConverter/index.js";
4
+ import { CmsModelToJsonSchemaConverter } from "@webiny/api-headless-cms/utils/contentModelToJsonSchema/index.js";
5
+ import { GetRevisionByIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetRevisionById/index.js";
6
+ import { ResolveAiCapabilityUseCase, withAdditionalInstructions } from "../Capabilities/index.js";
7
+ import { CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY } from "./capability.js";
8
+ import { CmsCompareEntryRevisionsUseCase } from "./abstractions.js";
9
+ class CmsCompareEntryRevisionsUseCaseImpl {
10
+ constructor(resolveCapability, ai, getModel, getRevisionById, modelToAst){
11
+ this.resolveCapability = resolveCapability;
12
+ this.ai = ai;
13
+ this.getModel = getModel;
14
+ this.getRevisionById = getRevisionById;
15
+ this.modelToAst = modelToAst;
16
+ }
17
+ async execute(params) {
18
+ const { modelId, revisionId1, revisionId2 } = params;
19
+ const resolved = await this.resolveCapability.execute(CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY);
20
+ if (resolved.isFail()) throw resolved.error;
21
+ const capability = resolved.value;
22
+ const modelResult = await this.getModel.execute(modelId);
23
+ if (modelResult.isFail()) throw new Error(`Content model "${modelId}" not found.`);
24
+ const model = modelResult.value;
25
+ const [rev1Result, rev2Result] = await Promise.all([
26
+ this.getRevisionById.execute(model, revisionId1),
27
+ this.getRevisionById.execute(model, revisionId2)
28
+ ]);
29
+ if (rev1Result.isFail()) throw new Error(`Revision "${revisionId1}" not found.`);
30
+ if (rev2Result.isFail()) throw new Error(`Revision "${revisionId2}" not found.`);
31
+ const revision1 = rev1Result.value;
32
+ const revision2 = rev2Result.value;
33
+ const modelAst = this.modelToAst.toAst(model);
34
+ const jsonSchemaConverter = new CmsModelToJsonSchemaConverter();
35
+ const entrySchema = jsonSchemaConverter.convert(modelAst, {
36
+ name: model.name,
37
+ description: model.description
38
+ });
39
+ const userPrompt = `CONTENT MODEL JSON SCHEMA:
40
+ ${JSON.stringify(entrySchema, null, 2)}
41
+
42
+ VERSION A (Revision #${revision1.version}):
43
+ ${JSON.stringify(revision1.values, null, 2)}
44
+
45
+ VERSION B (Revision #${revision2.version}):
46
+ ${JSON.stringify(revision2.values, null, 2)}`;
47
+ const result = await this.ai.generateText({
48
+ model: capability.model,
49
+ connection: capability.connection,
50
+ system: withAdditionalInstructions(capability),
51
+ prompt: userPrompt,
52
+ temperature: 0.3
53
+ });
54
+ const text = result.text;
55
+ const noChangesMatch = text.match(/No differences detected/);
56
+ let summary = "Content comparison completed";
57
+ if (noChangesMatch) summary = "No differences detected between versions";
58
+ else {
59
+ const headingMatch = text.match(/<h[2-3][^>]*>([^<]+)<\/h[2-3]>/);
60
+ const trCount = (text.match(/<tr>/g) || []).length - 1;
61
+ if (headingMatch) summary = headingMatch[1].trim();
62
+ else if (trCount > 0) summary = `${trCount} field${1 === trCount ? "" : "s"} changed`;
63
+ }
64
+ return {
65
+ html: text,
66
+ summary
67
+ };
68
+ }
69
+ }
70
+ const CmsCompareEntryRevisionsUseCaseImplementation = CmsCompareEntryRevisionsUseCase.createImplementation({
71
+ implementation: CmsCompareEntryRevisionsUseCaseImpl,
72
+ dependencies: [
73
+ ResolveAiCapabilityUseCase,
74
+ Ai,
75
+ GetModelUseCase,
76
+ GetRevisionByIdUseCase,
77
+ ModelToAstConverter
78
+ ]
79
+ });
80
+ export { CmsCompareEntryRevisionsUseCaseImplementation };
81
+
82
+ //# sourceMappingURL=CmsCompareEntryRevisionsUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/CmsCompareEntryRevisions/CmsCompareEntryRevisionsUseCase.js","sources":["../../../../src/api/features/CmsCompareEntryRevisions/CmsCompareEntryRevisionsUseCase.ts"],"sourcesContent":["import { Ai } from \"@webiny/api-core/features/ai/index.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { ModelToAstConverter } from \"@webiny/api-headless-cms/features/contentModel/ModelToAstConverter/index.js\";\nimport { CmsModelToJsonSchemaConverter } from \"@webiny/api-headless-cms/utils/contentModelToJsonSchema/index.js\";\nimport { GetRevisionByIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetRevisionById/index.js\";\nimport {\n ResolveAiCapabilityUseCase,\n withAdditionalInstructions\n} from \"~/api/features/Capabilities/index.js\";\nimport { CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY } from \"./capability.js\";\nimport { CmsCompareEntryRevisionsUseCase } from \"./abstractions.js\";\nimport type {\n ICmsCompareEntryRevisionsParams,\n ICmsCompareEntryRevisionsResult\n} from \"./abstractions.js\";\n\nclass CmsCompareEntryRevisionsUseCaseImpl implements CmsCompareEntryRevisionsUseCase.Interface {\n constructor(\n private resolveCapability: ResolveAiCapabilityUseCase.Interface,\n private ai: Ai.Interface,\n private getModel: GetModelUseCase.Interface,\n private getRevisionById: GetRevisionByIdUseCase.Interface,\n private modelToAst: ModelToAstConverter.Interface\n ) {}\n\n async execute(\n params: ICmsCompareEntryRevisionsParams\n ): Promise<ICmsCompareEntryRevisionsResult> {\n const { modelId, revisionId1, revisionId2 } = params;\n\n const resolved = await this.resolveCapability.execute(\n CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY\n );\n if (resolved.isFail()) {\n throw resolved.error;\n }\n\n const capability = resolved.value;\n\n const modelResult = await this.getModel.execute(modelId);\n if (modelResult.isFail()) {\n throw new Error(`Content model \"${modelId}\" not found.`);\n }\n const model = modelResult.value;\n\n const [rev1Result, rev2Result] = await Promise.all([\n this.getRevisionById.execute(model, revisionId1),\n this.getRevisionById.execute(model, revisionId2)\n ]);\n\n if (rev1Result.isFail()) {\n throw new Error(`Revision \"${revisionId1}\" not found.`);\n }\n if (rev2Result.isFail()) {\n throw new Error(`Revision \"${revisionId2}\" not found.`);\n }\n\n const revision1 = rev1Result.value;\n const revision2 = rev2Result.value;\n\n const modelAst = this.modelToAst.toAst(model);\n const jsonSchemaConverter = new CmsModelToJsonSchemaConverter();\n const entrySchema = jsonSchemaConverter.convert(modelAst, {\n name: model.name,\n description: model.description\n });\n\n const userPrompt = `CONTENT MODEL JSON SCHEMA:\n${JSON.stringify(entrySchema, null, 2)}\n\nVERSION A (Revision #${revision1.version}):\n${JSON.stringify(revision1.values, null, 2)}\n\nVERSION B (Revision #${revision2.version}):\n${JSON.stringify(revision2.values, null, 2)}`;\n\n const result = await this.ai.generateText({\n model: capability.model,\n connection: capability.connection,\n system: withAdditionalInstructions(capability),\n prompt: userPrompt,\n temperature: 0.3\n });\n\n const text = result.text;\n\n const noChangesMatch = text.match(/No differences detected/);\n let summary = \"Content comparison completed\";\n if (noChangesMatch) {\n summary = \"No differences detected between versions\";\n } else {\n const headingMatch = text.match(/<h[2-3][^>]*>([^<]+)<\\/h[2-3]>/);\n const trCount = (text.match(/<tr>/g) || []).length - 1;\n if (headingMatch) {\n summary = headingMatch[1].trim();\n } else if (trCount > 0) {\n summary = `${trCount} field${trCount === 1 ? \"\" : \"s\"} changed`;\n }\n }\n\n return { html: text, summary };\n }\n}\n\nexport const CmsCompareEntryRevisionsUseCaseImplementation =\n CmsCompareEntryRevisionsUseCase.createImplementation({\n implementation: CmsCompareEntryRevisionsUseCaseImpl,\n dependencies: [\n ResolveAiCapabilityUseCase,\n Ai,\n GetModelUseCase,\n GetRevisionByIdUseCase,\n ModelToAstConverter\n ]\n });\n"],"names":["CmsCompareEntryRevisionsUseCaseImpl","resolveCapability","ai","getModel","getRevisionById","modelToAst","params","modelId","revisionId1","revisionId2","resolved","CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY","capability","modelResult","Error","model","rev1Result","rev2Result","Promise","revision1","revision2","modelAst","jsonSchemaConverter","CmsModelToJsonSchemaConverter","entrySchema","userPrompt","JSON","result","withAdditionalInstructions","text","noChangesMatch","summary","headingMatch","trCount","CmsCompareEntryRevisionsUseCaseImplementation","CmsCompareEntryRevisionsUseCase","ResolveAiCapabilityUseCase","Ai","GetModelUseCase","GetRevisionByIdUseCase","ModelToAstConverter"],"mappings":";;;;;;;;AAgBA,MAAMA;IACF,YACYC,iBAAuD,EACvDC,EAAgB,EAChBC,QAAmC,EACnCC,eAAiD,EACjDC,UAAyC,CACnD;aALUJ,iBAAiB,GAAjBA;aACAC,EAAE,GAAFA;aACAC,QAAQ,GAARA;aACAC,eAAe,GAAfA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,QACFC,MAAuC,EACC;QACxC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UAAU,MAAM,EAAE,MAAM,IAAI;QAErC,MAAMO,SAAS,MAAM,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC;YACtC,OAAOf,WAAW,KAAK;YACvB,YAAYA,WAAW,UAAU;YACjC,QAAQgB,2BAA2BhB;YACnC,QAAQa;YACR,aAAa;QACjB;QAEA,MAAMI,OAAOF,OAAO,IAAI;QAExB,MAAMG,iBAAiBD,KAAK,KAAK,CAAC;QAClC,IAAIE,UAAU;QACd,IAAID,gBACAC,UAAU;aACP;YACH,MAAMC,eAAeH,KAAK,KAAK,CAAC;YAChC,MAAMI,UAAWJ,AAAAA,CAAAA,KAAK,KAAK,CAAC,YAAY,EAAC,EAAG,MAAM,GAAG;YACrD,IAAIG,cACAD,UAAUC,YAAY,CAAC,EAAE,CAAC,IAAI;iBAC3B,IAAIC,UAAU,GACjBF,UAAU,GAAGE,QAAQ,MAAM,EAAEA,AAAY,MAAZA,UAAgB,KAAK,IAAI,QAAQ,CAAC;QAEvE;QAEA,OAAO;YAAE,MAAMJ;YAAME;QAAQ;IACjC;AACJ;AAEO,MAAMG,gDACTC,gCAAgC,oBAAoB,CAAC;IACjD,gBAAgBnC;IAChB,cAAc;QACVoC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,18 @@
1
+ export interface ICmsCompareEntryRevisionsResult {
2
+ html: string;
3
+ summary: string;
4
+ }
5
+ export interface ICmsCompareEntryRevisionsParams {
6
+ modelId: string;
7
+ revisionId1: string;
8
+ revisionId2: string;
9
+ }
10
+ export interface ICmsCompareEntryRevisionsUseCase {
11
+ execute(params: ICmsCompareEntryRevisionsParams): Promise<ICmsCompareEntryRevisionsResult>;
12
+ }
13
+ export declare const CmsCompareEntryRevisionsUseCase: import("@webiny/di").Abstraction<ICmsCompareEntryRevisionsUseCase>;
14
+ export declare namespace CmsCompareEntryRevisionsUseCase {
15
+ type Interface = ICmsCompareEntryRevisionsUseCase;
16
+ type Params = ICmsCompareEntryRevisionsParams;
17
+ type Result = ICmsCompareEntryRevisionsResult;
18
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CmsCompareEntryRevisionsUseCase = createAbstraction("AiPowerUpsCmsCompareEntryRevisionsUseCase");
3
+ export { CmsCompareEntryRevisionsUseCase };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/CmsCompareEntryRevisions/abstractions.js","sources":["../../../../src/api/features/CmsCompareEntryRevisions/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface ICmsCompareEntryRevisionsResult {\n html: string;\n summary: string;\n}\n\nexport interface ICmsCompareEntryRevisionsParams {\n modelId: string;\n revisionId1: string;\n revisionId2: string;\n}\n\nexport interface ICmsCompareEntryRevisionsUseCase {\n execute(params: ICmsCompareEntryRevisionsParams): Promise<ICmsCompareEntryRevisionsResult>;\n}\n\nexport const CmsCompareEntryRevisionsUseCase = createAbstraction<ICmsCompareEntryRevisionsUseCase>(\n \"AiPowerUpsCmsCompareEntryRevisionsUseCase\"\n);\n\nexport namespace CmsCompareEntryRevisionsUseCase {\n export type Interface = ICmsCompareEntryRevisionsUseCase;\n export type Params = ICmsCompareEntryRevisionsParams;\n export type Result = ICmsCompareEntryRevisionsResult;\n}\n"],"names":["CmsCompareEntryRevisionsUseCase","createAbstraction"],"mappings":";AAiBO,MAAMA,kCAAkCC,kBAC3C"}
@@ -0,0 +1,13 @@
1
+ import { AiCapability } from "../../../api/features/Capabilities/index.js";
2
+ export declare const CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY = "cms.compareEntryRevisions";
3
+ declare class CmsCompareEntryRevisionsCapabilityImpl implements AiCapability.Interface {
4
+ readonly id = "cms.compareEntryRevisions";
5
+ readonly label = "CMS revision comparison";
6
+ readonly description = "Summarises what changed between two revisions of an entry. Short, structural work that a smaller model handles well.";
7
+ readonly defaultRole: "fast";
8
+ readonly guidance = "You are a content intelligence assistant specialized in version comparison for headless CMS platforms.\n\nI will provide:\n\n1. The content model JSON Schema that defines the structure of the entry.\n2. Two versions of the content entry values in JSON format: Version A and Version B.\n\nYour task:\n\n- Parse both versions according to the JSON Schema.\n- Identify all differences between Version A and Version B.\n- For each difference, explain:\n - The field name (use the human-readable label from the schema description if available)\n - The value in Version A\n - The value in Version B\n - A brief summary of the change (e.g., \"Title changed from 'Old' to 'New'\")\n- If nested fields or objects exist, perform a deep comparison.\n- Return the comparison in clean HTML format.\n\nOutput format:\n\n<div class=\"comparison-report\">\n <table class=\"comparison-table\">\n <thead>\n <tr>\n <th>Field</th>\n <th>Version A</th>\n <th>Version B</th>\n <th>Change Summary</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td><strong>title</strong></td>\n <td>Launch Plan</td>\n <td>Updated Launch Plan</td>\n <td>Title changed from 'Launch Plan' to 'Updated Launch Plan'</td>\n </tr>\n </tbody>\n </table>\n</div>\n\nIf no differences are found, return: <div class=\"no-changes\"><h3>No differences detected between Version A and Version B.</h3></div>\n\nUse semantic HTML with appropriate CSS classes for styling. Do not include <style> tags or CSS \u2014 only return the HTML structure.\nFor rich text or complex nested values, show a concise summary rather than raw JSON.";
9
+ }
10
+ export declare const CmsCompareEntryRevisionsCapability: typeof CmsCompareEntryRevisionsCapabilityImpl & {
11
+ __abstraction: import("@webiny/di").Abstraction<import("~/api/features/Capabilities/index.js").IAiCapability>;
12
+ };
13
+ export {};
@@ -0,0 +1,64 @@
1
+ import { AiCapability } from "../Capabilities/index.js";
2
+ const CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY = "cms.compareEntryRevisions";
3
+ const guidance = `You are a content intelligence assistant specialized in version comparison for headless CMS platforms.
4
+
5
+ I will provide:
6
+
7
+ 1. The content model JSON Schema that defines the structure of the entry.
8
+ 2. Two versions of the content entry values in JSON format: Version A and Version B.
9
+
10
+ Your task:
11
+
12
+ - Parse both versions according to the JSON Schema.
13
+ - Identify all differences between Version A and Version B.
14
+ - For each difference, explain:
15
+ - The field name (use the human-readable label from the schema description if available)
16
+ - The value in Version A
17
+ - The value in Version B
18
+ - A brief summary of the change (e.g., "Title changed from 'Old' to 'New'")
19
+ - If nested fields or objects exist, perform a deep comparison.
20
+ - Return the comparison in clean HTML format.
21
+
22
+ Output format:
23
+
24
+ <div class="comparison-report">
25
+ <table class="comparison-table">
26
+ <thead>
27
+ <tr>
28
+ <th>Field</th>
29
+ <th>Version A</th>
30
+ <th>Version B</th>
31
+ <th>Change Summary</th>
32
+ </tr>
33
+ </thead>
34
+ <tbody>
35
+ <tr>
36
+ <td><strong>title</strong></td>
37
+ <td>Launch Plan</td>
38
+ <td>Updated Launch Plan</td>
39
+ <td>Title changed from 'Launch Plan' to 'Updated Launch Plan'</td>
40
+ </tr>
41
+ </tbody>
42
+ </table>
43
+ </div>
44
+
45
+ If no differences are found, return: <div class="no-changes"><h3>No differences detected between Version A and Version B.</h3></div>
46
+
47
+ Use semantic HTML with appropriate CSS classes for styling. Do not include <style> tags or CSS — only return the HTML structure.
48
+ For rich text or complex nested values, show a concise summary rather than raw JSON.`;
49
+ class CmsCompareEntryRevisionsCapabilityImpl {
50
+ constructor(){
51
+ this.id = CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY;
52
+ this.label = "CMS revision comparison";
53
+ this.description = "Summarises what changed between two revisions of an entry. Short, structural work that a smaller model handles well.";
54
+ this.defaultRole = "fast";
55
+ this.guidance = guidance;
56
+ }
57
+ }
58
+ const CmsCompareEntryRevisionsCapability = AiCapability.createImplementation({
59
+ implementation: CmsCompareEntryRevisionsCapabilityImpl,
60
+ dependencies: []
61
+ });
62
+ export { CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY, CmsCompareEntryRevisionsCapability };
63
+
64
+ //# sourceMappingURL=capability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/CmsCompareEntryRevisions/capability.js","sources":["../../../../src/api/features/CmsCompareEntryRevisions/capability.ts"],"sourcesContent":["import { AiCapability } from \"~/api/features/Capabilities/index.js\";\n\nexport const CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY = \"cms.compareEntryRevisions\";\n\n/**\n * The output contract lives in this prompt: the use case regex-matches the HTML table it specifies\n * to build the summary, down to the literal \"No differences detected\" sentence and a count of\n * `<tr>` tags, and the dialog styles those classes. That is why a project can only append to it.\n */\nconst guidance = `You are a content intelligence assistant specialized in version comparison for headless CMS platforms.\n\nI will provide:\n\n1. The content model JSON Schema that defines the structure of the entry.\n2. Two versions of the content entry values in JSON format: Version A and Version B.\n\nYour task:\n\n- Parse both versions according to the JSON Schema.\n- Identify all differences between Version A and Version B.\n- For each difference, explain:\n - The field name (use the human-readable label from the schema description if available)\n - The value in Version A\n - The value in Version B\n - A brief summary of the change (e.g., \"Title changed from 'Old' to 'New'\")\n- If nested fields or objects exist, perform a deep comparison.\n- Return the comparison in clean HTML format.\n\nOutput format:\n\n<div class=\"comparison-report\">\n <table class=\"comparison-table\">\n <thead>\n <tr>\n <th>Field</th>\n <th>Version A</th>\n <th>Version B</th>\n <th>Change Summary</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td><strong>title</strong></td>\n <td>Launch Plan</td>\n <td>Updated Launch Plan</td>\n <td>Title changed from 'Launch Plan' to 'Updated Launch Plan'</td>\n </tr>\n </tbody>\n </table>\n</div>\n\nIf no differences are found, return: <div class=\"no-changes\"><h3>No differences detected between Version A and Version B.</h3></div>\n\nUse semantic HTML with appropriate CSS classes for styling. Do not include <style> tags or CSS — only return the HTML structure.\nFor rich text or complex nested values, show a concise summary rather than raw JSON.`;\n\nclass CmsCompareEntryRevisionsCapabilityImpl implements AiCapability.Interface {\n readonly id = CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY;\n readonly label = \"CMS revision comparison\";\n readonly description =\n \"Summarises what changed between two revisions of an entry. Short, structural work that a smaller model handles well.\";\n readonly defaultRole = \"fast\" as const;\n readonly guidance = guidance;\n}\n\nexport const CmsCompareEntryRevisionsCapability = AiCapability.createImplementation({\n implementation: CmsCompareEntryRevisionsCapabilityImpl,\n dependencies: []\n});\n"],"names":["CMS_COMPARE_ENTRY_REVISIONS_CAPABILITY","guidance","CmsCompareEntryRevisionsCapabilityImpl","CmsCompareEntryRevisionsCapability","AiCapability"],"mappings":";AAEO,MAAMA,yCAAyC;AAOtD,MAAMC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oFA6CkE,CAAC;AAErF,MAAMC;;aACO,EAAE,GAAGF;aACL,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAG;aACd,QAAQ,GAAGC;;AACxB;AAEO,MAAME,qCAAqCC,aAAa,oBAAoB,CAAC;IAChF,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,4 @@
1
+ export declare const CmsCompareEntryRevisionsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,13 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { CmsCompareEntryRevisionsUseCaseImplementation } from "./CmsCompareEntryRevisionsUseCase.js";
3
+ import { CmsCompareEntryRevisionsCapability } from "./capability.js";
4
+ const CmsCompareEntryRevisionsFeature = createFeature({
5
+ name: "AiPowerUps/CmsCompareEntryRevisions",
6
+ register (container) {
7
+ container.register(CmsCompareEntryRevisionsCapability);
8
+ container.register(CmsCompareEntryRevisionsUseCaseImplementation);
9
+ }
10
+ });
11
+ export { CmsCompareEntryRevisionsFeature };
12
+
13
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/CmsCompareEntryRevisions/feature.js","sources":["../../../../src/api/features/CmsCompareEntryRevisions/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CmsCompareEntryRevisionsUseCaseImplementation } from \"./CmsCompareEntryRevisionsUseCase.js\";\nimport { CmsCompareEntryRevisionsCapability } from \"./capability.js\";\n\nexport const CmsCompareEntryRevisionsFeature = createFeature({\n name: \"AiPowerUps/CmsCompareEntryRevisions\",\n register(container) {\n container.register(CmsCompareEntryRevisionsCapability);\n container.register(CmsCompareEntryRevisionsUseCaseImplementation);\n }\n});\n"],"names":["CmsCompareEntryRevisionsFeature","createFeature","container","CmsCompareEntryRevisionsCapability","CmsCompareEntryRevisionsUseCaseImplementation"],"mappings":";;;AAIO,MAAMA,kCAAkCC,cAAc;IACzD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;IACvB;AACJ"}
@@ -0,0 +1,2 @@
1
+ export { CmsCompareEntryRevisionsFeature } from "./feature.js";
2
+ export { CmsCompareEntryRevisionsUseCase } from "./abstractions.js";
@@ -0,0 +1,2 @@
1
+ export { CmsCompareEntryRevisionsFeature } from "./feature.js";
2
+ export { CmsCompareEntryRevisionsUseCase } from "./abstractions.js";
@@ -0,0 +1,33 @@
1
+ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
2
+ import { WebsocketsSendToIdentityUseCase } from "@webiny/api-websockets/features/SendToIdentity/abstractions.js";
3
+ import { CmsGenerateEntryContentUseCase } from "../../../api/features/CmsGenerateEntryContent/index.js";
4
+ import { IdentityContext } from "@webiny/api-core/exports/api/security.js";
5
+ export declare const CMS_GENERATE_ENTRY_CONTENT_TASK_ID = "aiPowerUpsGenerateEntryContent";
6
+ export interface ICmsGenerateEntryContentTaskInput {
7
+ prompt: string;
8
+ modelId: string;
9
+ projectId?: string | null;
10
+ excludedFileIds?: string[] | null;
11
+ readerPersonaId?: string | null;
12
+ writerPersonaId?: string | null;
13
+ additionalFileIds?: string[] | null;
14
+ }
15
+ declare class CmsGenerateEntryContentTaskImpl implements TaskDefinition.Interface<ICmsGenerateEntryContentTaskInput> {
16
+ private identityContext;
17
+ private generateEntryContent;
18
+ private sendToIdentity;
19
+ id: string;
20
+ title: string;
21
+ description: string;
22
+ maxIterations: number;
23
+ isPrivate: boolean;
24
+ databaseLogs: boolean;
25
+ constructor(identityContext: IdentityContext.Interface, generateEntryContent: CmsGenerateEntryContentUseCase.Interface, sendToIdentity: WebsocketsSendToIdentityUseCase.Interface);
26
+ run({ input, controller }: TaskDefinition.RunParams<ICmsGenerateEntryContentTaskInput>): Promise<TaskDefinition.Result<ICmsGenerateEntryContentTaskInput>>;
27
+ private sendContentToUser;
28
+ private sendErrorToUser;
29
+ }
30
+ export declare const CmsGenerateEntryContentTask: typeof CmsGenerateEntryContentTaskImpl & {
31
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
32
+ };
33
+ export {};
@@ -0,0 +1,84 @@
1
+ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
2
+ import { WebsocketsSendToIdentityUseCase } from "@webiny/api-websockets/features/SendToIdentity/abstractions.js";
3
+ import { compressJson } from "@webiny/utils/features/compression/legacy/gzip.js";
4
+ import { CmsGenerateEntryContentUseCase } from "./index.js";
5
+ import { IdentityContext } from "@webiny/api-core/exports/api/security.js";
6
+ const CMS_GENERATE_ENTRY_CONTENT_TASK_ID = "aiPowerUpsGenerateEntryContent";
7
+ class CmsGenerateEntryContentTaskImpl {
8
+ constructor(identityContext, generateEntryContent, sendToIdentity){
9
+ this.identityContext = identityContext;
10
+ this.generateEntryContent = generateEntryContent;
11
+ this.sendToIdentity = sendToIdentity;
12
+ this.id = CMS_GENERATE_ENTRY_CONTENT_TASK_ID;
13
+ this.title = "AI Power-Ups - Generate Entry Content";
14
+ this.description = "Generates CMS entry content using AI based on a user prompt.";
15
+ this.maxIterations = 1;
16
+ this.isPrivate = true;
17
+ this.databaseLogs = false;
18
+ }
19
+ async run({ input, controller }) {
20
+ if (controller.runtime.isAborted()) return controller.response.aborted();
21
+ const identity = this.identityContext.getIdentity();
22
+ let result;
23
+ try {
24
+ result = await this.generateEntryContent.execute({
25
+ prompt: input.prompt,
26
+ modelId: input.modelId,
27
+ projectId: input.projectId,
28
+ excludedFileIds: input.excludedFileIds,
29
+ readerPersonaId: input.readerPersonaId,
30
+ writerPersonaId: input.writerPersonaId,
31
+ additionalFileIds: input.additionalFileIds
32
+ });
33
+ } catch (err) {
34
+ const message = err instanceof Error ? err.message : String(err);
35
+ await this.sendErrorToUser(identity.id, message);
36
+ return controller.response.error({
37
+ message
38
+ });
39
+ }
40
+ if (result.isFail()) {
41
+ await this.sendErrorToUser(identity.id, result.error.message);
42
+ return controller.response.error({
43
+ message: result.error.message
44
+ });
45
+ }
46
+ const compressed = await compressJson(result.value.values);
47
+ const payload = compressed.toString("base64");
48
+ await this.sendContentToUser(identity.id, payload, result.value.telemetry);
49
+ return controller.response.done("Entry content generated successfully.");
50
+ }
51
+ async sendContentToUser(identityId, payload, telemetry) {
52
+ await this.sendToIdentity.execute({
53
+ id: identityId
54
+ }, {
55
+ action: "aiPowerUps.generateEntryContent.content",
56
+ data: {
57
+ compression: "gzip",
58
+ value: payload,
59
+ telemetry
60
+ }
61
+ });
62
+ }
63
+ async sendErrorToUser(identityId, message) {
64
+ await this.sendToIdentity.execute({
65
+ id: identityId
66
+ }, {
67
+ action: "aiPowerUps.generateEntryContent.error",
68
+ data: {
69
+ message
70
+ }
71
+ });
72
+ }
73
+ }
74
+ const CmsGenerateEntryContentTask = TaskDefinition.createImplementation({
75
+ implementation: CmsGenerateEntryContentTaskImpl,
76
+ dependencies: [
77
+ IdentityContext,
78
+ CmsGenerateEntryContentUseCase,
79
+ WebsocketsSendToIdentityUseCase
80
+ ]
81
+ });
82
+ export { CMS_GENERATE_ENTRY_CONTENT_TASK_ID, CmsGenerateEntryContentTask };
83
+
84
+ //# sourceMappingURL=CmsGenerateEntryContentTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.js","sources":["../../../../src/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.ts"],"sourcesContent":["import { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { WebsocketsSendToIdentityUseCase } from \"@webiny/api-websockets/features/SendToIdentity/abstractions.js\";\nimport { compressJson } from \"@webiny/utils/features/compression/legacy/gzip.js\";\nimport { CmsGenerateEntryContentUseCase } from \"~/api/features/CmsGenerateEntryContent/index.js\";\nimport type { GenerateEntryContentTelemetry } from \"~/api/features/CmsGenerateEntryContent/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/exports/api/security.js\";\n\nexport const CMS_GENERATE_ENTRY_CONTENT_TASK_ID = \"aiPowerUpsGenerateEntryContent\";\n\nexport interface ICmsGenerateEntryContentTaskInput {\n prompt: string;\n modelId: string;\n projectId?: string | null;\n excludedFileIds?: string[] | null;\n readerPersonaId?: string | null;\n writerPersonaId?: string | null;\n additionalFileIds?: string[] | null;\n}\n\nclass CmsGenerateEntryContentTaskImpl implements TaskDefinition.Interface<ICmsGenerateEntryContentTaskInput> {\n id = CMS_GENERATE_ENTRY_CONTENT_TASK_ID;\n title = \"AI Power-Ups - Generate Entry Content\";\n description = \"Generates CMS entry content using AI based on a user prompt.\";\n maxIterations = 1;\n isPrivate = true;\n databaseLogs = false;\n\n constructor(\n private identityContext: IdentityContext.Interface,\n private generateEntryContent: CmsGenerateEntryContentUseCase.Interface,\n private sendToIdentity: WebsocketsSendToIdentityUseCase.Interface\n ) {}\n\n async run({\n input,\n controller\n }: TaskDefinition.RunParams<ICmsGenerateEntryContentTaskInput>): Promise<\n TaskDefinition.Result<ICmsGenerateEntryContentTaskInput>\n > {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n const identity = this.identityContext.getIdentity();\n\n let result;\n try {\n result = await this.generateEntryContent.execute({\n prompt: input.prompt,\n modelId: input.modelId,\n projectId: input.projectId,\n excludedFileIds: input.excludedFileIds,\n readerPersonaId: input.readerPersonaId,\n writerPersonaId: input.writerPersonaId,\n additionalFileIds: input.additionalFileIds\n });\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n await this.sendErrorToUser(identity.id, message);\n return controller.response.error({ message });\n }\n\n if (result.isFail()) {\n await this.sendErrorToUser(identity.id, result.error.message);\n\n return controller.response.error({\n message: result.error.message\n });\n }\n\n // Serialize at the transport edge: the use case returns structured values; the\n // websocket stream carries a gzip+base64 JSON string that the Admin app decodes.\n const compressed = await compressJson(result.value.values);\n const payload = compressed.toString(\"base64\");\n\n await this.sendContentToUser(identity.id, payload, result.value.telemetry);\n\n return controller.response.done(\"Entry content generated successfully.\");\n }\n\n private async sendContentToUser(\n identityId: string,\n payload: string,\n telemetry: GenerateEntryContentTelemetry\n ) {\n await this.sendToIdentity.execute(\n { id: identityId },\n {\n action: \"aiPowerUps.generateEntryContent.content\",\n data: {\n compression: \"gzip\",\n value: payload,\n telemetry\n }\n }\n );\n }\n\n private async sendErrorToUser(identityId: string, message: string) {\n await this.sendToIdentity.execute(\n { id: identityId },\n {\n action: \"aiPowerUps.generateEntryContent.error\",\n data: {\n message\n }\n }\n );\n }\n}\n\nexport const CmsGenerateEntryContentTask = TaskDefinition.createImplementation({\n implementation: CmsGenerateEntryContentTaskImpl,\n dependencies: [IdentityContext, CmsGenerateEntryContentUseCase, WebsocketsSendToIdentityUseCase]\n});\n"],"names":["CMS_GENERATE_ENTRY_CONTENT_TASK_ID","CmsGenerateEntryContentTaskImpl","identityContext","generateEntryContent","sendToIdentity","input","controller","identity","result","err","message","Error","String","compressed","compressJson","payload","identityId","telemetry","CmsGenerateEntryContentTask","TaskDefinition","IdentityContext","CmsGenerateEntryContentUseCase","WebsocketsSendToIdentityUseCase"],"mappings":";;;;;AAOO,MAAMA,qCAAqC;AAYlD,MAAMC;IAQF,YACYC,eAA0C,EAC1CC,oBAA8D,EAC9DC,cAAyD,CACnE;aAHUF,eAAe,GAAfA;aACAC,oBAAoB,GAApBA;aACAC,cAAc,GAAdA;aAVZ,EAAE,GAAGJ;aACL,KAAK,GAAG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EAClBD,OAAe,EACfE,SAAwC,EAC1C;QACE,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B;YAAE,IAAID;QAAW,GACjB;YACI,QAAQ;YACR,MAAM;gBACF,aAAa;gBACb,OAAOD;gBACPE;YACJ;QACJ;IAER;IAEA,MAAc,gBAAgBD,UAAkB,EAAEN,OAAe,EAAE;QAC/D,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B;YAAE,IAAIM;QAAW,GACjB;YACI,QAAQ;YACR,MAAM;gBACFN;YACJ;QACJ;IAER;AACJ;AAEO,MAAMQ,8BAA8BC,eAAe,oBAAoB,CAAC;IAC3E,gBAAgBlB;IAChB,cAAc;QAACmB;QAAiBC;QAAgCC;KAAgC;AACpG"}
@@ -0,0 +1,27 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { Ai } from "@webiny/api-core/features/ai/index.js";
3
+ import { AiSdkTools } from "@webiny/api-core/features/ai/index.js";
4
+ import { AiToolPipelineRunner } from "@webiny/api-core/features/ai/index.js";
5
+ import { ListTagsUseCase } from "@webiny/api-file-manager/features/file/ListTags/index.js";
6
+ import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
7
+ import { ModelToAstConverter } from "@webiny/api-headless-cms/features/contentModel/ModelToAstConverter/index.js";
8
+ import { ResolveAiCapabilityUseCase } from "../../../api/features/Capabilities/index.js";
9
+ import { AiPromptContextBuilder } from "../../../api/features/AiPromptContext/index.js";
10
+ import { CmsGenerateEntryContentUseCase } from "./abstractions.js";
11
+ import type { CmsGenerateEntryContentParams, GenerateEntryContentResult } from "./abstractions.js";
12
+ declare class CmsGenerateEntryContentUseCaseImpl implements CmsGenerateEntryContentUseCase.Interface {
13
+ private promptContextBuilder;
14
+ private resolveCapability;
15
+ private ai;
16
+ private aiSdkTools;
17
+ private listTags;
18
+ private getModel;
19
+ private modelToAst;
20
+ private toolPipelineRunner;
21
+ constructor(promptContextBuilder: AiPromptContextBuilder.Interface, resolveCapability: ResolveAiCapabilityUseCase.Interface, ai: Ai.Interface, aiSdkTools: AiSdkTools.Interface, listTags: ListTagsUseCase.Interface, getModel: GetModelUseCase.Interface, modelToAst: ModelToAstConverter.Interface, toolPipelineRunner: AiToolPipelineRunner.Interface);
22
+ execute<TValues = Record<string, any>>(params: CmsGenerateEntryContentParams): Promise<Result<GenerateEntryContentResult<TValues>, Error>>;
23
+ }
24
+ export declare const CmsGenerateEntryContentUseCaseImplementation: typeof CmsGenerateEntryContentUseCaseImpl & {
25
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICmsGenerateEntryContentUseCase>;
26
+ };
27
+ export {};
@@ -0,0 +1,133 @@
1
+ import { stepCountIs } from "ai";
2
+ import { Result } from "@webiny/feature/api";
3
+ import { Ai, AiSdkTools, AiToolPipelineRunner } from "@webiny/api-core/features/ai/index.js";
4
+ import { ListTagsUseCase } from "@webiny/api-file-manager/features/file/ListTags/index.js";
5
+ import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
6
+ import { ModelToAstConverter } from "@webiny/api-headless-cms/features/contentModel/ModelToAstConverter/index.js";
7
+ import { CmsModelToJsonSchemaConverter } from "@webiny/api-headless-cms/utils/contentModelToJsonSchema/index.js";
8
+ import { ResolveAiCapabilityUseCase, withAdditionalInstructions } from "../Capabilities/index.js";
9
+ import { CMS_GENERATE_ENTRY_CAPABILITY } from "./capability.js";
10
+ import { AiPromptContextBuilder, formatAdditionalFilesContext } from "../AiPromptContext/index.js";
11
+ import { createReadProjectFileTool } from "../AiPromptContext/ReadProjectFileTool.js";
12
+ import { CmsGenerateEntryContentUseCase } from "./abstractions.js";
13
+ import { buildEntryPrompt } from "./buildPrompt.js";
14
+ import { LlmJsonResponse } from "../../../domain/LlmJsonResponse.js";
15
+ import { injectDynamicZoneTypenames } from "./injectDynamicZoneTypenames.js";
16
+ class CmsGenerateEntryContentUseCaseImpl {
17
+ constructor(promptContextBuilder, resolveCapability, ai, aiSdkTools, listTags, getModel, modelToAst, toolPipelineRunner){
18
+ this.promptContextBuilder = promptContextBuilder;
19
+ this.resolveCapability = resolveCapability;
20
+ this.ai = ai;
21
+ this.aiSdkTools = aiSdkTools;
22
+ this.listTags = listTags;
23
+ this.getModel = getModel;
24
+ this.modelToAst = modelToAst;
25
+ this.toolPipelineRunner = toolPipelineRunner;
26
+ }
27
+ async execute(params) {
28
+ const resolved = await this.resolveCapability.execute(CMS_GENERATE_ENTRY_CAPABILITY);
29
+ if (resolved.isFail()) return Result.fail(resolved.error);
30
+ const capability = resolved.value;
31
+ const modelResult = await this.getModel.execute(params.modelId);
32
+ if (modelResult.isFail()) return Result.fail(new Error(`Content model "${params.modelId}" not found.`));
33
+ const model = modelResult.value;
34
+ const modelAst = this.modelToAst.toAst(model);
35
+ const jsonSchemaConverter = new CmsModelToJsonSchemaConverter();
36
+ const entrySchema = jsonSchemaConverter.convert(modelAst, {
37
+ name: model.name,
38
+ description: model.description
39
+ });
40
+ const sdkTools = this.aiSdkTools.getToolSet();
41
+ const context = await this.promptContextBuilder.execute({
42
+ projectId: params.projectId,
43
+ readerPersonaId: params.readerPersonaId,
44
+ writerPersonaId: params.writerPersonaId,
45
+ excludedFileIds: params.excludedFileIds,
46
+ additionalFileIds: params.additionalFileIds
47
+ });
48
+ if (context.allProjectFiles.length > 0) {
49
+ const projectFileTool = createReadProjectFileTool(context.allProjectFiles, context.excludedFileIds);
50
+ Object.assign(sdkTools, projectFileTool);
51
+ }
52
+ const tagsResult = await this.listTags.execute({
53
+ where: {
54
+ type_startsWith: "image/"
55
+ },
56
+ limit: 100
57
+ });
58
+ const imageTags = tagsResult.isOk() ? tagsResult.value.map((t)=>t.tag) : [];
59
+ const systemText = withAdditionalInstructions(capability, buildEntryPrompt(model.name, entrySchema, imageTags) + context.toString());
60
+ const system = {
61
+ role: "system",
62
+ content: systemText,
63
+ providerOptions: {
64
+ anthropic: {
65
+ cacheControl: {
66
+ type: "ephemeral"
67
+ }
68
+ }
69
+ }
70
+ };
71
+ try {
72
+ const aiResult = await this.ai.generateText({
73
+ model: capability.model,
74
+ connection: capability.connection,
75
+ system,
76
+ toolChoice: "auto",
77
+ prompt: params.prompt + formatAdditionalFilesContext(context.additionalFiles),
78
+ ...Object.keys(sdkTools).length > 0 ? {
79
+ tools: sdkTools,
80
+ stopWhen: stepCountIs(20)
81
+ } : {}
82
+ });
83
+ const text = aiResult.text || (aiResult.steps.filter((step)=>step.text.length > 0).pop()?.text ?? "");
84
+ const entry = LlmJsonResponse.fromRawText(text).toArray().pop();
85
+ let resolved;
86
+ if (entry) {
87
+ resolved = await this.toolPipelineRunner.resolve(entry);
88
+ await injectDynamicZoneTypenames(resolved, modelAst, model.singularApiName);
89
+ }
90
+ const filesRead = new Set();
91
+ let toolCallsMade = 0;
92
+ for (const step of aiResult.steps)for (const call of step.toolCalls){
93
+ toolCallsMade++;
94
+ if ("read_project_file" === call.toolName) {
95
+ const input = call.input;
96
+ if (input.fileId) filesRead.add(input.fileId);
97
+ }
98
+ }
99
+ const telemetry = {
100
+ filesRead: [
101
+ ...filesRead
102
+ ],
103
+ cacheHit: context.cacheHit,
104
+ toolCallsMade,
105
+ totalSteps: aiResult.steps.length,
106
+ toolsAvailable: Object.keys(sdkTools),
107
+ imageTagsInPrompt: imageTags
108
+ };
109
+ return Result.ok({
110
+ values: resolved ?? {},
111
+ telemetry
112
+ });
113
+ } catch (error) {
114
+ return Result.fail(new Error(`AI generation failed: ${error instanceof Error ? error.message : String(error)}`));
115
+ }
116
+ }
117
+ }
118
+ const CmsGenerateEntryContentUseCaseImplementation = CmsGenerateEntryContentUseCase.createImplementation({
119
+ implementation: CmsGenerateEntryContentUseCaseImpl,
120
+ dependencies: [
121
+ AiPromptContextBuilder,
122
+ ResolveAiCapabilityUseCase,
123
+ Ai,
124
+ AiSdkTools,
125
+ ListTagsUseCase,
126
+ GetModelUseCase,
127
+ ModelToAstConverter,
128
+ AiToolPipelineRunner
129
+ ]
130
+ });
131
+ export { CmsGenerateEntryContentUseCaseImplementation };
132
+
133
+ //# sourceMappingURL=CmsGenerateEntryContentUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/CmsGenerateEntryContent/CmsGenerateEntryContentUseCase.js","sources":["../../../../src/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentUseCase.ts"],"sourcesContent":["import { stepCountIs } from \"ai\";\nimport { Result } from \"@webiny/feature/api\";\nimport { Ai } from \"@webiny/api-core/features/ai/index.js\";\nimport { AiSdkTools } from \"@webiny/api-core/features/ai/index.js\";\nimport { AiToolPipelineRunner } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListTagsUseCase } from \"@webiny/api-file-manager/features/file/ListTags/index.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { ModelToAstConverter } from \"@webiny/api-headless-cms/features/contentModel/ModelToAstConverter/index.js\";\nimport { CmsModelToJsonSchemaConverter } from \"@webiny/api-headless-cms/utils/contentModelToJsonSchema/index.js\";\nimport {\n ResolveAiCapabilityUseCase,\n withAdditionalInstructions\n} from \"~/api/features/Capabilities/index.js\";\nimport { CMS_GENERATE_ENTRY_CAPABILITY } from \"./capability.js\";\nimport {\n AiPromptContextBuilder,\n formatAdditionalFilesContext\n} from \"~/api/features/AiPromptContext/index.js\";\nimport { createReadProjectFileTool } from \"~/api/features/AiPromptContext/ReadProjectFileTool.js\";\nimport { CmsGenerateEntryContentUseCase } from \"./abstractions.js\";\nimport type {\n CmsGenerateEntryContentParams,\n GenerateEntryContentResult,\n GenerateEntryContentTelemetry\n} from \"./abstractions.js\";\nimport { buildEntryPrompt } from \"./buildPrompt.js\";\nimport { LlmJsonResponse } from \"~/domain/LlmJsonResponse.js\";\nimport { injectDynamicZoneTypenames } from \"./injectDynamicZoneTypenames.js\";\n\nclass CmsGenerateEntryContentUseCaseImpl implements CmsGenerateEntryContentUseCase.Interface {\n constructor(\n private promptContextBuilder: AiPromptContextBuilder.Interface,\n private resolveCapability: ResolveAiCapabilityUseCase.Interface,\n private ai: Ai.Interface,\n private aiSdkTools: AiSdkTools.Interface,\n private listTags: ListTagsUseCase.Interface,\n private getModel: GetModelUseCase.Interface,\n private modelToAst: ModelToAstConverter.Interface,\n private toolPipelineRunner: AiToolPipelineRunner.Interface\n ) {}\n\n async execute<TValues = Record<string, any>>(\n params: CmsGenerateEntryContentParams\n ): Promise<Result<GenerateEntryContentResult<TValues>, Error>> {\n const resolved = await this.resolveCapability.execute(CMS_GENERATE_ENTRY_CAPABILITY);\n if (resolved.isFail()) {\n return Result.fail(resolved.error);\n }\n\n const capability = resolved.value;\n\n const modelResult = await this.getModel.execute(params.modelId);\n if (modelResult.isFail()) {\n return Result.fail(new Error(`Content model \"${params.modelId}\" not found.`));\n }\n\n const model = modelResult.value;\n const modelAst = this.modelToAst.toAst(model);\n const jsonSchemaConverter = new CmsModelToJsonSchemaConverter();\n const entrySchema = jsonSchemaConverter.convert(modelAst, {\n name: model.name,\n description: model.description\n });\n\n const sdkTools = this.aiSdkTools.getToolSet();\n\n const context = await this.promptContextBuilder.execute({\n projectId: params.projectId,\n readerPersonaId: params.readerPersonaId,\n writerPersonaId: params.writerPersonaId,\n excludedFileIds: params.excludedFileIds,\n additionalFileIds: params.additionalFileIds\n });\n\n if (context.allProjectFiles.length > 0) {\n const projectFileTool = createReadProjectFileTool(\n context.allProjectFiles,\n context.excludedFileIds\n );\n Object.assign(sdkTools, projectFileTool);\n }\n\n const tagsResult = await this.listTags.execute({\n where: { type_startsWith: \"image/\" },\n limit: 100\n });\n const imageTags = tagsResult.isOk() ? tagsResult.value.map(t => t.tag) : [];\n\n const systemText = withAdditionalInstructions(\n capability,\n buildEntryPrompt(model.name, entrySchema, imageTags) + context.toString()\n );\n\n const system = {\n role: \"system\" as const,\n content: systemText,\n providerOptions: {\n anthropic: {\n cacheControl: { type: \"ephemeral\" }\n }\n }\n };\n\n try {\n const aiResult = await this.ai.generateText({\n model: capability.model,\n connection: capability.connection,\n system,\n toolChoice: \"auto\",\n prompt: params.prompt + formatAdditionalFilesContext(context.additionalFiles),\n ...(Object.keys(sdkTools).length > 0\n ? { tools: sdkTools, stopWhen: stepCountIs(20) }\n : {})\n });\n\n const text =\n aiResult.text ||\n (aiResult.steps.filter(step => step.text.length > 0).pop()?.text ?? \"\");\n\n const entry = LlmJsonResponse.fromRawText(text).toArray().pop();\n\n let resolved: Record<string, any> | undefined;\n\n if (entry) {\n resolved = (await this.toolPipelineRunner.resolve(entry)) as Record<string, any>;\n await injectDynamicZoneTypenames(resolved, modelAst, model.singularApiName);\n }\n\n const filesRead = new Set<string>();\n let toolCallsMade = 0;\n for (const step of aiResult.steps) {\n for (const call of step.toolCalls) {\n toolCallsMade++;\n if (call.toolName === \"read_project_file\") {\n const input = call.input as { fileId?: string };\n if (input.fileId) {\n filesRead.add(input.fileId);\n }\n }\n }\n }\n\n const telemetry: GenerateEntryContentTelemetry = {\n filesRead: [...filesRead],\n cacheHit: context.cacheHit,\n toolCallsMade,\n totalSteps: aiResult.steps.length,\n toolsAvailable: Object.keys(sdkTools),\n imageTagsInPrompt: imageTags\n };\n\n // Boundary cast: the AI output is dynamic JSON, so this is the one honest point\n // where we hand the resolved values to the caller's chosen `TValues` shape.\n return Result.ok({ values: (resolved ?? {}) as TValues, telemetry });\n } catch (error) {\n return Result.fail(\n new Error(\n `AI generation failed: ${error instanceof Error ? error.message : String(error)}`\n )\n );\n }\n }\n}\n\nexport const CmsGenerateEntryContentUseCaseImplementation =\n CmsGenerateEntryContentUseCase.createImplementation({\n implementation: CmsGenerateEntryContentUseCaseImpl,\n dependencies: [\n AiPromptContextBuilder,\n ResolveAiCapabilityUseCase,\n Ai,\n AiSdkTools,\n ListTagsUseCase,\n GetModelUseCase,\n ModelToAstConverter,\n AiToolPipelineRunner\n ]\n });\n"],"names":["CmsGenerateEntryContentUseCaseImpl","promptContextBuilder","resolveCapability","ai","aiSdkTools","listTags","getModel","modelToAst","toolPipelineRunner","params","resolved","CMS_GENERATE_ENTRY_CAPABILITY","Result","capability","modelResult","Error","model","modelAst","jsonSchemaConverter","CmsModelToJsonSchemaConverter","entrySchema","sdkTools","context","projectFileTool","createReadProjectFileTool","Object","tagsResult","imageTags","t","systemText","withAdditionalInstructions","buildEntryPrompt","system","aiResult","formatAdditionalFilesContext","stepCountIs","text","step","entry","LlmJsonResponse","injectDynamicZoneTypenames","filesRead","Set","toolCallsMade","call","input","telemetry","error","String","CmsGenerateEntryContentUseCaseImplementation","CmsGenerateEntryContentUseCase","AiPromptContextBuilder","ResolveAiCapabilityUseCase","Ai","AiSdkTools","ListTagsUseCase","GetModelUseCase","ModelToAstConverter","AiToolPipelineRunner"],"mappings":";;;;;;;;;;;;;;;AA6BA,MAAMA;IACF,YACYC,oBAAsD,EACtDC,iBAAuD,EACvDC,EAAgB,EAChBC,UAAgC,EAChCC,QAAmC,EACnCC,QAAmC,EACnCC,UAAyC,EACzCC,kBAAkD,CAC5D;aARUP,oBAAoB,GAApBA;aACAC,iBAAiB,GAAjBA;aACAC,EAAE,GAAFA;aACAC,UAAU,GAAVA;aACAC,QAAQ,GAARA;aACAC,QAAQ,GAARA;aACAC,UAAU,GAAVA;aACAC,kBAAkB,GAAlBA;IACT;IAEH,MAAM,QACFC,MAAqC,EACsB;QAC3D,MAAMC,WAAW,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAACC;QACtD,IAAID,SAAS,MAAM,IACf,OAAOE,OAAO,IAAI,CAACF,SAAS,KAAK;QAGrC,MAAMG,aAAaH,SAAS,KAAK;QAEjC,MAAMI,cAAc,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACL,OAAO,OAAO;QAC9D,IAAIK,YAAY,MAAM,IAClB,OAAOF,OAAO,IAAI,CAAC,IAAIG,MAAM,CAAC,eAAe,EAAEN,OAAO,OAAO,CAAC,YAAY,CAAC;QAG/E,MAAMO,QAAQF,YAAY,KAAK;QAC/B,MAAMG,WAAW,IAAI,CAAC,UAAU,CAAC,KAAK,CAACD;QACvC,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ChD,gBAAgBlD;IAChB,cAAc;QACVmD;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,36 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ export interface CmsGenerateEntryContentParams {
3
+ prompt: string;
4
+ modelId: string;
5
+ projectId?: string | null;
6
+ excludedFileIds?: string[] | null;
7
+ readerPersonaId?: string | null;
8
+ writerPersonaId?: string | null;
9
+ additionalFileIds?: string[] | null;
10
+ }
11
+ export interface GenerateEntryContentTelemetry {
12
+ filesRead: string[];
13
+ cacheHit: boolean;
14
+ toolCallsMade: number;
15
+ totalSteps: number;
16
+ toolsAvailable: string[];
17
+ imageTagsInPrompt: string[];
18
+ }
19
+ export interface GenerateEntryContentResult<TValues = Record<string, any>> {
20
+ /**
21
+ * The generated entry values, keyed by fieldId. Callers that consume the result
22
+ * directly (e.g. a bulk action) can read fields straight off this object; transport
23
+ * edges (the background task / websocket stream) serialize it themselves. Pass a type
24
+ * argument to `execute` to shape this (e.g. `execute<{ aiSummary?: string }>`).
25
+ */
26
+ values: TValues;
27
+ telemetry: GenerateEntryContentTelemetry;
28
+ }
29
+ export interface ICmsGenerateEntryContentUseCase {
30
+ execute<TValues = Record<string, any>>(params: CmsGenerateEntryContentParams): Promise<Result<GenerateEntryContentResult<TValues>, Error>>;
31
+ }
32
+ export declare const CmsGenerateEntryContentUseCase: import("@webiny/di").Abstraction<ICmsGenerateEntryContentUseCase>;
33
+ export declare namespace CmsGenerateEntryContentUseCase {
34
+ type Interface = ICmsGenerateEntryContentUseCase;
35
+ type Params = CmsGenerateEntryContentParams;
36
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CmsGenerateEntryContentUseCase = createAbstraction("AiPowerUpsCmsGenerateEntryContentUseCase");
3
+ export { CmsGenerateEntryContentUseCase };
4
+
5
+ //# sourceMappingURL=abstractions.js.map