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(platform): creator dashboard polish + MCP setup + settings link cleanup (#12979)
Abhimanyu Yadavb13fb10625d8
diff --git a/autogpt_platform/backend/backend/api/features/store/db.py b/autogpt_platform/backend/backend/api/features/store/db.pyindex e68f6db9ed..76d2af8677 100644--- a/autogpt_platform/backend/backend/api/features/store/db.py+++ b/autogpt_platform/backend/backend/api/features/store/db.py@@ -607,6 +607,53 @@ async def get_store_creator(raise DatabaseError("Failed to fetch creator details") from e+async def _get_submission_stats(user_id: str) -> store_model.SubmissionStats:+ """Compute creator-wide submission aggregates in a single round-trip.++ Uses Postgres FILTER clauses so all five aggregates land in one query —+ cheaper than five separate counts/sums and immune to the pagination+ undercount that client-side aggregation suffers from.+ """+ # average_rating is weighted by review_count so a submission with 1,000+ # reviews counts proportionally more than one with a single review;+ # straight AVG would over-represent low-volume submissions.+ sql = """+ SELECT+ COUNT(*)::int AS total,+ COUNT(*) FILTER (WHERE status = 'APPROVED')::int AS approved,+ COUNT(*) FILTER (WHERE status = 'PENDING')::int AS pending,+ COALESCE(SUM(run_count), 0)::bigint AS total_runs,+ (+ SUM(review_avg_rating * review_count)+ FILTER (WHERE review_count > 0 AND review_avg_rating > 0)+ )::double precision+ / NULLIF(+ SUM(review_count) FILTER (+ WHERE review_count > 0 AND review_avg_rating > 0+ ),+ 0+ ) AS average_rating+ FROM {schema_prefix}"StoreSubmission"+ WHERE user_id = $1 AND is_deleted = false+ """+ rows = await query_raw_with_schema(+ sql,+ user_id,+ model=store_model.SubmissionStats,+ )+ return (+ rows[0]+ if rows+ else store_model.SubmissionStats(+ total=0,+ approved=0,+ pending=0,+ total_runs=0,+ average_rating=None,+ )+ )++async def get_store_submissions(user_id: str, page: int = 1, page_size: int = 20) -> store_model.StoreSubmissionsResponse:@@ -614,27 +661,29 @@ async def get_store_submissions(logger.debug(f"Getting store submissions for user {user_id}, page={page}")try:- # Calculate pagination valuesskip = (page - 1) * page_sizewhere: prisma.types.StoreSubmissionWhereInput = {"user_id": user_id,"is_deleted": False,}- # Query submissions from database- submissions = await prisma.models.StoreSubmission.prisma().find_many(- where=where,- skip=skip,- take=page_size,- order=[{"submitted_at": "desc"}],- )- # Get total count for pagination- total = await prisma.models.StoreSubmission.prisma().count(where=where)+ # Page rows and creator-wide stats run concurrently — stats already+ # returns COUNT(*) over the same filter, so we reuse it for pagination+ # instead of issuing a redundant count query.+ submissions, stats = await asyncio.gather(+ prisma.models.StoreSubmission.prisma().find_many(+ where=where,+ skip=skip,+ take=page_size,+ order=[{"submitted_at": "desc"}],+ ),+ _get_submission_stats(user_id),+ )+ total = stats.totaltotal_pages = (total + page_size - 1) // page_size- # Convert to response models (internal_comments omitted for regular users)submission_models = [store_model.StoreSubmission.from_db(sub) for sub in submissions]@@ -648,6 +697,7 @@ async def get_store_submissions(total_pages=total_pages,page_size=page_size,),+ stats=stats,)except Exception as e:@@ -661,6 +711,13 @@ async def get_store_submissions(total_pages=0,page_size=page_size,),+ stats=store_model.SubmissionStats(+ total=0,+ approved=0,+ pending=0,+ total_runs=0,+ average_rating=None,+ ),)diff --git a/autogpt_platform/backend/backend/api/features/store/db_test.py b/autogpt_platform/backend/backend/api/features/store/db_test.pyindex 9fd3996b33..12b0d3e21e 100644--- a/autogpt_platform/backend/backend/api/features/store/db_test.py+++ b/autogpt_platform/backend/backend/api/features/store/db_test.py@@ -8,7 +8,7 @@ import pytestfrom prisma import Prismafrom . import db-from .model import Profile+from .model import Profile, SubmissionStats@pytest.fixture(autouse=True)@@ -428,3 +428,137 @@ async def test_get_store_creators_only_returns_approved(mocker):_, count_kwargs = mock_creator.return_value.count.call_argsassert find_kwargs["where"]["num_agents"] == {"gt": 0}assert count_kwargs["where"]["num_agents"] == {"gt": 0}++[email protected](loop_scope="session")+async def test_get_submission_stats_maps_row_to_pydantic(mocker):+ """The single FILTER aggregate query result maps cleanly into SubmissionStats."""+ query_mock = mocker.patch(+ "backend.api.features.store.db.query_raw_with_schema",+ AsyncMock(+ return_value=[+ SubmissionStats(+ total=4,+ approved=2,+ pending=1,+ total_runs=360,+ average_rating=4.5,+ )+ ]+ ),+ )++ result = await db._get_submission_stats("user-id")++ assert result.total == 4+ assert result.approved == 2+ assert result.pending == 1+ assert result.total_runs == 360+ assert result.average_rating == 4.5+ assert query_mock.await_args.kwargs["model"] is SubmissionStats++[email protected](loop_scope="session")+async def test_get_submission_stats_handles_empty_creator(mocker):+ """No submissions → COUNT/SUM yield zeros and NULL avg, mapped to zeros + None."""+ mocker.patch(+ "backend.api.features.store.db.query_raw_with_schema",+ AsyncMock(+ return_value=[+ SubmissionStats(+ total=0,+ approved=0,+ pending=0,+ total_runs=0,+ average_rating=None,+ )+ ]+ ),+ )++ result = await db._get_submission_stats("user-id")++ assert result.total == 0+ assert result.approved == 0+ assert result.pending == 0+ assert result.total_runs == 0+ assert result.average_rating is None++[email protected](loop_scope="session")+async def test_get_submission_stats_handles_no_rows(mocker):+ """Defensive: empty query result still produces a valid zeroed payload."""+ mocker.patch(+ "backend.api.features.store.db.query_raw_with_schema",+ AsyncMock(return_value=[]),+ )++ result = await db._get_submission_stats("user-id")++ assert result.total == 0+ assert result.approved == 0+ assert result.average_rating is None++[email protected](loop_scope="session")+async def test_get_store_submissions_reuses_stats_total_for_pagination(mocker):+ """get_store_submissions should not issue a separate COUNT — it should pull+ `total` off the stats payload returned from _get_submission_stats."""+ mock_submission = prisma.models.StoreSubmission(+ listing_id="listing-1",+ user_id="user-id",+ slug="agent",+ listing_version_id="lv-1",+ listing_version=1,+ graph_id="graph-1",+ graph_version=1,+ name="Test",+ sub_heading="sh",+ description="desc",+ instructions=None,+ categories=[],+ image_urls=[],+ video_url=None,+ agent_output_demo_url=None,+ submitted_at=datetime.now(),+ changes_summary=None,+ status=prisma.enums.SubmissionStatus.APPROVED,+ reviewed_at=None,+ reviewer_id=None,+ review_comments=None,+ internal_comments=None,+ is_deleted=False,+ run_count=10,+ review_count=2,+ review_avg_rating=4.0,+ )++ mock_store_sub = mocker.patch("prisma.models.StoreSubmission.prisma")+ mock_store_sub.return_value.find_many = AsyncMock(return_value=[mock_submission])+ # If the implementation regresses to issuing a count(), this surfaces the+ # bug because we explicitly do NOT register a count mock.+ mock_store_sub.return_value.count = AsyncMock(+ side_effect=AssertionError("count() must not be called"),+ )++ mocker.patch(+ "backend.api.features.store.db.query_raw_with_schema",+ AsyncMock(+ return_value=[+ SubmissionStats(+ total=7,+ approved=3,+ pending=2,+ total_runs=99,+ average_rating=3.9,+ )+ ]+ ),+ )++ result = await db.get_store_submissions(user_id="user-id", page=1, page_size=20)++ assert result.pagination.total_items == 7+ assert result.stats.total == 7+ assert result.stats.average_rating == 3.9+ mock_store_sub.return_value.count.assert_not_called()diff --git a/autogpt_platform/backend/backend/api/features/store/model.py b/autogpt_platform/backend/backend/api/features/store/model.pyindex d7de01a2b4..5fc55c24e5 100644--- a/autogpt_platform/backend/backend/api/features/store/model.py+++ b/autogpt_platform/backend/backend/api/features/store/model.py@@ -268,9 +268,25 @@ class StoreSubmission(pydantic.BaseModel):)+class SubmissionStats(pydantic.BaseModel):+ """Creator-wide aggregates over a user's non-deleted submissions.++ Computed server-side so values stay accurate regardless of pagination —+ summing client-side over the current page silently undercounts once the+ creator has more submissions than fit on one page.+ """++ total: int+ approved: int+ pending: int+ total_runs: int+ average_rating: float | None++class StoreSubmissionsResponse(pydantic.BaseModel):submissions: list[StoreSubmission]pagination: Pagination+ stats: SubmissionStatsclass StoreSubmissionRequest(pydantic.BaseModel):diff --git a/autogpt_platform/backend/backend/api/features/store/routes_test.py b/autogpt_platform/backend/backend/api/features/store/routes_test.pyindex 862db04a67..65b85a4baa 100644--- a/autogpt_platform/backend/backend/api/features/store/routes_test.py+++ b/autogpt_platform/backend/backend/api/features/store/routes_test.py@@ -562,6 +562,13 @@ def test_get_submissions_success(total_pages=1,page_size=20,),+ stats=store_model.SubmissionStats(+ total=1,+ approved=1,+ pending=0,+ total_runs=50,+ average_rating=4.2,+ ),)mock_db_call = mocker.patch("backend.api.features.store.db.get_store_submissions")mock_db_call.return_value = mocked_value@@ -573,6 +580,8 @@ def test_get_submissions_success(assert len(data.submissions) == 1assert data.submissions[0].name == "Test Agent"assert data.pagination.current_page == 1+ assert data.stats.total == 1+ assert data.stats.total_runs == 50snapshot.snapshot_dir = "snapshots"snapshot.assert_match(json.dumps(response.json(), indent=2), "sub_success")mock_db_call.assert_called_once_with(user_id=test_user_id, page=1, page_size=20)@@ -591,6 +600,13 @@ def test_get_submissions_pagination(total_pages=2,page_size=5,),+ stats=store_model.SubmissionStats(+ total=10,+ approved=4,+ pending=3,+ total_runs=12_345,+ average_rating=3.7,+ ),)mock_db_call = mocker.patch("backend.api.features.store.db.get_store_submissions")mock_db_call.return_value = mocked_valuediff --git a/autogpt_platform/backend/backend/data/db.py b/autogpt_platform/backend/backend/data/db.pyindex 38d7f3fa7f..d3084af487 100644--- a/autogpt_platform/backend/backend/data/db.py+++ b/autogpt_platform/backend/backend/data/db.py@@ -2,6 +2,7 @@ import loggingimport osfrom contextlib import asynccontextmanagerfrom datetime import timedelta+from typing import TypeVar, overloadfrom urllib.parse import parse_qsl, urlencode, urlparse, urlunparsefrom uuid import uuid4@@ -52,6 +53,7 @@ prisma = Prisma(logger = logging.getLogger(__name__)+RawQueryModelT = TypeVar("RawQueryModelT", bound=BaseModel)def is_connected():@@ -117,7 +119,8 @@ async def _raw_with_schema(*args,execute: bool = False,client: Prisma | None = None,-) -> list[dict] | int:+ model: type[RawQueryModelT] | None = None,+) -> list[dict] | list[RawQueryModelT] | int:"""Internal: Execute raw SQL with proper schema handling.Use query_raw_with_schema() or execute_raw_with_schema() instead.@@ -162,12 +165,28 @@ async def _raw_with_schema(if execute:result = await db_client.execute_raw(formatted_query, *args) # type: ignoreelse:- result = await db_client.query_raw(formatted_query, *args) # type: ignore+ result = await db_client.query_raw(formatted_query, *args, model=model) # type: ignorereturn result-async def query_raw_with_schema(query_template: str, *args) -> list[dict]:+@overload+async def query_raw_with_schema(query_template: str, *args) -> list[dict]: ...+++@overload+async def query_raw_with_schema(+ query_template: str,+ *args,+ model: type[RawQueryModelT],+) -> list[RawQueryModelT]: ...+++async def query_raw_with_schema(+ query_template: str,+ *args,+ model: type[RawQueryModelT] | None = None,+) -> list[dict] | list[RawQueryModelT]:"""Execute raw SQL SELECT query with proper schema handling.Args:@@ -183,7 +202,12 @@ async def query_raw_with_schema(query_template: str, *args) -> list[dict]:user_id)"""- return await _raw_with_schema(query_template, *args, execute=False) # type: ignore+ return await _raw_with_schema(+ query_template,+ *args,+ execute=False,+ model=model,+ ) # type: ignoreasync def execute_raw_with_schema(diff --git a/autogpt_platform/backend/snapshots/sub_pagination b/autogpt_platform/backend/snapshots/sub_paginationindex 7bc1cb9b57..8c903b4b88 100644--- a/autogpt_platform/backend/snapshots/sub_pagination+++ b/autogpt_platform/backend/snapshots/sub_pagination@@ -5,5 +5,12 @@"total_pages": 2,"current_page": 2,"page_size": 5+ },+ "stats": {+ "total": 10,+ "approved": 4,+ "pending": 3,+ "total_runs": 12345,+ "average_rating": 3.7}}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/sub_success b/autogpt_platform/backend/snapshots/sub_successindex abd56f99d9..0870e01628 100644--- a/autogpt_platform/backend/snapshots/sub_success+++ b/autogpt_platform/backend/snapshots/sub_success@@ -36,5 +36,12 @@"total_pages": 1,"current_page": 1,"page_size": 20+ },+ "stats": {+ "total": 1,+ "approved": 1,+ "pending": 0,+ "total_runs": 50,+ "average_rating": 4.2}}\ No newline at end of filediff --git a/autogpt_platform/frontend/src/app/(platform)/auth/integrations/setup-wizard/page.tsx b/autogpt_platform/frontend/src/app/(platform)/auth/integrations/setup-wizard/page.tsxindex 9e2e637ef6..e369faf072 100644--- a/autogpt_platform/frontend/src/app/(platform)/auth/integrations/setup-wizard/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/auth/integrations/setup-wizard/page.tsx@@ -315,7 +315,7 @@ export default function IntegrationSetupWizardPage() {<Text variant="small" className="text-center text-slate-500">You can view and manage all your integrations in your{" "}<Link- href="/profile/integrations"+ href="/settings/integrations"target="_blank"className="text-purple-600 underline hover:text-purple-800">diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderActions/components/CronSchedulerDialog/CronSchedulerDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderActions/components/CronSchedulerDialog/CronSchedulerDialog.tsxindex b6ec73eb9a..e6a0023e25 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderActions/components/CronSchedulerDialog/CronSchedulerDialog.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderActions/components/CronSchedulerDialog/CronSchedulerDialog.tsx@@ -69,7 +69,7 @@ export function CronSchedulerDialog({<InfoIcon className="h-4 w-4 text-amber-600" /><Text variant="body" className="text-amber-800">No timezone set. Schedule will run in UTC.- <a href="/profile/settings" className="ml-1 underline">+ <a href="/settings/account" className="ml-1 underline">Set your timezone</a></Text>diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/modals/ScheduleAgentModal/components/TimezoneNotice/TimezoneNotice.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/modals/ScheduleAgentModal/components/TimezoneNotice/TimezoneNotice.tsxindex 97ee4605f2..cd3e803905 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/modals/ScheduleAgentModal/components/TimezoneNotice/TimezoneNotice.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/modals/ScheduleAgentModal/components/TimezoneNotice/TimezoneNotice.tsx@@ -15,7 +15,7 @@ export function TimezoneNotice() {<InfoIcon className="h-4 w-4 text-amber-600" /><p className="text-sm text-amber-800">No timezone set. Schedule will run in UTC.- <a href="/profile/settings" className="ml-1 underline">+ <a href="/settings/account" className="ml-1 underline">Set your timezone</a></p>diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/__tests__/SettingsIndexPage.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/__tests__/SettingsIndexPage.test.tsxnew file mode 100644index 0000000000..ce06971e07--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/__tests__/SettingsIndexPage.test.tsx@@ -0,0 +1,47 @@+import { afterEach, describe, expect, it, vi } from "vitest";++import { cleanup, render, waitFor } from "@/tests/integrations/test-utils";++const { mockReplace } = vi.hoisted(() => ({ mockReplace: vi.fn() }));++vi.mock("next/navigation", () => ({+ useRouter: () => ({+ replace: mockReplace,+ push: vi.fn(),+ prefetch: vi.fn(),+ back: vi.fn(),+ forward: vi.fn(),+ refresh: vi.fn(),+ }),+ usePathname: () => "/settings",+ useSearchParams: () => new URLSearchParams(),+ useParams: () => ({}),+}));++import SettingsIndexPage from "../page";++describe("Settings index page", () => {+ afterEach(() => {+ mockReplace.mockClear();+ cleanup();+ });++ it("renders a polite content skeleton during the client-side redirect", () => {+ const { container } = render(<SettingsIndexPage />);++ const region = container.querySelector('[aria-busy="true"]');+ expect(region).not.toBeNull();+ expect(region?.getAttribute("aria-live")).toBe("polite");+ // Skeleton placeholders for header + sub + 3 sections+ expect(+ container.querySelectorAll('[aria-busy="true"] > div').length,+ ).toBeGreaterThanOrEqual(5);+ });++ it("redirects to /settings/profile via router.replace", async () => {+ render(<SettingsIndexPage />);+ await waitFor(() => {+ expect(mockReplace).toHaveBeenCalledWith("/settings/profile");+ });+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-hooks.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-hooks.test.tsxindex 6b96566867..164b309035 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-hooks.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/settings/billing/__tests__/billing-hooks.test.tsx@@ -490,7 +490,7 @@ describe("useYourPlanCard", () => {});expect(openSpy).toHaveBeenCalledWith(- expect.stringContaining("contact-sales"),+ expect.stringContaining("tally.so"),"_blank","noopener,noreferrer",);diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/useYourPlanCard.ts b/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/useYourPlanCard.tsindex 786cd79017..89d4e66d7e 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/useYourPlanCard.ts+++ b/autogpt_platform/frontend/src/app/(platform)/settings/billing/components/SubscriptionTab/YourPlanCard/useYourPlanCard.ts@@ -19,10 +19,9 @@ const PLAN_LABEL: Record<string, string> = {BUSINESS: "Team",};-// Team upgrade is contact-sales — open this page rather than firing a-// Stripe Checkout from the BUSINESS tier. Replace once marketing publishes-// the canonical sales URL.-export const TEAM_UPGRADE_URL = "https://agpt.co/contact-sales";+// Team upgrade is contact-sales — open the Tally intake form rather than+// firing a Stripe Checkout from the BUSINESS tier.+export const TEAM_UPGRADE_URL = "https://tally.so/r/2Eb9zj";// User-visible paid plans only. NO_TIER is the "no active subscription" state// (gates the platform via PaywallGate); BASIC + ENTERPRISE are reserveddiff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/helpers.test.tsindex 2808b373cc..c6f9f766b7 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/helpers.test.ts+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/helpers.test.ts@@ -5,7 +5,7 @@ import type { StoreSubmission } from "@/app/api/__generated__/models/storeSubmisimport {applyFiltersAndSort,- computeStats,+ EMPTY_DASHBOARD_STATS,filterSubmissions,formatRuns,formatSubmittedAt,@@ -15,6 +15,7 @@ import {STATUS_FILTERS,STATUS_OPTIONS,STATUS_VISUAL,+ toDashboardStats,type FilterState,} from "../helpers";@@ -219,41 +220,21 @@ describe("creator-dashboard helpers", () => {});});- describe("computeStats", () => {- test("returns zeroed stats with null average for empty list", () => {- expect(computeStats([])).toEqual({- total: 0,- approved: 0,- pending: 0,- totalRuns: 0,- averageRating: null,- });+ describe("toDashboardStats", () => {+ test("returns zeroed stats with null average when stats are missing", () => {+ expect(toDashboardStats(undefined)).toEqual(EMPTY_DASHBOARD_STATS);});- test("aggregates totals, approved, pending, runs, and average rating", () => {- const list = [- makeSubmission({- status: SubmissionStatus.APPROVED,- run_count: 100,- review_avg_rating: 4,- }),- makeSubmission({- status: SubmissionStatus.APPROVED,- run_count: 200,- review_avg_rating: 5,- }),- makeSubmission({- status: SubmissionStatus.PENDING,- run_count: 50,- review_avg_rating: 0,- }),- makeSubmission({- status: SubmissionStatus.REJECTED,- run_count: 10,+ test("maps server SubmissionStats into camelCase DashboardStats", () => {+ expect(+ toDashboardStats({+ total: 4,+ approved: 2,+ pending: 1,+ total_runs: 360,+ average_rating: 4.5,}),- ];-- expect(computeStats(list)).toEqual({+ ).toEqual({total: 4,approved: 2,pending: 1,@@ -262,12 +243,16 @@ describe("creator-dashboard helpers", () => {});});- test("returns null average when no submission has a positive rating", () => {- const list = [- makeSubmission({ review_avg_rating: 0 }),- makeSubmission({ review_avg_rating: undefined }),- ];- expect(computeStats(list).averageRating).toBeNull();+ test("preserves null average when no submission has a positive rating", () => {+ expect(+ toDashboardStats({+ total: 2,+ approved: 0,+ pending: 0,+ total_runs: 0,+ average_rating: null,+ }).averageRating,+ ).toBeNull();});});@@ -319,6 +304,16 @@ describe("creator-dashboard helpers", () => {expect(formatRuns(999_950)).toBe("1.0M");expect(formatRuns(999_949)).toBe("999.9K");});++ test("formats billions with B suffix", () => {+ expect(formatRuns(1_500_000_000)).toBe("1.5B");+ expect(formatRuns(12_300_000_000)).toBe("12.3B");+ });++ test("promotes near-billion boundary into B (no '1000.0M')", () => {+ expect(formatRuns(999_950_000)).toBe("1.0B");+ expect(formatRuns(999_949_999)).toBe("999.9M");+ });});describe("formatSubmittedAt", () => {diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/main.test.tsxindex 9cf8ce68be..6d7b373447 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/main.test.tsx@@ -124,6 +124,9 @@ function makeSubmission(function makeResponse(submissions: StoreSubmission[],): StoreSubmissionsResponse {+ const ratings = submissions+ .map((s) => s.review_avg_rating ?? 0)+ .filter((r) => r > 0);return {submissions,pagination: {@@ -132,6 +135,19 @@ function makeResponse(current_page: 1,page_size: submissions.length || 20,},+ stats: {+ total: submissions.length,+ approved: submissions.filter(+ (s) => s.status === SubmissionStatus.APPROVED,+ ).length,+ pending: submissions.filter((s) => s.status === SubmissionStatus.PENDING)+ .length,+ total_runs: submissions.reduce((sum, s) => sum + (s.run_count ?? 0), 0),+ average_rating:+ ratings.length > 0+ ? ratings.reduce((a, b) => a + b, 0) / ratings.length+ : null,+ },};}@@ -311,30 +327,6 @@ describe("SettingsCreatorDashboardPage", () => {});});- test("approved submissions cannot be selected (no checkbox rendered)", async () => {- server.use(- getGetV2ListMySubmissionsMockHandler(- makeResponse([- makeSubmission({- listing_version_id: "lv-approved",- name: "Approved Agent",- status: SubmissionStatus.APPROVED,- }),- ]),- ),- );-- render(<SettingsCreatorDashboardPage />);-- expect(- (await screen.findAllByText("Approved Agent")).length,- ).toBeGreaterThan(0);-- expect(- screen.queryByRole("checkbox", { name: /select approved agent/i }),- ).toBeNull();- });-test("delete failure shows a destructive toast and keeps the dialog open", async () => {server.use(getGetV2ListMySubmissionsMockHandler(@@ -378,46 +370,6 @@ describe("SettingsCreatorDashboardPage", () => {});});- test("bulk delete failure shows a partial-success destructive toast", async () => {- server.use(- getGetV2ListMySubmissionsMockHandler(- makeResponse([- makeSubmission({- listing_version_id: "lv-bulk",- name: "Bulk Agent",- status: SubmissionStatus.PENDING,- }),- ]),- ),- getDeleteV2DeleteStoreSubmissionMockHandler422(),- );-- render(<SettingsCreatorDashboardPage />);-- const checkboxes = await screen.findAllByRole("checkbox", {- name: /select bulk agent/i,- });- fireEvent.click(checkboxes[0]);-- const deleteSelected = await screen.findByRole("button", {- name: /delete selected/i,- });- fireEvent.click(deleteSelected);-- const confirm = await screen.findAllByRole("button", {- name: /delete selected/i,- });- fireEvent.click(confirm[confirm.length - 1]);-- await waitFor(() => {- expect(toastSpy).toHaveBeenCalledWith(- expect.objectContaining({- variant: "destructive",- }),- );- });- });-test("editing a submission via the row dropdown opens and closes the edit modal on success", async () => {server.use(getGetV2ListMySubmissionsMockHandler(@@ -624,71 +576,4 @@ describe("SettingsCreatorDashboardPage", () => {const clearButton = await screen.findByRole("button", { name: /^clear$/i });fireEvent.click(clearButton);});-- test("selection bar exposes Select All and Deselect controls", async () => {- server.use(- getGetV2ListMySubmissionsMockHandler(- makeResponse([- makeSubmission({- listing_version_id: "lv-p1",- name: "Pending One",- status: SubmissionStatus.PENDING,- }),- makeSubmission({- listing_version_id: "lv-p2",- name: "Pending Two",- status: SubmissionStatus.PENDING,- }),- ]),- ),- );-- render(<SettingsCreatorDashboardPage />);-- const firstCheckboxes = await screen.findAllByRole("checkbox", {- name: /select pending one/i,- });- fireEvent.click(firstCheckboxes[0]);-- const selectAll = await screen.findByRole("button", {- name: /select all/i,- });- fireEvent.click(selectAll);-- await waitFor(() => {- expect(screen.queryByRole("button", { name: /select all/i })).toBeNull();- });-- const deselect = screen.getByRole("button", { name: /^deselect$/i });- fireEvent.click(deselect);-- await waitFor(() => {- expect(screen.queryByRole("button", { name: /^deselect$/i })).toBeNull();- });- });-- test("selecting a pending submission shows the bulk selection bar", async () => {- server.use(- getGetV2ListMySubmissionsMockHandler(- makeResponse([- makeSubmission({- listing_version_id: "lv-pending",- name: "Pending Agent",- status: SubmissionStatus.PENDING,- }),- ]),- ),- );-- render(<SettingsCreatorDashboardPage />);-- const checkboxes = await screen.findAllByRole("checkbox", {- name: /select pending agent/i,- });- fireEvent.click(checkboxes[0]);-- expect(- await screen.findByRole("button", { name: /delete selected/i }),- ).toBeDefined();- });});diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionItem/MobileSubmissionItem.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionItem/MobileSubmissionItem.tsxindex 47392a21d9..c47ff916db 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionItem/MobileSubmissionItem.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionItem/MobileSubmissionItem.tsx@@ -1,13 +1,12 @@"use client";import Image from "next/image";+import { motion, useReducedMotion } from "framer-motion";import {- CheckSquareIcon,DotsThreeVerticalIcon,EyeIcon,ImageBrokenIcon,PencilSimpleIcon,- SquareIcon,StarIcon,TrashIcon,} from "@phosphor-icons/react";@@ -35,21 +34,25 @@ interface EditPayload extends StoreSubmissionEditRequest {interface Props {submission: StoreSubmission;- selected: boolean;- onToggleSelected: () => void;+ rowIndex?: number;onView: (submission: StoreSubmission) => void;onEdit: (payload: EditPayload) => void;onDelete: (submissionId: string) => Promise<void>;}+const ROW_EASE = [0.16, 1, 0.3, 1] as const;+const ROW_STAGGER = 0.025;+const ROW_STAGGER_CAP = 6;+const ROW_DURATION = 0.22;+export function MobileSubmissionItem({submission,- selected,- onToggleSelected,+ rowIndex = 0,onView,onEdit,onDelete,}: Props) {+ const reduceMotion = useReducedMotion();const {canModify,handleView,@@ -67,36 +70,25 @@ export function MobileSubmissionItem({!!submission.review_avg_rating && submission.review_avg_rating > 0;return (- <article+ <motion.articledata-testid="submission-card"data-agent-id={submission.graph_id}data-submission-id={submission.listing_version_id}- data-selected={selected}- className="flex flex-col gap-3 border-b border-zinc-100 px-3 py-3 last:border-b-0 data-[selected=true]:bg-zinc-50"+ initial={reduceMotion ? false : { opacity: 0, y: 4 }}+ animate={reduceMotion ? undefined : { opacity: 1, y: 0 }}+ transition={+ reduceMotion+ ? undefined+ : {+ duration: ROW_DURATION,+ ease: ROW_EASE,+ delay: Math.min(rowIndex, ROW_STAGGER_CAP) * ROW_STAGGER,+ }+ }+ className="flex flex-col gap-3 border-b border-zinc-100 px-3 py-3 last:border-b-0"><div className="flex items-start gap-3">- {canModify ? (- <button- type="button"- role="checkbox"- aria-checked={selected}- aria-label={`Select ${submission.name}`}- onClick={onToggleSelected}- className={`mt-1 shrink-0 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-zinc-800 ${- selected- ? "text-zinc-800 hover:text-zinc-900"- : "text-zinc-500 hover:text-zinc-700"- }`}- >- {selected ? (- <CheckSquareIcon size={20} weight="fill" />- ) : (- <SquareIcon size={20} />- )}- </button>- ) : null}-- <div className="relative aspect-video w-16 shrink-0 overflow-hidden rounded-[8px] bg-zinc-100">+ <div className="relative aspect-video w-16 shrink-0 select-none overflow-hidden rounded-[8px] bg-zinc-100">{thumbnail ? (<Imagesrc={thumbnail}@@ -104,10 +96,15 @@ export function MobileSubmissionItem({fillsizes="64px"style={{ objectFit: "cover" }}+ draggable={false}+ className="pointer-events-none"/>) : (<div className="flex h-full w-full items-center justify-center">- <ImageBrokenIcon size={18} className="text-zinc-400" />+ <ImageBrokenIcon+ size={18}+ className="pointer-events-none text-zinc-400"+ /></div>)}</div>@@ -247,6 +244,6 @@ export function MobileSubmissionItem({</Dialog.Footer></Dialog.Content></Dialog>- </article>+ </motion.article>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionsList/MobileSelectionBar.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionsList/MobileSelectionBar.tsxdeleted file mode 100644index 986e3e63c3..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionsList/MobileSelectionBar.tsx+++ /dev/null@@ -1,50 +0,0 @@-"use client";--import { TrashIcon } from "@phosphor-icons/react";--import { Button } from "@/components/atoms/Button/Button";-import { Text } from "@/components/atoms/Text/Text";--interface Props {- selectedCount: number;- allSelected: boolean;- onSelectAll: () => void;- onDeselectAll: () => void;- onDeleteSelected: () => void;-}--export function MobileSelectionBar({- selectedCount,- allSelected,- onSelectAll,- onDeselectAll,- onDeleteSelected,-}: Props) {- return (- <div className="flex w-full min-w-0 max-w-full flex-col gap-2 rounded-[14px] border border-zinc-200 bg-zinc-100 px-3 py-2">- <div className="flex items-center justify-between gap-2">- <Text variant="body-medium" as="span" className="text-zinc-700">- {selectedCount} selected- </Text>- <Button- variant="destructive"- size="small"- leftIcon={<TrashIcon size={14} />}- onClick={onDeleteSelected}- >- Delete- </Button>- </div>- <div className="flex flex-wrap items-center gap-2">- {!allSelected && (- <Button variant="ghost" size="small" onClick={onSelectAll}>- Select all- </Button>- )}- <Button variant="ghost" size="small" onClick={onDeselectAll}>- Deselect- </Button>- </div>- </div>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionsList/MobileSubmissionsList.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionsList/MobileSubmissionsList.tsxindex 0bd3f7bd76..b2660ffe84 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionsList/MobileSubmissionsList.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/MobileSubmissionsList/MobileSubmissionsList.tsx@@ -1,16 +1,13 @@"use client";-import { useMemo, useState } from "react";-import * as Sentry from "@sentry/nextjs";-import { AnimatePresence, motion, useReducedMotion } from "framer-motion";+import { motion, useReducedMotion } from "framer-motion";+import type { Pagination as PaginationModel } from "@/app/api/__generated__/models/pagination";import type { StoreSubmission } from "@/app/api/__generated__/models/storeSubmission";import type { StoreSubmissionEditRequest } from "@/app/api/__generated__/models/storeSubmissionEditRequest";-import { SubmissionStatus } from "@/app/api/__generated__/models/submissionStatus";+import type { SubmissionStatus } from "@/app/api/__generated__/models/submissionStatus";import { Button } from "@/components/atoms/Button/Button";import { Text } from "@/components/atoms/Text/Text";-import { Dialog } from "@/components/molecules/Dialog/Dialog";-import { toast } from "@/components/molecules/Toast/use-toast";import {EASE_OUT,@@ -19,10 +16,9 @@ import {type SortKey,} from "../../helpers";import { MobileSubmissionItem } from "../MobileSubmissionItem/MobileSubmissionItem";+import { Pagination } from "../Pagination/Pagination";import { SortColumnFilter } from "../SubmissionsList/columns/SortColumnFilter";import { StatusColumnFilter } from "../SubmissionsList/columns/StatusColumnFilter";-import { useSubmissionSelection } from "../SubmissionsList/useSubmissionSelection";-import { MobileSelectionBar } from "./MobileSelectionBar";interface EditPayload extends StoreSubmissionEditRequest {store_listing_version_id: string | undefined;@@ -32,6 +28,9 @@ interface EditPayload extends StoreSubmissionEditRequest {interface Props {submissions: StoreSubmission[];totalCount: number;+ pagination?: PaginationModel;+ onPageChange?: (page: number) => void;+ isFetching?: boolean;filterState: FilterState;onFilterChange: (next: FilterState) => void;onResetFilters: () => void;@@ -44,6 +43,9 @@ interface Props {export function MobileSubmissionsList({submissions,totalCount,+ pagination,+ onPageChange,+ isFetching,filterState,onFilterChange,onResetFilters,@@ -54,18 +56,6 @@ export function MobileSubmissionsList({}: Props) {const reduceMotion = useReducedMotion();- const selectableIds = useMemo(- () =>- submissions- .filter((s) => s.status === SubmissionStatus.PENDING)- .map((s) => s.listing_version_id),- [submissions],- );-- const selection = useSubmissionSelection(selectableIds);- const [bulkDeleteOpen, setBulkDeleteOpen] = useState(false);- const [isBulkDeleting, setIsBulkDeleting] = useState(false);-function setStatuses(statuses: SubmissionStatus[]) {onFilterChange({ ...filterState, statuses });}@@ -74,30 +64,6 @@ export function MobileSubmissionsList({onFilterChange({ ...filterState, sortKey, sortDir });}- async function handleBulkDelete() {- setIsBulkDeleting(true);- const ids = [...selection.selectedIds];- try {- const results = await Promise.allSettled(ids.map((id) => onDelete(id)));- const failed = results.filter((r) => r.status === "rejected").length;- const succeeded = ids.length - failed;- if (failed > 0) {- for (const r of results) {- if (r.status === "rejected") Sentry.captureException(r.reason);- }- toast({- title: `Deleted ${succeeded} of ${ids.length} submissions`,- description: `${failed} failed to delete. Please try again.`,- variant: "destructive",- });- }- selection.clear();- setBulkDeleteOpen(false);- } finally {- setIsBulkDeleting(false);- }- }-return (<motion.sectioninitial={reduceMotion ? false : { opacity: 0, y: 8 }}@@ -148,49 +114,13 @@ export function MobileSubmissionsList({</FilterChip></div>- <AnimatePresence initial={false}>- {selection.selectedCount > 0 && (- <motion.div- key="selection-bar"- initial={- reduceMotion- ? { opacity: 0 }- : { opacity: 0, height: 0, marginBottom: -12 }- }- animate={- reduceMotion- ? { opacity: 1 }- : { opacity: 1, height: "auto", marginBottom: 0 }- }- exit={- reduceMotion- ? { opacity: 0 }- : { opacity: 0, height: 0, marginBottom: -12 }- }- transition={{ duration: 0.2, ease: [0, 0, 0.2, 1] }}- className="overflow-hidden"- >- <MobileSelectionBar- selectedCount={selection.selectedCount}- allSelected={selection.allSelected}- onSelectAll={selection.selectAll}- onDeselectAll={selection.clear}- onDeleteSelected={() => setBulkDeleteOpen(true)}- />- </motion.div>- )}- </AnimatePresence>-<div className="w-full min-w-0 max-w-full overflow-hidden rounded-[18px] border border-zinc-200 bg-white shadow-[0_1px_2px_rgba(15,15,20,0.04)]">{submissions.length > 0 ? (- submissions.map((submission) => (+ submissions.map((submission, rowIndex) => (<MobileSubmissionItemkey={submission.listing_version_id}submission={submission}- selected={selection.isSelected(submission.listing_version_id)}- onToggleSelected={() =>- selection.toggle(submission.listing_version_id)- }+ rowIndex={rowIndex}onView={onView}onEdit={onEdit}onDelete={onDelete}@@ -206,42 +136,16 @@ export function MobileSubmissionsList({</Button></div>)}+ {pagination && onPageChange ? (+ <div className="border-t border-zinc-100">+ <Pagination+ pagination={pagination}+ onPageChange={onPageChange}+ disabled={isFetching}+ />+ </div>+ ) : null}</div>-- <Dialog- title="Delete selected submissions?"- styling={{ maxWidth: "420px" }}- controlled={{- isOpen: bulkDeleteOpen,- set: (open) => setBulkDeleteOpen(open),- }}- >- <Dialog.Content>- <Text variant="body" className="text-zinc-700">- This will remove {selection.selectedCount} submission- {selection.selectedCount === 1 ? "" : "s"} from the store. This- action cannot be undone.- </Text>- <Dialog.Footer>- <Button- variant="ghost"- size="small"- onClick={() => setBulkDeleteOpen(false)}- disabled={isBulkDeleting}- >- Cancel- </Button>- <Button- variant="destructive"- size="small"- onClick={handleBulkDelete}- loading={isBulkDeleting}- >- {isBulkDeleting ? "Deleting" : "Delete selected"}- </Button>- </Dialog.Footer>- </Dialog.Content>- </Dialog></motion.section>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/Pagination/Pagination.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/Pagination/Pagination.tsxnew file mode 100644index 0000000000..997237dc25--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/Pagination/Pagination.tsx@@ -0,0 +1,55 @@+"use client";++import { CaretLeftIcon, CaretRightIcon } from "@phosphor-icons/react";++import type { Pagination as PaginationModel } from "@/app/api/__generated__/models/pagination";+import { Button } from "@/components/atoms/Button/Button";+import { Text } from "@/components/atoms/Text/Text";++interface Props {+ pagination: PaginationModel;+ onPageChange: (page: number) => void;+ disabled?: boolean;+}++export function Pagination({ pagination, onPageChange, disabled }: Props) {+ const { current_page, total_pages, total_items, page_size } = pagination;++ if (total_pages <= 1) return null;++ const startItem = (current_page - 1) * page_size + 1;+ const endItem = Math.min(current_page * page_size, total_items);++ return (+ <div+ className="flex items-center justify-between gap-3 px-4 py-3"+ data-testid="submissions-pagination"+ >+ <Text variant="small" className="text-zinc-500">+ Showing {startItem}–{endItem} of {total_items}+ </Text>+ <div className="flex items-center gap-2">+ <Button+ variant="secondary"+ size="small"+ leftIcon={<CaretLeftIcon size={14} />}+ disabled={disabled || current_page <= 1}+ onClick={() => onPageChange(current_page - 1)}+ aria-label="Previous page"+ >+ Previous+ </Button>+ <Button+ variant="secondary"+ size="small"+ rightIcon={<CaretRightIcon size={14} />}+ disabled={disabled || current_page >= total_pages}+ onClick={() => onPageChange(current_page + 1)}+ aria-label="Next page"+ >+ Next+ </Button>+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/Pagination/__tests__/Pagination.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/Pagination/__tests__/Pagination.test.tsxnew file mode 100644index 0000000000..62887de0de--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/Pagination/__tests__/Pagination.test.tsx@@ -0,0 +1,126 @@+import { afterEach, describe, expect, it, vi } from "vitest";++import {+ cleanup,+ fireEvent,+ render,+ screen,+} from "@/tests/integrations/test-utils";++import { Pagination } from "../Pagination";++function makePagination(overrides = {}) {+ return {+ current_page: 2,+ total_pages: 5,+ total_items: 87,+ page_size: 20,+ ...overrides,+ };+}++describe("Pagination", () => {+ afterEach(() => cleanup());++ it("renders nothing when there is only one page", () => {+ const { container } = render(+ <Pagination+ pagination={makePagination({ total_pages: 1 })}+ onPageChange={() => {}}+ />,+ );+ expect(+ container.querySelector('[data-testid="submissions-pagination"]'),+ ).toBeNull();+ });++ it("renders the showing-range copy and both nav buttons", () => {+ render(+ <Pagination pagination={makePagination()} onPageChange={() => {}} />,+ );++ expect(screen.getByText(/showing 21–40 of 87/i)).toBeDefined();+ expect(+ screen.getByRole("button", { name: /previous page/i }),+ ).toBeDefined();+ expect(screen.getByRole("button", { name: /next page/i })).toBeDefined();+ });++ it("clamps the end of the visible range to total_items on the last page", () => {+ render(+ <Pagination+ pagination={makePagination({ current_page: 5, total_pages: 5 })}+ onPageChange={() => {}}+ />,+ );++ expect(screen.getByText(/showing 81–87 of 87/i)).toBeDefined();+ });++ it("disables Previous on page 1 and Next on the last page", () => {+ const { rerender } = render(+ <Pagination+ pagination={makePagination({ current_page: 1 })}+ onPageChange={() => {}}+ />,+ );+ expect(+ (+ screen.getByRole("button", {+ name: /previous page/i,+ }) as HTMLButtonElement+ ).disabled,+ ).toBe(true);++ rerender(+ <Pagination+ pagination={makePagination({ current_page: 5, total_pages: 5 })}+ onPageChange={() => {}}+ />,+ );+ expect(+ (+ screen.getByRole("button", {+ name: /next page/i,+ }) as HTMLButtonElement+ ).disabled,+ ).toBe(true);+ });++ it("invokes onPageChange with current_page ± 1 when buttons are clicked", () => {+ const onPageChange = vi.fn();+ render(+ <Pagination pagination={makePagination()} onPageChange={onPageChange} />,+ );++ fireEvent.click(screen.getByRole("button", { name: /previous page/i }));+ expect(onPageChange).toHaveBeenCalledWith(1);++ fireEvent.click(screen.getByRole("button", { name: /next page/i }));+ expect(onPageChange).toHaveBeenCalledWith(3);+ });++ it("disables both buttons when the disabled prop is true", () => {+ render(+ <Pagination+ pagination={makePagination()}+ onPageChange={() => {}}+ disabled+ />,+ );+ expect(+ (+ screen.getByRole("button", {+ name: /previous page/i,+ }) as HTMLButtonElement+ ).disabled,+ ).toBe(true);+ expect(+ (+ screen.getByRole("button", {+ name: /next page/i,+ }) as HTMLButtonElement+ ).disabled,+ ).toBe(true);+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionItem/SubmissionItem.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionItem/SubmissionItem.tsxindex cb3eb48b17..c3f9a780f3 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionItem/SubmissionItem.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionItem/SubmissionItem.tsx@@ -1,13 +1,12 @@"use client";import Image from "next/image";+import { motion, useReducedMotion } from "framer-motion";import {- CheckSquareIcon,DotsThreeVerticalIcon,EyeIcon,ImageBrokenIcon,PencilSimpleIcon,- SquareIcon,TrashIcon,} from "@phosphor-icons/react";@@ -34,21 +33,25 @@ interface EditPayload extends StoreSubmissionEditRequest {interface Props {submission: StoreSubmission;- selected: boolean;- onToggleSelected: () => void;+ rowIndex?: number;onView: (submission: StoreSubmission) => void;onEdit: (payload: EditPayload) => void;onDelete: (submissionId: string) => Promise<void>;}+const ROW_EASE = [0.16, 1, 0.3, 1] as const;+const ROW_STAGGER = 0.025;+const ROW_STAGGER_CAP = 6;+const ROW_DURATION = 0.22;+export function SubmissionItem({submission,- selected,- onToggleSelected,+ rowIndex = 0,onView,onEdit,onDelete,}: Props) {+ const reduceMotion = useReducedMotion();const {canModify,handleView,@@ -64,38 +67,26 @@ export function SubmissionItem({const thumbnail = submission.image_urls?.[0];return (- <tr+ <motion.trdata-testid="submission-row"data-agent-id={submission.graph_id}data-submission-id={submission.listing_version_id}- data-selected={selected}- className="ease-[cubic-bezier(0.16,1,0.3,1)] border-b border-zinc-100 transition-colors duration-150 last:border-b-0 data-[selected=true]:bg-zinc-100 hover:bg-zinc-50/60"+ initial={reduceMotion ? false : { opacity: 0, y: 4 }}+ animate={reduceMotion ? undefined : { opacity: 1, y: 0 }}+ transition={+ reduceMotion+ ? undefined+ : {+ duration: ROW_DURATION,+ ease: ROW_EASE,+ delay: Math.min(rowIndex, ROW_STAGGER_CAP) * ROW_STAGGER,+ }+ }+ className="ease-[cubic-bezier(0.16,1,0.3,1)] border-b border-zinc-100 transition-colors duration-150 last:border-b-0 hover:bg-zinc-50/60">- <td className="w-[48px] px-3 py-3 align-middle">- {canModify ? (- <button- type="button"- role="checkbox"- aria-checked={selected}- aria-label={`Select ${submission.name}`}- onClick={onToggleSelected}- className={`shrink-0 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-zinc-800 ${- selected- ? "text-zinc-800 hover:text-zinc-900"- : "text-zinc-500 hover:text-zinc-700"- }`}- >- {selected ? (- <CheckSquareIcon size={20} weight="fill" />- ) : (- <SquareIcon size={20} />- )}- </button>- ) : null}- </td><td className="px-4 py-3 align-middle"><div className="flex items-center gap-3">- <div className="relative aspect-video w-20 shrink-0 overflow-hidden rounded-[8px] bg-zinc-100">+ <div className="relative aspect-video w-20 shrink-0 select-none overflow-hidden rounded-[8px] bg-zinc-100">{thumbnail ? (<Imagesrc={thumbnail}@@ -103,10 +94,15 @@ export function SubmissionItem({fillsizes="80px"style={{ objectFit: "cover" }}+ draggable={false}+ className="pointer-events-none"/>) : (<div className="flex h-full w-full items-center justify-center">- <ImageBrokenIcon size={20} className="text-zinc-400" />+ <ImageBrokenIcon+ size={20}+ className="pointer-events-none text-zinc-400"+ /></div>)}</div>@@ -238,6 +234,6 @@ export function SubmissionItem({</Dialog.Content></Dialog></td>- </tr>+ </motion.tr>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionSelectionBar/SubmissionSelectionBar.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionSelectionBar/SubmissionSelectionBar.tsxdeleted file mode 100644index f669df21ae..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionSelectionBar/SubmissionSelectionBar.tsx+++ /dev/null@@ -1,46 +0,0 @@-import { TrashIcon } from "@phosphor-icons/react";--import { Button } from "@/components/atoms/Button/Button";-import { Text } from "@/components/atoms/Text/Text";--interface Props {- selectedCount: number;- allSelected: boolean;- onSelectAll: () => void;- onDeselectAll: () => void;- onDeleteSelected: () => void;-}--export function SubmissionSelectionBar({- selectedCount,- allSelected,- onSelectAll,- onDeselectAll,- onDeleteSelected,-}: Props) {- return (- <div className="flex w-full items-center justify-between rounded-[14px] border border-zinc-200 bg-zinc-100 px-4 py-2">- <div className="flex items-center gap-5">- <Text variant="body" as="span" className="text-zinc-700">- {selectedCount} selected- </Text>- {!allSelected && (- <Button variant="ghost" size="small" onClick={onSelectAll}>- Select All- </Button>- )}- <Button variant="ghost" size="small" onClick={onDeselectAll}>- Deselect- </Button>- </div>- <Button- variant="destructive"- size="small"- leftIcon={<TrashIcon size={16} />}- onClick={onDeleteSelected}- >- Delete selected- </Button>- </div>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionsList/SubmissionsList.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionsList/SubmissionsList.tsxindex 6b5be6a0a9..b7470fb011 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionsList/SubmissionsList.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionsList/SubmissionsList.tsx@@ -1,16 +1,13 @@"use client";-import { useMemo, useState } from "react";-import * as Sentry from "@sentry/nextjs";-import { AnimatePresence, motion, useReducedMotion } from "framer-motion";+import { motion, useReducedMotion } from "framer-motion";+import type { Pagination as PaginationModel } from "@/app/api/__generated__/models/pagination";import type { StoreSubmission } from "@/app/api/__generated__/models/storeSubmission";import type { StoreSubmissionEditRequest } from "@/app/api/__generated__/models/storeSubmissionEditRequest";-import { SubmissionStatus } from "@/app/api/__generated__/models/submissionStatus";+import type { SubmissionStatus } from "@/app/api/__generated__/models/submissionStatus";import { Button } from "@/components/atoms/Button/Button";import { Text } from "@/components/atoms/Text/Text";-import { Dialog } from "@/components/molecules/Dialog/Dialog";-import { toast } from "@/components/molecules/Toast/use-toast";import {EASE_OUT,@@ -18,12 +15,11 @@ import {type SortDir,type SortKey,} from "../../helpers";+import { Pagination } from "../Pagination/Pagination";import { SubmissionItem } from "../SubmissionItem/SubmissionItem";-import { SubmissionSelectionBar } from "../SubmissionSelectionBar/SubmissionSelectionBar";import { ColumnHeader } from "./columns/ColumnHeader";import { SortColumnFilter } from "./columns/SortColumnFilter";import { StatusColumnFilter } from "./columns/StatusColumnFilter";-import { useSubmissionSelection } from "./useSubmissionSelection";interface EditPayload extends StoreSubmissionEditRequest {store_listing_version_id: string | undefined;@@ -33,6 +29,9 @@ interface EditPayload extends StoreSubmissionEditRequest {interface Props {submissions: StoreSubmission[];totalCount: number;+ pagination?: PaginationModel;+ onPageChange?: (page: number) => void;+ isFetching?: boolean;filterState: FilterState;onFilterChange: (next: FilterState) => void;onResetFilters: () => void;@@ -42,11 +41,14 @@ interface Props {index?: number;}-const COLUMN_COUNT = 6;+const COLUMN_COUNT = 5;export function SubmissionsList({submissions,totalCount,+ pagination,+ onPageChange,+ isFetching,filterState,onFilterChange,onResetFilters,@@ -57,18 +59,6 @@ export function SubmissionsList({}: Props) {const reduceMotion = useReducedMotion();- const selectableIds = useMemo(- () =>- submissions- .filter((s) => s.status === SubmissionStatus.PENDING)- .map((s) => s.listing_version_id),- [submissions],- );-- const selection = useSubmissionSelection(selectableIds);- const [bulkDeleteOpen, setBulkDeleteOpen] = useState(false);- const [isBulkDeleting, setIsBulkDeleting] = useState(false);-function setStatuses(statuses: SubmissionStatus[]) {onFilterChange({ ...filterState, statuses });}@@ -77,30 +67,6 @@ export function SubmissionsList({onFilterChange({ ...filterState, sortKey, sortDir });}- async function handleBulkDelete() {- setIsBulkDeleting(true);- const ids = [...selection.selectedIds];- try {- const results = await Promise.allSettled(ids.map((id) => onDelete(id)));- const failed = results.filter((r) => r.status === "rejected").length;- const succeeded = ids.length - failed;- if (failed > 0) {- for (const r of results) {- if (r.status === "rejected") Sentry.captureException(r.reason);- }- toast({- title: `Deleted ${succeeded} of ${ids.length} submissions`,- description: `${failed} failed to delete. Please try again.`,- variant: "destructive",- });- }- selection.clear();- setBulkDeleteOpen(false);- } finally {- setIsBulkDeleting(false);- }- }-return (<motion.sectioninitial={reduceMotion ? false : { opacity: 0, y: 8 }}@@ -122,49 +88,11 @@ export function SubmissionsList({</Text></div>- <AnimatePresence initial={false}>- {selection.selectedCount > 0 && (- <motion.div- key="selection-bar"- initial={- reduceMotion- ? { opacity: 0 }- : { opacity: 0, height: 0, marginBottom: -12 }- }- animate={- reduceMotion- ? { opacity: 1 }- : { opacity: 1, height: "auto", marginBottom: 0 }- }- exit={- reduceMotion- ? { opacity: 0 }- : { opacity: 0, height: 0, marginBottom: -12 }- }- transition={{ duration: 0.2, ease: [0, 0, 0.2, 1] }}- className="overflow-hidden"- >- <SubmissionSelectionBar- selectedCount={selection.selectedCount}- allSelected={selection.allSelected}- onSelectAll={selection.selectAll}- onDeselectAll={selection.clear}- onDeleteSelected={() => setBulkDeleteOpen(true)}- />- </motion.div>- )}- </AnimatePresence>-<div className="overflow-hidden rounded-[18px] border border-zinc-200 bg-white shadow-[0_1px_2px_rgba(15,15,20,0.04)]">- <div className="overflow-x-auto">+ <div><table className="w-full border-collapse text-left"><thead><tr className="border-b border-zinc-100 bg-zinc-50/60">- <th- scope="col"- className="w-[48px] px-3 py-3"- aria-label="Select"- /><ColumnHeader label="Agent" /><ColumnHeaderlabel="Status"@@ -214,16 +142,11 @@ export function SubmissionsList({</thead><tbody>{submissions.length > 0 ? (- submissions.map((submission) => (+ submissions.map((submission, rowIndex) => (<SubmissionItemkey={submission.listing_version_id}submission={submission}- selected={selection.isSelected(- submission.listing_version_id,- )}- onToggleSelected={() =>- selection.toggle(submission.listing_version_id)- }+ rowIndex={rowIndex}onView={onView}onEdit={onEdit}onDelete={onDelete}@@ -250,42 +173,16 @@ export function SubmissionsList({</tbody></table></div>+ {pagination && onPageChange ? (+ <div className="border-t border-zinc-100">+ <Pagination+ pagination={pagination}+ onPageChange={onPageChange}+ disabled={isFetching}+ />+ </div>+ ) : null}</div>-- <Dialog- title="Delete selected submissions?"- styling={{ maxWidth: "420px" }}- controlled={{- isOpen: bulkDeleteOpen,- set: (open) => setBulkDeleteOpen(open),- }}- >- <Dialog.Content>- <Text variant="body" className="text-zinc-700">- This will remove {selection.selectedCount} submission- {selection.selectedCount === 1 ? "" : "s"} from the store. This- action cannot be undone.- </Text>- <Dialog.Footer>- <Button- variant="ghost"- size="small"- onClick={() => setBulkDeleteOpen(false)}- disabled={isBulkDeleting}- >- Cancel- </Button>- <Button- variant="destructive"- size="small"- onClick={handleBulkDelete}- loading={isBulkDeleting}- >- {isBulkDeleting ? "Deleting" : "Delete selected"}- </Button>- </Dialog.Footer>- </Dialog.Content>- </Dialog></motion.section>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionsList/useSubmissionSelection.ts b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionsList/useSubmissionSelection.tsdeleted file mode 100644index 46cf7d0469..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/components/SubmissionsList/useSubmissionSelection.ts+++ /dev/null@@ -1,46 +0,0 @@-import { useEffect, useState } from "react";--export function useSubmissionSelection(selectableIds: string[]) {- const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set());-- useEffect(() => {- setSelectedIds((prev) => {- if (prev.size === 0) return prev;- const existing = new Set(selectableIds);- const next = new Set<string>();- for (const id of prev) {- if (existing.has(id)) next.add(id);- }- return next.size === prev.size ? prev : next;- });- }, [selectableIds]);-- function toggle(id: string) {- setSelectedIds((prev) => {- const next = new Set(prev);- if (next.has(id)) next.delete(id);- else next.add(id);- return next;- });- }-- function selectAll() {- setSelectedIds(new Set(selectableIds));- }-- function clear() {- setSelectedIds(new Set());- }-- return {- selectedIds,- selectedCount: selectedIds.size,- allSelected:- selectableIds.length > 0 &&- selectableIds.every((id) => selectedIds.has(id)),- isSelected: (id: string) => selectedIds.has(id),- toggle,- selectAll,- clear,- };-}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/helpers.tsindex a983a1badb..5c6f611724 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/helpers.ts+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/helpers.ts@@ -8,6 +8,7 @@ import {import { SubmissionStatus } from "@/app/api/__generated__/models/submissionStatus";import type { StoreSubmission } from "@/app/api/__generated__/models/storeSubmission";+import type { SubmissionStats } from "@/app/api/__generated__/models/submissionStats";export const EASE_OUT = [0.16, 1, 0.3, 1] as const;@@ -140,39 +141,24 @@ export interface DashboardStats {averageRating: number | null;}-export function computeStats(submissions: StoreSubmission[]): DashboardStats {- if (submissions.length === 0) {- return {- total: 0,- approved: 0,- pending: 0,- totalRuns: 0,- averageRating: null,- };- }-- let approved = 0;- let pending = 0;- let totalRuns = 0;- let ratingSum = 0;- let ratingCount = 0;-- for (const submission of submissions) {- if (submission.status === SubmissionStatus.APPROVED) approved += 1;- if (submission.status === SubmissionStatus.PENDING) pending += 1;- totalRuns += submission.run_count ?? 0;- if (submission.review_avg_rating && submission.review_avg_rating > 0) {- ratingSum += submission.review_avg_rating;- ratingCount += 1;- }- }+export const EMPTY_DASHBOARD_STATS: DashboardStats = {+ total: 0,+ approved: 0,+ pending: 0,+ totalRuns: 0,+ averageRating: null,+};+export function toDashboardStats(+ stats: SubmissionStats | undefined,+): DashboardStats {+ if (!stats) return EMPTY_DASHBOARD_STATS;return {- total: submissions.length,- approved,- pending,- totalRuns,- averageRating: ratingCount > 0 ? ratingSum / ratingCount : null,+ total: stats.total,+ approved: stats.approved,+ pending: stats.pending,+ totalRuns: stats.total_runs,+ averageRating: stats.average_rating ?? null,};}@@ -185,6 +171,7 @@ export function filterSubmissions(}export function formatRuns(value: number): string {+ if (value >= 999_950_000) return `${(value / 1_000_000_000).toFixed(1)}B`;if (value >= 999_950) return `${(value / 1_000_000).toFixed(1)}M`;if (value >= 1_000) return `${(value / 1_000).toFixed(1)}K`;return value.toLocaleString();diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/page.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/page.tsxindex 38014cc97b..9f8229d5e7 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/page.tsx@@ -21,6 +21,9 @@ export default function SettingsCreatorDashboardPage() {const {submissions,visibleSubmissions,+ pagination,+ onPageChange,+ isFetching,stats,filterState,setFilterState,@@ -75,7 +78,10 @@ export default function SettingsCreatorDashboardPage() {<div className="hidden md:block"><SubmissionsListsubmissions={visibleSubmissions}- totalCount={submissions.length}+ totalCount={pagination?.total_items ?? submissions.length}+ pagination={pagination}+ onPageChange={onPageChange}+ isFetching={isFetching}filterState={filterState}onFilterChange={setFilterState}onResetFilters={resetFilters}@@ -88,7 +94,10 @@ export default function SettingsCreatorDashboardPage() {<div className="md:hidden"><MobileSubmissionsListsubmissions={visibleSubmissions}- totalCount={submissions.length}+ totalCount={pagination?.total_items ?? submissions.length}+ pagination={pagination}+ onPageChange={onPageChange}+ isFetching={isFetching}filterState={filterState}onFilterChange={setFilterState}onResetFilters={resetFilters}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/useCreatorDashboardPage.ts b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/useCreatorDashboardPage.tsindex 4e400b0e98..040c25de79 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/useCreatorDashboardPage.ts+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/useCreatorDashboardPage.ts@@ -1,5 +1,6 @@import { useMemo, useState } from "react";import * as Sentry from "@sentry/nextjs";+import { keepPreviousData } from "@tanstack/react-query";import {getGetV2ListMySubmissionsQueryKey,@@ -14,11 +15,13 @@ import { useSupabase } from "@/lib/supabase/hooks/useSupabase";import {applyFiltersAndSort,- computeStats,INITIAL_FILTER_STATE,+ toDashboardStats,type FilterState,} from "./helpers";+const PAGE_SIZE = 20;+type PublishStep = "select" | "info" | "review";interface PublishState {@@ -52,20 +55,36 @@ export function useCreatorDashboardPage() {submission: null,});- const [filterState, setFilterState] =+ const [filterState, setFilterStateRaw] =useState<FilterState>(INITIAL_FILTER_STATE);+ const [page, setPage] = useState(1);+const {data: response,isSuccess,+ isFetching,error,refetch,- } = useGetV2ListMySubmissions(undefined, {- query: {- select: (x) => x.data as StoreSubmissionsResponse,- enabled: !!user,+ } = useGetV2ListMySubmissions(+ { page, page_size: PAGE_SIZE },+ {+ query: {+ select: (x) => x.data as StoreSubmissionsResponse,+ enabled: !!user,+ placeholderData: keepPreviousData,+ },},- });+ );++ function setFilterState(next: FilterState) {+ setFilterStateRaw(next);+ setPage(1);+ }++ function onPageChange(nextPage: number) {+ setPage(nextPage);+ }const { mutateAsync: deleteSubmission } = useDeleteV2DeleteStoreSubmission({mutation: {@@ -79,7 +98,7 @@ export function useCreatorDashboardPage() {const submissions = response?.submissions ?? [];- const stats = useMemo(() => computeStats(submissions), [submissions]);+ const stats = toDashboardStats(response?.stats);const visibleSubmissions = useMemo(() => applyFiltersAndSort(submissions, filterState),@@ -142,6 +161,9 @@ export function useCreatorDashboardPage() {return {submissions,visibleSubmissions,+ pagination: response?.pagination,+ onPageChange,+ isFetching,stats,filterState,setFilterState,diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/components/DetailView/DetailView.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/components/DetailView/DetailView.tsxindex 0711a34864..f5abf22b4c 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/components/DetailView/DetailView.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/components/DetailView/DetailView.tsx@@ -13,10 +13,13 @@ import {} from "@/components/molecules/TabsLine/TabsLine";import { AuthType, ConnectableProvider, type AuthMethod } from "../../helpers";+import { McpConnectPanel } from "./McpConnectPanel";import { MethodPanel, TAB_LABEL } from "./MethodPanel";import { ProviderAvatar } from "./ProviderAvatar";import { UnsupportedNotice } from "./UnsupportedNotice";+const MCP_PROVIDER_ID = "mcp";+interface Props {provider: ConnectableProvider;onBack: () => void;@@ -49,8 +52,8 @@ export function DetailView({ provider, onBack, onSuccess }: Props) {remembered && tabs.includes(remembered) ? remembered : tabs[0];return (- <div className="flex flex-col gap-5">- <div className="flex items-center gap-3">+ <div className="flex flex-col gap-5 pl-1">+ <div className="flex items-center gap-3 pl-1"><Buttonvariant="icon"size="icon"@@ -74,7 +77,9 @@ export function DetailView({ provider, onBack, onSuccess }: Props) {</div></div>- {tabs.length === 0 ? (+ {provider.id === MCP_PROVIDER_ID ? (+ <McpConnectPanel onSuccess={onSuccess} />+ ) : tabs.length === 0 ? (<UnsupportedNotice providerName={provider.name} />) : tabs.length === 1 ? (<MethodPaneldiff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/components/DetailView/McpConnectPanel.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/components/DetailView/McpConnectPanel.tsxnew file mode 100644index 0000000000..1bfc30e86c--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/components/DetailView/McpConnectPanel.tsx@@ -0,0 +1,237 @@+"use client";++import { useEffect, useRef, useState } from "react";+import { useQueryClient } from "@tanstack/react-query";++import {+ postV2ExchangeOauthCodeForMcpTokens,+ postV2InitiateOauthLoginForAnMcpServer,+ postV2StoreABearerTokenForAnMcpServer,+} from "@/app/api/__generated__/endpoints/mcp/mcp";+import { getGetV1ListCredentialsQueryKey } from "@/app/api/__generated__/endpoints/integrations/integrations";+import type { MCPOAuthLoginResponse } from "@/app/api/__generated__/models/mCPOAuthLoginResponse";+import { Button } from "@/components/atoms/Button/Button";+import { Input } from "@/components/atoms/Input/Input";+import { Text } from "@/components/atoms/Text/Text";+import { openOAuthPopup } from "@/lib/oauth-popup";++interface Props {+ onSuccess: () => void;+}++type Phase = "form" | "manual-token";++export function McpConnectPanel({ onSuccess }: Props) {+ const queryClient = useQueryClient();+ const [serverUrl, setServerUrl] = useState("");+ const [token, setToken] = useState("");+ const [phase, setPhase] = useState<Phase>("form");+ const [isSubmitting, setIsSubmitting] = useState(false);+ const [error, setError] = useState<string | null>(null);+ const oauthAbortRef = useRef<((reason?: string) => void) | null>(null);++ useEffect(() => () => oauthAbortRef.current?.(), []);++ const trimmedUrl = serverUrl.trim();+ const trimmedToken = token.trim();+ const isUrlValid = isValidHttpUrl(trimmedUrl);+ const canConnect = isUrlValid && !isSubmitting;+ const canSubmitToken = isUrlValid && trimmedToken.length > 0 && !isSubmitting;++ async function invalidateCredentials() {+ await queryClient.invalidateQueries({+ queryKey: getGetV1ListCredentialsQueryKey(),+ });+ }++ async function handleConnect() {+ if (!canConnect) return;+ setError(null);+ setIsSubmitting(true);+ oauthAbortRef.current?.();++ try {+ // Only a 400 from the *initiate* call means "server doesn't support+ // OAuth" — fall back to manual-token for that. A 400 from anywhere else+ // (popup callback, token exchange) is a real error and should surface+ // as such instead of forcing the manual-token UI.+ let loginRes: Awaited<+ ReturnType<typeof postV2InitiateOauthLoginForAnMcpServer>+ >;+ try {+ loginRes = await postV2InitiateOauthLoginForAnMcpServer({+ server_url: trimmedUrl,+ });+ } catch (e: unknown) {+ if (getErrorStatus(e) === 400) {+ setPhase("manual-token");+ setError(+ "This server doesn't support OAuth sign-in. Paste a bearer token instead.",+ );+ return;+ }+ throw e;+ }++ const { login_url, state_token } = loginRes.data as MCPOAuthLoginResponse;++ const { promise, cleanup } = openOAuthPopup(login_url, {+ stateToken: state_token,+ useCrossOriginListeners: true,+ });+ oauthAbortRef.current = cleanup.abort;++ const result = await promise;++ await postV2ExchangeOauthCodeForMcpTokens({+ code: result.code,+ state_token,+ });++ await invalidateCredentials();+ onSuccess();+ } catch (e: unknown) {+ const message = getErrorMessage(e);+ if (message === "OAuth flow timed out") {+ setError("OAuth sign-in timed out. Please try again.");+ } else {+ setError(message);+ }+ } finally {+ setIsSubmitting(false);+ oauthAbortRef.current = null;+ }+ }++ async function handleSubmitToken() {+ if (!canSubmitToken) return;+ setError(null);+ setIsSubmitting(true);++ try {+ await postV2StoreABearerTokenForAnMcpServer({+ server_url: trimmedUrl,+ token: trimmedToken,+ });++ await invalidateCredentials();+ onSuccess();+ } catch (e: unknown) {+ setError(getErrorMessage(e));+ } finally {+ setIsSubmitting(false);+ }+ }++ function handleSwitchToOAuth() {+ setPhase("form");+ setToken("");+ setError(null);+ }++ return (+ <div className="flex flex-col gap-4">+ <Text variant="body" className="text-zinc-600">+ Enter the URL of your MCP server. We'll try OAuth first and fall+ back to a bearer token if the server doesn't support OAuth.+ </Text>++ <Input+ id="mcp-server-url"+ label="Server URL"+ type="url"+ placeholder="https://mcp.example.com"+ value={serverUrl}+ onChange={(e) => setServerUrl(e.target.value)}+ disabled={isSubmitting}+ autoFocus+ />++ {phase === "manual-token" ? (+ <Input+ id="mcp-bearer-token"+ label="Bearer token"+ type="password"+ placeholder="Paste API token"+ value={token}+ onChange={(e) => setToken(e.target.value)}+ disabled={isSubmitting}+ hint="Used as a Bearer Authorization header when calling tools."+ />+ ) : null}++ {error ? (+ <div+ role="alert"+ aria-live="polite"+ className="rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700"+ >+ {error}+ </div>+ ) : null}++ <div className="flex items-center justify-end gap-2">+ {phase === "manual-token" ? (+ <Button+ variant="secondary"+ size="small"+ onClick={handleSwitchToOAuth}+ disabled={isSubmitting}+ >+ Try OAuth+ </Button>+ ) : null}+ {phase === "form" ? (+ <Button+ variant="primary"+ size="small"+ onClick={handleConnect}+ disabled={!canConnect}+ loading={isSubmitting}+ >+ Connect+ </Button>+ ) : (+ <Button+ variant="primary"+ size="small"+ onClick={handleSubmitToken}+ disabled={!canSubmitToken}+ loading={isSubmitting}+ >+ Save token+ </Button>+ )}+ </div>+ </div>+ );+}++function getErrorMessage(error: unknown): string {+ if (error instanceof Error && error.message) return error.message;+ if (typeof error === "object" && error !== null) {+ const detail = (error as { detail?: unknown }).detail;+ if (typeof detail === "string") return detail;+ const message = (error as { message?: unknown }).message;+ if (typeof message === "string") return message;+ }+ return "Something went wrong. Please try again.";+}++function getErrorStatus(error: unknown): number | null {+ if (typeof error === "object" && error !== null) {+ const status = (error as { status?: unknown }).status;+ if (typeof status === "number") return status;+ }+ return null;+}++function isValidHttpUrl(value: string): boolean {+ if (!value) return false;+ try {+ const u = new URL(value);+ return u.protocol === "http:" || u.protocol === "https:";+ } catch {+ return false;+ }+}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/components/DetailView/__tests__/McpConnectPanel.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/components/DetailView/__tests__/McpConnectPanel.test.tsxnew file mode 100644index 0000000000..0acd7a2f7e--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/components/DetailView/__tests__/McpConnectPanel.test.tsx@@ -0,0 +1,249 @@+import {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from "@/tests/integrations/test-utils";+import { afterEach, describe, expect, it, vi } from "vitest";++import { McpConnectPanel } from "../McpConnectPanel";++vi.mock("@/lib/oauth-popup", () => ({+ openOAuthPopup: vi.fn(),+}));++vi.mock("@/app/api/__generated__/endpoints/mcp/mcp", () => ({+ postV2InitiateOauthLoginForAnMcpServer: vi.fn(),+ postV2ExchangeOauthCodeForMcpTokens: vi.fn(),+ postV2StoreABearerTokenForAnMcpServer: vi.fn(),+}));++function makeApiError(status: number, detail = "boom"): Error {+ const err = new Error(detail) as Error & {+ status: number;+ response: unknown;+ };+ err.name = "ApiError";+ err.status = status;+ err.response = { detail };+ return err;+}++describe("McpConnectPanel", () => {+ afterEach(() => {+ vi.clearAllMocks();+ cleanup();+ });++ it("disables Connect until a valid http(s) URL is entered", () => {+ render(<McpConnectPanel onSuccess={() => {}} />);++ const connectButton = screen.getByRole("button", { name: /connect/i });+ expect((connectButton as HTMLButtonElement).disabled).toBe(true);++ const urlInput = screen.getByLabelText(/server url/i);++ fireEvent.change(urlInput, { target: { value: "not a url" } });+ expect((connectButton as HTMLButtonElement).disabled).toBe(true);++ fireEvent.change(urlInput, {+ target: { value: "javascript:alert(1)" },+ });+ expect((connectButton as HTMLButtonElement).disabled).toBe(true);++ fireEvent.change(urlInput, {+ target: { value: "https://mcp.example.com" },+ });+ expect((connectButton as HTMLButtonElement).disabled).toBe(false);+ });++ it("falls back to manual-token form when initiate returns 400", async () => {+ const { postV2InitiateOauthLoginForAnMcpServer } = await import(+ "@/app/api/__generated__/endpoints/mcp/mcp"+ );++ vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockRejectedValueOnce(+ makeApiError(400, "OAuth not supported"),+ );++ render(<McpConnectPanel onSuccess={() => {}} />);++ fireEvent.change(screen.getByLabelText(/server url/i), {+ target: { value: "https://mcp.example.com" },+ });+ fireEvent.click(screen.getByRole("button", { name: /connect/i }));++ await waitFor(() => {+ expect(screen.getByPlaceholderText(/paste api token/i)).toBeDefined();+ });+ expect(+ screen.getByText(/server doesn't support oauth sign-in/i),+ ).toBeDefined();+ });++ it("does NOT switch to manual-token on a 400 from token exchange", async () => {+ const {+ postV2InitiateOauthLoginForAnMcpServer,+ postV2ExchangeOauthCodeForMcpTokens,+ } = await import("@/app/api/__generated__/endpoints/mcp/mcp");+ const { openOAuthPopup } = await import("@/lib/oauth-popup");++ vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({+ status: 200,+ data: { login_url: "https://login.example.com", state_token: "tok" },+ headers: new Headers(),+ } as never);++ vi.mocked(openOAuthPopup).mockReturnValueOnce({+ promise: Promise.resolve({ code: "abc" }),+ cleanup: { abort: vi.fn() },+ } as never);++ vi.mocked(postV2ExchangeOauthCodeForMcpTokens).mockRejectedValueOnce(+ makeApiError(400, "bad code"),+ );++ render(<McpConnectPanel onSuccess={() => {}} />);++ fireEvent.change(screen.getByLabelText(/server url/i), {+ target: { value: "https://mcp.example.com" },+ });+ fireEvent.click(screen.getByRole("button", { name: /connect/i }));++ await waitFor(() => {+ expect(screen.getByText(/bad code/i)).toBeDefined();+ });++ expect(screen.queryByPlaceholderText(/paste api token/i)).toBeNull();+ });++ it("submits a bearer token then calls onSuccess", async () => {+ const {+ postV2InitiateOauthLoginForAnMcpServer,+ postV2StoreABearerTokenForAnMcpServer,+ } = await import("@/app/api/__generated__/endpoints/mcp/mcp");++ vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockRejectedValueOnce(+ makeApiError(400, "OAuth not supported"),+ );++ const onSuccess = vi.fn();+ render(<McpConnectPanel onSuccess={onSuccess} />);++ fireEvent.change(screen.getByLabelText(/server url/i), {+ target: { value: "https://mcp.example.com" },+ });+ fireEvent.click(screen.getByRole("button", { name: /connect/i }));++ await waitFor(() => {+ expect(screen.getByPlaceholderText(/paste api token/i)).toBeDefined();+ });++ vi.mocked(postV2StoreABearerTokenForAnMcpServer).mockResolvedValueOnce({+ status: 200,+ data: { ok: true },+ headers: new Headers(),+ } as never);++ fireEvent.change(screen.getByPlaceholderText(/paste api token/i), {+ target: { value: "secret-bearer-token" },+ });+ fireEvent.click(screen.getByRole("button", { name: /save token/i }));++ await waitFor(() => {+ expect(onSuccess).toHaveBeenCalledTimes(1);+ });+ expect(postV2StoreABearerTokenForAnMcpServer).toHaveBeenCalledWith({+ server_url: "https://mcp.example.com",+ token: "secret-bearer-token",+ });+ });++ it("lets the user switch from manual-token back to OAuth", async () => {+ const { postV2InitiateOauthLoginForAnMcpServer } = await import(+ "@/app/api/__generated__/endpoints/mcp/mcp"+ );++ vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockRejectedValueOnce(+ makeApiError(400, "OAuth not supported"),+ );++ render(<McpConnectPanel onSuccess={() => {}} />);++ fireEvent.change(screen.getByLabelText(/server url/i), {+ target: { value: "https://mcp.example.com" },+ });+ fireEvent.click(screen.getByRole("button", { name: /connect/i }));++ await waitFor(() => {+ expect(screen.getByPlaceholderText(/paste api token/i)).toBeDefined();+ });++ fireEvent.change(screen.getByPlaceholderText(/paste api token/i), {+ target: { value: "stale-token" },+ });++ fireEvent.click(screen.getByRole("button", { name: /try oauth/i }));++ expect(screen.queryByPlaceholderText(/paste api token/i)).toBeNull();+ expect(screen.getByRole("button", { name: /connect/i })).toBeDefined();+ });++ it("surfaces an error when bearer-token submission fails", async () => {+ const {+ postV2InitiateOauthLoginForAnMcpServer,+ postV2StoreABearerTokenForAnMcpServer,+ } = await import("@/app/api/__generated__/endpoints/mcp/mcp");++ vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockRejectedValueOnce(+ makeApiError(400, "OAuth not supported"),+ );++ const onSuccess = vi.fn();+ render(<McpConnectPanel onSuccess={onSuccess} />);++ fireEvent.change(screen.getByLabelText(/server url/i), {+ target: { value: "https://mcp.example.com" },+ });+ fireEvent.click(screen.getByRole("button", { name: /connect/i }));++ await waitFor(() => {+ expect(screen.getByPlaceholderText(/paste api token/i)).toBeDefined();+ });++ vi.mocked(postV2StoreABearerTokenForAnMcpServer).mockRejectedValueOnce(+ makeApiError(401, "invalid token"),+ );++ fireEvent.change(screen.getByPlaceholderText(/paste api token/i), {+ target: { value: "wrong-token" },+ });+ fireEvent.click(screen.getByRole("button", { name: /save token/i }));++ const alert = await screen.findByRole("alert");+ expect(alert.textContent).toContain("invalid token");+ expect(onSuccess).not.toHaveBeenCalled();+ });++ it("renders an aria-live error region when a non-400 error occurs", async () => {+ const { postV2InitiateOauthLoginForAnMcpServer } = await import(+ "@/app/api/__generated__/endpoints/mcp/mcp"+ );++ vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockRejectedValueOnce(+ makeApiError(500, "internal server error"),+ );++ render(<McpConnectPanel onSuccess={() => {}} />);++ fireEvent.change(screen.getByLabelText(/server url/i), {+ target: { value: "https://mcp.example.com" },+ });+ fireEvent.click(screen.getByRole("button", { name: /connect/i }));++ const alert = await screen.findByRole("alert");+ expect(alert.getAttribute("aria-live")).toBe("polite");+ expect(alert.textContent).toContain("internal server error");+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/page.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/page.tsxindex 3513b241e9..b01c7df0cc 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/settings/page.tsx@@ -3,6 +3,8 @@import { useEffect } from "react";import { useRouter } from "next/navigation";+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";+export default function SettingsIndexPage() {const router = useRouter();@@ -10,5 +12,21 @@ export default function SettingsIndexPage() {router.replace("/settings/profile");}, [router]);- return null;+ return <SettingsContentSkeleton />;+}++function SettingsContentSkeleton() {+ return (+ <div+ className="flex w-full flex-col gap-4 px-4 pt-2"+ aria-busy="true"+ aria-live="polite"+ >+ <Skeleton className="h-7 w-44 rounded-[8px]" />+ <Skeleton className="h-4 w-72 rounded-[8px]" />+ <Skeleton className="mt-2 h-[120px] w-full rounded-[18px]" />+ <Skeleton className="h-[180px] w-full rounded-[18px]" />+ <Skeleton className="h-[120px] w-full rounded-[18px]" />+ </div>+ );}diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 7dfcd31aa8..197bf29322 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -16495,10 +16495,11 @@"type": "array","title": "Submissions"},- "pagination": { "$ref": "#/components/schemas/Pagination" }+ "pagination": { "$ref": "#/components/schemas/Pagination" },+ "stats": { "$ref": "#/components/schemas/SubmissionStats" }},"type": "object",- "required": ["submissions", "pagination"],+ "required": ["submissions", "pagination", "stats"],"title": "StoreSubmissionsResponse"},"StreamChatRequest": {@@ -16564,6 +16565,28 @@"title": "StreamChatRequest","description": "Request model for streaming chat with optional context."},+ "SubmissionStats": {+ "properties": {+ "total": { "type": "integer", "title": "Total" },+ "approved": { "type": "integer", "title": "Approved" },+ "pending": { "type": "integer", "title": "Pending" },+ "total_runs": { "type": "integer", "title": "Total Runs" },+ "average_rating": {+ "anyOf": [{ "type": "number" }, { "type": "null" }],+ "title": "Average Rating"+ }+ },+ "type": "object",+ "required": [+ "total",+ "approved",+ "pending",+ "total_runs",+ "average_rating"+ ],+ "title": "SubmissionStats",+ "description": "Creator-wide aggregates over a user's non-deleted submissions.\n\nComputed server-side so values stay accurate regardless of pagination —\nsumming client-side over the current page silently undercounts once the\ncreator has more submissions than fit on one page."+ },"SubmissionStatus": {"type": "string","enum": ["DRAFT", "PENDING", "APPROVED", "REJECTED"],diff --git a/autogpt_platform/frontend/src/components/contextual/CronScheduler/cron-scheduler-dialog.tsx b/autogpt_platform/frontend/src/components/contextual/CronScheduler/cron-scheduler-dialog.tsxindex 4da59b0358..ead42ca26a 100644--- a/autogpt_platform/frontend/src/components/contextual/CronScheduler/cron-scheduler-dialog.tsx+++ b/autogpt_platform/frontend/src/components/contextual/CronScheduler/cron-scheduler-dialog.tsx@@ -121,7 +121,7 @@ export function CronSchedulerDialog(props: CronSchedulerDialogProps) {<InfoIcon className="h-4 w-4 text-amber-600" /><p className="text-sm text-amber-800">No timezone set. Schedule will run in UTC.- <a href="/profile/settings" className="ml-1 underline">+ <a href="/settings/account" className="ml-1 underline">Set your timezone</a></p>diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentReviewStep.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentReviewStep.tsxindex 3c0e7fb4f6..cdd0363624 100644--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentReviewStep.tsx+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentReviewStep.tsx@@ -59,7 +59,7 @@ export function AgentReviewStep({reviewComments,}: Props) {const pathname = usePathname();- const isDashboardPage = pathname.includes("/profile/dashboard");+ const isDashboardPage = pathname.includes("/settings/creator-dashboard");const headerContent = getStepHeaderContent(status, isDashboardPage);return (diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.ts b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.tsindex 9521ce33e8..e459545abf 100644--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.ts+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.ts@@ -282,7 +282,7 @@ export function usePublishAgentModal({}function handleGoToDashboard() {- router.push("/profile/dashboard");+ router.push("/settings/creator-dashboard");handleClose();}diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletRefill.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletRefill.tsxindex ab7e62d630..09dc752c2f 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletRefill.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletRefill.tsx@@ -214,7 +214,7 @@ export function WalletRefill() {To update your billing details, head to{" "}</span><Link- href="/profile/credits"+ href="/settings/billing"className="cursor-pointer text-zinc-800 underline">Billing settingsdiff --git a/autogpt_platform/frontend/src/playwright/pages/marketplace.page.ts b/autogpt_platform/frontend/src/playwright/pages/marketplace.page.tsindex b0d334449f..c78dcdeaef 100644--- a/autogpt_platform/frontend/src/playwright/pages/marketplace.page.ts+++ b/autogpt_platform/frontend/src/playwright/pages/marketplace.page.ts@@ -274,19 +274,22 @@ export class MarketplacePage extends BasePage {async waitForDashboardSubmission(agentTitle: string) {for (let attempt = 0; attempt < 3; attempt += 1) {const submissionRow = this.page- .getByTestId("agent-table-row")+ .getByTestId("submission-row").filter({ hasText: agentTitle }).first();- // Row may not appear immediately after redirect — allow a short render- // window before deciding the submission is absent on this attempt.if (await submissionRow.isVisible({ timeout: 5000 }).catch(() => false)) {return submissionRow;}await this.page.reload();- await expect(this.page).toHaveURL(/\/profile\/dashboard/);- await expect(this.page.getByText("Agent dashboard")).toBeVisible();+ await expect(this.page).toHaveURL(/\/settings\/creator-dashboard/);+ await expect(+ this.page.getByRole("heading", {+ name: "Creator dashboard",+ level: 1,+ }),+ ).toBeVisible();}throw new Error(`Submission row for "${agentTitle}" did not appear`);diff --git a/autogpt_platform/frontend/src/playwright/publish-happy-path.spec.ts b/autogpt_platform/frontend/src/playwright/publish-happy-path.spec.tsindex 00fcbaf1d4..577bb7dbc1 100644--- a/autogpt_platform/frontend/src/playwright/publish-happy-path.spec.ts+++ b/autogpt_platform/frontend/src/playwright/publish-happy-path.spec.ts@@ -33,26 +33,27 @@ test("publish happy path: user can submit, track, and delete an agent submissionawait marketplacePage.submitAgentForReview(publishableAgentName);await page.getByTestId("view-progress-button").click();- await expect(page).toHaveURL(/\/profile\/dashboard/);- await expect(page.getByText("Agent dashboard")).toBeVisible();+ await expect(page).toHaveURL(/\/settings\/creator-dashboard/);+ await expect(+ page.getByRole("heading", { name: "Creator dashboard", level: 1 }),+ ).toBeVisible();const submissionRow =await marketplacePage.waitForDashboardSubmission(agentTitle);await expect(- submissionRow.getByTestId("agent-status"),+ submissionRow,`submission "${agentTitle}" should appear in the dashboard review-pending state`,- ).toContainText(/awaiting review/i);- await submissionRow.getByTestId("agent-table-row-actions").click();- await expect(page.getByRole("menuitem", { name: "Edit" })).toBeVisible();+ ).toContainText(/in review/i);+ await submissionRow.getByTestId("submission-actions").click();+ await expect(+ page.getByRole("menuitem", { name: "Edit details" }),+ ).toBeVisible();- // Delete the submission via the actions menu. The dashboard does not show- // a confirmation dialog — clicking Delete fires the API directly. We then- // assert the row is gone, proving the backend actually removed it (not- // just the menu item disappeared).await page.getByRole("menuitem", { name: "Delete" }).click();+ await page.getByRole("button", { name: "Delete submission" }).click();await expect(- page.getByTestId("agent-table-row").filter({ hasText: agentTitle }),+ page.getByTestId("submission-row").filter({ hasText: agentTitle }),`submission row "${agentTitle}" must be removed from the dashboard after delete`,).toHaveCount(0, { timeout: 15000 });diff --git a/autogpt_platform/frontend/src/providers/agent-credentials/credentials-provider.tsx b/autogpt_platform/frontend/src/providers/agent-credentials/credentials-provider.tsxindex cfcd11f4f4..e9bfe2a16a 100644--- a/autogpt_platform/frontend/src/providers/agent-credentials/credentials-provider.tsx+++ b/autogpt_platform/frontend/src/providers/agent-credentials/credentials-provider.tsx@@ -8,10 +8,12 @@ import {HostScopedCredentials,UserPasswordCredentials,} from "@/lib/autogpt-server-api";+import { getGetV1ListCredentialsQueryKey } from "@/app/api/__generated__/endpoints/integrations/integrations";import { postV2ExchangeOauthCodeForMcpTokens } from "@/app/api/__generated__/endpoints/mcp/mcp";import { useBackendAPI } from "@/lib/autogpt-server-api/context";import { useSupabase } from "@/lib/supabase/hooks/useSupabase";import { toDisplayName } from "@/providers/agent-credentials/helper";+import { hashKey, useQueryClient } from "@tanstack/react-query";import { createContext, useCallback, useEffect, useState } from "react";type APIKeyCredentialsCreatable = Omit<@@ -122,6 +124,7 @@ export default function CredentialsProvider({const { isLoggedIn } = useSupabase();const api = useBackendAPI();const onFailToast = useToastOnFail();+ const queryClient = useQueryClient();const upsertCredentials = useCallback((@@ -364,6 +367,31 @@ export default function CredentialsProvider({loadCredentials();}, [loadCredentials]);+ // Keep the in-memory provider state in sync with React Query: any code that+ // invalidates the credentials list query (e.g. settings v2 create/delete+ // flows using generated hooks) will trigger a reload here, so the builder+ // never sees stale credentials without callers having to opt in.+ //+ // Match by `queryHash` (computed via the public `hashKey` helper) instead+ // of comparing `queryKey[0]` so any future parameterisation of the key+ // still works. Listen for both `invalidate` (set isInvalidated=true) and+ // `success` (refetch landed) actions so we cover active and inactive+ // queries — for active queries the refetch following invalidate produces+ // the `success` event with fresh data; for inactive queries only the+ // `invalidate` action fires.+ useEffect(() => {+ const targetHash = hashKey(getGetV1ListCredentialsQueryKey());+ const unsubscribe = queryClient.getQueryCache().subscribe((event) => {+ if (event.query.queryHash !== targetHash) return;+ if (event.type !== "updated") return;+ const actionType = event.action.type;+ if (actionType === "invalidate" || actionType === "success") {+ loadCredentials();+ }+ });+ return unsubscribe;+ }, [queryClient, loadCredentials]);+return (<CredentialsActionsContext.Provider value={{ reload: loadCredentials }}><CredentialsProvidersContext.Provider value={providers}>