@burdenoff/microfe-botmanor 2026.1106.1 → 2026.1109.1
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/dist/botlit/BotlitRoutes.d.ts +2 -0
- package/dist/botlit/BotlitRoutes.js +40 -37
- package/dist/botlit/BotlitRoutes.js.map +1 -1
- package/dist/botlit/BotmanorRoot.d.ts +3 -0
- package/dist/botlit/BotmanorRoot.js +1 -2
- package/dist/botlit/BotmanorRoot.js.map +1 -1
- package/dist/botlit/BotmanorRootInner.d.ts +3 -0
- package/dist/botlit/BotmanorRootInner.js +9 -10
- package/dist/botlit/BotmanorRootInner.js.map +1 -1
- package/dist/botlit/components/AgentApprovalPanel.d.ts +20 -0
- package/dist/botlit/components/AgentApprovalPanel.js +49 -50
- package/dist/botlit/components/AgentApprovalPanel.js.map +1 -1
- package/dist/botlit/components/AiOperationsPanel.d.ts +14 -0
- package/dist/botlit/components/AiOperationsPanel.js +253 -0
- package/dist/botlit/components/AiOperationsPanel.js.map +1 -0
- package/dist/botlit/components/AssistantChannelPanel.d.ts +3 -0
- package/dist/botlit/components/AssistantChannelPanel.js +12 -13
- package/dist/botlit/components/AssistantChannelPanel.js.map +1 -1
- package/dist/botlit/components/AssistantRuntimeSetupPanel.d.ts +4 -0
- package/dist/botlit/components/AssistantRuntimeSetupPanel.js +14 -14
- package/dist/botlit/components/AssistantRuntimeSetupPanel.js.map +1 -1
- package/dist/botlit/components/AssistantWebsitePanel.d.ts +5 -0
- package/dist/botlit/components/AssistantWebsitePanel.js +15 -16
- package/dist/botlit/components/AssistantWebsitePanel.js.map +1 -1
- package/dist/botlit/components/Badge.d.ts +9 -0
- package/dist/botlit/components/Badge.js +1 -2
- package/dist/botlit/components/Badge.js.map +1 -1
- package/dist/botlit/components/Button.d.ts +10 -0
- package/dist/botlit/components/Button.js +1 -2
- package/dist/botlit/components/Button.js.map +1 -1
- package/dist/botlit/components/Card.d.ts +16 -0
- package/dist/botlit/components/Card.js +1 -2
- package/dist/botlit/components/Card.js.map +1 -1
- package/dist/botlit/components/ChannelSelectorSheet.d.ts +23 -0
- package/dist/botlit/components/ChannelSelectorSheet.js +1 -2
- package/dist/botlit/components/ChannelSelectorSheet.js.map +1 -1
- package/dist/botlit/components/EmptyState.d.ts +12 -0
- package/dist/botlit/components/EmptyState.js +1 -2
- package/dist/botlit/components/EmptyState.js.map +1 -1
- package/dist/botlit/components/ErrorState.d.ts +10 -0
- package/dist/botlit/components/ErrorState.js +5 -6
- package/dist/botlit/components/ErrorState.js.map +1 -1
- package/dist/botlit/components/Input.d.ts +27 -0
- package/dist/botlit/components/Input.js +2 -3
- package/dist/botlit/components/Input.js.map +1 -1
- package/dist/botlit/components/KnowledgeSourceImportPanel.d.ts +3 -0
- package/dist/botlit/components/KnowledgeSourceImportPanel.js +12 -13
- package/dist/botlit/components/KnowledgeSourceImportPanel.js.map +1 -1
- package/dist/botlit/components/ModelRegistrationPanel.d.ts +5 -0
- package/dist/botlit/components/ModelRegistrationPanel.js +1 -2
- package/dist/botlit/components/ModelRegistrationPanel.js.map +1 -1
- package/dist/botlit/components/PageLayout.d.ts +12 -0
- package/dist/botlit/components/PageLayout.js +1 -2
- package/dist/botlit/components/PageLayout.js.map +1 -1
- package/dist/botlit/components/QuotaExhaustedDialog.d.ts +9 -0
- package/dist/botlit/components/QuotaExhaustedDialog.js +1 -2
- package/dist/botlit/components/QuotaExhaustedDialog.js.map +1 -1
- package/dist/botlit/components/RetentionStatusPanel.d.ts +2 -0
- package/dist/botlit/components/RetentionStatusPanel.js +18 -19
- package/dist/botlit/components/RetentionStatusPanel.js.map +1 -1
- package/dist/botlit/components/RouteLoader.d.ts +23 -0
- package/dist/botlit/components/RouteLoader.js +1 -2
- package/dist/botlit/components/RouteLoader.js.map +1 -1
- package/dist/botlit/components/VersionHistoryPanel.d.ts +12 -0
- package/dist/botlit/components/VersionHistoryPanel.js +23 -24
- package/dist/botlit/components/VersionHistoryPanel.js.map +1 -1
- package/dist/botlit/components/WorkspaceRequired.d.ts +18 -0
- package/dist/botlit/components/WorkspaceRequired.js +1 -2
- package/dist/botlit/components/WorkspaceRequired.js.map +1 -1
- package/dist/botlit/components/index.d.ts +14 -0
- package/dist/botlit/hooks/index.d.ts +36 -0
- package/dist/botlit/hooks/index.js +15 -13
- package/dist/botlit/hooks/internal/mutationInput.d.ts +56 -0
- package/dist/botlit/hooks/internal/mutationInput.js +1 -2
- package/dist/botlit/hooks/internal/mutationInput.js.map +1 -1
- package/dist/botlit/hooks/internal/workspaceGateway.d.ts +54 -0
- package/dist/botlit/hooks/internal/workspaceGateway.js +17 -19
- package/dist/botlit/hooks/internal/workspaceGateway.js.map +1 -1
- package/dist/botlit/hooks/useA2A.d.ts +104 -0
- package/dist/botlit/hooks/useA2A.js +45 -45
- package/dist/botlit/hooks/useA2A.js.map +1 -1
- package/dist/botlit/hooks/useAgentApprovals.d.ts +62 -0
- package/dist/botlit/hooks/useAgentApprovals.js +38 -39
- package/dist/botlit/hooks/useAgentApprovals.js.map +1 -1
- package/dist/botlit/hooks/useAgents.d.ts +105 -0
- package/dist/botlit/hooks/useAgents.js +53 -54
- package/dist/botlit/hooks/useAgents.js.map +1 -1
- package/dist/botlit/hooks/useAiOperations.d.ts +95 -0
- package/dist/botlit/hooks/useAiOperations.js +154 -0
- package/dist/botlit/hooks/useAiOperations.js.map +1 -0
- package/dist/botlit/hooks/useAssistantChannels.d.ts +16 -0
- package/dist/botlit/hooks/useAssistantChannels.js +1 -2
- package/dist/botlit/hooks/useAssistantChannels.js.map +1 -1
- package/dist/botlit/hooks/useAssistantRuntimeSetup.d.ts +17 -0
- package/dist/botlit/hooks/useAssistantRuntimeSetup.js +1 -2
- package/dist/botlit/hooks/useAssistantRuntimeSetup.js.map +1 -1
- package/dist/botlit/hooks/useAssistantWebsites.d.ts +18 -0
- package/dist/botlit/hooks/useAssistantWebsites.js +1 -2
- package/dist/botlit/hooks/useAssistantWebsites.js.map +1 -1
- package/dist/botlit/hooks/useBotWorkflow.d.ts +22 -0
- package/dist/botlit/hooks/useBotWorkflow.js +1 -2
- package/dist/botlit/hooks/useBotWorkflow.js.map +1 -1
- package/dist/botlit/hooks/useBots.d.ts +68 -0
- package/dist/botlit/hooks/useBots.js +32 -33
- package/dist/botlit/hooks/useBots.js.map +1 -1
- package/dist/botlit/hooks/useBuckets.d.ts +57 -0
- package/dist/botlit/hooks/useBuckets.js +38 -39
- package/dist/botlit/hooks/useBuckets.js.map +1 -1
- package/dist/botlit/hooks/useChannels.d.ts +87 -0
- package/dist/botlit/hooks/useChannels.js +73 -73
- package/dist/botlit/hooks/useChannels.js.map +1 -1
- package/dist/botlit/hooks/useConversations.d.ts +42 -0
- package/dist/botlit/hooks/useConversations.js +1 -2
- package/dist/botlit/hooks/useConversations.js.map +1 -1
- package/dist/botlit/hooks/useExecutions.d.ts +87 -0
- package/dist/botlit/hooks/useExecutions.js +37 -37
- package/dist/botlit/hooks/useExecutions.js.map +1 -1
- package/dist/botlit/hooks/useKnowledgeBases.d.ts +79 -0
- package/dist/botlit/hooks/useKnowledgeBases.js +40 -39
- package/dist/botlit/hooks/useKnowledgeBases.js.map +1 -1
- package/dist/botlit/hooks/useKnowledgeSourceImports.d.ts +21 -0
- package/dist/botlit/hooks/useKnowledgeSourceImports.js +1 -2
- package/dist/botlit/hooks/useKnowledgeSourceImports.js.map +1 -1
- package/dist/botlit/hooks/useLLMProviders.d.ts +66 -0
- package/dist/botlit/hooks/useLLMProviders.js +25 -26
- package/dist/botlit/hooks/useLLMProviders.js.map +1 -1
- package/dist/botlit/hooks/useMCPServers.d.ts +71 -0
- package/dist/botlit/hooks/useMCPServers.js +40 -38
- package/dist/botlit/hooks/useMCPServers.js.map +1 -1
- package/dist/botlit/hooks/usePolicies.d.ts +60 -0
- package/dist/botlit/hooks/usePolicies.js +49 -49
- package/dist/botlit/hooks/usePolicies.js.map +1 -1
- package/dist/botlit/hooks/usePromptTemplates.d.ts +88 -0
- package/dist/botlit/hooks/usePromptTemplates.js +57 -57
- package/dist/botlit/hooks/usePromptTemplates.js.map +1 -1
- package/dist/botlit/hooks/useRetention.d.ts +26 -0
- package/dist/botlit/hooks/useRetention.js +3 -3
- package/dist/botlit/hooks/useRetention.js.map +1 -1
- package/dist/botlit/hooks/useRetrievalProfiles.d.ts +75 -0
- package/dist/botlit/hooks/useRetrievalProfiles.js +47 -47
- package/dist/botlit/hooks/useRetrievalProfiles.js.map +1 -1
- package/dist/botlit/hooks/useSkills.d.ts +64 -0
- package/dist/botlit/hooks/useSkills.js +53 -53
- package/dist/botlit/hooks/useSkills.js.map +1 -1
- package/dist/botlit/hooks/useStore.d.ts +112 -0
- package/dist/botlit/hooks/useStore.js +55 -55
- package/dist/botlit/hooks/useStore.js.map +1 -1
- package/dist/botlit/hooks/useUserPlatformConnection.d.ts +80 -0
- package/dist/botlit/hooks/useUserPlatformConnection.js +19 -19
- package/dist/botlit/hooks/useUserPlatformConnection.js.map +1 -1
- package/dist/botlit/index.d.ts +16 -0
- package/dist/botlit/index.js +12 -11
- package/dist/botlit/pages/A2AAgentDetailPage.d.ts +6 -0
- package/dist/botlit/pages/A2AAgentDetailPage.js +171 -178
- package/dist/botlit/pages/A2AAgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/A2ARegistryPage.d.ts +2 -0
- package/dist/botlit/pages/A2ARegistryPage.js +25 -26
- package/dist/botlit/pages/A2ARegistryPage.js.map +1 -1
- package/dist/botlit/pages/AgentApprovalsPage.d.ts +2 -0
- package/dist/botlit/pages/AgentApprovalsPage.js +32 -33
- package/dist/botlit/pages/AgentApprovalsPage.js.map +1 -1
- package/dist/botlit/pages/AgentBuilderPage.d.ts +2 -0
- package/dist/botlit/pages/AgentBuilderPage.js +59 -60
- package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
- package/dist/botlit/pages/AgentDetailPage.d.ts +2 -0
- package/dist/botlit/pages/AgentDetailPage.js +202 -190
- package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/AgentsListPage.d.ts +2 -0
- package/dist/botlit/pages/AgentsListPage.js +71 -72
- package/dist/botlit/pages/AgentsListPage.js.map +1 -1
- package/dist/botlit/pages/AiOperationsPage.d.ts +2 -0
- package/dist/botlit/pages/AiOperationsPage.js +165 -0
- package/dist/botlit/pages/AiOperationsPage.js.map +1 -0
- package/dist/botlit/pages/BotChannelsTab.d.ts +7 -0
- package/dist/botlit/pages/BotChannelsTab.js +120 -122
- package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
- package/dist/botlit/pages/BotDetailPage.d.ts +7 -0
- package/dist/botlit/pages/BotDetailPage.js +246 -237
- package/dist/botlit/pages/BotDetailPage.js.map +1 -1
- package/dist/botlit/pages/BotWorkflowTab.d.ts +11 -0
- package/dist/botlit/pages/BotWorkflowTab.js +20 -21
- package/dist/botlit/pages/BotWorkflowTab.js.map +1 -1
- package/dist/botlit/pages/BotsListPage.d.ts +2 -0
- package/dist/botlit/pages/BotsListPage.js +52 -53
- package/dist/botlit/pages/BotsListPage.js.map +1 -1
- package/dist/botlit/pages/BucketsPage.d.ts +2 -0
- package/dist/botlit/pages/BucketsPage.js +260 -261
- package/dist/botlit/pages/BucketsPage.js.map +1 -1
- package/dist/botlit/pages/ChannelDetailPage.d.ts +6 -0
- package/dist/botlit/pages/ChannelDetailPage.js +97 -96
- package/dist/botlit/pages/ChannelDetailPage.js.map +1 -1
- package/dist/botlit/pages/ChannelRoutesPage.d.ts +2 -0
- package/dist/botlit/pages/ChannelRoutesPage.js +23 -24
- package/dist/botlit/pages/ChannelRoutesPage.js.map +1 -1
- package/dist/botlit/pages/ChannelsPage.d.ts +2 -0
- package/dist/botlit/pages/ChannelsPage.js +44 -45
- package/dist/botlit/pages/ChannelsPage.js.map +1 -1
- package/dist/botlit/pages/ChatPage.d.ts +1 -0
- package/dist/botlit/pages/ChatPage.js +10 -11
- package/dist/botlit/pages/ChatPage.js.map +1 -1
- package/dist/botlit/pages/ConversationDetailPage.d.ts +2 -0
- package/dist/botlit/pages/ConversationsPage.d.ts +2 -0
- package/dist/botlit/pages/DashboardPage.d.ts +2 -0
- package/dist/botlit/pages/DashboardPage.js +37 -38
- package/dist/botlit/pages/DashboardPage.js.map +1 -1
- package/dist/botlit/pages/ExecutionDetailPage.d.ts +2 -0
- package/dist/botlit/pages/ExecutionDetailPage.js +47 -48
- package/dist/botlit/pages/ExecutionDetailPage.js.map +1 -1
- package/dist/botlit/pages/ExecutionsPage.d.ts +2 -0
- package/dist/botlit/pages/ExecutionsPage.js +72 -70
- package/dist/botlit/pages/ExecutionsPage.js.map +1 -1
- package/dist/botlit/pages/InstalledPackagesPage.d.ts +2 -0
- package/dist/botlit/pages/InstalledPackagesPage.js +77 -78
- package/dist/botlit/pages/InstalledPackagesPage.js.map +1 -1
- package/dist/botlit/pages/KnowledgeBaseDetailPage.d.ts +6 -0
- package/dist/botlit/pages/KnowledgeBaseDetailPage.js +171 -181
- package/dist/botlit/pages/KnowledgeBaseDetailPage.js.map +1 -1
- package/dist/botlit/pages/KnowledgeBasesPage.d.ts +2 -0
- package/dist/botlit/pages/KnowledgeBasesPage.js +30 -31
- package/dist/botlit/pages/KnowledgeBasesPage.js.map +1 -1
- package/dist/botlit/pages/MCPServerDetailPage.d.ts +6 -0
- package/dist/botlit/pages/MCPServerDetailPage.js +82 -83
- package/dist/botlit/pages/MCPServerDetailPage.js.map +1 -1
- package/dist/botlit/pages/MCPServersPage.d.ts +2 -0
- package/dist/botlit/pages/MCPServersPage.js +54 -55
- package/dist/botlit/pages/MCPServersPage.js.map +1 -1
- package/dist/botlit/pages/PoliciesPage.d.ts +2 -0
- package/dist/botlit/pages/PoliciesPage.js +25 -26
- package/dist/botlit/pages/PoliciesPage.js.map +1 -1
- package/dist/botlit/pages/PolicyDetailPage.d.ts +6 -0
- package/dist/botlit/pages/PolicyDetailPage.js +257 -259
- package/dist/botlit/pages/PolicyDetailPage.js.map +1 -1
- package/dist/botlit/pages/PromptStudioPage.d.ts +2 -0
- package/dist/botlit/pages/PromptStudioPage.js +35 -35
- package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
- package/dist/botlit/pages/PromptTemplateDetailPage.d.ts +6 -0
- package/dist/botlit/pages/PromptTemplateDetailPage.js +363 -362
- package/dist/botlit/pages/PromptTemplateDetailPage.js.map +1 -1
- package/dist/botlit/pages/PromptTemplatesPage.d.ts +2 -0
- package/dist/botlit/pages/PromptTemplatesPage.js +26 -27
- package/dist/botlit/pages/PromptTemplatesPage.js.map +1 -1
- package/dist/botlit/pages/RetrievalProfileDetailPage.d.ts +6 -0
- package/dist/botlit/pages/RetrievalProfileDetailPage.js +150 -158
- package/dist/botlit/pages/RetrievalProfileDetailPage.js.map +1 -1
- package/dist/botlit/pages/RetrievalProfilesPage.d.ts +2 -0
- package/dist/botlit/pages/RetrievalProfilesPage.js +24 -25
- package/dist/botlit/pages/RetrievalProfilesPage.js.map +1 -1
- package/dist/botlit/pages/SettingsPage.d.ts +2 -0
- package/dist/botlit/pages/SettingsPage.js +124 -125
- package/dist/botlit/pages/SettingsPage.js.map +1 -1
- package/dist/botlit/pages/SkillDetailPage.d.ts +6 -0
- package/dist/botlit/pages/SkillDetailPage.js +216 -217
- package/dist/botlit/pages/SkillDetailPage.js.map +1 -1
- package/dist/botlit/pages/SkillsPage.d.ts +2 -0
- package/dist/botlit/pages/SkillsPage.js +24 -25
- package/dist/botlit/pages/SkillsPage.js.map +1 -1
- package/dist/botlit/pages/StorePackageDetailPage.d.ts +2 -0
- package/dist/botlit/pages/StorePackageDetailPage.js +38 -39
- package/dist/botlit/pages/StorePackageDetailPage.js.map +1 -1
- package/dist/botlit/pages/StorePage.d.ts +2 -0
- package/dist/botlit/pages/StorePage.js +135 -136
- package/dist/botlit/pages/StorePage.js.map +1 -1
- package/dist/botlit/pages/index.d.ts +39 -0
- package/dist/botlit/permissions/PermissionRequired.d.ts +20 -0
- package/dist/botlit/permissions/PermissionRequired.js +10 -11
- package/dist/botlit/permissions/PermissionRequired.js.map +1 -1
- package/dist/botlit/permissions/botmanorPermissions.d.ts +82 -0
- package/dist/botlit/permissions/botmanorPermissions.js +1 -2
- package/dist/botlit/permissions/botmanorPermissions.js.map +1 -1
- package/dist/botlit/permissions/index.d.ts +7 -0
- package/dist/botlit/permissions/index.js +4 -3
- package/dist/botlit/permissions/useBotmanorPermissions.d.ts +41 -0
- package/dist/botlit/permissions/useBotmanorPermissions.js +1 -2
- package/dist/botlit/permissions/useBotmanorPermissions.js.map +1 -1
- package/dist/botlit/providers/BotlitProvider.d.ts +14 -0
- package/dist/botlit/providers/BotlitProvider.js +3 -3
- package/dist/botlit/providers/BotlitProvider.js.map +1 -1
- package/dist/botlit/store/botlitStore.d.ts +85 -0
- package/dist/botlit/store/botlitStore.js +1 -2
- package/dist/botlit/store/botlitStore.js.map +1 -1
- package/dist/botlit/store/renamedKeyStorage.d.ts +13 -0
- package/dist/botlit/store/renamedKeyStorage.js +1 -2
- package/dist/botlit/store/renamedKeyStorage.js.map +1 -1
- package/dist/botlit/types/index.d.ts +1008 -0
- package/dist/botlit/utils/cn.d.ts +2 -0
- package/dist/botlit/utils/cn.js +1 -2
- package/dist/botlit/utils/cn.js.map +1 -1
- package/dist/botlit/utils/embedding-models.d.ts +9 -0
- package/dist/botlit/utils/embedding-models.js +1 -2
- package/dist/botlit/utils/embedding-models.js.map +1 -1
- package/dist/botlit/utils/errors.d.ts +19 -0
- package/dist/botlit/utils/errors.js +1 -2
- package/dist/botlit/utils/errors.js.map +1 -1
- package/dist/botlit/utils/formatters.d.ts +38 -0
- package/dist/botlit/utils/formatters.js +0 -1
- package/dist/botlit/utils/formatters.js.map +1 -1
- package/dist/botlit/utils/navigation.d.ts +19 -0
- package/dist/botlit/utils/navigation.js +1 -2
- package/dist/botlit/utils/navigation.js.map +1 -1
- package/dist/botlit/utils/policyConfig.d.ts +68 -0
- package/dist/botlit/utils/policyConfig.js +2 -3
- package/dist/botlit/utils/policyConfig.js.map +1 -1
- package/dist/botlit/utils/unions.d.ts +25 -0
- package/dist/botlit/utils/unions.js +1 -2
- package/dist/botlit/utils/unions.js.map +1 -1
- package/dist/dev/App.d.ts +2 -0
- package/dist/dev/main.d.ts +0 -0
- package/dist/generated/global-operations.d.ts +197 -0
- package/dist/generated/global-operations.js +1 -2
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.d.ts +27678 -0
- package/dist/generated/global-types.js +1 -2
- package/dist/generated/global-types.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +5489 -0
- package/dist/generated/wspace-operations.js +172 -75
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +152017 -0
- package/dist/generated/wspace-types.js +6 -5
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/shared/hooks/useTr.d.ts +16 -0
- package/dist/shared/hooks/useTr.js +1 -2
- package/dist/shared/hooks/useTr.js.map +1 -1
- package/dist/stories/Badge.stories.d.ts +11 -0
- package/dist/stories/Button.stories.d.ts +13 -0
- package/dist/stories/EmptyState.stories.d.ts +8 -0
- package/dist/stories/StatusBadge.stories.d.ts +9 -0
- package/dist/test/fixtures.d.ts +39 -0
- package/dist/test/happydom.d.ts +1 -0
- package/dist/test/renderPage.d.ts +18 -0
- package/dist/test/setup.d.ts +9 -0
- package/dist/utils/nativeBridge.d.ts +2 -0
- package/dist/utils/nativeBridge.js +1 -2
- package/package.json +87 -60
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { BOTMANOR_PERMISSIONS as
|
|
5
|
-
import { BotmanorPermissionGate as
|
|
6
|
-
import {
|
|
2
|
+
import { Card as t, CardContent as n, CardDescription as r, CardHeader as i, CardTitle as a } from "./Card.js";
|
|
3
|
+
import { Button as o } from "./Button.js";
|
|
4
|
+
import { BOTMANOR_PERMISSIONS as s } from "../permissions/botmanorPermissions.js";
|
|
5
|
+
import { BotmanorPermissionGate as c } from "../permissions/useBotmanorPermissions.js";
|
|
6
|
+
import { Badge as l } from "./Badge.js";
|
|
7
|
+
import { useAgentApprovalActions as u, useAgentApprovalRequests as d, useAgentApprovalSettings as f } from "../hooks/useAgentApprovals.js";
|
|
8
|
+
import { useBotlit as p } from "../providers/BotlitProvider.js";
|
|
9
|
+
import { formatRelativeTime as m } from "../utils/formatters.js";
|
|
7
10
|
import "../permissions/index.js";
|
|
8
|
-
import { Card as o, CardContent as s, CardDescription as c, CardHeader as l, CardTitle as u } from "./Card.js";
|
|
9
|
-
import { Badge as d } from "./Badge.js";
|
|
10
|
-
import { useAgentApprovalActions as f, useAgentApprovalRequests as p, useAgentApprovalSettings as m } from "../hooks/useAgentApprovals.js";
|
|
11
11
|
import { useState as h } from "react";
|
|
12
12
|
import { Dialog as g, DialogContent as _, DialogDescription as v, DialogFooter as y, DialogHeader as b, DialogTitle as x, Textarea as S } from "@burdenoff/fe-libs/ui";
|
|
13
13
|
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
14
14
|
import { AlertTriangle as E, CheckCircle2 as D, Send as O, ShieldCheck as k, XCircle as A } from "lucide-react";
|
|
15
15
|
import { toast as j } from "sonner";
|
|
16
|
-
|
|
16
|
+
// src/botlit/components/AgentApprovalPanel.tsx
|
|
17
17
|
function M(e) {
|
|
18
18
|
return e === "PENDING" ? "warning" : e === "APPROVED" ? "success" : e === "REJECTED" ? "destructive" : "outline";
|
|
19
19
|
}
|
|
20
20
|
var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
21
|
-
let
|
|
21
|
+
let a = e(), [s, c] = h(""), l = t === "reject", u = {
|
|
22
22
|
request: {
|
|
23
|
-
title:
|
|
24
|
-
description:
|
|
25
|
-
confirm:
|
|
23
|
+
title: a("botlit.agentApproval.dialog.request.title", "Request activation"),
|
|
24
|
+
description: a("botlit.agentApproval.dialog.request.description", "A reviewer will check the agent's current prompt, model, tools and limits before it goes live. Changing the agent afterwards makes this request stale."),
|
|
25
|
+
confirm: a("botlit.agentApproval.dialog.request.confirm", "Submit for review")
|
|
26
26
|
},
|
|
27
27
|
approve: {
|
|
28
|
-
title:
|
|
29
|
-
description:
|
|
30
|
-
confirm:
|
|
28
|
+
title: a("botlit.agentApproval.dialog.approve.title", "Approve and go live"),
|
|
29
|
+
description: a("botlit.agentApproval.dialog.approve.description", "Approving publishes the agent's draft and makes it ACTIVE immediately."),
|
|
30
|
+
confirm: a("botlit.agentApproval.dialog.approve.confirm", "Approve")
|
|
31
31
|
},
|
|
32
32
|
reject: {
|
|
33
|
-
title:
|
|
34
|
-
description:
|
|
35
|
-
confirm:
|
|
33
|
+
title: a("botlit.agentApproval.dialog.reject.title", "Reject activation"),
|
|
34
|
+
description: a("botlit.agentApproval.dialog.reject.description", "Tell the requester what needs to change. The agent stays as it is."),
|
|
35
|
+
confirm: a("botlit.agentApproval.dialog.reject.confirm", "Reject")
|
|
36
36
|
}
|
|
37
37
|
}, d = t ? u[t] : null;
|
|
38
38
|
return /* @__PURE__ */ w(g, {
|
|
@@ -43,20 +43,20 @@ var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
|
43
43
|
children: /* @__PURE__ */ T(_, { children: [
|
|
44
44
|
/* @__PURE__ */ T(b, { children: [/* @__PURE__ */ w(x, { children: d?.title }), /* @__PURE__ */ w(v, { children: d?.description })] }),
|
|
45
45
|
/* @__PURE__ */ w(S, {
|
|
46
|
-
"aria-label": t === "request" ?
|
|
46
|
+
"aria-label": t === "request" ? a("botlit.agentApproval.dialog.noteLabel", "Note for the reviewer") : a("botlit.agentApproval.dialog.reasonLabel", "Reason"),
|
|
47
47
|
value: s,
|
|
48
48
|
maxLength: 2e3,
|
|
49
49
|
onChange: (e) => c(e.target.value),
|
|
50
|
-
placeholder: t === "request" ?
|
|
50
|
+
placeholder: t === "request" ? a("botlit.agentApproval.dialog.notePlaceholder", "What changed and why (optional)") : l ? a("botlit.agentApproval.dialog.reasonRequiredPlaceholder", "Reason (required)") : a("botlit.agentApproval.dialog.reasonPlaceholder", "Reason (optional)"),
|
|
51
51
|
rows: 4
|
|
52
52
|
}),
|
|
53
|
-
/* @__PURE__ */ T(y, { children: [/* @__PURE__ */ w(
|
|
53
|
+
/* @__PURE__ */ T(y, { children: [/* @__PURE__ */ w(o, {
|
|
54
54
|
variant: "outline",
|
|
55
55
|
onClick: () => {
|
|
56
56
|
c(""), r();
|
|
57
57
|
},
|
|
58
|
-
children:
|
|
59
|
-
}), /* @__PURE__ */ w(
|
|
58
|
+
children: a("botlit.common.cancel", "Cancel")
|
|
59
|
+
}), /* @__PURE__ */ w(o, {
|
|
60
60
|
variant: t === "reject" ? "destructive" : "default",
|
|
61
61
|
isLoading: n,
|
|
62
62
|
disabled: l && s.trim().length === 0,
|
|
@@ -68,7 +68,7 @@ var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
|
68
68
|
] })
|
|
69
69
|
});
|
|
70
70
|
}, P = ({ agentId: g, agentStatus: _, onChanged: v }) => {
|
|
71
|
-
let y = e(), { currentUser: b } =
|
|
71
|
+
let y = e(), { currentUser: b } = p(), x = f(), S = d({ agentId: g }), { run: P, pending: F } = u(), [I, L] = h(null), R = x.data?.requireActivationApproval === !0, z = S.data.find((e) => e.status === "PENDING") ?? null, B = S.data.filter((e) => e.status !== "PENDING").slice(0, 10), V = z !== null && z.requestedById === b?.id, H = (e) => e && e === b?.id ? y("botlit.agentApproval.you", "you") : e ?? "—", U = async (e) => {
|
|
72
72
|
if (I) try {
|
|
73
73
|
I.kind === "request" ? (await P({
|
|
74
74
|
kind: "request",
|
|
@@ -96,31 +96,31 @@ var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
|
96
96
|
j.error(e instanceof Error ? e.message : y("botlit.agentApproval.toast.error", "Approval action failed"));
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
return /* @__PURE__ */ T(
|
|
99
|
+
return /* @__PURE__ */ T(t, {
|
|
100
100
|
"data-testid": "agent-approval-panel",
|
|
101
101
|
children: [
|
|
102
|
-
/* @__PURE__ */ T(
|
|
102
|
+
/* @__PURE__ */ T(i, {
|
|
103
103
|
className: "flex flex-row items-start justify-between gap-4",
|
|
104
|
-
children: [/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T(
|
|
104
|
+
children: [/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T(a, {
|
|
105
105
|
className: "flex items-center gap-2",
|
|
106
106
|
children: [
|
|
107
107
|
/* @__PURE__ */ w(k, { size: 18 }),
|
|
108
108
|
y("botlit.agentApproval.title", "Activation approval"),
|
|
109
|
-
/* @__PURE__ */ w(
|
|
109
|
+
/* @__PURE__ */ w(l, {
|
|
110
110
|
variant: R ? "warning" : "outline",
|
|
111
111
|
children: R ? y("botlit.agentApproval.required", "Required in this workspace") : y("botlit.agentApproval.optional", "Optional")
|
|
112
112
|
})
|
|
113
113
|
]
|
|
114
|
-
}), /* @__PURE__ */ w(
|
|
115
|
-
permission:
|
|
116
|
-
children: /* @__PURE__ */ w(
|
|
114
|
+
}), /* @__PURE__ */ w(r, { children: R ? y("botlit.agentApproval.descriptionRequired", "This workspace requires a reviewer to approve an agent before it goes live or before a new version is published.") : y("botlit.agentApproval.descriptionOptional", "You can ask a reviewer to check this agent before it goes live. A workspace admin can make review mandatory on the Approvals page.") })] }), !z && _ !== "ARCHIVED" && /* @__PURE__ */ w(c, {
|
|
115
|
+
permission: s.AGENT_UPDATE,
|
|
116
|
+
children: /* @__PURE__ */ w(o, {
|
|
117
117
|
leftIcon: /* @__PURE__ */ w(O, { size: 16 }),
|
|
118
118
|
onClick: () => L({ kind: "request" }),
|
|
119
119
|
children: y("botlit.agentApproval.requestAction", "Request activation")
|
|
120
120
|
})
|
|
121
121
|
})]
|
|
122
122
|
}),
|
|
123
|
-
/* @__PURE__ */ T(
|
|
123
|
+
/* @__PURE__ */ T(n, {
|
|
124
124
|
className: "space-y-4",
|
|
125
125
|
children: [
|
|
126
126
|
S.loading && S.data.length === 0 ? /* @__PURE__ */ w("div", { className: "h-20 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }) : null,
|
|
@@ -130,7 +130,7 @@ var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
|
130
130
|
children: [
|
|
131
131
|
/* @__PURE__ */ T("div", {
|
|
132
132
|
className: "flex items-center gap-2 flex-wrap",
|
|
133
|
-
children: [/* @__PURE__ */ w(
|
|
133
|
+
children: [/* @__PURE__ */ w(l, {
|
|
134
134
|
variant: "warning",
|
|
135
135
|
children: z.status
|
|
136
136
|
}), /* @__PURE__ */ T("span", {
|
|
@@ -140,7 +140,7 @@ var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
|
140
140
|
" ",
|
|
141
141
|
H(z.requestedById),
|
|
142
142
|
" ",
|
|
143
|
-
|
|
143
|
+
m(z.createdAt)
|
|
144
144
|
]
|
|
145
145
|
})]
|
|
146
146
|
}),
|
|
@@ -154,25 +154,25 @@ var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
|
154
154
|
}),
|
|
155
155
|
/* @__PURE__ */ w("div", {
|
|
156
156
|
className: "flex gap-2 flex-wrap",
|
|
157
|
-
children: V ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(
|
|
158
|
-
permission:
|
|
159
|
-
children: /* @__PURE__ */ w(
|
|
157
|
+
children: V ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(c, {
|
|
158
|
+
permission: s.AGENT_UPDATE,
|
|
159
|
+
children: /* @__PURE__ */ w(o, {
|
|
160
160
|
variant: "outline",
|
|
161
161
|
size: "sm",
|
|
162
162
|
isLoading: F === "cancel",
|
|
163
163
|
onClick: () => void W(z),
|
|
164
164
|
children: y("botlit.agentApproval.cancelAction", "Cancel request")
|
|
165
165
|
})
|
|
166
|
-
}), z.isStale && /* @__PURE__ */ w(
|
|
167
|
-
permission:
|
|
168
|
-
children: /* @__PURE__ */ w(
|
|
166
|
+
}), z.isStale && /* @__PURE__ */ w(c, {
|
|
167
|
+
permission: s.AGENT_UPDATE,
|
|
168
|
+
children: /* @__PURE__ */ w(o, {
|
|
169
169
|
size: "sm",
|
|
170
170
|
onClick: () => L({ kind: "request" }),
|
|
171
171
|
children: y("botlit.agentApproval.resubmitAction", "Submit new request")
|
|
172
172
|
})
|
|
173
|
-
})] }) : /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(
|
|
174
|
-
permission:
|
|
175
|
-
children: /* @__PURE__ */ w(
|
|
173
|
+
})] }) : /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(c, {
|
|
174
|
+
permission: s.AGENT_APPROVE,
|
|
175
|
+
children: /* @__PURE__ */ w(o, {
|
|
176
176
|
size: "sm",
|
|
177
177
|
leftIcon: /* @__PURE__ */ w(D, { size: 14 }),
|
|
178
178
|
disabled: z.isStale,
|
|
@@ -182,9 +182,9 @@ var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
|
182
182
|
}),
|
|
183
183
|
children: y("botlit.agentApproval.approveAction", "Approve")
|
|
184
184
|
})
|
|
185
|
-
}), /* @__PURE__ */ w(
|
|
186
|
-
permission:
|
|
187
|
-
children: /* @__PURE__ */ w(
|
|
185
|
+
}), /* @__PURE__ */ w(c, {
|
|
186
|
+
permission: s.AGENT_APPROVE,
|
|
187
|
+
children: /* @__PURE__ */ w(o, {
|
|
188
188
|
size: "sm",
|
|
189
189
|
variant: "destructive",
|
|
190
190
|
leftIcon: /* @__PURE__ */ w(A, { size: 14 }),
|
|
@@ -210,7 +210,7 @@ var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
|
210
210
|
className: "p-3 border border-border-subtle rounded-lg text-sm space-y-1",
|
|
211
211
|
children: [/* @__PURE__ */ T("div", {
|
|
212
212
|
className: "flex items-center gap-2 flex-wrap",
|
|
213
|
-
children: [/* @__PURE__ */ w(
|
|
213
|
+
children: [/* @__PURE__ */ w(l, {
|
|
214
214
|
variant: M(e.status),
|
|
215
215
|
children: e.status
|
|
216
216
|
}), /* @__PURE__ */ T("span", {
|
|
@@ -220,7 +220,7 @@ var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
|
220
220
|
" ",
|
|
221
221
|
H(e.reviewerId),
|
|
222
222
|
" ",
|
|
223
|
-
e.decidedAt ?
|
|
223
|
+
e.decidedAt ? m(e.decidedAt) : ""
|
|
224
224
|
]
|
|
225
225
|
})]
|
|
226
226
|
}), e.decisionReason && /* @__PURE__ */ w("p", {
|
|
@@ -245,7 +245,6 @@ var N = ({ kind: t, loading: n, onClose: r, onConfirm: i }) => {
|
|
|
245
245
|
]
|
|
246
246
|
});
|
|
247
247
|
};
|
|
248
|
-
//#endregion
|
|
249
248
|
export { P as AgentApprovalPanel, N as ApprovalDecisionDialog, M as approvalStatusVariant };
|
|
250
249
|
|
|
251
250
|
//# sourceMappingURL=AgentApprovalPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentApprovalPanel.js","names":[],"sources":["../../../src/botlit/components/AgentApprovalPanel.tsx"],"sourcesContent":["/**\n * Agent Activation Approval Panel (BOFF-9682)\n * @module botlit/components\n *\n * Reviewer gate on the agent detail page. Builders request activation (the\n * request pins the agent's current config); reviewers with\n * `botmanor-agent:approve` approve it, which publishes the draft and takes the\n * agent live, or reject it with a reason. The requester cannot decide their\n * own request, and a request whose agent changed afterwards is flagged stale\n * and cannot be approved.\n */\n\nimport { useState, type FC } from 'react';\nimport { AlertTriangle, CheckCircle2, ShieldCheck, Send, XCircle } from 'lucide-react';\nimport { toast } from 'sonner';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Textarea,\n} from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from './Card';\nimport { Button } from './Button';\nimport { Badge } from './Badge';\nimport {\n useAgentApprovalActions,\n useAgentApprovalRequests,\n useAgentApprovalSettings,\n type AgentApprovalRequestRecord,\n type AgentApprovalStatus,\n} from '../hooks/useAgentApprovals';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport { formatRelativeTime } from '../utils/formatters';\nimport { BOTMANOR_PERMISSIONS, BotmanorPermissionGate } from '../permissions';\n\nexport function approvalStatusVariant(\n status: AgentApprovalStatus\n): 'warning' | 'success' | 'destructive' | 'outline' {\n if (status === 'PENDING') return 'warning';\n if (status === 'APPROVED') return 'success';\n if (status === 'REJECTED') return 'destructive';\n return 'outline';\n}\n\ntype DecisionKind = 'request' | 'approve' | 'reject';\n\ninterface DecisionDialogProps {\n kind: DecisionKind | null;\n loading: boolean;\n onClose: () => void;\n onConfirm: (text: string) => Promise<void>;\n}\n\n/** Note / reason dialog shared by the detail panel and the approvals page. */\nexport const ApprovalDecisionDialog: FC<DecisionDialogProps> = ({\n kind,\n loading,\n onClose,\n onConfirm,\n}) => {\n const t = useTr();\n const [text, setText] = useState('');\n const reasonRequired = kind === 'reject';\n\n const copy: Record<DecisionKind, { title: string; description: string; confirm: string }> = {\n request: {\n title: t('botlit.agentApproval.dialog.request.title', 'Request activation'),\n description: t(\n 'botlit.agentApproval.dialog.request.description',\n \"A reviewer will check the agent's current prompt, model, tools and limits before it goes live. Changing the agent afterwards makes this request stale.\"\n ),\n confirm: t('botlit.agentApproval.dialog.request.confirm', 'Submit for review'),\n },\n approve: {\n title: t('botlit.agentApproval.dialog.approve.title', 'Approve and go live'),\n description: t(\n 'botlit.agentApproval.dialog.approve.description',\n \"Approving publishes the agent's draft and makes it ACTIVE immediately.\"\n ),\n confirm: t('botlit.agentApproval.dialog.approve.confirm', 'Approve'),\n },\n reject: {\n title: t('botlit.agentApproval.dialog.reject.title', 'Reject activation'),\n description: t(\n 'botlit.agentApproval.dialog.reject.description',\n 'Tell the requester what needs to change. The agent stays as it is.'\n ),\n confirm: t('botlit.agentApproval.dialog.reject.confirm', 'Reject'),\n },\n };\n const current = kind ? copy[kind] : null;\n\n return (\n <Dialog\n open={kind !== null}\n onOpenChange={(open) => {\n if (!open) {\n setText('');\n onClose();\n }\n }}\n >\n <DialogContent>\n <DialogHeader>\n <DialogTitle>{current?.title}</DialogTitle>\n <DialogDescription>{current?.description}</DialogDescription>\n </DialogHeader>\n <Textarea\n aria-label={\n kind === 'request'\n ? t('botlit.agentApproval.dialog.noteLabel', 'Note for the reviewer')\n : t('botlit.agentApproval.dialog.reasonLabel', 'Reason')\n }\n value={text}\n maxLength={2000}\n onChange={(event) => setText(event.target.value)}\n placeholder={\n kind === 'request'\n ? t('botlit.agentApproval.dialog.notePlaceholder', 'What changed and why (optional)')\n : reasonRequired\n ? t('botlit.agentApproval.dialog.reasonRequiredPlaceholder', 'Reason (required)')\n : t('botlit.agentApproval.dialog.reasonPlaceholder', 'Reason (optional)')\n }\n rows={4}\n />\n <DialogFooter>\n <Button\n variant=\"outline\"\n onClick={() => {\n setText('');\n onClose();\n }}\n >\n {t('botlit.common.cancel', 'Cancel')}\n </Button>\n <Button\n variant={kind === 'reject' ? 'destructive' : 'default'}\n isLoading={loading}\n disabled={reasonRequired && text.trim().length === 0}\n onClick={async () => {\n await onConfirm(text);\n setText('');\n }}\n >\n {current?.confirm}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n};\n\ninterface AgentApprovalPanelProps {\n agentId: string;\n agentStatus: string;\n /** Called after a decision that changes the agent so the page can refetch it. */\n onChanged?: () => void;\n}\n\nexport const AgentApprovalPanel: FC<AgentApprovalPanelProps> = ({\n agentId,\n agentStatus,\n onChanged,\n}) => {\n const t = useTr();\n const { currentUser } = useBotlit();\n const settings = useAgentApprovalSettings();\n const requests = useAgentApprovalRequests({ agentId });\n const { run, pending } = useAgentApprovalActions();\n const [dialog, setDialog] = useState<{\n kind: DecisionKind;\n request?: AgentApprovalRequestRecord;\n } | null>(null);\n\n const required = settings.data?.requireActivationApproval === true;\n const open = requests.data.find((request) => request.status === 'PENDING') ?? null;\n const history = requests.data.filter((request) => request.status !== 'PENDING').slice(0, 10);\n const isRequester = open !== null && open.requestedById === currentUser?.id;\n\n const who = (id?: string | null): string =>\n id && id === currentUser?.id ? t('botlit.agentApproval.you', 'you') : (id ?? '—');\n\n const confirm = async (text: string): Promise<void> => {\n if (!dialog) return;\n try {\n if (dialog.kind === 'request') {\n await run({ kind: 'request', agentId, note: text });\n toast.success(t('botlit.agentApproval.toast.requested', 'Activation requested'));\n } else if (dialog.kind === 'approve' && dialog.request) {\n await run({ kind: 'approve', id: dialog.request.id, reason: text });\n toast.success(t('botlit.agentApproval.toast.approved', 'Approved — the agent is live'));\n onChanged?.();\n } else if (dialog.kind === 'reject' && dialog.request) {\n await run({ kind: 'reject', id: dialog.request.id, reason: text });\n toast.success(t('botlit.agentApproval.toast.rejected', 'Activation rejected'));\n }\n setDialog(null);\n await requests.refetch();\n } catch (err: unknown) {\n toast.error(\n err instanceof Error\n ? err.message\n : t('botlit.agentApproval.toast.error', 'Approval action failed')\n );\n }\n };\n\n const cancel = async (request: AgentApprovalRequestRecord): Promise<void> => {\n try {\n await run({ kind: 'cancel', id: request.id });\n toast.success(t('botlit.agentApproval.toast.cancelled', 'Request cancelled'));\n await requests.refetch();\n } catch (err: unknown) {\n toast.error(\n err instanceof Error\n ? err.message\n : t('botlit.agentApproval.toast.error', 'Approval action failed')\n );\n }\n };\n\n return (\n <Card data-testid=\"agent-approval-panel\">\n <CardHeader className=\"flex flex-row items-start justify-between gap-4\">\n <div>\n <CardTitle className=\"flex items-center gap-2\">\n <ShieldCheck size={18} />\n {t('botlit.agentApproval.title', 'Activation approval')}\n <Badge variant={required ? 'warning' : 'outline'}>\n {required\n ? t('botlit.agentApproval.required', 'Required in this workspace')\n : t('botlit.agentApproval.optional', 'Optional')}\n </Badge>\n </CardTitle>\n <CardDescription>\n {required\n ? t(\n 'botlit.agentApproval.descriptionRequired',\n 'This workspace requires a reviewer to approve an agent before it goes live or before a new version is published.'\n )\n : t(\n 'botlit.agentApproval.descriptionOptional',\n 'You can ask a reviewer to check this agent before it goes live. A workspace admin can make review mandatory on the Approvals page.'\n )}\n </CardDescription>\n </div>\n {!open && agentStatus !== 'ARCHIVED' && (\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.AGENT_UPDATE}>\n <Button leftIcon={<Send size={16} />} onClick={() => setDialog({ kind: 'request' })}>\n {t('botlit.agentApproval.requestAction', 'Request activation')}\n </Button>\n </BotmanorPermissionGate>\n )}\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {requests.loading && requests.data.length === 0 ? (\n <div className=\"h-20 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg\" />\n ) : null}\n\n {open && (\n <div\n className=\"p-4 border border-status-warning-border bg-bg-sunken rounded-lg space-y-2\"\n data-testid=\"agent-approval-pending\"\n >\n <div className=\"flex items-center gap-2 flex-wrap\">\n <Badge variant=\"warning\">{open.status}</Badge>\n <span className=\"text-sm text-text-secondary\">\n {t('botlit.agentApproval.requestedBy', 'Requested by')} {who(open.requestedById)}{' '}\n {formatRelativeTime(open.createdAt)}\n </span>\n </div>\n {open.requestNote && <p className=\"text-sm break-words\">{open.requestNote}</p>}\n {open.isStale && (\n <p className=\"flex items-center gap-2 text-sm text-status-warning-text\">\n <AlertTriangle size={14} />\n {t(\n 'botlit.agentApproval.stale',\n 'The agent changed after this request. Submit a new request so the reviewer sees the current configuration.'\n )}\n </p>\n )}\n <div className=\"flex gap-2 flex-wrap\">\n {isRequester ? (\n <>\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.AGENT_UPDATE}>\n <Button\n variant=\"outline\"\n size=\"sm\"\n isLoading={pending === 'cancel'}\n onClick={() => void cancel(open)}\n >\n {t('botlit.agentApproval.cancelAction', 'Cancel request')}\n </Button>\n </BotmanorPermissionGate>\n {open.isStale && (\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.AGENT_UPDATE}>\n <Button size=\"sm\" onClick={() => setDialog({ kind: 'request' })}>\n {t('botlit.agentApproval.resubmitAction', 'Submit new request')}\n </Button>\n </BotmanorPermissionGate>\n )}\n </>\n ) : (\n <>\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.AGENT_APPROVE}>\n <Button\n size=\"sm\"\n leftIcon={<CheckCircle2 size={14} />}\n disabled={open.isStale}\n onClick={() => setDialog({ kind: 'approve', request: open })}\n >\n {t('botlit.agentApproval.approveAction', 'Approve')}\n </Button>\n </BotmanorPermissionGate>\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.AGENT_APPROVE}>\n <Button\n size=\"sm\"\n variant=\"destructive\"\n leftIcon={<XCircle size={14} />}\n onClick={() => setDialog({ kind: 'reject', request: open })}\n >\n {t('botlit.agentApproval.rejectAction', 'Reject')}\n </Button>\n </BotmanorPermissionGate>\n </>\n )}\n </div>\n </div>\n )}\n\n {history.length > 0 && (\n <div className=\"space-y-2\">\n <p className=\"text-sm font-medium\">\n {t('botlit.agentApproval.history', 'Decision history')}\n </p>\n <ul className=\"space-y-2\" data-testid=\"agent-approval-history\">\n {history.map((request) => (\n <li\n key={request.id}\n className=\"p-3 border border-border-subtle rounded-lg text-sm space-y-1\"\n >\n <div className=\"flex items-center gap-2 flex-wrap\">\n <Badge variant={approvalStatusVariant(request.status)}>{request.status}</Badge>\n <span className=\"text-text-secondary\">\n {t('botlit.agentApproval.decidedBy', 'by')} {who(request.reviewerId)}{' '}\n {request.decidedAt ? formatRelativeTime(request.decidedAt) : ''}\n </span>\n </div>\n {request.decisionReason && (\n <p className=\"break-words\">{request.decisionReason}</p>\n )}\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {!open && history.length === 0 && !requests.loading && (\n <p className=\"text-sm text-text-secondary\">\n {t('botlit.agentApproval.empty', 'No activation requests for this agent yet.')}\n </p>\n )}\n </CardContent>\n\n <ApprovalDecisionDialog\n kind={dialog?.kind ?? null}\n loading={pending !== null}\n onClose={() => setDialog(null)}\n onConfirm={confirm}\n />\n </Card>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;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
{"version":3,"file":"AgentApprovalPanel.js","names":["_Fragment","approvalStatusVariant","status","ApprovalDecisionDialog","t","useTr","text","setText","useState","reasonRequired","kind","copy","current","Dialog","open","onClose","DialogContent","DialogHeader","DialogTitle","DialogDescription","Textarea","event","DialogFooter","Button","loading","onConfirm","AgentApprovalPanel","useBotlit","settings","useAgentApprovalSettings","requests","useAgentApprovalRequests","useAgentApprovalActions","dialog","setDialog","required","request","history","isRequester","currentUser","who","id","confirm","run","toast","onChanged","err","cancel","Card","CardHeader","CardTitle","ShieldCheck","Badge","CardDescription","agentStatus","BotmanorPermissionGate","BOTMANOR_PERMISSIONS","Send","CardContent","formatRelativeTime","AlertTriangle","Fragment","pending","CheckCircle2","XCircle"],"sources":["../../../src/botlit/components/AgentApprovalPanel.tsx"],"sourcesContent":["/**\n * Agent Activation Approval Panel (BOFF-9682)\n * @module botlit/components\n *\n * Reviewer gate on the agent detail page. Builders request activation (the\n * request pins the agent's current config); reviewers with\n * `botmanor-agent:approve` approve it, which publishes the draft and takes the\n * agent live, or reject it with a reason. The requester cannot decide their\n * own request, and a request whose agent changed afterwards is flagged stale\n * and cannot be approved.\n */\n\nimport { useState, type FC } from 'react';\nimport { AlertTriangle, CheckCircle2, ShieldCheck, Send, XCircle } from 'lucide-react';\nimport { toast } from 'sonner';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Textarea,\n} from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from './Card';\nimport { Button } from './Button';\nimport { Badge } from './Badge';\nimport {\n useAgentApprovalActions,\n useAgentApprovalRequests,\n useAgentApprovalSettings,\n type AgentApprovalRequestRecord,\n type AgentApprovalStatus,\n} from '../hooks/useAgentApprovals';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport { formatRelativeTime } from '../utils/formatters';\nimport { BOTMANOR_PERMISSIONS, BotmanorPermissionGate } from '../permissions';\n\nexport function approvalStatusVariant(\n status: AgentApprovalStatus\n): 'warning' | 'success' | 'destructive' | 'outline' {\n if (status === 'PENDING') return 'warning';\n if (status === 'APPROVED') return 'success';\n if (status === 'REJECTED') return 'destructive';\n return 'outline';\n}\n\ntype DecisionKind = 'request' | 'approve' | 'reject';\n\ninterface DecisionDialogProps {\n kind: DecisionKind | null;\n loading: boolean;\n onClose: () => void;\n onConfirm: (text: string) => Promise<void>;\n}\n\n/** Note / reason dialog shared by the detail panel and the approvals page. */\nexport const ApprovalDecisionDialog: FC<DecisionDialogProps> = ({\n kind,\n loading,\n onClose,\n onConfirm,\n}) => {\n const t = useTr();\n const [text, setText] = useState('');\n const reasonRequired = kind === 'reject';\n\n const copy: Record<DecisionKind, { title: string; description: string; confirm: string }> = {\n request: {\n title: t('botlit.agentApproval.dialog.request.title', 'Request activation'),\n description: t(\n 'botlit.agentApproval.dialog.request.description',\n \"A reviewer will check the agent's current prompt, model, tools and limits before it goes live. Changing the agent afterwards makes this request stale.\"\n ),\n confirm: t('botlit.agentApproval.dialog.request.confirm', 'Submit for review'),\n },\n approve: {\n title: t('botlit.agentApproval.dialog.approve.title', 'Approve and go live'),\n description: t(\n 'botlit.agentApproval.dialog.approve.description',\n \"Approving publishes the agent's draft and makes it ACTIVE immediately.\"\n ),\n confirm: t('botlit.agentApproval.dialog.approve.confirm', 'Approve'),\n },\n reject: {\n title: t('botlit.agentApproval.dialog.reject.title', 'Reject activation'),\n description: t(\n 'botlit.agentApproval.dialog.reject.description',\n 'Tell the requester what needs to change. The agent stays as it is.'\n ),\n confirm: t('botlit.agentApproval.dialog.reject.confirm', 'Reject'),\n },\n };\n const current = kind ? copy[kind] : null;\n\n return (\n <Dialog\n open={kind !== null}\n onOpenChange={(open) => {\n if (!open) {\n setText('');\n onClose();\n }\n }}\n >\n <DialogContent>\n <DialogHeader>\n <DialogTitle>{current?.title}</DialogTitle>\n <DialogDescription>{current?.description}</DialogDescription>\n </DialogHeader>\n <Textarea\n aria-label={\n kind === 'request'\n ? t('botlit.agentApproval.dialog.noteLabel', 'Note for the reviewer')\n : t('botlit.agentApproval.dialog.reasonLabel', 'Reason')\n }\n value={text}\n maxLength={2000}\n onChange={(event) => setText(event.target.value)}\n placeholder={\n kind === 'request'\n ? t('botlit.agentApproval.dialog.notePlaceholder', 'What changed and why (optional)')\n : reasonRequired\n ? t('botlit.agentApproval.dialog.reasonRequiredPlaceholder', 'Reason (required)')\n : t('botlit.agentApproval.dialog.reasonPlaceholder', 'Reason (optional)')\n }\n rows={4}\n />\n <DialogFooter>\n <Button\n variant=\"outline\"\n onClick={() => {\n setText('');\n onClose();\n }}\n >\n {t('botlit.common.cancel', 'Cancel')}\n </Button>\n <Button\n variant={kind === 'reject' ? 'destructive' : 'default'}\n isLoading={loading}\n disabled={reasonRequired && text.trim().length === 0}\n onClick={async () => {\n await onConfirm(text);\n setText('');\n }}\n >\n {current?.confirm}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n};\n\ninterface AgentApprovalPanelProps {\n agentId: string;\n agentStatus: string;\n /** Called after a decision that changes the agent so the page can refetch it. */\n onChanged?: () => void;\n}\n\nexport const AgentApprovalPanel: FC<AgentApprovalPanelProps> = ({\n agentId,\n agentStatus,\n onChanged,\n}) => {\n const t = useTr();\n const { currentUser } = useBotlit();\n const settings = useAgentApprovalSettings();\n const requests = useAgentApprovalRequests({ agentId });\n const { run, pending } = useAgentApprovalActions();\n const [dialog, setDialog] = useState<{\n kind: DecisionKind;\n request?: AgentApprovalRequestRecord;\n } | null>(null);\n\n const required = settings.data?.requireActivationApproval === true;\n const open = requests.data.find((request) => request.status === 'PENDING') ?? null;\n const history = requests.data.filter((request) => request.status !== 'PENDING').slice(0, 10);\n const isRequester = open !== null && open.requestedById === currentUser?.id;\n\n const who = (id?: string | null): string =>\n id && id === currentUser?.id ? t('botlit.agentApproval.you', 'you') : (id ?? '—');\n\n const confirm = async (text: string): Promise<void> => {\n if (!dialog) return;\n try {\n if (dialog.kind === 'request') {\n await run({ kind: 'request', agentId, note: text });\n toast.success(t('botlit.agentApproval.toast.requested', 'Activation requested'));\n } else if (dialog.kind === 'approve' && dialog.request) {\n await run({ kind: 'approve', id: dialog.request.id, reason: text });\n toast.success(t('botlit.agentApproval.toast.approved', 'Approved — the agent is live'));\n onChanged?.();\n } else if (dialog.kind === 'reject' && dialog.request) {\n await run({ kind: 'reject', id: dialog.request.id, reason: text });\n toast.success(t('botlit.agentApproval.toast.rejected', 'Activation rejected'));\n }\n setDialog(null);\n await requests.refetch();\n } catch (err: unknown) {\n toast.error(\n err instanceof Error\n ? err.message\n : t('botlit.agentApproval.toast.error', 'Approval action failed')\n );\n }\n };\n\n const cancel = async (request: AgentApprovalRequestRecord): Promise<void> => {\n try {\n await run({ kind: 'cancel', id: request.id });\n toast.success(t('botlit.agentApproval.toast.cancelled', 'Request cancelled'));\n await requests.refetch();\n } catch (err: unknown) {\n toast.error(\n err instanceof Error\n ? err.message\n : t('botlit.agentApproval.toast.error', 'Approval action failed')\n );\n }\n };\n\n return (\n <Card data-testid=\"agent-approval-panel\">\n <CardHeader className=\"flex flex-row items-start justify-between gap-4\">\n <div>\n <CardTitle className=\"flex items-center gap-2\">\n <ShieldCheck size={18} />\n {t('botlit.agentApproval.title', 'Activation approval')}\n <Badge variant={required ? 'warning' : 'outline'}>\n {required\n ? t('botlit.agentApproval.required', 'Required in this workspace')\n : t('botlit.agentApproval.optional', 'Optional')}\n </Badge>\n </CardTitle>\n <CardDescription>\n {required\n ? t(\n 'botlit.agentApproval.descriptionRequired',\n 'This workspace requires a reviewer to approve an agent before it goes live or before a new version is published.'\n )\n : t(\n 'botlit.agentApproval.descriptionOptional',\n 'You can ask a reviewer to check this agent before it goes live. A workspace admin can make review mandatory on the Approvals page.'\n )}\n </CardDescription>\n </div>\n {!open && agentStatus !== 'ARCHIVED' && (\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.AGENT_UPDATE}>\n <Button leftIcon={<Send size={16} />} onClick={() => setDialog({ kind: 'request' })}>\n {t('botlit.agentApproval.requestAction', 'Request activation')}\n </Button>\n </BotmanorPermissionGate>\n )}\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {requests.loading && requests.data.length === 0 ? (\n <div className=\"h-20 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg\" />\n ) : null}\n\n {open && (\n <div\n className=\"p-4 border border-status-warning-border bg-bg-sunken rounded-lg space-y-2\"\n data-testid=\"agent-approval-pending\"\n >\n <div className=\"flex items-center gap-2 flex-wrap\">\n <Badge variant=\"warning\">{open.status}</Badge>\n <span className=\"text-sm text-text-secondary\">\n {t('botlit.agentApproval.requestedBy', 'Requested by')} {who(open.requestedById)}{' '}\n {formatRelativeTime(open.createdAt)}\n </span>\n </div>\n {open.requestNote && <p className=\"text-sm break-words\">{open.requestNote}</p>}\n {open.isStale && (\n <p className=\"flex items-center gap-2 text-sm text-status-warning-text\">\n <AlertTriangle size={14} />\n {t(\n 'botlit.agentApproval.stale',\n 'The agent changed after this request. Submit a new request so the reviewer sees the current configuration.'\n )}\n </p>\n )}\n <div className=\"flex gap-2 flex-wrap\">\n {isRequester ? (\n <>\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.AGENT_UPDATE}>\n <Button\n variant=\"outline\"\n size=\"sm\"\n isLoading={pending === 'cancel'}\n onClick={() => void cancel(open)}\n >\n {t('botlit.agentApproval.cancelAction', 'Cancel request')}\n </Button>\n </BotmanorPermissionGate>\n {open.isStale && (\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.AGENT_UPDATE}>\n <Button size=\"sm\" onClick={() => setDialog({ kind: 'request' })}>\n {t('botlit.agentApproval.resubmitAction', 'Submit new request')}\n </Button>\n </BotmanorPermissionGate>\n )}\n </>\n ) : (\n <>\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.AGENT_APPROVE}>\n <Button\n size=\"sm\"\n leftIcon={<CheckCircle2 size={14} />}\n disabled={open.isStale}\n onClick={() => setDialog({ kind: 'approve', request: open })}\n >\n {t('botlit.agentApproval.approveAction', 'Approve')}\n </Button>\n </BotmanorPermissionGate>\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.AGENT_APPROVE}>\n <Button\n size=\"sm\"\n variant=\"destructive\"\n leftIcon={<XCircle size={14} />}\n onClick={() => setDialog({ kind: 'reject', request: open })}\n >\n {t('botlit.agentApproval.rejectAction', 'Reject')}\n </Button>\n </BotmanorPermissionGate>\n </>\n )}\n </div>\n </div>\n )}\n\n {history.length > 0 && (\n <div className=\"space-y-2\">\n <p className=\"text-sm font-medium\">\n {t('botlit.agentApproval.history', 'Decision history')}\n </p>\n <ul className=\"space-y-2\" data-testid=\"agent-approval-history\">\n {history.map((request) => (\n <li\n key={request.id}\n className=\"p-3 border border-border-subtle rounded-lg text-sm space-y-1\"\n >\n <div className=\"flex items-center gap-2 flex-wrap\">\n <Badge variant={approvalStatusVariant(request.status)}>{request.status}</Badge>\n <span className=\"text-text-secondary\">\n {t('botlit.agentApproval.decidedBy', 'by')} {who(request.reviewerId)}{' '}\n {request.decidedAt ? formatRelativeTime(request.decidedAt) : ''}\n </span>\n </div>\n {request.decisionReason && (\n <p className=\"break-words\">{request.decisionReason}</p>\n )}\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {!open && history.length === 0 && !requests.loading && (\n <p className=\"text-sm text-text-secondary\">\n {t('botlit.agentApproval.empty', 'No activation requests for this agent yet.')}\n </p>\n )}\n </CardContent>\n\n <ApprovalDecisionDialog\n kind={dialog?.kind ?? null}\n loading={pending !== null}\n onClose={() => setDialog(null)}\n onConfirm={confirm}\n />\n </Card>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAuCA,SAAgBC,EACd,GACmD;CAInD,OAHIC,MAAW,YAAkB,YAC7BA,MAAW,aAAmB,YAC9BA,MAAW,aAAmB,gBAC3B;AACT;AAYA,IAAaC,KAAmD,EAC9D,SACA,YACA,YACA,mBACI;CACJ,IAAMC,IAAIC,EAAM,GACV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SACH,CAAA,CAAA;QACJ,CAAA,GAAAA,EAAQ,kBACP,kBAAC,KAAD;SAAG,WAAU;SAAe,UAAAA,EAAQ;QAAkB,CAAA,CAEtD;OAbG,GAAAA,EAAQ,EAaX,CACL;MACC,CAAA,CACD;;KAGN,CAACtB,KAAQuB,EAAQ,WAAW,KAAK,CAACP,EAAS,WAC1C,kBAAC,KAAD;MAAG,WAAU;MACV,UAAA1B,EAAE,8BAA8B,4CAA4C;KAC5E,CAAA;IAEM;;GAEb,kBAACD,GAAD;IACE,MAAM8B,GAAQ,QAAQ;IACtB,SAAS6B,MAAY;IACrB,eAAe5B,EAAU,IAAI;IAC7B,WAAWQ;GACZ,CAAA;EACG;;AAEV"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { AiPredictionsFilter } from '../hooks/useAiOperations';
|
|
3
|
+
export interface AiOperationsPanelProps {
|
|
4
|
+
/** Narrow the feed to one subject (agent detail / bot detail slices). */
|
|
5
|
+
filter?: AiPredictionsFilter;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The decision-card feed. Pure presentation over `useAiPredictions` — the
|
|
12
|
+
* owning page composes it with config and run controls.
|
|
13
|
+
*/
|
|
14
|
+
export declare const AiOperationsPanel: FC<AiOperationsPanelProps>;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { PauseBotmanorAgentForSupervisorDocument as e, RebuildKnowledgeBaseIndexForSupervisorDocument as t } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { AiPredictionStatus as n } from "../../generated/wspace-types.js";
|
|
3
|
+
import { useTr as r } from "../../shared/hooks/useTr.js";
|
|
4
|
+
import { cn as i } from "../utils/cn.js";
|
|
5
|
+
import { formatRelativeTime as a } from "../utils/formatters.js";
|
|
6
|
+
import { Badge as o } from "./Badge.js";
|
|
7
|
+
import { Button as s } from "./Button.js";
|
|
8
|
+
import { Card as c } from "./Card.js";
|
|
9
|
+
import { EmptyState as l } from "./EmptyState.js";
|
|
10
|
+
import { ErrorState as u } from "./ErrorState.js";
|
|
11
|
+
import { useWorkspaceClient as d } from "../hooks/internal/workspaceGateway.js";
|
|
12
|
+
import { predictionSeverity as f, predictionSubjectName as p, useAiPredictions as m, useSetAiPredictionStatus as h } from "../hooks/useAiOperations.js";
|
|
13
|
+
import { useCallback as g, useMemo as _, useState as v } from "react";
|
|
14
|
+
import { AlertDialog as y, AlertDialogAction as b, AlertDialogCancel as x, AlertDialogContent as S, AlertDialogDescription as C, AlertDialogFooter as w, AlertDialogHeader as T, AlertDialogTitle as E } from "@burdenoff/fe-libs/ui";
|
|
15
|
+
import { jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
16
|
+
import { useNavigate as k } from "react-router";
|
|
17
|
+
import { Check as A, ShieldAlert as j, X as M } from "lucide-react";
|
|
18
|
+
// src/botlit/components/AiOperationsPanel.tsx
|
|
19
|
+
var N = {
|
|
20
|
+
CRITICAL: "destructive",
|
|
21
|
+
WARNING: "warning",
|
|
22
|
+
INFO: "secondary"
|
|
23
|
+
}, P = {
|
|
24
|
+
CRITICAL: "botlit.aiOperations.severity.critical",
|
|
25
|
+
WARNING: "botlit.aiOperations.severity.warning",
|
|
26
|
+
INFO: "botlit.aiOperations.severity.info"
|
|
27
|
+
}, F = {
|
|
28
|
+
failure_rate_regression: "botlit.aiOperations.type.failureRateRegression",
|
|
29
|
+
grounding_decay: "botlit.aiOperations.type.groundingDecay",
|
|
30
|
+
cost_anomaly: "botlit.aiOperations.type.costAnomaly",
|
|
31
|
+
latency_drift: "botlit.aiOperations.type.latencyDrift",
|
|
32
|
+
stalled_index: "botlit.aiOperations.type.stalledIndex",
|
|
33
|
+
idle_agent: "botlit.aiOperations.type.idleAgent",
|
|
34
|
+
stale_knowledge: "botlit.aiOperations.type.staleKnowledge"
|
|
35
|
+
};
|
|
36
|
+
function I(e, t) {
|
|
37
|
+
switch (e.predictionType) {
|
|
38
|
+
case "stalled_index": return e.subjectType !== "KNOWLEDGE_BASE" || !e.subjectId ? null : {
|
|
39
|
+
kind: "rebuild-index",
|
|
40
|
+
confirmTitle: t("botlit.aiOperations.confirm.rebuildTitle", "Rebuild the knowledge base index?"),
|
|
41
|
+
confirmBody: t("botlit.aiOperations.confirm.rebuildBody", "This rebuilds the index for this knowledge base so agents can retrieve from it again. The finding is marked accepted afterwards.")
|
|
42
|
+
};
|
|
43
|
+
case "failure_rate_regression":
|
|
44
|
+
case "idle_agent": return e.subjectType !== "AGENT" || !e.subjectId ? null : {
|
|
45
|
+
kind: "pause-agent",
|
|
46
|
+
confirmTitle: t("botlit.aiOperations.confirm.pauseTitle", "Pause this agent?"),
|
|
47
|
+
confirmBody: t("botlit.aiOperations.confirm.pauseBody", "The agent stops answering until a workspace member reactivates it. The finding is marked accepted afterwards.")
|
|
48
|
+
};
|
|
49
|
+
default: return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function L(e) {
|
|
53
|
+
if (!e.subjectId) return null;
|
|
54
|
+
switch (e.subjectType) {
|
|
55
|
+
case "AGENT": return `/agents/${e.subjectId}`;
|
|
56
|
+
case "APP": return `/bots/${e.subjectId}`;
|
|
57
|
+
case "KNOWLEDGE_BASE": return `/knowledge/${e.subjectId}`;
|
|
58
|
+
default: return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function R(e) {
|
|
62
|
+
let t = e.features ?? {}, n = [], r = (e, t) => {
|
|
63
|
+
typeof t == "number" ? n.push([e, Number.isInteger(t) ? String(t) : t.toFixed(4)]) : typeof t == "string" && t.length > 0 && t.length < 80 && n.push([e, t]);
|
|
64
|
+
};
|
|
65
|
+
for (let [e, n] of Object.entries(t).slice(0, 6)) e.endsWith("At") || e === "knowledgeBaseIds" || e === "agentIds" || r(e, n);
|
|
66
|
+
return n.slice(0, 4);
|
|
67
|
+
}
|
|
68
|
+
var z = ({ record: e, busy: t, onAccept: n, onDismiss: l }) => {
|
|
69
|
+
let u = r(), d = k(), m = f(e), h = p(e), g = e.status === "GENERATED" ? I(e, u) : null, _ = L(e), v = R(e), y = e.status === "GENERATED";
|
|
70
|
+
return /* @__PURE__ */ O(c, {
|
|
71
|
+
className: i("p-5", m === "CRITICAL" && "glow"),
|
|
72
|
+
"data-testid": "ai-operations-card",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ O("div", {
|
|
75
|
+
className: "flex items-start justify-between gap-3",
|
|
76
|
+
children: [/* @__PURE__ */ O("div", {
|
|
77
|
+
className: "flex items-center gap-2 flex-wrap",
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ D(o, {
|
|
80
|
+
variant: N[m] ?? "secondary",
|
|
81
|
+
children: u(P[m] ?? P.INFO, m.toLowerCase())
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ D(o, {
|
|
84
|
+
variant: "outline",
|
|
85
|
+
children: u(F[e.predictionType] ?? "botlit.aiOperations.type.unknown", e.predictionType.replace(/_/g, " "))
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ D("span", {
|
|
88
|
+
className: "text-sm text-text-secondary",
|
|
89
|
+
children: u("botlit.aiOperations.onSubject", "on {{name}}", { name: h })
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}), /* @__PURE__ */ D("span", {
|
|
93
|
+
className: "text-xs text-text-tertiary whitespace-nowrap",
|
|
94
|
+
children: a(e.generatedAt)
|
|
95
|
+
})]
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ D("p", {
|
|
98
|
+
className: "mt-3 text-sm text-text-primary",
|
|
99
|
+
children: e.recommendation
|
|
100
|
+
}),
|
|
101
|
+
v.length > 0 && /* @__PURE__ */ D("dl", {
|
|
102
|
+
className: "mt-3 grid grid-cols-2 gap-x-4 gap-y-1 sm:grid-cols-4",
|
|
103
|
+
children: v.map(([e, t]) => /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("dt", {
|
|
104
|
+
className: "text-xs text-text-tertiary",
|
|
105
|
+
children: e
|
|
106
|
+
}), /* @__PURE__ */ D("dd", {
|
|
107
|
+
className: "text-sm text-text-secondary",
|
|
108
|
+
children: t
|
|
109
|
+
})] }, e))
|
|
110
|
+
}),
|
|
111
|
+
y && /* @__PURE__ */ O("div", {
|
|
112
|
+
className: "mt-4 flex items-center gap-2",
|
|
113
|
+
children: [g ? /* @__PURE__ */ O(s, {
|
|
114
|
+
size: "sm",
|
|
115
|
+
onClick: () => n(e),
|
|
116
|
+
disabled: t,
|
|
117
|
+
children: [/* @__PURE__ */ D(A, { className: "h-4 w-4" }), u("botlit.aiOperations.actions.accept", "Accept")]
|
|
118
|
+
}) : _ && /* @__PURE__ */ O(s, {
|
|
119
|
+
size: "sm",
|
|
120
|
+
variant: "outline",
|
|
121
|
+
onClick: () => d(_),
|
|
122
|
+
disabled: t,
|
|
123
|
+
children: [/* @__PURE__ */ D(A, { className: "h-4 w-4" }), u("botlit.aiOperations.actions.reviewSubject", "Review subject")]
|
|
124
|
+
}), /* @__PURE__ */ O(s, {
|
|
125
|
+
size: "sm",
|
|
126
|
+
variant: "outline",
|
|
127
|
+
onClick: () => l(e),
|
|
128
|
+
disabled: t,
|
|
129
|
+
children: [/* @__PURE__ */ D(M, { className: "h-4 w-4" }), u("botlit.aiOperations.actions.dismiss", "Dismiss")]
|
|
130
|
+
})]
|
|
131
|
+
}),
|
|
132
|
+
!y && /* @__PURE__ */ D("div", {
|
|
133
|
+
className: "mt-4",
|
|
134
|
+
children: /* @__PURE__ */ D(o, {
|
|
135
|
+
variant: e.status === "ACCEPTED" ? "success" : "outline",
|
|
136
|
+
children: e.status
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
}, B = ({ filter: i, title: a, description: o, className: s }) => {
|
|
142
|
+
let f = r(), p = d(), { data: k, loading: A, error: M, refetch: N } = m(i), [P, F] = h(), [L, R] = v(null), [B, V] = v(null), H = F.loading, U = g(async (e) => {
|
|
143
|
+
V(null);
|
|
144
|
+
try {
|
|
145
|
+
await P({
|
|
146
|
+
id: e.id,
|
|
147
|
+
status: n.Dismissed
|
|
148
|
+
}), await N();
|
|
149
|
+
} catch (e) {
|
|
150
|
+
V(e instanceof Error ? e.message : String(e));
|
|
151
|
+
}
|
|
152
|
+
}, [P, N]), W = g(async () => {
|
|
153
|
+
let r = L;
|
|
154
|
+
if (!r) return;
|
|
155
|
+
R(null), V(null);
|
|
156
|
+
let i = I(r, f);
|
|
157
|
+
try {
|
|
158
|
+
i?.kind === "rebuild-index" && r.subjectId ? await p.mutate({
|
|
159
|
+
mutation: t,
|
|
160
|
+
variables: { knowledgeBaseId: r.subjectId }
|
|
161
|
+
}) : i?.kind === "pause-agent" && r.subjectId && await p.mutate({
|
|
162
|
+
mutation: e,
|
|
163
|
+
variables: {
|
|
164
|
+
id: r.subjectId,
|
|
165
|
+
input: { status: "PAUSED" }
|
|
166
|
+
}
|
|
167
|
+
}), await P({
|
|
168
|
+
id: r.id,
|
|
169
|
+
status: n.Accepted
|
|
170
|
+
}), await N();
|
|
171
|
+
} catch (e) {
|
|
172
|
+
V(e instanceof Error ? e.message : String(e));
|
|
173
|
+
}
|
|
174
|
+
}, [
|
|
175
|
+
L,
|
|
176
|
+
p,
|
|
177
|
+
P,
|
|
178
|
+
N,
|
|
179
|
+
f
|
|
180
|
+
]), G = L ? I(L, f) : null, K = _(() => M ? /* @__PURE__ */ D(u, {
|
|
181
|
+
resource: f("botlit.aiOperations.errorTitle", "AI operations findings"),
|
|
182
|
+
error: M,
|
|
183
|
+
onRetry: () => void N()
|
|
184
|
+
}) : A && k.length === 0 ? /* @__PURE__ */ D("div", {
|
|
185
|
+
className: "space-y-3",
|
|
186
|
+
"aria-busy": "true",
|
|
187
|
+
children: [
|
|
188
|
+
0,
|
|
189
|
+
1,
|
|
190
|
+
2
|
|
191
|
+
].map((e) => /* @__PURE__ */ D(c, {
|
|
192
|
+
className: "p-5 h-28 animate-pulse bg-bg-subtle",
|
|
193
|
+
children: /* @__PURE__ */ D("span", {
|
|
194
|
+
className: "sr-only",
|
|
195
|
+
children: f("botlit.aiOperations.loading", "Loading findings")
|
|
196
|
+
})
|
|
197
|
+
}, e))
|
|
198
|
+
}) : k.length === 0 ? /* @__PURE__ */ D(l, {
|
|
199
|
+
icon: /* @__PURE__ */ D(j, { className: "h-8 w-8" }),
|
|
200
|
+
title: f("botlit.aiOperations.emptyTitle", "No findings"),
|
|
201
|
+
description: f("botlit.aiOperations.emptyDescription", "The supervisor has not flagged anything. Enable the scheduled review to keep it that way.")
|
|
202
|
+
}) : /* @__PURE__ */ D("div", {
|
|
203
|
+
className: "space-y-3",
|
|
204
|
+
"data-testid": "ai-operations-feed",
|
|
205
|
+
children: k.map((e) => /* @__PURE__ */ D(z, {
|
|
206
|
+
record: e,
|
|
207
|
+
busy: H,
|
|
208
|
+
onAccept: (e) => R(e),
|
|
209
|
+
onDismiss: (e) => void U(e)
|
|
210
|
+
}, e.id))
|
|
211
|
+
}), [
|
|
212
|
+
M,
|
|
213
|
+
A,
|
|
214
|
+
k,
|
|
215
|
+
H,
|
|
216
|
+
U,
|
|
217
|
+
N,
|
|
218
|
+
f
|
|
219
|
+
]);
|
|
220
|
+
return /* @__PURE__ */ O("section", {
|
|
221
|
+
className: s,
|
|
222
|
+
"data-testid": "ai-operations-panel",
|
|
223
|
+
children: [
|
|
224
|
+
(a || o) && /* @__PURE__ */ O("header", {
|
|
225
|
+
className: "mb-4",
|
|
226
|
+
children: [a && /* @__PURE__ */ D("h2", {
|
|
227
|
+
className: "text-lg font-semibold text-text-primary",
|
|
228
|
+
children: a
|
|
229
|
+
}), o && /* @__PURE__ */ D("p", {
|
|
230
|
+
className: "text-sm text-text-secondary",
|
|
231
|
+
children: o
|
|
232
|
+
})]
|
|
233
|
+
}),
|
|
234
|
+
B && /* @__PURE__ */ D("p", {
|
|
235
|
+
className: "mb-3 text-sm text-status-error-text",
|
|
236
|
+
role: "alert",
|
|
237
|
+
children: B
|
|
238
|
+
}),
|
|
239
|
+
K,
|
|
240
|
+
/* @__PURE__ */ D(y, {
|
|
241
|
+
open: L != null,
|
|
242
|
+
onOpenChange: (e) => !e && R(null),
|
|
243
|
+
children: /* @__PURE__ */ O(S, { children: [/* @__PURE__ */ O(T, { children: [/* @__PURE__ */ D(E, { children: G?.confirmTitle }), /* @__PURE__ */ D(C, { children: G?.confirmBody })] }), /* @__PURE__ */ O(w, { children: [/* @__PURE__ */ D(x, { children: f("botlit.aiOperations.actions.cancel", "Cancel") }), /* @__PURE__ */ D(b, {
|
|
244
|
+
onClick: () => void W(),
|
|
245
|
+
children: f("botlit.aiOperations.actions.confirmAccept", "Confirm")
|
|
246
|
+
})] })] })
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
export { B as AiOperationsPanel };
|
|
252
|
+
|
|
253
|
+
//# sourceMappingURL=AiOperationsPanel.js.map
|