@burdenoff/microfe-botmanor 2026.1108.1 → 2026.1109.2

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 (335) hide show
  1. package/dist/botlit/BotlitRoutes.d.ts +2 -0
  2. package/dist/botlit/BotlitRoutes.js +40 -52
  3. package/dist/botlit/BotlitRoutes.js.map +1 -1
  4. package/dist/botlit/BotmanorRoot.d.ts +3 -0
  5. package/dist/botlit/BotmanorRoot.js +1 -2
  6. package/dist/botlit/BotmanorRoot.js.map +1 -1
  7. package/dist/botlit/BotmanorRootInner.d.ts +3 -0
  8. package/dist/botlit/BotmanorRootInner.js +9 -10
  9. package/dist/botlit/BotmanorRootInner.js.map +1 -1
  10. package/dist/botlit/components/AgentApprovalPanel.d.ts +20 -0
  11. package/dist/botlit/components/AgentApprovalPanel.js +49 -50
  12. package/dist/botlit/components/AgentApprovalPanel.js.map +1 -1
  13. package/dist/botlit/components/AiOperationsPanel.d.ts +14 -0
  14. package/dist/botlit/components/AiOperationsPanel.js +54 -55
  15. package/dist/botlit/components/AiOperationsPanel.js.map +1 -1
  16. package/dist/botlit/components/AssistantChannelPanel.d.ts +3 -0
  17. package/dist/botlit/components/AssistantChannelPanel.js +12 -13
  18. package/dist/botlit/components/AssistantChannelPanel.js.map +1 -1
  19. package/dist/botlit/components/AssistantRuntimeSetupPanel.d.ts +4 -0
  20. package/dist/botlit/components/AssistantRuntimeSetupPanel.js +14 -14
  21. package/dist/botlit/components/AssistantRuntimeSetupPanel.js.map +1 -1
  22. package/dist/botlit/components/AssistantWebsitePanel.d.ts +5 -0
  23. package/dist/botlit/components/AssistantWebsitePanel.js +15 -16
  24. package/dist/botlit/components/AssistantWebsitePanel.js.map +1 -1
  25. package/dist/botlit/components/Badge.d.ts +9 -0
  26. package/dist/botlit/components/Badge.js +1 -2
  27. package/dist/botlit/components/Badge.js.map +1 -1
  28. package/dist/botlit/components/Button.d.ts +10 -0
  29. package/dist/botlit/components/Button.js +1 -2
  30. package/dist/botlit/components/Button.js.map +1 -1
  31. package/dist/botlit/components/Card.d.ts +16 -0
  32. package/dist/botlit/components/Card.js +1 -2
  33. package/dist/botlit/components/Card.js.map +1 -1
  34. package/dist/botlit/components/ChannelSelectorSheet.d.ts +23 -0
  35. package/dist/botlit/components/ChannelSelectorSheet.js +1 -2
  36. package/dist/botlit/components/ChannelSelectorSheet.js.map +1 -1
  37. package/dist/botlit/components/EmptyState.d.ts +12 -0
  38. package/dist/botlit/components/EmptyState.js +1 -2
  39. package/dist/botlit/components/EmptyState.js.map +1 -1
  40. package/dist/botlit/components/ErrorState.d.ts +10 -0
  41. package/dist/botlit/components/ErrorState.js +5 -6
  42. package/dist/botlit/components/ErrorState.js.map +1 -1
  43. package/dist/botlit/components/Input.d.ts +27 -0
  44. package/dist/botlit/components/Input.js +1 -2
  45. package/dist/botlit/components/Input.js.map +1 -1
  46. package/dist/botlit/components/KnowledgeSourceImportPanel.d.ts +3 -0
  47. package/dist/botlit/components/KnowledgeSourceImportPanel.js +12 -13
  48. package/dist/botlit/components/KnowledgeSourceImportPanel.js.map +1 -1
  49. package/dist/botlit/components/ModelRegistrationPanel.d.ts +5 -0
  50. package/dist/botlit/components/ModelRegistrationPanel.js +1 -2
  51. package/dist/botlit/components/ModelRegistrationPanel.js.map +1 -1
  52. package/dist/botlit/components/PageLayout.d.ts +12 -0
  53. package/dist/botlit/components/PageLayout.js +1 -2
  54. package/dist/botlit/components/PageLayout.js.map +1 -1
  55. package/dist/botlit/components/QuotaExhaustedDialog.d.ts +9 -0
  56. package/dist/botlit/components/QuotaExhaustedDialog.js +1 -2
  57. package/dist/botlit/components/QuotaExhaustedDialog.js.map +1 -1
  58. package/dist/botlit/components/RetentionStatusPanel.d.ts +2 -0
  59. package/dist/botlit/components/RetentionStatusPanel.js +18 -19
  60. package/dist/botlit/components/RetentionStatusPanel.js.map +1 -1
  61. package/dist/botlit/components/RouteLoader.d.ts +23 -0
  62. package/dist/botlit/components/RouteLoader.js +1 -2
  63. package/dist/botlit/components/RouteLoader.js.map +1 -1
  64. package/dist/botlit/components/VersionHistoryPanel.d.ts +12 -0
  65. package/dist/botlit/components/VersionHistoryPanel.js +23 -24
  66. package/dist/botlit/components/VersionHistoryPanel.js.map +1 -1
  67. package/dist/botlit/components/WorkspaceRequired.d.ts +18 -0
  68. package/dist/botlit/components/WorkspaceRequired.js +1 -2
  69. package/dist/botlit/components/WorkspaceRequired.js.map +1 -1
  70. package/dist/botlit/components/index.d.ts +14 -0
  71. package/dist/botlit/hooks/index.d.ts +35 -0
  72. package/dist/botlit/hooks/index.js +16 -16
  73. package/dist/botlit/hooks/internal/mutationInput.d.ts +56 -0
  74. package/dist/botlit/hooks/internal/mutationInput.js +1 -2
  75. package/dist/botlit/hooks/internal/mutationInput.js.map +1 -1
  76. package/dist/botlit/hooks/internal/workspaceGateway.d.ts +54 -0
  77. package/dist/botlit/hooks/internal/workspaceGateway.js +17 -19
  78. package/dist/botlit/hooks/internal/workspaceGateway.js.map +1 -1
  79. package/dist/botlit/hooks/useA2A.d.ts +104 -0
  80. package/dist/botlit/hooks/useA2A.js +45 -45
  81. package/dist/botlit/hooks/useA2A.js.map +1 -1
  82. package/dist/botlit/hooks/useAgentApprovals.d.ts +62 -0
  83. package/dist/botlit/hooks/useAgentApprovals.js +38 -39
  84. package/dist/botlit/hooks/useAgentApprovals.js.map +1 -1
  85. package/dist/botlit/hooks/useAgents.d.ts +105 -0
  86. package/dist/botlit/hooks/useAgents.js +53 -54
  87. package/dist/botlit/hooks/useAgents.js.map +1 -1
  88. package/dist/botlit/hooks/useAiOperations.d.ts +95 -0
  89. package/dist/botlit/hooks/useAiOperations.js +20 -19
  90. package/dist/botlit/hooks/useAiOperations.js.map +1 -1
  91. package/dist/botlit/hooks/useAssistantChannels.d.ts +16 -0
  92. package/dist/botlit/hooks/useAssistantChannels.js +1 -2
  93. package/dist/botlit/hooks/useAssistantChannels.js.map +1 -1
  94. package/dist/botlit/hooks/useAssistantRuntimeSetup.d.ts +17 -0
  95. package/dist/botlit/hooks/useAssistantRuntimeSetup.js +1 -2
  96. package/dist/botlit/hooks/useAssistantRuntimeSetup.js.map +1 -1
  97. package/dist/botlit/hooks/useAssistantWebsites.d.ts +18 -0
  98. package/dist/botlit/hooks/useAssistantWebsites.js +1 -2
  99. package/dist/botlit/hooks/useAssistantWebsites.js.map +1 -1
  100. package/dist/botlit/hooks/useBotWorkflow.d.ts +22 -0
  101. package/dist/botlit/hooks/useBotWorkflow.js +1 -2
  102. package/dist/botlit/hooks/useBotWorkflow.js.map +1 -1
  103. package/dist/botlit/hooks/useBots.d.ts +68 -0
  104. package/dist/botlit/hooks/useBots.js +32 -33
  105. package/dist/botlit/hooks/useBots.js.map +1 -1
  106. package/dist/botlit/hooks/useBuckets.d.ts +62 -0
  107. package/dist/botlit/hooks/useBuckets.js +91 -58
  108. package/dist/botlit/hooks/useBuckets.js.map +1 -1
  109. package/dist/botlit/hooks/useChannels.d.ts +87 -0
  110. package/dist/botlit/hooks/useChannels.js +73 -73
  111. package/dist/botlit/hooks/useChannels.js.map +1 -1
  112. package/dist/botlit/hooks/useExecutions.d.ts +87 -0
  113. package/dist/botlit/hooks/useExecutions.js +37 -37
  114. package/dist/botlit/hooks/useExecutions.js.map +1 -1
  115. package/dist/botlit/hooks/useKnowledgeBases.d.ts +79 -0
  116. package/dist/botlit/hooks/useKnowledgeBases.js +40 -39
  117. package/dist/botlit/hooks/useKnowledgeBases.js.map +1 -1
  118. package/dist/botlit/hooks/useKnowledgeSourceImports.d.ts +21 -0
  119. package/dist/botlit/hooks/useKnowledgeSourceImports.js +1 -2
  120. package/dist/botlit/hooks/useKnowledgeSourceImports.js.map +1 -1
  121. package/dist/botlit/hooks/useLLMProviders.d.ts +66 -0
  122. package/dist/botlit/hooks/useLLMProviders.js +25 -26
  123. package/dist/botlit/hooks/useLLMProviders.js.map +1 -1
  124. package/dist/botlit/hooks/useMCPServers.d.ts +71 -0
  125. package/dist/botlit/hooks/useMCPServers.js +40 -38
  126. package/dist/botlit/hooks/useMCPServers.js.map +1 -1
  127. package/dist/botlit/hooks/usePolicies.d.ts +60 -0
  128. package/dist/botlit/hooks/usePolicies.js +49 -49
  129. package/dist/botlit/hooks/usePolicies.js.map +1 -1
  130. package/dist/botlit/hooks/usePromptTemplates.d.ts +88 -0
  131. package/dist/botlit/hooks/usePromptTemplates.js +57 -57
  132. package/dist/botlit/hooks/usePromptTemplates.js.map +1 -1
  133. package/dist/botlit/hooks/useRetention.d.ts +26 -0
  134. package/dist/botlit/hooks/useRetention.js +3 -3
  135. package/dist/botlit/hooks/useRetention.js.map +1 -1
  136. package/dist/botlit/hooks/useRetrievalProfiles.d.ts +75 -0
  137. package/dist/botlit/hooks/useRetrievalProfiles.js +47 -47
  138. package/dist/botlit/hooks/useRetrievalProfiles.js.map +1 -1
  139. package/dist/botlit/hooks/useSkills.d.ts +64 -0
  140. package/dist/botlit/hooks/useSkills.js +53 -53
  141. package/dist/botlit/hooks/useSkills.js.map +1 -1
  142. package/dist/botlit/hooks/useStore.d.ts +112 -0
  143. package/dist/botlit/hooks/useStore.js +55 -55
  144. package/dist/botlit/hooks/useStore.js.map +1 -1
  145. package/dist/botlit/hooks/useUserPlatformConnection.d.ts +80 -0
  146. package/dist/botlit/hooks/useUserPlatformConnection.js +19 -19
  147. package/dist/botlit/hooks/useUserPlatformConnection.js.map +1 -1
  148. package/dist/botlit/index.d.ts +15 -0
  149. package/dist/botlit/index.js +11 -11
  150. package/dist/botlit/pages/A2AAgentDetailPage.d.ts +6 -0
  151. package/dist/botlit/pages/A2AAgentDetailPage.js +171 -178
  152. package/dist/botlit/pages/A2AAgentDetailPage.js.map +1 -1
  153. package/dist/botlit/pages/A2ARegistryPage.d.ts +2 -0
  154. package/dist/botlit/pages/A2ARegistryPage.js +25 -26
  155. package/dist/botlit/pages/A2ARegistryPage.js.map +1 -1
  156. package/dist/botlit/pages/AgentApprovalsPage.d.ts +2 -0
  157. package/dist/botlit/pages/AgentApprovalsPage.js +32 -33
  158. package/dist/botlit/pages/AgentApprovalsPage.js.map +1 -1
  159. package/dist/botlit/pages/AgentBuilderPage.d.ts +2 -0
  160. package/dist/botlit/pages/AgentBuilderPage.js +59 -60
  161. package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
  162. package/dist/botlit/pages/AgentDetailPage.d.ts +2 -0
  163. package/dist/botlit/pages/AgentDetailPage.js +83 -84
  164. package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
  165. package/dist/botlit/pages/AgentsListPage.d.ts +2 -0
  166. package/dist/botlit/pages/AgentsListPage.js +71 -72
  167. package/dist/botlit/pages/AgentsListPage.js.map +1 -1
  168. package/dist/botlit/pages/AiOperationsPage.d.ts +2 -0
  169. package/dist/botlit/pages/AiOperationsPage.js +52 -53
  170. package/dist/botlit/pages/AiOperationsPage.js.map +1 -1
  171. package/dist/botlit/pages/BotChannelsTab.d.ts +7 -0
  172. package/dist/botlit/pages/BotChannelsTab.js +120 -122
  173. package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
  174. package/dist/botlit/pages/BotDetailPage.d.ts +7 -0
  175. package/dist/botlit/pages/BotDetailPage.js +353 -358
  176. package/dist/botlit/pages/BotDetailPage.js.map +1 -1
  177. package/dist/botlit/pages/BotWorkflowTab.d.ts +11 -0
  178. package/dist/botlit/pages/BotWorkflowTab.js +20 -21
  179. package/dist/botlit/pages/BotWorkflowTab.js.map +1 -1
  180. package/dist/botlit/pages/BotsListPage.d.ts +2 -0
  181. package/dist/botlit/pages/BotsListPage.js +52 -53
  182. package/dist/botlit/pages/BotsListPage.js.map +1 -1
  183. package/dist/botlit/pages/BucketDetailPage.d.ts +2 -0
  184. package/dist/botlit/pages/BucketDetailPage.js +251 -0
  185. package/dist/botlit/pages/BucketDetailPage.js.map +1 -0
  186. package/dist/botlit/pages/BucketsPage.d.ts +2 -0
  187. package/dist/botlit/pages/BucketsPage.js +260 -261
  188. package/dist/botlit/pages/BucketsPage.js.map +1 -1
  189. package/dist/botlit/pages/ChannelDetailPage.d.ts +6 -0
  190. package/dist/botlit/pages/ChannelDetailPage.js +97 -96
  191. package/dist/botlit/pages/ChannelDetailPage.js.map +1 -1
  192. package/dist/botlit/pages/ChannelRoutesPage.d.ts +2 -0
  193. package/dist/botlit/pages/ChannelRoutesPage.js +23 -24
  194. package/dist/botlit/pages/ChannelRoutesPage.js.map +1 -1
  195. package/dist/botlit/pages/ChannelsPage.d.ts +2 -0
  196. package/dist/botlit/pages/ChannelsPage.js +44 -45
  197. package/dist/botlit/pages/ChannelsPage.js.map +1 -1
  198. package/dist/botlit/pages/ChatPage.d.ts +1 -0
  199. package/dist/botlit/pages/ChatPage.js +10 -11
  200. package/dist/botlit/pages/ChatPage.js.map +1 -1
  201. package/dist/botlit/pages/DashboardPage.d.ts +2 -0
  202. package/dist/botlit/pages/DashboardPage.js +37 -38
  203. package/dist/botlit/pages/DashboardPage.js.map +1 -1
  204. package/dist/botlit/pages/ExecutionDetailPage.d.ts +2 -0
  205. package/dist/botlit/pages/ExecutionDetailPage.js +47 -48
  206. package/dist/botlit/pages/ExecutionDetailPage.js.map +1 -1
  207. package/dist/botlit/pages/ExecutionsPage.d.ts +2 -0
  208. package/dist/botlit/pages/ExecutionsPage.js +72 -70
  209. package/dist/botlit/pages/ExecutionsPage.js.map +1 -1
  210. package/dist/botlit/pages/InstalledPackagesPage.d.ts +2 -0
  211. package/dist/botlit/pages/InstalledPackagesPage.js +77 -78
  212. package/dist/botlit/pages/InstalledPackagesPage.js.map +1 -1
  213. package/dist/botlit/pages/KnowledgeBaseDetailPage.d.ts +6 -0
  214. package/dist/botlit/pages/KnowledgeBaseDetailPage.js +171 -181
  215. package/dist/botlit/pages/KnowledgeBaseDetailPage.js.map +1 -1
  216. package/dist/botlit/pages/KnowledgeBasesPage.d.ts +2 -0
  217. package/dist/botlit/pages/KnowledgeBasesPage.js +30 -31
  218. package/dist/botlit/pages/KnowledgeBasesPage.js.map +1 -1
  219. package/dist/botlit/pages/MCPServerDetailPage.d.ts +6 -0
  220. package/dist/botlit/pages/MCPServerDetailPage.js +82 -83
  221. package/dist/botlit/pages/MCPServerDetailPage.js.map +1 -1
  222. package/dist/botlit/pages/MCPServersPage.d.ts +2 -0
  223. package/dist/botlit/pages/MCPServersPage.js +54 -55
  224. package/dist/botlit/pages/MCPServersPage.js.map +1 -1
  225. package/dist/botlit/pages/PoliciesPage.d.ts +2 -0
  226. package/dist/botlit/pages/PoliciesPage.js +25 -26
  227. package/dist/botlit/pages/PoliciesPage.js.map +1 -1
  228. package/dist/botlit/pages/PolicyDetailPage.d.ts +6 -0
  229. package/dist/botlit/pages/PolicyDetailPage.js +257 -259
  230. package/dist/botlit/pages/PolicyDetailPage.js.map +1 -1
  231. package/dist/botlit/pages/PromptStudioPage.d.ts +2 -0
  232. package/dist/botlit/pages/PromptStudioPage.js +35 -35
  233. package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
  234. package/dist/botlit/pages/PromptTemplateDetailPage.d.ts +6 -0
  235. package/dist/botlit/pages/PromptTemplateDetailPage.js +363 -362
  236. package/dist/botlit/pages/PromptTemplateDetailPage.js.map +1 -1
  237. package/dist/botlit/pages/PromptTemplatesPage.d.ts +2 -0
  238. package/dist/botlit/pages/PromptTemplatesPage.js +26 -27
  239. package/dist/botlit/pages/PromptTemplatesPage.js.map +1 -1
  240. package/dist/botlit/pages/RetrievalProfileDetailPage.d.ts +6 -0
  241. package/dist/botlit/pages/RetrievalProfileDetailPage.js +150 -158
  242. package/dist/botlit/pages/RetrievalProfileDetailPage.js.map +1 -1
  243. package/dist/botlit/pages/RetrievalProfilesPage.d.ts +2 -0
  244. package/dist/botlit/pages/RetrievalProfilesPage.js +24 -25
  245. package/dist/botlit/pages/RetrievalProfilesPage.js.map +1 -1
  246. package/dist/botlit/pages/SettingsPage.d.ts +2 -0
  247. package/dist/botlit/pages/SettingsPage.js +124 -125
  248. package/dist/botlit/pages/SettingsPage.js.map +1 -1
  249. package/dist/botlit/pages/SkillDetailPage.d.ts +6 -0
  250. package/dist/botlit/pages/SkillDetailPage.js +216 -217
  251. package/dist/botlit/pages/SkillDetailPage.js.map +1 -1
  252. package/dist/botlit/pages/SkillsPage.d.ts +2 -0
  253. package/dist/botlit/pages/SkillsPage.js +24 -25
  254. package/dist/botlit/pages/SkillsPage.js.map +1 -1
  255. package/dist/botlit/pages/StorePackageDetailPage.d.ts +2 -0
  256. package/dist/botlit/pages/StorePackageDetailPage.js +38 -39
  257. package/dist/botlit/pages/StorePackageDetailPage.js.map +1 -1
  258. package/dist/botlit/pages/StorePage.d.ts +2 -0
  259. package/dist/botlit/pages/StorePage.js +135 -136
  260. package/dist/botlit/pages/StorePage.js.map +1 -1
  261. package/dist/botlit/pages/index.d.ts +38 -0
  262. package/dist/botlit/permissions/PermissionRequired.d.ts +20 -0
  263. package/dist/botlit/permissions/PermissionRequired.js +10 -11
  264. package/dist/botlit/permissions/PermissionRequired.js.map +1 -1
  265. package/dist/botlit/permissions/botmanorPermissions.d.ts +82 -0
  266. package/dist/botlit/permissions/botmanorPermissions.js +1 -2
  267. package/dist/botlit/permissions/botmanorPermissions.js.map +1 -1
  268. package/dist/botlit/permissions/index.d.ts +7 -0
  269. package/dist/botlit/permissions/index.js +4 -3
  270. package/dist/botlit/permissions/useBotmanorPermissions.d.ts +41 -0
  271. package/dist/botlit/permissions/useBotmanorPermissions.js +1 -2
  272. package/dist/botlit/permissions/useBotmanorPermissions.js.map +1 -1
  273. package/dist/botlit/providers/BotlitProvider.d.ts +14 -0
  274. package/dist/botlit/providers/BotlitProvider.js +3 -3
  275. package/dist/botlit/providers/BotlitProvider.js.map +1 -1
  276. package/dist/botlit/store/botlitStore.d.ts +85 -0
  277. package/dist/botlit/store/botlitStore.js +1 -2
  278. package/dist/botlit/store/botlitStore.js.map +1 -1
  279. package/dist/botlit/store/renamedKeyStorage.d.ts +13 -0
  280. package/dist/botlit/store/renamedKeyStorage.js +1 -2
  281. package/dist/botlit/store/renamedKeyStorage.js.map +1 -1
  282. package/dist/botlit/types/index.d.ts +1008 -0
  283. package/dist/botlit/utils/cn.d.ts +2 -0
  284. package/dist/botlit/utils/cn.js +1 -2
  285. package/dist/botlit/utils/cn.js.map +1 -1
  286. package/dist/botlit/utils/embedding-models.d.ts +9 -0
  287. package/dist/botlit/utils/embedding-models.js +1 -2
  288. package/dist/botlit/utils/embedding-models.js.map +1 -1
  289. package/dist/botlit/utils/errors.d.ts +19 -0
  290. package/dist/botlit/utils/errors.js +1 -2
  291. package/dist/botlit/utils/errors.js.map +1 -1
  292. package/dist/botlit/utils/formatters.d.ts +38 -0
  293. package/dist/botlit/utils/formatters.js +0 -1
  294. package/dist/botlit/utils/formatters.js.map +1 -1
  295. package/dist/botlit/utils/navigation.d.ts +19 -0
  296. package/dist/botlit/utils/navigation.js +1 -2
  297. package/dist/botlit/utils/navigation.js.map +1 -1
  298. package/dist/botlit/utils/policyConfig.d.ts +68 -0
  299. package/dist/botlit/utils/policyConfig.js +2 -3
  300. package/dist/botlit/utils/policyConfig.js.map +1 -1
  301. package/dist/botlit/utils/unions.d.ts +25 -0
  302. package/dist/botlit/utils/unions.js +1 -2
  303. package/dist/botlit/utils/unions.js.map +1 -1
  304. package/dist/dev/App.d.ts +2 -0
  305. package/dist/dev/main.d.ts +0 -0
  306. package/dist/generated/global-operations.d.ts +197 -0
  307. package/dist/generated/global-operations.js +1 -2
  308. package/dist/generated/global-operations.js.map +1 -1
  309. package/dist/generated/global-types.d.ts +27678 -0
  310. package/dist/generated/global-types.js +1 -2
  311. package/dist/generated/global-types.js.map +1 -1
  312. package/dist/generated/wspace-operations.d.ts +5489 -0
  313. package/dist/generated/wspace-operations.js +88 -84
  314. package/dist/generated/wspace-operations.js.map +1 -1
  315. package/dist/generated/wspace-types.d.ts +152017 -0
  316. package/dist/generated/wspace-types.js +1 -2
  317. package/dist/generated/wspace-types.js.map +1 -1
  318. package/dist/index.d.ts +5 -0
  319. package/dist/index.js +5 -6
  320. package/dist/shared/hooks/useTr.d.ts +16 -0
  321. package/dist/shared/hooks/useTr.js +1 -2
  322. package/dist/shared/hooks/useTr.js.map +1 -1
  323. package/dist/stories/Badge.stories.d.ts +11 -0
  324. package/dist/stories/Button.stories.d.ts +13 -0
  325. package/dist/stories/EmptyState.stories.d.ts +8 -0
  326. package/dist/stories/StatusBadge.stories.d.ts +9 -0
  327. package/dist/test/fixtures.d.ts +39 -0
  328. package/dist/test/happydom.d.ts +1 -0
  329. package/dist/test/renderPage.d.ts +18 -0
  330. package/dist/test/setup.d.ts +9 -0
  331. package/dist/utils/nativeBridge.d.ts +2 -0
  332. package/dist/utils/nativeBridge.js +1 -2
  333. package/package.json +87 -60
  334. package/dist/botlit/hooks/useConversations.js +0 -64
  335. package/dist/botlit/hooks/useConversations.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { buildMutationInput as e, fieldsOf as t } from "./internal/mutationInput.js";
