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.
feat(frontend): AutoPilot context panel V1 (shell + Files tab) (#13228)
Ubbe42f354f830a9
diff --git a/autogpt_platform/backend/backend/copilot/prompting.py b/autogpt_platform/backend/backend/copilot/prompting.pyindex f3a1802365..a2b4e99aeb 100644--- a/autogpt_platform/backend/backend/copilot/prompting.py+++ b/autogpt_platform/backend/backend/copilot/prompting.py@@ -221,6 +221,27 @@ Correct flow for *any* integration request:- Do NOT invoke `AutoPilotBlock` via `run_block`; use `run_sub_session`instead.+#### Closing out a task list (MANDATORY)+Before your final assistant message in a turn that used `TodoWrite`, emit+ONE more `TodoWrite` reflecting the true end state of every item:++- Item you actually finished → `completed`.+- Item you intentionally skipped or could not complete → `pending`, and+ explain why in your closing text.+- **Never leave any item as `in_progress` at end of turn.** The+ frontend's Progress sidebar renders the latest snapshot as the+ authoritative state — leaving items `in_progress` makes the UI look+ like work is still happening after you've already declared "done", which+ is a documented source of user confusion ("Autopilot said it finished+ but the sidebar still shows step 3 spinning").+- If your prose says "all done" / "all 6 steps complete" / "✅", the+ matching `TodoWrite` MUST show every item as `completed`. Text and+ task-list state are read together; divergence is treated as a bug.++This applies whether the turn ends successfully, with a question for the+user, or with a graceful stop — always reconcile the list with reality+before signing off.+### Self-learning via skills — load existing, distill newThe `<available_skills>` block injected at the start of the first userdiff --git a/autogpt_platform/frontend/src/app/(no-navbar)/share/chat/[token]/__tests__/page.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/share/chat/[token]/__tests__/page.test.tsxindex b4bb4ca662..4d26c042c4 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/share/chat/[token]/__tests__/page.test.tsx+++ b/autogpt_platform/frontend/src/app/(no-navbar)/share/chat/[token]/__tests__/page.test.tsx@@ -35,11 +35,9 @@ function resetArtifactPanelStore() {useCopilotUIStore.setState({artifactPanel: {isOpen: false,- isMinimized: false,- isMaximized: false,- width: 600,activeArtifact: null,history: [],+ activeTab: "files",},});useCopilotUIStore.getState().resetAutoOpenState();@@ -303,8 +301,8 @@ describe("SharedChatPage", () => {await screen.findByText(/Latest artifact/);await waitFor(() => {+ // The preview drawer is driven by activeArtifact, not `isOpen`.const panel = useCopilotUIStore.getState().artifactPanel;- expect(panel.isOpen).toBe(true);expect(panel.activeArtifact?.id).toBe(latestArtifactId);expect(panel.activeArtifact?.title).toBe("latest.md");});diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/share/chat/[token]/useSharedChatArtifacts.ts b/autogpt_platform/frontend/src/app/(no-navbar)/share/chat/[token]/useSharedChatArtifacts.tsindex dd15ce8093..3fb2856288 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/share/chat/[token]/useSharedChatArtifacts.ts+++ b/autogpt_platform/frontend/src/app/(no-navbar)/share/chat/[token]/useSharedChatArtifacts.ts@@ -20,7 +20,12 @@ export function useSharedChatArtifacts({filePattern,fileUrlBuilder,}: Props) {- const isArtifactPanelOpen = useCopilotUIStore((s) => s.artifactPanel.isOpen);+ // The preview drawer is driven by activeArtifact (not `isOpen`, which belongs+ // to the context sidebar), so derive the open state — used to widen the chat+ // column — from the active artifact.+ const isArtifactPanelOpen = useCopilotUIStore(+ (s) => s.artifactPanel.activeArtifact != null,+ );const openArtifact = useCopilotUIStore((s) => s.openArtifact);const resetArtifactPanel = useCopilotUIStore((s) => s.resetArtifactPanel);const autoOpenedArtifactIdRef = useRef<string | null>(null);diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotChatHost.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotChatHost.tsxindex 31bfad7766..b595d4ccb2 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotChatHost.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotChatHost.tsx@@ -59,7 +59,7 @@ export function CopilotChatHost({Test mode — this session runs agents as simulation</div>)}- <div className="flex-1 overflow-hidden">+ <div className="min-h-0 flex-1 overflow-hidden"><ChatContainermessages={messages}status={status}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsxindex a590495b08..0870c63b02 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx@@ -1,13 +1,17 @@"use client";import { LowCreditBanner } from "@/components/layout/TopUpPrompt/LowCreditBanner/LowCreditBanner";+import { DotDistortionShader } from "@/components/ui/dot-distortion-shader";import { SidebarProvider } from "@/components/ui/sidebar";+import { NAVBAR_HEIGHT_PX } from "@/lib/constants";import { useSupabase } from "@/lib/supabase/hooks/useSupabase";import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";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 { ContextPanelToggle } from "./components/ContextPanel/ContextPanelToggle";import { ChatSidebar } from "./components/ChatSidebar/ChatSidebar";import { FileDropZone } from "./components/FileDropZone/FileDropZone";import { MobileDrawer } from "./components/MobileDrawer/MobileDrawer";@@ -25,6 +29,14 @@ const ArtifactPanel = dynamic({ ssr: false },);+const ContextPanel = dynamic(+ () =>+ import("./components/ContextPanel/ContextPanel").then(+ (m) => m.ContextPanel,+ ),+ { ssr: false },+);+export function CopilotPage() {const [droppedFiles, setDroppedFiles] = useState<File[]>([]);const isMobile = useIsMobile();@@ -47,28 +59,85 @@ export function CopilotPage() {return (<SidebarProviderdefaultOpen={true}- className="h-[calc(100vh-72px)] min-h-0"+ // Explicit height: `h-full` against <section className="flex-1"> drifts+ // out of sync with the navbar-driven --preview-banner-height var during+ // re-renders, clipping the navbar when the sidebar toggles.+ style={{+ height: `calc(100vh - ${NAVBAR_HEIGHT_PX}px - var(--preview-banner-height, 0px))`,+ }}+ className="min-h-0">{!isMobile && <ChatSidebar />}- <div className="flex h-full w-full flex-row overflow-hidden">+ <MainArea+ isMobile={isMobile}+ isArtifactsEnabled={isArtifactsEnabled}+ sessionId={sessionId}+ droppedFiles={droppedFiles}+ setDroppedFiles={setDroppedFiles}+ />+ {isMobile && isArtifactsEnabled && sessionId && (+ <ContextPanel sessionId={sessionId} mobile />+ )}+ {isMobile && isArtifactsEnabled && <ArtifactPanel mobile />}+ {isMobile && <MobileDrawer />}+ <NotificationDialog />+ </SidebarProvider>+ );+}++interface MainAreaProps {+ isMobile: boolean;+ isArtifactsEnabled: boolean;+ sessionId: string | null;+ droppedFiles: File[];+ setDroppedFiles: (files: File[]) => void;+}++function MainArea({+ isMobile,+ isArtifactsEnabled,+ sessionId,+ droppedFiles,+ setDroppedFiles,+}: MainAreaProps) {+ 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]">+ {hasSession && (+ <DotDistortionShader+ dotGap={14}+ dotSize={1}+ opacity={0.2}+ isStatic+ className="pointer-events-none absolute inset-0 !bg-transparent [&_canvas]:opacity-70"+ />+ )}<FileDropZone- className="relative flex min-w-0 flex-1 flex-col overflow-hidden bg-[#f8f8f9] px-0"+ className="relative flex min-w-0 flex-1 flex-col overflow-hidden px-0"onFilesDropped={setDroppedFiles}>{isMobile && <MobileHeader />}<LowCreditBanner className="px-4 pt-4" /><NotificationBanner /><CopilotChatHost- key={sessionId ?? "new"}+ key={`chat-host-${sessionId ?? "new"}`}droppedFiles={droppedFiles}onDroppedFilesConsumed={() => setDroppedFiles([])}/>+ {!isMobile && isArtifactsEnabled && (+ <ContextPanelAutoOpen+ key={`context-auto-open-${sessionId ?? "new"}`}+ sessionId={sessionId}+ />+ )}</FileDropZone>- {!isMobile && isArtifactsEnabled && <ArtifactPanel />}</div>- {isMobile && isArtifactsEnabled && <ArtifactPanel mobile />}- {isMobile && <MobileDrawer />}- <NotificationDialog />- </SidebarProvider>+ {!isMobile && isArtifactsEnabled && sessionId && (+ <ContextPanel sessionId={sessionId} />+ )}+ {!isMobile && isArtifactsEnabled && sessionId && <ArtifactPanel />}+ {!isMobile && isArtifactsEnabled && sessionId && <ContextPanelToggle />}+ </div>);}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 36a5e7aef9..0c4905a793 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@@ -26,24 +26,28 @@ function resetStore() {useCopilotUIStore.setState({artifactPanel: {isOpen: false,- isMinimized: false,- isMaximized: false,- width: 600,activeArtifact: null,history: [],+ activeTab: "files",},});+ // Clear the module-level auto-open flags so each test starts isolated —+ // closeArtifactPanel/toggleContextPanel set _autoOpenUserClosed, which+ // would otherwise leak into later tests' openContextPanelFor* calls.+ useCopilotUIStore.getState().resetAutoOpenState();}describe("artifactPanel store actions", () => {beforeEach(resetStore);- it("openArtifact opens the panel and sets the active artifact", () => {+ it("openArtifact sets the active artifact, opens the context region, and expands the artifact", () => {const a = makeArtifact("a");useCopilotUIStore.getState().openArtifact(a);const s = useCopilotUIStore.getState().artifactPanel;+ // openArtifact opens the context region (isOpen) so closing the artifact+ // returns to the expanded Context Panel, and marks the artifact as the+ // expanded panel.expect(s.isOpen).toBe(true);- expect(s.isMinimized).toBe(false);expect(s.activeArtifact?.id).toBe("a");expect(s.history).toEqual([]);});@@ -96,7 +100,7 @@ describe("artifactPanel store actions", () => {expect(s.activeArtifact?.id).toBe("a");});- it("closeArtifactPanel keeps activeArtifact (for exit animation) and clears history", () => {+ it("closeArtifactPanel clears the preview (activeArtifact + history) and isOpen", () => {const a = makeArtifact("a");const b = makeArtifact("b");useCopilotUIStore.getState().openArtifact(a);@@ -104,8 +108,8 @@ describe("artifactPanel store actions", () => {useCopilotUIStore.getState().closeArtifactPanel();const s = useCopilotUIStore.getState().artifactPanel;expect(s.isOpen).toBe(false);- expect(s.isMinimized).toBe(false);- expect(s.activeArtifact?.id).toBe("b");+ // Drawer is gated on activeArtifact — closing must drop it so it can't float.+ expect(s.activeArtifact).toBeNull();expect(s.history).toEqual([]);});@@ -117,7 +121,6 @@ describe("artifactPanel store actions", () => {useCopilotUIStore.getState().openArtifact(b);const s = useCopilotUIStore.getState().artifactPanel;- expect(s.isOpen).toBe(true);expect(s.activeArtifact?.id).toBe("b");expect(s.history).toEqual([]);});@@ -131,67 +134,25 @@ describe("artifactPanel store actions", () => {useCopilotUIStore.getState().openArtifact(binary);const s = useCopilotUIStore.getState().artifactPanel;- expect(s.isOpen).toBe(true);expect(s.activeArtifact?.id).toBe("bin");});- it("resetArtifactPanel clears active artifact and history", () => {+ it("resetArtifactPanel clears active artifact and history without touching isOpen", () => {const a = makeArtifact("a");const b = makeArtifact("b");useCopilotUIStore.getState().openArtifact(a);useCopilotUIStore.getState().openArtifact(b);- useCopilotUIStore.getState().maximizeArtifactPanel();useCopilotUIStore.getState().resetArtifactPanel();const s = useCopilotUIStore.getState().artifactPanel;- expect(s.isOpen).toBe(false);- expect(s.isMinimized).toBe(false);- expect(s.isMaximized).toBe(false);+ // isOpen is intentionally left alone by resetArtifactPanel — it's shared+ // with ContextPanel and reset runs on every session change.+ expect(s.isOpen).toBe(true);expect(s.activeArtifact).toBeNull();expect(s.history).toEqual([]);});- it("minimize/restore toggles isMinimized without touching activeArtifact", () => {- const a = makeArtifact("a");- useCopilotUIStore.getState().openArtifact(a);- useCopilotUIStore.getState().minimizeArtifactPanel();- expect(useCopilotUIStore.getState().artifactPanel.isMinimized).toBe(true);- useCopilotUIStore.getState().restoreArtifactPanel();- expect(useCopilotUIStore.getState().artifactPanel.isMinimized).toBe(false);- expect(useCopilotUIStore.getState().artifactPanel.activeArtifact?.id).toBe(- "a",- );- });-- it("maximize sets isMaximized and clears isMinimized", () => {- const a = makeArtifact("a");- useCopilotUIStore.getState().openArtifact(a);- useCopilotUIStore.getState().minimizeArtifactPanel();- useCopilotUIStore.getState().maximizeArtifactPanel();- const s = useCopilotUIStore.getState().artifactPanel;- expect(s.isMaximized).toBe(true);- expect(s.isMinimized).toBe(false);- });-- it("restoreArtifactPanel clears both isMinimized and isMaximized", () => {- const a = makeArtifact("a");- useCopilotUIStore.getState().openArtifact(a);- useCopilotUIStore.getState().maximizeArtifactPanel();- useCopilotUIStore.getState().restoreArtifactPanel();- const s = useCopilotUIStore.getState().artifactPanel;- expect(s.isMaximized).toBe(false);- expect(s.isMinimized).toBe(false);- });-- it("setArtifactPanelWidth updates width and clears isMaximized", () => {- useCopilotUIStore.getState().maximizeArtifactPanel();- useCopilotUIStore.getState().setArtifactPanelWidth(720);- const s = useCopilotUIStore.getState().artifactPanel;- expect(s.width).toBe(720);- expect(s.isMaximized).toBe(false);- });-it("history is capped at 25 entries (MAX_HISTORY)", () => {// Open 27 artifacts sequentially (A0..A26). History should never exceed 25.for (let i = 0; i < 27; i++) {@@ -210,17 +171,44 @@ describe("artifactPanel store actions", () => {const b = makeArtifact("b");useCopilotUIStore.getState().openArtifact(a);useCopilotUIStore.getState().openArtifact(b);- useCopilotUIStore.getState().maximizeArtifactPanel();useCopilotUIStore.getState().clearCopilotLocalData();const s = useCopilotUIStore.getState().artifactPanel;expect(s.isOpen).toBe(false);- expect(s.isMinimized).toBe(false);- expect(s.isMaximized).toBe(false);expect(s.activeArtifact).toBeNull();expect(s.history).toEqual([]);- expect(s.width).toBe(600); // DEFAULT_PANEL_WIDTH+ });+});++describe("context panel open/close guards", () => {+ beforeEach(resetStore);++ it("toggleContextPanel closing also clears the active artifact (no floating drawer)", () => {+ useCopilotUIStore.getState().openContextPanelForFiles(); // isOpen true+ useCopilotUIStore.getState().openArtifact(makeArtifact("a")); // drawer up+ useCopilotUIStore.getState().toggleContextPanel(); // closes the panel+ const s = useCopilotUIStore.getState().artifactPanel;+ expect(s.isOpen).toBe(false);+ expect(s.activeArtifact).toBeNull();+ });++ it("closeArtifactPanel does NOT suppress auto-open (it is also the collapse path)", () => {+ // useCollapseContextPanelOnSession calls closeArtifactPanel on every session+ // entry, immediately before the auto-open hooks reopen the panel. Closing+ // must therefore NOT set the user-closed flag, or auto-open would break.+ useCopilotUIStore.getState().openContextPanelForFiles();+ useCopilotUIStore.getState().closeArtifactPanel();+ useCopilotUIStore.getState().openContextPanelForFiles();+ expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);+ });++ it("openContextPanelForProgress respects an explicit user close via the toggle", () => {+ useCopilotUIStore.getState().openContextPanelForProgress();+ expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);+ useCopilotUIStore.getState().toggleContextPanel(); // user close → sets flag+ useCopilotUIStore.getState().openContextPanelForProgress(); // now a no-op+ expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);});});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactCard/ArtifactCard.stories.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactCard/ArtifactCard.stories.tsxindex d4fc07fb48..5d179fb89c 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactCard/ArtifactCard.stories.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactCard/ArtifactCard.stories.tsx@@ -132,11 +132,9 @@ export const ActiveState: Story = {useCopilotUIStore.setState({artifactPanel: {isOpen: true,- isMinimized: false,- isMaximized: false,- width: 600,activeArtifact: makeArtifact({ id: "active-card" }),history: [],+ activeTab: "files",},});return <Story />;diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactCard/ArtifactCard.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactCard/ArtifactCard.tsxindex 6621e099fa..9e1978312b 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactCard/ArtifactCard.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactCard/ArtifactCard.tsx@@ -33,9 +33,7 @@ function formatSize(bytes?: number): string {export function ArtifactCard({ artifact, readOnly }: Props) {const isActive = useCopilotUIStore(- (s) =>- s.artifactPanel.isOpen &&- s.artifactPanel.activeArtifact?.id === artifact.id,+ (s) => s.artifactPanel.activeArtifact?.id === artifact.id,);const openArtifact = useCopilotUIStore((s) => s.openArtifact);const registerArtifactForAutoOpen = useCopilotUIStore(diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/ArtifactPanel.stories.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/ArtifactPanel.stories.tsxindex e7b457c6a9..b13338bf55 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/ArtifactPanel.stories.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/ArtifactPanel.stories.tsx@@ -21,11 +21,9 @@ function openPanelWith(artifact: ArtifactRef) {useCopilotUIStore.setState({artifactPanel: {isOpen: true,- isMinimized: false,- isMaximized: false,- width: 600,activeArtifact: artifact,history: [],+ activeTab: "files",},});}@@ -39,7 +37,7 @@ const meta: Meta<typeof ArtifactPanel> = {docs: {description: {component:- "Side panel for previewing workspace artifacts. Supports resize, minimize, maximize, and navigation history. Bug: panel auto-opens on chat switch instead of staying collapsed.",+ "Side panel for previewing workspace artifacts. Supports resize, navigation history, and a collapsed context rail. Bug: panel auto-opens on chat switch instead of staying collapsed.",},},},@@ -144,25 +142,6 @@ export const OpenWithImageArtifact: Story = {},};-export const MinimizedStrip: Story = {- name: "Minimized",- decorators: [- (Story) => {- useCopilotUIStore.setState({- artifactPanel: {- isOpen: true,- isMinimized: true,- isMaximized: false,- width: 600,- activeArtifact: makeArtifact(),- history: [],- },- });- return <Story />;- },- ],-};-export const ErrorState: Story = {name: "Error — Failed to Load (Stale Artifact)",decorators: [@@ -202,11 +181,9 @@ export const Closed: Story = {useCopilotUIStore.setState({artifactPanel: {isOpen: false,- isMinimized: false,- isMaximized: false,- width: 600,activeArtifact: null,history: [],+ activeTab: "files",},});return <Story />;diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/ArtifactPanel.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/ArtifactPanel.tsxindex 78e79e50e8..6fe0e9b100 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/ArtifactPanel.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/ArtifactPanel.tsx@@ -1,15 +1,10 @@"use client";-import {- Sheet,- SheetContent,- SheetHeader,- SheetTitle,-} from "@/components/ui/sheet";-import { AnimatePresence, motion } from "framer-motion";+import { useRef } from "react";+import { Drawer } from "vaul";+import { MIN_ARTIFACT_PANEL_WIDTH } from "../../store";+import { PanelResizeHandle } from "../PanelResizeHandle";import { ArtifactContent } from "./components/ArtifactContent";-import { ArtifactDragHandle } from "./components/ArtifactDragHandle";-import { ArtifactMinimizedStrip } from "./components/ArtifactMinimizedStrip";import { ArtifactPanelHeader } from "./components/ArtifactPanelHeader";import { useArtifactPanel } from "./useArtifactPanel";@@ -19,107 +14,122 @@ interface Props {export function ArtifactPanel({ mobile }: Props) {const {- isOpen,- isMinimized,- isMaximized,activeArtifact,history,- effectiveWidth,isSourceView,classification,setIsSourceView,- closeArtifactPanel,- minimizeArtifactPanel,- maximizeArtifactPanel,- restoreArtifactPanel,- setArtifactPanelWidth,+ clearArtifactPreview,goBackArtifact,canCopy,handleCopy,handleDownload,+ artifactPanelWidth,+ setArtifactPanelWidth,} = useArtifactPanel();- if (!activeArtifact || !classification) return null;-- const headerProps = {- artifact: activeArtifact,- classification,- canGoBack: history.length > 0,- isMaximized,- isSourceView,- hasSourceToggle: classification.hasSourceToggle,- mobile: !!mobile,- canCopy,- onBack: goBackArtifact,- onClose: closeArtifactPanel,- onMinimize: minimizeArtifactPanel,- onMaximize: maximizeArtifactPanel,- onRestore: restoreArtifactPanel,- onCopy: handleCopy,- onDownload: handleDownload,- onSourceToggle: setIsSourceView,- };+ // Hold the last live artifact so the mobile drawer can keep rendering its+ // contents while vaul plays the slide-out animation — by then+ // `activeArtifact` is already null, and unmounting the whole drawer would+ // snap it shut without animating. Desktop returns null immediately (no exit+ // animation expected there).+ const lastShownRef = useRef<{+ artifact: NonNullable<typeof activeArtifact>;+ classification: NonNullable<typeof classification>;+ } | null>(null);+ if (activeArtifact && classification) {+ lastShownRef.current = { artifact: activeArtifact, classification };+ }- // Mobile: fullscreen Sheet overlayif (mobile) {+ const shown = lastShownRef.current;+ if (!shown) return null;+return (- <Sheet- open={isOpen}- onOpenChange={(open) => !open && closeArtifactPanel()}+ <Drawer.Root+ open={!!activeArtifact && !!classification}+ onOpenChange={(open) => !open && clearArtifactPreview()}+ direction="right"+ handleOnly+ noBodyStyles+ modal={false}>- <SheetContent- side="right"- className="flex w-full flex-col p-0 sm:max-w-full"- >- <SheetHeader className="sr-only">- <SheetTitle>{activeArtifact.title}</SheetTitle>- </SheetHeader>- <ArtifactPanelHeader {...headerProps} />- <ArtifactContent- artifact={activeArtifact}- isSourceView={isSourceView}- classification={classification}+ <Drawer.Portal>+ {/* Manual backdrop — vaul's Drawer.Overlay wraps RemoveScroll, which+ adds padding-right to compensate for scrollbar removal. Our layout+ scrolls internally (no body scrollbar), so that padding visibly+ shifts the underlying page. modal={false} disables RemoveScroll;+ we render our own backdrop with click-to-close. */}+ <div+ onClick={clearArtifactPreview}+ className="fixed inset-0 z-[60] bg-black/20 backdrop-blur-[2px]"+ aria-hidden="true"/>- </SheetContent>- </Sheet>+ <Drawer.Content+ className="fixed right-0 top-0 z-[70] flex h-full w-full flex-col bg-white shadow-xl outline-none"+ style={{ userSelect: "text" }}+ aria-describedby={undefined}+ >+ <Drawer.Title className="sr-only">+ {shown.artifact.title}+ </Drawer.Title>+ <ArtifactPanelHeader+ artifact={shown.artifact}+ classification={shown.classification}+ canGoBack={history.length > 0}+ isSourceView={isSourceView}+ hasSourceToggle={shown.classification.hasSourceToggle}+ canCopy={canCopy}+ onBack={goBackArtifact}+ onClose={clearArtifactPreview}+ onCopy={handleCopy}+ onDownload={handleDownload}+ onSourceToggle={setIsSourceView}+ />+ <ArtifactContent+ artifact={shown.artifact}+ isSourceView={isSourceView}+ classification={shown.classification}+ />+ </Drawer.Content>+ </Drawer.Portal>+ </Drawer.Root>);}- // Minimized strip- if (isOpen && isMinimized) {- return (- <ArtifactMinimizedStrip- artifact={activeArtifact}- classification={classification}- onExpand={restoreArtifactPanel}- />- );- }+ if (!activeArtifact || !classification) return null;- // Keep AnimatePresence mounted across the open→closed transition so the- // exit animation on the motion.div has a chance to run.return (- <AnimatePresence>- {isOpen && (- <motion.div- key="artifact-panel"- data-artifact-panel- initial={{ opacity: 0 }}- animate={{ opacity: 1 }}- exit={{ opacity: 0 }}- transition={{ duration: 0.25, ease: "easeInOut" }}- className="relative flex h-full flex-col overflow-hidden border-l border-zinc-200 bg-white"- style={{ width: effectiveWidth }}- >- <ArtifactDragHandle onWidthChange={setArtifactPanelWidth} />- <ArtifactPanelHeader {...headerProps} />- <ArtifactContent- artifact={activeArtifact}- isSourceView={isSourceView}- classification={classification}- />- </motion.div>- )}- </AnimatePresence>+ <div+ data-artifact-panel+ style={{ width: artifactPanelWidth, userSelect: "text" }}+ className="relative flex h-full shrink-0 flex-col border-l border-l-[#80808017] bg-sidebar"+ >+ <PanelResizeHandle+ panelSelector="[data-artifact-panel]"+ onWidthChange={setArtifactPanelWidth}+ minWidth={MIN_ARTIFACT_PANEL_WIDTH}+ />+ <div className="flex min-h-0 w-full flex-1 flex-col overflow-hidden">+ <ArtifactPanelHeader+ artifact={activeArtifact}+ classification={classification}+ canGoBack={history.length > 0}+ isSourceView={isSourceView}+ hasSourceToggle={classification.hasSourceToggle}+ canCopy={canCopy}+ onBack={goBackArtifact}+ onClose={clearArtifactPreview}+ onCopy={handleCopy}+ onDownload={handleDownload}+ onSourceToggle={setIsSourceView}+ />+ <ArtifactContent+ artifact={activeArtifact}+ isSourceView={isSourceView}+ classification={classification}+ />+ </div>+ </div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/ArtifactMinimizedStrip.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/ArtifactMinimizedStrip.tsxdeleted file mode 100644index 5c85e6eca9..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/ArtifactMinimizedStrip.tsx+++ /dev/null@@ -1,47 +0,0 @@-"use client";--import { ArrowsOutSimple } from "@phosphor-icons/react";-import type { ArtifactRef } from "../../../store";-import type { ArtifactClassification } from "../helpers";--interface Props {- artifact: ArtifactRef;- classification: ArtifactClassification;- onExpand: () => void;-}--export function ArtifactMinimizedStrip({- artifact,- classification,- onExpand,-}: Props) {- const Icon = classification.icon;-- return (- <div className="flex h-full w-10 flex-col items-center border-l border-zinc-200 bg-white pt-3">- <button- type="button"- onClick={onExpand}- className="rounded p-1.5 text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-400"- title="Expand panel"- >- <ArrowsOutSimple size={16} />- </button>- <div className="mt-3 text-zinc-400">- <Icon size={16} />- </div>- <span- className="mt-2 text-xs text-zinc-400"- style={{- writingMode: "vertical-rl",- textOrientation: "mixed",- maxHeight: "120px",- overflow: "hidden",- textOverflow: "ellipsis",- }}- >- {artifact.title}- </span>- </div>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/ArtifactPanelHeader.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/ArtifactPanelHeader.tsxindex eb888fa6b2..33c637e4fc 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/ArtifactPanelHeader.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/ArtifactPanelHeader.tsx@@ -2,13 +2,10 @@import { cn } from "@/lib/utils";import {- ArrowLeft,- ArrowsIn,- ArrowsOut,- Copy,- DownloadSimple,- Minus,- X,+ ArrowLeftIcon,+ CopyIcon,+ DownloadSimpleIcon,+ XIcon,} from "@phosphor-icons/react";import type { ArtifactRef } from "../../../store";import type { ArtifactClassification } from "../helpers";@@ -18,16 +15,11 @@ interface Props {artifact: ArtifactRef;classification: ArtifactClassification;canGoBack: boolean;- isMaximized: boolean;isSourceView: boolean;hasSourceToggle: boolean;- mobile?: boolean;canCopy?: boolean;onBack: () => void;onClose: () => void;- onMinimize: () => void;- onMaximize: () => void;- onRestore: () => void;onCopy: () => void;onDownload: () => void;onSourceToggle: (isSource: boolean) => void;@@ -59,16 +51,11 @@ export function ArtifactPanelHeader({artifact,classification,canGoBack,- isMaximized,isSourceView,hasSourceToggle,- mobile,canCopy = true,onBack,onClose,- onMinimize,- onMaximize,- onRestore,onCopy,onDownload,onSourceToggle,@@ -76,12 +63,12 @@ export function ArtifactPanelHeader({const Icon = classification.icon;return (- <div className="sticky top-0 z-10 flex items-center gap-2 border-b border-zinc-200 bg-white px-3 py-2">+ <div className="sticky top-0 z-10 flex items-center gap-2 border-b border-b-[#80808017] bg-sidebar px-3 py-2">{/* Left section */}<div className="flex min-w-0 flex-1 items-center gap-2">{canGoBack && (<HeaderButton onClick={onBack} title="Back">- <ArrowLeft size={16} />+ <ArrowLeftIcon size={16} /></HeaderButton>)}<Icon size={16} className="shrink-0 text-zinc-400" />@@ -107,30 +94,14 @@ export function ArtifactPanelHeader({)}{canCopy && (<HeaderButton onClick={onCopy} title="Copy">- <Copy size={16} />+ <CopyIcon size={16} /></HeaderButton>)}<HeaderButton onClick={onDownload} title="Download">- <DownloadSimple size={16} />+ <DownloadSimpleIcon size={16} /></HeaderButton>- {!mobile && (- <>- <HeaderButton onClick={onMinimize} title="Minimize">- <Minus size={16} />- </HeaderButton>- {isMaximized ? (- <HeaderButton onClick={onRestore} title="Restore">- <ArrowsIn size={16} />- </HeaderButton>- ) : (- <HeaderButton onClick={onMaximize} title="Maximize">- <ArrowsOut size={16} />- </HeaderButton>- )}- </>- )}<HeaderButton onClick={onClose} title="Close">- <X size={16} />+ <XIcon size={16} /></HeaderButton></div></div>diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/__tests__/ArtifactDragHandle.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/__tests__/ArtifactDragHandle.test.tsxdeleted file mode 100644index 53706fc209..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/__tests__/ArtifactDragHandle.test.tsx+++ /dev/null@@ -1,181 +0,0 @@-import { cleanup, fireEvent, render } from "@testing-library/react";-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { ArtifactDragHandle } from "../ArtifactDragHandle";--function renderHandle(onWidthChange = vi.fn(), panelWidth = 600) {- const utils = render(- <div- data-artifact-panel- style={{- width: `${panelWidth}px`,- height: "400px",- position: "relative",- }}- >- <ArtifactDragHandle onWidthChange={onWidthChange} />- </div>,- );- const panel = utils.container.querySelector(- "[data-artifact-panel]",- ) as HTMLElement;- // happy-dom doesn't compute layout; stub offsetWidth so the handle reads- // the intended starting width.- Object.defineProperty(panel, "offsetWidth", {- value: panelWidth,- configurable: true,- });- const handle = utils.container.querySelector(- '[role="separator"]',- ) as HTMLElement;- return { handle, onWidthChange, ...utils };-}--// jsdom/happy-dom don't implement pointer capture by default — spy on the-// prototype so vi.restoreAllMocks() can tear the spies down. We also seed-// no-op base implementations where the prototype lacks them so vi.spyOn has-// something to wrap. Both the seeded properties and window.innerWidth are-// manual mutations that vi.restoreAllMocks() won't undo, so capture their-// original descriptors and restore them in `restoreGlobals`.-function installPointerCaptureStub() {- const proto = HTMLElement.prototype as unknown as {- setPointerCapture?: (id: number) => void;- releasePointerCapture?: (id: number) => void;- };- const originalSetPointerCapture = Object.getOwnPropertyDescriptor(- proto,- "setPointerCapture",- );- const originalReleasePointerCapture = Object.getOwnPropertyDescriptor(- proto,- "releasePointerCapture",- );-- if (!proto.setPointerCapture) proto.setPointerCapture = () => {};- if (!proto.releasePointerCapture) proto.releasePointerCapture = () => {};- const setPointerCapture = vi- .spyOn(HTMLElement.prototype, "setPointerCapture")- .mockImplementation(() => {});- const releasePointerCapture = vi- .spyOn(HTMLElement.prototype, "releasePointerCapture")- .mockImplementation(() => {});-- function restoreGlobals() {- if (originalSetPointerCapture) {- Object.defineProperty(- proto,- "setPointerCapture",- originalSetPointerCapture,- );- } else {- delete proto.setPointerCapture;- }- if (originalReleasePointerCapture) {- Object.defineProperty(- proto,- "releasePointerCapture",- originalReleasePointerCapture,- );- } else {- delete proto.releasePointerCapture;- }- }-- return { setPointerCapture, releasePointerCapture, restoreGlobals };-}--describe("ArtifactDragHandle", () => {- let spies: ReturnType<typeof installPointerCaptureStub>;- const originalInnerWidth = Object.getOwnPropertyDescriptor(- window,- "innerWidth",- );-- beforeEach(() => {- spies = installPointerCaptureStub();- Object.defineProperty(window, "innerWidth", {- value: 1200,- writable: true,- configurable: true,- });- });-- afterEach(() => {- cleanup();- vi.restoreAllMocks();- spies.restoreGlobals();- if (originalInnerWidth) {- Object.defineProperty(window, "innerWidth", originalInnerWidth);- }- });-- // SECRT-2256: when the cursor drifts over a sandboxed iframe mid-drag, the- // iframe eats pointermove/pointerup and the drag gets stuck. setPointerCapture- // routes all subsequent pointer events to the handle regardless of what's- // under the cursor, which fixes both "can't drag right" and "drag doesn't- // stop on release".- it("captures the pointer on pointerdown so drags survive the cursor drifting over iframes (SECRT-2256)", () => {- const { handle } = renderHandle();-- fireEvent.pointerDown(handle, { clientX: 500, pointerId: 7 });-- expect(spies.setPointerCapture).toHaveBeenCalledWith(7);- });-- it("releases the pointer capture when the drag ends", () => {- const { handle } = renderHandle();-- fireEvent.pointerDown(handle, { clientX: 500, pointerId: 7 });- fireEvent.pointerUp(handle, { clientX: 400, pointerId: 7 });-- expect(spies.releasePointerCapture).toHaveBeenCalledWith(7);- });-- it("calls onWidthChange with the expanded width when dragging leftwards", () => {- const onWidthChange = vi.fn();- const { handle } = renderHandle(onWidthChange);-- fireEvent.pointerDown(handle, { clientX: 800, pointerId: 1 });- fireEvent.pointerMove(document, { clientX: 700, pointerId: 1 });-- // startWidth is 600 (container), delta = 800 - 700 = 100 → newWidth 700- expect(onWidthChange).toHaveBeenCalledWith(700);- });-- it("calls onWidthChange with the shrunk width when dragging rightwards", () => {- const onWidthChange = vi.fn();- const { handle } = renderHandle(onWidthChange);-- fireEvent.pointerDown(handle, { clientX: 800, pointerId: 1 });- fireEvent.pointerMove(document, { clientX: 900, pointerId: 1 });-- // delta = -100 → newWidth 500- expect(onWidthChange).toHaveBeenCalledWith(500);- });-- it("clamps to minWidth and maxWidth", () => {- const onWidthChange = vi.fn();- const { handle } = renderHandle(onWidthChange);-- fireEvent.pointerDown(handle, { clientX: 800, pointerId: 1 });-- // Drag way left → want huge width, should clamp at 85% of 1200 = 1020- fireEvent.pointerMove(document, { clientX: -5000, pointerId: 1 });- expect(onWidthChange).toHaveBeenLastCalledWith(1020);-- // Drag way right → want tiny width, should clamp at minWidth 320- fireEvent.pointerMove(document, { clientX: 5000, pointerId: 1 });- expect(onWidthChange).toHaveBeenLastCalledWith(320);- });-- it("stops dragging on pointerup so subsequent cursor moves don't resize", () => {- const onWidthChange = vi.fn();- const { handle } = renderHandle(onWidthChange);-- fireEvent.pointerDown(handle, { clientX: 800, pointerId: 1 });- fireEvent.pointerUp(handle, { clientX: 800, pointerId: 1 });- onWidthChange.mockClear();-- fireEvent.pointerMove(document, { clientX: 500, pointerId: 1 });- expect(onWidthChange).not.toHaveBeenCalled();- });-});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/useArtifactPanel.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/useArtifactPanel.tsindex 20443154cd..389687758c 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/useArtifactPanel.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/useArtifactPanel.ts@@ -7,23 +7,14 @@ import { getCachedArtifactContent } from "./components/useArtifactContent";import { downloadArtifact } from "./downloadArtifact";import { classifyArtifact } from "./helpers";-// SSR fallback for viewport width before window is available.-const DEFAULT_VIEWPORT_WIDTH = 1280;-export function useArtifactPanel() {const artifactPanel = useCopilotUIStore((s) => s.artifactPanel);- const closeArtifactPanel = useCopilotUIStore((s) => s.closeArtifactPanel);- const minimizeArtifactPanel = useCopilotUIStore(- (s) => s.minimizeArtifactPanel,- );- const maximizeArtifactPanel = useCopilotUIStore(- (s) => s.maximizeArtifactPanel,- );- const restoreArtifactPanel = useCopilotUIStore((s) => s.restoreArtifactPanel);+ const clearArtifactPreview = useCopilotUIStore((s) => s.clearArtifactPreview);+ const goBackArtifact = useCopilotUIStore((s) => s.goBackArtifact);+ const artifactPanelWidth = useCopilotUIStore((s) => s.artifactPanelWidth);const setArtifactPanelWidth = useCopilotUIStore((s) => s.setArtifactPanelWidth,);- const goBackArtifact = useCopilotUIStore((s) => s.goBackArtifact);const [isSourceView, setIsSourceView] = useState(false);@@ -42,43 +33,9 @@ export function useArtifactPanel() {setIsSourceView(false);}, [activeArtifact?.id]);- // Keyboard: Escape to close- useEffect(() => {- if (!artifactPanel.isOpen) return;-- function handleKeyDown(e: KeyboardEvent) {- if (e.key === "Escape") {- if (document.querySelector('[role="dialog"], [data-state="open"]'))- return;- closeArtifactPanel();- }- }-- document.addEventListener("keydown", handleKeyDown);- return () => document.removeEventListener("keydown", handleKeyDown);- }, [artifactPanel.isOpen, closeArtifactPanel]);-- // Track viewport width reactively for maximize mode.- const [viewportWidth, setViewportWidth] = useState(- typeof window !== "undefined" ? window.innerWidth : DEFAULT_VIEWPORT_WIDTH,- );- useEffect(() => {- // Throttle to ~10Hz: resize fires continuously during drag, but we only- // need the panel width to follow the viewport within a frame or two.- let timer: ReturnType<typeof setTimeout> | null = null;- function handleResize() {- if (timer) return;- timer = setTimeout(() => {- setViewportWidth(window.innerWidth);- timer = null;- }, 100);- }- window.addEventListener("resize", handleResize);- return () => {- window.removeEventListener("resize", handleResize);- if (timer) clearTimeout(timer);- };- }, []);+ // Escape-to-close is owned by the vaul Drawer.Root in ArtifactPanel — its+ // onOpenChange already routes to clearArtifactPreview. A manual document+ // listener here would self-block on the drawer's own [role="dialog"].const canCopy =classification != null &&@@ -123,27 +80,18 @@ export function useArtifactPanel() {});}- // Always clamp against the current viewport so a previously-dragged-wide- // panel doesn't spill offscreen after the user resizes their window.- const maxWidth = viewportWidth * 0.85;- const effectiveWidth = artifactPanel.isMaximized- ? maxWidth- : Math.min(artifactPanel.width, maxWidth);-return {- ...artifactPanel,- effectiveWidth,+ activeArtifact,+ history: artifactPanel.history,isSourceView,classification,setIsSourceView,- closeArtifactPanel,- minimizeArtifactPanel,- maximizeArtifactPanel,- restoreArtifactPanel,- setArtifactPanelWidth,+ clearArtifactPreview,goBackArtifact,canCopy,handleCopy,handleDownload,+ artifactPanelWidth,+ setArtifactPanelWidth,};}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 298899f0e4..5f997b8228 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,12 +5,10 @@ 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";import { useCallback, useEffect, useRef, useState } from "react";-import { useCopilotUIStore } from "../../store";import type { TurnStatsMap } from "../../helpers/convertChatSessionToUiMessages";import { ChatMessagesContainer } from "../ChatMessagesContainer/ChatMessagesContainer";import { CopilotChatActionsProvider } from "../CopilotChatActionsProvider/CopilotChatActionsProvider";@@ -87,11 +85,6 @@ export const ChatContainer = ({turnStats,}: ChatContainerProps) => {const isArtifactsEnabled = useGetFlag(Flag.ARTIFACTS);- const isArtifactPanelOpen = useCopilotUIStore((s) => s.artifactPanel.isOpen);- // When the flag is off we must not auto-open artifacts or let the panel's- // open state drive layout width; an artifact generated in a stale session- // state would otherwise shrink the chat column with no panel rendered.- const isArtifactOpen = isArtifactsEnabled && isArtifactPanelOpen;useAutoOpenArtifacts({sessionId,messages,@@ -156,14 +149,9 @@ export const ChatContainer = ({return (<CopilotChatActionsProvider onSend={onSend}><LayoutGroup id="copilot-2-chat-layout">- <div className="flex h-full min-h-0 w-full flex-col bg-[#f8f8f9] px-2 lg:px-0">+ <div className="flex h-full min-h-0 w-full flex-col px-2 lg:px-0">{sessionId ? (- <div- className={cn(- "mx-auto flex h-full min-h-0 w-full flex-col",- !isArtifactOpen && "max-w-3xl",- )}- >+ <div className="mx-auto flex h-full min-h-0 w-full max-w-3xl flex-col bg-[#fafafa]"><ChatMessagesContainermessages={messages}status={status}@@ -188,7 +176,7 @@ export const ChatContainer = ({transition={{ duration: 0.3 }}className="relative px-3 pb-2 pt-2">- <div className="pointer-events-none absolute left-0 right-0 top-[-18px] z-10 h-6 bg-gradient-to-b from-transparent to-[#f8f8f9]" />+ <div className="pointer-events-none absolute left-0 right-0 top-[-18px] z-10 h-6 bg-gradient-to-b from-transparent to-[#fafafa]" />{isLimitReached && (<divref={usageCardRef}@@ -197,9 +185,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(248,248,249,0.96)_0%,rgba(248,248,249,0.9)_42%,rgba(248,248,249,0.58)_68%,rgba(248,248,249,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(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%)]">- <div className="absolute inset-x-10 bottom-0 h-28 rounded-full bg-[#f8f8f9]/80 blur-2xl" />+ <div className="absolute inset-x-10 bottom-0 h-28 rounded-full bg-[#fafafa]/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/__tests__/ChatContainer.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/__tests__/ChatContainer.test.tsxindex 6a75cbb8a6..607045b2db 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/__tests__/ChatContainer.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/__tests__/ChatContainer.test.tsx@@ -35,11 +35,9 @@ function resetCopilotStore() {useCopilotUIStore.setState({artifactPanel: {isOpen: false,- isMinimized: false,- isMaximized: false,- width: 600,activeArtifact: null,history: [],+ activeTab: "files",},});}@@ -284,7 +282,7 @@ describe("ChatContainer", () => {expect(wrapper?.className).toContain("max-w-3xl");});- it("resets the panel state when sessionId changes", () => {+ it("clears the artifact preview when sessionId changes", () => {mockArtifactsEnabled.mockReturnValue(true);useCopilotUIStore.getState()@@ -297,12 +295,16 @@ describe("ChatContainer", () => {<ChatContainer {...baseProps} sessionId="s1" />,);- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);+ // The preview drawer is driven by activeArtifact, not `isOpen`.+ expect(+ useCopilotUIStore.getState().artifactPanel.activeArtifact?.id,+ ).toBe(ARTIFACT_B_ID);rerender(<ChatContainer {...baseProps} sessionId="s2" />);+ // `isOpen` is shared with ContextPanel and intentionally left alone+ // on session switches; the drawer hides via activeArtifact being null.const panel = useCopilotUIStore.getState().artifactPanel;- expect(panel.isOpen).toBe(false);expect(panel.activeArtifact).toBeNull();expect(panel.history).toEqual([]);const wrapper = screen.getByTestId(@@ -332,18 +334,22 @@ describe("ChatContainer", () => {expect(panel.history).toEqual([]);});- it("closes the panel on unmount so nav-away cannot resurrect it (SECRT-2254)", () => {+ it("clears artifact preview on unmount so nav-away cannot resurrect it (SECRT-2254)", () => {mockArtifactsEnabled.mockReturnValue(true);useCopilotUIStore.getState().openArtifact(makeArtifact(ARTIFACT_A_ID, "a.txt"));- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);+ expect(+ useCopilotUIStore.getState().artifactPanel.activeArtifact?.id,+ ).toBe(ARTIFACT_A_ID);const { unmount } = render(<ChatContainer {...baseProps} />);unmount();+ // The drawer's visibility is gated on activeArtifact, so clearing it+ // is what prevents a resurrection on nav-away. `isOpen` belongs to+ // ContextPanel and must not be flipped here.const panel = useCopilotUIStore.getState().artifactPanel;- expect(panel.isOpen).toBe(false);expect(panel.activeArtifact).toBeNull();expect(panel.history).toEqual([]);});@@ -353,11 +359,9 @@ describe("ChatContainer", () => {useCopilotUIStore.setState({artifactPanel: {isOpen: true,- isMinimized: false,- isMaximized: false,- width: 600,activeArtifact: makeArtifact(ARTIFACT_A_ID, "stale.txt"),history: [],+ activeTab: "files",},});@@ -366,7 +370,12 @@ describe("ChatContainer", () => {render(<ChatContainer {...baseProps} />);- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);+ // The drawer is gated on activeArtifact — clearing it is enough to+ // suppress the stale preview. `isOpen` is owned by ContextPanel and+ // is no longer flipped by the unmount cleanup.+ expect(+ useCopilotUIStore.getState().artifactPanel.activeArtifact,+ ).toBeNull();const wrapper = screen.getByTestId("chat-messages-container",).parentElement;diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/useAutoOpenArtifacts.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/useAutoOpenArtifacts.test.tsindex 49e2711f21..3a0dfd2731 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/useAutoOpenArtifacts.test.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/useAutoOpenArtifacts.test.ts@@ -24,31 +24,13 @@ function makeArtifact(};}-function makeAgentMessage(- id: string,- artifactIds: string[],-): UIMessage<unknown, UIDataTypes, UITools> {- return {- id,- role: "assistant",- parts: artifactIds.map((aid) => ({- type: "file" as const,- url: `/api/proxy/api/workspace/files/${aid}/download`,- filename: `${aid}.txt`,- mediaType: "text/plain",- })),- };-}-function resetStore() {useCopilotUIStore.setState({artifactPanel: {isOpen: false,- isMinimized: false,- isMaximized: false,- width: 600,activeArtifact: null,history: [],+ activeTab: "files",},});useCopilotUIStore.getState().resetAutoOpenState();@@ -72,7 +54,7 @@ describe("useAutoOpenArtifacts (card-based)", () => {expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);});- it("resets the panel state when sessionId changes", () => {+ it("clears artifact preview state when sessionId changes", () => {useCopilotUIStore.getState().openArtifact(makeArtifact(A_ID, "a.txt"));useCopilotUIStore.getState().openArtifact(makeArtifact(B_ID, "b.txt"));@@ -85,213 +67,49 @@ describe("useAutoOpenArtifacts (card-based)", () => {rerender({ sessionId: "s2" });});+ // Switching sessions clears the preview via activeArtifact; we assert on+ // activeArtifact (not isOpen) because the drawer is gated on it.const s = useCopilotUIStore.getState().artifactPanel;- expect(s.isOpen).toBe(false);expect(s.activeArtifact).toBeNull();expect(s.history).toEqual([]);});- it("closes the panel on unmount (SECRT-2254)", () => {+ it("clears artifact preview on unmount (SECRT-2254)", () => {useCopilotUIStore.getState().openArtifact(makeArtifact(A_ID, "a.txt"));- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);+ // openArtifact opens the context region (isOpen: true) and drives the+ // preview drawer via activeArtifact.+ expect(useCopilotUIStore.getState().artifactPanel.activeArtifact?.id).toBe(+ A_ID,+ );const { unmount } = renderHook(() => useAutoOpenArtifacts(defaultProps));act(() => {unmount();});+ // Drawer is gated on activeArtifact, so clearing it is what hides the+ // preview after nav-away; we assert on activeArtifact here.const s = useCopilotUIStore.getState().artifactPanel;- expect(s.isOpen).toBe(false);expect(s.activeArtifact).toBeNull();});-- // ── Readiness gating ──────────────────────────────────────────────-- it("sets auto-open ready after loading completes with a session", () => {- renderHook(() => useAutoOpenArtifacts(defaultProps));- // After the effect fires, registerArtifactForAutoOpen should auto-open- const ref = makeArtifact(A_ID);- act(() => {- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- });- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);- });-- it("does not set ready when sessionId is null", () => {- renderHook(() =>- useAutoOpenArtifacts({ ...defaultProps, sessionId: null }),- );- const ref = makeArtifact(A_ID);- act(() => {- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- });- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);- });-- it("does not set ready when artifacts feature flag is disabled", () => {- renderHook(() =>- useAutoOpenArtifacts({ ...defaultProps, isArtifactsEnabled: false }),- );- const ref = makeArtifact(A_ID);- act(() => {- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- });- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);- });-- it("defers readiness when session was loading and messages haven't hydrated", () => {- const { rerender } = renderHook(- ({ isLoadingSession, messages }) =>- useAutoOpenArtifacts({- ...defaultProps,- isLoadingSession,- messages,- }),- { initialProps: { isLoadingSession: true, messages: [] as Messages } },- );-- // Loading done but messages still empty → should NOT be ready- act(() => {- rerender({ isLoadingSession: false, messages: [] as Messages });- });- const ref = makeArtifact(A_ID);- act(() => {- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- });- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);-- // Once messages arrive → ready- resetStore();- act(() => {- rerender({- isLoadingSession: false,- messages: [makeAgentMessage("m1", [A_ID])],- });- });- const ref2 = makeArtifact(B_ID);- act(() => {- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref2);- });- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);- });-- // ── User-close suppression ────────────────────────────────────────-- it("suppresses auto-open after the user explicitly closes the panel", () => {- renderHook(() => useAutoOpenArtifacts(defaultProps));-- // Open via store- act(() => {- useCopilotUIStore.getState().openArtifact(makeArtifact(A_ID));- });- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);-- // User closes- act(() => {- useCopilotUIStore.getState().closeArtifactPanel();- });-- // New registration should NOT auto-open- const ref = makeArtifact(B_ID);- act(() => {- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- });- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);- });-- it("resets close-suppression when session changes (remount)", () => {- renderHook(() => useAutoOpenArtifacts(defaultProps));-- // Open + close → suppressed- act(() => {- useCopilotUIStore.getState().openArtifact(makeArtifact(A_ID));- });- act(() => {- useCopilotUIStore.getState().closeArtifactPanel();- });-- // Session change resets suppression- const { rerender } = renderHook(- ({ sessionId }) => useAutoOpenArtifacts({ ...defaultProps, sessionId }),- { initialProps: { sessionId: "s1" } },- );- act(() => {- rerender({ sessionId: "s2" });- });-- // New registration should auto-open- const ref = makeArtifact(B_ID);- act(() => {- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- });- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);- });});// ── registerArtifactForAutoOpen (store unit tests) ────────────────+//+// Auto-open is disabled — registerArtifactForAutoOpen is only kept to track+// known IDs and upgrade metadata when a richer ref arrives for the same id.describe("registerArtifactForAutoOpen", () => {beforeEach(resetStore);- it("does not auto-open when not ready", () => {- const ref = makeArtifact(A_ID);- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);- });-- it("auto-opens an agent artifact when ready", () => {+ it("never auto-opens the panel, regardless of readiness", () => {useCopilotUIStore.getState().setAutoOpenReady();const ref = makeArtifact(A_ID);useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);- expect(useCopilotUIStore.getState().artifactPanel.activeArtifact?.id).toBe(- A_ID,- );- });-- it("does not auto-open user-uploaded artifacts", () => {- useCopilotUIStore.getState().setAutoOpenReady();- const ref = makeArtifact(A_ID, "upload.txt", "user-upload");- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);- });-- it("does not auto-open the same artifact twice", () => {- useCopilotUIStore.getState().setAutoOpenReady();- const ref = makeArtifact(A_ID);- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);-- // Close, then re-register same ID- useCopilotUIStore.getState().closeArtifactPanel();- // Reset the user-closed flag so it doesn't interfere- useCopilotUIStore.getState().resetAutoOpenState();- useCopilotUIStore.getState().setAutoOpenReady();- // But A_ID is already known from the first registration — wait,- // resetAutoOpenState clears known IDs too. Let's re-add it as known.- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);- // First call after reset → opens again (this is correct — reset clears known)- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true);-- // NOW close and try again without reset — same ID, should not re-trigger- useCopilotUIStore.getState().closeArtifactPanel();- // Manually set ready again (close doesn't affect ready)- const ref2 = makeArtifact(A_ID);- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref2);- // Already known, won't re-open- expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);- });-- it("does not auto-open when user-closed flag is set", () => {- useCopilotUIStore.getState().setAutoOpenReady();- useCopilotUIStore.getState().markUserClosedForAutoOpen();- const ref = makeArtifact(A_ID);- useCopilotUIStore.getState().registerArtifactForAutoOpen(ref);expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);});it("upgrades activeArtifact metadata when a richer ref arrives for a known ID", () => {- useCopilotUIStore.getState().setAutoOpenReady();const weakRef: ArtifactRef = {id: A_ID,title: "File " + A_ID.slice(0, 8),@@ -299,7 +117,10 @@ describe("registerArtifactForAutoOpen", () => {sourceUrl: `/api/proxy/api/workspace/files/${A_ID}/download`,origin: "agent",};+ // First registration tracks the ID but doesn't open the panel.useCopilotUIStore.getState().registerArtifactForAutoOpen(weakRef);+ // Simulate the user explicitly opening this artifact afterwards.+ useCopilotUIStore.getState().openArtifact(weakRef);expect(useCopilotUIStore.getState().artifactPanel.activeArtifact?.mimeType,).toBeNull();diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/ChatInput.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/ChatInput.tsxindex fee25162a1..7808abdc47 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/ChatInput.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/ChatInput.tsx@@ -8,11 +8,17 @@ import {} from "@/components/ai-elements/prompt-input";import { toast } from "@/components/molecules/Toast/use-toast";import { InputGroup } from "@/components/ui/input-group";+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/components/ui/tooltip";import { cn } from "@/lib/utils";import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { ArrowUpIcon } from "@phosphor-icons/react";import { ChangeEvent, useEffect, useState } from "react";import { AttachmentMenu } from "./components/AttachmentMenu";+import { BlockCaret } from "./components/BlockCaret";import { DryRunToggleButton } from "./components/DryRunToggleButton";import { FileChips } from "./components/FileChips";import { ModelToggleButton } from "./components/ModelToggleButton";@@ -209,7 +215,9 @@ export function ChatInput({onKeyDown={handleKeyDown}disabled={isInputDisabled}placeholder={resolvedPlaceholder}+ className="caret-transparent placeholder:indent-3"/>+ <BlockCaret textareaId={inputId} />{isRecording && !value && (<div className="pointer-events-none absolute inset-0 flex items-center justify-center"><RecordingIndicator@@ -292,7 +300,12 @@ export function ChatInput({</PromptInputButton>)}{isStreaming ? (- <PromptInputSubmit status="streaming" onStop={onStop} />+ <Tooltip>+ <TooltipTrigger asChild>+ <PromptInputSubmit status="streaming" onStop={onStop} />+ </TooltipTrigger>+ <TooltipContent side="top">Stop</TooltipContent>+ </Tooltip>) : (<PromptInputSubmit disabled={!canSend} />)}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/BlockCaret.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/BlockCaret.tsxnew file mode 100644index 0000000000..bb990c8ca4--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/BlockCaret.tsx@@ -0,0 +1,182 @@+"use client";++import { useEffect, useState } from "react";++interface Props {+ textareaId: string;+}++// Style properties that must be mirrored from the textarea onto a hidden+// measurement div so that span.offsetTop/offsetLeft inside the mirror equal+// the caret's pixel position inside the textarea.+const MIRROR_PROPERTIES = [+ "direction",+ "boxSizing",+ "width",+ "height",+ "overflowX",+ "overflowY",+ "borderTopWidth",+ "borderRightWidth",+ "borderBottomWidth",+ "borderLeftWidth",+ "borderStyle",+ "paddingTop",+ "paddingRight",+ "paddingBottom",+ "paddingLeft",+ "fontStyle",+ "fontVariant",+ "fontWeight",+ "fontStretch",+ "fontSize",+ "fontSizeAdjust",+ "lineHeight",+ "fontFamily",+ "textAlign",+ "textTransform",+ "textIndent",+ "letterSpacing",+ "wordSpacing",+ "tabSize",+ "whiteSpace",+ "wordWrap",+ "wordBreak",+] as const;++interface Coords {+ left: number;+ top: number;+ height: number;+}++function getCaretCoordinates(+ textarea: HTMLTextAreaElement,+ position: number,+): Coords {+ const computed = window.getComputedStyle(textarea);+ const mirror = document.createElement("div");++ mirror.style.position = "absolute";+ mirror.style.top = "0";+ mirror.style.left = "-9999px";+ mirror.style.visibility = "hidden";+ mirror.style.whiteSpace = "pre-wrap";+ mirror.style.wordWrap = "break-word";++ for (const prop of MIRROR_PROPERTIES) {+ mirror.style[prop as never] = computed[prop as never];+ }++ mirror.textContent = textarea.value.substring(0, position);+ const marker = document.createElement("span");+ // Fall back to a real char so the span has a measurable bounding box even+ // when the cursor is at end-of-input.+ marker.textContent = textarea.value.substring(position) || ".";+ mirror.appendChild(marker);+ document.body.appendChild(mirror);++ const fontSize = parseFloat(computed.fontSize);+ const lineHeight = parseFloat(computed.lineHeight) || fontSize * 1.2;+ const coords: Coords = {+ left: marker.offsetLeft,+ top: marker.offsetTop,+ height: lineHeight,+ };++ document.body.removeChild(mirror);+ return coords;+}++const CARET_WIDTH = 3;++export function BlockCaret({ textareaId }: Props) {+ const [pos, setPos] = useState<Coords | null>(null);+ const [visible, setVisible] = useState(true);++ useEffect(() => {+ const textarea = document.getElementById(+ textareaId,+ ) as HTMLTextAreaElement | null;+ if (!textarea) return;++ let frame = 0;++ function update() {+ if (!textarea) return;+ if (document.activeElement !== textarea) {+ setPos(null);+ return;+ }+ if (textarea.selectionStart !== textarea.selectionEnd) {+ // Hide bar during text selection — the bar over highlighted ranges+ // would look broken.+ setPos(null);+ return;+ }+ const c = getCaretCoordinates(textarea, textarea.selectionEnd);+ setPos({+ left: c.left - textarea.scrollLeft,+ top: c.top - textarea.scrollTop,+ height: c.height,+ });+ }++ // Each keystroke fires a burst of events (keydown + input + keyup, …).+ // Coalesce them into a single measurement per animation frame so the+ // synchronous reflow in getCaretCoordinates runs at most once per frame+ // instead of several times per keystroke.+ function scheduleUpdate() {+ if (frame) return;+ frame = window.requestAnimationFrame(() => {+ frame = 0;+ update();+ });+ }++ update();+ const events = [+ "input",+ "keyup",+ "keydown",+ "click",+ "focus",+ "blur",+ "scroll",+ "select",+ ];+ for (const ev of events) textarea.addEventListener(ev, scheduleUpdate);+ window.addEventListener("resize", scheduleUpdate);++ return () => {+ if (frame) window.cancelAnimationFrame(frame);+ for (const ev of events) textarea.removeEventListener(ev, scheduleUpdate);+ window.removeEventListener("resize", scheduleUpdate);+ };+ }, [textareaId]);++ useEffect(() => {+ if (!pos) return;+ // Reset to visible whenever the caret moves so typing keeps the bar+ // solid — only blinks once the user pauses.+ setVisible(true);+ const interval = setInterval(() => setVisible((v) => !v), 530);+ return () => clearInterval(interval);+ }, [pos]);++ if (!pos) return null;++ return (+ <div+ aria-hidden="true"+ className="pointer-events-none absolute z-10 bg-blue-500"+ style={{+ left: pos.left,+ top: pos.top - 3,+ height: pos.height,+ width: CARET_WIDTH,+ opacity: visible ? 1 : 0,+ }}+ />+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/DryRunToggleButton.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/DryRunToggleButton.tsxindex a0b6b5b8f1..b6100a6454 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/DryRunToggleButton.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/DryRunToggleButton.tsx@@ -27,9 +27,7 @@ export function DryRunToggleButton({ isDryRun, onToggle }: Props) {onClick={onToggle}className={cn("inline-flex h-9 items-center justify-center gap-1 rounded-full border border-neutral-200 bg-white px-2.5 text-xs font-medium shadow-sm transition-colors hover:bg-neutral-50",- isDryRun- ? "text-amber-900"- : "text-neutral-500 hover:text-neutral-700",+ isDryRun ? "text-amber-900" : "text-zinc-950 hover:text-zinc-950",)}aria-label={isDryRun ? "Test mode active" : "Enable Test mode"}>diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/ModeToggleButton.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/ModeToggleButton.tsxindex 5636123324..144e131d61 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/ModeToggleButton.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/ModeToggleButton.tsx@@ -29,8 +29,8 @@ export function ModeToggleButton({ mode, onToggle }: Props) {aria-pressed={isExtended}onClick={onToggle}className={cn(- "ml-2 inline-flex h-9 items-center justify-center gap-1 rounded-full border border-neutral-200 bg-white px-2.5 text-xs font-medium shadow-sm transition-colors hover:bg-neutral-50",- isExtended ? "text-purple-900" : "text-amber-900",+ "ml-2 inline-flex h-9 min-w-[6rem] items-center justify-center gap-1 rounded-full border border-neutral-200 bg-white px-2.5 text-xs font-medium shadow-sm transition-colors hover:bg-neutral-50",+ isExtended ? "text-purple-500" : "text-orange-600",)}aria-label={isExtendeddiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/ModelToggleButton.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/ModelToggleButton.tsxindex 68ec4d5fac..3db8f758b4 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/ModelToggleButton.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/ModelToggleButton.tsx@@ -25,9 +25,7 @@ export function ModelToggleButton({ model, onToggle }: Props) {onClick={onToggle}className={cn("inline-flex h-9 items-center justify-center gap-1 rounded-full border border-neutral-200 bg-white px-2.5 text-xs font-medium shadow-sm transition-colors hover:bg-neutral-50",- isAdvanced- ? "text-sky-900"- : "text-neutral-500 hover:text-neutral-700",+ isAdvanced ? "text-emerald-500" : "text-sky-600 hover:text-sky-700",)}aria-label={isAdvanced ? "Switch to Balanced model" : "Switch to Advanced model"diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/RecordingButton.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/RecordingButton.tsxindex f319f7680e..efba442807 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/RecordingButton.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatInput/components/RecordingButton.tsx@@ -28,7 +28,7 @@ export function RecordingButton({disabled={disabled}onClick={onClick}className={cn(- "border-0 bg-white text-zinc-500 hover:bg-zinc-50 hover:text-zinc-700",+ "border-zinc-300 bg-white text-zinc-500 hover:border-zinc-400 hover:bg-zinc-50 hover:text-zinc-700",disabled && "opacity-40",isRecording && "animate-pulse bg-red-500 text-white hover:bg-red-600",isTranscribing && "bg-zinc-100 text-zinc-400",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 81fdd5b093..fd4a41f12e 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@@ -11,6 +11,7 @@ import {} from "@/components/ai-elements/message";import { Button } from "@/components/atoms/Button/Button";import { LoadingSpinner } from "@/components/atoms/LoadingSpinner/LoadingSpinner";+import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { Clock } from "@phosphor-icons/react";import { FileUIPart, UIDataTypes, UIMessage, UITools } from "ai";import { useEffect, useLayoutEffect, useRef } from "react";@@ -26,6 +27,7 @@ import {type MessagePart,type RenderSegment,parseSpecialMarkers,+ shouldShowTaskListNotice,splitReasoningAndResponse,} from "./helpers";import { RESTORE_STALL_TIMEOUT_MS } from "../../restoreConstants";@@ -36,7 +38,9 @@ import { MessageAttachments } from "./components/MessageAttachments";import { MessagePartRenderer } from "./components/MessagePartRenderer";import { QueueBadge } from "./components/QueueBadge";import { StepsCollapse } from "./components/StepsCollapse";+import { TaskListNotice } from "./components/TaskListNotice";import { ThinkingIndicator } from "./components/ThinkingIndicator";+import { getLatestTaskList } from "../ContextPanel/components/ProgressTab/helpers";interface Props {messages: UIMessage<unknown, UIDataTypes, UITools>[];@@ -310,6 +314,15 @@ export function ChatMessagesContainer({filePattern,fileUrlBuilder,}: Props) {+ const isContextPanelEnabled = useGetFlag(Flag.ARTIFACTS);+ const latestTaskList = getLatestTaskList(messages);+ const isChatStreaming = status === "streaming" || status === "submitted";+ const hasActiveTaskList = shouldShowTaskListNotice({+ isContextPanelEnabled,+ isChatStreaming,+ latestTaskList,+ });+// Hide the container for one frame when messages first load so// StickToBottom can scroll to the bottom before the user sees it.const [settled, setSettled] = useState(false);@@ -466,7 +479,7 @@ export function ChatMessagesContainer({return (<Conversationkey={sessionID ?? "new"}- resize={settled ? "smooth" : "instant"}+ resize="instant"className={"min-h-0 flex-1 " +(hideForScroll@@ -475,7 +488,7 @@ export function ChatMessagesContainer({}><ConversationContent- className="flex min-h-full flex-1 flex-col gap-6 px-3 py-6"+ className="flex min-h-full flex-1 flex-col gap-6 px-6 py-4"style={bottomContentPadding? { paddingBottom: bottomContentPadding + 24 }@@ -558,7 +571,11 @@ export function ChatMessagesContainer({: null;return (- <Message from={message.role} key={message.id}>+ <Message+ from={message.role}+ key={message.id}+ data-message-id={message.id}+ ><MessageContentclassName={"text-[1rem] leading-relaxed " +@@ -667,6 +684,11 @@ export function ChatMessagesContainer({</Message>);})}+ {!readOnly && hasActiveTaskList && (+ <div className="px-1">+ <TaskListNotice />+ </div>+ )}{!readOnly && showIndicator && lastMessage?.role !== "assistant" && (<Message from="assistant"><MessageContent className="text-[1rem] leading-relaxed">diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsxindex a5398ed51b..935cb04ec3 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsx@@ -109,6 +109,7 @@ vi.mock("../helpers", () => ({}return { markerType: null };},+ shouldShowTaskListNotice: () => false,splitReasoningAndResponse: (parts: unknown[]) => ({reasoning: [],response: parts,diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/helpers.test.tsindex f24d9f7dee..e1aefe1c68 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/helpers.test.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/helpers.test.ts@@ -9,10 +9,12 @@ import {isReasoningToolPart,parseSpecialMarkers,resolveWorkspaceUrls,+ shouldShowTaskListNotice,splitReasoningAndResponse,} from "../helpers";import type { MessagePart } from "../helpers";import type { FileUIPart } from "ai";+import type { TodoItem } from "../../ContextPanel/components/ProgressTab/helpers";function textPart(text: string): MessagePart {return { type: "text", text } as MessagePart;@@ -768,3 +770,63 @@ describe("filePartToArtifactRef with custom pattern", () => {expect(url.match(WORKSPACE_FILE_PATTERN)?.[1]).toBe(FILE_ID);});});++describe("shouldShowTaskListNotice", () => {+ const activeTodos: TodoItem[] = [+ { content: "Step 1", status: "in_progress" },+ { content: "Step 2", status: "pending" },+ ] as TodoItem[];+ const completedTodos: TodoItem[] = [+ { content: "Step 1", status: "completed" },+ ] as TodoItem[];++ it("returns true when the flag, streaming and an in-progress task list all line up", () => {+ expect(+ shouldShowTaskListNotice({+ isContextPanelEnabled: true,+ isChatStreaming: true,+ latestTaskList: activeTodos,+ }),+ ).toBe(true);+ });++ it("returns false when the context panel is disabled", () => {+ expect(+ shouldShowTaskListNotice({+ isContextPanelEnabled: false,+ isChatStreaming: true,+ latestTaskList: activeTodos,+ }),+ ).toBe(false);+ });++ it("returns false when the chat is not streaming", () => {+ expect(+ shouldShowTaskListNotice({+ isContextPanelEnabled: true,+ isChatStreaming: false,+ latestTaskList: activeTodos,+ }),+ ).toBe(false);+ });++ it("returns false when there is no task list yet", () => {+ expect(+ shouldShowTaskListNotice({+ isContextPanelEnabled: true,+ isChatStreaming: true,+ latestTaskList: null,+ }),+ ).toBe(false);+ });++ it("returns false when every todo is already completed", () => {+ expect(+ shouldShowTaskListNotice({+ isContextPanelEnabled: true,+ isChatStreaming: true,+ latestTaskList: completedTodos,+ }),+ ).toBe(false);+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/AssistantMessageActions.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/AssistantMessageActions.tsxindex 2409a51bfb..b826a03350 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/AssistantMessageActions.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/AssistantMessageActions.tsx@@ -41,7 +41,7 @@ export function AssistantMessageActions({ message, sessionID }: Props) {return (<>- <MessageActions className="mt-1">+ <MessageActions className="mt-1 opacity-30 transition-opacity group-hover:opacity-100"><MessageActiontooltip="Copy"onClick={() => handleCopy(text)}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/CollapsedToolGroup.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/CollapsedToolGroup.tsxindex 31d54dea7f..dfb5b57443 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/CollapsedToolGroup.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/CollapsedToolGroup.tsx@@ -90,13 +90,13 @@ export function CollapsedToolGroup({ parts }: Props) {: `${parts.length} tool calls completed`;return (- <div className="py-1">+ <div className="py-1 text-xs opacity-50 transition-opacity group-hover:opacity-100"><buttontype="button"onClick={() => setExpanded(!expanded)}aria-expanded={expanded}aria-controls={panelId}- className="flex items-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground"+ className="flex items-center gap-1.5 !text-xs text-muted-foreground transition-colors hover:text-foreground"><CaretRightIconsize={12}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsxindex ff00d6d24f..bc4ab3cfd8 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/MessagePartRenderer.tsx@@ -236,6 +236,12 @@ export function MessagePartRenderer({case "tool-delete_folder":case "tool-move_agents_to_folder":return <FolderTool key={key} part={part as ToolUIPart} />;+ case "tool-TodoWrite":+ // Hidden inline — the chat shows a single persistent+ // "Progress shown in the sidebar" pill at the bottom of the message+ // list while any task is active. See `TaskListNotice` rendering in+ // `ChatMessagesContainer`.+ return null;default:// Render a generic tool indicator for SDK built-in// tools (Read, Glob, Grep, etc.) or any unrecognized tooldiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ReasoningCollapse.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ReasoningCollapse.tsxindex 53e01ba9a8..4b2b8aa322 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ReasoningCollapse.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ReasoningCollapse.tsx@@ -7,7 +7,7 @@ import {AccordionItem,} from "@/components/molecules/Accordion/Accordion";import { cn } from "@/lib/utils";-import { LightbulbIcon } from "@phosphor-icons/react";+import { CaretRightIcon, LightbulbIcon } from "@phosphor-icons/react";import * as AccordionPrimitive from "@radix-ui/react-accordion";import { useState } from "react";@@ -37,15 +37,25 @@ export function ReasoningCollapse({ children, isActive = false }: Props) {<AccordionPrimitive.Header className="flex"><AccordionPrimitive.TriggerclassName={cn(- "flex items-center gap-1.5 py-1 text-xs font-medium text-zinc-500 transition-colors hover:text-zinc-700 focus-visible:outline-none",+ "group flex items-center gap-1.5 py-1 font-sans text-sm font-medium text-zinc-500 transition-colors hover:text-zinc-700 focus-visible:outline-none",isActive && "animate-pulse",)}>- <LightbulbIcon size={14} weight="bold" className="shrink-0" />+ {isActive ? (+ <LightbulbIcon size={14} weight="bold" className="shrink-0" />+ ) : (+ // Once reasoning has finished streaming, swap the bulb for a+ // caret that rotates to reflect the expanded/collapsed state.+ <CaretRightIcon+ size={14}+ weight="bold"+ className="shrink-0 transition-transform group-data-[state=open]:rotate-90"+ />+ )}Reasoning</AccordionPrimitive.Trigger></AccordionPrimitive.Header>- <AccordionContent className="pb-1 pt-0 text-xs text-zinc-500 [&_pre]:m-0 [&_pre]:whitespace-pre-wrap [&_pre]:bg-transparent [&_pre]:p-0 [&_pre]:text-xs [&_pre]:text-zinc-500">+ <AccordionContent className="pb-1 pt-0 font-sans text-sm text-zinc-500 [&_pre]:m-0 [&_pre]:whitespace-pre-wrap [&_pre]:bg-transparent [&_pre]:p-0 [&_pre]:font-sans [&_pre]:text-sm [&_pre]:text-zinc-500">{children}<Buttonvariant="secondary"diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/StepsCollapse.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/StepsCollapse.tsxindex a5460e3f60..d937351a0a 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/StepsCollapse.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/StepsCollapse.tsx@@ -13,7 +13,7 @@ export function StepsCollapse({ children }: Props) {<Dialog.Trigger><buttontype="button"- className="flex items-center gap-1 text-xs text-zinc-500 transition-colors hover:text-zinc-700"+ className="flex items-center gap-1 !text-xs text-zinc-500 transition-colors hover:text-zinc-700"><ListBulletsIcon size={12} weight="bold" /><span>Show steps</span>diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/StoppedTaskCard.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/StoppedTaskCard.tsxindex 53cceb2628..406620622d 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/StoppedTaskCard.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/StoppedTaskCard.tsx@@ -4,7 +4,7 @@ import { Text } from "@/components/atoms/Text/Text";export function StoppedTaskCard() {return (- <div className="my-2 flex items-start gap-3 rounded-medium border border-zinc-200 bg-zinc-50 p-4">+ <div className="my-2 flex items-start gap-3 rounded-medium bg-stone-50 p-4"><div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-small bg-purple-50"><SquareIcon size={16} weight="fill" className="text-purple-500" /></div>diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/TaskListNotice.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/TaskListNotice.tsxnew file mode 100644index 0000000000..69fabb3fd3--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/TaskListNotice.tsx@@ -0,0 +1,22 @@+"use client";++import { ArrowRightIcon, ListChecksIcon } from "@phosphor-icons/react";+import { useCopilotUIStore } from "../../../store";++export function TaskListNotice() {+ const openContextPanelForProgress = useCopilotUIStore(+ (s) => s.openContextPanelForProgress,+ );++ return (+ <button+ type="button"+ onClick={openContextPanelForProgress}+ className="inline-flex w-fit items-center gap-2 rounded-full border border-zinc-200 bg-white px-3 py-1.5 text-xs text-zinc-600 transition-colors hover:border-zinc-300 hover:bg-zinc-50"+ >+ <ListChecksIcon size={14} className="text-blue-500" />+ <span>Progress shown in the sidebar</span>+ <ArrowRightIcon size={12} className="text-zinc-400" />+ </button>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThinkingIndicator.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThinkingIndicator.tsxindex 97e3b95c6e..b0d31ec391 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThinkingIndicator.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThinkingIndicator.tsx@@ -97,7 +97,7 @@ export function ThinkingIndicator({const transitionOpacity = statusMessage ? 1 : visible ? 1 : 0;return (- <span className="inline-flex items-center gap-1.5 text-neutral-500">+ <span className="inline-flex items-center gap-1.5 text-sm text-neutral-500"><ScaleLoader size={16} /><spanclassName="transition-opacity duration-300"diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/__tests__/ReasoningCollapse.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/__tests__/ReasoningCollapse.test.tsxindex 3792675b43..ab62663b72 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/__tests__/ReasoningCollapse.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/__tests__/ReasoningCollapse.test.tsx@@ -10,7 +10,10 @@ import { ReasoningCollapse } from "../ReasoningCollapse";vi.mock("@phosphor-icons/react", () => ({LightbulbIcon: ({ className }: { className?: string }) => (- <span data-testid="reasoning-icon" className={className} />+ <span data-testid="reasoning-bulb-icon" className={className} />+ ),+ CaretRightIcon: ({ className }: { className?: string }) => (+ <span data-testid="reasoning-caret-icon" className={className} />),}));@@ -19,7 +22,7 @@ describe("ReasoningCollapse", () => {cleanup();});- it("renders a collapsed 'Reasoning' trigger with a bulb icon", () => {+ it("renders a collapsed 'Reasoning' trigger", () => {render(<ReasoningCollapse><span data-testid="reasoning-body">secret thoughts</span>@@ -27,11 +30,32 @@ describe("ReasoningCollapse", () => {);expect(screen.getByRole("button", { name: /reasoning/i })).toBeDefined();- expect(screen.getByTestId("reasoning-icon")).toBeDefined();// Collapsed by default: content should not be visible.expect(screen.queryByTestId("reasoning-body")).toBeNull();});+ it("shows the pulsing bulb icon while actively reasoning", () => {+ render(+ <ReasoningCollapse isActive>+ <span>thought</span>+ </ReasoningCollapse>,+ );++ expect(screen.getByTestId("reasoning-bulb-icon")).toBeDefined();+ expect(screen.queryByTestId("reasoning-caret-icon")).toBeNull();+ });++ it("swaps the bulb for a caret once reasoning has ended", () => {+ render(+ <ReasoningCollapse>+ <span>thought</span>+ </ReasoningCollapse>,+ );++ expect(screen.getByTestId("reasoning-caret-icon")).toBeDefined();+ expect(screen.queryByTestId("reasoning-bulb-icon")).toBeNull();+ });+it("applies a pulse animation class to the trigger ONLY while active", () => {const inactive = render(<ReasoningCollapse>@@ -53,19 +77,6 @@ describe("ReasoningCollapse", () => {).toContain("animate-pulse");});- it("renders no chevron / extra svg inside the trigger", () => {- render(- <ReasoningCollapse>- <span>thought</span>- </ReasoningCollapse>,- );-- const trigger = screen.getByRole("button", { name: /reasoning/i });- // The bulb icon is mocked to a <span>; the previous design appended a- // <ChevronDown /> svg. After the redesign no svg should remain.- expect(trigger.querySelector("svg")).toBeNull();- });-it("reveals the reasoning body when the trigger is clicked", async () => {render(<ReasoningCollapse>diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.tsindex f0db0ae54f..68ce6d351d 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/helpers.ts@@ -4,6 +4,22 @@ import { parseWorkspaceURI } from "@/lib/workspace-uri";import { FileUIPart, ToolUIPart, UIDataTypes, UIMessage, UITools } from "ai";import { isCorruptedCardToolPart } from "../../helpers/toolOutput";import type { ArtifactRef } from "../../store";+import type { TodoItem } from "../ContextPanel/components/ProgressTab/helpers";++export function shouldShowTaskListNotice({+ isContextPanelEnabled,+ isChatStreaming,+ latestTaskList,+}: {+ isContextPanelEnabled: boolean;+ isChatStreaming: boolean;+ latestTaskList: TodoItem[] | null;+}): boolean {+ if (!isContextPanelEnabled || !isChatStreaming || !latestTaskList) {+ return false;+ }+ return latestTaskList.some((t) => t.status !== "completed");+}export type MessagePart = UIMessage<unknown,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.tsxindex 6f23c30870..abad9e0cd9 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx@@ -212,7 +212,7 @@ export function ChatSidebar() {<Sidebarvariant="inset"collapsible="icon"- className="!top-[50px] !h-[calc(100vh-50px)] border-r border-zinc-100 px-0"+ 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@@ -259,7 +259,7 @@ export function ChatSidebar() {</SidebarHeader>)}{!isCollapsed && (- <SidebarHeader className="shrink-0 px-4 pb-3 pt-3 shadow-[0_4px_6px_-1px_rgba(0,0,0,0.05)]">+ <SidebarHeader className="shrink-0 px-4 pb-3 pt-3"><motion.divinitial={{ opacity: 0 }}animate={{ opacity: 1 }}@@ -332,171 +332,178 @@ export function ChatSidebar() {No conversations yet</p>) : (- sessions?.map((session) => (- <div- key={session.id}- className={cn(- "group relative w-full rounded-lg transition-colors",- session.id === sessionId- ? "bg-zinc-100"- : "hover:bg-zinc-50",- )}- >- {editingSessionId === session.id ? (- <div className="px-3 py-2.5">- <input- ref={renameInputRef}- type="text"- aria-label="Rename chat"- value={editingTitle}- onChange={(e) => setEditingTitle(e.target.value)}- onKeyDown={(e) => {- if (e.key === "Enter") {- e.currentTarget.blur();- } else if (e.key === "Escape") {- renameCancelledRef.current = true;- setEditingSessionId(null);- }- }}- onBlur={() => {- if (renameCancelledRef.current) {- renameCancelledRef.current = false;- return;- }- handleRenameSubmit(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={() => handleSelectSession(session.id)}- className={cn(- "w-full px-3 py-2.5 text-left",- exportingSessionIds.has(session.id)- ? "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}- isActive={session.id === sessionId}- chatStatus={session.chat_status}- 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- }- />- </button>- )}- {exportingSessionIds.has(session.id) && (- <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" />- <DownloadSimpleIcon className="absolute inset-0 m-auto h-3.5 w-3.5" />+ sessions?.map((session, index) => {+ const isActive = session.id === sessionId;+ const nextIsActive = sessions?.[index + 1]?.id === sessionId;+ return (+ <div+ key={session.id}+ 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",+ nextIsActive && "!border-b-0",+ ),+ )}+ >+ {editingSessionId === session.id ? (+ <div className="px-3 py-2.5">+ <input+ ref={renameInputRef}+ type="text"+ aria-label="Rename chat"+ value={editingTitle}+ onChange={(e) => setEditingTitle(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === "Enter") {+ e.currentTarget.blur();+ } else if (e.key === "Escape") {+ renameCancelledRef.current = true;+ setEditingSessionId(null);+ }+ }}+ onBlur={() => {+ if (renameCancelledRef.current) {+ renameCancelledRef.current = false;+ return;+ }+ handleRenameSubmit(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>- </div>- )}- {editingSessionId !== session.id && (- <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"- >- <DotsThree className="h-4 w-4" />- </button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem- onClick={(e) =>- handleRenameClick(e, session.id, session.title)+ ) : (+ <button+ onClick={() => handleSelectSession(session.id)}+ className={cn(+ "w-full px-3 py-2.5 text-left",+ exportingSessionIds.has(session.id)+ ? "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>}- >- <PencilSimpleIcon className="mr-2 h-4 w-4" />- Rename- </DropdownMenuItem>- <DropdownMenuItem- onClick={(e) =>- handleExportClick(e, session.id, session.title)+ updatedAt={session.updated_at}+ sourcePlatform={session.source_platform}+ isActive={session.id === sessionId}+ chatStatus={session.chat_status}+ showProcessing={+ !!session.is_processing &&+ shouldShowSessionProcessingIndicator({+ sessionId: session.id,+ currentSessionId: sessionId,+ isProcessing: session.is_processing,+ hasCompletedIndicator: completedSessionIDs.has(+ session.id,+ ),+ needsReload: !!sessionNeedsReload[session.id],+ })}- onSelect={(e) => {- if (exportingSessionIds.has(session.id))- e.preventDefault();- }}- disabled={exportingSessionIds.has(session.id)}- >- {exportingSessionIds.has(session.id) ? (- <CircleNotch- className="mr-2 h-4 w-4 animate-spin"- weight="bold"- />- ) : (- <DownloadSimpleIcon className="mr-2 h-4 w-4" />- )}- {exportingSessionIds.has(session.id)- ? "Exporting…"- : "Export chat"}- </DropdownMenuItem>- {chatSharingEnabled && (+ showCompleted={+ completedSessionIDs.has(session.id) &&+ session.id !== sessionId+ }+ />+ </button>+ )}+ {exportingSessionIds.has(session.id) && (+ <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" />+ <DownloadSimpleIcon className="absolute inset-0 m-auto h-3.5 w-3.5" />+ </div>+ </div>+ )}+ {editingSessionId !== session.id && (+ <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"+ >+ <DotsThree className="h-4 w-4" />+ </button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem+ onClick={(e) =>+ handleRenameClick(e, session.id, session.title)+ }+ >+ <PencilSimpleIcon className="mr-2 h-4 w-4" />+ Rename+ </DropdownMenuItem><DropdownMenuItem- onClick={(e) => {- e.stopPropagation();- setSharingSessionId(session.id);+ onClick={(e) =>+ handleExportClick(e, session.id, session.title)+ }+ onSelect={(e) => {+ if (exportingSessionIds.has(session.id))+ e.preventDefault();}}+ disabled={exportingSessionIds.has(session.id)}>- <ShareNetworkIcon className="mr-2 h-4 w-4" />- Share chat+ {exportingSessionIds.has(session.id) ? (+ <CircleNotch+ className="mr-2 h-4 w-4 animate-spin"+ weight="bold"+ />+ ) : (+ <DownloadSimpleIcon className="mr-2 h-4 w-4" />+ )}+ {exportingSessionIds.has(session.id)+ ? "Exporting…"+ : "Export chat"}</DropdownMenuItem>- )}- <DropdownMenuItem- onClick={(e) =>- handleDeleteClick(e, session.id, session.title)- }- disabled={isDeleting}- className="text-red-600 focus:bg-red-50 focus:text-red-600"- >- <TrashIcon className="mr-2 h-4 w-4" />- Delete chat- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- )}- </div>- ))+ {chatSharingEnabled && (+ <DropdownMenuItem+ onClick={(e) => {+ e.stopPropagation();+ setSharingSessionId(session.id);+ }}+ >+ <ShareNetworkIcon className="mr-2 h-4 w-4" />+ Share chat+ </DropdownMenuItem>+ )}+ <DropdownMenuItem+ onClick={(e) =>+ handleDeleteClick(e, session.id, session.title)+ }+ disabled={isDeleting}+ className="text-red-600 focus:bg-red-50 focus:text-red-600"+ >+ <TrashIcon className="mr-2 h-4 w-4" />+ Delete chat+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ )}+ </div>+ );+ }))}{hasMore && (<Buttondiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsxnew file mode 100644index 0000000000..ab117add1b--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsx@@ -0,0 +1,107 @@+"use client";++import {+ Sheet,+ SheetContent,+ SheetHeader,+ SheetTitle,+} from "@/components/ui/sheet";+import { cn } from "@/lib/utils";+import { XIcon } from "@phosphor-icons/react";+import { MAX_CONTEXT_PANEL_WIDTH, MIN_CONTEXT_PANEL_WIDTH } from "../../store";+import { PanelResizeHandle } from "../PanelResizeHandle";+import { FilesTab } from "./components/FilesTab/FilesTab";+import { useSessionFiles } from "./components/FilesTab/useSessionFiles";+import { ProgressTab } from "./components/ProgressTab/ProgressTab";+import { TabSwitcher } from "./components/TabSwitcher";+import { useContextPanel } from "./useContextPanel";++interface Props {+ sessionId: string | null;+ mobile?: boolean;+}++export function ContextPanel({ sessionId, mobile }: Props) {+ const {+ isOpen,+ activeTab,+ showExpanded,+ setActiveTab,+ closeArtifactPanel,+ contextPanelWidth,+ setContextPanelWidth,+ } = useContextPanel();+ const { uploaded, generated } = useSessionFiles(sessionId);+ const filesCount = uploaded.length + generated.length;++ const tabs = (+ <div className="flex min-h-0 flex-1 flex-col">+ <div+ className={cn(+ "flex items-center justify-between gap-2 p-2",+ mobile && "mt-12",+ )}+ >+ <TabSwitcher+ activeTab={activeTab}+ filesCount={filesCount}+ onChange={setActiveTab}+ />+ {!mobile && (+ <button+ type="button"+ onClick={closeArtifactPanel}+ title="Close"+ aria-label="Close workspace panel"+ className="rounded p-1.5 text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-700"+ >+ <XIcon size={16} />+ </button>+ )}+ </div>+ <div className="flex min-h-0 flex-1 flex-col">+ {activeTab === "progress" && <ProgressTab sessionId={sessionId} />}+ {activeTab === "files" && <FilesTab sessionId={sessionId} />}+ </div>+ </div>+ );++ if (mobile) {+ return (+ <Sheet+ open={isOpen}+ onOpenChange={(open) => !open && closeArtifactPanel()}+ >+ <SheetContent+ side="right"+ className="flex w-full flex-col p-0 sm:max-w-full"+ >+ <SheetHeader className="sr-only">+ <SheetTitle>Workspace</SheetTitle>+ </SheetHeader>+ {tabs}+ </SheetContent>+ </Sheet>+ );+ }++ if (!showExpanded) return null;++ return (+ <div+ data-context-panel+ style={{ width: contextPanelWidth }}+ className="relative flex h-full shrink-0 flex-col border-l border-l-[#80808017] bg-sidebar"+ >+ <PanelResizeHandle+ panelSelector="[data-context-panel]"+ onWidthChange={setContextPanelWidth}+ minWidth={MIN_CONTEXT_PANEL_WIDTH}+ maxWidth={MAX_CONTEXT_PANEL_WIDTH}+ />+ <div className="flex min-h-0 w-full flex-1 flex-col overflow-hidden">+ {tabs}+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelAutoOpen.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelAutoOpen.tsxnew file mode 100644index 0000000000..048c691c2c--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelAutoOpen.tsx@@ -0,0 +1,16 @@+"use client";++import { useAutoOpenForFiles } from "./useAutoOpenForFiles";+import { useAutoOpenForProgress } from "./useAutoOpenForProgress";+import { useCollapseContextPanelOnSession } from "./useCollapseContextPanelOnSession";++interface Props {+ sessionId: string | null;+}++export function ContextPanelAutoOpen({ sessionId }: Props) {+ useCollapseContextPanelOnSession(sessionId);+ useAutoOpenForFiles(sessionId);+ useAutoOpenForProgress(sessionId);+ return null;+}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.tsxnew file mode 100644index 0000000000..3aec234e34--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelToggle.tsx@@ -0,0 +1,30 @@+"use client";++import { Button } from "@/components/ui/button";+import { FolderIcon } from "@phosphor-icons/react";+import { useCopilotUIStore } from "../../store";++export function ContextPanelToggle() {+ const isOpen = useCopilotUIStore((s) => s.artifactPanel.isOpen);+ const hasArtifact = useCopilotUIStore(+ (s) => s.artifactPanel.activeArtifact != null,+ );+ const toggleContextPanel = useCopilotUIStore((s) => s.toggleContextPanel);++ if (isOpen || hasArtifact) return null;++ return (+ <div className="flex shrink-0 items-start p-3">+ <Button+ type="button"+ variant="ghost"+ size="icon"+ onClick={toggleContextPanel}+ aria-label="Open workspace panel"+ aria-pressed={false}+ >+ <FolderIcon className="!size-5" />+ </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.tsxnew file mode 100644index 0000000000..8fe8a53ad5--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanel.test.tsx@@ -0,0 +1,64 @@+import { beforeEach, describe, expect, test } from "vitest";+import { render, screen } from "@/tests/integrations/test-utils";+import { server } from "@/mocks/mock-server";+import { getListWorkspaceFilesMockHandler200 } from "@/app/api/__generated__/endpoints/workspace/workspace.msw";+import { useCopilotUIStore } from "../../../store";+import { ContextPanel } from "../ContextPanel";++beforeEach(() => {+ server.use(+ getListWorkspaceFilesMockHandler200({+ files: [],+ offset: 0,+ has_more: false,+ }),+ );+ useCopilotUIStore.setState((s) => ({+ artifactPanel: {+ ...s.artifactPanel,+ isOpen: true,+ activeArtifact: null,+ activeTab: "files",+ },+ }));+});++describe("ContextPanel", () => {+ test("renders the tab switcher and active tab when open with no artifact", async () => {+ render(<ContextPanel sessionId="session-1" />);+ expect(await screen.findByRole("tablist")).toBeDefined();+ expect(screen.getByRole("tab", { name: /^Files \(\d+\)$/ })).toBeDefined();+ expect(await screen.findByText(/No files yet/i)).toBeDefined();+ });++ test("hides itself while an artifact is previewing (artifact takes over the region)", () => {+ useCopilotUIStore.setState((s) => ({+ artifactPanel: {+ ...s.artifactPanel,+ isOpen: true,+ activeArtifact: {+ id: "f1",+ title: "doc.md",+ mimeType: "text/markdown",+ sourceUrl: "/api/proxy/api/workspace/files/f1/download",+ origin: "agent",+ },+ },+ }));+ const { container } = render(<ContextPanel sessionId="session-1" />);+ expect(container.querySelector("[data-context-panel]")).toBeNull();+ expect(screen.queryByRole("tablist")).toBeNull();+ });++ test("renders nothing when closed", () => {+ useCopilotUIStore.setState((s) => ({+ artifactPanel: {+ ...s.artifactPanel,+ isOpen: false,+ activeArtifact: null,+ },+ }));+ const { container } = render(<ContextPanel sessionId="session-1" />);+ expect(container.querySelector("[data-context-panel]")).toBeNull();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelAutoOpen.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelAutoOpen.test.tsxnew file mode 100644index 0000000000..363a4a95ff--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelAutoOpen.test.tsx@@ -0,0 +1,50 @@+import { beforeEach, describe, expect, test } from "vitest";+import { render, waitFor } from "@/tests/integrations/test-utils";+import { server } from "@/mocks/mock-server";+import { getListWorkspaceFilesMockHandler200 } from "@/app/api/__generated__/endpoints/workspace/workspace.msw";+import type { ListFilesResponse } from "@/app/api/__generated__/models/listFilesResponse";+import { useCopilotUIStore } from "../../../store";+import { ContextPanelAutoOpen } from "../ContextPanelAutoOpen";++const SESSION = "session-1";++function withFiles(): ListFilesResponse {+ return {+ files: [+ {+ 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",+ },+ ],+ offset: 0,+ has_more: false,+ };+}++describe("ContextPanelAutoOpen", () => {+ beforeEach(() => {+ useCopilotUIStore.getState().resetAutoOpenState?.();+ useCopilotUIStore.setState((s) => ({+ artifactPanel: {+ ...s.artifactPanel,+ isOpen: false,+ activeArtifact: null,+ },+ }));+ });++ test("opens the panel to the Files tab when the session has files", async () => {+ server.use(getListWorkspaceFilesMockHandler200(withFiles()));+ render(<ContextPanelAutoOpen sessionId={SESSION} />);+ await waitFor(() =>+ expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(true),+ );+ expect(useCopilotUIStore.getState().artifactPanel.activeTab).toBe("files");+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/FilesTab.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/FilesTab.test.tsxnew file mode 100644index 0000000000..20202fc7f0--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/FilesTab.test.tsx@@ -0,0 +1,82 @@+import { describe, expect, test } from "vitest";+import {+ fireEvent,+ render,+ screen,+ waitFor,+ within,+} from "@/tests/integrations/test-utils";+import { server } from "@/mocks/mock-server";+import {+ getDeleteWorkspaceFileMockHandler200,+ getListWorkspaceFilesMockHandler200,+} from "@/app/api/__generated__/endpoints/workspace/workspace.msw";+import type { ListFilesResponse } from "@/app/api/__generated__/models/listFilesResponse";+import { FilesTab } from "../components/FilesTab/FilesTab";++const SESSION = "session-1";++function listResponse(): ListFilesResponse {+ return {+ files: [+ {+ id: "aaaaaaaa-0000-0000-0000-000000000001",+ name: "uploaded.png",+ path: "/sessions/session-1/uploaded.png",+ mime_type: "image/png",+ size_bytes: 1024,+ metadata: { origin: "user-upload" },+ origin: "uploaded",+ created_at: "2026-05-20T10:00:00Z",+ },+ {+ id: "bbbbbbbb-0000-0000-0000-000000000002",+ 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",+ },+ ],+ offset: 0,+ has_more: false,+ };+}++describe("FilesTab", () => {+ test("renders Uploaded and Generated sections from the API", async () => {+ server.use(getListWorkspaceFilesMockHandler200(listResponse()));+ render(<FilesTab sessionId={SESSION} />);+ expect(await screen.findByText("uploaded.png")).toBeDefined();+ expect(await screen.findByText("result.csv")).toBeDefined();+ expect(screen.getByRole("heading", { name: /Uploaded/i })).toBeDefined();+ expect(screen.getByRole("heading", { name: /Generated/i })).toBeDefined();+ });++ test("shows empty state when the session has no files", async () => {+ server.use(+ getListWorkspaceFilesMockHandler200({+ files: [],+ offset: 0,+ has_more: false,+ }),+ );+ render(<FilesTab sessionId={SESSION} />);+ expect(await screen.findByText(/No files yet/i)).toBeDefined();+ });++ test("delete is offered for generated files only and confirms via dialog", async () => {+ server.use(getListWorkspaceFilesMockHandler200(listResponse()));+ server.use(getDeleteWorkspaceFileMockHandler200());+ render(<FilesTab sessionId={SESSION} />);+ await screen.findByText("result.csv");+ expect(screen.queryByLabelText("Delete uploaded.png")).toBeNull();+ fireEvent.click(screen.getByLabelText("Delete result.csv"));+ const dialog = await screen.findByRole("dialog");+ const confirm = within(dialog).getByRole("button", { name: /^Delete$/ });+ fireEvent.click(confirm);+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/artifact-sidebar.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/artifact-sidebar.test.tsxnew file mode 100644index 0000000000..f38815b58e--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/artifact-sidebar.test.tsx@@ -0,0 +1,137 @@+import React from "react";+import { getListWorkspaceFilesMockHandler200 } from "@/app/api/__generated__/endpoints/workspace/workspace.msw";+import { server } from "@/mocks/mock-server";+import {+ cleanup,+ fireEvent,+ render,+ screen,+} from "@/tests/integrations/test-utils";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import type { ArtifactRef } from "../../../store";+import { useCopilotUIStore } from "../../../store";+import { ArtifactPanel } from "../../ArtifactPanel/ArtifactPanel";+import { ContextPanel } from "../ContextPanel";++const ARTIFACT_ID = "11111111-0000-0000-0000-000000000000";+const ARTIFACT_SOURCE_URL = `/api/proxy/api/workspace/files/${ARTIFACT_ID}/download`;++function makeArtifact(): ArtifactRef {+ return {+ id: ARTIFACT_ID,+ title: "notes.txt",+ mimeType: "text/plain",+ sourceUrl: ARTIFACT_SOURCE_URL,+ origin: "agent",+ };+}++function resetCopilotStore() {+ useCopilotUIStore.setState((s) => ({+ artifactPanel: {+ ...s.artifactPanel,+ isOpen: true,+ activeArtifact: null,+ history: [],+ activeTab: "files",+ },+ }));+}++// framer-motion's AnimatePresence/motion mount/exit animations make panel+// swaps async and flaky in jsdom. Render them as plain divs so the swap is+// synchronous — same approach as ChatContainer.test.tsx.+vi.mock("framer-motion", () => ({+ AnimatePresence: ({ children }: { children: React.ReactNode }) => (+ <>{children}</>+ ),+ motion: {+ div: React.forwardRef(function MotionDiv(+ props: Record<string, unknown>,+ ref: React.Ref<HTMLDivElement>,+ ) {+ const {+ children,+ initial: _initial,+ animate: _animate,+ exit: _exit,+ transition: _transition,+ ...rest+ } = props as {+ children?: React.ReactNode;+ initial?: unknown;+ animate?: unknown;+ exit?: unknown;+ transition?: unknown;+ [key: string]: unknown;+ };+ return (+ <div ref={ref} {...rest}>+ {children}+ </div>+ );+ }),+ },+}));++function RightRegion({ sessionId }: { sessionId: string }) {+ return (+ <div className="flex">+ <ContextPanel sessionId={sessionId} />+ <ArtifactPanel />+ </div>+ );+}++describe("Context/Artifact panel (desktop)", () => {+ beforeEach(() => {+ server.use(+ getListWorkspaceFilesMockHandler200({+ files: [],+ offset: 0,+ has_more: false,+ }),+ );+ // The text artifact fetches its content from the download proxy URL,+ // which isn't an Orval endpoint — stub global fetch for that URL only, and+ // throw on anything else so a stray fetch fails loudly instead of being+ // silently masked.+ vi.stubGlobal(+ "fetch",+ vi.fn(async (input: RequestInfo | URL) => {+ const url = typeof input === "string" ? input : input.toString();+ if (url.includes(ARTIFACT_SOURCE_URL)) {+ return new Response("hello world", {+ status: 200,+ headers: { "Content-Type": "text/plain" },+ });+ }+ throw new Error(`Unexpected fetch in test: ${url}`);+ }),+ );+ resetCopilotStore();+ });++ afterEach(() => {+ cleanup();+ resetCopilotStore();+ vi.clearAllMocks();+ vi.unstubAllGlobals();+ });++ it("shows the artifact panel when an artifact opens and returns to the context panel on close", async () => {+ useCopilotUIStore.getState().openArtifact(makeArtifact());++ render(<RightRegion sessionId="session-1" />);++ // Artifact open: the artifact takes over the right region — its header is+ // visible and the Context Panel (tabs) is hidden.+ expect(await screen.findByText("notes.txt")).toBeDefined();+ expect(screen.queryByRole("tablist")).toBeNull();++ // Close the artifact → it disappears and the Context Panel is shown.+ fireEvent.click(screen.getByRole("button", { name: "Close" }));+ expect(await screen.findByRole("tablist")).toBeDefined();+ expect(screen.queryByText("notes.txt")).toBeNull();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/FilesTab.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/FilesTab.tsxnew file mode 100644index 0000000000..35c0b7d3b5--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/FilesTab.tsx@@ -0,0 +1,203 @@+"use client";++import { useQueryClient } from "@tanstack/react-query";+import { useState } from "react";+import {+ getListWorkspaceFilesQueryKey,+ useDeleteWorkspaceFile,+} from "@/app/api/__generated__/endpoints/workspace/workspace";+import { Button } from "@/components/atoms/Button/Button";+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/components/atoms/Tooltip/BaseTooltip";+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";+import { toast } from "@/components/molecules/Toast/use-toast";+import { Skeleton } from "@/components/ui/skeleton";+import { DownloadSimpleIcon } from "@phosphor-icons/react";+import { useCopilotUIStore } from "../../../../store";+import { downloadArtifact } from "../../../ArtifactPanel/downloadArtifact";+import { DeleteFileDialog } from "./components/DeleteFileDialog";+import { FileRow } from "./components/FileRow";+import { downloadFilesAsZip, fileItemToArtifactRef } from "./helpers";+import { useSessionFiles, type SessionFile } from "./useSessionFiles";++interface Props {+ sessionId: string | null;+}++export function FilesTab({ sessionId }: Props) {+ const queryClient = useQueryClient();+ const openArtifact = useCopilotUIStore((s) => s.openArtifact);+ const { uploaded, generated, isLoading, isError, isEmpty } =+ useSessionFiles(sessionId);+ const [pendingDelete, setPendingDelete] = useState<SessionFile | null>(null);+ const [isZipping, setIsZipping] = useState(false);++ const { mutateAsync: deleteFile, isPending: isDeleting } =+ useDeleteWorkspaceFile({+ mutation: {+ onSuccess: () => {+ queryClient.invalidateQueries({+ queryKey: getListWorkspaceFilesQueryKey({+ session_id: sessionId ?? undefined,+ }),+ });+ toast({ title: "File deleted", variant: "success" });+ },+ onError: () =>+ toast({ title: "Failed to delete file", variant: "destructive" }),+ },+ });++ function handleOpen(file: SessionFile) {+ openArtifact(fileItemToArtifactRef(file.item));+ }++ function handleDownload(file: SessionFile) {+ downloadArtifact(fileItemToArtifactRef(file.item)).catch(() =>+ toast({ title: "Download failed", variant: "destructive" }),+ );+ }++ async function handleConfirmDelete() {+ if (!pendingDelete) return;+ try {+ await deleteFile({ fileId: pendingDelete.item.id });+ } catch {+ // onError toast already surfaces the failure; swallow so the await+ // settles and the dialog closes instead of staying open on rejection.+ } finally {+ setPendingDelete(null);+ }+ }++ async function handleDownloadAll() {+ const all = [...uploaded, ...generated].map((f) => ({+ id: f.item.id,+ name: f.item.name,+ }));+ if (all.length === 0) return;+ setIsZipping(true);+ try {+ await downloadFilesAsZip(all);+ } catch {+ toast({ title: "Download all failed", variant: "destructive" });+ } finally {+ setIsZipping(false);+ }+ }++ if (isLoading) {+ return (+ <div className="flex flex-col gap-2 p-3">+ <Skeleton className="h-10 w-full" />+ <Skeleton className="h-10 w-full" />+ <Skeleton className="h-10 w-full" />+ </div>+ );+ }++ if (isError) {+ return (+ <div className="p-3">+ <ErrorCard+ isSuccess={false}+ context="files"+ responseError={{ message: "Failed to load files." }}+ />+ </div>+ );+ }++ if (isEmpty || (uploaded.length === 0 && generated.length === 0)) {+ return (+ <div className="flex h-full flex-1 items-center justify-center p-6">+ <p className="text-center text-sm text-zinc-400">+ No files yet. Upload files or ask Autopilot to create something.+ </p>+ </div>+ );+ }++ const downloadAllButton = (+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="ghost"+ size="icon"+ onClick={handleDownloadAll}+ loading={isZipping}+ aria-label="Download all"+ className="h-7 !min-w-0 !p-1"+ >+ <DownloadSimpleIcon size={16} />+ </Button>+ </TooltipTrigger>+ <TooltipContent>Download all</TooltipContent>+ </Tooltip>+ );++ return (+ <div className="flex min-h-0 flex-1 flex-col">+ <div className="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto px-6 py-3">+ {uploaded.length > 0 && (+ <FileSection+ title="Uploaded files"+ action={generated.length === 0 ? downloadAllButton : null}+ >+ {uploaded.map((file) => (+ <FileRow+ key={file.item.id}+ file={file}+ onOpen={handleOpen}+ onDownload={handleDownload}+ onRequestDelete={setPendingDelete}+ />+ ))}+ </FileSection>+ )}+ {generated.length > 0 && (+ <FileSection title="Generated files" action={downloadAllButton}>+ {generated.map((file) => (+ <FileRow+ key={file.item.id}+ file={file}+ onOpen={handleOpen}+ onDownload={handleDownload}+ onRequestDelete={setPendingDelete}+ />+ ))}+ </FileSection>+ )}+ </div>+ <DeleteFileDialog+ fileName={pendingDelete?.item.name ?? null}+ isDeleting={isDeleting}+ onConfirm={handleConfirmDelete}+ onCancel={() => setPendingDelete(null)}+ />+ </div>+ );+}++function FileSection({+ title,+ action,+ children,+}: {+ title: string;+ action?: React.ReactNode;+ children: React.ReactNode;+}) {+ return (+ <section>+ <div className="flex items-center justify-between pb-1">+ <h3 className="text-sm font-medium text-zinc-900">{title}</h3>+ {action}+ </div>+ <div className="flex flex-col">{children}</div>+ </section>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/components/DeleteFileDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/components/DeleteFileDialog.tsxnew file mode 100644index 0000000000..5b86c7c93b--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/components/DeleteFileDialog.tsx@@ -0,0 +1,52 @@+import { Button } from "@/components/atoms/Button/Button";+import { Text } from "@/components/atoms/Text/Text";+import { Dialog } from "@/components/molecules/Dialog/Dialog";++interface Props {+ fileName: string | null;+ isDeleting: boolean;+ onConfirm: () => void;+ onCancel: () => void;+}++export function DeleteFileDialog({+ fileName,+ isDeleting,+ onConfirm,+ onCancel,+}: Props) {+ return (+ <Dialog+ title="Delete file"+ styling={{ maxWidth: "30rem", minWidth: "auto" }}+ controlled={{+ isOpen: !!fileName,+ set: async (open) => {+ if (!open && !isDeleting) onCancel();+ },+ }}+ >+ <Dialog.Content>+ <Text variant="body">+ Delete{" "}+ <Text variant="body-medium" as="span">+ "{fileName}"+ </Text>+ ? This removes it from the workspace and cannot be undone.+ </Text>+ <Dialog.Footer>+ <Button variant="secondary" onClick={onCancel} disabled={isDeleting}>+ Cancel+ </Button>+ <Button+ variant="destructive"+ onClick={onConfirm}+ loading={isDeleting}+ >+ Delete+ </Button>+ </Dialog.Footer>+ </Dialog.Content>+ </Dialog>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/components/FileRow.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/components/FileRow.tsxnew file mode 100644index 0000000000..ab13d18860--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/components/FileRow.tsx@@ -0,0 +1,82 @@+import { Button } from "@/components/atoms/Button/Button";+import { OverflowText } from "@/components/atoms/OverflowText/OverflowText";+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/components/atoms/Tooltip/BaseTooltip";+import { DownloadSimpleIcon, TrashIcon } from "@phosphor-icons/react";+import { classifyArtifact } from "../../../../ArtifactPanel/helpers";+import {+ formatFileSize,+ formatFileTimestamp,+ isUploadedFile,+} from "../helpers";+import type { SessionFile } from "../useSessionFiles";++interface Props {+ file: SessionFile;+ onOpen: (file: SessionFile) => void;+ onDownload: (file: SessionFile) => void;+ onRequestDelete: (file: SessionFile) => void;+}++export function FileRow({ file, onOpen, onDownload, onRequestDelete }: Props) {+ const { item } = file;+ const Icon = classifyArtifact(item.mime_type ?? null, item.name).icon;+ const canDelete = !isUploadedFile(item);++ return (+ <div className="group flex items-center gap-2 rounded-md py-1.5 hover:bg-zinc-50">+ <button+ type="button"+ onClick={() => onOpen(file)}+ className="flex min-w-0 flex-1 flex-col text-left"+ title={item.name}+ >+ <span className="flex min-w-0 items-center gap-2">+ <Icon size={16} className="shrink-0 text-black" />+ <OverflowText+ variant="body"+ value={item.name}+ className="text-zinc-800"+ />+ </span>+ <span className="text-xs text-zinc-400">+ {formatFileSize(item.size_bytes ?? 0)} ·{" "}+ {formatFileTimestamp(item.created_at)}+ </span>+ </button>+ <div className="flex shrink-0 items-center gap-0.5">+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="ghost"+ size="icon"+ onClick={() => onDownload(file)}+ aria-label={`Download ${item.name}`}+ >+ <DownloadSimpleIcon size={16} />+ </Button>+ </TooltipTrigger>+ <TooltipContent>Download</TooltipContent>+ </Tooltip>+ {canDelete && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="ghost"+ size="icon"+ onClick={() => onRequestDelete(file)}+ aria-label={`Delete ${item.name}`}+ >+ <TrashIcon size={16} />+ </Button>+ </TooltipTrigger>+ <TooltipContent>Delete</TooltipContent>+ </Tooltip>+ )}+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/helpers.test.tsnew file mode 100644index 0000000000..e9c92b559f--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/helpers.test.ts@@ -0,0 +1,72 @@+import { describe, expect, test } from "vitest";+import { downloadFilesAsZip } from "./helpers";+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";+import {+ fileItemToArtifactRef,+ formatFileSize,+ formatFileTimestamp,+ isUploadedFile,+} from "./helpers";++const baseItem: WorkspaceFileItem = {+ id: "11111111-1111-1111-1111-111111111111",+ name: "report.pdf",+ path: "/sessions/s1/report.pdf",+ mime_type: "application/pdf",+ size_bytes: 2048,+ metadata: { origin: "user-upload" },+ origin: "uploaded",+ created_at: "2026-05-20T10:00:00Z",+};++describe("FilesTab helpers", () => {+ test("formatFileSize renders human units", () => {+ expect(formatFileSize(0)).toBe("0 B");+ expect(formatFileSize(2048)).toBe("2 KB");+ expect(formatFileSize(5 * 1024 * 1024)).toBe("5 MB");+ });+ test("isUploadedFile splits by origin", () => {+ expect(isUploadedFile(baseItem)).toBe(true);+ expect(isUploadedFile({ ...baseItem, origin: "generated" })).toBe(false);+ });+ test("fileItemToArtifactRef builds a proxy download URL + origin", () => {+ const ref = fileItemToArtifactRef(baseItem);+ expect(ref.id).toBe(baseItem.id);+ expect(ref.title).toBe("report.pdf");+ expect(ref.origin).toBe("user-upload");+ expect(ref.sourceUrl).toContain("/api/proxy");+ expect(ref.sourceUrl).toContain(baseItem.id);+ expect(ref.sizeBytes).toBe(2048);+ });+ test("formatFileTimestamp returns a non-empty string", () => {+ expect(formatFileTimestamp(baseItem.created_at).length).toBeGreaterThan(0);+ });+});++describe("downloadFilesAsZip", () => {+ test("fetches each file and produces a zip blob via the sink", async () => {+ const fetched: string[] = [];+ const fetchImpl = async (url: string) => {+ fetched.push(url);+ return new Response(new Blob([url]), { status: 200 });+ };+ let savedName = "";+ let savedBlob: Blob | null = null;+ await downloadFilesAsZip(+ [+ { id: "a1", name: "a.txt" },+ { id: "b2", name: "b.txt" },+ ],+ {+ fetchImpl,+ save: (blob, name) => {+ savedBlob = blob;+ savedName = name;+ },+ },+ );+ expect(fetched).toHaveLength(2);+ expect(savedName.endsWith(".zip")).toBe(true);+ expect(savedBlob).toBeInstanceOf(Blob);+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/helpers.tsnew file mode 100644index 0000000000..97257a66f1--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/helpers.ts@@ -0,0 +1,94 @@+import JSZip from "jszip";+import { getGetWorkspaceDownloadFileByIdUrl } from "@/app/api/__generated__/endpoints/workspace/workspace";+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";+import type { ArtifactRef } from "../../../../store";++export function fileDownloadUrl(fileId: string): string {+ return `/api/proxy${getGetWorkspaceDownloadFileByIdUrl(fileId)}`;+}++export function isUploadedFile(item: WorkspaceFileItem): boolean {+ return item.origin === "uploaded";+}++export function fileItemToArtifactRef(item: WorkspaceFileItem): ArtifactRef {+ return {+ id: item.id,+ title: item.name,+ mimeType: item.mime_type ?? null,+ sourceUrl: fileDownloadUrl(item.id),+ origin: isUploadedFile(item) ? "user-upload" : "agent",+ sizeBytes: item.size_bytes ?? undefined,+ };+}++const UNITS = ["B", "KB", "MB", "GB", "TB"];++export function formatFileSize(bytes: number): string {+ if (!bytes || bytes < 0) return "0 B";+ const exponent = Math.min(+ Math.floor(Math.log(bytes) / Math.log(1024)),+ UNITS.length - 1,+ );+ const value = bytes / Math.pow(1024, exponent);+ const rounded = exponent === 0 ? value : Math.round(value * 10) / 10;+ const text = Number.isInteger(rounded) ? String(rounded) : rounded.toFixed(1);+ return `${text} ${UNITS[exponent]}`;+}++export function formatFileTimestamp(iso: string): string {+ const date = new Date(iso);+ if (Number.isNaN(date.getTime())) return "";+ return date.toLocaleDateString(undefined, {+ month: "short",+ day: "numeric",+ hour: "numeric",+ minute: "2-digit",+ });+}++interface ZipEntry {+ id: string;+ name: string;+}++interface DownloadZipDeps {+ fetchImpl?: (url: string) => Promise<Response>;+ save?: (blob: Blob, filename: string) => void;+}++function triggerDownload(blob: Blob, filename: string): void {+ const url = URL.createObjectURL(blob);+ const a = document.createElement("a");+ a.href = url;+ a.download = filename;+ document.body.appendChild(a);+ a.click();+ a.remove();+ URL.revokeObjectURL(url);+}++export async function downloadFilesAsZip(+ entries: ZipEntry[],+ deps: DownloadZipDeps = {},+): Promise<void> {+ const fetchImpl = deps.fetchImpl ?? ((url: string) => fetch(url));+ const save = deps.save ?? triggerDownload;+ const zip = new JSZip();+ const used = new Set<string>();+ let added = 0;+ for (const entry of entries) {+ const res = await fetchImpl(fileDownloadUrl(entry.id));+ if (!res.ok) continue;+ let name = entry.name || entry.id;+ while (used.has(name)) name = `${entry.id.slice(0, 8)}-${name}`;+ used.add(name);+ zip.file(name, await res.blob());+ added++;+ }+ if (added === 0) {+ throw new Error("No files could be downloaded.");+ }+ const blob = await zip.generateAsync({ type: "blob" });+ save(blob, "workspace-files.zip");+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/useSessionFiles.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/useSessionFiles.tsnew file mode 100644index 0000000000..b064722b7f--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/useSessionFiles.ts@@ -0,0 +1,55 @@+"use client";++import { useListWorkspaceFiles } from "@/app/api/__generated__/endpoints/workspace/workspace";+import type { ListFilesResponse } from "@/app/api/__generated__/models/listFilesResponse";+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";+import { useCopilotStreamStore } from "../../../../copilotStreamStore";+import { getMessageArtifacts } from "../../../ChatMessagesContainer/helpers";+import { isUploadedFile } from "./helpers";++export interface SessionFile {+ item: WorkspaceFileItem;+ messageID: string | null;+}++export function useSessionFiles(sessionId: string | null) {+ const messages = useCopilotStreamStore((s) =>+ sessionId ? s.messageSnapshots[sessionId] : undefined,+ );++ const query = useListWorkspaceFiles(+ { session_id: sessionId ?? undefined },+ {+ query: {+ enabled: !!sessionId,+ select: (res) => res.data as ListFilesResponse,+ },+ },+ );++ const fileIdToMessageId = new Map<string, string>();+ for (const message of messages ?? []) {+ for (const artifact of getMessageArtifacts(message)) {+ if (!fileIdToMessageId.has(artifact.id)) {+ fileIdToMessageId.set(artifact.id, message.id);+ }+ }+ }++ const files: SessionFile[] = (query.data?.files ?? []).map((item) => ({+ item,+ messageID: fileIdToMessageId.get(item.id) ?? null,+ }));++ const uploaded = files.filter((f) => isUploadedFile(f.item));+ const generated = files.filter((f) => !isUploadedFile(f.item));++ return {+ uploaded,+ generated,+ isLoading: query.isLoading && !!sessionId,+ isError: query.isError,+ error: query.error,+ isEmpty: !!sessionId && files.length === 0,+ };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/ProgressTab/ProgressTab.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/ProgressTab/ProgressTab.tsxnew file mode 100644index 0000000000..165f610efd--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/ProgressTab/ProgressTab.tsx@@ -0,0 +1,169 @@+"use client";++import {+ CheckCircleIcon,+ CircleDashedIcon,+ CircleIcon,+} from "@phosphor-icons/react";+import { motion } from "framer-motion";+import { useCopilotStreamStore } from "../../../../copilotStreamStore";+import { countCompleted, getLatestTaskList, type TodoItem } from "./helpers";++interface Props {+ sessionId: string | null;+}++export function ProgressTab({ sessionId }: Props) {+ const messages = useCopilotStreamStore((s) =>+ sessionId ? s.messageSnapshots[sessionId] : undefined,+ );+ const isStreaming = useCopilotStreamStore((s) => s.isStreaming);++ if (!sessionId) {+ return (+ <p className="p-6 text-center text-sm text-zinc-400">+ Start a conversation to see progress here.+ </p>+ );+ }++ const todos = messages ? getLatestTaskList(messages) : null;++ if (!todos || todos.length === 0) {+ return (+ <div className="flex h-full flex-1 items-center justify-center p-6">+ <p className="text-center text-sm text-zinc-400">+ No task list yet. Autopilot will populate it as work begins.+ </p>+ </div>+ );+ }++ const completed = countCompleted(todos);+ const allDone = completed === todos.length;++ if (allDone) return <AllTasksComplete total={todos.length} />;++ // When the agent is idle, render in_progress entries as pending so the+ // sidebar doesn't display an active spinner/bold treatment for work that+ // isn't actually progressing.+ const isIdle = !isStreaming;+ const displayTodos: TodoItem[] = isIdle+ ? todos.map((t) =>+ t.status === "in_progress" ? { ...t, status: "pending" } : t,+ )+ : todos;++ return (+ <div className="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto px-6 pb-3 pt-4">+ <header className="flex items-baseline justify-between">+ <h3 className="text-sm font-medium text-zinc-900">Task list</h3>+ <span className="text-xs text-zinc-500">+ {completed}/{todos.length} completed+ </span>+ </header>+ <ul className="flex flex-col gap-1.5">+ {displayTodos.map((todo, i) => (+ <TaskRow key={i} todo={todo} />+ ))}+ </ul>+ </div>+ );+}++function TaskRow({ todo }: { todo: TodoItem }) {+ return (+ <li className="flex items-start gap-2 text-xs">+ <span className="mt-0.5 flex-shrink-0">+ <StatusIcon status={todo.status} />+ </span>+ <span+ className={+ todo.status === "completed"+ ? "text-muted-foreground line-through"+ : todo.status === "in_progress"+ ? "font-medium text-foreground"+ : "text-muted-foreground"+ }+ >+ {todo.status === "in_progress" && todo.activeForm+ ? todo.activeForm+ : todo.content}+ </span>+ </li>+ );+}++function StatusIcon({ status }: { status: TodoItem["status"] }) {+ if (status === "completed") {+ return (+ <CheckCircleIcon+ size={14}+ weight="fill"+ className="text-green-500"+ aria-label="completed"+ />+ );+ }+ if (status === "in_progress") {+ return (+ <CircleDashedIcon+ size={14}+ weight="bold"+ className="text-blue-500"+ aria-label="in progress"+ />+ );+ }+ return (+ <CircleIcon+ size={14}+ weight="regular"+ className="text-neutral-400"+ aria-label="pending"+ />+ );+}++function AllTasksComplete({ total }: { total: number }) {+ return (+ <div className="flex flex-1 flex-col items-center justify-center gap-3 px-6 py-12 text-center">+ <motion.div+ initial={{ scale: 0, rotate: -30 }}+ animate={{ scale: 1, rotate: 0 }}+ transition={{ type: "spring", stiffness: 260, damping: 18 }}+ className="flex h-14 w-14 items-center justify-center rounded-full bg-emerald-50"+ >+ <motion.div+ initial={{ scale: 0 }}+ animate={{ scale: [0, 1.15, 1] }}+ transition={{ duration: 0.5, delay: 0.15, ease: "easeOut" }}+ >+ <CheckCircleIcon+ size={32}+ weight="fill"+ className="text-emerald-500"+ />+ </motion.div>+ </motion.div>+ <motion.h3+ initial={{ opacity: 0, y: 6 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: 0.3, delay: 0.25 }}+ className="text-sm font-medium text-zinc-900"+ >+ All tasks complete+ </motion.h3>+ <motion.p+ initial={{ opacity: 0, y: 6 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: 0.3, delay: 0.35 }}+ className="max-w-xs text-xs text-zinc-500"+ >+ {total} {total === 1 ? "task" : "tasks"} finished.+ <br />+ Autopilot is ready for the next ask.+ </motion.p>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/ProgressTab/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/ProgressTab/helpers.tsnew file mode 100644index 0000000000..b1e49c4531--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/ProgressTab/helpers.ts@@ -0,0 +1,40 @@+import type { UIMessage } from "ai";++export interface TodoItem {+ content: string;+ status: "pending" | "in_progress" | "completed";+ activeForm?: string;+}++function isTodoItem(value: unknown): value is TodoItem {+ if (!value || typeof value !== "object") return false;+ const v = value as Record<string, unknown>;+ return (+ typeof v.content === "string" &&+ (v.status === "pending" ||+ v.status === "in_progress" ||+ v.status === "completed")+ );+}++export function getLatestTaskList(messages: UIMessage[]): TodoItem[] | null {+ for (let i = messages.length - 1; i >= 0; i--) {+ const parts = messages[i]?.parts;+ if (!parts) continue;+ for (let j = parts.length - 1; j >= 0; j--) {+ const part = parts[j] as { type: string; input?: unknown };+ if (part.type !== "tool-TodoWrite") continue;+ const input = part.input;+ if (!input || typeof input !== "object") continue;+ const todos = (input as { todos?: unknown }).todos;+ if (!Array.isArray(todos)) continue;+ const filtered = todos.filter(isTodoItem);+ if (filtered.length > 0) return filtered;+ }+ }+ return null;+}++export function countCompleted(todos: TodoItem[]): number {+ return todos.filter((t) => t.status === "completed").length;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/TabSwitcher.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/TabSwitcher.tsxnew file mode 100644index 0000000000..a73d0322c9--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/TabSwitcher.tsx@@ -0,0 +1,41 @@+import { cn } from "@/lib/utils";+import type { ContextPanelTab } from "../../../store";++interface Props {+ activeTab: ContextPanelTab;+ filesCount: number;+ onChange: (tab: ContextPanelTab) => void;+}++export function TabSwitcher({ activeTab, filesCount, onChange }: Props) {+ const tabs: { id: ContextPanelTab; label: string }[] = [+ { id: "progress", label: "Progress" },+ { id: "files", label: `Files (${filesCount})` },+ ];++ return (+ <div+ role="tablist"+ aria-label="Context panel sections"+ className="flex items-center rounded-md border border-zinc-200 bg-zinc-50 p-0.5 text-xs font-medium"+ >+ {tabs.map((tab) => (+ <button+ key={tab.id}+ role="tab"+ type="button"+ aria-selected={activeTab === tab.id}+ onClick={() => onChange(tab.id)}+ className={cn(+ "rounded px-2 py-1 transition-colors",+ activeTab === tab.id+ ? "bg-white text-zinc-900 shadow-sm"+ : "text-zinc-500 hover:text-zinc-700",+ )}+ >+ {tab.label}+ </button>+ ))}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useAutoOpenForFiles.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useAutoOpenForFiles.tsnew file mode 100644index 0000000000..edbde80b17--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useAutoOpenForFiles.ts@@ -0,0 +1,39 @@+"use client";++import { useEffect, useRef } from "react";+import { useCopilotUIStore } from "../../store";+import { useSessionFiles } from "./components/FilesTab/useSessionFiles";++/**+ * Opens the context panel to the Files tab the first time a session has files,+ * unless the user has explicitly closed it. Mirrors useAutoOpenArtifacts.+ */+export function useAutoOpenForFiles(sessionId: string | null) {+ const openContextPanelForFiles = useCopilotUIStore(+ (s) => s.openContextPanelForFiles,+ );+ const { uploaded, generated } = useSessionFiles(sessionId);+ const hasFiles = uploaded.length + generated.length > 0;+ const triggered = useRef(false);+ const prevSessionIdRef = useRef(sessionId);++ // Session change: clear the per-session "already triggered" guard so the+ // next session can auto-open independently. The shared `_autoOpenReady` /+ // `_autoOpenUserClosed` flags are reset by `useAutoOpenArtifacts` (the+ // single owner of that global state); calling `resetAutoOpenState()` here+ // too races with that hook and can clobber the ready flag depending on+ // mount order.+ useEffect(() => {+ if (prevSessionIdRef.current !== sessionId) {+ triggered.current = false;+ prevSessionIdRef.current = sessionId;+ }+ }, [sessionId]);++ useEffect(() => {+ if (hasFiles && !triggered.current) {+ triggered.current = true;+ openContextPanelForFiles();+ }+ }, [hasFiles, openContextPanelForFiles]);+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useAutoOpenForProgress.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useAutoOpenForProgress.tsnew file mode 100644index 0000000000..704b82c433--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useAutoOpenForProgress.ts@@ -0,0 +1,50 @@+"use client";++import { useEffect, useRef } from "react";+import { useCopilotStreamStore } from "../../copilotStreamStore";+import { useCopilotUIStore } from "../../store";+import {+ getLatestTaskList,+ type TodoItem,+} from "./components/ProgressTab/helpers";++function hasActiveWork(todos: TodoItem[] | null): boolean {+ if (!todos || todos.length === 0) return false;+ return todos.some(+ (t) => t.status === "in_progress" || t.status === "pending",+ );+}++/**+ * Force-opens the context panel on the Progress tab the moment a session's+ * task list goes "active" (has any incomplete todo). Re-arms when the active+ * state flips back to inactive so a subsequent task list reopens the panel.+ */+export function useAutoOpenForProgress(sessionId: string | null) {+ const openContextPanelForProgress = useCopilotUIStore(+ (s) => s.openContextPanelForProgress,+ );+ const messages = useCopilotStreamStore((s) =>+ sessionId ? s.messageSnapshots[sessionId] : undefined,+ );+ const wasActiveRef = useRef(false);+ const prevSessionIdRef = useRef(sessionId);++ useEffect(() => {+ if (prevSessionIdRef.current !== sessionId) {+ wasActiveRef.current = false;+ prevSessionIdRef.current = sessionId;+ }+ }, [sessionId]);++ useEffect(() => {+ const todos = messages ? getLatestTaskList(messages) : null;+ const active = hasActiveWork(todos);+ if (active && !wasActiveRef.current) {+ wasActiveRef.current = true;+ openContextPanelForProgress();+ } else if (!active && wasActiveRef.current) {+ wasActiveRef.current = false;+ }+ }, [messages, openContextPanelForProgress]);+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useCollapseContextPanelOnSession.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useCollapseContextPanelOnSession.tsnew file mode 100644index 0000000000..2e71e9a27b--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useCollapseContextPanelOnSession.ts@@ -0,0 +1,22 @@+"use client";++import { useMountEffect } from "@/hooks/useMountEffect";+import { useCopilotUIStore } from "../../store";++/**+ * Collapses the context panel on session entry. ContextPanelAutoOpen is keyed+ * by sessionId in CopilotPage, so this runs on every session change. The+ * useAutoOpenFor{Files,Progress} hooks then reopen the panel on the same+ * render when the new session has files or an active task list — sessions+ * with nothing to surface stay collapsed.+ *+ * Skips when sessionId is null so the very first mount (no session yet)+ * doesn't overwrite the user's persisted open/closed preference.+ */+export function useCollapseContextPanelOnSession(sessionId: string | null) {+ const closeArtifactPanel = useCopilotUIStore((s) => s.closeArtifactPanel);+ useMountEffect(() => {+ if (!sessionId) return;+ closeArtifactPanel();+ });+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useContextPanel.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useContextPanel.tsnew file mode 100644index 0000000000..95e9a12c5e--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useContextPanel.ts@@ -0,0 +1,26 @@+"use client";++import { useCopilotUIStore } from "../../store";++export function useContextPanel() {+ const artifactPanel = useCopilotUIStore((s) => s.artifactPanel);+ const setActiveTab = useCopilotUIStore((s) => s.setActiveTab);+ const closeArtifactPanel = useCopilotUIStore((s) => s.closeArtifactPanel);+ const contextPanelWidth = useCopilotUIStore((s) => s.contextPanelWidth);+ const setContextPanelWidth = useCopilotUIStore((s) => s.setContextPanelWidth);++ // The artifact takes over the right region while it's open, so the Context+ // Panel is hidden then (you return to it by closing the artifact).+ const hasArtifact = artifactPanel.activeArtifact != null;+ const showExpanded = artifactPanel.isOpen && !hasArtifact;++ return {+ isOpen: artifactPanel.isOpen,+ activeTab: artifactPanel.activeTab,+ showExpanded,+ setActiveTab,+ closeArtifactPanel,+ contextPanelWidth,+ setContextPanelWidth,+ };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsxindex 933172b880..4b1cd1dd83 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx@@ -4,6 +4,8 @@ import { ChatInput } from "@/app/(platform)/copilot/components/ChatInput/ChatInpimport { useGetV2GetSuggestedPrompts } from "@/app/api/__generated__/endpoints/chat/chat";import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";import { Text } from "@/components/atoms/Text/Text";+import { DotDistortionShader } from "@/components/ui/dot-distortion-shader";+import { TextGenerateEffect } from "@/components/ui/text-generate-effect";import { useSupabase } from "@/lib/supabase/hooks/useSupabase";import { motion } from "framer-motion";import { useEffect, useState } from "react";@@ -71,9 +73,17 @@ export function EmptySession({}, []);return (- <div className="flex h-full flex-1 items-center justify-center overflow-y-auto bg-[#f8f8f9] px-0 py-5 md:px-6 md:py-10">+ <div className="relative flex h-full flex-1 items-center justify-center overflow-y-auto px-0 py-5 md:px-6 md:py-10">+ <DotDistortionShader+ dotGap={14}+ dotSize={1}+ opacity={0.2}+ enableMouseInteraction={false}+ breathingSpeed={0.4}+ className="pointer-events-none absolute inset-0 !bg-transparent [&_canvas]:opacity-70"+ /><motion.div- className="w-full max-w-[52rem] text-center"+ className="relative z-10 w-full max-w-[52rem] text-center"initial={{ opacity: 0 }}animate={{ opacity: 1 }}transition={{ duration: 0.3 }}@@ -83,9 +93,11 @@ export function EmptySession({Hey, <span className="text-violet-600">{greetingName}</span><EditNameDialog currentName={greetingName} /></Text>- <Text variant="h3" className="mb-8 !font-normal">- Tell me about your work — I'll find what to automate.- </Text>+ <TextGenerateEffect+ className="mb-8 !font-normal [&>div]:!mt-0 [&_div]:!text-[1.375rem] [&_div]:!leading-normal [&_div]:!tracking-normal"+ duration={0.6}+ words="Tell me about your work — I'll find what to automate."+ />{isAgentBriefingEnabled && (<PulseChips chips={pulseChips} onChipClick={onSend} />diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/SuggestionThemes/SuggestionThemes.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/SuggestionThemes/SuggestionThemes.tsxindex 14658b730d..ce111d6afd 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/SuggestionThemes/SuggestionThemes.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/SuggestionThemes/SuggestionThemes.tsx@@ -57,10 +57,10 @@ export function SuggestionThemes({ themes, onSend, disabled }: Props) {<PopoverTrigger asChild><Buttontype="button"- variant="outline"+ variant="secondary"size="small"disabled={disabled || loadingPrompt !== null}- className="shrink-0 gap-2 border-zinc-300 px-3 py-2 text-[.9rem] text-zinc-600"+ className="shrink-0 gap-2 !border-neutral-200 !bg-white px-3 py-2 text-[.9rem]">{Icon && <Icon size={16} weight="regular" />}{theme.name}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/JobStatsBar/TurnStatsBar.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/JobStatsBar/TurnStatsBar.tsxindex 195d5d46ff..81a778c1e8 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/JobStatsBar/TurnStatsBar.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/JobStatsBar/TurnStatsBar.tsx@@ -82,7 +82,7 @@ export function TurnStatsBar({ turnMessages, elapsedSeconds, stats }: Props) {if (counters.length === 0 && showTimeLabel === null) return null;return (- <div className="mt-2 flex items-center gap-1.5">+ <div className="mt-2 flex items-center gap-1.5 text-xs opacity-50 transition-opacity group-hover:opacity-100">{showTimeLabel !== null && (<TimeLabel displaySeconds={showTimeLabel} localDate={localDate} />)}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.tsxindex 5c2d4d541f..c5d85001e0 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileHeader/MobileHeader.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileHeader/MobileHeader.tsx@@ -1,10 +1,13 @@import { Button } from "@/components/atoms/Button/Button";import { NAVBAR_HEIGHT_PX } from "@/lib/constants";-import { ListIcon } from "@phosphor-icons/react";+import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";+import { FolderIcon, ListIcon } from "@phosphor-icons/react";import { useCopilotUIStore } from "../../store";export function MobileHeader() {const setDrawerOpen = useCopilotUIStore((s) => s.setDrawerOpen);+ const toggleContextPanel = useCopilotUIStore((s) => s.toggleContextPanel);+ const isContextPanelEnabled = useGetFlag(Flag.ARTIFACTS);return (<divclassName="fixed z-50 flex gap-2"@@ -19,6 +22,17 @@ export function MobileHeader() {><ListIcon width="1.25rem" height="1.25rem" /></Button>+ {isContextPanelEnabled && (+ <Button+ variant="icon"+ size="icon"+ aria-label="Open workspace files"+ onClick={toggleContextPanel}+ className="bg-white shadow-md"+ >+ <FolderIcon width="1.25rem" height="1.25rem" />+ </Button>+ )}</div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MorphingTextAnimation/MorphingTextAnimation.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MorphingTextAnimation/MorphingTextAnimation.tsxindex aac615bb2b..f757155561 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MorphingTextAnimation/MorphingTextAnimation.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MorphingTextAnimation/MorphingTextAnimation.tsx@@ -10,9 +10,13 @@ export function MorphingTextAnimation({ text, className }: Props) {const letters = text.split("");return (- <div className={cn(className)}>+ // min-w-0 + overflow-hidden lets the parent flex item shrink and clip;+ // the inner whitespace-nowrap keeps the per-character animation on one+ // line without forcing the chat column wider than the viewport on long+ // command strings.+ <div className={cn("min-w-0 overflow-hidden", className)}><AnimatePresence mode="popLayout" initial={false}>- <motion.div key={text} className="whitespace-nowrap">+ <motion.div key={text} className="truncate whitespace-nowrap"><motion.span className="inline-flex overflow-hidden">{letters.map((char, index) => (<motion.spandiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/ArtifactDragHandle.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/PanelResizeHandle.tsxsimilarity index 63%rename from autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/ArtifactDragHandle.tsxrename to autogpt_platform/frontend/src/app/(platform)/copilot/components/PanelResizeHandle.tsxindex f169bec9e4..8cb1d2133f 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/components/ArtifactDragHandle.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/PanelResizeHandle.tsx@@ -2,46 +2,53 @@import { cn } from "@/lib/utils";import { useEffect, useRef, useState } from "react";-import { DEFAULT_PANEL_WIDTH } from "../../../store";interface Props {+ /** CSS selector for the panel element this handle resizes (e.g. "[data-artifact-panel]"). */+ panelSelector: string;onWidthChange: (width: number) => void;- minWidth?: number;- maxWidthPercent?: number;+ minWidth: number;+ maxWidth?: number;+ /** Space reserved for everything else in the flex row (chat + opposite rail). */+ reservedWidth?: number;}-export function ArtifactDragHandle({+export function PanelResizeHandle({+ panelSelector,onWidthChange,- minWidth = 320,- maxWidthPercent = 85,+ minWidth,+ maxWidth,+ reservedWidth = 440,}: Props) {const [isDragging, setIsDragging] = useState(false);const startXRef = useRef(0);const startWidthRef = useRef(0);- // Use refs for the callback + bounds so the drag listeners can read the- // latest values without having to detach/reattach between re-renders.+ const containerWidthRef = useRef(0);const onWidthChangeRef = useRef(onWidthChange);const minWidthRef = useRef(minWidth);- const maxWidthPercentRef = useRef(maxWidthPercent);+ const maxWidthRef = useRef(maxWidth);+ const reservedWidthRef = useRef(reservedWidth);onWidthChangeRef.current = onWidthChange;minWidthRef.current = minWidth;- maxWidthPercentRef.current = maxWidthPercent;+ maxWidthRef.current = maxWidth;+ reservedWidthRef.current = reservedWidth;- // Track the captured pointer id so pointerup can release it even after- // React re-renders.const pointerIdRef = useRef<number | null>(null);- // Attach document listeners only while dragging, and always tear them down- // on unmount — otherwise closing the panel mid-drag leaves listeners bound- // to a handler that calls setState on the unmounted component.+ // DOM integration: document-level pointer listeners bound only while+ // dragging, torn down on unmount so closing the panel mid-drag is safe.useEffect(() => {if (!isDragging) return;function handlePointerMove(moveEvent: PointerEvent) {const delta = startXRef.current - moveEvent.clientX;- const maxWidth = window.innerWidth * (maxWidthPercentRef.current / 100);+ const available = containerWidthRef.current - reservedWidthRef.current;+ const cappedMax = maxWidthRef.current+ ? Math.min(maxWidthRef.current, available)+ : available;+ const effectiveMax = Math.max(minWidthRef.current, cappedMax);const newWidth = Math.min(- maxWidth,+ effectiveMax,Math.max(minWidthRef.current, startWidthRef.current + delta),);onWidthChangeRef.current(newWidth);@@ -64,23 +71,21 @@ export function ArtifactDragHandle({function handlePointerDown(e: React.PointerEvent<HTMLDivElement>) {e.preventDefault();startXRef.current = e.clientX;-- // Get the panel's current width from its parentconst panel = (e.target as HTMLElement).closest(- "[data-artifact-panel]",+ panelSelector,) as HTMLElement | null;- startWidthRef.current = panel?.offsetWidth ?? DEFAULT_PANEL_WIDTH;-- // Capture the pointer so pointermove/pointerup still reach us when the- // cursor drifts over sandboxed artifact iframes. Without this, the iframe- // eats the events and the drag gets stuck (SECRT-2256).+ startWidthRef.current = panel?.offsetWidth ?? minWidthRef.current;+ containerWidthRef.current =+ panel?.parentElement?.offsetWidth ??+ (typeof window !== "undefined"+ ? window.innerWidth+ : startWidthRef.current);try {e.currentTarget.setPointerCapture(e.pointerId);pointerIdRef.current = e.pointerId;} catch {// Non-supporting environments (older test DOMs) — safe to ignore.}-setIsDragging(true);}@@ -97,15 +102,11 @@ export function ArtifactDragHandle({}return (- // 12px transparent hit target with the visible 1px line centered inside- // (WCAG-compliant, matches ~8-12px conventions of other resizable panels).<divrole="separator"aria-orientation="vertical"aria-label="Resize panel"- className={cn(- "group absolute -left-1.5 top-0 z-10 flex h-full w-3 cursor-col-resize items-stretch justify-center",- )}+ className="group absolute left-0 top-0 z-10 flex h-full w-3 -translate-x-1/2 cursor-col-resize items-stretch justify-center"onPointerDown={handlePointerDown}onPointerUp={handlePointerUp}onPointerCancel={handlePointerUp}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolAccordion/ToolAccordion.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolAccordion/ToolAccordion.tsxindex e53df15e6c..ae71c6e375 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolAccordion/ToolAccordion.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolAccordion/ToolAccordion.tsx@@ -39,10 +39,7 @@ export function ToolAccordion({return (<div- className={cn(- "mt-2 w-full rounded-lg border border-slate-200 bg-slate-100 px-3 py-2",- className,- )}+ className={cn("mt-2 w-full rounded-lg bg-stone-50 px-3 py-2", className)}><buttontype="button"diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolErrorCard/ToolErrorCard.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolErrorCard/ToolErrorCard.tsxindex 26ae976b90..7c6942f909 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolErrorCard/ToolErrorCard.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolErrorCard/ToolErrorCard.tsx@@ -24,7 +24,7 @@ export function ToolErrorCard({actions,}: Props) {return (- <div className="space-y-3 rounded-lg border border-red-200 bg-red-50 p-4">+ <div className="space-y-3 rounded-lg bg-red-50 p-4"><div className="flex items-start gap-2"><WarningDiamondIconsize={20}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/copilotStreamStore.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/copilotStreamStore.tsindex 12d2f2aa7b..b6bbe2573c 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/copilotStreamStore.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/copilotStreamStore.ts@@ -56,12 +56,20 @@ interface CopilotStreamStore {messageSnapshots: Record<string, UIMessage[]>;pendingFirstSend: PendingFirstSend | null;pendingFileParts: FileUIPart[];+ /**+ * True while the current chat is in `streaming` or `submitted` state.+ * Shared so views outside the chat tree (e.g. the workspace sidebar's+ * Progress tab) can decide whether to render an "active" task list view+ * or fall back to an "idle/done" view without prop drilling.+ */+ isStreaming: boolean;getCoord: (sessionId: string) => SessionCoord;updateCoord: (sessionId: string, patch: Partial<SessionCoord>) => void;clearSession: (sessionId: string) => void;getMessageSnapshot: (sessionId: string) => UIMessage[];setMessageSnapshot: (sessionId: string, messages: UIMessage[]) => void;+ setStreaming: (streaming: boolean) => void;setPendingFirstSend: (send: PendingFirstSend | null) => void;setPendingFileParts: (parts: FileUIPart[]) => void;@@ -82,6 +90,7 @@ export const useCopilotStreamStore = create<CopilotStreamStore>()(messageSnapshots: {},pendingFirstSend: null,pendingFileParts: [],+ isStreaming: false,getCoord(sessionId) {return get().sessions[sessionId] ?? defaultCoord;@@ -122,6 +131,10 @@ export const useCopilotStreamStore = create<CopilotStreamStore>()(},}));},+ setStreaming(streaming) {+ if (get().isStreaming === streaming) return;+ set({ isStreaming: streaming });+ },setPendingFirstSend(send) {set({ pendingFirstSend: send });@@ -141,6 +154,7 @@ export const useCopilotStreamStore = create<CopilotStreamStore>()(messageSnapshots: {},pendingFirstSend: null,pendingFileParts: [],+ isStreaming: false,});},}),diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/store.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/store.tsindex f5e29af8b1..2d49f13f31 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/store.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/store.ts@@ -40,14 +40,16 @@ export interface ArtifactRef {interface ArtifactPanelState {isOpen: boolean;- isMinimized: boolean;- isMaximized: boolean;- width: number;activeArtifact: ArtifactRef | null;history: ArtifactRef[];+ activeTab: ContextPanelTab;}-export const DEFAULT_PANEL_WIDTH = 600;+export const DEFAULT_PANEL_WIDTH = 432; // context panel default (352 + 80)+export const DEFAULT_ARTIFACT_PANEL_WIDTH = 640;+export const MIN_CONTEXT_PANEL_WIDTH = 280;+export const MAX_CONTEXT_PANEL_WIDTH = 600;+export const MIN_ARTIFACT_PANEL_WIDTH = 400;/** Autopilot response mode. */export type CopilotMode = "extended_thinking" | "fast";@@ -55,30 +57,50 @@ export type CopilotMode = "extended_thinking" | "fast";/** Per-request model tier. 'standard' = current default; 'advanced' = highest-capability. */export type CopilotLlmModel = "standard" | "advanced";+/** Context panel tab. */+export type ContextPanelTab = "progress" | "files";+const isClient = typeof window !== "undefined";-function getPersistedWidth(): number {+function getPersistedOpen(): boolean {+ if (!isClient) return false;+ return storage.get(Key.COPILOT_CONTEXT_PANEL_OPEN) === "true";+}++function getPersistedTab(): ContextPanelTab {+ if (!isClient) return "files";+ const saved = storage.get(Key.COPILOT_CONTEXT_PANEL_TAB);+ return saved === "progress" ? saved : "files";+}++function clampWidth(value: number, min: number, max: number): number {+ return Math.min(max, Math.max(min, value));+}++function getPersistedContextWidth(): number {if (!isClient) return DEFAULT_PANEL_WIDTH;- const saved = storage.get(Key.COPILOT_ARTIFACT_PANEL_WIDTH);- if (saved) {- const parsed = parseInt(saved, 10);- // Match the drag-handle clamp so a stale/corrupt value can't open the- // panel wider than 85% of the viewport.- const maxWidth = window.innerWidth * 0.85;- if (!isNaN(parsed) && parsed >= 320) {- return Math.min(parsed, maxWidth);- }- }- return DEFAULT_PANEL_WIDTH;+ const raw = Number(storage.get(Key.COPILOT_CONTEXT_PANEL_WIDTH));+ return Number.isFinite(raw) && raw > 0+ ? clampWidth(raw, MIN_CONTEXT_PANEL_WIDTH, MAX_CONTEXT_PANEL_WIDTH)+ : DEFAULT_PANEL_WIDTH;+}++function getPersistedArtifactWidth(): number {+ if (!isClient) return DEFAULT_ARTIFACT_PANEL_WIDTH;+ const raw = Number(storage.get(Key.COPILOT_ARTIFACT_PANEL_WIDTH));+ return Number.isFinite(raw) && raw >= MIN_ARTIFACT_PANEL_WIDTH+ ? raw+ : DEFAULT_ARTIFACT_PANEL_WIDTH;}-let panelWidthPersistTimer: ReturnType<typeof setTimeout> | null = null;-function schedulePanelWidthPersist(width: number) {+const widthPersistTimers: Record<string, ReturnType<typeof setTimeout>> = {};+function scheduleWidthPersist(key: Key, value: number) {if (!isClient) return;- if (panelWidthPersistTimer) clearTimeout(panelWidthPersistTimer);- panelWidthPersistTimer = setTimeout(() => {- storage.set(Key.COPILOT_ARTIFACT_PANEL_WIDTH, String(width));- panelWidthPersistTimer = null;+ const existing = widthPersistTimers[key];+ if (existing) clearTimeout(existing);+ widthPersistTimers[key] = setTimeout(() => {+ storage.set(key, String(Math.round(value)));+ delete widthPersistTimers[key];}, 200);}@@ -100,6 +122,11 @@ interface CopilotUIState {initialPrompt: string | null;setInitialPrompt: (prompt: string | null) => void;+ contextPanelWidth: number;+ artifactPanelWidth: number;+ setContextPanelWidth: (width: number) => void;+ setArtifactPanelWidth: (width: number) => void;+sessionToDelete: DeleteTarget | null;setSessionToDelete: (target: DeleteTarget | null) => void;@@ -127,12 +154,13 @@ interface CopilotUIState {artifactPanel: ArtifactPanelState;openArtifact: (ref: ArtifactRef) => void;closeArtifactPanel: () => void;+ clearArtifactPreview: () => void;resetArtifactPanel: () => void;- minimizeArtifactPanel: () => void;- maximizeArtifactPanel: () => void;- restoreArtifactPanel: () => void;- setArtifactPanelWidth: (width: number) => void;goBackArtifact: () => void;+ setActiveTab: (tab: ContextPanelTab) => void;+ toggleContextPanel: () => void;+ openContextPanelForFiles: () => void;+ openContextPanelForProgress: () => void;// Card-based auto-open: ArtifactCard registers itself on mount, the store// decides whether to auto-open. Much simpler than message-scanning.@@ -168,6 +196,17 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({initialPrompt: null,setInitialPrompt: (prompt) => set({ initialPrompt: prompt }),+ contextPanelWidth: getPersistedContextWidth(),+ artifactPanelWidth: getPersistedArtifactWidth(),+ setContextPanelWidth: (width) => {+ scheduleWidthPersist(Key.COPILOT_CONTEXT_PANEL_WIDTH, width);+ set({ contextPanelWidth: width });+ },+ setArtifactPanelWidth: (width) => {+ scheduleWidthPersist(Key.COPILOT_ARTIFACT_PANEL_WIDTH, width);+ set({ artifactPanelWidth: width });+ },+sessionToDelete: null,setSessionToDelete: (target) => set({ sessionToDelete: target }),@@ -223,12 +262,10 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({// Artifact panelartifactPanel: {- isOpen: false,- isMinimized: false,- isMaximized: false,- width: getPersistedWidth(),+ isOpen: getPersistedOpen(),activeArtifact: null,history: [],+ activeTab: getPersistedTab(),},openArtifact: (ref) =>set((state) => {@@ -236,31 +273,51 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({const topOfHistory = prevHistory[prevHistory.length - 1];const isReturningToTop = topOfHistory?.id === ref.id;const shouldPushHistory =- state.artifactPanel.isOpen &&- activeArtifact != null &&- activeArtifact.id !== ref.id;+ activeArtifact != null && activeArtifact.id !== ref.id;const MAX_HISTORY = 25;const history = isReturningToTop? prevHistory.slice(0, -1): shouldPushHistory? [...prevHistory, activeArtifact!].slice(-MAX_HISTORY): prevHistory;+ if (isClient) storage.set(Key.COPILOT_CONTEXT_PANEL_OPEN, "true");return {artifactPanel: {...state.artifactPanel,isOpen: true,- isMinimized: false,activeArtifact: ref,history,},};}),closeArtifactPanel: () =>+ set((state) => {+ if (isClient) storage.set(Key.COPILOT_CONTEXT_PANEL_OPEN, "false");+ // NOTE: deliberately does NOT set _autoOpenUserClosed. Unlike+ // toggleContextPanel (a user action), closeArtifactPanel is also the+ // programmatic collapse path — useCollapseContextPanelOnSession calls it+ // on every session entry, right before the auto-open hooks reopen the+ // panel. Suppressing auto-open here would break that collapse→reopen+ // flow. Unwanted reopen-after-user-close is already prevented per-session+ // by the auto-open hooks' own "triggered" guards.+ return {+ // Clear the preview too: the drawer is gated solely on activeArtifact,+ // so leaving it set would float a drawer with no panel behind it (and+ // a later openArtifact would wrongly treat the closed artifact as+ // back-stack history).+ artifactPanel: {+ ...state.artifactPanel,+ isOpen: false,+ activeArtifact: null,+ history: [],+ },+ };+ }),+ clearArtifactPreview: () =>set((state) => ({artifactPanel: {...state.artifactPanel,- isOpen: false,- isMinimized: false,+ activeArtifact: null,history: [],},})),@@ -268,43 +325,10 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({set((state) => ({artifactPanel: {...state.artifactPanel,- isOpen: false,- isMinimized: false,- isMaximized: false,activeArtifact: null,history: [],},})),- minimizeArtifactPanel: () =>- set((state) => ({- artifactPanel: { ...state.artifactPanel, isMinimized: true },- })),- maximizeArtifactPanel: () =>- set((state) => ({- artifactPanel: {- ...state.artifactPanel,- isMaximized: true,- isMinimized: false,- },- })),- restoreArtifactPanel: () =>- set((state) => ({- artifactPanel: {- ...state.artifactPanel,- isMaximized: false,- isMinimized: false,- },- })),- setArtifactPanelWidth: (width) => {- schedulePanelWidthPersist(width);- set((state) => ({- artifactPanel: {- ...state.artifactPanel,- width,- isMaximized: false,- },- }));- },goBackArtifact: () =>set((state) => {const { history } = state.artifactPanel;@@ -318,12 +342,78 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({},};}),+ setActiveTab: (tab) =>+ set((state) => {+ if (isClient) storage.set(Key.COPILOT_CONTEXT_PANEL_TAB, tab);+ return {+ // Selecting a tab returns to the tabs view (drops any open preview).+ artifactPanel: {+ ...state.artifactPanel,+ activeTab: tab,+ activeArtifact: null,+ history: [],+ },+ };+ }),+ toggleContextPanel: () =>+ set((state) => {+ const nextOpen = !state.artifactPanel.isOpen;+ if (isClient)+ storage.set(Key.COPILOT_CONTEXT_PANEL_OPEN, String(nextOpen));+ // Persist the new open state. Either direction clears any open preview:+ // opening lands on the tabs view, and closing must also drop+ // activeArtifact so the artifact drawer (gated solely on activeArtifact)+ // can't stay floating after its parent panel is hidden. Closing also+ // counts as an explicit close for files auto-open.+ if (!nextOpen) _autoOpenUserClosed = true;+ return {+ artifactPanel: {+ ...state.artifactPanel,+ isOpen: nextOpen,+ activeArtifact: null,+ history: [],+ },+ };+ }),+ openContextPanelForFiles: () => {+ if (_autoOpenUserClosed) return;+ if (isClient) {+ storage.set(Key.COPILOT_CONTEXT_PANEL_OPEN, "true");+ storage.set(Key.COPILOT_CONTEXT_PANEL_TAB, "files");+ }+ set((state) => ({+ artifactPanel: {+ ...state.artifactPanel,+ isOpen: true,+ activeTab: "files",+ activeArtifact: null,+ history: [],+ },+ }));+ },+ openContextPanelForProgress: () => {+ if (_autoOpenUserClosed) return;+ if (isClient) {+ storage.set(Key.COPILOT_CONTEXT_PANEL_OPEN, "true");+ storage.set(Key.COPILOT_CONTEXT_PANEL_TAB, "progress");+ }+ set((state) => ({+ artifactPanel: {+ ...state.artifactPanel,+ isOpen: true,+ activeTab: "progress",+ activeArtifact: null,+ history: [],+ },+ }));+ },// ── Card-based auto-open actions ─────────────────────────────────registerArtifactForAutoOpen: (ref) => {+ // Auto-open is disabled — the drawer only opens on explicit click.+ // We still track the ID so we can upgrade activeArtifact metadata when+ // a richer ref (e.g. file-part with real MIME) arrives for the same id.if (_autoOpenKnownIds.has(ref.id)) {- // Already known — upgrade activeArtifact metadata if this ref is richer- // (e.g. file-part ref with real MIME replacing text-extracted null MIME).const active = get().artifactPanel.activeArtifact;if (active?.id === ref.id && !active.mimeType && ref.mimeType) {set((state) => ({@@ -333,9 +423,6 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({return;}_autoOpenKnownIds.add(ref.id);- if (!_autoOpenReady || _autoOpenUserClosed || ref.origin !== "agent")- return;- get().openArtifact(ref);},setAutoOpenReady: () => {_autoOpenReady = true;@@ -386,6 +473,9 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({storage.clean(Key.COPILOT_SOUND_ENABLED);storage.clean(Key.COPILOT_NOTIFICATION_BANNER_DISMISSED);storage.clean(Key.COPILOT_NOTIFICATION_DIALOG_DISMISSED);+ storage.clean(Key.COPILOT_CONTEXT_PANEL_OPEN);+ storage.clean(Key.COPILOT_CONTEXT_PANEL_TAB);+ storage.clean(Key.COPILOT_CONTEXT_PANEL_WIDTH);storage.clean(Key.COPILOT_ARTIFACT_PANEL_WIDTH);storage.clean(Key.COPILOT_COMPLETED_SESSIONS);storage.clean(Key.COPILOT_DRY_RUN);@@ -393,16 +483,16 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({storage.clean(Key.COPILOT_MODEL);set({completedSessionIDs: new Set<string>(),+ contextPanelWidth: DEFAULT_PANEL_WIDTH,+ artifactPanelWidth: DEFAULT_ARTIFACT_PANEL_WIDTH,isSearchOpen: false,isNotificationsEnabled: false,isSoundEnabled: true,artifactPanel: {isOpen: false,- isMinimized: false,- isMaximized: false,- width: DEFAULT_PANEL_WIDTH,activeArtifact: null,history: [],+ activeTab: "files",},copilotChatMode: "extended_thinking",copilotLlmModel: "standard",diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/tools/GenericTool/GenericTool.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/tools/GenericTool/GenericTool.tsxindex 694571de7a..9b80a98ec4 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/tools/GenericTool/GenericTool.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/tools/GenericTool/GenericTool.tsx@@ -20,6 +20,7 @@ import {TrashIcon,WarningDiamondIcon,} from "@phosphor-icons/react";+import { cn } from "@/lib/utils";import { MorphingTextAnimation } from "../../components/MorphingTextAnimation/MorphingTextAnimation";import { ToolAccordion } from "../../components/ToolAccordion/ToolAccordion";import {@@ -780,7 +781,7 @@ export function GenericTool({ part }: Props) {return (<div className="py-2">- <div className="flex items-center gap-2 text-sm text-muted-foreground">+ <div className="flex min-w-0 items-center gap-2 overflow-hidden text-xs text-muted-foreground"><ToolIconcategory={category}isStreaming={isStreaming}@@ -788,7 +789,7 @@ export function GenericTool({ part }: Props) {/><MorphingTextAnimationtext={text}- className={isError ? "text-red-500" : undefined}+ className={cn("min-w-0 flex-1", isError ? "text-red-500" : undefined)}/></div>diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotStream.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotStream.tsindex e10d4c40f0..0a58d784d6 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotStream.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotStream.ts@@ -422,6 +422,16 @@ export function useCopilotStream({}}, [sessionId, hydratedMessages, status, isReconnectScheduled]);+ // Mirror the live stream status onto the shared store so out-of-tree views+ // (workspace sidebar's Progress tab) can react to "agent is actively+ // working" without prop-drilling status through the layout. `sessionId` is a+ // dependency so the flag is re-synced on session change and the previous+ // session's "live" state never bleeds into the newly opened one.+ useEffect(() => {+ const isLive = status === "streaming" || status === "submitted";+ useCopilotStreamStore.getState().setStreaming(isLive);+ }, [status, sessionId]);+// Invalidate session + usage caches when the stream completes.// Reconnect counter/timer reset on the same transition is owned by// `useCopilotReconnect`, which watches `status` internally.diff --git a/autogpt_platform/frontend/src/app/globals.css b/autogpt_platform/frontend/src/app/globals.cssindex 7940c36bba..da6b90a8e9 100644--- a/autogpt_platform/frontend/src/app/globals.css+++ b/autogpt_platform/frontend/src/app/globals.css@@ -186,6 +186,14 @@ body[data-google-picker-open="true"] [data-dialog-content] {color: white;}+/* Markdown headings: rehype-autolink-headings wraps each heading's text in an+ <a>, which `prose` then underlines and recolors. Keep the anchor clickable+ but render it as plain heading text. */+.markdown-output :is(h1, h2, h3, h4, h5, h6) a {+ text-decoration: none;+ color: inherit;+}+/* CoPilot chat table styling — remove left/right borders, increase padding */[data-streamdown="table-wrapper"] table {border-left: none;diff --git a/autogpt_platform/frontend/src/components/ai-elements/conversation.tsx b/autogpt_platform/frontend/src/components/ai-elements/conversation.tsxindex cda40eb57f..d0ce043dd5 100644--- a/autogpt_platform/frontend/src/components/ai-elements/conversation.tsx+++ b/autogpt_platform/frontend/src/components/ai-elements/conversation.tsx@@ -13,7 +13,7 @@ export const Conversation = ({ className, ...props }: ConversationProps) => (<StickToBottomclassName={cn("relative flex-1 overflow-y-hidden", className)}initial="instant"- resize="smooth"+ resize="instant"role="log"{...props}/>@@ -82,7 +82,7 @@ export const ConversationScrollButton = ({const { isAtBottom, scrollToBottom } = useStickToBottomContext();const handleScrollToBottom = useCallback(() => {- scrollToBottom();+ scrollToBottom("instant");}, [scrollToBottom]);return (diff --git a/autogpt_platform/frontend/src/components/ai-elements/message.tsx b/autogpt_platform/frontend/src/components/ai-elements/message.tsxindex 60eb04207a..59f8a34e49 100644--- a/autogpt_platform/frontend/src/components/ai-elements/message.tsx+++ b/autogpt_platform/frontend/src/components/ai-elements/message.tsx@@ -356,8 +356,27 @@ export const MessageResponse = memo(<StreamdownclassName={cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&_pre]:!bg-white",+ "[&_a]:text-blue-500 [&_a]:no-underline hover:[&_a]:underline",+ // Raycast/Linear-style markdown tables — clean borders, subtle row+ // separators, light header, no outer-corner artifacts.+ "[&_table]:w-full [&_table]:border-separate [&_table]:border-spacing-0 [&_table]:border [&_table]:border-zinc-200 [&_table]:text-sm",+ "[&_thead]:bg-zinc-50",+ "[&_th]:border-b [&_th]:border-zinc-200 [&_th]:px-3 [&_th]:py-2 [&_th]:text-left [&_th]:font-medium [&_th]:text-zinc-600",+ "[&_td]:border-b [&_td]:border-zinc-100 [&_td]:px-3 [&_td]:py-2 [&_td]:align-top [&_td]:text-zinc-800",+ "[&_tbody_tr:last-child_td]:border-b-0",+ "[&_tbody_tr:hover_td]:bg-zinc-50/60",className,)}+ components={{+ // Tables can be wider than the chat column (long URLs, many columns).+ // Wrap in an overflow-x-auto div so the page never grows past the+ // chat container — the table scrolls internally instead.+ table: ({ children, ...tableProps }) => (+ <div className="my-4 max-w-full overflow-x-auto">+ <table {...tableProps}>{children}</table>+ </div>+ ),+ }}plugins={{ code, mermaid, math, cjk }}linkSafety={{enabled: true,diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsxindex dc0385f040..3428e375fd 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx@@ -69,6 +69,11 @@ export function Navbar() {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} />diff --git a/autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpForm/useTopUpForm.ts b/autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpForm/useTopUpForm.tsindex 0f712ccb12..8014b813d2 100644--- a/autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpForm/useTopUpForm.ts+++ b/autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpForm/useTopUpForm.ts@@ -8,6 +8,7 @@ import { z } from "zod";const topUpSchema = z.object({amount: z.number({ coerce: true, invalid_type_error: "Enter top-up amount" })+ .int("Enter a whole-dollar amount").min(5, "Top-ups start at $5. Please enter a higher amount."),});@@ -23,7 +24,7 @@ export function useTopUpForm() {async function submitTopUp(data: z.infer<typeof topUpSchema>) {setIsLoading(true);- await requestTopUp(data.amount * 100)+ await requestTopUp(Math.round(data.amount * 100)).catch(toastOnFail("request top-up")).finally(() => setIsLoading(false));}diff --git a/autogpt_platform/frontend/src/components/ui/dot-distortion-shader.tsx b/autogpt_platform/frontend/src/components/ui/dot-distortion-shader.tsxnew file mode 100644index 0000000000..4028baffda--- /dev/null+++ b/autogpt_platform/frontend/src/components/ui/dot-distortion-shader.tsx@@ -0,0 +1,376 @@+"use client";++import React, { useEffect, useRef, useCallback } from "react";+import { cn } from "@/lib/utils";++interface DotDistortionShaderProps {+ className?: string;+ dotGap?: number;+ dotSize?: number;+ dotColor?: string;+ glowColor?: string;+ backgroundColor?: string;+ mouseRadius?: number;+ distortionStrength?: number;+ breathingSpeed?: number;+ enableMouseInteraction?: boolean;+ opacity?: number;+ returnSpeed?: number;+ /** Render dots as a single static frame — no breathing, glow, or mouse-driven distortion. */+ isStatic?: boolean;+}++interface Dot {+ x: number;+ y: number;+ baseX: number;+ baseY: number;+ vx: number;+ vy: number;+ brightness: number;+ phase: number;+ breathingSpeed: number;+ glowIntensity: number;+ glowTarget: number;+ glowSpeed: number;+ nextGlowTime: number;+}++export const DotDistortionShader: React.FC<DotDistortionShaderProps> = ({+ className,+ dotGap = 16,+ dotSize = 1,+ dotColor = "var(--color-sky-700)",+ glowColor = "var(--color-sky-700)",+ backgroundColor,+ mouseRadius = 100,+ distortionStrength = 1,+ breathingSpeed = 1,+ enableMouseInteraction = true,+ opacity = 1,+ returnSpeed = 0.08,+ isStatic = false,+}) => {+ const canvasRef = useRef<HTMLCanvasElement>(null);+ const containerRef = useRef<HTMLDivElement>(null);+ const dotsRef = useRef<Dot[]>([]);+ const mouseRef = useRef({ x: -1000, y: -1000 });+ const prevMouseRef = useRef({ x: -1000, y: -1000 });+ const mouseVelocityRef = useRef({ x: 0, y: 0 });+ const rafRef = useRef<number>(0);+ const timeRef = useRef<number>(0);++ const initDots = useCallback(+ (width: number, height: number) => {+ const dots: Dot[] = [];+ const cols = Math.ceil(width / dotGap) + 2;+ const rows = Math.ceil(height / dotGap) + 2;+ const offsetX = (width % dotGap) / 2;+ const offsetY = (height % dotGap) / 2;++ for (let i = 0; i < cols; i++) {+ for (let j = 0; j < rows; j++) {+ const x = i * dotGap + offsetX;+ const y = j * dotGap + offsetY;++ const noiseVal =+ Math.sin(i * 0.3 + j * 0.2) * 0.3 ++ Math.sin(i * 0.7 - j * 0.5) * 0.2 ++ Math.sin((i + j) * 0.4) * 0.2 ++ Math.random() * 0.3;++ const brightness = Math.max(0.1, Math.min(1, 0.3 + noiseVal));++ dots.push({+ x,+ y,+ baseX: x,+ baseY: y,+ vx: 0,+ vy: 0,+ brightness,+ phase: Math.random() * Math.PI * 2,+ breathingSpeed: 0.5 + Math.random() * 0.5,+ glowIntensity: 0,+ glowTarget: 0,+ glowSpeed: 0.002 + Math.random() * 0.003,+ nextGlowTime: Math.random() * 3,+ });+ }+ }+ return dots;+ },+ [dotGap],+ );++ useEffect(() => {+ const canvas = canvasRef.current;+ const container = containerRef.current;+ if (!canvas || !container) return;++ const ctx = canvas.getContext("2d");+ if (!ctx) return;++ const resolveColor = (color: string) => {+ if (color.startsWith("var(")) {+ const varName = color.match(/var\(([^)]+)\)/)?.[1];+ if (varName) {+ return getComputedStyle(container).getPropertyValue(varName).trim();+ }+ }+ return color;+ };++ let stopped = false;+ const dpr = Math.max(1, window.devicePixelRatio || 1);++ let resolvedDotColor = resolveColor(dotColor);+ let resolvedGlowColor = resolveColor(glowColor);++ const resize = () => {+ const { width, height } = container.getBoundingClientRect();+ canvas.width = Math.floor(width * dpr);+ canvas.height = Math.floor(height * dpr);+ canvas.style.width = `${Math.floor(width)}px`;+ canvas.style.height = `${Math.floor(height)}px`;+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);+ dotsRef.current = initDots(width, height);+ resolvedDotColor = resolveColor(dotColor);+ resolvedGlowColor = resolveColor(glowColor);+ if (isStatic) requestAnimationFrame(drawStatic);+ };++ const drawStatic = () => {+ if (stopped) return;+ const { width, height } = container.getBoundingClientRect();+ ctx.clearRect(0, 0, width, height);+ ctx.shadowColor = "transparent";+ ctx.shadowBlur = 0;+ ctx.fillStyle = resolvedDotColor;+ for (const dot of dotsRef.current) {+ ctx.globalAlpha = dot.brightness * opacity;+ ctx.beginPath();+ ctx.arc(dot.baseX, dot.baseY, dotSize, 0, Math.PI * 2);+ ctx.fill();+ }+ };++ const ro = new ResizeObserver(resize);+ ro.observe(container);+ resize();+ if (isStatic) {+ drawStatic();+ return () => {+ stopped = true;+ ro.disconnect();+ };+ }++ let isFirstMouseEntry = true;++ const handleMouseMove = (e: MouseEvent) => {+ if (!enableMouseInteraction) return;+ const rect = container.getBoundingClientRect();+ const x = e.clientX - rect.left;+ const y = e.clientY - rect.top;++ if (x >= 0 && x <= rect.width && y >= 0 && y <= rect.height) {+ if (isFirstMouseEntry || mouseRef.current.x < 0) {+ mouseRef.current = { x, y };+ prevMouseRef.current = { x, y };+ mouseVelocityRef.current = { x: 0, y: 0 };+ isFirstMouseEntry = false;+ } else {+ prevMouseRef.current = { ...mouseRef.current };+ mouseRef.current = { x, y };++ mouseVelocityRef.current = {+ x: mouseRef.current.x - prevMouseRef.current.x,+ y: mouseRef.current.y - prevMouseRef.current.y,+ };+ }+ } else {+ mouseRef.current = { x: -1000, y: -1000 };+ mouseVelocityRef.current = { x: 0, y: 0 };+ }+ };++ window.addEventListener("mousemove", handleMouseMove);++ const handleVisibilityChange = () => {+ if (!document.hidden) {+ timeRef.current = 0;+ mouseVelocityRef.current = { x: 0, y: 0 };+ for (const dot of dotsRef.current) {+ dot.vx = 0;+ dot.vy = 0;+ dot.x = dot.baseX;+ dot.y = dot.baseY;+ dot.glowIntensity = 0;+ dot.glowTarget = 0;+ dot.nextGlowTime = Math.random() * 2;+ }+ }+ };+ document.addEventListener("visibilitychange", handleVisibilityChange);++ const draw = (timestamp: number) => {+ if (stopped) return;++ if (timeRef.current === 0) {+ timeRef.current = timestamp;+ rafRef.current = requestAnimationFrame(draw);+ return;+ }++ const dt = Math.min((timestamp - timeRef.current) / 16.67, 1.5);+ timeRef.current = timestamp;+ const { width, height } = container.getBoundingClientRect();++ ctx.clearRect(0, 0, width, height);+ ctx.globalAlpha = opacity;++ const time = timestamp * 0.001 * breathingSpeed;+ const timeSeconds = timestamp * 0.001;+ const mouseVelMagnitude = Math.sqrt(+ mouseVelocityRef.current.x ** 2 + mouseVelocityRef.current.y ** 2,+ );++ for (const dot of dotsRef.current) {+ if (timeSeconds >= dot.nextGlowTime) {+ if (dot.glowTarget === 0) {+ dot.glowTarget = 0.6 + Math.random() * 0.4;+ dot.glowSpeed = 0.001 + Math.random() * 0.002;+ } else {+ dot.glowTarget = 0;+ dot.glowSpeed = 0.0005 + Math.random() * 0.001;+ dot.nextGlowTime = timeSeconds + 1 + Math.random() * 3;+ }+ }++ const glowDiff = dot.glowTarget - dot.glowIntensity;+ dot.glowIntensity += glowDiff * dot.glowSpeed * dt * 60;++ if (dot.glowTarget > 0 && Math.abs(glowDiff) < 0.05) {+ dot.nextGlowTime = timeSeconds + 2 + Math.random() * 3;+ }++ const dx = mouseRef.current.x - dot.baseX;+ const dy = mouseRef.current.y - dot.baseY;+ const distance = Math.sqrt(dx * dx + dy * dy);++ if (+ distance < mouseRadius &&+ enableMouseInteraction &&+ mouseVelMagnitude > 0.5+ ) {+ const falloff = 1 - distance / mouseRadius;+ const strength = falloff * falloff * distortionStrength;++ dot.vx += mouseVelocityRef.current.x * strength * 0.3;+ dot.vy += mouseVelocityRef.current.y * strength * 0.3;+ }++ dot.x += dot.vx * dt;+ dot.y += dot.vy * dt;++ const springX = (dot.baseX - dot.x) * returnSpeed * dt;+ const springY = (dot.baseY - dot.y) * returnSpeed * dt;+ dot.x += springX;+ dot.y += springY;++ dot.vx *= 0.92;+ dot.vy *= 0.92;++ dot.vx += (dot.baseX - dot.x) * 0.02 * dt;+ dot.vy += (dot.baseY - dot.y) * 0.02 * dt;++ const breathingOffset =+ Math.sin(time * dot.breathingSpeed + dot.phase) * 0.15;+ const animatedBrightness = Math.max(+ 0.05,+ Math.min(1, dot.brightness + breathingOffset),+ );++ const displacement = Math.sqrt(+ (dot.x - dot.baseX) ** 2 + (dot.y - dot.baseY) ** 2,+ );+ const brightnessBoost = Math.min(0.5, displacement * 0.05);++ const randomGlowBoost = dot.glowIntensity * 0.7;++ const finalBrightness = Math.min(+ 1,+ animatedBrightness + brightnessBoost + randomGlowBoost,+ );++ const hasRandomGlow = dot.glowIntensity > 0.1;+ if (finalBrightness > 0.4 || hasRandomGlow) {+ const baseGlowIntensity = (finalBrightness - 0.4) / 0.6;+ const combinedGlowIntensity = Math.max(+ baseGlowIntensity,+ dot.glowIntensity,+ );+ ctx.shadowColor = resolvedGlowColor;+ ctx.shadowBlur = 10 + 20 * combinedGlowIntensity;+ } else {+ ctx.shadowColor = "transparent";+ ctx.shadowBlur = 0;+ }++ ctx.globalAlpha = finalBrightness * opacity;+ ctx.fillStyle = resolvedDotColor;+ ctx.beginPath();+ ctx.arc(dot.x, dot.y, dotSize, 0, Math.PI * 2);+ ctx.fill();+ }++ mouseVelocityRef.current.x *= 0.9;+ mouseVelocityRef.current.y *= 0.9;++ rafRef.current = requestAnimationFrame(draw);+ };++ rafRef.current = requestAnimationFrame(draw);++ return () => {+ stopped = true;+ cancelAnimationFrame(rafRef.current);+ window.removeEventListener("mousemove", handleMouseMove);+ document.removeEventListener("visibilitychange", handleVisibilityChange);+ ro.disconnect();+ };+ }, [+ dotGap,+ dotSize,+ dotColor,+ glowColor,+ mouseRadius,+ distortionStrength,+ breathingSpeed,+ enableMouseInteraction,+ opacity,+ returnSpeed,+ isStatic,+ initDots,+ ]);++ return (+ <div+ ref={containerRef}+ className={cn(+ "relative overflow-hidden bg-white dark:bg-black",+ className,+ )}+ style={{+ background: backgroundColor,+ }}+ >+ <canvas+ ref={canvasRef}+ className="absolute inset-0 h-full w-full"+ style={{ display: "block" }}+ />+ </div>+ );+};diff --git a/autogpt_platform/frontend/src/components/ui/text-generate-effect.tsx b/autogpt_platform/frontend/src/components/ui/text-generate-effect.tsxnew file mode 100644index 0000000000..fbb9ee5d49--- /dev/null+++ b/autogpt_platform/frontend/src/components/ui/text-generate-effect.tsx@@ -0,0 +1,62 @@+"use client";+import { useEffect } from "react";+import { motion, stagger, useAnimate } from "motion/react";+import { cn } from "@/lib/utils";++export const TextGenerateEffect = ({+ words,+ className,+ filter = true,+ duration = 0.5,+}: {+ words: string;+ className?: string;+ filter?: boolean;+ duration?: number;+}) => {+ const [scope, animate] = useAnimate();+ const wordsArray = words.split(" ");+ useEffect(() => {+ animate(+ "span",+ {+ opacity: 1,+ filter: filter ? "blur(0px)" : "none",+ },+ {+ duration: duration ? duration : 1,+ delay: stagger(0.08),+ },+ );+ }, [scope.current]);++ const renderWords = () => {+ return (+ <motion.div ref={scope}>+ {wordsArray.map((word, idx) => {+ return (+ <motion.span+ key={word + idx}+ className="text-black opacity-0 dark:text-white"+ style={{+ filter: filter ? "blur(10px)" : "none",+ }}+ >+ {word}{" "}+ </motion.span>+ );+ })}+ </motion.div>+ );+ };++ return (+ <div className={cn("font-bold", className)}>+ <div className="mt-4">+ <div className="text-2xl leading-snug tracking-wide text-black dark:text-white">+ {renderWords()}+ </div>+ </div>+ </div>+ );+};diff --git a/autogpt_platform/frontend/src/services/storage/local-storage.ts b/autogpt_platform/frontend/src/services/storage/local-storage.tsindex b949f0e5d9..f4e6b8e448 100644--- a/autogpt_platform/frontend/src/services/storage/local-storage.ts+++ b/autogpt_platform/frontend/src/services/storage/local-storage.ts@@ -16,6 +16,9 @@ export enum Key {COPILOT_NOTIFICATION_BANNER_DISMISSED = "copilot-notification-banner-dismissed",COPILOT_NOTIFICATION_DIALOG_DISMISSED = "copilot-notification-dialog-dismissed",COPILOT_ARTIFACT_PANEL_WIDTH = "copilot-artifact-panel-width",+ COPILOT_CONTEXT_PANEL_WIDTH = "copilot-context-panel-width",+ COPILOT_CONTEXT_PANEL_OPEN = "copilot-context-panel-open",+ COPILOT_CONTEXT_PANEL_TAB = "copilot-context-panel-tab",COPILOT_MODE = "copilot-mode",COPILOT_MODEL = "copilot-model",COPILOT_COMPLETED_SESSIONS = "copilot-completed-sessions",