@burdenoff/microfe-botmanor 2026.1127.1 → 2026.1127.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/botlit/BotlitRoutes.js +31 -24
  2. package/dist/botlit/BotlitRoutes.js.map +1 -1
  3. package/dist/botlit/BotmanorRootInner.js +45 -44
  4. package/dist/botlit/BotmanorRootInner.js.map +1 -1
  5. package/dist/botlit/components/AgentA2APanel.js +63 -62
  6. package/dist/botlit/components/AgentA2APanel.js.map +1 -1
  7. package/dist/botlit/components/AgentBindingsPanel.js +125 -124
  8. package/dist/botlit/components/AgentBindingsPanel.js.map +1 -1
  9. package/dist/botlit/components/AgentFallbackModelsPicker.js +56 -55
  10. package/dist/botlit/components/AgentFallbackModelsPicker.js.map +1 -1
  11. package/dist/botlit/components/AiOperationsPanel.js.map +1 -1
  12. package/dist/botlit/components/AssistantChannelPanel.js +40 -39
  13. package/dist/botlit/components/AssistantChannelPanel.js.map +1 -1
  14. package/dist/botlit/components/AssistantRuntimeSetupPanel.js +36 -35
  15. package/dist/botlit/components/AssistantRuntimeSetupPanel.js.map +1 -1
  16. package/dist/botlit/components/BotAgentsPanel.js +104 -103
  17. package/dist/botlit/components/BotAgentsPanel.js.map +1 -1
  18. package/dist/botlit/components/BotFormFields.js +118 -117
  19. package/dist/botlit/components/BotFormFields.js.map +1 -1
  20. package/dist/botlit/components/BucketDialogs.js +110 -110
  21. package/dist/botlit/components/BucketDialogs.js.map +1 -1
  22. package/dist/botlit/components/ChannelRoutesPanel.js +29 -28
  23. package/dist/botlit/components/ChannelRoutesPanel.js.map +1 -1
  24. package/dist/botlit/components/CreateChannelRouteDialog.js +105 -105
  25. package/dist/botlit/components/CreateChannelRouteDialog.js.map +1 -1
  26. package/dist/botlit/components/DescribeBotDialog.js +86 -86
  27. package/dist/botlit/components/DescribeBotDialog.js.map +1 -1
  28. package/dist/botlit/components/EmptyState.d.ts +8 -0
  29. package/dist/botlit/components/EmptyState.js +43 -30
  30. package/dist/botlit/components/EmptyState.js.map +1 -1
  31. package/dist/botlit/components/HandoffConfigPanel.js +125 -124
  32. package/dist/botlit/components/HandoffConfigPanel.js.map +1 -1
  33. package/dist/botlit/components/HandoffTargetPickers.js +42 -41
  34. package/dist/botlit/components/HandoffTargetPickers.js.map +1 -1
  35. package/dist/botlit/components/KnowledgeBackendMigrationPanel.js +106 -105
  36. package/dist/botlit/components/KnowledgeBackendMigrationPanel.js.map +1 -1
  37. package/dist/botlit/components/KnowledgeRetrievalTestPanel.js +76 -75
  38. package/dist/botlit/components/KnowledgeRetrievalTestPanel.js.map +1 -1
  39. package/dist/botlit/components/KnowledgeSourceImportPanel.js +76 -75
  40. package/dist/botlit/components/KnowledgeSourceImportPanel.js.map +1 -1
  41. package/dist/botlit/components/ModelRegistrationPanel.js +70 -69
  42. package/dist/botlit/components/ModelRegistrationPanel.js.map +1 -1
  43. package/dist/botlit/components/StorePackageDraftCard.js +87 -86
  44. package/dist/botlit/components/StorePackageDraftCard.js.map +1 -1
  45. package/dist/botlit/components/SuggestionsPanel.js.map +1 -1
  46. package/dist/botlit/hooks/useLLMProviders.d.ts +1 -1
  47. package/dist/botlit/hooks/useLLMProviders.js.map +1 -1
  48. package/dist/botlit/hooks/useMCPServers.d.ts +1 -1
  49. package/dist/botlit/hooks/useMCPServers.js.map +1 -1
  50. package/dist/botlit/pages/A2AAgentDetailPage.js +263 -262
  51. package/dist/botlit/pages/A2AAgentDetailPage.js.map +1 -1
  52. package/dist/botlit/pages/A2ARegistryPage.js +47 -46
  53. package/dist/botlit/pages/A2ARegistryPage.js.map +1 -1
  54. package/dist/botlit/pages/AgentBuilderPage.js +426 -425
  55. package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
  56. package/dist/botlit/pages/AgentDetailPage.js +1 -0
  57. package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
  58. package/dist/botlit/pages/AgentsListPage.js +248 -247
  59. package/dist/botlit/pages/AgentsListPage.js.map +1 -1
  60. package/dist/botlit/pages/BotChannelsTab.js +324 -310
  61. package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
  62. package/dist/botlit/pages/BotDetailPage.js +1 -0
  63. package/dist/botlit/pages/BotDetailPage.js.map +1 -1
  64. package/dist/botlit/pages/BotWorkflowTab.js +126 -121
  65. package/dist/botlit/pages/BotWorkflowTab.js.map +1 -1
  66. package/dist/botlit/pages/BotsListPage.js +1 -0
  67. package/dist/botlit/pages/BotsListPage.js.map +1 -1
  68. package/dist/botlit/pages/BucketDetailPage.js +1 -0
  69. package/dist/botlit/pages/BucketDetailPage.js.map +1 -1
  70. package/dist/botlit/pages/BucketsPage.js +1 -0
  71. package/dist/botlit/pages/BucketsPage.js.map +1 -1
  72. package/dist/botlit/pages/ChannelDetailPage.js +267 -266
  73. package/dist/botlit/pages/ChannelDetailPage.js.map +1 -1
  74. package/dist/botlit/pages/ChannelsPage.js +187 -186
  75. package/dist/botlit/pages/ChannelsPage.js.map +1 -1
  76. package/dist/botlit/pages/ChatPage.js +69 -68
  77. package/dist/botlit/pages/ChatPage.js.map +1 -1
  78. package/dist/botlit/pages/ExecutionDetailPage.js +1 -0
  79. package/dist/botlit/pages/ExecutionDetailPage.js.map +1 -1
  80. package/dist/botlit/pages/ExecutionsPage.js +191 -191
  81. package/dist/botlit/pages/ExecutionsPage.js.map +1 -1
  82. package/dist/botlit/pages/HandoffsPage.js +65 -64
  83. package/dist/botlit/pages/HandoffsPage.js.map +1 -1
  84. package/dist/botlit/pages/InstalledPackagesPage.js +146 -145
  85. package/dist/botlit/pages/InstalledPackagesPage.js.map +1 -1
  86. package/dist/botlit/pages/KnowledgeBaseDetailPage.js +235 -234
  87. package/dist/botlit/pages/KnowledgeBaseDetailPage.js.map +1 -1
  88. package/dist/botlit/pages/KnowledgeBasesPage.js +152 -151
  89. package/dist/botlit/pages/KnowledgeBasesPage.js.map +1 -1
  90. package/dist/botlit/pages/MCPServerDetailPage.js +183 -182
  91. package/dist/botlit/pages/MCPServerDetailPage.js.map +1 -1
  92. package/dist/botlit/pages/MCPServersPage.js +145 -145
  93. package/dist/botlit/pages/MCPServersPage.js.map +1 -1
  94. package/dist/botlit/pages/PoliciesPage.js.map +1 -1
  95. package/dist/botlit/pages/PolicyDetailPage.js +293 -292
  96. package/dist/botlit/pages/PolicyDetailPage.js.map +1 -1
  97. package/dist/botlit/pages/PromptStudioPage.js +229 -229
  98. package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
  99. package/dist/botlit/pages/PromptTemplateDetailPage.js +280 -279
  100. package/dist/botlit/pages/PromptTemplateDetailPage.js.map +1 -1
  101. package/dist/botlit/pages/PromptTemplatesPage.js +31 -30
  102. package/dist/botlit/pages/PromptTemplatesPage.js.map +1 -1
  103. package/dist/botlit/pages/RetrievalProfileDetailPage.js +204 -203
  104. package/dist/botlit/pages/RetrievalProfileDetailPage.js.map +1 -1
  105. package/dist/botlit/pages/RetrievalProfilesPage.js.map +1 -1
  106. package/dist/botlit/pages/SettingsPage.js +153 -153
  107. package/dist/botlit/pages/SettingsPage.js.map +1 -1
  108. package/dist/botlit/pages/SkillDetailPage.js +305 -304
  109. package/dist/botlit/pages/SkillDetailPage.js.map +1 -1
  110. package/dist/botlit/pages/SkillsPage.js.map +1 -1
  111. package/dist/botlit/pages/StorePackageDetailPage.js +1 -0
  112. package/dist/botlit/pages/StorePackageDetailPage.js.map +1 -1
  113. package/dist/botlit/pages/StorePage.js +173 -173
  114. package/dist/botlit/pages/StorePage.js.map +1 -1
  115. package/dist/botlit/permissions/PermissionRequired.d.ts +2 -0
  116. package/dist/botlit/permissions/PermissionRequired.js +6 -6
  117. package/dist/botlit/permissions/PermissionRequired.js.map +1 -1
  118. package/dist/botlit/permissions/botmanorPermissions.d.ts +1 -0
  119. package/dist/botlit/permissions/botmanorPermissions.js +1 -0
  120. package/dist/botlit/permissions/botmanorPermissions.js.map +1 -1
  121. package/dist/botlit/utils/confirmAction.d.ts +13 -11
  122. package/dist/botlit/utils/confirmAction.js +26 -4
  123. package/dist/botlit/utils/confirmAction.js.map +1 -1
  124. package/dist/generated/wspace-operations.d.ts +6 -6
  125. package/dist/generated/wspace-operations.js +6 -6
  126. package/dist/generated/wspace-operations.js.map +1 -1
  127. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"useLLMProviders.js","names":["LIST_LIMIT","NO_PROVIDERS","NO_MODELS","CREATE_PROVIDER_FIELDS","fieldsOf","UPDATE_PROVIDER_FIELDS","useLLMList","client","useWorkspaceClient","useBotlit","query","useQuery","workspaceId","currentUser","kind","providerId","records","offset","result","document","page","select","fallback","useLLMProviders","ListBotmanorLlmProvidersDocument","data","useLLMModels","ListBotmanorLlmModelsDocument","filters","useConfigureLLMProvider","useWorkspaceId","create","createState","useWorkspaceMutation","CreateBotmanorLlmProviderDocument","buildMutationInput","input","update","updateState","UpdateBotmanorLlmProviderDocument","useCallback","existingId","useTestLLMConnection","TestLlmConnectionDocument","useCreateLLMModel","createModel","state","CreateBotmanorLlmModelDocument"],"sources":["../../../src/botlit/hooks/useLLMProviders.ts"],"sourcesContent":["/**\n * LLM Providers Hooks\n * @module botlit/hooks\n *\n * These go through the shell's workspace gateway client like every other BotManor\n * hook. They deliberately do NOT use the generated `useQuery`/`useMutation`\n * wrappers: `BotmanorRoot` only mounts an `<ApolloProvider>` in standalone mode,\n * so an Apollo React hook throws \"Could not find client in the context\" the\n * moment the MFE is mounted by an app shell — which is every production route.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport type { DocumentNode } from 'graphql';\nimport { useQuery } from '@tanstack/react-query';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport {\n CreateBotmanorLlmProviderDocument,\n CreateBotmanorLlmModelDocument,\n DeleteLlmProviderDocument,\n GetBotmanorLlmProviderDocument,\n ListBotmanorLlmModelsDocument,\n ListBotmanorLlmProvidersDocument,\n TestLlmConnectionDocument,\n UpdateBotmanorLlmProviderDocument,\n type CreateBotmanorLlmProviderMutation,\n type CreateBotmanorLlmModelMutation,\n type DeleteLlmProviderMutation,\n type GetBotmanorLlmProviderQuery,\n type ListBotmanorLlmModelsQuery,\n type ListBotmanorLlmProvidersQuery,\n type TestLlmConnectionMutation,\n type UpdateBotmanorLlmProviderMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateBotmanorLlmModelInput,\n CreateBotmanorLlmProviderInput,\n UpdateBotmanorLlmProviderInput,\n} from '../../generated/wspace-types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceClient,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 50;\n\nexport interface LLMProviderRecord {\n id: string;\n name: string;\n type: string;\n isActive: boolean;\n apiEndpoint?: string | null;\n credentialsHash?: string | null;\n connectionId?: string | null;\n metadata?: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n workspaceId: string;\n}\n\nexport interface LLMModelRecord {\n id: string;\n name: string;\n modelId: string;\n providerId: string;\n contextWindow: number;\n maxOutputTokens: number;\n inputPricePerMToken: number;\n outputPricePerMToken: number;\n isActive: boolean;\n supportsStreaming: boolean;\n supportsFunctionCalling: boolean;\n supportsVision: boolean;\n metadata?: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** `CreateBotmanorLLMProviderInput` minus the `workspaceId` the hook supplies. */\nexport type ConfigureLLMProviderVariables = Omit<\n GraphQLInput<CreateBotmanorLlmProviderInput>,\n 'workspaceId'\n> & { isActive?: boolean };\n\nconst NO_PROVIDERS: LLMProviderRecord[] = [];\nconst NO_MODELS: LLMModelRecord[] = [];\n\nconst CREATE_PROVIDER_FIELDS = fieldsOf<CreateBotmanorLlmProviderInput>({\n apiEndpoint: true,\n connectionId: true,\n credentials: true,\n metadata: true,\n name: true,\n type: true,\n workspaceId: true,\n});\n\nconst UPDATE_PROVIDER_FIELDS = fieldsOf<UpdateBotmanorLlmProviderInput>({\n apiEndpoint: true,\n clearCredentials: true,\n connectionId: true,\n credentials: true,\n isActive: true,\n metadata: true,\n name: true,\n});\n\nexport const llmProviderKeys = {\n all: ['llmProviders'] as const,\n lists: () => [...llmProviderKeys.all, 'list'] as const,\n details: () => [...llmProviderKeys.all, 'detail'] as const,\n detail: (id: string) => [...llmProviderKeys.details(), id] as const,\n};\n\nfunction useLLMList<TData, TRecord>(\n document: DocumentNode,\n kind: string,\n select: (data: TData | undefined) => TRecord[],\n fallback: TRecord[],\n providerId?: string\n): QueryResult<TRecord[]> {\n const client = useWorkspaceClient();\n const { workspaceId, currentUser } = useBotlit();\n const query = useQuery({\n queryKey: ['botmanor-llm-catalog', workspaceId, currentUser?.id, kind, providerId],\n enabled: Boolean(workspaceId),\n retry: false,\n queryFn: async () => {\n const records: TRecord[] = [];\n for (let offset = 0; offset < 10000; offset += LIST_LIMIT) {\n const result = await client.query<TData>({\n query: document,\n fetchPolicy: 'network-only',\n variables: {\n filters: providerId ? { providerId } : undefined,\n pagination: { limit: LIST_LIMIT, offset },\n },\n });\n if (!result.data) throw new Error('Model catalog unavailable');\n const page = select(result.data);\n if (!Array.isArray(page) || page.length > LIST_LIMIT)\n throw new Error('Model catalog unavailable');\n records.push(...page);\n if (page.length < LIST_LIMIT) return records;\n }\n throw new Error('Model catalog exceeds the supported limit');\n },\n });\n return {\n data: query.data ?? fallback,\n loading: query.isFetching,\n error: query.error ?? undefined,\n refetch: async () => {\n await query.refetch();\n },\n };\n}\n\nexport function useLLMProviders(): QueryResult<LLMProviderRecord[]> {\n return useLLMList<ListBotmanorLlmProvidersQuery, LLMProviderRecord>(\n ListBotmanorLlmProvidersDocument,\n 'providers',\n (data) => data?.listBotmanorLLMProviders ?? NO_PROVIDERS,\n NO_PROVIDERS\n );\n}\n\nexport function useLLMProvider(\n providerId: string | undefined\n): QueryResult<LLMProviderRecord | null> {\n const variables = useMemo(() => ({ id: providerId ?? '' }), [providerId]);\n\n return useWorkspaceQuery<GetBotmanorLlmProviderQuery, LLMProviderRecord | null>({\n document: GetBotmanorLlmProviderDocument,\n variables,\n select: (data) => data?.getBotmanorLLMProvider ?? null,\n fallback: null,\n enabled: Boolean(providerId),\n errorMessage: 'Failed to load LLM provider',\n });\n}\n\nexport function useLLMModels(filters?: { providerId?: string }): QueryResult<LLMModelRecord[]> {\n return useLLMList<ListBotmanorLlmModelsQuery, LLMModelRecord>(\n ListBotmanorLlmModelsDocument,\n 'models',\n (data) => data?.listBotmanorLLMModels ?? NO_MODELS,\n NO_MODELS,\n filters?.providerId\n );\n}\n\n/**\n * Creates a provider, or updates the one whose id the caller passes.\n * `UpdateBotmanorLLMProviderInput` has no `type`/`workspaceId`, so the update\n * payload is projected onto the fields that input actually declares.\n */\nexport function useConfigureLLMProvider() {\n const workspaceId = useWorkspaceId();\n\n const [create, createState] = useWorkspaceMutation<\n CreateBotmanorLlmProviderMutation,\n ConfigureLLMProviderVariables,\n LLMProviderRecord\n >({\n document: CreateBotmanorLlmProviderDocument,\n variables: (input) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_PROVIDER_FIELDS),\n }),\n select: (data) => data?.createBotmanorLLMProvider,\n errorMessage: 'Failed to create the LLM provider',\n });\n\n const [update, updateState] = useWorkspaceMutation<\n UpdateBotmanorLlmProviderMutation,\n { providerId: string; input: ConfigureLLMProviderVariables },\n LLMProviderRecord\n >({\n document: UpdateBotmanorLlmProviderDocument,\n variables: ({ providerId, input }) => ({\n id: providerId,\n input: buildMutationInput(input, UPDATE_PROVIDER_FIELDS),\n }),\n select: (data) => data?.updateBotmanorLLMProvider,\n errorMessage: 'Failed to update the LLM provider',\n });\n\n const configureProvider = useCallback(\n async (input: ConfigureLLMProviderVariables, existingId?: string) =>\n existingId ? update({ providerId: existingId, input }) : create(input),\n [create, update]\n );\n\n return {\n configureProvider,\n isConfiguring: createState.loading || updateState.loading,\n error: createState.error ?? updateState.error,\n };\n}\n\nexport function useDeleteLLMProvider() {\n return useWorkspaceMutation<DeleteLlmProviderMutation, string, boolean>({\n document: DeleteLlmProviderDocument,\n variables: (providerId) => ({ id: providerId }),\n select: (data) => data?.deleteLLMProvider,\n errorMessage: 'Failed to delete the LLM provider',\n });\n}\n\nexport function useTestLLMConnection() {\n return useWorkspaceMutation<TestLlmConnectionMutation, string, boolean>({\n document: TestLlmConnectionDocument,\n variables: (providerId) => ({ id: providerId }),\n select: (data) => data?.testLlmConnection,\n errorMessage: 'Failed to test the LLM connection',\n });\n}\n\n/** Register models through the same authenticated workspace gateway as providers. */\nexport function useCreateLLMModel() {\n const [createModel, state] = useWorkspaceMutation<\n CreateBotmanorLlmModelMutation,\n CreateBotmanorLlmModelInput,\n LLMModelRecord\n >({\n document: CreateBotmanorLlmModelDocument,\n variables: (input) => ({\n input: buildMutationInput(\n input,\n fieldsOf<CreateBotmanorLlmModelInput>({\n providerId: true,\n name: true,\n modelId: true,\n contextWindow: true,\n maxOutputTokens: true,\n inputPricePerMToken: true,\n outputPricePerMToken: true,\n supportsStreaming: true,\n supportsFunctionCalling: true,\n supportsVision: true,\n metadata: true,\n })\n ),\n }),\n select: (data) => data?.createBotmanorLLMModel,\n errorMessage: 'Failed to register the model',\n });\n return { createModel, isCreating: state.loading, error: state.error };\n}\n"],"mappings":";;;;;;;AA+CA,IAAMA,IAAa,IAwCbC,IAAoC,CAAC,GACrCC,IAA8B,CAAC,GAE/BC,IAAyBC,EAAyC;CACtE,aAAa;CACb,cAAc;CACd,aAAa;CACb,UAAU;CACV,MAAM;CACN,MAAM;CACN,aAAa;AACf,CAAC,GAEKC,IAAyBD,EAAyC;CACtE,aAAa;CACb,kBAAkB;CAClB,cAAc;CACd,aAAa;CACb,UAAU;CACV,UAAU;CACV,MAAM;AACR,CAAC;AASD,SAASE,EACP,GACA,GACA,GACA,GACA,GACwB;CACxB,IAAMC,IAASC,EAAmB,GAC5B,EAAE,gBAAa,mBAAgBC,EAAU,GACzCC,IAAQC,EAAS;EACrB,UAAU;GAAC;GAAwBC;GAAaC,GAAa;GAA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L,EAI5B;EACA,UAAUM;EACV,YAAY,EAAE,eAAY,gBAAa;GACrC,IAAIxB;GACJ,OAAOoB,EAAmBC,GAAO/B,CAAsB;EACzD;EACA,SAAS,MAASoB,GAAM;EACxB,cAAc;CAChB,CAAC;CAQD,OAAO;EACL,mBAPwBe,EACxB,OAAO,GAAsC,MAC3CC,IAAaJ,EAAO;GAAE,YAAYI;GAAY;EAAM,CAAC,IAAIV,EAAOK,CAAK,GACvE,CAACL,GAAQM,CAAM,CAIf;EACA,eAAeL,EAAY,WAAWM,EAAY;EAClD,OAAON,EAAY,SAASM,EAAY;CAC1C;AACF;AAWA,SAAgBI,IAAuB;CACrC,OAAOT,EAAiE;EACtE,UAAUU;EACV,YAAY,OAAgB,EAAE,IAAI5B,EAAW;EAC7C,SAAS,MAASU,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAGA,SAAgBmB,IAAoB;CAClC,IAAM,CAACC,GAAaC,KAASb,EAI3B;EACA,UAAUc;EACV,YAAY,OAAW,EACrB,OAAOZ,EACLC,GACAhC,EAAsC;GACpC,YAAY;GACZ,MAAM;GACN,SAAS;GACT,eAAe;GACf,iBAAiB;GACjB,qBAAqB;GACrB,sBAAsB;GACtB,mBAAmB;GACnB,yBAAyB;GACzB,gBAAgB;GAChB,UAAU;EACZ,CAAC,CACH,EACF;EACA,SAAS,MAASqB,GAAM;EACxB,cAAc;CAChB,CAAC;CACD,OAAO;EAAE;EAAa,YAAYqB,EAAM;EAAS,OAAOA,EAAM;CAAM;AACtE"}
