@webiny/ai-powerups 6.4.12-beta.4 → 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,34 @@
1
+ import { MainGraphQLClient } from "@webiny/app/exports/admin.js";
2
+ import { ListCapabilitiesGateway } from "./abstractions.js";
3
+ const LIST_CAPABILITIES = `
4
+ query ListAiCapabilities {
5
+ aiPowerUps {
6
+ listCapabilities {
7
+ id
8
+ label
9
+ description
10
+ defaultRole
11
+ }
12
+ }
13
+ }
14
+ `;
15
+ class ListCapabilitiesGatewayImpl {
16
+ constructor(client){
17
+ this.client = client;
18
+ }
19
+ async execute() {
20
+ const response = await this.client.execute({
21
+ query: LIST_CAPABILITIES
22
+ });
23
+ return response.aiPowerUps.listCapabilities ?? [];
24
+ }
25
+ }
26
+ const ListCapabilitiesGateway_ListCapabilitiesGateway = ListCapabilitiesGateway.createImplementation({
27
+ implementation: ListCapabilitiesGatewayImpl,
28
+ dependencies: [
29
+ MainGraphQLClient
30
+ ]
31
+ });
32
+ export { ListCapabilitiesGateway_ListCapabilitiesGateway as ListCapabilitiesGateway };
33
+
34
+ //# sourceMappingURL=ListCapabilitiesGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/listCapabilities/ListCapabilitiesGateway.js","sources":["../../../../src/admin/features/listCapabilities/ListCapabilitiesGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/exports/admin.js\";\nimport { ListCapabilitiesGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AiCapability } from \"./abstractions.js\";\n\nconst LIST_CAPABILITIES = /* GraphQL */ `\n query ListAiCapabilities {\n aiPowerUps {\n listCapabilities {\n id\n label\n description\n defaultRole\n }\n }\n }\n`;\n\ntype ListCapabilitiesResponse = {\n aiPowerUps: {\n listCapabilities: AiCapability[];\n };\n};\n\nclass ListCapabilitiesGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute(): Promise<AiCapability[]> {\n const response = await this.client.execute<ListCapabilitiesResponse>({\n query: LIST_CAPABILITIES\n });\n\n return response.aiPowerUps.listCapabilities ?? [];\n }\n}\n\nexport const ListCapabilitiesGateway = GatewayAbstraction.createImplementation({\n implementation: ListCapabilitiesGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["LIST_CAPABILITIES","ListCapabilitiesGatewayImpl","client","response","ListCapabilitiesGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAIA,MAAMA,oBAAkC,CAAC;;;;;;;;;;;AAWzC,CAAC;AAQD,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,UAAmC;QACrC,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA2B;YACjE,OAAOH;QACX;QAEA,OAAOG,SAAS,UAAU,CAAC,gBAAgB,IAAI,EAAE;IACrD;AACJ;AAEO,MAAMC,kDAA0BC,wBAAAA,oBAAuC,CAAC;IAC3E,gBAAgBJ;IAChB,cAAc;QAACK;KAAkB;AACrC"}
@@ -0,0 +1,13 @@
1
+ import { ListCapabilitiesRepository as RepoAbstraction, ListCapabilitiesGateway } from "./abstractions.js";
2
+ import type { AiCapability } from "./abstractions.js";
3
+ declare class ListCapabilitiesRepositoryImpl implements RepoAbstraction.Interface {
4
+ private gateway;
5
+ private capabilities;
6
+ constructor(gateway: ListCapabilitiesGateway.Interface);
7
+ execute(): Promise<void>;
8
+ getCapabilities(): AiCapability[];
9
+ }
10
+ export declare const ListCapabilitiesRepository: typeof ListCapabilitiesRepositoryImpl & {
11
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListCapabilitiesRepository>;
12
+ };
13
+ export {};
@@ -0,0 +1,27 @@
1
+ import { makeAutoObservable, runInAction } from "mobx";
2
+ import { ListCapabilitiesGateway, ListCapabilitiesRepository } from "./abstractions.js";
3
+ class ListCapabilitiesRepositoryImpl {
4
+ constructor(gateway){
5
+ this.gateway = gateway;
6
+ this.capabilities = [];
7
+ makeAutoObservable(this);
8
+ }
9
+ async execute() {
10
+ const capabilities = await this.gateway.execute();
11
+ runInAction(()=>{
12
+ this.capabilities = capabilities;
13
+ });
14
+ }
15
+ getCapabilities() {
16
+ return this.capabilities;
17
+ }
18
+ }
19
+ const ListCapabilitiesRepository_ListCapabilitiesRepository = ListCapabilitiesRepository.createImplementation({
20
+ implementation: ListCapabilitiesRepositoryImpl,
21
+ dependencies: [
22
+ ListCapabilitiesGateway
23
+ ]
24
+ });
25
+ export { ListCapabilitiesRepository_ListCapabilitiesRepository as ListCapabilitiesRepository };
26
+
27
+ //# sourceMappingURL=ListCapabilitiesRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/listCapabilities/ListCapabilitiesRepository.js","sources":["../../../../src/admin/features/listCapabilities/ListCapabilitiesRepository.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport {\n ListCapabilitiesRepository as RepoAbstraction,\n ListCapabilitiesGateway\n} from \"./abstractions.js\";\nimport type { AiCapability } from \"./abstractions.js\";\n\nclass ListCapabilitiesRepositoryImpl implements RepoAbstraction.Interface {\n private capabilities: AiCapability[] = [];\n\n constructor(private gateway: ListCapabilitiesGateway.Interface) {\n makeAutoObservable(this);\n }\n\n async execute(): Promise<void> {\n const capabilities = await this.gateway.execute();\n runInAction(() => {\n this.capabilities = capabilities;\n });\n }\n\n getCapabilities(): AiCapability[] {\n return this.capabilities;\n }\n}\n\nexport const ListCapabilitiesRepository = RepoAbstraction.createImplementation({\n implementation: ListCapabilitiesRepositoryImpl,\n dependencies: [ListCapabilitiesGateway]\n});\n"],"names":["ListCapabilitiesRepositoryImpl","gateway","makeAutoObservable","capabilities","runInAction","ListCapabilitiesRepository","RepoAbstraction","ListCapabilitiesGateway"],"mappings":";;AAOA,MAAMA;IAGF,YAAoBC,OAA0C,CAAE;aAA5CA,OAAO,GAAPA;aAFZ,YAAY,GAAmB,EAAE;QAGrCC,mBAAmB,IAAI;IAC3B;IAEA,MAAM,UAAyB;QAC3B,MAAMC,eAAe,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO;QAC/CC,YAAY;YACR,IAAI,CAAC,YAAY,GAAGD;QACxB;IACJ;IAEA,kBAAkC;QAC9B,OAAO,IAAI,CAAC,YAAY;IAC5B;AACJ;AAEO,MAAME,wDAA6BC,2BAAAA,oBAAoC,CAAC;IAC3E,gBAAgBN;IAChB,cAAc;QAACO;KAAwB;AAC3C"}
@@ -0,0 +1,10 @@
1
+ import { ListCapabilitiesUseCase as UseCaseAbstraction, ListCapabilitiesRepository } from "./abstractions.js";
2
+ declare class ListCapabilitiesUseCaseImpl implements UseCaseAbstraction.Interface {
3
+ private repository;
4
+ constructor(repository: ListCapabilitiesRepository.Interface);
5
+ execute(): Promise<void>;
6
+ }
7
+ export declare const ListCapabilitiesUseCase: typeof ListCapabilitiesUseCaseImpl & {
8
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListCapabilitiesUseCase>;
9
+ };
10
+ export {};
@@ -0,0 +1,18 @@
1
+ import { ListCapabilitiesRepository, ListCapabilitiesUseCase } from "./abstractions.js";
2
+ class ListCapabilitiesUseCaseImpl {
3
+ constructor(repository){
4
+ this.repository = repository;
5
+ }
6
+ async execute() {
7
+ return this.repository.execute();
8
+ }
9
+ }
10
+ const ListCapabilitiesUseCase_ListCapabilitiesUseCase = ListCapabilitiesUseCase.createImplementation({
11
+ implementation: ListCapabilitiesUseCaseImpl,
12
+ dependencies: [
13
+ ListCapabilitiesRepository
14
+ ]
15
+ });
16
+ export { ListCapabilitiesUseCase_ListCapabilitiesUseCase as ListCapabilitiesUseCase };
17
+
18
+ //# sourceMappingURL=ListCapabilitiesUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/listCapabilities/ListCapabilitiesUseCase.js","sources":["../../../../src/admin/features/listCapabilities/ListCapabilitiesUseCase.ts"],"sourcesContent":["import {\n ListCapabilitiesUseCase as UseCaseAbstraction,\n ListCapabilitiesRepository\n} from \"./abstractions.js\";\n\nclass ListCapabilitiesUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private repository: ListCapabilitiesRepository.Interface) {}\n\n async execute(): Promise<void> {\n return this.repository.execute();\n }\n}\n\nexport const ListCapabilitiesUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListCapabilitiesUseCaseImpl,\n dependencies: [ListCapabilitiesRepository]\n});\n"],"names":["ListCapabilitiesUseCaseImpl","repository","ListCapabilitiesUseCase","UseCaseAbstraction","ListCapabilitiesRepository"],"mappings":";AAKA,MAAMA;IACF,YAAoBC,UAAgD,CAAE;aAAlDA,UAAU,GAAVA;IAAmD;IAEvE,MAAM,UAAyB;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO;IAClC;AACJ;AAEO,MAAMC,kDAA0BC,wBAAAA,oBAAuC,CAAC;IAC3E,gBAAgBH;IAChB,cAAc;QAACI;KAA2B;AAC9C"}
@@ -0,0 +1,28 @@
1
+ export interface AiCapability {
2
+ id: string;
3
+ label: string;
4
+ description: string;
5
+ defaultRole: string;
6
+ }
7
+ export interface IListCapabilitiesGateway {
8
+ execute(): Promise<AiCapability[]>;
9
+ }
10
+ export declare const ListCapabilitiesGateway: import("@webiny/di").Abstraction<IListCapabilitiesGateway>;
11
+ export declare namespace ListCapabilitiesGateway {
12
+ type Interface = IListCapabilitiesGateway;
13
+ }
14
+ export interface IListCapabilitiesRepository {
15
+ execute(): Promise<void>;
16
+ getCapabilities(): AiCapability[];
17
+ }
18
+ export declare const ListCapabilitiesRepository: import("@webiny/di").Abstraction<IListCapabilitiesRepository>;
19
+ export declare namespace ListCapabilitiesRepository {
20
+ type Interface = IListCapabilitiesRepository;
21
+ }
22
+ export interface IListCapabilitiesUseCase {
23
+ execute(): Promise<void>;
24
+ }
25
+ export declare const ListCapabilitiesUseCase: import("@webiny/di").Abstraction<IListCapabilitiesUseCase>;
26
+ export declare namespace ListCapabilitiesUseCase {
27
+ type Interface = IListCapabilitiesUseCase;
28
+ }
@@ -0,0 +1,7 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ const ListCapabilitiesGateway = createAbstraction("AiPowerUps/ListCapabilitiesGateway");
3
+ const ListCapabilitiesRepository = createAbstraction("AiPowerUps/ListCapabilitiesRepository");
4
+ const ListCapabilitiesUseCase = createAbstraction("AiPowerUps/ListCapabilitiesUseCase");
5
+ export { ListCapabilitiesGateway, ListCapabilitiesRepository, ListCapabilitiesUseCase };
6
+
7
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/listCapabilities/abstractions.js","sources":["../../../../src/admin/features/listCapabilities/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport interface AiCapability {\n id: string;\n label: string;\n description: string;\n defaultRole: string;\n}\n\nexport interface IListCapabilitiesGateway {\n execute(): Promise<AiCapability[]>;\n}\n\nexport const ListCapabilitiesGateway = createAbstraction<IListCapabilitiesGateway>(\n \"AiPowerUps/ListCapabilitiesGateway\"\n);\nexport namespace ListCapabilitiesGateway {\n export type Interface = IListCapabilitiesGateway;\n}\n\nexport interface IListCapabilitiesRepository {\n execute(): Promise<void>;\n getCapabilities(): AiCapability[];\n}\n\nexport const ListCapabilitiesRepository = createAbstraction<IListCapabilitiesRepository>(\n \"AiPowerUps/ListCapabilitiesRepository\"\n);\nexport namespace ListCapabilitiesRepository {\n export type Interface = IListCapabilitiesRepository;\n}\n\nexport interface IListCapabilitiesUseCase {\n execute(): Promise<void>;\n}\n\nexport const ListCapabilitiesUseCase = createAbstraction<IListCapabilitiesUseCase>(\n \"AiPowerUps/ListCapabilitiesUseCase\"\n);\nexport namespace ListCapabilitiesUseCase {\n export type Interface = IListCapabilitiesUseCase;\n}\n"],"names":["ListCapabilitiesGateway","createAbstraction","ListCapabilitiesRepository","ListCapabilitiesUseCase"],"mappings":";AAaO,MAAMA,0BAA0BC,kBACnC;AAWG,MAAMC,6BAA6BD,kBACtC;AAUG,MAAME,0BAA0BF,kBACnC"}
@@ -0,0 +1,3 @@
1
+ export declare const ListCapabilitiesFeature: import("@webiny/feature/admin").FeatureDefinition<{
2
+ useCase: import("./abstractions.js").IListCapabilitiesUseCase;
3
+ }, []>;
@@ -0,0 +1,21 @@
1
+ import { createFeature } from "@webiny/feature/admin";
2
+ import { ListCapabilitiesUseCase } from "./abstractions.js";
3
+ import { ListCapabilitiesUseCase as external_ListCapabilitiesUseCase_js_ListCapabilitiesUseCase } from "./ListCapabilitiesUseCase.js";
4
+ import { ListCapabilitiesRepository } from "./ListCapabilitiesRepository.js";
5
+ import { ListCapabilitiesGateway } from "./ListCapabilitiesGateway.js";
6
+ const ListCapabilitiesFeature = createFeature({
7
+ name: "AiPowerUps/ListCapabilities",
8
+ register (container) {
9
+ container.register(external_ListCapabilitiesUseCase_js_ListCapabilitiesUseCase);
10
+ container.register(ListCapabilitiesRepository).inSingletonScope();
11
+ container.register(ListCapabilitiesGateway).inSingletonScope();
12
+ },
13
+ resolve (container) {
14
+ return {
15
+ useCase: container.resolve(ListCapabilitiesUseCase)
16
+ };
17
+ }
18
+ });
19
+ export { ListCapabilitiesFeature };
20
+
21
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/listCapabilities/feature.js","sources":["../../../../src/admin/features/listCapabilities/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { ListCapabilitiesUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { ListCapabilitiesUseCase } from \"./ListCapabilitiesUseCase.js\";\nimport { ListCapabilitiesRepository } from \"./ListCapabilitiesRepository.js\";\nimport { ListCapabilitiesGateway } from \"./ListCapabilitiesGateway.js\";\n\nexport const ListCapabilitiesFeature = createFeature({\n name: \"AiPowerUps/ListCapabilities\",\n register(container) {\n container.register(ListCapabilitiesUseCase);\n container.register(ListCapabilitiesRepository).inSingletonScope();\n container.register(ListCapabilitiesGateway).inSingletonScope();\n },\n resolve(container) {\n return {\n useCase: container.resolve(UseCaseAbstraction)\n };\n }\n});\n"],"names":["ListCapabilitiesFeature","createFeature","container","ListCapabilitiesUseCase","ListCapabilitiesRepository","ListCapabilitiesGateway","UseCaseAbstraction"],"mappings":";;;;;AAMO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,4BAA4B,gBAAgB;QAC/DF,UAAU,QAAQ,CAACG,yBAAyB,gBAAgB;IAChE;IACA,SAAQH,SAAS;QACb,OAAO;YACH,SAASA,UAAU,OAAO,CAACI;QAC/B;IACJ;AACJ"}
@@ -0,0 +1,3 @@
1
+ export { ListCapabilitiesFeature } from "./feature.js";
2
+ export { ListCapabilitiesUseCase, ListCapabilitiesRepository, ListCapabilitiesGateway } from "./abstractions.js";
3
+ export type { AiCapability } from "./abstractions.js";
@@ -0,0 +1,2 @@
1
+ export { ListCapabilitiesFeature } from "./feature.js";
2
+ export { ListCapabilitiesGateway, ListCapabilitiesRepository, ListCapabilitiesUseCase } from "./abstractions.js";
@@ -1,5 +1,15 @@
1
+ import { z } from "zod";
1
2
  import { ListModelsGateway } from "./abstractions.js";
