@data-club/ai-hub 0.0.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 (344) hide show
  1. package/dist/auth/passwordPolicy.d.ts +55 -0
  2. package/dist/auth/passwordPolicy.d.ts.map +1 -0
  3. package/dist/auth/passwordPolicy.js +63 -0
  4. package/dist/auth/passwordPolicy.js.map +1 -0
  5. package/dist/auth/texts.d.ts +815 -0
  6. package/dist/auth/texts.d.ts.map +1 -0
  7. package/dist/auth/texts.js +429 -0
  8. package/dist/auth/texts.js.map +1 -0
  9. package/dist/client/AIHubClient.d.ts +1058 -0
  10. package/dist/client/AIHubClient.d.ts.map +1 -0
  11. package/dist/client/AIHubClient.js +950 -0
  12. package/dist/client/AIHubClient.js.map +1 -0
  13. package/dist/client/index.d.ts +11 -0
  14. package/dist/client/index.d.ts.map +1 -0
  15. package/dist/client/index.js +9 -0
  16. package/dist/client/index.js.map +1 -0
  17. package/dist/client/sseParser.d.ts +41 -0
  18. package/dist/client/sseParser.d.ts.map +1 -0
  19. package/dist/client/sseParser.js +153 -0
  20. package/dist/client/sseParser.js.map +1 -0
  21. package/dist/client/tokenStorage.d.ts +56 -0
  22. package/dist/client/tokenStorage.d.ts.map +1 -0
  23. package/dist/client/tokenStorage.js +116 -0
  24. package/dist/client/tokenStorage.js.map +1 -0
  25. package/dist/components/AgentsPicker/index.d.ts +70 -0
  26. package/dist/components/AgentsPicker/index.d.ts.map +1 -0
  27. package/dist/components/AgentsPicker/index.js +63 -0
  28. package/dist/components/AgentsPicker/index.js.map +1 -0
  29. package/dist/components/AuthGate/index.d.ts +79 -0
  30. package/dist/components/AuthGate/index.d.ts.map +1 -0
  31. package/dist/components/AuthGate/index.js +61 -0
  32. package/dist/components/AuthGate/index.js.map +1 -0
  33. package/dist/components/CacheBadge/index.d.ts +88 -0
  34. package/dist/components/CacheBadge/index.d.ts.map +1 -0
  35. package/dist/components/CacheBadge/index.js +127 -0
  36. package/dist/components/CacheBadge/index.js.map +1 -0
  37. package/dist/components/ChangePassword/index.d.ts +109 -0
  38. package/dist/components/ChangePassword/index.d.ts.map +1 -0
  39. package/dist/components/ChangePassword/index.js +142 -0
  40. package/dist/components/ChangePassword/index.js.map +1 -0
  41. package/dist/components/ChatShell/ShellHeader.d.ts +44 -0
  42. package/dist/components/ChatShell/ShellHeader.d.ts.map +1 -0
  43. package/dist/components/ChatShell/ShellHeader.js +14 -0
  44. package/dist/components/ChatShell/ShellHeader.js.map +1 -0
  45. package/dist/components/ChatShell/UserMenu.d.ts +48 -0
  46. package/dist/components/ChatShell/UserMenu.d.ts.map +1 -0
  47. package/dist/components/ChatShell/UserMenu.js +86 -0
  48. package/dist/components/ChatShell/UserMenu.js.map +1 -0
  49. package/dist/components/ChatShell/index.d.ts +98 -0
  50. package/dist/components/ChatShell/index.d.ts.map +1 -0
  51. package/dist/components/ChatShell/index.js +124 -0
  52. package/dist/components/ChatShell/index.js.map +1 -0
  53. package/dist/components/DataClubAIHub/index.d.ts +132 -0
  54. package/dist/components/DataClubAIHub/index.d.ts.map +1 -0
  55. package/dist/components/DataClubAIHub/index.js +124 -0
  56. package/dist/components/DataClubAIHub/index.js.map +1 -0
  57. package/dist/components/DataClubAIHubAdmin/AgentEditorModal.d.ts +89 -0
  58. package/dist/components/DataClubAIHubAdmin/AgentEditorModal.d.ts.map +1 -0
  59. package/dist/components/DataClubAIHubAdmin/AgentEditorModal.js +199 -0
  60. package/dist/components/DataClubAIHubAdmin/AgentEditorModal.js.map +1 -0
  61. package/dist/components/DataClubAIHubAdmin/AgentsPage.d.ts +33 -0
  62. package/dist/components/DataClubAIHubAdmin/AgentsPage.d.ts.map +1 -0
  63. package/dist/components/DataClubAIHubAdmin/AgentsPage.js +137 -0
  64. package/dist/components/DataClubAIHubAdmin/AgentsPage.js.map +1 -0
  65. package/dist/components/DataClubAIHubAdmin/CreateUserModal.d.ts +50 -0
  66. package/dist/components/DataClubAIHubAdmin/CreateUserModal.d.ts.map +1 -0
  67. package/dist/components/DataClubAIHubAdmin/CreateUserModal.js +93 -0
  68. package/dist/components/DataClubAIHubAdmin/CreateUserModal.js.map +1 -0
  69. package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.d.ts +49 -0
  70. package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.d.ts.map +1 -0
  71. package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.js +94 -0
  72. package/dist/components/DataClubAIHubAdmin/PasswordRevealModal.js.map +1 -0
  73. package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.d.ts +37 -0
  74. package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.d.ts.map +1 -0
  75. package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.js +44 -0
  76. package/dist/components/DataClubAIHubAdmin/ResetPasswordModal.js.map +1 -0
  77. package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.d.ts +56 -0
  78. package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.d.ts.map +1 -0
  79. package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.js +158 -0
  80. package/dist/components/DataClubAIHubAdmin/RotatingMessageEditorModal.js.map +1 -0
  81. package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.d.ts +29 -0
  82. package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.d.ts.map +1 -0
  83. package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.js +183 -0
  84. package/dist/components/DataClubAIHubAdmin/RotatingMessagesPage.js.map +1 -0
  85. package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.d.ts +38 -0
  86. package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.d.ts.map +1 -0
  87. package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.js +294 -0
  88. package/dist/components/DataClubAIHubAdmin/SessionsOverviewPage.js.map +1 -0
  89. package/dist/components/DataClubAIHubAdmin/SettingsPage.d.ts +36 -0
  90. package/dist/components/DataClubAIHubAdmin/SettingsPage.d.ts.map +1 -0
  91. package/dist/components/DataClubAIHubAdmin/SettingsPage.js +373 -0
  92. package/dist/components/DataClubAIHubAdmin/SettingsPage.js.map +1 -0
  93. package/dist/components/DataClubAIHubAdmin/UsersPage.d.ts +47 -0
  94. package/dist/components/DataClubAIHubAdmin/UsersPage.d.ts.map +1 -0
  95. package/dist/components/DataClubAIHubAdmin/UsersPage.js +233 -0
  96. package/dist/components/DataClubAIHubAdmin/UsersPage.js.map +1 -0
  97. package/dist/components/DataClubAIHubAdmin/index.d.ts +87 -0
  98. package/dist/components/DataClubAIHubAdmin/index.d.ts.map +1 -0
  99. package/dist/components/DataClubAIHubAdmin/index.js +137 -0
  100. package/dist/components/DataClubAIHubAdmin/index.js.map +1 -0
  101. package/dist/components/DataClubAIHubLogin/index.d.ts +113 -0
  102. package/dist/components/DataClubAIHubLogin/index.d.ts.map +1 -0
  103. package/dist/components/DataClubAIHubLogin/index.js +123 -0
  104. package/dist/components/DataClubAIHubLogin/index.js.map +1 -0
  105. package/dist/components/EffortControl/index.d.ts +57 -0
  106. package/dist/components/EffortControl/index.d.ts.map +1 -0
  107. package/dist/components/EffortControl/index.js +84 -0
  108. package/dist/components/EffortControl/index.js.map +1 -0
  109. package/dist/components/Layout/index.d.ts +63 -0
  110. package/dist/components/Layout/index.d.ts.map +1 -0
  111. package/dist/components/Layout/index.js +45 -0
  112. package/dist/components/Layout/index.js.map +1 -0
  113. package/dist/components/MainColumn/index.d.ts +69 -0
  114. package/dist/components/MainColumn/index.d.ts.map +1 -0
  115. package/dist/components/MainColumn/index.js +47 -0
  116. package/dist/components/MainColumn/index.js.map +1 -0
  117. package/dist/components/MarkdownRenderer/index.d.ts +66 -0
  118. package/dist/components/MarkdownRenderer/index.d.ts.map +1 -0
  119. package/dist/components/MarkdownRenderer/index.js +153 -0
  120. package/dist/components/MarkdownRenderer/index.js.map +1 -0
  121. package/dist/components/MessageInput/index.d.ts +85 -0
  122. package/dist/components/MessageInput/index.d.ts.map +1 -0
  123. package/dist/components/MessageInput/index.js +139 -0
  124. package/dist/components/MessageInput/index.js.map +1 -0
  125. package/dist/components/MessageList/index.d.ts +156 -0
  126. package/dist/components/MessageList/index.d.ts.map +1 -0
  127. package/dist/components/MessageList/index.js +352 -0
  128. package/dist/components/MessageList/index.js.map +1 -0
  129. package/dist/components/ReasoningSelector/index.d.ts +77 -0
  130. package/dist/components/ReasoningSelector/index.d.ts.map +1 -0
  131. package/dist/components/ReasoningSelector/index.js +156 -0
  132. package/dist/components/ReasoningSelector/index.js.map +1 -0
  133. package/dist/components/ReasoningView/index.d.ts +94 -0
  134. package/dist/components/ReasoningView/index.d.ts.map +1 -0
  135. package/dist/components/ReasoningView/index.js +83 -0
  136. package/dist/components/ReasoningView/index.js.map +1 -0
  137. package/dist/components/ScrollToPresentButton/index.d.ts +54 -0
  138. package/dist/components/ScrollToPresentButton/index.d.ts.map +1 -0
  139. package/dist/components/ScrollToPresentButton/index.js +44 -0
  140. package/dist/components/ScrollToPresentButton/index.js.map +1 -0
  141. package/dist/components/SessionsPanel/SessionTitleModal.d.ts +79 -0
  142. package/dist/components/SessionsPanel/SessionTitleModal.d.ts.map +1 -0
  143. package/dist/components/SessionsPanel/SessionTitleModal.js +102 -0
  144. package/dist/components/SessionsPanel/SessionTitleModal.js.map +1 -0
  145. package/dist/components/SessionsPanel/index.d.ts +100 -0
  146. package/dist/components/SessionsPanel/index.d.ts.map +1 -0
  147. package/dist/components/SessionsPanel/index.js +176 -0
  148. package/dist/components/SessionsPanel/index.js.map +1 -0
  149. package/dist/components/SystemNotice/index.d.ts +66 -0
  150. package/dist/components/SystemNotice/index.d.ts.map +1 -0
  151. package/dist/components/SystemNotice/index.js +81 -0
  152. package/dist/components/SystemNotice/index.js.map +1 -0
  153. package/dist/components/ThemeSwitcher/index.d.ts +66 -0
  154. package/dist/components/ThemeSwitcher/index.d.ts.map +1 -0
  155. package/dist/components/ThemeSwitcher/index.js +73 -0
  156. package/dist/components/ThemeSwitcher/index.js.map +1 -0
  157. package/dist/components/ToolCallView/formatContent.d.ts +36 -0
  158. package/dist/components/ToolCallView/formatContent.d.ts.map +1 -0
  159. package/dist/components/ToolCallView/formatContent.js +53 -0
  160. package/dist/components/ToolCallView/formatContent.js.map +1 -0
  161. package/dist/components/ToolCallView/index.d.ts +120 -0
  162. package/dist/components/ToolCallView/index.d.ts.map +1 -0
  163. package/dist/components/ToolCallView/index.js +104 -0
  164. package/dist/components/ToolCallView/index.js.map +1 -0
  165. package/dist/components/TpmBanner/index.d.ts +53 -0
  166. package/dist/components/TpmBanner/index.d.ts.map +1 -0
  167. package/dist/components/TpmBanner/index.js +116 -0
  168. package/dist/components/TpmBanner/index.js.map +1 -0
  169. package/dist/components/TurnStatusIndicator/index.d.ts +77 -0
  170. package/dist/components/TurnStatusIndicator/index.d.ts.map +1 -0
  171. package/dist/components/TurnStatusIndicator/index.js +122 -0
  172. package/dist/components/TurnStatusIndicator/index.js.map +1 -0
  173. package/dist/components/internal/PasswordInput.d.ts +62 -0
  174. package/dist/components/internal/PasswordInput.d.ts.map +1 -0
  175. package/dist/components/internal/PasswordInput.js +42 -0
  176. package/dist/components/internal/PasswordInput.js.map +1 -0
  177. package/dist/context/AIHubContext.d.ts +220 -0
  178. package/dist/context/AIHubContext.d.ts.map +1 -0
  179. package/dist/context/AIHubContext.js +19 -0
  180. package/dist/context/AIHubContext.js.map +1 -0
  181. package/dist/context/AIHubProvider.d.ts +75 -0
  182. package/dist/context/AIHubProvider.d.ts.map +1 -0
  183. package/dist/context/AIHubProvider.js +954 -0
  184. package/dist/context/AIHubProvider.js.map +1 -0
  185. package/dist/context/index.d.ts +9 -0
  186. package/dist/context/index.d.ts.map +1 -0
  187. package/dist/context/index.js +9 -0
  188. package/dist/context/index.js.map +1 -0
  189. package/dist/context/theme.d.ts +43 -0
  190. package/dist/context/theme.d.ts.map +1 -0
  191. package/dist/context/theme.js +70 -0
  192. package/dist/context/theme.js.map +1 -0
  193. package/dist/context/useAIHub.d.ts +104 -0
  194. package/dist/context/useAIHub.d.ts.map +1 -0
  195. package/dist/context/useAIHub.js +63 -0
  196. package/dist/context/useAIHub.js.map +1 -0
  197. package/dist/context/useAIHubAuth.d.ts +44 -0
  198. package/dist/context/useAIHubAuth.d.ts.map +1 -0
  199. package/dist/context/useAIHubAuth.js +35 -0
  200. package/dist/context/useAIHubAuth.js.map +1 -0
  201. package/dist/index.d.ts +76 -0
  202. package/dist/index.d.ts.map +1 -0
  203. package/dist/index.js +57 -0
  204. package/dist/index.js.map +1 -0
  205. package/dist/primitives/index.d.ts +99 -0
  206. package/dist/primitives/index.d.ts.map +1 -0
  207. package/dist/primitives/index.js +97 -0
  208. package/dist/primitives/index.js.map +1 -0
  209. package/dist/state/affordances.d.ts +182 -0
  210. package/dist/state/affordances.d.ts.map +1 -0
  211. package/dist/state/affordances.js +189 -0
  212. package/dist/state/affordances.js.map +1 -0
  213. package/dist/state/stateReducer.d.ts +72 -0
  214. package/dist/state/stateReducer.d.ts.map +1 -0
  215. package/dist/state/stateReducer.js +122 -0
  216. package/dist/state/stateReducer.js.map +1 -0
  217. package/dist/stories/EffortControl.stories.d.ts +14 -0
  218. package/dist/stories/EffortControl.stories.d.ts.map +1 -0
  219. package/dist/stories/EffortControl.stories.js +43 -0
  220. package/dist/stories/EffortControl.stories.js.map +1 -0
  221. package/dist/stories/MarkdownRenderer.stories.d.ts +25 -0
  222. package/dist/stories/MarkdownRenderer.stories.d.ts.map +1 -0
  223. package/dist/stories/MarkdownRenderer.stories.js +178 -0
  224. package/dist/stories/MarkdownRenderer.stories.js.map +1 -0
  225. package/dist/stories/MessageBubble.stories.d.ts +21 -0
  226. package/dist/stories/MessageBubble.stories.d.ts.map +1 -0
  227. package/dist/stories/MessageBubble.stories.js +59 -0
  228. package/dist/stories/MessageBubble.stories.js.map +1 -0
  229. package/dist/stories/ReasoningView.stories.d.ts +18 -0
  230. package/dist/stories/ReasoningView.stories.d.ts.map +1 -0
  231. package/dist/stories/ReasoningView.stories.js +62 -0
  232. package/dist/stories/ReasoningView.stories.js.map +1 -0
  233. package/dist/stories/ScrollToPresentButton.stories.d.ts +18 -0
  234. package/dist/stories/ScrollToPresentButton.stories.d.ts.map +1 -0
  235. package/dist/stories/ScrollToPresentButton.stories.js +34 -0
  236. package/dist/stories/ScrollToPresentButton.stories.js.map +1 -0
  237. package/dist/stories/SystemNotice.stories.d.ts +17 -0
  238. package/dist/stories/SystemNotice.stories.d.ts.map +1 -0
  239. package/dist/stories/SystemNotice.stories.js +42 -0
  240. package/dist/stories/SystemNotice.stories.js.map +1 -0
  241. package/dist/stories/ThemeSwitcher.stories.d.ts +15 -0
  242. package/dist/stories/ThemeSwitcher.stories.d.ts.map +1 -0
  243. package/dist/stories/ThemeSwitcher.stories.js +35 -0
  244. package/dist/stories/ThemeSwitcher.stories.js.map +1 -0
  245. package/dist/stories/ToolCallView.stories.d.ts +20 -0
  246. package/dist/stories/ToolCallView.stories.d.ts.map +1 -0
  247. package/dist/stories/ToolCallView.stories.js +65 -0
  248. package/dist/stories/ToolCallView.stories.js.map +1 -0
  249. package/dist/stories/TpmBanner.stories.d.ts +24 -0
  250. package/dist/stories/TpmBanner.stories.d.ts.map +1 -0
  251. package/dist/stories/TpmBanner.stories.js +63 -0
  252. package/dist/stories/TpmBanner.stories.js.map +1 -0
  253. package/dist/stories/TurnStatusIndicator.stories.d.ts +25 -0
  254. package/dist/stories/TurnStatusIndicator.stories.d.ts.map +1 -0
  255. package/dist/stories/TurnStatusIndicator.stories.js +56 -0
  256. package/dist/stories/TurnStatusIndicator.stories.js.map +1 -0
  257. package/dist/stories/_mockProvider.d.ts +44 -0
  258. package/dist/stories/_mockProvider.d.ts.map +1 -0
  259. package/dist/stories/_mockProvider.js +84 -0
  260. package/dist/stories/_mockProvider.js.map +1 -0
  261. package/dist/types.d.ts +787 -0
  262. package/dist/types.d.ts.map +1 -0
  263. package/dist/types.js +19 -0
  264. package/dist/types.js.map +1 -0
  265. package/dist/webcomponent/defineWebComponent.d.ts +106 -0
  266. package/dist/webcomponent/defineWebComponent.d.ts.map +1 -0
  267. package/dist/webcomponent/defineWebComponent.js +126 -0
  268. package/dist/webcomponent/defineWebComponent.js.map +1 -0
  269. package/dist/webcomponent/index.d.ts +7 -0
  270. package/dist/webcomponent/index.d.ts.map +1 -0
  271. package/dist/webcomponent/index.js +7 -0
  272. package/dist/webcomponent/index.js.map +1 -0
  273. package/package.json +63 -0
  274. package/src/__lint-canary__/step1-lint-canary.ts.disabled +28 -0
  275. package/src/auth/passwordPolicy.ts +75 -0
  276. package/src/auth/texts.ts +1294 -0
  277. package/src/client/AIHubClient.ts +1718 -0
  278. package/src/client/index.ts +30 -0
  279. package/src/client/sseParser.ts +168 -0
  280. package/src/client/tokenStorage.ts +131 -0
  281. package/src/components/AgentsPicker/index.tsx +147 -0
  282. package/src/components/AuthGate/index.tsx +132 -0
  283. package/src/components/CacheBadge/index.tsx +245 -0
  284. package/src/components/ChangePassword/index.tsx +375 -0
  285. package/src/components/ChatShell/ShellHeader.tsx +80 -0
  286. package/src/components/ChatShell/UserMenu.tsx +196 -0
  287. package/src/components/ChatShell/index.tsx +307 -0
  288. package/src/components/DataClubAIHub/index.tsx +300 -0
  289. package/src/components/DataClubAIHubAdmin/AgentEditorModal.tsx +505 -0
  290. package/src/components/DataClubAIHubAdmin/AgentsPage.tsx +342 -0
  291. package/src/components/DataClubAIHubAdmin/CreateUserModal.tsx +214 -0
  292. package/src/components/DataClubAIHubAdmin/PasswordRevealModal.tsx +204 -0
  293. package/src/components/DataClubAIHubAdmin/ResetPasswordModal.tsx +122 -0
  294. package/src/components/DataClubAIHubAdmin/RotatingMessageEditorModal.tsx +408 -0
  295. package/src/components/DataClubAIHubAdmin/RotatingMessagesPage.tsx +373 -0
  296. package/src/components/DataClubAIHubAdmin/SessionsOverviewPage.tsx +639 -0
  297. package/src/components/DataClubAIHubAdmin/SettingsPage.tsx +979 -0
  298. package/src/components/DataClubAIHubAdmin/UsersPage.tsx +495 -0
  299. package/src/components/DataClubAIHubAdmin/index.tsx +277 -0
  300. package/src/components/DataClubAIHubLogin/index.tsx +282 -0
  301. package/src/components/EffortControl/index.tsx +138 -0
  302. package/src/components/Layout/index.tsx +92 -0
  303. package/src/components/MainColumn/index.tsx +131 -0
  304. package/src/components/MarkdownRenderer/index.tsx +256 -0
  305. package/src/components/MessageInput/index.tsx +283 -0
  306. package/src/components/MessageList/index.tsx +753 -0
  307. package/src/components/ReasoningSelector/index.tsx +268 -0
  308. package/src/components/ReasoningView/index.tsx +183 -0
  309. package/src/components/ScrollToPresentButton/index.tsx +85 -0
  310. package/src/components/SessionsPanel/SessionTitleModal.tsx +256 -0
  311. package/src/components/SessionsPanel/index.tsx +406 -0
  312. package/src/components/SystemNotice/index.tsx +151 -0
  313. package/src/components/ThemeSwitcher/index.tsx +136 -0
  314. package/src/components/ToolCallView/formatContent.ts +50 -0
  315. package/src/components/ToolCallView/index.tsx +274 -0
  316. package/src/components/TpmBanner/index.tsx +172 -0
  317. package/src/components/TurnStatusIndicator/index.tsx +203 -0
  318. package/src/components/internal/PasswordInput.tsx +145 -0
  319. package/src/context/AIHubContext.ts +249 -0
  320. package/src/context/AIHubProvider.tsx +1084 -0
  321. package/src/context/index.ts +9 -0
  322. package/src/context/theme.ts +76 -0
  323. package/src/context/useAIHub.ts +151 -0
  324. package/src/context/useAIHubAuth.ts +65 -0
  325. package/src/index.ts +275 -0
  326. package/src/primitives/index.ts +101 -0
  327. package/src/state/affordances.ts +321 -0
  328. package/src/state/stateReducer.ts +131 -0
  329. package/src/stories/EffortControl.stories.tsx +63 -0
  330. package/src/stories/MarkdownRenderer.stories.tsx +201 -0
  331. package/src/stories/MessageBubble.stories.tsx +101 -0
  332. package/src/stories/ReasoningView.stories.tsx +81 -0
  333. package/src/stories/ScrollToPresentButton.stories.tsx +52 -0
  334. package/src/stories/SystemNotice.stories.tsx +59 -0
  335. package/src/stories/ThemeSwitcher.stories.tsx +55 -0
  336. package/src/stories/ToolCallView.stories.tsx +95 -0
  337. package/src/stories/TpmBanner.stories.tsx +93 -0
  338. package/src/stories/TurnStatusIndicator.stories.tsx +86 -0
  339. package/src/stories/_mockProvider.tsx +116 -0
  340. package/src/styles/CLASSES.md +356 -0
  341. package/src/styles/default.css +2937 -0
  342. package/src/types.ts +867 -0
  343. package/src/webcomponent/defineWebComponent.tsx +193 -0
  344. package/src/webcomponent/index.ts +11 -0