1
+ {"version":3,"file":"useLLMProviders.js","names":["LIST_LIMIT","NO_PROVIDERS","NO_MODELS","CREATE_PROVIDER_FIELDS","fieldsOf","UPDATE_PROVIDER_FIELDS","useLLMList","client","useWorkspaceClient","useBotlit","query","useQuery","workspaceId","currentUser","kind","providerId","records","offset","result","document","page","select","fallback","useLLMProviders","ListBotmanorLlmProvidersDocument","data","useLLMModels","ListBotmanorLlmModelsDocument","filters","useConfigureLLMProvider","useWorkspaceId","create","createState","useWorkspaceMutation","CreateBotmanorLlmProviderDocument","buildMutationInput","input","update","updateState","UpdateBotmanorLlmProviderDocument","useCallback","existingId","useTestLLMConnection","TestLlmConnectionDocument","useCreateLLMModel","createModel","state","CreateBotmanorLlmModelDocument"],"sources":["../../../src/botlit/hooks/useLLMProviders.ts"],"sourcesContent":["/**\n * LLM Providers Hooks\n * @module botlit/hooks\n *\n * These go through the shell's workspace gateway client like every other BotManor\n * hook. They deliberately do NOT use the generated `useQuery`/`useMutation`\n * wrappers: `BotmanorRoot` only mounts an `<ApolloProvider>` in standalone mode,\n * so an Apollo React hook throws \"Could not find client in the context\" the\n * moment the MFE is mounted by an app shell — which is every production route.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport type { DocumentNode } from 'graphql';\nimport { useQuery } from '@tanstack/react-query';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport {\n CreateBotmanorLlmProviderDocument,\n CreateBotmanorLlmModelDocument,\n DeleteLlmProviderDocument,\n GetBotmanorLlmProviderDocument,\n ListBotmanorLlmModelsDocument,\n ListBotmanorLlmProvidersDocument,\n TestLlmConnectionDocument,\n UpdateBotmanorLlmProviderDocument,\n type CreateBotmanorLlmProviderMutation,\n type CreateBotmanorLlmModelMutation,\n type DeleteLlmProviderMutation,\n type GetBotmanorLlmProviderQuery,\n type ListBotmanorLlmModelsQuery,\n type ListBotmanorLlmProvidersQuery,\n type TestLlmConnectionMutation,\n type UpdateBotmanorLlmProviderMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateBotmanorLlmModelInput,\n CreateBotmanorLlmProviderInput,\n UpdateBotmanorLlmProviderInput,\n} from '../../generated/wspace-types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceClient,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 50;\n\nexport interface LLMProviderRecord {\n id: string;\n name: string;\n type: string;\n isActive: boolean;\n apiEndpoint?: string | null;\n hasStoredCredentials?: boolean;\n connectionId?: string | null;\n metadata?: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n workspaceId: string;\n}\n\nexport interface LLMModelRecord {\n id: string;\n name: string;\n modelId: string;\n providerId: string;\n contextWindow: number;\n maxOutputTokens: number;\n inputPricePerMToken: number;\n outputPricePerMToken: number;\n isActive: boolean;\n supportsStreaming: boolean;\n supportsFunctionCalling: boolean;\n supportsVision: boolean;\n metadata?: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** `CreateBotmanorLLMProviderInput` minus the `workspaceId` the hook supplies. */\nexport type ConfigureLLMProviderVariables = Omit<\n GraphQLInput<CreateBotmanorLlmProviderInput>,\n 'workspaceId'\n> & { isActive?: boolean };\n\nconst NO_PROVIDERS: LLMProviderRecord[] = [];\nconst NO_MODELS: LLMModelRecord[] = [];\n\nconst CREATE_PROVIDER_FIELDS = fieldsOf<CreateBotmanorLlmProviderInput>({\n apiEndpoint: true,\n connectionId: true,\n credentials: true,\n metadata: true,\n name: true,\n type: true,\n workspaceId: true,\n});\n\nconst UPDATE_PROVIDER_FIELDS = fieldsOf<UpdateBotmanorLlmProviderInput>({\n apiEndpoint: true,\n clearCredentials: true,\n connectionId: true,\n credentials: true,\n isActive: true,\n metadata: true,\n name: true,\n});\n\nexport const llmProviderKeys = {\n all: ['llmProviders'] as const,\n lists: () => [...llmProviderKeys.all, 'list'] as const,\n details: () => [...llmProviderKeys.all, 'detail'] as const,\n detail: (id: string) => [...llmProviderKeys.details(), id] as const,\n};\n\nfunction useLLMList<TData, TRecord>(\n document: DocumentNode,\n kind: string,\n select: (data: TData | undefined) => TRecord[],\n fallback: TRecord[],\n providerId?: string\n): QueryResult<TRecord[]> {\n const client = useWorkspaceClient();\n const { workspaceId, currentUser } = useBotlit();\n const query = useQuery({\n queryKey: ['botmanor-llm-catalog', workspaceId, currentUser?.id, kind, providerId],\n enabled: Boolean(workspaceId),\n retry: false,\n queryFn: async () => {\n const records: TRecord[] = [];\n for (let offset = 0; offset < 10000; offset += LIST_LIMIT) {\n const result = await client.query<TData>({\n query: document,\n fetchPolicy: 'network-only',\n variables: {\n filters: providerId ? { providerId } : undefined,\n pagination: { limit: LIST_LIMIT, offset },\n },\n });\n if (!result.data) throw new Error('Model catalog unavailable');\n const page = select(result.data);\n if (!Array.isArray(page) || page.length > LIST_LIMIT)\n throw new Error('Model catalog unavailable');\n records.push(...page);\n if (page.length < LIST_LIMIT) return records;\n }\n throw new Error('Model catalog exceeds the supported limit');\n },\n });\n return {\n data: query.data ?? fallback,\n loading: query.isFetching,\n error: query.error ?? undefined,\n refetch: async () => {\n await query.refetch();\n },\n };\n}\n\nexport function useLLMProviders(): QueryResult<LLMProviderRecord[]> {\n return useLLMList<ListBotmanorLlmProvidersQuery, LLMProviderRecord>(\n ListBotmanorLlmProvidersDocument,\n 'providers',\n (data) => data?.listBotmanorLLMProviders ?? NO_PROVIDERS,\n NO_PROVIDERS\n );\n}\n\nexport function useLLMProvider(\n providerId: string | undefined\n): QueryResult<LLMProviderRecord | null> {\n const variables = useMemo(() => ({ id: providerId ?? '' }), [providerId]);\n\n return useWorkspaceQuery<GetBotmanorLlmProviderQuery, LLMProviderRecord | null>({\n document: GetBotmanorLlmProviderDocument,\n variables,\n select: (data) => data?.getBotmanorLLMProvider ?? null,\n fallback: null,\n enabled: Boolean(providerId),\n errorMessage: 'Failed to load LLM provider',\n });\n}\n\nexport function useLLMModels(filters?: { providerId?: string }): QueryResult<LLMModelRecord[]> {\n return useLLMList<ListBotmanorLlmModelsQuery, LLMModelRecord>(\n ListBotmanorLlmModelsDocument,\n 'models',\n (data) => data?.listBotmanorLLMModels ?? NO_MODELS,\n NO_MODELS,\n filters?.providerId\n );\n}\n\n/**\n * Creates a provider, or updates the one whose id the caller passes.\n * `UpdateBotmanorLLMProviderInput` has no `type`/`workspaceId`, so the update\n * payload is projected onto the fields that input actually declares.\n */\nexport function useConfigureLLMProvider() {\n const workspaceId = useWorkspaceId();\n\n const [create, createState] = useWorkspaceMutation<\n CreateBotmanorLlmProviderMutation,\n ConfigureLLMProviderVariables,\n LLMProviderRecord\n >({\n document: CreateBotmanorLlmProviderDocument,\n variables: (input) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_PROVIDER_FIELDS),\n }),\n select: (data) => data?.createBotmanorLLMProvider,\n errorMessage: 'Failed to create the LLM provider',\n });\n\n const [update, updateState] = useWorkspaceMutation<\n UpdateBotmanorLlmProviderMutation,\n { providerId: string; input: ConfigureLLMProviderVariables },\n LLMProviderRecord\n >({\n document: UpdateBotmanorLlmProviderDocument,\n variables: ({ providerId, input }) => ({\n id: providerId,\n input: buildMutationInput(input, UPDATE_PROVIDER_FIELDS),\n }),\n select: (data) => data?.updateBotmanorLLMProvider,\n errorMessage: 'Failed to update the LLM provider',\n });\n\n const configureProvider = useCallback(\n async (input: ConfigureLLMProviderVariables, existingId?: string) =>\n existingId ? update({ providerId: existingId, input }) : create(input),\n [create, update]\n );\n\n return {\n configureProvider,\n isConfiguring: createState.loading || updateState.loading,\n error: createState.error ?? updateState.error,\n };\n}\n\nexport function useDeleteLLMProvider() {\n return useWorkspaceMutation<DeleteLlmProviderMutation, string, boolean>({\n document: DeleteLlmProviderDocument,\n variables: (providerId) => ({ id: providerId }),\n select: (data) => data?.deleteLLMProvider,\n errorMessage: 'Failed to delete the LLM provider',\n });\n}\n\nexport function useTestLLMConnection() {\n return useWorkspaceMutation<TestLlmConnectionMutation, string, boolean>({\n document: TestLlmConnectionDocument,\n variables: (providerId) => ({ id: providerId }),\n select: (data) => data?.testLlmConnection,\n errorMessage: 'Failed to test the LLM connection',\n });\n}\n\n/** Register models through the same authenticated workspace gateway as providers. */\nexport function useCreateLLMModel() {\n const [createModel, state] = useWorkspaceMutation<\n CreateBotmanorLlmModelMutation,\n CreateBotmanorLlmModelInput,\n LLMModelRecord\n >({\n document: CreateBotmanorLlmModelDocument,\n variables: (input) => ({\n input: buildMutationInput(\n input,\n fieldsOf<CreateBotmanorLlmModelInput>({\n providerId: true,\n name: true,\n modelId: true,\n contextWindow: true,\n maxOutputTokens: true,\n inputPricePerMToken: true,\n outputPricePerMToken: true,\n supportsStreaming: true,\n supportsFunctionCalling: true,\n supportsVision: true,\n metadata: true,\n })\n ),\n }),\n select: (data) => data?.createBotmanorLLMModel,\n errorMessage: 'Failed to register the model',\n });\n return { createModel, isCreating: state.loading, error: state.error };\n}\n"],"mappings":";;;;;;;AA+CA,IAAMA,IAAa,IAwCbC,IAAoC,CAAC,GACrCC,IAA8B,CAAC,GAE/BC,IAAyBC,EAAyC;CACtE,aAAa;CACb,cAAc;CACd,aAAa;CACb,UAAU;CACV,MAAM;CACN,MAAM;CACN,aAAa;AACf,CAAC,GAEKC,IAAyBD,EAAyC;CACtE,aAAa;CACb,kBAAkB;CAClB,cAAc;CACd,aAAa;CACb,UAAU;CACV,UAAU;CACV,MAAM;AACR,CAAC;AASD,SAASE,EACP,GACA,GACA,GACA,GACA,GACwB;CACxB,IAAMC,IAASC,EAAmB,GAC5B,EAAE,gBAAa,mBAAgBC,EAAU,GACzCC,IAAQC,EAAS;EACrB,UAAU;GAAC;GAAwBC;GAAaC,GAAa;GAAIC;GAAMC;EAAU;EACjF,SAAS,EAAQH;EACjB,OAAO;EACP,SAAS,YAAY;GACnB,IAAMI,IAAqB,CAAC;GAC5B,KAAK,IAAIC,IAAS,GAAGA,IAAS,KAAO,KAAUjB,GAAY;IACzD,IAAMkB,IAAS,MAAMX,EAAO,MAAa;KACvC,OAAOY;KACP,aAAa;KACb,WAAW;MACT,SAASJ,IAAa,EAAE,cAAW,IAAI,KAAA;MACvC,YAAY;OAAE,OAAOf;OAAY;MAAO;KAC1C;IACF,CAAC;IACD,IAAI,CAACkB,EAAO,MAAM,MAAU,MAAM,2BAA2B;IAC7D,IAAME,IAAOC,EAAOH,EAAO,IAAI;IAC/B,IAAI,CAAC,MAAM,QAAQE,CAAI,KAAKA,EAAK,SAASpB,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AAW;EAC7C,SAAS,MAASU,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAGA,SAAgBmB,IAAoB;CAClC,IAAM,CAACC,GAAaC,KAASb,EAI3B;EACA,UAAUc;EACV,YAAY,OAAW,EACrB,OAAOZ,EACLC,GACAhC,EAAsC;GACpC,YAAY;GACZ,MAAM;GACN,SAAS;GACT,eAAe;GACf,iBAAiB;GACjB,qBAAqB;GACrB,sBAAsB;GACtB,mBAAmB;GACnB,yBAAyB;GACzB,gBAAgB;GAChB,UAAU;EACZ,CAAC,CACH,EACF;EACA,SAAS,MAASqB,GAAM;EACxB,cAAc;CAChB,CAAC;CACD,OAAO;EAAE;EAAa,YAAYqB,EAAM;EAAS,OAAOA,EAAM;CAAM;AACtE"}
@@ -9,7 +9,7 @@ export interface MCPServerRecord {
9
9
  type: string;
10
10
  status: string;
11
11
  config: Record<string, unknown>;
12
- credentialsHash?: string | null;
12
+ hasCredentials?: boolean;
13
13
  errorMessage?: string | null;
14
14
  lastConnectedAt?: string | null;
15
15
  lastErrorAt?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"useMCPServers.js","names":["LIST_LIMIT","CREATE_CONNECTION_FIELDS","fieldsOf","UPDATE_CONNECTION_FIELDS","NO_SERVERS","NO_TOOLS","NO_RESOURCES","isMCPServerHealthy","status","mcpServerEndpoint","url","server","mcpServerDescription","description","selectServers","data","selectServer","selectTools","selectResources","useMCPServers","workspaceId","useWorkspaceId","search","filter","variables","useMemo","all","useAllPagesQuery","ListMcpConnectionsDocument","row","useMCPServer","serverId","useWorkspaceQuery","GetMcpConnectionDocument","useMCPTools","ListMcpToolsDocument","useMCPResources","ListMcpResourcesDocument","useCreateMCPServer","useCallback","buildMutationInput","input","useWorkspaceMutation","CreateMcpConnectionDocument","useUpdateMCPServer","UpdateMcpConnectionDocument","useDeleteMCPServer","DeleteMcpConnectionDocument","useTestMCPConnection","TestMcpConnectionDocument","useUpdateMCPTool","UpdateMcpToolDocument","toolId"],"sources":["../../../src/botlit/hooks/useMCPServers.ts"],"sourcesContent":["/**\n * MCP Servers Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listMCPConnections` / `getMCPConnection` / `listMCPTools`\n * / `listMCPResources` operations and the create/update/delete/test mutations on\n * wspace-botlit-svc.\n *\n * The service models an MCP server as an `MCPConnection`: `type` is the\n * transport, `config` holds the endpoint, and `status` reports health.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateMcpConnectionDocument,\n DeleteMcpConnectionDocument,\n GetMcpConnectionDocument,\n ListMcpConnectionsDocument,\n ListMcpResourcesDocument,\n ListMcpToolsDocument,\n TestMcpConnectionDocument,\n UpdateMcpConnectionDocument,\n UpdateMcpToolDocument,\n type CreateMcpConnectionMutation,\n type DeleteMcpConnectionMutation,\n type GetMcpConnectionQuery,\n type ListMcpConnectionsQuery,\n type ListMcpResourcesQuery,\n type ListMcpToolsQuery,\n type TestMcpConnectionMutation,\n type UpdateMcpConnectionMutation,\n type UpdateMcpToolMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateMcpConnectionInput,\n McpToolRiskLevel,\n UpdateMcpConnectionInput,\n UpdateMcpToolInput,\n} from '../../generated/wspace-types';\nimport type { BaseFilter } from '../types';\nimport { useAllPagesQuery } from './internal/allPages';\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 MCPServerRecord {\n id: string;\n name: string;\n /** Transport / server kind, e.g. `HTTP_JSON`. */\n type: string;\n status: string;\n config: Record<string, unknown>;\n credentialsHash?: string | null;\n errorMessage?: string | null;\n lastConnectedAt?: string | null;\n lastErrorAt?: string | null;\n deletedAt?: string | null;\n metadata?: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\nexport interface MCPToolRecord {\n id: string;\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n riskLevel: McpToolRiskLevel;\n}\n\nexport interface MCPResourceRecord {\n name: string;\n uri: string;\n description?: string | null;\n mimeType?: string | null;\n}\n\n/** `CreateMCPConnectionInput` minus the `workspaceId` the hook supplies. */\nexport type CreateMCPServerVariables = Omit<GraphQLInput<CreateMcpConnectionInput>, 'workspaceId'>;\n\nexport interface UpdateMCPServerVariables {\n serverId: string;\n input: GraphQLInput<UpdateMcpConnectionInput>;\n}\n\nexport interface UpdateMCPToolVariables {\n toolId: string;\n input: GraphQLInput<UpdateMcpToolInput>;\n}\n\nconst CREATE_CONNECTION_FIELDS = fieldsOf<CreateMcpConnectionInput>({\n config: true,\n credential: true,\n credentials: true,\n metadata: true,\n name: true,\n type: true,\n workspaceId: true,\n});\n\nconst UPDATE_CONNECTION_FIELDS = fieldsOf<UpdateMcpConnectionInput>({\n clearCredential: true,\n config: true,\n credential: true,\n credentials: true,\n metadata: true,\n name: true,\n type: true,\n});\n\nconst NO_SERVERS: MCPServerRecord[] = [];\nconst NO_TOOLS: MCPToolRecord[] = [];\nconst NO_RESOURCES: MCPResourceRecord[] = [];\n\n/** `CONNECTED` is the only status that means the server is usable right now. */\nexport function isMCPServerHealthy(status: string | null | undefined): boolean {\n return status === 'CONNECTED';\n}\n\nexport function isMCPServerUnhealthy(status: string | null | undefined): boolean {\n return status === 'ERROR' || status === 'DISCONNECTED';\n}\n\n/** Endpoint the connection points at — the service stores it on the free-form config. */\nexport function mcpServerEndpoint(server: Pick<MCPServerRecord, 'config'>): string | undefined {\n const url = server.config?.url;\n return typeof url === 'string' ? url : undefined;\n}\n\n/** Optional human description the UI stores alongside the endpoint. */\nexport function mcpServerDescription(server: Pick<MCPServerRecord, 'config'>): string | undefined {\n const description = server.config?.description;\n return typeof description === 'string' ? description : undefined;\n}\n\nfunction selectServers(data: ListMcpConnectionsQuery | undefined): MCPServerRecord[] {\n return data?.listMCPConnections ?? NO_SERVERS;\n}\n\nfunction selectServer(data: GetMcpConnectionQuery | undefined): MCPServerRecord | null {\n return data?.getMCPConnection ?? null;\n}\n\nfunction selectTools(data: ListMcpToolsQuery | undefined): MCPToolRecord[] {\n return data?.listMCPTools ?? NO_TOOLS;\n}\n\nfunction selectResources(data: ListMcpResourcesQuery | undefined): MCPResourceRecord[] {\n return data?.listMCPResources ?? NO_RESOURCES;\n}\n\nexport const mcpServerKeys = {\n all: ['mcpServers'] as const,\n lists: () => [...mcpServerKeys.all, 'list'] as const,\n list: (filter?: BaseFilter) => [...mcpServerKeys.lists(), filter] as const,\n details: () => [...mcpServerKeys.all, 'detail'] as const,\n detail: (id: string) => [...mcpServerKeys.details(), id] as const,\n resources: (serverId?: string) => [...mcpServerKeys.all, 'resources', serverId] as const,\n tools: (serverId?: string) => [...mcpServerKeys.all, 'tools', serverId] as const,\n};\n\nexport function useMCPServers(filter?: BaseFilter): QueryResult<MCPServerRecord[]> {\n const workspaceId = useWorkspaceId();\n const search = filter?.search?.trim().toLowerCase() ?? '';\n\n const variables = useMemo(\n () => ({\n // MCPConnectionFilterInput has no free-text field — search is narrowed on the client.\n filters: { workspaceId },\n }),\n [workspaceId]\n );\n\n // Every page: pickers and lookups need the whole list, not the first 100.\n const all = useAllPagesQuery<ListMcpConnectionsQuery, MCPServerRecord>({\n document: ListMcpConnectionsDocument,\n variables,\n pageSize: LIST_LIMIT,\n extractRows: selectServers,\n fallback: NO_SERVERS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load MCP servers',\n });\n\n // Narrowed on the client, over the whole list.\n const data = useMemo(\n () => (search ? all.data.filter((row) => row.name.toLowerCase().includes(search)) : all.data),\n [all.data, search]\n );\n return { ...all, data };\n}\n\nexport function useMCPServer(serverId: string | undefined): QueryResult<MCPServerRecord | null> {\n const variables = useMemo(() => ({ id: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<GetMcpConnectionQuery, MCPServerRecord | null>({\n document: GetMcpConnectionDocument,\n variables,\n select: selectServer,\n fallback: null,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP server',\n });\n}\n\nexport function useMCPTools(serverId: string | undefined): QueryResult<MCPToolRecord[]> {\n const variables = useMemo(() => ({ connectionId: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<ListMcpToolsQuery, MCPToolRecord[]>({\n document: ListMcpToolsDocument,\n variables,\n select: selectTools,\n fallback: NO_TOOLS,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP tools',\n });\n}\n\nexport function useMCPResources(serverId: string | undefined): QueryResult<MCPResourceRecord[]> {\n const variables = useMemo(() => ({ connectionId: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<ListMcpResourcesQuery, MCPResourceRecord[]>({\n document: ListMcpResourcesDocument,\n variables,\n select: selectResources,\n fallback: NO_RESOURCES,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP resources',\n });\n}\n\nexport function useCreateMCPServer() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreateMCPServerVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_CONNECTION_FIELDS),\n }),\n [workspaceId]\n );\n\n return useWorkspaceMutation<\n CreateMcpConnectionMutation,\n CreateMCPServerVariables,\n MCPServerRecord\n >({\n document: CreateMcpConnectionDocument,\n variables,\n select: (data) => data?.createMCPConnection,\n errorMessage: 'Failed to connect MCP server',\n });\n}\n\nexport function useUpdateMCPServer() {\n return useWorkspaceMutation<\n UpdateMcpConnectionMutation,\n UpdateMCPServerVariables,\n MCPServerRecord\n >({\n document: UpdateMcpConnectionDocument,\n variables: ({ serverId, input }) => ({\n id: serverId,\n input: buildMutationInput(input, UPDATE_CONNECTION_FIELDS),\n }),\n select: (data) => data?.updateMCPConnection,\n errorMessage: 'Failed to update MCP server',\n });\n}\n\nexport function useDeleteMCPServer() {\n return useWorkspaceMutation<DeleteMcpConnectionMutation, string, boolean>({\n document: DeleteMcpConnectionDocument,\n variables: (serverId) => ({ id: serverId }),\n select: (data) => data?.deleteMCPConnection,\n errorMessage: 'Failed to disconnect MCP server',\n });\n}\n\nexport function useTestMCPConnection() {\n return useWorkspaceMutation<TestMcpConnectionMutation, string, boolean>({\n document: TestMcpConnectionDocument,\n variables: (serverId) => ({ id: serverId }),\n select: (data) => data?.testMCPConnection,\n errorMessage: 'Failed to test MCP connection',\n });\n}\n\nexport function useUpdateMCPTool() {\n return useWorkspaceMutation<UpdateMcpToolMutation, UpdateMCPToolVariables, MCPToolRecord>({\n document: UpdateMcpToolDocument,\n variables: ({ toolId, input }) => ({ id: toolId, input }),\n select: (data) => data?.updateMCPTool,\n errorMessage: 'Failed to update MCP tool risk level',\n });\n}\n"],"mappings":";;;;;;AAiDA,IAAMA,IAAa,KAkDbC,IAA2BC,EAAmC;CAClE,QAAQ;CACR,YAAY;CACZ,aAAa;CACb,UAAU;CACV,MAAM;CACN,MAAM;CACN,aAAa;AACf,CAAC,GAEKC,IAA2BD,EAAmC;CAClE,iBAAiB;CACjB,QAAQ;CACR,YAAY;CACZ,aAAa;CACb,UAAU;CACV,MAAM;CACN,MAAM;AACR,CAAC,GAEKE,IAAgC,CAAC,GACjCC,IAA4B,CAAC,GAC7BC,IAAoC,CAAC;AAG3C,SAAgBC,EAAmB,GAA4C;CAC7E,OAAOC,MAAW;AACpB;AAOA,SAAgBC,EAAkB,GAA6D;CAC7F,IAAMC,IAAMC,EAAO,QAAQ;CAC3B,OAAO,OAAOD,KAAQ,WAAWA,IAAM,KAAA;AACzC;AAGA,SAAgBE,EAAqB,GAA6D;CAChG,IAAMC,IAAcF,EAAO,QAAQ;CACnC,OAAO,OAAOE,KAAgB,WAAWA,IAAc,KAAA;AACzD;AAEA,SAASC,EAAc,GAA8D;CACnF,OAAOC,GAAM,sBAAsBX;AACrC;AAEA,SAASY,EAAa,GAAiE;CACrF,OAAOD,GAAM,oBAAoB;AACnC;AAEA,SAASE,EAAY,GAAsD;CACzE,OAAOF,GAAM,gBAAgBV;AAC/B;AAEA,SAASa,EAAgB,GA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B,IAAcC,EAAe,GAE7BG,IAAYe,GACf,OAAqC,EACpC,OAAOC,EAAmB;EAAE,GAAGC;EAAO;CAAY,GAAGxC,CAAwB,EAC/E,IACA,CAACmB,CAAW,CACd;CAEA,OAAOsB,EAIL;EACA,UAAUC;EACV;EACA,SAAS,MAAS5B,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgB6B,IAAqB;CACnC,OAAOF,EAIL;EACA,UAAUG;EACV,YAAY,EAAE,aAAU,gBAAa;GACnC,IAAId;GACJ,OAAOS,EAAmBC,GAAOtC,CAAwB;EAC3D;EACA,SAAS,MAASY,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgB+B,IAAqB;CACnC,OAAOJ,EAAmE;EACxE,UAAUK;EACV,YAAY,OAAc,EAAE,IAAIhB,EAAS;EACzC,SAAS,MAAShB,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBiC,IAAuB;CACrC,OAAON,EAAiE;EACtE,UAAUO;EACV,YAAY,OAAc,EAAE,IAAIlB,EAAS;EACzC,SAAS,MAAShB,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBmC,IAAmB;CACjC,OAAOR,EAAmF;EACxF,UAAUS;EACV,YAAY,EAAE,WAAQ,gBAAa;GAAE,IAAIC;GAAQ;EAAM;EACvD,SAAS,MAASrC,GAAM;EACxB,cAAc;CAChB,CAAC;AACH"}