2
3
  import { MainGraphQLClient } from "@webiny/app/exports/admin.js";
4
+ const dateField = z.coerce.date().nullable().optional().transform((v)=>v ?? void 0);
5
+ const schema = z.array(z.object({
6
+ providerId: z.string(),
7
+ providerName: z.string(),
8
+ modelId: z.string(),
9
+ modelName: z.string(),
10
+ deprecated: dateField,
11
+ endOfLife: dateField
12
+ }));
3
13
  const LIST_MODELS = `
4
14
  query ListModels {
5
15
  aiPowerUps {
@@ -8,6 +18,8 @@ const LIST_MODELS = `
8
18
  providerName
9
19
  modelId
10
20
  modelName
21
+ deprecated
22
+ endOfLife
11
23
  }
12
24
  }
13
25
  }
@@ -20,7 +32,12 @@ class ListModelsGatewayImpl {
20
32
  const response = await this.client.execute({
21
33
  query: LIST_MODELS
22
34
  });
23
- return response.aiPowerUps.listModels ?? [];
35
+ const result = schema.safeParse(response.aiPowerUps.listModels);
36
+ if (!result.success) {
37
+ console.error(result.error);
38
+ return [];
39
+ }
40
+ return result.data;
24
41
  }
25
42
  }
26
43
  const ListModelsGateway_ListModelsGateway = ListModelsGateway.createImplementation({
@@ -1 +1 @@
1
- {"version":3,"file":"admin/features/listModels/ListModelsGateway.js","sources":["../../../../src/admin/features/listModels/ListModelsGateway.ts"],"sourcesContent":["import { ListModelsGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport { MainGraphQLClient } from \"@webiny/app/exports/admin.js\";\nimport type { AiModel } from \"./abstractions.js\";\n\nconst LIST_MODELS = /* GraphQL */ `\n query ListModels {\n aiPowerUps {\n listModels {\n providerId\n providerName\n modelId\n modelName\n }\n }\n }\n`;\n\ntype ListModelsResponse = {\n aiPowerUps: {\n listModels: AiModel[];\n };\n};\n\nclass ListModelsGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute(): Promise<AiModel[]> {\n const response = await this.client.execute<ListModelsResponse>({\n query: LIST_MODELS\n });\n\n return response.aiPowerUps.listModels ?? [];\n }\n}\n\nexport const ListModelsGateway = GatewayAbstraction.createImplementation({\n implementation: ListModelsGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["LIST_MODELS","ListModelsGatewayImpl","client","response","ListModelsGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAIA,MAAMA,cAA4B,CAAC;;;;;;;;;;;AAWnC,CAAC;AAQD,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,UAA8B;QAChC,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAqB;YAC3D,OAAOH;QACX;QAEA,OAAOG,SAAS,UAAU,CAAC,UAAU,IAAI,EAAE;IAC/C;AACJ;AAEO,MAAMC,sCAAoBC,kBAAAA,oBAAuC,CAAC;IACrE,gBAAgBJ;IAChB,cAAc;QAACK;KAAkB;AACrC"}
1
+ {"version":3,"file":"admin/features/listModels/ListModelsGateway.js","sources":["../../../../src/admin/features/listModels/ListModelsGateway.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { ListModelsGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport { MainGraphQLClient } from \"@webiny/app/exports/admin.js\";\nimport type { AiModel } from \"./abstractions.js\";\n\nconst dateField = z.coerce\n .date()\n .nullable()\n .optional()\n .transform(v => v ?? undefined);\n\nconst schema = z.array(\n z.object({\n providerId: z.string(),\n providerName: z.string(),\n modelId: z.string(),\n modelName: z.string(),\n deprecated: dateField,\n endOfLife: dateField\n })\n);\n\nconst LIST_MODELS = /* GraphQL */ `\n query ListModels {\n aiPowerUps {\n listModels {\n providerId\n providerName\n modelId\n modelName\n deprecated\n endOfLife\n }\n }\n }\n`;\n\ntype ListModelsResponse = {\n aiPowerUps: {\n listModels: AiModel[];\n };\n};\n\nclass ListModelsGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute(): Promise<AiModel[]> {\n const response = await this.client.execute<ListModelsResponse>({\n query: LIST_MODELS\n });\n\n const result = schema.safeParse(response.aiPowerUps.listModels);\n if (!result.success) {\n console.error(result.error);\n return [];\n }\n return result.data;\n }\n}\n\nexport const ListModelsGateway = GatewayAbstraction.createImplementation({\n implementation: ListModelsGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["dateField","z","v","undefined","schema","LIST_MODELS","ListModelsGatewayImpl","client","response","result","console","ListModelsGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;;AAKA,MAAMA,YAAYC,EAAE,MAAM,CAARA,IACT,GACJ,QAAQ,GACR,QAAQ,GACR,SAAS,CAACC,CAAAA,IAAKA,KAAKC;AAEzB,MAAMC,SAASH,EAAE,KAAK,CAClBA,EAAE,MAAM,CAAC;IACL,YAAYA,EAAE,MAAM;IACpB,cAAcA,EAAE,MAAM;IACtB,SAASA,EAAE,MAAM;IACjB,WAAWA,EAAE,MAAM;IACnB,YAAYD;IACZ,WAAWA;AACf;AAGJ,MAAMK,cAA4B,CAAC;;;;;;;;;;;;;AAanC,CAAC;AAQD,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,UAA8B;QAChC,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAqB;YAC3D,OAAOH;QACX;QAEA,MAAMI,SAASL,OAAO,SAAS,CAACI,SAAS,UAAU,CAAC,UAAU;QAC9D,IAAI,CAACC,OAAO,OAAO,EAAE;YACjBC,QAAQ,KAAK,CAACD,OAAO,KAAK;YAC1B,OAAO,EAAE;QACb;QACA,OAAOA,OAAO,IAAI;IACtB;AACJ;AAEO,MAAME,sCAAoBC,kBAAAA,oBAAuC,CAAC;IACrE,gBAAgBN;IAChB,cAAc;QAACO;KAAkB;AACrC"}
@@ -18,6 +18,8 @@ export type AiModel = {
18
18
  providerName: string;
19
19
  modelId: string;
20
20
  modelName: string;
21
+ deprecated: Date | undefined;
22
+ endOfLife: Date | undefined;
21
23
  };
22
24
  export interface IListModelsGateway {
23
25
  execute(): Promise<AiModel[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"admin/features/listModels/abstractions.js","sources":["../../../../src/admin/features/listModels/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport interface IListModelsUseCase {\n execute(): Promise<void>;\n}\n\nexport const ListModelsUseCase = createAbstraction<IListModelsUseCase>(\n \"AiPowerUps/ListModelsUseCase\"\n);\nexport namespace ListModelsUseCase {\n export type Interface = IListModelsUseCase;\n}\n\nexport interface IListModelsRepository {\n execute(): Promise<void>;\n getModels(): AiModel[];\n}\n\nexport const ListModelsRepository = createAbstraction<IListModelsRepository>(\n \"AiPowerUps/ListModelsRepository\"\n);\nexport namespace ListModelsRepository {\n export type Interface = IListModelsRepository;\n}\n\nexport type AiModel = {\n providerId: string;\n providerName: string;\n modelId: string;\n modelName: string;\n};\n\nexport interface IListModelsGateway {\n execute(): Promise<AiModel[]>;\n}\n\nexport const ListModelsGateway = createAbstraction<IListModelsGateway>(\n \"AiPowerUps/ListModelsGateway\"\n);\nexport namespace ListModelsGateway {\n export type Interface = IListModelsGateway;\n}\n"],"names":["ListModelsUseCase","createAbstraction","ListModelsRepository","ListModelsGateway"],"mappings":";AAMO,MAAMA,oBAAoBC,kBAC7B;AAWG,MAAMC,uBAAuBD,kBAChC;AAiBG,MAAME,oBAAoBF,kBAC7B"}
1
+ {"version":3,"file":"admin/features/listModels/abstractions.js","sources":["../../../../src/admin/features/listModels/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport interface IListModelsUseCase {\n execute(): Promise<void>;\n}\n\nexport const ListModelsUseCase = createAbstraction<IListModelsUseCase>(\n \"AiPowerUps/ListModelsUseCase\"\n);\nexport namespace ListModelsUseCase {\n export type Interface = IListModelsUseCase;\n}\n\nexport interface IListModelsRepository {\n execute(): Promise<void>;\n getModels(): AiModel[];\n}\n\nexport const ListModelsRepository = createAbstraction<IListModelsRepository>(\n \"AiPowerUps/ListModelsRepository\"\n);\nexport namespace ListModelsRepository {\n export type Interface = IListModelsRepository;\n}\n\nexport type AiModel = {\n providerId: string;\n providerName: string;\n modelId: string;\n modelName: string;\n deprecated: Date | undefined;\n endOfLife: Date | undefined;\n};\n\nexport interface IListModelsGateway {\n execute(): Promise<AiModel[]>;\n}\n\nexport const ListModelsGateway = createAbstraction<IListModelsGateway>(\n \"AiPowerUps/ListModelsGateway\"\n);\nexport namespace ListModelsGateway {\n export type Interface = IListModelsGateway;\n}\n"],"names":["ListModelsUseCase","createAbstraction","ListModelsRepository","ListModelsGateway"],"mappings":";AAMO,MAAMA,oBAAoBC,kBAC7B;AAWG,MAAMC,uBAAuBD,kBAChC;AAmBG,MAAME,oBAAoBF,kBAC7B"}
@@ -1,3 +1,4 @@
1
+ import type { AiModelRoleId } from "../../../../admin/domain/modelRoles.js";
1
2
  export interface IAiPowerUpsSettingsCache {
2
3
  get(): IAiPowerUpsSettings | null;
3
4
  set(data: IAiPowerUpsSettings): void;
@@ -12,14 +13,63 @@ export interface IAiPowerUpsPersonaPreset {
12
13
  description: string;
13
14
  style?: string;
14
15
  }
16
+ /** One vendor credential. The `apiKey` is only ever the mask; the plaintext never leaves the api. */
17
+ export interface IAiPowerUpsConnectionPreset {
18
+ id: string;
19
+ name: string;
20
+ sdkName: string;
21
+ apiKey: string;
22
+ }
23
+ export interface IAiPowerUpsModelRoleAssignment {
24
+ connectionId: string;
25
+ model: string;
26
+ }
27
+ /** A file attached to a project, as the picker returns it. */
28
+ export interface IAiPowerUpsProjectFile {
29
+ id: string;
30
+ name: string;
31
+ size: number;
32
+ mimeType: string;
33
+ src: string;
34
+ width?: number;
35
+ height?: number;
36
+ }
37
+ export interface IAiPowerUpsProjectPreset {
38
+ id: string;
39
+ name: string;
40
+ description?: string;
41
+ instructions?: string;
42
+ defaultReaderPersonaId?: string;
43
+ defaultWriterPersonaId?: string;
44
+ files?: IAiPowerUpsProjectFile[];
45
+ version: number;
46
+ }
47
+ /** What a project decided about one capability. Absent `enabled` means enabled. */
48
+ export interface IAiPowerUpsCapabilityEntry {
49
+ enabled?: boolean;
50
+ overrides: IAiPowerUpsCapabilityOverride;
51
+ }
52
+ export interface IAiPowerUpsCapabilityOverride {
53
+ roleId?: string;
54
+ connectionId?: string;
55
+ model?: string;
56
+ additionalInstructions?: string;
57
+ }
15
58
  export interface IAiPowerUpsSettings {
16
- providers: {
17
- presets: {
18
- name: string;
19
- description: string;
20
- model: string;
21
- apiKey: string;
22
- }[];
59
+ connections: {
60
+ presets: IAiPowerUpsConnectionPreset[];
61
+ };
62
+ modelRoles: {
63
+ /** Keyed by role id, and every role always present — the set is closed. */
64
+ roles: Record<AiModelRoleId, IAiPowerUpsModelRoleAssignment>;
65
+ };
66
+ capabilities: {
67
+ /**
68
+ * Keyed by capability id, and open-ended: extensions register their own, so there is no
69
+ * union to enumerate. `Partial` because most capabilities are untouched, and a bare
70
+ * `Record` would type a miss as present.
71
+ */
72
+ items: Partial<Record<string, IAiPowerUpsCapabilityEntry>>;
23
73
  };
24
74
  readerPersonas: {
25
75
  presets: IAiPowerUpsPersonaPreset[];
@@ -28,23 +78,6 @@ export interface IAiPowerUpsSettings {
28
78
  presets: IAiPowerUpsPersonaPreset[];
29
79
  };
30
80
  projects: {
31
- presets: {
32
- id: string;
33
- name: string;
34
- description?: string;
35
- instructions?: string;
36
- defaultReaderPersonaId?: string;
37
- defaultWriterPersonaId?: string;
38
- files?: {
39
- id: string;
40
- name: string;
41
- size: number;
42
- mimeType: string;
43
- src: string;
44
- width?: number;
45
- height?: number;
46
- }[];
47
- version: number;
48
- }[];
81
+ presets: IAiPowerUpsProjectPreset[];
49
82
  };
50
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"admin/features/settings/shared/abstractions.js","sources":["../../../../../src/admin/features/settings/shared/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport interface IAiPowerUpsSettingsCache {\n get(): IAiPowerUpsSettings | null;\n set(data: IAiPowerUpsSettings): void;\n}\n\nexport const SettingsCache = createAbstraction<IAiPowerUpsSettingsCache>(\n \"AiPowerUps/SettingsCache\"\n);\nexport namespace SettingsCache {\n export type Interface = IAiPowerUpsSettingsCache;\n}\n\nexport interface IAiPowerUpsPersonaPreset {\n id: string;\n name: string;\n description: string;\n style?: string;\n}\n\nexport interface IAiPowerUpsSettings {\n providers: {\n presets: {\n name: string;\n description: string;\n model: string;\n apiKey: string;\n }[];\n };\n readerPersonas: {\n presets: IAiPowerUpsPersonaPreset[];\n };\n writerPersonas: {\n presets: IAiPowerUpsPersonaPreset[];\n };\n projects: {\n presets: {\n id: string;\n name: string;\n description?: string;\n instructions?: string;\n defaultReaderPersonaId?: string;\n defaultWriterPersonaId?: string;\n files?: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n width?: number;\n height?: number;\n }[];\n version: number;\n }[];\n };\n}\n"],"names":["SettingsCache","createAbstraction"],"mappings":";AAOO,MAAMA,gBAAgBC,kBACzB"}
1
+ {"version":3,"file":"admin/features/settings/shared/abstractions.js","sources":["../../../../../src/admin/features/settings/shared/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { AiModelRoleId } from \"~/admin/domain/modelRoles.js\";\n\nexport interface IAiPowerUpsSettingsCache {\n get(): IAiPowerUpsSettings | null;\n set(data: IAiPowerUpsSettings): void;\n}\n\nexport const SettingsCache = createAbstraction<IAiPowerUpsSettingsCache>(\n \"AiPowerUps/SettingsCache\"\n);\nexport namespace SettingsCache {\n export type Interface = IAiPowerUpsSettingsCache;\n}\n\nexport interface IAiPowerUpsPersonaPreset {\n id: string;\n name: string;\n description: string;\n style?: string;\n}\n\n/** One vendor credential. The `apiKey` is only ever the mask; the plaintext never leaves the api. */\nexport interface IAiPowerUpsConnectionPreset {\n id: string;\n name: string;\n sdkName: string;\n apiKey: string;\n}\n\nexport interface IAiPowerUpsModelRoleAssignment {\n connectionId: string;\n model: string;\n}\n\n/** A file attached to a project, as the picker returns it. */\nexport interface IAiPowerUpsProjectFile {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n width?: number;\n height?: number;\n}\n\nexport interface IAiPowerUpsProjectPreset {\n id: string;\n name: string;\n description?: string;\n instructions?: string;\n defaultReaderPersonaId?: string;\n defaultWriterPersonaId?: string;\n files?: IAiPowerUpsProjectFile[];\n version: number;\n}\n\n/** What a project decided about one capability. Absent `enabled` means enabled. */\nexport interface IAiPowerUpsCapabilityEntry {\n enabled?: boolean;\n overrides: IAiPowerUpsCapabilityOverride;\n}\n\nexport interface IAiPowerUpsCapabilityOverride {\n roleId?: string;\n connectionId?: string;\n model?: string;\n additionalInstructions?: string;\n}\n\nexport interface IAiPowerUpsSettings {\n connections: {\n presets: IAiPowerUpsConnectionPreset[];\n };\n modelRoles: {\n /** Keyed by role id, and every role always present — the set is closed. */\n roles: Record<AiModelRoleId, IAiPowerUpsModelRoleAssignment>;\n };\n capabilities: {\n /**\n * Keyed by capability id, and open-ended: extensions register their own, so there is no\n * union to enumerate. `Partial` because most capabilities are untouched, and a bare\n * `Record` would type a miss as present.\n */\n items: Partial<Record<string, IAiPowerUpsCapabilityEntry>>;\n };\n readerPersonas: {\n presets: IAiPowerUpsPersonaPreset[];\n };\n writerPersonas: {\n presets: IAiPowerUpsPersonaPreset[];\n };\n projects: {\n presets: IAiPowerUpsProjectPreset[];\n };\n}\n"],"names":["SettingsCache","createAbstraction"],"mappings":";AAQO,MAAMA,gBAAgBC,kBACzB"}
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- export declare const AiPowerUpsSettingsPage: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
3
- readonly type: () => React.JSX.Element;
2
+ export declare const AiPowerUpsSettingsPage: (() => React.JSX.Element) & {
3
+ displayName: string;
4
4
  };
@@ -23,11 +23,10 @@ const AiPowerUpsSettingsPage = observer(()=>{
23
23
  className: "mb-lg"
24
24
  }, /*#__PURE__*/ react.createElement(PresenterErrors, {
25
25
  errors: vm.errors
26
- })) : null, vm.form && vm.form.errors.length > 0 ? /*#__PURE__*/ react.createElement("div", {
26
+ })) : null, vm.form ? /*#__PURE__*/ react.createElement(FormErrors, {
27
+ form: vm.form,
27
28
  className: "mb-lg"
28
- }, /*#__PURE__*/ react.createElement(FormErrors, {
29
- form: vm.form
30
- })) : null, vm.loading || vm.saving ? /*#__PURE__*/ react.createElement(OverlayLoader, {
29
+ }) : null, vm.loading || vm.saving ? /*#__PURE__*/ react.createElement(OverlayLoader, {
31
30
  text: vm.saving ? "Saving..." : "Loading..."
32
31
  }) : null, /*#__PURE__*/ react.createElement(SimpleFormHeader, {
33
32
  title: "AI Power-Ups"
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js","sources":["../../../../src/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport {\n FormView,\n FormErrors,\n PresenterErrors,\n SimpleForm,\n SimpleFormContent,\n SimpleFormFooter,\n SimpleFormHeader\n} from \"@webiny/app-admin\";\nimport { Button, OverlayLoader, useToast } from \"@webiny/admin-ui\";\nimport { useFeature } from \"@webiny/app\";\nimport { AiPowerUpsSettingsFeature } from \"./feature.js\";\n\nexport const AiPowerUpsSettingsPage = observer(() => {\n const toast = useToast();\n const { presenter } = useFeature(AiPowerUpsSettingsFeature);\n const vm = presenter.vm;\n\n useEffect(() => {\n presenter.init();\n }, []);\n\n const handleSave = async () => {\n const success = await presenter.save();\n if (success) {\n toast.showSuccessToast({\n title: \"AI power-ups settings saved successfully!\"\n });\n }\n };\n\n return (\n <div>\n <SimpleForm size={\"xl\"}>\n {vm.errors.length > 0 ? (\n <div className={\"mb-lg\"}>\n <PresenterErrors errors={vm.errors} />\n </div>\n ) : null}\n {vm.form && vm.form.errors.length > 0 ? (\n <div className={\"mb-lg\"}>\n <FormErrors form={vm.form} />\n </div>\n ) : null}\n {vm.loading || vm.saving ? (\n <OverlayLoader text={vm.saving ? \"Saving...\" : \"Loading...\"} />\n ) : null}\n <SimpleFormHeader title=\"AI Power-Ups\" />\n <SimpleFormContent className={\"p-0\"}>\n <div className=\"flex flex-col gap-4\">\n {vm.form ? <FormView name=\"AI Power-Ups\" form={vm.form} /> : null}\n </div>\n </SimpleFormContent>\n <SimpleFormFooter className={\"border-t-sm border-t-neutral-dimmed pt-lg\"}>\n <Button text=\"Save Settings\" onClick={handleSave} />\n </SimpleFormFooter>\n </SimpleForm>\n </div>\n );\n});\n"],"names":["AiPowerUpsSettingsPage","observer","toast","useToast","presenter","useFeature","AiPowerUpsSettingsFeature","vm","useEffect","handleSave","success","SimpleForm","PresenterErrors","FormErrors","OverlayLoader","SimpleFormHeader","SimpleFormContent","FormView","SimpleFormFooter","Button"],"mappings":";;;;;;AAeO,MAAMA,yBAAyBC,SAAS;IAC3C,MAAMC,QAAQC;IACd,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAWC;IACjC,MAAMC,KAAKH,UAAU,EAAE;IAEvBI,UAAU;QACNJ,UAAU,IAAI;IAClB,GAAG,EAAE;IAEL,MAAMK,aAAa;QACf,MAAMC,UAAU,MAAMN,UAAU,IAAI;QACpC,IAAIM,SACAR,MAAM,gBAAgB,CAAC;YACnB,OAAO;QACX;IAER;IAEA,OAAO,WAAP,GACI,oBAAC,2BACG,oBAACS,YAAUA;QAAC,MAAM;OACbJ,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,WAAJ,GAChB,oBAAC;QAAI,WAAW;qBACZ,oBAACK,iBAAeA;QAAC,QAAQL,GAAG,MAAM;UAEtC,MACHA,GAAG,IAAI,IAAIA,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,WAAJ,GAChC,oBAAC;QAAI,WAAW;qBACZ,oBAACM,YAAUA;QAAC,MAAMN,GAAG,IAAI;UAE7B,MACHA,GAAG,OAAO,IAAIA,GAAG,MAAM,GAAG,WAAH,GACpB,oBAACO,eAAaA;QAAC,MAAMP,GAAG,MAAM,GAAG,cAAc;SAC/C,oBACJ,oBAACQ,kBAAgBA;QAAC,OAAM;sBACxB,oBAACC,mBAAiBA;QAAC,WAAW;qBAC1B,oBAAC;QAAI,WAAU;OACVT,GAAG,IAAI,GAAG,WAAH,GAAG,oBAACU,UAAQA;QAAC,MAAK;QAAe,MAAMV,GAAG,IAAI;SAAO,sBAGrE,oBAACW,kBAAgBA;QAAC,WAAW;qBACzB,oBAACC,QAAMA;QAAC,MAAK;QAAgB,SAASV;;AAK1D"}
1
+ {"version":3,"file":"admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js","sources":["../../../../src/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport {\n FormView,\n FormErrors,\n PresenterErrors,\n SimpleForm,\n SimpleFormContent,\n SimpleFormFooter,\n SimpleFormHeader\n} from \"@webiny/app-admin\";\nimport { Button, OverlayLoader, useToast } from \"@webiny/admin-ui\";\nimport { useFeature } from \"@webiny/app\";\nimport { AiPowerUpsSettingsFeature } from \"./feature.js\";\n\nexport const AiPowerUpsSettingsPage = observer(() => {\n const toast = useToast();\n const { presenter } = useFeature(AiPowerUpsSettingsFeature);\n const vm = presenter.vm;\n\n useEffect(() => {\n presenter.init();\n }, []);\n\n const handleSave = async () => {\n const success = await presenter.save();\n if (success) {\n toast.showSuccessToast({\n title: \"AI power-ups settings saved successfully!\"\n });\n }\n };\n\n return (\n <div>\n <SimpleForm size={\"xl\"}>\n {vm.errors.length > 0 ? (\n <div className={\"mb-lg\"}>\n <PresenterErrors errors={vm.errors} />\n </div>\n ) : null}\n {vm.form ? <FormErrors form={vm.form} className={\"mb-lg\"} /> : null}\n {vm.loading || vm.saving ? (\n <OverlayLoader text={vm.saving ? \"Saving...\" : \"Loading...\"} />\n ) : null}\n <SimpleFormHeader title=\"AI Power-Ups\" />\n <SimpleFormContent className={\"p-0\"}>\n <div className=\"flex flex-col gap-4\">\n {vm.form ? <FormView name=\"AI Power-Ups\" form={vm.form} /> : null}\n </div>\n </SimpleFormContent>\n <SimpleFormFooter className={\"border-t-sm border-t-neutral-dimmed pt-lg\"}>\n <Button text=\"Save Settings\" onClick={handleSave} />\n </SimpleFormFooter>\n </SimpleForm>\n </div>\n );\n});\n"],"names":["AiPowerUpsSettingsPage","observer","toast","useToast","presenter","useFeature","AiPowerUpsSettingsFeature","vm","useEffect","handleSave","success","SimpleForm","PresenterErrors","FormErrors","OverlayLoader","SimpleFormHeader","SimpleFormContent","FormView","SimpleFormFooter","Button"],"mappings":";;;;;;AAeO,MAAMA,yBAAyBC,SAAS;IAC3C,MAAMC,QAAQC;IACd,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAWC;IACjC,MAAMC,KAAKH,UAAU,EAAE;IAEvBI,UAAU;QACNJ,UAAU,IAAI;IAClB,GAAG,EAAE;IAEL,MAAMK,aAAa;QACf,MAAMC,UAAU,MAAMN,UAAU,IAAI;QACpC,IAAIM,SACAR,MAAM,gBAAgB,CAAC;YACnB,OAAO;QACX;IAER;IAEA,OAAO,WAAP,GACI,oBAAC,2BACG,oBAACS,YAAUA;QAAC,MAAM;OACbJ,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,WAAJ,GAChB,oBAAC;QAAI,WAAW;qBACZ,oBAACK,iBAAeA;QAAC,QAAQL,GAAG,MAAM;UAEtC,MACHA,GAAG,IAAI,GAAG,WAAH,GAAG,oBAACM,YAAUA;QAAC,MAAMN,GAAG,IAAI;QAAE,WAAW;SAAc,MAC9DA,GAAG,OAAO,IAAIA,GAAG,MAAM,GAAG,WAAH,GACpB,oBAACO,eAAaA;QAAC,MAAMP,GAAG,MAAM,GAAG,cAAc;SAC/C,oBACJ,oBAACQ,kBAAgBA;QAAC,OAAM;sBACxB,oBAACC,mBAAiBA;QAAC,WAAW;qBAC1B,oBAAC;QAAI,WAAU;OACVT,GAAG,IAAI,GAAG,WAAH,GAAG,oBAACU,UAAQA;QAAC,MAAK;QAAe,MAAMV,GAAG,IAAI;SAAO,sBAGrE,oBAACW,kBAAgBA;QAAC,WAAW;qBACzB,oBAACC,QAAMA;QAAC,MAAK;QAAgB,SAASV;;AAK1D"}
@@ -33,8 +33,20 @@ class AiPowerUpsSettingsPresenterImpl {
33
33
  this.loading = true;
34
34
  this.errors = [];
35
35
  try {
36
- const data = await this.getSettings.execute();
36
+ const [data, initResults] = await Promise.all([
37
+ this.getSettings.execute(),
38
+ Promise.allSettled(this.groups.map((group)=>group.init?.()))
39
+ ]);
40
+ const initErrors = initResults.flatMap((result, index)=>{
41
+ if ("rejected" !== result.status) return [];
42
+ const label = this.groups[index].label;
43
+ const reason = result.reason instanceof Error ? result.reason.message : String(result.reason);
44
+ return [
45
+ `Could not load the "${label}" section: ${reason}`
46
+ ];
47
+ });
37
48
  runInAction(()=>{
49
+ this.errors = initErrors;
38
50
  this.form = this.buildForm();
39
51
  this.form.setData(data);
40
52
  });
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.js","sources":["../../../../src/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.ts"],"sourcesContent":["import { makeAutoObservable, computed, runInAction } from \"mobx\";\nimport { FormModelFactory, FormModel } from \"@webiny/app-admin\";\nimport type { ILayoutNodeBuilder } from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport { GetSettingsUseCase } from \"../../features/settings/getSettings/abstractions.js\";\nimport { UpdateSettingsUseCase } from \"../../features/settings/updateSettings/abstractions.js\";\nimport { AiPowerUpsSettingsPresenter as PresenterAbstraction } from \"./abstractions.js\";\nimport { AiPowerUpsSettingsGroup } from \"./settingsGroup.js\";\nimport { SettingsValidationError } from \"~/admin/domain/errors.js\";\nimport type { IAiPowerUpsSettings } from \"~/admin/features/settings/shared/abstractions.js\";\n\ntype FieldsFactory = (\n fields: FormModelFactory.FieldBuilderRegistry\n) => Record<string, FormModelFactory.FieldBuilder>;\n\ntype LayoutFactory = (layout: FormModelFactory.LayoutBuilder) => ILayoutNodeBuilder[];\n\ninterface CollectedGroup {\n group: AiPowerUpsSettingsGroup.Interface;\n fieldsFn: FieldsFactory | null;\n layoutFn: LayoutFactory | null;\n}\n\nclass AiPowerUpsSettingsPresenterImpl implements PresenterAbstraction.Interface {\n private loading = false;\n private saving = false;\n private form: FormModel.Interface<IAiPowerUpsSettings> | null = null;\n private errors: string[] = [];\n\n constructor(\n private factory: FormModelFactory.Interface,\n private groups: AiPowerUpsSettingsGroup.Interface[],\n private getSettings: GetSettingsUseCase.Interface,\n private updateSettings: UpdateSettingsUseCase.Interface\n ) {\n makeAutoObservable(this, { vm: computed }, { autoBind: true });\n }\n\n get vm(): PresenterAbstraction.ViewModel {\n return {\n loading: this.loading,\n saving: this.saving,\n form: this.form ? this.form.vm : null,\n errors: this.errors\n };\n }\n\n async init(): Promise<void> {\n this.loading = true;\n this.errors = [];\n\n try {\n const data = await this.getSettings.execute();\n runInAction(() => {\n this.form = this.buildForm();\n this.form.setData(data);\n });\n } catch (err) {\n runInAction(() => {\n this.errors = [err instanceof Error ? err.message : \"Failed to load settings.\"];\n });\n } finally {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n async save(): Promise<boolean> {\n if (!this.form) {\n return false;\n }\n\n const data = await this.form.submit<IAiPowerUpsSettings>();\n if (!data) {\n return false;\n }\n\n runInAction(() => {\n this.saving = true;\n this.errors = [];\n });\n\n try {\n await this.updateSettings.execute(data);\n return true;\n } catch (err) {\n runInAction(() => {\n if (err instanceof SettingsValidationError) {\n this.errors = Object.values(err.data.invalidFields).map(e => e.message);\n } else {\n this.errors = [err instanceof Error ? err.message : \"Failed to save settings.\"];\n }\n });\n return false;\n } finally {\n runInAction(() => {\n this.saving = false;\n });\n }\n }\n\n importData(data: Record<string, unknown>): void {\n if (!this.form) {\n return;\n }\n const current = this.form.getData();\n this.form.setData({ ...current, ...data } as IAiPowerUpsSettings);\n }\n\n private collectGroups(): CollectedGroup[] {\n return this.groups.map(group => {\n const collected: CollectedGroup = {\n group,\n fieldsFn: null,\n layoutFn: null\n };\n\n const builder: AiPowerUpsSettingsGroup.FormBuilder = {\n fields(fn: FieldsFactory) {\n collected.fieldsFn = fn;\n },\n layout(fn: LayoutFactory) {\n collected.layoutFn = fn;\n }\n };\n\n group.buildForm(builder);\n\n return collected;\n });\n }\n\n private buildForm() {\n const collected = this.collectGroups();\n\n const form = this.factory.create<IAiPowerUpsSettings>({\n fields: fields => {\n const result: Record<string, FormModelFactory.FieldBuilder> = {};\n for (const { group, fieldsFn } of collected) {\n if (!fieldsFn) {\n continue;\n }\n result[group.name] = fields\n .object()\n .label(group.label)\n .renderer(\"passthrough\")\n .fields(fieldsFn);\n }\n return result;\n },\n layout: layout => {\n if (collected.length === 0) {\n return [];\n }\n\n const tabsBuilder = layout.tabs(\"settings-tabs\").renderer(\"tabsVertical\");\n\n for (const { group } of collected) {\n tabsBuilder.tab(group.name, tab => {\n tab.label(group.label);\n if (group.description) {\n tab.description(group.description);\n }\n if (group.icon) {\n tab.icon(group.icon);\n }\n tab.layout(l => [l.row(group.name)]);\n });\n }\n\n return [tabsBuilder];\n }\n });\n\n return form;\n }\n}\n\nexport const AiPowerUpsSettingsPresenter = PresenterAbstraction.createImplementation({\n implementation: AiPowerUpsSettingsPresenterImpl,\n dependencies: [\n FormModelFactory,\n [AiPowerUpsSettingsGroup, { multiple: true }],\n GetSettingsUseCase,\n UpdateSettingsUseCase\n ]\n});\n"],"names":["AiPowerUpsSettingsPresenterImpl","factory","groups","getSettings","updateSettings","makeAutoObservable","computed","data","runInAction","err","Error","SettingsValidationError","Object","e","current","group","collected","builder","fn","form","fields","result","fieldsFn","layout","tabsBuilder","tab","l","AiPowerUpsSettingsPresenter","PresenterAbstraction","FormModelFactory","AiPowerUpsSettingsGroup","GetSettingsUseCase","UpdateSettingsUseCase"],"mappings":"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"}
1
+ {"version":3,"file":"admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.js","sources":["../../../../src/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.ts"],"sourcesContent":["import { makeAutoObservable, computed, runInAction } from \"mobx\";\nimport { FormModelFactory, FormModel } from \"@webiny/app-admin\";\nimport type { ILayoutNodeBuilder } from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport { GetSettingsUseCase } from \"../../features/settings/getSettings/abstractions.js\";\nimport { UpdateSettingsUseCase } from \"../../features/settings/updateSettings/abstractions.js\";\nimport { AiPowerUpsSettingsPresenter as PresenterAbstraction } from \"./abstractions.js\";\nimport { AiPowerUpsSettingsGroup } from \"./settingsGroup.js\";\nimport { SettingsValidationError } from \"~/admin/domain/errors.js\";\nimport type { IAiPowerUpsSettings } from \"~/admin/features/settings/shared/abstractions.js\";\n\ntype FieldsFactory = (\n fields: FormModelFactory.FieldBuilderRegistry\n) => Record<string, FormModelFactory.FieldBuilder>;\n\ntype LayoutFactory = (layout: FormModelFactory.LayoutBuilder) => ILayoutNodeBuilder[];\n\ninterface CollectedGroup {\n group: AiPowerUpsSettingsGroup.Interface;\n fieldsFn: FieldsFactory | null;\n layoutFn: LayoutFactory | null;\n}\n\nclass AiPowerUpsSettingsPresenterImpl implements PresenterAbstraction.Interface {\n private loading = false;\n private saving = false;\n private form: FormModel.Interface<IAiPowerUpsSettings> | null = null;\n private errors: string[] = [];\n\n constructor(\n private factory: FormModelFactory.Interface,\n private groups: AiPowerUpsSettingsGroup.Interface[],\n private getSettings: GetSettingsUseCase.Interface,\n private updateSettings: UpdateSettingsUseCase.Interface\n ) {\n makeAutoObservable(this, { vm: computed }, { autoBind: true });\n }\n\n get vm(): PresenterAbstraction.ViewModel {\n return {\n loading: this.loading,\n saving: this.saving,\n form: this.form ? this.form.vm : null,\n errors: this.errors\n };\n }\n\n async init(): Promise<void> {\n this.loading = true;\n this.errors = [];\n\n try {\n /*\n * Two loads of different things, started together because neither feeds the other.\n *\n * `getSettings` fetches the saved *values*: the chosen connection, the model on each\n * role, the per-capability overrides. Those go into the form at `setData` below.\n *\n * A group's `init()` loads the catalogue its fields are built *from*.\n * `CapabilitiesSettings` needs the list of registered capabilities to render a row\n * each, plus the model list for the dropdowns; `ModelRoles` and `Connections` need the\n * model list. Four of the seven groups have no init at all, hence the optional call.\n *\n * So the settings blob does not say which fields exist and the catalogue does not say\n * what is configured. Running them one after the other would just cost a round trip.\n *\n * Neither is \"first\": both calls are made in this tick and `Promise.all` only waits, so\n * the array positions pick which result is `data` and which is `initResults`, nothing\n * more. The ordering that matters is that both finish before `buildForm()`, which reads\n * the catalogue, and `setData()`, which needs the values. The `await` does that.\n *\n * `allSettled`, not `all`: one group's failed init should not take the whole screen\n * down. Under `all` a single rejection skipped straight to the catch below and left the\n * page with a heading, a Save button and no tabs at all, hiding every working section.\n *\n * It rescues less than it looks, though. Firing in one tick is also what puts these\n * queries in a single `BatchingGraphQLClient` batch, and that rejects *every* operation\n * in a batch when any one errors (see `executeBatchGroup`), so a group whose query\n * fails server-side takes `getSettings` down with it and we reach the catch anyway.\n * What is left is real but narrower: a group that throws inside its own `init()`, one\n * whose query missed the batch window, and the reporting, which now names the failing\n * section. Covering the batched case means not batching `getSettings` with the group\n * inits, at the cost of a serial round trip on every load of this screen.\n */\n const [data, initResults] = await Promise.all([\n this.getSettings.execute(),\n Promise.allSettled(this.groups.map(group => group.init?.()))\n ]);\n\n /*\n * `flatMap` to filter and map in one pass: a fulfilled group contributes no message.\n * The index is load-bearing, and safe because `allSettled` resolves in input order, so\n * `initResults[index]` is the result for `this.groups[index]`.\n */\n const initErrors = initResults.flatMap((result, index) => {\n if (result.status !== \"rejected\") {\n return [];\n }\n\n const label = this.groups[index].label;\n const reason =\n result.reason instanceof Error ? result.reason.message : String(result.reason);\n\n return [`Could not load the \"${label}\" section: ${reason}`];\n });\n\n runInAction(() => {\n this.errors = initErrors;\n this.form = this.buildForm();\n this.form.setData(data);\n });\n } catch (err) {\n runInAction(() => {\n this.errors = [err instanceof Error ? err.message : \"Failed to load settings.\"];\n });\n } finally {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n async save(): Promise<boolean> {\n if (!this.form) {\n return false;\n }\n\n const data = await this.form.submit<IAiPowerUpsSettings>();\n if (!data) {\n return false;\n }\n\n runInAction(() => {\n this.saving = true;\n this.errors = [];\n });\n\n try {\n await this.updateSettings.execute(data);\n return true;\n } catch (err) {\n runInAction(() => {\n if (err instanceof SettingsValidationError) {\n this.errors = Object.values(err.data.invalidFields).map(e => e.message);\n } else {\n this.errors = [err instanceof Error ? err.message : \"Failed to save settings.\"];\n }\n });\n return false;\n } finally {\n runInAction(() => {\n this.saving = false;\n });\n }\n }\n\n importData(data: Record<string, unknown>): void {\n if (!this.form) {\n return;\n }\n const current = this.form.getData();\n this.form.setData({ ...current, ...data } as IAiPowerUpsSettings);\n }\n\n private collectGroups(): CollectedGroup[] {\n return this.groups.map(group => {\n const collected: CollectedGroup = {\n group,\n fieldsFn: null,\n layoutFn: null\n };\n\n const builder: AiPowerUpsSettingsGroup.FormBuilder = {\n fields(fn: FieldsFactory) {\n collected.fieldsFn = fn;\n },\n layout(fn: LayoutFactory) {\n collected.layoutFn = fn;\n }\n };\n\n group.buildForm(builder);\n\n return collected;\n });\n }\n\n private buildForm() {\n const collected = this.collectGroups();\n\n const form = this.factory.create<IAiPowerUpsSettings>({\n fields: fields => {\n const result: Record<string, FormModelFactory.FieldBuilder> = {};\n for (const { group, fieldsFn } of collected) {\n if (!fieldsFn) {\n continue;\n }\n result[group.name] = fields\n .object()\n .label(group.label)\n .renderer(\"passthrough\")\n .fields(fieldsFn);\n }\n return result;\n },\n layout: layout => {\n if (collected.length === 0) {\n return [];\n }\n\n const tabsBuilder = layout.tabs(\"settings-tabs\").renderer(\"tabsVertical\");\n\n for (const { group } of collected) {\n tabsBuilder.tab(group.name, tab => {\n tab.label(group.label);\n if (group.description) {\n tab.description(group.description);\n }\n if (group.icon) {\n tab.icon(group.icon);\n }\n tab.layout(l => [l.row(group.name)]);\n });\n }\n\n return [tabsBuilder];\n }\n });\n\n return form;\n }\n}\n\nexport const AiPowerUpsSettingsPresenter = PresenterAbstraction.createImplementation({\n implementation: AiPowerUpsSettingsPresenterImpl,\n dependencies: [\n FormModelFactory,\n [AiPowerUpsSettingsGroup, { multiple: true }],\n GetSettingsUseCase,\n UpdateSettingsUseCase\n ]\n});\n"],"names":["AiPowerUpsSettingsPresenterImpl","factory","groups","getSettings","updateSettings","makeAutoObservable","computed","data","initResults","Promise","group","initErrors","result","index","label","reason","Error","String","runInAction","err","SettingsValidationError","Object","e","current","collected","builder","fn","form","fields","fieldsFn","layout","tabsBuilder","tab","l","AiPowerUpsSettingsPresenter","PresenterAbstraction","FormModelFactory","AiPowerUpsSettingsGroup","GetSettingsUseCase","UpdateSettingsUseCase"],"mappings":"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"}
@@ -1,14 +1,18 @@
1
1
  import { createFeature } from "@webiny/feature/admin";
2
2
  import { AiPowerUpsSettingsPresenter } from "./abstractions.js";
3
3
  import { AiPowerUpsSettingsPresenter as external_AiPowerUpsSettingsPresenter_js_AiPowerUpsSettingsPresenter } from "./AiPowerUpsSettingsPresenter.js";
4
- import { ProviderSettings } from "../ProvidersSettings.js";
4
+ import { ConnectionsSettings } from "../ConnectionsSettings.js";
5
+ import { ModelRolesSettings } from "../ModelRolesSettings.js";
6
+ import { CapabilitiesSettings } from "../CapabilitiesSettings.js";
5
7
  import { ReaderPersonasSettings } from "../ReaderPersonasSettings.js";
6
8
  import { WriterPersonasSettings } from "../WriterPersonasSettings.js";
7
9
  import { ProjectsSettings } from "../ProjectsSettings.js";
8
10
  const AiPowerUpsSettingsFeature = createFeature({
9
11
  name: "AiPowerUps/Settings/Presenter",
10
12
  register (container) {
11
- container.register(ProviderSettings);
13
+ container.register(ConnectionsSettings);
14
+ container.register(ModelRolesSettings);
15
+ container.register(CapabilitiesSettings);
12
16
  container.register(ReaderPersonasSettings);
13
17
  container.register(WriterPersonasSettings);
14
18
  container.register(ProjectsSettings);
@@ -1 +1 @@
1
- {"version":3,"file":"admin/presentation/AiPowerUpsSettings/feature.js","sources":["../../../../src/admin/presentation/AiPowerUpsSettings/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { AiPowerUpsSettingsPresenter as PresenterAbstraction } from \"./abstractions.js\";\nimport { AiPowerUpsSettingsPresenter } from \"./AiPowerUpsSettingsPresenter.js\";\nimport { ProviderSettings } from \"../ProvidersSettings.js\";\nimport { ReaderPersonasSettings } from \"../ReaderPersonasSettings.js\";\nimport { WriterPersonasSettings } from \"../WriterPersonasSettings.js\";\nimport { ProjectsSettings } from \"../ProjectsSettings.js\";\n\nexport const AiPowerUpsSettingsFeature = createFeature({\n name: \"AiPowerUps/Settings/Presenter\",\n register(container) {\n container.register(ProviderSettings);\n container.register(ReaderPersonasSettings);\n container.register(WriterPersonasSettings);\n container.register(ProjectsSettings);\n container.register(AiPowerUpsSettingsPresenter);\n },\n resolve(container) {\n return {\n presenter: container.resolve(PresenterAbstraction)\n };\n }\n});\n"],"names":["AiPowerUpsSettingsFeature","createFeature","container","ProviderSettings","ReaderPersonasSettings","WriterPersonasSettings","ProjectsSettings","AiPowerUpsSettingsPresenter","PresenterAbstraction"],"mappings":";;;;;;;AAQO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;IACvB;IACA,SAAQL,SAAS;QACb,OAAO;YACH,WAAWA,UAAU,OAAO,CAACM;QACjC;IACJ;AACJ"}
1
+ {"version":3,"file":"admin/presentation/AiPowerUpsSettings/feature.js","sources":["../../../../src/admin/presentation/AiPowerUpsSettings/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { AiPowerUpsSettingsPresenter as PresenterAbstraction } from \"./abstractions.js\";\nimport { AiPowerUpsSettingsPresenter } from \"./AiPowerUpsSettingsPresenter.js\";\nimport { ConnectionsSettings } from \"../ConnectionsSettings.js\";\nimport { ModelRolesSettings } from \"../ModelRolesSettings.js\";\nimport { CapabilitiesSettings } from \"../CapabilitiesSettings.js\";\nimport { ReaderPersonasSettings } from \"../ReaderPersonasSettings.js\";\nimport { WriterPersonasSettings } from \"../WriterPersonasSettings.js\";\nimport { ProjectsSettings } from \"../ProjectsSettings.js\";\n\nexport const AiPowerUpsSettingsFeature = createFeature({\n name: \"AiPowerUps/Settings/Presenter\",\n register(container) {\n /*\n * Registration order is tab order. Configuration first (a key, then what each role runs,\n * then per-feature exceptions), then the prompt content: personas and projects.\n *\n * `ProvidersSettings` is gone from the UI. Its stored section still round-trips on the api\n * so `Connections` and `ModelRoles` can seed themselves from it once.\n */\n container.register(ConnectionsSettings);\n container.register(ModelRolesSettings);\n container.register(CapabilitiesSettings);\n container.register(ReaderPersonasSettings);\n container.register(WriterPersonasSettings);\n container.register(ProjectsSettings);\n container.register(AiPowerUpsSettingsPresenter);\n },\n resolve(container) {\n return {\n presenter: container.resolve(PresenterAbstraction)\n };\n }\n});\n"],"names":["AiPowerUpsSettingsFeature","createFeature","container","ConnectionsSettings","ModelRolesSettings","CapabilitiesSettings","ReaderPersonasSettings","WriterPersonasSettings","ProjectsSettings","AiPowerUpsSettingsPresenter","PresenterAbstraction"],"mappings":";;;;;;;;;AAUO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QAQdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;QACnBL,UAAU,QAAQ,CAACM;QACnBN,UAAU,QAAQ,CAACO;IACvB;IACA,SAAQP,SAAS;QACb,OAAO;YACH,WAAWA,UAAU,OAAO,CAACQ;QACjC;IACJ;AACJ"}
@@ -0,0 +1,13 @@
1
+ import type { IAiPowerUpsSettings } from "../../../admin/features/settings/shared/abstractions.js";
2
+ /**
3
+ * Whether a feature that runs on the Standard role has something to run on.
4
+ *
5
+ * The AI entry points hide themselves when the project has no model configured, and they used to
6
+ * test `providers.presets.length > 0` for it. That test passed for a row with no key in it, so the
7
+ * button appeared and the request failed. This one checks the whole chain the api will walk: the
8
+ * role is filled, the connection it names still exists, and that connection has a key.
9
+ *
10
+ * Admin only ever sees the masked key, and the mask is non-empty exactly when a key is stored, so
11
+ * it answers the question without the plaintext leaving the api.
12
+ */
13
+ export declare const hasUsableModel: (settings: IAiPowerUpsSettings | null) => boolean;
@@ -0,0 +1,9 @@
1
+ const hasUsableModel = (settings)=>{
2
+ const standard = settings?.modelRoles?.roles?.["standard"];
3
+ if (!standard?.model || !standard.connectionId) return false;
4
+ const connection = settings?.connections?.presets?.find((c)=>c.id === standard.connectionId);
5
+ return Boolean(connection?.apiKey);
6
+ };
7
+ export { hasUsableModel };
8
+
9
+ //# sourceMappingURL=hasUsableModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/presentation/AiPowerUpsSettings/hasUsableModel.js","sources":["../../../../src/admin/presentation/AiPowerUpsSettings/hasUsableModel.ts"],"sourcesContent":["import type { IAiPowerUpsSettings } from \"~/admin/features/settings/shared/abstractions.js\";\n\n/**\n * Whether a feature that runs on the Standard role has something to run on.\n *\n * The AI entry points hide themselves when the project has no model configured, and they used to\n * test `providers.presets.length > 0` for it. That test passed for a row with no key in it, so the\n * button appeared and the request failed. This one checks the whole chain the api will walk: the\n * role is filled, the connection it names still exists, and that connection has a key.\n *\n * Admin only ever sees the masked key, and the mask is non-empty exactly when a key is stored, so\n * it answers the question without the plaintext leaving the api.\n */\nexport const hasUsableModel = (settings: IAiPowerUpsSettings | null): boolean => {\n const standard = settings?.modelRoles?.roles?.[\"standard\"];\n\n if (!standard?.model || !standard.connectionId) {\n return false;\n }\n\n const connection = settings?.connections?.presets?.find(c => c.id === standard.connectionId);\n\n return Boolean(connection?.apiKey);\n};\n"],"names":["hasUsableModel","settings","standard","connection","c","Boolean"],"mappings":"AAaO,MAAMA,iBAAiB,CAACC;IAC3B,MAAMC,WAAWD,UAAU,YAAY,OAAO,CAAC,WAAW;IAE1D,IAAI,CAACC,UAAU,SAAS,CAACA,SAAS,YAAY,EAC1C,OAAO;IAGX,MAAMC,aAAaF,UAAU,aAAa,SAAS,KAAKG,CAAAA,IAAKA,EAAE,EAAE,KAAKF,SAAS,YAAY;IAE3F,OAAOG,QAAQF,YAAY;AAC/B"}
@@ -1,3 +1,4 @@
1
1
  export { AiPowerUpsSettingsFeature } from "./feature.js";
2
2
  export { useAiPowerUpsSettings } from "./useAiPowerUpsSettings.js";
3
+ export { hasUsableModel } from "./hasUsableModel.js";
3
4
  export { AiPowerUpsSettingsGroup } from "./settingsGroup.js";