@@ -0,0 +1,342 @@
1
+ /**
2
+ * `<AdminAgentsPage />` — the Agents sub-page mounted inside
3
+ * `<DataClubAIHubAdmin />` ([06-admin-agents.md]).
4
+ *
5
+ * Lists the ai-hub agents catalog with per-row `[Edit]` + `[Archive]` /
6
+ * `[Unarchive]` actions, top-right `[+ Create agent]` + `[↗ Open Letta ADE]`,
7
+ * and a `[☐ Show archived]` toggle. **No TPM⚙ button** — TPM-recovery was
8
+ * removed in Step 11.5 (§6.5); the column is retained on the DB schema but
9
+ * the UI doesn't surface it. **No 🗑 button** — agents cannot be hard-deleted
10
+ * in v1 (§6.3.4).
11
+ *
12
+ * Visible to `power_user`+ per §8.2. The component itself does not gate
13
+ * — that's the shell's job — but it expects to be mounted only inside the
14
+ * admin shell.
15
+ *
16
+ * @see SPECIFICATIONS.md §6.3.4 / §8.3 / §11
17
+ * @see ui-sketches/06-admin-agents.md
18
+ */
19
+ import { useEffect, useMemo, useState, type ReactNode } from "react";
20
+
21
+ import type { AIHubAdminTexts } from "../../auth/texts.js";
22
+ import type { AdminAgentView } from "../../client/AIHubClient.js";
23
+ import { useAIHub } from "../../context/useAIHub.js";
24
+ import { useAIHubAuth } from "../../context/useAIHubAuth.js";
25
+
26
+ import {
27
+ AgentEditorModal,
28
+ type AgentEditorMode,
29
+ type AgentEditorSubmitBody,
30
+ } from "./AgentEditorModal.js";
31
+
32
+ /** State of the editor modal: closed, or open in one of two modes. */
33
+ type EditorState =
34
+ | { kind: "closed" }
35
+ | { kind: "create" }
36
+ | { kind: "edit"; agent: AdminAgentView };
37
+
38
+ /** Resolves the deployment's ADE URL or derives one from the base URL. */
39
+ function deriveAdeUrl(adeUrl: string | undefined): string | null {
40
+ if (!adeUrl) return null;
41
+ return adeUrl.replace(/\/$/, "");
42
+ }
43
+
44
+ /** Sort comparator — alphabetical by display_name, stable. */
45
+ function byDisplayName(a: AdminAgentView, b: AdminAgentView): number {
46
+ return a.display_name.localeCompare(b.display_name);
47
+ }
48
+
49
+ /** Props for `<AdminAgentsPage />`. */
50
+ export interface AdminAgentsPageProps {
51
+ /** Resolved admin texts. */
52
+ texts: AIHubAdminTexts;
53
+ }
54
+
55
+ /**
56
+ * Renders the Agents sub-page.
57
+ *
58
+ * @param props - see {@link AdminAgentsPageProps}.
59
+ * @returns the rendered page.
60
+ */
61
+ export function AdminAgentsPage(props: AdminAgentsPageProps): ReactNode {
62
+ const { client } = useAIHub();
63
+ const auth = useAIHubAuth();
64
+ const adeUrl = deriveAdeUrl(auth.deployment?.letta_ade_url);
65
+
66
+ const [agents, setAgents] = useState<AdminAgentView[] | null>(null);
67
+ const [loadError, setLoadError] = useState<string | null>(null);
68
+ const [showArchived, setShowArchived] = useState(false);
69
+ const [editor, setEditor] = useState<EditorState>({ kind: "closed" });
70
+
71
+ useEffect(() => {
72
+ let cancelled = false;
73
+ void (async () => {
74
+ try {
75
+ const rows = await client.listAdminAgents();
76
+ if (!cancelled) {
77
+ setAgents([...rows].sort(byDisplayName));
78
+ setLoadError(null);
79
+ }
80
+ } catch (err) {
81
+ if (!cancelled) {
82
+ setLoadError(
83
+ err instanceof Error && err.message.length > 0
84
+ ? err.message
85
+ : props.texts.agentsGenericError,
86
+ );
87
+ }
88
+ }
89
+ })();
90
+ return () => {
91
+ cancelled = true;
92
+ };
93
+ }, [client, props.texts.agentsGenericError]);
94
+
95
+ const visibleAgents = useMemo(() => {
96
+ if (agents === null) return null;
97
+ return showArchived ? agents : agents.filter((a) => !a.is_archived);
98
+ }, [agents, showArchived]);
99
+
100
+ async function handleCreateSubmit(body: AgentEditorSubmitBody): Promise<void> {
101
+ const created = await client.createAdminAgent({
102
+ displayName: body.displayName,
103
+ lettaAgentId: body.lettaAgentId,
104
+ sandboxSeedName: body.sandboxSeedName,
105
+ forkSourceConversationId: body.forkSourceConversationId,
106
+ });
107
+ setAgents((prev) => {
108
+ const next = prev === null ? [created] : [...prev, created];
109
+ return next.sort(byDisplayName);
110
+ });
111
+ setEditor({ kind: "closed" });
112
+ }
113
+
114
+ async function handleEditSubmit(
115
+ target: AdminAgentView,
116
+ body: AgentEditorSubmitBody,
117
+ ): Promise<void> {
118
+ const updated = await client.patchAdminAgent(target.id, {
119
+ displayName: body.displayName,
120
+ lettaAgentId: body.lettaAgentId,
121
+ sandboxSeedName: body.sandboxSeedName,
122
+ forkSourceConversationId: body.forkSourceConversationId,
123
+ });
124
+ setAgents((prev) =>
125
+ prev === null
126
+ ? [updated]
127
+ : prev.map((a) => (a.id === updated.id ? updated : a)).sort(byDisplayName),
128
+ );
129
+ setEditor({ kind: "closed" });
130
+ }
131
+
132
+ async function handleArchive(target: AdminAgentView): Promise<void> {
133
+ const prompt = props.texts.agentArchiveConfirmPrompt.replace(
134
+ "{name}",
135
+ target.display_name,
136
+ );
137
+ // Native confirm is fine for v1 per [06-admin-agents.md].
138
+ // eslint-disable-next-line no-alert
139
+ const ok =
140
+ typeof window !== "undefined" && typeof window.confirm === "function"
141
+ ? window.confirm(prompt)
142
+ : true;
143
+ if (!ok) return;
144
+ const updated = await client.patchAdminAgent(target.id, { isArchived: true });
145
+ setAgents((prev) =>
146
+ prev === null
147
+ ? [updated]
148
+ : prev.map((a) => (a.id === updated.id ? updated : a)),
149
+ );
150
+ }
151
+
152
+ async function handleUnarchive(target: AdminAgentView): Promise<void> {
153
+ const updated = await client.patchAdminAgent(target.id, { isArchived: false });
154
+ setAgents((prev) =>
155
+ prev === null
156
+ ? [updated]
157
+ : prev.map((a) => (a.id === updated.id ? updated : a)),
158
+ );
159
+ }
160
+
161
+ return (
162
+ <div
163
+ className="data-club-ai-hub-admin__agents-page"
164
+ data-testid="admin-agents-page"
165
+ >
166
+ <header className="data-club-ai-hub-admin__page-header">
167
+ <h1
168
+ className="data-club-ai-hub-admin__page-heading"
169
+ data-testid="admin-agents-heading"
170
+ >
171
+ {props.texts.agentsHeading}
172
+ </h1>
173
+ <div className="data-club-ai-hub-admin__page-header-actions">
174
+ {adeUrl !== null ? (
175
+ <a
176
+ className="data-club-ai-hub-admin__button"
177
+ data-testid="admin-agents-open-ade"
178
+ href={adeUrl}
179
+ target="_blank"
180
+ rel="noopener noreferrer"
181
+ >
182
+ {props.texts.openLettaAdeButton}
183
+ </a>
184
+ ) : null}
185
+ <button
186
+ type="button"
187
+ className="data-club-ai-hub-admin__button data-club-ai-hub-admin__button--primary"
188
+ data-testid="admin-agents-create"
189
+ onClick={() => setEditor({ kind: "create" })}
190
+ >
191
+ {props.texts.createAgentButton}
192
+ </button>
193
+ </div>
194
+ </header>
195
+ {loadError !== null ? (
196
+ <div
197
+ className="data-club-ai-hub-admin__error"
198
+ data-testid="admin-agents-error"
199
+ role="alert"
200
+ >
201
+ {loadError}
202
+ </div>
203
+ ) : null}
204
+ {agents === null && loadError === null ? (
205
+ <p
206
+ className="data-club-ai-hub-admin__loading"
207
+ data-testid="admin-agents-loading"
208
+ >
209
+ {props.texts.agentsLoading}
210
+ </p>
211
+ ) : null}
212
+ {visibleAgents !== null && visibleAgents.length === 0 ? (
213
+ <p
214
+ className="data-club-ai-hub-admin__empty"
215
+ data-testid="admin-agents-empty"
216
+ >
217
+ {props.texts.agentsEmpty}
218
+ </p>
219
+ ) : null}
220
+ {visibleAgents !== null && visibleAgents.length > 0 ? (
221
+ <table
222
+ className="data-club-ai-hub-admin__agents-table"
223
+ data-testid="admin-agents-table"
224
+ >
225
+ <thead>
226
+ <tr>
227
+ <th>{props.texts.agentColumnName}</th>
228
+ <th>{props.texts.agentColumnLettaId}</th>
229
+ <th>{props.texts.agentColumnStatus}</th>
230
+ <th>{props.texts.agentColumnActions}</th>
231
+ </tr>
232
+ </thead>
233
+ <tbody>
234
+ {visibleAgents.map((a) => (
235
+ <tr
236
+ key={a.id}
237
+ data-testid={`admin-agent-row-${a.id}`}
238
+ data-archived={a.is_archived ? "true" : "false"}
239
+ className={
240
+ a.is_archived
241
+ ? "data-club-ai-hub-admin__agents-row data-club-ai-hub-admin__agents-row--archived"
242
+ : "data-club-ai-hub-admin__agents-row"
243
+ }
244
+ >
245
+ <td>{a.display_name}</td>
246
+ <td>
247
+ <code className="data-club-ai-hub-admin__mono">
248
+ {a.letta_agent_id}
249
+ </code>
250
+ </td>
251
+ <td>
252
+ <span
253
+ className={
254
+ a.is_archived
255
+ ? "data-club-ai-hub-admin__status-pill data-club-ai-hub-admin__status-pill--archived"
256
+ : "data-club-ai-hub-admin__status-pill data-club-ai-hub-admin__status-pill--active"
257
+ }
258
+ >
259
+ {a.is_archived
260
+ ? props.texts.agentStatusArchived
261
+ : props.texts.agentStatusActive}
262
+ </span>
263
+ </td>
264
+ <td>
265
+ <button
266
+ type="button"
267
+ className="data-club-ai-hub-admin__row-action"
268
+ data-testid={`admin-agent-row-${a.id}-edit`}
269
+ onClick={() => setEditor({ kind: "edit", agent: a })}
270
+ >
271
+ {props.texts.agentEditButton}
272
+ </button>
273
+ {a.is_archived ? (
274
+ <button
275
+ type="button"
276
+ className="data-club-ai-hub-admin__row-action"
277
+ data-testid={`admin-agent-row-${a.id}-unarchive`}
278
+ onClick={() => {
279
+ void handleUnarchive(a);
280
+ }}
281
+ >
282
+ {props.texts.agentUnarchiveButton}
283
+ </button>
284
+ ) : (
285
+ <button
286
+ type="button"
287
+ className="data-club-ai-hub-admin__row-action"
288
+ data-testid={`admin-agent-row-${a.id}-archive`}
289
+ onClick={() => {
290
+ void handleArchive(a);
291
+ }}
292
+ >
293
+ {props.texts.agentArchiveButton}
294
+ </button>
295
+ )}
296
+ </td>
297
+ </tr>
298
+ ))}
299
+ </tbody>
300
+ </table>
301
+ ) : null}
302
+ <label className="data-club-ai-hub-admin__filter-toggle">
303
+ <input
304
+ type="checkbox"
305
+ data-testid="admin-agents-show-archived"
306
+ checked={showArchived}
307
+ onChange={(event) => setShowArchived(event.target.checked)}
308
+ />
309
+ <span>{props.texts.agentShowArchivedToggle}</span>
310
+ </label>
311
+ <p
312
+ className="data-club-ai-hub-admin__footnote"
313
+ data-testid="admin-agents-footnote"
314
+ >
315
+ {props.texts.agentsAdeFootnote}
316
+ </p>
317
+
318
+ {editor.kind === "create" ? (
319
+ <AgentEditorModal
320
+ mode={"create" satisfies AgentEditorMode}
321
+ texts={props.texts}
322
+ onSubmit={handleCreateSubmit}
323
+ onCancel={() => setEditor({ kind: "closed" })}
324
+ />
325
+ ) : null}
326
+ {editor.kind === "edit" ? (
327
+ <AgentEditorModal
328
+ mode={"edit" satisfies AgentEditorMode}
329
+ initial={{
330
+ displayName: editor.agent.display_name,
331
+ lettaAgentId: editor.agent.letta_agent_id,
332
+ sandboxSeedName: editor.agent.sandbox_seed_name,
333
+ forkSourceConversationId: editor.agent.fork_source_conversation_id,
334
+ }}
335
+ texts={props.texts}
336
+ onSubmit={(body) => handleEditSubmit(editor.agent, body)}
337
+ onCancel={() => setEditor({ kind: "closed" })}
338
+ />
339
+ ) : null}
340
+ </div>
341
+ );
342
+ }
@@ -0,0 +1,214 @@
1
+ /**
2
+ * `<CreateUserModal />` — Phase-1 form for the create-user flow.
3
+ *
4
+ * Submitting POSTs `/admin/users` (server generates the password); the
5
+ * one-time plaintext is returned in the response and surfaced via
6
+ * `<PasswordRevealModal />` afterward — the parent owns the phase
7
+ * transition because the password is the parent's state to keep until
8
+ * dismissed.
9
+ *
10
+ * Role-option filtering ([05-admin-users.md]):
11
+ *
12
+ * - `admin` callers see `user / power_user / admin`. They cannot create
13
+ * `super_admin`s — server enforces and the dropdown hides the option.
14
+ * - `super_admin` callers additionally see `super_admin`.
15
+ *
16
+ * @see SPECIFICATIONS.md §6.3.4 / §8.5
17
+ * @see ui-sketches/05-admin-users.md — create_user_modal
18
+ */
19
+ import { useState, type FormEvent, type ReactNode } from "react";
20
+
21
+ import type { AIHubAdminTexts } from "../../auth/texts.js";
22
+ import { AIHubRequestError } from "../../client/AIHubClient.js";
23
+ import type { AIHubRole } from "../../types.js";
24
+
25
+ /** The role options each caller role can offer. */
26
+ function roleOptionsForCaller(role: AIHubRole | null): AIHubRole[] {
27
+ if (role === "super_admin") {
28
+ return ["user", "power_user", "admin", "super_admin"];
29
+ }
30
+ return ["user", "power_user", "admin"];
31
+ }
32
+
33
+ /**
34
+ * Props for `<CreateUserModal />`.
35
+ */
36
+ export interface CreateUserModalProps {
37
+ /** Caller's role — drives the role-option filter. */
38
+ callerRole: AIHubRole | null;
39
+ /** Resolved admin texts. */
40
+ texts: AIHubAdminTexts;
41
+ /**
42
+ * Submits the form. Resolves on success; throws `AIHubRequestError` on
43
+ * validation / forbidden / `username_taken` so the modal can surface the
44
+ * right inline message.
45
+ */
46
+ onSubmit: (input: {
47
+ username: string;
48
+ displayName: string | null;
49
+ role: AIHubRole;
50
+ }) => Promise<void>;
51
+ /** Fired when the admin clicks Cancel (no server call). */
52
+ onCancel: () => void;
53
+ }
54
+
55
+ /**
56
+ * Renders the create-user modal.
57
+ *
58
+ * @param props - see `CreateUserModalProps`.
59
+ * @returns the rendered modal.
60
+ */
61
+ export function CreateUserModal(props: CreateUserModalProps): ReactNode {
62
+ const options = roleOptionsForCaller(props.callerRole);
63
+ const [username, setUsername] = useState("");
64
+ const [displayName, setDisplayName] = useState("");
65
+ const [role, setRole] = useState<AIHubRole>(options[0] ?? "user");
66
+ const [submitting, setSubmitting] = useState(false);
67
+ const [errorText, setErrorText] = useState<string | null>(null);
68
+
69
+ function roleLabel(r: AIHubRole): string {
70
+ if (r === "super_admin") return props.texts.roleOptionSuperAdmin;
71
+ if (r === "admin") return props.texts.roleOptionAdmin;
72
+ if (r === "power_user") return props.texts.roleOptionPowerUser;
73
+ return props.texts.roleOptionUser;
74
+ }
75
+
76
+ async function handleSubmit(e: FormEvent<HTMLFormElement>): Promise<void> {
77
+ e.preventDefault();
78
+ const trimmed = username.trim();
79
+ if (trimmed.length === 0) {
80
+ setErrorText(props.texts.createUserUsernameRequiredError);
81
+ return;
82
+ }
83
+ setErrorText(null);
84
+ setSubmitting(true);
85
+ try {
86
+ await props.onSubmit({
87
+ username: trimmed,
88
+ displayName: displayName.trim().length > 0 ? displayName.trim() : null,
89
+ role,
90
+ });
91
+ // Parent unmounts us on success → no further state work here.
92
+ } catch (err) {
93
+ // Map known error codes to localized strings; fall back to generic.
94
+ if (err instanceof AIHubRequestError) {
95
+ if (err.code === "username_taken" || err.status === 409) {
96
+ setErrorText(props.texts.createUserUsernameTakenError);
97
+ } else if (err.message) {
98
+ setErrorText(err.message);
99
+ } else {
100
+ setErrorText(props.texts.createUserGenericError);
101
+ }
102
+ } else {
103
+ setErrorText(props.texts.createUserGenericError);
104
+ }
105
+ setSubmitting(false);
106
+ }
107
+ }
108
+
109
+ return (
110
+ <div
111
+ className="data-club-ai-hub-admin__modal-backdrop"
112
+ role="presentation"
113
+ >
114
+ <form
115
+ className="data-club-ai-hub-admin__modal"
116
+ role="dialog"
117
+ aria-modal="true"
118
+ aria-labelledby="create-user-modal-title"
119
+ data-testid="create-user-modal"
120
+ onSubmit={(e) => {
121
+ void handleSubmit(e);
122
+ }}
123
+ >
124
+ <h2
125
+ id="create-user-modal-title"
126
+ className="data-club-ai-hub-admin__modal-title"
127
+ >
128
+ {props.texts.createUserModalTitle}
129
+ </h2>
130
+ {errorText !== null ? (
131
+ <div
132
+ className="data-club-ai-hub-admin__modal-error"
133
+ data-testid="create-user-error"
134
+ role="alert"
135
+ >
136
+ {errorText}
137
+ </div>
138
+ ) : null}
139
+ <label
140
+ className="data-club-ai-hub-admin__modal-field"
141
+ >
142
+ <span className="data-club-ai-hub-admin__modal-label">
143
+ {props.texts.createUserUsernameLabel}
144
+ </span>
145
+ <input
146
+ type="text"
147
+ value={username}
148
+ onChange={(e) => setUsername(e.target.value)}
149
+ className="data-club-ai-hub-admin__modal-input"
150
+ data-testid="create-user-username"
151
+ autoFocus
152
+ disabled={submitting}
153
+ />
154
+ </label>
155
+ <label
156
+ className="data-club-ai-hub-admin__modal-field"
157
+ >
158
+ <span className="data-club-ai-hub-admin__modal-label">
159
+ {props.texts.createUserDisplayLabel}
160
+ </span>
161
+ <input
162
+ type="text"
163
+ value={displayName}
164
+ onChange={(e) => setDisplayName(e.target.value)}
165
+ className="data-club-ai-hub-admin__modal-input"
166
+ data-testid="create-user-display"
167
+ disabled={submitting}
168
+ />
169
+ </label>
170
+ <label
171
+ className="data-club-ai-hub-admin__modal-field"
172
+ >
173
+ <span className="data-club-ai-hub-admin__modal-label">
174
+ {props.texts.createUserRoleLabel}
175
+ </span>
176
+ <select
177
+ value={role}
178
+ onChange={(e) => setRole(e.target.value as AIHubRole)}
179
+ className="data-club-ai-hub-admin__modal-input"
180
+ data-testid="create-user-role"
181
+ disabled={submitting}
182
+ >
183
+ {options.map((r) => (
184
+ <option key={r} value={r}>
185
+ {roleLabel(r)}
186
+ </option>
187
+ ))}
188
+ </select>
189
+ </label>
190
+ <div className="data-club-ai-hub-admin__modal-actions">
191
+ <button
192
+ type="button"
193
+ className="data-club-ai-hub-admin__button"
194
+ data-testid="create-user-cancel"
195
+ onClick={props.onCancel}
196
+ disabled={submitting}
197
+ >
198
+ {props.texts.createUserCancelButton}
199
+ </button>
200
+ <button
201
+ type="submit"
202
+ className="data-club-ai-hub-admin__button data-club-ai-hub-admin__button--primary"
203
+ data-testid="create-user-submit"
204
+ disabled={submitting || username.trim().length === 0}
205
+ >
206
+ {submitting
207
+ ? props.texts.createUserSubmittingButton
208
+ : props.texts.createUserSubmitButton}
209
+ </button>
210
+ </div>
211
+ </form>
212
+ </div>
213
+ );
214
+ }