@webiny/ai-powerups 0.0.0-unstable.b6d7105cee → 0.0.0-unstable.eb81deee7e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AiPowerups.d.ts +12 -0
- package/AiPowerups.js +3 -3
- package/AiPowerups.js.map +1 -1
- package/admin/Extension.d.ts +1 -1
- package/admin/Extension.js +10 -3
- package/admin/Extension.js.map +1 -1
- package/admin/domain/modelRoles.d.ts +17 -0
- package/admin/domain/modelRoles.js +8 -0
- package/admin/domain/modelRoles.js.map +1 -0
- package/admin/features/feature.js +2 -0
- package/admin/features/feature.js.map +1 -1
- package/admin/features/listCapabilities/ListCapabilitiesGateway.d.ts +12 -0
- package/admin/features/listCapabilities/ListCapabilitiesGateway.js +34 -0
- package/admin/features/listCapabilities/ListCapabilitiesGateway.js.map +1 -0
- package/admin/features/listCapabilities/ListCapabilitiesRepository.d.ts +13 -0
- package/admin/features/listCapabilities/ListCapabilitiesRepository.js +27 -0
- package/admin/features/listCapabilities/ListCapabilitiesRepository.js.map +1 -0
- package/admin/features/listCapabilities/ListCapabilitiesUseCase.d.ts +10 -0
- package/admin/features/listCapabilities/ListCapabilitiesUseCase.js +18 -0
- package/admin/features/listCapabilities/ListCapabilitiesUseCase.js.map +1 -0
- package/admin/features/listCapabilities/abstractions.d.ts +28 -0
- package/admin/features/listCapabilities/abstractions.js +7 -0
- package/admin/features/listCapabilities/abstractions.js.map +1 -0
- package/admin/features/listCapabilities/feature.d.ts +3 -0
- package/admin/features/listCapabilities/feature.js +21 -0
- package/admin/features/listCapabilities/feature.js.map +1 -0
- package/admin/features/listCapabilities/index.d.ts +3 -0
- package/admin/features/listCapabilities/index.js +2 -0
- package/admin/features/listModels/ListModelsGateway.js +18 -1
- package/admin/features/listModels/ListModelsGateway.js.map +1 -1
- package/admin/features/listModels/abstractions.d.ts +2 -0
- package/admin/features/listModels/abstractions.js.map +1 -1
- package/admin/features/settings/shared/abstractions.d.ts +58 -25
- package/admin/features/settings/shared/abstractions.js.map +1 -1
- package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.d.ts +2 -2
- package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.js +13 -1
- package/admin/presentation/AiPowerUpsSettings/AiPowerUpsSettingsPresenter.js.map +1 -1
- package/admin/presentation/AiPowerUpsSettings/feature.js +6 -2
- package/admin/presentation/AiPowerUpsSettings/feature.js.map +1 -1
- package/admin/presentation/AiPowerUpsSettings/hasUsableModel.d.ts +13 -0
- package/admin/presentation/AiPowerUpsSettings/hasUsableModel.js +9 -0
- package/admin/presentation/AiPowerUpsSettings/hasUsableModel.js.map +1 -0
- package/admin/presentation/AiPowerUpsSettings/index.d.ts +1 -0
- package/admin/presentation/AiPowerUpsSettings/index.js +1 -0
- package/admin/presentation/AiPowerUpsSettings/settingsGroup.d.ts +9 -0
- package/admin/presentation/AiPowerUpsSettings/settingsGroup.js.map +1 -1
- package/admin/presentation/CapabilitiesSettings.d.ts +39 -0
- package/admin/presentation/CapabilitiesSettings.js +104 -0
- package/admin/presentation/CapabilitiesSettings.js.map +1 -0
- package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsDialog.d.ts +2 -2
- package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsDrawer.d.ts +2 -2
- package/admin/presentation/CmsCompareEntryRevisions/CmsCompareEntryRevisionsMenuItem.d.ts +2 -2
- package/admin/presentation/CmsContentGeneration/CmsGenerateContentButton.d.ts +2 -2
- package/admin/presentation/CmsContentGeneration/CmsGenerateContentButton.js +2 -2
- package/admin/presentation/CmsContentGeneration/CmsGenerateContentButton.js.map +1 -1
- package/admin/presentation/CmsContentGeneration/CmsGenerateContentDialog.d.ts +2 -2
- package/admin/presentation/CmsContentGeneration/Extension.js +3 -3
- package/admin/presentation/CmsContentGeneration/Extension.js.map +1 -1
- package/admin/presentation/CmsEntryWizard/CmsEntryWizard.d.ts +2 -2
- package/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.d.ts +2 -2
- package/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.js +4 -1
- package/admin/presentation/CmsEntryWizard/CmsEntryWizardGate.js.map +1 -1
- package/admin/presentation/ConnectionsSettings.d.ts +25 -0
- package/admin/presentation/ConnectionsSettings.js +52 -0
- package/admin/presentation/ConnectionsSettings.js.map +1 -0
- package/admin/presentation/ModelRolesSettings.d.ts +29 -0
- package/admin/presentation/ModelRolesSettings.js +67 -0
- package/admin/presentation/ModelRolesSettings.js.map +1 -0
- package/admin/presentation/ProvidersSettings.js +1 -1
- package/admin/presentation/ProvidersSettings.js.map +1 -1
- package/admin/presentation/WbContentGeneration/GenerateContentButton.js +2 -2
- package/admin/presentation/WbContentGeneration/GenerateContentButton.js.map +1 -1
- package/admin/presentation/WbContentGeneration/GenerateContentDialog.d.ts +2 -2
- package/admin/presentation/modelRoles.d.ts +10 -0
- package/admin/presentation/modelRoles.js +23 -0
- package/admin/presentation/modelRoles.js.map +1 -0
- package/api/Extension.js +11 -3
- package/api/Extension.js.map +1 -1
- package/api/features/AdminAssistant/AdminAssistantStreamRoute.d.ts +34 -0
- package/api/features/AdminAssistant/AdminAssistantStreamRoute.js +42 -0
- package/api/features/AdminAssistant/AdminAssistantStreamRoute.js.map +1 -0
- package/api/features/AdminAssistant/AdminAssistantUseCase.d.ts +42 -0
- package/api/features/AdminAssistant/AdminAssistantUseCase.js +170 -0
- package/api/features/AdminAssistant/AdminAssistantUseCase.js.map +1 -0
- package/api/features/AdminAssistant/abstractions.d.ts +38 -0
- package/api/features/AdminAssistant/abstractions.js +6 -0
- package/api/features/AdminAssistant/abstractions.js.map +1 -0
- package/api/features/AdminAssistant/approvals.d.ts +29 -0
- package/api/features/AdminAssistant/approvals.js +30 -0
- package/api/features/AdminAssistant/approvals.js.map +1 -0
- package/api/features/AdminAssistant/capability.d.ts +31 -0
- package/api/features/AdminAssistant/capability.js +19 -0
- package/api/features/AdminAssistant/capability.js.map +1 -0
- package/api/features/AdminAssistant/events.d.ts +54 -0
- package/api/features/AdminAssistant/events.js +0 -0
- package/api/features/AdminAssistant/feature.d.ts +12 -0
- package/api/features/AdminAssistant/feature.js +23 -0
- package/api/features/AdminAssistant/feature.js.map +1 -0
- package/api/features/AdminAssistant/index.d.ts +5 -0
- package/api/features/AdminAssistant/index.js +3 -0
- package/api/features/AdminAssistant/parseChatBody.d.ts +14 -0
- package/api/features/AdminAssistant/parseChatBody.js +33 -0
- package/api/features/AdminAssistant/parseChatBody.js.map +1 -0
- package/api/features/AdminAssistant/systemPrompt.d.ts +7 -0
- package/api/features/AdminAssistant/systemPrompt.js +24 -0
- package/api/features/AdminAssistant/systemPrompt.js.map +1 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentAfterCreateHandler.js +1 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentAfterCreateHandler.js.map +1 -1
- package/api/features/AiImageEnrichment/AiImageEnrichmentStreamRoute.d.ts +36 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentStreamRoute.js +92 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentStreamRoute.js.map +1 -0
- package/api/features/AiImageEnrichment/AiImageEnrichmentTask.d.ts +21 -16
- package/api/features/AiImageEnrichment/AiImageEnrichmentTask.js +67 -110
- package/api/features/AiImageEnrichment/AiImageEnrichmentTask.js.map +1 -1
- package/api/features/AiImageEnrichment/ApplyImageEnrichmentUseCase.d.ts +18 -0
- package/api/features/AiImageEnrichment/ApplyImageEnrichmentUseCase.js +50 -0
- package/api/features/AiImageEnrichment/ApplyImageEnrichmentUseCase.js.map +1 -0
- package/api/features/AiImageEnrichment/EnrichmentCapabilityDisabledError.d.ts +9 -0
- package/api/features/AiImageEnrichment/EnrichmentCapabilityDisabledError.js +8 -0
- package/api/features/AiImageEnrichment/EnrichmentCapabilityDisabledError.js.map +1 -0
- package/api/features/AiImageEnrichment/PrepareImageEnrichmentUseCase.d.ts +17 -0
- package/api/features/AiImageEnrichment/PrepareImageEnrichmentUseCase.js +47 -0
- package/api/features/AiImageEnrichment/PrepareImageEnrichmentUseCase.js.map +1 -0
- package/api/features/AiImageEnrichment/abstractions.d.ts +66 -0
- package/api/features/AiImageEnrichment/abstractions.js +12 -0
- package/api/features/AiImageEnrichment/abstractions.js.map +1 -0
- package/api/features/AiImageEnrichment/buildEnrichmentAiRequest.d.ts +12 -0
- package/api/features/AiImageEnrichment/buildEnrichmentAiRequest.js +30 -0
- package/api/features/AiImageEnrichment/buildEnrichmentAiRequest.js.map +1 -0
- package/api/features/AiImageEnrichment/capability.d.ts +18 -0
- package/api/features/AiImageEnrichment/capability.js +19 -0
- package/api/features/AiImageEnrichment/capability.js.map +1 -0
- package/api/features/AiImageEnrichment/errors.d.ts +33 -0
- package/api/features/AiImageEnrichment/errors.js +29 -0
- package/api/features/AiImageEnrichment/errors.js.map +1 -0
- package/api/features/AiImageEnrichment/feature.js +11 -0
- package/api/features/AiImageEnrichment/feature.js.map +1 -1
- package/api/features/AiImageEnrichment/imageEnrichmentErrorStatusCode.d.ts +6 -0
- package/api/features/AiImageEnrichment/imageEnrichmentErrorStatusCode.js +10 -0
- package/api/features/AiImageEnrichment/imageEnrichmentErrorStatusCode.js.map +1 -0
- package/api/features/AiImageEnrichment/readEnrichmentPartial.d.ts +8 -0
- package/api/features/AiImageEnrichment/readEnrichmentPartial.js +16 -0
- package/api/features/AiImageEnrichment/readEnrichmentPartial.js.map +1 -0
- package/api/features/AiImageEnrichment/streamEvents.d.ts +36 -0
- package/api/features/AiImageEnrichment/streamEvents.js +0 -0
- package/api/features/Capabilities/AiCapabilityDisabledError.d.ts +16 -0
- package/api/features/Capabilities/AiCapabilityDisabledError.js +8 -0
- package/api/features/Capabilities/AiCapabilityDisabledError.js.map +1 -0
- package/api/features/Capabilities/CapabilitiesHandler.d.ts +28 -0
- package/api/features/Capabilities/CapabilitiesHandler.js +56 -0
- package/api/features/Capabilities/CapabilitiesHandler.js.map +1 -0
- package/api/features/Capabilities/ListAiCapabilitiesUseCase.d.ts +18 -0
- package/api/features/Capabilities/ListAiCapabilitiesUseCase.js +28 -0
- package/api/features/Capabilities/ListAiCapabilitiesUseCase.js.map +1 -0
- package/api/features/Capabilities/ResolveAiCapabilityUseCase.d.ts +31 -0
- package/api/features/Capabilities/ResolveAiCapabilityUseCase.js +90 -0
- package/api/features/Capabilities/ResolveAiCapabilityUseCase.js.map +1 -0
- package/api/features/Capabilities/abstractions.d.ts +83 -0
- package/api/features/Capabilities/abstractions.js +7 -0
- package/api/features/Capabilities/abstractions.js.map +1 -0
- package/api/features/Capabilities/composeSystemPrompt.d.ts +14 -0
- package/api/features/Capabilities/composeSystemPrompt.js +13 -0
- package/api/features/Capabilities/composeSystemPrompt.js.map +1 -0
- package/api/features/Capabilities/feature.d.ts +4 -0
- package/api/features/Capabilities/feature.js +15 -0
- package/api/features/Capabilities/feature.js.map +1 -0
- package/api/features/Capabilities/index.d.ts +6 -0
- package/api/features/Capabilities/index.js +4 -0
- package/api/features/Capabilities/types.d.ts +86 -0
- package/api/features/Capabilities/types.js +4 -0
- package/api/features/Capabilities/types.js.map +1 -0
- package/api/features/CmsCompareEntryRevisions/CmsCompareEntryRevisionsUseCase.d.ts +3 -5
- package/api/features/CmsCompareEntryRevisions/CmsCompareEntryRevisionsUseCase.js +11 -65
- package/api/features/CmsCompareEntryRevisions/CmsCompareEntryRevisionsUseCase.js.map +1 -1
- package/api/features/CmsCompareEntryRevisions/capability.d.ts +13 -0
- package/api/features/CmsCompareEntryRevisions/capability.js +64 -0
- package/api/features/CmsCompareEntryRevisions/capability.js.map +1 -0
- package/api/features/CmsCompareEntryRevisions/feature.js +2 -0
- package/api/features/CmsCompareEntryRevisions/feature.js.map +1 -1
- package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.d.ts +11 -6
- package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.js +19 -10
- package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentTask.js.map +1 -1
- package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentUseCase.d.ts +3 -5
- package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentUseCase.js +12 -20
- package/api/features/CmsGenerateEntryContent/CmsGenerateEntryContentUseCase.js.map +1 -1
- package/api/features/CmsGenerateEntryContent/capability.d.ts +17 -0
- package/api/features/CmsGenerateEntryContent/capability.js +17 -0
- package/api/features/CmsGenerateEntryContent/capability.js.map +1 -0
- package/api/features/CmsGenerateEntryContent/feature.js +2 -0
- package/api/features/CmsGenerateEntryContent/feature.js.map +1 -1
- package/api/features/CmsResolveImageTool/CmsResolveImageTool.js +1 -1
- package/api/features/CmsResolveImageTool/CmsResolveImageTool.js.map +1 -1
- package/api/features/Connections/ConnectionsGraphQLMapper.d.ts +20 -0
- package/api/features/Connections/ConnectionsGraphQLMapper.js +37 -0
- package/api/features/Connections/ConnectionsGraphQLMapper.js.map +1 -0
- package/api/features/Connections/ConnectionsHandler.d.ts +25 -0
- package/api/features/Connections/ConnectionsHandler.js +84 -0
- package/api/features/Connections/ConnectionsHandler.js.map +1 -0
- package/api/features/Connections/feature.d.ts +4 -0
- package/api/features/Connections/feature.js +13 -0
- package/api/features/Connections/feature.js.map +1 -0
- package/api/features/Connections/index.d.ts +2 -0
- package/api/features/Connections/index.js +1 -0
- package/api/features/Connections/legacyProviders.d.ts +26 -0
- package/api/features/Connections/legacyProviders.js +9 -0
- package/api/features/Connections/legacyProviders.js.map +1 -0
- package/api/features/Connections/types.d.ts +36 -0
- package/api/features/Connections/types.js +0 -0
- package/api/features/GetSettings/GetSettingsRepository.js +1 -1
- package/api/features/GetSettings/GetSettingsRepository.js.map +1 -1
- package/api/features/GetSettings/GetSettingsUseCase.d.ts +1 -1
- package/api/features/ModelRoles/ModelRolesHandler.d.ts +15 -0
- package/api/features/ModelRoles/ModelRolesHandler.js +74 -0
- package/api/features/ModelRoles/ModelRolesHandler.js.map +1 -0
- package/api/features/ModelRoles/feature.d.ts +4 -0
- package/api/features/ModelRoles/feature.js +11 -0
- package/api/features/ModelRoles/feature.js.map +1 -0
- package/api/features/ModelRoles/index.d.ts +4 -0
- package/api/features/ModelRoles/index.js +2 -0
- package/api/features/ModelRoles/roles.d.ts +16 -0
- package/api/features/ModelRoles/roles.js +9 -0
- package/api/features/ModelRoles/roles.js.map +1 -0
- package/api/features/ModelRoles/types.d.ts +21 -0
- package/api/features/ModelRoles/types.js +7 -0
- package/api/features/ModelRoles/types.js.map +1 -0
- package/api/features/Providers/ProvidersHandler.js.map +1 -1
- package/api/features/UpdateSettings/UpdateSettingsRepository.js +2 -2
- package/api/features/UpdateSettings/UpdateSettingsRepository.js.map +1 -1
- package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.d.ts +11 -6
- package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.js +19 -10
- package/api/features/WbGeneratePageContent/WbGeneratePageContentTask.js.map +1 -1
- package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.d.ts +3 -5
- package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.js +12 -20
- package/api/features/WbGeneratePageContent/WbGeneratePageContentUseCase.js.map +1 -1
- package/api/features/WbGeneratePageContent/capability.d.ts +16 -0
- package/api/features/WbGeneratePageContent/capability.js +17 -0
- package/api/features/WbGeneratePageContent/capability.js.map +1 -0
- package/api/features/WbGeneratePageContent/feature.js +2 -0
- package/api/features/WbGeneratePageContent/feature.js.map +1 -1
- package/api/features/WbTranslatePage/WbTranslatePageDecorator.d.ts +10 -5
- package/api/features/WbTranslatePage/WbTranslatePageDecorator.js +43 -21
- package/api/features/WbTranslatePage/WbTranslatePageDecorator.js.map +1 -1
- package/api/features/WbTranslatePage/capability.d.ts +13 -0
- package/api/features/WbTranslatePage/capability.js +19 -0
- package/api/features/WbTranslatePage/capability.js.map +1 -0
- package/api/features/WbTranslatePage/feature.js +2 -0
- package/api/features/WbTranslatePage/feature.js.map +1 -1
- package/api/features/shared/abstractions.d.ts +6 -1
- package/api/features/shared/abstractions.js.map +1 -1
- package/api/features/shared/modelId.d.ts +11 -0
- package/api/features/shared/modelId.js +4 -0
- package/api/features/shared/modelId.js.map +1 -0
- package/api/graphql/BaseGraphQLSchema.d.ts +3 -2
- package/api/graphql/BaseGraphQLSchema.js +31 -9
- package/api/graphql/BaseGraphQLSchema.js.map +1 -1
- package/api/graphql/CmsCompareEntryRevisionsSchema.d.ts +3 -2
- package/api/graphql/CmsCompareEntryRevisionsSchema.js +5 -1
- package/api/graphql/CmsCompareEntryRevisionsSchema.js.map +1 -1
- package/api/types.d.ts +3 -0
- package/api/types.js +3 -0
- package/{api/features/WbGeneratePageContent → domain}/LlmJsonResponse.d.ts +1 -0
- package/{api/features/WbGeneratePageContent → domain}/LlmJsonResponse.js +3 -0
- package/domain/LlmJsonResponse.js.map +1 -0
- package/exports/api/ai-powerups.d.ts +6 -0
- package/exports/api/ai-powerups.js +3 -0
- package/package.json +30 -29
- package/api/features/WbGeneratePageContent/LlmJsonResponse.js.map +0 -1
package/AiPowerups.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Both extensions load unconditionally; each gates itself at runtime.
|
|
4
|
+
*
|
|
5
|
+
* This used to sit inside `FeatureFlag.CanUseAiPowerups`, which reads project config while the
|
|
6
|
+
* project graph is built, so the decision was baked in at deploy time. A WCP licence that granted
|
|
7
|
+
* AI Power-Ups therefore did nothing until the next deploy, which is the wrong shape for something
|
|
8
|
+
* a customer can buy at any moment.
|
|
9
|
+
*
|
|
10
|
+
* The gate now lives where the licence is readable: `api/Extension.ts` checks the effective flags
|
|
11
|
+
* at `register()` (the licence is refreshed per request, before any feature registers), and
|
|
12
|
+
* `admin/Extension.tsx` checks them on render. `ai-chat` and `api-aco` already gate this way.
|
|
13
|
+
*/
|
|
2
14
|
export declare const AiPowerups: () => React.JSX.Element;
|
package/AiPowerups.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const AiPowerups = ()=>/*#__PURE__*/ react.createElement(
|
|
2
|
+
import { Api } from "@webiny/project-aws/api.js";
|
|
3
|
+
import { Admin } from "@webiny/project-aws/admin.js";
|
|
4
|
+
const AiPowerups = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
5
5
|
src: import.meta.dirname + "/api/Extension.js"
|
|
6
6
|
}), /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
7
7
|
src: import.meta.dirname + "/admin/Extension.js"
|
package/AiPowerups.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiPowerups.js","sources":["../src/AiPowerups.tsx"],"sourcesContent":["import React from \"react\";\nimport { Api
|
|
1
|
+
{"version":3,"file":"AiPowerups.js","sources":["../src/AiPowerups.tsx"],"sourcesContent":["import React from \"react\";\nimport { Api } from \"@webiny/project-aws/api.js\";\nimport { Admin } from \"@webiny/project-aws/admin.js\";\n\n/**\n * Both extensions load unconditionally; each gates itself at runtime.\n *\n * This used to sit inside `FeatureFlag.CanUseAiPowerups`, which reads project config while the\n * project graph is built, so the decision was baked in at deploy time. A WCP licence that granted\n * AI Power-Ups therefore did nothing until the next deploy, which is the wrong shape for something\n * a customer can buy at any moment.\n *\n * The gate now lives where the licence is readable: `api/Extension.ts` checks the effective flags\n * at `register()` (the licence is refreshed per request, before any feature registers), and\n * `admin/Extension.tsx` checks them on render. `ai-chat` and `api-aco` already gate this way.\n */\nexport const AiPowerups = () => {\n return (\n <>\n {/* Api extensions */}\n <Api.Extension src={import.meta.dirname + \"/api/Extension.js\"} />\n\n {/* Admin extensions */}\n <Admin.Extension src={import.meta.dirname + \"/admin/Extension.js\"} />\n </>\n );\n};\n"],"names":["AiPowerups","Api","Admin"],"mappings":";;;AAgBO,MAAMA,aAAa,IACf,WAAP,GACI,wDAEI,oBAACC,IAAI,SAAS;QAAC,KAAK,YAAY,OAAO,GAAG;sBAG1C,oBAACC,MAAM,SAAS;QAAC,KAAK,YAAY,OAAO,GAAG"}
|
package/admin/Extension.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const Extension: () => React.JSX.Element;
|
|
2
|
+
export declare const Extension: () => React.JSX.Element | null;
|
package/admin/Extension.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
import { AdminConfig, AdminLayout, RegisterFeature, useRouter } from "@webiny/app-admin";
|
|
2
|
+
import { AdminConfig, AdminLayout, RegisterFeature, useFeatureFlags, useRouter } from "@webiny/app-admin";
|
|
3
3
|
import { AiPowerUpsSettingsFeature } from "./presentation/AiPowerUpsSettings/index.js";
|
|
4
4
|
import { AiPowerUpsSettingsPage } from "./presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js";
|
|
5
5
|
import { WbContentGeneration } from "./presentation/WbContentGeneration/Extension.js";
|
|
@@ -16,7 +16,10 @@ const AiPowerUpsSettings = ()=>{
|
|
|
16
16
|
route: Routes.Settings,
|
|
17
17
|
element: /*#__PURE__*/ react.createElement(AdminLayout, {
|
|
18
18
|
title: "AI Power-Ups"
|
|
19
|
-
}, /*#__PURE__*/ react.createElement(
|
|
19
|
+
}, /*#__PURE__*/ react.createElement(AdminConfig.Breadcrumb, {
|
|
20
|
+
name: "ai-powerups",
|
|
21
|
+
label: "AI Power-Ups"
|
|
22
|
+
}), /*#__PURE__*/ react.createElement(AiPowerUpsSettingsPage, null))
|
|
20
23
|
}), /*#__PURE__*/ react.createElement(Menu, {
|
|
21
24
|
parent: "settings.system",
|
|
22
25
|
name: "aiPowerUps",
|
|
@@ -30,13 +33,17 @@ const AiPowerUpsSettings = ()=>{
|
|
|
30
33
|
})
|
|
31
34
|
}));
|
|
32
35
|
};
|
|
33
|
-
const Extension = ()
|
|
36
|
+
const Extension = ()=>{
|
|
37
|
+
const featureFlags = useFeatureFlags();
|
|
38
|
+
if (!featureFlags.isEnabled("aiPowerups")) return null;
|
|
39
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
34
40
|
feature: AiPromptFormFeature
|
|
35
41
|
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
36
42
|
feature: AiPowerUpsHeadlessFeatures
|
|
37
43
|
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
38
44
|
feature: AiPowerUpsSettingsFeature
|
|
39
45
|
}), /*#__PURE__*/ react.createElement(AiPowerUpsSettings, null), /*#__PURE__*/ react.createElement(WbContentGeneration, null), /*#__PURE__*/ react.createElement(CmsContentGeneration, null), /*#__PURE__*/ react.createElement(CmsCompareEntryRevisions, null), /*#__PURE__*/ react.createElement(CmsEntryWizardExtension, null));
|
|
46
|
+
};
|
|
40
47
|
export { Extension };
|
|
41
48
|
|
|
42
49
|
//# sourceMappingURL=Extension.js.map
|
package/admin/Extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/Extension.js","sources":["../../src/admin/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"admin/Extension.js","sources":["../../src/admin/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n AdminConfig,\n AdminLayout,\n useRouter,\n RegisterFeature,\n useFeatureFlags\n} from \"@webiny/app-admin\";\nimport { AiPowerUpsSettingsFeature } from \"./presentation/AiPowerUpsSettings/index.js\";\nimport { AiPowerUpsSettingsPage } from \"./presentation/AiPowerUpsSettings/AiPowerUpsSettingsPage.js\";\nimport { WbContentGeneration } from \"~/admin/presentation/WbContentGeneration/Extension.js\";\nimport { CmsContentGeneration } from \"~/admin/presentation/CmsContentGeneration/Extension.js\";\nimport { CmsEntryWizardExtension } from \"~/admin/presentation/CmsEntryWizard/Extension.js\";\nimport { CmsCompareEntryRevisions } from \"~/admin/presentation/CmsCompareEntryRevisions/Extension.js\";\nimport { AiPowerUpsHeadlessFeatures } from \"~/admin/features/feature.js\";\nimport { AiPromptFormFeature } from \"~/admin/presentation/AiPromptFormFactory/feature.js\";\nimport { Routes } from \"./routes.js\";\n\nconst { Menu, Route } = AdminConfig;\n\nconst AiPowerUpsSettings = () => {\n const { getLink } = useRouter();\n\n return (\n <AdminConfig>\n <Route\n route={Routes.Settings}\n element={\n <AdminLayout title={\"AI Power-Ups\"}>\n <AdminConfig.Breadcrumb name={\"ai-powerups\"} label={\"AI Power-Ups\"} />\n <AiPowerUpsSettingsPage />\n </AdminLayout>\n }\n />\n <Menu\n parent={\"settings.system\"}\n name={\"aiPowerUps\"}\n element={\n <Menu.Link\n text={\"AI Power-Ups\"}\n badge={<Menu.Link.Badge text=\"BETA\" />}\n to={getLink(Routes.Settings)}\n pinnable={true}\n />\n }\n />\n </AdminConfig>\n );\n};\n\nexport const Extension = () => {\n /*\n * Gated here rather than around `<Admin.Extension>` in `AiPowerups.tsx`, so a licence granted\n * after the last deploy takes effect on the next page load instead of the next deploy. Returning\n * null registers nothing, so an unlicensed project has no AI Power-Ups settings screen and no AI\n * buttons, rather than ones that fail when clicked. `app-audit-logs` gates the same way.\n */\n const featureFlags = useFeatureFlags();\n\n if (!featureFlags.isEnabled(\"aiPowerups\")) {\n return null;\n }\n\n return (\n <>\n <RegisterFeature feature={AiPromptFormFeature} />\n <RegisterFeature feature={AiPowerUpsHeadlessFeatures} />\n <RegisterFeature feature={AiPowerUpsSettingsFeature} />\n <AiPowerUpsSettings />\n {/* Website Builder Extension */}\n <WbContentGeneration />\n {/* Headless CMS Extension */}\n <CmsContentGeneration />\n {/* CMS Revision Comparison */}\n <CmsCompareEntryRevisions />\n {/* AI Entry Wizard (registered first so custom wizards can override) */}\n <CmsEntryWizardExtension />\n </>\n );\n};\n"],"names":["Menu","Route","AdminConfig","AiPowerUpsSettings","getLink","useRouter","Routes","AdminLayout","AiPowerUpsSettingsPage","Extension","featureFlags","useFeatureFlags","RegisterFeature","AiPromptFormFeature","AiPowerUpsHeadlessFeatures","AiPowerUpsSettingsFeature","WbContentGeneration","CmsContentGeneration","CmsCompareEntryRevisions","CmsEntryWizardExtension"],"mappings":";;;;;;;;;;;AAkBA,MAAM,EAAEA,MAAAA,IAAI,EAAEC,OAAAA,KAAK,EAAE,GAAGC;AAExB,MAAMC,qBAAqB;IACvB,MAAM,EAAEC,OAAO,EAAE,GAAGC;IAEpB,OAAO,WAAP,GACI,oBAACH,aAAWA,MAAAA,WAAAA,GACR,oBAACD,OAAKA;QACF,OAAOK,OAAO,QAAQ;QACtB,uBACI,oBAACC,aAAWA;YAAC,OAAO;yBAChB,oBAACL,YAAY,UAAU;YAAC,MAAM;YAAe,OAAO;0BACpD,oBAACM,wBAAsBA;sBAInC,oBAACR,MAAIA;QACD,QAAQ;QACR,MAAM;QACN,uBACI,oBAACA,KAAK,IAAI;YACN,MAAM;YACN,qBAAO,oBAACA,KAAK,IAAI,CAAC,KAAK;gBAAC,MAAK;;YAC7B,IAAII,QAAQE,OAAO,QAAQ;YAC3B,UAAU;;;AAMlC;AAEO,MAAMG,YAAY;IAOrB,MAAMC,eAAeC;IAErB,IAAI,CAACD,aAAa,SAAS,CAAC,eACxB,OAAO;IAGX,OAAO,WAAP,GACI,wDACI,oBAACE,iBAAeA;QAAC,SAASC;sBAC1B,oBAACD,iBAAeA;QAAC,SAASE;sBAC1B,oBAACF,iBAAeA;QAAC,SAASG;sBAC1B,oBAACZ,oBAAkBA,OAAAA,WAAAA,GAEnB,oBAACa,qBAAmBA,OAAAA,WAAAA,GAEpB,oBAACC,sBAAoBA,OAAAA,WAAAA,GAErB,oBAACC,0BAAwBA,OAAAA,WAAAA,GAEzB,oBAACC,yBAAuBA;AAGpC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model role ids, admin-side.
|
|
3
|
+
*
|
|
4
|
+
* A closed set by design: an extension can add a capability, never a role. That is why this is a
|
|
5
|
+
* record keyed by id everywhere it appears rather than a list — three named slots, not a collection
|
|
6
|
+
* someone appends to.
|
|
7
|
+
*
|
|
8
|
+
* The api owns the ids and the resolution rules (`~/api/features/ModelRoles/roles.ts`). They are
|
|
9
|
+
* repeated here rather than imported because admin and api are separate bundles and nothing else in
|
|
10
|
+
* `src/admin` reaches across that line; settings section names are already duplicated the same way.
|
|
11
|
+
*
|
|
12
|
+
* This lives in `domain` rather than next to the settings form so `features/` can use it without
|
|
13
|
+
* importing from `presentation/`. The labels and descriptions stay in
|
|
14
|
+
* `~/admin/presentation/modelRoles.js`, since those are words on a screen.
|
|
15
|
+
*/
|
|
16
|
+
export declare const AI_MODEL_ROLE_IDS: readonly ["fast", "standard", "vision"];
|
|
17
|
+
export type AiModelRoleId = (typeof AI_MODEL_ROLE_IDS)[number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/domain/modelRoles.js","sources":["../../../src/admin/domain/modelRoles.ts"],"sourcesContent":["/**\n * The model role ids, admin-side.\n *\n * A closed set by design: an extension can add a capability, never a role. That is why this is a\n * record keyed by id everywhere it appears rather than a list — three named slots, not a collection\n * someone appends to.\n *\n * The api owns the ids and the resolution rules (`~/api/features/ModelRoles/roles.ts`). They are\n * repeated here rather than imported because admin and api are separate bundles and nothing else in\n * `src/admin` reaches across that line; settings section names are already duplicated the same way.\n *\n * This lives in `domain` rather than next to the settings form so `features/` can use it without\n * importing from `presentation/`. The labels and descriptions stay in\n * `~/admin/presentation/modelRoles.js`, since those are words on a screen.\n */\nexport const AI_MODEL_ROLE_IDS = [\"fast\", \"standard\", \"vision\"] as const;\n\nexport type AiModelRoleId = (typeof AI_MODEL_ROLE_IDS)[number];\n"],"names":["AI_MODEL_ROLE_IDS"],"mappings":"AAeO,MAAMA,oBAAoB;IAAC;IAAQ;IAAY;CAAS"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/admin";
|
|
2
2
|
import { ListModelsFeature } from "./listModels/index.js";
|
|
3
|
+
import { ListCapabilitiesFeature } from "./listCapabilities/index.js";
|
|
3
4
|
import { SharedSettingsFeature } from "./settings/shared/index.js";
|
|
4
5
|
import { GetSettingsFeature } from "./settings/getSettings/index.js";
|
|
5
6
|
import { UpdateSettingsFeature } from "./settings/updateSettings/index.js";
|
|
@@ -12,6 +13,7 @@ const AiPowerUpsHeadlessFeatures = createFeature({
|
|
|
12
13
|
GetSettingsFeature.register(container);
|
|
13
14
|
UpdateSettingsFeature.register(container);
|
|
14
15
|
ListModelsFeature.register(container);
|
|
16
|
+
ListCapabilitiesFeature.register(container);
|
|
15
17
|
GeneratePageContentFeature.register(container);
|
|
16
18
|
CompareEntryRevisionsFeature.register(container);
|
|
17
19
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/features/feature.js","sources":["../../../src/admin/features/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { ListModelsFeature } from \"~/admin/features/listModels/index.js\";\nimport { SharedSettingsFeature } from \"~/admin/features/settings/shared/index.js\";\nimport { GetSettingsFeature } from \"~/admin/features/settings/getSettings/index.js\";\nimport { UpdateSettingsFeature } from \"~/admin/features/settings/updateSettings/index.js\";\nimport { GeneratePageContentFeature } from \"~/admin/features/generatePageContent/index.js\";\nimport { CompareEntryRevisionsFeature } from \"~/admin/features/compareEntryRevisions/index.js\";\n\nexport const AiPowerUpsHeadlessFeatures = createFeature({\n name: \"AiPowerUps/HeadlessFeatures\",\n register(container) {\n SharedSettingsFeature.register(container);\n GetSettingsFeature.register(container);\n UpdateSettingsFeature.register(container);\n ListModelsFeature.register(container);\n GeneratePageContentFeature.register(container);\n CompareEntryRevisionsFeature.register(container);\n },\n resolve() {\n return {};\n }\n});\n"],"names":["AiPowerUpsHeadlessFeatures","createFeature","container","SharedSettingsFeature","GetSettingsFeature","UpdateSettingsFeature","ListModelsFeature","GeneratePageContentFeature","CompareEntryRevisionsFeature"],"mappings":"
|
|
1
|
+
{"version":3,"file":"admin/features/feature.js","sources":["../../../src/admin/features/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { ListModelsFeature } from \"~/admin/features/listModels/index.js\";\nimport { ListCapabilitiesFeature } from \"~/admin/features/listCapabilities/index.js\";\nimport { SharedSettingsFeature } from \"~/admin/features/settings/shared/index.js\";\nimport { GetSettingsFeature } from \"~/admin/features/settings/getSettings/index.js\";\nimport { UpdateSettingsFeature } from \"~/admin/features/settings/updateSettings/index.js\";\nimport { GeneratePageContentFeature } from \"~/admin/features/generatePageContent/index.js\";\nimport { CompareEntryRevisionsFeature } from \"~/admin/features/compareEntryRevisions/index.js\";\n\nexport const AiPowerUpsHeadlessFeatures = createFeature({\n name: \"AiPowerUps/HeadlessFeatures\",\n register(container) {\n SharedSettingsFeature.register(container);\n GetSettingsFeature.register(container);\n UpdateSettingsFeature.register(container);\n ListModelsFeature.register(container);\n ListCapabilitiesFeature.register(container);\n GeneratePageContentFeature.register(container);\n CompareEntryRevisionsFeature.register(container);\n },\n resolve() {\n return {};\n }\n});\n"],"names":["AiPowerUpsHeadlessFeatures","createFeature","container","SharedSettingsFeature","GetSettingsFeature","UpdateSettingsFeature","ListModelsFeature","ListCapabilitiesFeature","GeneratePageContentFeature","CompareEntryRevisionsFeature"],"mappings":";;;;;;;;AASO,MAAMA,6BAA6BC,cAAc;IACpD,MAAM;IACN,UAASC,SAAS;QACdC,sBAAsB,QAAQ,CAACD;QAC/BE,mBAAmB,QAAQ,CAACF;QAC5BG,sBAAsB,QAAQ,CAACH;QAC/BI,kBAAkB,QAAQ,CAACJ;QAC3BK,wBAAwB,QAAQ,CAACL;QACjCM,2BAA2B,QAAQ,CAACN;QACpCO,6BAA6B,QAAQ,CAACP;IAC1C;IACA;QACI,OAAO,CAAC;IACZ;AACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MainGraphQLClient } from "@webiny/app/exports/admin.js";
|
|
2
|
+
import { ListCapabilitiesGateway as GatewayAbstraction } from "./abstractions.js";
|
|
3
|
+
import type { AiCapability } from "./abstractions.js";
|
|
4
|
+
declare class ListCapabilitiesGatewayImpl implements GatewayAbstraction.Interface {
|
|
5
|
+
private client;
|
|
6
|
+
constructor(client: MainGraphQLClient.Interface);
|
|
7
|
+
execute(): Promise<AiCapability[]>;
|
|
8
|
+
}
|
|
9
|
+
export declare const ListCapabilitiesGateway: typeof ListCapabilitiesGatewayImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListCapabilitiesGateway>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -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,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"}
|
|
@@ -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
|
-
|
|
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
|
|
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"}
|
|
@@ -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;
|
|
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
|
-
|
|
17
|
-
presets:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
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) & {
|
|
3
|
-
|
|
2
|
+
export declare const AiPowerUpsSettingsPage: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
|
|
3
|
+
readonly type: () => React.JSX.Element;
|
|
4
4
|
};
|
|
@@ -33,8 +33,20 @@ class AiPowerUpsSettingsPresenterImpl {
|
|
|
33
33
|
this.loading = true;
|
|
34
34
|
this.errors = [];
|
|
35
35
|
try {
|
|
36
|
-
const data = await
|
|
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
|
});
|