Skip to content

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

refactor(platform): refine team and expert pages (#14343)

Abhimanyu Yadav7a655768636b
diff --git a/autogpt_platform/backend/backend/api/features/experts/credential_counts.py b/autogpt_platform/backend/backend/api/features/experts/credential_counts.py
new file mode 100644
index 0000000000..bd7cd60d02
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/experts/credential_counts.py
@@ -0,0 +1,31 @@
+import asyncio
+from collections import Counter
+
+import prisma.models
+
+from backend.api.features.experts.credentials import _seed_if_needed, _user_credentials
+
+
+async def count_expert_credentials(
+ user_id: str, experts: list[prisma.models.Expert]
+) -> dict[str, int]:
+ owned = [expert for expert in experts if expert.ownerUserId == user_id]
+ if not owned:
+ return {}
+ semaphore = asyncio.Semaphore(8)
+
+ async def seed(expert: prisma.models.Expert) -> None:
+ async with semaphore:
+ await _seed_if_needed(user_id, expert)
+
+ await asyncio.gather(*(seed(expert) for expert in owned))
+ grants, credentials = await asyncio.gather(
+ prisma.models.ExpertCredential.prisma().find_many(
+ where={"expertId": {"in": [expert.id for expert in owned]}}
+ ),
+ _user_credentials(user_id),
+ )
+ live_ids = {credential.id for credential in credentials}
+ return dict(
+ Counter(grant.expertId for grant in grants if grant.credentialId in live_ids)
+ )
diff --git a/autogpt_platform/backend/backend/api/features/experts/credential_counts_test.py b/autogpt_platform/backend/backend/api/features/experts/credential_counts_test.py
new file mode 100644
index 0000000000..3662651a27
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/experts/credential_counts_test.py
@@ -0,0 +1,99 @@
+from types import SimpleNamespace
+from unittest.mock import AsyncMock, patch
+
+import prisma.models
+import pytest
+
+from backend.api.features.experts import credential_counts, experts_db
+from backend.api.features.experts.models import Expert
+
+
+async def test_counts_live_credentials_in_one_owner_scoped_batch():
+ experts = [
+ prisma.models.Expert.model_construct(id="expert-1", ownerUserId="owner-1"),
+ prisma.models.Expert.model_construct(id="expert-2", ownerUserId="owner-1"),
+ prisma.models.Expert.model_construct(id="foreign", ownerUserId="owner-2"),
+ ]
+ grant_query = AsyncMock(
+ return_value=[
+ SimpleNamespace(expertId="expert-1", credentialId="live-1"),
+ SimpleNamespace(expertId="expert-1", credentialId="deleted"),
+ SimpleNamespace(expertId="expert-2", credentialId="live-1"),
+ SimpleNamespace(expertId="expert-2", credentialId="live-2"),
+ ]
+ )
+ with (
+ patch.object(credential_counts, "_seed_if_needed", new=AsyncMock()) as seed,
+ patch.object(
+ credential_counts,
+ "_user_credentials",
+ new=AsyncMock(
+ return_value=[
+ SimpleNamespace(id="live-1"),
+ SimpleNamespace(id="live-2"),
+ ]
+ ),
+ ) as credentials,
+ patch.object(
+ prisma.models.ExpertCredential,
+ "prisma",
+ return_value=SimpleNamespace(find_many=grant_query),
+ ),
+ ):
+ counts = await credential_counts.count_expert_credentials("owner-1", experts)
+
+ assert counts == {"expert-1": 1, "expert-2": 2}
+ assert seed.await_count == 2
+ for call in seed.await_args_list:
+ assert call.args[0] == "owner-1"
+ assert call.args[1].ownerUserId == "owner-1"
+ credentials.assert_awaited_once_with("owner-1")
+ grant_query.assert_awaited_once_with(
+ where={"expertId": {"in": ["expert-1", "expert-2"]}}
+ )
+
+
+async def test_empty_roster_skips_credential_reads():
+ with patch.object(
+ credential_counts, "_user_credentials", new=AsyncMock()
+ ) as credentials:
+ assert await credential_counts.count_expert_credentials("owner-1", []) == {}
+ credentials.assert_not_awaited()
+
+
[email protected]("with_metrics", [True, False])
[email protected]("count_error", [False, True])
+async def test_roster_includes_counts_only_when_metrics_are_requested(
+ with_metrics, count_error
+):
+ row = prisma.models.Expert.model_construct(id="expert-1", ownerUserId="owner-1")
+ client = SimpleNamespace(find_many=AsyncMock(return_value=[row]))
+ with (
+ patch.object(prisma.models.Expert, "prisma", return_value=client),
+ patch.object(experts_db, "_latest_runs", new=AsyncMock(return_value={})),
+ patch.object(experts_db, "_weekly_spends", new=AsyncMock(return_value={})),
+ patch.object(
+ experts_db, "_to_model", return_value=Expert.model_construct(id=row.id)
+ ),
+ patch.object(
+ experts_db,
+ "count_expert_credentials",
+ new=AsyncMock(
+ return_value={row.id: 2},
+ side_effect=(
+ RuntimeError("credentials unavailable") if count_error else None
+ ),
+ ),
+ ) as counts,
+ ):
+ roster = await experts_db.list_experts("owner-1", with_metrics=with_metrics)
+
+ assert client.find_many.await_args.kwargs["where"]["ownerUserId"] == "owner-1"
+ assert roster[0].credential_count == (2 if with_metrics and not count_error else 0)
+ if with_metrics:
+ counts.assert_awaited_once_with("owner-1", [row])
+ else:
+ counts.assert_not_awaited()
diff --git a/autogpt_platform/backend/backend/api/features/experts/errors.py b/autogpt_platform/backend/backend/api/features/experts/errors.py
index a305e291f9..5c665c484b 100644
--- a/autogpt_platform/backend/backend/api/features/experts/errors.py
+++ b/autogpt_platform/backend/backend/api/features/experts/errors.py
@@ -27,6 +27,7 @@ __all__ = [
"ExpertPodNameTakenError",
"ExpertPodNotFoundError",
"ExpertTemplateNotFoundError",
+ "ExpertScheduleCleanupError",
"RaisedExpertLifetimeLimitExceededError",
]
@@ -36,6 +37,10 @@ ACTIVE_EXPERT_LIMIT = 20
LIFETIME_RAISED_EXPERT_LIMIT = 100
+class ExpertScheduleCleanupError(RuntimeError):
+ pass
+
+
class ExpertPodNotFoundError(Exception):
def __init__(self, pod_id: str):
super().__init__(f"Pod {pod_id} not found")
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 2d197fbbab..6d71de089b 100644
--- a/autogpt_platform/backend/backend/api/features/experts/experts_db.py
+++ b/autogpt_platform/backend/backend/api/features/experts/experts_db.py
@@ -1,19 +1,22 @@
import asyncio
import logging
from collections import defaultdict
+from datetime import date, datetime, time, timedelta
from typing import Literal, cast
+from zoneinfo import ZoneInfo
import prisma.enums
import prisma.errors
import prisma.models
import prisma.types
from prisma.enums import ResourceVisibility
-from pydantic import JsonValue, ValidationError
+from pydantic import BaseModel, JsonValue, ValidationError
from backend.api.features.experts import raise_attachments, scheduling
# Re-exported so `db_accessors.experts_db()` resolves the same attribute name
# on both branches: the module here, and the RPC client stub in db_manager.
+from backend.api.features.experts.credential_counts import count_expert_credentials
from backend.api.features.experts.credentials import (
expert_allowed_credential_ids as expert_allowed_credential_ids,
)
@@ -31,6 +34,8 @@ from backend.api.features.experts.errors import (
from backend.api.features.experts.models import (
PROTECTED_SOUL_RULES,
Expert,
+ ExpertActivity,
+ ExpertActivityDay,
ExpertIdentity,
ExpertPod,
ExpertRun,
@@ -43,10 +48,16 @@ from backend.api.features.experts.models import (
RaiseResult,
decode_voice_preferences,
)
+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.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
+from backend.copilot.tools.skills import (
+ get_default_skill_with_body,
+ list_user_skills,
+ read_user_skill_with_body,
+)
from backend.data.db import prisma as db_client
from backend.data.db import query_raw_with_schema, transaction
from backend.data.expert_attribution import (
@@ -81,11 +92,21 @@ def _raised_identity(name: str) -> str:
_WORKFLOW_ROW_INCLUDE: prisma.types.ExpertWorkflowInclude = {
# AgentGraph carries the name/description of a user-created library agent;
# LibraryAgent.name is only populated from a marketplace snapshot.
- "LibraryAgent": {"include": {"AgentGraph": True}},
+ "LibraryAgent": {"include": {"AgentGraph": {"include": {"Nodes": True}}}},
"StoreListingVersion": True,
}
_WORKFLOW_INCLUDE = {"Workflows": {"include": _WORKFLOW_ROW_INCLUDE}}
+_ROSTER_WORKFLOW_INCLUDE: prisma.types.ExpertInclude = {
+ "Workflows": {
+ "include": {
+ "LibraryAgent": {"include": {"AgentGraph": True}},
+ "StoreListingVersion": True,
+ }
+ }
+}
_MAX_EXPERT_RUNS = 20
+# One year: the window the at-a-glance activity graph draws.
+EXPERT_ACTIVITY_DAYS = 365
FirstJobUnavailableError = raise_attachments.RaiseAttachmentUnavailableError
@@ -111,6 +132,11 @@ def _to_workflow_ref(row: prisma.models.ExpertWorkflow) -> ExpertWorkflowRef:
description=description,
schedule_cron=row.scheduleCron,
schedule_id=row.scheduleId,
+ chain=build_workflow_chain(
+ library_agent.AgentGraph.Nodes or []
+ if library_agent and library_agent.AgentGraph
+ else []
+ ),
)
@@ -245,14 +271,21 @@ async def list_experts(user_id: str, *, with_metrics: bool = True) -> list[Exper
"isArchived": False,
"visibility": ResourceVisibility.PRIVATE,
},
- include=_WORKFLOW_INCLUDE,
+ include=_ROSTER_WORKFLOW_INCLUDE,
)
if not with_metrics:
return [_to_model(row) for row in rows]
latest_runs = await _latest_runs([row.id for row in rows])
weekly_spends = await _weekly_spends([row.id for row in rows])
+ try:
+ credential_counts = await count_expert_credentials(user_id, rows)
+ except Exception:
+ logger.exception("Failed to read credential counts for expert roster")
+ credential_counts = {}
return [
- _to_model(row, latest_runs.get(row.id), weekly_spends.get(row.id, 0))
+ _to_model(
+ row, latest_runs.get(row.id), weekly_spends.get(row.id, 0)
+ ).model_copy(update={"credential_count": credential_counts.get(row.id, 0)})
for row in rows
]
@@ -400,6 +433,84 @@ async def list_expert_runs(
]
+class _DayCount(BaseModel):
+ day: date
+ count: int
+
+
+_ACTIVITY_TABLES: dict[str, str] = {
+ "ChatSession": "",
+ "AgentGraphExecution": 'AND "isDeleted" = false',
+}
+
+
+async def _count_expert_rows_by_day(
+ table: Literal["ChatSession", "AgentGraphExecution"],
+ user_id: str,
+ expert_id: str,
+ since: datetime,
+ tz_name: str,
+) -> dict[date, int]:
+ """Rows of *table* stamped with this expert, bucketed by the owner's
+ calendar day. ``createdAt`` is a UTC wall-clock ``timestamp``, so it is
+ re-tagged as UTC before shifting into the owner's zone."""
+ rows = await query_raw_with_schema(
+ f"""
+ SELECT (("createdAt" AT TIME ZONE 'UTC') AT TIME ZONE $3::text)::date AS day,
+ COUNT(*)::int AS count
+ FROM {{schema_prefix}}"{table}"
+ WHERE "userId" = $1
+ AND "expertId" = $2
+ AND "createdAt" >= ($4::timestamptz AT TIME ZONE 'UTC')
+ {_ACTIVITY_TABLES[table]}
+ GROUP BY day
+ """,
+ user_id,
+ expert_id,
+ tz_name,
+ since,
+ model=_DayCount,
+ )
+ return {row.day: row.count for row in rows}
+
+
+async def get_expert_activity(user_id: str, expert_id: str) -> ExpertActivity:
+ """Per-day chat sessions and runs for the last :data:`EXPERT_ACTIVITY_DAYS`,
+ on the owner's calendar so "today" matches what they see.
+
+ Raises :class:`ExpertNotFoundError` when the expert isn't a live hire of
+ this user.
+ """
+ if not await owns_active_expert(user_id, expert_id):
+ raise ExpertNotFoundError(expert_id)
+
+ user = await get_user_by_id(user_id)
+ tz_name = get_user_timezone_or_utc(user.timezone if user else None)
+ tz = ZoneInfo(tz_name)
+ today = datetime.now(tz).date()
+ first_day = today - timedelta(days=EXPERT_ACTIVITY_DAYS - 1)
+ since = datetime.combine(first_day, time.min, tzinfo=tz)
+
+ sessions, runs = await asyncio.gather(
+ _count_expert_rows_by_day("ChatSession", user_id, expert_id, since, tz_name),
+ _count_expert_rows_by_day(
+ "AgentGraphExecution", user_id, expert_id, since, tz_name
+ ),
+ )
+ days = [
+ first_day + timedelta(days=offset) for offset in range(EXPERT_ACTIVITY_DAYS)
+ ]
+ return ExpertActivity(
+ timezone=tz_name,
+ days=[
+ ExpertActivityDay(
+ day=day, sessions=sessions.get(day, 0), runs=runs.get(day, 0)
+ )
+ for day in days
+ ],
+ )
+
+
async def _classify_run_outputs(
execution_ids: list[str],
) -> dict[str, tuple[OutputType, str | None]]:
@@ -846,6 +957,78 @@ async def _install_first_job(
)
+async def update_skills(
+ user_id: str,
+ expert_id: str,
+ skills: list[str],
+ marketplace_listing_ids: list[str] | None = None,
+) -> Expert:
+ """Replace an expert's skill list. Names the expert does not already
+ carry must resolve to a library skill; the stored name is the skill's
+ canonical one so display and lookup agree."""
+ row = await prisma.models.Expert.prisma().find_first(
+ where={
+ "id": expert_id,
+ "ownerUserId": user_id,
+ "isTemplate": False,
+ "isArchived": False,
+ "visibility": ResourceVisibility.PRIVATE,
+ }
+ )
+ if row is None:
+ raise ExpertNotFoundError(expert_id)
+
+ current = {name.lower(): name for name in row.skills or []}
+ resolved = [
+ current.get(name.lower()) or await _resolve_library_skill_name(user_id, name)
+ for name in skills
+ ]
+ for listing_id in marketplace_listing_ids or []:
+ name = await _resolve_marketplace_skill_name(listing_id)
+ if name.lower() not in {r.lower() for r in resolved}:
+ resolved.append(name)
+ await prisma.models.Expert.prisma().update(
+ where={"id": row.id}, data={"skills": resolved}
+ )
+ expert = await get_expert(user_id, expert_id)
+ if expert is None:
+ raise ExpertNotFoundError(expert_id)
+ return expert
+
+
+async def _resolve_marketplace_skill_name(store_listing_version_id: str) -> str:
+ if not await library_db.is_store_listing_version_available_for_install(
+ store_listing_version_id
+ ):
+ raise NotFoundError(f"Marketplace skill #{store_listing_version_id} not found")
+ listing = await prisma.models.StoreListingVersion.prisma().find_unique(
+ where={"id": store_listing_version_id}
+ )
+ if listing is None:
+ raise NotFoundError(f"Marketplace skill #{store_listing_version_id} not found")
+ return listing.name
+
+
+async def _resolve_library_skill_name(user_id: str, name: str) -> str:
+ slug = name.strip().lower()
+ default = get_default_skill_with_body(slug)
+ if default is not None:
+ return default.name
+ stored = await read_user_skill_with_body(user_id, slug)
+ if stored is not None:
+ return stored.name
+ # A skill whose frontmatter name differs from its folder slug (anything
+ # not written through store_user_skill) is listed by the library UI under
+ # the frontmatter name, so match on that too before giving up.
+ listed = next(
+ (s for s in await list_user_skills(user_id) if s.name.strip().lower() == slug),
+ None,
+ )
+ if listed is None:
+ raise NotFoundError(f"Skill '{name}' is not in your library")
+ return listed.name
+
+
async def update_soul(user_id: str, expert_id: str, soul: ExpertSoulUpdate) -> Expert:
updated = await prisma.models.Expert.prisma().update_many(
where={
@@ -871,6 +1054,26 @@ async def update_soul(user_id: str, expert_id: str, soul: ExpertSoulUpdate) -> E
return expert
+async def update_avatar(user_id: str, expert_id: str, avatar_url: str | None) -> Expert:
+ updated = await prisma.models.Expert.prisma().update_many(
+ where={
+ "id": expert_id,
+ "ownerUserId": user_id,
+ "isTemplate": False,
+ "isArchived": False,
+ "visibility": ResourceVisibility.PRIVATE,
+ },
+ data={"avatarUrl": avatar_url},
+ )
+ if updated == 0:
+ raise ExpertNotFoundError(expert_id)
+
+ expert = await get_expert(user_id, expert_id)
+ if expert is None:
+ raise ExpertNotFoundError(expert_id)
+ return expert
+
+
async def update_soul_if_current(
user_id: str,
expert_id: str,
@@ -1184,6 +1387,33 @@ async def _install_marketplace_workflow(
return _to_workflow_ref(row)
+async def remove_workflow(user_id: str, expert_id: str, workflow_id: str) -> None:
+ """Detach a workflow from a hired expert, dropping its install-time
+ schedule. The library agent itself is left alone — it is still the
+ user's, and another expert may share it."""
+ expert = await prisma.models.Expert.prisma().find_first(
+ where={
+ "id": expert_id,
+ "ownerUserId": user_id,
+ "isTemplate": False,
+ "isArchived": False,
+ "visibility": ResourceVisibility.PRIVATE,
+ }
+ )
+ if expert is None:
+ raise ExpertNotFoundError(expert_id)
+
+ row = await prisma.models.ExpertWorkflow.prisma().find_first(
+ where={"id": workflow_id, "expertId": expert_id}
+ )
+ if row is None:
+ raise NotFoundError(f"Workflow #{workflow_id} not found on expert")
+
+ if row.scheduleId:
+ await scheduling.delete_workflow_schedule(row.scheduleId, user_id, expert_id)
+ await prisma.models.ExpertWorkflow.prisma().delete(where={"id": row.id})
+
+
async def resolve_expert_for_graph(user_id: str, graph_id: str) -> str | None:
"""Expert attribution for a manually scheduled graph.
diff --git a/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py b/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py
index 0adf08ad7b..7e24605035 100644
--- a/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py
+++ b/autogpt_platform/backend/backend/api/features/experts/experts_db_test.py
@@ -7,6 +7,7 @@ from pathlib import Path
from test import load_store_agents as store_assets
from types import SimpleNamespace
from unittest.mock import AsyncMock, patch
+from zoneinfo import ZoneInfo
import prisma.enums
import prisma.errors
@@ -1687,6 +1688,62 @@ async def test_owner_can_update_expert_soul(server: SpinTestServer, test_user):
assert updated.boundaries == "Never invent customer evidence."
[email protected](loop_scope="session")
+async def test_update_skills_attaches_library_skills_and_keeps_existing(
+ server: SpinTestServer, test_user
+):
+ from backend.copilot.tools.skills import DEFAULT_SKILLS
+
+ default_slug = DEFAULT_SKILLS[0].name
+ template = await _seed_template(name="Maria", preload_listings=[])
+ hired = await experts_db.hire_expert(test_user.id, template.id, None)
+ await prisma.models.Expert.prisma().update(
+ where={"id": hired.expert.id}, data={"skills": ["Marketplace Skill"]}
+ )
+
+ updated = await experts_db.update_skills(
+ test_user.id, hired.expert.id, ["marketplace skill", default_slug.upper()]
+ )
+
+ assert updated.skills[0] == "Marketplace Skill"
+ assert updated.skills[1].lower() == default_slug.lower()
+
+ with pytest.raises(NotFoundError):
+ await experts_db.update_skills(
+ test_user.id, hired.expert.id, ["not-a-skill-anyone-has"]
+ )
+
+
[email protected](loop_scope="session")
+async def test_update_skills_resolves_a_library_skill_by_its_listed_name(
+ server: SpinTestServer, test_user, monkeypatch
+):
+ from backend.copilot.tools.skills import ParsedSkill
+
+ listed = ParsedSkill(name="Deep Research", description="Research anything", body="")
+ monkeypatch.setattr(experts_db, "read_user_skill_with_body", _none_skill)
+ monkeypatch.setattr(experts_db, "list_user_skills", _listing_skills([listed]))
+ template = await _seed_template(name="Maria", preload_listings=[])
+ hired = await experts_db.hire_expert(test_user.id, template.id, None)
+
+ updated = await experts_db.update_skills(
+ test_user.id, hired.expert.id, ["deep research"]
+ )
+
+ assert updated.skills == ["Deep Research"]
+
+
+async def _none_skill(*_args, **_kwargs):
+ return None
+
+
+def _listing_skills(skills):
+ async def _list(*_args, **_kwargs):
+ return skills
+
+ return _list
+
+
@pytest.mark.asyncio(loop_scope="session")
async def test_other_user_cannot_update_expert_soul(
server: SpinTestServer, test_user, other_user
@@ -1886,6 +1943,37 @@ async def test_seed_roster_exposes_two_voice_samples_per_template(
assert template.voice_preferences == entry["voice_preferences"]
[email protected](loop_scope="session")
+async def test_remove_workflow_detaches_it_from_the_expert(
+ server: SpinTestServer, test_user
+):
+ library_agent_id, _ = await _seed_own_library_agent(server, test_user.id)
+ template = await _seed_template(name="Maria", preload_listings=[])
+ hired = await experts_db.hire_expert(test_user.id, template.id, None)
+ installed = await experts_db.install_workflow(
+ test_user.id, hired.expert.id, library_agent_id=library_agent_id
+ )
+
+ await experts_db.remove_workflow(test_user.id, hired.expert.id, installed.id)
+
+ expert = await experts_db.get_expert(test_user.id, hired.expert.id)
+ assert expert is not None
+ assert [w.id for w in expert.workflows] == []
+ library_agent = await prisma.models.LibraryAgent.prisma().find_unique(
+ where={"id": library_agent_id}
+ )
+ assert library_agent is not None and not library_agent.isDeleted
+
+
[email protected](loop_scope="session")
+async def test_remove_workflow_unknown_id_raises(server: SpinTestServer, test_user):
+ template = await _seed_template(name="Maria", preload_listings=[])
+ hired = await experts_db.hire_expert(test_user.id, template.id, None)
+
+ with pytest.raises(NotFoundError):
+ await experts_db.remove_workflow(test_user.id, hired.expert.id, "missing")
+
+
@pytest.mark.asyncio(loop_scope="session")
async def test_install_workflow_duplicate_returns_existing(
server: SpinTestServer, test_user
@@ -3581,6 +3669,94 @@ async def test_list_expert_runs_scopes_queries_and_matches_pending_review():
assert [run.needs_review for run in runs] == [False, True]
+async def test_get_expert_activity_zero_fills_the_window_on_the_owners_calendar():
+ tz = "Pacific/Auckland"
+ instant = datetime(2026, 1, 1, 11, 30, tzinfo=timezone.utc)
+ today = instant.astimezone(ZoneInfo(tz)).date()
+ yesterday = today - timedelta(days=1)
+ seen: list[tuple] = []
+
+ async def fake_query(sql: str, *args, model):
+ seen.append((sql, args))
+ if '"ChatSession"' in sql:
+ return [model(day=today, count=2), model(day=yesterday, count=1)]
+ return [model(day=today, count=3)]
+
+ with (
+ patch.object(
+ experts_db, "owns_active_expert", new=AsyncMock(return_value=True)
+ ),
+ patch.object(
+ experts_db,
+ "get_user_by_id",
+ new=AsyncMock(return_value=SimpleNamespace(timezone=tz)),
+ ),
+ patch.object(experts_db, "query_raw_with_schema", new=fake_query),
+ patch.object(experts_db, "datetime", wraps=datetime) as clock,
+ ):
+ clock.now.return_value = instant.astimezone(ZoneInfo(tz))
+ activity = await experts_db.get_expert_activity("owner-1", "expert-1")
+
+ assert activity.timezone == tz
+ assert len(activity.days) == 365
+ assert activity.days[-1].day == today
+ assert activity.days[0].day == today - timedelta(
+ days=experts_db.EXPERT_ACTIVITY_DAYS - 1
+ )
+ assert [d.day for d in activity.days] == sorted(d.day for d in activity.days)
+ assert (activity.days[-1].sessions, activity.days[-1].runs) == (2, 3)
+ assert (activity.days[-2].sessions, activity.days[-2].runs) == (1, 0)
+ assert all(d.sessions == 0 and d.runs == 0 for d in activity.days[:-2])
+
+ assert {'"ChatSession"' in sql for sql, _ in seen} == {True, False}
+ for sql, args in seen:
+ assert args[:3] == ("owner-1", "expert-1", tz)
+ assert args[3] == datetime.combine(
+ activity.days[0].day, datetime.min.time(), tzinfo=ZoneInfo(tz)
+ )
+ assert ('"isDeleted" = false' in sql) == ('"AgentGraphExecution"' in sql)
+
+
+async def test_get_expert_activity_rejects_missing_or_foreign_expert():
+ with (
+ patch.object(
+ experts_db, "owns_active_expert", new=AsyncMock(return_value=False)
+ ),
+ patch.object(experts_db, "query_raw_with_schema", new=AsyncMock()) as query,
+ pytest.raises(experts_db.ExpertNotFoundError),
+ ):
+ await experts_db.get_expert_activity("owner-1", "foreign-expert")
+
+ query.assert_not_awaited()
+
+
[email protected](loop_scope="session")
+async def test_get_expert_activity_counts_sessions_by_day(server: SpinTestServer):
+ owner = await _create_seed_user()
+ raised = await experts_db.create_raised_expert(
+ owner.id, name="Otto", role=None, voice_preferences=None
+ )
+ for _ in range(2):
+ await create_chat_session(owner.id, dry_run=False, expert_id=raised.expert.id)
+ await create_chat_session(owner.id, dry_run=False)
+
+ instant = datetime(2026, 1, 1, 23, 59, tzinfo=timezone.utc)
+ await prisma.models.ChatSession.prisma().update_many(
+ where={"userId": owner.id}, data={"createdAt": instant}
+ )
+ with patch.object(experts_db, "datetime", wraps=datetime) as clock:
+ clock.now.return_value = instant
+ activity = await experts_db.get_expert_activity(owner.id, raised.expert.id)
+
+ assert activity.timezone == "UTC"
+ assert activity.days[-1].day == instant.date()
+ assert activity.days[-1].sessions == 2
+ assert sum(d.sessions for d in activity.days) == 2
+ assert sum(d.runs for d in activity.days) == 0
+
+
@pytest.mark.asyncio
async def test_list_expert_runs_rejects_missing_or_foreign_expert():
expert_client = SimpleNamespace(find_first=AsyncMock(return_value=None))
diff --git a/autogpt_platform/backend/backend/api/features/experts/models.py b/autogpt_platform/backend/backend/api/features/experts/models.py
index 1d41061389..04d985beb7 100644
--- a/autogpt_platform/backend/backend/api/features/experts/models.py
+++ b/autogpt_platform/backend/backend/api/features/experts/models.py
@@ -1,5 +1,5 @@
import json
-from datetime import datetime
+from datetime import date, datetime
from typing import Literal
from urllib.parse import urlparse
@@ -85,6 +85,19 @@ class VoiceSample(BaseModel):
text: str
+ExpertWorkflowChainKind = Literal[
+ "integration", "input", "output", "trigger", "agent", "ai", "mcp", "human"
+]
+
+
+class ExpertWorkflowChainItem(BaseModel):
+ """One step in the workflow card's summary chain: a provider logo for
+ integration blocks, or a kind the frontend maps to an icon."""
+
+ kind: ExpertWorkflowChainKind
+ provider: str | None = None
+
+
class ExpertWorkflowRef(BaseModel):
id: str
store_listing_version_id: str | None
@@ -97,6 +110,8 @@ class ExpertWorkflowRef(BaseModel):
# created yet (e.g. missing credentials) — the workflow needs setup.
schedule_cron: str | None = None
schedule_id: str | None = None
+ # Up to three of the graph's most-used blocks, integrations first.
+ chain: list[ExpertWorkflowChainItem] = Field(default_factory=list)
class ExpertIdentity(BaseModel):
@@ -142,6 +157,7 @@ class Expert(BaseModel):
source_template_id: str | None
is_archived: bool
workflows: list[ExpertWorkflowRef]
+ credential_count: int = 0
# Latest expert-attributed execution, for the /team card's status line.
last_run_at: datetime | None = None
last_run_status: str | None = None
@@ -182,6 +198,24 @@ class ExpertRun(BaseModel):
link: str | None
+class ExpertActivityDay(BaseModel):
+ """One calendar day, in the owner's timezone, of expert activity."""
+
+ day: date
+ sessions: int
+ runs: int
+
+
+class ExpertActivity(BaseModel):
+ """Daily chat-session and run counts behind the at-a-glance activity graph.
+
+ ``days`` is zero-filled, oldest first, and ends on the owner's today.
+ """
+
+ timezone: str
+ days: list[ExpertActivityDay]
+
+
class ExpertDetachPreview(BaseModel):
"""What archiving the expert would pause — drives the confirm dialog."""
@@ -247,6 +281,36 @@ class RaiseResult(BaseModel):
failed_attachments: list[RaiseAttachmentFailure] = []
+class ExpertSkillsUpdate(BaseModel):
+ """The full list of skill names an expert should carry. Names new to the
+ expert must be library skills (default or uploaded); names already on
+ the expert are kept as-is so marketplace skills survive a round-trip."""
+
+ skills: list[str] = Field(max_length=50)
+ # Store listing versions to attach as marketplace skills; each resolves
+ # to the listing's public name, the same way the raise flow records them.
+ marketplace_listing_ids: list[str] = Field(default_factory=list, max_length=20)
+
+ @field_validator("skills", mode="before")
+ @classmethod
+ def strip_and_dedupe(cls, value: object) -> object:
+ if not isinstance(value, list):
+ return value
+ seen: set[str] = set()
+ cleaned: list[str] = []
+ for item in value:
+ if not isinstance(item, str):
+ return value
+ name = item.strip()
+ if not name or len(name) > 100:
+ raise ValueError("Skill names must be 1-100 characters")
+ if name.lower() in seen:
+ continue
+ seen.add(name.lower())
+ cleaned.append(name)
+ return cleaned
+
+
class ExpertSoulUpdate(BaseModel):
name: str = Field(min_length=1, max_length=EXPERT_NAME_MAX_LENGTH)
identity: str = Field(min_length=1, max_length=EXPERT_IDENTITY_MAX_LENGTH)
@@ -264,6 +328,19 @@ class ExpertSoulUpdate(BaseModel):
return _strip_optional_soul_field(value)
+class ExpertAvatarUpdate(BaseModel):
+ """Swap an expert's picture. ``None`` clears it back to the generated marble."""
+
+ avatar_url: str | None = Field(
+ default=None, max_length=EXPERT_AVATAR_URL_MAX_LENGTH
+ )
+
+ @field_validator("avatar_url")
+ @classmethod
+ def check_avatar_url(cls, value: str | None) -> str | None:
+ return validate_avatar_url(value)
+
+
class ExpertSoulFieldsPatch(BaseModel):
"""Partial Soul edit: only supplied fields are validated and written.
diff --git a/autogpt_platform/backend/backend/api/features/experts/routes.py b/autogpt_platform/backend/backend/api/features/experts/routes.py
index a9d8d15aeb..98f11e1cf8 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.errors import ExpertScheduleCleanupError
from backend.api.features.experts.models import (
EXPERT_AVATAR_URL_MAX_LENGTH,
EXPERT_COLOR_MAX_LENGTH,
@@ -12,11 +13,14 @@ from backend.api.features.experts.models import (
MAX_RAISE_ATTACHMENTS,
WEEKLY_BUDGET_MAX_CREDITS,
Expert,
+ ExpertActivity,
+ ExpertAvatarUpdate,
ExpertCredentialRef,
ExpertDetachPreview,
ExpertIdentity,
ExpertPod,
ExpertRun,
+ ExpertSkillsUpdate,
ExpertSoulUpdate,
ExpertWorkflowRef,
HireResult,
@@ -304,6 +308,22 @@ async def list_expert_runs(
raise fastapi.HTTPException(status_code=404, detail=str(e))
+ "/{expert_id}/activity",
+ operation_id="get_expert_activity",
+ responses={404: {"description": "Expert not found"}},
+)
+async def get_expert_activity(
+ expert_id: str,
+ user_id: str = Security(autogpt_auth_lib.get_user_id),
+) -> ExpertActivity:
+ """Daily chat-session and run counts for the expert's activity graph."""
+ try:
+ return await experts_db.get_expert_activity(user_id, expert_id)
+ except experts_db.ExpertNotFoundError as e:
+ raise fastapi.HTTPException(status_code=404, detail=str(e))
+
+
class GrantCredentialsRequest(BaseModel):
credential_ids: list[str] = Field(min_length=1, max_length=50)
@@ -381,6 +401,43 @@ async def update_expert_soul(
raise fastapi.HTTPException(status_code=404, detail=str(e))
+ "/{expert_id}/skills",
+ operation_id="update_expert_skills",
+ responses={404: {"description": "Expert or skill not found"}},
+)
+async def update_expert_skills(
+ expert_id: str,
+ request: ExpertSkillsUpdate,
+ user_id: str = Security(autogpt_auth_lib.get_user_id),
+) -> Expert:
+ try:
+ return await experts_db.update_skills(
+ user_id,
+ expert_id,
+ request.skills,
+ marketplace_listing_ids=request.marketplace_listing_ids,
+ )
+ except NotFoundError as e:
+ raise fastapi.HTTPException(status_code=404, detail=str(e))
+
+
+ "/{expert_id}/avatar",
+ operation_id="update_expert_avatar",
+ responses={404: {"description": "Expert not found"}},
+)
+async def update_expert_avatar(
+ expert_id: str,
+ request: ExpertAvatarUpdate,
+ user_id: str = Security(autogpt_auth_lib.get_user_id),
+) -> Expert:
+ try:
+ return await experts_db.update_avatar(user_id, expert_id, request.avatar_url)
+ except experts_db.ExpertNotFoundError as e:
+ raise fastapi.HTTPException(status_code=404, detail=str(e))
+
+
@router.post(
"/{expert_id}/workflows",
operation_id="install_expert_workflow",
@@ -402,6 +459,31 @@ async def install_expert_workflow(
raise fastapi.HTTPException(status_code=404, detail=str(e))
+ "/{expert_id}/workflows/{workflow_id}",
+ operation_id="remove_expert_workflow",
+ status_code=204,
+ responses={
+ 404: {"description": "Expert or workflow not found"},
+ 503: {"description": "Workflow schedule cleanup temporarily unavailable"},
+ },
+)
+async def remove_expert_workflow(
+ expert_id: str,
+ workflow_id: str,
+ user_id: str = Security(autogpt_auth_lib.get_user_id),
+) -> None:
+ try:
+ await experts_db.remove_workflow(user_id, expert_id, workflow_id)
+ except NotFoundError as e:
+ raise fastapi.HTTPException(status_code=404, detail=str(e))
+ except ExpertScheduleCleanupError as e:
+ raise fastapi.HTTPException(
+ status_code=503,
+ detail="Could not remove the workflow schedule. Please try again.",
+ ) from e
+
+
@router.get(
"/{expert_id}/detach-preview",
operation_id="get_expert_detach_preview",
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 43013c2e94..7263411722 100644
--- a/autogpt_platform/backend/backend/api/features/experts/routes_test.py
+++ b/autogpt_platform/backend/backend/api/features/experts/routes_test.py
@@ -6,6 +6,7 @@ with AsyncMock at the route module's import site.
"""
import json
+from datetime import date
from unittest.mock import AsyncMock
import fastapi
@@ -17,9 +18,12 @@ from autogpt_libs.auth.jwt_utils import get_jwt_payload
from pytest_snapshot.plugin import Snapshot
from backend.api.features.experts import experts_db
+from backend.api.features.experts.errors import ExpertScheduleCleanupError
from backend.api.features.experts.models import (
PROTECTED_SOUL_RULES,
Expert,
+ ExpertActivity,
+ ExpertActivityDay,
ExpertIdentity,
ExpertPod,
ExpertRun,
@@ -802,6 +806,52 @@ def test_list_expert_runs_unknown_expert_returns_404(
assert response.status_code == 404
+def test_get_expert_activity_forwards_authenticated_user_and_serializes(
+ mocker: pytest_mock.MockerFixture,
+ test_user_id: str,
+ configured_snapshot: Snapshot,
+) -> None:
+ activity = ExpertActivity(
+ timezone="Europe/Madrid",
+ days=[
+ ExpertActivityDay(day=date(2026, 9, 2), sessions=0, runs=0),
+ ExpertActivityDay(day=date(2026, 9, 3), sessions=2, runs=1),
+ ],
+ )
+ mock_get = mocker.patch(
+ "backend.api.features.experts.routes.experts_db.get_expert_activity",
+ new_callable=AsyncMock,
+ return_value=activity,
+ )
+
+ response = client.get("/experts/expert-1/activity")
+
+ assert response.status_code == 200
+ data = response.json()
+ assert data["timezone"] == "Europe/Madrid"
+ assert [d["day"] for d in data["days"]] == ["2026-09-02", "2026-09-03"]
+ assert data["days"][1] == {"day": "2026-09-03", "sessions": 2, "runs": 1}
+ mock_get.assert_awaited_once_with(test_user_id, "expert-1")
+
+ configured_snapshot.assert_match(
+ f"{json.dumps(data, indent=2, sort_keys=True)}\n", "expert_activity"
+ )
+
+
+def test_get_expert_activity_unknown_expert_returns_404(
+ mocker: pytest_mock.MockerFixture,
+) -> None:
+ mocker.patch(
+ "backend.api.features.experts.routes.experts_db.get_expert_activity",
+ new_callable=AsyncMock,
+ side_effect=experts_db.ExpertNotFoundError("nope"),
+ )
+
+ response = client.get("/experts/nope/activity")
+
+ assert response.status_code == 404
+
+
# ─── Soul ──────────────────────────────────────────────────────────────
@@ -841,6 +891,43 @@ def test_update_expert_soul_returns_updated_expert(
)
+def test_update_expert_skills_replaces_the_list(
+ mocker: pytest_mock.MockerFixture,
+ test_user_id: str,
+) -> None:
+ updated = _make_expert(name="Maria", skills=["Deep Research", "SEO"])
+ mock_update = mocker.patch(
+ "backend.api.features.experts.routes.experts_db.update_skills",
+ new_callable=AsyncMock,
+ return_value=updated,
+ )
+
+ response = client.put(
+ "/experts/expert-1/skills",
+ json={"skills": [" Deep Research ", "SEO", "seo"]},
+ )
+
+ assert response.status_code == 200
+ assert response.json()["skills"] == ["Deep Research", "SEO"]
+ mock_update.assert_awaited_once_with(
+ test_user_id, "expert-1", ["Deep Research", "SEO"], marketplace_listing_ids=[]
+ )
+
+
+def test_update_expert_skills_unknown_skill_returns_404(
+ mocker: pytest_mock.MockerFixture,
+) -> None:
+ mocker.patch(
+ "backend.api.features.experts.routes.experts_db.update_skills",
+ new_callable=AsyncMock,
+ side_effect=NotFoundError("Skill 'Nope' is not in your library"),
+ )
+
+ response = client.put("/experts/expert-1/skills", json={"skills": ["Nope"]})
+
+ assert response.status_code == 404
+
+
def test_update_expert_soul_not_found_returns_404(
mocker: pytest_mock.MockerFixture,
) -> None:
@@ -864,6 +951,63 @@ def test_update_expert_soul_not_found_returns_404(
mock_update.assert_awaited_once()
+# ─── Avatar ────────────────────────────────────────────────────────────
+
+
+def test_update_expert_avatar_returns_updated_expert(
+ mocker: pytest_mock.MockerFixture,
+ test_user_id: str,
+) -> None:
+ updated = _make_expert(avatar_url="https://cdn.example.com/mara.png")
+ mock_update = mocker.patch(
+ "backend.api.features.experts.routes.experts_db.update_avatar",
+ new_callable=AsyncMock,
+ return_value=updated,
+ )
+
+ response = client.patch(
+ "/experts/expert-1/avatar",
+ json={"avatar_url": "https://cdn.example.com/mara.png"},
+ )
+
+ assert response.status_code == 200
+ assert response.json()["avatar_url"] == "https://cdn.example.com/mara.png"
+ mock_update.assert_awaited_once_with(
+ test_user_id, "expert-1", "https://cdn.example.com/mara.png"
+ )
+
+
+def test_update_expert_avatar_rejects_unsafe_url(
+ mocker: pytest_mock.MockerFixture,
+) -> None:
+ mock_update = mocker.patch(
+ "backend.api.features.experts.routes.experts_db.update_avatar",
+ new_callable=AsyncMock,
+ )
+
+ response = client.patch(
+ "/experts/expert-1/avatar",
+ json={"avatar_url": "javascript:alert(1)"},
+ )
+
+ assert response.status_code == 422
+ mock_update.assert_not_awaited()
+
+
+def test_update_expert_avatar_not_found_returns_404(
+ mocker: pytest_mock.MockerFixture,
+) -> None:
+ mocker.patch(
+ "backend.api.features.experts.routes.experts_db.update_avatar",
+ new_callable=AsyncMock,
+ side_effect=experts_db.ExpertNotFoundError("expert-1"),
+ )
+
+ response = client.patch("/experts/expert-1/avatar", json={"avatar_url": None})
+
+ assert response.status_code == 404
+
+
def test_update_expert_soul_validates_field_lengths() -> None:
response = client.patch(
"/experts/expert-1/soul",
@@ -957,6 +1101,55 @@ def test_install_workflow_duplicate_returns_same_row_id(
assert mock_install.await_args_list == [expected, expected]
+def test_remove_workflow_returns_204(
+ mocker: pytest_mock.MockerFixture,
+ test_user_id: str,
+) -> None:
+ mock_remove = mocker.patch(
+ "backend.api.features.experts.routes.experts_db.remove_workflow",
+ new_callable=AsyncMock,
+ return_value=None,
+ )
+
+ response = client.delete("/experts/expert-1/workflows/workflow-ref-1")
+
+ assert response.status_code == 204
+ mock_remove.assert_awaited_once_with(test_user_id, "expert-1", "workflow-ref-1")
+
+
+def test_remove_workflow_unknown_returns_404(
+ mocker: pytest_mock.MockerFixture,
+) -> None:
+ mocker.patch(
+ "backend.api.features.experts.routes.experts_db.remove_workflow",
+ new_callable=AsyncMock,
+ side_effect=NotFoundError("Workflow #missing not found on expert"),
+ )
+
+ response = client.delete("/experts/expert-1/workflows/missing")
+
+ assert response.status_code == 404
+
+
+def test_remove_workflow_cleanup_failure_returns_retryable_503(
+ mocker: pytest_mock.MockerFixture,
+ test_user_id: str,
+) -> None:
+ remove = mocker.patch(
+ "backend.api.features.experts.routes.experts_db.remove_workflow",
+ new_callable=AsyncMock,
+ side_effect=ExpertScheduleCleanupError("internal schedule ID"),
+ )
+
+ response = client.delete("/experts/expert-1/workflows/workflow-ref-1")
+
+ assert response.status_code == 503
+ assert response.json() == {
+ "detail": "Could not remove the workflow schedule. Please try again."
+ }
+ remove.assert_awaited_once_with(test_user_id, "expert-1", "workflow-ref-1")
+
+
def test_install_workflow_unknown_expert_returns_404(
mocker: pytest_mock.MockerFixture,
) -> None:
diff --git a/autogpt_platform/backend/backend/api/features/experts/scheduling.py b/autogpt_platform/backend/backend/api/features/experts/scheduling.py
index 08994ed960..0d999e1cc8 100644
--- a/autogpt_platform/backend/backend/api/features/experts/scheduling.py
+++ b/autogpt_platform/backend/backend/api/features/experts/scheduling.py
@@ -14,11 +14,12 @@ from datetime import datetime, timezone
import prisma.models
from prisma.enums import ResourceVisibility
+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.util.clients import get_scheduler_client
-from backend.util.exceptions import ExpertRunPausedError
+from backend.util.exceptions import ExpertRunPausedError, NotFoundError
from backend.util.settings import Settings
logger = logging.getLogger(__name__)
@@ -102,9 +103,19 @@ async def create_workflow_schedule(
return True
-async def _delete_schedule_best_effort(
+async def delete_workflow_schedule(
schedule_id: str, user_id: str, expert_id: str
) -> None:
+ """Drop the schedule of a workflow being removed from an expert."""
+ if not await _delete_schedule_best_effort(schedule_id, user_id, expert_id):
+ raise ExpertScheduleCleanupError(
+ f"Could not delete workflow schedule #{schedule_id}"
+ )
+
+
+async def _delete_schedule_best_effort(
+ schedule_id: str, user_id: str, expert_id: str
+) -> bool:
"""Never leave a schedule firing with no row pointing at it. One
immediate retry covers transient RPC blips; a persistent failure is
logged loudly by id. A surviving orphan is not invisible: it stays
@@ -114,13 +125,16 @@ async def _delete_schedule_best_effort(
for _attempt in range(2):
try:
await get_scheduler_client().delete_schedule(schedule_id, user_id=user_id)
- return
+ return True
+ except NotFoundError:
+ return True
except Exception as cleanup_error:
last_error = cleanup_error
logger.error(
f"Orphaned schedule #{schedule_id} for expert #{expert_id} "
f"could not be deleted: {type(last_error).__name__}: {last_error}"
)
+ return False
async def _get_expert_schedules(
diff --git a/autogpt_platform/backend/backend/api/features/experts/workflow_chain.py b/autogpt_platform/backend/backend/api/features/experts/workflow_chain.py
new file mode 100644
index 0000000000..ec52e381fb
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/experts/workflow_chain.py
@@ -0,0 +1,98 @@
+from collections import Counter
+from collections.abc import Sequence
+
+import prisma
+
+from backend.api.features.experts.models import (
+ ExpertWorkflowChainItem,
+ ExpertWorkflowChainKind,
+)
+from backend.blocks import get_block
+from backend.blocks._base import AnyBlockSchema, BlockType
+from backend.integrations.providers import ProviderName
+
+CHAIN_LENGTH = 3
+_PROVIDER_PRIORITY = 100
+
+_KIND_BY_BLOCK_TYPE: dict[BlockType, ExpertWorkflowChainKind] = {
+ BlockType.INPUT: "input",
+ BlockType.OUTPUT: "output",
+ BlockType.WEBHOOK: "trigger",
+ BlockType.WEBHOOK_MANUAL: "trigger",
+ BlockType.AGENT: "agent",
+ BlockType.AI: "ai",
+ BlockType.MCP_TOOL: "mcp",
+ BlockType.HUMAN_IN_THE_LOOP: "human",
+}
+
+# Chain reads left to right like the graph: what starts it, what it uses,
+# what it produces.
+_DISPLAY_ORDER: dict[ExpertWorkflowChainKind, int] = {
+ "trigger": 0,
+ "input": 0,
+ "output": 2,
+}
+
+ChainKey = tuple[ExpertWorkflowChainKind, str | None]
+
+
+def build_workflow_chain(
+ nodes: Sequence[prisma.models.AgentNode],
+) -> list[ExpertWorkflowChainItem]:
+ counts: Counter[ChainKey] = Counter()
+ for node in nodes:
+ key = _classify_node(node)
+ if key is not None:
+ counts[key] += 1
+
+ ranked = sorted(counts.items(), key=_rank)[:CHAIN_LENGTH]
+ ordered = sorted(ranked, key=lambda item: _DISPLAY_ORDER.get(item[0][0], 1))
+ return [
+ ExpertWorkflowChainItem(kind=kind, provider=provider)
+ for (kind, provider), _ in ordered
+ ]
+
+
+def _rank(item: tuple[ChainKey, int]) -> tuple[int, str, str]:
+ (kind, provider), count = item
+ score = count + (_PROVIDER_PRIORITY if provider else 0)
+ return (-score, kind, provider or "")
+
+
+def _classify_node(node: prisma.models.AgentNode) -> ChainKey | None:
+ block = get_block(node.agentBlockId)
+ if block is None or block.block_type == BlockType.NOTE:
+ return None
+ credentials_key = _credentials_key(block, node.constantInput)
+ if credentials_key is not None:
+ return credentials_key
+ kind = _KIND_BY_BLOCK_TYPE.get(block.block_type)
+ return (kind, None) if kind else None
+
+
+def _credentials_key(block: AnyBlockSchema, constant_input: object) -> ChainKey | None:
+ """A single-provider field names the integration; a model-discriminated
+ field resolves through the node's chosen model, and stays a generic AI
+ step when the model is unknown."""
+ inputs = constant_input if isinstance(constant_input, dict) else {}
+ for info in block.input_schema.get_credentials_fields_info().values():
+ if info.discriminator and info.discriminator_mapping:
+ chosen = inputs.get(info.discriminator)
+ mapped = (
+ info.discriminator_mapping.get(str(chosen))
+ if chosen is not None
+ else None
+ )
+ return (
+ ("integration", _provider_slug(mapped))
+ if mapped is not None
+ else ("ai", None)
+ )
+ if len(info.provider) == 1:
+ return ("integration", _provider_slug(next(iter(info.provider))))
+ return ("ai", None)
+ return None
+
+
+def _provider_slug(provider: ProviderName | str) -> str:
+ return provider.value if isinstance(provider, ProviderName) else provider
diff --git a/autogpt_platform/backend/backend/api/features/experts/workflow_chain_test.py b/autogpt_platform/backend/backend/api/features/experts/workflow_chain_test.py
new file mode 100644
index 0000000000..e9944192e0
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/experts/workflow_chain_test.py
@@ -0,0 +1,56 @@
+import json
+
+import prisma
+
+from backend.api.features.experts.workflow_chain import build_workflow_chain
+
+AGENT_INPUT_BLOCK = "c0a8e994-ebf1-4a9c-a4d8-89d09c86741b"
+AGENT_OUTPUT_BLOCK = "363ae599-353e-4804-937e-b2ee3cef3da4"
+GMAIL_READ_BLOCK = "25310c70-b89b-43ba-b25c-4dfa7e2a481c"
+AI_TEXT_GENERATOR_BLOCK = "1f292d4a-41a4-4977-9684-7c8d560b9f91"
+
+
+def _node(block_id: str, constant_input: dict | None = None) -> prisma.models.AgentNode:
+ return prisma.models.AgentNode(
+ id=f"node-{block_id[:8]}-{json.dumps(constant_input or {})}",
+ agentBlockId=block_id,
+ agentGraphId="graph-1",
+ agentGraphVersion=1,
+ constantInput=json.dumps(constant_input or {}),
+ metadata=json.dumps({}),
+ )
+
+
+def test_chain_puts_integrations_first_and_reads_input_to_output():
+ nodes = [
+ _node(AGENT_INPUT_BLOCK),
+ _node(GMAIL_READ_BLOCK),
+ _node(GMAIL_READ_BLOCK),
+ _node(AI_TEXT_GENERATOR_BLOCK, {"model": "Llama-3.3-70B-Instruct"}),
+ _node(AGENT_OUTPUT_BLOCK),
+ ]
+
+ chain = build_workflow_chain(nodes)
+
+ assert [(item.kind, item.provider) for item in chain] == [
+ ("input", None),
+ ("integration", "google"),
+ ("integration", "llama_api"),
+ ]
+
+
+def test_chain_falls_back_to_block_kinds_without_integrations():
+ chain = build_workflow_chain([_node(AGENT_INPUT_BLOCK), _node(AGENT_OUTPUT_BLOCK)])
+
+ assert [(item.kind, item.provider) for item in chain] == [
+ ("input", None),
+ ("output", None),
+ ]
+
+
+def test_chain_skips_unknown_blocks_and_unresolved_llm_models():
+ chain = build_workflow_chain(
+ [_node("not-a-block"), _node(AI_TEXT_GENERATOR_BLOCK, {"model": "mystery"})]
+ )
+
+ assert [(item.kind, item.provider) for item in chain] == [("ai", None)]
diff --git a/autogpt_platform/backend/backend/api/features/experts/workflow_loading_test.py b/autogpt_platform/backend/backend/api/features/experts/workflow_loading_test.py
new file mode 100644
index 0000000000..874cdf8858
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/experts/workflow_loading_test.py
@@ -0,0 +1,68 @@
+from types import SimpleNamespace
+from unittest.mock import AsyncMock, patch
+
+import prisma.models
+import pytest
+
+from backend.api.features.experts import experts_db
+from backend.api.features.experts.models import Expert
+
+
[email protected]("with_metrics", [True, False])
+async def test_roster_skips_nodes_but_detail_loads_workflow_chain(with_metrics):
+ graph = prisma.models.AgentGraph.model_construct(
+ name="My workflow", description="Created in the library", Nodes=None
+ )
+ workflow = prisma.models.ExpertWorkflow.model_construct(
+ id="workflow-1",
+ storeListingVersionId=None,
+ libraryAgentId="library-1",
+ LibraryAgent=prisma.models.LibraryAgent.model_construct(
+ agentGraphId="graph-1", name=None, description=None, AgentGraph=graph
+ ),
+ StoreListingVersion=None,
+ )
+ row = prisma.models.Expert.model_construct(id="expert-1", Workflows=[workflow])
+ client = SimpleNamespace(
+ find_many=AsyncMock(return_value=[row]), find_first=AsyncMock(return_value=row)
+ )
+
+ def convert(expert, *_args):
+ return Expert.model_construct(
+ id=expert.id,
+ workflows=[experts_db._to_workflow_ref(w) for w in expert.Workflows],
+ )
+
+ with (
+ patch.object(prisma.models.Expert, "prisma", return_value=client),
+ patch.object(experts_db, "_latest_runs", new=AsyncMock(return_value={})),
+ patch.object(experts_db, "_weekly_spends", new=AsyncMock(return_value={})),
+ patch.object(experts_db, "get_weekly_spend", new=AsyncMock(return_value=0)),
+ patch.object(
+ experts_db, "count_expert_credentials", new=AsyncMock(return_value={})
+ ),
+ patch.object(experts_db, "_to_model", side_effect=convert),
+ ):
+ roster = await experts_db.list_experts("owner-1", with_metrics=with_metrics)
+ graph.Nodes = [
+ prisma.models.AgentNode.model_construct(
+ agentBlockId="c0a8e994-ebf1-4a9c-a4d8-89d09c86741b",
+ constantInput="{}",
+ )
+ ]
+ detail = await experts_db.get_expert("owner-1", row.id)
+
+ roster_graph = client.find_many.await_args.kwargs["include"]["Workflows"][
+ "include"
+ ]["LibraryAgent"]["include"]["AgentGraph"]
+ detail_graph = client.find_first.await_args.kwargs["include"]["Workflows"][
+ "include"
+ ]["LibraryAgent"]["include"]["AgentGraph"]
+ assert roster_graph is True
+ assert detail_graph["include"]["Nodes"] is True
+ assert roster[0].workflows[0].name == "My workflow"
+ assert roster[0].workflows[0].description == "Created in the library"
+ assert roster[0].workflows[0].chain == []
+ assert detail is not None
+ assert [item.kind for item in detail.workflows[0].chain] == ["input"]
diff --git a/autogpt_platform/backend/backend/api/features/experts/workflow_removal_test.py b/autogpt_platform/backend/backend/api/features/experts/workflow_removal_test.py
new file mode 100644
index 0000000000..773370243f
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/experts/workflow_removal_test.py
@@ -0,0 +1,57 @@
+from types import SimpleNamespace
+from unittest.mock import AsyncMock, patch
+
+import prisma.models
+import pytest
+
+from backend.api.features.experts import experts_db, scheduling
+from backend.api.features.experts.errors import ExpertScheduleCleanupError
+from backend.util.exceptions import NotFoundError
+
+
+ "outcomes,deleted",
+ [
+ ([RuntimeError("unavailable"), RuntimeError("unavailable")], False),
+ ([RuntimeError("transient"), None], True),
+ ([NotFoundError("already deleted")], True),
+ ([None], True),
+ ],
+)
+async def test_remove_workflow_preserves_row_until_schedule_is_deleted(
+ outcomes, deleted
+):
+ expert_client = SimpleNamespace(find_first=AsyncMock(return_value=object()))
+ workflow_client = SimpleNamespace(
+ find_first=AsyncMock(
+ return_value=SimpleNamespace(id="workflow-1", scheduleId="schedule-1")
+ ),
+ delete=AsyncMock(),
+ )
+ scheduler = SimpleNamespace(delete_schedule=AsyncMock(side_effect=outcomes))
+ with (
+ patch.object(prisma.models.Expert, "prisma", return_value=expert_client),
+ patch.object(
+ prisma.models.ExpertWorkflow, "prisma", return_value=workflow_client
+ ),
+ patch.object(scheduling, "get_scheduler_client", return_value=scheduler),
+ ):
+ if deleted:
+ await experts_db.remove_workflow("owner-1", "expert-1", "workflow-1")
+ else:
+ with pytest.raises(ExpertScheduleCleanupError, match="schedule"):
+ await experts_db.remove_workflow("owner-1", "expert-1", "workflow-1")
+
+ assert (
+ expert_client.find_first.await_args.kwargs["where"]["ownerUserId"] == "owner-1"
+ )
+ workflow_client.find_first.assert_awaited_once_with(
+ where={"id": "workflow-1", "expertId": "expert-1"}
+ )
+ assert scheduler.delete_schedule.await_count == len(outcomes)
+ scheduler.delete_schedule.assert_awaited_with("schedule-1", user_id="owner-1")
+ if deleted:
+ workflow_client.delete.assert_awaited_once_with(where={"id": "workflow-1"})
+ else:
+ workflow_client.delete.assert_not_awaited()
diff --git a/autogpt_platform/backend/backend/data/org_credit_test.py b/autogpt_platform/backend/backend/data/org_credit_test.py
index cfdf79752f..1294bd2055 100644
--- a/autogpt_platform/backend/backend/data/org_credit_test.py
+++ b/autogpt_platform/backend/backend/data/org_credit_test.py
@@ -243,3 +243,9 @@ class TestOrgCreditModelTopUp:
assert result == 500
mock_prisma.query_raw.assert_called_once()
+ assert mock_prisma.query_raw.call_args.args[1:] == ("org-1", 500)
+ mock_prisma.orgcredittransaction.create.assert_awaited_once()
+ transaction = mock_prisma.orgcredittransaction.create.call_args.kwargs["data"]
+ assert transaction["initiatedByUserId"] == "user-1"
+ assert transaction["orgId"] == "org-1"
+ assert transaction["amount"] == 500
diff --git a/autogpt_platform/backend/snapshots/expert_activity b/autogpt_platform/backend/snapshots/expert_activity
new file mode 100644
index 0000000000..0e8aa9bcb3
--- /dev/null
+++ b/autogpt_platform/backend/snapshots/expert_activity
@@ -0,0 +1,15 @@
+{
+ "days": [
+ {
+ "day": "2026-09-02",
+ "runs": 0,
+ "sessions": 0
+ },
+ {
+ "day": "2026-09-03",
+ "runs": 1,
+ "sessions": 2
+ }
+ ],
+ "timezone": "Europe/Madrid"
+}
diff --git a/autogpt_platform/backend/snapshots/expert_pod_assign b/autogpt_platform/backend/snapshots/expert_pod_assign
index c44213bdbe..ff3a3c5e25 100644
--- a/autogpt_platform/backend/snapshots/expert_pod_assign
+++ b/autogpt_platform/backend/snapshots/expert_pod_assign
@@ -3,6 +3,7 @@
"bio": null,
"boundaries": "Ask before external actions.",
"color": "",
+ "credential_count": 0,
"id": "expert-1",
"identity": "You are Maria, a pragmatic marketing specialist.",
"is_archived": false,
diff --git a/autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failure b/autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failure
index 4bab5dc26a..37d89c9076 100644
--- a/autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failure
+++ b/autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failure
@@ -4,6 +4,7 @@
"bio": null,
"boundaries": "",
"color": "",
+ "credential_count": 0,
"id": "raised-3",
"identity": "I'm Nova, raised by you. I learn how you work and grow with you.",
"is_archived": false,
diff --git a/autogpt_platform/backend/snapshots/expert_raise_attachments b/autogpt_platform/backend/snapshots/expert_raise_attachments
index 8e9e3ed1fd..0f95e74056 100644
--- a/autogpt_platform/backend/snapshots/expert_raise_attachments
+++ b/autogpt_platform/backend/snapshots/expert_raise_attachments
@@ -4,6 +4,7 @@
"bio": null,
"boundaries": "",
"color": "",
+ "credential_count": 0,
"id": "raised-2",
"identity": "I'm Nova, raised by you. I learn how you work and grow with you.",
"is_archived": false,
@@ -27,6 +28,7 @@
"weekly_spend": 0,
"workflows": [
{
+ "chain": [],
"description": "Writes SEO-optimized blog posts",
"graph_id": "graph-1",
"id": "workflow-ref-1",
diff --git a/autogpt_platform/backend/snapshots/expert_raise_default b/autogpt_platform/backend/snapshots/expert_raise_default
index 979c8433e5..eb322d117f 100644
--- a/autogpt_platform/backend/snapshots/expert_raise_default
+++ b/autogpt_platform/backend/snapshots/expert_raise_default
@@ -4,6 +4,7 @@
"bio": null,
"boundaries": "",
"color": "",
+ "credential_count": 0,
"id": "raised-1",
"identity": "I'm Otto, raised by you. I learn how you work and grow with you.",
"is_archived": false,
diff --git a/autogpt_platform/backend/snapshots/expert_soul_update b/autogpt_platform/backend/snapshots/expert_soul_update
index 257e4d14b5..4d1ce2bbaf 100644
--- a/autogpt_platform/backend/snapshots/expert_soul_update
+++ b/autogpt_platform/backend/snapshots/expert_soul_update
@@ -3,6 +3,7 @@
"bio": null,
"boundaries": "Never invent customer evidence.",
"color": "",
+ "credential_count": 0,
"id": "expert-1",
"identity": "You are Mara, a thoughtful strategist.",
"is_archived": false,
diff --git a/autogpt_platform/backend/snapshots/expert_templates_list b/autogpt_platform/backend/snapshots/expert_templates_list
index 007680789b..59fa4fb504 100644
--- a/autogpt_platform/backend/snapshots/expert_templates_list
+++ b/autogpt_platform/backend/snapshots/expert_templates_list
@@ -4,6 +4,7 @@
"bio": null,
"boundaries": "Ask before external actions.",
"color": "",
+ "credential_count": 0,
"id": "template-1",
"identity": "You are Maria, a pragmatic marketing specialist.",
"is_archived": false,
@@ -27,6 +28,7 @@
"weekly_spend": 0,
"workflows": [
{
+ "chain": [],
"description": "Writes SEO-optimized blog posts",
"graph_id": null,
"id": "workflow-ref-1",
diff --git a/autogpt_platform/frontend/package.json b/autogpt_platform/frontend/package.json
index eb91568d7a..7f701b2a60 100644
--- a/autogpt_platform/frontend/package.json
+++ b/autogpt_platform/frontend/package.json
@@ -41,6 +41,7 @@
"@hugeicons/react": "^1.1.9",
"@next/third-parties": "15.4.6",
"@number-flow/react": "0.6.0",
+ "@phosphor-icons/react": "2.1.10",
"@posthog/react": "1.7.0",
"@radix-ui/react-accordion": "1.2.12",
"@radix-ui/react-alert-dialog": "1.1.15",
diff --git a/autogpt_platform/frontend/pnpm-lock.yaml b/autogpt_platform/frontend/pnpm-lock.yaml
index 8baab980ea..dab18cc464 100644
--- a/autogpt_platform/frontend/pnpm-lock.yaml
+++ b/autogpt_platform/frontend/pnpm-lock.yaml
@@ -40,6 +40,9 @@ importers:
'@number-flow/react':
specifier: 0.6.0
+ '@phosphor-icons/react':
+ specifier: 2.1.10
'@posthog/react':
specifier: 1.7.0
@@ -2583,6 +2586,13 @@ packages:
cpu: [x64]
os: [win32]
+ '@phosphor-icons/[email protected]':
+ resolution: {integrity: sha512-vt8Tvq8GLjheAZZYa+YG/pW7HDbov8El/MANW8pOAz4eGxrwhnbfrQZq0Cp4q8zBEu8NIhHdnr+r8thnfRSNYA==}
+ engines: {node: '>=10'}
+ peerDependencies:
+ react: '>= 16.8'
+ react-dom: '>= 16.8'
+
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
engines: {node: '>=14'}
@@ -11799,6 +11809,11 @@ snapshots:
'@oxc-resolver/[email protected]':
optional: true
+ dependencies:
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+
optional: true
diff --git a/autogpt_platform/frontend/public/experts/covers/amber-300.jpg b/autogpt_platform/frontend/public/experts/covers/amber-300.jpg
new file mode 100644
index 0000000000..d07b5b2c2d
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/amber-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/autopilot.jpg b/autogpt_platform/frontend/public/experts/covers/autopilot.jpg
new file mode 100644
index 0000000000..98c9c31372
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/autopilot.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/blue-300.jpg b/autogpt_platform/frontend/public/experts/covers/blue-300.jpg
new file mode 100644
index 0000000000..5006f05ea6
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/blue-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/cyan-300.jpg b/autogpt_platform/frontend/public/experts/covers/cyan-300.jpg
new file mode 100644
index 0000000000..d98f63c916
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/cyan-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/default.jpg b/autogpt_platform/frontend/public/experts/covers/default.jpg
new file mode 100644
index 0000000000..3676df9ba6
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/default.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/emerald-300.jpg b/autogpt_platform/frontend/public/experts/covers/emerald-300.jpg
new file mode 100644
index 0000000000..d4f492fda5
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/emerald-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/fuchsia-300.jpg b/autogpt_platform/frontend/public/experts/covers/fuchsia-300.jpg
new file mode 100644
index 0000000000..0bc122379b
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/fuchsia-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/green-300.jpg b/autogpt_platform/frontend/public/experts/covers/green-300.jpg
new file mode 100644
index 0000000000..dccd6f00e6
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/green-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/indigo-300.jpg b/autogpt_platform/frontend/public/experts/covers/indigo-300.jpg
new file mode 100644
index 0000000000..507120dd2f
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/indigo-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/lime-300.jpg b/autogpt_platform/frontend/public/experts/covers/lime-300.jpg
new file mode 100644
index 0000000000..cee406102f
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/lime-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/orange-300.jpg b/autogpt_platform/frontend/public/experts/covers/orange-300.jpg
new file mode 100644
index 0000000000..1b036ad67c
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/orange-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/red-300.jpg b/autogpt_platform/frontend/public/experts/covers/red-300.jpg
new file mode 100644
index 0000000000..b7d794d9ce
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/red-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/rose-300.jpg b/autogpt_platform/frontend/public/experts/covers/rose-300.jpg
new file mode 100644
index 0000000000..652b922556
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/rose-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/sky-300.jpg b/autogpt_platform/frontend/public/experts/covers/sky-300.jpg
new file mode 100644
index 0000000000..fb985eb308
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/sky-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/teal-300.jpg b/autogpt_platform/frontend/public/experts/covers/teal-300.jpg
new file mode 100644
index 0000000000..544a1d3732
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/teal-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/violet-300.jpg b/autogpt_platform/frontend/public/experts/covers/violet-300.jpg
new file mode 100644
index 0000000000..b97114ab7e
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/violet-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/covers/yellow-300.jpg b/autogpt_platform/frontend/public/experts/covers/yellow-300.jpg
new file mode 100644
index 0000000000..4b4aebd841
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/covers/yellow-300.jpg differ
diff --git a/autogpt_platform/frontend/public/experts/streak-fire.png b/autogpt_platform/frontend/public/experts/streak-fire.png
new file mode 100644
index 0000000000..07fc0c2a58
Binary files /dev/null and b/autogpt_platform/frontend/public/experts/streak-fire.png differ
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/components/HomeBackdrop/HomeBackdrop.tsx b/autogpt_platform/frontend/src/app/(platform)/home/components/HomeBackdrop/HomeBackdrop.tsx
deleted file mode 100644
index 21998808cf..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/home/components/HomeBackdrop/HomeBackdrop.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import { cn } from "@/lib/utils";
-
-/** A faint 40px grid behind the page, fading out toward the edges so the
- * panels sit on a drafting sheet rather than a flat wash. Colours match
- * the zinc-50 shell so the fade dissolves into the page. */
-export function HomeBackdrop() {
- return (
- <div
- aria-hidden="true"
- className="pointer-events-none absolute inset-0 overflow-hidden"
- >
- <div
- className={cn(
- "absolute inset-0 opacity-60",
- "[background-size:40px_40px]",
- "[background-image:linear-gradient(to_right,theme(colors.zinc.200)_1px,transparent_1px),linear-gradient(to_bottom,theme(colors.zinc.200)_1px,transparent_1px)]",
- )}
- />
- <div className="absolute inset-0 bg-zinc-50 [mask-image:radial-gradient(ellipse_at_center,transparent_20%,black)]" />
- </div>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/home/page.tsx b/autogpt_platform/frontend/src/app/(platform)/home/page.tsx
index f53f077a1f..f13f30c33f 100644
--- a/autogpt_platform/frontend/src/app/(platform)/home/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/home/page.tsx
@@ -7,7 +7,6 @@ import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
import { useAuth } from "@/lib/auth/hooks/useAuth";
import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";
import { AgentTeam } from "./components/AgentTeam/AgentTeam";
-import { HomeBackdrop } from "./components/HomeBackdrop/HomeBackdrop";
import { HomeHeader } from "./components/HomeHeader/HomeHeader";
import { NeedsYou } from "./components/NeedsYou/NeedsYou";
import { NowNext } from "./components/NowNext/NowNext";
@@ -36,7 +35,6 @@ export default function HomePage() {
if (isError || !dashboard) {
return (
<main className={SHELL_CLASS}>
- <HomeBackdrop />
<div className={CONTENT_CLASS}>
<ErrorCard
context="home"
@@ -50,7 +48,6 @@ export default function HomePage() {
return (
<main className={SHELL_CLASS}>
- <HomeBackdrop />
<div className={CONTENT_CLASS}>
<HomeHeader
greeting={getTimeOfDayGreeting()}
@@ -80,7 +77,6 @@ export default function HomePage() {
function HomeSkeleton() {
return (
<main className={SHELL_CLASS} aria-label="Loading Home…">
- <HomeBackdrop />
<div className={CONTENT_CLASS}>
<div className="flex items-end justify-between gap-6 px-1 pb-5 pt-1">
<div className="space-y-2">
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedScheduleView/components/EditScheduleModal/EditScheduleModal.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedScheduleView/components/EditScheduleModal/EditScheduleModal.tsx
index 943937c48e..d7fd90d012 100644
--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedScheduleView/components/EditScheduleModal/EditScheduleModal.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedScheduleView/components/EditScheduleModal/EditScheduleModal.tsx
@@ -8,7 +8,7 @@ import { MultiToggle } from "@/components/molecules/MultiToggle/MultiToggle";
import { Select } from "@/components/atoms/Select/Select";
import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
import { useEditScheduleModal } from "./useEditScheduleModal";
-import { PencilIcon } from "@hugeicons/core-free-icons";
+import { PencilEdit02Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@/components/atoms/Icon/Icon";
type Props = {
@@ -52,7 +52,7 @@ export function EditScheduleModal({
size="small"
className={triggerClassName ?? "absolute -right-2 -top-2"}
>
- <Icon icon={PencilIcon} className="size-4" /> Edit schedule
+ <Icon icon={PencilEdit02Icon} className="size-4" /> Edit schedule
</Button>
</Dialog.Trigger>
<Dialog.Content>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/integrations.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/integrations.test.tsx
index c36ee31995..d54c3624e4 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/integrations.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/integrations.test.tsx
@@ -18,6 +18,37 @@ import { http, HttpResponse } from "msw";
import { beforeEach, describe, expect, it, vi } from "vitest";
import ExpertDetailPage from "../page";
+vi.mock("@/components/contextual/DeviceAuth/DeviceAuthConnectButton", () => ({
+ DeviceAuthConnectButton: ({
+ onSuccess,
+ }: {
+ onSuccess: (credential: {
+ id: string;
+ provider: string;
+ type: "oauth2";
+ title: string;
+ }) => void;
+ }) => (
+ <button
+ onClick={() =>
+ onSuccess({
+ id: "cred-device",
+ provider: "openai",
+ type: "oauth2",
+ title: "Device account",
+ })
+ }
+ >
+ Complete device approval
+ </button>
+ ),
+}));
+
+vi.mock("framer-motion", async (importActual) => {
+ const actual = await importActual<typeof import("framer-motion")>();
+ return { ...actual, useReducedMotion: () => true };
+});
+
vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {
const actual =
await importOriginal<
@@ -101,22 +132,55 @@ beforeEach(() => {
);
});
+async function openIntegrationsTab() {
+ await userEvent.click(
+ await screen.findByRole("tab", { name: /integrations/i }),
+ );
+}
+
describe("managing an expert's integrations", () => {
it("lists what the expert can reach", async () => {
server.use(getListExpertCredentialsMockHandler([linkedin]));
render(<ExpertDetailPage />);
+ await openIntegrationsTab();
+
const section = await screen.findByTestId("expert-integrations-section");
expect(await within(section).findByText("Work LinkedIn")).toBeDefined();
expect(within(section).getByText("LinkedIn")).toBeDefined();
});
+ it("titles the tab and filters integrations by search", async () => {
+ server.use(getListExpertCredentialsMockHandler([linkedin]));
+
+ render(<ExpertDetailPage />);
+
+ await openIntegrationsTab();
+
+ const section = await screen.findByTestId("expert-integrations-section");
+ expect(within(section).getByText("Maria's Integrations")).toBeDefined();
+ await within(section).findByText("Work LinkedIn");
+
+ await userEvent.type(
+ within(section).getByRole("searchbox", { name: "Search integrations" }),
+ "notion",
+ );
+ expect(within(section).getByText("No integrations match.")).toBeDefined();
+
+ await userEvent.clear(
+ within(section).getByRole("searchbox", { name: "Search integrations" }),
+ );
+ expect(within(section).getByText("Work LinkedIn")).toBeDefined();
+ });
+
it("explains the empty state instead of showing a bare list", async () => {
server.use(getListExpertCredentialsMockHandler([]));
render(<ExpertDetailPage />);
+ await openIntegrationsTab();
+
const section = await screen.findByTestId("expert-integrations-section");
expect(
await within(section).findByText(
@@ -140,6 +204,8 @@ describe("managing an expert's integrations", () => {
render(<ExpertDetailPage />);
+ await openIntegrationsTab();
+
await userEvent.click(
await screen.findByRole("button", { name: "Remove Work LinkedIn" }),
);
@@ -151,6 +217,20 @@ describe("managing an expert's integrations", () => {
let granted: string[] = [];
server.use(
getListExpertCredentialsMockHandler([linkedin]),
+ http.get("*/api/integrations/providers", () =>
+ HttpResponse.json([
+ {
+ name: "notion",
+ description: "Docs and databases",
+ supported_auth_types: ["api_key"],
+ },
+ {
+ name: "linkedin",
+ description: "Professional network",
+ supported_auth_types: ["oauth2"],
+ },
+ ]),
+ ),
http.post(
"*/api/experts/expert-maria/credentials",
async ({ request }) => {
@@ -163,14 +243,19 @@ describe("managing an expert's integrations", () => {
render(<ExpertDetailPage />);
+ await openIntegrationsTab();
await userEvent.click(
- await screen.findByRole("button", { name: /Add integration/ }),
+ await screen.findByRole("button", { name: /Use existing/ }),
);
- expect(await screen.findByText("Team Notion")).toBeDefined();
- expect(screen.queryByRole("button", { name: "Work LinkedIn" })).toBeNull();
+ const dialog = await screen.findByRole("dialog");
+ const list = within(dialog).getByRole("list", {
+ name: "Existing connections",
+ });
+ const useNotion = within(list).getByRole("button", { name: /Notion/ });
+ expect(within(list).queryByRole("button", { name: /LinkedIn/ })).toBeNull();
- await userEvent.click(screen.getByText("Team Notion"));
+ await userEvent.click(useNotion);
await waitFor(() => expect(granted).toEqual(["cred-notion"]));
});
@@ -183,13 +268,10 @@ describe("managing an expert's integrations", () => {
render(<ExpertDetailPage />);
- await userEvent.click(
- await screen.findByRole("button", { name: /Add integration/ }),
- );
- expect(await screen.findByText("Nothing connected yet.")).toBeDefined();
+ await openIntegrationsTab();
await userEvent.click(
- screen.getByRole("button", { name: /Connect a new service/ }),
+ await screen.findByRole("button", { name: /Add integration/ }),
);
expect(await screen.findByLabelText("Search services")).toBeDefined();
@@ -200,6 +282,135 @@ describe("managing an expert's integrations", () => {
).toBeDefined();
});
+ it("grants an existing credential from the Use existing dialog", async () => {
+ let granted: string[] = [];
+ server.use(
+ getListExpertCredentialsMockHandler([linkedin]),
+ http.post(
+ "*/api/experts/expert-maria/credentials",
+ async ({ request }) => {
+ const body = (await request.json()) as { credential_ids: string[] };
+ granted = body.credential_ids;
+ return HttpResponse.json([]);
+ },
+ ),
+ );
+
+ render(<ExpertDetailPage />);
+
+ await openIntegrationsTab();
+ await userEvent.click(
+ await screen.findByRole("button", { name: /Use existing/ }),
+ );
+
+ const dialog = await screen.findByRole("dialog");
+ const list = within(dialog).getByRole("list", {
+ name: "Existing connections",
+ });
+ expect(within(list).getByText("Team Notion")).toBeDefined();
+ expect(within(list).queryByText("Work LinkedIn")).toBeNull();
+ await userEvent.click(within(list).getByRole("button", { name: /Notion/ }));
+
+ await waitFor(() => expect(granted).toEqual(["cred-notion"]));
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ });
+
+ it("asks which credential to use when a provider has several", async () => {
+ let granted: string[] = [];
+ server.use(
+ getListExpertCredentialsMockHandler([linkedin]),
+ http.get("*/api/integrations/credentials", () =>
+ HttpResponse.json([
+ {
+ id: "cred-notion",
+ provider: "notion",
+ type: "api_key",
+ title: "Team Notion",
+ },
+ {
+ id: "cred-notion-2",
+ provider: "notion",
+ type: "api_key",
+ title: "Personal Notion",
+ },
+ ]),
+ ),
+ http.post(
+ "*/api/experts/expert-maria/credentials",
+ async ({ request }) => {
+ const body = (await request.json()) as { credential_ids: string[] };
+ granted = body.credential_ids;
+ return HttpResponse.json([]);
+ },
+ ),
+ );
+
+ render(<ExpertDetailPage />);
+
+ await openIntegrationsTab();
+ await userEvent.click(
+ await screen.findByRole("button", { name: /Use existing/ }),
+ );
+ const dialog = await screen.findByRole("dialog");
+ expect(
+ within(dialog).getByText("2 connections · choose one"),
+ ).toBeDefined();
+ await userEvent.click(
+ within(dialog).getByRole("button", { name: /Notion/ }),
+ );
+
+ const choices = await within(dialog).findByRole("list", {
+ name: "Notion connections",
+ });
+ expect(within(choices).getAllByRole("listitem")).toHaveLength(2);
+ await userEvent.click(
+ within(choices).getByRole("button", {
+ name: "Let Maria use Personal Notion",
+ }),
+ );
+
+ await waitFor(() => expect(granted).toEqual(["cred-notion-2"]));
+ });
+
+ it("opens a separate dialog for each header button", async () => {
+ server.use(
+ getListExpertCredentialsMockHandler([linkedin]),
+ http.get("*/api/integrations/providers", () =>
+ HttpResponse.json([
+ {
+ name: "notion",
+ description: "Docs and databases",
+ supported_auth_types: ["api_key"],
+ },
+ ]),
+ ),
+ );
+
+ render(<ExpertDetailPage />);
+
+ await openIntegrationsTab();
+ await userEvent.click(
+ await screen.findByRole("button", { name: /Use existing/ }),
+ );
+ let dialog = await screen.findByRole("dialog");
+ expect(
+ within(dialog).getByRole("list", { name: "Existing connections" }),
+ ).toBeDefined();
+ expect(within(dialog).queryByLabelText("Search services")).toBeNull();
+ await userEvent.keyboard("{Escape}");
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+
+ await userEvent.click(
+ screen.getByRole("button", { name: /Add integration/ }),
+ );
+ dialog = await screen.findByRole("dialog");
+ expect(
+ await within(dialog).findByLabelText("Search services"),
+ ).toBeDefined();
+ expect(await within(dialog).findByText("Notion")).toBeDefined();
+ expect(within(dialog).queryByText(/Let Maria use/)).toBeNull();
+ });
+
it("grants only the credential the dialog created", async () => {
const workLinkedin = {
id: "cred-linkedin",
@@ -253,24 +464,62 @@ describe("managing an expert's integrations", () => {
render(<ExpertDetailPage />);
+ await openIntegrationsTab();
+
await userEvent.click(
await screen.findByRole("button", { name: /Add integration/ }),
);
- await userEvent.click(
- await screen.findByRole("button", { name: /Connect a new service/ }),
- );
await userEvent.click(await screen.findByText("Notion"));
+ expect(await screen.findByText("Connect AutoGPT to Notion")).toBeDefined();
+ await userEvent.click(screen.getByRole("button", { name: /API Key/ }));
await userEvent.type(
await screen.findByPlaceholderText("My Notion key"),
"Team Notion",
);
await userEvent.type(screen.getByPlaceholderText("sk-..."), "secret-value");
- await userEvent.click(screen.getByRole("button", { name: "Save API key" }));
+ await userEvent.click(screen.getByRole("button", { name: "Continue" }));
await waitFor(() => expect(granted).toEqual([["cred-notion"]]));
});
+ it("grants the approved device credential to the expert", async () => {
+ const granted: string[][] = [];
+ server.use(
+ getListExpertCredentialsMockHandler([]),
+ http.get("*/api/integrations/providers", () =>
+ HttpResponse.json([
+ {
+ name: "openai",
+ description: "Device account",
+ supported_auth_types: ["device_code"],
+ },
+ ]),
+ ),
+ http.post(
+ "*/api/experts/expert-maria/credentials",
+ async ({ request }) => {
+ const body = (await request.json()) as { credential_ids: string[] };
+ granted.push(body.credential_ids);
+ return HttpResponse.json([]);
+ },
+ ),
+ );
+ render(<ExpertDetailPage />);
+ await openIntegrationsTab();
+ await userEvent.click(
+ await screen.findByRole("button", { name: /Add integration/ }),
+ );
+ await userEvent.click(await screen.findByText("OpenAI"));
+ await userEvent.click(
+ await screen.findByRole("button", { name: /Device/ }),
+ );
+ await userEvent.click(
+ await screen.findByRole("button", { name: "Complete device approval" }),
+ );
+ await waitFor(() => expect(granted).toEqual([["cred-device"]]));
+ });
+
it("does not offer integrations when the expert's own list fails to load", async () => {
let grantAttempts = 0;
server.use(
@@ -285,14 +534,21 @@ describe("managing an expert's integrations", () => {
render(<ExpertDetailPage />);
+ await openIntegrationsTab();
+
await userEvent.click(
await screen.findByRole("button", { name: /Add integration/ }),
);
+ const dialog = await screen.findByRole("dialog");
+ expect(within(dialog).queryByText(/Let Maria use/)).toBeNull();
+ await userEvent.keyboard("{Escape}");
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
expect(
- await screen.findByText("Couldn't load what Maria already has."),
- ).toBeDefined();
- expect(screen.queryByText("Team Notion")).toBeNull();
+ screen
+ .getByRole("button", { name: /Use existing/ })
+ .hasAttribute("disabled"),
+ ).toBe(true);
expect(grantAttempts).toBe(0);
});
@@ -310,6 +566,8 @@ describe("managing an expert's integrations", () => {
render(<ExpertDetailPage />);
+ await openIntegrationsTab();
+
const section = await screen.findByTestId("expert-integrations-section");
expect(await within(section).findByText("Sentry")).toBeDefined();
expect(within(section).getByText("MCP server")).toBeDefined();
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 8ffe70bb23..c8f674aea8 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
@@ -2,16 +2,24 @@ import userEvent from "@testing-library/user-event";
import { http, HttpResponse } from "msw";
import {
getArchiveExpertMockHandler,
+ getGetExpertActivityMockHandler,
getGetExpertDetachPreviewMockHandler,
getGetExpertMockHandler,
getInstallExpertWorkflowMockHandler,
getListExpertRunsMockHandler,
getListExpertsMockHandler,
+ getRemoveExpertWorkflowMockHandler204,
getResumeExpertSchedulesMockHandler,
+ getUpdateExpertSkillsMockHandler200,
+ getUpdateExpertAvatarMockHandler,
} from "@/app/api/__generated__/endpoints/experts/experts.msw";
-import { getGetV2ListLibraryAgentsMockHandler200 } from "@/app/api/__generated__/endpoints/library/library.msw";
+import {
+ getGetV2GetLibraryAgentMockHandler200,
+ getGetV2ListLibraryAgentsMockHandler200,
+} from "@/app/api/__generated__/endpoints/library/library.msw";
import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
import { LibraryAgentResponse } from "@/app/api/__generated__/models/libraryAgentResponse";
+import { ExpertActivityDay } from "@/app/api/__generated__/models/expertActivityDay";
import { ExpertRun } from "@/app/api/__generated__/models/expertRun";
import {
getDeleteV1DeleteExecutionScheduleMockHandler,
@@ -19,6 +27,8 @@ import {
} from "@/app/api/__generated__/endpoints/schedules/schedules.msw";
import { Expert } from "@/app/api/__generated__/models/expert";
import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
+import { getListCopilotSkillsMockHandler200 } from "@/app/api/__generated__/endpoints/skills/skills.msw";
+import { getGetV2ListStoreAgentsMockHandler200 } from "@/app/api/__generated__/endpoints/store/store.msw";
import { server } from "@/mocks/mock-server";
import {
fireEvent,
@@ -27,9 +37,15 @@ import {
waitFor,
within,
} from "@/tests/integrations/test-utils";
+import { format, subDays } from "date-fns";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import ExpertDetailPage from "../page";
+vi.mock("framer-motion", async (importActual) => {
+ const actual = await importActual<typeof import("framer-motion")>();
+ return { ...actual, useReducedMotion: () => true };
+});
+
const { setFlagStatusMock } = vi.hoisted(() => ({
setFlagStatusMock: vi.fn(() => ({ enabled: true, ready: true })),
}));
@@ -48,6 +64,12 @@ vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {
};
});
+const { uploadAvatarSpy } = vi.hoisted(() => ({ uploadAvatarSpy: vi.fn() }));
+vi.mock("@/lib/direct-upload", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("@/lib/direct-upload")>();
+ return { ...actual, uploadSubmissionMediaDirect: uploadAvatarSpy };
+});
+
const { notFoundMock, pushMock } = vi.hoisted(() => ({
notFoundMock: vi.fn(),
pushMock: vi.fn(),
@@ -98,6 +120,11 @@ const maria: Expert = {
description: "Plans a week of posts",
schedule_cron: "40 7 * * *",
schedule_id: "sched-1",
+ chain: [
+ { kind: "input", provider: null },
+ { kind: "integration", provider: "google" },
+ { kind: "ai", provider: null },
+ ],
},
{
id: "wf-2",
@@ -154,6 +181,26 @@ const mariaRuns: ExpertRun[] = [
},
];
+const ACTIVITY_WINDOW_DAYS = 365;
+
+/** The backend sends `day` as a bare `YYYY-MM-DD`, which the client keeps as
+ * a string despite the generated `Date` type. */
+function activityDays(
+ counts: Record<number, { sessions?: number; runs?: number }>,
+): ExpertActivityDay[] {
+ return Array.from({ length: ACTIVITY_WINDOW_DAYS }, (_, index) => {
+ const daysAgo = ACTIVITY_WINDOW_DAYS - 1 - index;
+ return {
+ day: format(
+ subDays(new Date(), daysAgo),
+ "yyyy-MM-dd",
+ ) as unknown as Date,
+ sessions: counts[daysAgo]?.sessions ?? 0,
+ runs: counts[daysAgo]?.runs ?? 0,
+ };
+ });
+}
+
const ownLibraryAgent = {
id: "lib-private",
graph_id: "graph-private",
@@ -182,14 +229,23 @@ beforeEach(() => {
getGetExpertMockHandler(maria),
getGetV1ListExecutionSchedulesForAUserMockHandler([mariaSchedule]),
getListExpertRunsMockHandler([]),
+ getGetExpertActivityMockHandler({
+ timezone: "UTC",
+ days: activityDays({}),
+ }),
);
});
afterEach(() => {
+ window.localStorage.removeItem("team-workflows-view");
setFlagStatusMock.mockReturnValue({ enabled: true, ready: true });
pushMock.mockReset();
});
+async function openTab(name: string) {
+ await userEvent.click(await screen.findByRole("tab", { name }));
+}
+
describe("ExpertDetailPage", () => {
test("renders the expert profile with workflows and schedule state", async () => {
render(<ExpertDetailPage />);
@@ -199,8 +255,19 @@ describe("ExpertDetailPage", () => {
expect(
screen.getByText("Maria is a senior marketing strategist."),
).toBeDefined();
+ expect(screen.getByText("Identity")).toBeDefined();
+ expect(
+ screen.getByText("You are Maria, a senior marketing strategist."),
+ ).toBeDefined();
+ expect(screen.getByText("Voice")).toBeDefined();
+ expect(screen.getByText("Warm, concise, and direct.")).toBeDefined();
+ expect(screen.getByText("Boundaries")).toBeDefined();
+ expect(screen.getByText("Never invent customer evidence.")).toBeDefined();
+
+ await openTab("Skills");
expect(screen.getByText("Content strategy")).toBeDefined();
+ await openTab("Workflows");
const workflowRows = screen.getAllByTestId("expert-workflow-row");
expect(workflowRows).toHaveLength(2);
expect(within(workflowRows[0]).getByText("Content Calendar")).toBeDefined();
@@ -211,10 +278,478 @@ describe("ExpertDetailPage", () => {
expect(within(workflowRows[1]).getByText("Needs setup")).toBeDefined();
});
+ test("keeps the budget above the tabs and the summary in Basics", async () => {
+ render(<ExpertDetailPage />);
+
+ const budget = await screen.findByRole("region", {
+ name: "Maria budget",
+ });
+ const summary = await screen.findByRole("complementary", {
+ name: "Maria at a glance",
+ });
+ const basicsPanel = screen.getByRole("tabpanel");
+ expect(within(basicsPanel).getByRole("complementary")).toBe(summary);
+ expect(
+ within(basicsPanel).queryByRole("region", { name: "Maria budget" }),
+ ).toBeNull();
+ expect(
+ within(summary).getByRole("region", { name: "Maria activity" }),
+ ).toBeDefined();
+ expect(
+ within(summary).getByRole("region", { name: "Maria activity streak" }),
+ ).toBeDefined();
+ expect(within(summary).queryByText("Schedules")).toBeNull();
+ expect(within(summary).queryByText("Skills")).toBeNull();
+ expect(within(summary).queryByText("Workflows")).toBeNull();
+
+ await openTab("Work");
+ expect(screen.getByRole("region", { name: "Maria budget" })).toBe(budget);
+ expect(
+ screen.queryByRole("complementary", { name: "Maria at a glance" }),
+ ).toBeNull();
+ });
+
+ test("opens the Soul panel from Basics", async () => {
+ const user = userEvent.setup();
+ render(<ExpertDetailPage />);
+
+ await user.click(await screen.findByRole("button", { name: "Edit Soul" }));
+
+ expect(
+ screen.getByRole("complementary", { name: "Maria's Soul" }),
+ ).toBeDefined();
+ expect(
+ screen.getByRole("textbox", { name: "Identity and personality" }),
+ ).toBeDefined();
+ });
+
+ test("shows the workflow's block chain with provider logos and icons", async () => {
+ const user = userEvent.setup();
+ render(<ExpertDetailPage />);
+
+ await openTab("Workflows");
+ await user.click(screen.getByRole("button", { name: "Grid view" }));
+ const [calendar, seo] = screen.getAllByTestId("expert-workflow-row");
+ const chain = within(calendar).getByTestId("workflow-chain");
+ expect(
+ within(chain).getByRole("img", { name: "Agent input" }),
+ ).toBeDefined();
+ expect(within(chain).getByRole("img", { name: "google" })).toBeDefined();
+ expect(within(chain).getByRole("img", { name: "AI model" })).toBeDefined();
+ expect(within(seo).queryByTestId("workflow-chain")).toBeNull();
+ });
+
+ test("shows each workflow's total runs from its library agent", async () => {
+ server.use(
+ getGetV2GetLibraryAgentMockHandler200({
+ ...ownLibraryAgent,
+ id: "lib-1",
+ execution_count: 12,
+ } as LibraryAgent),
+ );
+ render(<ExpertDetailPage />);
+
+ await openTab("Workflows");
+ const [calendar] = screen.getAllByTestId("expert-workflow-row");
+ expect(await within(calendar).findByText(/12 runs/)).toBeDefined();
+ });
+
+ test("opens the workflow's library page from the card", async () => {
+ render(<ExpertDetailPage />);
+
+ await openTab("Workflows");
+ const link = screen.getByRole("link", {
+ name: "Open Content Calendar tasks",
+ });
+ expect(link.getAttribute("href")).toBe("/library/agents/lib-1");
+ const [calendar] = screen.getAllByTestId("expert-workflow-row");
+ expect(
+ within(calendar)
+ .getByRole("link", { name: "Edit workflow" })
+ .getAttribute("href"),
+ ).toBe("/build?flowID=graph-1");
+ expect(within(calendar).queryByText("See tasks")).toBeNull();
+ });
+
+ test("opens the run dialog from the card's Run button", async () => {
+ const user = userEvent.setup();
+ server.use(
+ getGetV2GetLibraryAgentMockHandler200({
+ ...ownLibraryAgent,
+ id: "lib-1",
+ name: "Content Calendar",
+ } as LibraryAgent),
+ );
+ render(<ExpertDetailPage />);
+
+ await openTab("Workflows");
+ const [calendar] = screen.getAllByTestId("expert-workflow-row");
+ await user.click(
+ await within(calendar).findByRole("button", { name: "Run" }),
+ );
+
+ expect(await screen.findByRole("dialog")).toBeDefined();
+ });
+
+ test("removes a workflow from the expert after confirming", async () => {
+ const user = userEvent.setup();
+ const deleted: string[] = [];
+ let removed = false;
+ server.use(
+ getGetExpertMockHandler(() =>
+ removed ? { ...maria, workflows: [maria.workflows[1]] } : maria,
+ ),
+ getRemoveExpertWorkflowMockHandler204(({ params }) => {
+ deleted.push(String(params.workflowId));
+ removed = true;
+ return undefined;
+ }),
+ );
+ render(<ExpertDetailPage />);
+
+ await openTab("Workflows");
+ const [calendar] = screen.getAllByTestId("expert-workflow-row");
+ await user.click(
+ within(calendar).getByRole("button", { name: "More actions" }),
+ );
+ await user.click(
+ await screen.findByRole("menuitem", { name: "Remove from expert" }),
+ );
+ const dialog = await screen.findByRole("dialog", {
+ name: "Remove Content Calendar?",
+ });
+ await user.click(within(dialog).getByRole("button", { name: "Remove" }));
+
+ await waitFor(() => {
+ expect(screen.getAllByTestId("expert-workflow-row")).toHaveLength(1);
+ });
+ expect(deleted).toEqual(["wf-1"]);
+ expect(screen.queryByRole("dialog")).toBeNull();
+ });
+
+ test("titles the schedules tab and searches schedules", async () => {
+ const user = userEvent.setup();
+ render(<ExpertDetailPage />);
+
+ await openTab("Schedules");
+ expect(screen.getByText("Maria's Schedules")).toBeDefined();
+ expect(await screen.findByTestId("schedule-row")).toBeDefined();
+
+ await user.type(
+ screen.getByRole("searchbox", { name: "Search schedules" }),
+ "nothing-like-this",
+ );
+ expect(screen.getByText("No schedules match.")).toBeDefined();
+ });
+
+ test("lists the expert's workflows in the create schedule dialog", async () => {
+ const user = userEvent.setup();
+ render(<ExpertDetailPage />);
+
+ await openTab("Schedules");
+ await user.click(screen.getByRole("button", { name: "Create schedule" }));
+
+ const dialog = await screen.findByRole("dialog", {
+ name: "Create schedule",
+ });
+ const list = within(dialog).getByRole("list", {
+ name: "Schedulable workflows",
+ });
+ expect(within(list).getByText("Content Calendar")).toBeDefined();
+ expect(within(list).getByText("SEO Audit")).toBeDefined();
+ });
+
+ test("defaults workflows to the stacked list and can switch to the grid", async () => {
+ const user = userEvent.setup();
+ render(<ExpertDetailPage />);
+
+ await openTab("Workflows");
+ const list = screen.getByTestId("workflow-list");
+ expect(within(list).getAllByTestId("expert-workflow-row")).toHaveLength(2);
+ expect(
+ within(list).getAllByRole("button", { name: "More actions" }),
+ ).toHaveLength(2);
+
+ await user.click(screen.getByRole("button", { name: "Grid view" }));
+ expect(screen.queryByTestId("workflow-list")).toBeNull();
+ expect(screen.getAllByTestId("expert-workflow-row")).toHaveLength(2);
+ });
+
+ test("remembers the chosen workflows view in local storage", async () => {
+ const user = userEvent.setup();
+ const { unmount } = render(<ExpertDetailPage />);
+
+ await openTab("Workflows");
+ await user.click(screen.getByRole("button", { name: "Grid view" }));
+ expect(window.localStorage.getItem("team-workflows-view")).toBe("grid");
+ unmount();
+
+ render(<ExpertDetailPage />);
+ await openTab("Workflows");
+ await waitFor(() => {
+ expect(screen.queryByTestId("workflow-list")).toBeNull();
+ });
+ expect(screen.getAllByTestId("expert-workflow-row")).toHaveLength(2);
+ });
+
+ test("stacks the credentials a workflow will use beside Run", async () => {
+ server.use(
+ getGetV2GetLibraryAgentMockHandler200({
+ ...ownLibraryAgent,
+ id: "lib-1",
+ credentials_input_schema: {
+ type: "object",
+ properties: {
+ github: { credentials_provider: ["github"] },
+ notion: { credentials_provider: ["notion"] },
+ slack: { credentials_provider: ["slack"] },
+ linear: { credentials_provider: ["linear"] },
+ discord: { credentials_provider: ["discord"] },
+ },
+ },
+ } as LibraryAgent),
+ );
+ render(<ExpertDetailPage />);
+
+ await openTab("Workflows");
+ const [calendar] = screen.getAllByTestId("expert-workflow-row");
+ const stack = await within(calendar).findByRole("list", {
+ name: "Credentials used",
+ });
+ expect(within(stack).getAllByRole("listitem")).toHaveLength(4);
+ expect(within(stack).getByText("+3")).toBeDefined();
+ });
+
+ test("lists the expert's skills with library details and adds one", async () => {
+ const user = userEvent.setup();
+ const puts: string[][] = [];
+ let skills = ["Content strategy"];
+ server.use(
+ getGetExpertMockHandler(() => ({ ...maria, skills })),
+ getListCopilotSkillsMockHandler200([
+ {
+ name: "Content strategy",
+ description: "How to plan a content calendar",
+ triggers: ["plan content"],
+ },
+ { name: "Deep Research", description: "Research anything thoroughly" },
+ ]),
+ getUpdateExpertSkillsMockHandler200(async ({ request }) => {
+ const body = (await request.json()) as { skills: string[] };
+ puts.push(body.skills);
+ skills = body.skills;
+ return { ...maria, skills };
+ }),
+ );
+ render(<ExpertDetailPage />);
+
+ await openTab("Skills");
+ expect(screen.getByText("Maria's Skills")).toBeDefined();
+ const list = screen.getByRole("list", { name: "Expert skills" });
+ expect(
+ await within(list).findByText("How to plan a content calendar"),
+ ).toBeDefined();
+ expect(within(list).getByText("plan content")).toBeDefined();
+
+ await user.click(screen.getByRole("button", { name: "Add skill" }));
+ const dialog = await screen.findByRole("dialog", { name: "Add a skill" });
+ expect(within(dialog).queryByText("Content strategy")).toBeNull();
+ await user.click(within(dialog).getByRole("button", { name: "Add" }));
+
+ await waitFor(() => {
+ expect(puts).toEqual([["Content strategy", "Deep Research"]]);
+ });
+ expect(await within(list).findByText("Deep Research")).toBeDefined();
+ });
+
+ test("offers marketplace skills as a second source in the add dialog", async () => {
+ const user = userEvent.setup();
+ server.use(
+ getListCopilotSkillsMockHandler200([]),
+ getGetV2ListStoreAgentsMockHandler200({
+ agents: [
+ {
+ slug: "seo-audit",
+ agent_name: "SEO Audit Pro",
+ agent_image: "",
+ creator: "acme",
+ creator_avatar: "",
+ sub_heading: "Audit any page for SEO gaps",
+ description: "",
+ runs: 3,
+ rating: 4.5,
+ agent_graph_id: "graph-seo",
+ },
+ ],
+ pagination: {
+ total_items: 1,
+ total_pages: 1,
+ current_page: 1,
+ page_size: 20,
+ },
+ }),
+ );
+ render(<ExpertDetailPage />);
+
+ await openTab("Skills");
+ await user.click(screen.getByRole("button", { name: "Add skill" }));
+ const dialog = await screen.findByRole("dialog", { name: "Add a skill" });
+ await user.click(within(dialog).getByRole("tab", { name: "Marketplace" }));
+
+ const list = await within(dialog).findByRole("list", {
+ name: "Marketplace skills",
+ });
+ expect(within(list).getByText("SEO Audit Pro")).toBeDefined();
+ });
+
+ test("removes a skill from the expert", async () => {
+ const user = userEvent.setup();
+ const puts: string[][] = [];
+ let skills = ["Content strategy"];
+ server.use(
+ getGetExpertMockHandler(() => ({ ...maria, skills })),
+ getListCopilotSkillsMockHandler200([]),
+ getUpdateExpertSkillsMockHandler200(async ({ request }) => {
+ const body = (await request.json()) as { skills: string[] };
+ puts.push(body.skills);
+ skills = body.skills;
+ return { ...maria, skills };
+ }),
+ );
+ render(<ExpertDetailPage />);
+
+ await openTab("Skills");
+ await user.click(
+ await screen.findByRole("button", { name: "Remove Content strategy" }),
+ );
+
+ await waitFor(() => {
+ expect(puts).toEqual([[]]);
+ });
+ expect(await screen.findByText(/No skills yet/)).toBeDefined();
+ });
+
+ test("searches and filters the workflow list", async () => {
+ const user = userEvent.setup();
+ render(<ExpertDetailPage />);
+
+ await openTab("Workflows");
+ expect(screen.getAllByTestId("expert-workflow-row")).toHaveLength(2);
+
+ await user.type(
+ screen.getByRole("searchbox", { name: "Search workflows" }),
+ "seo",
+ );
+ expect(screen.getAllByTestId("expert-workflow-row")).toHaveLength(1);
+ expect(screen.getByText("SEO Audit")).toBeDefined();
+
+ await user.clear(
+ screen.getByRole("searchbox", { name: "Search workflows" }),
+ );
+ await user.click(screen.getByRole("button", { name: "Filter workflows" }));
+ await user.click(
+ await screen.findByRole("menuitemradio", { name: "Scheduled" }),
+ );
+ expect(screen.getAllByTestId("expert-workflow-row")).toHaveLength(1);
+ expect(screen.getByText("Content Calendar")).toBeDefined();
+
+ await user.click(screen.getByRole("button", { name: "Filter workflows" }));
+ await user.click(
+ await screen.findByRole("menuitemradio", { name: "Manual" }),
+ );
+ expect(screen.getByText("No workflows match.")).toBeDefined();
+ });
+
+ test("toggles the Soul panel closed from the header button", async () => {
+ const user = userEvent.setup();
+ render(<ExpertDetailPage />);
+
+ const editSoul = await screen.findByRole("button", { name: "Edit Soul" });
+ await user.click(editSoul);
+ expect(
+ screen.getByRole("complementary", { name: "Maria's Soul" }),
+ ).toBeDefined();
+
+ await user.click(editSoul);
+ await waitFor(() => {
+ expect(
+ screen.queryByRole("complementary", { name: "Maria's Soul" }),
+ ).toBeNull();
+ });
+ });
+
+ test("draws the activity graph and marks the expert active this week", async () => {
+ server.use(
+ getGetExpertActivityMockHandler({
+ timezone: "UTC",
+ days: activityDays({
+ 0: { sessions: 2, runs: 1 },
+ 1: { runs: 1 },
+ 2: { sessions: 1 },
+ 29: { sessions: 1 },
+ }).slice(-31),
+ }),
+ );
+
+ render(<ExpertDetailPage />);
+
+ expect(await screen.findByText("Active this week")).toBeDefined();
+ expect(
+ screen.getByRole("img", { name: "Activity over the last 3 months" }),
+ ).toBeDefined();
+ expect(
+ screen.getByText("4 sessions · 2 runs · last 3 months"),
+ ).toBeDefined();
+ const graph = screen.getByTestId("expert-activity-graph");
+ expect(graph.querySelectorAll("[title]")).toHaveLength(90);
+ const streak = screen.getByRole("region", {
+ name: "Maria activity streak",
+ });
+ expect(within(streak).getByText("3")).toBeDefined();
+ expect(within(streak).getByText("day streak")).toBeDefined();
+ const today = screen.getByTitle(
+ `2 sessions, 1 run on ${format(new Date(), "MMM d")}`,
+ );
+ expect(today.getAttribute("data-level")).toBe("4");
+ const lighter = screen.getByTitle(
+ `1 session on ${format(subDays(new Date(), 29), "MMM d")}`,
+ );
+ expect(lighter.getAttribute("data-level")).toBe("2");
+ });
+
+ test("marks the expert quiet when nothing happened this week", async () => {
+ server.use(
+ getGetExpertActivityMockHandler({
+ timezone: "UTC",
+ days: activityDays({ 10: { runs: 2 } }),
+ }),
+ );
+
+ render(<ExpertDetailPage />);
+
+ expect(await screen.findByText("Quiet lately")).toBeDefined();
+ expect(
+ screen.getByText("0 sessions · 2 runs · last 3 months"),
+ ).toBeDefined();
+ });
+
+ test("shows a fallback when activity fails to load", async () => {
+ server.use(
+ http.get("/api/proxy/api/experts/:expertId/activity", () =>
+ HttpResponse.json({ detail: "boom" }, { status: 500 }),
+ ),
+ );
+
+ render(<ExpertDetailPage />);
+
+ expect(await screen.findByText("Activity unavailable")).toBeDefined();
+ expect(screen.getByRole("heading", { name: "Maria" })).toBeDefined();
+ });
+
test("lists the expert's schedules with edit and delete actions", async () => {
render(<ExpertDetailPage />);
- await screen.findByRole("heading", { name: "Maria" });
+ await openTab("Schedules");
const row = await screen.findByTestId("schedule-row");
expect(row.getAttribute("data-schedule-id")).toBe("sched-1");
expect(screen.getByRole("button", { name: /Edit schedule/ })).toBeDefined();
@@ -227,6 +762,7 @@ describe("ExpertDetailPage", () => {
render(<ExpertDetailPage />);
+ await openTab("Schedules");
fireEvent.click(await screen.findByTestId("schedule-delete-button"));
fireEvent.click(await screen.findByTestId("schedule-confirm-delete"));
@@ -238,8 +774,8 @@ describe("ExpertDetailPage", () => {
render(<ExpertDetailPage />);
- await screen.findByRole("heading", { name: "Maria" });
- expect(screen.getByText(/No schedules yet/)).toBeDefined();
+ await openTab("Schedules");
+ expect(await screen.findByText(/No schedules yet/)).toBeDefined();
});
test("shows the expert's recent work with honest status chips", async () => {
@@ -247,7 +783,7 @@ describe("ExpertDetailPage", () => {
render(<ExpertDetailPage />);
- await screen.findByRole("heading", { name: "Maria" });
+ await openTab("Work");
const workList = await screen.findByRole("list", { name: "Expert work" });
expect(within(workList).getByText("Weekly Report")).toBeDefined();
expect(within(workList).getByText("Completed")).toBeDefined();
@@ -262,7 +798,7 @@ describe("ExpertDetailPage", () => {
render(<ExpertDetailPage />);
- await screen.findByRole("heading", { name: "Maria" });
+ await openTab("Work");
await screen.findByRole("list", { name: "Expert work" });
fireEvent.click(screen.getByRole("button", { name: /Needs review \(1\)/ }));
@@ -275,7 +811,7 @@ describe("ExpertDetailPage", () => {
test("shows an empty work message when there is no completed work", async () => {
render(<ExpertDetailPage />);
- await screen.findByRole("heading", { name: "Maria" });
+ await openTab("Work");
expect(await screen.findByText(/No completed work yet/)).toBeDefined();
});
@@ -289,19 +825,78 @@ describe("ExpertDetailPage", () => {
: HttpResponse.json(mariaRuns);
}),
);
- const user = userEvent.setup();
render(<ExpertDetailPage />);
+ await openTab("Work");
expect(
await screen.findByText("We could not load this expert's recent work."),
).toBeDefined();
- await user.click(screen.getByRole("button", { name: /try again/i }));
+ await userEvent.click(screen.getByRole("button", { name: /try again/i }));
expect(await screen.findByText("Weekly Report")).toBeDefined();
expect(attempts).toBe(2);
});
+ test("uploads a new photo from the header avatar", async () => {
+ const updateSpy = vi.fn((info: { request: Request }) => info.request);
+ uploadAvatarSpy.mockResolvedValueOnce("https://cdn.example.com/maria.png");
+ server.use(
+ getUpdateExpertAvatarMockHandler(async (info) => {
+ updateSpy(info);
+ return {
+ ...maria,
+ avatar_url: "https://cdn.example.com/maria.png",
+ };
+ }),
+ );
+
+ render(<ExpertDetailPage />);
+
+ const button = await screen.findByRole("button", {
+ name: "Change Maria's photo",
+ });
+ const fileInput = screen.getByLabelText("Upload Maria photo");
+ expect(button.contains(fileInput)).toBe(false);
+ const pickerClick = vi.spyOn(fileInput, "click");
+ fireEvent.click(button);
+ expect(pickerClick).toHaveBeenCalledTimes(1);
+ pickerClick.mockRestore();
+ const file = new File(["x"], "maria.png", { type: "image/png" });
+ fireEvent.change(fileInput, { target: { files: [file] } });
+
+ await waitFor(() => expect(updateSpy).toHaveBeenCalled());
+ expect(uploadAvatarSpy).toHaveBeenCalledWith(file);
+ const body = await updateSpy.mock.results[0].value.json();
+ expect(body).toEqual({ avatar_url: "https://cdn.example.com/maria.png" });
+ });
+
+ test("a failed photo upload leaves the expert untouched", async () => {
+ uploadAvatarSpy.mockRejectedValueOnce(new Error("Unauthorized"));
+ const updateSpy = vi.fn();
+ server.use(
+ getUpdateExpertAvatarMockHandler(() => {
+ updateSpy();
+ return maria;
+ }),
+ );
+
+ render(<ExpertDetailPage />);
+
+ const button = await screen.findByRole("button", {
+ name: "Change Maria's photo",
+ });
+ const fileInput = screen.getByLabelText("Upload Maria photo");
+ expect(button.contains(fileInput)).toBe(false);
+ fireEvent.change(fileInput, {
+ target: { files: [new File(["x"], "maria.png", { type: "image/png" })] },
+ });
+
+ await waitFor(() => expect(uploadAvatarSpy).toHaveBeenCalled());
+ await waitFor(() => expect(button).not.toHaveProperty("disabled", true));
+ expect(updateSpy).not.toHaveBeenCalled();
+ });
+
test("paused expert offers one-click resume", async () => {
const resumeSpy = vi.fn(() => ({ ...maria, schedules_paused_at: null }));
server.use(
@@ -319,7 +914,7 @@ describe("ExpertDetailPage", () => {
await waitFor(() => expect(resumeSpy).toHaveBeenCalled());
});
- test("fires the expert from the header menu and returns to the team page", async () => {
+ test("fires the expert from the settings tab and returns to the team page", async () => {
const archiveSpy = vi.fn();
server.use(
getGetExpertDetachPreviewMockHandler({
@@ -331,13 +926,8 @@ describe("ExpertDetailPage", () => {
render(<ExpertDetailPage />);
- await screen.findByRole("heading", { name: "Maria" });
- fireEvent.pointerDown(screen.getByTestId("expert-detail-actions"), {
- button: 0,
- });
- fireEvent.click(
- await screen.findByRole("menuitem", { name: /Fire Maria/ }),
- );
+ await openTab("Settings");
+ fireEvent.click(await screen.findByTestId("expert-fire-button"));
const dialog = await screen.findByRole("dialog", { name: "Fire Maria?" });
expect(
@@ -376,7 +966,10 @@ describe("ExpertDetailPage", () => {
render(<ExpertDetailPage />);
await screen.findByRole("heading", { name: "Maria" });
- await user.click(screen.getByRole("button", { name: "Install workflow" }));
+ await openTab("Workflows");
+ await user.click(
+ await screen.findByRole("button", { name: "Install workflow" }),
+ );
const dialog = await screen.findByRole("dialog");
const row = await within(dialog).findByTestId("install-workflow-option");
@@ -388,7 +981,7 @@ describe("ExpertDetailPage", () => {
);
});
- test("marks an already-installed workflow instead of offering Install", async () => {
+ test("hides an already-installed workflow from the Install picker", async () => {
const user = userEvent.setup();
const installed = { ...ownLibraryAgent, id: "lib-1" } as LibraryAgent;
server.use(
@@ -399,12 +992,64 @@ describe("ExpertDetailPage", () => {
render(<ExpertDetailPage />);
await screen.findByRole("heading", { name: "Maria" });
+ await openTab("Workflows");
await user.click(screen.getByRole("button", { name: "Install workflow" }));
const dialog = await screen.findByRole("dialog");
- const row = await within(dialog).findByTestId("install-workflow-option");
- expect(within(row).getByText("Installed")).toBeDefined();
- expect(within(row).queryByRole("button", { name: "Install" })).toBeNull();
+ expect(
+ await within(dialog).findByText("No workflows in your library."),
+ ).toBeDefined();
+ expect(within(dialog).queryByTestId("install-workflow-option")).toBeNull();
+ });
+
+ test("fetches later installable workflows after an installed first page", async () => {
+ const pages: number[] = [];
+ server.use(
+ getListExpertsMockHandler([maria]),
+ http.get("*/api/library/agents", ({ request }) => {
+ const page = Number(new URL(request.url).searchParams.get("page") ?? 1);
+ pages.push(page);
+ const agents =
+ page === 1
+ ? [{ ...ownLibraryAgent, id: "lib-1", name: "Already installed" }]
+ : page === 2
+ ? [ownLibraryAgent]
+ : [
+ {
+ ...ownLibraryAgent,
+ id: "lib-later",
+ name: "Another workflow",
+ },
+ ];
+ return HttpResponse.json({
+ ...libraryResponse(agents),
+ pagination: {
+ total_items: 21,
+ total_pages: 3,
+ current_page: page,
+ page_size: 10,
+ },
+ });
+ }),
+ );
+ render(<ExpertDetailPage />);
+ await screen.findByRole("heading", { name: "Maria" });
+ await openTab("Workflows");
+ await userEvent.click(
+ screen.getByRole("button", { name: "Install workflow" }),
+ );
+ const dialog = await screen.findByRole("dialog");
+ expect(await within(dialog).findByText("My Private Agent")).toBeDefined();
+ expect(within(dialog).queryByText("Already installed")).toBeNull();
+ expect(pages).toEqual([1, 2]);
+ await userEvent.click(
+ within(dialog).getByRole("button", { name: "Load more workflows" }),
+ );
+ expect(await within(dialog).findByText("Another workflow")).toBeDefined();
+ expect(pages).toEqual([1, 2, 3]);
+ expect(
+ within(dialog).queryByRole("button", { name: "Load more workflows" }),
+ ).toBeNull();
});
test("shows the workflow description rather than an unknown creator", async () => {
@@ -419,6 +1064,7 @@ describe("ExpertDetailPage", () => {
render(<ExpertDetailPage />);
await screen.findByRole("heading", { name: "Maria" });
+ await openTab("Workflows");
await user.click(screen.getByRole("button", { name: "Install workflow" }));
const dialog = await screen.findByRole("dialog");
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
new file mode 100644
index 0000000000..a3a1b22ea9
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/AddSkillDialog.tsx
@@ -0,0 +1,234 @@
+"use client";
+
+import { CopilotSkillInfo } from "@/app/api/__generated__/models/copilotSkillInfo";
+import { StoreAgent } from "@/app/api/__generated__/models/storeAgent";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { Dialog } from "@/components/molecules/Dialog/Dialog";
+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";
+import {
+ TabsLine,
+ TabsLineList,
+ TabsLineTrigger,
+} from "@/components/molecules/TabsLine/TabsLine";
+import {
+ BookOpen01Icon,
+ PlusSignIcon,
+ Store01Icon,
+} from "@hugeicons/core-free-icons";
+import NextLink from "next/link";
+import { useState } from "react";
+import { useFitListToDialog } from "./useFitListToDialog";
+
+type Source = "library" | "marketplace";
+
+interface Props {
+ open: boolean;
+ source: Source;
+ onSourceChange: (source: Source) => void;
+ skills: CopilotSkillInfo[];
+ isLoading: boolean;
+ marketQuery: string;
+ onMarketQueryChange: (query: string) => void;
+ marketplaceSkills: StoreAgent[];
+ isMarketplaceLoading: boolean;
+ isSaving: boolean;
+ onAdd: (name: string) => void;
+ onAddMarketplace: (agent: StoreAgent) => void;
+ onClose: () => void;
+}
+
+export function AddSkillDialog({
+ open,
+ source,
+ onSourceChange,
+ skills,
+ isLoading,
+ marketQuery,
+ onMarketQueryChange,
+ marketplaceSkills,
+ isMarketplaceLoading,
+ isSaving,
+ onAdd,
+ onAddMarketplace,
+ onClose,
+}: Props) {
+ const [query, setQuery] = useState("");
+ const { attachList } = useFitListToDialog<HTMLUListElement>();
+ const needle = query.trim().toLowerCase();
+ const visible = needle
+ ? skills.filter(
+ (skill) =>
+ skill.name.toLowerCase().includes(needle) ||
+ skill.description.toLowerCase().includes(needle),
+ )
+ : skills;
+
+ return (
+ <Dialog
+ controlled={{
+ isOpen: open,
+ set: (next) => {
+ if (!next) onClose();
+ },
+ }}
+ styling={{ maxWidth: "30rem", maxHeight: "60vh" }}
+ title="Add a skill"
+ >
+ <Dialog.Content>
+ <div className="flex flex-col gap-3">
+ <Text variant="small" className="text-sm !text-zinc-500">
+ Skills are reusable instructions this expert follows for a specific
+ job. Pick one from your library or install one from the marketplace.
+ </Text>
+ <TabsLine
+ value={source}
+ onValueChange={(next) => onSourceChange(next as Source)}
+ >
+ <TabsLineList flush indicatorClassName="bg-zinc-900">
+ <TabsLineTrigger
+ value="library"
+ className="gap-1.5 data-[state=active]:text-zinc-900"
+ >
+ <Icon icon={BookOpen01Icon} size={14} />
+ Library
+ </TabsLineTrigger>
+ <TabsLineTrigger
+ value="marketplace"
+ className="gap-1.5 data-[state=active]:text-zinc-900"
+ >
+ <Icon icon={Store01Icon} size={14} />
+ Marketplace
+ </TabsLineTrigger>
+ </TabsLineList>
+ </TabsLine>
+
+ {source === "library" ? (
+ <>
+ <SearchInput
+ size="small"
+ value={query}
+ onChange={setQuery}
+ placeholder="Search your library"
+ />
+ {isLoading ? (
+ <Text variant="small" className="text-zinc-500">
+ Loading your skills…
+ </Text>
+ ) : visible.length === 0 ? (
+ <Text variant="small" className="text-zinc-500">
+ {skills.length === 0
+ ? "Every library skill is already on this expert."
+ : "No skills match."}
+ </Text>
+ ) : (
+ <ul
+ ref={attachList}
+ className="flex flex-col gap-2 overflow-y-auto pr-1"
+ aria-label="Library skills"
+ >
+ {visible.map((skill) => (
+ <SkillOption
+ key={skill.name}
+ name={skill.name}
+ description={skill.description}
+ icon={BookOpen01Icon}
+ disabled={isSaving}
+ onAdd={() => onAdd(skill.name)}
+ />
+ ))}
+ </ul>
+ )}
+ <NextLink
+ href="/library/skills"
+ className="text-sm text-zinc-500 underline underline-offset-2"
+ >
+ Upload a new skill in your library
+ </NextLink>
+ </>
+ ) : (
+ <>
+ <SearchInput
+ size="small"
+ value={marketQuery}
+ onChange={onMarketQueryChange}
+ placeholder="Search the marketplace"
+ />
+ {isMarketplaceLoading ? (
+ <Text variant="small" className="text-zinc-500">
+ Searching the marketplace…
+ </Text>
+ ) : marketplaceSkills.length === 0 ? (
+ <Text variant="small" className="text-zinc-500">
+ No marketplace skills match.
+ </Text>
+ ) : (
+ <ul
+ ref={attachList}
+ className="flex flex-col gap-2 overflow-y-auto pr-1"
+ aria-label="Marketplace skills"
+ >
+ {marketplaceSkills.map((agent) => (
+ <SkillOption
+ key={`${agent.creator}/${agent.slug}`}
+ name={agent.agent_name}
+ description={agent.sub_heading || agent.description}
+ icon={Store01Icon}
+ disabled={isSaving}
+ onAdd={() => onAddMarketplace(agent)}
+ />
+ ))}
+ </ul>
+ )}
+ </>
+ )}
+ <div className="flex justify-end pt-1">
+ <Button variant="secondary" size="small" onClick={onClose}>
+ Cancel
+ </Button>
+ </div>
+ </div>
+ </Dialog.Content>
+ </Dialog>
+ );
+}
+
+interface OptionProps {
+ name: string;
+ description: string;
+ icon: typeof BookOpen01Icon;
+ disabled: boolean;
+ onAdd: () => void;
+}
+
+function SkillOption({
+ name,
+ description,
+ icon,
+ disabled,
+ onAdd,
+}: OptionProps) {
+ return (
+ <li className="flex items-center gap-3 rounded-2xl border border-zinc-200 px-4 py-3">
+ <Icon icon={icon} size={18} className="shrink-0 text-zinc-500" />
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-sm font-medium text-zinc-900">
+ {name}
+ </span>
+ <span className="block truncate text-xs text-zinc-500">
+ {description}
+ </span>
+ </span>
+ <Button
+ variant="secondary"
+ size="small"
+ disabled={disabled}
+ onClick={onAdd}
+ leftIcon={<Icon icon={PlusSignIcon} size={14} />}
+ >
+ Add
+ </Button>
+ </li>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ChainTile.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ChainTile.tsx
new file mode 100644
index 0000000000..81ca4b4c7b
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ChainTile.tsx
@@ -0,0 +1,61 @@
+"use client";
+
+import { ExpertWorkflowChainItem } from "@/app/api/__generated__/models/expertWorkflowChainItem";
+import { ExpertWorkflowChainItemKind } from "@/app/api/__generated__/models/expertWorkflowChainItemKind";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { IntegrationLogo } from "@/components/molecules/IntegrationLogo/IntegrationLogo";
+import { cn } from "@/lib/utils";
+import {
+ AiChat02Icon,
+ FlashIcon,
+ FileExportIcon,
+ InputCursorTextIcon,
+ Plug01Icon,
+ Robot01Icon,
+ UserCheck01Icon,
+} from "@hugeicons/core-free-icons";
+import type { IconSvgElement } from "@hugeicons/react";
+
+const KIND_ICONS: Record<
+ ExpertWorkflowChainItemKind,
+ { icon: IconSvgElement; label: string }
+> = {
+ integration: { icon: Plug01Icon, label: "Integration" },
+ input: { icon: InputCursorTextIcon, label: "Agent input" },
+ output: { icon: FileExportIcon, label: "Agent output" },
+ trigger: { icon: FlashIcon, label: "Trigger" },
+ agent: { icon: Robot01Icon, label: "Agent" },
+ ai: { icon: AiChat02Icon, label: "AI model" },
+ mcp: { icon: Plug01Icon, label: "MCP tool" },
+ human: { icon: UserCheck01Icon, label: "Human review" },
+};
+
+interface Props {
+ item: ExpertWorkflowChainItem;
+ size: "sm" | "md";
+}
+
+export function ChainTile({ item, size }: Props) {
+ const fallback = KIND_ICONS[item.kind];
+ const isSmall = size === "sm";
+ return (
+ <span
+ className={cn(
+ "flex items-center justify-center bg-white ring-1 ring-zinc-200/70",
+ isSmall ? "size-9 rounded-lg" : "size-12 rounded-xl",
+ )}
+ >
+ {item.provider ? (
+ <IntegrationLogo provider={item.provider} size={isSmall ? 16 : 22} />
+ ) : (
+ <Icon
+ icon={fallback.icon}
+ size={isSmall ? 16 : 20}
+ role="img"
+ aria-label={fallback.label}
+ className="text-zinc-600"
+ />
+ )}
+ </span>
+ );
+}
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
new file mode 100644
index 0000000000..201ba689d1
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/CreateScheduleDialog.tsx
@@ -0,0 +1,124 @@
+"use client";
+
+import { useGetV2GetLibraryAgent } from "@/app/api/__generated__/endpoints/library/library";
+import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
+import { okData } from "@/app/api/helpers";
+import { RunAgentModal } from "@/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/modals/RunAgentModal/RunAgentModal";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { Dialog } from "@/components/molecules/Dialog/Dialog";
+import { ArrowRight01Icon, Calendar03Icon } from "@hugeicons/core-free-icons";
+import { useCreateScheduleDialog } from "./useCreateScheduleDialog";
+import { useFitListToDialog } from "./useFitListToDialog";
+
+interface Props {
+ expertId: string;
+ workflows: ExpertWorkflowRef[];
+ open: boolean;
+ onClose: () => void;
+}
+
+export function CreateScheduleDialog({
+ expertId,
+ workflows,
+ open,
+ onClose,
+}: Props) {
+ const { handleScheduleCreated } = useCreateScheduleDialog(expertId, onClose);
+ const schedulable = workflows.filter((workflow) => workflow.library_agent_id);
+ const { attachList } = useFitListToDialog<HTMLUListElement>();
+
+ return (
+ <Dialog
+ controlled={{
+ isOpen: open,
+ set: (next) => {
+ if (!next) onClose();
+ },
+ }}
+ styling={{ maxWidth: "28rem", maxHeight: "60vh" }}
+ title="Create schedule"
+ >
+ <Dialog.Content>
+ <div className="flex flex-col">
+ {schedulable.length === 0 ? (
+ <Text variant="body" className="text-zinc-600">
+ Install a workflow first, then schedule it here.
+ </Text>
+ ) : (
+ <ul
+ ref={attachList}
+ className="flex flex-col gap-2 overflow-y-auto pr-1"
+ aria-label="Schedulable workflows"
+ >
+ {schedulable.map((workflow) => (
+ <li key={workflow.id}>
+ <ScheduleWorkflowRow
+ workflow={workflow}
+ onScheduleCreated={handleScheduleCreated}
+ />
+ </li>
+ ))}
+ </ul>
+ )}
+ <div className="flex justify-end pt-1">
+ <Button variant="secondary" size="small" onClick={onClose}>
+ Cancel
+ </Button>
+ </div>
+ </div>
+ </Dialog.Content>
+ </Dialog>
+ );
+}
+
+interface RowProps {
+ workflow: ExpertWorkflowRef;
+ onScheduleCreated: () => void;
+}
+
+function ScheduleWorkflowRow({ workflow, onScheduleCreated }: RowProps) {
+ const { data: agent } = useGetV2GetLibraryAgent(
+ workflow.library_agent_id ?? "",
+ { query: { select: okData, enabled: Boolean(workflow.library_agent_id) } },
+ );
+ const name = workflow.name ?? "Unnamed workflow";
+ const row = (
+ <button
+ type="button"
+ disabled={!agent}
+ className="flex w-full items-center gap-3 rounded-2xl border border-zinc-200 px-4 py-3 text-left transition-colors hover:bg-zinc-50 disabled:opacity-60"
+ >
+ <Icon
+ icon={Calendar03Icon}
+ size={18}
+ className="shrink-0 text-zinc-500"
+ />
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-sm font-medium text-zinc-900">
+ {name}
+ </span>
+ {workflow.description ? (
+ <span className="block truncate text-xs text-zinc-500">
+ {workflow.description}
+ </span>
+ ) : null}
+ </span>
+ <Icon
+ icon={ArrowRight01Icon}
+ size={16}
+ className="shrink-0 text-zinc-400"
+ />
+ </button>
+ );
+
+ if (!agent) return row;
+ return (
+ <RunAgentModal
+ agent={agent}
+ triggerSlot={row}
+ onScheduleCreated={onScheduleCreated}
+ />
+ );
+}
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 28579bc350..6f09c09354 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,53 +1,45 @@
"use client";
-import { cn } from "@/lib/utils";
-import { useState } from "react";
-import { ArrowDown01Icon } from "@hugeicons/core-free-icons";
-import { Icon } from "@/components/atoms/Icon/Icon";
-import { useClampOverflow } from "./useClampOverflow";
-
interface Props {
- text: string;
+ bio: string | null;
+ identity: string;
+ voicePreferences: string | null;
+ boundaries: string | null;
}
-export function ExpertAboutSection({ text }: Props) {
- const [isExpanded, setIsExpanded] = useState(false);
- const { isOverflowing, measureRef } = useClampOverflow();
- // Once expanded the paragraph no longer overflows, so keep the toggle
- // visible from either signal.
- const showToggle = isOverflowing || isExpanded;
-
+export function ExpertAboutSection({
+ bio,
+ identity,
+ voicePreferences,
+ boundaries,
+}: Props) {
return (
- <section>
- <div className="mb-2.5 text-xs font-medium uppercase tracking-[0.14em] text-zinc-400">
- About
- </div>
- <p
- ref={measureRef}
- className={cn(
- "max-w-prose whitespace-pre-line text-base leading-relaxed text-zinc-600",
- !isExpanded && "line-clamp-4",
- )}
- >
- {text}
- </p>
- {showToggle ? (
- <button
- type="button"
- onClick={() => setIsExpanded((v) => !v)}
- className="mt-2 flex items-center gap-1 text-sm font-medium text-zinc-500 transition-colors hover:text-zinc-900"
- >
- {isExpanded ? "Show less" : "Read more"}
- <Icon
- icon={ArrowDown01Icon}
- size={14}
- className={cn(
- "transition-transform duration-200",
- isExpanded && "rotate-180",
- )}
- />
- </button>
+ <section className="space-y-5">
+ {bio ? (
+ <p className="whitespace-pre-line text-xs text-zinc-600">{bio}</p>
) : null}
+
+ <dl className="space-y-4">
+ <ProfileEntry label="Identity" value={identity} />
+ <ProfileEntry label="Voice" value={voicePreferences} />
+ <ProfileEntry label="Boundaries" value={boundaries} />
+ </dl>
</section>
);
}
+
+interface ProfileEntryProps {
+ label: string;
+ value: string | null;
+}
+
+function ProfileEntry({ label, value }: ProfileEntryProps) {
+ return (
+ <div>
+ <dt className="text-sm font-medium text-zinc-900">{label}</dt>
+ <dd className="mt-1 whitespace-pre-line text-sm text-zinc-600">
+ {value || "Not set yet."}
+ </dd>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertActivityGraph/ExpertActivityGraph.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertActivityGraph/ExpertActivityGraph.tsx
new file mode 100644
index 0000000000..c6a408abaa
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertActivityGraph/ExpertActivityGraph.tsx
@@ -0,0 +1,54 @@
+import { ditherColorsFor } from "@/app/(platform)/raise/components/ColorStep/helpers";
+import { ExpertActivityDay } from "@/app/api/__generated__/models/expertActivityDay";
+import { cn } from "@/lib/utils";
+import { getActivityCells, getActivitySummary } from "./helpers";
+
+const LEVEL_OPACITY = [0, 0.18, 0.34, 0.52, 0.7] as const;
+
+interface Props {
+ days: ExpertActivityDay[];
+ color?: string | null;
+}
+
+export function ExpertActivityGraph({ days, color }: Props) {
+ const cells = getActivityCells(days);
+ const { rangeLabel } = getActivitySummary(days);
+ // The dither ramp's first stop is the -400 shade, dark enough to read at
+ // 25% opacity for the lightest level.
+ const fillColor = ditherColorsFor(color ?? null)?.[0];
+
+ return (
+ <div className="w-full pb-1">
+ <div
+ role="img"
+ aria-label={`Activity over the ${rangeLabel}`}
+ className="grid w-full auto-cols-fr grid-flow-col grid-rows-7 gap-[3px]"
+ data-testid="expert-activity-graph"
+ >
+ {cells.map((cell) =>
+ cell.label === null ? (
+ <span key={cell.key} aria-hidden className="aspect-square w-full" />
+ ) : (
+ <span
+ key={cell.key}
+ title={cell.label}
+ data-level={cell.level}
+ style={
+ cell.level > 0 && fillColor
+ ? {
+ backgroundColor: fillColor,
+ opacity: LEVEL_OPACITY[cell.level],
+ }
+ : undefined
+ }
+ className={cn(
+ "aspect-square w-full rounded-[3px]",
+ cell.level === 0 ? "bg-zinc-100" : !fillColor && "bg-zinc-800",
+ )}
+ />
+ ),
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertActivityGraph/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertActivityGraph/helpers.ts
new file mode 100644
index 0000000000..847eebf04e
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertActivityGraph/helpers.ts
@@ -0,0 +1,135 @@
+import { ExpertActivityDay } from "@/app/api/__generated__/models/expertActivityDay";
+import { format, subDays } from "date-fns";
+
+export const DAYS_PER_WEEK = 7;
+const DAYS_PER_MONTH = 30;
+const THREE_MONTH_DAYS = 90;
+const DAYS_PER_YEAR = 365;
+const RECENT_WINDOW_DAYS = 7;
+const LEVEL_COUNT = 4;
+
+export type ActivityLevel = 0 | 1 | 2 | 3 | 4;
+
+export interface ActivityCell {
+ key: string;
+ level: ActivityLevel;
+ label: string | null;
+}
+
+/** The API declares `day` as a date, which the generated client types as
+ * `Date`, but a bare `YYYY-MM-DD` never passes the mutator's ISO date-time
+ * check so it reaches us as a string. Mock data does round-trip as a Date. */
+function toDayKey(day: ExpertActivityDay["day"]) {
+ return day instanceof Date
+ ? day.toISOString().slice(0, 10)
+ : String(day).slice(0, 10);
+}
+
+function parseDayKey(key: string) {
+ const [year, month, day] = key.split("-").map(Number);
+ return new Date(year, month - 1, day);
+}
+
+export function getYearActivityDays(days: ExpertActivityDay[]) {
+ const lastDay =
+ days.length > 0
+ ? parseDayKey(toDayKey(days[days.length - 1].day))
+ : new Date();
+ const daysByKey = new Map(days.map((day) => [toDayKey(day.day), day]));
+
+ return Array.from({ length: DAYS_PER_YEAR }, (_, index) => {
+ const day = format(
+ subDays(lastDay, DAYS_PER_YEAR - 1 - index),
+ "yyyy-MM-dd",
+ );
+ return (
+ daysByKey.get(day) ?? {
+ day: day as unknown as Date,
+ sessions: 0,
+ runs: 0,
+ }
+ );
+ });
+}
+
+export function getThreeMonthActivityDays(days: ExpertActivityDay[]) {
+ return days.slice(-THREE_MONTH_DAYS);
+}
+
+export function getActivityTotal(day: ExpertActivityDay) {
+ return day.sessions + day.runs;
+}
+
+export function getActivityLevel(total: number, max: number): ActivityLevel {
+ if (total <= 0 || max <= 0) return 0;
+ const level = Math.ceil((total / max) * LEVEL_COUNT);
+ return Math.min(LEVEL_COUNT, Math.max(1, level)) as ActivityLevel;
+}
+
+function pluralize(count: number, noun: string) {
+ return `${count} ${noun}${count === 1 ? "" : "s"}`;
+}
+
+export function describeActivityDay(day: ExpertActivityDay) {
+ const when = format(parseDayKey(toDayKey(day.day)), "MMM d");
+ const parts = [
+ day.sessions > 0 ? pluralize(day.sessions, "session") : null,
+ day.runs > 0 ? pluralize(day.runs, "run") : null,
+ ].filter(Boolean);
+ return parts.length > 0
+ ? `${parts.join(", ")} on ${when}`
+ : `No activity on ${when}`;
+}
+
+/** Cells in column-major order for a Sunday-first week grid: blank leading
+ * cells pad the first column so every column starts on a Sunday. */
+export function getActivityCells(days: ExpertActivityDay[]): ActivityCell[] {
+ if (days.length === 0) return [];
+ const max = Math.max(...days.map(getActivityTotal));
+ const leadingBlanks = parseDayKey(toDayKey(days[0].day)).getDay();
+ const padding = Array.from({ length: leadingBlanks }, (_, index) => ({
+ key: `pad-${index}`,
+ level: 0 as ActivityLevel,
+ label: null,
+ }));
+ return [
+ ...padding,
+ ...days.map((day) => ({
+ key: toDayKey(day.day),
+ level: getActivityLevel(getActivityTotal(day), max),
+ label: describeActivityDay(day),
+ })),
+ ];
+}
+
+export function getActivitySummary(days: ExpertActivityDay[]) {
+ const recent = days.slice(-RECENT_WINDOW_DAYS);
+ const sessions = days.reduce((total, day) => total + day.sessions, 0);
+ const runs = days.reduce((total, day) => total + day.runs, 0);
+ const weeks = Math.max(1, Math.round(days.length / DAYS_PER_WEEK));
+ return {
+ isActive: recent.some((day) => getActivityTotal(day) > 0),
+ rangeLabel:
+ days.length >= DAYS_PER_YEAR
+ ? "last year"
+ : days.length >= THREE_MONTH_DAYS
+ ? "last 3 months"
+ : days.length >= DAYS_PER_MONTH
+ ? "last month"
+ : `last ${weeks} weeks`,
+ totalsLabel: `${pluralize(sessions, "session")} · ${pluralize(runs, "run")}`,
+ };
+}
+
+export function getActivityStreak(days: ExpertActivityDay[]) {
+ let index = days.length - 1;
+ if (index < 0) return 0;
+ if (getActivityTotal(days[index]) === 0) index -= 1;
+
+ let streak = 0;
+ while (index >= 0 && getActivityTotal(days[index]) > 0) {
+ streak += 1;
+ index -= 1;
+ }
+ return streak;
+}
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
new file mode 100644
index 0000000000..5ec34d68de
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/ExpertAvatarButton.tsx
@@ -0,0 +1,87 @@
+"use client";
+
+import { Expert } from "@/app/api/__generated__/models/expert";
+import {
+ Avatar,
+ AvatarFallback,
+ AvatarImage,
+} from "@/components/atoms/Avatar/Avatar";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import {
+ Camera01Icon,
+ Loading03Icon,
+ PencilIcon,
+} from "@hugeicons/core-free-icons";
+import { ChangeEvent, useRef } from "react";
+import { useExpertAvatarButton } from "./useExpertAvatarButton";
+
+interface Props {
+ expert: Expert;
+}
+
+export function ExpertAvatarButton({ expert }: Props) {
+ const fileRef = useRef<HTMLInputElement>(null);
+ const { uploadAvatar, isUploading } = useExpertAvatarButton(expert.id);
+
+ function openFilePicker() {
+ if (isUploading) return;
+ fileRef.current?.click();
+ }
+
+ async function handleChange(event: ChangeEvent<HTMLInputElement>) {
+ const file = event.target.files?.[0];
+ event.target.value = "";
+ if (file) await uploadAvatar(file);
+ }
+
+ return (
+ <>
+ <button
+ type="button"
+ onClick={openFilePicker}
+ disabled={isUploading}
+ aria-label={`Change ${expert.name}'s photo`}
+ className="group relative size-24 shrink-0 cursor-pointer rounded-full outline-none transition-transform duration-150 ease-out focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:scale-[0.97] disabled:cursor-wait"
+ >
+ <Avatar className="size-24 bg-background ring-4 ring-background">
+ {expert.avatar_url ? (
+ <AvatarImage
+ src={expert.avatar_url}
+ alt={expert.name}
+ width={192}
+ height={192}
+ />
+ ) : null}
+ <AvatarFallback>{expert.name}</AvatarFallback>
+ </Avatar>
+
+ <span
+ aria-hidden
+ data-uploading={isUploading || undefined}
+ className="pointer-events-none absolute inset-0 flex items-center justify-center rounded-full bg-foreground/45 text-background opacity-0 backdrop-blur-[2px] transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100 data-[uploading]:opacity-100"
+ >
+ {isUploading ? (
+ <Icon icon={Loading03Icon} size={20} className="animate-spin" />
+ ) : (
+ <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}
+ type="file"
+ aria-label={`Upload ${expert.name} photo`}
+ accept="image/png,image/jpeg,image/webp,image/gif"
+ className="hidden"
+ onChange={handleChange}
+ />
+ </>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/useExpertAvatarButton.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/useExpertAvatarButton.ts
new file mode 100644
index 0000000000..0606e09d7c
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertAvatarButton/useExpertAvatarButton.ts
@@ -0,0 +1,55 @@
+import {
+ getGetExpertQueryKey,
+ getListExpertsQueryKey,
+ useUpdateExpertAvatar,
+} from "@/app/api/__generated__/endpoints/experts/experts";
+import { useToast } from "@/components/molecules/Toast/use-toast";
+import {
+ isFileTooLarge,
+ SUBMISSION_MEDIA_MAX_SIZE_MB,
+ uploadSubmissionMediaDirect,
+} from "@/lib/direct-upload";
+import { useQueryClient } from "@tanstack/react-query";
+import { useState } from "react";
+
+export function useExpertAvatarButton(expertId: string) {
+ const queryClient = useQueryClient();
+ const { toast } = useToast();
+ const [isUploading, setIsUploading] = useState(false);
+
+ const { mutateAsync: updateAvatar } = useUpdateExpertAvatar({
+ mutation: {
+ onSuccess: () => {
+ queryClient.invalidateQueries({
+ queryKey: getGetExpertQueryKey(expertId),
+ });
+ queryClient.invalidateQueries({ queryKey: getListExpertsQueryKey() });
+ },
+ },
+ });
+
+ async function uploadAvatar(file: File) {
+ if (
+ isFileTooLarge({ file, maxSizeMB: SUBMISSION_MEDIA_MAX_SIZE_MB, toast })
+ )
+ return;
+
+ setIsUploading(true);
+ try {
+ const url = (await uploadSubmissionMediaDirect(file)).trim();
+ if (!url) throw new Error("Upload returned no URL");
+ await updateAvatar({ expertId, data: { avatar_url: url } });
+ toast({ title: "Photo updated", variant: "success" });
+ } catch (error) {
+ toast({
+ title: "Failed to update photo",
+ description: error instanceof Error ? error.message : undefined,
+ variant: "destructive",
+ });
+ } finally {
+ setIsUploading(false);
+ }
+ }
+
+ return { uploadAvatar, isUploading };
+}
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
new file mode 100644
index 0000000000..b7d8cd1fa5
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertBudgetSection.tsx
@@ -0,0 +1,41 @@
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { Text } from "@/components/atoms/Text/Text";
+import { creditsToUsdLabel } from "@/lib/credits";
+import { SpendMeter } from "../../components/ExpertTeamCard/components/SpendMeter";
+import { getWeeklySpend } from "../../helpers";
+
+interface Props {
+ expert: Expert;
+}
+
+export function ExpertBudgetSection({ expert }: Props) {
+ const weeklySpend = getWeeklySpend(expert);
+
+ return (
+ <section
+ aria-label={`${expert.name} budget`}
+ className="flex w-full flex-col gap-1.5 lg:w-1/2"
+ >
+ <div className="flex items-baseline justify-between gap-2">
+ <Text variant="body-medium" className="text-sm text-zinc-700">
+ Budget
+ </Text>
+ <Text
+ variant="body-medium"
+ unmask={false}
+ className="text-sm tabular-nums text-zinc-700"
+ >
+ {weeklySpend
+ ? `${creditsToUsdLabel(weeklySpend.spent)} / ${creditsToUsdLabel(weeklySpend.budget)}`
+ : "No budget"}
+ </Text>
+ </div>
+ <SpendMeter
+ spent={weeklySpend?.spent ?? 0}
+ budget={weeklySpend?.budget ?? 1}
+ color={expert.color}
+ muted={!weeklySpend}
+ />
+ </section>
+ );
+}
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
new file mode 100644
index 0000000000..8755db5489
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertDetailHeader.tsx
@@ -0,0 +1,71 @@
+"use client";
+
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { cn } from "@/lib/utils";
+import { PencilEdit02Icon } from "@hugeicons/core-free-icons";
+import { getRaisedExpertAccent } from "@/app/(platform)/marketplace/components/ExpertsSection/helpers";
+import { ExpertCover } from "../../components/ExpertTeamCard/components/ExpertCover";
+import { ExpertAvatarButton } from "./ExpertAvatarButton/ExpertAvatarButton";
+import { ACTION_BUTTON_CLASS } from "@/app/(platform)/team/helpers";
+
+interface Props {
+ expert: Expert;
+ onEditSoul: () => void;
+}
+
+export function ExpertDetailHeader({ expert, onEditSoul }: Props) {
+ const accent = getRaisedExpertAccent(expert.role, expert.color);
+
+ return (
+ <header>
+ <ExpertCover className="h-36" color={expert.color} />
+
+ <div className="flex flex-col gap-4 sm:flex-row sm:items-center">
+ <span className="-mt-12 ml-14 block shrink-0">
+ <ExpertAvatarButton expert={expert} />
+ </span>
+ <div className="min-w-0 flex-1">
+ <div className="flex flex-wrap items-center gap-3">
+ <h1 className="text-2xl font-semibold tracking-[-0.02em] text-zinc-900">
+ {expert.name}
+ </h1>
+ <span
+ className={cn(
+ "inline-flex items-center gap-1.5 rounded-md px-2.5 py-0.5 text-sm font-medium",
+ accent.pill,
+ )}
+ >
+ <Icon icon={accent.roleIcon} size={14} />
+ {expert.role}
+ </span>
+ </div>
+ {expert.tagline ? (
+ <p className="mt-1 text-sm text-zinc-500">{expert.tagline}</p>
+ ) : null}
+ </div>
+ <div className="flex shrink-0 items-center gap-2">
+ <Button
+ variant="secondary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ leftIcon={<Icon icon={PencilEdit02Icon} size={14} />}
+ onClick={onEditSoul}
+ >
+ Edit Soul
+ </Button>
+ <Button
+ as="NextLink"
+ href={`/copilot?expertId=${expert.id}`}
+ variant="primary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ >
+ Chat
+ </Button>
+ </div>
+ </div>
+ </header>
+ );
+}
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
new file mode 100644
index 0000000000..150b93e5c7
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertConnectServiceDialog.tsx
@@ -0,0 +1,247 @@
+"use client";
+
+import type { CredentialsMetaResponse } from "@/app/api/__generated__/models/credentialsMetaResponse";
+import { ConnectProviderRow } from "@/app/(platform)/copilot/components/OnboardingWelcomeDialog/ConnectProviderRow";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
+import { Text } from "@/components/atoms/Text/Text";
+import { ConnectMethodView } from "@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/ConnectMethodView/ConnectMethodView";
+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";
+import { Dialog } from "@/components/molecules/Dialog/Dialog";
+import { cn } from "@/lib/utils";
+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
+import { useMeasuredHeight } from "@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/useMeasuredHeight";
+import { Plug01Icon } from "@hugeicons/core-free-icons";
+import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
+import { useBottomScrollShadow } from "../../../components/SoulDrawer/useBottomScrollShadow";
+import { useFitListToDialog } from "../useFitListToDialog";
+import { useExpertConnectServiceDialog } from "./useExpertConnectServiceDialog";
+
+const STEP_TRANSITION = { duration: 0.15, ease: [0, 0, 0.2, 1] as const };
+const HEIGHT_TRANSITION = { duration: 0.2, ease: [0, 0, 0.2, 1] as const };
+
+const stepVariants = {
+ initial: (direction: number) => ({ x: 16 * direction, opacity: 0 }),
+ active: { x: 0, opacity: 1 },
+ exit: (direction: number) => ({ x: -16 * direction, opacity: 0 }),
+};
+
+const reducedVariants = {
+ initial: { opacity: 0 },
+ active: { opacity: 1 },
+ exit: { opacity: 0 },
+};
+
+interface Props {
+ open: boolean;
+ expertName: string;
+ onClose: () => void;
+ onConnected: (credential: CredentialsMetaResponse) => void;
+}
+
+/** The welcome dialog's "Connect your tools" panel, minus the recommendations:
+ * every service is listed, and a successful connect hands the credential
+ * back so the expert is granted it. */
+export function ExpertConnectServiceDialog({
+ open,
+ expertName,
+ onClose,
+ onConnected,
+}: Props) {
+ const {
+ query,
+ setQuery,
+ providers,
+ isLoading,
+ isError,
+ refetch,
+ selectedProvider,
+ direction,
+ connectedProviders,
+ selectedMethod,
+ setSelectedMethod,
+ apiKeyForm,
+ handleApiKeySubmit,
+ showContinue,
+ isContinueDisabled,
+ isConnecting,
+ handleSelect,
+ handleBackToList,
+ handleContinue,
+ handleSuccess,
+ } = useExpertConnectServiceDialog({ open, onConnected });
+ const reduceMotion = useReducedMotion();
+ const variants = reduceMotion ? reducedVariants : stepVariants;
+ const [contentRef, contentHeight] = useMeasuredHeight<HTMLDivElement>();
+ const { attachList, list } = useFitListToDialog<HTMLUListElement>();
+ const hasMoreBelow = useBottomScrollShadow(list);
+
+ return (
+ <Dialog
+ styling={{ maxWidth: "40rem", maxHeight: "60vh" }}
+ controlled={{
+ isOpen: open,
+ set: (next) => {
+ if (!next && !isConnecting) onClose();
+ },
+ }}
+ >
+ <Dialog.Content>
+ <div className="flex flex-col gap-4">
+ <motion.div
+ className="relative overflow-hidden"
+ animate={{ height: contentHeight ?? "auto" }}
+ transition={reduceMotion ? { duration: 0 } : HEIGHT_TRANSITION}
+ >
+ <div ref={contentRef}>
+ <AnimatePresence mode="wait" initial={false} custom={direction}>
+ {selectedProvider ? (
+ <motion.div
+ key={`detail-${selectedProvider.id}`}
+ custom={direction}
+ variants={variants}
+ initial="initial"
+ animate="active"
+ exit="exit"
+ transition={STEP_TRANSITION}
+ >
+ <ConnectMethodView
+ provider={selectedProvider}
+ selectedMethod={selectedMethod}
+ onSelectMethod={setSelectedMethod}
+ apiKeyForm={apiKeyForm}
+ onApiKeySubmit={handleApiKeySubmit}
+ onDeviceAuthSuccess={handleSuccess}
+ />
+ </motion.div>
+ ) : (
+ <motion.div
+ key="list"
+ custom={direction}
+ variants={variants}
+ initial="initial"
+ animate="active"
+ exit="exit"
+ transition={STEP_TRANSITION}
+ className="flex flex-col gap-4"
+ >
+ <div className="flex flex-col gap-1">
+ <Text
+ variant="h3"
+ className="!text-[1.25rem] text-zinc-900"
+ >
+ Connect a service for {expertName}
+ </Text>
+ <Text variant="small" className="!text-zinc-500">
+ Pick a service to connect. {expertName} will be able to
+ use it on your behalf.
+ </Text>
+ </div>
+ {isLoading ? (
+ <div className="grid grid-cols-2 gap-2">
+ {[0, 1, 2, 3].map((row) => (
+ <Skeleton
+ key={row}
+ className="h-14 w-full rounded-xl"
+ />
+ ))}
+ </div>
+ ) : isError ? (
+ <ErrorCard
+ context="services"
+ hint="We could not load the services you can connect."
+ onRetry={() => refetch()}
+ />
+ ) : (
+ <div className="flex flex-col gap-3">
+ <SearchInput
+ value={query}
+ onChange={setQuery}
+ placeholder="Search services..."
+ aria-label="Search services"
+ />
+ {providers.length === 0 ? (
+ <div className="flex flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-[#DADADC] py-8 text-center">
+ <Icon
+ icon={Plug01Icon}
+ size={24}
+ className="text-[#83838C]"
+ />
+ <Text variant="body" className="text-[#505057]">
+ {query.trim()
+ ? `No services match "${query.trim()}"`
+ : "No services available."}
+ </Text>
+ </div>
+ ) : (
+ <div className="relative">
+ <ul
+ ref={attachList}
+ className="grid grid-cols-2 gap-2 overflow-y-auto pr-1"
+ aria-label="Services"
+ >
+ {providers.map((provider) => (
+ <li key={provider.id}>
+ <ConnectProviderRow
+ provider={provider}
+ onSelect={handleSelect}
+ isConnected={connectedProviders.has(
+ provider.id,
+ )}
+ />
+ </li>
+ ))}
+ </ul>
+
+ <div
+ aria-hidden="true"
+ className={cn(
+ "pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-white to-transparent transition-opacity duration-200",
+
+ hasMoreBelow ? "opacity-100" : "opacity-0",
+ )}
+ />
+ </div>
+ )}
+ </div>
+ )}
+ </motion.div>
+ )}
+ </AnimatePresence>
+ </div>
+ </motion.div>
+
+ <div className="flex items-center justify-end gap-3">
+ {selectedProvider ? (
+ <>
+ <Button
+ variant="secondary"
+ size="small"
+ onClick={handleBackToList}
+ >
+ Back
+ </Button>
+ {showContinue ? (
+ <Button
+ variant="primary"
+ size="small"
+ disabled={isContinueDisabled}
+ loading={isConnecting}
+ onClick={handleContinue}
+ >
+ {isConnecting ? "Connecting…" : "Continue"}
+ </Button>
+ ) : null}
+ </>
+ ) : (
+ <Button variant="secondary" size="small" onClick={onClose}>
+ Cancel
+ </Button>
+ )}
+ </div>
+ </div>
+ </Dialog.Content>
+ </Dialog>
+ );
+}
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
new file mode 100644
index 0000000000..40fc3b1bb0
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/ExpertIntegrationGroups.tsx
@@ -0,0 +1,198 @@
+"use client";
+
+import { ExpertCredentialRef } from "@/app/api/__generated__/models/expertCredentialRef";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import {
+ formatCredentialName,
+ formatCredentialSource,
+ formatProviderName,
+} from "@/components/contextual/IntegrationsPanel/helpers";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from "@/components/molecules/Accordion/Accordion";
+import { IntegrationLogo } from "@/components/molecules/IntegrationLogo/IntegrationLogo";
+import { Delete02Icon, Loading03Icon } from "@hugeicons/core-free-icons";
+import { motion, useReducedMotion, type Variants } from "framer-motion";
+
+const TYPE_LABELS: Record<string, string> = {
+ api_key: "API Key",
+ oauth2: "OAuth",
+ user_password: "Username & password",
+ host_scoped: "Host",
+ device_code: "Device auth",
+};
+
+const CONNECTION_LABELS: Record<string, string> = {
+ api_key: "API key configured",
+ oauth2: "Connected via OAuth",
+ user_password: "Username/password set",
+ host_scoped: "Host configured",
+ device_code: "Connected via device auth",
+};
+
+function formatConnection(integration: ExpertCredentialRef): string {
+ if (integration.provider === "mcp") return formatCredentialSource("mcp");
+ return CONNECTION_LABELS[integration.type] ?? "Configured";
+}
+
+const CONTAINER_VARIANTS: Variants = {
+ hidden: {},
+ show: { transition: { staggerChildren: 0.08, delayChildren: 0.05 } },
+};
+const ITEM_VARIANTS: Variants = {
+ hidden: { opacity: 0, y: 16 },
+ show: {
+ opacity: 1,
+ y: 0,
+ transition: { duration: 0.3, ease: [0.16, 1, 0.3, 1] },
+ },
+};
+const REDUCED_ITEM_VARIANTS: Variants = {
+ hidden: { opacity: 0 },
+ show: { opacity: 1 },
+};
+
+interface Group {
+ id: string;
+ name: string;
+ integrations: ExpertCredentialRef[];
+}
+
+export function groupExpertIntegrations(
+ integrations: ExpertCredentialRef[],
+): Group[] {
+ const byProvider = new Map<string, ExpertCredentialRef[]>();
+ for (const integration of integrations) {
+ const id =
+ integration.provider === "codex" ? "openai" : integration.provider;
+ byProvider.set(id, [...(byProvider.get(id) ?? []), integration]);
+ }
+ return [...byProvider.entries()]
+ .map(([id, list]) => ({
+ id,
+ name: formatProviderName(id),
+ integrations: list,
+ }))
+ .sort((a, b) => a.name.localeCompare(b.name));
+}
+
+interface Props {
+ integrations: ExpertCredentialRef[];
+ isRemoving: boolean;
+ onRemove: (credentialId: string) => void;
+}
+
+export function ExpertIntegrationGroups({
+ integrations,
+ isRemoving,
+ onRemove,
+}: Props) {
+ const reduceMotion = useReducedMotion();
+ const groups = groupExpertIntegrations(integrations);
+
+ return (
+ <motion.div
+ className="flex flex-col gap-3"
+ variants={CONTAINER_VARIANTS}
+ initial="hidden"
+ animate="show"
+ >
+ {groups.map((group) => (
+ <motion.div
+ key={group.id}
+ variants={reduceMotion ? REDUCED_ITEM_VARIANTS : ITEM_VARIANTS}
+ >
+ <Accordion
+ type="single"
+ collapsible
+ defaultValue={group.id}
+ className="w-full overflow-hidden rounded-xl border border-[#DADADC] bg-white"
+ >
+ <AccordionItem value={group.id} className="border-b-0">
+ <AccordionTrigger className="px-3 py-3 pr-5 hover:no-underline [&>svg]:text-[#1F1F20]">
+ <div className="flex items-center gap-3">
+ <IntegrationLogo
+ provider={group.id}
+ alt={`${group.name} logo`}
+ size={24}
+ className="rounded-full bg-white"
+ />
+ <span className="text-[16px] font-medium leading-[26px] tracking-[-0.08px] text-black">
+ {group.name}
+ </span>
+ <span className="inline-flex items-center justify-center rounded-md bg-[#EFF1F4] px-2 py-[2px] text-[14px] font-medium leading-[22px] text-black">
+ {group.integrations.length}
+ </span>
+ </div>
+ </AccordionTrigger>
+ <AccordionContent className="px-0 pb-0 pt-0">
+ <div className="flex flex-col divide-y divide-[#DADADC] border-t border-[#DADADC]">
+ {group.integrations.map((integration) => (
+ <ExpertIntegrationRow
+ key={integration.credential_id}
+ integration={integration}
+ isRemoving={isRemoving}
+ onRemove={() => onRemove(integration.credential_id)}
+ />
+ ))}
+ </div>
+ </AccordionContent>
+ </AccordionItem>
+ </Accordion>
+ </motion.div>
+ ))}
+ </motion.div>
+ );
+}
+
+interface RowProps {
+ integration: ExpertCredentialRef;
+ isRemoving: boolean;
+ onRemove: () => void;
+}
+
+function ExpertIntegrationRow({ integration, isRemoving, onRemove }: RowProps) {
+ const name = formatCredentialName(integration.title, integration.provider);
+ return (
+ <div
+ className="flex w-full items-center justify-between py-3 pl-4 pr-5"
+ data-testid="expert-integration-row"
+ >
+ <div className="flex flex-col gap-1">
+ <div className="flex items-center gap-3">
+ <span className="text-[14px] font-medium leading-[22px] text-[#1F1F20]">
+ {name}
+ </span>
+ <span className="inline-flex items-center justify-center rounded-md bg-[#EFF1F4] px-2 py-[2px] text-[12px] font-medium leading-[20px] text-[#505057]">
+ {TYPE_LABELS[integration.type] ?? integration.type}
+ </span>
+ </div>
+ <span className="text-[11px] font-medium uppercase tracking-[1.1px] text-[#505057]">
+ {formatConnection(integration)}
+ </span>
+ </div>
+ <div className="flex items-center gap-4">
+ <span className="text-[11px] font-medium uppercase tracking-[1.1px] text-emerald-600">
+ Ready
+ </span>
+ <button
+ type="button"
+ onClick={onRemove}
+ disabled={isRemoving}
+ aria-busy={isRemoving}
+ aria-label={`Remove ${name}`}
+ className="inline-flex size-5 items-center justify-center text-[#1F1F20] transition-colors hover:text-red-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-purple-400 disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ {isRemoving ? (
+ <Icon icon={Loading03Icon} size={20} className="animate-spin" />
+ ) : (
+ <Icon icon={Delete02Icon} size={20} />
+ )}
+ </button>
+ </div>
+ </div>
+ );
+}
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 e0341ec703..6db51afbd2 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
@@ -1,52 +1,41 @@
"use client";
-import {
- Avatar,
- AvatarFallback,
- AvatarImage,
-} from "@/components/atoms/Avatar/Avatar";
-import { Badge } from "@/components/atoms/Badge/Badge";
import { Button } from "@/components/atoms/Button/Button";
import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
import { Icon } from "@/components/atoms/Icon/Icon";
-import { ConnectServiceDialog } from "@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/ConnectServiceDialog";
-import {
- formatCredentialName,
- formatCredentialSource,
- formatProviderName,
-} from "@/components/contextual/IntegrationsPanel/helpers";
-import { IntegrationLogo } from "@/components/molecules/IntegrationLogo/IntegrationLogo";
+import { Text } from "@/components/atoms/Text/Text";
+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";
+import { useState } from "react";
+import { ExpertConnectServiceDialog } from "./ExpertConnectServiceDialog";
+import { ExpertIntegrationGroups } from "./ExpertIntegrationGroups";
+import { UseExistingCredentialsDialog } from "./UseExistingCredentialsDialog";
+import { PlusSignIcon, Share01Icon } from "@hugeicons/core-free-icons";
import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/components/molecules/Popover/Popover";
-import { Delete02Icon, PlusSignIcon } from "@hugeicons/core-free-icons";
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/atoms/Tooltip/BaseTooltip";
import { useExpertIntegrationsSection } from "./useExpertIntegrationsSection";
+import { ACTION_BUTTON_CLASS } from "@/app/(platform)/team/helpers";
interface Props {
expertId: string;
expertName: string;
- expertAvatarUrl: string | null;
}
-export function ExpertIntegrationsSection({
- expertId,
- expertName,
- expertAvatarUrl,
-}: Props) {
+export function ExpertIntegrationsSection({ expertId, expertName }: Props) {
const {
granted,
grantable,
- isAdding,
- openAdd,
- closeAdd,
isConnecting,
+ isUsingExisting,
+ openUseExisting,
+ closeUseExisting,
openConnect,
closeConnect,
connectCredential,
- addIntegration,
+ grantExistingCredential,
removeIntegration,
isGranting,
isRevoking,
@@ -56,90 +45,73 @@ export function ExpertIntegrationsSection({
isGrantableError,
refetch,
} = useExpertIntegrationsSection(expertId);
+ const [query, setQuery] = useState("");
+ const needle = query.trim().toLowerCase();
+ const visible = needle
+ ? granted.filter((integration) =>
+ `${integration.title} ${integration.provider}`
+ .toLowerCase()
+ .includes(needle),
+ )
+ : granted;
return (
<section data-testid="expert-integrations-section">
- <div className="mb-2.5 flex items-center justify-between">
- <div className="text-xs font-medium uppercase tracking-[0.14em] text-zinc-400">
- Integrations
- </div>
- <Popover
- open={isAdding}
- onOpenChange={(open) => (open ? openAdd() : closeAdd())}
- >
- <PopoverTrigger asChild>
- <Button
- variant="ghost"
- size="small"
- leftIcon={<Icon icon={PlusSignIcon} size={16} />}
- >
- Add integration
- </Button>
- </PopoverTrigger>
- <PopoverContent align="end" className="w-72 p-2">
- {isGrantableLoading ? (
- <div className="flex flex-col gap-2 p-2">
- <Skeleton className="h-8 w-full" />
- <Skeleton className="h-8 w-full" />
- </div>
+ <div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">
+ <Text variant="large-medium">{expertName}&apos;s Integrations</Text>
+ <div className="flex items-center gap-2">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span>
+ <Button
+ variant="secondary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ leftIcon={<Icon icon={Share01Icon} size={14} />}
+ disabled={
+ grantable.length === 0 || isError || isGrantableError
+ }
+ onClick={openUseExisting}
+ >
+ Use existing
+ </Button>
+ </span>
+ </TooltipTrigger>
+ {isError ? (
+ <TooltipContent side="bottom">
+ Couldn&apos;t load what {expertName} already has.
+ </TooltipContent>
) : isGrantableError ? (
- <p className="px-2 py-3 text-sm text-zinc-500">
+ <TooltipContent side="bottom">
Couldn&apos;t load your services.
- </p>
- ) : isError ? (
- <p className="px-2 py-3 text-sm text-zinc-500">
- Couldn&apos;t load what {expertName} already has.
- </p>
- ) : grantable.length === 0 ? (
- <p className="px-2 py-3 text-sm text-zinc-500">
- {granted.length === 0
- ? "Nothing connected yet."
- : `${expertName} can already use everything you've connected.`}
- </p>
- ) : (
- <ul className="max-h-72 overflow-y-auto">
- {grantable.map((credential) => (
- <li key={credential.id}>
- <button
- type="button"
- disabled={isGranting}
- className="flex w-full items-center gap-2 rounded-md px-2 py-2 text-left hover:bg-zinc-50 disabled:opacity-50"
- onClick={() => addIntegration(credential.id)}
- >
- <IntegrationLogo provider={credential.provider} />
- <span className="min-w-0 flex-1 truncate text-sm text-zinc-700">
- {credential.title
- ? formatCredentialName(
- credential.title,
- credential.provider,
- )
- : formatProviderName(credential.provider)}
- </span>
- </button>
- </li>
- ))}
- </ul>
- )}
-
- <div className="mt-1 border-t border-zinc-100 pt-1">
- <button
- type="button"
- disabled={isGranting}
- className="flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm text-zinc-700 hover:bg-zinc-50 disabled:opacity-50"
- onClick={openConnect}
- >
- <span className="flex size-6 shrink-0 items-center justify-center rounded-md bg-zinc-100 text-zinc-500">
- <Icon icon={PlusSignIcon} size={14} />
- </span>
- Connect a new service…
- </button>
- </div>
- </PopoverContent>
- </Popover>
+ </TooltipContent>
+ ) : grantable.length === 0 && !isGrantableLoading ? (
+ <TooltipContent side="bottom">
+ {expertName} can already use everything in your account.
+ </TooltipContent>
+ ) : null}
+ </Tooltip>
+ <Button
+ variant="secondary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ leftIcon={<Icon icon={PlusSignIcon} size={14} />}
+ onClick={openConnect}
+ >
+ Add integration
+ </Button>
+ <SearchInput
+ size="xsmall"
+ value={query}
+ onChange={setQuery}
+ placeholder="Search integrations"
+ className="w-48"
+ />
+ </div>
</div>
{isLoading ? (
- <Skeleton className="h-24 w-full rounded-xl" />
+ <Skeleton className="h-24 w-full rounded-lg" />
) : isError ? (
<ErrorCard
context="this expert's integrations"
@@ -151,65 +123,36 @@ export function ExpertIntegrationsSection({
Nothing connected yet. Add a tool and {expertName} can use it on your
behalf.
</p>
+ ) : visible.length === 0 ? (
+ <p className="pt-4 text-sm text-zinc-500">No integrations match.</p>
) : (
- <div className="divide-y divide-zinc-100 rounded-xl border border-zinc-200/80 bg-white">
- {granted.map((integration) => {
- const name = formatCredentialName(
- integration.title,
- integration.provider,
- );
- return (
- <div
- key={integration.credential_id}
- className="flex items-center gap-3 px-4 py-3"
- data-testid="expert-integration-row"
- >
- <IntegrationLogo provider={integration.provider} size={18} />
- <div className="min-w-0 flex-1">
- <div className="truncate text-[15px] font-medium text-zinc-800">
- {name}
- </div>
- <div className="text-[13px] text-zinc-500">
- {formatCredentialSource(integration.provider)}
- </div>
- </div>
- <Badge variant="success" size="small">
- Ready
- </Badge>
- <Button
- variant="ghost"
- size="small"
- disabled={isRevoking}
- aria-label={`Remove ${name}`}
- leftIcon={<Icon icon={Delete02Icon} size={16} />}
- onClick={() => removeIntegration(integration.credential_id)}
- >
- Remove
- </Button>
- </div>
- );
- })}
- </div>
+ <ExpertIntegrationGroups
+ integrations={visible}
+ isRemoving={isRevoking}
+ onRemove={removeIntegration}
+ />
)}
- <ConnectServiceDialog
+ <UseExistingCredentialsDialog
+ open={isUsingExisting}
+ expertName={expertName}
+ credentials={grantable}
+ isGranting={isGranting}
+ onUse={(credentialId) => {
+ grantExistingCredential(credentialId);
+ closeUseExisting();
+ }}
+ onClose={closeUseExisting}
+ />
+
+ <ExpertConnectServiceDialog
open={isConnecting}
- onOpenChange={(open) => {
- if (!open) closeConnect();
+ expertName={expertName}
+ onClose={closeConnect}
+ onConnected={(credential) => {
+ connectCredential(credential);
+ closeConnect();
}}
- title={
- <span className="flex items-center gap-2.5">
- <Avatar className="size-7">
- {expertAvatarUrl ? (
- <AvatarImage src={expertAvatarUrl} alt="" />
- ) : null}
- <AvatarFallback>{expertName}</AvatarFallback>
- </Avatar>
- Connect a service for {expertName}
- </span>
- }
- description={`Pick a service to connect. ${expertName} will be able to use it on your behalf.`}
- onConnected={connectCredential}
/>
</section>
);
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
new file mode 100644
index 0000000000..9bc2f9ff87
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/UseExistingCredentialsDialog.tsx
@@ -0,0 +1,235 @@
+"use client";
+
+import type { CredentialsMetaResponse } from "@/app/api/__generated__/models/credentialsMetaResponse";
+import { ConnectProviderRow } from "@/app/(platform)/copilot/components/OnboardingWelcomeDialog/ConnectProviderRow";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import {
+ formatCredentialName,
+ formatProviderName,
+} from "@/components/contextual/IntegrationsPanel/helpers";
+import type { ConnectableProvider } from "@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/helpers";
+import { Dialog } from "@/components/molecules/Dialog/Dialog";
+import { IntegrationLogo } from "@/components/molecules/IntegrationLogo/IntegrationLogo";
+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";
+import { ArrowLeft02Icon } from "@hugeicons/core-free-icons";
+import { cn } from "@/lib/utils";
+import { useEffect, useState } from "react";
+import { useBottomScrollShadow } from "../../../components/SoulDrawer/useBottomScrollShadow";
+import { useFitListToDialog } from "../useFitListToDialog";
+
+interface Props {
+ open: boolean;
+ expertName: string;
+ credentials: CredentialsMetaResponse[];
+ isGranting: boolean;
+ onUse: (credentialId: string) => void;
+ onClose: () => void;
+}
+
+interface ProviderGroup {
+ provider: ConnectableProvider;
+ credentials: CredentialsMetaResponse[];
+}
+
+function groupByProvider(
+ credentials: CredentialsMetaResponse[],
+): ProviderGroup[] {
+ const groups = new Map<string, CredentialsMetaResponse[]>();
+ for (const credential of credentials) {
+ groups.set(credential.provider, [
+ ...(groups.get(credential.provider) ?? []),
+ credential,
+ ]);
+ }
+ return [...groups.entries()]
+ .map(([id, list]) => ({
+ provider: { id, name: formatProviderName(id), supportedAuthTypes: [] },
+ credentials: list,
+ }))
+ .sort((a, b) => a.provider.name.localeCompare(b.provider.name));
+}
+
+/** Credentials already on your account that this expert cannot use yet,
+ * grouped like the connect picker. A provider with one credential grants
+ * on click; with several, a second step asks which one. */
+export function UseExistingCredentialsDialog({
+ open,
+ expertName,
+ credentials,
+ isGranting,
+ onUse,
+ onClose,
+}: Props) {
+ const [query, setQuery] = useState("");
+ const [selectedProvider, setSelectedProvider] = useState<string | null>(null);
+ const { attachList, list } = useFitListToDialog<HTMLUListElement>();
+ const hasMoreBelow = useBottomScrollShadow(list);
+
+ useEffect(() => {
+ if (!open) {
+ setQuery("");
+ setSelectedProvider(null);
+ }
+ }, [open]);
+
+ const needle = query.trim().toLowerCase();
+ const groups = groupByProvider(credentials).filter(
+ (group) =>
+ !needle ||
+ group.provider.name.toLowerCase().includes(needle) ||
+ group.credentials.some((credential) =>
+ (credential.title ?? "").toLowerCase().includes(needle),
+ ),
+ );
+ const selected = groups.find(
+ (group) => group.provider.id === selectedProvider,
+ );
+
+ function handleSelect(providerId: string) {
+ const group = groups.find((item) => item.provider.id === providerId);
+ if (!group) return;
+ if (group.credentials.length === 1) {
+ onUse(group.credentials[0].id);
+ return;
+ }
+ setSelectedProvider(providerId);
+ }
+
+ return (
+ <Dialog
+ styling={{ maxWidth: "40rem", maxHeight: "60vh" }}
+ title="Use an existing connection"
+ controlled={{
+ isOpen: open,
+ set: (next) => {
+ if (!next) onClose();
+ },
+ }}
+ >
+ <Dialog.Content>
+ <div className="-mb-2 flex flex-col gap-3">
+ {selected ? (
+ <>
+ <button
+ type="button"
+ onClick={() => setSelectedProvider(null)}
+ className="flex w-fit items-center gap-1 text-sm text-zinc-500 hover:text-zinc-800"
+ >
+ <Icon icon={ArrowLeft02Icon} size={14} />
+ All connections
+ </button>
+ <Text
+ variant="small"
+ className="text-sm leading-5 !text-zinc-500"
+ >
+ You have {selected.credentials.length} {selected.provider.name}{" "}
+ connections. Choose which one {expertName} should use.
+ </Text>
+ <ul
+ className="flex flex-col gap-2"
+ aria-label={`${selected.provider.name} connections`}
+ >
+ {selected.credentials.map((credential) => {
+ const name = formatCredentialName(
+ credential.title ?? credential.provider,
+ credential.provider,
+ );
+ return (
+ <li
+ key={credential.id}
+ className="flex items-center gap-3 rounded-xl bg-neutral-100 px-3 py-2.5"
+ >
+ <IntegrationLogo
+ provider={credential.provider}
+ size={24}
+ />
+ <span className="min-w-0 flex-1 truncate text-sm font-medium text-zinc-800">
+ {name}
+ </span>
+ <Button
+ variant="secondary"
+ size="small"
+ disabled={isGranting}
+ onClick={() => onUse(credential.id)}
+ aria-label={`Let ${expertName} use ${name}`}
+ >
+ Use
+ </Button>
+ </li>
+ );
+ })}
+ </ul>
+ </>
+ ) : (
+ <>
+ <Text
+ variant="small"
+ className="text-sm leading-5 !text-zinc-500"
+ >
+ These connections are already set up on your account but{" "}
+ {expertName} can&apos;t use them yet. Choose one to give{" "}
+ {expertName} access. Nothing is re-authorised, and you can
+ remove the access from this tab at any time.
+ </Text>
+ <SearchInput
+ size="small"
+ value={query}
+ onChange={setQuery}
+ placeholder="Search connections"
+ />
+ {groups.length === 0 ? (
+ <Text variant="small" className="text-zinc-500">
+ {credentials.length === 0
+ ? `${expertName} can already use everything in your account.`
+ : "No connections match."}
+ </Text>
+ ) : (
+ <div className="relative">
+ <ul
+ ref={attachList}
+ className="grid grid-cols-2 gap-2 overflow-y-auto pr-1"
+ aria-label="Existing connections"
+ >
+ {groups.map((group) => (
+ <li key={group.provider.id}>
+ <ConnectProviderRow
+ provider={group.provider}
+ onSelect={handleSelect}
+ description={
+ group.credentials.length === 1
+ ? formatCredentialName(
+ group.credentials[0].title ??
+ group.provider.name,
+ group.provider.id,
+ )
+ : `${group.credentials.length} connections · choose one`
+ }
+ />
+ </li>
+ ))}
+ </ul>
+
+ <div
+ aria-hidden="true"
+ className={cn(
+ "pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-white to-transparent transition-opacity duration-200",
+
+ hasMoreBelow ? "opacity-100" : "opacity-0",
+ )}
+ />
+ </div>
+ )}
+ </>
+ )}
+ <div className="flex justify-end pt-1">
+ <Button variant="secondary" size="small" onClick={onClose}>
+ Cancel
+ </Button>
+ </div>
+ </div>
+ </Dialog.Content>
+ </Dialog>
+ );
+}
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
new file mode 100644
index 0000000000..51150bfcda
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertConnectServiceDialog.ts
@@ -0,0 +1,126 @@
+import {
+ useGetV1ListCredentials,
+ useGetV1ListProviders,
+} from "@/app/api/__generated__/endpoints/integrations/integrations";
+import type { CredentialsMetaResponse } from "@/app/api/__generated__/models/credentialsMetaResponse";
+import { useApiKeyConnectForm } from "@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useApiKeyConnectForm";
+import { useOAuthConnect } from "@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useOAuthConnect";
+import {
+ AuthType,
+ filterConnectableProviders,
+ toConnectableProviders,
+ type AuthMethod,
+ type ConnectableProvider,
+} from "@/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/helpers";
+import { useDebouncedValue } from "@/hooks/useDebouncedValue";
+import { useEffect, useState } from "react";
+
+interface Args {
+ open: boolean;
+ onConnected: (credential: CredentialsMetaResponse) => void;
+}
+
+export function useExpertConnectServiceDialog({ open, onConnected }: Args) {
+ const [query, setQuery] = useState("");
+ const debouncedQuery = useDebouncedValue(query, 250);
+ const [selectedId, setSelectedId] = useState<string | null>(null);
+ const [selectedMethod, setSelectedMethod] = useState<AuthMethod | null>(null);
+ const [direction, setDirection] = useState<1 | -1>(1);
+
+ const providersQuery = useGetV1ListProviders({
+ query: {
+ enabled: open,
+ select: (response) => (response.status === 200 ? response.data : []),
+ },
+ });
+ const credentialsQuery = useGetV1ListCredentials({
+ query: {
+ enabled: open,
+ select: (response) => (response.status === 200 ? response.data : []),
+ },
+ });
+
+ useEffect(() => {
+ if (!open) {
+ setQuery("");
+ setSelectedId(null);
+ setSelectedMethod(null);
+ }
+ }, [open]);
+
+ const allProviders = toConnectableProviders(providersQuery.data ?? []);
+ const credentials = credentialsQuery.data ?? [];
+ const connectedProviders = new Set(
+ credentials.map((credential) => credential.provider),
+ );
+ const providers = filterConnectableProviders(allProviders, debouncedQuery);
+ const selectedProvider: ConnectableProvider | null = selectedId
+ ? (allProviders.find((provider) => provider.id === selectedId) ?? null)
+ : null;
+ function handleSuccess(credential?: CredentialsMetaResponse) {
+ setDirection(-1);
+ setSelectedId(null);
+ setSelectedMethod(null);
+ if (credential) onConnected(credential);
+ }
+
+ const oauth = useOAuthConnect({
+ provider: selectedProvider?.id ?? "",
+ onSuccess: handleSuccess,
+ });
+ const apiKey = useApiKeyConnectForm({
+ provider: selectedProvider?.id ?? "",
+ onSuccess: handleSuccess,
+ });
+
+ function handleSelect(providerId: string) {
+ setDirection(1);
+ setSelectedId(providerId);
+ setSelectedMethod(null);
+ apiKey.form.reset();
+ }
+
+ function handleBackToList() {
+ setDirection(-1);
+ setSelectedId(null);
+ setSelectedMethod(null);
+ }
+
+ function handleContinue() {
+ if (selectedMethod === AuthType.oauth2) {
+ oauth.connect();
+ return;
+ }
+ if (selectedMethod === AuthType.api_key) {
+ apiKey.form.handleSubmit(apiKey.handleSubmit)();
+ }
+ }
+
+ return {
+ query,
+ setQuery,
+ providers,
+ isLoading: providersQuery.isLoading,
+ isError: providersQuery.isError,
+ refetch: providersQuery.refetch,
+ selectedProvider,
+ direction,
+ connectedProviders,
+ selectedMethod,
+ setSelectedMethod,
+ apiKeyForm: apiKey.form,
+ handleApiKeySubmit: apiKey.handleSubmit,
+ showContinue:
+ !selectedMethod ||
+ selectedMethod === AuthType.oauth2 ||
+ selectedMethod === AuthType.api_key,
+ isContinueDisabled:
+ !selectedMethod ||
+ (selectedMethod === AuthType.api_key && !apiKey.form.formState.isValid),
+ isConnecting: oauth.isPending || apiKey.isPending,
+ handleSelect,
+ handleBackToList,
+ handleContinue,
+ handleSuccess,
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertIntegrationsSection.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertIntegrationsSection.ts
index 53990b21af..b215eaf4f0 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertIntegrationsSection.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertIntegrationsSection.ts
@@ -10,17 +10,16 @@ import { okData } from "@/app/api/helpers";
import { filterSystemCredentials } from "@/components/contextual/CredentialsInput/helpers";
import { useToast } from "@/components/molecules/Toast/use-toast";
import { useQueryClient } from "@tanstack/react-query";
-import { useRef, useState } from "react";
+import { useState } from "react";
export function useExpertIntegrationsSection(expertId: string) {
const queryClient = useQueryClient();
const { toast } = useToast();
- const [isAdding, setIsAdding] = useState(false);
const [isConnecting, setIsConnecting] = useState(false);
+ const [isUsingExisting, setIsUsingExisting] = useState(false);
// Whether the dialog we just closed actually created something. Closing
// without a credential means the user backed out, and the picker they came
// from should come back rather than the click going nowhere.
- const didConnect = useRef(false);
const grantedQuery = useListExpertCredentials(expertId, {
query: { select: (response) => okData(response) ?? [] },
@@ -49,7 +48,6 @@ export function useExpertIntegrationsSection(expertId: string) {
const { mutate: grant, isPending: isGranting } = useGrantExpertCredentials({
mutation: {
onSuccess: () => {
- setIsAdding(false);
invalidate();
},
onError: () =>
@@ -68,35 +66,30 @@ export function useExpertIntegrationsSection(expertId: string) {
},
});
- function openAdd() {
- setIsAdding(true);
+ function openUseExisting() {
+ setIsUsingExisting(true);
}
- function closeAdd() {
- setIsAdding(false);
+ function closeUseExisting() {
+ setIsUsingExisting(false);
}
function openConnect() {
- setIsAdding(false);
- didConnect.current = false;
setIsConnecting(true);
}
// The dialog names the credential it created, so a credential the user
// happens to add elsewhere while it is open is never swept in.
function connectCredential(credential: CredentialsMetaResponse) {
- didConnect.current = true;
grant({ expertId, data: { credential_ids: [credential.id] } });
}
- function closeConnect() {
- setIsConnecting(false);
- if (!didConnect.current) setIsAdding(true);
- didConnect.current = false;
+ function grantExistingCredential(credentialId: string) {
+ grant({ expertId, data: { credential_ids: [credentialId] } });
}
- function addIntegration(credentialId: string) {
- grant({ expertId, data: { credential_ids: [credentialId] } });
+ function closeConnect() {
+ setIsConnecting(false);
}
function removeIntegration(credentialId: string) {
@@ -119,14 +112,14 @@ export function useExpertIntegrationsSection(expertId: string) {
isGrantableLoading: connectedQuery.isLoading,
isGrantableError: connectedQuery.isError,
refetch,
- isAdding,
- openAdd,
- closeAdd,
isConnecting,
+ isUsingExisting,
+ openUseExisting,
+ closeUseExisting,
openConnect,
closeConnect,
connectCredential,
- addIntegration,
+ grantExistingCredential,
removeIntegration,
isGranting,
isRevoking,
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 7b65f8fd67..0671886ea9 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
@@ -1,46 +1,105 @@
"use client";
+import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
import { EditScheduleModal } from "@/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedScheduleView/components/EditScheduleModal/EditScheduleModal";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
import { GraphScheduleListItem } from "@/components/contextual/SchedulesPanel/components/GraphScheduleListItem/GraphScheduleListItem";
+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";
+import { PlusSignIcon } from "@hugeicons/core-free-icons";
+import { useState } from "react";
+import {
+ filterExpertSchedules,
+ SCHEDULE_FILTERS,
+ ScheduleFilter,
+ ACTION_BUTTON_CLASS,
+} from "../../helpers";
+import { CreateScheduleDialog } from "./CreateScheduleDialog";
+import { FilterIconMenu } from "./FilterIconMenu";
interface Props {
+ title: string;
expertName: string;
+ expertId?: string;
+ workflows?: ExpertWorkflowRef[];
+ accentClassName?: string;
schedules: GraphExecutionJobInfo[];
lastRunLabel: string | null;
}
export function ExpertSchedulesSection({
+ title,
expertName,
+ expertId,
+ workflows,
+ accentClassName,
schedules,
lastRunLabel,
}: Props) {
+ const [query, setQuery] = useState("");
+ const [filter, setFilter] = useState<ScheduleFilter>("all");
+ const [isCreateOpen, setIsCreateOpen] = useState(false);
+ const visible = filterExpertSchedules(schedules, query, filter);
+
return (
<section>
- <div className="mb-2.5 flex items-center justify-between gap-2">
- <div className="text-xs font-medium uppercase tracking-[0.14em] text-zinc-400">
- Schedules
+ <div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">
+ <div className="flex items-baseline gap-3">
+ <Text variant="large-medium">{title}</Text>
+ {lastRunLabel ? (
+ <span className="text-xs text-zinc-500">{lastRunLabel}</span>
+ ) : null}
+ </div>
+ <div className="flex items-center gap-2">
+ {expertId && workflows ? (
+ <Button
+ variant="secondary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ leftIcon={<Icon icon={PlusSignIcon} size={14} />}
+ onClick={() => setIsCreateOpen(true)}
+ >
+ Create schedule
+ </Button>
+ ) : null}
+ <SearchInput
+ size="xsmall"
+ value={query}
+ onChange={setQuery}
+ placeholder="Search schedules"
+ className="w-48"
+ />
+ <FilterIconMenu
+ label="Filter schedules"
+ value={filter}
+ defaultValue="all"
+ options={SCHEDULE_FILTERS}
+ onChange={setFilter}
+ />
</div>
- {lastRunLabel ? (
- <span className="text-xs text-zinc-500">{lastRunLabel}</span>
- ) : null}
</div>
{schedules.length === 0 ? (
- <p className="text-sm text-zinc-500">
+ <p className="pt-4 text-sm text-zinc-500">
No schedules yet. Workflows with a schedule will run {expertName}{" "}
automatically and show up here.
</p>
+ ) : visible.length === 0 ? (
+ <p className="pt-4 text-sm text-zinc-500">No schedules match.</p>
) : (
- <ul className="flex flex-col gap-3" aria-label="Expert schedules">
- {schedules.map((schedule) => (
+ <ul className="flex flex-col gap-3 pt-4" aria-label="Expert schedules">
+ {visible.map((schedule) => (
<li key={schedule.id}>
<GraphScheduleListItem
schedule={schedule}
+ iconClassName={accentClassName}
+ actionClassName={ACTION_BUTTON_CLASS}
editAction={
<EditScheduleModal
graphId={schedule.graph_id}
schedule={schedule}
- triggerClassName="shrink-0"
+ triggerClassName={`${ACTION_BUTTON_CLASS} shrink-0`}
/>
}
/>
@@ -48,6 +107,14 @@ export function ExpertSchedulesSection({
))}
</ul>
)}
+ {expertId && workflows ? (
+ <CreateScheduleDialog
+ expertId={expertId}
+ workflows={workflows}
+ open={isCreateOpen}
+ onClose={() => setIsCreateOpen(false)}
+ />
+ ) : null}
</section>
);
}
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
new file mode 100644
index 0000000000..7ff73ee647
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSettingsSection.tsx
@@ -0,0 +1,34 @@
+"use client";
+
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { Button } from "@/components/atoms/Button/Button";
+import { Text } from "@/components/atoms/Text/Text";
+import { ACTION_BUTTON_CLASS } from "@/app/(platform)/team/helpers";
+
+interface Props {
+ expert: Expert;
+ onFire: () => void;
+}
+
+export function ExpertSettingsSection({ expert, onFire }: Props) {
+ return (
+ <section className="rounded-xl border border-red-200 bg-red-50/50 p-4">
+ <Text variant="large-medium" className="text-red-700">
+ Danger zone
+ </Text>
+ <Text variant="small" className="mt-1 text-red-600">
+ Firing {expert.name} pauses every schedule and removes them from your
+ team.
+ </Text>
+ <Button
+ variant="destructive"
+ size="small"
+ className={`${ACTION_BUTTON_CLASS} mt-4`}
+ onClick={onFire}
+ data-testid="expert-fire-button"
+ >
+ Fire {expert.name}
+ </Button>
+ </section>
+ );
+}
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
new file mode 100644
index 0000000000..2664be9705
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSkillListItem.tsx
@@ -0,0 +1,88 @@
+"use client";
+
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { cn } from "@/lib/utils";
+import { BookOpen01Icon, Delete02Icon } from "@hugeicons/core-free-icons";
+import { ExpertSkillEntry } from "./useExpertSkills";
+import { ACTION_BUTTON_CLASS } from "@/app/(platform)/team/helpers";
+
+interface Props {
+ entry: ExpertSkillEntry;
+ accentClassName?: string;
+ isSaving: boolean;
+ onRemove: (name: string) => void;
+}
+
+export function ExpertSkillListItem({
+ entry,
+ accentClassName,
+ isSaving,
+ onRemove,
+}: Props) {
+ 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"
+ data-testid="expert-skill-row"
+ >
+ <div className="flex min-w-0 flex-1 items-start 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",
+ accentClassName,
+ "border-0",
+ )}
+ >
+ <Icon icon={BookOpen01Icon} size={18} className="text-inherit" />
+ </div>
+ <div className="flex min-w-0 flex-col gap-1">
+ <Text variant="body-medium" className="break-words">
+ {entry.name}
+ </Text>
+ <Text variant="small" className="!text-zinc-500">
+ {entry.library?.description ??
+ "Marketplace skill. Not in your library yet."}
+ </Text>
+ {triggers.length > 0 ? (
+ <div className="mt-1 flex flex-wrap gap-1">
+ {triggers.map((trigger) => (
+ <span
+ key={trigger}
+ className="rounded-md bg-zinc-100 px-2 py-0.5 text-xs text-zinc-600"
+ >
+ {trigger}
+ </span>
+ ))}
+ </div>
+ ) : null}
+ </div>
+ </div>
+ <div className="flex flex-shrink-0 items-center gap-2">
+ {entry.library ? (
+ <Button
+ as="NextLink"
+ href="/library/skills"
+ variant="ghost"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ >
+ Open in library
+ </Button>
+ ) : null}
+ <Button
+ variant="secondary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ disabled={isSaving}
+ onClick={() => onRemove(entry.name)}
+ aria-label={`Remove ${entry.name}`}
+ >
+ <Icon icon={Delete02Icon} className="mr-1 h-4 w-4" />
+ Remove
+ </Button>
+ </div>
+ </div>
+ );
+}
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
new file mode 100644
index 0000000000..4c393bcba5
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSkillsSection.tsx
@@ -0,0 +1,103 @@
+"use client";
+
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";
+import { PlusSignIcon } from "@hugeicons/core-free-icons";
+import { AddSkillDialog } from "./AddSkillDialog";
+import { ExpertSkillListItem } from "./ExpertSkillListItem";
+import { useExpertSkills } from "./useExpertSkills";
+import { ACTION_BUTTON_CLASS } from "@/app/(platform)/team/helpers";
+
+interface Props {
+ expert: Expert;
+ accentClassName?: string;
+}
+
+export function ExpertSkillsSection({ expert, accentClassName }: Props) {
+ const {
+ query,
+ setQuery,
+ visible,
+ hasAny,
+ available,
+ isLibraryLoading,
+ isAddOpen,
+ openAdd,
+ closeAdd,
+ source,
+ setSource,
+ marketQuery,
+ setMarketQuery,
+ marketplaceSkills,
+ isMarketplaceLoading,
+ addSkill,
+ addMarketplaceSkill,
+ removeSkill,
+ isSaving,
+ } = useExpertSkills(expert);
+
+ return (
+ <section>
+ <div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">
+ <Text variant="large-medium">{expert.name}&apos;s Skills</Text>
+ <div className="flex items-center gap-2">
+ <Button
+ variant="secondary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ leftIcon={<Icon icon={PlusSignIcon} size={14} />}
+ onClick={openAdd}
+ >
+ Add skill
+ </Button>
+ <SearchInput
+ size="xsmall"
+ value={query}
+ onChange={setQuery}
+ placeholder="Search skills"
+ className="w-48"
+ />
+ </div>
+ </div>
+ {!hasAny ? (
+ <p className="pt-4 text-sm text-zinc-500">
+ No skills yet. Add skills from your library so {expert.name} knows how
+ you like things done.
+ </p>
+ ) : visible.length === 0 ? (
+ <p className="pt-4 text-sm text-zinc-500">No skills match.</p>
+ ) : (
+ <ul className="flex flex-col gap-3 pt-4" aria-label="Expert skills">
+ {visible.map((entry) => (
+ <li key={entry.name}>
+ <ExpertSkillListItem
+ entry={entry}
+ accentClassName={accentClassName}
+ isSaving={isSaving}
+ onRemove={removeSkill}
+ />
+ </li>
+ ))}
+ </ul>
+ )}
+ <AddSkillDialog
+ open={isAddOpen}
+ source={source}
+ onSourceChange={setSource}
+ skills={available}
+ isLoading={isLibraryLoading}
+ marketQuery={marketQuery}
+ onMarketQueryChange={setMarketQuery}
+ marketplaceSkills={marketplaceSkills}
+ isMarketplaceLoading={isMarketplaceLoading}
+ isSaving={isSaving}
+ onAdd={addSkill}
+ onAddMarketplace={addMarketplaceSkill}
+ onClose={closeAdd}
+ />
+ </section>
+ );
+}
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
new file mode 100644
index 0000000000..1e4e92cc39
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertSummaryCard.tsx
@@ -0,0 +1,123 @@
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { ExpertActivity } from "@/app/api/__generated__/models/expertActivity";
+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
+import { Text } from "@/components/atoms/Text/Text";
+import { cn } from "@/lib/utils";
+import { FireIcon } from "@hugeicons/core-free-icons";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { ExpertActivityGraph } from "./ExpertActivityGraph/ExpertActivityGraph";
+import {
+ getActivityStreak,
+ getActivitySummary,
+ getThreeMonthActivityDays,
+ getYearActivityDays,
+} from "./ExpertActivityGraph/helpers";
+
+interface Props {
+ expert: Expert;
+ activity: ExpertActivity | null;
+ isActivityLoading: boolean;
+ isActivityError: boolean;
+}
+
+export function ExpertSummaryCard({
+ expert,
+ activity,
+ isActivityLoading,
+ isActivityError,
+}: Props) {
+ const activityDays = activity ? getYearActivityDays(activity.days) : null;
+ const visibleActivityDays = activityDays
+ ? getThreeMonthActivityDays(activityDays)
+ : null;
+ const summary = visibleActivityDays
+ ? getActivitySummary(visibleActivityDays)
+ : null;
+ const streak = activityDays ? getActivityStreak(activityDays) : null;
+
+ return (
+ <aside
+ aria-label={`${expert.name} at a glance`}
+ className="flex flex-col gap-4 self-start"
+ >
+ <section
+ aria-label={`${expert.name} activity`}
+ className="flex flex-col gap-2 rounded-xl border border-zinc-200 bg-white p-4"
+ >
+ <div className="flex items-center justify-between gap-2">
+ <Text variant="large-medium" className="text-base text-zinc-700">
+ Activity
+ </Text>
+ {summary ? <ActivityStatus isActive={summary.isActive} /> : null}
+ </div>
+ {isActivityLoading ? (
+ <Skeleton className="h-[5.25rem] w-full rounded-lg" />
+ ) : isActivityError ? (
+ <Text variant="small" className="text-zinc-500">
+ Activity unavailable
+ </Text>
+ ) : visibleActivityDays && summary ? (
+ <>
+ <ExpertActivityGraph
+ days={visibleActivityDays}
+ color={expert.color}
+ />
+ <Text variant="small" className="text-zinc-500">
+ {summary.totalsLabel} · {summary.rangeLabel}
+ </Text>
+ </>
+ ) : null}
+ </section>
+
+ <section
+ aria-label={`${expert.name} activity streak`}
+ className="flex flex-col rounded-xl border border-zinc-200 bg-white p-4"
+ >
+ {isActivityLoading ? (
+ <Skeleton className="h-16 w-full rounded-lg" />
+ ) : isActivityError ? (
+ <Text variant="small" className="text-zinc-500">
+ Streak unavailable
+ </Text>
+ ) : (
+ <div className="flex items-center justify-center gap-3 text-center">
+ <Icon
+ icon={FireIcon}
+ size={40}
+ className="shrink-0 text-zinc-400"
+ />
+ <div className="min-w-0">
+ <Text variant="h4" className="tabular-nums text-zinc-900">
+ {streak ?? 0}
+ </Text>
+ <Text variant="small" className="text-sm text-zinc-500">
+ day streak
+ </Text>
+ </div>
+ </div>
+ )}
+ </section>
+ </aside>
+ );
+}
+
+interface ActivityStatusProps {
+ isActive: boolean;
+}
+
+function ActivityStatus({ isActive }: ActivityStatusProps) {
+ return (
+ <span className="flex items-center gap-1.5">
+ <span
+ aria-hidden
+ className={cn(
+ "size-2 rounded-full",
+ isActive ? "bg-emerald-500" : "bg-zinc-300",
+ )}
+ />
+ <Text variant="small" className="text-zinc-500">
+ {isActive ? "Active this week" : "Quiet lately"}
+ </Text>
+ </span>
+ );
+}
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 1e1f3e3d86..a9f3b5bc78 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
@@ -12,6 +12,7 @@ import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
import { RunStatusBadge } from "@/components/molecules/RunStatusBadge/RunStatusBadge";
import { cn } from "@/lib/utils";
import { useState } from "react";
+import { ACTION_BUTTON_CLASS } from "@/app/(platform)/team/helpers";
interface Props {
expertId: string;
@@ -33,17 +34,14 @@ export function ExpertWorkSection({ expertId, enabled }: Props) {
return (
<section>
- <div className="mb-2.5 flex items-center justify-between gap-2">
- <div className="text-xs font-medium uppercase tracking-[0.14em] text-zinc-400">
- Work
- </div>
+ <div className="mb-2.5 flex items-center justify-end gap-2 empty:mb-0">
{reviewCount > 0 ? (
<button
type="button"
aria-pressed={needsReviewOnly}
onClick={() => setNeedsReviewOnly((value) => !value)}
className={cn(
- "rounded-full px-3 py-1 text-xs font-medium ring-1 ring-inset transition-colors",
+ "rounded-md px-2.5 py-1 text-xs font-medium ring-1 ring-inset transition-colors",
needsReviewOnly
? "bg-amber-100 text-amber-700 ring-amber-200"
: "bg-white text-zinc-500 ring-zinc-200 hover:text-zinc-800",
@@ -56,8 +54,8 @@ export function ExpertWorkSection({ expertId, enabled }: Props) {
{runsQuery.isLoading ? (
<div className="space-y-3">
- <Skeleton className="h-16 w-full rounded-xl" />
- <Skeleton className="h-16 w-full rounded-xl" />
+ <Skeleton className="h-16 w-full rounded-lg" />
+ <Skeleton className="h-16 w-full rounded-lg" />
</div>
) : runsQuery.isError && runsQuery.data == null ? (
<ErrorCard
@@ -105,7 +103,7 @@ export function ExpertWorkSection({ expertId, enabled }: Props) {
function ExpertRunRow({ run, onOpen }: { run: ExpertRun; onOpen: () => void }) {
return (
- <div className="flex items-center justify-between gap-3 rounded-xl bg-white p-3 ring-1 ring-inset ring-zinc-200">
+ <div className="flex items-center justify-between gap-3 rounded-lg bg-white p-3 ring-1 ring-inset ring-zinc-200">
<div className="min-w-0">
<p className="truncate text-sm font-medium text-zinc-900">
{run.agent_name}
@@ -119,7 +117,12 @@ function ExpertRunRow({ run, onOpen }: { run: ExpertRun; onOpen: () => void }) {
) : null}
</div>
</div>
- <Button variant="secondary" size="small" onClick={onOpen}>
+ <Button
+ variant="secondary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ onClick={onOpen}
+ >
Open
</Button>
</div>
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowActions.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowActions.tsx
new file mode 100644
index 0000000000..baf569f86e
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowActions.tsx
@@ -0,0 +1,63 @@
+"use client";
+
+import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { PencilEdit02Icon, SparklesIcon } from "@hugeicons/core-free-icons";
+import { ExpertWorkflowCardMenu } from "./ExpertWorkflowCardMenu";
+
+const ICON_BUTTON_CLASS =
+ "h-7 w-7 rounded-md border-transparent bg-white/90 p-0 text-zinc-700 hover:border-transparent hover:bg-white";
+
+interface Props {
+ workflow: ExpertWorkflowRef;
+ expertId: string;
+ name: string;
+ builderHref: string | null;
+ chatHref: string;
+ buttonClassName?: string;
+ menuClassName?: string;
+}
+
+export function ExpertWorkflowActions({
+ workflow,
+ expertId,
+ name,
+ builderHref,
+ chatHref,
+ buttonClassName = ICON_BUTTON_CLASS,
+ menuClassName = buttonClassName,
+}: Props) {
+ return (
+ <>
+ {builderHref ? (
+ <Button
+ as="NextLink"
+ href={builderHref}
+ variant="icon"
+ size="icon"
+ aria-label="Edit workflow"
+ className={buttonClassName}
+ >
+ <Icon icon={PencilEdit02Icon} size={14} />
+ </Button>
+ ) : null}
+ <Button
+ as="NextLink"
+ href={chatHref}
+ variant="icon"
+ size="icon"
+ aria-label="Ask about this workflow"
+ className={buttonClassName}
+ >
+ <Icon icon={SparklesIcon} size={14} />
+ </Button>
+ <ExpertWorkflowCardMenu
+ workflow={workflow}
+ expertId={expertId}
+ name={name}
+ triggerClassName={menuClassName}
+ />
+ </>
+ );
+}
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
new file mode 100644
index 0000000000..2675e1df5e
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowCard.tsx
@@ -0,0 +1,122 @@
+"use client";
+
+import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
+import { Icon } from "@/components/atoms/Icon/Icon";
+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 NextLink from "next/link";
+import { ExpertCover } from "../../components/ExpertTeamCard/components/ExpertCover";
+import { ExpertWorkflowActions } from "./ExpertWorkflowActions";
+import { ExpertWorkflowRunButton } from "./ExpertWorkflowRunButton";
+import { useExpertWorkflowCard } from "./useExpertWorkflowCard";
+import { WorkflowChain } from "./WorkflowChain";
+import { WorkflowCredentialStack } from "./WorkflowCredentialStack";
+
+interface Props {
+ workflow: ExpertWorkflowRef;
+ expertId: string;
+ coverColor: string | undefined;
+}
+
+export function ExpertWorkflowCard({ workflow, expertId, coverColor }: Props) {
+ const {
+ name,
+ libraryAgent,
+ runCount,
+ isTriggerWorkflow,
+ status,
+ credentialProviders,
+ libraryHref,
+ builderHref,
+ chatHref,
+ openRun,
+ openTriggers,
+ } = useExpertWorkflowCard({ workflow, expertId });
+
+ 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"
+ >
+ {libraryHref ? (
+ <NextLink
+ href={libraryHref}
+ aria-label={`Open ${name} tasks`}
+ className="absolute inset-0 z-0 rounded-xl"
+ />
+ ) : 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>
+ <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}
+ expertId={expertId}
+ name={name}
+ builderHref={builderHref}
+ chatHref={chatHref}
+ />
+ </div>
+ </div>
+
+ <div className="pointer-events-none relative flex flex-1 flex-col px-3 pb-3 pt-2.5">
+ <Text variant="h5" className="line-clamp-2 hyphens-auto break-words">
+ {name}
+ </Text>
+ {workflow.schedule_cron ? (
+ <Text variant="small" className="mt-0.5 text-zinc-400">
+ {safeHumanizeCronExpression(workflow.schedule_cron)}
+ </Text>
+ ) : null}
+ {workflow.description ? (
+ <Text
+ variant="small"
+ className="mt-1.5 line-clamp-2 text-sm leading-5 text-zinc-500"
+ >
+ {workflow.description}
+ </Text>
+ ) : null}
+ <div className="mt-2 flex flex-wrap items-center gap-2">
+ {runCount !== undefined ? (
+ <Text
+ variant="small"
+ className="flex items-center gap-1.5 text-sm leading-5 text-zinc-500"
+ >
+ <Icon icon={Activity01Icon} size={14} className="shrink-0" />
+ {runCount} {runCount === 1 ? "run" : "runs"}
+ </Text>
+ ) : null}
+ <span
+ className={cn(
+ "rounded-md px-2 py-0.5 text-xs font-medium ring-1 ring-inset ring-zinc-200/80",
+ status.className,
+ )}
+ >
+ {status.label}
+ </span>
+ </div>
+ {libraryAgent ? (
+ <div className="relative z-10 mt-auto flex items-center justify-between gap-3 pt-3">
+ <WorkflowCredentialStack providers={credentialProviders} />
+ <span className="pointer-events-auto ml-auto">
+ <ExpertWorkflowRunButton
+ agent={libraryAgent}
+ isTriggerWorkflow={isTriggerWorkflow}
+ onRunCreated={openRun}
+ onTriggerSetup={openTriggers}
+ />
+ </span>
+ </div>
+ ) : null}
+ </div>
+ </div>
+ );
+}
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
new file mode 100644
index 0000000000..26a51aceb0
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowCardMenu.tsx
@@ -0,0 +1,150 @@
+"use client";
+
+import {
+ getGetExpertQueryKey,
+ useRemoveExpertWorkflow,
+} from "@/app/api/__generated__/endpoints/experts/experts";
+import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { Dialog } from "@/components/molecules/Dialog/Dialog";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/molecules/DropdownMenu/DropdownMenu";
+import { useToast } from "@/components/molecules/Toast/use-toast";
+import { invalidateExpertRosterQueries } from "@/services/experts/invalidate-experts";
+import {
+ Delete02Icon,
+ Folder01Icon,
+ MoreHorizontalIcon,
+ Settings01Icon,
+} from "@hugeicons/core-free-icons";
+import { useQueryClient } from "@tanstack/react-query";
+import NextLink from "next/link";
+import { useState } from "react";
+import { workflowNeedsSetup } from "../../helpers";
+
+interface Props {
+ workflow: ExpertWorkflowRef;
+ expertId: string;
+ name: string;
+ triggerClassName?: string;
+}
+
+export function ExpertWorkflowCardMenu({
+ workflow,
+ expertId,
+ name,
+ triggerClassName,
+}: Props) {
+ const { toast } = useToast();
+ const queryClient = useQueryClient();
+ const [isRemoveOpen, setIsRemoveOpen] = useState(false);
+ const { mutateAsync: removeWorkflow, isPending: isRemoving } =
+ useRemoveExpertWorkflow();
+ const libraryHref = workflow.library_agent_id
+ ? `/library/agents/${workflow.library_agent_id}`
+ : null;
+
+ async function handleRemove() {
+ try {
+ await removeWorkflow({ expertId, workflowId: workflow.id });
+ await Promise.all([
+ queryClient.invalidateQueries({
+ queryKey: getGetExpertQueryKey(expertId),
+ }),
+ invalidateExpertRosterQueries(queryClient),
+ ]);
+ toast({ title: "Workflow removed", variant: "success" });
+ setIsRemoveOpen(false);
+ } catch {
+ toast({ title: "Couldn't remove workflow", variant: "destructive" });
+ }
+ }
+
+ return (
+ <>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ type="button"
+ variant="icon"
+ size="icon"
+ aria-label="More actions"
+ className={triggerClassName}
+ >
+ <Icon icon={MoreHorizontalIcon} size={16} />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-[11rem]">
+ {libraryHref ? (
+ <DropdownMenuItem asChild>
+ <NextLink href={libraryHref} className="flex items-center gap-2">
+ <Icon
+ icon={
+ workflowNeedsSetup(workflow) ? Settings01Icon : Folder01Icon
+ }
+ size={16}
+ />
+ {workflowNeedsSetup(workflow) ? "Set up" : "Open in library"}
+ </NextLink>
+ </DropdownMenuItem>
+ ) : null}
+ {libraryHref ? <DropdownMenuSeparator /> : null}
+ <DropdownMenuItem
+ className="flex items-center gap-2 text-red-600 focus:text-red-600"
+ onSelect={() => setIsRemoveOpen(true)}
+ >
+ <Icon icon={Delete02Icon} size={16} />
+ Remove from expert
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+
+ <Dialog
+ controlled={{
+ isOpen: isRemoveOpen,
+ set: (open) => {
+ if (!open && !isRemoving) setIsRemoveOpen(false);
+ },
+ }}
+ className="max-h-[60vh] max-w-md"
+ title={`Remove ${name}?`}
+ >
+ <Dialog.Content>
+ <div className="flex flex-col gap-4">
+ <Text variant="body" className="text-zinc-600">
+ This expert will stop running it and its schedule will be removed.
+ The workflow stays in your library.
+ </Text>
+ <div className="flex justify-end gap-2">
+ <Button
+ type="button"
+ variant="ghost"
+ size="small"
+ disabled={isRemoving}
+ onClick={() => setIsRemoveOpen(false)}
+ >
+ Keep
+ </Button>
+ <Button
+ type="button"
+ variant="destructive"
+ size="small"
+ loading={isRemoving}
+ onClick={handleRemove}
+ >
+ Remove
+ </Button>
+ </div>
+ </div>
+ </Dialog.Content>
+ </Dialog>
+ </>
+ );
+}
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
new file mode 100644
index 0000000000..f603396fa9
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowListItem.tsx
@@ -0,0 +1,139 @@
+"use client";
+
+import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
+import { Icon } from "@/components/atoms/Icon/Icon";
+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 NextLink from "next/link";
+import { ExpertWorkflowActions } from "./ExpertWorkflowActions";
+import { ExpertWorkflowRunButton } from "./ExpertWorkflowRunButton";
+import { useExpertWorkflowCard } from "./useExpertWorkflowCard";
+import { WorkflowCredentialStack } from "./WorkflowCredentialStack";
+
+interface Props {
+ workflow: ExpertWorkflowRef;
+ expertId: string;
+ accentClassName: string;
+}
+
+export function ExpertWorkflowListItem({
+ workflow,
+ expertId,
+ accentClassName,
+}: Props) {
+ const {
+ name,
+ libraryAgent,
+ runCount,
+ isTriggerWorkflow,
+ status,
+ credentialProviders,
+ libraryHref,
+ builderHref,
+ chatHref,
+ openRun,
+ openTriggers,
+ } = useExpertWorkflowCard({ workflow, expertId });
+ const meta = [
+ workflow.schedule_cron
+ ? safeHumanizeCronExpression(workflow.schedule_cron)
+ : null,
+ runCount !== undefined
+ ? `${runCount} ${runCount === 1 ? "run" : "runs"}`
+ : null,
+ ].filter((part): part is string => Boolean(part));
+
+ 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"
+ >
+ {libraryHref ? (
+ <NextLink
+ href={libraryHref}
+ aria-label={`Open ${name} tasks`}
+ className="absolute inset-0 z-0 rounded-lg"
+ />
+ ) : 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={status.icon}
+ size={18}
+ role="img"
+ aria-label={status.label}
+ />
+ </div>
+
+ <div className="pointer-events-none min-w-0 flex-1">
+ <div className="flex items-center gap-2">
+ <Text variant="body-medium" className="truncate text-zinc-900">
+ {name}
+ </Text>
+ <span
+ className={cn(
+ "shrink-0 rounded-md px-2 py-0.5 text-xs font-medium ring-1 ring-inset ring-zinc-200/80",
+ status.className,
+ )}
+ >
+ {status.label}
+ </span>
+ </div>
+ {workflow.description ? (
+ <Text
+ variant="small"
+ className="mt-0.5 truncate text-sm text-zinc-500"
+ >
+ {workflow.description}
+ </Text>
+ ) : null}
+ {meta.length > 0 || credentialProviders.length > 0 ? (
+ <div className="mt-1 flex flex-wrap items-center gap-2 text-sm leading-5 text-zinc-600">
+ {meta.length > 0 ? (
+ <Text
+ variant="small"
+ className="flex items-center gap-1.5 text-sm leading-5 text-zinc-600"
+ >
+ <Icon icon={Activity01Icon} size={14} className="shrink-0" />
+ {meta.join(" · ")}
+ </Text>
+ ) : null}
+ {meta.length > 0 && credentialProviders.length > 0 ? (
+ <span className="text-zinc-300">•</span>
+ ) : null}
+ <WorkflowCredentialStack providers={credentialProviders} />
+ </div>
+ ) : null}
+ </div>
+
+ <div className="pointer-events-auto relative z-10 flex shrink-0 items-center gap-1">
+ <ExpertWorkflowActions
+ workflow={workflow}
+ expertId={expertId}
+ name={name}
+ builderHref={builderHref}
+ chatHref={chatHref}
+ buttonClassName="h-8 w-8 rounded-md border-transparent p-0 text-zinc-700 hover:border-transparent hover:bg-zinc-50"
+ />
+ {libraryAgent ? (
+ <span className="ml-1">
+ <ExpertWorkflowRunButton
+ agent={libraryAgent}
+ isTriggerWorkflow={isTriggerWorkflow}
+ variant="secondary"
+ onRunCreated={openRun}
+ onTriggerSetup={openTriggers}
+ />
+ </span>
+ ) : null}
+ </div>
+ </div>
+ );
+}
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
new file mode 100644
index 0000000000..da1206cfe3
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertWorkflowRunButton.tsx
@@ -0,0 +1,43 @@
+"use client";
+import { GraphExecutionMeta } from "@/app/api/__generated__/models/graphExecutionMeta";
+import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
+import { RunAgentModal } from "@/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/modals/RunAgentModal/RunAgentModal";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { PlayIcon } from "@hugeicons/core-free-icons";
+import { ACTION_BUTTON_CLASS } from "@/app/(platform)/team/helpers";
+
+interface Props {
+ agent: LibraryAgent;
+ isTriggerWorkflow: boolean;
+ variant?: "primary" | "secondary";
+ onRunCreated: (execution: GraphExecutionMeta) => void;
+ onTriggerSetup: () => void;
+}
+
+export function ExpertWorkflowRunButton({
+ agent,
+ isTriggerWorkflow,
+ onRunCreated,
+ onTriggerSetup,
+ variant = "secondary",
+}: Props) {
+ return (
+ <RunAgentModal
+ agent={agent}
+ onRunCreated={onRunCreated}
+ onTriggerSetup={onTriggerSetup}
+ triggerSlot={
+ <Button
+ type="button"
+ variant={variant}
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ leftIcon={<Icon icon={PlayIcon} size={14} />}
+ >
+ {isTriggerWorkflow ? "Set up trigger" : "Run"}
+ </Button>
+ }
+ />
+ );
+}
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 75efe82461..7f8427a190 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
@@ -1,76 +1,103 @@
"use client";
import { Expert } from "@/app/api/__generated__/models/expert";
-import { Badge } from "@/components/atoms/Badge/Badge";
import { Button } from "@/components/atoms/Button/Button";
-import { safeHumanizeCronExpression } from "@/lib/cron-expression-utils";
-import { FlashIcon, PlusSignIcon } from "@hugeicons/core-free-icons";
import { Icon } from "@/components/atoms/Icon/Icon";
-import { workflowNeedsSetup } from "../../helpers";
+import { Text } from "@/components/atoms/Text/Text";
+import { getRaisedExpertAccent } from "@/app/(platform)/marketplace/components/ExpertsSection/helpers";
+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";
+import {
+ GridViewIcon,
+ ListViewIcon,
+ PlusSignIcon,
+} from "@hugeicons/core-free-icons";
+import { useState } from "react";
+import {
+ filterExpertWorkflows,
+ WORKFLOW_FILTERS,
+ WorkflowFilter,
+ ACTION_BUTTON_CLASS,
+} from "../../helpers";
+import { ExpertWorkflowCard } from "./ExpertWorkflowCard";
+import { ExpertWorkflowListItem } from "./ExpertWorkflowListItem";
+import { FilterIconMenu } from "./FilterIconMenu";
+import { useExpertWorkflowsView } from "./useExpertWorkflowsView";
+import { ViewToggle } from "./ViewToggle";
+
+const VIEW_OPTIONS = [
+ { value: "list", label: "List view", icon: ListViewIcon },
+ { value: "grid", label: "Grid view", icon: GridViewIcon },
+] as const;
interface Props {
expert: Expert;
- accentIconClass: string;
onInstallWorkflow: () => void;
}
-export function ExpertWorkflowsSection({
- expert,
- accentIconClass,
- onInstallWorkflow,
-}: Props) {
+export function ExpertWorkflowsSection({ expert, onInstallWorkflow }: Props) {
+ const [query, setQuery] = useState("");
+ const [filter, setFilter] = useState<WorkflowFilter>("all");
+ const { view, setView } = useExpertWorkflowsView();
+ const accent = getRaisedExpertAccent(expert.role, expert.color);
+ const visible = filterExpertWorkflows(expert.workflows, query, filter);
+
return (
<section>
- <div className="mb-2.5 flex items-center justify-between">
- <div className="text-xs font-medium uppercase tracking-[0.14em] text-zinc-400">
- Workflows
+ <div className="mb-2.5 flex flex-wrap items-center justify-between gap-3">
+ <Text variant="large-medium">{expert.name}&apos;s Workflows</Text>
+ <div className="flex items-center gap-2">
+ <Button
+ variant="secondary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ leftIcon={<Icon icon={PlusSignIcon} size={14} />}
+ onClick={onInstallWorkflow}
+ >
+ Install workflow
+ </Button>
+ <SearchInput
+ size="xsmall"
+ value={query}
+ onChange={setQuery}
+ placeholder="Search workflows"
+ className="w-48"
+ />
+ <FilterIconMenu
+ label="Filter workflows"
+ value={filter}
+ defaultValue="all"
+ options={WORKFLOW_FILTERS}
+ onChange={setFilter}
+ />
+ <ViewToggle value={view} options={VIEW_OPTIONS} onChange={setView} />
</div>
- <Button
- variant="ghost"
- size="small"
- leftIcon={<Icon icon={PlusSignIcon} size={16} />}
- onClick={onInstallWorkflow}
- >
- Install workflow
- </Button>
</div>
{expert.workflows.length === 0 ? (
<p className="text-sm text-zinc-500">
No workflows yet. Install one to give {expert.name} something to run.
</p>
+ ) : visible.length === 0 ? (
+ <p className="text-sm text-zinc-500">No workflows match.</p>
+ ) : view === "list" ? (
+ <div className="flex flex-col gap-3 pt-4" data-testid="workflow-list">
+ {visible.map((workflow) => (
+ <ExpertWorkflowListItem
+ key={workflow.id}
+ workflow={workflow}
+ expertId={expert.id}
+ accentClassName={accent.pill}
+ />
+ ))}
+ </div>
) : (
- <div className="divide-y divide-zinc-100 rounded-xl border border-zinc-200/80 bg-white">
- {expert.workflows.map((workflow) => (
- <div
+ <div className="grid grid-cols-1 gap-4 pt-4 sm:grid-cols-2 lg:grid-cols-3">
+ {visible.map((workflow) => (
+ <ExpertWorkflowCard
key={workflow.id}
- className="flex items-center gap-3 px-4 py-3"
- data-testid="expert-workflow-row"
- >
- <Icon
- icon={FlashIcon}
- size={18}
- className={`shrink-0 ${accentIconClass}`}
- />
- <div className="min-w-0 flex-1">
- <div className="text-[15px] font-medium text-zinc-800">
- {workflow.name ?? "Unnamed workflow"}
- </div>
- {workflow.description ? (
- <div className="line-clamp-1 text-[13px] text-zinc-500">
- {workflow.description}
- </div>
- ) : null}
- </div>
- {workflowNeedsSetup(workflow) ? (
- <Badge variant="warning" size="small" className="shrink-0">
- Needs setup
- </Badge>
- ) : workflow.schedule_cron ? (
- <Badge variant="info" size="small" className="shrink-0">
- {safeHumanizeCronExpression(workflow.schedule_cron)}
- </Badge>
- ) : null}
- </div>
+ workflow={workflow}
+ expertId={expert.id}
+ coverColor={expert.color}
+ />
))}
</div>
)}
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
new file mode 100644
index 0000000000..418c7fbba1
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/FilterIconMenu.tsx
@@ -0,0 +1,62 @@
+"use client";
+
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
+ DropdownMenuTrigger,
+} from "@/components/molecules/DropdownMenu/DropdownMenu";
+import { cn } from "@/lib/utils";
+import { FilterHorizontalIcon } from "@hugeicons/core-free-icons";
+
+interface Props<T extends string> {
+ label: string;
+ value: T;
+ options: readonly { value: T; label: string }[];
+ defaultValue: T;
+ onChange: (next: T) => void;
+}
+
+export function FilterIconMenu<T extends string>({
+ label,
+ value,
+ options,
+ defaultValue,
+ onChange,
+}: Props<T>) {
+ const isActive = value !== defaultValue;
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ type="button"
+ variant="icon"
+ size="icon"
+ aria-label={label}
+ className={cn(
+ "h-7 w-7 rounded-md border-zinc-200 p-0",
+ isActive &&
+ "border-zinc-900 bg-zinc-900 text-white hover:bg-zinc-800 hover:text-white",
+ )}
+ >
+ <Icon icon={FilterHorizontalIcon} size={14} />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-[11rem]">
+ <DropdownMenuRadioGroup
+ value={value}
+ onValueChange={(next) => onChange(next as T)}
+ >
+ {options.map((option) => (
+ <DropdownMenuRadioItem key={option.value} value={option.value}>
+ {option.label}
+ </DropdownMenuRadioItem>
+ ))}
+ </DropdownMenuRadioGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+}
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
new file mode 100644
index 0000000000..cbd3558d61
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ViewToggle.tsx
@@ -0,0 +1,37 @@
+"use client";
+
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { cn } from "@/lib/utils";
+import type { IconSvgElement } from "@hugeicons/react";
+
+interface Props<T extends string> {
+ value: T;
+ options: readonly { value: T; label: string; icon: IconSvgElement }[];
+ onChange: (next: T) => void;
+}
+
+export function ViewToggle<T extends string>({
+ value,
+ options,
+ onChange,
+}: Props<T>) {
+ return (
+ <div className="flex h-7 items-center rounded-md border border-zinc-200 p-0.5">
+ {options.map((option) => (
+ <button
+ key={option.value}
+ type="button"
+ aria-label={option.label}
+ aria-pressed={value === option.value}
+ onClick={() => onChange(option.value)}
+ className={cn(
+ "flex h-full w-7 items-center justify-center rounded text-zinc-500 transition-colors hover:text-zinc-800",
+ value === option.value && "bg-zinc-100 text-zinc-900",
+ )}
+ >
+ <Icon icon={option.icon} size={14} />
+ </button>
+ ))}
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/WorkflowChain.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/WorkflowChain.tsx
new file mode 100644
index 0000000000..53d35cb418
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/WorkflowChain.tsx
@@ -0,0 +1,42 @@
+"use client";
+import { ExpertWorkflowChainItem } from "@/app/api/__generated__/models/expertWorkflowChainItem";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { ArrowRight01Icon, FlashIcon } from "@hugeicons/core-free-icons";
+import { Fragment } from "react";
+import { ChainTile } from "./ChainTile";
+
+interface Props {
+ chain: ExpertWorkflowChainItem[];
+ size?: "sm" | "md";
+}
+
+export function WorkflowChain({ chain, size = "md" }: Props) {
+ if (chain.length === 0) {
+ return (
+ <Icon
+ icon={FlashIcon}
+ size={size === "sm" ? 20 : 28}
+ className="text-zinc-300"
+ />
+ );
+ }
+
+ return (
+ <>
+ <div className="flex items-center gap-3" data-testid="workflow-chain">
+ {chain.map((item, index) => (
+ <Fragment key={`${item.kind}-${item.provider ?? index}`}>
+ {index > 0 ? (
+ <Icon
+ icon={ArrowRight01Icon}
+ size={14}
+ className="text-zinc-800"
+ />
+ ) : null}
+ <ChainTile item={item} size={size} />
+ </Fragment>
+ ))}
+ </div>
+ </>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/WorkflowCredentialStack.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/WorkflowCredentialStack.tsx
new file mode 100644
index 0000000000..d4d9f6b4cc
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/WorkflowCredentialStack.tsx
@@ -0,0 +1,79 @@
+"use client";
+
+import { ExpertWorkflowChainItem } from "@/app/api/__generated__/models/expertWorkflowChainItem";
+import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
+import { cn } from "@/lib/utils";
+import { IntegrationLogo } from "@/components/molecules/IntegrationLogo/IntegrationLogo";
+import { toDisplayName } from "@/components/renderers/InputRenderer/custom/CredentialField/helpers";
+
+const MAX_VISIBLE = 3;
+
+export function getWorkflowCredentialProviders(
+ agent: LibraryAgent | undefined,
+ chain: ExpertWorkflowChainItem[],
+): string[] {
+ const properties = agent?.credentials_input_schema?.properties;
+ const fromSchema = properties
+ ? Object.values(properties as Record<string, unknown>).flatMap((schema) => {
+ const providers =
+ schema &&
+ typeof schema === "object" &&
+ "credentials_provider" in schema
+ ? (schema as { credentials_provider?: unknown })
+ .credentials_provider
+ : undefined;
+ return Array.isArray(providers) && providers.length === 1
+ ? providers.filter((p): p is string => typeof p === "string")
+ : [];
+ })
+ : [];
+ const fromChain = chain
+ .map((item) => item.provider)
+ .filter((provider): provider is string => Boolean(provider));
+ return [...new Set([...fromSchema, ...fromChain])];
+}
+
+interface Props {
+ providers: string[];
+}
+
+export function WorkflowCredentialStack({ providers }: Props) {
+ if (providers.length === 0) return null;
+ const visible = providers.slice(0, MAX_VISIBLE);
+ const hidden = providers.length - visible.length;
+ return (
+ <div
+ className="flex items-center"
+ role="list"
+ aria-label="Credentials used"
+ title={providers.map(toDisplayName).join(", ")}
+ >
+ {visible.map((provider, index) => (
+ <span
+ key={provider}
+ role="listitem"
+ className={cn(
+ "flex size-7 items-center justify-center rounded-full border border-zinc-200 bg-white ring-2 ring-white",
+ index > 0 && "-ml-2",
+ ["z-30", "z-20", "z-10"][index],
+ )}
+ >
+ <IntegrationLogo
+ provider={provider}
+ alt={toDisplayName(provider)}
+ size={16}
+ />
+ </span>
+ ))}
+ {hidden > 0 ? (
+ <span
+ role="listitem"
+ className="-ml-2 flex size-7 items-center justify-center rounded-full border border-zinc-200 bg-zinc-100 text-[11px] font-medium text-zinc-600 ring-2 ring-white"
+ aria-label={`${hidden} more`}
+ >
+ +{hidden}
+ </span>
+ ) : null}
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/__tests__/useFitListToDialog.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/__tests__/useFitListToDialog.test.tsx
new file mode 100644
index 0000000000..8611d73772
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/__tests__/useFitListToDialog.test.tsx
@@ -0,0 +1,98 @@
+import { fireEvent, render } from "@testing-library/react";
+import { describe, expect, test, vi } from "vitest";
+import { useFitListToDialog } from "../useFitListToDialog";
+
+function Harness() {
+ const { attachList } = useFitListToDialog<HTMLUListElement>();
+ return (
+ <div data-dialog-content>
+ <div className="overflow-y-auto" data-testid="body">
+ <p>title</p>
+ <ul ref={attachList} data-testid="list" />
+ </div>
+ </div>
+ );
+}
+
+function mockMetrics(
+ body: HTMLElement,
+ list: HTMLElement,
+ metrics: { scrollHeight: number; clientHeight: number; listHeight: number },
+) {
+ Object.defineProperty(body, "scrollHeight", {
+ configurable: true,
+ get: () => metrics.scrollHeight,
+ });
+ Object.defineProperty(body, "clientHeight", {
+ configurable: true,
+ get: () => metrics.clientHeight,
+ });
+ Object.defineProperty(list, "offsetHeight", {
+ configurable: true,
+ get: () => metrics.listHeight,
+ });
+}
+
+describe("useFitListToDialog", () => {
+ test("caps the list by exactly the body's overflow", () => {
+ const { getByTestId } = render(<Harness />);
+ const body = getByTestId("body");
+ const list = getByTestId("list");
+ mockMetrics(body, list, {
+ scrollHeight: 700,
+ clientHeight: 500,
+ listHeight: 400,
+ });
+
+ fireEvent(window, new Event("resize"));
+
+ expect(list.style.maxHeight).toBe("200px");
+ });
+
+ test("leaves the list unbounded when nothing overflows", () => {
+ const { getByTestId } = render(<Harness />);
+ const body = getByTestId("body");
+ const list = getByTestId("list");
+ mockMetrics(body, list, {
+ scrollHeight: 300,
+ clientHeight: 500,
+ listHeight: 120,
+ });
+
+ fireEvent(window, new Event("resize"));
+
+ expect(list.style.maxHeight).toBe("");
+ });
+
+ test("never shrinks the list below a usable minimum", () => {
+ const { getByTestId } = render(<Harness />);
+ const body = getByTestId("body");
+ const list = getByTestId("list");
+ mockMetrics(body, list, {
+ scrollHeight: 900,
+ clientHeight: 500,
+ listHeight: 420,
+ });
+
+ fireEvent(window, new Event("resize"));
+
+ expect(list.style.maxHeight).toBe("96px");
+ });
+ test("keeps observers stable on rerenders and cleans them up on unmount", () => {
+ const add = vi.spyOn(window, "addEventListener");
+ const remove = vi.spyOn(window, "removeEventListener");
+ const { rerender, unmount } = render(<Harness />);
+ const subscriptions = add.mock.calls.filter(
+ ([event]) => event === "resize",
+ ).length;
+ rerender(<Harness />);
+ rerender(<Harness />);
+ expect(add.mock.calls.filter(([event]) => event === "resize")).toHaveLength(
+ subscriptions,
+ );
+ unmount();
+ expect(remove.mock.calls.some(([event]) => event === "resize")).toBe(true);
+ add.mockRestore();
+ remove.mockRestore();
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useClampOverflow.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useClampOverflow.ts
deleted file mode 100644
index b379760b6a..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useClampOverflow.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { useRef, useState } from "react";
-
-/** Measures whether a clamped element actually overflows, instead of
- * guessing from character count — a short bio can still clamp on narrow or
- * zoomed layouts. Re-measures on element resize. */
-export function useClampOverflow() {
- const [isOverflowing, setIsOverflowing] = useState(false);
- const observerRef = useRef<ResizeObserver | null>(null);
-
- function measureRef(node: HTMLElement | null) {
- observerRef.current?.disconnect();
- observerRef.current = null;
- if (!node) return;
- function measure() {
- if (!node) return;
- setIsOverflowing(node.scrollHeight > node.clientHeight + 1);
- }
- if (typeof ResizeObserver !== "undefined") {
- observerRef.current = new ResizeObserver(measure);
- observerRef.current.observe(node);
- }
- measure();
- }
-
- return { isOverflowing, measureRef };
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useCreateScheduleDialog.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useCreateScheduleDialog.ts
new file mode 100644
index 0000000000..de4da76477
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useCreateScheduleDialog.ts
@@ -0,0 +1,22 @@
+import { getGetExpertQueryKey } from "@/app/api/__generated__/endpoints/experts/experts";
+import { getGetV1ListExecutionSchedulesForAUserQueryKey } from "@/app/api/__generated__/endpoints/schedules/schedules";
+import { useToast } from "@/components/molecules/Toast/use-toast";
+import { useQueryClient } from "@tanstack/react-query";
+export function useCreateScheduleDialog(expertId: string, onClose: () => void) {
+ const { toast } = useToast();
+ const queryClient = useQueryClient();
+ async function handleScheduleCreated() {
+ await Promise.all([
+ queryClient.invalidateQueries({
+ queryKey: getGetV1ListExecutionSchedulesForAUserQueryKey(),
+ }),
+ queryClient.invalidateQueries({
+ queryKey: getGetExpertQueryKey(expertId),
+ }),
+ ]);
+ toast({ title: "Schedule created", variant: "success" });
+ onClose();
+ }
+
+ return { handleScheduleCreated };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useExpertSkills.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useExpertSkills.ts
new file mode 100644
index 0000000000..841f867303
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useExpertSkills.ts
@@ -0,0 +1,152 @@
+import {
+ getGetExpertQueryKey,
+ useUpdateExpertSkills,
+} from "@/app/api/__generated__/endpoints/experts/experts";
+import { useListCopilotSkills } from "@/app/api/__generated__/endpoints/skills/skills";
+import {
+ getV2GetSpecificAgent,
+ useGetV2ListStoreAgents,
+} from "@/app/api/__generated__/endpoints/store/store";
+import { StoreAgent } from "@/app/api/__generated__/models/storeAgent";
+import { useDebouncedValue } from "@/hooks/useDebouncedValue";
+import { CopilotSkillInfo } from "@/app/api/__generated__/models/copilotSkillInfo";
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { okData } from "@/app/api/helpers";
+import { ApiError } from "@/lib/autogpt-server-api/helpers";
+import { useToast } from "@/components/molecules/Toast/use-toast";
+import { invalidateExpertRosterQueries } from "@/services/experts/invalidate-experts";
+import { useQueryClient } from "@tanstack/react-query";
+import { useState } from "react";
+
+export interface ExpertSkillEntry {
+ name: string;
+ library: CopilotSkillInfo | null;
+}
+
+export function useExpertSkills(expert: Expert) {
+ const { toast } = useToast();
+ const queryClient = useQueryClient();
+ const [query, setQuery] = useState("");
+ const [isAddOpen, setIsAddOpen] = useState(false);
+ const [source, setSource] = useState<"library" | "marketplace">("library");
+ const [marketQuery, setMarketQuery] = useState("");
+ const debouncedMarketQuery = useDebouncedValue(marketQuery, 250);
+ const marketplaceSkills = useGetV2ListStoreAgents(
+ { search_query: debouncedMarketQuery.trim(), page_size: 20 },
+ {
+ query: {
+ enabled: isAddOpen && source === "marketplace",
+ select: (res) => okData(res)?.agents ?? [],
+ },
+ },
+ );
+ const librarySkills = useListCopilotSkills({
+ query: { select: (res) => okData(res) ?? [] },
+ });
+ const { mutateAsync: updateSkills, isPending } = useUpdateExpertSkills();
+
+ const library = librarySkills.data ?? [];
+ const byName = new Map(
+ library.map((skill) => [skill.name.toLowerCase(), skill]),
+ );
+ const attached: ExpertSkillEntry[] = expert.skills.map((name) => ({
+ name,
+ library: byName.get(name.toLowerCase()) ?? null,
+ }));
+ const attachedNames = new Set(
+ expert.skills.map((name) => name.toLowerCase()),
+ );
+ const available = library.filter(
+ (skill) => !attachedNames.has(skill.name.toLowerCase()),
+ );
+ const needle = query.trim().toLowerCase();
+ const visible = needle
+ ? attached.filter(
+ (entry) =>
+ entry.name.toLowerCase().includes(needle) ||
+ (entry.library?.description ?? "").toLowerCase().includes(needle),
+ )
+ : attached;
+
+ async function save(
+ skills: string[],
+ successTitle: string,
+ marketplaceListingIds: string[] = [],
+ ) {
+ try {
+ await updateSkills({
+ expertId: expert.id,
+ data: { skills, marketplace_listing_ids: marketplaceListingIds },
+ });
+ await Promise.all([
+ queryClient.invalidateQueries({
+ queryKey: getGetExpertQueryKey(expert.id),
+ }),
+ invalidateExpertRosterQueries(queryClient),
+ ]);
+ toast({ title: successTitle, variant: "success" });
+ return true;
+ } catch (error) {
+ toast({
+ title: "Couldn't update skills",
+ description: error instanceof ApiError ? error.message : undefined,
+ variant: "destructive",
+ });
+ return false;
+ }
+ }
+
+ async function addSkill(name: string) {
+ const saved = await save([...expert.skills, name], `Added ${name}`);
+ if (saved) setIsAddOpen(false);
+ }
+
+ async function addMarketplaceSkill(agent: StoreAgent) {
+ try {
+ const details = await getV2GetSpecificAgent(
+ agent.creator.toLowerCase(),
+ agent.slug,
+ );
+ if (details.status !== 200) throw new Error("listing unavailable");
+ const saved = await save(expert.skills, `Added ${agent.agent_name}`, [
+ details.data.store_listing_version_id,
+ ]);
+ if (saved) setIsAddOpen(false);
+ } catch (error) {
+ toast({
+ title: "Couldn't add that skill",
+ description: error instanceof ApiError ? error.message : undefined,
+ variant: "destructive",
+ });
+ }
+ }
+
+ function removeSkill(name: string) {
+ return save(
+ expert.skills.filter((skill) => skill !== name),
+ `Removed ${name}`,
+ );
+ }
+
+ return {
+ query,
+ setQuery,
+ visible,
+ hasAny: attached.length > 0,
+ available,
+ isLibraryLoading: librarySkills.isLoading,
+ isAddOpen,
+ openAdd: () => setIsAddOpen(true),
+ closeAdd: () => setIsAddOpen(false),
+ source,
+ setSource,
+ marketQuery,
+ setMarketQuery,
+ marketplaceSkills: marketplaceSkills.data ?? [],
+ isMarketplaceLoading: marketplaceSkills.isFetching,
+ addSkill,
+ addMarketplaceSkill,
+ removeSkill,
+ isSaving: isPending,
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useExpertWorkflowCard.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useExpertWorkflowCard.ts
new file mode 100644
index 0000000000..6b84b7d13e
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useExpertWorkflowCard.ts
@@ -0,0 +1,105 @@
+import { useGetV2GetLibraryAgent } from "@/app/api/__generated__/endpoints/library/library";
+import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
+import { GraphExecutionMeta } from "@/app/api/__generated__/models/graphExecutionMeta";
+import { okData } from "@/app/api/helpers";
+import {
+ Alert01Icon,
+ Calendar03Icon,
+ FlashIcon,
+ PlayIcon,
+} from "@hugeicons/core-free-icons";
+import { useRouter } from "next/navigation";
+import { workflowNeedsSetup } from "../../helpers";
+import { getWorkflowCredentialProviders } from "./WorkflowCredentialStack";
+
+const STATUS = {
+ "needs-setup": {
+ label: "Needs setup",
+ className: "bg-amber-50 text-amber-700",
+ icon: Alert01Icon,
+ iconClassName: "bg-amber-50 text-amber-600",
+ },
+ scheduled: {
+ label: "Scheduled",
+ className: "bg-white text-zinc-700",
+ icon: Calendar03Icon,
+ iconClassName: "bg-violet-50 text-violet-600",
+ },
+ trigger: {
+ label: "Triggered",
+ className: "bg-white text-zinc-700",
+ icon: FlashIcon,
+ iconClassName: "bg-sky-50 text-sky-600",
+ },
+ manual: {
+ label: "Manual",
+ className: "bg-white text-zinc-500",
+ icon: PlayIcon,
+ iconClassName: "bg-zinc-100 text-zinc-500",
+ },
+} as const;
+
+interface Args {
+ workflow: ExpertWorkflowRef;
+ expertId: string;
+}
+
+export function useExpertWorkflowCard({ workflow, expertId }: Args) {
+ const router = useRouter();
+ const name = workflow.name ?? "Unnamed workflow";
+ const needsSetup = workflowNeedsSetup(workflow);
+ const { data: libraryAgent } = useGetV2GetLibraryAgent(
+ workflow.library_agent_id ?? "",
+ {
+ query: {
+ select: okData,
+ enabled: Boolean(workflow.library_agent_id),
+ },
+ },
+ );
+ const libraryHref = workflow.library_agent_id
+ ? `/library/agents/${workflow.library_agent_id}`
+ : null;
+ const chatPrompt = encodeURIComponent(
+ `Tell me about the workflow "${name}" and how you use it.`,
+ );
+
+ function openRun(execution: GraphExecutionMeta) {
+ router.push(`${libraryHref}?activeTab=runs&activeItem=${execution.id}`);
+ }
+
+ function openTriggers() {
+ router.push(`${libraryHref}?activeTab=triggers`);
+ }
+
+ const isTriggerWorkflow =
+ Boolean(libraryAgent?.trigger_setup_info) ||
+ (workflow.chain ?? []).some((item) => item.kind === "trigger");
+ const statusKind = needsSetup
+ ? "needs-setup"
+ : workflow.schedule_cron
+ ? "scheduled"
+ : isTriggerWorkflow
+ ? "trigger"
+ : "manual";
+
+ return {
+ name,
+ needsSetup,
+ libraryAgent,
+ runCount: libraryAgent?.execution_count,
+ isTriggerWorkflow,
+ status: STATUS[statusKind],
+ credentialProviders: getWorkflowCredentialProviders(
+ libraryAgent,
+ workflow.chain ?? [],
+ ),
+ libraryHref,
+ builderHref: workflow.graph_id
+ ? `/build?flowID=${workflow.graph_id}`
+ : null,
+ chatHref: `/copilot?expertId=${expertId}&autosubmit=true#prompt=${chatPrompt}`,
+ openRun,
+ openTriggers,
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useExpertWorkflowsView.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useExpertWorkflowsView.ts
new file mode 100644
index 0000000000..cd22d727c0
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useExpertWorkflowsView.ts
@@ -0,0 +1,22 @@
+import { Key, storage } from "@/services/storage/local-storage";
+import { useEffect, useState } from "react";
+
+export type WorkflowsView = "grid" | "list";
+
+const DEFAULT_VIEW: WorkflowsView = "list";
+
+export function useExpertWorkflowsView() {
+ const [view, setViewState] = useState<WorkflowsView>(DEFAULT_VIEW);
+
+ useEffect(() => {
+ const stored = storage.get(Key.TEAM_WORKFLOWS_VIEW);
+ if (stored === "grid" || stored === "list") setViewState(stored);
+ }, []);
+
+ function setView(next: WorkflowsView) {
+ setViewState(next);
+ storage.set(Key.TEAM_WORKFLOWS_VIEW, next);
+ }
+
+ return { view, setView };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useFitListToDialog.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useFitListToDialog.ts
new file mode 100644
index 0000000000..2bc042309d
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/useFitListToDialog.ts
@@ -0,0 +1,33 @@
+import { useLayoutEffect, useState } from "react";
+
+export function useFitListToDialog<T extends HTMLElement>() {
+ const [list, setList] = useState<T | null>(null);
+
+ useLayoutEffect(() => {
+ if (!list) return;
+ const body = list
+ .closest("[data-dialog-content]")
+ ?.querySelector<HTMLElement>('[class*="overflow-y-auto"]');
+ if (!body) return;
+
+ function fit() {
+ if (!list || !body) return;
+ list.style.maxHeight = "";
+ const overflow = body.scrollHeight - body.clientHeight;
+ const next =
+ overflow > 0 ? Math.max(96, list.offsetHeight - overflow) : undefined;
+ list.style.maxHeight = next === undefined ? "" : `${next}px`;
+ }
+ fit();
+ window.addEventListener("resize", fit);
+ const observer =
+ typeof ResizeObserver === "undefined" ? null : new ResizeObserver(fit);
+ observer?.observe(body);
+ observer?.observe(list);
+ return () => {
+ window.removeEventListener("resize", fit);
+ observer?.disconnect();
+ };
+ }, [list]);
+ return { attachList: setList, list };
+}
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 97af38ded5..3d1d9e071e 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/page.tsx
@@ -1,47 +1,59 @@
"use client";
import { getRaisedExpertAccent } from "@/app/(platform)/marketplace/components/ExpertsSection/helpers";
-import {
- Avatar,
- AvatarFallback,
- AvatarImage,
-} from "@/components/atoms/Avatar/Avatar";
import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
import { Text } from "@/components/atoms/Text/Text";
import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
import { InstallWorkflowPicker } from "@/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker";
+import {
+ TabsLine,
+ TabsLineContent,
+ TabsLineList,
+ TabsLineTrigger,
+} from "@/components/molecules/TabsLine/TabsLine";
import { cn } from "@/lib/utils";
import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";
-import { ArrowLeft02Icon } from "@hugeicons/core-free-icons";
-import { Icon } from "@/components/atoms/Icon/Icon";
-import Link from "next/link";
+import {
+ Briefcase01Icon,
+ Calendar03Icon,
+ PlugSocketIcon,
+ Settings01Icon,
+ SparklesIcon,
+ UserIcon,
+ WorkflowSquare01Icon,
+} from "@hugeicons/core-free-icons";
import { notFound, useParams, useRouter } from "next/navigation";
-import { getLastRunLabel } from "../helpers";
+import { BackToTeamLink } from "../components/BackToTeamLink";
import { FireExpertDialog } from "../components/FireExpertDialog/FireExpertDialog";
-import { FireExpertMenu } from "../components/FireExpertMenu/FireExpertMenu";
+import { SoulDrawer } from "../components/SoulDrawer/SoulDrawer";
+import { getLastRunLabel } from "../helpers";
import { ExpertAboutSection } from "./components/ExpertAboutSection";
+import { ExpertBudgetSection } from "./components/ExpertBudgetSection";
+import { ExpertDetailHeader } from "./components/ExpertDetailHeader";
import { ExpertIntegrationsSection } from "./components/ExpertIntegrationsSection/ExpertIntegrationsSection";
import { ExpertSchedulesSection } from "./components/ExpertSchedulesSection";
+import { ExpertSettingsSection } from "./components/ExpertSettingsSection";
+import { ExpertSkillsSection } from "./components/ExpertSkillsSection";
+import { ExpertSummaryCard } from "./components/ExpertSummaryCard";
import { ExpertWorkSection } from "./components/ExpertWorkSection/ExpertWorkSection";
import { ExpertWorkflowsSection } from "./components/ExpertWorkflowsSection";
import { useExpertDetailPage } from "./useExpertDetailPage";
+import { ACTION_BUTTON_CLASS } from "@/app/(platform)/team/helpers";
const MAIN_CLASS =
- "container min-h-screen space-y-8 pb-20 pt-8 sm:px-8 md:px-12";
-
-function BackToTeamLink() {
- return (
- <Link
- href="/team"
- className="inline-flex items-center gap-1 text-sm text-zinc-500 hover:text-zinc-800"
- data-testid="expert-back-to-team"
- >
- <Icon icon={ArrowLeft02Icon} size={14} />
- Back to Team
- </Link>
- );
-}
+ "container min-h-screen max-w-[1180px] space-y-5 pb-16 pt-6 sm:px-8 md:px-12";
+
+const TABS = [
+ { value: "basics", label: "Basics", icon: UserIcon },
+ { value: "work", label: "Work", icon: Briefcase01Icon },
+ { value: "schedules", label: "Schedules", icon: Calendar03Icon },
+ { value: "workflows", label: "Workflows", icon: WorkflowSquare01Icon },
+ { value: "integrations", label: "Integrations", icon: PlugSocketIcon },
+ { value: "skills", label: "Skills", icon: SparklesIcon },
+ { value: "settings", label: "Settings", icon: Settings01Icon },
+] as const;
export default function ExpertDetailPage() {
const { expertId } = useParams<{ expertId: string }>();
@@ -53,6 +65,9 @@ export default function ExpertDetailPage() {
isError,
refetch,
schedules,
+ activity,
+ isActivityLoading,
+ isActivityError,
isPickerOpen,
openPicker,
closePicker,
@@ -61,6 +76,10 @@ export default function ExpertDetailPage() {
isFireOpen,
openFire,
closeFire,
+ isSoulOpen,
+ soulDrawerKey,
+ toggleSoul,
+ closeSoul,
} = useExpertDetailPage({
expertId,
enabled: Boolean(enabled) && ready,
@@ -69,9 +88,9 @@ export default function ExpertDetailPage() {
if (!ready || isLoading) {
return (
<main className={MAIN_CLASS}>
- <Skeleton className="h-32 w-full rounded-2xl" />
- <Skeleton className="h-48 w-full rounded-2xl" />
- <Skeleton className="h-48 w-full rounded-2xl" />
+ <Skeleton className="h-20 w-full rounded-xl" />
+ <Skeleton className="h-10 w-full rounded-xl" />
+ <Skeleton className="h-48 w-full rounded-xl" />
</main>
);
}
@@ -93,135 +112,138 @@ export default function ExpertDetailPage() {
);
}
- const accent = getRaisedExpertAccent(expert.role, expert.color);
const isPaused = Boolean(expert.schedules_paused_at);
return (
- <main className={MAIN_CLASS}>
- <BackToTeamLink />
-
- <header
- className={cn(
- "relative flex flex-col gap-5 overflow-hidden rounded-2xl border border-zinc-200/60 p-6 sm:flex-row sm:items-center",
- accent.washWide,
- )}
- >
- <Avatar className="h-20 w-20 bg-white shadow-sm ring-1 ring-black/5">
- {expert.avatar_url ? (
- <AvatarImage src={expert.avatar_url} alt={expert.name} />
- ) : null}
- <AvatarFallback>{expert.name}</AvatarFallback>
- </Avatar>
- <div className="min-w-0 flex-1">
- <div className="flex flex-wrap items-center gap-3">
- <h1 className="text-3xl font-semibold tracking-[-0.02em] text-zinc-900">
- {expert.name}
- </h1>
- <span
- className={cn(
- "inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-sm font-medium",
- accent.pill,
- )}
+ <div className="flex w-full">
+ <main className={cn(MAIN_CLASS, "min-w-0 flex-1")}>
+ <BackToTeamLink />
+ <ExpertDetailHeader expert={expert} onEditSoul={toggleSoul} />
+
+ {isPaused ? (
+ <div className="flex items-center justify-between gap-2 rounded-lg bg-amber-50 px-4 py-2.5 ring-1 ring-inset ring-amber-200">
+ <Text variant="small" className="text-amber-700">
+ Schedules paused
+ </Text>
+ <Button
+ variant="secondary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ loading={isResuming}
+ onClick={resumeSchedules}
>
- <Icon icon={accent.roleIcon} size={14} />
- {expert.role}
- </span>
+ Resume schedules
+ </Button>
</div>
- {expert.tagline ? (
- <p className="mt-1.5 text-base text-zinc-500">{expert.tagline}</p>
- ) : null}
- </div>
- <div className="flex shrink-0 items-center gap-2">
- <Button
- as="NextLink"
- href={`/copilot?expertId=${expert.id}`}
- variant="primary"
- size="small"
- >
- Chat
- </Button>
- <FireExpertMenu
- expertName={expert.name}
- onFire={openFire}
- testId="expert-detail-actions"
- triggerClassName="bg-white/70 text-zinc-500 ring-1 ring-inset ring-black/5 hover:bg-white hover:text-zinc-800"
- />
- </div>
- </header>
-
- {isPaused ? (
- <div className="flex items-center justify-between gap-2 rounded-xl bg-amber-50 px-4 py-3 ring-1 ring-inset ring-amber-200">
- <Text variant="small" className="text-amber-700">
- Schedules paused
- </Text>
- <Button
- variant="secondary"
- size="small"
- loading={isResuming}
- onClick={resumeSchedules}
- >
- Resume schedules
- </Button>
- </div>
- ) : null}
+ ) : null}
- <ExpertAboutSection text={expert.bio || expert.identity} />
+ <ExpertBudgetSection expert={expert} />
- {expert.skills && expert.skills.length > 0 ? (
- <section>
- <div className="mb-2.5 text-xs font-medium uppercase tracking-[0.14em] text-zinc-400">
- Skills
- </div>
- <div className="flex flex-wrap gap-2">
- {expert.skills.map((skill) => (
- <span
- key={skill}
- className="rounded-full bg-zinc-50 px-3 py-1.5 text-sm text-zinc-600 ring-1 ring-inset ring-zinc-200/80"
+ <TabsLine defaultValue="basics">
+ <TabsLineList
+ flush
+ className="overflow-x-auto"
+ indicatorClassName="bg-zinc-900"
+ >
+ {TABS.map((tab) => (
+ <TabsLineTrigger
+ key={tab.value}
+ value={tab.value}
+ className="gap-1.5 px-2.5 py-2 text-sm leading-5 data-[state=active]:text-zinc-900"
>
- {skill}
- </span>
+ <Icon icon={tab.icon} size={14} />
+ {tab.label}
+ </TabsLineTrigger>
))}
- </div>
- </section>
- ) : null}
-
- <ExpertWorkSection
- expertId={expert.id}
- enabled={Boolean(enabled) && ready}
- />
-
- <ExpertSchedulesSection
- expertName={expert.name}
- schedules={schedules}
- lastRunLabel={getLastRunLabel(expert)}
- />
-
- <ExpertIntegrationsSection
- expertId={expert.id}
- expertName={expert.name}
- expertAvatarUrl={expert.avatar_url ?? null}
- />
-
- <ExpertWorkflowsSection
- expert={expert}
- accentIconClass={accent.icon}
- onInstallWorkflow={openPicker}
- />
+ </TabsLineList>
+
+ <TabsLineContent value="basics">
+ <div className="grid gap-4 lg:grid-cols-[minmax(0,3fr)_minmax(300px,1fr)]">
+ <ExpertAboutSection
+ bio={expert.bio}
+ identity={expert.identity}
+ voicePreferences={expert.voice_preferences}
+ boundaries={expert.boundaries}
+ />
+ <ExpertSummaryCard
+ expert={expert}
+ activity={activity}
+ isActivityLoading={isActivityLoading}
+ isActivityError={isActivityError}
+ />
+ </div>
+ </TabsLineContent>
+
+ <TabsLineContent value="work">
+ <ExpertWorkSection
+ expertId={expert.id}
+ enabled={Boolean(enabled) && ready}
+ />
+ </TabsLineContent>
+
+ <TabsLineContent value="schedules">
+ <ExpertSchedulesSection
+ title={`${expert.name}'s Schedules`}
+ accentClassName={
+ getRaisedExpertAccent(expert.role, expert.color).pill
+ }
+ expertName={expert.name}
+ expertId={expert.id}
+ workflows={expert.workflows}
+ schedules={schedules}
+ lastRunLabel={getLastRunLabel(expert)}
+ />
+ </TabsLineContent>
+
+ <TabsLineContent value="workflows">
+ <ExpertWorkflowsSection
+ expert={expert}
+ onInstallWorkflow={openPicker}
+ />
+ </TabsLineContent>
+
+ <TabsLineContent value="integrations">
+ <ExpertIntegrationsSection
+ expertId={expert.id}
+ expertName={expert.name}
+ />
+ </TabsLineContent>
+
+ <TabsLineContent value="skills">
+ <ExpertSkillsSection
+ expert={expert}
+ accentClassName={
+ getRaisedExpertAccent(expert.role, expert.color).pill
+ }
+ />
+ </TabsLineContent>
+
+ <TabsLineContent value="settings">
+ <ExpertSettingsSection expert={expert} onFire={openFire} />
+ </TabsLineContent>
+ </TabsLine>
+
+ <InstallWorkflowPicker
+ mode="pick-workflow"
+ expertId={expert.id}
+ open={isPickerOpen}
+ onClose={closePicker}
+ />
- <InstallWorkflowPicker
- mode="pick-workflow"
- expertId={expert.id}
- open={isPickerOpen}
- onClose={closePicker}
- />
+ <FireExpertDialog
+ expertId={expert.id}
+ expertName={expert.name}
+ open={isFireOpen}
+ onClose={closeFire}
+ onFired={() => router.push("/team")}
+ />
+ </main>
- <FireExpertDialog
- expertId={expert.id}
- expertName={expert.name}
- open={isFireOpen}
- onClose={closeFire}
- onFired={() => router.push("/team")}
+ <SoulDrawer
+ key={soulDrawerKey}
+ expert={isSoulOpen ? expert : null}
+ onClose={closeSoul}
/>
- </main>
+ </div>
);
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/useExpertDetailPage.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/useExpertDetailPage.ts
index 9c7737bdc4..dd8e76f029 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/useExpertDetailPage.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/useExpertDetailPage.ts
@@ -2,6 +2,7 @@ import {
getGetExpertQueryKey,
getListExpertsQueryKey,
useGetExpert,
+ useGetExpertActivity,
useResumeExpertSchedules,
} from "@/app/api/__generated__/endpoints/experts/experts";
import { useGetV1ListExecutionSchedulesForAUser } from "@/app/api/__generated__/endpoints/schedules/schedules";
@@ -27,6 +28,9 @@ export function useExpertDetailPage({ expertId, enabled }: Args) {
const schedulesQuery = useGetV1ListExecutionSchedulesForAUser({
query: { select: (res) => okData(res) ?? [], enabled },
});
+ const activityQuery = useGetExpertActivity(expertId, {
+ query: { select: (res) => okData(res) ?? null, enabled },
+ });
const expert = expertQuery.data ?? null;
const schedules = expert
@@ -34,6 +38,8 @@ export function useExpertDetailPage({ expertId, enabled }: Args) {
: [];
const [isFireOpen, setIsFireOpen] = useState(false);
+ const [isSoulOpen, setIsSoulOpen] = useState(false);
+ const [soulDrawerKey, setSoulDrawerKey] = useState(0);
const { mutate: resumeSchedules, isPending: isResuming } =
useResumeExpertSchedules({
@@ -54,7 +60,11 @@ export function useExpertDetailPage({ expertId, enabled }: Args) {
});
async function refetch() {
- await Promise.all([expertQuery.refetch(), schedulesQuery.refetch()]);
+ await Promise.all([
+ expertQuery.refetch(),
+ schedulesQuery.refetch(),
+ activityQuery.refetch(),
+ ]);
}
function openFire() {
@@ -65,6 +75,19 @@ export function useExpertDetailPage({ expertId, enabled }: Args) {
setIsFireOpen(false);
}
+ function toggleSoul() {
+ if (isSoulOpen) {
+ setIsSoulOpen(false);
+ return;
+ }
+ setIsSoulOpen(true);
+ setSoulDrawerKey((current) => current + 1);
+ }
+
+ function closeSoul() {
+ setIsSoulOpen(false);
+ }
+
return {
expert,
isLoading: enabled && (expertQuery.isLoading || schedulesQuery.isLoading),
@@ -74,6 +97,9 @@ export function useExpertDetailPage({ expertId, enabled }: Args) {
(expertQuery.isFetched && expert === null),
refetch,
schedules,
+ activity: activityQuery.data ?? null,
+ isActivityLoading: enabled && activityQuery.isLoading,
+ isActivityError: activityQuery.isError,
isPickerOpen,
openPicker: () => setIsPickerOpen(true),
closePicker: () => setIsPickerOpen(false),
@@ -82,5 +108,9 @@ export function useExpertDetailPage({ expertId, enabled }: Args) {
isFireOpen,
openFire,
closeFire,
+ isSoulOpen,
+ soulDrawerKey,
+ toggleSoul,
+ closeSoul,
};
}
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 3ff2a50672..5116804193 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
@@ -2,11 +2,9 @@ import {
getArchiveExpertMockHandler,
getArchiveExpertMockHandler401,
getGetExpertDetachPreviewMockHandler,
- getInstallExpertWorkflowMockHandler,
- getInstallExpertWorkflowMockHandler404,
- getInstallExpertWorkflowMockHandler422,
getAssignExpertPodMockHandler,
getCreateExpertPodMockHandler,
+ getListExpertCredentialsMockHandler,
getListExpertPodsMockHandler,
getListExpertPodsMockHandler401,
getListExpertsMockHandler,
@@ -17,7 +15,6 @@ import {
} from "@/app/api/__generated__/endpoints/experts/experts.msw";
import {
getGetV2ListLibraryAgentsMockHandler200,
- getGetV2ListLibraryAgentsMockHandler401,
getGetV2ListLibraryAgentsResponseMock200,
} from "@/app/api/__generated__/endpoints/library/library.msw";
import { getGetV1ListExecutionSchedulesForAUserMockHandler } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";
@@ -38,6 +35,11 @@ import { delay, http, HttpResponse } from "msw";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import TeamPage from "../page";
+vi.mock("framer-motion", async (importActual) => {
+ const actual = await importActual<typeof import("framer-motion")>();
+ return { ...actual, useReducedMotion: () => true };
+});
+
const toastMock = vi.hoisted(() => vi.fn());
const { setFlagStatusMock } = vi.hoisted(() => ({
setFlagStatusMock: vi.fn(() => ({ enabled: true, ready: true })),
@@ -62,46 +64,6 @@ function libraryResponse(
};
}
-function makeLibraryAgent(over: Partial<LibraryAgent>): LibraryAgent {
- return {
- id: "lib-agent",
- graph_id: "graph-agent",
- graph_version: 1,
- name: "Research Assistant",
- description: "",
- creator_name: "Acme Labs",
- creator_image_url: "",
- image_url: null,
- status: "COMPLETED",
- created_at: new Date(),
- updated_at: new Date(),
- input_schema: {},
- output_schema: {},
- credentials_input_schema: {},
- has_external_trigger: false,
- has_human_in_the_loop: false,
- has_sensitive_action: false,
- new_output: false,
- can_access_graph: true,
- is_latest_version: true,
- is_favorite: false,
- marketplace_listing: null,
- ...over,
- } as unknown as LibraryAgent;
-}
-
-const adoptableAgent = makeLibraryAgent({
- id: "lib-research",
- graph_id: "graph-research",
- name: "Research Assistant",
-});
-
-const unpublishedAgent = makeLibraryAgent({
- id: "lib-local",
- graph_id: "graph-local",
- name: "My Private Agent",
-});
-
function makeSchedule(
over: Partial<GraphExecutionJobInfo> = {},
): GraphExecutionJobInfo {
@@ -119,10 +81,17 @@ function makeSchedule(
};
}
+/** Reads the value of one of the expert card's stat rows by its label. */
+function getStatValue(card: HTMLElement, label: string) {
+ const row = within(card).getByText(label).closest("div");
+ return row?.querySelector("dd")?.textContent;
+}
+
beforeEach(() => {
server.use(
getGetV1ListExecutionSchedulesForAUserMockHandler([]),
getListExpertPodsMockHandler([]),
+ getListExpertCredentialsMockHandler([]),
getGetV2ListLibraryAgentsMockHandler200(libraryResponse([])),
);
});
@@ -174,8 +143,11 @@ vi.mock("next/navigation", () => ({
}));
async function openNewPodDialog(user: ReturnType<typeof userEvent.setup>) {
- await user.click(await screen.findByRole("button", { name: /create/i }));
- await user.click(await screen.findByRole("menuitem", { name: "New pod" }));
+ await user.click(await screen.findByRole("button", { name: "New Pod" }));
+}
+
+async function openTab(user: ReturnType<typeof userEvent.setup>, name: string) {
+ await user.click(await screen.findByRole("tab", { name }));
}
const hiredMaria: Expert = {
@@ -237,7 +209,7 @@ describe("TeamPage", () => {
render(<TeamPage />);
const autopilot = await screen.findByText("Autopilot");
- expect(screen.getByText(/runs the shop/i)).toBeDefined();
+ expect(screen.getByText("Head of AI")).toBeDefined();
const maria = await screen.findByText("Maria");
expect(
@@ -246,40 +218,28 @@ describe("TeamPage", () => {
).toBeTruthy();
});
- test("Create menu exposes accessible hire and build actions", async () => {
- const user = userEvent.setup();
+ test("header exposes New Expert and New Pod actions", async () => {
server.use(getListExpertsMockHandler([hiredMaria]));
render(<TeamPage />);
- const trigger = await screen.findByRole("button", { name: /create/i });
- // The Radix trigger advertises its menu to assistive tech and keyboard users.
- expect(trigger.getAttribute("aria-haspopup")).toBe("menu");
-
- await user.click(trigger);
-
- const hire = await screen.findByRole("menuitem", {
- name: "Hire an expert",
- });
- expect(hire.getAttribute("href")).toBe("/marketplace#experts");
-
- const build = screen.getByRole("menuitem", {
- name: "Build an agent from scratch",
- });
- expect(build.getAttribute("href")).toBe("/build");
+ const newExpert = await screen.findByRole("link", { name: "New Expert" });
+ expect(newExpert.getAttribute("href")).toBe("/raise");
- expect(screen.getByRole("menuitem", { name: "New pod" })).toBeDefined();
+ expect(screen.getByRole("button", { name: "New Pod" })).toBeDefined();
});
- test("renders hired experts with a workflow count instead of chips", async () => {
+ test("renders hired experts with a stat strip instead of chips", async () => {
server.use(getListExpertsMockHandler([hiredMaria]));
render(<TeamPage />);
expect(await screen.findByText("Maria")).toBeDefined();
expect(screen.getByText("Marketing Strategist")).toBeDefined();
- expect(screen.getByText("2 workflows")).toBeDefined();
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");
expect(within(card).queryByText("Content Calendar")).toBeNull();
expect(within(card).queryByText("SEO Audit")).toBeNull();
});
@@ -310,7 +270,24 @@ describe("TeamPage", () => {
).toBeDefined();
});
- test("shows a schedule count with the next run on the expert card", async () => {
+ test("counts the integrations an expert has been granted", async () => {
+ const credentialRequests = vi.fn();
+ server.use(
+ getListExpertsMockHandler([{ ...hiredMaria, credential_count: 2 }]),
+ http.get("*/api/experts/:expertId/credentials", () => {
+ credentialRequests();
+ return HttpResponse.json([]);
+ }),
+ );
+
+ render(<TeamPage />);
+
+ const card = await screen.findByRole("link", { name: "View Maria" });
+ await waitFor(() => expect(getStatValue(card, "Integrations")).toBe("2"));
+ expect(credentialRequests).not.toHaveBeenCalled();
+ });
+
+ test("counts an expert's schedules on their card", async () => {
const inTwoDays = new Date(Date.now() + 2 * 24 * 60 * 60 * 1000);
const mariaSchedule = makeSchedule({
next_run_time: inTwoDays.toISOString(),
@@ -322,8 +299,10 @@ describe("TeamPage", () => {
render(<TeamPage />);
- await screen.findByText("Maria");
- expect(await screen.findByText(/1 schedule · next in/)).toBeDefined();
+ // Maria renders on both her card and the timeline lane once scheduled.
+ await screen.findAllByText("Maria");
+ const card = await screen.findByRole("link", { name: "View Maria" });
+ expect(getStatValue(card, "Schedules")).toBe("1");
});
test("marks scheduled workflows without a schedule as needing setup", async () => {
@@ -343,6 +322,20 @@ describe("TeamPage", () => {
await screen.findByText("Maria");
expect(screen.getByText(/1 needs setup/)).toBeDefined();
+ expect(screen.getByText("Needs you")).toBeDefined();
+ });
+
+ test("marks an expert with an active run as working", async () => {
+ server.use(
+ getListExpertsMockHandler([
+ { ...hiredMaria, last_run_status: "RUNNING" },
+ ]),
+ );
+
+ render(<TeamPage />);
+
+ const card = await screen.findByRole("link", { name: "View Maria" });
+ expect(within(card).getByText("Working")).toBeDefined();
});
test("shows weekly spend as a progress bar on the expert card", async () => {
@@ -356,7 +349,7 @@ describe("TeamPage", () => {
render(<TeamPage />);
await screen.findByText("Maria");
- expect(screen.getByText("Spend this week")).toBeDefined();
+ expect(screen.getByText("Budget")).toBeDefined();
expect(screen.getByText("$12 / $50")).toBeDefined();
});
@@ -391,7 +384,9 @@ describe("TeamPage", () => {
await user.click(await screen.findByRole("button", { name: "Edit Soul" }));
- expect(screen.getByRole("dialog", { name: "Maria's Soul" })).toBeDefined();
+ expect(
+ screen.getByRole("complementary", { name: "Maria's Soul" }),
+ ).toBeDefined();
expect(
(screen.getByRole("textbox", { name: "Name" }) as HTMLInputElement).value,
).toBe("Maria");
@@ -425,23 +420,26 @@ describe("TeamPage", () => {
expect(screen.queryByRole("button", { name: /remove/i })).toBeNull();
});
- test("keeps the Soul drawer mounted for its exit animation", async () => {
+ test("closes the Soul panel from its cancel action", async () => {
const user = userEvent.setup();
server.use(getListExpertsMockHandler([hiredMaria]));
render(<TeamPage />);
await user.click(await screen.findByRole("button", { name: "Edit Soul" }));
- const dialog = screen.getByRole("dialog", { name: "Maria's Soul" });
+ expect(
+ screen.getByRole("complementary", { name: "Maria's Soul" }),
+ ).toBeDefined();
await user.click(screen.getByRole("button", { name: "Cancel" }));
await waitFor(() => {
- expect(dialog.getAttribute("data-state")).toBe("closed");
+ expect(
+ screen.queryByRole("complementary", { name: "Maria's Soul" }),
+ ).toBeNull();
});
- expect(dialog.textContent).toContain("Maria's Soul");
});
- test("opens only the Soul drawer when activated with the keyboard", async () => {
+ test("opens only the Soul panel when activated with the keyboard", async () => {
const user = userEvent.setup();
server.use(getListExpertsMockHandler([hiredMaria]));
@@ -451,7 +449,9 @@ describe("TeamPage", () => {
editSoul.focus();
await user.keyboard("{Enter}");
- expect(screen.getByRole("dialog", { name: "Maria's Soul" })).toBeDefined();
+ expect(
+ screen.getByRole("complementary", { name: "Maria's Soul" }),
+ ).toBeDefined();
expect(screen.queryByRole("dialog", { name: "Maria" })).toBeNull();
});
@@ -570,7 +570,9 @@ describe("TeamPage", () => {
expect((voiceInput as HTMLTextAreaElement).value).toBe(
"Calm and conversational.",
);
- expect(screen.getByRole("dialog", { name: "Maria's Soul" })).toBeDefined();
+ expect(
+ screen.getByRole("complementary", { name: "Maria's Soul" }),
+ ).toBeDefined();
});
test("states what firing pauses from the detach preview", async () => {
@@ -854,6 +856,7 @@ describe("TeamPage", () => {
});
test("groups experts under their pod with ungrouped members below", async () => {
+ const user = userEvent.setup();
const growthPod: ExpertPod = {
id: "pod-growth",
name: "Growth",
@@ -879,6 +882,7 @@ describe("TeamPage", () => {
);
render(<TeamPage />);
+ await openTab(user, "Pod board");
const podHeader = await screen.findByRole("heading", { name: "Growth" });
const maria = await screen.findByText("Maria");
@@ -902,6 +906,7 @@ describe("TeamPage", () => {
});
test("shows a pod with no members instead of hiding it", async () => {
+ const user = userEvent.setup();
const emptyPod: ExpertPod = {
id: "pod-empty",
name: "Support",
@@ -913,6 +918,7 @@ describe("TeamPage", () => {
);
render(<TeamPage />);
+ await openTab(user, "Pod board");
const podHeader = await screen.findByRole("heading", { name: "Support" });
const emptyCopy = await screen.findByText("No experts in this pod yet.");
@@ -1068,11 +1074,11 @@ describe("TeamPage", () => {
render(<TeamPage />);
await screen.findByText("Maria");
- // The trigger names the pod the expert is already in.
+ // The trigger is icon-only, so the pod it is already in has to come
+ // through in the accessible name.
const trigger = screen.getByRole("button", {
name: "Move to pod (currently Growth)",
});
- expect(trigger.textContent).toContain("Growth");
await user.click(trigger);
await user.click(
await screen.findByRole("menuitem", { name: "Remove from pod" }),
@@ -1171,351 +1177,6 @@ describe("TeamPage", () => {
expect(screen.queryByRole("button", { name: "Edit Soul" })).toBeNull();
});
- test("groups installed workflows under each expert in the What runs zone", async () => {
- const john: Expert = {
- ...hiredMaria,
- id: "expert-john",
- name: "John",
- workflows: [
- {
- id: "wf-j",
- store_listing_version_id: "slv-j",
- library_agent_id: "lib-j",
- graph_id: "graph-j",
- name: "Lead Scraper",
- description: null,
- },
- ],
- };
- server.use(getListExpertsMockHandler([scheduledMaria, john]));
-
- render(<TeamPage />);
-
- const zone = await screen.findByRole("region", { name: "What runs" });
- const mariaGroup = within(zone).getByRole("region", {
- name: "Maria runs",
- });
- expect(within(mariaGroup).getByText("Content Calendar")).toBeDefined();
- expect(within(mariaGroup).getByText("SEO Audit")).toBeDefined();
- expect(within(mariaGroup).queryByText("Lead Scraper")).toBeNull();
-
- const johnGroup = within(zone).getByRole("region", { name: "John runs" });
- expect(within(johnGroup).getByText("Lead Scraper")).toBeDefined();
- expect(within(johnGroup).queryByText("Content Calendar")).toBeNull();
- });
-
- test("shows a quiet empty message for an expert with nothing installed", async () => {
- const emptyMaria: Expert = { ...hiredMaria, workflows: [] };
- server.use(getListExpertsMockHandler([emptyMaria]));
-
- render(<TeamPage />);
-
- const group = await screen.findByRole("region", { name: "Maria runs" });
- expect(within(group).getByText(/nothing installed yet/i)).toBeDefined();
- });
-
- test("offers Adopt for unpublished agents too", async () => {
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([adoptableAgent, unpublishedAgent]),
- ),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- expect(within(agents).getByText("Research Assistant")).toBeDefined();
- expect(within(agents).getByText("My Private Agent")).toBeDefined();
- expect(
- within(agents).getAllByRole("button", { name: "Install" }),
- ).toHaveLength(2);
- });
-
- test("hides already-installed agents from Your workflows", async () => {
- const installedAgent = makeLibraryAgent({
- id: "lib-1",
- graph_id: "graph-1",
- name: "Content Calendar",
- });
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([installedAgent, adoptableAgent]),
- ),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- expect(within(agents).getByText("Research Assistant")).toBeDefined();
- expect(within(agents).queryByText("My Private Agent")).toBeNull();
- expect(
- within(agents).getAllByRole("button", { name: "Install" }),
- ).toHaveLength(1);
- });
-
- test("adopts an agent onto the selected expert via the install endpoint", async () => {
- const user = userEvent.setup();
- let installExpertId: string | undefined;
- let installBody: unknown;
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([adoptableAgent]),
- ),
- getInstallExpertWorkflowMockHandler(async (info) => {
- installExpertId = info.params.expertId as string;
- installBody = await info.request.json();
- return {
- id: "wf-adopted",
- store_listing_version_id: "slv-adopt",
- library_agent_id: "lib-research",
- graph_id: "graph-research",
- name: "Research Assistant",
- description: null,
- };
- }),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- await user.click(within(agents).getByRole("button", { name: "Install" }));
-
- await waitFor(() => expect(installExpertId).toBe("expert-maria"));
- expect(installBody).toEqual({ library_agent_id: "lib-research" });
- expect(within(agents).queryByText("Research Assistant")).toBeNull();
- });
-
- test("asks which expert to install onto when more than one is hired", async () => {
- const user = userEvent.setup();
- const john: Expert = {
- ...hiredMaria,
- id: "expert-john",
- name: "John",
- workflows: [],
- };
- let installExpertId: string | undefined;
- server.use(
- getListExpertsMockHandler([hiredMaria, john]),
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([adoptableAgent]),
- ),
- getInstallExpertWorkflowMockHandler((info) => {
- installExpertId = info.params.expertId as string;
- return {
- id: "wf-adopted",
- store_listing_version_id: "slv-adopt",
- library_agent_id: "lib-research",
- graph_id: "graph-research",
- name: "Research Assistant",
- description: null,
- };
- }),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- await user.click(within(agents).getByRole("button", { name: "Install" }));
- expect(screen.queryByText(/undo anytime/i)).toBeNull();
- await user.click(
- await screen.findByRole("button", {
- name: /Installs on John/i,
- }),
- );
-
- await waitFor(() => expect(installExpertId).toBe("expert-john"));
- });
-
- test("offers an agent only to experts that have not adopted it", async () => {
- const user = userEvent.setup();
- const mariaWithAgent: Expert = {
- ...hiredMaria,
- workflows: [
- ...hiredMaria.workflows,
- {
- id: "wf-adopted",
- store_listing_version_id: null,
- library_agent_id: "lib-research",
- graph_id: "graph-research",
- name: "Research Assistant",
- description: null,
- },
- ],
- };
- const john: Expert = {
- ...hiredMaria,
- id: "expert-john",
- name: "John",
- workflows: [],
- };
- let installExpertId: string | undefined;
- server.use(
- getListExpertsMockHandler([mariaWithAgent, john]),
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([adoptableAgent]),
- ),
- getInstallExpertWorkflowMockHandler((info) => {
- installExpertId = info.params.expertId as string;
- return {
- id: "wf-john",
- store_listing_version_id: "slv-adopt",
- library_agent_id: "lib-research",
- graph_id: "graph-research",
- name: "Research Assistant",
- description: null,
- };
- }),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- await user.click(within(agents).getByRole("button", { name: "Install" }));
-
- await waitFor(() => expect(installExpertId).toBe("expert-john"));
- expect(screen.queryByText("Choose an expert")).toBeNull();
- });
-
- test("filter chips switch between members and agents in the zone", async () => {
- const user = userEvent.setup();
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([adoptableAgent]),
- ),
- );
-
- render(<TeamPage />);
-
- await screen.findByRole("region", { name: "Maria runs" });
- await screen.findByRole("region", { name: "Your workflows" });
-
- await user.click(screen.getByRole("button", { name: "Unassigned" }));
- expect(screen.queryByRole("region", { name: "Maria runs" })).toBeNull();
- expect(
- screen.getByRole("region", { name: "Your workflows" }),
- ).toBeDefined();
-
- await user.click(screen.getByRole("button", { name: "Members" }));
- expect(screen.getByRole("region", { name: "Maria runs" })).toBeDefined();
- expect(screen.queryByRole("region", { name: "Your workflows" })).toBeNull();
- });
-
- test("keeps only workflows with actual jobs when Scheduled is active", async () => {
- const user = userEvent.setup();
- const manuallyScheduledMaria: Expert = {
- ...hiredMaria,
- workflows: [
- { ...hiredMaria.workflows[0], schedule_id: null, schedule_cron: null },
- hiredMaria.workflows[1],
- ],
- };
- server.use(
- getListExpertsMockHandler([manuallyScheduledMaria]),
- getGetV1ListExecutionSchedulesForAUserMockHandler([makeSchedule()]),
- );
-
- render(<TeamPage />);
-
- const group = await screen.findByRole("region", { name: "Maria runs" });
- expect(within(group).getByText("Content Calendar")).toBeDefined();
- expect(within(group).getByText("SEO Audit")).toBeDefined();
-
- await user.click(screen.getByRole("button", { name: "Scheduled" }));
-
- const scheduledGroup = screen.getByRole("region", { name: "Maria runs" });
- expect(within(scheduledGroup).getByText("Content Calendar")).toBeDefined();
- expect(within(scheduledGroup).queryByText("SEO Audit")).toBeNull();
- });
-
- test("does not treat a deleted scheduler job as scheduled", async () => {
- const user = userEvent.setup();
- server.use(getListExpertsMockHandler([scheduledMaria]));
-
- render(<TeamPage />);
-
- await screen.findByRole("region", { name: "Maria runs" });
- await user.click(screen.getByRole("button", { name: "Scheduled" }));
-
- expect(screen.queryByRole("region", { name: "Maria runs" })).toBeNull();
- expect(screen.getByText("No scheduled workflows yet.")).toBeDefined();
- });
-
- test("shows every actual schedule attached to a workflow", async () => {
- server.use(
- getListExpertsMockHandler([scheduledMaria]),
- getGetV1ListExecutionSchedulesForAUserMockHandler([
- makeSchedule(),
- makeSchedule({ id: "sched-2", cron: "0 9 * * 1" }),
- ]),
- );
-
- render(<TeamPage />);
-
- const group = await screen.findByRole("region", { name: "Maria runs" });
- expect(within(group).getByText("Every day at 07:40")).toBeDefined();
- expect(within(group).getByText("Every Monday at 09:00")).toBeDefined();
- });
-
- test("shows paused instead of recurrence for a paused workflow", async () => {
- const pausedMaria: Expert = {
- ...scheduledMaria,
- schedules_paused_at: new Date("2026-08-14T12:00:00Z"),
- workflows: scheduledMaria.workflows.map((workflow) => ({
- ...workflow,
- schedule_id: null,
- })),
- };
- server.use(
- getListExpertsMockHandler([pausedMaria]),
- getGetV1ListExecutionSchedulesForAUserMockHandler([makeSchedule()]),
- );
-
- render(<TeamPage />);
-
- const group = await screen.findByRole("region", { name: "Maria runs" });
- const workflow = within(group).getAllByTestId("what-runs-workflow-row")[0];
- expect(within(group).getAllByText("Paused")).toHaveLength(1);
- expect(within(workflow).queryByText("Paused")).toBeNull();
- expect(within(workflow).queryByText("Every day at 07:40")).toBeNull();
- expect(within(workflow).queryByText("Needs setup")).toBeNull();
- });
-
- test("links a workflow with a missing job to its setup page", async () => {
- const staleMaria: Expert = {
- ...hiredMaria,
- workflows: [
- {
- ...hiredMaria.workflows[0],
- schedule_cron: "40 7 * * *",
- schedule_id: "deleted-schedule",
- },
- ],
- };
- server.use(getListExpertsMockHandler([staleMaria]));
-
- render(<TeamPage />);
-
- const group = await screen.findByRole("region", { name: "Maria runs" });
- expect(within(group).getByText("Needs setup")).toBeDefined();
- expect(
- within(group).getByRole("link", { name: "Set up" }).getAttribute("href"),
- ).toBe("/library/agents/lib-1");
- });
-
test("does not mark the card as needing setup when a stale id has a live job", async () => {
const staleButLiveMaria: Expert = {
...hiredMaria,
@@ -1537,286 +1198,4 @@ describe("TeamPage", () => {
const card = await screen.findByRole("link", { name: "View Maria" });
expect(within(card).queryByText(/needs setup/i)).toBeNull();
});
-
- test("shows feedback and re-enables Adopt when adoption fails", async () => {
- const user = userEvent.setup();
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([adoptableAgent]),
- ),
- getInstallExpertWorkflowMockHandler422(),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- await user.click(within(agents).getByRole("button", { name: "Install" }));
-
- await waitFor(() =>
- expect(toastMock).toHaveBeenCalledWith(
- expect.objectContaining({
- title: "Couldn't install on Maria",
- variant: "destructive",
- }),
- ),
- );
- const adoptButton = within(agents).getByRole("button", { name: "Install" });
- expect(adoptButton.hasAttribute("disabled")).toBe(false);
- });
-
- test("explains when an adopted agent is no longer available", async () => {
- const user = userEvent.setup();
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([adoptableAgent]),
- ),
- getInstallExpertWorkflowMockHandler404(),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- await user.click(within(agents).getByRole("button", { name: "Install" }));
-
- await waitFor(() =>
- expect(toastMock).toHaveBeenCalledWith(
- expect.objectContaining({
- description: "This workflow is no longer available.",
- }),
- ),
- );
- });
-
- test("tracks pending adoption by library agent id", async () => {
- const user = userEvent.setup();
- let installCalls = 0;
- const sameGraphAgent = makeLibraryAgent({
- ...adoptableAgent,
- id: "lib-research-v2",
- name: "Research Assistant v2",
- });
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([adoptableAgent, sameGraphAgent]),
- ),
- getInstallExpertWorkflowMockHandler(async () => {
- installCalls += 1;
- await new Promise((resolve) => setTimeout(resolve, 150));
- return {
- id: "wf-adopted",
- store_listing_version_id: "slv-adopt",
- library_agent_id: "lib-research",
- graph_id: "graph-research",
- name: "Research Assistant",
- description: null,
- };
- }),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- const rows = within(agents).getAllByTestId("what-runs-agent-row");
- const firstAdopt = within(rows[0]).getByRole("button", { name: "Install" });
- const secondAdopt = within(rows[1]).getByRole("button", {
- name: "Install",
- });
- await user.click(firstAdopt);
- await waitFor(() => expect(firstAdopt.hasAttribute("disabled")).toBe(true));
- expect(secondAdopt.hasAttribute("disabled")).toBe(false);
- await user.click(firstAdopt);
-
- await waitFor(() =>
- expect(toastMock).toHaveBeenCalledWith(
- expect.objectContaining({ variant: "success" }),
- ),
- );
- expect(installCalls).toBe(1);
- });
-
- test("shows a retry state when loading your agents fails", async () => {
- const user = userEvent.setup();
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- getGetV2ListLibraryAgentsMockHandler401(),
- );
-
- render(<TeamPage />);
-
- expect(
- await screen.findByText(/could not load your workflows/i),
- ).toBeDefined();
-
- server.use(
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([adoptableAgent]),
- ),
- );
- await user.click(screen.getByRole("button", { name: "Retry" }));
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- expect(within(agents).getByText("Research Assistant")).toBeDefined();
- });
-
- test("shows filter-specific empty states for Workflows and Scheduled", async () => {
- const user = userEvent.setup();
- const emptyMaria: Expert = { ...hiredMaria, workflows: [] };
- server.use(getListExpertsMockHandler([emptyMaria]));
-
- render(<TeamPage />);
-
- await screen.findByRole("region", { name: "What runs" });
-
- await user.click(screen.getByRole("button", { name: "Workflows" }));
- expect(screen.getByText("No workflows installed yet.")).toBeDefined();
-
- await user.click(screen.getByRole("button", { name: "Scheduled" }));
- expect(screen.getByText("No scheduled workflows yet.")).toBeDefined();
- });
-
- test("tells an empty library apart from a fully adopted one", async () => {
- server.use(getListExpertsMockHandler([hiredMaria]));
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- expect(
- await within(agents).findByText("No workflows available to install."),
- ).toBeDefined();
- });
-
- test("loads additional non-hidden library pages on demand", async () => {
- const user = userEvent.setup();
- const secondAgent = makeLibraryAgent({
- id: "lib-second",
- graph_id: "graph-second",
- name: "Second-page Agent",
- });
- const requestedPages: string[] = [];
- const hiddenFilters: string[] = [];
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- getGetV2ListLibraryAgentsMockHandler200(({ request }) => {
- const params = new URL(request.url).searchParams;
- const page = params.get("page") ?? "1";
- requestedPages.push(page);
- hiddenFilters.push(params.get("is_hidden") ?? "missing");
- return page === "2"
- ? libraryResponse([secondAgent], 101, 2)
- : libraryResponse([adoptableAgent], 101, 1);
- }),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- expect(within(agents).getByText("Research Assistant")).toBeDefined();
- expect(within(agents).queryByText("Second-page Agent")).toBeNull();
- expect(requestedPages).toEqual(["1"]);
-
- await user.click(
- within(agents).getByRole("button", { name: "Load more workflows" }),
- );
-
- expect(await within(agents).findByText("Second-page Agent")).toBeDefined();
- expect(requestedPages).toEqual(["1", "2"]);
- expect(hiddenFilters).toEqual(["false", "false"]);
- });
-
- test("does not claim every agent is adopted while more pages remain", async () => {
- const installedAgent = makeLibraryAgent({
- id: "lib-1",
- graph_id: "graph-1",
- name: "Content Calendar",
- });
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- getGetV2ListLibraryAgentsMockHandler200(
- libraryResponse([installedAgent], 101, 1),
- ),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- expect(
- within(agents).queryByText("Every workflow is already on your team."),
- ).toBeNull();
- expect(
- within(agents).getByRole("button", { name: "Load more workflows" }),
- ).toBeDefined();
- });
-
- test("keeps page one visible and retries when loading page two fails", async () => {
- const user = userEvent.setup();
- let pageTwoFails = true;
- const secondAgent = makeLibraryAgent({
- id: "lib-second",
- graph_id: "graph-second",
- name: "Recovered Agent",
- });
- server.use(
- getListExpertsMockHandler([hiredMaria]),
- http.get("/api/proxy/api/library/agents", ({ request }) => {
- const page = new URL(request.url).searchParams.get("page") ?? "1";
- if (page === "2" && pageTwoFails) {
- return HttpResponse.json({ detail: "expired" }, { status: 401 });
- }
- return HttpResponse.json(
- page === "2"
- ? libraryResponse([secondAgent], 101, 2)
- : libraryResponse([adoptableAgent], 101, 1),
- );
- }),
- );
-
- render(<TeamPage />);
-
- const agents = await screen.findByRole("region", {
- name: "Your workflows",
- });
- expect(within(agents).getByText("Research Assistant")).toBeDefined();
- await user.click(
- within(agents).getByRole("button", { name: "Load more workflows" }),
- );
-
- expect(
- await within(agents).findByText("We could not load more workflows."),
- ).toBeDefined();
- expect(within(agents).getByText("Research Assistant")).toBeDefined();
-
- pageTwoFails = false;
- await user.click(
- within(agents).getByRole("button", { name: "Retry loading more" }),
- );
-
- expect(await within(agents).findByText("Recovered Agent")).toBeDefined();
- });
-
- test("shows last-run status as a chip beside the workflow count", async () => {
- server.use(getListExpertsMockHandler([scheduledMaria]));
-
- render(<TeamPage />);
-
- const group = await screen.findByRole("region", { name: "Maria runs" });
- expect(within(group).getByText("Maria · 2 workflows")).toBeDefined();
- expect(within(group).getByText(/Last run succeeded/)).toBeDefined();
- });
});
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
new file mode 100644
index 0000000000..2b4739b6d9
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/tabs.test.tsx
@@ -0,0 +1,279 @@
+import {
+ getListExpertCredentialsMockHandler,
+ getListExpertPodsMockHandler,
+ getListExpertsMockHandler,
+} from "@/app/api/__generated__/endpoints/experts/experts.msw";
+import { getGetV2ListLibraryAgentsMockHandler200 } from "@/app/api/__generated__/endpoints/library/library.msw";
+import { getGetV1ListExecutionSchedulesForAUserMockHandler } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { ExpertPod } from "@/app/api/__generated__/models/expertPod";
+import { server } from "@/mocks/mock-server";
+import { render, screen, within } from "@/tests/integrations/test-utils";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, test, vi } from "vitest";
+import TeamPage from "../page";
+
+vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {
+ const actual =
+ await importOriginal<
+ typeof import("@/services/feature-flags/use-get-flag")
+ >();
+ return {
+ ...actual,
+ useFlagStatus: (flag: string) =>
+ flag === "hire-experts"
+ ? { enabled: true, ready: true }
+ : actual.useFlagStatus(flag as never),
+ };
+});
+
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({
+ push: vi.fn(),
+ replace: vi.fn(),
+ prefetch: vi.fn(),
+ back: vi.fn(),
+ forward: vi.fn(),
+ refresh: vi.fn(),
+ }),
+ usePathname: () => "/team",
+ useSearchParams: () => new URLSearchParams(),
+ useParams: () => ({}),
+ notFound: vi.fn(),
+}));
+
+function makeExpert(over: Partial<Expert> = {}): Expert {
+ return {
+ id: "expert-maria",
+ name: "Maria",
+ avatar_url: null,
+ role: "Marketing Strategist",
+ bio: null,
+ skills: [],
+ tagline: "Grows your brand while you sleep",
+ identity: "You are Maria.",
+ voice_preferences: null,
+ boundaries: null,
+ protected_soul_rules: [],
+ is_template: false,
+ source_template_id: "template-maria",
+ is_archived: false,
+ workflows: [],
+ ...over,
+ } as Expert;
+}
+
+/** Reads the value of one of a card's stat columns by its label. */
+function getStatValue(card: HTMLElement, label: string) {
+ const column = within(card).getByText(label).closest("div");
+ return column?.querySelector("dd")?.textContent;
+}
+
+const maria = makeExpert();
+const lee = makeExpert({ id: "expert-lee", name: "Lee", role: "Researcher" });
+
+beforeEach(() => {
+ server.use(
+ getGetV1ListExecutionSchedulesForAUserMockHandler([]),
+ getListExpertPodsMockHandler([]),
+ getListExpertCredentialsMockHandler([]),
+ getGetV2ListLibraryAgentsMockHandler200(),
+ );
+});
+
+describe("TeamPage tabs", () => {
+ test("opens on Team Overview and offers Pod board", async () => {
+ server.use(getListExpertsMockHandler([maria]));
+
+ render(<TeamPage />);
+
+ const overview = await screen.findByRole("tab", { name: "Team Overview" });
+ expect(overview.getAttribute("aria-selected")).toBe("true");
+ expect(screen.getByRole("tab", { name: "Pod board" })).toBeDefined();
+ expect(screen.queryByRole("tab", { name: "All tasks" })).toBeNull();
+ });
+
+ test("Team Overview lists every expert without pod sections", async () => {
+ const growth: ExpertPod = {
+ id: "pod-growth",
+ name: "Growth",
+ created_at: new Date("2026-08-14T00:00:00Z"),
+ };
+ server.use(
+ getListExpertsMockHandler([makeExpert({ pod_id: "pod-growth" }), lee]),
+ getListExpertPodsMockHandler([growth]),
+ );
+
+ render(<TeamPage />);
+
+ expect(await screen.findByText("Maria")).toBeDefined();
+ expect(screen.getByText("Lee")).toBeDefined();
+ // Pod grouping belongs to the Pod board tab, not the overview grid.
+ expect(screen.queryByRole("heading", { name: "Growth" })).toBeNull();
+ });
+
+ test("Pod board tells you how to start when there are no pods and no experts", async () => {
+ const user = userEvent.setup();
+ server.use(getListExpertsMockHandler([]));
+
+ render(<TeamPage />);
+ await user.click(await screen.findByRole("tab", { name: "Pod board" }));
+
+ expect(await screen.findByText("No pods yet")).toBeDefined();
+ });
+
+ test("Pod board still shows ungrouped experts when there are no pods", async () => {
+ const user = userEvent.setup();
+ server.use(getListExpertsMockHandler([maria]));
+
+ render(<TeamPage />);
+ await user.click(await screen.findByRole("tab", { name: "Pod board" }));
+
+ expect(
+ await screen.findByRole("heading", { name: "Ungrouped" }),
+ ).toBeDefined();
+ expect(screen.getByText("Maria")).toBeDefined();
+ expect(screen.queryByText("No pods yet")).toBeNull();
+ });
+});
+
+describe("TeamRoster toolbar", () => {
+ test("search narrows the roster to matching experts", async () => {
+ const user = userEvent.setup();
+ server.use(getListExpertsMockHandler([maria, lee]));
+
+ render(<TeamPage />);
+ expect(await screen.findByText("Maria")).toBeDefined();
+
+ await user.type(
+ screen.getByRole("searchbox", { name: "Search experts" }),
+ "resear",
+ );
+
+ // Matches Lee on role, not name.
+ expect(screen.getByText("Lee")).toBeDefined();
+ expect(screen.queryByText("Maria")).toBeNull();
+ // Autopilot is pinned, but steps aside once the roster is narrowed.
+ expect(screen.queryByText("Autopilot")).toBeNull();
+ });
+
+ test("says so when nothing matches the search", async () => {
+ const user = userEvent.setup();
+ server.use(getListExpertsMockHandler([maria]));
+
+ render(<TeamPage />);
+ expect(await screen.findByText("Maria")).toBeDefined();
+
+ await user.type(
+ screen.getByRole("searchbox", { name: "Search experts" }),
+ "nobody",
+ );
+
+ expect(
+ screen.getByText("No experts match that search or filter."),
+ ).toBeDefined();
+ });
+
+ test("the paused filter keeps only experts with paused schedules", async () => {
+ const user = userEvent.setup();
+ const pausedLee = makeExpert({
+ id: "expert-lee",
+ name: "Lee",
+ schedules_paused_at: new Date("2026-08-20T10:00:00Z"),
+ });
+ server.use(getListExpertsMockHandler([maria, pausedLee]));
+
+ 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" }));
+
+ expect(screen.getByText("Lee")).toBeDefined();
+ expect(screen.queryByText("Maria")).toBeNull();
+ });
+});
+
+describe("AutopilotCard", () => {
+ test("counts the whole team's skills, schedules and workflows", async () => {
+ const scheduledMaria = makeExpert({
+ ...maria,
+ skills: ["Copywriting", "SEO"],
+ workflows: [
+ {
+ id: "wf-1",
+ store_listing_version_id: "slv-1",
+ library_agent_id: null,
+ graph_id: "graph-1",
+ name: "Content Calendar",
+ description: null,
+ schedule_cron: null,
+ schedule_id: null,
+ },
+ ],
+ });
+ // Lee shares Copywriting with Maria, so the team has three skills, not four.
+ const skilledLee = makeExpert({
+ ...lee,
+ skills: ["Copywriting", "Analytics"],
+ });
+ server.use(
+ getListExpertsMockHandler([scheduledMaria, skilledLee]),
+ getGetV1ListExecutionSchedulesForAUserMockHandler([
+ {
+ id: "sched-soon",
+ name: "Content Calendar",
+ user_id: "user-1",
+ graph_id: "graph-1",
+ graph_version: 1,
+ cron: "0 7 * * *",
+ input_data: {},
+ next_run_time: "2099-01-01T07:00:00Z",
+ expert_id: "expert-maria",
+ },
+ ]),
+ );
+
+ render(<TeamPage />);
+ expect(await screen.findByText("Lee")).toBeDefined();
+
+ const autopilot = screen.getByRole("region", { name: "Autopilot" });
+ expect(getStatValue(autopilot, "Skills")).toBe("3");
+ expect(getStatValue(autopilot, "Schedules")).toBe("1");
+ expect(getStatValue(autopilot, "Workflows")).toBe("1");
+ });
+
+ test("zeroes 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");
+ expect(within(autopilot).getByText("Built in")).toBeDefined();
+ expect(within(autopilot).queryByText("Budget")).toBeNull();
+ expect(
+ within(autopilot)
+ .getByRole("link", { name: "Chat" })
+ .getAttribute("href"),
+ ).toBe("/copilot");
+ expect(within(autopilot).queryByRole("link", { name: "Edit" })).toBeNull();
+ });
+
+ test("links its body to the Autopilot page", async () => {
+ server.use(getListExpertsMockHandler([maria]));
+
+ render(<TeamPage />);
+ expect(await screen.findByText("Maria")).toBeDefined();
+
+ const autopilot = screen.getByRole("region", { name: "Autopilot" });
+ expect(
+ within(autopilot)
+ .getByRole("link", { name: "View Autopilot" })
+ .getAttribute("href"),
+ ).toBe("/team/autopilot");
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/__tests__/main.test.tsx
new file mode 100644
index 0000000000..f58bba416d
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/__tests__/main.test.tsx
@@ -0,0 +1,302 @@
+import { getListExpertsMockHandler } from "@/app/api/__generated__/endpoints/experts/experts.msw";
+import { getGetV1ListExecutionSchedulesForAUserMockHandler } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
+import { server } from "@/mocks/mock-server";
+import { render, screen, within } from "@/tests/integrations/test-utils";
+import userEvent from "@testing-library/user-event";
+import { http, HttpResponse } from "msw";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+import AutopilotPage from "../page";
+
+const { setFlagStatusMock } = vi.hoisted(() => ({
+ setFlagStatusMock: vi.fn(() => ({ enabled: true, ready: true })),
+}));
+
+vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {
+ const actual =
+ await importOriginal<
+ typeof import("@/services/feature-flags/use-get-flag")
+ >();
+ return {
+ ...actual,
+ useFlagStatus: (flag: string) =>
+ flag === "hire-experts"
+ ? setFlagStatusMock()
+ : actual.useFlagStatus(flag as never),
+ };
+});
+
+const { notFoundMock } = vi.hoisted(() => ({ notFoundMock: vi.fn() }));
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({
+ push: vi.fn(),
+ replace: vi.fn(),
+ prefetch: vi.fn(),
+ back: vi.fn(),
+ forward: vi.fn(),
+ refresh: vi.fn(),
+ }),
+ usePathname: () => "/team/autopilot",
+ useSearchParams: () => new URLSearchParams(),
+ useParams: () => ({}),
+ notFound: () => {
+ notFoundMock();
+ throw new Error("NEXT_NOT_FOUND");
+ },
+}));
+
+function makeExpert(over: Partial<Expert> = {}): Expert {
+ return {
+ id: "expert-maria",
+ name: "Maria",
+ avatar_url: null,
+ role: "Marketing Strategist",
+ bio: null,
+ skills: [],
+ tagline: null,
+ identity: "You are Maria.",
+ voice_preferences: null,
+ boundaries: null,
+ protected_soul_rules: [],
+ is_template: false,
+ source_template_id: "template-maria",
+ is_archived: false,
+ workflows: [],
+ ...over,
+ } as Expert;
+}
+
+const maria = makeExpert({
+ skills: ["Copywriting", "SEO"],
+ workflows: [
+ {
+ id: "wf-1",
+ store_listing_version_id: "slv-1",
+ library_agent_id: "lib-1",
+ graph_id: "graph-1",
+ name: "Content Calendar",
+ description: "Plans a week of posts",
+ schedule_cron: "40 7 * * *",
+ schedule_id: "sched-1",
+ },
+ {
+ id: "wf-2",
+ store_listing_version_id: "slv-2",
+ library_agent_id: "lib-2",
+ graph_id: "graph-2",
+ name: "SEO Audit",
+ description: null,
+ schedule_cron: "0 9 * * 1",
+ schedule_id: null,
+ },
+ ],
+});
+
+const lee = makeExpert({
+ id: "expert-lee",
+ name: "Lee",
+ role: "Researcher",
+ skills: ["Copywriting", "Analytics"],
+});
+
+const firedSam = makeExpert({
+ id: "expert-sam",
+ name: "Sam",
+ role: "Fired",
+ is_archived: true,
+ skills: ["Ghostwriting"],
+});
+
+const mariaSchedule: GraphExecutionJobInfo = {
+ id: "sched-1",
+ name: "Content Calendar",
+ agent_name: "Content Calendar",
+ user_id: "user-1",
+ graph_id: "graph-1",
+ graph_version: 1,
+ cron: "40 7 * * *",
+ input_data: {},
+ next_run_time: new Date(Date.now() + 60 * 60 * 1000).toISOString(),
+ expert_id: "expert-maria",
+};
+
+/** A schedule nobody on the team owns, which Autopilot must not claim. */
+const straySchedule: GraphExecutionJobInfo = {
+ ...mariaSchedule,
+ id: "sched-stray",
+ name: "Nobody's Job",
+ agent_name: "Nobody's Job",
+ graph_id: "graph-stray",
+ expert_id: null,
+};
+
+/** Reads the value of one of the summary's stat columns by its label. */
+function getStatValue(container: HTMLElement, label: string) {
+ const column = within(container).getByText(label).closest("div");
+ return column?.querySelector("dd")?.textContent;
+}
+
+beforeEach(() => {
+ server.use(
+ getListExpertsMockHandler([maria, lee, firedSam]),
+ getGetV1ListExecutionSchedulesForAUserMockHandler([
+ mariaSchedule,
+ straySchedule,
+ ]),
+ );
+});
+
+afterEach(() => {
+ setFlagStatusMock.mockReturnValue({ enabled: true, ready: true });
+ notFoundMock.mockReset();
+});
+
+async function openTab(name: string) {
+ await userEvent.click(await screen.findByRole("tab", { name }));
+}
+
+describe("AutopilotPage", () => {
+ test("renders the Autopilot profile with a chat link and a way back", async () => {
+ render(<AutopilotPage />);
+
+ expect(
+ await screen.findByRole("heading", { name: "Autopilot" }),
+ ).toBeDefined();
+ expect(screen.getByText("Head of AI")).toBeDefined();
+ expect(screen.getByText("Built in")).toBeDefined();
+ expect(screen.getByText("Identity")).toBeDefined();
+ expect(screen.getByText("Works with")).toBeDefined();
+ expect(screen.getByText("Boundaries")).toBeDefined();
+ expect(
+ screen.getByRole("link", { name: "Chat" }).getAttribute("href"),
+ ).toBe("/copilot");
+ expect(
+ screen.getByRole("link", { name: "Back to Team" }).getAttribute("href"),
+ ).toBe("/team");
+ });
+
+ test("sums the hired team in the summary and links each expert", async () => {
+ render(<AutopilotPage />);
+
+ const summary = await screen.findByRole("complementary", {
+ name: "Team at a glance",
+ });
+ // Sam is fired, so the roster is two experts.
+ expect(getStatValue(summary, "Experts")).toBe("2");
+ // Only Maria's schedule belongs to the team; the stray one is ignored.
+ expect(getStatValue(summary, "Schedules")).toBe("1");
+ // Copywriting is shared, so three skills — and Sam's Ghostwriting is out.
+ expect(getStatValue(summary, "Skills")).toBe("3");
+ expect(getStatValue(summary, "Workflows")).toBe("2");
+
+ expect(
+ within(summary).getByRole("link", { name: /Maria/ }).getAttribute("href"),
+ ).toBe("/team/expert-maria");
+ expect(
+ within(summary).getByRole("link", { name: /Lee/ }).getAttribute("href"),
+ ).toBe("/team/expert-lee");
+ expect(within(summary).queryByText("Sam")).toBeNull();
+ });
+
+ test("lists the team's schedules", async () => {
+ render(<AutopilotPage />);
+ await screen.findByRole("heading", { name: "Autopilot" });
+
+ await openTab("Schedules");
+
+ const list = screen.getByRole("list", { name: "Expert schedules" });
+ expect(within(list).getAllByRole("listitem")).toHaveLength(1);
+ expect(within(list).getByText("Content Calendar")).toBeDefined();
+ expect(within(list).queryByText("Nobody's Job")).toBeNull();
+ });
+
+ test("groups workflows by the expert who owns them", async () => {
+ render(<AutopilotPage />);
+ await screen.findByRole("heading", { name: "Autopilot" });
+
+ await openTab("Workflows");
+
+ const group = screen.getByRole("region", { name: "Maria workflows" });
+ expect(
+ within(group).getByRole("link", { name: /Maria/ }).getAttribute("href"),
+ ).toBe("/team/expert-maria");
+ const rows = within(group).getAllByTestId("autopilot-workflow-row");
+ expect(rows).toHaveLength(2);
+ expect(within(rows[0]).getByText("Content Calendar")).toBeDefined();
+ expect(within(rows[0]).getByText(/Every day at 07:40/)).toBeDefined();
+ expect(within(rows[1]).getByText("SEO Audit")).toBeDefined();
+ expect(within(rows[1]).getByText("Needs setup")).toBeDefined();
+ // Lee has no workflows, so gets no group.
+ expect(screen.queryByRole("region", { name: "Lee workflows" })).toBeNull();
+ });
+
+ test("shows the team's skills de-duplicated and sorted", async () => {
+ render(<AutopilotPage />);
+ await screen.findByRole("heading", { name: "Autopilot" });
+
+ await openTab("Skills");
+
+ const panel = screen.getByRole("tabpanel");
+ const skills = within(panel)
+ .getAllByText(/^(Analytics|Copywriting|SEO|Ghostwriting)$/)
+ .map((node) => node.textContent);
+ expect(skills).toEqual(["Analytics", "Copywriting", "SEO"]);
+ });
+
+ test("tells you when the team has nothing set up yet", async () => {
+ server.use(
+ getListExpertsMockHandler([]),
+ getGetV1ListExecutionSchedulesForAUserMockHandler([]),
+ );
+
+ render(<AutopilotPage />);
+
+ const summary = await screen.findByRole("complementary", {
+ name: "Team at a glance",
+ });
+ expect(getStatValue(summary, "Experts")).toBe("0");
+ expect(within(summary).getByText(/No experts hired yet/)).toBeDefined();
+
+ await openTab("Workflows");
+ expect(screen.getByText(/No workflows yet/)).toBeDefined();
+
+ await openTab("Skills");
+ expect(screen.getByText(/No skills listed yet/)).toBeDefined();
+
+ await openTab("Schedules");
+ expect(screen.getByText(/No schedules yet/)).toBeDefined();
+ });
+
+ test("offers a retry when the team fails to load", async () => {
+ const user = userEvent.setup();
+ let failures = 0;
+ server.use(
+ http.get("/api/proxy/api/experts", () => {
+ failures += 1;
+ return failures === 1
+ ? HttpResponse.json({ detail: "boom" }, { status: 500 })
+ : HttpResponse.json([maria]);
+ }),
+ );
+
+ render(<AutopilotPage />);
+
+ expect(
+ await screen.findByText("We could not load your team."),
+ ).toBeDefined();
+ await user.click(screen.getByRole("button", { name: /try again/i }));
+
+ expect(
+ await screen.findByRole("heading", { name: "Autopilot" }),
+ ).toBeDefined();
+ expect(failures).toBe(2);
+ });
+
+ test("404s when experts are switched off", () => {
+ setFlagStatusMock.mockReturnValue({ enabled: false, ready: true });
+
+ expect(() => render(<AutopilotPage />)).toThrow("NEXT_NOT_FOUND");
+ expect(notFoundMock).toHaveBeenCalled();
+ });
+});
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
new file mode 100644
index 0000000000..70bcd74aea
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotAboutSection.tsx
@@ -0,0 +1,40 @@
+import { AUTOPILOT_BLURB } from "../../helpers";
+
+const ENTRIES = [
+ {
+ label: "Identity",
+ value:
+ "Autopilot is the generalist at the head of your team. It talks with you directly, answers questions, and runs your workflows on request.",
+ },
+ {
+ label: "Works with",
+ value:
+ "Every expert you hire. Autopilot knows what each one can do and hands work to the right expert, then reports back to you.",
+ },
+ {
+ label: "Boundaries",
+ value:
+ "Autopilot asks before taking external actions on your behalf and never edits an expert's Soul for you.",
+ },
+] as const;
+
+export function AutopilotAboutSection() {
+ return (
+ <section className="space-y-5">
+ <p className="text-base leading-relaxed text-zinc-600">
+ {AUTOPILOT_BLURB}
+ </p>
+
+ <dl className="space-y-5">
+ {ENTRIES.map((entry) => (
+ <div key={entry.label}>
+ <dt className="text-sm font-medium text-zinc-900">{entry.label}</dt>
+ <dd className="mt-1 text-base leading-relaxed text-zinc-600">
+ {entry.value}
+ </dd>
+ </div>
+ ))}
+ </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
new file mode 100644
index 0000000000..908bb6bd47
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotHeader.tsx
@@ -0,0 +1,48 @@
+import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { SparklesIcon } from "@hugeicons/core-free-icons";
+import { ExpertCover } from "../../components/ExpertTeamCard/components/ExpertCover";
+import { AUTOPILOT_ROLE, ACTION_BUTTON_CLASS } from "../../helpers";
+
+export function AutopilotHeader() {
+ return (
+ <header>
+ <ExpertCover
+ className="h-36"
+ color={undefined}
+ src="/experts/covers/autopilot.jpg"
+ status="built-in"
+ />
+
+ <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">
+ <AutoGPTLogo hideText viewBox="47 -1 42 42" className="size-12" />
+ </span>
+ <div className="min-w-0 flex-1">
+ <div className="flex flex-wrap items-center gap-3">
+ <h1 className="text-2xl font-semibold tracking-[-0.02em] text-zinc-900">
+ Autopilot
+ </h1>
+ <span className="inline-flex items-center gap-1.5 rounded-md border border-zinc-200 bg-zinc-50 px-2.5 py-0.5 text-sm font-medium text-zinc-700">
+ <Icon icon={SparklesIcon} size={14} />
+ {AUTOPILOT_ROLE}
+ </span>
+ </div>
+ <p className="mt-1 text-sm text-zinc-500">
+ Built in, always on your team.
+ </p>
+ </div>
+ <Button
+ as="NextLink"
+ href="/copilot"
+ variant="primary"
+ size="small"
+ className={`${ACTION_BUTTON_CLASS} shrink-0`}
+ >
+ Chat
+ </Button>
+ </div>
+ </header>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotSummaryCard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotSummaryCard.tsx
new file mode 100644
index 0000000000..f815d869ca
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotSummaryCard.tsx
@@ -0,0 +1,64 @@
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { Text } from "@/components/atoms/Text/Text";
+import Link from "next/link";
+import { CardStat, CardStats } from "../../components/CardStats";
+
+interface Props {
+ experts: Expert[];
+ scheduleCount: number;
+ skillCount: number;
+ workflowCount: number;
+}
+
+export function AutopilotSummaryCard({
+ experts,
+ scheduleCount,
+ skillCount,
+ workflowCount,
+}: Props) {
+ return (
+ <aside
+ aria-label="Team at a glance"
+ className="flex flex-col gap-4 self-start rounded-xl border border-zinc-200 bg-white p-4"
+ >
+ <Text variant="large-medium" className="text-base text-zinc-700">
+ Team at a glance
+ </Text>
+ <CardStats>
+ <CardStat label="Experts">{experts.length}</CardStat>
+ <CardStat label="Schedules">{scheduleCount}</CardStat>
+ <CardStat label="Skills">{skillCount}</CardStat>
+ <CardStat label="Workflows">{workflowCount}</CardStat>
+ </CardStats>
+
+ <section
+ aria-label="Experts Autopilot works with"
+ className="flex flex-col gap-2 border-t border-zinc-100 pt-4"
+ >
+ {experts.length === 0 ? (
+ <Text variant="small" className="text-zinc-500">
+ No experts hired yet. Autopilot works alone until you hire one.
+ </Text>
+ ) : (
+ <ul className="flex flex-col gap-1">
+ {experts.map((expert) => (
+ <li key={expert.id}>
+ <Link
+ href={`/team/${expert.id}`}
+ className="flex items-baseline justify-between gap-2 rounded-md px-2 py-1.5 hover:bg-zinc-50"
+ >
+ <span className="truncate text-sm font-medium text-zinc-800">
+ {expert.name}
+ </span>
+ <span className="truncate text-xs text-zinc-500">
+ {expert.role}
+ </span>
+ </Link>
+ </li>
+ ))}
+ </ul>
+ )}
+ </section>
+ </aside>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotWorkflowsSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotWorkflowsSection.tsx
new file mode 100644
index 0000000000..41712b1c90
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/AutopilotWorkflowsSection.tsx
@@ -0,0 +1,74 @@
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { Badge } from "@/components/atoms/Badge/Badge";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { safeHumanizeCronExpression } from "@/lib/cron-expression-utils";
+import { FlashIcon } from "@hugeicons/core-free-icons";
+import Link from "next/link";
+import { workflowNeedsSetup } from "../../helpers";
+
+interface Props {
+ experts: Expert[];
+}
+
+export function AutopilotWorkflowsSection({ experts }: Props) {
+ const owners = experts.filter((expert) => expert.workflows.length > 0);
+
+ if (owners.length === 0) {
+ return (
+ <p className="text-sm text-zinc-500">
+ No workflows yet. Install one on an expert to give Autopilot something
+ to run.
+ </p>
+ );
+ }
+
+ return (
+ <div className="space-y-5">
+ {owners.map((expert) => (
+ <section key={expert.id} aria-label={`${expert.name} workflows`}>
+ <Link
+ href={`/team/${expert.id}`}
+ className="mb-2 inline-flex items-baseline gap-2 text-sm hover:underline"
+ >
+ <span className="font-medium text-zinc-900">{expert.name}</span>
+ <span className="text-zinc-500">{expert.role}</span>
+ </Link>
+ <div className="divide-y divide-zinc-100 rounded-lg border border-zinc-200/80 bg-white">
+ {expert.workflows.map((workflow) => (
+ <div
+ key={workflow.id}
+ className="flex items-center gap-3 px-4 py-3"
+ data-testid="autopilot-workflow-row"
+ >
+ <Icon
+ icon={FlashIcon}
+ size={18}
+ className="shrink-0 text-zinc-500"
+ />
+ <div className="min-w-0 flex-1">
+ <div className="text-[15px] font-medium text-zinc-800">
+ {workflow.name ?? "Unnamed workflow"}
+ </div>
+ {workflow.description ? (
+ <div className="line-clamp-1 text-xs text-zinc-500">
+ {workflow.description}
+ </div>
+ ) : null}
+ </div>
+ {workflowNeedsSetup(workflow) ? (
+ <Badge variant="warning" size="small" className="shrink-0">
+ Needs setup
+ </Badge>
+ ) : workflow.schedule_cron ? (
+ <Badge variant="info" size="small" className="shrink-0">
+ {safeHumanizeCronExpression(workflow.schedule_cron)}
+ </Badge>
+ ) : null}
+ </div>
+ ))}
+ </div>
+ </section>
+ ))}
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/TeamSkillsSection.tsx b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/TeamSkillsSection.tsx
new file mode 100644
index 0000000000..ff0a0d332a
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/components/TeamSkillsSection.tsx
@@ -0,0 +1,30 @@
+"use client";
+
+interface Props {
+ expertName: string;
+ skills: string[];
+}
+
+export function TeamSkillsSection({ expertName, skills }: Props) {
+ if (skills.length === 0) {
+ return (
+ <p className="text-sm text-zinc-500">
+ No skills listed yet. {expertName} picks these up from the workflows you
+ install.
+ </p>
+ );
+ }
+
+ return (
+ <div className="flex flex-wrap gap-2">
+ {skills.map((skill) => (
+ <span
+ key={skill}
+ className="rounded-full bg-zinc-50 px-3 py-1.5 text-sm text-zinc-600 ring-1 ring-inset ring-zinc-200/80"
+ >
+ {skill}
+ </span>
+ ))}
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/page.tsx b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/page.tsx
new file mode 100644
index 0000000000..0cec8d170c
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/page.tsx
@@ -0,0 +1,130 @@
+"use client";
+
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
+import {
+ TabsLine,
+ TabsLineContent,
+ TabsLineList,
+ TabsLineTrigger,
+} from "@/components/molecules/TabsLine/TabsLine";
+import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";
+import {
+ Calendar03Icon,
+ SparklesIcon,
+ UserIcon,
+ WorkflowSquare01Icon,
+} from "@hugeicons/core-free-icons";
+import { notFound } from "next/navigation";
+import { ExpertSchedulesSection } from "../[expertId]/components/ExpertSchedulesSection";
+import { TeamSkillsSection } from "./components/TeamSkillsSection";
+import { BackToTeamLink } from "../components/BackToTeamLink";
+import { AutopilotAboutSection } from "./components/AutopilotAboutSection";
+import { AutopilotHeader } from "./components/AutopilotHeader";
+import { AutopilotSummaryCard } from "./components/AutopilotSummaryCard";
+import { AutopilotWorkflowsSection } from "./components/AutopilotWorkflowsSection";
+import { useAutopilotPage } from "./useAutopilotPage";
+
+const MAIN_CLASS =
+ "container min-h-screen max-w-[1180px] space-y-5 pb-16 pt-6 sm:px-8 md:px-12";
+
+const TABS = [
+ { value: "basics", label: "Basics", icon: UserIcon },
+ { value: "schedules", label: "Schedules", icon: Calendar03Icon },
+ { value: "workflows", label: "Workflows", icon: WorkflowSquare01Icon },
+ { value: "skills", label: "Skills", icon: SparklesIcon },
+] as const;
+
+export default function AutopilotPage() {
+ const { enabled, ready } = useFlagStatus(Flag.HIRE_EXPERTS);
+ const { experts, schedules, skills, isLoading, isError, refetch } =
+ useAutopilotPage({ enabled: Boolean(enabled) && ready });
+
+ if (!ready || isLoading) {
+ return (
+ <main className={MAIN_CLASS}>
+ <Skeleton className="h-20 w-full rounded-xl" />
+ <Skeleton className="h-10 w-full rounded-xl" />
+ <Skeleton className="h-48 w-full rounded-xl" />
+ </main>
+ );
+ }
+
+ if (!enabled) {
+ notFound();
+ }
+
+ if (isError) {
+ return (
+ <main className={MAIN_CLASS}>
+ <BackToTeamLink />
+ <ErrorCard
+ context="Autopilot"
+ hint="We could not load your team."
+ onRetry={() => refetch()}
+ />
+ </main>
+ );
+ }
+
+ const workflowCount = experts.reduce(
+ (total, expert) => total + expert.workflows.length,
+ 0,
+ );
+
+ return (
+ <main className={MAIN_CLASS}>
+ <BackToTeamLink />
+ <AutopilotHeader />
+
+ <TabsLine defaultValue="basics">
+ <TabsLineList
+ flush
+ className="overflow-x-auto"
+ indicatorClassName="bg-zinc-900"
+ >
+ {TABS.map((tab) => (
+ <TabsLineTrigger
+ key={tab.value}
+ value={tab.value}
+ className="gap-1.5 px-2.5 py-2 text-xs leading-5 data-[state=active]:text-zinc-900"
+ >
+ <Icon icon={tab.icon} size={14} />
+ {tab.label}
+ </TabsLineTrigger>
+ ))}
+ </TabsLineList>
+
+ <TabsLineContent value="basics">
+ <div className="grid gap-4 lg:grid-cols-[3fr_1fr]">
+ <AutopilotAboutSection />
+ <AutopilotSummaryCard
+ experts={experts}
+ scheduleCount={schedules.length}
+ skillCount={skills.length}
+ workflowCount={workflowCount}
+ />
+ </div>
+ </TabsLineContent>
+
+ <TabsLineContent value="schedules">
+ <ExpertSchedulesSection
+ title="Team schedules"
+ expertName="your team"
+ schedules={schedules}
+ lastRunLabel={null}
+ />
+ </TabsLineContent>
+
+ <TabsLineContent value="workflows">
+ <AutopilotWorkflowsSection experts={experts} />
+ </TabsLineContent>
+
+ <TabsLineContent value="skills">
+ <TeamSkillsSection expertName="Autopilot" skills={skills} />
+ </TabsLineContent>
+ </TabsLine>
+ </main>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/autopilot/useAutopilotPage.ts b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/useAutopilotPage.ts
new file mode 100644
index 0000000000..d80a0ed869
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/autopilot/useAutopilotPage.ts
@@ -0,0 +1,35 @@
+import { useListExperts } from "@/app/api/__generated__/endpoints/experts/experts";
+import { useGetV1ListExecutionSchedulesForAUser } from "@/app/api/__generated__/endpoints/schedules/schedules";
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { okData } from "@/app/api/helpers";
+import { getHiredExperts, getTeamSchedules, getTeamSkills } from "../helpers";
+
+interface Args {
+ enabled: boolean;
+}
+
+export function useAutopilotPage({ enabled }: Args) {
+ const expertsQuery = useListExperts({
+ query: { select: (res) => (okData(res) ?? []) as Expert[], enabled },
+ });
+ const schedulesQuery = useGetV1ListExecutionSchedulesForAUser({
+ query: { select: (res) => okData(res) ?? [], enabled },
+ });
+
+ const experts = getHiredExperts(expertsQuery.data ?? []);
+ const schedules = getTeamSchedules(experts, schedulesQuery.data ?? []);
+ const skills = getTeamSkills(experts);
+
+ function refetch() {
+ return Promise.all([expertsQuery.refetch(), schedulesQuery.refetch()]);
+ }
+
+ return {
+ experts,
+ schedules,
+ skills,
+ isLoading: enabled && (expertsQuery.isLoading || schedulesQuery.isLoading),
+ isError: expertsQuery.isError || schedulesQuery.isError,
+ refetch,
+ };
+}
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 145ed26178..4011082a64 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/AutopilotCard.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/AutopilotCard.tsx
@@ -1,34 +1,83 @@
-import { Avatar, AvatarFallback } from "@/components/atoms/Avatar/Avatar";
+import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";
import { Button } from "@/components/atoms/Button/Button";
-import { Text } from "@/components/atoms/Text/Text";
-import { Robot01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@/components/atoms/Icon/Icon";
+import { Text } from "@/components/atoms/Text/Text";
+import { PencilEdit02Icon } from "@hugeicons/core-free-icons";
+import Link from "next/link";
+import {
+ AUTOPILOT_BLURB,
+ AUTOPILOT_ROLE,
+ ACTION_BUTTON_CLASS,
+} from "../helpers";
+import { CardStat, CardStats } from "./CardStats";
+import { ExpertCover } from "./ExpertTeamCard/components/ExpertCover";
+
+interface Props {
+ skillCount: number;
+ scheduleCount: number;
+ workflowCount: number;
+}
-export function AutopilotCard() {
+export function AutopilotCard({
+ skillCount,
+ scheduleCount,
+ workflowCount,
+}: Props) {
return (
- <div className="flex flex-col gap-3 rounded-[1.75rem] border border-zinc-200 bg-white p-5">
- <div className="flex items-center gap-3">
- <Avatar className="h-12 w-12">
- <AvatarFallback>
- <Icon icon={Robot01Icon} size={24} />
- </AvatarFallback>
- </Avatar>
- <div className="min-w-0 flex-1">
- <Text variant="large-medium">Autopilot</Text>
- <Text variant="small" className="text-zinc-500">
- Generalist — runs the shop
+ <section
+ aria-label="Autopilot"
+ className="flex flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white"
+ >
+ <Link
+ href="/team/autopilot"
+ aria-label="View Autopilot"
+ className="flex flex-1 flex-col items-start p-2 pb-4"
+ >
+ <ExpertCover
+ color={undefined}
+ src="/experts/covers/autopilot.jpg"
+ status="built-in"
+ />
+
+ <div className="flex w-full items-start gap-3 px-2">
+ <span className="relative z-10 -mt-11 ml-1 flex size-[5.25rem] shrink-0 items-center justify-center rounded-full bg-white ring-4 ring-white">
+ <AutoGPTLogo hideText viewBox="47 -1 42 42" className="size-11" />
+ </span>
+ </div>
+
+ <div className="mt-2 flex w-full flex-col items-start gap-1 px-2 pl-5 text-left">
+ <Text variant="h4" className="w-full truncate pb-1">
+ Autopilot
+ </Text>
+ <Text variant="body" className="text-zinc-500">
+ {AUTOPILOT_ROLE}
+ </Text>
+ <Text variant="body" className="mt-1 line-clamp-3 text-zinc-500">
+ {AUTOPILOT_BLURB}
</Text>
</div>
- </div>
- <Text variant="body">
- Your built-in generalist. It runs your workflows, answers questions, and
- hands work to your hired experts.
- </Text>
- <div className="mt-auto flex gap-2">
- <Button as="NextLink" href="/copilot" variant="secondary" size="small">
+
+ <div className="w-full px-2">
+ <CardStats className="mt-3 w-full">
+ <CardStat label="Schedules">{scheduleCount}</CardStat>
+ <CardStat label="Skills">{skillCount}</CardStat>
+ <CardStat label="Workflows">{workflowCount}</CardStat>
+ </CardStats>
+ </div>
+ </Link>
+
+ <div className="flex items-center gap-2 px-4 pb-4">
+ <Button
+ as="NextLink"
+ href="/copilot"
+ variant="secondary"
+ size="small"
+ className={`${ACTION_BUTTON_CLASS} flex-1`}
+ leftIcon={<Icon icon={PencilEdit02Icon} size={14} />}
+ >
Chat
</Button>
</div>
- </div>
+ </section>
);
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/BackToTeamLink.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/BackToTeamLink.tsx
new file mode 100644
index 0000000000..81f779d8a1
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/BackToTeamLink.tsx
@@ -0,0 +1,16 @@
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { ArrowLeft02Icon } from "@hugeicons/core-free-icons";
+import Link from "next/link";
+
+export function BackToTeamLink() {
+ return (
+ <Link
+ href="/team"
+ className="inline-flex items-center gap-1 text-sm text-zinc-500 hover:text-zinc-800"
+ data-testid="expert-back-to-team"
+ >
+ <Icon icon={ArrowLeft02Icon} size={14} />
+ Back to Team
+ </Link>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/CardStats.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/CardStats.tsx
new file mode 100644
index 0000000000..534726c1a2
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/CardStats.tsx
@@ -0,0 +1,48 @@
+import { Text } from "@/components/atoms/Text/Text";
+import { cn } from "@/lib/utils";
+import { ReactNode } from "react";
+
+interface Props {
+ className?: string;
+ children: ReactNode;
+}
+
+/** A card's totals as one tinted pill, each stat a value over its label. */
+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,
+ )}
+ >
+ {children}
+ </dl>
+ );
+}
+
+interface StatProps {
+ label: string;
+ children: ReactNode;
+}
+
+export function CardStat({ label, children }: StatProps) {
+ return (
+ <div className="flex min-w-0 flex-1 flex-col items-center gap-0.5 text-center">
+ <dt className="order-2 w-full">
+ <Text variant="small" className="truncate text-zinc-500">
+ {label}
+ </Text>
+ </dt>
+ <dd className="order-1">
+ <Text
+ variant="large-semibold"
+ unmask={false}
+ className="tabular-nums text-zinc-900"
+ >
+ {children}
+ </Text>
+ </dd>
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/CreateMenu/CreateMenu.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/CreateMenu/CreateMenu.tsx
deleted file mode 100644
index cd3f505009..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/CreateMenu/CreateMenu.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-"use client";
-
-import { Button } from "@/components/atoms/Button/Button";
-import { Icon } from "@/components/atoms/Icon/Icon";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from "@/components/molecules/DropdownMenu/DropdownMenu";
-import { MARKETPLACE_EXPERTS_HREF } from "@/lib/constants";
-import {
- FlowIcon,
- PlusSignIcon,
- SparklesIcon,
- UserAdd01Icon,
- UserGroupIcon,
-} from "@hugeicons/core-free-icons";
-import Link from "next/link";
-
-interface Props {
- onNewPod: () => void;
-}
-
-export function CreateMenu({ onNewPod }: Props) {
- return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- size="small"
- leftIcon={<Icon icon={PlusSignIcon} className="size-4" />}
- >
- Create
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-60">
- <DropdownMenuItem asChild>
- <Link href={MARKETPLACE_EXPERTS_HREF}>
- <Icon icon={UserAdd01Icon} className="mr-2 size-4" />
- Hire an expert
- </Link>
- </DropdownMenuItem>
- <DropdownMenuItem asChild>
- <Link href="/raise">
- <Icon icon={SparklesIcon} className="mr-2 size-4" />
- Raise your own expert
- </Link>
- </DropdownMenuItem>
- <DropdownMenuItem asChild>
- <Link href="/build">
- <Icon icon={FlowIcon} className="mr-2 size-4" />
- Build an agent from scratch
- </Link>
- </DropdownMenuItem>
- <DropdownMenuItem onSelect={onNewPod}>
- <Icon icon={UserGroupIcon} className="mr-2 size-4" />
- New pod
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- );
-}
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 26bcefa782..3274c4963b 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/EmptyTeamState.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/EmptyTeamState.tsx
@@ -2,10 +2,11 @@ import { Button } from "@/components/atoms/Button/Button";
import { Text } from "@/components/atoms/Text/Text";
import { UserGroupIcon } from "@hugeicons/core-free-icons";
import { Icon } from "@/components/atoms/Icon/Icon";
+import { ACTION_BUTTON_CLASS } from "@/app/(platform)/team/helpers";
export function EmptyTeamState() {
return (
- <div className="flex flex-col items-center gap-3 rounded-[1.75rem] border border-dashed border-zinc-300 bg-white p-10 text-center">
+ <div className="flex flex-col items-center gap-3 rounded-xl border border-dashed border-zinc-300 bg-white p-8 text-center">
<Icon icon={UserGroupIcon} size={32} className="text-zinc-400" />
<Text variant="large-medium">No hired experts yet</Text>
<Text variant="body" className="max-w-prose text-zinc-600">
@@ -18,10 +19,17 @@ export function EmptyTeamState() {
href="/marketplace"
variant="primary"
size="small"
+ className={ACTION_BUTTON_CLASS}
>
Browse the marketplace
</Button>
- <Button as="NextLink" href="/raise" variant="secondary" size="small">
+ <Button
+ as="NextLink"
+ href="/raise"
+ variant="secondary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ >
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 547566a0b4..7064cd2fda 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
@@ -24,21 +24,30 @@ import {
UserGroupIcon,
} from "@hugeicons/core-free-icons";
import { creditsToUsdLabel } from "@/lib/credits";
-import Image from "next/image";
import Link from "next/link";
import { MouseEvent } from "react";
+import { ExpertCover } from "./components/ExpertCover";
import { SpendMeter } from "./components/SpendMeter";
import {
+ getExpertBlurb,
+ getExpertRosterStatus,
getNeedsSetupCount,
- getScheduleCountLabel,
getWeeklySpend,
+ ACTION_BUTTON_CLASS,
} from "../../helpers";
+import { ChatCircle } from "@phosphor-icons/react";
+import { CardStat, CardStats } from "../CardStats";
import { FireExpertDialog } from "../FireExpertDialog/FireExpertDialog";
import { FireExpertMenu } from "../FireExpertMenu/FireExpertMenu";
import { useExpertTeamCard } from "./useExpertTeamCard";
-const TEAM_CARD_BANNER_SRC = "/images/team-card-banner.jpg";
+const COVER_ACTION_CLASS =
+ "size-8 rounded-lg bg-white/90 p-0 text-zinc-700 backdrop-blur hover:bg-white hover:text-zinc-900";
+
+/** The card's corners are heavily rounded, so its actions are too. */
+const FOOTER_BUTTON_CLASS = `${ACTION_BUTTON_CLASS} flex-1`;
+const FOOTER_OUTLINE_BUTTON_CLASS = `${FOOTER_BUTTON_CLASS} !border-zinc-200 hover:!border-zinc-300`;
interface Props {
expert: Expert;
@@ -59,9 +68,9 @@ export function ExpertTeamCard({
onEditSoul,
onAssignPod,
}: Props) {
- const workflowCount = expert.workflows.length;
+ const blurb = getExpertBlurb(expert);
const needsSetupCount = getNeedsSetupCount(expert, schedules);
- const scheduleLabel = getScheduleCountLabel(schedules);
+ const rosterStatus = getExpertRosterStatus(expert, needsSetupCount);
const weeklySpend = getWeeklySpend(expert);
const { handleResume, isResuming, isFireOpen, openFire, closeFire } =
useExpertTeamCard(expert.id);
@@ -77,78 +86,104 @@ export function ExpertTeamCard({
}
return (
- <div className="flex flex-col rounded-[1.75rem] border border-zinc-200 bg-white p-1 transition-all duration-200 hover:-translate-y-0.5 hover:border-zinc-300 hover:shadow-[0_16px_40px_-16px_rgba(16,24,40,0.18)]">
- <div className="relative h-24 w-full overflow-hidden rounded-t-[1.5rem]">
- <Image
- src={TEAM_CARD_BANNER_SRC}
- alt=""
- fill
- sizes="(min-width: 1024px) 33vw, (min-width: 768px) 50vw, 100vw"
- className="object-cover"
- />
- {/* Fades the banner into the card background along its bottom edge, so
- the avatar straddling the seam has no hard line to cross. */}
- <div
- aria-hidden
- className="pointer-events-none absolute inset-0 shadow-[inset_0_-4rem_3rem_-1.5rem_hsl(var(--card))]"
+ <div className="relative flex flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white">
+ {/* 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">
+ {pods.length > 0 ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="icon"
+ size="small"
+ className={COVER_ACTION_CLASS}
+ aria-label={
+ currentPod
+ ? `Move to pod (currently ${currentPod.name})`
+ : "Move to pod"
+ }
+ >
+ <Icon icon={UserGroupIcon} size={16} />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ align="end"
+ className="max-h-72 w-52 overflow-y-auto"
+ >
+ {pods.map((pod) => (
+ <DropdownMenuItem
+ key={pod.id}
+ onSelect={() => onAssignPod(expert.id, pod.id)}
+ >
+ <span className="flex-1 truncate">{pod.name}</span>
+ {expert.pod_id === pod.id ? (
+ <Icon icon={Tick02Icon} size={16} className="ml-2" />
+ ) : null}
+ </DropdownMenuItem>
+ ))}
+ {expert.pod_id ? (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ onSelect={() => onAssignPod(expert.id, null)}
+ >
+ Remove from pod
+ </DropdownMenuItem>
+ </>
+ ) : null}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : null}
+ <Button
+ variant="icon"
+ size="small"
+ aria-label="Edit Soul"
+ className={COVER_ACTION_CLASS}
+ onClick={handleEditSoulClick}
+ >
+ <Icon icon={PencilEdit02Icon} size={16} />
+ </Button>
+ <FireExpertMenu
+ expertName={expert.name}
+ onFire={openFire}
+ testId="expert-card-actions"
+ triggerClassName={COVER_ACTION_CLASS}
/>
- <div className="absolute right-3 top-3 z-10 flex items-center gap-1">
- <Button
- variant="icon"
- size="small"
- aria-label="Edit Soul"
- className="bg-white p-2 hover:bg-zinc-100"
- onClick={handleEditSoulClick}
- >
- <Icon icon={PencilEdit02Icon} size={16} />
- </Button>
- <FireExpertMenu
- expertName={expert.name}
- onFire={openFire}
- testId="expert-card-actions"
- triggerClassName="bg-white text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900"
- />
- </div>
</div>
- <div className="flex flex-1 flex-col gap-3 p-4 pt-0">
- <Link
- href={`/team/${expert.id}`}
- aria-label={`View ${expert.name}`}
- className="flex flex-col gap-3"
- >
- <div className="flex items-center gap-3">
- {/* Half the avatar sits over the banner, half below it. */}
- <Avatar className="-mt-9 h-[4.5rem] w-[4.5rem] self-start ring-4 ring-white">
+
+ <Link
+ href={`/team/${expert.id}`}
+ aria-label={`View ${expert.name}`}
+ className="flex flex-1 flex-col items-center p-2 pb-4"
+ >
+ <ExpertCover color={expert.color} status={rosterStatus} />
+
+ <div className="flex w-full items-start gap-3 px-2">
+ <span className="-mt-11 ml-1 block shrink-0">
+ <Avatar className="size-[5.25rem] rounded-full ring-4 ring-white">
{expert.avatar_url ? (
<AvatarImage
src={expert.avatar_url}
alt={expert.name}
- width={72}
- height={72}
+ width={84}
+ height={84}
className="bg-white"
/>
) : null}
- <AvatarFallback>{expert.name}</AvatarFallback>
+ <AvatarFallback className="grain-overlay">
+ {expert.name}
+ </AvatarFallback>
</Avatar>
- <div className="min-w-0 flex-1">
- <Text variant="large-medium">{expert.name}</Text>
- <Text variant="small" className="text-zinc-500">
- {expert.role}
- </Text>
- </div>
- </div>
- <Text variant="body" className="line-clamp-2 min-h-12 text-zinc-600">
- {expert.tagline || expert.identity}
- </Text>
- <div className="flex flex-col gap-1">
+ </span>
+
+ <div className="mt-2 flex min-w-0 flex-1 flex-col gap-1">
<div className="flex items-baseline justify-between gap-2">
- <Text variant="small" className="text-zinc-500">
- Spend this week
+ <Text variant="small-medium" className="text-zinc-700">
+ Budget
</Text>
<Text
- variant="small"
+ variant="small-medium"
unmask={false}
- className="tabular-nums text-zinc-500"
+ className="tabular-nums text-zinc-700"
>
{weeklySpend
? `${creditsToUsdLabel(weeklySpend.spent)} / ${creditsToUsdLabel(weeklySpend.budget)}`
@@ -158,102 +193,82 @@ export function ExpertTeamCard({
<SpendMeter
spent={weeklySpend?.spent ?? 0}
budget={weeklySpend?.budget ?? 1}
+ color={expert.color}
muted={!weeklySpend}
/>
</div>
- <Text variant="small" className="min-h-5 text-zinc-500">
- {scheduleLabel ?? "No schedules yet"}
+ </div>
+
+ <div className="mt-2 flex w-full flex-col items-start gap-1 px-2 pl-5 text-left">
+ {/* `truncate` clips at the padding box, so descenders in a name like
+ "Fiona Gray" need a little room below the line box. */}
+ <Text variant="h4" className="w-full truncate pb-1">
+ {expert.name}
+ </Text>
+ <Text variant="body" className="line-clamp-2 text-zinc-500">
+ {expert.role}
+ </Text>
+ <Text variant="body" className="mt-1 line-clamp-2 text-zinc-500">
+ {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">
+ <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>
+ </CardStats>
+ </div>
+ </Link>
+
+ {isPaused ? (
+ <div className="mx-4 mb-3 flex items-center justify-between gap-2 rounded-lg bg-amber-50 px-3 py-2 ring-1 ring-inset ring-amber-200">
+ <Text variant="body" className="text-amber-700">
+ Schedules paused
</Text>
- <div className="flex min-h-5 items-center gap-2">
- <Text variant="small" className="text-zinc-500">
- {workflowCount} {workflowCount === 1 ? "workflow" : "workflows"}
- </Text>
- {needsSetupCount > 0 ? (
- <Badge variant="warning" size="small">
- {needsSetupCount} {needsSetupCount === 1 ? "needs" : "need"}{" "}
- setup
- </Badge>
- ) : null}
- </div>
- </Link>
- {isPaused ? (
- <div className="flex items-center justify-between gap-2 rounded-xl bg-amber-50 px-3 py-2 ring-1 ring-inset ring-amber-200">
- <Text variant="small" className="text-amber-700">
- Schedules paused
- </Text>
- <Button
- variant="secondary"
- size="small"
- loading={isResuming}
- onClick={handleResume}
- >
- Resume schedules
- </Button>
- </div>
- ) : null}
- <div className="mt-auto flex flex-wrap gap-2">
<Button
- as="NextLink"
- href={`/copilot?expertId=${expert.id}`}
variant="secondary"
size="small"
+ className={ACTION_BUTTON_CLASS}
+ loading={isResuming}
+ onClick={handleResume}
>
- Chat
- </Button>
- <Button
- variant="ghost"
- size="small"
- leftIcon={<Icon icon={PlusSignIcon} size={16} />}
- onClick={handleInstallClick}
- >
- Install workflow
+ Resume schedules
</Button>
- {pods.length > 0 ? (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- variant="ghost"
- size="small"
- leftIcon={<Icon icon={UserGroupIcon} size={16} />}
- aria-label={
- currentPod
- ? `Move to pod (currently ${currentPod.name})`
- : "Move to pod"
- }
- >
- {currentPod ? currentPod.name : "Move to pod"}
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- align="end"
- className="max-h-72 w-52 overflow-y-auto"
- >
- {pods.map((pod) => (
- <DropdownMenuItem
- key={pod.id}
- onSelect={() => onAssignPod(expert.id, pod.id)}
- >
- <span className="flex-1 truncate">{pod.name}</span>
- {expert.pod_id === pod.id ? (
- <Icon icon={Tick02Icon} size={16} className="ml-2" />
- ) : null}
- </DropdownMenuItem>
- ))}
- {expert.pod_id ? (
- <>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- onSelect={() => onAssignPod(expert.id, null)}
- >
- Remove from pod
- </DropdownMenuItem>
- </>
- ) : null}
- </DropdownMenuContent>
- </DropdownMenu>
- ) : null}
</div>
+ ) : null}
+
+ <div className="flex items-center gap-2 px-4 pb-4">
+ <Button
+ as="NextLink"
+ href={`/copilot?expertId=${expert.id}`}
+ variant="secondary"
+ size="small"
+ className={FOOTER_BUTTON_CLASS}
+ leftIcon={<ChatCircle size={14} />}
+ >
+ Chat
+ </Button>
+ <Button
+ variant="outline"
+ size="small"
+ className={FOOTER_OUTLINE_BUTTON_CLASS}
+ leftIcon={<Icon icon={PlusSignIcon} size={14} />}
+ onClick={handleInstallClick}
+ >
+ Install workflow
+ </Button>
</div>
+
<FireExpertDialog
expertId={expert.id}
expertName={expert.name}
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
new file mode 100644
index 0000000000..98261cf0d0
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/ExpertCover.tsx
@@ -0,0 +1,75 @@
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { cn } from "@/lib/utils";
+import {
+ Activity01Icon,
+ Alert01Icon,
+ Clock01Icon,
+ SparklesIcon,
+} from "@hugeicons/core-free-icons";
+import type { IconSvgElement } from "@hugeicons/react";
+import Image from "next/image";
+import { type ExpertRosterStatus, getExpertCoverSrc } from "../../../helpers";
+
+type CoverStatus = ExpertRosterStatus | "built-in";
+
+const STATUS_STYLES: Record<
+ CoverStatus,
+ { label: string; className: string; icon: IconSvgElement }
+> = {
+ idle: {
+ label: "Idle",
+ className: "bg-white text-zinc-700",
+ icon: Clock01Icon,
+ },
+ working: {
+ label: "Working",
+ className: "bg-emerald-50 text-emerald-700",
+ icon: Activity01Icon,
+ },
+ "needs-you": {
+ label: "Needs you",
+ className: "bg-amber-50 text-amber-700",
+ icon: Alert01Icon,
+ },
+ "built-in": {
+ label: "Built in",
+ className: "bg-white text-zinc-700",
+ icon: SparklesIcon,
+ },
+};
+
+interface Props {
+ className?: string;
+ color: string | undefined;
+ src?: string;
+ status?: CoverStatus;
+}
+
+export function ExpertCover({ className, color, src, status }: Props) {
+ const statusStyle = status ? STATUS_STYLES[status] : null;
+
+ return (
+ <div
+ className={cn(
+ "relative h-28 w-full overflow-hidden rounded-lg bg-zinc-100",
+ className,
+ )}
+ >
+ <Image
+ src={src ?? getExpertCoverSrc(color)}
+ alt=""
+ fill
+ sizes="(min-width: 1024px) 33vw, (min-width: 768px) 50vw, 100vw"
+ className="object-cover"
+ />
+ {statusStyle ? (
+ <span
+ className={`absolute bottom-3 right-3 flex items-center gap-1 rounded-md px-2 py-0.5 text-xs font-medium ${statusStyle.className}`}
+ >
+ <Icon icon={statusStyle.icon} size={13} />
+ {statusStyle.label}
+ </span>
+ ) : null}
+ </div>
+ );
+}
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 80b94edd54..7f7d66c7e7 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,17 +1,27 @@
+import { ditherColorsFor } from "@/app/(platform)/raise/components/ColorStep/helpers";
import { creditsToUsdLabel } from "@/lib/credits";
import { cn } from "@/lib/utils";
+import { useEffect, useState } from "react";
-const SEGMENT_COUNT = 36;
+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, muted }: Props) {
+export function SpendMeter({ spent, budget, color, muted }: Props) {
+ const [hasEntered, setHasEntered] = useState(false);
const ratio = budget > 0 ? Math.min(Math.max(spent / budget, 0), 1) : 0;
- const filledCount = Math.round(ratio * SEGMENT_COUNT);
+ 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 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)" : ""
@@ -26,19 +36,27 @@ export function SpendMeter({ spent, budget, muted }: Props) {
aria-valuemax={budget}
aria-valuetext={valueText}
className={cn(
- "flex h-4 w-full items-stretch gap-[3px]",
+ "flex h-4 w-full items-stretch gap-1",
muted && "opacity-50",
)}
>
- {Array.from({ length: SEGMENT_COUNT }, (_, index) => (
- <span
- key={index}
- className={cn(
- "flex-1 rounded-[1px] transition-colors duration-300",
- index < filledCount ? "bg-zinc-800" : "bg-zinc-200",
- )}
- />
- ))}
+ {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 0156ddde4b..f25c7b01c5 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCardSkeleton.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCardSkeleton.tsx
@@ -1,42 +1,44 @@
import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
-// Mirrors ExpertTeamCard's structure — banner, straddling avatar, tagline,
-// spend meter, footer actions — so the grid doesn't jump when the real
-// cards land. A single flat block would settle at the wrong height.
+// Mirrors ExpertTeamCard — cover, overlapping avatar, centred name and role,
+// stats pill, spend meter, icon footer — so the grid doesn't jump when the
+// real cards land. A single flat block would settle at the wrong height.
export function ExpertTeamCardSkeleton() {
return (
- <div className="flex flex-col rounded-[1.75rem] border border-zinc-200 bg-white p-1">
- <Skeleton className="h-24 w-full rounded-t-[1.5rem]" />
-
- <div className="flex flex-1 flex-col gap-3 p-4 pt-0">
- <div className="flex items-center gap-3">
- <Skeleton className="-mt-9 size-[4.5rem] shrink-0 self-start rounded-full ring-4 ring-white" />
- <div className="flex min-w-0 flex-1 flex-col gap-2">
- <Skeleton className="h-4 w-2/5 rounded-full" />
- <Skeleton className="h-3 w-1/4 rounded-full" />
+ <div className="flex flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white">
+ <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">
+ <Skeleton className="-mt-11 ml-1 size-[5.75rem] shrink-0 rounded-full" />
+ <div className="mt-2 flex flex-1 flex-col gap-1">
+ <div className="flex items-baseline justify-between gap-2">
+ <Skeleton className="h-3 w-12 rounded-full" />
+ <Skeleton className="h-3 w-14 rounded-full" />
+ </div>
+ <Skeleton className="h-4 w-full rounded-sm" />
</div>
</div>
-
- <div className="flex min-h-12 flex-col gap-2">
- <Skeleton className="h-3 w-full rounded-full" />
- <Skeleton className="h-3 w-4/5 rounded-full" />
+ <div className="mt-2 flex w-full flex-col items-start gap-2 pl-5 pr-2">
+ <Skeleton className="h-5 w-2/5 rounded-full" />
+ <Skeleton className="h-4 w-1/2 rounded-full" />
</div>
- <div className="flex flex-col gap-1">
- <div className="flex items-baseline justify-between gap-2">
- <Skeleton className="h-3 w-28 rounded-full" />
- <Skeleton className="h-3 w-16 rounded-full" />
- </div>
- <Skeleton className="h-4 w-full rounded-sm" />
+ <div className="mx-2 mt-3 flex rounded-lg bg-zinc-50 px-2 py-2 ring-1 ring-inset ring-zinc-100">
+ {[0, 1, 2, 3].map((stat) => (
+ <div
+ key={stat}
+ className="flex flex-1 flex-col items-center gap-1.5"
+ >
+ <Skeleton className="h-5 w-7 rounded-full" />
+ <Skeleton className="h-3 w-12 rounded-full" />
+ </div>
+ ))}
</div>
+ </div>
- <Skeleton className="h-3 min-h-5 w-32 rounded-full" />
- <Skeleton className="h-3 min-h-5 w-24 rounded-full" />
-
- <div className="mt-auto flex gap-2">
- <Skeleton className="h-9 w-[7.7rem] rounded-full" />
- <Skeleton className="h-9 w-[9.5rem] rounded-full" />
- </div>
+ <div className="flex gap-2 px-4 pb-4">
+ <Skeleton className="h-9 flex-1 rounded-lg" />
+ <Skeleton className="h-9 flex-1 rounded-lg" />
</div>
</div>
);
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
new file mode 100644
index 0000000000..df5a60b900
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/PodBoard/PodBoard.tsx
@@ -0,0 +1,110 @@
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { ExpertPod } from "@/app/api/__generated__/models/expertPod";
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
+import { Text } from "@/components/atoms/Text/Text";
+import { Folder02Icon } from "@hugeicons/core-free-icons";
+import { ACTION_BUTTON_CLASS } from "@/app/(platform)/team/helpers";
+
+interface Props {
+ isLoading: boolean;
+ podGroups: { pod: ExpertPod; experts: Expert[] }[];
+ ungroupedExperts: Expert[];
+ onNewPod: () => void;
+}
+
+const FOLDER_GRID_CLASS =
+ "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3";
+
+export function PodBoard({
+ isLoading,
+ podGroups,
+ ungroupedExperts,
+ onNewPod,
+}: Props) {
+ if (isLoading) {
+ return (
+ <div className={FOLDER_GRID_CLASS}>
+ {[0, 1, 2].map((index) => (
+ <Skeleton key={index} className="h-28 w-full rounded-xl" />
+ ))}
+ </div>
+ );
+ }
+
+ if (podGroups.length === 0 && ungroupedExperts.length === 0) {
+ return (
+ <div className="flex flex-col items-center gap-3 rounded-xl border border-dashed border-zinc-300 bg-white p-8 text-center">
+ <Text variant="large-medium">No pods yet</Text>
+ <Text variant="body" className="max-w-prose text-zinc-600">
+ Group experts into pods to keep related work together.
+ </Text>
+ <Button
+ variant="primary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ onClick={onNewPod}
+ >
+ New Pod
+ </Button>
+ </div>
+ );
+ }
+
+ return (
+ <div className={FOLDER_GRID_CLASS}>
+ {podGroups.map((group) => (
+ <PodFolder
+ key={group.pod.id}
+ name={group.pod.name}
+ experts={group.experts}
+ />
+ ))}
+ {ungroupedExperts.length > 0 ? (
+ <PodFolder name="Ungrouped" experts={ungroupedExperts} />
+ ) : null}
+ </div>
+ );
+}
+
+interface PodFolderProps {
+ name: string;
+ experts: Expert[];
+}
+
+function PodFolder({ name, experts }: PodFolderProps) {
+ return (
+ <section className="flex flex-col gap-3 rounded-xl border border-zinc-200 bg-white p-4">
+ <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">
+ <Icon icon={Folder02Icon} size={20} />
+ </span>
+ <div className="min-w-0">
+ <Text variant="h5" className="truncate">
+ {name}
+ </Text>
+ <Text variant="small" className="text-zinc-500">
+ {experts.length} {experts.length === 1 ? "expert" : "experts"}
+ </Text>
+ </div>
+ </div>
+ {experts.length > 0 ? (
+ <ul className="flex flex-wrap gap-1.5">
+ {experts.map((expert) => (
+ <li
+ key={expert.id}
+ className="max-w-full truncate rounded-md bg-zinc-50 px-2 py-0.5 text-xs text-zinc-600 ring-1 ring-inset ring-zinc-200"
+ >
+ {expert.name}
+ </li>
+ ))}
+ </ul>
+ ) : (
+ <Text variant="small" className="text-zinc-500">
+ No experts in this pod yet.
+ </Text>
+ )}
+ </section>
+ );
+}
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 0730411457..c18c9e0c59 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
@@ -8,18 +8,25 @@ import {
AvatarImage,
} from "@/components/atoms/Avatar/Avatar";
import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
import { Input } from "@/components/atoms/Input/Input";
+import { FullscreenDialog } from "@/components/molecules/FullscreenDialog/FullscreenDialog";
import { Text } from "@/components/atoms/Text/Text";
-import {
- Sheet,
- SheetContent,
- SheetDescription,
- SheetTitle,
-} from "@/components/ui/sheet";
-import { Icon } from "@/components/atoms/Icon/Icon";
-import { LockIcon } from "@hugeicons/core-free-icons";
-import { ReactNode, useState } from "react";
+import { Cancel01Icon, LockIcon } from "@hugeicons/core-free-icons";
+import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
+import { ReactNode, useEffect, useState } from "react";
+import { PanelResizeHandle } from "@/app/(platform)/copilot/components/PanelResizeHandle";
+import { useIsMobile } from "@/app/(platform)/copilot/useIsMobile";
+import { cn } from "@/lib/utils";
+import { useBottomScrollShadow } from "./useBottomScrollShadow";
import { useSoulDrawer } from "./useSoulDrawer";
+import { useSoulPanelSidebarCollapse } from "./useSoulPanelSidebarCollapse";
+
+const DEFAULT_PANEL_WIDTH = 520;
+const MIN_PANEL_WIDTH = 320;
+const MAX_PANEL_VIEWPORT_RATIO = 0.4;
+const PANEL_EASE: [number, number, number, number] = [0.32, 0.72, 0, 1];
+const PANEL_DURATION = 0.3;
interface Props {
expert: Expert | null;
@@ -27,69 +34,160 @@ interface Props {
}
export function SoulDrawer({ expert, onClose }: Props) {
- const [displayedExpert] = useState(expert);
+ const isMobile = useIsMobile();
+ const shouldReduceMotion = useReducedMotion();
+ const [width, setWidth] = useState(DEFAULT_PANEL_WIDTH);
+ const [isResizing, setIsResizing] = useState(false);
+ const maxWidth = useMaxPanelWidth();
+ const renderedWidth = Math.min(width, maxWidth);
+ useSoulPanelSidebarCollapse(expert !== null);
+
+ if (isMobile) {
+ if (!expert) return null;
+ return (
+ <FullscreenDialog title={`${expert.name}'s Soul`} onClose={onClose}>
+ <SoulPanelBody expert={expert} onClose={onClose} />
+ </FullscreenDialog>
+ );
+ }
+
+ const transition =
+ shouldReduceMotion || isResizing
+ ? { duration: 0 }
+ : { duration: PANEL_DURATION, ease: PANEL_EASE };
+
+ return (
+ <AnimatePresence>
+ {expert ? (
+ <motion.aside
+ data-soul-panel
+ aria-label={`${expert.name}'s Soul`}
+ initial={{ width: 0, opacity: 0 }}
+ animate={{ width: renderedWidth, opacity: 1 }}
+ exit={{ width: 0, opacity: 0 }}
+ transition={transition}
+ className="sticky top-0 h-svh shrink-0 self-start border-l border-l-[#80808017] bg-sidebar"
+ >
+ <PanelResizeHandle
+ panelSelector="[data-soul-panel]"
+ onWidthChange={setWidth}
+ onResizingChange={setIsResizing}
+ minWidth={MIN_PANEL_WIDTH}
+ maxWidth={maxWidth}
+ />
+ <div className="h-full overflow-hidden">
+ <div
+ style={{ width: renderedWidth }}
+ className="flex h-full min-h-0 flex-col"
+ >
+ <SoulPanelBody expert={expert} onClose={onClose} />
+ </div>
+ </div>
+ </motion.aside>
+ ) : null}
+ </AnimatePresence>
+ );
+}
+
+function useMaxPanelWidth() {
+ const [maxWidth, setMaxWidth] = useState(DEFAULT_PANEL_WIDTH);
+
+ useEffect(() => {
+ function update() {
+ setMaxWidth(
+ Math.max(
+ MIN_PANEL_WIDTH,
+ Math.round(window.innerWidth * MAX_PANEL_VIEWPORT_RATIO),
+ ),
+ );
+ }
+ update();
+ window.addEventListener("resize", update);
+ return () => window.removeEventListener("resize", update);
+ }, []);
+
+ return maxWidth;
+}
+
+interface BodyProps {
+ expert: Expert;
+ onClose: () => void;
+}
+
+function SoulPanelBody({ expert, onClose }: BodyProps) {
const { soul, updateField, save, isPending, canSave } = useSoulDrawer({
expert,
onClose,
});
+ const [scrollElement, setScrollElement] = useState<HTMLDivElement | null>(
+ null,
+ );
+ const hasMoreBelow = useBottomScrollShadow(scrollElement);
return (
- <Sheet
- open={expert !== null}
- onOpenChange={(open) => {
- if (!open) onClose();
- }}
- >
- <SheetContent
- side="right"
- className="flex w-full flex-col overflow-hidden p-0 sm:w-1/2 sm:max-w-none"
- >
- <div className="border-b border-zinc-200 bg-white px-6 py-5 pr-12 sm:px-8">
- <div className="flex items-center gap-3">
- <Avatar className="h-11 w-11">
- {displayedExpert?.avatar_url ? (
- <AvatarImage
- src={displayedExpert.avatar_url}
- alt={displayedExpert.name}
- />
- ) : null}
- <AvatarFallback>{displayedExpert?.name ?? "Soul"}</AvatarFallback>
- </Avatar>
- <div>
- <SheetTitle>{`${displayedExpert?.name ?? "Expert"}'s Soul`}</SheetTitle>
- <SheetDescription>
- A living document that shapes every reply.
- </SheetDescription>
- </div>
- </div>
- </div>
+ <>
+ <div className="flex h-[53px] shrink-0 items-center gap-2 border-b border-b-[#80808017] px-3">
+ <Avatar className="h-7 w-7 shrink-0">
+ {expert.avatar_url ? (
+ <AvatarImage
+ src={expert.avatar_url}
+ alt={expert.name}
+ width={56}
+ height={56}
+ />
+ ) : null}
+ <AvatarFallback>{expert.name}</AvatarFallback>
+ </Avatar>
+ <h2 className="min-w-0 flex-1 truncate text-sm font-medium text-zinc-900">
+ {expert.name}&apos;s Soul
+ </h2>
+ <button
+ type="button"
+ aria-label="Close Soul panel"
+ onClick={onClose}
+ className="rounded p-1.5 text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-700"
+ >
+ <Icon icon={Cancel01Icon} size={16} />
+ </button>
+ </div>
- <form onSubmit={save} className="flex min-h-0 flex-1 flex-col">
- <div className="flex-1 overflow-y-auto bg-zinc-50 px-4 py-6 sm:px-8">
- <div className="mx-auto max-w-2xl rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm sm:p-8">
- <SoulFields soul={soul} updateField={updateField} />
- <LearnedNotes />
- <ProtectedRules
- rules={displayedExpert?.protected_soul_rules ?? []}
- />
- </div>
- </div>
- <div className="flex justify-end gap-2 border-t border-zinc-200 bg-white px-6 py-4 sm:px-8">
- <Button type="button" variant="ghost" onClick={onClose}>
- Cancel
- </Button>
- <Button
- type="submit"
- variant="primary"
- loading={isPending}
- disabled={!canSave}
- >
- Save Soul
- </Button>
+ <form onSubmit={save} className="flex min-h-0 flex-1 flex-col">
+ <div className="relative min-h-0 flex-1">
+ <div
+ ref={setScrollElement}
+ className="h-full overflow-y-auto px-5 py-5"
+ >
+ <Text variant="small" className="mb-5 text-zinc-500">
+ A living document that shapes every reply.
+ </Text>
+ <SoulFields soul={soul} updateField={updateField} />
+ <LearnedNotes />
+ <ProtectedRules rules={expert.protected_soul_rules} />
</div>
- </form>
- </SheetContent>
- </Sheet>
+ <div
+ aria-hidden="true"
+ className={cn(
+ "pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-sidebar to-transparent transition-opacity duration-200",
+ hasMoreBelow ? "opacity-100" : "opacity-0",
+ )}
+ />
+ </div>
+ <div className="flex shrink-0 justify-end gap-2 border-t border-t-[#80808017] px-5 py-3">
+ <Button type="button" variant="ghost" size="small" onClick={onClose}>
+ Cancel
+ </Button>
+ <Button
+ type="submit"
+ variant="primary"
+ size="small"
+ loading={isPending}
+ disabled={!canSave}
+ >
+ Save Soul
+ </Button>
+ </div>
+ </form>
+ </>
);
}
@@ -105,7 +203,7 @@ function SoulFields({ soul, updateField }: SoulFieldsProps) {
id="soul-name"
label="Name"
labelVariant="small-medium"
- labelClassName="uppercase tracking-[0.12em] !text-purple-600"
+ labelClassName="!text-zinc-700"
value={soul.name}
maxLength={100}
required
@@ -115,7 +213,7 @@ function SoulFields({ soul, updateField }: SoulFieldsProps) {
id="soul-identity"
label="Identity and personality"
labelVariant="small-medium"
- labelClassName="uppercase tracking-[0.12em] !text-purple-600"
+ labelClassName="!text-zinc-700"
type="textarea"
rows={6}
value={soul.identity}
@@ -127,7 +225,7 @@ function SoulFields({ soul, updateField }: SoulFieldsProps) {
id="soul-voice"
label="Voice"
labelVariant="small-medium"
- labelClassName="uppercase tracking-[0.12em] !text-purple-600"
+ labelClassName="!text-zinc-700"
type="textarea"
rows={3}
value={soul.voice_preferences}
@@ -141,7 +239,7 @@ function SoulFields({ soul, updateField }: SoulFieldsProps) {
id="soul-boundaries"
label="Boundaries"
labelVariant="small-medium"
- labelClassName="uppercase tracking-[0.12em] !text-purple-600"
+ labelClassName="!text-zinc-700"
type="textarea"
rows={4}
value={soul.boundaries}
@@ -190,9 +288,5 @@ function ProtectedRules({ rules }: { rules: string[] }) {
}
function SoulSectionTitle({ children }: { children: ReactNode }) {
- return (
- <h3 className="text-xs font-semibold uppercase tracking-[0.12em] text-purple-600">
- {children}
- </h3>
- );
+ return <h3 className="text-sm font-medium text-zinc-900">{children}</h3>;
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useBottomScrollShadow.test.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useBottomScrollShadow.test.ts
new file mode 100644
index 0000000000..d80980d907
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useBottomScrollShadow.test.ts
@@ -0,0 +1,48 @@
+import { fireEvent, renderHook, waitFor } from "@testing-library/react";
+import { expect, test, vi } from "vitest";
+import { useBottomScrollShadow } from "./useBottomScrollShadow";
+
+function scrollElement(scrollHeight: number) {
+ const element = document.createElement("div");
+ Object.defineProperties(element, {
+ scrollHeight: { value: scrollHeight, writable: true, configurable: true },
+ clientHeight: { value: 100, configurable: true },
+ });
+ return element;
+}
+
+test("reattaches to remounted lists and stops observing detached lists", () => {
+ const first = scrollElement(300);
+ const second = scrollElement(600);
+ const remove = vi.spyOn(first, "removeEventListener");
+ const { result, rerender, unmount } = renderHook(
+ ({ element }: { element: HTMLElement | null }) =>
+ useBottomScrollShadow(element),
+ { initialProps: { element: first as HTMLElement | null } },
+ );
+ expect(result.current).toBe(true);
+ first.scrollTop = 200;
+ fireEvent.scroll(first);
+ expect(result.current).toBe(false);
+ rerender({ element: null });
+ expect(result.current).toBe(false);
+ expect(remove).toHaveBeenCalledWith("scroll", expect.any(Function));
+ rerender({ element: second });
+ expect(result.current).toBe(true);
+ fireEvent.scroll(first);
+ expect(result.current).toBe(true);
+ second.scrollTop = 500;
+ fireEvent.scroll(second);
+ expect(result.current).toBe(false);
+ unmount();
+ remove.mockRestore();
+});
+
+test("updates when filtering replaces children without resizing the list", async () => {
+ const element = scrollElement(100);
+ const { result } = renderHook(() => useBottomScrollShadow(element));
+ expect(result.current).toBe(false);
+ Object.defineProperty(element, "scrollHeight", { value: 300 });
+ element.appendChild(document.createElement("div"));
+ await waitFor(() => expect(result.current).toBe(true));
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useBottomScrollShadow.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useBottomScrollShadow.ts
new file mode 100644
index 0000000000..e43ca8d684
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useBottomScrollShadow.ts
@@ -0,0 +1,44 @@
+import { useEffect, useState } from "react";
+
+const BOTTOM_THRESHOLD_PX = 2;
+
+export function useBottomScrollShadow(element: HTMLElement | null) {
+ const [hasMoreBelow, setHasMoreBelow] = useState(false);
+
+ useEffect(() => {
+ if (!element) {
+ setHasMoreBelow(false);
+ return;
+ }
+ function update() {
+ if (!element) return;
+ const remaining =
+ element.scrollHeight - element.scrollTop - element.clientHeight;
+ setHasMoreBelow(remaining > BOTTOM_THRESHOLD_PX);
+ }
+ const observer =
+ typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
+ function observeContents() {
+ if (!element) return;
+ observer?.disconnect();
+ observer?.observe(element);
+ Array.from(element.children).forEach((child) => observer?.observe(child));
+ update();
+ }
+ observeContents();
+ element.addEventListener("scroll", update, { passive: true });
+ const mutations = new MutationObserver(observeContents);
+ mutations.observe(element, {
+ childList: true,
+ subtree: true,
+ characterData: true,
+ });
+ return () => {
+ element.removeEventListener("scroll", update);
+ observer?.disconnect();
+ mutations.disconnect();
+ };
+ }, [element]);
+
+ return element !== null && hasMoreBelow;
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useSoulPanelSidebarCollapse.test.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useSoulPanelSidebarCollapse.test.ts
new file mode 100644
index 0000000000..d0b06c19ba
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useSoulPanelSidebarCollapse.test.ts
@@ -0,0 +1,74 @@
+import { renderHook } from "@testing-library/react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { useSoulPanelSidebarCollapse } from "./useSoulPanelSidebarCollapse";
+
+const setOpen = vi.fn<(open: boolean) => void>();
+const setOpenMobile = vi.fn<(open: boolean) => void>();
+let sidebarOpen = true;
+
+vi.mock("@/components/ui/sidebar", () => ({
+ useOptionalSidebar: () => ({
+ open: sidebarOpen,
+ setOpen,
+ setOpenMobile,
+ }),
+}));
+
+beforeEach(() => {
+ sidebarOpen = true;
+ setOpen.mockReset();
+ setOpenMobile.mockReset();
+});
+
+describe("useSoulPanelSidebarCollapse", () => {
+ it("closes the left sidebar when the Soul panel opens", () => {
+ renderHook(() => useSoulPanelSidebarCollapse(true));
+
+ expect(setOpen).toHaveBeenCalledWith(false);
+ expect(setOpenMobile).toHaveBeenCalledWith(false);
+ });
+
+ it("restores the previous sidebar state when the Soul panel closes", () => {
+ const { rerender } = renderHook(
+ ({ isOpen }) => useSoulPanelSidebarCollapse(isOpen),
+ { initialProps: { isOpen: true } },
+ );
+ sidebarOpen = false;
+ setOpen.mockClear();
+
+ rerender({ isOpen: false });
+
+ expect(setOpen).toHaveBeenCalledWith(true);
+ });
+ it("restores a sidebar it closed when the panel unmounts", () => {
+ const { rerender, unmount } = renderHook(() =>
+ useSoulPanelSidebarCollapse(true),
+ );
+ sidebarOpen = false;
+ rerender();
+ setOpen.mockClear();
+ unmount();
+ expect(setOpen).toHaveBeenCalledExactlyOnceWith(true);
+ });
+
+ it("does not open a sidebar that was already closed", () => {
+ sidebarOpen = false;
+ const { unmount } = renderHook(() => useSoulPanelSidebarCollapse(true));
+ setOpen.mockClear();
+ unmount();
+ expect(setOpen).not.toHaveBeenCalled();
+ });
+
+ it("does not overwrite a sidebar the user reopened", () => {
+ const { rerender, unmount } = renderHook(() =>
+ useSoulPanelSidebarCollapse(true),
+ );
+ sidebarOpen = false;
+ rerender();
+ sidebarOpen = true;
+ rerender();
+ setOpen.mockClear();
+ unmount();
+ expect(setOpen).not.toHaveBeenCalled();
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useSoulPanelSidebarCollapse.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useSoulPanelSidebarCollapse.ts
new file mode 100644
index 0000000000..5aafee6204
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/SoulDrawer/useSoulPanelSidebarCollapse.ts
@@ -0,0 +1,24 @@
+import { useOptionalSidebar } from "@/components/ui/sidebar";
+import { useEffect, useLayoutEffect, useRef } from "react";
+
+export function useSoulPanelSidebarCollapse(isPanelOpen: boolean) {
+ const sidebar = useOptionalSidebar();
+ const sidebarRef = useRef(sidebar);
+ useLayoutEffect(() => {
+ sidebarRef.current = sidebar;
+ }, [sidebar]);
+ const hasSidebar = Boolean(sidebar);
+
+ useEffect(() => {
+ const current = sidebarRef.current;
+ if (!isPanelOpen || !current) return;
+ const wasOpen = current.open;
+ current.setOpen(false);
+ current.setOpenMobile(false);
+
+ return () => {
+ const latest = sidebarRef.current;
+ if (wasOpen && latest && !latest.open) latest.setOpen(true);
+ };
+ }, [isPanelOpen, hasSidebar]);
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsx
new file mode 100644
index 0000000000..96b259eca6
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamHeaderActions.tsx
@@ -0,0 +1,36 @@
+"use client";
+
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { SparklesIcon, UserGroupIcon } from "@hugeicons/core-free-icons";
+import { ACTION_BUTTON_CLASS, OUTLINE_ACTION_BUTTON_CLASS } from "../helpers";
+
+interface Props {
+ onNewPod: () => void;
+}
+
+export function TeamHeaderActions({ onNewPod }: Props) {
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ <Button
+ as="NextLink"
+ href="/raise"
+ variant="primary"
+ size="small"
+ className={ACTION_BUTTON_CLASS}
+ leftIcon={<Icon icon={SparklesIcon} className="size-3.5" />}
+ >
+ New Expert
+ </Button>
+ <Button
+ variant="outline"
+ size="small"
+ onClick={onNewPod}
+ className={OUTLINE_ACTION_BUTTON_CLASS}
+ leftIcon={<Icon icon={UserGroupIcon} className="size-3.5" />}
+ >
+ New Pod
+ </Button>
+ </div>
+ );
+}
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 fc95775bf3..adaaaee284 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
@@ -1,87 +1,82 @@
+"use client";
+
import { Expert } from "@/app/api/__generated__/models/expert";
-import { ExpertPod } from "@/app/api/__generated__/models/expertPod";
+import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
import { Text } from "@/components/atoms/Text/Text";
import { ReactNode } from "react";
-import { TEAM_GRID_CLASS } from "../../helpers";
+import { cn } from "@/lib/utils";
+import {
+ SECTION_INSET_CLASS,
+ TEAM_GRID_CLASS,
+ getAutopilotSummary,
+} from "../../helpers";
import { AutopilotCard } from "../AutopilotCard";
import { ExpertTeamCardSkeleton } from "../ExpertTeamCardSkeleton";
+import { TeamRosterToolbar } from "./TeamRosterToolbar";
+import { useTeamRosterView } from "./useTeamRosterView";
interface Props {
isLoading: boolean;
- podGroups: { pod: ExpertPod; experts: Expert[] }[];
- ungroupedExperts: Expert[];
+ experts: Expert[];
+ schedulesForExpert: (expert: Expert) => GraphExecutionJobInfo[];
renderCard: (expert: Expert) => ReactNode;
}
-interface SectionHeaderProps {
- name: string;
- count: number;
-}
-
export function TeamRoster({
isLoading,
- podGroups,
- ungroupedExperts,
+ experts,
+ schedulesForExpert,
renderCard,
}: Props) {
- if (isLoading) {
- return (
- <div className={TEAM_GRID_CLASS}>
- <AutopilotCard />
- {[0, 1, 2].map((index) => (
- <ExpertTeamCardSkeleton key={index} />
- ))}
- </div>
- );
- }
+ const { query, setQuery, filter, setFilter, isNarrowed, visibleExperts } =
+ useTeamRosterView({ experts, schedulesForExpert });
- if (podGroups.length === 0) {
- return (
- <div className={TEAM_GRID_CLASS}>
- <AutopilotCard />
- {ungroupedExperts.map(renderCard)}
- </div>
- );
- }
+ // Autopilot reports on the whole team, so its summary ignores the toolbar.
+ const summary = getAutopilotSummary({ experts, schedulesForExpert });
+ const autopilot = (
+ <AutopilotCard
+ skillCount={summary.skillCount}
+ scheduleCount={summary.scheduleCount}
+ workflowCount={summary.workflowCount}
+ />
+ );
return (
- <div className="space-y-8">
- <div className={TEAM_GRID_CLASS}>
- <AutopilotCard />
+ <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="h5">Experts</Text>
+ <TeamRosterToolbar
+ query={query}
+ onQueryChange={setQuery}
+ filter={filter}
+ onFilterChange={setFilter}
+ />
</div>
- {podGroups.map((group) => (
- <section key={group.pod.id} className="space-y-3">
- <SectionHeader name={group.pod.name} count={group.experts.length} />
- {group.experts.length > 0 ? (
- <div className={TEAM_GRID_CLASS}>
- {group.experts.map(renderCard)}
- </div>
- ) : (
- <Text variant="small" className="text-zinc-500">
- No experts in this pod yet.
- </Text>
- )}
- </section>
- ))}
- {ungroupedExperts.length > 0 ? (
- <section className="space-y-3">
- <SectionHeader name="Ungrouped" count={ungroupedExperts.length} />
- <div className={TEAM_GRID_CLASS}>
- {ungroupedExperts.map(renderCard)}
- </div>
- </section>
- ) : null}
- </div>
- );
-}
-function SectionHeader({ name, count }: SectionHeaderProps) {
- return (
- <div className="flex items-baseline gap-2">
- <Text variant="h4">{name}</Text>
- <Text variant="small" className="text-zinc-500">
- {count} {count === 1 ? "expert" : "experts"}
- </Text>
- </div>
+ {isLoading ? (
+ <div className={TEAM_GRID_CLASS}>
+ {autopilot}
+ {[0, 1, 2].map((index) => (
+ <ExpertTeamCardSkeleton key={index} />
+ ))}
+ </div>
+ ) : (
+ <div className={TEAM_GRID_CLASS}>
+ {/* Autopilot is pinned rather than filtered — it is always on the
+ team, so it stays put unless the roster is being narrowed. */}
+ {isNarrowed ? null : autopilot}
+ {visibleExperts.map(renderCard)}
+ </div>
+ )}
+
+ {!isLoading && isNarrowed && visibleExperts.length === 0 ? (
+ <Text
+ variant="body"
+ className={cn("text-zinc-500", SECTION_INSET_CLASS)}
+ >
+ No experts match that search or filter.
+ </Text>
+ ) : null}
+ </section>
);
}
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
new file mode 100644
index 0000000000..7d7c91e8c5
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/TeamRosterToolbar.tsx
@@ -0,0 +1,50 @@
+import { Select } from "@/components/atoms/Select/Select";
+import { SearchInput } from "@/components/molecules/SearchInput/SearchInput";
+import { TeamFilter } from "../../helpers";
+
+interface Props {
+ query: string;
+ onQueryChange: (next: string) => void;
+ filter: TeamFilter;
+ onFilterChange: (next: TeamFilter) => void;
+}
+
+const FILTER_OPTIONS = [
+ { value: "all", label: "All experts" },
+ { value: "scheduled", label: "Scheduled" },
+ { value: "needs-setup", label: "Needs setup" },
+ { value: "paused", label: "Paused" },
+];
+
+export function TeamRosterToolbar({
+ query,
+ onQueryChange,
+ filter,
+ onFilterChange,
+}: Props) {
+ return (
+ <div className="flex flex-wrap items-center justify-center gap-2">
+ <SearchInput
+ value={query}
+ onChange={onQueryChange}
+ size="xsmall"
+ 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"
+ 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"
+ />
+ </div>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/useTeamRosterView.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/useTeamRosterView.ts
new file mode 100644
index 0000000000..cfb41bfe96
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/TeamRoster/useTeamRosterView.ts
@@ -0,0 +1,28 @@
+import { Expert } from "@/app/api/__generated__/models/expert";
+import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
+import { useState } from "react";
+import { TeamFilter, filterExperts } from "../../helpers";
+
+interface Args {
+ experts: Expert[];
+ schedulesForExpert: (expert: Expert) => GraphExecutionJobInfo[];
+}
+
+export function useTeamRosterView({ experts, schedulesForExpert }: Args) {
+ const [query, setQuery] = useState("");
+ const [filter, setFilter] = useState<TeamFilter>("all");
+
+ return {
+ query,
+ setQuery,
+ filter,
+ setFilter,
+ isNarrowed: query.trim().length > 0 || filter !== "all",
+ visibleExperts: filterExperts({
+ experts,
+ query,
+ filter,
+ schedulesForExpert,
+ }),
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/WhatRunsZone.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/WhatRunsZone.tsx
deleted file mode 100644
index 801ab058e9..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/WhatRunsZone.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-import { Expert } from "@/app/api/__generated__/models/expert";
-import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
-import { Button } from "@/components/atoms/Button/Button";
-import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
-import { Text } from "@/components/atoms/Text/Text";
-import { cn } from "@/lib/utils";
-import { SECTION_INSET_CLASS } from "../../helpers";
-import { ExpertWorkflowGroup } from "./components/ExpertWorkflowGroup";
-import { WhatRunsFilters } from "./components/WhatRunsFilters";
-import { YourAgentsList } from "./components/YourAgentsList";
-import { WhatRunsFilter } from "./helpers";
-import { useWhatRunsZone } from "./useWhatRunsZone";
-
-type Props = {
- experts: Expert[];
- schedules: GraphExecutionJobInfo[];
-};
-
-const GROUP_EMPTY_MESSAGES: Partial<Record<WhatRunsFilter, string>> = {
- workflows: "No workflows installed yet.",
- scheduled: "No scheduled workflows yet.",
-};
-
-export function WhatRunsZone({ experts, schedules }: Props) {
- const {
- filter,
- setFilter,
- groups,
- showAgents,
- unadoptedAgents,
- libraryAgentCount,
- isLoadingAgents,
- isErrorAgents,
- hasMoreAgents,
- isLoadingMoreAgents,
- isErrorLoadingMoreAgents,
- retryAgents,
- loadMoreAgents,
- adopt,
- pendingLibraryAgentIDs,
- adoptedTargetKeys,
- } = useWhatRunsZone({
- experts,
- schedules,
- enabled: experts.length > 0,
- });
-
- if (experts.length === 0) return null;
-
- const groupEmptyMessage = GROUP_EMPTY_MESSAGES[filter];
-
- return (
- <section aria-label="What runs" className="!mt-10 flex flex-col gap-4">
- <div className={cn("border-b border-zinc-100 pb-4", SECTION_INSET_CLASS)}>
- <Text variant="h4">What runs</Text>
- </div>
-
- <div className={SECTION_INSET_CLASS}>
- <WhatRunsFilters value={filter} onChange={setFilter} />
- </div>
-
- {/* Keyed on the filter so React remounts the results and the enter
- animation replays — without it, switching tabs swaps the content
- instantly. Neither child holds state, so the remount costs nothing. */}
- <div
- key={filter}
- className="flex flex-col gap-6 duration-300 animate-in fade-in slide-in-from-bottom-2 motion-reduce:animate-none"
- >
- {groups.length > 0 ? (
- <div className="flex flex-col gap-4">
- {groups.map((group) => (
- <ExpertWorkflowGroup key={group.expert.id} group={group} />
- ))}
- </div>
- ) : groupEmptyMessage ? (
- <Text variant="small" className="text-zinc-500">
- {groupEmptyMessage}
- </Text>
- ) : null}
-
- {showAgents ? (
- isLoadingAgents ? (
- <Skeleton className="h-24 w-full rounded-2xl" />
- ) : isErrorAgents ? (
- <div className="flex items-center justify-between gap-3 rounded-2xl border border-zinc-200 bg-white px-4 py-3">
- <Text variant="small" className="text-zinc-500">
- We could not load your workflows.
- </Text>
- <Button variant="secondary" size="small" onClick={retryAgents}>
- Retry
- </Button>
- </div>
- ) : (
- <YourAgentsList
- agents={unadoptedAgents}
- experts={experts}
- libraryAgentCount={libraryAgentCount}
- pendingLibraryAgentIDs={pendingLibraryAgentIDs}
- adoptedTargetKeys={adoptedTargetKeys}
- hasMoreAgents={hasMoreAgents}
- isLoadingMoreAgents={isLoadingMoreAgents}
- isErrorLoadingMoreAgents={isErrorLoadingMoreAgents}
- onLoadMore={loadMoreAgents}
- onAdopt={adopt}
- />
- )
- ) : null}
- </div>
- </section>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/AdoptAgentButton.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/AdoptAgentButton.tsx
deleted file mode 100644
index 9306692152..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/AdoptAgentButton.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import { Expert } from "@/app/api/__generated__/models/expert";
-import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
-import { Button } from "@/components/atoms/Button/Button";
-import { Text } from "@/components/atoms/Text/Text";
-import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
-import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/components/molecules/Popover/Popover";
-import { useState } from "react";
-
-type Props = {
- agent: LibraryAgent;
- experts: Expert[];
- isPending: boolean;
- onAdopt: (agent: LibraryAgent, expert: Expert) => void;
-};
-
-export function AdoptAgentButton({
- agent,
- experts,
- isPending,
- onAdopt,
-}: Props) {
- const [open, setOpen] = useState(false);
-
- function handleSelect(expert: Expert) {
- setOpen(false);
- onAdopt(agent, expert);
- }
-
- function handleSingleExpert() {
- const expert = experts[0];
- if (expert) onAdopt(agent, expert);
- }
-
- if (experts.length === 1) {
- return (
- <Button
- variant="secondary"
- size="small"
- loading={isPending}
- onClick={handleSingleExpert}
- >
- Install
- </Button>
- );
- }
-
- return (
- <Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger asChild>
- <Button variant="secondary" size="small" loading={isPending}>
- Install
- </Button>
- </PopoverTrigger>
- <PopoverContent align="end" className="w-72 p-2">
- <Text variant="small-medium" className="px-2 pb-1 pt-1 text-zinc-500">
- Choose an expert
- </Text>
- <div className="flex flex-col">
- {experts.map((expert) => (
- <button
- key={expert.id}
- type="button"
- onClick={() => handleSelect(expert)}
- className="flex items-start gap-2 rounded-lg px-2 py-2 text-left hover:bg-zinc-50 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-zinc-900"
- >
- <ExpertAvatar
- name={expert.name}
- avatarUrl={expert.avatar_url ?? null}
- size={28}
- />
- <div className="min-w-0 flex-1">
- <Text variant="body" className="truncate">
- {expert.name}
- </Text>
- <Text variant="small" className="text-zinc-500">
- Installs on {expert.name}.
- </Text>
- </div>
- </button>
- ))}
- </div>
- </PopoverContent>
- </Popover>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/ExpertWorkflowGroup.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/ExpertWorkflowGroup.tsx
deleted file mode 100644
index 332123de83..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/ExpertWorkflowGroup.tsx
+++ /dev/null
@@ -1,125 +0,0 @@
-import { Badge } from "@/components/atoms/Badge/Badge";
-import { Icon } from "@/components/atoms/Icon/Icon";
-import { Text } from "@/components/atoms/Text/Text";
-import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
-import { safeHumanizeCronExpression } from "@/lib/cron-expression-utils";
-import { FlashIcon } from "@hugeicons/core-free-icons";
-import Link from "next/link";
-import { getLastRunLabel, workflowNeedsSetup } from "../../../helpers";
-import { STATUS_BADGE_CLASS } from "../constants";
-import { ExpertWorkflowGroupData } from "../helpers";
-
-type Props = {
- group: ExpertWorkflowGroupData;
-};
-
-export function ExpertWorkflowGroup({ group }: Props) {
- const { expert, workflows } = group;
- const lastRun = getLastRunLabel(expert);
- const countLabel = `${workflows.length} ${workflows.length === 1 ? "workflow" : "workflows"}`;
- const isPaused = Boolean(expert.schedules_paused_at);
- const lastRunVariant =
- expert.last_run_status === "FAILED"
- ? "error"
- : expert.last_run_status === "COMPLETED"
- ? "success"
- : "info";
-
- return (
- <section
- aria-label={`${expert.name} runs`}
- className="rounded-2xl border border-zinc-200 bg-white"
- >
- <div className="flex flex-wrap items-center gap-3 border-b border-zinc-100 px-4 py-3">
- <ExpertAvatar
- name={expert.name}
- avatarUrl={expert.avatar_url ?? null}
- size={32}
- />
- <div className="min-w-0 flex-1">
- <Text variant="large-medium" className="truncate">
- {`${expert.name} · ${countLabel}`}
- </Text>
- </div>
- {lastRun ? (
- <Badge
- variant={lastRunVariant}
- className={`shrink-0 ${STATUS_BADGE_CLASS}`}
- >
- {lastRun}
- </Badge>
- ) : null}
- {isPaused ? (
- <Badge variant="info" className={`shrink-0 ${STATUS_BADGE_CLASS}`}>
- Paused
- </Badge>
- ) : null}
- </div>
-
- {workflows.length === 0 ? (
- <div className="px-4 py-3">
- <Text variant="small" className="text-zinc-500">
- Nothing installed yet —{" "}
- <Link href="/marketplace" className="underline">
- browse marketplace
- </Link>
- </Text>
- </div>
- ) : (
- <div className="divide-y divide-zinc-100">
- {workflows.map(({ workflow, schedules }) => {
- const needsSetup = workflowNeedsSetup(workflow, schedules);
- const setupHref = workflow.library_agent_id
- ? `/library/agents/${workflow.library_agent_id}`
- : "/marketplace";
- return (
- <div
- key={workflow.id}
- data-testid="what-runs-workflow-row"
- className="flex flex-wrap items-center gap-3 px-4 py-3"
- >
- <Icon
- icon={FlashIcon}
- size={18}
- aria-hidden="true"
- className="shrink-0 text-zinc-400"
- />
- <div className="min-w-0 flex-1">
- <Text variant="body" className="truncate">
- {workflow.name ?? "Unnamed workflow"}
- </Text>
- </div>
- <div className="ml-auto flex flex-wrap items-center justify-end gap-2">
- {needsSetup && !isPaused ? (
- <>
- <Badge variant="warning" className={STATUS_BADGE_CLASS}>
- Needs setup
- </Badge>
- <Link
- href={setupHref}
- className="rounded-sm text-sm font-medium text-zinc-700 underline underline-offset-2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-zinc-900"
- >
- Set up
- </Link>
- </>
- ) : null}
- {!isPaused
- ? schedules.map((schedule) => (
- <Badge
- key={schedule.id}
- variant="info"
- className={STATUS_BADGE_CLASS}
- >
- {safeHumanizeCronExpression(schedule.cron)}
- </Badge>
- ))
- : null}
- </div>
- </div>
- );
- })}
- </div>
- )}
- </section>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/WhatRunsFilters.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/WhatRunsFilters.tsx
deleted file mode 100644
index 15d294f074..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/WhatRunsFilters.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import { cn } from "@/lib/utils";
-import { WHAT_RUNS_FILTERS, WhatRunsFilter } from "../helpers";
-import { useFilterIndicator } from "./useFilterIndicator";
-
-type Props = {
- value: WhatRunsFilter;
- onChange: (filter: WhatRunsFilter) => void;
-};
-
-export function WhatRunsFilters({ value, onChange }: Props) {
- const { listRef, indicator } = useFilterIndicator(value);
-
- return (
- <div
- ref={listRef}
- className="relative flex flex-wrap gap-2"
- role="group"
- aria-label="Filter"
- >
- {indicator ? (
- <span
- aria-hidden
- style={{ left: indicator.left, width: indicator.width }}
- className="ease-[cubic-bezier(0.33,1,0.68,1)] absolute top-0 h-[2.125rem] rounded-full bg-zinc-800 transition-[left,width] duration-300 motion-reduce:transition-none"
- />
- ) : null}
-
- {WHAT_RUNS_FILTERS.map((chip) => {
- const isActive = chip.id === value;
- return (
- <button
- key={chip.id}
- type="button"
- data-active={isActive}
- aria-pressed={isActive}
- onClick={() => onChange(chip.id)}
- className={cn(
- "relative rounded-full px-3 py-1.5 text-sm transition-colors duration-200 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-zinc-900",
- "active:scale-95 motion-reduce:active:scale-100",
- // The pill behind supplies the active fill; the chip only ever
- // animates its label colour, so the two never fight.
- isActive
- ? "text-white"
- : "bg-zinc-100 text-zinc-600 hover:bg-zinc-200",
- )}
- >
- {chip.label}
- </button>
- );
- })}
- </div>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/YourAgentsList.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/YourAgentsList.tsx
deleted file mode 100644
index cf4a4317cd..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/YourAgentsList.tsx
+++ /dev/null
@@ -1,108 +0,0 @@
-import { Expert } from "@/app/api/__generated__/models/expert";
-import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
-import { Button } from "@/components/atoms/Button/Button";
-import { Text } from "@/components/atoms/Text/Text";
-import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";
-import { workflowSubtitle } from "@/components/molecules/InstallWorkflowPicker/helpers";
-import { getAdoptableExperts } from "../helpers";
-import { AdoptAgentButton } from "./AdoptAgentButton";
-
-type Props = {
- agents: LibraryAgent[];
- experts: Expert[];
- libraryAgentCount: number;
- pendingLibraryAgentIDs: Set<string>;
- adoptedTargetKeys: Set<string>;
- hasMoreAgents: boolean;
- isLoadingMoreAgents: boolean;
- isErrorLoadingMoreAgents: boolean;
- onLoadMore: () => void;
- onAdopt: (agent: LibraryAgent, expert: Expert) => void;
-};
-
-export function YourAgentsList({
- agents,
- experts,
- libraryAgentCount,
- pendingLibraryAgentIDs,
- adoptedTargetKeys,
- hasMoreAgents,
- isLoadingMoreAgents,
- isErrorLoadingMoreAgents,
- onLoadMore,
- onAdopt,
-}: Props) {
- return (
- <section aria-label="Your workflows" className="!mt-8 flex flex-col gap-2">
- <div className="mb-4 border-b border-zinc-100 pb-4">
- <Text variant="h4">Your workflows</Text>
- </div>
- {agents.length === 0 ? (
- !hasMoreAgents ? (
- <Text variant="small" className="text-zinc-500">
- {libraryAgentCount === 0
- ? "No workflows available to install."
- : "Every workflow is already on your team."}
- </Text>
- ) : null
- ) : (
- <div className="divide-y divide-zinc-100 rounded-2xl border border-zinc-200 bg-white">
- {agents.map((agent) => {
- const adoptableExperts = getAdoptableExperts(
- agent,
- experts,
- adoptedTargetKeys,
- );
- return (
- <div
- key={agent.id}
- data-testid="what-runs-agent-row"
- className="flex items-center gap-3 px-4 py-3"
- >
- <ExpertAvatar
- name={agent.name}
- avatarUrl={agent.image_url ?? null}
- size={32}
- />
- <div className="min-w-0 flex-1">
- <Text variant="body" className="truncate">
- {agent.name}
- </Text>
- <Text variant="small" className="truncate text-zinc-500">
- {workflowSubtitle(agent.description)}
- </Text>
- </div>
- <AdoptAgentButton
- agent={agent}
- experts={adoptableExperts}
- isPending={pendingLibraryAgentIDs.has(agent.id)}
- onAdopt={onAdopt}
- />
- </div>
- );
- })}
- </div>
- )}
- {isErrorLoadingMoreAgents ? (
- <div className="flex items-center justify-between gap-3 rounded-xl border border-zinc-200 px-3 py-2">
- <Text variant="small" className="text-zinc-500">
- We could not load more workflows.
- </Text>
- <Button variant="secondary" size="small" onClick={onLoadMore}>
- Retry loading more
- </Button>
- </div>
- ) : hasMoreAgents ? (
- <Button
- variant="secondary"
- size="small"
- loading={isLoadingMoreAgents}
- onClick={onLoadMore}
- className="self-start"
- >
- Load more workflows
- </Button>
- ) : null}
- </section>
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/useFilterIndicator.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/useFilterIndicator.ts
deleted file mode 100644
index 8b71bfc2c7..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/useFilterIndicator.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { useLayoutEffect, useRef, useState } from "react";
-
-interface Indicator {
- left: number;
- width: number;
-}
-
-// The pill is one element that slides between chips rather than a background
-// on each chip, so switching tabs reads as a single travelling object. Measured
-// rather than CSS-only because the chips are text-width, not a fixed grid.
-export function useFilterIndicator(activeId: string) {
- const listRef = useRef<HTMLDivElement>(null);
- const [indicator, setIndicator] = useState<Indicator | null>(null);
-
- useLayoutEffect(() => {
- const list = listRef.current;
- if (!list) return;
-
- function measure() {
- const list = listRef.current;
- const active = list?.querySelector<HTMLElement>('[data-active="true"]');
- if (!list || !active) return;
- setIndicator({ left: active.offsetLeft, width: active.offsetWidth });
- }
-
- measure();
- // Chips wrap on narrow viewports, so the pill has to re-measure on resize.
- const observer = new ResizeObserver(measure);
- observer.observe(list);
- return () => observer.disconnect();
- }, [activeId]);
-
- return { listRef, indicator };
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/constants.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/constants.ts
deleted file mode 100644
index 7fd4cff27e..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/constants.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const STATUS_BADGE_CLASS = "normal-case tracking-normal";
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/helpers.test.ts
deleted file mode 100644
index 63a9a686ae..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/helpers.test.ts
+++ /dev/null
@@ -1,325 +0,0 @@
-import { Expert } from "@/app/api/__generated__/models/expert";
-import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
-import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
-import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
-import { describe, expect, it } from "vitest";
-import {
- getGraphWorkflowCounts,
- getWorkflowSchedules,
- workflowNeedsSetup,
-} from "../../helpers";
-import {
- getAdoptableExperts,
- getAdoptTargetKey,
- getFilterView,
- getUnadoptedAgents,
- getVisibleGroups,
- pruneAdoptedTargetKeys,
-} from "./helpers";
-
-function makeWorkflow(over: Partial<ExpertWorkflowRef>): ExpertWorkflowRef {
- return {
- id: "wf",
- store_listing_version_id: "slv",
- library_agent_id: "lib",
- graph_id: "graph",
- name: "Workflow",
- description: null,
- ...over,
- };
-}
-
-function makeExpert(over: Partial<Expert>): Expert {
- return { id: "expert", name: "Expert", workflows: [], ...over } as Expert;
-}
-
-function makeAgent(over: Partial<LibraryAgent>): LibraryAgent {
- return {
- id: "agent",
- graph_id: "graph",
- name: "Agent",
- ...over,
- } as unknown as LibraryAgent;
-}
-
-function makeSchedule(
- over: Partial<GraphExecutionJobInfo>,
-): GraphExecutionJobInfo {
- return {
- id: "schedule",
- name: "Schedule",
- user_id: "user",
- graph_id: "graph-scheduled",
- graph_version: 1,
- cron: "40 7 * * *",
- input_data: {},
- next_run_time: "2026-08-15T07:40:00Z",
- expert_id: "a",
- ...over,
- };
-}
-
-describe("getFilterView", () => {
- it("shows both groups and agents for all", () => {
- expect(getFilterView("all")).toEqual({
- showGroups: true,
- showAgents: true,
- includeEmptyGroups: true,
- scheduledOnly: false,
- });
- });
-
- it("hides agents but keeps empty groups for members", () => {
- const view = getFilterView("members");
- expect(view.showGroups).toBe(true);
- expect(view.showAgents).toBe(false);
- expect(view.includeEmptyGroups).toBe(true);
- });
-
- it("shows only agents for agents", () => {
- expect(getFilterView("agents")).toMatchObject({
- showGroups: false,
- showAgents: true,
- });
- });
-
- it("drops empty groups for workflows", () => {
- expect(getFilterView("workflows").includeEmptyGroups).toBe(false);
- });
-
- it("keeps only scheduled rows for scheduled", () => {
- expect(getFilterView("scheduled")).toMatchObject({
- scheduledOnly: true,
- includeEmptyGroups: false,
- });
- });
-});
-
-describe("getVisibleGroups", () => {
- const withWorkflows = makeExpert({
- id: "a",
- workflows: [
- makeWorkflow({
- id: "s",
- graph_id: "graph-scheduled",
- schedule_id: "sched",
- schedule_cron: "40 7 * * *",
- }),
- makeWorkflow({ id: "u", graph_id: "graph-unscheduled" }),
- ],
- });
- const empty = makeExpert({ id: "b", workflows: [] });
- const schedules = [makeSchedule({})];
-
- it("keeps empty groups for all and members", () => {
- expect(
- getVisibleGroups([withWorkflows, empty], schedules, "all"),
- ).toHaveLength(2);
- expect(
- getVisibleGroups([withWorkflows, empty], schedules, "members"),
- ).toHaveLength(2);
- });
-
- it("drops empty groups for workflows", () => {
- const groups = getVisibleGroups(
- [withWorkflows, empty],
- schedules,
- "workflows",
- );
- expect(groups).toHaveLength(1);
- expect(groups[0].expert.id).toBe("a");
- });
-
- it("keeps only workflows with scheduler jobs for scheduled", () => {
- const groups = getVisibleGroups(
- [withWorkflows, empty],
- schedules,
- "scheduled",
- );
- expect(groups).toHaveLength(1);
- expect(groups[0].workflows.map((item) => item.workflow.id)).toEqual(["s"]);
- });
-
- it("returns no groups for agents", () => {
- expect(
- getVisibleGroups([withWorkflows, empty], schedules, "agents"),
- ).toHaveLength(0);
- });
-
- it("ignores a stale workflow schedule id when no scheduler job exists", () => {
- expect(getVisibleGroups([withWorkflows], [], "scheduled")).toEqual([]);
- });
-
- it("keeps every scheduler job for a workflow", () => {
- const groups = getVisibleGroups(
- [withWorkflows],
- [makeSchedule({ id: "one" }), makeSchedule({ id: "two" })],
- "scheduled",
- );
- expect(
- groups[0].workflows[0].schedules.map((schedule) => schedule.id),
- ).toEqual(["one", "two"]);
- });
-
- it("does not assign one graph schedule to multiple workflow snapshots", () => {
- const first = makeWorkflow({
- id: "first",
- graph_id: "shared-graph",
- schedule_id: "first-schedule",
- });
- const second = makeWorkflow({
- id: "second",
- graph_id: "shared-graph",
- schedule_id: null,
- });
- const expert = makeExpert({
- id: "a",
- workflows: [first, second],
- });
- const groups = getVisibleGroups(
- [expert],
- [makeSchedule({ id: "first-schedule", graph_id: "shared-graph" })],
- "all",
- );
-
- expect(groups[0].workflows[0].schedules).toHaveLength(1);
- expect(groups[0].workflows[1].schedules).toHaveLength(0);
- });
-
- it("leaves a manual graph schedule unassigned when snapshots are ambiguous", () => {
- const workflows = [
- makeWorkflow({ id: "first", graph_id: "shared-graph" }),
- makeWorkflow({ id: "second", graph_id: "shared-graph" }),
- ];
- const schedule = makeSchedule({ id: "manual", graph_id: "shared-graph" });
-
- const graphWorkflowCounts = getGraphWorkflowCounts(workflows);
- expect(
- getWorkflowSchedules(workflows[0], [schedule], graphWorkflowCounts),
- ).toEqual([]);
- expect(
- getWorkflowSchedules(workflows[1], [schedule], graphWorkflowCounts),
- ).toEqual([]);
- });
-});
-
-describe("getUnadoptedAgents", () => {
- it("excludes an agent every expert already installed", () => {
- const experts = [
- makeExpert({
- id: "a",
- workflows: [makeWorkflow({ library_agent_id: "installed" })],
- }),
- ];
- const agents = [makeAgent({ id: "installed" }), makeAgent({ id: "free" })];
-
- expect(getUnadoptedAgents(agents, experts).map((a) => a.id)).toEqual([
- "free",
- ]);
- });
-
- it("keeps an unpublished agent adoptable", () => {
- const agent = makeAgent({ id: "never-published" });
-
- expect(
- getUnadoptedAgents([agent], [makeExpert({ workflows: [] })]),
- ).toEqual([agent]);
- });
-
- it("keeps an agent visible while another expert can adopt it", () => {
- const installed = makeExpert({
- id: "installed",
- workflows: [makeWorkflow({ library_agent_id: "shared" })],
- });
- const available = makeExpert({ id: "available", workflows: [] });
- const agent = makeAgent({ id: "shared" });
-
- expect(getUnadoptedAgents([agent], [installed, available])).toEqual([
- agent,
- ]);
- expect(getAdoptableExperts(agent, [installed, available])).toEqual([
- available,
- ]);
-
- const optimistic = new Set([getAdoptTargetKey(agent, available)]);
- expect(
- getUnadoptedAgents([agent], [installed, available], optimistic),
- ).toEqual([]);
- });
-
- it("counts a marketplace install of the same agent as adopted", () => {
- const expert = makeExpert({
- workflows: [
- makeWorkflow({
- library_agent_id: "shared",
- store_listing_version_id: "slv-1",
- }),
- ],
- });
-
- expect(getUnadoptedAgents([makeAgent({ id: "shared" })], [expert])).toEqual(
- [],
- );
- });
-});
-
-describe("pruneAdoptedTargetKeys", () => {
- it("removes confirmed and fired-expert targets before the set grows", () => {
- const pending = makeExpert({ id: "pending", workflows: [] });
- const confirmed = makeExpert({
- id: "confirmed",
- workflows: [makeWorkflow({ library_agent_id: "agent" })],
- });
- const fired = makeExpert({ id: "fired", workflows: [] });
- const agent = makeAgent({ id: "agent" });
- const keys = new Set([
- getAdoptTargetKey(agent, pending),
- getAdoptTargetKey(agent, confirmed),
- getAdoptTargetKey(agent, fired),
- ]);
-
- expect(pruneAdoptedTargetKeys(keys, [agent], [pending, confirmed])).toEqual(
- new Set([getAdoptTargetKey(agent, pending)]),
- );
- });
-
- it("preserves the set identity when no targets can be pruned", () => {
- const expert = makeExpert({ workflows: [] });
- const agent = makeAgent({ id: "agent" });
- const keys = new Set([getAdoptTargetKey(agent, expert)]);
-
- expect(pruneAdoptedTargetKeys(keys, [agent], [expert])).toBe(keys);
- });
-});
-
-describe("workflow schedule helpers", () => {
- it("marks cron without a schedule id as needing setup", () => {
- expect(
- workflowNeedsSetup(makeWorkflow({ schedule_cron: "40 7 * * *" })),
- ).toBe(true);
- expect(
- workflowNeedsSetup(
- makeWorkflow({ schedule_cron: "40 7 * * *", schedule_id: "x" }),
- ),
- ).toBe(false);
- });
-
- it("uses scheduler jobs instead of a stale schedule id when supplied", () => {
- const workflow = makeWorkflow({
- graph_id: "graph-scheduled",
- schedule_cron: "40 7 * * *",
- schedule_id: "stale",
- });
- expect(workflowNeedsSetup(workflow, [])).toBe(true);
- expect(
- workflowNeedsSetup(
- workflow,
- getWorkflowSchedules(
- workflow,
- [makeSchedule({ id: "active" })],
- getGraphWorkflowCounts([workflow]),
- ),
- ),
- ).toBe(false);
- });
-});
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/helpers.ts
deleted file mode 100644
index 1c4780996c..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/helpers.ts
+++ /dev/null
@@ -1,177 +0,0 @@
-import { Expert } from "@/app/api/__generated__/models/expert";
-import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
-import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
-import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
-import {
- getExpertSchedules,
- getGraphWorkflowCounts,
- getWorkflowSchedules,
-} from "../../helpers";
-
-export type WhatRunsFilter =
- | "all"
- | "members"
- | "agents"
- | "workflows"
- | "scheduled";
-
-export const WHAT_RUNS_FILTERS: { id: WhatRunsFilter; label: string }[] = [
- { id: "all", label: "All" },
- { id: "members", label: "Members" },
- { id: "agents", label: "Unassigned" },
- { id: "workflows", label: "Workflows" },
- { id: "scheduled", label: "Scheduled" },
-];
-
-interface FilterView {
- showGroups: boolean;
- showAgents: boolean;
- includeEmptyGroups: boolean;
- scheduledOnly: boolean;
-}
-
-export function getFilterView(filter: WhatRunsFilter): FilterView {
- switch (filter) {
- case "members":
- return {
- showGroups: true,
- showAgents: false,
- includeEmptyGroups: true,
- scheduledOnly: false,
- };
- case "agents":
- return {
- showGroups: false,
- showAgents: true,
- includeEmptyGroups: false,
- scheduledOnly: false,
- };
- case "workflows":
- return {
- showGroups: true,
- showAgents: false,
- includeEmptyGroups: false,
- scheduledOnly: false,
- };
- case "scheduled":
- return {
- showGroups: true,
- showAgents: false,
- includeEmptyGroups: false,
- scheduledOnly: true,
- };
- case "all":
- default:
- return {
- showGroups: true,
- showAgents: true,
- includeEmptyGroups: true,
- scheduledOnly: false,
- };
- }
-}
-
-export interface ExpertWorkflowGroupData {
- expert: Expert;
- workflows: {
- workflow: ExpertWorkflowRef;
- schedules: GraphExecutionJobInfo[];
- }[];
-}
-
-export function getVisibleGroups(
- experts: Expert[],
- schedules: GraphExecutionJobInfo[],
- filter: WhatRunsFilter,
-): ExpertWorkflowGroupData[] {
- const view = getFilterView(filter);
- if (!view.showGroups) return [];
- const groups: ExpertWorkflowGroupData[] = [];
- for (const expert of experts) {
- const expertSchedules = getExpertSchedules(expert, schedules);
- const graphWorkflowCounts = getGraphWorkflowCounts(expert.workflows);
- const workflows = expert.workflows.map((workflow) => ({
- workflow,
- schedules: getWorkflowSchedules(
- workflow,
- expertSchedules,
- graphWorkflowCounts,
- ),
- }));
- const visibleWorkflows = view.scheduledOnly
- ? workflows.filter((item) => item.schedules.length > 0)
- : workflows;
- if (view.includeEmptyGroups || visibleWorkflows.length > 0) {
- groups.push({ expert, workflows: visibleWorkflows });
- }
- }
- return groups;
-}
-
-/** Keep agents that still have at least one eligible expert target. */
-export function getUnadoptedAgents(
- agents: LibraryAgent[],
- experts: Expert[],
- adoptedTargetKeys?: ReadonlySet<string>,
-): LibraryAgent[] {
- return agents.filter(
- (agent) =>
- getAdoptableExperts(agent, experts, adoptedTargetKeys).length > 0,
- );
-}
-
-export function getAdoptableExperts(
- agent: LibraryAgent,
- experts: Expert[],
- adoptedTargetKeys?: ReadonlySet<string>,
-): Expert[] {
- return experts.filter(
- (expert) =>
- !isAdopted(agent, expert) &&
- !adoptedTargetKeys?.has(getAdoptTargetKey(agent, expert)),
- );
-}
-
-export function getAdoptTargetKey(agent: LibraryAgent, expert: Expert) {
- return `${agent.id}:${expert.id}`;
-}
-
-function parseAdoptTargetKey(key: string) {
- const separator = key.lastIndexOf(":");
- if (separator < 1 || separator === key.length - 1) return null;
- return {
- agentID: key.slice(0, separator),
- expertID: key.slice(separator + 1),
- };
-}
-
-export function pruneAdoptedTargetKeys(
- adoptedTargetKeys: Set<string>,
- agents: LibraryAgent[],
- experts: Expert[],
-) {
- if (adoptedTargetKeys.size === 0) return adoptedTargetKeys;
-
- const agentsByID = new Map(agents.map((agent) => [agent.id, agent]));
- const expertsByID = new Map(experts.map((expert) => [expert.id, expert]));
- const next = new Set<string>();
- for (const key of adoptedTargetKeys) {
- const target = parseAdoptTargetKey(key);
- if (!target) continue;
- const agent = agentsByID.get(target.agentID);
- const expert = expertsByID.get(target.expertID);
- if (!agent || !expert) continue;
- if (!isAdopted(agent, expert)) next.add(key);
- }
-
- return next.size === adoptedTargetKeys.size ? adoptedTargetKeys : next;
-}
-
-/** An expert installs a library agent by id, so the same agent stays
- * adoptable on other experts and a marketplace install of it counts too —
- * that path records the same library_agent_id. */
-function isAdopted(agent: LibraryAgent, expert: Expert) {
- return expert.workflows.some(
- (workflow) => workflow.library_agent_id === agent.id,
- );
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/useWhatRunsZone.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/useWhatRunsZone.ts
deleted file mode 100644
index 30c887d339..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/useWhatRunsZone.ts
+++ /dev/null
@@ -1,126 +0,0 @@
-import {
- getListExpertsQueryKey,
- useInstallExpertWorkflow,
-} from "@/app/api/__generated__/endpoints/experts/experts";
-import { useGetV2ListLibraryAgentsInfinite } from "@/app/api/__generated__/endpoints/library/library";
-import { Expert } from "@/app/api/__generated__/models/expert";
-import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
-import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
-import { getPaginationNextPageNumber, unpaginate } from "@/app/api/helpers";
-import { toast } from "@/components/molecules/Toast/use-toast";
-import { useQueryClient } from "@tanstack/react-query";
-import { useState } from "react";
-import {
- getAdoptTargetKey,
- getUnadoptedAgents,
- getVisibleGroups,
- pruneAdoptedTargetKeys,
- WhatRunsFilter,
-} from "./helpers";
-
-const AGENTS_PAGE_SIZE = 100;
-
-function hasStatus(error: unknown, status: number) {
- return (
- typeof error === "object" &&
- error !== null &&
- "status" in error &&
- error.status === status
- );
-}
-
-interface Args {
- experts: Expert[];
- schedules: GraphExecutionJobInfo[];
- enabled: boolean;
-}
-
-export function useWhatRunsZone({ experts, schedules, enabled }: Args) {
- const queryClient = useQueryClient();
- const [filter, setFilter] = useState<WhatRunsFilter>("all");
- const [pendingLibraryAgentIDs, setPendingLibraryAgentIDs] = useState<
- Set<string>
- >(new Set());
- const [adoptedTargetKeys, setAdoptedTargetKeys] = useState<Set<string>>(
- new Set(),
- );
-
- const agentsQuery = useGetV2ListLibraryAgentsInfinite(
- { page: 1, page_size: AGENTS_PAGE_SIZE, is_hidden: false },
- {
- query: {
- enabled,
- getNextPageParam: getPaginationNextPageNumber,
- },
- },
- );
-
- const { mutateAsync: installWorkflow } = useInstallExpertWorkflow();
-
- const libraryAgents = agentsQuery.data
- ? unpaginate(agentsQuery.data, "agents")
- : [];
- const unadoptedAgents = getUnadoptedAgents(
- libraryAgents,
- experts,
- adoptedTargetKeys,
- );
- const groups = getVisibleGroups(experts, schedules, filter);
- const showAgents = filter === "all" || filter === "agents";
-
- async function adopt(agent: LibraryAgent, expert: Expert) {
- if (pendingLibraryAgentIDs.has(agent.id)) return;
- const targetKey = getAdoptTargetKey(agent, expert);
- setPendingLibraryAgentIDs((current) => new Set(current).add(agent.id));
- try {
- await installWorkflow({
- expertId: expert.id,
- data: { library_agent_id: agent.id },
- });
- setAdoptedTargetKeys((current) => {
- const next = new Set(
- pruneAdoptedTargetKeys(current, libraryAgents, experts),
- );
- next.add(targetKey);
- return next;
- });
- await queryClient.invalidateQueries({
- queryKey: getListExpertsQueryKey(),
- });
- toast({ title: `Installed on ${expert.name}`, variant: "success" });
- } catch (error) {
- toast({
- title: `Couldn't install on ${expert.name}`,
- description: hasStatus(error, 404)
- ? "This workflow is no longer available."
- : "Something went wrong. Please try again.",
- variant: "destructive",
- });
- } finally {
- setPendingLibraryAgentIDs((current) => {
- const next = new Set(current);
- next.delete(agent.id);
- return next;
- });
- }
- }
-
- return {
- filter,
- setFilter,
- groups,
- showAgents,
- unadoptedAgents,
- libraryAgentCount: libraryAgents.length,
- isLoadingAgents: enabled && agentsQuery.isLoading,
- isErrorAgents: agentsQuery.isError && !agentsQuery.data,
- hasMoreAgents: agentsQuery.hasNextPage === true,
- isLoadingMoreAgents: agentsQuery.isFetchingNextPage,
- isErrorLoadingMoreAgents: agentsQuery.isFetchNextPageError,
- retryAgents: () => void agentsQuery.refetch(),
- loadMoreAgents: () => void agentsQuery.fetchNextPage(),
- adopt,
- pendingLibraryAgentIDs,
- adoptedTargetKeys,
- };
-}
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 b83d3ca322..826704c54a 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/helpers.test.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/team/helpers.test.ts
@@ -1,7 +1,15 @@
import { Expert } from "@/app/api/__generated__/models/expert";
import { ExpertPod } from "@/app/api/__generated__/models/expertPod";
+import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
import { describe, expect, test } from "vitest";
-import { getAssignToastTitle, groupExpertsByPods } from "./helpers";
+import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
+import {
+ filterExpertSchedules,
+ filterExpertWorkflows,
+ getAssignToastTitle,
+ getExpertRosterStatus,
+ groupExpertsByPods,
+} from "./helpers";
function makeExpert(id: string, podId: string | null = null): Expert {
return {
@@ -90,3 +98,163 @@ describe("getAssignToastTitle", () => {
expect(getAssignToastTitle({ podId: null })).toBe("Removed from pod");
});
});
+
+describe("getExpertRosterStatus", () => {
+ test("reports active work before attention states", () => {
+ const expert = makeExpert("working");
+ expert.last_run_status = "RUNNING";
+ expert.schedules_paused_at = new Date("2026-09-03T10:00:00Z");
+
+ expect(getExpertRosterStatus(expert, 1)).toBe("working");
+ });
+
+ test.each(["FAILED", "TERMINATED", "REVIEW"])(
+ "reports %s as needing attention",
+ (lastRunStatus) => {
+ const expert = makeExpert("attention");
+ expert.last_run_status = lastRunStatus;
+
+ expect(getExpertRosterStatus(expert, 0)).toBe("needs-you");
+ },
+ );
+
+ test("reports paused and unconfigured experts as needing attention", () => {
+ 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");
+ });
+
+ 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");
+ });
+});
+
+describe("filterExpertWorkflows", () => {
+ const workflows: ExpertWorkflowRef[] = [
+ {
+ id: "wf-1",
+ store_listing_version_id: null,
+ library_agent_id: "lib-1",
+ graph_id: "graph-1",
+ name: "Content Calendar",
+ description: "Plans a week of posts",
+ schedule_cron: "40 7 * * *",
+ schedule_id: "sched-1",
+ },
+ {
+ id: "wf-2",
+ store_listing_version_id: null,
+ library_agent_id: "lib-2",
+ graph_id: "graph-2",
+ name: "SEO Audit",
+ description: null,
+ schedule_cron: "0 9 * * 1",
+ schedule_id: null,
+ },
+ {
+ id: "wf-3",
+ store_listing_version_id: null,
+ library_agent_id: "lib-3",
+ graph_id: "graph-3",
+ name: "Draft reply",
+ description: "Answers inbound posts",
+ schedule_cron: null,
+ schedule_id: null,
+ },
+ ];
+
+ test("matches the query against name and description", () => {
+ expect(
+ filterExpertWorkflows(workflows, "posts", "all").map((w) => w.id),
+ ).toEqual(["wf-1", "wf-3"]);
+ expect(
+ filterExpertWorkflows(workflows, " seo ", "all").map((w) => w.id),
+ ).toEqual(["wf-2"]);
+ });
+
+ test("splits scheduled, manual and needs-setup workflows", () => {
+ expect(
+ filterExpertWorkflows(workflows, "", "scheduled").map((w) => w.id),
+ ).toEqual(["wf-1"]);
+ expect(
+ filterExpertWorkflows(workflows, "", "needs-setup").map((w) => w.id),
+ ).toEqual(["wf-2"]);
+ expect(
+ filterExpertWorkflows(workflows, "", "manual").map((w) => w.id),
+ ).toEqual(["wf-3"]);
+ });
+
+ test("combines query and filter", () => {
+ expect(
+ filterExpertWorkflows(workflows, "posts", "manual").map((w) => w.id),
+ ).toEqual(["wf-3"]);
+ });
+});
+
+describe("filterExpertSchedules", () => {
+ const now = new Date("2026-09-04T00:00:00Z");
+ function schedule(
+ id: string,
+ name: string,
+ hoursAhead: number,
+ ): GraphExecutionJobInfo {
+ return {
+ id,
+ name,
+ agent_name: `${name} agent`,
+ user_id: "user-1",
+ graph_id: `graph-${id}`,
+ graph_version: 1,
+ cron: "0 9 * * *",
+ input_data: {},
+ next_run_time: new Date(
+ now.getTime() + hoursAhead * 3600_000,
+ ).toISOString(),
+ };
+ }
+ const schedules = [
+ schedule("s1", "Morning digest", 3),
+ schedule("s2", "Weekly report", 3 * 24),
+ schedule("s3", "Quarterly review", 30 * 24),
+ ];
+
+ test("matches the query against schedule and agent names", () => {
+ expect(
+ filterExpertSchedules(schedules, "weekly", "all", now).map((s) => s.id),
+ ).toEqual(["s2"]);
+ expect(filterExpertSchedules(schedules, "agent", "all", now)).toHaveLength(
+ 3,
+ );
+ });
+
+ test("buckets by next run time", () => {
+ expect(
+ filterExpertSchedules(schedules, "", "today", now).map((s) => s.id),
+ ).toEqual(["s1"]);
+ expect(
+ filterExpertSchedules(schedules, "", "week", now).map((s) => s.id),
+ ).toEqual(["s1", "s2"]);
+ expect(
+ filterExpertSchedules(schedules, "", "later", now).map((s) => s.id),
+ ).toEqual(["s3"]);
+ });
+
+ test("treats a missing next run time as later, never as due now", () => {
+ const paused = { ...schedule("s4", "Paused sync", 1), next_run_time: "" };
+ const all = [...schedules, paused];
+ expect(
+ filterExpertSchedules(all, "", "today", now).map((s) => s.id),
+ ).toEqual(["s1"]);
+ expect(
+ filterExpertSchedules(all, "", "week", now).map((s) => s.id),
+ ).toEqual(["s1", "s2"]);
+ expect(
+ filterExpertSchedules(all, "", "later", now).map((s) => s.id),
+ ).toEqual(["s3", "s4"]);
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts
index 732098ccd7..27f4962707 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts
@@ -2,20 +2,34 @@ import { Expert } from "@/app/api/__generated__/models/expert";
import { ExpertPod } from "@/app/api/__generated__/models/expertPod";
import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowRef";
import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";
+import { findColorOption } from "@/app/(platform)/raise/components/ColorStep/helpers";
import { formatDistanceToNow } from "date-fns";
/** Section headings sit outside the cards, so they need the cards' own content
* inset (1px border-box padding + p-4, matching AutopilotCard's p-5) to line
* up with the text inside them instead of with the card edge. */
-export const SECTION_INSET_CLASS = "px-5";
+export const SECTION_INSET_CLASS = "px-4";
+
+/** The Button atom is pill-shaped and tall by default; team actions match the
+ * home briefing's compact row buttons. */
+export const ACTION_BUTTON_CLASS = "h-7 min-w-0 !rounded-md px-2.5 text-xs";
+
+/** The `outline` variant's zinc-700 border is too heavy at this size, so team
+ * actions soften it while keeping the hover lift. */
+export const OUTLINE_ACTION_BUTTON_CLASS = `${ACTION_BUTTON_CLASS} !border-zinc-200 hover:!border-zinc-300`;
interface PodGroup {
pod: ExpertPod;
experts: Expert[];
}
+export const AUTOPILOT_ROLE = "Head of AI";
+
+export const AUTOPILOT_BLURB =
+ "Your built-in generalist. It answers questions, runs workflows, and delegates work across your hired experts.";
+
export const TEAM_GRID_CLASS =
- "grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3";
+ "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3";
/** Mirrors `CreatePodRequest.name`'s `max_length` on the backend. */
export const POD_NAME_MAX_LENGTH = 100;
@@ -71,11 +85,43 @@ export function getLastRunLabel(expert: Expert) {
return `Last run ${when}`;
}
+/** The line under an expert's name on their card: their tagline, falling back
+ * to the opening of their identity when they have none. */
+export function getExpertBlurb(expert: Expert) {
+ if (expert.tagline?.trim()) return expert.tagline;
+ const lines = expert.identity
+ .split("\n")
+ .map((line) => line.trim())
+ .filter(Boolean);
+ return lines.slice(0, 2).join(" ") || null;
+}
+
export function getWeeklySpend(expert: Expert) {
if (expert.weekly_budget == null || expert.weekly_budget <= 0) return null;
return { spent: expert.weekly_spend ?? 0, budget: expert.weekly_budget };
}
+export type ExpertRosterStatus = "idle" | "working" | "needs-you";
+
+export function getExpertRosterStatus(
+ expert: Expert,
+ needsSetupCount: number,
+): 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"
+ ) {
+ return "needs-you";
+ }
+ return "idle";
+}
+
export function getWorkflowSchedules(
workflow: ExpertWorkflowRef,
schedules: GraphExecutionJobInfo[],
@@ -142,18 +188,157 @@ export function getExpertSchedules(
.sort((a, b) => nextRunMs(a) - nextRunMs(b));
}
-export function getScheduleCountLabel(schedules: GraphExecutionJobInfo[]) {
- if (schedules.length === 0) return null;
- const count = `${schedules.length} ${schedules.length === 1 ? "schedule" : "schedules"}`;
- const next = schedules[0]?.next_run_time
- ? new Date(schedules[0].next_run_time)
- : null;
- if (!next || Number.isNaN(next.valueOf())) return count;
- return `${count} · next ${formatDistanceToNow(next, { addSuffix: true })}`;
-}
-
function nextRunMs(schedule: GraphExecutionJobInfo) {
if (!schedule.next_run_time) return Number.POSITIVE_INFINITY;
const t = new Date(schedule.next_run_time).valueOf();
return Number.isNaN(t) ? Number.POSITIVE_INFINITY : t;
}
+
+export type TeamFilter = "all" | "scheduled" | "needs-setup" | "paused";
+
+interface FilterExpertsArgs {
+ experts: Expert[];
+ query: string;
+ filter: TeamFilter;
+ schedulesForExpert: (expert: Expert) => GraphExecutionJobInfo[];
+}
+
+/** Narrows the roster by free-text (name or role) and by the toolbar's filter.
+ * Both are applied together, so an empty result can mean either. */
+export function filterExperts({
+ experts,
+ query,
+ filter,
+ schedulesForExpert,
+}: FilterExpertsArgs) {
+ const needle = query.trim().toLowerCase();
+ return experts.filter((expert) => {
+ const haystack = `${expert.name} ${expert.role}`.toLowerCase();
+ if (needle && !haystack.includes(needle)) return false;
+ if (filter === "scheduled") return schedulesForExpert(expert).length > 0;
+ if (filter === "needs-setup")
+ return getNeedsSetupCount(expert, schedulesForExpert(expert)) > 0;
+ if (filter === "paused") return Boolean(expert.schedules_paused_at);
+ return true;
+ });
+}
+
+/** Experts on the roster: hired (not marketplace templates) and not fired. */
+export function getHiredExperts(experts: Expert[]) {
+ return experts.filter((expert) => !expert.is_template && !expert.is_archived);
+}
+
+/** Every skill on the team, de-duplicated and alphabetised. */
+export function getTeamSkills(experts: Expert[]) {
+ return Array.from(new Set(experts.flatMap((expert) => expert.skills))).sort(
+ (a, b) => a.localeCompare(b),
+ );
+}
+
+/** Every expert's schedules as one list, soonest-firing first. A schedule
+ * reachable from two experts (shared graph) is listed once. */
+export function getTeamSchedules(
+ experts: Expert[],
+ schedules: GraphExecutionJobInfo[],
+) {
+ const byId = new Map(
+ experts
+ .flatMap((expert) => getExpertSchedules(expert, schedules))
+ .map((schedule) => [schedule.id, schedule]),
+ );
+ return Array.from(byId.values()).sort((a, b) => nextRunMs(a) - nextRunMs(b));
+}
+
+interface AutopilotSummaryArgs {
+ experts: Expert[];
+ schedulesForExpert: (expert: Expert) => GraphExecutionJobInfo[];
+}
+
+/** Autopilot works across the whole team, so its card counts the team's
+ * totals. Skills are de-duplicated — two experts who can both write copy is
+ * one skill on the team, not two. */
+export function getAutopilotSummary({
+ experts,
+ schedulesForExpert,
+}: AutopilotSummaryArgs) {
+ return {
+ skillCount: getTeamSkills(experts).length,
+ scheduleCount: new Set(
+ experts.flatMap(schedulesForExpert).map((schedule) => schedule.id),
+ ).size,
+ workflowCount: experts.reduce(
+ (total, expert) => total + expert.workflows.length,
+ 0,
+ ),
+ };
+}
+
+/** Covers live at `public/experts/covers/<color token>.jpg`, one per raise-flow
+ * accent, plus `default.jpg` for experts without a colour (marketplace
+ * templates). */
+export function getExpertCoverSrc(color: string | null | undefined) {
+ const token = findColorOption(color ?? null)?.id ?? "default";
+ return `/experts/covers/${token}.jpg`;
+}
+
+export const WORKFLOW_FILTERS = [
+ { value: "all", label: "All workflows" },
+ { value: "scheduled", label: "Scheduled" },
+ { value: "manual", label: "Manual" },
+ { value: "needs-setup", label: "Needs setup" },
+] as const;
+
+export type WorkflowFilter = (typeof WORKFLOW_FILTERS)[number]["value"];
+
+export function filterExpertWorkflows(
+ workflows: ExpertWorkflowRef[],
+ query: string,
+ filter: WorkflowFilter,
+) {
+ const needle = query.trim().toLowerCase();
+ return workflows.filter((workflow) => {
+ if (needle) {
+ const haystack =
+ `${workflow.name ?? ""} ${workflow.description ?? ""}`.toLowerCase();
+ if (!haystack.includes(needle)) return false;
+ }
+ if (filter === "all") return true;
+ if (filter === "needs-setup") return workflowNeedsSetup(workflow);
+ if (filter === "scheduled")
+ return Boolean(workflow.schedule_cron) && !workflowNeedsSetup(workflow);
+ return !workflow.schedule_cron;
+ });
+}
+
+export const SCHEDULE_FILTERS = [
+ { value: "all", label: "All schedules" },
+ { value: "today", label: "Next 24 hours" },
+ { value: "week", label: "Next 7 days" },
+ { value: "later", label: "Later" },
+] as const;
+
+export type ScheduleFilter = (typeof SCHEDULE_FILTERS)[number]["value"];
+
+const DAY_MS = 24 * 60 * 60 * 1000;
+
+export function filterExpertSchedules(
+ schedules: GraphExecutionJobInfo[],
+ query: string,
+ filter: ScheduleFilter,
+ now: Date = new Date(),
+) {
+ const needle = query.trim().toLowerCase();
+ return schedules.filter((schedule) => {
+ if (needle) {
+ const haystack =
+ `${schedule.name} ${schedule.agent_name ?? ""}`.toLowerCase();
+ if (!haystack.includes(needle)) return false;
+ }
+ if (filter === "all") return true;
+ const untilNext = nextRunMs(schedule) - now.getTime();
+ if (untilNext < 0) return false;
+ if (filter === "today") return untilNext <= DAY_MS;
+ if (filter === "week") return untilNext <= 7 * DAY_MS;
+ return untilNext > 7 * DAY_MS;
+ });
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/page.tsx b/autogpt_platform/frontend/src/app/(platform)/team/page.tsx
index 8d93014c56..4440004013 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/page.tsx
@@ -1,26 +1,38 @@
"use client";
import { Expert } from "@/app/api/__generated__/models/expert";
-import { AITeamIcon } from "@/components/atoms/AITeamIcon/AITeamIcon";
import { Text } from "@/components/atoms/Text/Text";
import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
import { InstallWorkflowPicker } from "@/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker";
+import {
+ TabsLine,
+ TabsLineContent,
+ TabsLineList,
+ TabsLineTrigger,
+} from "@/components/molecules/TabsLine/TabsLine";
import { cn } from "@/lib/utils";
import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";
+import { KanbanIcon, UserGroupIcon } from "@hugeicons/core-free-icons";
+import { Icon } from "@/components/atoms/Icon/Icon";
import { notFound } from "next/navigation";
-import { CreateMenu } from "./components/CreateMenu/CreateMenu";
import { EmptyTeamState } from "./components/EmptyTeamState";
import { ExpertTeamCard } from "./components/ExpertTeamCard/ExpertTeamCard";
import { ExpertTeamCardSkeleton } from "./components/ExpertTeamCardSkeleton";
import { NewPodDialog } from "./components/NewPodDialog/NewPodDialog";
+import { PodBoard } from "./components/PodBoard/PodBoard";
import { SoulDrawer } from "./components/SoulDrawer/SoulDrawer";
+import { TeamHeaderActions } from "./components/TeamHeaderActions";
import { TeamRoster } from "./components/TeamRoster/TeamRoster";
-import { WhatRunsZone } from "./components/WhatRunsZone/WhatRunsZone";
-import { SECTION_INSET_CLASS, TEAM_GRID_CLASS } from "./helpers";
+import { TEAM_GRID_CLASS } from "./helpers";
import { useTeamPage } from "./useTeamPage";
const MAIN_CLASS =
- "container min-h-screen space-y-6 pb-20 pt-8 sm:px-8 md:px-12";
+ "mx-auto min-h-screen w-full max-w-[1180px] space-y-5 pb-16 pt-6 duration-500 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: "pods", label: "Pod board", icon: KanbanIcon },
+] as const;
export default function TeamPage() {
const { enabled, ready } = useFlagStatus(Flag.HIRE_EXPERTS);
@@ -30,7 +42,6 @@ export default function TeamPage() {
podForExpert,
podGroups,
ungroupedExperts,
- schedules,
schedulesForExpert,
isLoading,
isError,
@@ -82,61 +93,85 @@ export default function TeamPage() {
}
return (
- <main className={MAIN_CLASS}>
- <div
- className={cn(
- "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",
- SECTION_INSET_CLASS,
- )}
- >
- <div className="flex flex-col gap-1">
- <div className="flex items-center gap-2.5">
- <AITeamIcon size={36} className="shrink-0 text-zinc-950" />
- <Text variant="h3">Your Team</Text>
+ <div className="flex w-full">
+ <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="h5">Team</Text>
+ </div>
+ <Text variant="body" className="max-w-prose text-zinc-600">
+ Autopilot and your hired experts, ready to work.
+ </Text>
</div>
- <Text variant="body" className="max-w-prose text-zinc-600">
- Autopilot and your hired experts, ready to work.
- </Text>
+ <TeamHeaderActions onNewPod={openNewPod} />
</div>
- <CreateMenu onNewPod={openNewPod} />
- </div>
- <TeamRoster
- isLoading={isLoading}
- podGroups={podGroups}
- ungroupedExperts={ungroupedExperts}
- renderCard={renderCard}
- />
- {!isLoading && !isError && hiredExperts.length > 0 ? (
- <WhatRunsZone experts={hiredExperts} schedules={schedules} />
- ) : null}
+ {isError ? (
+ <ErrorCard
+ context="your team"
+ hint="We could not load your hired experts."
+ onRetry={() => refetch()}
+ />
+ ) : null}
+
+ <TabsLine defaultValue="overview">
+ <TabsLineList
+ flush
+ className="overflow-x-auto border-b-transparent"
+ indicatorClassName="bg-zinc-900"
+ >
+ {TABS.map((tab) => (
+ <TabsLineTrigger
+ key={tab.value}
+ value={tab.value}
+ className="gap-1.5 px-2.5 py-2 text-xs leading-5 data-[state=active]:text-zinc-900"
+ >
+ <Icon icon={tab.icon} size={14} />
+ {tab.label}
+ </TabsLineTrigger>
+ ))}
+ </TabsLineList>
+
+ <TabsLineContent value="overview" className="space-y-6">
+ <TeamRoster
+ isLoading={isLoading}
+ experts={hiredExperts}
+ schedulesForExpert={schedulesForExpert}
+ renderCard={renderCard}
+ />
+
+ {!isLoading && !isError && hiredExperts.length === 0 ? (
+ <EmptyTeamState />
+ ) : null}
+ </TabsLineContent>
+
+ <TabsLineContent value="pods">
+ <PodBoard
+ isLoading={isLoading}
+ podGroups={podGroups}
+ ungroupedExperts={ungroupedExperts}
+ onNewPod={openNewPod}
+ />
+ </TabsLineContent>
+ </TabsLine>
- {isError ? (
- <ErrorCard
- context="your team"
- hint="We could not load your hired experts."
- onRetry={() => refetch()}
+ <InstallWorkflowPicker
+ mode="pick-workflow"
+ expertId={pickerExpertId ?? undefined}
+ open={pickerExpertId !== null}
+ onClose={closeWorkflowPicker}
/>
- ) : null}
- {!isLoading &&
- !isError &&
- hiredExperts.length === 0 &&
- podGroups.length === 0 ? (
- <EmptyTeamState />
- ) : null}
- <InstallWorkflowPicker
- mode="pick-workflow"
- expertId={pickerExpertId ?? undefined}
- open={pickerExpertId !== null}
- onClose={closeWorkflowPicker}
- />
+ <NewPodDialog
+ open={isNewPodOpen}
+ onClose={closeNewPod}
+ onCreate={createPod}
+ isCreating={isCreatingPod}
+ />
+ </main>
+
<SoulDrawer key={soulDrawerKey} expert={soulExpert} onClose={closeSoul} />
- <NewPodDialog
- open={isNewPodOpen}
- onClose={closeNewPod}
- onCreate={createPod}
- isCreating={isCreatingPod}
- />
- </main>
+ </div>
);
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.ts b/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.ts
index 44ada2b27a..70601c0a5a 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/team/useTeamPage.ts
@@ -17,6 +17,7 @@ import { useState } from "react";
import {
getAssignToastTitle,
getExpertSchedules,
+ getHiredExperts,
groupExpertsByPods,
} from "./helpers";
@@ -127,9 +128,7 @@ export function useTeamPage({ enabled }: Args) {
},
});
- const hiredExperts = (expertsQuery.data ?? []).filter(
- (expert) => !expert.is_template && !expert.is_archived,
- );
+ const hiredExperts = getHiredExperts(expertsQuery.data ?? []);
const schedules = schedulesQuery.data ?? [];
const { groups, ungrouped } = groupExpertsByPods(hiredExperts, pods);
diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.json
index 5f6854e668..2396ba9ebd 100644
--- a/autogpt_platform/frontend/src/app/api/openapi.json
+++ b/autogpt_platform/frontend/src/app/api/openapi.json
@@ -6407,6 +6407,91 @@
}
}
},
+ "/api/experts/{expert_id}/activity": {
+ "get": {
+ "tags": ["v2", "experts", "experts", "private"],
+ "summary": "Get Expert Activity",
+ "description": "Daily chat-session and run counts for the expert's activity graph.",
+ "operationId": "get_expert_activity",
+ "security": [{ "HTTPBearerJWT": [] }],
+ "parameters": [
+ {
+ "name": "expert_id",
+ "in": "path",
+ "required": true,
+ "schema": { "type": "string", "title": "Expert Id" }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ExpertActivity" }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ },
+ "404": { "description": "Expert not found" },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api/experts/{expert_id}/avatar": {
+ "patch": {
+ "tags": ["v2", "experts", "experts", "private"],
+ "summary": "Update Expert Avatar",
+ "operationId": "update_expert_avatar",
+ "security": [{ "HTTPBearerJWT": [] }],
+ "parameters": [
+ {
+ "name": "expert_id",
+ "in": "path",
+ "required": true,
+ "schema": { "type": "string", "title": "Expert Id" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ExpertAvatarUpdate" }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/Expert" }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ },
+ "404": { "description": "Expert not found" },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
+ }
+ }
+ }
+ }
+ }
+ },
"/api/experts/{expert_id}/credentials": {
"get": {
"tags": ["v2", "experts", "experts", "private"],
@@ -6722,6 +6807,52 @@
}
}
},
+ "/api/experts/{expert_id}/skills": {
+ "put": {
+ "tags": ["v2", "experts", "experts", "private"],
+ "summary": "Update Expert Skills",
+ "operationId": "update_expert_skills",
+ "security": [{ "HTTPBearerJWT": [] }],
+ "parameters": [
+ {
+ "name": "expert_id",
+ "in": "path",
+ "required": true,
+ "schema": { "type": "string", "title": "Expert Id" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ExpertSkillsUpdate" }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/Expert" }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ },
+ "404": { "description": "Expert or skill not found" },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
+ }
+ }
+ }
+ }
+ }
+ },
"/api/experts/{expert_id}/soul": {
"patch": {
"tags": ["v2", "experts", "experts", "private"],
@@ -6816,6 +6947,46 @@
}
}
},
+ "/api/experts/{expert_id}/workflows/{workflow_id}": {
+ "delete": {
+ "tags": ["v2", "experts", "experts", "private"],
+ "summary": "Remove Expert Workflow",
+ "operationId": "remove_expert_workflow",
+ "security": [{ "HTTPBearerJWT": [] }],
+ "parameters": [
+ {
+ "name": "expert_id",
+ "in": "path",
+ "required": true,
+ "schema": { "type": "string", "title": "Expert Id" }
+ },
+ {
+ "name": "workflow_id",
+ "in": "path",
+ "required": true,
+ "schema": { "type": "string", "title": "Workflow Id" }
+ }
+ ],
+ "responses": {
+ "204": { "description": "Successful Response" },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ },
+ "404": { "description": "Expert or workflow not found" },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
+ }
+ }
+ },
+ "503": {
+ "description": "Workflow schedule cleanup temporarily unavailable"
+ }
+ }
+ }
+ },
"/api/files/upload": {
"post": {
"tags": ["v1", "files"],
@@ -19519,6 +19690,11 @@
"type": "array",
"title": "Workflows"
},
+ "credential_count": {
+ "type": "integer",
+ "title": "Credential Count",
+ "default": 0
+ },
"last_run_at": {
"anyOf": [
{ "type": "string", "format": "date-time" },
@@ -19571,6 +19747,45 @@
],
"title": "Expert"
},
+ "ExpertActivity": {
+ "properties": {
+ "timezone": { "type": "string", "title": "Timezone" },
+ "days": {
+ "items": { "$ref": "#/components/schemas/ExpertActivityDay" },
+ "type": "array",
+ "title": "Days"
+ }
+ },
+ "type": "object",
+ "required": ["timezone", "days"],
+ "title": "ExpertActivity",
+ "description": "Daily chat-session and run counts behind the at-a-glance activity graph.\n\n``days`` is zero-filled, oldest first, and ends on the owner's today."
+ },
+ "ExpertActivityDay": {
+ "properties": {
+ "day": { "type": "string", "format": "date", "title": "Day" },
+ "sessions": { "type": "integer", "title": "Sessions" },
+ "runs": { "type": "integer", "title": "Runs" }
+ },
+ "type": "object",
+ "required": ["day", "sessions", "runs"],
+ "title": "ExpertActivityDay",
+ "description": "One calendar day, in the owner's timezone, of expert activity."
+ },
+ "ExpertAvatarUpdate": {
+ "properties": {
+ "avatar_url": {
+ "anyOf": [
+ { "type": "string", "maxLength": 2000 },
+ { "type": "null" }
+ ],
+ "title": "Avatar Url"
+ }
+ },
+ "type": "object",
+ "title": "ExpertAvatarUpdate",
+ "description": "Swap an expert's picture. ``None`` clears it back to the generated marble."
+ },
"ExpertCredentialRef": {
"properties": {
"credential_id": { "type": "string", "title": "Credential Id" },
@@ -19699,6 +19914,26 @@
"title": "ExpertRun",
"description": "One expert-attributed execution, for the /team Work surface."
},
+ "ExpertSkillsUpdate": {
+ "properties": {
+ "skills": {
+ "items": { "type": "string" },
+ "type": "array",
+ "maxItems": 50,
+ "title": "Skills"
+ },
+ "marketplace_listing_ids": {
+ "items": { "type": "string" },
+ "type": "array",
+ "maxItems": 20,
+ "title": "Marketplace Listing Ids"
+ }
+ },
+ "type": "object",
+ "required": ["skills"],
+ "title": "ExpertSkillsUpdate",
+ "description": "The full list of skill names an expert should carry. Names new to the\nexpert must be library skills (default or uploaded); names already on\nthe expert are kept as-is so marketplace skills survive a round-trip."
+ },
"ExpertSoulUpdate": {
"properties": {
"name": {
@@ -19759,6 +19994,32 @@
"title": "ExpertSoulUpdatedResponse",
"description": "Response for the two-step Soul edit tools.\n\nCarries the diff so the model must surface exactly what changed. ``applied``\nis False for the update_expert_soul preview (nothing written yet; the\none-time ``confirmation_id`` references the stored proposal) and True once\nconfirm_expert_soul_update saves the edit."
},
+ "ExpertWorkflowChainItem": {
+ "properties": {
+ "kind": {
+ "type": "string",
+ "enum": [
+ "integration",
+ "input",
+ "output",
+ "trigger",
+ "agent",
+ "ai",
+ "mcp",
+ "human"
+ ],
+ "title": "Kind"
+ },
+ "provider": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Provider"
+ }
+ },
+ "type": "object",
+ "required": ["kind"],
+ "title": "ExpertWorkflowChainItem",
+ "description": "One step in the workflow card's summary chain: a provider logo for\nintegration blocks, or a kind the frontend maps to an icon."
+ },
"ExpertWorkflowRef": {
"properties": {
"id": { "type": "string", "title": "Id" },
@@ -19789,6 +20050,11 @@
"schedule_id": {
"anyOf": [{ "type": "string" }, { "type": "null" }],
"title": "Schedule Id"
+ },
+ "chain": {
+ "items": { "$ref": "#/components/schemas/ExpertWorkflowChainItem" },
+ "type": "array",
+ "title": "Chain"
}
},
"type": "object",
diff --git a/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx b/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx
index 1a401332b7..efc89187f4 100644
--- a/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx
+++ b/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx
@@ -165,18 +165,25 @@ export function AvatarImage({
export type AvatarFallbackProps = React.HTMLAttributes<HTMLSpanElement> & {
size?: number;
+ /**
+ * Fills the whole box instead of drawing a circle inside it, so a wrapper
+ * with a smaller radius can clip the marble to a rounded square.
+ */
+ square?: boolean;
};
export function AvatarFallback({
className,
children,
size: _size, // accepted for API compatibility; currently not used
+ square = false,
...props
}: AvatarFallbackProps): JSX.Element | null {
const { isLoaded, hasImage } = useAvatarContext();
const show = !isLoaded || !hasImage;
if (!show) return null;
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
const name =
typeof children === "string" && children.trim() ? children.trim() : "User";
@@ -188,18 +195,23 @@ export function AvatarFallback({
className={cn(
// absolute so the fallback overlays (not flows beside) the image while it loads;
// svg stretched to fill so the marble always matches the avatar size
- "absolute inset-0 flex items-center justify-center rounded-full bg-transparent text-lg text-neutral-600 [&>svg]:h-full [&>svg]:w-full",
+ "absolute inset-0 flex items-center justify-center rounded-full bg-transparent text-lg text-neutral-600",
+ !hasCustomFallback && "[&>svg]:h-full [&>svg]:w-full",
className,
)}
{...props}
>
- <BoringAvatar
- size={computedSize}
- name={name}
- variant="marble"
- colors={["#92A1C6", "#146A7C", "#F0AB3D", "#C271B4", "#C20D90"]}
- square={false}
- />
+ {hasCustomFallback ? (
+ children
+ ) : (
+ <BoringAvatar
+ size={computedSize}
+ name={name}
+ variant="marble"
+ colors={["#92A1C6", "#146A7C", "#F0AB3D", "#C271B4", "#C20D90"]}
+ square={square}
+ />
+ )}
</span>
);
}
diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/ConnectMethodView/ConnectMethodView.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/ConnectMethodView/ConnectMethodView.tsx
index b3feca7a2b..86ae9918ec 100644
--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/ConnectMethodView/ConnectMethodView.tsx
+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/ConnectMethodView/ConnectMethodView.tsx
@@ -1,5 +1,6 @@
"use client";
+import type { CredentialsMetaResponse } from "@/app/api/__generated__/models/credentialsMetaResponse";
import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";
import { Icon } from "@/components/atoms/Icon/Icon";
import { Text } from "@/components/atoms/Text/Text";
@@ -30,7 +31,7 @@ interface Props {
onSelectMethod: (method: AuthMethod) => void;
apiKeyForm: UseFormReturn<ApiKeyConnectFormValues>;
onApiKeySubmit: (values: ApiKeyConnectFormValues) => void;
- onDeviceAuthSuccess: () => void;
+ onDeviceAuthSuccess: (credential?: CredentialsMetaResponse) => void;
}
export const METHOD_ORDER: AuthMethod[] = [
diff --git a/autogpt_platform/frontend/src/components/contextual/SchedulesPanel/components/GraphScheduleListItem/GraphScheduleListItem.tsx b/autogpt_platform/frontend/src/components/contextual/SchedulesPanel/components/GraphScheduleListItem/GraphScheduleListItem.tsx
index e926ff9665..ebff862a1e 100644
--- a/autogpt_platform/frontend/src/components/contextual/SchedulesPanel/components/GraphScheduleListItem/GraphScheduleListItem.tsx
+++ b/autogpt_platform/frontend/src/components/contextual/SchedulesPanel/components/GraphScheduleListItem/GraphScheduleListItem.tsx
@@ -24,12 +24,18 @@ interface Props {
/** Layout overrides for narrow containers (e.g. drawers) where the
* side-by-side sm layout would crush the text column. */
className?: string;
+ /** Tint override for the leading icon tile, e.g. an expert's accent. */
+ iconClassName?: string;
+ /** Size override for the View/Delete buttons, e.g. compact row actions. */
+ actionClassName?: string;
}
export function GraphScheduleListItem({
schedule,
editAction,
className,
+ iconClassName,
+ actionClassName,
}: Props) {
const {
nextRunLabel,
@@ -51,7 +57,7 @@ export function GraphScheduleListItem({
return (
<div
className={cn(
- "flex w-full flex-col gap-3 rounded-large border border-zinc-200 bg-white p-4 sm:flex-row sm:items-center sm:justify-between",
+ "flex w-full flex-col gap-3 rounded-lg border border-zinc-200 bg-white p-3 sm:flex-row sm:items-center sm:justify-between",
className,
)}
data-testid="schedule-row"
@@ -63,8 +69,17 @@ export function GraphScheduleListItem({
className="flex min-w-0 flex-1 items-start gap-3 hover:opacity-80"
data-testid="schedule-open-agent"
>
- <div className="flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-large border border-slate-50 bg-emerald-50">
- <Icon icon={Calendar03Icon} size={18} className="text-emerald-700" />
+ <div
+ className={cn(
+ "flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-md border border-slate-50 bg-emerald-50",
+ iconClassName,
+ )}
+ >
+ <Icon
+ icon={Calendar03Icon}
+ size={18}
+ className={iconClassName ? "text-inherit" : "text-emerald-700"}
+ />
</div>
<div className="flex min-w-0 flex-col gap-1">
<Text
@@ -87,7 +102,7 @@ export function GraphScheduleListItem({
</Text>
<span className="text-zinc-300">•</span>
<span
- className="rounded-full bg-emerald-100 px-2 py-0.5 text-xs text-emerald-700"
+ className="rounded-md bg-emerald-100 px-2 py-0.5 text-xs text-emerald-700"
data-testid="schedule-kind-badge"
>
Agent run
@@ -102,6 +117,7 @@ export function GraphScheduleListItem({
variant="secondary"
size="small"
onClick={openView}
+ className={actionClassName}
data-testid="schedule-view-button"
aria-label="View schedule"
>
@@ -112,6 +128,7 @@ export function GraphScheduleListItem({
variant="secondary"
size="small"
onClick={openDelete}
+ className={actionClassName}
data-testid="schedule-delete-button"
aria-label="Delete schedule"
>
diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/expert-groups.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/expert-groups.test.tsx
index f9f0f0aaca..67ff6dd192 100644
--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/expert-groups.test.tsx
+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/__tests__/expert-groups.test.tsx
@@ -188,9 +188,12 @@ describe("RecentChats — expert groups", () => {
);
renderRecentChats();
+ const expertGroup = await screen.findByRole("button", {
+ name: "Expert chats",
+ });
expect(
- await screen.findByRole("button", { name: "Expert chats" }),
- ).toBeDefined();
+ expertGroup.querySelector('svg[aria-label="AutoGPT Logo"]'),
+ ).not.toBe(null);
expect(await screen.findByText("expert-ghost chat 1")).toBeDefined();
});
diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/ExpertChatGroup/ExpertChatGroup.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/ExpertChatGroup/ExpertChatGroup.tsx
index 6ae31ed25f..4e3a30f31f 100644
--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/ExpertChatGroup/ExpertChatGroup.tsx
+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/RecentChats/components/ExpertChatGroup/ExpertChatGroup.tsx
@@ -6,6 +6,7 @@ import {
AvatarFallback,
AvatarImage,
} from "@/components/atoms/Avatar/Avatar";
+import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";
import { Icon } from "@/components/atoms/Icon/Icon";
import {
Collapsible,
@@ -31,9 +32,6 @@ export function ExpertChatGroup({
sessions,
renderItem,
}: Props) {
- // Open on mount: the sidebar's job is to show the chats, so a group that
- // hides them behind a click on every render is a step backwards. Controlled
- // rather than `defaultOpen` because the collapsed branch below reads it.
const [isOpen, setIsOpen] = useState(true);
const [visibleCount, setVisibleCount] = useState(EXPERT_GROUP_PREVIEW_COUNT);
const visibleSessions = sessions.slice(0, visibleCount);
@@ -48,23 +46,23 @@ export function ExpertChatGroup({
>
<CollapsibleTrigger
aria-label={`${label} chats`}
- className="mb-1 flex w-full items-center gap-2 rounded-md px-2 py-0.5 text-left text-[13px] font-medium text-zinc-900 hover:bg-zinc-100"
+ className="mb-1 flex w-full items-center gap-2 rounded-md px-2 py-0.5 text-left text-sm font-medium text-zinc-900 hover:bg-zinc-100"
>
- <Avatar className="h-5 w-5">
- {avatarUrl ? <AvatarImage src={avatarUrl} alt={label} /> : null}
- <AvatarFallback className="text-[9px]">
- {label.charAt(0).toUpperCase()}
+ <Avatar className="h-6 w-6">
+ {avatarUrl ? (
+ <AvatarImage src={avatarUrl} alt={label} width={48} height={48} />
+ ) : null}
+ <AvatarFallback>
+ <AutoGPTLogo hideText viewBox="47 -1 42 42" className="size-4" />
</AvatarFallback>
</Avatar>
<span className="truncate">{label}</span>
<Icon
icon={ArrowDown01Icon}
- className="ease-[cubic-bezier(0.33,1,0.68,1)] ml-auto size-4 shrink-0 text-zinc-400 transition-transform duration-200 group-data-[state=open]/expert-group:rotate-180 motion-reduce:transition-none"
+ className="ease-[cubic-bezier(0.33,1,0.68,1)] ml-auto size-5 shrink-0 text-zinc-400 transition-transform duration-200 group-data-[state=open]/expert-group:rotate-180 motion-reduce:transition-none"
/>
</CollapsibleTrigger>
- {/* Running chats stay visible while the group is collapsed so an
- in-flight session is never hidden behind a closed toggle. */}
{!isOpen && runningSessions.length > 0 && (
<GroupBody>
<SidebarMenu>{runningSessions.map(renderItem)}</SidebarMenu>
@@ -93,8 +91,6 @@ export function ExpertChatGroup({
}
function GroupBody({ children }: { children: ReactNode }) {
- // A hard border reads heavier than the rail deserves — a 1px gradient
- // strip fades out toward the bottom instead.
return (
<div className="relative ml-[17px] pl-1.5 before:absolute before:inset-y-0 before:left-0 before:w-px before:bg-gradient-to-b before:from-zinc-200/70 before:to-transparent">
{children}
diff --git a/autogpt_platform/frontend/src/components/molecules/Dialog/Dialog.tsx b/autogpt_platform/frontend/src/components/molecules/Dialog/Dialog.tsx
index 725edecb3a..d14b572ed7 100644
--- a/autogpt_platform/frontend/src/components/molecules/Dialog/Dialog.tsx
+++ b/autogpt_platform/frontend/src/components/molecules/Dialog/Dialog.tsx
@@ -12,6 +12,7 @@ import { useDialogInternal } from "./useDialogInternal";
interface Props extends PropsWithChildren {
title?: React.ReactNode;
styling?: CSSProperties;
+ className?: string;
forceOpen?: boolean;
onClose?: (() => void) | undefined;
@@ -29,6 +30,7 @@ function Dialog({
children,
title,
styling,
+ className,
forceOpen = false,
onClose,
@@ -42,6 +44,7 @@ function Dialog({
value={{
title: title || "",
styling,
+ className,
isOpen,
isForceOpen: forceOpen,
diff --git a/autogpt_platform/frontend/src/components/molecules/Dialog/components/DialogWrap.tsx b/autogpt_platform/frontend/src/components/molecules/Dialog/components/DialogWrap.tsx
index bbae32192d..8c56657715 100644
--- a/autogpt_platform/frontend/src/components/molecules/Dialog/components/DialogWrap.tsx
+++ b/autogpt_platform/frontend/src/components/molecules/Dialog/components/DialogWrap.tsx
@@ -35,6 +35,7 @@ export function DialogWrap({
children,
title,
styling = {},
+ className,
isForceOpen,
handleClose,
}: Props) {
@@ -97,7 +98,7 @@ export function DialogWrap({
onFocusOutside={handleFocusOutside}
onEscapeKeyDown={isForceOpen ? undefined : handleClose}
aria-describedby={undefined}
- className={modalStyles.content}
+ className={cn(modalStyles.content, className)}
style={{
...styling,
}}
@@ -134,11 +135,10 @@ export function DialogWrap({
className={cn(
"flex-1 overflow-y-auto overflow-x-hidden px-2",
scrollbarStyles,
+ hasVerticalScrollbar
+ ? "-mr-6 [scrollbar-gutter:stable]"
+ : "mr-0 [scrollbar-gutter:auto]",
)}
- style={{
- scrollbarGutter: "stable",
- marginRight: hasVerticalScrollbar ? "-24px" : "0px",
- }}
>
{children}
</div>
diff --git a/autogpt_platform/frontend/src/components/molecules/Dialog/components/DrawerWrap.tsx b/autogpt_platform/frontend/src/components/molecules/Dialog/components/DrawerWrap.tsx
index 4714981edb..83624adc6d 100644
--- a/autogpt_platform/frontend/src/components/molecules/Dialog/components/DrawerWrap.tsx
+++ b/autogpt_platform/frontend/src/components/molecules/Dialog/components/DrawerWrap.tsx
@@ -22,6 +22,7 @@ export function DrawerWrap({
testId,
handleClose,
isForceOpen,
+ className,
}: Props) {
const accessibleTitle = title || "Dialog";
const hasVisibleTitle = Boolean(title);
@@ -42,7 +43,7 @@ export function DrawerWrap({
<Drawer.Overlay className={drawerStyles.overlay} />
<Drawer.Content
aria-describedby={undefined}
- className={drawerStyles.content}
+ className={cn(drawerStyles.content, className)}
data-testid={testId}
onInteractOutside={handleClose}
>
diff --git a/autogpt_platform/frontend/src/components/molecules/Dialog/useDialogCtx.ts b/autogpt_platform/frontend/src/components/molecules/Dialog/useDialogCtx.ts
index 6d0051d7a4..9cd5273514 100644
--- a/autogpt_platform/frontend/src/components/molecules/Dialog/useDialogCtx.ts
+++ b/autogpt_platform/frontend/src/components/molecules/Dialog/useDialogCtx.ts
@@ -14,6 +14,7 @@ export interface DialogCtx {
isForceOpen: boolean;
isLargeScreen: boolean;
styling: CSSProperties | undefined;
+ className?: string;
}
export const DialogCtx = createContext<DialogCtx>({
diff --git a/autogpt_platform/frontend/src/components/molecules/FullscreenDialog/FullscreenDialog.tsx b/autogpt_platform/frontend/src/components/molecules/FullscreenDialog/FullscreenDialog.tsx
new file mode 100644
index 0000000000..b732b9cd44
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/molecules/FullscreenDialog/FullscreenDialog.tsx
@@ -0,0 +1,43 @@
+"use client";
+
+import * as Dialog from "@radix-ui/react-dialog";
+import { PropsWithChildren, useRef } from "react";
+
+interface Props extends PropsWithChildren {
+ title: string;
+ onClose: () => void;
+}
+
+export function FullscreenDialog({ title, onClose, children }: Props) {
+ const previousFocus = useRef<HTMLElement | null>(null);
+ return (
+ <Dialog.Root
+ open
+ onOpenChange={(open) => {
+ if (!open) onClose();
+ }}
+ >
+ <Dialog.Portal>
+ <Dialog.Overlay className="fixed inset-0 z-50 bg-background" />
+ <Dialog.Content
+ className="fixed inset-0 z-50 flex flex-col bg-background"
+ aria-describedby={undefined}
+ onOpenAutoFocus={() => {
+ previousFocus.current =
+ document.activeElement instanceof HTMLElement
+ ? document.activeElement
+ : null;
+ }}
+ onCloseAutoFocus={(event) => {
+ event.preventDefault();
+ if (previousFocus.current?.isConnected)
+ previousFocus.current.focus();
+ }}
+ >
+ <Dialog.Title className="sr-only">{title}</Dialog.Title>
+ {children}
+ </Dialog.Content>
+ </Dialog.Portal>
+ </Dialog.Root>
+ );
+}
diff --git a/autogpt_platform/frontend/src/components/molecules/FullscreenDialog/__tests__/FullscreenDialog.test.tsx b/autogpt_platform/frontend/src/components/molecules/FullscreenDialog/__tests__/FullscreenDialog.test.tsx
new file mode 100644
index 0000000000..63f80c81d6
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/molecules/FullscreenDialog/__tests__/FullscreenDialog.test.tsx
@@ -0,0 +1,45 @@
+import { render, screen, waitFor } from "@/tests/integrations/test-utils";
+import userEvent from "@testing-library/user-event";
+import { useState } from "react";
+import { expect, test } from "vitest";
+import { FullscreenDialog } from "../FullscreenDialog";
+
+function Harness() {
+ const [open, setOpen] = useState(false);
+ return (
+ <div>
+ <button onClick={() => setOpen(true)}>Edit Soul</button>
+ <button>Background action</button>
+ {open ? (
+ <FullscreenDialog title="Maria's Soul" onClose={() => setOpen(false)}>
+ <button onClick={() => setOpen(false)}>Close Soul</button>
+ <input aria-label="Identity" />
+ <button>Save Soul</button>
+ </FullscreenDialog>
+ ) : null}
+ </div>
+ );
+}
+
+test("focuses and traps the mobile panel, hides the background, and restores focus", async () => {
+ render(<Harness />);
+ const trigger = screen.getByRole("button", { name: "Edit Soul" });
+ await userEvent.click(trigger);
+ const dialog = await screen.findByRole("dialog", { name: "Maria's Soul" });
+ await waitFor(() =>
+ expect(dialog.contains(document.activeElement)).toBe(true),
+ );
+ expect(
+ screen.queryByRole("button", { name: "Background action" }),
+ ).toBeNull();
+ const first = screen.getByRole("button", { name: "Close Soul" });
+ const last = screen.getByRole("button", { name: "Save Soul" });
+ last.focus();
+ await userEvent.tab();
+ expect(document.activeElement).toBe(first);
+ await userEvent.tab({ shift: true });
+ expect(document.activeElement).toBe(last);
+ await userEvent.keyboard("{Escape}");
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ await waitFor(() => expect(document.activeElement).toBe(trigger));
+});
diff --git a/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker.tsx b/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker.tsx
index 9ca7db9f84..67229bc86c 100644
--- a/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker.tsx
+++ b/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/InstallWorkflowPicker.tsx
@@ -31,12 +31,14 @@ export function InstallWorkflowPicker({
const {
title,
hiredExperts,
- isLibraryAgentInstalled,
source,
setSource,
searchQuery,
setSearchQuery,
libraryResults,
+ hasMoreLibraryResults,
+ loadMoreLibraryResults,
+ isLoadingMore,
marketplaceResults,
isSearching,
pendingKey,
@@ -181,23 +183,14 @@ export function InstallWorkflowPicker({
{workflowSubtitle(agent.description)}
</Text>
</div>
- {isLibraryAgentInstalled(agent) ? (
- <Text
- variant="small"
- className="shrink-0 !text-zinc-400"
- >
- Installed
- </Text>
- ) : (
- <Button
- variant="secondary"
- size="small"
- loading={pendingKey === agent.id}
- onClick={() => installLibraryAgent(agent)}
- >
- Install
- </Button>
- )}
+ <Button
+ variant="secondary"
+ size="small"
+ loading={pendingKey === agent.id}
+ onClick={() => installLibraryAgent(agent)}
+ >
+ Install
+ </Button>
</div>
))
: marketplaceResults.map((agent) => (
@@ -235,6 +228,16 @@ export function InstallWorkflowPicker({
))}
</div>
)}
+ {source === "library" && hasMoreLibraryResults ? (
+ <Button
+ variant="secondary"
+ size="small"
+ loading={isLoadingMore}
+ onClick={() => loadMoreLibraryResults()}
+ >
+ Load more workflows
+ </Button>
+ ) : null}
</div>
)}
</Dialog.Content>
diff --git a/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/useInstallWorkflowPicker.ts b/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/useInstallWorkflowPicker.ts
index 197a259478..32f227bc1d 100644
--- a/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/useInstallWorkflowPicker.ts
+++ b/autogpt_platform/frontend/src/components/molecules/InstallWorkflowPicker/useInstallWorkflowPicker.ts
@@ -4,20 +4,22 @@ import {
useInstallExpertWorkflow,
useListExperts,
} from "@/app/api/__generated__/endpoints/experts/experts";
-import { useGetV2ListLibraryAgents } from "@/app/api/__generated__/endpoints/library/library";
+import {
+ getGetV2ListLibraryAgentsQueryKey,
+ useGetV2ListLibraryAgentsInfinite,
+} from "@/app/api/__generated__/endpoints/library/library";
import {
getV2GetSpecificAgent,
useGetV2ListStoreAgents,
} from "@/app/api/__generated__/endpoints/store/store";
import { Expert } from "@/app/api/__generated__/models/expert";
import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
-import { LibraryAgentResponse } from "@/app/api/__generated__/models/libraryAgentResponse";
import { StoreAgent } from "@/app/api/__generated__/models/storeAgent";
import { StoreAgentsResponse } from "@/app/api/__generated__/models/storeAgentsResponse";
import { toast } from "@/components/molecules/Toast/use-toast";
import { useDebouncedValue } from "@/hooks/useDebouncedValue";
import { useQueryClient } from "@tanstack/react-query";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { InstallWorkflowSource, WorkflowInstallData } from "./helpers";
const SEARCH_DEBOUNCE_MS = 300;
@@ -57,19 +59,52 @@ export function useInstallWorkflowPicker({
);
const isPickingWorkflow = open && mode === "pick-workflow";
- const libraryResultsQuery = useGetV2ListLibraryAgents(
- {
- search_term: debouncedSearchQuery || undefined,
- page_size: RESULTS_PAGE_SIZE,
- is_hidden: false,
- },
- {
- query: {
- select: (x) => (x.data as LibraryAgentResponse).agents,
- enabled: isPickingWorkflow && source === "library",
- },
+ const libraryParams = {
+ search_term: debouncedSearchQuery || undefined,
+ page_size: RESULTS_PAGE_SIZE,
+ is_hidden: false,
+ };
+ const libraryResultsQuery = useGetV2ListLibraryAgentsInfinite(libraryParams, {
+ query: {
+ queryKey: [
+ ...getGetV2ListLibraryAgentsQueryKey(libraryParams),
+ "infinite",
+ ],
+ initialPageParam: 1,
+ getNextPageParam: (last) =>
+ last.status === 200 &&
+ last.data.pagination.current_page < last.data.pagination.total_pages
+ ? last.data.pagination.current_page + 1
+ : undefined,
+ enabled: isPickingWorkflow && source === "library",
},
- );
+ });
+
+ const libraryResults = (libraryResultsQuery.data?.pages ?? [])
+ .flatMap((page) => (page.status === 200 ? page.data.agents : []))
+ .filter(
+ (agent) =>
+ !targetExpert?.workflows.some(
+ (workflow) => workflow.library_agent_id === agent.id,
+ ),
+ );
+ const { hasNextPage, isFetching, isFetchNextPageError, fetchNextPage } =
+ libraryResultsQuery;
+ const needsMoreLibraryResults =
+ isPickingWorkflow &&
+ source === "library" &&
+ !expertsQuery.isPending &&
+ libraryResults.length === 0 &&
+ hasNextPage;
+ useEffect(() => {
+ if (needsMoreLibraryResults && !isFetching && !isFetchNextPageError)
+ void fetchNextPage();
+ }, [
+ needsMoreLibraryResults,
+ isFetching,
+ isFetchNextPageError,
+ fetchNextPage,
+ ]);
const marketplaceResultsQuery = useGetV2ListStoreAgents(
{
@@ -163,16 +198,6 @@ export function useInstallWorkflowPicker({
}
}
- // Only the library source can tell: a marketplace row carries no listing
- // version until its detail is fetched at click time.
- function isLibraryAgentInstalled(agent: LibraryAgent) {
- return (
- targetExpert?.workflows.some(
- (workflow) => workflow.library_agent_id === agent.id,
- ) ?? false
- );
- }
-
const title =
mode === "pick-expert"
? "Install on an expert"
@@ -184,14 +209,18 @@ export function useInstallWorkflowPicker({
return {
title,
hiredExperts,
- isLibraryAgentInstalled,
source,
setSource,
searchQuery,
setSearchQuery,
- libraryResults: libraryResultsQuery.data ?? [],
+ libraryResults,
+ hasMoreLibraryResults: hasNextPage,
+ loadMoreLibraryResults: fetchNextPage,
+ isLoadingMore: libraryResultsQuery.isFetchingNextPage,
marketplaceResults: marketplaceResultsQuery.data ?? [],
- isSearching: resultsQuery.isLoading,
+ isSearching:
+ resultsQuery.isLoading ||
+ (needsMoreLibraryResults && !isFetchNextPageError),
pendingKey,
installOnExpert,
installLibraryAgent,
diff --git a/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.stories.tsx b/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.stories.tsx
index d882e931cc..8b3e92b80b 100644
--- a/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.stories.tsx
+++ b/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.stories.tsx
@@ -16,7 +16,7 @@ const meta: Meta<typeof SearchInput> = {
argTypes: {
size: {
control: { type: "radio" },
- options: ["small", "medium"],
+ options: ["xsmall", "small", "medium"],
},
disabled: { control: "boolean" },
},
diff --git a/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.tsx b/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.tsx
index cafe6ee1cb..858eb769bf 100644
--- a/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.tsx
+++ b/autogpt_platform/frontend/src/components/molecules/SearchInput/SearchInput.tsx
@@ -17,16 +17,18 @@ interface Props {
disabled?: boolean;
loading?: boolean;
maxLength?: number;
- size?: "small" | "medium";
+ size?: "xsmall" | "small" | "medium";
className?: string;
}
const sizeStyles = {
+ xsmall: "h-7 rounded-md pl-8 pr-7 text-xs leading-5",
small: "h-[36px] pl-10 pr-9 text-sm leading-[22px]",
medium: "h-[46px] pl-12 pr-10 text-sm leading-[22px]",
} as const;
const iconOffset = {
+ xsmall: { left: "left-2.5", right: "right-1" },
small: { left: "left-3", right: "right-2" },
medium: { left: "left-4", right: "right-3" },
} as const;
@@ -51,7 +53,7 @@ export const SearchInput = forwardRef<HTMLInputElement, Props>(
<div className={cn("relative w-full", className)}>
<Icon
icon={Search01Icon}
- size={size === "small" ? 16 : 20}
+ size={size === "medium" ? 20 : size === "small" ? 16 : 14}
className={cn(
"pointer-events-none absolute top-1/2 -translate-y-1/2 text-muted-foreground",
iconOffset[size].left,
@@ -83,7 +85,7 @@ export const SearchInput = forwardRef<HTMLInputElement, Props>(
>
<Icon
icon={Loading03Icon}
- size={size === "small" ? 14 : 16}
+ size={size === "medium" ? 16 : 14}
className="animate-spin"
/>
</span>
@@ -97,7 +99,7 @@ export const SearchInput = forwardRef<HTMLInputElement, Props>(
iconOffset[size].right,
)}
>
- <Icon icon={Cancel01Icon} size={size === "small" ? 12 : 14} />
+ <Icon icon={Cancel01Icon} size={size === "medium" ? 14 : 12} />
</button>
) : null}
</div>
diff --git a/autogpt_platform/frontend/src/components/molecules/TabsLine/TabsLine.tsx b/autogpt_platform/frontend/src/components/molecules/TabsLine/TabsLine.tsx
index 4844d9bee5..8354009009 100644
--- a/autogpt_platform/frontend/src/components/molecules/TabsLine/TabsLine.tsx
+++ b/autogpt_platform/frontend/src/components/molecules/TabsLine/TabsLine.tsx
@@ -41,12 +41,17 @@ interface TabsLineListProps
* aligns flush with the list's left edge. Defaults to `false`.
*/
flush?: boolean;
+ /**
+ * Overrides the active-tab underline colour, for surfaces that want a
+ * neutral accent instead of the default purple.
+ */
+ indicatorClassName?: string;
}
const TabsLineList = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.List>,
TabsLineListProps
->(({ className, flush = false, ...props }, ref) => {
+>(({ className, flush = false, indicatorClassName, ...props }, ref) => {
const { activeTabElement } = useTabsLine();
const listRef = React.useRef<HTMLDivElement>(null);
@@ -69,7 +74,10 @@ const TabsLineList = React.forwardRef<
/>
{activeTabElement && (
<div
- className="transition-left transition-right absolute bottom-0 h-0.5 bg-purple-600 duration-200 ease-in-out"
+ className={cn(
+ "transition-left transition-right absolute bottom-0 h-0.5 bg-purple-600 duration-200 ease-in-out",
+ indicatorClassName,
+ )}
style={{
left: activeTabElement.offsetLeft,
width: activeTabElement.offsetWidth,
diff --git a/autogpt_platform/frontend/src/components/ui/sidebar.tsx b/autogpt_platform/frontend/src/components/ui/sidebar.tsx
index 9f72083430..e61b4835e4 100644
--- a/autogpt_platform/frontend/src/components/ui/sidebar.tsx
+++ b/autogpt_platform/frontend/src/components/ui/sidebar.tsx
@@ -45,8 +45,12 @@ type SidebarContextProps = {
const SidebarContext = React.createContext<SidebarContextProps | null>(null);
+function useOptionalSidebar() {
+ return React.useContext(SidebarContext);
+}
+
function useSidebar() {
- const context = React.useContext(SidebarContext);
+ const context = useOptionalSidebar();
if (!context) {
throw new Error("useSidebar must be used within a SidebarProvider.");
}
@@ -781,5 +785,6 @@ export {
SidebarRail,
SidebarSeparator,
SidebarTrigger,
+ useOptionalSidebar,
useSidebar,
};
diff --git a/autogpt_platform/frontend/src/services/storage/local-storage.ts b/autogpt_platform/frontend/src/services/storage/local-storage.ts
index eab88bca00..1e1443d45d 100644
--- a/autogpt_platform/frontend/src/services/storage/local-storage.ts
+++ b/autogpt_platform/frontend/src/services/storage/local-storage.ts
@@ -21,6 +21,7 @@ export enum Key {
COPILOT_CONTEXT_PANEL_WIDTH = "copilot-context-panel-width",
COPILOT_CONTEXT_PANEL_OPEN = "copilot-context-panel-open",
COPILOT_CONTEXT_PANEL_TAB = "copilot-context-panel-tab",
+ TEAM_WORKFLOWS_VIEW = "team-workflows-view",
COPILOT_MODE = "copilot-mode",
COPILOT_MODEL = "copilot-model",
COPILOT_COMPLETED_SESSIONS = "copilot-completed-sessions",
diff --git a/autogpt_platform/frontend/tailwind.config.ts b/autogpt_platform/frontend/tailwind.config.ts
index ee1ff6a8f8..b8ec0bdf34 100644
--- a/autogpt_platform/frontend/tailwind.config.ts
+++ b/autogpt_platform/frontend/tailwind.config.ts
@@ -30,6 +30,27 @@ const smoothShadowRing = plugin(function smoothShadowRing({
});
});
+// Fractal-noise tile, inlined so the grain costs no extra request. `#` and `%`
+// stay percent-encoded or the data URI terminates early.
+const GRAIN_TEXTURE = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'/%3E%3C/svg%3E")`;
+
+// Lays grain over an element's own background. Deliberately sets no `position`,
+// so it never fights the positioning utilities already on the target — callers
+// must position the element themselves.
+const grainTexture = plugin(function grainTexture({ addUtilities }) {
+ addUtilities({
+ ".grain-overlay::after": {
+ content: '""',
+ position: "absolute",
+ inset: "0",
+ backgroundImage: GRAIN_TEXTURE,
+ opacity: "0.5",
+ mixBlendMode: "soft-light",
+ pointerEvents: "none",
+ },
+ });
+});
+
const config = {
darkMode: ["class", ".dark-mode"], // ignore dark: prefix classes for now until we fully support dark mode
content: ["./src/**/*.{ts,tsx}", "./node_modules/streamdown/dist/**/*.js"],
@@ -305,6 +326,7 @@ const config = {
tailwindcssAnimate,
scrollbar({ nocompatible: true }),
smoothShadowRing,
+ grainTexture,
],
} satisfies Config;