@burdenoff/microfe-botmanor 2026.1106.1 → 2026.1109.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/dist/botlit/BotlitRoutes.d.ts +2 -0
  2. package/dist/botlit/BotlitRoutes.js +40 -37
  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 +253 -0
  15. package/dist/botlit/components/AiOperationsPanel.js.map +1 -0
  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 +2 -3
  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 +36 -0
  72. package/dist/botlit/hooks/index.js +15 -13
  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 +154 -0
  90. package/dist/botlit/hooks/useAiOperations.js.map +1 -0
  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 +57 -0
  107. package/dist/botlit/hooks/useBuckets.js +38 -39
  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/useConversations.d.ts +42 -0
  113. package/dist/botlit/hooks/useConversations.js +1 -2
  114. package/dist/botlit/hooks/useConversations.js.map +1 -1
  115. package/dist/botlit/hooks/useExecutions.d.ts +87 -0
  116. package/dist/botlit/hooks/useExecutions.js +37 -37
  117. package/dist/botlit/hooks/useExecutions.js.map +1 -1
  118. package/dist/botlit/hooks/useKnowledgeBases.d.ts +79 -0
  119. package/dist/botlit/hooks/useKnowledgeBases.js +40 -39
  120. package/dist/botlit/hooks/useKnowledgeBases.js.map +1 -1
  121. package/dist/botlit/hooks/useKnowledgeSourceImports.d.ts +21 -0
  122. package/dist/botlit/hooks/useKnowledgeSourceImports.js +1 -2
  123. package/dist/botlit/hooks/useKnowledgeSourceImports.js.map +1 -1
  124. package/dist/botlit/hooks/useLLMProviders.d.ts +66 -0
  125. package/dist/botlit/hooks/useLLMProviders.js +25 -26
  126. package/dist/botlit/hooks/useLLMProviders.js.map +1 -1
  127. package/dist/botlit/hooks/useMCPServers.d.ts +71 -0
  128. package/dist/botlit/hooks/useMCPServers.js +40 -38
  129. package/dist/botlit/hooks/useMCPServers.js.map +1 -1
  130. package/dist/botlit/hooks/usePolicies.d.ts +60 -0
  131. package/dist/botlit/hooks/usePolicies.js +49 -49
  132. package/dist/botlit/hooks/usePolicies.js.map +1 -1
  133. package/dist/botlit/hooks/usePromptTemplates.d.ts +88 -0
  134. package/dist/botlit/hooks/usePromptTemplates.js +57 -57
  135. package/dist/botlit/hooks/usePromptTemplates.js.map +1 -1
  136. package/dist/botlit/hooks/useRetention.d.ts +26 -0
  137. package/dist/botlit/hooks/useRetention.js +3 -3
  138. package/dist/botlit/hooks/useRetention.js.map +1 -1
  139. package/dist/botlit/hooks/useRetrievalProfiles.d.ts +75 -0
  140. package/dist/botlit/hooks/useRetrievalProfiles.js +47 -47
  141. package/dist/botlit/hooks/useRetrievalProfiles.js.map +1 -1
  142. package/dist/botlit/hooks/useSkills.d.ts +64 -0
  143. package/dist/botlit/hooks/useSkills.js +53 -53
  144. package/dist/botlit/hooks/useSkills.js.map +1 -1
  145. package/dist/botlit/hooks/useStore.d.ts +112 -0
  146. package/dist/botlit/hooks/useStore.js +55 -55
  147. package/dist/botlit/hooks/useStore.js.map +1 -1
  148. package/dist/botlit/hooks/useUserPlatformConnection.d.ts +80 -0
  149. package/dist/botlit/hooks/useUserPlatformConnection.js +19 -19
  150. package/dist/botlit/hooks/useUserPlatformConnection.js.map +1 -1
  151. package/dist/botlit/index.d.ts +16 -0
  152. package/dist/botlit/index.js +12 -11
  153. package/dist/botlit/pages/A2AAgentDetailPage.d.ts +6 -0
  154. package/dist/botlit/pages/A2AAgentDetailPage.js +171 -178
  155. package/dist/botlit/pages/A2AAgentDetailPage.js.map +1 -1
  156. package/dist/botlit/pages/A2ARegistryPage.d.ts +2 -0
  157. package/dist/botlit/pages/A2ARegistryPage.js +25 -26
  158. package/dist/botlit/pages/A2ARegistryPage.js.map +1 -1
  159. package/dist/botlit/pages/AgentApprovalsPage.d.ts +2 -0
  160. package/dist/botlit/pages/AgentApprovalsPage.js +32 -33
  161. package/dist/botlit/pages/AgentApprovalsPage.js.map +1 -1
  162. package/dist/botlit/pages/AgentBuilderPage.d.ts +2 -0
  163. package/dist/botlit/pages/AgentBuilderPage.js +59 -60
  164. package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
  165. package/dist/botlit/pages/AgentDetailPage.d.ts +2 -0
  166. package/dist/botlit/pages/AgentDetailPage.js +202 -190
  167. package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
  168. package/dist/botlit/pages/AgentsListPage.d.ts +2 -0
  169. package/dist/botlit/pages/AgentsListPage.js +71 -72
  170. package/dist/botlit/pages/AgentsListPage.js.map +1 -1
  171. package/dist/botlit/pages/AiOperationsPage.d.ts +2 -0
  172. package/dist/botlit/pages/AiOperationsPage.js +165 -0
  173. package/dist/botlit/pages/AiOperationsPage.js.map +1 -0
  174. package/dist/botlit/pages/BotChannelsTab.d.ts +7 -0
  175. package/dist/botlit/pages/BotChannelsTab.js +120 -122
  176. package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
  177. package/dist/botlit/pages/BotDetailPage.d.ts +7 -0
  178. package/dist/botlit/pages/BotDetailPage.js +246 -237
  179. package/dist/botlit/pages/BotDetailPage.js.map +1 -1
  180. package/dist/botlit/pages/BotWorkflowTab.d.ts +11 -0
  181. package/dist/botlit/pages/BotWorkflowTab.js +20 -21
  182. package/dist/botlit/pages/BotWorkflowTab.js.map +1 -1
  183. package/dist/botlit/pages/BotsListPage.d.ts +2 -0
  184. package/dist/botlit/pages/BotsListPage.js +52 -53
  185. package/dist/botlit/pages/BotsListPage.js.map +1 -1
  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/ConversationDetailPage.d.ts +2 -0
  202. package/dist/botlit/pages/ConversationsPage.d.ts +2 -0
  203. package/dist/botlit/pages/DashboardPage.d.ts +2 -0
  204. package/dist/botlit/pages/DashboardPage.js +37 -38
  205. package/dist/botlit/pages/DashboardPage.js.map +1 -1
  206. package/dist/botlit/pages/ExecutionDetailPage.d.ts +2 -0
  207. package/dist/botlit/pages/ExecutionDetailPage.js +47 -48
  208. package/dist/botlit/pages/ExecutionDetailPage.js.map +1 -1
  209. package/dist/botlit/pages/ExecutionsPage.d.ts +2 -0
  210. package/dist/botlit/pages/ExecutionsPage.js +72 -70
  211. package/dist/botlit/pages/ExecutionsPage.js.map +1 -1
  212. package/dist/botlit/pages/InstalledPackagesPage.d.ts +2 -0
  213. package/dist/botlit/pages/InstalledPackagesPage.js +77 -78
  214. package/dist/botlit/pages/InstalledPackagesPage.js.map +1 -1
  215. package/dist/botlit/pages/KnowledgeBaseDetailPage.d.ts +6 -0
  216. package/dist/botlit/pages/KnowledgeBaseDetailPage.js +171 -181
  217. package/dist/botlit/pages/KnowledgeBaseDetailPage.js.map +1 -1
  218. package/dist/botlit/pages/KnowledgeBasesPage.d.ts +2 -0
  219. package/dist/botlit/pages/KnowledgeBasesPage.js +30 -31
  220. package/dist/botlit/pages/KnowledgeBasesPage.js.map +1 -1
  221. package/dist/botlit/pages/MCPServerDetailPage.d.ts +6 -0
  222. package/dist/botlit/pages/MCPServerDetailPage.js +82 -83
  223. package/dist/botlit/pages/MCPServerDetailPage.js.map +1 -1
  224. package/dist/botlit/pages/MCPServersPage.d.ts +2 -0
  225. package/dist/botlit/pages/MCPServersPage.js +54 -55
  226. package/dist/botlit/pages/MCPServersPage.js.map +1 -1
  227. package/dist/botlit/pages/PoliciesPage.d.ts +2 -0
  228. package/dist/botlit/pages/PoliciesPage.js +25 -26
  229. package/dist/botlit/pages/PoliciesPage.js.map +1 -1
  230. package/dist/botlit/pages/PolicyDetailPage.d.ts +6 -0
  231. package/dist/botlit/pages/PolicyDetailPage.js +257 -259
  232. package/dist/botlit/pages/PolicyDetailPage.js.map +1 -1
  233. package/dist/botlit/pages/PromptStudioPage.d.ts +2 -0
  234. package/dist/botlit/pages/PromptStudioPage.js +35 -35
  235. package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
  236. package/dist/botlit/pages/PromptTemplateDetailPage.d.ts +6 -0
  237. package/dist/botlit/pages/PromptTemplateDetailPage.js +363 -362
  238. package/dist/botlit/pages/PromptTemplateDetailPage.js.map +1 -1
  239. package/dist/botlit/pages/PromptTemplatesPage.d.ts +2 -0
  240. package/dist/botlit/pages/PromptTemplatesPage.js +26 -27
  241. package/dist/botlit/pages/PromptTemplatesPage.js.map +1 -1
  242. package/dist/botlit/pages/RetrievalProfileDetailPage.d.ts +6 -0
  243. package/dist/botlit/pages/RetrievalProfileDetailPage.js +150 -158
  244. package/dist/botlit/pages/RetrievalProfileDetailPage.js.map +1 -1
  245. package/dist/botlit/pages/RetrievalProfilesPage.d.ts +2 -0
  246. package/dist/botlit/pages/RetrievalProfilesPage.js +24 -25
  247. package/dist/botlit/pages/RetrievalProfilesPage.js.map +1 -1
  248. package/dist/botlit/pages/SettingsPage.d.ts +2 -0
  249. package/dist/botlit/pages/SettingsPage.js +124 -125
  250. package/dist/botlit/pages/SettingsPage.js.map +1 -1
  251. package/dist/botlit/pages/SkillDetailPage.d.ts +6 -0
  252. package/dist/botlit/pages/SkillDetailPage.js +216 -217
  253. package/dist/botlit/pages/SkillDetailPage.js.map +1 -1
  254. package/dist/botlit/pages/SkillsPage.d.ts +2 -0
  255. package/dist/botlit/pages/SkillsPage.js +24 -25
  256. package/dist/botlit/pages/SkillsPage.js.map +1 -1
  257. package/dist/botlit/pages/StorePackageDetailPage.d.ts +2 -0
  258. package/dist/botlit/pages/StorePackageDetailPage.js +38 -39
  259. package/dist/botlit/pages/StorePackageDetailPage.js.map +1 -1
  260. package/dist/botlit/pages/StorePage.d.ts +2 -0
  261. package/dist/botlit/pages/StorePage.js +135 -136
  262. package/dist/botlit/pages/StorePage.js.map +1 -1
  263. package/dist/botlit/pages/index.d.ts +39 -0
  264. package/dist/botlit/permissions/PermissionRequired.d.ts +20 -0
  265. package/dist/botlit/permissions/PermissionRequired.js +10 -11
  266. package/dist/botlit/permissions/PermissionRequired.js.map +1 -1
  267. package/dist/botlit/permissions/botmanorPermissions.d.ts +82 -0
  268. package/dist/botlit/permissions/botmanorPermissions.js +1 -2
  269. package/dist/botlit/permissions/botmanorPermissions.js.map +1 -1
  270. package/dist/botlit/permissions/index.d.ts +7 -0
  271. package/dist/botlit/permissions/index.js +4 -3
  272. package/dist/botlit/permissions/useBotmanorPermissions.d.ts +41 -0
  273. package/dist/botlit/permissions/useBotmanorPermissions.js +1 -2
  274. package/dist/botlit/permissions/useBotmanorPermissions.js.map +1 -1
  275. package/dist/botlit/providers/BotlitProvider.d.ts +14 -0
  276. package/dist/botlit/providers/BotlitProvider.js +3 -3
  277. package/dist/botlit/providers/BotlitProvider.js.map +1 -1
  278. package/dist/botlit/store/botlitStore.d.ts +85 -0
  279. package/dist/botlit/store/botlitStore.js +1 -2
  280. package/dist/botlit/store/botlitStore.js.map +1 -1
  281. package/dist/botlit/store/renamedKeyStorage.d.ts +13 -0
  282. package/dist/botlit/store/renamedKeyStorage.js +1 -2
  283. package/dist/botlit/store/renamedKeyStorage.js.map +1 -1
  284. package/dist/botlit/types/index.d.ts +1008 -0
  285. package/dist/botlit/utils/cn.d.ts +2 -0
  286. package/dist/botlit/utils/cn.js +1 -2
  287. package/dist/botlit/utils/cn.js.map +1 -1
  288. package/dist/botlit/utils/embedding-models.d.ts +9 -0
  289. package/dist/botlit/utils/embedding-models.js +1 -2
  290. package/dist/botlit/utils/embedding-models.js.map +1 -1
  291. package/dist/botlit/utils/errors.d.ts +19 -0
  292. package/dist/botlit/utils/errors.js +1 -2
  293. package/dist/botlit/utils/errors.js.map +1 -1
  294. package/dist/botlit/utils/formatters.d.ts +38 -0
  295. package/dist/botlit/utils/formatters.js +0 -1
  296. package/dist/botlit/utils/formatters.js.map +1 -1
  297. package/dist/botlit/utils/navigation.d.ts +19 -0
  298. package/dist/botlit/utils/navigation.js +1 -2
  299. package/dist/botlit/utils/navigation.js.map +1 -1
  300. package/dist/botlit/utils/policyConfig.d.ts +68 -0
  301. package/dist/botlit/utils/policyConfig.js +2 -3
  302. package/dist/botlit/utils/policyConfig.js.map +1 -1
  303. package/dist/botlit/utils/unions.d.ts +25 -0
  304. package/dist/botlit/utils/unions.js +1 -2
  305. package/dist/botlit/utils/unions.js.map +1 -1
  306. package/dist/dev/App.d.ts +2 -0
  307. package/dist/dev/main.d.ts +0 -0
  308. package/dist/generated/global-operations.d.ts +197 -0
  309. package/dist/generated/global-operations.js +1 -2
  310. package/dist/generated/global-operations.js.map +1 -1
  311. package/dist/generated/global-types.d.ts +27678 -0
  312. package/dist/generated/global-types.js +1 -2
  313. package/dist/generated/global-types.js.map +1 -1
  314. package/dist/generated/wspace-operations.d.ts +5489 -0
  315. package/dist/generated/wspace-operations.js +172 -75
  316. package/dist/generated/wspace-operations.js.map +1 -1
  317. package/dist/generated/wspace-types.d.ts +152017 -0
  318. package/dist/generated/wspace-types.js +6 -5
  319. package/dist/generated/wspace-types.js.map +1 -1
  320. package/dist/index.d.ts +5 -0
  321. package/dist/shared/hooks/useTr.d.ts +16 -0
  322. package/dist/shared/hooks/useTr.js +1 -2
  323. package/dist/shared/hooks/useTr.js.map +1 -1
  324. package/dist/stories/Badge.stories.d.ts +11 -0
  325. package/dist/stories/Button.stories.d.ts +13 -0
  326. package/dist/stories/EmptyState.stories.d.ts +8 -0
  327. package/dist/stories/StatusBadge.stories.d.ts +9 -0
  328. package/dist/test/fixtures.d.ts +39 -0
  329. package/dist/test/happydom.d.ts +1 -0
  330. package/dist/test/renderPage.d.ts +18 -0
  331. package/dist/test/setup.d.ts +9 -0
  332. package/dist/utils/nativeBridge.d.ts +2 -0
  333. package/dist/utils/nativeBridge.js +1 -2
  334. package/package.json +87 -60
