@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,196 @@
1
+ /**
2
+ * `<UserMenu />` — the right-side identity affordance in the shell
3
+ * header.
4
+ *
5
+ * Step 9 ships the minimal version: avatar circle + username, click
6
+ * opens a dropdown with the role label and a `Sign out` item. Step 10
7
+ * adds the `Theme: Light ↔ Dark` item. **Step 11 adds the `Admin` and
8
+ * `Open Letta ADE ↗` items**, both gated to `role >= power_user` per
9
+ * §8.3 / [00-shell.md]. Step 12 wires the voluntary `Change Password`
10
+ * item via the shell's shell-aware framing.
11
+ *
12
+ * `Open Letta ADE` opens the deployment's ADE in a new tab
13
+ * (`target="_blank" rel="noopener noreferrer"`); the URL comes from the
14
+ * `deployment.letta_ade_url` field on `/auth/me` (only present for
15
+ * `power_user` and above by design — see `AIHubDeployment` JSDoc).
16
+ *
17
+ * The right side of the shell header is **library-owned** and not
18
+ * customizable — per-customer wrappers can theme via CSS but cannot
19
+ * replace this component.
20
+ *
21
+ * @see ui-sketches/00-shell.md — user_menu_button + user_menu_dropdown
22
+ * @see SPECIFICATIONS.md §8.3 — Open Letta ADE link
23
+ */
24
+
25
+ import {
26
+ useEffect,
27
+ useRef,
28
+ useState,
29
+ type ReactNode,
30
+ } from "react";
31
+
32
+ import type { AIHubChatTexts } from "../../auth/texts.js";
33
+ import { useAIHub } from "../../context/useAIHub.js";
34
+ import { useAIHubAuth } from "../../context/useAIHubAuth.js";
35
+ import type { AIHubRole } from "../../types.js";
36
+
37
+ import { ThemeSwitcher } from "../ThemeSwitcher/index.js";
38
+
39
+ /**
40
+ * Returns true when the given role can see the admin-only menu items
41
+ * (`Admin` + `Open Letta ADE`). Mirrors the §8.2 matrix.
42
+ *
43
+ * @param role - the caller's role, or `null` when not authenticated.
44
+ * @returns whether the items should render.
45
+ */
46
+ function canSeeAdminItems(role: AIHubRole | null): boolean {
47
+ return role === "power_user" || role === "admin" || role === "super_admin";
48
+ }
49
+
50
+ /**
51
+ * Props for the internal `<UserMenu />` helper.
52
+ */
53
+ export interface UserMenuProps {
54
+ /** Resolved chat texts (the menu copy lives under `texts.chat`). */
55
+ texts: AIHubChatTexts;
56
+ /**
57
+ * Fired when the user clicks the `Admin` item. The host (chat shell)
58
+ * decides what to do — typically swap the main area for
59
+ * `<DataClubAIHubAdmin />`. Omitted when the host doesn't support an
60
+ * in-shell admin route (a Tier-3 wrapper that mounts admin on its own
61
+ * Next.js page can omit this and rely on its own nav instead).
62
+ */
63
+ onOpenAdmin?: () => void;
64
+ }
65
+
66
+ /**
67
+ * Renders the user menu (button + dropdown).
68
+ *
69
+ * @param props - see `UserMenuProps`.
70
+ * @returns the rendered menu, or `null` when unauthenticated.
71
+ */
72
+ export function UserMenu(props: UserMenuProps): ReactNode {
73
+ const { texts } = props;
74
+ const auth = useAIHubAuth();
75
+ const { themeSwitcherEnabled } = useAIHub();
76
+ const [open, setOpen] = useState(false);
77
+ const wrapRef = useRef<HTMLDivElement | null>(null);
78
+ const showAdminItems = canSeeAdminItems(auth.role);
79
+ const lettaAdeUrl = auth.deployment?.letta_ade_url ?? null;
80
+
81
+ // Close on outside-click + Escape so the menu can't be left open
82
+ // accidentally over the chat below.
83
+ useEffect(() => {
84
+ if (!open) return;
85
+ function handleClick(e: MouseEvent): void {
86
+ const node = wrapRef.current;
87
+ if (node && !node.contains(e.target as Node)) {
88
+ setOpen(false);
89
+ }
90
+ }
91
+ function handleKey(e: KeyboardEvent): void {
92
+ if (e.key === "Escape") setOpen(false);
93
+ }
94
+ document.addEventListener("mousedown", handleClick);
95
+ document.addEventListener("keydown", handleKey);
96
+ return () => {
97
+ document.removeEventListener("mousedown", handleClick);
98
+ document.removeEventListener("keydown", handleKey);
99
+ };
100
+ }, [open]);
101
+
102
+ if (!auth.user) return null;
103
+
104
+ const displayName = auth.user.display_name ?? auth.user.username;
105
+
106
+ return (
107
+ <div
108
+ className="data-club-ai-hub__user-menu"
109
+ ref={wrapRef}
110
+ data-testid="user-menu"
111
+ >
112
+ <button
113
+ type="button"
114
+ className="data-club-ai-hub__user-menu__button"
115
+ aria-haspopup="menu"
116
+ aria-expanded={open}
117
+ onClick={() => setOpen((o) => !o)}
118
+ data-testid="user-menu-button"
119
+ >
120
+ <span
121
+ className="data-club-ai-hub__user-menu__avatar"
122
+ aria-hidden="true"
123
+ >
124
+ {displayName.slice(0, 1).toUpperCase()}
125
+ </span>
126
+ <span className="data-club-ai-hub__user-menu__username">
127
+ {auth.user.username}
128
+ </span>
129
+ </button>
130
+ {open ? (
131
+ <div
132
+ className="data-club-ai-hub__user-menu__dropdown"
133
+ role="menu"
134
+ data-testid="user-menu-dropdown"
135
+ >
136
+ <div className="data-club-ai-hub__user-menu__header">
137
+ <div className="data-club-ai-hub__user-menu__username-large">
138
+ {displayName}
139
+ </div>
140
+ <div className="data-club-ai-hub__user-menu__role">
141
+ {auth.role ?? ""}
142
+ </div>
143
+ </div>
144
+ {showAdminItems && props.onOpenAdmin ? (
145
+ <button
146
+ type="button"
147
+ role="menuitem"
148
+ className="data-club-ai-hub__user-menu__item"
149
+ data-testid="user-menu-admin"
150
+ onClick={() => {
151
+ setOpen(false);
152
+ props.onOpenAdmin?.();
153
+ }}
154
+ >
155
+ ⚙ {texts.adminMenuItem}
156
+ </button>
157
+ ) : null}
158
+ {showAdminItems && lettaAdeUrl !== null && lettaAdeUrl.length > 0 ? (
159
+ <a
160
+ role="menuitem"
161
+ className="data-club-ai-hub__user-menu__item data-club-ai-hub__user-menu__item--link"
162
+ data-testid="user-menu-open-letta-ade"
163
+ href={lettaAdeUrl}
164
+ target="_blank"
165
+ rel="noopener noreferrer"
166
+ onClick={() => setOpen(false)}
167
+ >
168
+ ↗ {texts.openLettaAdeMenuItem}
169
+ </a>
170
+ ) : null}
171
+ {themeSwitcherEnabled ? (
172
+ <div
173
+ className="data-club-ai-hub__user-menu__item"
174
+ role="none"
175
+ data-testid="user-menu-theme-row"
176
+ >
177
+ <ThemeSwitcher />
178
+ </div>
179
+ ) : null}
180
+ <button
181
+ type="button"
182
+ role="menuitem"
183
+ className="data-club-ai-hub__user-menu__item"
184
+ onClick={() => {
185
+ setOpen(false);
186
+ void auth.logout();
187
+ }}
188
+ data-testid="user-menu-sign-out"
189
+ >
190
+ ⏻ {texts.signOutMenuItem}
191
+ </button>
192
+ </div>
193
+ ) : null}
194
+ </div>
195
+ );
196
+ }
@@ -0,0 +1,307 @@
1
+ /**
2
+ * `<ChatShell />` — the authenticated chrome wrapping the chat layout.
3
+ *
4
+ * Step 10 lights up the §8.4 server-toggle precedence here: this is the
5
+ * one place that calls `resolveAffordanceFlags(serverToggles, propStack)`
6
+ * and then forwards the resolved booleans to the child primitives so
7
+ * each primitive doesn't have to re-implement the merge.
8
+ *
9
+ * `ChatShell` is internal to `<DataClubAIHub />` — Tier-3 wrappers
10
+ * compose primitives directly and don't render this component.
11
+ *
12
+ * @see SPECIFICATIONS.md §7.3, §8.4
13
+ * @see ui-sketches/00-shell.md, ui-sketches/03-chat.md
14
+ */
15
+
16
+ import { useEffect, useMemo, type ReactNode } from "react";
17
+
18
+ import {
19
+ resolveAIHubTexts,
20
+ type AIHubTexts,
21
+ type DeepPartial,
22
+ } from "../../auth/texts.js";
23
+ import { useAIHub } from "../../context/useAIHub.js";
24
+ import {
25
+ resolveAffordanceFlags,
26
+ type AIHubAffordanceFlags,
27
+ } from "../../state/affordances.js";
28
+ import type {
29
+ AIHubMessageActionRenderer,
30
+ AIHubMessageBubbleRenderer,
31
+ } from "../../types.js";
32
+ import { AgentsPicker } from "../AgentsPicker/index.js";
33
+ import { Layout } from "../Layout/index.js";
34
+ import { MainColumn } from "../MainColumn/index.js";
35
+ import { MessageInput } from "../MessageInput/index.js";
36
+ import { MessageList } from "../MessageList/index.js";
37
+ import { SessionsPanel } from "../SessionsPanel/index.js";
38
+
39
+ import { ShellHeader } from "./ShellHeader.js";
40
+
41
+ /**
42
+ * Props for `<ChatShell />` — a strict subset of `<DataClubAIHub />` props
43
+ * the shell actually reads.
44
+ */
45
+ export interface ChatShellProps {
46
+ /** Product name shown when `customShellHeaderLeft` is unset. */
47
+ productName?: string;
48
+ /** Wrapper-supplied left-of-header slot. */
49
+ customShellHeaderLeft?: ReactNode;
50
+ /** Wrapper-supplied below-main-area footer slot. */
51
+ customShellFooter?: ReactNode;
52
+ /** Wrapper-supplied per-agent header slot (right of agent name). */
53
+ customHeaderContent?: ReactNode;
54
+ /** Top-of-sessions-panel slot. */
55
+ customSidebarHeader?: ReactNode;
56
+ /** Bottom-of-sessions-panel slot. */
57
+ customSidebarFooter?: ReactNode;
58
+ /** Per-message action bar renderer (Tier-2 slot). */
59
+ customMessageActions?: AIHubMessageActionRenderer;
60
+ /** Override the entire bubble (Tier-3 escape hatch). */
61
+ customMessageBubble?: AIHubMessageBubbleRenderer;
62
+ /** Extra toolbar items in the input area. */
63
+ customInputToolbarItems?: ReactNode;
64
+ /** Whether the agents picker is reachable. Defaults to true. */
65
+ showAgentsPicker?: boolean;
66
+ /** Skip the picker entirely and open this agent. */
67
+ initialAgentId?: string;
68
+ /** Deep-link a session inside `initialAgentId`. */
69
+ initialSessionId?: string;
70
+
71
+ /* ── §8.4 React-prop defaults — server toggles override at runtime. ── */
72
+ /** sessions_panel_enabled default. */
73
+ showSessionsPanel?: boolean;
74
+ /** sessions_panel_collapsible default. */
75
+ sessionsPanelCollapsible?: boolean;
76
+ /** sessions_panel_resizable default. */
77
+ sessionsPanelResizable?: boolean;
78
+ /** Layout-only (not a §8.4 toggle). */
79
+ sessionsPanelPosition?: "left" | "right";
80
+ /** Layout-only (not a §8.4 toggle). */
81
+ sessionsPanelWidthPercent?: number;
82
+ /** user_input_enabled default. */
83
+ showInput?: boolean;
84
+ /** create_session_button_enabled default. */
85
+ showCreateSessionButton?: boolean;
86
+ /** effort_control_visible default. */
87
+ showEffortControl?: boolean;
88
+ /** stop_button_enabled default. */
89
+ showStopButton?: boolean;
90
+ /** tool_calls_visible default. */
91
+ showToolCalls?: boolean;
92
+ /** reasoning_visible default. */
93
+ showReasoning?: boolean;
94
+ /** system_messages_visible default. */
95
+ showSystemMessages?: boolean;
96
+ /** tpm_notice_visible default. */
97
+ showTpmNotice?: boolean;
98
+ /** scroll_to_present_visible default. */
99
+ showScrollToPresentButton?: boolean;
100
+ /** turn_status_visible default. */
101
+ showTurnStatus?: boolean;
102
+ /** Whether the ThemeSwitcher renders in the user menu (server override wins). */
103
+ showThemeSwitcher?: boolean;
104
+
105
+ /** Wrapper-supplied i18n. */
106
+ texts?: DeepPartial<AIHubTexts>;
107
+ /** Extra className merged on the shell root. */
108
+ className?: string;
109
+ /**
110
+ * Fired when the user clicks the `Admin` item in the user-menu. Step 11
111
+ * — the monolith uses this to swap the main area for
112
+ * `<DataClubAIHubAdmin />`. Omitted by Tier-3 wrappers that mount admin
113
+ * on a separate Next.js route.
114
+ */
115
+ onOpenAdmin?: () => void;
116
+ }
117
+
118
+ /**
119
+ * Builds the prop-override record consumed by `resolveAffordanceFlags`.
120
+ *
121
+ * Note that some props on `ChatShellProps` use slightly different names
122
+ * than the `AIHubAffordanceFlags` field names (e.g. `showInput` vs.
123
+ * `userInputEnabled`); this function maps them. Adding a new flag
124
+ * requires touching this function alongside `AIHubAffordanceFlags`.
125
+ */
126
+ function buildPropOverrides(
127
+ props: ChatShellProps,
128
+ ): Partial<AIHubAffordanceFlags> {
129
+ const out: Partial<AIHubAffordanceFlags> = {};
130
+ if (props.showSessionsPanel !== undefined)
131
+ out.sessionsPanelEnabled = props.showSessionsPanel;
132
+ if (props.sessionsPanelResizable !== undefined)
133
+ out.sessionsPanelResizable = props.sessionsPanelResizable;
134
+ if (props.sessionsPanelCollapsible !== undefined)
135
+ out.sessionsPanelCollapsible = props.sessionsPanelCollapsible;
136
+ if (props.showCreateSessionButton !== undefined)
137
+ out.createSessionButtonEnabled = props.showCreateSessionButton;
138
+ if (props.showInput !== undefined) out.userInputEnabled = props.showInput;
139
+ if (props.showStopButton !== undefined)
140
+ out.stopButtonEnabled = props.showStopButton;
141
+ if (props.showToolCalls !== undefined)
142
+ out.toolCallsVisible = props.showToolCalls;
143
+ if (props.showReasoning !== undefined)
144
+ out.reasoningVisible = props.showReasoning;
145
+ if (props.showSystemMessages !== undefined)
146
+ out.systemMessagesVisible = props.showSystemMessages;
147
+ if (props.showTpmNotice !== undefined)
148
+ out.tpmNoticeVisible = props.showTpmNotice;
149
+ if (props.showEffortControl !== undefined)
150
+ out.effortControlVisible = props.showEffortControl;
151
+ if (props.showScrollToPresentButton !== undefined)
152
+ out.scrollToPresentVisible = props.showScrollToPresentButton;
153
+ if (props.showTurnStatus !== undefined)
154
+ out.turnStatusVisible = props.showTurnStatus;
155
+ return out;
156
+ }
157
+
158
+ /**
159
+ * Renders the chat shell.
160
+ *
161
+ * @param props - see `ChatShellProps`.
162
+ * @returns the rendered shell.
163
+ */
164
+ export function ChatShell(props: ChatShellProps): ReactNode {
165
+ const {
166
+ agents,
167
+ agentsLoading,
168
+ activeAgentId,
169
+ setActiveAgent,
170
+ activeSessionId,
171
+ setActiveSession,
172
+ featureToggles,
173
+ } = useAIHub();
174
+ const texts = resolveAIHubTexts(props.texts);
175
+ const productName = props.productName ?? "ai-hub";
176
+ const showAgentsPicker = props.showAgentsPicker ?? true;
177
+ const sessionsPanelPosition = props.sessionsPanelPosition ?? "left";
178
+ const sessionsPanelWidthPercent = props.sessionsPanelWidthPercent ?? 25;
179
+
180
+ // Compose the §8.4 precedence stack once. `featureToggles === null`
181
+ // (still loading) → fall through to prop / default; we treat it as
182
+ // an empty blob so the precedence rule reduces to "prop > default".
183
+ const propOverrides = useMemo(() => buildPropOverrides(props), [props]);
184
+ const flags = useMemo(
185
+ () => resolveAffordanceFlags(featureToggles, propOverrides),
186
+ [featureToggles, propOverrides],
187
+ );
188
+
189
+ // Deep-link: open `initialAgentId` and `initialSessionId` on first
190
+ // mount (and whenever those props change).
191
+ useEffect(() => {
192
+ if (props.initialAgentId && activeAgentId !== props.initialAgentId) {
193
+ setActiveAgent(props.initialAgentId);
194
+ }
195
+ }, [props.initialAgentId]);
196
+
197
+ useEffect(() => {
198
+ if (
199
+ props.initialSessionId &&
200
+ activeSessionId !== props.initialSessionId
201
+ ) {
202
+ setActiveSession(props.initialSessionId);
203
+ }
204
+ }, [props.initialSessionId]);
205
+
206
+ const autoSelectOnlyAgent = useMemo(
207
+ () =>
208
+ showAgentsPicker && !activeAgentId && !agentsLoading && agents.length === 1,
209
+ [showAgentsPicker, activeAgentId, agentsLoading, agents],
210
+ );
211
+ useEffect(() => {
212
+ if (autoSelectOnlyAgent && agents[0]) {
213
+ setActiveAgent(agents[0].id);
214
+ }
215
+ }, [autoSelectOnlyAgent, agents, setActiveAgent]);
216
+
217
+ const inPicker = showAgentsPicker && !activeAgentId;
218
+
219
+ const rootClass = props.className
220
+ ? `data-club-ai-hub__shell ${props.className}`
221
+ : "data-club-ai-hub__shell";
222
+
223
+ return (
224
+ <div className={rootClass} data-testid="chat-shell">
225
+ <ShellHeader
226
+ productName={productName}
227
+ texts={texts.chat}
228
+ {...(props.customShellHeaderLeft !== undefined
229
+ ? { customShellHeaderLeft: props.customShellHeaderLeft }
230
+ : {})}
231
+ {...(props.onOpenAdmin !== undefined
232
+ ? { onOpenAdmin: props.onOpenAdmin }
233
+ : {})}
234
+ />
235
+ <main
236
+ className="data-club-ai-hub__shell-main"
237
+ data-testid="shell-main"
238
+ >
239
+ {inPicker ? (
240
+ <AgentsPicker
241
+ {...(props.texts !== undefined ? { texts: props.texts } : {})}
242
+ />
243
+ ) : (
244
+ <Layout
245
+ panelPosition={sessionsPanelPosition}
246
+ panelWidthPercent={sessionsPanelWidthPercent}
247
+ >
248
+ {flags.sessionsPanelEnabled ? (
249
+ <SessionsPanel
250
+ showCreateButton={flags.createSessionButtonEnabled}
251
+ collapsible={flags.sessionsPanelCollapsible}
252
+ {...(props.texts !== undefined ? { texts: props.texts } : {})}
253
+ {...(props.customSidebarHeader !== undefined
254
+ ? { customHeader: props.customSidebarHeader }
255
+ : {})}
256
+ {...(props.customSidebarFooter !== undefined
257
+ ? { customFooter: props.customSidebarFooter }
258
+ : {})}
259
+ />
260
+ ) : null}
261
+ <MainColumn
262
+ showBackToAgents={showAgentsPicker}
263
+ showTurnStatus={flags.turnStatusVisible}
264
+ {...(props.texts !== undefined ? { texts: props.texts } : {})}
265
+ {...(props.customHeaderContent !== undefined
266
+ ? { customHeaderContent: props.customHeaderContent }
267
+ : {})}
268
+ >
269
+ <MessageList
270
+ showSystemMessages={flags.systemMessagesVisible}
271
+ showTpmNotice={flags.tpmNoticeVisible}
272
+ showScrollToPresentButton={flags.scrollToPresentVisible}
273
+ showReasoning={flags.reasoningVisible}
274
+ showToolCalls={flags.toolCallsVisible}
275
+ {...(props.texts !== undefined ? { texts: props.texts } : {})}
276
+ {...(props.customMessageActions !== undefined
277
+ ? { renderMessageActions: props.customMessageActions }
278
+ : {})}
279
+ {...(props.customMessageBubble !== undefined
280
+ ? { renderMessageBubble: props.customMessageBubble }
281
+ : {})}
282
+ />
283
+ {flags.userInputEnabled ? (
284
+ <MessageInput
285
+ showEffortControl={flags.effortControlVisible}
286
+ stopButtonEnabled={flags.stopButtonEnabled}
287
+ {...(props.texts !== undefined ? { texts: props.texts } : {})}
288
+ {...(props.customInputToolbarItems !== undefined
289
+ ? { toolbar: props.customInputToolbarItems }
290
+ : {})}
291
+ />
292
+ ) : null}
293
+ </MainColumn>
294
+ </Layout>
295
+ )}
296
+ </main>
297
+ {props.customShellFooter ? (
298
+ <footer
299
+ className="data-club-ai-hub__shell-footer"
300
+ data-testid="shell-footer"
301
+ >
302
+ {props.customShellFooter}
303
+ </footer>
304
+ ) : null}
305
+ </div>
306
+ );
307
+ }