@burdenoff/microfe-botmanor 2026.1115.2 → 2026.1117.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.
Files changed (53) hide show
  1. package/dist/botlit/components/BotFormFields.js +66 -87
  2. package/dist/botlit/components/BotFormFields.js.map +1 -1
  3. package/dist/botlit/components/EmojiPicker.d.ts +20 -0
  4. package/dist/botlit/components/EmojiPicker.js +42 -0
  5. package/dist/botlit/components/EmojiPicker.js.map +1 -0
  6. package/dist/botlit/components/index.d.ts +1 -0
  7. package/dist/botlit/hooks/internal/allPages.d.ts +2 -0
  8. package/dist/botlit/hooks/internal/allPages.js +25 -0
  9. package/dist/botlit/hooks/internal/allPages.js.map +1 -0
  10. package/dist/botlit/hooks/internal/workspaceGateway.js +33 -32
  11. package/dist/botlit/hooks/internal/workspaceGateway.js.map +1 -1
  12. package/dist/botlit/hooks/useAgents.d.ts +26 -3
  13. package/dist/botlit/hooks/useAgents.js +160 -110
  14. package/dist/botlit/hooks/useAgents.js.map +1 -1
  15. package/dist/botlit/hooks/useBotAgents.d.ts +35 -0
  16. package/dist/botlit/hooks/useBotAgents.js +95 -0
  17. package/dist/botlit/hooks/useBotAgents.js.map +1 -0
  18. package/dist/botlit/hooks/useBots.js +2 -2
  19. package/dist/botlit/hooks/useBots.js.map +1 -1
  20. package/dist/botlit/hooks/useKnowledgeBases.d.ts +13 -0
  21. package/dist/botlit/hooks/useKnowledgeBases.js +77 -58
  22. package/dist/botlit/hooks/useKnowledgeBases.js.map +1 -1
  23. package/dist/botlit/hooks/useMCPServers.js +53 -57
  24. package/dist/botlit/hooks/useMCPServers.js.map +1 -1
  25. package/dist/botlit/pages/AgentBuilderPage.js +848 -425
  26. package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
  27. package/dist/botlit/pages/AgentDetailPage.js +629 -518
  28. package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
  29. package/dist/botlit/pages/AgentsListPage.js +487 -291
  30. package/dist/botlit/pages/AgentsListPage.js.map +1 -1
  31. package/dist/botlit/pages/KnowledgeBaseDetailPage.js +519 -265
  32. package/dist/botlit/pages/KnowledgeBaseDetailPage.js.map +1 -1
  33. package/dist/botlit/pages/KnowledgeBasesPage.js +269 -130
  34. package/dist/botlit/pages/KnowledgeBasesPage.js.map +1 -1
  35. package/dist/botlit/types/index.d.ts +4 -1
  36. package/dist/botlit/utils/agentDelete.d.ts +5 -0
  37. package/dist/botlit/utils/agentDelete.js +15 -0
  38. package/dist/botlit/utils/agentDelete.js.map +1 -0
  39. package/dist/botlit/utils/agentSettings.d.ts +77 -0
  40. package/dist/botlit/utils/agentSettings.js +78 -0
  41. package/dist/botlit/utils/agentSettings.js.map +1 -0
  42. package/dist/botlit/utils/kbDelete.d.ts +5 -0
  43. package/dist/botlit/utils/kbDelete.js +11 -0
  44. package/dist/botlit/utils/kbDelete.js.map +1 -0
  45. package/dist/botlit/utils/kbSettings.d.ts +41 -0
  46. package/dist/botlit/utils/kbSettings.js +60 -0
  47. package/dist/botlit/utils/kbSettings.js.map +1 -0
  48. package/dist/generated/wspace-operations.d.ts +75 -0
  49. package/dist/generated/wspace-operations.js +60 -48
  50. package/dist/generated/wspace-operations.js.map +1 -1
  51. package/dist/generated/wspace-types.d.ts +66 -0
  52. package/dist/generated/wspace-types.js.map +1 -1
  53. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useKnowledgeBases.js","names":["LIST_LIMIT","CREATE_KB_FIELDS","fieldsOf","UPDATE_KB_FIELDS","NO_KNOWLEDGE_BASES","NO_DOCUMENTS","selectKnowledgeBases","data","selectKnowledgeBase","selectDocuments","useKnowledgeBases","workspaceId","useWorkspaceId","search","filter","variables","useMemo","useWorkspaceQuery","ListKnowledgeBasesDocument","useKnowledgeBase","kbId","GetKnowledgeBaseDocument","useKnowledgeDocuments","ListKnowledgeDocumentsDocument","useCreateKnowledgeBase","useCallback","buildMutationInput","input","useWorkspaceMutation","CreateKnowledgeBaseDocument","useUpdateKnowledgeBase","UpdateKnowledgeBaseDocument","useRebuildKnowledgeBaseIndex","RebuildKnowledgeBaseIndexDocument"],"sources":["../../../src/botlit/hooks/useKnowledgeBases.ts"],"sourcesContent":["/**\n * Knowledge Bases Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listKnowledgeBases` / `getKnowledgeBase` /\n * `listKnowledgeDocuments` operations and the create/update/delete mutations on\n * wspace-botlit-svc.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateKnowledgeBaseDocument,\n DeleteKnowledgeBaseDocument,\n GetKnowledgeBaseDocument,\n ListKnowledgeBasesDocument,\n ListKnowledgeDocumentsDocument,\n RebuildKnowledgeBaseIndexDocument,\n UpdateKnowledgeBaseDocument,\n type CreateKnowledgeBaseMutation,\n type DeleteKnowledgeBaseMutation,\n type GetKnowledgeBaseQuery,\n type ListKnowledgeBasesQuery,\n type ListKnowledgeDocumentsQuery,\n type RebuildKnowledgeBaseIndexMutation,\n type UpdateKnowledgeBaseMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateKnowledgeBaseInput,\n UpdateKnowledgeBaseInput,\n} from '../../generated/wspace-types';\nimport type { BaseFilter } from '../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 KnowledgeBaseRecord {\n id: string;\n name: string;\n description?: string | null;\n indexStatus: string;\n embeddingModel: string;\n embeddingDimensions: number;\n chunkingStrategy: string;\n chunkSize: number;\n chunkOverlap: number;\n totalDocuments: number;\n totalChunks: number;\n vectorCount: number;\n lastIndexedAt?: 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 KnowledgeDocumentRecord {\n id: string;\n knowledgeBaseId: string;\n title: string;\n fileId: string;\n status: string;\n chunkCount: number;\n processingError?: string | null;\n processedAt?: string | null;\n addedAt: string;\n addedById: string;\n updatedAt: string;\n}\n\n/**\n * `CreateKnowledgeBaseInput` minus the `workspaceId` the hook supplies.\n * `embeddingModel`/`embeddingDimensions` are required by the service.\n */\nexport type CreateKnowledgeBaseVariables = Omit<\n GraphQLInput<CreateKnowledgeBaseInput>,\n 'workspaceId'\n>;\n\nexport interface UpdateKnowledgeBaseVariables {\n kbId: string;\n input: GraphQLInput<UpdateKnowledgeBaseInput>;\n}\n\nconst CREATE_KB_FIELDS = fieldsOf<CreateKnowledgeBaseInput>({\n chunkOverlap: true,\n chunkSize: true,\n chunkingStrategy: true,\n description: true,\n embeddingDimensions: true,\n embeddingModel: true,\n metadata: true,\n name: true,\n // Optional: the service picks the environment default when omitted.\n vectorStoreDriver: true,\n workspaceId: true,\n});\n\nconst UPDATE_KB_FIELDS = fieldsOf<UpdateKnowledgeBaseInput>({\n chunkOverlap: true,\n chunkSize: true,\n chunkingStrategy: true,\n description: true,\n metadata: true,\n name: true,\n});\n\nconst NO_KNOWLEDGE_BASES: KnowledgeBaseRecord[] = [];\nconst NO_DOCUMENTS: KnowledgeDocumentRecord[] = [];\n\nfunction selectKnowledgeBases(data: ListKnowledgeBasesQuery | undefined): KnowledgeBaseRecord[] {\n return data?.listKnowledgeBases ?? NO_KNOWLEDGE_BASES;\n}\n\nfunction selectKnowledgeBase(data: GetKnowledgeBaseQuery | undefined): KnowledgeBaseRecord | null {\n return data?.getKnowledgeBase ?? null;\n}\n\nfunction selectDocuments(data: ListKnowledgeDocumentsQuery | undefined): KnowledgeDocumentRecord[] {\n return data?.listKnowledgeDocuments ?? NO_DOCUMENTS;\n}\n\nexport const knowledgeBaseKeys = {\n all: ['knowledgeBases'] as const,\n lists: () => [...knowledgeBaseKeys.all, 'list'] as const,\n list: (filter?: BaseFilter) => [...knowledgeBaseKeys.lists(), filter] as const,\n details: () => [...knowledgeBaseKeys.all, 'detail'] as const,\n detail: (id: string) => [...knowledgeBaseKeys.details(), id] as const,\n documents: (kbId: string) => [...knowledgeBaseKeys.detail(kbId), 'documents'] as const,\n};\n\nexport function useKnowledgeBases(filter?: BaseFilter): QueryResult<KnowledgeBaseRecord[]> {\n const workspaceId = useWorkspaceId();\n const search = filter?.search;\n\n const variables = useMemo(\n () => ({\n filters: { workspaceId, search: search || undefined },\n pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [workspaceId, search]\n );\n\n return useWorkspaceQuery<ListKnowledgeBasesQuery, KnowledgeBaseRecord[]>({\n document: ListKnowledgeBasesDocument,\n variables,\n select: selectKnowledgeBases,\n fallback: NO_KNOWLEDGE_BASES,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load knowledge bases',\n });\n}\n\nexport function useKnowledgeBase(\n kbId: string | undefined\n): QueryResult<KnowledgeBaseRecord | null> {\n const variables = useMemo(() => ({ id: kbId ?? '' }), [kbId]);\n\n return useWorkspaceQuery<GetKnowledgeBaseQuery, KnowledgeBaseRecord | null>({\n document: GetKnowledgeBaseDocument,\n variables,\n select: selectKnowledgeBase,\n fallback: null,\n enabled: Boolean(kbId),\n errorMessage: 'Failed to load knowledge base',\n });\n}\n\nexport function useKnowledgeDocuments(\n kbId: string | undefined\n): QueryResult<KnowledgeDocumentRecord[]> {\n const variables = useMemo(\n () => ({ knowledgeBaseId: kbId ?? '', pagination: { limit: LIST_LIMIT, offset: 0 } }),\n [kbId]\n );\n\n return useWorkspaceQuery<ListKnowledgeDocumentsQuery, KnowledgeDocumentRecord[]>({\n document: ListKnowledgeDocumentsDocument,\n variables,\n select: selectDocuments,\n fallback: NO_DOCUMENTS,\n enabled: Boolean(kbId),\n errorMessage: 'Failed to load knowledge documents',\n });\n}\n\nexport function useCreateKnowledgeBase() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreateKnowledgeBaseVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_KB_FIELDS),\n }),\n [workspaceId]\n );\n\n return useWorkspaceMutation<\n CreateKnowledgeBaseMutation,\n CreateKnowledgeBaseVariables,\n { id: string; name: string; workspaceId: string }\n >({\n document: CreateKnowledgeBaseDocument,\n variables,\n select: (data) => data?.createKnowledgeBase,\n errorMessage: 'Failed to create knowledge base',\n });\n}\n\nexport function useUpdateKnowledgeBase() {\n return useWorkspaceMutation<\n UpdateKnowledgeBaseMutation,\n UpdateKnowledgeBaseVariables,\n { id: string; name: string; indexStatus: string }\n >({\n document: UpdateKnowledgeBaseDocument,\n variables: ({ kbId, input }) => ({\n id: kbId,\n input: buildMutationInput(input, UPDATE_KB_FIELDS),\n }),\n select: (data) => data?.updateKnowledgeBase,\n errorMessage: 'Failed to update knowledge base',\n });\n}\n\n/** Re-indexes every document in the knowledge base (`rebuildKnowledgeBaseIndex`). */\nexport function useRebuildKnowledgeBaseIndex() {\n return useWorkspaceMutation<RebuildKnowledgeBaseIndexMutation, string, boolean>({\n document: RebuildKnowledgeBaseIndexDocument,\n variables: (kbId) => ({ knowledgeBaseId: kbId }),\n select: (data) => data?.rebuildKnowledgeBaseIndex,\n errorMessage: 'Failed to rebuild the knowledge base index',\n });\n}\n\nexport function useDeleteKnowledgeBase() {\n return useWorkspaceMutation<DeleteKnowledgeBaseMutation, string, boolean>({\n document: DeleteKnowledgeBaseDocument,\n variables: (kbId) => ({ id: kbId }),\n select: (data) => data?.deleteKnowledgeBase,\n errorMessage: 'Failed to delete knowledge base',\n });\n}\n"],"mappings":";;;;;AAuCA,IAAMA,IAAa,KAoDbC,IAAmBC,EAAmC;CAC1D,cAAc;CACd,WAAW;CACX,kBAAkB;CAClB,aAAa;CACb,qBAAqB;CACrB,gBAAgB;CAChB,UAAU;CACV,MAAM;CAEN,mBAAmB;CACnB,aAAa;AACf,CAAC,GAEKC,IAAmBD,EAAmC;CAC1D,cAAc;CACd,WAAW;CACX,kBAAkB;CAClB,aAAa;CACb,UAAU;CACV,MAAM;AACR,CAAC,GAEKE,IAA4C,CAAC,GAC7CC,IAA0C,CAA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,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBuB,IAAyB;CACvC,OAAOF,EAIL;EACA,UAAUG;EACV,YAAY,EAAE,SAAM,gBAAa;GAC/B,IAAIX;GACJ,OAAOM,EAAmBC,GAAOxB,CAAgB;EACnD;EACA,SAAS,MAASI,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAGA,SAAgByB,IAA+B;CAC7C,OAAOJ,EAAyE;EAC9E,UAAUK;EACV,YAAY,OAAU,EAAE,iBAAiBb,EAAK;EAC9C,SAAS,MAASb,GAAM;EACxB,cAAc;CAChB,CAAC;AACH"}
1
+ {"version":3,"file":"useKnowledgeBases.js","names":["LIST_LIMIT","CREATE_KB_FIELDS","fieldsOf","UPDATE_KB_FIELDS","NO_KNOWLEDGE_BASES","NO_DOCUMENTS","selectKnowledgeBases","data","selectKnowledgeBase","selectDocuments","useKnowledgeBases","workspaceId","useWorkspaceId","search","filter","variables","useMemo","useAllPagesQuery","ListKnowledgeBasesDocument","useKnowledgeBase","kbId","useWorkspaceQuery","GetKnowledgeBaseDocument","useKnowledgeDocuments","ListKnowledgeDocumentsDocument","useLoadKnowledgeBaseUsage","client","useWorkspaceClient","useCallback","result","GetKnowledgeBaseUsageDocument","operationError","useRemoveKnowledgeDocument","useWorkspaceMutation","RemoveKnowledgeDocumentDocument","documentId","useCreateKnowledgeBase","buildMutationInput","input","CreateKnowledgeBaseDocument","useUpdateKnowledgeBase","UpdateKnowledgeBaseDocument","useRebuildKnowledgeBaseIndex","RebuildKnowledgeBaseIndexDocument","useDeleteKnowledgeBase","DeleteKnowledgeBaseDocument"],"sources":["../../../src/botlit/hooks/useKnowledgeBases.ts"],"sourcesContent":["/**\n * Knowledge Bases Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listKnowledgeBases` / `getKnowledgeBase` /\n * `listKnowledgeDocuments` operations and the create/update/delete mutations on\n * wspace-botlit-svc.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateKnowledgeBaseDocument,\n DeleteKnowledgeBaseDocument,\n GetKnowledgeBaseDocument,\n GetKnowledgeBaseUsageDocument,\n ListKnowledgeBasesDocument,\n ListKnowledgeDocumentsDocument,\n RebuildKnowledgeBaseIndexDocument,\n RemoveKnowledgeDocumentDocument,\n UpdateKnowledgeBaseDocument,\n type CreateKnowledgeBaseMutation,\n type DeleteKnowledgeBaseMutation,\n type GetKnowledgeBaseQuery,\n type ListKnowledgeBasesQuery,\n type ListKnowledgeDocumentsQuery,\n type GetKnowledgeBaseUsageQuery,\n type RebuildKnowledgeBaseIndexMutation,\n type RemoveKnowledgeDocumentMutation,\n type UpdateKnowledgeBaseMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateKnowledgeBaseInput,\n UpdateKnowledgeBaseInput,\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 useWorkspaceClient,\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 100;\n\nexport interface KnowledgeBaseRecord {\n id: string;\n name: string;\n description?: string | null;\n indexStatus: string;\n embeddingModel: string;\n embeddingDimensions: number;\n chunkingStrategy: string;\n chunkSize: number;\n chunkOverlap: number;\n totalDocuments: number;\n totalChunks: number;\n vectorCount: number;\n lastIndexedAt?: 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 KnowledgeDocumentRecord {\n id: string;\n knowledgeBaseId: string;\n title: string;\n fileId: string;\n status: string;\n chunkCount: number;\n processingError?: string | null;\n processedAt?: string | null;\n addedAt: string;\n addedById: string;\n updatedAt: string;\n}\n\n/**\n * `CreateKnowledgeBaseInput` minus the `workspaceId` the hook supplies.\n * `embeddingModel`/`embeddingDimensions` are required by the service.\n */\nexport type CreateKnowledgeBaseVariables = Omit<\n GraphQLInput<CreateKnowledgeBaseInput>,\n 'workspaceId'\n>;\n\nexport interface UpdateKnowledgeBaseVariables {\n kbId: string;\n input: GraphQLInput<UpdateKnowledgeBaseInput>;\n}\n\nconst CREATE_KB_FIELDS = fieldsOf<CreateKnowledgeBaseInput>({\n chunkOverlap: true,\n chunkSize: true,\n chunkingStrategy: true,\n description: true,\n embeddingDimensions: true,\n embeddingModel: true,\n metadata: true,\n name: true,\n // Optional: the service picks the environment default when omitted.\n vectorStoreDriver: true,\n workspaceId: true,\n});\n\nconst UPDATE_KB_FIELDS = fieldsOf<UpdateKnowledgeBaseInput>({\n chunkOverlap: true,\n chunkSize: true,\n chunkingStrategy: true,\n description: true,\n metadata: true,\n name: true,\n});\n\nconst NO_KNOWLEDGE_BASES: KnowledgeBaseRecord[] = [];\nconst NO_DOCUMENTS: KnowledgeDocumentRecord[] = [];\n\nfunction selectKnowledgeBases(data: ListKnowledgeBasesQuery | undefined): KnowledgeBaseRecord[] {\n return data?.listKnowledgeBases ?? NO_KNOWLEDGE_BASES;\n}\n\nfunction selectKnowledgeBase(data: GetKnowledgeBaseQuery | undefined): KnowledgeBaseRecord | null {\n return data?.getKnowledgeBase ?? null;\n}\n\nfunction selectDocuments(data: ListKnowledgeDocumentsQuery | undefined): KnowledgeDocumentRecord[] {\n return data?.listKnowledgeDocuments ?? NO_DOCUMENTS;\n}\n\nexport const knowledgeBaseKeys = {\n all: ['knowledgeBases'] as const,\n lists: () => [...knowledgeBaseKeys.all, 'list'] as const,\n list: (filter?: BaseFilter) => [...knowledgeBaseKeys.lists(), filter] as const,\n details: () => [...knowledgeBaseKeys.all, 'detail'] as const,\n detail: (id: string) => [...knowledgeBaseKeys.details(), id] as const,\n documents: (kbId: string) => [...knowledgeBaseKeys.detail(kbId), 'documents'] as const,\n};\n\nexport function useKnowledgeBases(filter?: BaseFilter): QueryResult<KnowledgeBaseRecord[]> {\n const workspaceId = useWorkspaceId();\n const search = filter?.search;\n\n const variables = useMemo(\n () => ({\n filters: { workspaceId, search: search || undefined },\n }),\n [workspaceId, search]\n );\n\n // Every page: pickers and lookups need the whole list, not the first 100.\n return useAllPagesQuery<ListKnowledgeBasesQuery, KnowledgeBaseRecord>({\n document: ListKnowledgeBasesDocument,\n variables,\n pageSize: LIST_LIMIT,\n extractRows: selectKnowledgeBases,\n fallback: NO_KNOWLEDGE_BASES,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load knowledge bases',\n });\n}\n\nexport function useKnowledgeBase(\n kbId: string | undefined\n): QueryResult<KnowledgeBaseRecord | null> {\n const variables = useMemo(() => ({ id: kbId ?? '' }), [kbId]);\n\n return useWorkspaceQuery<GetKnowledgeBaseQuery, KnowledgeBaseRecord | null>({\n document: GetKnowledgeBaseDocument,\n variables,\n select: selectKnowledgeBase,\n fallback: null,\n enabled: Boolean(kbId),\n errorMessage: 'Failed to load knowledge base',\n });\n}\n\n/** Every document of a knowledge base: all pages, `loading` until the last one is in. */\nexport function useKnowledgeDocuments(\n kbId: string | undefined\n): QueryResult<KnowledgeDocumentRecord[]> {\n const variables = useMemo(() => ({ knowledgeBaseId: kbId ?? '' }), [kbId]);\n\n return useAllPagesQuery<ListKnowledgeDocumentsQuery, KnowledgeDocumentRecord>({\n document: ListKnowledgeDocumentsDocument,\n variables,\n pageSize: LIST_LIMIT,\n extractRows: selectDocuments,\n fallback: NO_DOCUMENTS,\n enabled: Boolean(kbId),\n errorMessage: 'Failed to load knowledge documents',\n });\n}\n\n/** What still uses a knowledge base: the live agents that have it attached (BOFF-12472). */\nexport interface KnowledgeBaseUsage {\n agents: Array<{ id: string; name: string; status: string }>;\n}\n\n/** Returns a function that reads what uses a knowledge base, fresh each time: a delete is about to rely on it. */\nexport function useLoadKnowledgeBaseUsage() {\n const client = useWorkspaceClient();\n\n return useCallback(\n async (kbId: string): Promise<KnowledgeBaseUsage> => {\n const result = await client.query<GetKnowledgeBaseUsageQuery>({\n query: GetKnowledgeBaseUsageDocument,\n variables: { id: kbId },\n fetchPolicy: 'network-only',\n });\n const operationError = (result as { error?: unknown }).error;\n if (operationError != null) {\n throw operationError instanceof Error\n ? operationError\n : new Error('Failed to load what uses this knowledge base');\n }\n return result.data?.getKnowledgeBaseUsage ?? { agents: [] };\n },\n [client]\n );\n}\n\n/** Removes one document and its vectors (`removeKnowledgeDocument`). */\nexport function useRemoveKnowledgeDocument() {\n return useWorkspaceMutation<RemoveKnowledgeDocumentMutation, string, boolean>({\n document: RemoveKnowledgeDocumentDocument,\n variables: (documentId) => ({ id: documentId }),\n select: (data) => data?.removeKnowledgeDocument,\n errorMessage: 'Failed to remove the document',\n });\n}\n\nexport function useCreateKnowledgeBase() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreateKnowledgeBaseVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_KB_FIELDS),\n }),\n [workspaceId]\n );\n\n return useWorkspaceMutation<\n CreateKnowledgeBaseMutation,\n CreateKnowledgeBaseVariables,\n { id: string; name: string; workspaceId: string }\n >({\n document: CreateKnowledgeBaseDocument,\n variables,\n select: (data) => data?.createKnowledgeBase,\n errorMessage: 'Failed to create knowledge base',\n });\n}\n\nexport function useUpdateKnowledgeBase() {\n return useWorkspaceMutation<\n UpdateKnowledgeBaseMutation,\n UpdateKnowledgeBaseVariables,\n { id: string; name: string; indexStatus: string }\n >({\n document: UpdateKnowledgeBaseDocument,\n variables: ({ kbId, input }) => ({\n id: kbId,\n input: buildMutationInput(input, UPDATE_KB_FIELDS),\n }),\n select: (data) => data?.updateKnowledgeBase,\n errorMessage: 'Failed to update knowledge base',\n });\n}\n\n/** Re-indexes every document in the knowledge base (`rebuildKnowledgeBaseIndex`). */\nexport function useRebuildKnowledgeBaseIndex() {\n return useWorkspaceMutation<RebuildKnowledgeBaseIndexMutation, string, boolean>({\n document: RebuildKnowledgeBaseIndexDocument,\n variables: (kbId) => ({ knowledgeBaseId: kbId }),\n select: (data) => data?.rebuildKnowledgeBaseIndex,\n errorMessage: 'Failed to rebuild the knowledge base index',\n });\n}\n\nexport function useDeleteKnowledgeBase() {\n return useWorkspaceMutation<DeleteKnowledgeBaseMutation, string, boolean>({\n document: DeleteKnowledgeBaseDocument,\n variables: (kbId) => ({ id: kbId }),\n select: (data) => data?.deleteKnowledgeBase,\n errorMessage: 'Failed to delete knowledge base',\n });\n}\n"],"mappings":";;;;;;AA6CA,IAAMA,IAAa,KAoDbC,IAAmBC,EAAmC;CAC1D,cAAc;CACd,WAAW;CACX,kBAAkB;CAClB,aAAa;CACb,qBAAqB;CACrB,gBAAgB;CAChB,UAAU;CACV,MAAM;CAEN,mBAAmB;CACnB,aAAa;AACf,CAAC,GAEKC,IAAmBD,EAAmC;CAC1D,cAAc;CACd,WAAW;CACX,kBAAkB;CAClB,aAAa;CACb,UAAU;CACV,MAAM;AACR,CAAC,GAEKE,IAA4C,CAAC,GAC7CC,IAA0C,CAAC;AAEjD,SAASC,EAAqB,GAAkE;CAC9F,OAAOC,GAAM,sBAAsBH;AACrC;AAEA,SAASI,EAAoB,GAAqE;CAChG,OAAOD,GAAM,oBAAoB;AACnC;AAEA,SAASE,EAAgB,GAA0E;CACjG,OAAOF,GAAM,0BAA0BF;AACzC;AAWA,SAAgBK,EAAkB,GAAyD;CACzF,IAAMC,IAAcC,EAAe,GAC7BC,IAASC,GAAQ,QAEjBC,IAAYC,SACT,EACL,SAAS;EAAE;EAAa,QAAQH,KAAU,KAAA;CAAU,EACtD,IACA,CAACF,GAAaE,CAAM,CACtB;CAGA,OAAOI,EAA+D;EACpE,UAAUC;EACV;EACA,UAAUlB;EACV,aAAaM;EACb,UAAUF;EACV,SAAS,EAAQO;EACjB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBQ,EACd,GACyC;CACzC,IAAMJ,IAAYC,SAAe,EAAE,IAAII,KAAQ,GAAG,IAAI,CAACA,CAAI,CAAC;CAE5D,OAAOC,EAAqE;EAC1E,UAAUC;EACV;EACA,QAAQd;EACR,UAAU;EACV,SAAS,EA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;CAChB,CAAC;AACH;AAGA,SAAgBmC,IAA+B;CAC7C,OAAOT,EAAyE;EAC9E,UAAUU;EACV,YAAY,OAAU,EAAE,iBAAiBvB,EAAK;EAC9C,SAAS,MAASb,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBqC,IAAyB;CACvC,OAAOX,EAAmE;EACxE,UAAUY;EACV,YAAY,OAAU,EAAE,IAAIzB,EAAK;EACjC,SAAS,MAASb,GAAM;EACxB,cAAc;CAChB,CAAC;AACH"}
@@ -1,138 +1,134 @@
1
1
  import { CreateMcpConnectionDocument as e, DeleteMcpConnectionDocument as t, GetMcpConnectionDocument as n, ListMcpConnectionsDocument as r, ListMcpResourcesDocument as i, ListMcpToolsDocument as a, TestMcpConnectionDocument as o, UpdateMcpConnectionDocument as s, UpdateMcpToolDocument as c } from "../../generated/wspace-operations.js";
2
- import { buildMutationInput as l, fieldsOf as u } from "./internal/mutationInput.js";
3
- import { useWorkspaceId as d, useWorkspaceMutation as f, useWorkspaceQuery as p } from "./internal/workspaceGateway.js";
4
- import { useCallback as m, useMemo as h } from "react";
2
+ import { useAllPagesQuery as l } from "./internal/allPages.js";
3
+ import { buildMutationInput as u, fieldsOf as d } from "./internal/mutationInput.js";
4
+ import { useWorkspaceId as f, useWorkspaceMutation as p, useWorkspaceQuery as m } from "./internal/workspaceGateway.js";
5
+ import { useCallback as h, useMemo as g } from "react";
5
6
  // src/botlit/hooks/useMCPServers.ts
6
- var g = 100, _ = u({
7
+ var _ = 100, v = d({
7
8
  config: !0,
8
9
  credentials: !0,
9
10
  metadata: !0,
10
11
  name: !0,
11
12
  type: !0,
12
13
  workspaceId: !0
13
- }), v = u({
14
+ }), y = d({
14
15
  config: !0,
15
16
  credentials: !0,
16
17
  metadata: !0,
17
18
  name: !0
18
- }), y = [], b = [], x = [];
19
- function S(e) {
19
+ }), b = [], x = [], S = [];
20
+ function C(e) {
20
21
  return e === "CONNECTED";
21
22
  }
22
- function C(e) {
23
+ function w(e) {
23
24
  let t = e.config?.url;
24
25
  return typeof t == "string" ? t : void 0;
25
26
  }
26
- function w(e) {
27
+ function T(e) {
27
28
  let t = e.config?.description;
28
29
  return typeof t == "string" ? t : void 0;
29
30
  }
30
- function T(e) {
31
- return e?.listMCPConnections ?? y;
32
- }
33
31
  function E(e) {
34
- return e?.getMCPConnection ?? null;
32
+ return e?.listMCPConnections ?? b;
35
33
  }
36
34
  function D(e) {
37
- return e?.listMCPTools ?? b;
35
+ return e?.getMCPConnection ?? null;
38
36
  }
39
37
  function O(e) {
40
- return e?.listMCPResources ?? x;
38
+ return e?.listMCPTools ?? x;
41
39
  }
42
40
  function k(e) {
43
- let t = d(), n = e?.search?.trim().toLowerCase() ?? "", i = h(() => ({
44
- filters: { workspaceId: t },
45
- pagination: {
46
- limit: g,
47
- offset: 0
48
- }
49
- }), [t]), a = m((e) => {
50
- let t = T(e);
51
- return n ? t.filter((e) => e.name.toLowerCase().includes(n)) : t;
52
- }, [n]);
53
- return p({
41
+ return e?.listMCPResources ?? S;
42
+ }
43
+ function A(e) {
44
+ let t = f(), n = e?.search?.trim().toLowerCase() ?? "", i = g(() => ({ filters: { workspaceId: t } }), [t]), a = l({
54
45
  document: r,
55
46
  variables: i,
56
- select: a,
57
- fallback: y,
47
+ pageSize: _,
48
+ extractRows: E,
49
+ fallback: b,
58
50
  enabled: !!t,
59
51
  errorMessage: "Failed to load MCP servers"
60
- });
52
+ }), o = g(() => n ? a.data.filter((e) => e.name.toLowerCase().includes(n)) : a.data, [a.data, n]);
53
+ return {
54
+ ...a,
55
+ data: o
56
+ };
61
57
  }
62
- function A(e) {
63
- let t = h(() => ({ id: e ?? "" }), [e]);
64
- return p({
58
+ function j(e) {
59
+ let t = g(() => ({ id: e ?? "" }), [e]);
60
+ return m({
65
61
  document: n,
66
62
  variables: t,
67
- select: E,
63
+ select: D,
68
64
  fallback: null,
69
65
  enabled: !!e,
70
66
  errorMessage: "Failed to load MCP server"
71
67
  });
72
68
  }
73
- function j(e) {
74
- let t = h(() => ({ connectionId: e ?? "" }), [e]);
75
- return p({
69
+ function M(e) {
70
+ let t = g(() => ({ connectionId: e ?? "" }), [e]);
71
+ return m({
76
72
  document: a,
77
73
  variables: t,
78
- select: D,
79
- fallback: b,
74
+ select: O,
75
+ fallback: x,
80
76
  enabled: !!e,
81
77
  errorMessage: "Failed to load MCP tools"
82
78
  });
83
79
  }
84
- function M(e) {
85
- let t = h(() => ({ connectionId: e ?? "" }), [e]);
86
- return p({
80
+ function N(e) {
81
+ let t = g(() => ({ connectionId: e ?? "" }), [e]);
82
+ return m({
87
83
  document: i,
88
84
  variables: t,
89
- select: O,
90
- fallback: x,
85
+ select: k,
86
+ fallback: S,
91
87
  enabled: !!e,
92
88
  errorMessage: "Failed to load MCP resources"
93
89
  });
94
90
  }
95
- function N() {
96
- let t = d(), n = m((e) => ({ input: l({
91
+ function P() {
92
+ let t = f(), n = h((e) => ({ input: u({
97
93
  ...e,
98
94
  workspaceId: t
99
- }, _) }), [t]);
100
- return f({
95
+ }, v) }), [t]);
96
+ return p({
101
97
  document: e,
102
98
  variables: n,
103
99
  select: (e) => e?.createMCPConnection,
104
100
  errorMessage: "Failed to connect MCP server"
105
101
  });
106
102
  }
107
- function P() {
108
- return f({
103
+ function F() {
104
+ return p({
109
105
  document: s,
110
106
  variables: ({ serverId: e, input: t }) => ({
111
107
  id: e,
112
- input: l(t, v)
108
+ input: u(t, y)
113
109
  }),
114
110
  select: (e) => e?.updateMCPConnection,
115
111
  errorMessage: "Failed to update MCP server"
116
112
  });
117
113
  }
118
- function F() {
119
- return f({
114
+ function I() {
115
+ return p({
120
116
  document: t,
121
117
  variables: (e) => ({ id: e }),
122
118
  select: (e) => e?.deleteMCPConnection,
123
119
  errorMessage: "Failed to disconnect MCP server"
124
120
  });
125
121
  }
126
- function I() {
127
- return f({
122
+ function L() {
123
+ return p({
128
124
  document: o,
129
125
  variables: (e) => ({ id: e }),
130
126
  select: (e) => e?.testMCPConnection,
131
127
  errorMessage: "Failed to test MCP connection"
132
128
  });
133
129
  }
134
- function L() {
135
- return f({
130
+ function R() {
131
+ return p({
136
132
  document: c,
137
133
  variables: ({ toolId: e, input: t }) => ({
138
134
  id: e,
@@ -142,6 +138,6 @@ function L() {
142
138
  errorMessage: "Failed to update MCP tool risk level"
143
139
  });
144
140
  }
145
- export { S as isMCPServerHealthy, w as mcpServerDescription, C as mcpServerEndpoint, N as useCreateMCPServer, F as useDeleteMCPServer, M as useMCPResources, A as useMCPServer, k as useMCPServers, j as useMCPTools, I as useTestMCPConnection, P as useUpdateMCPServer, L as useUpdateMCPTool };
141
+ export { C as isMCPServerHealthy, T as mcpServerDescription, w as mcpServerEndpoint, P as useCreateMCPServer, I as useDeleteMCPServer, N as useMCPResources, j as useMCPServer, A as useMCPServers, M as useMCPTools, L as useTestMCPConnection, F as useUpdateMCPServer, R as useUpdateMCPTool };
146
142
 
147
143
  //# sourceMappingURL=useMCPServers.js.map
@@ -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","select","useCallback","rows","row","useWorkspaceQuery","ListMcpConnectionsDocument","useMCPServer","serverId","GetMcpConnectionDocument","useMCPTools","ListMcpToolsDocument","useMCPResources","ListMcpResourcesDocument","useCreateMCPServer","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 { 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 credentials: true,\n metadata: true,\n name: true,\n type: true,\n workspaceId: true,\n});\n\nconst UPDATE_CONNECTION_FIELDS = fieldsOf<UpdateMcpConnectionInput>({\n config: true,\n credentials: true,\n metadata: true,\n name: 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 pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [workspaceId]\n );\n\n const select = useCallback(\n (data: ListMcpConnectionsQuery | undefined): MCPServerRecord[] => {\n const rows = selectServers(data);\n if (!search) return rows;\n return rows.filter((row) => row.name.toLowerCase().includes(search));\n },\n [search]\n );\n\n return useWorkspaceQuery<ListMcpConnectionsQuery, MCPServerRecord[]>({\n document: ListMcpConnectionsDocument,\n variables,\n select,\n fallback: NO_SERVERS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load MCP servers',\n });\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":";;;;;AAgDA,IAAMA,IAAa,KAkDbC,IAA2BC,EAAmC;CAClE,QAAQ;CACR,aAAa;CACb,UAAU;CACV,MAAM;CACN,MAAM;CACN,aAAa;AACf,CAAC,GAEKC,IAA2BD,EAAmC;CAClE,QAAQ;CACR,aAAa;CACb,UAAU;CACV,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,GAA8D;CACrF,OAAOH,GAAM,oBAAoBT;AACnC;AAYA,SAAgBa,EAAc,GAAqD;CACjF,IAAMC,IAAcC,EAAe,GAC7BC,IAASC,GAAQ,QAAQ,KAAK,CAAC,CAAC,YAAY,KAAK,IAEjDC,IAAYC,SACT;EAEL,SAAS,EAAE,eAAY;EACvB,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;EACA,SAAS,MAAS5B,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgB6B,IAAqB;CACnC,OAAOF,EAIL;EACA,UAAUG;EACV,YAAY,EAAE,aAAU,gBAAa;GACnC,IAAIZ;GACJ,OAAOO,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,IAAId,EAAS;EACzC,SAAS,MAASlB,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBiC,IAAuB;CACrC,OAAON,EAAiE;EACtE,UAAUO;EACV,YAAY,OAAc,EAAE,IAAIhB,EAAS;EACzC,SAAS,MAASlB,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 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 credentials: true,\n metadata: true,\n name: true,\n type: true,\n workspaceId: true,\n});\n\nconst UPDATE_CONNECTION_FIELDS = fieldsOf<UpdateMcpConnectionInput>({\n config: true,\n credentials: true,\n metadata: true,\n name: 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,aAAa;CACb,UAAU;CACV,MAAM;CACN,MAAM;CACN,aAAa;AACf,CAAC,GAEKC,IAA2BD,EAAmC;CAClE,QAAQ;CACR,aAAa;CACb,UAAU;CACV,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,GAA8D;CACrF,OAAOH,GAAM,oBAAoBT;AACnC;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