@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,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { CreatePromptTemplateDocument as e, DeletePromptTemplateDocument as t, GetPromptTemplateDocument as n, ListPromptTemplatesDocument as r, RenderPromptTemplateDocument as i, UpdatePromptTemplateDocument as a } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { jsonRecords as o } from "../utils/unions.js";
|
|
3
|
+
import { buildMutationInput as s, fieldsOf as c } from "./internal/mutationInput.js";
|
|
4
|
+
import { useWorkspaceId as l, useWorkspaceMutation as u, useWorkspaceQuery as d } from "./internal/workspaceGateway.js";
|
|
5
5
|
import { useCallback as f, useMemo as p } from "react";
|
|
6
|
-
|
|
7
|
-
var m = 100, h =
|
|
6
|
+
// src/botlit/hooks/usePromptTemplates.ts
|
|
7
|
+
var m = 100, h = c({
|
|
8
8
|
bucketId: !0,
|
|
9
9
|
description: !0,
|
|
10
10
|
exampleInputs: !0,
|
|
@@ -18,7 +18,7 @@ var m = 100, h = t({
|
|
|
18
18
|
version: !0,
|
|
19
19
|
visibility: !0,
|
|
20
20
|
workspaceId: !0
|
|
21
|
-
}), g =
|
|
21
|
+
}), g = c({
|
|
22
22
|
bucketId: !0,
|
|
23
23
|
description: !0,
|
|
24
24
|
exampleInputs: !0,
|
|
@@ -39,7 +39,7 @@ var m = 100, h = t({
|
|
|
39
39
|
"object"
|
|
40
40
|
];
|
|
41
41
|
function y(e) {
|
|
42
|
-
return
|
|
42
|
+
return o(e.variables).map((e, t) => ({
|
|
43
43
|
name: typeof e.name == "string" ? e.name : `variable_${t + 1}`,
|
|
44
44
|
type: v.find((t) => typeof e.type == "string" && t === e.type) ?? "string",
|
|
45
45
|
required: e.required === !0,
|
|
@@ -48,36 +48,36 @@ function y(e) {
|
|
|
48
48
|
}));
|
|
49
49
|
}
|
|
50
50
|
function b(e) {
|
|
51
|
-
return
|
|
51
|
+
return o(e.exampleInputs);
|
|
52
52
|
}
|
|
53
53
|
function x(e) {
|
|
54
54
|
return e?.listPromptTemplates ?? _;
|
|
55
55
|
}
|
|
56
56
|
function S(e) {
|
|
57
|
-
let t =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
57
|
+
let t = l(), { search: n, status: i, visibility: a, bucketId: o } = e ?? {}, s = e?.tags?.join(",") ?? "", c = p(() => ({
|
|
58
|
+
filters: {
|
|
59
|
+
workspaceId: t,
|
|
60
|
+
search: n || void 0,
|
|
61
|
+
status: i,
|
|
62
|
+
visibility: a,
|
|
63
|
+
bucketId: o,
|
|
64
|
+
tags: s ? s.split(",") : void 0
|
|
65
|
+
},
|
|
66
|
+
pagination: {
|
|
67
|
+
limit: m,
|
|
68
|
+
offset: 0
|
|
69
|
+
}
|
|
70
|
+
}), [
|
|
71
|
+
t,
|
|
72
|
+
n,
|
|
73
|
+
i,
|
|
74
|
+
a,
|
|
75
|
+
o,
|
|
76
|
+
s
|
|
77
|
+
]);
|
|
78
|
+
return d({
|
|
79
|
+
document: r,
|
|
80
|
+
variables: c,
|
|
81
81
|
select: x,
|
|
82
82
|
fallback: _,
|
|
83
83
|
enabled: !!t,
|
|
@@ -85,9 +85,10 @@ function S(e) {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
function C(e) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
let t = p(() => ({ id: e ?? "" }), [e]);
|
|
89
|
+
return d({
|
|
90
|
+
document: n,
|
|
91
|
+
variables: t,
|
|
91
92
|
select: (e) => e?.getPromptTemplate ?? null,
|
|
92
93
|
fallback: null,
|
|
93
94
|
enabled: !!e,
|
|
@@ -95,12 +96,12 @@ function C(e) {
|
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
function w() {
|
|
98
|
-
let t =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
let t = l(), n = f((e) => ({ input: s({
|
|
100
|
+
...e,
|
|
101
|
+
workspaceId: t
|
|
102
|
+
}, h) }), [t]), [r, i] = u({
|
|
103
|
+
document: e,
|
|
104
|
+
variables: n,
|
|
104
105
|
select: (e) => e?.createPromptTemplate,
|
|
105
106
|
errorMessage: "Failed to create prompt template"
|
|
106
107
|
});
|
|
@@ -111,37 +112,37 @@ function w() {
|
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
114
|
function T() {
|
|
114
|
-
let [
|
|
115
|
-
document:
|
|
116
|
-
variables: ({ templateId:
|
|
117
|
-
id:
|
|
118
|
-
input:
|
|
115
|
+
let [e, t] = u({
|
|
116
|
+
document: a,
|
|
117
|
+
variables: ({ templateId: e, input: t }) => ({
|
|
118
|
+
id: e,
|
|
119
|
+
input: s(t, g)
|
|
119
120
|
}),
|
|
120
121
|
select: (e) => e?.updatePromptTemplate,
|
|
121
122
|
errorMessage: "Failed to update prompt template"
|
|
122
123
|
});
|
|
123
124
|
return {
|
|
124
|
-
update:
|
|
125
|
-
loading:
|
|
126
|
-
error:
|
|
125
|
+
update: e,
|
|
126
|
+
loading: t.loading,
|
|
127
|
+
error: t.error
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
130
|
function E() {
|
|
130
|
-
let [e,
|
|
131
|
-
document:
|
|
131
|
+
let [e, n] = u({
|
|
132
|
+
document: t,
|
|
132
133
|
variables: (e) => ({ id: e }),
|
|
133
134
|
select: (e) => e?.deletePromptTemplate,
|
|
134
135
|
errorMessage: "Failed to delete prompt template"
|
|
135
136
|
});
|
|
136
137
|
return {
|
|
137
138
|
remove: e,
|
|
138
|
-
loading:
|
|
139
|
-
error:
|
|
139
|
+
loading: n.loading,
|
|
140
|
+
error: n.error
|
|
140
141
|
};
|
|
141
142
|
}
|
|
142
143
|
function D() {
|
|
143
|
-
let [e, t] =
|
|
144
|
-
document:
|
|
144
|
+
let [e, t] = u({
|
|
145
|
+
document: i,
|
|
145
146
|
variables: ({ templateId: e, variables: t }) => ({
|
|
146
147
|
id: e,
|
|
147
148
|
variables: t
|
|
@@ -155,7 +156,6 @@ function D() {
|
|
|
155
156
|
error: t.error
|
|
156
157
|
};
|
|
157
158
|
}
|
|
158
|
-
//#endregion
|
|
159
159
|
export { b as promptTemplateExamples, y as promptTemplateVariables, w as useCreatePromptTemplate, E as useDeletePromptTemplate, C as usePromptTemplate, S as usePromptTemplates, D as useRenderPromptTemplate, T as useUpdatePromptTemplate };
|
|
160
160
|
|
|
161
161
|
//# sourceMappingURL=usePromptTemplates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePromptTemplates.js","names":[],"sources":["../../../src/botlit/hooks/usePromptTemplates.ts"],"sourcesContent":["/**\n * Prompt Templates Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listPromptTemplates` / `getPromptTemplate` operations and\n * the create/update/delete/render mutations on wspace-botlit-svc.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreatePromptTemplateDocument,\n DeletePromptTemplateDocument,\n GetPromptTemplateDocument,\n ListPromptTemplatesDocument,\n RenderPromptTemplateDocument,\n UpdatePromptTemplateDocument,\n type CreatePromptTemplateMutation,\n type DeletePromptTemplateMutation,\n type GetPromptTemplateQuery,\n type ListPromptTemplatesQuery,\n type RenderPromptTemplateMutation,\n type UpdatePromptTemplateMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreatePromptTemplateInput,\n UpdatePromptTemplateInput,\n} from '../../generated/wspace-types';\nimport { jsonRecords } from '../utils/unions';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 100;\n\nexport interface PromptTemplateRecord {\n id: string;\n name: string;\n slug: string;\n version: string;\n templateText: string;\n status: string;\n visibility: string;\n description?: string | null;\n bucketId?: string | null;\n /** Free-form JSON — the UI stores an array of `PromptVariable` here. */\n variables: Record<string, unknown> | unknown[];\n exampleInputs: Record<string, unknown> | unknown[];\n metadata?: Record<string, unknown> | null;\n revision: number;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\nexport interface PromptTemplateFilterVariables {\n search?: string;\n status?: string;\n visibility?: string;\n bucketId?: string;\n tags?: string[];\n}\n\n/** `CreatePromptTemplateInput` minus the `workspaceId` the hook supplies. */\nexport type CreatePromptTemplateVariables = Omit<\n GraphQLInput<CreatePromptTemplateInput>,\n 'workspaceId'\n>;\n\nexport interface UpdatePromptTemplateVariables {\n templateId: string;\n input: GraphQLInput<UpdatePromptTemplateInput>;\n}\n\nconst CREATE_TEMPLATE_FIELDS = fieldsOf<CreatePromptTemplateInput>({\n bucketId: true,\n description: true,\n exampleInputs: true,\n metadata: true,\n name: true,\n slug: true,\n status: true,\n tags: true,\n templateText: true,\n variables: true,\n version: true,\n visibility: true,\n workspaceId: true,\n});\n\nconst UPDATE_TEMPLATE_FIELDS = fieldsOf<UpdatePromptTemplateInput>({\n bucketId: true,\n description: true,\n exampleInputs: true,\n metadata: true,\n name: true,\n slug: true,\n status: true,\n tags: true,\n templateText: true,\n variables: true,\n version: true,\n visibility: true,\n});\n\nexport interface RenderPromptTemplateVariables {\n templateId: string;\n variables?: Record<string, unknown>;\n}\n\nconst NO_TEMPLATES: PromptTemplateRecord[] = [];\n\n/** The variable types the editor offers; anything else falls back to `string`. */\nconst VARIABLE_TYPES: PromptVariableType[] = ['string', 'number', 'boolean', 'array', 'object'];\n\nexport type PromptVariableType = 'string' | 'number' | 'boolean' | 'array' | 'object';\n\n/**\n * One declared template variable. `variables` is a free-form `JSON` column, so\n * a template whose variables were written by another client (or stored as an\n * object rather than an array) must still render.\n */\nexport interface PromptTemplateVariable {\n name: string;\n type: PromptVariableType;\n required: boolean;\n description?: string;\n defaultValue?: unknown;\n}\n\n/** The template's declared variables, normalised for rendering. */\nexport function promptTemplateVariables(\n template: Pick<PromptTemplateRecord, 'variables'>\n): PromptTemplateVariable[] {\n return jsonRecords(template.variables).map((variable, index) => ({\n name: typeof variable.name === 'string' ? variable.name : `variable_${index + 1}`,\n type:\n VARIABLE_TYPES.find(\n (candidate) => typeof variable.type === 'string' && candidate === variable.type\n ) ?? 'string',\n required: variable.required === true,\n description: typeof variable.description === 'string' ? variable.description : undefined,\n defaultValue: variable.defaultValue,\n }));\n}\n\n/** The template's example input sets, normalised for rendering. */\nexport function promptTemplateExamples(\n template: Pick<PromptTemplateRecord, 'exampleInputs'>\n): Record<string, unknown>[] {\n return jsonRecords(template.exampleInputs);\n}\n\nfunction selectTemplates(data: ListPromptTemplatesQuery | undefined): PromptTemplateRecord[] {\n return data?.listPromptTemplates ?? NO_TEMPLATES;\n}\n\nexport const promptTemplateKeys = {\n all: ['promptTemplates'] as const,\n lists: () => [...promptTemplateKeys.all, 'list'] as const,\n list: (filter?: PromptTemplateFilterVariables) =>\n [...promptTemplateKeys.lists(), filter] as const,\n details: () => [...promptTemplateKeys.all, 'detail'] as const,\n detail: (id: string) => [...promptTemplateKeys.details(), id] as const,\n};\n\nexport function usePromptTemplates(\n filter?: PromptTemplateFilterVariables\n): QueryResult<PromptTemplateRecord[]> {\n const workspaceId = useWorkspaceId();\n const { search, status, visibility, bucketId } = filter ?? {};\n const tagsKey = filter?.tags?.join(',') ?? '';\n\n const variables = useMemo(\n () => ({\n filters: {\n workspaceId,\n search: search || undefined,\n status,\n visibility,\n bucketId,\n tags: tagsKey ? tagsKey.split(',') : undefined,\n },\n pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [workspaceId, search, status, visibility, bucketId, tagsKey]\n );\n\n return useWorkspaceQuery<ListPromptTemplatesQuery, PromptTemplateRecord[]>({\n document: ListPromptTemplatesDocument,\n variables,\n select: selectTemplates,\n fallback: NO_TEMPLATES,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load prompt templates',\n });\n}\n\nexport function usePromptTemplate(\n templateId: string | undefined\n): QueryResult<PromptTemplateRecord | null> {\n const variables = useMemo(() => ({ id: templateId ?? '' }), [templateId]);\n\n return useWorkspaceQuery<GetPromptTemplateQuery, PromptTemplateRecord | null>({\n document: GetPromptTemplateDocument,\n variables,\n select: (data) => data?.getPromptTemplate ?? null,\n fallback: null,\n enabled: Boolean(templateId),\n errorMessage: 'Failed to load prompt template',\n });\n}\n\nexport function useCreatePromptTemplate() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreatePromptTemplateVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_TEMPLATE_FIELDS),\n }),\n [workspaceId]\n );\n\n const [create, state] = useWorkspaceMutation<\n CreatePromptTemplateMutation,\n CreatePromptTemplateVariables,\n PromptTemplateRecord\n >({\n document: CreatePromptTemplateDocument,\n variables,\n select: (data) => data?.createPromptTemplate,\n errorMessage: 'Failed to create prompt template',\n });\n\n return { create, loading: state.loading, error: state.error };\n}\n\nexport function useUpdatePromptTemplate() {\n const [update, state] = useWorkspaceMutation<\n UpdatePromptTemplateMutation,\n UpdatePromptTemplateVariables,\n PromptTemplateRecord\n >({\n document: UpdatePromptTemplateDocument,\n variables: ({ templateId, input }) => ({\n id: templateId,\n input: buildMutationInput(input, UPDATE_TEMPLATE_FIELDS),\n }),\n select: (data) => data?.updatePromptTemplate,\n errorMessage: 'Failed to update prompt template',\n });\n\n return { update, loading: state.loading, error: state.error };\n}\n\nexport function useDeletePromptTemplate() {\n const [remove, state] = useWorkspaceMutation<DeletePromptTemplateMutation, string, boolean>({\n document: DeletePromptTemplateDocument,\n variables: (templateId) => ({ id: templateId }),\n select: (data) => data?.deletePromptTemplate,\n errorMessage: 'Failed to delete prompt template',\n });\n\n return { remove, loading: state.loading, error: state.error };\n}\n\nexport function useRenderPromptTemplate() {\n const [render, state] = useWorkspaceMutation<\n RenderPromptTemplateMutation,\n RenderPromptTemplateVariables,\n string\n >({\n document: RenderPromptTemplateDocument,\n variables: ({ templateId, variables }) => ({ id: templateId, variables }),\n select: (data) => data?.renderPromptTemplate,\n errorMessage: 'Failed to render prompt template',\n });\n\n return { render, loading: state.loading, error: state.error };\n}\n"],"mappings":";;;;;;AAoCA,IAAM,IAAa,KA4Cb,IAAyB,EAAoC;CACjE,UAAU;CACV,aAAa;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,CAAC;AAEF,QAAO;EAAE;EAAQ,SAAS,EAAM;EAAS,OAAO,EAAM;EAAO"}
|
|
1
|
+
{"version":3,"file":"usePromptTemplates.js","names":["LIST_LIMIT","CREATE_TEMPLATE_FIELDS","fieldsOf","UPDATE_TEMPLATE_FIELDS","NO_TEMPLATES","VARIABLE_TYPES","promptTemplateVariables","jsonRecords","template","variable","index","candidate","promptTemplateExamples","selectTemplates","data","usePromptTemplates","workspaceId","useWorkspaceId","filter","tagsKey","variables","useMemo","search","status","visibility","bucketId","useWorkspaceQuery","ListPromptTemplatesDocument","usePromptTemplate","templateId","GetPromptTemplateDocument","useCreatePromptTemplate","useCallback","buildMutationInput","input","create","state","useWorkspaceMutation","CreatePromptTemplateDocument","useUpdatePromptTemplate","update","UpdatePromptTemplateDocument","useDeletePromptTemplate","remove","DeletePromptTemplateDocument","useRenderPromptTemplate","render","RenderPromptTemplateDocument"],"sources":["../../../src/botlit/hooks/usePromptTemplates.ts"],"sourcesContent":["/**\n * Prompt Templates Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listPromptTemplates` / `getPromptTemplate` operations and\n * the create/update/delete/render mutations on wspace-botlit-svc.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreatePromptTemplateDocument,\n DeletePromptTemplateDocument,\n GetPromptTemplateDocument,\n ListPromptTemplatesDocument,\n RenderPromptTemplateDocument,\n UpdatePromptTemplateDocument,\n type CreatePromptTemplateMutation,\n type DeletePromptTemplateMutation,\n type GetPromptTemplateQuery,\n type ListPromptTemplatesQuery,\n type RenderPromptTemplateMutation,\n type UpdatePromptTemplateMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreatePromptTemplateInput,\n UpdatePromptTemplateInput,\n} from '../../generated/wspace-types';\nimport { jsonRecords } from '../utils/unions';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 100;\n\nexport interface PromptTemplateRecord {\n id: string;\n name: string;\n slug: string;\n version: string;\n templateText: string;\n status: string;\n visibility: string;\n description?: string | null;\n bucketId?: string | null;\n /** Free-form JSON — the UI stores an array of `PromptVariable` here. */\n variables: Record<string, unknown> | unknown[];\n exampleInputs: Record<string, unknown> | unknown[];\n metadata?: Record<string, unknown> | null;\n revision: number;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\nexport interface PromptTemplateFilterVariables {\n search?: string;\n status?: string;\n visibility?: string;\n bucketId?: string;\n tags?: string[];\n}\n\n/** `CreatePromptTemplateInput` minus the `workspaceId` the hook supplies. */\nexport type CreatePromptTemplateVariables = Omit<\n GraphQLInput<CreatePromptTemplateInput>,\n 'workspaceId'\n>;\n\nexport interface UpdatePromptTemplateVariables {\n templateId: string;\n input: GraphQLInput<UpdatePromptTemplateInput>;\n}\n\nconst CREATE_TEMPLATE_FIELDS = fieldsOf<CreatePromptTemplateInput>({\n bucketId: true,\n description: true,\n exampleInputs: true,\n metadata: true,\n name: true,\n slug: true,\n status: true,\n tags: true,\n templateText: true,\n variables: true,\n version: true,\n visibility: true,\n workspaceId: true,\n});\n\nconst UPDATE_TEMPLATE_FIELDS = fieldsOf<UpdatePromptTemplateInput>({\n bucketId: true,\n description: true,\n exampleInputs: true,\n metadata: true,\n name: true,\n slug: true,\n status: true,\n tags: true,\n templateText: true,\n variables: true,\n version: true,\n visibility: true,\n});\n\nexport interface RenderPromptTemplateVariables {\n templateId: string;\n variables?: Record<string, unknown>;\n}\n\nconst NO_TEMPLATES: PromptTemplateRecord[] = [];\n\n/** The variable types the editor offers; anything else falls back to `string`. */\nconst VARIABLE_TYPES: PromptVariableType[] = ['string', 'number', 'boolean', 'array', 'object'];\n\nexport type PromptVariableType = 'string' | 'number' | 'boolean' | 'array' | 'object';\n\n/**\n * One declared template variable. `variables` is a free-form `JSON` column, so\n * a template whose variables were written by another client (or stored as an\n * object rather than an array) must still render.\n */\nexport interface PromptTemplateVariable {\n name: string;\n type: PromptVariableType;\n required: boolean;\n description?: string;\n defaultValue?: unknown;\n}\n\n/** The template's declared variables, normalised for rendering. */\nexport function promptTemplateVariables(\n template: Pick<PromptTemplateRecord, 'variables'>\n): PromptTemplateVariable[] {\n return jsonRecords(template.variables).map((variable, index) => ({\n name: typeof variable.name === 'string' ? variable.name : `variable_${index + 1}`,\n type:\n VARIABLE_TYPES.find(\n (candidate) => typeof variable.type === 'string' && candidate === variable.type\n ) ?? 'string',\n required: variable.required === true,\n description: typeof variable.description === 'string' ? variable.description : undefined,\n defaultValue: variable.defaultValue,\n }));\n}\n\n/** The template's example input sets, normalised for rendering. */\nexport function promptTemplateExamples(\n template: Pick<PromptTemplateRecord, 'exampleInputs'>\n): Record<string, unknown>[] {\n return jsonRecords(template.exampleInputs);\n}\n\nfunction selectTemplates(data: ListPromptTemplatesQuery | undefined): PromptTemplateRecord[] {\n return data?.listPromptTemplates ?? NO_TEMPLATES;\n}\n\nexport const promptTemplateKeys = {\n all: ['promptTemplates'] as const,\n lists: () => [...promptTemplateKeys.all, 'list'] as const,\n list: (filter?: PromptTemplateFilterVariables) =>\n [...promptTemplateKeys.lists(), filter] as const,\n details: () => [...promptTemplateKeys.all, 'detail'] as const,\n detail: (id: string) => [...promptTemplateKeys.details(), id] as const,\n};\n\nexport function usePromptTemplates(\n filter?: PromptTemplateFilterVariables\n): QueryResult<PromptTemplateRecord[]> {\n const workspaceId = useWorkspaceId();\n const { search, status, visibility, bucketId } = filter ?? {};\n const tagsKey = filter?.tags?.join(',') ?? '';\n\n const variables = useMemo(\n () => ({\n filters: {\n workspaceId,\n search: search || undefined,\n status,\n visibility,\n bucketId,\n tags: tagsKey ? tagsKey.split(',') : undefined,\n },\n pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [workspaceId, search, status, visibility, bucketId, tagsKey]\n );\n\n return useWorkspaceQuery<ListPromptTemplatesQuery, PromptTemplateRecord[]>({\n document: ListPromptTemplatesDocument,\n variables,\n select: selectTemplates,\n fallback: NO_TEMPLATES,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load prompt templates',\n });\n}\n\nexport function usePromptTemplate(\n templateId: string | undefined\n): QueryResult<PromptTemplateRecord | null> {\n const variables = useMemo(() => ({ id: templateId ?? '' }), [templateId]);\n\n return useWorkspaceQuery<GetPromptTemplateQuery, PromptTemplateRecord | null>({\n document: GetPromptTemplateDocument,\n variables,\n select: (data) => data?.getPromptTemplate ?? null,\n fallback: null,\n enabled: Boolean(templateId),\n errorMessage: 'Failed to load prompt template',\n });\n}\n\nexport function useCreatePromptTemplate() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreatePromptTemplateVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_TEMPLATE_FIELDS),\n }),\n [workspaceId]\n );\n\n const [create, state] = useWorkspaceMutation<\n CreatePromptTemplateMutation,\n CreatePromptTemplateVariables,\n PromptTemplateRecord\n >({\n document: CreatePromptTemplateDocument,\n variables,\n select: (data) => data?.createPromptTemplate,\n errorMessage: 'Failed to create prompt template',\n });\n\n return { create, loading: state.loading, error: state.error };\n}\n\nexport function useUpdatePromptTemplate() {\n const [update, state] = useWorkspaceMutation<\n UpdatePromptTemplateMutation,\n UpdatePromptTemplateVariables,\n PromptTemplateRecord\n >({\n document: UpdatePromptTemplateDocument,\n variables: ({ templateId, input }) => ({\n id: templateId,\n input: buildMutationInput(input, UPDATE_TEMPLATE_FIELDS),\n }),\n select: (data) => data?.updatePromptTemplate,\n errorMessage: 'Failed to update prompt template',\n });\n\n return { update, loading: state.loading, error: state.error };\n}\n\nexport function useDeletePromptTemplate() {\n const [remove, state] = useWorkspaceMutation<DeletePromptTemplateMutation, string, boolean>({\n document: DeletePromptTemplateDocument,\n variables: (templateId) => ({ id: templateId }),\n select: (data) => data?.deletePromptTemplate,\n errorMessage: 'Failed to delete prompt template',\n });\n\n return { remove, loading: state.loading, error: state.error };\n}\n\nexport function useRenderPromptTemplate() {\n const [render, state] = useWorkspaceMutation<\n RenderPromptTemplateMutation,\n RenderPromptTemplateVariables,\n string\n >({\n document: RenderPromptTemplateDocument,\n variables: ({ templateId, variables }) => ({ id: templateId, variables }),\n select: (data) => data?.renderPromptTemplate,\n errorMessage: 'Failed to render prompt template',\n });\n\n return { render, loading: state.loading, error: state.error };\n}\n"],"mappings":";;;;;;AAoCA,IAAMA,IAAa,KA4CbC,IAAyBC,EAAoC;CACjE,UAAU;CACV,aAAa;CACb,eAAe;CACf,UAAU;CACV,MAAM;CACN,MAAM;CACN,QAAQ;CACR,MAAM;CACN,cAAc;CACd,WAAW;CACX,SAAS;CACT,YAAY;CACZ,aAAa;AACf,CAAC,GAEKC,IAAyBD,EAAoC;CACjE,UAAU;CACV,aAAa;CACb,eAAe;CACf,UAAU;CACV,MAAM;CACN,MAAM;CACN,QAAQ;CACR,MAAM;CACN,cAAc;CACd,WAAW;CACX,SAAS;CACT,YAAY;AACd,CAAC,GAOKE,IAAuC,CAAC,GAGxCC,IAAuC;CAAC;CAAU;CAAU;CAAW;CAAS;AAAQ;AAkB9F,SAAgBC,EACd,GAC0B;CAC1B,OAAOC,EAAYC,EAAS,SAAS,CAAC,CAAC,KAAK,GAAU,OAAW;EAC/D,MAAM,OAAOC,EAAS,QAAS,WAAWA,EAAS,OAAO,YAAYC,IAAQ;EAC9E,MACEL,EAAe,MACZ,MAAc,OAAOI,EAAS,QAAS,YAAYE,MAAcF,EAAS,IAC7E,KAAK;EACP,UAAUA,EAAS,aAAa;EAChC,aAAa,OAAOA,EAAS,eAAgB,WAAWA,EAAS,cAAc,KAAA;EAC/E,cAAcA,EAAS;CACzB,EAAE;AACJ;AAGA,SAAgBG,EACd,GAC2B;CAC3B,OAAOL,EAAYC,EAAS,aAAa;AAC3C;AAEA,SAASK,EAAgB,GAAoE;CAC3F,OAAOC,GAAM,uBAAuBV;AACtC;AAWA,SAAgBW,EACd,GACqC;CACrC,IA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AAc;CAChB,CAAC;CAED,OAAO;EAAE;EAAQ,SAASsB,EAAM;EAAS,OAAOA,EAAM;CAAM;AAC9D;AAEA,SAAgBM,IAA0B;CACxC,IAAM,CAACC,GAAQP,KAASC,EAAoE;EAC1F,UAAUO;EACV,YAAY,OAAgB,EAAE,IAAIf,EAAW;EAC7C,SAAS,MAASf,GAAM;EACxB,cAAc;CAChB,CAAC;CAED,OAAO;EAAE;EAAQ,SAASsB,EAAM;EAAS,OAAOA,EAAM;CAAM;AAC9D;AAEA,SAAgBS,IAA0B;CACxC,IAAM,CAACC,GAAQV,KAASC,EAItB;EACA,UAAUU;EACV,YAAY,EAAE,eAAY,oBAAiB;GAAE,IAAIlB;GAAY;EAAU;EACvE,SAAS,MAASf,GAAM;EACxB,cAAc;CAChB,CAAC;CAED,OAAO;EAAE;EAAQ,SAASsB,EAAM;EAAS,OAAOA,EAAM;CAAM;AAC9D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { QueryResult } from './internal/workspaceGateway';
|
|
2
|
+
export interface RetentionRunRecord {
|
|
3
|
+
id: string;
|
|
4
|
+
trigger: string;
|
|
5
|
+
status: string;
|
|
6
|
+
executionDataRetentionDays?: number | null;
|
|
7
|
+
conversationRetentionDays?: number | null;
|
|
8
|
+
executionsPurged: number;
|
|
9
|
+
a2aMessagesPurged: number;
|
|
10
|
+
errorMessage?: string | null;
|
|
11
|
+
startedAt: string;
|
|
12
|
+
finishedAt: string;
|
|
13
|
+
}
|
|
14
|
+
export interface RetentionStatusRecord {
|
|
15
|
+
executionDataRetentionDays?: number | null;
|
|
16
|
+
conversationRetentionDays?: number | null;
|
|
17
|
+
activePolicyCount: number;
|
|
18
|
+
endOfTermErasureGraceDays: number;
|
|
19
|
+
recentRuns: RetentionRunRecord[];
|
|
20
|
+
}
|
|
21
|
+
export declare function useRetentionStatus(): QueryResult<RetentionStatusRecord | null>;
|
|
22
|
+
export declare function useApplyRetention(): {
|
|
23
|
+
apply: (input: void) => Promise<RetentionRunRecord>;
|
|
24
|
+
loading: boolean;
|
|
25
|
+
error: Error | undefined;
|
|
26
|
+
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { ApplyBotmanorRetentionDocument as e, BotmanorRetentionStatusDocument as t } from "../../generated/wspace-operations.js";
|
|
2
2
|
import { useWorkspaceId as n, useWorkspaceMutation as r, useWorkspaceQuery as i } from "./internal/workspaceGateway.js";
|
|
3
|
-
|
|
3
|
+
// src/botlit/hooks/useRetention.ts
|
|
4
4
|
var a = {};
|
|
5
5
|
function o() {
|
|
6
|
+
let e = n();
|
|
6
7
|
return i({
|
|
7
8
|
document: t,
|
|
8
9
|
variables: a,
|
|
9
10
|
select: (e) => e?.botmanorRetentionStatus ?? null,
|
|
10
11
|
fallback: null,
|
|
11
|
-
enabled: !!
|
|
12
|
+
enabled: !!e,
|
|
12
13
|
errorMessage: "Failed to load retention status"
|
|
13
14
|
});
|
|
14
15
|
}
|
|
@@ -25,7 +26,6 @@ function s() {
|
|
|
25
26
|
error: n.error
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
|
-
//#endregion
|
|
29
29
|
export { s as useApplyRetention, o as useRetentionStatus };
|
|
30
30
|
|
|
31
31
|
//# sourceMappingURL=useRetention.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRetention.js","names":[],"sources":["../../../src/botlit/hooks/useRetention.ts"],"sourcesContent":["/**\n * Retention hooks (BOFF-9661)\n * @module botlit/hooks\n *\n * Reads the retention settings in force for the workspace and its recent\n * retention passes, and runs a pass on demand. Retention itself is enforced\n * hourly by wspace-botmanor-svc; `applyBotmanorRetention` only runs it now.\n */\n\nimport {\n ApplyBotmanorRetentionDocument,\n BotmanorRetentionStatusDocument,\n type ApplyBotmanorRetentionMutation,\n type BotmanorRetentionStatusQuery,\n} from '../../generated/wspace-operations';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst NO_VARIABLES: Record<string, unknown> = {};\n\nexport interface RetentionRunRecord {\n id: string;\n trigger: string;\n status: string;\n executionDataRetentionDays?: number | null;\n conversationRetentionDays?: number | null;\n executionsPurged: number;\n a2aMessagesPurged: number;\n errorMessage?: string | null;\n startedAt: string;\n finishedAt: string;\n}\n\nexport interface RetentionStatusRecord {\n executionDataRetentionDays?: number | null;\n conversationRetentionDays?: number | null;\n activePolicyCount: number;\n endOfTermErasureGraceDays: number;\n recentRuns: RetentionRunRecord[];\n}\n\nexport function useRetentionStatus(): QueryResult<RetentionStatusRecord | null> {\n const workspaceId = useWorkspaceId();\n return useWorkspaceQuery<BotmanorRetentionStatusQuery, RetentionStatusRecord | null>({\n document: BotmanorRetentionStatusDocument,\n // No arguments: the workspace comes from the gateway-verified token.\n variables: NO_VARIABLES,\n select: (data) => data?.botmanorRetentionStatus ?? null,\n fallback: null,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load retention status',\n });\n}\n\nexport function useApplyRetention() {\n const [apply, state] = useWorkspaceMutation<\n ApplyBotmanorRetentionMutation,\n void,\n RetentionRunRecord\n >({\n document: ApplyBotmanorRetentionDocument,\n variables: () => ({}),\n select: (data) => data?.applyBotmanorRetention,\n errorMessage: 'Failed to apply retention',\n });\n return { apply, loading: state.loading, error: state.error };\n}\n"],"mappings":";;;AAsBA,
|
|
1
|
+
{"version":3,"file":"useRetention.js","names":["NO_VARIABLES","useRetentionStatus","workspaceId","useWorkspaceId","useWorkspaceQuery","BotmanorRetentionStatusDocument","data","useApplyRetention","apply","state","useWorkspaceMutation","ApplyBotmanorRetentionDocument"],"sources":["../../../src/botlit/hooks/useRetention.ts"],"sourcesContent":["/**\n * Retention hooks (BOFF-9661)\n * @module botlit/hooks\n *\n * Reads the retention settings in force for the workspace and its recent\n * retention passes, and runs a pass on demand. Retention itself is enforced\n * hourly by wspace-botmanor-svc; `applyBotmanorRetention` only runs it now.\n */\n\nimport {\n ApplyBotmanorRetentionDocument,\n BotmanorRetentionStatusDocument,\n type ApplyBotmanorRetentionMutation,\n type BotmanorRetentionStatusQuery,\n} from '../../generated/wspace-operations';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst NO_VARIABLES: Record<string, unknown> = {};\n\nexport interface RetentionRunRecord {\n id: string;\n trigger: string;\n status: string;\n executionDataRetentionDays?: number | null;\n conversationRetentionDays?: number | null;\n executionsPurged: number;\n a2aMessagesPurged: number;\n errorMessage?: string | null;\n startedAt: string;\n finishedAt: string;\n}\n\nexport interface RetentionStatusRecord {\n executionDataRetentionDays?: number | null;\n conversationRetentionDays?: number | null;\n activePolicyCount: number;\n endOfTermErasureGraceDays: number;\n recentRuns: RetentionRunRecord[];\n}\n\nexport function useRetentionStatus(): QueryResult<RetentionStatusRecord | null> {\n const workspaceId = useWorkspaceId();\n return useWorkspaceQuery<BotmanorRetentionStatusQuery, RetentionStatusRecord | null>({\n document: BotmanorRetentionStatusDocument,\n // No arguments: the workspace comes from the gateway-verified token.\n variables: NO_VARIABLES,\n select: (data) => data?.botmanorRetentionStatus ?? null,\n fallback: null,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load retention status',\n });\n}\n\nexport function useApplyRetention() {\n const [apply, state] = useWorkspaceMutation<\n ApplyBotmanorRetentionMutation,\n void,\n RetentionRunRecord\n >({\n document: ApplyBotmanorRetentionDocument,\n variables: () => ({}),\n select: (data) => data?.applyBotmanorRetention,\n errorMessage: 'Failed to apply retention',\n });\n return { apply, loading: state.loading, error: state.error };\n}\n"],"mappings":";;;AAsBA,IAAMA,IAAwC,CAAC;AAuB/C,SAAgBC,IAAgE;CAC9E,IAAMC,IAAcC,EAAe;CACnC,OAAOC,EAA8E;EACnF,UAAUC;EAEV,WAAWL;EACX,SAAS,MAASM,GAAM,2BAA2B;EACnD,UAAU;EACV,SAAS,EAAQJ;EACjB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBK,IAAoB;CAClC,IAAM,CAACC,GAAOC,KAASC,EAIrB;EACA,UAAUC;EACV,kBAAkB,CAAC;EACnB,SAAS,MAASL,GAAM;EACxB,cAAc;CAChB,CAAC;CACD,OAAO;EAAE;EAAO,SAASG,EAAM;EAAS,OAAOA,EAAM;CAAM;AAC7D"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { CreateRetrievalProfileInput, UpdateRetrievalProfileInput } from '../../generated/wspace-types';
|
|
2
|
+
import { GraphQLInput } from './internal/mutationInput';
|
|
3
|
+
import { QueryResult } from './internal/workspaceGateway';
|
|
4
|
+
export interface RetrievalProfileRecord {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
status: string;
|
|
8
|
+
visibility: string;
|
|
9
|
+
strategyMode: string;
|
|
10
|
+
topK: number;
|
|
11
|
+
snippetMaxChars: number;
|
|
12
|
+
minSources: number;
|
|
13
|
+
citationsRequired: boolean;
|
|
14
|
+
showSources: boolean;
|
|
15
|
+
noAnswerIfBelowThreshold: boolean;
|
|
16
|
+
multiHop: string;
|
|
17
|
+
queryRewrite: string;
|
|
18
|
+
reranker: string;
|
|
19
|
+
description?: string | null;
|
|
20
|
+
bucketId?: string | null;
|
|
21
|
+
citationFormat?: string | null;
|
|
22
|
+
hybridWeights?: Record<string, unknown> | null;
|
|
23
|
+
minRelevanceScore?: number | null;
|
|
24
|
+
multiHopDepth?: number | null;
|
|
25
|
+
rerankerModelPolicyId?: string | null;
|
|
26
|
+
testQueries?: Record<string, unknown> | null;
|
|
27
|
+
metadata?: Record<string, unknown> | null;
|
|
28
|
+
revision: number;
|
|
29
|
+
tags: string[];
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
createdById: string;
|
|
33
|
+
updatedById: string;
|
|
34
|
+
workspaceId: string;
|
|
35
|
+
}
|
|
36
|
+
export interface RetrievalProfileFilterVariables {
|
|
37
|
+
search?: string;
|
|
38
|
+
status?: string;
|
|
39
|
+
strategyMode?: string;
|
|
40
|
+
bucketId?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* `CreateRetrievalProfileInput` minus the `workspaceId` the hook supplies.
|
|
44
|
+
* The service's input is FLAT — there is no nested `strategy`/`grounding`/
|
|
45
|
+
* `thresholds` object anywhere in the schema.
|
|
46
|
+
*/
|
|
47
|
+
export type CreateRetrievalProfileVariables = Omit<GraphQLInput<CreateRetrievalProfileInput>, 'workspaceId'>;
|
|
48
|
+
export interface UpdateRetrievalProfileVariables {
|
|
49
|
+
profileId: string;
|
|
50
|
+
input: GraphQLInput<UpdateRetrievalProfileInput>;
|
|
51
|
+
}
|
|
52
|
+
export declare const retrievalProfileKeys: {
|
|
53
|
+
all: readonly ["retrieval-profiles"];
|
|
54
|
+
lists: () => readonly ["retrieval-profiles", "list"];
|
|
55
|
+
list: (filter?: RetrievalProfileFilterVariables) => readonly ["retrieval-profiles", "list", RetrievalProfileFilterVariables | undefined];
|
|
56
|
+
details: () => readonly ["retrieval-profiles", "detail"];
|
|
57
|
+
detail: (id: string) => readonly ["retrieval-profiles", "detail", string];
|
|
58
|
+
};
|
|
59
|
+
export declare function useRetrievalProfiles(filter?: RetrievalProfileFilterVariables): QueryResult<RetrievalProfileRecord[]>;
|
|
60
|
+
export declare function useRetrievalProfile(profileId: string | undefined): QueryResult<RetrievalProfileRecord | null>;
|
|
61
|
+
export declare function useCreateRetrievalProfile(): {
|
|
62
|
+
create: (input: CreateRetrievalProfileVariables) => Promise<RetrievalProfileRecord>;
|
|
63
|
+
loading: boolean;
|
|
64
|
+
error: Error | undefined;
|
|
65
|
+
};
|
|
66
|
+
export declare function useUpdateRetrievalProfile(): {
|
|
67
|
+
update: (input: UpdateRetrievalProfileVariables) => Promise<RetrievalProfileRecord>;
|
|
68
|
+
loading: boolean;
|
|
69
|
+
error: Error | undefined;
|
|
70
|
+
};
|
|
71
|
+
export declare function useDeleteRetrievalProfile(): {
|
|
72
|
+
remove: (input: string) => Promise<boolean>;
|
|
73
|
+
loading: boolean;
|
|
74
|
+
error: Error | undefined;
|
|
75
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CreateRetrievalProfileDocument as e, DeleteRetrievalProfileDocument as t, GetRetrievalProfileDocument as n, ListRetrievalProfilesDocument as r, UpdateRetrievalProfileDocument as i } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { buildMutationInput as a, fieldsOf as o } from "./internal/mutationInput.js";
|
|
3
3
|
import { useWorkspaceId as s, useWorkspaceMutation as c, useWorkspaceQuery as l } from "./internal/workspaceGateway.js";
|
|
4
4
|
import { useCallback as u, useMemo as d } from "react";
|
|
5
|
-
|
|
6
|
-
var f = 100, p =
|
|
5
|
+
// src/botlit/hooks/useRetrievalProfiles.ts
|
|
6
|
+
var f = 100, p = o({
|
|
7
7
|
bucketId: !0,
|
|
8
8
|
citationFormat: !0,
|
|
9
9
|
citationsRequired: !0,
|
|
@@ -28,7 +28,7 @@ var f = 100, p = t({
|
|
|
28
28
|
topK: !0,
|
|
29
29
|
visibility: !0,
|
|
30
30
|
workspaceId: !0
|
|
31
|
-
}), m =
|
|
31
|
+
}), m = o({
|
|
32
32
|
bucketId: !0,
|
|
33
33
|
citationFormat: !0,
|
|
34
34
|
citationsRequired: !0,
|
|
@@ -57,28 +57,28 @@ function g(e) {
|
|
|
57
57
|
return e?.listRetrievalProfiles ?? h;
|
|
58
58
|
}
|
|
59
59
|
function _(e) {
|
|
60
|
-
let t = s(), { search: n, status:
|
|
60
|
+
let t = s(), { search: n, status: i, strategyMode: a, bucketId: o } = e ?? {}, c = d(() => ({
|
|
61
|
+
filters: {
|
|
62
|
+
workspaceId: t,
|
|
63
|
+
search: n || void 0,
|
|
64
|
+
status: i,
|
|
65
|
+
strategyMode: a,
|
|
66
|
+
bucketId: o
|
|
67
|
+
},
|
|
68
|
+
pagination: {
|
|
69
|
+
limit: f,
|
|
70
|
+
offset: 0
|
|
71
|
+
}
|
|
72
|
+
}), [
|
|
73
|
+
t,
|
|
74
|
+
n,
|
|
75
|
+
i,
|
|
76
|
+
a,
|
|
77
|
+
o
|
|
78
|
+
]);
|
|
61
79
|
return l({
|
|
62
|
-
document:
|
|
63
|
-
variables:
|
|
64
|
-
filters: {
|
|
65
|
-
workspaceId: t,
|
|
66
|
-
search: n || void 0,
|
|
67
|
-
status: r,
|
|
68
|
-
strategyMode: i,
|
|
69
|
-
bucketId: o
|
|
70
|
-
},
|
|
71
|
-
pagination: {
|
|
72
|
-
limit: f,
|
|
73
|
-
offset: 0
|
|
74
|
-
}
|
|
75
|
-
}), [
|
|
76
|
-
t,
|
|
77
|
-
n,
|
|
78
|
-
r,
|
|
79
|
-
i,
|
|
80
|
-
o
|
|
81
|
-
]),
|
|
80
|
+
document: r,
|
|
81
|
+
variables: c,
|
|
82
82
|
select: g,
|
|
83
83
|
fallback: h,
|
|
84
84
|
enabled: !!t,
|
|
@@ -86,9 +86,10 @@ function _(e) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
function v(e) {
|
|
89
|
+
let t = d(() => ({ id: e ?? "" }), [e]);
|
|
89
90
|
return l({
|
|
90
|
-
document:
|
|
91
|
-
variables:
|
|
91
|
+
document: n,
|
|
92
|
+
variables: t,
|
|
92
93
|
select: (e) => e?.getRetrievalProfile ?? null,
|
|
93
94
|
fallback: null,
|
|
94
95
|
enabled: !!e,
|
|
@@ -96,12 +97,12 @@ function v(e) {
|
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
function y() {
|
|
99
|
-
let t = s(),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
let t = s(), n = u((e) => ({ input: a({
|
|
101
|
+
...e,
|
|
102
|
+
workspaceId: t
|
|
103
|
+
}, p) }), [t]), [r, i] = c({
|
|
104
|
+
document: e,
|
|
105
|
+
variables: n,
|
|
105
106
|
select: (e) => e?.createRetrievalProfile,
|
|
106
107
|
errorMessage: "Failed to create retrieval profile"
|
|
107
108
|
});
|
|
@@ -112,35 +113,34 @@ function y() {
|
|
|
112
113
|
};
|
|
113
114
|
}
|
|
114
115
|
function b() {
|
|
115
|
-
let [
|
|
116
|
-
document:
|
|
117
|
-
variables: ({ profileId:
|
|
118
|
-
id:
|
|
119
|
-
input:
|
|
116
|
+
let [e, t] = c({
|
|
117
|
+
document: i,
|
|
118
|
+
variables: ({ profileId: e, input: t }) => ({
|
|
119
|
+
id: e,
|
|
120
|
+
input: a(t, m)
|
|
120
121
|
}),
|
|
121
122
|
select: (e) => e?.updateRetrievalProfile,
|
|
122
123
|
errorMessage: "Failed to update retrieval profile"
|
|
123
124
|
});
|
|
124
125
|
return {
|
|
125
|
-
update:
|
|
126
|
-
loading:
|
|
127
|
-
error:
|
|
126
|
+
update: e,
|
|
127
|
+
loading: t.loading,
|
|
128
|
+
error: t.error
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
131
|
function x() {
|
|
131
|
-
let [e,
|
|
132
|
-
document:
|
|
132
|
+
let [e, n] = c({
|
|
133
|
+
document: t,
|
|
133
134
|
variables: (e) => ({ id: e }),
|
|
134
135
|
select: (e) => e?.deleteRetrievalProfile,
|
|
135
136
|
errorMessage: "Failed to delete retrieval profile"
|
|
136
137
|
});
|
|
137
138
|
return {
|
|
138
139
|
remove: e,
|
|
139
|
-
loading:
|
|
140
|
-
error:
|
|
140
|
+
loading: n.loading,
|
|
141
|
+
error: n.error
|
|
141
142
|
};
|
|
142
143
|
}
|
|
143
|
-
//#endregion
|
|
144
144
|
export { y as useCreateRetrievalProfile, x as useDeleteRetrievalProfile, v as useRetrievalProfile, _ as useRetrievalProfiles, b as useUpdateRetrievalProfile };
|
|
145
145
|
|
|
146
146
|
//# sourceMappingURL=useRetrievalProfiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRetrievalProfiles.js","names":[],"sources":["../../../src/botlit/hooks/useRetrievalProfiles.ts"],"sourcesContent":["/**\n * Retrieval Profiles Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listRetrievalProfiles` / `getRetrievalProfile` operations\n * and the create/update/delete mutations on wspace-botlit-svc.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateRetrievalProfileDocument,\n DeleteRetrievalProfileDocument,\n GetRetrievalProfileDocument,\n ListRetrievalProfilesDocument,\n UpdateRetrievalProfileDocument,\n type CreateRetrievalProfileMutation,\n type DeleteRetrievalProfileMutation,\n type GetRetrievalProfileQuery,\n type ListRetrievalProfilesQuery,\n type UpdateRetrievalProfileMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateRetrievalProfileInput,\n UpdateRetrievalProfileInput,\n} from '../../generated/wspace-types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 100;\n\nexport interface RetrievalProfileRecord {\n id: string;\n name: string;\n status: string;\n visibility: string;\n strategyMode: string;\n topK: number;\n snippetMaxChars: number;\n minSources: number;\n citationsRequired: boolean;\n showSources: boolean;\n noAnswerIfBelowThreshold: boolean;\n multiHop: string;\n queryRewrite: string;\n reranker: string;\n description?: string | null;\n bucketId?: string | null;\n citationFormat?: string | null;\n hybridWeights?: Record<string, unknown> | null;\n minRelevanceScore?: number | null;\n multiHopDepth?: number | null;\n rerankerModelPolicyId?: string | null;\n testQueries?: Record<string, unknown> | null;\n metadata?: Record<string, unknown> | null;\n revision: number;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\nexport interface RetrievalProfileFilterVariables {\n search?: string;\n status?: string;\n strategyMode?: string;\n bucketId?: string;\n}\n\n/**\n * `CreateRetrievalProfileInput` minus the `workspaceId` the hook supplies.\n * The service's input is FLAT — there is no nested `strategy`/`grounding`/\n * `thresholds` object anywhere in the schema.\n */\nexport type CreateRetrievalProfileVariables = Omit<\n GraphQLInput<CreateRetrievalProfileInput>,\n 'workspaceId'\n>;\n\nexport interface UpdateRetrievalProfileVariables {\n profileId: string;\n input: GraphQLInput<UpdateRetrievalProfileInput>;\n}\n\nconst CREATE_PROFILE_FIELDS = fieldsOf<CreateRetrievalProfileInput>({\n bucketId: true,\n citationFormat: true,\n citationsRequired: true,\n description: true,\n hybridWeights: true,\n metadata: true,\n minRelevanceScore: true,\n minSources: true,\n multiHop: true,\n multiHopDepth: true,\n name: true,\n noAnswerIfBelowThreshold: true,\n queryRewrite: true,\n reranker: true,\n rerankerModelPolicyId: true,\n showSources: true,\n snippetMaxChars: true,\n status: true,\n strategyMode: true,\n tags: true,\n testQueries: true,\n topK: true,\n visibility: true,\n workspaceId: true,\n});\n\nconst UPDATE_PROFILE_FIELDS = fieldsOf<UpdateRetrievalProfileInput>({\n bucketId: true,\n citationFormat: true,\n citationsRequired: true,\n description: true,\n hybridWeights: true,\n metadata: true,\n minRelevanceScore: true,\n minSources: true,\n multiHop: true,\n multiHopDepth: true,\n name: true,\n noAnswerIfBelowThreshold: true,\n queryRewrite: true,\n reranker: true,\n rerankerModelPolicyId: true,\n showSources: true,\n snippetMaxChars: true,\n status: true,\n strategyMode: true,\n tags: true,\n testQueries: true,\n topK: true,\n visibility: true,\n});\n\nconst NO_PROFILES: RetrievalProfileRecord[] = [];\n\nfunction selectProfiles(data: ListRetrievalProfilesQuery | undefined): RetrievalProfileRecord[] {\n return data?.listRetrievalProfiles ?? NO_PROFILES;\n}\n\nexport const retrievalProfileKeys = {\n all: ['retrieval-profiles'] as const,\n lists: () => [...retrievalProfileKeys.all, 'list'] as const,\n list: (filter?: RetrievalProfileFilterVariables) =>\n [...retrievalProfileKeys.lists(), filter] as const,\n details: () => [...retrievalProfileKeys.all, 'detail'] as const,\n detail: (id: string) => [...retrievalProfileKeys.details(), id] as const,\n};\n\nexport function useRetrievalProfiles(\n filter?: RetrievalProfileFilterVariables\n): QueryResult<RetrievalProfileRecord[]> {\n const workspaceId = useWorkspaceId();\n const { search, status, strategyMode, bucketId } = filter ?? {};\n\n const variables = useMemo(\n () => ({\n filters: {\n workspaceId,\n search: search || undefined,\n status,\n strategyMode,\n bucketId,\n },\n pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [workspaceId, search, status, strategyMode, bucketId]\n );\n\n return useWorkspaceQuery<ListRetrievalProfilesQuery, RetrievalProfileRecord[]>({\n document: ListRetrievalProfilesDocument,\n variables,\n select: selectProfiles,\n fallback: NO_PROFILES,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load retrieval profiles',\n });\n}\n\nexport function useRetrievalProfile(\n profileId: string | undefined\n): QueryResult<RetrievalProfileRecord | null> {\n const variables = useMemo(() => ({ id: profileId ?? '' }), [profileId]);\n\n return useWorkspaceQuery<GetRetrievalProfileQuery, RetrievalProfileRecord | null>({\n document: GetRetrievalProfileDocument,\n variables,\n select: (data) => data?.getRetrievalProfile ?? null,\n fallback: null,\n enabled: Boolean(profileId),\n errorMessage: 'Failed to load retrieval profile',\n });\n}\n\nexport function useCreateRetrievalProfile() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreateRetrievalProfileVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_PROFILE_FIELDS),\n }),\n [workspaceId]\n );\n\n const [create, state] = useWorkspaceMutation<\n CreateRetrievalProfileMutation,\n CreateRetrievalProfileVariables,\n RetrievalProfileRecord\n >({\n document: CreateRetrievalProfileDocument,\n variables,\n select: (data) => data?.createRetrievalProfile,\n errorMessage: 'Failed to create retrieval profile',\n });\n\n return { create, loading: state.loading, error: state.error };\n}\n\nexport function useUpdateRetrievalProfile() {\n const [update, state] = useWorkspaceMutation<\n UpdateRetrievalProfileMutation,\n UpdateRetrievalProfileVariables,\n RetrievalProfileRecord\n >({\n document: UpdateRetrievalProfileDocument,\n variables: ({ profileId, input }) => ({\n id: profileId,\n input: buildMutationInput(input, UPDATE_PROFILE_FIELDS),\n }),\n select: (data) => data?.updateRetrievalProfile,\n errorMessage: 'Failed to update retrieval profile',\n });\n\n return { update, loading: state.loading, error: state.error };\n}\n\nexport function useDeleteRetrievalProfile() {\n const [remove, state] = useWorkspaceMutation<DeleteRetrievalProfileMutation, string, boolean>({\n document: DeleteRetrievalProfileDocument,\n variables: (profileId) => ({ id: profileId }),\n select: (data) => data?.deleteRetrievalProfile,\n errorMessage: 'Failed to delete retrieval profile',\n });\n\n return { remove, loading: state.loading, error: state.error };\n}\n"],"mappings":";;;;;AAiCA,IAAM,IAAa,KAyDb,IAAwB,EAAsC;CAClE,UAAU;CACV,gBAAgB;CAChB,mBAAmB;CACnB,aAAa;CACb,eAAe;CACf,UAAU;CACV,mBAAmB;CACnB,YAAY;CACZ,UAAU;CACV,eAAe;CACf,MAAM;CACN,0BAA0B;CAC1B,cAAc;CACd,UAAU;CACV,uBAAuB;CACvB,aAAa;CACb,iBAAiB;CACjB,QAAQ;CACR,cAAc;CACd,MAAM;CACN,aAAa;CACb,MAAM;CACN,YAAY;CACZ,aAAa;CACd,CAAC,EAEI,IAAwB,EAAsC;CAClE,UAAU;CACV,gBAAgB;CAChB,mBAAmB;CACnB,aAAa;CACb,eAAe;CACf,UAAU;CACV,mBAAmB;CACnB,YAAY;CACZ,UAAU;CACV,eAAe;CACf,MAAM;CACN,0BAA0B;CAC1B,cAAc;CACd,UAAU;CACV,uBAAuB;CACvB,aAAa;CACb,iBAAiB;CACjB,QAAQ;CACR,cAAc;CACd,MAAM;CACN,aAAa;CACb,MAAM;CACN,YAAY;CACb,CAAC,EAEI,IAAwC,EAAE;AAEhD,SAAS,EAAe,GAAwE;AAC9F,QAAO,GAAM,yBAAyB;;AAYxC,SAAgB,EACd,GACuC;CACvC,IAAM,IAAc,GAAgB,EAC9B,EAAE,WAAQ,WAAQ,iBAAc,gBAAa,KAAU,EAAE;AAgB/D,QAAO,EAAwE;EAC7E,UAAU;EACV,WAhBgB,SACT;GACL,SAAS;IACP;IACA,QAAQ,KAAU,K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.js","names":["LIST_LIMIT","CREATE_PROFILE_FIELDS","fieldsOf","UPDATE_PROFILE_FIELDS","NO_PROFILES","selectProfiles","data","useRetrievalProfiles","workspaceId","useWorkspaceId","filter","variables","useMemo","search","status","strategyMode","bucketId","useWorkspaceQuery","ListRetrievalProfilesDocument","useRetrievalProfile","profileId","GetRetrievalProfileDocument","useCreateRetrievalProfile","useCallback","buildMutationInput","input","create","state","useWorkspaceMutation","CreateRetrievalProfileDocument","useUpdateRetrievalProfile","update","UpdateRetrievalProfileDocument","useDeleteRetrievalProfile","remove","DeleteRetrievalProfileDocument"],"sources":["../../../src/botlit/hooks/useRetrievalProfiles.ts"],"sourcesContent":["/**\n * Retrieval Profiles Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listRetrievalProfiles` / `getRetrievalProfile` operations\n * and the create/update/delete mutations on wspace-botlit-svc.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateRetrievalProfileDocument,\n DeleteRetrievalProfileDocument,\n GetRetrievalProfileDocument,\n ListRetrievalProfilesDocument,\n UpdateRetrievalProfileDocument,\n type CreateRetrievalProfileMutation,\n type DeleteRetrievalProfileMutation,\n type GetRetrievalProfileQuery,\n type ListRetrievalProfilesQuery,\n type UpdateRetrievalProfileMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateRetrievalProfileInput,\n UpdateRetrievalProfileInput,\n} from '../../generated/wspace-types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 100;\n\nexport interface RetrievalProfileRecord {\n id: string;\n name: string;\n status: string;\n visibility: string;\n strategyMode: string;\n topK: number;\n snippetMaxChars: number;\n minSources: number;\n citationsRequired: boolean;\n showSources: boolean;\n noAnswerIfBelowThreshold: boolean;\n multiHop: string;\n queryRewrite: string;\n reranker: string;\n description?: string | null;\n bucketId?: string | null;\n citationFormat?: string | null;\n hybridWeights?: Record<string, unknown> | null;\n minRelevanceScore?: number | null;\n multiHopDepth?: number | null;\n rerankerModelPolicyId?: string | null;\n testQueries?: Record<string, unknown> | null;\n metadata?: Record<string, unknown> | null;\n revision: number;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\nexport interface RetrievalProfileFilterVariables {\n search?: string;\n status?: string;\n strategyMode?: string;\n bucketId?: string;\n}\n\n/**\n * `CreateRetrievalProfileInput` minus the `workspaceId` the hook supplies.\n * The service's input is FLAT — there is no nested `strategy`/`grounding`/\n * `thresholds` object anywhere in the schema.\n */\nexport type CreateRetrievalProfileVariables = Omit<\n GraphQLInput<CreateRetrievalProfileInput>,\n 'workspaceId'\n>;\n\nexport interface UpdateRetrievalProfileVariables {\n profileId: string;\n input: GraphQLInput<UpdateRetrievalProfileInput>;\n}\n\nconst CREATE_PROFILE_FIELDS = fieldsOf<CreateRetrievalProfileInput>({\n bucketId: true,\n citationFormat: true,\n citationsRequired: true,\n description: true,\n hybridWeights: true,\n metadata: true,\n minRelevanceScore: true,\n minSources: true,\n multiHop: true,\n multiHopDepth: true,\n name: true,\n noAnswerIfBelowThreshold: true,\n queryRewrite: true,\n reranker: true,\n rerankerModelPolicyId: true,\n showSources: true,\n snippetMaxChars: true,\n status: true,\n strategyMode: true,\n tags: true,\n testQueries: true,\n topK: true,\n visibility: true,\n workspaceId: true,\n});\n\nconst UPDATE_PROFILE_FIELDS = fieldsOf<UpdateRetrievalProfileInput>({\n bucketId: true,\n citationFormat: true,\n citationsRequired: true,\n description: true,\n hybridWeights: true,\n metadata: true,\n minRelevanceScore: true,\n minSources: true,\n multiHop: true,\n multiHopDepth: true,\n name: true,\n noAnswerIfBelowThreshold: true,\n queryRewrite: true,\n reranker: true,\n rerankerModelPolicyId: true,\n showSources: true,\n snippetMaxChars: true,\n status: true,\n strategyMode: true,\n tags: true,\n testQueries: true,\n topK: true,\n visibility: true,\n});\n\nconst NO_PROFILES: RetrievalProfileRecord[] = [];\n\nfunction selectProfiles(data: ListRetrievalProfilesQuery | undefined): RetrievalProfileRecord[] {\n return data?.listRetrievalProfiles ?? NO_PROFILES;\n}\n\nexport const retrievalProfileKeys = {\n all: ['retrieval-profiles'] as const,\n lists: () => [...retrievalProfileKeys.all, 'list'] as const,\n list: (filter?: RetrievalProfileFilterVariables) =>\n [...retrievalProfileKeys.lists(), filter] as const,\n details: () => [...retrievalProfileKeys.all, 'detail'] as const,\n detail: (id: string) => [...retrievalProfileKeys.details(), id] as const,\n};\n\nexport function useRetrievalProfiles(\n filter?: RetrievalProfileFilterVariables\n): QueryResult<RetrievalProfileRecord[]> {\n const workspaceId = useWorkspaceId();\n const { search, status, strategyMode, bucketId } = filter ?? {};\n\n const variables = useMemo(\n () => ({\n filters: {\n workspaceId,\n search: search || undefined,\n status,\n strategyMode,\n bucketId,\n },\n pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [workspaceId, search, status, strategyMode, bucketId]\n );\n\n return useWorkspaceQuery<ListRetrievalProfilesQuery, RetrievalProfileRecord[]>({\n document: ListRetrievalProfilesDocument,\n variables,\n select: selectProfiles,\n fallback: NO_PROFILES,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load retrieval profiles',\n });\n}\n\nexport function useRetrievalProfile(\n profileId: string | undefined\n): QueryResult<RetrievalProfileRecord | null> {\n const variables = useMemo(() => ({ id: profileId ?? '' }), [profileId]);\n\n return useWorkspaceQuery<GetRetrievalProfileQuery, RetrievalProfileRecord | null>({\n document: GetRetrievalProfileDocument,\n variables,\n select: (data) => data?.getRetrievalProfile ?? null,\n fallback: null,\n enabled: Boolean(profileId),\n errorMessage: 'Failed to load retrieval profile',\n });\n}\n\nexport function useCreateRetrievalProfile() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreateRetrievalProfileVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_PROFILE_FIELDS),\n }),\n [workspaceId]\n );\n\n const [create, state] = useWorkspaceMutation<\n CreateRetrievalProfileMutation,\n CreateRetrievalProfileVariables,\n RetrievalProfileRecord\n >({\n document: CreateRetrievalProfileDocument,\n variables,\n select: (data) => data?.createRetrievalProfile,\n errorMessage: 'Failed to create retrieval profile',\n });\n\n return { create, loading: state.loading, error: state.error };\n}\n\nexport function useUpdateRetrievalProfile() {\n const [update, state] = useWorkspaceMutation<\n UpdateRetrievalProfileMutation,\n UpdateRetrievalProfileVariables,\n RetrievalProfileRecord\n >({\n document: UpdateRetrievalProfileDocument,\n variables: ({ profileId, input }) => ({\n id: profileId,\n input: buildMutationInput(input, UPDATE_PROFILE_FIELDS),\n }),\n select: (data) => data?.updateRetrievalProfile,\n errorMessage: 'Failed to update retrieval profile',\n });\n\n return { update, loading: state.loading, error: state.error };\n}\n\nexport function useDeleteRetrievalProfile() {\n const [remove, state] = useWorkspaceMutation<DeleteRetrievalProfileMutation, string, boolean>({\n document: DeleteRetrievalProfileDocument,\n variables: (profileId) => ({ id: profileId }),\n select: (data) => data?.deleteRetrievalProfile,\n errorMessage: 'Failed to delete retrieval profile',\n });\n\n return { remove, loading: state.loading, error: state.error };\n}\n"],"mappings":";;;;;AAiCA,IAAMA,IAAa,KAyDbC,IAAwBC,EAAsC;CAClE,UAAU;CACV,gBAAgB;CAChB,mBAAmB;CACnB,aAAa;CACb,eAAe;CACf,UAAU;CACV,mBAAmB;CACnB,YAAY;CACZ,UAAU;CACV,eAAe;CACf,MAAM;CACN,0BAA0B;CAC1B,cAAc;CACd,UAAU;CACV,uBAAuB;CACvB,aAAa;CACb,iBAAiB;CACjB,QAAQ;CACR,cAAc;CACd,MAAM;CACN,aAAa;CACb,MAAM;CACN,YAAY;CACZ,aAAa;AACf,CAAC,GAEKC,IAAwBD,EAAsC;CAClE,UAAU;CACV,gBAAgB;CAChB,mBAAmB;CACnB,aAAa;CACb,eAAe;CACf,UAAU;CACV,mBAAmB;CACnB,YAAY;CACZ,UAAU;CACV,eAAe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