AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
refactor(frontend): drop the new-tool-ui flag and commit to the tool chain UX (#14164)
Ubbe948b55ea8109
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotChatHost.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotChatHost.tsxindex d5a414993c..2d6bb762ef 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotChatHost.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotChatHost.tsx@@ -8,6 +8,9 @@ import { Icon } from "@/components/atoms/Icon/Icon";interface Props {droppedFiles: File[];onDroppedFilesConsumed: () => void;+ /** The new layout floats its sidebar/files controls over the chat's+ * top-left corner on small viewports. */+ hasFloatingControls?: boolean;}/**@@ -18,6 +21,7 @@ interface Props {export function CopilotChatHost({droppedFiles,onDroppedFilesConsumed,+ hasFloatingControls,}: Props) {const {sessionId,@@ -94,6 +98,7 @@ export function CopilotChatHost({isResolvingExpertIdentity={isResolvingExpertIdentity}isAdoptingExpertSession={isAdoptingExpertSession}isKickoffStarting={isKickoffStarting}+ hasFloatingControls={hasFloatingControls}/></div><RateLimitGatediff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsxindex d673ff2ddf..1bede44bd6 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx@@ -13,7 +13,6 @@ 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 { CopilotModals } from "./components/CopilotModals/CopilotModals";import { FileDropZone } from "./components/FileDropZone/FileDropZone";@@ -130,7 +129,6 @@ function MainArea({setDroppedFiles,}: MainAreaProps) {const hasSession = !!sessionId;- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);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]">@@ -165,11 +163,12 @@ function MainArea({key={`chat-host-${sessionId ?? "new"}`}droppedFiles={droppedFiles}onDroppedFilesConsumed={() => setDroppedFiles([])}+ hasFloatingControls={showNewLayout}/>{/* Mounted on mobile too: it owns the session-entry reset that- forgets the previous chat's artifact, and the new tool UI's- artifacts button lives in the chat column on every viewport.- Only the auto-opening is desktop-only. */}+ forgets the previous chat's artifact, and the chat column's+ artifacts button is mounted on every viewport. Only the+ auto-opening is desktop-only. */}{isArtifactsEnabled && (<ContextPanelAutoOpenkey={`context-auto-open-${sessionId ?? "new"}`}@@ -185,11 +184,6 @@ function MainArea({{!isMobile && isArtifactsEnabled && sessionId && (<ArtifactPanel hasExternalClose />)}- {/* Under the new tool UI the trigger lives inside the chat column,- beside the workspace-files card it opens. */}- {!isMobile && isArtifactsEnabled && sessionId && !isNewToolUI && (- <ContextPanelToggle />- )}</div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsxindex c480b2a971..04940ffe0a 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsx@@ -85,7 +85,6 @@ vi.mock("@/services/feature-flags/use-get-flag", () => ({ARTIFACTS: "ARTIFACTS",CHAT_MODE_OPTION: "CHAT_MODE_OPTION",TASK_PROGRESS_BAR: "TASK_PROGRESS_BAR",- NEW_TOOL_UI: "NEW_TOOL_UI",},useGetFlag: (flag: string) =>flag === "ARTIFACTS" ? flagState.artifacts : false,diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/compaction-progress.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/compaction-progress.test.tsxindex 9ce22fe149..9253fc7ec3 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/compaction-progress.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/compaction-progress.test.tsx@@ -367,7 +367,7 @@ describe("context compaction progress", () => {// (or, before it opens, the step-start marker) keeps `hasInflight`// true throughout the compaction turn, so this holds from the very// first chunk onward — not just once the bar is visible.- expect(screen.queryByText("Thinking...")).toBeNull();+ expect(screen.queryByText("Thinking…")).toBeNull();});});@@ -576,7 +576,7 @@ describe("context compaction progress", () => {// With the row closed, `hasInflight` is false — without the live-// compaction gate the ThinkingIndicator would stack its own spinner// and timer directly under the CompactionCard's.- expect(screen.queryByText("Thinking...")).toBeNull();+ expect(screen.queryByText("Thinking…")).toBeNull();});expect(screen.getByRole("progressbar")).toBeDefined();});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsxindex cc9ef56476..2f57e41e71 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expert-threads.test.tsx@@ -109,12 +109,6 @@ vi.mock(vi.mock("../components/ChatMessagesContainer/components/CopyButton", () => ({CopyButton: () => null,}));-vi.mock(- "../components/ChatMessagesContainer/components/CollapsedToolGroup",- () => ({- CollapsedToolGroup: () => null,- }),-);vi.mock("../components/ChatMessagesContainer/components/MessageAttachments",() => ({@@ -130,12 +124,6 @@ vi.mock(vi.mock("../components/ChatMessagesContainer/components/QueueBadge", () => ({QueueBadge: () => null,}));-vi.mock(- "../components/ChatMessagesContainer/components/ReasoningGroup",- () => ({- ReasoningGroup: () => null,- }),-);vi.mock("../components/ChatMessagesContainer/components/ThinkingIndicator",() => ({@@ -143,16 +131,10 @@ vi.mock(}),);vi.mock("../components/ChatMessagesContainer/helpers", () => ({- buildRenderSegments: () => [],getLatestCompactionPhase: () => null,getTurnMessages: () => [],isChainableToolPart: () => false,parseSpecialMarkers: () => ({ markerType: null }),- shouldShowTaskListNotice: () => false,- splitReasoningAndResponse: (parts: unknown[]) => ({- reasoning: [],- response: parts,- }),}));vi.mock("../components/JobStatsBar/TurnStatsBar", () => ({TurnStatsBar: () => null,@@ -731,8 +713,7 @@ describe("ChatMessagesContainer — expert identity", () => {expect(expertDetailRequests).toBe(0);});- it("wears the Autopilot identity on plain sessions under the new tool UI", () => {- flagState.values = { "hire-experts": true, "new-tool-ui": true };+ it("wears the Autopilot identity on plain sessions", () => {render(<ChatMessagesContainermessages={[assistantMessage]}@@ -747,20 +728,6 @@ describe("ChatMessagesContainer — expert identity", () => {expect(screen.queryByTestId("expert-schedules-button")).toBeNull();expect(screen.queryByTestId("expert-assistant-identity")).toBeNull();});-- it("renders no header for plain sessions on the old tool UI", () => {- render(- <ChatMessagesContainer- messages={[assistantMessage]}- status="ready"- error={undefined}- isLoading={false}- />,- );-- expect(screen.queryByTestId("expert-thread-header")).toBeNull();- expect(screen.queryByTestId("expert-assistant-identity")).toBeNull();- });});function RecipientPickerHarness() {diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/resume-hydrated-turn.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/resume-hydrated-turn.test.tsxindex f3eb4b3dad..daa87465f1 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/resume-hydrated-turn.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/resume-hydrated-turn.test.tsx@@ -35,17 +35,12 @@ vi.mock("@/lib/auth/hooks/useAuth", () => ({useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),}));-// The hydrated-tail trim in `resumeStreamFromStart` only runs under the new-// tool UI, so this suite must opt that flag in (every other flag stays off).vi.mock("@/services/feature-flags/use-get-flag", async (importActual) => {const actual =await importActual<typeof import("@/services/feature-flags/use-get-flag")>();- return {- ...actual,- useGetFlag: (flag: string) => flag === actual.Flag.NEW_TOOL_UI,- };+ return { ...actual, useGetFlag: () => false };});const EARLIER_PROMPT = "What is on my calendar";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 c623f1b92c..69b3c2319d 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@@ -232,14 +232,6 @@ describe("context panel open/close guards", () => {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);- });});describe("useCopilotUIStore", () => {@@ -546,6 +538,13 @@ describe("useCopilotUIStore localStorage initialisation", () => {const { useCopilotUIStore: fresh } = await import("../store");expect(fresh.getState().copilotLlmModel).toBe("advanced");});++ it("falls back to the files card for a persisted tab the sidebar no longer has", async () => {+ window.localStorage.setItem("copilot-context-panel-tab", "progress");+ vi.resetModules();+ const { useCopilotUIStore: fresh } = await import("../store");+ expect(fresh.getState().artifactPanel.activeTab).toBe("files");+ });});describe("lastArtifact session scoping", () => {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 e20e7b98e9..a8a9cdfacc 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@@ -2,17 +2,12 @@import { toast } from "@/components/molecules/Toast/use-toast";import { cn } from "@/lib/utils";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { useEffect } from "react";import type { ArtifactRef } from "../../store";import { useCopilotUIStore } from "../../store";import { downloadArtifact } from "../ArtifactPanel/downloadArtifact";import { classifyArtifact } from "../ArtifactPanel/helpers";-import {- ArrowRight01Icon,- Download01Icon,- Download04Icon,-} from "@hugeicons/core-free-icons";+import { ArrowRight01Icon, Download01Icon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";interface Props {@@ -62,9 +57,6 @@ export function ArtifactCard({ artifact, readOnly }: Props) {artifact.title,artifact.sizeBytes,);- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);- const cardShapeClass = isNewToolUI ? "min-w-0 rounded-2xl" : "rounded-lg";- const downloadIcon = isNewToolUI ? Download01Icon : Download04Icon;function handleDownloadOnly() {downloadArtifact(artifact).catch(() => {@@ -81,10 +73,7 @@ export function ArtifactCard({ artifact, readOnly }: Props) {<buttontype="button"onClick={handleDownloadOnly}- className={cn(- "my-1 flex w-full items-center gap-3 border border-zinc-200 bg-white px-3 py-2.5 text-left transition-colors animate-in fade-in slide-in-from-bottom-2 fill-mode-both [animation-duration:500ms] hover:bg-zinc-50",- cardShapeClass,- )}+ className="my-1 flex w-full min-w-0 items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2.5 text-left transition-colors animate-in fade-in slide-in-from-bottom-2 fill-mode-both [animation-duration:500ms] hover:bg-zinc-50"><Iconicon={classification.icon}@@ -103,7 +92,7 @@ export function ArtifactCard({ artifact, readOnly }: Props) {</p></div><Icon- icon={downloadIcon}+ icon={Download01Icon}size={16}className="shrink-0 text-zinc-400"/>@@ -116,8 +105,7 @@ export function ArtifactCard({ artifact, readOnly }: Props) {type="button"onClick={() => openArtifact(artifact)}className={cn(- "my-1 flex w-full items-center gap-3 border bg-white px-3 py-2.5 text-left transition-colors animate-in fade-in slide-in-from-bottom-2 fill-mode-both [animation-duration:500ms] hover:bg-zinc-50",- cardShapeClass,+ "my-1 flex w-full min-w-0 items-center gap-3 rounded-2xl border bg-white px-3 py-2.5 text-left transition-colors animate-in fade-in slide-in-from-bottom-2 fill-mode-both [animation-duration:500ms] hover:bg-zinc-50",isActive ? "border-violet-300 bg-violet-50/50" : "border-zinc-200",)}>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 01acb371fb..ee867553fe 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@@ -10,9 +10,9 @@ import { useArtifactPanel } from "./useArtifactPanel";interface Props {mobile?: boolean;- /** The desktop copilot chat renders its own sidebar-right close control- * under the new tool UI; standalone hosts (share viewer, tour, mobile- * drawer) do not, so their header keeps its Close button. */+ /** The desktop copilot chat renders its own sidebar-right close control;+ * standalone hosts (share viewer, tour, mobile drawer) do not, so their+ * header keeps its Close button. */hasExternalClose?: boolean;}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/__tests__/ArtifactPanel.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/__tests__/ArtifactPanel.test.tsxindex b76c536b51..d4ab80d999 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/__tests__/ArtifactPanel.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/__tests__/ArtifactPanel.test.tsx@@ -119,4 +119,26 @@ describe("ArtifactPanel (desktop) width clamping", () => {expect(getPanel().style.width).toBe(`${900 - PANEL_RESERVED_WIDTH}px`);});++ it("keeps the header Close button for standalone hosts", async () => {+ offsetWidthSpy = vi+ .spyOn(HTMLElement.prototype, "offsetWidth", "get")+ .mockReturnValue(2000);++ render(<ArtifactPanel />);++ expect(await screen.findByText("notes.txt")).toBeDefined();+ expect(screen.getByRole("button", { name: "Close" })).toBeDefined();+ });++ it("drops the header Close button when the host closes it externally", async () => {+ offsetWidthSpy = vi+ .spyOn(HTMLElement.prototype, "offsetWidth", "get")+ .mockReturnValue(2000);++ render(<ArtifactPanel hasExternalClose />);++ expect(await screen.findByText("notes.txt")).toBeDefined();+ expect(screen.queryByRole("button", { name: "Close" })).toBeNull();+ });});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 a93307eed1..090360b8af 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@@ -6,7 +6,6 @@ import {TooltipTrigger,} from "@/components/atoms/Tooltip/BaseTooltip";import { cn } from "@/lib/utils";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import type { ArtifactRef } from "../../../store";import type { ArtifactClassification } from "../helpers";import { SourceToggle } from "./SourceToggle";@@ -15,7 +14,6 @@ import {Cancel01Icon,Copy01Icon,Download01Icon,- Download04Icon,Folder01Icon,} from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";@@ -80,18 +78,10 @@ export function ArtifactPanelHeader({onSourceToggle,hasExternalClose = false,}: Props) {- // The new tool UI closes the panel from the chat's sidebar-right toggle,- // so the header drops its own Close button there.- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);- // New UI: h matches the chat thread header (36px avatar + py-2 + border)- // so the two top bars share one seam across the panel split.+ // Height matches the chat thread header (36px avatar + py-2 + border) so+ // the two top bars share one seam across the panel split.return (- <div- className={cn(- "sticky top-0 z-10 flex items-center gap-2 border-b border-b-[#80808017] bg-sidebar px-3",- isNewToolUI ? "h-[53px]" : "py-2",- )}- >+ <div className="sticky top-0 z-10 flex h-[53px] items-center gap-2 border-b border-b-[#80808017] bg-sidebar px-3">{/* Left section */}<div className="flex min-w-0 flex-1 items-center gap-2">{canGoBack && (@@ -130,15 +120,12 @@ export function ArtifactPanelHeader({</HeaderButton>)}<HeaderButton onClick={onDownload} title="Download">- <Icon- icon={isNewToolUI ? Download01Icon : Download04Icon}- size={16}- />+ <Icon icon={Download01Icon} size={16} /></HeaderButton><HeaderButton onClick={onOpenFiles} title="All files"><Icon icon={Folder01Icon} size={16} /></HeaderButton>- {(!isNewToolUI || !hasExternalClose) && (+ {!hasExternalClose && (<HeaderButton onClick={onClose} title="Close"><Icon icon={Cancel01Icon} size={16} /></HeaderButton>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 2d68167d78..b08daed956 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@@ -27,7 +27,7 @@ import { ArchivedExpertNotice } from "./components/ArchivedExpertNotice";import { SharedChatNotice } from "./components/SharedChatNotice";import { useAutoOpenArtifacts } from "./useAutoOpenArtifacts";import type { ExpertIdentity } from "../../useExpertMap";-import { useCopilotUIStore } from "../../store";+import { useAreWorkspaceFileCardsOpen } from "../../useAreWorkspaceFileCardsOpen";import {getKickoffAttemptToken,getKickoffExpertId,@@ -90,6 +90,9 @@ export interface ChatContainerProps {isAdoptingExpertSession?: boolean;/** True until a newly hired expert's first kickoff has been handed off. */isKickoffStarting?: boolean;+ /** The layout floats its sidebar/files controls over the chat's top-left+ * corner on small viewports; the thread header clears them. */+ hasFloatingControls?: boolean;}const NO_OP_SEND = () => undefined;@@ -124,23 +127,13 @@ export const ChatContainer = ({isResolvingExpertIdentity,isAdoptingExpertSession,isKickoffStarting,+ hasFloatingControls,}: ChatContainerProps) => {const isArtifactsEnabled = useGetFlag(Flag.ARTIFACTS);const isTaskBarEnabled = useGetFlag(Flag.TASK_PROGRESS_BAR);- // Old tool UI keeps its interactive in-transcript question card; the dock- // is the new-UI answering surface, so gate it to avoid double forms.- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);- // Mirrors the files card's visibility (useWorkspaceFileCards.isOpen): the- // composer only slides aside while the floating card is actually shown.- // New tool UI only — the old UI docks a side panel instead, which narrows- // the column by itself.- const areFilesOpen =- useCopilotUIStore(- (s) =>- s.artifactPanel.isOpen &&- s.artifactPanel.activeArtifact == null &&- s.artifactPanel.activeTab !== "artifacts",- ) && isNewToolUI;+ // The composer and the message column only slide aside while the floating+ // files card is shown; this host is the one that mounts the card.+ const areFilesOpen = useAreWorkspaceFileCardsOpen();useAutoOpenArtifacts({sessionId,messages,@@ -238,9 +231,7 @@ export const ChatContainer = ({return (<CopilotChatActionsProvider onSend={guardedOnSend}>- <PendingQuestionsContext.Provider- value={isNewToolUI ? getPendingQuestions(messages) : null}- >+ <PendingQuestionsContext.Provider value={getPendingQuestions(messages)}><LayoutGroup id="copilot-2-chat-layout"><div className="flex h-full min-h-0 w-full flex-col px-2 lg:px-0">{/* The chat column runs full width: the max-w-3xl cap lives on the@@ -248,7 +239,7 @@ export const ChatContainer = ({can span edge to edge while staying aligned with the messages. */}{sessionId ? (<div className="relative flex h-full min-h-0 w-full flex-col bg-[#fafafa]">- {isNewToolUI && isArtifactsEnabled && (+ {isArtifactsEnabled && (<><div className="absolute right-0 top-0 z-30"><ContextPanelToggle sessionId={sessionId} />@@ -274,6 +265,8 @@ export const ChatContainer = ({queuedMessages={queuedMessages}bottomContentPadding={usageCardHeight}expertIdentity={expertIdentity}+ hasFloatingControls={hasFloatingControls}+ areFilesOpen={areFilesOpen}/>{archivedExpertIdentity ? (<ArchivedExpertNoticediff --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 6e9b126fb7..1d7b2df3b1 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@@ -23,16 +23,11 @@ import { CopilotPendingReviews } from "../CopilotPendingReviews/CopilotPendingReimport type { TurnStatsMap } from "../../helpers/convertChatSessionToUiMessages";import { revealKickoffMessages } from "../../expertKickoff";import {- buildRenderSegments,getLastCompactionCallId,getLatestCompactionPhase,getLatestCompactionStats,getTurnMessages,- type MessagePart,- type RenderSegment,parseSpecialMarkers,- shouldShowTaskListNotice,- splitReasoningAndResponse,} from "./helpers";import {getLatestAssistantStatusMessage,@@ -40,35 +35,21 @@ import {} from "../../messageParts";import { RESTORE_STALL_TIMEOUT_MS } from "../../restoreConstants";import type { ExpertIdentity } from "../../useExpertMap";-import { useCopilotUIStore } from "../../store";import { ChatMinimap } from "../ChatMinimap/ChatMinimap";-import type {- CompactionPhase,- CompactionStats,-} from "../CompactionCard/helpers";import { WorkCard } from "../WorkCard/WorkCard";import { getWorkRunMetadata, toPreview } from "../WorkCard/helpers";import { AssistantMessageActions } from "./components/AssistantMessageActions";import { ChainMessageParts } from "./components/ChainMessageParts";import { CopyButton } from "./components/CopyButton";-import { CollapsedToolGroup } from "./components/CollapsedToolGroup";-import { ExpertAvatar } from "./components/ExpertAvatar/ExpertAvatar";-import { ExpertSchedulesButton } from "./components/ExpertSchedulesButton/ExpertSchedulesButton";import { MessageAttachments } from "./components/MessageAttachments";import { MessagePartRenderer } from "./components/MessagePartRenderer";import { QueueBadge } from "./components/QueueBadge";-import { ReasoningGroup } from "./components/ReasoningGroup";-import { StepsCollapse } from "./components/StepsCollapse";-import { TaskListNotice } from "./components/TaskListNotice";+import { ThreadHeader } from "./components/ThreadHeader";import { ThinkingIndicator } from "./components/ThinkingIndicator";import { UserMessageClamp } from "./components/UserMessageClamp";-import { getLatestTaskList } from "../TaskProgressBar/helpers";import { Clock01Icon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";-// Autopilot's product-facing title when a session carries no expert identity.-const DEFAULT_EXPERT_ROLE = "Head of AI";-interface Props {messages: UIMessage<unknown, UIDataTypes, UITools>[];status: string;@@ -114,63 +95,14 @@ interface Props {/** Expert identity for expert-scoped sessions: drives the thread header* and the assistant avatar/name. Null/undefined = default header. */expertIdentity?: ExpertIdentity | null;-}--interface RenderSegmentOptions {- onRetry?: () => void;- fileUrlBuilder?: (fileId: string) => string;- forceArtifacts?: boolean;- readOnly?: boolean;- compactionPhase?: CompactionPhase | null;- liveCompactionCallId?: string | null;- liveCompactionStats?: CompactionStats;- isCurrentlyStreaming?: boolean;-}--function renderSegments(- segments: RenderSegment[],- messageID: string,- options: RenderSegmentOptions = {},-): React.ReactNode[] {- const {- onRetry,- fileUrlBuilder,- forceArtifacts,- readOnly,- compactionPhase,- liveCompactionCallId,- liveCompactionStats,- isCurrentlyStreaming,- } = options;- return segments.map((seg, segIdx) => {- if (seg.kind === "collapsed-group") {- return <CollapsedToolGroup key={`group-${segIdx}`} parts={seg.parts} />;- }- if (seg.kind === "reasoning-group") {- return (- <ReasoningGroup- key={`${messageID}-reasoning-${seg.index}`}- parts={seg.parts}- />- );- }- return (- <MessagePartRenderer- key={`${messageID}-${seg.index}`}- part={seg.part}- messageID={messageID}- partIndex={seg.index}- onRetry={onRetry}- fileUrlBuilder={fileUrlBuilder}- forceArtifacts={forceArtifacts}- readOnly={readOnly}- compactionPhase={compactionPhase}- liveCompactionCallId={liveCompactionCallId}- liveCompactionStats={liveCompactionStats}- isCurrentlyStreaming={isCurrentlyStreaming}- />- );- });+ /** The layout floats its sidebar/files controls over the chat's top-left+ * corner on small viewports (see ThreadHeader). */+ hasFloatingControls?: boolean;+ /** The host's floating workspace-files card is open, so the header and+ * the column slide aside for it. Only the copilot chat mounts that card;+ * every other host (share viewer, memory and builder panels) leaves this+ * off, whatever the persisted panel state says. */+ areFilesOpen?: boolean;}/**@@ -369,40 +301,15 @@ export function ChatMessagesContainer({filePattern,fileUrlBuilder,expertIdentity,+ hasFloatingControls = false,+ areFilesOpen = false,}: Props) {const messages = useMemo(() => revealKickoffMessages(allMessages),[allMessages],);- // The in-chat "progress in the sidebar" notice only applies to the old- // sidebar surface — hide it entirely when the task bar is on.- const isTaskBarEnabled = useGetFlag(Flag.TASK_PROGRESS_BAR);- const isContextPanelEnabled = useGetFlag(Flag.ARTIFACTS);// Bubble restyle ships with the brain-dump experience.const isBrainDumpEnabled = useGetFlag(Flag.ONBOARDING_BRAIN_DUMP);- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);- // The workspace-files card floats over the column's right side, so the- // centred content slides left to make room for it. The docked artifacts- // panel already narrows the column on its own, so it must never also- // trigger this slide, or the two shifts stack and push the messages off- // screen under the app sidebar. New tool UI only: the old UI's files tab- // IS the docked panel.- const areFilesOpen =- useCopilotUIStore(- (s) =>- s.artifactPanel.isOpen &&- s.artifactPanel.activeArtifact == null &&- s.artifactPanel.activeTab !== "artifacts",- ) && isNewToolUI;- const isChatStreaming = status === "streaming" || status === "submitted";- const hasActiveTaskList =- !isTaskBarEnabled &&- shouldShowTaskListNotice({- isContextPanelEnabled,- isChatStreaming,- latestTaskList: getLatestTaskList(messages),- });-// 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);@@ -484,13 +391,14 @@ export function ChatMessagesContainer({// more recent content part (in which case the model has moved on and the// status is stale).const latestStatusMessage = getLatestAssistantStatusMessage(messages);+ const isActivelyStreaming = status === "streaming" || status === "submitted";// A live compaction narrates itself via CompactionCard — the generic// Thinking indicator must not stack a second spinner and timer under it.// The `rebuilding` phase arrives after the tool row has already closed,// so `hasInflight` alone cannot cover that window.const liveCompactionPhase =- isChatStreaming && lastMessage?.role === "assistant"+ isActivelyStreaming && lastMessage?.role === "assistant"? getLatestCompactionPhase(lastMessage.parts): null;@@ -502,7 +410,6 @@ export function ChatMessagesContainer({!isRestoringActiveSession &&liveCompactionPhase === null &&(status === "submitted" || (status === "streaming" && !hasInflight));- const isActivelyStreaming = status === "streaming" || status === "submitted";const { elapsedSeconds } = useElapsedTimer(isActivelyStreaming,activeStreamStartedAt,@@ -512,10 +419,11 @@ export function ChatMessagesContainer({active={showThinking}elapsedSeconds={elapsedSeconds}statusMessage={latestStatusMessage}- variant={isNewToolUI ? "chain" : "legacy"}/>);- const showIndicator = showThinking;+ // Public viewers of a shared chat never see a live turn, so the indicator+ // stays out of the transcript for them wherever it would render.+ const showIndicator = !readOnly && showThinking;const [showRestoreFallback, setShowRestoreFallback] = useState(false);useEffect(() => {if (!isRestoringActiveSession) {@@ -549,70 +457,13 @@ export function ChatMessagesContainer({return (<>- {/* Sits above the scroller rather than sticky inside it, so the bar- spans the full chat width while its row stays aligned with the- max-w-3xl message column. Under the new tool UI an expert session- wears the expert's identity and every other session is Autopilot's,- so the thread is never anonymous; the old UI keeps its header for- expert sessions only. */}- {isNewToolUI ? (- <div- data-testid="expert-thread-header"- className="z-10 w-full border-b border-b-[#80808017] bg-[#fafafa]/80 backdrop-blur-md"- >- <div- className={cn(- "ease-[cubic-bezier(0.32,0.72,0,1)] mx-auto flex w-full max-w-3xl items-center gap-2 px-6 py-2 transition-transform duration-300 will-change-transform motion-reduce:transition-none",- areFilesOpen && "xl:-translate-x-40",- )}- >- <ExpertAvatar- name={expertIdentity?.name ?? "Autopilot"}- avatarUrl={expertIdentity?.avatarUrl ?? null}- isAutopilot={!expertIdentity}- />- <div className="flex min-w-0 flex-col">- <span className="truncate text-sm font-medium text-zinc-800">- {expertIdentity?.name ?? "Autopilot"}- </span>- <span className="truncate text-xs text-zinc-500">- {expertIdentity?.role ?? DEFAULT_EXPERT_ROLE}- </span>- </div>- {expertIdentity && !readOnly && !expertIdentity.isArchived && (- <ExpertSchedulesButton- expertId={expertIdentity.id}- expertName={expertIdentity.name}- />- )}- </div>- </div>- ) : (- expertIdentity && (- <div- data-testid="expert-thread-header"- className="z-10 w-full border-b border-zinc-200/60 bg-[#fafafa]/80 backdrop-blur-md"- >- <div className="mx-auto flex w-full max-w-3xl items-center gap-2 px-6 pb-3 pt-4">- <ExpertAvatar- name={expertIdentity.name}- avatarUrl={expertIdentity.avatarUrl}- size="sm"- />- <span className="text-sm font-medium text-zinc-800">- {expertIdentity.name}- </span>- {!readOnly && !expertIdentity.isArchived && (- <ExpertSchedulesButton- expertId={expertIdentity.id}- expertName={expertIdentity.name}- />- )}- </div>- </div>- )- )}- {isNewToolUI && <ChatMinimap messages={messages} />}+ <ThreadHeader+ expertIdentity={expertIdentity}+ readOnly={readOnly}+ areFilesOpen={areFilesOpen}+ hasFloatingControls={hasFloatingControls}+ />+ <ChatMinimap messages={messages} /><Conversationkey={sessionID ?? "new"}resize="instant"@@ -739,30 +590,6 @@ export function ChatMessagesContainer({(p): p is FileUIPart => p.type === "file",);- // For finalized assistant messages, split into reasoning + response.- // During streaming, show everything normally with tool collapsing.- // The new tool UI renders chains inline instead, so it skips the- // reasoning split (and its "Show steps" modal) entirely.- const isFinalized =- !isNewToolUI &&- message.role === "assistant" &&- !isCurrentlyStreaming;- const { reasoning, response } = isFinalized- ? splitReasoningAndResponse(renderableParts)- : { reasoning: [] as MessagePart[], response: renderableParts };- const hasReasoning = reasoning.length > 0;-- // Note: when interactive tools are pinned from reasoning into response,- // this index approximates their position (used only for React keys).- const responseStartIndex = renderableParts.length - response.length;- const responseSegments =- message.role === "assistant"- ? buildRenderSegments(response, responseStartIndex)- : null;- const reasoningSegments = hasReasoning- ? buildRenderSegments(reasoning, 0)- : null;-return (<Messagefrom={message.role}@@ -777,24 +604,12 @@ export function ChatMessagesContainer({? "group-[.is-user]:rounded-3xl group-[.is-user]:bg-gradient-to-br group-[.is-user]:from-[#f3edff] group-[.is-user]:to-[#e4d4ff] group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-[#3b1e75] group-[.is-user]:[border-bottom-right-radius:0.5rem] ": "group-[.is-user]:rounded-xl group-[.is-user]:bg-purple-100 group-[.is-user]:px-3 group-[.is-user]:py-2.5 group-[.is-user]:text-slate-900 group-[.is-user]:[border-bottom-right-radius:0] ") +"group-[.is-user]:[&_h1]:text-lg group-[.is-user]:[&_h1]:font-semibold group-[.is-user]:[&_h2]:text-lg group-[.is-user]:[&_h2]:font-semibold group-[.is-user]:[&_h3]:text-lg group-[.is-user]:[&_h3]:font-semibold group-[.is-user]:[&_h4]:text-lg group-[.is-user]:[&_h4]:font-semibold group-[.is-user]:[&_h5]:text-lg group-[.is-user]:[&_h5]:font-semibold group-[.is-user]:[&_h6]:text-lg group-[.is-user]:[&_h6]:font-semibold " +- "group-[.is-assistant]:bg-transparent group-[.is-assistant]:text-slate-900" +// Chain hover pills use negative margins that the base// overflow-hidden would clip.- (isNewToolUI- ? " group-[.is-assistant]:overflow-visible"- : "")+ "group-[.is-assistant]:overflow-visible group-[.is-assistant]:bg-transparent group-[.is-assistant]:text-slate-900"}>- {hasReasoning && reasoningSegments && (- <StepsCollapse>- {renderSegments(reasoningSegments, message.id, {- fileUrlBuilder,- forceArtifacts: readOnly,- readOnly,- })}- </StepsCollapse>- )}- {isAssistant && isNewToolUI ? (+ {isAssistant ? (<ChainMessagePartsparts={renderableParts}messageID={message.id}@@ -807,26 +622,14 @@ export function ChatMessagesContainer({liveCompactionCallId={liveCompactionCallId}liveCompactionStats={liveCompactionStats}/>- ) : responseSegments ? (- renderSegments(responseSegments, message.id, {- onRetry: isLastAssistant ? onRetry : undefined,- fileUrlBuilder,- forceArtifacts: readOnly,- readOnly,- compactionPhase,- liveCompactionCallId,- liveCompactionStats,- isCurrentlyStreaming,- })) : (- (() => {- const parts = renderableParts.map((part, i) => (+ <UserMessageClamp>+ {renderableParts.map((part, i) => (<MessagePartRendererkey={`${message.id}-${i}`}part={part}messageID={message.id}partIndex={i}- onRetry={isLastAssistant ? onRetry : undefined}fileUrlBuilder={fileUrlBuilder}forceArtifacts={readOnly}readOnly={readOnly}@@ -835,13 +638,8 @@ export function ChatMessagesContainer({liveCompactionStats={liveCompactionStats}isCurrentlyStreaming={isCurrentlyStreaming}/>- ));- return isNewToolUI ? (- <UserMessageClamp>{parts}</UserMessageClamp>- ) : (- parts- );- })()+ ))}+ </UserMessageClamp>)}{isLastInTurn && !isCurrentlyStreaming && (<TurnStatsBar@@ -874,13 +672,7 @@ export function ChatMessagesContainer({);})()}{message.role === "user" && textParts.length > 0 && (- <MessageActions- className={cn(- "mt-1 items-center justify-end gap-2",- !isNewToolUI &&- "opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",- )}- >+ <MessageActions className="mt-1 items-center justify-end gap-2">{(() => {const createdAt = turnStats?.get(message.id)?.createdAt;if (!createdAt) return null;@@ -916,13 +708,7 @@ export function ChatMessagesContainer({/>)}{readOnly && showActions && (- <MessageActions- className={cn(- "mt-1 items-center justify-start gap-2",- !isNewToolUI &&- "opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",- )}- >+ <MessageActions className="mt-1 items-center justify-start gap-2"><CopyButtontext={textParts.map((p) => p.text).join("\n")}/>@@ -931,12 +717,7 @@ export function ChatMessagesContainer({</Message>);})}- {!readOnly && hasActiveTaskList && (- <div className="px-1">- <TaskListNotice />- </div>- )}- {!readOnly && showIndicator && lastMessage?.role !== "assistant" && (+ {showIndicator && lastMessage?.role !== "assistant" && (<Messagefrom="assistant"className="duration-300 animate-in fade-in slide-in-from-bottom-2 fill-mode-both"@@ -957,7 +738,6 @@ export function ChatMessagesContainer({statusMessage={restoreStatusMessage ?? "Reconnecting to live stream..."}- variant={isNewToolUI ? "chain" : "legacy"}/><span className="pl-6 text-xs text-slate-400">Still syncing the latest progress.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 781fe2ac54..834a9dec27 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@@ -4,18 +4,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { ChatMessagesContainer } from "../ChatMessagesContainer";import { buildKickoffMessage } from "../../../expertKickoff";-const flagState = vi.hoisted(() => ({ newToolUI: false }));-vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {const actual =await importOriginal<typeof import("@/services/feature-flags/use-get-flag")>();- return {- ...actual,- useGetFlag: (flag: string) =>- flag === actual.Flag.NEW_TOOL_UI ? flagState.newToolUI : false,- };+ return { ...actual, useGetFlag: () => false };});const mockScrollEl = {@@ -85,9 +79,6 @@ vi.mock("../components/QueueBadge", () => ({}));vi.mock("../components/CopyButton", () => ({ CopyButton: () => null }));-vi.mock("../components/CollapsedToolGroup", () => ({- CollapsedToolGroup: () => null,-}));vi.mock("../components/MessageAttachments", () => ({MessageAttachments: () => null,}));@@ -116,7 +107,6 @@ vi.mock("../../CopilotPendingReviews/CopilotPendingReviews", () => ({}));// Tests below override this default by re-mocking ../helpers as needed.vi.mock("../helpers", () => ({- buildRenderSegments: () => [],getLatestCompactionPhase: () => null,getTurnMessages: () => [],isChainableToolPart: () => false,@@ -132,11 +122,6 @@ vi.mock("../helpers", () => ({}return { markerType: null };},- shouldShowTaskListNotice: () => false,- splitReasoningAndResponse: (parts: unknown[]) => ({- reasoning: [],- response: parts,- }),}));vi.mock("@/components/atoms/LoadingSpinner/LoadingSpinner", () => ({@@ -177,7 +162,7 @@ const baseProps = {onRetry: vi.fn(),};-describe("ChatMessagesContainer — tool UI dispatch", () => {+describe("ChatMessagesContainer — assistant rendering", () => {const messages = [{id: "assistant-tools",@@ -187,24 +172,38 @@ describe("ChatMessagesContainer — tool UI dispatch", () => {];afterEach(() => {- flagState.newToolUI = false;cleanup();});- it("uses chain rendering when the new tool UI flag is enabled", () => {- flagState.newToolUI = true;-+ it("renders assistant messages through the chain renderer", () => {render(<ChatMessagesContainer {...baseProps} messages={messages} />);expect(screen.getByTestId("chain-message-parts")).toBeDefined();});- it("keeps the legacy renderer when the flag is off", () => {- flagState.newToolUI = false;+ it("shows the thinking indicator inside a submitted assistant turn", () => {+ render(+ <ChatMessagesContainer+ {...baseProps}+ messages={messages}+ status="submitted"+ />,+ );- render(<ChatMessagesContainer {...baseProps} messages={messages} />);+ expect(screen.getByTestId("thinking-indicator")).toBeDefined();+ });++ it("keeps the thinking indicator out of a read-only transcript", () => {+ render(+ <ChatMessagesContainer+ {...baseProps}+ messages={messages}+ status="submitted"+ readOnly+ />,+ );- expect(screen.queryByTestId("chain-message-parts")).toBeNull();+ expect(screen.queryByTestId("thinking-indicator")).toBeNull();});});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 e1e0f08380..e1a6ec35ef 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@@ -1,338 +1,26 @@import { describe, expect, it } from "vitest";import {WORKSPACE_FILE_PATTERN,- buildRenderSegments,extractWorkspaceArtifacts,filePartToArtifactRef,getLatestCompactionPhase,getLatestCompactionStats,getMessageArtifacts,getMostRecentArtifact,- isCompletedToolPart,- isInteractiveToolPart,- isReasoningToolPart,parseSpecialMarkers,resolveWorkspaceUrls,- shouldShowTaskListNotice,- splitReasoningAndResponse,} from "../helpers";import type { MessagePart } from "../helpers";import type { FileUIPart, UIDataTypes, UIMessage, UITools } from "ai";-import type { TodoItem } from "../../TaskProgressBar/helpers";function textPart(text: string): MessagePart {return { type: "text", text } as MessagePart;}-function reasoningPart(text: string): MessagePart {- return { type: "reasoning", text, state: "done" } as MessagePart;-}-function stepStartPart(): MessagePart {return { type: "step-start" } as MessagePart;}-function toolPart(- toolName: string,- state: string = "output-available",- output: unknown = "{}",-): MessagePart {- return {- type: `tool-${toolName}`,- state,- toolCallId: `call-${toolName}`,- toolName,- args: {},- output,- } as unknown as MessagePart;-}--function interactiveToolPart(- toolName: string,- responseType: string,-): MessagePart {- return {- type: `tool-${toolName}`,- state: "output-available",- toolCallId: `call-${toolName}`,- toolName,- args: {},- output: { type: responseType },- } as unknown as MessagePart;-}--describe("isCompletedToolPart", () => {- it("returns true for output-available tool part", () => {- const part = toolPart("some_tool", "output-available");- expect(isCompletedToolPart(part)).toBe(true);- });-- it("returns true for output-error tool part", () => {- const part = toolPart("some_tool", "output-error");- expect(isCompletedToolPart(part)).toBe(true);- });-- it("returns false for input-streaming tool part", () => {- const part = toolPart("some_tool", "input-streaming");- expect(isCompletedToolPart(part)).toBe(false);- });-- it("returns false for text part", () => {- const part = textPart("hello");- expect(isCompletedToolPart(part)).toBe(false);- });-});--describe("isInteractiveToolPart", () => {- it("returns true for task_decomposition type", () => {- const part = toolPart("decompose_goal", "output-available", {- type: "task_decomposition",- message: "Plan",- goal: "Build agent",- steps: [],- step_count: 0,- });- expect(isInteractiveToolPart(part)).toBe(true);- });-- it("returns true for setup_requirements type", () => {- const part = toolPart("run_mcp_tool", "output-available", {- type: "setup_requirements",- message: "Setup needed",- });- expect(isInteractiveToolPart(part)).toBe(true);- });-- it("returns true for agent_details type", () => {- const part = toolPart("find_agent", "output-available", {- type: "agent_details",- });- expect(isInteractiveToolPart(part)).toBe(true);- });-- it("returns false for non-interactive output type", () => {- const part = toolPart("some_tool", "output-available", {- type: "generic_output",- });- expect(isInteractiveToolPart(part)).toBe(false);- });-- it("returns false when state is not output-available", () => {- const part = toolPart("decompose_goal", "input-streaming", {- type: "task_decomposition",- });- expect(isInteractiveToolPart(part)).toBe(false);- });-- it("returns false for non-tool parts", () => {- const part = textPart("hello");- expect(isInteractiveToolPart(part)).toBe(false);- });-- it("returns false when output is null", () => {- const part = toolPart("decompose_goal", "output-available", null);- expect(isInteractiveToolPart(part)).toBe(false);- });-- it("handles JSON-encoded string output", () => {- const part = toolPart(- "decompose_goal",- "output-available",- JSON.stringify({ type: "task_decomposition" }),- );- expect(isInteractiveToolPart(part)).toBe(true);- });-- it("returns false for invalid JSON string output", () => {- const part = toolPart(- "decompose_goal",- "output-available",- "not valid json",- );- expect(isInteractiveToolPart(part)).toBe(false);- });-});--describe("buildRenderSegments", () => {- it("returns individual segments for custom tool types", () => {- const parts = [- toolPart("decompose_goal", "output-available", {- type: "task_decomposition",- }),- ];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(1);- expect(segments[0].kind).toBe("part");- });-- it("collapses consecutive generic completed tool parts", () => {- const parts = [- toolPart("unknown_tool_a", "output-available"),- toolPart("unknown_tool_b", "output-available"),- ];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(1);- expect(segments[0].kind).toBe("collapsed-group");- if (segments[0].kind === "collapsed-group") {- expect(segments[0].parts).toHaveLength(2);- }- });-- it("does not collapse custom tool types into groups", () => {- const parts = [- toolPart("decompose_goal", "output-available", {- type: "task_decomposition",- }),- toolPart("create_agent", "output-available"),- ];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(2);- expect(segments[0].kind).toBe("part");- expect(segments[1].kind).toBe("part");- });-- it("renders text parts individually", () => {- const parts = [textPart("Hello"), textPart("World")];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(2);- expect(segments.every((s) => s.kind === "part")).toBe(true);- });-- it("handles mixed custom tools, generic tools, and text", () => {- const parts = [- textPart("Plan:"),- toolPart("decompose_goal", "output-available"),- toolPart("generic_a", "output-available"),- toolPart("generic_b", "output-available"),- textPart("Done"),- ];- const segments = buildRenderSegments(parts);-- expect(segments[0].kind).toBe("part");- expect(segments[1].kind).toBe("part");- expect(segments[2].kind).toBe("collapsed-group");- expect(segments[3].kind).toBe("part");- });-- it("does not collapse a single generic tool part", () => {- const parts = [toolPart("generic_a", "output-available")];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(1);- expect(segments[0].kind).toBe("part");- });-- it("never collapses connect_integration into a tool group", () => {- // The sign-in card must stay individually rendered — folding it into a- // collapsed group hides the card behind a "N tool calls" summary.- const parts = [- toolPart("generic_a", "output-available"),- toolPart("connect_integration", "output-available", {- type: "setup_requirements",- message: "Connect GitHub",- }),- toolPart("generic_b", "output-available"),- ];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(3);- expect(segments.every((s) => s.kind === "part")).toBe(true);- });-- it("preserves baseIndex offset in part segments", () => {- const parts = [textPart("Hello")];- const segments = buildRenderSegments(parts, 5);- expect(segments).toHaveLength(1);- if (segments[0].kind === "part") {- expect(segments[0].index).toBe(5);- }- });-- it("collapses consecutive reasoning parts into one reasoning-group", () => {- const parts = [- reasoningPart("Thinking step 1"),- reasoningPart("Thinking step 2"),- reasoningPart("Thinking step 3"),- ];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(1);- expect(segments[0].kind).toBe("reasoning-group");- if (segments[0].kind === "reasoning-group") {- expect(segments[0].parts).toHaveLength(3);- }- });-- it("wraps a single reasoning part in a reasoning-group for stable identity", () => {- const parts = [reasoningPart("Lone thought")];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(1);- expect(segments[0].kind).toBe("reasoning-group");- if (segments[0].kind === "reasoning-group") {- expect(segments[0].parts).toHaveLength(1);- }- });-- it("breaks reasoning groups around interleaved text", () => {- const parts = [- reasoningPart("a"),- reasoningPart("b"),- textPart("Status update"),- reasoningPart("c"),- reasoningPart("d"),- ];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(3);- expect(segments[0].kind).toBe("reasoning-group");- expect(segments[1].kind).toBe("part");- expect(segments[2].kind).toBe("reasoning-group");- });-- it("does not merge reasoning parts and generic tools together", () => {- const parts = [- reasoningPart("a"),- reasoningPart("b"),- toolPart("generic_a", "output-available"),- toolPart("generic_b", "output-available"),- ];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(2);- expect(segments[0].kind).toBe("reasoning-group");- expect(segments[1].kind).toBe("collapsed-group");- });-- it("uses the first part's absolute index as the reasoning-group index", () => {- const parts = [reasoningPart("a"), reasoningPart("b")];- const segments = buildRenderSegments(parts, 3);- expect(segments).toHaveLength(1);- if (segments[0].kind === "reasoning-group") {- expect(segments[0].index).toBe(3);- }- });-- it("treats step-start markers as transparent so reasoning stays grouped", () => {- const parts = [- reasoningPart("turn 1"),- stepStartPart(),- reasoningPart("turn 2"),- ];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(1);- expect(segments[0].kind).toBe("reasoning-group");- if (segments[0].kind === "reasoning-group") {- expect(segments[0].parts).toHaveLength(2);- }- });-- it("treats step-start markers as transparent within tool groups", () => {- const parts = [- toolPart("generic_a", "output-available"),- stepStartPart(),- toolPart("generic_b", "output-available"),- ];- const segments = buildRenderSegments(parts);- expect(segments).toHaveLength(1);- expect(segments[0].kind).toBe("collapsed-group");- });-});-describe("parseSpecialMarkers", () => {it("returns null marker for plain text", () => {const result = parseSpecialMarkers("Hello world");@@ -480,321 +168,6 @@ describe("filePartToArtifactRef", () => {});});-describe("isReasoningToolPart", () => {- it("returns true for reasoning/search tools", () => {- const reasoningTools = [- "find_block",- "find_agent",- "find_library_agent",- "search_docs",- "get_doc_page",- "search_feature_requests",- "ask_question",- ];- for (const name of reasoningTools) {- expect(isReasoningToolPart(toolPart(name))).toBe(true);- }- });-- it("returns false for action tools", () => {- const actionTools = [- "run_block",- "run_agent",- "create_agent",- "edit_agent",- "run_mcp_tool",- "schedule_agent",- "continue_run_block",- ];- for (const name of actionTools) {- expect(isReasoningToolPart(toolPart(name))).toBe(false);- }- });-- it("returns false for text parts", () => {- expect(isReasoningToolPart(textPart("hello"))).toBe(false);- });-});--describe("splitReasoningAndResponse", () => {- it("returns all parts as response when there are no tools", () => {- const parts = [textPart("Hello"), textPart("World")];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toEqual([]);- expect(result.response).toEqual(parts);- });-- it("splits on reasoning tools — text before goes to reasoning", () => {- const parts = [- textPart("Let me search..."),- toolPart("find_block"),- textPart("Here is your answer"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toHaveLength(2);- expect(result.response).toHaveLength(1);- expect((result.response[0] as { text: string }).text).toBe(- "Here is your answer",- );- });-- it("does NOT split on action tools — response before run_block stays visible", () => {- const parts = [- textPart("Here is my answer"),- toolPart("run_block"),- textPart("Block finished"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toEqual([]);- expect(result.response).toEqual(parts);- });-- it("splits only on reasoning tools when both reasoning and action tools are present", () => {- const parts = [- textPart("Planning..."),- toolPart("search_docs"),- textPart("Found it. Running now."),- toolPart("run_block"),- textPart("Done!"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toHaveLength(2);- expect(result.response).toHaveLength(3);- expect((result.response[0] as { text: string }).text).toBe(- "Found it. Running now.",- );- });-- it("returns all as response when reasoning tools have no text after them", () => {- const parts = [- textPart("Hello"),- toolPart("find_agent"),- toolPart("run_block"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toEqual([]);- expect(result.response).toEqual(parts);- });-- it("handles multiple reasoning tools correctly", () => {- const parts = [- textPart("Searching..."),- toolPart("find_block"),- textPart("Found one, searching more..."),- toolPart("search_docs"),- textPart("Here are the results"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toHaveLength(4);- expect(result.response).toHaveLength(1);- expect((result.response[0] as { text: string }).text).toBe(- "Here are the results",- );- });-- it("handles action tool after response text without hiding the response", () => {- const parts = [- toolPart("find_block"),- textPart("I found it! Let me run it."),- toolPart("run_agent"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toHaveLength(1);- expect(result.response).toHaveLength(2);- expect((result.response[0] as { text: string }).text).toBe(- "I found it! Let me run it.",- );- });-- it("returns empty arrays for an empty parts list", () => {- const result = splitReasoningAndResponse([]);- expect(result.reasoning).toEqual([]);- expect(result.response).toEqual([]);- });-- it("pins interactive reasoning tools into the response (object output)", () => {- const askQuestion = interactiveToolPart(- "ask_question",- "input_validation_error",- );- const parts = [- textPart("Let me check..."),- askQuestion,- textPart("Here's the result"),- ];- const result = splitReasoningAndResponse(parts);- // Non-interactive reasoning (the text) stays in reasoning; the interactive- // tool is pinned to the front of the response so it remains visible.- expect(result.reasoning).toEqual([parts[0]]);- expect(result.response).toHaveLength(2);- expect(result.response[0]).toBe(askQuestion);- expect((result.response[1] as { text: string }).text).toBe(- "Here's the result",- );- });-- it("pins interactive reasoning tools even when output is a JSON string", () => {- const askQuestion = {- type: "tool-ask_question",- state: "output-available",- toolCallId: "call-ask_question",- toolName: "ask_question",- args: {},- output: JSON.stringify({ type: "need_login" }),- } as unknown as MessagePart;- const parts = [- toolPart("find_block"),- askQuestion,- textPart("Please log in and try again"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toEqual([parts[0]]);- expect(result.response).toHaveLength(2);- expect(result.response[0]).toBe(askQuestion);- });-- it("pins corrupted card-capable tool parts instead of hiding them", () => {- // Truncated setup_requirements JSON: isInteractiveToolPart can't parse- // it, but burying the part in "Show steps" would silently swallow a- // lost sign-in card — it must stay visible so the renderer can show- // an error.- const corruptedRunBlock = toolPart(- "run_block",- "output-available",- '{"type":"setup_requirements","message":"Connect Goo',- );- const parts = [- corruptedRunBlock,- reasoningPart("Thinking about the result..."),- textPart("A sign-in card has appeared."),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toEqual([parts[1]]);- expect(result.response).toHaveLength(2);- expect(result.response[0]).toBe(corruptedRunBlock);- });-- it("pins the trigger-setup card even when reasoning follows it", () => {- // Regression: setup_agent_webhook_trigger emits a trigger_setup card, then- // the model adds a trailing reasoning part before its text reply. The card- // must stay pinned to the response so it never gets buried in "Show steps".- const triggerSetup = toolPart(- "setup_agent_webhook_trigger",- "output-available",- JSON.stringify({ type: "trigger_setup", message: "Trigger is set up." }),- );- const parts = [- triggerSetup,- reasoningPart("The webhook trigger has been set up successfully..."),- textPart("The webhook trigger is live!"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toEqual([parts[1]]);- expect(result.response).toHaveLength(2);- expect(result.response[0]).toBe(triggerSetup);- });-- it("keeps card-capable tools with valid non-interactive output in reasoning", () => {- const okRunBlock = toolPart(- "run_block",- "output-available",- JSON.stringify({ type: "block_output", block_id: "b1", outputs: {} }),- );- const parts = [- okRunBlock,- reasoningPart("Reviewing output..."),- textPart("Done"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toEqual([okRunBlock, parts[1]]);- expect(result.response).toHaveLength(1);- });-- it("keeps non-interactive reasoning tools in reasoning", () => {- const parts = [- toolPart("find_block"),- toolPart("search_docs"),- textPart("Answer"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toHaveLength(2);- expect(result.reasoning[0]).toBe(parts[0]);- expect(result.reasoning[1]).toBe(parts[1]);- expect(result.response).toHaveLength(1);- });-- it("moves a native reasoning part into reasoning when text follows", () => {- const parts = [reasoningPart("Thinking through this..."), textPart("Done")];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toHaveLength(1);- expect(result.reasoning[0]).toBe(parts[0]);- expect(result.response).toHaveLength(1);- expect((result.response[0] as { text: string }).text).toBe("Done");- });-- it("keeps a trailing native reasoning part in response when no text follows", () => {- const parts = [textPart("Hello"), reasoningPart("Thinking...")];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toEqual([]);- expect(result.response).toEqual(parts);- });-- it("sweeps a native reasoning part emitted after the last reasoning tool into reasoning", () => {- const parts = [- toolPart("find_block"),- reasoningPart("Post-tool thinking"),- textPart("Final answer"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toHaveLength(2);- expect(result.reasoning[0]).toBe(parts[0]);- expect(result.reasoning[1]).toBe(parts[1]);- expect(result.response).toHaveLength(1);- expect((result.response[0] as { text: string }).text).toBe("Final answer");- });-- it("splits on reasoning parts alone when no reasoning tools are present", () => {- const parts = [- reasoningPart("Step 1"),- reasoningPart("Step 2"),- textPart("Here's the answer"),- ];- const result = splitReasoningAndResponse(parts);- expect(result.reasoning).toHaveLength(2);- expect(result.response).toHaveLength(1);- expect((result.response[0] as { text: string }).text).toBe(- "Here's the answer",- );- });-- it("keeps decompose_goal output pinned to response (interactive)", () => {- const parts = [- textPart("Thinking..."),- toolPart("decompose_goal", "output-available", {- type: "task_decomposition",- }),- ];- const { reasoning, response } = splitReasoningAndResponse(parts);- expect(reasoning).toHaveLength(0);- expect(response).toHaveLength(2);- });-- it("keeps non-interactive tool parts that emit a block_list payload in reasoning", () => {- const genericTool = toolPart("find_block", "output-available", {- type: "block_list",- });- const parts = [- textPart("Looking for blocks..."),- genericTool,- textPart("Found them."),- ];- const { reasoning, response } = splitReasoningAndResponse(parts);- expect(reasoning).toHaveLength(2);- expect(reasoning[1]).toBe(genericTool);- expect(response).toHaveLength(1);- });-});-// ----- Custom fileUrlBuilder threading -----------------------------------// The public-share viewer threads a token-aware URL builder through// these helpers so anonymous readers can render file references that@@ -1096,63 +469,3 @@ describe("getLatestCompactionStats", () => {expect(getLatestCompactionStats(parts)).toEqual({});});});--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 9667e34ece..d631b9990e 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@@ -5,7 +5,6 @@ import {MessageActions,} from "@/components/ai-elements/message";import { cn } from "@/lib/utils";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { UIDataTypes, UIMessage, UITools } from "ai";import { useMessageFeedback } from "../useMessageFeedback";import { FeedbackModal } from "./FeedbackModal";@@ -44,18 +43,10 @@ export function AssistantMessageActions({ message, sessionID }: Props) {} = useMessageFeedback({ sessionID, messageID: message.id });const text = extractTextFromParts(message.parts);- // The old UI reveals the actions on hover; the new UI keeps them visible.- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);return (<>- <MessageActions- className={cn(- "mt-1",- !isNewToolUI &&- "opacity-30 transition-opacity group-hover:opacity-100",- )}- >+ <MessageActions className="mt-1"><MessageActiontooltip="Copy"onClick={() => handleCopy(text)}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ChainMessageParts.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ChainMessageParts.tsxindex ec7dc66d0e..23582997de 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ChainMessageParts.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ChainMessageParts.tsx@@ -50,6 +50,7 @@ export function ChainMessageParts({isStreaming={isCurrentlyStreaming && segmentIndex === lastChainSegmentIndex}+ readOnly={readOnly}/>);}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.tsxdeleted file mode 100644index 03f3653921..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/CollapsedToolGroup.tsx+++ /dev/null@@ -1,139 +0,0 @@-"use client";--import { useId, useState } from "react";-import type { ToolUIPart } from "ai";-import {- type ToolCategory,- extractToolName,- getAnimationText,- getToolCategory,-} from "../../../tools/GenericTool/helpers";-import {- AlertDiamondIcon,- ArrowRight01Icon,- CheckListIcon,- CheckmarkCircle02Icon,- ComputerIcon,- Delete02Icon,- FileEmpty02Icon,- Files01Icon,- Globe02Icon,- PencilIcon,- ReloadIcon,- Search01Icon,- Settings01Icon,- TerminalIcon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--interface Props {- parts: ToolUIPart[];-}--/** Category icon matching GenericTool's ToolIcon for completed states. */-function EntryIcon({- category,- isError,-}: {- category: ToolCategory;- isError: boolean;-}) {- if (isError) {- return <Icon icon={AlertDiamondIcon} size={14} className="text-red-500" />;- }-- const iconClass = "text-green-500";- switch (category) {- case "bash":- return <Icon icon={TerminalIcon} size={14} className={iconClass} />;- case "web":- return <Icon icon={Globe02Icon} size={14} className={iconClass} />;- case "browser":- return <Icon icon={ComputerIcon} size={14} className={iconClass} />;- case "file-read":- case "file-write":- return <Icon icon={FileEmpty02Icon} size={14} className={iconClass} />;- case "file-delete":- return <Icon icon={Delete02Icon} size={14} className={iconClass} />;- case "file-list":- return <Icon icon={Files01Icon} size={14} className={iconClass} />;- case "search":- return <Icon icon={Search01Icon} size={14} className={iconClass} />;- case "edit":- return <Icon icon={PencilIcon} size={14} className={iconClass} />;- case "todo":- return <Icon icon={CheckListIcon} size={14} className={iconClass} />;- case "compaction":- return <Icon icon={ReloadIcon} size={14} className={iconClass} />;- default:- return <Icon icon={Settings01Icon} size={14} className={iconClass} />;- }-}--export function CollapsedToolGroup({ parts }: Props) {- const [expanded, setExpanded] = useState(false);- const panelId = useId();-- const errorCount = parts.filter((p) => p.state === "output-error").length;- const label =- errorCount > 0- ? `${parts.length} tool calls (${errorCount} failed)`- : `${parts.length} tool calls completed`;-- return (- <div className="py-1 text-xs opacity-50 transition-opacity group-hover:opacity-100">- <button- type="button"- onClick={() => setExpanded(!expanded)}- aria-expanded={expanded}- aria-controls={panelId}- className="flex items-center gap-1.5 !text-xs text-muted-foreground transition-colors hover:text-foreground"- >- <Icon- icon={ArrowRight01Icon}- size={12}- className={- "transition-transform duration-150 " + (expanded ? "rotate-90" : "")- }- />- {errorCount > 0 ? (- <Icon icon={AlertDiamondIcon} size={14} className="text-red-500" />- ) : (- <Icon- icon={CheckmarkCircle02Icon}- size={14}- className="text-green-500"- />- )}- <span>{label}</span>- </button>-- {expanded && (- <div- id={panelId}- className="ml-5 mt-1 space-y-0.5 border-l border-neutral-200 pl-3"- >- {parts.map((part) => {- const toolName = extractToolName(part);- const category = getToolCategory(toolName);- const text = getAnimationText(part, category);- const isError = part.state === "output-error";-- return (- <div- key={part.toolCallId}- className={- "flex items-center gap-1.5 text-xs " +- (isError ? "text-red-500" : "text-muted-foreground")- }- >- <EntryIcon category={category} isError={isError} />- <span>{text}</span>- </div>- );- })}- </div>- )}- </div>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertAvatar/ExpertAvatar.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertAvatar/ExpertAvatar.tsxindex afaa7e7f76..2751245dd9 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertAvatar/ExpertAvatar.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertAvatar/ExpertAvatar.tsx@@ -9,16 +9,9 @@ interface Props {name: string;avatarUrl: string | null;isAutopilot?: boolean;- /** "sm" is the old-tool-UI header size; the new header runs larger. */- size?: "sm" | "lg";}-export function ExpertAvatar({- name,- avatarUrl,- isAutopilot,- size = "lg",-}: Props) {+export function ExpertAvatar({ name, avatarUrl, isAutopilot }: Props) {if (isAutopilot && !avatarUrl) {return (<span className="flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-b from-white to-zinc-100 shadow-[inset_0_1px_1px_rgba(255,255,255,0.9),inset_0_-2px_4px_rgba(0,0,0,0.08),0_1px_2px_rgba(0,0,0,0.06)] ring-1 ring-inset ring-zinc-200/70">@@ -27,13 +20,12 @@ export function ExpertAvatar({);}- const sizeClass = size === "sm" ? "h-6 w-6" : "h-9 w-9";return (- <Avatar className={sizeClass}>+ <Avatar className="h-9 w-9">{avatarUrl ? <AvatarImage src={avatarUrl} alt={name} /> : null}{/* The fallback seeds a generated avatar off the name, and also coversan avatar URL that fails to load. */}- <AvatarFallback className={sizeClass}>{name}</AvatarFallback>+ <AvatarFallback className="h-9 w-9">{name}</AvatarFallback></Avatar>);}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 dae799432e..aaa24d4286 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@@ -90,48 +90,30 @@ function TextWithArtifactCards({readOnly?: boolean;}) {const isArtifactsFlagEnabled = useGetFlag(Flag.ARTIFACTS);- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);const isArtifactsEnabled = forceArtifacts || isArtifactsFlagEnabled;const artifacts = extractWorkspaceArtifacts(text, fileUrlBuilder);const resolved = resolveWorkspaceUrls(text, fileUrlBuilder);- const artifactCards = isArtifactsEnabled && artifacts.length > 0 && (- <div- className={- isNewToolUI- ? "mt-2 grid grid-cols-1 gap-1 sm:grid-cols-2"- : "mb-2 flex flex-col gap-1"- }- >- {artifacts.map((artifact) => (- <ArtifactCard- key={artifact.id}- artifact={artifact}- readOnly={readOnly}- />- ))}- </div>- );- const response = (- <MessageResponse- components={STREAMDOWN_COMPONENTS}- className={isNewToolUI ? "[&_li]:py-0" : undefined}- >- {resolved}- </MessageResponse>- );-- // New tool UI reads text-first with artifacts trailing; the legacy layout- // leads with the artifact cards.- return isNewToolUI ? (- <>- {response}- {artifactCards}- </>- ) : (+ // Text reads first, with the artifact cards trailing.+ return (<>- {artifactCards}- {response}+ <MessageResponse+ components={STREAMDOWN_COMPONENTS}+ className="[&_li]:py-0"+ >+ {resolved}+ </MessageResponse>+ {isArtifactsEnabled && artifacts.length > 0 && (+ <div className="mt-2 grid grid-cols-1 gap-1 sm:grid-cols-2">+ {artifacts.map((artifact) => (+ <ArtifactCard+ key={artifact.id}+ artifact={artifact}+ readOnly={readOnly}+ />+ ))}+ </div>+ )}</>);}@@ -290,10 +272,9 @@ export function MessagePartRenderer({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`.+ // Hidden inline — the task list surfaces through TaskProgressBar above+ // the composer, not as a message part. That bar is gated on+ // TASK_PROGRESS_BAR, so until it rolls out the list has no UI.return null;case COMPACTION_PART_TYPE: {const toolPart = part as ToolUIPart;diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ReasoningGroup.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ReasoningGroup.tsxdeleted file mode 100644index bf6f26297a..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ReasoningGroup.tsx+++ /dev/null@@ -1,32 +0,0 @@-import type { MessagePart } from "../helpers";-import { ReasoningCollapse } from "./ReasoningCollapse";--interface Props {- parts: MessagePart[];-}--function reasoningText(part: MessagePart): string {- return "text" in part && typeof part.text === "string" ? part.text : "";-}--export function ReasoningGroup({ parts }: Props) {- const texts = parts.map(reasoningText).filter((text) => text.trim());- if (texts.length === 0) return null;-- // The group is still "thinking" while its most recent part streams — that- // keeps the pulse going through the whole multi-turn reasoning run instead- // of flickering off between turns.- const lastPart = parts[parts.length - 1];- const isActive =- "state" in lastPart &&- typeof lastPart.state === "string" &&- lastPart.state === "streaming";-- return (- <ReasoningCollapse isActive={isActive}>- <pre className="whitespace-pre-wrap text-sm text-zinc-700">- {texts.join("\n\n")}- </pre>- </ReasoningCollapse>- );-}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.tsxdeleted file mode 100644index a93442558b..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/StepsCollapse.tsx+++ /dev/null@@ -1,27 +0,0 @@-"use client";-import { Dialog } from "@/components/molecules/Dialog/Dialog";-import { LeftToRightListBulletIcon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--interface Props {- children: React.ReactNode;-}--export function StepsCollapse({ children }: Props) {- return (- <Dialog title="Steps">- <Dialog.Trigger>- <button- type="button"- className="flex items-center gap-1 !text-xs text-zinc-500 transition-colors hover:text-zinc-700"- >- <Icon icon={LeftToRightListBulletIcon} size={12} />- <span>Show steps</span>- </button>- </Dialog.Trigger>- <Dialog.Content>- <div className="space-y-1">{children}</div>- </Dialog.Content>- </Dialog>- );-}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.tsxdeleted file mode 100644index a30948cf23..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/TaskListNotice.tsx+++ /dev/null@@ -1,22 +0,0 @@-"use client";-import { useCopilotUIStore } from "../../../store";-import { ArrowRight02Icon, CheckListIcon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--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"- >- <Icon icon={CheckListIcon} size={14} className="text-blue-500" />- <span>Progress shown in the sidebar</span>- <Icon icon={ArrowRight02Icon} 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 900addf5e4..5177d8380e 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@@ -1,145 +1,43 @@-import { useEffect, useRef, useState } from "react";import { formatElapsed } from "../../JobStatsBar/formatElapsed";import { PixelGridLoader } from "../../PixelGridLoader/PixelGridLoader";-import { ScaleLoader } from "../../ScaleLoader/ScaleLoader";import { SwapText } from "../../ToolChain/SwapText";-const THINKING_PHRASES = [- "Thinking...",- "Considering this...",- "Working through this...",- "Analyzing your request...",- "Reasoning...",- "Looking into it...",- "Processing your request...",- "Mulling this over...",- "Piecing it together...",- "On it...",- "Connecting the dots...",- "Exploring possibilities...",- "Weighing options...",- "Diving deeper...",- "Gathering thoughts...",- "Almost there...",- "Figuring this out...",- "Putting it together...",- "Running through ideas...",- "Wrapping my head around this...",-];--const PHRASE_CYCLE_MS = 6_000;-const FADE_DURATION_MS = 300;-/** Only show elapsed time after this many seconds. */const SHOW_TIME_AFTER_SECONDS = 20;-/**- * Cycles through thinking phrases sequentially with a fade-out/in transition.- * Returns the current phrase and whether it's visible (for opacity).- */-function useCyclingPhrase(active: boolean) {- const indexRef = useRef(0);- const [phrase, setPhrase] = useState(THINKING_PHRASES[0]);- const [visible, setVisible] = useState(true);- const fadeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);-- // Reset to the first phrase when thinking restarts- const prevActive = useRef(active);- useEffect(() => {- if (active && !prevActive.current) {- indexRef.current = 0;- setPhrase(THINKING_PHRASES[0]);- setVisible(true);- }- prevActive.current = active;- }, [active]);-- useEffect(() => {- if (!active) return;- const id = setInterval(() => {- setVisible(false);- fadeTimeoutRef.current = setTimeout(() => {- indexRef.current = (indexRef.current + 1) % THINKING_PHRASES.length;- setPhrase(THINKING_PHRASES[indexRef.current]);- setVisible(true);- }, FADE_DURATION_MS);- }, PHRASE_CYCLE_MS);- return () => {- clearInterval(id);- if (fadeTimeoutRef.current) {- clearTimeout(fadeTimeoutRef.current);- fadeTimeoutRef.current = null;- }- };- }, [active]);-- return { phrase, visible };-}-interface Props {active: boolean;elapsedSeconds: number;/*** Backend-emitted status message for the current silent gap (e.g.* "Reading your message…", "Analyzing result…", "Optimizing conversation- * context…"). When provided, it replaces the rotating generic phrase so- * the user sees what's actually happening instead of a placeholder. In- * the chain variant an absent message shows no label at all rather than+ * context…"). An absent message shows no label at all rather than* inventing a generic placeholder.*/statusMessage?: string | null;- /** "chain" is the NEW_TOOL_UI pixel-loader look; "legacy" (default)- * keeps the original rotating-phrase indicator. */- variant?: "legacy" | "chain";}export function ThinkingIndicator({active,elapsedSeconds,statusMessage,- variant = "legacy",}: Props) {- const { phrase, visible } = useCyclingPhrase(active);const showTime = active && elapsedSeconds >= SHOW_TIME_AFTER_SECONDS;- if (variant === "chain") {- return (- <span- role="status"- aria-live="polite"- className="inline-flex w-fit items-center gap-2.5 text-sm text-zinc-600"- >- <PixelGridLoader className="text-zinc-600" />- {statusMessage && (- <SwapText text={statusMessage} shimmer className="text-sm" />- )}- {!statusMessage && <span className="sr-only">Thinking…</span>}- {showTime && (- <span className="font-mono text-xs tabular-nums text-zinc-400">- {formatElapsed(elapsedSeconds)}- </span>- )}- </span>- );- }-- const displayText = statusMessage || phrase;- const transitionOpacity = statusMessage ? 1 : visible ? 1 : 0;-return (- <span className="inline-flex items-center gap-1.5 text-sm text-neutral-500">- <ScaleLoader size={16} />- <span- className="transition-opacity duration-300"- style={{ opacity: transitionOpacity }}- >- <span className="animate-pulse [animation-duration:1.5s]">- {displayText}- </span>- </span>+ <span+ role="status"+ aria-live="polite"+ className="inline-flex w-fit items-center gap-2.5 text-sm text-zinc-600"+ >+ <PixelGridLoader className="text-zinc-600" />+ {statusMessage && (+ <SwapText text={statusMessage} shimmer className="text-sm" />+ )}+ {!statusMessage && <span className="sr-only">Thinking…</span>}{showTime && (- <span className="animate-pulse tabular-nums [animation-duration:1.5s]">- • {formatElapsed(elapsedSeconds)}+ <span className="font-mono text-xs tabular-nums text-zinc-400">+ {formatElapsed(elapsedSeconds)}</span>)}</span>diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsxnew file mode 100644index 0000000000..8e5b021c84--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsx@@ -0,0 +1,64 @@+import { cn } from "@/lib/utils";+import type { ExpertIdentity } from "../../../useExpertMap";+import { ExpertAvatar } from "./ExpertAvatar/ExpertAvatar";+import { ExpertSchedulesButton } from "./ExpertSchedulesButton/ExpertSchedulesButton";++// Autopilot's product-facing title when a session carries no expert identity.+const DEFAULT_EXPERT_ROLE = "Head of AI";++interface Props {+ expertIdentity?: ExpertIdentity | null;+ readOnly: boolean;+ /** The workspace-files card floats over the column's right side, so the+ * centred row slides left to make room for it. */+ areFilesOpen: boolean;+ /** The new layout floats the sidebar and workspace-files controls over the+ * chat's top-left corner below `lg`; the row starts past them. */+ hasFloatingControls?: boolean;+}++/** Sits above the scroller rather than sticky inside it, so the bar spans the+ * full chat width while its row stays aligned with the max-w-3xl message+ * column. An expert session wears the expert's identity and every other+ * session is Autopilot's, so the thread is never anonymous. */+export function ThreadHeader({+ expertIdentity,+ readOnly,+ areFilesOpen,+ hasFloatingControls = false,+}: Props) {+ return (+ <div+ data-testid="expert-thread-header"+ className="z-10 w-full border-b border-b-[#80808017] bg-[#fafafa]/80 backdrop-blur-md"+ >+ <div+ className={cn(+ "ease-[cubic-bezier(0.32,0.72,0,1)] mx-auto flex w-full max-w-3xl items-center gap-2 px-6 py-2 transition-transform duration-300 will-change-transform motion-reduce:transition-none",+ areFilesOpen && "xl:-translate-x-40",+ hasFloatingControls && "max-md:pl-28 md:max-lg:pl-20",+ )}+ >+ <ExpertAvatar+ name={expertIdentity?.name ?? "Autopilot"}+ avatarUrl={expertIdentity?.avatarUrl ?? null}+ isAutopilot={!expertIdentity}+ />+ <div className="flex min-w-0 flex-col">+ <span className="truncate text-sm font-medium text-zinc-800">+ {expertIdentity?.name ?? "Autopilot"}+ </span>+ <span className="truncate text-xs text-zinc-500">+ {expertIdentity?.role ?? DEFAULT_EXPERT_ROLE}+ </span>+ </div>+ {expertIdentity && !readOnly && !expertIdentity.isArchived && (+ <ExpertSchedulesButton+ expertId={expertIdentity.id}+ expertName={expertIdentity.name}+ />+ )}+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/__tests__/CollapsedToolGroup.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/__tests__/CollapsedToolGroup.test.tsxdeleted file mode 100644index b05cc11dd5..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/__tests__/CollapsedToolGroup.test.tsx+++ /dev/null@@ -1,147 +0,0 @@-import { afterEach, describe, expect, it } from "vitest";-import { cleanup, fireEvent, render, screen } from "@testing-library/react";-import type { ToolUIPart } from "ai";-import { CollapsedToolGroup } from "../CollapsedToolGroup";--afterEach(cleanup);--function makePart(toolName: string, overrides: Partial<ToolUIPart> = {}) {- return {- type: `tool-${toolName}`,- toolCallId: `call-${toolName}`,- state: "output-available",- input: {},- output: { message: "ok" },- ...overrides,- } as unknown as ToolUIPart;-}--// The entry glyph is chosen by a switch on the tool category. A wrong or-// undefined icon import renders an empty <svg> instead of throwing, so assert-// on the drawn geometry rather than on the element merely existing.-function glyphs(root: HTMLElement) {- return Array.from(root.querySelectorAll("svg"))- .map((svg) =>- Array.from(svg.querySelectorAll("path,circle,rect,line,polyline"))- .map((n) => n.getAttribute("d") ?? n.outerHTML)- .join("|"),- )- .filter(Boolean);-}--describe("CollapsedToolGroup", () => {- it("summarises completed calls and stays collapsed until clicked", () => {- render(- <CollapsedToolGroup parts={[makePart("bash_exec"), makePart("grep")]} />,- );-- const toggle = screen.getByRole("button");- expect(toggle.getAttribute("aria-expanded")).toBe("false");- expect(toggle.textContent).toContain("2 tool calls completed");- expect(screen.queryByText(/Ran command/i)).toBeNull();- });-- it("counts failures in the summary label", () => {- render(- <CollapsedToolGroup- parts={[- makePart("bash_exec"),- makePart("grep", { state: "output-error" } as Partial<ToolUIPart>),- ]}- />,- );-- expect(screen.getByRole("button").textContent).toContain(- "2 tool calls (1 failed)",- );- });-- it("reveals one entry per tool call when expanded", () => {- const { container } = render(- <CollapsedToolGroup- parts={[makePart("bash_exec"), makePart("grep"), makePart("glob")]}- />,- );-- const toggle = screen.getByRole("button");- fireEvent.click(toggle);-- expect(toggle.getAttribute("aria-expanded")).toBe("true");- const panel = container.querySelector(- `#${CSS.escape(toggle.getAttribute("aria-controls") ?? "")}`,- );- expect(panel).not.toBeNull();- expect(panel?.children.length).toBe(3);- });-- it("draws a distinct glyph for every tool category", () => {- const byCategory: [string, string][] = [- ["bash", "bash_exec"],- ["web", "web_search"],- ["browser", "browser_navigate"],- ["file-read", "read_file"],- ["file-delete", "delete_workspace_file"],- ["file-list", "glob"],- ["search", "grep"],- ["edit", "edit_file"],- ["todo", "TodoWrite"],- ["compaction", "context_compaction"],- ["other", "some_unknown_tool"],- ];-- const seen: string[] = [];- for (const [, toolName] of byCategory) {- const { container, unmount } = render(- <CollapsedToolGroup parts={[makePart(toolName)]} />,- );- fireEvent.click(screen.getByRole("button"));- // [0] and [1] belong to the toggle (caret + status); the entry is last.- const drawn = glyphs(container);- expect(drawn.length).toBe(3);- seen.push(drawn[2]);- unmount();- }-- expect(new Set(seen).size).toBe(seen.length);- });-- it("swaps the entry glyph for the alert icon when a call errored", () => {- const { container: ok } = render(- <CollapsedToolGroup parts={[makePart("bash_exec")]} />,- );- fireEvent.click(screen.getByRole("button"));- const okGlyph = glyphs(ok)[2];- cleanup();-- const { container: failed } = render(- <CollapsedToolGroup- parts={[- makePart("bash_exec", {- state: "output-error",- } as Partial<ToolUIPart>),- ]}- />,- );- fireEvent.click(screen.getByRole("button"));- const failedGlyph = glyphs(failed)[2];-- expect(failedGlyph).toBeTruthy();- expect(failedGlyph).not.toBe(okGlyph);- });-- it("shares the file glyph between reads and writes", () => {- const { container: read } = render(- <CollapsedToolGroup parts={[makePart("read_file")]} />,- );- fireEvent.click(screen.getByRole("button"));- const readGlyph = glyphs(read)[2];- cleanup();-- const { container: write } = render(- <CollapsedToolGroup parts={[makePart("write_file")]} />,- );- fireEvent.click(screen.getByRole("button"));-- expect(glyphs(write)[2]).toBe(readGlyph);- });-});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/__tests__/StepsCollapse.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/__tests__/StepsCollapse.test.tsxdeleted file mode 100644index 75b8138f73..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/__tests__/StepsCollapse.test.tsx+++ /dev/null@@ -1,78 +0,0 @@-import { afterEach, describe, expect, it, vi } from "vitest";-import { cleanup, fireEvent, render, screen } from "@testing-library/react";-import { StepsCollapse } from "../StepsCollapse";--vi.mock("@hugeicons/core-free-icons", () => ({- LeftToRightListBulletIcon: "list-icon",-}));--vi.mock("@/components/atoms/Icon/Icon", () => ({- Icon: ({ icon }: { icon: string }) => <span data-testid={icon} />,-}));--vi.mock("@/components/molecules/Dialog/Dialog", async () => {- const { createContext, useContext, useState } = await import("react");-- const Ctx = createContext<{- open: boolean;- setOpen: (v: boolean) => void;- }>({ open: false, setOpen: () => {} });-- function Dialog({ children }: { children: React.ReactNode }) {- const [open, setOpen] = useState(false);- return <Ctx.Provider value={{ open, setOpen }}>{children}</Ctx.Provider>;- }- Dialog.Trigger = function Trigger({- children,- }: {- children: React.ReactNode;- }) {- const ctx = useContext(Ctx);- return (- <span data-testid="dialog-trigger" onClick={() => ctx.setOpen(true)}>- {children}- </span>- );- };- Dialog.Content = function Content({- children,- }: {- children: React.ReactNode;- }) {- const ctx = useContext(Ctx);- if (!ctx.open) return null;- return <div data-testid="dialog-content">{children}</div>;- };- return { Dialog };-});--describe("StepsCollapse", () => {- afterEach(() => {- cleanup();- });-- it("renders the 'Show steps' trigger button without opening the dialog", () => {- render(- <StepsCollapse>- <div data-testid="step-body">step content</div>- </StepsCollapse>,- );-- expect(screen.getByText("Show steps")).toBeDefined();- expect(screen.queryByTestId("dialog-content")).toBeNull();- });-- it("opens the dialog and renders children on trigger click", () => {- render(- <StepsCollapse>- <div data-testid="step-body">step content</div>- </StepsCollapse>,- );-- fireEvent.click(screen.getByTestId("dialog-trigger"));-- expect(screen.getByTestId("dialog-content")).toBeDefined();- expect(screen.getByTestId("step-body")).toBeDefined();- expect(screen.getByText("step content")).toBeDefined();- });-});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 793135197d..8b5703985d 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@@ -1,8 +1,6 @@import { getGetWorkspaceDownloadFileByIdUrl } from "@/app/api/__generated__/endpoints/workspace/workspace";-import { ResponseType } from "@/app/api/__generated__/models/responseType";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 {COMPACTION_DATA_PART_TYPE,@@ -11,22 +9,6 @@ import {type CompactionStats,} from "../CompactionCard/helpers";import { COMPACTION_PART_TYPE } from "../ToolChain/helpers";-import type { TodoItem } from "../TaskProgressBar/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,@@ -34,56 +16,9 @@ export type MessagePart = UIMessage<UITools>["parts"][number];-export type RenderSegment =- | { kind: "part"; part: MessagePart; index: number }- | { kind: "collapsed-group"; parts: ToolUIPart[] }- | { kind: "reasoning-group"; parts: MessagePart[]; index: number };--const LEGACY_CUSTOM_TOOL_TYPES = new Set([- "tool-ask_question",- "tool-find_block",- "tool-find_agent",- "tool-find_library_agent",- "tool-search_docs",- "tool-get_doc_page",- "tool-connect_integration",- "tool-run_block",- "tool-continue_run_block",- "tool-connect_integration",- "tool-run_mcp_tool",- "tool-run_agent",- "tool-schedule_agent",- "tool-setup_agent_webhook_trigger",- "tool-create_agent",- "tool-edit_agent",- "tool-view_agent_output",- "tool-search_feature_requests",- "tool-create_feature_request",- "tool-decompose_goal",- // Renders via CompactionCard, not the generic completed-tool grouping —- // excluding it here keeps a settled compaction row from folding into a- // collapsed "N tool calls" group next to an adjacent completed tool,- // which would bury its payoff copy.- COMPACTION_PART_TYPE,-]);--const REASONING_TOOL_TYPES = new Set([- "tool-find_block",- "tool-find_agent",- "tool-find_library_agent",- "tool-search_docs",- "tool-get_doc_page",- "tool-search_feature_requests",- "tool-ask_question",-]);--export function isReasoningToolPart(part: MessagePart): boolean {- return REASONING_TOOL_TYPES.has(part.type);-}--// Every assistant tool belongs to the new ToolChain. ToolResult supplies a+// Every assistant tool renders inside the ToolChain. ToolResult supplies a// compact result view for known backend tools and a structured fallback for-// SDK or future tools, so no tool can fall back to the legacy top-level UI.+// SDK or future tools, so no tool ever renders as a bare top-level part.export function isChainableToolPart(part: MessagePart): boolean {if (part.type === COMPACTION_PART_TYPE) return false;return part.type === "reasoning" || part.type.startsWith("tool-");@@ -193,175 +128,6 @@ export const WORKSPACE_FILE_PATTERN =/^\/api\/proxy\/api\/workspace\/files\/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})\/download$/;const WORKSPACE_URI_PATTERN = /workspace:\/\/([a-f0-9-]+)(?:#([^\s)\]]+))?/g;-const INTERACTIVE_RESPONSE_TYPES: ReadonlySet<string> = new Set([- ResponseType.setup_requirements,- ResponseType.trigger_setup,- ResponseType.agent_details,- ResponseType.block_details,- ResponseType.review_required,- ResponseType.need_login,- ResponseType.input_validation_error,- ResponseType.agent_builder_clarification_needed,- ResponseType.suggested_goal,- ResponseType.agent_builder_preview,- ResponseType.agent_builder_saved,- ResponseType.task_decomposition,-]);--export function isCompletedToolPart(part: MessagePart): part is ToolUIPart {- return (- part.type.startsWith("tool-") &&- "state" in part &&- (part.state === "output-available" || part.state === "output-error")- );-}--export function isInteractiveToolPart(part: MessagePart): boolean {- if (!part.type.startsWith("tool-")) return false;- if (!("state" in part) || part.state !== "output-available") return false;-- let output = (part as ToolUIPart).output;- if (!output) return false;-- if (typeof output === "string") {- try {- output = JSON.parse(output);- } catch {- return false;- }- }-- if (typeof output !== "object" || output === null) return false;-- const responseType = (output as Record<string, unknown>).type;- return (- typeof responseType === "string" &&- INTERACTIVE_RESPONSE_TYPES.has(responseType)- );-}--export function buildRenderSegments(- parts: MessagePart[],- baseIndex = 0,-): RenderSegment[] {- const segments: RenderSegment[] = [];- let pendingTools: Array<{ part: ToolUIPart; index: number }> | null = null;- let pendingReasoning: Array<{ part: MessagePart; index: number }> | null =- null;-- function flushTools() {- if (!pendingTools) return;- if (pendingTools.length >= 2) {- segments.push({- kind: "collapsed-group",- parts: pendingTools.map((p) => p.part),- });- } else {- for (const p of pendingTools) {- segments.push({ kind: "part", part: p.part, index: p.index });- }- }- pendingTools = null;- }-- // Native reasoning parts (one per agentic turn) are always emitted as a- // reasoning-group — including a lone part. This folds a multi-step task's- // consecutive reasoning into one collapsed block instead of a stacked wall of- // "Reasoning" accordions, and gives the run a single stable identity- // (`reasoning-group` keyed by its first index) so a single block doesn't- // remount — losing its open/closed state — the moment a second consecutive- // block arrives and turns it into a group.- function flushReasoning() {- if (!pendingReasoning) return;- segments.push({- kind: "reasoning-group",- parts: pendingReasoning.map((p) => p.part),- index: pendingReasoning[0].index,- });- pendingReasoning = null;- }-- parts.forEach((part, i) => {- const absoluteIndex = baseIndex + i;-- // `step-start` markers delimit turns in multi-step agentic streams and- // render as nothing. Treat them as transparent: skipping them (rather than- // flushing) keeps the reasoning blocks on either side in a single run, which- // is exactly the consecutive-reasoning case this grouping targets.- if (part.type === "step-start") return;-- const isGenericCompletedTool =- isCompletedToolPart(part) && !LEGACY_CUSTOM_TOOL_TYPES.has(part.type);-- if (isGenericCompletedTool) {- flushReasoning();- if (!pendingTools) pendingTools = [];- pendingTools.push({ part: part as ToolUIPart, index: absoluteIndex });- } else if (part.type === "reasoning") {- flushTools();- if (!pendingReasoning) pendingReasoning = [];- pendingReasoning.push({ part, index: absoluteIndex });- } else {- flushTools();- flushReasoning();- segments.push({ kind: "part", part, index: absoluteIndex });- }- });-- flushTools();- flushReasoning();- return segments;-}--function isReasoningBoundary(part: MessagePart): boolean {- return part.type === "reasoning" || isReasoningToolPart(part);-}--export function splitReasoningAndResponse(parts: MessagePart[]): {- reasoning: MessagePart[];- response: MessagePart[];-} {- const lastReasoningIndex = parts.findLastIndex(isReasoningBoundary);-- if (lastReasoningIndex === -1) {- return { reasoning: [], response: parts };- }-- const hasResponseAfterReasoning = parts- .slice(lastReasoningIndex + 1)- .some((p) => p.type === "text");-- if (!hasResponseAfterReasoning) {- return { reasoning: [], response: parts };- }-- const rawReasoning = parts.slice(0, lastReasoningIndex + 1);- const rawResponse = parts.slice(lastReasoningIndex + 1);-- const reasoning: MessagePart[] = [];- const pinnedParts: MessagePart[] = [];-- for (const part of rawReasoning) {- // Corrupted card-capable parts are pinned too: their output failed to- // parse, so isInteractiveToolPart can't recognize them, but hiding them- // in the steps modal would silently swallow a lost sign-in/setup card.- // Pinning lets the tool renderer surface a visible error instead.- if (isInteractiveToolPart(part) || isCorruptedCardToolPart(part)) {- pinnedParts.push(part);- } else {- // Reasoning / thinking parts stay inside the outer "Show steps" modal- // alongside the tool-use timeline — their own inline accordion handles- // expansion inside the modal so there's no visual collision.- reasoning.push(part);- }- }-- return {- reasoning,- response: [...pinnedParts, ...rawResponse],- };-}-export function getTurnMessages(messages: UIMessage<unknown, UIDataTypes, UITools>[],lastAssistantIndex: number,diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsxindex 7fe49a5336..e9a4f49509 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanel.tsx@@ -6,24 +6,12 @@ import {SheetHeader,SheetTitle,} from "@/components/ui/sheet";-import { cn } from "@/lib/utils";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { AnimatePresence, motion, useReducedMotion } from "framer-motion";import { useState } from "react";-import {- MAX_CONTEXT_PANEL_WIDTH,- MIN_CONTEXT_PANEL_WIDTH,- type ContextPanelTab,-} from "../../store";+import { MAX_CONTEXT_PANEL_WIDTH, MIN_CONTEXT_PANEL_WIDTH } from "../../store";import { PanelResizeHandle } from "../PanelResizeHandle";import { ArtifactsTab } from "./components/ArtifactsTab/ArtifactsTab";-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";-import { Cancel01Icon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";interface Props {sessionId: string | null;@@ -35,120 +23,57 @@ interface Props {const PANEL_EASE: [number, number, number, number] = [0.32, 0.72, 0, 1];const PANEL_DURATION = 0.3;+// Files render as a card grid above the composer (``WorkspaceFileCards``), so+// this panel only ever holds the artifacts library. The open flag also drives+// that card, so both the docked desktop panel and the mobile sheet claim the+// screen for the artifacts tab only — a "files" tab belongs to the card.export function ContextPanel({ sessionId, mobile }: Props) {const {isOpen,activeTab,showExpanded,- setActiveTab,closeArtifactPanel,contextPanelWidth,setContextPanelWidth,} = useContextPanel();const [isResizing, setIsResizing] = useState(false);const shouldReduceMotion = useReducedMotion();- const { uploaded, generated } = useSessionFiles(sessionId);- const filesCount = uploaded.length + generated.length;- // New tool UI renders files as a card grid above the composer- // (``WorkspaceFileCards``), so the desktop panel only ever docks for the- // artifacts library there — files and progress tabs stay out of it.- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);- // When the task bar (above the chat input) is on, the sidebar drops the- // Progress tab and shows Files only.- const showProgressTab = !useGetFlag(Flag.TASK_PROGRESS_BAR) && !isNewToolUI;- const showFilesTab = !isNewToolUI;- // Clamp a persisted tab to one that still exists, so the switcher never ends- // up with no selected tab. The Artifacts library tab ships with the new- // tool UI only.- const availableTabs: ContextPanelTab[] = [- ...(showProgressTab ? (["progress"] as const) : []),- ...(showFilesTab ? (["files"] as const) : []),- ...(isNewToolUI ? (["artifacts"] as const) : []),- ];- // Read-side only: "files" stays "files" in the store because the toggle,- // the workspace-files card and the chat column all read the raw tab.- const effectiveTab = availableTabs.includes(activeTab)- ? activeTab- : availableTabs[0];-- // One tab left (new tool UI docks the panel for artifacts only) means the- // switcher has nothing to switch, and the chat's sidebar icon already- // toggles the panel — so the header row has nothing left to hold. The old- // UI keeps its header regardless: it carries the panel's close button.- const showHeader = mobile || !isNewToolUI || availableTabs.length > 1;- const tabs = (+ const library = (<div className="flex min-h-0 flex-1 flex-col">- {showHeader && (- <div- className={cn(- "flex items-center justify-between gap-2 p-2",- mobile && "mt-12",- )}- >- <TabSwitcher- activeTab={effectiveTab}- filesCount={filesCount}- onChange={setActiveTab}- showProgressTab={showProgressTab}- showFilesTab={showFilesTab}- showArtifactsTab={isNewToolUI}- />- {!mobile && !isNewToolUI && (- <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"- >- <Icon icon={Cancel01Icon} size={16} />- </button>- )}- </div>- )}- <div className="flex min-h-0 flex-1 flex-col">- {effectiveTab === "progress" ? (- <ProgressTab sessionId={sessionId} />- ) : effectiveTab === "artifacts" ? (- <ArtifactsTab sessionId={sessionId} />- ) : (- <FilesTab sessionId={sessionId} />- )}- </div>+ <ArtifactsTab sessionId={sessionId} /></div>);if (mobile) {return (<Sheet- open={isOpen}+ open={isOpen && activeTab === "artifacts"}onOpenChange={(open) => !open && closeArtifactPanel()}><SheetContentside="right"className="flex w-full flex-col p-0 sm:max-w-full">- <SheetHeader className="sr-only">- <SheetTitle>Workspace</SheetTitle>+ <SheetHeader className="mt-12 p-2 text-left">+ <SheetTitle className="text-sm font-medium text-zinc-900">+ Artifacts+ </SheetTitle></SheetHeader>- {tabs}+ {library}</SheetContent></Sheet>);}- // Under the new tool UI the open flag also drives the inline files card, so- // the docked panel only claims the side region for the artifacts tab. The- // raw tab decides: a "files" tab belongs to the card, not to this panel.- const isDocked = showExpanded && !(isNewToolUI && activeTab !== "artifacts");+ const isDocked = showExpanded && activeTab === "artifacts";// Width is the animated property because the panel pushes the chat column// rather than overlaying it. Dragging the handle bypasses the tween (a- // queued 300ms tween per pointer move would trail the cursor). The old UI- // always mounts instantly — the open/close tween is new-tool-UI only.+ // queued 300ms tween per pointer move would trail the cursor). The chat's+ // sidebar icon toggles the panel, so it carries no header of its own.const transition =- shouldReduceMotion || isResizing || !isNewToolUI+ shouldReduceMotion || isResizing? { duration: 0 }: { duration: PANEL_DURATION, ease: PANEL_EASE };@@ -174,15 +99,15 @@ export function ContextPanel({ sessionId, mobile }: Props) {maxWidth={MAX_CONTEXT_PANEL_WIDTH}/><div className="h-full overflow-hidden">- {/* Fixed inner width: the tabs keep their final layout while the- shell widens, so nothing reflows mid-animation. That also+ {/* Fixed inner width: the library keeps its final layout while+ the shell widens, so nothing reflows mid-animation. That alsomeans the inner is wider than the shell for the whole tween,so the clip above is what stops it spilling over the chat. */}<divstyle={{ width: contextPanelWidth }}className="flex h-full min-h-0 flex-col overflow-hidden">- {tabs}+ {library}</div></div></motion.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.tsxindex 2d63f1448c..4ad80dc2bb 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelAutoOpen.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelAutoOpen.tsx@@ -1,8 +1,6 @@"use client";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { useAutoOpenForFiles } from "./useAutoOpenForFiles";-import { useAutoOpenForProgress } from "./useAutoOpenForProgress";import { useCollapseContextPanelOnSession } from "./useCollapseContextPanelOnSession";interface Props {@@ -10,16 +8,13 @@ interface Props {/** Auto-opening is desktop-only — on mobile the panel is a full-screen* sheet, so opening it on session entry would bury the chat. The* session-entry collapse below must still run on mobile: it is what- * forgets the previous chat's artifact, and the new tool UI mounts its+ * forgets the previous chat's artifact, and the chat column mounts its* artifacts button on every viewport. */canAutoOpen?: boolean;}export function ContextPanelAutoOpen({ sessionId, canAutoOpen = true }: Props) {- // The sidebar auto-opens on progress only when the task bar is off.- const taskBarEnabled = useGetFlag(Flag.TASK_PROGRESS_BAR);useCollapseContextPanelOnSession(sessionId);useAutoOpenForFiles(sessionId, canAutoOpen);- useAutoOpenForProgress(sessionId, canAutoOpen && !taskBarEnabled);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.tsxindex 559d55b164..97d8f15e7d 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelToggle.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/ContextPanelToggle.tsx@@ -2,14 +2,10 @@import { Button } from "@/components/ui/button";import { cn } from "@/lib/utils";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { useCopilotUIStore } from "../../store";+import { useAreWorkspaceFileCardsOpen } from "../../useAreWorkspaceFileCardsOpen";import { WorkspaceFilesPopover } from "../WorkspaceFileCards/components/WorkspaceFilesPopover";-import {- CheckListIcon,- Folder01Icon,- SidebarRightIcon,-} from "@hugeicons/core-free-icons";+import { File02Icon, SidebarRightIcon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";interface Props {@@ -22,36 +18,12 @@ export function ContextPanelToggle({ sessionId }: Props) {(s) => s.artifactPanel.activeArtifact != null,);const activeTab = useCopilotUIStore((s) => s.artifactPanel.activeTab);- const toggleContextPanel = useCopilotUIStore((s) => s.toggleContextPanel);const toggleContextPanelTab = useCopilotUIStore((s) => s.toggleContextPanelTab,);const closeArtifactPanel = useCopilotUIStore((s) => s.closeArtifactPanel);const lastArtifact = useCopilotUIStore((s) => s.artifactPanel.lastArtifact);const openArtifact = useCopilotUIStore((s) => s.openArtifact);- // The side panel carries its own close button, so the trigger hides while- // it's open. The new-UI card grid sits inline in the chat column instead, so- // the icon has to stay put and behave as a real toggle.- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);-- if (!isNewToolUI) {- 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}- >- <Icon icon={Folder01Icon} className="!size-5" />- </Button>- </div>- );- }-// Sized and stroked like the sidebar's nav icons so the chat's top-right// controls read as the same family.const buttonClass =@@ -63,10 +35,10 @@ export function ContextPanelToggle({ sessionId }: Props) {// one control that closes them — the panel carries no close button.const isRightSidebarOpen = hasArtifact || isArtifactsOpen;// While the right sidebar owns that region the inline files card has- // nowhere to sit, so the task-list trigger becomes a popover; it returns- // to the pinned card as soon as the sidebar closes.+ // nowhere to sit, so the workspace-files trigger becomes a popover; it+ // returns to the pinned card as soon as the sidebar closes.const showFilesAsPopover = isRightSidebarOpen;- const isFilesCardOpen = isOpen && !isRightSidebarOpen;+ const isFilesCardOpen = useAreWorkspaceFileCardsOpen();function handleSidebarToggle() {if (hasArtifact) {@@ -98,12 +70,12 @@ export function ContextPanelToggle({ sessionId }: Props) {size="icon"onClick={() => toggleContextPanelTab("files")}aria-label={- isFilesCardOpen ? "Hide workspace files" : "Open workspace panel"+ isFilesCardOpen ? "Hide workspace files" : "Open workspace files"}aria-pressed={isFilesCardOpen}className={cn(buttonClass, isFilesCardOpen && "bg-zinc-200/70")}>- <Icon icon={CheckListIcon} className={iconClass} />+ <Icon icon={File02Icon} className={iconClass} /></Button>)}<Buttondiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanel.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanel.test.tsxindex 08e8f7d263..4ba685b5a2 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanel.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanel.test.tsx@@ -1,26 +1,16 @@-import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";+import { beforeEach, describe, expect, test, vi } from "vitest";import { render, screen, waitFor } from "@/tests/integrations/test-utils";import { server } from "@/mocks/mock-server";import { getListWorkspaceFilesMockHandler200 } from "@/app/api/__generated__/endpoints/workspace/workspace.msw";import { useCopilotUIStore } from "../../../store";import { ContextPanel } from "../ContextPanel";-const flagState = vi.hoisted(() => ({ newToolUI: false }));-vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {const actual =await importOriginal<typeof import("@/services/feature-flags/use-get-flag")>();- return {- ...actual,- useGetFlag: (flag: string) =>- flag === actual.Flag.NEW_TOOL_UI ? flagState.newToolUI : false,- };-});--afterEach(() => {- flagState.newToolUI = false;+ return { ...actual, useGetFlag: () => false };});beforeEach(() => {@@ -36,24 +26,33 @@ beforeEach(() => {...s.artifactPanel,isOpen: true,activeArtifact: null,- activeTab: "files",+ activeTab: "artifacts",},}));});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("docks for the artifacts tab and renders the artifacts library", async () => {+ const { container } = render(<ContextPanel sessionId="session-1" />);+ await waitFor(() =>+ expect(container.querySelector("[data-context-panel]")).not.toBeNull(),+ );+ expect(await screen.findByText("Nothing to preview yet.")).toBeDefined();+ });++ test("leaves a files tab alone and stays undocked so the files card owns it", async () => {+ useCopilotUIStore.setState((s) => ({+ artifactPanel: { ...s.artifactPanel, activeTab: "files" },+ }));+ const { container } = render(<ContextPanel sessionId="session-1" />);+ expect(container.querySelector("[data-context-panel]")).toBeNull();+ expect(useCopilotUIStore.getState().artifactPanel.activeTab).toBe("files");});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",@@ -65,30 +64,6 @@ describe("ContextPanel", () => {}));const { container } = render(<ContextPanel sessionId="session-1" />);expect(container.querySelector("[data-context-panel]")).toBeNull();- expect(screen.queryByRole("tablist")).toBeNull();- });-- test("leaves a files tab alone and stays undocked so the files card owns it", async () => {- flagState.newToolUI = true;- const { container } = render(<ContextPanel sessionId="session-1" />);- await waitFor(() =>- expect(container.querySelector("[data-context-panel]")).toBeNull(),- );- expect(useCopilotUIStore.getState().artifactPanel.activeTab).toBe("files");- });-- test("docks for the artifacts tab under the new tool UI", async () => {- flagState.newToolUI = true;- useCopilotUIStore.setState((s) => ({- artifactPanel: { ...s.artifactPanel, activeTab: "artifacts" },- }));- const { container } = render(<ContextPanel sessionId="session-1" />);- await waitFor(() =>- expect(container.querySelector("[data-context-panel]")).not.toBeNull(),- );- expect(useCopilotUIStore.getState().artifactPanel.activeTab).toBe(- "artifacts",- );});test("renders nothing when closed", () => {@@ -102,4 +77,18 @@ describe("ContextPanel", () => {const { container } = render(<ContextPanel sessionId="session-1" />);expect(container.querySelector("[data-context-panel]")).toBeNull();});++ test("mobile: keeps the sheet closed for the files tab (the inline files card owns it)", () => {+ useCopilotUIStore.setState((s) => ({+ artifactPanel: { ...s.artifactPanel, activeTab: "files" },+ }));+ render(<ContextPanel sessionId="session-1" mobile />);+ expect(screen.queryByRole("dialog")).toBeNull();+ });++ test("mobile: opens the sheet on the artifacts tab", async () => {+ render(<ContextPanel sessionId="session-1" mobile />);+ expect(await screen.findByRole("dialog")).toBeDefined();+ expect(screen.getByRole("heading", { name: "Artifacts" })).toBeDefined();+ });});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelToggle.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelToggle.test.tsxindex 5c2e4c63ca..8b11eb5389 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelToggle.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/ContextPanelToggle.test.tsx@@ -5,18 +5,12 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";import { useCopilotUIStore } from "../../../store";import { ContextPanelToggle } from "../ContextPanelToggle";-const flagState = vi.hoisted(() => ({ newToolUI: false }));-vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {const actual =await importOriginal<typeof import("@/services/feature-flags/use-get-flag")>();- return {- ...actual,- useGetFlag: (flag: string) =>- flag === actual.Flag.NEW_TOOL_UI ? flagState.newToolUI : false,- };+ return { ...actual, useGetFlag: () => false };});const SESSION = "session-1";@@ -57,7 +51,6 @@ beforeEach(() => {});afterEach(() => {- flagState.newToolUI = false;setPanel({isOpen: false,activeArtifact: null,@@ -67,38 +60,11 @@ afterEach(() => {});});-describe("ContextPanelToggle - legacy (flag off)", () => {- test("renders an open-panel button when closed with no artifact", () => {- render(<ContextPanelToggle sessionId={SESSION} />);-- const button = screen.getByLabelText("Open workspace panel");- fireEvent.click(button);-- expect(panelState().isOpen).toBe(true);- });-- test("renders nothing while the panel is open", () => {- setPanel({ isOpen: true });- const { container } = render(<ContextPanelToggle sessionId={SESSION} />);- expect(container.textContent).toBe("");- });-- test("renders nothing while an artifact is previewing", () => {- setPanel({ activeArtifact: ARTIFACT });- const { container } = render(<ContextPanelToggle sessionId={SESSION} />);- expect(container.textContent).toBe("");- });-});--describe("ContextPanelToggle - new tool UI (flag on)", () => {- beforeEach(() => {- flagState.newToolUI = true;- });-+describe("ContextPanelToggle", () => {test("shows a files toggle button when the right sidebar is closed", () => {render(<ContextPanelToggle sessionId={SESSION} />);- const filesButton = screen.getByLabelText("Open workspace panel");+ const filesButton = screen.getByLabelText("Open workspace files");fireEvent.click(filesButton);expect(panelState().isOpen).toBe(true);expect(panelState().activeTab).toBe("files");@@ -116,7 +82,7 @@ describe("ContextPanelToggle - new tool UI (flag on)", () => {setPanel({ isOpen: true, activeTab: "artifacts" });render(<ContextPanelToggle sessionId={SESSION} />);- expect(screen.queryByLabelText("Open workspace panel")).toBeNull();+ expect(screen.queryByLabelText("Open workspace files")).toBeNull();expect(screen.queryByLabelText("Hide workspace files")).toBeNull();expect(await screen.findByLabelText("Workspace files")).toBeDefined();});@@ -132,7 +98,7 @@ describe("ContextPanelToggle - new tool UI (flag on)", () => {setPanel({ activeArtifact: ARTIFACT });render(<ContextPanelToggle sessionId={null} />);- expect(screen.getByLabelText("Open workspace panel")).toBeDefined();+ expect(screen.getByLabelText("Open workspace files")).toBeDefined();});test("sidebar toggle closes the artifact preview via closeArtifactPanel", () => {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.tsxdeleted file mode 100644index 20202fc7f0..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/__tests__/FilesTab.test.tsx+++ /dev/null@@ -1,82 +0,0 @@-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.tsxindex 7c29d40956..86e38543aa 100644--- 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.tsx@@ -6,6 +6,7 @@ import {fireEvent,render,screen,+ waitFor,} from "@/tests/integrations/test-utils";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import type { ArtifactRef } from "../../../store";@@ -33,7 +34,7 @@ function resetCopilotStore() {isOpen: true,activeArtifact: null,history: [],- activeTab: "files",+ activeTab: "artifacts",},}));}@@ -120,19 +121,20 @@ describe("Context/Artifact panel (desktop)", () => {vi.unstubAllGlobals();});- it("shows the artifact panel when an artifact opens and returns to the context panel on close", async () => {+ it("shows the artifact panel when an artifact opens and returns to the artifacts library on close", async () => {useCopilotUIStore.getState().openArtifact(makeArtifact());- render(<RightRegion sessionId="session-1" />);+ const { container } = 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.+ // visible and the docked Context Panel is hidden.expect(await screen.findByText("notes.txt")).toBeDefined();- expect(screen.queryByRole("tablist")).toBeNull();+ expect(container.querySelector("[data-context-panel]")).toBeNull();- // Close the artifact → it disappears and the Context Panel is shown.+ // Close the artifact → the preview clears and the artifacts library docks+ // in its place.fireEvent.click(screen.getByRole("button", { name: "Close" }));- expect(await screen.findByRole("tablist")).toBeDefined();- expect(screen.queryByText("notes.txt")).toBeNull();+ await waitFor(() => expect(screen.queryByText("notes.txt")).toBeNull());+ expect(container.querySelector("[data-context-panel]")).not.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.tsxdeleted file mode 100644index 442886b06b..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/FilesTab.tsx+++ /dev/null@@ -1,204 +0,0 @@-"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 { 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";-import { Download04Icon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--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"- >- <Icon icon={Download04Icon} 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/FileRow.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/components/FileRow.tsxdeleted file mode 100644index a516fa889c..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/components/FileRow.tsx+++ /dev/null@@ -1,83 +0,0 @@-import { Button } from "@/components/atoms/Button/Button";-import { OverflowText } from "@/components/atoms/OverflowText/OverflowText";-import {- Tooltip,- TooltipContent,- TooltipTrigger,-} from "@/components/atoms/Tooltip/BaseTooltip";-import { classifyArtifact } from "../../../../ArtifactPanel/helpers";-import {- formatFileSize,- formatFileTimestamp,- isUploadedFile,-} from "../helpers";-import type { SessionFile } from "../useSessionFiles";-import { Delete02Icon, Download04Icon } from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--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 fileIcon = classifyArtifact(item.mime_type ?? null, item.name).icon;- const canDelete = !isUploadedFile(item) && !!onRequestDelete;-- 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 icon={fileIcon} 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}`}- >- <Icon icon={Download04Icon} 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}`}- >- <Icon icon={Delete02Icon} size={16} />- </Button>- </TooltipTrigger>- <TooltipContent>Delete</TooltipContent>- </Tooltip>- )}- </div>- </div>- );-}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.tsxdeleted file mode 100644index 89cb81865c..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/ProgressTab/ProgressTab.tsx+++ /dev/null@@ -1,173 +0,0 @@-"use client";-import { motion } from "framer-motion";-import { useCopilotStreamStore } from "../../../../copilotStreamStore";-import {- countCompleted,- getLatestTaskList,- type TodoItem,-} from "../../../TaskProgressBar/helpers";-import {- CheckmarkCircle02Icon,- CircleDashedIcon,- CircleIcon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--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 (- <Icon- icon={CheckmarkCircle02Icon}- size={14}- className="text-green-500"- aria-label="completed"- />- );- }- if (status === "in_progress") {- return (- <Icon- icon={CircleDashedIcon}- size={14}- className="text-blue-500"- aria-label="in progress"- />- );- }- return (- <Icon- icon={CircleIcon}- size={14}- 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" }}- >- <Icon- icon={CheckmarkCircle02Icon}- size={32}- 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/TabSwitcher.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/TabSwitcher.tsxdeleted file mode 100644index c1b11e19ff..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/TabSwitcher.tsx+++ /dev/null@@ -1,58 +0,0 @@-import { cn } from "@/lib/utils";-import type { ContextPanelTab } from "../../../store";--interface Props {- activeTab: ContextPanelTab;- filesCount: number;- onChange: (tab: ContextPanelTab) => void;- showProgressTab?: boolean;- showFilesTab?: boolean;- showArtifactsTab?: boolean;-}--export function TabSwitcher({- activeTab,- filesCount,- onChange,- showProgressTab = true,- showFilesTab = true,- showArtifactsTab = false,-}: Props) {- const tabs: { id: ContextPanelTab; label: string }[] = [- ...(showProgressTab- ? [{ id: "progress" as const, label: "Progress" }]- : []),- ...(showFilesTab- ? [{ id: "files" as const, label: `Files (${filesCount})` }]- : []),- ...(showArtifactsTab- ? [{ id: "artifacts" as const, label: "Artifacts" }]- : []),- ];-- 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/useAutoOpenForProgress.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useAutoOpenForProgress.tsdeleted file mode 100644index f746c7fa7f..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useAutoOpenForProgress.ts+++ /dev/null@@ -1,51 +0,0 @@-"use client";--import { useEffect, useRef } from "react";-import { useCopilotStreamStore } from "../../copilotStreamStore";-import { useCopilotUIStore } from "../../store";-import { getLatestTaskList, type TodoItem } from "../TaskProgressBar/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,- enabled = true,-) {- 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(() => {- if (!enabled) return;- 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;- }- }, [enabled, messages, openContextPanelForProgress]);-}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.tsindex 95e9a12c5e..866d838faa 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useContextPanel.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/useContextPanel.ts@@ -4,7 +4,6 @@ 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);@@ -18,7 +17,6 @@ export function useContextPanel() {isOpen: artifactPanel.isOpen,activeTab: artifactPanel.activeTab,showExpanded,- setActiveTab,closeArtifactPanel,contextPanelWidth,setContextPanelWidth,diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/ToolChain.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/ToolChain.tsxindex 9d6a45f8e7..3344bff218 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/ToolChain.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/ToolChain.tsx@@ -45,15 +45,20 @@ const COLLAPSED_WINDOW = 2;interface Props {parts: MessagePart[];isStreaming: boolean;+ /** Public share viewer: the chain renders as the owner saw it, but setup+ * cards and the Proceed draft are the owner's work — a reader gets no+ * Connect prompt and no write into the composer store. */+ readOnly?: boolean;}-export function ToolChain({ parts, isStreaming }: Props) {+export function ToolChain({ parts, isStreaming, readOnly = false }: Props) {const [manualExpanded, setManualExpanded] = useState<boolean | null>(null);const panelId = useId();const reducedMotion = useReducedMotion();const pendingQuestions = useContext(PendingQuestionsContext);- const { setInitialPrompt, sentMessageCount } = useCopilotUIStore();+ const setInitialPrompt = useCopilotUIStore((s) => s.setInitialPrompt);+ const sentMessageCount = useCopilotUIStore((s) => s.sentMessageCount);// Ids drafted by the last Proceed, plus the send count at that moment.// Proceed only fills the composer, so the cards' onSent callbacks fire// when the user actually sends — not when the draft is written.@@ -317,8 +322,9 @@ export function ToolChain({ parts, isStreaming }: Props) {)}{/* Lifted rows render off-screen: their cards must stay mounted so- the ChainActionCard below keeps its registrations. */}- {liftedRows.length > 0 && (+ the ChainActionCard below keeps its registrations. A read-only+ transcript has no card to feed, so they stay unmounted. */}+ {!readOnly && liftedRows.length > 0 && (<div className="hidden"><ChainActionsContext.Provider value={chainActions}>{liftedRows.map((row) => (@@ -331,7 +337,7 @@ export function ToolChain({ parts, isStreaming }: Props) {{/* Lifted out of the rows: connecting, filling inputs and answeringquestions are the user's own work, so every card's asks merge intoone card under the chain that stays put when it collapses. */}- {hasCardWork && (+ {!readOnly && hasCardWork && (<ChainActionCardconnectors={connectorRequests}mcp={mcpRequests}@@ -344,7 +350,7 @@ export function ToolChain({ parts, isStreaming }: Props) {{/* Cards with nothing to connect, fill in or answer (confirm-only)still need somewhere to send from. */}- {pendingActions.length > 0 && !hasCardWork && (+ {!readOnly && pendingActions.length > 0 && !hasCardWork && (<div className="mt-1 flex flex-col items-start gap-2"><span className="flex items-center gap-1.5 text-sm text-zinc-600"><Icon icon={SentIcon} size={16} className="text-zinc-400" />diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/WorkspaceFileCards.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/WorkspaceFileCards.tsxindex 02d8191f03..8bb0727d18 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/WorkspaceFileCards.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/WorkspaceFileCards.tsx@@ -4,6 +4,7 @@ import { Download01Icon, File02Icon } from "@hugeicons/core-free-icons";import { AnimatePresence, motion } from "framer-motion";import { Button } from "@/components/atoms/Button/Button";import { Icon } from "@/components/atoms/Icon/Icon";+import { useAreWorkspaceFileCardsOpen } from "../../useAreWorkspaceFileCardsOpen";import { SessionActivityCard } from "./components/SessionActivityCard";import { StackSection } from "./components/StackSection";import { WorkspaceFilesContent } from "./components/WorkspaceFilesContent";@@ -20,18 +21,30 @@ const CARD_EASE: [number, number, number, number] = [0.32, 0.72, 0, 1];const CARD_TRANSITION = { duration: 0.3, ease: CARD_EASE };/**- * Workspace files as a floating card pinned to the chat's top right — the- * new-tool-UI replacement for the Context Panel's side sheet.+ * Workspace files as a floating card pinned to the chat's top right. The+ * workspace-files icon toggles ``artifactPanel.isOpen``; this grid answers it+ * inside the chat column rather than pushing a drawer over it.*- * Same trigger, same store flag: the workspace-files icon toggles- * ``artifactPanel.isOpen``; under the flag the panel renders nothing and this- * grid answers instead, so files stay inside the chat column rather than- * pushing a drawer over it.+ * The card body — and its file-list request and transcript scans — mounts+ * only while the card is showing.*/export function WorkspaceFileCards({ sessionId }: Props) {+ const isOpen = useAreWorkspaceFileCardsOpen();+ return (+ <AnimatePresence initial={false}>+ {isOpen && sessionId && (+ <OpenWorkspaceFileCards+ key="workspace-file-cards"+ sessionId={sessionId}+ />+ )}+ </AnimatePresence>+ );+}++function OpenWorkspaceFileCards({ sessionId }: { sessionId: string }) {const {files,- isOpen,isLoading,isError,isDeleting,@@ -51,62 +64,58 @@ export function WorkspaceFileCards({ sessionId }: Props) {const hasActivity = runs.length > 0 || schedules.length > 0;return (- <AnimatePresence initial={false}>- {isOpen && sessionId && (- <motion.div- initial={{ opacity: 0, x: 12, scale: 0.98 }}- animate={{ opacity: 1, x: 0, scale: 1 }}- exit={{ opacity: 0, x: 12, scale: 0.98 }}- transition={CARD_TRANSITION}- className="absolute right-8 top-18 z-30 flex w-80 max-w-[calc(100%-2rem)] flex-col gap-3"+ <motion.div+ initial={{ opacity: 0, x: 12, scale: 0.98 }}+ animate={{ opacity: 1, x: 0, scale: 1 }}+ exit={{ opacity: 0, x: 12, scale: 0.98 }}+ transition={CARD_TRANSITION}+ className="absolute right-8 top-18 z-30 flex w-80 max-w-[calc(100%-2rem)] flex-col gap-3"+ >+ {!showFilesCard && !hasActivity && (+ <div className="rounded-3xl bg-white/90 px-4 py-3 backdrop-blur smooth-shadow-ring-sm">+ <p className="py-2 text-center text-sm text-zinc-400">+ Nothing here yet.+ </p>+ </div>+ )}+ {showFilesCard && (+ <StackSection+ title="Files"+ icon={File02Icon}+ count={files.length || undefined}+ action={+ files.length > 0 && (+ <Button+ variant="ghost"+ size="icon"+ onClick={handleDownloadAll}+ loading={isZipping}+ aria-label="Download all"+ className="size-6 rounded-lg !p-0 text-zinc-400"+ >+ <Icon icon={Download01Icon} size={14} />+ </Button>+ )+ }>- {!showFilesCard && !hasActivity && (- <div className="rounded-3xl bg-white/90 px-4 py-3 backdrop-blur smooth-shadow-ring-sm">- <p className="py-2 text-center text-sm text-zinc-400">- Nothing here yet.- </p>- </div>- )}- {showFilesCard && (- <StackSection- title="Files"- icon={File02Icon}- count={files.length || undefined}- action={- files.length > 0 && (- <Button- variant="ghost"- size="icon"- onClick={handleDownloadAll}- loading={isZipping}- aria-label="Download all"- className="size-6 rounded-lg !p-0 text-zinc-400"- >- <Icon icon={Download01Icon} size={14} />- </Button>- )- }- >- <WorkspaceFilesContent- files={files}- isLoading={isLoading}- isError={isError}- isDeleting={isDeleting}- isZipping={isZipping}- pendingDelete={pendingDelete}- onOpen={handleOpen}- onDownload={handleDownload}- onRequestDelete={setPendingDelete}- onConfirmDelete={handleConfirmDelete}- onCancelDelete={() => setPendingDelete(null)}- onDownloadAll={handleDownloadAll}- showHeader={false}- />- </StackSection>- )}- <SessionActivityCard sessionId={sessionId} />- </motion.div>+ <WorkspaceFilesContent+ files={files}+ isLoading={isLoading}+ isError={isError}+ isDeleting={isDeleting}+ isZipping={isZipping}+ pendingDelete={pendingDelete}+ onOpen={handleOpen}+ onDownload={handleDownload}+ onRequestDelete={setPendingDelete}+ onConfirmDelete={handleConfirmDelete}+ onCancelDelete={() => setPendingDelete(null)}+ onDownloadAll={handleDownloadAll}+ showHeader={false}+ />+ </StackSection>)}- </AnimatePresence>+ <SessionActivityCard sessionId={sessionId} />+ </motion.div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFileCards.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFileCards.test.tsxindex 41b6d2f5b5..bd46cdca02 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFileCards.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFileCards.test.tsx@@ -10,6 +10,7 @@ import {screen,waitFor,} from "@/tests/integrations/test-utils";+import { act } from "@testing-library/react";import type { UIMessage } from "ai";import { http, HttpResponse } from "msw";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";@@ -89,6 +90,23 @@ function openFilesCard() {});}+function closeFilesCard() {+ useCopilotUIStore.setState({+ artifactPanel: {+ isOpen: false,+ activeArtifact: null,+ history: [],+ activeTab: "files",+ lastArtifact: null,+ },+ });+}++// Long enough for a mounted list query to reach the MSW handler.+function flushRequests() {+ return new Promise((resolve) => setTimeout(resolve, 20));+}+function activityMessages(): UIMessage[] {return [{@@ -186,6 +204,25 @@ describe("WorkspaceFileCards", () => {expect(container.textContent).toBe("");});+ it("requests the file list only while the card is open", async () => {+ let listRequests = 0;+ server.use(+ getListWorkspaceFilesMockHandler200(() => {+ listRequests += 1;+ return listResponse();+ }),+ );+ closeFilesCard();+ render(<WorkspaceFileCards sessionId={SESSION} />);+ await flushRequests();+ expect(listRequests).toBe(0);++ act(() => openFilesCard());++ expect(await screen.findByText("uploaded.png")).toBeDefined();+ expect(listRequests).toBeGreaterThan(0);+ });+it("opens a file as an artifact preview on click", async () => {render(<WorkspaceFileCards sessionId={SESSION} />);diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFilesPopover.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFilesPopover.test.tsxindex b7a0a837e5..9e9045a663 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFilesPopover.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/__tests__/WorkspaceFilesPopover.test.tsx@@ -16,19 +16,38 @@ import { useCopilotStreamStore } from "../../../copilotStreamStore";import { useCopilotUIStore } from "../../../store";import { WorkspaceFilesPopover } from "../components/WorkspaceFilesPopover";-// Popover renders through a portal and only shows content while open in-// real usage; mocking it as an always-mounted pair of divs (the pattern-// used by UsagePopover's tests) lets us assert the section content and-// wiring without fighting Radix positioning/portal internals in jsdom.-vi.mock("@/components/molecules/Popover/Popover", () => {- function Popover({ children }: { children: React.ReactNode }) {- return <div>{children}</div>;+// Popover renders through a portal in real usage; mocking it as plain divs+// that still honour `open` (the trigger toggles it, the content mounts only+// while it's set) lets us assert the section content and wiring without+// fighting Radix positioning/portal internals in jsdom.+vi.mock("@/components/molecules/Popover/Popover", async () => {+ const { createContext, useContext } = await import("react");+ const OpenContext = createContext<{+ open: boolean;+ onOpenChange: (open: boolean) => void;+ }>({ open: false, onOpenChange: () => {} });+ function Popover({+ open,+ onOpenChange,+ children,+ }: {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ children: React.ReactNode;+ }) {+ return (+ <OpenContext.Provider value={{ open, onOpenChange }}>+ {children}+ </OpenContext.Provider>+ );}function PopoverTrigger({ children }: { children: React.ReactNode }) {- return <div>{children}</div>;+ const { open, onOpenChange } = useContext(OpenContext);+ return <div onClick={() => onOpenChange(!open)}>{children}</div>;}function PopoverContent({ children }: { children: React.ReactNode }) {- return <div>{children}</div>;+ const { open } = useContext(OpenContext);+ return open ? <div>{children}</div> : null;}return { Popover, PopoverTrigger, PopoverContent };});@@ -41,6 +60,15 @@ function listResponse(return { files, offset: 0, has_more: false };}+function openPopover() {+ fireEvent.click(screen.getByLabelText("Workspace files"));+}++// Long enough for a mounted list query to reach the MSW handler.+function flushRequests() {+ return new Promise((resolve) => setTimeout(resolve, 20));+}+function activityMessages(): UIMessage[] {return [{@@ -72,6 +100,7 @@ describe("WorkspaceFilesPopover", () => {it("shows the empty state when there are no files, runs, or schedules", async () => {server.use(getListWorkspaceFilesMockHandler200(listResponse()));render(<WorkspaceFilesPopover sessionId={SESSION} />);+ openPopover();expect(await screen.findByText("Nothing here yet.")).toBeDefined();});@@ -94,6 +123,7 @@ describe("WorkspaceFilesPopover", () => {),);render(<WorkspaceFilesPopover sessionId={SESSION} />);+ openPopover();fireEvent.click(await screen.findByTitle("result.csv"));@@ -130,6 +160,7 @@ describe("WorkspaceFilesPopover", () => {}),);render(<WorkspaceFilesPopover sessionId={SESSION} />);+ openPopover();fireEvent.click(await screen.findByLabelText("Delete result.csv"));fireEvent.click(await screen.findByRole("button", { name: /^Delete$/ }));@@ -144,9 +175,28 @@ describe("WorkspaceFilesPopover", () => {.setMessageSnapshot(SESSION, activityMessages());render(<WorkspaceFilesPopover sessionId={SESSION} />);+ openPopover();expect(await screen.findByText(/^Runs \(1\)/)).toBeDefined();expect(screen.getByText("Daily Digest")).toBeDefined();expect(screen.queryByText("Nothing here yet.")).toBeNull();});++ it("requests the file list only once the popover opens", async () => {+ let listRequests = 0;+ server.use(+ getListWorkspaceFilesMockHandler200(() => {+ listRequests += 1;+ return listResponse();+ }),+ );+ render(<WorkspaceFilesPopover sessionId={SESSION} />);+ await flushRequests();+ expect(listRequests).toBe(0);++ openPopover();++ expect(await screen.findByText("Nothing here yet.")).toBeDefined();+ expect(listRequests).toBeGreaterThan(0);+ });});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/components/WorkspaceFilesPopover.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/components/WorkspaceFilesPopover.tsxindex 40236d9acf..7d373e39e6 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/components/WorkspaceFilesPopover.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/components/WorkspaceFilesPopover.tsx@@ -7,7 +7,7 @@ import {PopoverTrigger,} from "@/components/molecules/Popover/Popover";import { cn } from "@/lib/utils";-import { CheckListIcon } from "@hugeicons/core-free-icons";+import { File02Icon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";import { Fragment, useState } from "react";import type { SessionFile } from "../../ContextPanel/components/FilesTab/useSessionFiles";@@ -40,6 +40,78 @@ export function WorkspaceFilesPopover({iconClassName,}: Props) {const [isPopoverOpen, setIsPopoverOpen] = useState(false);+ // The delete confirm renders as a modal dialog outside the popover tree —+ // without the guards below the popover reads that interaction as "outside"+ // and closes, unmounting the dialog mid-confirm.+ const [isConfirmingDelete, setIsConfirmingDelete] = useState(false);++ // The trigger can still close the popover mid-confirm; the content (and its+ // pending delete) unmounts with it, so the guard must not outlive them.+ function handleOpenChange(open: boolean) {+ setIsPopoverOpen(open);+ if (!open) setIsConfirmingDelete(false);+ }++ return (+ <div className={cn("flex shrink-0 items-start p-2", wrapperClassName)}>+ <Popover open={isPopoverOpen} onOpenChange={handleOpenChange}>+ <PopoverTrigger asChild>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ aria-label="Workspace files"+ // p-0: the atom's size="icon" is p-3, which on a size-8 trigger+ // leaves an 8px content box and squeezes the glyph. shrink-0: the+ // atom has no [&_svg]:shrink-0, so the icon would flex-shrink to+ // fit regardless of its own size class.+ className={cn(+ "p-0",+ triggerClassName ?? "size-9 rounded-xl",+ isPopoverOpen && "bg-zinc-200/70 text-zinc-900",+ )}+ >+ <Icon+ icon={File02Icon}+ className={cn("shrink-0", iconClassName ?? "!size-[1.15rem]")}+ />+ </Button>+ </PopoverTrigger>+ <PopoverContent+ align="end"+ className="w-80 rounded-3xl border-none bg-white/90 px-4 py-3 shadow-none backdrop-blur smooth-shadow-ring-sm"+ onInteractOutside={(e) => {+ if (isConfirmingDelete) e.preventDefault();+ }}+ onEscapeKeyDown={(e) => {+ if (isConfirmingDelete) e.preventDefault();+ }}+ >+ {/* Mounted only while the popover is open, so the file-list request+ and the transcript scans wait for the click — as the floating+ card's body does. */}+ <WorkspaceFilesPopoverContent+ sessionId={sessionId}+ onFileOpened={() => setIsPopoverOpen(false)}+ onConfirmingDeleteChange={setIsConfirmingDelete}+ />+ </PopoverContent>+ </Popover>+ </div>+ );+}++interface ContentProps {+ sessionId: string;+ onFileOpened: () => void;+ onConfirmingDeleteChange: (isConfirming: boolean) => void;+}++function WorkspaceFilesPopoverContent({+ sessionId,+ onFileOpened,+ onConfirmingDeleteChange,+}: ContentProps) {const {files,isLoading,@@ -57,7 +129,22 @@ export function WorkspaceFilesPopover({function handleOpenFile(file: SessionFile) {handleOpen(file);- setIsPopoverOpen(false);+ onFileOpened();+ }++ function handleRequestDelete(file: SessionFile) {+ setPendingDelete(file);+ onConfirmingDeleteChange(true);+ }++ function handleCancelDelete() {+ setPendingDelete(null);+ onConfirmingDeleteChange(false);+ }++ async function handleConfirm() {+ await handleConfirmDelete();+ onConfirmingDeleteChange(false);}// Mirrors the floating stack: each section only earns its space once it has@@ -77,9 +164,9 @@ export function WorkspaceFilesPopover({pendingDelete={pendingDelete}onOpen={handleOpenFile}onDownload={handleDownload}- onRequestDelete={setPendingDelete}- onConfirmDelete={handleConfirmDelete}- onCancelDelete={() => setPendingDelete(null)}+ onRequestDelete={handleRequestDelete}+ onConfirmDelete={handleConfirm}+ onCancelDelete={handleCancelDelete}onDownloadAll={handleDownloadAll}/>),@@ -104,60 +191,20 @@ export function WorkspaceFilesPopover({},].filter((section) => section.node);- return (- <div className={cn("flex shrink-0 items-start p-2", wrapperClassName)}>- <Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>- <PopoverTrigger asChild>- <Button- type="button"- variant="ghost"- size="icon"- aria-label="Workspace files"- // p-0: the atom's size="icon" is p-3, which on a size-8 trigger- // leaves an 8px content box and squeezes the glyph. shrink-0: the- // atom has no [&_svg]:shrink-0, so the icon would flex-shrink to- // fit regardless of its own size class.- className={cn(- "p-0",- triggerClassName ?? "size-9 rounded-xl",- isPopoverOpen && "bg-zinc-200/70 text-zinc-900",- )}- >- <Icon- icon={CheckListIcon}- className={cn("shrink-0", iconClassName ?? "!size-[1.15rem]")}- />- </Button>- </PopoverTrigger>- <PopoverContent- align="end"- className="w-80 rounded-3xl border-none bg-white/90 px-4 py-3 shadow-none backdrop-blur smooth-shadow-ring-sm"- // The delete confirm renders as a modal dialog outside the popover- // tree — without these guards the popover reads that interaction as- // "outside" and closes, unmounting the dialog mid-confirm.- onInteractOutside={(e) => {- if (pendingDelete) e.preventDefault();- }}- onEscapeKeyDown={(e) => {- if (pendingDelete) e.preventDefault();- }}- >- {sections.length === 0 ? (- <p className="py-2 text-center text-sm text-zinc-400">- Nothing here yet.- </p>- ) : (- // One popover can't float three cards, so the stack's card breaks- // become hairlines here.- sections.map((section, index) => (- <Fragment key={section.key}>- {index > 0 && <div className="my-3 border-t border-zinc-100" />}- {section.node}- </Fragment>- ))- )}- </PopoverContent>- </Popover>- </div>- );+ if (sections.length === 0) {+ return (+ <p className="py-2 text-center text-sm text-zinc-400">+ Nothing here yet.+ </p>+ );+ }++ // One popover can't float three cards, so the stack's card breaks become+ // hairlines here.+ return sections.map((section, index) => (+ <Fragment key={section.key}>+ {index > 0 && <div className="my-3 border-t border-zinc-100" />}+ {section.node}+ </Fragment>+ ));}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/useWorkspaceFileCards.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/useWorkspaceFileCards.tsindex 2507a386cd..e4c12e96ed 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/useWorkspaceFileCards.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/WorkspaceFileCards/useWorkspaceFileCards.ts@@ -21,16 +21,6 @@ import {export function useWorkspaceFileCards(sessionId: string | null) {const queryClient = useQueryClient();const openArtifact = useCopilotUIStore((s) => s.openArtifact);- // An open artifact owns the right side, so the card steps aside for it- // instead of floating on top of the artifact panel. The artifacts side- // panel likewise takes over: while its tab is active the trigger swaps the- // card for a popover (see ContextPanelToggle).- const isOpen = useCopilotUIStore(- (s) =>- s.artifactPanel.isOpen &&- s.artifactPanel.activeArtifact == null &&- s.artifactPanel.activeTab !== "artifacts",- );// Session-scoped on purpose: the card is this chat's drawer — only files// uploaded to or created in this session. The artifacts side panel carries// the workspace-wide library.@@ -93,7 +83,6 @@ export function useWorkspaceFileCards(sessionId: string | null) {return {files,- isOpen,isLoading,isError,isDeleting,diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/copilotStreamStore.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/copilotStreamStore.tsindex 796f6a6413..aa00db9c88 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/copilotStreamStore.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/copilotStreamStore.ts@@ -70,20 +70,12 @@ interface CopilotStreamStore {pendingFirstSend: PendingFirstSend | null;pendingFirstSendSessionId: string | 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;bindPendingFirstSendToSession: (sessionId: string) => void;@@ -106,7 +98,6 @@ export const useCopilotStreamStore = create<CopilotStreamStore>()(pendingFirstSend: null,pendingFirstSendSessionId: null,pendingFileParts: [],- isStreaming: false,getCoord(sessionId) {return { ...defaultCoord, ...get().sessions[sessionId] };@@ -147,11 +138,6 @@ export const useCopilotStreamStore = create<CopilotStreamStore>()(},}));},- setStreaming(streaming) {- if (get().isStreaming === streaming) return;- set({ isStreaming: streaming });- },-setPendingFirstSend(send) {set({ pendingFirstSend: send, pendingFirstSendSessionId: null });},@@ -186,7 +172,6 @@ export const useCopilotStreamStore = create<CopilotStreamStore>()(pendingFirstSend: null,pendingFirstSendSessionId: null,pendingFileParts: [],- isStreaming: false,});},}),diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/helpers/__tests__/toolOutput.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/helpers/__tests__/toolOutput.test.tsindex bb7718f663..bad61de4f2 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/helpers/__tests__/toolOutput.test.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/helpers/__tests__/toolOutput.test.ts@@ -4,7 +4,6 @@ vi.mock("@sentry/nextjs", () => ({ captureMessage: vi.fn() }));import * as Sentry from "@sentry/nextjs";import {- isCorruptedCardToolPart,isUnparseableJsonOutput,reportCorruptedToolOutput,} from "../toolOutput";@@ -39,47 +38,6 @@ describe("isUnparseableJsonOutput", () => {});});-describe("isCorruptedCardToolPart", () => {- const truncated = '{"type":"setup_requirements","message":"Conn';-- it("flags a card-capable tool with truncated JSON output", () => {- expect(- isCorruptedCardToolPart({- type: "tool-run_block",- state: "output-available",- output: truncated,- }),- ).toBe(true);- });-- it("ignores tools that never render cards", () => {- expect(- isCorruptedCardToolPart({- type: "tool-search_docs",- state: "output-available",- output: truncated,- }),- ).toBe(false);- });-- it("ignores non-completed and valid-output parts", () => {- expect(- isCorruptedCardToolPart({- type: "tool-run_block",- state: "output-error",- output: truncated,- }),- ).toBe(false);- expect(- isCorruptedCardToolPart({- type: "tool-run_block",- state: "output-available",- output: '{"type":"block_output","block_id":"b1"}',- }),- ).toBe(false);- });-});-describe("reportCorruptedToolOutput", () => {it("reports once per toolCallId", () => {reportCorruptedToolOutput("call-dedupe-test", "tool-run_block");diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/helpers/toolOutput.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/helpers/toolOutput.tsindex 41dd659567..d367b280af 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/helpers/toolOutput.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/helpers/toolOutput.ts@@ -1,19 +1,5 @@import * as Sentry from "@sentry/nextjs";-/**- * Tool types whose JSON output can surface interactive cards in chat- * (setup_requirements sign-in cards, pickers, review prompts). When their- * output arrives corrupted the user loses a card they cannot recover —- * unlike read-only tools where a broken payload only degrades a summary.- */-export const CARD_CAPABLE_TOOL_TYPES: ReadonlySet<string> = new Set([- "tool-run_block",- "tool-continue_run_block",- "tool-connect_integration",- "tool-run_agent",- "tool-run_mcp_tool",-]);-/*** True when `output` looks like a JSON document but doesn't parse — the* signature of a payload truncated or mangled in transit. Plain-text@@ -32,16 +18,6 @@ export function isUnparseableJsonOutput(output: unknown): boolean {}}-export function isCorruptedCardToolPart(part: {- type: string;- state?: unknown;- output?: unknown;-}): boolean {- if (!CARD_CAPABLE_TOOL_TYPES.has(part.type)) return false;- if (part.state !== "output-available") return false;- return isUnparseableJsonOutput(part.output);-}-/*** Bounded so the dedupe set can't grow for the tab's lifetime and so a* `toolCallId` reused in a much later conversation eventually evicts its olddiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/store.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/store.tsindex 5a7b0a13bd..dab9b058a6 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/store.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/store.ts@@ -66,8 +66,9 @@ export type CopilotLlmAuthSelection =| { authProvider: "platform"; credentialId: null }| { authProvider: "codex"; credentialId: string };-/** Context panel tab. */-export type ContextPanelTab = "progress" | "files" | "artifacts";+/** Context panel tab: "files" is the inline workspace-files card, "artifacts"+ * the docked artifacts library. */+export type ContextPanelTab = "files" | "artifacts";const isClient = typeof window !== "undefined";@@ -79,7 +80,9 @@ function getPersistedOpen(): boolean {function getPersistedTab(): ContextPanelTab {if (!isClient) return "files";const saved = storage.get(Key.COPILOT_CONTEXT_PANEL_TAB);- return saved === "progress" || saved === "artifacts" ? saved : "files";+ // Anything else (including a "progress" tab persisted by the retired+ // sidebar) falls back to the files card.+ return saved === "artifacts" ? saved : "files";}function clampWidth(value: number, min: number, max: number): number {@@ -187,7 +190,6 @@ interface CopilotUIState {clearArtifactPreview: () => void;resetArtifactPanel: () => void;goBackArtifact: () => void;- setActiveTab: (tab: ContextPanelTab) => void;toggleContextPanel: () => void;/** Opens the panel on `tab`, or closes it if that tab is already showing. */toggleContextPanelTab: (tab: ContextPanelTab) => void;@@ -195,7 +197,6 @@ interface CopilotUIState {* can never restore the previous chat's artifact. */clearLastArtifact: () => void;openContextPanelForFiles: () => void;- openContextPanelForProgress: () => void;autoOpenArtifact: (ref: ArtifactRef) => void;showFilesTab: () => void;@@ -405,19 +406,6 @@ 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;@@ -482,22 +470,6 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({},}));},- 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: [],- },- }));- },// Auto-open path for sessions that already have generated files: surfaces the// last generated file directly in the Artifact panel. Respects the user's@@ -514,8 +486,8 @@ export const useCopilotUIStore = create<CopilotUIState>((set, get) => ({},}));},- // Explicit user action (Artifact panel folder button): always opens the- // Context panel on the Files tab, dropping any open artifact preview.+ // Explicit user action (the artifact panel's files button): drops the open+ // preview and hands the region to the floating files card.showFilesTab: () => {if (isClient) {storage.set(Key.COPILOT_CONTEXT_PANEL_OPEN, "true");diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/useAreWorkspaceFileCardsOpen.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/useAreWorkspaceFileCardsOpen.tsnew file mode 100644index 0000000000..9423ea2f45--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/useAreWorkspaceFileCardsOpen.ts@@ -0,0 +1,17 @@+import { useCopilotUIStore } from "./store";++// The one condition under which the floating workspace-files card is on+// screen — read by the card itself and by the composer and message column+// that slide aside for it. The open flag also drives the docked artifacts+// panel and the artifact preview, so only a non-artifacts tab with no+// preview means the card is showing. The docked panel narrows the chat+// column on its own, so it must never also trigger the slide, or the two+// shifts stack and push the messages off screen under the app sidebar.+export function useAreWorkspaceFileCardsOpen() {+ return useCopilotUIStore(+ (s) =>+ s.artifactPanel.isOpen &&+ s.artifactPanel.activeArtifact == null &&+ s.artifactPanel.activeTab !== "artifacts",+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotStream.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotStream.tsindex 52e569f8b4..79e0221f15 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotStream.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotStream.ts@@ -4,7 +4,6 @@ import {} from "@/app/api/__generated__/endpoints/chat/chat";import { toast } from "@/components/molecules/Toast/use-toast";import { useMountEffect } from "@/hooks/useMountEffect";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { useChat } from "@ai-sdk/react";import { useQueryClient } from "@tanstack/react-query";import type { UIMessage } from "ai";@@ -95,9 +94,6 @@ export function useCopilotStream({}: UseCopilotStreamArgs) {const queryClient = useQueryClient();const setInitialPrompt = useCopilotUIStore((s) => s.setInitialPrompt);- // The hydrated-tail trim below ships with the new tool UI; the old UI- // keeps its original in-progress-only trim.- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);const [rateLimitMessage, setRateLimitMessage] = useState<string | null>(null);function dismissRateLimit() {setRateLimitMessage(null);@@ -379,27 +375,22 @@ export function useCopilotStream({// messages (``-seq-N`` ids) are dropped — a streamed tail belongs// to a finished turn this mount ran (continuation reconnect) and// the resume will NOT replay it.- if (isNewToolUI) {- // The trim starts at the running turn's first hydrated message, not- // at the last user message: a turn the backend started on its own- // (engine-switch continuation) has no user row in front of it, so a- // user-anchored cut would also delete the completed answer above it- // — content the resume never replays. Never cut past the last user- // message either, so the prompt itself always survives.- const lastUserIndex = prev.findLastIndex((m) => m.role === "user");- const userCut = lastUserIndex === -1 ? -1 : lastUserIndex + 1;- const activeTurnIndex = activeTurnStartMessageId- ? prev.findIndex((m) => m.id === activeTurnStartMessageId)- : -1;- const cutIndex =- activeTurnIndex === -1 ? userCut : Math.max(activeTurnIndex, userCut);- const tail = cutIndex === -1 ? [] : prev.slice(cutIndex);- if (- tail.length > 0 &&- tail.every((m) => extractDbSequence(m) !== null)- ) {- return prev.slice(0, cutIndex);- }+ // The trim starts at the running turn's first hydrated message, not+ // at the last user message: a turn the backend started on its own+ // (engine-switch continuation) has no user row in front of it, so a+ // user-anchored cut would also delete the completed answer above it+ // — content the resume never replays. Never cut past the last user+ // message either, so the prompt itself always survives.+ const lastUserIndex = prev.findLastIndex((m) => m.role === "user");+ const userCut = lastUserIndex === -1 ? -1 : lastUserIndex + 1;+ const activeTurnIndex = activeTurnStartMessageId+ ? prev.findIndex((m) => m.id === activeTurnStartMessageId)+ : -1;+ const cutIndex =+ activeTurnIndex === -1 ? userCut : Math.max(activeTurnIndex, userCut);+ const tail = cutIndex === -1 ? [] : prev.slice(cutIndex);+ if (tail.length > 0 && tail.every((m) => extractDbSequence(m) !== null)) {+ return prev.slice(0, cutIndex);}const last = prev[prev.length - 1];return hasInProgressAssistantParts(last) ? prev.slice(0, -1) : prev;@@ -601,16 +592,6 @@ 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/(public)/tour/chat/components/TourMessageList/TourMessageList.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourMessageList/TourMessageList.tsxindex c2155d3f0b..a78baaac18 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourMessageList/TourMessageList.tsx+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourMessageList/TourMessageList.tsx@@ -60,7 +60,15 @@ export function TourMessageList({ messages, isStreaming, footer }: Props) {</MessageContent></Message>))}- {showThinking && <ThinkingIndicator active elapsedSeconds={0} />}+ {/* The demo has no backend status stream, so it names the state+ itself — the indicator shows no label otherwise. */}+ {showThinking && (+ <ThinkingIndicator+ active+ elapsedSeconds={0}+ statusMessage="Thinking…"+ />+ )}{footer}</ConversationContent><ConversationScrollButton />diff --git a/autogpt_platform/frontend/src/components/contextual/CredentialsInput/CredentialsInput.tsx b/autogpt_platform/frontend/src/components/contextual/CredentialsInput/CredentialsInput.tsxindex ba6b233fc7..72557434fd 100644--- a/autogpt_platform/frontend/src/components/contextual/CredentialsInput/CredentialsInput.tsx+++ b/autogpt_platform/frontend/src/components/contextual/CredentialsInput/CredentialsInput.tsx@@ -8,7 +8,6 @@ import {} from "@/lib/autogpt-server-api/types";import { cn } from "@/lib/utils";import { toDisplayName } from "@/providers/agent-credentials/helper";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { useState } from "react";import { APIKeyCredentialsModal } from "./components/APIKeyCredentialsModal/APIKeyCredentialsModal";import { ConnectCredentialDialog } from "./components/ConnectCredentialDialog/ConnectCredentialDialog";@@ -66,10 +65,9 @@ export function CredentialsInput({isOptional,});const [isConnectDialogOpen, setConnectDialogOpen] = useState(false);- // The unified connect dialog ships with the new tool UI; off keeps the- // legacy per-type action flow everywhere.- const usesConnectDialog =- useGetFlag(Flag.NEW_TOOL_UI) && variant === "default";+ // The builder node keeps its per-type action flow; everywhere else goes+ // through the unified connect dialog.+ const usesConnectDialog = variant === "default";if (!isLoaded(hookData)) {return null;diff --git a/autogpt_platform/frontend/src/components/contextual/CredentialsInput/__tests__/CredentialsInput.test.tsx b/autogpt_platform/frontend/src/components/contextual/CredentialsInput/__tests__/CredentialsInput.test.tsxindex 777eca6eea..05f8dc6670 100644--- a/autogpt_platform/frontend/src/components/contextual/CredentialsInput/__tests__/CredentialsInput.test.tsx+++ b/autogpt_platform/frontend/src/components/contextual/CredentialsInput/__tests__/CredentialsInput.test.tsx@@ -14,7 +14,12 @@ import type {import React from "react";import { CredentialsInput } from "../CredentialsInput";-vi.mock("@/hooks/useCredentials", () => ({ default: vi.fn() }));+// The default variant mounts ConnectCredentialDialog, which reads the pure+// getConnectableCredentialTypes helper — keep it while stubbing the hook.+vi.mock("@/hooks/useCredentials", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@/hooks/useCredentials")>()),+ default: vi.fn(),+}));vi.mock("@/lib/autogpt-server-api/context", () => ({useBackendAPI: vi.fn(),BackendAPIProvider: ({ children }: { children: React.ReactNode }) => children,@@ -35,6 +40,18 @@ vi.mock("@/lib/oauth-popup", () => ({vi.mock("@/app/api/__generated__/endpoints/mcp/mcp", () => ({postV2InitiateOauthLoginForAnMcpServer: vi.fn(),}));+// The unified connect dialog's method picker pulls in the OAuth and API-key+// connect hooks; a stub keeps the default-variant test on the dialog itself.+vi.mock(+ "@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/ConnectMethodView/ConnectMethodView",+ () => ({+ ConnectMethodView: ({ provider }: { provider: { name: string } }) => (+ <div data-testid="connect-method-view">+ Connect AutoGPT to {provider.name}+ </div>+ ),+ }),+);import { toast } from "@/components/molecules/Toast/use-toast";import useCredentials from "@/hooks/useCredentials";@@ -510,6 +527,7 @@ describe("CredentialsInput – device auth", () => {schema={deviceSchema}selectedCredentials={undefined}onSelectCredentials={vi.fn()}+ variant="node"/>,);}@@ -532,9 +550,11 @@ describe("CredentialsInput – device auth", () => {function StatefulCredentialsInput({initial,onSelectionChange,+ variant,}: {initial?: CredentialsMetaInput;onSelectionChange?: (credential?: CredentialsMetaInput) => void;+ variant?: "default" | "node";}) {const [selected, setSelected] = React.useState<CredentialsMetaInput | undefined@@ -551,6 +571,7 @@ function StatefulCredentialsInput({selectedCredentials={selected}onSelectCredentials={handleSelectionChange}showTitle={false}+ variant={variant}/>);}@@ -814,7 +835,9 @@ describe("CredentialsInput – a removed connection", () => {// the thing it was warning about.// The provider list starts empty and gains the connection when the// callback resolves, which is what really happens: `oAuthCallback` mints- // the credential and refreshes the list.+ // the credential and refreshes the list. The builder node wires the+ // button straight to that flow (the default variant opens the connect+ // dialog instead).const reconnected = {id: "new-cred",provider: "codex",@@ -841,7 +864,7 @@ describe("CredentialsInput – a removed connection", () => {cleanup: { abort: vi.fn() },});- render(<StatefulCredentialsInput initial={deleted} />);+ render(<StatefulCredentialsInput initial={deleted} variant="node" />);expect(await screen.findByText(@@ -856,3 +879,27 @@ describe("CredentialsInput – a removed connection", () => {await waitFor(() => expect(screen.queryByText(/was removed/i)).toBeNull());});});++describe("CredentialsInput default variant", () => {+ it("opens the unified connect dialog instead of the per-type action flow", async () => {+ mockUseCredentials.mockReturnValue(makeCredentialsReturn());+ const backendAPI = makeBackendAPI();+ mockUseBackendAPI.mockReturnValue(backendAPI);++ render(+ <CredentialsInput+ schema={baseSchema}+ selectedCredentials={undefined}+ onSelectCredentials={vi.fn()}+ />,+ );++ fireEvent.click(+ await screen.findByRole("button", { name: /add account/i }),+ );++ expect(await screen.findByText(/^Connect AutoGPT to/)).toBeDefined();+ expect(backendAPI.oAuthLogin).not.toHaveBeenCalled();+ expect(mockOpenOAuthPopup).not.toHaveBeenCalled();+ });+});diff --git a/autogpt_platform/frontend/src/components/contextual/CredentialsInput/components/CredentialsFlatView/CredentialsFlatView.tsx b/autogpt_platform/frontend/src/components/contextual/CredentialsInput/components/CredentialsFlatView/CredentialsFlatView.tsxindex 1a76c598c0..414322ee95 100644--- a/autogpt_platform/frontend/src/components/contextual/CredentialsInput/components/CredentialsFlatView/CredentialsFlatView.tsx+++ b/autogpt_platform/frontend/src/components/contextual/CredentialsInput/components/CredentialsFlatView/CredentialsFlatView.tsx@@ -5,7 +5,6 @@ import {BlockIOCredentialsSubSchema,CredentialsMetaInput,} from "@/lib/autogpt-server-api/types";-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { ExclamationTriangleIcon } from "@radix-ui/react-icons";import { useState } from "react";import { AyrshareConnectButton } from "../AyrshareConnectButton/AyrshareConnectButton";@@ -105,7 +104,6 @@ export function CredentialsFlatView({onAddCredential,onDeleteCredential,}: Props) {- const isNewToolUI = useGetFlag(Flag.NEW_TOOL_UI);const hasCredentials = credentials.length > 0;// Ayrshare has no user-settable credential — provisioning runs on the// server after the user clicks the Connect Social Media Accounts@@ -119,39 +117,20 @@ export function CredentialsFlatView({<>{showTitle && (<div className="mb-2 flex items-center gap-2">- {isNewToolUI ? (- <Text variant="small" className="flex items-center gap-2">- <span className="inline-flex items-center gap-1 text-zinc-600">- {displayName} credentials- {isOptional && (- <span className="font-normal text-gray-500">(optional)</span>- )}- {!isOptional && !selectedCredential && (- <span className="inline-flex items-center gap-1 text-red-600">- <ExclamationTriangleIcon className="size-3.5" />- <span className="font-normal">required</span>- </span>- )}- </span>- </Text>- ) : (- <Text variant="large-medium" className="flex items-center gap-2">- <span className="inline-flex items-center gap-1">- {displayName} credentials- {isOptional && (- <span className="text-sm font-normal text-gray-500">- (optional)- </span>- )}- {!isOptional && !selectedCredential && (- <span className="inline-flex items-center gap-1 text-red-600">- <ExclamationTriangleIcon className="size-4" />- <span className="text-sm font-normal">required</span>- </span>- )}- </span>- </Text>- )}+ <Text variant="small" className="flex items-center gap-2">+ <span className="inline-flex items-center gap-1 text-zinc-600">+ {displayName} credentials+ {isOptional && (+ <span className="font-normal text-gray-500">(optional)</span>+ )}+ {!isOptional && !selectedCredential && (+ <span className="inline-flex items-center gap-1 text-red-600">+ <ExclamationTriangleIcon className="size-3.5" />+ <span className="font-normal">required</span>+ </span>+ )}+ </span>+ </Text>{schema.description && (<InformationTooltip description={schema.description} />)}@@ -209,24 +188,12 @@ export function CredentialsFlatView({{showAyrshareConnect && <AyrshareConnectButton className="mt-2" />}</>) : showAddAction ? (- isNewToolUI ? (- <ProviderConnectRow- provider={provider}- displayName={displayName}- actionButtonText={actionButtonText}- onAddCredential={onAddCredential}- />- ) : (- <Button- variant="primary"- size="small"- onClick={onAddCredential}- className="w-fit"- type="button"- >- {actionButtonText}- </Button>- )+ <ProviderConnectRow+ provider={provider}+ displayName={displayName}+ actionButtonText={actionButtonText}+ onAddCredential={onAddCredential}+ />) : showAyrshareConnect ? (<AyrshareConnectButton className="mt-2" />) : null}diff --git a/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts b/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.tsindex 02732d5c53..83ac257dcb 100644--- a/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts+++ b/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts@@ -32,7 +32,6 @@ export enum Flag {// Mirror of the backend ``Flag`` enum — the endpoints 404 when off, so// both sides must agree. Off renders the pillbox flow untouched.ONBOARDING_BRAIN_DUMP = "onboarding-brain-dump",- NEW_TOOL_UI = "new-tool-ui",// Graphiti memory + dream-system gates. Mirror of the backend// ``Flag`` enum in ``backend/util/feature_flag.py``. Frontend reads// them when memory/dream-related UI surfaces ship (P6+ on the@@ -80,7 +79,6 @@ const defaultFlags = {// brain dump for everyone — which is what the backend 404s are meant to// prevent. Use NEXT_PUBLIC_FORCE_FLAG_ONBOARDING_BRAIN_DUMP locally.[Flag.ONBOARDING_BRAIN_DUMP]: false,- [Flag.NEW_TOOL_UI]: false,[Flag.GRAPHITI_MEMORY]: false,[Flag.GRAPHITI_COMMUNITIES_ENABLED]: false,[Flag.DREAM_PASS_ENABLED]: false,@@ -146,8 +144,6 @@ function readEnvOverride(flag: Flag): string | undefined {return process.env.NEXT_PUBLIC_FORCE_FLAG_SETTINGS_NOTIFICATIONS;case Flag.ONBOARDING_BRAIN_DUMP:return process.env.NEXT_PUBLIC_FORCE_FLAG_ONBOARDING_BRAIN_DUMP;- case Flag.NEW_TOOL_UI:- return process.env.NEXT_PUBLIC_FORCE_FLAG_NEW_TOOL_UI;case Flag.GRAPHITI_MEMORY:return process.env.NEXT_PUBLIC_FORCE_FLAG_GRAPHITI_MEMORY;case Flag.GRAPHITI_COMMUNITIES_ENABLED: