AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(frontend/marketplace): dedicated, shareable expert pages with a Coming soon state (#14313)
Ubbe667e023d4791
diff --git a/autogpt_platform/backend/backend/api/features/experts/routes.py b/autogpt_platform/backend/backend/api/features/experts/routes.pyindex ea0adb4235..a9d8d15aeb 100644--- a/autogpt_platform/backend/backend/api/features/experts/routes.py+++ b/autogpt_platform/backend/backend/api/features/experts/routes.py@@ -32,6 +32,12 @@ router = APIRouter(dependencies=[Security(autogpt_auth_lib.requires_user)],)+# Templates are marketplace content: the expert page shows them to signed-out+# visitors, so they live on a router without the session requirement. It must+# be mounted before ``router`` so ``/templates`` isn't swallowed by+# ``/{expert_id}``.+public_router = APIRouter(prefix="/experts", tags=["experts"])+class HireRequest(BaseModel):template_id: str@@ -114,7 +120,7 @@ class CreateRaisedExpertRequest(BaseModel):return value.strip() or None[email protected]("/templates", operation_id="list_expert_templates")+@public_router.get("/templates", operation_id="list_expert_templates")async def list_expert_templates() -> list[Expert]:return await experts_db.list_templates()diff --git a/autogpt_platform/backend/backend/api/features/experts/routes_test.py b/autogpt_platform/backend/backend/api/features/experts/routes_test.pyindex 85b309b66c..43013c2e94 100644--- a/autogpt_platform/backend/backend/api/features/experts/routes_test.py+++ b/autogpt_platform/backend/backend/api/features/experts/routes_test.py@@ -30,10 +30,11 @@ from backend.api.features.experts.models import (RaiseAttachmentFailure,RaiseResult,)-from backend.api.features.experts.routes import router+from backend.api.features.experts.routes import public_router, routerfrom backend.util.exceptions import NotFoundErrorapp = fastapi.FastAPI()+app.include_router(public_router)app.include_router(router)client = fastapi.testclient.TestClient(app)diff --git a/autogpt_platform/backend/backend/api/features/store/routes.py b/autogpt_platform/backend/backend/api/features/store/routes.pyindex 75f29361f5..1177b7f231 100644--- a/autogpt_platform/backend/backend/api/features/store/routes.py+++ b/autogpt_platform/backend/backend/api/features/store/routes.py@@ -232,11 +232,12 @@ async def post_user_review_for_agent("/listings/versions/{store_listing_version_id}",summary="Get agent by version",tags=["store"],- dependencies=[Security(autogpt_libs.auth.requires_user)],)async def get_agent_by_listing_version(store_listing_version_id: str,) -> store_model.StoreAgentDetails:+ # Public on purpose: the query only reads the APPROVED-only StoreAgent+ # view, so a signed-out expert page can show its workflows' preview images.agent = await store_db.get_store_agent_by_version_id(store_listing_version_id)return agentdiff --git a/autogpt_platform/backend/backend/api/rest_api.py b/autogpt_platform/backend/backend/api/rest_api.pyindex 5aaf85d1aa..64357abee8 100644--- a/autogpt_platform/backend/backend/api/rest_api.py+++ b/autogpt_platform/backend/backend/api/rest_api.py@@ -454,6 +454,7 @@ app.include_router(app.include_router(backend.api.features.library.routes.router, tags=["v2"], prefix="/api/library")+app.include_router(experts_routes.public_router, tags=["v2", "experts"], prefix="/api")app.include_router(experts_routes.router, tags=["v2", "experts"], prefix="/api")app.include_router(memory_routes.router, tags=["v2", "memory"], prefix="/api")app.include_router(home_routes.router, prefix="/api")diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsxindex 148c8b9de0..e1ab3875c5 100644--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx@@ -1,27 +1,22 @@import {- getHireExpertMockHandler,getListExpertsMockHandler,getListExpertTemplatesMockHandler,- getUpdateExpertSoulMockHandler,} from "@/app/api/__generated__/endpoints/experts/experts.msw";import { Expert } from "@/app/api/__generated__/models/expert";-import { Toaster } from "@/components/molecules/Toast/toaster";import { server } from "@/mocks/mock-server";import { render, screen, waitFor } from "@/tests/integrations/test-utils";-import userEvent from "@testing-library/user-event";import { HttpResponse, http } from "msw";import { beforeEach, describe, expect, test, vi } from "vitest";import { MainMarkeplacePage } from "../components/MainMarketplacePage/MainMarketplacePage";const mockUseAuth = vi.hoisted(() => vi.fn());-const mockRouterPush = vi.hoisted(() => vi.fn());vi.mock("next/navigation", () => ({useRouter: () => ({back: vi.fn(),forward: vi.fn(),prefetch: vi.fn(),- push: mockRouterPush,+ push: vi.fn(),refresh: vi.fn(),replace: vi.fn(),}),@@ -74,43 +69,21 @@ const hiredMaria: Expert = {source_template_id: "template-maria",};-const mariaWithSamples: Expert = {- ...mariaTemplate,- voice_samples: [- { label: "Punchy and bold", text: "Stop guessing what your buyers want." },- {- label: "Warm and story-led",- text: "Every campaign starts with a person, not a product.",- },- ],-};--function renderMarketplace() {- return render(- <>- <MainMarkeplacePage />- <Toaster />- </>,- );-}-describe("Marketplace ExpertsSection", () => {beforeEach(() => {- mockRouterPush.mockReset();mockUseAuth.mockReturnValue({user: { id: "user-1" },isLoggedIn: true,});});- test("renders experts section and hires from the profile sheet", async () => {+ test("links each expert card to its own page", async () => {server.use(getListExpertTemplatesMockHandler([mariaTemplate]),getListExpertsMockHandler([]),- getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),);- renderMarketplace();+ render(<MainMarkeplacePage />);expect(await screen.findByText("Meet the AI Experts")).toBeDefined();expect(@@ -118,17 +91,13 @@ describe("Marketplace ExpertsSection", () => {.getByRole("link", { name: /raise your own expert from scratch/i }).getAttribute("href"),).toBe("/raise");- await userEvent.click(await screen.findByText("Maria"));- await userEvent.click(- await screen.findByRole("button", { name: "Hire Maria" }),- );-- expect(await screen.findByText("Maria joined your team")).toBeDefined();- expect(await screen.findByText("View team")).toBeDefined();- expect(screen.queryByText("Chat with Maria")).toBeNull();- expect(mockRouterPush).toHaveBeenCalledWith(- `/copilot?expertId=${hiredMaria.id}&kickoff=1`,+ // The card is the link: a shared URL lands on the same profile the+ // marketplace opens, with no dialog in between.+ const card = await screen.findByRole("link", { name: /Maria/ });+ expect(card.getAttribute("href")).toBe(+ "/marketplace/experts/template-maria",);+ expect(screen.queryByRole("dialog")).toBeNull();});test("stays hidden and fetches nothing for signed-out visitors", async () => {@@ -142,7 +111,7 @@ describe("Marketplace ExpertsSection", () => {getListExpertsMockHandler([]),);- renderMarketplace();+ render(<MainMarkeplacePage />);expect(await screen.findByText("All AI Workflows")).toBeDefined();expect(screen.queryByText("Meet the AI Experts")).toBeNull();@@ -156,7 +125,7 @@ describe("Marketplace ExpertsSection", () => {getListExpertsMockHandler([]),);- renderMarketplace();+ render(<MainMarkeplacePage />);await waitFor(() => {@@ -179,7 +148,7 @@ describe("Marketplace ExpertsSection", () => {getListExpertsMockHandler([]),);- renderMarketplace();+ render(<MainMarkeplacePage />);const raiseLink = await screen.findByRole("link", {name: "Raise your own expert from scratch",@@ -188,198 +157,29 @@ describe("Marketplace ExpertsSection", () => {expect(raiseLink.textContent).not.toContain("…or");});- test("captures a voice pick as a plain-text soul PATCH after hire", async () => {- let savedVoice = "";- server.use(- getListExpertTemplatesMockHandler([mariaWithSamples]),- getListExpertsMockHandler([]),- getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),- getUpdateExpertSoulMockHandler(async (info) => {- const body = (await info.request.json()) as {- voice_preferences: string;- };- savedVoice = body.voice_preferences;- return { ...hiredMaria, voice_preferences: body.voice_preferences };- }),- );-- renderMarketplace();-- await userEvent.click(await screen.findByText("Maria"));- await userEvent.click(- await screen.findByRole("button", { name: "Hire Maria" }),- );-- // The voice pick replaces the profile before the join is celebrated.- expect(await screen.findByText("How should Maria write?")).toBeDefined();- await userEvent.click(await screen.findByText("Punchy and bold"));- await userEvent.click(- screen.getByRole("button", { name: "Use this voice" }),- );-- expect(await screen.findByText("Maria joined your team")).toBeDefined();- expect(savedVoice).toContain("Preferred writing style: Punchy and bold.");- expect(savedVoice).toContain("Stop guessing what your buyers want.");- expect(savedVoice.startsWith("{")).toBe(false);- });-- test("skips the voice pick without patching the soul", async () => {- let soulPatched = false;- server.use(- getListExpertTemplatesMockHandler([mariaWithSamples]),- getListExpertsMockHandler([]),- getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),- getUpdateExpertSoulMockHandler(() => {- soulPatched = true;- return hiredMaria;- }),- );-- renderMarketplace();-- await userEvent.click(await screen.findByText("Maria"));- await userEvent.click(- await screen.findByRole("button", { name: "Hire Maria" }),- );- // Wait for the picker to mount (hire awaits a list refetch first) before- // reaching for its skip control.- expect(await screen.findByText("How should Maria write?")).toBeDefined();- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );-- expect(await screen.findByText("Maria joined your team")).toBeDefined();- expect(soulPatched).toBe(false);- });-- test("refetches expert queries after the voice save so later Soul edits see it", async () => {- let listRequests = 0;- let voicePatched = false;- server.use(- getListExpertTemplatesMockHandler([mariaWithSamples]),- getListExpertsMockHandler(() => {- listRequests += 1;- return voicePatched ? [hiredMaria] : [];- }),- getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),- getUpdateExpertSoulMockHandler(() => {- voicePatched = true;- return hiredMaria;- }),- );-- renderMarketplace();-- await userEvent.click(await screen.findByText("Maria"));- await userEvent.click(- await screen.findByRole("button", { name: "Hire Maria" }),- );- expect(await screen.findByText("How should Maria write?")).toBeDefined();- const requestsBeforePick = listRequests;- await userEvent.click(await screen.findByText("Punchy and bold"));- await userEvent.click(- screen.getByRole("button", { name: "Use this voice" }),- );-- // The hire-time refetch cached the pre-voice expert as fresh for 60s; a- // post-PATCH refetch is what keeps a follow-up Soul edit from writing the- // stale description back over the chosen voice.- expect(await screen.findByText("Maria joined your team")).toBeDefined();- await waitFor(() =>- expect(listRequests).toBeGreaterThan(requestsBeforePick),- );- expect(voicePatched).toBe(true);- });-- test("retries a failed voice PATCH, then celebrates and closes", async () => {- let patchAttempts = 0;- server.use(- getListExpertTemplatesMockHandler([mariaWithSamples]),- getListExpertsMockHandler([]),- getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),- http.patch("/api/proxy/api/experts/:expertId/soul", () => {- patchAttempts += 1;- return patchAttempts === 1- ? HttpResponse.json({ detail: [] }, { status: 422 })- : HttpResponse.json(hiredMaria);- }),- );-- renderMarketplace();-- await userEvent.click(await screen.findByText("Maria"));- await userEvent.click(- await screen.findByRole("button", { name: "Hire Maria" }),- );- expect(await screen.findByText("How should Maria write?")).toBeDefined();- await userEvent.click(await screen.findByText("Punchy and bold"));- await userEvent.click(- screen.getByRole("button", { name: "Use this voice" }),- );-- // The hire already succeeded, so the picker stays open to retry rather- // than losing the choice.- expect(await screen.findByText("Couldn't save the voice")).toBeDefined();- expect(screen.getByText("How should Maria write?")).toBeDefined();-- await userEvent.click(- screen.getByRole("button", { name: "Use this voice" }),- );-- expect(await screen.findByText("Maria joined your team")).toBeDefined();- await waitFor(() =>- expect(screen.queryByText("How should Maria write?")).toBeNull(),- );- expect(patchAttempts).toBe(2);- });-- test("celebrates exactly once when the completed hire is dismissed", async () => {- server.use(- getListExpertTemplatesMockHandler([mariaWithSamples]),- getListExpertsMockHandler([]),- getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),- );-- renderMarketplace();-- await userEvent.click(await screen.findByText("Maria"));- await userEvent.click(- await screen.findByRole("button", { name: "Hire Maria" }),- );- expect(await screen.findByText("How should Maria write?")).toBeDefined();-- await userEvent.keyboard("{Escape}");-- expect(await screen.findByText("Maria joined your team")).toBeDefined();- await waitFor(() =>- expect(screen.queryByText("How should Maria write?")).toBeNull(),- );- expect(screen.getAllByText("Maria joined your team")).toHaveLength(1);- });-test("hired template shows hired state", async () => {server.use(getListExpertTemplatesMockHandler([mariaTemplate]),getListExpertsMockHandler([hiredMaria]),);- renderMarketplace();+ render(<MainMarkeplacePage />);expect(await screen.findByText("Meet the AI Experts")).toBeDefined();expect(await screen.findByText("Hired")).toBeDefined();});- test("template becomes hireable again once the expert is fired", async () => {+ test("template becomes viewable again once the expert is fired", async () => {server.use(getListExpertTemplatesMockHandler([mariaTemplate]),getListExpertsMockHandler([{ ...hiredMaria, is_archived: true }]),);- renderMarketplace();+ render(<MainMarkeplacePage />);expect(await screen.findByText("Meet the AI Experts")).toBeDefined();await screen.findByText("Maria");- expect(screen.getByText("Hire")).toBeDefined();+ expect(screen.getByText("View")).toBeDefined();expect(screen.queryByText("Hired")).toBeNull();});});diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/ExpertsSection.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/ExpertsSection.tsxindex aa10ffcd27..943cb6eaaa 100644--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/ExpertsSection.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/ExpertsSection.tsx@@ -5,20 +5,11 @@ import { AITeamIcon } from "@/components/atoms/AITeamIcon/AITeamIcon";import Link from "next/link";import { SectionHeader } from "../SectionHeader";import { ExpertCard } from "./components/ExpertCard";-import { ExpertProfileSheet } from "./components/ExpertProfileSheet/ExpertProfileSheet";import { useExpertsSection } from "./useExpertsSection";export function ExpertsSection() {- const {- isLoggedIn,- templates,- hiredTemplateIds,- isLoading,- isError,- selectedTemplateId,- openTemplate,- closeSheet,- } = useExpertsSection();+ const { isLoggedIn, templates, hiredTemplateIds, isLoading, isError } =+ useExpertsSection();if (!isLoggedIn) {return null;@@ -58,15 +49,10 @@ export function ExpertsSection() {key={template.id}expert={template}isHired={hiredTemplateIds.has(template.id)}- onClick={() => openTemplate(template.id)}/>))}</div>)}- <ExpertProfileSheet- expert={templates.find((t) => t.id === selectedTemplateId) ?? null}- onClose={closeSheet}- /></section>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertCard.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertCard.tsxindex 52f93af360..7282824a17 100644--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertCard.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertCard.tsx@@ -5,6 +5,7 @@ import {AvatarImage,} from "@/components/atoms/Avatar/Avatar";import { cn } from "@/lib/utils";+import Link from "next/link";import { getExpertAccent } from "../helpers";import {ArrowRight02Icon,@@ -16,17 +17,17 @@ import { Icon } from "@/components/atoms/Icon/Icon";interface Props {expert: Expert;isHired: boolean;- onClick: () => void;}-export function ExpertCard({ expert, isHired, onClick }: Props) {+/** Each card is a plain link to the expert's own page, so a profile can be+ * shared and opened directly. */+export function ExpertCard({ expert, isHired }: Props) {const accent = getExpertAccent(expert.role);return (- <button- type="button"- onClick={onClick}- className="group relative flex flex-col overflow-hidden rounded-2xl border border-zinc-200/80 bg-white text-left shadow-[0_1px_2px_rgba(16,24,40,0.04)] transition-all duration-200 ease-out hover:-translate-y-0.5 hover:border-zinc-300 hover:shadow-[0_16px_40px_-16px_rgba(16,24,40,0.18)]"+ <Link+ href={`/marketplace/experts/${expert.id}`}+ className="group relative flex flex-col overflow-hidden rounded-2xl border border-zinc-200/80 bg-white text-left shadow-[0_1px_2px_rgba(16,24,40,0.04)] outline-none transition-all duration-200 ease-out hover:-translate-y-0.5 hover:border-zinc-300 hover:shadow-[0_16px_40px_-16px_rgba(16,24,40,0.18)] focus-visible:ring-2 focus-visible:ring-zinc-400"><divclassName={cn(@@ -100,7 +101,7 @@ export function ExpertCard({ expert, isHired, onClick }: Props) {</span>) : (<span className="flex items-center gap-1.5 text-base font-medium text-zinc-400 transition-colors duration-200 group-hover:text-zinc-900">- Hire+ View<Iconicon={ArrowRight02Icon}size={16}@@ -110,6 +111,6 @@ export function ExpertCard({ expert, isHired, onClick }: Props) {)}</div></div>- </button>+ </Link>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertProfileSheet/ExpertProfileContent.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertProfileSheet/ExpertProfileContent.tsxdeleted file mode 100644index f848cc0341..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertProfileSheet/ExpertProfileContent.tsx+++ /dev/null@@ -1,185 +0,0 @@-"use client";--import { Expert } from "@/app/api/__generated__/models/expert";-import {- Avatar,- AvatarFallback,- AvatarImage,-} from "@/components/atoms/Avatar/Avatar";-import { Button } from "@/components/atoms/Button/Button";-import { cn } from "@/lib/utils";-import { useState } from "react";-import { ExpertAccent } from "../../helpers";-import {- ArrowDown01Icon,- CheckmarkCircle02Icon,- FlashIcon,-} from "@hugeicons/core-free-icons";-import { Icon } from "@/components/atoms/Icon/Icon";--interface Props {- expert: Expert;- accent: ExpertAccent;- isHired: boolean;- isHiring: boolean;- onHire: () => void;-}--export function ExpertProfileContent({- expert,- accent,- isHired,- isHiring,- onHire,-}: Props) {- return (- <div className="relative">- <div- className={cn(- "relative flex items-center gap-5 overflow-hidden rounded-2xl border border-zinc-200/60 p-5",- accent.wash,- )}- >- <Avatar className="h-24 w-24 bg-white shadow-sm ring-1 ring-black/5">- {expert.avatar_url ? (- <AvatarImage src={expert.avatar_url} alt={expert.name} />- ) : null}- <AvatarFallback>{expert.name}</AvatarFallback>- </Avatar>- <div>- <div className="flex items-center gap-3">- <h2 className="text-3xl font-semibold tracking-[-0.02em] text-zinc-900">- {expert.name}- </h2>- <span- className={cn(- "inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-sm font-medium",- accent.pill,- )}- >- <Icon icon={accent.roleIcon} size={14} />- {expert.role}- </span>- </div>- {expert.tagline ? (- <p className="mt-1.5 text-base text-zinc-500">{expert.tagline}</p>- ) : null}- </div>- </div>-- <PersonalitySection- key={expert.id}- text={expert.bio || expert.identity}- />-- {expert.skills && expert.skills.length > 0 ? (- <div className="relative mt-8">- <div className="mb-2.5 text-xs font-medium uppercase tracking-[0.14em] text-zinc-400">- Skills- </div>- <div className="flex flex-wrap gap-2">- {expert.skills.map((skill) => (- <span- key={skill}- className="rounded-full bg-zinc-50 px-3 py-1.5 text-sm text-zinc-600 ring-1 ring-inset ring-zinc-200/80"- >- {skill}- </span>- ))}- </div>- </div>- ) : null}-- {expert.workflows.length > 0 ? (- <div className="relative mt-8">- <div className="mb-2.5 text-xs font-medium uppercase tracking-[0.14em] text-zinc-400">- {expert.is_template ? "Preloaded workflows" : "Workflows"}- </div>- <div className="divide-y divide-zinc-100 rounded-xl border border-zinc-200/80 bg-white">- {expert.workflows.map((workflow) => (- <div- key={workflow.id}- className="flex items-center gap-3 px-4 py-3"- >- <Icon- icon={FlashIcon}- size={18}- className={cn("shrink-0", accent.icon)}- />- <div className="min-w-0">- <div className="text-[15px] font-medium text-zinc-800">- {workflow.name ?? "Unnamed workflow"}- </div>- {workflow.description ? (- <div className="line-clamp-1 text-[13px] text-zinc-500">- {workflow.description}- </div>- ) : null}- </div>- </div>- ))}- </div>- </div>- ) : null}-- <div className="relative mt-8">- {isHired ? (- <div className="flex h-12 w-full items-center justify-center gap-2 rounded-full border border-emerald-200 bg-emerald-50 text-base font-medium text-emerald-700">- <Icon icon={CheckmarkCircle02Icon} size={20} />- On your team- </div>- ) : (- <Button- variant="primary"- onClick={onHire}- loading={isHiring}- className="h-12 w-full rounded-full text-base"- >- {`Hire ${expert.name}`}- </Button>- )}- </div>- </div>- );-}--// Roughly the number of characters that fit in the four-line clamp below.-const CLAMPED_BIO_LENGTH = 280;--function PersonalitySection({ text }: { text: string }) {- const [isExpanded, setIsExpanded] = useState(false);- const isClampable = text.length > CLAMPED_BIO_LENGTH;-- return (- <div className="relative mt-8">- <div className="mb-2.5 text-xs font-medium uppercase tracking-[0.14em] text-zinc-400">- About- </div>- <p- className={cn(- "whitespace-pre-line text-base leading-relaxed text-zinc-600",- isClampable && !isExpanded && "line-clamp-4",- )}- >- {text}- </p>- {isClampable ? (- <button- type="button"- onClick={() => setIsExpanded((v) => !v)}- className="mt-2 flex items-center gap-1 text-sm font-medium text-zinc-500 transition-colors hover:text-zinc-900"- >- {isExpanded ? "Show less" : "Read more"}- <Icon- icon={ArrowDown01Icon}- size={14}- className={cn(- "transition-transform duration-200",- isExpanded && "rotate-180",- )}- />- </button>- ) : null}- </div>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertProfileSheet/ExpertProfileSheet.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertProfileSheet/ExpertProfileSheet.tsxdeleted file mode 100644index 5d75cc27b0..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertProfileSheet/ExpertProfileSheet.tsx+++ /dev/null@@ -1,84 +0,0 @@-"use client";--import { Expert } from "@/app/api/__generated__/models/expert";-import { Dialog } from "@/components/molecules/Dialog/Dialog";-import { VoicePicker } from "@/components/organisms/VoicePicker/VoicePicker";-import { Sheet, SheetContent, SheetTitle } from "@/components/ui/sheet";-import { getExpertAccent } from "../../helpers";-import { ExpertProfileContent } from "./ExpertProfileContent";-import { useExpertProfileSheet } from "./useExpertProfileSheet";--interface Props {- expert: Expert | null;- onClose: () => void;- presentation?: "dialog" | "drawer";-}--export function ExpertProfileSheet({- expert,- onClose,- presentation = "dialog",-}: Props) {- const {- isHired,- isHiring,- hire,- hireResult,- pickVoice,- skipVoice,- isSavingVoice,- handleClose,- } = useExpertProfileSheet(expert, onClose);- const accent = expert ? getExpertAccent(expert.role) : null;-- const content = hireResult ? (- <VoicePicker- name={hireResult.expert.name}- samples={expert?.voice_samples ?? []}- onPick={pickVoice}- onSkip={skipVoice}- isSubmitting={isSavingVoice}- />- ) : expert && accent ? (- <ExpertProfileContent- expert={expert}- accent={accent}- isHired={isHired}- isHiring={isHiring}- onHire={hire}- />- ) : null;-- if (presentation === "drawer") {- return (- <Sheet- open={expert !== null}- onOpenChange={(open) => {- if (!open) handleClose();- }}- >- <SheetContent- side="right"- className="w-full overflow-y-auto sm:w-1/2 sm:max-w-none"- >- <SheetTitle className="sr-only">{expert?.name}</SheetTitle>- {content}- </SheetContent>- </Sheet>- );- }-- return (- <Dialog- styling={{ width: "640px" }}- controlled={{- isOpen: expert !== null,- set: (open) => {- if (!open) handleClose();- },- }}- >- <Dialog.Content>{content}</Dialog.Content>- </Dialog>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/helpers.tsindex 2154c21471..84dc7e8cf0 100644--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/helpers.ts+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/helpers.ts@@ -15,6 +15,9 @@ export interface ExpertAccent {* across a full-width card. */washWide: string;pill: string;+ /** Glossy tag for the expert page's skills: a white-to-tint gradient with+ * a top highlight and a soft glow in the accent hue. */+ chip: string;icon: string;roleIcon: IconSvgElement;}@@ -25,6 +28,7 @@ const ACCENTS: Record<string, ExpertAccent> = {washWide:"bg-[linear-gradient(180deg,rgba(139,92,246,0.10),rgba(139,92,246,0.03)_60%,transparent)]",pill: "bg-violet-50 text-violet-700 ring-1 ring-inset ring-violet-600/10",+ chip: "bg-gradient-to-b from-white to-violet-50 text-violet-800 ring-1 ring-inset ring-violet-500/20 shadow-[inset_0_1px_0_rgba(255,255,255,0.95),0_1px_2px_rgba(139,92,246,0.12),0_0_18px_-4px_rgba(139,92,246,0.45)]",icon: "text-violet-500",roleIcon: Megaphone01Icon,},@@ -33,6 +37,7 @@ const ACCENTS: Record<string, ExpertAccent> = {washWide:"bg-[linear-gradient(180deg,rgba(245,158,11,0.10),rgba(245,158,11,0.03)_60%,transparent)]",pill: "bg-amber-50 text-amber-700 ring-1 ring-inset ring-amber-600/10",+ chip: "bg-gradient-to-b from-white to-amber-50 text-amber-800 ring-1 ring-inset ring-amber-500/20 shadow-[inset_0_1px_0_rgba(255,255,255,0.95),0_1px_2px_rgba(245,158,11,0.12),0_0_18px_-4px_rgba(245,158,11,0.45)]",icon: "text-amber-500",roleIcon: ChartIncreaseIcon,},@@ -41,6 +46,7 @@ const ACCENTS: Record<string, ExpertAccent> = {washWide:"bg-[linear-gradient(180deg,rgba(14,165,233,0.10),rgba(14,165,233,0.03)_60%,transparent)]",pill: "bg-sky-50 text-sky-700 ring-1 ring-inset ring-sky-600/10",+ chip: "bg-gradient-to-b from-white to-sky-50 text-sky-800 ring-1 ring-inset ring-sky-500/20 shadow-[inset_0_1px_0_rgba(255,255,255,0.95),0_1px_2px_rgba(14,165,233,0.12),0_0_18px_-4px_rgba(14,165,233,0.45)]",icon: "text-sky-500",roleIcon: Settings01Icon,},@@ -49,6 +55,7 @@ const ACCENTS: Record<string, ExpertAccent> = {washWide:"bg-[linear-gradient(180deg,rgba(113,113,122,0.08),rgba(113,113,122,0.02)_60%,transparent)]",pill: "bg-zinc-100 text-zinc-600 ring-1 ring-inset ring-zinc-500/10",+ chip: "bg-gradient-to-b from-white to-zinc-50 text-zinc-700 ring-1 ring-inset ring-zinc-500/20 shadow-[inset_0_1px_0_rgba(255,255,255,0.95),0_1px_2px_rgba(113,113,122,0.12),0_0_18px_-4px_rgba(113,113,122,0.45)]",icon: "text-zinc-500",roleIcon: Briefcase01Icon,},diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.tsindex 5b78867711..2067bc60cc 100644--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts@@ -4,12 +4,8 @@ import {} from "@/app/api/__generated__/endpoints/experts/experts";import { Expert } from "@/app/api/__generated__/models/expert";import { useAuth } from "@/lib/auth/hooks/useAuth";-import { useState } from "react";export function useExpertsSection() {- const [selectedTemplateId, setSelectedTemplateId] = useState<string | null>(- null,- );const { isLoggedIn } = useAuth();const templatesQuery = useListExpertTemplates({@@ -32,8 +28,5 @@ export function useExpertsSection() {hiredTemplateIds,isLoading: isLoggedIn && templatesQuery.isLoading,isError: templatesQuery.isError,- selectedTemplateId,- openTemplate: setSelectedTemplateId,- closeSheet: () => setSelectedTemplateId(null),};}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertAbout.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertAbout.tsxnew file mode 100644index 0000000000..2177cb0fdd--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertAbout.tsx@@ -0,0 +1,49 @@+"use client";++import { Icon } from "@/components/atoms/Icon/Icon";+import { cn } from "@/lib/utils";+import { ArrowDown01Icon } from "@hugeicons/core-free-icons";+import { useState } from "react";+import { ExpertSection } from "./ExpertSection";++// Roughly the number of characters that fit in the six-line clamp below.+const CLAMPED_LENGTH = 500;++interface Props {+ text: string;+}++export function ExpertAbout({ text }: Props) {+ const [isExpanded, setIsExpanded] = useState(false);+ const isClampable = text.length > CLAMPED_LENGTH;++ return (+ <ExpertSection title="About">+ <p+ className={cn(+ "whitespace-pre-line text-[15px] leading-6 text-zinc-600",+ isClampable && !isExpanded && "line-clamp-6",+ )}+ >+ {text}+ </p>+ {isClampable ? (+ <button+ type="button"+ onClick={() => setIsExpanded((value) => !value)}+ className="mt-2 inline-flex items-center gap-1 text-[13px] font-medium text-zinc-500 transition-colors hover:text-zinc-900"+ >+ {isExpanded ? "Show less" : "Read more"}+ <Icon+ icon={ArrowDown01Icon}+ size={14}+ className={cn(+ "transition-transform duration-200",+ isExpanded && "rotate-180",+ )}+ />+ </button>+ ) : null}+ </ExpertSection>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertComingSoon.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertComingSoon.tsxnew file mode 100644index 0000000000..a7a95a6e98--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertComingSoon.tsx@@ -0,0 +1,30 @@+import { AITeamIcon } from "@/components/atoms/AITeamIcon/AITeamIcon";+import { Button } from "@/components/atoms/Button/Button";++/** What a signed-in user sees before AI Experts reach their account. */+export function ExpertComingSoon() {+ return (+ <section className="flex flex-col items-center py-20 text-center sm:py-28">+ <span className="flex h-12 w-12 items-center justify-center rounded-xl bg-white shadow-[0_1px_2px_rgba(16,24,40,0.04)] ring-1 ring-zinc-200">+ <AITeamIcon size={26} className="text-zinc-900" />+ </span>+ <h1 className="mt-6 text-2xl font-semibold tracking-[-0.02em] text-zinc-900">+ Coming soon+ </h1>+ <p className="mt-2 max-w-sm text-[15px] leading-6 text-zinc-500">+ Ready-made specialists you hire in a click, working for you in minutes.+ This expert's page opens as soon as Experts reach your account.+ </p>+ <div className="mt-8">+ <Button+ as="NextLink"+ href="/marketplace"+ variant="secondary"+ size="small"+ >+ Back to marketplace+ </Button>+ </div>+ </section>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertHireActions.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertHireActions.tsxnew file mode 100644index 0000000000..08e80400d3--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertHireActions.tsx@@ -0,0 +1,78 @@+import { Expert } from "@/app/api/__generated__/models/expert";+import { Badge } from "@/components/atoms/Badge/Badge";+import { Button } from "@/components/atoms/Button/Button";+import { Icon } from "@/components/atoms/Icon/Icon";+import { CheckmarkCircle02Icon } from "@hugeicons/core-free-icons";++// Sized and shaped like the small button beside it so the pair reads as one row.+const STATUS_CLASS = "h-9 rounded-full px-3.5 text-sm";++// A white, hairline-bordered secondary so the button sits quietly next to+// the status badge instead of reading as a solid grey slab.+const SECONDARY_CLASS =+ "border-zinc-200 bg-white shadow-[0_1px_2px_rgba(16,24,40,0.05)] hover:border-zinc-300 hover:bg-zinc-50";++interface Props {+ expert: Expert;+ hiredExpert: Expert | null;+ isLoggedIn: boolean;+ isHiring: boolean;+ onHire: () => void;+}++/** The page's one call to action, sitting in the header beside the name.+ * Signed-out visitors get a sign-up prompt that brings them back here. */+export function ExpertHireActions({+ expert,+ hiredExpert,+ isLoggedIn,+ isHiring,+ onHire,+}: Props) {+ if (!isLoggedIn) {+ const next = encodeURIComponent(`/marketplace/experts/${expert.id}`);+ return (+ <Button+ as="NextLink"+ href={`/signup?next=${next}`}+ variant="primary"+ size="small"+ className="w-full sm:w-auto"+ >+ Get started+ </Button>+ );+ }++ if (hiredExpert) {+ return (+ <div className="flex flex-wrap items-center gap-3">+ <Badge variant="success" className={STATUS_CLASS}>+ <Icon icon={CheckmarkCircle02Icon} size={16} />+ On your team+ </Badge>+ <Button+ as="NextLink"+ href={`/copilot?expertId=${hiredExpert.id}`}+ variant="secondary"+ size="small"+ className={SECONDARY_CLASS}+ >+ {`Chat with ${expert.name}`}+ </Button>+ </div>+ );+ }++ return (+ <Button+ variant="primary"+ size="small"+ onClick={onHire}+ loading={isHiring}+ className="w-full sm:w-auto"+ >+ {`Hire ${expert.name}`}+ </Button>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPageHeader.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPageHeader.tsxnew file mode 100644index 0000000000..d7b139340a--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertPageHeader.tsx@@ -0,0 +1,51 @@+import { Expert } from "@/app/api/__generated__/models/expert";+import {+ Avatar,+ AvatarFallback,+ AvatarImage,+} from "@/components/atoms/Avatar/Avatar";+import { Icon } from "@/components/atoms/Icon/Icon";+import { cn } from "@/lib/utils";+import { ReactNode } from "react";+import type { ExpertAccent } from "../../../components/ExpertsSection/helpers";++interface Props {+ expert: Expert;+ accent: ExpertAccent;+ actions: ReactNode;+}++export function ExpertPageHeader({ expert, accent, actions }: Props) {+ return (+ <header>+ <div className="flex flex-wrap items-center gap-4 sm:gap-5">+ <Avatar className="h-18 w-18 shrink-0 bg-white shadow-sm ring-1 ring-black/5">+ {expert.avatar_url ? (+ <AvatarImage src={expert.avatar_url} alt={expert.name} />+ ) : null}+ <AvatarFallback>{expert.name}</AvatarFallback>+ </Avatar>+ <div className="min-w-0 flex-1">+ <h1 className="text-[28px] font-semibold leading-8 tracking-[-0.02em] text-zinc-900">+ {expert.name}+ </h1>+ <span+ className={cn(+ "mt-2 inline-flex items-center gap-1.5 rounded-md px-2 py-0.5 text-xs font-medium",+ accent.pill,+ )}+ >+ <Icon icon={accent.roleIcon} size={12} />+ {expert.role}+ </span>+ </div>+ <div className="w-full sm:w-auto">{actions}</div>+ </div>+ {expert.tagline ? (+ <p className="mt-5 max-w-[60ch] text-[17px] leading-7 text-zinc-600">+ {expert.tagline}+ </p>+ ) : null}+ </header>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertSection.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertSection.tsxnew file mode 100644index 0000000000..ecff844767--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertSection.tsx@@ -0,0 +1,27 @@+import { ReactNode } from "react";++interface Props {+ title: string;+ count?: number;+ description?: string;+ children: ReactNode;+}++export function ExpertSection({ title, count, description, children }: Props) {+ return (+ <section>+ <h2 className="flex items-baseline gap-2 text-base font-medium text-zinc-900">+ {title}+ {count !== undefined ? (+ <span className="text-sm font-normal tabular-nums text-zinc-400">+ {count}+ </span>+ ) : null}+ </h2>+ {description ? (+ <p className="mt-1 text-sm leading-5 text-zinc-500">{description}</p>+ ) : null}+ <div className="mt-3">{children}</div>+ </section>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertSkills.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertSkills.tsxnew file mode 100644index 0000000000..0bef645aa6--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertSkills.tsx@@ -0,0 +1,30 @@+import { cn } from "@/lib/utils";+import type { ExpertAccent } from "../../../components/ExpertsSection/helpers";+import { ExpertSection } from "./ExpertSection";++interface Props {+ skills: string[];+ accent: ExpertAccent;+}++export function ExpertSkills({ skills, accent }: Props) {+ if (skills.length === 0) return null;++ return (+ <ExpertSection title="Skills">+ <div className="flex flex-wrap gap-2">+ {skills.map((skill) => (+ <span+ key={skill}+ className={cn(+ "inline-flex items-center rounded-lg px-2.5 py-1 text-sm font-medium leading-5",+ accent.chip,+ )}+ >+ {skill}+ </span>+ ))}+ </div>+ </ExpertSection>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertWorkflowCard/ExpertWorkflowCard.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertWorkflowCard/ExpertWorkflowCard.tsxnew file mode 100644index 0000000000..4d6170c8f4--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertWorkflowCard/ExpertWorkflowCard.tsx@@ -0,0 +1,53 @@+"use client";++import type { ExpertAccent } from "@/app/(platform)/marketplace/components/ExpertsSection/helpers";+import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";+import { Icon } from "@/components/atoms/Icon/Icon";+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";+import { FlashIcon } from "@hugeicons/core-free-icons";+import Image from "next/image";+import { useExpertWorkflowCard } from "./useExpertWorkflowCard";++interface Props {+ workflow: ExpertWorkflowRef;+ accent: ExpertAccent;+}++export function ExpertWorkflowCard({ workflow, accent }: Props) {+ const { imageUrl, isLoadingImage } = useExpertWorkflowCard(+ workflow.store_listing_version_id,+ );+ const name = workflow.name ?? "Unnamed workflow";++ return (+ <li className="flex flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white">+ <div className="relative aspect-[2.17/1] w-full bg-zinc-50">+ {imageUrl ? (+ <Image+ src={imageUrl}+ alt={`${name} preview image`}+ fill+ sizes="(min-width: 640px) 360px, 100vw"+ className="object-cover"+ />+ ) : isLoadingImage ? (+ <Skeleton className="absolute inset-0 rounded-none" />+ ) : (+ <div className="absolute inset-0 flex items-center justify-center">+ <span className="flex h-10 w-10 items-center justify-center rounded-lg bg-white ring-1 ring-inset ring-zinc-200/70">+ <Icon icon={FlashIcon} size={18} className={accent.icon} />+ </span>+ </div>+ )}+ </div>+ <div className="flex flex-1 flex-col border-t border-zinc-100 p-4">+ <div className="text-sm font-medium text-zinc-900">{name}</div>+ {workflow.description ? (+ <p className="mt-1 line-clamp-2 text-[13px] leading-5 text-zinc-500">+ {workflow.description}+ </p>+ ) : null}+ </div>+ </li>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertWorkflowCard/useExpertWorkflowCard.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertWorkflowCard/useExpertWorkflowCard.tsnew file mode 100644index 0000000000..380d6599d3--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertWorkflowCard/useExpertWorkflowCard.ts@@ -0,0 +1,18 @@+import { useGetV2GetAgentByVersion } from "@/app/api/__generated__/endpoints/store/store";+import { okData } from "@/app/api/helpers";++/** The marketplace listing behind a preloaded workflow, for its preview+ * image. Workflows installed from a library agent have no listing. */+export function useExpertWorkflowCard(storeListingVersionId: string | null) {+ const listingQuery = useGetV2GetAgentByVersion(storeListingVersionId ?? "", {+ query: {+ enabled: Boolean(storeListingVersionId),+ select: (response) => okData(response)?.agent_image?.[0] ?? null,+ },+ });++ return {+ imageUrl: listingQuery.data ?? null,+ isLoadingImage: listingQuery.isLoading,+ };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertWorkflowList.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertWorkflowList.tsxnew file mode 100644index 0000000000..d53ece64d4--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/components/ExpertWorkflowList.tsx@@ -0,0 +1,32 @@+import { Expert } from "@/app/api/__generated__/models/expert";+import type { ExpertAccent } from "../../../components/ExpertsSection/helpers";+import { ExpertSection } from "./ExpertSection";+import { ExpertWorkflowCard } from "./ExpertWorkflowCard/ExpertWorkflowCard";++interface Props {+ name: string;+ workflows: Expert["workflows"];+ accent: ExpertAccent;+}++export function ExpertWorkflowList({ name, workflows, accent }: Props) {+ if (workflows.length === 0) return null;++ return (+ <ExpertSection+ title="Workflows"+ count={workflows.length}+ description={`Installed and ready to run the moment ${name} joins your team.`}+ >+ <ul className="grid gap-4 sm:grid-cols-2">+ {workflows.map((workflow) => (+ <ExpertWorkflowCard+ key={workflow.id}+ workflow={workflow}+ accent={accent}+ />+ ))}+ </ul>+ </ExpertSection>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/page.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/page.tsxnew file mode 100644index 0000000000..50f257eeab--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/page.tsx@@ -0,0 +1,158 @@+"use client";++import { getExpertAccent } from "@/app/(platform)/marketplace/components/ExpertsSection/helpers";+import { Icon } from "@/components/atoms/Icon/Icon";+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";+import { Dialog } from "@/components/molecules/Dialog/Dialog";+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";+import { VoicePicker } from "@/components/organisms/VoicePicker/VoicePicker";+import { ArrowLeft02Icon } from "@hugeicons/core-free-icons";+import Link from "next/link";+import { notFound, useParams } from "next/navigation";+import { ExpertAbout } from "./components/ExpertAbout";+import { ExpertComingSoon } from "./components/ExpertComingSoon";+import { ExpertHireActions } from "./components/ExpertHireActions";+import { ExpertPageHeader } from "./components/ExpertPageHeader";+import { ExpertSkills } from "./components/ExpertSkills";+import { ExpertWorkflowList } from "./components/ExpertWorkflowList";+import { useExpertPage } from "./useExpertPage";+import { useHireFlow } from "./useHireFlow";++const MAIN_CLASS =+ "mx-auto flex w-full max-w-[760px] flex-col px-6 pb-24 pt-8 md:px-8";++function BackToMarketplaceLink() {+ return (+ <Link+ href="/marketplace#experts"+ className="mb-6 inline-flex w-fit items-center gap-1.5 text-[13px] text-zinc-500 transition-colors hover:text-zinc-900"+ >+ <Icon icon={ArrowLeft02Icon} size={14} />+ Back to marketplace+ </Link>+ );+}++export default function MarketplaceExpertPage() {+ const { expertId } = useParams<{ expertId: string }>();+ const {+ expert,+ hiredExpert,+ isLoggedIn,+ isComingSoon,+ isReady,+ isLoading,+ isError,+ refetch,+ } = useExpertPage({ expertId });+ const {+ hire,+ isHiring,+ hireResult,+ pickVoice,+ skipVoice,+ dismissVoicePick,+ isSavingVoice,+ } = useHireFlow(expert);++ if (!isReady || isLoading) {+ return (+ <main className={MAIN_CLASS}>+ <Skeleton className="mb-6 h-4 w-32" />+ <div className="flex items-center gap-5">+ <Skeleton className="h-18 w-18 rounded-full" />+ <div className="flex flex-1 flex-col gap-2.5">+ <Skeleton className="h-7 w-36" />+ <Skeleton className="h-5 w-24 rounded-md" />+ </div>+ <Skeleton className="h-9 w-28 rounded-full" />+ </div>+ <Skeleton className="mt-5 h-5 w-3/4" />+ <div className="mt-8 flex flex-col gap-3 border-t border-zinc-200 pt-8">+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-11/12" />+ <Skeleton className="h-4 w-3/4" />+ </div>+ </main>+ );+ }++ if (isComingSoon) {+ return (+ <main className={MAIN_CLASS}>+ <ExpertComingSoon />+ </main>+ );+ }++ if (isError) {+ return (+ <main className={MAIN_CLASS}>+ <BackToMarketplaceLink />+ <ErrorCard+ context="this expert"+ hint="We could not load this expert."+ onRetry={() => refetch()}+ />+ </main>+ );+ }++ if (!expert) {+ notFound();+ }++ const accent = getExpertAccent(expert.role);++ return (+ <main className={MAIN_CLASS}>+ <BackToMarketplaceLink />+ <ExpertPageHeader+ expert={expert}+ accent={accent}+ actions={+ <ExpertHireActions+ expert={expert}+ hiredExpert={hiredExpert}+ isLoggedIn={isLoggedIn}+ isHiring={isHiring}+ onHire={hire}+ />+ }+ />+ <div className="mt-8 flex flex-col gap-10 border-t border-zinc-200 pt-8">+ <ExpertAbout key={expert.id} text={expert.bio || expert.identity} />+ <ExpertSkills skills={expert.skills ?? []} accent={accent} />+ <ExpertWorkflowList+ name={expert.name}+ workflows={expert.workflows}+ accent={accent}+ />+ </div>++ {/* The voice pick follows a successful hire when the persona ships+ writing samples; dismissing it still celebrates the hire. */}+ <Dialog+ styling={{ width: "640px" }}+ controlled={{+ isOpen: hireResult !== null,+ set: (open) => {+ if (!open) dismissVoicePick();+ },+ }}+ >+ <Dialog.Content>+ {hireResult ? (+ <VoicePicker+ name={hireResult.expert.name}+ samples={expert.voice_samples ?? []}+ onPick={pickVoice}+ onSkip={skipVoice}+ isSubmitting={isSavingVoice}+ />+ ) : null}+ </Dialog.Content>+ </Dialog>+ </main>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useExpertPage.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useExpertPage.tsnew file mode 100644index 0000000000..e5bcbce62d--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useExpertPage.ts@@ -0,0 +1,49 @@+import {+ useListExperts,+ useListExpertTemplates,+} from "@/app/api/__generated__/endpoints/experts/experts";+import { Expert } from "@/app/api/__generated__/models/expert";+import { useAuth } from "@/lib/auth/hooks/useAuth";+import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";++interface Args {+ expertId: string;+}++/** The template behind a marketplace expert page, plus whether this viewer+ * can hire it. Templates are public, so a signed-out visitor sees the+ * profile with a sign-up prompt; the hired roster and the hire itself need+ * a session and the experts flag. Signed in without the flag, the page+ * shows its coming-soon face. */+export function useExpertPage({ expertId }: Args) {+ const { isLoggedIn, isUserLoading } = useAuth();+ const { enabled, ready } = useFlagStatus(Flag.HIRE_EXPERTS);+ const canHire = isLoggedIn && Boolean(enabled);+ const canView = !isUserLoading && (!isLoggedIn || canHire);++ const templatesQuery = useListExpertTemplates({+ query: { select: (x) => x.data as Expert[], enabled: canView },+ });+ const expertsQuery = useListExperts({+ query: { select: (x) => x.data as Expert[], enabled: canHire },+ });++ const expert =+ (templatesQuery.data ?? []).find((template) => template.id === expertId) ??+ null;+ const hiredExpert =+ (expertsQuery.data ?? []).find(+ (hired) => !hired.is_archived && hired.source_template_id === expertId,+ ) ?? null;++ return {+ expert,+ hiredExpert,+ isLoggedIn,+ isComingSoon: isLoggedIn && !enabled,+ isReady: !isUserLoading && (!isLoggedIn || ready),+ isLoading: canView && templatesQuery.isLoading,+ isError: templatesQuery.isError,+ refetch: templatesQuery.refetch,+ };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertProfileSheet/useExpertProfileSheet.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useHireFlow.tsxsimilarity index 80%rename from autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertProfileSheet/useExpertProfileSheet.tsxrename to autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useHireFlow.tsxindex acb419f95e..a8456f6afa 100644--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/components/ExpertProfileSheet/useExpertProfileSheet.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/[expertId]/useHireFlow.tsx@@ -1,7 +1,6 @@import {getGetExpertQueryKey,useHireExpert,- useListExperts,useUpdateExpertSoul,} from "@/app/api/__generated__/endpoints/experts/experts";import { Expert } from "@/app/api/__generated__/models/expert";@@ -32,43 +31,31 @@ function celebrate(result: HireResult) {});}-export function useExpertProfileSheet(- expert: Expert | null,- onClose: () => void,-) {+/** Hiring from the expert page: hire the template, offer a voice pick when+ * the persona ships writing samples, then celebrate and hand the user to+ * the expert's first thread. */+export function useHireFlow(expert: Expert | null) {const queryClient = useQueryClient();const router = useRouter();- // Set once a hire succeeds for a persona that ships writing samples: it- // swaps the sheet to the voice pick before the hire is celebrated.+ // Set once a hire succeeds for a persona with writing samples: it opens+ // the voice pick before the hire is celebrated.const [hireResult, setHireResult] = useState<HireResult | null>(null);const pendingCelebrationRef = useRef<HireResult | null>(null);- const expertsQuery = useListExperts({- query: { select: (x) => x.data as Expert[] },- });-- const isHired =- expert !== null &&- (!expert.is_template ||- (expertsQuery.data ?? []).some(- (hired) => hired.source_template_id === expert.id,- ));-const { mutateAsync: hireExpert, isPending: isHiring } = useHireExpert();const { mutateAsync: updateSoul, isPending: isSavingVoice } =useUpdateExpertSoul();- function handleClose() {+ function finish() {const completedHire = pendingCelebrationRef.current;pendingCelebrationRef.current = null;setHireResult(null);if (completedHire) {celebrate(completedHire);- // Hiring isn't installing: hand the user straight to the expert's thread- // with kickoff=1 so it introduces itself and starts its day-one job.+ // Hiring isn't installing: hand the user straight to the expert's+ // thread with kickoff=1 so it introduces itself and starts its job.router.push(`/copilot?expertId=${completedHire.expert.id}&kickoff=1`);}- onClose();}async function hire() {@@ -78,13 +65,11 @@ export function useExpertProfileSheet(const result = response.data as HireResult;await invalidateExpertRosterQueries(queryClient);pendingCelebrationRef.current = result;- // Offer the voice pick when the persona ships writing samples; otherwise- // finish with the classic celebration toast.if ((expert.voice_samples ?? []).length > 0) {setHireResult(result);return;}- handleClose();+ finish();} catch {toast({title: `Couldn't hire ${expert.name}`,@@ -104,7 +89,7 @@ export function useExpertProfileSheet(// Nothing storable (missing sample, blank custom text): keep the hired// expert's existing voice instead of blanking it with an empty PATCH.if (voicePreferences === null) {- skipVoice();+ finish();return;}try {@@ -136,21 +121,16 @@ export function useExpertProfileSheet(});return;}- handleClose();- }-- function skipVoice() {- handleClose();+ finish();}return {- isHired,- isHiring,hire,+ isHiring,hireResult,pickVoice,- skipVoice,+ skipVoice: finish,+ dismissVoicePick: finish,isSavingVoice,- handleClose,};}diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/__tests__/expert-page.test.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/__tests__/expert-page.test.tsxnew file mode 100644index 0000000000..4a14f76ee1--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/experts/__tests__/expert-page.test.tsx@@ -0,0 +1,323 @@+import {+ getHireExpertMockHandler,+ getListExpertsMockHandler,+ getListExpertTemplatesMockHandler,+ getUpdateExpertSoulMockHandler,+} from "@/app/api/__generated__/endpoints/experts/experts.msw";+import { Expert } from "@/app/api/__generated__/models/expert";+import { Toaster } from "@/components/molecules/Toast/toaster";+import { server } from "@/mocks/mock-server";+import { render, screen, waitFor } from "@/tests/integrations/test-utils";+import userEvent from "@testing-library/user-event";+import { HttpResponse, http } from "msw";+import { beforeEach, describe, expect, test, vi } from "vitest";+import MarketplaceExpertPage from "../[expertId]/page";++const mockUseAuth = vi.hoisted(() => vi.fn());+const mockRouterPush = vi.hoisted(() => vi.fn());+const mockParams = vi.hoisted(() => ({ expertId: "template-maria" }));+const flagStatusMock = vi.hoisted(() =>+ vi.fn(() => ({ enabled: true, ready: true })),+);++vi.mock("next/navigation", () => ({+ useRouter: () => ({+ back: vi.fn(),+ forward: vi.fn(),+ prefetch: vi.fn(),+ push: mockRouterPush,+ refresh: vi.fn(),+ replace: vi.fn(),+ }),+ usePathname: () => "/marketplace/experts/template-maria",+ useSearchParams: () => new URLSearchParams(),+ useParams: () => mockParams,+ notFound: () => {+ throw new Error("NEXT_NOT_FOUND");+ },+}));++vi.mock("@/lib/auth/hooks/useAuth", () => ({+ useAuth: mockUseAuth,+}));++vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {+ const actual =+ await importOriginal<+ typeof import("@/services/feature-flags/use-get-flag")+ >();+ return {+ ...actual,+ useFlagStatus: (flag: string) =>+ flag === "hire-experts"+ ? flagStatusMock()+ : actual.useFlagStatus(flag as never),+ };+});++const mariaTemplate: Expert = {+ id: "template-maria",+ name: "Maria",+ avatar_url: null,+ role: "Marketing Strategist",+ bio: "Maria is a senior marketing strategist with fifteen years across B2B SaaS.",+ skills: ["Content strategy", "Positioning"],+ tagline: "Grows your brand while you sleep",+ identity: "You are Maria, a senior marketing strategist.",+ voice_preferences: "Warm, concise, and direct.",+ boundaries: "Never invent customer evidence.",+ protected_soul_rules: [],+ is_template: true,+ source_template_id: null,+ is_archived: false,+ workflows: [+ {+ id: "wf-1",+ name: "LinkedIn Post Generator",+ description: "Create research-driven LinkedIn posts in minutes.",+ store_listing_version_id: null,+ library_agent_id: null,+ graph_id: null,+ },+ ],+};++const hiredMaria: Expert = {+ ...mariaTemplate,+ id: "expert-maria",+ is_template: false,+ source_template_id: "template-maria",+};++const mariaWithSamples: Expert = {+ ...mariaTemplate,+ voice_samples: [+ { label: "Punchy and bold", text: "Stop guessing what your buyers want." },+ {+ label: "Warm and story-led",+ text: "Every campaign starts with a person, not a product.",+ },+ ],+};++function renderPage() {+ return render(+ <>+ <MarketplaceExpertPage />+ <Toaster />+ </>,+ );+}++describe("Marketplace expert page", () => {+ beforeEach(() => {+ mockRouterPush.mockReset();+ mockParams.expertId = "template-maria";+ flagStatusMock.mockReturnValue({ enabled: true, ready: true });+ mockUseAuth.mockReturnValue({ user: { id: "user-1" }, isLoggedIn: true });+ });++ test("shows the profile and hires from the page", async () => {+ server.use(+ getListExpertTemplatesMockHandler([mariaTemplate]),+ getListExpertsMockHandler([]),+ getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),+ );++ renderPage();++ expect(+ await screen.findByRole("heading", { level: 1, name: "Maria" }),+ ).toBeDefined();+ expect(screen.getByText("Grows your brand while you sleep")).toBeDefined();+ expect(screen.getByText("Content strategy")).toBeDefined();+ expect(screen.getByText("LinkedIn Post Generator")).toBeDefined();+ expect(+ screen+ .getByRole("link", { name: "Back to marketplace" })+ .getAttribute("href"),+ ).toBe("/marketplace#experts");++ await userEvent.click(screen.getByRole("button", { name: "Hire Maria" }));++ expect(await screen.findByText("Maria joined your team")).toBeDefined();+ expect(mockRouterPush).toHaveBeenCalledWith(+ `/copilot?expertId=${hiredMaria.id}&kickoff=1`,+ );+ });++ test("shows the on-your-team state with a way into the chat", async () => {+ server.use(+ getListExpertTemplatesMockHandler([mariaTemplate]),+ getListExpertsMockHandler([hiredMaria]),+ );++ renderPage();++ expect(await screen.findByText("On your team")).toBeDefined();+ expect(+ screen+ .getByRole("link", { name: "Chat with Maria" })+ .getAttribute("href"),+ ).toBe("/copilot?expertId=expert-maria");+ expect(screen.queryByRole("button", { name: "Hire Maria" })).toBeNull();+ });++ test("captures a voice pick as a plain-text soul PATCH after hire", async () => {+ let savedVoice = "";+ server.use(+ getListExpertTemplatesMockHandler([mariaWithSamples]),+ getListExpertsMockHandler([]),+ getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),+ getUpdateExpertSoulMockHandler(async (info) => {+ const body = (await info.request.json()) as {+ voice_preferences: string;+ };+ savedVoice = body.voice_preferences;+ return { ...hiredMaria, voice_preferences: body.voice_preferences };+ }),+ );++ renderPage();++ await userEvent.click(+ await screen.findByRole("button", { name: "Hire Maria" }),+ );++ expect(await screen.findByText("How should Maria write?")).toBeDefined();+ await userEvent.click(await screen.findByText("Punchy and bold"));+ await userEvent.click(+ screen.getByRole("button", { name: "Use this voice" }),+ );++ expect(await screen.findByText("Maria joined your team")).toBeDefined();+ expect(savedVoice).toContain("Preferred writing style: Punchy and bold.");+ expect(savedVoice.startsWith("{")).toBe(false);+ });++ test("skips the voice pick without patching the soul", async () => {+ let soulPatched = false;+ server.use(+ getListExpertTemplatesMockHandler([mariaWithSamples]),+ getListExpertsMockHandler([]),+ getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),+ getUpdateExpertSoulMockHandler(() => {+ soulPatched = true;+ return hiredMaria;+ }),+ );++ renderPage();++ await userEvent.click(+ await screen.findByRole("button", { name: "Hire Maria" }),+ );+ expect(await screen.findByText("How should Maria write?")).toBeDefined();+ await userEvent.click(+ await screen.findByRole("button", { name: "Skip for now" }),+ );++ expect(await screen.findByText("Maria joined your team")).toBeDefined();+ expect(soulPatched).toBe(false);+ });++ test("retries a failed voice PATCH, then celebrates and closes", async () => {+ let patchAttempts = 0;+ server.use(+ getListExpertTemplatesMockHandler([mariaWithSamples]),+ getListExpertsMockHandler([]),+ getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),+ http.patch("/api/proxy/api/experts/:expertId/soul", () => {+ patchAttempts += 1;+ return patchAttempts === 1+ ? HttpResponse.json({ detail: [] }, { status: 422 })+ : HttpResponse.json(hiredMaria);+ }),+ );++ renderPage();++ await userEvent.click(+ await screen.findByRole("button", { name: "Hire Maria" }),+ );+ expect(await screen.findByText("How should Maria write?")).toBeDefined();+ await userEvent.click(await screen.findByText("Punchy and bold"));+ await userEvent.click(+ screen.getByRole("button", { name: "Use this voice" }),+ );++ expect(await screen.findByText("Couldn't save the voice")).toBeDefined();+ expect(screen.getByText("How should Maria write?")).toBeDefined();++ await userEvent.click(+ screen.getByRole("button", { name: "Use this voice" }),+ );++ expect(await screen.findByText("Maria joined your team")).toBeDefined();+ await waitFor(() =>+ expect(screen.queryByText("How should Maria write?")).toBeNull(),+ );+ expect(patchAttempts).toBe(2);+ });++ test("celebrates exactly once when the voice pick is dismissed", async () => {+ server.use(+ getListExpertTemplatesMockHandler([mariaWithSamples]),+ getListExpertsMockHandler([]),+ getHireExpertMockHandler({ expert: hiredMaria, failed_preloads: [] }),+ );++ renderPage();++ await userEvent.click(+ await screen.findByRole("button", { name: "Hire Maria" }),+ );+ expect(await screen.findByText("How should Maria write?")).toBeDefined();++ await userEvent.keyboard("{Escape}");++ expect(await screen.findByText("Maria joined your team")).toBeDefined();+ await waitFor(() =>+ expect(screen.queryByText("How should Maria write?")).toBeNull(),+ );+ expect(screen.getAllByText("Maria joined your team")).toHaveLength(1);+ });++ test("shows the profile to signed-out visitors with a way to sign up", async () => {+ mockUseAuth.mockReturnValue({ user: null, isLoggedIn: false });+ let rosterRequested = false;+ server.use(+ getListExpertTemplatesMockHandler([mariaTemplate]),+ getListExpertsMockHandler(() => {+ rosterRequested = true;+ return [];+ }),+ );++ renderPage();++ expect(+ await screen.findByRole("heading", { level: 1, name: "Maria" }),+ ).toBeDefined();+ expect(+ screen.getByRole("link", { name: "Get started" }).getAttribute("href"),+ ).toBe("/signup?next=%2Fmarketplace%2Fexperts%2Ftemplate-maria");+ expect(screen.queryByRole("button", { name: "Hire Maria" })).toBeNull();+ expect(screen.queryByText("Coming soon")).toBeNull();+ expect(rosterRequested).toBe(false);+ });++ test("shows the coming-soon page when experts are not enabled yet", async () => {+ flagStatusMock.mockReturnValue({ enabled: false, ready: true });++ renderPage();++ expect(await screen.findByText("Coming soon")).toBeDefined();+ expect(screen.queryByRole("heading", { name: "Maria" })).toBeNull();+ expect(+ screen+ .getByRole("link", { name: "Back to marketplace" })+ .getAttribute("href"),+ ).toBe("/marketplace");+ });+});diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 1a8c9f3a2c..8e33b45f46 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -6237,7 +6237,7 @@},"/api/experts/templates": {"get": {- "tags": ["v2", "experts", "experts", "private"],+ "tags": ["v2", "experts", "experts"],"summary": "List Expert Templates","operationId": "list_expert_templates","responses": {@@ -6252,12 +6252,8 @@}}}- },- "401": {- "$ref": "#/components/responses/HTTP401NotAuthenticatedError"}- },- "security": [{ "HTTPBearerJWT": [] }]+ }}},"/api/experts/{expert_id}": {@@ -13784,7 +13780,6 @@"tags": ["v2", "store"],"summary": "Get agent by version","operationId": "getV2Get agent by version",- "security": [{ "HTTPBearerJWT": [] }],"parameters": [{"name": "store_listing_version_id",@@ -13802,9 +13797,6 @@}}},- "401": {- "$ref": "#/components/responses/HTTP401NotAuthenticatedError"- },"422": {"description": "Validation Error","content": {