@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,62 @@
1
+ /**
2
+ * `<PasswordInput>` — internal helper used by `<DataClubAIHubLogin />` and
3
+ * `<DataClubAIHubChangePassword />` to render a password field with its own
4
+ * show/hide eye-icon toggle.
5
+ *
6
+ * The toggle is **per-field** (each input owns its own state) so a user
7
+ * can reveal one field while keeping another masked — useful for visually
8
+ * verifying a match between New and Confirm without exposing both at once.
9
+ *
10
+ * Not exported from the package (no JSDoc-required interface surfaces here);
11
+ * lives under `components/internal/` to make that explicit.
12
+ *
13
+ * @see ui-sketches/01-login.md — show_password_toggle
14
+ * @see ui-sketches/02-change-password.md — per-field toggle
15
+ */
16
+ import { type ReactNode } from "react";
17
+ /**
18
+ * Props for the internal `<PasswordInput>` helper.
19
+ */
20
+ export interface PasswordInputProps {
21
+ /** Stable DOM id used by the label + `aria-describedby` if any. */
22
+ id: string;
23
+ /** Input value. */
24
+ value: string;
25
+ /** Change handler — receives the next plaintext value. */
26
+ onChange: (next: string) => void;
27
+ /** Native `name` attribute for autofill / form submission. */
28
+ name: string;
29
+ /** Native `autoComplete` value — caller picks per field. */
30
+ autoComplete?: string;
31
+ /** Placeholder text. Defaults to "••••••••". */
32
+ placeholder?: string;
33
+ /** Whether the input is disabled (e.g. during submit). */
34
+ disabled?: boolean;
35
+ /** Whether to autofocus on mount. */
36
+ autoFocus?: boolean;
37
+ /** Required field — mirrors HTML `required` for browser-side validation. */
38
+ required?: boolean;
39
+ /** `aria-label` for the toggle when the password is currently hidden. */
40
+ showAriaLabel: string;
41
+ /** `aria-label` for the toggle when the password is currently shown. */
42
+ hideAriaLabel: string;
43
+ /** BEM class for the wrapper `<div>` that holds the input + toggle. */
44
+ wrapperClassName: string;
45
+ /** BEM class for the `<input>` itself. */
46
+ inputClassName: string;
47
+ /** BEM class for the toggle `<button>`. */
48
+ toggleClassName: string;
49
+ /** Optional `data-testid` on the wrapper — used by RTL tests. */
50
+ testId?: string;
51
+ }
52
+ /**
53
+ * Renders a password field with a show/hide eye-icon toggle.
54
+ *
55
+ * The toggle is `type="button"` (not submit) and keyboard-accessible
56
+ * (Enter / Space activate without submitting the surrounding form).
57
+ *
58
+ * @param props - the input props.
59
+ * @returns the input + toggle pair.
60
+ */
61
+ export declare function PasswordInput(props: PasswordInputProps): ReactNode;
62
+ //# sourceMappingURL=PasswordInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasswordInput.d.ts","sourceRoot":"","sources":["../../../src/components/internal/PasswordInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yEAAyE;IACzE,aAAa,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,aAAa,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,gBAAgB,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAoDlE"}
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * `<PasswordInput>` — internal helper used by `<DataClubAIHubLogin />` and
4
+ * `<DataClubAIHubChangePassword />` to render a password field with its own
5
+ * show/hide eye-icon toggle.
6
+ *
7
+ * The toggle is **per-field** (each input owns its own state) so a user
8
+ * can reveal one field while keeping another masked — useful for visually
9
+ * verifying a match between New and Confirm without exposing both at once.
10
+ *
11
+ * Not exported from the package (no JSDoc-required interface surfaces here);
12
+ * lives under `components/internal/` to make that explicit.
13
+ *
14
+ * @see ui-sketches/01-login.md — show_password_toggle
15
+ * @see ui-sketches/02-change-password.md — per-field toggle
16
+ */
17
+ import { useState } from "react";
18
+ /**
19
+ * Renders a password field with a show/hide eye-icon toggle.
20
+ *
21
+ * The toggle is `type="button"` (not submit) and keyboard-accessible
22
+ * (Enter / Space activate without submitting the surrounding form).
23
+ *
24
+ * @param props - the input props.
25
+ * @returns the input + toggle pair.
26
+ */
27
+ export function PasswordInput(props) {
28
+ const { id, value, onChange, name, autoComplete, placeholder = "••••••••", disabled, autoFocus, required, showAriaLabel, hideAriaLabel, wrapperClassName, inputClassName, toggleClassName, testId, } = props;
29
+ const [revealed, setRevealed] = useState(false);
30
+ return (_jsxs("div", { className: wrapperClassName, ...(testId !== undefined ? { "data-testid": testId } : {}), children: [_jsx("input", { id: id, type: revealed ? "text" : "password", value: value, onChange: (e) => onChange(e.target.value), name: name, ...(autoComplete !== undefined ? { autoComplete } : {}), placeholder: placeholder, disabled: disabled, autoFocus: autoFocus, required: required, className: inputClassName }), _jsx("button", { type: "button", className: toggleClassName, "aria-label": revealed ? hideAriaLabel : showAriaLabel, "aria-pressed": revealed, onClick: () => setRevealed((r) => !r), tabIndex: 0, children: _jsx(EyeIcon, { open: revealed }) })] }));
31
+ }
32
+ /**
33
+ * Inline eye icon. Two paths so the open / closed variants share weight
34
+ * and stroke caps without two `<svg>` trees.
35
+ *
36
+ * @param props - icon props.
37
+ * @param props.open - true → "show" (eye), false → "hide" (eye with slash).
38
+ */
39
+ function EyeIcon(props) {
40
+ return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children: [_jsx("path", { d: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z" }), _jsx("circle", { cx: "12", cy: "12", r: "3" }), !props.open ? _jsx("path", { d: "M3 3l18 18" }) : null] }));
41
+ }
42
+ //# sourceMappingURL=PasswordInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasswordInput.js","sourceRoot":"","sources":["../../../src/components/internal/PasswordInput.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAsCjD;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EACJ,EAAE,EACF,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,WAAW,GAAG,UAAU,EACxB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,MAAM,GACP,GAAG,KAAK,CAAC;IAEV,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhD,OAAO,CACL,eACE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B,SAAS,EAAC,OAAO,aAEjB,eAAM,CAAC,EAAC,kDAAkD,GAAG,EAC7D,iBAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,GAAG,GAAG,EAC/B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,eAAM,CAAC,EAAC,YAAY,GAAG,CAAC,CAAC,CAAC,IAAI,IACzC,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,220 @@
1
+ /**
2
+ * Internal React context shared by `<AIHubProvider>` + the `useAIHub` /
3
+ * `useAIHubAuth` hooks.
4
+ *
5
+ * Kept separate from `AIHubProvider.tsx` so the hooks can import the
6
+ * context object without pulling in the provider's component tree (and
7
+ * the JSX dependencies that come with it).
8
+ *
9
+ * @see SPECIFICATIONS.md §7.2 — provider + hooks
10
+ */
11
+ import type { AgentSummary, AIHubClient, LoginResponse, PatchSessionOptions } from "../client/AIHubClient.js";
12
+ import type { AIHubEffort } from "../client/AIHubClient.js";
13
+ import type { AIHubAuthContext, AIHubFeatureToggles, AIHubMessage, AIHubRole, AIHubState, AIHubToolCallRecord, AIHubUser, Session } from "../types.js";
14
+ /**
15
+ * The shape provided by `<AIHubProvider>` to its descendants. Hook
16
+ * implementations destructure this; consumers don't see it directly.
17
+ */
18
+ export interface AIHubContextValue {
19
+ /** The underlying SDK — consumers can call any method directly. */
20
+ client: AIHubClient;
21
+ /** Currently authenticated user, or null when no valid token is present. */
22
+ user: AIHubUser | null;
23
+ /** Echoes `user.role` for convenience; null when unauthenticated. */
24
+ role: AIHubRole | null;
25
+ /** Deployment-wide context from `/auth/me`; null when unauthenticated. */
26
+ deployment: AIHubAuthContext["deployment"] | null;
27
+ /**
28
+ * True when the user must call `changePassword` before any other endpoint
29
+ * accepts the token. Forces the change-password screen to render under
30
+ * `AuthGate` (Step 8).
31
+ */
32
+ mustChangePassword: boolean;
33
+ /** Initialization state — `true` until the first `/auth/me` resolves. */
34
+ hydrating: boolean;
35
+ /**
36
+ * Logs in via `client.login`. Stores the token + refreshes auth state.
37
+ * Returns the underlying `LoginResponse` so callers (e.g. the auto-
38
+ * rendered `<DataClubAIHubLogin />`) can branch on `mustChangePassword`
39
+ * + read the just-authenticated `user` without waiting for the next
40
+ * render. Throws `AIHubRequestError` on failure (the caller decides UX).
41
+ */
42
+ login: (username: string, password: string) => Promise<LoginResponse>;
43
+ /**
44
+ * Clears the local token; calls `client.logout()` best-effort for the
45
+ * audit log. The state transitions to `user=null, role=null` so consumers
46
+ * route back to login.
47
+ */
48
+ logout: () => Promise<void>;
49
+ /**
50
+ * Calls `client.changePassword`; after success, refreshes `/auth/me` so
51
+ * `user` + `deployment` reflect the now-clearable `is_initial_password`
52
+ * flag.
53
+ */
54
+ changePassword: (currentPassword: string | null, newPassword: string) => Promise<void>;
55
+ /**
56
+ * Active turn's reducer state, driven by SSE events flowing from
57
+ * `client.streamChat()`. Re-derived from the persisted event log on
58
+ * reconnect (§7.5).
59
+ */
60
+ state: AIHubState;
61
+ /** Per-message reasoning effort (§7.4). Defaults to `"medium"`. */
62
+ effort: AIHubEffort;
63
+ /** Sets the per-message effort. Survives until changed. */
64
+ setEffort: (next: AIHubEffort) => void;
65
+ /**
66
+ * The ai-hub agents catalog visible to the caller (non-archived only,
67
+ * with caller-scoped `session_count`). Loaded once after authentication;
68
+ * refreshed via `refreshAgents()`.
69
+ */
70
+ agents: AgentSummary[];
71
+ /** True while the initial `/agents` request is in flight. */
72
+ agentsLoading: boolean;
73
+ /** Refetches `/agents` — e.g. after a new session was created. */
74
+ refreshAgents: () => Promise<void>;
75
+ /**
76
+ * The ai-hub agent the user has opened. `null` when on the agents
77
+ * picker. The sessions list + chat column read from this.
78
+ */
79
+ activeAgentId: string | null;
80
+ /**
81
+ * Opens an agent (transitions out of the agents picker) or clears the
82
+ * selection back to it (`null`).
83
+ */
84
+ setActiveAgent: (id: string | null) => void;
85
+ /**
86
+ * Sessions for the active agent + current user, ordered by
87
+ * `updated_at DESC`. Empty when no agent is open.
88
+ */
89
+ sessions: Session[];
90
+ /** True while the active agent's `/sessions` request is in flight. */
91
+ sessionsLoading: boolean;
92
+ /** Refetches `/sessions` for the active agent. */
93
+ refreshSessions: () => Promise<void>;
94
+ /**
95
+ * Whether the sessions list includes archived rows. Toggled by the
96
+ * `archived_filter_toggle` at the bottom of the panel.
97
+ */
98
+ includeArchivedSessions: boolean;
99
+ /** Sets the archived filter. */
100
+ setIncludeArchivedSessions: (next: boolean) => void;
101
+ /** The opened session id, or `null` if none. */
102
+ activeSessionId: string | null;
103
+ /** Opens a session (loads its message history). */
104
+ setActiveSession: (id: string | null) => void;
105
+ /**
106
+ * Creates a session via `POST /sessions` and selects it. `title` is
107
+ * required (1..80 chars). Rejected client-side on empty / oversize.
108
+ */
109
+ createSession: (title: string) => Promise<Session>;
110
+ /** Rename / archive a session via `PATCH /sessions/{id}`. */
111
+ patchSession: (id: string, patch: PatchSessionOptions) => Promise<Session>;
112
+ /**
113
+ * Messages for the active session. Loaded from
114
+ * `GET /sessions/{id}/messages` when `activeSessionId` changes; appended
115
+ * to during streaming. Empty when no session is active.
116
+ */
117
+ messages: AIHubMessage[];
118
+ /** True while the active session's message history is loading. */
119
+ messagesLoading: boolean;
120
+ /**
121
+ * In-progress assistant text — accumulating `assistant_delta`s for the
122
+ * currently-streaming turn. `null` when no turn is in flight.
123
+ */
124
+ streamingAssistantText: string | null;
125
+ /**
126
+ * In-progress reasoning text — accumulating `reasoning_delta`s for
127
+ * the currently-streaming turn. `null` when no reasoning is in
128
+ * flight. The live assistant bubble renders this via
129
+ * `<ReasoningView />`.
130
+ */
131
+ streamingReasoning: string | null;
132
+ /**
133
+ * In-progress tool calls — built up from `tool_call_started` /
134
+ * `tool_call_input_delta` / `tool_call_result` events. Empty when no
135
+ * tool is being invoked.
136
+ */
137
+ streamingToolCalls: ReadonlyArray<AIHubToolCallRecord>;
138
+ /**
139
+ * Sends `text` against the active session, opening an SSE stream. Throws
140
+ * if no session is active or the request fails before the stream opens.
141
+ */
142
+ sendMessage: (text: string) => Promise<void>;
143
+ /**
144
+ * Cancels the in-flight turn via `POST /chat/{turn_id}/cancel`.
145
+ * The server-side handler calls Letta's authoritative
146
+ * `agents.messages.cancel` API (which rolls back the in-progress
147
+ * step from the conversation history while preserving completed
148
+ * steps) and signals our runner to emit `stream_end{cancelled}`.
149
+ * The client deliberately DOES NOT abort the SSE iterator — it
150
+ * waits for the genuine terminal event so the post-stream
151
+ * canonicalize sees Letta's true final state.
152
+ */
153
+ stop: () => Promise<void>;
154
+ /**
155
+ * True from the moment the user clicks Stop until the in-flight
156
+ * turn's `stream_end` lands. UI-only flag; the state machine's
157
+ * `state.status` stays `running` for the brief "Stopping…" window
158
+ * because the server is server-authoritative for that. Drives the
159
+ * button label / disabled state in `<MessageInput>`.
160
+ */
161
+ isStoppingTurn: boolean;
162
+ /**
163
+ * Text to push into the input on the next render. Set by the post-
164
+ * stream-end branch when a cancel rolled back the user's message
165
+ * (single-step cancel: Letta deletes the entire turn including the
166
+ * user message). `<MessageInput>` reads it, populates the textarea,
167
+ * and clears via `consumePendingDraft()`.
168
+ */
169
+ pendingDraft: string | null;
170
+ /**
171
+ * Atomically reads + clears `pendingDraft` — used by `<MessageInput>`
172
+ * after it copies the value into its local textarea state. Returns
173
+ * the consumed value (or null if none was pending).
174
+ */
175
+ consumePendingDraft: () => string | null;
176
+ /**
177
+ * Returned by `sendMessage` when the stream fails before any `stream_end`
178
+ * fires (network drop, unrecoverable error). Plain message for the
179
+ * `--failed` modifier — Step 10 enriches with a Retry button.
180
+ */
181
+ lastTurnError: string | null;
182
+ /** Resolved theme (`light` | `dark`) — computed per §7.6 precedence. */
183
+ theme: "light" | "dark";
184
+ /**
185
+ * Flips the theme. Optimistic; reverts on server error
186
+ * (`theme_switcher_disabled` → server returned 409).
187
+ */
188
+ setTheme: (next: "light" | "dark") => Promise<void>;
189
+ /**
190
+ * Mirror of `deployment.theme_switcher_enabled`. When false, the
191
+ * `AIHub.ThemeSwitcher` primitive renders nothing.
192
+ */
193
+ themeSwitcherEnabled: boolean;
194
+ /**
195
+ * The deployment-wide UI feature toggles fetched from public
196
+ * `GET /feature-toggles` on mount. `null` while the request is in
197
+ * flight; thereafter the wire blob (possibly empty `{}`).
198
+ *
199
+ * Consumers should not branch on individual keys directly — use
200
+ * `useAffordanceFlags()` to compute the resolved flag stack with
201
+ * precedence ("server toggle > React prop > built-in default").
202
+ *
203
+ * @see SPECIFICATIONS.md §8.4
204
+ */
205
+ featureToggles: AIHubFeatureToggles | null;
206
+ /**
207
+ * Re-fetches the toggles blob. Called by the super-admin Settings
208
+ * page (Step 12) after a save so the saving super-admin sees the
209
+ * effect without a page reload.
210
+ */
211
+ refreshFeatureToggles: () => Promise<void>;
212
+ }
213
+ /**
214
+ * The React context object. Default value is `null` — every hook checks
215
+ * for null and throws a "Wrapped in `<AIHubProvider>`?" error in dev so
216
+ * misconfiguration surfaces immediately instead of cascading null-deref
217
+ * failures in components.
218
+ */
219
+ export declare const aiHubContext: import("react").Context<AIHubContextValue | null>;
220
+ //# sourceMappingURL=AIHubContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIHubContext.d.ts","sourceRoot":"","sources":["../../src/context/AIHubContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,SAAS,EACT,OAAO,EACR,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,MAAM,EAAE,WAAW,CAAC;IAGpB,4EAA4E;IAC5E,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;I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,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD;;;OAGG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAG9B;;;;;;;;;;OAUG;IACH,cAAc,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC3C;;;;OAIG;IACH,qBAAqB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,mDAAgD,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Internal React context shared by `<AIHubProvider>` + the `useAIHub` /
3
+ * `useAIHubAuth` hooks.
4
+ *
5
+ * Kept separate from `AIHubProvider.tsx` so the hooks can import the
6
+ * context object without pulling in the provider's component tree (and
7
+ * the JSX dependencies that come with it).
8
+ *
9
+ * @see SPECIFICATIONS.md §7.2 — provider + hooks
10
+ */
11
+ import { createContext } from "react";
12
+ /**
13
+ * The React context object. Default value is `null` — every hook checks
14
+ * for null and throws a "Wrapped in `<AIHubProvider>`?" error in dev so
15
+ * misconfiguration surfaces immediately instead of cascading null-deref
16
+ * failures in components.
17
+ */
18
+ export const aiHubContext = createContext(null);
19
+ //# sourceMappingURL=AIHubContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIHubContext.js","sourceRoot":"","sources":["../../src/context/AIHubContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAuOtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * `<AIHubProvider>` — root of every ai-hub React tree.
3
+ *
4
+ * Owns:
5
+ *
6
+ * - The shared `AIHubClient` instance (consumers call SDK methods through
7
+ * `useAIHub().client`).
8
+ * - The JWT lifecycle: read from `tokenStorage` on mount, attempt `/auth/me`
9
+ * to hydrate `user` + `deployment`; clear on logout; clear and route
10
+ * back to login on any 401 from the server (§6.7 — no silent refresh).
11
+ * - The resolved theme: client-side precedence per §7.6, FOUC-avoided via
12
+ * a cached value in `localStorage` applied on first paint.
13
+ * - Per-message reasoning effort state.
14
+ * - **Step 9 — chat state:** agents catalog, active agent, sessions list,
15
+ * active session, message history, in-flight turn state (driven by the
16
+ * §10 reducer over SSE events from `client.streamChat`), `sendMessage`,
17
+ * `stop`. The state-aware affordance gates (TPM banner, theme switcher,
18
+ * tool-call card, reasoning view) layer on top in Step 10.
19
+ *
20
+ * @see SPECIFICATIONS.md §7.2 — provider props
21
+ * @see SPECIFICATIONS.md §7.5 — state on the client
22
+ * @see SPECIFICATIONS.md §7.6 — theme resolution
23
+ * @see SPECIFICATIONS.md §6.7 — auth model
24
+ */
25
+ import { type ReactNode } from "react";
26
+ import { AIHubClient, type PatchSessionOptions } from "../client/AIHubClient.js";
27
+ import type { TokenStorageMode, TokenStorage } from "../client/tokenStorage.js";
28
+ import type { AIHubError } from "../types.js";
29
+ import { type ResolvedTheme } from "./theme.js";
30
+ /**
31
+ * Public props on `<AIHubProvider>`.
32
+ *
33
+ * `defaultTheme` is overridden by the deployment's `theme_default` once
34
+ * `/auth/me` resolves (server config wins — same rule as the §8.4 toggles).
35
+ */
36
+ export interface AIHubProviderProps {
37
+ /**
38
+ * Base URL the ai-hub-server routes are mounted at. Typically
39
+ * `/api/ai-hub` in a per-customer wrapper.
40
+ */
41
+ baseUrl: string;
42
+ /** Custom `fetch`; defaults to `globalThis.fetch`. */
43
+ fetch?: typeof fetch;
44
+ /** Token storage mode or custom adapter. Defaults to `"localStorage"`. */
45
+ tokenStorage?: TokenStorageMode | TokenStorage;
46
+ /**
47
+ * Pre-built `AIHubClient`. When set, `baseUrl` / `fetch` / `tokenStorage`
48
+ * are ignored. Useful for tests that need to stub the SDK without going
49
+ * through the provider's lifecycle.
50
+ */
51
+ client?: AIHubClient;
52
+ /**
53
+ * Notification hook for top-level errors. Fired for transport and
54
+ * surfaced stream errors; not fired for normal stream `done` /
55
+ * `cancelled`. The provider does not render its own error UI.
56
+ */
57
+ onError?: (err: AIHubError) => void;
58
+ /**
59
+ * Fallback theme used when no `/auth/me` has resolved yet and the cache
60
+ * is empty. Server config (`theme_default`) wins after hydration.
61
+ */
62
+ defaultTheme?: ResolvedTheme;
63
+ /** The tree under the provider. */
64
+ children: ReactNode;
65
+ }
66
+ /**
67
+ * The provider component. Single instance per ai-hub mount — multiple
68
+ * mounts on the same page each manage their own auth state (this is the
69
+ * shape `defineWebComponent` ships).
70
+ *
71
+ * @param props - the provider props.
72
+ */
73
+ export declare function AIHubProvider(props: AIHubProviderProps): ReactNode;
74
+ export type { PatchSessionOptions };
75
+ //# sourceMappingURL=AIHubProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIHubProvider.d.ts","sourceRoot":"","sources":["../../src/context/AIHubProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,WAAW,EAGX,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAKhF,OAAO,KAAK,EAGV,UAAU,EAQX,MAAM,aAAa,CAAC;AAGrB,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AA0DpB;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,gBAAgB,GAAG,YAAY,CAAC;IAC/C;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;IACpC;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,mCAAmC;IACnC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAk5BlE;AAED,YAAY,EAAE,mBAAmB,EAAE,CAAC"}