@@ -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>];
@@ -1,16 +1,16 @@
1
- import { buildMutationInput as e, fieldsOf as t } from "./internal/mutationInput.js";
2
- import { CreateMcpConnectionDocument as n, DeleteMcpConnectionDocument as r, GetMcpConnectionDocument as i, ListMcpConnectionsDocument as a, ListMcpResourcesDocument as o, ListMcpToolsDocument as s, TestMcpConnectionDocument as c, UpdateMcpConnectionDocument as l, UpdateMcpToolDocument as u } from "../../generated/wspace-operations.js";
1
+ import { CreateMcpConnectionDocument as e, DeleteMcpConnectionDocument as t, GetMcpConnectionDocument as n, ListMcpConnectionsDocument as r, ListMcpResourcesDocument as i, ListMcpToolsDocument as a, TestMcpConnectionDocument as o, UpdateMcpConnectionDocument as s, UpdateMcpToolDocument as c } from "../../generated/wspace-operations.js";
2
+ import { buildMutationInput as l, fieldsOf as u } from "./internal/mutationInput.js";
3
3
  import { useWorkspaceId as d, useWorkspaceMutation as f, useWorkspaceQuery as p } from "./internal/workspaceGateway.js";
4
4
  import { useCallback as m, useMemo as h } from "react";
