Skip to content

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

feat(platform): Files multi-select, Team setup card, and Team/Home design polish (#14469)

Ubbec2c8cd900f24
diff --git a/autogpt_platform/backend/backend/api/features/experts/credentials.py b/autogpt_platform/backend/backend/api/features/experts/credentials.py
index a8eb66ef72..d8f3da2313 100644
--- a/autogpt_platform/backend/backend/api/features/experts/credentials.py
+++ b/autogpt_platform/backend/backend/api/features/experts/credentials.py
@@ -17,6 +17,7 @@ from datetime import datetime, timezone
import prisma.models
+from backend.api.features.experts import scheduling
from backend.api.features.experts.models import ExpertCredentialRef
from backend.data.model import Credentials
from backend.integrations.credentials_store import is_system_credential
@@ -217,6 +218,9 @@ async def grant_expert_credentials(
],
skip_duplicates=True,
)
+ # A missing grant is what usually kept a scheduled workflow from
+ # getting its schedule at install time; now is the moment to retry.
+ await scheduling.create_pending_workflow_schedules(user_id, expert_id)
return _to_refs(await _grants(expert_id), credentials)
diff --git a/autogpt_platform/backend/backend/api/features/experts/experts_db.py b/autogpt_platform/backend/backend/api/features/experts/experts_db.py
index 4b994ab1b3..e7918851c5 100644
--- a/autogpt_platform/backend/backend/api/features/experts/experts_db.py
+++ b/autogpt_platform/backend/backend/api/features/experts/experts_db.py
@@ -51,6 +51,7 @@ from backend.api.features.experts.models import (
)
from backend.api.features.experts.workflow_chain import build_workflow_chain
from backend.api.features.library import db as library_db
+from backend.api.features.library import model as library_model
from backend.api.features.orgs.db import get_user_default_team
from backend.blocks import get_output_block_ids
from backend.copilot.briefing.outcome import DEFAULT_AGENT_NAME, run_link
@@ -1274,6 +1275,16 @@ async def _install_preloads(
if any(p.scheduleCron for p in preloads):
user = await get_user_by_id(user_id)
user_timezone = get_user_timezone_or_utc(user.timezone if user else None)
+ # Rows first, schedules second: creating a schedule resolves credentials
+ # scoped to the expert, which seeds its allow-list from the workflows
+ # installed so far. Interleaving would freeze that list after the first one.
+ installed: list[
+ tuple[
+ prisma.models.ExpertWorkflow,
+ prisma.models.ExpertWorkflow,
+ library_model.LibraryAgent,
+ ]
+ ] = []
for preload in preloads:
if preload.storeListingVersionId is None:
continue
@@ -1300,18 +1311,21 @@ async def _install_preloads(
else preload.storeListingVersionId
)
continue
- if preload.scheduleCron:
- listing = preload.StoreListingVersion
- await scheduling.create_workflow_schedule(
- workflow_row_id=row.id,
- expert_id=expert_id,
- user_id=user_id,
- cron=preload.scheduleCron,
- graph_id=library_agent.graph_id,
- graph_version=library_agent.graph_version,
- name=listing.name if listing else "Expert workflow",
- user_timezone=user_timezone or "UTC",
- )
+ installed.append((row, preload, library_agent))
+ for row, preload, library_agent in installed:
+ if not preload.scheduleCron:
+ continue
+ listing = preload.StoreListingVersion
+ await scheduling.create_workflow_schedule(
+ workflow_row_id=row.id,
+ expert_id=expert_id,
+ user_id=user_id,
+ cron=preload.scheduleCron,
+ graph_id=library_agent.graph_id,
+ graph_version=library_agent.graph_version,
+ name=listing.name if listing else "Expert workflow",
+ user_timezone=user_timezone or "UTC",
+ )
return failed
diff --git a/autogpt_platform/backend/backend/api/features/experts/models.py b/autogpt_platform/backend/backend/api/features/experts/models.py
index 9a49cae3e8..184b20f092 100644
--- a/autogpt_platform/backend/backend/api/features/experts/models.py
+++ b/autogpt_platform/backend/backend/api/features/experts/models.py
@@ -127,6 +127,26 @@ class ExpertIdentity(BaseModel):
is_archived: bool
+class ExpertSetupItem(BaseModel):
+ """One thing standing between a scheduled workflow and its schedule.
+
+ Rendered on the Team page as a row with a single fix. ``connect``: the
+ user has no credential for any of ``providers``. ``allow``: they have one
+ (``credential_id``) that this expert may not use yet. ``workflow``: no
+ credential is missing, so the schedule needs creating from the workflow.
+ """
+
+ expert_id: str
+ expert_name: str
+ expert_avatar_url: str | None
+ workflow_id: str
+ workflow_name: str | None
+ library_agent_id: str | None
+ providers: list[str]
+ resolution: Literal["connect", "allow", "workflow"]
+ credential_id: str | None = None
+
+
class ExpertCredentialRef(BaseModel):
"""One integration credential an expert is allowed to use.
diff --git a/autogpt_platform/backend/backend/api/features/experts/routes.py b/autogpt_platform/backend/backend/api/features/experts/routes.py
index 38fe5bf892..78241c416f 100644
--- a/autogpt_platform/backend/backend/api/features/experts/routes.py
+++ b/autogpt_platform/backend/backend/api/features/experts/routes.py
@@ -5,6 +5,7 @@ from pydantic import BaseModel, Field, field_validator, model_validator
from backend.api.features.experts import credentials as expert_credentials
from backend.api.features.experts import experts_db, scheduling
+from backend.api.features.experts import setup as expert_setup
from backend.api.features.experts.errors import ExpertScheduleCleanupError
from backend.api.features.experts.models import (
EXPERT_AVATAR_URL_MAX_LENGTH,
@@ -21,6 +22,7 @@ from backend.api.features.experts.models import (
ExpertIdentity,
ExpertPod,
ExpertRun,
+ ExpertSetupItem,
ExpertSkillsUpdate,
ExpertSoulUpdate,
ExpertWorkflowRef,
@@ -277,6 +279,14 @@ async def list_expert_identities(
return await experts_db.list_expert_identities(user_id)
[email protected]("/setup", operation_id="list_expert_setup_items")
+async def list_expert_setup_items(
+ user_id: str = Security(autogpt_auth_lib.get_user_id),
+) -> list[ExpertSetupItem]:
+ """What still stands between each expert's scheduled workflows and a schedule."""
+ return await expert_setup.list_setup_items(user_id)
+
+
@router.get(
"/{expert_id}",
operation_id="get_expert",
diff --git a/autogpt_platform/backend/backend/api/features/experts/routes_test.py b/autogpt_platform/backend/backend/api/features/experts/routes_test.py
index 41d034373b..c953a18923 100644
--- a/autogpt_platform/backend/backend/api/features/experts/routes_test.py
+++ b/autogpt_platform/backend/backend/api/features/experts/routes_test.py
@@ -28,6 +28,7 @@ from backend.api.features.experts.models import (
ExpertIdentity,
ExpertPod,
ExpertRun,
+ ExpertSetupItem,
ExpertSoulUpdate,
ExpertWorkflowRef,
HireResult,
@@ -1682,3 +1683,33 @@ def test_assign_pod_unknown_pod_returns_404(
assert response.status_code == 404
assert response.json()["detail"] == "Expert or pod not found"
+
+
+# ─── Setup items ───────────────────────────────────────────────────────
+
+
+def test_list_expert_setup_items_is_not_swallowed_by_the_expert_route(
+ mocker: pytest_mock.MockerFixture,
+) -> None:
+ item = ExpertSetupItem(
+ expert_id="expert-1",
+ expert_name="Maria",
+ expert_avatar_url=None,
+ workflow_id="wf-1",
+ workflow_name="SEO Audit",
+ library_agent_id="library-agent-1",
+ providers=["notion"],
+ resolution="connect",
+ )
+ mock_list = mocker.patch(
+ "backend.api.features.experts.routes.expert_setup.list_setup_items",
+ new_callable=AsyncMock,
+ return_value=[item],
+ )
+
+ response = client.get("/experts/setup")
+
+ assert response.status_code == 200
+ assert response.json()[0]["resolution"] == "connect"
+ assert response.json()[0]["providers"] == ["notion"]
+ mock_list.assert_awaited_once()
diff --git a/autogpt_platform/backend/backend/api/features/experts/scheduling.py b/autogpt_platform/backend/backend/api/features/experts/scheduling.py
index c61d23cb78..7ed32ecdc8 100644
--- a/autogpt_platform/backend/backend/api/features/experts/scheduling.py
+++ b/autogpt_platform/backend/backend/api/features/experts/scheduling.py
@@ -18,9 +18,12 @@ from backend.api.features.experts.errors import ExpertScheduleCleanupError
from backend.api.features.experts.models import ExpertDetachPreview
from backend.copilot import db as chat_db
from backend.data.expert_spend import get_weekly_spend, reset_weekly_spend
+from backend.data.model import CredentialsMetaInput
+from backend.data.user import get_user_by_id
from backend.util.clients import get_scheduler_client
from backend.util.exceptions import ExpertRunPausedError, NotFoundError
from backend.util.settings import Settings
+from backend.util.timezone_utils import get_user_timezone_or_utc
logger = logging.getLogger(__name__)
settings = Settings()
@@ -55,12 +58,16 @@ async def create_workflow_schedule(
"""Create the attributed schedule for an expert workflow and record its
id on the ExpertWorkflow row.
+ The graph's credential inputs are filled from what the expert may use.
Failure is non-fatal and expected for agents that need credentials the
user hasn't connected yet: the cadence stays on the row with a null
``scheduleId``, surfacing the workflow as "needs setup" instead of
silently dropping the roster's intent.
"""
try:
+ input_credentials = await _resolve_workflow_credentials(
+ user_id, expert_id, graph_id, graph_version
+ )
schedule = await get_scheduler_client().add_execution_schedule(
user_id=user_id,
graph_id=graph_id,
@@ -68,7 +75,7 @@ async def create_workflow_schedule(
name=name,
cron=cron,
input_data={},
- input_credentials={},
+ input_credentials=input_credentials,
user_timezone=user_timezone,
expert_id=expert_id,
)
@@ -103,6 +110,60 @@ async def create_workflow_schedule(
return True
+async def _resolve_workflow_credentials(
+ user_id: str, expert_id: str, graph_id: str, graph_version: int
+) -> dict[str, CredentialsMetaInput]:
+ """The graph's credential inputs, filled from the expert's allow-list.
+
+ Partial on purpose: a field nothing matches is left out, and the scheduler
+ then rejects the schedule for the same reason a run would, which is what
+ keeps the workflow in "needs setup".
+ """
+ # Imported here: the matcher lives beside the executor, which imports this
+ # package at module load.
+ from backend.copilot.tools.utils import match_user_credentials_to_graph
+ from backend.data.graph import get_graph
+
+ graph = await get_graph(graph_id, graph_version, user_id, include_subgraphs=True)
+ if graph is None:
+ return {}
+ matched, _missing = await match_user_credentials_to_graph(user_id, graph, expert_id)
+ return matched
+
+
+async def create_pending_workflow_schedules(user_id: str, expert_id: str) -> int:
+ """Retry schedule creation for the expert's workflows still missing one.
+
+ Called after a credential grant, the usual thing that unblocks them.
+ Returns how many schedules were created.
+ """
+ rows = await prisma.models.ExpertWorkflow.prisma().find_many(
+ where={"expertId": expert_id, "scheduleId": None},
+ include={"LibraryAgent": True, "StoreListingVersion": True},
+ )
+ pending = [row for row in rows if row.scheduleCron and row.LibraryAgent]
+ if not pending:
+ return 0
+ user = await get_user_by_id(user_id)
+ user_timezone = get_user_timezone_or_utc(user.timezone if user else None)
+ created = 0
+ for row in pending:
+ library_agent = row.LibraryAgent
+ assert library_agent is not None and row.scheduleCron is not None
+ listing = row.StoreListingVersion
+ created += await create_workflow_schedule(
+ workflow_row_id=row.id,
+ expert_id=expert_id,
+ user_id=user_id,
+ cron=row.scheduleCron,
+ graph_id=library_agent.agentGraphId,
+ graph_version=library_agent.agentGraphVersion,
+ name=listing.name if listing else "Expert workflow",
+ user_timezone=user_timezone,
+ )
+ return created
+
+
async def delete_workflow_schedule(
schedule_id: str, user_id: str, expert_id: str
) -> None:
diff --git a/autogpt_platform/backend/backend/api/features/experts/scheduling_test.py b/autogpt_platform/backend/backend/api/features/experts/scheduling_test.py
index 641c6bbbda..84dfdd8e14 100644
--- a/autogpt_platform/backend/backend/api/features/experts/scheduling_test.py
+++ b/autogpt_platform/backend/backend/api/features/experts/scheduling_test.py
@@ -133,3 +133,106 @@ async def test_budget_gate_fails_closed_for_non_private_expert(mocker) -> None:
assert where["ownerUserId"] == "owner"
assert where["visibility"] == ResourceVisibility.PRIVATE
spend.assert_not_awaited()
+
+
+async def test_create_workflow_schedule_fills_credentials_from_the_allow_list(
+ mocker,
+) -> None:
+ """The scheduler validates credential inputs, so an empty map fails every
+ graph that needs one; the expert's reachable credentials must be passed."""
+ from types import SimpleNamespace
+
+ from backend.data.model import CredentialsMetaInput
+
+ meta = CredentialsMetaInput(
+ id="cred-notion", provider="notion", type="api_key", title="Notion"
+ )
+ mocker.patch.object(
+ scheduling,
+ "_resolve_workflow_credentials",
+ new=AsyncMock(return_value={"notion_credentials": meta}),
+ )
+ scheduler_client = mocker.MagicMock()
+ scheduler_client.add_execution_schedule = AsyncMock(
+ return_value=SimpleNamespace(id="sched-1")
+ )
+ mocker.patch.object(
+ scheduling, "get_scheduler_client", return_value=scheduler_client
+ )
+ workflow_client = mocker.MagicMock()
+ workflow_client.update_many = AsyncMock(return_value=1)
+ mocker.patch.object(
+ scheduling.prisma.models.ExpertWorkflow,
+ "prisma",
+ return_value=workflow_client,
+ )
+
+ created = await scheduling.create_workflow_schedule(
+ workflow_row_id="wf-1",
+ expert_id="expert-1",
+ user_id="owner",
+ cron="0 9 * * 1",
+ graph_id="g1",
+ graph_version=1,
+ name="SEO Audit",
+ user_timezone="UTC",
+ )
+
+ assert created is True
+ assert scheduler_client.add_execution_schedule.await_args.kwargs[
+ "input_credentials"
+ ] == {"notion_credentials": meta}
+
+
+async def test_pending_schedules_are_retried_per_workflow(mocker) -> None:
+ from types import SimpleNamespace
+
+ workflow_client = mocker.MagicMock()
+ workflow_client.find_many = AsyncMock(
+ return_value=[
+ SimpleNamespace(
+ id="wf-1",
+ scheduleCron="0 9 * * 1",
+ scheduleId=None,
+ LibraryAgent=SimpleNamespace(agentGraphId="g1", agentGraphVersion=2),
+ StoreListingVersion=SimpleNamespace(name="SEO Audit"),
+ ),
+ # No cadence: nothing to create.
+ SimpleNamespace(
+ id="wf-2",
+ scheduleCron=None,
+ scheduleId=None,
+ LibraryAgent=SimpleNamespace(agentGraphId="g2", agentGraphVersion=1),
+ StoreListingVersion=None,
+ ),
+ ]
+ )
+ mocker.patch.object(
+ scheduling.prisma.models.ExpertWorkflow,
+ "prisma",
+ return_value=workflow_client,
+ )
+ mocker.patch.object(
+ scheduling,
+ "get_user_by_id",
+ new=AsyncMock(return_value=SimpleNamespace(timezone="Europe/Madrid")),
+ )
+ create = mocker.patch.object(
+ scheduling, "create_workflow_schedule", new=AsyncMock(return_value=True)
+ )
+
+ created = await scheduling.create_pending_workflow_schedules("owner", "expert-1")
+
+ assert created == 1
+ create.assert_awaited_once_with(
+ workflow_row_id="wf-1",
+ expert_id="expert-1",
+ user_id="owner",
+ cron="0 9 * * 1",
+ graph_id="g1",
+ graph_version=2,
+ name="SEO Audit",
+ user_timezone="Europe/Madrid",
+ )
diff --git a/autogpt_platform/backend/backend/api/features/experts/setup.py b/autogpt_platform/backend/backend/api/features/experts/setup.py
new file mode 100644
index 0000000000..9343ce9542
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/experts/setup.py
@@ -0,0 +1,144 @@
+"""What stands between a hired expert and its scheduled work.
+
+A workflow "needs setup" when its roster cadence could not become a schedule
+at install time, almost always because the graph needs a credential the
+expert cannot reach. This names that gap per workflow so the Team page can
+offer the one fix that clears it: connect a service, or allow the expert to
+use one the user already has.
+"""
+
+import logging
+from enum import Enum
+
+import prisma.models
+import prisma.types
+
+from backend.api.features.experts.credentials import (
+ _user_credentials,
+ expert_allowed_credential_ids,
+ filter_credentials_for_expert,
+)
+from backend.api.features.experts.models import ExpertSetupItem
+from backend.data.model import Credentials
+
+logger = logging.getLogger(__name__)
+
+_INCLUDE: prisma.types.ExpertInclude = {
+ "Workflows": {
+ "include": {
+ "LibraryAgent": {"include": {"AgentGraph": True}},
+ "StoreListingVersion": True,
+ }
+ }
+}
+
+
+async def list_setup_items(user_id: str) -> list[ExpertSetupItem]:
+ experts = await prisma.models.Expert.prisma().find_many(
+ where={"ownerUserId": user_id, "isTemplate": False, "isArchived": False},
+ include=_INCLUDE,
+ order={"createdAt": "asc"},
+ )
+ pending = [
+ (expert, workflow)
+ for expert in experts
+ for workflow in expert.Workflows or []
+ if workflow.scheduleCron and workflow.scheduleId is None
+ ]
+ if not pending:
+ return []
+
+ credentials = await _user_credentials(user_id)
+ reachable_by_expert: dict[str, list[Credentials]] = {}
+ items: list[ExpertSetupItem] = []
+ for expert, workflow in pending:
+ if expert.id not in reachable_by_expert:
+ allowed = set(await expert_allowed_credential_ids(user_id, expert.id))
+ reachable_by_expert[expert.id] = filter_credentials_for_expert(
+ credentials, allowed
+ )
+ items.extend(
+ await _workflow_items(
+ user_id, expert, workflow, credentials, reachable_by_expert[expert.id]
+ )
+ )
+ return items
+
+
+async def _workflow_items(
+ user_id: str,
+ expert: prisma.models.Expert,
+ workflow: prisma.models.ExpertWorkflow,
+ credentials: list[Credentials],
+ reachable: list[Credentials],
+) -> list[ExpertSetupItem]:
+ # Imported here: the matcher lives beside the executor, which imports this
+ # package at module load.
+ from backend.copilot.tools.utils import find_matching_credential
+ from backend.data.graph import get_graph
+
+ def item(**overrides) -> ExpertSetupItem:
+ return ExpertSetupItem(
+ expert_id=expert.id,
+ expert_name=expert.name,
+ expert_avatar_url=expert.avatarUrl,
+ workflow_id=workflow.id,
+ workflow_name=_workflow_name(workflow),
+ library_agent_id=workflow.libraryAgentId,
+ **overrides,
+ )
+
+ library_agent = workflow.LibraryAgent
+ if library_agent is None:
+ return [item(providers=[], resolution="workflow")]
+ try:
+ graph = await get_graph(
+ library_agent.agentGraphId,
+ library_agent.agentGraphVersion,
+ user_id,
+ include_subgraphs=True,
+ )
+ except Exception:
+ logger.warning(
+ f"Could not load graph for workflow #{workflow.id} on expert "
+ f"#{expert.id}; reporting it as needing its schedule",
+ exc_info=True,
+ )
+ graph = None
+ if graph is None:
+ return [item(providers=[], resolution="workflow")]
+
+ items: list[ExpertSetupItem] = []
+ for field_info, _, is_required in graph.regular_credentials_inputs.values():
+ # An optional credential never blocks a schedule: the scheduler skips
+ # the node instead.
+ if not is_required:
+ continue
+ if find_matching_credential(reachable, field_info):
+ continue
+ candidate = find_matching_credential(credentials, field_info)
+ items.append(
+ item(
+ providers=sorted(_provider_slug(p) for p in field_info.provider),
+ resolution="allow" if candidate else "connect",
+ credential_id=candidate.id if candidate else None,
+ )
+ )
+ # Everything is reachable yet the schedule is still missing: whatever
+ # failed was not a credential, so hand the user the workflow itself.
+ return items or [item(providers=[], resolution="workflow")]
+
+
+def _workflow_name(workflow: prisma.models.ExpertWorkflow) -> str | None:
+ listing = workflow.StoreListingVersion
+ if listing is not None:
+ return listing.name
+ library_agent = workflow.LibraryAgent
+ if library_agent is None:
+ return None
+ graph = library_agent.AgentGraph
+ return library_agent.name or (graph.name if graph else None)
+
+
+def _provider_slug(provider: object) -> str:
+ return provider.value if isinstance(provider, Enum) else str(provider)
diff --git a/autogpt_platform/backend/backend/api/features/experts/setup_test.py b/autogpt_platform/backend/backend/api/features/experts/setup_test.py
new file mode 100644
index 0000000000..e45cecad0a
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/experts/setup_test.py
@@ -0,0 +1,189 @@
+"""Tests for the Team page's setup card: what each pending workflow is missing."""
+
+from types import SimpleNamespace
+from unittest.mock import AsyncMock
+
+import pytest
+import pytest_mock
+from pydantic import SecretStr
+
+from backend.api.features.experts import setup
+from backend.data.model import APIKeyCredentials, CredentialsFieldInfo
+
+
+def _api_key_credential(credential_id: str, provider: str) -> APIKeyCredentials:
+ return APIKeyCredentials(
+ id=credential_id,
+ provider=provider,
+ api_key=SecretStr("key"),
+ title=f"{provider} key",
+ )
+
+
+def _field(provider: str, required: bool = True):
+ info = CredentialsFieldInfo(
+ credentials_provider=frozenset({provider}),
+ credentials_types=frozenset({"api_key"}),
+ )
+ return (info, set(), required)
+
+
+def _workflow(**overrides) -> SimpleNamespace:
+ values = {
+ "id": "wf-1",
+ "scheduleCron": "0 9 * * 1",
+ "scheduleId": None,
+ "libraryAgentId": "lib-1",
+ "LibraryAgent": SimpleNamespace(
+ agentGraphId="g1",
+ agentGraphVersion=1,
+ name=None,
+ AgentGraph=SimpleNamespace(name="SEO Audit"),
+ ),
+ "StoreListingVersion": None,
+ }
+ values.update(overrides)
+ return SimpleNamespace(**values)
+
+
+def _expert(*workflows: SimpleNamespace) -> SimpleNamespace:
+ return SimpleNamespace(
+ id="expert-1", name="Maria", avatarUrl=None, Workflows=list(workflows)
+ )
+
+
+def _arrange(
+ mocker: pytest_mock.MockFixture,
+ *,
+ experts: list[SimpleNamespace],
+ credentials: list[APIKeyCredentials],
+ allowed: list[str],
+ fields: dict,
+) -> None:
+ expert_client = mocker.MagicMock()
+ expert_client.find_many = AsyncMock(return_value=experts)
+ mocker.patch.object(
+ setup.prisma.models.Expert, "prisma", return_value=expert_client
+ )
+ mocker.patch.object(
+ setup, "_user_credentials", new=AsyncMock(return_value=credentials)
+ )
+ mocker.patch.object(
+ setup, "expert_allowed_credential_ids", new=AsyncMock(return_value=allowed)
+ )
+ mocker.patch(
+ "backend.data.graph.get_graph",
+ new=AsyncMock(return_value=SimpleNamespace(regular_credentials_inputs=fields)),
+ )
+
+
+async def test_lists_nothing_when_every_workflow_has_its_schedule(
+ mocker: pytest_mock.MockFixture,
+):
+ _arrange(
+ mocker,
+ experts=[_expert(_workflow(scheduleId="sched-1"))],
+ credentials=[],
+ allowed=[],
+ fields={"notion": _field("notion")},
+ )
+
+ assert await setup.list_setup_items("user-1") == []
+
+
+async def test_connect_when_the_user_has_no_matching_credential(
+ mocker: pytest_mock.MockFixture,
+):
+ _arrange(
+ mocker,
+ experts=[_expert(_workflow())],
+ credentials=[],
+ allowed=[],
+ fields={"notion": _field("notion")},
+ )
+
+ [item] = await setup.list_setup_items("user-1")
+
+ assert item.resolution == "connect"
+ assert item.providers == ["notion"]
+ assert item.credential_id is None
+ assert item.workflow_name == "SEO Audit"
+ assert item.expert_name == "Maria"
+
+
+async def test_allow_when_a_credential_exists_but_the_expert_may_not_use_it(
+ mocker: pytest_mock.MockFixture,
+):
+ """The fix is a grant, not a new connection, so the row carries the id."""
+ _arrange(
+ mocker,
+ experts=[_expert(_workflow())],
+ credentials=[_api_key_credential("cred-notion", "notion")],
+ allowed=[],
+ fields={"notion": _field("notion")},
+ )
+
+ [item] = await setup.list_setup_items("user-1")
+
+ assert item.resolution == "allow"
+ assert item.credential_id == "cred-notion"
+
+
+async def test_a_reachable_credential_leaves_only_the_missing_schedule(
+ mocker: pytest_mock.MockFixture,
+):
+ """Nothing credential-shaped is missing, so the user gets the workflow."""
+ _arrange(
+ mocker,
+ experts=[_expert(_workflow())],
+ credentials=[_api_key_credential("cred-notion", "notion")],
+ allowed=["cred-notion"],
+ fields={"notion": _field("notion")},
+ )
+
+ [item] = await setup.list_setup_items("user-1")
+
+ assert item.resolution == "workflow"
+ assert item.providers == []
+ assert item.library_agent_id == "lib-1"
+
+
+async def test_optional_credentials_never_block(mocker: pytest_mock.MockFixture):
+ """The scheduler skips a node whose optional credential is unset."""
+ _arrange(
+ mocker,
+ experts=[_expert(_workflow())],
+ credentials=[],
+ allowed=[],
+ fields={"notion": _field("notion", required=False)},
+ )
+
+ [item] = await setup.list_setup_items("user-1")
+
+ assert item.resolution == "workflow"
+
+
+async def test_a_graph_that_fails_to_load_still_reports_the_workflow(
+ mocker: pytest_mock.MockFixture,
+):
+ _arrange(
+ mocker,
+ experts=[_expert(_workflow())],
+ credentials=[],
+ allowed=[],
+ fields={},
+ )
+ mocker.patch(
+ "backend.data.graph.get_graph",
+ new=AsyncMock(side_effect=RuntimeError("db is down")),
+ )
+
+ [item] = await setup.list_setup_items("user-1")
+
+ assert item.resolution == "workflow"
diff --git a/autogpt_platform/backend/backend/api/features/home/attention.py b/autogpt_platform/backend/backend/api/features/home/attention.py
index 9ece4738e8..02552eb106 100644
--- a/autogpt_platform/backend/backend/api/features/home/attention.py
+++ b/autogpt_platform/backend/backend/api/features/home/attention.py
@@ -103,9 +103,8 @@ def _expert_attention(expert: Expert) -> HomeAttentionItem:
),
why_it_matters="Those workflows cannot run until their connections are ready.",
expert=summary,
- primary_action=HomeAction(
- label="Finish setup", href=f"/team/{quote(expert.id)}"
- ),
+ # The Team page carries the setup card that names and fixes the gap.
+ primary_action=HomeAction(label="Finish setup", href="/team"),
)
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/selection.test.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/selection.test.tsx
new file mode 100644
index 0000000000..8bf0af2dd6
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/__tests__/selection.test.tsx
@@ -0,0 +1,285 @@
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+
+import {
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from "@/tests/integrations/test-utils";
+import { server } from "@/mocks/mock-server";
+import { http, HttpResponse } from "msw";
+import { getListExpertIdentitiesMockHandler } from "@/app/api/__generated__/endpoints/experts/experts.msw";
+import {
+ getGetWorkspaceStorageUsageMockHandler,
+ getListWorkspaceFilesMockHandler,
+ getListWorkspaceFoldersMockHandler,
+} from "@/app/api/__generated__/endpoints/workspace/workspace.msw";
+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";
+import type { WorkspaceFolder } from "@/app/api/__generated__/models/workspaceFolder";
+import { FILE_DRAG_MIME } from "../components/WorkspaceFolders/drag";
+
+vi.mock("@/services/feature-flags/use-get-flag", () => ({
+ Flag: { ARTIFACTS_PAGE: "artifacts-page" },
+ useGetFlag: () => true,
+ useFlagStatus: () => ({ enabled: true, ready: true }),
+}));
+
+beforeEach(() => {
+ server.use(getListExpertIdentitiesMockHandler([]));
+});
+
+afterEach(() => {
+ vi.restoreAllMocks();
+ vi.unstubAllGlobals();
+});
+
+// happy-dom ships no window.confirm, so there is nothing to spy on.
+function stubConfirm(answer: boolean) {
+ vi.stubGlobal(
+ "confirm",
+ vi.fn(() => answer),
+ );
+}
+
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({
+ push: vi.fn(),
+ replace: vi.fn(),
+ prefetch: vi.fn(),
+ back: vi.fn(),
+ forward: vi.fn(),
+ refresh: vi.fn(),
+ }),
+ usePathname: () => "/artifacts",
+ useSearchParams: () => new URLSearchParams(),
+ useParams: () => ({}),
+ notFound: () => {
+ throw new Error("NEXT_NOT_FOUND");
+ },
+}));
+
+vi.mock("framer-motion", async (importActual) => {
+ const actual = await importActual<typeof import("framer-motion")>();
+ return { ...actual, useReducedMotion: () => true };
+});
+
+import ArtifactsPage from "../page";
+
+const PROXY = "/api/proxy/api/workspace";
+
+function makeFile(
+ overrides: Partial<WorkspaceFileItem> = {},
+): WorkspaceFileItem {
+ return {
+ id: "file-base",
+ name: "base.txt",
+ path: "/base.txt",
+ mime_type: "text/plain",
+ size_bytes: 1024,
+ folder_id: null,
+ metadata: {},
+ origin: "generated",
+ created_at: "2026-05-01T00:00:00Z",
+ ...overrides,
+ };
+}
+
+function makeFolder(overrides: Partial<WorkspaceFolder> = {}): WorkspaceFolder {
+ return {
+ id: "fld-1",
+ workspace_id: "ws-1",
+ name: "Reports",
+ file_count: 2,
+ created_at: "2026-05-01T00:00:00Z" as unknown as Date,
+ updated_at: "2026-05-01T00:00:00Z" as unknown as Date,
+ ...overrides,
+ };
+}
+
+function useBaseHandlers(files: WorkspaceFileItem[]) {
+ server.use(
+ getGetWorkspaceStorageUsageMockHandler({
+ used_bytes: 0,
+ limit_bytes: 1_000_000_000,
+ used_percent: 0,
+ file_count: 0,
+ }),
+ getListWorkspaceFilesMockHandler({ files, offset: 0, has_more: false }),
+ getListWorkspaceFoldersMockHandler({
+ folders: [makeFolder({ id: "fld-1", name: "Reports" })],
+ }),
+ );
+}
+
+function makeDataTransfer() {
+ const store: Record<string, string> = {};
+ return {
+ store,
+ dataTransfer: {
+ setData: (key: string, value: string) => {
+ store[key] = value;
+ },
+ getData: (key: string) => store[key] ?? "",
+ setDragImage: () => {},
+ get types() {
+ return Object.keys(store);
+ },
+ },
+ };
+}
+
+const TWO_FILES = [
+ makeFile({ id: "f1", name: "one.txt" }),
+ makeFile({ id: "f2", name: "two.txt" }),
+];
+
+describe("ArtifactsPage - row selection", () => {
+ test("clicking a thumbnail selects the row without opening it", async () => {
+ useBaseHandlers(TWO_FILES);
+
+ render(<ArtifactsPage />);
+
+ const toggle = await screen.findByLabelText("Select one.txt");
+ fireEvent.click(toggle);
+
+ expect(await screen.findByTestId("artifacts-selection-bar")).toBeDefined();
+ expect(screen.getByText("1 selected")).toBeDefined();
+ expect(screen.queryByTestId("file-viewer")).toBeNull();
+ expect(toggle.getAttribute("aria-pressed")).toBe("true");
+
+ fireEvent.click(toggle);
+ await waitFor(() =>
+ expect(screen.queryByTestId("artifacts-selection-bar")).toBeNull(),
+ );
+ expect(screen.getByText("Modified")).toBeDefined();
+ });
+
+ test("select all and clear work from the selection bar", async () => {
+ useBaseHandlers(TWO_FILES);
+
+ render(<ArtifactsPage />);
+
+ fireEvent.click(await screen.findByLabelText("Select one.txt"));
+ fireEvent.click(await screen.findByTestId("artifacts-select-all"));
+
+ expect(await screen.findByText("2 selected")).toBeDefined();
+ expect(screen.queryByTestId("artifacts-select-all")).toBeNull();
+
+ fireEvent.click(screen.getByLabelText("Clear selection"));
+ await waitFor(() =>
+ expect(screen.queryByTestId("artifacts-selection-bar")).toBeNull(),
+ );
+ });
+
+ test("deleting the selection deletes every selected file", async () => {
+ useBaseHandlers(TWO_FILES);
+ const deleted: string[] = [];
+ server.use(
+ http.delete(`${PROXY}/files/:fileId`, ({ params }) => {
+ deleted.push(String(params.fileId));
+ return new HttpResponse(null, { status: 204 });
+ }),
+ );
+ stubConfirm(true);
+
+ render(<ArtifactsPage />);
+
+ fireEvent.click(await screen.findByLabelText("Select one.txt"));
+ fireEvent.click(await screen.findByLabelText("Select two.txt"));
+ fireEvent.click(await screen.findByTestId("artifacts-selection-delete"));
+
+ await waitFor(() => expect(deleted.sort()).toEqual(["f1", "f2"]));
+ });
+
+ test("a cancelled delete confirmation deletes nothing", async () => {
+ useBaseHandlers(TWO_FILES);
+ let deleteCalled = false;
+ server.use(
+ http.delete(`${PROXY}/files/:fileId`, () => {
+ deleteCalled = true;
+ return new HttpResponse(null, { status: 204 });
+ }),
+ );
+ stubConfirm(false);
+
+ render(<ArtifactsPage />);
+
+ fireEvent.click(await screen.findByLabelText("Select one.txt"));
+ fireEvent.click(await screen.findByTestId("artifacts-selection-delete"));
+
+ expect(await screen.findByText("1 selected")).toBeDefined();
+ expect(deleteCalled).toBe(false);
+ });
+
+ test("moving the selection posts one bulk move with every id", async () => {
+ useBaseHandlers(TWO_FILES);
+ let body: { file_ids: string[]; folder_id: string | null } | null = null;
+ server.use(
+ http.post(`${PROXY}/folders/files/bulk-move`, async ({ request }) => {
+ body = (await request.json()) as typeof body;
+ return HttpResponse.json([]);
+ }),
+ );
+
+ render(<ArtifactsPage />);
+
+ fireEvent.click(await screen.findByLabelText("Select one.txt"));
+ fireEvent.click(await screen.findByLabelText("Select two.txt"));
+ fireEvent.click(await screen.findByTestId("artifacts-selection-move"));
+ expect(await screen.findByText("Move 2 files to:")).toBeDefined();
+ fireEvent.click(await screen.findByTestId("move-to-folder-option"));
+
+ await waitFor(() =>
+ expect(body).toEqual({ file_ids: ["f1", "f2"], folder_id: "fld-1" }),
+ );
+ });
+
+ test("dragging a selected row onto a folder moves the whole selection", async () => {
+ useBaseHandlers(TWO_FILES);
+ let body: { file_ids: string[]; folder_id: string | null } | null = null;
+ server.use(
+ http.post(`${PROXY}/folders/files/bulk-move`, async ({ request }) => {
+ body = (await request.json()) as typeof body;
+ return HttpResponse.json([]);
+ }),
+ );
+
+ render(<ArtifactsPage />);
+
+ fireEvent.click(await screen.findByLabelText("Select one.txt"));
+ fireEvent.click(await screen.findByLabelText("Select two.txt"));
+
+ const { store, dataTransfer } = makeDataTransfer();
+ const [firstRow] = screen.getAllByTestId("artifacts-list-item");
+ const folder = await screen.findByTestId("workspace-folder");
+ fireEvent.dragStart(firstRow, { dataTransfer });
+ fireEvent.dragOver(folder, { dataTransfer });
+ fireEvent.drop(folder, { dataTransfer });
+ fireEvent.dragEnd(firstRow, { dataTransfer });
+
+ expect(store[FILE_DRAG_MIME]).toBe("f1,f2");
+ await waitFor(() =>
+ expect(body).toEqual({ file_ids: ["f1", "f2"], folder_id: "fld-1" }),
+ );
+ });
+
+ test("dragging an unselected row carries only that file", async () => {
+ useBaseHandlers(TWO_FILES);
+ server.use(
+ http.post(`${PROXY}/folders/files/bulk-move`, () =>
+ HttpResponse.json([]),
+ ),
+ );
+
+ render(<ArtifactsPage />);
+
+ fireEvent.click(await screen.findByLabelText("Select one.txt"));
+
+ const { store, dataTransfer } = makeDataTransfer();
+ const [, secondRow] = screen.getAllByTestId("artifacts-list-item");
+ fireEvent.dragStart(secondRow, { dataTransfer });
+ fireEvent.dragEnd(secondRow, { dataTransfer });
+
+ expect(store[FILE_DRAG_MIME]).toBe("f2");
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactCard/ArtifactCard.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactCard/ArtifactCard.tsx
index 49c5b32cc1..48b6a5df7c 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactCard/ArtifactCard.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactCard/ArtifactCard.tsx
@@ -49,7 +49,7 @@ const REDUCED_CARD_VARIANTS: Variants = {
export function ArtifactCard({ file, onOpen, index = 0 }: Props) {
const typeIcon = getFileTypeIcon(file.mime_type, file.name);
const reduceMotion = useReducedMotion();
- const { handleDragStart, handleDragEnd } = useFileDrag(file.id, file.name);
+ const { handleDragStart, handleDragEnd } = useFileDrag([file.id], file.name);
return (
<motion.li
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsList.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsList.tsx
index 143ceb16d1..47f9030649 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsList.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsList.tsx
@@ -72,7 +72,9 @@ export function ArtifactsList({
/>
</div>
) : (
+ // Keyed so the row selection resets whenever the listing changes.
<ArtifactsTable
+ key={listKey}
files={files}
isLoading={isLoading}
emptyState={emptyState}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/ArtifactsTable.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/ArtifactsTable.tsx
index 1afbeaad7a..3657235e6b 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/ArtifactsTable.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/ArtifactsTable.tsx
@@ -8,10 +8,12 @@ import { motion, useReducedMotion } from "framer-motion";
import type { Variants } from "framer-motion";
import { EmptyState } from "../EmptyState";
import type { EmptyStateContent } from "../helpers";
+import { SelectionBar } from "../SelectionBar/SelectionBar";
import { FileRow } from "./FileRow";
import { FolderRows } from "./FolderRows";
import { SkeletonRow } from "./SkeletonRow";
import { DATE_CELL_CLASS, ROW_GRID_CLASS, SIZE_CELL_CLASS } from "./row-layout";
+import { useFileSelection } from "./useFileSelection";
interface Props {
files: WorkspaceFileItem[];
@@ -42,29 +44,39 @@ export function ArtifactsTable({
onOpen,
}: Props) {
const reduceMotion = useReducedMotion();
+ const selection = useFileSelection(files);
return (
<div data-testid="artifacts-table">
- <div className={cn(ROW_GRID_CLASS, "px-2 pb-2")}>
- <Text variant="body" as="span" className="text-zinc-500">
- Name
- </Text>
- <Text
- variant="body"
- as="span"
- className={cn(DATE_CELL_CLASS, "text-zinc-500")}
- >
- Modified
- </Text>
- <Text
- variant="body"
- as="span"
- className={cn(SIZE_CELL_CLASS, "text-zinc-500")}
- >
- Size
- </Text>
- <span aria-hidden className="min-w-10" />
- </div>
+ {selection.selectedFiles.length > 0 ? (
+ <SelectionBar
+ selectedFiles={selection.selectedFiles}
+ totalCount={files.length}
+ onSelectAll={selection.selectAll}
+ onClear={selection.clear}
+ />
+ ) : (
+ <div className={cn(ROW_GRID_CLASS, "px-2 pb-2")}>
+ <Text variant="body" as="span" className="text-zinc-500">
+ Name
+ </Text>
+ <Text
+ variant="body"
+ as="span"
+ className={cn(DATE_CELL_CLASS, "text-zinc-500")}
+ >
+ Modified
+ </Text>
+ <Text
+ variant="body"
+ as="span"
+ className={cn(SIZE_CELL_CLASS, "text-zinc-500")}
+ >
+ Size
+ </Text>
+ <span aria-hidden />
+ </div>
+ )}
<TooltipProvider delayDuration={450} skipDelayDuration={300}>
<motion.ul
key={listKey}
@@ -91,6 +103,9 @@ export function ArtifactsTable({
file={file}
onOpen={onOpen}
index={index}
+ isSelected={selection.isSelected(file)}
+ selectedIds={selection.selectedIds}
+ onToggleSelect={selection.toggle}
/>
))
)}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FileRow.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FileRow.tsx
index c99868ad44..a346b91ba1 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FileRow.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FileRow.tsx
@@ -9,7 +9,7 @@ import {
TooltipTrigger,
} from "@/components/atoms/Tooltip/BaseTooltip";
import { cn } from "@/lib/utils";
-import { PencilEdit02Icon } from "@hugeicons/core-free-icons";
+import { PencilEdit02Icon, Tick02Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@/components/atoms/Icon/Icon";
import { motion, useReducedMotion } from "framer-motion";
import { useState } from "react";
@@ -35,6 +35,10 @@ interface Props {
onOpen: (file: WorkspaceFileItem) => void;
/** Position in the list; drives the small entrance stagger. */
index?: number;
+ isSelected: boolean;
+ /** Every selected file id; a drag from a selected row carries all of them. */
+ selectedIds: string[];
+ onToggleSelect: (file: WorkspaceFileItem) => void;
}
// Long enough that skimming down the list doesn't flash previews; short
@@ -42,9 +46,18 @@ interface Props {
// provider's skip delay opens the next preview immediately.
const PREVIEW_DELAY_MS = 450;
-export function FileRow({ file, onOpen, index = 0 }: Props) {
+export function FileRow({
+ file,
+ onOpen,
+ index = 0,
+ isSelected,
+ selectedIds,
+ onToggleSelect,
+}: Props) {
const reduceMotion = useReducedMotion();
- const { handleDragStart, handleDragEnd } = useFileDrag(file.id, file.name);
+ const dragIds = isSelected ? selectedIds : [file.id];
+ const dragLabel = dragIds.length > 1 ? `${dragIds.length} files` : file.name;
+ const { handleDragStart, handleDragEnd } = useFileDrag(dragIds, dragLabel);
const [isRenameOpen, setIsRenameOpen] = useState(false);
return (
@@ -56,18 +69,44 @@ export function FileRow({ file, onOpen, index = 0 }: Props) {
className={cn(
ROW_GRID_CLASS,
"group cursor-pointer px-2 transition-colors has-[[data-state=open]]:bg-zinc-50 hover:bg-zinc-50",
+ isSelected && "bg-zinc-100 hover:bg-zinc-100",
)}
data-testid="artifacts-list-item"
+ data-selected={isSelected || undefined}
draggable
onClick={() => onOpen(file)}
onDragStartCapture={handleDragStart}
onDragEndCapture={handleDragEnd}
>
- {/* The name is the row's accessible control: it takes focus, Enter
- bubbles a click up to the row, and hovering (or focusing) it opens
- the large preview. The rename pencil sits beside it, outside the
- preview trigger. */}
+ {/* The thumbnail toggles the row's selection; the name is the row's
+ accessible open control: it takes focus, Enter bubbles a click up to
+ the row, and hovering (or focusing) it opens the large preview. The
+ rename pencil sits beside it, outside the preview trigger. */}
<div className="flex min-w-0 items-center gap-1 justify-self-start">
+ <button
+ type="button"
+ aria-label={`Select ${file.name}`}
+ aria-pressed={isSelected}
+ className="group/select relative my-2.5 mr-3 shrink-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-zinc-400"
+ onClick={(e) => {
+ e.stopPropagation();
+ onToggleSelect(file);
+ }}
+ data-testid="artifacts-select"
+ >
+ <FileThumbnail file={file} />
+ <span
+ aria-hidden
+ className={cn(
+ "pointer-events-none absolute inset-0 flex items-center justify-center rounded-xl text-white transition-opacity",
+ isSelected
+ ? "bg-zinc-900/80 opacity-100"
+ : "bg-zinc-900/60 opacity-0 group-hover/select:opacity-100 group-focus-visible/select:opacity-100",
+ )}
+ >
+ <Icon icon={Tick02Icon} size={20} />
+ </span>
+ </button>
<Tooltip delayDuration={PREVIEW_DELAY_MS}>
<TooltipTrigger asChild>
<button
@@ -75,7 +114,6 @@ export function FileRow({ file, onOpen, index = 0 }: Props) {
className={NAME_BUTTON_CLASS}
data-testid="artifacts-card-open"
>
- <FileThumbnail file={file} />
<Text
variant="body-medium"
as="span"
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FolderRow.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FolderRow.tsx
index 88a5294172..f57f56fe45 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FolderRow.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FolderRow.tsx
@@ -11,7 +11,7 @@ import {
import { motion, useReducedMotion } from "framer-motion";
import { useState } from "react";
import type { DragEvent } from "react";
-import { FILE_DRAG_MIME } from "../../WorkspaceFolders/drag";
+import { FILE_DRAG_MIME, readFileDragIds } from "../../WorkspaceFolders/drag";
import { FOLDER_STYLE } from "../../WorkspaceFolders/folder-constants";
import { formatDayLabel, formatFullDate } from "../helpers";
import {
@@ -32,7 +32,9 @@ interface Props {
onOpen: () => void;
onEdit: () => void;
onDelete: () => void;
- onFileDrop: (fileId: string) => void;
+ onFileDrop: (fileIds: string[]) => void;
+ /** Position in the list; drives the small entrance stagger. */
+ index?: number;
}
const ACTION_BUTTON_CLASS =
@@ -47,6 +49,7 @@ export function FolderRow({
onEdit,
onDelete,
onFileDrop,
+ index = 0,
}: Props) {
const reduceMotion = useReducedMotion();
const [isDragOver, setIsDragOver] = useState(false);
@@ -69,13 +72,18 @@ export function FolderRow({
function handleDrop(e: DragEvent<HTMLLIElement>) {
e.preventDefault();
setIsDragOver(false);
- const fileId = e.dataTransfer.getData(FILE_DRAG_MIME);
- if (fileId) onFileDrop(fileId);
+ const fileIds = readFileDragIds(e.dataTransfer);
+ if (fileIds.length > 0) onFileDrop(fileIds);
}
return (
+ // Animates on its own mount (see row-layout.ts) so a folder created
+ // while the list is already showing doesn't stay in the hidden state.
<motion.li
variants={reduceMotion ? REDUCED_ROW_VARIANTS : ROW_VARIANTS}
+ custom={index}
+ initial={reduceMotion ? false : "hidden"}
+ animate="show"
className={cn(
ROW_GRID_CLASS,
"group cursor-pointer px-2 transition-colors hover:bg-zinc-50",
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FolderRows.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FolderRows.tsx
index 08b6926ff3..72c88229cf 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FolderRows.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/FolderRows.tsx
@@ -13,7 +13,7 @@ interface Props {
}
export function FolderRows({ onSelectFolder }: Props) {
- const { folders, isLoading, isError, error, moveFileToFolder } =
+ const { folders, isLoading, isError, error, moveFilesToFolder } =
useArtifactsFolders();
const [editing, setEditing] = useState<WorkspaceFolder | null>(null);
const [deleting, setDeleting] = useState<WorkspaceFolder | null>(null);
@@ -41,9 +41,10 @@ export function FolderRows({ onSelectFolder }: Props) {
return (
<>
- {folders.map((folder) => (
+ {folders.map((folder, index) => (
<FolderRow
key={folder.id}
+ index={index}
id={folder.id}
name={folder.name}
fileCount={folder.file_count ?? 0}
@@ -51,8 +52,8 @@ export function FolderRows({ onSelectFolder }: Props) {
onOpen={() => onSelectFolder(folder.id)}
onEdit={() => setEditing(folder)}
onDelete={() => setDeleting(folder)}
- onFileDrop={(fileId) => {
- moveFileToFolder({ fileId, folderId: folder.id }).catch(() => {});
+ onFileDrop={(fileIds) => {
+ moveFilesToFolder({ fileIds, folderId: folder.id }).catch(() => {});
}}
/>
))}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/row-layout.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/row-layout.ts
index 6afa19f0f3..69f76d9ea6 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/row-layout.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/row-layout.ts
@@ -1,13 +1,14 @@
import type { Variants } from "framer-motion";
// Column template shared by the header and every row so cells line up.
-// Modified and Size collapse on narrow screens; the trailing column sizes to
-// the row actions.
+// Modified and Size collapse on narrow screens. The trailing column has a
+// fixed width (room for two icon buttons) so rows with a different number of
+// actions don't shift the other columns.
export const ROW_GRID_CLASS =
- "grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 sm:grid-cols-[minmax(0,1fr)_7rem_auto] md:grid-cols-[minmax(0,1fr)_8rem_6rem_auto]";
+ "grid grid-cols-[minmax(0,1fr)_4.5rem] items-center gap-3 sm:grid-cols-[minmax(0,1fr)_7rem_4.5rem] md:grid-cols-[minmax(0,1fr)_8rem_6rem_4.5rem]";
export const DATE_CELL_CLASS = "hidden truncate sm:block";
export const SIZE_CELL_CLASS = "hidden tabular-nums md:block";
-export const ACTIONS_CELL_CLASS = "flex min-w-10 justify-end";
+export const ACTIONS_CELL_CLASS = "flex justify-end";
// Sized to its content (its wrapper is not stretched across the column) so
// the hover preview, which anchors to this button, opens beside the name.
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/useFileSelection.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/useFileSelection.ts
new file mode 100644
index 0000000000..81436bc898
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/ArtifactsTable/useFileSelection.ts
@@ -0,0 +1,42 @@
+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";
+import { useState } from "react";
+
+/**
+ * Multi-select for table rows. The selection is derived from the current
+ * `files`, so an id that leaves the list (deleted, moved, paged out) drops out
+ * of the selection on its own.
+ */
+export function useFileSelection(files: WorkspaceFileItem[]) {
+ const [selectedIdSet, setSelectedIdSet] = useState<ReadonlySet<string>>(
+ () => new Set(),
+ );
+
+ const selectedFiles = files.filter((file) => selectedIdSet.has(file.id));
+ const selectedIds = selectedFiles.map((file) => file.id);
+
+ function toggle(file: WorkspaceFileItem) {
+ setSelectedIdSet((prev) => {
+ const next = new Set(prev);
+ if (next.has(file.id)) next.delete(file.id);
+ else next.add(file.id);
+ return next;
+ });
+ }
+
+ function selectAll() {
+ setSelectedIdSet(new Set(files.map((file) => file.id)));
+ }
+
+ function clear() {
+ setSelectedIdSet(new Set());
+ }
+
+ return {
+ selectedFiles,
+ selectedIds,
+ isSelected: (file: WorkspaceFileItem) => selectedIdSet.has(file.id),
+ toggle,
+ selectAll,
+ clear,
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileActionsMenu.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileActionsMenu.tsx
index db6b81208f..b39a501f03 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileActionsMenu.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/FileActionsMenu.tsx
@@ -133,8 +133,8 @@ export function FileActionsMenu({ file, className }: Props) {
)}
{isMoveOpen && (
<MoveToFolderDialog
- fileId={file.id}
- fileName={file.name}
+ fileIds={[file.id]}
+ subject={`“${file.name}”`}
currentFolderId={file.folder_id}
isOpen={isMoveOpen}
setIsOpen={setIsMoveOpen}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/SelectionBar/SelectionBar.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/SelectionBar/SelectionBar.tsx
new file mode 100644
index 0000000000..f7c0323597
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/SelectionBar/SelectionBar.tsx
@@ -0,0 +1,102 @@
+"use client";
+
+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import {
+ Cancel01Icon,
+ Delete02Icon,
+ Folder01Icon,
+} from "@hugeicons/core-free-icons";
+import { MoveToFolderDialog } from "../../MoveToFolderDialog/MoveToFolderDialog";
+import { useSelectionBar } from "./useSelectionBar";
+
+interface Props {
+ selectedFiles: WorkspaceFileItem[];
+ totalCount: number;
+ onSelectAll: () => void;
+ onClear: () => void;
+}
+
+export function SelectionBar({
+ selectedFiles,
+ totalCount,
+ onSelectAll,
+ onClear,
+}: Props) {
+ const {
+ isMoveOpen,
+ setIsMoveOpen,
+ isDeleting,
+ handleDelete,
+ moveSubject,
+ sharedFolderId,
+ } = useSelectionBar(selectedFiles, onClear);
+ const count = selectedFiles.length;
+
+ return (
+ <div
+ className="flex h-[1.875rem] items-center justify-between gap-3 px-2 pb-2"
+ data-testid="artifacts-selection-bar"
+ >
+ <div className="flex items-center gap-3">
+ <Text variant="body-medium" as="span" className="text-zinc-900">
+ {count} selected
+ </Text>
+ {count < totalCount ? (
+ <button
+ type="button"
+ className="text-sm text-zinc-500 underline-offset-2 hover:text-zinc-900 hover:underline"
+ onClick={onSelectAll}
+ data-testid="artifacts-select-all"
+ >
+ Select all {totalCount}
+ </button>
+ ) : null}
+ </div>
+ <div className="flex items-center gap-2">
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={() => setIsMoveOpen(true)}
+ data-testid="artifacts-selection-move"
+ >
+ <Icon icon={Folder01Icon} size={14} />
+ Move to folder
+ </Button>
+ <Button
+ variant="outline"
+ size="xs"
+ disabled={isDeleting}
+ onClick={handleDelete}
+ className="text-red-600 hover:bg-red-50 hover:text-red-700"
+ data-testid="artifacts-selection-delete"
+ >
+ <Icon icon={Delete02Icon} size={14} />
+ {isDeleting ? "Deleting…" : "Delete"}
+ </Button>
+ <button
+ type="button"
+ aria-label="Clear selection"
+ className="inline-flex h-7 w-7 items-center justify-center rounded-full text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-900"
+ onClick={onClear}
+ data-testid="artifacts-selection-clear"
+ >
+ <Icon icon={Cancel01Icon} size={16} />
+ </button>
+ </div>
+ {isMoveOpen && (
+ <MoveToFolderDialog
+ fileIds={selectedFiles.map((file) => file.id)}
+ subject={moveSubject}
+ currentFolderId={sharedFolderId}
+ canMoveToRoot={selectedFiles.some((file) => file.folder_id != null)}
+ isOpen={isMoveOpen}
+ setIsOpen={setIsMoveOpen}
+ onMoved={onClear}
+ />
+ )}
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/SelectionBar/useSelectionBar.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/SelectionBar/useSelectionBar.ts
new file mode 100644
index 0000000000..065c0c5a7f
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/SelectionBar/useSelectionBar.ts
@@ -0,0 +1,81 @@
+import { deleteWorkspaceFile } from "@/app/api/__generated__/endpoints/workspace/workspace";
+import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";
+import { useToast } from "@/components/molecules/Toast/use-toast";
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useState } from "react";
+import { invalidateWorkspaceFileQueries } from "../helpers";
+
+export function useSelectionBar(
+ selectedFiles: WorkspaceFileItem[],
+ onDone: () => void,
+) {
+ const [isMoveOpen, setIsMoveOpen] = useState(false);
+ const { toast } = useToast();
+ const queryClient = useQueryClient();
+ const count = selectedFiles.length;
+
+ const { mutateAsync: deleteFiles, isPending: isDeleting } = useMutation({
+ // There is no bulk delete endpoint, so delete one by one and report how
+ // many failed; the ones that succeeded leave the list on refetch.
+ mutationFn: async (fileIds: string[]) => {
+ const results = await Promise.allSettled(
+ fileIds.map((fileId) => deleteWorkspaceFile(fileId)),
+ );
+ const failed = results.filter((r) => r.status === "rejected").length;
+ if (failed > 0) {
+ throw new Error(
+ `${failed} of ${fileIds.length} files could not be deleted.`,
+ );
+ }
+ },
+ onSettled: () => invalidateWorkspaceFileQueries(queryClient),
+ onSuccess: (_, fileIds) => {
+ toast({
+ title:
+ fileIds.length === 1
+ ? "File deleted"
+ : `${fileIds.length} files deleted`,
+ });
+ onDone();
+ },
+ onError: (error) => {
+ toast({
+ title: "Failed to delete files",
+ description:
+ error instanceof Error ? error.message : "Please try again.",
+ variant: "destructive",
+ });
+ },
+ });
+
+ async function handleDelete() {
+ if (isDeleting || count === 0) return;
+ const confirmed = window.confirm(
+ count === 1
+ ? `Delete "${selectedFiles[0].name}"?`
+ : `Delete ${count} files?`,
+ );
+ if (!confirmed) return;
+ try {
+ await deleteFiles(selectedFiles.map((file) => file.id));
+ } catch {
+ // Already surfaced by the mutation's onError toast.
+ }
+ }
+
+ const firstFolderId = selectedFiles[0]?.folder_id ?? null;
+ const sharedFolderId = selectedFiles.every(
+ (file) => (file.folder_id ?? null) === firstFolderId,
+ )
+ ? firstFolderId
+ : null;
+
+ return {
+ isMoveOpen,
+ setIsMoveOpen,
+ isDeleting,
+ handleDelete,
+ moveSubject: count === 1 ? `“${selectedFiles[0].name}”` : `${count} files`,
+ sharedFolderId,
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/helpers.ts
index 2b32b1ed53..5796bbeff3 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/helpers.ts
@@ -9,6 +9,12 @@ import {
Video01Icon,
} from "@hugeicons/core-free-icons";
import type { IconSvgElement } from "@hugeicons/react";
+import {
+ getGetWorkspaceStorageUsageQueryKey,
+ getListWorkspaceFoldersQueryKey,
+} from "@/app/api/__generated__/endpoints/workspace/workspace";
+import type { QueryClient } from "@tanstack/react-query";
+import { ARTIFACTS_LIST_QUERY_KEY } from "../../useArtifactsPage";
export type FileOrigin =
| { kind: "session"; sessionId: string; href: string }
@@ -414,3 +420,17 @@ export function getEmptyState(opts: {
chatHref: "/copilot",
};
}
+
+/**
+ * Refetches everything a file deletion touches: the listing, the folder rows
+ * (which show file counts) and the storage footer.
+ */
+export function invalidateWorkspaceFileQueries(queryClient: QueryClient) {
+ queryClient.invalidateQueries({ queryKey: ARTIFACTS_LIST_QUERY_KEY });
+ queryClient.invalidateQueries({
+ queryKey: getListWorkspaceFoldersQueryKey(),
+ });
+ queryClient.invalidateQueries({
+ queryKey: getGetWorkspaceStorageUsageQueryKey(),
+ });
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/useFileActionsMenu.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/useFileActionsMenu.ts
index f83cea9ab2..f7ec8c1d8e 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/useFileActionsMenu.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/ArtifactsList/useFileActionsMenu.ts
@@ -1,14 +1,13 @@
-import {
- getGetWorkspaceStorageUsageQueryKey,
- getListWorkspaceFoldersQueryKey,
- useDeleteWorkspaceFile,
-} from "@/app/api/__generated__/endpoints/workspace/workspace";
+import { useDeleteWorkspaceFile } from "@/app/api/__generated__/endpoints/workspace/workspace";
import type { WorkspaceFileItem } from "@/app/api/__generated__/models/workspaceFileItem";
import { useToast } from "@/components/molecules/Toast/use-toast";
import { useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
-import { ARTIFACTS_LIST_QUERY_KEY } from "../../useArtifactsPage";
-import { deriveFileOrigin, downloadFileBlob } from "./helpers";
+import {
+ deriveFileOrigin,
+ downloadFileBlob,
+ invalidateWorkspaceFileQueries,
+} from "./helpers";
export function useFileActionsMenu(file: WorkspaceFileItem) {
const origin = deriveFileOrigin(file.path);
@@ -21,17 +20,7 @@ export function useFileActionsMenu(file: WorkspaceFileItem) {
useDeleteWorkspaceFile({
mutation: {
onSuccess: () => {
- queryClient.invalidateQueries({
- queryKey: ARTIFACTS_LIST_QUERY_KEY,
- });
- // Folder rows show file counts and the footer shows storage used,
- // so both go stale after a deletion.
- queryClient.invalidateQueries({
- queryKey: getListWorkspaceFoldersQueryKey(),
- });
- queryClient.invalidateQueries({
- queryKey: getGetWorkspaceStorageUsageQueryKey(),
- });
+ invalidateWorkspaceFileQueries(queryClient);
toast({ title: "File deleted" });
},
onError: (error) => {
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/MoveToFolderDialog/MoveToFolderDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/MoveToFolderDialog/MoveToFolderDialog.tsx
index c478375079..eb4dfd3a6d 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/MoveToFolderDialog/MoveToFolderDialog.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/MoveToFolderDialog/MoveToFolderDialog.tsx
@@ -8,28 +8,40 @@ import { Folder01Icon, Home01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@/components/atoms/Icon/Icon";
interface Props {
- fileId: string;
- fileName: string;
+ fileIds: string[];
+ /** What is being moved, as shown in the prompt: `“report.pdf”` or `3 files`. */
+ subject: string;
+ /** Folder every file already sits in, left out of the destinations.
+ `null` when the files are at the root or spread across folders. */
currentFolderId?: string | null;
+ /** Offer "Files (root)". Defaults to "some file is inside a folder", which
+ `currentFolderId` alone cannot express for a mixed selection. */
+ canMoveToRoot?: boolean;
isOpen: boolean;
setIsOpen: (open: boolean) => void;
+ onMoved?: () => void;
}
export function MoveToFolderDialog({
- fileId,
- fileName,
+ fileIds,
+ subject,
currentFolderId,
+ canMoveToRoot = currentFolderId != null,
isOpen,
setIsOpen,
+ onMoved,
}: Props) {
- const { folders, moveFileToFolder } = useArtifactsFolders();
+ const { folders, moveFilesToFolder } = useArtifactsFolders();
const destinationFolders = folders.filter((f) => f.id !== currentFolderId);
function handleMove(folderId: string | null) {
// Close only on success; the hook toasts on error and we keep the dialog
// open so the user can retry without re-opening it.
- moveFileToFolder({ fileId, folderId })
- .then(() => setIsOpen(false))
+ moveFilesToFolder({ fileIds, folderId })
+ .then(() => {
+ setIsOpen(false);
+ onMoved?.();
+ })
.catch(() => {});
}
@@ -42,9 +54,9 @@ export function MoveToFolderDialog({
<Dialog.Content>
<div className="flex flex-col gap-1">
<Text variant="small" className="mb-1 text-zinc-500">
- Move &ldquo;{fileName}&rdquo; to:
+ Move {subject} to:
</Text>
- {currentFolderId != null && (
+ {canMoveToRoot && (
<Button
variant="ghost"
className="w-full justify-start gap-3 px-3 py-2.5"
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/WorkspaceFolder.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/WorkspaceFolder.tsx
index 6124e1c7d0..0fd71c4917 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/WorkspaceFolder.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/WorkspaceFolder.tsx
@@ -3,7 +3,7 @@
import { useState } from "react";
import { Button } from "@/components/atoms/Button/Button";
import { Text } from "@/components/atoms/Text/Text";
-import { FILE_DRAG_MIME } from "./drag";
+import { FILE_DRAG_MIME, readFileDragIds } from "./drag";
import { FOLDER_STYLE } from "./folder-constants";
import {
Delete02Icon,
@@ -20,7 +20,7 @@ interface Props {
onEdit: () => void;
onDelete: () => void;
onClick: () => void;
- onFileDrop: (fileId: string, folderId: string) => void;
+ onFileDrop: (fileIds: string[], folderId: string) => void;
}
export function WorkspaceFolder({
@@ -53,8 +53,8 @@ export function WorkspaceFolder({
function handleDrop(e: React.DragEvent<HTMLDivElement>) {
e.preventDefault();
setIsDragOver(false);
- const fileId = e.dataTransfer.getData(FILE_DRAG_MIME);
- if (fileId) onFileDrop(fileId, id);
+ const fileIds = readFileDragIds(e.dataTransfer);
+ if (fileIds.length > 0) onFileDrop(fileIds, id);
}
return (
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/WorkspaceFolders.tsx b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/WorkspaceFolders.tsx
index 491752aa86..033f8d1e31 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/WorkspaceFolders.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/WorkspaceFolders.tsx
@@ -14,7 +14,7 @@ interface Props {
}
export function WorkspaceFolders({ onSelectFolder }: Props) {
- const { folders, isLoading, isError, error, moveFileToFolder } =
+ const { folders, isLoading, isError, error, moveFilesToFolder } =
useArtifactsFolders();
const [editing, setEditing] = useState<WorkspaceFolderModel | null>(null);
@@ -58,8 +58,8 @@ export function WorkspaceFolders({ onSelectFolder }: Props) {
onClick={() => onSelectFolder(folder.id)}
onEdit={() => setEditing(folder)}
onDelete={() => setDeleting(folder)}
- onFileDrop={(fileId, folderId) => {
- moveFileToFolder({ fileId, folderId }).catch(() => {});
+ onFileDrop={(fileIds, folderId) => {
+ moveFilesToFolder({ fileIds, folderId }).catch(() => {});
}}
/>
))}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/drag.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/drag.ts
index f45065df8a..ef3304c592 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/drag.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/drag.ts
@@ -1,6 +1,23 @@
-/** DataTransfer MIME type used when dragging a file card onto a folder. */
+/** DataTransfer MIME type used when dragging file cards/rows onto a folder. */
export const FILE_DRAG_MIME = "application/workspace-file-id";
+// File ids are UUIDs, so a comma can't appear inside one.
+const ID_SEPARATOR = ",";
+
+export function writeFileDragData(
+ dataTransfer: DataTransfer,
+ fileIds: string[],
+) {
+ dataTransfer.setData(FILE_DRAG_MIME, fileIds.join(ID_SEPARATOR));
+}
+
+export function readFileDragIds(dataTransfer: DataTransfer): string[] {
+ return dataTransfer
+ .getData(FILE_DRAG_MIME)
+ .split(ID_SEPARATOR)
+ .filter(Boolean);
+}
+
const FILE_GLYPH = `<svg width="20" height="20" viewBox="0 0 256 256" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"></path></svg>`;
function escapeHtml(value: string): string {
@@ -16,7 +33,7 @@ function escapeHtml(value: string): string {
* dragging a file card, so the cursor carries a compact file chip instead of a
* snapshot of the whole card. Caller is responsible for removing it on dragend.
*/
-export function createFileDragImage(fileName: string): HTMLElement {
+export function createFileDragImage(label: string): HTMLElement {
const el = document.createElement("div");
el.style.cssText = [
"position:absolute",
@@ -34,7 +51,7 @@ export function createFileDragImage(fileName: string): HTMLElement {
"box-shadow:0 4px 12px rgba(0,0,0,0.08)",
].join(";");
el.innerHTML = `${FILE_GLYPH}<span style="color:#18181b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:160px;">${escapeHtml(
- fileName,
+ label,
)}</span>`;
return el;
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/useFileDrag.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/useFileDrag.ts
index ec900e6d0b..565f3abe1c 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/useFileDrag.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/components/WorkspaceFolders/useFileDrag.ts
@@ -1,12 +1,14 @@
import { useEffect, useRef } from "react";
import type { DragEvent } from "react";
-import { createFileDragImage, FILE_DRAG_MIME } from "./drag";
+import { createFileDragImage, writeFileDragData } from "./drag";
/**
* Drag handlers for a file card/row so it can be dropped onto a folder. Owns
* the off-screen drag-image node and removes it on dragend or unmount.
+ * `fileIds` are the files carried by the drag; `label` is shown in the chip
+ * under the cursor.
*/
-export function useFileDrag(fileId: string, fileName: string) {
+export function useFileDrag(fileIds: string[], label: string) {
const dragImageRef = useRef<HTMLElement | null>(null);
// Clean up a leftover drag-image node if the element unmounts mid-drag
@@ -20,9 +22,9 @@ export function useFileDrag(fileId: string, fileName: string) {
function handleDragStart(e: DragEvent<HTMLElement>) {
dragImageRef.current?.remove();
- e.dataTransfer.setData(FILE_DRAG_MIME, fileId);
+ writeFileDragData(e.dataTransfer, fileIds);
e.dataTransfer.effectAllowed = "move";
- const dragImage = createFileDragImage(fileName);
+ const dragImage = createFileDragImage(label);
document.body.appendChild(dragImage);
e.dataTransfer.setDragImage(dragImage, 16, 16);
dragImageRef.current = dragImage;
diff --git a/autogpt_platform/frontend/src/app/(platform)/artifacts/useArtifactsFolders.ts b/autogpt_platform/frontend/src/app/(platform)/artifacts/useArtifactsFolders.ts
index 14af989547..c62dcbb330 100644
--- a/autogpt_platform/frontend/src/app/(platform)/artifacts/useArtifactsFolders.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/artifacts/useArtifactsFolders.ts
@@ -74,12 +74,17 @@ export function useArtifactsFolders() {
const moveMutation = useBulkMoveWorkspaceFiles({
mutation: {
- onSuccess: () => {
+ onSuccess: (_, variables) => {
invalidate();
- toast({ title: "File moved" });
+ const count = variables.data.file_ids.length;
+ toast({ title: count === 1 ? "File moved" : `${count} files moved` });
},
- onError: () => {
- toast({ title: "Failed to move file", variant: "destructive" });
+ onError: (_, variables) => {
+ const count = variables.data.file_ids.length;
+ toast({
+ title: count === 1 ? "Failed to move file" : "Failed to move files",
+ variant: "destructive",
+ });
},
},
});
@@ -101,9 +106,9 @@ export function useArtifactsFolders() {
deleteFolder: (folderId: string) =>
deleteMutation.mutateAsync({ folderId }),
isDeleting: deleteMutation.isPending,
- moveFileToFolder: (args: { fileId: string; folderId: string | null }) =>
+ moveFilesToFolder: (args: { fileIds: string[]; folderId: string | null }) =>
moveMutation.mutateAsync({
- data: { file_ids: [args.fileId], folder_id: args.folderId },
+ data: { file_ids: args.fileIds, folder_id: args.folderId },
}),
};
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx
index 7970248cde..5086ce5653 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx
@@ -318,6 +318,7 @@ export const ChatContainer = ({
queuedMessages={queuedMessages}
bottomContentPadding={usageCardHeight}
expertIdentity={expertIdentity}
+ isResolvingExpertIdentity={isResolvingExpertIdentity}
hasFloatingControls={hasFloatingControls}
canOpenActivity={isArtifactsEnabled}
areFilesOpen={areFilesOpen}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx
index 5edb821139..631304e1f9 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx
@@ -96,6 +96,9 @@ interface Props {
/** Expert identity for expert-scoped sessions: drives the thread header
* and the assistant avatar/name. Null/undefined = default header. */
expertIdentity?: ExpertIdentity | null;
+ /** The roster is still loading for an expert-scoped session, so the
+ * header must not yet claim the thread is Autopilot's. */
+ isResolvingExpertIdentity?: boolean;
/** The layout floats its sidebar/files controls over the chat's top-left
* corner on small viewports (see ThreadHeader). */
hasFloatingControls?: boolean;
@@ -311,6 +314,7 @@ export function ChatMessagesContainer({
filePattern,
fileUrlBuilder,
expertIdentity,
+ isResolvingExpertIdentity = false,
hasFloatingControls = false,
canOpenActivity = false,
areFilesOpen = false,
@@ -474,6 +478,7 @@ export function ChatMessagesContainer({
{showThreadHeader && (
<ThreadHeader
expertIdentity={expertIdentity}
+ isResolvingExpertIdentity={isResolvingExpertIdentity}
readOnly={readOnly}
sessionId={sessionID}
hasFloatingControls={hasFloatingControls}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertAvatar/ExpertAvatar.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertAvatar/ExpertAvatar.tsx
index ebcdd4eefe..788dd3fc9a 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertAvatar/ExpertAvatar.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ExpertAvatar/ExpertAvatar.tsx
@@ -4,18 +4,36 @@ import {
AvatarImage,
} from "@/components/atoms/Avatar/Avatar";
import { AutopilotAvatar } from "@/components/molecules/AutopilotAvatar/AutopilotAvatar";
+import { cn } from "@/lib/utils";
interface Props {
name: string;
avatarUrl: string | null;
isAutopilot?: boolean;
+ /** Identity still loading: a muted grey circle, no stand-in identity. */
+ isLoading?: boolean;
size?: "sm" | "md";
}
-export function ExpertAvatar({ name, avatarUrl, isAutopilot, size }: Props) {
+export function ExpertAvatar({
+ name,
+ avatarUrl,
+ isAutopilot,
+ isLoading,
+ size,
+}: Props) {
const isSmall = size === "sm";
const sizeClass = isSmall ? "h-6 w-6" : "h-9 w-9";
+ if (isLoading) {
+ return (
+ <span
+ aria-hidden="true"
+ className={cn("shrink-0 rounded-full bg-zinc-100", sizeClass)}
+ />
+ );
+ }
+
if (isAutopilot && !avatarUrl) {
return (
<AutopilotAvatar
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsx
index ffbd058d49..b37aeb58ca 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/ThreadHeader.tsx
@@ -1,6 +1,7 @@
"use client";
import { Icon } from "@/components/atoms/Icon/Icon";
+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
import {
Tooltip,
TooltipContent,
@@ -22,6 +23,8 @@ const DEFAULT_EXPERT_ROLE = "Head of AI";
interface Props {
expertIdentity?: ExpertIdentity | null;
+ /** The roster has not settled yet for an expert-scoped session. */
+ isResolvingExpertIdentity?: boolean;
readOnly: boolean;
/** Powers the chip's file/run counters and its click-through to the
* session activity card. Without it the chip is a passive label. */
@@ -45,13 +48,19 @@ interface Props {
* the expert's integration logos sit beside it with their own popover. */
export function ThreadHeader({
expertIdentity,
+ isResolvingExpertIdentity = false,
readOnly,
sessionId = null,
canOpenActivity = false,
hasFloatingControls = false,
}: Props) {
+ // While the roster loads, the chip shows a quiet placeholder rather than
+ // AutoPilot's identity, which would be wrong for an expert session.
+ const isResolving = isResolvingExpertIdentity && !expertIdentity;
const name = expertIdentity?.name ?? "AutoPilot";
const role = expertIdentity?.role ?? DEFAULT_EXPERT_ROLE;
+ // Assistive tech gets a loading identity too, not Autopilot's.
+ const identityLabel = isResolving ? "Loading expert" : `${name}, ${role}`;
const isArtifactsEnabled = useGetFlag(Flag.ARTIFACTS);
// Only the copilot chat mounts the activity card. The builder and memory
// panels pass a live sessionId and aren't read-only, so without the host's
@@ -89,12 +98,17 @@ export function ThreadHeader({
<ExpertAvatar
name={name}
avatarUrl={expertIdentity?.avatarUrl ?? null}
- isAutopilot={!expertIdentity}
+ isAutopilot={!expertIdentity && !isResolving}
+ isLoading={isResolving}
size="sm"
/>
- <span className="max-w-[10rem] truncate text-sm font-medium text-zinc-800">
- {name}
- </span>
+ {isResolving ? (
+ <Skeleton className="h-3.5 w-16 rounded" />
+ ) : (
+ <span className="max-w-[10rem] truncate text-sm font-medium text-zinc-800">
+ {name}
+ </span>
+ )}
{counters.map(({ icon, count, noun }) => (
<span
key={noun}
@@ -128,8 +142,8 @@ export function ThreadHeader({
type="button"
aria-label={
spokenCounts
- ? `${name}, ${role}. ${spokenCounts}. Open session activity`
- : `${name}, ${role}. Open session activity`
+ ? `${identityLabel}. ${spokenCounts}. Open session activity`
+ : `${identityLabel}. Open session activity`
}
onClick={() => toggleContextPanelTab("files")}
className="flex min-w-0 items-center gap-2 rounded-full py-1 pl-1.5 pr-3 transition-colors hover:bg-zinc-100/80"
@@ -143,19 +157,23 @@ export function ThreadHeader({
// get the role at all.
<div
tabIndex={0}
- aria-label={`${name} — ${role}`}
+ aria-label={
+ isResolving ? identityLabel : `${name} — ${role}`
+ }
className="flex min-w-0 items-center gap-2 rounded-full py-1 pl-1.5 pr-3"
>
{chipContent}
</div>
)}
</TooltipTrigger>
- <TooltipContent
- side="bottom"
- className="bg-zinc-900 text-zinc-50 outline-none"
- >
- {role}
- </TooltipContent>
+ {isResolving ? null : (
+ <TooltipContent
+ side="bottom"
+ className="bg-zinc-900 text-zinc-50 outline-none"
+ >
+ {role}
+ </TooltipContent>
+ )}
</Tooltip>
</TooltipProvider>
{showIntegrations && (
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/AgentTeam/components/AgentRow.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/AgentTeam/components/AgentRow.tsx
index 0d4646efe2..f154374ab4 100644
--- a/autogpt_platform/frontend/src/app/(platform)/home/components/AgentTeam/components/AgentRow.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/AgentTeam/components/AgentRow.tsx
@@ -1,5 +1,6 @@
import type { HomeAgentStatus } from "@/app/api/__generated__/models/homeAgentStatus";
import { Button } from "@/components/atoms/Button/Button";
+import { BubbleChatIcon, Settings01Icon } from "@hugeicons/core-free-icons";
import { Text } from "@/components/atoms/Text/Text";
import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
import { formatWeeklySpend } from "../../../helpers";
@@ -49,24 +50,23 @@ export function AgentRow({ agent }: Props) {
) : null}
</div>
<div className="flex shrink-0 items-center gap-1.5">
+ {/* Icon-only: the atom shows the aria-label as a hover tooltip. */}
<Button
as="NextLink"
href={`/copilot?expertId=${agent.expert.id}`}
- variant="secondary"
- size="xs"
+ variant="icon"
+ size="icon-sm"
+ leadingIcon={BubbleChatIcon}
aria-label={`Chat with ${agent.expert.name}`}
- >
- Chat
- </Button>
+ />
<Button
as="NextLink"
href={`/team/${agent.expert.id}`}
- variant="secondary"
- size="xs"
+ variant="icon"
+ size="icon-sm"
+ leadingIcon={Settings01Icon}
aria-label={`Manage ${agent.expert.name}`}
- >
- Manage
- </Button>
+ />
</div>
</div>
);
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTile/HomeTile.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTile/HomeTile.tsx
index 33c997b26a..8b12797bdd 100644
--- a/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTile/HomeTile.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTile/HomeTile.tsx
@@ -34,7 +34,7 @@ export function HomeTile({
<Component
aria-label={as === "section" ? title : undefined}
className={cn(
- "flex min-w-0 flex-col overflow-hidden rounded-lg border border-zinc-200 bg-white",
+ "flex min-w-0 flex-col overflow-hidden rounded-2xl bg-white smooth-shadow-ring-sm",
className,
)}
>
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTileEmpty/HomeTileEmpty.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTileEmpty/HomeTileEmpty.tsx
index fefeefe20a..6e61729dba 100644
--- a/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTileEmpty/HomeTileEmpty.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTileEmpty/HomeTileEmpty.tsx
@@ -69,7 +69,7 @@ export function HomeTileEmpty({
as="NextLink"
href={action.href}
variant="secondary"
- size="xs"
+ size="small"
>
{action.label}
</Button>
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTileFilter/HomeTileFilter.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTileFilter/HomeTileFilter.tsx
index 85e0f975c6..355f11c05d 100644
--- a/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTileFilter/HomeTileFilter.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/HomeTileFilter/HomeTileFilter.tsx
@@ -31,8 +31,8 @@ export function HomeTileFilter({
<DropdownMenuTrigger asChild>
<Button
variant="ghost"
- size="xs"
- className="gap-1 px-2 text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900"
+ size="small"
+ className="gap-1 px-2.5 text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900"
leadingIcon={FilterHorizontalIcon}
aria-label={`${ariaLabelPrefix}: ${activeLabel}`}
unmask={false}
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/NeedsYou/components/AttentionRowActions.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/NeedsYou/components/AttentionRowActions.tsx
index 2c38ea9cba..d9f80b96aa 100644
--- a/autogpt_platform/frontend/src/app/(platform)/home/components/NeedsYou/components/AttentionRowActions.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/NeedsYou/components/AttentionRowActions.tsx
@@ -24,7 +24,8 @@ export function AttentionRowActions({
as="NextLink"
href={item.primary_action.href}
variant="secondary"
- size="xs"
+ size="small"
+ className="h-8 min-w-0 px-3"
>
{item.primary_action.label}
</Button>
@@ -39,7 +40,7 @@ export function AttentionRowActions({
{primaryAction}
<Button
variant="primary"
- size="icon-xs"
+ size="icon-sm"
leadingIcon={Tick02Icon}
disabled={isProcessing}
aria-label={`Approve: ${item.title}`}
@@ -47,7 +48,7 @@ export function AttentionRowActions({
/>
<Button
variant={confirmDecline ? "destructive" : "icon"}
- size="icon-xs"
+ size="icon-sm"
leadingIcon={Cancel01Icon}
disabled={isProcessing}
aria-label={`${confirmDecline ? "Confirm decline" : "Decline"}: ${item.title}`}
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/WorkGroup.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/WorkGroup.tsx
index 66e4546337..181de2cfec 100644
--- a/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/WorkGroup.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/home/components/RecentWork/components/WorkGroup.tsx
@@ -29,7 +29,7 @@ export function WorkGroup({ group, timezone }: Props) {
variant="small-medium"
as="span"
className={cn(
- "shrink-0 rounded-full border px-1.5 uppercase leading-4 tracking-[0.04em]",
+ "shrink-0 rounded-full border px-1.5 capitalize leading-4",
chip.className,
)}
>
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/page.tsx b/autogpt_platform/frontend/src/app/(platform)/home/page.tsx
index f13f30c33f..130cb45381 100644
--- a/autogpt_platform/frontend/src/app/(platform)/home/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/home/page.tsx
@@ -109,7 +109,7 @@ interface Props {
function HomeTileSkeleton({ cardClassName }: Props) {
return (
- <div className="overflow-hidden rounded-lg border border-zinc-200 bg-white">
+ <div className="overflow-hidden rounded-2xl bg-white smooth-shadow-ring-sm">
<div className="flex h-10 items-center border-b border-zinc-100 px-4">
<Skeleton className="h-3.5 w-28" />
</div>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsx
index 2c826a50cc..4eb4a660ef 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/main.test.tsx
@@ -293,18 +293,18 @@ function attentionItem(
): HomeAttentionItem {
return {
id,
- kind: "setup",
- priority: "normal",
+ kind: "paused",
+ priority: "high",
title,
- description: "Waiting on a connection.",
- why_it_matters: "Runs are blocked until this is done.",
+ description: "Scheduled work is paused.",
+ why_it_matters: "Upcoming tasks will not run while this agent is paused.",
expert: {
id: expertId,
name: expertId === "expert-maria" ? "Maria" : "Other",
role: "Marketing Strategist",
avatar_url: null,
},
- primary_action: { label: "Finish setup", href: `/team/${expertId}` },
+ primary_action: { label: "Review budget", href: `/team/${expertId}` },
};
}
@@ -391,6 +391,13 @@ describe("ExpertDetailPage", () => {
test("shows the workflow's block chain with provider logos and icons", async () => {
const user = userEvent.setup();
+ // The chain stands in for a workflow with no image of its own.
+ server.use(
+ getGetV2GetLibraryAgentMockHandler200({
+ ...ownLibraryAgent,
+ id: "lib-1",
+ } as LibraryAgent),
+ );
render(<ExpertDetailPage />);
await openTab("Workflows");
@@ -1372,18 +1379,44 @@ describe("ExpertDetailPage", () => {
const section = await screen.findByRole("region", { name: "Needs you" });
expect(within(section).getByText("Connect your calendar")).toBeDefined();
expect(within(section).queryByText("Approve the budget")).toBeNull();
+ // The count is announced but has no visible heading to name it.
expect(
- within(section).getByRole("status", {
- name: "1 item needs your attention",
- }),
+ within(section).getByText("1 item needs your attention"),
).toBeDefined();
+
expect(
within(section)
- .getByRole("link", { name: "Finish setup" })
+ .getByRole("link", { name: "Review budget" })
.getAttribute("href"),
).toBe("/team/expert-maria");
});
+ test("leaves setup items to the Team page's Setup needed card", async () => {
+ server.use(
+ getGetHomeDashboardMockHandler(
+ getGetHomeDashboardResponseMock200({
+ attention: [
+ {
+ ...attentionItem(
+ "att-1",
+ "expert-maria",
+ "Finish setting up Maria",
+ ),
+ kind: "setup",
+ priority: "normal",
+ primary_action: { label: "Finish setup", href: "/team" },
+ },
+ ],
+ }),
+ ),
+ );
+
+ render(<ExpertDetailPage />);
+
+ expect(await screen.findByRole("heading", { name: "Maria" })).toBeDefined();
+ expect(screen.queryByRole("region", { name: "Needs you" })).toBeNull();
+ });
+
test("hides the Needs you block when nothing is waiting on the user", async () => {
render(<ExpertDetailPage />);
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/AddSkillDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/AddSkillDialog.tsx
index a818213e42..d60e7bc8e6 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/AddSkillDialog.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/AddSkillDialog.tsx
@@ -182,7 +182,7 @@ export function AddSkillDialog({
</>
)}
<div className="flex justify-end pt-1">
- <Button variant="secondary" size="xs" onClick={onClose}>
+ <Button variant="secondary" size="small" onClick={onClose}>
Cancel
</Button>
</div>
@@ -225,7 +225,7 @@ function SkillOption({
</span>
<Button
variant="secondary"
- size="xs"
+ size="small"
disabled={disabled}
onClick={onAdd}
leadingIcon={PlusSignIcon}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/CreateScheduleDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/CreateScheduleDialog.tsx
index cce5a5200c..a9f0f047ce 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/CreateScheduleDialog.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/CreateScheduleDialog.tsx
@@ -64,7 +64,7 @@ export function CreateScheduleDialog({
</ul>
)}
<div className="flex justify-end pt-1">
- <Button variant="secondary" size="xs" onClick={onClose}>
+ <Button variant="secondary" size="small" onClick={onClose}>
Cancel
</Button>
</div>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/EditBudgetDialog/EditBudgetDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/EditBudgetDialog/EditBudgetDialog.tsx
index 147de23acc..af3d9e6c3f 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/EditBudgetDialog/EditBudgetDialog.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/EditBudgetDialog/EditBudgetDialog.tsx
@@ -55,7 +55,7 @@ export function EditBudgetDialog({ expert, open, onClose }: Props) {
</div>
<div className="flex justify-end gap-2">
<Button
- size="xs"
+ size="small"
type="button"
variant="secondary"
onClick={onClose}
@@ -63,7 +63,7 @@ export function EditBudgetDialog({ expert, open, onClose }: Props) {
Cancel
</Button>
<Button
- size="xs"
+ size="small"
type="submit"
variant="primary"
disabled={isInvalid}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAboutSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAboutSection.tsx
index 35266f133d..3b0a350988 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAboutSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAboutSection.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Text } from "@/components/atoms/Text/Text";
+import { ProfileEntry } from "./ProfileEntry";
interface Props {
bio: string | null;
@@ -26,26 +26,3 @@ export function ExpertAboutSection({
</section>
);
}
-
-interface ProfileEntryProps {
- label: string;
- value: string | null;
-}
-
-function ProfileEntry({ label, value }: ProfileEntryProps) {
- return (
- <div>
- <Text variant="body-medium" as="dt" tone="primary">
- {label}
- </Text>
- <Text
- variant="body"
- as="dd"
- tone="secondary"
- className="mt-1 whitespace-pre-line"
- >
- {value || "Not set yet."}
- </Text>
- </div>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/ExpertAvatarButton.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/ExpertAvatarButton.tsx
index 5ec34d68de..693b4141a0 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/ExpertAvatarButton.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/ExpertAvatarButton.tsx
@@ -7,11 +7,7 @@ import {
AvatarImage,
} from "@/components/atoms/Avatar/Avatar";
import { Icon } from "@/components/atoms/Icon/Icon";
-import {
- Camera01Icon,
- Loading03Icon,
- PencilIcon,
-} from "@hugeicons/core-free-icons";
+import { Camera01Icon, Loading03Icon } from "@hugeicons/core-free-icons";
import { ChangeEvent, useRef } from "react";
import { useExpertAvatarButton } from "./useExpertAvatarButton";
@@ -66,13 +62,6 @@ export function ExpertAvatarButton({ expert }: Props) {
<Icon icon={Camera01Icon} size={20} />
)}
</span>
-
- <span
- aria-hidden
- className="pointer-events-none absolute -bottom-0.5 -right-0.5 flex size-6 items-center justify-center rounded-full border-2 border-background bg-background text-foreground shadow-[0_3px_10px_-2px_rgba(15,15,20,0.25)]"
- >
- <Icon icon={PencilIcon} size={12} />
- </span>
</button>
<input
ref={fileRef}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertBudgetSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertBudgetSection.tsx
index 5fc9bb2995..6d360ec8b3 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertBudgetSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertBudgetSection.tsx
@@ -21,7 +21,7 @@ export function ExpertBudgetSection({ expert }: Props) {
return (
<section
aria-label={`${expert.name} budget`}
- className="flex w-full flex-col gap-1.5 lg:w-1/2"
+ className="flex w-full shrink-0 flex-col gap-1.5 md:ml-auto md:w-64"
>
<div className="flex items-center justify-between gap-2">
<div className="flex items-center gap-1">
@@ -51,7 +51,6 @@ export function ExpertBudgetSection({ expert }: Props) {
<SpendMeter
spent={weeklySpend?.spent ?? 0}
budget={weeklySpend?.budget ?? 1}
- color={expert.color}
muted={!weeklySpend}
/>
<EditBudgetDialog
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertDetailHeader.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertDetailHeader.tsx
index a97932b465..69c397bfbd 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertDetailHeader.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertDetailHeader.tsx
@@ -32,15 +32,16 @@ export function ExpertDetailHeader({ expert, onEditSoul, onChat }: Props) {
<h1 className="text-2xl font-semibold tracking-[-0.02em] text-zinc-900">
{expert.name}
</h1>
+ {/* Same pill as the marketplace expert card. */}
<Text
- variant="body-medium"
+ variant="small-medium"
as="span"
className={cn(
- "inline-flex items-center gap-1.5 rounded-md px-2.5 py-0.5",
+ "inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5",
accent.pill,
)}
>
- <Icon icon={accent.roleIcon} size={14} />
+ <Icon icon={accent.roleIcon} size={12} />
{expert.role}
</Text>
</div>
@@ -48,7 +49,7 @@ export function ExpertDetailHeader({ expert, onEditSoul, onChat }: Props) {
<div className="flex shrink-0 items-center gap-2">
<Button
variant="secondary"
- size="xs"
+ size="small"
leadingIcon={PencilEdit02Icon}
onClick={onEditSoul}
>
@@ -56,7 +57,7 @@ export function ExpertDetailHeader({ expert, onEditSoul, onChat }: Props) {
</Button>
<Button
variant="primary"
- size="xs"
+ size="small"
leadingIcon={BubbleChatIcon}
onClick={onChat}
>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertConnectServiceDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertConnectServiceDialog.tsx
index 2ac9ab4e7c..366ca29aea 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertConnectServiceDialog.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertConnectServiceDialog.tsx
@@ -39,6 +39,8 @@ const reducedVariants = {
interface Props {
open: boolean;
expertName: string;
+ /** Open straight on this provider's connect step instead of the picker. */
+ initialProviderId?: string | null;
onClose: () => void;
onConnected: (credential: CredentialsMetaResponse) => void;
}
@@ -49,6 +51,7 @@ interface Props {
export function ExpertConnectServiceDialog({
open,
expertName,
+ initialProviderId,
onClose,
onConnected,
}: Props) {
@@ -75,7 +78,7 @@ export function ExpertConnectServiceDialog({
handleBackToList,
handleContinue,
handleSuccess,
- } = useExpertConnectServiceDialog({ open, onConnected });
+ } = useExpertConnectServiceDialog({ open, initialProviderId, onConnected });
const reduceMotion = useReducedMotion();
const variants = reduceMotion ? reducedVariants : stepVariants;
const [contentRef, contentHeight] = useMeasuredHeight<HTMLDivElement>();
@@ -175,7 +178,7 @@ export function ExpertConnectServiceDialog({
key={option.value}
type="button"
variant="toggle"
- size="xs"
+ size="small"
aria-pressed={filter === option.value}
onClick={() => setFilter(option.value)}
>
@@ -242,7 +245,7 @@ export function ExpertConnectServiceDialog({
<>
<Button
variant="secondary"
- size="xs"
+ size="small"
onClick={handleBackToList}
>
Back
@@ -250,7 +253,7 @@ export function ExpertConnectServiceDialog({
{showContinue ? (
<Button
variant="primary"
- size="xs"
+ size="small"
disabled={isContinueDisabled}
loading={isConnecting}
onClick={handleContinue}
@@ -260,7 +263,7 @@ export function ExpertConnectServiceDialog({
) : null}
</>
) : (
- <Button variant="secondary" size="xs" onClick={onClose}>
+ <Button variant="secondary" size="small" onClick={onClose}>
Cancel
</Button>
)}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationGroups.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationGroups.tsx
index 9e9ffa447c..fe5568cc5f 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationGroups.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationGroups.tsx
@@ -110,7 +110,7 @@ export function ExpertIntegrationGroups({
type="single"
collapsible
defaultValue={group.id}
- className="w-full overflow-hidden rounded-lg border border-zinc-200 bg-white"
+ className="w-full overflow-hidden rounded-2xl bg-white smooth-shadow-ring-sm"
>
<AccordionItem value={group.id} className="border-b-0">
<AccordionTrigger className="px-3 py-2.5 pr-4 hover:no-underline [&>svg]:size-4 [&>svg]:text-zinc-500">
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationsSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationsSection.tsx
index 1a0b0192eb..634947d251 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationsSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationsSection.tsx
@@ -56,7 +56,7 @@ export function ExpertIntegrationsSection({ expertId, expertName }: Props) {
return (
<section data-testid="expert-integrations-section">
<div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">
- <Text variant="body-medium" tone="primary">
+ <Text variant="large-medium" tone="primary">
{expertName}&apos;s Integrations
</Text>
<div className="flex items-center gap-2">
@@ -65,7 +65,7 @@ export function ExpertIntegrationsSection({ expertId, expertName }: Props) {
<span>
<Button
variant="secondary"
- size="xs"
+ size="small"
leadingIcon={Share01Icon}
disabled={
grantable.length === 0 || isError || isGrantableError
@@ -92,14 +92,14 @@ export function ExpertIntegrationsSection({ expertId, expertName }: Props) {
</Tooltip>
<Button
variant="secondary"
- size="xs"
+ size="small"
leadingIcon={PlusSignIcon}
onClick={openConnect}
>
Add integration
</Button>
<SearchInput
- size="xsmall"
+ size="small"
value={query}
onChange={setQuery}
placeholder="Search integrations"
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/UseExistingCredentialsDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/UseExistingCredentialsDialog.tsx
index 3e33ce073d..7b9b724a10 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/UseExistingCredentialsDialog.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/UseExistingCredentialsDialog.tsx
@@ -153,7 +153,7 @@ export function UseExistingCredentialsDialog({
</Text>
<Button
variant="secondary"
- size="xs"
+ size="small"
disabled={isGranting}
onClick={() => onUse(credential.id)}
aria-label={`Let ${expertName} use ${name}`}
@@ -224,7 +224,7 @@ export function UseExistingCredentialsDialog({
</>
)}
<div className="flex justify-end pt-1">
- <Button variant="secondary" size="xs" onClick={onClose}>
+ <Button variant="secondary" size="small" onClick={onClose}>
Cancel
</Button>
</div>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertConnectServiceDialog.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertConnectServiceDialog.ts
index eb7661db4d..4d1dd3a28b 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertConnectServiceDialog.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertConnectServiceDialog.ts
@@ -28,10 +28,16 @@ export const SERVICE_FILTERS: readonly {
interface Args {
open: boolean;
+ /** Skip the picker and open straight on this provider's connect step. */
+ initialProviderId?: string | null;
onConnected: (credential: CredentialsMetaResponse) => void;
}
-export function useExpertConnectServiceDialog({ open, onConnected }: Args) {
+export function useExpertConnectServiceDialog({
+ open,
+ initialProviderId,
+ onConnected,
+}: Args) {
const [query, setQuery] = useState("");
const debouncedQuery = useDebouncedValue(query, 250);
const [filter, setFilter] = useState<ServiceFilter>("all");
@@ -58,8 +64,14 @@ export function useExpertConnectServiceDialog({ open, onConnected }: Args) {
setFilter("all");
setSelectedId(null);
setSelectedMethod(null);
+ return;
+ }
+ if (initialProviderId) {
+ setDirection(1);
+ setSelectedId(initialProviderId);
+ setSelectedMethod(null);
}
- }, [open]);
+ }, [open, initialProviderId]);
const allProviders = toConnectableProviders(providersQuery.data ?? []);
const credentials = credentialsQuery.data ?? [];
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertNeedsYouSection/ExpertAttentionCard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertNeedsYouSection/ExpertAttentionCard.tsx
new file mode 100644
index 0000000000..efb2289294
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertNeedsYouSection/ExpertAttentionCard.tsx
@@ -0,0 +1,103 @@
+"use client";
+
+import { AttentionRowActions } from "@/app/(platform)/home/components/NeedsYou/components/AttentionRowActions";
+import type { HomeAttentionItem } from "@/app/api/__generated__/models/homeAttentionItem";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
+import {
+ AlertCircleIcon,
+ CoinsDollarIcon,
+ MessageQuestionIcon,
+ PauseIcon,
+ Settings02Icon,
+} from "@hugeicons/core-free-icons";
+import type { IconSvgElement } from "@hugeicons/react";
+import { useState } from "react";
+
+interface Props {
+ item: HomeAttentionItem;
+ isProcessing: boolean;
+ onDecision: (item: HomeAttentionItem, approved: boolean) => void;
+}
+
+const ICONS: Record<HomeAttentionItem["kind"], IconSvgElement> = {
+ approval: AlertCircleIcon,
+ setup: Settings02Icon,
+ paused: PauseIcon,
+ credits: CoinsDollarIcon,
+ question: MessageQuestionIcon,
+};
+
+/** Compact card version of the home page's AttentionRow, styled like the
+ * chat sidebar's mini cards. */
+export function ExpertAttentionCard({ item, isProcessing, onDecision }: Props) {
+ const [confirmDecline, setConfirmDecline] = useState(false);
+
+ function handleDecline() {
+ if (!confirmDecline) {
+ setConfirmDecline(true);
+ return;
+ }
+ setConfirmDecline(false);
+ onDecision(item, false);
+ }
+
+ return (
+ <article className="flex flex-col gap-3 rounded-2xl bg-white px-3.5 py-2.5 smooth-shadow-ring-sm sm:flex-row sm:items-center">
+ <div className="flex min-w-0 flex-1 items-center gap-2.5">
+ {item.expert ? (
+ <ExpertAvatar
+ name={item.expert.name}
+ avatarUrl={item.expert.avatar_url}
+ size={32}
+ />
+ ) : (
+ <Icon
+ icon={ICONS[item.kind]}
+ size={18}
+ className="shrink-0 text-zinc-500"
+ aria-hidden="true"
+ />
+ )}
+ <div className="flex min-w-0 flex-1 flex-col">
+ <div className="flex flex-wrap items-center gap-2">
+ <Text
+ variant="body-medium"
+ as="span"
+ className="truncate !text-zinc-800"
+ >
+ {item.title}
+ </Text>
+ {item.priority === "high" ? (
+ <Text
+ variant="small-medium"
+ as="span"
+ className="rounded bg-amber-50 px-1.5 py-px text-amber-700 ring-1 ring-inset ring-amber-600/10"
+ >
+ Waiting
+ </Text>
+ ) : null}
+ </div>
+ <Text variant="small" as="span" className="truncate !text-zinc-400">
+ {item.description}
+ </Text>
+ </div>
+ </div>
+
+ <div className="flex shrink-0 items-center gap-1.5 self-end sm:self-center">
+ <AttentionRowActions
+ item={item}
+ isProcessing={isProcessing}
+ confirmDecline={confirmDecline}
+ onApprove={() => onDecision(item, true)}
+ onDecline={handleDecline}
+ onDeclineBlur={() => setConfirmDecline(false)}
+ />
+ </div>
+ <span className="sr-only" aria-live="polite">
+ {confirmDecline ? `Press again to decline ${item.title}` : ""}
+ </span>
+ </article>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertNeedsYouSection/ExpertNeedsYouSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertNeedsYouSection/ExpertNeedsYouSection.tsx
index ec32178516..0950af5eed 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertNeedsYouSection/ExpertNeedsYouSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertNeedsYouSection/ExpertNeedsYouSection.tsx
@@ -1,44 +1,40 @@
"use client";
-import { AttentionRow } from "@/app/(platform)/home/components/NeedsYou/components/AttentionRow";
-import { HomeTile } from "@/app/(platform)/home/components/HomeTile/HomeTile";
-import { Text } from "@/components/atoms/Text/Text";
-import { AlertCircleIcon } from "@hugeicons/core-free-icons";
+import type { Expert } from "@/app/api/__generated__/models/expert";
+import { ExpertAttentionCard } from "./ExpertAttentionCard";
import { useExpertNeedsYou } from "./useExpertNeedsYou";
interface Props {
- expertId: string;
+ expert: Expert;
enabled: boolean;
}
-export function ExpertNeedsYouSection({ expertId, enabled }: Props) {
- const { items, pendingIDs, decide } = useExpertNeedsYou({
- expertId,
+/** One card per item, styled like the stack sections in the chat sidebar.
+ * Setup items are left to the Team page's Setup needed card, which names
+ * the missing connection and offers the fix. */
+export function ExpertNeedsYouSection({ expert, enabled }: Props) {
+ const {
+ items: allItems,
+ pendingIDs,
+ decide,
+ } = useExpertNeedsYou({
+ expertId: expert.id,
enabled,
});
+ const items = allItems.filter((item) => item.kind !== "setup");
if (items.length === 0) return null;
return (
- <HomeTile
- icon={AlertCircleIcon}
- title="Needs you"
- badge={
- <Text
- variant="small-medium"
- as="span"
- tone="secondary"
- role="status"
- aria-label={`${items.length} ${items.length === 1 ? "item needs" : "items need"} your attention`}
- className="rounded-md bg-zinc-100 px-1.5 py-0.5 tabular-nums"
- >
- {items.length}
- </Text>
- }
- >
- <div className="divide-y divide-zinc-100">
+ <section aria-label="Needs you" className="flex min-w-0 flex-col">
+ {/* No visible heading: the cards say what needs doing. The count is
+ still announced for screen readers. */}
+ <span role="status" className="sr-only">
+ {`${items.length} ${items.length === 1 ? "item needs" : "items need"} your attention`}
+ </span>
+ <div className="flex flex-col gap-2">
{items.map((item) => (
- <AttentionRow
+ <ExpertAttentionCard
key={item.id}
item={item}
isProcessing={pendingIDs.has(item.id)}
@@ -46,6 +42,6 @@ export function ExpertNeedsYouSection({ expertId, enabled }: Props) {
/>
))}
</div>
- </HomeTile>
+ </section>
);
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSchedulesSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSchedulesSection.tsx
index 7d02806621..c380397470 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSchedulesSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSchedulesSection.tsx
@@ -46,7 +46,7 @@ export function ExpertSchedulesSection({
<section>
<div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">
<div className="flex items-baseline gap-3">
- <Text variant="body-medium" tone="primary">
+ <Text variant="large-medium" tone="primary">
{title}
</Text>
{lastRunLabel ? (
@@ -59,7 +59,7 @@ export function ExpertSchedulesSection({
{expertId && workflows ? (
<Button
variant="secondary"
- size="xs"
+ size="small"
leadingIcon={PlusSignIcon}
onClick={() => setIsCreateOpen(true)}
>
@@ -67,7 +67,7 @@ export function ExpertSchedulesSection({
</Button>
) : null}
<SearchInput
- size="xsmall"
+ size="small"
value={query}
onChange={setQuery}
placeholder="Search schedules"
@@ -97,6 +97,7 @@ export function ExpertSchedulesSection({
<li key={schedule.id}>
<GraphScheduleListItem
schedule={schedule}
+ className="rounded-2xl border-0 smooth-shadow-ring-sm"
iconClassName={accentClassName}
actionClassName={ACTION_BUTTON_CLASS}
editAction={
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSettingsSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSettingsSection.tsx
index 870362fee6..16e31c598e 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSettingsSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSettingsSection.tsx
@@ -12,7 +12,7 @@ interface Props {
export function ExpertSettingsSection({ expert, onFire }: Props) {
return (
<section className="rounded-xl border border-red-200 bg-red-50/50 p-4">
- <Text variant="body-medium" tone="danger">
+ <Text variant="large-medium" tone="danger">
Danger zone
</Text>
<Text variant="small" tone="danger" className="mt-1">
@@ -21,7 +21,7 @@ export function ExpertSettingsSection({ expert, onFire }: Props) {
</Text>
<Button
variant="destructive"
- size="xs"
+ size="small"
className="mt-4"
onClick={onFire}
data-testid="expert-fire-button"
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSkillListItem.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSkillListItem.tsx
index 24526ed9c8..46cd560955 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSkillListItem.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSkillListItem.tsx
@@ -23,10 +23,10 @@ export function ExpertSkillListItem({
const triggers = entry.library?.triggers ?? [];
return (
<div
- className="flex w-full flex-col gap-3 rounded-lg border border-zinc-200 bg-white p-3 sm:flex-row sm:items-start sm:justify-between"
+ className="flex w-full flex-col gap-3 rounded-2xl bg-white p-3.5 smooth-shadow-ring-sm sm:flex-row sm:items-center sm:justify-between"
data-testid="expert-skill-row"
>
- <div className="flex min-w-0 flex-1 items-start gap-3">
+ <div className="flex min-w-0 flex-1 items-center gap-3">
<div
className={cn(
"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-md bg-violet-50 text-violet-700",
@@ -67,7 +67,7 @@ export function ExpertSkillListItem({
as="NextLink"
href="/library/skills"
variant="ghost"
- size="xs"
+ size="small"
>
Open in library
</Button>
@@ -75,7 +75,7 @@ export function ExpertSkillListItem({
{onRemove ? (
<Button
variant="secondary"
- size="xs"
+ size="small"
leadingIcon={Delete02Icon}
disabled={isSaving}
onClick={() => onRemove(entry.name)}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSkillsSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSkillsSection.tsx
index d0f83cc69c..e6f7857fc4 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSkillsSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSkillsSection.tsx
@@ -40,20 +40,20 @@ export function ExpertSkillsSection({ expert, accentClassName }: Props) {
return (
<section>
<div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">
- <Text variant="body-medium" tone="primary">
+ <Text variant="large-medium" tone="primary">
{expert.name}&apos;s Skills
</Text>
<div className="flex items-center gap-2">
<Button
variant="secondary"
- size="xs"
+ size="small"
leadingIcon={PlusSignIcon}
onClick={openAdd}
>
Add skill
</Button>
<SearchInput
- size="xsmall"
+ size="small"
value={query}
onChange={setQuery}
placeholder="Search skills"
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSummaryCard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSummaryCard.tsx
index da6d1fcb6a..ebfb654817 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSummaryCard.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSummaryCard.tsx
@@ -42,7 +42,7 @@ export function ExpertSummaryCard({
>
<section
aria-label={`${expert.name} activity`}
- className="flex flex-col gap-2 rounded-xl border border-zinc-200 bg-white p-4"
+ className="flex flex-col gap-2 rounded-2xl bg-white p-4 smooth-shadow-ring-sm"
>
<div className="flex items-center justify-between gap-2">
<Text variant="body-medium" tone="primary">
@@ -71,7 +71,7 @@ export function ExpertSummaryCard({
<section
aria-label={`${expert.name} activity streak`}
- className="flex flex-col rounded-xl border border-zinc-200 bg-white p-4"
+ className="flex flex-col rounded-2xl bg-white p-4 smooth-shadow-ring-sm"
>
{isActivityLoading ? (
<Skeleton className="h-16 w-full rounded-lg" />
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkSection/ExpertWorkSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkSection/ExpertWorkSection.tsx
index a34ab4974d..acdd434e39 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkSection/ExpertWorkSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkSection/ExpertWorkSection.tsx
@@ -40,7 +40,7 @@ export function ExpertWorkSection({ expertId, expertName, enabled }: Props) {
return (
<section>
<div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">
- <Text variant="body-medium" tone="primary">
+ <Text variant="large-medium" tone="primary">
{expertName}&apos;s Work
</Text>
<FilterIconMenu
@@ -127,7 +127,7 @@ function ExpertRunRow({ run, onOpen }: { run: ExpertRun; onOpen: () => void }) {
) : null}
</div>
</div>
- <Button variant="secondary" size="xs" onClick={onOpen}>
+ <Button variant="secondary" size="small" onClick={onOpen}>
Open
</Button>
</div>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowCard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowCard.tsx
index 60f89bc382..e7708b42bd 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowCard.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowCard.tsx
@@ -6,7 +6,10 @@ import { Text } from "@/components/atoms/Text/Text";
import { safeHumanizeCronExpression } from "@/lib/cron-expression-utils";
import { cn } from "@/lib/utils";
import { Activity01Icon } from "@hugeicons/core-free-icons";
+import { isRenderableImageUrl } from "@/lib/next-image";
+import Image from "next/image";
import NextLink from "next/link";
+import { useState } from "react";
import { ExpertCover } from "../../components/ExpertTeamCard/components/ExpertCover";
import { ExpertWorkflowActions } from "./ExpertWorkflowActions";
import { ExpertWorkflowRunButton } from "./ExpertWorkflowRunButton";
@@ -41,11 +44,12 @@ export function ExpertWorkflowCard({
openRun,
openTriggers,
} = useExpertWorkflowCard({ workflow, expertId });
+ const [hasImageError, setHasImageError] = useState(false);
return (
<div
data-testid="expert-workflow-row"
- className="group relative flex w-full flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white transition-colors hover:border-zinc-300"
+ className="group relative flex w-full flex-col overflow-hidden rounded-2xl bg-white transition-colors smooth-shadow-ring-sm hover:bg-zinc-50"
>
{libraryHref ? (
<NextLink
@@ -56,13 +60,26 @@ export function ExpertWorkflowCard({
) : null}
<div className="pointer-events-none relative mx-1.5 mt-1.5 flex h-32 items-center justify-center overflow-hidden rounded-lg bg-zinc-100">
- <ExpertCover
- className="absolute inset-0 h-full w-full rounded-none"
- color={coverColor}
- />
- <div className="relative">
- <WorkflowChain chain={workflow.chain ?? []} size="sm" />
- </div>
+ {isRenderableImageUrl(libraryAgent?.image_url) && !hasImageError ? (
+ <Image
+ src={libraryAgent.image_url}
+ alt=""
+ fill
+ sizes="(min-width: 1024px) 33vw, (min-width: 640px) 50vw, 100vw"
+ onError={() => setHasImageError(true)}
+ className="object-cover"
+ />
+ ) : (
+ <>
+ <ExpertCover
+ className="absolute inset-0 h-full w-full rounded-none"
+ color={coverColor}
+ />
+ <div className="relative">
+ <WorkflowChain chain={workflow.chain ?? []} size="sm" />
+ </div>
+ </>
+ )}
<div className="pointer-events-auto absolute right-2 top-2 z-10 flex items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 has-[[data-state=open]]:opacity-100">
<ExpertWorkflowActions
workflow={workflow}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowCardMenu.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowCardMenu.tsx
index cec30438a5..6a255e62a7 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowCardMenu.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowCardMenu.tsx
@@ -133,7 +133,7 @@ export function ExpertWorkflowCardMenu({
<Button
type="button"
variant="ghost"
- size="xs"
+ size="small"
disabled={isRemoving}
onClick={() => setIsRemoveOpen(false)}
>
@@ -142,7 +142,7 @@ export function ExpertWorkflowCardMenu({
<Button
type="button"
variant="destructive"
- size="xs"
+ size="small"
loading={isRemoving}
onClick={handleRemove}
>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowListItem.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowListItem.tsx
index ca73744f07..ec05165633 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowListItem.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowListItem.tsx
@@ -9,7 +9,10 @@ import {
Activity01Icon,
WorkflowSquare01Icon,
} from "@hugeicons/core-free-icons";
+import { isRenderableImageUrl } from "@/lib/next-image";
+import Image from "next/image";
import NextLink from "next/link";
+import { useState } from "react";
import { ExpertWorkflowActions } from "./ExpertWorkflowActions";
import { ExpertWorkflowRunButton } from "./ExpertWorkflowRunButton";
import { useExpertWorkflowCard } from "./useExpertWorkflowCard";
@@ -42,6 +45,7 @@ export function ExpertWorkflowListItem({
openRun,
openTriggers,
} = useExpertWorkflowCard({ workflow, expertId });
+ const [hasImageError, setHasImageError] = useState(false);
const meta = [
workflow.schedule_cron
? safeHumanizeCronExpression(workflow.schedule_cron)
@@ -54,7 +58,7 @@ export function ExpertWorkflowListItem({
return (
<div
data-testid="expert-workflow-row"
- className="group relative flex items-center gap-4 rounded-lg border border-zinc-200 bg-white px-3 py-2.5 transition-colors hover:bg-zinc-50"
+ className="group relative flex items-center gap-4 rounded-2xl bg-white px-3.5 py-2.5 transition-colors smooth-shadow-ring-sm hover:bg-zinc-50"
>
{libraryHref ? (
<NextLink
@@ -64,14 +68,28 @@ export function ExpertWorkflowListItem({
/>
) : null}
- <div
- className={cn(
- accentClassName,
- "pointer-events-none flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-md border-0",
- )}
- >
- <Icon icon={WorkflowSquare01Icon} size={18} aria-hidden="true" />
- </div>
+ {/* A square as tall as the text column, title through meta line. */}
+ {isRenderableImageUrl(libraryAgent?.image_url) && !hasImageError ? (
+ <div className="pointer-events-none relative aspect-square shrink-0 self-stretch overflow-hidden rounded-lg bg-zinc-100">
+ <Image
+ src={libraryAgent.image_url}
+ alt=""
+ fill
+ sizes="96px"
+ onError={() => setHasImageError(true)}
+ className="object-cover"
+ />
+ </div>
+ ) : (
+ <div
+ className={cn(
+ accentClassName,
+ "pointer-events-none flex aspect-square shrink-0 items-center justify-center self-stretch rounded-lg border-0",
+ )}
+ >
+ <Icon icon={WorkflowSquare01Icon} size={20} aria-hidden="true" />
+ </div>
+ )}
<div className="pointer-events-none min-w-0 flex-1">
<div className="flex items-center gap-2">
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowRunButton.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowRunButton.tsx
index 0cfad43013..3daf121063 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowRunButton.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowRunButton.tsx
@@ -31,7 +31,7 @@ export function ExpertWorkflowRunButton({
<Button
type="button"
variant={variant}
- size="xs"
+ size="small"
leadingIcon={PlayIcon}
>
{isTriggerWorkflow ? "Set up trigger" : "Run"}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowsSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowsSection.tsx
index d84903aee4..941b974a82 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowsSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowsSection.tsx
@@ -55,14 +55,14 @@ export function ExpertWorkflowsSection({
return (
<section>
<div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">
- <Text variant="body-medium" tone="primary">
+ <Text variant="large-medium" tone="primary">
{expertName}&apos;s Workflows
</Text>
<div className="flex items-center gap-2">
{onInstallWorkflow ? (
<Button
variant="secondary"
- size="xs"
+ size="small"
leadingIcon={PlusSignIcon}
onClick={onInstallWorkflow}
>
@@ -70,7 +70,7 @@ export function ExpertWorkflowsSection({
</Button>
) : null}
<SearchInput
- size="xsmall"
+ size="small"
value={query}
onChange={setQuery}
placeholder="Search workflows"
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/FilterIconMenu.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/FilterIconMenu.tsx
index f33488296b..af6b09938e 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/FilterIconMenu.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/FilterIconMenu.tsx
@@ -8,6 +8,7 @@ import {
DropdownMenuRadioItem,
DropdownMenuTrigger,
} from "@/components/molecules/DropdownMenu/DropdownMenu";
+import { cn } from "@/lib/utils";
import { FilterHorizontalIcon } from "@hugeicons/core-free-icons";
interface Props<T extends string> {
@@ -29,17 +30,19 @@ export function FilterIconMenu<T extends string>({
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
+ {/* Sized and bordered like the small SearchInput it sits beside,
+ with no fill until a filter is active. */}
<Button
type="button"
- variant="icon"
- size="icon-xs"
+ variant="outline"
+ size="icon-sm"
aria-label={label}
leadingIcon={FilterHorizontalIcon}
- className={
- isActive
- ? "border-zinc-900 bg-zinc-900 text-white hover:border-zinc-800 hover:bg-zinc-800 hover:text-white"
- : undefined
- }
+ className={cn(
+ "size-9 rounded-xl border-input bg-transparent text-zinc-600 shadow-none hover:border-input hover:bg-zinc-50",
+ isActive &&
+ "border-zinc-900 bg-zinc-900 text-white hover:border-zinc-800 hover:bg-zinc-800 hover:text-white",
+ )}
/>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="min-w-[11rem]">
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ProfileEntry.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ProfileEntry.tsx
new file mode 100644
index 0000000000..2bb3959a9b
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ProfileEntry.tsx
@@ -0,0 +1,26 @@
+import { Text } from "@/components/atoms/Text/Text";
+
+interface Props {
+ label: string;
+ value: string | null;
+}
+
+/** One labelled paragraph on a Basics tab, shared by the expert and
+ * Autopilot pages so their headings stay the same size. */
+export function ProfileEntry({ label, value }: Props) {
+ return (
+ <div>
+ <Text variant="large-medium" as="dt" tone="primary">
+ {label}
+ </Text>
+ <Text
+ variant="body"
+ as="dd"
+ tone="secondary"
+ className="mt-1 whitespace-pre-line"
+ >
+ {value || "Not set yet."}
+ </Text>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ViewToggle.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ViewToggle.tsx
index 3f02b15b20..b24c668a99 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ViewToggle.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ViewToggle.tsx
@@ -14,15 +14,16 @@ export function ViewToggle<T extends string>({
options,
onChange,
}: Props<T>) {
+ // Sized like the search input and filter button it sits beside.
return (
- <div className="flex h-7 items-center rounded-md border border-zinc-200 p-0.5">
+ <div className="flex h-9 items-center rounded-xl border border-input p-1">
{options.map((option) => (
<Button
key={option.value}
type="button"
variant="toggle"
size="icon-xs"
- className="size-6 rounded"
+ className="size-7 rounded-lg"
leadingIcon={option.icon}
aria-label={option.label}
aria-pressed={value === option.value}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/page.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/page.tsx
index d48c0ec59f..84540ffcaa 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/page.tsx
@@ -138,7 +138,7 @@ export default function ExpertDetailPage() {
</Text>
<Button
variant="secondary"
- size="xs"
+ size="small"
loading={isResuming}
onClick={resumeSchedules}
>
@@ -147,16 +147,19 @@ export default function ExpertDetailPage() {
</div>
) : null}
- <ExpertBudgetSection expert={expert} />
-
- {expert.tagline ? (
- <Text variant="body" tone="muted">
- {expert.tagline}
- </Text>
- ) : null}
+ {/* items-start keeps the tagline level with the Budget label rather
+ than floating between the label and the bar. */}
+ <div className="flex flex-col gap-4 md:flex-row md:items-start md:justify-between md:gap-8">
+ {expert.tagline ? (
+ <Text variant="large" tone="muted" className="min-w-0 flex-1">
+ {expert.tagline}
+ </Text>
+ ) : null}
+ <ExpertBudgetSection expert={expert} />
+ </div>
<ExpertNeedsYouSection
- expertId={expert.id}
+ expert={expert}
enabled={Boolean(enabled) && ready}
/>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx
index a9d085369d..206078fbe3 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx
@@ -4,6 +4,7 @@ import {
getGetExpertDetachPreviewMockHandler,
getListExpertCredentialsMockHandler,
getListExpertPodsMockHandler,
+ getListExpertSetupItemsMockHandler,
getListExpertsMockHandler,
getListExpertsMockHandler401,
getResumeExpertSchedulesMockHandler,
@@ -14,7 +15,9 @@ import {
getGetV2ListLibraryAgentsMockHandler200,
getGetV2ListLibraryAgentsResponseMock200,
} from "@/app/api/__generated__/endpoints/library/library.msw";
+import { getGetV1ListProvidersMockHandler } from "@/app/api/__generated__/endpoints/integrations/integrations.msw";
import { getGetV1ListExecutionSchedulesForAUserMockHandler } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";
+import type { ExpertSetupItem } from "@/app/api/__generated__/models/expertSetupItem";
import { Expert } from "@/app/api/__generated__/models/expert";
import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
@@ -89,6 +92,8 @@ beforeEach(() => {
getGetV1ListExecutionSchedulesForAUserMockHandler([]),
getListExpertPodsMockHandler([]),
getListExpertCredentialsMockHandler([]),
+ getListExpertSetupItemsMockHandler([]),
+ getGetV1ListProvidersMockHandler([]),
getGetV2ListLibraryAgentsMockHandler200(libraryResponse([])),
);
});
@@ -231,7 +236,8 @@ describe("TeamPage", () => {
const card = screen.getByRole("link", { name: "View Maria" });
expect(within(card).getByText("Idle")).toBeDefined();
expect(getStatValue(card, "Workflows")).toBe("2");
- expect(getStatValue(card, "Skills")).toBe("0");
+ // Empty totals are left off the meta line.
+ expect(within(card).queryByText("Skills")).toBeNull();
expect(within(card).queryByText("Content Calendar")).toBeNull();
expect(within(card).queryByText("SEO Audit")).toBeNull();
});
@@ -324,7 +330,7 @@ describe("TeamPage", () => {
expect(getStatValue(card, "Schedules")).toBe("1");
});
- test("marks scheduled workflows without a schedule as needing setup", async () => {
+ test("does not badge a card for a workflow without a schedule", async () => {
const needsSetupMaria: Expert = {
...hiredMaria,
workflows: [
@@ -340,8 +346,9 @@ describe("TeamPage", () => {
render(<TeamPage />);
await screen.findByText("Maria");
- expect(screen.getByText(/1 needs setup/)).toBeDefined();
- expect(screen.getByText("Needs you")).toBeDefined();
+ // The Setup needed card above the roster owns that state now.
+ expect(screen.queryByText(/needs setup/i)).toBeNull();
+ expect(screen.queryByText("Needs you")).toBeNull();
});
test("marks an expert with an active run as working", async () => {
@@ -961,3 +968,144 @@ describe("TeamPage", () => {
expect(within(card).queryByText(/needs setup/i)).toBeNull();
});
});
+
+function makeSetupItem(
+ overrides: Partial<ExpertSetupItem> = {},
+): ExpertSetupItem {
+ return {
+ expert_id: "expert-maria",
+ expert_name: "Maria",
+ expert_avatar_url: null,
+ workflow_id: "wf-1",
+ workflow_name: "SEO Audit",
+ library_agent_id: "lib-1",
+ providers: ["notion"],
+ resolution: "connect",
+ credential_id: null,
+ ...overrides,
+ };
+}
+
+describe("TeamPage - setup needed card", () => {
+ test("stays hidden when nothing needs setup", async () => {
+ server.use(getListExpertsMockHandler([hiredMaria]));
+
+ render(<TeamPage />);
+
+ await screen.findByText("Maria");
+ expect(screen.queryByTestId("setup-needed")).toBeNull();
+ });
+
+ test("lists each missing connection with the expert and workflow", async () => {
+ server.use(
+ getListExpertSetupItemsMockHandler([
+ makeSetupItem(),
+ makeSetupItem({
+ workflow_id: "wf-2",
+ workflow_name: "Weekly digest",
+ providers: ["github"],
+ resolution: "allow",
+ credential_id: "cred-github",
+ }),
+ makeSetupItem({
+ workflow_id: "wf-3",
+ workflow_name: "Newsletter",
+ providers: [],
+ resolution: "workflow",
+ }),
+ ]),
+ getGetV1ListProvidersMockHandler([
+ { name: "notion", supported_auth_types: ["api_key"] },
+ ]),
+ );
+
+ render(<TeamPage />);
+
+ const card = await screen.findByTestId("setup-needed");
+ expect(within(card).getByText("Setup needed (3)")).toBeDefined();
+ expect(within(card).getByText("Notion for Maria")).toBeDefined();
+ expect(
+ within(card).getByText("SEO Audit needs it to run on schedule."),
+ ).toBeDefined();
+ expect(within(card).getByRole("button", { name: "Connect" })).toBeDefined();
+ expect(within(card).getByRole("button", { name: "Allow" })).toBeDefined();
+ expect(
+ within(card)
+ .getByRole("link", { name: "Open workflow" })
+ .getAttribute("href"),
+ ).toBe("/library/agents/lib-1");
+ });
+
+ test("a provider the user cannot connect is explained instead of offered", async () => {
+ server.use(
+ getListExpertSetupItemsMockHandler([
+ makeSetupItem({ providers: ["some_platform_only_provider"] }),
+ ]),
+ );
+
+ render(<TeamPage />);
+
+ const card = await screen.findByTestId("setup-needed");
+ expect(within(card).getByText("Needs a platform key")).toBeDefined();
+ expect(within(card).queryByRole("button", { name: "Connect" })).toBeNull();
+ });
+
+ test("Allow grants the existing credential to that expert", async () => {
+ let granted: {
+ expertId: string;
+ body: { credential_ids: string[] };
+ } | null = null;
+ server.use(
+ getListExpertSetupItemsMockHandler([
+ makeSetupItem({ resolution: "allow", credential_id: "cred-notion" }),
+ ]),
+ http.post(
+ "/api/proxy/api/experts/:expertId/credentials",
+ async ({ params, request }) => {
+ granted = {
+ expertId: String(params.expertId),
+ body: (await request.json()) as { credential_ids: string[] },
+ };
+ return HttpResponse.json([]);
+ },
+ ),
+ );
+
+ render(<TeamPage />);
+
+ const card = await screen.findByTestId("setup-needed");
+ fireEvent.click(within(card).getByRole("button", { name: "Allow" }));
+
+ await waitFor(() =>
+ expect(granted).toEqual({
+ expertId: "expert-maria",
+ body: { credential_ids: ["cred-notion"] },
+ }),
+ );
+ });
+
+ test("Connect opens the connect dialog on that provider", async () => {
+ server.use(
+ getListExpertSetupItemsMockHandler([makeSetupItem()]),
+ getGetV1ListProvidersMockHandler([
+ { name: "notion", supported_auth_types: ["api_key"] },
+ ]),
+ );
+
+ render(<TeamPage />);
+
+ const card = await screen.findByTestId("setup-needed");
+ fireEvent.click(within(card).getByRole("button", { name: "Connect" }));
+
+ const dialog = await screen.findByRole("dialog");
+ // Straight to the provider's step: the picker gives way to it once the
+ // provider list has loaded, so wait for the picker heading to go.
+ await waitFor(() =>
+ expect(
+ within(dialog).queryByText("Connect a service for Maria"),
+ ).toBeNull(),
+ );
+ expect(within(dialog).getByRole("button", { name: "Back" })).toBeDefined();
+ expect(within(dialog).getAllByText(/Notion/).length).toBeGreaterThan(0);
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/tabs.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/tabs.test.tsx
index d6fc37dd12..cb1c1a6133 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/tabs.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/tabs.test.tsx
@@ -82,18 +82,18 @@ beforeEach(() => {
});
describe("TeamPage tabs", () => {
- test("opens on Team Overview without Pod board", async () => {
+ test("opens on Overview without Pod board", async () => {
server.use(getListExpertsMockHandler([maria]));
render(<TeamPage />);
- const overview = await screen.findByRole("tab", { name: "Team Overview" });
+ const overview = await screen.findByRole("tab", { name: "Overview" });
expect(overview.getAttribute("aria-selected")).toBe("true");
expect(screen.queryByRole("tab", { name: "Pod board" })).toBeNull();
expect(screen.queryByRole("tab", { name: "All tasks" })).toBeNull();
});
- test("Team Overview lists every expert without pod sections", async () => {
+ test("Overview lists every expert without pod sections", async () => {
const growth: ExpertPod = {
id: "pod-growth",
name: "Growth",
@@ -161,8 +161,10 @@ describe("TeamRoster toolbar", () => {
render(<TeamPage />);
expect(await screen.findByText("Maria")).toBeDefined();
- await user.click(screen.getByRole("combobox", { name: /filter/i }));
- await user.click(await screen.findByRole("option", { name: "Paused" }));
+ await user.click(screen.getByRole("button", { name: "Filter experts" }));
+ await user.click(
+ await screen.findByRole("menuitemradio", { name: "Paused" }),
+ );
expect(screen.getByText("Lee")).toBeDefined();
expect(screen.queryByText("Maria")).toBeNull();
@@ -218,16 +220,17 @@ describe("AutopilotCard", () => {
expect(getStatValue(autopilot, "Workflows")).toBe("1");
});
- test("zeroes out the totals for a team with nothing set up", async () => {
+ test("leaves out the totals for a team with nothing set up", async () => {
server.use(getListExpertsMockHandler([maria]));
render(<TeamPage />);
expect(await screen.findByText("Maria")).toBeDefined();
const autopilot = screen.getByRole("region", { name: "Autopilot" });
- expect(getStatValue(autopilot, "Skills")).toBe("0");
- expect(getStatValue(autopilot, "Schedules")).toBe("0");
- expect(getStatValue(autopilot, "Workflows")).toBe("0");
+ // A zero total is left out of the meta line rather than shown as "0".
+ expect(within(autopilot).queryByText("Skills")).toBeNull();
+ expect(within(autopilot).queryByText("Schedules")).toBeNull();
+ expect(within(autopilot).queryByText("Workflows")).toBeNull();
expect(within(autopilot).getByText("Built in")).toBeDefined();
expect(within(autopilot).queryByText("Budget")).toBeNull();
expect(
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotAboutSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotAboutSection.tsx
index 84eca7ac87..dff36ef310 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotAboutSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotAboutSection.tsx
@@ -1,4 +1,4 @@
-import { Text } from "@/components/atoms/Text/Text";
+import { ProfileEntry } from "../../[expertId]/components/ProfileEntry";
import { AUTOPILOT_BLURB } from "../../helpers";
const ENTRIES = [
@@ -25,14 +25,11 @@ export function AutopilotAboutSection() {
<section className="space-y-5">
<dl className="space-y-4">
{ENTRIES.map((entry) => (
- <div key={entry.label}>
- <Text variant="body-medium" as="dt" tone="primary">
- {entry.label}
- </Text>
- <Text variant="body" as="dd" tone="secondary" className="mt-1">
- {entry.value}
- </Text>
- </div>
+ <ProfileEntry
+ key={entry.label}
+ label={entry.label}
+ value={entry.value}
+ />
))}
</dl>
</section>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotHeader.tsx b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotHeader.tsx
index 4c872ce8aa..61dcd2761f 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotHeader.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotHeader.tsx
@@ -2,7 +2,7 @@ import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";
import { Button } from "@/components/atoms/Button/Button";
import { Icon } from "@/components/atoms/Icon/Icon";
import { Text } from "@/components/atoms/Text/Text";
-import { SparklesIcon } from "@hugeicons/core-free-icons";
+import { Tick02Icon, SparklesIcon } from "@hugeicons/core-free-icons";
import { ExpertCover } from "../../components/ExpertTeamCard/components/ExpertCover";
import { cn } from "@/lib/utils";
import { AUTOPILOT_PILL_CLASS, AUTOPILOT_ROLE } from "../../helpers";
@@ -10,7 +10,7 @@ import { AUTOPILOT_PILL_CLASS, AUTOPILOT_ROLE } from "../../helpers";
export function AutopilotHeader() {
return (
<header>
- <ExpertCover className="h-36" color={undefined} status="built-in" />
+ <ExpertCover className="h-36" color={undefined} builtIn />
<div className="flex flex-col gap-4 sm:flex-row sm:items-center">
<span className="relative z-10 -mt-12 ml-14 flex size-24 shrink-0 items-center justify-center rounded-full bg-white ring-4 ring-white">
@@ -22,23 +22,34 @@ export function AutopilotHeader() {
Autopilot
</h1>
<Text
- variant="body-medium"
+ variant="small-medium"
as="span"
className={cn(
- "inline-flex items-center gap-1.5 rounded-md px-2.5 py-0.5",
+ "inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5",
AUTOPILOT_PILL_CLASS,
)}
>
- <Icon icon={SparklesIcon} size={14} />
+ <Icon icon={SparklesIcon} size={12} />
{AUTOPILOT_ROLE}
</Text>
+ <Text
+ variant="small-medium"
+ as="span"
+ className={cn(
+ "inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5",
+ AUTOPILOT_PILL_CLASS,
+ )}
+ >
+ <Icon icon={Tick02Icon} size={12} />
+ Built in
+ </Text>
</div>
</div>
<Button
as="NextLink"
href="/copilot"
variant="primary"
- size="xs"
+ size="small"
className="shrink-0"
>
Chat
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotSkillsSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotSkillsSection.tsx
index f016f45e01..128986bb31 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotSkillsSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotSkillsSection.tsx
@@ -25,11 +25,11 @@ export function AutopilotSkillsSection({ skills }: Props) {
return (
<section>
<div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">
- <Text variant="body-medium" tone="primary">
+ <Text variant="large-medium" tone="primary">
Autopilot&apos;s Skills
</Text>
<SearchInput
- size="xsmall"
+ size="small"
value={query}
onChange={setQuery}
placeholder="Search skills"
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/AutopilotCard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/AutopilotCard.tsx
index 71e64fc5ff..32861e7201 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/AutopilotCard.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/AutopilotCard.tsx
@@ -1,9 +1,20 @@
import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";
import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
import { Text } from "@/components/atoms/Text/Text";
-import { BubbleChatIcon } from "@hugeicons/core-free-icons";
+import {
+ BubbleChatIcon,
+ Calendar03Icon,
+ FlashIcon,
+ SparklesIcon,
+} from "@hugeicons/core-free-icons";
+import { cn } from "@/lib/utils";
import Link from "next/link";
-import { AUTOPILOT_BLURB, AUTOPILOT_ROLE } from "../helpers";
+import {
+ AUTOPILOT_BLURB,
+ AUTOPILOT_PILL_CLASS,
+ AUTOPILOT_ROLE,
+} from "../helpers";
import { CardStat, CardStats } from "./CardStats";
import { ExpertCover } from "./ExpertTeamCard/components/ExpertCover";
@@ -23,7 +34,7 @@ export function AutopilotCard({
return (
<section
aria-label="Autopilot"
- className="flex flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white"
+ className="flex flex-col overflow-hidden rounded-2xl bg-white smooth-shadow-ring-sm"
>
<Link
href="/team/autopilot"
@@ -46,7 +57,15 @@ export function AutopilotCard({
>
Autopilot
</Text>
- <Text variant="body" tone="muted">
+ <Text
+ variant="small-medium"
+ as="span"
+ className={cn(
+ "inline-flex items-center gap-1.5 self-start rounded-full px-2.5 py-0.5",
+ AUTOPILOT_PILL_CLASS,
+ )}
+ >
+ <Icon icon={SparklesIcon} size={12} />
{AUTOPILOT_ROLE}
</Text>
<Text variant="body" tone="muted" className="mt-1 line-clamp-3">
@@ -54,11 +73,26 @@ export function AutopilotCard({
</Text>
</div>
- <div className="w-full px-2">
+ <div className="w-full px-2 pl-5">
<CardStats className="mt-3 w-full">
- <CardStat label="Schedules">{scheduleCount}</CardStat>
- <CardStat label="Skills">{skillCount}</CardStat>
- <CardStat label="Workflows">{workflowCount}</CardStat>
+ <CardStat
+ icon={Calendar03Icon}
+ label="Schedules"
+ singular="schedule"
+ count={scheduleCount}
+ />
+ <CardStat
+ icon={SparklesIcon}
+ label="Skills"
+ singular="skill"
+ count={skillCount}
+ />
+ <CardStat
+ icon={FlashIcon}
+ label="Workflows"
+ singular="workflow"
+ count={workflowCount}
+ />
</CardStats>
</div>
</Link>
@@ -66,7 +100,7 @@ export function AutopilotCard({
<div className="flex items-center gap-2 px-4 pb-4">
<Button
variant="secondary"
- size="xs"
+ size="small"
className="flex-1"
leadingIcon={BubbleChatIcon}
onClick={onChat}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/CardStats.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/CardStats.tsx
index 41a371fb8b..e4cef781c0 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/CardStats.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/CardStats.tsx
@@ -1,5 +1,7 @@
+import { Icon } from "@/components/atoms/Icon/Icon";
import { Text } from "@/components/atoms/Text/Text";
import { cn } from "@/lib/utils";
+import type { IconSvgElement } from "@hugeicons/react";
import { ReactNode } from "react";
interface Props {
@@ -7,14 +9,14 @@ interface Props {
children: ReactNode;
}
-/** A card's totals as one tinted pill, each stat a value over its label. */
+/** A card's totals as one meta line: icon, count, word, like the
+ * marketplace card's footer. Empty totals are left out, which is what
+ * keeps the line short; if it still overflows it wraps whole items,
+ * never mid-word. */
export function CardStats({ className, children }: Props) {
return (
<dl
- className={cn(
- "flex items-stretch rounded-lg bg-zinc-50 px-2 py-2 ring-1 ring-inset ring-zinc-100",
- className,
- )}
+ className={cn("flex flex-wrap items-center gap-x-3 gap-y-1", className)}
>
{children}
</dl>
@@ -22,29 +24,31 @@ export function CardStats({ className, children }: Props) {
}
interface StatProps {
+ icon: IconSvgElement;
+ /** Plural noun, also the accessible label: "Schedules". */
label: string;
- children: ReactNode;
+ singular: string;
+ count: number;
}
-export function CardStat({ label, children }: StatProps) {
+export function CardStat({ icon, label, singular, count }: StatProps) {
+ if (count === 0) return null;
+ const word = count === 1 ? singular : label.toLowerCase();
+
return (
- <div className="flex min-w-0 flex-1 flex-col items-center gap-0.5 text-center">
- <Text
- variant="small"
- as="dt"
- tone="muted"
- className="order-2 w-full truncate"
- >
- {label}
- </Text>
+ <div className="flex items-center gap-1 whitespace-nowrap text-zinc-800">
+ <Icon icon={icon} size={14} className="shrink-0" aria-hidden="true" />
<Text
- variant="large-semibold"
+ variant="body-medium"
as="dd"
- tone="primary"
unmask={false}
- className="order-1 tabular-nums"
+ className="tabular-nums !text-zinc-800"
>
- {children}
+ {count}
+ </Text>
+ <Text variant="body-medium" as="dt" className="!text-inherit">
+ <span className="sr-only">{label}</span>
+ <span aria-hidden="true">{word}</span>
</Text>
</div>
);
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/EmptyTeamState.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/EmptyTeamState.tsx
index e82fc70eae..0e083a3ac0 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/EmptyTeamState.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/EmptyTeamState.tsx
@@ -15,10 +15,15 @@ export function EmptyTeamState() {
work alongside Autopilot.
</Text>
<div className="flex flex-wrap items-center justify-center gap-2">
- <Button as="NextLink" href="/marketplace" variant="primary" size="xs">
+ <Button
+ as="NextLink"
+ href="/marketplace"
+ variant="primary"
+ size="small"
+ >
Browse the marketplace
</Button>
- <Button as="NextLink" href="/raise" variant="secondary" size="xs">
+ <Button as="NextLink" href="/raise" variant="secondary" size="small">
Raise your own
</Button>
</div>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx
index 215910186d..afe3f87b6e 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/ExpertTeamCard.tsx
@@ -1,19 +1,25 @@
import { Expert } from "@/app/api/__generated__/models/expert";
+import { getRaisedExpertAccent } from "@/app/(platform)/marketplace/components/ExpertsSection/helpers";
import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/components/atoms/Avatar/Avatar";
-import { Badge } from "@/components/atoms/Badge/Badge";
import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
import { Text } from "@/components/atoms/Text/Text";
import {
BubbleChatIcon,
+ Calendar03Icon,
+ FlashIcon,
PencilEdit02Icon,
+ PlugSocketIcon,
PlusSignIcon,
+ SparklesIcon,
} from "@hugeicons/core-free-icons";
import { creditsToUsdLabel } from "@/lib/credits";
+import { cn } from "@/lib/utils";
import Link from "next/link";
import { MouseEvent } from "react";
@@ -22,7 +28,6 @@ import { SpendMeter } from "./components/SpendMeter";
import {
getExpertBlurb,
getExpertRosterStatus,
- getNeedsSetupCount,
getWeeklySpend,
} from "../../helpers";
import { CardStat, CardStats } from "../CardStats";
@@ -46,8 +51,8 @@ export function ExpertTeamCard({
onChat,
}: Props) {
const blurb = getExpertBlurb(expert);
- const needsSetupCount = getNeedsSetupCount(expert, schedules);
- const rosterStatus = getExpertRosterStatus(expert, needsSetupCount);
+ const accent = getRaisedExpertAccent(expert.role, expert.color);
+ const rosterStatus = getExpertRosterStatus(expert);
const weeklySpend = getWeeklySpend(expert);
const { handleResume, isResuming, isFireOpen, openFire, closeFire } =
useExpertTeamCard(expert.id);
@@ -63,7 +68,7 @@ export function ExpertTeamCard({
}
return (
- <div className="relative flex flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white">
+ <div className="relative flex flex-col overflow-hidden rounded-2xl bg-white smooth-shadow-ring-sm">
{/* Floated over the cover so the whole body stays one link target. */}
<div className="absolute right-4 top-4 z-10 flex items-center gap-1.5">
<Button
@@ -124,7 +129,6 @@ export function ExpertTeamCard({
<SpendMeter
spent={weeklySpend?.spent ?? 0}
budget={weeklySpend?.budget ?? 1}
- color={expert.color}
muted={!weeklySpend}
/>
</div>
@@ -140,27 +144,49 @@ export function ExpertTeamCard({
>
{expert.name}
</Text>
- <Text variant="body" tone="muted" className="line-clamp-2">
- {expert.role}
+ {/* Same pill as the expert page header and the marketplace card. */}
+ <Text
+ variant="small-medium"
+ as="span"
+ className={cn(
+ "inline-flex max-w-full items-center gap-1.5 self-start rounded-full px-2.5 py-0.5",
+ accent.pill,
+ )}
+ >
+ <Icon icon={accent.roleIcon} size={12} className="shrink-0" />
+ <span className="truncate">{expert.role}</span>
</Text>
<Text variant="body" tone="muted" className="mt-1 line-clamp-2">
{blurb}
</Text>
- {needsSetupCount > 0 ? (
- <Badge variant="warning" size="small" className="mt-1">
- {needsSetupCount} {needsSetupCount === 1 ? "needs" : "need"} setup
- </Badge>
- ) : null}
</div>
- <div className="w-full px-2">
+ <div className="w-full px-2 pl-5">
<CardStats className="mt-3 w-full">
- <CardStat label="Schedules">{schedules.length}</CardStat>
- <CardStat label="Skills">{expert.skills.length}</CardStat>
- <CardStat label="Workflows">{expert.workflows.length}</CardStat>
- <CardStat label="Integrations">
- {expert.credential_count ?? 0}
- </CardStat>
+ <CardStat
+ icon={Calendar03Icon}
+ label="Schedules"
+ singular="schedule"
+ count={schedules.length}
+ />
+ <CardStat
+ icon={SparklesIcon}
+ label="Skills"
+ singular="skill"
+ count={expert.skills.length}
+ />
+ <CardStat
+ icon={FlashIcon}
+ label="Workflows"
+ singular="workflow"
+ count={expert.workflows.length}
+ />
+ <CardStat
+ icon={PlugSocketIcon}
+ label="Integrations"
+ singular="integration"
+ count={expert.credential_count ?? 0}
+ />
</CardStats>
</div>
</Link>
@@ -172,7 +198,7 @@ export function ExpertTeamCard({
</Text>
<Button
variant="secondary"
- size="xs"
+ size="small"
loading={isResuming}
onClick={handleResume}
>
@@ -184,7 +210,7 @@ export function ExpertTeamCard({
<div className="flex items-center gap-2 px-4 pb-4">
<Button
variant="secondary"
- size="xs"
+ size="small"
className="flex-1"
leadingIcon={BubbleChatIcon}
onClick={() => onChat(expert.id)}
@@ -192,8 +218,8 @@ export function ExpertTeamCard({
Chat
</Button>
<Button
- variant="outline"
- size="xs"
+ variant="secondary"
+ size="small"
className="flex-1"
leadingIcon={PlusSignIcon}
onClick={handleInstallClick}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/ExpertCover.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/ExpertCover.tsx
index e620b549ce..13a7bad33b 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/ExpertCover.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/ExpertCover.tsx
@@ -44,10 +44,14 @@ interface Props {
className?: string;
color: string | undefined;
status?: CoverStatus;
+ /** Show Autopilot's cover art. Implied by the "built-in" status, so a
+ * caller that wants the art without the badge sets this instead. */
+ builtIn?: boolean;
}
-export function ExpertCover({ className, color, status }: Props) {
+export function ExpertCover({ className, color, status, builtIn }: Props) {
const statusStyle = status ? STATUS_STYLES[status] : null;
+ const showArt = builtIn || status === "built-in";
return (
<div
@@ -57,7 +61,7 @@ export function ExpertCover({ className, color, status }: Props) {
className,
)}
>
- {status === "built-in" ? (
+ {showArt ? (
<Image
src="/experts/covers/autopilot.jpg"
alt=""
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/SpendMeter.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/SpendMeter.tsx
index 7f7d66c7e7..f7810cdce0 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/SpendMeter.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/SpendMeter.tsx
@@ -1,34 +1,24 @@
-import { ditherColorsFor } from "@/app/(platform)/raise/components/ColorStep/helpers";
+import { Progress } from "@/components/atoms/Progress/Progress";
import { creditsToUsdLabel } from "@/lib/credits";
import { cn } from "@/lib/utils";
-import { useEffect, useState } from "react";
-
-const SEGMENT_COUNT = 28;
-/** Segments light up left to right, so the bar fills up instead of blinking on. */
-const SEGMENT_DELAY_MS = 25;
interface Props {
spent: number;
budget: number;
- color?: string | null;
muted?: boolean;
}
-export function SpendMeter({ spent, budget, color, muted }: Props) {
- const [hasEntered, setHasEntered] = useState(false);
+export function SpendMeter({ spent, budget, muted }: Props) {
const ratio = budget > 0 ? Math.min(Math.max(spent / budget, 0), 1) : 0;
- const filledCount = hasEntered ? Math.round(ratio * SEGMENT_COUNT) : 0;
-
- useEffect(() => setHasEntered(true), []);
- // The dither ramp's second stop is the -300 shade the expert was picked in.
- const fillColor = ditherColorsFor(color ?? null)?.[1];
+ const isOverBudget = spent > budget;
const clampedSpent = Math.min(Math.max(spent, 0), Math.max(budget, 0));
const valueText = `${creditsToUsdLabel(spent)} of ${creditsToUsdLabel(budget)} spent this week${
- spent > budget ? " (over budget)" : ""
+ isOverBudget ? " (over budget)" : ""
}`;
return (
- <div
+ <Progress
+ value={ratio * 100}
role="progressbar"
aria-label="Weekly spend"
aria-valuenow={clampedSpent}
@@ -36,27 +26,10 @@ export function SpendMeter({ spent, budget, color, muted }: Props) {
aria-valuemax={budget}
aria-valuetext={valueText}
className={cn(
- "flex h-4 w-full items-stretch gap-1",
+ "h-1.5 w-full bg-zinc-100",
+ isOverBudget ? "[&>div]:bg-red-400" : "[&>div]:bg-zinc-400",
muted && "opacity-50",
)}
- >
- {Array.from({ length: SEGMENT_COUNT }, (_, index) => {
- const isFilled = index < filledCount;
-
- return (
- <span
- key={index}
- style={{
- transitionDelay: `${index * SEGMENT_DELAY_MS}ms`,
- backgroundColor: isFilled && fillColor ? fillColor : undefined,
- }}
- className={cn(
- "flex-1 rounded-[1px] transition-colors duration-300",
- isFilled && !fillColor ? "bg-zinc-800" : "bg-zinc-200",
- )}
- />
- );
- })}
- </div>
+ />
);
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCardSkeleton.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCardSkeleton.tsx
index f25c7b01c5..653672abec 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCardSkeleton.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCardSkeleton.tsx
@@ -5,7 +5,7 @@ import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
// real cards land. A single flat block would settle at the wrong height.
export function ExpertTeamCardSkeleton() {
return (
- <div className="flex flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white">
+ <div className="flex flex-col overflow-hidden rounded-2xl bg-white smooth-shadow-ring-sm">
<div className="flex flex-col items-start p-2 pb-4">
<div className="h-28 w-full rounded-lg bg-zinc-100" />
<div className="flex w-full items-start gap-3 px-2">
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/FireExpertDialog/FireExpertDialogSections.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/FireExpertDialog/FireExpertDialogSections.tsx
index 14c7cb2c25..2ab4657347 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/FireExpertDialog/FireExpertDialogSections.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/FireExpertDialog/FireExpertDialogSections.tsx
@@ -65,7 +65,7 @@ export function FireExpertPreview({
<div className="flex justify-end">
<Button
variant="secondary"
- size="xs"
+ size="small"
onClick={handleRetry}
data-testid="fire-preview-retry"
>
@@ -111,7 +111,7 @@ export function FireExpertFooter({
return (
<Dialog.Footer>
<Button
- size="xs"
+ size="small"
variant="secondary"
disabled={isFiring}
onClick={onClose}
@@ -119,7 +119,7 @@ export function FireExpertFooter({
Keep {expertName}
</Button>
<Button
- size="xs"
+ size="small"
variant="destructive"
loading={isFiring}
disabled={isPreviewLoading}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/NewPodDialog/NewPodDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/NewPodDialog/NewPodDialog.tsx
index 0612e59f84..b9845a2172 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/NewPodDialog/NewPodDialog.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/NewPodDialog/NewPodDialog.tsx
@@ -54,7 +54,7 @@ export function NewPodDialog({ open, onClose, onCreate, isCreating }: Props) {
/>
<div className="flex justify-end gap-2">
<Button
- size="xs"
+ size="small"
type="button"
variant="secondary"
onClick={onClose}
@@ -62,7 +62,7 @@ export function NewPodDialog({ open, onClose, onCreate, isCreating }: Props) {
Cancel
</Button>
<Button
- size="xs"
+ size="small"
type="submit"
variant="primary"
disabled={!trimmed || isCreating}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/PodBoard/PodBoard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/PodBoard/PodBoard.tsx
index c1f9f69e59..aede43c220 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/PodBoard/PodBoard.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/PodBoard/PodBoard.tsx
@@ -82,7 +82,7 @@ export function PodBoard({
<Text variant="body" tone="secondary" className="max-w-prose">
Group experts into pods to keep related work together.
</Text>
- <Button variant="primary" size="xs" onClick={onNewPod}>
+ <Button variant="primary" size="small" onClick={onNewPod}>
New Pod
</Button>
</div>
@@ -114,7 +114,7 @@ function PodFolder({ name, experts, onOpen }: PodFolderProps) {
type="button"
onClick={onOpen}
aria-label={`Open ${name} pod`}
- className="flex flex-col gap-3 rounded-xl border border-zinc-200 bg-white p-4 text-left transition-colors hover:border-zinc-300 hover:bg-zinc-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400"
+ className="flex flex-col gap-3 rounded-2xl bg-white p-4 text-left transition-colors smooth-shadow-ring-sm hover:bg-zinc-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400"
>
<div className="flex items-center gap-3">
<span className="flex size-10 shrink-0 items-center justify-center rounded-lg bg-zinc-100 text-zinc-600">
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/SetupNeeded.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/SetupNeeded.tsx
new file mode 100644
index 0000000000..08e3f0abcf
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/SetupNeeded.tsx
@@ -0,0 +1,73 @@
+"use client";
+
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { Alert01Icon } from "@hugeicons/core-free-icons";
+import { ExpertConnectServiceDialog } from "../../[expertId]/components/ExpertIntegrationsSection/ExpertConnectServiceDialog";
+import { SetupNeededRow } from "./components/SetupNeededRow";
+import { useSetupNeeded } from "./useSetupNeeded";
+
+interface Props {
+ enabled: boolean;
+}
+
+/** Everything still standing between the team's scheduled workflows and
+ * their schedules, one row per gap with the one action that closes it. */
+export function SetupNeeded({ enabled }: Props) {
+ const {
+ items,
+ isConnectable,
+ connecting,
+ connect,
+ closeConnect,
+ handleConnected,
+ allow,
+ isGranting,
+ } = useSetupNeeded({ enabled });
+
+ if (items.length === 0) return null;
+
+ return (
+ <section
+ aria-label="Setup needed"
+ className="flex min-w-0 flex-col"
+ data-testid="setup-needed"
+ >
+ <div className="mb-1.5 flex items-center gap-1.5 px-3.5">
+ <Icon
+ icon={Alert01Icon}
+ size={14}
+ className="text-amber-600"
+ aria-hidden
+ />
+ <Text variant="small-medium" as="h2" className="!text-zinc-700">
+ Setup needed ({items.length})
+ </Text>
+ </div>
+ <ul className="flex flex-col gap-2" aria-label="Setup items">
+ {items.map((item) => (
+ <li
+ key={`${item.expert_id}-${item.workflow_id}-${item.providers.join("+")}`}
+ >
+ <SetupNeededRow
+ item={item}
+ isConnectable={isConnectable(item)}
+ isGranting={isGranting}
+ onConnect={() => connect(item)}
+ onAllow={() => allow(item)}
+ />
+ </li>
+ ))}
+ </ul>
+ {connecting ? (
+ <ExpertConnectServiceDialog
+ open
+ expertName={connecting.expert_name}
+ initialProviderId={connecting.providers[0] ?? null}
+ onClose={closeConnect}
+ onConnected={handleConnected}
+ />
+ ) : null}
+ </section>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/components/SetupNeededRow.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/components/SetupNeededRow.tsx
new file mode 100644
index 0000000000..365837ff71
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/components/SetupNeededRow.tsx
@@ -0,0 +1,90 @@
+import type { ExpertSetupItem } from "@/app/api/__generated__/models/expertSetupItem";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { formatProviderName } from "@/components/contextual/IntegrationsPanel/helpers";
+import { IntegrationLogo } from "@/components/molecules/IntegrationLogo/IntegrationLogo";
+import { Calendar03Icon } from "@hugeicons/core-free-icons";
+
+interface Props {
+ item: ExpertSetupItem;
+ isConnectable: boolean;
+ isGranting: boolean;
+ onConnect: () => void;
+ onAllow: () => void;
+}
+
+export function SetupNeededRow({
+ item,
+ isConnectable,
+ isGranting,
+ onConnect,
+ onAllow,
+}: Props) {
+ const provider = item.providers[0];
+ const providerName = provider ? formatProviderName(provider) : "A service";
+ const workflowName = item.workflow_name ?? "a workflow";
+ const isCredential = item.resolution !== "workflow";
+
+ return (
+ <article className="flex items-center gap-2.5 rounded-2xl bg-white px-3.5 py-2.5 smooth-shadow-ring-sm">
+ {isCredential && provider ? (
+ <IntegrationLogo provider={provider} size={20} className="shrink-0" />
+ ) : (
+ <Icon
+ icon={Calendar03Icon}
+ size={18}
+ className="shrink-0 text-zinc-500"
+ aria-hidden="true"
+ />
+ )}
+ <div className="flex min-w-0 flex-1 flex-col">
+ <Text
+ variant="body-medium"
+ as="span"
+ className="truncate !text-zinc-800"
+ >
+ {isCredential
+ ? `${providerName} for ${item.expert_name}`
+ : `Schedule ${workflowName} for ${item.expert_name}`}
+ </Text>
+ <Text variant="small" as="span" className="truncate !text-zinc-400">
+ {isCredential
+ ? `${workflowName} needs it to run on schedule.`
+ : "Every connection is in place; the schedule still has to be created."}
+ </Text>
+ </div>
+ <div className="flex shrink-0 items-center">
+ {item.resolution === "allow" ? (
+ <Button
+ variant="secondary"
+ size="small"
+ loading={isGranting}
+ onClick={onAllow}
+ >
+ Allow
+ </Button>
+ ) : item.resolution === "connect" ? (
+ isConnectable ? (
+ <Button variant="primary" size="small" onClick={onConnect}>
+ Connect
+ </Button>
+ ) : (
+ <Text variant="small" as="span" className="!text-zinc-500">
+ Needs a platform key
+ </Text>
+ )
+ ) : item.library_agent_id ? (
+ <Button
+ as="NextLink"
+ href={`/library/agents/${item.library_agent_id}`}
+ variant="outline"
+ size="small"
+ >
+ Open workflow
+ </Button>
+ ) : null}
+ </div>
+ </article>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/useSetupNeeded.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/useSetupNeeded.ts
new file mode 100644
index 0000000000..7c7eba17fb
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/useSetupNeeded.ts
@@ -0,0 +1,112 @@
+import {
+ getListExpertSetupItemsQueryKey,
+ getListExpertsQueryKey,
+ useGrantExpertCredentials,
+ useListExpertSetupItems,
+} from "@/app/api/__generated__/endpoints/experts/experts";
+import { useGetV1ListProviders } from "@/app/api/__generated__/endpoints/integrations/integrations";
+import { getGetV1ListExecutionSchedulesForAUserQueryKey } from "@/app/api/__generated__/endpoints/schedules/schedules";
+import type { CredentialsMetaResponse } from "@/app/api/__generated__/models/credentialsMetaResponse";
+import type { ExpertSetupItem } from "@/app/api/__generated__/models/expertSetupItem";
+import { okData } from "@/app/api/helpers";
+import { toConnectableProviders } from "@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/helpers";
+import { formatProviderName } from "@/components/contextual/IntegrationsPanel/helpers";
+import { useToast } from "@/components/molecules/Toast/use-toast";
+import { useQueryClient } from "@tanstack/react-query";
+import { useState } from "react";
+
+interface Args {
+ enabled: boolean;
+}
+
+export function useSetupNeeded({ enabled }: Args) {
+ const queryClient = useQueryClient();
+ const { toast } = useToast();
+ const [connecting, setConnecting] = useState<ExpertSetupItem | null>(null);
+
+ const itemsQuery = useListExpertSetupItems({
+ query: { enabled, select: (res) => okData(res) ?? [] },
+ });
+ const providersQuery = useGetV1ListProviders({
+ query: {
+ enabled,
+ select: (res) => (res.status === 200 ? res.data : []),
+ },
+ });
+ const connectable = new Set(
+ toConnectableProviders(providersQuery.data ?? []).map((p) => p.id),
+ );
+
+ // A grant is what lets the backend create the pending schedule, so the
+ // roster (schedule counts) and the schedule list move with the card.
+ function invalidate() {
+ for (const queryKey of [
+ getListExpertSetupItemsQueryKey(),
+ getListExpertsQueryKey(),
+ getGetV1ListExecutionSchedulesForAUserQueryKey(),
+ ]) {
+ queryClient.invalidateQueries({ queryKey });
+ }
+ }
+
+ const { mutate: grant, isPending: isGranting } = useGrantExpertCredentials({
+ mutation: {
+ onSuccess: invalidate,
+ onError: () =>
+ toast({ title: "Could not add integration", variant: "destructive" }),
+ },
+ });
+
+ function grantTo(
+ item: ExpertSetupItem,
+ credential: { id: string; provider?: string },
+ ) {
+ // A row can name a credential without naming its provider, and half a
+ // sentence is worse than a general one.
+ const service = credential.provider
+ ? formatProviderName(credential.provider)
+ : "this service";
+ grant(
+ { expertId: item.expert_id, data: { credential_ids: [credential.id] } },
+ {
+ onSuccess: () =>
+ toast({ title: `${item.expert_name} can now use ${service}` }),
+ },
+ );
+ }
+
+ function allow(item: ExpertSetupItem) {
+ if (!item.credential_id) return;
+ grantTo(item, { id: item.credential_id, provider: item.providers[0] });
+ }
+
+ function connect(item: ExpertSetupItem) {
+ setConnecting(item);
+ }
+
+ function closeConnect() {
+ setConnecting(null);
+ }
+
+ function handleConnected(credential: CredentialsMetaResponse) {
+ if (connecting) grantTo(connecting, credential);
+ setConnecting(null);
+ }
+
+ return {
+ items: itemsQuery.data ?? [],
+ // While the provider list is still loading nothing is knowably
+ // unconnectable, so rows offer Connect rather than flashing "Needs a
+ // platform key". Once it has settled, a failed load means no provider
+ // is known to be connectable and the rows say so.
+ isConnectable: (item: ExpertSetupItem) =>
+ providersQuery.isPending ||
+ item.providers.some((provider) => connectable.has(provider)),
+ connecting,
+ connect,
+ closeConnect,
+ handleConnected,
+ allow,
+ isGranting,
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/SoulDrawer.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/SoulDrawer.tsx
index d111eb47f0..a06883193e 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/SoulDrawer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/SoulDrawer.tsx
@@ -72,13 +72,13 @@ function SoulPanelBody({ expert, onClose }: BodyProps) {
/>
</div>
<div className="flex shrink-0 justify-end gap-2 border-t border-t-sidebar-border px-5 py-3">
- <Button type="button" variant="ghost" size="xs" onClick={onClose}>
+ <Button type="button" variant="ghost" size="small" onClick={onClose}>
Cancel
</Button>
<Button
type="submit"
variant="primary"
- size="xs"
+ size="small"
loading={isPending}
disabled={!canSave}
>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsx
index 2df6fe0c21..b7eac24c6b 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsx
@@ -1,26 +1,18 @@
"use client";
import { Button } from "@/components/atoms/Button/Button";
-import { SparklesIcon, UserAdd01Icon } from "@hugeicons/core-free-icons";
export function TeamHeaderActions() {
return (
<div className="flex flex-wrap items-center gap-2">
- <Button
- as="NextLink"
- href="/raise"
- variant="secondary"
- size="xs"
- leadingIcon={SparklesIcon}
- >
+ <Button as="NextLink" href="/raise" variant="secondary" size="small">
Raise expert
</Button>
<Button
as="NextLink"
href="/marketplace#experts"
variant="primary"
- size="xs"
- leadingIcon={UserAdd01Icon}
+ size="small"
>
Hire expert
</Button>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRoster.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRoster.tsx
index ea5164320e..535f56de3d 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRoster.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRoster.tsx
@@ -11,12 +11,13 @@ import {
} from "../../helpers";
import { AutopilotCard } from "../AutopilotCard";
import { ExpertTeamCardSkeleton } from "../ExpertTeamCardSkeleton";
-import { TeamRosterToolbar } from "./TeamRosterToolbar";
-import { useTeamRosterView } from "./useTeamRosterView";
interface Props {
isLoading: boolean;
experts: Expert[];
+ /** Experts left after the page's search and filter. */
+ visibleExperts: Expert[];
+ isNarrowed: boolean;
schedulesForExpert: (expert: Expert) => GraphExecutionJobInfo[];
renderCard: (expert: Expert) => ReactNode;
onAutopilotChat: () => void;
@@ -25,13 +26,12 @@ interface Props {
export function TeamRoster({
isLoading,
experts,
+ visibleExperts,
+ isNarrowed,
schedulesForExpert,
renderCard,
onAutopilotChat,
}: Props) {
- const { query, setQuery, filter, setFilter, isNarrowed, visibleExperts } =
- useTeamRosterView({ experts, schedulesForExpert });
-
// Autopilot reports on the whole team, so its summary ignores the toolbar.
const summary = getAutopilotSummary({ experts, schedulesForExpert });
const autopilot = (
@@ -45,18 +45,6 @@ export function TeamRoster({
return (
<section aria-label="Experts" className="flex flex-col gap-4">
- <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
- <Text variant="large-medium" as="h5" tone="primary">
- Experts
- </Text>
- <TeamRosterToolbar
- query={query}
- onQueryChange={setQuery}
- filter={filter}
- onFilterChange={setFilter}
- />
- </div>
-
{isLoading ? (
<div className={TEAM_GRID_CLASS}>
{autopilot}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRosterToolbar.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRosterToolbar.tsx
index 7d7c91e8c5..b584812768 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRosterToolbar.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRosterToolbar.tsx
@@ -1,5 +1,5 @@
-import { Select } from "@/components/atoms/Select/Select";
import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";
+import { FilterIconMenu } from "../../[expertId]/components/FilterIconMenu";
import { TeamFilter } from "../../helpers";
interface Props {
@@ -9,13 +9,14 @@ interface Props {
onFilterChange: (next: TeamFilter) => void;
}
-const FILTER_OPTIONS = [
+const FILTER_OPTIONS: readonly { value: TeamFilter; label: string }[] = [
{ value: "all", label: "All experts" },
{ value: "scheduled", label: "Scheduled" },
{ value: "needs-setup", label: "Needs setup" },
{ value: "paused", label: "Paused" },
];
+/** Search plus the same filter icon menu the expert page tabs use. */
export function TeamRosterToolbar({
query,
onQueryChange,
@@ -23,27 +24,21 @@ export function TeamRosterToolbar({
onFilterChange,
}: Props) {
return (
- <div className="flex flex-wrap items-center justify-center gap-2">
+ <div className="flex flex-wrap items-center gap-2 sm:justify-end">
<SearchInput
value={query}
onChange={onQueryChange}
- size="xsmall"
+ size="small"
placeholder="Search experts"
aria-label="Search experts"
className="w-full sm:w-48"
/>
- <Select
- id="team-filter"
- label="Filter"
- hideLabel
- size="small"
- className="h-7 rounded-md px-2.5 text-xs"
+ <FilterIconMenu
+ label="Filter experts"
value={filter}
- onValueChange={(next) => onFilterChange(next as TeamFilter)}
options={FILTER_OPTIONS}
- // The hidden-label Select reserves `mb-6` for error text it never
- // shows, which pushes its trigger off the toolbar's centre line.
- wrapperClassName="w-36 !mb-0"
+ defaultValue="all"
+ onChange={onFilterChange}
/>
</div>
);
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/team/helpers.test.ts
index 826704c54a..32b7ef3aa5 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/helpers.test.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/team/helpers.test.ts
@@ -105,7 +105,7 @@ describe("getExpertRosterStatus", () => {
expert.last_run_status = "RUNNING";
expert.schedules_paused_at = new Date("2026-09-03T10:00:00Z");
- expect(getExpertRosterStatus(expert, 1)).toBe("working");
+ expect(getExpertRosterStatus(expert)).toBe("working");
});
test.each(["FAILED", "TERMINATED", "REVIEW"])(
@@ -114,7 +114,7 @@ describe("getExpertRosterStatus", () => {
const expert = makeExpert("attention");
expert.last_run_status = lastRunStatus;
- expect(getExpertRosterStatus(expert, 0)).toBe("needs-you");
+ expect(getExpertRosterStatus(expert)).toBe("needs-you");
},
);
@@ -122,15 +122,15 @@ describe("getExpertRosterStatus", () => {
const paused = makeExpert("paused");
paused.schedules_paused_at = new Date("2026-09-03T10:00:00Z");
- expect(getExpertRosterStatus(paused, 0)).toBe("needs-you");
- expect(getExpertRosterStatus(makeExpert("setup"), 1)).toBe("needs-you");
+ expect(getExpertRosterStatus(paused)).toBe("needs-you");
+ expect(getExpertRosterStatus(makeExpert("setup"))).toBe("idle");
});
test("reports an expert with no active issue as idle", () => {
const expert = makeExpert("idle");
expert.last_run_status = "COMPLETED";
- expect(getExpertRosterStatus(expert, 0)).toBe("idle");
+ expect(getExpertRosterStatus(expert)).toBe("idle");
});
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts
index 2be89a7d6e..f748fee303 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts
@@ -155,16 +155,14 @@ export function getWeeklySpend(expert: Expert) {
export type ExpertRosterStatus = "idle" | "working" | "needs-you";
-export function getExpertRosterStatus(
- expert: Expert,
- needsSetupCount: number,
-): ExpertRosterStatus {
+// Missing setup is not a card status: the Setup needed card above the
+// roster names it and offers the fix.
+export function getExpertRosterStatus(expert: Expert): ExpertRosterStatus {
const runStatus = expert.last_run_status?.toUpperCase();
if (runStatus === "RUNNING" || runStatus === "QUEUED") return "working";
if (
expert.schedules_paused_at ||
- needsSetupCount > 0 ||
runStatus === "FAILED" ||
runStatus === "TERMINATED" ||
runStatus === "REVIEW"
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/page.tsx b/autogpt_platform/frontend/src/app/(platform)/team/page.tsx
index d7af5ef95e..cd9171e8d7 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/page.tsx
@@ -13,15 +13,18 @@ import {
import { cn } from "@/lib/utils";
import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";
import { UserGroupIcon } from "@hugeicons/core-free-icons";
-import { Icon } from "@/components/atoms/Icon/Icon";
import { notFound } from "next/navigation";
+import { useState } from "react";
import { EmptyTeamState } from "./components/EmptyTeamState";
import { ExpertChatDrawer } from "./components/ExpertChatDrawer/ExpertChatDrawer";
import { ExpertTeamCard } from "./components/ExpertTeamCard/ExpertTeamCard";
import { ExpertTeamCardSkeleton } from "./components/ExpertTeamCardSkeleton";
+import { SetupNeeded } from "./components/SetupNeeded/SetupNeeded";
import { SoulDrawer } from "./components/SoulDrawer/SoulDrawer";
import { TeamHeaderActions } from "./components/TeamHeaderActions";
import { TeamRoster } from "./components/TeamRoster/TeamRoster";
+import { TeamRosterToolbar } from "./components/TeamRoster/TeamRosterToolbar";
+import { useTeamRosterView } from "./components/TeamRoster/useTeamRosterView";
import { TEAM_GRID_CLASS } from "./helpers";
import { useTeamPage } from "./useTeamPage";
@@ -29,9 +32,11 @@ const MAIN_CLASS =
"mx-auto min-h-screen w-full max-w-[1180px] space-y-5 px-4 pb-16 pt-6 duration-500 sm:px-8 md:px-12 animate-in fade-in slide-in-from-bottom-2 fill-mode-both motion-reduce:animate-none";
const TABS = [
- { value: "overview", label: "Team Overview", icon: UserGroupIcon },
+ { value: "overview", label: "Overview", icon: UserGroupIcon },
] as const;
+type TeamTab = (typeof TABS)[number]["value"];
+
export default function TeamPage() {
const { enabled, ready } = useFlagStatus(Flag.HIRE_EXPERTS);
const {
@@ -52,6 +57,11 @@ export default function TeamPage() {
openChat,
closeChat,
} = useTeamPage({ enabled: Boolean(enabled) && ready });
+ const [tab, setTab] = useState<TeamTab>("overview");
+ const roster = useTeamRosterView({
+ experts: hiredExperts,
+ schedulesForExpert,
+ });
if (!ready) {
return (
@@ -87,12 +97,9 @@ export default function TeamPage() {
<main className={cn(MAIN_CLASS, "min-w-0 flex-1")}>
<div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
<div className="flex flex-col gap-1">
- <div className="flex items-center gap-2">
- <Icon icon={UserGroupIcon} size={18} className="text-zinc-950" />
- <Text variant="large-medium" as="h5" tone="primary">
- Team
- </Text>
- </div>
+ <Text variant="lead-medium" as="h1" tone="primary">
+ Team
+ </Text>
<Text variant="body" tone="secondary" className="max-w-prose">
Autopilot and your hired experts, ready to work.
</Text>
@@ -108,23 +115,42 @@ export default function TeamPage() {
/>
) : null}
- <TabsLine variant="compact" defaultValue="overview">
- <TabsLineList className="overflow-x-auto border-b-transparent">
- {TABS.map((tab) => (
- <TabsLineTrigger
- key={tab.value}
- value={tab.value}
- icon={tab.icon}
- >
- {tab.label}
- </TabsLineTrigger>
- ))}
- </TabsLineList>
+ <TabsLine
+ variant="compact"
+ value={tab}
+ onValueChange={(next) => setTab(next as TeamTab)}
+ >
+ {/* The roster's search and filter share the tabs row, right-aligned,
+ and only while the roster is the tab being shown. */}
+ <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
+ <TabsLineList className="w-auto overflow-x-auto border-b-transparent">
+ {TABS.map((item) => (
+ <TabsLineTrigger
+ key={item.value}
+ value={item.value}
+ icon={item.icon}
+ >
+ {item.label}
+ </TabsLineTrigger>
+ ))}
+ </TabsLineList>
+ {tab === "overview" ? (
+ <TeamRosterToolbar
+ query={roster.query}
+ onQueryChange={roster.setQuery}
+ filter={roster.filter}
+ onFilterChange={roster.setFilter}
+ />
+ ) : null}
+ </div>
<TabsLineContent value="overview" className="space-y-6">
+ <SetupNeeded enabled={Boolean(enabled) && ready} />
<TeamRoster
isLoading={isLoading}
experts={hiredExperts}
+ visibleExperts={roster.visibleExperts}
+ isNarrowed={roster.isNarrowed}
schedulesForExpert={schedulesForExpert}
renderCard={renderCard}
onAutopilotChat={() => openChat(null)}
diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.json
index 662d80f8fa..f6086b19f1 100644
--- a/autogpt_platform/frontend/src/app/api/openapi.json
+++ b/autogpt_platform/frontend/src/app/api/openapi.json
@@ -6504,6 +6504,32 @@
"security": [{ "HTTPBearerJWT": [] }]
}
},
+ "/api/experts/setup": {
+ "get": {
+ "tags": ["v2", "experts", "experts", "private"],
+ "summary": "List Expert Setup Items",
+ "description": "What still stands between each expert's scheduled workflows and a schedule.",
+ "operationId": "list_expert_setup_items",
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "items": { "$ref": "#/components/schemas/ExpertSetupItem" },
+ "type": "array",
+ "title": "Response List Expert Setup Items"
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ }
+ },
+ "security": [{ "HTTPBearerJWT": [] }]
+ }
+ },
"/api/experts/templates": {
"get": {
"tags": ["v2", "experts", "experts"],
@@ -20799,6 +20825,52 @@
"title": "ExpertRun",
"description": "One expert-attributed execution, for the /team Work surface."
},
+ "ExpertSetupItem": {
+ "properties": {
+ "expert_id": { "type": "string", "title": "Expert Id" },
+ "expert_name": { "type": "string", "title": "Expert Name" },
+ "expert_avatar_url": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Expert Avatar Url"
+ },
+ "workflow_id": { "type": "string", "title": "Workflow Id" },
+ "workflow_name": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Workflow Name"
+ },
+ "library_agent_id": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Library Agent Id"
+ },
+ "providers": {
+ "items": { "type": "string" },
+ "type": "array",
+ "title": "Providers"
+ },
+ "resolution": {
+ "type": "string",
+ "enum": ["connect", "allow", "workflow"],
+ "title": "Resolution"
+ },
+ "credential_id": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Credential Id"
+ }
+ },
+ "type": "object",
+ "required": [
+ "expert_id",
+ "expert_name",
+ "expert_avatar_url",
+ "workflow_id",
+ "workflow_name",
+ "library_agent_id",
+ "providers",
+ "resolution"
+ ],
+ "title": "ExpertSetupItem",
+ "description": "One thing standing between a scheduled workflow and its schedule.\n\nRendered on the Team page as a row with a single fix. ``connect``: the\nuser has no credential for any of ``providers``. ``allow``: they have one\n(``credential_id``) that this expert may not use yet. ``workflow``: no\ncredential is missing, so the schedule needs creating from the workflow."
+ },
"ExpertSkillsUpdate": {
"properties": {
"skills": {
diff --git a/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx b/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx
index efc89187f4..8456caede8 100644
--- a/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx
+++ b/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx
@@ -182,6 +182,21 @@ export function AvatarFallback({
const { isLoaded, hasImage } = useAvatarContext();
const show = !isLoaded || !hasImage;
if (!show) return null;
+ // An image on its way: a quiet grey placeholder, not a stand-in identity
+ // that gets swapped out a moment later.
+ if (hasImage) {
+ return (
+ <span
+ aria-hidden="true"
+ className={cn(
+ "absolute inset-0 rounded-full bg-zinc-100",
+ square && "rounded-none",
+ className,
+ )}
+ {...props}
+ />
+ );
+ }
const computedSize = _size || getAvatarSizeFromClassName(className) || 40;
const hasCustomFallback = typeof children !== "string" && children != null;
// Trim the seed so call sites with padded names render the same gradient
diff --git a/autogpt_platform/frontend/src/components/atoms/Button/helpers.ts b/autogpt_platform/frontend/src/components/atoms/Button/helpers.ts
index 43077d025a..89e372ee7f 100644
--- a/autogpt_platform/frontend/src/components/atoms/Button/helpers.ts
+++ b/autogpt_platform/frontend/src/components/atoms/Button/helpers.ts
@@ -17,14 +17,14 @@ export const extendedButtonVariants = cva(
primary:
"bg-zinc-800 border-zinc-800 text-white hover:bg-zinc-900 hover:border-zinc-900 rounded-full disabled:text-white disabled:bg-zinc-200 disabled:border-zinc-200 disabled:opacity-1",
secondary:
- "bg-zinc-100 border-zinc-100 text-black hover:bg-zinc-200 hover:border-zinc-200 rounded-full disabled:text-zinc-300 disabled:bg-zinc-50 disabled:border-zinc-50 disabled:opacity-1",
+ "bg-white border-zinc-200 text-zinc-800 shadow-sm hover:bg-zinc-50 hover:border-zinc-300 rounded-full disabled:text-zinc-300 disabled:bg-zinc-50 disabled:border-zinc-100 disabled:shadow-none disabled:opacity-1",
destructive:
"bg-red-500 border-red-500 text-white hover:bg-red-600 hover:border-red-600 rounded-full disabled:text-white disabled:bg-zinc-200 disabled:border-zinc-200 disabled:opacity-1",
outline:
- "bg-transparent border-zinc-700 text-black hover:bg-zinc-100 hover:border-zinc-700 rounded-full disabled:border-zinc-200 disabled:text-zinc-200 disabled:opacity-1",
+ "bg-transparent border-[#a6a6a6] text-black hover:bg-zinc-100 hover:border-[#a6a6a6] rounded-full disabled:border-zinc-200 disabled:text-zinc-200 disabled:opacity-1",
ghost:
"bg-transparent border-transparent text-black hover:bg-zinc-50 hover:border-zinc-50 rounded-full disabled:text-zinc-200 disabled:opacity-1",
- icon: "bg-transparent text-black border border-zinc-300 hover:bg-zinc-100 hover:border-zinc-600 rounded-[96px] disabled:opacity-1 !min-w-0",
+ icon: "bg-white text-zinc-800 border border-zinc-200 shadow-sm hover:bg-zinc-50 hover:border-zinc-300 rounded-[96px] disabled:shadow-none disabled:opacity-1 !min-w-0",
toggle:
"bg-transparent border-transparent text-zinc-500 hover:bg-transparent hover:border-transparent hover:text-zinc-800 aria-pressed:bg-zinc-100 aria-pressed:text-zinc-900 rounded-md disabled:opacity-50",
floating:
@@ -38,7 +38,7 @@ export const extendedButtonVariants = cva(
},
size: {
small: "px-3 py-2 text-sm gap-1.5 h-[2.25rem] min-w-[5.5rem]",
- large: "px-4 py-3 text-sm gap-2 h-[3.25rem]",
+ large: "px-4 py-2.5 text-sm gap-2 h-[2.875rem]",
icon: "p-3 !min-w-0",
xs: "h-7 min-w-0 gap-1.5 rounded-md px-2.5 text-xs",
"icon-xs": "size-7 min-w-0 rounded-md p-0",
@@ -49,13 +49,12 @@ export const extendedButtonVariants = cva(
{
variant: "outline",
size: ["xs", "icon-xs", "icon-sm"],
- class: "border-zinc-200 hover:border-zinc-300",
+ class: "border-[#a6a6a6] hover:border-[#a6a6a6]",
},
{
variant: "icon",
size: ["icon-xs", "icon-sm"],
- class:
- "border-zinc-200 text-zinc-600 hover:border-zinc-300 hover:bg-zinc-50",
+ class: "text-zinc-600",
},
],
defaultVariants: {
diff --git a/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker.tsx b/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker.tsx
index a3c334d829..c3322307ff 100644
--- a/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker.tsx
+++ b/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker.tsx
@@ -9,8 +9,7 @@ import { Button } from "@/components/atoms/Button/Button";
import { Input } from "@/components/atoms/Input/Input";
import { Text } from "@/components/atoms/Text/Text";
import { Dialog } from "@/components/molecules/Dialog/Dialog";
-import { Icon } from "@/components/atoms/Icon/Icon";
-import { WorkflowSquare01Icon } from "@hugeicons/core-free-icons";
+import { WorkflowTile } from "./components/WorkflowTile";
import { INSTALL_WORKFLOW_SOURCES, workflowSubtitle } from "./helpers";
import { useInstallWorkflowPicker } from "./useInstallWorkflowPicker";
@@ -100,7 +99,7 @@ export function InstallWorkflowPicker({
</div>
<Button
variant="secondary"
- size="xs"
+ size="small"
loading={pendingKey === expert.id}
onClick={() => installOnExpert(expert)}
>
@@ -163,7 +162,7 @@ export function InstallWorkflowPicker({
data-testid="install-workflow-option"
className="flex items-center gap-3 px-3.5 py-2.5 transition-colors hover:bg-zinc-50"
>
- <WorkflowTile />
+ <WorkflowTile imageUrl={agent.image_url} />
<div className="min-w-0 flex-1">
<Text variant="body-medium" className="truncate">
{agent.name}
@@ -177,7 +176,7 @@ export function InstallWorkflowPicker({
</div>
<Button
variant="secondary"
- size="xs"
+ size="small"
loading={pendingKey === agent.id}
onClick={() => installLibraryAgent(agent)}
>
@@ -191,7 +190,7 @@ export function InstallWorkflowPicker({
data-testid="install-workflow-option"
className="flex items-center gap-3 px-3.5 py-2.5 transition-colors hover:bg-zinc-50"
>
- <WorkflowTile />
+ <WorkflowTile imageUrl={agent.agent_image} />
<div className="min-w-0 flex-1">
<Text variant="body-medium" className="truncate">
{agent.agent_name}
@@ -202,7 +201,7 @@ export function InstallWorkflowPicker({
</div>
<Button
variant="secondary"
- size="xs"
+ size="small"
loading={pendingKey === agent.agent_graph_id}
onClick={() => installFromListing(agent)}
>
@@ -215,7 +214,7 @@ export function InstallWorkflowPicker({
{source === "library" && hasMoreLibraryResults ? (
<Button
variant="secondary"
- size="xs"
+ size="small"
loading={isLoadingMore}
onClick={() => loadMoreLibraryResults()}
>
@@ -228,14 +227,3 @@ export function InstallWorkflowPicker({
</Dialog>
);
}
-
-function WorkflowTile() {
- return (
- <span
- aria-hidden="true"
- className="flex size-9 shrink-0 items-center justify-center rounded-lg bg-zinc-100 text-zinc-600"
- >
- <Icon icon={WorkflowSquare01Icon} size={18} />
- </span>
- );
-}
diff --git a/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/components/WorkflowTile.tsx b/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/components/WorkflowTile.tsx
new file mode 100644
index 0000000000..9b4f413fb6
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/components/WorkflowTile.tsx
@@ -0,0 +1,34 @@
+"use client";
+
+import { isRenderableImageUrl } from "@/lib/next-image";
+import Image from "next/image";
+import { useState } from "react";
+
+interface Props {
+ imageUrl?: string | null;
+}
+
+/** The workflow's image, or a plain muted square when there is none, when
+ * next/image cannot load it, or when it fails to load: never a broken-image
+ * outline, never a stand-in glyph. */
+export function WorkflowTile({ imageUrl }: Props) {
+ const [hasError, setHasError] = useState(false);
+ if (!isRenderableImageUrl(imageUrl) || hasError) {
+ return (
+ <span
+ aria-hidden="true"
+ className="size-9 shrink-0 rounded-lg bg-zinc-100"
+ />
+ );
+ }
+ return (
+ <Image
+ src={imageUrl}
+ alt=""
+ width={36}
+ height={36}
+ onError={() => setHasError(true)}
+ className="size-9 shrink-0 rounded-lg bg-zinc-100 object-cover"
+ />
+ );
+}
diff --git a/autogpt_platform/frontend/src/lib/next-image.test.ts b/autogpt_platform/frontend/src/lib/next-image.test.ts
new file mode 100644
index 0000000000..2d38879edd
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/next-image.test.ts
@@ -0,0 +1,43 @@
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+import { describe, expect, test } from "vitest";
+import { isRenderableImageUrl } from "./next-image";
+
+/** The hostnames next.config.mjs allows, read from the config's source, so a
+ * host added there but not to the helper fails this test. */
+function configuredHosts(): string[] {
+ const source = readFileSync(join(process.cwd(), "next.config.mjs"), "utf8");
+ const domainsBlock = /domains:\s*\[([^\]]*)\]/.exec(source)?.[1] ?? "";
+ const domains = [...domainsBlock.matchAll(/"([^"]+)"/g)].map((m) => m[1]);
+ const patterns = [...source.matchAll(/hostname:\s*"([^"]+)"/g)].map(
+ (m) => m[1],
+ );
+ return Array.from(new Set([...domains, ...patterns]));
+}
+
+describe("isRenderableImageUrl", () => {
+ test("accepts every host next.config.mjs configures", () => {
+ const hosts = configuredHosts();
+ expect(hosts.length).toBeGreaterThan(0);
+ for (const host of hosts) {
+ expect(isRenderableImageUrl(`https://${host}/agent.png`)).toBe(true);
+ }
+ });
+
+ test("rejects a host next/image would throw on", () => {
+ expect(isRenderableImageUrl("https://evil.example.org/agent.png")).toBe(
+ false,
+ );
+ });
+
+ test("rejects nothing to render and anything unparseable", () => {
+ expect(isRenderableImageUrl(null)).toBe(false);
+ expect(isRenderableImageUrl(undefined)).toBe(false);
+ expect(isRenderableImageUrl("")).toBe(false);
+ expect(isRenderableImageUrl("not a url")).toBe(false);
+ });
+
+ test("accepts an app-relative path", () => {
+ expect(isRenderableImageUrl("/images/agent.png")).toBe(true);
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/next-image.ts b/autogpt_platform/frontend/src/lib/next-image.ts
new file mode 100644
index 0000000000..05ecef988d
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/next-image.ts
@@ -0,0 +1,29 @@
+/** The hosts `next.config.mjs` lets `next/image` load from.
+ *
+ * `next/image` throws while rendering — it never reaches `onError` — when
+ * `src` points at any other host, so a URL that arrives from user-submitted
+ * data has to be checked before it is handed to an `<Image>`.
+ * `next-image.test.ts` keeps this list in step with the config. */
+const ALLOWED_IMAGE_HOSTS = [
+ "ddz4ak4pa3d19.cloudfront.net",
+ "example.com",
+ "ideogram.ai",
+ "images.unsplash.com",
+ "lh3.googleusercontent.com",
+ "storage.cloud.google.com",
+ "storage.googleapis.com",
+ "upload.wikimedia.org",
+];
+
+/** Whether `next/image` can render this src instead of throwing on it. */
+export function isRenderableImageUrl(
+ url: string | null | undefined,
+): url is string {
+ if (!url) return false;
+ if (url.startsWith("/")) return true;
+ try {
+ return ALLOWED_IMAGE_HOSTS.includes(new URL(url).hostname);
+ } catch {
+ return false;
+ }
+}