@burdenoff/microfe-botmanor 2026.1123.2 → 2026.1123.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.
- package/dist/botlit/hooks/internal/workspaceGateway.d.ts +6 -8
- package/dist/botlit/hooks/internal/workspaceGateway.js +32 -27
- package/dist/botlit/hooks/internal/workspaceGateway.js.map +1 -1
- package/dist/botlit/hooks/useBots.js +64 -62
- package/dist/botlit/hooks/useBots.js.map +1 -1
- package/dist/botlit/hooks/useLLMProviders.js +1 -0
- package/dist/botlit/hooks/useLLMProviders.js.map +1 -1
- package/dist/botlit/hooks/useMCPServers.js +5 -1
- package/dist/botlit/hooks/useMCPServers.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +96 -0
- package/dist/generated/wspace-operations.js +146 -116
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +22716 -1548
- package/dist/generated/wspace-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -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 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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,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 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;GAAIC;GAAMC;EAAU;EACjF,SAAS,EAAQH;EACjB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AY,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"}
|
|
@@ -6,16 +6,20 @@ import { useCallback as h, useMemo as g } from "react";
|
|
|
6
6
|
// src/botlit/hooks/useMCPServers.ts
|
|
7
7
|
var _ = 100, v = d({
|
|
8
8
|
config: !0,
|
|
9
|
+
credential: !0,
|
|
9
10
|
credentials: !0,
|
|
10
11
|
metadata: !0,
|
|
11
12
|
name: !0,
|
|
12
13
|
type: !0,
|
|
13
14
|
workspaceId: !0
|
|
14
15
|
}), y = d({
|
|
16
|
+
clearCredential: !0,
|
|
15
17
|
config: !0,
|
|
18
|
+
credential: !0,
|
|
16
19
|
credentials: !0,
|
|
17
20
|
metadata: !0,
|
|
18
|
-
name: !0
|
|
21
|
+
name: !0,
|
|
22
|
+
type: !0
|
|
19
23
|
}), b = [], x = [], S = [];
|
|
20
24
|
function C(e) {
|
|
21
25
|
return e === "CONNECTED";
|
|
@@ -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 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;CAC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;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 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,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,EACzB,IACA,CAACL,CAAW,CACd,GAGMM,IAAMC,EAA2D;EACrE,UAAUC;EACV;EACA,UAAU5B;EACV,aAAac;EACb,UAAUV;EACV,SAAS,EA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C,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"}
|
|
@@ -127,6 +127,10 @@ export type ChannelPlatform =
|
|
|
127
127
|
| 'SMS'
|
|
128
128
|
/** Microsoft Teams */
|
|
129
129
|
| 'TEAMS'
|
|
130
|
+
/** Custom webchat widget */
|
|
131
|
+
| 'WEBCHAT'
|
|
132
|
+
/** Generic HTTP webhook */
|
|
133
|
+
| 'WEBHOOK'
|
|
130
134
|
/** WhatsApp Business */
|
|
131
135
|
| 'WHATSAPP';
|
|
132
136
|
export type ChannelRouteFilterInput = {
|
|
@@ -155,6 +159,12 @@ export type ConnectionFilterInput = {
|
|
|
155
159
|
providerId?: string | number | null | undefined;
|
|
156
160
|
search?: string | null | undefined;
|
|
157
161
|
status?: ConnectionStatus | null | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Any of these statuses, e.g. [ERROR, EXPIRED] for "Needs attention". An empty list is the same as
|
|
164
|
+
* omitting it. When `status` is also given a connection must match both (so the result is
|
|
165
|
+
* narrowed, never widened).
|
|
166
|
+
*/
|
|
167
|
+
statuses?: Array<ConnectionStatus> | null | undefined;
|
|
158
168
|
};
|
|
159
169
|
export type ConnectionStatus = 'ACTIVE' | 'ERROR' | 'EXPIRED' | 'INACTIVE' | 'PENDING_AUTH' | 'REVOKED';
|
|
160
170
|
/**
|
|
@@ -343,6 +353,8 @@ export type CreateKnowledgeBaseInput = {
|
|
|
343
353
|
};
|
|
344
354
|
export type CreateMcpConnectionInput = {
|
|
345
355
|
config: Record<string, unknown>;
|
|
356
|
+
credential?: McpCredentialInput | null | undefined;
|
|
357
|
+
/** @deprecated Use credential. A bare token string or { token } is stored as a bearer token. */
|
|
346
358
|
credentials?: Record<string, unknown> | null | undefined;
|
|
347
359
|
metadata?: Record<string, unknown> | null | undefined;
|
|
348
360
|
name: string;
|
|
@@ -504,6 +516,11 @@ export type HandleChannelMessageInput = {
|
|
|
504
516
|
conversationId?: string | number | null | undefined;
|
|
505
517
|
/** Platform event type (e.g. MESSAGE_CREATE, app_mention) */
|
|
506
518
|
eventType: string;
|
|
519
|
+
/**
|
|
520
|
+
* The platform's own id for this message (Slack: the message `ts`). A reply to
|
|
521
|
+
* a top-level channel message is threaded under it.
|
|
522
|
+
*/
|
|
523
|
+
externalMessageId?: string | null | undefined;
|
|
507
524
|
/** True when this message is a direct message to the bot */
|
|
508
525
|
isDm?: boolean | null | undefined;
|
|
509
526
|
/** Message ID already created by conversations-svc */
|
|
@@ -537,8 +554,12 @@ export type InstallPackageInput = {
|
|
|
537
554
|
workspaceId: string | number;
|
|
538
555
|
};
|
|
539
556
|
export type InstalledPackageFilterInput = {
|
|
557
|
+
kinds?: Array<PackageKind> | null | undefined;
|
|
540
558
|
mode?: InstallMode | null | undefined;
|
|
541
559
|
packageId?: string | number | null | undefined;
|
|
560
|
+
packageIds?: Array<string | number> | null | undefined;
|
|
561
|
+
search?: string | null | undefined;
|
|
562
|
+
updateAvailable?: boolean | null | undefined;
|
|
542
563
|
workspaceId: string | number;
|
|
543
564
|
};
|
|
544
565
|
export type IntegrationsPaginationInput = {
|
|
@@ -558,11 +579,20 @@ export type LlmModelFilterInput = {
|
|
|
558
579
|
supportsVision?: boolean | null | undefined;
|
|
559
580
|
};
|
|
560
581
|
export type McpConnectionFilterInput = {
|
|
582
|
+
search?: string | null | undefined;
|
|
583
|
+
sort?: McpConnectionSort | null | undefined;
|
|
561
584
|
status?: McpConnectionStatus | null | undefined;
|
|
562
585
|
type?: string | null | undefined;
|
|
563
586
|
workspaceId?: string | number | null | undefined;
|
|
564
587
|
};
|
|
588
|
+
export type McpConnectionSort = 'NAME_ASC' | 'NAME_DESC' | 'NEWEST' | 'OLDEST';
|
|
565
589
|
export type McpConnectionStatus = 'CONNECTED' | 'CONNECTING' | 'DISCONNECTED' | 'ERROR';
|
|
590
|
+
export type McpCredentialInput = {
|
|
591
|
+
headerName?: string | null | undefined;
|
|
592
|
+
scheme: McpCredentialScheme;
|
|
593
|
+
secret: string;
|
|
594
|
+
};
|
|
595
|
+
export type McpCredentialScheme = 'API_KEY_HEADER' | 'BEARER';
|
|
566
596
|
export type McpToolRiskLevel = 'HIGH' | 'LOW' | 'MEDIUM';
|
|
567
597
|
export type PackageKind = 'A2A_AGENT' | 'AGENT' | 'APP' | 'CHANNEL_TEMPLATE' | 'INTEGRATION' | 'KB_TEMPLATE' | 'KNOWLEDGE_BASE' | 'MCP_PACK' | 'POLICY_BUNDLE' | 'PROMPT' | 'PROMPT_TEMPLATE' | 'RETRIEVAL_PROFILE' | 'SKILL' | 'TEMPLATE' | 'TOOL' | 'WORKFLOW';
|
|
568
598
|
/** Standard pagination input */
|
|
@@ -769,6 +799,8 @@ export type UpdateBotmanorAgentInput = {
|
|
|
769
799
|
};
|
|
770
800
|
export type UpdateBotmanorLlmProviderInput = {
|
|
771
801
|
apiEndpoint?: string | null | undefined;
|
|
802
|
+
/** Remove the stored encrypted API key (BOFF-12706). */
|
|
803
|
+
clearCredentials?: boolean | null | undefined;
|
|
772
804
|
connectionId?: string | null | undefined;
|
|
773
805
|
credentials?: Record<string, unknown> | null | undefined;
|
|
774
806
|
isActive?: boolean | null | undefined;
|
|
@@ -845,12 +877,17 @@ export type UpdateKnowledgeBaseInput = {
|
|
|
845
877
|
name?: string | null | undefined;
|
|
846
878
|
};
|
|
847
879
|
export type UpdateMcpConnectionInput = {
|
|
880
|
+
clearCredential?: boolean | null | undefined;
|
|
848
881
|
config?: Record<string, unknown> | null | undefined;
|
|
882
|
+
credential?: McpCredentialInput | null | undefined;
|
|
883
|
+
/** @deprecated Use credential. A bare token string or { token } is stored as a bearer token. */
|
|
849
884
|
credentials?: Record<string, unknown> | null | undefined;
|
|
850
885
|
metadata?: Record<string, unknown> | null | undefined;
|
|
851
886
|
name?: string | null | undefined;
|
|
887
|
+
type?: string | null | undefined;
|
|
852
888
|
};
|
|
853
889
|
export type UpdateMcpToolInput = {
|
|
890
|
+
enabled?: boolean | null | undefined;
|
|
854
891
|
riskLevel?: McpToolRiskLevel | null | undefined;
|
|
855
892
|
};
|
|
856
893
|
export type UpdatePolicyInput = {
|
|
@@ -1541,6 +1578,39 @@ export type DeleteBotAppMutationVariables = Exact<{
|
|
|
1541
1578
|
export type DeleteBotAppMutation = {
|
|
1542
1579
|
deleteBotApp: boolean;
|
|
1543
1580
|
};
|
|
1581
|
+
export type ListBotAppsPageQueryVariables = Exact<{
|
|
1582
|
+
filters?: Types.BotAppFilterInput | null | undefined;
|
|
1583
|
+
pagination?: Types.PaginationInput | null | undefined;
|
|
1584
|
+
}>;
|
|
1585
|
+
export type ListBotAppsPageQuery = {
|
|
1586
|
+
listBotAppsPage: {
|
|
1587
|
+
nextOffset: number | null;
|
|
1588
|
+
items: Array<{
|
|
1589
|
+
id: string;
|
|
1590
|
+
name: string;
|
|
1591
|
+
slug: string;
|
|
1592
|
+
description: string | null;
|
|
1593
|
+
icon: string | null;
|
|
1594
|
+
type: Types.BotAppType;
|
|
1595
|
+
status: Types.BotAppStatus;
|
|
1596
|
+
visibility: Types.BotAppVisibility;
|
|
1597
|
+
routingStrategy: Types.RoutingStrategy;
|
|
1598
|
+
defaultAgentId: string | null;
|
|
1599
|
+
welcomeMessage: string | null;
|
|
1600
|
+
fallbackMessage: string | null;
|
|
1601
|
+
workflowId: string | null;
|
|
1602
|
+
executionCount: number;
|
|
1603
|
+
lastExecutedAt: string | null;
|
|
1604
|
+
tagIds: Array<string>;
|
|
1605
|
+
tags: Record<string, unknown>;
|
|
1606
|
+
createdAt: string;
|
|
1607
|
+
updatedAt: string;
|
|
1608
|
+
createdById: string;
|
|
1609
|
+
updatedById: string;
|
|
1610
|
+
workspaceId: string;
|
|
1611
|
+
}>;
|
|
1612
|
+
};
|
|
1613
|
+
};
|
|
1544
1614
|
export type GetBucketQueryVariables = Exact<{
|
|
1545
1615
|
id: string | number;
|
|
1546
1616
|
}>;
|
|
@@ -5013,6 +5083,32 @@ export declare function useDeleteBotAppMutation(baseOptions?: ApolloReactHooks.M
|
|
|
5013
5083
|
export type DeleteBotAppMutationHookResult = ReturnType<typeof useDeleteBotAppMutation>;
|
|
5014
5084
|
export type DeleteBotAppMutationResult = Apollo.MutationResult<Types.DeleteBotAppMutation>;
|
|
5015
5085
|
export type DeleteBotAppMutationOptions = Apollo.BaseMutationOptions<Types.DeleteBotAppMutation, Types.DeleteBotAppMutationVariables>;
|
|
5086
|
+
export declare const ListBotAppsPageDocument: Apollo.DocumentNode;
|
|
5087
|
+
/**
|
|
5088
|
+
* __useListBotAppsPageQuery__
|
|
5089
|
+
*
|
|
5090
|
+
* To run a query within a React component, call `useListBotAppsPageQuery` and pass it any options that fit your needs.
|
|
5091
|
+
* When your component renders, `useListBotAppsPageQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
5092
|
+
* you can use to render your UI.
|
|
5093
|
+
*
|
|
5094
|
+
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
5095
|
+
*
|
|
5096
|
+
* @example
|
|
5097
|
+
* const { data, loading, error } = useListBotAppsPageQuery({
|
|
5098
|
+
* variables: {
|
|
5099
|
+
* filters: // value for 'filters'
|
|
5100
|
+
* pagination: // value for 'pagination'
|
|
5101
|
+
* },
|
|
5102
|
+
* });
|
|
5103
|
+
*/
|
|
5104
|
+
export declare function useListBotAppsPageQuery(baseOptions?: ApolloReactHooks.QueryHookOptions<Types.ListBotAppsPageQuery, Types.ListBotAppsPageQueryVariables>): ApolloReactHooks.useQuery.Result<Types.ListBotAppsPageQuery, Types.ListBotAppsPageQueryVariables, "empty" | "complete" | "streaming", Types.ListBotAppsPageQueryVariables, undefined>;
|
|
5105
|
+
export declare function useListBotAppsPageLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.ListBotAppsPageQuery, Types.ListBotAppsPageQueryVariables>): ApolloReactHooks.useLazyQuery.ResultTuple<Types.ListBotAppsPageQuery, Types.ListBotAppsPageQueryVariables, "empty" | "complete" | "streaming", undefined>;
|
|
5106
|
+
export declare function useListBotAppsPageSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.ListBotAppsPageQuery, Types.ListBotAppsPageQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.ListBotAppsPageQuery, Types.ListBotAppsPageQueryVariables>;
|
|
5107
|
+
export declare function useListBotAppsPageSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.ListBotAppsPageQuery, Types.ListBotAppsPageQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.ListBotAppsPageQuery | undefined, Types.ListBotAppsPageQueryVariables>;
|
|
5108
|
+
export type ListBotAppsPageQueryHookResult = ReturnType<typeof useListBotAppsPageQuery>;
|
|
5109
|
+
export type ListBotAppsPageLazyQueryHookResult = ReturnType<typeof useListBotAppsPageLazyQuery>;
|
|
5110
|
+
export type ListBotAppsPageSuspenseQueryHookResult = ReturnType<typeof useListBotAppsPageSuspenseQuery>;
|
|
5111
|
+
export type ListBotAppsPageQueryResult = Apollo.QueryResult<Types.ListBotAppsPageQuery, Types.ListBotAppsPageQueryVariables>;
|
|
5016
5112
|
export declare const GetBucketDocument: Apollo.DocumentNode;
|
|
5017
5113
|
/**
|
|
5018
5114
|
* __useGetBucketQuery__
|