@vertesia/ui 1.5.0 → 1.6.0-dev.20260918.061604Z

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 (336) hide show
  1. package/README.md +125 -0
  2. package/lib/boot/branding.d.ts +58 -0
  3. package/lib/boot/branding.d.ts.map +1 -0
  4. package/lib/boot/branding.js +62 -0
  5. package/lib/boot/branding.js.map +1 -0
  6. package/lib/boot/index.d.ts +27 -0
  7. package/lib/boot/index.d.ts.map +1 -0
  8. package/lib/boot/index.js +325 -0
  9. package/lib/boot/index.js.map +1 -0
  10. package/lib/boot/vite.d.ts +63 -0
  11. package/lib/boot/vite.d.ts.map +1 -0
  12. package/lib/boot/vite.js +108 -0
  13. package/lib/boot/vite.js.map +1 -0
  14. package/lib/core/components/shadcn/button.d.ts.map +1 -1
  15. package/lib/core/components/shadcn/button.js +1 -2
  16. package/lib/core/components/shadcn/button.js.map +1 -1
  17. package/lib/core/components/shadcn/filters/filter-styles.d.ts +1 -1
  18. package/lib/core/components/shadcn/filters/filter-styles.d.ts.map +1 -1
  19. package/lib/core/components/shadcn/filters/filter-styles.js +4 -4
  20. package/lib/core/components/shadcn/label.js +1 -1
  21. package/lib/core/components/shadcn/label.js.map +1 -1
  22. package/lib/env/index.d.ts +32 -1
  23. package/lib/env/index.d.ts.map +1 -1
  24. package/lib/env/index.js +55 -3
  25. package/lib/env/index.js.map +1 -1
  26. package/lib/features/agent/PayloadBuilder.d.ts +4 -0
  27. package/lib/features/agent/PayloadBuilder.d.ts.map +1 -1
  28. package/lib/features/agent/PayloadBuilder.js +6 -1
  29. package/lib/features/agent/PayloadBuilder.js.map +1 -1
  30. package/lib/features/agent/chat/AgentRunFeedback.d.ts +66 -0
  31. package/lib/features/agent/chat/AgentRunFeedback.d.ts.map +1 -0
  32. package/lib/features/agent/chat/AgentRunFeedback.js +298 -0
  33. package/lib/features/agent/chat/AgentRunFeedback.js.map +1 -0
  34. package/lib/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
  35. package/lib/features/agent/chat/ModernAgentConversation.js +7 -5
  36. package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
  37. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +3 -1
  38. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
  39. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +11 -10
  40. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
  41. package/lib/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
  42. package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  43. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts +3 -1
  44. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
  45. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +28 -7
  46. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
  47. package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.d.ts.map +1 -1
  48. package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.js +2 -0
  49. package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.js.map +1 -1
  50. package/lib/features/agent/chat/hooks/useAgentPlans.d.ts +1 -1
  51. package/lib/features/agent/chat/hooks/useAgentPlans.d.ts.map +1 -1
  52. package/lib/features/agent/chat/hooks/useAgentPlans.js +5 -5
  53. package/lib/features/agent/chat/hooks/useAgentPlans.js.map +1 -1
  54. package/lib/features/agent/chat/index.d.ts +1 -0
  55. package/lib/features/agent/chat/index.d.ts.map +1 -1
  56. package/lib/features/agent/chat/index.js +1 -0
  57. package/lib/features/agent/chat/index.js.map +1 -1
  58. package/lib/features/facets/AgentRunnerFacetsNav.d.ts +8 -0
  59. package/lib/features/facets/AgentRunnerFacetsNav.d.ts.map +1 -1
  60. package/lib/features/facets/AgentRunnerFacetsNav.js +12 -0
  61. package/lib/features/facets/AgentRunnerFacetsNav.js.map +1 -1
  62. package/lib/features/permissions/UserPermissionsProvider.d.ts +15 -1
  63. package/lib/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
  64. package/lib/features/permissions/UserPermissionsProvider.js +20 -12
  65. package/lib/features/permissions/UserPermissionsProvider.js.map +1 -1
  66. package/lib/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
  67. package/lib/features/store/objects/search/DocumentSearchContext.js +6 -1
  68. package/lib/features/store/objects/search/DocumentSearchContext.js.map +1 -1
  69. package/lib/features/store/objects/selection/SelectionActions.js +1 -1
  70. package/lib/features/store/objects/selection/SelectionActions.js.map +1 -1
  71. package/lib/features/store/types/TypeRegistry.d.ts +130 -0
  72. package/lib/features/store/types/TypeRegistry.d.ts.map +1 -1
  73. package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts +130 -0
  74. package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts.map +1 -1
  75. package/lib/i18n/index.d.ts +5 -4
  76. package/lib/i18n/index.d.ts.map +1 -1
  77. package/lib/i18n/index.js +16 -2
  78. package/lib/i18n/index.js.map +1 -1
  79. package/lib/i18n/locales/ar.json +30 -0
  80. package/lib/i18n/locales/de.json +30 -0
  81. package/lib/i18n/locales/en.json +30 -0
  82. package/lib/i18n/locales/es.json +30 -0
  83. package/lib/i18n/locales/fr.json +30 -0
  84. package/lib/i18n/locales/it.json +30 -0
  85. package/lib/i18n/locales/ja.json +30 -0
  86. package/lib/i18n/locales/ko.json +30 -0
  87. package/lib/i18n/locales/pt.json +30 -0
  88. package/lib/i18n/locales/ru.json +30 -0
  89. package/lib/i18n/locales/tr.json +30 -0
  90. package/lib/i18n/locales/zh-TW.json +30 -0
  91. package/lib/i18n/locales/zh.json +30 -0
  92. package/lib/layout/ErrorPage.js +1 -1
  93. package/lib/layout/ErrorPage.js.map +1 -1
  94. package/lib/layout/Navbar.d.ts.map +1 -1
  95. package/lib/layout/Navbar.js +3 -2
  96. package/lib/layout/Navbar.js.map +1 -1
  97. package/lib/session/UserSession.d.ts.map +1 -1
  98. package/lib/session/UserSession.js +2 -3
  99. package/lib/session/UserSession.js.map +1 -1
  100. package/lib/session/UserSessionProvider.d.ts +2 -1
  101. package/lib/session/UserSessionProvider.d.ts.map +1 -1
  102. package/lib/session/UserSessionProvider.js +13 -4
  103. package/lib/session/UserSessionProvider.js.map +1 -1
  104. package/lib/session/auth/composable.d.ts.map +1 -1
  105. package/lib/session/auth/composable.js +88 -3
  106. package/lib/session/auth/composable.js.map +1 -1
  107. package/lib/session/auth/domainRouting.d.ts +22 -12
  108. package/lib/session/auth/domainRouting.d.ts.map +1 -1
  109. package/lib/session/auth/domainRouting.js +35 -21
  110. package/lib/session/auth/domainRouting.js.map +1 -1
  111. package/lib/session/auth/firebase.d.ts.map +1 -1
  112. package/lib/session/auth/firebase.js +10 -0
  113. package/lib/session/auth/firebase.js.map +1 -1
  114. package/lib/session/auth/useAuthState.d.ts +9 -4
  115. package/lib/session/auth/useAuthState.d.ts.map +1 -1
  116. package/lib/session/auth/useAuthState.js +9 -4
  117. package/lib/session/auth/useAuthState.js.map +1 -1
  118. package/lib/session/index.d.ts.map +1 -1
  119. package/lib/session/index.js +3 -1
  120. package/lib/session/index.js.map +1 -1
  121. package/lib/shell/AuthScreenPreview.d.ts +12 -0
  122. package/lib/shell/AuthScreenPreview.d.ts.map +1 -0
  123. package/lib/shell/AuthScreenPreview.js +140 -0
  124. package/lib/shell/AuthScreenPreview.js.map +1 -0
  125. package/lib/shell/BrandedAuthScreens.d.ts +19 -0
  126. package/lib/shell/BrandedAuthScreens.d.ts.map +1 -0
  127. package/lib/shell/BrandedAuthScreens.js +64 -0
  128. package/lib/shell/BrandedAuthScreens.js.map +1 -0
  129. package/lib/shell/SplashScreen.d.ts +13 -2
  130. package/lib/shell/SplashScreen.d.ts.map +1 -1
  131. package/lib/shell/SplashScreen.js +20 -19
  132. package/lib/shell/SplashScreen.js.map +1 -1
  133. package/lib/shell/VertesiaShell.d.ts +15 -4
  134. package/lib/shell/VertesiaShell.d.ts.map +1 -1
  135. package/lib/shell/VertesiaShell.js +8 -3
  136. package/lib/shell/VertesiaShell.js.map +1 -1
  137. package/lib/shell/apps/StandaloneApp.js +5 -1
  138. package/lib/shell/apps/StandaloneApp.js.map +1 -1
  139. package/lib/shell/index.d.ts +6 -0
  140. package/lib/shell/index.d.ts.map +1 -1
  141. package/lib/shell/index.js +5 -0
  142. package/lib/shell/index.js.map +1 -1
  143. package/lib/shell/login/SignInAuthPending.js +1 -1
  144. package/lib/shell/login/SignInAuthPending.js.map +1 -1
  145. package/lib/shell/login/SignInEmailStep.d.ts.map +1 -1
  146. package/lib/shell/login/SignInEmailStep.js +2 -2
  147. package/lib/shell/login/SignInEmailStep.js.map +1 -1
  148. package/lib/shell/login/SignInFlow.d.ts +68 -0
  149. package/lib/shell/login/SignInFlow.d.ts.map +1 -0
  150. package/lib/shell/login/SignInFlow.js +108 -0
  151. package/lib/shell/login/SignInFlow.js.map +1 -0
  152. package/lib/shell/login/SignInIcons.d.ts +1 -1
  153. package/lib/shell/login/SignInIcons.d.ts.map +1 -1
  154. package/lib/shell/login/SignInPageShell.d.ts +13 -0
  155. package/lib/shell/login/SignInPageShell.d.ts.map +1 -0
  156. package/lib/shell/login/SignInPageShell.js +14 -0
  157. package/lib/shell/login/SignInPageShell.js.map +1 -0
  158. package/lib/shell/login/SignInPrimitives.d.ts +3 -3
  159. package/lib/shell/login/SignInPrimitives.d.ts.map +1 -1
  160. package/lib/shell/login/SignInPrimitives.js +13 -11
  161. package/lib/shell/login/SignInPrimitives.js.map +1 -1
  162. package/lib/shell/login/SignInRestrictedEnvStep.d.ts +5 -0
  163. package/lib/shell/login/SignInRestrictedEnvStep.d.ts.map +1 -1
  164. package/lib/shell/login/SignInRestrictedEnvStep.js +8 -4
  165. package/lib/shell/login/SignInRestrictedEnvStep.js.map +1 -1
  166. package/lib/shell/login/SigninScreen.d.ts +38 -3
  167. package/lib/shell/login/SigninScreen.d.ts.map +1 -1
  168. package/lib/shell/login/SigninScreen.js +33 -86
  169. package/lib/shell/login/SigninScreen.js.map +1 -1
  170. package/lib/shell/login/SignupForm.d.ts +3 -1
  171. package/lib/shell/login/SignupForm.d.ts.map +1 -1
  172. package/lib/shell/login/SignupForm.js +7 -3
  173. package/lib/shell/login/SignupForm.js.map +1 -1
  174. package/lib/shell/login/signInUtils.d.ts +12 -1
  175. package/lib/shell/login/signInUtils.d.ts.map +1 -1
  176. package/lib/shell/login/signInUtils.js +34 -11
  177. package/lib/shell/login/signInUtils.js.map +1 -1
  178. package/lib/vertesia-ui-boot.js +237 -0
  179. package/lib/vertesia-ui-boot.js.map +1 -0
  180. package/lib/vertesia-ui-core.js +88 -46
  181. package/lib/vertesia-ui-core.js.map +1 -1
  182. package/lib/vertesia-ui-env.js +1 -1
  183. package/lib/vertesia-ui-env.js.map +1 -1
  184. package/lib/vertesia-ui-features.js +350 -317
  185. package/lib/vertesia-ui-features.js.map +1 -1
  186. package/lib/vertesia-ui-i18n.B3NFclwl.chunk.js +5 -0
  187. package/lib/vertesia-ui-i18n.B3NFclwl.chunk.js.map +1 -0
  188. package/lib/vertesia-ui-i18n.BWSrNIxc.chunk.js +5 -0
  189. package/lib/vertesia-ui-i18n.BWSrNIxc.chunk.js.map +1 -0
  190. package/lib/vertesia-ui-i18n.BWvWeB1p.chunk.js +5 -0
  191. package/lib/vertesia-ui-i18n.BWvWeB1p.chunk.js.map +1 -0
  192. package/lib/vertesia-ui-i18n.BZCXvTC1.chunk.js +5 -0
  193. package/lib/vertesia-ui-i18n.BZCXvTC1.chunk.js.map +1 -0
  194. package/lib/vertesia-ui-i18n.BbJMvFZW.chunk.js +5 -0
  195. package/lib/vertesia-ui-i18n.BbJMvFZW.chunk.js.map +1 -0
  196. package/lib/vertesia-ui-i18n.CE5ldwpt.chunk.js +5 -0
  197. package/lib/vertesia-ui-i18n.CE5ldwpt.chunk.js.map +1 -0
  198. package/lib/vertesia-ui-i18n.CMC0IShY.chunk.js +5 -0
  199. package/lib/vertesia-ui-i18n.CMC0IShY.chunk.js.map +1 -0
  200. package/lib/vertesia-ui-i18n.CkcRqBKU.chunk.js +5 -0
  201. package/lib/vertesia-ui-i18n.CkcRqBKU.chunk.js.map +1 -0
  202. package/lib/vertesia-ui-i18n.D-Mq1sw_.chunk.js +5 -0
  203. package/lib/vertesia-ui-i18n.D-Mq1sw_.chunk.js.map +1 -0
  204. package/lib/vertesia-ui-i18n.DkK68-A-.chunk.js +5 -0
  205. package/lib/vertesia-ui-i18n.DkK68-A-.chunk.js.map +1 -0
  206. package/lib/vertesia-ui-i18n.XE_dcCg6.chunk.js +5 -0
  207. package/lib/vertesia-ui-i18n.XE_dcCg6.chunk.js.map +1 -0
  208. package/lib/vertesia-ui-i18n.js +2 -2
  209. package/lib/vertesia-ui-i18n.js.map +1 -1
  210. package/lib/vertesia-ui-i18n.qgNqMPvK.chunk.js +5 -0
  211. package/lib/vertesia-ui-i18n.qgNqMPvK.chunk.js.map +1 -0
  212. package/lib/vertesia-ui-layout.js +43 -19
  213. package/lib/vertesia-ui-layout.js.map +1 -1
  214. package/lib/vertesia-ui-rich-text.js +123 -74
  215. package/lib/vertesia-ui-rich-text.js.map +1 -1
  216. package/lib/vertesia-ui-router.js.map +1 -1
  217. package/lib/vertesia-ui-session.js +1 -1
  218. package/lib/vertesia-ui-session.js.map +1 -1
  219. package/lib/vertesia-ui-shell.js +87 -33
  220. package/lib/vertesia-ui-shell.js.map +1 -1
  221. package/lib/vertesia-ui-widgets.js +154 -98
  222. package/lib/vertesia-ui-widgets.js.map +1 -1
  223. package/lib/widgets/xml-viewer/hooks/useCollapsible.d.ts +1 -1
  224. package/llms.txt +6 -2
  225. package/package.json +45 -36
  226. package/src/__tests__/a11y.test.tsx +25 -0
  227. package/src/__tests__/theme.test.ts +91 -0
  228. package/src/boot/branding.test.ts +72 -0
  229. package/src/boot/branding.ts +108 -0
  230. package/src/boot/index.test.ts +216 -0
  231. package/src/boot/index.ts +356 -0
  232. package/src/boot/vite.test.ts +93 -0
  233. package/src/boot/vite.ts +118 -0
  234. package/src/core/components/shadcn/button.tsx +1 -2
  235. package/src/core/components/shadcn/filters/filter-styles.ts +4 -4
  236. package/src/core/components/shadcn/label.tsx +1 -1
  237. package/src/env/index.test.ts +127 -0
  238. package/src/env/index.ts +73 -3
  239. package/src/features/agent/PayloadBuilder.tsx +10 -1
  240. package/src/features/agent/chat/AgentRunFeedback.test.tsx +347 -0
  241. package/src/features/agent/chat/AgentRunFeedback.tsx +465 -0
  242. package/src/features/agent/chat/ModernAgentConversation.test.tsx +1 -1
  243. package/src/features/agent/chat/ModernAgentConversation.tsx +52 -47
  244. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +145 -0
  245. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +42 -24
  246. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +4 -0
  247. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +38 -5
  248. package/src/features/agent/chat/ModernAgentOutput/SummaryConversation.ts +2 -0
  249. package/src/features/agent/chat/ModernAgentOutput/utils.test.ts +14 -0
  250. package/src/features/agent/chat/hooks/useAgentPlans.test.ts +52 -0
  251. package/src/features/agent/chat/hooks/useAgentPlans.ts +5 -5
  252. package/src/features/agent/chat/hooks/useFileProcessing.test.tsx +0 -5
  253. package/src/features/agent/chat/index.ts +6 -0
  254. package/src/features/facets/AgentRunnerFacetsNav.tsx +26 -0
  255. package/src/features/permissions/UserPermissionsProvider.test.tsx +50 -1
  256. package/src/features/permissions/UserPermissionsProvider.tsx +82 -44
  257. package/src/features/store/objects/search/DocumentSearchContext.ts +8 -3
  258. package/src/features/store/objects/selection/SelectionActions.tsx +4 -1
  259. package/src/i18n/index.tsx +25 -2
  260. package/src/i18n/locales/ar.json +30 -0
  261. package/src/i18n/locales/de.json +30 -0
  262. package/src/i18n/locales/en.json +30 -0
  263. package/src/i18n/locales/es.json +30 -0
  264. package/src/i18n/locales/fr.json +30 -0
  265. package/src/i18n/locales/it.json +30 -0
  266. package/src/i18n/locales/ja.json +30 -0
  267. package/src/i18n/locales/ko.json +30 -0
  268. package/src/i18n/locales/pt.json +30 -0
  269. package/src/i18n/locales/ru.json +30 -0
  270. package/src/i18n/locales/tr.json +30 -0
  271. package/src/i18n/locales/zh-TW.json +30 -0
  272. package/src/i18n/locales/zh.json +30 -0
  273. package/src/layout/ErrorPage.tsx +1 -1
  274. package/src/layout/Navbar.test.tsx +58 -0
  275. package/src/layout/Navbar.tsx +5 -2
  276. package/src/router/path.test.ts +5 -5
  277. package/src/session/UserSession.ts +2 -4
  278. package/src/session/UserSessionProvider.strict-mode.test.tsx +44 -0
  279. package/src/session/UserSessionProvider.test.ts +62 -1
  280. package/src/session/UserSessionProvider.tsx +12 -4
  281. package/src/session/auth/composable.renewal.test.ts +170 -0
  282. package/src/session/auth/composable.test.ts +23 -1
  283. package/src/session/auth/composable.ts +101 -2
  284. package/src/session/auth/domainRouting.test.ts +35 -65
  285. package/src/session/auth/domainRouting.ts +51 -34
  286. package/src/session/auth/firebase.test.ts +25 -0
  287. package/src/session/auth/firebase.ts +10 -0
  288. package/src/session/auth/useAuthState.ts +11 -4
  289. package/src/session/index.ts +3 -1
  290. package/src/shell/AuthScreenPreview.test.tsx +44 -0
  291. package/src/shell/AuthScreenPreview.tsx +228 -0
  292. package/src/shell/BrandedAuthScreens.test.tsx +181 -0
  293. package/src/shell/BrandedAuthScreens.tsx +117 -0
  294. package/src/shell/SplashScreen.test.tsx +37 -0
  295. package/src/shell/SplashScreen.tsx +44 -39
  296. package/src/shell/VertesiaShell.tsx +49 -22
  297. package/src/shell/apps/StandaloneApp.tsx +5 -1
  298. package/src/shell/index.tsx +6 -0
  299. package/src/shell/login/SignInAuthPending.tsx +3 -3
  300. package/src/shell/login/SignInEmailStep.test.tsx +32 -0
  301. package/src/shell/login/SignInEmailStep.tsx +13 -9
  302. package/src/shell/login/SignInFlow.tsx +213 -0
  303. package/src/shell/login/SignInPageShell.tsx +62 -0
  304. package/src/shell/login/SignInPrimitives.tsx +14 -11
  305. package/src/shell/login/SignInRestrictedEnvStep.tsx +19 -7
  306. package/src/shell/login/SigninScreen.test.tsx +104 -0
  307. package/src/shell/login/SigninScreen.tsx +115 -145
  308. package/src/shell/login/SignupForm.tsx +8 -3
  309. package/src/shell/login/signInUtils.ts +42 -9
  310. package/src/widgets/markdown/CollaborativeMarkdownRenderer.test.tsx +11 -3
  311. package/src/widgets/markdown/markdown.css +21 -21
  312. package/lib/vertesia-ui-i18n.BfN7iOHb.chunk.js +0 -5
  313. package/lib/vertesia-ui-i18n.BfN7iOHb.chunk.js.map +0 -1
  314. package/lib/vertesia-ui-i18n.BjH2zEZw.chunk.js +0 -5
  315. package/lib/vertesia-ui-i18n.BjH2zEZw.chunk.js.map +0 -1
  316. package/lib/vertesia-ui-i18n.BjSwAZXl.chunk.js +0 -5
  317. package/lib/vertesia-ui-i18n.BjSwAZXl.chunk.js.map +0 -1
  318. package/lib/vertesia-ui-i18n.C7PUm5Au.chunk.js +0 -5
  319. package/lib/vertesia-ui-i18n.C7PUm5Au.chunk.js.map +0 -1
  320. package/lib/vertesia-ui-i18n.CF_1mUS5.chunk.js +0 -5
  321. package/lib/vertesia-ui-i18n.CF_1mUS5.chunk.js.map +0 -1
  322. package/lib/vertesia-ui-i18n.ChfUl3_-.chunk.js +0 -5
  323. package/lib/vertesia-ui-i18n.ChfUl3_-.chunk.js.map +0 -1
  324. package/lib/vertesia-ui-i18n.D-Sk-5d1.chunk.js +0 -5
  325. package/lib/vertesia-ui-i18n.D-Sk-5d1.chunk.js.map +0 -1
  326. package/lib/vertesia-ui-i18n.D4rnu1_S.chunk.js +0 -5
  327. package/lib/vertesia-ui-i18n.D4rnu1_S.chunk.js.map +0 -1
  328. package/lib/vertesia-ui-i18n.DDf0-laK.chunk.js +0 -5
  329. package/lib/vertesia-ui-i18n.DDf0-laK.chunk.js.map +0 -1
  330. package/lib/vertesia-ui-i18n.DN79y06J.chunk.js +0 -5
  331. package/lib/vertesia-ui-i18n.DN79y06J.chunk.js.map +0 -1
  332. package/lib/vertesia-ui-i18n.DWLIciYQ.chunk.js +0 -5
  333. package/lib/vertesia-ui-i18n.DWLIciYQ.chunk.js.map +0 -1
  334. package/lib/vertesia-ui-i18n.DvF_YaAJ.chunk.js +0 -5
  335. package/lib/vertesia-ui-i18n.DvF_YaAJ.chunk.js.map +0 -1
  336. package/src/session/auth/authState.test.ts +0 -35
