AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(frontend): hide unfinished expert pods UI (#14472)
Abhimanyu Yadav765bb4112447
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsxindex 1452a50533..a9d085369d 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx@@ -2,11 +2,8 @@ import {getArchiveExpertMockHandler,getArchiveExpertMockHandler401,getGetExpertDetachPreviewMockHandler,- getAssignExpertPodMockHandler,- getCreateExpertPodMockHandler,getListExpertCredentialsMockHandler,getListExpertPodsMockHandler,- getListExpertPodsMockHandler401,getListExpertsMockHandler,getListExpertsMockHandler401,getResumeExpertSchedulesMockHandler,@@ -19,7 +16,6 @@ import {} from "@/app/api/__generated__/endpoints/library/library.msw";import { getGetV1ListExecutionSchedulesForAUserMockHandler } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";import { Expert } from "@/app/api/__generated__/models/expert";-import { ExpertPod } from "@/app/api/__generated__/models/expertPod";import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";import { getGetV2ListSessionsMockHandler200 } from "@/app/api/__generated__/endpoints/chat/chat.msw";@@ -143,14 +139,6 @@ vi.mock("next/navigation", () => ({},}));-async function openNewPodDialog(user: ReturnType<typeof userEvent.setup>) {- await user.click(await screen.findByRole("button", { name: "New Pod" }));-}--async function openTab(user: ReturnType<typeof userEvent.setup>, name: string) {- await user.click(await screen.findByRole("tab", { name }));-}-const hiredMaria: Expert = {id: "expert-maria",name: "Maria",@@ -219,7 +207,7 @@ describe("TeamPage", () => {).toBeTruthy();});- test("header exposes Raise expert, Hire expert and New Pod actions", async () => {+ test("header exposes expert actions without pod creation", async () => {server.use(getListExpertsMockHandler([hiredMaria]));render(<TeamPage />);@@ -230,7 +218,7 @@ describe("TeamPage", () => {screen.getByRole("link", { name: "Hire expert" }).getAttribute("href"),).toBe("/marketplace#experts");- expect(screen.getByRole("button", { name: "New Pod" })).toBeDefined();+ expect(screen.queryByRole("button", { name: "New Pod" })).toBeNull();});test("renders hired experts with a stat strip instead of chips", async () => {@@ -885,318 +873,21 @@ describe("TeamPage", () => {).toBe("/raise");});- test("shows an error card when loading experts fails", async () => {+ test("shows an error card and retries when loading experts fails", async () => {server.use(getListExpertsMockHandler401());render(<TeamPage />);expect(await screen.findByText("Something went wrong")).toBeDefined();- });-- test("groups experts under their pod and leaves ungrouped members off the board", async () => {- const user = userEvent.setup();- const growthPod: ExpertPod = {- id: "pod-growth",- name: "Growth",- created_at: new Date("2026-08-14T00:00:00Z"),- };- const poddedMaria: Expert = { ...hiredMaria, pod_id: "pod-growth" };- const lee: Expert = {- ...hiredMaria,- id: "expert-lee",- name: "Lee",- pod_id: null,- };- const archivedPoddedSam: Expert = {- ...hiredMaria,- id: "expert-sam",- name: "Sam",- pod_id: "pod-growth",- is_archived: true,- };- server.use(- getListExpertsMockHandler([poddedMaria, lee, archivedPoddedSam]),- getListExpertPodsMockHandler([growthPod]),- );-- render(<TeamPage />);- await openTab(user, "Pod board");-- const board = await screen.findByRole("region", { name: "Pods" });- const podHeader = await within(board).findByRole("heading", {- name: "Growth",- });- const maria = await within(board).findByText("Maria");- expect(- podHeader.compareDocumentPosition(maria) &- Node.DOCUMENT_POSITION_FOLLOWING,- ).toBeTruthy();- // Lee has no pod, so the board does not list him anywhere.- expect(within(board).queryByText("Lee")).toBeNull();- expect(screen.queryByRole("heading", { name: "Ungrouped" })).toBeNull();- // Archived experts never render, even with a pod_id.- expect(screen.queryByText("Sam")).toBeNull();- });-- test("opens a pod to show its expert cards and returns to the board", async () => {- const user = userEvent.setup();- const growthPod: ExpertPod = {- id: "pod-growth",- name: "Growth",- created_at: new Date("2026-08-14T00:00:00Z"),- };- const poddedMaria: Expert = { ...hiredMaria, pod_id: "pod-growth" };- server.use(- getListExpertsMockHandler([poddedMaria]),- getListExpertPodsMockHandler([growthPod]),- );-- render(<TeamPage />);- await openTab(user, "Pod board");-- await user.click(- await screen.findByRole("button", { name: "Open Growth pod" }),- );- const pod = screen.getByRole("region", { name: "Growth pod" });- expect(- within(pod)- .getByRole("link", { name: "View Maria" })- .getAttribute("href"),- ).toBe("/team/expert-maria");- expect(within(pod).getByRole("button", { name: "Chat" })).toBeDefined();-- await user.click(within(pod).getByRole("button", { name: "Back to pods" }));- expect(screen.getByRole("region", { name: "Pods" })).toBeDefined();- expect(- screen.getByRole("button", { name: "Open Growth pod" }),- ).toBeDefined();- });-- test("shows a pod with no members instead of hiding it", async () => {- const user = userEvent.setup();- const emptyPod: ExpertPod = {- id: "pod-empty",- name: "Support",- created_at: new Date("2026-08-14T00:00:00Z"),- };- server.use(- getListExpertsMockHandler([hiredMaria]),- getListExpertPodsMockHandler([emptyPod]),- );-- render(<TeamPage />);- await openTab(user, "Pod board");-- const podHeader = await screen.findByRole("heading", { name: "Support" });- const emptyCopy = await screen.findByText("No experts in this pod yet.");- expect(- podHeader.compareDocumentPosition(emptyCopy) &- Node.DOCUMENT_POSITION_FOLLOWING,- ).toBeTruthy();- // The unpodded expert is not listed on the board.- const board = screen.getByRole("region", { name: "Pods" });- expect(within(board).queryByText("Maria")).toBeNull();- });-- test("creates a pod from the New pod dialog", async () => {- const user = userEvent.setup();- let createdName: string | undefined;- server.use(- getListExpertsMockHandler([hiredMaria]),- getCreateExpertPodMockHandler(async ({ request }) => {- const body = (await request.json()) as { name: string };- createdName = body.name;- return {- id: "pod-new",- name: body.name,- created_at: new Date("2026-08-14T00:00:00Z"),- };- }),- );-- render(<TeamPage />);-- await openNewPodDialog(user);- const nameInput = await screen.findByRole("textbox", { name: /pod name/i });- await user.type(nameInput, "Growth");- await user.click(screen.getByRole("button", { name: "Create pod" }));-- await waitFor(() => expect(createdName).toBe("Growth"));- });-- test("keeps the New pod dialog open and shows the reason when creation fails", async () => {- const user = userEvent.setup();- server.use(- getListExpertsMockHandler([hiredMaria]),- http.post("/api/proxy/api/experts/pods", () =>- HttpResponse.json(- { detail: "A pod named 'Growth' already exists" },- { status: 409 },- ),- ),- );-- render(<TeamPage />);-- await openNewPodDialog(user);- const nameInput = await screen.findByRole("textbox", { name: /pod name/i });- await user.type(nameInput, "Growth");- await user.click(screen.getByRole("button", { name: "Create pod" }));-- await waitFor(() =>- expect(toastMock).toHaveBeenCalledWith(- expect.objectContaining({- title: "Could not create pod",- description: "A pod named 'Growth' already exists",- variant: "destructive",- }),- ),- );- // The dialog must survive the failure with the typed name intact.- expect(screen.getByRole("dialog", { name: "New pod" })).toBeDefined();- expect((nameInput as HTMLInputElement).value).toBe("Growth");- });- test("clears the pod name after cancelling and reopening the dialog", async () => {- const user = userEvent.setup();server.use(getListExpertsMockHandler([hiredMaria]));+ await userEvent.click(screen.getByRole("button", { name: "Try Again" }));- render(<TeamPage />);-- await openNewPodDialog(user);- const nameInput = await screen.findByRole("textbox", { name: /pod name/i });- expect(nameInput.getAttribute("maxlength")).toBe("100");- await user.type(nameInput, "Draft pod");- await user.click(screen.getByRole("button", { name: "Cancel" }));- await waitFor(() =>- expect(screen.queryByRole("dialog", { name: "New pod" })).toBeNull(),- );-- await openNewPodDialog(user);- const reopenedNameInput = await screen.findByRole("textbox", {- name: /pod name/i,- });- expect((reopenedNameInput as HTMLInputElement).value).toBe("");- });-- test("moves an expert into a pod from the card menu", async () => {- const user = userEvent.setup();- const growthPod: ExpertPod = {- id: "pod-growth",- name: "Growth",- created_at: new Date("2026-08-14T00:00:00Z"),- };- let assignedPodId: string | null | undefined;- let expertRequests = 0;- server.use(- getListExpertsMockHandler(() => {- expertRequests += 1;- return [hiredMaria];- }),- getListExpertPodsMockHandler([growthPod]),- getAssignExpertPodMockHandler(async ({ request }) => {- const body = (await request.json()) as { pod_id: string | null };- assignedPodId = body.pod_id;- return { ...hiredMaria, pod_id: body.pod_id };- }),- );-- render(<TeamPage />);-- await screen.findByText("Maria");- await waitFor(() => expect(expertRequests).toBe(1));- await user.click(screen.getByRole("button", { name: "Move to pod" }));- await user.click(await screen.findByRole("menuitem", { name: /Growth/ }));-- await waitFor(() => expect(assignedPodId).toBe("pod-growth"));- expect(toastMock).toHaveBeenCalledWith({ title: "Moved to Growth" });- // The PATCH response is written into the cache, so the heavy roster query- // is never refetched and the card reflects the move immediately.- expect(- await screen.findByRole("button", {- name: "Move to pod (currently Growth)",- }),- ).toBeDefined();- expect(expertRequests).toBe(1);- });-- test("removes an expert from its pod from the card menu", async () => {- const user = userEvent.setup();- const growthPod: ExpertPod = {- id: "pod-growth",- name: "Growth",- created_at: new Date("2026-08-14T00:00:00Z"),- };- const poddedMaria: Expert = { ...hiredMaria, pod_id: growthPod.id };- let assignedPodId: string | null | undefined;- server.use(- getListExpertsMockHandler([poddedMaria]),- getListExpertPodsMockHandler([growthPod]),- getAssignExpertPodMockHandler(async ({ request }) => {- const body = (await request.json()) as { pod_id: string | null };- assignedPodId = body.pod_id;- return { ...poddedMaria, pod_id: body.pod_id };- }),- );-- render(<TeamPage />);-- await screen.findByText("Maria");- // The trigger is icon-only, so the pod it is already in has to come- // through in the accessible name.- const trigger = screen.getByRole("button", {- name: "Move to pod (currently Growth)",- });- await user.click(trigger);- await user.click(- await screen.findByRole("menuitem", { name: "Remove from pod" }),- );-- await waitFor(() => expect(assignedPodId).toBeNull());- expect(toastMock).toHaveBeenCalledWith({ title: "Removed from pod" });- });-- test("shows the assign failure reason and refreshes stale pods", async () => {- const user = userEvent.setup();- const growthPod: ExpertPod = {- id: "pod-growth",- name: "Growth",- created_at: new Date("2026-08-14T00:00:00Z"),- };- let podRequests = 0;- server.use(- getListExpertsMockHandler([hiredMaria]),- getListExpertPodsMockHandler(() => {- podRequests += 1;- return podRequests === 1 ? [growthPod] : [];- }),- http.patch("/api/proxy/api/experts/expert-maria/pod", () =>- HttpResponse.json(- { detail: "Expert or pod not found" },- { status: 404 },- ),- ),- );-- render(<TeamPage />);-- await screen.findByText("Maria");- await user.click(screen.getByRole("button", { name: "Move to pod" }));- await user.click(await screen.findByRole("menuitem", { name: /Growth/ }));-- await waitFor(() =>- expect(toastMock).toHaveBeenCalledWith({- title: "Could not move expert",- description: "Expert or pod not found",- variant: "destructive",- }),- );- await waitFor(() =>- expect(screen.queryByRole("button", { name: "Move to pod" })).toBeNull(),- );+ expect(await screen.findByText("Maria")).toBeDefined();+ expect(screen.queryByText("Something went wrong")).toBeNull();});- test("keeps the roster in loading state until pods resolve", async () => {+ test("renders the roster without waiting for pods", async () => {server.use(getListExpertsMockHandler([hiredMaria]),getListExpertPodsMockHandler(() => new Promise(() => {})),@@ -1205,21 +896,24 @@ describe("TeamPage", () => {render(<TeamPage />);await screen.findByText("Autopilot");- await new Promise((resolve) => setTimeout(resolve, 50));- // Experts resolved but pods have not: no card may render yet, or a- // podded expert would flash as ungrouped.- expect(screen.queryByText("Maria")).toBeNull();+ expect(await screen.findByText("Maria")).toBeDefined();});- test("shows an error card when loading pods fails", async () => {+ test("renders the roster without requesting pods", async () => {+ const podsRequest = vi.fn();server.use(getListExpertsMockHandler([hiredMaria]),- getListExpertPodsMockHandler401(),+ getListExpertPodsMockHandler(() => {+ podsRequest();+ throw new Error("Pods must not be requested");+ }),);render(<TeamPage />);- expect(await screen.findByText("Something went wrong")).toBeDefined();+ expect(await screen.findByText("Maria")).toBeDefined();+ expect(screen.queryByText("Something went wrong")).toBeNull();+ expect(podsRequest).not.toHaveBeenCalled();});test("calls notFound() when the flag is resolved and disabled", () => {diff --git a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/tabs.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/tabs.test.tsxindex f12ab80e5a..d6fc37dd12 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/tabs.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/tabs.test.tsx@@ -82,14 +82,14 @@ beforeEach(() => {});describe("TeamPage tabs", () => {- test("opens on Team Overview and offers Pod board", async () => {+ test("opens on Team Overview without Pod board", async () => {server.use(getListExpertsMockHandler([maria]));render(<TeamPage />);const overview = await screen.findByRole("tab", { name: "Team Overview" });expect(overview.getAttribute("aria-selected")).toBe("true");- expect(screen.getByRole("tab", { name: "Pod board" })).toBeDefined();+ expect(screen.queryByRole("tab", { name: "Pod board" })).toBeNull();expect(screen.queryByRole("tab", { name: "All tasks" })).toBeNull();});@@ -108,33 +108,8 @@ describe("TeamPage tabs", () => {expect(await screen.findByText("Maria")).toBeDefined();expect(screen.getByText("Lee")).toBeDefined();- // Pod grouping belongs to the Pod board tab, not the overview grid.expect(screen.queryByRole("heading", { name: "Growth" })).toBeNull();});-- test("Pod board tells you how to start when there are no pods and no experts", async () => {- const user = userEvent.setup();- server.use(getListExpertsMockHandler([]));-- render(<TeamPage />);- await user.click(await screen.findByRole("tab", { name: "Pod board" }));-- expect(await screen.findByText("No pods yet")).toBeDefined();- });-- test("Pod board lists only pods, never an ungrouped bucket", async () => {- const user = userEvent.setup();- server.use(getListExpertsMockHandler([maria]));-- render(<TeamPage />);- await user.click(await screen.findByRole("tab", { name: "Pod board" }));-- const board = await screen.findByRole("region", { name: "Pods" });- expect(within(board).getByRole("heading", { name: "Pods" })).toBeDefined();- expect(within(board).getByText("No pods yet")).toBeDefined();- expect(screen.queryByRole("heading", { name: "Ungrouped" })).toBeNull();- expect(within(board).queryByText("Maria")).toBeNull();- });});describe("TeamRoster toolbar", () => {diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsxindex 3279344abe..215910186d 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx@@ -1,5 +1,4 @@import { Expert } from "@/app/api/__generated__/models/expert";-import { ExpertPod } from "@/app/api/__generated__/models/expertPod";import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";import {Avatar,@@ -8,21 +7,11 @@ import {} from "@/components/atoms/Avatar/Avatar";import { Badge } from "@/components/atoms/Badge/Badge";import { Button } from "@/components/atoms/Button/Button";-import { Icon } from "@/components/atoms/Icon/Icon";import { Text } from "@/components/atoms/Text/Text";-import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuSeparator,- DropdownMenuTrigger,-} from "@/components/molecules/DropdownMenu/DropdownMenu";import {BubbleChatIcon,PencilEdit02Icon,PlusSignIcon,- Tick02Icon,- UserGroupIcon,} from "@hugeicons/core-free-icons";import { creditsToUsdLabel } from "@/lib/credits";import Link from "next/link";@@ -44,23 +33,17 @@ import { useExpertTeamCard } from "./useExpertTeamCard";interface Props {expert: Expert;schedules: GraphExecutionJobInfo[];- pods: ExpertPod[];- currentPod: ExpertPod | undefined;onInstallWorkflow: (expertId: string) => void;onEditSoul: (expertId: string) => void;onChat: (expertId: string) => void;- onAssignPod: (expertId: string, podId: string | null) => void;}export function ExpertTeamCard({expert,schedules,- pods,- currentPod,onInstallWorkflow,onEditSoul,onChat,- onAssignPod,}: Props) {const blurb = getExpertBlurb(expert);const needsSetupCount = getNeedsSetupCount(expert, schedules);@@ -83,48 +66,6 @@ export function ExpertTeamCard({<div className="relative flex flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white">{/* Floated over the cover so the whole body stays one link target. */}<div className="absolute right-4 top-4 z-10 flex items-center gap-1.5">- {pods.length > 0 ? (- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button- variant="floating"- size="icon-sm"- leadingIcon={UserGroupIcon}- aria-label={- currentPod- ? `Move to pod (currently ${currentPod.name})`- : "Move to pod"- }- />- </DropdownMenuTrigger>- <DropdownMenuContent- align="end"- className="max-h-72 w-52 overflow-y-auto"- >- {pods.map((pod) => (- <DropdownMenuItem- key={pod.id}- onSelect={() => onAssignPod(expert.id, pod.id)}- >- <span className="flex-1 truncate">{pod.name}</span>- {expert.pod_id === pod.id ? (- <Icon icon={Tick02Icon} size={16} className="ml-2" />- ) : null}- </DropdownMenuItem>- ))}- {expert.pod_id ? (- <>- <DropdownMenuSeparator />- <DropdownMenuItem- onSelect={() => onAssignPod(expert.id, null)}- >- Remove from pod- </DropdownMenuItem>- </>- ) : null}- </DropdownMenuContent>- </DropdownMenu>- ) : null}<Buttonvariant="floating"size="icon-sm"diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsxindex bd74aad760..2df6fe0c21 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsx@@ -1,17 +1,9 @@"use client";import { Button } from "@/components/atoms/Button/Button";-import {- SparklesIcon,- UserAdd01Icon,- UserGroupIcon,-} from "@hugeicons/core-free-icons";+import { SparklesIcon, UserAdd01Icon } from "@hugeicons/core-free-icons";-interface Props {- onNewPod: () => void;-}--export function TeamHeaderActions({ onNewPod }: Props) {+export function TeamHeaderActions() {return (<div className="flex flex-wrap items-center gap-2"><Button@@ -32,14 +24,6 @@ export function TeamHeaderActions({ onNewPod }: Props) {>Hire expert</Button>- <Button- variant="outline"- size="xs"- onClick={onNewPod}- leadingIcon={UserGroupIcon}- >- New Pod- </Button></div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/team/page.tsx b/autogpt_platform/frontend/src/app/(platform)/team/page.tsxindex 145fb73b44..d7af5ef95e 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/page.tsx@@ -12,15 +12,13 @@ import {} from "@/components/molecules/TabsLine/TabsLine";import { cn } from "@/lib/utils";import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";-import { KanbanIcon, UserGroupIcon } from "@hugeicons/core-free-icons";+import { UserGroupIcon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";import { notFound } from "next/navigation";import { EmptyTeamState } from "./components/EmptyTeamState";import { ExpertChatDrawer } from "./components/ExpertChatDrawer/ExpertChatDrawer";import { ExpertTeamCard } from "./components/ExpertTeamCard/ExpertTeamCard";import { ExpertTeamCardSkeleton } from "./components/ExpertTeamCardSkeleton";-import { NewPodDialog } from "./components/NewPodDialog/NewPodDialog";-import { PodBoard } from "./components/PodBoard/PodBoard";import { SoulDrawer } from "./components/SoulDrawer/SoulDrawer";import { TeamHeaderActions } from "./components/TeamHeaderActions";import { TeamRoster } from "./components/TeamRoster/TeamRoster";@@ -32,16 +30,12 @@ const MAIN_CLASS =const TABS = [{ value: "overview", label: "Team Overview", icon: UserGroupIcon },- { value: "pods", label: "Pod board", icon: KanbanIcon },] as const;export default function TeamPage() {const { enabled, ready } = useFlagStatus(Flag.HIRE_EXPERTS);const {hiredExperts,- pods,- podForExpert,- podGroups,schedulesForExpert,isLoading,isError,@@ -57,12 +51,6 @@ export default function TeamPage() {chatDrawerKey,openChat,closeChat,- isNewPodOpen,- openNewPod,- closeNewPod,- createPod,- isCreatingPod,- assignPod,} = useTeamPage({ enabled: Boolean(enabled) && ready });if (!ready) {@@ -87,12 +75,9 @@ export default function TeamPage() {key={expert.id}expert={expert}schedules={schedulesForExpert(expert)}- pods={pods}- currentPod={podForExpert(expert)}onInstallWorkflow={installWorkflow}onEditSoul={openSoul}onChat={openChat}- onAssignPod={assignPod}/>);}@@ -112,7 +97,7 @@ export default function TeamPage() {Autopilot and your hired experts, ready to work.</Text></div>- <TeamHeaderActions onNewPod={openNewPod} />+ <TeamHeaderActions /></div>{isError ? (@@ -149,15 +134,6 @@ export default function TeamPage() {<EmptyTeamState />) : null}</TabsLineContent>-- <TabsLineContent value="pods">- <PodBoard- isLoading={isLoading}- podGroups={podGroups}- onNewPod={openNewPod}- renderCard={renderCard}- />- </TabsLineContent></TabsLine><InstallWorkflowPicker@@ -166,12 +142,6 @@ export default function TeamPage() {open={pickerExpertId !== null}onClose={closeWorkflowPicker}/>- <NewPodDialog- open={isNewPodOpen}- onClose={closeNewPod}- onCreate={createPod}- isCreating={isCreatingPod}- /></main><SoulDrawer key={soulDrawerKey} expert={soulExpert} onClose={closeSoul} />diff --git a/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.ts b/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.tsindex 2394261fee..174fa4a92f 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.ts+++ b/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.ts@@ -1,143 +1,34 @@-import {- getListExpertPodsQueryKey,- getListExpertsQueryKey,- listExperts,- useAssignExpertPod,- useCreateExpertPod,- useListExpertPods,- useListExperts,-} from "@/app/api/__generated__/endpoints/experts/experts";+import { useListExperts } from "@/app/api/__generated__/endpoints/experts/experts";import { useGetV1ListExecutionSchedulesForAUser } from "@/app/api/__generated__/endpoints/schedules/schedules";import { Expert } from "@/app/api/__generated__/models/expert";-import { ExpertPod } from "@/app/api/__generated__/models/expertPod";import { okData } from "@/app/api/helpers";-import { toast } from "@/components/molecules/Toast/use-toast";-import { useQueryClient } from "@tanstack/react-query";import { useState } from "react";import {AUTOPILOT_CHAT_TARGET,ChatTarget,expertToChatTarget,} from "./components/ExpertChatDrawer/helpers";-import {- getAssignToastTitle,- getExpertSchedules,- getHiredExperts,- groupExpertsByPods,-} from "./helpers";+import { getExpertSchedules, getHiredExperts } from "./helpers";interface Args {enabled: boolean;}export function useTeamPage({ enabled }: Args) {- const queryClient = useQueryClient();const [pickerExpertId, setPickerExpertId] = useState<string | null>(null);const [soulExpertId, setSoulExpertId] = useState<string | null>(null);const [soulDrawerKey, setSoulDrawerKey] = useState(0);const [chatTarget, setChatTarget] = useState<ChatTarget | null>(null);const [chatDrawerKey, setChatDrawerKey] = useState(0);- const [isNewPodOpen, setIsNewPodOpen] = useState(false);const expertsQuery = useListExperts({query: { select: (res) => (okData(res) ?? []) as Expert[], enabled },});- const podsQuery = useListExpertPods({- query: {- select: (res) => (okData(res) ?? []) as ExpertPod[],- enabled,- },- });const schedulesQuery = useGetV1ListExecutionSchedulesForAUser({query: { select: (res) => okData(res) ?? [], enabled },});- const pods = podsQuery.data ?? [];- // Built once per render so each card resolves its pod in O(1) instead of- // scanning the full list.- const podsById = new Map(pods.map((pod) => [pod.id, pod]));-- function podForExpert(expert: Expert) {- return expert.pod_id ? podsById.get(expert.pod_id) : undefined;- }-- function invalidateExperts() {- return queryClient.invalidateQueries({- queryKey: getListExpertsQueryKey(),- });- }-- function invalidatePods() {- return queryClient.invalidateQueries({- queryKey: getListExpertPodsQueryKey(),- });- }-- function writeExpertToCache(updated: Expert) {- const key = getListExpertsQueryKey();- const cached =- queryClient.getQueryData<Awaited<ReturnType<typeof listExperts>>>(key);- if (cached?.status !== 200) return invalidateExperts();- queryClient.setQueryData(key, {- ...cached,- data: cached.data.map((expert) =>- expert.id === updated.id ? updated : expert,- ),- });- }-- const { mutate: createPodMutate, isPending: isCreatingPod } =- useCreateExpertPod({- mutation: {- onSuccess: () => {- void invalidatePods();- setIsNewPodOpen(false);- },- onError: (error) => {- // The dialog stays open (it only closes on success) so the typed- // name survives; surface the server's reason, e.g. the 409's- // "already exists" detail.- toast({- title: "Could not create pod",- description: error instanceof Error ? error.message : undefined,- variant: "destructive",- });- },- },- });-- const { mutate: assignPodMutate } = useAssignExpertPod({- mutation: {- onSuccess: (response, variables) => {- // The PATCH returns the updated expert, so patch it into the cached- // roster instead of refetching the heavy list_experts join.- if (response.status === 200) writeExpertToCache(response.data);- else void invalidateExperts();-- const podId = variables.data.pod_id;- const destination = pods.find((pod) => pod.id === podId);- // A pod we don't know about means the cached pod list is stale.- if (podId !== null && !destination) void invalidatePods();- toast({- title: getAssignToastTitle({- podId,- destinationName: destination?.name,- }),- });- },- onError: (error) => {- void invalidatePods();- toast({- title: "Could not move expert",- description: error instanceof Error ? error.message : undefined,- variant: "destructive",- });- },- },- });-const hiredExperts = getHiredExperts(expertsQuery.data ?? []);const schedules = schedulesQuery.data ?? [];- const { groups } = groupExpertsByPods(hiredExperts, pods);function schedulesForExpert(expert: Expert) {return getExpertSchedules(expert, schedules);@@ -152,11 +43,7 @@ export function useTeamPage({ enabled }: Args) {}function refetch() {- return Promise.all([- expertsQuery.refetch(),- podsQuery.refetch(),- schedulesQuery.refetch(),- ]);+ return Promise.all([expertsQuery.refetch(), schedulesQuery.refetch()]);}function closeSoul() {@@ -180,36 +67,12 @@ export function useTeamPage({ enabled }: Args) {setChatTarget(null);}- function createPod(name: string) {- createPodMutate({ data: { name } });- }-- function assignPod(expertId: string, podId: string | null) {- assignPodMutate({ expertId, data: { pod_id: podId } });- }-- function openNewPod() {- setIsNewPodOpen(true);- }-- function closeNewPod() {- setIsNewPodOpen(false);- }-return {hiredExperts,- pods,- podForExpert,- podGroups: groups,schedules,schedulesForExpert,- isLoading:- enabled &&- (expertsQuery.isLoading ||- podsQuery.isLoading ||- schedulesQuery.isLoading),- isError:- expertsQuery.isError || podsQuery.isError || schedulesQuery.isError,+ isLoading: enabled && (expertsQuery.isLoading || schedulesQuery.isLoading),+ isError: expertsQuery.isError || schedulesQuery.isError,refetch,installWorkflow,pickerExpertId,@@ -223,11 +86,5 @@ export function useTeamPage({ enabled }: Args) {chatDrawerKey,openChat,closeChat,- isNewPodOpen,- openNewPod,- closeNewPod,- createPod,- isCreatingPod,- assignPod,};}