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(platform): optimize creator search experience (#13142)
Abhimanyu Yadav6fe482f2d2d1
diff --git a/autogpt_platform/backend/backend/api/features/store/db.py b/autogpt_platform/backend/backend/api/features/store/db.pyindex 8c9db11b67..510dfb1762 100644--- a/autogpt_platform/backend/backend/api/features/store/db.py+++ b/autogpt_platform/backend/backend/api/features/store/db.py@@ -655,10 +655,27 @@ async def _get_submission_stats(user_id: str) -> store_model.SubmissionStats:async def get_store_submissions(- user_id: str, page: int = 1, page_size: int = 20+ user_id: str,+ page: int = 1,+ page_size: int = 20,+ search_query: str | None = None,+ statuses: list[prisma.enums.SubmissionStatus] | None = None,+ sort_key: str | None = None,+ sort_dir: str = "desc",) -> store_model.StoreSubmissionsResponse:"""Get store submissions for the authenticated user -- not an admin"""- logger.debug(f"Getting store submissions for user {user_id}, page={page}")+ logger.debug(+ (+ "Getting store submissions for user %s, page=%s, search_query=%r, "+ "statuses=%r, sort_key=%r, sort_dir=%s"+ ),+ user_id,+ page,+ search_query,+ statuses,+ sort_key,+ sort_dir,+ )try:skip = (page - 1) * page_size@@ -668,20 +685,38 @@ async def get_store_submissions("is_deleted": False,}- # 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),+ normalized_query = (search_query or "").strip()+ if normalized_query:+ where["OR"] = [+ {"name": {"contains": normalized_query, "mode": "insensitive"}},+ {"slug": {"contains": normalized_query, "mode": "insensitive"}},+ {"sub_heading": {"contains": normalized_query, "mode": "insensitive"}},+ ]+ if statuses:+ where["status"] = {"in": statuses}++ order: list[prisma.types.StoreSubmissionOrderByInput]+ if sort_key == "runs":+ order = [{"run_count": sort_dir}, {"submitted_at": "desc"}]+ else:+ order = [{"submitted_at": sort_dir}]++ submissions_task = prisma.models.StoreSubmission.prisma().find_many(+ where=where,+ skip=skip,+ take=page_size,+ order=order,)+ stats_task = _get_submission_stats(user_id)+ if normalized_query or statuses:+ count_task = prisma.models.StoreSubmission.prisma().count(where=where)+ submissions, stats, total = await asyncio.gather(+ submissions_task, stats_task, count_task+ )+ else:+ submissions, stats = await asyncio.gather(submissions_task, stats_task)+ total = stats.total- total = stats.totaltotal_pages = (total + page_size - 1) // page_sizesubmission_models = [@@ -700,25 +735,9 @@ async def get_store_submissions(stats=stats,)- except Exception as e:- logger.error(f"Error fetching store submissions: {e}")- # Return empty response rather than exposing internal errors- return store_model.StoreSubmissionsResponse(- submissions=[],- pagination=store_model.Pagination(- current_page=page,- total_items=0,- total_pages=0,- page_size=page_size,- ),- stats=store_model.SubmissionStats(- total=0,- approved=0,- pending=0,- total_runs=0,- average_rating=None,- ),- )+ except Exception:+ logger.exception("Error fetching store submissions")+ raiseasync def delete_store_submission(@@ -1195,26 +1214,43 @@ async def get_my_agents(page: int = 1,page_size: int = 20,sort_by: store_model.MyAgentsSortBy = store_model.MyAgentsSortBy.MOST_RECENT,+ search_query: str | None = None,) -> store_model.MyUnpublishedAgentsResponse:"""Get the agents for the authenticated user"""logger.debug(- f"Getting my agents for user {user_id}, page={page}, sort_by={sort_by.value}"+ "Getting my agents for user %s, page=%s, sort_by=%s, search_query=%r",+ user_id,+ page,+ sort_by.value,+ search_query,)try:+ agent_graph_filter: prisma.types.AgentGraphWhereInput = {+ "StoreListingVersions": {+ "none": {+ "isAvailable": True,+ "StoreListing": {"is": {"isDeleted": False}},+ }+ }+ }++ normalized_query = (search_query or "").strip()+ if normalized_query:+ agent_graph_filter["OR"] = [+ {"name": {"contains": normalized_query, "mode": "insensitive"}},+ {+ "description": {+ "contains": normalized_query,+ "mode": "insensitive",+ }+ },+ ]+search_filter: prisma.types.LibraryAgentWhereInput = {"userId": user_id,# Filter for unpublished agents only:- "AgentGraph": {- "is": {- "StoreListingVersions": {- "none": {- "isAvailable": True,- "StoreListing": {"is": {"isDeleted": False}},- }- }- }- },+ "AgentGraph": {"is": agent_graph_filter},"isArchived": False,"isDeleted": False,}diff --git a/autogpt_platform/backend/backend/api/features/store/db_test.py b/autogpt_platform/backend/backend/api/features/store/db_test.pyindex 4996cc8ec5..a232270fc2 100644--- a/autogpt_platform/backend/backend/api/features/store/db_test.py+++ b/autogpt_platform/backend/backend/api/features/store/db_test.py@@ -589,6 +589,166 @@ async def test_get_store_submissions_reuses_stats_total_for_pagination(mocker):assert result.stats.total == 7assert result.stats.average_rating == 3.9mock_store_sub.return_value.count.assert_not_called()+ assert mock_store_sub.return_value.find_many.call_args.kwargs["order"] == [+ {"submitted_at": "desc"}+ ]++[email protected](loop_scope="session")+async def test_get_store_submissions_search_filters_and_counts_matches(mocker):+ mock_store_sub = mocker.patch("prisma.models.StoreSubmission.prisma")+ mock_store_sub.return_value.find_many = AsyncMock(return_value=[])+ mock_store_sub.return_value.count = AsyncMock(return_value=2)+ 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,+ search_query=" invoice ",+ )++ expected_where = {+ "user_id": "user-id",+ "is_deleted": False,+ "OR": [+ {"name": {"contains": "invoice", "mode": "insensitive"}},+ {"slug": {"contains": "invoice", "mode": "insensitive"}},+ {"sub_heading": {"contains": "invoice", "mode": "insensitive"}},+ ],+ }+ assert result.pagination.total_items == 2+ assert result.stats.total == 7+ mock_store_sub.return_value.find_many.assert_called_once()+ mock_store_sub.return_value.count.assert_called_once_with(where=expected_where)+ assert (+ mock_store_sub.return_value.find_many.call_args.kwargs["where"]+ == expected_where+ )++[email protected](loop_scope="session")+async def test_get_store_submissions_sorts_by_runs(mocker):+ mock_store_sub = mocker.patch("prisma.models.StoreSubmission.prisma")+ mock_store_sub.return_value.find_many = AsyncMock(return_value=[])+ 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,+ )+ ]+ ),+ )++ await db.get_store_submissions(+ user_id="user-id",+ page=1,+ page_size=20,+ sort_key="runs",+ sort_dir="asc",+ )++ assert mock_store_sub.return_value.find_many.call_args.kwargs["order"] == [+ {"run_count": "asc"},+ {"submitted_at": "desc"},+ ]++[email protected](loop_scope="session")+async def test_get_store_submissions_reraises_fetch_errors(mocker):+ mock_store_sub = mocker.patch("prisma.models.StoreSubmission.prisma")+ mock_store_sub.return_value.find_many = AsyncMock(+ side_effect=RuntimeError("database unavailable")+ )+ 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,+ )+ ]+ ),+ )++ with pytest.raises(RuntimeError, match="database unavailable"):+ await db.get_store_submissions(user_id="user-id", page=1, page_size=20)++[email protected](loop_scope="session")+async def test_get_store_submissions_status_filters_and_counts_matches(mocker):+ mock_store_sub = mocker.patch("prisma.models.StoreSubmission.prisma")+ mock_store_sub.return_value.find_many = AsyncMock(return_value=[])+ mock_store_sub.return_value.count = AsyncMock(return_value=3)+ 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,+ statuses=[+ prisma.enums.SubmissionStatus.PENDING,+ prisma.enums.SubmissionStatus.APPROVED,+ ],+ )++ expected_where = {+ "user_id": "user-id",+ "is_deleted": False,+ "status": {+ "in": [+ prisma.enums.SubmissionStatus.PENDING,+ prisma.enums.SubmissionStatus.APPROVED,+ ]+ },+ }+ assert result.pagination.total_items == 3+ assert result.stats.total == 7+ mock_store_sub.return_value.find_many.assert_called_once()+ mock_store_sub.return_value.count.assert_called_once_with(where=expected_where)+ assert (+ mock_store_sub.return_value.find_many.call_args.kwargs["where"]+ == expected_where+ )def _make_library_agent(idx: int, now: datetime) -> prisma.models.LibraryAgent:@@ -688,3 +848,41 @@ async def test_get_my_agents_pagination_window(mocker):kwargs = mock_library.return_value.find_many.call_args.kwargsassert kwargs["skip"] == 20assert kwargs["take"] == 10++[email protected](loop_scope="session")+async def test_get_my_agents_search_filters_agent_name_and_description(mocker):+ mock_library = mocker.patch("prisma.models.LibraryAgent.prisma")+ mock_library.return_value.find_many = AsyncMock(return_value=[])+ mock_library.return_value.count = AsyncMock(return_value=0)++ result = await db.get_my_agents(+ user_id="user-id",+ page=1,+ page_size=10,+ search_query=" scraper ",+ )++ expected_agent_graph_filter = {+ "StoreListingVersions": {+ "none": {+ "isAvailable": True,+ "StoreListing": {"is": {"isDeleted": False}},+ }+ },+ "OR": [+ {"name": {"contains": "scraper", "mode": "insensitive"}},+ {"description": {"contains": "scraper", "mode": "insensitive"}},+ ],+ }+ expected_where = {+ "userId": "user-id",+ "AgentGraph": {"is": expected_agent_graph_filter},+ "isArchived": False,+ "isDeleted": False,+ }+ assert result.pagination.total_items == 0+ assert (+ mock_library.return_value.find_many.call_args.kwargs["where"] == expected_where+ )+ mock_library.return_value.count.assert_called_once_with(where=expected_where)diff --git a/autogpt_platform/backend/backend/api/features/store/routes.py b/autogpt_platform/backend/backend/api/features/store/routes.pyindex cbc75b9e14..931aab3e76 100644--- a/autogpt_platform/backend/backend/api/features/store/routes.py+++ b/autogpt_platform/backend/backend/api/features/store/routes.py@@ -1,5 +1,6 @@import loggingimport urllib.parse+from typing import Literalimport autogpt_libs.authimport fastapi@@ -24,6 +25,9 @@ logger = logging.getLogger(__name__)router = fastapi.APIRouter()+SubmissionSortKey = Literal["submitted", "runs"]+SubmissionSortDir = Literal["asc", "desc"]+############################################################# Profile Endpoints ############@@ -334,6 +338,7 @@ async def get_my_unpublished_agents(sort_by: store_model.MyAgentsSortBy = Query(default=store_model.MyAgentsSortBy.MOST_RECENT),+ search_query: str | None = Query(default=None, max_length=100),) -> store_model.MyUnpublishedAgentsResponse:"""List the authenticated user's unpublished agents"""agents = await store_db.get_my_agents(@@ -341,6 +346,7 @@ async def get_my_unpublished_agents(page=page,page_size=page_size,sort_by=sort_by,+ search_query=search_query,)return agents@@ -373,16 +379,46 @@ async def get_submissions(user_id: str = Security(autogpt_libs.auth.get_user_id),page: int = Query(ge=1, default=1),page_size: int = Query(ge=1, default=20),+ search_query: str | None = Query(default=None, max_length=100),+ statuses: str | None = Query(default=None),+ sort_key: SubmissionSortKey | None = Query(default=None),+ sort_dir: SubmissionSortDir = Query(default="desc"),) -> store_model.StoreSubmissionsResponse:"""List the authenticated user's marketplace listing submissions"""+ parsed_statuses = _parse_status_filter(statuses)listings = await store_db.get_store_submissions(user_id=user_id,page=page,page_size=page_size,+ search_query=search_query,+ statuses=parsed_statuses,+ sort_key=sort_key,+ sort_dir=sort_dir,)return listings+def _parse_status_filter(+ raw: str | None,+) -> list[prisma.enums.SubmissionStatus] | None:+ """Parse a comma-separated `statuses` query value into a typed list.++ Orval's fetch client serializes array query params with `value.toString()`,+ which produces a single comma-joined string (`?statuses=PENDING,APPROVED`)+ instead of the FastAPI-default repeated form. Accept that shape here and+ surface invalid enum members as a 422.+ """+ if not raw:+ return None+ parts = [p.strip() for p in raw.split(",") if p.strip()]+ if not parts:+ return None+ try:+ return [prisma.enums.SubmissionStatus(p) for p in parts]+ except ValueError as exc:+ raise fastapi.HTTPException(status_code=422, detail=str(exc)) from exc++@router.post("/submissions",summary="Create store submission",diff --git a/autogpt_platform/backend/backend/api/features/store/routes_test.py b/autogpt_platform/backend/backend/api/features/store/routes_test.pyindex 65b85a4baa..b5b7bd07e8 100644--- a/autogpt_platform/backend/backend/api/features/store/routes_test.py+++ b/autogpt_platform/backend/backend/api/features/store/routes_test.py@@ -28,9 +28,11 @@ def setup_app_auth(mock_jwt_user):"""Setup auth overrides for all tests in this module"""from autogpt_libs.auth.jwt_utils import get_jwt_payload+ store_routes.store_cache.clear_all_caches()app.dependency_overrides[get_jwt_payload] = mock_jwt_user["get_jwt_payload"]yieldapp.dependency_overrides.clear()+ store_routes.store_cache.clear_all_caches()def test_get_agents_defaults(@@ -584,7 +586,15 @@ def test_get_submissions_success(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)+ mock_db_call.assert_called_once_with(+ user_id=test_user_id,+ page=1,+ page_size=20,+ search_query=None,+ statuses=None,+ sort_key=None,+ sort_dir="desc",+ )def test_get_submissions_pagination(@@ -619,7 +629,179 @@ def test_get_submissions_pagination(assert data.pagination.page_size == 5snapshot.snapshot_dir = "snapshots"snapshot.assert_match(json.dumps(response.json(), indent=2), "sub_pagination")- mock_db_call.assert_called_once_with(user_id=test_user_id, page=2, page_size=5)+ mock_db_call.assert_called_once_with(+ user_id=test_user_id,+ page=2,+ page_size=5,+ search_query=None,+ statuses=None,+ sort_key=None,+ sort_dir="desc",+ )+++def test_get_submissions_forwards_search_query(+ mocker: pytest_mock.MockFixture,+ test_user_id: str,+) -> None:+ mocked_value = store_model.StoreSubmissionsResponse(+ submissions=[],+ pagination=store_model.Pagination(+ current_page=1,+ total_items=0,+ total_pages=0,+ page_size=20,+ ),+ stats=store_model.SubmissionStats(+ total=0, approved=0, pending=0, total_runs=0, average_rating=None+ ),+ )+ mock_db_call = mocker.patch("backend.api.features.store.db.get_store_submissions")+ mock_db_call.return_value = mocked_value++ response = client.get("/submissions?search_query=invoice%20agent")+ assert response.status_code == 200+ mock_db_call.assert_called_once_with(+ user_id=test_user_id,+ page=1,+ page_size=20,+ search_query="invoice agent",+ statuses=None,+ sort_key=None,+ sort_dir="desc",+ )+++def test_get_submissions_forwards_statuses(+ mocker: pytest_mock.MockFixture,+ test_user_id: str,+) -> None:+ mocked_value = store_model.StoreSubmissionsResponse(+ submissions=[],+ pagination=store_model.Pagination(+ current_page=1,+ total_items=0,+ total_pages=0,+ page_size=20,+ ),+ stats=store_model.SubmissionStats(+ total=0, approved=0, pending=0, total_runs=0, average_rating=None+ ),+ )+ mock_db_call = mocker.patch("backend.api.features.store.db.get_store_submissions")+ mock_db_call.return_value = mocked_value++ response = client.get("/submissions?statuses=PENDING,APPROVED")+ assert response.status_code == 200+ mock_db_call.assert_called_once_with(+ user_id=test_user_id,+ page=1,+ page_size=20,+ search_query=None,+ statuses=[+ prisma.enums.SubmissionStatus.PENDING,+ prisma.enums.SubmissionStatus.APPROVED,+ ],+ sort_key=None,+ sort_dir="desc",+ )+++def test_get_submissions_forwards_sort(+ mocker: pytest_mock.MockFixture,+ test_user_id: str,+) -> None:+ mocked_value = store_model.StoreSubmissionsResponse(+ submissions=[],+ pagination=store_model.Pagination(+ current_page=1,+ total_items=0,+ total_pages=0,+ page_size=20,+ ),+ stats=store_model.SubmissionStats(+ total=0, approved=0, pending=0, total_runs=0, average_rating=None+ ),+ )+ mock_db_call = mocker.patch("backend.api.features.store.db.get_store_submissions")+ mock_db_call.return_value = mocked_value++ response = client.get("/submissions?sort_key=runs&sort_dir=asc")+ assert response.status_code == 200+ mock_db_call.assert_called_once_with(+ user_id=test_user_id,+ page=1,+ page_size=20,+ search_query=None,+ statuses=None,+ sort_key="runs",+ sort_dir="asc",+ )+++def test_get_submissions_rejects_invalid_sort(+ mocker: pytest_mock.MockFixture,+) -> None:+ mock_db_call = mocker.patch("backend.api.features.store.db.get_store_submissions")+ response = client.get("/submissions?sort_key=name")+ assert response.status_code == 422+ mock_db_call.assert_not_called()+++def test_get_submissions_rejects_invalid_status(+ mocker: pytest_mock.MockFixture,+) -> None:+ mock_db_call = mocker.patch("backend.api.features.store.db.get_store_submissions")+ response = client.get("/submissions?statuses=INVALID")+ assert response.status_code == 422+ mock_db_call.assert_not_called()+++def test_get_submissions_search_query_too_long(+ mocker: pytest_mock.MockFixture,+) -> None:+ mock_db_call = mocker.patch("backend.api.features.store.db.get_store_submissions")+ response = client.get("/submissions?search_query=" + "x" * 101)+ assert response.status_code == 422+ mock_db_call.assert_not_called()+++def test_get_my_unpublished_agents_forwards_search_query(+ mocker: pytest_mock.MockFixture,+ test_user_id: str,+) -> None:+ mocked_value = store_model.MyUnpublishedAgentsResponse(+ agents=[],+ pagination=store_model.Pagination(+ current_page=1,+ total_items=0,+ total_pages=0,+ page_size=10,+ ),+ )+ mock_db_call = mocker.patch("backend.api.features.store.db.get_my_agents")+ mock_db_call.return_value = mocked_value++ response = client.get(+ "/my-unpublished-agents?page=1&page_size=10&search_query=scraper"+ )+ assert response.status_code == 200+ mock_db_call.assert_called_once_with(+ test_user_id,+ page=1,+ page_size=10,+ sort_by=store_model.MyAgentsSortBy.MOST_RECENT,+ search_query="scraper",+ )+++def test_get_my_unpublished_agents_search_query_too_long(+ mocker: pytest_mock.MockFixture,+) -> None:+ mock_db_call = mocker.patch("backend.api.features.store.db.get_my_agents")+ response = client.get("/my-unpublished-agents?search_query=" + "x" * 101)+ assert response.status_code == 422+ mock_db_call.assert_not_called()def test_get_submissions_malformed_request(mocker: pytest_mock.MockFixture):diff --git a/autogpt_platform/backend/migrations/20260516120000_add_creator_search_trgm_indexes/migration.sql b/autogpt_platform/backend/migrations/20260516120000_add_creator_search_trgm_indexes/migration.sqlnew file mode 100644index 0000000000..dc7dae106c--- /dev/null+++ b/autogpt_platform/backend/migrations/20260516120000_add_creator_search_trgm_indexes/migration.sql@@ -0,0 +1,31 @@+-- Creator-tooling search: keep ILIKE '%q%' fast as creator libraries grow.+-- Plain B-tree indexes can't help LIKE patterns with a leading wildcard, so+-- we install pg_trgm and add GIN indexes on the columns that the new+-- /submissions and /my-unpublished-agents search queries scan (Prisma+-- `contains` + `mode: "insensitive"` compiles to ILIKE). StoreSubmission is+-- a view over StoreListing and StoreListingVersion, so the /submissions+-- indexes live on those base table columns instead of the view itself.+--+-- Prisma's `migrate deploy` wraps each migration file in a single+-- transaction, and Postgres rejects `CREATE INDEX CONCURRENTLY` inside a+-- transaction block. The plain `CREATE INDEX` form briefly acquires a+-- ShareLock on each table; for production tables that can't tolerate that,+-- run the equivalent `CREATE INDEX CONCURRENTLY` out-of-band before the+-- migration ships and Postgres will skip the recreate via `IF NOT EXISTS`.++CREATE EXTENSION IF NOT EXISTS pg_trgm;++CREATE INDEX IF NOT EXISTS "AgentGraph_name_trgm_idx"+ ON "AgentGraph" USING gin (name gin_trgm_ops);++CREATE INDEX IF NOT EXISTS "AgentGraph_description_trgm_idx"+ ON "AgentGraph" USING gin (description gin_trgm_ops);++CREATE INDEX IF NOT EXISTS "StoreListingVersion_name_trgm_idx"+ ON "StoreListingVersion" USING gin (name gin_trgm_ops);++CREATE INDEX IF NOT EXISTS "StoreListingVersion_subHeading_trgm_idx"+ ON "StoreListingVersion" USING gin ("subHeading" gin_trgm_ops);++CREATE INDEX IF NOT EXISTS "StoreListing_slug_trgm_idx"+ ON "StoreListing" USING gin (slug gin_trgm_ops);diff --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 c6f9f766b7..027b1dbb29 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@@ -53,7 +53,6 @@ describe("creator-dashboard helpers", () => {test("starts with no filters and descending sort direction", () => {expect(INITIAL_FILTER_STATE).toEqual({statuses: [],- nameQuery: "",sortKey: null,sortDir: "desc",});@@ -73,15 +72,6 @@ describe("creator-dashboard helpers", () => {expect(isFiltered(state)).toBe(true);});- test("returns true if name query is non-empty after trim", () => {- expect(isFiltered({ ...INITIAL_FILTER_STATE, nameQuery: "foo" })).toBe(- true,- );- expect(isFiltered({ ...INITIAL_FILTER_STATE, nameQuery: " " })).toBe(- false,- );- });-test("returns true if sortKey is set", () => {expect(isFiltered({ ...INITIAL_FILTER_STATE, sortKey: "runs" })).toBe(true,@@ -131,23 +121,6 @@ describe("creator-dashboard helpers", () => {expect(result.map((s) => s.listing_version_id)).toEqual(["a", "c"]);});- test("filters by case-insensitive name query", () => {- const result = applyFiltersAndSort(items, {- ...INITIAL_FILTER_STATE,- nameQuery: "BETA",- });- expect(result).toHaveLength(1);- expect(result[0].listing_version_id).toBe("b");- });-- test("ignores whitespace-only name query", () => {- const result = applyFiltersAndSort(items, {- ...INITIAL_FILTER_STATE,- nameQuery: " ",- });- expect(result).toHaveLength(3);- });-test("sorts by runs descending", () => {const result = applyFiltersAndSort(items, {...INITIAL_FILTER_STATE,diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/search.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/search.test.tsxnew file mode 100644index 0000000000..113bb2a1a4--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/search.test.tsx@@ -0,0 +1,290 @@+import { beforeEach, describe, expect, test, vi } from "vitest";++import { getGetV2ListMySubmissionsMockHandler } from "@/app/api/__generated__/endpoints/store/store.msw";+import type { StoreSubmission } from "@/app/api/__generated__/models/storeSubmission";+import type { StoreSubmissionsResponse } from "@/app/api/__generated__/models/storeSubmissionsResponse";+import { SubmissionStatus } from "@/app/api/__generated__/models/submissionStatus";+import { server } from "@/mocks/mock-server";+import { within } from "@testing-library/react";++import {+ fireEvent,+ render,+ screen,+ waitFor,+} from "@/tests/integrations/test-utils";++import SettingsCreatorDashboardPage from "../page";++const mockUseSupabase = vi.hoisted(() => vi.fn());++vi.mock("@/lib/supabase/hooks/useSupabase", () => ({+ useSupabase: mockUseSupabase,+}));++vi.mock("@/components/contextual/PublishAgentModal/PublishAgentModal", () => ({+ PublishAgentModal: ({ trigger }: { trigger: React.ReactNode }) => (+ <>{trigger}</>+ ),+}));++vi.mock("@/components/contextual/EditAgentModal/EditAgentModal", () => ({+ EditAgentModal: () => null,+}));++const testUser = {+ id: "user-1",+ email: "[email protected]",+ app_metadata: {},+ user_metadata: {},+ aud: "authenticated",+ created_at: "2026-01-01T00:00:00.000Z",+};++function makeSubmission(+ overrides: Partial<StoreSubmission> = {},+): StoreSubmission {+ return {+ listing_id: "listing-base",+ user_id: "user-1",+ slug: "agent-slug",+ listing_version_id: "lv-base",+ listing_version: 1,+ graph_id: "graph-base",+ graph_version: 1,+ name: "Base Agent",+ sub_heading: "sub",+ description: "desc",+ instructions: null,+ categories: [],+ image_urls: [],+ video_url: null,+ agent_output_demo_url: null,+ submitted_at: new Date("2026-04-01T00:00:00Z"),+ changes_summary: null,+ status: SubmissionStatus.PENDING,+ run_count: 0,+ review_count: 0,+ review_avg_rating: 0,+ ...overrides,+ };+}++function makeResponse(+ submissions: StoreSubmission[],+): StoreSubmissionsResponse {+ return {+ submissions,+ pagination: {+ total_items: submissions.length,+ total_pages: submissions.length > 0 ? 1 : 0,+ current_page: 1,+ page_size: submissions.length || 20,+ },+ stats: {+ total: submissions.length,+ approved: 0,+ pending: submissions.length,+ total_runs: 0,+ average_rating: null,+ },+ };+}++describe("creator-dashboard search", () => {+ beforeEach(() => {+ mockUseSupabase.mockReturnValue({+ user: testUser,+ isLoggedIn: true,+ isUserLoading: false,+ supabase: {},+ });+ });++ test("typing in search forwards a debounced search_query and renders matches", async () => {+ const observedQueries: (string | null)[] = [];+ server.use(+ getGetV2ListMySubmissionsMockHandler(({ request }) => {+ const url = new URL(request.url);+ const search = url.searchParams.get("search_query");+ observedQueries.push(search);+ const all = [+ makeSubmission({+ listing_version_id: "lv-1",+ name: "Invoice Agent",+ }),+ makeSubmission({+ listing_version_id: "lv-2",+ name: "Scraper Agent",+ }),+ ];+ const filtered = search+ ? all.filter((s) =>+ s.name.toLowerCase().includes(search.toLowerCase()),+ )+ : all;+ return makeResponse(filtered);+ }),+ );++ render(<SettingsCreatorDashboardPage />);++ const list = await screen.findByTestId("submissions-list");+ const scoped = within(list);++ expect(await scoped.findByText("Invoice Agent")).toBeDefined();+ expect(scoped.getByText("Scraper Agent")).toBeDefined();++ const searchBox = scoped.getByRole("searchbox", {+ name: /search submissions/i,+ });+ fireEvent.change(searchBox, { target: { value: "invoice" } });++ await waitFor(+ () => {+ expect(scoped.queryByText("Scraper Agent")).toBeNull();+ },+ { timeout: 2000 },+ );++ expect(scoped.getByText("Invoice Agent")).toBeDefined();+ expect(observedQueries.some((q) => q === "invoice")).toBe(true);+ });++ test("shows a search-specific empty state and clears via the empty-state button", async () => {+ server.use(+ getGetV2ListMySubmissionsMockHandler(({ request }) => {+ const url = new URL(request.url);+ const search = url.searchParams.get("search_query");+ if (search) return makeResponse([]);+ return makeResponse([+ makeSubmission({ listing_version_id: "lv-1", name: "Hello Agent" }),+ ]);+ }),+ );++ render(<SettingsCreatorDashboardPage />);++ const list = await screen.findByTestId("submissions-list");+ const scoped = within(list);++ expect(await scoped.findByText("Hello Agent")).toBeDefined();++ const searchBox = scoped.getByRole("searchbox", {+ name: /search submissions/i,+ });+ fireEvent.change(searchBox, { target: { value: "zzz" } });++ expect(+ await scoped.findByText(/No submissions match "zzz"/, undefined, {+ timeout: 2000,+ }),+ ).toBeDefined();++ const clearButtons = scoped.getAllByRole("button", {+ name: /clear search/i,+ });+ fireEvent.click(clearButtons[clearButtons.length - 1]);++ expect(await scoped.findByText("Hello Agent")).toBeDefined();+ });++ test("status filter forwards statuses to the submissions request", async () => {+ const observedStatuses: (string | null)[] = [];+ server.use(+ getGetV2ListMySubmissionsMockHandler(({ request }) => {+ const url = new URL(request.url);+ const statuses = url.searchParams.get("statuses");+ observedStatuses.push(statuses);++ const all = [+ makeSubmission({+ listing_version_id: "lv-1",+ name: "Pending Agent",+ status: SubmissionStatus.PENDING,+ }),+ makeSubmission({+ listing_version_id: "lv-2",+ name: "Approved Agent",+ status: SubmissionStatus.APPROVED,+ }),+ ];+ const selectedStatuses = statuses?.split(",") ?? [];+ const filtered =+ selectedStatuses.length > 0+ ? all.filter((submission) =>+ selectedStatuses.includes(submission.status),+ )+ : all;++ return makeResponse(filtered);+ }),+ );++ render(<SettingsCreatorDashboardPage />);++ expect(+ (await screen.findAllByText("Pending Agent")).length,+ ).toBeGreaterThan(0);++ fireEvent.click(+ screen.getAllByRole("button", { name: /filter status/i })[0],+ );+ fireEvent.click(+ await screen.findByRole("button", {+ name: /in review/i,+ pressed: false,+ }),+ );++ await waitFor(+ () => {+ expect(observedStatuses).toContain(SubmissionStatus.PENDING);+ expect(screen.queryByText("Approved Agent")).toBeNull();+ },+ { timeout: 3000 },+ );+ });++ test("sort filter forwards sorting to the submissions request", async () => {+ const observedSorts: { key: string | null; dir: string | null }[] = [];+ server.use(+ getGetV2ListMySubmissionsMockHandler(({ request }) => {+ const url = new URL(request.url);+ observedSorts.push({+ key: url.searchParams.get("sort_key"),+ dir: url.searchParams.get("sort_dir"),+ });++ return makeResponse([+ makeSubmission({+ listing_version_id: "lv-1",+ name: "Alpha",+ run_count: 100,+ }),+ makeSubmission({+ listing_version_id: "lv-2",+ name: "Beta",+ run_count: 500,+ }),+ ]);+ }),+ );++ render(<SettingsCreatorDashboardPage />);++ expect((await screen.findAllByText("Alpha")).length).toBeGreaterThan(0);++ fireEvent.click(screen.getAllByRole("button", { name: /filter sort/i })[1]);+ fireEvent.click(+ await screen.findByRole("button", { name: /lowest first/i }),+ );++ await waitFor(+ () => {+ expect(observedSorts).toContainEqual({ key: "runs", dir: "asc" });+ },+ { timeout: 3000 },+ );+ });+});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 1893120d70..07d766415c 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,7 +1,6 @@"use client";import { motion, useReducedMotion } from "framer-motion";-import { CircleNotchIcon } from "@phosphor-icons/react";import type { Pagination as PaginationModel } from "@/app/api/__generated__/models/pagination";import type { StoreSubmission } from "@/app/api/__generated__/models/storeSubmission";@@ -9,6 +8,7 @@ import type { StoreSubmissionEditRequest } from "@/app/api/__generated__/models/import type { SubmissionStatus } from "@/app/api/__generated__/models/submissionStatus";import { Button } from "@/components/atoms/Button/Button";import { Text } from "@/components/atoms/Text/Text";+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";import {EASE_OUT,@@ -35,6 +35,9 @@ interface Props {filterState: FilterState;onFilterChange: (next: FilterState) => void;onResetFilters: () => void;+ searchInput: string;+ onSearchChange: (next: string) => void;+ debouncedSearch: string;onView: (submission: StoreSubmission) => void;onEdit: (payload: EditPayload) => void;onDelete: (submissionId: string) => Promise<void>;@@ -51,6 +54,9 @@ export function MobileSubmissionsList({filterState,onFilterChange,onResetFilters,+ searchInput,+ onSearchChange,+ debouncedSearch,onView,onEdit,onDelete,@@ -84,26 +90,24 @@ export function MobileSubmissionsList({<Text variant="body-medium" as="span" className="text-textBlack">Submissions</Text>- {isFetching ? (- <span- role="status"- aria-live="polite"- className="inline-flex items-center gap-1 text-zinc-500"- data-testid="submissions-fetching"- >- <CircleNotchIcon- size={14}- weight="bold"- className="animate-spin"- />- </span>- ) : null}</div><Text variant="small" className="text-zinc-500">{submissions.length} of {totalCount}</Text></div>+ <div className="px-1">+ <SearchInput+ value={searchInput}+ onChange={onSearchChange}+ placeholder="Search by agent or listing name"+ aria-label="Search submissions"+ maxLength={100}+ loading={isFetching}+ size="small"+ />+ </div>+<div className="flex flex-wrap items-center gap-2 px-1"><FilterChip label="Status"><StatusColumnFilter@@ -149,11 +153,23 @@ export function MobileSubmissionsList({) : (<div className="flex flex-col items-center justify-center gap-3 px-4 py-10 text-center"><Text variant="body-medium" className="text-textBlack">- No submissions match these filters+ {debouncedSearch+ ? `No submissions match "${debouncedSearch}"`+ : "No submissions match these filters"}</Text>- <Button variant="secondary" size="small" onClick={onResetFilters}>- Clear filters- </Button>+ {debouncedSearch ? (+ <Button+ variant="secondary"+ size="small"+ onClick={() => onSearchChange("")}+ >+ Clear search+ </Button>+ ) : (+ <Button variant="secondary" size="small" onClick={onResetFilters}>+ Clear filters+ </Button>+ )}</div>)}{pagination && onPageChange ? (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 35ed17a0d0..cf602964d9 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,7 +1,6 @@"use client";import { motion, useReducedMotion } from "framer-motion";-import { CircleNotchIcon } from "@phosphor-icons/react";import type { Pagination as PaginationModel } from "@/app/api/__generated__/models/pagination";import type { StoreSubmission } from "@/app/api/__generated__/models/storeSubmission";@@ -9,6 +8,7 @@ import type { StoreSubmissionEditRequest } from "@/app/api/__generated__/models/import type { SubmissionStatus } from "@/app/api/__generated__/models/submissionStatus";import { Button } from "@/components/atoms/Button/Button";import { Text } from "@/components/atoms/Text/Text";+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";import {EASE_OUT,@@ -36,6 +36,9 @@ interface Props {filterState: FilterState;onFilterChange: (next: FilterState) => void;onResetFilters: () => void;+ searchInput: string;+ onSearchChange: (next: string) => void;+ debouncedSearch: string;onView: (submission: StoreSubmission) => void;onEdit: (payload: EditPayload) => void;onDelete: (submissionId: string) => Promise<void>;@@ -54,6 +57,9 @@ export function SubmissionsList({filterState,onFilterChange,onResetFilters,+ searchInput,+ onSearchChange,+ debouncedSearch,onView,onEdit,onDelete,@@ -87,29 +93,24 @@ export function SubmissionsList({<Text variant="body-medium" as="span" className="text-textBlack">Submissions</Text>- {isFetching ? (- <span- role="status"- aria-live="polite"- className="inline-flex items-center gap-1 text-zinc-500"- data-testid="submissions-fetching"- >- <CircleNotchIcon- size={14}- weight="bold"- className="animate-spin"- />- <Text variant="small" as="span" className="text-zinc-500">- Updating- </Text>- </span>- ) : null}</div><Text variant="small" className="text-zinc-500">{submissions.length} of {totalCount}</Text></div>+ <div className="pr-1 sm:max-w-md">+ <SearchInput+ value={searchInput}+ onChange={onSearchChange}+ placeholder="Search by agent or listing name"+ aria-label="Search submissions"+ maxLength={100}+ loading={isFetching}+ size="medium"+ />+ </div>+<div className="overflow-hidden rounded-[18px] border border-zinc-200 bg-white shadow-[0_1px_2px_rgba(15,15,20,0.04)]"><div><table className="w-full border-collapse text-left">@@ -180,15 +181,27 @@ export function SubmissionsList({<td colSpan={COLUMN_COUNT} className="px-4 py-12"><div className="flex flex-col items-center justify-center gap-3 text-center"><Text variant="body-medium" className="text-textBlack">- No submissions match these filters+ {debouncedSearch+ ? `No submissions match "${debouncedSearch}"`+ : "No submissions match these filters"}</Text>- <Button- variant="secondary"- size="small"- onClick={onResetFilters}- >- Clear filters- </Button>+ {debouncedSearch ? (+ <Button+ variant="secondary"+ size="small"+ onClick={() => onSearchChange("")}+ >+ Clear search+ </Button>+ ) : (+ <Button+ variant="secondary"+ size="small"+ onClick={onResetFilters}+ >+ Clear filters+ </Button>+ )}</div></td></tr>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 5c6f611724..78cf0b1eae 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@@ -19,14 +19,12 @@ export type SortDir = "asc" | "desc";export interface FilterState {statuses: SubmissionStatus[];- nameQuery: string;sortKey: SortKey | null;sortDir: SortDir;}export const INITIAL_FILTER_STATE: FilterState = {statuses: [],- nameQuery: "",sortKey: null,sortDir: "desc",};@@ -49,11 +47,6 @@ export function applyFiltersAndSort(result = result.filter((s) => set.has(s.status));}- if (state.nameQuery.trim()) {- const q = state.nameQuery.trim().toLowerCase();- result = result.filter((s) => s.name.toLowerCase().includes(q));- }-if (state.sortKey) {const dir = state.sortDir === "asc" ? 1 : -1;result = [...result].sort((a, b) => {@@ -79,11 +72,7 @@ function sortValue(submission: StoreSubmission, key: SortKey): number {}export function isFiltered(state: FilterState): boolean {- return (- state.statuses.length > 0 ||- state.nameQuery.trim() !== "" ||- state.sortKey !== null- );+ return state.statuses.length > 0 || state.sortKey !== null;}export interface StatusVisual {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 565e9f3951..44f45a7586 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@@ -28,6 +28,9 @@ export default function SettingsCreatorDashboardPage() {filterState,setFilterState,resetFilters,+ searchInput,+ setSearchInput,+ debouncedSearch,isLoading,error,refetch,@@ -61,7 +64,8 @@ export default function SettingsCreatorDashboardPage() {return <DashboardSkeleton />;}- const isEmpty = submissions.length === 0;+ const isEmpty =+ submissions.length === 0 && !debouncedSearch && stats.total === 0;return (<div className="flex flex-col gap-6 pb-8">@@ -86,6 +90,9 @@ export default function SettingsCreatorDashboardPage() {filterState={filterState}onFilterChange={setFilterState}onResetFilters={resetFilters}+ searchInput={searchInput}+ onSearchChange={setSearchInput}+ debouncedSearch={debouncedSearch}onView={onViewSubmission}onEdit={onEditSubmission}onDelete={onDeleteSubmission}@@ -103,6 +110,9 @@ export default function SettingsCreatorDashboardPage() {filterState={filterState}onFilterChange={setFilterState}onResetFilters={resetFilters}+ searchInput={searchInput}+ onSearchChange={setSearchInput}+ debouncedSearch={debouncedSearch}onView={onViewSubmission}onEdit={onEditSubmission}onDelete={onDeleteSubmission}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 2ebc004613..98db481682 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,4 +1,4 @@-import { useEffect, useMemo, useRef, useState } from "react";+import { useEffect, useRef, useState } from "react";import * as Sentry from "@sentry/nextjs";import { keepPreviousData } from "@tanstack/react-query";@@ -12,17 +12,18 @@ import type { ProfileDetails } from "@/app/api/__generated__/models/profileDetaiimport type { StoreSubmission } from "@/app/api/__generated__/models/storeSubmission";import type { StoreSubmissionEditRequest } from "@/app/api/__generated__/models/storeSubmissionEditRequest";import type { StoreSubmissionsResponse } from "@/app/api/__generated__/models/storeSubmissionsResponse";+import { useDebouncedValue } from "@/hooks/useDebouncedValue";import { getQueryClient } from "@/lib/react-query/queryClient";import { useSupabase } from "@/lib/supabase/hooks/useSupabase";import {- applyFiltersAndSort,INITIAL_FILTER_STATE,toDashboardStats,type FilterState,} from "./helpers";const PAGE_SIZE = 20;+const SEARCH_QUERY_MAX_LENGTH = 100;type PublishStep = "select" | "info" | "review";@@ -61,6 +62,26 @@ export function useCreatorDashboardPage() {useState<FilterState>(INITIAL_FILTER_STATE);const [page, setPage] = useState(1);+ const [searchInput, setSearchInput] = useState("");+ const [searchResetPending, setSearchResetPending] = useState(false);+ const debouncedSearch = useDebouncedValue(searchInput.trim(), 300);+ const isDebouncingSearch = searchInput.trim() !== debouncedSearch;+ const queryPage = searchResetPending ? 1 : page;++ function handleSearchChange(next: string) {+ const cappedNext = next.slice(0, SEARCH_QUERY_MAX_LENGTH);+ const prevTrimmed = searchInput.trim();+ setSearchInput(cappedNext);+ if (cappedNext.trim() !== prevTrimmed) {+ setSearchResetPending(true);+ }+ }++ useEffect(() => {+ if (!searchResetPending || isDebouncingSearch) return;+ setPage(1);+ setSearchResetPending(false);+ }, [isDebouncingSearch, searchResetPending]);const { data: profile } = useGetV2GetUserProfile({query: {@@ -77,11 +98,21 @@ export function useCreatorDashboardPage() {error,refetch,} = useGetV2ListMySubmissions(- { page, page_size: PAGE_SIZE },+ {+ page: queryPage,+ page_size: PAGE_SIZE,+ search_query: debouncedSearch || undefined,+ statuses:+ filterState.statuses.length > 0+ ? filterState.statuses.join(",")+ : undefined,+ sort_key: filterState.sortKey ?? undefined,+ sort_dir: filterState.sortKey ? filterState.sortDir : undefined,+ },{query: {select: (x) => x.data as StoreSubmissionsResponse,- enabled: !!user,+ enabled: !!user && !isDebouncingSearch,placeholderData: keepPreviousData,},},@@ -124,10 +155,7 @@ export function useCreatorDashboardPage() {const stats = toDashboardStats(response?.stats);- const visibleSubmissions = useMemo(- () => applyFiltersAndSort(submissions, filterState),- [submissions, filterState],- );+ const visibleSubmissions = submissions;function resetFilters() {setFilterState(INITIAL_FILTER_STATE);@@ -192,6 +220,9 @@ export function useCreatorDashboardPage() {filterState,setFilterState,resetFilters,+ searchInput,+ setSearchInput: handleSearchChange,+ debouncedSearch,isLoading: !isSuccess,isReady: isSuccess,error,diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/useConnectServiceDialog.ts b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/useConnectServiceDialog.tsindex dc4a71dc79..f84c00dd60 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/useConnectServiceDialog.ts+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/ConnectServiceDialog/useConnectServiceDialog.ts@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";import { useGetV1ListProviders } from "@/app/api/__generated__/endpoints/integrations/integrations";-import { useDebouncedValue } from "../hooks/useDebouncedValue";+import { useDebouncedValue } from "@/hooks/useDebouncedValue";import {filterConnectableProviders,toConnectableProviders,diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/IntegrationsList/useIntegrationsList.ts b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/IntegrationsList/useIntegrationsList.tsindex f42afa1a27..cded997f11 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/IntegrationsList/useIntegrationsList.ts+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/IntegrationsList/useIntegrationsList.ts@@ -14,7 +14,7 @@ import {useDeleteIntegration,type DeleteIntegrationTarget,} from "../hooks/useDeleteIntegration";-import { useDebouncedValue } from "../hooks/useDebouncedValue";+import { useDebouncedValue } from "@/hooks/useDebouncedValue";import { useIntegrationsSelection } from "./useIntegrationsSelection";export function useIntegrationsList() {diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 28aa61f06a..317721536b 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -9338,6 +9338,18 @@"$ref": "#/components/schemas/MyAgentsSortBy","default": "most_recent"}+ },+ {+ "name": "search_query",+ "in": "query",+ "required": false,+ "schema": {+ "anyOf": [+ { "type": "string", "maxLength": 100 },+ { "type": "null" }+ ],+ "title": "Search Query"+ }}],"responses": {@@ -9528,6 +9540,50 @@"default": 20,"title": "Page Size"}+ },+ {+ "name": "search_query",+ "in": "query",+ "required": false,+ "schema": {+ "anyOf": [+ { "type": "string", "maxLength": 100 },+ { "type": "null" }+ ],+ "title": "Search Query"+ }+ },+ {+ "name": "statuses",+ "in": "query",+ "required": false,+ "schema": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Statuses"+ }+ },+ {+ "name": "sort_key",+ "in": "query",+ "required": false,+ "schema": {+ "anyOf": [+ { "enum": ["submitted", "runs"], "type": "string" },+ { "type": "null" }+ ],+ "title": "Sort Key"+ }+ },+ {+ "name": "sort_dir",+ "in": "query",+ "required": false,+ "schema": {+ "enum": ["asc", "desc"],+ "type": "string",+ "default": "desc",+ "title": "Sort Dir"+ }}],"responses": {diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsxindex 4695393535..00b31d7f3c 100644--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsx+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsx@@ -122,6 +122,7 @@ export function PublishAgentModal({<Dialogstyling={{maxWidth: "48rem",+ marginRight: "0.5rem",}}controlled={{isOpen: currentState.isOpen,diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/AgentSelectStep.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/AgentSelectStep.tsxindex 6b8bc193ea..073c4d7e4c 100644--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/AgentSelectStep.tsx+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/AgentSelectStep.tsx@@ -12,6 +12,7 @@ import {import { Text } from "../../../../atoms/Text/Text";import { Button } from "../../../../atoms/Button/Button";import { Select } from "../../../../atoms/Select/Select";+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";import { StepHeader } from "../StepHeader";import { StepFooter } from "../StepFooter";import { Skeleton } from "@/components/__legacy__/ui/skeleton";@@ -59,6 +60,10 @@ export function AgentSelectStep({pageSize,sortBy,pageDirection,+ searchInput,+ setSearchInput,+ debouncedSearch,+ isDebouncingSearch,handleAgentClick,handleNext,handleSortChange,@@ -97,7 +102,14 @@ export function AgentSelectStep({);}- const showEmpty = !isLoading && totalItems === 0 && myAgents.length === 0;+ const hasNoResults = !isLoading && totalItems === 0 && myAgents.length === 0;+ const hasActiveSearch = Boolean(searchInput.trim() || debouncedSearch);+ const showLibraryEmpty = hasNoResults && !hasActiveSearch && !isFetching;+ const showNoMatches =+ hasNoResults &&+ Boolean(debouncedSearch) &&+ !isFetching &&+ !isDebouncingSearch;return (<div className="mx-auto flex w-full flex-col">@@ -107,7 +119,7 @@ export function AgentSelectStep({currentStep="select"/>- {showEmpty ? (+ {showLibraryEmpty ? (<div className="mt-5 flex min-h-[320px] flex-col items-center justify-center gap-4 rounded-[18px] border border-dashed border-zinc-300 bg-zinc-50 px-6 py-8 text-center"><div className="flex size-11 items-center justify-center rounded-full bg-white text-zinc-700 shadow-[0_1px_2px_rgba(15,15,20,0.06)]"><PlusIcon size={20} weight="bold" />@@ -123,7 +135,18 @@ export function AgentSelectStep({</div>) : (<>- <div className="mt-2 flex items-center justify-start pb-0">+ <div className="mt-2 flex flex-col gap-2 px-1 pb-0 sm:flex-row sm:items-center sm:justify-start">+ <div className="w-full sm:w-[calc((100%-0.5rem)/2)] sm:flex-none">+ <SearchInput+ value={searchInput}+ onChange={setSearchInput}+ placeholder="Search your agents"+ aria-label="Search your agents"+ maxLength={100}+ loading={isFetching || isDebouncingSearch}+ size="small"+ />+ </div><div className="w-full sm:w-[220px]"><Selectid="agent-sort"@@ -133,12 +156,12 @@ export function AgentSelectStep({value={sortBy}onValueChange={handleSortChange}options={SORT_OPTIONS}- wrapperClassName="mb-2"+ wrapperClassName="mb-0"/></div></div>- <div className="flex-grow overflow-hidden pb-3">+ <div className="mt-1 flex-grow overflow-hidden pb-3"><h3 className="sr-only">List of agents</h3><divclassName={cn(@@ -166,6 +189,25 @@ export function AgentSelectStep({</div>))}</div>+ ) : showNoMatches ? (+ <div+ className="flex min-h-[200px] flex-col items-center justify-center gap-2 px-6 py-10 text-center"+ data-testid="agent-search-no-matches"+ >+ <Text variant="body-medium" className="text-textBlack">+ No agents match “{debouncedSearch}”+ </Text>+ <Text variant="small" className="text-zinc-500">+ Try a different name or clear the search.+ </Text>+ <Button+ variant="secondary"+ size="small"+ onClick={() => setSearchInput("")}+ >+ Clear search+ </Button>+ </div>) : (<AnimatePresencemode="wait"diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/AgentSelectStep.test.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/AgentSelectStep.test.tsxindex 10c0db7d61..9369d1364c 100644--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/AgentSelectStep.test.tsx+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/AgentSelectStep.test.tsx@@ -50,6 +50,50 @@ function installHandler(total = 47, pageSize = 10) {);}+function installSearchHandler() {+ const observedSearchQueries: string[] = [];++ server.use(+ http.get(+ "http://localhost:3000/api/proxy/api/store/my-unpublished-agents",+ ({ request }) => {+ const url = new URL(request.url);+ const searchQuery = url.searchParams.get("search_query") ?? "";+ observedSearchQueries.push(searchQuery);++ const agents =+ searchQuery.toLowerCase() === "invoice"+ ? [+ {+ graph_id: "graph-invoice",+ graph_version: 1,+ agent_name: "Invoice Agent",+ description: "Processes invoices",+ last_edited: "2026-05-01T00:00:00.000Z",+ agent_image: null,+ recommended_schedule_cron: null,+ },+ ]+ : searchQuery+ ? []+ : fakeAgents(3, 1, 10);++ return HttpResponse.json({+ agents,+ pagination: {+ current_page: 1,+ total_items: agents.length,+ total_pages: agents.length > 0 ? 1 : 0,+ page_size: 10,+ },+ });+ },+ ),+ );++ return observedSearchQueries;+}+describe("AgentSelectStep", () => {const onSelect = vi.fn();const onCancel = vi.fn();@@ -171,6 +215,71 @@ describe("AgentSelectStep", () => {expect(onOpenBuilder).toHaveBeenCalled();});+ it("passes the debounced search query to the unpublished agents request", async () => {+ const observedSearchQueries = installSearchHandler();+ render(+ <AgentSelectStep+ onSelect={onSelect}+ onCancel={onCancel}+ onNext={onNext}+ onOpenBuilder={onOpenBuilder}+ />,+ );++ await screen.findByText("Agent 1", {}, { timeout: 3000 });++ fireEvent.change(+ screen.getByRole("searchbox", { name: "Search your agents" }),+ { target: { value: "invoice" } },+ );++ await waitFor(+ () => {+ expect(observedSearchQueries).toContain("invoice");+ expect(screen.queryByText("Invoice Agent")).not.toBeNull();+ },+ { timeout: 3000 },+ );+ });++ it("shows a searchable no-matches state that can clear the query", async () => {+ installSearchHandler();+ render(+ <AgentSelectStep+ onSelect={onSelect}+ onCancel={onCancel}+ onNext={onNext}+ onOpenBuilder={onOpenBuilder}+ />,+ );++ await screen.findByText("Agent 1", {}, { timeout: 3000 });++ fireEvent.change(+ screen.getByRole("searchbox", { name: "Search your agents" }),+ { target: { value: "unknown" } },+ );++ expect(+ await screen.findByTestId(+ "agent-search-no-matches",+ {},+ { timeout: 3000 },+ ),+ ).toBeDefined();++ fireEvent.click(+ screen.getAllByRole("button", { name: "Clear search" }).at(-1)!,+ );++ await waitFor(+ () => {+ expect(screen.queryByText("Agent 1")).not.toBeNull();+ },+ { timeout: 3000 },+ );+ });+it("renders the ellipsis page range when total pages exceeds 7", async () => {// 100 items / 10 per page = 10 pages → ellipsis branch is exercised.installHandler(100, 10);diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.tsindex c4d08bdf46..8d1f34597a 100644--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts@@ -3,6 +3,7 @@ import { keepPreviousData } from "@tanstack/react-query";import { useGetV2GetMyAgents } from "@/app/api/__generated__/endpoints/store/store";import { okData } from "@/app/api/helpers";import { MyAgentsSortBy } from "@/app/api/__generated__/models/myAgentsSortBy";+import { useDebouncedValue } from "@/hooks/useDebouncedValue";import { useSupabase } from "@/lib/supabase/hooks/useSupabase";export interface Agent {@@ -30,6 +31,7 @@ interface UseAgentSelectStepProps {}const PAGE_SIZE = 10;+const SEARCH_QUERY_MAX_LENGTH = 100;export function useAgentSelectStep({onSelect,@@ -50,12 +52,32 @@ export function useAgentSelectStep({const [sortBy, setSortBy] = React.useState<MyAgentsSortBy>(MyAgentsSortBy.most_recent,);+ const [searchInput, setSearchInput] = React.useState("");+ const [searchResetPending, setSearchResetPending] = React.useState(false);+ const debouncedSearch = useDebouncedValue(searchInput.trim(), 300);+ const isDebouncingSearch = searchInput.trim() !== debouncedSearch;+ const queryPage = searchResetPending ? 1 : page;const { isLoggedIn } = useSupabase();React.useEffect(() => {setPage(1);}, [sortBy]);+ function handleSearchChange(next: string) {+ const cappedNext = next.slice(0, SEARCH_QUERY_MAX_LENGTH);+ const prevTrimmed = searchInput.trim();+ setSearchInput(cappedNext);+ if (cappedNext.trim() !== prevTrimmed) {+ setSearchResetPending(true);+ }+ }++ React.useEffect(() => {+ if (!searchResetPending || isDebouncingSearch) return;+ setPage(1);+ setSearchResetPending(false);+ }, [isDebouncingSearch, searchResetPending]);+const {data: agentsData,isLoading,@@ -63,13 +85,14 @@ export function useAgentSelectStep({error,} = useGetV2GetMyAgents({- page,+ page: queryPage,page_size: PAGE_SIZE,sort_by: sortBy,+ search_query: debouncedSearch || undefined,},{query: {- enabled: isLoggedIn,+ enabled: isLoggedIn && !isDebouncingSearch,refetchOnMount: "always",staleTime: 0,placeholderData: keepPreviousData,@@ -140,6 +163,10 @@ export function useAgentSelectStep({pageSize: PAGE_SIZE,sortBy,pageDirection,+ searchInput,+ setSearchInput: handleSearchChange,+ debouncedSearch,+ isDebouncingSearch,handleAgentClick,handleNext,handleSortChange,diff --git a/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.stories.tsx b/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.stories.tsxnew file mode 100644index 0000000000..d882e931cc--- /dev/null+++ b/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.stories.tsx@@ -0,0 +1,59 @@+import type { Meta, StoryObj } from "@storybook/nextjs";+import { useEffect, useState } from "react";++import { SearchInput } from "./SearchInput";++const meta: Meta<typeof SearchInput> = {+ title: "Molecules/SearchInput",+ component: SearchInput,+ parameters: {+ layout: "centered",+ },+ args: {+ placeholder: "Search",+ size: "medium",+ },+ argTypes: {+ size: {+ control: { type: "radio" },+ options: ["small", "medium"],+ },+ disabled: { control: "boolean" },+ },+};++export default meta;+type Story = StoryObj<typeof SearchInput>;++function ControlledExample(args: React.ComponentProps<typeof SearchInput>) {+ const [value, setValue] = useState(args.value ?? "");++ useEffect(() => {+ setValue(args.value ?? "");+ }, [args.value]);++ return (+ <div className="w-[360px]">+ <SearchInput {...args} value={value} onChange={setValue} />+ </div>+ );+}++export const Default: Story = {+ render: (args) => <ControlledExample {...args} />,+};++export const WithValue: Story = {+ args: { value: "invoice agent" },+ render: (args) => <ControlledExample {...args} />,+};++export const Small: Story = {+ args: { size: "small", value: "scraper" },+ render: (args) => <ControlledExample {...args} />,+};++export const Disabled: Story = {+ args: { value: "agent", disabled: true },+ render: (args) => <ControlledExample {...args} />,+};diff --git a/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.test.tsx b/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.test.tsxnew file mode 100644index 0000000000..c1a230ba3c--- /dev/null+++ b/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.test.tsx@@ -0,0 +1,92 @@+import { useState } from "react";+import { describe, expect, test, vi } from "vitest";+import userEvent from "@testing-library/user-event";+import { render, screen } from "@/tests/integrations/test-utils";+import { SearchInput } from "./SearchInput";++function Harness({+ initial = "",+ onChange,+ ...rest+}: {+ initial?: string;+ onChange?: (next: string) => void;+} & Omit<React.ComponentProps<typeof SearchInput>, "value" | "onChange">) {+ const [value, setValue] = useState(initial);+ return (+ <SearchInput+ {...rest}+ value={value}+ onChange={(next) => {+ setValue(next);+ onChange?.(next);+ }}+ />+ );+}++describe("SearchInput", () => {+ test("renders placeholder text on the input", () => {+ render(<Harness placeholder="Find creators" />);+ expect(screen.getByPlaceholderText("Find creators")).toBeDefined();+ });++ test("uses placeholder as the accessible label by default", () => {+ render(<Harness placeholder="Find creators" />);+ expect(+ screen.getByRole("searchbox", { name: "Find creators" }),+ ).toBeDefined();+ });++ test("prefers explicit aria-label over placeholder", () => {+ render(+ <Harness placeholder="Find creators" aria-label="Creator search input" />,+ );+ expect(+ screen.getByRole("searchbox", { name: "Creator search input" }),+ ).toBeDefined();+ });++ test("fires onChange for every keystroke", async () => {+ const user = userEvent.setup();+ const handleChange = vi.fn();+ render(<Harness placeholder="Search" onChange={handleChange} />);++ await user.type(screen.getByRole("searchbox"), "abc");++ expect(handleChange).toHaveBeenCalledTimes(3);+ expect(handleChange).toHaveBeenNthCalledWith(1, "a");+ expect(handleChange).toHaveBeenNthCalledWith(2, "ab");+ expect(handleChange).toHaveBeenNthCalledWith(3, "abc");+ });++ test("clear button resets the value and emits empty string", async () => {+ const user = userEvent.setup();+ const handleChange = vi.fn();+ render(+ <Harness placeholder="Search" initial="agent" onChange={handleChange} />,+ );++ const clearButton = screen.getByRole("button", { name: "Clear search" });+ await user.click(clearButton);++ expect(handleChange).toHaveBeenLastCalledWith("");+ expect((screen.getByRole("searchbox") as HTMLInputElement).value).toBe("");+ });++ test("hides the clear button when input is empty", () => {+ render(<Harness placeholder="Search" />);+ expect(screen.queryByRole("button", { name: "Clear search" })).toBeNull();+ });++ test("hides the clear button when disabled, even with a value", () => {+ render(<Harness placeholder="Search" initial="agent" disabled />);+ expect(screen.queryByRole("button", { name: "Clear search" })).toBeNull();+ });++ test("shows a loading status indicator instead of the clear button while loading", () => {+ render(<Harness placeholder="Search" initial="agent" loading />);+ expect(screen.getByRole("status", { name: "Searching" })).toBeDefined();+ expect(screen.queryByRole("button", { name: "Clear search" })).toBeNull();+ });+});diff --git a/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.tsx b/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.tsxnew file mode 100644index 0000000000..b8ad7c3322--- /dev/null+++ b/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.tsx@@ -0,0 +1,105 @@+"use client";++import { forwardRef } from "react";+import {+ CircleNotchIcon,+ MagnifyingGlassIcon,+ XIcon,+} from "@phosphor-icons/react";++import { cn } from "@/lib/utils";++interface Props {+ value: string;+ onChange: (next: string) => void;+ placeholder?: string;+ "aria-label"?: string;+ disabled?: boolean;+ loading?: boolean;+ maxLength?: number;+ size?: "small" | "medium";+ className?: string;+}++const sizeStyles = {+ small: "h-[36px] pl-10 pr-9 text-sm leading-[22px]",+ medium: "h-[46px] pl-12 pr-10 text-sm leading-[22px]",+} as const;++const iconOffset = {+ small: { left: "left-3", right: "right-2" },+ medium: { left: "left-4", right: "right-3" },+} as const;++export const SearchInput = forwardRef<HTMLInputElement, Props>(+ function SearchInput(+ {+ value,+ onChange,+ placeholder = "Search",+ "aria-label": ariaLabel,+ disabled,+ loading,+ maxLength,+ size = "medium",+ className,+ },+ ref,+ ) {+ const hasValue = value.length > 0;+ return (+ <div className={cn("relative w-full", className)}>+ <MagnifyingGlassIcon+ size={size === "small" ? 16 : 20}+ className={cn(+ "pointer-events-none absolute top-1/2 -translate-y-1/2 text-muted-foreground",+ iconOffset[size].left,+ )}+ />+ <input+ ref={ref}+ type="search"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ placeholder={placeholder}+ aria-label={ariaLabel ?? placeholder}+ disabled={disabled}+ maxLength={maxLength}+ className={cn(+ "w-full rounded-xl border border-input bg-background text-foreground placeholder:text-muted-foreground focus:border-ring focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-60",+ sizeStyles[size],+ "[&::-webkit-search-cancel-button]:appearance-none",+ )}+ />+ {loading ? (+ <span+ role="status"+ aria-label="Searching"+ className={cn(+ "absolute top-1/2 flex size-6 -translate-y-1/2 items-center justify-center text-muted-foreground",+ iconOffset[size].right,+ )}+ >+ <CircleNotchIcon+ size={size === "small" ? 14 : 16}+ weight="bold"+ className="animate-spin"+ />+ </span>+ ) : hasValue && !disabled ? (+ <button+ type="button"+ onClick={() => onChange("")}+ aria-label="Clear search"+ className={cn(+ "absolute top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground transition hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ iconOffset[size].right,+ )}+ >+ <XIcon size={size === "small" ? 12 : 14} weight="bold" />+ </button>+ ) : null}+ </div>+ );+ },+);diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/hooks/__tests__/useDebouncedValue.test.ts b/autogpt_platform/frontend/src/hooks/__tests__/useDebouncedValue.test.tssimilarity index 100%rename from autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/hooks/__tests__/useDebouncedValue.test.tsrename to autogpt_platform/frontend/src/hooks/__tests__/useDebouncedValue.test.tsdiff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/hooks/useDebouncedValue.ts b/autogpt_platform/frontend/src/hooks/useDebouncedValue.tssimilarity index 100%rename from autogpt_platform/frontend/src/app/(platform)/settings/integrations/components/hooks/useDebouncedValue.tsrename to autogpt_platform/frontend/src/hooks/useDebouncedValue.ts