1
+ {"version":3,"file":"useMCPServers.js","names":["LIST_LIMIT","CREATE_CONNECTION_FIELDS","fieldsOf","UPDATE_CONNECTION_FIELDS","NO_SERVERS","NO_TOOLS","NO_RESOURCES","isMCPServerHealthy","status","mcpServerEndpoint","url","server","mcpServerDescription","description","selectServers","data","selectServer","selectTools","selectResources","useMCPServers","workspaceId","useWorkspaceId","search","filter","variables","useMemo","all","useAllPagesQuery","ListMcpConnectionsDocument","row","useMCPServer","serverId","useWorkspaceQuery","GetMcpConnectionDocument","useMCPTools","ListMcpToolsDocument","useMCPResources","ListMcpResourcesDocument","useCreateMCPServer","useCallback","buildMutationInput","input","useWorkspaceMutation","CreateMcpConnectionDocument","useUpdateMCPServer","UpdateMcpConnectionDocument","useDeleteMCPServer","DeleteMcpConnectionDocument","useTestMCPConnection","TestMcpConnectionDocument","useUpdateMCPTool","UpdateMcpToolDocument","toolId"],"sources":["../../../src/botlit/hooks/useMCPServers.ts"],"sourcesContent":["/**\n * MCP Servers Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listMCPConnections` / `getMCPConnection` / `listMCPTools`\n * / `listMCPResources` operations and the create/update/delete/test mutations on\n * wspace-botlit-svc.\n *\n * The service models an MCP server as an `MCPConnection`: `type` is the\n * transport, `config` holds the endpoint, and `status` reports health.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateMcpConnectionDocument,\n DeleteMcpConnectionDocument,\n GetMcpConnectionDocument,\n ListMcpConnectionsDocument,\n ListMcpResourcesDocument,\n ListMcpToolsDocument,\n TestMcpConnectionDocument,\n UpdateMcpConnectionDocument,\n UpdateMcpToolDocument,\n type CreateMcpConnectionMutation,\n type DeleteMcpConnectionMutation,\n type GetMcpConnectionQuery,\n type ListMcpConnectionsQuery,\n type ListMcpResourcesQuery,\n type ListMcpToolsQuery,\n type TestMcpConnectionMutation,\n type UpdateMcpConnectionMutation,\n type UpdateMcpToolMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateMcpConnectionInput,\n McpToolRiskLevel,\n UpdateMcpConnectionInput,\n UpdateMcpToolInput,\n} from '../../generated/wspace-types';\nimport type { BaseFilter } from '../types';\nimport { useAllPagesQuery } from './internal/allPages';\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 MCPServerRecord {\n id: string;\n name: string;\n /** Transport / server kind, e.g. `HTTP_JSON`. */\n type: string;\n status: string;\n config: Record<string, unknown>;\n hasCredentials?: boolean;\n errorMessage?: string | null;\n lastConnectedAt?: string | null;\n lastErrorAt?: string | null;\n deletedAt?: string | null;\n metadata?: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\nexport interface MCPToolRecord {\n id: string;\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n riskLevel: McpToolRiskLevel;\n}\n\nexport interface MCPResourceRecord {\n name: string;\n uri: string;\n description?: string | null;\n mimeType?: string | null;\n}\n\n/** `CreateMCPConnectionInput` minus the `workspaceId` the hook supplies. */\nexport type CreateMCPServerVariables = Omit<GraphQLInput<CreateMcpConnectionInput>, 'workspaceId'>;\n\nexport interface UpdateMCPServerVariables {\n serverId: string;\n input: GraphQLInput<UpdateMcpConnectionInput>;\n}\n\nexport interface UpdateMCPToolVariables {\n toolId: string;\n input: GraphQLInput<UpdateMcpToolInput>;\n}\n\nconst CREATE_CONNECTION_FIELDS = fieldsOf<CreateMcpConnectionInput>({\n config: true,\n credential: true,\n credentials: true,\n metadata: true,\n name: true,\n type: true,\n workspaceId: true,\n});\n\nconst UPDATE_CONNECTION_FIELDS = fieldsOf<UpdateMcpConnectionInput>({\n clearCredential: true,\n config: true,\n credential: true,\n credentials: true,\n metadata: true,\n name: true,\n type: true,\n});\n\nconst NO_SERVERS: MCPServerRecord[] = [];\nconst NO_TOOLS: MCPToolRecord[] = [];\nconst NO_RESOURCES: MCPResourceRecord[] = [];\n\n/** `CONNECTED` is the only status that means the server is usable right now. */\nexport function isMCPServerHealthy(status: string | null | undefined): boolean {\n return status === 'CONNECTED';\n}\n\nexport function isMCPServerUnhealthy(status: string | null | undefined): boolean {\n return status === 'ERROR' || status === 'DISCONNECTED';\n}\n\n/** Endpoint the connection points at — the service stores it on the free-form config. */\nexport function mcpServerEndpoint(server: Pick<MCPServerRecord, 'config'>): string | undefined {\n const url = server.config?.url;\n return typeof url === 'string' ? url : undefined;\n}\n\n/** Optional human description the UI stores alongside the endpoint. */\nexport function mcpServerDescription(server: Pick<MCPServerRecord, 'config'>): string | undefined {\n const description = server.config?.description;\n return typeof description === 'string' ? description : undefined;\n}\n\nfunction selectServers(data: ListMcpConnectionsQuery | undefined): MCPServerRecord[] {\n return data?.listMCPConnections ?? NO_SERVERS;\n}\n\nfunction selectServer(data: GetMcpConnectionQuery | undefined): MCPServerRecord | null {\n return data?.getMCPConnection ?? null;\n}\n\nfunction selectTools(data: ListMcpToolsQuery | undefined): MCPToolRecord[] {\n return data?.listMCPTools ?? NO_TOOLS;\n}\n\nfunction selectResources(data: ListMcpResourcesQuery | undefined): MCPResourceRecord[] {\n return data?.listMCPResources ?? NO_RESOURCES;\n}\n\nexport const mcpServerKeys = {\n all: ['mcpServers'] as const,\n lists: () => [...mcpServerKeys.all, 'list'] as const,\n list: (filter?: BaseFilter) => [...mcpServerKeys.lists(), filter] as const,\n details: () => [...mcpServerKeys.all, 'detail'] as const,\n detail: (id: string) => [...mcpServerKeys.details(), id] as const,\n resources: (serverId?: string) => [...mcpServerKeys.all, 'resources', serverId] as const,\n tools: (serverId?: string) => [...mcpServerKeys.all, 'tools', serverId] as const,\n};\n\nexport function useMCPServers(filter?: BaseFilter): QueryResult<MCPServerRecord[]> {\n const workspaceId = useWorkspaceId();\n const search = filter?.search?.trim().toLowerCase() ?? '';\n\n const variables = useMemo(\n () => ({\n // MCPConnectionFilterInput has no free-text field — search is narrowed on the client.\n filters: { workspaceId },\n }),\n [workspaceId]\n );\n\n // Every page: pickers and lookups need the whole list, not the first 100.\n const all = useAllPagesQuery<ListMcpConnectionsQuery, MCPServerRecord>({\n document: ListMcpConnectionsDocument,\n variables,\n pageSize: LIST_LIMIT,\n extractRows: selectServers,\n fallback: NO_SERVERS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load MCP servers',\n });\n\n // Narrowed on the client, over the whole list.\n const data = useMemo(\n () => (search ? all.data.filter((row) => row.name.toLowerCase().includes(search)) : all.data),\n [all.data, search]\n );\n return { ...all, data };\n}\n\nexport function useMCPServer(serverId: string | undefined): QueryResult<MCPServerRecord | null> {\n const variables = useMemo(() => ({ id: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<GetMcpConnectionQuery, MCPServerRecord | null>({\n document: GetMcpConnectionDocument,\n variables,\n select: selectServer,\n fallback: null,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP server',\n });\n}\n\nexport function useMCPTools(serverId: string | undefined): QueryResult<MCPToolRecord[]> {\n const variables = useMemo(() => ({ connectionId: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<ListMcpToolsQuery, MCPToolRecord[]>({\n document: ListMcpToolsDocument,\n variables,\n select: selectTools,\n fallback: NO_TOOLS,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP tools',\n });\n}\n\nexport function useMCPResources(serverId: string | undefined): QueryResult<MCPResourceRecord[]> {\n const variables = useMemo(() => ({ connectionId: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<ListMcpResourcesQuery, MCPResourceRecord[]>({\n document: ListMcpResourcesDocument,\n variables,\n select: selectResources,\n fallback: NO_RESOURCES,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP resources',\n });\n}\n\nexport function useCreateMCPServer() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreateMCPServerVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_CONNECTION_FIELDS),\n }),\n [workspaceId]\n );\n\n return useWorkspaceMutation<\n CreateMcpConnectionMutation,\n CreateMCPServerVariables,\n MCPServerRecord\n >({\n document: CreateMcpConnectionDocument,\n variables,\n select: (data) => data?.createMCPConnection,\n errorMessage: 'Failed to connect MCP server',\n });\n}\n\nexport function useUpdateMCPServer() {\n return useWorkspaceMutation<\n UpdateMcpConnectionMutation,\n UpdateMCPServerVariables,\n MCPServerRecord\n >({\n document: UpdateMcpConnectionDocument,\n variables: ({ serverId, input }) => ({\n id: serverId,\n input: buildMutationInput(input, UPDATE_CONNECTION_FIELDS),\n }),\n select: (data) => data?.updateMCPConnection,\n errorMessage: 'Failed to update MCP server',\n });\n}\n\nexport function useDeleteMCPServer() {\n return useWorkspaceMutation<DeleteMcpConnectionMutation, string, boolean>({\n document: DeleteMcpConnectionDocument,\n variables: (serverId) => ({ id: serverId }),\n select: (data) => data?.deleteMCPConnection,\n errorMessage: 'Failed to disconnect MCP server',\n });\n}\n\nexport function useTestMCPConnection() {\n return useWorkspaceMutation<TestMcpConnectionMutation, string, boolean>({\n document: TestMcpConnectionDocument,\n variables: (serverId) => ({ id: serverId }),\n select: (data) => data?.testMCPConnection,\n errorMessage: 'Failed to test MCP connection',\n });\n}\n\nexport function useUpdateMCPTool() {\n return useWorkspaceMutation<UpdateMcpToolMutation, UpdateMCPToolVariables, MCPToolRecord>({\n document: UpdateMcpToolDocument,\n variables: ({ toolId, input }) => ({ id: toolId, input }),\n select: (data) => data?.updateMCPTool,\n errorMessage: 'Failed to update MCP tool risk level',\n });\n}\n"],"mappings":";;;;;;AAiDA,IAAMA,IAAa,KAkDbC,IAA2BC,EAAmC;CAClE,QAAQ;CACR,YAAY;CACZ,aAAa;CACb,UAAU;CACV,MAAM;CACN,MAAM;CACN,aAAa;AACf,CAAC,GAEKC,IAA2BD,EAAmC;CAClE,iBAAiB;CACjB,QAAQ;CACR,YAAY;CACZ,aAAa;CACb,UAAU;CACV,MAAM;CACN,MAAM;AACR,CAAC,GAEKE,IAAgC,CAAC,GACjCC,IAA4B,CAAC,GAC7BC,IAAoC,CAAC;AAG3C,SAAgBC,EAAmB,GAA4C;CAC7E,OAAOC,MAAW;AACpB;AAOA,SAAgBC,EAAkB,GAA6D;CAC7F,IAAMC,IAAMC,EAAO,QAAQ;CAC3B,OAAO,OAAOD,KAAQ,WAAWA,IAAM,KAAA;AACzC;AAGA,SAAgBE,EAAqB,GAA6D;CAChG,IAAMC,IAAcF,EAAO,QAAQ;CACnC,OAAO,OAAOE,KAAgB,WAAWA,IAA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