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.

feat(frontend): add Artifacts page behind ARTIFACTS_PAGE flag (#13230)

Abhimanyu Yadava87302105586
diff --git a/autogpt_platform/backend/backend/api/features/workspace/routes.py b/autogpt_platform/backend/backend/api/features/workspace/routes.py
index 8065a7f752..e172c167cd 100644
--- a/autogpt_platform/backend/backend/api/features/workspace/routes.py
+++ b/autogpt_platform/backend/backend/api/features/workspace/routes.py
@@ -6,7 +6,7 @@ import asyncio
import logging
import os
import re
-from typing import Annotated
+from typing import Annotated, Literal
from urllib.parse import quote
import fastapi
@@ -339,6 +339,23 @@ async def list_workspace_files(
session_id: str | None = Query(default=None),
limit: int = Query(default=200, ge=1, le=1000),
offset: int = Query(default=0, ge=0),
+ q: str | None = Query(
+ default=None,
+ description=(
+ "Case-insensitive substring search on file name. Applied "
+ "in the database for fresh results without waiting on "
+ "embedding generation."
+ ),
+ ),
+ origin: Literal["builder", "autopilot"] | None = Query(
+ default=None,
+ description=(
+ "Filter by upload origin. ``autopilot`` matches files stored "
+ "under ``/sessions/...`` (CoPilot chat uploads); ``builder`` "
+ "matches everything else. Ignored when ``session_id`` is set "
+ "(session scoping already implies origin)."
+ ),
+ ),
) -> ListFilesResponse:
"""
List files in the user's workspace.
@@ -346,6 +363,9 @@ async def list_workspace_files(
When session_id is provided, only files for that session are returned.
Otherwise, all files across sessions are listed. Results are paginated
via `limit`/`offset`; `has_more` indicates whether additional pages exist.
+
+ The Artifacts page uses ``q`` for name search and ``origin`` to filter
+ between Builder (root-level) and Autopilot (session-scoped) uploads.
"""
workspace = await get_or_create_workspace(user_id)
@@ -356,11 +376,27 @@ async def list_workspace_files(
manager = WorkspaceManager(user_id, workspace.id, session_id)
include_all = session_id is None
+
+ # Origin → path filter. Only applied when not session-scoped, since
+ # session_id already pins the origin.
+ list_path: str | None = None
+ path_not_starts_with: str | None = None
+ if session_id is None and origin is not None:
+ if origin == "autopilot":
+ list_path = "/sessions/"
+ else: # "builder"
+ path_not_starts_with = "/sessions/"
+
+ name_contains = (q or "").strip() or None
+
# Fetch one extra to compute has_more without a separate count query.
files = await manager.list_files(
+ path=list_path,
limit=limit + 1,
offset=offset,
include_all_sessions=include_all,
+ name_contains=name_contains,
+ path_not_starts_with=path_not_starts_with,
)
has_more = len(files) > limit
page = files[:limit]
diff --git a/autogpt_platform/backend/backend/api/features/workspace/routes_test.py b/autogpt_platform/backend/backend/api/features/workspace/routes_test.py
index b5bcbdef8b..c0937a45d2 100644
--- a/autogpt_platform/backend/backend/api/features/workspace/routes_test.py
+++ b/autogpt_platform/backend/backend/api/features/workspace/routes_test.py
@@ -106,7 +106,12 @@ def test_list_files_returns_all_when_no_session(mock_manager_cls, mock_get_works
assert data["files"][0]["metadata"] == {"origin": "user-upload"}
assert data["files"][1]["id"] == "f2"
mock_instance.list_files.assert_called_once_with(
- limit=201, offset=0, include_all_sessions=True
+ path=None,
+ limit=201,
+ offset=0,
+ include_all_sessions=True,
+ name_contains=None,
+ path_not_starts_with=None,
)
@@ -128,7 +133,12 @@ def test_list_files_scopes_to_session_when_provided(
assert data["has_more"] is False
mock_manager_cls.assert_called_once_with(test_user_id, "ws-001", "sess-123")
mock_instance.list_files.assert_called_once_with(
- limit=201, offset=0, include_all_sessions=False
+ path=None,
+ limit=201,
+ offset=0,
+ include_all_sessions=False,
+ name_contains=None,
+ path_not_starts_with=None,
)
@@ -544,7 +554,12 @@ def test_list_files_has_more_true_when_limit_exceeded(
assert data["files"][0]["id"] == "f1"
assert data["files"][1]["id"] == "f2"
mock_instance.list_files.assert_called_once_with(
- limit=3, offset=0, include_all_sessions=True
+ path=None,
+ limit=3,
+ offset=0,
+ include_all_sessions=True,
+ name_contains=None,
+ path_not_starts_with=None,
)
@@ -579,10 +594,178 @@ def test_list_files_offset_is_echoed_back(mock_manager_cls, mock_get_workspace):
assert response.status_code == 200
assert response.json()["offset"] == 50
mock_instance.list_files.assert_called_once_with(
- limit=11, offset=50, include_all_sessions=True
+ path=None,
+ limit=11,
+ offset=50,
+ include_all_sessions=True,
+ name_contains=None,
+ path_not_starts_with=None,
)
+@patch("backend.api.features.workspace.routes.get_or_create_workspace")
+@patch("backend.api.features.workspace.routes.WorkspaceManager")
+def test_list_files_origin_autopilot_scopes_to_sessions_path(
+ mock_manager_cls, mock_get_workspace
+):
+ """origin=autopilot maps to path='/sessions/' on the manager call."""
+ mock_get_workspace.return_value = _make_workspace()
+ mock_instance = AsyncMock()
+ mock_instance.list_files.return_value = []
+ mock_manager_cls.return_value = mock_instance
+
+ response = client.get("/files?origin=autopilot")
+ assert response.status_code == 200
+ mock_instance.list_files.assert_called_once_with(
+ path="/sessions/",
+ limit=201,
+ offset=0,
+ include_all_sessions=True,
+ name_contains=None,
+ path_not_starts_with=None,
+ )
+
+
+@patch("backend.api.features.workspace.routes.get_or_create_workspace")
+@patch("backend.api.features.workspace.routes.WorkspaceManager")
+def test_list_files_origin_builder_excludes_sessions_path(
+ mock_manager_cls, mock_get_workspace
+):
+ """origin=builder maps to path_not_starts_with='/sessions/'."""
+ mock_get_workspace.return_value = _make_workspace()
+ mock_instance = AsyncMock()
+ mock_instance.list_files.return_value = []
+ mock_manager_cls.return_value = mock_instance
+
+ response = client.get("/files?origin=builder")
+ assert response.status_code == 200
+ mock_instance.list_files.assert_called_once_with(
+ path=None,
+ limit=201,
+ offset=0,
+ include_all_sessions=True,
+ name_contains=None,
+ path_not_starts_with="/sessions/",
+ )
+
+
+@patch("backend.api.features.workspace.routes.get_or_create_workspace")
+@patch("backend.api.features.workspace.routes.WorkspaceManager")
+def test_list_files_origin_ignored_when_session_id_set(
+ mock_manager_cls, mock_get_workspace
+):
+ """origin is dropped when session_id is provided (session implies origin)."""
+ mock_get_workspace.return_value = _make_workspace()
+ mock_instance = AsyncMock()
+ mock_instance.list_files.return_value = []
+ mock_manager_cls.return_value = mock_instance
+
+ response = client.get("/files?origin=builder&session_id=sess-123")
+ assert response.status_code == 200
+ mock_instance.list_files.assert_called_once_with(
+ path=None,
+ limit=201,
+ offset=0,
+ include_all_sessions=False,
+ name_contains=None,
+ path_not_starts_with=None,
+ )
+
+
+@patch("backend.api.features.workspace.routes.get_or_create_workspace")
+@patch("backend.api.features.workspace.routes.WorkspaceManager")
+def test_list_files_q_search_passed_through(mock_manager_cls, mock_get_workspace):
+ """q forwards to name_contains after stripping."""
+ mock_get_workspace.return_value = _make_workspace()
+ mock_instance = AsyncMock()
+ mock_instance.list_files.return_value = []
+ mock_manager_cls.return_value = mock_instance
+
+ response = client.get("/files?q=report")
+ assert response.status_code == 200
+ mock_instance.list_files.assert_called_once_with(
+ path=None,
+ limit=201,
+ offset=0,
+ include_all_sessions=True,
+ name_contains="report",
+ path_not_starts_with=None,
+ )
+
+
+@patch("backend.api.features.workspace.routes.get_or_create_workspace")
+@patch("backend.api.features.workspace.routes.WorkspaceManager")
+def test_list_files_blank_q_becomes_none(mock_manager_cls, mock_get_workspace):
+ """Whitespace-only q is normalized to None instead of an empty filter."""
+ mock_get_workspace.return_value = _make_workspace()
+ mock_instance = AsyncMock()
+ mock_instance.list_files.return_value = []
+ mock_manager_cls.return_value = mock_instance
+
+ response = client.get("/files?q=%20%20%20")
+ assert response.status_code == 200
+ mock_instance.list_files.assert_called_once_with(
+ path=None,
+ limit=201,
+ offset=0,
+ include_all_sessions=True,
+ name_contains=None,
+ path_not_starts_with=None,
+ )
+
+
+@patch("backend.api.features.workspace.routes.get_or_create_workspace")
+@patch("backend.api.features.workspace.routes.WorkspaceManager")
+def test_list_files_q_and_origin_combine(mock_manager_cls, mock_get_workspace):
+ """q and origin compose into one filter on the manager call."""
+ mock_get_workspace.return_value = _make_workspace()
+ mock_instance = AsyncMock()
+ mock_instance.list_files.return_value = []
+ mock_manager_cls.return_value = mock_instance
+
+ response = client.get("/files?q=report&origin=autopilot")
+ assert response.status_code == 200
+ mock_instance.list_files.assert_called_once_with(
+ path="/sessions/",
+ limit=201,
+ offset=0,
+ include_all_sessions=True,
+ name_contains="report",
+ path_not_starts_with=None,
+ )
+
+
+@patch("backend.api.features.workspace.routes.get_or_create_workspace")
+@patch("backend.api.features.workspace.routes.WorkspaceManager")
+def test_list_files_empty_session_id_treated_as_omitted(
+ mock_manager_cls, mock_get_workspace, test_user_id
+):
+ """Empty session_id must not silently list files across every session."""
+ mock_get_workspace.return_value = _make_workspace(user_id=test_user_id)
+ mock_instance = AsyncMock()
+ mock_instance.list_files.return_value = []
+ mock_manager_cls.return_value = mock_instance
+
+ response = client.get("/files?session_id=")
+ assert response.status_code == 200
+ # Manager should be constructed with session_id=None, not ""
+ mock_manager_cls.assert_called_once_with(test_user_id, "ws-001", None)
+ mock_instance.list_files.assert_called_once_with(
+ path=None,
+ limit=201,
+ offset=0,
+ include_all_sessions=True,
+ name_contains=None,
+ path_not_starts_with=None,
+ )
+
+
+def test_list_files_rejects_invalid_origin():
+ """FastAPI Literal validation rejects unknown origin values."""
+ response = client.get("/files?origin=nonsense")
+ assert response.status_code == 422
+
+
def test_upload_virus_scan_infrastructure_error_returns_500(mocker):
"""VirusScanError (ClamAV outage) should return 500, not 409."""
from backend.api.features.store.exceptions import VirusScanError
diff --git a/autogpt_platform/backend/backend/data/workspace.py b/autogpt_platform/backend/backend/data/workspace.py
index 19384fde83..11a3014ea4 100644
--- a/autogpt_platform/backend/backend/data/workspace.py
+++ b/autogpt_platform/backend/backend/data/workspace.py
@@ -251,6 +251,7 @@ async def get_workspace_file_by_path(
async def list_workspace_files(
workspace_id: str,
path_prefix: Optional[str] = None,
+ path_not_starts_with: Optional[str] = None,
include_deleted: bool = False,
limit: Optional[int] = None,
offset: int = 0,
@@ -262,6 +263,9 @@ async def list_workspace_files(
Args:
workspace_id: The workspace ID
path_prefix: Optional path prefix to filter (e.g., "/documents/")
+ path_not_starts_with: Optional path prefix to *exclude* — used by
+ the Artifacts page to filter out session-scoped (autopilot)
+ uploads when the user picks the "Builder" origin filter.
include_deleted: Whether to include soft-deleted files
limit: Maximum number of files to return
offset: Number of files to skip
@@ -283,6 +287,11 @@ async def list_workspace_files(
path_prefix = f"/{path_prefix}"
where_clause["path"] = {"startswith": path_prefix}
+ if path_not_starts_with:
+ if not path_not_starts_with.startswith("/"):
+ path_not_starts_with = f"/{path_not_starts_with}"
+ where_clause["NOT"] = [{"path": {"startswith": path_not_starts_with}}]
+
if name_contains:
where_clause["name"] = {"contains": name_contains, "mode": "insensitive"}
diff --git a/autogpt_platform/backend/backend/util/workspace.py b/autogpt_platform/backend/backend/util/workspace.py
index 61d6e47e22..bdec9cdd3c 100644
--- a/autogpt_platform/backend/backend/util/workspace.py
+++ b/autogpt_platform/backend/backend/util/workspace.py
@@ -350,6 +350,7 @@ class WorkspaceManager:
offset: int = 0,
include_all_sessions: bool = False,
name_contains: Optional[str] = None,
+ path_not_starts_with: Optional[str] = None,
) -> list[WorkspaceFile]:
"""
List files in workspace.
@@ -363,6 +364,10 @@ class WorkspaceManager:
offset: Number of files to skip
include_all_sessions: If True, list files from all sessions.
If False (default), only list current session's files.
+ name_contains: Case-insensitive substring filter on the file name.
+ path_not_starts_with: Path prefix to exclude from results.
+ Used by the Artifacts page to surface only Builder-origin
+ files (i.e. those not under ``/sessions/``).
Returns:
List of WorkspaceFile instances
@@ -373,6 +378,7 @@ class WorkspaceManager:
return await db.list_workspace_files(
workspace_id=self.workspace_id,
path_prefix=effective_path,
+ path_not_starts_with=path_not_starts_with,
limit=limit,
offset=offset,
name_contains=name_contains,
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/main.test.tsx
new file mode 100644
index 0000000000..8e71cd630a
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/main.test.tsx
@@ -0,0 +1,233 @@
+import { describe, expect, test, vi } from "vitest";
+
+import { fireEvent, render, screen } from "@/tests/integrations/test-utils";
+import { server } from "@/mocks/mock-server";
+import {
+ getGetWorkspaceStorageUsageMockHandler,
+ getListWorkspaceFilesMockHandler,
+ getListWorkspaceFilesMockHandler401,
+} from "@/app/api/__generated__/endpoints/workspace/workspace.msw";
+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";
+
+const { setFlagStatusMock } = vi.hoisted(() => {
+ return {
+ setFlagStatusMock: vi.fn(() => ({ enabled: true, ready: true })),
+ };
+});
+
+vi.mock("@/services/feature-flags/use-get-flag", () => ({
+ Flag: { ARTIFACTS_PAGE: "artifacts-page" },
+ useGetFlag: () => true,
+ useFlagStatus: () => setFlagStatusMock(),
+}));
+
+const notFoundMock = vi.hoisted(() => vi.fn());
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({
+ push: vi.fn(),
+ replace: vi.fn(),
+ prefetch: vi.fn(),
+ back: vi.fn(),
+ forward: vi.fn(),
+ refresh: vi.fn(),
+ }),
+ usePathname: () => "/artifacts",
+ useSearchParams: () => new URLSearchParams(),
+ useParams: () => ({}),
+ notFound: () => {
+ notFoundMock();
+ throw new Error("NEXT_NOT_FOUND");
+ },
+}));
+
+vi.mock("framer-motion", async (importActual) => {
+ const actual = await importActual<typeof import("framer-motion")>();
+ return {
+ ...actual,
+ useReducedMotion: () => true,
+ };
+});
+
+import ArtifactsPage from "../page";
+
+function makeFile(
+ overrides: Partial<WorkspaceFileItem> = {},
+): WorkspaceFileItem {
+ return {
+ id: "file-base",
+ name: "base.txt",
+ path: "/base.txt",
+ mime_type: "text/plain",
+ size_bytes: 1024,
+ metadata: {},
+ created_at: "2026-05-01T00:00:00Z",
+ ...overrides,
+ };
+}
+
+function useStorageHandler(usedBytes = 0, limitBytes = 1_000_000_000) {
+ server.use(
+ getGetWorkspaceStorageUsageMockHandler({
+ used_bytes: usedBytes,
+ limit_bytes: limitBytes,
+ used_percent: limitBytes
+ ? Math.round((usedBytes / limitBytes) * 1000) / 10
+ : 0,
+ file_count: 0,
+ }),
+ );
+}
+
+describe("ArtifactsPage - basic rendering", () => {
+ test("renders the page header", async () => {
+ useStorageHandler();
+ server.use(
+ getListWorkspaceFilesMockHandler({
+ files: [],
+ offset: 0,
+ has_more: false,
+ }),
+ );
+
+ render(<ArtifactsPage />);
+
+ expect(
+ await screen.findByRole("heading", { name: /artifacts/i }),
+ ).toBeDefined();
+ });
+
+ test("shows the empty state when the workspace has no files", async () => {
+ useStorageHandler();
+ server.use(
+ getListWorkspaceFilesMockHandler({
+ files: [],
+ offset: 0,
+ has_more: false,
+ }),
+ );
+
+ render(<ArtifactsPage />);
+
+ expect(await screen.findByTestId("artifacts-empty")).toBeDefined();
+ expect(screen.getByText(/no artifacts yet/i)).toBeDefined();
+ });
+
+ test("renders one card per file with name + type label", async () => {
+ useStorageHandler();
+ server.use(
+ getListWorkspaceFilesMockHandler({
+ files: [
+ makeFile({
+ id: "f1",
+ name: "report.pdf",
+ mime_type: "application/pdf",
+ }),
+ makeFile({ id: "f2", name: "data.csv", mime_type: "text/csv" }),
+ ],
+ offset: 0,
+ has_more: false,
+ }),
+ );
+
+ render(<ArtifactsPage />);
+
+ expect(await screen.findByText("report.pdf")).toBeDefined();
+ expect(screen.getByText("data.csv")).toBeDefined();
+ expect(screen.getAllByTestId("artifacts-list-item").length).toBe(2);
+ });
+
+ test("renders the error card when the API fails", async () => {
+ useStorageHandler();
+ server.use(getListWorkspaceFilesMockHandler401());
+
+ render(<ArtifactsPage />);
+
+ expect(await screen.findByText(/something went wrong/i)).toBeDefined();
+ });
+});
+
+describe("ArtifactsPage - search filter", () => {
+ test("typing in the search bar narrows the visible cards", async () => {
+ useStorageHandler();
+ server.use(
+ getListWorkspaceFilesMockHandler({
+ files: [
+ makeFile({ id: "f1", name: "alpha.txt" }),
+ makeFile({ id: "f2", name: "beta.txt" }),
+ ],
+ offset: 0,
+ has_more: false,
+ }),
+ );
+
+ render(<ArtifactsPage />);
+
+ expect(await screen.findByText("alpha.txt")).toBeDefined();
+ expect(screen.getByText("beta.txt")).toBeDefined();
+
+ const search = screen.getByPlaceholderText(/search/i);
+
+ // Second handler returns only beta — the debounce + refetch should show it.
+ server.use(
+ getListWorkspaceFilesMockHandler({
+ files: [makeFile({ id: "f2", name: "beta.txt" })],
+ offset: 0,
+ has_more: false,
+ }),
+ );
+
+ fireEvent.change(search, { target: { value: "beta" } });
+
+ // Wait for the filtered list to appear (debounced ~250ms).
+ expect(await screen.findByText("beta.txt")).toBeDefined();
+ });
+});
+
+describe("ArtifactsPage - feature flag gating", () => {
+ test("shows the flag-loading skeleton while LaunchDarkly is resolving", async () => {
+ setFlagStatusMock.mockReturnValueOnce({ enabled: false, ready: false });
+
+ render(<ArtifactsPage />);
+
+ expect(await screen.findByTestId("artifacts-flag-loading")).toBeDefined();
+ expect(notFoundMock).not.toHaveBeenCalled();
+ });
+
+ test("calls notFound() when the flag is resolved and disabled", () => {
+ setFlagStatusMock.mockReturnValueOnce({ enabled: false, ready: true });
+ notFoundMock.mockClear();
+
+ try {
+ render(<ArtifactsPage />);
+ } catch {
+ // React surfaces the thrown notFound() error; the assertion below is
+ // what we actually care about.
+ }
+
+ expect(notFoundMock).toHaveBeenCalled();
+ });
+});
+
+describe("ArtifactsPage - card menu", () => {
+ test("renders the card actions menu trigger and origin link", async () => {
+ useStorageHandler();
+ server.use(
+ getListWorkspaceFilesMockHandler({
+ files: [
+ makeFile({
+ id: "with-menu",
+ name: "menu-target.txt",
+ path: "/sessions/sess-xyz/menu-target.txt",
+ }),
+ ],
+ offset: 0,
+ has_more: false,
+ }),
+ );
+
+ render(<ArtifactsPage />);
+
+ expect(await screen.findByText("menu-target.txt")).toBeDefined();
+ expect(screen.getByTestId("artifacts-card-menu")).toBeDefined();
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactCard/ArtifactCard.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactCard/ArtifactCard.tsx
new file mode 100644
index 0000000000..3acd6e48bb
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactCard/ArtifactCard.tsx
@@ -0,0 +1,218 @@
+"use client";
+
+import { useDeleteWorkspaceFile } from "@/app/api/__generated__/endpoints/workspace/workspace";
+import { ARTIFACTS_LIST_QUERY_KEY } from "../../../useArtifactsPage";
+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";
+import { Text } from "@/components/atoms/Text/Text";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/molecules/DropdownMenu/DropdownMenu";
+import { useToast } from "@/components/molecules/Toast/use-toast";
+import {
+ ArrowSquareOutIcon,
+ CircleNotchIcon,
+ DotsThreeIcon,
+ DownloadSimpleIcon,
+ TrashIcon,
+} from "@phosphor-icons/react";
+import { useQueryClient } from "@tanstack/react-query";
+import { motion, useReducedMotion } from "framer-motion";
+import type { Variants } from "framer-motion";
+import Link from "next/link";
+import { useState } from "react";
+import {
+ deriveFileOrigin,
+ formatFileSize,
+ formatRelativeDate,
+ getFileDownloadUrl,
+ getFileTypeIcon,
+ getFileTypeLabel,
+} from "../helpers";
+import { CardPreview } from "./CardPreview";
+
+interface Props {
+ file: WorkspaceFileItem;
+}
+
+const CARD_VARIANTS: Variants = {
+ hidden: { opacity: 0, y: 8, scale: 0.98, filter: "blur(8px)" },
+ show: {
+ opacity: 1,
+ y: 0,
+ scale: 1,
+ filter: "blur(0px)",
+ transition: { duration: 0.4, ease: [0.16, 1, 0.3, 1] },
+ },
+};
+
+const REDUCED_CARD_VARIANTS: Variants = {
+ hidden: { opacity: 0 },
+ show: { opacity: 1, transition: { duration: 0.2 } },
+};
+
+export function ArtifactCard({ file }: Props) {
+ const origin = deriveFileOrigin(file.path);
+ const goLabel = origin.kind === "session" ? "Open chat" : "Open in Builder";
+ const TypeIcon = getFileTypeIcon(file.mime_type);
+ const reduceMotion = useReducedMotion();
+
+ return (
+ <motion.li
+ variants={reduceMotion ? REDUCED_CARD_VARIANTS : CARD_VARIANTS}
+ style={{ willChange: "transform, opacity, filter" }}
+ className="group flex flex-col overflow-hidden rounded-2xl border border-zinc-200 bg-white transition-colors hover:border-zinc-300"
+ data-testid="artifacts-list-item"
+ >
+ <CardPreview file={file} />
+ <div className="flex items-center gap-3 p-3">
+ <TypeIcon
+ size={20}
+ weight="regular"
+ className="shrink-0 text-zinc-500"
+ />
+ <div className="flex min-w-0 flex-1 flex-col">
+ <Text
+ variant="body-medium"
+ className="truncate text-zinc-900"
+ title={file.name}
+ >
+ {file.name}
+ </Text>
+ <Text variant="small" className="truncate text-zinc-500">
+ {getFileTypeLabel(file.mime_type)} ·{" "}
+ {formatFileSize(file.size_bytes)} ·{" "}
+ {formatRelativeDate(file.created_at)}
+ </Text>
+ </div>
+ <CardMenu file={file} goLabel={goLabel} goHref={origin.href} />
+ </div>
+ </motion.li>
+ );
+}
+
+function CardMenu({
+ file,
+ goLabel,
+ goHref,
+}: {
+ file: WorkspaceFileItem;
+ goLabel: string;
+ goHref: string;
+}) {
+ const [isDownloading, setIsDownloading] = useState(false);
+ const { toast } = useToast();
+ const queryClient = useQueryClient();
+ const { mutateAsync: deleteFile, isPending: isDeleting } =
+ useDeleteWorkspaceFile({
+ mutation: {
+ onSuccess: () => {
+ queryClient.invalidateQueries({
+ queryKey: ARTIFACTS_LIST_QUERY_KEY,
+ });
+ toast({ title: "File deleted" });
+ },
+ onError: (error) => {
+ toast({
+ title: "Failed to delete file",
+ description:
+ error instanceof Error ? error.message : "Please try again.",
+ variant: "destructive",
+ });
+ },
+ },
+ });
+
+ async function handleDownload() {
+ if (isDownloading) return;
+ setIsDownloading(true);
+ try {
+ const res = await fetch(getFileDownloadUrl(file.id));
+ if (!res.ok) throw new Error(`Download failed: ${res.status}`);
+ const blob = await res.blob();
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement("a");
+ a.href = url;
+ a.download = file.name;
+ document.body.appendChild(a);
+ a.click();
+ a.remove();
+ // Defer revocation so browsers (Firefox/Edge) have time to start the download.
+ setTimeout(() => URL.revokeObjectURL(url), 0);
+ } catch (error) {
+ toast({
+ title: "Failed to download file",
+ description:
+ error instanceof Error ? error.message : "Please try again.",
+ variant: "destructive",
+ });
+ } finally {
+ setIsDownloading(false);
+ }
+ }
+
+ async function handleDelete() {
+ if (isDeleting) return;
+ const confirmed = window.confirm(`Delete "${file.name}"?`);
+ if (!confirmed) return;
+ await deleteFile({ fileId: file.id });
+ }
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <button
+ type="button"
+ aria-label={`Actions for ${file.name}`}
+ className="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-900"
+ data-testid="artifacts-card-menu"
+ >
+ <DotsThreeIcon size={20} weight="bold" />
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-44">
+ <DropdownMenuItem
+ onSelect={(e) => {
+ e.preventDefault();
+ handleDownload();
+ }}
+ disabled={isDownloading}
+ data-testid="artifacts-download"
+ >
+ {isDownloading ? (
+ <CircleNotchIcon size={16} className="mr-2 animate-spin" />
+ ) : (
+ <DownloadSimpleIcon size={16} className="mr-2" />
+ )}
+ {isDownloading ? "Downloading…" : "Download"}
+ </DropdownMenuItem>
+ <DropdownMenuItem asChild>
+ <Link href={goHref} data-testid="artifacts-origin-link">
+ <ArrowSquareOutIcon size={16} className="mr-2" />
+ {goLabel}
+ </Link>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ onSelect={(e) => {
+ e.preventDefault();
+ handleDelete();
+ }}
+ disabled={isDeleting}
+ className="text-red-600 focus:bg-red-50 focus:text-red-700"
+ data-testid="artifacts-delete"
+ >
+ {isDeleting ? (
+ <CircleNotchIcon size={16} className="mr-2 animate-spin" />
+ ) : (
+ <TrashIcon size={16} className="mr-2" />
+ )}
+ {isDeleting ? "Deleting…" : "Delete"}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactCard/CardPreview.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactCard/CardPreview.tsx
new file mode 100644
index 0000000000..763e02d7ff
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactCard/CardPreview.tsx
@@ -0,0 +1,184 @@
+"use client";
+
+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";
+import { cn } from "@/lib/utils";
+import { useCallback, useEffect, useState } from "react";
+import {
+ deriveBadgeLabel,
+ FileIllustration,
+ pickFileTypeKey,
+} from "../FileIllustration";
+import {
+ getFileDownloadUrl,
+ getPreviewKind,
+ type PreviewKind,
+} from "../helpers";
+
+interface Props {
+ file: WorkspaceFileItem;
+}
+
+export function CardPreview({ file }: Props) {
+ const kind = getPreviewKind(file.mime_type, file.size_bytes);
+
+ return (
+ <div className="relative aspect-[16/10] overflow-hidden border-b border-zinc-200 bg-zinc-100">
+ <div className="absolute inset-x-6 bottom-0 top-6 origin-bottom overflow-hidden rounded-t-2xl bg-white shadow-md shadow-black/[0.08] ring-1 ring-black/5 transition-transform duration-300 ease-out group-hover:scale-[1.04] motion-reduce:transition-none motion-reduce:group-hover:scale-100">
+ <PreviewBody file={file} kind={kind} />
+ </div>
+ </div>
+ );
+}
+
+function PreviewBody({
+ file,
+ kind,
+}: {
+ file: WorkspaceFileItem;
+ kind: PreviewKind;
+}) {
+ const [hasError, setHasError] = useState(false);
+ const handleError = useCallback(() => setHasError(true), []);
+
+ if (hasError || kind === "none") {
+ return <Fallback file={file} />;
+ }
+
+ if (kind === "image") {
+ return <ImagePreview file={file} onError={handleError} />;
+ }
+
+ if (kind === "video") {
+ return <VideoPreview file={file} onError={handleError} />;
+ }
+
+ return <TextSnippetPreview file={file} onError={handleError} />;
+}
+
+function ImagePreview({
+ file,
+ onError,
+}: {
+ file: WorkspaceFileItem;
+ onError: () => void;
+}) {
+ const [isLoaded, setIsLoaded] = useState(false);
+
+ return (
+ <>
+ {!isLoaded ? <LoadingPlaceholder file={file} /> : null}
+ {/* eslint-disable-next-line @next/next/no-img-element */}
+ <img
+ src={getFileDownloadUrl(file.id)}
+ alt={file.name}
+ loading="lazy"
+ onLoad={() => setIsLoaded(true)}
+ onError={onError}
+ className={cn(
+ "h-full w-full object-cover transition-opacity duration-300",
+ isLoaded ? "opacity-100" : "opacity-0",
+ )}
+ />
+ </>
+ );
+}
+
+function VideoPreview({
+ file,
+ onError,
+}: {
+ file: WorkspaceFileItem;
+ onError: () => void;
+}) {
+ const [isLoaded, setIsLoaded] = useState(false);
+
+ return (
+ <>
+ {!isLoaded ? <LoadingPlaceholder file={file} /> : null}
+ <video
+ src={getFileDownloadUrl(file.id)}
+ preload="metadata"
+ muted
+ playsInline
+ onLoadedData={() => setIsLoaded(true)}
+ onError={onError}
+ className={cn(
+ "h-full w-full object-cover transition-opacity duration-300",
+ isLoaded ? "opacity-100" : "opacity-0",
+ )}
+ />
+ </>
+ );
+}
+
+function Fallback({ file }: { file: WorkspaceFileItem }) {
+ return (
+ <div className="flex h-full w-full items-center justify-center">
+ <FileIllustration
+ typeKey={pickFileTypeKey(file.mime_type)}
+ label={deriveBadgeLabel(file.name, file.mime_type)}
+ size="md"
+ />
+ </div>
+ );
+}
+
+function LoadingPlaceholder({ file }: { file: WorkspaceFileItem }) {
+ return (
+ <div className="absolute inset-0">
+ <Fallback file={file} />
+ <ProgressBar />
+ </div>
+ );
+}
+
+function ProgressBar() {
+ return (
+ <div
+ className="absolute inset-x-0 top-0 h-0.5 overflow-hidden bg-zinc-200/70"
+ aria-hidden
+ >
+ <div className="h-full w-1/3 animate-progress-bar rounded-full bg-zinc-500" />
+ </div>
+ );
+}
+
+const TEXT_SNIPPET_CHARS = 1500;
+
+function TextSnippetPreview({
+ file,
+ onError,
+}: {
+ file: WorkspaceFileItem;
+ onError: () => void;
+}) {
+ const [text, setText] = useState<string | null>(null);
+
+ useEffect(() => {
+ let cancelled = false;
+ async function load() {
+ try {
+ const res = await fetch(getFileDownloadUrl(file.id));
+ if (!res.ok) throw new Error(`Status ${res.status}`);
+ const body = await res.text();
+ if (!cancelled) setText(body.slice(0, TEXT_SNIPPET_CHARS));
+ } catch {
+ if (!cancelled) onError();
+ }
+ }
+ load();
+ return () => {
+ cancelled = true;
+ };
+ }, [file.id, onError]);
+
+ if (text === null) {
+ return <LoadingPlaceholder file={file} />;
+ }
+
+ return (
+ <pre className="h-full w-full overflow-hidden whitespace-pre-wrap break-words bg-white p-3 font-mono text-[10px] leading-[1.35] text-zinc-700">
+ {text}
+ </pre>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsList.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsList.tsx
new file mode 100644
index 0000000000..17dd6408f1
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsList.tsx
@@ -0,0 +1,104 @@
+"use client";
+
+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";
+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
+import { Text } from "@/components/atoms/Text/Text";
+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
+import { motion, useReducedMotion } from "framer-motion";
+import type { Variants } from "framer-motion";
+import { ArtifactCard } from "./ArtifactCard/ArtifactCard";
+import { FileTypeMarquee } from "./FileTypeMarquee";
+import { LoadMoreSentinel } from "./LoadMoreSentinel";
+
+interface Props {
+ files: WorkspaceFileItem[];
+ isLoading: boolean;
+ isError: boolean;
+ error: unknown;
+ hasSearchTerm: boolean;
+ hasMore: boolean;
+ isLoadingMore: boolean;
+ onLoadMore: () => void;
+ listKey: string;
+}
+
+const GRID_VARIANTS: Variants = {
+ hidden: {},
+ show: {
+ transition: { staggerChildren: 0.04, delayChildren: 0.05 },
+ },
+};
+
+export function ArtifactsList({
+ files,
+ isLoading,
+ isError,
+ error,
+ hasSearchTerm,
+ hasMore,
+ isLoadingMore,
+ onLoadMore,
+ listKey,
+}: Props) {
+ const reduceMotion = useReducedMotion();
+
+ if (isLoading) {
+ return (
+ <div
+ className="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-4"
+ data-testid="artifacts-loading"
+ >
+ {Array.from({ length: 6 }).map((_, i) => (
+ <Skeleton key={i} className="h-64 w-full rounded-2xl" />
+ ))}
+ </div>
+ );
+ }
+
+ if (isError) {
+ return (
+ <ErrorCard
+ context="artifacts"
+ responseError={
+ error instanceof Error ? { message: error.message } : undefined
+ }
+ />
+ );
+ }
+
+ if (files.length === 0) {
+ return (
+ <div
+ className="flex min-h-[20rem] flex-col items-center justify-center gap-4 p-8 text-center"
+ data-testid="artifacts-empty"
+ >
+ <FileTypeMarquee />
+ <Text variant="h5" className="text-zinc-700">
+ {hasSearchTerm ? "No files match your search" : "No artifacts yet"}
+ </Text>
+ </div>
+ );
+ }
+
+ return (
+ <>
+ <motion.ul
+ key={listKey}
+ className="grid grid-cols-1 gap-4 pt-4 sm:grid-cols-2 md:grid-cols-4"
+ data-testid="artifacts-list"
+ variants={reduceMotion ? undefined : GRID_VARIANTS}
+ initial={reduceMotion ? false : "hidden"}
+ animate={reduceMotion ? undefined : "show"}
+ >
+ {files.map((file) => (
+ <ArtifactCard key={file.id} file={file} />
+ ))}
+ </motion.ul>
+ <LoadMoreSentinel
+ hasMore={hasMore}
+ isLoading={isLoadingMore}
+ onLoadMore={onLoadMore}
+ />
+ </>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileIllustration.test.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileIllustration.test.tsx
new file mode 100644
index 0000000000..c2d6b175d0
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileIllustration.test.tsx
@@ -0,0 +1,77 @@
+import { describe, expect, test } from "vitest";
+import { render, screen } from "@/tests/integrations/test-utils";
+
+import {
+ deriveBadgeLabel,
+ FileIllustration,
+ pickFileTypeKey,
+} from "./FileIllustration";
+
+describe("pickFileTypeKey", () => {
+ test.each([
+ ["image/png", "img"],
+ ["video/mp4", "video"],
+ ["application/pdf", "pdf"],
+ ["text/html", "html"],
+ ["application/xhtml+xml", "html"],
+ [
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ "xls",
+ ],
+ ["application/vnd.ms-excel", "xls"],
+ ["text/csv", "xls"],
+ ["application/json", "json"],
+ ["text/plain", "generic"],
+ [undefined, "generic"],
+ ])("pickFileTypeKey(%s) === %s", (mime, expected) => {
+ expect(pickFileTypeKey(mime)).toBe(expected);
+ });
+});
+
+describe("deriveBadgeLabel", () => {
+ test("returns the uppercased file extension when present", () => {
+ expect(deriveBadgeLabel("report.PDF", "application/pdf")).toBe("PDF");
+ expect(deriveBadgeLabel("notes.md", "text/markdown")).toBe("MD");
+ });
+
+ test("truncates long extensions to four chars", () => {
+ expect(deriveBadgeLabel("data.jsonld", "application/json")).toBe("JSON");
+ });
+
+ test("falls back to the mime subtype when no extension is present", () => {
+ expect(deriveBadgeLabel("noext", "application/pdf")).toBe("PDF");
+ });
+
+ test("returns the FILE sentinel when neither name nor mime is informative", () => {
+ expect(deriveBadgeLabel(undefined, undefined)).toBe("FILE");
+ expect(deriveBadgeLabel("", "")).toBe("FILE");
+ });
+});
+
+describe("FileIllustration", () => {
+ test("renders the badge label override when provided", () => {
+ render(<FileIllustration typeKey="pdf" label="CUSTOM" />);
+ expect(screen.getByText("CUSTOM")).toBeDefined();
+ });
+
+ test("falls back to the type-config default label when no override is given", () => {
+ render(<FileIllustration typeKey="pdf" />);
+ // PDF config label
+ expect(screen.getByText(/PDF/)).toBeDefined();
+ });
+
+ test("renders for every known type key", () => {
+ for (const key of [
+ "pdf",
+ "xls",
+ "json",
+ "img",
+ "html",
+ "video",
+ "generic",
+ ] as const) {
+ const { unmount } = render(<FileIllustration typeKey={key} />);
+ unmount();
+ }
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileIllustration.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileIllustration.tsx
new file mode 100644
index 0000000000..8d5a48487c
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileIllustration.tsx
@@ -0,0 +1,300 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+import type { ReactNode } from "react";
+
+export type FileTypeKey =
+ | "pdf"
+ | "xls"
+ | "json"
+ | "img"
+ | "html"
+ | "video"
+ | "generic";
+
+interface FileTypeConfig {
+ label: string;
+ cardClass: string;
+ badgePositionClass: string;
+ content: ReactNode;
+}
+
+const cardBase =
+ "relative h-28 overflow-hidden rounded-md rounded-tr-[15%] bg-white shadow-md shadow-black/[0.065] ring-1 ring-zinc-200";
+
+const DEFAULT_BADGE_POSITION = "bottom-5 -right-2";
+
+function GenericTextContent() {
+ return (
+ <div className="space-y-3">
+ <div className="space-y-1.5">
+ <div className="h-0.5 w-full rounded-full bg-zinc-900/10" />
+ <div className="flex gap-1">
+ <div className="h-0.5 w-1/3 rounded-full bg-zinc-900/10" />
+ <div className="h-0.5 w-1/3 rounded-full bg-zinc-900/10" />
+ <div className="h-0.5 w-1/3 rounded-full bg-zinc-900/10" />
+ </div>
+ <div className="flex gap-1">
+ <div className="h-0.5 w-1/2 rounded-full bg-zinc-900/10" />
+ <div className="h-0.5 w-1/2 rounded-full bg-zinc-900/10" />
+ </div>
+ <div className="flex gap-1">
+ <div className="h-0.5 w-1/3 rounded-full bg-zinc-900/10" />
+ <div className="h-0.5 w-1/3 rounded-full bg-zinc-900/10" />
+ <div className="h-0.5 w-1/3 rounded-full bg-zinc-900/10" />
+ </div>
+ <div className="flex gap-1">
+ <div className="h-0.5 w-1/3 rounded-full bg-zinc-900/10" />
+ <div className="h-0.5 w-2/3 rounded-full bg-zinc-900/10" />
+ </div>
+ <div className="flex gap-1">
+ <div className="h-0.5 w-1/3 rounded-full bg-zinc-900/10" />
+ <div className="h-0.5 w-1/3 rounded-full bg-zinc-900/10" />
+ </div>
+ </div>
+ <div className="pt-1">
+ <div className="h-0.5 w-4 rounded-full bg-zinc-900" />
+ </div>
+ </div>
+ );
+}
+
+function XlsContent() {
+ return (
+ <div className="grid grid-cols-3 gap-px overflow-hidden rounded-sm">
+ <div className="col-span-3 grid grid-cols-3 gap-px bg-zinc-900/5">
+ <div className="h-2 bg-zinc-900/15" />
+ <div className="h-2 bg-zinc-900/15" />
+ <div className="h-2 bg-zinc-900/15" />
+ </div>
+ {Array.from({ length: 21 }).map((_, i) => (
+ <div key={i} className="h-2 bg-zinc-900/5" />
+ ))}
+ </div>
+ );
+}
+
+function JsonContent() {
+ return (
+ <div className="space-y-1">
+ <div className="font-mono text-[6px] text-zinc-900/40">{"{"}</div>
+ <div className="flex items-center gap-1 pl-1.5">
+ <div className="h-[3px] w-3 rounded-full bg-zinc-900/30" />
+ <div className="text-[5px] text-zinc-900/30">:</div>
+ <div className="h-[3px] w-4 rounded-full bg-zinc-900/15" />
+ </div>
+ <div className="flex items-center gap-1 pl-1.5">
+ <div className="h-[3px] w-4 rounded-full bg-zinc-900/30" />
+ <div className="text-[5px] text-zinc-900/30">:</div>
+ <div className="h-[3px] w-2 rounded-full bg-zinc-900/15" />
+ </div>
+ <div className="flex items-center gap-1 pl-1.5">
+ <div className="h-[3px] w-2.5 rounded-full bg-zinc-900/30" />
+ <div className="text-[5px] text-zinc-900/30">:</div>
+ <div className="h-[3px] w-5 rounded-full bg-zinc-900/15" />
+ </div>
+ <div className="flex items-center gap-1 pl-1.5">
+ <div className="h-[3px] w-3.5 rounded-full bg-zinc-900/30" />
+ <div className="text-[5px] text-zinc-900/30">:</div>
+ <div className="h-[3px] w-3 rounded-full bg-zinc-900/15" />
+ </div>
+ <div className="font-mono text-[6px] text-zinc-900/40">{"}"}</div>
+ </div>
+ );
+}
+
+function HtmlContent() {
+ function Tag({
+ color,
+ w,
+ pl,
+ closing,
+ selfClosing,
+ }: {
+ color: string;
+ w: string;
+ pl?: string;
+ closing?: boolean;
+ selfClosing?: boolean;
+ }) {
+ return (
+ <div className={cn("flex items-center gap-0.5", pl)}>
+ <div className="font-mono text-[5px] text-zinc-900/40">
+ {closing ? "</" : "<"}
+ </div>
+ <div className={cn("h-[3px] rounded-full", color, w)} />
+ <div className="font-mono text-[5px] text-zinc-900/40">
+ {selfClosing ? "/>" : ">"}
+ </div>
+ </div>
+ );
+ }
+ return (
+ <div className="space-y-1">
+ <Tag color="bg-zinc-900/30" w="w-3" />
+ <Tag color="bg-zinc-900/25" w="w-2.5" pl="pl-1.5" />
+ <div className="pl-3">
+ <div className="h-[2px] w-6 rounded-full bg-zinc-900/10" />
+ </div>
+ <Tag color="bg-zinc-900/25" w="w-2.5" pl="pl-1.5" closing />
+ <Tag color="bg-zinc-900/20" w="w-2" pl="pl-1.5" selfClosing />
+ <Tag color="bg-zinc-900/30" w="w-3" closing />
+ </div>
+ );
+}
+
+function VideoContent() {
+ return (
+ <div className="relative h-16 overflow-hidden rounded-sm bg-zinc-900/10">
+ {/* Play triangle */}
+ <div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
+ <div
+ className="h-0 w-0"
+ style={{
+ borderTop: "5px solid transparent",
+ borderBottom: "5px solid transparent",
+ borderLeft: "7px solid rgb(24 24 27 / 0.55)",
+ }}
+ />
+ </div>
+ {/* Timeline at the bottom */}
+ <div className="absolute bottom-1 left-1 right-1 h-1 rounded-full bg-zinc-900/10">
+ <div className="h-full w-1/3 rounded-full bg-zinc-900/40" />
+ </div>
+ </div>
+ );
+}
+
+function ImgContent() {
+ return (
+ <div className="relative h-16">
+ <div className="absolute bottom-0 left-0 right-0 h-4 bg-gradient-to-t from-zinc-900/20 to-transparent" />
+ <div className="absolute bottom-1 left-1 h-3 w-5 rounded-t-full bg-zinc-900/25" />
+ <div className="absolute bottom-1 right-2 h-5 w-4 rounded-t-full bg-zinc-900/30" />
+ <div className="absolute right-1.5 top-1.5 size-2 rounded-full bg-zinc-900/40" />
+ </div>
+ );
+}
+
+export const FILE_TYPE_CONFIGS: Record<FileTypeKey, FileTypeConfig> = {
+ pdf: {
+ label: "PDF",
+ cardClass: "w-20 space-y-3 p-3",
+ badgePositionClass: "bottom-5 -right-2",
+ content: <GenericTextContent />,
+ },
+ xls: {
+ label: "XLS",
+ cardClass: "w-20 space-y-2 p-2",
+ badgePositionClass: "bottom-5 -right-2",
+ content: <XlsContent />,
+ },
+ json: {
+ label: "JSON",
+ cardClass: "w-20 space-y-1.5 p-2.5",
+ badgePositionClass: "bottom-5 -right-2",
+ content: <JsonContent />,
+ },
+ img: {
+ label: "IMG",
+ cardClass: "w-20 p-2.5",
+ badgePositionClass: "bottom-5 -right-2",
+ content: <ImgContent />,
+ },
+ html: {
+ label: "HTML",
+ cardClass: "w-20 space-y-1 p-2.5",
+ badgePositionClass: "bottom-5 -right-2",
+ content: <HtmlContent />,
+ },
+ video: {
+ label: "MP4",
+ cardClass: "w-20 p-2.5",
+ badgePositionClass: "bottom-5 -right-2",
+ content: <VideoContent />,
+ },
+ generic: {
+ label: "FILE",
+ cardClass: "w-20 space-y-3 p-3",
+ badgePositionClass: "bottom-5 -right-2",
+ content: <GenericTextContent />,
+ },
+};
+
+export const FILE_TYPE_KEYS: FileTypeKey[] = [
+ "pdf",
+ "xls",
+ "json",
+ "img",
+ "html",
+ "video",
+ "generic",
+];
+
+export function pickFileTypeKey(mimeType: string | undefined): FileTypeKey {
+ const mt = (mimeType ?? "").toLowerCase();
+ if (mt.startsWith("image/")) return "img";
+ if (mt.startsWith("video/")) return "video";
+ if (mt.includes("pdf")) return "pdf";
+ if (mt.includes("html") || mt.includes("xhtml")) return "html";
+ if (
+ mt.includes("spreadsheet") ||
+ mt.includes("excel") ||
+ mt.includes("csv")
+ ) {
+ return "xls";
+ }
+ if (mt.includes("json")) return "json";
+ return "generic";
+}
+
+export function deriveBadgeLabel(
+ fileName: string | undefined,
+ mimeType: string | undefined,
+): string {
+ const extMatch = (fileName ?? "").match(/\.([a-z0-9]+)$/i);
+ if (extMatch) return extMatch[1].toUpperCase().slice(0, 4);
+ const sub = (mimeType ?? "").split("/")[1];
+ if (sub) return sub.toUpperCase().slice(0, 4);
+ return "FILE";
+}
+
+interface Props {
+ typeKey: FileTypeKey;
+ label?: string;
+ className?: string;
+ size?: "sm" | "md";
+ badgeClassName?: string;
+}
+
+const SIZE_WRAPPER_CLASS: Record<NonNullable<Props["size"]>, string> = {
+ md: "",
+ sm: "origin-top-left scale-[0.55] -mr-9 -mb-12",
+};
+
+export function FileIllustration({
+ typeKey,
+ label,
+ className,
+ size = "md",
+ badgeClassName,
+}: Props) {
+ const config = FILE_TYPE_CONFIGS[typeKey];
+ const badgeLabel = label ?? config.label;
+ return (
+ <div
+ className={cn("relative shrink-0", SIZE_WRAPPER_CLASS[size], className)}
+ >
+ <div className={cn(cardBase, config.cardClass)}>{config.content}</div>
+ <span
+ className={cn(
+ "absolute rounded-md bg-zinc-700 px-2 py-1 text-[11px] font-semibold uppercase tracking-wide text-white shadow-md shadow-black/10",
+ config.badgePositionClass ?? DEFAULT_BADGE_POSITION,
+ badgeClassName,
+ )}
+ >
+ {badgeLabel}
+ </span>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileTypeMarquee.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileTypeMarquee.tsx
new file mode 100644
index 0000000000..07da5f7e4d
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileTypeMarquee.tsx
@@ -0,0 +1,22 @@
+"use client";
+
+import { FILE_TYPE_KEYS, FileIllustration } from "./FileIllustration";
+
+export function FileTypeMarquee() {
+ const items = [...FILE_TYPE_KEYS, ...FILE_TYPE_KEYS];
+
+ return (
+ <div
+ className="pointer-events-none relative mx-auto w-full max-w-lg overflow-hidden [mask-image:linear-gradient(to_right,transparent,black_15%,black_85%,transparent)]"
+ data-testid="artifacts-file-type-marquee"
+ >
+ <div className="flex w-max animate-marquee-x items-end gap-4 py-2">
+ {items.map((key, i) => (
+ <div key={`${key}-${i}`} className="px-4 py-3">
+ <FileIllustration typeKey={key} />
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/LoadMoreSentinel.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/LoadMoreSentinel.tsx
new file mode 100644
index 0000000000..1b48d6d995
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/LoadMoreSentinel.tsx
@@ -0,0 +1,45 @@
+"use client";
+
+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
+import { useEffect, useRef } from "react";
+
+interface Props {
+ hasMore: boolean;
+ isLoading: boolean;
+ onLoadMore: () => void;
+}
+
+export function LoadMoreSentinel({ hasMore, isLoading, onLoadMore }: Props) {
+ const sentinelRef = useRef<HTMLDivElement>(null);
+ const onLoadMoreRef = useRef(onLoadMore);
+ onLoadMoreRef.current = onLoadMore;
+
+ useEffect(() => {
+ const el = sentinelRef.current;
+ if (!el || !hasMore || isLoading) return;
+ const observer = new IntersectionObserver(
+ ([entry]) => {
+ if (entry.isIntersecting) onLoadMoreRef.current();
+ },
+ { rootMargin: "400px 0px 400px 0px" },
+ );
+ observer.observe(el);
+ return () => observer.disconnect();
+ }, [hasMore, isLoading]);
+
+ if (!hasMore && !isLoading) return null;
+
+ return (
+ <div
+ ref={sentinelRef}
+ className="grid grid-cols-1 gap-4 pt-4 sm:grid-cols-2 md:grid-cols-4"
+ data-testid="artifacts-load-more-sentinel"
+ >
+ {isLoading
+ ? Array.from({ length: 4 }).map((_, i) => (
+ <Skeleton key={i} className="h-64 w-full rounded-2xl" />
+ ))
+ : null}
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/helpers.test.ts
new file mode 100644
index 0000000000..0e6cf42898
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/helpers.test.ts
@@ -0,0 +1,205 @@
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+
+import {
+ deriveFileOrigin,
+ formatFileSize,
+ formatRelativeDate,
+ getFileDownloadUrl,
+ getFileTypeIcon,
+ getFileTypeLabel,
+ getPreviewKind,
+} from "./helpers";
+
+describe("deriveFileOrigin", () => {
+ test("extracts session id from /sessions/<id>/...", () => {
+ const origin = deriveFileOrigin("/sessions/abc-123/notes.txt");
+ expect(origin.kind).toBe("session");
+ if (origin.kind === "session") {
+ expect(origin.sessionId).toBe("abc-123");
+ expect(origin.href).toBe("/copilot?sessionId=abc-123");
+ }
+ });
+
+ test("url-encodes session ids that contain special characters", () => {
+ const origin = deriveFileOrigin("/sessions/has space/x");
+ expect(origin.kind).toBe("session");
+ if (origin.kind === "session") {
+ expect(origin.href).toBe("/copilot?sessionId=has%20space");
+ }
+ });
+
+ test("falls back to builder for non-session paths", () => {
+ expect(deriveFileOrigin("/uploads/file.txt")).toEqual({
+ kind: "builder",
+ href: "/build",
+ });
+ });
+
+ test("handles undefined safely", () => {
+ expect(deriveFileOrigin(undefined)).toEqual({
+ kind: "builder",
+ href: "/build",
+ });
+ });
+
+ test("a literal /sessions path without a child segment is not a session", () => {
+ expect(deriveFileOrigin("/sessions/")).toEqual({
+ kind: "builder",
+ href: "/build",
+ });
+ });
+});
+
+describe("getFileDownloadUrl", () => {
+ test("url-encodes the file id", () => {
+ expect(getFileDownloadUrl("a/b c")).toBe(
+ "/api/proxy/api/workspace/files/a%2Fb%20c/download",
+ );
+ });
+});
+
+describe("formatFileSize", () => {
+ test.each([
+ [0, "0 B"],
+ [-100, "0 B"],
+ [Number.NaN, "0 B"],
+ [Number.POSITIVE_INFINITY, "0 B"],
+ [500, "500 B"],
+ [1024, "1.0 KB"],
+ [1024 * 1024, "1.0 MB"],
+ [1024 * 1024 * 1024, "1.0 GB"],
+ [1024 * 1024 * 1024 * 1024, "1.0 TB"],
+ ])("formatFileSize(%s) === %s", (bytes, expected) => {
+ expect(formatFileSize(bytes)).toBe(expected);
+ });
+});
+
+describe("formatRelativeDate", () => {
+ beforeEach(() => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-05-29T12:00:00Z"));
+ });
+
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
+ test("returns dash for invalid dates", () => {
+ expect(formatRelativeDate("not-a-date")).toBe("—");
+ });
+
+ test("under a minute reads as 'just now'", () => {
+ expect(formatRelativeDate("2026-05-29T11:59:30Z")).toBe("just now");
+ });
+
+ test("between 1 and 60 minutes reads in minutes", () => {
+ expect(formatRelativeDate("2026-05-29T11:55:00Z")).toBe("5m ago");
+ });
+
+ test("between 1 and 24 hours reads in hours", () => {
+ expect(formatRelativeDate("2026-05-29T08:00:00Z")).toBe("4h ago");
+ });
+
+ test("between 1 and 7 days reads in days", () => {
+ expect(formatRelativeDate("2026-05-27T12:00:00Z")).toBe("2d ago");
+ });
+
+ test("older than 7 days reads as a date with the current year hidden", () => {
+ const out = formatRelativeDate("2026-04-01T12:00:00Z");
+ expect(out).toMatch(/Apr 1/);
+ expect(out).not.toMatch(/2026/);
+ });
+
+ test("older than 7 days from a previous year includes the year", () => {
+ const out = formatRelativeDate("2024-04-01T12:00:00Z");
+ expect(out).toMatch(/2024/);
+ });
+
+ test("accepts Date instances directly", () => {
+ expect(formatRelativeDate(new Date("2026-05-29T11:55:00Z"))).toBe("5m ago");
+ });
+});
+
+describe("getFileTypeLabel + getFileTypeIcon", () => {
+ test.each([
+ ["image/png", "Image"],
+ ["video/mp4", "Video"],
+ ["audio/mpeg", "Audio"],
+ ["application/pdf", "PDF document"],
+ ["text/html", "Web page"],
+ ["application/xhtml+xml", "Web page"],
+ ["text/csv", "Spreadsheet"],
+ [
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ "Spreadsheet",
+ ],
+ ["application/json", "JSON data"],
+ ["text/markdown", "Markdown"],
+ ["text/plain", "Document"],
+ ["application/octet-stream", "Generated file"],
+ [undefined, "Generated file"],
+ ])("getFileTypeLabel(%s) === %s", (mime, expected) => {
+ expect(getFileTypeLabel(mime)).toBe(expected);
+ });
+
+ test("returns a callable icon component for every known mime family", () => {
+ for (const mime of [
+ "image/png",
+ "video/mp4",
+ "application/pdf",
+ "text/html",
+ "text/csv",
+ "application/json",
+ "text/markdown",
+ "application/octet-stream",
+ undefined,
+ ]) {
+ const Icon = getFileTypeIcon(mime);
+ expect(typeof Icon).toBe("object");
+ }
+ });
+});
+
+describe("getPreviewKind", () => {
+ test("images under the 10MB cap preview as 'image'", () => {
+ expect(getPreviewKind("image/png", 1_000)).toBe("image");
+ });
+
+ test("images over the cap suppress the preview", () => {
+ expect(getPreviewKind("image/png", 20_000_000)).toBe("none");
+ });
+
+ test("videos under the cap preview as 'video'", () => {
+ expect(getPreviewKind("video/mp4", 1_000_000)).toBe("video");
+ });
+
+ test("videos over the cap suppress the preview", () => {
+ expect(getPreviewKind("video/mp4", 800_000_000)).toBe("none");
+ });
+
+ test.each([
+ "text/plain",
+ "text/html",
+ "application/json",
+ "application/xml",
+ "text/csv",
+ "text/markdown",
+ "application/javascript",
+ "application/typescript",
+ "application/yaml",
+ ])("text-like mime '%s' under cap previews as 'text'", (mt) => {
+ expect(getPreviewKind(mt, 1_000)).toBe("text");
+ });
+
+ test("text over the cap suppresses the preview", () => {
+ expect(getPreviewKind("text/plain", 500_000)).toBe("none");
+ });
+
+ test("unknown binary mime types return 'none'", () => {
+ expect(getPreviewKind("application/octet-stream", 100)).toBe("none");
+ });
+
+ test("undefined mime returns 'none'", () => {
+ expect(getPreviewKind(undefined, 100)).toBe("none");
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/helpers.ts
new file mode 100644
index 0000000000..4d478e45dc
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/helpers.ts
@@ -0,0 +1,136 @@
+import type { Icon } from "@phosphor-icons/react";
+import {
+ BracketsCurlyIcon,
+ CodeIcon,
+ FileIcon,
+ FilePdfIcon,
+ FileTextIcon,
+ ImageIcon,
+ TableIcon,
+ VideoCameraIcon,
+} from "@phosphor-icons/react";
+
+export type FileOrigin =
+ | { kind: "session"; sessionId: string; href: string }
+ | { kind: "builder"; href: string };
+
+const SESSION_PATH_RE = /^\/sessions\/([^/]+)\//;
+
+export function deriveFileOrigin(filePath: string | undefined): FileOrigin {
+ const match = (filePath ?? "").match(SESSION_PATH_RE);
+ if (match) {
+ const sessionId = match[1];
+ return {
+ kind: "session",
+ sessionId,
+ href: `/copilot?sessionId=${encodeURIComponent(sessionId)}`,
+ };
+ }
+ return { kind: "builder", href: "/build" };
+}
+
+export function getFileDownloadUrl(fileId: string): string {
+ return `/api/proxy/api/workspace/files/${encodeURIComponent(fileId)}/download`;
+}
+
+const BYTE_UNITS = ["B", "KB", "MB", "GB", "TB"] as const;
+
+export function formatFileSize(bytes: number): string {
+ if (!Number.isFinite(bytes) || bytes <= 0) return "0 B";
+ const exp = Math.min(
+ BYTE_UNITS.length - 1,
+ Math.floor(Math.log(bytes) / Math.log(1024)),
+ );
+ const value = bytes / Math.pow(1024, exp);
+ const formatted = exp === 0 ? value.toFixed(0) : value.toFixed(1);
+ return `${formatted} ${BYTE_UNITS[exp]}`;
+}
+
+export function formatRelativeDate(input: string | Date): string {
+ const date = input instanceof Date ? input : new Date(input);
+ if (Number.isNaN(date.getTime())) return "—";
+
+ const diffMs = Date.now() - date.getTime();
+ const diffMin = Math.floor(diffMs / 60_000);
+ if (diffMin < 1) return "just now";
+ if (diffMin < 60) return `${diffMin}m ago`;
+ const diffHr = Math.floor(diffMin / 60);
+ if (diffHr < 24) return `${diffHr}h ago`;
+ const diffDay = Math.floor(diffHr / 24);
+ if (diffDay < 7) return `${diffDay}d ago`;
+
+ return date.toLocaleDateString(undefined, {
+ month: "short",
+ day: "numeric",
+ year:
+ date.getFullYear() === new Date().getFullYear() ? undefined : "numeric",
+ });
+}
+
+export function getFileTypeLabel(mimeType: string | undefined): string {
+ const mt = (mimeType ?? "").toLowerCase();
+ if (mt.startsWith("image/")) return "Image";
+ if (mt.startsWith("video/")) return "Video";
+ if (mt.startsWith("audio/")) return "Audio";
+ if (mt.includes("pdf")) return "PDF document";
+ if (mt.includes("html") || mt.includes("xhtml")) return "Web page";
+ if (mt.includes("csv")) return "Spreadsheet";
+ if (mt.includes("spreadsheet") || mt.includes("excel")) return "Spreadsheet";
+ if (mt.includes("json")) return "JSON data";
+ if (mt.includes("markdown")) return "Markdown";
+ if (mt.includes("text")) return "Document";
+ return "Generated file";
+}
+
+export function getFileTypeIcon(mimeType: string | undefined): Icon {
+ const mt = (mimeType ?? "").toLowerCase();
+ if (mt.startsWith("image/")) return ImageIcon;
+ if (mt.startsWith("video/")) return VideoCameraIcon;
+ if (mt.includes("pdf")) return FilePdfIcon;
+ if (mt.includes("html") || mt.includes("xhtml")) return CodeIcon;
+ if (
+ mt.includes("csv") ||
+ mt.includes("spreadsheet") ||
+ mt.includes("excel")
+ ) {
+ return TableIcon;
+ }
+ if (mt.includes("json")) return BracketsCurlyIcon;
+ if (mt.includes("text") || mt.includes("markdown")) return FileTextIcon;
+ return FileIcon;
+}
+
+export type PreviewKind = "image" | "video" | "text" | "none";
+
+const MAX_TEXT_PREVIEW_BYTES = 200_000;
+const MAX_IMAGE_PREVIEW_BYTES = 10_000_000;
+const MAX_VIDEO_PREVIEW_BYTES = 500_000_000;
+
+export function getPreviewKind(
+ mimeType: string | undefined,
+ sizeBytes: number,
+): PreviewKind {
+ const mt = (mimeType ?? "").toLowerCase();
+ if (mt.startsWith("image/")) {
+ return sizeBytes > MAX_IMAGE_PREVIEW_BYTES ? "none" : "image";
+ }
+ if (mt.startsWith("video/")) {
+ return sizeBytes > MAX_VIDEO_PREVIEW_BYTES ? "none" : "video";
+ }
+ if (sizeBytes > MAX_TEXT_PREVIEW_BYTES) return "none";
+ if (
+ mt.startsWith("text/") ||
+ mt.includes("html") ||
+ mt.includes("xhtml") ||
+ mt.includes("json") ||
+ mt.includes("xml") ||
+ mt.includes("csv") ||
+ mt.includes("markdown") ||
+ mt.includes("javascript") ||
+ mt.includes("typescript") ||
+ mt.includes("yaml")
+ ) {
+ return "text";
+ }
+ return "none";
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsSearchBar/ArtifactsSearchBar.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsSearchBar/ArtifactsSearchBar.tsx
new file mode 100644
index 0000000000..88051b432a
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsSearchBar/ArtifactsSearchBar.tsx
@@ -0,0 +1,40 @@
+"use client";
+
+import { Input } from "@/components/atoms/Input/Input";
+import { MagnifyingGlassIcon } from "@phosphor-icons/react";
+import type { ChangeEvent } from "react";
+
+interface Props {
+ searchTerm: string;
+ setSearchTerm: (value: string) => void;
+}
+
+export function ArtifactsSearchBar({ searchTerm, setSearchTerm }: Props) {
+ function handleChange(event: ChangeEvent<HTMLInputElement>) {
+ setSearchTerm(event.target.value);
+ }
+
+ return (
+ <div
+ data-testid="artifacts-search-bar"
+ className="relative -mb-6 flex w-full items-center md:w-auto"
+ >
+ <MagnifyingGlassIcon
+ width={18}
+ height={18}
+ className="absolute left-4 top-[34%] z-20 -translate-y-1/2 text-zinc-800"
+ />
+ <Input
+ label="Search files"
+ id="artifacts-search-bar"
+ hideLabel
+ type="text"
+ value={searchTerm}
+ onChange={handleChange}
+ placeholder="Search files"
+ className="min-w-[18rem] pl-12 lg:min-w-[24rem]"
+ data-testid="artifacts-search-input"
+ />
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/OriginFilter/OriginFilter.stories.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/OriginFilter/OriginFilter.stories.tsx
new file mode 100644
index 0000000000..e608b0b62b
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/OriginFilter/OriginFilter.stories.tsx
@@ -0,0 +1,71 @@
+import type { Meta, StoryObj } from "@storybook/nextjs";
+import { useState } from "react";
+import type { OriginFilter as OriginFilterValue } from "../../useArtifactsPage";
+import { OriginFilter } from "./OriginFilter";
+
+const meta: Meta<typeof OriginFilter> = {
+ title: "Pages/Artifacts/OriginFilter",
+ component: OriginFilter,
+ tags: ["autodocs"],
+ parameters: {
+ layout: "centered",
+ docs: {
+ description: {
+ component:
+ "Segmented pill filter for the Artifacts page. The active pill " +
+ "slides between options via Framer Motion's shared `layoutId`. " +
+ "Drives the `origin` query param on `useListWorkspaceFiles` " +
+ "(builder vs autopilot, all = no filter).",
+ },
+ },
+ },
+ argTypes: {
+ value: {
+ control: { type: "radio" },
+ options: ["all", "builder", "autopilot"] satisfies OriginFilterValue[],
+ description: "Currently selected origin filter.",
+ },
+ onChange: {
+ action: "changed",
+ description: "Fired when the user picks a different option.",
+ },
+ },
+};
+
+export default meta;
+type Story = StoryObj<typeof meta>;
+
+export const All: Story = {
+ args: { value: "all" },
+};
+
+export const Builder: Story = {
+ args: { value: "builder" },
+};
+
+export const Autopilot: Story = {
+ args: { value: "autopilot" },
+};
+
+export const Interactive: Story = {
+ render: function InteractiveStory() {
+ const [value, setValue] = useState<OriginFilterValue>("all");
+ return (
+ <div className="flex flex-col items-center gap-4">
+ <OriginFilter value={value} onChange={setValue} />
+ <span className="text-xs text-zinc-500">
+ Selected: <code className="text-zinc-900">{value}</code>
+ </span>
+ </div>
+ );
+ },
+ parameters: {
+ docs: {
+ description: {
+ story:
+ "Stateful playground — click pills to see the active background " +
+ "slide between them.",
+ },
+ },
+ },
+};
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/OriginFilter/OriginFilter.test.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/OriginFilter/OriginFilter.test.tsx
new file mode 100644
index 0000000000..a3fda433c9
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/OriginFilter/OriginFilter.test.tsx
@@ -0,0 +1,35 @@
+import { describe, expect, test, vi } from "vitest";
+import { fireEvent, render, screen } from "@/tests/integrations/test-utils";
+
+import { OriginFilter } from "./OriginFilter";
+
+describe("OriginFilter", () => {
+ test("renders all three tabs", () => {
+ render(<OriginFilter value="all" onChange={() => {}} />);
+ expect(screen.getByRole("tab", { name: /all/i })).toBeDefined();
+ expect(screen.getByRole("tab", { name: /builder/i })).toBeDefined();
+ expect(screen.getByRole("tab", { name: /autopilot/i })).toBeDefined();
+ });
+
+ test("marks the active tab as aria-selected", () => {
+ render(<OriginFilter value="builder" onChange={() => {}} />);
+ const builder = screen.getByRole("tab", { name: /builder/i });
+ const all = screen.getByRole("tab", { name: /all/i });
+ expect(builder.getAttribute("aria-selected")).toBe("true");
+ expect(all.getAttribute("aria-selected")).toBe("false");
+ });
+
+ test("clicking a tab forwards the value to onChange", () => {
+ const onChange = vi.fn();
+ render(<OriginFilter value="all" onChange={onChange} />);
+ fireEvent.click(screen.getByRole("tab", { name: /autopilot/i }));
+ expect(onChange).toHaveBeenCalledWith("autopilot");
+ });
+
+ test("clicking the already-active tab still fires onChange (caller decides)", () => {
+ const onChange = vi.fn();
+ render(<OriginFilter value="builder" onChange={onChange} />);
+ fireEvent.click(screen.getByRole("tab", { name: /builder/i }));
+ expect(onChange).toHaveBeenCalledWith("builder");
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/OriginFilter/OriginFilter.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/OriginFilter/OriginFilter.tsx
new file mode 100644
index 0000000000..ca6fa20a38
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/OriginFilter/OriginFilter.tsx
@@ -0,0 +1,98 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+import {
+ HouseLineIcon,
+ ListBulletsIcon,
+ SparkleIcon,
+ type Icon,
+} from "@phosphor-icons/react";
+import { LayoutGroup, motion, type Transition } from "framer-motion";
+import type { OriginFilter as OriginFilterValue } from "../../useArtifactsPage";
+
+interface Props {
+ value: OriginFilterValue;
+ onChange: (value: OriginFilterValue) => void;
+}
+
+interface Option {
+ value: OriginFilterValue;
+ label: string;
+ Icon: Icon;
+}
+
+const OPTIONS: Option[] = [
+ { value: "all", label: "All", Icon: ListBulletsIcon },
+ { value: "builder", label: "Builder", Icon: HouseLineIcon },
+ { value: "autopilot", label: "Autopilot", Icon: SparkleIcon },
+];
+
+const snappySpring: Transition = {
+ type: "spring",
+ stiffness: 350,
+ damping: 30,
+ mass: 1,
+};
+
+export function OriginFilter({ value, onChange }: Props) {
+ return (
+ <LayoutGroup id="artifacts-origin-filter">
+ <div
+ role="tablist"
+ aria-label="Filter by source"
+ className="inline-flex items-center gap-1 rounded-full border border-zinc-200 bg-zinc-50 p-1"
+ data-testid="artifacts-origin-filter"
+ >
+ {OPTIONS.map((opt) => (
+ <OriginTab
+ key={opt.value}
+ option={opt}
+ active={value === opt.value}
+ onClick={() => onChange(opt.value)}
+ />
+ ))}
+ </div>
+ </LayoutGroup>
+ );
+}
+
+interface OriginTabProps {
+ option: Option;
+ active: boolean;
+ onClick: () => void;
+}
+
+function OriginTab({ option, active, onClick }: OriginTabProps) {
+ const { label, Icon } = option;
+ return (
+ <button
+ type="button"
+ role="tab"
+ aria-selected={active}
+ onClick={onClick}
+ className={cn(
+ "relative flex items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium outline-none transition-colors",
+ active ? "text-white" : "text-zinc-500 hover:text-zinc-800",
+ )}
+ data-testid={`artifacts-origin-filter-${option.value}`}
+ >
+ {active ? (
+ <motion.span
+ layoutId="artifacts-origin-active"
+ className="absolute inset-0 rounded-full bg-zinc-900 shadow-sm"
+ transition={snappySpring}
+ />
+ ) : null}
+ <span className="relative z-10 flex items-center gap-1.5">
+ <Icon
+ size={14}
+ className={cn(
+ "transition-transform duration-300",
+ active && "scale-110",
+ )}
+ />
+ {label}
+ </span>
+ </button>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/StorageUsage/StorageUsage.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/StorageUsage/StorageUsage.tsx
new file mode 100644
index 0000000000..61d0b63f43
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/StorageUsage/StorageUsage.tsx
@@ -0,0 +1,91 @@
+"use client";
+
+import { useGetWorkspaceStorageUsage } from "@/app/api/__generated__/endpoints/workspace/workspace";
+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
+import { Text } from "@/components/atoms/Text/Text";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/atoms/Tooltip/BaseTooltip";
+import { cn } from "@/lib/utils";
+import { formatFileSize } from "../ArtifactsList/helpers";
+
+const SEGMENT_COUNT = 40;
+
+export function StorageUsage() {
+ const { data, isLoading, isError } = useGetWorkspaceStorageUsage({
+ query: {
+ select: (res) => (res.status === 200 ? res.data : null),
+ },
+ });
+
+ if (isLoading) {
+ return (
+ <div
+ className="flex w-full flex-col gap-2"
+ data-testid="storage-usage-loading"
+ >
+ <Skeleton className="h-3 w-24" />
+ <div className="flex items-center gap-3">
+ <Skeleton className="h-8 flex-1 rounded-md" />
+ <Skeleton className="h-3 w-32" />
+ </div>
+ </div>
+ );
+ }
+
+ if (isError || !data) return null;
+
+ const percent = Math.min(Math.max(data.used_percent, 0), 100);
+ const filled = Math.round((percent / 100) * SEGMENT_COUNT);
+ const filledColor = percent > 95 ? "bg-red-400" : "bg-purple-300";
+ const usedLabel = `${Math.round(percent)}% used`;
+ const leftLabel = `${Math.max(0, Math.round(100 - percent))}% left`;
+
+ return (
+ <div className="flex w-full flex-col gap-2" data-testid="storage-usage">
+ <Text variant="body-medium" className="text-zinc-800">
+ Storage
+ </Text>
+ <div className="flex items-center gap-3">
+ <TooltipProvider delayDuration={400} skipDelayDuration={120}>
+ <div
+ role="progressbar"
+ aria-valuenow={percent}
+ aria-valuemin={0}
+ aria-valuemax={100}
+ aria-label={`${usedLabel}, ${leftLabel}`}
+ className="flex h-8 flex-1 items-center gap-[3px]"
+ >
+ {Array.from({ length: SEGMENT_COUNT }).map((_, i) => {
+ const isFilled = i < filled;
+ return (
+ <Tooltip key={i} delayDuration={400}>
+ <TooltipTrigger asChild>
+ <div
+ className={cn(
+ "h-full w-[3px] flex-1 rounded-full transition duration-200 ease-out hover:-translate-y-1.5 motion-reduce:transition-none motion-reduce:hover:translate-y-0",
+ isFilled ? filledColor : "bg-zinc-300",
+ )}
+ />
+ </TooltipTrigger>
+ <TooltipContent side="top" sideOffset={6}>
+ {isFilled ? usedLabel : leftLabel}
+ </TooltipContent>
+ </Tooltip>
+ );
+ })}
+ </div>
+ </TooltipProvider>
+ <Text variant="body" className="shrink-0 text-zinc-500">
+ <span className="font-medium text-zinc-900">
+ {formatFileSize(data.used_bytes)}
+ </span>{" "}
+ of {formatFileSize(data.limit_bytes)} used
+ </Text>
+ </div>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/page.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/page.tsx
new file mode 100644
index 0000000000..a18e633e14
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/page.tsx
@@ -0,0 +1,150 @@
+"use client";
+
+import { useEffect } from "react";
+import { notFound } from "next/navigation";
+import { motion, useReducedMotion } from "framer-motion";
+import type { Transition, Variants } from "framer-motion";
+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
+import { Text } from "@/components/atoms/Text/Text";
+import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";
+import { ArtifactsSearchBar } from "./components/ArtifactsSearchBar/ArtifactsSearchBar";
+import { ArtifactsList } from "./components/ArtifactsList/ArtifactsList";
+import { OriginFilter } from "./components/OriginFilter/OriginFilter";
+import { StorageUsage } from "./components/StorageUsage/StorageUsage";
+import { useArtifactsPage } from "./useArtifactsPage";
+
+const EASE_OUT_SOFT: Transition["ease"] = [0.16, 1, 0.3, 1];
+
+const SECTION_VARIANTS: Variants = {
+ hidden: { opacity: 0, y: 8, filter: "blur(8px)" },
+ show: {
+ opacity: 1,
+ y: 0,
+ filter: "blur(0px)",
+ transition: { duration: 0.45, ease: EASE_OUT_SOFT },
+ },
+};
+
+const REDUCED_SECTION_VARIANTS: Variants = {
+ hidden: { opacity: 0 },
+ show: { opacity: 1, transition: { duration: 0.2 } },
+};
+
+export default function ArtifactsPage() {
+ const { enabled: isEnabled, ready: flagReady } = useFlagStatus(
+ Flag.ARTIFACTS_PAGE,
+ );
+ const reduceMotion = useReducedMotion();
+ const {
+ files,
+ isLoading,
+ isError,
+ error,
+ searchTerm,
+ setSearchTerm,
+ debouncedSearch,
+ originFilter,
+ setOriginFilter,
+ hasMore,
+ isLoadingMore,
+ loadMore,
+ } = useArtifactsPage();
+
+ useEffect(() => {
+ document.title = "Artifacts – AutoGPT Platform";
+ }, []);
+
+ if (!flagReady) {
+ return <ArtifactsPageSkeleton />;
+ }
+ if (!isEnabled) {
+ notFound();
+ }
+
+ const variants = reduceMotion ? REDUCED_SECTION_VARIANTS : SECTION_VARIANTS;
+
+ return (
+ <main className="container min-h-screen space-y-6 pb-20 pt-16 sm:px-8 md:px-12">
+ <div className="flex flex-col gap-4 md:flex-row md:items-start md:justify-between">
+ <motion.div
+ className="flex flex-col gap-1"
+ variants={variants}
+ initial="hidden"
+ animate="show"
+ transition={{ delay: 0 }}
+ >
+ <Text variant="h3">Artifacts</Text>
+ <Text variant="body" className="max-w-prose text-zinc-600">
+ Every file your agents generate or use in the Builder lives here —
+ ready to reuse, download, or share.
+ </Text>
+ </motion.div>
+ <motion.div
+ variants={variants}
+ initial="hidden"
+ animate="show"
+ transition={{ delay: reduceMotion ? 0 : 0.08 }}
+ >
+ <ArtifactsSearchBar
+ searchTerm={searchTerm}
+ setSearchTerm={setSearchTerm}
+ />
+ </motion.div>
+ </div>
+ <div className="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
+ <motion.div
+ className="flex w-full md:w-2/5"
+ variants={variants}
+ initial="hidden"
+ animate="show"
+ transition={{ delay: reduceMotion ? 0 : 0.16 }}
+ >
+ <StorageUsage />
+ </motion.div>
+ <motion.div
+ variants={variants}
+ initial="hidden"
+ animate="show"
+ transition={{ delay: reduceMotion ? 0 : 0.24 }}
+ >
+ <OriginFilter value={originFilter} onChange={setOriginFilter} />
+ </motion.div>
+ </div>
+ <motion.div
+ variants={variants}
+ initial="hidden"
+ animate="show"
+ transition={{ delay: reduceMotion ? 0 : 0.32 }}
+ >
+ <ArtifactsList
+ files={files}
+ isLoading={isLoading}
+ isError={isError}
+ error={error}
+ hasSearchTerm={searchTerm.length > 0}
+ hasMore={hasMore}
+ isLoadingMore={isLoadingMore}
+ onLoadMore={loadMore}
+ listKey={`${originFilter}|${debouncedSearch}`}
+ />
+ </motion.div>
+ </main>
+ );
+}
+
+function ArtifactsPageSkeleton() {
+ return (
+ <main
+ className="container min-h-screen space-y-6 pb-20 pt-16 sm:px-8 md:px-12"
+ data-testid="artifacts-flag-loading"
+ >
+ <Skeleton className="h-8 w-48 rounded-md" />
+ <Skeleton className="h-4 w-80 rounded-md" />
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-4">
+ {Array.from({ length: 6 }).map((_, i) => (
+ <Skeleton key={i} className="h-64 w-full rounded-2xl" />
+ ))}
+ </div>
+ </main>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/useArtifactsPage.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/useArtifactsPage.ts
new file mode 100644
index 0000000000..c6c3ac7738
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/useArtifactsPage.ts
@@ -0,0 +1,94 @@
+import { useEffect, useState } from "react";
+import { listWorkspaceFiles } from "@/app/api/__generated__/endpoints/workspace/workspace";
+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";
+import {
+ type InfiniteData,
+ keepPreviousData,
+ useInfiniteQuery,
+} from "@tanstack/react-query";
+
+export type OriginFilter = "all" | "builder" | "autopilot";
+
+const SEARCH_DEBOUNCE_MS = 250;
+const ARTIFACTS_PAGE_SIZE = 50;
+
+export const ARTIFACTS_LIST_QUERY_KEY = ["artifacts", "list"] as const;
+
+type ListPage = Awaited<ReturnType<typeof listWorkspaceFiles>>;
+
+export function useArtifactsPage() {
+ const [searchTerm, setSearchTerm] = useState("");
+ const [originFilter, setOriginFilter] = useState<OriginFilter>("all");
+
+ const debouncedSearch = useDebouncedValue(
+ searchTerm.trim(),
+ SEARCH_DEBOUNCE_MS,
+ );
+
+ const q = debouncedSearch || undefined;
+ const origin = originFilter === "all" ? undefined : originFilter;
+
+ const query = useInfiniteQuery({
+ queryKey: [
+ ...ARTIFACTS_LIST_QUERY_KEY,
+ { q: q ?? null, origin: origin ?? null },
+ ] as const,
+ queryFn: ({ pageParam }) =>
+ listWorkspaceFiles({
+ limit: ARTIFACTS_PAGE_SIZE,
+ offset: pageParam,
+ q,
+ origin,
+ }),
+ initialPageParam: 0,
+ getNextPageParam: (lastPage, allPages) => {
+ if (lastPage.status !== 200) return undefined;
+ if (!lastPage.data.has_more) return undefined;
+ return countLoadedFiles(allPages);
+ },
+ placeholderData: keepPreviousData,
+ });
+
+ return {
+ files: flattenFiles(query.data),
+ isLoading: query.isLoading,
+ isError: query.isError,
+ error: query.error,
+ searchTerm,
+ setSearchTerm,
+ debouncedSearch,
+ originFilter,
+ setOriginFilter,
+ hasMore: !!query.hasNextPage,
+ isLoadingMore: query.isFetchingNextPage,
+ loadMore: () => {
+ query.fetchNextPage();
+ },
+ };
+}
+
+function flattenFiles(
+ data: InfiniteData<ListPage> | undefined,
+): WorkspaceFileItem[] {
+ if (!data) return [];
+ return data.pages.flatMap((page) =>
+ page.status === 200 ? (page.data.files ?? []) : [],
+ );
+}
+
+function countLoadedFiles(pages: ListPage[]): number {
+ return pages.reduce(
+ (acc, page) =>
+ acc + (page.status === 200 ? (page.data.files?.length ?? 0) : 0),
+ 0,
+ );
+}
+
+function useDebouncedValue<T>(value: T, delayMs: number): T {
+ const [debounced, setDebounced] = useState(value);
+ useEffect(() => {
+ const handle = setTimeout(() => setDebounced(value), delayMs);
+ return () => clearTimeout(handle);
+ }, [value, delayMs]);
+ return debounced;
+}
diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.json
index 21a6a8fa3e..5fafb0d73b 100644
--- a/autogpt_platform/frontend/src/app/api/openapi.json
+++ b/autogpt_platform/frontend/src/app/api/openapi.json
@@ -9767,7 +9767,7 @@
"get": {
"tags": ["workspace"],
"summary": "List workspace files",
- "description": "List files in the user's workspace.\n\nWhen session_id is provided, only files for that session are returned.\nOtherwise, all files across sessions are listed. Results are paginated\nvia `limit`/`offset`; `has_more` indicates whether additional pages exist.",
+ "description": "List files in the user's workspace.\n\nWhen session_id is provided, only files for that session are returned.\nOtherwise, all files across sessions are listed. Results are paginated\nvia `limit`/`offset`; `has_more` indicates whether additional pages exist.\n\nThe Artifacts page uses ``q`` for name search and ``origin`` to filter\nbetween Builder (root-level) and Autopilot (session-scoped) uploads.",
"operationId": "listWorkspaceFiles",
"security": [{ "HTTPBearerJWT": [] }],
"parameters": [
@@ -9802,6 +9802,31 @@
"default": 0,
"title": "Offset"
}
+ },
+ {
+ "name": "q",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "description": "Case-insensitive substring search on file name. Applied in the database for fresh results without waiting on embedding generation.",
+ "title": "Q"
+ },
+ "description": "Case-insensitive substring search on file name. Applied in the database for fresh results without waiting on embedding generation."
+ },
+ {
+ "name": "origin",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "anyOf": [
+ { "enum": ["builder", "autopilot"], "type": "string" },
+ { "type": "null" }
+ ],
+ "description": "Filter by upload origin. ``autopilot`` matches files stored under ``/sessions/...`` (CoPilot chat uploads); ``builder`` matches everything else. Ignored when ``session_id`` is set (session scoping already implies origin).",
+ "title": "Origin"
+ },
+ "description": "Filter by upload origin. ``autopilot`` matches files stored under ``/sessions/...`` (CoPilot chat uploads); ``builder`` matches everything else. Ignored when ``session_id`` is set (session scoping already implies origin)."
}
],
"responses": {
diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx
index 8272af5bc8..fcd600546e 100644
--- a/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx
+++ b/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx
@@ -10,6 +10,7 @@ import { NAVBAR_HEIGHT_PX } from "@/lib/constants";
import { useBreakpoint } from "@/lib/hooks/useBreakpoint";
import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
import { environment } from "@/services/environment";
+import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
import { AccountMenu } from "./components/AccountMenu/AccountMenu";
import { FeedbackButton } from "./components/FeedbackButton";
import { AgentActivityDropdown } from "./components/AgentActivityDropdown/AgentActivityDropdown";
@@ -20,6 +21,19 @@ import { NavbarLoading } from "./components/NavbarLoading";
import { Wallet } from "./components/Wallet/Wallet";
import { getAccountMenuItems, loggedInLinks, loggedOutLinks } from "./helpers";
+const MOBILE_NAV_ICONS: Readonly<Record<string, IconType>> = {
+ "/marketplace": IconType.Marketplace,
+ "/build": IconType.Builder,
+ "/copilot": IconType.Chat,
+ "/library": IconType.Library,
+ "/artifacts": IconType.UploadCloud,
+ "/monitor": IconType.Library,
+};
+
+function pickMobileNavIcon(href: string): IconType {
+ return MOBILE_NAV_ICONS[href] ?? IconType.LayoutDashboard;
+}
+
export function Navbar() {
const { user, isLoggedIn, isUserLoading } = useSupabase();
const breakpoint = useBreakpoint();
@@ -43,9 +57,12 @@ export function Navbar() {
const shouldShowPreviewBanner = Boolean(isLoggedIn && previewBranchName);
+ const isArtifactsEnabled = useGetFlag(Flag.ARTIFACTS_PAGE);
+
const actualLoggedInLinks = [
{ name: "Home", href: "/copilot" },
{ name: "Agents", href: "/library" },
+ ...(isArtifactsEnabled ? [{ name: "Artifacts", href: "/artifacts" }] : []),
...loggedInLinks,
];
@@ -123,30 +140,11 @@ export function Navbar() {
menuItemGroups={[
{
groupName: "Navigation",
- items: actualLoggedInLinks
- .map((link) => {
- return {
- icon:
- link.href === "/marketplace"
- ? IconType.Marketplace
- : link.href === "/build"
- ? IconType.Builder
- : link.href === "/copilot"
- ? IconType.Chat
- : link.href === "/library"
- ? IconType.Library
- : link.href === "/monitor"
- ? IconType.Library
- : IconType.LayoutDashboard,
- text: link.name,
- href: link.href,
- };
- })
- .filter((item) => item !== null) as Array<{
- icon: IconType;
- text: string;
- href: string;
- }>,
+ items: actualLoggedInLinks.map((link) => ({
+ icon: pickMobileNavIcon(link.href),
+ text: link.name,
+ href: link.href,
+ })),
},
...dynamicMenuItems,
]}
diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLink.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLink.tsx
index cc9f919dbc..18ec893c8e 100644
--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLink.tsx
+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/NavbarLink.tsx
@@ -1,7 +1,11 @@
"use client";
import { cn } from "@/lib/utils";
-import { Laptop, ListChecksIcon } from "@phosphor-icons/react/dist/ssr";
+import {
+ FilesIcon,
+ Laptop,
+ ListChecksIcon,
+} from "@phosphor-icons/react/dist/ssr";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { Text } from "../../../atoms/Text/Text";
@@ -82,6 +86,14 @@ export function NavbarLink({ name, href }: Props) {
)}
/>
)}
+ {href === "/artifacts" && (
+ <FilesIcon
+ className={cn(
+ "h-5 w-5 shrink-0",
+ isActive && "text-white dark:text-black",
+ )}
+ />
+ )}
<Text
variant="h5"
className={cn(
diff --git a/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts b/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts
index bb297d5e34..977fa69fda 100644
--- a/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts
+++ b/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts
@@ -3,12 +3,14 @@
import { DEFAULT_SEARCH_TERMS } from "@/app/(platform)/marketplace/components/HeroSection/helpers";
import { environment } from "@/services/environment";
import { useFlags } from "launchdarkly-react-client-sdk";
+import { useEffect, useState } from "react";
export enum Flag {
BETA_BLOCKS = "beta-blocks",
MARKETPLACE_SEARCH_TERMS = "marketplace-search-terms",
ENABLE_PLATFORM_PAYMENT = "enable-platform-payment",
ARTIFACTS = "artifacts",
+ ARTIFACTS_PAGE = "artifacts-page",
CHAT_MODE_OPTION = "chat-mode-option",
BUILDER_CHAT_PANEL = "builder-chat-panel",
AGENT_BRIEFING = "agent-briefing",
@@ -24,6 +26,7 @@ const defaultFlags = {
[Flag.MARKETPLACE_SEARCH_TERMS]: DEFAULT_SEARCH_TERMS,
[Flag.ENABLE_PLATFORM_PAYMENT]: false,
[Flag.ARTIFACTS]: false,
+ [Flag.ARTIFACTS_PAGE]: false,
[Flag.CHAT_MODE_OPTION]: false,
[Flag.BUILDER_CHAT_PANEL]: false,
[Flag.AGENT_BRIEFING]: false,
@@ -61,6 +64,8 @@ function readEnvOverride(flag: Flag): string | undefined {
return process.env.NEXT_PUBLIC_FORCE_FLAG_ENABLE_PLATFORM_PAYMENT;
case Flag.ARTIFACTS:
return process.env.NEXT_PUBLIC_FORCE_FLAG_ARTIFACTS;
+ case Flag.ARTIFACTS_PAGE:
+ return process.env.NEXT_PUBLIC_FORCE_FLAG_ARTIFACTS_PAGE;
case Flag.CHAT_MODE_OPTION:
return process.env.NEXT_PUBLIC_FORCE_FLAG_CHAT_MODE_OPTION;
case Flag.BUILDER_CHAT_PANEL:
@@ -71,6 +76,8 @@ function readEnvOverride(flag: Flag): string | undefined {
return process.env.NEXT_PUBLIC_FORCE_FLAG_GENERIC_TRIGGER_AGENTS;
case Flag.CHAT_SEARCH:
return process.env.NEXT_PUBLIC_FORCE_FLAG_CHAT_SEARCH;
+ case Flag.CHAT_SHARING:
+ return process.env.NEXT_PUBLIC_FORCE_FLAG_CHAT_SHARING;
}
}
@@ -116,3 +123,43 @@ export function useGetFlag<T extends Flag>(flag: T): FlagValues[T] {
return flagValue ?? defaultFlags[flag];
}
+
+const FLAG_RESOLUTION_TIMEOUT_MS = 5000;
+
+/**
+ * Same as ``useGetFlag`` but also surfaces whether LaunchDarkly has
+ * actually answered for this flag. Callers that gate a whole route on a
+ * flag should branch on ``ready`` first — short-circuiting to
+ * ``notFound()`` before LD responds 404s users that actually have the
+ * flag on. Falls back to "ready" after ``FLAG_RESOLUTION_TIMEOUT_MS`` so
+ * a flag key that LD never registers doesn't spin forever.
+ */
+export function useFlagStatus<T extends Flag>(
+ flag: T,
+): { enabled: FlagValues[T]; ready: boolean } {
+ const currentFlags = useFlags<FlagValues>();
+ const areFlagsEnabled = environment.areFeatureFlagsEnabled();
+ const override = envFlagOverride(flag);
+
+ const [timedOut, setTimedOut] = useState(false);
+ useEffect(() => {
+ const timer = setTimeout(
+ () => setTimedOut(true),
+ FLAG_RESOLUTION_TIMEOUT_MS,
+ );
+ return () => clearTimeout(timer);
+ }, []);
+
+ if (override !== undefined) {
+ return { enabled: override, ready: true };
+ }
+ if (!areFlagsEnabled || isPwMockEnabled) {
+ return { enabled: defaultFlags[flag], ready: true };
+ }
+
+ const ldResponded = flag in currentFlags;
+ return {
+ enabled: (currentFlags[flag] ?? defaultFlags[flag]) as FlagValues[T],
+ ready: ldResponded || timedOut,
+ };
+}
diff --git a/autogpt_platform/frontend/tailwind.config.ts b/autogpt_platform/frontend/tailwind.config.ts
index 76cd15ff0a..d4befe562e 100644
--- a/autogpt_platform/frontend/tailwind.config.ts
+++ b/autogpt_platform/frontend/tailwind.config.ts
@@ -199,6 +199,14 @@ const config = {
"0%": { backgroundPosition: "50% 50%, 50% 50%" },
"100%": { backgroundPosition: "350% 50%, 350% 50%" },
},
+ "marquee-x": {
+ "0%": { transform: "translateX(0)" },
+ "100%": { transform: "translateX(-50%)" },
+ },
+ "progress-bar": {
+ "0%": { transform: "translateX(-100%)" },
+ "100%": { transform: "translateX(400%)" },
+ },
},
animation: {
"accordion-down": "accordion-down 0.2s ease-out",
@@ -214,6 +222,9 @@ const config = {
loader: "loader 1s infinite",
shake: "shake 0.5s ease-in-out",
aurora: "aurora 60s linear infinite",
+ "marquee-x": "marquee-x 40s linear infinite",
+ "progress-bar":
+ "progress-bar 1.4s cubic-bezier(0.65, 0, 0.35, 1) infinite",
},
transitionDuration: {
"2000": "2000ms",