5
- //#region src/botlit/hooks/useMCPServers.ts
6
- var g = 100, _ = t({
5
+ // src/botlit/hooks/useMCPServers.ts
6
+ var g = 100, _ = u({
7
7
  config: !0,
8
8
  credentials: !0,
9
9
  metadata: !0,
10
10
  name: !0,
11
11
  type: !0,
12
12
  workspaceId: !0
13
- }), v = t({
13
+ }), v = u({
14
14
  config: !0,
15
15
  credentials: !0,
16
16
  metadata: !0,
@@ -40,29 +40,30 @@ function O(e) {
40
40
  return e?.listMCPResources ?? x;
41
41
  }
42
42
  function k(e) {
43
- let t = d(), n = e?.search?.trim().toLowerCase() ?? "";
43
+ let t = d(), n = e?.search?.trim().toLowerCase() ?? "", i = h(() => ({
44
+ filters: { workspaceId: t },
45
+ pagination: {
46
+ limit: g,
47
+ offset: 0
48
+ }
49
+ }), [t]), a = m((e) => {
50
+ let t = T(e);
51
+ return n ? t.filter((e) => e.name.toLowerCase().includes(n)) : t;
52
+ }, [n]);
44
53
  return p({
45
- document: a,
46
- variables: h(() => ({
47
- filters: { workspaceId: t },
48
- pagination: {
49
- limit: g,
50
- offset: 0
51
- }
52
- }), [t]),
53
- select: m((e) => {
54
- let t = T(e);
55
- return n ? t.filter((e) => e.name.toLowerCase().includes(n)) : t;
56
- }, [n]),
54
+ document: r,
55
+ variables: i,
56
+ select: a,
57
57
  fallback: y,
58
58
  enabled: !!t,
59
59
  errorMessage: "Failed to load MCP servers"
60
60
  });
61
61
  }
62
62
  function A(e) {
63
+ let t = h(() => ({ id: e ?? "" }), [e]);
63
64
  return p({
64
- document: i,
65
- variables: h(() => ({ id: e ?? "" }), [e]),
65
+ document: n,
66
+ variables: t,
66
67
  select: E,
67
68
  fallback: null,
68
69
  enabled: !!e,
@@ -70,9 +71,10 @@ function A(e) {
70
71
  });
71
72
  }
72
73
  function j(e) {
74
+ let t = h(() => ({ connectionId: e ?? "" }), [e]);
73
75
  return p({
74
- document: s,
75
- variables: h(() => ({ connectionId: e ?? "" }), [e]),
76
+ document: a,
77
+ variables: t,
76
78
  select: D,
77
79
  fallback: b,
78
80
  enabled: !!e,
@@ -80,9 +82,10 @@ function j(e) {
80
82
  });
81
83
  }
82
84
  function M(e) {
85
+ let t = h(() => ({ connectionId: e ?? "" }), [e]);
83
86
  return p({
84
- document: o,
85
- variables: h(() => ({ connectionId: e ?? "" }), [e]),
87
+ document: i,
88
+ variables: t,
86
89
  select: O,
87
90
  fallback: x,
88
91
  enabled: !!e,
@@ -90,23 +93,23 @@ function M(e) {
90
93
  });
91
94
  }
92
95
  function N() {
93
- let t = d();
96
+ let t = d(), n = m((e) => ({ input: l({
97
+ ...e,
98
+ workspaceId: t
99
+ }, _) }), [t]);
94
100
  return f({
95
- document: n,
96
- variables: m((n) => ({ input: e({
97
- ...n,
98
- workspaceId: t
99
- }, _) }), [t]),
101
+ document: e,
102
+ variables: n,
100
103
  select: (e) => e?.createMCPConnection,
101
104
  errorMessage: "Failed to connect MCP server"
102
105
  });
103
106
  }
104
107
  function P() {
105
108
  return f({
106
- document: l,
107
- variables: ({ serverId: t, input: n }) => ({
108
- id: t,
109
- input: e(n, v)
109
+ document: s,
110
+ variables: ({ serverId: e, input: t }) => ({
111
+ id: e,
112
+ input: l(t, v)
110
113
  }),
111
114
  select: (e) => e?.updateMCPConnection,
112
115
  errorMessage: "Failed to update MCP server"
@@ -114,7 +117,7 @@ function P() {
114
117
  }
115
118
  function F() {
116
119
  return f({
117
- document: r,
120
+ document: t,
118
121
  variables: (e) => ({ id: e }),
119
122
  select: (e) => e?.deleteMCPConnection,
120
123
  errorMessage: "Failed to disconnect MCP server"
@@ -122,7 +125,7 @@ function F() {
122
125
  }
123
126
  function I() {
124
127
  return f({
125
- document: c,
128
+ document: o,
126
129
  variables: (e) => ({ id: e }),
127
130
  select: (e) => e?.testMCPConnection,
128
131
  errorMessage: "Failed to test MCP connection"
@@ -130,7 +133,7 @@ function I() {
130
133
  }
131
134
  function L() {
132
135
  return f({
133
- document: u,
136
+ document: c,
134
137
  variables: ({ toolId: e, input: t }) => ({
135
138
  id: e,
136
139
  input: t
@@ -139,7 +142,6 @@ function L() {
139
142
  errorMessage: "Failed to update MCP tool risk level"
140
143
  });
141
144
  }
142
- //#endregion
143
145
  export { S as isMCPServerHealthy, w as mcpServerDescription, C as mcpServerEndpoint, N as useCreateMCPServer, F as useDeleteMCPServer, M as useMCPResources, A as useMCPServer, k as useMCPServers, j as useMCPTools, I as useTestMCPConnection, P as useUpdateMCPServer, L as useUpdateMCPTool };
144
146
 
145
147
  //# sourceMappingURL=useMCPServers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMCPServers.js","names":[],"sources":["../../../src/botlit/hooks/useMCPServers.ts"],"sourcesContent":["/**\n * MCP Servers Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listMCPConnections` / `getMCPConnection` / `listMCPTools`\n * / `listMCPResources` operations and the create/update/delete/test mutations on\n * wspace-botlit-svc.\n *\n * The service models an MCP server as an `MCPConnection`: `type` is the\n * transport, `config` holds the endpoint, and `status` reports health.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateMcpConnectionDocument,\n DeleteMcpConnectionDocument,\n GetMcpConnectionDocument,\n ListMcpConnectionsDocument,\n ListMcpResourcesDocument,\n ListMcpToolsDocument,\n TestMcpConnectionDocument,\n UpdateMcpConnectionDocument,\n UpdateMcpToolDocument,\n type CreateMcpConnectionMutation,\n type DeleteMcpConnectionMutation,\n type GetMcpConnectionQuery,\n type ListMcpConnectionsQuery,\n type ListMcpResourcesQuery,\n type ListMcpToolsQuery,\n type TestMcpConnectionMutation,\n type UpdateMcpConnectionMutation,\n type UpdateMcpToolMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateMcpConnectionInput,\n McpToolRiskLevel,\n UpdateMcpConnectionInput,\n UpdateMcpToolInput,\n} from '../../generated/wspace-types';\nimport type { BaseFilter } from '../types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 100;\n\nexport interface MCPServerRecord {\n id: string;\n name: string;\n /** Transport / server kind, e.g. `HTTP_JSON`. */\n type: string;\n status: string;\n config: Record<string, unknown>;\n credentialsHash?: string | null;\n errorMessage?: string | null;\n lastConnectedAt?: string | null;\n lastErrorAt?: string | null;\n deletedAt?: string | null;\n metadata?: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\nexport interface MCPToolRecord {\n id: string;\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n riskLevel: McpToolRiskLevel;\n}\n\nexport interface MCPResourceRecord {\n name: string;\n uri: string;\n description?: string | null;\n mimeType?: string | null;\n}\n\n/** `CreateMCPConnectionInput` minus the `workspaceId` the hook supplies. */\nexport type CreateMCPServerVariables = Omit<GraphQLInput<CreateMcpConnectionInput>, 'workspaceId'>;\n\nexport interface UpdateMCPServerVariables {\n serverId: string;\n input: GraphQLInput<UpdateMcpConnectionInput>;\n}\n\nexport interface UpdateMCPToolVariables {\n toolId: string;\n input: GraphQLInput<UpdateMcpToolInput>;\n}\n\nconst CREATE_CONNECTION_FIELDS = fieldsOf<CreateMcpConnectionInput>({\n config: true,\n credentials: true,\n metadata: true,\n name: true,\n type: true,\n workspaceId: true,\n});\n\nconst UPDATE_CONNECTION_FIELDS = fieldsOf<UpdateMcpConnectionInput>({\n config: true,\n credentials: true,\n metadata: true,\n name: true,\n});\n\nconst NO_SERVERS: MCPServerRecord[] = [];\nconst NO_TOOLS: MCPToolRecord[] = [];\nconst NO_RESOURCES: MCPResourceRecord[] = [];\n\n/** `CONNECTED` is the only status that means the server is usable right now. */\nexport function isMCPServerHealthy(status: string | null | undefined): boolean {\n return status === 'CONNECTED';\n}\n\nexport function isMCPServerUnhealthy(status: string | null | undefined): boolean {\n return status === 'ERROR' || status === 'DISCONNECTED';\n}\n\n/** Endpoint the connection points at — the service stores it on the free-form config. */\nexport function mcpServerEndpoint(server: Pick<MCPServerRecord, 'config'>): string | undefined {\n const url = server.config?.url;\n return typeof url === 'string' ? url : undefined;\n}\n\n/** Optional human description the UI stores alongside the endpoint. */\nexport function mcpServerDescription(server: Pick<MCPServerRecord, 'config'>): string | undefined {\n const description = server.config?.description;\n return typeof description === 'string' ? description : undefined;\n}\n\nfunction selectServers(data: ListMcpConnectionsQuery | undefined): MCPServerRecord[] {\n return data?.listMCPConnections ?? NO_SERVERS;\n}\n\nfunction selectServer(data: GetMcpConnectionQuery | undefined): MCPServerRecord | null {\n return data?.getMCPConnection ?? null;\n}\n\nfunction selectTools(data: ListMcpToolsQuery | undefined): MCPToolRecord[] {\n return data?.listMCPTools ?? NO_TOOLS;\n}\n\nfunction selectResources(data: ListMcpResourcesQuery | undefined): MCPResourceRecord[] {\n return data?.listMCPResources ?? NO_RESOURCES;\n}\n\nexport const mcpServerKeys = {\n all: ['mcpServers'] as const,\n lists: () => [...mcpServerKeys.all, 'list'] as const,\n list: (filter?: BaseFilter) => [...mcpServerKeys.lists(), filter] as const,\n details: () => [...mcpServerKeys.all, 'detail'] as const,\n detail: (id: string) => [...mcpServerKeys.details(), id] as const,\n resources: (serverId?: string) => [...mcpServerKeys.all, 'resources', serverId] as const,\n tools: (serverId?: string) => [...mcpServerKeys.all, 'tools', serverId] as const,\n};\n\nexport function useMCPServers(filter?: BaseFilter): QueryResult<MCPServerRecord[]> {\n const workspaceId = useWorkspaceId();\n const search = filter?.search?.trim().toLowerCase() ?? '';\n\n const variables = useMemo(\n () => ({\n // MCPConnectionFilterInput has no free-text field — search is narrowed on the client.\n filters: { workspaceId },\n pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [workspaceId]\n );\n\n const select = useCallback(\n (data: ListMcpConnectionsQuery | undefined): MCPServerRecord[] => {\n const rows = selectServers(data);\n if (!search) return rows;\n return rows.filter((row) => row.name.toLowerCase().includes(search));\n },\n [search]\n );\n\n return useWorkspaceQuery<ListMcpConnectionsQuery, MCPServerRecord[]>({\n document: ListMcpConnectionsDocument,\n variables,\n select,\n fallback: NO_SERVERS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load MCP servers',\n });\n}\n\nexport function useMCPServer(serverId: string | undefined): QueryResult<MCPServerRecord | null> {\n const variables = useMemo(() => ({ id: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<GetMcpConnectionQuery, MCPServerRecord | null>({\n document: GetMcpConnectionDocument,\n variables,\n select: selectServer,\n fallback: null,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP server',\n });\n}\n\nexport function useMCPTools(serverId: string | undefined): QueryResult<MCPToolRecord[]> {\n const variables = useMemo(() => ({ connectionId: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<ListMcpToolsQuery, MCPToolRecord[]>({\n document: ListMcpToolsDocument,\n variables,\n select: selectTools,\n fallback: NO_TOOLS,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP tools',\n });\n}\n\nexport function useMCPResources(serverId: string | undefined): QueryResult<MCPResourceRecord[]> {\n const variables = useMemo(() => ({ connectionId: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<ListMcpResourcesQuery, MCPResourceRecord[]>({\n document: ListMcpResourcesDocument,\n variables,\n select: selectResources,\n fallback: NO_RESOURCES,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP resources',\n });\n}\n\nexport function useCreateMCPServer() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreateMCPServerVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_CONNECTION_FIELDS),\n }),\n [workspaceId]\n );\n\n return useWorkspaceMutation<\n CreateMcpConnectionMutation,\n CreateMCPServerVariables,\n MCPServerRecord\n >({\n document: CreateMcpConnectionDocument,\n variables,\n select: (data) => data?.createMCPConnection,\n errorMessage: 'Failed to connect MCP server',\n });\n}\n\nexport function useUpdateMCPServer() {\n return useWorkspaceMutation<\n UpdateMcpConnectionMutation,\n UpdateMCPServerVariables,\n MCPServerRecord\n >({\n document: UpdateMcpConnectionDocument,\n variables: ({ serverId, input }) => ({\n id: serverId,\n input: buildMutationInput(input, UPDATE_CONNECTION_FIELDS),\n }),\n select: (data) => data?.updateMCPConnection,\n errorMessage: 'Failed to update MCP server',\n });\n}\n\nexport function useDeleteMCPServer() {\n return useWorkspaceMutation<DeleteMcpConnectionMutation, string, boolean>({\n document: DeleteMcpConnectionDocument,\n variables: (serverId) => ({ id: serverId }),\n select: (data) => data?.deleteMCPConnection,\n errorMessage: 'Failed to disconnect MCP server',\n });\n}\n\nexport function useTestMCPConnection() {\n return useWorkspaceMutation<TestMcpConnectionMutation, string, boolean>({\n document: TestMcpConnectionDocument,\n variables: (serverId) => ({ id: serverId }),\n select: (data) => data?.testMCPConnection,\n errorMessage: 'Failed to test MCP connection',\n });\n}\n\nexport function useUpdateMCPTool() {\n return useWorkspaceMutation<UpdateMcpToolMutation, UpdateMCPToolVariables, MCPToolRecord>({\n document: UpdateMcpToolDocument,\n variables: ({ toolId, input }) => ({ id: toolId, input }),\n select: (data) => data?.updateMCPTool,\n errorMessage: 'Failed to update MCP tool risk level',\n });\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"useMCPServers.js","names":["LIST_LIMIT","CREATE_CONNECTION_FIELDS","fieldsOf","UPDATE_CONNECTION_FIELDS","NO_SERVERS","NO_TOOLS","NO_RESOURCES","isMCPServerHealthy","status","mcpServerEndpoint","url","server","mcpServerDescription","description","selectServers","data","selectServer","selectTools","selectResources","useMCPServers","workspaceId","useWorkspaceId","search","filter","variables","useMemo","select","useCallback","rows","row","useWorkspaceQuery","ListMcpConnectionsDocument","useMCPServer","serverId","GetMcpConnectionDocument","useMCPTools","ListMcpToolsDocument","useMCPResources","ListMcpResourcesDocument","useCreateMCPServer","buildMutationInput","input","useWorkspaceMutation","CreateMcpConnectionDocument","useUpdateMCPServer","UpdateMcpConnectionDocument","useDeleteMCPServer","DeleteMcpConnectionDocument","useTestMCPConnection","TestMcpConnectionDocument","useUpdateMCPTool","UpdateMcpToolDocument","toolId"],"sources":["../../../src/botlit/hooks/useMCPServers.ts"],"sourcesContent":["/**\n * MCP Servers Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listMCPConnections` / `getMCPConnection` / `listMCPTools`\n * / `listMCPResources` operations and the create/update/delete/test mutations on\n * wspace-botlit-svc.\n *\n * The service models an MCP server as an `MCPConnection`: `type` is the\n * transport, `config` holds the endpoint, and `status` reports health.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateMcpConnectionDocument,\n DeleteMcpConnectionDocument,\n GetMcpConnectionDocument,\n ListMcpConnectionsDocument,\n ListMcpResourcesDocument,\n ListMcpToolsDocument,\n TestMcpConnectionDocument,\n UpdateMcpConnectionDocument,\n UpdateMcpToolDocument,\n type CreateMcpConnectionMutation,\n type DeleteMcpConnectionMutation,\n type GetMcpConnectionQuery,\n type ListMcpConnectionsQuery,\n type ListMcpResourcesQuery,\n type ListMcpToolsQuery,\n type TestMcpConnectionMutation,\n type UpdateMcpConnectionMutation,\n type UpdateMcpToolMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateMcpConnectionInput,\n McpToolRiskLevel,\n UpdateMcpConnectionInput,\n UpdateMcpToolInput,\n} from '../../generated/wspace-types';\nimport type { BaseFilter } from '../types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 100;\n\nexport interface MCPServerRecord {\n id: string;\n name: string;\n /** Transport / server kind, e.g. `HTTP_JSON`. */\n type: string;\n status: string;\n config: Record<string, unknown>;\n credentialsHash?: string | null;\n errorMessage?: string | null;\n lastConnectedAt?: string | null;\n lastErrorAt?: string | null;\n deletedAt?: string | null;\n metadata?: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\nexport interface MCPToolRecord {\n id: string;\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n riskLevel: McpToolRiskLevel;\n}\n\nexport interface MCPResourceRecord {\n name: string;\n uri: string;\n description?: string | null;\n mimeType?: string | null;\n}\n\n/** `CreateMCPConnectionInput` minus the `workspaceId` the hook supplies. */\nexport type CreateMCPServerVariables = Omit<GraphQLInput<CreateMcpConnectionInput>, 'workspaceId'>;\n\nexport interface UpdateMCPServerVariables {\n serverId: string;\n input: GraphQLInput<UpdateMcpConnectionInput>;\n}\n\nexport interface UpdateMCPToolVariables {\n toolId: string;\n input: GraphQLInput<UpdateMcpToolInput>;\n}\n\nconst CREATE_CONNECTION_FIELDS = fieldsOf<CreateMcpConnectionInput>({\n config: true,\n credentials: true,\n metadata: true,\n name: true,\n type: true,\n workspaceId: true,\n});\n\nconst UPDATE_CONNECTION_FIELDS = fieldsOf<UpdateMcpConnectionInput>({\n config: true,\n credentials: true,\n metadata: true,\n name: true,\n});\n\nconst NO_SERVERS: MCPServerRecord[] = [];\nconst NO_TOOLS: MCPToolRecord[] = [];\nconst NO_RESOURCES: MCPResourceRecord[] = [];\n\n/** `CONNECTED` is the only status that means the server is usable right now. */\nexport function isMCPServerHealthy(status: string | null | undefined): boolean {\n return status === 'CONNECTED';\n}\n\nexport function isMCPServerUnhealthy(status: string | null | undefined): boolean {\n return status === 'ERROR' || status === 'DISCONNECTED';\n}\n\n/** Endpoint the connection points at — the service stores it on the free-form config. */\nexport function mcpServerEndpoint(server: Pick<MCPServerRecord, 'config'>): string | undefined {\n const url = server.config?.url;\n return typeof url === 'string' ? url : undefined;\n}\n\n/** Optional human description the UI stores alongside the endpoint. */\nexport function mcpServerDescription(server: Pick<MCPServerRecord, 'config'>): string | undefined {\n const description = server.config?.description;\n return typeof description === 'string' ? description : undefined;\n}\n\nfunction selectServers(data: ListMcpConnectionsQuery | undefined): MCPServerRecord[] {\n return data?.listMCPConnections ?? NO_SERVERS;\n}\n\nfunction selectServer(data: GetMcpConnectionQuery | undefined): MCPServerRecord | null {\n return data?.getMCPConnection ?? null;\n}\n\nfunction selectTools(data: ListMcpToolsQuery | undefined): MCPToolRecord[] {\n return data?.listMCPTools ?? NO_TOOLS;\n}\n\nfunction selectResources(data: ListMcpResourcesQuery | undefined): MCPResourceRecord[] {\n return data?.listMCPResources ?? NO_RESOURCES;\n}\n\nexport const mcpServerKeys = {\n all: ['mcpServers'] as const,\n lists: () => [...mcpServerKeys.all, 'list'] as const,\n list: (filter?: BaseFilter) => [...mcpServerKeys.lists(), filter] as const,\n details: () => [...mcpServerKeys.all, 'detail'] as const,\n detail: (id: string) => [...mcpServerKeys.details(), id] as const,\n resources: (serverId?: string) => [...mcpServerKeys.all, 'resources', serverId] as const,\n tools: (serverId?: string) => [...mcpServerKeys.all, 'tools', serverId] as const,\n};\n\nexport function useMCPServers(filter?: BaseFilter): QueryResult<MCPServerRecord[]> {\n const workspaceId = useWorkspaceId();\n const search = filter?.search?.trim().toLowerCase() ?? '';\n\n const variables = useMemo(\n () => ({\n // MCPConnectionFilterInput has no free-text field — search is narrowed on the client.\n filters: { workspaceId },\n pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [workspaceId]\n );\n\n const select = useCallback(\n (data: ListMcpConnectionsQuery | undefined): MCPServerRecord[] => {\n const rows = selectServers(data);\n if (!search) return rows;\n return rows.filter((row) => row.name.toLowerCase().includes(search));\n },\n [search]\n );\n\n return useWorkspaceQuery<ListMcpConnectionsQuery, MCPServerRecord[]>({\n document: ListMcpConnectionsDocument,\n variables,\n select,\n fallback: NO_SERVERS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load MCP servers',\n });\n}\n\nexport function useMCPServer(serverId: string | undefined): QueryResult<MCPServerRecord | null> {\n const variables = useMemo(() => ({ id: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<GetMcpConnectionQuery, MCPServerRecord | null>({\n document: GetMcpConnectionDocument,\n variables,\n select: selectServer,\n fallback: null,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP server',\n });\n}\n\nexport function useMCPTools(serverId: string | undefined): QueryResult<MCPToolRecord[]> {\n const variables = useMemo(() => ({ connectionId: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<ListMcpToolsQuery, MCPToolRecord[]>({\n document: ListMcpToolsDocument,\n variables,\n select: selectTools,\n fallback: NO_TOOLS,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP tools',\n });\n}\n\nexport function useMCPResources(serverId: string | undefined): QueryResult<MCPResourceRecord[]> {\n const variables = useMemo(() => ({ connectionId: serverId ?? '' }), [serverId]);\n\n return useWorkspaceQuery<ListMcpResourcesQuery, MCPResourceRecord[]>({\n document: ListMcpResourcesDocument,\n variables,\n select: selectResources,\n fallback: NO_RESOURCES,\n enabled: Boolean(serverId),\n errorMessage: 'Failed to load MCP resources',\n });\n}\n\nexport function useCreateMCPServer() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreateMCPServerVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_CONNECTION_FIELDS),\n }),\n [workspaceId]\n );\n\n return useWorkspaceMutation<\n CreateMcpConnectionMutation,\n CreateMCPServerVariables,\n MCPServerRecord\n >({\n document: CreateMcpConnectionDocument,\n variables,\n select: (data) => data?.createMCPConnection,\n errorMessage: 'Failed to connect MCP server',\n });\n}\n\nexport function useUpdateMCPServer() {\n return useWorkspaceMutation<\n UpdateMcpConnectionMutation,\n UpdateMCPServerVariables,\n MCPServerRecord\n >({\n document: UpdateMcpConnectionDocument,\n variables: ({ serverId, input }) => ({\n id: serverId,\n input: buildMutationInput(input, UPDATE_CONNECTION_FIELDS),\n }),\n select: (data) => data?.updateMCPConnection,\n errorMessage: 'Failed to update MCP server',\n });\n}\n\nexport function useDeleteMCPServer() {\n return useWorkspaceMutation<DeleteMcpConnectionMutation, string, boolean>({\n document: DeleteMcpConnectionDocument,\n variables: (serverId) => ({ id: serverId }),\n select: (data) => data?.deleteMCPConnection,\n errorMessage: 'Failed to disconnect MCP server',\n });\n}\n\nexport function useTestMCPConnection() {\n return useWorkspaceMutation<TestMcpConnectionMutation, string, boolean>({\n document: TestMcpConnectionDocument,\n variables: (serverId) => ({ id: serverId }),\n select: (data) => data?.testMCPConnection,\n errorMessage: 'Failed to test MCP connection',\n });\n}\n\nexport function useUpdateMCPTool() {\n return useWorkspaceMutation<UpdateMcpToolMutation, UpdateMCPToolVariables, MCPToolRecord>({\n document: UpdateMcpToolDocument,\n variables: ({ toolId, input }) => ({ id: toolId, input }),\n select: (data) => data?.updateMCPTool,\n errorMessage: 'Failed to update MCP tool risk level',\n });\n}\n"],"mappings":"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"}
@@ -0,0 +1,60 @@
1
+ import { CreatePolicyInput, UpdatePolicyInput } from '../../generated/wspace-types';
2
+ import { GraphQLInput } from './internal/mutationInput';
3
+ import { QueryResult } from './internal/workspaceGateway';
4
+ export interface PolicyRecord {
5
+ id: string;
6
+ name: string;
7
+ type: string;
8
+ status: string;
9
+ visibility: string;
10
+ description?: string | null;
11
+ bucketId?: string | null;
12
+ config?: Record<string, unknown> | null;
13
+ metadata?: Record<string, unknown> | null;
14
+ revision: number;
15
+ tags: string[];
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ createdById: string;
19
+ updatedById: string;
20
+ workspaceId: string;
21
+ }
22
+ export interface PolicyFilterVariables {
23
+ search?: string;
24
+ type?: string;
25
+ status?: string;
26
+ visibility?: string;
27
+ bucketId?: string;
28
+ }
29
+ /** `CreatePolicyInput` minus the `workspaceId` the hook supplies. */
30
+ export type CreatePolicyVariables = Omit<GraphQLInput<CreatePolicyInput>, 'workspaceId'>;
31
+ export interface UpdatePolicyVariables {
32
+ policyId: string;
33
+ input: GraphQLInput<UpdatePolicyInput>;
34
+ }
35
+ export declare const policyKeys: {
36
+ all: readonly ["policies"];
37
+ lists: () => readonly ["policies", "list"];
38
+ list: (filter?: PolicyFilterVariables) => readonly ["policies", "list", PolicyFilterVariables | undefined];
39
+ details: () => readonly ["policies", "detail"];
40
+ detail: (id: string) => readonly ["policies", "detail", string];
41
+ byType: (type: string) => readonly ["policies", "type", string];
42
+ };
43
+ export declare function usePolicies(filter?: PolicyFilterVariables): QueryResult<PolicyRecord[]>;
44
+ export declare function usePoliciesByType(type: string): QueryResult<PolicyRecord[]>;
45
+ export declare function usePolicy(policyId: string | undefined): QueryResult<PolicyRecord | null>;
46
+ export declare function useCreatePolicy(): {
47
+ create: (input: CreatePolicyVariables) => Promise<PolicyRecord>;
48
+ loading: boolean;
49
+ error: Error | undefined;
50
+ };
51
+ export declare function useUpdatePolicy(): {
52
+ update: (input: UpdatePolicyVariables) => Promise<PolicyRecord>;
53
+ loading: boolean;
54
+ error: Error | undefined;
55
+ };
56
+ export declare function useDeletePolicy(): {
57
+ remove: (input: string) => Promise<boolean>;
58
+ loading: boolean;
59
+ error: Error | undefined;
60
+ };
@@ -1,9 +1,9 @@
1
- import { buildMutationInput as e, fieldsOf as t } from "./internal/mutationInput.js";
2
- import { CreatePolicyDocument as n, DeletePolicyDocument as r, GetPolicyDocument as i, ListPoliciesDocument as a, UpdatePolicyDocument as o } from "../../generated/wspace-operations.js";
1
+ import { CreatePolicyDocument as e, DeletePolicyDocument as t, GetPolicyDocument as n, ListPoliciesDocument as r, UpdatePolicyDocument as i } from "../../generated/wspace-operations.js";
2
+ import { buildMutationInput as a, fieldsOf as o } from "./internal/mutationInput.js";
3
3
  import { useWorkspaceId as s, useWorkspaceMutation as c, useWorkspaceQuery as l } from "./internal/workspaceGateway.js";
4
4
  import { useCallback as u, useMemo as d } from "react";
5
- //#region src/botlit/hooks/usePolicies.ts
6
- var f = 100, p = t({
5
+ // src/botlit/hooks/usePolicies.ts
6
+ var f = 100, p = o({
7
7
  bucketId: !0,
8
8
  config: !0,
9
9
  description: !0,
@@ -14,7 +14,7 @@ var f = 100, p = t({
14
14
  type: !0,
15
15
  visibility: !0,
16
16
  workspaceId: !0
17
- }), m = t({
17
+ }), m = o({
18
18
  bucketId: !0,
19
19
  config: !0,
20
20
  description: !0,
@@ -29,30 +29,30 @@ function g(e) {
29
29
  return e?.listPolicies ?? h;
30
30
  }
31
31
  function _(e) {
32
- let t = s(), { search: n, type: r, status: i, visibility: o, bucketId: c } = e ?? {};
32
+ let t = s(), { search: n, type: i, status: a, visibility: o, bucketId: c } = e ?? {}, u = d(() => ({
33
+ filters: {
34
+ workspaceId: t,
35
+ search: n || void 0,
36
+ type: i,
37
+ status: a,
38
+ visibility: o,
39
+ bucketId: c
40
+ },
41
+ pagination: {
42
+ limit: f,
43
+ offset: 0
44
+ }
45
+ }), [
46
+ t,
47
+ n,
48
+ i,
49
+ a,
50
+ o,
51
+ c
52
+ ]);
33
53
  return l({
34
- document: a,
35
- variables: d(() => ({
36
- filters: {
37
- workspaceId: t,
38
- search: n || void 0,
39
- type: r,
40
- status: i,
41
- visibility: o,
42
- bucketId: c
43
- },
44
- pagination: {
45
- limit: f,
46
- offset: 0
47
- }
48
- }), [
49
- t,
50
- n,
51
- r,
52
- i,
53
- o,
54
- c
55
- ]),
54
+ document: r,
55
+ variables: u,
56
56
  select: g,
57
57
  fallback: h,
58
58
  enabled: !!t,
@@ -60,9 +60,10 @@ function _(e) {
60
60
  });
61
61
  }
62
62
  function v(e) {
63
+ let t = d(() => ({ id: e ?? "" }), [e]);
63
64
  return l({
64
- document: i,
65
- variables: d(() => ({ id: e ?? "" }), [e]),
65
+ document: n,
66
+ variables: t,
66
67
  select: (e) => e?.getPolicy ?? null,
67
68
  fallback: null,
68
69
  enabled: !!e,
@@ -70,12 +71,12 @@ function v(e) {
70
71
  });
71
72
  }
72
73
  function y() {
73
- let t = s(), [r, i] = c({
74
- document: n,
75
- variables: u((n) => ({ input: e({
76
- ...n,
77
- workspaceId: t
78
- }, p) }), [t]),
74
+ let t = s(), n = u((e) => ({ input: a({
75
+ ...e,
76
+ workspaceId: t
77
+ }, p) }), [t]), [r, i] = c({
78
+ document: e,
79
+ variables: n,
79
80
  select: (e) => e?.createPolicy,
80
81
  errorMessage: "Failed to create policy"
81
82
  });
@@ -86,35 +87,34 @@ function y() {
86
87
  };
87
88
  }
88
89
  function b() {
89
- let [t, n] = c({
90
- document: o,
91
- variables: ({ policyId: t, input: n }) => ({
92
- id: t,
93
- input: e(n, m)
90
+ let [e, t] = c({
91
+ document: i,
92
+ variables: ({ policyId: e, input: t }) => ({
93
+ id: e,
94
+ input: a(t, m)
94
95
  }),
95
96
  select: (e) => e?.updatePolicy,
96
97
  errorMessage: "Failed to update policy"
97
98
  });
98
99
  return {
99
- update: t,
100
- loading: n.loading,
101
- error: n.error
100
+ update: e,
101
+ loading: t.loading,
102
+ error: t.error
102
103
  };
103
104
  }
104
105
  function x() {
105
- let [e, t] = c({
106
- document: r,
106
+ let [e, n] = c({
107
+ document: t,
107
108
  variables: (e) => ({ id: e }),
108
109
  select: (e) => e?.deletePolicy,
109
110
  errorMessage: "Failed to delete policy"
110
111
  });
111
112
  return {
112
113
  remove: e,
113
- loading: t.loading,
114
- error: t.error
114
+ loading: n.loading,
115
+ error: n.error
115
116
  };
116
117
  }
117
- //#endregion
118
118
  export { y as useCreatePolicy, x as useDeletePolicy, _ as usePolicies, v as usePolicy, b as useUpdatePolicy };
119
119
 
120
120
  //# sourceMappingURL=usePolicies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePolicies.js","names":[],"sources":["../../../src/botlit/hooks/usePolicies.ts"],"sourcesContent":["/**\n * Policies Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listPolicies` / `getPolicy` operations and the\n * create/update/delete mutations on wspace-botlit-svc.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreatePolicyDocument,\n DeletePolicyDocument,\n GetPolicyDocument,\n ListPoliciesDocument,\n UpdatePolicyDocument,\n type CreatePolicyMutation,\n type DeletePolicyMutation,\n type GetPolicyQuery,\n type ListPoliciesQuery,\n type UpdatePolicyMutation,\n} from '../../generated/wspace-operations';\nimport type { CreatePolicyInput, UpdatePolicyInput } 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 = 100;\n\nexport interface PolicyRecord {\n id: string;\n name: string;\n type: string;\n status: string;\n visibility: string;\n description?: string | null;\n bucketId?: string | null;\n config?: Record<string, unknown> | null;\n metadata?: Record<string, unknown> | null;\n revision: number;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\nexport interface PolicyFilterVariables {\n search?: string;\n type?: string;\n status?: string;\n visibility?: string;\n bucketId?: string;\n}\n\n/** `CreatePolicyInput` minus the `workspaceId` the hook supplies. */\nexport type CreatePolicyVariables = Omit<GraphQLInput<CreatePolicyInput>, 'workspaceId'>;\n\nexport interface UpdatePolicyVariables {\n policyId: string;\n input: GraphQLInput<UpdatePolicyInput>;\n}\n\nconst CREATE_POLICY_FIELDS = fieldsOf<CreatePolicyInput>({\n bucketId: true,\n config: true,\n description: true,\n metadata: true,\n name: true,\n status: true,\n tags: true,\n type: true,\n visibility: true,\n workspaceId: true,\n});\n\nconst UPDATE_POLICY_FIELDS = fieldsOf<UpdatePolicyInput>({\n bucketId: true,\n config: true,\n description: true,\n metadata: true,\n name: true,\n status: true,\n tags: true,\n type: true,\n visibility: true,\n});\n\nconst NO_POLICIES: PolicyRecord[] = [];\n\nfunction selectPolicies(data: ListPoliciesQuery | undefined): PolicyRecord[] {\n return data?.listPolicies ?? NO_POLICIES;\n}\n\nexport const policyKeys = {\n all: ['policies'] as const,\n lists: () => [...policyKeys.all, 'list'] as const,\n list: (filter?: PolicyFilterVariables) => [...policyKeys.lists(), filter] as const,\n details: () => [...policyKeys.all, 'detail'] as const,\n detail: (id: string) => [...policyKeys.details(), id] as const,\n byType: (type: string) => [...policyKeys.all, 'type', type] as const,\n};\n\nexport function usePolicies(filter?: PolicyFilterVariables): QueryResult<PolicyRecord[]> {\n const workspaceId = useWorkspaceId();\n const { search, type, status, visibility, bucketId } = filter ?? {};\n\n const variables = useMemo(\n () => ({\n filters: {\n workspaceId,\n search: search || undefined,\n type,\n status,\n visibility,\n bucketId,\n },\n pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [workspaceId, search, type, status, visibility, bucketId]\n );\n\n return useWorkspaceQuery<ListPoliciesQuery, PolicyRecord[]>({\n document: ListPoliciesDocument,\n variables,\n select: selectPolicies,\n fallback: NO_POLICIES,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load policies',\n });\n}\n\nexport function usePoliciesByType(type: string): QueryResult<PolicyRecord[]> {\n return usePolicies({ type });\n}\n\nexport function usePolicy(policyId: string | undefined): QueryResult<PolicyRecord | null> {\n const variables = useMemo(() => ({ id: policyId ?? '' }), [policyId]);\n\n return useWorkspaceQuery<GetPolicyQuery, PolicyRecord | null>({\n document: GetPolicyDocument,\n variables,\n select: (data) => data?.getPolicy ?? null,\n fallback: null,\n enabled: Boolean(policyId),\n errorMessage: 'Failed to load policy',\n });\n}\n\nexport function useCreatePolicy() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreatePolicyVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_POLICY_FIELDS),\n }),\n [workspaceId]\n );\n\n const [create, state] = useWorkspaceMutation<\n CreatePolicyMutation,\n CreatePolicyVariables,\n PolicyRecord\n >({\n document: CreatePolicyDocument,\n variables,\n select: (data) => data?.createPolicy,\n errorMessage: 'Failed to create policy',\n });\n\n return { create, loading: state.loading, error: state.error };\n}\n\nexport function useUpdatePolicy() {\n const [update, state] = useWorkspaceMutation<\n UpdatePolicyMutation,\n UpdatePolicyVariables,\n PolicyRecord\n >({\n document: UpdatePolicyDocument,\n variables: ({ policyId, input }) => ({\n id: policyId,\n input: buildMutationInput(input, UPDATE_POLICY_FIELDS),\n }),\n select: (data) => data?.updatePolicy,\n errorMessage: 'Failed to update policy',\n });\n\n return { update, loading: state.loading, error: state.error };\n}\n\nexport function useDeletePolicy() {\n const [remove, state] = useWorkspaceMutation<DeletePolicyMutation, string, boolean>({\n document: DeletePolicyDocument,\n variables: (policyId) => ({ id: policyId }),\n select: (data) => data?.deletePolicy,\n errorMessage: 'Failed to delete policy',\n });\n\n return { remove, loading: state.loading, error: state.error };\n}\n"],"mappings":";;;;;AA8BA,IAAM,IAAa,KAqCb,IAAuB,EAA4B;CACvD,UAAU;CACV,QAAQ;CACR,aAAa;CACb,UAAU;CACV,MAAM;CACN,QAAQ;CACR,MAAM;CACN,MAAM;CACN,YAAY;CACZ,aAAa;CACd,CAAC,EAEI,IAAuB,EAA4B;CACvD,UAAU;CACV,QAAQ;CACR,aAAa;CACb,UAAU;CACV,MAAM;CACN,QAAQ;CACR,MAAM;CACN,MAAM;CACN,YAAY;CACb,CAAC,EAEI,IAA8B,EAAE;AAEtC,SAAS,EAAe,GAAqD;AAC3E,QAAO,GAAM,gBAAgB;;AAY/B,SAAgB,EAAY,GAA6D;CACvF,IAAM,IAAc,GAAgB,EAC9B,EAAE,WAAQ,SAAM,WAAQ,eAAY,gBAAa,KAAU,EAAE;AAiBnE,QAAO,EAAqD;EAC1D,UAAU;EACV,WAjBgB,SACT;GACL,SAAS;IACP;IACA,QAAQ,KAAU,KAAA;IAClB;IACA;IACA;IACA;IACD;GACD,YAAY;IAAE,OAAO;IAAY,QAAQ;IAAG;GAC7C,GACD;GAAC;GAAa;GAAQ;GAAM;GAAQ;GAAY;GAAS,CAC1D;EAKC,QAAQ;EACR,UAAU;EACV,SAAS,EAAQ;EACjB,cAAc;EACf,CAAC;;AAOJ,SAAgB,EAAU,GAAgE;AAGxF,QAAO,EAAuD;EAC5D,UAAU;EACV,WAJgB,SAAe,EAAE,IAAI,KAAY,IAAI,GAAG,CAAC,EAAS,CAAC;EAKnE,SAAS,MAAS,GAAM,aAAa;EACrC,UAAU;EACV,SAAS,EAAQ;EACjB,cAAc;EACf,CAAC;;AAGJ,SAAgB,IAAkB;CAChC,IAAM,IAAc,GAAgB,EAS9B,CAAC,GAAQ,KAAS,EAItB;EACA,UAAU;EACV,WAbgB,GACf,OAAkC,EACjC,OAAO,EAAmB;GAAE,GAAG;GAAO;GAAa,EAAE,EAAqB,EAC3E,GACD,CAAC,EAAY,CACd;EASC,SAAS,MAAS,GAAM;EACxB,cAAc;EACf,CAAC;AAEF,QAAO;EAAE;EAAQ,SAAS,EAAM;EAAS,OAAO,EAAM;EAAO;;AAG/D,SAAgB,IAAkB;CAChC,IAAM,CAAC,GAAQ,KAAS,EAItB;EACA,UAAU;EACV,YAAY,EAAE,aAAU,gBAAa;GACnC,IAAI;GACJ,OAAO,EAAmB,GAAO,EAAqB;GACvD;EACD,SAAS,MAAS,GAAM;EACxB,cAAc;EACf,CAAC;AAEF,QAAO;EAAE;EAAQ,SAAS,EAAM;EAAS,OAAO,EAAM;EAAO;;AAG/D,SAAgB,IAAkB;CAChC,IAAM,CAAC,GAAQ,KAAS,EAA4D;EAClF,UAAU;EACV,YAAY,OAAc,EAAE,IAAI,GAAU;EAC1C,SAAS,MAAS,GAAM;EACxB,cAAc;EACf,CAAC;AAEF,QAAO;EAAE;EAAQ,SAAS,EAAM;EAAS,OAAO,EAAM;EAAO"}
1
+ {"version":3,"file":"usePolicies.js","names":["LIST_LIMIT","CREATE_POLICY_FIELDS","fieldsOf","UPDATE_POLICY_FIELDS","NO_POLICIES","selectPolicies","data","usePolicies","workspaceId","useWorkspaceId","filter","variables","useMemo","search","type","status","visibility","bucketId","useWorkspaceQuery","ListPoliciesDocument","usePolicy","policyId","GetPolicyDocument","useCreatePolicy","useCallback","buildMutationInput","input","create","state","useWorkspaceMutation","CreatePolicyDocument","useUpdatePolicy","update","UpdatePolicyDocument","useDeletePolicy","remove","DeletePolicyDocument"],"sources":["../../../src/botlit/hooks/usePolicies.ts"],"sourcesContent":["/**\n * Policies Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listPolicies` / `getPolicy` operations and the\n * create/update/delete mutations on wspace-botlit-svc.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreatePolicyDocument,\n DeletePolicyDocument,\n GetPolicyDocument,\n ListPoliciesDocument,\n UpdatePolicyDocument,\n type CreatePolicyMutation,\n type DeletePolicyMutation,\n type GetPolicyQuery,\n type ListPoliciesQuery,\n type UpdatePolicyMutation,\n} from '../../generated/wspace-operations';\nimport type { CreatePolicyInput, UpdatePolicyInput } 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 = 100;\n\nexport interface PolicyRecord {\n id: string;\n name: string;\n type: string;\n status: string;\n visibility: string;\n description?: string | null;\n bucketId?: string | null;\n config?: Record<string, unknown> | null;\n metadata?: Record<string, unknown> | null;\n revision: number;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\nexport interface PolicyFilterVariables {\n search?: string;\n type?: string;\n status?: string;\n visibility?: string;\n bucketId?: string;\n}\n\n/** `CreatePolicyInput` minus the `workspaceId` the hook supplies. */\nexport type CreatePolicyVariables = Omit<GraphQLInput<CreatePolicyInput>, 'workspaceId'>;\n\nexport interface UpdatePolicyVariables {\n policyId: string;\n input: GraphQLInput<UpdatePolicyInput>;\n}\n\nconst CREATE_POLICY_FIELDS = fieldsOf<CreatePolicyInput>({\n bucketId: true,\n config: true,\n description: true,\n metadata: true,\n name: true,\n status: true,\n tags: true,\n type: true,\n visibility: true,\n workspaceId: true,\n});\n\nconst UPDATE_POLICY_FIELDS = fieldsOf<UpdatePolicyInput>({\n bucketId: true,\n config: true,\n description: true,\n metadata: true,\n name: true,\n status: true,\n tags: true,\n type: true,\n visibility: true,\n});\n\nconst NO_POLICIES: PolicyRecord[] = [];\n\nfunction selectPolicies(data: ListPoliciesQuery | undefined): PolicyRecord[] {\n return data?.listPolicies ?? NO_POLICIES;\n}\n\nexport const policyKeys = {\n all: ['policies'] as const,\n lists: () => [...policyKeys.all, 'list'] as const,\n list: (filter?: PolicyFilterVariables) => [...policyKeys.lists(), filter] as const,\n details: () => [...policyKeys.all, 'detail'] as const,\n detail: (id: string) => [...policyKeys.details(), id] as const,\n byType: (type: string) => [...policyKeys.all, 'type', type] as const,\n};\n\nexport function usePolicies(filter?: PolicyFilterVariables): QueryResult<PolicyRecord[]> {\n const workspaceId = useWorkspaceId();\n const { search, type, status, visibility, bucketId } = filter ?? {};\n\n const variables = useMemo(\n () => ({\n filters: {\n workspaceId,\n search: search || undefined,\n type,\n status,\n visibility,\n bucketId,\n },\n pagination: { limit: LIST_LIMIT, offset: 0 },\n }),\n [workspaceId, search, type, status, visibility, bucketId]\n );\n\n return useWorkspaceQuery<ListPoliciesQuery, PolicyRecord[]>({\n document: ListPoliciesDocument,\n variables,\n select: selectPolicies,\n fallback: NO_POLICIES,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load policies',\n });\n}\n\nexport function usePoliciesByType(type: string): QueryResult<PolicyRecord[]> {\n return usePolicies({ type });\n}\n\nexport function usePolicy(policyId: string | undefined): QueryResult<PolicyRecord | null> {\n const variables = useMemo(() => ({ id: policyId ?? '' }), [policyId]);\n\n return useWorkspaceQuery<GetPolicyQuery, PolicyRecord | null>({\n document: GetPolicyDocument,\n variables,\n select: (data) => data?.getPolicy ?? null,\n fallback: null,\n enabled: Boolean(policyId),\n errorMessage: 'Failed to load policy',\n });\n}\n\nexport function useCreatePolicy() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: CreatePolicyVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, CREATE_POLICY_FIELDS),\n }),\n [workspaceId]\n );\n\n const [create, state] = useWorkspaceMutation<\n CreatePolicyMutation,\n CreatePolicyVariables,\n PolicyRecord\n >({\n document: CreatePolicyDocument,\n variables,\n select: (data) => data?.createPolicy,\n errorMessage: 'Failed to create policy',\n });\n\n return { create, loading: state.loading, error: state.error };\n}\n\nexport function useUpdatePolicy() {\n const [update, state] = useWorkspaceMutation<\n UpdatePolicyMutation,\n UpdatePolicyVariables,\n PolicyRecord\n >({\n document: UpdatePolicyDocument,\n variables: ({ policyId, input }) => ({\n id: policyId,\n input: buildMutationInput(input, UPDATE_POLICY_FIELDS),\n }),\n select: (data) => data?.updatePolicy,\n errorMessage: 'Failed to update policy',\n });\n\n return { update, loading: state.loading, error: state.error };\n}\n\nexport function useDeletePolicy() {\n const [remove, state] = useWorkspaceMutation<DeletePolicyMutation, string, boolean>({\n document: DeletePolicyDocument,\n variables: (policyId) => ({ id: policyId }),\n select: (data) => data?.deletePolicy,\n errorMessage: 'Failed to delete policy',\n });\n\n return { remove, loading: state.loading, error: state.error };\n}\n"],"mappings":";;;;;AA8BA,IAAMA,IAAa,KAqCbC,IAAuBC,EAA4B;CACvD,UAAU;CACV,QAAQ;CACR,aAAa;CACb,UAAU;CACV,MAAM;CACN,QAAQ;CACR,MAAM;CACN,MAAM;CACN,YAAY;CACZ,aAAa;AACf,CAAC,GAEKC,IAAuBD,EAA4B;CACvD,UAAU;CACV,QAAQ;CACR,aAAa;CACb,UAAU;CACV,MAAM;CACN,QAAQ;CACR,MAAM;CACN,MAAM;CACN,YAAY;AACd,CAAC,GAEKE,IAA8B,CAAC;AAErC,SAASC,EAAe,GAAqD;CAC3E,OAAOC,GAAM,gBAAgBF;AAC/B;AAWA,SAAgBG,EAAY,GAA6D;CACvF,IAAMC,IAAcC,EAAe,GAC7B,EAAE,WAAQ,SAAM,WAAQ,eAAY,gBAAaC,KAAU,CAAC,GAE5DC,IAAYC,SACT;EACL,SAAS;GACP;GACA,QAAQC,KAAU,KAAA;GAClB;GACA;GACA;GACA;EACF;EACA,YAAY;GAAE,OAAOb;GAAY,QAAQ;EAAE;CAC7C,IACA;EAACQ;EAAaK;EAAQC;EAAMC;EAAQC;EAAYC;CAAQ,CAC1D;CAEA,OAAOC,EAAqD;EAC1D,UAAUC;EACV;EACA,QAAQd;EACR,UAAUD;EACV,SAAS,EAAQI;EACjB,cAAc;CAChB,CAAC;AACH;AAMA,SAAgBY,EAAU,GAAgE;CACxF,IAAMT,IAAYC,SAAe,EAAE,IAAIS,KAAY,GAAG,IAAI,CAACA,CAAQ,CAAC;CAEpE,OAAOH,EAAuD;EAC5D,UAAUI;EACV;EACA,SAAS,MAAShB,GAAM,aAAa;EACrC,UAAU;EACV,SAAS,EAAQe;EACjB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBE,IAAkB;CAChC,IAAMf,IAAcC,EAAe,GAE7BE,IAAYa,GACf,OAAkC,EACjC,OAAOC,EAAmB;EAAE,GAAGC;EAAO;CAAY,GAAGzB,CAAoB,EAC3E,IACA,CAACO,CAAW,CACd,GAEM,CAACmB,GAAQC,KAASC,EAItB;EACA,UAAUC;EACV;EACA,SAAS,MAASxB,GAAM;EACxB,cAAc;CAChB,CAAC;CAED,OAAO;EAAE;EAAQ,SAASsB,EAAM;EAAS,OAAOA,EAAM;CAAM;AAC9D;AAEA,SAAgBG,IAAkB;CAChC,IAAM,CAACC,GAAQJ,KAASC,EAItB;EACA,UAAUI;EACV,YAAY,EAAE,aAAU,gBAAa;GACnC,IAAIZ;GACJ,OAAOI,EAAmBC,GAAOvB,CAAoB;EACvD;EACA,SAAS,MAASG,GAAM;EACxB,cAAc;CAChB,CAAC;CAED,OAAO;EAAE;EAAQ,SAASsB,EAAM;EAAS,OAAOA,EAAM;CAAM;AAC9D;AAEA,SAAgBM,IAAkB;CAChC,IAAM,CAACC,GAAQP,KAASC,EAA4D;EAClF,UAAUO;EACV,YAAY,OAAc,EAAE,IAAIf,EAAS;EACzC,SAAS,MAASf,GAAM;EACxB,cAAc;CAChB,CAAC;CAED,OAAO;EAAE;EAAQ,SAASsB,EAAM;EAAS,OAAOA,EAAM;CAAM;AAC9D"}
@@ -0,0 +1,88 @@
1
+ import { CreatePromptTemplateInput, UpdatePromptTemplateInput } from '../../generated/wspace-types';
2
+ import { GraphQLInput } from './internal/mutationInput';
3
+ import { QueryResult } from './internal/workspaceGateway';
4
+ export interface PromptTemplateRecord {
5
+ id: string;
6
+ name: string;
7
+ slug: string;
8
+ version: string;
9
+ templateText: string;
10
+ status: string;
11
+ visibility: string;
12
+ description?: string | null;
13
+ bucketId?: string | null;
14
+ /** Free-form JSON — the UI stores an array of `PromptVariable` here. */
15
+ variables: Record<string, unknown> | unknown[];
16
+ exampleInputs: Record<string, unknown> | unknown[];
17
+ metadata?: Record<string, unknown> | null;
18
+ revision: number;
19
+ tags: string[];
20
+ createdAt: string;
21
+ updatedAt: string;
22
+ createdById: string;
23
+ updatedById: string;
24
+ workspaceId: string;
25
+ }
26
+ export interface PromptTemplateFilterVariables {
27
+ search?: string;
28
+ status?: string;
29
+ visibility?: string;
30
+ bucketId?: string;
31
+ tags?: string[];
32
+ }
33
+ /** `CreatePromptTemplateInput` minus the `workspaceId` the hook supplies. */
34
+ export type CreatePromptTemplateVariables = Omit<GraphQLInput<CreatePromptTemplateInput>, 'workspaceId'>;
35
+ export interface UpdatePromptTemplateVariables {
36
+ templateId: string;
37
+ input: GraphQLInput<UpdatePromptTemplateInput>;
38
+ }
39
+ export interface RenderPromptTemplateVariables {
40
+ templateId: string;
41
+ variables?: Record<string, unknown>;
42
+ }
43
+ export type PromptVariableType = 'string' | 'number' | 'boolean' | 'array' | 'object';
44
+ /**
45
+ * One declared template variable. `variables` is a free-form `JSON` column, so
46
+ * a template whose variables were written by another client (or stored as an
47
+ * object rather than an array) must still render.
48
+ */
49
+ export interface PromptTemplateVariable {
50
+ name: string;
51
+ type: PromptVariableType;
52
+ required: boolean;
53
+ description?: string;
54
+ defaultValue?: unknown;
55
+ }
56
+ /** The template's declared variables, normalised for rendering. */
57
+ export declare function promptTemplateVariables(template: Pick<PromptTemplateRecord, 'variables'>): PromptTemplateVariable[];
58
+ /** The template's example input sets, normalised for rendering. */
59
+ export declare function promptTemplateExamples(template: Pick<PromptTemplateRecord, 'exampleInputs'>): Record<string, unknown>[];
60
+ export declare const promptTemplateKeys: {
61
+ all: readonly ["promptTemplates"];
62
+ lists: () => readonly ["promptTemplates", "list"];
63
+ list: (filter?: PromptTemplateFilterVariables) => readonly ["promptTemplates", "list", PromptTemplateFilterVariables | undefined];
64
+ details: () => readonly ["promptTemplates", "detail"];
65
+ detail: (id: string) => readonly ["promptTemplates", "detail", string];
66
+ };
67
+ export declare function usePromptTemplates(filter?: PromptTemplateFilterVariables): QueryResult<PromptTemplateRecord[]>;
68
+ export declare function usePromptTemplate(templateId: string | undefined): QueryResult<PromptTemplateRecord | null>;
69
+ export declare function useCreatePromptTemplate(): {
70
+ create: (input: CreatePromptTemplateVariables) => Promise<PromptTemplateRecord>;
71
+ loading: boolean;
72
+ error: Error | undefined;
73
+ };
74
+ export declare function useUpdatePromptTemplate(): {
75
+ update: (input: UpdatePromptTemplateVariables) => Promise<PromptTemplateRecord>;
76
+ loading: boolean;
77
+ error: Error | undefined;
78
+ };
79
+ export declare function useDeletePromptTemplate(): {
80
+ remove: (input: string) => Promise<boolean>;
81
+ loading: boolean;
82
+ error: Error | undefined;
83
+ };
84
+ export declare function useRenderPromptTemplate(): {
85
+ render: (input: RenderPromptTemplateVariables) => Promise<string>;
86
+ loading: boolean;
87
+ error: Error | undefined;
88
+ };