@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,72 @@
1
+ /**
2
+ * Client-side state reducer for `AIHubState`.
3
+ *
4
+ * The ai-hub server is the authoritative source of state (§6.6, §10). Every
5
+ * SSE event carries a `state: { status, phase }` snapshot at emission time
6
+ * (§9); the client's job is to trust that snapshot and enrich it with the
7
+ * cross-event fields the UI needs to render — `last_seq` (for the resumption
8
+ * cursor), `turn_id` (from `stream_start`), `session_id`, and `tpm_retry_at`
9
+ * (the countdown deadline read from the latest `system_notice {tpm_wait}`).
10
+ *
11
+ * Because the server emits the `(status, phase)` directly on every event, the
12
+ * reducer does **not** re-derive the transitions from §10.2 — it just lifts
13
+ * the snapshot. The §10.2 arrows are tested via the cross-package SSE
14
+ * fixtures (`packages/ai-hub-server/__tests__/fixtures/sse/*.json`): each
15
+ * fixture replays the bytes the server emits and the reducer's per-event
16
+ * output is asserted to match the expected `(status, phase)` for that arrow.
17
+ *
18
+ * @see SPECIFICATIONS.md §6.6 — server-authoritative state
19
+ * @see SPECIFICATIONS.md §7.5 — state on the client
20
+ * @see SPECIFICATIONS.md §9 — wire protocol
21
+ * @see SPECIFICATIONS.md §10 — state machine
22
+ */
23
+ import type { AIHubEvent, AIHubState } from "../types.js";
24
+ /**
25
+ * The reducer's starting state, before any event has been seen.
26
+ *
27
+ * `last_seq: -1` is the convention used as the `from_seq` cursor on the
28
+ * resumption endpoint (`/chat/{turn_id}/events?from_seq=N`) — the server
29
+ * matches with `seq > N`, so `-1` replays every event from `seq: 0`
30
+ * forward (`server/routes/chat.ts`).
31
+ *
32
+ * @returns the initial state.
33
+ */
34
+ export declare function initialAIHubState(): AIHubState;
35
+ /**
36
+ * Reduces one `AIHubEvent` into the next `AIHubState`.
37
+ *
38
+ * Pure. Re-runnable. The provider replays the same event sequence on
39
+ * reconnect-by-replay and lands on the same state every time — that's the
40
+ * load-bearing property the resumption flow depends on.
41
+ *
42
+ * Behavioural notes (each maps to a §10.2 arrow or §10.3 rule, and is locked
43
+ * down by the SSE fixtures consumed in `__tests__/state/stateReducer.test.ts`):
44
+ *
45
+ * - `stream_start` → captures `turn_id` + `session_id`; clears any leftover
46
+ * `tpm_retry_at` from a previous turn (defensive; a fresh turn should
47
+ * never inherit one).
48
+ * - `system_notice {code: "tpm_wait"}` → stores `retry_at` so the TPM banner
49
+ * (Step 10) can render its countdown. The `(status, phase)` snapshot on
50
+ * the event is already `running / waiting_provider` per §10.2.
51
+ * - `system_notice {code: "resumed"}` → clears `tpm_retry_at`. Snapshot is
52
+ * back to `running / model_text` (or whatever the recovery resumes into).
53
+ * - `error` → server already emitted `(status: failed, phase: null)`; the
54
+ * reducer just lifts it and clears `tpm_retry_at` so a Retry button
55
+ * doesn't render a stale countdown.
56
+ * - `stream_end` → terminal `(status, phase)` is already on the snapshot;
57
+ * `tpm_retry_at` is cleared for the same reason as `error`.
58
+ * - All other events → `(status, phase)` + `last_seq` are lifted from the
59
+ * snapshot; nothing else changes. The §10.3 tool-error-vs-agent-error
60
+ * rule is honored entirely by the server's snapshot (a `tool_call_result`
61
+ * with an `error` field carries `phase: model_text` and `status: running`;
62
+ * only an `error` event carries `status: failed`).
63
+ *
64
+ * @param state - the previous `AIHubState`.
65
+ * @param event - the next event from the SSE stream.
66
+ * @returns the next `AIHubState`.
67
+ *
68
+ * @see SPECIFICATIONS.md §10.2 — transitions
69
+ * @see SPECIFICATIONS.md §10.3 — tool error vs. agent error
70
+ */
71
+ export declare function reduceAIHubState(state: AIHubState, event: AIHubEvent): AIHubState;
72
+ //# sourceMappingURL=stateReducer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateReducer.d.ts","sourceRoot":"","sources":["../../src/state/stateReducer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,UAAU,CAS9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,UAAU,GAChB,UAAU,CA6CZ"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Client-side state reducer for `AIHubState`.
3
+ *
4
+ * The ai-hub server is the authoritative source of state (§6.6, §10). Every
5
+ * SSE event carries a `state: { status, phase }` snapshot at emission time
6
+ * (§9); the client's job is to trust that snapshot and enrich it with the
7
+ * cross-event fields the UI needs to render — `last_seq` (for the resumption
8
+ * cursor), `turn_id` (from `stream_start`), `session_id`, and `tpm_retry_at`
9
+ * (the countdown deadline read from the latest `system_notice {tpm_wait}`).
10
+ *
11
+ * Because the server emits the `(status, phase)` directly on every event, the
12
+ * reducer does **not** re-derive the transitions from §10.2 — it just lifts
13
+ * the snapshot. The §10.2 arrows are tested via the cross-package SSE
14
+ * fixtures (`packages/ai-hub-server/__tests__/fixtures/sse/*.json`): each
15
+ * fixture replays the bytes the server emits and the reducer's per-event
16
+ * output is asserted to match the expected `(status, phase)` for that arrow.
17
+ *
18
+ * @see SPECIFICATIONS.md §6.6 — server-authoritative state
19
+ * @see SPECIFICATIONS.md §7.5 — state on the client
20
+ * @see SPECIFICATIONS.md §9 — wire protocol
21
+ * @see SPECIFICATIONS.md §10 — state machine
22
+ */
23
+ /**
24
+ * The reducer's starting state, before any event has been seen.
25
+ *
26
+ * `last_seq: -1` is the convention used as the `from_seq` cursor on the
27
+ * resumption endpoint (`/chat/{turn_id}/events?from_seq=N`) — the server
28
+ * matches with `seq > N`, so `-1` replays every event from `seq: 0`
29
+ * forward (`server/routes/chat.ts`).
30
+ *
31
+ * @returns the initial state.
32
+ */
33
+ export function initialAIHubState() {
34
+ return {
35
+ status: "idle",
36
+ phase: null,
37
+ last_seq: -1,
38
+ turn_id: null,
39
+ session_id: null,
40
+ tpm_retry_at: null,
41
+ };
42
+ }
43
+ /**
44
+ * Reduces one `AIHubEvent` into the next `AIHubState`.
45
+ *
46
+ * Pure. Re-runnable. The provider replays the same event sequence on
47
+ * reconnect-by-replay and lands on the same state every time — that's the
48
+ * load-bearing property the resumption flow depends on.
49
+ *
50
+ * Behavioural notes (each maps to a §10.2 arrow or §10.3 rule, and is locked
51
+ * down by the SSE fixtures consumed in `__tests__/state/stateReducer.test.ts`):
52
+ *
53
+ * - `stream_start` → captures `turn_id` + `session_id`; clears any leftover
54
+ * `tpm_retry_at` from a previous turn (defensive; a fresh turn should
55
+ * never inherit one).
56
+ * - `system_notice {code: "tpm_wait"}` → stores `retry_at` so the TPM banner
57
+ * (Step 10) can render its countdown. The `(status, phase)` snapshot on
58
+ * the event is already `running / waiting_provider` per §10.2.
59
+ * - `system_notice {code: "resumed"}` → clears `tpm_retry_at`. Snapshot is
60
+ * back to `running / model_text` (or whatever the recovery resumes into).
61
+ * - `error` → server already emitted `(status: failed, phase: null)`; the
62
+ * reducer just lifts it and clears `tpm_retry_at` so a Retry button
63
+ * doesn't render a stale countdown.
64
+ * - `stream_end` → terminal `(status, phase)` is already on the snapshot;
65
+ * `tpm_retry_at` is cleared for the same reason as `error`.
66
+ * - All other events → `(status, phase)` + `last_seq` are lifted from the
67
+ * snapshot; nothing else changes. The §10.3 tool-error-vs-agent-error
68
+ * rule is honored entirely by the server's snapshot (a `tool_call_result`
69
+ * with an `error` field carries `phase: model_text` and `status: running`;
70
+ * only an `error` event carries `status: failed`).
71
+ *
72
+ * @param state - the previous `AIHubState`.
73
+ * @param event - the next event from the SSE stream.
74
+ * @returns the next `AIHubState`.
75
+ *
76
+ * @see SPECIFICATIONS.md §10.2 — transitions
77
+ * @see SPECIFICATIONS.md §10.3 — tool error vs. agent error
78
+ */
79
+ export function reduceAIHubState(state, event) {
80
+ // Lift the snapshot + advance the resumption cursor. Every branch below
81
+ // refines this base value.
82
+ const next = {
83
+ ...state,
84
+ status: event.state.status,
85
+ phase: event.state.phase,
86
+ last_seq: event.seq,
87
+ };
88
+ switch (event.event) {
89
+ case "stream_start":
90
+ next.turn_id = event.data.turn_id;
91
+ next.session_id = event.data.session_id;
92
+ next.tpm_retry_at = null;
93
+ return next;
94
+ case "system_notice":
95
+ if (event.data.code === "tpm_wait") {
96
+ // `retry_at` is optional on the wire; absent → no countdown, the
97
+ // banner renders without a timer. We still keep the `waiting_provider`
98
+ // phase from the snapshot so the affordance flips.
99
+ next.tpm_retry_at = event.data.retry_at ?? null;
100
+ }
101
+ else if (event.data.code === "resumed") {
102
+ next.tpm_retry_at = null;
103
+ }
104
+ return next;
105
+ case "error":
106
+ case "stream_end":
107
+ next.tpm_retry_at = null;
108
+ return next;
109
+ case "heartbeat":
110
+ case "assistant_delta":
111
+ case "reasoning_delta":
112
+ case "assistant_message_complete":
113
+ case "tool_call_started":
114
+ case "tool_call_input_delta":
115
+ case "tool_call_dispatched":
116
+ case "tool_call_progress":
117
+ case "tool_call_result":
118
+ case "usage":
119
+ return next;
120
+ }
121
+ }
122
+ //# sourceMappingURL=stateReducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateReducer.js","sourceRoot":"","sources":["../../src/state/stateReducer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO;QACL,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,CAAC,CAAC;QACZ,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,IAAI;KACnB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAiB,EACjB,KAAiB;IAEjB,wEAAwE;IACxE,2BAA2B;IAC3B,MAAM,IAAI,GAAe;QACvB,GAAG,KAAK;QACR,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM;QAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK;QACxB,QAAQ,EAAE,KAAK,CAAC,GAAG;KACpB,CAAC;IAEF,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,KAAK,cAAc;YACjB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;YAClC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;YACxC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,OAAO,IAAI,CAAC;QAEd,KAAK,eAAe;YAClB,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gBACnC,iEAAiE;gBACjE,uEAAuE;gBACvE,mDAAmD;gBACnD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC;YAClD,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBACzC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YAC3B,CAAC;YACD,OAAO,IAAI,CAAC;QAEd,KAAK,OAAO,CAAC;QACb,KAAK,YAAY;YACf,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,OAAO,IAAI,CAAC;QAEd,KAAK,WAAW,CAAC;QACjB,KAAK,iBAAiB,CAAC;QACvB,KAAK,iBAAiB,CAAC;QACvB,KAAK,4BAA4B,CAAC;QAClC,KAAK,mBAAmB,CAAC;QACzB,KAAK,uBAAuB,CAAC;QAC7B,KAAK,sBAAsB,CAAC;QAC5B,KAAK,oBAAoB,CAAC;QAC1B,KAAK,kBAAkB,CAAC;QACxB,KAAK,OAAO;YACV,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Stories for `<EffortControl />` — reasoning-effort dropdown.
3
+ *
4
+ * @see SPECIFICATIONS.md §7.4 — reasoning effort
5
+ */
6
+ import type { Meta, StoryObj } from "@storybook/react-vite";
7
+ import { EffortControl } from "../components/EffortControl/index.js";
8
+ declare const meta: Meta<typeof EffortControl>;
9
+ export default meta;
10
+ type Story = StoryObj<typeof EffortControl>;
11
+ export declare const DefaultMedium: Story;
12
+ export declare const SetToNone: Story;
13
+ export declare const Disabled: Story;
14
+ //# sourceMappingURL=EffortControl.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EffortControl.stories.d.ts","sourceRoot":"","sources":["../../src/stories/EffortControl.stories.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAarE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAWpC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAUvB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAUtB,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { EffortControl } from "../components/EffortControl/index.js";
3
+ import { MockProvider } from "./_mockProvider.js";
4
+ function withEffort(effort) {
5
+ return (Story) => (_jsx(MockProvider, { opts: { effort }, children: _jsx(Story, {}) }));
6
+ }
7
+ const meta = {
8
+ title: "Affordances/EffortControl",
9
+ component: EffortControl,
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: "Reasoning-effort dropdown mirroring Letta's ADE enum (None | Minimal | Low | Medium | High | Extra High). Per-message; persists in provider state until changed.",
14
+ },
15
+ },
16
+ },
17
+ };
18
+ export default meta;
19
+ export const DefaultMedium = {
20
+ decorators: [withEffort("medium")],
21
+ };
22
+ export const SetToNone = {
23
+ decorators: [withEffort("none")],
24
+ parameters: {
25
+ docs: {
26
+ description: {
27
+ story: "`none` is the off-state for reasoning; there is no separate reasoning toggle.",
28
+ },
29
+ },
30
+ },
31
+ };
32
+ export const Disabled = {
33
+ decorators: [withEffort("medium")],
34
+ args: { disabled: true },
35
+ parameters: {
36
+ docs: {
37
+ description: {
38
+ story: "Disabled while a turn is streaming.",
39
+ },
40
+ },
41
+ },
42
+ };
43
+ //# sourceMappingURL=EffortControl.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EffortControl.stories.js","sourceRoot":"","sources":["../../src/stories/EffortControl.stories.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAGrE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,SAAS,UAAU,CAAC,MAAmB;IACrC,OAAO,CAAC,KAA4B,EAAE,EAAE,CAAC,CACvC,KAAC,YAAY,IAAC,IAAI,EAAE,EAAE,MAAM,EAAE,YAC5B,KAAC,KAAK,KAAG,GACI,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,IAAI,GAA+B;IACvC,KAAK,EAAE,2BAA2B;IAClC,SAAS,EAAE,aAAa;IACxB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EACP,kKAAkK;aACrK;SACF;KACF;CACF,CAAC;AACF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,aAAa,GAAU;IAClC,UAAU,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAU;IAC9B,UAAU,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,KAAK,EACH,+EAA+E;aAClF;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,UAAU,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,KAAK,EAAE,qCAAqC;aAC7C;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Stories for `<MarkdownRenderer />` — the assistant-bubble body
3
+ * renderer that turns GFM markdown (+ LaTeX-style math) into themed HTML.
4
+ *
5
+ * Each story feeds a curated chunk of markdown so designers can eyeball
6
+ * one feature at a time (paragraphs, tables, code blocks, math…) without
7
+ * having to spin up a real chat turn. The "Showcase" story stitches all
8
+ * of them together — that's the one to load when checking the renderer
9
+ * end-to-end after a CSS-token tweak.
10
+ *
11
+ * @see docs/react/markdown-rendering.md
12
+ */
13
+ import type { Meta, StoryObj } from "@storybook/react-vite";
14
+ import { MarkdownRenderer } from "../components/MarkdownRenderer/index.js";
15
+ declare const meta: Meta<typeof MarkdownRenderer>;
16
+ export default meta;
17
+ type Story = StoryObj<typeof MarkdownRenderer>;
18
+ export declare const Paragraphs: Story;
19
+ export declare const HeadingsAndLists: Story;
20
+ export declare const Tables: Story;
21
+ export declare const CodeBlocks: Story;
22
+ export declare const MathEquations: Story;
23
+ export declare const Blockquotes: Story;
24
+ export declare const Showcase: Story;
25
+ //# sourceMappingURL=MarkdownRenderer.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownRenderer.stories.d.ts","sourceRoot":"","sources":["../../src/stories/MarkdownRenderer.stories.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAWvC,CAAC;AACF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/C,eAAO,MAAM,UAAU,EAAE,KAQxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAmB9B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAkBpB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAwBxB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAoB3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAUzB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KA0DtB,CAAC"}
@@ -0,0 +1,178 @@
1
+ import { MarkdownRenderer } from "../components/MarkdownRenderer/index.js";
2
+ const meta = {
3
+ title: "Affordances/MarkdownRenderer",
4
+ component: MarkdownRenderer,
5
+ parameters: {
6
+ docs: {
7
+ description: {
8
+ component: "Renders assistant-bubble bodies as GitHub-flavored Markdown with KaTeX math. Per-customer wrappers theme it via the `--dc-aih-markdown-*` custom properties (default mappings live in `src/styles/default.css`).",
9
+ },
10
+ },
11
+ },
12
+ };
13
+ export default meta;
14
+ export const Paragraphs = {
15
+ args: {
16
+ content: [
17
+ "This is a **bold** statement with some *emphasis*, an [inline link](https://example.com), and ~~strikethrough~~ for good measure.",
18
+ "",
19
+ "Second paragraph — separated by a blank line. Inline code looks like `const x = 42;`.",
20
+ ].join("\n"),
21
+ },
22
+ };
23
+ export const HeadingsAndLists = {
24
+ args: {
25
+ content: [
26
+ "# Heading 1",
27
+ "## Heading 2",
28
+ "### Heading 3",
29
+ "",
30
+ "Unordered list:",
31
+ "- First item",
32
+ "- Second item",
33
+ " - Nested item",
34
+ "- Third item",
35
+ "",
36
+ "Ordered list:",
37
+ "1. Step one",
38
+ "2. Step two",
39
+ "3. Step three",
40
+ ].join("\n"),
41
+ },
42
+ };
43
+ export const Tables = {
44
+ args: {
45
+ content: [
46
+ "| Plan | Monthly | Annual |",
47
+ "|------|---------|--------|",
48
+ "| Starter | $9 | $90 |",
49
+ "| Pro | $29 | $290 |",
50
+ "| Enterprise | Contact us | Contact us |",
51
+ "",
52
+ "Wide tables are horizontally scrollable, so the bubble keeps its `max-width: 80%` even when the table doesn't fit:",
53
+ "",
54
+ "| Region | Q1 | Q2 | Q3 | Q4 | Total | YoY % | Notes |",
55
+ "|--------|----|----|----|----|-------|-------|-------|",
56
+ "| EMEA | 120 | 134 | 142 | 158 | 554 | +18% | Growth driven by DACH region |",
57
+ "| APAC | 87 | 95 | 110 | 121 | 413 | +24% | Strong tailwind from JP launches |",
58
+ "| Americas | 210 | 215 | 219 | 240 | 884 | +6% | Mature market, steady |",
59
+ ].join("\n"),
60
+ },
61
+ };
62
+ export const CodeBlocks = {
63
+ args: {
64
+ content: [
65
+ "Here's a TypeScript snippet:",
66
+ "",
67
+ "```ts",
68
+ "function greet(name: string): string {",
69
+ " return `Hello, ${name}!`;",
70
+ "}",
71
+ "",
72
+ "const message = greet('world');",
73
+ "console.log(message);",
74
+ "```",
75
+ "",
76
+ "And a Python one:",
77
+ "",
78
+ "```python",
79
+ "def fibonacci(n: int) -> int:",
80
+ " if n < 2:",
81
+ " return n",
82
+ " return fibonacci(n - 1) + fibonacci(n - 2)",
83
+ "```",
84
+ ].join("\n"),
85
+ },
86
+ };
87
+ export const MathEquations = {
88
+ args: {
89
+ content: [
90
+ "Inline math: the Pythagorean identity is $a^2 + b^2 = c^2$.",
91
+ "",
92
+ "Block math:",
93
+ "",
94
+ "$$",
95
+ "\\int_0^\\infty e^{-x^2} \\, dx = \\frac{\\sqrt{\\pi}}{2}",
96
+ "$$",
97
+ "",
98
+ "The quadratic formula:",
99
+ "",
100
+ "$$",
101
+ "x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}",
102
+ "$$",
103
+ "",
104
+ "Euler's identity, $e^{i\\pi} + 1 = 0$, links five fundamental constants.",
105
+ ].join("\n"),
106
+ },
107
+ };
108
+ export const Blockquotes = {
109
+ args: {
110
+ content: [
111
+ "> This is a blockquote. It's typically used to highlight a quote, an aside, or a callout from another source.",
112
+ ">",
113
+ "> Multi-paragraph quotes work too.",
114
+ "",
115
+ "Back to regular text.",
116
+ ].join("\n"),
117
+ },
118
+ };
119
+ export const Showcase = {
120
+ args: {
121
+ content: [
122
+ "# Markdown showcase",
123
+ "",
124
+ "This story renders every feature the chat supports — use it as a regression sanity-check after touching `--dc-aih-markdown-*` tokens.",
125
+ "",
126
+ "## Inline formatting",
127
+ "",
128
+ "Mix of **bold**, *italic*, `inline code`, [a link](https://example.com), and ~~strikethrough~~.",
129
+ "",
130
+ "## Lists",
131
+ "",
132
+ "- Apples",
133
+ "- Oranges",
134
+ " - Mandarins",
135
+ " - Clementines",
136
+ "- Bananas",
137
+ "",
138
+ "1. Mise en place",
139
+ "2. Sauté the aromatics",
140
+ "3. Simmer until thickened",
141
+ "",
142
+ "## Tables",
143
+ "",
144
+ "| Customer | MRR | Tier |",
145
+ "|----------|-----|------|",
146
+ "| Acme Co. | $9,400 | Enterprise |",
147
+ "| Globex | $2,100 | Pro |",
148
+ "| Initech | $290 | Starter |",
149
+ "",
150
+ "## Code",
151
+ "",
152
+ "```ts",
153
+ "export function sum(xs: number[]): number {",
154
+ " return xs.reduce((a, b) => a + b, 0);",
155
+ "}",
156
+ "```",
157
+ "",
158
+ "## Math",
159
+ "",
160
+ "The sum of the first $n$ natural numbers is",
161
+ "",
162
+ "$$",
163
+ "\\sum_{k=1}^{n} k = \\frac{n(n+1)}{2}.",
164
+ "$$",
165
+ "",
166
+ "## Blockquote",
167
+ "",
168
+ "> The best way to predict the future is to invent it.",
169
+ ">",
170
+ "> — Alan Kay",
171
+ "",
172
+ "---",
173
+ "",
174
+ "End of showcase.",
175
+ ].join("\n"),
176
+ },
177
+ };
178
+ //# sourceMappingURL=MarkdownRenderer.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownRenderer.stories.js","sourceRoot":"","sources":["../../src/stories/MarkdownRenderer.stories.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Stories for the message-bubble variants emitted by `<MessageList />`.
3
+ *
4
+ * The bubble is not a separate primitive — it's the inner element of
5
+ * `MessageList`. Each story mounts a full `<MessageList />` under a
6
+ * `MockProvider` whose `messages` array + reducer `state` produces the
7
+ * variant under inspection (user / assistant / system / tool / failed
8
+ * assistant / cancelled assistant).
9
+ *
10
+ * @see SPECIFICATIONS.md §7.3 — message bubble variants
11
+ * @see ui-sketches/03-chat.md
12
+ */
13
+ import type { Meta, StoryObj } from "@storybook/react-vite";
14
+ import { MessageList } from "../components/MessageList/index.js";
15
+ declare const meta: Meta<typeof MessageList>;
16
+ export default meta;
17
+ type Story = StoryObj<typeof MessageList>;
18
+ export declare const Mixed_AllVariants: Story;
19
+ export declare const FailedAssistant: Story;
20
+ export declare const CancelledAssistant: Story;
21
+ //# sourceMappingURL=MessageBubble.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageBubble.stories.d.ts","sourceRoot":"","sources":["../../src/stories/MessageBubble.stories.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AA2CjE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAWlC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,iBAAiB,EAAE,KAE/B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAW7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAUhC,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MessageList } from "../components/MessageList/index.js";
3
+ import { MockProvider } from "./_mockProvider.js";
4
+ function msg(id, role, content) {
5
+ return {
6
+ id,
7
+ role,
8
+ content,
9
+ created_at: "2026-05-13T12:00:00.000Z",
10
+ };
11
+ }
12
+ function withProvider(opts) {
13
+ return (Story) => (_jsx(MockProvider, { opts: { activeSessionId: "s-mock", ...opts }, children: _jsx("div", { style: { height: "32rem", display: "flex" }, children: _jsx(Story, {}) }) }));
14
+ }
15
+ const HISTORY = [
16
+ msg("m1", "user", "Why did my last turn fail?"),
17
+ msg("m2", "assistant", "Looking at the logs, the upstream provider returned a 429 and we exhausted the retry budget."),
18
+ msg("m3", "system", "Notice: deployment-wide TPM recovery is configured for 5 retries with 30s backoff."),
19
+ msg("m4", "tool", "search_docs → 3 results returned"),
20
+ ];
21
+ const meta = {
22
+ title: "Affordances/MessageBubble",
23
+ component: MessageList,
24
+ parameters: {
25
+ docs: {
26
+ description: {
27
+ component: "Each story mounts `<MessageList />` with a curated `messages` array + reducer state so the resulting DOM shows one of the six bubble variants (user / assistant / system / tool / failed assistant / cancelled assistant).",
28
+ },
29
+ },
30
+ },
31
+ };
32
+ export default meta;
33
+ export const Mixed_AllVariants = {
34
+ decorators: [withProvider({ status: "idle", messages: HISTORY })],
35
+ };
36
+ export const FailedAssistant = {
37
+ decorators: [
38
+ withProvider({
39
+ status: "failed",
40
+ lastTurnError: "Stream failed: upstream provider unavailable.",
41
+ messages: [
42
+ msg("m1", "user", "Summarize the last release."),
43
+ msg("m2", "assistant", "Sure, here's what I have so far —"),
44
+ ],
45
+ }),
46
+ ],
47
+ };
48
+ export const CancelledAssistant = {
49
+ decorators: [
50
+ withProvider({
51
+ status: "cancelled",
52
+ messages: [
53
+ msg("m1", "user", "Run a long simulation."),
54
+ msg("m2", "assistant", "Starting the simulation now…"),
55
+ ],
56
+ }),
57
+ ],
58
+ };
59
+ //# sourceMappingURL=MessageBubble.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageBubble.stories.js","sourceRoot":"","sources":["../../src/stories/MessageBubble.stories.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAGjE,OAAO,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAC;AAEzE,SAAS,GAAG,CACV,EAAU,EACV,IAA0B,EAC1B,OAAe;IAEf,OAAO;QACL,EAAE;QACF,IAAI;QACJ,OAAO;QACP,UAAU,EAAE,0BAA0B;KACvC,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,IAAsB;IAC1C,OAAO,CAAC,KAA4B,EAAE,EAAE,CAAC,CACvC,KAAC,YAAY,IAAC,IAAI,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,YACxD,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAC9C,KAAC,KAAK,KAAG,GACL,GACO,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,GAAmB;IAC9B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,4BAA4B,CAAC;IAC/C,GAAG,CACD,IAAI,EACJ,WAAW,EACX,8FAA8F,CAC/F;IACD,GAAG,CACD,IAAI,EACJ,QAAQ,EACR,oFAAoF,CACrF;IACD,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,kCAAkC,CAAC;CACtD,CAAC;AAEF,MAAM,IAAI,GAA6B;IACrC,KAAK,EAAE,2BAA2B;IAClC,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EACP,4NAA4N;aAC/N;SACF;KACF;CACF,CAAC;AACF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,iBAAiB,GAAU;IACtC,UAAU,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAU;IACpC,UAAU,EAAE;QACV,YAAY,CAAC;YACX,MAAM,EAAE,QAAQ;YAChB,aAAa,EAAE,+CAA+C;YAC9D,QAAQ,EAAE;gBACR,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,6BAA6B,CAAC;gBAChD,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,mCAAmC,CAAC;aAC5D;SACF,CAAC;KACH;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAU;IACvC,UAAU,EAAE;QACV,YAAY,CAAC;YACX,MAAM,EAAE,WAAW;YACnB,QAAQ,EAAE;gBACR,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,wBAAwB,CAAC;gBAC3C,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,8BAA8B,CAAC;aACvD;SACF,CAAC;KACH;CACF,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Stories for `<ReasoningView />` — collapsible reasoning block inside
3
+ * an assistant bubble.
4
+ *
5
+ * Pure presentational primitive (no context needed).
6
+ *
7
+ * @see SPECIFICATIONS.md §7.3 — showReasoning prop
8
+ */
9
+ import type { Meta, StoryObj } from "@storybook/react-vite";
10
+ import { ReasoningView } from "../components/ReasoningView/index.js";
11
+ declare const meta: Meta<typeof ReasoningView>;
12
+ export default meta;
13
+ type Story = StoryObj<typeof ReasoningView>;
14
+ export declare const Collapsed: Story;
15
+ export declare const Expanded: Story;
16
+ export declare const Streaming: Story;
17
+ export declare const WithDuration: Story;
18
+ //# sourceMappingURL=ReasoningView.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReasoningView.stories.d.ts","sourceRoot":"","sources":["../../src/stories/ReasoningView.stories.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AASrE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAWpC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,eAAO,MAAM,SAAS,EAAE,KAMvB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAcvB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAa1B,CAAC"}