@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,9 @@
1
+ /**
2
+ * Re-exports for the `context/` directory.
3
+ *
4
+ * @see SPECIFICATIONS.md §7.2 — provider + hooks
5
+ */
6
+
7
+ export { AIHubProvider, type AIHubProviderProps } from "./AIHubProvider.js";
8
+ export { useAIHub, type UseAIHubResult } from "./useAIHub.js";
9
+ export { useAIHubAuth, type UseAIHubAuthResult } from "./useAIHubAuth.js";
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Theme resolution helpers used by `<AIHubProvider>`.
3
+ *
4
+ * The §7.6 precedence:
5
+ *
6
+ * 1. `user.theme_preference` when `deployment.theme_switcher_enabled` is true.
7
+ * 2. Otherwise `deployment.theme_default`.
8
+ *
9
+ * The unauthenticated case (no `/auth/me` yet) falls back to a value cached
10
+ * in `localStorage` so the first paint matches the last-known theme and
11
+ * the user doesn't see a flash of unstyled content.
12
+ *
13
+ * @see SPECIFICATIONS.md §7.6 — theming
14
+ */
15
+
16
+ import type { AIHubDeployment, AIHubUser } from "../types.js";
17
+
18
+ /** localStorage key for the last-resolved theme. Namespaced to ai-hub. */
19
+ const CACHE_KEY = "data-club-ai-hub:theme";
20
+
21
+ /** The two themes the library ships. */
22
+ export type ResolvedTheme = "light" | "dark";
23
+
24
+ /**
25
+ * Computes the resolved theme from the inputs on the `/auth/me` envelope.
26
+ *
27
+ * @param user - authenticated user, or null when unauthenticated.
28
+ * @param deployment - deployment context, or null when unauthenticated.
29
+ * @param fallback - default applied when both inputs are null
30
+ * (typically the React-prop `defaultTheme`).
31
+ * @returns the resolved theme.
32
+ */
33
+ export function resolveTheme(
34
+ user: AIHubUser | null,
35
+ deployment: AIHubDeployment | null,
36
+ fallback: ResolvedTheme,
37
+ ): ResolvedTheme {
38
+ if (!deployment) return fallback;
39
+ if (deployment.theme_switcher_enabled && user?.theme_preference) {
40
+ return user.theme_preference;
41
+ }
42
+ return deployment.theme_default;
43
+ }
44
+
45
+ /**
46
+ * Reads the cached theme from `localStorage`. Returns null when no cache
47
+ * exists, the value is malformed, or storage is unavailable (Safari
48
+ * private mode, SSR, etc.).
49
+ *
50
+ * @returns the cached theme or null.
51
+ */
52
+ export function readCachedTheme(): ResolvedTheme | null {
53
+ try {
54
+ if (typeof window === "undefined" || !window.localStorage) return null;
55
+ const raw = window.localStorage.getItem(CACHE_KEY);
56
+ if (raw === "light" || raw === "dark") return raw;
57
+ return null;
58
+ } catch {
59
+ return null;
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Persists the resolved theme into `localStorage` for FOUC avoidance on
65
+ * the next page load. Silent no-op on storage failures.
66
+ *
67
+ * @param theme - the theme to cache.
68
+ */
69
+ export function writeCachedTheme(theme: ResolvedTheme): void {
70
+ try {
71
+ if (typeof window === "undefined" || !window.localStorage) return;
72
+ window.localStorage.setItem(CACHE_KEY, theme);
73
+ } catch {
74
+ /* ignore */
75
+ }
76
+ }
@@ -0,0 +1,151 @@
1
+ /**
2
+ * `useAIHub()` — primary hook for chat state (agents, sessions, messages,
3
+ * streaming), theme controls, effort, and direct SDK access.
4
+ *
5
+ * Step 9 wires the chat surface on top of the Step-7 foundation. The
6
+ * remaining affordances (TPM banner, reasoning view, theme switcher
7
+ * primitive, server-toggle precedence) layer in Step 10.
8
+ *
9
+ * @see SPECIFICATIONS.md §7.2 — provider + hooks
10
+ */
11
+
12
+ import { useContext } from "react";
13
+
14
+ import { aiHubContext, type AIHubContextValue } from "./AIHubContext.js";
15
+
16
+ /**
17
+ * The shape `useAIHub()` returns. Mirrors `AIHubContextValue` minus the
18
+ * auth-only fields (`user`, `role`, `mustChangePassword`, `login`,
19
+ * `logout`, `changePassword`) — those live on `useAIHubAuth()`.
20
+ */
21
+ export interface UseAIHubResult {
22
+ /** The underlying SDK client. */
23
+ client: AIHubContextValue["client"];
24
+ /** Active turn's reducer state. */
25
+ state: AIHubContextValue["state"];
26
+ /** Per-message reasoning effort selector value. */
27
+ effort: AIHubContextValue["effort"];
28
+ /** Updates `effort`. */
29
+ setEffort: AIHubContextValue["setEffort"];
30
+ /** Resolved theme (`light` | `dark`). */
31
+ theme: AIHubContextValue["theme"];
32
+ /**
33
+ * Flips the theme. Throws `AIHubRequestError` (`code:
34
+ * "theme_switcher_disabled"`) when the deployment has the switcher off.
35
+ */
36
+ setTheme: AIHubContextValue["setTheme"];
37
+ /** Mirror of `deployment.theme_switcher_enabled`. */
38
+ themeSwitcherEnabled: AIHubContextValue["themeSwitcherEnabled"];
39
+ /** Non-archived agents available to the caller. */
40
+ agents: AIHubContextValue["agents"];
41
+ /** True while the initial `/agents` request is in flight. */
42
+ agentsLoading: AIHubContextValue["agentsLoading"];
43
+ /** Refetches `/agents`. */
44
+ refreshAgents: AIHubContextValue["refreshAgents"];
45
+ /** Opened agent id, or `null` when on the picker. */
46
+ activeAgentId: AIHubContextValue["activeAgentId"];
47
+ /** Opens an agent (`id`) or returns to the picker (`null`). */
48
+ setActiveAgent: AIHubContextValue["setActiveAgent"];
49
+ /** Sessions for the active agent + current user. */
50
+ sessions: AIHubContextValue["sessions"];
51
+ /** True while sessions are loading. */
52
+ sessionsLoading: AIHubContextValue["sessionsLoading"];
53
+ /** Refetches sessions for the active agent. */
54
+ refreshSessions: AIHubContextValue["refreshSessions"];
55
+ /** Whether archived rows are included in `sessions`. */
56
+ includeArchivedSessions: AIHubContextValue["includeArchivedSessions"];
57
+ /** Toggles the archived filter. */
58
+ setIncludeArchivedSessions: AIHubContextValue["setIncludeArchivedSessions"];
59
+ /** Opened session id. */
60
+ activeSessionId: AIHubContextValue["activeSessionId"];
61
+ /** Opens a session (`id`) or clears the selection (`null`). */
62
+ setActiveSession: AIHubContextValue["setActiveSession"];
63
+ /** Creates + selects a new session. Title required (1..80 chars). */
64
+ createSession: AIHubContextValue["createSession"];
65
+ /** Patches a session (rename / archive / unarchive). */
66
+ patchSession: AIHubContextValue["patchSession"];
67
+ /** Messages for the active session. */
68
+ messages: AIHubContextValue["messages"];
69
+ /** True while the active session's message history is loading. */
70
+ messagesLoading: AIHubContextValue["messagesLoading"];
71
+ /** Streaming assistant text accumulator (null when nothing is streaming). */
72
+ streamingAssistantText: AIHubContextValue["streamingAssistantText"];
73
+ /** Streaming reasoning text accumulator (null when no reasoning is in flight). */
74
+ streamingReasoning: AIHubContextValue["streamingReasoning"];
75
+ /** In-progress tool calls being assembled from SSE events. */
76
+ streamingToolCalls: AIHubContextValue["streamingToolCalls"];
77
+ /** Sends a message against the active session. */
78
+ sendMessage: AIHubContextValue["sendMessage"];
79
+ /** Cancels the in-flight turn. */
80
+ stop: AIHubContextValue["stop"];
81
+ /** True while a Stop is in flight and we're waiting for stream_end. */
82
+ isStoppingTurn: AIHubContextValue["isStoppingTurn"];
83
+ /** Text the input should prefill (from a rolled-back send). */
84
+ pendingDraft: AIHubContextValue["pendingDraft"];
85
+ /** Reads + clears `pendingDraft` in one step. */
86
+ consumePendingDraft: AIHubContextValue["consumePendingDraft"];
87
+ /** Last turn's unrecoverable error message, or null. */
88
+ lastTurnError: AIHubContextValue["lastTurnError"];
89
+ /**
90
+ * Deployment-wide UI feature toggles (§8.4) — `null` until the fetch
91
+ * resolves. Most consumers should NOT branch on this directly; the
92
+ * `useAffordanceFlags()` helper composes server toggle > React prop >
93
+ * built-in default and is the supported way to read flag state.
94
+ */
95
+ featureToggles: AIHubContextValue["featureToggles"];
96
+ /** Re-fetches the toggles (used after a super-admin save). */
97
+ refreshFeatureToggles: AIHubContextValue["refreshFeatureToggles"];
98
+ }
99
+
100
+ /**
101
+ * Returns the chat / theme / SDK surface from the nearest `<AIHubProvider>`.
102
+ *
103
+ * Throws when called outside a provider — surface mounting bugs early
104
+ * instead of cascading through context-null deref in components.
105
+ *
106
+ * @returns the chat surface.
107
+ */
108
+ export function useAIHub(): UseAIHubResult {
109
+ const ctx = useContext(aiHubContext);
110
+ if (!ctx) {
111
+ throw new Error(
112
+ "useAIHub() was called outside <AIHubProvider>. Wrap the tree in <AIHubProvider> first.",
113
+ );
114
+ }
115
+ return {
116
+ client: ctx.client,
117
+ state: ctx.state,
118
+ effort: ctx.effort,
119
+ setEffort: ctx.setEffort,
120
+ theme: ctx.theme,
121
+ setTheme: ctx.setTheme,
122
+ themeSwitcherEnabled: ctx.themeSwitcherEnabled,
123
+ agents: ctx.agents,
124
+ agentsLoading: ctx.agentsLoading,
125
+ refreshAgents: ctx.refreshAgents,
126
+ activeAgentId: ctx.activeAgentId,
127
+ setActiveAgent: ctx.setActiveAgent,
128
+ sessions: ctx.sessions,
129
+ sessionsLoading: ctx.sessionsLoading,
130
+ refreshSessions: ctx.refreshSessions,
131
+ includeArchivedSessions: ctx.includeArchivedSessions,
132
+ setIncludeArchivedSessions: ctx.setIncludeArchivedSessions,
133
+ activeSessionId: ctx.activeSessionId,
134
+ setActiveSession: ctx.setActiveSession,
135
+ createSession: ctx.createSession,
136
+ patchSession: ctx.patchSession,
137
+ messages: ctx.messages,
138
+ messagesLoading: ctx.messagesLoading,
139
+ streamingAssistantText: ctx.streamingAssistantText,
140
+ streamingReasoning: ctx.streamingReasoning,
141
+ streamingToolCalls: ctx.streamingToolCalls,
142
+ sendMessage: ctx.sendMessage,
143
+ stop: ctx.stop,
144
+ isStoppingTurn: ctx.isStoppingTurn,
145
+ pendingDraft: ctx.pendingDraft,
146
+ consumePendingDraft: ctx.consumePendingDraft,
147
+ lastTurnError: ctx.lastTurnError,
148
+ featureToggles: ctx.featureToggles,
149
+ refreshFeatureToggles: ctx.refreshFeatureToggles,
150
+ };
151
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * `useAIHubAuth()` — auth-only hook for apps building their own login UI
3
+ * or rendering role-aware affordances.
4
+ *
5
+ * Separate from `useAIHub()` so consumers that only need the user's role
6
+ * (e.g. for menu visibility) don't subscribe to chat-state changes.
7
+ *
8
+ * @see SPECIFICATIONS.md §7.2 — provider + hooks
9
+ */
10
+
11
+ import { useContext } from "react";
12
+
13
+ import { aiHubContext, type AIHubContextValue } from "./AIHubContext.js";
14
+
15
+ /**
16
+ * The shape `useAIHubAuth()` returns.
17
+ */
18
+ export interface UseAIHubAuthResult {
19
+ /** Currently authenticated user, or null when unauthenticated. */
20
+ user: AIHubContextValue["user"];
21
+ /** Convenience echo of `user.role`. */
22
+ role: AIHubContextValue["role"];
23
+ /** Deployment-wide context returned by `/auth/me`. */
24
+ deployment: AIHubContextValue["deployment"];
25
+ /**
26
+ * True until the first `/auth/me` resolves. Consumers should render a
27
+ * loading state (or render nothing) rather than flashing the login screen
28
+ * while the cached token is being validated.
29
+ */
30
+ hydrating: AIHubContextValue["hydrating"];
31
+ /** True when the user must complete the change-password flow. */
32
+ mustChangePassword: AIHubContextValue["mustChangePassword"];
33
+ /** Logs in with username + password. */
34
+ login: AIHubContextValue["login"];
35
+ /** Clears the token and the local auth state. */
36
+ logout: AIHubContextValue["logout"];
37
+ /** Changes the password (voluntary or forced flow — see §8.5). */
38
+ changePassword: AIHubContextValue["changePassword"];
39
+ }
40
+
41
+ /**
42
+ * Returns the auth surface from the nearest `<AIHubProvider>`.
43
+ *
44
+ * Throws when called outside a provider.
45
+ *
46
+ * @returns the auth surface.
47
+ */
48
+ export function useAIHubAuth(): UseAIHubAuthResult {
49
+ const ctx = useContext(aiHubContext);
50
+ if (!ctx) {
51
+ throw new Error(
52
+ "useAIHubAuth() was called outside <AIHubProvider>. Wrap the tree in <AIHubProvider> first.",
53
+ );
54
+ }
55
+ return {
56
+ user: ctx.user,
57
+ role: ctx.role,
58
+ deployment: ctx.deployment,
59
+ hydrating: ctx.hydrating,
60
+ mustChangePassword: ctx.mustChangePassword,
61
+ login: ctx.login,
62
+ logout: ctx.logout,
63
+ changePassword: ctx.changePassword,
64
+ };
65
+ }
package/src/index.ts ADDED
@@ -0,0 +1,275 @@
1
+ /**
2
+ * Public entry point for `@data-club/ai-hub`.
3
+ *
4
+ * Step 7 shipped the non-visual foundation: client SDK, state reducer,
5
+ * React provider + hooks, `defineWebComponent` helper, and the `AIHub.*`
6
+ * namespace (stubs for the visible primitives). **Step 8 fills in the
7
+ * auth screens**: `<DataClubAIHubLogin />`,
8
+ * `<DataClubAIHubChangePassword />` (forced + voluntary variants),
9
+ * `AIHub.AuthGate`, and a minimal `<DataClubAIHub />` skeleton that
10
+ * threads branding / i18n into both screens. The chat layout
11
+ * (`AIHub.AgentsPicker`, `Layout`, `SessionsPanel`, …) lands in Step 9;
12
+ * the affordances (TPM banner, theme switcher, reasoning view, …) in
13
+ * Step 10; the admin UI in Steps 11–12.
14
+ *
15
+ * @see SPECIFICATIONS.md §7.1 — exports
16
+ */
17
+
18
+ /* ── Types ────────────────────────────────────────────────────────── */
19
+
20
+ export type {
21
+ AIHubRole,
22
+ AIHubUser,
23
+ AIHubDeployment,
24
+ AIHubAuthContext,
25
+ AIHubFeatureToggles,
26
+ Session,
27
+ AIHubMessage,
28
+ AIHubMessageOverride,
29
+ AIHubMessageUsage,
30
+ AIHubToolCallRecord,
31
+ TurnStatus,
32
+ RunningPhase,
33
+ AIHubState,
34
+ AIHubEventState,
35
+ AIHubEvent,
36
+ AIHubError,
37
+ AIHubMessageActionRenderer,
38
+ AIHubMessageBubbleRenderer,
39
+ AIHubSlotProps,
40
+ } from "./types.js";
41
+
42
+ /* ── State reducer + affordance helpers ──────────────────────────── */
43
+
44
+ export { initialAIHubState, reduceAIHubState } from "./state/stateReducer.js";
45
+ export {
46
+ DEFAULT_AFFORDANCE_FLAGS,
47
+ FEATURE_TOGGLE_KEY_MAP,
48
+ resolveAffordanceFlags,
49
+ chatAffordances,
50
+ turnStatusVisual,
51
+ } from "./state/affordances.js";
52
+ export type {
53
+ AIHubAffordanceFlags,
54
+ AIHubChatAffordances,
55
+ AIHubTurnStatusVisual,
56
+ } from "./state/affordances.js";
57
+
58
+ /* ── Client SDK ───────────────────────────────────────────────────── */
59
+
60
+ export {
61
+ AIHubClient,
62
+ AIHubRequestError,
63
+ parseSseStream,
64
+ createMemoryTokenStorage,
65
+ resolveTokenStorage,
66
+ } from "./client/index.js";
67
+ export type {
68
+ AIHubClientOptions,
69
+ LoginResponse,
70
+ ListSessionsOptions,
71
+ CreateSessionOptions,
72
+ PatchSessionOptions,
73
+ PatchSessionReasoningOptions,
74
+ AIHubEffort,
75
+ StreamChatBody,
76
+ StreamChatOptions,
77
+ AgentSummary,
78
+ CancelTurnResponse,
79
+ AdminUserView,
80
+ CreateUserBody,
81
+ AdminUserPasswordReveal,
82
+ CreateUserResponse,
83
+ TokenStorage,
84
+ TokenStorageMode,
85
+ } from "./client/index.js";
86
+
87
+ /* ── Provider + hooks ─────────────────────────────────────────────── */
88
+
89
+ export {
90
+ AIHubProvider,
91
+ useAIHub,
92
+ useAIHubAuth,
93
+ } from "./context/index.js";
94
+ export type {
95
+ AIHubProviderProps,
96
+ UseAIHubResult,
97
+ UseAIHubAuthResult,
98
+ } from "./context/index.js";
99
+
100
+ /* ── Web Component packaging ──────────────────────────────────────── */
101
+
102
+ export {
103
+ defineWebComponent,
104
+ isValidCustomElementName,
105
+ } from "./webcomponent/index.js";
106
+ export type { DefineWebComponentOptions } from "./webcomponent/index.js";
107
+
108
+ /* ── Built-in screens (auto-rendered by `<DataClubAIHub />`) ─────── */
109
+
110
+ export {
111
+ DataClubAIHubLogin,
112
+ } from "./components/DataClubAIHubLogin/index.js";
113
+ export type {
114
+ DataClubAIHubLoginProps,
115
+ AIHubLoginClassNames,
116
+ } from "./components/DataClubAIHubLogin/index.js";
117
+
118
+ export {
119
+ DataClubAIHubChangePassword,
120
+ } from "./components/ChangePassword/index.js";
121
+ export type {
122
+ DataClubAIHubChangePasswordProps,
123
+ AIHubChangePasswordClassNames,
124
+ } from "./components/ChangePassword/index.js";
125
+
126
+ export {
127
+ DataClubAIHub,
128
+ } from "./components/DataClubAIHub/index.js";
129
+ export type {
130
+ DataClubAIHubProps,
131
+ } from "./components/DataClubAIHub/index.js";
132
+
133
+ export {
134
+ DataClubAIHubAdmin,
135
+ } from "./components/DataClubAIHubAdmin/index.js";
136
+ export type {
137
+ DataClubAIHubAdminProps,
138
+ AdminPage,
139
+ } from "./components/DataClubAIHubAdmin/index.js";
140
+
141
+ /* ── Chat primitives (also exported under the `AIHub` namespace) ── */
142
+
143
+ export { AgentsPicker } from "./components/AgentsPicker/index.js";
144
+ export type {
145
+ AgentsPickerProps,
146
+ AgentsPickerClassNames,
147
+ } from "./components/AgentsPicker/index.js";
148
+
149
+ export { Layout } from "./components/Layout/index.js";
150
+ export type { LayoutProps, LayoutClassNames } from "./components/Layout/index.js";
151
+
152
+ export { SessionsPanel } from "./components/SessionsPanel/index.js";
153
+ export type {
154
+ SessionsPanelProps,
155
+ SessionsPanelClassNames,
156
+ } from "./components/SessionsPanel/index.js";
157
+
158
+ export { MainColumn } from "./components/MainColumn/index.js";
159
+ export type {
160
+ MainColumnProps,
161
+ MainColumnClassNames,
162
+ } from "./components/MainColumn/index.js";
163
+
164
+ export { MessageList } from "./components/MessageList/index.js";
165
+ export type {
166
+ MessageListProps,
167
+ MessageListClassNames,
168
+ } from "./components/MessageList/index.js";
169
+
170
+ export { MessageInput } from "./components/MessageInput/index.js";
171
+ export type {
172
+ MessageInputProps,
173
+ MessageInputClassNames,
174
+ } from "./components/MessageInput/index.js";
175
+
176
+ export { MarkdownRenderer } from "./components/MarkdownRenderer/index.js";
177
+ export type {
178
+ MarkdownRendererProps,
179
+ MarkdownRendererClassNames,
180
+ } from "./components/MarkdownRenderer/index.js";
181
+
182
+ /* ── Affordance primitives (Step 10) ─────────────────────────────── */
183
+
184
+ export { EffortControl, EFFORT_VALUES } from "./components/EffortControl/index.js";
185
+ export type {
186
+ EffortControlProps,
187
+ EffortControlClassNames,
188
+ } from "./components/EffortControl/index.js";
189
+
190
+ export { ReasoningSelector } from "./components/ReasoningSelector/index.js";
191
+ export type {
192
+ ReasoningSelectorProps,
193
+ ReasoningSelectorClassNames,
194
+ } from "./components/ReasoningSelector/index.js";
195
+
196
+ export { TurnStatusIndicator } from "./components/TurnStatusIndicator/index.js";
197
+ export type {
198
+ TurnStatusIndicatorProps,
199
+ TurnStatusIndicatorClassNames,
200
+ } from "./components/TurnStatusIndicator/index.js";
201
+
202
+ export { ThemeSwitcher } from "./components/ThemeSwitcher/index.js";
203
+ export type {
204
+ ThemeSwitcherProps,
205
+ ThemeSwitcherClassNames,
206
+ } from "./components/ThemeSwitcher/index.js";
207
+
208
+ export { SystemNotice } from "./components/SystemNotice/index.js";
209
+ export type {
210
+ SystemNoticeProps,
211
+ SystemNoticeClassNames,
212
+ } from "./components/SystemNotice/index.js";
213
+
214
+ export { TpmBanner } from "./components/TpmBanner/index.js";
215
+ export type { TpmBannerProps } from "./components/TpmBanner/index.js";
216
+
217
+ export { ReasoningView } from "./components/ReasoningView/index.js";
218
+ export type {
219
+ ReasoningViewProps,
220
+ ReasoningViewClassNames,
221
+ } from "./components/ReasoningView/index.js";
222
+
223
+ export { ToolCallView } from "./components/ToolCallView/index.js";
224
+ export type {
225
+ ToolCallStatus,
226
+ ToolCallViewProps,
227
+ ToolCallViewClassNames,
228
+ } from "./components/ToolCallView/index.js";
229
+ export { formatToolContentForDisplay } from "./components/ToolCallView/formatContent.js";
230
+
231
+ export { CacheBadge, computeCacheHitRatio } from "./components/CacheBadge/index.js";
232
+ export type {
233
+ CacheBadgeProps,
234
+ CacheBadgeClassNames,
235
+ CacheBadgeTexts,
236
+ } from "./components/CacheBadge/index.js";
237
+
238
+ export { ScrollToPresentButton } from "./components/ScrollToPresentButton/index.js";
239
+ export type {
240
+ ScrollToPresentButtonProps,
241
+ ScrollToPresentButtonClassNames,
242
+ } from "./components/ScrollToPresentButton/index.js";
243
+
244
+ /* ── i18n / branding surface ─────────────────────────────────────── */
245
+
246
+ export {
247
+ defaultAIHubTexts,
248
+ resolveAIHubTexts,
249
+ } from "./auth/texts.js";
250
+ export type {
251
+ AIHubTexts,
252
+ AIHubLoginTexts,
253
+ AIHubChangePasswordTexts,
254
+ AIHubChatTexts,
255
+ AIHubAdminTexts,
256
+ DeepPartial,
257
+ } from "./auth/texts.js";
258
+
259
+ /* ── Password policy (client-side mirror of §8.5) ────────────────── */
260
+
261
+ export {
262
+ PASSWORD_MIN_LENGTH,
263
+ PASSWORD_REQUIRED_CATEGORIES,
264
+ validatePasswordPolicyClient,
265
+ countCharacterCategoriesClient,
266
+ } from "./auth/passwordPolicy.js";
267
+ export type {
268
+ ClientPasswordPolicyResult,
269
+ ClientPasswordPolicyErrorCode,
270
+ } from "./auth/passwordPolicy.js";
271
+
272
+ /* ── AIHub.* namespace (Tier-3 composition primitives) ───────────── */
273
+
274
+ export { AIHub } from "./primitives/index.js";
275
+ export type { AIHubNamespace } from "./primitives/index.js";
@@ -0,0 +1,101 @@
1
+ /**
2
+ * The `AIHub.*` namespace — Tier-3 composition primitives.
3
+ *
4
+ * Every primitive is real after Step 10. Tier-3 wrappers compose them
5
+ * directly; the default monolith `<DataClubAIHub />` is itself a Tier-3
6
+ * composition that lives in the library as a reference (~50 lines of
7
+ * internal body code).
8
+ *
9
+ * The namespace is intentionally a single object literal so consumers
10
+ * can do `import { AIHub } from "@data-club/ai-hub"` and reach every
11
+ * primitive via dotted access (`<AIHub.MessageList renderMessageActions={…} />`).
12
+ *
13
+ * @see SPECIFICATIONS.md §7.1 — exports
14
+ * @see SPECIFICATIONS.md §7.9 — Tier 3 composition
15
+ */
16
+
17
+ import { AIHubProvider } from "../context/AIHubProvider.js";
18
+ import { AgentsPicker } from "../components/AgentsPicker/index.js";
19
+ import { AuthGate } from "../components/AuthGate/index.js";
20
+ import { DataClubAIHubAdmin } from "../components/DataClubAIHubAdmin/index.js";
21
+ import { EffortControl } from "../components/EffortControl/index.js";
22
+ import { Layout } from "../components/Layout/index.js";
23
+ import { MainColumn } from "../components/MainColumn/index.js";
24
+ import { MarkdownRenderer } from "../components/MarkdownRenderer/index.js";
25
+ import { MessageInput } from "../components/MessageInput/index.js";
26
+ import { MessageList } from "../components/MessageList/index.js";
27
+ import { ReasoningSelector } from "../components/ReasoningSelector/index.js";
28
+ import { ReasoningView } from "../components/ReasoningView/index.js";
29
+ import { ScrollToPresentButton } from "../components/ScrollToPresentButton/index.js";
30
+ import { SessionsPanel } from "../components/SessionsPanel/index.js";
31
+ import { SystemNotice } from "../components/SystemNotice/index.js";
32
+ import { ThemeSwitcher } from "../components/ThemeSwitcher/index.js";
33
+ import { ToolCallView } from "../components/ToolCallView/index.js";
34
+ import { TpmBanner } from "../components/TpmBanner/index.js";
35
+ import { TurnStatusIndicator } from "../components/TurnStatusIndicator/index.js";
36
+
37
+ /**
38
+ * Tier-3 composition primitives. Build a custom layout by composing
39
+ * `AIHub.Provider` + `AIHub.AuthGate` + `AIHub.Layout` + sub-primitives.
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * <AIHub.Provider baseUrl="/api/ai-hub">
44
+ * <AIHub.AuthGate>
45
+ * <AIHub.Layout>
46
+ * <AIHub.SessionsPanel />
47
+ * <AIHub.MainColumn>
48
+ * <AIHub.MessageList />
49
+ * <AIHub.Input toolbar={<AIHub.EffortControl />} />
50
+ * </AIHub.MainColumn>
51
+ * </AIHub.Layout>
52
+ * </AIHub.AuthGate>
53
+ * </AIHub.Provider>
54
+ * ```
55
+ *
56
+ * @see SPECIFICATIONS.md §7.9
57
+ */
58
+ export const AIHub = {
59
+ /** Root context provider. */
60
+ Provider: AIHubProvider,
61
+ /** Auth gate — renders Login / ChangePassword when needed. */
62
+ AuthGate,
63
+ /** Post-login landing view. */
64
+ AgentsPicker,
65
+ /** Flex layout container for SessionsPanel + MainColumn. */
66
+ Layout,
67
+ /** Sessions sidebar. */
68
+ SessionsPanel,
69
+ /** Main chat column. */
70
+ MainColumn,
71
+ /** Scrollable message list. */
72
+ MessageList,
73
+ /** Input area with send/stop buttons + toolbar. */
74
+ Input: MessageInput,
75
+ /** Markdown renderer for assistant message bodies (GFM + math). */
76
+ MarkdownRenderer,
77
+ /** Standalone reasoning-effort selector (per-message, legacy §7.4 path). */
78
+ EffortControl,
79
+ /** Capability-driven per-session reasoning UI. Renders 0–3 dropdowns/inputs
80
+ * based on the active agent's model. Returns null for no-reasoning models. */
81
+ ReasoningSelector,
82
+ /** System-notice banner (TPM wait / resumed / error). */
83
+ SystemNotice,
84
+ /** TPM-recovery banner with countdown. */
85
+ TpmBanner,
86
+ /** `(status, phase)` indicator dot + label (§10.4). */
87
+ TurnStatusIndicator,
88
+ /** Sun/moon theme toggle. */
89
+ ThemeSwitcher,
90
+ /** Floating "↓ Jump to latest" button. */
91
+ ScrollToPresentButton,
92
+ /** Collapsible reasoning block inside an assistant bubble. */
93
+ ReasoningView,
94
+ /** Collapsible tool-call card. */
95
+ ToolCallView,
96
+ /** Role-gated admin UI (returns null for `user`-role callers). */
97
+ AdminShell: DataClubAIHubAdmin,
98
+ } as const;
99
+
100
+ /** The `AIHub` namespace type — exported for consumers that type-spread it. */
101
+ export type AIHubNamespace = typeof AIHub;