@burdenoff/microfe-botmanor 2026.1002.1 → 2026.1007.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/botlit/components/AssistantChannelPanel.js +109 -0
- package/dist/botlit/components/AssistantChannelPanel.js.map +1 -0
- package/dist/botlit/components/AssistantRuntimeSetupPanel.js +76 -0
- package/dist/botlit/components/AssistantRuntimeSetupPanel.js.map +1 -0
- package/dist/botlit/components/AssistantWebsitePanel.js +196 -0
- package/dist/botlit/components/AssistantWebsitePanel.js.map +1 -0
- package/dist/botlit/components/KnowledgeSourceImportPanel.js +135 -0
- package/dist/botlit/components/KnowledgeSourceImportPanel.js.map +1 -0
- package/dist/botlit/hooks/useAgents.js +12 -12
- package/dist/botlit/hooks/useAgents.js.map +1 -1
- package/dist/botlit/hooks/useAssistantChannels.js +76 -0
- package/dist/botlit/hooks/useAssistantChannels.js.map +1 -0
- package/dist/botlit/hooks/useAssistantRuntimeSetup.js +112 -0
- package/dist/botlit/hooks/useAssistantRuntimeSetup.js.map +1 -0
- package/dist/botlit/hooks/useAssistantWebsites.js +85 -0
- package/dist/botlit/hooks/useAssistantWebsites.js.map +1 -0
- package/dist/botlit/hooks/useKnowledgeBases.js +1 -0
- package/dist/botlit/hooks/useKnowledgeBases.js.map +1 -1
- package/dist/botlit/hooks/useKnowledgeSourceImports.js +86 -0
- package/dist/botlit/hooks/useKnowledgeSourceImports.js.map +1 -0
- package/dist/botlit/hooks/useLLMProviders.js +2 -2
- package/dist/botlit/hooks/useLLMProviders.js.map +1 -1
- package/dist/botlit/pages/AgentDetailPage.js +180 -158
- package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/ChatPage.js +58 -238
- package/dist/botlit/pages/ChatPage.js.map +1 -1
- package/dist/botlit/pages/KnowledgeBaseDetailPage.js +162 -160
- package/dist/botlit/pages/KnowledgeBaseDetailPage.js.map +1 -1
- package/dist/generated/global-types.js.map +1 -1
- package/dist/generated/wspace-operations.js +11 -11
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKnowledgeSourceImports.js","names":[],"sources":["../../../src/botlit/hooks/useKnowledgeSourceImports.ts"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { useBotlit } from '../providers/BotlitProvider';\n\ninterface SourceImport {\n id: string;\n knowledgeBaseId: string;\n title: string;\n status: string;\n failureCount: number;\n errorCode: string | null;\n documentId: string | null;\n}\nexport interface SourceImportInput {\n clientRequestId: string;\n title: string;\n sourceUrl?: string;\n content?: string;\n}\nconst LIST = gql`\n query KnowledgeSourceImports($knowledgeBaseId: ID!) {\n knowledgeSourceImports(knowledgeBaseId: $knowledgeBaseId) {\n id\n knowledgeBaseId\n title\n status\n failureCount\n errorCode\n documentId\n }\n }\n`;\nconst QUEUE = gql`\n mutation QueueKnowledgeSource($input: QueueKnowledgeSourceInput!) {\n queueKnowledgeSource(input: $input) {\n id\n knowledgeBaseId\n title\n status\n failureCount\n errorCode\n documentId\n }\n }\n`;\nconst RETRY = gql`\n mutation RetryKnowledgeSourceImport($id: ID!) {\n retryKnowledgeSourceImport(id: $id)\n }\n`;\nexport function useKnowledgeSourceImports(knowledgeBaseId: string) {\n const client = useGatewayClient('workspace'),\n cache = useQueryClient(),\n { workspaceId, currentUser } = useBotlit();\n const key = ['botmanor-knowledge-source-imports', workspaceId, currentUser?.id, knowledgeBaseId];\n const imports = useQuery({\n queryKey: key,\n enabled: Boolean(workspaceId && currentUser?.id && knowledgeBaseId),\n retry: false,\n refetchInterval: (query) =>\n query.state.data?.some((row) => ['READY', 'PROCESSING'].includes(row.status)) ? 5000 : false,\n queryFn: async () => {\n const response = await client.query<{ knowledgeSourceImports: SourceImport[] }>({\n query: LIST,\n variables: { knowledgeBaseId },\n fetchPolicy: 'no-cache',\n });\n const rows = response.data?.knowledgeSourceImports;\n if (!rows || rows.length > 100 || rows.some((row) => row.knowledgeBaseId !== knowledgeBaseId))\n throw new Error('Knowledge imports unavailable');\n return rows;\n },\n });\n const queue = useMutation({\n mutationFn: async (input: SourceImportInput) => {\n const response = await client.mutate<{ queueKnowledgeSource: SourceImport }>({\n mutation: QUEUE,\n variables: { input: { ...input, knowledgeBaseId } },\n });\n const row = response.data?.queueKnowledgeSource;\n if (!row || row.knowledgeBaseId !== knowledgeBaseId)\n throw new Error('Knowledge admission unavailable');\n return row;\n },\n onSuccess: () => cache.invalidateQueries({ queryKey: key }),\n });\n const retry = useMutation({\n mutationFn: async (id: string) => {\n const response = await client.mutate<{ retryKnowledgeSourceImport: boolean }>({\n mutation: RETRY,\n variables: { id },\n });\n if (!response.data?.retryKnowledgeSourceImport)\n throw new Error('Knowledge recovery unavailable');\n },\n onSuccess: () => cache.invalidateQueries({ queryKey: key }),\n });\n return { imports, queue, retry };\n}\n"],"mappings":";;;;;AAoBA,IAAM,IAAO,CAAG;;;;;;;;;;;;GAaV,IAAQ,CAAG;;;;;;;;;;;;GAaX,IAAQ,CAAG;;;;;AAKjB,SAAgB,EAA0B,GAAyB;CACjE,IAAM,IAAS,EAAiB,YAAY,EAC1C,IAAQ,GAAgB,EACxB,EAAE,gBAAa,mBAAgB,GAAW,EACtC,IAAM;EAAC;EAAqC;EAAa,GAAa;EAAI;EAAgB;AA2ChG,QAAO;EAAE,SA1CO,EAAS;GACvB,UAAU;GACV,SAAS,GAAQ,KAAe,GAAa,MAAM;GACnD,OAAO;GACP,kBAAkB,MAChB,EAAM,MAAM,MAAM,MAAM,MAAQ,CAAC,SAAS,aAAa,CAAC,SAAS,EAAI,OAAO,CAAC,GAAG,MAAO;GACzF,SAAS,YAAY;IAMnB,IAAM,KALW,MAAM,EAAO,MAAkD;KAC9E,OAAO;KACP,WAAW,EAAE,oBAAiB;KAC9B,aAAa;KACd,CAAC,EACoB,MAAM;AAC5B,QAAI,CAAC,KAAQ,EAAK,SAAS,OAAO,EAAK,MAAM,MAAQ,EAAI,oBAAoB,EAAgB,CAC3F,OAAU,MAAM,gCAAgC;AAClD,WAAO;;GAEV,CAAC;EAyBgB,OAxBJ,EAAY;GACxB,YAAY,OAAO,MAA6B;IAK9C,IAAM,KAJW,MAAM,EAAO,OAA+C;KAC3E,UAAU;KACV,WAAW,EAAE,OAAO;MAAE,GAAG;MAAO;MAAiB,EAAE;KACpD,CAAC,EACmB,MAAM;AAC3B,QAAI,CAAC,KAAO,EAAI,oBAAoB,EAClC,OAAU,MAAM,kCAAkC;AACpD,WAAO;;GAET,iBAAiB,EAAM,kBAAkB,EAAE,UAAU,GAAK,CAAC;GAC5D,CAAC;EAYuB,OAXX,EAAY;GACxB,YAAY,OAAO,MAAe;AAKhC,QAAI,EAJa,MAAM,EAAO,OAAgD;KAC5E,UAAU;KACV,WAAW,EAAE,OAAI;KAClB,CAAC,EACY,MAAM,2BAClB,OAAU,MAAM,iCAAiC;;GAErD,iBAAiB,EAAM,kBAAkB,EAAE,UAAU,GAAK,CAAC;GAC5D,CAAC;EAC8B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildMutationInput as e, fieldsOf as t } from "./internal/mutationInput.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CreateBotmanorLlmProviderDocument as n, ListLlmModelsDocument as r, ListLlmProvidersDocument as i, UpdateLlmProviderDocument as a } from "../../generated/wspace-operations.js";
|
|
3
3
|
import { useWorkspaceId as o, useWorkspaceMutation as s, useWorkspaceQuery as c } from "./internal/workspaceGateway.js";
|
|
4
4
|
import { useCallback as l, useMemo as u } from "react";
|
|
5
5
|
//#region src/botlit/hooks/useLLMProviders.ts
|
|
@@ -57,7 +57,7 @@ function v() {
|
|
|
57
57
|
...n,
|
|
58
58
|
workspaceId: t
|
|
59
59
|
}, m) }),
|
|
60
|
-
select: (e) => e?.
|
|
60
|
+
select: (e) => e?.createBotmanorLLMProvider,
|
|
61
61
|
errorMessage: "Failed to create the LLM provider"
|
|
62
62
|
}), [c, u] = s({
|
|
63
63
|
document: a,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLLMProviders.js","names":[],"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 {\n
|
|
1
|
+
{"version":3,"file":"useLLMProviders.js","names":[],"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 {\n CreateBotmanorLlmProviderDocument,\n DeleteLlmProviderDocument,\n GetLlmProviderDocument,\n ListLlmModelsDocument,\n ListLlmProvidersDocument,\n TestLlmConnectionDocument,\n UpdateLlmProviderDocument,\n type CreateBotmanorLlmProviderMutation,\n type DeleteLlmProviderMutation,\n type GetLlmProviderQuery,\n type ListLlmModelsQuery,\n type ListLlmProvidersQuery,\n type TestLlmConnectionMutation,\n type UpdateLlmProviderMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateBotmanorLlmModelInput,\n CreateBotmanorLlmProviderInput,\n UpdateBotlitLlmProviderInput,\n} from '../../generated/wspace-types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 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 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>;\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<UpdateBotlitLlmProviderInput>({\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\nexport function useLLMProviders(): QueryResult<LLMProviderRecord[]> {\n const workspaceId = useWorkspaceId();\n\n const variables = useMemo(() => ({ pagination: { limit: LIST_LIMIT, offset: 0 } }), []);\n\n return useWorkspaceQuery<ListLlmProvidersQuery, LLMProviderRecord[]>({\n document: ListLlmProvidersDocument,\n variables,\n select: (data) => data?.listLLMProviders ?? NO_PROVIDERS,\n fallback: NO_PROVIDERS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load LLM 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<GetLlmProviderQuery, LLMProviderRecord | null>({\n document: GetLlmProviderDocument,\n variables,\n select: (data) => data?.getLLMProvider ?? 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 const workspaceId = useWorkspaceId();\n const providerId = filters?.providerId;\n\n const variables = useMemo(\n () => ({\n filters: providerId ? { providerId } : undefined,\n pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [providerId]\n );\n\n return useWorkspaceQuery<ListLlmModelsQuery, LLMModelRecord[]>({\n document: ListLlmModelsDocument,\n variables,\n select: (data) => data?.listLLMModels ?? NO_MODELS,\n fallback: NO_MODELS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load LLM models',\n });\n}\n\n/**\n * Creates a provider, or updates the one whose id the caller passes.\n * `UpdateBotlitLLMProviderInput` 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 UpdateLlmProviderMutation,\n { providerId: string; input: ConfigureLLMProviderVariables },\n LLMProviderRecord\n >({\n document: UpdateLlmProviderDocument,\n variables: ({ providerId, input }) => ({\n id: providerId,\n input: buildMutationInput(input, UPDATE_PROVIDER_FIELDS),\n }),\n select: (data) => data?.updateLLMProvider,\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/**\n * `createBotlitLLMModel` is not published on the supergraph — models are\n * catalogued by the service, so the UI cannot add custom ones yet.\n */\nexport function useCreateLLMModel() {\n const createModel = useCallback(async (_input: CreateBotmanorLlmModelInput): Promise<never> => {\n throw new Error(\"Custom model creation isn't available yet.\");\n }, []);\n\n return { createModel, isCreating: false, error: undefined };\n}\n"],"mappings":";;;;;AAyCA,IAAM,IAAa,IAuCb,IAAoC,EAAE,EACtC,IAA8B,EAAE,EAEhC,IAAyB,EAAyC;CACtE,aAAa;CACb,cAAc;CACd,aAAa;CACb,UAAU;CACV,MAAM;CACN,MAAM;CACN,aAAa;CACd,CAAC,EAEI,IAAyB,EAAuC;CACpE,aAAa;CACb,cAAc;CACd,aAAa;CACb,UAAU;CACV,UAAU;CACV,MAAM;CACP,CAAC;AASF,SAAgB,IA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