@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.
- package/README.md +125 -0
- package/lib/boot/branding.d.ts +58 -0
- package/lib/boot/branding.d.ts.map +1 -0
- package/lib/boot/branding.js +62 -0
- package/lib/boot/branding.js.map +1 -0
- package/lib/boot/index.d.ts +27 -0
- package/lib/boot/index.d.ts.map +1 -0
- package/lib/boot/index.js +325 -0
- package/lib/boot/index.js.map +1 -0
- package/lib/boot/vite.d.ts +63 -0
- package/lib/boot/vite.d.ts.map +1 -0
- package/lib/boot/vite.js +108 -0
- package/lib/boot/vite.js.map +1 -0
- package/lib/core/components/shadcn/button.d.ts.map +1 -1
- package/lib/core/components/shadcn/button.js +1 -2
- package/lib/core/components/shadcn/button.js.map +1 -1
- package/lib/core/components/shadcn/filters/filter-styles.d.ts +1 -1
- package/lib/core/components/shadcn/filters/filter-styles.d.ts.map +1 -1
- package/lib/core/components/shadcn/filters/filter-styles.js +4 -4
- package/lib/core/components/shadcn/label.js +1 -1
- package/lib/core/components/shadcn/label.js.map +1 -1
- package/lib/env/index.d.ts +32 -1
- package/lib/env/index.d.ts.map +1 -1
- package/lib/env/index.js +55 -3
- package/lib/env/index.js.map +1 -1
- package/lib/features/agent/PayloadBuilder.d.ts +4 -0
- package/lib/features/agent/PayloadBuilder.d.ts.map +1 -1
- package/lib/features/agent/PayloadBuilder.js +6 -1
- package/lib/features/agent/PayloadBuilder.js.map +1 -1
- package/lib/features/agent/chat/AgentRunFeedback.d.ts +66 -0
- package/lib/features/agent/chat/AgentRunFeedback.d.ts.map +1 -0
- package/lib/features/agent/chat/AgentRunFeedback.js +298 -0
- package/lib/features/agent/chat/AgentRunFeedback.js.map +1 -0
- package/lib/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.js +7 -5
- package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +3 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +11 -10
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts +3 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +28 -7
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.js +2 -0
- package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.js.map +1 -1
- package/lib/features/agent/chat/hooks/useAgentPlans.d.ts +1 -1
- package/lib/features/agent/chat/hooks/useAgentPlans.d.ts.map +1 -1
- package/lib/features/agent/chat/hooks/useAgentPlans.js +5 -5
- package/lib/features/agent/chat/hooks/useAgentPlans.js.map +1 -1
- package/lib/features/agent/chat/index.d.ts +1 -0
- package/lib/features/agent/chat/index.d.ts.map +1 -1
- package/lib/features/agent/chat/index.js +1 -0
- package/lib/features/agent/chat/index.js.map +1 -1
- package/lib/features/facets/AgentRunnerFacetsNav.d.ts +8 -0
- package/lib/features/facets/AgentRunnerFacetsNav.d.ts.map +1 -1
- package/lib/features/facets/AgentRunnerFacetsNav.js +12 -0
- package/lib/features/facets/AgentRunnerFacetsNav.js.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.d.ts +15 -1
- package/lib/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.js +20 -12
- package/lib/features/permissions/UserPermissionsProvider.js.map +1 -1
- package/lib/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
- package/lib/features/store/objects/search/DocumentSearchContext.js +6 -1
- package/lib/features/store/objects/search/DocumentSearchContext.js.map +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js.map +1 -1
- package/lib/features/store/types/TypeRegistry.d.ts +130 -0
- package/lib/features/store/types/TypeRegistry.d.ts.map +1 -1
- package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts +130 -0
- package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts.map +1 -1
- package/lib/i18n/index.d.ts +5 -4
- package/lib/i18n/index.d.ts.map +1 -1
- package/lib/i18n/index.js +16 -2
- package/lib/i18n/index.js.map +1 -1
- package/lib/i18n/locales/ar.json +30 -0
- package/lib/i18n/locales/de.json +30 -0
- package/lib/i18n/locales/en.json +30 -0
- package/lib/i18n/locales/es.json +30 -0
- package/lib/i18n/locales/fr.json +30 -0
- package/lib/i18n/locales/it.json +30 -0
- package/lib/i18n/locales/ja.json +30 -0
- package/lib/i18n/locales/ko.json +30 -0
- package/lib/i18n/locales/pt.json +30 -0
- package/lib/i18n/locales/ru.json +30 -0
- package/lib/i18n/locales/tr.json +30 -0
- package/lib/i18n/locales/zh-TW.json +30 -0
- package/lib/i18n/locales/zh.json +30 -0
- package/lib/layout/ErrorPage.js +1 -1
- package/lib/layout/ErrorPage.js.map +1 -1
- package/lib/layout/Navbar.d.ts.map +1 -1
- package/lib/layout/Navbar.js +3 -2
- package/lib/layout/Navbar.js.map +1 -1
- package/lib/session/UserSession.d.ts.map +1 -1
- package/lib/session/UserSession.js +2 -3
- package/lib/session/UserSession.js.map +1 -1
- package/lib/session/UserSessionProvider.d.ts +2 -1
- package/lib/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/session/UserSessionProvider.js +13 -4
- package/lib/session/UserSessionProvider.js.map +1 -1
- package/lib/session/auth/composable.d.ts.map +1 -1
- package/lib/session/auth/composable.js +88 -3
- package/lib/session/auth/composable.js.map +1 -1
- package/lib/session/auth/domainRouting.d.ts +22 -12
- package/lib/session/auth/domainRouting.d.ts.map +1 -1
- package/lib/session/auth/domainRouting.js +35 -21
- package/lib/session/auth/domainRouting.js.map +1 -1
- package/lib/session/auth/firebase.d.ts.map +1 -1
- package/lib/session/auth/firebase.js +10 -0
- package/lib/session/auth/firebase.js.map +1 -1
- package/lib/session/auth/useAuthState.d.ts +9 -4
- package/lib/session/auth/useAuthState.d.ts.map +1 -1
- package/lib/session/auth/useAuthState.js +9 -4
- package/lib/session/auth/useAuthState.js.map +1 -1
- package/lib/session/index.d.ts.map +1 -1
- package/lib/session/index.js +3 -1
- package/lib/session/index.js.map +1 -1
- package/lib/shell/AuthScreenPreview.d.ts +12 -0
- package/lib/shell/AuthScreenPreview.d.ts.map +1 -0
- package/lib/shell/AuthScreenPreview.js +140 -0
- package/lib/shell/AuthScreenPreview.js.map +1 -0
- package/lib/shell/BrandedAuthScreens.d.ts +19 -0
- package/lib/shell/BrandedAuthScreens.d.ts.map +1 -0
- package/lib/shell/BrandedAuthScreens.js +64 -0
- package/lib/shell/BrandedAuthScreens.js.map +1 -0
- package/lib/shell/SplashScreen.d.ts +13 -2
- package/lib/shell/SplashScreen.d.ts.map +1 -1
- package/lib/shell/SplashScreen.js +20 -19
- package/lib/shell/SplashScreen.js.map +1 -1
- package/lib/shell/VertesiaShell.d.ts +15 -4
- package/lib/shell/VertesiaShell.d.ts.map +1 -1
- package/lib/shell/VertesiaShell.js +8 -3
- package/lib/shell/VertesiaShell.js.map +1 -1
- package/lib/shell/apps/StandaloneApp.js +5 -1
- package/lib/shell/apps/StandaloneApp.js.map +1 -1
- package/lib/shell/index.d.ts +6 -0
- package/lib/shell/index.d.ts.map +1 -1
- package/lib/shell/index.js +5 -0
- package/lib/shell/index.js.map +1 -1
- package/lib/shell/login/SignInAuthPending.js +1 -1
- package/lib/shell/login/SignInAuthPending.js.map +1 -1
- package/lib/shell/login/SignInEmailStep.d.ts.map +1 -1
- package/lib/shell/login/SignInEmailStep.js +2 -2
- package/lib/shell/login/SignInEmailStep.js.map +1 -1
- package/lib/shell/login/SignInFlow.d.ts +68 -0
- package/lib/shell/login/SignInFlow.d.ts.map +1 -0
- package/lib/shell/login/SignInFlow.js +108 -0
- package/lib/shell/login/SignInFlow.js.map +1 -0
- package/lib/shell/login/SignInIcons.d.ts +1 -1
- package/lib/shell/login/SignInIcons.d.ts.map +1 -1
- package/lib/shell/login/SignInPageShell.d.ts +13 -0
- package/lib/shell/login/SignInPageShell.d.ts.map +1 -0
- package/lib/shell/login/SignInPageShell.js +14 -0
- package/lib/shell/login/SignInPageShell.js.map +1 -0
- package/lib/shell/login/SignInPrimitives.d.ts +3 -3
- package/lib/shell/login/SignInPrimitives.d.ts.map +1 -1
- package/lib/shell/login/SignInPrimitives.js +13 -11
- package/lib/shell/login/SignInPrimitives.js.map +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts +5 -0
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts.map +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.js +8 -4
- package/lib/shell/login/SignInRestrictedEnvStep.js.map +1 -1
- package/lib/shell/login/SigninScreen.d.ts +38 -3
- package/lib/shell/login/SigninScreen.d.ts.map +1 -1
- package/lib/shell/login/SigninScreen.js +33 -86
- package/lib/shell/login/SigninScreen.js.map +1 -1
- package/lib/shell/login/SignupForm.d.ts +3 -1
- package/lib/shell/login/SignupForm.d.ts.map +1 -1
- package/lib/shell/login/SignupForm.js +7 -3
- package/lib/shell/login/SignupForm.js.map +1 -1
- package/lib/shell/login/signInUtils.d.ts +12 -1
- package/lib/shell/login/signInUtils.d.ts.map +1 -1
- package/lib/shell/login/signInUtils.js +34 -11
- package/lib/shell/login/signInUtils.js.map +1 -1
- package/lib/vertesia-ui-boot.js +237 -0
- package/lib/vertesia-ui-boot.js.map +1 -0
- package/lib/vertesia-ui-core.js +88 -46
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +350 -317
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.B3NFclwl.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.B3NFclwl.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BWSrNIxc.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BWSrNIxc.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BWvWeB1p.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BWvWeB1p.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BZCXvTC1.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BZCXvTC1.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BbJMvFZW.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BbJMvFZW.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CE5ldwpt.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CE5ldwpt.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CMC0IShY.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CMC0IShY.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CkcRqBKU.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CkcRqBKU.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.D-Mq1sw_.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.D-Mq1sw_.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.DkK68-A-.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.DkK68-A-.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.XE_dcCg6.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.XE_dcCg6.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.js +2 -2
- package/lib/vertesia-ui-i18n.js.map +1 -1
- package/lib/vertesia-ui-i18n.qgNqMPvK.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.qgNqMPvK.chunk.js.map +1 -0
- package/lib/vertesia-ui-layout.js +43 -19
- package/lib/vertesia-ui-layout.js.map +1 -1
- package/lib/vertesia-ui-rich-text.js +123 -74
- package/lib/vertesia-ui-rich-text.js.map +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +87 -33
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +154 -98
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/lib/widgets/xml-viewer/hooks/useCollapsible.d.ts +1 -1
- package/llms.txt +6 -2
- package/package.json +45 -36
- package/src/__tests__/a11y.test.tsx +25 -0
- package/src/__tests__/theme.test.ts +91 -0
- package/src/boot/branding.test.ts +72 -0
- package/src/boot/branding.ts +108 -0
- package/src/boot/index.test.ts +216 -0
- package/src/boot/index.ts +356 -0
- package/src/boot/vite.test.ts +93 -0
- package/src/boot/vite.ts +118 -0
- package/src/core/components/shadcn/button.tsx +1 -2
- package/src/core/components/shadcn/filters/filter-styles.ts +4 -4
- package/src/core/components/shadcn/label.tsx +1 -1
- package/src/env/index.test.ts +127 -0
- package/src/env/index.ts +73 -3
- package/src/features/agent/PayloadBuilder.tsx +10 -1
- package/src/features/agent/chat/AgentRunFeedback.test.tsx +347 -0
- package/src/features/agent/chat/AgentRunFeedback.tsx +465 -0
- package/src/features/agent/chat/ModernAgentConversation.test.tsx +1 -1
- package/src/features/agent/chat/ModernAgentConversation.tsx +52 -47
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +145 -0
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +42 -24
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +4 -0
- package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +38 -5
- package/src/features/agent/chat/ModernAgentOutput/SummaryConversation.ts +2 -0
- package/src/features/agent/chat/ModernAgentOutput/utils.test.ts +14 -0
- package/src/features/agent/chat/hooks/useAgentPlans.test.ts +52 -0
- package/src/features/agent/chat/hooks/useAgentPlans.ts +5 -5
- package/src/features/agent/chat/hooks/useFileProcessing.test.tsx +0 -5
- package/src/features/agent/chat/index.ts +6 -0
- package/src/features/facets/AgentRunnerFacetsNav.tsx +26 -0
- package/src/features/permissions/UserPermissionsProvider.test.tsx +50 -1
- package/src/features/permissions/UserPermissionsProvider.tsx +82 -44
- package/src/features/store/objects/search/DocumentSearchContext.ts +8 -3
- package/src/features/store/objects/selection/SelectionActions.tsx +4 -1
- package/src/i18n/index.tsx +25 -2
- package/src/i18n/locales/ar.json +30 -0
- package/src/i18n/locales/de.json +30 -0
- package/src/i18n/locales/en.json +30 -0
- package/src/i18n/locales/es.json +30 -0
- package/src/i18n/locales/fr.json +30 -0
- package/src/i18n/locales/it.json +30 -0
- package/src/i18n/locales/ja.json +30 -0
- package/src/i18n/locales/ko.json +30 -0
- package/src/i18n/locales/pt.json +30 -0
- package/src/i18n/locales/ru.json +30 -0
- package/src/i18n/locales/tr.json +30 -0
- package/src/i18n/locales/zh-TW.json +30 -0
- package/src/i18n/locales/zh.json +30 -0
- package/src/layout/ErrorPage.tsx +1 -1
- package/src/layout/Navbar.test.tsx +58 -0
- package/src/layout/Navbar.tsx +5 -2
- package/src/router/path.test.ts +5 -5
- package/src/session/UserSession.ts +2 -4
- package/src/session/UserSessionProvider.strict-mode.test.tsx +44 -0
- package/src/session/UserSessionProvider.test.ts +62 -1
- package/src/session/UserSessionProvider.tsx +12 -4
- package/src/session/auth/composable.renewal.test.ts +170 -0
- package/src/session/auth/composable.test.ts +23 -1
- package/src/session/auth/composable.ts +101 -2
- package/src/session/auth/domainRouting.test.ts +35 -65
- package/src/session/auth/domainRouting.ts +51 -34
- package/src/session/auth/firebase.test.ts +25 -0
- package/src/session/auth/firebase.ts +10 -0
- package/src/session/auth/useAuthState.ts +11 -4
- package/src/session/index.ts +3 -1
- package/src/shell/AuthScreenPreview.test.tsx +44 -0
- package/src/shell/AuthScreenPreview.tsx +228 -0
- package/src/shell/BrandedAuthScreens.test.tsx +181 -0
- package/src/shell/BrandedAuthScreens.tsx +117 -0
- package/src/shell/SplashScreen.test.tsx +37 -0
- package/src/shell/SplashScreen.tsx +44 -39
- package/src/shell/VertesiaShell.tsx +49 -22
- package/src/shell/apps/StandaloneApp.tsx +5 -1
- package/src/shell/index.tsx +6 -0
- package/src/shell/login/SignInAuthPending.tsx +3 -3
- package/src/shell/login/SignInEmailStep.test.tsx +32 -0
- package/src/shell/login/SignInEmailStep.tsx +13 -9
- package/src/shell/login/SignInFlow.tsx +213 -0
- package/src/shell/login/SignInPageShell.tsx +62 -0
- package/src/shell/login/SignInPrimitives.tsx +14 -11
- package/src/shell/login/SignInRestrictedEnvStep.tsx +19 -7
- package/src/shell/login/SigninScreen.test.tsx +104 -0
- package/src/shell/login/SigninScreen.tsx +115 -145
- package/src/shell/login/SignupForm.tsx +8 -3
- package/src/shell/login/signInUtils.ts +42 -9
- package/src/widgets/markdown/CollaborativeMarkdownRenderer.test.tsx +11 -3
- package/src/widgets/markdown/markdown.css +21 -21
- package/lib/vertesia-ui-i18n.BfN7iOHb.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BfN7iOHb.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.BjH2zEZw.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BjH2zEZw.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.BjSwAZXl.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BjSwAZXl.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.C7PUm5Au.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.C7PUm5Au.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.CF_1mUS5.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.CF_1mUS5.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.ChfUl3_-.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.ChfUl3_-.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.D-Sk-5d1.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.D-Sk-5d1.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.D4rnu1_S.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.D4rnu1_S.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DDf0-laK.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DDf0-laK.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DN79y06J.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DN79y06J.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DWLIciYQ.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DWLIciYQ.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DvF_YaAJ.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DvF_YaAJ.chunk.js.map +0 -1
- 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('
|
|
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
|
|
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
|
|
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' :
|
|
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
|
-
<
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
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>
|