Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

refactor(frontend): copilot home becomes briefing recap, BriefingCard promoted to organisms (#14016)

Abhimanyu Yadav2f0083714750
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/CopilotHome.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/CopilotHome.tsx
index 03d378bf3e..72435a3252 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/CopilotHome.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/CopilotHome.tsx
@@ -1,52 +1,42 @@
"use client";
import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
-import { NeedsAttentionList } from "@/components/organisms/NeedsAttentionList/NeedsAttentionList";
+import { BriefingCard } from "@/components/organisms/BriefingCard/BriefingCard";
+import { hasRecapContent } from "@/components/organisms/BriefingCard/helpers";
import type { ReactNode } from "react";
-import { BriefingCard } from "./components/BriefingCard/BriefingCard";
-import { TeamStrip } from "./components/TeamStrip/TeamStrip";
import { useCopilotHome } from "./useCopilotHome";
interface Props {
fallback: ReactNode;
}
-// The briefing-first block of the copilot home. Mounted *inside*
-// EmptySession rather than beside it, so the experts cohort keeps the
-// onboarding surface (welcome dialog, greeting flow, suggestion themes) and
-// the composer's recipient picker, which live there.
+// The short briefing recap under the composer. It is a recap only — the
+// decisions inbox and team status live on /home — so the copilot's empty
+// state keeps its onboarding surface (welcome dialog, greeting flow,
+// suggestion themes) and the composer's recipient picker.
export function CopilotHome({ fallback }: Props) {
- const {
- briefing,
- isLoadingBriefing,
- isBriefingError,
- refetchBriefing,
- hasBriefing,
- } = useCopilotHome();
+ const { briefing, isLoadingBriefing, isBriefingError, refetchBriefing } =
+ useCopilotHome();
- return (
- <>
- {/* Briefing card slot — falls back to whatever the caller renders in
- its place only when a successful fetch says there is no briefing
- yet; a failed fetch shows the error card so it can't masquerade as
- "no briefing". Nothing renders until load settles so the fallback
- doesn't flash for users who do have a briefing. */}
- {isLoadingBriefing ? null : isBriefingError ? (
- <ErrorCard
- context="briefing"
- httpError={{ message: "Failed to load your briefing" }}
- onRetry={() => refetchBriefing()}
- className="mb-5"
- />
- ) : hasBriefing && briefing ? (
- <BriefingCard briefing={briefing} />
- ) : (
- fallback
- )}
+ // Nothing renders until load settles so the fallback doesn't flash for
+ // users who do have a briefing. A failed fetch shows the error card so it
+ // can't masquerade as "no briefing".
+ if (isLoadingBriefing) return null;
- <NeedsAttentionList />
+ if (isBriefingError) {
+ return (
+ <ErrorCard
+ context="briefing"
+ httpError={{ message: "Failed to load your briefing" }}
+ onRetry={() => refetchBriefing()}
+ />
+ );
+ }
- <TeamStrip />
- </>
- );
+ // Not just "no briefing": a briefing of nothing but pending decisions has
+ // no runs to recap, and the card would render null. The inbox that used to
+ // carry that case lives on /home now, so the fallback has to.
+ if (!hasRecapContent(briefing)) return <>{fallback}</>;
+
+ return <BriefingCard briefing={briefing} />;
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/__tests__/flag-off.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/__tests__/flag-off.test.tsx
index f33348e3b6..560aa85ffa 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/__tests__/flag-off.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/__tests__/flag-off.test.tsx
@@ -7,10 +7,9 @@ import {
} from "@/app/api/__generated__/endpoints/library/library.msw";
import { getGetV1ListAllExecutionsMockHandler } from "@/app/api/__generated__/endpoints/graphs/graphs.msw";
import { getGetBriefingsGetLatestBriefingMockHandler200 } from "@/app/api/__generated__/endpoints/briefings/briefings.msw";
-import { getGetV2GetPendingReviewsMockHandler200 } from "@/app/api/__generated__/endpoints/executions/executions.msw";
import { EmptySession } from "../../EmptySession/EmptySession";
-// The mirror of main.test.tsx: everything the briefing home adds rides the
+// The mirror of main.test.tsx: everything the briefing recap adds rides the
// experts flag, so with it off the pre-existing pulse strip must be what
// renders and none of the new surfaces may mount.
vi.mock("@/services/feature-flags/use-get-flag", async (importActual) => {
@@ -47,28 +46,7 @@ function mockHomeData() {
},
}),
getGetV1ListAllExecutionsMockHandler([]),
- // Both would render something if the briefing home mounted anyway.
- getGetV2GetPendingReviewsMockHandler200([
- {
- node_exec_id: "ne-1",
- node_id: "n-1",
- user_id: "u-1",
- graph_exec_id: "run-1",
- graph_id: "g-1",
- graph_version: 1,
- payload: { to: "[email protected]" },
- instructions: "Approve outreach email",
- editable: true,
- status: "WAITING",
- expert_id: "exp-1",
- expert_name: "Ana",
- expert_avatar_url: null,
- agent_name: "Lead Finder",
- library_agent_id: "lib-1",
- session_id: null,
- created_at: new Date(),
- },
- ]),
+ // Would render something if the briefing recap mounted anyway.
getGetBriefingsGetLatestBriefingMockHandler200({
id: "briefing-1",
briefing_date: new Date(),
@@ -102,9 +80,9 @@ test("keeps the pulse strip and mounts no briefing home when experts is off", as
mockHomeData();
// Absence of the rendered text alone could pass just because the briefing
- // hadn't resolved yet. The briefing and pending-review queries only exist
- // inside CopilotHome, so "never requested" is the durable proof the gate
- // held — and it fails loudly if the gate is removed.
+ // hadn't resolved yet. The briefing query only exists inside CopilotHome,
+ // so "never requested" is the durable proof the gate held — and it fails
+ // loudly if the gate is removed.
const requestedPaths: string[] = [];
function record({ request }: { request: Request }) {
requestedPaths.push(new URL(request.url).pathname);
@@ -124,10 +102,7 @@ test("keeps the pulse strip and mounts no briefing home when experts is off", as
expect(requestedPaths.some((path) => path.includes("briefing"))).toBe(
false,
);
- expect(requestedPaths.some((path) => path.includes("review"))).toBe(false);
- expect(screen.queryByText("What ran")).toBeNull();
- expect(screen.queryByText("What was found")).toBeNull();
- expect(screen.queryByText(/Needs your attention/)).toBeNull();
+ expect(screen.queryByText("Recap")).toBeNull();
} finally {
server.events.removeListener("request:start", record);
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/__tests__/main.test.tsx
index 03ac69ebae..a9d4d10da8 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/__tests__/main.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/__tests__/main.test.tsx
@@ -1,5 +1,6 @@
import { expect, test, vi } from "vitest";
import { http, HttpResponse } from "msw";
+import userEvent from "@testing-library/user-event";
import { render, screen } from "@/tests/integrations/test-utils";
import { server } from "@/mocks/mock-server";
import {
@@ -8,14 +9,9 @@ import {
} from "@/app/api/__generated__/endpoints/library/library.msw";
import { getGetV1ListAllExecutionsMockHandler } from "@/app/api/__generated__/endpoints/graphs/graphs.msw";
import { getGetBriefingsGetLatestBriefingMockHandler200 } from "@/app/api/__generated__/endpoints/briefings/briefings.msw";
-import { getListExpertsMockHandler200 } from "@/app/api/__generated__/endpoints/experts/experts.msw";
-import { getGetV1ListExecutionSchedulesForAUserMockHandler } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";
-import { getGetV2GetPendingReviewsMockHandler200 } from "@/app/api/__generated__/endpoints/executions/executions.msw";
-import type { Expert } from "@/app/api/__generated__/models/expert";
-import type { PendingHumanReviewModel } from "@/app/api/__generated__/models/pendingHumanReviewModel";
import { EmptySession } from "../../EmptySession/EmptySession";
-// Rendered through EmptySession, not CopilotHome directly: the briefing home
+// Rendered through EmptySession, not CopilotHome directly: the briefing recap
// mounts inside it, and the onboarding surface + composer recipient picker
// that live there must survive the experts flag being on.
vi.mock("@/services/feature-flags/use-get-flag", async (importActual) => {
@@ -39,9 +35,7 @@ const baseProps = {
// Guarantees the pulse strip has at least one chip regardless of faker's
// random defaults — an agent with an external trigger always produces a
-// "listening" sitrep item. Also pins pending reviews to empty since the
-// generated mock otherwise returns 1-10 random reviews by default, which
-// would make the needs-attention slot non-deterministic across tests.
+// "listening" sitrep item.
function mockPulseStripAgent() {
const base = getGetV2ListLibraryAgentsResponseMock();
server.use(
@@ -58,102 +52,6 @@ function mockPulseStripAgent() {
},
}),
getGetV1ListAllExecutionsMockHandler([]),
- getGetV2GetPendingReviewsMockHandler200([]),
- );
-}
-
-const pendingReview: PendingHumanReviewModel = {
- node_exec_id: "ne-1",
- node_id: "n-1",
- user_id: "u-1",
- graph_exec_id: "run-1",
- graph_id: "g-1",
- graph_version: 1,
- payload: { to: "[email protected]" },
- instructions: "Approve outreach email",
- editable: true,
- status: "WAITING",
- expert_id: "exp-1",
- expert_name: "Ana",
- expert_avatar_url: null,
- agent_name: "Lead Finder",
- library_agent_id: "lib-1",
- session_id: null,
- created_at: new Date(),
-};
-
-const healthyExpert: Expert = {
- id: "expert-healthy",
- name: "Sales Scout",
- avatar_url: null,
- role: "Sales Researcher",
- bio: null,
- skills: [],
- tagline: "Finds leads while you sleep",
- identity: "You are a senior sales researcher.",
- voice_preferences: "",
- boundaries: "",
- protected_soul_rules: [],
- is_template: false,
- source_template_id: null,
- is_archived: false,
- workflows: [],
- last_run_at: new Date("2026-08-06T10:00:00Z"),
- last_run_status: "COMPLETED",
-};
-
-const pausedExpert: Expert = {
- id: "expert-paused",
- name: "Support Bot",
- avatar_url: null,
- role: "Support Triager",
- bio: null,
- skills: [],
- tagline: "Triages tickets",
- identity: "You are a support triager.",
- voice_preferences: "",
- boundaries: "",
- protected_soul_rules: [],
- is_template: false,
- source_template_id: null,
- is_archived: false,
- workflows: [],
- schedules_paused_at: new Date("2026-08-05T10:00:00Z"),
-};
-
-const needsSetupExpert: Expert = {
- id: "expert-needs-setup",
- name: "Ops Analyst",
- avatar_url: null,
- role: "Operations Analyst",
- bio: null,
- skills: [],
- tagline: "Keeps the ops dashboard current",
- identity: "You are an operations analyst.",
- voice_preferences: "",
- boundaries: "",
- protected_soul_rules: [],
- is_template: false,
- source_template_id: null,
- is_archived: false,
- workflows: [
- {
- id: "wf-1",
- store_listing_version_id: "slv-1",
- library_agent_id: "lib-1",
- graph_id: "graph-1",
- name: "Daily Report",
- description: null,
- schedule_cron: "0 9 * * *",
- schedule_id: null,
- },
- ],
-};
-
-function mockTeamStrip() {
- server.use(
- getListExpertsMockHandler200([healthyExpert, pausedExpert]),
- getGetV1ListExecutionSchedulesForAUserMockHandler([]),
);
}
@@ -226,74 +124,124 @@ test("renders briefing sections when a briefing is available", async () => {
);
render(<EmptySession {...baseProps} />);
- expect(await screen.findByText("What ran")).toBeDefined();
- expect(screen.getByText("What was found")).toBeDefined();
- // Findings carry their agent name, matching the thread markdown.
+ expect(await screen.findByText("Recap")).toBeDefined();
+ expect(screen.getByText("Lead Finder")).toBeDefined();
+ expect(screen.getByText("Ticket Triager")).toBeDefined();
+ // A summary carries the expert it came from, matching the thread markdown.
const finding = screen.getByText(/Found 3 leads/);
- expect(finding.textContent).toContain("Lead Finder");
+ expect(finding.textContent).toContain("Sales Scout");
- // The card does not repeat the decisions: the needs-attention list below
+ // The recap does not repeat the decisions: the needs-you list on /home
// shows the same pending reviews, and it can act on them.
expect(screen.queryByText(/Needs your decision/)).toBeNull();
});
-test("renders the team strip with hired experts", async () => {
+test("shows three runs, then all of them behind the show-all toggle", async () => {
mockPulseStripAgent();
- server.use(getGetBriefingsGetLatestBriefingMockHandler200(null));
- mockTeamStrip();
+ server.use(
+ getGetBriefingsGetLatestBriefingMockHandler200({
+ id: "briefing-1",
+ briefing_date: new Date(),
+ created_at: new Date(),
+ delivered_at: null,
+ content: {
+ generated_at: new Date(),
+ timezone: "UTC",
+ zero_expert_fallback: false,
+ run_items: Array.from({ length: 5 }, (_, i) => ({
+ expert_id: null,
+ expert_name: null,
+ expert_avatar_url: null,
+ agent_name: `Agent ${i}`,
+ graph_id: `graph-${i}`,
+ execution_id: `exec-${i}`,
+ library_agent_id: null,
+ status: "COMPLETED",
+ summary: null,
+ link: null,
+ })),
+ decision_items: [],
+ decision_total: 0,
+ },
+ }),
+ );
render(<EmptySession {...baseProps} />);
- expect(await screen.findByText("Sales Scout")).toBeDefined();
- expect(screen.getByText("Support Bot")).toBeDefined();
- expect(screen.getByText("Paused")).toBeDefined();
-
- // Each Chat link names its expert, so screen readers can tell the
- // repeated links apart.
- expect(
- screen
- .getByRole("link", { name: "Chat with Sales Scout" })
- .getAttribute("href"),
- ).toBe("/copilot?expertId=expert-healthy");
- expect(
- screen
- .getByRole("link", { name: "Chat with Support Bot" })
- .getAttribute("href"),
- ).toBe("/copilot?expertId=expert-paused");
-});
+ // Every row stays mounted so the card can animate its height in both
+ // directions; the collapsed card clips to three rows visually, and only
+ // the expanded one scrolls.
+ expect(await screen.findByText("Agent 4")).toBeDefined();
+ expect(screen.getByRole("list").className).toContain("overflow-hidden");
-test("uses singular grammar for a single workflow needing setup", async () => {
- mockPulseStripAgent();
- server.use(
- getGetBriefingsGetLatestBriefingMockHandler200(null),
- getListExpertsMockHandler200([needsSetupExpert]),
- getGetV1ListExecutionSchedulesForAUserMockHandler([]),
+ await userEvent.click(
+ screen.getByRole("button", { name: /Show all results \(5\)/ }),
);
- render(<EmptySession {...baseProps} />);
- expect(await screen.findByText("1 workflow needs setup")).toBeDefined();
+ expect(screen.getByRole("list").className).toContain("overflow-y-auto");
+ expect(screen.getByRole("button", { name: /Show less/ })).toBeDefined();
});
-test("renders a needs-attention row when a review is pending", async () => {
+test("links each row straight at its run", async () => {
mockPulseStripAgent();
server.use(
- getGetBriefingsGetLatestBriefingMockHandler200(null),
- getGetV2GetPendingReviewsMockHandler200([pendingReview]),
+ getGetBriefingsGetLatestBriefingMockHandler200({
+ id: "briefing-1",
+ briefing_date: new Date(),
+ created_at: new Date(),
+ delivered_at: null,
+ content: {
+ generated_at: new Date(),
+ timezone: "UTC",
+ zero_expert_fallback: false,
+ run_items: [
+ {
+ expert_id: "expert-1",
+ expert_name: "Sales Scout",
+ expert_avatar_url: null,
+ agent_name: "Lead Finder",
+ graph_id: "graph-1",
+ execution_id: "exec-1",
+ library_agent_id: "lib-1",
+ status: "COMPLETED",
+ summary: "Found 3 leads",
+ link: "/library/agents/lib-1/runs/exec-1",
+ },
+ ],
+ decision_items: [],
+ decision_total: 0,
+ },
+ }),
);
render(<EmptySession {...baseProps} />);
- expect(await screen.findByText("Approve outreach email")).toBeDefined();
+ const row = await screen.findByRole("link", { name: /Lead Finder/ });
+ expect(row.getAttribute("href")).toBe("/library/agents/lib-1/runs/exec-1");
});
-test("does not render the needs-attention slot when there are no pending reviews", async () => {
+test("keeps the decisions inbox and team status off the copilot recap", async () => {
+ // Both moved to /home. Proving the pending-reviews query never fires is
+ // what keeps the inbox from creeping back in: absent text alone would
+ // also pass while the request was still in flight. (The experts query has
+ // no such tell — the composer's recipient picker still needs it.)
mockPulseStripAgent();
- server.use(
- getGetBriefingsGetLatestBriefingMockHandler200(null),
- getGetV2GetPendingReviewsMockHandler200([]),
- );
- render(<EmptySession {...baseProps} />);
+ server.use(getGetBriefingsGetLatestBriefingMockHandler200(null));
- await screen.findByText("What's happening with your agents");
- expect(screen.queryByText(/Needs your attention/)).toBeNull();
+ const requestedPaths: string[] = [];
+ function record({ request }: { request: Request }) {
+ requestedPaths.push(new URL(request.url).pathname);
+ }
+ server.events.on("request:start", record);
+
+ try {
+ render(<EmptySession {...baseProps} />);
+ await screen.findByText("What's happening with your agents");
+
+ expect(requestedPaths.some((path) => path.includes("review"))).toBe(false);
+ expect(screen.queryByText(/Needs your attention/)).toBeNull();
+ expect(screen.queryByRole("link", { name: /Chat with/ })).toBeNull();
+ } finally {
+ server.events.removeListener("request:start", record);
+ }
});
test("shows an error card instead of the pulse strip when the briefing fetch fails", async () => {
@@ -309,25 +257,9 @@ test("shows an error card instead of the pulse strip when the briefing fetch fai
expect(screen.queryByText("What's happening with your agents")).toBeNull();
});
-test("shows an error card when the pending-reviews fetch fails", async () => {
- mockPulseStripAgent();
- server.use(
- getGetBriefingsGetLatestBriefingMockHandler200(null),
- http.get("/api/proxy/api/review/pending", () =>
- HttpResponse.json({ detail: "boom" }, { status: 500 }),
- ),
- );
- render(<EmptySession {...baseProps} />);
-
- expect(
- await screen.findByText("Failed to load pending reviews"),
- ).toBeDefined();
- expect(screen.queryByText(/Needs your attention/)).toBeNull();
-});
-
test("keeps the onboarding surface and recipient picker with the experts flag on", async () => {
// hire-experts and onboarding-brain-dump are independent flags aimed at
- // overlapping beta cohorts; the briefing home must not cancel the other
+ // overlapping beta cohorts; the briefing recap must not cancel the other
// rollout out from under a brand-new user.
mockPulseStripAgent();
server.use(getGetBriefingsGetLatestBriefingMockHandler200(null));
@@ -378,8 +310,8 @@ test("renders a run row without a link when the briefing has no deep link", asyn
});
test("does not render a hollow briefing card when there are no runs", async () => {
- // A run paused on an approval is not terminal, so it never lands in "What
- // ran" — leaving a card that would show only a date.
+ // A run paused on an approval is not terminal, so it never lands in the
+ // run list — leaving a card that would show only a date.
mockPulseStripAgent();
server.use(
getGetBriefingsGetLatestBriefingMockHandler200({
@@ -409,7 +341,11 @@ test("does not render a hollow briefing card when there are no runs", async () =
);
render(<EmptySession {...baseProps} />);
- await screen.findByPlaceholderText(/./);
+ // The pulse strip has to take over: the decisions inbox that used to carry
+ // this case is on /home now, so without it the empty state is blank.
+ expect(
+ await screen.findByText("What's happening with your agents"),
+ ).toBeDefined();
expect(screen.queryByText("This morning")).toBeNull();
- expect(screen.queryByText("What ran")).toBeNull();
+ expect(screen.queryByText("Recap")).toBeNull();
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/BriefingCard/BriefingCard.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/BriefingCard/BriefingCard.tsx
deleted file mode 100644
index 718e84f15e..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/BriefingCard/BriefingCard.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-import Link from "next/link";
-import type { BriefingResponse } from "@/app/api/__generated__/models/briefingResponse";
-import type { BriefingRunItem } from "@/app/api/__generated__/models/briefingRunItem";
-import { Card } from "@/components/atoms/Card/Card";
-import { Text } from "@/components/atoms/Text/Text";
-import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
-import { cn } from "@/lib/utils";
-import { formatBriefingDate, isInternalLink } from "./helpers";
-
-interface Props {
- briefing: BriefingResponse;
-}
-
-// The briefing's decision items are deliberately not rendered here: the same
-// pending reviews already appear — and are actionable — in the
-// needs-attention list directly below this card. They stay in the thread
-// markdown, where there is no such list.
-export function BriefingCard({ briefing }: Props) {
- const { run_items } = briefing.content;
- const foundItems = run_items.filter((item) => item.summary);
-
- // A briefing can be all decisions and no terminal runs (a run paused on an
- // approval never completes), which would render as a card containing just
- // a date. The needs-attention list below carries that case on its own.
- if (run_items.length === 0) return null;
-
- return (
- <Card className="mb-5 space-y-5 text-left">
- <Text variant="small" className="text-zinc-500">
- {formatBriefingDate(briefing.briefing_date)}
- </Text>
-
- {run_items.length > 0 ? (
- <section className="flex flex-col gap-3">
- <Text variant="h5">What ran</Text>
- <div className="flex flex-col gap-2">
- {run_items.map((item) => (
- <RunRow key={item.execution_id} item={item} />
- ))}
- </div>
- </section>
- ) : null}
-
- {foundItems.length > 0 ? (
- <section className="flex flex-col gap-3">
- <Text variant="h5">What was found</Text>
- <div className="flex flex-col gap-2">
- {foundItems.map((item) => (
- <Text
- key={item.execution_id}
- variant="body"
- className="text-zinc-700"
- >
- {/* Attribution matters once more than one agent reports:
- mirrors the thread markdown's "**{agent}**: {summary}". */}
- <span className="font-medium">{item.agent_name}</span>:{" "}
- {item.summary}
- </Text>
- ))}
- </div>
- </section>
- ) : null}
- </Card>
- );
-}
-
-function RunRow({ item }: { item: BriefingRunItem }) {
- const isFailed = item.status !== "COMPLETED";
- const subtitle = [item.expert_name, isFailed ? "Failed" : "Completed"]
- .filter(Boolean)
- .join(" · ");
-
- const body = (
- <>
- <ExpertAvatar
- name={item.expert_name}
- avatarUrl={item.expert_avatar_url}
- size={32}
- />
- <div className="min-w-0 flex-1">
- <Text
- variant="body-medium"
- className={cn("truncate", isFailed && "text-destructive")}
- >
- {item.agent_name}
- </Text>
- <Text
- variant="small"
- className={cn(
- "truncate text-zinc-500",
- isFailed && "text-destructive",
- )}
- >
- {subtitle}
- </Text>
- </div>
- </>
- );
-
- // Relative paths only: the backend composes these, but nothing else stops
- // a future regression from delivering an absolute or `javascript:` URL to
- // a Next.js <Link>.
- if (!item.link || !isInternalLink(item.link)) {
- return (
- <div className="flex items-center gap-3 rounded-xl border border-zinc-200 p-3">
- {body}
- </div>
- );
- }
-
- return (
- <Link
- href={item.link}
- className="flex items-center gap-3 rounded-xl border border-zinc-200 p-3"
- >
- {body}
- </Link>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/BriefingCard/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/BriefingCard/helpers.test.ts
deleted file mode 100644
index 4c81d270f5..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/BriefingCard/helpers.test.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { afterEach, describe, expect, it, vi } from "vitest";
-import { formatBriefingDate, isInternalLink } from "./helpers";
-
-describe("formatBriefingDate", () => {
- afterEach(() => {
- vi.useRealTimers();
- });
-
- it("labels today's briefing as this morning", () => {
- vi.useFakeTimers();
- vi.setSystemTime(new Date("2026-08-07T09:00:00Z"));
-
- expect(formatBriefingDate("2026-08-07")).toBe("This morning");
- });
-
- it("does not shift a date-only string a day back", () => {
- // The API sends "2026-08-07" with no time part, so the client's date
- // transformer leaves it a string. `new Date(...)` would read it as UTC
- // midnight — i.e. Aug 6 in the evening for anyone west of UTC.
- vi.useFakeTimers();
- vi.setSystemTime(new Date("2026-08-09T12:00:00Z"));
-
- expect(formatBriefingDate("2026-08-07")).toBe("August 7");
- });
-
- it("accepts an already-parsed Date", () => {
- vi.useFakeTimers();
- vi.setSystemTime(new Date("2026-08-09T12:00:00Z"));
-
- expect(formatBriefingDate(new Date(2026, 7, 7, 9, 0))).toBe("August 7");
- });
-});
-
-describe("isInternalLink", () => {
- it("accepts an app-relative path", () => {
- expect(isInternalLink("/library/agents/lib-1")).toBe(true);
- });
-
- it.each(["https://evil.example", "javascript:alert(1)", "//evil.example"])(
- "rejects %s",
- (link) => {
- expect(isInternalLink(link)).toBe(false);
- },
- );
-});
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/BriefingCard/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/BriefingCard/helpers.ts
deleted file mode 100644
index 4585eb45fc..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/BriefingCard/helpers.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { format, isToday, parseISO } from "date-fns";
-
-export function formatBriefingDate(date: Date | string): string {
- // The generated type says Date, but date-only strings ("2026-08-07") skip
- // the client's date transformer (its regex requires a time part), so the
- // runtime value is still a string. parseISO reads it as LOCAL midnight —
- // `new Date("2026-08-07")` would read UTC midnight and shift the label a
- // day back for viewers west of UTC.
- const parsed = typeof date === "string" ? parseISO(date) : date;
- if (isToday(parsed)) return "This morning";
- return format(parsed, "MMMM d");
-}
-
-export function isInternalLink(link: string): boolean {
- return link.startsWith("/") && !link.startsWith("//");
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/TeamStrip.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/TeamStrip.tsx
deleted file mode 100644
index 93162c58d2..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/TeamStrip.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import Link from "next/link";
-import type { Expert } from "@/app/api/__generated__/models/expert";
-import type { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
-import { Text } from "@/components/atoms/Text/Text";
-import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
-import { getExpertStatusLine } from "./helpers";
-import { useTeamStrip } from "./useTeamStrip";
-
-export function TeamStrip() {
- const { isVisible, hiredExperts, schedules } = useTeamStrip();
-
- if (!isVisible) return null;
-
- return (
- <div className="mb-6 flex snap-x gap-3 overflow-x-auto pb-2 text-left">
- {hiredExperts.map((expert) => (
- <TeamStripCard key={expert.id} expert={expert} schedules={schedules} />
- ))}
- </div>
- );
-}
-
-interface CardProps {
- expert: Expert;
- schedules: GraphExecutionJobInfo[];
-}
-
-function TeamStripCard({ expert, schedules }: CardProps) {
- return (
- <div className="flex w-56 shrink-0 snap-start flex-col gap-3 rounded-2xl border border-zinc-200 bg-white p-4">
- <Link
- href={`/team/${expert.id}`}
- aria-label={`View ${expert.name}`}
- className="flex flex-col gap-2"
- >
- <ExpertAvatar name={expert.name} avatarUrl={expert.avatar_url} />
- <div className="min-w-0">
- <Text variant="body-medium" className="truncate">
- {expert.name}
- </Text>
- <Text variant="small" className="truncate text-zinc-500">
- {expert.role}
- </Text>
- </div>
- <Text variant="small" className="truncate text-zinc-500">
- {getExpertStatusLine(expert, schedules)}
- </Text>
- </Link>
- <Link
- href={`/copilot?expertId=${expert.id}`}
- aria-label={`Chat with ${expert.name}`}
- className="text-sm font-medium text-zinc-700 hover:text-zinc-900"
- >
- Chat
- </Link>
- </div>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/helpers.test.ts
deleted file mode 100644
index c5441ebb6a..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/helpers.test.ts
+++ /dev/null
@@ -1,99 +0,0 @@
-import { describe, expect, it } from "vitest";
-import type { Expert } from "@/app/api/__generated__/models/expert";
-import type { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
-import type { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
-import { getExpertStatusLine } from "./helpers";
-
-function makeWorkflow(id: string): ExpertWorkflowRef {
- // schedule_cron set + schedule_id missing is what "needs setup" means.
- return {
- id,
- store_listing_version_id: `slv-${id}`,
- library_agent_id: `lib-${id}`,
- graph_id: `graph-${id}`,
- name: `Workflow ${id}`,
- description: null,
- schedule_cron: "0 9 * * *",
- schedule_id: null,
- };
-}
-
-function makeExpert(overrides: Partial<Expert> = {}): Expert {
- return {
- id: "expert-1",
- name: "Sales Scout",
- avatar_url: null,
- role: "Sales Researcher",
- bio: null,
- skills: [],
- tagline: null,
- identity: "You are a senior sales researcher.",
- voice_preferences: "",
- boundaries: "",
- protected_soul_rules: [],
- is_template: false,
- source_template_id: null,
- is_archived: false,
- workflows: [],
- ...overrides,
- };
-}
-
-function makeSchedule(overrides: Partial<GraphExecutionJobInfo> = {}) {
- return {
- id: "sched-1",
- name: "Daily Report",
- user_id: "u-1",
- graph_id: "graph-1",
- graph_version: 1,
- cron: "0 9 * * *",
- input_data: {},
- next_run_time: "2026-08-10T14:30:00Z",
- expert_id: "expert-1",
- ...overrides,
- } as GraphExecutionJobInfo;
-}
-
-describe("getExpertStatusLine", () => {
- it("reports a paused expert before anything else", () => {
- const expert = makeExpert({
- schedules_paused_at: new Date("2026-08-05T10:00:00Z"),
- workflows: [makeWorkflow("1")],
- });
-
- expect(getExpertStatusLine(expert, [])).toBe("Paused");
- });
-
- it("uses singular grammar for one workflow needing setup", () => {
- const expert = makeExpert({ workflows: [makeWorkflow("1")] });
-
- expect(getExpertStatusLine(expert, [])).toBe("1 workflow needs setup");
- });
-
- it("uses plural grammar for several workflows needing setup", () => {
- const expert = makeExpert({
- workflows: [makeWorkflow("1"), makeWorkflow("2")],
- });
-
- expect(getExpertStatusLine(expert, [])).toBe("2 workflows need setup");
- });
-
- it("falls back to the last run once nothing needs setup", () => {
- const expert = makeExpert({
- last_run_at: new Date("2026-08-06T10:00:00Z"),
- last_run_status: "COMPLETED",
- });
-
- expect(getExpertStatusLine(expert, [])).toContain("Last run succeeded");
- });
-
- it("shows the next scheduled run for an expert that has never run", () => {
- const expert = makeExpert();
-
- expect(getExpertStatusLine(expert, [makeSchedule()])).toMatch(/^Next run /);
- });
-
- it("falls back to Idle with no runs and no schedules", () => {
- expect(getExpertStatusLine(makeExpert(), [])).toBe("Idle");
- });
-});
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/helpers.ts
deleted file mode 100644
index 5aa7917e81..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/helpers.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import type { Expert } from "@/app/api/__generated__/models/expert";
-import type { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
-import {
- getExpertSchedules,
- getLastRunLabel,
- getNeedsSetupCount,
-} from "@/app/(platform)/team/helpers";
-
-export function getExpertStatusLine(
- expert: Expert,
- schedules: GraphExecutionJobInfo[],
-): string {
- if (expert.schedules_paused_at) return "Paused";
-
- const needsSetup = getNeedsSetupCount(expert);
- if (needsSetup > 0) {
- const noun = needsSetup === 1 ? "workflow" : "workflows";
- const verb = needsSetup === 1 ? "needs" : "need";
- return `${needsSetup} ${noun} ${verb} setup`;
- }
-
- const lastRun = getLastRunLabel(expert);
- if (lastRun) return lastRun;
-
- const next = getExpertSchedules(expert, schedules)[0]?.next_run_time;
- if (next) {
- return `Next run ${new Date(next).toLocaleTimeString([], {
- hour: "numeric",
- minute: "2-digit",
- })}`;
- }
-
- return "Idle";
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/useTeamStrip.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/useTeamStrip.ts
deleted file mode 100644
index 6b6b2bbae3..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/components/TeamStrip/useTeamStrip.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { useListExperts } from "@/app/api/__generated__/endpoints/experts/experts";
-import { useGetV1ListExecutionSchedulesForAUser } from "@/app/api/__generated__/endpoints/schedules/schedules";
-import { okData } from "@/app/api/helpers";
-import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
-
-export function useTeamStrip() {
- const isExpertsEnabled = useGetFlag(Flag.HIRE_EXPERTS);
-
- const expertsQuery = useListExperts({
- query: {
- // okData, like every sibling query here: an error body must never
- // reach the render layer typed as Expert[].
- select: (res) => okData(res) ?? [],
- enabled: isExpertsEnabled,
- },
- });
- const schedulesQuery = useGetV1ListExecutionSchedulesForAUser({
- query: { select: (res) => okData(res) ?? [], enabled: isExpertsEnabled },
- });
-
- const hiredExperts = (expertsQuery.data ?? []).filter(
- (expert) => !expert.is_template && !expert.is_archived,
- );
-
- return {
- isVisible: isExpertsEnabled && hiredExperts.length > 0,
- hiredExperts,
- schedules: schedulesQuery.data ?? [],
- };
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/useCopilotHome.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/useCopilotHome.ts
index 3e665d5360..e0d596ea1e 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/useCopilotHome.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CopilotHome/useCopilotHome.ts
@@ -12,6 +12,5 @@ export function useCopilotHome() {
isLoadingBriefing: isLoading,
isBriefingError: isError,
refetchBriefing: refetch,
- hasBriefing: Boolean(data),
};
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx
index 76c3972c3c..a1b5ac39cd 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx
@@ -92,15 +92,7 @@ export function EmptySession({
}, []);
return (
- <div
- className={cn(
- "relative flex h-full flex-1 justify-center overflow-y-auto px-0 py-5 md:px-6 md:py-10",
- // The whole greeting flow reads top-down like a letter, so it
- // anchors to the top from its first visible frame; the regular
- // hero stays vertically centered.
- intro.anchorTop ? "items-start" : "items-center",
- )}
- >
+ <div className="relative flex h-full flex-1 items-start justify-center overflow-y-auto px-0 py-5 md:px-6 md:py-10">
{!isBrainDumpEnabled && (
<DotDistortionShader
dotGap={14}
@@ -116,7 +108,16 @@ export function EmptySession({
onClose={intro.closeWelcome}
/>
<motion.div
- className="relative z-10 w-full max-w-[52rem] text-center"
+ className={cn(
+ "relative z-10 w-full max-w-[52rem] text-center",
+ // The whole greeting flow reads top-down like a letter, so it
+ // anchors to the top from its first visible frame; the regular
+ // hero centers itself. `my-auto` rather than the parent's
+ // `items-center`: auto margins collapse to 0 once the content is
+ // taller than the scroller, where centering would push the top of
+ // the page above the scroll origin and make it unreachable.
+ !intro.anchorTop && "my-auto",
+ )}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.3 }}
@@ -141,24 +142,6 @@ export function EmptySession({
<EmptyHero name={greetingName} />
)}
- {!intro.isVisible &&
- !intro.isAwaitingGreeting &&
- (isExpertsEnabled ? (
- // The briefing home takes the chips' slot and falls back to
- // them — still on their own flag — when there's no briefing.
- <CopilotHome
- fallback={
- isAgentBriefingEnabled ? (
- <PulseChips chips={pulseChips} onChipClick={onSend} />
- ) : null
- }
- />
- ) : (
- isAgentBriefingEnabled && (
- <PulseChips chips={pulseChips} onChipClick={onSend} />
- )
- ))}
-
{/* Held back while the greeting is on its way — it enters with
the greeting page instead of sitting under a bare hero. */}
{!intro.isAwaitingGreeting && (
@@ -215,6 +198,27 @@ export function EmptySession({
</motion.div>
</div>
)}
+
+ {/* The recap sits under the composer: the empty state's job is to
+ get a message typed, so the briefing reads as context below it
+ rather than as a wall above it. */}
+ {!intro.isVisible &&
+ !intro.isAwaitingGreeting &&
+ (isExpertsEnabled ? (
+ <div className="mx-auto mb-6 w-full max-w-[42rem]">
+ <CopilotHome
+ fallback={
+ isAgentBriefingEnabled ? (
+ <PulseChips chips={pulseChips} onChipClick={onSend} />
+ ) : null
+ }
+ />
+ </div>
+ ) : (
+ isAgentBriefingEnabled && (
+ <PulseChips chips={pulseChips} onChipClick={onSend} />
+ )
+ ))}
</div>
{/* The greeting page is deliberately quiet: its own prompts are
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/MorningBriefing/components/OutcomeRow.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/MorningBriefing/components/OutcomeRow.tsx
index d85eea8a76..06272d6613 100644
--- a/autogpt_platform/frontend/src/app/(platform)/home/components/MorningBriefing/components/OutcomeRow.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/MorningBriefing/components/OutcomeRow.tsx
@@ -36,7 +36,7 @@ export function OutcomeRow({ outcome }: Props) {
{outcome.title}
</Text>
<Text
- variant="large"
+ variant="body"
className="mt-1 line-clamp-2 text-pretty text-zinc-600"
>
{outcome.summary}
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/NeedsYou/components/AttentionRow.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/NeedsYou/components/AttentionRow.tsx
index 50718b7da1..7fcd3ba1c8 100644
--- a/autogpt_platform/frontend/src/app/(platform)/home/components/NeedsYou/components/AttentionRow.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/NeedsYou/components/AttentionRow.tsx
@@ -70,7 +70,7 @@ export function AttentionRow({ item, isProcessing, onDecision }: Props) {
) : null}
</div>
<Text
- variant="large"
+ variant="body"
className="mt-1 line-clamp-2 text-pretty text-zinc-600"
>
{item.description}
diff --git a/autogpt_platform/frontend/src/components/organisms/BriefingCard/BriefingCard.tsx b/autogpt_platform/frontend/src/components/organisms/BriefingCard/BriefingCard.tsx
new file mode 100644
index 0000000000..4383640b02
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/organisms/BriefingCard/BriefingCard.tsx
@@ -0,0 +1,170 @@
+"use client";
+
+import { motion, useReducedMotion } from "framer-motion";
+import {
+ ArrowDown01Icon,
+ ArrowDown02Icon,
+ ArrowUp02Icon,
+ News01Icon,
+} from "@hugeicons/core-free-icons";
+import type { BriefingResponse } from "@/app/api/__generated__/models/briefingResponse";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { cn } from "@/lib/utils";
+import { RunRow } from "./components/RunRow";
+import { COLLAPSED_ROWS, formatBriefingDate, hasRecapContent } from "./helpers";
+import { useBriefingCard } from "./useBriefingCard";
+
+interface Props {
+ briefing: BriefingResponse;
+ className?: string;
+}
+
+// The briefing's decision items are deliberately not rendered here: the same
+// pending reviews already appear — and are actionable — in the
+// needs-attention list on the home page. They stay in the thread markdown,
+// where there is no such list.
+export function BriefingCard({ briefing, className }: Props) {
+ const { run_items } = briefing.content;
+ const {
+ listRef,
+ height,
+ heightTransition,
+ isShowingAll,
+ toggleShowAll,
+ canScrollUp,
+ canScrollDown,
+ scrollByStep,
+ } = useBriefingCard(run_items.map((item) => item.execution_id).join("|"));
+
+ // Callers gate on hasRecapContent so they can show their own fallback;
+ // this keeps the organism safe to mount on its own.
+ if (!hasRecapContent(briefing)) return null;
+
+ const hasMore = run_items.length > COLLAPSED_ROWS;
+
+ return (
+ <section className={cn("text-left", className)}>
+ <div className="mb-2 flex items-center gap-2 px-2">
+ <Icon icon={News01Icon} size={16} className="text-zinc-400" />
+ <Text variant="body" className="text-zinc-700">
+ Recap
+ </Text>
+ {/* Both stops stay at or below purple-600 so the lightest painted
+ pixel still clears WCAG AA (4.5:1) against the white card. */}
+ <Text
+ variant="body"
+ className="bg-gradient-to-r from-purple-800 to-purple-600 bg-clip-text text-transparent"
+ >
+ {formatBriefingDate(briefing.briefing_date)}
+ </Text>
+ </div>
+
+ <div className="overflow-hidden rounded-3xl bg-white shadow-zinc-950 smooth-shadow-ring-sm">
+ <motion.div
+ // Real height, not a layout transform: the page below has to reflow
+ // with the card, and a transform would scale the rows' text.
+ initial={false}
+ animate={{ height: height ?? "auto" }}
+ transition={heightTransition}
+ className="relative"
+ >
+ <ul
+ ref={listRef}
+ className={cn(
+ "h-full divide-y divide-zinc-100",
+ isShowingAll
+ ? "overflow-y-auto scrollbar-none"
+ : "overflow-hidden",
+ )}
+ >
+ {run_items.map((item, index) => (
+ <RunRow
+ key={item.execution_id}
+ item={item}
+ isHidden={!isShowingAll && index >= COLLAPSED_ROWS}
+ />
+ ))}
+ </ul>
+
+ {/* Inside the card, over the scrolling rows: the scrollbar is
+ hidden, so these are the only affordance once the list runs past
+ its window. */}
+ <ScrollArrow
+ direction="up"
+ isVisible={canScrollUp}
+ onScroll={() => scrollByStep(-1)}
+ />
+ <ScrollArrow
+ direction="down"
+ isVisible={canScrollDown}
+ onScroll={() => scrollByStep(1)}
+ />
+ </motion.div>
+
+ {hasMore ? (
+ <button
+ type="button"
+ onClick={toggleShowAll}
+ className="flex w-full items-center justify-center gap-1.5 border-t border-zinc-100 px-4 py-3 text-zinc-500 transition-colors hover:bg-zinc-50 hover:text-zinc-900"
+ >
+ <Text variant="small-medium" className="text-inherit">
+ {isShowingAll
+ ? "Show less"
+ : `Show all results (${run_items.length})`}
+ </Text>
+ <Icon
+ icon={ArrowDown01Icon}
+ size={14}
+ className={cn(
+ "transition-transform",
+ isShowingAll && "rotate-180",
+ )}
+ />
+ </button>
+ ) : null}
+ </div>
+ </section>
+ );
+}
+
+function ScrollArrow({
+ direction,
+ isVisible,
+ onScroll,
+}: {
+ direction: "up" | "down";
+ isVisible: boolean;
+ onScroll: () => void;
+}) {
+ const isUp = direction === "up";
+ const shouldReduceMotion = useReducedMotion();
+
+ return (
+ <motion.div
+ initial={false}
+ animate={{ opacity: isVisible ? 1 : 0 }}
+ transition={{ duration: shouldReduceMotion ? 0 : 0.15 }}
+ className={cn(
+ "pointer-events-none absolute inset-x-0 flex h-12 items-center justify-center",
+ isUp
+ ? "top-0 bg-gradient-to-b from-white via-white/85 to-transparent"
+ : "bottom-0 bg-gradient-to-t from-white via-white/85 to-transparent",
+ )}
+ >
+ <button
+ type="button"
+ onClick={onScroll}
+ tabIndex={isVisible ? 0 : -1}
+ aria-hidden={!isVisible}
+ aria-label={isUp ? "Scroll up" : "Scroll down"}
+ className={cn(
+ "flex size-8 items-center justify-center rounded-full bg-white text-zinc-500 shadow-zinc-950 transition-colors smooth-shadow-ring-sm hover:text-zinc-900",
+ isVisible && "pointer-events-auto",
+ )}
+ >
+ <Icon icon={isUp ? ArrowUp02Icon : ArrowDown02Icon} size={16} />
+ </button>
+ </motion.div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/components/organisms/BriefingCard/__tests__/BriefingCard.test.tsx b/autogpt_platform/frontend/src/components/organisms/BriefingCard/__tests__/BriefingCard.test.tsx
new file mode 100644
index 0000000000..8094e2b395
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/organisms/BriefingCard/__tests__/BriefingCard.test.tsx
@@ -0,0 +1,131 @@
+import userEvent from "@testing-library/user-event";
+import { afterEach, beforeEach, expect, test, vi } from "vitest";
+import type { BriefingResponse } from "@/app/api/__generated__/models/briefingResponse";
+import type { BriefingRunItem } from "@/app/api/__generated__/models/briefingRunItem";
+import { render, screen } from "@/tests/integrations/test-utils";
+import { BriefingCard } from "../BriefingCard";
+
+function makeItem(index: number): BriefingRunItem {
+ return {
+ expert_id: `exp-${index}`,
+ expert_name: `Expert ${index}`,
+ expert_avatar_url: null,
+ agent_name: `Agent ${index}`,
+ graph_id: `g-${index}`,
+ execution_id: `run-${index}`,
+ library_agent_id: `lib-${index}`,
+ status: "COMPLETED",
+ summary: `Summary ${index}`,
+ link: `/library/agents/lib-${index}`,
+ };
+}
+
+function makeBriefing(items: BriefingRunItem[]): BriefingResponse {
+ return {
+ id: "briefing-1",
+ briefing_date: new Date("2026-08-12T00:00:00Z"),
+ created_at: new Date("2026-08-12T00:00:00Z"),
+ delivered_at: null,
+ content: {
+ generated_at: new Date("2026-08-12T00:00:00Z"),
+ timezone: "UTC",
+ zero_expert_fallback: false,
+ run_items: items,
+ decision_items: [],
+ },
+ };
+}
+
+const observedTargets: Element[] = [];
+
+beforeEach(() => {
+ observedTargets.length = 0;
+ vi.stubGlobal(
+ "ResizeObserver",
+ class {
+ observe(target: Element) {
+ observedTargets.push(target);
+ }
+ unobserve() {}
+ disconnect() {}
+ },
+ );
+});
+
+afterEach(() => {
+ vi.unstubAllGlobals();
+});
+
+test("keeps clipped rows out of the tab order until the list is expanded", async () => {
+ const { container } = render(
+ <BriefingCard briefing={makeBriefing([0, 1, 2, 3].map(makeItem))} />,
+ );
+
+ const clipped = container.querySelectorAll("li")[3];
+ expect(clipped.getAttribute("aria-hidden")).toBe("true");
+ expect(clipped.querySelector("a")?.getAttribute("tabindex")).toBe("-1");
+ expect(screen.queryByRole("link", { name: /Agent 3/ })).toBeNull();
+
+ await userEvent.click(
+ screen.getByRole("button", { name: /Show all results \(4\)/ }),
+ );
+
+ const expanded = screen.getByRole("link", { name: /Agent 3/ });
+ expect(expanded.getAttribute("tabindex")).toBeNull();
+ expect(expanded.closest("li")?.getAttribute("aria-hidden")).toBeNull();
+});
+
+test("masks agent names and run summaries from session replays", () => {
+ render(<BriefingCard briefing={makeBriefing([makeItem(0)])} />);
+
+ expect(screen.getByText("Agent 0").className).not.toContain("sentry-unmask");
+ expect(
+ screen.getByText(/Summary 0/).className.includes("sentry-unmask"),
+ ).toBe(false);
+});
+
+test("badges a run that did not complete, and only that run", () => {
+ render(
+ <BriefingCard
+ briefing={makeBriefing([
+ makeItem(0),
+ { ...makeItem(1), status: "FAILED" },
+ ])}
+ />,
+ );
+
+ const failedRow = screen.getByText("Agent 1").closest("li");
+ expect(failedRow?.textContent).toContain("Failed");
+ expect(screen.getByText("Agent 0").closest("li")?.textContent).not.toContain(
+ "Failed",
+ );
+});
+
+test("jumps back to the top when the list collapses", async () => {
+ const { container } = render(
+ <BriefingCard briefing={makeBriefing([0, 1, 2, 3].map(makeItem))} />,
+ );
+ const list = container.querySelector("ul") as HTMLUListElement;
+ const scrollTo = vi.fn();
+ list.scrollTo = scrollTo;
+
+ const toggle = screen.getByRole("button", { name: /Show all results/ });
+ await userEvent.click(toggle);
+ expect(scrollTo).not.toHaveBeenCalled();
+
+ await userEvent.click(screen.getByRole("button", { name: /Show less/ }));
+ expect(scrollTo).toHaveBeenCalledWith({ top: 0 });
+});
+
+test("re-observes the rows when the briefing refetches a different run list", () => {
+ const { rerender } = render(
+ <BriefingCard briefing={makeBriefing([0, 1].map(makeItem))} />,
+ );
+ observedTargets.length = 0;
+
+ rerender(<BriefingCard briefing={makeBriefing([0, 1, 2].map(makeItem))} />);
+
+ expect(
+ observedTargets.some((target) => target.textContent?.includes("Agent 2")),
+ ).toBe(true);
+});
diff --git a/autogpt_platform/frontend/src/components/organisms/BriefingCard/components/RunRow.tsx b/autogpt_platform/frontend/src/components/organisms/BriefingCard/components/RunRow.tsx
new file mode 100644
index 0000000000..7e4d3dde57
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/organisms/BriefingCard/components/RunRow.tsx
@@ -0,0 +1,91 @@
+import Link from "next/link";
+import { ArrowRight01Icon } from "@hugeicons/core-free-icons";
+import type { BriefingRunItem } from "@/app/api/__generated__/models/briefingRunItem";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
+import { cn } from "@/lib/utils";
+import { getSafeLink, getSubtitleParts } from "../helpers";
+
+interface Props {
+ item: BriefingRunItem;
+ isHidden?: boolean;
+}
+
+// One row per run: the summary doubles as the row's subtitle, so the agent
+// name and its finding read as a single line.
+export function RunRow({ item, isHidden = false }: Props) {
+ const isFailed = item.status !== "COMPLETED";
+ const { attribution, text } = getSubtitleParts(item);
+ const link = getSafeLink(item.link);
+
+ const body = (
+ <>
+ <ExpertAvatar
+ name={item.expert_name}
+ avatarUrl={item.expert_avatar_url}
+ size={28}
+ />
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center gap-2">
+ {/* Agent names and run summaries are user data: leave them masked in
+ session replays rather than taking Text's static-copy default. */}
+ <Text
+ variant="body-medium"
+ unmask={false}
+ className="truncate text-zinc-900"
+ >
+ {item.agent_name}
+ </Text>
+ {isFailed ? (
+ <span className="shrink-0 rounded-full bg-red-50 px-2 py-0.5 text-[0.6875rem] font-medium text-red-600">
+ Failed
+ </span>
+ ) : null}
+ </div>
+ {text ? (
+ <Text
+ variant="body"
+ unmask={false}
+ className="line-clamp-2 text-zinc-500"
+ >
+ {/* Attribution matters once more than one agent reports:
+ mirrors the thread markdown's "**{agent}**: {summary}". */}
+ {attribution ? (
+ <span className="text-zinc-400">{attribution} · </span>
+ ) : null}
+ {text}
+ </Text>
+ ) : null}
+ </div>
+ {link ? (
+ <Icon
+ icon={ArrowRight01Icon}
+ size={16}
+ className="shrink-0 self-center text-zinc-300 transition-colors group-hover:text-zinc-500"
+ />
+ ) : null}
+ </>
+ );
+
+ const rowClassName = "group flex items-start gap-3 px-5 py-4";
+
+ // Collapsed rows stay mounted and are clipped by the list's overflow, so
+ // without this they keep their place in the tab order and focus lands on
+ // rows the reader cannot see.
+ return (
+ <li aria-hidden={isHidden || undefined}>
+ {link ? (
+ <Link
+ href={link}
+ tabIndex={isHidden ? -1 : undefined}
+ className={cn(rowClassName, "transition-colors hover:bg-zinc-50")}
+ >
+ {body}
+ </Link>
+ ) : (
+ <div className={rowClassName}>{body}</div>
+ )}
+ </li>
+ );
+}
diff --git a/autogpt_platform/frontend/src/components/organisms/BriefingCard/helpers.test.ts b/autogpt_platform/frontend/src/components/organisms/BriefingCard/helpers.test.ts
new file mode 100644
index 0000000000..6a089354e7
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/organisms/BriefingCard/helpers.test.ts
@@ -0,0 +1,108 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import type { BriefingRunItem } from "@/app/api/__generated__/models/briefingRunItem";
+import {
+ formatBriefingDate,
+ getSafeLink,
+ getSubtitleParts,
+ isInternalLink,
+} from "./helpers";
+
+describe("formatBriefingDate", () => {
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
+ it("labels today's briefing as this morning", () => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-08-07T09:00:00Z"));
+
+ expect(formatBriefingDate("2026-08-07")).toBe("This morning");
+ });
+
+ it("does not shift a date-only string a day back", () => {
+ // The API sends "2026-08-07" with no time part, so the client's date
+ // transformer leaves it a string. `new Date(...)` would read it as UTC
+ // midnight — i.e. Aug 6 in the evening for anyone west of UTC.
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-08-09T12:00:00Z"));
+
+ expect(formatBriefingDate("2026-08-07")).toBe("August 7");
+ });
+
+ it("accepts an already-parsed Date", () => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-08-09T12:00:00Z"));
+
+ expect(formatBriefingDate(new Date(2026, 7, 7, 9, 0))).toBe("August 7");
+ });
+});
+
+describe("isInternalLink", () => {
+ it("accepts an app-relative path", () => {
+ expect(isInternalLink("/library/agents/lib-1")).toBe(true);
+ });
+
+ it.each(["https://evil.example", "javascript:alert(1)", "//evil.example"])(
+ "rejects %s",
+ (link) => {
+ expect(isInternalLink(link)).toBe(false);
+ },
+ );
+});
+
+describe("getSafeLink", () => {
+ it("passes an app-relative path through", () => {
+ expect(getSafeLink("/library/agents/lib-1")).toBe("/library/agents/lib-1");
+ });
+
+ it.each([
+ ["null", null],
+ ["undefined", undefined],
+ ["empty", ""],
+ ["absolute", "https://evil.example"],
+ ["protocol-relative", "//evil.example"],
+ ["javascript", "javascript:alert(1)"],
+ ])("returns null for %s", (_label, link) => {
+ expect(getSafeLink(link)).toBeNull();
+ });
+});
+
+describe("getSubtitleParts", () => {
+ function makeItem(overrides: Partial<BriefingRunItem>): BriefingRunItem {
+ return {
+ expert_id: "exp-1",
+ expert_name: "Ana",
+ expert_avatar_url: null,
+ agent_name: "Lead Finder",
+ graph_id: "g-1",
+ execution_id: "run-1",
+ library_agent_id: "lib-1",
+ status: "COMPLETED",
+ summary: null,
+ link: null,
+ ...overrides,
+ };
+ }
+
+ it("attributes a summary to its expert", () => {
+ expect(getSubtitleParts(makeItem({ summary: "Found 3 leads" }))).toEqual({
+ attribution: "Ana",
+ text: "Found 3 leads",
+ });
+ });
+
+ it("uses the expert as the subtitle rather than a prefix to itself", () => {
+ expect(getSubtitleParts(makeItem({ summary: null }))).toEqual({
+ attribution: null,
+ text: "Ana",
+ });
+ });
+
+ it("drops attribution when the run has no expert", () => {
+ expect(
+ getSubtitleParts(
+ makeItem({ summary: "Found 3 leads", expert_name: null }),
+ ),
+ ).toEqual({ attribution: null, text: "Found 3 leads" });
+ });
+});
diff --git a/autogpt_platform/frontend/src/components/organisms/BriefingCard/helpers.ts b/autogpt_platform/frontend/src/components/organisms/BriefingCard/helpers.ts
new file mode 100644
index 0000000000..8527c484ab
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/organisms/BriefingCard/helpers.ts
@@ -0,0 +1,75 @@
+import { format, isToday, parseISO } from "date-fns";
+import type { BriefingResponse } from "@/app/api/__generated__/models/briefingResponse";
+import type { BriefingRunItem } from "@/app/api/__generated__/models/briefingRunItem";
+
+// A briefing can be all decisions and no terminal runs — a run paused on an
+// approval never completes — which leaves the card with nothing but a date.
+// Callers check this before mounting the card, so a briefing that renders to
+// nothing shows their own fallback instead of a blank surface.
+export function hasRecapContent(
+ briefing: BriefingResponse | null | undefined,
+): briefing is BriefingResponse {
+ return Boolean(briefing && briefing.content.run_items.length > 0);
+}
+
+export const COLLAPSED_ROWS = 3;
+
+// Roughly six rows: enough that "show all" feels like it opened something,
+// short enough that the card still sits under the composer.
+const MAX_EXPANDED_HEIGHT = 416;
+
+// Sub-pixel scroll offsets are routine (zoom, fractional row heights), so an
+// exact comparison would leave both arrows on forever.
+const EDGE_TOLERANCE = 2;
+
+// Null when there is nothing to measure yet, so callers can leave the last
+// good height in place rather than collapsing the card to zero.
+export function measureListHeight(
+ list: HTMLElement,
+ isShowingAll: boolean,
+): number | null {
+ const rows = Array.from(list.children) as HTMLElement[];
+ if (rows.length === 0) return null;
+ if (isShowingAll) return Math.min(list.scrollHeight, MAX_EXPANDED_HEIGHT);
+
+ const lastVisible = rows[Math.min(COLLAPSED_ROWS, rows.length) - 1];
+ return lastVisible.offsetTop + lastVisible.offsetHeight - rows[0].offsetTop;
+}
+
+export function getScrollEdges(list: HTMLElement) {
+ const { scrollTop, scrollHeight, clientHeight } = list;
+ return {
+ canScrollUp: scrollTop > EDGE_TOLERANCE,
+ canScrollDown: scrollTop + clientHeight < scrollHeight - EDGE_TOLERANCE,
+ };
+}
+
+export function formatBriefingDate(date: Date | string): string {
+ // The generated type says Date, but date-only strings ("2026-08-07") skip
+ // the client's date transformer (its regex requires a time part), so the
+ // runtime value is still a string. parseISO reads it as LOCAL midnight —
+ // `new Date("2026-08-07")` would read UTC midnight and shift the label a
+ // day back for viewers west of UTC.
+ const parsed = typeof date === "string" ? parseISO(date) : date;
+ if (isToday(parsed)) return "This morning";
+ return format(parsed, "MMMM d");
+}
+
+export function isInternalLink(link: string): boolean {
+ return link.startsWith("/") && !link.startsWith("//");
+}
+
+// Relative paths only: the backend composes these, but nothing else stops a
+// future regression from delivering an absolute or `javascript:` URL to a
+// Next.js <Link>.
+export function getSafeLink(link: string | null | undefined): string | null {
+ return link && isInternalLink(link) ? link : null;
+}
+
+// Attribution only earns its space when it sits in front of something else:
+// with a summary the row reads "Ana · Found 3 leads", and without one the
+// expert's name is the whole subtitle rather than a prefix to itself.
+export function getSubtitleParts(item: BriefingRunItem) {
+ if (!item.summary) return { attribution: null, text: item.expert_name };
+ return { attribution: item.expert_name, text: item.summary };
+}
diff --git a/autogpt_platform/frontend/src/components/organisms/BriefingCard/useBriefingCard.ts b/autogpt_platform/frontend/src/components/organisms/BriefingCard/useBriefingCard.ts
new file mode 100644
index 0000000000..50071a6220
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/organisms/BriefingCard/useBriefingCard.ts
@@ -0,0 +1,59 @@
+"use client";
+
+import { useReducedMotion } from "framer-motion";
+import { useEffect, useRef, useState } from "react";
+import { useCardLayout } from "./useCardLayout";
+
+export function useBriefingCard(rowsKey: string) {
+ const listRef = useRef<HTMLUListElement>(null);
+ const [isShowingAll, setIsShowingAll] = useState(false);
+ const shouldReduceMotion = useReducedMotion();
+ const { height, canScrollUp, canScrollDown } = useCardLayout(
+ listRef,
+ isShowingAll,
+ rowsKey,
+ );
+
+ // The first measurement necessarily lands one commit after mount, when the
+ // card is still at its natural full height. Tweening that commit would play
+ // a shrink-to-three-rows animation on every mount, so it snaps instead.
+ const hasPaintedRef = useRef(false);
+ useEffect(() => {
+ hasPaintedRef.current = true;
+ }, []);
+
+ function scrollByStep(direction: 1 | -1) {
+ const list = listRef.current;
+ if (!list) return;
+ // Two thirds of the window: the reader keeps a landmark on screen.
+ list.scrollBy({
+ top: direction * list.clientHeight * 0.66,
+ behavior: shouldReduceMotion ? "auto" : "smooth",
+ });
+ }
+
+ function toggleShowAll() {
+ // Collapsing keeps whatever scroll offset the reader left behind, so a
+ // list read to the middle would shrink around row 7 with no way back up
+ // — the three-row window has no scrollbar and no arrows. Jump to the top
+ // instantly: a smooth scroll would race the height animation.
+ if (isShowingAll) listRef.current?.scrollTo({ top: 0 });
+ setIsShowingAll(!isShowingAll);
+ }
+
+ const heightTransition =
+ shouldReduceMotion || !hasPaintedRef.current
+ ? { duration: 0 }
+ : { duration: 0.32, ease: [0.32, 0.72, 0, 1] as const };
+
+ return {
+ listRef,
+ height,
+ heightTransition,
+ isShowingAll,
+ toggleShowAll,
+ canScrollUp,
+ canScrollDown,
+ scrollByStep,
+ };
+}
diff --git a/autogpt_platform/frontend/src/components/organisms/BriefingCard/useCardLayout.ts b/autogpt_platform/frontend/src/components/organisms/BriefingCard/useCardLayout.ts
new file mode 100644
index 0000000000..cac0169d5c
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/organisms/BriefingCard/useCardLayout.ts
@@ -0,0 +1,56 @@
+"use client";
+
+import { useLayoutEffect, useState, type RefObject } from "react";
+import { getScrollEdges, measureListHeight } from "./helpers";
+
+// The card animates its real height rather than a `layout` transform: a
+// transform-based resize scales the rows' text while it runs and leaves the
+// rest of the page unaware that anything moved. Measuring gives framer a
+// number to tween, so the column below reflows in step.
+//
+// `rowsKey` identifies the rendered rows. The briefing query refetches on
+// focus and reconnect, and a refetch that swaps the run list would leave the
+// observer bound to detached rows — the card would keep the height it
+// measured for the old ones until the reader toggled it.
+export function useCardLayout(
+ listRef: RefObject<HTMLUListElement>,
+ isShowingAll: boolean,
+ rowsKey: string,
+) {
+ const [height, setHeight] = useState<number | null>(null);
+ const [canScrollUp, setCanScrollUp] = useState(false);
+ const [canScrollDown, setCanScrollDown] = useState(false);
+
+ // Layout effect, not effect: measuring after paint lets the browser show
+ // the card at full height for a frame before it collapses.
+ useLayoutEffect(() => {
+ const list = listRef.current;
+ if (!list) return;
+
+ function update() {
+ if (!list) return;
+ const measured = measureListHeight(list, isShowingAll);
+ if (measured === null) return;
+ setHeight(measured);
+
+ const edges = getScrollEdges(list);
+ setCanScrollUp(isShowingAll && edges.canScrollUp);
+ setCanScrollDown(isShowingAll && edges.canScrollDown);
+ }
+
+ update();
+ list.addEventListener("scroll", update, { passive: true });
+ // Avatars and wrapped summaries settle after the first paint, which
+ // changes the height the card should animate to.
+ const observer = new ResizeObserver(update);
+ observer.observe(list);
+ for (const row of Array.from(list.children)) observer.observe(row);
+
+ return () => {
+ list.removeEventListener("scroll", update);
+ observer.disconnect();
+ };
+ }, [listRef, isShowingAll, rowsKey]);
+
+ return { height, canScrollUp, canScrollDown };
+}
diff --git a/autogpt_platform/frontend/src/components/organisms/NeedsAttentionList/NeedsAttentionList.tsx b/autogpt_platform/frontend/src/components/organisms/NeedsAttentionList/NeedsAttentionList.tsx
index e818b162ea..35b4f420cb 100644
--- a/autogpt_platform/frontend/src/components/organisms/NeedsAttentionList/NeedsAttentionList.tsx
+++ b/autogpt_platform/frontend/src/components/organisms/NeedsAttentionList/NeedsAttentionList.tsx
@@ -1,13 +1,7 @@
-import Link from "next/link";
-import { useState } from "react";
-import type { PendingHumanReviewModel } from "@/app/api/__generated__/models/pendingHumanReviewModel";
-import { Button } from "@/components/atoms/Button/Button";
import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
import { Text } from "@/components/atoms/Text/Text";
import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
-import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
-import { getReviewLink } from "@/lib/review-links";
-import { getReviewTitle } from "./helpers";
+import { NeedsAttentionRow } from "./components/NeedsAttentionRow";
import { useNeedsAttentionList } from "./useNeedsAttentionList";
export function NeedsAttentionList() {
@@ -62,84 +56,3 @@ export function NeedsAttentionList() {
</section>
);
}
-
-interface RowProps {
- review: PendingHumanReviewModel;
- isProcessing: boolean;
- onApprove: (review: PendingHumanReviewModel) => void;
- onDecline: (review: PendingHumanReviewModel) => void;
-}
-
-function NeedsAttentionRow({
- review,
- isProcessing,
- onApprove,
- onDecline,
-}: RowProps) {
- // Decline rejects the agent's action outright, with no undo, in a flow
- // built for fast tapping — so it takes a second, deliberate tap.
- const [isConfirmingDecline, setIsConfirmingDecline] = useState(false);
- const title = getReviewTitle(review);
- const subtitle = [review.expert_name, review.agent_name]
- .filter(Boolean)
- .join(" · ");
-
- function handleDecline() {
- if (!isConfirmingDecline) {
- setIsConfirmingDecline(true);
- return;
- }
- setIsConfirmingDecline(false);
- onDecline(review);
- }
-
- return (
- <div className="flex items-center gap-3 rounded-xl border border-zinc-200 bg-white p-3">
- <ExpertAvatar
- name={review.expert_name ?? null}
- avatarUrl={review.expert_avatar_url ?? null}
- />
- <Link href={getReviewLink(review)} className="min-w-0 flex-1">
- <Text variant="body-medium" className="truncate">
- {title}
- </Text>
- {subtitle ? (
- <Text variant="small" className="truncate text-zinc-500">
- {subtitle}
- </Text>
- ) : null}
- </Link>
- <div className="flex shrink-0 items-center gap-2">
- <Button
- variant="primary"
- size="small"
- disabled={isProcessing}
- aria-label={`Approve: ${title}`}
- onClick={() => onApprove(review)}
- >
- Approve
- </Button>
- <Button
- // The armed state carries the destructive colour as well as the
- // label: in a fast-tapping flow a word swap alone is easy to miss,
- // and the next tap has no undo.
- variant={isConfirmingDecline ? "destructive" : "ghost"}
- size="small"
- disabled={isProcessing}
- aria-label={
- isConfirmingDecline
- ? `Confirm decline: ${title}`
- : `Decline: ${title}`
- }
- onClick={handleDecline}
- onBlur={() => setIsConfirmingDecline(false)}
- >
- {isConfirmingDecline ? "Confirm" : "Decline"}
- </Button>
- </div>
- <span aria-live="polite" className="sr-only">
- {isConfirmingDecline ? `Tap again to decline: ${title}` : ""}
- </span>
- </div>
- );
-}
diff --git a/autogpt_platform/frontend/src/components/organisms/NeedsAttentionList/components/NeedsAttentionRow.tsx b/autogpt_platform/frontend/src/components/organisms/NeedsAttentionList/components/NeedsAttentionRow.tsx
new file mode 100644
index 0000000000..a4fa14203a
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/organisms/NeedsAttentionList/components/NeedsAttentionRow.tsx
@@ -0,0 +1,89 @@
+import Link from "next/link";
+import { useState } from "react";
+import type { PendingHumanReviewModel } from "@/app/api/__generated__/models/pendingHumanReviewModel";
+import { Button } from "@/components/atoms/Button/Button";
+import { Text } from "@/components/atoms/Text/Text";
+import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
+import { getReviewLink } from "@/lib/review-links";
+import { getReviewTitle } from "../helpers";
+
+interface Props {
+ review: PendingHumanReviewModel;
+ isProcessing: boolean;
+ onApprove: (review: PendingHumanReviewModel) => void;
+ onDecline: (review: PendingHumanReviewModel) => void;
+}
+
+export function NeedsAttentionRow({
+ review,
+ isProcessing,
+ onApprove,
+ onDecline,
+}: Props) {
+ // Decline rejects the agent's action outright, with no undo, in a flow
+ // built for fast tapping — so it takes a second, deliberate tap.
+ const [isConfirmingDecline, setIsConfirmingDecline] = useState(false);
+ const title = getReviewTitle(review);
+ const subtitle = [review.expert_name, review.agent_name]
+ .filter(Boolean)
+ .join(" · ");
+
+ function handleDecline() {
+ if (!isConfirmingDecline) {
+ setIsConfirmingDecline(true);
+ return;
+ }
+ setIsConfirmingDecline(false);
+ onDecline(review);
+ }
+
+ return (
+ <div className="flex items-center gap-3 rounded-xl border border-zinc-200 bg-white p-3">
+ <ExpertAvatar
+ name={review.expert_name ?? null}
+ avatarUrl={review.expert_avatar_url ?? null}
+ />
+ <Link href={getReviewLink(review)} className="min-w-0 flex-1">
+ <Text variant="body-medium" className="truncate">
+ {title}
+ </Text>
+ {subtitle ? (
+ <Text variant="small" className="truncate text-zinc-500">
+ {subtitle}
+ </Text>
+ ) : null}
+ </Link>
+ <div className="flex shrink-0 items-center gap-2">
+ <Button
+ variant="primary"
+ size="small"
+ disabled={isProcessing}
+ aria-label={`Approve: ${title}`}
+ onClick={() => onApprove(review)}
+ >
+ Approve
+ </Button>
+ <Button
+ // The armed state carries the destructive colour as well as the
+ // label: in a fast-tapping flow a word swap alone is easy to miss,
+ // and the next tap has no undo.
+ variant={isConfirmingDecline ? "destructive" : "ghost"}
+ size="small"
+ disabled={isProcessing}
+ aria-label={
+ isConfirmingDecline
+ ? `Confirm decline: ${title}`
+ : `Decline: ${title}`
+ }
+ onClick={handleDecline}
+ onBlur={() => setIsConfirmingDecline(false)}
+ >
+ {isConfirmingDecline ? "Confirm" : "Decline"}
+ </Button>
+ </div>
+ <span aria-live="polite" className="sr-only">
+ {isConfirmingDecline ? `Tap again to decline: ${title}` : ""}
+ </span>
+ </div>
+ );
+}