AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
refactor(frontend): delete the classic layout and serve the sidebar layout to everyone (#15106)
Abhimanyu Yadav9e09da8757cd
diff --git a/autogpt_platform/backend/backend/api/features/feature_flags/routes_test.py b/autogpt_platform/backend/backend/api/features/feature_flags/routes_test.pyindex ce80adbe8f..c7d5712a6a 100644--- a/autogpt_platform/backend/backend/api/features/feature_flags/routes_test.py+++ b/autogpt_platform/backend/backend/api/features/feature_flags/routes_test.py@@ -38,7 +38,7 @@ VISITOR = "0b6c1f3e-visitor-0001"USER_ID = "3f2b8c1e-7a4d-4e9b-9c2a-5d6e7f8a9b0c"PINNING = FrontendFlag.CHAT_PINNING.valueHIRE_EXPERTS = FrontendFlag.HIRE_EXPERTS.value-CHAT_SEARCH = FrontendFlag.CHAT_SEARCH.value+PROGRESS_BAR = FrontendFlag.TASK_PROGRESS_BAR.valueSTREAM_SHADOW = FrontendFlag.COPILOT_STREAM_SHADOW.valueapp = fastapi.FastAPI()@@ -125,7 +125,7 @@ async def test_a_flag_the_vendor_has_no_definition_of_is_answered_null():# Null serves the page's default now; left out, the page would wait for good.assert (- flags.get(CHAT_SEARCH, "left out"),+ flags.get(PROGRESS_BAR, "left out"),flags.get(STREAM_SHADOW, "left out"),flags[HIRE_EXPERTS],) == (None, None, True)@@ -143,7 +143,7 @@ async def test_a_defined_flag_the_vendor_could_not_answer_is_left_out(mocker):flags = (await _get_flags(USER_ID))["flags"]# A default here would read as an answer and 404 a gated route for a user who has it.- assert (HIRE_EXPERTS in flags, flags.get(CHAT_SEARCH, "left out")) == (False, None)+ assert (HIRE_EXPERTS in flags, flags.get(PROGRESS_BAR, "left out")) == (False, None)@pytest.mark.parametrize("ready_first", [False, True])@@ -228,7 +228,7 @@ async def test_a_signed_in_read_asks_posthog_nothing_about_flags_it_lacks(mockerclient.shutdown()# hire-experts is defined but needs /flags; nothing else may ask.- assert (remote.call_count, flags.get(CHAT_SEARCH, "left out")) == (1, None)+ assert (remote.call_count, flags.get(PROGRESS_BAR, "left out")) == (1, None)@pytest.mark.parametrize("loaded", [True, False])@@ -251,7 +251,7 @@ async def test_on_posthog_only_loaded_definitions_can_rule_a_flag_undefined(# hire-experts is defined but needs /flags, which is down: left out either way.expected = (False, None) if loaded else (False, "left out")- assert (HIRE_EXPERTS in flags, flags.get(CHAT_SEARCH, "left out")) == expected+ assert (HIRE_EXPERTS in flags, flags.get(PROGRESS_BAR, "left out")) == expectedasync def test_with_no_vendor_configured_every_flag_is_the_frontends_default(mocker):@@ -285,13 +285,13 @@ async def test_an_env_override_forces_a_switch_but_never_a_payload(monkeypatch.setenv("FORCE_FLAG_COPILOT_VOICE_MODE", "true")monkeypatch.setenv("FORCE_FLAG_MARKETPLACE_SEARCH_TERMS", "true")# Forced although the vendor has no definition of it.- monkeypatch.setenv("FORCE_FLAG_CHAT_SEARCH", "true")+ monkeypatch.setenv("FORCE_FLAG_TASK_PROGRESS_BAR", "true")flags = (await _get_flags(user_id, visitor_id))["flags"]assert flags[FrontendFlag.COPILOT_VOICE_MODE.value] is Trueassert flags[FrontendFlag.MARKETPLACE_SEARCH_TERMS.value] == terms- assert flags[CHAT_SEARCH] is True+ assert flags[PROGRESS_BAR] is Trueasync def test_a_consenting_visitor_is_bucketed_by_their_own_id():diff --git a/autogpt_platform/backend/backend/util/feature_flag/backends_test.py b/autogpt_platform/backend/backend/util/feature_flag/backends_test.pyindex e6953b08cf..7ca05a5294 100644--- a/autogpt_platform/backend/backend/util/feature_flag/backends_test.py+++ b/autogpt_platform/backend/backend/util/feature_flag/backends_test.py@@ -381,7 +381,7 @@ class TestPostHogBackend:frontend._defined_flags.cache_clear()posthog_client.shutdown()- split = frontend.FrontendFlag.CHAT_SEARCH+ split = frontend.FrontendFlag.TASK_PROGRESS_BARshare = sum(v.flags.get(split) is True for v in visitors) / len(visitors)# One assertion, so a failure shows both halves.assert (anonymous.flags.get(split), 0.1 < share < 0.3) == (False, True), share@@ -1227,7 +1227,7 @@ def _posthog_with_a_split_on_is_anonymous() -> Posthog:client.feature_flags = [{"id": 2,- "key": "chat-search",+ "key": "task-progress-bar","active": True,"filters": {"groups": [diff --git a/autogpt_platform/backend/backend/util/feature_flag/frontend.py b/autogpt_platform/backend/backend/util/feature_flag/frontend.pyindex 5b18d6b45e..07f114ff46 100644--- a/autogpt_platform/backend/backend/util/feature_flag/frontend.py+++ b/autogpt_platform/backend/backend/util/feature_flag/frontend.py@@ -42,8 +42,6 @@ class FrontendFlag(str, Enum):ARTIFACTS_PAGE = "artifacts-page"CHAT_MODE_OPTION = Flag.CHAT_MODE_OPTION.valueGENERIC_TRIGGER_AGENTS = Flag.GENERIC_TRIGGER_AGENTS.value- CHAT_SEARCH = "chat-search"- AUTOGPT_NEW_LAYOUT = "autogpt-new-layout"CHAT_WORKSPACE_FILES = "chat-workspace-files"CHAT_PINNING = "chat-pinning"TASK_PROGRESS_BAR = "task-progress-bar"diff --git a/autogpt_platform/frontend/.env.default b/autogpt_platform/frontend/.env.defaultindex 0ba4c4ca09..6aa2893b5f 100644--- a/autogpt_platform/frontend/.env.default+++ b/autogpt_platform/frontend/.env.default@@ -119,9 +119,6 @@ NEXT_PUBLIC_GOOGLE_APP_ID=NEXT_PUBLIC_CLOUDFLARE_TURNSTILE_SITE_KEY=NEXT_PUBLIC_TURNSTILE=disabled-# PR previews-NEXT_PUBLIC_PREVIEW_STEALING_DEV=-# PostHog AnalyticsNEXT_PUBLIC_POSTHOG_KEY=NEXT_PUBLIC_POSTHOG_HOST=https://eu.i.posthog.comdiff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.tsindex 7b8be49c4a..f21db6857e 100644--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts@@ -240,10 +240,11 @@ export function usePaywallModal() {setPendingTier(null);}- // Route through the shared /logout page (same path the Navbar uses) rather- // than calling logOut() inline: it runs the full sign-out, then redirects to- // /login. Navigating away also unmounts this modal — without the redirect the- // user would be left logged-out but stranded behind the paywall.+ // Route through the shared /logout page (same path the account menu uses)+ // rather than calling logOut() inline: it runs the full sign-out, then+ // redirects to /login. Navigating away also unmounts this modal — without+ // the redirect the user would be left logged-out but stranded behind the+ // paywall.function handleLogout() {router.replace("/logout");}diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsx b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsxindex 45baaebdf5..4031bdde73 100644--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsx@@ -6,7 +6,6 @@ import { TourSidebar } from "@/app/(public)/tour/chat/components/TourSidebar/Touimport { AppSidebar } from "@/components/layout/AppSidebar/AppSidebar";import { AppSidebarToggleProvider } from "@/components/layout/AppSidebar/components/AppSidebarTrigger/AppSidebarTrigger";import { cn } from "@/lib/utils";-import { Navbar } from "@/components/layout/Navbar/Navbar";import { TopUpPromptProvider } from "@/components/layout/TopUpPrompt/TopUpPromptProvider";import {getPersistedSidebarOpen,@@ -34,13 +33,10 @@ interface Props {export function PlatformChrome({ children, persistedSidebarOpen }: Props) {const {- showNewLayout,- isNewLayoutActive,+ showAppSidebar,showTourSidebar,overlayInsetHeader,hasInsetHeaderTitle,- isSettingsRoute,- isAdminRoute,isBuilderRoute,} = usePlatformChrome();// The collapsed-by-default sidebar ships with the brain-dump experience.@@ -67,7 +63,7 @@ export function PlatformChrome({ children, persistedSidebarOpen }: Props) {);}- if (showNewLayout) {+ if (showAppSidebar) {// The browser's cookie stays current across client navigation; the layout's does not.const openOutsideBuilder =getPersistedSidebarOpen() ?? persistedSidebarOpen ?? !isBrainDumpEnabled;@@ -109,23 +105,10 @@ export function PlatformChrome({ children, persistedSidebarOpen }: Props) {);}- // Settings and admin render their own sidebar shells (with a Back link) —- // no top Navbar. Only the new layout drops the Navbar here; classic users- // keep it below so they don't lose global nav (wallet, account menu) or a- // way back on mobile.- if ((isSettingsRoute || isAdminRoute) && isNewLayoutActive) {- return (- <main className="flex h-screen w-full flex-col">- <AdminImpersonationBanner />- <GlobalSearchOverlay />- <section className="flex-1">{content}</section>- </main>- );- }-+ // Settings and admin render their own sidebar shells (with a Back link);+ // the unauthenticated routes (reset-password, auth errors) get a bare frame.return (<main className="flex h-screen w-full flex-col">- <Navbar /><AdminImpersonationBanner /><GlobalSearchOverlay /><section className="flex-1">{content}</section>diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/PlatformChrome.test.tsx b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/PlatformChrome.test.tsxindex 679e263206..e443d3e127 100644--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/PlatformChrome.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/PlatformChrome.test.tsx@@ -1,9 +1,4 @@-import {- fireEvent,- render,- screen,- waitFor,-} from "@/tests/integrations/test-utils";+import { fireEvent, render, screen } from "@/tests/integrations/test-utils";import type { ReactNode } from "react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";@@ -15,11 +10,11 @@ import {} from "@/tests/integrations/cookiebot";import { PlatformChrome } from "../PlatformChrome";-const showNewLayoutMock = vi.fn<() => boolean>(() => false);+const showAppSidebarMock = vi.fn<() => boolean>(() => true);const showTourSidebarMock = vi.fn<() => boolean>(() => false);vi.mock("../usePlatformChrome", () => ({usePlatformChrome: () => ({- showNewLayout: showNewLayoutMock(),+ showAppSidebar: showAppSidebarMock(),showTourSidebar: showTourSidebarMock(),}),}));@@ -27,9 +22,6 @@ vi.mock("../usePlatformChrome", () => ({vi.mock("@/components/layout/AppSidebar/AppSidebar", () => ({AppSidebar: () => <div data-testid="app-sidebar" />,}));-vi.mock("@/components/layout/Navbar/Navbar", () => ({- Navbar: () => <div data-testid="navbar" />,-}));vi.mock("@/components/layout/TopUpPrompt/TopUpPromptProvider", () => ({TopUpPromptProvider: ({ children }: { children: ReactNode }) => (<div>{children}</div>@@ -54,39 +46,39 @@ afterEach(() => {describe("PlatformChrome", () => {beforeEach(() => {vi.stubEnv("NEXT_PUBLIC_BEHAVE_AS", "CLOUD");- showNewLayoutMock.mockReturnValue(false);+ showAppSidebarMock.mockReturnValue(true);showTourSidebarMock.mockReturnValue(false);useTourStore.setState({ isDemoComplete: false });});- it("renders the classic Navbar shell when the new layout is off", () => {+ it("renders the app sidebar shell", () => {render(<PlatformChrome><div data-testid="child">content</div></PlatformChrome>,);- expect(screen.getByTestId("navbar")).toBeDefined();- expect(screen.queryByTestId("app-sidebar")).toBeNull();+ expect(screen.getByTestId("app-sidebar")).toBeDefined();+ expect(screen.getByTestId("global-search")).toBeDefined();expect(screen.getByTestId("child")).toBeDefined();});- it("renders the new sidebar shell when enabled", async () => {- showNewLayoutMock.mockReturnValue(true);+ it("renders a bare frame with no sidebar on excluded routes", () => {+ showAppSidebarMock.mockReturnValue(false);render(<PlatformChrome><div data-testid="child">content</div></PlatformChrome>,);- await waitFor(() => {- expect(screen.getByTestId("app-sidebar")).toBeDefined();- });- expect(screen.queryByTestId("navbar")).toBeNull();+ expect(screen.queryByTestId("app-sidebar")).toBeNull();+ expect(screen.queryByRole("navigation")).toBeNull();+ expect(screen.getByTestId("global-search")).toBeDefined();expect(screen.getByTestId("child")).toBeDefined();});it("renders a free-trial sidebar without demo chats when logged out", () => {+ showAppSidebarMock.mockReturnValue(false);showTourSidebarMock.mockReturnValue(true);render(<PlatformChrome>@@ -113,7 +105,6 @@ describe("PlatformChrome", () => {).toBe("/marketplace");expect(screen.queryByText(/Start with Pro/i)).toBeNull();expect(screen.queryByText(/\$42\.50/)).toBeNull();- expect(screen.queryByTestId("navbar")).toBeNull();expect(screen.queryByTestId("app-sidebar")).toBeNull();expect(screen.getByTestId("child")).toBeDefined();});diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/sidebarState.test.tsx b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/sidebarState.test.tsxindex 3397014bf6..a14354618c 100644--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/sidebarState.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/sidebarState.test.tsx@@ -25,7 +25,7 @@ vi.mock("next/navigation", () => ({vi.mock("../usePlatformChrome", () => ({usePlatformChrome: () => ({- showNewLayout: true,+ showAppSidebar: true,isBuilderRoute: pathname.startsWith("/build"),}),}));diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.ts b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.tsindex 5c848dc1f6..763dd94dbf 100644--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.ts+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.ts@@ -24,72 +24,30 @@ function setAuth({});}-const flagMock = vi.fn<(flag: string) => boolean>(() => true);-vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {- const actual =- await importOriginal<- typeof import("@/services/feature-flags/use-get-flag")- >();- return {- ...actual,- useGetFlag: (flag: string) => flagMock(flag),- };-});-describe("usePlatformChrome", () => {beforeEach(() => {pathnameMock.mockReturnValue("/marketplace");- flagMock.mockReturnValue(true);setAuth({ isLoggedIn: true, isUserLoading: false });});- it("enables the new layout after mount when the flag is on and route is allowed", async () => {+ it("shows the app sidebar from the very first render", () => {const { result } = renderHook(() => usePlatformChrome());- await waitFor(() => {- expect(result.current.showNewLayout).toBe(true);- });+ // What the server paints: no mount gate, no flag to wait for.+ expect(result.current.showAppSidebar).toBe(true);});- it("keeps the classic layout when the flag is off", async () => {- flagMock.mockReturnValue(false);- const { result } = renderHook(() => usePlatformChrome());-- await waitFor(() => {- expect(result.current.showNewLayout).toBe(false);- });- });-- it("excludes the /settings route from the new layout", async () => {- pathnameMock.mockReturnValue("/settings");- const { result } = renderHook(() => usePlatformChrome());-- await waitFor(() => {- // give the mount effect a chance to run; it should still be false.- expect(result.current.showNewLayout).toBe(false);- });- });-- it("excludes nested /settings/* routes from the new layout", async () => {- pathnameMock.mockReturnValue("/settings/billing");- const { result } = renderHook(() => usePlatformChrome());-- await waitFor(() => {- expect(result.current.showNewLayout).toBe(false);- });- });-- it("excludes /admin routes from the new layout but keeps the flag active", async () => {- pathnameMock.mockReturnValue("/admin/marketplace");- const { result } = renderHook(() => usePlatformChrome());+ it.each(["/settings", "/settings/billing", "/admin/marketplace"])(+ "keeps the app sidebar off %s, which brings its own shell",+ async (route) => {+ pathnameMock.mockReturnValue(route);+ const { result } = renderHook(() => usePlatformChrome());- await waitFor(() => {- // The admin section brings its own sidebar, so the app sidebar shell is- // suppressed even though the new-layout flag itself is active.- expect(result.current.showNewLayout).toBe(false);- expect(result.current.isNewLayoutActive).toBe(true);- });- });+ await waitFor(() => {+ expect(result.current.showAppSidebar).toBe(false);+ });+ },+ );it.each(["/reset-password",@@ -97,22 +55,23 @@ describe("usePlatformChrome", () => {"/error","/unauthorized",])(- "excludes the unauthenticated %s route from the new layout",+ "keeps the app sidebar off the unauthenticated %s route",async (route) => {pathnameMock.mockReturnValue(route);const { result } = renderHook(() => usePlatformChrome());await waitFor(() => {- expect(result.current.showNewLayout).toBe(false);+ expect(result.current.showAppSidebar).toBe(false);});},);- it("passes the flag enum to useGetFlag", async () => {- renderHook(() => usePlatformChrome());- await waitFor(() => {- expect(flagMock).toHaveBeenCalledWith("autogpt-new-layout");- });+ it("collapses the sidebar by default on the builder", () => {+ pathnameMock.mockReturnValue("/build");+ const { result } = renderHook(() => usePlatformChrome());++ expect(result.current.isBuilderRoute).toBe(true);+ expect(result.current.showAppSidebar).toBe(true);});it("shows the tour sidebar for logged-out marketplace visitors", async () => {@@ -122,7 +81,7 @@ describe("usePlatformChrome", () => {await waitFor(() => {expect(result.current.showTourSidebar).toBe(true);});- expect(result.current.showNewLayout).toBe(false);+ expect(result.current.showAppSidebar).toBe(false);});it("keeps the tour sidebar hidden while the session check is in flight", async () => {@@ -132,6 +91,7 @@ describe("usePlatformChrome", () => {await waitFor(() => {expect(result.current.showTourSidebar).toBe(false);});+ expect(result.current.showAppSidebar).toBe(true);});it("keeps the tour sidebar hidden for logged-in marketplace visitors", async () => {@@ -139,7 +99,7 @@ describe("usePlatformChrome", () => {await waitFor(() => {expect(result.current.showTourSidebar).toBe(false);- expect(result.current.showNewLayout).toBe(true);+ expect(result.current.showAppSidebar).toBe(true);});});@@ -151,12 +111,14 @@ describe("usePlatformChrome", () => {await waitFor(() => {expect(result.current.showTourSidebar).toBe(false);});+ expect(result.current.showAppSidebar).toBe(true);});-});-it("gives home the chat controls and floating header", () => {- pathnameMock.mockReturnValue("/home");- const { result } = renderHook(() => usePlatformChrome());- expect(result.current.isCopilotRoute).toBe(true);- expect(result.current.overlayInsetHeader).toBe(true);+ it("gives home the chat controls and floating header", () => {+ pathnameMock.mockReturnValue("/home");+ const { result } = renderHook(() => usePlatformChrome());++ expect(result.current.isCopilotRoute).toBe(true);+ expect(result.current.overlayInsetHeader).toBe(true);+ });});diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.ts b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.tsindex d0bcd2fc40..ea1a6bc8c9 100644--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.ts+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.ts@@ -3,17 +3,15 @@ import { useEffect, useState } from "react";import { useAuthStore } from "@/lib/auth/hooks/useAuthStore";import { matchesRoute } from "@/lib/utils";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { getRouteTitle } from "./components/InsetHeaderTitle/InsetHeaderTitle";import { isCopilotPathname } from "./helpers";-// Routes that must stay outside the new top-level sidebar layout. Login,-// signup and onboarding already live in the (no-navbar) group. These-// (platform) routes should not show the app sidebar — reset-password and the-// auth/error/unauthorized pages are all reachable while unauthenticated, and-// /admin brings its own admin sidebar (see admin/layout.tsx).-const NEW_LAYOUT_EXCLUDED_PREFIXES = [+// Routes that render without the app sidebar. Login, signup and onboarding+// already live in the (no-navbar) group. Settings and admin bring their own+// sidebar shells (with a Back link); reset-password and the+// auth/error/unauthorized pages are all reachable while unauthenticated.+const SIDEBAR_EXCLUDED_PREFIXES = ["/settings","/admin","/reset-password",@@ -27,22 +25,19 @@ const NEW_LAYOUT_EXCLUDED_PREFIXES = [// every URL-param write. See useIsChatSession.export function usePlatformChrome() {const pathname = usePathname();- const isNewLayoutEnabled = useGetFlag(Flag.AUTOGPT_NEW_LAYOUT);// The store, not useAuth: useAuth reads the search params too. The app-root// providers (CredentialsProvider, OnboardingProvider) call useAuth on every// page, so the session check still starts in the tour shell.const isLoggedIn = useAuthStore((state) => Boolean(state.user));const isUserLoading = useAuthStore((state) => state.isUserLoading);- // The LaunchDarkly flag is client-side data that can resolve differently on- // the server vs the client's first render. Switching the whole layout shell- // on it directly causes a hydration mismatch, so we only apply the new- // layout after mount — the server and first client paint always render the- // classic shell, then we swap once the flag is known on the client.+ // The session is client-side state that can resolve differently on the+ // server vs the client's first render, so the tour swap only happens after+ // mount.const [isMounted, setIsMounted] = useState(false);useEffect(() => setIsMounted(true), []);- const isExcludedRoute = NEW_LAYOUT_EXCLUDED_PREFIXES.some((prefix) =>+ const isExcludedRoute = SIDEBAR_EXCLUDED_PREFIXES.some((prefix) =>matchesRoute(pathname, prefix),);@@ -52,27 +47,13 @@ export function usePlatformChrome() {const isBuilderRoute = matchesRoute(pathname, "/build");- // Settings brings its own sidebar (with a Back link), so it renders without- // the top Navbar even though it opts out of the new app-sidebar layout.- const isSettingsRoute = matchesRoute(pathname, "/settings");-- // Admin mirrors settings under the new layout: its own settings-style- // sidebar shell (see admin/layout.tsx), no top Navbar.- const isAdminRoute = matchesRoute(pathname, "/admin");-- // Logged-out marketplace visitors get the tour demo sidebar as an upsell.+ // Logged-out marketplace visitors get public navigation and a trial CTA.// Waits for the session check so it never flashes at logged-in users.const showTourSidebar =isMounted && isMarketplaceRoute && !isUserLoading && !isLoggedIn;- // The new layout is only active after mount (see hydration note above). This- // is the flag on its own, independent of the per-route exclusions, so shells- // for excluded routes (e.g. settings) can still gate their new-layout chrome.- const isNewLayoutActive = isMounted && Boolean(isNewLayoutEnabled);-return {- showNewLayout: isNewLayoutActive && !isExcludedRoute && !showTourSidebar,- isNewLayoutActive,+ showAppSidebar: !isExcludedRoute && !showTourSidebar,// On copilot the inset header floats over the chat instead of stacking// above it, so messages scroll to the viewport top. Kept separate from// `isCopilotRoute` so a future overlay-header route doesn't inherit@@ -83,8 +64,6 @@ export function usePlatformChrome() {// below an empty strip; on mobile it stays for the sidebar trigger.hasInsetHeaderTitle: Boolean(getRouteTitle(pathname)),showTourSidebar,- isSettingsRoute,- isAdminRoute,// The builder wants the full canvas — the sidebar starts collapsed there// (defaultOpen seed for hard loads; BuilderSidebarAutoClose handles// client-side navigation).diff --git a/autogpt_platform/frontend/src/app/(platform)/admin/__tests__/AdminLayoutShell.test.tsx b/autogpt_platform/frontend/src/app/(platform)/admin/__tests__/AdminLayoutShell.test.tsxindex e1b0a4245e..56bb07aaf5 100644--- a/autogpt_platform/frontend/src/app/(platform)/admin/__tests__/AdminLayoutShell.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/admin/__tests__/AdminLayoutShell.test.tsx@@ -1,17 +1,12 @@import type { AnchorHTMLAttributes, ReactNode } from "react";import { render, screen } from "@/tests/integrations/test-utils";-import { beforeEach, describe, expect, it, vi } from "vitest";+import { describe, expect, it, vi } from "vitest";type MockLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {children: ReactNode;href: string;};-const { usePathnameMock, usePlatformChromeMock } = vi.hoisted(() => ({- usePathnameMock: vi.fn(() => "/admin/marketplace"),- usePlatformChromeMock: vi.fn(() => ({ isNewLayoutActive: false })),-}));-vi.mock("next/navigation", () => ({useRouter: () => ({push: vi.fn(),@@ -21,7 +16,7 @@ vi.mock("next/navigation", () => ({forward: vi.fn(),refresh: vi.fn(),}),- usePathname: usePathnameMock,+ usePathname: () => "/admin/marketplace",useSearchParams: () => new URLSearchParams(),useParams: () => ({}),}));@@ -38,21 +33,10 @@ vi.mock("next/link", () => ({useLinkStatus: () => ({ pending: false }),}));-vi.mock("@/app/(platform)/PlatformChrome/usePlatformChrome", () => ({- usePlatformChrome: usePlatformChromeMock,-}));-import AdminLayout from "../layout";-describe("AdminLayout shell switching", () => {- beforeEach(() => {- usePathnameMock.mockReturnValue("/admin/marketplace");- usePlatformChromeMock.mockReturnValue({ isNewLayoutActive: false });- });-- it("renders the new admin shell with its own Back link when the new layout is active", () => {- usePlatformChromeMock.mockReturnValue({ isNewLayoutActive: true });-+describe("AdminLayout shell", () => {+ it("renders the admin shell with its own Back link", () => {render(<AdminLayout><p>admin page body</p>@@ -60,26 +44,13 @@ describe("AdminLayout shell switching", () => {);expect(screen.getByText("admin page body")).toBeDefined();- // The new shell owns navigation (no top Navbar), so it must expose a way back.+ // The shell owns navigation (no app sidebar), so it must expose a way back.expect(screen.getAllByRole("link", { name: /back to home/i }).length,).toBeGreaterThan(0);});- it("renders the classic shell without the new admin Back link when the flag is off", () => {- render(- <AdminLayout>- <p>admin page body</p>- </AdminLayout>,- );-- expect(screen.getByText("admin page body")).toBeDefined();- expect(screen.queryByRole("link", { name: /back to home/i })).toBeNull();- });-- it("keeps every admin destination reachable in the new shell", () => {- usePlatformChromeMock.mockReturnValue({ isNewLayoutActive: true });-+ it("keeps every admin destination reachable", () => {render(<AdminLayout><p>admin page body</p>diff --git a/autogpt_platform/frontend/src/app/(platform)/admin/components/AdminClassicShell.tsx b/autogpt_platform/frontend/src/app/(platform)/admin/components/AdminClassicShell.tsxdeleted file mode 100644index 44aaf5d683..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/admin/components/AdminClassicShell.tsx+++ /dev/null@@ -1,99 +0,0 @@-import { Sidebar } from "@/components/__legacy__/Sidebar";-import { IconSliders } from "@/components/__legacy__/ui/icons";-import {- BrainIcon,- Calculator01Icon,- Database01Icon,- DollarSignIcon,- File02Icon,- Pulse01Icon,- ReceiptTextIcon,- Robot01Icon,- UserIcon,- UserMultipleIcon,-} from "@hugeicons/core-free-icons";-import { ReactNode } from "react";--import { Icon } from "@/components/atoms/Icon/Icon";-import { isTestDataSurfaceEnabled } from "../test-data/helpers";--// Built per render so the local-only Test Data link follows the live-// environment check instead of the value at module load.-function getSidebarLinkGroups() {- return [- {- links: [- {- text: "Users",- href: "/admin/users",- icon: <Icon icon={UserIcon} className="h-6 w-6" />,- },- {- text: "Marketplace Management",- href: "/admin/marketplace",- icon: <Icon icon={UserMultipleIcon} className="h-6 w-6" />,- },- {- text: "User Spending",- href: "/admin/spending",- icon: <Icon icon={DollarSignIcon} className="h-6 w-6" />,- },- {- text: "System Diagnostics",- href: "/admin/diagnostics",- icon: <Icon icon={Pulse01Icon} className="h-6 w-6" />,- },- {- text: "Platform Costs",- href: "/admin/platform-costs",- icon: <Icon icon={ReceiptTextIcon} className="h-6 w-6" />,- },- {- text: "Execution Analytics",- href: "/admin/execution-analytics",- icon: <Icon icon={File02Icon} className="h-6 w-6" />,- },- {- text: "Bot Analytics",- href: "/admin/bots",- icon: <Icon icon={Robot01Icon} className="h-6 w-6" />,- },- {- text: "Block Cost Estimates",- href: "/admin/block-cost-estimates",- icon: <Icon icon={Calculator01Icon} className="h-6 w-6" />,- },- {- text: "Memory Inspector",- href: "/admin/memory",- icon: <Icon icon={BrainIcon} className="h-6 w-6" />,- },- {- text: "Admin settings",- href: "/admin/settings",- icon: <IconSliders className="h-6 w-6" />,- },- // Test data seeding only exists on local stacks; hide the entry point- // everywhere else so cloud admins don't hit a guaranteed 403/404.- ...(isTestDataSurfaceEnabled()- ? [- {- text: "Test Data",- href: "/admin/test-data",- icon: <Icon icon={Database01Icon} className="h-6 w-6" />,- },- ]- : []),- ],- },- ];-}--export function AdminClassicShell({ children }: { children: ReactNode }) {- return (- <div className="flex h-full w-full flex-col lg:flex-row">- <Sidebar linkGroups={getSidebarLinkGroups()} />- <div className="flex-1 pl-4">{children}</div>- </div>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/admin/components/AdminNewShell.tsx b/autogpt_platform/frontend/src/app/(platform)/admin/components/AdminShell.tsxsimilarity index 83%rename from autogpt_platform/frontend/src/app/(platform)/admin/components/AdminNewShell.tsxrename to autogpt_platform/frontend/src/app/(platform)/admin/components/AdminShell.tsxindex 90e144dc12..ad2a3677a4 100644--- a/autogpt_platform/frontend/src/app/(platform)/admin/components/AdminNewShell.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/admin/components/AdminShell.tsx@@ -8,10 +8,9 @@ import { ReactNode } from "react";import { AdminMobileNav } from "./AdminMobileNav/AdminMobileNav";import { AdminSidebar } from "./AdminSidebar/AdminSidebar";-// Mirrors the new /settings shell: own sidebar with a Back link, no top-// Navbar (PlatformChrome renders the bare shell for /admin under the new-// layout).-export function AdminNewShell({ children }: { children: ReactNode }) {+// Mirrors the /settings shell: own sidebar with a Back link, no app sidebar+// (PlatformChrome renders the bare frame for /admin).+export function AdminShell({ children }: { children: ReactNode }) {const pathname = usePathname();const reduceMotion = useReducedMotion();diff --git a/autogpt_platform/frontend/src/app/(platform)/admin/layout.tsx b/autogpt_platform/frontend/src/app/(platform)/admin/layout.tsxindex abdd7ba615..734d29edde 100644--- a/autogpt_platform/frontend/src/app/(platform)/admin/layout.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/admin/layout.tsx@@ -1,20 +1,7 @@-"use client";--import { usePlatformChrome } from "@/app/(platform)/PlatformChrome/usePlatformChrome";import { ReactNode } from "react";-import { AdminClassicShell } from "./components/AdminClassicShell";-import { AdminNewShell } from "./components/AdminNewShell";+import { AdminShell } from "./components/AdminShell";-// Switcher between the classic admin shell (legacy sidebar under the top-// Navbar) and the new-layout shell (settings-style sidebar, no Navbar). The-// classic shell can be deleted wholesale once the new layout ships.export default function AdminLayout({ children }: { children: ReactNode }) {- const { isNewLayoutActive } = usePlatformChrome();-- if (isNewLayoutActive) {- return <AdminNewShell>{children}</AdminNewShell>;- }-- return <AdminClassicShell>{children}</AdminClassicShell>;+ return <AdminShell>{children}</AdminShell>;}diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/main.test.tsxindex 9cdf975a67..f18ecc4ec0 100644--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/main.test.tsx@@ -26,8 +26,8 @@ const { setFlagStatusMock, uploadFileDirectMock } = vi.hoisted(() => {};});-// usePlatformChrome re-renders once on mount (isMounted guard), so per-test-// flag overrides must persist across renders; restore the default afterward.+// Per-test flag overrides must persist across re-renders; restore the default+// afterward.afterEach(() => {setFlagStatusMock.mockReturnValue({ enabled: true, ready: true });uploadFileDirectMock.mockReset();@@ -43,10 +43,9 @@ beforeEach(() => {vi.mock("@/services/feature-flags/use-get-flag", () => ({Flag: {ARTIFACTS_PAGE: "artifacts-page",- AUTOGPT_NEW_LAYOUT: "autogpt-new-layout",HIRE_EXPERTS: "hire-experts",},- useGetFlag: (flag: string) => flag !== "autogpt-new-layout",+ useGetFlag: () => true,useFlagStatus: () => setFlagStatusMock(),}));@@ -139,15 +138,18 @@ async function openHoverPreview() {}describe("ArtifactsPage - basic rendering", () => {- test("renders the page header", async () => {+ test("renders the page intro and leaves the title to the inset header", async () => {useStorageHandler();useFilesHandler([]);render(<ArtifactsPage />);expect(- await screen.findByRole("heading", { name: /files/i }),+ await screen.findByText(+ "Find here every file generated by your team or uploaded by you.",+ ),).toBeDefined();+ expect(screen.queryByRole("heading", { name: "Files" })).toBeNull();});test("shows the empty state when the workspace has no files", async () => {diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/office-files.test.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/office-files.test.tsxindex 2cc3b312a6..7d92943cc5 100644--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/office-files.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/office-files.test.tsx@@ -20,10 +20,9 @@ import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspacevi.mock("@/services/feature-flags/use-get-flag", () => ({Flag: {ARTIFACTS_PAGE: "artifacts-page",- AUTOGPT_NEW_LAYOUT: "autogpt-new-layout",HIRE_EXPERTS: "hire-experts",},- useGetFlag: (flag: string) => flag !== "autogpt-new-layout",+ useGetFlag: () => true,useFlagStatus: () => ({ enabled: true, ready: true }),}));diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/page.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/page.tsxindex 21ecb00ee3..1d5d666282 100644--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/page.tsx@@ -7,7 +7,6 @@ import type { Transition, Variants } from "framer-motion";import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";import { Text } from "@/components/atoms/Text/Text";import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";-import { usePlatformChrome } from "@/app/(platform)/PlatformChrome/usePlatformChrome";import { useExpertMap } from "@/app/(platform)/copilot/useExpertMap";import { ArtifactsSearchBar } from "./components/ArtifactsSearchBar/ArtifactsSearchBar";import { ArtifactsList } from "./components/ArtifactsList/ArtifactsList";@@ -15,7 +14,6 @@ import { getEmptyState } from "./components/ArtifactsList/helpers";import { NewMenu } from "./components/NewMenu/NewMenu";import { ExpertFilter } from "./components/ExpertFilter/ExpertFilter";import { OriginFilter } from "./components/OriginFilter/OriginFilter";-import { StorageUsage } from "./components/StorageUsage/StorageUsage";import { ViewToggle } from "./components/ViewToggle/ViewToggle";import { FolderBreadcrumb } from "./components/WorkspaceFolders/FolderBreadcrumb";import {@@ -42,18 +40,13 @@ const REDUCED_SECTION_VARIANTS: Variants = {show: { opacity: 1, transition: { duration: 0.2 } },};-// The sidebar-inset dashboard layout the artifacts page was redesigned for.-const NEW_LAYOUT_MAIN =+const MAIN_CLASS_NAME ="mx-auto min-h-screen w-full max-w-7xl space-y-6 px-6 pb-20 pt-2 md:px-8";-// Classic navbar layout — kept intact when the new-layout flag is off.-const CLASSIC_MAIN =- "container min-h-screen space-y-6 pb-20 pt-16 sm:px-8 md:px-12";export default function ArtifactsPage() {const { enabled: isEnabled, ready: flagReady } = useFlagStatus(Flag.ARTIFACTS_PAGE,);- const { showNewLayout } = usePlatformChrome();const reduceMotion = useReducedMotion();const {folders,@@ -111,7 +104,7 @@ export default function ArtifactsPage() {}, []);if (!flagReady) {- return <ArtifactsPageSkeleton showNewLayout={showNewLayout} />;+ return <ArtifactsPageSkeleton />;}if (!isEnabled) {notFound();@@ -120,21 +113,9 @@ export default function ArtifactsPage() {const variants = reduceMotion ? REDUCED_SECTION_VARIANTS : SECTION_VARIANTS;return (- <main className={showNewLayout ? NEW_LAYOUT_MAIN : CLASSIC_MAIN}>- {/* Under the new layout the chrome's inset header owns the title row and- shows storage usage beside it (see InsetHeaderActions). */}- {!showNewLayout ? (- <motion.div- className="flex items-center justify-between gap-4"- variants={variants}- initial="hidden"- animate="show"- transition={{ delay: 0 }}- >- <Text variant="h3">Files</Text>- <StorageUsage />- </motion.div>- ) : null}+ <main className={MAIN_CLASS_NAME}>+ {/* The chrome's inset header owns the title row and shows storage usage+ beside it (see InsetHeaderActions). */}<div className="flex flex-col gap-4 md:flex-row md:items-center md:justify-between"><motion.divvariants={variants}@@ -142,10 +123,7 @@ export default function ArtifactsPage() {animate="show"transition={{ delay: 0 }}>- <Text- variant={showNewLayout ? "large" : "body"}- className="max-w-prose text-zinc-600"- >+ <Text variant="large" className="max-w-prose text-zinc-600">Find here every file generated by your team or uploaded by you.</Text></motion.div>@@ -243,16 +221,9 @@ export default function ArtifactsPage() {);}-interface Props {- showNewLayout: boolean;-}--function ArtifactsPageSkeleton({ showNewLayout }: Props) {+function ArtifactsPageSkeleton() {return (- <main- className={showNewLayout ? NEW_LAYOUT_MAIN : CLASSIC_MAIN}- data-testid="artifacts-flag-loading"- >+ <main className={MAIN_CLASS_NAME} data-testid="artifacts-flag-loading"><Skeleton className="h-8 w-48 rounded-md" /><Skeleton className="h-4 w-80 rounded-md" /><div className="flex flex-col divide-y divide-zinc-100">diff --git a/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/GlobalSearchOverlay.tsx b/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/GlobalSearchOverlay.tsxindex 5605d1c510..fb01053b99 100644--- a/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/GlobalSearchOverlay.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/GlobalSearchOverlay.tsx@@ -1,6 +1,5 @@"use client";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { usePathname, useRouter } from "next/navigation";import { useEffect, useRef } from "react";import { GlobalSearchModal } from "./GlobalSearchModal";@@ -10,12 +9,6 @@ import { useGlobalSearchStore } from "./useGlobalSearchStore";// Mounted once in the platform layout so Cmd/Ctrl+Shift+K opens the search// palette from any page. Renders a single modal instance driven by the store.export function GlobalSearchOverlay() {- // Search is a first-class part of the new layout (sidebar Search item +- // Cmd/Ctrl+Shift+K), so enable it whenever that layout is on, independent of- // chat-search flag that gates it in the classic layout.- const isChatSearchEnabled = useGetFlag(Flag.CHAT_SEARCH);- const isNewLayoutEnabled = useGetFlag(Flag.AUTOGPT_NEW_LAYOUT);- const isEnabled = isChatSearchEnabled || isNewLayoutEnabled;const router = useRouter();const pathname = usePathname();const isOpen = useGlobalSearchStore((state) => state.isOpen);@@ -33,24 +26,19 @@ export function GlobalSearchOverlay() {}, [pathname]);useEffect(() => {- if (!isEnabled) return;function handleSearchShortcut(event: KeyboardEvent) {if (event.repeat) return;if (!event.key || event.key.toLocaleLowerCase() !== "k") return;if (!event.metaKey && !event.ctrlKey) return;- // The new layout binds Cmd/Ctrl+Shift+K; the classic chat-search path- // keeps its original plain Cmd/Ctrl+K, so only require Shift on the new- // layout to avoid changing the classic binding.- if (isNewLayoutEnabled && !event.shiftKey) return;+ // Plain Cmd/Ctrl+K stays free for the chat input's own shortcuts.+ if (!event.shiftKey) return;event.preventDefault();useGlobalSearchStore.getState().toggleSearch();}document.addEventListener("keydown", handleSearchShortcut);return () => document.removeEventListener("keydown", handleSearchShortcut);- }, [isEnabled, isNewLayoutEnabled]);-- if (!isEnabled) return null;+ }, []);return (<GlobalSearchModaldiff --git a/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/__tests__/GlobalSearchOverlay.test.tsx b/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/__tests__/GlobalSearchOverlay.test.tsxindex f30ff1924a..a850a77e64 100644--- a/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/__tests__/GlobalSearchOverlay.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/__tests__/GlobalSearchOverlay.test.tsx@@ -29,17 +29,6 @@ vi.mock("next/navigation", () => ({useParams: () => ({}),}));-vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {- const actual =- await importOriginal<- typeof import("@/services/feature-flags/use-get-flag")- >();- return {- ...actual,- useGetFlag: (flag: string) => flag === "chat-search",- };-});-function makeSearchResponse(overrides: Partial<GlobalSearchResponse> = {},): GlobalSearchResponse {@@ -100,7 +89,7 @@ describe("GlobalSearchOverlay", () => {server.resetHandlers();});- it("opens with Cmd+K, focuses the input, and shows recent chats", async () => {+ it("opens with Cmd+Shift+K, focuses the input, and shows recent chats", async () => {render(<GlobalSearchOverlay />);fireEvent.keyDown(document, { key: "k", metaKey: true, shiftKey: true });@@ -111,12 +100,12 @@ describe("GlobalSearchOverlay", () => {expect(await within(dialog).findByText("Revenue forecast")).toBeDefined();});- it("opens with plain Cmd+K on the classic chat-search path (no Shift required)", async () => {+ it("leaves plain Cmd+K alone", () => {render(<GlobalSearchOverlay />);fireEvent.keyDown(document, { key: "k", metaKey: true });- expect(await screen.findByRole("dialog")).toBeDefined();+ expect(screen.queryByRole("dialog")).toBeNull();});it("filters results, shows empty copy, and clears the query", async () => {diff --git a/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/useTabIntroCard.test.tsx b/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/useTabIntroCard.test.tsxindex 0d9490ba08..270ed20641 100644--- a/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/useTabIntroCard.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/__tests__/useTabIntroCard.test.tsx@@ -20,7 +20,6 @@ vi.mock("@/services/feature-flags/use-get-flag", () => ({Flag: {ONBOARDING_BRAIN_DUMP: "onboarding-brain-dump",HIRE_EXPERTS: "hire-experts",- AUTOGPT_NEW_LAYOUT: "autogpt-new-layout",},useFlagStatus: (flag: string) => ({enabled: flags.current[flag] ?? false,@@ -167,7 +166,6 @@ describe("useTabIntroCard — workflow migration", () => {flags.current = {"onboarding-brain-dump": true,"hire-experts": true,- "autogpt-new-layout": true,};});@@ -180,21 +178,18 @@ describe("useTabIntroCard — workflow migration", () => {expect(window.localStorage.getItem(SEEN_KEY)).toBeNull();});- it.each(["hire-experts", "autogpt-new-layout"])(- "waits for %s before deciding which intro applies",- (flag) => {- flags.current[flag] = false;- flagReadiness.current[flag] = false;- const { result, rerender } = renderGate();- expect(result.current.isOpen).toBe(false);- expect(capture).not.toHaveBeenCalled();+ it("waits for hire-experts before deciding which intro applies", () => {+ flags.current["hire-experts"] = false;+ flagReadiness.current["hire-experts"] = false;+ const { result, rerender } = renderGate();+ expect(result.current.isOpen).toBe(false);+ expect(capture).not.toHaveBeenCalled();- flagReadiness.current[flag] = true;- rerender();+ flagReadiness.current["hire-experts"] = true;+ rerender();- expect(result.current.isOpen).toBe(true);- },- );+ expect(result.current.isOpen).toBe(true);+ });it.each(["marketplace", "build"] as const)("preserves the %s intro for existing users",diff --git a/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/useTabIntroCard.ts b/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/useTabIntroCard.tsindex 18a5cfe9e7..d3d46077f5 100644--- a/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/useTabIntroCard.ts+++ b/autogpt_platform/frontend/src/app/(platform)/components/TabIntroCard/useTabIntroCard.ts@@ -29,12 +29,10 @@ export function useTabIntroCard(tab: TabIntroTab, canShow = true) {// of their own.const { enabled, ready } = useFlagStatus(Flag.ONBOARDING_BRAIN_DUMP);const experts = useFlagStatus(Flag.HIRE_EXPERTS);- const layout = useFlagStatus(Flag.AUTOGPT_NEW_LAYOUT);const isMigrationCohort =tab === "agents" && isPreExpertsUser(user?.created_at);const hasMigrationNotice =- isMigrationCohort &&- (!experts.ready || !layout.ready || (experts.enabled && layout.enabled));+ isMigrationCohort && (!experts.ready || experts.enabled);const step = TAB_INTRO_STEPS[tab];// Who closed the card in this mounted session, rather than a boolean: adiff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/tutorialCoexistence.test.tsx b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/tutorialCoexistence.test.tsxindex c9e64b168e..00392bde1c 100644--- a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/tutorialCoexistence.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/tutorialCoexistence.test.tsx@@ -43,7 +43,6 @@ vi.mock("@/services/feature-flags/use-get-flag", () => ({Flag: {ONBOARDING_BRAIN_DUMP: "onboarding-brain-dump",HIRE_EXPERTS: "hire-experts",- AUTOGPT_NEW_LAYOUT: "autogpt-new-layout",},useGetFlag: (flag: string) => context.flags[flag] ?? false,useFlagStatus: (flag: string) => ({@@ -100,7 +99,6 @@ beforeEach(() => {context.flags = {"onboarding-brain-dump": true,"hire-experts": true,- "autogpt-new-layout": true,};context.readiness = {};context.state = { completedSteps: ["ONBOARDING_COMPLETE"] };@@ -148,10 +146,7 @@ describe("migration notice with production first-visit tutorials", () => {"never flashes the agents tutorial when %s arrives first",async (first) => {context.state = null;- context.readiness = {- "hire-experts": false,- "autogpt-new-layout": false,- };+ context.readiness = { "hire-experts": false };const { refresh } = renderTogether();expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0);if (first === "flags") {@@ -209,27 +204,24 @@ describe("migration notice with production first-visit tutorials", () => {expect(context.postedStep).not.toHaveBeenCalled();});- it.each(["hire-experts", "autogpt-new-layout"])(- "preserves the old tutorial when delayed %s resolves off",- async (flag) => {- context.flags[flag] = false;- context.readiness[flag] = false;- const { refresh } = renderTogether();- expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0);- context.readiness[flag] = true;- refresh();- expectOnlyDialog("Your mission control.");- expectNoWrites();- await userEvent.click(- screen.getByRole("button", { name: "See my workflows" }),- );- expect(context.completeStep).toHaveBeenCalledExactlyOnceWith(- "AGENTS_TAB_INTRO",- );- expect(context.getState).not.toHaveBeenCalled();- expect(context.postedStep).not.toHaveBeenCalled();- },- );+ it("preserves the old tutorial when delayed hire-experts resolves off", async () => {+ context.flags["hire-experts"] = false;+ context.readiness["hire-experts"] = false;+ const { refresh } = renderTogether();+ expect(screen.queryAllByRole("dialog", { hidden: true })).toHaveLength(0);+ context.readiness["hire-experts"] = true;+ refresh();+ expectOnlyDialog("Your mission control.");+ expectNoWrites();+ await userEvent.click(+ screen.getByRole("button", { name: "See my workflows" }),+ );+ expect(context.completeStep).toHaveBeenCalledExactlyOnceWith(+ "AGENTS_TAB_INTRO",+ );+ expect(context.getState).not.toHaveBeenCalled();+ expect(context.postedStep).not.toHaveBeenCalled();+ });it.each([[diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/useWorkflowsMovedNotice.test.tsx b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/useWorkflowsMovedNotice.test.tsxindex fa7fb216de..143e9448ed 100644--- a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/useWorkflowsMovedNotice.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/__tests__/useWorkflowsMovedNotice.test.tsx@@ -28,10 +28,7 @@ const context = vi.hoisted(() => ({search: "",ready: true,flagReadiness: {} as Record<string, boolean>,- flags: { "hire-experts": true, "autogpt-new-layout": true } as Record<- string,- boolean- >,+ flags: { "hire-experts": true } as Record<string, boolean>,}));vi.mock("@/lib/auth/hooks/useAuth", () => ({useAuth: () => ({ user: context.user }),@@ -43,7 +40,6 @@ vi.mock("next/navigation", () => ({vi.mock("@/services/feature-flags/use-get-flag", () => ({Flag: {HIRE_EXPERTS: "hire-experts",- AUTOGPT_NEW_LAYOUT: "autogpt-new-layout",ONBOARDING_BRAIN_DUMP: "onboarding-brain-dump",},useFlagStatus: (flag: string) => ({@@ -102,7 +98,7 @@ beforeEach(() => {context.search = "";context.ready = true;context.flagReadiness = {};- context.flags = { "hire-experts": true, "autogpt-new-layout": true };+ context.flags = { "hire-experts": true };mockOnboarding();});@@ -287,13 +283,10 @@ describe("migration notice eligibility", () => {await waitFor(() => expect(result.current.isOpen).toBe(true));});- it.each(["hire-experts", "autogpt-new-layout"])(- "stays closed with %s disabled",- (flag) => {- context.flags[flag] = false;- expectDeferred();- },- );+ it("stays closed with hire-experts disabled", () => {+ context.flags["hire-experts"] = false;+ expectDeferred();+ });it("waits for feature flag readiness", () => {context.ready = false;diff --git a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useWorkflowsMovedNotice.ts b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useWorkflowsMovedNotice.tsindex dc83974d78..75bc24aaba 100644--- a/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useWorkflowsMovedNotice.ts+++ b/autogpt_platform/frontend/src/app/(platform)/components/WorkflowsMovedNotice/useWorkflowsMovedNotice.ts@@ -28,15 +28,12 @@ export function useWorkflowsMovedNotice(canShow = true) {const userID = user?.id ?? null;const isSafeLanding = useNoticeLandingRoute();const experts = useFlagStatus(Flag.HIRE_EXPERTS);- const layout = useFlagStatus(Flag.AUTOGPT_NEW_LAYOUT);const [dismissedUsers, setDismissedUsers] = useState<string[]>([]);const isEligible = Boolean(canShow &&userID &&experts.ready &&experts.enabled &&- layout.ready &&- layout.enabled &&isPreExpertsUser(user?.created_at) &&isSafeLanding &&!dismissedUsers.includes(userID) &&diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsxindex c869d3118c..0ca6dca5f5 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx@@ -3,20 +3,14 @@import { LowCreditBanner } from "@/components/layout/TopUpPrompt/LowCreditBanner/LowCreditBanner";import { SidebarProvider } from "@/components/ui/sidebar";import { useAuth } from "@/lib/auth/hooks/useAuth";-import { NAVBAR_HEIGHT_PX } from "@/lib/constants";-import { cn } from "@/lib/utils";import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";-import { usePlatformChrome } from "../PlatformChrome/usePlatformChrome";import dynamic from "next/dynamic";import { parseAsString, useQueryState } from "nuqs";import { useState } from "react";import { CopilotChatHost } from "./CopilotChatHost";import { ContextPanelAutoOpen } from "./components/ContextPanel/ContextPanelAutoOpen";-import { ChatSidebar } from "./components/ChatSidebar/ChatSidebar";import { CopilotModals } from "./components/CopilotModals/CopilotModals";import { FileDropZone } from "./components/FileDropZone/FileDropZone";-import { MobileDrawer } from "./components/MobileDrawer/MobileDrawer";-import { MobileHeader } from "./components/MobileHeader/MobileHeader";import { NotificationBanner } from "./components/NotificationBanner/NotificationBanner";import { NotificationDialog } from "./components/NotificationDialog/NotificationDialog";import { ScaleLoader } from "./components/ScaleLoader/ScaleLoader";@@ -42,10 +36,6 @@ export function CopilotPage() {const [droppedFiles, setDroppedFiles] = useState<File[]>([]);const isMobile = useIsMobile();const isBrainDumpEnabled = useGetFlag(Flag.ONBOARDING_BRAIN_DUMP);- // Use the same mount-gated decision as PlatformChrome so the ChatSidebar is- // hidden in lockstep with the layout swap — avoids a one-frame flash where- // the classic shell renders without its sidebar before the new layout mounts.- const { showNewLayout } = usePlatformChrome();const { isUserLoading, isLoggedIn } = useAuth();// Read sessionId here purely to key the chat-host subtree. The view still// remounts on session switch, but the underlying AI SDK Chat runtime now@@ -64,37 +54,27 @@ export function CopilotPage() {return (<SidebarProviderdefaultOpen={true}- // Both layouts need an explicit, viewport-bound height: the chat column- // relies on a definite height so its inner `min-h-0` chain lets the- // messages area (not the page) absorb growth — e.g. expanding the task- // progress accordion above the input. The new-layout ancestors- // (SidebarProvider `min-h-svh` → SidebarInset `flex-1` → `section flex-1`)- // only set a *minimum* height, so `height: 100%` there resolves to- // content height and the accordion pushes the input below the fold.- // The new layout gets the full viewport — its inset header overlays the- // chat (see PlatformChrome) instead of stacking above it. The classic- // layout subtracts the navbar + preview banner. `svh` keeps the input+ // The chat column needs an explicit, viewport-bound height: it relies on+ // a definite height so its inner `min-h-0` chain lets the messages area+ // (not the page) absorb growth — e.g. expanding the task progress+ // accordion above the input. The chrome's ancestors (SidebarProvider+ // `min-h-svh` → SidebarInset `flex-1` → `section flex-1`) only set a+ // *minimum* height, so `height: 100%` would resolve to content height+ // and the accordion would push the input below the fold. The inset+ // header overlays the chat (see PlatformChrome) instead of stacking+ // above it, so the full viewport is available. `svh` keeps the input// visible when mobile browser chrome is shown.- style={- showNewLayout- ? { height: "100svh" }- : {- height: `calc(100vh - ${NAVBAR_HEIGHT_PX}px - var(--preview-banner-height, 0px))`,- }- }+ style={{ height: "100svh" }}className="min-h-0">- {!isMobile && !showNewLayout && <ChatSidebar />}<MainAreaisMobile={isMobile}- showNewLayout={showNewLayout}sessionId={sessionId}droppedFiles={droppedFiles}setDroppedFiles={setDroppedFiles}/>{isMobile && sessionId && <ContextPanel sessionId={sessionId} mobile />}{isMobile && <ArtifactPanel mobile />}- {isMobile && !showNewLayout && <MobileDrawer />}{!isBrainDumpEnabled && <NotificationDialog />}<CopilotModals /></SidebarProvider>@@ -103,7 +83,6 @@ export function CopilotPage() {interface MainAreaProps {isMobile: boolean;- showNewLayout: boolean;sessionId: string | null;droppedFiles: File[];setDroppedFiles: (files: File[]) => void;@@ -111,7 +90,6 @@ interface MainAreaProps {function MainArea({isMobile,- showNewLayout,sessionId,droppedFiles,setDroppedFiles,@@ -123,17 +101,10 @@ function MainArea({className="relative flex min-w-0 flex-1 flex-col overflow-hidden px-0"onFilesDropped={setDroppedFiles}>- {/* New layout replaces these floating buttons: sessions live in the- app sidebar, workspace files toggle sits in the inset header. */}- {isMobile && !showNewLayout && <MobileHeader />}- <div- className={cn(- "flex flex-col gap-3 px-4 pt-4 empty:hidden",- // Clear the floating inset-header controls (sidebar toggle +- // workspace-files trigger) that overlay the top-left corner.- showNewLayout && "max-lg:pt-16",- )}- >+ {/* max-lg:pt-16 clears the floating inset-header controls (sidebar+ toggle + workspace-files trigger) that overlay the top-left+ corner. */}+ <div className="flex flex-col gap-3 px-4 pt-4 empty:hidden max-lg:pt-16"><LowCreditBanner /><NotificationBanner /></div>@@ -141,9 +112,7 @@ function MainArea({key={`chat-host-${sessionId ?? "new"}`}droppedFiles={droppedFiles}onDroppedFilesConsumed={() => setDroppedFiles([])}- floatingControls={- showNewLayout ? "newLayout" : isMobile ? "classic" : undefined- }+ floatingControls="newLayout"/>{/* Owns the session-entry reset that forgets the previous chat'sartifact. */}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsxindex 8e9373e450..eb51e71172 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsx@@ -12,18 +12,9 @@ import { CopilotPage } from "../CopilotPage";vi.mock("../components/ChatContainer/ChatContainer", () => ({ChatContainer: () => <div data-testid="chat-container" />,}));-vi.mock("../components/ChatSidebar/ChatSidebar", () => ({- ChatSidebar: () => <div data-testid="chat-sidebar" />,-}));vi.mock("../components/DeleteChatDialog/DeleteChatDialog", () => ({DeleteChatDialog: () => null,}));-vi.mock("../components/MobileDrawer/MobileDrawer", () => ({- MobileDrawer: () => null,-}));-vi.mock("../components/MobileHeader/MobileHeader", () => ({- MobileHeader: () => null,-}));vi.mock("../components/NotificationBanner/NotificationBanner", () => ({NotificationBanner: () => null,}));@@ -95,6 +86,7 @@ vi.mock("@/services/feature-flags/use-get-flag", () => ({TASK_PROGRESS_BAR: "TASK_PROGRESS_BAR",},useGetFlag: () => false,+ useFlagStatus: () => ({ enabled: false, ready: true, answered: true }),}));// Auth check moved into CopilotPage directly — default to a logged-indiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsxindex 65cb297464..df6e0f5495 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsx@@ -5,7 +5,6 @@ import {} from "@/app/api/__generated__/endpoints/experts/experts.msw";import { getGetV1ListExecutionSchedulesForAUserMockHandler } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";import type { Expert } from "@/app/api/__generated__/models/expert";-import { SidebarProvider } from "@/components/ui/sidebar";import { server } from "@/mocks/mock-server";import { CredentialsProvidersContext } from "@/providers/agent-credentials/credentials-provider";import {@@ -24,7 +23,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { RecipientChip } from "../components/ChatInput/components/RecipientChip";import { useRecipientPicker } from "../components/EmptySession/useRecipientPicker";import { ChatMessagesContainer } from "../components/ChatMessagesContainer/ChatMessagesContainer";-import { ChatSidebar } from "../components/ChatSidebar/ChatSidebar";import { useChatSession } from "../useChatSession";import { getNewChatHref } from "@/components/layout/AppSidebar/components/RecentChats/helpers";import { useCopilotUIStore } from "../store";@@ -70,12 +68,6 @@ vi.mock(UsagePopover: () => null,}),);-vi.mock(- "../components/ChatSidebar/components/NotificationToggle/NotificationToggle",- () => ({- NotificationToggle: () => null,- }),-);vi.mock("use-stick-to-bottom", () => ({useStickToBottomContext: () => ({@@ -236,6 +228,23 @@ function AutopilotSessionHarness() {);}+/** Mirrors the app sidebar's New Chat link, which lands on /home with neither+ * a session nor an expert in the URL. */+function NewChatButton() {+ const [, setSessionId] = useQueryState("sessionId", parseAsString);+ const [, setExpertId] = useQueryState("expertId", parseAsString);+ return (+ <button+ onClick={() => {+ void setSessionId(null);+ void setExpertId(null);+ }}+ >+ New Chat+ </button>+ );+}+/** Mirrors `CopilotPage`, which keys the chat host on the session id — every* session change (including "New Chat" clearing it) remounts `useChatSession`* with fresh refs. */@@ -627,10 +636,8 @@ describe("useChatSession — expert sessions", () => {render(<NuqsWrapper>- <SidebarProvider>- <ChatSidebar />- <KeyedSessionHost />- </SidebarProvider>+ <NewChatButton />+ <KeyedSessionHost /></NuqsWrapper>,);@@ -640,12 +647,10 @@ describe("useChatSession — expert sessions", () => {);});- // Click inside waitFor, re-querying each attempt: the sidebar re-renders- // as the adoption lands and the session list arrives, which can replace- // the button node between a one-shot query and its click (a click on the- // detached node is a no-op). Re-clicking is idempotent (sets null).+ // Re-clicking is idempotent (sets null), so click inside waitFor in case+ // the adoption effect bounces the session back once before settling.await waitFor(() => {- fireEvent.click(screen.getAllByRole("button", { name: "New Chat" })[0]);+ fireEvent.click(screen.getByRole("button", { name: "New Chat" }));expect(screen.getByTestId("session-id").textContent).toBe("none");});// The remount re-runs the adoption effect against a warm cache, so give it@@ -680,220 +685,6 @@ describe("groupSessionsByExpert", () => {});});-describe("ChatSidebar — expert groups", () => {- it("groups expert threads under expert name headers with Otto as the default group", async () => {- server.use(- getGetV2ListSessionsMockHandler200({- sessions: [- makeSession({ id: "s1", title: "Plain chat" }),- makeSession({- id: "s2",- title: "Campaign ideas",- expert_id: "expert-maria",- }),- ],- total: 2,- }),- getListExpertIdentitiesMockHandler([mariaExpert]),- );-- render(- <SidebarProvider>- <ChatSidebar />- </SidebarProvider>,- );-- await screen.findByText("Plain chat");- const mariaHeader = await screen.findByTestId(- "expert-group-header-expert-maria",- );- expect(within(mariaHeader).getByText("Maria")).toBeDefined();- expect(within(mariaHeader).getByText(mariaExpert.role)).toBeDefined();- expect(- within(screen.getByTestId("expert-group-header-autopilot")).getByText(- "Otto",- ),- ).toBeDefined();- expect(screen.getByText("Campaign ideas")).toBeDefined();- });-- it("renders no group headers when the user has no expert threads", async () => {- server.use(- getGetV2ListSessionsMockHandler200({- sessions: [- makeSession({ id: "s1", title: "Plain chat" }),- makeSession({ id: "s2", title: "Another plain chat" }),- ],- total: 2,- }),- getListExpertIdentitiesMockHandler([]),- );-- render(- <SidebarProvider>- <ChatSidebar />- </SidebarProvider>,- );-- await screen.findByText("Plain chat");- expect(screen.getByText("Another plain chat")).toBeDefined();- expect(screen.queryByTestId("expert-group-header-autopilot")).toBeNull();- });-- it("keeps pinned chats above the groups so pinning still floats expert threads", async () => {- flagState.values = { "hire-experts": true, "chat-pinning": true };- server.use(- getGetV2ListSessionsMockHandler200({- sessions: [- makeSession({- id: "s-pinned",- title: "Pinned campaign",- expert_id: "expert-maria",- is_pinned: true,- }),- makeSession({ id: "s-plain", title: "Plain chat" }),- makeSession({- id: "s-maria",- title: "Campaign ideas",- expert_id: "expert-maria",- }),- ],- total: 3,- }),- getListExpertIdentitiesMockHandler([mariaExpert]),- );-- render(- <SidebarProvider>- <ChatSidebar />- </SidebarProvider>,- );-- const pinnedSection = await screen.findByTestId(- "expert-group-header-pinned",- );- expect(pinnedSection.textContent).toBe("Pinned");-- const pinnedGroup = pinnedSection.closest('[role="group"]');- expect(pinnedGroup).not.toBeNull();- expect(within(pinnedGroup as HTMLElement).getByText("Pinned campaign"));-- // The pinned chat is lifted out of Maria's group, which keeps the rest.- const mariaGroup = screen- .getByTestId("expert-group-header-expert-maria")- .closest('[role="group"]') as HTMLElement;- expect(within(mariaGroup).getByText("Campaign ideas")).toBeDefined();- expect(within(mariaGroup).queryByText("Pinned campaign")).toBeNull();- });-- it("shows the first four chats of an expert and reveals the rest via Load more", async () => {- server.use(- getGetV2ListSessionsMockHandler200({- sessions: [- makeSession({ id: "s-plain", title: "Plain chat" }),- ...Array.from({ length: 7 }, (_, i) =>- makeSession({- id: `s-maria-${i + 1}`,- title: `Maria chat ${i + 1}`,- expert_id: "expert-maria",- }),- ),- ],- total: 8,- }),- getListExpertIdentitiesMockHandler([mariaExpert]),- );-- render(- <SidebarProvider>- <ChatSidebar />- </SidebarProvider>,- );-- await screen.findByText("Maria chat 1");- expect(screen.getByText("Maria chat 4")).toBeDefined();- expect(screen.queryByText("Maria chat 5")).toBeNull();-- fireEvent.click(screen.getByTestId("expert-group-load-more-expert-maria"));- expect(screen.getByText("Maria chat 6")).toBeDefined();- expect(screen.getByText("Maria chat 7")).toBeDefined();- expect(- screen.queryByTestId("expert-group-load-more-expert-maria"),- ).toBeNull();- // Otto's single chat never needs a Load more button.- expect(screen.queryByTestId("expert-group-load-more-autopilot")).toBeNull();- });-- it("collapses and expands an expert group from its header", async () => {- server.use(- getGetV2ListSessionsMockHandler200({- sessions: [- makeSession({ id: "s-plain", title: "Plain chat" }),- makeSession({- id: "s-maria",- title: "Campaign ideas",- expert_id: "expert-maria",- }),- ],- total: 2,- }),- getListExpertIdentitiesMockHandler([mariaExpert]),- );-- render(- <SidebarProvider>- <ChatSidebar />- </SidebarProvider>,- );-- await screen.findByText("Campaign ideas");- const header = screen.getByTestId("expert-group-header-expert-maria");-- fireEvent.click(header);- await waitFor(() => {- expect(screen.queryByText("Campaign ideas")).toBeNull();- });- expect(screen.getByText("Plain chat")).toBeDefined();-- fireEvent.click(header);- expect(await screen.findByText("Campaign ideas")).toBeDefined();- });-- it("does not fetch experts or group sessions when the flag is off", async () => {- flagState.values = { "hire-experts": false };- let expertsRequests = 0;- server.use(- http.get("*/api/experts/identities", () => {- expertsRequests += 1;- return HttpResponse.json([mariaExpert]);- }),- getGetV2ListSessionsMockHandler200({- sessions: [- makeSession({ id: "s1", title: "Plain chat" }),- makeSession({- id: "s2",- title: "Campaign ideas",- expert_id: "expert-maria",- }),- ],- total: 2,- }),- );-- render(- <SidebarProvider>- <ChatSidebar />- </SidebarProvider>,- );-- await screen.findByText("Plain chat");- expect(screen.getByText("Campaign ideas")).toBeDefined();- expect(screen.queryByTestId("expert-group-header-autopilot")).toBeNull();- expect(screen.queryByTestId("expert-group-header-expert-maria")).toBeNull();- expect(expertsRequests).toBe(0);- });-});-describe("ChatMessagesContainer — expert identity", () => {const assistantMessage = {id: "m1",diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/low-credit-banner.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/low-credit-banner.test.tsxindex 966705f57a..8e7dc6bff0 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/low-credit-banner.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/low-credit-banner.test.tsx@@ -15,15 +15,6 @@ import { CopilotPage } from "../CopilotPage";vi.mock("../components/ChatContainer/ChatContainer", () => ({ChatContainer: () => <div data-testid="chat-container" />,}));-vi.mock("../components/ChatSidebar/ChatSidebar", () => ({- ChatSidebar: () => <div data-testid="chat-sidebar" />,-}));-vi.mock("../components/MobileDrawer/MobileDrawer", () => ({- MobileDrawer: () => null,-}));-vi.mock("../components/MobileHeader/MobileHeader", () => ({- MobileHeader: () => null,-}));vi.mock("../components/NotificationBanner/NotificationBanner", () => ({NotificationBanner: () => null,}));diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store-selectors.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store-selectors.test.tsxindex 54ce5e5ea8..81a6a61cc2 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store-selectors.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store-selectors.test.tsx@@ -13,7 +13,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { useChatInput } from "../components/ChatInput/useChatInput";import { useConnectionPicker } from "../components/ChatInput/components/ConnectionPicker/useConnectionPicker";import { useLockedTierFallback } from "../components/ChatInput/components/ConnectionPicker/useLockedTierFallback";-import { NotificationToggle } from "../components/ChatSidebar/components/NotificationToggle/NotificationToggle";import { NotificationDialog } from "../components/NotificationDialog/NotificationDialog";import { DEFAULT_PANEL_WIDTH, useCopilotUIStore } from "../store";import { useSessionDeletion } from "../useSessionDeletion";@@ -173,18 +172,6 @@ describe("copilot UI store readers", () => {await waitFor(() => expect(result.current.value).toBe("Hello Otto"));});- it("NotificationToggle ignores unrelated writes", async () => {- const { onRender } = countComponentCommits(<NotificationToggle />);- await settle();- onRender.mockClear();-- writeUnrelatedField();- expect(onRender).not.toHaveBeenCalled();-- act(() => useCopilotUIStore.getState().toggleSound());- expect(onRender).toHaveBeenCalled();- });-it("NotificationDialog ignores unrelated writes", async () => {const { onRender } = countComponentCommits(<NotificationDialog />);await settle();diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsxindex 444aa677d0..a8b70b249e 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsx@@ -20,16 +20,12 @@ import { ExpertAvatar } from "./ExpertAvatar/ExpertAvatar";// Otto's product-facing title when a session carries no expert identity.const DEFAULT_EXPERT_ROLE = "Head of AI";-export type FloatingControls = "classic" | "newLayout";+export type FloatingControls = "newLayout";-// Below `lg` the chip joins the floating controls' row. Classic: centred on-// MobileHeader's 46px buttons (20px down, 16px in), one button gap after the-// last one; the chat column starts 8px in. New layout: the sidebar button-// moves into the chip itself (see PlatformChrome) and the files and-// integrations buttons onto the composer (ComposerPanelTab), so the chip-// stands alone, centred near the top edge.+// Below `lg` the sidebar button moves into the chip itself (see+// PlatformChrome) and the files and integrations buttons onto the composer+// (ComposerPanelTab), so the chip stands alone, centred near the top edge.const floatingControlsClassName: Record<FloatingControls, string> = {- classic: "max-lg:top-5 max-lg:pl-[116px]",newLayout: "max-lg:top-2 max-lg:justify-center",};@@ -62,7 +58,6 @@ export function ThreadHeader({const role = expertIdentity?.role ?? DEFAULT_EXPERT_ROLE;const jobTitle = expertIdentity?.jobTitle;const roleLabel = jobTitle || getExpertRoleLabel(role);- // Only the new layout mounts the app sidebar.const hasSidebar = Boolean(useAppSidebarToggle());const hasSidebarButton = floatingControls === "newLayout" && hasSidebar;diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/ChatSearchResults.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/ChatSearchResults.tsxdeleted file mode 100644index 1c08465623..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/ChatSearchResults.tsx+++ /dev/null@@ -1,188 +0,0 @@-import { Button } from "@/components/ui/button";-import { cn } from "@/lib/utils";-import { AnimatePresence, motion, useReducedMotion } from "framer-motion";-import type { MutableRefObject } from "react";-import { shouldShowSessionProcessingIndicator } from "../../sessionActivity";-import { ChatOriginIcon } from "../ChatOriginIcon/ChatOriginIcon";-import { getSessionTitle, highlightMatch, type SearchSession } from "./helpers";-import {- BubbleChatIcon,- CheckmarkCircle02Icon,- HourglassIcon,- Loading03Icon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--const indicatorTransition = {- type: "spring" as const,- damping: 30,- stiffness: 520,- mass: 0.8,-};--interface Props {- results: SearchSession[];- query: string;- highlightedIndex: number;- highlightedResultRef: MutableRefObject<HTMLButtonElement | null>;- currentSessionId: string | null;- completedSessionIDs: Set<string>;- sessionNeedsReload: Record<string, boolean>;- onHighlight: (index: number) => void;- onSelect: (id: string) => void;-}--export function ChatSearchResults({- results,- query,- highlightedIndex,- highlightedResultRef,- currentSessionId,- completedSessionIDs,- sessionNeedsReload,- onHighlight,- onSelect,-}: Props) {- const reduceMotion = useReducedMotion();- return (- <div role="listbox" aria-label="Chat sessions" className="flex flex-col">- {results.map((session, index) => {- const isHighlighted = index === highlightedIndex;- const title = getSessionTitle(session);-- return (- <Button- key={session.id}- ref={isHighlighted ? highlightedResultRef : undefined}- id={`chat-search-result-${session.id}`}- type="button"- variant="ghost"- role="option"- aria-selected={isHighlighted}- onMouseEnter={() => onHighlight(index)}- onClick={() => onSelect(session.id)}- className={cn(- "relative h-auto w-full justify-start rounded-md px-3 py-2 text-left hover:bg-transparent",- )}- >- {isHighlighted && (- <>- <motion.div- layoutId="chat-search-highlight"- aria-hidden="true"- className="absolute inset-0 z-0 rounded-md bg-zinc-100"- transition={- reduceMotion ? { duration: 0 } : indicatorTransition- }- />- <motion.div- layoutId="chat-search-highlight-bar"- aria-hidden="true"- className="absolute inset-y-0 left-0 z-[1] my-auto h-5 w-[3px] rounded-full bg-zinc-900"- transition={- reduceMotion ? { duration: 0 } : indicatorTransition- }- />- </>- )}- <div className="relative z-10 flex min-w-0 flex-1 items-center gap-2.5">- <Icon- icon={BubbleChatIcon}- aria-hidden="true"- className={cn(- "h-4 w-4 shrink-0 transition-colors duration-150",- isHighlighted ? "text-zinc-900" : "text-zinc-500",- )}- />- <ChatOriginIcon sourcePlatform={session.source_platform} />- <div className="min-w-0 flex-1">- <div- className={cn(- "truncate text-sm font-normal transition-colors duration-150",- isHighlighted ? "text-zinc-950" : "text-zinc-800",- session.id === currentSessionId && "text-zinc-600",- )}- >- {highlightMatch(title, query).map((part, partIndex) => (- <span- key={`${part.text}-${partIndex}`}- className={part.isMatch ? "font-semibold" : undefined}- >- {part.text}- </span>- ))}- </div>- </div>- {session.chat_status === "running" && (- <span- aria-label="Session running"- className="inline-flex h-4 w-4 shrink-0 items-center justify-center"- >- <span className="h-2 w-2 animate-pulse rounded-full bg-emerald-500" />- </span>- )}- {session.chat_status === "queued" && (- <span- aria-label="Session queued"- className="inline-flex h-4 w-4 shrink-0 items-center justify-center text-purple-600"- >- <Icon icon={HourglassIcon} className="h-3.5 w-3.5" />- </span>- )}- {session.chat_status !== "running" &&- session.is_processing &&- shouldShowSessionProcessingIndicator({- sessionId: session.id,- currentSessionId,- isProcessing: session.is_processing,- hasCompletedIndicator: completedSessionIDs.has(session.id),- needsReload: !!sessionNeedsReload[session.id],- }) && (- <Icon- icon={Loading03Icon}- aria-label="Session processing"- className="h-4 w-4 shrink-0 animate-spin text-zinc-400"- />- )}- {completedSessionIDs.has(session.id) &&- session.id !== currentSessionId && (- <Icon- icon={CheckmarkCircle02Icon}- aria-label="Session completed"- className="h-4 w-4 shrink-0 text-green-500"- />- )}- <AnimatePresence initial={false}>- {isHighlighted && (- <motion.span- aria-hidden="true"- initial={- reduceMotion- ? { opacity: 0 }- : { opacity: 0, scale: 0.95, x: 80 }- }- animate={- reduceMotion- ? { opacity: 1 }- : { opacity: 1, scale: 1, x: 0 }- }- exit={- reduceMotion- ? { opacity: 0 }- : { opacity: 0, scale: 0.95, x: 80 }- }- transition={{ duration: 0.26, ease: [0.22, 1, 0.36, 1] }}- style={{ willChange: "transform, opacity" }}- className="inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-md border border-zinc-200 bg-white px-1 font-sans text-[11px] text-zinc-600 shadow-[inset_0_-1px_0_rgba(15,15,20,0.04),0_1px_1px_rgba(15,15,20,0.04)]"- >- ↵- </motion.span>- )}- </AnimatePresence>- </div>- </Button>- );- })}- </div>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/__tests__/helpers.test.tsdeleted file mode 100644index 2b04afbdd1..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/__tests__/helpers.test.ts+++ /dev/null@@ -1,91 +0,0 @@-import { describe, expect, it } from "vitest";-import {- filterSessions,- formatRelativeDate,- highlightMatch,- type SearchSession,-} from "../helpers";--const sessions: SearchSession[] = [- {- id: "older",- title: "Weekly update",- updated_at: "2025-01-01T00:00:00Z",- },- {- id: "newer",- title: "Revenue forecast",- updated_at: "2025-01-03T00:00:00Z",- },- {- id: "middle",- title: "Forecast follow-up",- updated_at: "2025-01-02T00:00:00Z",- },-];--describe("filterSessions", () => {- it("returns recent sessions sorted newest first for an empty query", () => {- expect(filterSessions(sessions, "").map((session) => session.id)).toEqual([- "newer",- "middle",- "older",- ]);- });-- it("filters titles case-insensitively and keeps newest first", () => {- expect(- filterSessions(sessions, "FORECAST").map((session) => session.id),- ).toEqual(["newer", "middle"]);- });-- it("limits active search results to 20 sessions", () => {- const manySessions = Array.from({ length: 25 }, (_, index) => ({- id: String(index),- title: `Searchable ${index}`,- updated_at: `2025-01-${String(index + 1).padStart(2, "0")}T00:00:00Z`,- }));-- expect(filterSessions(manySessions, "searchable")).toHaveLength(20);- });-});--describe("highlightMatch", () => {- it("marks the matched title substring", () => {- expect(highlightMatch("Revenue forecast", "fore")).toEqual([- { text: "Revenue ", isMatch: false },- { text: "fore", isMatch: true },- { text: "cast", isMatch: false },- ]);- });-- it("returns plain text when there is no query", () => {- expect(highlightMatch("Revenue forecast", "")).toEqual([- { text: "Revenue forecast", isMatch: false },- ]);- });-});--describe("formatRelativeDate", () => {- const baseDate = new Date("2025-01-10T12:00:00Z");-- it("formats recent days", () => {- expect(formatRelativeDate("2025-01-10T00:00:00Z", baseDate)).toBe("Today");- expect(formatRelativeDate("2025-01-09T00:00:00Z", baseDate)).toBe(- "Yesterday",- );- expect(formatRelativeDate("2025-01-07T00:00:00Z", baseDate)).toBe(- "3 days ago",- );- });-- it("formats older dates", () => {- // formatRelativeDate renders in the runner's LOCAL timezone. Construct the- // input from local calendar parts (not a UTC-midnight string, which lands- // on the previous day west of UTC) so the assertion holds in any timezone.- const older = new Date(2025, 0, 1, 12, 0, 0);- expect(formatRelativeDate(older.toISOString(), baseDate)).toBe(- "1st Jan 2025",- );- });-});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/helpers.tsdeleted file mode 100644index 2ca12b0465..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/helpers.ts+++ /dev/null@@ -1,90 +0,0 @@-export interface SearchSession {- id: string;- title?: string | null;- updated_at: string;- is_processing?: boolean;- chat_status?: string | null;- source_platform?: string | null;-}--export interface HighlightPart {- text: string;- isMatch: boolean;-}--const EMPTY_QUERY_LIMIT = 10;-const ACTIVE_QUERY_LIMIT = 20;--function getSessionTimestamp(session: SearchSession) {- const timestamp = new Date(session.updated_at).getTime();- return Number.isNaN(timestamp) ? 0 : timestamp;-}--function getTitle(session: SearchSession) {- return session.title || "Untitled chat";-}--export function filterSessions(- sessions: SearchSession[],- query: string,-): SearchSession[] {- const normalizedQuery = query.trim().toLocaleLowerCase();- const sortedSessions = [...sessions].sort(- (a, b) => getSessionTimestamp(b) - getSessionTimestamp(a),- );-- if (!normalizedQuery) {- return sortedSessions.slice(0, EMPTY_QUERY_LIMIT);- }-- return sortedSessions- .filter((session) =>- getTitle(session).toLocaleLowerCase().includes(normalizedQuery),- )- .slice(0, ACTIVE_QUERY_LIMIT);-}--export function highlightMatch(title: string, query: string): HighlightPart[] {- const normalizedQuery = query.trim().toLocaleLowerCase();- if (!normalizedQuery) return [{ text: title, isMatch: false }];-- const matchIndex = title.toLocaleLowerCase().indexOf(normalizedQuery);- if (matchIndex === -1) return [{ text: title, isMatch: false }];-- const matchEnd = matchIndex + normalizedQuery.length;- return [- { text: title.slice(0, matchIndex), isMatch: false },- { text: title.slice(matchIndex, matchEnd), isMatch: true },- { text: title.slice(matchEnd), isMatch: false },- ].filter((part) => part.text.length > 0);-}--export function formatRelativeDate(dateString: string, baseDate = new Date()) {- const date = new Date(dateString);- if (Number.isNaN(date.getTime())) return "";-- const diffMs = baseDate.getTime() - date.getTime();- const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));-- if (diffDays <= 0) return "Today";- if (diffDays === 1) return "Yesterday";- if (diffDays < 7) return `${diffDays} days ago`;-- const day = date.getDate();- const ordinal =- day % 10 === 1 && day !== 11- ? "st"- : day % 10 === 2 && day !== 12- ? "nd"- : day % 10 === 3 && day !== 13- ? "rd"- : "th";- const month = date.toLocaleDateString("en-US", { month: "short" });- const year = date.getFullYear();-- return `${day}${ordinal} ${month} ${year}`;-}--export function getSessionTitle(session: SearchSession) {- return getTitle(session);-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/useChatSearch.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/useChatSearch.tsdeleted file mode 100644index 087bc3d18b..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSearchModal/useChatSearch.ts+++ /dev/null@@ -1,74 +0,0 @@-import { useEffect, useRef, useState } from "react";-import { filterSessions, type SearchSession } from "./helpers";--const DEBOUNCE_MS = 150;--export function useChatSearch(sessions: SearchSession[], isOpen: boolean) {- const [query, setQuery] = useState("");- const [debouncedQuery, setDebouncedQuery] = useState("");- const [highlightedIndex, setHighlightedIndex] = useState(0);- const highlightedResultRef = useRef<HTMLButtonElement | null>(null);-- useEffect(() => {- if (!isOpen) {- setQuery("");- setDebouncedQuery("");- setHighlightedIndex(0);- }- }, [isOpen]);-- useEffect(() => {- const timeout = window.setTimeout(() => {- setDebouncedQuery(query);- }, DEBOUNCE_MS);-- return () => window.clearTimeout(timeout);- }, [query]);-- const results = filterSessions(sessions, debouncedQuery);-- useEffect(() => {- setHighlightedIndex(0);- }, [debouncedQuery, sessions.length]);-- useEffect(() => {- if (highlightedIndex >= results.length) {- setHighlightedIndex(Math.max(0, results.length - 1));- }- }, [highlightedIndex, results.length]);-- useEffect(() => {- highlightedResultRef.current?.scrollIntoView({- block: "nearest",- });- }, [highlightedIndex]);-- function moveHighlight(direction: 1 | -1) {- if (results.length === 0) return;- setHighlightedIndex((current) => {- const next = current + direction;- if (next < 0 || next >= results.length) return current;- return next;- });- }-- function clearQuery() {- setQuery("");- setDebouncedQuery("");- }-- const isSearching = debouncedQuery.trim().length > 0;-- return {- query,- debouncedQuery,- setQuery,- clearQuery,- results,- highlightedIndex,- setHighlightedIndex,- highlightedResultRef,- moveHighlight,- isSearching,- };-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSessionBlock/ChatSessionBlock.stories.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSessionBlock/ChatSessionBlock.stories.tsxdeleted file mode 100644index 3f21c13b53..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSessionBlock/ChatSessionBlock.stories.tsx+++ /dev/null@@ -1,144 +0,0 @@-import type { ComponentProps } from "react";-import type { Meta, StoryObj } from "@storybook/nextjs";-import { ChatSessionBlock } from "./ChatSessionBlock";--function daysAgo(days: number) {- const date = new Date();- date.setDate(date.getDate() - days);- return date.toISOString();-}--function renderSessionBlock(args: ComponentProps<typeof ChatSessionBlock>) {- return (- <button- type="button"- className={[- "w-full rounded-lg px-3 py-2.5 text-left transition-colors",- args.isActive ? "bg-zinc-100" : "bg-white hover:bg-zinc-50",- ].join(" ")}- >- <ChatSessionBlock {...args} />- </button>- );-}--const meta: Meta<typeof ChatSessionBlock> = {- title: "Copilot/ChatSessionBlock",- component: ChatSessionBlock,- tags: ["autodocs"],- parameters: {- layout: "centered",- docs: {- description: {- component:- "Copilot session row content used in the chat sidebar and mobile drawer, including external-platform origin logos.",- },- },- },- decorators: [- (Story) => (- <div className="w-80 rounded-lg border border-zinc-100 bg-zinc-50 p-3">- <Story />- </div>- ),- ],- render: renderSessionBlock,- args: {- title: "Review Discord support flow",- updatedAt: new Date().toISOString(),- sourcePlatform: "discord",- },-};--export default meta;-type Story = StoryObj<typeof meta>;--export const Discord: Story = {};--export const SlackActive: Story = {- args: {- title: "Triage Slack escalation",- updatedAt: daysAgo(1),- sourcePlatform: "slack",- isActive: true,- },-};--export const TelegramQueued: Story = {- args: {- title: "Telegram onboarding message",- updatedAt: daysAgo(2),- sourcePlatform: "telegram",- chatStatus: "queued",- },-};--export const GitHubRunning: Story = {- args: {- title: "Investigate GitHub issue",- updatedAt: daysAgo(3),- sourcePlatform: "github",- chatStatus: "running",- },-};--export const LinearCompleted: Story = {- args: {- title: "Summarize Linear ticket",- updatedAt: daysAgo(4),- sourcePlatform: "linear",- showCompleted: true,- },-};--export const Pinned: Story = {- args: {- title: "Pinned project plan",- updatedAt: daysAgo(2),- showPinned: true,- },-};--export const PlatformMatrix: Story = {- render: () => (- <div className="space-y-1">- {[- {- title: "Discord community report",- sourcePlatform: "discord",- updatedAt: new Date().toISOString(),- },- {- title: "Slack customer question",- sourcePlatform: "slack",- updatedAt: daysAgo(1),- isActive: true,- },- {- title: "Telegram lead follow-up",- sourcePlatform: "telegram",- updatedAt: daysAgo(2),- chatStatus: "queued",- },- {- title: "GitHub issue analysis",- sourcePlatform: "github",- updatedAt: daysAgo(3),- chatStatus: "running",- },- {- title: "Linear sprint update",- sourcePlatform: "linear",- updatedAt: daysAgo(4),- showCompleted: true,- },- {- title: "Native Copilot chat",- updatedAt: daysAgo(8),- },- ].map((session) => (- <div key={session.title}>{renderSessionBlock(session)}</div>- ))}- </div>- ),-};diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSessionBlock/ChatSessionBlock.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSessionBlock/ChatSessionBlock.tsxdeleted file mode 100644index 2fac6363d8..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSessionBlock/ChatSessionBlock.tsx+++ /dev/null@@ -1,132 +0,0 @@-"use client";--import { Text } from "@/components/atoms/Text/Text";-import { cn } from "@/lib/utils";-import type { ReactNode } from "react";-import { ChatOriginIcon } from "../ChatOriginIcon/ChatOriginIcon";-import {- CheckmarkCircle02Icon,- HourglassIcon,- Loading03Icon,- PinIcon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--interface Props {- title?: string | null;- titleContent?: ReactNode;- updatedAt: string;- sourcePlatform?: string | null;- isActive?: boolean;- chatStatus?: string | null;- showProcessing?: boolean;- showCompleted?: boolean;- showPinned?: boolean;- className?: string;-}--function formatDate(dateString: string) {- const date = new Date(dateString);- const now = new Date();- const diffMs = now.getTime() - date.getTime();- const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));-- if (diffDays === 0) return "Today";- if (diffDays === 1) return "Yesterday";- if (diffDays < 7) return `${diffDays} days ago`;-- const day = date.getDate();- const ordinal =- day % 10 === 1 && day !== 11- ? "st"- : day % 10 === 2 && day !== 12- ? "nd"- : day % 10 === 3 && day !== 13- ? "rd"- : "th";- const month = date.toLocaleDateString("en-US", { month: "short" });- const year = date.getFullYear();-- return `${day}${ordinal} ${month} ${year}`;-}--export function ChatSessionBlock({- title,- titleContent,- updatedAt,- sourcePlatform,- isActive = false,- chatStatus,- showProcessing = false,- showCompleted = false,- showPinned = false,- className,-}: Props) {- const displayTitle = title || "Untitled chat";-- return (- <div- className={cn("flex min-w-0 max-w-full items-center gap-2", className)}- >- <div className="min-w-0 flex-1">- <div className="flex min-w-0 items-center">- <Text- variant="body"- className={cn(- "min-w-0 flex-1 truncate font-normal",- isActive ? "text-zinc-600" : "text-zinc-800",- )}- >- {titleContent || displayTitle}- </Text>- </div>- <div className="flex items-center gap-1.5">- {showPinned ? (- <Icon- icon={PinIcon}- aria-label="Pinned"- data-testid="session-pinned-indicator"- className="h-3 w-3 shrink-0 text-neutral-400"- />- ) : null}- <Text variant="small" className="text-neutral-400">- {formatDate(updatedAt)}- </Text>- <ChatOriginIcon sourcePlatform={sourcePlatform} />- </div>- </div>- {chatStatus === "running" ? (- <span- aria-label="Session running"- title="Running"- data-testid="session-status-running"- className="inline-flex h-4 w-4 shrink-0 items-center justify-center"- >- <span className="h-2 w-2 animate-pulse rounded-full bg-emerald-500" />- </span>- ) : null}- {chatStatus === "queued" ? (- <span- aria-label="Session queued"- title="Queued"- data-testid="session-status-queued"- className="inline-flex h-4 w-4 shrink-0 items-center justify-center text-purple-600"- >- <Icon icon={HourglassIcon} className="h-3.5 w-3.5" />- </span>- ) : null}- {chatStatus !== "running" && showProcessing ? (- <Icon- icon={Loading03Icon}- className="h-4 w-4 shrink-0 animate-spin text-zinc-400"- />- ) : null}- {showCompleted ? (- <Icon- icon={CheckmarkCircle02Icon}- className="h-4 w-4 shrink-0 text-green-500"- />- ) : null}- </div>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsxdeleted file mode 100644index 2da968985f..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx+++ /dev/null@@ -1,563 +0,0 @@-"use client";-import {- getV2GetSession,- usePatchV2UpdateSessionPinned,- usePatchV2UpdateSessionTitle,-} from "@/app/api/__generated__/endpoints/chat/chat";-import { useExcludeSkillLearningSource } from "@/app/api/__generated__/endpoints/skill-learning/skill-learning";-import { CHAT_SOURCE_KIND } from "@/services/skill-learning/helpers";-import type { SessionSummaryResponse } from "@/app/api/__generated__/models/sessionSummaryResponse";-import { Button } from "@/components/atoms/Button/Button";-import { LoadingSpinner } from "@/components/atoms/LoadingSpinner/LoadingSpinner";-import { Text } from "@/components/atoms/Text/Text";-import { Button as ShadcnButton } from "@/components/ui/button";-import { toast } from "@/components/molecules/Toast/use-toast";-import {- Sidebar,- SidebarContent,- SidebarHeader,- SidebarTrigger,- useSidebar,-} from "@/components/ui/sidebar";-import { cn } from "@/lib/utils";-import { ApiError } from "@/lib/autogpt-server-api/helpers";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";-import { ShareChatDialog } from "../../sharing/ShareChatDialog";-import { useQueryClient } from "@tanstack/react-query";-import { motion } from "framer-motion";-import { parseAsString, useQueryState } from "nuqs";-import { useEffect, useMemo, useRef, useState } from "react";-import { useStableCallback } from "@/hooks/useStableCallback";-import { useCopilotChatRuntimeStore } from "../../copilotChatRegistry";-import { fetchAndExportChat } from "../../helpers/exportChatAsMarkdown";-import { shouldShowSessionProcessingIndicator } from "../../sessionActivity";-import { useCopilotUIStore } from "../../store";-import { useSessionDeletion } from "../../useSessionDeletion";-import { useExpertMap } from "../../useExpertMap";-import {- groupSessionsForSidebar,- SESSION_LIST_QUERY_KEY,- useSessionList,-} from "../../useSessionList";-import { useGlobalSearchStore } from "@/app/(platform)/components/GlobalSearchModal/useGlobalSearchStore";-import { useRouter } from "next/navigation";-import { ChatSessionRow } from "./components/ChatSessionRow/ChatSessionRow";-import { ExpertSessionGroup } from "./components/ExpertSessionGroup/ExpertSessionGroup";-import { HeaderAction } from "./components/HeaderAction";-import { DeleteChatDialog } from "../DeleteChatDialog/DeleteChatDialog";-import { UsagePopover } from "../UsageLimits/UsagePopover/UsagePopover";-import { NotificationToggle } from "./components/NotificationToggle/NotificationToggle";-import { sessionAgeDays, useSessionAgeClock } from "./useSessionAgeClock";-import {- Files01Icon,- PlusSignCircleIcon,- PlusSignIcon,- Search01Icon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--export function ChatSidebar() {- const { state } = useSidebar();- const isCollapsed = state === "collapsed";- const [sessionId, setSessionId] = useQueryState("sessionId", parseAsString);- const completedSessionIDs = useCopilotUIStore((s) => s.completedSessionIDs);- const openSearch = useGlobalSearchStore((state) => state.openSearch);- const closeSearch = useGlobalSearchStore((state) => state.closeSearch);- const isChatSearchEnabled = useGetFlag(Flag.CHAT_SEARCH);- const isArtifactsEnabled = useGetFlag(Flag.ARTIFACTS_PAGE);- const router = useRouter();- const sessionNeedsReload = useCopilotChatRuntimeStore(- (state) => state.sessionNeedsReload,- );-- const queryClient = useQueryClient();-- const {- sessions,- isLoading: isLoadingSessions,- hasMore,- isLoadingMore,- loadMore,- } = useSessionList();-- const {- sessionToDelete,- isDeleting,- requestDelete,- confirmDelete,- cancelDelete,- } = useSessionDeletion();-- const [editingSessionId, setEditingSessionId] = useState<string | null>(null);- const [editingTitle, setEditingTitle] = useState("");- const [exportingSessionIds, setExportingSessionIds] = useState<Set<string>>(- new Set(),- );- const [sharingSessionId, setSharingSessionId] = useState<string | null>(null);- const renameInputRef = useRef<HTMLInputElement>(null);- const renameCancelledRef = useRef(false);- const isPinningEnabled = useGetFlag(Flag.CHAT_PINNING);- const isExpertsEnabled = useGetFlag(Flag.HIRE_EXPERTS);- const isLearningEnabled = useGetFlag(Flag.DREAM_SKILL_LEARNING_ENABLED);- const { mutate: excludeFromLearning } = useExcludeSkillLearningSource({- mutation: {- onSuccess: () => {- toast({- title: "Excluded from learning",- description:- "This chat will not be used for future skill learning. Skills " +- "that depended on it were restored or paused.",- });- },- onError: (error) => {- toast({- title: "Could not exclude this chat",- description:- error instanceof ApiError- ? error.message- : "Nothing has been recorded for this chat yet.",- variant: "destructive",- });- },- },- });- const { expertsById } = useExpertMap();- const [, setExpertIdParam] = useQueryState("expertId", parseAsString);-- const { mutate: setSessionPinned } = usePatchV2UpdateSessionPinned({- mutation: {- onSuccess: () => {- queryClient.invalidateQueries({- queryKey: SESSION_LIST_QUERY_KEY,- });- },- onError: (error) => {- const description =- error instanceof ApiError- ? ((error.response as { detail?: string } | undefined)?.detail ??- error.message)- : error instanceof Error- ? error.message- : "An error occurred";- toast({- title: "Failed to update chat",- description,- variant: "destructive",- });- },- },- });-- const { mutate: renameSession } = usePatchV2UpdateSessionTitle({- mutation: {- onSuccess: () => {- queryClient.invalidateQueries({- queryKey: SESSION_LIST_QUERY_KEY,- });- setEditingSessionId(null);- },- onError: (error) => {- toast({- title: "Failed to rename chat",- description:- error instanceof Error ? error.message : "An error occurred",- variant: "destructive",- });- setEditingSessionId(null);- },- },- });-- // Auto-focus the rename input when editing starts- useEffect(() => {- if (editingSessionId && renameInputRef.current) {- renameInputRef.current.focus();- renameInputRef.current.select();- }- }, [editingSessionId]);-- // Refetch session list when active session changes- useEffect(() => {- queryClient.invalidateQueries({- queryKey: SESSION_LIST_QUERY_KEY,- });- }, [sessionId, queryClient]);-- function handleNewChat() {- setSessionId(null);- // Without this the ?expertId= deep-link adoption in `useChatSession`- // re-runs on the remount and drops the user straight back into that- // expert's latest thread, making New Chat a no-op.- if (isExpertsEnabled) {- setExpertIdParam(null);- }- }-- // Row handlers are shared by every row and keep one identity across renders- // (see `ChatSessionRow`), so a list update only re-renders the rows whose- // own props changed.- const handleSelectSession = useStableCallback(- (id: string, expertId: string | null) => {- setSessionId(id);- if (isExpertsEnabled) {- setExpertIdParam(expertId);- }- closeSearch();- },- );-- const handleRenameClick = useStableCallback(- (e: React.MouseEvent, id: string, title: string | null | undefined) => {- e.stopPropagation();- renameCancelledRef.current = false;- setEditingSessionId(id);- setEditingTitle(title || "");- },- );-- function handleRenameSubmit(id: string) {- const trimmed = editingTitle.trim();- if (trimmed) {- renameSession({ sessionId: id, data: { title: trimmed } });- } else {- setEditingSessionId(null);- }- }-- const handleRenameCancel = useStableCallback(() => {- renameCancelledRef.current = true;- setEditingSessionId(null);- });-- const handleRenameBlur = useStableCallback((id: string) => {- if (renameCancelledRef.current) {- renameCancelledRef.current = false;- return;- }- handleRenameSubmit(id);- });-- const handleDeleteClick = useStableCallback(- (e: React.MouseEvent, id: string, title: string | null | undefined) => {- e.stopPropagation();- requestDelete(id, title);- },- );-- const handleExcludeClick = useStableCallback(- (e: React.MouseEvent, id: string) => {- e.stopPropagation();- excludeFromLearning({ sourceKind: CHAT_SOURCE_KIND, sourceRef: id });- },- );-- const handlePinClick = useStableCallback(- (e: React.MouseEvent, id: string, isPinned: boolean) => {- e.stopPropagation();- setSessionPinned({ sessionId: id, data: { is_pinned: !isPinned } });- },- );-- const handleShareClick = useStableCallback(- (e: React.MouseEvent, id: string) => {- e.stopPropagation();- setSharingSessionId(id);- },- );-- const handleExportClick = useStableCallback(handleExport);-- async function handleExport(- e: React.MouseEvent,- id: string,- title: string | null | undefined,- ) {- e.stopPropagation();- if (exportingSessionIds.has(id)) return;- setExportingSessionIds((prev) => new Set(prev).add(id));- try {- await fetchAndExportChat(id, title, getV2GetSession);- toast({ title: "Chat exported" });- } catch (error) {- console.error("Failed to export chat:", { id, title, error });- toast({- title: "Export failed",- description:- error instanceof Error- ? error.message- : "Could not export this chat. Please try again.",- variant: "destructive",- });- } finally {- setExportingSessionIds((prev) => {- const next = new Set(prev);- next.delete(id);- return next;- });- }- }-- const { pinned, groups, showHeaders } = useMemo(- () =>- groupSessionsForSidebar({- sessions,- floatPinned: isPinningEnabled,- }),- [sessions, isPinningEnabled],- );- const sessionSections = isExpertsEnabled && showHeaders ? groups : null;- const ageClock = useSessionAgeClock(sessions);-- function renderSessionRow(- session: SessionSummaryResponse,- index: number,- list: SessionSummaryResponse[],- ) {- const isEditing = editingSessionId === session.id;- return (- <ChatSessionRow- key={session.id}- session={session}- isActive={session.id === sessionId}- isNextActive={list[index + 1]?.id === sessionId}- isEditing={isEditing}- editingTitle={isEditing ? editingTitle : ""}- renameInputRef={renameInputRef}- isExporting={exportingSessionIds.has(session.id)}- isDeleting={isDeleting}- isPinningEnabled={isPinningEnabled}- isLearningEnabled={isLearningEnabled}- showProcessing={- !!session.is_processing &&- shouldShowSessionProcessingIndicator({- sessionId: session.id,- currentSessionId: sessionId,- isProcessing: session.is_processing,- hasCompletedIndicator: completedSessionIDs.has(session.id),- needsReload: !!sessionNeedsReload[session.id],- })- }- showCompleted={- completedSessionIDs.has(session.id) && session.id !== sessionId- }- ageDays={sessionAgeDays(session.updated_at, ageClock)}- onSelect={handleSelectSession}- onEditingTitleChange={setEditingTitle}- onRenameCancel={handleRenameCancel}- onRenameBlur={handleRenameBlur}- onPin={handlePinClick}- onRename={handleRenameClick}- onExport={handleExportClick}- onShare={handleShareClick}- onExcludeFromLearning={handleExcludeClick}- onDelete={handleDeleteClick}- />- );- }-- return (- <>- <Sidebar- variant="inset"- collapsible="icon"- className="!top-[calc(50px+var(--preview-banner-height,0px))] !h-[calc(100vh-50px-var(--preview-banner-height,0px))] px-0 [&_[data-sidebar=sidebar]]:border-r [&_[data-sidebar=sidebar]]:border-r-[#80808017]"- >- {isCollapsed && (- <SidebarHeader- className={cn(- "flex",- isCollapsed- ? "flex-row items-center justify-between gap-y-4 md:flex-col md:items-start md:justify-start"- : "flex-row items-center justify-between",- )}- >- <motion.div- key={isCollapsed ? "header-collapsed" : "header-expanded"}- className="flex flex-col items-center gap-3 pt-4"- initial={{ opacity: 0, filter: "blur(3px)" }}- animate={{ opacity: 1, filter: "blur(0px)" }}- transition={{ type: "spring", bounce: 0.2 }}- >- <div className="flex flex-col items-center gap-2">- <SidebarTrigger />- {sessionId ? (- <Button- variant="ghost"- onClick={handleNewChat}- style={{ minWidth: "auto", width: "auto" }}- >- <Icon icon={PlusSignCircleIcon} className="!size-5" />- <span className="sr-only">New Chat</span>- </Button>- ) : null}- {isChatSearchEnabled ? (- <ShadcnButton- type="button"- variant="ghost"- size="icon-sm"- aria-label="Search chats"- onClick={() => openSearch()}- className="rounded-full text-zinc-600 hover:bg-zinc-100"- >- <Icon icon={Search01Icon} className="!size-5" />- </ShadcnButton>- ) : null}- </div>- </motion.div>- </SidebarHeader>- )}- {!isCollapsed && (- <SidebarHeader className="shrink-0 px-4 pb-3 pt-3">- <motion.div- initial={{ opacity: 0 }}- animate={{ opacity: 1 }}- transition={{ duration: 0.2, delay: 0.1 }}- className="flex flex-col gap-3 px-3"- >- <div className="flex items-center justify-between">- <Text variant="h3" size="body-medium">- Your chats- </Text>- <div className="flex items-center [&_button:hover]:!bg-zinc-100 [&_button]:!h-8 [&_button]:!w-8 [&_button]:!min-w-0 [&_button]:!rounded-full [&_button]:!p-0 [&_button]:!text-zinc-600 [&_svg]:!size-[1.125rem]">- {isChatSearchEnabled ? (- <HeaderAction label="Search chats">- <ShadcnButton- type="button"- variant="ghost"- size="icon-sm"- aria-label="Search chats"- onClick={() => openSearch()}- >- <Icon icon={Search01Icon} className="!size-5" />- </ShadcnButton>- </HeaderAction>- ) : null}- {isArtifactsEnabled ? (- <HeaderAction label="Files">- <ShadcnButton- type="button"- variant="ghost"- size="icon-sm"- aria-label="Files"- onClick={() => router.push("/artifacts")}- >- <Icon icon={Files01Icon} className="!size-5" />- </ShadcnButton>- </HeaderAction>- ) : null}- <HeaderAction label="Usage limits">- <UsagePopover />- </HeaderAction>- <HeaderAction label="Notification settings">- <NotificationToggle />- </HeaderAction>- <HeaderAction label="Collapse sidebar">- <SidebarTrigger />- </HeaderAction>- </div>- </div>- {sessionId ? (- <Button- variant="primary"- size="small"- onClick={handleNewChat}- className="w-full"- leftIcon={<Icon icon={PlusSignIcon} className="h-4 w-4" />}- >- New Chat- </Button>- ) : null}- </motion.div>- </SidebarHeader>- )}-- <SidebarContent className="gap-4 overflow-y-auto px-4 py-4 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">- {!isCollapsed && (- <motion.div- initial={{ opacity: 0 }}- animate={{ opacity: 1 }}- transition={{ duration: 0.2, delay: 0.15 }}- className="flex flex-col gap-1"- >- {isLoadingSessions ? (- <div className="flex min-h-[30rem] items-center justify-center py-4">- <LoadingSpinner size="small" className="text-neutral-600" />- </div>- ) : !sessions?.length ? (- <p className="py-4 text-center text-sm text-neutral-500">- No conversations yet- </p>- ) : sessionSections ? (- <>- {pinned.length > 0 && (- <ExpertSessionGroup- groupKey="pinned"- label="Pinned"- sessions={pinned}- renderRow={renderSessionRow}- />- )}- {sessionSections.map((group) => {- const groupKey = group.expertId ?? "autopilot";- const expert = group.expertId- ? expertsById.get(group.expertId)- : null;- return (- <ExpertSessionGroup- key={groupKey}- groupKey={groupKey}- role={- group.expertId- ? expert?.jobTitle || expert?.role- : "Head of AI"- }- label={- group.expertId ? (expert?.name ?? "Expert") : "Otto"- }- sessions={group.sessions}- renderRow={renderSessionRow}- />- );- })}- </>- ) : (- sessions.map((session, index) =>- renderSessionRow(session, index, sessions),- )- )}- {hasMore && (- <Button- variant="secondary"- size="small"- onClick={() => loadMore()}- loading={isLoadingMore}- disabled={isLoadingMore}- className="mt-2 w-full"- >- {isLoadingMore ? "Loading…" : "Load older chats"}- </Button>- )}- </motion.div>- )}- </SidebarContent>- </Sidebar>-- <DeleteChatDialog- session={sessionToDelete}- isDeleting={isDeleting}- onConfirm={confirmDelete}- onCancel={cancelDelete}- />-- {sharingSessionId && (- <ShareChatDialog- sessionId={sharingSessionId}- open={true}- onOpenChange={(next) => {- if (!next) setSharingSessionId(null);- }}- />- )}- </>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/__tests__/ChatSidebar.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/__tests__/ChatSidebar.test.tsxdeleted file mode 100644index 0575e3503c..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/__tests__/ChatSidebar.test.tsx+++ /dev/null@@ -1,745 +0,0 @@-import {- getDeleteV2DeleteSessionMockHandler,- getGetV2ListSessionsMockHandler200,-} from "@/app/api/__generated__/endpoints/chat/chat.msw";-import { server } from "@/mocks/mock-server";-import {- act,- fireEvent,- render,- screen,- within,-} from "@/tests/integrations/test-utils";-import { SidebarProvider } from "@/components/ui/sidebar";-import { http, HttpResponse } from "msw";-import { parseAsString, useQueryState } from "nuqs";-import { withNuqsTestingAdapter } from "nuqs/adapters/testing";-import userEvent from "@testing-library/user-event";-import { Profiler } from "react";-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { useGlobalSearchStore } from "@/app/(platform)/components/GlobalSearchModal/useGlobalSearchStore";-import { useCopilotUIStore } from "../../../store";-import { useChatSession } from "../../../useChatSession";-import { useSendMessage } from "../../../useSendMessage";-import { ChatSidebar } from "../ChatSidebar";--const toastMock = vi.fn();-vi.mock("@/components/molecules/Toast/use-toast", async (importOriginal) => {- const actual =- await importOriginal<- typeof import("@/components/molecules/Toast/use-toast")- >();- return {- ...actual,- toast: (...args: unknown[]) => toastMock(...args),- };-});--vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {- const actual =- await importOriginal<- typeof import("@/services/feature-flags/use-get-flag")- >();- return {- ...actual,- useGetFlag: (flag: string) =>- flag === "chat-search" || flag === "chat-pinning",- };-});--vi.mock("../../UsageLimits/UsageLimits", () => ({- UsageLimits: () => null,-}));-vi.mock("../../UsageLimits/UsagePopover/UsagePopover", () => ({- UsagePopover: () => null,-}));-vi.mock("../components/NotificationToggle/NotificationToggle", () => ({- NotificationToggle: () => null,-}));--const sessions = [- {- id: "s1",- title: "Active chat",- is_processing: false,- source_platform: "discord",- created_at: "2025-01-01T00:00:00Z",- updated_at: "2025-01-01T00:00:00Z",- },- {- id: "s2",- title: "Other chat",- is_processing: false,- created_at: "2025-01-01T00:00:00Z",- updated_at: "2025-01-01T00:00:00Z",- },-];--function renderSidebar() {- return render(- <SidebarProvider>- <ChatSidebar />- </SidebarProvider>,- );-}--async function openDeleteDialogFor(title: string) {- const sessionRow = (await screen.findByText(title)).closest("div.group");- if (!sessionRow) throw new Error(`row not found for ${title}`);- const moreButton = within(sessionRow as HTMLElement).getByRole("button", {- name: /more actions/i,- });- fireEvent.pointerDown(moreButton, { button: 0 });- const deleteItem = await screen.findByRole("menuitem", {- name: /delete chat/i,- });- fireEvent.click(deleteItem);-}--describe("ChatSidebar — delete flow", () => {- beforeEach(() => {- toastMock.mockClear();- useCopilotUIStore.setState({ sessionToDelete: null, isSearchOpen: false });- server.use(- getGetV2ListSessionsMockHandler200({ sessions, total: sessions.length }),- );- });-- afterEach(() => {- server.resetHandlers();- });-- it("opens the delete dialog with the chosen session title", async () => {- renderSidebar();-- await openDeleteDialogFor("Other chat");-- expect(- await screen.findByRole("heading", { name: /delete chat/i }),- ).toBeDefined();- expect(screen.getByText(/"Other chat"/)).toBeDefined();- expect(useCopilotUIStore.getState().sessionToDelete).toMatchObject({- id: "s2",- title: "Other chat",- });- });-- it("shows a platform logo for chats from an external platform", async () => {- renderSidebar();-- expect(await screen.findByAltText("Discord")).toBeDefined();- });-- it("clears the staged session when Cancel is clicked", async () => {- renderSidebar();-- await openDeleteDialogFor("Active chat");- expect(useCopilotUIStore.getState().sessionToDelete).not.toBeNull();-- const cancelButton = await screen.findByRole("button", { name: /cancel/i });- fireEvent.click(cancelButton);-- expect(useCopilotUIStore.getState().sessionToDelete).toBeNull();- });-- it("removes the chat from the list as soon as Delete is confirmed", async () => {- let deleted = false;- let releaseDelete = () => {};- const deleteHeld = new Promise<void>((resolve) => {- releaseDelete = resolve;- });- server.use(- getGetV2ListSessionsMockHandler200(() => {- const remaining = deleted- ? sessions.filter((session) => session.id !== "s2")- : sessions;- return { sessions: remaining, total: remaining.length };- }),- getDeleteV2DeleteSessionMockHandler(async () => {- await deleteHeld;- deleted = true;- }),- );- renderSidebar();-- await openDeleteDialogFor("Other chat");- const confirmButton = await screen.findByRole("button", {- name: /^delete$/i,- });- fireEvent.click(confirmButton);-- await vi.waitFor(() => {- expect(screen.queryByText("Other chat")).toBeNull();- });- expect(screen.queryByRole("heading", { name: /delete chat/i })).toBeNull();- expect(useCopilotUIStore.getState().sessionToDelete).toBeNull();- expect(screen.getByText("Active chat")).toBeDefined();-- releaseDelete();-- await vi.waitFor(() => {- expect(deleted).toBe(true);- });- expect(screen.queryByText("Other chat")).toBeNull();- expect(toastMock).not.toHaveBeenCalled();- });-- it("keeps a chat out of the list while its delete is pending, even after the list refetches", async () => {- let activeTitle = "Active chat";- let releaseDelete = () => {};- const deleteHeld = new Promise<void>((resolve) => {- releaseDelete = resolve;- });- server.use(- getGetV2ListSessionsMockHandler200(() => ({- sessions: sessions.map((session) =>- session.id === "s1" ? { ...session, title: activeTitle } : session,- ),- total: sessions.length,- })),- getDeleteV2DeleteSessionMockHandler(async () => {- await deleteHeld;- }),- );- renderSidebar();-- await openDeleteDialogFor("Other chat");- fireEvent.click(await screen.findByRole("button", { name: /^delete$/i }));- await vi.waitFor(() => {- expect(screen.queryByText("Other chat")).toBeNull();- });-- activeTitle = "Active chat, refetched";- fireEvent.click(screen.getByText("Active chat"));-- expect(await screen.findByText("Active chat, refetched")).toBeDefined();- expect(screen.queryByText("Other chat")).toBeNull();-- releaseDelete();- });-- it("leaves the open chat as soon as its delete is confirmed, so nothing more is sent to it", async () => {- let releaseDelete = () => {};- const deleteHeld = new Promise<void>((resolve) => {- releaseDelete = resolve;- });- let deleted = false;- server.use(- getDeleteV2DeleteSessionMockHandler(async () => {- await deleteHeld;- deleted = true;- }),- );- const sent: (string | null)[] = [];- const createSession = vi.fn();- const ActiveChatWrapper = withNuqsTestingAdapter({- searchParams: "?sessionId=s1",- hasMemory: true,- });- function ActiveChatComposer() {- const [sessionId] = useQueryState("sessionId", parseAsString);- const { onSend } = useSendMessage({- sessionId,- createSession,- isUserStoppingRef: { current: false },- sendMessage: async () => {- sent.push(sessionId);- },- });- return (- <>- <span data-testid="open-session">{sessionId ?? "none"}</span>- <button onClick={() => onSend("One more thing")}>Send</button>- </>- );- }- render(- <ActiveChatWrapper>- <SidebarProvider>- <ChatSidebar />- </SidebarProvider>- <ActiveChatComposer />- </ActiveChatWrapper>,- );- expect(screen.getByTestId("open-session").textContent).toBe("s1");-- await openDeleteDialogFor("Active chat");- fireEvent.click(await screen.findByRole("button", { name: /^delete$/i }));-- await vi.waitFor(() => {- expect(screen.getByTestId("open-session").textContent).toBe("none");- });- expect(deleted).toBe(false);- fireEvent.click(screen.getByRole("button", { name: "Send" }));- await vi.waitFor(() => expect(createSession).toHaveBeenCalled());- expect(sent).not.toContain("s1");-- releaseDelete();- await vi.waitFor(() => expect(deleted).toBe(true));- });-- it.each([- ["while the delete is pending", "pending"],- ["after the delete has returned", "deleted"],- ])(- "does not reopen a deleted expert chat when the expert's latest-thread lookup answers %s",- async (_label, answerExpertLookup) => {- const expertId = "expert-maria";- const expertChat = { ...sessions[0], expert_id: expertId };- let releaseDelete = () => {};- const deleteHeld = new Promise<void>((resolve) => {- releaseDelete = resolve;- });- let releaseExpertLookup = () => {};- const expertLookupHeld = new Promise<void>((resolve) => {- releaseExpertLookup = resolve;- });- let deleted = false;- server.use(- getGetV2ListSessionsMockHandler200(async ({ request }) => {- if (new URL(request.url).searchParams.has("expert_id")) {- if (answerExpertLookup === "deleted") await expertLookupHeld;- return { sessions: [expertChat], total: 1 };- }- return deleted- ? { sessions: [sessions[1]], total: 1 }- : { sessions: [expertChat, sessions[1]], total: 2 };- }),- getDeleteV2DeleteSessionMockHandler(async () => {- await deleteHeld;- deleted = true;- }),- );- useCopilotUIStore.setState({ adoptedExpertThreads: new Set<string>() });- const sent: (string | null)[] = [];- const createSession = vi.fn();- const ExpertChatWrapper = withNuqsTestingAdapter({- searchParams: `?sessionId=s1&expertId=${expertId}`,- hasMemory: true,- });- function ExpertChat() {- const [expertIdParam] = useQueryState("expertId", parseAsString);- const { sessionId } = useChatSession({ expertId: expertIdParam });- const { onSend } = useSendMessage({- sessionId,- createSession,- isUserStoppingRef: { current: false },- sendMessage: async () => {- sent.push(sessionId);- },- });- return (- <>- <span data-testid="open-session">{sessionId ?? "none"}</span>- <button onClick={() => onSend("New task")}>Send</button>- </>- );- }- function KeyedChatHost() {- const [sessionId] = useQueryState("sessionId", parseAsString);- return <ExpertChat key={sessionId ?? "new"} />;- }- render(- <ExpertChatWrapper>- <SidebarProvider>- <ChatSidebar />- </SidebarProvider>- <KeyedChatHost />- </ExpertChatWrapper>,- );-- await openDeleteDialogFor("Active chat");- fireEvent.click(await screen.findByRole("button", { name: /^delete$/i }));- await vi.waitFor(() => {- expect(screen.getByTestId("open-session").textContent).toBe("none");- });-- if (answerExpertLookup === "pending") {- await new Promise((resolve) => setTimeout(resolve, 200));- expect(deleted).toBe(false);- expect(screen.getByTestId("open-session").textContent).toBe("none");- fireEvent.click(screen.getByRole("button", { name: "Send" }));- await vi.waitFor(() => expect(createSession).toHaveBeenCalled());- }-- releaseDelete();- await vi.waitFor(() => expect(deleted).toBe(true));- releaseExpertLookup();- await new Promise((resolve) => setTimeout(resolve, 200));-- expect(screen.getByTestId("open-session").textContent).toBe("none");- expect(screen.queryByText("Active chat")).toBeNull();- expect(sent).not.toContain("s1");- },- );-- it("puts the chat back and toasts when the delete fails, without waiting for a refetch", async () => {- let holdListRequests = false;- let rejectDelete = () => {};- const deleteHeld = new Promise<void>((resolve) => {- rejectDelete = resolve;- });- server.use(- getGetV2ListSessionsMockHandler200(async () => {- if (holdListRequests) await new Promise(() => {});- return { sessions, total: sessions.length };- }),- http.delete("/api/proxy/api/chat/sessions/:sessionId", async () => {- await deleteHeld;- return HttpResponse.json({ detail: "boom" }, { status: 500 });- }),- );- renderSidebar();-- await openDeleteDialogFor("Other chat");- holdListRequests = true;- fireEvent.click(await screen.findByRole("button", { name: /^delete$/i }));-- await vi.waitFor(() => {- expect(screen.queryByText("Other chat")).toBeNull();- });- expect(screen.queryByRole("heading", { name: /delete chat/i })).toBeNull();-- rejectDelete();-- expect(await screen.findByText("Other chat")).toBeDefined();- expect(toastMock).toHaveBeenCalledTimes(1);- expect(toastMock.mock.calls[0][0]).toMatchObject({- title: "Failed to delete chat",- variant: "destructive",- });- expect(useCopilotUIStore.getState().sessionToDelete).toBeNull();- });-});--describe("ChatSidebar — global search trigger", () => {- beforeEach(() => {- useGlobalSearchStore.setState({ isOpen: false });- server.use(- getGetV2ListSessionsMockHandler200({- sessions: [],- total: 0,- }),- );- });-- // The search palette itself is mounted globally in the platform layout- // (see GlobalSearchOverlay) — here we only assert the sidebar button opens- // the shared store that drives it.- it("opens the global search palette from the search button", async () => {- const user = userEvent.setup();- renderSidebar();-- expect(useGlobalSearchStore.getState().isOpen).toBe(false);-- await user.click(- await screen.findByRole("button", { name: /search chats/i }),- );-- expect(useGlobalSearchStore.getState().isOpen).toBe(true);- });-});--describe("ChatSidebar — chat_status indicators", () => {- afterEach(() => {- server.resetHandlers();- });-- it("renders the green running dot on sessions with chat_status='running'", async () => {- const runningSessions = [- {- id: "s1",- title: "Running essay",- is_processing: false,- chat_status: "running",- created_at: "2025-01-01T00:00:00Z",- updated_at: "2025-01-01T00:00:00Z",- },- ];- server.use(- getGetV2ListSessionsMockHandler200({- sessions: runningSessions,- total: 1,- }),- );- renderSidebar();- await screen.findByText("Running essay");- expect(screen.getByTestId("session-status-running")).toBeDefined();- expect(screen.queryByTestId("session-status-queued")).toBeNull();- });-- it("renders the purple hourglass on sessions with chat_status='queued'", async () => {- const queuedSessions = [- {- id: "s1",- title: "Robot haiku",- is_processing: false,- chat_status: "queued",- created_at: "2025-01-01T00:00:00Z",- updated_at: "2025-01-01T00:00:00Z",- },- ];- server.use(- getGetV2ListSessionsMockHandler200({- sessions: queuedSessions,- total: 1,- }),- );- renderSidebar();- await screen.findByText("Robot haiku");- expect(screen.getByTestId("session-status-queued")).toBeDefined();- expect(screen.queryByTestId("session-status-running")).toBeNull();- });-- it("renders no status indicator for chat_status='idle' sessions", async () => {- const idleSessions = [- {- id: "s1",- title: "Old chat",- is_processing: false,- chat_status: "idle",- created_at: "2025-01-01T00:00:00Z",- updated_at: "2025-01-01T00:00:00Z",- },- ];- server.use(- getGetV2ListSessionsMockHandler200({- sessions: idleSessions,- total: 1,- }),- );- renderSidebar();- await screen.findByText("Old chat");- expect(screen.queryByTestId("session-status-running")).toBeNull();- expect(screen.queryByTestId("session-status-queued")).toBeNull();- });-});--describe("ChatSidebar — pinning", () => {- afterEach(() => {- server.resetHandlers();- });-- async function openMenuFor(title: string) {- const sessionRow = (await screen.findByText(title)).closest("div.group");- if (!sessionRow) throw new Error(`row not found for ${title}`);- const moreButton = within(sessionRow as HTMLElement).getByRole("button", {- name: /more actions/i,- });- fireEvent.pointerDown(moreButton, { button: 0 });- }-- it("pins an unpinned session via the dropdown", async () => {- let pinnedBody: { is_pinned?: boolean } | null = null;- server.use(- getGetV2ListSessionsMockHandler200({- sessions: [- {- id: "s1",- title: "Unpinned chat",- is_processing: false,- is_pinned: false,- created_at: "2025-01-01T00:00:00Z",- updated_at: "2025-01-01T00:00:00Z",- },- ],- total: 1,- }),- http.patch("*/api/chat/sessions/:id/pinned", async ({ request }) => {- pinnedBody = (await request.json()) as { is_pinned: boolean };- return HttpResponse.json({ status: "ok" });- }),- );- renderSidebar();-- await openMenuFor("Unpinned chat");- const pinItem = await screen.findByRole("menuitem", { name: /pin chat/i });- fireEvent.click(pinItem);-- await vi.waitFor(() => {- expect(pinnedBody).toEqual({ is_pinned: true });- });- });-- it("offers Unpin and a pinned indicator for pinned sessions", async () => {- server.use(- getGetV2ListSessionsMockHandler200({- sessions: [- {- id: "s1",- title: "Pinned chat",- is_processing: false,- is_pinned: true,- created_at: "2025-01-01T00:00:00Z",- updated_at: "2025-01-01T00:00:00Z",- },- ],- total: 1,- }),- );- renderSidebar();-- await screen.findByText("Pinned chat");- expect(screen.getByTestId("session-pinned-indicator")).toBeDefined();-- await openMenuFor("Pinned chat");- expect(- await screen.findByRole("menuitem", { name: /unpin chat/i }),- ).toBeDefined();- });-});--describe("ChatSidebar — pagination", () => {- afterEach(() => {- server.resetHandlers();- });-- function makeSessions(count: number, offset = 0) {- return Array.from({ length: count }, (_, i) => ({- id: `s${offset + i}`,- title: `Chat ${offset + i}`,- is_processing: false,- created_at: "2025-01-01T00:00:00Z",- updated_at: "2025-01-01T00:00:00Z",- }));- }-- it("hides 'Load older chats' when all sessions are loaded", async () => {- server.use(- getGetV2ListSessionsMockHandler200({- sessions: makeSessions(3),- total: 3,- }),- );- renderSidebar();- await screen.findByText("Chat 0");- expect(- screen.queryByRole("button", { name: /load older chats/i }),- ).toBeNull();- });-- it("renders 'Load older chats' when total exceeds loaded sessions", async () => {- server.use(- getGetV2ListSessionsMockHandler200({- sessions: makeSessions(50),- total: 75,- }),- );- renderSidebar();- await screen.findByText("Chat 0");- expect(- await screen.findByRole("button", { name: /load older chats/i }),- ).toBeDefined();- });-- it("fetches the next page with the loaded count as offset", async () => {- const seenOffsets: string[] = [];- server.use(- http.get("*/api/chat/sessions", ({ request }) => {- const offset = new URL(request.url).searchParams.get("offset") ?? "0";- seenOffsets.push(offset);- const offsetN = Number(offset);- const sessions =- offsetN === 0 ? makeSessions(50, 0) : makeSessions(25, 50);- return HttpResponse.json({ sessions, total: 75 });- }),- );- renderSidebar();-- const loadMore = await screen.findByRole("button", {- name: /load older chats/i,- });- fireEvent.click(loadMore);-- await screen.findByText("Chat 50");- expect(seenOffsets).toContain("50");- await vi.waitFor(() => {- expect(- screen.queryByRole("button", { name: /load older chats/i }),- ).toBeNull();- });- }, 10_000);-});--describe("ChatSidebar — rename", () => {- afterEach(() => {- server.resetHandlers();- });-- async function startRenaming(title: string) {- const sessionRow = (await screen.findByText(title)).closest("div.group");- if (!sessionRow) throw new Error(`row not found for ${title}`);- const moreButton = within(sessionRow as HTMLElement).getByRole("button", {- name: /more actions/i,- });- fireEvent.pointerDown(moreButton, { button: 0 });- fireEvent.click(await screen.findByRole("menuitem", { name: /rename/i }));- return screen.findByLabelText("Rename chat");- }-- it("keeps editing on Enter while an IME is composing, then commits on a real Enter", async () => {- const titleBodies: { title: string }[] = [];- server.use(- getGetV2ListSessionsMockHandler200({ sessions, total: sessions.length }),- http.patch("*/api/chat/sessions/:id/title", async ({ request }) => {- titleBodies.push((await request.json()) as { title: string });- return HttpResponse.json({ status: "ok" });- }),- );- renderSidebar();-- const input = await startRenaming("Active chat");- fireEvent.change(input, { target: { value: "新しいチャット" } });-- fireEvent.keyDown(input, { key: "Enter", isComposing: true });- // The IME owns this Enter: the field stays in edit mode and, more to the- // point, no rename request goes out.- expect(screen.queryByLabelText("Rename chat")).not.toBeNull();- expect(titleBodies).toEqual([]);-- fireEvent.keyDown(input, { key: "Enter" });- await vi.waitFor(() => {- expect(titleBodies).toEqual([{ title: "新しいチャット" }]);- });- });-});--describe("ChatSidebar — copilot UI store reads", () => {- beforeEach(() => {- useCopilotUIStore.setState({- sessionToDelete: null,- completedSessionIDs: new Set(),- });- server.use(- getGetV2ListSessionsMockHandler200({ sessions, total: sessions.length }),- );- });-- afterEach(() => {- server.resetHandlers();- });-- it("does not re-render while a panel resize writes its width", async () => {- const onRender = vi.fn();- render(- <SidebarProvider>- <Profiler id="chat-sidebar" onRender={onRender}>- <ChatSidebar />- </Profiler>- </SidebarProvider>,- );- await screen.findByText("Other chat");- await act(async () => {});- onRender.mockClear();-- act(() => {- const store = useCopilotUIStore.getState();- store.setContextPanelWidth(store.contextPanelWidth + 40);- store.setArtifactPanelWidth(store.artifactPanelWidth + 40);- });- expect(onRender).not.toHaveBeenCalled();-- act(() => useCopilotUIStore.getState().addCompletedSession("s2"));- expect(onRender).toHaveBeenCalled();- });-});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/__tests__/session-list-renders.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/__tests__/session-list-renders.test.tsxdeleted file mode 100644index 687d8c91b9..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/__tests__/session-list-renders.test.tsx+++ /dev/null@@ -1,361 +0,0 @@-import { SESSION_LIST_REFETCH_INTERVAL_MS } from "@/app/(platform)/copilot/useSessionList";-import { SidebarProvider } from "@/components/ui/sidebar";-import { server } from "@/mocks/mock-server";-import {- act,- fireEvent,- render,- screen,- waitFor,- within,-} from "@/tests/integrations/test-utils";-import { http, HttpResponse } from "msw";-import type { ComponentProps } from "react";-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { useCopilotUIStore } from "../../../store";-import { ChatSidebar } from "../ChatSidebar";--const blockRenders = vi.fn();--// Every render of a row renders its `ChatSessionBlock`, so counting the block-// counts the rows that re-rendered (and which ones).-vi.mock("../../ChatSessionBlock/ChatSessionBlock", async (importOriginal) => {- const actual =- await importOriginal<- typeof import("../../ChatSessionBlock/ChatSessionBlock")- >();- function CountedChatSessionBlock(- props: ComponentProps<typeof actual.ChatSessionBlock>,- ) {- blockRenders(props.title);- return <actual.ChatSessionBlock {...props} />;- }- return { ...actual, ChatSessionBlock: CountedChatSessionBlock };-});--vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {- const actual =- await importOriginal<- typeof import("@/services/feature-flags/use-get-flag")- >();- return {- ...actual,- useGetFlag: (flag: string) => flag === "chat-pinning",- };-});--const exportChat = vi.fn();-vi.mock("../../../helpers/exportChatAsMarkdown", () => ({- fetchAndExportChat: (id: string, title: string | null | undefined) =>- exportChat(id, title),-}));--vi.mock("../../../sharing/ShareChatDialog", () => ({- ShareChatDialog: ({ sessionId }: { sessionId: string }) => (- <div role="dialog" aria-label={`Share ${sessionId}`} />- ),-}));--vi.mock("../../UsageLimits/UsagePopover/UsagePopover", () => ({- UsagePopover: () => null,-}));-vi.mock("../components/NotificationToggle/NotificationToggle", () => ({- NotificationToggle: () => null,-}));--interface SessionSeed {- id: string;- title: string;- is_pinned?: boolean;- updated_at?: string;-}--function toSummary(seed: SessionSeed) {- return {- id: seed.id,- title: seed.title,- is_processing: false,- is_pinned: seed.is_pinned ?? false,- chat_status: "idle",- // `Z`-suffixed, so the API client turns them into `Date`s as in the app.- created_at: "2026-01-05T09:00:00Z",- updated_at: seed.updated_at ?? "2026-01-05T09:00:00Z",- };-}--let listed: SessionSeed[] = [];-let listRequests: string[] = [];--function serveList(total?: () => number) {- server.use(- http.get("*/api/chat/sessions", ({ request }) => {- const url = new URL(request.url);- const offset = Number(url.searchParams.get("offset") ?? "0");- const limit = Number(url.searchParams.get("limit") ?? "50");- listRequests.push(String(offset));- return HttpResponse.json({- sessions: listed.slice(offset, offset + limit).map(toSummary),- total: total ? total() : listed.length,- });- }),- );-}--function renderSidebar() {- return render(- <SidebarProvider>- <ChatSidebar />- </SidebarProvider>,- );-}--async function tick(ms: number) {- await act(async () => {- vi.advanceTimersByTime(ms);- });-}--/** Lets in-flight requests resolve and React commit what they returned. */-async function settle() {- await act(async () => {- await new Promise((resolve) => setTimeout(resolve, 50));- });-}--beforeEach(() => {- vi.useFakeTimers({ shouldAdvanceTime: true });- useCopilotUIStore.setState({- sessionToDelete: null,- completedSessionIDs: new Set(),- });- listed = [- { id: "s1", title: "First chat" },- { id: "s2", title: "Second chat" },- { id: "s3", title: "Third chat" },- ];- listRequests = [];- blockRenders.mockClear();-});--afterEach(() => {- vi.useRealTimers();- server.resetHandlers();-});--describe("ChatSidebar — session rows", () => {- it("re-renders no row when a refetch returns the same sessions", async () => {- serveList();- renderSidebar();- await screen.findByText("Third chat");- await settle();- blockRenders.mockClear();- const requestsBefore = listRequests.length;-- await tick(SESSION_LIST_REFETCH_INTERVAL_MS);- await waitFor(() =>- expect(listRequests.length).toBeGreaterThan(requestsBefore),- );- await settle();-- expect(blockRenders).not.toHaveBeenCalled();- });-- it("re-renders only the pinned row when one session is pinned", async () => {- serveList();- server.use(- http.patch("*/api/chat/sessions/:id/pinned", async ({ params }) => {- // The backend lists pinned chats first.- const pinned = listed.find((s) => s.id === params.id);- if (pinned) {- listed = [- { ...pinned, is_pinned: true },- ...listed.filter((s) => s.id !== params.id),- ];- }- return HttpResponse.json({ status: "ok" });- }),- );- renderSidebar();- const row = (await screen.findByText("Third chat")).closest("div.group");- if (!row) throw new Error("row not found");- await settle();- blockRenders.mockClear();-- fireEvent.pointerDown(- within(row as HTMLElement).getByRole("button", { name: /more actions/i }),- { button: 0 },- );- fireEvent.click(await screen.findByRole("menuitem", { name: "Pin chat" }));-- await waitFor(() =>- expect(blockRenders).toHaveBeenCalledWith("Third chat"),- );- await settle();- expect(blockRenders.mock.calls.map(([title]) => title)).toEqual([- "Third chat",- ]);- });-});--describe("ChatSidebar — session rows while editing and as they age", () => {- it("does not re-render sibling rows while a title is being edited", async () => {- serveList();- renderSidebar();- const row = (await screen.findByText("Third chat")).closest("div.group");- if (!row) throw new Error("row not found");-- fireEvent.pointerDown(- within(row as HTMLElement).getByRole("button", { name: /more actions/i }),- { button: 0 },- );- fireEvent.click(await screen.findByRole("menuitem", { name: /rename/i }));- const input = await screen.findByLabelText("Rename chat");- await settle();- blockRenders.mockClear();-- fireEvent.change(input, { target: { value: "Renamed" } });- await settle();-- expect(blockRenders).not.toHaveBeenCalled();- });-- it("re-renders a row when its 'Today' label turns into 'Yesterday'", async () => {- // The rows were updated at 09:00 UTC; one becomes a day old first.- listed = [- { id: "s1", title: "First chat", updated_at: "2026-01-05T09:00:00Z" },- { id: "s2", title: "Second chat", updated_at: "2026-01-05T15:00:00Z" },- ];- vi.setSystemTime(new Date("2026-01-06T08:59:00Z"));- serveList();- renderSidebar();- await screen.findByText("Second chat");- expect(screen.getAllByText("Today")).toHaveLength(2);- await settle();- blockRenders.mockClear();-- await tick(2 * 60_000);- await settle();-- expect(blockRenders.mock.calls.map(([title]) => title)).toEqual([- "First chat",- ]);- expect(screen.getByText("Yesterday")).toBeDefined();- expect(screen.getAllByText("Today")).toHaveLength(1);- });-});--describe("ChatSidebar — shared row callbacks", () => {- async function openActionsFor(title: string) {- const row = (await screen.findByText(title)).closest("div.group");- if (!row) throw new Error(`row not found for ${title}`);- fireEvent.pointerDown(- within(row as HTMLElement).getByRole("button", { name: /more actions/i }),- { button: 0 },- );- }-- it("runs each row action on that row's own session", async () => {- const renames: string[] = [];- serveList();- server.use(- http.patch("*/api/chat/sessions/:id/title", ({ params }) => {- renames.push(String(params.id));- return HttpResponse.json({ status: "ok" });- }),- );- exportChat.mockClear();- renderSidebar();-- await openActionsFor("Third chat");- fireEvent.click(- await screen.findByRole("menuitem", { name: /export chat/i }),- );- await waitFor(() =>- expect(exportChat).toHaveBeenCalledWith("s3", "Third chat"),- );-- await openActionsFor("Second chat");- fireEvent.click(- await screen.findByRole("menuitem", { name: /share chat/i }),- );- expect(- await screen.findByRole("dialog", { name: "Share s2" }),- ).toBeDefined();-- await openActionsFor("First chat");- fireEvent.click(await screen.findByRole("menuitem", { name: /rename/i }));- const input = await screen.findByLabelText("Rename chat");- fireEvent.change(input, { target: { value: "Never saved" } });- fireEvent.keyDown(input, { key: "Escape" });- fireEvent.blur(input);- await settle();-- expect(screen.queryByLabelText("Rename chat")).toBeNull();- expect(screen.getByText("First chat")).toBeDefined();- expect(renames).toEqual([]);- });-});--describe("ChatSidebar — 10-second refresh", () => {- function seedPages(count: number) {- listed = Array.from({ length: count }, (_, i) => ({- id: `s${i}`,- title: `Chat ${i}`,- }));- }-- async function loadOlderChats() {- fireEvent.click(- await screen.findByRole("button", { name: /load older chats/i }),- );- await screen.findByText("Chat 74");- await settle();- }-- it("requests only the first page once older pages are loaded", async () => {- seedPages(75);- serveList();- renderSidebar();- await loadOlderChats();- listRequests = [];-- await tick(SESSION_LIST_REFETCH_INTERVAL_MS);- await waitFor(() => expect(listRequests.length).toBeGreaterThan(0));- await settle();-- expect(listRequests).toEqual(["0"]);- });-- it("still shows a renamed chat on the first page after one interval", async () => {- seedPages(75);- serveList();- renderSidebar();- await loadOlderChats();- listRequests = [];-- listed[3] = { ...listed[3], title: "Renamed on the server" };- await tick(SESSION_LIST_REFETCH_INTERVAL_MS);-- expect(await screen.findByText("Renamed on the server")).toBeDefined();- expect(listRequests).toEqual(["0"]);- expect(screen.getByText("Chat 74")).toBeDefined();- });-- it("refetches every loaded page when a new chat shifts the first page", async () => {- seedPages(75);- serveList();- renderSidebar();- await loadOlderChats();-- listed = [{ id: "new", title: "Brand new chat" }, ...listed];- await tick(SESSION_LIST_REFETCH_INTERVAL_MS);-- expect(await screen.findByText("Brand new chat")).toBeDefined();- // Chat 49 was pushed from the first page onto the second; it must not- // fall into the gap between them.- await waitFor(() => expect(screen.getByText("Chat 49")).toBeDefined());- for (let i = 0; i < 75; i++) {- expect(screen.getAllByText(`Chat ${i}`)).toHaveLength(1);- }- });-});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/ChatSessionRow/ChatSessionRow.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/ChatSessionRow/ChatSessionRow.tsxdeleted file mode 100644index 9e5cc6784a..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/ChatSessionRow/ChatSessionRow.tsx+++ /dev/null@@ -1,253 +0,0 @@-"use client";--import type { SessionSummaryResponse } from "@/app/api/__generated__/models/sessionSummaryResponse";-import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,-} from "@/components/molecules/DropdownMenu/DropdownMenu";-import { cn } from "@/lib/utils";-import { AnimatePresence, motion } from "framer-motion";-import { memo, type MouseEvent, type RefObject } from "react";-import { ChatSessionBlock } from "../../../ChatSessionBlock/ChatSessionBlock";-import {- BookOpen01Icon,- Delete02Icon,- Download04Icon,- Loading03Icon,- MoreHorizontalIcon,- PencilIcon,- PinIcon,- PinOffIcon,- Share03Icon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";-import { isKey } from "@/lib/keyboard";--interface Props {- session: SessionSummaryResponse;- isActive: boolean;- /** The row below is the active one, which owns the divider instead. */- isNextActive: boolean;- isEditing: boolean;- editingTitle: string;- renameInputRef: RefObject<HTMLInputElement | null>;- isExporting: boolean;- isDeleting: boolean;- isPinningEnabled: boolean;- isLearningEnabled: boolean;- showProcessing: boolean;- showCompleted: boolean;- /** Whole days since the last update (see `sessionAgeDays`). It changes- * exactly when the relative date label ("Today", "Yesterday", "N days ago")- * does, so the memoised row re-renders then even if the session did not. */- ageDays: number;- /** The callbacks below are shared by every row and take the row's session,- * so a parent re-render passes the same props and the row skips its own. */- onSelect: (id: string, expertId: string | null) => void;- onEditingTitleChange: (title: string) => void;- onRenameCancel: () => void;- onRenameBlur: (id: string) => void;- onPin: (e: MouseEvent, id: string, isPinned: boolean) => void;- onRename: (- e: MouseEvent,- id: string,- title: string | null | undefined,- ) => void;- onExport: (- e: MouseEvent,- id: string,- title: string | null | undefined,- ) => void;- onShare: (e: MouseEvent, id: string) => void;- onExcludeFromLearning: (e: MouseEvent, id: string) => void;- onDelete: (- e: MouseEvent,- id: string,- title: string | null | undefined,- ) => void;-}--export const ChatSessionRow = memo(function ChatSessionRow({- session,- isActive,- isNextActive,- isEditing,- editingTitle,- renameInputRef,- isExporting,- isDeleting,- isPinningEnabled,- isLearningEnabled,- showProcessing,- showCompleted,- onSelect,- onEditingTitleChange,- onRenameCancel,- onRenameBlur,- onPin,- onRename,- onExport,- onShare,- onExcludeFromLearning,- onDelete,-}: Props) {- return (- <div- className={cn(- "group relative w-full transition-colors",- isActive- ? "rounded-lg bg-zinc-100"- : cn(- "border-b border-b-[#8080800f] last:border-b-0 hover:bg-zinc-50",- isNextActive && "!border-b-0",- ),- )}- >- {isEditing ? (- <div className="px-3 py-2.5">- <input- ref={renameInputRef}- type="text"- aria-label="Rename chat"- value={editingTitle}- onChange={(e) => onEditingTitleChange(e.target.value)}- onKeyDown={(e) => {- if (isKey(e, "Enter")) {- e.currentTarget.blur();- } else if (isKey(e, "Escape")) {- onRenameCancel();- }- }}- onBlur={() => onRenameBlur(session.id)}- className="w-full rounded border border-zinc-300 bg-white px-2 py-1 text-sm text-zinc-800 outline-none focus:border-purple-500 focus:ring-1 focus:ring-purple-500"- />- </div>- ) : (- <button- onClick={() => onSelect(session.id, session.expert_id ?? null)}- className={cn(- "w-full px-3 py-2.5 text-left",- isExporting ? "pr-[68px]" : "pr-10",- )}- >- <ChatSessionBlock- title={session.title}- titleContent={- <AnimatePresence mode="wait" initial={false}>- <motion.span- key={session.title || "untitled"}- initial={{ opacity: 0, y: 4 }}- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, y: -4 }}- transition={{ duration: 0.2 }}- className="block truncate"- >- {session.title || "Untitled chat"}- </motion.span>- </AnimatePresence>- }- updatedAt={session.updated_at}- sourcePlatform={session.source_platform}- showPinned={isPinningEnabled && !!session.is_pinned}- isActive={isActive}- chatStatus={session.chat_status}- showProcessing={showProcessing}- showCompleted={showCompleted}- />- </button>- )}- {isExporting && (- <div- className="pointer-events-none absolute right-9 top-1/2 z-10 -translate-y-1/2 rounded-full bg-white text-zinc-600 shadow-sm"- aria-label="Exporting chat"- title="Exporting chat…"- >- <div className="relative h-7 w-7">- <div className="absolute inset-0 animate-spin rounded-full border-2 border-zinc-200 border-t-zinc-700" />- <Icon- icon={Download04Icon}- className="absolute inset-0 m-auto h-3.5 w-3.5"- />- </div>- </div>- )}- {!isEditing && (- <DropdownMenu>- <DropdownMenuTrigger asChild>- <button- onClick={(e) => e.stopPropagation()}- className="absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-1.5 text-zinc-600 transition-all hover:bg-neutral-100"- aria-label="More actions"- >- <Icon icon={MoreHorizontalIcon} className="h-4 w-4" />- </button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- {isPinningEnabled && (- <DropdownMenuItem- onClick={(e) => onPin(e, session.id, !!session.is_pinned)}- >- {session.is_pinned ? (- <>- <Icon icon={PinOffIcon} className="mr-2 h-4 w-4" />- Unpin chat- </>- ) : (- <>- <Icon icon={PinIcon} className="mr-2 h-4 w-4" />- Pin chat- </>- )}- </DropdownMenuItem>- )}- <DropdownMenuItem- onClick={(e) => onRename(e, session.id, session.title)}- >- <Icon icon={PencilIcon} className="mr-2 h-4 w-4" />- Rename- </DropdownMenuItem>- <DropdownMenuItem- onClick={(e) => onExport(e, session.id, session.title)}- onSelect={(e) => {- if (isExporting) e.preventDefault();- }}- disabled={isExporting}- >- {isExporting ? (- <Icon- icon={Loading03Icon}- className="mr-2 h-4 w-4 animate-spin"- />- ) : (- <Icon icon={Download04Icon} className="mr-2 h-4 w-4" />- )}- {isExporting ? "Exporting…" : "Export chat"}- </DropdownMenuItem>- <DropdownMenuItem onClick={(e) => onShare(e, session.id)}>- <Icon icon={Share03Icon} className="mr-2 h-4 w-4" />- Share chat- </DropdownMenuItem>- {isLearningEnabled && (- <DropdownMenuItem- onClick={(e) => onExcludeFromLearning(e, session.id)}- >- <Icon icon={BookOpen01Icon} className="mr-2 h-4 w-4" />- Exclude from learning- </DropdownMenuItem>- )}- <DropdownMenuItem- onClick={(e) => onDelete(e, session.id, session.title)}- disabled={isDeleting}- className="text-red-600 focus:bg-red-50 focus:text-red-600"- >- <Icon icon={Delete02Icon} className="mr-2 h-4 w-4" />- Delete chat- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- )}- </div>- );-});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/ExpertSessionGroup/ExpertSessionGroup.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/ExpertSessionGroup/ExpertSessionGroup.test.tsxdeleted file mode 100644index c0c31669a9..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/ExpertSessionGroup/ExpertSessionGroup.test.tsx+++ /dev/null@@ -1,17 +0,0 @@-import { render, screen } from "@testing-library/react";-import { expect, test } from "vitest";-import { ExpertSessionGroup } from "./ExpertSessionGroup";--test("does not label the mixed pinned group as an AI Expert", () => {- render(- <ExpertSessionGroup- groupKey="pinned"- label="Pinned"- sessions={[]}- renderRow={() => null}- />,- );- expect(screen.getByRole("button", { name: "Pinned" })).toBeDefined();- expect(screen.queryByText("AI Expert")).toBeNull();- expect(screen.queryByText("Your personal Head of AI")).toBeNull();-});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/ExpertSessionGroup/ExpertSessionGroup.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/ExpertSessionGroup/ExpertSessionGroup.tsxdeleted file mode 100644index 70be6da28c..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/ExpertSessionGroup/ExpertSessionGroup.tsx+++ /dev/null@@ -1,85 +0,0 @@-import type { SessionSummaryResponse } from "@/app/api/__generated__/models/sessionSummaryResponse";-import { Text } from "@/components/atoms/Text/Text";-import { Button } from "@/components/atoms/Button/Button";-import { Icon } from "@/components/atoms/Icon/Icon";-import {- Collapsible,- CollapsibleContent,- CollapsibleTrigger,-} from "@/components/ui/collapsible";-import { ArrowDown01Icon } from "@hugeicons/core-free-icons";-import { useState, type ReactNode } from "react";-import { EXPERT_CHAT_PAGE_SIZE } from "@/services/experts/expert-chat-pagination";-import { ExpertIdentityDetails } from "@/components/molecules/ExpertIdentityDetails/ExpertIdentityDetails";--interface Props {- groupKey: string;- label: string;- role?: string | null;- sessions: SessionSummaryResponse[];- renderRow: (- session: SessionSummaryResponse,- index: number,- list: SessionSummaryResponse[],- ) => ReactNode;-}--export function ExpertSessionGroup({- groupKey,- label,- role,- sessions,- renderRow,-}: Props) {- const [visibleCount, setVisibleCount] = useState(EXPERT_CHAT_PAGE_SIZE);- const visible = sessions.slice(0, visibleCount);- const hiddenCount = sessions.length - visible.length;- const headerId = `session-group-${groupKey}`;-- return (- <Collapsible- defaultOpen- role="group"- aria-labelledby={headerId}- className="group/collapsible flex flex-col gap-1"- >- <CollapsibleTrigger- id={headerId}- data-testid={`expert-group-header-${groupKey}`}- className="flex items-center justify-between gap-2 px-3 pb-1 pt-2 text-zinc-500 hover:text-zinc-700"- >- {groupKey === "pinned" ? (- <Text as="span" variant="body-medium">- {label}- </Text>- ) : (- <ExpertIdentityDetails- isOtto={groupKey === "autopilot"}- name={label}- role={role}- size="compact"- />- )}- <Icon- icon={ArrowDown01Icon}- className="size-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-180 motion-reduce:transition-none"- />- </CollapsibleTrigger>- <CollapsibleContent className="flex flex-col gap-1 overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down motion-reduce:animate-none">- {visible.map((session, index) => renderRow(session, index, visible))}- {hiddenCount > 0 && (- <Button- variant="ghost"- size="small"- data-testid={`expert-group-load-more-${groupKey}`}- onClick={() =>- setVisibleCount((count) => count + EXPERT_CHAT_PAGE_SIZE)- }- >- Load more- </Button>- )}- </CollapsibleContent>- </Collapsible>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/HeaderAction.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/HeaderAction.tsxdeleted file mode 100644index 33565bef27..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/HeaderAction.tsx+++ /dev/null@@ -1,23 +0,0 @@-"use client";--import {- Tooltip,- TooltipContent,- TooltipTrigger,-} from "@/components/atoms/Tooltip/BaseTooltip";--interface Props {- label: string;- children: React.ReactNode;-}--export function HeaderAction({ label, children }: Props) {- return (- <Tooltip>- <TooltipTrigger asChild>- <span className="inline-flex">{children}</span>- </TooltipTrigger>- <TooltipContent side="bottom">{label}</TooltipContent>- </Tooltip>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/NotificationToggle/NotificationToggle.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/NotificationToggle/NotificationToggle.tsxdeleted file mode 100644index 237f9228c0..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/NotificationToggle/NotificationToggle.tsx+++ /dev/null@@ -1,100 +0,0 @@-"use client";--import { Switch } from "@/components/atoms/Switch/Switch";-import {- Popover,- PopoverContent,- PopoverTrigger,-} from "@/components/molecules/Popover/Popover";-import { toast } from "@/components/molecules/Toast/use-toast";-import { Button } from "@/components/ui/button";-import { cn } from "@/lib/utils";-import { useCopilotUIStore } from "../../../../store";-import {- BellIcon,- BellOffIcon,- BellRingIcon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--export function NotificationToggle() {- const isNotificationsEnabled = useCopilotUIStore(- (s) => s.isNotificationsEnabled,- );- const setNotificationsEnabled = useCopilotUIStore(- (s) => s.setNotificationsEnabled,- );- const isSoundEnabled = useCopilotUIStore((s) => s.isSoundEnabled);- const toggleSound = useCopilotUIStore((s) => s.toggleSound);-- async function handleToggleNotifications() {- if (isNotificationsEnabled) {- setNotificationsEnabled(false);- return;- }- if (typeof Notification === "undefined") {- toast({- title: "Notifications not supported",- description: "Your browser does not support notifications.",- variant: "destructive",- });- return;- }- const permission = await Notification.requestPermission();- if (permission === "granted") {- setNotificationsEnabled(true);- } else {- toast({- title: "Notifications blocked",- description:- "Please allow notifications in your browser settings to enable this feature.",- variant: "destructive",- });- }- }-- return (- <Popover>- <PopoverTrigger asChild>- <Button variant="ghost" size="icon" aria-label="Notification settings">- {!isNotificationsEnabled ? (- <Icon icon={BellOffIcon} className="!size-5" />- ) : isSoundEnabled ? (- <Icon icon={BellRingIcon} className="!size-5" />- ) : (- <Icon icon={BellIcon} className="!size-5" />- )}- </Button>- </PopoverTrigger>- {/* z-[80]: must layer above the Otto mobile drawer- (overlay z-[60], content z-[70] in MobileDrawer.tsx) so the- popover doesn't render under the drawer's blur. */}- <PopoverContent align="start" className="z-[80] w-56 p-3">- <div className="flex flex-col gap-3">- <label className="flex items-center justify-between">- <span className="text-sm text-zinc-700">Notifications</span>- <Switch- checked={isNotificationsEnabled}- onCheckedChange={handleToggleNotifications}- />- </label>- <label className="flex items-center justify-between">- <span- className={cn(- "text-sm text-zinc-700",- !isNotificationsEnabled && "opacity-50",- )}- >- Sound- </span>- <Switch- checked={isSoundEnabled && isNotificationsEnabled}- onCheckedChange={toggleSound}- disabled={!isNotificationsEnabled}- />- </label>- </div>- </PopoverContent>- </Popover>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/NotificationToggle/__tests__/NotificationToggle.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/NotificationToggle/__tests__/NotificationToggle.test.tsxdeleted file mode 100644index 6584fb68ab..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/components/NotificationToggle/__tests__/NotificationToggle.test.tsx+++ /dev/null@@ -1,141 +0,0 @@-import {- cleanup,- render,- screen,- fireEvent,- waitFor,-} from "@testing-library/react";-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { useCopilotUIStore } from "../../../../../store";-import { NotificationToggle } from "../NotificationToggle";--vi.mock("@sentry/nextjs", () => ({- captureException: vi.fn(),-}));--vi.mock("@/services/environment", () => ({- environment: {- isServerSide: vi.fn(() => false),- isClientSide: vi.fn(() => true),- getAGPTServerApiUrl: vi.fn(() => "http://localhost:8006/api"),- },-}));--function resetStore() {- useCopilotUIStore.setState({- isNotificationsEnabled: false,- isSoundEnabled: true,- showNotificationDialog: false,- });-}--function clickTrigger() {- const triggers = screen.getAllByLabelText("Notification settings");- fireEvent.click(triggers[0]);-}--describe("NotificationToggle", () => {- beforeEach(() => {- window.localStorage.clear();- resetStore();- Object.defineProperty(globalThis, "Notification", {- value: { permission: "default", requestPermission: vi.fn() },- configurable: true,- writable: true,- });- });-- afterEach(() => {- cleanup();- });-- it("renders notification settings button", () => {- render(<NotificationToggle />);-- expect(- screen.getAllByLabelText("Notification settings").length,- ).toBeGreaterThan(0);- });-- it("shows popover with toggles when clicked", async () => {- render(<NotificationToggle />);-- clickTrigger();-- expect(await screen.findByText("Notifications")).toBeDefined();- expect(screen.getByText("Sound")).toBeDefined();- });-- it("enables notifications when toggled on with granted permission", async () => {- const requestPermission = vi.fn().mockResolvedValue("granted");- Object.defineProperty(globalThis, "Notification", {- value: { permission: "default", requestPermission },- configurable: true,- writable: true,- });-- render(<NotificationToggle />);-- clickTrigger();-- const notifSwitch = await screen.findByRole("switch", {- name: /notifications/i,- });- fireEvent.click(notifSwitch);-- await waitFor(() => {- expect(requestPermission).toHaveBeenCalled();- expect(useCopilotUIStore.getState().isNotificationsEnabled).toBe(true);- });- });-- it("disables notifications when toggled off", async () => {- useCopilotUIStore.setState({ isNotificationsEnabled: true });-- render(<NotificationToggle />);-- clickTrigger();-- const notifSwitch = await screen.findByRole("switch", {- name: /notifications/i,- });- fireEvent.click(notifSwitch);-- await waitFor(() => {- expect(useCopilotUIStore.getState().isNotificationsEnabled).toBe(false);- });- });-- it("disables sound switch when notifications are off", async () => {- useCopilotUIStore.setState({ isNotificationsEnabled: false });-- render(<NotificationToggle />);-- clickTrigger();-- const soundSwitch = await screen.findByRole("switch", {- name: /sound/i,- });- expect(- soundSwitch.hasAttribute("disabled") ||- soundSwitch.getAttribute("data-disabled") !== null,- ).toBe(true);- });-- it("toggles sound when clicked", async () => {- useCopilotUIStore.setState({ isNotificationsEnabled: true });-- render(<NotificationToggle />);-- clickTrigger();-- const soundSwitch = await screen.findByRole("switch", {- name: /sound/i,- });- fireEvent.click(soundSwitch);-- await waitFor(() => {- expect(useCopilotUIStore.getState().isSoundEnabled).toBe(false);- });- });-});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/useSessionAgeClock.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/useSessionAgeClock.tsdeleted file mode 100644index 67bcd88d54..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/useSessionAgeClock.ts+++ /dev/null@@ -1,41 +0,0 @@-import type { SessionSummaryResponse } from "@/app/api/__generated__/models/sessionSummaryResponse";-import { useEffect, useState } from "react";--const DAY_MS = 24 * 60 * 60 * 1000;-// `ChatSessionBlock` labels a session "Today", "Yesterday" or "N days ago"-// from whole 24-hour periods since `updated_at`, and shows a date from 7 on.-const LAST_RELATIVE_DAY = 7;--/**- * Whole days since `updatedAt`, capped where the label turns into a date. It- * changes exactly when the row's relative date label does, so passing it to a- * memoised row re-renders that row then and at no other time.- */-export function sessionAgeDays(updatedAt: string | Date, now: number) {- const days = Math.floor((now - new Date(updatedAt).getTime()) / DAY_MS);- return Math.min(days, LAST_RELATIVE_DAY);-}--/**- * A timestamp that moves on only when some session's age in days changes:- * one timeout, set for the earliest such moment across the list.- */-export function useSessionAgeClock(sessions: SessionSummaryResponse[]) {- const [now, setNow] = useState(() => Date.now());-- useEffect(() => {- const current = Date.now();- let next = Infinity;- for (const session of sessions) {- const updated = new Date(session.updated_at).getTime();- const days = Math.floor((current - updated) / DAY_MS);- if (days >= LAST_RELATIVE_DAY) continue;- next = Math.min(next, updated + (days + 1) * DAY_MS);- }- if (next === Infinity) return;- const timeout = setTimeout(() => setNow(Date.now()), next - current + 1);- return () => clearTimeout(timeout);- }, [sessions, now]);-- return now;-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsxdeleted file mode 100644index bdac43f059..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx+++ /dev/null@@ -1,285 +0,0 @@-import { Button } from "@/components/atoms/Button/Button";-import { scrollbarStyles } from "@/components/styles/scrollbars";-import { Button as ShadcnButton } from "@/components/ui/button";-import { Input } from "@/components/ui/input";-import { Separator } from "@/components/ui/separator";-import { useAuth } from "@/lib/auth/hooks/useAuth";-import { cn } from "@/lib/utils";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";-import { parseAsString, useQueryState } from "nuqs";-import { useEffect, useRef } from "react";-import { Drawer } from "vaul";-import { useCopilotChatRuntimeStore } from "../../copilotChatRegistry";-import { shouldShowSessionProcessingIndicator } from "../../sessionActivity";-import { useCopilotUIStore } from "../../store";-import { useSessionDeletion } from "../../useSessionDeletion";-import { useSessionList } from "../../useSessionList";-import { ChatSearchResults } from "../ChatSearchModal/ChatSearchResults";-import { useChatSearch } from "../ChatSearchModal/useChatSearch";-import { ChatSessionBlock } from "../ChatSessionBlock/ChatSessionBlock";-import { NotificationToggle } from "../ChatSidebar/components/NotificationToggle/NotificationToggle";-import { DeleteChatDialog } from "../DeleteChatDialog/DeleteChatDialog";-import { UsagePopover } from "../UsageLimits/UsagePopover/UsagePopover";-import {- Cancel01Icon,- Loading03Icon,- PlusSignIcon,- Search01Icon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--export function MobileDrawer() {- const { isUserLoading, isLoggedIn } = useAuth();- const searchInputRef = useRef<HTMLInputElement>(null);- const [currentSessionId, setSessionId] = useQueryState(- "sessionId",- parseAsString,- );- const completedSessionIDs = useCopilotUIStore((s) => s.completedSessionIDs);- const clearCompletedSession = useCopilotUIStore(- (s) => s.clearCompletedSession,- );- const isDrawerOpen = useCopilotUIStore((s) => s.isDrawerOpen);- const setDrawerOpen = useCopilotUIStore((s) => s.setDrawerOpen);- const isSearchOpen = useCopilotUIStore((s) => s.isSearchOpen);- const setSearchOpen = useCopilotUIStore((s) => s.setSearchOpen);- const isChatSearchEnabled = useGetFlag(Flag.CHAT_SEARCH);- const isSearchActive = isChatSearchEnabled && isSearchOpen;- const sessionNeedsReload = useCopilotChatRuntimeStore(- (state) => state.sessionNeedsReload,- );-- const { sessions, isLoading, hasMore, isLoadingMore, loadMore } =- useSessionList({ enabled: !isUserLoading && isLoggedIn });- const {- query,- debouncedQuery,- setQuery,- results,- highlightedIndex,- setHighlightedIndex,- highlightedResultRef,- } = useChatSearch(sessions, isSearchOpen);-- const { sessionToDelete, isDeleting, confirmDelete, cancelDelete } =- useSessionDeletion();-- useEffect(() => {- if (!isSearchActive || !isDrawerOpen) return;- window.setTimeout(() => searchInputRef.current?.focus(), 0);- }, [isSearchActive, isDrawerOpen]);-- function handleDrawerOpenChange(open: boolean) {- setDrawerOpen(open);- if (!open) setSearchOpen(false);- }-- function closeDrawer() {- setDrawerOpen(false);- setSearchOpen(false);- }-- function handleSelectSession(id: string) {- setSessionId(id);- setSearchOpen(false);- closeDrawer();- }-- function handleNewChat() {- setSessionId(null);- closeDrawer();- }-- return (- <>- <Drawer.Root- open={isDrawerOpen}- onOpenChange={handleDrawerOpenChange}- direction="left"- >- <Drawer.Portal>- <Drawer.Overlay className="fixed inset-0 z-[60] bg-black/10 backdrop-blur-sm" />- <Drawer.Content className="fixed left-0 top-0 z-[70] flex h-full w-80 flex-col border-r border-zinc-200 bg-zinc-50">- <div className="shrink-0 border-b border-zinc-200 px-4 py-2">- <div className="flex items-center justify-between">- <Drawer.Title className="text-lg font-semibold text-zinc-800">- Your chats- </Drawer.Title>- <div className="flex items-center gap-1">- <UsagePopover />- <NotificationToggle />- {isChatSearchEnabled ? (- <ShadcnButton- type="button"- variant="ghost"- size="icon-sm"- aria-label={- isSearchOpen ? "Close search" : "Search chats"- }- onClick={() => setSearchOpen(!isSearchOpen)}- className="rounded-full text-zinc-600 hover:bg-zinc-100"- >- {isSearchOpen ? (- <Icon icon={Cancel01Icon} className="h-4 w-4" />- ) : (- <Icon icon={Search01Icon} className="h-4 w-4" />- )}- </ShadcnButton>- ) : null}- <Button- variant="icon"- size="icon"- aria-label="Close sessions"- onClick={closeDrawer}- className="ml-3"- >- <Icon icon={Cancel01Icon} width="1rem" height="1rem" />- </Button>- </div>- </div>- {currentSessionId && !isSearchActive ? (- <div className="mt-2">- <Button- variant="primary"- size="small"- onClick={handleNewChat}- className="w-full"- leftIcon={- <Icon icon={PlusSignIcon} width="1rem" height="1rem" />- }- >- New Chat- </Button>- </div>- ) : null}- </div>- <div- className={cn(- "flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto px-3 py-3",- scrollbarStyles,- )}- >- {isSearchActive ? (- <div className="flex min-h-0 flex-1 flex-col">- <div className="px-1 pb-3">- <div className="relative">- <Icon- icon={Search01Icon}- className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"- />- <Input- ref={searchInputRef}- value={query}- onChange={(event) => setQuery(event.target.value)}- placeholder="Search chats..."- aria-label="Search chats"- autoComplete="off"- className="h-10 bg-white pl-9 text-sm"- />- </div>- </div>- <Separator className="mb-2" />- <div className="px-1 pb-2 text-xs font-medium uppercase tracking-wide text-zinc-400">- {debouncedQuery.trim() ? "Results" : "Recent chats"}- </div>- {results.length > 0 ? (- <ChatSearchResults- results={results}- query={debouncedQuery}- highlightedIndex={highlightedIndex}- highlightedResultRef={highlightedResultRef}- currentSessionId={currentSessionId}- completedSessionIDs={completedSessionIDs}- sessionNeedsReload={sessionNeedsReload}- onHighlight={setHighlightedIndex}- onSelect={(id) => {- handleSelectSession(id);- if (completedSessionIDs.has(id)) {- clearCompletedSession(id);- }- }}- />- ) : (- <p className="py-4 text-center text-sm text-neutral-500">- No chats found- </p>- )}- </div>- ) : isLoading ? (- <div className="flex items-center justify-center py-4">- <Icon- icon={Loading03Icon}- className="h-5 w-5 animate-spin text-neutral-400"- />- </div>- ) : sessions.length === 0 ? (- <p className="py-4 text-center text-sm text-neutral-500">- No conversations yet- </p>- ) : (- sessions.map((session) => (- <button- key={session.id}- onClick={() => {- handleSelectSession(session.id);- if (completedSessionIDs.has(session.id)) {- clearCompletedSession(session.id);- }- }}- className={cn(- "w-full rounded-lg px-3 py-2.5 text-left transition-colors",- session.id === currentSessionId- ? "bg-zinc-100"- : "hover:bg-zinc-50",- )}- >- <ChatSessionBlock- title={session.title}- updatedAt={session.updated_at}- sourcePlatform={session.source_platform}- isActive={session.id === currentSessionId}- showProcessing={- !!session.is_processing &&- shouldShowSessionProcessingIndicator({- sessionId: session.id,- currentSessionId,- isProcessing: session.is_processing,- hasCompletedIndicator: completedSessionIDs.has(- session.id,- ),- needsReload: !!sessionNeedsReload[session.id],- })- }- showCompleted={- completedSessionIDs.has(session.id) &&- session.id !== currentSessionId- }- />- </button>- ))- )}- {hasMore && (- <Button- variant="ghost"- size="small"- onClick={() => loadMore()}- loading={isLoadingMore}- disabled={isLoadingMore}- className="mt-2 w-full justify-center text-neutral-500"- >- {isLoadingMore ? "Loading…" : "Load older chats"}- </Button>- )}- </div>- </Drawer.Content>- </Drawer.Portal>- </Drawer.Root>- <DeleteChatDialog- session={sessionToDelete}- isDeleting={isDeleting}- onConfirm={confirmDelete}- onCancel={cancelDelete}- />- </>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawer.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawer.test.tsxdeleted file mode 100644index 5e91ac74d9..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawer.test.tsx+++ /dev/null@@ -1,127 +0,0 @@-import { getGetV2ListSessionsMockHandler200 } from "@/app/api/__generated__/endpoints/chat/chat.msw";-import { server } from "@/mocks/mock-server";-import { fireEvent, render, screen } from "@/tests/integrations/test-utils";-import {- afterAll,- beforeAll,- beforeEach,- describe,- expect,- it,- vi,-} from "vitest";-import { useCopilotUIStore } from "../../../store";-import { MobileDrawer } from "../MobileDrawer";--vi.mock("@/lib/auth/hooks/useAuth", () => ({- useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),-}));--vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {- const actual =- await importOriginal<- typeof import("@/services/feature-flags/use-get-flag")- >();- return {- ...actual,- useGetFlag: (flag: string) => flag === "chat-search",- };-});--const sessions = [- {- id: "s1",- title: "Budget notes",- is_processing: false,- source_platform: "slack",- created_at: "2025-01-01T00:00:00Z",- updated_at: "2025-01-01T00:00:00Z",- },- {- id: "s2",- title: "Revenue forecast",- is_processing: false,- created_at: "2025-01-02T00:00:00Z",- updated_at: "2025-01-02T00:00:00Z",- },-];--describe("MobileDrawer search", () => {- const originalSetPointerCapture = HTMLElement.prototype.setPointerCapture;- const originalReleasePointerCapture =- HTMLElement.prototype.releasePointerCapture;- const originalHasPointerCapture = HTMLElement.prototype.hasPointerCapture;-- beforeAll(() => {- HTMLElement.prototype.setPointerCapture = vi.fn();- HTMLElement.prototype.releasePointerCapture = vi.fn();- HTMLElement.prototype.hasPointerCapture = vi.fn(() => false);- });-- afterAll(() => {- HTMLElement.prototype.setPointerCapture = originalSetPointerCapture;- HTMLElement.prototype.releasePointerCapture = originalReleasePointerCapture;- HTMLElement.prototype.hasPointerCapture = originalHasPointerCapture;- });-- beforeEach(() => {- useCopilotUIStore.setState({- isDrawerOpen: true,- isSearchOpen: false,- completedSessionIDs: new Set<string>(),- });- server.use(- getGetV2ListSessionsMockHandler200({- sessions,- total: sessions.length,- }),- );- });-- it("opens and closes the inline search view", async () => {- render(<MobileDrawer />);-- expect(await screen.findByText("Budget notes")).toBeDefined();- expect(screen.getByAltText("Slack")).toBeDefined();-- fireEvent.click(screen.getByRole("button", { name: /search chats/i }));- expect(- screen.getByRole("textbox", { name: /search chats/i }),- ).toBeDefined();-- fireEvent.change(screen.getByRole("textbox", { name: /search chats/i }), {- target: { value: "forecast" },- });- expect(- await screen.findByRole("option", { name: /revenue forecast/i }),- ).toBeDefined();- await vi.waitFor(() => {- expect(- screen.queryByRole("option", { name: /budget notes/i }),- ).toBeNull();- });-- fireEvent.click(screen.getByRole("button", { name: /close search/i }));- expect(screen.queryByRole("textbox", { name: /search chats/i })).toBeNull();- expect(await screen.findByText("Budget notes")).toBeDefined();- });-- it("selects a filtered session and closes the drawer", async () => {- render(<MobileDrawer />);-- fireEvent.click(- await screen.findByRole("button", { name: /search chats/i }),- );- fireEvent.change(screen.getByRole("textbox", { name: /search chats/i }), {- target: { value: "revenue" },- });- fireEvent.click(- await screen.findByRole("option", { name: /revenue forecast/i }),- );-- await vi.waitFor(() => {- expect(useCopilotUIStore.getState().isDrawerOpen).toBe(false);- expect(useCopilotUIStore.getState().isSearchOpen).toBe(false);- });- });-});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawerControls.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawerControls.test.tsxdeleted file mode 100644index 26ed72dc59..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawerControls.test.tsx+++ /dev/null@@ -1,115 +0,0 @@-import { getGetV2ListSessionsMockHandler200 } from "@/app/api/__generated__/endpoints/chat/chat.msw";-import { server } from "@/mocks/mock-server";-import { render, screen } from "@/tests/integrations/test-utils";-import { http, HttpResponse } from "msw";-import {- afterAll,- beforeAll,- beforeEach,- describe,- expect,- it,- vi,-} from "vitest";-import { useCopilotUIStore } from "../../../store";-import { MobileDrawer } from "../MobileDrawer";--vi.mock("@/lib/auth/hooks/useAuth", () => ({- useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),-}));--vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {- const actual =- await importOriginal<- typeof import("@/services/feature-flags/use-get-flag")- >();- return {- ...actual,- useGetFlag: () => true,- };-});--vi.mock("@/components/molecules/Popover/Popover", () => {- function Popover({ children }: { children: React.ReactNode }) {- return <div>{children}</div>;- }- function PopoverTrigger({ children }: { children: React.ReactNode }) {- return <div>{children}</div>;- }- function PopoverContent({ children }: { children: React.ReactNode }) {- return <div>{children}</div>;- }- return { Popover, PopoverTrigger, PopoverContent };-});--vi.mock("../../UsageLimits/StorageBar", () => ({- StorageBar: () => null,-}));--function mockUsageResponse() {- const future = new Date(Date.now() + 3600 * 1000).toISOString();- server.use(- http.get("*/api/chat/usage", () =>- HttpResponse.json({- daily: { percent_used: 10, resets_at: future },- weekly: { percent_used: 20, resets_at: future },- tier: "BASIC",- }),- ),- );-}--describe("MobileDrawer controls", () => {- const originalSetPointerCapture = HTMLElement.prototype.setPointerCapture;- const originalReleasePointerCapture =- HTMLElement.prototype.releasePointerCapture;- const originalHasPointerCapture = HTMLElement.prototype.hasPointerCapture;-- beforeAll(() => {- HTMLElement.prototype.setPointerCapture = vi.fn();- HTMLElement.prototype.releasePointerCapture = vi.fn();- HTMLElement.prototype.hasPointerCapture = vi.fn(() => false);- });-- afterAll(() => {- HTMLElement.prototype.setPointerCapture = originalSetPointerCapture;- HTMLElement.prototype.releasePointerCapture = originalReleasePointerCapture;- HTMLElement.prototype.hasPointerCapture = originalHasPointerCapture;- });-- beforeEach(() => {- useCopilotUIStore.setState({- isDrawerOpen: true,- isSearchOpen: false,- completedSessionIDs: new Set<string>(),- isNotificationsEnabled: false,- isSoundEnabled: true,- });- server.use(getGetV2ListSessionsMockHandler200({ sessions: [], total: 0 }));- mockUsageResponse();- });-- it("surfaces the usage and notification controls inside the drawer header", async () => {- render(<MobileDrawer />);-- expect(- await screen.findByRole("button", { name: /usage limits/i }),- ).toBeDefined();- expect(- screen.getByRole("button", { name: /notification settings/i }),- ).toBeDefined();- });-- it("does not render the legacy standalone sound toggle (folded into NotificationToggle)", async () => {- render(<MobileDrawer />);-- // Wait for header to render so we don't false-pass before mount.- await screen.findByRole("button", { name: /usage limits/i });-- expect(- screen.queryByRole("button", {- name: /enable notification sound|disable notification sound/i,- }),- ).toBeNull();- });-});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileHeader/MobileHeader.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileHeader/MobileHeader.tsxdeleted file mode 100644index 35f5cbaca3..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileHeader/MobileHeader.tsx+++ /dev/null@@ -1,37 +0,0 @@-import { Button } from "@/components/atoms/Button/Button";-import { NAVBAR_HEIGHT_PX } from "@/lib/constants";-import { useCopilotUIStore } from "../../store";-import { Folder01Icon, Menu01Icon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--export function MobileHeader() {- const setDrawerOpen = useCopilotUIStore((s) => s.setDrawerOpen);- const toggleContextPanelTab = useCopilotUIStore(- (s) => s.toggleContextPanelTab,- );- return (- <div- className="fixed z-50 flex gap-2"- style={{ left: "1rem", top: `${NAVBAR_HEIGHT_PX + 20}px` }}- >- <Button- variant="icon"- size="icon"- aria-label="Open sessions"- onClick={() => setDrawerOpen(true)}- className="bg-white shadow-md"- >- <Icon icon={Menu01Icon} width="1.25rem" height="1.25rem" />- </Button>- <Button- variant="icon"- size="icon"- aria-label="Open workspace files"- onClick={() => toggleContextPanelTab("files")}- className="bg-white shadow-md"- >- <Icon icon={Folder01Icon} width="1.25rem" height="1.25rem" />- </Button>- </div>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/UsageLimits/UsagePopover/UsagePopover.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/UsageLimits/UsagePopover/UsagePopover.tsxindex a389a0bd9a..5fe4e8a7bc 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/UsageLimits/UsagePopover/UsagePopover.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/UsageLimits/UsagePopover/UsagePopover.tsx@@ -43,9 +43,8 @@ export function UsagePopover({ trigger, align = "start" }: Props) {</Button>)}</PopoverTrigger>- {/* z-[80]: must layer above the Otto mobile drawer- (overlay z-[60], content z-[70] in MobileDrawer.tsx) so the- popover doesn't render under the drawer's blur. */}+ {/* z-[80]: must layer above the mobile sidebar sheet so the popover+ doesn't render under its overlay. */}<PopoverContent align={align} className="z-[80] w-72 p-4"><div className="flex flex-col gap-4"><div className="flex items-center gap-2">diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFilesTrigger/WorkspaceFilesTrigger.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFilesTrigger/WorkspaceFilesTrigger.tsxindex c48e0eec52..1cd122f68d 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFilesTrigger/WorkspaceFilesTrigger.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFilesTrigger/WorkspaceFilesTrigger.tsx@@ -9,7 +9,7 @@ interface Props {className?: string;}-// Sits next to the sidebar toggle in the new-layout inset header and mirrors+// Sits next to the sidebar toggle in the chrome's inset header and mirrors// SidebarTrigger's ghost styling (no border, no shadow).export function WorkspaceFilesTrigger({ className }: Props) {const toggleContextPanelTab = useCopilotUIStore(diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFilesTrigger/__tests__/WorkspaceFilesTrigger.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFilesTrigger/__tests__/WorkspaceFilesTrigger.test.tsxindex 1d633aa982..a904118ae8 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFilesTrigger/__tests__/WorkspaceFilesTrigger.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFilesTrigger/__tests__/WorkspaceFilesTrigger.test.tsx@@ -1,7 +1,6 @@import { render, screen, fireEvent } from "@/tests/integrations/test-utils";import { beforeEach, describe, expect, it } from "vitest";import { useCopilotUIStore } from "../../../store";-import { MobileHeader } from "../../MobileHeader/MobileHeader";import { WorkspaceFilesTrigger } from "../WorkspaceFilesTrigger";beforeEach(() => {@@ -47,10 +46,7 @@ describe("WorkspaceFilesTrigger", () => {});});-describe.each([- ["classic layout", MobileHeader],- ["new layout", WorkspaceFilesTrigger],-] as const)("workspace files button in the %s", (_layout, Controls) => {+describe("workspace files button", () => {it.each([true, false])("opens files after integrations when the panel is open: %s",(isOpen) => {@@ -60,7 +56,7 @@ describe.each([});if (!isOpen)useCopilotUIStore.getState().toggleContextPanelTab("integrations");- render(<Controls />);+ render(<WorkspaceFilesTrigger />);fireEvent.click(screen.getByRole("button", { name: /open workspace files/i }),@@ -74,7 +70,7 @@ describe.each([);it("closes files when clicked again", () => {- render(<Controls />);+ render(<WorkspaceFilesTrigger />);const button = screen.getByRole("button", {name: /open workspace files/i,});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/useSessionDeletion.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/useSessionDeletion.tsindex 2b0a7449f6..abeeca6ae9 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/useSessionDeletion.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/useSessionDeletion.ts@@ -18,8 +18,8 @@ import {* hides the chat while the mutation is pending. On success it is dropped from* the cached list; on error the chat shows again and a toast is shown.*- * Consumed by `ChatSidebar`, `MobileDrawer` and `RecentChats` so each can- * render its own `DeleteChatDialog` without duplicating the mutation wiring.+ * Consumed by the app sidebar's recent-chats list so it can render its own+ * `DeleteChatDialog` without duplicating the mutation wiring.*/export function useSessionDeletion() {const queryClient = useQueryClient();diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/useSessionList.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/useSessionList.tsindex c8f5b46181..fa98415113 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/useSessionList.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/useSessionList.ts@@ -179,16 +179,6 @@ export interface SessionGroup {sessions: SessionSummaryResponse[];}-export interface SidebarSessions {- /** Rendered flat above the groups so the backend's pinned-first ordering- * survives grouping. Empty unless headers are shown. */- pinned: SessionSummaryResponse[];- groups: SessionGroup[];- /** Headers only earn their space once there is an expert group to- * distinguish from Otto. */- showHeaders: boolean;-}-export function groupSessionsByExpert(sessions: SessionSummaryResponse[],): SessionGroup[] {@@ -212,32 +202,6 @@ export function groupSessionsByExpert(});}-export function groupSessionsForSidebar({- sessions,- floatPinned,-}: {- sessions: SessionSummaryResponse[];- floatPinned: boolean;-}): SidebarSessions {- const groups = groupSessionsByExpert(sessions);- // With a single group the list reads exactly as the API returned it, so- // adding headers (and lifting pinned chats out) would only be noise.- if (groups.length <= 1) return { pinned: [], groups, showHeaders: false };-- const pinned = floatPinned- ? sessions.filter((session) => !!session.is_pinned)- : [];- if (pinned.length === 0) return { pinned, groups, showHeaders: true };-- return {- pinned,- groups: groupSessionsByExpert(- sessions.filter((session) => !session.is_pinned),- ),- showHeaders: true,- };-}-function hasOlderPages(data: SessionListInfiniteData | undefined) {return (data?.pages.length ?? 0) > 1;}diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/NewAgentLibraryView.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/NewAgentLibraryView.tsxindex d77dc695cb..e9ed5c0c3d 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/NewAgentLibraryView.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/NewAgentLibraryView.tsx@@ -25,7 +25,6 @@ import { SelectedTriggerAgentView } from "./components/selected-views/SelectedTrimport { SelectedTriggerView } from "./components/selected-views/SelectedTriggerView/SelectedTriggerView";import { SelectedViewLayout } from "./components/selected-views/SelectedViewLayout";import { SidebarRunsList } from "./components/sidebar/SidebarRunsList/SidebarRunsList";-import { usePlatformChrome } from "@/app/(platform)/PlatformChrome/usePlatformChrome";import {AGENT_LIBRARY_SECTION_PADDING_X,isNewAgentTaskDisabled,@@ -72,7 +71,6 @@ export function NewAgentLibraryView() {} = useMarketplaceUpdate({ agent });const [changelogOpen, setChangelogOpen] = useState(false);- const { isNewLayoutActive } = usePlatformChrome();useEffect(() => {if (agent) {@@ -231,24 +229,12 @@ export function NewAgentLibraryView() {return (<>- <div- className={cn(- isNewLayoutActive- ? // New sidebar layout: detail panel sits next to the app sidebar,- // the runs list becomes a fixed column on the right, and both- // panels own their scroll on desktop (h-svh + minmax rows)- // instead of assuming a top-navbar page. Children's mb-3 (from- // the classic layout) would overflow the viewport-sized rows.- "grid h-full w-full min-w-0 grid-cols-1 gap-4 px-4 pb-3 pt-3 lg:h-svh lg:grid-cols-[minmax(0,1fr)_340px] lg:grid-rows-[minmax(0,1fr)] lg:[&>*]:mb-0"- : "mx-4 grid h-full w-full grid-cols-1 gap-0 pt-3 md:ml-4 md:mr-0 md:gap-4 lg:grid-cols-[25%_70%]",- )}- >- <SectionWrap- className={cn(- "mb-3 block",- isNewLayoutActive && "lg:order-2 lg:flex lg:min-h-0 lg:flex-col",- )}- >+ {/* The detail panel sits next to the app sidebar, the runs list is a+ fixed column on the right, and both panels own their scroll on+ desktop (h-svh + minmax rows). Children's mb-3 would overflow the+ viewport-sized rows. */}+ <div className="grid h-full w-full min-w-0 grid-cols-1 gap-4 px-4 pb-3 pt-3 lg:h-svh lg:grid-cols-[minmax(0,1fr)_340px] lg:grid-rows-[minmax(0,1fr)] lg:[&>*]:mb-0">+ <SectionWrap className="mb-3 block lg:order-2 lg:flex lg:min-h-0 lg:flex-col"><divclassName={cn("border-b border-zinc-100 pb-5",diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/useNewSettingsRedirect.ts b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/useNewSettingsRedirect.tsindex 3336ec1e2e..26cc340a06 100644--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/useNewSettingsRedirect.ts+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/useNewSettingsRedirect.ts@@ -4,10 +4,8 @@ import { usePathname, useRouter } from "next/navigation";import { useEffect } from "react";// The old /profile pages are superseded by /settings. Each legacy page maps to-// its closest new-settings equivalent. The new pages render under both the-// classic and the new layout, so this is deliberately not flag-gated — links-// in the wild (emails, bookmarks, the old sidebar) must land on the new-// surface regardless of which shell the user is on.+// its closest new-settings equivalent. Links in the wild (emails, bookmarks,+// the old sidebar) must land on the new surface.const LEGACY_TO_NEW_SETTINGS: Record<string, string> = {"/profile": "/settings/profile","/profile/dashboard": "/settings/creator-dashboard",diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 4650b1ba8e..40b26705a4 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -25111,8 +25111,6 @@"artifacts-page","chat-mode-option","generic-trigger-agents",- "chat-search",- "autogpt-new-layout","chat-workspace-files","chat-pinning","task-progress-bar",@@ -25140,8 +25138,6 @@"ARTIFACTS_PAGE","CHAT_MODE_OPTION","GENERIC_TRIGGER_AGENTS",- "CHAT_SEARCH",- "AUTOGPT_NEW_LAYOUT","CHAT_WORKSPACE_FILES","CHAT_PINNING","TASK_PROGRESS_BAR",diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/RecentChats.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/RecentChats.tsxindex ebb4d1c0bf..f5d23a91c3 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/RecentChats.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/RecentChats.tsx@@ -18,6 +18,7 @@ import { useRecentChats } from "./useRecentChats";export function RecentChats() {const chatPinningEnabled = useGetFlag(Flag.CHAT_PINNING);const isExpertsEnabled = useGetFlag(Flag.HIRE_EXPERTS);+ const isLearningEnabled = useGetFlag(Flag.DREAM_SKILL_LEARNING_ENABLED);const { expertsById, activeExpertIds } = useExpertMap();// Re-groups "Today" / "Yesterday" at midnight: list polls that return the// same sessions no longer re-render this component.@@ -40,6 +41,7 @@ export function RecentChats() {exportChat,sharingSessionId,setSharingSessionId,+ excludeFromLearning,sessionToDelete,isDeleting,requestDelete,@@ -80,6 +82,8 @@ export function RecentChats() {onRename={startRename}onExport={exportChat}onShare={setSharingSessionId}+ isLearningEnabled={isLearningEnabled}+ onExcludeFromLearning={excludeFromLearning}onDelete={requestDelete}/>);diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/__tests__/exclude-learning.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/exclude-learning.test.tsxsimilarity index 79%rename from autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/__tests__/exclude-learning.test.tsxrename to autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/exclude-learning.test.tsxindex 5515f4f4f5..09a77e7e60 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/__tests__/exclude-learning.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/exclude-learning.test.tsx@@ -10,8 +10,7 @@ import {within,} from "@/tests/integrations/test-utils";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { useCopilotUIStore } from "../../../store";-import { ChatSidebar } from "../ChatSidebar";+import { RecentChats } from "../RecentChats";const toastMock = vi.fn();vi.mock("@/components/molecules/Toast/use-toast", async (importOriginal) => {@@ -33,14 +32,6 @@ vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {};});-vi.mock("../../UsageLimits/UsageLimits", () => ({ UsageLimits: () => null }));-vi.mock("../../UsageLimits/UsagePopover/UsagePopover", () => ({- UsagePopover: () => null,-}));-vi.mock("../components/NotificationToggle/NotificationToggle", () => ({- NotificationToggle: () => null,-}));-const sessions = [{id: "s1",@@ -51,10 +42,9 @@ const sessions = [},];-describe("ChatSidebar — exclude from learning", () => {+describe("RecentChats — exclude from learning", () => {beforeEach(() => {toastMock.mockClear();- useCopilotUIStore.setState({ sessionToDelete: null, isSearchOpen: false });server.use(getGetV2ListSessionsMockHandler200({ sessions, total: sessions.length }),);@@ -78,16 +68,14 @@ describe("ChatSidebar — exclude from learning", () => {);render(<SidebarProvider>- <ChatSidebar />+ <RecentChats /></SidebarProvider>,);- const row = (await screen.findByText("CSV import chat")).closest(- "div.group",- );+ const row = (await screen.findByText("CSV import chat")).closest("li");if (!row) throw new Error("row not found");fireEvent.pointerDown(- within(row as HTMLElement).getByRole("button", { name: /more actions/i }),+ within(row as HTMLElement).getByRole("button", { name: /chat actions/i }),{ button: 0 },);fireEvent.click(diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/session-list-refresh.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/session-list-refresh.test.tsxnew file mode 100644index 0000000000..cc7a197b9c--- /dev/null+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/session-list-refresh.test.tsx@@ -0,0 +1,147 @@+import { SESSION_LIST_REFETCH_INTERVAL_MS } from "@/app/(platform)/copilot/useSessionList";+import { useCopilotUIStore } from "@/app/(platform)/copilot/store";+import { SidebarProvider } from "@/components/ui/sidebar";+import { server } from "@/mocks/mock-server";+import {+ act,+ fireEvent,+ render,+ screen,+ waitFor,+} from "@/tests/integrations/test-utils";+import { http, HttpResponse } from "msw";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { RecentChats } from "../RecentChats";++vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {+ const actual =+ await importOriginal<+ typeof import("@/services/feature-flags/use-get-flag")+ >();+ return {+ ...actual,+ useGetFlag: (flag: string) => flag === "chat-pinning",+ };+});++interface SessionSeed {+ id: string;+ title: string;+}++let listed: SessionSeed[] = [];+let listRequests: string[] = [];++function toSummary(seed: SessionSeed) {+ return {+ id: seed.id,+ title: seed.title,+ is_processing: false,+ is_pinned: false,+ // `Z`-suffixed, so the API client turns them into `Date`s as in the app.+ created_at: "2026-06-30T10:00:00Z",+ updated_at: "2026-06-30T10:00:00Z",+ };+}++function seedPages(count: number) {+ listed = Array.from({ length: count }, (_, i) => ({+ id: `s${i}`,+ title: `Chat ${i}`,+ }));+}++function renderRecentChats() {+ return render(+ <SidebarProvider>+ <RecentChats />+ </SidebarProvider>,+ );+}++async function tick(ms: number) {+ await act(async () => {+ vi.advanceTimersByTime(ms);+ });+}++/** Lets in-flight requests resolve and React commit what they returned. */+async function settle() {+ await act(async () => {+ await new Promise((resolve) => setTimeout(resolve, 50));+ });+}++async function loadOlderChats() {+ fireEvent.click(await screen.findByRole("button", { name: /load more/i }));+ await screen.findByText("Chat 74");+ await settle();+}++beforeEach(() => {+ vi.useFakeTimers({ shouldAdvanceTime: true });+ vi.setSystemTime(new Date("2026-06-30T12:00:00Z"));+ useCopilotUIStore.setState({ sessionToDelete: null });+ seedPages(75);+ listRequests = [];+ server.use(+ http.get("*/api/chat/sessions", ({ request }) => {+ const url = new URL(request.url);+ const offset = Number(url.searchParams.get("offset") ?? "0");+ const limit = Number(url.searchParams.get("limit") ?? "50");+ listRequests.push(String(offset));+ return HttpResponse.json({+ sessions: listed.slice(offset, offset + limit).map(toSummary),+ total: listed.length,+ });+ }),+ );+});++afterEach(() => {+ vi.useRealTimers();+ server.resetHandlers();+});++describe("RecentChats — 10-second refresh", () => {+ it("requests only the first page once older pages are loaded", async () => {+ renderRecentChats();+ await loadOlderChats();+ listRequests = [];++ await tick(SESSION_LIST_REFETCH_INTERVAL_MS);+ await waitFor(() => expect(listRequests.length).toBeGreaterThan(0));+ await settle();++ expect(listRequests).toEqual(["0"]);+ });++ it("still shows a renamed chat on the first page after one interval", async () => {+ renderRecentChats();+ await loadOlderChats();+ listRequests = [];++ listed[3] = { ...listed[3], title: "Renamed on the server" };+ await tick(SESSION_LIST_REFETCH_INTERVAL_MS);++ expect(await screen.findByText("Renamed on the server")).toBeDefined();+ expect(listRequests).toEqual(["0"]);+ expect(screen.getByText("Chat 74")).toBeDefined();+ });++ it("refetches every loaded page when a new chat shifts the first page", async () => {+ renderRecentChats();+ await loadOlderChats();++ listed = [{ id: "new", title: "Brand new chat" }, ...listed];+ await tick(SESSION_LIST_REFETCH_INTERVAL_MS);++ expect(await screen.findByText("Brand new chat")).toBeDefined();+ // Chat 49 was pushed from the first page onto the second; it must not+ // fall into the gap between them.+ await waitFor(() => expect(screen.getByText("Chat 49")).toBeDefined());+ for (let i = 0; i < 75; i++) {+ expect(screen.getAllByText(`Chat ${i}`)).toHaveLength(1);+ }+ });+});diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/RecentChatItem/RecentChatItem.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/RecentChatItem/RecentChatItem.tsxindex 73ebfef181..bbd5a38752 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/RecentChatItem/RecentChatItem.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/RecentChatItem/RecentChatItem.tsx@@ -17,6 +17,7 @@ import {import Link, { useLinkStatus } from "next/link";import { memo, useRef } from "react";import {+ BookOpen01Icon,Delete02Icon,Download04Icon,Loading03Icon,@@ -53,6 +54,8 @@ interface Props {onRename: (id: string, title: string | null | undefined) => void;onExport: (id: string, title: string | null | undefined) => void;onShare: (id: string) => void;+ isLearningEnabled: boolean;+ onExcludeFromLearning: (id: string) => void;onDelete: (id: string, title: string | null | undefined) => void;}@@ -88,6 +91,8 @@ export const RecentChatItem = memo(function RecentChatItem({onRename,onExport,onShare,+ isLearningEnabled,+ onExcludeFromLearning,onDelete,}: Props) {const title = session.title || "Untitled chat";@@ -205,6 +210,12 @@ export const RecentChatItem = memo(function RecentChatItem({<Icon icon={Share03Icon} className="mr-2 h-4 w-4" />Share chat</DropdownMenuItem>+ {isLearningEnabled && (+ <DropdownMenuItem onClick={() => onExcludeFromLearning(session.id)}>+ <Icon icon={BookOpen01Icon} className="mr-2 h-4 w-4" />+ Exclude from learning+ </DropdownMenuItem>+ )}<DropdownMenuItemonClick={() => onDelete(session.id, session.title)}disabled={isDeleting}diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/RecentChatItem/__tests__/RecentChatItem.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/RecentChatItem/__tests__/RecentChatItem.test.tsxindex 39a9024a99..19d067820f 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/RecentChatItem/__tests__/RecentChatItem.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/RecentChatItem/__tests__/RecentChatItem.test.tsx@@ -37,6 +37,8 @@ function makeProps(onRename: vi.fn(),onExport: vi.fn(),onShare: vi.fn(),+ isLearningEnabled: false,+ onExcludeFromLearning: vi.fn(),onDelete: vi.fn(),...overrides,};@@ -178,6 +180,27 @@ describe("RecentChatItem — actions menu", () => {expect(onShare).toHaveBeenCalledWith("s1");});+ it("offers Exclude from learning only while skill learning is on", async () => {+ const onExcludeFromLearning = vi.fn();+ renderItem(makeProps({ isLearningEnabled: true, onExcludeFromLearning }));++ openActions();+ fireEvent.click(+ await screen.findByRole("menuitem", { name: /exclude from learning/i }),+ );+ expect(onExcludeFromLearning).toHaveBeenCalledWith("s1");+ });++ it("hides Exclude from learning while skill learning is off", async () => {+ renderItem(makeProps());++ openActions();+ await screen.findByRole("menuitem", { name: /rename/i });+ expect(+ screen.queryByRole("menuitem", { name: /exclude from learning/i }),+ ).toBeNull();+ });+it("shows an exporting label while an export is in flight", async () => {renderItem(makeProps({ isExporting: true }));diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/useRecentChats.ts b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/useRecentChats.tsindex 691f8e8773..dee21ee73b 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/useRecentChats.ts+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/useRecentChats.ts@@ -3,6 +3,7 @@ import {usePatchV2UpdateSessionPinned,usePatchV2UpdateSessionTitle,} from "@/app/api/__generated__/endpoints/chat/chat";+import { useExcludeSkillLearningSource } from "@/app/api/__generated__/endpoints/skill-learning/skill-learning";import { fetchAndExportChat } from "@/app/(platform)/copilot/helpers/exportChatAsMarkdown";import {SESSION_LIST_QUERY_KEY,@@ -11,6 +12,8 @@ import {import { useSessionDeletion } from "@/app/(platform)/copilot/useSessionDeletion";import { toast } from "@/components/molecules/Toast/use-toast";import { useStableCallback } from "@/hooks/useStableCallback";+import { ApiError } from "@/lib/autogpt-server-api/helpers";+import { CHAT_SOURCE_KIND } from "@/services/skill-learning/helpers";import { useQueryClient } from "@tanstack/react-query";import { usePathname, useSearchParams } from "next/navigation";import { useState } from "react";@@ -72,8 +75,35 @@ export function useRecentChats() {},});+ const { mutate: excludeSource } = useExcludeSkillLearningSource({+ mutation: {+ onSuccess: () => {+ toast({+ title: "Excluded from learning",+ description:+ "This chat will not be used for future skill learning. Skills " ++ "that depended on it were restored or paused.",+ });+ },+ onError: (error) => {+ toast({+ title: "Could not exclude this chat",+ description:+ error instanceof ApiError+ ? error.message+ : "Nothing has been recorded for this chat yet.",+ variant: "destructive",+ });+ },+ },+ });+// Every handler handed to the rows keeps one identity across renders, so the// memoised `RecentChatItem`s only re-render when their own props change.+ const excludeFromLearning = useStableCallback((id: string) => {+ excludeSource({ sourceKind: CHAT_SOURCE_KIND, sourceRef: id });+ });+const togglePin = useStableCallback((id: string, isPinned: boolean) => {setSessionPinned({ sessionId: id, data: { is_pinned: !isPinned } });});@@ -142,6 +172,7 @@ export function useRecentChats() {exportChat,sharingSessionId,setSharingSessionId,+ excludeFromLearning,sessionToDelete,isDeleting,requestDelete: stableRequestDelete,diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/SidebarUserActions.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/SidebarUserActions.tsxindex a486b4d2c7..951f1577dd 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/SidebarUserActions.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/SidebarUserActions.tsx@@ -21,11 +21,7 @@ export function SidebarUserActions() {const isCollapsed = state === "collapsed";const logoutInProgress = isLogoutInProgress();const isBillingEnabled = useIsBillingEnabled();- const dynamicMenuItems = getAccountMenuItems(- user?.role,- true,- isBillingEnabled,- );+ const dynamicMenuItems = getAccountMenuItems(user?.role, isBillingEnabled);const { data: profile, isLoading: isProfileLoading } = useGetV2GetUserProfile({@@ -49,7 +45,6 @@ export function SidebarUserActions() {avatarSrc={profile?.avatar_url ?? ""}menuItemGroups={dynamicMenuItems}isLoading={isLoadingProfile}- newLayoutside="top"align="start"/>diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsxdeleted file mode 100644index a072111e80..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx+++ /dev/null@@ -1,170 +0,0 @@-"use client";--import { useIsBillingEnabled } from "@/hooks/useIsBillingEnabled";-import { useGetV2GetUserProfile } from "@/app/api/__generated__/endpoints/store/store";-import { okData } from "@/app/api/helpers";-import { IconType } from "@/components/__legacy__/ui/icons";-import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";-import { PreviewBanner } from "@/components/layout/Navbar/components/PreviewBanner/PreviewBanner";-import { isLogoutInProgress } from "@/lib/autogpt-server-api/helpers";-import { NAVBAR_HEIGHT_PX } from "@/lib/constants";-import { useBreakpoint } from "@/lib/hooks/useBreakpoint";-import { useAuth } from "@/lib/auth/hooks/useAuth";-import { environment } from "@/services/environment";-import { AccountMenu } from "./components/AccountMenu/AccountMenu";-import { FeedbackButton } from "./components/FeedbackButton";-import { AgentActivityDropdown } from "./components/AgentActivityDropdown/AgentActivityDropdown";-import { OrgTeamSwitcher } from "./components/OrgTeamSwitcher/OrgTeamSwitcher";-import { LoginButton } from "./components/LoginButton";-import { MobileNavBar } from "./components/MobileNavbar/MobileNavBar";-import { NavbarLink } from "./components/NavbarLink";-import { NavbarLoading } from "./components/NavbarLoading";-import { Wallet } from "./components/Wallet/Wallet";-import { getAccountMenuItems, loggedInLinks, loggedOutLinks } from "./helpers";--const MOBILE_NAV_ICONS: Readonly<Record<string, IconType>> = {- "/marketplace": IconType.Marketplace,- "/build": IconType.Builder,- "/home": IconType.Chat,- "/library": IconType.Library,- "/monitor": IconType.Library,-};--function pickMobileNavIcon(href: string): IconType {- return MOBILE_NAV_ICONS[href] ?? IconType.LayoutDashboard;-}--export function Navbar() {- const { user, isLoggedIn, isUserLoading } = useAuth();- const breakpoint = useBreakpoint();- const isSmallScreen = breakpoint === "sm" || breakpoint === "base";- const isBillingEnabled = useIsBillingEnabled();- const dynamicMenuItems = getAccountMenuItems(- user?.role,- false,- isBillingEnabled,- );- const previewBranchName = environment.getPreviewStealingDev();- const logoutInProgress = isLogoutInProgress();-- const { data: profile, isLoading: isProfileLoading } = useGetV2GetUserProfile(- {- query: {- select: okData,- enabled: isLoggedIn && !!user && !logoutInProgress,- // Include user ID in query key to ensure cache invalidation when user changes- queryKey: ["/api/store/profile", user?.id],- },- },- );-- const isLoadingProfile = isProfileLoading || isUserLoading;-- const shouldShowPreviewBanner = Boolean(isLoggedIn && previewBranchName);-- // Files is reached via the icon in the CoPilot sidebar (gated by- // ARTIFACTS_PAGE), not the top nav — it's an entry point, not a product.- const actualLoggedInLinks = [- { name: "Home", href: "/home" },- { name: "Workflows", href: "/library" },- ...loggedInLinks,- ];-- if (isUserLoading) {- return <NavbarLoading />;- }-- return (- <>- {/* Drives banner-aware offsets in fixed-position siblings (e.g. ChatSidebar)- that can't read the navbar's natural height through normal layout. */}- <style>{`:root { --preview-banner-height: ${- shouldShowPreviewBanner ? "2.25rem" : "0px"- }; }`}</style>- <div className="sticky top-0 z-40 w-full">- {shouldShowPreviewBanner && previewBranchName ? (- <PreviewBanner branchName={previewBranchName} />- ) : null}- <nav- className="inline-flex w-full items-center border-b border-[#f1f1f1] bg-[#FAFAFA]/80 p-3 backdrop-blur-xl"- style={{ height: NAVBAR_HEIGHT_PX }}- >- {/* Left section */}- {!isSmallScreen ? (- <div className="flex flex-1 items-center gap-5">- {isLoggedIn- ? actualLoggedInLinks.map((link) => (- <NavbarLink- key={link.name}- name={link.name}- href={link.href}- />- ))- : loggedOutLinks.map((link) => (- <NavbarLink- key={link.name}- name={link.name}- href={link.href}- />- ))}- </div>- ) : null}-- {/* Centered logo */}- <div className="static md:absolute md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2">- <AutoGPTLogo className="h-auto w-[4.5rem] md:w-[5.5rem]" />- </div>-- {/* Right section */}- {isLoggedIn && !isSmallScreen ? (- <div className="flex flex-1 items-center justify-end gap-4">- <div className="flex items-center gap-4">- <OrgTeamSwitcher />- {environment.isCloud() && <FeedbackButton />}- <AgentActivityDropdown />- {profile && <Wallet key={profile.username} />}- <AccountMenu- userName={profile?.name || profile?.username}- userHandle={profile?.username}- userEmail={user?.email}- avatarSrc={profile?.avatar_url ?? ""}- menuItemGroups={dynamicMenuItems}- isLoading={isLoadingProfile}- />- </div>- </div>- ) : !isLoggedIn ? (- <div className="flex w-full items-center justify-end">- <LoginButton />- </div>- ) : null}- {/* <ThemeToggle /> */}- </nav>- </div>- {/* Mobile Navbar - Adjust positioning */}- <>- {isLoggedIn && isSmallScreen ? (- <div className="fixed right-0 top-2 z-50 flex items-center gap-0">- <Wallet />- <MobileNavBar- userName={profile?.username}- menuItemGroups={[- {- groupName: "Navigation",- items: actualLoggedInLinks.map((link) => ({- icon: pickMobileNavIcon(link.href),- text: link.name,- href: link.href,- })),- },- ...dynamicMenuItems,- ]}- userEmail={profile?.name}- avatarSrc={profile?.avatar_url ?? ""}- />- </div>- ) : null}- </>- </>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenu.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenu.tsxindex 24f540821f..3d775c2475 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenu.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenu.tsx@@ -1,13 +1,15 @@-import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";import {Popover,PopoverContent,PopoverTrigger,} from "@/components/molecules/Popover/Popover";+import { environment } from "@/services/environment";import * as React from "react";import { MenuItemGroup } from "../../helpers";-import { AccountMenuNewLayout } from "./AccountMenuNewLayout";import { AccountLogoutOption } from "./components/AccountLogoutOption";+import { AccountMenuActivityRow } from "./components/AccountMenuActivityRow";+import { AccountMenuFeedbackRow } from "./components/AccountMenuFeedbackRow";+import { AccountMenuHeader } from "./components/AccountMenuHeader";import { AccountMenuRow } from "./components/AccountMenuRow";import { InitialAvatar } from "./components/InitialAvatar";import { getAccountMenuIcon } from "./helpers";@@ -17,13 +19,8 @@ interface Props {userHandle?: string;userEmail?: string;avatarSrc?: string;- hideNavBarUsername?: boolean;menuItemGroups: MenuItemGroup[];isLoading?: boolean;- // New sidebar layout variant — gated behind the AUTOGPT_NEW_LAYOUT flag,- // opted into only by the (flag-gated) sidebar. Classic Navbar keeps the- // original menu below.- newLayout?: boolean;side?: "top" | "right" | "bottom" | "left";align?: "start" | "center" | "end";}@@ -35,27 +32,11 @@ export function AccountMenu({avatarSrc,menuItemGroups,isLoading = false,- newLayout = false,- side,- align,+ side = "top",+ align = "start",}: Props) {const popupId = React.useId();- if (newLayout) {- return (- <AccountMenuNewLayout- userName={userName}- userHandle={userHandle}- userEmail={userEmail}- avatarSrc={avatarSrc}- menuItemGroups={menuItemGroups}- isLoading={isLoading}- side={side}- align={align}- />- );- }-return (<Popover><PopoverTrigger asChild>@@ -78,82 +59,87 @@ export function AccountMenu({<PopoverContentid={popupId}- align="end"+ side={side}+ align={align}sideOffset={8}- className="w-64 overflow-hidden rounded-2xl border border-neutral-200 bg-white p-0 shadow-lg"+ className="w-72 overflow-hidden rounded-2xl border border-neutral-200 bg-white px-0 py-2 shadow-lg"data-testid="account-menu-popover">- <div className="flex items-center gap-3 px-4 py-3">- <InitialAvatar- src={avatarSrc}- name={userName}- username={userHandle}+ <div className="px-2">+ <AccountMenuHeader+ userName={userName}+ userHandle={userHandle}+ userEmail={userEmail}+ avatarSrc={avatarSrc}+ isLoading={isLoading}/>- <div className="flex min-w-0 flex-1 flex-col gap-1">- {isLoading || !userName || !userEmail ? (- <>- <Skeleton className="h-3.5 w-24" />- <Skeleton className="h-3 w-32" />- </>- ) : (- <>- <span className="truncate text-sm font-semibold leading-tight text-neutral-900">- {userName}- </span>- <span- data-testid="account-menu-user-email"- className="truncate text-sm leading-tight text-neutral-700"- >- {userEmail}- </span>- </>- )}- </div></div>- <div className="border-t border-neutral-100 p-2">- <ul className="flex flex-col gap-0.5">- {menuItemGroups.map((group, groupIndex) =>- group.items.map((item, itemIndex) => {- const key = `${groupIndex}-${itemIndex}-${item.text}`;- const icon = getAccountMenuIcon(item.icon);+ {menuItemGroups.map((group, groupIndex) => {+ const isLogoutGroup = group.items.some(+ (item) => item.text === "Log out",+ );+ const showDivider = groupIndex === 0 || isLogoutGroup;- if (item.text === "Log out") {- return (- <li key={key}>- <AccountLogoutOption />- </li>- );- }+ return (+ <React.Fragment key={`group-${groupIndex}`}>+ {showDivider && <div className="mx-3 my-1 h-px bg-neutral-200" />}+ <div className="px-2 py-1">+ <ul className="flex flex-col gap-0.5">+ {group.items.map((item, itemIndex) => {+ const key = `${groupIndex}-${itemIndex}-${item.text}`;+ const icon = getAccountMenuIcon(item.icon);- if (item.href) {- return (- <li key={key}>- <AccountMenuRow- as="link"- href={item.href}- external={item.external}- icon={icon}- label={item.text}- />- </li>- );- }+ if (item.text === "Log out") {+ return (+ <li key={key}>+ <AccountLogoutOption />+ </li>+ );+ }- return (- <li key={key}>- <AccountMenuRow- as="button"- onClick={item.onClick}- icon={icon}- label={item.text}- />- </li>- );- }),- )}- </ul>- </div>+ if (item.href) {+ return (+ <li key={key}>+ <AccountMenuRow+ as="link"+ href={item.href}+ external={item.external}+ icon={icon}+ label={item.text}+ />+ </li>+ );+ }++ return (+ <li key={key}>+ <AccountMenuRow+ as="button"+ onClick={item.onClick}+ icon={icon}+ label={item.text}+ />+ </li>+ );+ })}+ {groupIndex === 0 && (+ <>+ <li>+ <AccountMenuActivityRow />+ </li>+ {environment.isCloud() && (+ <li>+ <AccountMenuFeedbackRow />+ </li>+ )}+ </>+ )}+ </ul>+ </div>+ </React.Fragment>+ );+ })}</PopoverContent></Popover>);diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenuNewLayout.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenuNewLayout.tsxdeleted file mode 100644index b27f3d6eaa..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/AccountMenuNewLayout.tsx+++ /dev/null@@ -1,148 +0,0 @@-import {- Popover,- PopoverContent,- PopoverTrigger,-} from "@/components/molecules/Popover/Popover";-import { environment } from "@/services/environment";-import * as React from "react";-import { MenuItemGroup } from "../../helpers";-import { AccountLogoutOption } from "./components/AccountLogoutOption";-import { AccountMenuActivityRow } from "./components/AccountMenuActivityRow";-import { AccountMenuFeedbackRow } from "./components/AccountMenuFeedbackRow";-import { AccountMenuHeader } from "./components/AccountMenuHeader";-import { AccountMenuRow } from "./components/AccountMenuRow";-import { InitialAvatar } from "./components/InitialAvatar";-import { getAccountMenuIcon } from "./helpers";--interface Props {- userName?: string;- userHandle?: string;- userEmail?: string;- avatarSrc?: string;- menuItemGroups: MenuItemGroup[];- isLoading?: boolean;- side?: "top" | "right" | "bottom" | "left";- align?: "start" | "center" | "end";-}--export function AccountMenuNewLayout({- userName,- userHandle,- userEmail,- avatarSrc,- menuItemGroups,- isLoading = false,- side = "top",- align = "start",-}: Props) {- const popupId = React.useId();-- return (- <Popover>- <PopoverTrigger asChild>- <button- type="button"- className="flex cursor-pointer items-center space-x-3 rounded-full outline-none focus-visible:ring-2 focus-visible:ring-neutral-300"- aria-label="Open profile menu"- aria-controls={popupId}- aria-haspopup="true"- data-testid="profile-popout-menu-trigger"- >- <InitialAvatar- src={avatarSrc}- name={userName}- username={userHandle}- className="h-8 w-8"- />- </button>- </PopoverTrigger>-- <PopoverContent- id={popupId}- side={side}- align={align}- sideOffset={8}- className="w-72 overflow-hidden rounded-2xl border border-neutral-200 bg-white px-0 py-2 shadow-lg"- data-testid="account-menu-popover"- >- <div className="px-2">- <AccountMenuHeader- userName={userName}- userHandle={userHandle}- userEmail={userEmail}- avatarSrc={avatarSrc}- isLoading={isLoading}- />- </div>-- {menuItemGroups.map((group, groupIndex) => {- const isLogoutGroup = group.items.some(- (item) => item.text === "Log out",- );- const showDivider = groupIndex === 0 || isLogoutGroup;-- return (- <React.Fragment key={`group-${groupIndex}`}>- {showDivider && <div className="mx-3 my-1 h-px bg-neutral-200" />}- <div className="px-2 py-1">- <ul className="flex flex-col gap-0.5">- {group.items.map((item, itemIndex) => {- const key = `${groupIndex}-${itemIndex}-${item.text}`;- const icon = getAccountMenuIcon(item.icon);-- if (item.text === "Log out") {- return (- <li key={key}>- <AccountLogoutOption weight="regular" />- </li>- );- }-- if (item.href) {- return (- <li key={key}>- <AccountMenuRow- as="link"- href={item.href}- external={item.external}- icon={icon}- label={item.text}- newLayout- />- </li>- );- }-- return (- <li key={key}>- <AccountMenuRow- as="button"- onClick={item.onClick}- icon={icon}- label={item.text}- newLayout- />- </li>- );- })}- {groupIndex === 0 && (- <>- <li>- <AccountMenuActivityRow />- </li>- {environment.isCloud() && (- <li>- <AccountMenuFeedbackRow />- </li>- )}- </>- )}- </ul>- </div>- </React.Fragment>- );- })}- </PopoverContent>- </Popover>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/__tests__/AccountMenu.test.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/__tests__/AccountMenu.test.tsxindex 08250740e0..ae4a05368f 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/__tests__/AccountMenu.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/__tests__/AccountMenu.test.tsx@@ -173,26 +173,24 @@ describe("AccountMenu", () => {expect(getFallbackSVG(trigger)).toBe(getFallbackSVG(reference.container));});- test("new layout renders the organization switcher header trigger", () => {+ test("renders the organization switcher header trigger", () => {render(<AccountMenuuserName="Ada"userEmail="[email protected]"menuItemGroups={baseGroups}- newLayout/>,);expect(screen.getByTestId("account-menu-org-trigger")).toBeDefined();});- test("new layout renders the agent activity row trigger", () => {+ test("renders the agent activity row trigger", () => {render(<AccountMenuuserName="Ada"userEmail="[email protected]"menuItemGroups={baseGroups}- newLayout/>,);@@ -200,13 +198,12 @@ describe("AccountMenu", () => {expect(screen.getByText("Activity")).toBeDefined();});- test("new layout renders Give feedback right after Activity", () => {+ test("renders Give feedback right after Activity", () => {render(<AccountMenuuserName="Ada"userEmail="[email protected]"menuItemGroups={baseGroups}- newLayout/>,);@@ -218,13 +215,12 @@ describe("AccountMenu", () => {);});- test("new layout does not load the Tally script before feedback is asked for", () => {+ test("does not load the Tally script before feedback is asked for", () => {render(<AccountMenuuserName="Ada"userEmail="[email protected]"menuItemGroups={baseGroups}- newLayout/>,);@@ -234,32 +230,17 @@ describe("AccountMenu", () => {);});- test("new layout leaves Give feedback out when not running in the cloud", () => {+ test("leaves Give feedback out when not running in the cloud", () => {vi.stubEnv("NEXT_PUBLIC_BEHAVE_AS", "LOCAL");render(<AccountMenuuserName="Ada"userEmail="[email protected]"menuItemGroups={baseGroups}- newLayout/>,);expect(screen.getByTestId("account-menu-activity-trigger")).toBeDefined();expect(screen.queryByRole("button", { name: "Give feedback" })).toBeNull();});-- test("classic layout does not render org, activity or feedback triggers", () => {- render(- <AccountMenu- userName="Ada"- userEmail="[email protected]"- menuItemGroups={baseGroups}- />,- );-- expect(screen.queryByTestId("account-menu-org-trigger")).toBeNull();- expect(screen.queryByTestId("account-menu-activity-trigger")).toBeNull();- expect(screen.queryByRole("button", { name: "Give feedback" })).toBeNull();- });});diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/__tests__/helpers.test.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/__tests__/helpers.test.tsxindex 99ca2fa26d..ad5e7b15e5 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/__tests__/helpers.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/__tests__/helpers.test.tsx@@ -1,10 +1,7 @@import { IconType } from "@/components/__legacy__/ui/icons";import { describe, expect, test } from "vitest";import { getAccountMenuIcon } from "../helpers";-import {- getAccountMenuItems,- getAccountMenuOptionIcon,-} from "../../../helpers";+import { getAccountMenuItems } from "../../../helpers";function flattenTexts(groups: ReturnType<typeof getAccountMenuItems>) {return groups.flatMap((group) => group.items.map((item) => item.text));@@ -33,8 +30,8 @@ describe("getAccountMenuIcon", () => {});describe("getAccountMenuItems", () => {- test("new layout groups profile settings and a footer without Admin for non-admins", () => {- const groups = getAccountMenuItems(undefined, true);+ test("groups profile settings and a footer without Admin for non-admins", () => {+ const groups = getAccountMenuItems(undefined);const texts = flattenTexts(groups);expect(texts).toEqual(@@ -50,8 +47,8 @@ describe("getAccountMenuItems", () => {expect(texts).not.toContain("Admin");});- test("new layout points What's new at the changelog docs", () => {- const items = getAccountMenuItems(undefined, true).flatMap(+ test("points What's new at the changelog docs", () => {+ const items = getAccountMenuItems(undefined).flatMap((group) => group.items,);const whatsNew = items.find((item) => item.text === "What's new");@@ -62,36 +59,17 @@ describe("getAccountMenuItems", () => {expect(whatsNew?.external).toBe(true);});- test("new layout adds an Admin entry for admin users", () => {- const texts = flattenTexts(getAccountMenuItems("admin", true));+ test("drops Billing when billing is disabled", () => {+ const texts = flattenTexts(getAccountMenuItems(undefined, false));- expect(texts).toContain("Admin");- expect(texts).toContain("Log out");+ expect(texts).not.toContain("Billing");+ expect(texts).toEqual(expect.arrayContaining(["Profile", "Settings"]));});- test("classic layout differs from the new layout grouping", () => {- const classic = flattenTexts(getAccountMenuItems(undefined));- const newLayout = flattenTexts(getAccountMenuItems(undefined, true));-- expect(classic).toContain("Profile");- expect(newLayout).not.toEqual(classic);- });-});+ test("adds an Admin entry for admin users", () => {+ const texts = flattenTexts(getAccountMenuItems("admin"));-describe("getAccountMenuOptionIcon", () => {- test.each([- IconType.Edit,- IconType.Settings,- IconType.Billing,- IconType.Help,- IconType.WhatsNew,- IconType.Sliders,- IconType.LogOut,- ])("returns an icon element for %s", (icon) => {- expect(getAccountMenuOptionIcon(icon)).not.toBeNull();- });-- test("falls back to a default icon for unmapped types", () => {- expect(getAccountMenuOptionIcon(IconType.UploadCloud)).not.toBeNull();+ expect(texts).toContain("Admin");+ expect(texts).toContain("Log out");});});diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountLogoutOption.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountLogoutOption.tsxindex 494b7caf16..b7a47634e6 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountLogoutOption.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountLogoutOption.tsx@@ -4,11 +4,7 @@ import { AccountMenuRow } from "./AccountMenuRow";import { Logout03Icon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";-interface Props {- weight?: "bold" | "regular";-}--export function AccountLogoutOption({ weight = "bold" }: Props) {+export function AccountLogoutOption() {const router = useRouter();function handleLogout() {@@ -20,7 +16,6 @@ export function AccountLogoutOption({ weight = "bold" }: Props) {as="button"destructivelabel="Log out"- newLayout={weight === "regular"}icon={<Icon icon={Logout03Icon} className="h-[18px] w-[18px] shrink-0" />}onClick={handleLogout}/>diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountMenuActivityRow.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountMenuActivityRow.tsxindex f765331d98..a54eb72866 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountMenuActivityRow.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountMenuActivityRow.tsx@@ -72,7 +72,6 @@ export function AccountMenuActivityRow() {activeExecutions={activeExecutions}recentCompletions={recentCompletions}recentFailures={recentFailures}- newLayout/></PopoverContent></Popover>diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountMenuRow.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountMenuRow.tsxindex 1532977c48..25453ee0b9 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountMenuRow.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/components/AccountMenuRow.tsx@@ -13,8 +13,6 @@ interface Props {destructive?: boolean;as?: "link" | "button";external?: boolean;- // New sidebar layout variant: lighter text weight + external-link glyph.- newLayout?: boolean;}const baseRowClasses =@@ -91,16 +89,11 @@ export function AccountMenuRow({destructive = false,as = "link",external = false,- newLayout = false,}: Props) {const colorClasses = destructive? "text-neutral-700 hover:bg-red-50 hover:text-red-600 focus-visible:bg-red-50 focus-visible:text-red-600": "text-neutral-700 hover:bg-neutral-100 focus-visible:bg-neutral-100";- const rowClasses = cn(- baseRowClasses,- newLayout ? "font-normal" : "font-medium",- colorClasses,- );+ const rowClasses = cn(baseRowClasses, "font-normal", colorClasses);if (as === "link" && href) {if (external) {@@ -115,7 +108,7 @@ export function AccountMenuRow({icon={icon}label={label}destructive={destructive}- external={newLayout}+ external/></a>);diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/AgentActivityDropdown.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/AgentActivityDropdown.tsxdeleted file mode 100644index 0cc3b2e05f..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/AgentActivityDropdown.tsx+++ /dev/null@@ -1,69 +0,0 @@-"use client";--import { Text } from "@/components/atoms/Text/Text";-import {- Popover,- PopoverContent,- PopoverTrigger,-} from "@/components/__legacy__/ui/popover";-import { ActivityDropdown } from "./components/ActivityDropdown/ActivityDropdown";-import { formatNotificationCount } from "./helpers";-import { useAgentActivityDropdown } from "./useAgentActivityDropdown";-import { Pulse01Icon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--export function AgentActivityDropdown() {- const {- activeExecutions,- recentCompletions,- recentFailures,- isOpen,- setIsOpen,- } = useAgentActivityDropdown();-- const activeCount = activeExecutions.length;-- return (- <Popover open={isOpen} onOpenChange={setIsOpen}>- <PopoverTrigger asChild>- <button- className={`group relative h-[2.5rem] w-[2.5rem] rounded-full p-2 transition-colors hover:bg-white ${isOpen ? "bg-white" : ""}`}- data-testid="agent-activity-button"- aria-label="View Workflow Activity"- >- <Icon icon={Pulse01Icon} size={22} className="text-black" />-- {activeCount > 0 && (- <>- {/* Running Agents Rotating Badge */}- <div- data-testid="agent-activity-badge"- className="absolute right-[1px] top-[0.5px] flex h-5 w-5 items-center justify-center rounded-full bg-purple-600 text-[10px] font-medium text-white"- >- {formatNotificationCount(activeCount)}- <div className="absolute -inset-0.5 animate-spin rounded-full border-[3px] border-transparent border-r-purple-200 border-t-purple-200" />- </div>- {/* Running Agent Hover Hint */}- <div- data-testid="agent-activity-hover-hint"- className="absolute bottom-[-2.5rem] left-1/2 z-50 hidden -translate-x-1/2 transform whitespace-nowrap rounded-small bg-white px-4 py-2 shadow-md group-hover:block"- >- <Text variant="body-medium">- {activeCount} active workflow{activeCount > 1 ? "s" : ""}- </Text>- </div>- </>- )}- </button>- </PopoverTrigger>-- <PopoverContent className="w-80 p-0" align="center" sideOffset={8}>- <ActivityDropdown- activeExecutions={activeExecutions}- recentCompletions={recentCompletions}- recentFailures={recentFailures}- />- </PopoverContent>- </Popover>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/__tests__/AgentActivityDropdown.test.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/__tests__/AgentActivityDropdown.test.tsxdeleted file mode 100644index 5c45af03f4..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/__tests__/AgentActivityDropdown.test.tsx+++ /dev/null@@ -1,76 +0,0 @@-import { render, screen } from "@/tests/integrations/test-utils";-import { AgentExecutionStatus } from "@/app/api/__generated__/models/agentExecutionStatus";-import { AgentActivityDropdown } from "../AgentActivityDropdown";-import { AgentExecutionWithInfo } from "../helpers";-import { beforeEach, describe, expect, test, vi } from "vitest";--const mockUseAgentActivityDropdown = vi.hoisted(() => vi.fn());--vi.mock("../useAgentActivityDropdown", () => ({- useAgentActivityDropdown: mockUseAgentActivityDropdown,-}));--function makeExecution(- overrides: Partial<AgentExecutionWithInfo> = {},-): AgentExecutionWithInfo {- return {- id: "exec-1",- graph_id: "graph-1",- status: AgentExecutionStatus.RUNNING,- started_at: new Date(),- ended_at: null,- user_id: "user-1",- graph_version: 1,- inputs: {},- credential_inputs: {},- nodes_input_masks: {},- preset_id: null,- stats: null,- agent_name: "Test Agent",- agent_description: "A running agent",- library_agent_id: "library-1",- ...overrides,- };-}--describe("AgentActivityDropdown", () => {- beforeEach(() => {- mockUseAgentActivityDropdown.mockReturnValue({- activeExecutions: [makeExecution(), makeExecution({ id: "exec-2" })],- recentCompletions: [],- recentFailures: [],- totalCount: 2,- isReady: true,- error: null,- isOpen: false,- setIsOpen: vi.fn(),- });- });-- test("shows the active execution badge count", () => {- render(<AgentActivityDropdown />);-- expect(screen.getByTestId("agent-activity-badge").textContent).toContain(- "2",- );- expect(screen.getByTestId("agent-activity-button")).toBeDefined();- });-- test("renders the dropdown content when open", async () => {- mockUseAgentActivityDropdown.mockReturnValue({- activeExecutions: [makeExecution()],- recentCompletions: [],- recentFailures: [],- totalCount: 1,- isReady: true,- error: null,- isOpen: true,- setIsOpen: vi.fn(),- });-- render(<AgentActivityDropdown />);-- expect(screen.getByTestId("agent-activity-dropdown")).toBeDefined();- expect(await screen.findByText("Test Agent")).toBeDefined();- });-});diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityDropdown/ActivityDropdown.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityDropdown/ActivityDropdown.tsxindex b0ea7be1b8..f206e6a398 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityDropdown/ActivityDropdown.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityDropdown/ActivityDropdown.tsx@@ -3,7 +3,6 @@import { Button } from "@/components/atoms/Button/Button";import { Input } from "@/components/atoms/Input/Input";import { Text } from "@/components/atoms/Text/Text";-import { cn } from "@/lib/utils";import { List, type RowComponentProps } from "react-window";import { AgentExecutionWithInfo } from "../../helpers";import { ActivityItem } from "../ActivityItem";@@ -23,25 +22,21 @@ interface Props {activeExecutions: AgentExecutionWithInfo[];recentCompletions: AgentExecutionWithInfo[];recentFailures: AgentExecutionWithInfo[];- // New sidebar layout variant — gated behind the AUTOGPT_NEW_LAYOUT flag.- newLayout?: boolean;}interface ActivityRowProps {executions: AgentExecutionWithInfo[];- newLayout: boolean;}function VirtualizedActivityItem({index,style,executions,- newLayout,}: RowComponentProps<ActivityRowProps>) {const execution = executions[index];return (<div style={style}>- <ActivityItem execution={execution} newLayout={newLayout} />+ <ActivityItem execution={execution} /></div>);}@@ -50,7 +45,6 @@ export function ActivityDropdown({activeExecutions,recentCompletions,recentFailures,- newLayout = false,}: Props) {const {isSearchVisible,@@ -68,7 +62,7 @@ export function ActivityDropdown({// Static height for the virtualised list (react-window)const itemHeight = 72; // Height of each ActivityItem in pixels- const maxHeight = newLayout ? 320 : 400; // Maximum height of the dropdown+ const maxHeight = 320; // Maximum height of the dropdownconst listHeight = Math.min(maxHeight,@@ -80,13 +74,8 @@ export function ActivityDropdown({return (<div className="overflow-hidden">{/* Header */}- <div className={cn("sticky top-0 z-10 px-4", !newLayout && "pb-1 pt-0")}>- <div- className={cn(- "flex items-center justify-between",- newLayout ? "pb-1 pt-3" : "h-[60px]",- )}- >+ <div className="sticky top-0 z-10 px-4">+ <div className="flex items-center justify-between pb-1 pt-3">{isSearchVisible && withSearch ? (<divclassName={`${styles.searchContainer} ${@@ -121,28 +110,17 @@ export function ActivityDropdown({</div></div>) : (- <div className={cn(styles.headerContainer, newLayout && "py-0.5")}>- {newLayout ? (- <span className="text-xs font-medium uppercase text-neutral-500">- Workflow Activity- </span>- ) : (- <Text variant="large-semibold" className="!text-black">- Workflow Activity- </Text>- )}+ <div className={`${styles.headerContainer} py-0.5`}>+ <span className="text-xs font-medium uppercase text-neutral-500">+ Workflow Activity+ </span>{withSearch ? (<Buttonvariant="ghost"size="small"onClick={toggleSearch}aria-label="Search workflows"- className={cn(- "hover:border-transparent hover:bg-transparent",- newLayout- ? "!h-auto !w-fit !min-w-0 !p-0"- : "relative left-3",- )}+ className="!h-auto !w-fit !min-w-0 !p-0 hover:border-transparent hover:bg-transparent"><Iconicon={Search01Icon}@@ -166,9 +144,9 @@ export function ActivityDropdown({defaultHeight={listHeight}rowCount={filteredExecutions.length}rowHeight={itemHeight}- rowProps={{ executions: filteredExecutions, newLayout }}+ rowProps={{ executions: filteredExecutions }}rowComponent={VirtualizedActivityItem}- style={{ width: newLayout ? "100%" : 320, height: listHeight }}+ style={{ width: "100%", height: listHeight }}/>) : (<div className="flex h-full flex-col items-center justify-center gap-5 pb-8 pt-6">diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityItem.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityItem.tsxindex 9e3451b8af..ad8fa46e6c 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityItem.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityItem.tsx@@ -5,7 +5,6 @@ import { LoadingSpinner } from "@/components/atoms/LoadingSpinner/LoadingSpinnerimport { Text } from "@/components/atoms/Text/Text";import { isCompletedWithErrors } from "@/lib/run-health";import { formatTimeAgo } from "@/lib/utils/time";-import { cn } from "@/lib/utils";import Link, { useLinkStatus } from "next/link";import type { AgentExecutionWithInfo } from "../helpers";import { getExecutionDuration } from "../helpers";@@ -44,11 +43,9 @@ function ActivityNavIndicator() {interface Props {execution: AgentExecutionWithInfo;- // New sidebar layout variant — gated behind the AUTOGPT_NEW_LAYOUT flag.- newLayout?: boolean;}-export function ActivityItem({ execution, newLayout = false }: Props) {+export function ActivityItem({ execution }: Props) {function getStatusIcon() {switch (execution.status) {case AgentExecutionStatus.QUEUED:@@ -162,7 +159,7 @@ export function ActivityItem({ execution, newLayout = false }: Props) {<div className="flex items-center space-x-2">{getStatusIcon()}<Text- variant={newLayout ? "small-medium" : "body-medium"}+ variant="small-medium"className="max-w-44 truncate text-gray-900">{execution.agent_name}@@ -185,34 +182,16 @@ export function ActivityItem({ execution, newLayout = false }: Props) {);if (withExecutionLink) {- return newLayout ? (+ return (<LinkclassName="flex cursor-pointer items-center justify-between gap-2 rounded-xl px-2 py-3 transition-colors hover:bg-bgLightGrey"href={linkUrl}- role="button"><div className="min-w-0 flex-1">{content}</div><ActivityNavIndicator /></Link>- ) : (- <Link- className="block cursor-pointer border-b border-slate-50 px-2 py-3 transition-colors last:border-b-0 hover:bg-bgLightGrey"- href={linkUrl}- role="button"- >- {content}- </Link>);}- return (- <div- className={cn(- "block px-2 py-3",- newLayout ? "rounded-xl" : "border-b border-slate-50 last:border-b-0",- )}- >- {content}- </div>- );+ return <div className="block rounded-xl px-2 py-3">{content}</div>;}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/__tests__/ActivityItem.test.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/__tests__/ActivityItem.test.tsxindex 973f7e43a9..d2925cf589 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/__tests__/ActivityItem.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/__tests__/ActivityItem.test.tsx@@ -24,10 +24,11 @@ function makeExecution(}describe("ActivityItem", () => {- it("renders a linked item with a nav indicator in the new layout", () => {- render(<ActivityItem execution={makeExecution()} newLayout />);+ it("renders a linked item with a nav indicator", () => {+ render(<ActivityItem execution={makeExecution()} />);- const link = screen.getByRole("button");+ const link = screen.getByRole("link");+ expect(screen.queryByRole("button")).toBeNull();expect(link.getAttribute("href")).toContain("/library/agents/lib-agent-1");expect(link.getAttribute("href")).toContain("activeTab=runs");expect(screen.getByText("Weather Agent")).toBeDefined();@@ -37,16 +38,15 @@ describe("ActivityItem", () => {render(<ActivityItemexecution={makeExecution({ status: AgentExecutionStatus.REVIEW })}- newLayout/>,);- expect(screen.getByRole("button").getAttribute("href")).toContain(+ expect(screen.getByRole("link").getAttribute("href")).toContain("activeTab=reviews",);});- it("renders a running execution in the classic layout as a link", () => {+ it("renders a running execution as a link", () => {render(<ActivityItemexecution={makeExecution({@@ -56,7 +56,7 @@ describe("ActivityItem", () => {/>,);- expect(screen.getByRole("button")).toBeDefined();+ expect(screen.getByRole("link")).toBeDefined();expect(screen.getByText("Weather Agent")).toBeDefined();});diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/FeedbackButton.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/FeedbackButton.tsxdeleted file mode 100644index 40effafcd5..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/FeedbackButton.tsx+++ /dev/null@@ -1,31 +0,0 @@-"use client";--import { useTallyFeedback } from "@/components/molecules/TallyPoup/useTallyFeedback";-import { useAuth } from "@/lib/auth/hooks/useAuth";-import { Chatting01Icon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--export function FeedbackButton() {- const { isLoggedIn, isUserLoading } = useAuth();- const feedback = useTallyFeedback(isUserLoading ? null : isLoggedIn);-- if (feedback.isFormVisible) return null;-- return (- <button- type="button"- className="group inline-flex overflow-hidden rounded-full active:scale-[0.97] disabled:pointer-events-none disabled:opacity-50"- onClick={feedback.openFeedbackForm}- disabled={feedback.isLoading}- aria-label="Give Feedback"- data-feedback-trigger- >- <div className="rounded-full bg-gradient-to-r from-indigo-100 to-indigo-300 to-zinc-400 p-[1px]">- <div className="flex items-center gap-1.5 whitespace-nowrap rounded-full bg-[#FAFAFA]/80 px-3 py-1.5 text-sm font-medium text-neutral-700 backdrop-blur-xl transition-colors duration-150 ease-out group-hover:bg-zinc-100/90">- <span className="hidden xl:inline">Give Feedback</span>- <Icon icon={Chatting01Icon} size={16} />- </div>- </div>- </button>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/LoginButton.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/LoginButton.tsxdeleted file mode 100644index c8e826d642..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/LoginButton.tsx+++ /dev/null@@ -1,29 +0,0 @@-"use client";--import { Button } from "@/components/atoms/Button/Button";-import { usePathname, useRouter } from "next/navigation";-import { Login03Icon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--export function LoginButton() {- const router = useRouter();- const pathname = usePathname();- const isLoginPage = pathname.includes("/login");-- if (isLoginPage) return null;-- function handleLogin() {- router.push("/login");- }-- return (- <Button- onClick={handleLogin}- size="small"- leftIcon={<Icon icon={Login03Icon} className="size-4" />}- variant="secondary"- >- Log In- </Button>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/MenuIcon/MenuIcon.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/MenuIcon/MenuIcon.tsxdeleted file mode 100644index 192ae03314..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/MenuIcon/MenuIcon.tsx+++ /dev/null@@ -1,164 +0,0 @@-export function BuilderIcon() {- return (- <svg- width="20"- height="20"- viewBox="0 0 20 20"- fill="none"- xmlns="http://www.w3.org/2000/svg"- >- <path- d="M2.47508 10.7667C2.22905 10.9145 2.02535 11.1233 1.88374 11.373C1.74212 11.6226 1.66738 11.9046 1.66675 12.1917V14.8917C1.66738 15.1787 1.74212 15.4607 1.88374 15.7103C2.02535 15.96 2.22905 16.1688 2.47508 16.3167L4.97508 17.8167C5.2343 17.9724 5.53101 18.0547 5.83341 18.0547C6.13582 18.0547 6.43253 17.9724 6.69175 17.8167L10.0001 15.8333V11.25L5.83341 8.75L2.47508 10.7667Z"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M5.8333 13.75L1.8833 11.375"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M5.83325 13.75L9.99992 11.25"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M5.83325 13.75V18.0583"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M10 11.25V15.8333L13.3083 17.8167C13.5676 17.9724 13.8643 18.0547 14.1667 18.0547C14.4691 18.0547 14.7658 17.9724 15.025 17.8167L17.525 16.3167C17.771 16.1688 17.9747 15.96 18.1163 15.7103C18.258 15.4607 18.3327 15.1787 18.3333 14.8917V12.1917C18.3327 11.9046 18.258 11.6226 18.1163 11.373C17.9747 11.1233 17.771 10.9145 17.525 10.7667L14.1667 8.75L10 11.25Z"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M14.1667 13.75L10 11.25"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M14.1667 13.75L18.1167 11.375"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M14.1667 13.75V18.0583"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M6.64159 3.68333C6.39555 3.83115 6.19186 4.04 6.05024 4.28965C5.90862 4.53931 5.83388 4.8213 5.83325 5.10833V8.75L9.99992 11.25L14.1666 8.75V5.10833C14.166 4.8213 14.0912 4.53931 13.9496 4.28965C13.808 4.04 13.6043 3.83115 13.3583 3.68333L10.8583 2.18333C10.599 2.02759 10.3023 1.94531 9.99992 1.94531C9.69751 1.94531 9.4008 2.02759 9.14159 2.18333L6.64159 3.68333Z"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M10 6.66669L6.05005 4.29169"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M10 6.66669L13.95 4.29169"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M10 11.25V6.66669"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- </svg>- );-}--export function MarketplaceIcon() {- return (- <svg- width="20"- height="20"- viewBox="0 0 20 20"- fill="none"- xmlns="http://www.w3.org/2000/svg"- >- <g clipPath="url(#clip0_274_1265)">- <path- d="M6.66659 18.3334C7.12682 18.3334 7.49992 17.9603 7.49992 17.5C7.49992 17.0398 7.12682 16.6667 6.66659 16.6667C6.20635 16.6667 5.83325 17.0398 5.83325 17.5C5.83325 17.9603 6.20635 18.3334 6.66659 18.3334Z"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M15.8333 18.3334C16.2936 18.3334 16.6667 17.9603 16.6667 17.5C16.6667 17.0398 16.2936 16.6667 15.8333 16.6667C15.3731 16.6667 15 17.0398 15 17.5C15 17.9603 15.3731 18.3334 15.8333 18.3334Z"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M1.70825 1.70831H3.37492L5.59159 12.0583C5.6729 12.4374 5.88381 12.7762 6.18801 13.0165C6.49221 13.2568 6.87067 13.3836 7.25825 13.375H15.4083C15.7876 13.3744 16.1553 13.2444 16.4508 13.0065C16.7462 12.7686 16.9517 12.4371 17.0333 12.0666L18.4083 5.87498H4.26659"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- </g>- <defs>- <clipPath id="clip0_274_1265">- <rect width="20" height="20" fill="white" />- </clipPath>- </defs>- </svg>- );-}--export function HomepageIcon() {- return (- <svg- width="20"- height="20"- viewBox="0 0 20 20"- fill="none"- xmlns="http://www.w3.org/2000/svg"- >- <path- d="M2.5 7.50002L10 1.66669L17.5 7.50002V16.6667C17.5 17.1087 17.3244 17.5326 17.0118 17.8452C16.6993 18.1578 16.2754 18.3334 15.8333 18.3334H4.16667C3.72464 18.3334 3.30072 18.1578 2.98816 17.8452C2.67559 17.5326 2.5 17.1087 2.5 16.6667V7.50002Z"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- />- <path- d="M7.5 18.3333V10H12.5V18.3333"- stroke="currentColor"- strokeWidth="1.25"- strokeLinecap="round"- strokeLinejoin="round"- />- </svg>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/MobileNavbar/MobileNavBar.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/MobileNavbar/MobileNavBar.tsxdeleted file mode 100644index da3746eb20..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/MobileNavbar/MobileNavBar.tsx+++ /dev/null@@ -1,132 +0,0 @@-"use client";--import {- Popover,- PopoverContent,- PopoverPortal,- PopoverTrigger,-} from "@/components/__legacy__/ui/popover";-import { Separator } from "@/components/__legacy__/ui/separator";-import Avatar, {- AvatarFallback,- AvatarImage,-} from "@/components/atoms/Avatar/Avatar";-import { Button } from "@/components/atoms/Button/Button";-import { AnimatePresence, motion } from "framer-motion";-import { usePathname } from "next/navigation";-import * as React from "react";-import { MenuItemGroup } from "../../helpers";-import { MobileNavbarLogoutItem } from "./components/MobileNavbarLogoutItem";-import { MobileNavbarMenuItem } from "./components/MobileNavbarMenuItem";-import { ArrowUp01Icon, Menu01Icon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--interface MobileNavBarProps {- userName?: string;- userEmail?: string;- avatarSrc?: string;- menuItemGroups: MenuItemGroup[];-}--const Overlay = React.forwardRef<HTMLDivElement, { children: React.ReactNode }>(- ({ children }, ref) => (- <div ref={ref} className="h-screen w-screen backdrop-blur-md">- {children}- </div>- ),-);--Overlay.displayName = "Overlay";--export function MobileNavBar({- userName,- userEmail,- avatarSrc,- menuItemGroups,-}: MobileNavBarProps) {- const [isOpen, setIsOpen] = React.useState(false);- const pathname = usePathname();- const parts = pathname.split("/");- const activeLink = parts.length > 1 ? parts[1] : parts[0];-- return (- <Popover open={isOpen} onOpenChange={setIsOpen}>- <PopoverTrigger asChild>- <Button- variant="ghost"- aria-label="Open menu"- className="min-w-auto flex !min-w-[3.75rem] items-center justify-center md:hidden"- data-testid="mobile-nav-bar-trigger"- >- {isOpen ? (- <Icon icon={ArrowUp01Icon} className="size-6 stroke-slate-800" />- ) : (- <Icon icon={Menu01Icon} className="size-6 stroke-slate-800" />- )}- <span className="sr-only">Open menu</span>- </Button>- </PopoverTrigger>- <AnimatePresence>- <PopoverPortal>- <Overlay>- <PopoverContent asChild>- <motion.div- initial={{ opacity: 0, y: -32 }}- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, y: -32, transition: { duration: 0.2 } }}- className="w-screen rounded-b-2xl bg-white"- >- <div className="mb-4 inline-flex w-full items-end justify-start gap-4">- <Avatar className="h-14 w-14">- <AvatarImage- src={avatarSrc}- alt={userName || "Unknown User"}- />- <AvatarFallback>{userName}</AvatarFallback>- </Avatar>- <div className="relative h-14 w-full">- <div className="absolute left-0 top-0 text-lg font-semibold leading-7 text-[#474747]">- {userName || "Unknown User"}- </div>- <div className="absolute left-0 top-6 font-sans text-base font-normal leading-7 text-[#474747]">- {userEmail || "No Email Set"}- </div>- </div>- </div>- <Separator className="mb-4" />- {menuItemGroups.map((group, groupIndex) => (- <React.Fragment key={groupIndex}>- {group.items.map((item, itemIndex) => {- if (item.text === "Log out") {- return (- <MobileNavbarLogoutItem- key={itemIndex}- icon={item.icon}- text={item.text}- />- );- }- return (- <MobileNavbarMenuItem- key={itemIndex}- icon={item.icon}- isActive={item.href === activeLink}- text={item.text}- onClick={item.onClick}- href={item.href}- />- );- })}- {groupIndex < menuItemGroups.length - 1 && (- <Separator className="my-4" />- )}- </React.Fragment>- ))}- </motion.div>- </PopoverContent>- </Overlay>- </PopoverPortal>- </AnimatePresence>- </Popover>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/MobileNavbar/components/MobileNavbarLogoutItem.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/MobileNavbar/components/MobileNavbarLogoutItem.tsxdeleted file mode 100644index d4798cc170..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/MobileNavbar/components/MobileNavbarLogoutItem.tsx+++ /dev/null@@ -1,31 +0,0 @@-"use client";--import { IconType } from "@/components/__legacy__/ui/icons";-import { useRouter } from "next/navigation";-import { getAccountMenuOptionIcon } from "../../../helpers";--interface Props {- icon: IconType;- text: string;-}--export function MobileNavbarLogoutItem({ icon, text }: Props) {- const router = useRouter();-- async function handleLogout() {- router.replace("/logout");- }-- return (- <button className="w-full" onClick={handleLogout} type="button">- <div className="inline-flex w-full items-center justify-start gap-4 py-2 hover:rounded hover:bg-[#e0e0e0]">- {getAccountMenuOptionIcon(icon)}- <div className="relative">- <div className="font-sans text-base font-normal leading-7 text-[#474747]">- {text}- </div>- </div>- </div>- </button>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/MobileNavbar/components/MobileNavbarMenuItem.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/MobileNavbar/components/MobileNavbarMenuItem.tsxdeleted file mode 100644index fa190b63b7..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/MobileNavbar/components/MobileNavbarMenuItem.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { IconType } from "@/components/__legacy__/ui/icons";-import { cn } from "@/lib/utils";-import Link from "next/link";-import { getAccountMenuOptionIcon } from "../../../helpers";--interface Props {- icon: IconType;- isActive: boolean;- text: string;- href?: string;- onClick?: () => void;-}--export function MobileNavbarMenuItem({- icon,- isActive,- text,- href,- onClick,-}: Props) {- const content = (- <div className="inline-flex w-full items-center justify-start gap-4 py-2 hover:rounded hover:bg-[#e0e0e0]">- {getAccountMenuOptionIcon(icon)}- <div className="relative">- <div- className={cn(- "font-sans text-base font-normal leading-7",- isActive ? "font-semibold text-[#272727]" : "text-[#474747]",- )}- >- {text}- </div>- {isActive && (- <div className="absolute bottom-[-4px] left-0 h-[2px] w-full bg-[#272727]"></div>- )}- </div>- </div>- );-- if (onClick)- return (- <div className="w-full" onClick={onClick}>- {content}- </div>- );- if (href)- return (- <Link href={href} className="w-full">- {content}- </Link>- );- return content;-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLink.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLink.tsxdeleted file mode 100644index 7a8c6e354e..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLink.tsx+++ /dev/null@@ -1,100 +0,0 @@-"use client";--import { cn } from "@/lib/utils";-import Link from "next/link";-import { usePathname } from "next/navigation";-import { Text } from "../../../atoms/Text/Text";-import {- BuilderIcon,- HomepageIcon,- MarketplaceIcon,-} from "./MenuIcon/MenuIcon";-import { CheckListIcon, LaptopIcon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--const iconBaseClass = "h-4 w-4 shrink-0";-const iconNudgedClass = "relative bottom-[2px] h-4 w-4 shrink-0";--interface Props {- name: string;- href: string;-}--export function NavbarLink({ name, href }: Props) {- const pathname = usePathname();-- const isActive =- href === "/home"- ? pathname === "/" || pathname.startsWith("/home")- : pathname.includes(href);-- return (- <Link href={href} data-testid={`navbar-link-${name.toLowerCase()}`}>- <div- className={cn(- "flex items-center justify-start gap-2.5 p-1 md:p-2",- isActive &&- "rounded-small bg-neutral-800 py-1 pl-1 pr-1.5 transition-all duration-300 md:py-[0.7rem] md:pl-2 md:pr-3",- )}- >- {href === "/marketplace" && (- <div- className={cn(- iconNudgedClass,- isActive && "text-white dark:text-black",- )}- >- <MarketplaceIcon />- </div>- )}- {href === "/build" && (- <div- className={cn(- iconNudgedClass,- isActive && "text-white dark:text-black",- )}- >- <BuilderIcon />- </div>- )}- {href === "/monitor" && (- <Icon- icon={LaptopIcon}- className={cn(- iconBaseClass,- isActive && "text-white dark:text-black",- )}- />- )}- {href === "/home" && (- <div- className={cn(- iconNudgedClass,- isActive && "text-white dark:text-black",- )}- >- <HomepageIcon />- </div>- )}- {href === "/library" && (- <Icon- icon={CheckListIcon}- className={cn(- "h-5 w-5 shrink-0",- isActive && "text-white dark:text-black",- )}- />- )}- <Text- variant="h5"- className={cn(- "hidden !font-poppins leading-none xl:block",- isActive ? "!text-white" : "!text-black",- )}- >- {name}- </Text>- </div>- </Link>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLoading.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLoading.tsxdeleted file mode 100644index 322574fdb0..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLoading.tsx+++ /dev/null@@ -1,20 +0,0 @@-import { IconAutoGPTLogo } from "@/components/__legacy__/ui/icons";-import { Skeleton } from "@/components/__legacy__/ui/skeleton";--export function NavbarLoading() {- return (- <nav className="sticky top-0 z-40 hidden h-16 items-center rounded-bl-2xl rounded-br-2xl border border-white/50 bg-white/5 p-3 backdrop-blur-[26px] md:inline-flex">- <div className="flex flex-1 items-center gap-6">- <Skeleton className="h-6 w-24 bg-zinc-200/60" />- <Skeleton className="h-6 w-24 bg-zinc-200/60" />- <Skeleton className="h-6 w-16 bg-zinc-200/60" />- </div>- <div className="absolute left-1/2 top-1/2 h-10 w-[88.87px] -translate-x-1/2 -translate-y-1/2">- <IconAutoGPTLogo className="h-full w-full" />- </div>- <div className="flex flex-1 items-center justify-end gap-4">- <Skeleton className="h-8 w-8 rounded-full bg-zinc-200/60" />- </div>- </nav>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/OrgTeamSwitcher/OrgTeamSwitcher.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/OrgTeamSwitcher/OrgTeamSwitcher.tsxdeleted file mode 100644index 7fb19f428c..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/OrgTeamSwitcher/OrgTeamSwitcher.tsx+++ /dev/null@@ -1,136 +0,0 @@-import {- Popover,- PopoverContent,- PopoverTrigger,-} from "@/components/__legacy__/ui/popover";-import Avatar, {- AvatarFallback,- AvatarImage,-} from "@/components/atoms/Avatar/Avatar";-import { useOrgTeamSwitcher } from "./useOrgTeamSwitcher";-import Link from "next/link";-import {- ArrowDown01Icon,- Settings02Icon,- Tick02Icon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--export function OrgTeamSwitcher() {- const {- orgs,- teams,- activeOrg,- activeTeam,- switchOrg,- switchTeam,- isLoaded,- } = useOrgTeamSwitcher();-- if (!isLoaded || orgs.length === 0) {- return null;- }-- return (- <Popover>- <PopoverTrigger asChild>- <button- type="button"- className="flex cursor-pointer items-center gap-1.5 rounded-lg bg-white/60 px-2.5 py-1.5 text-sm font-medium text-neutral-700 hover:bg-white/80"- aria-label="Switch organization"- data-testid="org-switcher-trigger"- >- <Avatar className="h-5 w-5">- <AvatarImage- src={activeOrg?.avatarUrl ?? ""}- alt=""- aria-hidden="true"- />- <AvatarFallback className="text-xs" aria-hidden="true">- {activeOrg?.name?.charAt(0) || "O"}- </AvatarFallback>- </Avatar>- <span className="max-w-[8rem] truncate">{activeOrg?.name}</span>- <Icon icon={ArrowDown01Icon} size={12} />- </button>- </PopoverTrigger>-- <PopoverContent- className="flex w-64 flex-col gap-2 rounded-xl bg-white p-2 shadow-lg"- align="end"- data-testid="org-switcher-popover"- >- {/* Org list */}- <div className="flex flex-col gap-0.5">- <span className="px-2 py-1 text-xs font-medium uppercase text-neutral-400">- Organizations- </span>- {orgs.map((org) => (- <button- key={org.id}- type="button"- className="flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-sm hover:bg-neutral-100"- onClick={() => switchOrg(org.id)}- >- <Avatar className="h-5 w-5">- <AvatarImage src={org.avatarUrl ?? ""} alt="" />- <AvatarFallback className="text-xs">- {org.name.charAt(0)}- </AvatarFallback>- </Avatar>- <span className="flex-1 truncate text-left">{org.name}</span>- {org.isPersonal && (- <span className="text-xs text-neutral-400">Personal</span>- )}- {org.id === activeOrg?.id && (- <Icon icon={Tick02Icon} size={14} className="text-green-600" />- )}- </button>- ))}- {/* "Create organization" is intentionally hidden until the org- management frontend ships (PR1 is backend-only; /org/settings- does not exist yet). */}- </div>-- {/* Team list (only if orgs exist) */}- {teams.length > 0 && (- <>- <div className="border-t border-neutral-100" />- <div className="flex flex-col gap-0.5">- <span className="px-2 py-1 text-xs font-medium uppercase text-neutral-400">- Teams- </span>- {teams.map((ws) => (- <button- key={ws.id}- type="button"- className="flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-sm hover:bg-neutral-100"- onClick={() => switchTeam(ws.id)}- >- <span className="flex-1 truncate text-left">{ws.name}</span>- {ws.joinPolicy === "PRIVATE" && (- <span className="text-xs text-neutral-400">Private</span>- )}- {ws.id === activeTeam?.id && (- <Icon- icon={Tick02Icon}- size={14}- className="text-green-600"- />- )}- </button>- ))}- <Link- href="/org/teams"- className="flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm text-neutral-500 hover:bg-neutral-100"- >- <Icon icon={Settings02Icon} size={14} />- <span>Manage teams</span>- </Link>- </div>- </>- )}- </PopoverContent>- </Popover>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/OrgTeamSwitcher/__tests__/OrgTeamSwitcher.test.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/OrgTeamSwitcher/__tests__/OrgTeamSwitcher.test.tsxdeleted file mode 100644index 84ea7b461b..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/OrgTeamSwitcher/__tests__/OrgTeamSwitcher.test.tsx+++ /dev/null@@ -1,168 +0,0 @@-import { useOrgTeamStore } from "@/services/org-team/store";-import { render, screen, waitFor } from "@/tests/integrations/test-utils";-import userEvent from "@testing-library/user-event";-import { beforeEach, describe, expect, it } from "vitest";--import { OrgTeamSwitcher } from "../OrgTeamSwitcher";--const PERSONAL_ORG = {- id: "org-personal",- name: "Jane's Org",- slug: "jane",- avatarUrl: null,- isPersonal: true,- memberCount: 1,-};--const COMPANY_ORG = {- id: "org-company",- name: "Acme Inc",- slug: "acme",- avatarUrl: null,- isPersonal: false,- memberCount: 12,-};--const DEFAULT_TEAM = {- id: "team-default",- name: "General",- slug: "general",- isDefault: true,- joinPolicy: "OPEN",- orgId: COMPANY_ORG.id,-};--const PRIVATE_TEAM = {- id: "team-private",- name: "Skunkworks",- slug: "skunkworks",- isDefault: false,- joinPolicy: "PRIVATE",- orgId: COMPANY_ORG.id,-};--function seedStore(overrides: Partial<ReturnType<typeof baseState>> = {}) {- useOrgTeamStore.setState({ ...baseState(), ...overrides });-}--function baseState() {- return {- activeOrgID: COMPANY_ORG.id,- activeTeamID: DEFAULT_TEAM.id,- orgs: [PERSONAL_ORG, COMPANY_ORG],- teams: [DEFAULT_TEAM, PRIVATE_TEAM],- isLoaded: true,- };-}--async function openSwitcher() {- await userEvent.click(screen.getByTestId("org-switcher-trigger"));- await waitFor(() => {- expect(screen.getByTestId("org-switcher-popover")).toBeDefined();- });-}--describe("OrgTeamSwitcher", () => {- beforeEach(() => {- window.localStorage.clear();- });-- it("renders nothing before the org context has loaded", () => {- seedStore({ isLoaded: false });-- const { container } = render(<OrgTeamSwitcher />);-- expect(container.innerHTML).toBe("");- });-- it("renders nothing when the user belongs to no orgs", () => {- seedStore({ orgs: [], teams: [] });-- const { container } = render(<OrgTeamSwitcher />);-- expect(container.innerHTML).toBe("");- });-- it("shows the active org name on the trigger", () => {- seedStore();-- render(<OrgTeamSwitcher />);-- expect(screen.getByTestId("org-switcher-trigger").textContent).toContain(- COMPANY_ORG.name,- );- });-- it("lists every org with a Personal badge on the personal org", async () => {- seedStore();- render(<OrgTeamSwitcher />);-- await openSwitcher();-- expect(screen.getAllByText(COMPANY_ORG.name).length).toBeGreaterThan(0);- expect(screen.getByText(PERSONAL_ORG.name)).toBeDefined();- expect(screen.getByText("Personal")).toBeDefined();- // "Create organization" is hidden until the org management frontend- // ships (PR1 is backend-only; /org/settings does not exist yet).- expect(screen.queryByText("Create organization")).toBeNull();- });-- it("lists teams with a Private badge on invite-only teams", async () => {- seedStore();- render(<OrgTeamSwitcher />);-- await openSwitcher();-- expect(screen.getByText(DEFAULT_TEAM.name)).toBeDefined();- expect(screen.getByText(PRIVATE_TEAM.name)).toBeDefined();- expect(screen.getByText("Private")).toBeDefined();- expect(screen.getByText("Manage teams")).toBeDefined();- });-- it("hides the team section when the org has no teams", async () => {- seedStore({ teams: [] });- render(<OrgTeamSwitcher />);-- await openSwitcher();-- expect(screen.queryByText("Teams")).toBeNull();- expect(screen.queryByText("Manage teams")).toBeNull();- });-- it("switching org updates the store and resets the active team", async () => {- seedStore();- render(<OrgTeamSwitcher />);-- await openSwitcher();- await userEvent.click(screen.getByText(PERSONAL_ORG.name));-- expect(useOrgTeamStore.getState().activeOrgID).toBe(PERSONAL_ORG.id);- expect(useOrgTeamStore.getState().activeTeamID).toBeNull();- });-- it("switching team updates the store without touching the active org", async () => {- seedStore();- render(<OrgTeamSwitcher />);-- await openSwitcher();- await userEvent.click(screen.getByText(PRIVATE_TEAM.name));-- expect(useOrgTeamStore.getState().activeTeamID).toBe(PRIVATE_TEAM.id);- expect(useOrgTeamStore.getState().activeOrgID).toBe(COMPANY_ORG.id);- });-- it("re-selecting the already-active org leaves state untouched", async () => {- seedStore();- render(<OrgTeamSwitcher />);-- await openSwitcher();- const popover = screen.getByTestId("org-switcher-popover");- const activeOrgButton = Array.from(popover.querySelectorAll("button")).find(- (b) => b.textContent?.includes(COMPANY_ORG.name),- );- await userEvent.click(activeOrgButton!);-- expect(useOrgTeamStore.getState().activeOrgID).toBe(COMPANY_ORG.id);- expect(useOrgTeamStore.getState().activeTeamID).toBe(DEFAULT_TEAM.id);- });-});diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/PreviewBanner/PreviewBanner.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/PreviewBanner/PreviewBanner.tsxdeleted file mode 100644index 10a62dd611..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/PreviewBanner/PreviewBanner.tsx+++ /dev/null@@ -1,14 +0,0 @@-type Props = {- branchName: string;-};--export function PreviewBanner({ branchName }: Props) {- if (!branchName) return null;-- return (- <div className="w-full bg-green-500 px-4 py-2 text-center text-sm font-medium text-white">- This is a Preview build for the branch:{" "}- <span className="font-mono text-xs font-semibold">{branchName}</span>- </div>- );-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/__tests__/FeedbackButton.test.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/__tests__/FeedbackButton.test.tsxdeleted file mode 100644index 282b46c6b8..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/__tests__/FeedbackButton.test.tsx+++ /dev/null@@ -1,66 +0,0 @@-import {- act,- fireEvent,- render,- screen,-} from "@/tests/integrations/test-utils";-import { stubTallyEmbed } from "@/tests/integrations/tally";-import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";-import { FeedbackButton } from "../FeedbackButton";--vi.mock("@sentry/nextjs", () => ({ getReplay: vi.fn() }));-vi.mock("@/lib/auth/hooks/useAuth", () => ({- useAuth: () => ({ isLoggedIn: false, isUserLoading: false }),-}));--let tally: ReturnType<typeof stubTallyEmbed>;--function feedbackButton() {- return screen.getByRole<HTMLButtonElement>("button", {- name: "Give Feedback",- });-}--describe("FeedbackButton", () => {- beforeEach(() => {- window.history.replaceState({}, "", "/marketplace");- tally = stubTallyEmbed();- });-- afterEach(async () => {- await tally.restore();- });-- test("loads Tally only after a click and waits for it before opening the form", async () => {- render(<FeedbackButton />);- expect(tally.scripts).toHaveLength(0);-- fireEvent.click(feedbackButton());-- expect(tally.scripts).toHaveLength(1);- expect(feedbackButton().disabled).toBe(true);- expect(tally.openPopup).not.toHaveBeenCalled();-- await tally.finishLoading();-- expect(feedbackButton().disabled).toBe(false);- expect(tally.openPopup).toHaveBeenCalledWith(- "3yx2L0",- expect.objectContaining({- hiddenFields: expect.objectContaining({ isAuthenticated: "false" }),- }),- );- });-- test("hides while the form is open and comes back once it closes", async () => {- render(<FeedbackButton />);- fireEvent.click(feedbackButton());- await tally.finishLoading();-- act(() => tally.popupOptions().onOpen());- expect(screen.queryByRole("button", { name: "Give Feedback" })).toBeNull();-- act(() => tally.popupOptions().onClose());- expect(feedbackButton()).toBeDefined();- });-});diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/helpers.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/helpers.tsxindex 58989fb117..decbfab497 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/helpers.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/helpers.tsx@@ -1,46 +1,4 @@-import {- IconBuilder,- IconEdit,- IconLibrary,- IconLogOut,- IconMarketplace,- IconRefresh,- IconSettings,- IconSliders,- IconType,- IconUploadCloud,-} from "@/components/__legacy__/ui/icons";-import {- CreditCardIcon,- MessageMultiple02Icon,- NewsIcon,- QuestionIcon,- Store01Icon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--type Link = {- name: string;- href: string;-};--export const loggedInLinks: Link[] = [- {- name: "Marketplace",- href: "/marketplace",- },- {- name: "Build",- href: "/build",- },-];--export const loggedOutLinks: Link[] = [- {- name: "Marketplace",- href: "/marketplace",- },-];+import { IconType } from "@/components/__legacy__/ui/icons";export type MenuItemGroup = {groupName?: string;@@ -53,65 +11,10 @@ export type MenuItemGroup = {}[];};-export const accountMenuItems: MenuItemGroup[] = [- {- items: [- {- icon: IconType.Edit,- text: "Account",- href: "/settings/account",- },- ],- },- {- items: [- {- icon: IconType.LayoutDashboard,- text: "Creator Dashboard",- href: "/settings/creator-dashboard",- },- {- icon: IconType.UploadCloud,- text: "Publish a workflow",- },- ],- },- {- items: [- {- icon: IconType.Settings,- text: "Settings",- href: "/settings",- },- ],- },- {- items: [- {- icon: IconType.LogOut,- text: "Log out",- },- ],- },-];-export function getAccountMenuItems(userRole?: string,- newLayout = false,isBillingEnabled = true,): MenuItemGroup[] {- const groups = newLayout- ? getNewLayoutAccountMenuItems(userRole)- : getClassicAccountMenuItems(userRole);- if (isBillingEnabled) return groups;- return groups.map((group) => ({- ...group,- items: group.items.filter((item) => item.href !== "/settings/billing"),- }));-}--// New sidebar layout grouping — gated behind the AUTOGPT_NEW_LAYOUT flag.-function getNewLayoutAccountMenuItems(userRole?: string): MenuItemGroup[] {const footerItems: MenuItemGroup["items"] = [{icon: IconType.WhatsNew,@@ -153,11 +56,15 @@ function getNewLayoutAccountMenuItems(userRole?: string): MenuItemGroup[] {text: "Settings",href: "/settings/account",},- {- icon: IconType.Billing,- text: "Billing",- href: "/settings/billing",- },+ ...(isBillingEnabled+ ? [+ {+ icon: IconType.Billing,+ text: "Billing",+ href: "/settings/billing",+ },+ ]+ : []),],},{@@ -165,96 +72,3 @@ function getNewLayoutAccountMenuItems(userRole?: string): MenuItemGroup[] {},];}--// Classic Navbar grouping (unchanged, pre-new-layout).-function getClassicAccountMenuItems(userRole?: string): MenuItemGroup[] {- const baseMenuItems: MenuItemGroup[] = [- {- items: [- {- icon: IconType.Edit,- text: "Profile",- href: "/settings/profile",- },- {- icon: IconType.Settings,- text: "Settings",- href: "/settings/account",- },- {- icon: IconType.Billing,- text: "Billing",- href: "/settings/billing",- },- {- icon: IconType.LayoutDashboard,- text: "Creator Dashboard",- href: "/settings/creator-dashboard",- },- {- icon: IconType.Help,- text: "Help & Docs",- href: "https://agpt.co/docs",- external: true,- },- ],- },- ];-- if (userRole === "admin") {- baseMenuItems.push({- items: [- {- icon: IconType.Sliders,- text: "Admin",- href: "/admin/marketplace",- },- ],- });- }-- baseMenuItems.push({- items: [- {- icon: IconType.LogOut,- text: "Log out",- },- ],- });-- return baseMenuItems;-}--export function getAccountMenuOptionIcon(icon: IconType) {- const iconClass = "size-4";- switch (icon) {- case IconType.LayoutDashboard:- return <Icon icon={Store01Icon} className={iconClass} />;- case IconType.UploadCloud:- return <IconUploadCloud className={iconClass} />;- case IconType.Edit:- return <IconEdit className={iconClass} />;- case IconType.Settings:- return <IconSettings className={iconClass} />;- case IconType.LogOut:- return <IconLogOut className={iconClass} />;- case IconType.Marketplace:- return <IconMarketplace className={iconClass} />;- case IconType.Library:- return <IconLibrary className={iconClass} />;- case IconType.Builder:- return <IconBuilder className={iconClass} />;- case IconType.Sliders:- return <IconSliders className={iconClass} />;- case IconType.Chat:- return <Icon icon={MessageMultiple02Icon} className={iconClass} />;- case IconType.Billing:- return <Icon icon={CreditCardIcon} className={iconClass} />;- case IconType.Help:- return <Icon icon={QuestionIcon} className={iconClass} />;- case IconType.WhatsNew:- return <Icon icon={NewsIcon} className={iconClass} />;- default:- return <IconRefresh className={iconClass} />;- }-}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/useNavbar.ts b/autogpt_platform/frontend/src/components/layout/Navbar/useNavbar.tsdeleted file mode 100644index e502d635cf..0000000000--- a/autogpt_platform/frontend/src/components/layout/Navbar/useNavbar.ts+++ /dev/null@@ -1,28 +0,0 @@-import { useGetV2GetUserProfile } from "@/app/api/__generated__/endpoints/store/store";-import { isLogoutInProgress } from "@/lib/autogpt-server-api/helpers";-import { useAuth } from "@/lib/auth/hooks/useAuth";--export function useNavbar() {- const { isLoggedIn, isUserLoading } = useAuth();- const logoutInProgress = isLogoutInProgress();-- const {- data: profileResponse,- isLoading: isProfileLoading,- error: profileError,- } = useGetV2GetUserProfile({- query: {- enabled: isLoggedIn === true && !logoutInProgress,- },- });-- const profile = profileResponse?.data || null;- const isLoading = isUserLoading || (isLoggedIn && isProfileLoading);-- return {- isLoggedIn,- profile,- isLoading,- profileError,- };-}diff --git a/autogpt_platform/frontend/src/lib/constants.ts b/autogpt_platform/frontend/src/lib/constants.tsindex 2945dd0b3b..ad00c64de1 100644--- a/autogpt_platform/frontend/src/lib/constants.ts+++ b/autogpt_platform/frontend/src/lib/constants.ts@@ -14,8 +14,5 @@ export const API_KEY_HEADER_NAME = "X-API-Key";export const CLIENT_COUNTRY_TOKEN_HEADER_NAME = "X-Client-Country-Token";export const VERCEL_COUNTRY_HEADER_NAME = "x-vercel-ip-country";-// Layout-export const NAVBAR_HEIGHT_PX = 60;-// Routesexport const MARKETPLACE_EXPERTS_HREF = "/marketplace#experts";diff --git a/autogpt_platform/frontend/src/playwright/journeys/hosted-flags.json b/autogpt_platform/frontend/src/playwright/journeys/hosted-flags.jsonindex 7621808e0b..a63e362baf 100644--- a/autogpt_platform/frontend/src/playwright/journeys/hosted-flags.json+++ b/autogpt_platform/frontend/src/playwright/journeys/hosted-flags.json@@ -1,10 +1,8 @@{"hire-experts": true,- "autogpt-new-layout": true,"onboarding-brain-dump": true,"onboarding-expert-team": true,"artifacts-page": true,- "chat-search": true,"skills-hub": true,"graphiti-memory": true,"expert-spend-approval": true,diff --git a/autogpt_platform/frontend/src/playwright/pages/header.page.ts b/autogpt_platform/frontend/src/playwright/pages/header.page.tsdeleted file mode 100644index 25520608c8..0000000000--- a/autogpt_platform/frontend/src/playwright/pages/header.page.ts+++ /dev/null@@ -1,9 +0,0 @@-import { Locator, Page } from "@playwright/test";--function getNotificationButton(page: Page): Locator {- return page.locator('button[title="Agent Activity"]');-}--export const headerTest = {- getNotificationButton,-};diff --git a/autogpt_platform/frontend/src/playwright/pages/navbar.page.ts b/autogpt_platform/frontend/src/playwright/pages/navbar.page.tsindex 4da50427f8..98043dde40 100644--- a/autogpt_platform/frontend/src/playwright/pages/navbar.page.ts+++ b/autogpt_platform/frontend/src/playwright/pages/navbar.page.ts@@ -1,15 +1,23 @@import { Page } from "@playwright/test";+// Global navigation lives in the app sidebar; the account menu trigger sits in+// its footer.export class NavBar {constructor(private page: Page) {}+ private sidebarLink(name: string) {+ return this.page+ .locator('[data-sidebar="sidebar"]')+ .getByRole("link", { name, exact: true });+ }+async clickProfileLink() {await this.page.getByTestId("profile-popout-menu-trigger").click();await this.page.getByRole("link", { name: "Profile" }).click();}async clickBuildLink() {- const link = this.page.getByTestId("navbar-link-build");+ const link = this.sidebarLink("Build");await link.waitFor({ state: "visible", timeout: 15000 });await link.scrollIntoViewIfNeeded();await link.click();@@ -17,7 +25,7 @@ export class NavBar {}async clickMarketplaceLink() {- await this.page.getByTestId("navbar-link-marketplace").click();+ await this.sidebarLink("Marketplace").click();}async getUserMenuButton() {diff --git a/autogpt_platform/frontend/src/playwright/utils/signup.ts b/autogpt_platform/frontend/src/playwright/utils/signup.tsindex 9255572832..75d6ddf288 100644--- a/autogpt_platform/frontend/src/playwright/utils/signup.ts+++ b/autogpt_platform/frontend/src/playwright/utils/signup.ts@@ -2,6 +2,7 @@ import { TestUser } from "./auth";import { getSelectors } from "./selectors";import { isVisible } from "./assertion";import { BuildPage } from "../pages/build.page";+import { NavBar } from "../pages/navbar.page";import { skipOnboardingIfPresent } from "./onboarding";import { expect } from "@playwright/test";@@ -89,8 +90,7 @@ export async function signupTestUser(if (withAgent) {// Create a dummy agent for each new user- const buildLink = getId("navbar-link-build");- await buildLink.click();+ await new NavBar(page).clickBuildLink();const blocksBtn = getId("blocks-control-blocks-button");await isVisible(blocksBtn);diff --git a/autogpt_platform/frontend/src/services/environment/index.ts b/autogpt_platform/frontend/src/services/environment/index.tsindex 3203003000..8fbdd841f0 100644--- a/autogpt_platform/frontend/src/services/environment/index.ts+++ b/autogpt_platform/frontend/src/services/environment/index.ts@@ -72,22 +72,6 @@ function getSentryEnvironment() {return override || getEnvironmentStr();}-function getPreviewStealingDev() {- const branch = process.env.NEXT_PUBLIC_PREVIEW_STEALING_DEV || "";- const appEnv = getAppEnv();-- if (- !branch ||- branch === "dev" ||- branch === "refs/heads/dev" ||- appEnv !== AppEnv.DEV- ) {- return null;- }-- return branch;-}-function getRevision() {return process.env.NEXT_PUBLIC_REVISION?.trim() || "";}@@ -208,7 +192,6 @@ export const environment = {getAGPTServerApiUrl,getAGPTServerBaseUrl,getAGPTWsServerUrl,- getPreviewStealingDev,getRevision,getPostHogCredentials,getLaunchDarklyClientId,diff --git a/autogpt_platform/frontend/src/services/feature-flags/__tests__/flag-defaults.test.ts b/autogpt_platform/frontend/src/services/feature-flags/__tests__/flag-defaults.test.tsindex bf72ff4c8f..9ff061b604 100644--- a/autogpt_platform/frontend/src/services/feature-flags/__tests__/flag-defaults.test.ts+++ b/autogpt_platform/frontend/src/services/feature-flags/__tests__/flag-defaults.test.ts@@ -51,14 +51,11 @@ describe("dream/graphiti flag defaults fail closed", () => {});});-// These two have been flipped to `true` in the defaults map twice now, and+// This one has been flipped to `true` in the defaults map twice now, and// both times it silently swapped the onboarding wizard for every// LaunchDarkly-less environment — local dev, CI, Playwright — which is how// auth-happy-path stopped finding the pillbox step.-const ONBOARDING_FLAGS = [- Flag.ONBOARDING_BRAIN_DUMP,- Flag.AUTOGPT_NEW_LAYOUT,-] as const;+const ONBOARDING_FLAGS = [Flag.ONBOARDING_BRAIN_DUMP] as const;describe("onboarding flag defaults fail closed", () => {beforeEach(() => {diff --git a/autogpt_platform/frontend/src/services/feature-flags/__tests__/server-flags.test.tsx b/autogpt_platform/frontend/src/services/feature-flags/__tests__/server-flags.test.tsxindex 882990be22..80501529e7 100644--- a/autogpt_platform/frontend/src/services/feature-flags/__tests__/server-flags.test.tsx+++ b/autogpt_platform/frontend/src/services/feature-flags/__tests__/server-flags.test.tsx@@ -63,7 +63,7 @@ describe("server backend", () => {const { result } = renderHook(() => ({hire: useFlagStatus(Flag.HIRE_EXPERTS),- search: useFlagStatus(Flag.CHAT_SEARCH),+ progressBar: useFlagStatus(Flag.TASK_PROGRESS_BAR),}),{ wrapper: withQueryClient() },);@@ -71,7 +71,7 @@ describe("server backend", () => {await waitFor(() => expect(result.current.hire.answered).toBe(true));expect(result.current.hire.enabled).toBe(true);// A gated route must keep waiting rather than 404 on a flag the vendor never answered.- expect(result.current.search).toMatchObject({+ expect(result.current.progressBar).toMatchObject({enabled: false,answered: false,});@@ -80,7 +80,7 @@ describe("server backend", () => {it("answers every flag with its default when the server has no vendor", async () => {serveFlags({ flags: {}, configured: false });- const { result } = renderHook(() => useFlagStatus(Flag.CHAT_SEARCH), {+ const { result } = renderHook(() => useFlagStatus(Flag.TASK_PROGRESS_BAR), {wrapper: withQueryClient(),});diff --git a/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts b/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.tsindex ca86c8e008..2fb6608737 100644--- a/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts+++ b/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts@@ -23,8 +23,6 @@ const defaultFlags = {[Flag.ARTIFACTS_PAGE]: false,[Flag.CHAT_MODE_OPTION]: false,[Flag.GENERIC_TRIGGER_AGENTS]: false,- [Flag.CHAT_SEARCH]: false,- [Flag.AUTOGPT_NEW_LAYOUT]: false,[Flag.CHAT_WORKSPACE_FILES]: false,[Flag.CHAT_PINNING]: false,[Flag.TASK_PROGRESS_BAR]: false,@@ -84,10 +82,6 @@ function readEnvOverride(flag: Flag): string | undefined {return process.env.NEXT_PUBLIC_FORCE_FLAG_CHAT_MODE_OPTION;case Flag.GENERIC_TRIGGER_AGENTS:return process.env.NEXT_PUBLIC_FORCE_FLAG_GENERIC_TRIGGER_AGENTS;- case Flag.CHAT_SEARCH:- return process.env.NEXT_PUBLIC_FORCE_FLAG_CHAT_SEARCH;- case Flag.AUTOGPT_NEW_LAYOUT:- return process.env.NEXT_PUBLIC_FORCE_FLAG_AUTOGPT_NEW_LAYOUT;case Flag.CHAT_WORKSPACE_FILES:return process.env.NEXT_PUBLIC_FORCE_FLAG_CHAT_WORKSPACE_FILES;case Flag.CHAT_PINNING: