@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 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,OAAO,GAAG,aAAa,CAAC;AAExE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IACxB,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,sEAAsE;IACtE,IAAI,EAAE,SAAS,CAAC;IAChB;;;;;;OAMG;IACH,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,aAAa,EAAE,OAAO,GAAG,MAAM,CAAC;IAChC;;;;OAIG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,IAAI,EAAE,SAAS,CAAC;IAChB,wEAAwE;IACxE,UAAU,EAAE,eAAe,CAAC;CAC7B;AAMD;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO;IACtB,mBAAmB;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,gFAAgF;I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IAClD,qDAAqD;IACrD,mBAAmB,CAAC,EAAE,0BAA0B,CAAC;IACjD,sEAAsE;IACtE,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,kCAAkC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qCAAqC;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
package/dist/types.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Shared type definitions for the ai-hub library.
3
+ *
4
+ * Owned by `@data-club/ai-hub` per SPECIFICATIONS.md §7.1; the server package
5
+ * imports from here via the workspace symlink so the wire protocol (§9), the
6
+ * state machine (§10), and the role / user / session shapes (§11, §8) stay in
7
+ * exactly one place.
8
+ *
9
+ * Step 1 only defines the types — there is intentionally no runtime code in
10
+ * this file. Subsequent steps add reducers (Step 7), server handlers (Steps 2+),
11
+ * and React components (Steps 8+) that consume these.
12
+ *
13
+ * @see SPECIFICATIONS.md §7.1 — exports
14
+ * @see SPECIFICATIONS.md §9 — wire protocol
15
+ * @see SPECIFICATIONS.md §10 — state machine
16
+ * @see SPECIFICATIONS.md §11 — data model
17
+ */
18
+ export {};
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * `defineWebComponent()` — the helper every per-customer wrapper calls
3
+ * exactly once to ship its React tree as a `<{customer}-chat>` Web
4
+ * Component (§7.10).
5
+ *
6
+ * Default behavior:
7
+ *
8
+ * 1. Validates `tagName` per the WHATWG custom-element naming rules
9
+ * (lowercase, contains a hyphen, not a reserved name).
10
+ * https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
11
+ * 2. Creates an `HTMLElement` subclass:
12
+ * - `connectedCallback` opens an open Shadow Root (default) or mounts
13
+ * directly on the host, calls `react-dom`'s `createRoot()` against
14
+ * that root, and renders `<Component />`.
15
+ * - `disconnectedCallback` unmounts the React root.
16
+ * - The `onConnect` / `onDisconnect` hooks fire around mount/unmount.
17
+ * 3. Injects the package's default CSS into the shadow root unless
18
+ * `cssText` is provided (in which case the per-customer CSS is
19
+ * responsible for everything).
20
+ * 4. Calls `customElements.define(tagName, GeneratedClass)`. Re-registration
21
+ * (e.g. during hot reload) is detected and warned, not thrown — the
22
+ * second registration is a no-op so dev workflows aren't blocked.
23
+ *
24
+ * @see SPECIFICATIONS.md §7.10 — defineWebComponent
25
+ */
26
+ import { type ComponentType } from "react";
27
+ import { type Root } from "react-dom/client";
28
+ declare global {
29
+ interface HTMLElement {
30
+ /** Root used by `defineWebComponent` to track the React tree. */
31
+ __dcAIHubRoot?: Root;
32
+ }
33
+ }
34
+ /**
35
+ * Options for `defineWebComponent`.
36
+ */
37
+ export interface DefineWebComponentOptions {
38
+ /**
39
+ * Render into a Shadow DOM. Default true — style isolation is what
40
+ * makes ai-hub safe to embed in any third-party website (§7.10).
41
+ * Disable only for advanced cases where the host page must reach into
42
+ * the chat tree (e.g. legacy print-stylesheets).
43
+ */
44
+ shadowDom?: boolean;
45
+ /**
46
+ * CSS to inject into the Shadow Root. When omitted, the library injects
47
+ * its bundled `default.css` (set by the consuming app's bundler via
48
+ * `import "@data-club/ai-hub/styles/default.css"`-style raw imports —
49
+ * the helper itself does not pull the file at runtime).
50
+ *
51
+ * For Step 7 the per-customer wrapper is responsible for providing
52
+ * either `cssText` or arranging for `default.css` to be loaded another
53
+ * way; the helper validates that one of the two is in place but does
54
+ * not embed a CSS string itself.
55
+ */
56
+ cssText?: string;
57
+ /**
58
+ * Called immediately after the React root mounts. Useful for the
59
+ * wrapper to attach analytics or read host-element attributes.
60
+ *
61
+ * @param host - the custom-element host.
62
+ */
63
+ onConnect?: (host: HTMLElement) => void;
64
+ /**
65
+ * Called when the custom element disconnects (just before the React root
66
+ * is unmounted).
67
+ *
68
+ * @param host - the custom-element host.
69
+ */
70
+ onDisconnect?: (host: HTMLElement) => void;
71
+ }
72
+ /**
73
+ * Validates a custom-element tag name per the WHATWG rules:
74
+ *
75
+ * - Starts with a lowercase ASCII letter.
76
+ * - Contains at least one hyphen.
77
+ * - Only lowercase ASCII letters, digits, hyphens, dots, and underscores.
78
+ * - Does not match the reserved-name list (`annotation-xml`, `color-profile`,
79
+ * `font-face`, `font-face-src`, `font-face-uri`, `font-face-format`,
80
+ * `font-face-name`, `missing-glyph`).
81
+ *
82
+ * @param tagName - the proposed tag name.
83
+ * @returns true when the name is valid.
84
+ */
85
+ export declare function isValidCustomElementName(tagName: string): boolean;
86
+ /**
87
+ * Registers a custom HTML element that renders `Component` inside a
88
+ * Shadow DOM (or directly on the host when `shadowDom: false`).
89
+ *
90
+ * Idempotent on re-registration of the same `tagName`: emits a console
91
+ * warning and returns without throwing (the existing element keeps
92
+ * working — useful during HMR).
93
+ *
94
+ * @param tagName - the custom-element tag name (must contain a hyphen).
95
+ * @param Component - the React component to mount.
96
+ * @param options - optional shadow-DOM + CSS + lifecycle settings.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * defineWebComponent("bankxyz-chat", () => <DataClubAIHub />, {
101
+ * cssText: customerThemeCss,
102
+ * });
103
+ * ```
104
+ */
105
+ export declare function defineWebComponent(tagName: string, Component: ComponentType, options?: DefineWebComponentOptions): void;
106
+ //# sourceMappingURL=defineWebComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineWebComponent.d.ts","sourceRoot":"","sources":["../../src/webcomponent/defineWebComponent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,WAAW;QACnB,iEAAiE;QACjE,aAAa,CAAC,EAAE,IAAI,CAAC;KACtB;CACF;AAGD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CAC5C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAcjE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,aAAa,EACxB,OAAO,GAAE,yBAA8B,GACtC,IAAI,CA+DN"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * `defineWebComponent()` — the helper every per-customer wrapper calls
3
+ * exactly once to ship its React tree as a `<{customer}-chat>` Web
4
+ * Component (§7.10).
5
+ *
6
+ * Default behavior:
7
+ *
8
+ * 1. Validates `tagName` per the WHATWG custom-element naming rules
9
+ * (lowercase, contains a hyphen, not a reserved name).
10
+ * https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
11
+ * 2. Creates an `HTMLElement` subclass:
12
+ * - `connectedCallback` opens an open Shadow Root (default) or mounts
13
+ * directly on the host, calls `react-dom`'s `createRoot()` against
14
+ * that root, and renders `<Component />`.
15
+ * - `disconnectedCallback` unmounts the React root.
16
+ * - The `onConnect` / `onDisconnect` hooks fire around mount/unmount.
17
+ * 3. Injects the package's default CSS into the shadow root unless
18
+ * `cssText` is provided (in which case the per-customer CSS is
19
+ * responsible for everything).
20
+ * 4. Calls `customElements.define(tagName, GeneratedClass)`. Re-registration
21
+ * (e.g. during hot reload) is detected and warned, not thrown — the
22
+ * second registration is a no-op so dev workflows aren't blocked.
23
+ *
24
+ * @see SPECIFICATIONS.md §7.10 — defineWebComponent
25
+ */
26
+ import { createElement } from "react";
27
+ import { createRoot } from "react-dom/client";
28
+ /**
29
+ * Validates a custom-element tag name per the WHATWG rules:
30
+ *
31
+ * - Starts with a lowercase ASCII letter.
32
+ * - Contains at least one hyphen.
33
+ * - Only lowercase ASCII letters, digits, hyphens, dots, and underscores.
34
+ * - Does not match the reserved-name list (`annotation-xml`, `color-profile`,
35
+ * `font-face`, `font-face-src`, `font-face-uri`, `font-face-format`,
36
+ * `font-face-name`, `missing-glyph`).
37
+ *
38
+ * @param tagName - the proposed tag name.
39
+ * @returns true when the name is valid.
40
+ */
41
+ export function isValidCustomElementName(tagName) {
42
+ if (typeof tagName !== "string" || tagName.length === 0)
43
+ return false;
44
+ if (!/^[a-z][a-z0-9._-]*-[a-z0-9._-]*$/.test(tagName))
45
+ return false;
46
+ const reserved = new Set([
47
+ "annotation-xml",
48
+ "color-profile",
49
+ "font-face",
50
+ "font-face-src",
51
+ "font-face-uri",
52
+ "font-face-format",
53
+ "font-face-name",
54
+ "missing-glyph",
55
+ ]);
56
+ return !reserved.has(tagName);
57
+ }
58
+ /**
59
+ * Registers a custom HTML element that renders `Component` inside a
60
+ * Shadow DOM (or directly on the host when `shadowDom: false`).
61
+ *
62
+ * Idempotent on re-registration of the same `tagName`: emits a console
63
+ * warning and returns without throwing (the existing element keeps
64
+ * working — useful during HMR).
65
+ *
66
+ * @param tagName - the custom-element tag name (must contain a hyphen).
67
+ * @param Component - the React component to mount.
68
+ * @param options - optional shadow-DOM + CSS + lifecycle settings.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * defineWebComponent("bankxyz-chat", () => <DataClubAIHub />, {
73
+ * cssText: customerThemeCss,
74
+ * });
75
+ * ```
76
+ */
77
+ export function defineWebComponent(tagName, Component, options = {}) {
78
+ if (!isValidCustomElementName(tagName)) {
79
+ throw new Error(`defineWebComponent: "${tagName}" is not a valid custom-element name. ` +
80
+ `Names must start with a lowercase letter, contain at least one hyphen, and use only [a-z0-9._-].`);
81
+ }
82
+ if (typeof customElements === "undefined") {
83
+ throw new Error("defineWebComponent: the `customElements` registry is unavailable. " +
84
+ "This helper must run in a browser-like environment.");
85
+ }
86
+ if (customElements.get(tagName)) {
87
+ // Hot-reload friendliness — registries are immutable, so we warn and
88
+ // bail rather than throwing.
89
+ // eslint-disable-next-line no-console
90
+ console.warn(`defineWebComponent: <${tagName}> is already registered. Skipping re-registration.`);
91
+ return;
92
+ }
93
+ const shadowDom = options.shadowDom !== false;
94
+ const cssText = options.cssText;
95
+ const onConnect = options.onConnect;
96
+ const onDisconnect = options.onDisconnect;
97
+ class AIHubElement extends HTMLElement {
98
+ connectedCallback() {
99
+ const target = shadowDom
100
+ ? this.attachShadow({ mode: "open" })
101
+ : this;
102
+ if (shadowDom && cssText) {
103
+ const styleEl = document.createElement("style");
104
+ styleEl.textContent = cssText;
105
+ target.appendChild(styleEl);
106
+ }
107
+ const mountNode = document.createElement("div");
108
+ mountNode.className = "data-club-ai-hub-mount";
109
+ target.appendChild(mountNode);
110
+ const root = createRoot(mountNode);
111
+ root.render(createElement(Component));
112
+ this.__dcAIHubRoot = root;
113
+ onConnect?.(this);
114
+ }
115
+ disconnectedCallback() {
116
+ onDisconnect?.(this);
117
+ const root = this.__dcAIHubRoot;
118
+ if (root) {
119
+ root.unmount();
120
+ delete this.__dcAIHubRoot;
121
+ }
122
+ }
123
+ }
124
+ customElements.define(tagName, AIHubElement);
125
+ }
126
+ //# sourceMappingURL=defineWebComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineWebComponent.js","sourceRoot":"","sources":["../../src/webcomponent/defineWebComponent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,aAAa,EAAsB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AAkDzD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,w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C,iBAAiB;YACf,MAAM,MAAM,GAAyB,SAAS;gBAC5C,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gBACrC,CAAC,CAAC,IAAI,CAAC;YAET,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;gBACzB,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBAChD,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC;gBAC7B,MAAqB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC9C,CAAC;YAED,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAChD,SAAS,CAAC,SAAS,GAAG,wBAAwB,CAAC;YAC/C,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YAE9B,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;YACtC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAC1B,SAAS,EAAE,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;QAED,oBAAoB;YAClB,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC;YACrB,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC;YAChC,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC,OAAO,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,aAAa,CAAC;YAC5B,CAAC;QACH,CAAC;KACF;IAED,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Re-exports for the `webcomponent/` directory.
3
+ *
4
+ * @see SPECIFICATIONS.md §7.10 — defineWebComponent
5
+ */
6
+ export { defineWebComponent, isValidCustomElementName, type DefineWebComponentOptions, } from "./defineWebComponent.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webcomponent/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Re-exports for the `webcomponent/` directory.
3
+ *
4
+ * @see SPECIFICATIONS.md §7.10 — defineWebComponent
5
+ */
6
+ export { defineWebComponent, isValidCustomElementName, } from "./defineWebComponent.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/webcomponent/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GAEzB,MAAM,yBAAyB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@data-club/ai-hub",
3
+ "version": "0.0.1",
4
+ "description": "React package for the data-club ai-hub: chat UI, login + change-password, admin UI, AIHub.* primitives, defineWebComponent helper, client SDK. See docs/SPECIFICATIONS.md §7.",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./types": {
16
+ "types": "./dist/types.d.ts",
17
+ "import": "./dist/types.js"
18
+ },
19
+ "./styles/default.css": "./src/styles/default.css"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "src"
24
+ ],
25
+ "peerDependencies": {
26
+ "react": "^19.0.0",
27
+ "react-dom": "^19.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@storybook/react-vite": "^10.3.6",
31
+ "@storybook/test-runner": "^0.24.0",
32
+ "@testing-library/jest-dom": "^6.6.3",
33
+ "@testing-library/react": "^16.1.0",
34
+ "@types/react": "^19.0.1",
35
+ "@types/react-dom": "^19.0.2",
36
+ "@vitejs/plugin-react": "^4.3.4",
37
+ "eslint-plugin-storybook": "^10.3.6",
38
+ "jsdom": "^25.0.1",
39
+ "react": "^19.0.0",
40
+ "react-dom": "^19.0.0",
41
+ "storybook": "^10.3.6",
42
+ "typescript": "^5.5.4",
43
+ "vite": "^5.4.11",
44
+ "vitest": "^1.6.1"
45
+ },
46
+ "dependencies": {
47
+ "katex": "^0.16",
48
+ "react-markdown": "^9",
49
+ "rehype-katex": "^7",
50
+ "remark-gfm": "^4",
51
+ "remark-math": "^6"
52
+ },
53
+ "scripts": {
54
+ "build": "tsc -p tsconfig.build.json",
55
+ "typecheck": "tsc -p tsconfig.json --noEmit",
56
+ "test": "vitest run --passWithNoTests",
57
+ "dev": "vite",
58
+ "clean": "rm -rf dist .tsbuildinfo",
59
+ "storybook": "storybook dev -p 6006",
60
+ "build-storybook": "storybook build",
61
+ "test-storybook": "test-storybook --url http://localhost:6006"
62
+ }
63
+ }
@@ -0,0 +1,28 @@
1
+ // step1-lint-canary.ts.disabled
2
+ //
3
+ // This file is the **deliberate lint failure** the Step 1 acceptance criteria
4
+ // reference: "A deliberate 'exported function with no JSDoc' sample fails
5
+ // `pnpm lint` (proves the rule is wired)." See docs/IMPLEMENTATION_PLAN.md
6
+ // Step 1.
7
+ //
8
+ // HOW TO USE:
9
+ //
10
+ // 1. Rename this file by stripping the `.disabled` suffix:
11
+ // mv step1-lint-canary.ts.disabled step1-lint-canary.ts
12
+ // 2. Run `pnpm lint`.
13
+ // 3. ESLint MUST report `jsdoc/require-jsdoc` on `noJSDocHere`. If it
14
+ // doesn't, the lint plumbing is broken — fix the config before merging.
15
+ // 4. Rename the file back (re-append `.disabled`) or delete it.
16
+ //
17
+ // The file is shipped suffixed-out so `pnpm lint` stays green in normal CI;
18
+ // the suffix-flip is the "deliberate" part of "deliberate failure."
19
+ //
20
+ // Why a file rather than a snippet inlined in a docs file: ESLint's
21
+ // `require-jsdoc` only runs on parsed source, not on prose. Future agents
22
+ // who edit the lint config can flip this on, watch the rule fire, and flip
23
+ // it off again — confirming the wiring without remembering an arbitrary
24
+ // snippet.
25
+
26
+ export function noJSDocHere(): string {
27
+ return "intentional regression sample — no JSDoc above this export";
28
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Client-side mirror of the §8.5 password policy enforced server-side at
3
+ * `packages/ai-hub-server/src/auth/passwordPolicy.ts`.
4
+ *
5
+ * The change-password form re-runs this check before submit so the user
6
+ * sees the error without a round-trip; the server is authoritative — if
7
+ * the two ever disagree, the server wins (the form re-renders the server's
8
+ * error banner). The duplication is deliberate (two 5-line regex checks)
9
+ * because we don't want the React package to import server-only deps just
10
+ * to share five lines of policy.
11
+ *
12
+ * **If you tighten the policy, change it in both files** — there is a
13
+ * regression test that locks both modules' behavior against the same
14
+ * fixture set so divergence shows up as a CI failure.
15
+ *
16
+ * @see SPECIFICATIONS.md §8.5 — password complexity
17
+ * @see ../../../ai-hub-server/src/auth/passwordPolicy.ts — server source-of-truth
18
+ */
19
+
20
+ /** Minimum length for a new password (§8.5). */
21
+ export const PASSWORD_MIN_LENGTH = 8;
22
+
23
+ /** Minimum distinct character categories required (§8.5). */
24
+ export const PASSWORD_REQUIRED_CATEGORIES = 2;
25
+
26
+ /** Machine-readable codes the client validator emits. */
27
+ export type ClientPasswordPolicyErrorCode =
28
+ | "password_too_short"
29
+ | "password_too_simple";
30
+
31
+ /** Result of `validatePasswordPolicyClient`. */
32
+ export type ClientPasswordPolicyResult =
33
+ | { ok: true }
34
+ | { ok: false; code: ClientPasswordPolicyErrorCode };
35
+
36
+ /**
37
+ * Returns whether the candidate satisfies the §8.5 policy. Used by the
38
+ * change-password form to disable submit / surface an inline error before
39
+ * issuing a request.
40
+ *
41
+ * @param password - the candidate plaintext password.
42
+ * @returns `{ ok: true }` or a discriminated failure code.
43
+ */
44
+ export function validatePasswordPolicyClient(
45
+ password: string,
46
+ ): ClientPasswordPolicyResult {
47
+ if (password.length < PASSWORD_MIN_LENGTH) {
48
+ return { ok: false, code: "password_too_short" };
49
+ }
50
+ if (countCharacterCategoriesClient(password) < PASSWORD_REQUIRED_CATEGORIES) {
51
+ return { ok: false, code: "password_too_simple" };
52
+ }
53
+ return { ok: true };
54
+ }
55
+
56
+ /**
57
+ * Counts how many of the three §8.5 categories the password matches.
58
+ *
59
+ * - letter — any Unicode letter (`\p{L}`)
60
+ * - digit — any Unicode number (`\p{N}`)
61
+ * - special — anything else that isn't whitespace (`\s`)
62
+ *
63
+ * Whitespace deliberately doesn't tick the special box — we want at least
64
+ * one meaningfully non-letter, non-digit character.
65
+ *
66
+ * @param password - the candidate plaintext password.
67
+ * @returns the count in `[0, 3]`.
68
+ */
69
+ export function countCharacterCategoriesClient(password: string): number {
70
+ let count = 0;
71
+ if (/\p{L}/u.test(password)) count++;
72
+ if (/\p{N}/u.test(password)) count++;
73
+ if (/[^\p{L}\p{N}\s]/u.test(password)) count++;
74
+ return count;
75
+ }