2
- import { CreateKnowledgeBaseDocument as n, GetKnowledgeBaseDocument as r, ListKnowledgeBasesDocument as i, ListKnowledgeDocumentsDocument as a, RebuildKnowledgeBaseIndexDocument as o, UpdateKnowledgeBaseDocument as s } from "../../generated/wspace-operations.js";
1
+ import { CreateKnowledgeBaseDocument as e, GetKnowledgeBaseDocument as t, ListKnowledgeBasesDocument as n, ListKnowledgeDocumentsDocument as r, RebuildKnowledgeBaseIndexDocument as i, UpdateKnowledgeBaseDocument as a } from "../../generated/wspace-operations.js";
2
+ import { buildMutationInput as o, fieldsOf as s } from "./internal/mutationInput.js";
3
3
  import { useWorkspaceId as c, useWorkspaceMutation as l, useWorkspaceQuery as u } from "./internal/workspaceGateway.js";
4
4
  import { useCallback as d, useMemo as f } from "react";
5
- //#region src/botlit/hooks/useKnowledgeBases.ts
6
- var p = 100, m = t({
5
+ // src/botlit/hooks/useKnowledgeBases.ts
6
+ var p = 100, m = s({
7
7
  chunkOverlap: !0,
8
8
  chunkSize: !0,
9
9
  chunkingStrategy: !0,
@@ -14,7 +14,7 @@ var p = 100, m = t({
14
14
  name: !0,
15
15
  vectorStoreDriver: !0,
16
16
  workspaceId: !0
17
- }), h = t({
17
+ }), h = s({
18
18
  chunkOverlap: !0,
19
19
  chunkSize: !0,
20
20
  chunkingStrategy: !0,
@@ -32,19 +32,19 @@ function b(e) {
32
32
  return e?.listKnowledgeDocuments ?? _;
33
33
  }
34
34
  function x(e) {
35
- let t = c(), n = e?.search;
35
+ let t = c(), r = e?.search, i = f(() => ({
36
+ filters: {
37
+ workspaceId: t,
38
+ search: r || void 0
39
+ },
40
+ pagination: {
41
+ limit: p,
42
+ offset: 0
43
+ }
44
+ }), [t, r]);
36
45
  return u({
37
- document: i,
38
- variables: f(() => ({
39
- filters: {
40
- workspaceId: t,
41
- search: n || void 0
42
- },
43
- pagination: {
44
- limit: p,
45
- offset: 0
46
- }
47
- }), [t, n]),
46
+ document: n,
47
+ variables: i,
48
48
  select: v,
49
49
  fallback: g,
50
50
  enabled: !!t,
@@ -52,9 +52,10 @@ function x(e) {
52
52
  });
53
53
  }
54
54
  function S(e) {
55
+ let n = f(() => ({ id: e ?? "" }), [e]);
55
56
  return u({
56
- document: r,
57
- variables: f(() => ({ id: e ?? "" }), [e]),
57
+ document: t,
58
+ variables: n,
58
59
  select: y,
59
60
  fallback: null,
60
61
  enabled: !!e,
@@ -62,15 +63,16 @@ function S(e) {
62
63
  });
63
64
  }
64
65
  function C(e) {
66
+ let t = f(() => ({
67
+ knowledgeBaseId: e ?? "",
68
+ pagination: {
69
+ limit: p,
70
+ offset: 0
71
+ }
72
+ }), [e]);
65
73
  return u({
66
- document: a,
67
- variables: f(() => ({
68
- knowledgeBaseId: e ?? "",
69
- pagination: {
70
- limit: p,
71
- offset: 0
72
- }
73
- }), [e]),
74
+ document: r,
75
+ variables: t,
74
76
  select: b,
75
77
  fallback: _,
76
78
  enabled: !!e,
@@ -78,23 +80,23 @@ function C(e) {
78
80
  });
79
81
  }
80
82
  function w() {
81
- let t = c();
83
+ let t = c(), n = d((e) => ({ input: o({
84
+ ...e,
85
+ workspaceId: t
86
+ }, m) }), [t]);
82
87
  return l({
83
- document: n,
84
- variables: d((n) => ({ input: e({
85
- ...n,
86
- workspaceId: t
87
- }, m) }), [t]),
88
+ document: e,
89
+ variables: n,
88
90
  select: (e) => e?.createKnowledgeBase,
89
91
  errorMessage: "Failed to create knowledge base"
90
92
  });
91
93
  }
92
94
  function T() {
93
95
  return l({
94
- document: s,
95
- variables: ({ kbId: t, input: n }) => ({
96
- id: t,
97
- input: e(n, h)
96
+ document: a,
97
+ variables: ({ kbId: e, input: t }) => ({
98
+ id: e,
99
+ input: o(t, h)
98
100
  }),
99
101
  select: (e) => e?.updateKnowledgeBase,
100
102
  errorMessage: "Failed to update knowledge base"
@@ -102,13 +104,12 @@ function T() {
102
104
  }
103
105
  function E() {
104
106
  return l({
105
- document: o,
107
+ document: i,
106
108
  variables: (e) => ({ knowledgeBaseId: e }),
107
109
  select: (e) => e?.rebuildKnowledgeBaseIndex,
108
110
  errorMessage: "Failed to rebuild the knowledge base index"
109
111
  });
110
112
  }
111
- //#endregion
112
113
  export { w as useCreateKnowledgeBase, S as useKnowledgeBase, x as useKnowledgeBases, C as useKnowledgeDocuments, E as useRebuildKnowledgeBaseIndex, T as useUpdateKnowledgeBase };
113
114
 
114
115
  //# sourceMappingURL=useKnowledgeBases.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useKnowledgeBases.js","names":[],"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,IAAM,IAAa,KAoDb,IAAmB,EAAmC;CAC1D,cAAc;CACd,WAAW;CACX,kBAAkB;CAClB,aAAa;CACb,qBAAqB;CACrB,gBAAgB;CAChB,UAAU;CACV,MAAM;CAEN,mBAAmB;CACnB,aAAa;CACd,CAAC,EAEI,IAAmB,EAAmC;CAC1D,cAAc;CACd,WAAW;CACX,kBAAkB;CAClB,aAAa;CACb,UAAU;CACV,MAAM;CACP,CAAC,EAEI,IAA4C,EAAE,EAC9C,IAA0C,EAAE;AAElD,SAAS,EAAqB,GAAkE;AAC9F,QAAO,GAAM,sBAAsB;;AAGrC,SAAS,EAAoB,GAAqE;AAChG,QAAO,GAAM,oBAAoB;;AAGnC,SAAS,EAAgB,GAA0E;AACjG,QAAO,GAAM,0BAA0B;;AAYzC,SAAgB,EAAkB,GAAyD;CACzF,IAAM,IAAc,GAAgB,EAC9B,IAAS,GAAQ;AAUvB,QAAO,EAAkE;EACvE,UAAU;EACV,WAVgB,SACT;GACL,SAAS;IAAE;IAAa,QAAQ,KAAU,KAAA;IAAW;GACrD,YAAY;IAAE,OAAO;IAAY,QAAQ;IAAG;GAC7C,GACD,CAAC,GAAa,EAAO,CACtB;EAKC,QAAQ;EACR,UAAU;EACV,SAAS,EAAQ;EACjB,cAAc;EACf,CAAC;;AAGJ,SAAgB,EACd,GACyC;AAGzC,QAAO,EAAqE;EAC1E,UAAU;EACV,WAJgB,SAAe,EAAE,IAAI,KAAQ,IAAI,GAAG,CAAC,EAAK,CAAC;EAK3D,QAAQ;EACR,UAAU;EACV,SAAS,EAAQ;EACjB,cAAc;EACf,CAAC;;AAGJ,SAAgB,EACd,GACwC;AAMxC,QAAO,EAA0E;EAC/E,UAAU;EACV,WAPgB,SACT;GAAE,iBAAiB,KAAQ;GAAI,YAAY;IAAE,OAAO;IAAY,QAAQ;IAAG;GAAE,GACpF,CAAC,EAAK,CACP;EAKC,QAAQ;EACR,UAAU;EACV,SAAS,EAAQ;EACjB,cAAc;EACf,CAAC;;AAGJ,SAAgB,IAAyB;CACvC,IAAM,IAAc,GAAgB;AASpC,QAAO,EAIL;EACA,UAAU;EACV,WAbgB,GACf,OAAyC,EACxC,OAAO,EAAmB;GAAE,GAAG;GAAO;GAAa,EAAE,EAAiB,EACvE,GACD,CAAC,EAAY,CACd;EASC,SAAS,MAAS,GAAM;EACxB,cAAc;EACf,CAAC;;AAGJ,SAAgB,IAAyB;AACvC,QAAO,EAIL;EACA,UAAU;EACV,YAAY,EAAE,SAAM,gBAAa;GAC/B,IAAI;GACJ,OAAO,EAAmB,GAAO,EAAiB;GACnD;EACD,SAAS,MAAS,GAAM;EACxB,cAAc;EACf,CAAC;;AAIJ,SAAgB,IAA+B;AAC7C,QAAO,EAAyE;EAC9E,UAAU;EACV,YAAY,OAAU,EAAE,iBAAiB,GAAM;EAC/C,SAAS,MAAS,GAAM;EACxB,cAAc;EACf,CAAC"}
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,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;GAAE;GAAa,QAAQH,KAAU,KAAA;EAAU;EACpD,YAAY;GAAE,OAAOb;GAAY,QAAQ;EAAE;CAC7C,IACA,CAACW,GAAaE,CAAM,CACtB;CAEA,OAAOI,EAAkE;EACvE,UAAUC;EACV;EACA,QAAQZ;EACR,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,OAAOH,EAAqE;EAC1E,UAAUI;EACV;EACA,QAAQb;EACR,UAAU;EACV,SAAS,EAAQY;EACjB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBE,EACd,GACwC;CACxC,IAAMP,IAAYC,SACT;EAAE,iBAAiBI,KAAQ;EAAI,YAAY;GAAE,OAAOpB;GAAY,QAAQ;EAAE;CAAE,IACnF,CAACoB,CAAI,CACP;CAEA,OAAOH,EAA0E;EAC/E,UAAUM;EACV;EACA,QAAQd;EACR,UAAUJ;EACV,SAAS,EAAQe;EACjB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBI,IAAyB;CACvC,IAAMb,IAAcC,EAAe,GAE7BG,IAAYU,GACf,OAAyC,EACxC,OAAOC,EAAmB;EAAE,GAAGC;EAAO;CAAY,GAAG1B,CAAgB,EACvE,IACA,CAACU,CAAW,CACd;CAEA,OAAOiB,EAIL;EACA,UAAUC;EACV;EACA,SAAS,MAAStB,GAAM;EACxB,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"}
@@ -0,0 +1,21 @@
1
+ interface SourceImport {
2
+ id: string;
3
+ knowledgeBaseId: string;
4
+ title: string;
5
+ status: string;
6
+ failureCount: number;
7
+ errorCode: string | null;
8
+ documentId: string | null;
9
+ }
10
+ export interface SourceImportInput {
11
+ clientRequestId: string;
12
+ title: string;
13
+ sourceUrl?: string;
14
+ content?: string;
15
+ }
16
+ export declare function useKnowledgeSourceImports(knowledgeBaseId: string): {
17
+ imports: import('@tanstack/react-query').UseQueryResult<SourceImport[], Error>;
18
+ queue: import('@tanstack/react-query').UseMutationResult<SourceImport, Error, SourceImportInput, unknown>;
19
+ retry: import('@tanstack/react-query').UseMutationResult<void, Error, string, unknown>;
20
+ };
21
+ export {};
@@ -2,7 +2,7 @@ import { useBotlit as e } from "../providers/BotlitProvider.js";
2
2
  import { gql as t } from "@apollo/client";
3
3
  import { useGatewayClient as n } from "@burdenoff/fe-libs/shared/graphql";
4
4
  import { useMutation as r, useQuery as i, useQueryClient as a } from "@tanstack/react-query";
5
- //#region src/botlit/hooks/useKnowledgeSourceImports.ts
5
+ // src/botlit/hooks/useKnowledgeSourceImports.ts
6
6
  var o = t`
7
7
  query KnowledgeSourceImports($knowledgeBaseId: ID!) {
8
8
  knowledgeSourceImports(knowledgeBaseId: $knowledgeBaseId) {
@@ -80,7 +80,6 @@ function l(t) {
80
80
  })
81
81
  };
82
82
  }
83
- //#endregion
84
83
  export { l as useKnowledgeSourceImports };
85
84
 
86
85
  //# sourceMappingURL=useKnowledgeSourceImports.js.map
@@ -1 +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
+ {"version":3,"file":"useKnowledgeSourceImports.js","names":["LIST","QUEUE","RETRY","useKnowledgeSourceImports","client","useGatewayClient","cache","useQueryClient","useBotlit","key","workspaceId","currentUser","knowledgeBaseId","useQuery","query","row","rows","useMutation","input"],"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,IAAMA,IAAO,CAAG;;;;;;;;;;;;GAaVC,IAAQ,CAAG;;;;;;;;;;;;GAaXC,IAAQ,CAAG;;;;;AAKjB,SAAgBC,EAA0B,GAAyB;CACjE,IAAMC,IAASC,EAAiB,WAAW,GACzCC,IAAQC,EAAe,GACvB,EAAE,gBAAa,mBAAgBC,EAAU,GACrCC,IAAM;EAAC;EAAqCC;EAAaC,GAAa;EAAIC;CAAe;CA2C/F,OAAO;EAAE,SA1COC,EAAS;GACvB,UAAUJ;GACV,SAAS,GAAQC,KAAeC,GAAa,MAAMC;GACnD,OAAO;GACP,kBAAkB,MAChBE,EAAM,MAAM,MAAM,MAAM,MAAQ,CAAC,SAAS,YAAY,CAAC,CAAC,SAASC,EAAI,MAAM,CAAC,IAAI,MAAO;GACzF,SAAS,YAAY;IAMnB,IAAMC,KAAO,MALUZ,EAAO,MAAkD;KAC9E,OAAOJ;KACP,WAAW,EAAE,mBAAgB;KAC7B,aAAa;IACf,CAAC,EAAA,CACqB,MAAM;IAC5B,IAAI,CAACgB,KAAQA,EAAK,SAAS,OAAOA,EAAK,MAAM,MAAQD,EAAI,oBAAoBH,CAAe,GAC1F,MAAU,MAAM,+BAA+B;IACjD,OAAOI;GACT;EACF,CAyBS;EAAS,OAxBJC,EAAY;GACxB,YAAY,OAAO,MAA6B;IAK9C,IAAMF,KAAM,MAJWX,EAAO,OAA+C;KAC3E,UAAUH;KACV,WAAW,EAAE,OAAO;MAAE,GAAGiB;MAAO;KAAgB,EAAE;IACpD,CAAC,EAAA,CACoB,MAAM;IAC3B,IAAI,CAACH,KAAOA,EAAI,oBAAoBH,GAClC,MAAU,MAAM,iCAAiC;IACnD,OAAOG;GACT;GACA,iBAAiBT,EAAM,kBAAkB,EAAE,UAAUG,EAAI,CAAC;EAC5D,CAYkB;EAAO,OAXXQ,EAAY;GACxB,YAAY,OAAO,MAAe;IAKhC,IAAI,EAAC,MAJkBb,EAAO,OAAgD;KAC5E,UAAUF;KACV,WAAW,EAAE,MAAG;IAClB,CAAC,EAAA,CACa,MAAM,4BAClB,MAAU,MAAM,gCAAgC;GACpD;GACA,iBAAiBI,EAAM,kBAAkB,EAAE,UAAUG,EAAI,CAAC;EAC5D,CACyB;CAAM;AACjC"}
@@ -0,0 +1,66 @@
1
+ import { CreateBotmanorLlmModelInput, CreateBotmanorLlmProviderInput } from '../../generated/wspace-types';
2
+ import { GraphQLInput } from './internal/mutationInput';
3
+ import { QueryResult } from './internal/workspaceGateway';
4
+ export interface LLMProviderRecord {
5
+ id: string;
6
+ name: string;
7
+ type: string;
8
+ isActive: boolean;
9
+ apiEndpoint?: string | null;
10
+ credentialsHash?: string | null;
11
+ connectionId?: string | null;
12
+ metadata?: Record<string, unknown> | null;
13
+ createdAt: string;
14
+ updatedAt: string;
15
+ workspaceId: string;
16
+ }
17
+ export interface LLMModelRecord {
18
+ id: string;
19
+ name: string;
20
+ modelId: string;
21
+ providerId: string;
22
+ contextWindow: number;
23
+ maxOutputTokens: number;
24
+ inputPricePerMToken: number;
25
+ outputPricePerMToken: number;
26
+ isActive: boolean;
27
+ supportsStreaming: boolean;
28
+ supportsFunctionCalling: boolean;
29
+ supportsVision: boolean;
30
+ metadata?: Record<string, unknown> | null;
31
+ createdAt: string;
32
+ updatedAt: string;
33
+ }
34
+ /** `CreateBotmanorLLMProviderInput` minus the `workspaceId` the hook supplies. */
35
+ export type ConfigureLLMProviderVariables = Omit<GraphQLInput<CreateBotmanorLlmProviderInput>, 'workspaceId'> & {
36
+ isActive?: boolean;
37
+ };
38
+ export declare const llmProviderKeys: {
39
+ all: readonly ["llmProviders"];
40
+ lists: () => readonly ["llmProviders", "list"];
41
+ details: () => readonly ["llmProviders", "detail"];
42
+ detail: (id: string) => readonly ["llmProviders", "detail", string];
43
+ };
44
+ export declare function useLLMProviders(): QueryResult<LLMProviderRecord[]>;
45
+ export declare function useLLMProvider(providerId: string | undefined): QueryResult<LLMProviderRecord | null>;
46
+ export declare function useLLMModels(filters?: {
47
+ providerId?: string;
48
+ }): QueryResult<LLMModelRecord[]>;
49
+ /**
50
+ * Creates a provider, or updates the one whose id the caller passes.
51
+ * `UpdateBotmanorLLMProviderInput` has no `type`/`workspaceId`, so the update
52
+ * payload is projected onto the fields that input actually declares.
53
+ */
54
+ export declare function useConfigureLLMProvider(): {
55
+ configureProvider: (input: ConfigureLLMProviderVariables, existingId?: string) => Promise<LLMProviderRecord>;
56
+ isConfiguring: boolean;
57
+ error: Error | undefined;
58
+ };
59
+ export declare function useDeleteLLMProvider(): readonly [(input: string) => Promise<boolean>, import('./internal/workspaceGateway').MutationState<boolean>];
60
+ export declare function useTestLLMConnection(): readonly [(input: string) => Promise<boolean>, import('./internal/workspaceGateway').MutationState<boolean>];
61
+ /** Register models through the same authenticated workspace gateway as providers. */
62
+ export declare function useCreateLLMModel(): {
63
+ createModel: (input: CreateBotmanorLlmModelInput) => Promise<LLMModelRecord>;
64
+ isCreating: boolean;
65
+ error: Error | undefined;
66
+ };
@@ -1,11 +1,11 @@
1
1
  import { useBotlit as e } from "../providers/BotlitProvider.js";
2
- import { buildMutationInput as t, fieldsOf as n } from "./internal/mutationInput.js";
3
- import { CreateBotmanorLlmModelDocument as r, CreateBotmanorLlmProviderDocument as i, ListBotmanorLlmModelsDocument as a, ListBotmanorLlmProvidersDocument as o, UpdateBotmanorLlmProviderDocument as s } from "../../generated/wspace-operations.js";
2
+ import { CreateBotmanorLlmModelDocument as t, CreateBotmanorLlmProviderDocument as n, ListBotmanorLlmModelsDocument as r, ListBotmanorLlmProvidersDocument as i, UpdateBotmanorLlmProviderDocument as a } from "../../generated/wspace-operations.js";
3
+ import { buildMutationInput as o, fieldsOf as s } from "./internal/mutationInput.js";
4
4
  import { useWorkspaceClient as c, useWorkspaceId as l, useWorkspaceMutation as u } from "./internal/workspaceGateway.js";
5
5
  import { useCallback as d } from "react";
6
6
  import { useQuery as f } from "@tanstack/react-query";
7
- //#region src/botlit/hooks/useLLMProviders.ts
8
- var p = 50, m = [], h = [], g = n({
7
+ // src/botlit/hooks/useLLMProviders.ts
8
+ var p = 50, m = [], h = [], g = s({
9
9
  apiEndpoint: !0,
10
10
  connectionId: !0,
11
11
  credentials: !0,
@@ -13,7 +13,7 @@ var p = 50, m = [], h = [], g = n({
13
13
  name: !0,
14
14
  type: !0,
15
15
  workspaceId: !0
16
- }), _ = n({
16
+ }), _ = s({
17
17
  apiEndpoint: !0,
18
18
  connectionId: !0,
19
19
  credentials: !0,
@@ -64,42 +64,42 @@ function v(t, n, r, i, a) {
64
64
  };
65
65
  }
66
66
  function y() {
67
- return v(o, "providers", (e) => e?.listBotmanorLLMProviders ?? m, m);
67
+ return v(i, "providers", (e) => e?.listBotmanorLLMProviders ?? m, m);
68
68
  }
69
69
  function b(e) {
70
- return v(a, "models", (e) => e?.listBotmanorLLMModels ?? h, h, e?.providerId);
70
+ return v(r, "models", (e) => e?.listBotmanorLLMModels ?? h, h, e?.providerId);
71
71
  }
72
72
  function x() {
73
- let e = l(), [n, r] = u({
74
- document: i,
75
- variables: (n) => ({ input: t({
76
- ...n,
73
+ let e = l(), [t, r] = u({
74
+ document: n,
75
+ variables: (t) => ({ input: o({
76
+ ...t,
77
77
  workspaceId: e
78
78
  }, g) }),
79
79
  select: (e) => e?.createBotmanorLLMProvider,
80
80
  errorMessage: "Failed to create the LLM provider"
81
- }), [a, o] = u({
82
- document: s,
83
- variables: ({ providerId: e, input: n }) => ({
81
+ }), [i, s] = u({
82
+ document: a,
83
+ variables: ({ providerId: e, input: t }) => ({
84
84
  id: e,
85
- input: t(n, _)
85
+ input: o(t, _)
86
86
  }),
87
87
  select: (e) => e?.updateBotmanorLLMProvider,
88
88
  errorMessage: "Failed to update the LLM provider"
89
89
  });
90
90
  return {
91
- configureProvider: d(async (e, t) => t ? a({
92
- providerId: t,
91
+ configureProvider: d(async (e, n) => n ? i({
92
+ providerId: n,
93
93
  input: e
94
- }) : n(e), [n, a]),
95
- isConfiguring: r.loading || o.loading,
96
- error: r.error ?? o.error
94
+ }) : t(e), [t, i]),
95
+ isConfiguring: r.loading || s.loading,
96
+ error: r.error ?? s.error
97
97
  };
98
98
  }
99
99
  function S() {
100
- let [e, i] = u({
101
- document: r,
102
- variables: (e) => ({ input: t(e, n({
100
+ let [e, n] = u({
101
+ document: t,
102
+ variables: (e) => ({ input: o(e, s({
103
103
  providerId: !0,
104
104
  name: !0,
105
105
  modelId: !0,
@@ -117,11 +117,10 @@ function S() {
117
117
  });
118
118
  return {
119
119
  createModel: e,
120
- isCreating: i.loading,
121
- error: i.error
120
+ isCreating: n.loading,
121
+ error: n.error
122
122
  };
123
123
  }
124
- //#endregion
125
124
  export { x as useConfigureLLMProvider, S as useCreateLLMModel, b as useLLMModels, y as useLLMProviders };
126
125
 
127
126
  //# sourceMappingURL=useLLMProviders.js.map
@@ -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 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":"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"}
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","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":"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"}
@@ -0,0 +1,71 @@
1
+ import { CreateMcpConnectionInput, McpToolRiskLevel, UpdateMcpConnectionInput, UpdateMcpToolInput } from '../../generated/wspace-types';
2
+ import { BaseFilter } from '../types';
3
+ import { GraphQLInput } from './internal/mutationInput';
4
+ import { QueryResult } from './internal/workspaceGateway';
5
+ export interface MCPServerRecord {
6
+ id: string;
7
+ name: string;
8
+ /** Transport / server kind, e.g. `HTTP_JSON`. */
9
+ type: string;
10
+ status: string;
11
+ config: Record<string, unknown>;
12
+ credentialsHash?: string | null;
13
+ errorMessage?: string | null;
14
+ lastConnectedAt?: string | null;
15
+ lastErrorAt?: string | null;
16
+ deletedAt?: string | null;
17
+ metadata?: Record<string, unknown> | null;
18
+ createdAt: string;
19
+ updatedAt: string;
20
+ createdById: string;
21
+ updatedById: string;
22
+ workspaceId: string;
23
+ }
24
+ export interface MCPToolRecord {
25
+ id: string;
26
+ name: string;
27
+ description: string;
28
+ inputSchema: Record<string, unknown>;
29
+ riskLevel: McpToolRiskLevel;
30
+ }
31
+ export interface MCPResourceRecord {
32
+ name: string;
33
+ uri: string;
34
+ description?: string | null;
35
+ mimeType?: string | null;
36
+ }
37
+ /** `CreateMCPConnectionInput` minus the `workspaceId` the hook supplies. */
38
+ export type CreateMCPServerVariables = Omit<GraphQLInput<CreateMcpConnectionInput>, 'workspaceId'>;
39
+ export interface UpdateMCPServerVariables {
40
+ serverId: string;
41
+ input: GraphQLInput<UpdateMcpConnectionInput>;
42
+ }
43
+ export interface UpdateMCPToolVariables {
44
+ toolId: string;
45
+ input: GraphQLInput<UpdateMcpToolInput>;
46
+ }
47
+ /** `CONNECTED` is the only status that means the server is usable right now. */
48
+ export declare function isMCPServerHealthy(status: string | null | undefined): boolean;
49
+ export declare function isMCPServerUnhealthy(status: string | null | undefined): boolean;
50
+ /** Endpoint the connection points at — the service stores it on the free-form config. */
51
+ export declare function mcpServerEndpoint(server: Pick<MCPServerRecord, 'config'>): string | undefined;
52
+ /** Optional human description the UI stores alongside the endpoint. */
53
+ export declare function mcpServerDescription(server: Pick<MCPServerRecord, 'config'>): string | undefined;
54
+ export declare const mcpServerKeys: {
55
+ all: readonly ["mcpServers"];
56
+ lists: () => readonly ["mcpServers", "list"];
57
+ list: (filter?: BaseFilter) => readonly ["mcpServers", "list", BaseFilter | undefined];
58
+ details: () => readonly ["mcpServers", "detail"];
59
+ detail: (id: string) => readonly ["mcpServers", "detail", string];
60
+ resources: (serverId?: string) => readonly ["mcpServers", "resources", string | undefined];
61
+ tools: (serverId?: string) => readonly ["mcpServers", "tools", string | undefined];
62
+ };
63
+ export declare function useMCPServers(filter?: BaseFilter): QueryResult<MCPServerRecord[]>;
64
+ export declare function useMCPServer(serverId: string | undefined): QueryResult<MCPServerRecord | null>;
65
+ export declare function useMCPTools(serverId: string | undefined): QueryResult<MCPToolRecord[]>;
66
+ export declare function useMCPResources(serverId: string | undefined): QueryResult<MCPResourceRecord[]>;
67
+ export declare function useCreateMCPServer(): readonly [(input: CreateMCPServerVariables) => Promise<MCPServerRecord>, import('./internal/workspaceGateway').MutationState<MCPServerRecord>];
68
+ export declare function useUpdateMCPServer(): readonly [(input: UpdateMCPServerVariables) => Promise<MCPServerRecord>, import('./internal/workspaceGateway').MutationState<MCPServerRecord>];
69
+ export declare function useDeleteMCPServer(): readonly [(input: string) => Promise<boolean>, import('./internal/workspaceGateway').MutationState<boolean>];
70
+ export declare function useTestMCPConnection(): readonly [(input: string) => Promise<boolean>, import('./internal/workspaceGateway').MutationState<boolean>];
71
+ export declare function useUpdateMCPTool(): readonly [(input: UpdateMCPToolVariables) => Promise<MCPToolRecord>, import('./internal/workspaceGateway').MutationState<MCPToolRecord>];