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.
fix(frontend): expert card and chat chip polish (#15002)
Ubbeecede1d24f8b
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsxindex 4116b54e20..58c6b6ebb2 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx@@ -125,7 +125,7 @@ function MainArea({const hasSession = !!sessionId;return (<div className="flex h-full w-full flex-row overflow-hidden">- <div className="relative flex min-w-0 flex-1 overflow-hidden bg-[#fafafa]">+ <div className="relative flex min-w-0 flex-1 overflow-hidden bg-white">{!isBrainDumpEnabled && hasSession && (<DotDistortionShaderdotGap={14}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-integrations.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-integrations.test.tsxindex 1ab9221bbd..8837fbe8fa 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-integrations.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-integrations.test.tsx@@ -1,4 +1,5 @@import { getListExpertCredentialsMockHandler } from "@/app/api/__generated__/endpoints/experts/experts.msw";+import { getListWorkspaceFilesMockHandler200 } from "@/app/api/__generated__/endpoints/workspace/workspace.msw";import type { ExpertCredentialRef } from "@/app/api/__generated__/models/expertCredentialRef";import { server } from "@/mocks/mock-server";import {@@ -7,9 +8,11 @@ import {screen,within,} from "@/tests/integrations/test-utils";-import userEvent from "@testing-library/user-event";-import { describe, expect, it, vi } from "vitest";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { ThreadHeader } from "../components/ChatMessagesContainer/components/ThreadHeader";+import { ContextPanel } from "../components/ContextPanel/ContextPanel";+import { ContextPanelToggle } from "../components/ContextPanel/ContextPanelToggle";+import { useCopilotUIStore } from "../store";vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {const actual =@@ -19,9 +22,10 @@ vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {return { ...actual, useGetFlag: () => true };});+const maria = { id: "expert-maria", name: "Maria" };+const mariaIdentity = {- id: "expert-maria",- name: "Maria",+ ...maria,avatarUrl: null,role: "Marketing Strategist",isArchived: false,@@ -37,14 +41,44 @@ function credential(provider: string): ExpertCredentialRef {};}-function renderHeader() {+function resetPanel() {+ useCopilotUIStore.setState((s) => ({+ integrationsPanelExpert: null,+ artifactPanel: {+ ...s.artifactPanel,+ isOpen: false,+ activeArtifact: null,+ activeTab: "files",+ mode: "artifact",+ isComputerOpen: false,+ },+ }));+}++function renderControls() {return render(- <ThreadHeader expertIdentity={mariaIdentity} readOnly={false} />,+ <>+ <ContextPanelToggle sessionId="session-1" expert={maria} />+ <ContextPanel sessionId="session-1" />+ </>,);}-describe("expert integrations in the thread header", () => {- it("shows the first three logos and counts the rest", async () => {+beforeEach(() => {+ server.use(+ getListWorkspaceFilesMockHandler200({+ files: [],+ offset: 0,+ has_more: false,+ }),+ );+ resetPanel();+});++afterEach(resetPanel);++describe("expert integrations in the chat controls", () => {+ it("shows the first two logos and counts the rest", async () => {server.use(getListExpertCredentialsMockHandler([credential("linkedin"),@@ -55,11 +89,11 @@ describe("expert integrations in the thread header", () => {]),);- renderHeader();+ renderControls();const cluster = await screen.findByTestId("expert-integrations");- expect(within(cluster).getAllByRole("img")).toHaveLength(3);- expect(within(cluster).getByText("+2")).toBeDefined();+ expect(within(cluster).getAllByRole("img")).toHaveLength(2);+ expect(within(cluster).getByText("+3")).toBeDefined();});it("omits the counter when everything fits", async () => {@@ -70,60 +104,40 @@ describe("expert integrations in the thread header", () => {]),);- renderHeader();+ renderControls();const cluster = await screen.findByTestId("expert-integrations");expect(within(cluster).getAllByRole("img")).toHaveLength(2);expect(within(cluster).queryByText(/^\+/)).toBeNull();});- it("lists every integration by name once opened", async () => {+ it("opens the side panel on the expert's integrations", async () => {server.use(getListExpertCredentialsMockHandler([credential("linkedin"),credential("notion"),credential("github"),- credential("slack"),]),);- renderHeader();- await userEvent.click(await screen.findByTestId("expert-integrations"));-- expect(await screen.findByText("slack account")).toBeDefined();- expect(screen.getByText("linkedin account")).toBeDefined();- expect(- screen.getByRole("link", { name: /Manage what Maria can access/ }),- ).toBeDefined();- });+ renderControls();+ fireEvent.click(await screen.findByTestId("expert-integrations"));- it("names an MCP integration after the service, not its URL", async () => {- server.use(- getListExpertCredentialsMockHandler([- {- credential_id: "cred-mcp",- provider: "mcp",- title: "MCP: mcp.sentry.dev",- type: "host_scoped",- },- ]),+ expect(await screen.findByText("Maria's Integrations")).toBeDefined();+ expect(await screen.findByText("github account")).toBeDefined();+ expect(screen.getByLabelText("Hide integrations")).toBeDefined();+ expect(useCopilotUIStore.getState().artifactPanel.activeTab).toBe(+ "integrations",);-- renderHeader();- await userEvent.click(await screen.findByTestId("expert-integrations"));-- expect(await screen.findByText("Sentry")).toBeDefined();- expect(screen.queryByText("MCP: mcp.sentry.dev")).toBeNull();});it("keeps the integration's name when its logo fails to load", async () => {server.use(getListExpertCredentialsMockHandler([credential("linkedin")]));- renderHeader();+ renderControls();const cluster = await screen.findByTestId("expert-integrations");- const logo = within(cluster).getByRole("img", { name: "LinkedIn" });- fireEvent.error(logo);+ fireEvent.error(within(cluster).getByRole("img", { name: "LinkedIn" }));// The PNG is missing for plenty of providers, so the fallback glyph must// still announce which integration it stands for.@@ -132,12 +146,26 @@ describe("expert integrations in the thread header", () => {).toBeDefined();});- it("renders nothing when the expert reaches no integrations", async () => {+ it("shows a placeholder that still opens the panel when there are none", async () => {server.use(getListExpertCredentialsMockHandler([]));- renderHeader();+ renderControls();- expect(await screen.findByTestId("expert-thread-header")).toBeDefined();+ const placeholder = await screen.findByTestId("expert-integrations-empty");expect(screen.queryByTestId("expert-integrations")).toBeNull();+ fireEvent.click(placeholder);++ expect(await screen.findByText("Maria's Integrations")).toBeDefined();+ expect(screen.getByLabelText("Hide integrations")).toBeDefined();+ });++ it("keeps integrations and actions out of the thread chip", async () => {+ server.use(getListExpertCredentialsMockHandler([credential("linkedin")]));++ render(<ThreadHeader expertIdentity={mariaIdentity} />);++ const header = await screen.findByTestId("expert-thread-header");+ expect(within(header).queryByRole("img", { name: "LinkedIn" })).toBeNull();+ expect(within(header).queryByRole("button")).toBeNull();});});diff --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 63f9f5539a..b1989fae5c 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@@ -782,37 +782,7 @@ describe("ChatMessagesContainer — expert identity", () => {expect(screen.queryByTestId("expert-assistant-identity")).toBeNull();});- it("opens the session activity card when the chip is clicked", async () => {- flagState.values["artifacts"] = true;- server.use(- getGetExpertMockHandler(mariaExpert),- getGetV1ListExecutionSchedulesForAUserMockHandler([]),- );- useCopilotUIStore.setState((s) => ({- artifactPanel: { ...s.artifactPanel, isOpen: false, activeTab: "files" },- }));- render(- <ChatMessagesContainer- messages={[assistantMessage]}- status="ready"- error={undefined}- isLoading={false}- expertIdentity={mariaIdentity}- sessionID="session-1"- canOpenActivity- />,- );-- await userEvent.click(- screen.getByRole("button", { name: /Open session activity/ }),- );-- const panel = useCopilotUIStore.getState().artifactPanel;- expect(panel.isOpen).toBe(true);- expect(panel.activeTab).toBe("files");- });-- it("stays a passive label in hosts that never mount the activity card", async () => {+ it("keeps the chip a passive label with no file counter", async () => {flagState.values["artifacts"] = true;let workspaceFileRequests = 0;server.use(@@ -822,8 +792,6 @@ describe("ChatMessagesContainer — expert identity", () => {return HttpResponse.json({ files: [], offset: 0, has_more: false });}),);- // Same live sessionId the builder and memory panels pass — only the host's- // canOpenActivity separates them from the copilot chat.render(<ChatMessagesContainermessages={[assistantMessage]}@@ -836,9 +804,7 @@ describe("ChatMessagesContainer — expert identity", () => {);const header = await screen.findByTestId("expert-thread-header");- expect(- within(header).queryByRole("button", { name: /Open session activity/ }),- ).toBeNull();+ expect(within(header).queryByRole("button")).toBeNull();expect(workspaceFileRequests).toBe(0);});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store.test.tsindex f6a4e56d55..a320d2a7b8 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store.test.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/store.test.ts@@ -522,6 +522,17 @@ describe("lastArtifact session scoping", () => {expect(useCopilotUIStore.getState().artifactPanel.lastArtifact).toBeNull();});+ it("clearLastArtifact forgets the previous chat's expert integrations", () => {+ useCopilotUIStore+ .getState()+ .toggleIntegrationsPanel({ id: "expert-maria", name: "Maria" });+ useCopilotUIStore.getState().closeArtifactPanel();+ useCopilotUIStore.getState().clearLastArtifact();+ const s = useCopilotUIStore.getState();+ expect(s.integrationsPanelExpert).toBeNull();+ expect(s.artifactPanel.activeTab).toBe("files");+ });+it("closing the artifacts tab forgets the remembered preview", () => {useCopilotUIStore.getState().openArtifact(makeArtifact("a"));useCopilotUIStore.getState().closeArtifactPanel();diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsxindex 9fca6c8dbc..8fdc170a85 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx@@ -5,7 +5,6 @@ import {TooltipContent,TooltipTrigger,} from "@/components/atoms/Tooltip/BaseTooltip";-import { cn } from "@/lib/utils";import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { UIDataTypes, UIMessage, UITools } from "ai";import { LayoutGroup, motion } from "framer-motion";@@ -22,7 +21,6 @@ import { useIsUsageLimitReached } from "../UsageLimits/useIsUsageLimitReached";import { TaskProgressBar } from "../TaskProgressBar/TaskProgressBar";import { getLatestTaskList } from "../TaskProgressBar/helpers";import { ContextPanelToggle } from "../ContextPanel/ContextPanelToggle";-import { WorkspaceFileCards } from "../WorkspaceFileCards/WorkspaceFileCards";import { ArchivedExpertNotice } from "./components/ArchivedExpertNotice";import { SessionNotFound } from "./components/SessionNotFound";import { SharedChatNotice } from "./components/SharedChatNotice";@@ -40,7 +38,6 @@ import type { ExpertIdentity } from "../../useExpertMap";import { isTokenDevtoolEnabled } from "../../tokenDevtool/gate";import { updateHistoryBreakdown } from "../../tokenDevtool/store";import { breakdownCacheKey } from "../../tokenDevtool/tokenMath";-import { useAreWorkspaceFileCardsOpen } from "../../useAreWorkspaceFileCardsOpen";import type { SentFrom } from "../../sentFrom";import type { AutopilotMode } from "../../autopilotModeStore";import { AutopilotModeSelector } from "../ChatInput/components/AutopilotModeSelector/AutopilotModeSelector";@@ -165,9 +162,6 @@ export const ChatContainer = ({hasFloatingControls,}: ChatContainerProps) => {const isTaskBarEnabled = useGetFlag(Flag.TASK_PROGRESS_BAR);- // The composer and the message column only slide aside while the floating- // files card is shown; this host is the one that mounts the card.- const areFilesOpen = useAreWorkspaceFileCardsOpen();useAutoOpenArtifacts({sessionId,messages,@@ -328,11 +322,17 @@ export const ChatContainer = ({{sessionId && isSessionNotFound ? (<SessionNotFound />) : sessionId ? (- <div className="relative flex h-full min-h-0 w-full flex-col bg-[#fafafa]">+ <div className="relative flex h-full min-h-0 w-full flex-col bg-white"><div className="absolute right-0 top-0 z-30">- <ContextPanelToggle sessionId={sessionId} />+ <ContextPanelToggle+ sessionId={sessionId}+ expert={+ expertIdentity && !expertIdentity.isArchived+ ? { id: expertIdentity.id, name: expertIdentity.name }+ : null+ }+ /></div>- <WorkspaceFileCards sessionId={sessionId} /><ChatMessagesContainermessages={messages}status={status}@@ -355,8 +355,6 @@ export const ChatContainer = ({expertIdentity={expertIdentity}isResolvingExpertIdentity={isResolvingExpertIdentity}hasFloatingControls={hasFloatingControls}- canOpenActivity- areFilesOpen={areFilesOpen}/>{archivedExpertIdentity ? (<ArchivedExpertNotice@@ -368,10 +366,7 @@ export const ChatContainer = ({initial={{ opacity: 0 }}animate={{ opacity: 1 }}transition={{ duration: 0.3 }}- className={cn(- "ease-[cubic-bezier(0.32,0.72,0,1)] relative mx-auto w-full max-w-3xl px-3 pb-6 pt-2 transition-transform duration-300 will-change-transform motion-reduce:transition-none",- areFilesOpen && "xl:-translate-x-40",- )}+ className="relative mx-auto w-full max-w-3xl px-3 pb-6 pt-2">{isLimitReached && (<div@@ -381,9 +376,9 @@ export const ChatContainer = ({<divaria-hidden="true"data-testid="usage-limit-backdrop"- className="absolute -inset-x-14 -top-20 bottom-[-18px] overflow-hidden rounded-[2rem] bg-[radial-gradient(ellipse_at_center,rgba(250,250,250,0.96)_0%,rgba(250,250,250,0.9)_42%,rgba(250,250,250,0.58)_68%,rgba(250,250,250,0)_100%)] backdrop-blur-lg [mask-image:linear-gradient(to_bottom,transparent_0%,black_26%,black_100%)]"+ className="absolute -inset-x-14 -top-20 bottom-[-18px] overflow-hidden rounded-[2rem] bg-[radial-gradient(ellipse_at_center,rgba(255,255,255,0.96)_0%,rgba(255,255,255,0.9)_42%,rgba(255,255,255,0.58)_68%,rgba(255,255,255,0)_100%)] backdrop-blur-lg [mask-image:linear-gradient(to_bottom,transparent_0%,black_26%,black_100%)]">- <div className="absolute inset-x-10 bottom-0 h-28 rounded-full bg-[#fafafa]/80 blur-2xl" />+ <div className="absolute inset-x-10 bottom-0 h-28 rounded-full bg-white/80 blur-2xl" /><div className="absolute inset-x-16 bottom-8 h-16 rounded-full bg-white/55 blur-xl" /></div><div className="pointer-events-auto relative px-3">diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/components/SessionNotFound.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/components/SessionNotFound.tsxindex 4397f2aad9..9afb98b837 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/components/SessionNotFound.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/components/SessionNotFound.tsx@@ -16,7 +16,7 @@ export function SessionNotFound() {}return (- <div className="flex h-full min-h-0 w-full items-center justify-center bg-[#fafafa] px-6">+ <div className="flex h-full min-h-0 w-full items-center justify-center bg-white px-6"><divrole="status"className="flex max-w-md flex-col items-center gap-3 text-center"diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxindex 9bd5e531f6..475b3ab6d3 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx@@ -136,14 +136,6 @@ interface Props {/** The layout floats its sidebar/files controls over the chat's top-left* corner on small viewports (see ThreadHeader). */hasFloatingControls?: boolean;- /** Set by the host that mounts the session activity card, so the thread- * chip only becomes clickable where that card exists. */- canOpenActivity?: boolean;- /** The host's floating workspace-files card is open, so the column- * slides aside for it. Only the copilot chat mounts that card;- * every other host (share viewer, memory and builder panels) leaves this- * off, whatever the persisted panel state says. */- areFilesOpen?: boolean;/** Compact thread for side panels: smaller text, tighter bubbles and* spacing. */variant?: "default" | "compact";@@ -308,8 +300,6 @@ export function ChatMessagesContainer({isResolvingExpertIdentity = false,sessionSentFrom = null,hasFloatingControls = false,- canOpenActivity = false,- areFilesOpen = false,variant = "default",showThreadHeader = true,}: Props) {@@ -489,10 +479,7 @@ export function ChatMessagesContainer({<ThreadHeaderexpertIdentity={expertIdentity}isResolvingExpertIdentity={isResolvingExpertIdentity}- readOnly={readOnly}- sessionId={sessionID}hasFloatingControls={hasFloatingControls}- canOpenActivity={canOpenActivity}/>)}{!isCompact && <ChatMinimap messages={messages} />}@@ -508,10 +495,9 @@ export function ChatMessagesContainer({><ConversationContentclassName={cn(- "ease-[cubic-bezier(0.32,0.72,0,1)] mx-auto flex min-h-full w-full max-w-3xl flex-1 flex-col gap-6 px-6 pb-4 pt-14 transition-transform duration-300 will-change-transform motion-reduce:transition-none",+ "mx-auto flex min-h-full w-full max-w-3xl flex-1 flex-col gap-6 px-6 pb-4 pt-14",isCompact && "gap-4 px-4 pt-4",!showThreadHeader && "pt-4",- areFilesOpen && "xl:-translate-x-40",)}style={bottomContentPaddingdiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertIntegrations/ExpertIntegrations.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertIntegrations/ExpertIntegrations.tsxdeleted file mode 100644index 03e2a981ba..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertIntegrations/ExpertIntegrations.tsx+++ /dev/null@@ -1,80 +0,0 @@-"use client";--import Link from "next/link";-import {- Popover,- PopoverContent,- PopoverTrigger,-} from "@/components/molecules/Popover/Popover";-import { IntegrationLogo } from "@/components/molecules/IntegrationLogo/IntegrationLogo";-import {- formatCredentialName,- formatProviderName,-} from "@/components/contextual/IntegrationsPanel/helpers";-import { useExpertIntegrations } from "./useExpertIntegrations";--interface Props {- expertId: string;- expertName: string;-}--const VISIBLE_LOGOS = 3;--/** The integrations this expert can reach, under its name in the thread header.- *- * Renders nothing when the expert has none: a header that says "Integrations"- * above an empty row reads as a loading failure rather than an empty state.- */-export function ExpertIntegrations({ expertId, expertName }: Props) {- const { integrations } = useExpertIntegrations(expertId);-- if (integrations.length === 0) return null;-- const visible = integrations.slice(0, VISIBLE_LOGOS);- const overflow = integrations.length - visible.length;-- return (- <Popover>- <PopoverTrigger- className="flex shrink-0 items-center gap-1 rounded-full py-1 pl-1.5 pr-3 transition-colors hover:bg-zinc-100/80"- aria-label={`${expertName}'s integrations`}- data-testid="expert-integrations"- >- {visible.map((integration) => (- <IntegrationLogo- key={integration.credential_id}- provider={integration.provider}- alt={formatProviderName(integration.provider)}- />- ))}- {overflow > 0 ? (- <span className="ml-0.5 text-xs text-zinc-500">+{overflow}</span>- ) : null}- </PopoverTrigger>- <PopoverContent align="start" className="w-64 p-3">- <div className="mb-2 text-xs font-medium uppercase tracking-[0.14em] text-zinc-400">- Integrations- </div>- <ul className="flex flex-col gap-2">- {integrations.map((integration) => (- <li- key={integration.credential_id}- className="flex items-center gap-2"- >- <IntegrationLogo provider={integration.provider} />- <span className="truncate text-sm text-zinc-700">- {formatCredentialName(integration.title, integration.provider)}- </span>- </li>- ))}- </ul>- <Link- href={`/team/${expertId}`}- className="mt-3 block text-xs text-zinc-500 underline hover:text-zinc-800"- >- Manage what {expertName} can access- </Link>- </PopoverContent>- </Popover>- );-}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 8418e789bc..c75879c905 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@@ -1,6 +1,5 @@"use client";-import { Icon } from "@/components/atoms/Icon/Icon";import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";import { ExpertIdentityDetails } from "@/components/molecules/ExpertIdentityDetails/ExpertIdentityDetails";import { getExpertRoleLabel } from "@/services/experts/expert-role-label";@@ -11,13 +10,8 @@ import {TooltipTrigger,} from "@/components/atoms/Tooltip/BaseTooltip";import { cn } from "@/lib/utils";-import { ClockIcon, File02Icon, PlayIcon } from "@hugeicons/core-free-icons";-import { useCopilotUIStore } from "../../../store";import type { ExpertIdentity } from "../../../useExpertMap";-import { useSessionFiles } from "../../ContextPanel/components/FilesTab/useSessionFiles";-import { useSessionActivity } from "../../WorkspaceFileCards/useSessionActivity";import { ExpertAvatar } from "./ExpertAvatar/ExpertAvatar";-import { ExpertIntegrations } from "./ExpertIntegrations/ExpertIntegrations";// Otto's product-facing title when a session carries no expert identity.const DEFAULT_EXPERT_ROLE = "Head of AI";@@ -26,14 +20,6 @@ interface Props {expertIdentity?: ExpertIdentity | null;/** The roster has not settled yet for an expert-scoped session. */isResolvingExpertIdentity?: boolean;- readOnly: boolean;- /** Powers the chip's file/run counters and its click-through to the- * session activity card. Without it the chip is a passive label. */- sessionId?: string | null;- /** Set only by the host that actually mounts the activity card. The other- * hosts pass a real sessionId too, so the flag cannot be inferred — and- * without it the chip would open a card that isn't there. */- canOpenActivity?: boolean;/** The new layout floats the sidebar and workspace-files controls over the* chat's top-left corner below `lg`; the chip clears them. */hasFloatingControls?: boolean;@@ -41,18 +27,12 @@ interface Props {/** Floats as a translucent chip pinned to the pane's top-left gutter — the* zero-height wrapper keeps it out of the flex flow so messages scroll- * underneath. On narrow viewports the gutter disappears and the chip simply- * overlaps the message column, which its translucency is built for. An- * expert session wears the expert's identity and every other session is- * Otto's, so the thread is never anonymous. Clicking the identity- * opens the session activity card (files, runs, schedules) on the right;- * the expert's integration logos sit beside it with their own popover. */+ * underneath. An expert session wears the expert's identity and every other+ * session is Otto's, so the thread is never anonymous. The chip is a passive+ * label; the expert's integrations live in the top-right controls. */export function ThreadHeader({expertIdentity,isResolvingExpertIdentity = false,- readOnly,- sessionId = null,- canOpenActivity = false,hasFloatingControls = false,}: Props) {// While the roster loads, the chip shows a quiet placeholder rather than@@ -62,73 +42,6 @@ export function ThreadHeader({const role = expertIdentity?.role ?? DEFAULT_EXPERT_ROLE;const jobTitle = expertIdentity?.jobTitle;const roleLabel = jobTitle || getExpertRoleLabel(role);- // Assistive tech gets a loading identity too, not Otto's.- const identityLabel = isResolving- ? "Loading expert"- : `${name}, ${roleLabel}`;- // Only the copilot chat mounts the activity card. The builder and memory- // panels pass a live sessionId and aren't read-only, so without the host's- // own say-so the chip would render a button whose click writes panel state- // and fetches a file list for a card that never appears.- const isInteractive = Boolean(canOpenActivity && !readOnly && sessionId);- const toggleContextPanelTab = useCopilotUIStore(- (s) => s.toggleContextPanelTab,- );- const activitySessionId = isInteractive ? sessionId : null;- const { runs, schedules } = useSessionActivity(activitySessionId);- const { uploaded, generated } = useSessionFiles(activitySessionId);- const fileCount = uploaded.length + generated.length;- const runCount = runs.length;- const scheduleCount = schedules.length;- const showIntegrations = expertIdentity != null && !expertIdentity.isArchived;-- // The chip's own aria-label replaces its contents for screen readers, so- // every count has to be spelled out here or it is simply never announced.- const counters = isInteractive- ? [- { icon: File02Icon, count: fileCount, noun: "file" },- { icon: PlayIcon, count: runCount, noun: "run" },- { icon: ClockIcon, count: scheduleCount, noun: "schedule" },- ].filter((counter) => counter.count > 0)- : [];- const spokenCounts = counters- .map(({ count, noun }) => `${count} ${noun}${count === 1 ? "" : "s"}`)- .join(", ");-- const chipContent = (- <>- <ExpertAvatar- name={name}- avatarUrl={expertIdentity?.avatarUrl ?? null}- color={expertIdentity?.color}- isAutopilot={!expertIdentity && !isResolving}- isLoading={isResolving}- size="md"- />- {isResolving ? (- <Skeleton className="h-3.5 w-16 rounded" />- ) : (- <span className="min-w-0 max-w-[10rem]">- <ExpertIdentityDetails- isOtto={!expertIdentity && !isResolving}- name={name}- role={role}- jobTitle={jobTitle}- size="compact"- />- </span>- )}- {counters.map(({ icon, count, noun }) => (- <span- key={noun}- className="flex shrink-0 items-center gap-1 text-xs font-medium tabular-nums text-zinc-500"- >- <Icon icon={icon} className="size-3.5" aria-hidden />- {count}- </span>- ))}- </>- );return (<div data-testid="expert-thread-header" className="relative z-20 h-0">@@ -138,56 +51,49 @@ export function ThreadHeader({hasFloatingControls && "max-md:pl-28 md:max-lg:pl-20",)}>- {/* The integrations popover is its own button, so the chip is a- container and only the identity half opens the activity card —- nesting the two triggers would be button-in-button. Each half- carries its own padding so its hover fill reaches the chip's edge. */}- <div className="pointer-events-auto flex items-center whitespace-nowrap rounded-full border border-zinc-200/70 bg-white/75 shadow-sm backdrop-blur-md">- <TooltipProvider>- <Tooltip>- <TooltipTrigger asChild>- {isInteractive ? (- <button- type="button"- aria-label={- spokenCounts- ? `${identityLabel}. ${spokenCounts}. Open session activity`- : `${identityLabel}. Open session activity`- }- onClick={() => toggleContextPanelTab("files")}- className="flex min-w-0 items-center gap-2 rounded-full py-1 pl-1.5 pr-5 transition-colors hover:bg-zinc-100/80"- >- {chipContent}- </button>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <div+ tabIndex={0}+ aria-label={+ isResolving ? "Loading expert" : `${name} — ${roleLabel}`+ }+ className="pointer-events-auto flex min-w-0 items-center gap-2 whitespace-nowrap rounded-full border border-zinc-200/70 bg-white/75 py-1 pl-1.5 pr-5 shadow-sm backdrop-blur-md"+ >+ <ExpertAvatar+ name={name}+ avatarUrl={expertIdentity?.avatarUrl ?? null}+ color={expertIdentity?.color}+ isAutopilot={!expertIdentity && !isResolving}+ isLoading={isResolving}+ size="md"+ />+ {isResolving ? (+ <Skeleton className="h-3.5 w-16 rounded" />) : (- <div- tabIndex={0}- aria-label={- isResolving ? identityLabel : `${name} — ${roleLabel}`- }- className="flex min-w-0 items-center gap-2 rounded-full py-1 pl-1.5 pr-5"- >- {chipContent}- </div>+ <span className="min-w-0 max-w-[10rem]">+ <ExpertIdentityDetails+ isOtto={!expertIdentity}+ name={name}+ role={role}+ jobTitle={jobTitle}+ size="compact"+ />+ </span>)}- </TooltipTrigger>- {isResolving ? null : (- <TooltipContent- side="bottom"- className="bg-zinc-900 text-zinc-50 outline-none"- >- {roleLabel}- </TooltipContent>- )}- </Tooltip>- </TooltipProvider>- {showIntegrations && (- <ExpertIntegrations- expertId={expertIdentity.id}- expertName={expertIdentity.name}- />- )}- </div>+ </div>+ </TooltipTrigger>+ {isResolving ? null : (+ <TooltipContent+ side="bottom"+ className="bg-zinc-900 text-zinc-50 outline-none"+ >+ {roleLabel}+ </TooltipContent>+ )}+ </Tooltip>+ </TooltipProvider></div></div>);diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsxindex e9a4f49509..9d5d3781b6 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsx@@ -8,9 +8,15 @@ import {} from "@/components/ui/sheet";import { AnimatePresence, motion, useReducedMotion } from "framer-motion";import { useState } from "react";-import { MAX_CONTEXT_PANEL_WIDTH, MIN_CONTEXT_PANEL_WIDTH } from "../../store";+import {+ MAX_CONTEXT_PANEL_WIDTH,+ MIN_CONTEXT_PANEL_WIDTH,+ type ContextPanelTab,+} from "../../store";import { PanelResizeHandle } from "../PanelResizeHandle";+import { WorkspaceFileCards } from "../WorkspaceFileCards/WorkspaceFileCards";import { ArtifactsTab } from "./components/ArtifactsTab/ArtifactsTab";+import { IntegrationsTab } from "./components/IntegrationsTab/IntegrationsTab";import { useContextPanel } from "./useContextPanel";interface Props {@@ -23,13 +29,14 @@ interface Props {const PANEL_EASE: [number, number, number, number] = [0.32, 0.72, 0, 1];const PANEL_DURATION = 0.3;-// Files render as a card grid above the composer (``WorkspaceFileCards``), so-// this panel only ever holds the artifacts library. The open flag also drives-// that card, so both the docked desktop panel and the mobile sheet claim the-// screen for the artifacts tab only — a "files" tab belongs to the card.+const TAB_TITLES: Record<ContextPanelTab, string> = {+ files: "Files",+ artifacts: "Artifacts",+ integrations: "Integrations",+};+export function ContextPanel({ sessionId, mobile }: Props) {const {- isOpen,activeTab,showExpanded,closeArtifactPanel,@@ -39,16 +46,26 @@ export function ContextPanel({ sessionId, mobile }: Props) {const [isResizing, setIsResizing] = useState(false);const shouldReduceMotion = useReducedMotion();- const library = (+ const content = (<div className="flex min-h-0 flex-1 flex-col">- <ArtifactsTab sessionId={sessionId} />+ {activeTab === "artifacts" ? (+ <ArtifactsTab sessionId={sessionId} />+ ) : (+ <div className="min-h-0 flex-1 overflow-y-auto p-3 pt-4">+ {activeTab === "integrations" ? (+ <IntegrationsTab />+ ) : sessionId ? (+ <WorkspaceFileCards sessionId={sessionId} />+ ) : null}+ </div>+ )}</div>);if (mobile) {return (<Sheet- open={isOpen && activeTab === "artifacts"}+ open={showExpanded}onOpenChange={(open) => !open && closeArtifactPanel()}><SheetContent@@ -57,17 +74,15 @@ export function ContextPanel({ sessionId, mobile }: Props) {><SheetHeader className="mt-12 p-2 text-left"><SheetTitle className="text-sm font-medium text-zinc-900">- Artifacts+ {TAB_TITLES[activeTab]}</SheetTitle></SheetHeader>- {library}+ {content}</SheetContent></Sheet>);}- const isDocked = showExpanded && activeTab === "artifacts";-// Width is the animated property because the panel pushes the chat column// rather than overlaying it. Dragging the handle bypasses the tween (a// queued 300ms tween per pointer move would trail the cursor). The chat's@@ -79,7 +94,7 @@ export function ContextPanel({ sessionId, mobile }: Props) {return (<AnimatePresence initial={false}>- {isDocked && (+ {showExpanded && (<motion.divdata-context-panelinitial={{ width: 0, opacity: 0 }}@@ -99,7 +114,7 @@ export function ContextPanel({ sessionId, mobile }: Props) {maxWidth={MAX_CONTEXT_PANEL_WIDTH}/><div className="h-full overflow-hidden">- {/* Fixed inner width: the library keeps its final layout while+ {/* Fixed inner width: the content keeps its final layout whilethe shell widens, so nothing reflows mid-animation. That alsomeans the inner is wider than the shell for the whole tween,so the clip above is what stops it spilling over the chat. */}@@ -107,7 +122,7 @@ export function ContextPanel({ sessionId, mobile }: Props) {style={{ width: contextPanelWidth }}className="flex h-full min-h-0 flex-col overflow-hidden">- {library}+ {content}</div></div></motion.div>diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelToggle.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelToggle.tsxindex 3a7f7d8339..e3d728b030 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelToggle.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelToggle.tsx@@ -2,122 +2,49 @@import { Button } from "@/components/ui/button";import { cn } from "@/lib/utils";-import { useCopilotUIStore } from "../../store";-import { useAreWorkspaceFileCardsOpen } from "../../useAreWorkspaceFileCardsOpen";-import { fileItemToArtifactRef } from "./components/FilesTab/helpers";-import {- useSessionFiles,- type SessionFile,-} from "./components/FilesTab/useSessionFiles";+import { useCopilotUIStore, type IntegrationsPanelExpert } from "../../store";import { ComputerIcon, LicenseDraftIcon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";import { useIsMobile } from "../../useIsMobile";+import { IntegrationsToggle } from "./components/IntegrationsToggle/IntegrationsToggle";interface Props {sessionId?: string | null;+ /** The chat's live expert, whose integrations lead the controls. */+ expert?: IntegrationsPanelExpert | null;}-function getLastGeneratedFile(generated: SessionFile[]): SessionFile | null {- let latest: SessionFile | null = null;- let latestTime = Number.NEGATIVE_INFINITY;- for (const file of generated) {- const time = new Date(file.item.created_at).getTime();- if (latest === null || time > latestTime) {- latest = file;- latestTime = time;- }- }- return latest;-}+// Sized and stroked like the sidebar's nav icons so the chat's top-right+// controls read as the same family.+const toggleClass =+ "shrink-0 rounded-md transition-[background-color,transform] duration-150 ease-out hover:bg-zinc-100 active:scale-[0.97] motion-reduce:transition-none";-/** The chat's top-right controls: the Computer toggle and the artifacts- * toggle, one per face of the side panel. The artifacts toggle wears the- * name of the session's most recently generated file so the current working- * document stays visible, and clicking it opens that file directly in the- * artifact panel. Workspace files open from the thread chip instead. The+/** The chat's top-right controls: the expert's integrations, the Computer+ * toggle and the files toggle, each opening its face of the side panel. The* Computer toggle is always there for a chat with a session: the panel's* own "Turn on screen" button lives on that face, so it must be reachable- * before any desktop exists and without an artifact to switch from. */-export function ContextPanelToggle({ sessionId = null }: Props) {- const isOpen = useCopilotUIStore((s) => s.artifactPanel.isOpen);- const hasArtifact = useCopilotUIStore(- (s) => s.artifactPanel.activeArtifact != null,+ * before any desktop exists. */+export function ContextPanelToggle({ sessionId = null, expert = null }: Props) {+ const isFilesOpen = useCopilotUIStore(+ (s) =>+ s.artifactPanel.isOpen &&+ s.artifactPanel.activeTab === "files" &&+ s.artifactPanel.activeArtifact == null &&+ !s.artifactPanel.isComputerOpen,);- const activeTab = useCopilotUIStore((s) => s.artifactPanel.activeTab);const toggleContextPanelTab = useCopilotUIStore((s) => s.toggleContextPanelTab,);- const closeArtifactPanel = useCopilotUIStore((s) => s.closeArtifactPanel);- const lastArtifact = useCopilotUIStore((s) => s.artifactPanel.lastArtifact);- const openArtifact = useCopilotUIStore((s) => s.openArtifact);const isComputerOpen = useCopilotUIStore((s) => s.artifactPanel.isComputerOpen,);+ const isPanelOpen = useCopilotUIStore((s) => s.artifactPanel.isOpen);const openComputer = useCopilotUIStore((s) => s.openComputer);const closeComputer = useCopilotUIStore((s) => s.closeComputer);- const setArtifactPanelMode = useCopilotUIStore((s) => s.setArtifactPanelMode);const isMobile = useIsMobile();- const { deliverables } = useSessionFiles(sessionId);- const lastGenerated = getLastGeneratedFile(deliverables);- const isFilesCardOpen = useAreWorkspaceFileCardsOpen();- const isArtifactsOpen = isOpen && activeTab === "artifacts";- // An open artifact preview and the artifacts tab are both the document- // face of the right sidebar, so the toggle reads active for either and is- // another control that closes them alongside the panel header. With the- // computer face on top, the artifact underneath is not showing.- const isDocumentOpen = !isComputerOpen && (hasArtifact || isArtifactsOpen);- const isRightSidebarOpen = isDocumentOpen || isComputerOpen;// The mobile sheet has no computer face to open.const showComputerToggle = !!sessionId && !isMobile;- // The open activity card already lists the same file, so the labeled- // artifacts button floating above it is pure duplication — the card's rows- // are the way in while it shows. The Computer button is not about files- // and stays, or "Turn on screen" is out of reach until the card closes.- const showArtifactsToggle = !isFilesCardOpen;- if (!showArtifactsToggle && !showComputerToggle) return null;-- // With the panel open its own header already names the document, so the- // button collapses to the bare icon; closed, the name is the reminder of- // what's being worked on.- const showFileName = lastGenerated != null && !isRightSidebarOpen;-- // Straight to the document: the freshest generated file, then the- // remembered preview, and only then the tabs view.- function openDocument() {- const target =- (lastGenerated ? fileItemToArtifactRef(lastGenerated.item) : null) ??- lastArtifact;- if (target) {- openArtifact(target);- return;- }- // Already on the library (the computer face was just turned off it):- // toggling would close it.- if (isArtifactsOpen) return;- toggleContextPanelTab("artifacts");- }-- function handleSidebarToggle() {- if (isComputerOpen) {- // Turn the panel to its document face: the preview that was under- // the computer if there is one, else wherever a closed panel opens.- setArtifactPanelMode("artifact");- if (hasArtifact) return;- openDocument();- return;- }- if (hasArtifact) {- closeArtifactPanel();- return;- }- if (isArtifactsOpen) {- toggleContextPanelTab("artifacts");- return;- }- openDocument();- }-function handleComputerToggle() {// Back to whatever the computer was covering: the preview, the tab, or// nothing at all.@@ -125,13 +52,16 @@ export function ContextPanelToggle({ sessionId = null }: Props) {else openComputer();}- // Sized and stroked like the sidebar's nav icons so the chat's top-right- // controls read as the same family.- const toggleClass =- "shrink-0 rounded-md transition-[background-color,transform] duration-150 ease-out hover:bg-zinc-100 active:scale-[0.97] motion-reduce:transition-none";-return (- <div className="flex shrink-0 items-center gap-1 p-2">+ // With the side panel open the chat column narrows under these controls,+ // so they lift off the messages instead of blending into them.+ <div+ className={cn(+ "m-1 flex shrink-0 items-center gap-1 rounded-xl border border-transparent bg-white p-1 transition-shadow duration-150",+ isPanelOpen && "border-zinc-200/70 shadow-sm",+ )}+ >+ {expert && <IntegrationsToggle expert={expert} className={toggleClass} />}{showComputerToggle && (<Buttontype="button"@@ -148,37 +78,20 @@ export function ContextPanelToggle({ sessionId = null }: Props) {/></Button>)}- {showArtifactsToggle && (- <Button- type="button"- variant="ghost"- size={showFileName ? "sm" : "icon"}- onClick={handleSidebarToggle}- aria-label={- isDocumentOpen- ? "Hide artifacts"- : lastGenerated- ? `Open ${lastGenerated.item.name}`- : "Open artifacts"- }- aria-pressed={isDocumentOpen}- className={cn(- toggleClass,- showFileName ? "h-8 gap-1.5 px-2" : "size-8",- isDocumentOpen && "bg-zinc-100",- )}- >- <Icon- icon={LicenseDraftIcon}- className="!size-4 text-sidebar-foreground/90"- />- {showFileName && (- <span className="max-w-[9rem] truncate text-xs font-medium text-sidebar-foreground/90">- {lastGenerated.item.name}- </span>- )}- </Button>- )}+ <Button+ type="button"+ variant="ghost"+ size="icon"+ onClick={() => toggleContextPanelTab("files")}+ aria-label={isFilesOpen ? "Hide files" : "Open files"}+ aria-pressed={isFilesOpen}+ className={cn(toggleClass, "size-8", isFilesOpen && "bg-zinc-100")}+ >+ <Icon+ icon={LicenseDraftIcon}+ className="!size-4 text-sidebar-foreground/90"+ />+ </Button></div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanel.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanel.test.tsxindex cdc5cca26e..36fe974750 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanel.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanel.test.tsx@@ -2,6 +2,7 @@ import { beforeEach, describe, expect, test, vi } from "vitest";import { render, screen, waitFor } from "@/tests/integrations/test-utils";import { server } from "@/mocks/mock-server";import { getListWorkspaceFilesMockHandler200 } from "@/app/api/__generated__/endpoints/workspace/workspace.msw";+import { getListExpertCredentialsMockHandler } from "@/app/api/__generated__/endpoints/experts/experts.msw";import { useCopilotUIStore } from "../../../store";import { ContextPanel } from "../ContextPanel";@@ -27,6 +28,8 @@ beforeEach(() => {isOpen: true,activeArtifact: null,activeTab: "artifacts",+ mode: "artifact",+ isComputerOpen: false,},}));});@@ -40,13 +43,29 @@ describe("ContextPanel", () => {expect(await screen.findByText("Nothing to preview yet.")).toBeDefined();});- test("leaves a files tab alone and stays undocked so the files card owns it", async () => {+ test("docks for the files tab and lists the chat's files", async () => {useCopilotUIStore.setState((s) => ({artifactPanel: { ...s.artifactPanel, activeTab: "files" },}));const { container } = render(<ContextPanel sessionId="session-1" />);- expect(container.querySelector("[data-context-panel]")).toBeNull();- expect(useCopilotUIStore.getState().artifactPanel.activeTab).toBe("files");+ await waitFor(() =>+ expect(container.querySelector("[data-context-panel]")).not.toBeNull(),+ );+ expect(await screen.findByText("Nothing here yet.")).toBeDefined();+ });++ test("docks for the integrations tab with the expert's integrations", async () => {+ server.use(getListExpertCredentialsMockHandler([]));+ useCopilotUIStore.setState((s) => ({+ integrationsPanelExpert: { id: "expert-maria", name: "Maria" },+ artifactPanel: { ...s.artifactPanel, activeTab: "integrations" },+ }));+ render(<ContextPanel sessionId="session-1" />);++ expect(await screen.findByText("Maria's Integrations")).toBeDefined();+ expect(+ screen.getByRole("link", { name: "Open Maria's page" }),+ ).toBeDefined();});test("hides itself while an artifact is previewing (artifact takes over the region)", () => {@@ -91,12 +110,13 @@ describe("ContextPanel", () => {expect(container.querySelector("[data-context-panel]")).toBeNull();});- test("mobile: keeps the sheet closed for the files tab (the inline files card owns it)", () => {+ test("mobile: opens the sheet on the files tab", async () => {useCopilotUIStore.setState((s) => ({artifactPanel: { ...s.artifactPanel, activeTab: "files" },}));render(<ContextPanel sessionId="session-1" mobile />);- expect(screen.queryByRole("dialog")).toBeNull();+ expect(await screen.findByRole("dialog")).toBeDefined();+ expect(screen.getByRole("heading", { name: "Files" })).toBeDefined();});test("mobile: opens the sheet on the artifacts tab", async () => {diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelToggle.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelToggle.test.tsxindex 0e2fcc91d1..69caac5f30 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelToggle.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelToggle.test.tsx@@ -1,20 +1,9 @@import { getListWorkspaceFilesMockHandler200 } from "@/app/api/__generated__/endpoints/workspace/workspace.msw";-import type { ListFilesResponse } from "@/app/api/__generated__/models/listFilesResponse";import { server } from "@/mocks/mock-server";-import {- fireEvent,- render,- screen,- waitFor,-} from "@/tests/integrations/test-utils";+import { fireEvent, render, screen } from "@/tests/integrations/test-utils";import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";-import { Key, storage } from "@/services/storage/local-storage";import { useCopilotUIStore } from "../../../store";import { ContextPanelToggle } from "../ContextPanelToggle";-import { useSessionFiles } from "../components/FilesTab/useSessionFiles";-import { useWorkspaceFileCards } from "../../WorkspaceFileCards/useWorkspaceFileCards";-import { WorkspaceFileCard } from "../../WorkspaceFileCards/components/WorkspaceFileCard";-import { ArtifactsTab } from "../components/ArtifactsTab/ArtifactsTab";let mobile = false;function setMobile(value: boolean) {@@ -84,109 +73,52 @@ afterEach(() => {});});-describe("ContextPanelToggle", () => {- test("renders no workspace-files trigger — the thread chip owns that", () => {- render(<ContextPanelToggle />);-- expect(screen.queryByLabelText("Open workspace files")).toBeNull();- expect(screen.queryByLabelText("Workspace files")).toBeNull();- });-- test("sidebar toggle closes the artifact preview via closeArtifactPanel", () => {- setPanel({ activeArtifact: ARTIFACT, isOpen: true });- render(<ContextPanelToggle />);-- fireEvent.click(screen.getByLabelText("Hide artifacts"));-- expect(panelState().activeArtifact).toBeNull();- });-- test("sidebar toggle restores the last previewed artifact instead of opening the tabs view", () => {- setPanel({ lastArtifact: ARTIFACT, isOpen: false });- render(<ContextPanelToggle />);-- fireEvent.click(screen.getByLabelText("Open artifacts"));-- expect(panelState().activeArtifact).toEqual(ARTIFACT);- });-- test("sidebar toggle opens the artifacts tab when there is no remembered artifact", () => {- setPanel({ lastArtifact: null, isOpen: false });- render(<ContextPanelToggle />);+describe("ContextPanelToggle files button", () => {+ test("opens the files tab of the side panel", () => {+ render(<ContextPanelToggle sessionId="s1" />);- fireEvent.click(screen.getByLabelText("Open artifacts"));+ fireEvent.click(screen.getByLabelText("Open files"));expect(panelState().isOpen).toBe(true);- expect(panelState().activeTab).toBe("artifacts");+ expect(panelState().activeTab).toBe("files");+ expect(screen.getByLabelText("Hide files")).toBeDefined();});- test("sidebar toggle reads as active when the artifacts tab is open", () => {- setPanel({ isOpen: true, activeTab: "artifacts" });- render(<ContextPanelToggle />);+ test("closes the files tab when it is showing", () => {+ setPanel({ isOpen: true, activeTab: "files" });+ render(<ContextPanelToggle sessionId="s1" />);- expect(screen.getByLabelText("Hide artifacts")).toBeDefined();+ fireEvent.click(screen.getByLabelText("Hide files"));++ expect(panelState().isOpen).toBe(false);});- test("sidebar toggle turns the computer face back to the artifact under it", () => {- setPanel({- activeArtifact: ARTIFACT,- isOpen: true,- mode: "computer",- isComputerOpen: true,- });+ test("brings the files tab back over an open preview", () => {+ setPanel({ activeArtifact: ARTIFACT, isOpen: true });render(<ContextPanelToggle sessionId="s1" />);- fireEvent.click(screen.getByLabelText("Open artifacts"));+ fireEvent.click(screen.getByLabelText("Open files"));- expect(panelState().mode).toBe("artifact");- expect(panelState().isComputerOpen).toBe(false);- expect(panelState().activeArtifact).toEqual(ARTIFACT);+ expect(panelState().activeArtifact).toBeNull();expect(panelState().isOpen).toBe(true);+ expect(panelState().activeTab).toBe("files");});- test("sidebar toggle turns the computer face back to the remembered preview", () => {- setPanel({- lastArtifact: ARTIFACT,- isOpen: true,- activeTab: "files",- mode: "computer",- isComputerOpen: true,- });+ test("takes the panel from the computer face", () => {+ setPanel({ isOpen: true, mode: "computer", isComputerOpen: true });render(<ContextPanelToggle sessionId="s1" />);- fireEvent.click(screen.getByLabelText("Open artifacts"));+ fireEvent.click(screen.getByLabelText("Open files"));- expect(panelState().activeArtifact).toEqual(ARTIFACT);expect(panelState().isComputerOpen).toBe(false);expect(panelState().mode).toBe("artifact");+ expect(panelState().activeTab).toBe("files");});- test("a panel the computer opened is stored as open once turned to the library", () => {- storage.set(Key.COPILOT_CONTEXT_PANEL_OPEN, "false");- setPanel({ isOpen: false, activeTab: "artifacts" });+ test("shows no integrations without an expert", () => {render(<ContextPanelToggle sessionId="s1" />);- fireEvent.click(screen.getByLabelText("Open computer"));- fireEvent.click(screen.getByLabelText("Open artifacts"));-- expect(panelState().isOpen).toBe(true);- expect(storage.get(Key.COPILOT_CONTEXT_PANEL_OPEN)).toBe("true");- });-- test("sidebar toggle turns the computer face to the library when nothing is under it", () => {- setPanel({- isOpen: true,- activeTab: "artifacts",- mode: "computer",- isComputerOpen: true,- });- render(<ContextPanelToggle sessionId="s1" />);-- fireEvent.click(screen.getByLabelText("Open artifacts"));-- expect(panelState().isComputerOpen).toBe(false);- expect(panelState().isOpen).toBe(true);- expect(panelState().activeTab).toBe("artifacts");+ expect(screen.queryByTestId("expert-integrations")).toBeNull();});});@@ -220,7 +152,7 @@ describe("ContextPanelToggle computer button", () => {expect(panelState().isComputerOpen).toBe(true);expect(panelState().activeArtifact).toEqual(ARTIFACT);expect(screen.getByLabelText("Hide computer")).toBeDefined();- expect(screen.getByLabelText("Open artifacts")).toBeDefined();+ expect(screen.getByLabelText("Open files")).toBeDefined();});test("hiding the computer closes the panel it opened over, keeping the remembered preview", () => {@@ -245,7 +177,6 @@ describe("ContextPanelToggle computer button", () => {expect(panelState().isComputerOpen).toBe(false);expect(panelState().isOpen).toBe(true);expect(panelState().activeTab).toBe("artifacts");- expect(screen.getByLabelText("Hide artifacts")).toBeDefined();});test("hiding the computer reveals the preview it was covering, history intact", () => {@@ -268,250 +199,11 @@ describe("ContextPanelToggle computer button", () => {expect(panelState().history).toEqual([earlier]);});- test("stays while the workspace files card is open, alone", () => {- setPanel({ isOpen: true, activeTab: "files" });- render(<ContextPanelToggle sessionId="s1" />);-- expect(screen.queryByLabelText("Open artifacts")).toBeNull();- fireEvent.click(screen.getByLabelText("Open computer"));-- expect(panelState().isComputerOpen).toBe(true);- expect(panelState().mode).toBe("computer");- });-test("is hidden on mobile, whose sheet has no computer face", () => {setMobile(true);render(<ContextPanelToggle sessionId="s1" />);expect(screen.queryByLabelText("Open computer")).toBeNull();- expect(screen.getByLabelText("Open artifacts")).toBeDefined();- });-});--const SESSION = "session-1";--// The toggle renders the same bare icon whether the files are still in-// flight or every one of them was filtered out, so a "stays unlabeled"-// assertion would pass trivially. This probe gives those tests something to-// await that proves the listing actually arrived.-interface Props {- sessionId: string;-}--function LoadedFilesProbe({ sessionId }: Props) {- const { generated } = useSessionFiles(sessionId);- return <div data-testid="generated-count">{generated.length}</div>;-}--function WorkspaceFilesProbe({ sessionId }: Props) {- const { files, handleOpen, handleDownload, setPendingDelete } =- useWorkspaceFileCards(sessionId);- return (- <>- {files.map((file) => (- <WorkspaceFileCard- key={file.item.id}- file={file}- onOpen={handleOpen}- onDownload={handleDownload}- onRequestDelete={setPendingDelete}- />- ))}- </>- );-}--function realFile(): ListFilesResponse["files"][number] {- return {- id: "aaaaaaaa-0000-0000-0000-000000000001",- name: "result.csv",- path: "/sessions/session-1/result.csv",- mime_type: "text/csv",- size_bytes: 4096,- metadata: { origin: "agent" },- origin: "generated",- created_at: "2026-05-20T11:00:00Z",- };-}--// One entry per branch of `isInternalToolOutput`, each newer than the real-// deliverable so a missing filter would surface it instead.-function toolOutputs(): ListFilesResponse["files"] {- return [- {- id: "bbbbbbbb-0000-0000-0000-000000000002",- name: "toolu_01ABCdef.json",- path: "/sessions/session-1/tool-outputs/toolu_01ABCdef.json",- mime_type: "application/json",- size_bytes: 512,- metadata: {},- origin: "generated",- created_at: "2026-05-20T12:00:00Z",- },- {- id: "cccccccc-0000-0000-0000-000000000003",- name: "mcp_a1b2-c3d4.json",- path: "/sessions/session-1/tool-outputs/mcp_a1b2-c3d4.json",- mime_type: "application/json",- size_bytes: 256,- metadata: {},- origin: "generated",- created_at: "2026-05-20T13:00:00Z",- },- {- id: "dddddddd-0000-0000-0000-000000000004",- name: "toolu_02ZYXwvu.json",- path: "/sessions/session-1/tool-results/toolu_02ZYXwvu.json",- mime_type: "application/json",- size_bytes: 128,- metadata: {},- origin: "generated",- created_at: "2026-05-20T14:00:00Z",- },- // The id an SDK-transport session actually produces: `_execute_tool_sync`- // synthesizes `sdk-<uuid>` rather than forwarding the SDK's `toolu_*`, so- // this is the shape the default AutoPilot path parks in the directory.- {- id: "ffffffff-0000-0000-0000-000000000006",- name: "sdk-a1b2c3d4e5f6.json",- path: "/sessions/session-1/tool-outputs/sdk-a1b2c3d4e5f6.json",- mime_type: "application/json",- size_bytes: 320,- metadata: {},- origin: "generated",- created_at: "2026-05-20T16:00:00Z",- },- ];-}--function listing(files: ListFilesResponse["files"]): ListFilesResponse {- return { files, offset: 0, has_more: false };-}--describe("ContextPanelToggle internal tool output", () => {- test("uses provenance after an internal output is renamed, while retaining file access", async () => {- const internal = {- ...toolOutputs()[0],- name: "renamed.json",- path: "/sessions/session-1/renamed.json",- metadata: { purpose: "tool-output" },- };- server.use(- getListWorkspaceFilesMockHandler200(listing([realFile(), internal])),- );- render(- <>- <ContextPanelToggle sessionId={SESSION} />- <ArtifactsTab sessionId={SESSION} />- <WorkspaceFilesProbe sessionId={SESSION} />- </>,- );-- expect(await screen.findByLabelText("Open result.csv")).toBeDefined();- expect(await screen.findByLabelText("Download renamed.json")).toBeDefined();- expect(screen.getAllByText("renamed.json")).toHaveLength(1);- fireEvent.click(screen.getByTitle("renamed.json"));- expect(panelState().activeArtifact?.id).toBe(internal.id);- });-- test("promotes an explicitly marked deliverable in the legacy tool-output directory", async () => {- const deliverable = {- ...toolOutputs()[0],- metadata: { purpose: "deliverable" },- };- server.use(- getListWorkspaceFilesMockHandler200(listing([realFile(), deliverable])),- );- render(<ContextPanelToggle sessionId={SESSION} />);-- expect(- await screen.findByLabelText(`Open ${deliverable.name}`),- ).toBeDefined();- });- test("wears the newest user-facing file, not a newer tool output", async () => {- server.use(- getListWorkspaceFilesMockHandler200(- listing([realFile(), ...toolOutputs()]),- ),- );- render(<ContextPanelToggle sessionId={SESSION} />);-- const button = await screen.findByLabelText("Open result.csv");- fireEvent.click(button);-- expect(panelState().isOpen).toBe(true);- expect(panelState().activeArtifact?.id).toBe(- "aaaaaaaa-0000-0000-0000-000000000001",- );- });-- test("still wears a deliverable whose name looks like an SDK tool id", async () => {- server.use(- getListWorkspaceFilesMockHandler200(- listing([- realFile(),- ...toolOutputs(),- {- id: "eeeeeeee-0000-0000-0000-000000000005",- name: "mcp_config.json",- path: "/sessions/session-1/mcp_config.json",- mime_type: "application/json",- size_bytes: 64,- metadata: {},- origin: "generated",- created_at: "2026-05-20T17:00:00Z",- },- ]),- ),- );- render(<ContextPanelToggle sessionId={SESSION} />);-- expect(await screen.findByLabelText("Open mcp_config.json")).toBeDefined();- });-- test("still wears a deliverable under the user's own tool-outputs folder", async () => {- server.use(- getListWorkspaceFilesMockHandler200(- listing([- realFile(),- ...toolOutputs(),- {- id: "99999999-0000-0000-0000-000000000007",- name: "data.json",- path: "/sessions/session-1/my-pipeline/tool-outputs/data.json",- mime_type: "application/json",- size_bytes: 96,- metadata: {},- origin: "generated",- created_at: "2026-05-20T17:00:00Z",- },- ]),- ),- );- render(<ContextPanelToggle sessionId={SESSION} />);-- expect(await screen.findByLabelText("Open data.json")).toBeDefined();- });-- test("stays unlabeled when every generated file is an internal tool output", async () => {- server.use(getListWorkspaceFilesMockHandler200(listing(toolOutputs())));- render(- <>- <ContextPanelToggle sessionId={SESSION} />- <LoadedFilesProbe sessionId={SESSION} />- </>,- );-- await waitFor(() =>- expect(screen.getByTestId("generated-count").textContent).toBe(- String(toolOutputs().length),- ),- );- expect(screen.getByLabelText("Open artifacts")).toBeDefined();-- fireEvent.click(screen.getByLabelText("Open artifacts"));-- expect(panelState().activeArtifact).toBeNull();- expect(panelState().activeTab).toBe("artifacts");+ expect(screen.getByLabelText("Open files")).toBeDefined();});});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/IntegrationsTab/IntegrationsTab.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/IntegrationsTab/IntegrationsTab.tsxnew file mode 100644index 0000000000..6ce8c8ec9e--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/IntegrationsTab/IntegrationsTab.tsx@@ -0,0 +1,28 @@+"use client";++import Link from "next/link";+import { ExpertIntegrationsSection } from "@/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationsSection";+import { useCopilotUIStore } from "../../../../store";++/** The chat's expert's integrations, with the same add / use existing /+ * remove actions as the Integrations tab on the expert's page. */+export function IntegrationsTab() {+ const expert = useCopilotUIStore((s) => s.integrationsPanelExpert);+ if (!expert) return null;++ return (+ <div className="flex flex-col gap-3">+ <ExpertIntegrationsSection+ expertId={expert.id}+ expertName={expert.name}+ compact+ />+ <Link+ href={`/team/${expert.id}`}+ className="px-1 text-xs text-zinc-500 underline hover:text-zinc-800"+ >+ Open {expert.name}'s page+ </Link>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/IntegrationsToggle/IntegrationsToggle.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/IntegrationsToggle/IntegrationsToggle.tsxnew file mode 100644index 0000000000..07dc73df4d--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/IntegrationsToggle/IntegrationsToggle.tsx@@ -0,0 +1,122 @@+"use client";++import { PlugSocketIcon } from "@hugeicons/core-free-icons";+import { groupExpertIntegrations } from "@/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationGroups";+import {+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from "@/components/atoms/Tooltip/BaseTooltip";+import { Icon } from "@/components/atoms/Icon/Icon";+import { IntegrationLogo } from "@/components/molecules/IntegrationLogo/IntegrationLogo";+import { cn } from "@/lib/utils";+import {+ useCopilotUIStore,+ type IntegrationsPanelExpert,+} from "../../../../store";+import { useExpertIntegrations } from "./useExpertIntegrations";++const VISIBLE_LOGOS = 2;++interface Props {+ expert: IntegrationsPanelExpert;+ className?: string;+}++/** The services the chat's expert can reach, as a stack of logos: the first+ * two name themselves on hover and "+N" names the rest. With none yet, a+ * plug icon stands in so the panel's add actions stay one click away.+ * Clicking opens the integrations tab of the side panel. */+export function IntegrationsToggle({ expert, className }: Props) {+ const { integrations } = useExpertIntegrations(expert.id);+ const toggleIntegrationsPanel = useCopilotUIStore(+ (s) => s.toggleIntegrationsPanel,+ );+ const isActive = useCopilotUIStore(+ (s) =>+ s.artifactPanel.isOpen &&+ s.artifactPanel.activeTab === "integrations" &&+ s.artifactPanel.activeArtifact == null &&+ !s.artifactPanel.isComputerOpen,+ );++ const services = groupExpertIntegrations(integrations);++ if (services.length === 0) {+ return (+ <button+ type="button"+ onClick={() => toggleIntegrationsPanel(expert)}+ aria-label={+ isActive ? "Hide integrations" : `${expert.name}'s integrations`+ }+ aria-pressed={isActive}+ data-testid="expert-integrations-empty"+ className={cn(+ className,+ "flex size-8 items-center justify-center",+ isActive && "bg-zinc-100",+ )}+ >+ <Icon+ icon={PlugSocketIcon}+ className="!size-4 text-sidebar-foreground/90"+ />+ </button>+ );+ }++ const shown = services.slice(0, VISIBLE_LOGOS);+ const hidden = services.slice(VISIBLE_LOGOS);+ const hiddenNames = hidden.map((service) => service.name).join(", ");+ const allNames = services.map((service) => service.name).join(", ");++ return (+ <TooltipProvider>+ <button+ type="button"+ onClick={() => toggleIntegrationsPanel(expert)}+ aria-label={+ isActive+ ? "Hide integrations"+ : `${expert.name}'s integrations: ${allNames}`+ }+ aria-pressed={isActive}+ data-testid="expert-integrations"+ className={cn(+ className,+ "flex h-8 items-center gap-1.5 px-1.5",+ isActive && "bg-zinc-100",+ )}+ >+ <span className="flex -space-x-1.5">+ {shown.map((service) => (+ <Tooltip key={service.id}>+ <TooltipTrigger asChild>+ <span className="flex size-6 items-center justify-center rounded-full bg-white ring-2 ring-white smooth-shadow-ring-sm">+ <IntegrationLogo+ provider={service.id}+ alt={service.name}+ size={14}+ />+ </span>+ </TooltipTrigger>+ <TooltipContent side="bottom">{service.name}</TooltipContent>+ </Tooltip>+ ))}+ </span>+ {hidden.length > 0 && (+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="text-xs font-medium tabular-nums text-sidebar-foreground/90">+ +{hidden.length}+ </span>+ </TooltipTrigger>+ <TooltipContent side="bottom">{hiddenNames}</TooltipContent>+ </Tooltip>+ )}+ </button>+ </TooltipProvider>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertIntegrations/useExpertIntegrations.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/IntegrationsToggle/useExpertIntegrations.tssimilarity index 100%rename from autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertIntegrations/useExpertIntegrations.tsrename to autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/IntegrationsToggle/useExpertIntegrations.tsdiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useContextPanel.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useContextPanel.tsindex 0afd153e50..f83bfa78e5 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useContextPanel.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useContextPanel.ts@@ -16,7 +16,6 @@ export function useContextPanel() {artifactPanel.isOpen && !hasArtifact && !artifactPanel.isComputerOpen;return {- isOpen: artifactPanel.isOpen,activeTab: artifactPanel.activeTab,showExpanded,closeArtifactPanel,diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/WorkspaceFileCards.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/WorkspaceFileCards.tsxindex feaecd64fe..61ce679a6b 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/WorkspaceFileCards.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/WorkspaceFileCards.tsx@@ -1,10 +1,8 @@"use client";import { Download01Icon, File02Icon } from "@hugeicons/core-free-icons";-import { AnimatePresence, motion } from "framer-motion";import { Button } from "@/components/atoms/Button/Button";import { Icon } from "@/components/atoms/Icon/Icon";-import { useAreWorkspaceFileCardsOpen } from "../../useAreWorkspaceFileCardsOpen";import { SessionActivityCard } from "./components/SessionActivityCard";import { StackSection } from "./components/StackSection";import { WorkspaceFilesContent } from "./components/WorkspaceFilesContent";@@ -12,37 +10,12 @@ import { useSessionActivity } from "./useSessionActivity";import { useWorkspaceFileCards } from "./useWorkspaceFileCards";interface Props {- sessionId: string | null;+ sessionId: string;}-// Matches the chat column's shift transition (see ChatMessagesContainer) so-// the card lands as the messages finish sliding aside.-const CARD_EASE: [number, number, number, number] = [0.32, 0.72, 0, 1];-const CARD_TRANSITION = { duration: 0.3, ease: CARD_EASE };--/**- * Workspace files as a floating card pinned to the chat's top right. The- * workspace-files icon toggles ``artifactPanel.isOpen``; this grid answers it- * inside the chat column rather than pushing a drawer over it.- *- * The card body — and its file-list request and transcript scans — mounts- * only while the card is showing.- */+/** The chat's files, then the runs and schedules it set in motion — the+ * files tab of the docked side panel. */export function WorkspaceFileCards({ sessionId }: Props) {- const isOpen = useAreWorkspaceFileCardsOpen();- return (- <AnimatePresence initial={false}>- {isOpen && sessionId && (- <OpenWorkspaceFileCards- key="workspace-file-cards"- sessionId={sessionId}- />- )}- </AnimatePresence>- );-}--function OpenWorkspaceFileCards({ sessionId }: { sessionId: string }) {const {files,isLoading,@@ -57,20 +30,14 @@ function OpenWorkspaceFileCards({ sessionId }: { sessionId: string }) {handleDownloadAll,} = useWorkspaceFileCards(sessionId);- // An empty-state card is noise floating over the chat — the files card only- // earns its space once there's something in it (or something to report).+ // The files section only shows once there's something in it (or something+ // to report); a chat with nothing at all gets one empty state.const showFilesCard = isLoading || isError || files.length > 0;const { runs, schedules } = useSessionActivity(sessionId);const hasActivity = runs.length > 0 || schedules.length > 0;return (- <motion.div- initial={{ opacity: 0, x: 12, scale: 0.98 }}- animate={{ opacity: 1, x: 0, scale: 1 }}- exit={{ opacity: 0, x: 12, scale: 0.98 }}- transition={CARD_TRANSITION}- className="absolute right-8 top-3 z-30 flex w-80 max-w-[calc(100%-2rem)] flex-col gap-3"- >+ <div className="flex flex-col gap-3">{!showFilesCard && !hasActivity && (<div className="rounded-3xl bg-white/90 px-4 py-3 backdrop-blur smooth-shadow-ring-sm"><p className="py-2 text-center text-sm text-zinc-400">@@ -116,6 +83,6 @@ function OpenWorkspaceFileCards({ sessionId }: { sessionId: string }) {</StackSection>)}<SessionActivityCard sessionId={sessionId} />- </motion.div>+ </div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFileCards.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFileCards.test.tsxindex 1d355787cc..b5908b762b 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFileCards.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFileCards.test.tsx@@ -10,7 +10,6 @@ import {screen,waitFor,} from "@/tests/integrations/test-utils";-import { act } from "@testing-library/react";import type { UIMessage } from "ai";import { http, HttpResponse } from "msw";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";@@ -78,41 +77,6 @@ function listResponse(): ListFilesResponse {};}-function openFilesCard() {- useCopilotUIStore.setState({- artifactPanel: {- isOpen: true,- activeArtifact: null,- history: [],- activeTab: "files",- lastArtifact: null,- mode: "artifact",- computer: null,- isComputerOpen: false,- },- });-}--function closeFilesCard() {- useCopilotUIStore.setState({- artifactPanel: {- isOpen: false,- activeArtifact: null,- history: [],- activeTab: "files",- lastArtifact: null,- mode: "artifact",- computer: null,- isComputerOpen: false,- },- });-}--// Long enough for a mounted list query to reach the MSW handler.-function flushRequests() {- return new Promise((resolve) => setTimeout(resolve, 20));-}-function activityMessages(): UIMessage[] {return [{@@ -151,7 +115,6 @@ function activityMessages(): UIMessage[] {beforeEach(() => {server.use(getListWorkspaceFilesMockHandler200(listResponse()));- openFilesCard();});afterEach(() => {@@ -176,7 +139,7 @@ afterEach(() => {});describe("WorkspaceFileCards", () => {- it("renders the session's files as a floating card when the store flag is open", async () => {+ it("renders the session's files", async () => {render(<WorkspaceFileCards sessionId={SESSION} />);expect(await screen.findByText("uploaded.png")).toBeDefined();@@ -185,76 +148,6 @@ describe("WorkspaceFileCards", () => {expect(screen.getByLabelText("Download all")).toBeDefined();});- it("renders nothing while the card is closed", () => {- useCopilotUIStore.setState({- artifactPanel: {- isOpen: false,- activeArtifact: null,- history: [],- activeTab: "files",- lastArtifact: null,- mode: "artifact",- computer: null,- isComputerOpen: false,- },- });- const { container } = render(<WorkspaceFileCards sessionId={SESSION} />);- expect(container.textContent).toBe("");- });-- it("steps aside while the artifacts tab owns the side panel", () => {- useCopilotUIStore.setState({- artifactPanel: {- isOpen: true,- activeArtifact: null,- history: [],- activeTab: "artifacts",- lastArtifact: null,- mode: "artifact",- computer: null,- isComputerOpen: false,- },- });- const { container } = render(<WorkspaceFileCards sessionId={SESSION} />);- expect(container.textContent).toBe("");- });-- it("steps aside while the computer face covers the panel", () => {- useCopilotUIStore.setState({- artifactPanel: {- isOpen: true,- activeArtifact: null,- history: [],- activeTab: "files",- lastArtifact: null,- mode: "computer",- computer: null,- isComputerOpen: true,- },- });- const { container } = render(<WorkspaceFileCards sessionId={SESSION} />);- expect(container.textContent).toBe("");- });-- it("requests the file list only while the card is open", async () => {- let listRequests = 0;- server.use(- getListWorkspaceFilesMockHandler200(() => {- listRequests += 1;- return listResponse();- }),- );- closeFilesCard();- render(<WorkspaceFileCards sessionId={SESSION} />);- await flushRequests();- expect(listRequests).toBe(0);-- act(() => openFilesCard());-- expect(await screen.findByText("uploaded.png")).toBeDefined();- expect(listRequests).toBeGreaterThan(0);- });-it("opens a file as an artifact preview on click", async () => {render(<WorkspaceFileCards sessionId={SESSION} />);diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/store.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/store.tsindex b612b6e12d..f07f23c0a9 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/store.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/store.ts@@ -99,9 +99,15 @@ export type CopilotLlmAuthSelection =| { authProvider: "codex"; credentialId: string }| { authProvider: "microsoft_365_copilot"; credentialId: string };-/** Context panel tab: "files" is the inline workspace-files card, "artifacts"- * the docked artifacts library. */-export type ContextPanelTab = "files" | "artifacts";+/** Context panel tab, each docked on the right: the chat's files, the+ * artifacts library, or the chat's expert's integrations. */+export type ContextPanelTab = "files" | "artifacts" | "integrations";++/** The expert whose integrations the panel lists. */+export interface IntegrationsPanelExpert {+ id: string;+ name: string;+}const isClient = typeof window !== "undefined";@@ -226,6 +232,9 @@ interface CopilotUIState {toggleContextPanel: () => void;/** Opens the panel on `tab`, or closes it if that tab is already showing. */toggleContextPanelTab: (tab: ContextPanelTab) => void;+ integrationsPanelExpert: IntegrationsPanelExpert | null;+ /** The integrations tab for `expert`, toggled like any other tab. */+ toggleIntegrationsPanel: (expert: IntegrationsPanelExpert) => void;/** Forget the remembered preview — called on session entry so a new chat* can never restore the previous chat's artifact. */clearLastArtifact: () => void;@@ -559,8 +568,14 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({}),clearLastArtifact: () =>set((state) => ({+ // The integrations tab belongs to the previous chat's expert.+ integrationsPanelExpert: null,artifactPanel: {...state.artifactPanel,+ activeTab:+ state.artifactPanel.activeTab === "integrations"+ ? "files"+ : state.artifactPanel.activeTab,lastArtifact: null,// A new chat has its own computer; never show the previous chat's.computer: null,@@ -602,6 +617,11 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({},};}),+ integrationsPanelExpert: null,+ toggleIntegrationsPanel: (expert) => {+ set({ integrationsPanelExpert: expert });+ get().toggleContextPanelTab("integrations");+ },openContextPanelForFiles: () => {if (_autoOpenUserClosed) return;if (isClient) {@@ -622,8 +642,7 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({},// Explicit user action (the artifact panel's files button): drops the open- // preview or the computer face and hands the region to the floating files- // card.+ // preview or the computer face and docks the files tab.showFilesTab: () => {if (isClient) {storage.set(Key.COPILOT_CONTEXT_PANEL_OPEN, "true");@@ -720,6 +739,7 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({isSearchOpen: false,isNotificationsEnabled: false,isSoundEnabled: true,+ integrationsPanelExpert: null,artifactPanel: {isOpen: false,activeArtifact: null,diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/useAreWorkspaceFileCardsOpen.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/useAreWorkspaceFileCardsOpen.tsdeleted file mode 100644index 321a12979c..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/useAreWorkspaceFileCardsOpen.ts+++ /dev/null@@ -1,19 +0,0 @@-import { useCopilotUIStore } from "./store";--// The one condition under which the floating workspace-files card is on-// screen — read by the card itself and by the composer and message column-// that slide aside for it. The open flag also drives the docked artifacts-// panel and the artifact preview, so only a non-artifacts tab with no-// preview means the card is showing. The docked panel narrows the chat-// column on its own, so it must never also trigger the slide, or the two-// shifts stack and push the messages off screen under the app sidebar.-// The computer face docks the same way, whatever tab is remembered under it.-export function useAreWorkspaceFileCardsOpen() {- return useCopilotUIStore(- (s) =>- s.artifactPanel.isOpen &&- s.artifactPanel.activeArtifact == null &&- !s.artifactPanel.isComputerOpen &&- s.artifactPanel.activeTab !== "artifacts",- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsxindex cbc2769a35..d6f0f005e2 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsx@@ -350,18 +350,20 @@ describe("ExpertDetailPage", () => {expect(within(workflowRows[1]).getByText("Needs setup")).toBeDefined();});- test("shows the expert's integrations beside the name", async () => {+ test("shows the expert's integrations beside the category chip", async () => {server.use(getGetExpertMockHandler(() => ({...maria,+ categories: ["marketing"],credential_providers: ["github", "openai"],})),);render(<ExpertDetailPage />);- const header = (await screen.findByRole("heading", { name: "Maria" }))- .parentElement as HTMLElement;+ const header = (+ await screen.findByRole("heading", { name: "Maria" })+ ).closest("header") as HTMLElement;const integrations = within(header).getByRole("list", {name: "Integrations",});@@ -370,11 +372,8 @@ describe("ExpertDetailPage", () => {.getAllByRole("img").map((logo) => logo.getAttribute("alt")),).toEqual(["GitHub", "OpenAI"]);- const name = within(header).getByRole("heading", { name: "Maria" });- expect(- name.compareDocumentPosition(integrations) &- Node.DOCUMENT_POSITION_FOLLOWING,- ).toBeTruthy();+ const chip = within(header).getByText("Marketing");+ expect(integrations.parentElement?.contains(chip)).toBe(true);});test("keeps the budget above the tabs and the summary in Basics", async () => {diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/ExpertAvatarButton.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/ExpertAvatarButton.tsxindex 23a36f3ed6..d3de56aba0 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/ExpertAvatarButton.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/ExpertAvatarButton.tsx@@ -24,12 +24,13 @@ export function ExpertAvatarButton({ expert }: Props) {type="button"onClick={() => setIsOpen(true)}aria-label={`Change ${expert.name}'s appearance`}- className="size-24 shrink-0 rounded-xl focus-visible:ring-2 focus-visible:ring-ring"+ className="size-24 shrink-0 rounded-full focus-visible:ring-2 focus-visible:ring-ring"><ExpertAvatarname={expert.name}avatarUrl={expert.avatar_url}size={96}+ className="rounded-full ring-4 ring-background"backgroundColor={getExpertTopicHex({avatarUrl: expert.avatar_url,categories: expert.categories,diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertDetailHeader.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertDetailHeader.tsxindex 391d390108..328bda47f0 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertDetailHeader.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertDetailHeader.tsx@@ -25,7 +25,7 @@ export function ExpertDetailHeader({ expert, onEditSoul, onChat }: Props) {<ExpertCover className="h-36" color={cover.color} art={cover.art} /><div className="flex flex-col gap-4 sm:flex-row sm:items-center">- <span className="-mt-12 ml-14 block shrink-0">+ <span className="relative z-10 -mt-12 ml-14 block shrink-0"><ExpertAvatarButton expert={expert} /></span><div className="min-w-0 flex-1">@@ -35,14 +35,14 @@ export function ExpertDetailHeader({ expert, onEditSoul, onChat }: Props) {jobTitle={expert.job_title}size="page"nameAlign="baseline"- nameAccessory={- <IntegrationIcons- expertName={expert.name}- providers={expert.credential_providers ?? []}- />- }/>- {topic ? <CategoryTag category={topic} className="mt-2" /> : null}+ <div className="mt-2 flex items-center gap-2 empty:hidden">+ {topic ? <CategoryTag category={topic} /> : null}+ <IntegrationIcons+ expertName={expert.name}+ providers={expert.credential_providers ?? []}+ />+ </div></div><div className="flex shrink-0 items-center gap-2"><Buttondiff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationsSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationsSection.tsxindex 634947d251..9e3d63246d 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationsSection.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationsSection.tsx@@ -20,9 +20,15 @@ import { useExpertIntegrationsSection } from "./useExpertIntegrationsSection";interface Props {expertId: string;expertName: string;+ /** The chat's side panel: a smaller title and no search. */+ compact?: boolean;}-export function ExpertIntegrationsSection({ expertId, expertName }: Props) {+export function ExpertIntegrationsSection({+ expertId,+ expertName,+ compact = false,+}: Props) {const {granted,grantable,@@ -56,7 +62,7 @@ export function ExpertIntegrationsSection({ expertId, expertName }: Props) {return (<section data-testid="expert-integrations-section"><div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">- <Text variant="large-medium" tone="primary">+ <Text variant={compact ? "body-medium" : "large-medium"} tone="primary">{expertName}'s Integrations</Text><div className="flex items-center gap-2">@@ -98,13 +104,15 @@ export function ExpertIntegrationsSection({ expertId, expertName }: Props) {>Add integration</Button>- <SearchInput- size="small"- value={query}- onChange={setQuery}- placeholder="Search integrations"- className="w-48"- />+ {compact ? null : (+ <SearchInput+ size="small"+ value={query}+ onChange={setQuery}+ placeholder="Search integrations"+ className="w-48"+ />+ )}</div></div>diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsxindex c7f2852e8a..dbf7f1d1cc 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx@@ -144,14 +144,14 @@ export function ExpertTeamCard({role={expert.role}jobTitle={expert.job_title}nameAlign="baseline"- nameAccessory={- <IntegrationIcons- expertName={expert.name}- providers={expert.credential_providers ?? []}- />- }/>- {topic ? <CategoryTag category={topic} /> : null}+ <div className="flex items-center gap-2 empty:hidden">+ {topic ? <CategoryTag category={topic} /> : null}+ <IntegrationIcons+ expertName={expert.name}+ providers={expert.credential_providers ?? []}+ />+ </div><ExpertTagline tagline={expert.tagline} compact /></div>diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsxindex 31a54f12fa..5a2fbddeb5 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsx@@ -104,8 +104,7 @@ function NewTaskIcon() {);}-// The stronger active state + grey shell ship with the brain-dump-// experience; off keeps the original white sidebar.+// The stronger active state ships with the brain-dump experience.function useNavItemClassName() {const isBrainDumpEnabled = useGetFlag(Flag.ONBOARDING_BRAIN_DUMP);return cn(@@ -246,7 +245,6 @@ export function AppSidebar(props: Props) {const itemVariants = getSidebarItemVariants(!!reduceMotion);const router = useRouter();const isHireExpertsEnabled = useGetFlag(Flag.HIRE_EXPERTS);- const isBrainDumpEnabled = useGetFlag(Flag.ONBOARDING_BRAIN_DUMP);const mainLinks = isHireExpertsEnabled? MAIN_LINKS.filter((link) => link.href !== "/library"): MAIN_LINKS;@@ -277,11 +275,7 @@ export function AppSidebar(props: Props) {<Sidebarcollapsible="icon"{...props}- className={- isBrainDumpEnabled- ? "[&_[data-sidebar=sidebar]]:bg-[#F4F4F4]"- : "[&_[data-sidebar=sidebar]]:bg-[#ffffff]"- }+ className="[&_[data-sidebar=sidebar]]:bg-[#fafafa]"><AppSidebarHeader />diff --git a/autogpt_platform/frontend/src/components/molecules/ExpertIdentityDetails/ExpertIdentityDetails.tsx b/autogpt_platform/frontend/src/components/molecules/ExpertIdentityDetails/ExpertIdentityDetails.tsxindex 289701e466..6c179abe4d 100644--- a/autogpt_platform/frontend/src/components/molecules/ExpertIdentityDetails/ExpertIdentityDetails.tsx+++ b/autogpt_platform/frontend/src/components/molecules/ExpertIdentityDetails/ExpertIdentityDetails.tsx@@ -67,7 +67,11 @@ export function ExpertIdentityDetails({variant="body"tone="secondary"unmask={false}- className={cn("min-w-0 truncate", areaClassName)}+ className={cn(+ "min-w-0 truncate",+ size === "card" && "text-[13px]",+ areaClassName,+ )}title={titleOnNameLine}>{"•"} {titleOnNameLine}