@@ -0,0 +1,465 @@
1
+ import {
2
+ AGENT_RUN_FEEDBACK_COMMENT_MAX_LENGTH,
3
+ type AgentMessage,
4
+ AgentMessageType,
5
+ type AgentRunFeedbackEntry,
6
+ type AgentRunFeedbackPayload,
7
+ type AgentRunFeedbackRating,
8
+ type AgentRunFeedbackReasonCode,
9
+ type AgentRunFeedbackStatus,
10
+ } from '@vertesia/common';
11
+ import {
12
+ Button,
13
+ cn,
14
+ FormItem,
15
+ Modal,
16
+ ModalBody,
17
+ ModalFooter,
18
+ ModalTitle,
19
+ SelectBox,
20
+ Textarea,
21
+ useToast,
22
+ VTooltip,
23
+ } from '@vertesia/ui/core';
24
+ import { useUITranslation } from '@vertesia/ui/i18n';
25
+ import { useUserSession } from '@vertesia/ui/session';
26
+ import { ThumbsDown, ThumbsUp } from 'lucide-react';
27
+ import { createContext, type ReactNode, useContext, useEffect, useMemo, useRef, useState } from 'react';
28
+
29
+ /**
30
+ * Which rating each reason code belongs to.
31
+ *
32
+ * Written as a `Record` over the published enum on purpose: adding a code to
33
+ * `AgentRunFeedbackReasonCode` breaks this file until someone decides where it belongs, so the
34
+ * picker can never silently stop offering a code the API accepts. `other` is offered on both sides.
35
+ */
36
+ const REASON_CODE_RATINGS: Record<AgentRunFeedbackReasonCode, readonly AgentRunFeedbackRating[]> = {
37
+ accurate: ['up'],
38
+ helpful: ['up'],
39
+ fast: ['up'],
40
+ well_explained: ['up'],
41
+ wrong_result: ['down'],
42
+ incomplete: ['down'],
43
+ misunderstood_request: ['down'],
44
+ too_slow: ['down'],
45
+ tool_failure: ['down'],
46
+ unsafe_action: ['down'],
47
+ other: ['up', 'down'],
48
+ };
49
+
50
+ const REASON_CODES = Object.keys(REASON_CODE_RATINGS) as AgentRunFeedbackReasonCode[];
51
+
52
+ export function agentRunFeedbackReasonCodes(rating: AgentRunFeedbackRating): AgentRunFeedbackReasonCode[] {
53
+ return REASON_CODES.filter((code) => REASON_CODE_RATINGS[code].includes(rating));
54
+ }
55
+
56
+ /**
57
+ * Opaque identifier of one message inside its run, used as the feedback `message_id`. Agent
58
+ * messages carry no id of their own; the workstream plus the timestamp is what the transcript
59
+ * itself keys on.
60
+ */
61
+ export function agentMessageFeedbackId(message: Pick<AgentMessage, 'workstream_id' | 'timestamp'>): string {
62
+ return `${message.workstream_id || 'main'}:${message.timestamp}`;
63
+ }
64
+
65
+ /**
66
+ * Whether a transcript message can carry a rating. Only a final answer can: while an answer is
67
+ * still streaming, the transcript shows a placeholder stamped with the browser clock, and a
68
+ * rating keyed to that timestamp would never match the answer the worker eventually posts, so
69
+ * the same answer would end up rated twice.
70
+ */
71
+ export function isAgentMessageRatable(message: Pick<AgentMessage, 'type' | 'details'>): boolean {
72
+ if (message.type !== AgentMessageType.ANSWER) return false;
73
+ const details = message.details as { source?: unknown } | undefined;
74
+ return details?.source !== 'streaming_summary';
75
+ }
76
+
77
+ /** Idempotency key for one submission; the server counts a retried id once. */
78
+ function newFeedbackId(): string {
79
+ if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) return crypto.randomUUID();
80
+ return `fb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
81
+ }
82
+
83
+ /** `recorded` and `replaced` both mean the rating is in; only `disabled` is a non-outcome. */
84
+ function isAccepted(status: AgentRunFeedbackStatus): boolean {
85
+ return status === 'recorded' || status === 'replaced';
86
+ }
87
+
88
+ /** The subject of one rating: the run as a whole, or one message of it. */
89
+ interface FeedbackScope {
90
+ agentRunId: string;
91
+ messageId?: string;
92
+ messageSeq?: number;
93
+ }
94
+
95
+ function scopeKeyOf({ agentRunId, messageId, messageSeq }: FeedbackScope): string {
96
+ return `${agentRunId}|${messageId ?? ''}|${messageSeq ?? ''}`;
97
+ }
98
+
99
+ function entryScopeKey(agentRunId: string, entry: Pick<AgentRunFeedbackEntry, 'message_id' | 'message_seq'>): string {
100
+ return scopeKeyOf({ agentRunId, messageId: entry.message_id, messageSeq: entry.message_seq });
101
+ }
102
+
103
+ /**
104
+ * The stored rating of the current user for every scope of one run, read once from the run
105
+ * document so a reload shows the thumbs where they were left.
106
+ *
107
+ * `null` while the run has not been read yet, so a control can tell "nothing recorded" from
108
+ * "not known yet".
109
+ */
110
+ interface AgentRunFeedbackHydration {
111
+ agentRunId: string;
112
+ ratingFor(scope: FeedbackScope): AgentRunFeedbackRating | undefined;
113
+ /** A rating this session just recorded, so a remounted control shows it without a refetch. */
114
+ remember(scope: FeedbackScope, rating: AgentRunFeedbackRating): void;
115
+ }
116
+
117
+ const AgentRunFeedbackContext = createContext<AgentRunFeedbackHydration | null>(null);
118
+
119
+ /**
120
+ * The server stores the rater as a principal ref (`user:<id>`), the same string the auth layer
121
+ * builds from the token: `user_id` when the token carries one, else `sub`.
122
+ */
123
+ function currentPrincipalRef(user: { sub?: string; user_id?: string } | undefined): string | undefined {
124
+ const id = user?.user_id ?? user?.sub;
125
+ return id ? `user:${id}` : undefined;
126
+ }
127
+
128
+ /**
129
+ * The current user's active rating per scope. A replaced entry is history; among the rest the
130
+ * latest `rated_at` wins, which is also what the server's one-vote-per-scope rule keeps.
131
+ */
132
+ export function activeRatingsByScope(
133
+ agentRunId: string,
134
+ entries: readonly AgentRunFeedbackEntry[] | undefined,
135
+ principalRef: string | undefined,
136
+ ): Map<string, AgentRunFeedbackRating> {
137
+ const latest = new Map<string, AgentRunFeedbackEntry>();
138
+ if (!principalRef) return new Map();
139
+ for (const entry of entries ?? []) {
140
+ if (entry.user_id !== principalRef || entry.replaced_at) continue;
141
+ const key = entryScopeKey(agentRunId, entry);
142
+ const seen = latest.get(key);
143
+ if (!seen || seen.rated_at < entry.rated_at) latest.set(key, entry);
144
+ }
145
+ return new Map(Array.from(latest, ([key, entry]) => [key, entry.rating]));
146
+ }
147
+
148
+ /**
149
+ * Loads the ratings the current user already gave on `agentRunId` and hands them to every
150
+ * {@link AgentRunFeedback} rendered underneath, so the thumbs survive a reload of the
151
+ * conversation. One read per run, however many messages carry a control.
152
+ *
153
+ * Without a provider the controls still work; they just start blank.
154
+ */
155
+ export function AgentRunFeedbackProvider({ agentRunId, children }: { agentRunId: string; children: ReactNode }) {
156
+ const { client, user } = useUserSession();
157
+ const principalRef = currentPrincipalRef(user);
158
+ const [loaded, setLoaded] = useState<{ agentRunId: string; ratings: Map<string, AgentRunFeedbackRating> }>();
159
+ const [remembered, setRemembered] = useState<Map<string, AgentRunFeedbackRating>>(() => new Map());
160
+ // Read through a ref: the run is re-read when the run or the user changes, not whenever the
161
+ // session hands out a new client object.
162
+ const clientRef = useRef(client);
163
+ clientRef.current = client;
164
+
165
+ useEffect(() => {
166
+ let cancelled = false;
167
+ // The run document carries the retained entries; a failure here only costs the hydration,
168
+ // never the ability to rate.
169
+ clientRef.current.agents
170
+ .retrieve(agentRunId)
171
+ .then((run) => {
172
+ if (cancelled) return;
173
+ setLoaded({ agentRunId, ratings: activeRatingsByScope(agentRunId, run.feedback, principalRef) });
174
+ })
175
+ .catch(() => {
176
+ if (!cancelled) setLoaded({ agentRunId, ratings: new Map() });
177
+ });
178
+ return () => {
179
+ cancelled = true;
180
+ };
181
+ }, [agentRunId, principalRef]);
182
+
183
+ const value = useMemo<AgentRunFeedbackHydration>(
184
+ () => ({
185
+ agentRunId,
186
+ ratingFor: (scope) => {
187
+ const key = scopeKeyOf(scope);
188
+ return remembered.get(key) ?? (loaded?.agentRunId === agentRunId ? loaded.ratings.get(key) : undefined);
189
+ },
190
+ remember: (scope, rating) => {
191
+ setRemembered((previous) => new Map(previous).set(scopeKeyOf(scope), rating));
192
+ },
193
+ }),
194
+ [agentRunId, loaded, remembered],
195
+ );
196
+
197
+ return <AgentRunFeedbackContext.Provider value={value}>{children}</AgentRunFeedbackContext.Provider>;
198
+ }
199
+
200
+ export interface AgentRunFeedbackProps {
201
+ /** The run being rated. */
202
+ agentRunId: string;
203
+ /** Rate one message rather than the run as a whole. */
204
+ messageId?: string;
205
+ /** Position of the rated message in the run. Sent alongside or instead of `messageId`. */
206
+ messageSeq?: number;
207
+ /** `compact` matches the icon-button sizing used by the conversation header's compact variant. */
208
+ variant?: 'full' | 'compact';
209
+ /** `inline` fades the control until the pointer is over the message it belongs to. */
210
+ tone?: 'default' | 'inline';
211
+ className?: string;
212
+ /** Called after every accepted round trip, with what the server said it did with the rating. */
213
+ onRecorded?: (payload: AgentRunFeedbackPayload, status: AgentRunFeedbackStatus) => void;
214
+ }
215
+
216
+ /**
217
+ * Thumbs up / thumbs down on an agent run.
218
+ *
219
+ * The click records the rating on its own, immediately — that is the signal being collected, and
220
+ * making the user fill a form first would cost most of it. Nothing opens on its own: once the
221
+ * rating is in, a quiet "Tell us more" link appears next to the thumbs, and only that opens the
222
+ * detail dialog for the reason code and an optional comment. Submitting it sends a revision of the
223
+ * same rating, which the server supersedes the first one with.
224
+ *
225
+ * Every submission carries a fresh `feedback_id`: it is the server's idempotency key, so a retried
226
+ * request cannot count twice, and a second vote by the same user on the same scope replaces the
227
+ * first (`replaced`) rather than adding to it. Both `recorded` and `replaced` mean the rating is in.
228
+ *
229
+ * The outcome is read from the response's `status`, not from the HTTP code: a deployment that does
230
+ * not collect ratings answers 200 with `disabled` and has counted nothing. Saying "thanks" there
231
+ * would be a lie, so the control says the rating was not recorded and stops offering itself.
232
+ */
233
+ export function AgentRunFeedback({
234
+ agentRunId,
235
+ messageId,
236
+ messageSeq,
237
+ variant = 'full',
238
+ tone = 'default',
239
+ className,
240
+ onRecorded,
241
+ }: AgentRunFeedbackProps) {
242
+ const { t } = useUITranslation();
243
+ const { client } = useUserSession();
244
+ const toast = useToast();
245
+ const hydration = useContext(AgentRunFeedbackContext);
246
+ const [ownRating, setOwnRating] = useState<AgentRunFeedbackRating>();
247
+ // What this session recorded wins over what the run document said at load time; a stored
248
+ // rating from a previous session fills in when nothing was clicked here yet.
249
+ const rating =
250
+ ownRating ??
251
+ (hydration?.agentRunId === agentRunId ? hydration.ratingFor({ agentRunId, messageId, messageSeq }) : undefined);
252
+ const [pendingRating, setPendingRating] = useState<AgentRunFeedbackRating>();
253
+ const [isUnavailable, setIsUnavailable] = useState(false);
254
+ const [isDetailOpen, setIsDetailOpen] = useState(false);
255
+ const [isSubmittingDetail, setIsSubmittingDetail] = useState(false);
256
+ const [reasonCode, setReasonCode] = useState<AgentRunFeedbackReasonCode>();
257
+ const [comment, setComment] = useState('');
258
+
259
+ const scope = messageId !== undefined || messageSeq !== undefined ? 'message' : 'run';
260
+
261
+ /**
262
+ * The subject this control is rating. Every piece of state below belongs to it and to nothing
263
+ * else, so when it changes they all have to go.
264
+ *
265
+ * Without this the component kept its rating, its reason code, its comment and its open dialog
266
+ * across a switch to a different run: the previous conversation's thumb stayed lit on the new
267
+ * one, and submitting a dialog left open across the switch sent the old comment against the new
268
+ * run's id — `send` reads `agentRunId` at call time, so the request went to the new run
269
+ * carrying text written about the old one. A parent that remounts per run hid it; the component
270
+ * is exported from `@vertesia/ui` and cannot assume one does.
271
+ *
272
+ * Reset during render, which is React's documented way to adjust state when a prop changes: it
273
+ * re-renders before committing, so nothing paints with the stale value the way a `useEffect`
274
+ * reset would.
275
+ */
276
+ const scopeKey = `${agentRunId}|${messageId ?? ''}|${messageSeq ?? ''}`;
277
+ const [lastScopeKey, setLastScopeKey] = useState(scopeKey);
278
+ const currentScopeKey = useRef(scopeKey);
279
+ if (lastScopeKey !== scopeKey) {
280
+ setLastScopeKey(scopeKey);
281
+ currentScopeKey.current = scopeKey;
282
+ setOwnRating(undefined);
283
+ setPendingRating(undefined);
284
+ setIsDetailOpen(false);
285
+ setIsSubmittingDetail(false);
286
+ setReasonCode(undefined);
287
+ setComment('');
288
+ // `isUnavailable` is NOT reset: `disabled` is a property of the deployment, not of the run,
289
+ // so a control that has already learned the pipeline is off stays hidden rather than
290
+ // re-offering itself on every switch and collecting clicks nothing records.
291
+ }
292
+
293
+ const send = async (
294
+ value: AgentRunFeedbackRating,
295
+ detail: boolean,
296
+ ): Promise<AgentRunFeedbackStatus | undefined> => {
297
+ const payload: AgentRunFeedbackPayload = {
298
+ feedback_id: newFeedbackId(),
299
+ rating: value,
300
+ ...(detail && reasonCode !== undefined ? { reason_code: reasonCode } : {}),
301
+ ...(detail && comment.trim().length > 0 ? { comment: comment.trim() } : {}),
302
+ ...(messageId !== undefined ? { message_id: messageId } : {}),
303
+ ...(messageSeq !== undefined ? { message_seq: messageSeq } : {}),
304
+ };
305
+ // Captured before the await: a response that lands after the user has moved to another run
306
+ // describes a subject this control is no longer showing, and applying it would light a
307
+ // thumb for a rating given somewhere else.
308
+ const sentScopeKey = scopeKey;
309
+ try {
310
+ const response = await client.agents.recordFeedback(agentRunId, payload);
311
+ if (sentScopeKey !== currentScopeKey.current) return undefined;
312
+ if (isAccepted(response.status)) {
313
+ onRecorded?.(payload, response.status);
314
+ setOwnRating(value);
315
+ hydration?.remember({ agentRunId, messageId, messageSeq }, value);
316
+ return response.status;
317
+ }
318
+ // `disabled` means this deployment collects no ratings; there is nothing to retry, so
319
+ // the control removes itself rather than inviting a second useless click.
320
+ setIsUnavailable(response.status === 'disabled');
321
+ toast({
322
+ status: 'info',
323
+ title: t('agent.feedback.notRecorded'),
324
+ description: t(`agent.feedback.status.${response.status}`),
325
+ duration: 4000,
326
+ });
327
+ return response.status;
328
+ } catch (error: unknown) {
329
+ if (sentScopeKey !== currentScopeKey.current) return undefined;
330
+ toast({
331
+ status: 'error',
332
+ title: t('agent.feedback.failed'),
333
+ description: error instanceof Error ? error.message : String(error),
334
+ duration: 4000,
335
+ });
336
+ return undefined;
337
+ }
338
+ };
339
+
340
+ const handleRate = async (value: AgentRunFeedbackRating) => {
341
+ if (pendingRating) return;
342
+ setPendingRating(value);
343
+ try {
344
+ await send(value, false);
345
+ } finally {
346
+ setPendingRating(undefined);
347
+ }
348
+ };
349
+
350
+ const openDetail = () => {
351
+ if (!rating) return;
352
+ setIsDetailOpen(true);
353
+ };
354
+
355
+ const handleSubmitDetail = async () => {
356
+ if (!rating) return;
357
+ setIsSubmittingDetail(true);
358
+ try {
359
+ const status = await send(rating, true);
360
+ if (status && isAccepted(status)) {
361
+ setIsDetailOpen(false);
362
+ toast({ status: 'success', title: t('agent.feedback.thanks'), duration: 2000 });
363
+ }
364
+ } finally {
365
+ setIsSubmittingDetail(false);
366
+ }
367
+ };
368
+
369
+ if (isUnavailable) return null;
370
+
371
+ const isCompact = variant === 'compact';
372
+ const upLabel = scope === 'message' ? t('agent.feedback.rateMessageUp') : t('agent.feedback.rateRunUp');
373
+ const downLabel = scope === 'message' ? t('agent.feedback.rateMessageDown') : t('agent.feedback.rateRunDown');
374
+
375
+ const thumb = (value: AgentRunFeedbackRating, label: string, Icon: typeof ThumbsUp) => (
376
+ <VTooltip description={label} asChild>
377
+ <Button
378
+ type="button"
379
+ variant="ghost"
380
+ size={isCompact ? 'icon' : 'xs'}
381
+ aria-label={label}
382
+ aria-pressed={rating === value}
383
+ disabled={pendingRating !== undefined}
384
+ onClick={() => void handleRate(value)}
385
+ className={cn(
386
+ 'transition-colors duration-200 rounded-md',
387
+ isCompact && 'size-8 rounded-lg',
388
+ rating === value && (value === 'up' ? 'text-success' : 'text-destructive'),
389
+ )}
390
+ >
391
+ <Icon className="size-4" />
392
+ </Button>
393
+ </VTooltip>
394
+ );
395
+
396
+ return (
397
+ <div
398
+ className={cn(
399
+ 'flex items-center gap-0.5',
400
+ // Inline under an answer the control should not compete with the text: it sits
401
+ // faded until the pointer is over the message, and stays visible once a rating is
402
+ // in so the user can find "Tell us more" again.
403
+ tone === 'inline' &&
404
+ !rating &&
405
+ 'opacity-40 transition-opacity duration-200 group-hover:opacity-100 focus-within:opacity-100',
406
+ className,
407
+ )}
408
+ >
409
+ {thumb('up', upLabel, ThumbsUp)}
410
+ {thumb('down', downLabel, ThumbsDown)}
411
+ {rating && !isDetailOpen && (
412
+ <Button
413
+ type="button"
414
+ variant="ghost"
415
+ size="xs"
416
+ onClick={openDetail}
417
+ className="ms-1 text-xs text-muted hover:text-foreground"
418
+ >
419
+ {t('agent.feedback.tellUsMore')}
420
+ </Button>
421
+ )}
422
+ <Modal isOpen={isDetailOpen} onClose={() => setIsDetailOpen(false)} size="md" disableCloseOnClickOutside>
423
+ <ModalTitle>{t('agent.feedback.detailTitle')}</ModalTitle>
424
+ <ModalBody>
425
+ <div className="flex flex-col gap-4">
426
+ <p className="text-sm text-muted">{t('agent.feedback.detailHelp')}</p>
427
+ <FormItem label={t('agent.feedback.reasonLabel')}>
428
+ <SelectBox<AgentRunFeedbackReasonCode>
429
+ options={rating ? agentRunFeedbackReasonCodes(rating) : []}
430
+ value={reasonCode}
431
+ onChange={setReasonCode}
432
+ optionLabel={(code) => t(`agent.feedback.reason.${code}`)}
433
+ placeholder={t('agent.feedback.reasonPlaceholder')}
434
+ aria-label={t('agent.feedback.reasonLabel')}
435
+ isClearable
436
+ />
437
+ </FormItem>
438
+ <FormItem label={t('agent.feedback.commentLabel')} helpText={t('agent.feedback.commentHelp')}>
439
+ <Textarea
440
+ value={comment}
441
+ onChange={(e) => setComment(e.target.value)}
442
+ maxLength={AGENT_RUN_FEEDBACK_COMMENT_MAX_LENGTH}
443
+ minLines={3}
444
+ maxLines={8}
445
+ placeholder={t('agent.feedback.commentPlaceholder')}
446
+ />
447
+ </FormItem>
448
+ </div>
449
+ </ModalBody>
450
+ <ModalFooter>
451
+ <Button variant="ghost" onClick={() => setIsDetailOpen(false)} disabled={isSubmittingDetail}>
452
+ {t('agent.feedback.skip')}
453
+ </Button>
454
+ <Button
455
+ onClick={() => void handleSubmitDetail()}
456
+ isLoading={isSubmittingDetail}
457
+ disabled={isSubmittingDetail || (reasonCode === undefined && comment.trim().length === 0)}
458
+ >
459
+ {t('agent.feedback.submit')}
460
+ </Button>
461
+ </ModalFooter>
462
+ </Modal>
463
+ </div>
464
+ );
465
+ }
@@ -1278,7 +1278,7 @@ describe('ModernAgentConversation send handling', () => {
1278
1278
  expect.objectContaining({ workstream_id: 'beta', status: 'running' }),
1279
1279
  expect.objectContaining({ workstream_id: 'gamma', status: 'completed' }),
1280
1280
  ]);
1281
- expect(latestRightPanelProps.activeTab).toBe('plan');
1281
+ expect(latestRightPanelProps.activeTab).toBe('workstreams');
1282
1282
  expect(latestMessageInputProps.activeTaskCount).toBe(2);
1283
1283
  expect(latestMessageInputProps.activeWorkstreams).toEqual([
1284
1284
  expect.objectContaining({ workstream_id: 'alpha', status: 'running' }),
@@ -45,6 +45,7 @@ import { AgentApprovalModeSelector } from './AgentApprovalModeSelector';
45
45
  import { AgentChatPlaybackControls } from './AgentChatPlaybackControls';
46
46
  import { AgentRequestInputOverlay } from './AgentRequestInputOverlay';
47
47
  import { AgentRightPanel, type WorkstreamInfo } from './AgentRightPanel.js';
48
+ import { AgentRunFeedbackProvider } from './AgentRunFeedback';
48
49
  import { AnimatedThinkingDots, PulsatingCircle } from './AnimatedThinkingDots';
49
50
  import { extractFilesFromClipboard } from './clipboardFiles.js';
50
51
  import { useAgentPlans } from './hooks/useAgentPlans.js';
@@ -1229,7 +1230,7 @@ function StartWorkflowView({
1229
1230
  >
1230
1231
  {/* Drag overlay for full-panel file drop */}
1231
1232
  {canStageFiles && isDragOver && (
1232
- <div className="absolute inset-0 flex items-center justify-center bg-info-background z-50 pointer-events-none rounded-lg">
1233
+ <div className="absolute inset-0 flex items-center justify-center bg-info z-50 pointer-events-none rounded-lg">
1233
1234
  <div className="text-info font-medium flex items-center gap-2 text-lg">
1234
1235
  <UploadIcon className="size-6" />
1235
1236
  Drop files to stage for upload
@@ -1553,7 +1554,7 @@ function ModernAgentConversationInner({
1553
1554
  showInput,
1554
1555
  showSlidingPanel,
1555
1556
  setShowSlidingPanel,
1556
- } = useAgentPlans(messages, interactive, isModal);
1557
+ } = useAgentPlans(messages, interactive);
1557
1558
 
1558
1559
  const {
1559
1560
  openDocuments,
@@ -1937,9 +1938,10 @@ function ModernAgentConversationInner({
1937
1938
  // Unified right panel state
1938
1939
  // ────────────────────────────────────────────
1939
1940
  type RightPanelTab = 'plan' | 'workstreams' | 'documents' | 'uploads' | 'artifacts' | 'payload' | 'conversation';
1940
- const [rightPanelTab, setRightPanelTab] = useState<RightPanelTab>(
1941
- conversationContent || conversationTab ? 'conversation' : 'plan',
1941
+ const [rightPanelTab, setRightPanelTab] = useState<RightPanelTab | undefined>(
1942
+ conversationContent || conversationTab ? 'conversation' : undefined,
1942
1943
  );
1944
+ const defaultRightPanelTab = plans.length > 0 || panelWorkstreams.length === 0 ? 'plan' : 'workstreams';
1943
1945
  const [selectedArtifactPath, setSelectedArtifactPath] = useState<string | null>(null);
1944
1946
  const [rightPanelWidth, setRightPanelWidth] = useState(400);
1945
1947
  const [isRightPanelResizing, setIsRightPanelResizing] = useState(false);
@@ -2808,47 +2810,50 @@ function ModernAgentConversationInner({
2808
2810
  {messages.length === 0 && !effectiveIsCompleted && pendingStartMessage && pendingStartTimestamp ? (
2809
2811
  <PendingStartConversation message={pendingStartMessage} startedAt={pendingStartTimestamp} />
2810
2812
  ) : (
2811
- <AllMessagesMixed
2812
- messages={renderedMessages}
2813
- workstreamSourceMessages={renderedWorkstreamSourceMessages}
2814
- bottomRef={bottomRef as React.RefObject<HTMLDivElement>}
2815
- isCompleted={displayedIsCompleted}
2816
- plan={getActivePlan.plan}
2817
- workstreamStatus={getActivePlan.workstreamStatus}
2818
- showPlanPanel={showRightPanelProp && showSlidingPanel}
2819
- onTogglePlanPanel={handleTogglePlanPanel}
2820
- plans={plans}
2821
- activePlanIndex={activePlanIndex}
2822
- onChangePlan={handleChangePlan}
2823
- taskLabels={taskLabels}
2824
- streamingMessages={displayedStreamingMessages}
2825
- onSendMessage={isPlaybackLive ? handleSendMessage : undefined}
2826
- onOpenArtifact={showArtifacts ? handleOpenArtifact : undefined}
2827
- messageItemClassNames={messageItemClassNames}
2828
- messageStyleOverrides={messageStyleOverrides}
2829
- toolCallGroupClassNames={toolCallGroupClassNames}
2830
- hideToolCallsInViewMode={hideToolCallsInViewMode}
2831
- streamingMessageClassNames={streamingMessageClassNames}
2832
- batchProgressPanelClassNames={batchProgressPanelClassNames}
2833
- artifactRunId={agentRunId}
2834
- viewMode={viewMode}
2835
- hideWorkstreamTabs={hideWorkstreamTabs}
2836
- workingIndicatorClassName={workingIndicatorClassName}
2837
- messageListClassName={messageListClassName}
2838
- StoreLinkComponent={effectiveStoreLinkComponent}
2839
- CollectionLinkComponent={CollectionLinkComponent}
2840
- prependFriendlyMessage={prependFriendlyMessage}
2841
- initialRequestData={initialRequestData}
2842
- initialRequestSchema={initialRequestSchema}
2843
- initialRequestTitle={initialRequestTitle}
2844
- initialRequestTemplate={initialRequestTemplate}
2845
- showInitialRequest={initialHistoryStatus === 'empty' && messages.length === 0}
2846
- hiddenMessageTypes={hiddenMessageTypes}
2847
- disableAutoScroll={!isPlaybackLive}
2848
- renderRequestInputControls={!shouldShowRequestInputOverlay}
2849
- activeWorkstream={activeWorkstream}
2850
- onActiveWorkstreamChange={setActiveWorkstream}
2851
- />
2813
+ <AgentRunFeedbackProvider agentRunId={agentRunId}>
2814
+ <AllMessagesMixed
2815
+ messages={renderedMessages}
2816
+ workstreamSourceMessages={renderedWorkstreamSourceMessages}
2817
+ bottomRef={bottomRef as React.RefObject<HTMLDivElement>}
2818
+ isCompleted={displayedIsCompleted}
2819
+ plan={getActivePlan.plan}
2820
+ workstreamStatus={getActivePlan.workstreamStatus}
2821
+ showPlanPanel={showRightPanelProp && showSlidingPanel}
2822
+ onTogglePlanPanel={handleTogglePlanPanel}
2823
+ plans={plans}
2824
+ activePlanIndex={activePlanIndex}
2825
+ onChangePlan={handleChangePlan}
2826
+ taskLabels={taskLabels}
2827
+ streamingMessages={displayedStreamingMessages}
2828
+ onSendMessage={isPlaybackLive ? handleSendMessage : undefined}
2829
+ onOpenArtifact={showArtifacts ? handleOpenArtifact : undefined}
2830
+ messageItemClassNames={messageItemClassNames}
2831
+ messageStyleOverrides={messageStyleOverrides}
2832
+ toolCallGroupClassNames={toolCallGroupClassNames}
2833
+ hideToolCallsInViewMode={hideToolCallsInViewMode}
2834
+ streamingMessageClassNames={streamingMessageClassNames}
2835
+ batchProgressPanelClassNames={batchProgressPanelClassNames}
2836
+ artifactRunId={agentRunId}
2837
+ agentRunId={agentRunId}
2838
+ viewMode={viewMode}
2839
+ hideWorkstreamTabs={hideWorkstreamTabs}
2840
+ workingIndicatorClassName={workingIndicatorClassName}
2841
+ messageListClassName={messageListClassName}
2842
+ StoreLinkComponent={effectiveStoreLinkComponent}
2843
+ CollectionLinkComponent={CollectionLinkComponent}
2844
+ prependFriendlyMessage={prependFriendlyMessage}
2845
+ initialRequestData={initialRequestData}
2846
+ initialRequestSchema={initialRequestSchema}
2847
+ initialRequestTitle={initialRequestTitle}
2848
+ initialRequestTemplate={initialRequestTemplate}
2849
+ showInitialRequest={initialHistoryStatus === 'empty' && messages.length === 0}
2850
+ hiddenMessageTypes={hiddenMessageTypes}
2851
+ disableAutoScroll={!isPlaybackLive}
2852
+ renderRequestInputControls={!shouldShowRequestInputOverlay}
2853
+ activeWorkstream={activeWorkstream}
2854
+ onActiveWorkstreamChange={setActiveWorkstream}
2855
+ />
2856
+ </AgentRunFeedbackProvider>
2852
2857
  )}
2853
2858
 
2854
2859
  {shouldShowRequestInputOverlay ? (
@@ -3081,8 +3086,8 @@ function ModernAgentConversationInner({
3081
3086
  conversationContent={conversationTab ? conversationAreaJsx : conversationContent}
3082
3087
  // Panel control
3083
3088
  onClose={handleCloseRightPanel}
3084
- defaultTab={rightPanelTab}
3085
- activeTab={rightPanelTab}
3089
+ defaultTab={rightPanelTab ?? defaultRightPanelTab}
3090
+ activeTab={rightPanelTab ?? defaultRightPanelTab}
3086
3091
  onTabChange={setRightPanelTab}
3087
3092
  />
3088
3093
  </div>