AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(platform): rework expert raise flow — attachments, budget, skills (#14069)
Abhimanyu Yadav53bb39050c8e
diff --git a/autogpt_platform/backend/backend/api/features/experts/experts_db.py b/autogpt_platform/backend/backend/api/features/experts/experts_db.pyindex 07f7626a14..9c44968178 100644--- a/autogpt_platform/backend/backend/api/features/experts/experts_db.py+++ b/autogpt_platform/backend/backend/api/features/experts/experts_db.py@@ -10,7 +10,7 @@ import prisma.typesfrom prisma.enums import ResourceVisibilityfrom pydantic import JsonValue, ValidationError-from backend.api.features.experts import scheduling+from backend.api.features.experts import raise_attachments, schedulingfrom backend.api.features.experts.models import (PROTECTED_SOUL_RULES,Expert,@@ -22,6 +22,7 @@ from backend.api.features.experts.models import (ExpertSoulUpdate,ExpertWorkflowRef,HireResult,+ RaiseAttachment,RaiseResult,decode_voice_preferences,)@@ -46,7 +47,6 @@ from backend.util import type as type_utilsfrom backend.util.exceptions import (ExpertNotFoundError,ExpertPrivateTenancyNotFoundError,- NotFoundError,)from backend.util.timezone_utils import get_user_timezone_or_utc@@ -111,25 +111,28 @@ class RaisedExpertLifetimeLimitExceededError(Exception):self.limit = limit-class FirstJobUnavailableError(Exception):- def __init__(self, store_listing_version_id: str):- super().__init__(- f"Store listing version {store_listing_version_id} "- "not found or unavailable"- )- self.store_listing_version_id = store_listing_version_id+FirstJobUnavailableError = raise_attachments.RaiseAttachmentUnavailableErrordef _to_workflow_ref(row: prisma.models.ExpertWorkflow) -> ExpertWorkflowRef:listing = row.StoreListingVersionlibrary_agent = row.LibraryAgent+ # A listing always carries both name and description (non-null columns), so+ # the pair is taken from one source or the other — never mixed, which would+ # pair a published title with the creator's private description.+ if listing is not None:+ name, description = listing.name, listing.description+ elif library_agent is not None:+ name, description = library_agent.name, library_agent.description+ else:+ name, description = None, Nonereturn ExpertWorkflowRef(id=row.id,store_listing_version_id=row.storeListingVersionId,library_agent_id=row.libraryAgentId,graph_id=library_agent.agentGraphId if library_agent else None,- name=listing.name if listing else None,- description=listing.description if listing else None,+ name=name,+ description=description,schedule_cron=row.scheduleCron,schedule_id=row.scheduleId,)@@ -157,6 +160,7 @@ def _to_model(id=row.id,name=row.name,avatar_url=row.avatarUrl,+ color=row.color,role=row.role,tagline=row.tagline,bio=row.bio,@@ -558,6 +562,7 @@ async def hire_expert(user_id: str, template_id: str, name: str | None) -> HireR"ownerUserId": user_id,"name": name or template.name,"avatarUrl": template.avatarUrl,+ "color": template.color,"role": template.role,"tagline": template.tagline,"bio": template.bio,@@ -712,56 +717,42 @@ async def create_raised_expert(name: str,role: str | None,voice_preferences: str | None,- first_job_store_listing_version_id: str | None,+ *,+ avatar_url: str | None = None,+ color: str | None = None,+ about: str | None = None,+ weekly_budget: int | None = None,+ attachments: list[RaiseAttachment] | None = None,) -> RaiseResult:"""Raise a blank expert owned by *user_id*.A raised expert has no source template, so ``sourceTemplateId`` stays- NULL. Capacity checks and creation share a per-user advisory lock. A- requested first job is validated before creation, then its exact listing- rows are locked and revalidated through workflow association. Installation- failure remains non-fatal and is reported in the result.+ NULL. Capacity checks and creation share a per-user advisory lock.+ Attachments are validated before creation. Workflow install failure+ remains non-fatal and is reported in the result."""- if first_job_store_listing_version_id is not None:- await _validate_first_job_listing(first_job_store_listing_version_id)-- expert = await _create_raised_expert_row(user_id, name, role, voice_preferences)- first_job_installed = False- failure_reason: Literal["unavailable", "installation_failed"] | None = None- if first_job_store_listing_version_id is not None:- try:- await _install_first_job(- user_id, expert.id, first_job_store_listing_version_id- )- first_job_installed = True- except (FirstJobUnavailableError, NotFoundError):- # NotFoundError covers the listing version or its graph disappearing- # between the locked availability check and graph resolution, which- # is the same "no longer available" outcome for the client.- failure_reason = "unavailable"- logger.warning(- f"First job {first_job_store_listing_version_id} became "- f"unavailable while raising expert #{expert.id} for user #{user_id}"- )- except Exception:- failure_reason = "installation_failed"- logger.exception(- f"Failed to install first job "- f"{first_job_store_listing_version_id} on raised "- f"expert #{expert.id} for user #{user_id}"- )-- if first_job_installed:+ resolved = await raise_attachments.resolve_attachments(user_id, attachments or [])+ expert = await _create_raised_expert_row(+ user_id,+ name,+ role,+ voice_preferences,+ avatar_url=avatar_url,+ color=color,+ about=about,+ weekly_budget=weekly_budget,+ skills=resolved.skill_names,+ )+ failed_attachments = await raise_attachments.install_workflows(+ user_id, expert.id, resolved.workflows+ )+ if resolved.workflows and len(failed_attachments) < len(resolved.workflows):hydrated = await get_expert(user_id, expert.id)if hydrated is None:raise ExpertNotFoundError(expert.id)else:hydrated = _to_model(expert)- return RaiseResult(- expert=hydrated,- first_job_installed=first_job_installed,- first_job_failure_reason=failure_reason,- )+ return RaiseResult(expert=hydrated, failed_attachments=failed_attachments)async def _create_raised_expert_row(@@ -769,6 +760,12 @@ async def _create_raised_expert_row(name: str,role: str | None,voice_preferences: str | None,+ *,+ avatar_url: str | None,+ color: str | None,+ about: str | None,+ weekly_budget: int | None = None,+ skills: list[str] | None = None,) -> prisma.models.Expert:async with transaction() as tx:await _lock_expert_creation(tx, user_id)@@ -786,9 +783,13 @@ async def _create_raised_expert_row(data={"ownerUserId": user_id,"name": name,+ "avatarUrl": avatar_url,+ "color": color or "","role": role or "",- "identity": _raised_identity(name),+ "identity": about or _raised_identity(name),"voicePreferences": voice_preferences or "",+ "weeklyBudget": weekly_budget,+ "skills": skills or [],},include=_WORKFLOW_INCLUDE,)@@ -799,51 +800,9 @@ async def _install_first_job(expert_id: str,store_listing_version_id: str,) -> None:- async with transaction() as tx:- is_installable = (- await library_db.is_store_listing_version_available_for_install(- store_listing_version_id,- tx=tx,- lock_rows=True,- )- )- if not is_installable:- raise FirstJobUnavailableError(store_listing_version_id)-- expert = await tx.expert.find_first(- where={- "id": expert_id,- "ownerUserId": user_id,- "isTemplate": False,- "isArchived": False,- }- )- if expert is None:- raise ExpertNotFoundError(expert_id)-- library_agent = await library_db.add_store_agent_to_library_in_transaction(- store_listing_version_id, user_id, tx- )- await tx.expertworkflow.create(- data={- "expertId": expert_id,- "storeListingVersionId": store_listing_version_id,- "libraryAgentId": library_agent.id,- }- )---async def _validate_first_job_listing(store_listing_version_id: str) -> None:- """Require the submitted listing-version row itself to be live.-- The shared library install path authorizes by graph, which would let a- pending or deleted version UUID pointing at an approved graph slip- through and link the expert to an unapproved row."""- is_installable = await library_db.is_store_listing_version_available_for_install(- store_listing_version_id+ await raise_attachments.install_marketplace_workflow(+ user_id, expert_id, store_listing_version_id)- if not is_installable:- raise FirstJobUnavailableError(store_listing_version_id)async def update_soul(user_id: str, expert_id: str, soul: ExpertSoulUpdate) -> Expert: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.pyindex 5badce24d4..2b00b4b2a2 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@@ -20,6 +20,7 @@ from backend.api.features.experts.models import (ExpertSoulFieldsPatch,ExpertSoulUpdate,HireResult,+ RaiseAttachment,VoiceSample,encode_voice_preferences,)@@ -76,6 +77,22 @@ async def other_user():return await _create_seed_user()+def _marketplace_workflow(listing_id: str) -> list[RaiseAttachment]:+ return [RaiseAttachment(kind="workflow", source="marketplace", id=listing_id)]+++def _library_workflow(library_agent_id: str) -> list[RaiseAttachment]:+ return [RaiseAttachment(kind="workflow", source="library", id=library_agent_id)]+++def _library_skill(slug: str) -> list[RaiseAttachment]:+ return [RaiseAttachment(kind="skill", source="library", id=slug)]+++def _marketplace_skill(listing_id: str) -> list[RaiseAttachment]:+ return [RaiseAttachment(kind="skill", source="marketplace", id=listing_id)]++async def _create_seed_user():suffix = uuid.uuid4().hex[:8]return await get_or_create_user(@@ -320,7 +337,7 @@ async def test_hire_and_raise_share_active_expert_cap(server: SpinTestServer):results = await asyncio.gather(experts_db.hire_expert(owner.id, template.id, None),- experts_db.create_raised_expert(owner.id, "Nova", None, None, None),+ experts_db.create_raised_expert(owner.id, "Nova", None, None),return_exceptions=True,)@@ -352,23 +369,87 @@ async def test_raise_expert_creates_blank_owned_expert(server: SpinTestServer):name="Otto",role=None,voice_preferences=None,- first_job_store_listing_version_id=None,)assert not raised.expert.is_templateassert raised.expert.source_template_id is Noneassert raised.expert.name == "Otto"assert "Otto" in raised.expert.identityassert raised.expert.workflows == []- assert raised.first_job_installed is False- assert raised.first_job_failure_reason is None+ assert raised.failed_attachments == []assert raised.expert.id in {e.id for e in await experts_db.list_experts(owner.id)}[email protected](loop_scope="session")+async def test_raise_expert_persists_avatar_and_color(server: SpinTestServer):+ owner = await _create_seed_user()+ raised = await experts_db.create_raised_expert(+ owner.id,+ name="Nova",+ role=None,+ voice_preferences=None,+ avatar_url="https://storage.googleapis.com/bucket/nova.png",+ color="sky-300",+ )+ assert raised.expert.avatar_url == "https://storage.googleapis.com/bucket/nova.png"+ assert raised.expert.color == "sky-300"++ reloaded = await experts_db.get_expert(owner.id, raised.expert.id)+ assert reloaded is not None+ assert reloaded.avatar_url == "https://storage.googleapis.com/bucket/nova.png"+ assert reloaded.color == "sky-300"++[email protected](loop_scope="session")+async def test_raise_expert_stores_about_as_identity(server: SpinTestServer):+ owner = await _create_seed_user()+ raised = await experts_db.create_raised_expert(+ owner.id,+ name="Nova",+ role=None,+ voice_preferences=None,+ about="Keeps replies short and always cites a source.",+ )+ assert raised.expert.identity == "Keeps replies short and always cites a source."++ reloaded = await experts_db.get_expert(owner.id, raised.expert.id)+ assert reloaded is not None+ assert reloaded.identity == "Keeps replies short and always cites a source."++[email protected](loop_scope="session")+async def test_raise_expert_falls_back_to_default_identity_without_about(+ server: SpinTestServer,+):+ owner = await _create_seed_user()+ raised = await experts_db.create_raised_expert(+ owner.id,+ name="Otto",+ role=None,+ voice_preferences=None,+ )+ assert raised.expert.identity == experts_db._raised_identity("Otto")++[email protected](loop_scope="session")+async def test_raise_expert_defaults_avatar_and_color_when_omitted(+ server: SpinTestServer,+):+ owner = await _create_seed_user()+ raised = await experts_db.create_raised_expert(+ owner.id,+ name="Otto",+ role=None,+ voice_preferences=None,+ )+ assert raised.expert.avatar_url is None+ assert raised.expert.color == ""++@pytest.mark.asyncio(loop_scope="session")async def test_raise_expert_allows_multiple_per_owner(server: SpinTestServer):owner = await _create_seed_user()- first = await experts_db.create_raised_expert(owner.id, "Otto", None, None, None)- second = await experts_db.create_raised_expert(owner.id, "Nova", None, None, None)+ first = await experts_db.create_raised_expert(owner.id, "Otto", None, None)+ second = await experts_db.create_raised_expert(owner.id, "Nova", None, None)assert first.expert.id != second.expert.idowned = {e.id for e in await experts_db.list_experts(owner.id)}assert {first.expert.id, second.expert.id} <= owned@@ -377,13 +458,13 @@ async def test_raise_expert_allows_multiple_per_owner(server: SpinTestServer):@pytest.mark.asyncio(loop_scope="session")async def test_raise_expert_is_scoped_to_owner(server: SpinTestServer, other_user):owner = await _create_seed_user()- raised = await experts_db.create_raised_expert(owner.id, "Otto", None, None, None)+ raised = await experts_db.create_raised_expert(owner.id, "Otto", None, None)assert await experts_db.get_expert(other_user.id, raised.expert.id) is Noneassert await experts_db.get_expert(owner.id, raised.expert.id) is not None@pytest.mark.asyncio(loop_scope="session")-async def test_raise_expert_installs_first_job(server: SpinTestServer):+async def test_raise_expert_installs_marketplace_workflow(server: SpinTestServer):owner = await _create_seed_user()slv_id = await _seed_store_listing(server)raised = await experts_db.create_raised_expert(@@ -391,12 +472,11 @@ async def test_raise_expert_installs_first_job(server: SpinTestServer):name="Nova",role="Research Assistant",voice_preferences="Warm and detailed.",- first_job_store_listing_version_id=slv_id,+ attachments=_marketplace_workflow(slv_id),)assert raised.expert.role == "Research Assistant"assert raised.expert.voice_preferences == "Warm and detailed."- assert raised.first_job_installed is True- assert raised.first_job_failure_reason is None+ assert raised.failed_attachments == []assert len(raised.expert.workflows) == 1assert raised.expert.workflows[0].store_listing_version_id == slv_id@@ -418,7 +498,9 @@ async def test_raise_expert_restores_existing_first_job_library_agent(data={"isDeleted": True, "isArchived": True},)- raised = await experts_db.create_raised_expert(owner.id, "Nova", None, None, slv_id)+ raised = await experts_db.create_raised_expert(+ owner.id, "Nova", None, None, attachments=_marketplace_workflow(slv_id)+ )restored = await prisma.models.LibraryAgent.prisma().find_unique(where={"id": existing.id}@@ -431,9 +513,13 @@ async def test_raise_expert_restores_existing_first_job_library_agent(@pytest.mark.asyncio(loop_scope="session")-async def test_first_job_install_rolls_back_library_agent_on_link_failure(+async def test_first_job_install_rolls_back_library_agent_on_link_race(server: SpinTestServer,):+ """A concurrent raise already attached this listing, so the link insert+ loses the unique constraint: the transaction — including the library agent+ it created — rolls back, and the caller still sees success because the+ workflow is attached."""owner = await _create_seed_user()slv_id = await _seed_store_listing(server)expert = await prisma.models.Expert.prisma().create(@@ -451,8 +537,7 @@ async def test_first_job_install_rolls_back_library_agent_on_link_failure(})- with pytest.raises(prisma.errors.UniqueViolationError):- await experts_db._install_first_job(owner.id, expert.id, slv_id)+ await experts_db._install_first_job(owner.id, expert.id, slv_id)listing = await prisma.models.StoreListingVersion.prisma().find_unique(where={"id": slv_id}, include={"AgentGraph": True}@@ -482,12 +567,12 @@ async def test_raise_expert_reports_failed_first_job(server: SpinTestServer):side_effect=RuntimeError("install exploded"),):raised = await experts_db.create_raised_expert(- owner.id, "Otto", None, None, slv_id+ owner.id, "Otto", None, None, attachments=_marketplace_workflow(slv_id))assert not raised.expert.is_templateassert raised.expert.workflows == []- assert raised.first_job_installed is False- assert raised.first_job_failure_reason == "installation_failed"+ assert len(raised.failed_attachments) == 1+ assert raised.failed_attachments[0].reason == "installation_failed"@pytest.mark.asyncio(loop_scope="session")@@ -504,17 +589,17 @@ async def test_raise_expert_reports_vanished_graph_as_unavailable(side_effect=NotFoundError("Graph #x v1 not found or accessible"),):raised = await experts_db.create_raised_expert(- owner.id, "Otto", None, None, slv_id+ owner.id, "Otto", None, None, attachments=_marketplace_workflow(slv_id))assert raised.expert.workflows == []- assert raised.first_job_installed is False- assert raised.first_job_failure_reason == "unavailable"+ assert len(raised.failed_attachments) == 1+ assert raised.failed_attachments[0].reason == "unavailable"@pytest.mark.asyncio(loop_scope="session")async def test_raise_expert_handles_braces_in_name(server: SpinTestServer):owner = await _create_seed_user()- raised = await experts_db.create_raised_expert(owner.id, "a{b", None, None, None)+ raised = await experts_db.create_raised_expert(owner.id, "a{b", None, None)assert raised.expert.name == "a{b"assert "a{b" in raised.expert.identity@@ -533,8 +618,9 @@ async def test_raise_expert_degrades_when_first_job_vanishes_mid_flight(name: str,role: str | None,voice_preferences: str | None,+ **kwargs,) -> prisma.models.Expert:- expert = await create_row(user_id, name, role, voice_preferences)+ expert = await create_row(user_id, name, role, voice_preferences, **kwargs)await prisma.models.StoreListingVersion.prisma().update(where={"id": slv_id}, data={"isAvailable": False})@@ -546,11 +632,11 @@ async def test_raise_expert_degrades_when_first_job_vanishes_mid_flight(new=create_then_withdraw,):raised = await experts_db.create_raised_expert(- owner.id, "Otto", None, None, slv_id+ owner.id, "Otto", None, None, attachments=_marketplace_workflow(slv_id))assert raised.expert.workflows == []- assert raised.first_job_installed is False- assert raised.first_job_failure_reason == "unavailable"+ assert len(raised.failed_attachments) == 1+ assert raised.failed_attachments[0].reason == "unavailable"assert (await prisma.models.ExpertWorkflow.prisma().count(where={"expertId": raised.expert.id}@@ -566,7 +652,11 @@ async def test_raise_expert_rejects_unapproved_first_job(server: SpinTestServer)with pytest.raises(experts_db.FirstJobUnavailableError):await experts_db.create_raised_expert(- owner.id, "Otto", None, None, pending_slv_id+ owner.id,+ "Otto",+ None,+ None,+ attachments=_marketplace_workflow(pending_slv_id),)assert await experts_db.list_experts(owner.id) == []@@ -582,7 +672,11 @@ async def test_raise_expert_rejects_withdrawn_first_job(server: SpinTestServer):with pytest.raises(experts_db.FirstJobUnavailableError):await experts_db.create_raised_expert(- owner.id, "Otto", None, None, withdrawn_slv_id+ owner.id,+ "Otto",+ None,+ None,+ attachments=_marketplace_workflow(withdrawn_slv_id),)assert await experts_db.list_experts(owner.id) == []@@ -617,11 +711,160 @@ async def test_raise_expert_rejects_pending_version_of_approved_graph()with pytest.raises(experts_db.FirstJobUnavailableError):- await experts_db.create_raised_expert(owner.id, "Otto", None, None, pending.id)+ await experts_db.create_raised_expert(+ owner.id, "Otto", None, None, attachments=_marketplace_workflow(pending.id)+ )++ assert await experts_db.list_experts(owner.id) == []++[email protected](loop_scope="session")+async def test_raise_expert_persists_weekly_budget(server: SpinTestServer):+ owner = await _create_seed_user()+ raised = await experts_db.create_raised_expert(+ owner.id,+ name="Otto",+ role=None,+ voice_preferences=None,+ weekly_budget=250,+ )+ row = await prisma.models.Expert.prisma().find_unique(+ where={"id": raised.expert.id}+ )+ assert row is not None+ assert row.weeklyBudget == 250+ assert raised.expert.weekly_budget == 250++[email protected](loop_scope="session")+async def test_raise_expert_omitted_weekly_budget_uses_platform_default(+ server: SpinTestServer,+):+ owner = await _create_seed_user()+ raised = await experts_db.create_raised_expert(+ owner.id, name="Otto", role=None, voice_preferences=None+ )+ row = await prisma.models.Expert.prisma().find_unique(+ where={"id": raised.expert.id}+ )+ assert row is not None+ assert row.weeklyBudget is None+ assert raised.expert.weekly_budget == scheduling.effective_weekly_budget(row)++[email protected](loop_scope="session")+async def test_raise_expert_attaches_library_workflow(server: SpinTestServer):+ owner = await _create_seed_user()+ slv_id = await _seed_store_listing(server)+ library_agent = await library_db.add_store_agent_to_library(slv_id, owner.id)++ raised = await experts_db.create_raised_expert(+ owner.id,+ name="Nova",+ role=None,+ voice_preferences=None,+ attachments=_library_workflow(library_agent.id),+ )++ assert raised.failed_attachments == []+ assert len(raised.expert.workflows) == 1+ assert raised.expert.workflows[0].library_agent_id == library_agent.id++[email protected](loop_scope="session")+async def test_raise_expert_rejects_other_users_library_workflow(+ server: SpinTestServer, other_user+):+ owner = await _create_seed_user()+ slv_id = await _seed_store_listing(server)+ library_agent = await library_db.add_store_agent_to_library(slv_id, other_user.id)++ with pytest.raises(experts_db.FirstJobUnavailableError):+ await experts_db.create_raised_expert(+ owner.id,+ "Otto",+ None,+ None,+ attachments=_library_workflow(library_agent.id),+ )+ assert await experts_db.list_experts(owner.id) == []++[email protected](loop_scope="session")+async def test_raise_expert_attaches_library_skill(server: SpinTestServer):+ owner = await _create_seed_user()+ skill = SimpleNamespace(name="oauth_flow")+ with (+ patch.object(+ experts_db.raise_attachments,+ "get_default_skill_with_body",+ return_value=None,+ ),+ patch.object(+ experts_db.raise_attachments,+ "read_user_skill_with_body",+ new_callable=AsyncMock,+ return_value=skill,+ ),+ ):+ raised = await experts_db.create_raised_expert(+ owner.id,+ name="Nova",+ role=None,+ voice_preferences=None,+ attachments=_library_skill("oauth_flow"),+ )+ assert raised.expert.skills == ["oauth_flow"]+ assert raised.failed_attachments == []+[email protected](loop_scope="session")+async def test_raise_expert_rejects_missing_library_skill(server: SpinTestServer):+ owner = await _create_seed_user()+ with (+ patch.object(+ experts_db.raise_attachments,+ "get_default_skill_with_body",+ return_value=None,+ ),+ patch.object(+ experts_db.raise_attachments,+ "read_user_skill_with_body",+ new_callable=AsyncMock,+ return_value=None,+ ),+ pytest.raises(experts_db.FirstJobUnavailableError),+ ):+ await experts_db.create_raised_expert(+ owner.id,+ "Otto",+ None,+ None,+ attachments=_library_skill("missing_skill"),+ )assert await experts_db.list_experts(owner.id) == [][email protected](loop_scope="session")+async def test_raise_expert_attaches_marketplace_skill_name(server: SpinTestServer):+ owner = await _create_seed_user()+ slv_id = await _seed_store_listing(server)+ listing = await prisma.models.StoreListingVersion.prisma().find_unique(+ where={"id": slv_id}+ )+ assert listing is not None++ raised = await experts_db.create_raised_expert(+ owner.id,+ name="Nova",+ role=None,+ voice_preferences=None,+ attachments=_marketplace_skill(slv_id),+ )+ assert raised.expert.skills == [listing.name]+ assert raised.expert.workflows == []++@pytest.mark.asyncio(loop_scope="session")async def test_raise_expert_enforces_active_expert_cap(server: SpinTestServer):owner = await _create_seed_user()@@ -638,9 +881,7 @@ async def test_raise_expert_enforces_active_expert_cap(server: SpinTestServer):)with pytest.raises(experts_db.ExpertLimitExceededError):- await experts_db.create_raised_expert(- owner.id, "One Too Many", None, None, None- )+ await experts_db.create_raised_expert(owner.id, "One Too Many", None, None)filler = await prisma.models.Expert.prisma().find_first(where={"ownerUserId": owner.id}@@ -648,9 +889,7 @@ async def test_raise_expert_enforces_active_expert_cap(server: SpinTestServer):assert filler is not Noneawait experts_db.archive_expert(owner.id, filler.id)- raised = await experts_db.create_raised_expert(- owner.id, "Fits Now", None, None, None- )+ raised = await experts_db.create_raised_expert(owner.id, "Fits Now", None, None)assert raised.expert.name == "Fits Now"@@ -670,8 +909,8 @@ async def test_raise_expert_serializes_concurrent_cap_checks(server: SpinTestSer)results = await asyncio.gather(- experts_db.create_raised_expert(owner.id, "Alpha", None, None, None),- experts_db.create_raised_expert(owner.id, "Beta", None, None, None),+ experts_db.create_raised_expert(owner.id, "Alpha", None, None),+ experts_db.create_raised_expert(owner.id, "Beta", None, None),return_exceptions=True,)@@ -714,11 +953,11 @@ async def test_raise_expert_locks_are_independent_per_owner(server: SpinTestServwith patch.object(experts_db, "_lock_expert_creation", new=lock_and_hold_first):first = asyncio.create_task(- experts_db.create_raised_expert(first_owner.id, "Alpha", None, None, None)+ experts_db.create_raised_expert(first_owner.id, "Alpha", None, None))await asyncio.wait_for(first_lock_acquired.wait(), timeout=5)second = asyncio.create_task(- experts_db.create_raised_expert(second_owner.id, "Beta", None, None, None)+ experts_db.create_raised_expert(second_owner.id, "Beta", None, None))try:await asyncio.wait_for(second_lock_acquired.wait(), timeout=5)@@ -747,9 +986,7 @@ async def test_raise_expert_enforces_lifetime_cap(server: SpinTestServer):)with pytest.raises(experts_db.RaisedExpertLifetimeLimitExceededError):- await experts_db.create_raised_expert(- owner.id, "One Too Many", None, None, None- )+ await experts_db.create_raised_expert(owner.id, "One Too Many", None, None)@pytest.mark.asyncio(loop_scope="session")@@ -761,9 +998,7 @@ async def test_hired_experts_do_not_consume_raised_lifetime_cap(await experts_db.hire_expert(owner.id, template.id, None)with patch.object(experts_db, "LIFETIME_RAISED_EXPERT_LIMIT", 1):- raised = await experts_db.create_raised_expert(- owner.id, "Nova", None, None, None- )+ raised = await experts_db.create_raised_expert(owner.id, "Nova", None, None)assert raised.expert.source_template_id is None@@ -1076,9 +1311,11 @@ async def test_existing_non_private_hire_is_never_revived():async def fake_transaction(*args, **kwargs):yield tx- with patch.object(experts_db, "transaction", fake_transaction):- with pytest.raises(experts_db.ExpertNotFoundError):- await experts_db._reserve_hired_expert("owner-1", "template-1", {})+ with (+ patch.object(experts_db, "transaction", fake_transaction),+ pytest.raises(experts_db.ExpertNotFoundError),+ ):+ await experts_db._reserve_hired_expert("owner-1", "template-1", {})tx.expert.update.assert_not_awaited()tx.expert.create.assert_not_awaited()@@ -1090,6 +1327,7 @@ async def test_hire_existing_team_expert_fails_closed():id="template-1",name="Maria",avatarUrl=None,+ color="",role="Marketing Specialist",tagline=None,bio=None,@@ -1123,9 +1361,9 @@ async def test_hire_existing_team_expert_fails_closed():with (patch.object(prisma.models.Expert, "prisma", return_value=expert_client),patch.object(experts_db, "transaction", fake_transaction),+ pytest.raises(experts_db.ExpertNotFoundError) as exc_info,):- with pytest.raises(experts_db.ExpertNotFoundError) as exc_info:- await experts_db.hire_expert("owner-1", "template-1", None)+ await experts_db.hire_expert("owner-1", "template-1", None)assert exc_info.value.expert_id == "shared-expert"tx.expert.create.assert_not_awaited()@@ -1139,6 +1377,7 @@ async def test_hire_raced_org_expert_fails_closed():id="template-1",name="Maria",avatarUrl=None,+ color="",role="Marketing Specialist",tagline=None,bio=None,@@ -1174,9 +1413,9 @@ async def test_hire_raced_org_expert_fails_closed():with (patch.object(prisma.models.Expert, "prisma", return_value=expert_client),patch.object(experts_db, "transaction", fake_transaction),+ pytest.raises(experts_db.ExpertNotFoundError) as exc_info,):- with pytest.raises(experts_db.ExpertNotFoundError) as exc_info:- await experts_db.hire_expert("owner-1", "template-1", None)+ await experts_db.hire_expert("owner-1", "template-1", None)assert exc_info.value.expert_id == "shared-expert"tx.expert.create.assert_awaited_once()@@ -1213,9 +1452,9 @@ async def test_rehire_missing_private_tenancy_rolls_back_to_archived():patch.object(scheduling, "detach_expert_triggers", new_callable=AsyncMock) as detach,+ pytest.raises(experts_db.ExpertPrivateTenancyNotFoundError),):- with pytest.raises(experts_db.ExpertPrivateTenancyNotFoundError):- await experts_db._resume_revived_hire(row)+ await experts_db._resume_revived_hire(row)resume.assert_not_awaited()reattach.assert_not_awaited()@@ -1260,9 +1499,9 @@ async def test_rehire_reattach_failure_restores_archived_state():patch.object(scheduling, "detach_expert_triggers", new_callable=AsyncMock) as detach,+ pytest.raises(experts_db.ExpertHireUnavailableError) as exc_info,):- with pytest.raises(experts_db.ExpertHireUnavailableError) as exc_info:- await experts_db._resume_revived_hire(row)+ await experts_db._resume_revived_hire(row)assert exc_info.value.expert_id == "expert-1"assert isinstance(exc_info.value.__cause__, RuntimeError)@@ -1343,9 +1582,9 @@ async def test_resolve_private_expert_tenancy_fails_without_personal_org():new_callable=AsyncMock,return_value=(None, None),),+ pytest.raises(experts_db.ExpertPrivateTenancyNotFoundError),):- with pytest.raises(experts_db.ExpertPrivateTenancyNotFoundError):- await experts_db.resolve_private_expert_tenancy("owner-1", "expert-1")+ await experts_db.resolve_private_expert_tenancy("owner-1", "expert-1")@pytest.mark.asyncio(loop_scope="session")@@ -2039,9 +2278,11 @@ async def test_enforce_budget_pauses_blocks_and_resumes(where={"id": hired.expert.id}, data={"weeklyBudget": 100})- with patch.object(scheduling, "get_weekly_spend", new=AsyncMock(return_value=150)):- with pytest.raises(ExpertRunPausedError):- await scheduling.enforce_expert_run_budget(test_user.id, hired.expert.id)+ with (+ patch.object(scheduling, "get_weekly_spend", new=AsyncMock(return_value=150)),+ pytest.raises(ExpertRunPausedError),+ ):+ await scheduling.enforce_expert_run_budget(test_user.id, hired.expert.id)row = await prisma.models.Expert.prisma().find_unique(where={"id": hired.expert.id})assert row is not None and row.schedulesPausedAt is not None@@ -3032,13 +3273,15 @@ async def test_list_expert_runs_scopes_queries_and_matches_pending_review():async def test_list_expert_runs_rejects_missing_or_foreign_expert():expert_client = SimpleNamespace(find_first=AsyncMock(return_value=None))- with patch.object(- prisma.models.Expert,- "prisma",- return_value=expert_client,+ with (+ patch.object(+ prisma.models.Expert,+ "prisma",+ return_value=expert_client,+ ),+ pytest.raises(experts_db.ExpertNotFoundError),):- with pytest.raises(experts_db.ExpertNotFoundError):- await experts_db.list_expert_runs("owner-1", "foreign-expert")+ await experts_db.list_expert_runs("owner-1", "foreign-expert")assert expert_client.find_first.await_args.kwargs["where"]["ownerUserId"] == ("owner-1"diff --git a/autogpt_platform/backend/backend/api/features/experts/models.py b/autogpt_platform/backend/backend/api/features/experts/models.pyindex be68f3c79c..9ba646ca4b 100644--- a/autogpt_platform/backend/backend/api/features/experts/models.py+++ b/autogpt_platform/backend/backend/api/features/experts/models.py@@ -1,6 +1,7 @@import jsonfrom datetime import datetimefrom typing import Literal+from urllib.parse import urlparsefrom pydantic import BaseModel, Field, ValidationError, field_validator@@ -21,19 +22,57 @@ EXTERNAL_ACTION_APPROVAL_RULE = "External actions require approval."PROTECTED_SOUL_RULES = (AI_DISCLOSURE_RULE, EXTERNAL_ACTION_APPROVAL_RULE)_EXPERT_NAME_MAX_LENGTH = 100-_EXPERT_IDENTITY_MAX_LENGTH = 10_000+EXPERT_IDENTITY_MAX_LENGTH = 10_000_EXPERT_SOUL_TEXT_MAX_LENGTH = 4_000+EXPERT_COLOR_MAX_LENGTH = 32+EXPERT_AVATAR_URL_MAX_LENGTH = 2_000++# Avatars come from our own upload (an absolute https URL) or ship with a+# roster template (a path under /public). Anything else — notably data:,+# javascript: and plaintext http: — is refused so a stored value can never+# carry script or be fetched unencrypted.+# Backslashes and tab/CR/LF are refused outright: browsers strip the control+# characters and treat "\" as "/" for special schemes, so "/\evil.example/a.png"+# would resolve to a third-party origin despite looking site-relative.+_AVATAR_URL_FORBIDDEN_CHARS = ("\\", "\t", "\r", "\n")+++def validate_avatar_url(value: str | None) -> str | None:+ """Accept an absolute https URL or a site-relative path, else reject."""+ if value is None:+ return None+ stripped = value.strip()+ if not stripped:+ return None+ if any(char in stripped for char in _AVATAR_URL_FORBIDDEN_CHARS):+ raise ValueError(+ "Avatar URL must not contain backslashes or control characters"+ )+ if stripped.startswith("//"):+ raise ValueError("Avatar URL must not be protocol-relative")+ if stripped.startswith("/"):+ return stripped+ parsed = urlparse(stripped)+ if parsed.scheme != "https" or not parsed.netloc:+ raise ValueError("Avatar URL must be an https URL or a relative path")+ return stripped-def _strip_required_soul_field(value: str) -> str:+# The soul strippers run as "before" validators, ahead of the length+# constraints, so a padded value is measured after trimming and a blank one+# fails with the field's own message. Non-str input passes through untouched+# for Pydantic to reject with its type error.+def _strip_required_soul_field(value: object) -> object:+ if not isinstance(value, str):+ return valuestripped = value.strip()if not stripped:raise ValueError("Field must not be blank")return stripped-def _strip_optional_soul_field(value: str) -> str:- return value.strip()+def _strip_optional_soul_field(value: object) -> object:+ return value.strip() if isinstance(value, str) else valueclass VoiceSample(BaseModel):@@ -71,6 +110,8 @@ class Expert(BaseModel):id: strname: stravatar_url: str | None+ # Accent color token chosen while raising; "" when unset.+ color: str = ""role: strtagline: str | Nonebio: str | None@@ -139,32 +180,73 @@ class HireResult(BaseModel):failed_preloads: list[str]+RaiseAttachmentKind = Literal["workflow", "skill"]+RaiseAttachmentSource = Literal["marketplace", "library"]+RaiseAttachmentFailureReason = Literal["unavailable", "installation_failed"]+MAX_RAISE_ATTACHMENTS = 20+WEEKLY_BUDGET_MAX_CREDITS = 1_000_000+++class RaiseAttachment(BaseModel):+ """One workflow or skill to attach while raising an expert.++ ``id`` is a store listing version UUID (marketplace), a library agent+ UUID (library workflow), or a copilot skill slug (library skill).+ Marketplace skills use a store listing version UUID; the listing's+ public name is stored on ``Expert.skills``.+ """++ kind: RaiseAttachmentKind+ source: RaiseAttachmentSource+ id: str = Field(min_length=1, max_length=100)++ # "before" so the length bounds apply to the trimmed id: a padded but+ # in-range id is accepted, and a whitespace-only one fails with the+ # message below instead of the generic min_length error.+ @field_validator("id", mode="before")+ @classmethod+ def strip_id(cls, value: object) -> object:+ if not isinstance(value, str):+ return value+ stripped = value.strip()+ if not stripped:+ raise ValueError("Attachment id must not be blank")+ return stripped+++class RaiseAttachmentFailure(BaseModel):+ kind: RaiseAttachmentKind+ source: RaiseAttachmentSource+ id: str+ reason: RaiseAttachmentFailureReason++class RaiseResult(BaseModel):- """Result of raising a blank expert. ``first_job_installed`` is only- True when a first job was requested and its install succeeded, so the- client can surface partial success instead of a silent no-op. The stable- failure reason distinguishes a listing withdrawn mid-flow from an install- failure."""+ """Result of raising a blank expert.++ Attachments are validated before the expert row is created. A later+ install failure is non-fatal and listed in ``failed_attachments`` so+ the client can surface partial success.+ """expert: Expert- first_job_installed: bool- first_job_failure_reason: Literal["unavailable", "installation_failed"] | None+ failed_attachments: list[RaiseAttachmentFailure] = []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)+ identity: str = Field(min_length=1, max_length=EXPERT_IDENTITY_MAX_LENGTH)voice_preferences: str = Field(max_length=_EXPERT_SOUL_TEXT_MAX_LENGTH)boundaries: str = Field(max_length=_EXPERT_SOUL_TEXT_MAX_LENGTH)- @field_validator("name", "identity")+ @field_validator("name", "identity", mode="before")@classmethod- def strip_required_fields(cls, value: str) -> str:+ def strip_required_fields(cls, value: object) -> object:return _strip_required_soul_field(value)- @field_validator("voice_preferences", "boundaries")+ @field_validator("voice_preferences", "boundaries", mode="before")@classmethod- def strip_optional_fields(cls, value: str) -> str:+ def strip_optional_fields(cls, value: object) -> object:return _strip_optional_soul_field(value)@@ -177,7 +259,7 @@ class ExpertSoulFieldsPatch(BaseModel):"""identity: str | None = Field(- default=None, min_length=1, max_length=_EXPERT_IDENTITY_MAX_LENGTH+ default=None, min_length=1, max_length=EXPERT_IDENTITY_MAX_LENGTH)voice_preferences: str | None = Field(default=None, max_length=_EXPERT_SOUL_TEXT_MAX_LENGTH@@ -186,17 +268,15 @@ class ExpertSoulFieldsPatch(BaseModel):default=None, max_length=_EXPERT_SOUL_TEXT_MAX_LENGTH)- @field_validator("identity")+ @field_validator("identity", mode="before")@classmethod- def strip_required_fields(cls, value: str | None) -> str | None:- if value is None:- return None+ def strip_required_fields(cls, value: object) -> object:return _strip_required_soul_field(value)- @field_validator("voice_preferences", "boundaries")+ @field_validator("voice_preferences", "boundaries", mode="before")@classmethod- def strip_optional_fields(cls, value: str | None) -> str | None:- return None if value is None else _strip_optional_soul_field(value)+ def strip_optional_fields(cls, value: object) -> object:+ return _strip_optional_soul_field(value)def encode_voice_preferences(description: str, samples: list[VoiceSample]) -> str:diff --git a/autogpt_platform/backend/backend/api/features/experts/models_test.py b/autogpt_platform/backend/backend/api/features/experts/models_test.pyindex 3ecd29f08c..b5dffdc12b 100644--- a/autogpt_platform/backend/backend/api/features/experts/models_test.py+++ b/autogpt_platform/backend/backend/api/features/experts/models_test.py@@ -4,10 +4,14 @@ import pytestfrom pydantic import ValidationErrorfrom backend.api.features.experts.models import (+ EXPERT_IDENTITY_MAX_LENGTH,+ ExpertSoulFieldsPatch,ExpertSoulUpdate,+ RaiseAttachment,VoiceSample,decode_voice_preferences,encode_voice_preferences,+ validate_avatar_url,)@@ -111,3 +115,108 @@ def test_decode_mixed_sample_list_keeps_only_valid_samples():assert description == "Clear and direct."assert samples == [VoiceSample(label="Punchy", text="Ship it.")]+++def test_raise_attachment_strips_id():+ attachment = RaiseAttachment(kind="workflow", source="library", id=" agent-1 ")+ assert attachment.id == "agent-1"+++def test_raise_attachment_rejects_blank_id():+ with pytest.raises(ValidationError):+ RaiseAttachment(kind="skill", source="library", id=" ")+++def test_raise_attachment_strips_before_length_bounds():+ # The trim runs ahead of max_length, so padding around a full-length id+ # cannot push it over the limit.+ padded = f" {'a' * 100} "++ attachment = RaiseAttachment(kind="skill", source="library", id=padded)++ assert attachment.id == "a" * 100+++def test_raise_attachment_blank_id_reports_the_blank_message():+ # Whitespace satisfies min_length, so the blank check must own the error.+ with pytest.raises(ValidationError) as error:+ RaiseAttachment(kind="skill", source="library", id=" ")++ assert "Attachment id must not be blank" in str(error.value)+++def test_raise_attachment_rejects_non_string_id():+ # The "before" validator hands a non-str through so Pydantic still owns+ # the type error.+ with pytest.raises(ValidationError):+ RaiseAttachment.model_validate({"kind": "skill", "source": "library", "id": 7})+++def test_soul_update_strips_before_length_bounds():+ padded_name = f" {'n' * 100} "+ padded_identity = f" {'i' * EXPERT_IDENTITY_MAX_LENGTH} "++ soul = ExpertSoulUpdate(+ name=padded_name,+ identity=padded_identity,+ voice_preferences="",+ boundaries="",+ )++ assert soul.name == "n" * 100+ assert soul.identity == "i" * EXPERT_IDENTITY_MAX_LENGTH+++def test_soul_patch_strips_before_length_bounds():+ patch = ExpertSoulFieldsPatch(identity=f" {'i' * EXPERT_IDENTITY_MAX_LENGTH} ")++ assert patch.identity == "i" * EXPERT_IDENTITY_MAX_LENGTH+++def test_soul_patch_leaves_omitted_fields_none():+ patch = ExpertSoulFieldsPatch()++ assert patch.identity is None+ assert patch.voice_preferences is None+ assert patch.boundaries is None+++ ("value", "expected"),+ [+ (None, None),+ (" ", None),+ (" https://cdn.example.com/a.png ", "https://cdn.example.com/a.png"),+ ("/experts/maria.svg", "/experts/maria.svg"),+ ],+)+def test_validate_avatar_url_accepts_https_and_relative_paths(+ value: str | None, expected: str | None+):+ assert validate_avatar_url(value) == expected+++ "value",+ [+ # Plaintext http would fetch the avatar unencrypted.+ "http://cdn.example.com/a.png",+ # Browsers read "\" as "/" for special schemes, so these look+ # site-relative but resolve to a third-party origin.+ "/\\tracker.example/avatar.png",+ "https:/\\tracker.example/avatar.png",+ # Tab/CR/LF are stripped by the URL parser, turning this into+ # "//evil.example/x.png" — protocol-relative to another origin.+ "/\t/evil.example/x.png",+ "//evil.example/x.png",+ "javascript:alert(1)",+ "data:image/svg+xml;base64,PHN2Zz48L3N2Zz4=",+ "ftp://example.com/x.png",+ # https with no host is not fetchable from our origin.+ "https:///a.png",+ "https://",+ ],+)+def test_validate_avatar_url_rejects_unsafe_values(value: str):+ with pytest.raises(ValueError):+ validate_avatar_url(value)diff --git a/autogpt_platform/backend/backend/api/features/experts/raise_attachments.py b/autogpt_platform/backend/backend/api/features/experts/raise_attachments.pynew file mode 100644index 0000000000..3dacc1a339--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/experts/raise_attachments.py@@ -0,0 +1,328 @@+"""Validate and install raise-flow workflow/skill attachments."""++import logging++import prisma.errors+import prisma.models+from pydantic import BaseModel++from backend.api.features.experts.models import (+ RaiseAttachment,+ RaiseAttachmentFailure,+ RaiseAttachmentFailureReason,+ RaiseAttachmentKind,+ RaiseAttachmentSource,+)+from backend.api.features.library import db as library_db+from backend.api.features.store.store_listing_versions import (+ installable_store_version_where,+)+from backend.copilot.tools.skills import (+ get_default_skill_with_body,+ read_user_skill_with_body,+)+from backend.data.db import transaction+from backend.util.exceptions import ExpertNotFoundError, NotFoundError++logger = logging.getLogger(__name__)++_WORKFLOW_ROW_INCLUDE = {"LibraryAgent": True, "StoreListingVersion": True}+++class RaiseAttachmentUnavailableError(Exception):+ def __init__(+ self,+ kind: RaiseAttachmentKind,+ source: RaiseAttachmentSource,+ attachment_id: str,+ ):+ super().__init__(f"{source} {kind} {attachment_id} not found or unavailable")+ self.kind = kind+ self.source = source+ self.id = attachment_id+++class ResolvedWorkflow(BaseModel):+ attachment: RaiseAttachment+ store_listing_version_id: str | None+ library_agent_id: str | None+++class ResolvedRaiseAttachments(BaseModel):+ workflows: list[ResolvedWorkflow]+ skill_names: list[str]+++async def resolve_attachments(+ user_id: str, attachments: list[RaiseAttachment]+) -> ResolvedRaiseAttachments:+ """Pre-check every attachment. Raises if any item is not attachable."""+ workflows: list[ResolvedWorkflow] = []+ skill_names: list[str] = []+ seen: set[tuple[str, str, str]] = set()+ for attachment in attachments:+ key = _dedupe_key(attachment)+ if key in seen:+ continue+ seen.add(key)+ if attachment.kind == "workflow":+ workflows.append(await _resolve_workflow(user_id, attachment))+ continue+ skill_names.append(await _resolve_skill_name(user_id, attachment))+ return ResolvedRaiseAttachments(workflows=workflows, skill_names=skill_names)+++async def install_workflows(+ user_id: str,+ expert_id: str,+ workflows: list[ResolvedWorkflow],+) -> list[RaiseAttachmentFailure]:+ """Install validated workflows. Failures are reported, not fatal."""+ failed: list[RaiseAttachmentFailure] = []+ for resolved in workflows:+ try:+ await _install_resolved_workflow(user_id, expert_id, resolved)+ except (RaiseAttachmentUnavailableError, NotFoundError):+ failed.append(_failure(resolved.attachment, "unavailable"))+ logger.warning(+ f"{resolved.attachment.source} workflow {resolved.attachment.id} "+ f"became unavailable while raising expert #{expert_id} "+ f"for user #{user_id}"+ )+ except Exception:+ failed.append(_failure(resolved.attachment, "installation_failed"))+ logger.exception(+ f"Failed to install {resolved.attachment.source} workflow "+ f"{resolved.attachment.id} on raised expert #{expert_id} "+ f"for user #{user_id}"+ )+ return failed+++async def install_marketplace_workflow(+ user_id: str,+ expert_id: str,+ store_listing_version_id: str,+) -> None:+ """Install a marketplace listing and attach it to the expert.++ A concurrent or retried raise can win the ExpertWorkflow insert; that row+ is the same attachment, so a unique violation counts as success. The+ re-check runs after the failed transaction has rolled back, never inside+ it — Postgres aborts a transaction on the first failed statement.+ """+ try:+ await _install_marketplace_workflow_once(+ user_id, expert_id, store_listing_version_id+ )+ except prisma.errors.UniqueViolationError:+ raced = await _existing_listing_workflow(expert_id, store_listing_version_id)+ if raced is None:+ raise+++async def _install_marketplace_workflow_once(+ user_id: str,+ expert_id: str,+ store_listing_version_id: str,+) -> None:+ async with transaction() as tx:+ is_installable = (+ await library_db.is_store_listing_version_available_for_install(+ store_listing_version_id,+ tx=tx,+ lock_rows=True,+ )+ )+ if not is_installable:+ raise RaiseAttachmentUnavailableError(+ "workflow", "marketplace", store_listing_version_id+ )+ expert = await tx.expert.find_first(+ where={+ "id": expert_id,+ "ownerUserId": user_id,+ "isTemplate": False,+ "isArchived": False,+ }+ )+ if expert is None:+ raise ExpertNotFoundError(expert_id)+ library_agent = await library_db.add_store_agent_to_library_in_transaction(+ store_listing_version_id, user_id, tx+ )+ await tx.expertworkflow.create(+ data={+ "expertId": expert_id,+ "storeListingVersionId": store_listing_version_id,+ "libraryAgentId": library_agent.id,+ }+ )+++async def _resolve_workflow(+ user_id: str, attachment: RaiseAttachment+) -> ResolvedWorkflow:+ if attachment.source == "marketplace":+ await _validate_marketplace_listing(attachment.id, "workflow")+ return ResolvedWorkflow(+ attachment=attachment,+ store_listing_version_id=attachment.id,+ library_agent_id=None,+ )+ row = await _library_agent_row(user_id, attachment.id)+ return ResolvedWorkflow(+ attachment=attachment,+ store_listing_version_id=await _matching_store_listing_version_id(row),+ library_agent_id=row.id,+ )+++async def _resolve_skill_name(user_id: str, attachment: RaiseAttachment) -> str:+ if attachment.source == "marketplace":+ await _validate_marketplace_listing(attachment.id, "skill")+ listing = await prisma.models.StoreListingVersion.prisma().find_unique(+ where={"id": attachment.id}+ )+ if listing is None:+ raise RaiseAttachmentUnavailableError("skill", "marketplace", attachment.id)+ return listing.name+ slug = attachment.id.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 None:+ raise RaiseAttachmentUnavailableError("skill", "library", slug)+ return stored.name+++async def _validate_marketplace_listing(+ store_listing_version_id: str, kind: RaiseAttachmentKind+) -> None:+ is_installable = await library_db.is_store_listing_version_available_for_install(+ store_listing_version_id+ )+ if not is_installable:+ raise RaiseAttachmentUnavailableError(+ kind, "marketplace", store_listing_version_id+ )+++async def _install_resolved_workflow(+ user_id: str, expert_id: str, resolved: ResolvedWorkflow+) -> None:+ if resolved.store_listing_version_id and resolved.library_agent_id is None:+ await install_marketplace_workflow(+ user_id, expert_id, resolved.store_listing_version_id+ )+ return+ if resolved.library_agent_id is None:+ raise RaiseAttachmentUnavailableError(+ "workflow", "library", resolved.attachment.id+ )+ await _link_library_workflow(+ expert_id, resolved.library_agent_id, resolved.store_listing_version_id+ )+++async def _link_library_workflow(+ expert_id: str,+ library_agent_id: str,+ store_listing_version_id: str | None,+) -> None:+ existing = await _existing_workflow(+ expert_id, library_agent_id, store_listing_version_id+ )+ if existing is not None:+ return+ try:+ await prisma.models.ExpertWorkflow.prisma().create(+ data={+ "expertId": expert_id,+ "libraryAgentId": library_agent_id,+ "storeListingVersionId": store_listing_version_id,+ }+ )+ except prisma.errors.UniqueViolationError:+ raced = await _existing_workflow(+ expert_id, library_agent_id, store_listing_version_id+ )+ if raced is None:+ raise+++async def _library_agent_row(+ user_id: str, library_agent_id: str+) -> prisma.models.LibraryAgent:+ row = await prisma.models.LibraryAgent.prisma().find_first(+ where={+ "id": library_agent_id,+ "userId": user_id,+ "isDeleted": False,+ }+ )+ if row is None:+ raise RaiseAttachmentUnavailableError("workflow", "library", library_agent_id)+ return row+++async def _matching_store_listing_version_id(+ row: prisma.models.LibraryAgent,+) -> str | None:+ listing = await prisma.models.StoreListingVersion.prisma().find_first(+ where={+ "agentGraphId": row.agentGraphId,+ "agentGraphVersion": row.agentGraphVersion,+ **installable_store_version_where(),+ }+ )+ return listing.id if listing else None+++async def _existing_workflow(+ expert_id: str,+ library_agent_id: str,+ store_listing_version_id: str | None,+) -> prisma.models.ExpertWorkflow | None:+ if store_listing_version_id is not None:+ by_listing = await _existing_listing_workflow(+ expert_id, store_listing_version_id+ )+ if by_listing is not None:+ return by_listing+ return await prisma.models.ExpertWorkflow.prisma().find_first(+ where={"expertId": expert_id, "libraryAgentId": library_agent_id},+ include=_WORKFLOW_ROW_INCLUDE,+ )+++async def _existing_listing_workflow(+ expert_id: str,+ store_listing_version_id: str,+) -> prisma.models.ExpertWorkflow | None:+ return await prisma.models.ExpertWorkflow.prisma().find_first(+ where={+ "expertId": expert_id,+ "storeListingVersionId": store_listing_version_id,+ },+ include=_WORKFLOW_ROW_INCLUDE,+ )+++def _dedupe_key(attachment: RaiseAttachment) -> tuple[str, str, str]:+ attachment_id = attachment.id+ if attachment.kind == "skill" and attachment.source == "library":+ attachment_id = attachment.id.strip().lower()+ return (attachment.kind, attachment.source, attachment_id)+++def _failure(+ attachment: RaiseAttachment, reason: RaiseAttachmentFailureReason+) -> RaiseAttachmentFailure:+ return RaiseAttachmentFailure(+ kind=attachment.kind,+ source=attachment.source,+ id=attachment.id,+ reason=reason,+ )diff --git a/autogpt_platform/backend/backend/api/features/experts/raise_attachments_test.py b/autogpt_platform/backend/backend/api/features/experts/raise_attachments_test.pynew file mode 100644index 0000000000..690a10cbe4--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/experts/raise_attachments_test.py@@ -0,0 +1,74 @@+from contextlib import asynccontextmanager+from types import SimpleNamespace+from unittest.mock import AsyncMock, patch++import prisma.errors+import prisma.models+import pytest++from backend.api.features.experts import raise_attachments+++def _transaction_losing_the_insert():+ tx = SimpleNamespace(+ expert=SimpleNamespace(+ find_first=AsyncMock(return_value=SimpleNamespace(id="expert-1"))+ ),+ expertworkflow=SimpleNamespace(+ create=AsyncMock(side_effect=prisma.errors.UniqueViolationError({}))+ ),+ )++ @asynccontextmanager+ async def fake_transaction(*args, **kwargs):+ yield tx++ return fake_transaction+++@asynccontextmanager+async def _marketplace_install_race(existing: object | None):+ """Marketplace install where a concurrent raise already made the row."""+ workflow_client = SimpleNamespace(find_first=AsyncMock(return_value=existing))+ with (+ patch.object(+ raise_attachments, "transaction", _transaction_losing_the_insert()+ ),+ patch.object(+ raise_attachments.library_db,+ "is_store_listing_version_available_for_install",+ new_callable=AsyncMock,+ return_value=True,+ ),+ patch.object(+ raise_attachments.library_db,+ "add_store_agent_to_library_in_transaction",+ new_callable=AsyncMock,+ return_value=SimpleNamespace(id="library-agent-1"),+ ),+ patch.object(+ prisma.models.ExpertWorkflow, "prisma", return_value=workflow_client+ ),+ ):+ yield workflow_client+++async def test_install_marketplace_workflow_accepts_concurrent_winner():+ winner = SimpleNamespace(id="workflow-1")++ async with _marketplace_install_race(winner) as workflow_client:+ await raise_attachments.install_marketplace_workflow(+ "user-1", "expert-1", "slv-1"+ )++ workflow_client.find_first.assert_awaited_once()+++async def test_install_marketplace_workflow_reraises_race_without_winner():+ async with _marketplace_install_race(None) as workflow_client:+ with pytest.raises(prisma.errors.UniqueViolationError):+ await raise_attachments.install_marketplace_workflow(+ "user-1", "expert-1", "slv-1"+ )++ workflow_client.find_first.assert_awaited_once()diff --git a/autogpt_platform/backend/backend/api/features/experts/routes.py b/autogpt_platform/backend/backend/api/features/experts/routes.pyindex aea7a0efee..52f571f9f6 100644--- a/autogpt_platform/backend/backend/api/features/experts/routes.py+++ b/autogpt_platform/backend/backend/api/features/experts/routes.py@@ -5,6 +5,11 @@ from pydantic import BaseModel, Field, field_validatorfrom backend.api.features.experts import experts_db, schedulingfrom backend.api.features.experts.models import (+ EXPERT_AVATAR_URL_MAX_LENGTH,+ EXPERT_COLOR_MAX_LENGTH,+ EXPERT_IDENTITY_MAX_LENGTH,+ MAX_RAISE_ATTACHMENTS,+ WEEKLY_BUDGET_MAX_CREDITS,Expert,ExpertDetachPreview,ExpertIdentity,@@ -13,7 +18,9 @@ from backend.api.features.experts.models import (ExpertSoulUpdate,ExpertWorkflowRef,HireResult,+ RaiseAttachment,RaiseResult,+ validate_avatar_url,)router = APIRouter(@@ -54,17 +61,44 @@ class AssignPodRequest(BaseModel):class CreateRaisedExpertRequest(BaseModel):name: str = Field(min_length=1, max_length=100)role: str | None = Field(default=None, max_length=100)+ avatar_url: str | None = Field(+ default=None, max_length=EXPERT_AVATAR_URL_MAX_LENGTH+ )+ # Opaque design token (e.g. "sky-300"); the client maps it to a palette.+ color: str | None = Field(default=None, max_length=EXPERT_COLOR_MAX_LENGTH)voice_preferences: str | None = Field(default=None, max_length=4_000)- first_job_store_listing_version_id: str | None = Field(default=None, max_length=100)-- @field_validator("name")+ # Free-text "about them" answer from the raise flow; becomes the identity.+ about: str | None = Field(default=None, max_length=EXPERT_IDENTITY_MAX_LENGTH)+ # Credits (100 = $1). Omitted/null keeps the platform default at read time.+ weekly_budget: int | None = Field(default=None, ge=0, le=WEEKLY_BUDGET_MAX_CREDITS)+ attachments: list[RaiseAttachment] = Field(+ default_factory=list, max_length=MAX_RAISE_ATTACHMENTS+ )++ # "before" so the length bounds apply to the trimmed name and a blank one+ # fails with the message below rather than the generic min_length error.+ @field_validator("name", mode="before")@classmethod- def strip_name(cls, value: str) -> str:+ def strip_name(cls, value: object) -> object:+ if not isinstance(value, str):+ return valuestripped = value.strip()if not stripped:raise ValueError("Name must not be blank")return stripped+ @field_validator("avatar_url")+ @classmethod+ def check_avatar_url(cls, value: str | None) -> str | None:+ return validate_avatar_url(value)++ @field_validator("color", "about")+ @classmethod+ def strip_optional_text(cls, value: str | None) -> str | None:+ if value is None:+ return None+ return value.strip() or None+@router.get("/templates", operation_id="list_expert_templates")async def list_expert_templates() -> list[Expert]:@@ -111,7 +145,7 @@ async def hire_expert("/raise",operation_id="create_raised_expert",responses={- 404: {"description": "First job listing not found or unavailable"},+ 404: {"description": "Attachment not found or unavailable"},409: {"description": "Active expert limit reached"},},)@@ -125,14 +159,20 @@ async def create_raised_expert(request.name,request.role,request.voice_preferences,- request.first_job_store_listing_version_id,+ avatar_url=request.avatar_url,+ color=request.color,+ about=request.about,+ weekly_budget=request.weekly_budget,+ attachments=request.attachments,)except experts_db.FirstJobUnavailableError as e:raise fastapi.HTTPException(status_code=404,detail={- "code": "first_job_unavailable",- "store_listing_version_id": e.store_listing_version_id,+ "code": "attachment_unavailable",+ "kind": e.kind,+ "source": e.source,+ "id": e.id,},)except experts_db.ExpertLimitExceededError as e:diff --git a/autogpt_platform/backend/backend/api/features/experts/routes_test.py b/autogpt_platform/backend/backend/api/features/experts/routes_test.pyindex 43fe93ce28..d090926b92 100644--- a/autogpt_platform/backend/backend/api/features/experts/routes_test.py+++ b/autogpt_platform/backend/backend/api/features/experts/routes_test.py@@ -26,6 +26,8 @@ from backend.api.features.experts.models import (ExpertSoulUpdate,ExpertWorkflowRef,HireResult,+ RaiseAttachment,+ RaiseAttachmentFailure,RaiseResult,)from backend.api.features.experts.routes import router@@ -228,8 +230,7 @@ def test_create_raised_expert_returns_expert(new_callable=AsyncMock,return_value=RaiseResult(expert=raised,- first_job_installed=False,- first_job_failure_reason=None,+ failed_attachments=[],),)@@ -239,15 +240,24 @@ def test_create_raised_expert_returns_expert(data = response.json()assert data["expert"]["id"] == "raised-1"assert data["expert"]["source_template_id"] is None- assert data["first_job_installed"] is False- assert data["first_job_failure_reason"] is None- mock_create.assert_awaited_once_with(test_user_id, "Otto", None, None, None)+ assert data["failed_attachments"] == []+ mock_create.assert_awaited_once_with(+ test_user_id,+ "Otto",+ None,+ None,+ avatar_url=None,+ color=None,+ about=None,+ weekly_budget=None,+ attachments=[],+ )configured_snapshot.assert_match(json.dumps(data, indent=2, sort_keys=True), "expert_raise_default")-def test_create_raised_expert_passes_role_voice_and_first_job(+def test_create_raised_expert_passes_role_voice_budget_and_attachments(mocker: pytest_mock.MockerFixture,test_user_id: str,configured_snapshot: Snapshot,@@ -263,8 +273,7 @@ def test_create_raised_expert_passes_role_voice_and_first_job(voice_preferences="Warm and detailed.",workflows=[_make_workflow_ref()],),- first_job_installed=True,- first_job_failure_reason=None,+ failed_attachments=[],),)@@ -274,26 +283,73 @@ def test_create_raised_expert_passes_role_voice_and_first_job("name": "Nova","role": "Research Assistant","voice_preferences": "Warm and detailed.",- "first_job_store_listing_version_id": "listing-version-1",+ "weekly_budget": 250,+ "attachments": [+ {+ "kind": "workflow",+ "source": "marketplace",+ "id": "listing-version-1",+ }+ ],},)assert response.status_code == 200data = response.json()- assert data["first_job_installed"] is True+ assert data["failed_attachments"] == []mock_create.assert_awaited_once_with(test_user_id,"Nova","Research Assistant","Warm and detailed.",- "listing-version-1",+ avatar_url=None,+ color=None,+ about=None,+ weekly_budget=250,+ attachments=[+ RaiseAttachment(+ kind="workflow", source="marketplace", id="listing-version-1"+ )+ ],)configured_snapshot.assert_match(- json.dumps(data, indent=2, sort_keys=True), "expert_raise_first_job"+ json.dumps(data, indent=2, sort_keys=True), "expert_raise_attachments"+ )+++def test_create_raised_expert_forwards_about(+ mocker: pytest_mock.MockerFixture,+ test_user_id: str,+) -> None:+ mock_create = mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_raised_expert",+ new_callable=AsyncMock,+ return_value=RaiseResult(+ expert=_make_raised_expert(id="raised-4", name="Nova"),+ failed_attachments=[],+ ),+ )++ response = client.post(+ "/experts/raise",+ json={"name": "Nova", "about": " Always cites a source. "},+ )++ assert response.status_code == 200+ mock_create.assert_awaited_once_with(+ test_user_id,+ "Nova",+ None,+ None,+ avatar_url=None,+ color=None,+ about="Always cites a source.",+ weekly_budget=None,+ attachments=[],)-def test_create_raised_expert_reports_first_job_installation_failure(+def test_create_raised_expert_reports_attachment_installation_failure(mocker: pytest_mock.MockerFixture,test_user_id: str,configured_snapshot: Snapshot,@@ -303,8 +359,14 @@ def test_create_raised_expert_reports_first_job_installation_failure(new_callable=AsyncMock,return_value=RaiseResult(expert=_make_raised_expert(id="raised-3", name="Nova"),- first_job_installed=False,- first_job_failure_reason="installation_failed",+ failed_attachments=[+ RaiseAttachmentFailure(+ kind="workflow",+ source="marketplace",+ id="listing-version-1",+ reason="installation_failed",+ )+ ],),)@@ -312,24 +374,37 @@ def test_create_raised_expert_reports_first_job_installation_failure("/experts/raise",json={"name": "Nova",- "first_job_store_listing_version_id": "listing-version-1",+ "attachments": [+ {+ "kind": "workflow",+ "source": "marketplace",+ "id": "listing-version-1",+ }+ ],},)assert response.status_code == 200data = response.json()- assert data["first_job_installed"] is False- assert data["first_job_failure_reason"] == "installation_failed"+ assert data["failed_attachments"][0]["reason"] == "installation_failed"mock_create.assert_awaited_once_with(test_user_id,"Nova",None,None,- "listing-version-1",+ avatar_url=None,+ color=None,+ about=None,+ weekly_budget=None,+ attachments=[+ RaiseAttachment(+ kind="workflow", source="marketplace", id="listing-version-1"+ )+ ],)configured_snapshot.assert_match(json.dumps(data, indent=2, sort_keys=True),- "expert_raise_first_job_installation_failure",+ "expert_raise_attachment_installation_failure",)@@ -352,6 +427,117 @@ def test_create_raised_expert_requires_name()+def test_create_raised_expert_passes_avatar_and_color(+ mocker: pytest_mock.MockerFixture,+ test_user_id: str,+) -> None:+ mock_create = mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_raised_expert",+ new_callable=AsyncMock,+ return_value=RaiseResult(+ expert=_make_raised_expert(id="raised-3", name="Nova"),+ failed_attachments=[],+ ),+ )++ response = client.post(+ "/experts/raise",+ json={+ "name": "Nova",+ "avatar_url": " https://storage.googleapis.com/bucket/nova.png ",+ "color": " sky-300 ",+ },+ )++ assert response.status_code == 200+ mock_create.assert_awaited_once_with(+ test_user_id,+ "Nova",+ None,+ None,+ avatar_url="https://storage.googleapis.com/bucket/nova.png",+ color="sky-300",+ about=None,+ weekly_budget=None,+ attachments=[],+ )+++def test_create_raised_expert_accepts_relative_avatar_path(+ mocker: pytest_mock.MockerFixture,+) -> None:+ mock_create = mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_raised_expert",+ new_callable=AsyncMock,+ return_value=RaiseResult(+ expert=_make_raised_expert(id="raised-4", name="Otto"),+ failed_attachments=[],+ ),+ )++ response = client.post(+ "/experts/raise",+ json={"name": "Otto", "avatar_url": "/experts/maria.svg"},+ )++ assert response.status_code == 200+ assert mock_create.await_args.kwargs["avatar_url"] == "/experts/maria.svg"+++ "avatar_url",+ [+ "javascript:alert(1)",+ "data:image/svg+xml;base64,PHN2Zz48L3N2Zz4=",+ "//evil.example.com/x.png",+ "ftp://example.com/x.png",+ ],+)+def test_create_raised_expert_rejects_unsafe_avatar_url(+ mocker: pytest_mock.MockerFixture,+ avatar_url: str,+) -> None:+ mock_create = mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_raised_expert",+ new_callable=AsyncMock,+ )++ response = client.post(+ "/experts/raise",+ json={"name": "Otto", "avatar_url": avatar_url},+ )++ assert response.status_code == 422+ mock_create.assert_not_awaited()+++def test_create_raised_expert_treats_blank_avatar_and_color_as_unset(+ mocker: pytest_mock.MockerFixture,+) -> None:+ mock_create = mocker.patch(+ "backend.api.features.experts.routes.experts_db.create_raised_expert",+ new_callable=AsyncMock,+ return_value=RaiseResult(+ expert=_make_raised_expert(id="raised-5", name="Otto"),+ failed_attachments=[],+ ),+ )++ response = client.post(+ "/experts/raise",+ json={"name": "Otto", "avatar_url": " ", "color": " "},+ )++ assert response.status_code == 200+ assert mock_create.await_args.kwargs == {+ "avatar_url": None,+ "color": None,+ "about": None,+ "weekly_budget": None,+ "attachments": [],+ }++@pytest.mark.parametrize(("field", "value", "snapshot_name"),[@@ -362,10 +548,13 @@ def test_create_raised_expert_requires_name("v" * 4_001,"expert_raise_voice_preferences_too_long",),+ ("weekly_budget", -1, "expert_raise_weekly_budget_negative"),+ ("color", "c" * 33, "expert_raise_color_too_long"),+ ("about", "a" * 10_001, "expert_raise_about_too_long"),(- "first_job_store_listing_version_id",- "l" * 101,- "expert_raise_first_job_id_too_long",+ "avatar_url",+ f"https://cdn.example.com/{'a' * 2_001}.png",+ "expert_raise_avatar_url_too_long",),],)@@ -437,32 +626,42 @@ def test_create_raised_expert_at_lifetime_cap_returns_409()-def test_create_raised_expert_unavailable_first_job_returns_404(+def test_create_raised_expert_unavailable_attachment_returns_404(mocker: pytest_mock.MockerFixture,configured_snapshot: Snapshot,) -> None:mocker.patch("backend.api.features.experts.routes.experts_db.create_raised_expert",new_callable=AsyncMock,- side_effect=experts_db.FirstJobUnavailableError("listing-version-9"),+ side_effect=experts_db.FirstJobUnavailableError(+ "workflow", "marketplace", "listing-version-9"+ ),)response = client.post("/experts/raise",json={"name": "Otto",- "first_job_store_listing_version_id": "listing-version-9",+ "attachments": [+ {+ "kind": "workflow",+ "source": "marketplace",+ "id": "listing-version-9",+ }+ ],},)assert response.status_code == 404assert response.json()["detail"] == {- "code": "first_job_unavailable",- "store_listing_version_id": "listing-version-9",+ "code": "attachment_unavailable",+ "kind": "workflow",+ "source": "marketplace",+ "id": "listing-version-9",}configured_snapshot.assert_match(json.dumps(response.json(), indent=2, sort_keys=True),- "expert_raise_first_job_unavailable",+ "expert_raise_attachment_unavailable",)diff --git a/autogpt_platform/backend/migrations/20260816120000_add_expert_color/migration.sql b/autogpt_platform/backend/migrations/20260816120000_add_expert_color/migration.sqlnew file mode 100644index 0000000000..10e2533cbe--- /dev/null+++ b/autogpt_platform/backend/migrations/20260816120000_add_expert_color/migration.sql@@ -0,0 +1,2 @@+ALTER TABLE "Expert"+ADD COLUMN "color" TEXT NOT NULL DEFAULT '';diff --git a/autogpt_platform/backend/schema.prisma b/autogpt_platform/backend/schema.prismaindex f1f29105a7..8eb5f4775a 100644--- a/autogpt_platform/backend/schema.prisma+++ b/autogpt_platform/backend/schema.prisma@@ -868,6 +868,8 @@ model Expert {name StringavatarUrl String?+ // Accent color token picked while raising (e.g. "sky-300"); "" = unset.+ color String @default("")role Stringtagline String?identity Stringdiff --git a/autogpt_platform/backend/snapshots/expert_pod_assign b/autogpt_platform/backend/snapshots/expert_pod_assignindex 4b9b4ab758..c44213bdbe 100644--- a/autogpt_platform/backend/snapshots/expert_pod_assign+++ b/autogpt_platform/backend/snapshots/expert_pod_assign@@ -2,6 +2,7 @@"avatar_url": null,"bio": null,"boundaries": "Ask before external actions.",+ "color": "","id": "expert-1","identity": "You are Maria, a pragmatic marketing specialist.","is_archived": false,diff --git a/autogpt_platform/backend/snapshots/expert_raise_about_too_long b/autogpt_platform/backend/snapshots/expert_raise_about_too_longnew file mode 100644index 0000000000..4c3d871043--- /dev/null+++ b/autogpt_platform/backend/snapshots/expert_raise_about_too_long@@ -0,0 +1,16 @@+{+ "detail": [+ {+ "ctx": {+ "max_length": 10000+ },+ "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",+ "loc": [+ "body",+ "about"+ ],+ "msg": "String should have at most 10000 characters",+ "type": "string_too_long"+ }+ ]+}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_raise_first_job_installation_failure b/autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failuresimilarity index 79%rename from autogpt_platform/backend/snapshots/expert_raise_first_job_installation_failurerename to autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failureindex 6be476a48d..4bab5dc26a 100644--- a/autogpt_platform/backend/snapshots/expert_raise_first_job_installation_failure+++ b/autogpt_platform/backend/snapshots/expert_raise_attachment_installation_failure@@ -3,6 +3,7 @@"avatar_url": null,"bio": null,"boundaries": "",+ "color": "","id": "raised-3","identity": "I'm Nova, raised by you. I learn how you work and grow with you.","is_archived": false,@@ -26,6 +27,12 @@"weekly_spend": 0,"workflows": []},- "first_job_failure_reason": "installation_failed",- "first_job_installed": false+ "failed_attachments": [+ {+ "id": "listing-version-1",+ "kind": "workflow",+ "reason": "installation_failed",+ "source": "marketplace"+ }+ ]}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_raise_attachment_unavailable b/autogpt_platform/backend/snapshots/expert_raise_attachment_unavailablenew file mode 100644index 0000000000..28ad995ee5--- /dev/null+++ b/autogpt_platform/backend/snapshots/expert_raise_attachment_unavailable@@ -0,0 +1,8 @@+{+ "detail": {+ "code": "attachment_unavailable",+ "id": "listing-version-9",+ "kind": "workflow",+ "source": "marketplace"+ }+}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_raise_first_job b/autogpt_platform/backend/snapshots/expert_raise_attachmentssimilarity index 94%rename from autogpt_platform/backend/snapshots/expert_raise_first_jobrename to autogpt_platform/backend/snapshots/expert_raise_attachmentsindex c33aaa9081..8e9e3ed1fd 100644--- a/autogpt_platform/backend/snapshots/expert_raise_first_job+++ b/autogpt_platform/backend/snapshots/expert_raise_attachments@@ -3,6 +3,7 @@"avatar_url": null,"bio": null,"boundaries": "",+ "color": "","id": "raised-2","identity": "I'm Nova, raised by you. I learn how you work and grow with you.","is_archived": false,@@ -37,6 +38,5 @@}]},- "first_job_failure_reason": null,- "first_job_installed": true+ "failed_attachments": []}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_raise_avatar_url_too_long b/autogpt_platform/backend/snapshots/expert_raise_avatar_url_too_longnew file mode 100644index 0000000000..4193a5e8e0--- /dev/null+++ b/autogpt_platform/backend/snapshots/expert_raise_avatar_url_too_long@@ -0,0 +1,16 @@+{+ "detail": [+ {+ "ctx": {+ "max_length": 2000+ },+ "input": "https://cdn.example.com/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.png",+ "loc": [+ "body",+ "avatar_url"+ ],+ "msg": "String should have at most 2000 characters",+ "type": "string_too_long"+ }+ ]+}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_raise_color_too_long b/autogpt_platform/backend/snapshots/expert_raise_color_too_longnew file mode 100644index 0000000000..1b1acb72e8--- /dev/null+++ b/autogpt_platform/backend/snapshots/expert_raise_color_too_long@@ -0,0 +1,16 @@+{+ "detail": [+ {+ "ctx": {+ "max_length": 32+ },+ "input": "ccccccccccccccccccccccccccccccccc",+ "loc": [+ "body",+ "color"+ ],+ "msg": "String should have at most 32 characters",+ "type": "string_too_long"+ }+ ]+}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_raise_default b/autogpt_platform/backend/snapshots/expert_raise_defaultindex 307a09efbc..979c8433e5 100644--- a/autogpt_platform/backend/snapshots/expert_raise_default+++ b/autogpt_platform/backend/snapshots/expert_raise_default@@ -3,6 +3,7 @@"avatar_url": null,"bio": null,"boundaries": "",+ "color": "","id": "raised-1","identity": "I'm Otto, raised by you. I learn how you work and grow with you.","is_archived": false,@@ -26,6 +27,5 @@"weekly_spend": 0,"workflows": []},- "first_job_failure_reason": null,- "first_job_installed": false+ "failed_attachments": []}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_raise_first_job_id_too_long b/autogpt_platform/backend/snapshots/expert_raise_first_job_id_too_longdeleted file mode 100644index 65e98a0db1..0000000000--- a/autogpt_platform/backend/snapshots/expert_raise_first_job_id_too_long+++ /dev/null@@ -1,16 +0,0 @@-{- "detail": [- {- "ctx": {- "max_length": 100- },- "input": "lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll",- "loc": [- "body",- "first_job_store_listing_version_id"- ],- "msg": "String should have at most 100 characters",- "type": "string_too_long"- }- ]-}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_raise_first_job_unavailable b/autogpt_platform/backend/snapshots/expert_raise_first_job_unavailabledeleted file mode 100644index ad0648774f..0000000000--- a/autogpt_platform/backend/snapshots/expert_raise_first_job_unavailable+++ /dev/null@@ -1,6 +0,0 @@-{- "detail": {- "code": "first_job_unavailable",- "store_listing_version_id": "listing-version-9"- }-}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_raise_weekly_budget_negative b/autogpt_platform/backend/snapshots/expert_raise_weekly_budget_negativenew file mode 100644index 0000000000..33a087360e--- /dev/null+++ b/autogpt_platform/backend/snapshots/expert_raise_weekly_budget_negative@@ -0,0 +1,16 @@+{+ "detail": [+ {+ "ctx": {+ "ge": 0+ },+ "input": -1,+ "loc": [+ "body",+ "weekly_budget"+ ],+ "msg": "Input should be greater than or equal to 0",+ "type": "greater_than_equal"+ }+ ]+}\ No newline at end of filediff --git a/autogpt_platform/backend/snapshots/expert_soul_update b/autogpt_platform/backend/snapshots/expert_soul_updateindex b0c5719248..257e4d14b5 100644--- a/autogpt_platform/backend/snapshots/expert_soul_update+++ b/autogpt_platform/backend/snapshots/expert_soul_update@@ -2,6 +2,7 @@"avatar_url": null,"bio": null,"boundaries": "Never invent customer evidence.",+ "color": "","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_listindex c3c52119e1..007680789b 100644--- a/autogpt_platform/backend/snapshots/expert_templates_list+++ b/autogpt_platform/backend/snapshots/expert_templates_list@@ -3,6 +3,7 @@"avatar_url": null,"bio": null,"boundaries": "Ask before external actions.",+ "color": "","id": "template-1","identity": "You are Maria, a pragmatic marketing specialist.","is_archived": false,diff --git a/autogpt_platform/frontend/public/images/team-card-banner.jpg b/autogpt_platform/frontend/public/images/team-card-banner.jpgnew file mode 100644index 0000000000..132d2604caBinary files /dev/null and b/autogpt_platform/frontend/public/images/team-card-banner.jpg differdiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expertKickoff.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expertKickoff.test.tsindex 64396f08e0..10e958e7a5 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expertKickoff.test.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/expertKickoff.test.ts@@ -13,8 +13,8 @@ import {markKickoffDone,markKickoffPending,parseLegacyKickoffExpertId,+ revealKickoffMessages,shouldClearKickoffParam,- stripKickoffMessages,stripLegacyKickoffMarker,withKickoffLock,} from "../expertKickoff";@@ -35,6 +35,11 @@ function userMessage(} as UIMessage;}+function firstText(message: UIMessage): string | undefined {+ const part = message.parts.find((candidate) => candidate.type === "text");+ return part && "text" in part ? part.text : undefined;+}+function assistantMessage(id: string,text: string,@@ -120,7 +125,7 @@ describe("kickoff message identification", () => {).toBeNull();});- it("removes only kickoff messages from the transcript", () => {+ it("keeps every message in the transcript, kickoff included", () => {const kickoff = buildKickoffMessage(EXPERT_ID);const messages = [userMessage("m1", kickoff.text, kickoff.metadata),@@ -128,9 +133,40 @@ describe("kickoff message identification", () => {userMessage("m3", "Sounds good, go ahead."),];- expect(stripKickoffMessages(messages).map((message) => message.id)).toEqual(- ["m2", "m3"],- );+ const revealed = revealKickoffMessages(messages);++ expect(revealed.map((message) => message.id)).toEqual(["m1", "m2", "m3"]);+ expect(firstText(revealed[0])).toBe(kickoff.text);+ });++ it("carries non-text parts of a kickoff message through the reveal", () => {+ const kickoff = buildKickoffMessage(EXPERT_ID);+ const filePart = {+ type: "file",+ mediaType: "application/json",+ filename: "workflow.json",+ url: "https://example.test/api/workspace/files/file-1",+ };+ const message = {+ id: "m1",+ role: "user",+ parts: [{ type: "text", text: kickoff.text }, filePart],+ metadata: kickoff.metadata,+ } as UIMessage;++ const [revealed] = revealKickoffMessages([message]);++ expect(revealed.parts).toHaveLength(2);+ expect(firstText(revealed)).toBe(kickoff.text);+ expect(revealed.parts[1]).toEqual(filePart);+ });++ it("hides the legacy marker from a revealed kickoff message", () => {+ const legacy = `[[EXPERT_KICKOFF:${EXPERT_ID}]]\n\nIntroduce yourself.`;++ const revealed = revealKickoffMessages([userMessage("m1", legacy)]);++ expect(firstText(revealed[0])).toBe("Introduce yourself.");});it("strictly recognizes legacy markers for backward compatibility", () => {diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsxindex d8c9a036fb..aed28c74a8 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx@@ -220,8 +220,11 @@ export const ChatContainer = ({<CopilotChatActionsProvider onSend={guardedOnSend}><LayoutGroup id="copilot-2-chat-layout"><div className="flex h-full min-h-0 w-full flex-col px-2 lg:px-0">+ {/* The chat column runs full width: the max-w-3xl cap lives on the+ message list and the input instead, so the expert thread header+ can span edge to edge while staying aligned with the messages. */}{sessionId ? (- <div className="mx-auto flex h-full min-h-0 w-full max-w-3xl flex-col bg-[#fafafa]">+ <div className="flex h-full min-h-0 w-full flex-col bg-[#fafafa]"><ChatMessagesContainermessages={messages}status={status}@@ -251,7 +254,7 @@ export const ChatContainer = ({initial={{ opacity: 0 }}animate={{ opacity: 1 }}transition={{ duration: 0.3 }}- className="relative px-3 pb-6 pt-2"+ className="relative mx-auto w-full max-w-3xl px-3 pb-6 pt-2">{isLimitReached && (<divdiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/__tests__/ChatContainer.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/__tests__/ChatContainer.test.tsxindex dcc99ed4a5..5c5d1b9dac 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/__tests__/ChatContainer.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/__tests__/ChatContainer.test.tsx@@ -314,16 +314,21 @@ describe("ChatContainer", () => {});describe("auto-open artifact panel behavior", () => {+ // The chat column itself runs full width; the reading-width cap lives on+ // the message list and the composer, so anchor the check on the composer.+ function expectChatColumnIsCapped() {+ expect(screen.getByTestId("chat-input").closest(".max-w-3xl")).not.toBe(+ null,+ );+ }+it("does not auto-open the artifact panel on initial render", () => {mockArtifactsEnabled.mockReturnValue(true);render(<ChatContainer {...baseProps} />);expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);- const wrapper = screen.getByTestId(- "chat-messages-container",- ).parentElement;- expect(wrapper?.className).toContain("max-w-3xl");+ expectChatColumnIsCapped();});it("does not auto-open when rerendering within the same session", () => {@@ -333,10 +338,7 @@ describe("ChatContainer", () => {rerender(<ChatContainer {...baseProps} />);expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);- const wrapper = screen.getByTestId(- "chat-messages-container",- ).parentElement;- expect(wrapper?.className).toContain("max-w-3xl");+ expectChatColumnIsCapped();});it("clears the artifact preview when sessionId changes", () => {@@ -364,10 +366,7 @@ describe("ChatContainer", () => {const panel = useCopilotUIStore.getState().artifactPanel;expect(panel.activeArtifact).toBeNull();expect(panel.history).toEqual([]);- const wrapper = screen.getByTestId(- "chat-messages-container",- ).parentElement;- expect(wrapper?.className).toContain("max-w-3xl");+ expectChatColumnIsCapped();});it("does not carry a stale back stack into the next session", () => {@@ -433,10 +432,7 @@ describe("ChatContainer", () => {expect(useCopilotUIStore.getState().artifactPanel.activeArtifact,).toBeNull();- const wrapper = screen.getByTestId(- "chat-messages-container",- ).parentElement;- expect(wrapper?.className).toContain("max-w-3xl");+ expectChatColumnIsCapped();});});});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsxindex ecdd63c949..dfc064b026 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx@@ -20,7 +20,7 @@ import { TurnStatsBar } from "../JobStatsBar/TurnStatsBar";import { useElapsedTimer } from "../JobStatsBar/useElapsedTimer";import { CopilotPendingReviews } from "../CopilotPendingReviews/CopilotPendingReviews";import type { TurnStatsMap } from "../../helpers/convertChatSessionToUiMessages";-import { stripKickoffMessages } from "../../expertKickoff";+import { revealKickoffMessages } from "../../expertKickoff";import {buildRenderSegments,getTurnMessages,@@ -334,10 +334,8 @@ export function ChatMessagesContainer({fileUrlBuilder,expertIdentity,}: Props) {- // The expert-kickoff control prompt is filtered at the transcript renderer- // only so lifecycle, dedup and metadata-preserving retry logic still see it.const messages = useMemo(- () => stripKickoffMessages(allMessages),+ () => revealKickoffMessages(allMessages),[allMessages],);// The in-chat "progress in the sidebar" notice only applies to the old@@ -509,29 +507,16 @@ export function ChatMessagesContainer({});return (- <Conversation- key={sessionID ?? "new"}- resize="instant"- className={- "min-h-0 flex-1 " +- (hideForScroll- ? "opacity-0"- : "opacity-100 transition-opacity duration-100 ease-out")- }- >- <ConversationContent- className="flex min-h-full flex-1 flex-col gap-6 px-6 py-4"- style={- bottomContentPadding- ? { paddingBottom: bottomContentPadding + 24 }- : undefined- }- >- {expertIdentity && (- <div- data-testid="expert-thread-header"- className="sticky top-0 z-10 -mx-6 -mt-4 flex items-center gap-2 border-b border-zinc-200/60 bg-[#fafafa]/80 px-6 pb-3 pt-4 backdrop-blur-md"- >+ <>+ {/* Sits above the scroller rather than sticky inside it, so the bar+ spans the full chat width while its row stays aligned with the+ max-w-3xl message column. */}+ {expertIdentity && (+ <div+ data-testid="expert-thread-header"+ className="z-10 w-full border-b border-zinc-200/60 bg-[#fafafa]/80 backdrop-blur-md"+ >+ <div className="mx-auto flex w-full max-w-3xl items-center gap-2 px-6 pb-3 pt-4"><ExpertAvatarname={expertIdentity.name}avatarUrl={expertIdentity.avatarUrl}@@ -546,35 +531,130 @@ export function ChatMessagesContainer({/>)}</div>- )}- {!readOnly && hasMoreMessages && onLoadMore && (- <LoadMoreSentinel- hasMore={hasMoreMessages}- isLoading={!!isLoadingMore}- messageCount={messages.length}- onLoadMore={onLoadMore}- />- )}- {isLoading && messages.length === 0 && !isRestoringActiveSession && (- <div className="flex flex-1 items-center justify-center">- <LoadingSpinner className="text-neutral-600" />- </div>- )}- {messages.map((message, messageIndex) => {- // A run-post rides structured metadata — render a compact WorkCard- // instead of the raw markdown wall (legacy posts have no metadata- // and fall through to normal rendering).- const runMetadata = getWorkRunMetadata(message.metadata);- if (runMetadata) {- const preview = toPreview(- message.parts- .filter(- (p): p is Extract<typeof p, { type: "text" }> =>- p.type === "text",- )- .map((p) => p.text)- .join(" "),+ </div>+ )}+ <Conversation+ key={sessionID ?? "new"}+ resize="instant"+ className={+ "min-h-0 flex-1 " ++ (hideForScroll+ ? "opacity-0"+ : "opacity-100 transition-opacity duration-100 ease-out")+ }+ >+ <ConversationContent+ className="mx-auto flex min-h-full w-full max-w-3xl flex-1 flex-col gap-6 px-6 py-4"+ style={+ bottomContentPadding+ ? { paddingBottom: bottomContentPadding + 24 }+ : undefined+ }+ >+ {!readOnly && hasMoreMessages && onLoadMore && (+ <LoadMoreSentinel+ hasMore={hasMoreMessages}+ isLoading={!!isLoadingMore}+ messageCount={messages.length}+ onLoadMore={onLoadMore}+ />+ )}+ {isLoading && messages.length === 0 && !isRestoringActiveSession && (+ <div className="flex flex-1 items-center justify-center">+ <LoadingSpinner className="text-neutral-600" />+ </div>+ )}+ {messages.map((message, messageIndex) => {+ // A run-post rides structured metadata — render a compact WorkCard+ // instead of the raw markdown wall (legacy posts have no metadata+ // and fall through to normal rendering).+ const runMetadata = getWorkRunMetadata(message.metadata);+ if (runMetadata) {+ const preview = toPreview(+ message.parts+ .filter(+ (p): p is Extract<typeof p, { type: "text" }> =>+ p.type === "text",+ )+ .map((p) => p.text)+ .join(" "),+ );+ return (+ <Message+ from={message.role}+ key={message.id}+ data-message-id={message.id}+ className="duration-300 animate-in fade-in slide-in-from-bottom-2 fill-mode-both"+ >+ <MessageContent className="group-[.is-assistant]:bg-transparent">+ <WorkCard metadata={runMetadata} preview={preview} />+ </MessageContent>+ </Message>+ );+ }++ const isLastAssistant =+ messageIndex === messages.length - 1 &&+ message.role === "assistant";++ const isCurrentlyStreaming =+ isLastAssistant &&+ (status === "streaming" || status === "submitted");++ const isAssistant = message.role === "assistant";++ const nextMessage = messages[messageIndex + 1];+ const isLastInTurn =+ isAssistant &&+ messageIndex <= messages.length - 1 &&+ (!nextMessage || nextMessage.role === "user");+ // data-cursor / data-status parts are internal bookkeeping —+ // strip them before any render/split logic so they never reach+ // the user UI. data-status surfaces via ThinkingIndicator.+ const renderableParts = message.parts.filter(+ (p) => p.type !== "data-cursor" && p.type !== "data-status",);+ const textParts = renderableParts.filter(+ (p): p is Extract<typeof p, { type: "text" }> =>+ p.type === "text",+ );+ const lastTextPart = textParts[textParts.length - 1];+ const markerType =+ lastTextPart !== undefined+ ? parseSpecialMarkers(lastTextPart.text).markerType+ : null;+ const hasErrorMarker =+ markerType === "error" || markerType === "retryable_error";+ const showActions =+ isLastInTurn &&+ !isCurrentlyStreaming &&+ textParts.length > 0 &&+ !hasErrorMarker;++ const fileParts = renderableParts.filter(+ (p): p is FileUIPart => p.type === "file",+ );++ // For finalized assistant messages, split into reasoning + response.+ // During streaming, show everything normally with tool collapsing.+ const isFinalized =+ message.role === "assistant" && !isCurrentlyStreaming;+ const { reasoning, response } = isFinalized+ ? splitReasoningAndResponse(renderableParts)+ : { reasoning: [] as MessagePart[], response: renderableParts };+ const hasReasoning = reasoning.length > 0;++ // Note: when interactive tools are pinned from reasoning into response,+ // this index approximates their position (used only for React keys).+ const responseStartIndex = renderableParts.length - response.length;+ const responseSegments =+ message.role === "assistant"+ ? buildRenderSegments(response, responseStartIndex)+ : null;+ const reasoningSegments = hasReasoning+ ? buildRenderSegments(reasoning, 0)+ : null;+return (<Messagefrom={message.role}@@ -582,265 +662,195 @@ export function ChatMessagesContainer({data-message-id={message.id}className="duration-300 animate-in fade-in slide-in-from-bottom-2 fill-mode-both">- <MessageContent className="group-[.is-assistant]:bg-transparent">- <WorkCard metadata={runMetadata} preview={preview} />+ <MessageContent+ className={+ "text-[1rem] leading-relaxed " ++ (isBrainDumpEnabled+ ? "group-[.is-user]:rounded-3xl group-[.is-user]:bg-gradient-to-br group-[.is-user]:from-[#f3edff] group-[.is-user]:to-[#e4d4ff] group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-[#3b1e75] group-[.is-user]:[border-bottom-right-radius:0.5rem] "+ : "group-[.is-user]:rounded-xl group-[.is-user]:bg-purple-100 group-[.is-user]:px-3 group-[.is-user]:py-2.5 group-[.is-user]:text-slate-900 group-[.is-user]:[border-bottom-right-radius:0] ") ++ "group-[.is-user]:[&_h1]:text-lg group-[.is-user]:[&_h1]:font-semibold group-[.is-user]:[&_h2]:text-lg group-[.is-user]:[&_h2]:font-semibold group-[.is-user]:[&_h3]:text-lg group-[.is-user]:[&_h3]:font-semibold group-[.is-user]:[&_h4]:text-lg group-[.is-user]:[&_h4]:font-semibold group-[.is-user]:[&_h5]:text-lg group-[.is-user]:[&_h5]:font-semibold group-[.is-user]:[&_h6]:text-lg group-[.is-user]:[&_h6]:font-semibold " ++ "group-[.is-assistant]:bg-transparent group-[.is-assistant]:text-slate-900"+ }+ >+ {hasReasoning && reasoningSegments && (+ <StepsCollapse>+ {renderSegments(reasoningSegments, message.id, {+ fileUrlBuilder,+ forceArtifacts: readOnly,+ readOnly,+ })}+ </StepsCollapse>+ )}+ {responseSegments+ ? renderSegments(responseSegments, message.id, {+ onRetry: isLastAssistant ? onRetry : undefined,+ fileUrlBuilder,+ forceArtifacts: readOnly,+ readOnly,+ })+ : renderableParts.map((part, i) => (+ <MessagePartRenderer+ key={`${message.id}-${i}`}+ part={part}+ messageID={message.id}+ partIndex={i}+ onRetry={isLastAssistant ? onRetry : undefined}+ fileUrlBuilder={fileUrlBuilder}+ forceArtifacts={readOnly}+ readOnly={readOnly}+ />+ ))}+ {isLastInTurn && !isCurrentlyStreaming && (+ <TurnStatsBar+ turnMessages={getTurnMessages(messages, messageIndex)}+ elapsedSeconds={+ messageIndex === messages.length - 1+ ? frozenElapsedRef.current+ : undefined+ }+ stats={turnStats?.get(message.id)}+ />+ )}+ {isLastAssistant && showIndicator && indicator}</MessageContent>+ {!readOnly &&+ message.role === "user" &&+ sessionChatStatus === "queued" &&+ (() => {+ const stats = turnStats?.get(message.id);+ if (!stats?.isLatestUserMessage) {+ return null;+ }+ return (+ <MessageActions+ className="mt-1 items-center justify-end gap-1.5"+ data-testid="queue-status-row"+ >+ <QueueBadge sessionID={sessionID ?? null} />+ </MessageActions>+ );+ })()}+ {message.role === "user" && textParts.length > 0 && (+ <MessageActions className="mt-1 items-center justify-end gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100">+ {(() => {+ const createdAt = turnStats?.get(message.id)?.createdAt;+ if (!createdAt) return null;+ const date = new Date(createdAt);+ if (Number.isNaN(date.getTime())) return null;+ return (+ <span className="text-[11px] tabular-nums text-neutral-500">+ {date.toLocaleString(undefined, {+ dateStyle: "medium",+ timeStyle: "short",+ })}+ </span>+ );+ })()}+ <CopyButton+ text={textParts.map((p) => p.text).join("\n")}+ />+ </MessageActions>+ )}+ {fileParts.length > 0 && (+ <MessageAttachments+ files={fileParts}+ isUser={message.role === "user"}+ forceArtifacts={readOnly}+ filePattern={filePattern}+ readOnly={readOnly}+ />+ )}+ {!readOnly && showActions && (+ <AssistantMessageActions+ message={message}+ sessionID={sessionID ?? null}+ />+ )}+ {readOnly && showActions && (+ <MessageActions className="mt-1 items-center justify-start gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100">+ <CopyButton+ text={textParts.map((p) => p.text).join("\n")}+ />+ </MessageActions>+ )}</Message>);- }-- const isLastAssistant =- messageIndex === messages.length - 1 &&- message.role === "assistant";-- const isCurrentlyStreaming =- isLastAssistant &&- (status === "streaming" || status === "submitted");-- const isAssistant = message.role === "assistant";-- const nextMessage = messages[messageIndex + 1];- const isLastInTurn =- isAssistant &&- messageIndex <= messages.length - 1 &&- (!nextMessage || nextMessage.role === "user");- // data-cursor / data-status parts are internal bookkeeping —- // strip them before any render/split logic so they never reach- // the user UI. data-status surfaces via ThinkingIndicator.- const renderableParts = message.parts.filter(- (p) => p.type !== "data-cursor" && p.type !== "data-status",- );- const textParts = renderableParts.filter(- (p): p is Extract<typeof p, { type: "text" }> => p.type === "text",- );- const lastTextPart = textParts[textParts.length - 1];- const markerType =- lastTextPart !== undefined- ? parseSpecialMarkers(lastTextPart.text).markerType- : null;- const hasErrorMarker =- markerType === "error" || markerType === "retryable_error";- const showActions =- isLastInTurn &&- !isCurrentlyStreaming &&- textParts.length > 0 &&- !hasErrorMarker;-- const fileParts = renderableParts.filter(- (p): p is FileUIPart => p.type === "file",- );-- // For finalized assistant messages, split into reasoning + response.- // During streaming, show everything normally with tool collapsing.- const isFinalized =- message.role === "assistant" && !isCurrentlyStreaming;- const { reasoning, response } = isFinalized- ? splitReasoningAndResponse(renderableParts)- : { reasoning: [] as MessagePart[], response: renderableParts };- const hasReasoning = reasoning.length > 0;-- // Note: when interactive tools are pinned from reasoning into response,- // this index approximates their position (used only for React keys).- const responseStartIndex = renderableParts.length - response.length;- const responseSegments =- message.role === "assistant"- ? buildRenderSegments(response, responseStartIndex)- : null;- const reasoningSegments = hasReasoning- ? buildRenderSegments(reasoning, 0)- : null;-- return (+ })}+ {!readOnly && hasActiveTaskList && (+ <div className="px-1">+ <TaskListNotice />+ </div>+ )}+ {!readOnly && showIndicator && lastMessage?.role !== "assistant" && (<Message- from={message.role}- key={message.id}- data-message-id={message.id}+ from="assistant"className="duration-300 animate-in fade-in slide-in-from-bottom-2 fill-mode-both">- <MessageContent- className={- "text-[1rem] leading-relaxed " +- (isBrainDumpEnabled- ? "group-[.is-user]:rounded-3xl group-[.is-user]:bg-gradient-to-br group-[.is-user]:from-[#f3edff] group-[.is-user]:to-[#e4d4ff] group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-[#3b1e75] group-[.is-user]:[border-bottom-right-radius:0.5rem] "- : "group-[.is-user]:rounded-xl group-[.is-user]:bg-purple-100 group-[.is-user]:px-3 group-[.is-user]:py-2.5 group-[.is-user]:text-slate-900 group-[.is-user]:[border-bottom-right-radius:0] ") +- "group-[.is-user]:[&_h1]:text-lg group-[.is-user]:[&_h1]:font-semibold group-[.is-user]:[&_h2]:text-lg group-[.is-user]:[&_h2]:font-semibold group-[.is-user]:[&_h3]:text-lg group-[.is-user]:[&_h3]:font-semibold group-[.is-user]:[&_h4]:text-lg group-[.is-user]:[&_h4]:font-semibold group-[.is-user]:[&_h5]:text-lg group-[.is-user]:[&_h5]:font-semibold group-[.is-user]:[&_h6]:text-lg group-[.is-user]:[&_h6]:font-semibold " +- "group-[.is-assistant]:bg-transparent group-[.is-assistant]:text-slate-900"- }- >- {hasReasoning && reasoningSegments && (- <StepsCollapse>- {renderSegments(reasoningSegments, message.id, {- fileUrlBuilder,- forceArtifacts: readOnly,- readOnly,- })}- </StepsCollapse>- )}- {responseSegments- ? renderSegments(responseSegments, message.id, {- onRetry: isLastAssistant ? onRetry : undefined,- fileUrlBuilder,- forceArtifacts: readOnly,- readOnly,- })- : renderableParts.map((part, i) => (- <MessagePartRenderer- key={`${message.id}-${i}`}- part={part}- messageID={message.id}- partIndex={i}- onRetry={isLastAssistant ? onRetry : undefined}- fileUrlBuilder={fileUrlBuilder}- forceArtifacts={readOnly}- readOnly={readOnly}- />- ))}- {isLastInTurn && !isCurrentlyStreaming && (- <TurnStatsBar- turnMessages={getTurnMessages(messages, messageIndex)}- elapsedSeconds={- messageIndex === messages.length - 1- ? frozenElapsedRef.current- : undefined- }- stats={turnStats?.get(message.id)}- />- )}- {isLastAssistant && showIndicator && indicator}+ <MessageContent className="text-[1rem] leading-relaxed">+ {indicator}</MessageContent>- {!readOnly &&- message.role === "user" &&- sessionChatStatus === "queued" &&- (() => {- const stats = turnStats?.get(message.id);- if (!stats?.isLatestUserMessage) {- return null;- }- return (- <MessageActions- className="mt-1 items-center justify-end gap-1.5"- data-testid="queue-status-row"- >- <QueueBadge sessionID={sessionID ?? null} />- </MessageActions>- );- })()}- {message.role === "user" && textParts.length > 0 && (- <MessageActions className="mt-1 items-center justify-end gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100">- {(() => {- const createdAt = turnStats?.get(message.id)?.createdAt;- if (!createdAt) return null;- const date = new Date(createdAt);- if (Number.isNaN(date.getTime())) return null;- return (- <span className="text-[11px] tabular-nums text-neutral-500">- {date.toLocaleString(undefined, {- dateStyle: "medium",- timeStyle: "short",- })}- </span>- );- })()}- <CopyButton text={textParts.map((p) => p.text).join("\n")} />- </MessageActions>- )}- {fileParts.length > 0 && (- <MessageAttachments- files={fileParts}- isUser={message.role === "user"}- forceArtifacts={readOnly}- filePattern={filePattern}- readOnly={readOnly}- />- )}- {!readOnly && showActions && (- <AssistantMessageActions- message={message}- sessionID={sessionID ?? null}- />- )}- {readOnly && showActions && (- <MessageActions className="mt-1 items-center justify-start gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100">- <CopyButton text={textParts.map((p) => p.text).join("\n")} />- </MessageActions>- )}</Message>- );- })}- {!readOnly && hasActiveTaskList && (- <div className="px-1">- <TaskListNotice />- </div>- )}- {!readOnly && showIndicator && lastMessage?.role !== "assistant" && (- <Message- from="assistant"- className="duration-300 animate-in fade-in slide-in-from-bottom-2 fill-mode-both"- >- <MessageContent className="text-[1rem] leading-relaxed">- {indicator}- </MessageContent>- </Message>- )}- {!readOnly && isRestoringActiveSession && (- <Message from="assistant">- <MessageContent className="text-[1rem] leading-relaxed text-slate-900">- {showRestoreFallback ? (- <div className="flex flex-col gap-1 text-sm text-slate-500">- <ThinkingIndicator- active- elapsedSeconds={restoreElapsedSeconds}- statusMessage={- restoreStatusMessage ?? "Reconnecting to live stream..."- }- />- <span className="pl-6 text-xs text-slate-400">- Still syncing the latest progress.- </span>- </div>- ) : (- <div className="flex items-center gap-2 text-sm text-slate-500">- <LoadingSpinner className="h-4 w-4 text-neutral-500" />- <span>Retrieving latest messages</span>- </div>- )}- </MessageContent>- </Message>- )}- {!readOnly && graphExecId && (- <CopilotPendingReviews graphExecId={graphExecId} />- )}- {!readOnly &&- queuedMessages?.map((msg, idx) => (- <Message key={idx} from="user">- <MessageContent- className={- isBrainDumpEnabled- ? "flex flex-col gap-1 rounded-3xl border border-dashed border-[#b18aff] bg-gradient-to-br from-[#f3edff] to-[#e4d4ff] px-4 py-3 text-[1rem] leading-relaxed text-[#3b1e75] opacity-60 [border-bottom-right-radius:0.5rem]"- : "flex flex-col gap-1 rounded-xl border border-dashed border-purple-400 bg-purple-100 px-3 py-2.5 text-[1rem] leading-relaxed text-slate-900 opacity-60 [border-bottom-right-radius:0]"- }- >- <span>{msg}</span>- <span className="flex items-center gap-1 text-xs text-slate-500">- <Icon icon={Clock01Icon} className="size-3" />- Queued- </span>+ )}+ {!readOnly && isRestoringActiveSession && (+ <Message from="assistant">+ <MessageContent className="text-[1rem] leading-relaxed text-slate-900">+ {showRestoreFallback ? (+ <div className="flex flex-col gap-1 text-sm text-slate-500">+ <ThinkingIndicator+ active+ elapsedSeconds={restoreElapsedSeconds}+ statusMessage={+ restoreStatusMessage ?? "Reconnecting to live stream..."+ }+ />+ <span className="pl-6 text-xs text-slate-400">+ Still syncing the latest progress.+ </span>+ </div>+ ) : (+ <div className="flex items-center gap-2 text-sm text-slate-500">+ <LoadingSpinner className="h-4 w-4 text-neutral-500" />+ <span>Retrieving latest messages</span>+ </div>+ )}</MessageContent></Message>- ))}- {!readOnly && error && !lastAssistantHasErrorMarker && (- <details className="rounded-lg bg-red-50 p-4 text-sm text-red-700">- <summary className="cursor-pointer font-medium">- The assistant encountered an error. Please try sending your- message again.- </summary>- <pre className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words text-xs text-red-600">- {error instanceof Error ? error.message : String(error)}- </pre>- </details>- )}- </ConversationContent>- <ConversationScrollButton />- </Conversation>+ )}+ {!readOnly && graphExecId && (+ <CopilotPendingReviews graphExecId={graphExecId} />+ )}+ {!readOnly &&+ queuedMessages?.map((msg, idx) => (+ <Message key={idx} from="user">+ <MessageContent+ className={+ isBrainDumpEnabled+ ? "flex flex-col gap-1 rounded-3xl border border-dashed border-[#b18aff] bg-gradient-to-br from-[#f3edff] to-[#e4d4ff] px-4 py-3 text-[1rem] leading-relaxed text-[#3b1e75] opacity-60 [border-bottom-right-radius:0.5rem]"+ : "flex flex-col gap-1 rounded-xl border border-dashed border-purple-400 bg-purple-100 px-3 py-2.5 text-[1rem] leading-relaxed text-slate-900 opacity-60 [border-bottom-right-radius:0]"+ }+ >+ <span>{msg}</span>+ <span className="flex items-center gap-1 text-xs text-slate-500">+ <Icon icon={Clock01Icon} className="size-3" />+ Queued+ </span>+ </MessageContent>+ </Message>+ ))}+ {!readOnly && error && !lastAssistantHasErrorMarker && (+ <details className="rounded-lg bg-red-50 p-4 text-sm text-red-700">+ <summary className="cursor-pointer font-medium">+ The assistant encountered an error. Please try sending your+ message again.+ </summary>+ <pre className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words text-xs text-red-600">+ {error instanceof Error ? error.message : String(error)}+ </pre>+ </details>+ )}+ </ConversationContent>+ <ConversationScrollButton />+ </Conversation>+ </>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsxindex b7992d7bd7..07e80df8f0 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/ChatMessagesContainer.test.tsx@@ -715,14 +715,10 @@ describe("ChatMessagesContainer — readOnly mode", () => {});});-// ── expert-kickoff hiding ─────────────────────────────────────────────────+// ── expert kickoff ────────────────────────────────────────────────────────-describe("ChatMessagesContainer — expert kickoff hiding", () => {- afterEach(() => {- cleanup();- });-- it("hides the marked kickoff user message but renders the reply", () => {+describe("ChatMessagesContainer — expert kickoff", () => {+ it("shows the kickoff prompt as a user message above the reply", () => {const kickoff = buildKickoffMessage("3f8b0f7e-9f30-4a3b-a6a1-000000000001");render(<ChatMessagesContainer@@ -744,7 +740,7 @@ describe("ChatMessagesContainer — expert kickoff hiding", () => {/>,);- expect(screen.queryAllByTestId("message-user")).toHaveLength(0);+ expect(screen.getAllByTestId("message-user")).toHaveLength(1);expect(screen.getAllByTestId("message-assistant").length).toBeGreaterThan(0,);diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/expertKickoff.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/expertKickoff.tsindex e39e2d01ef..9352360463 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/expertKickoff.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/expertKickoff.ts@@ -117,8 +117,21 @@ export function shouldClearKickoffParam(return !isExpertsEnabled || (hasExpertsSettled && expertId === null);}-export function stripKickoffMessages<T extends UIMessage>(messages: T[]): T[] {- return messages.filter((message) => !isKickoffMessage(message));+// The kickoff prompt reads in the thread like any other opening message, so a+// freshly raised expert answers something visible rather than thin air. Older+// threads carry an inline marker that was never meant to be read.+export function revealKickoffMessages<T extends UIMessage>(messages: T[]): T[] {+ return messages.map((message) => {+ if (!isKickoffMessage(message)) return message;+ return {+ ...message,+ parts: message.parts.map((part) =>+ part.type === "text"+ ? { ...part, text: stripLegacyKickoffMarker(part.text) }+ : part,+ ),+ };+ });}export function kickoffStorageKey(userId: string, expertId: string): string {diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/helpers.tsindex da273f2516..2154c21471 100644--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/helpers.ts+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/helpers.ts@@ -5,6 +5,8 @@ import {Settings01Icon,} from "@hugeicons/core-free-icons";import type { IconSvgElement } from "@hugeicons/react";+import { findColorOption } from "@/app/(platform)/raise/components/ColorStep/helpers";+import { cn } from "@/lib/utils";export interface ExpertAccent {wash: string;@@ -64,3 +66,24 @@ export function getExpertAccent(role: string): ExpertAccent {}return ACCENTS.zinc;}++/** An expert raised through /raise carries the color its owner picked, which+ * outranks the role guess. Marketplace templates have no color, so they keep+ * falling back to the role accent. The role icon is never colour-derived. */+export function getRaisedExpertAccent(+ role: string,+ color: string | null | undefined,+): ExpertAccent {+ const roleAccent = getExpertAccent(role);+ const option = findColorOption(color ?? null);+ if (!option) return roleAccent;++ const wash = cn("bg-gradient-to-b to-transparent", option.washFromClassName);+ return {+ ...roleAccent,+ wash,+ washWide: wash,+ pill: cn("border", option.bubbleClassName, option.textClassName),+ icon: option.textClassName,+ };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/main.test.tsxindex ec54047b4b..e3cbd2ff5c 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/main.test.tsx@@ -1,13 +1,7 @@import { getCreateRaisedExpertMockHandler } from "@/app/api/__generated__/endpoints/experts/experts.msw";-import {- getGetV2GetSpecificAgentMockHandler,- getGetV2ListStoreAgentsMockHandler,-} from "@/app/api/__generated__/endpoints/store/store.msw";+import { getListCopilotSkillsMockHandler } from "@/app/api/__generated__/endpoints/skills/skills.msw";import type { Expert } from "@/app/api/__generated__/models/expert";import type { RaiseResult } from "@/app/api/__generated__/models/raiseResult";-import type { StoreAgent } from "@/app/api/__generated__/models/storeAgent";-import type { StoreAgentDetails } from "@/app/api/__generated__/models/storeAgentDetails";-import type { StoreAgentsResponse } from "@/app/api/__generated__/models/storeAgentsResponse";import { Toaster } from "@/components/molecules/Toast/toaster";import { server } from "@/mocks/mock-server";import { render, screen, waitFor } from "@/tests/integrations/test-utils";@@ -15,6 +9,7 @@ import userEvent from "@testing-library/user-event";import { HttpResponse, http } from "msw";import { afterEach, beforeEach, expect, test, vi } from "vitest";import RaisePage from "../page";+import { loadDraft, saveDraft, VOICE_SKIPPED_LABEL } from "../helpers";const { setFlagStatusMock } = vi.hoisted(() => ({setFlagStatusMock: vi.fn(() => ({ enabled: true, ready: true })),@@ -58,7 +53,7 @@ const raisedExpert = {id: "raised-1",name: "Otto",avatar_url: null,- role: "",+ role: "marketer",tagline: null,bio: null,skills: [],@@ -72,50 +67,8 @@ const raisedExpert = {workflows: [],} as Expert;-const installedWorkflow = {- id: "workflow-1",- store_listing_version_id: "listing-version-42",- library_agent_id: "library-agent-1",- graph_id: "graph-1",- name: "SEO Blog Writer",- description: null,-};--const storeAgent = {- slug: "seo-writer",- agent_name: "SEO Blog Writer",- agent_image: "",- creator: "acme",- creator_avatar: "",- sub_heading: "Writes optimized blog posts",- description: "",- runs: 1200,- rating: 4.8,- agent_graph_id: "graph-1",-} as StoreAgent;--const storeAgentsResponse: StoreAgentsResponse = {- agents: [storeAgent],- pagination: {- total_items: 1,- total_pages: 1,- current_page: 1,- page_size: 3,- },-};--const agentDetails = {- store_listing_version_id: "listing-version-42",- slug: "seo-writer",- agent_name: "SEO Blog Writer",- creator: "acme",-} as StoreAgentDetails;--function useStoreHandlers() {- server.use(- getGetV2ListStoreAgentsMockHandler(storeAgentsResponse),- getGetV2GetSpecificAgentMockHandler(agentDetails),- );+function raiseResult(overrides: Partial<RaiseResult> = {}): RaiseResult {+ return { expert: raisedExpert, failed_attachments: [], ...overrides };}function renderRaise() {@@ -127,25 +80,65 @@ function renderRaise() {);}-async function walkToReviewWithJob() {- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));+function mockReducedMotion() {+ vi.spyOn(window, "matchMedia").mockImplementation((query) => {+ return {+ matches: query.includes("prefers-reduced-motion"),+ media: query,+ onchange: null,+ addListener: vi.fn(),+ removeListener: vi.fn(),+ addEventListener: vi.fn(),+ removeEventListener: vi.fn(),+ dispatchEvent: vi.fn(),+ } as unknown as MediaQueryList;+ });+}- await userEvent.click(await screen.findByText("Concise and direct"));- await userEvent.click(screen.getByRole("button", { name: "Use this voice" }));+function seedAtBudget(name = "Otto") {+ saveDraft({+ step: "budget",+ hasStarted: true,+ role: "marketer",+ name,+ color: "rose-300",+ avatarUrl: "",+ about: "",+ voicePreferences: "",+ voiceLabel: VOICE_SKIPPED_LABEL,+ budget: null,+ marketplace: null,+ skills: null,+ });+}- await userEvent.click(await screen.findByText("SEO Blog Writer"));- const confirmJob = (await screen.findByRole("button", {- name: "Give me this job",- })) as HTMLButtonElement;- await waitFor(() => expect(confirmJob.disabled).toBe(false));- await userEvent.click(confirmJob);+function seedAtSkills(+ name = "Otto",+ budget: { credits: number | null } = { credits: null },+) {+ saveDraft({+ step: "skills",+ hasStarted: true,+ role: "marketer",+ name,+ color: "rose-300",+ avatarUrl: "",+ about: "",+ voicePreferences: "",+ voiceLabel: VOICE_SKIPPED_LABEL,+ budget,+ marketplace: [],+ skills: null,+ });}beforeEach(() => {window.sessionStorage.clear();+ mockReducedMotion();setFlagStatusMock.mockReturnValue({ enabled: true, ready: true });pushMock.mockClear();notFoundMock.mockClear();+ server.use(getListCopilotSkillsMockHandler([]));});afterEach(() => {@@ -162,40 +155,30 @@ test("calls notFound when the experts feature is disabled", () => {expect(notFoundMock).toHaveBeenCalled();});-test("walks name → voice → first job, posts the payload, and kicks off", async () => {+test("skips remaining kit steps, posts null budget and empty attachments, and opens copilot", async () => {let captured: unknown = null;- useStoreHandlers();server.use(getCreateRaisedExpertMockHandler(async (info) => {captured = await info.request.json();- return {- expert: { ...raisedExpert, workflows: [installedWorkflow] },- first_job_installed: true,- first_job_failure_reason: null,- } as RaiseResult;+ return raiseResult();}),);+ seedAtSkills();renderRaise();- expect(- await screen.findByRole("log", { name: "Raise expert conversation" }),- ).toBeDefined();- await walkToReviewWithJob();-+ // The skills step only renders its actions once the copilot-skills request+ // settles, which can outrun the 1s default when the suite runs under load.await userEvent.click(- await screen.findByRole("button", { name: /Bring Otto to life/ }),+ await screen.findByRole("button", { name: "Skip" }, { timeout: 5000 }),);await waitFor(() => expect(captured).not.toBeNull());expect(captured).toMatchObject({name: "Otto",- first_job_store_listing_version_id: "listing-version-42",+ role: "marketer",+ weekly_budget: null,+ attachments: [],});- expect(- (captured as { voice_preferences: string }).voice_preferences,- ).toContain("Concise and direct");- expect(captured as Record<string, unknown>).not.toHaveProperty("role");-await waitFor(() =>expect(pushMock).toHaveBeenCalledWith("/copilot?expertId=raised-1&kickoff=1",@@ -203,129 +186,45 @@ test("walks name → voice → first job, posts the payload, and kicks off", asy);});-test("posts a custom writing sample as voice preferences", async () => {+test("posts a chosen weekly budget", async () => {let captured: unknown = null;- useStoreHandlers();server.use(getCreateRaisedExpertMockHandler(async (info) => {captured = await info.request.json();- return {- expert: raisedExpert,- first_job_installed: false,- first_job_failure_reason: null,- } as RaiseResult;+ return raiseResult();}),);+ seedAtSkills("Otto", { credits: 500 });renderRaise();- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));- await userEvent.type(- await screen.findByRole("textbox", { name: "Custom voice sample" }),- "Keep every answer short, practical, and warm.",- );- await userEvent.click(screen.getByRole("button", { name: "Use this voice" }));- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );- await userEvent.click(await screen.findByRole("button", { name: /life/ }));-- await waitFor(() => expect(captured).not.toBeNull());- const payload = captured as Record<string, unknown>;- expect(payload.voice_preferences).toContain(- "Keep every answer short, practical, and warm.",- );- expect(payload).not.toHaveProperty("role");-});--test("skips voice and first job, posts a minimal payload without kickoff", async () => {- let captured: unknown = null;- useStoreHandlers();- server.use(- getCreateRaisedExpertMockHandler(async (info) => {- captured = await info.request.json();- return {- expert: raisedExpert,- first_job_installed: false,- first_job_failure_reason: null,- } as RaiseResult;- }),- );-- renderRaise();-- const nameInput = await screen.findByPlaceholderText("Type a name…");- await userEvent.type(nameInput, "Juno");- await userEvent.click(screen.getByRole("button", { name: "Name me" }));-- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );-- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );-- await userEvent.click(await screen.findByRole("button", { name: /life/ }));-- await waitFor(() => expect(captured).not.toBeNull());- expect(- (captured as Record<string, unknown>).first_job_store_listing_version_id,- ).toBeNull();- await waitFor(() =>- expect(pushMock).toHaveBeenCalledWith("/copilot?expertId=raised-1"),- );-});--test("surfaces a failed first-job install and skips kickoff", async () => {- useStoreHandlers();- server.use(- getCreateRaisedExpertMockHandler({- expert: raisedExpert,- first_job_installed: false,- first_job_failure_reason: "installation_failed",- } as RaiseResult),- );-- renderRaise();- await walkToReviewWithJob();-await userEvent.click(await screen.findByRole("button", { name: /Bring Otto to life/ }),);- expect(- await screen.findByText("Couldn't set up Otto's first job"),- ).toBeDefined();- expect(screen.getByText(/from their page anytime/)).toBeDefined();+ await waitFor(() => expect(captured).not.toBeNull());+ expect(captured).toMatchObject({+ name: "Otto",+ weekly_budget: 500,+ attachments: [],+ });await waitFor(() =>- expect(pushMock).toHaveBeenCalledWith("/copilot?expertId=raised-1"),+ expect(pushMock).toHaveBeenCalledWith(+ "/copilot?expertId=raised-1&kickoff=1",+ ),);});test("a rapid double-click on finish sends a single POST", async () => {let postCount = 0;- useStoreHandlers();server.use(getCreateRaisedExpertMockHandler(() => {postCount += 1;- return {- expert: raisedExpert,- first_job_installed: false,- first_job_failure_reason: null,- } as RaiseResult;+ return raiseResult();}),);+ seedAtSkills();renderRaise();-- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );-const finishButton = await screen.findByRole("button", { name: /life/ });await Promise.all([userEvent.click(finishButton),@@ -338,7 +237,6 @@ test("a rapid double-click on finish sends a single POST", async () => {test("unlocks finish after a raise POST fails so the user can retry", async () => {let postCount = 0;- useStoreHandlers();server.use(http.post("/api/proxy/api/experts/raise", () => {postCount += 1;@@ -346,15 +244,8 @@ test("unlocks finish after a raise POST fails so the user can retry", async () =}),);+ seedAtSkills();renderRaise();- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );-await userEvent.click(await screen.findByRole("button", { name: /life/ }));expect(await screen.findByText("Couldn't raise Otto")).toBeDefined();await waitFor(() => expect(postCount).toBe(1));@@ -365,35 +256,7 @@ test("unlocks finish after a raise POST fails so the user can retry", async () =await waitFor(() => expect(postCount).toBe(2));});-test("keeps navigation locked after success until the route unmounts", async () => {- useStoreHandlers();- server.use(- getCreateRaisedExpertMockHandler({- expert: raisedExpert,- first_job_installed: false,- first_job_failure_reason: null,- } as RaiseResult),- );-- renderRaise();- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );- await userEvent.click(await screen.findByRole("button", { name: /life/ }));-- await waitFor(() => expect(pushMock).toHaveBeenCalled());- expect(- (screen.getByRole("button", { name: "Back" }) as HTMLButtonElement)- .disabled,- ).toBe(true);-});-test("shows a friendly limit message on 409", async () => {- useStoreHandlers();server.use(http.post("/api/proxy/api/experts/raise", () =>HttpResponse.json(@@ -403,15 +266,8 @@ test("shows a friendly limit message on 409", async () => {),);+ seedAtSkills();renderRaise();-- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );await userEvent.click(await screen.findByRole("button", { name: /life/ }));expect(await screen.findByText("Your team is full")).toBeDefined();@@ -419,26 +275,17 @@ test("shows a friendly limit message on 409", async () => {});test("distinguishes the lifetime raised-expert limit", async () => {- useStoreHandlers();server.use(http.post("/api/proxy/api/experts/raise", () =>HttpResponse.json(- {- detail: { code: "raised_expert_lifetime_limit", limit: 100 },- },+ { detail: { code: "raised_expert_lifetime_limit", limit: 100 } },{ status: 409 },),),);+ seedAtSkills();renderRaise();- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );await userEvent.click(await screen.findByRole("button", { name: /life/ }));expect(@@ -448,121 +295,85 @@ test("distinguishes the lifetime raised-expert limit", async () => {expect(pushMock).not.toHaveBeenCalled();});-test("back returns to the previous step and the draft survives", async () => {- useStoreHandlers();- renderRaise();-- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));- expect(await screen.findByText("How should Otto write?")).toBeDefined();- await waitFor(() =>- expect(document.activeElement).toBe(- screen.getByRole("region", { name: "Voice step" }),+test("toasts failed attachments and still opens copilot", async () => {+ server.use(+ getCreateRaisedExpertMockHandler(+ raiseResult({+ failed_attachments: [+ {+ kind: "workflow",+ source: "marketplace",+ id: "listing-1",+ reason: "installation_failed",+ },+ ],+ }),),);- await userEvent.click(screen.getByRole("button", { name: "Back" }));+ seedAtSkills();+ renderRaise();+ await userEvent.click(+ await screen.findByRole("button", { name: /Bring Otto to life/ }),+ );- expect(await screen.findByPlaceholderText("Type a name…")).toBeDefined();- expect(screen.getByText("Otto's Soul")).toBeDefined();+ expect(await screen.findByText(/some tools didn't attach/)).toBeDefined();await waitFor(() =>- expect(document.activeElement).toBe(- screen.getByRole("region", { name: "Name step" }),+ expect(pushMock).toHaveBeenCalledWith(+ "/copilot?expertId=raised-1&kickoff=1",),);});-test("a refresh resumes the draft from session storage", async () => {- useStoreHandlers();- const first = renderRaise();-- await userEvent.click(await screen.findByRole("button", { name: "Nova" }));- expect(await screen.findByText("How should Nova write?")).toBeDefined();-- first.unmount();+test("picking a weekly budget advances to marketplace workflows", async () => {+ seedAtBudget();renderRaise();-- expect(await screen.findByText("How should Nova write?")).toBeDefined();- expect(screen.getByText("Nova's Soul")).toBeDefined();-});--test("explains when the selected first job becomes unavailable", async () => {- useStoreHandlers();- server.use(- getCreateRaisedExpertMockHandler({- expert: raisedExpert,- first_job_installed: false,- first_job_failure_reason: "unavailable",- } as RaiseResult),- );-- renderRaise();- await walkToReviewWithJob();await userEvent.click(- await screen.findByRole("button", { name: /Bring Otto to life/ }),+ await screen.findByRole("button", { name: /500 credits/ }),);expect(- await screen.findByText("SEO Blog Writer is no longer available"),+ await screen.findByRole(+ "textbox",+ { name: "Search marketplace and library workflows" },+ { timeout: 3000 },+ ),).toBeDefined();- expect(screen.getByText(/choose another first job/)).toBeDefined();+ expect(screen.getByRole("button", { name: "That's it" })).toBeDefined();});-test("keeps skip available when starter-job suggestions fail", async () => {- server.use(- http.get("/api/proxy/api/store/agents", () =>- HttpResponse.json({ detail: "Store unavailable" }, { status: 500 }),- ),- );-+test("back returns to the previous step and the draft survives", async () => {+ seedAtBudget();renderRaise();- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));- await userEvent.click(+ expect(await screen.findByRole("button", { name: "Skip" })).toBeDefined();++ await userEvent.click(screen.getByRole("button", { name: "Back" }));+ expect(await screen.findByRole("button", { name: "Skip for now" }),- );+ ).toBeDefined();- expect(await screen.findByText("Something went wrong")).toBeDefined();- expect(screen.getByRole("button", { name: "Skip for now" })).toBeDefined();+ const draft = loadDraft();+ expect(draft.step).toBe("voice");+ expect(draft.voiceLabel).toBeNull();+ expect(draft).toMatchObject({+ hasStarted: true,+ role: "marketer",+ name: "Otto",+ color: "rose-300",+ });});-test("explains when there are no starter jobs", async () => {- server.use(- getGetV2ListStoreAgentsMockHandler({- ...storeAgentsResponse,- agents: [],- pagination: { ...storeAgentsResponse.pagination, total_items: 0 },- }),- );-- renderRaise();- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );-+test("a refresh resumes the draft from session storage", async () => {+ seedAtSkills("Nova");+ const first = renderRaise();expect(- await screen.findByText(/No starter jobs are available right now/),+ await screen.findByRole("button", { name: /Bring Nova to life/ }),).toBeDefined();- expect(screen.getByRole("button", { name: "Skip for now" })).toBeDefined();-});--test("surfaces a selected job detail failure", async () => {- server.use(- getGetV2ListStoreAgentsMockHandler(storeAgentsResponse),- http.get("/api/proxy/api/store/agents/:username/:agentName", () =>- HttpResponse.json({ detail: "Details unavailable" }, { status: 500 }),- ),- );+ first.unmount();renderRaise();- await userEvent.click(await screen.findByRole("button", { name: "Otto" }));- await userEvent.click(- await screen.findByRole("button", { name: "Skip for now" }),- );- await userEvent.click(await screen.findByText("SEO Blog Writer"));- expect(await screen.findByText("Something went wrong")).toBeDefined();- expect(screen.getByText("SEO Blog Writer")).toBeDefined();- const confirm = screen.getByRole("button", { name: "Give me this job" });- expect((confirm as HTMLButtonElement).disabled).toBe(true);- expect(screen.getByRole("button", { name: "Skip for now" })).toBeDefined();+ expect(+ await screen.findByRole("button", { name: /Bring Nova to life/ }),+ ).toBeDefined();});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/raise-typewriter.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/raise-typewriter.test.tsxnew file mode 100644index 0000000000..7953dadc4b--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/raise-typewriter.test.tsx@@ -0,0 +1,111 @@+import { Toaster } from "@/components/molecules/Toast/toaster";+import { render, screen } from "@/tests/integrations/test-utils";+import { afterEach, beforeEach, expect, test, vi } from "vitest";+import { saveDraft } from "../helpers";+import RaisePage from "../page";++const { setFlagStatusMock } = vi.hoisted(() => ({+ setFlagStatusMock: vi.fn(() => ({ enabled: true, ready: true })),+}));++vi.mock("@/services/feature-flags/use-get-flag", async (importActual) => {+ const actual =+ await importActual<+ typeof import("@/services/feature-flags/use-get-flag")+ >();+ return {+ ...actual,+ useFlagStatus: (flag: string) =>+ flag === "hire-experts"+ ? setFlagStatusMock()+ : actual.useFlagStatus(flag as never),+ };+});++vi.mock("@/lib/auth/hooks/useAuth", () => ({+ useAuth: () => ({ isLoggedIn: true, user: { id: "user-1" } }),+}));++vi.mock("next/navigation", () => ({+ useRouter: () => ({ push: vi.fn() }),+ usePathname: () => "/raise",+ useSearchParams: () => new URLSearchParams(),+ useParams: () => ({}),+ notFound: () => {+ throw new Error("NEXT_NOT_FOUND");+ },+}));++function renderRaise() {+ return render(+ <>+ <RaisePage />+ <Toaster />+ </>,+ );+}++function visibleBubbleText() {+ const log = screen.getByRole("log", { name: "Raise expert conversation" });+ return Array.from(log.querySelectorAll("span[aria-hidden]")).map(+ (node) => node.textContent ?? "",+ );+}++beforeEach(() => {+ window.sessionStorage.clear();+ setFlagStatusMock.mockReturnValue({ enabled: true, ready: true });+});++afterEach(() => {+ vi.clearAllMocks();+});++test("renders restored conversation messages instantly after reload", async () => {+ saveDraft({+ step: "color",+ hasStarted: true,+ role: "marketer",+ name: "Nova",+ color: null,+ avatarUrl: null,+ about: null,+ voicePreferences: "",+ voiceLabel: null,+ budget: null,+ marketplace: null,+ skills: null,+ });++ renderRaise();++ expect(+ await screen.findByRole(+ "log",+ { name: "Raise expert conversation" },+ { timeout: 5000 },+ ),+ ).toBeDefined();++ const visible = visibleBubbleText();+ expect(+ visible.some((text) =>+ text.includes(+ "Hello, I'm Autopilot. I'll help you raise your own expert.",+ ),+ ),+ ).toBe(true);+ expect(+ visible.some((text) =>+ text.includes("First — what should your expert do for you?"),+ ),+ ).toBe(true);+ expect(+ visible.some((text) =>+ text.includes("Good pick. What do you want to call it?"),+ ),+ ).toBe(true);+ expect(+ visible.some((text) => text.includes("Nice. Now choose a color for it.")),+ ).toBe(true);+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/AboutStep/AboutStep.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/AboutStep/AboutStep.test.tsxnew file mode 100644index 0000000000..1580f388f7--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/AboutStep/AboutStep.test.tsx@@ -0,0 +1,92 @@+import { render, screen } from "@/tests/integrations/test-utils";+import userEvent from "@testing-library/user-event";+import { describe, expect, test, vi } from "vitest";+import { AboutStep } from "./AboutStep";++describe("AboutStep", () => {+ test("shows the submitted about text in the answer bubble", () => {+ render(+ <AboutStep+ submittedAbout="Focus on practical SEO wins."+ name="Nova"+ color="rose-300"+ onSubmit={vi.fn()}+ onSkip={vi.fn()}+ />,+ );++ expect(screen.getByText("Focus on practical SEO wins.")).toBeDefined();+ });++ test("shows Skipped when the about step was skipped", () => {+ render(+ <AboutStep+ submittedAbout=""+ name="Nova"+ color="rose-300"+ onSubmit={vi.fn()}+ onSkip={vi.fn()}+ />,+ );++ expect(screen.getByText("Skipped")).toBeDefined();+ expect(screen.queryByRole("textbox")).toBeNull();+ });++ test("submits trimmed about text", async () => {+ const onSubmit = vi.fn();+ render(+ <AboutStep+ submittedAbout={null}+ name="Nova"+ color={null}+ onSubmit={onSubmit}+ onSkip={vi.fn()}+ />,+ );++ await userEvent.type(+ screen.getByRole("textbox", { name: "Anything about your expert" }),+ " Ship weekly updates. ",+ );+ await userEvent.click(screen.getByRole("button", { name: "That's it" }));++ expect(onSubmit).toHaveBeenCalledWith("Ship weekly updates.");+ });++ test("shows a generic placeholder when the expert has no name", () => {+ render(+ <AboutStep+ submittedAbout={null}+ name={null}+ color={null}+ onSubmit={vi.fn()}+ onSkip={vi.fn()}+ />,+ );++ expect(+ screen.getByPlaceholderText(+ "How they should work, what you care about, anything that helps them sound like yours…",+ ),+ ).toBeDefined();+ });++ test("personalizes the placeholder with the expert name", () => {+ render(+ <AboutStep+ submittedAbout={null}+ name="Nova"+ color={null}+ onSubmit={vi.fn()}+ onSkip={vi.fn()}+ />,+ );++ expect(+ screen.getByPlaceholderText(+ "How Nova should work, what you care about, anything that helps them sound like yours…",+ ),+ ).toBeDefined();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/AboutStep/AboutStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/AboutStep/AboutStep.tsxnew file mode 100644index 0000000000..d8b3149b18--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/AboutStep/AboutStep.tsx@@ -0,0 +1,98 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Icon } from "@/components/atoms/Icon/Icon";+import { Input } from "@/components/atoms/Input/Input";+import { cn } from "@/lib/utils";+import { Forward02Icon } from "@hugeicons/core-free-icons";+import { useState } from "react";+import { bubbleClassFor } from "../ColorStep/helpers";+import { aboutPlaceholderFor } from "../RoleStep/helpers";++interface Props {+ submittedAbout: string | null;+ name: string | null;+ color: string | null;+ onSubmit: (about: string) => void;+ onSkip: () => void;+}++export function AboutStep({+ submittedAbout,+ name,+ color,+ onSubmit,+ onSkip,+}: Props) {+ const [value, setValue] = useState("");+ const trimmed = value.trim();++ if (submittedAbout !== null) {+ const isSkipped = submittedAbout === "";++ return (+ <div+ className={cn(+ "ml-auto max-w-[80%] rounded-2xl border px-4 py-3 text-[15px] leading-relaxed text-foreground",+ isSkipped && "flex w-fit items-center gap-2",+ bubbleClassFor(color) ?? "border-accent bg-accent/5",+ )}+ >+ {isSkipped ? (+ <>+ <Icon icon={Forward02Icon} size={16} aria-hidden />+ Skipped+ </>+ ) : (+ submittedAbout+ )}+ </div>+ );+ }++ function handleSubmit(event: React.FormEvent) {+ event.preventDefault();+ if (!trimmed) return;+ onSubmit(trimmed);+ }++ return (+ <form+ onSubmit={handleSubmit}+ className="flex w-full flex-col items-end gap-3"+ >+ <Input+ id="raise-about"+ type="textarea"+ label="Anything about your expert"+ hideLabel+ value={value}+ onChange={(event) => setValue(event.target.value)}+ placeholder={aboutPlaceholderFor(name)}+ rows={4}+ maxLength={2000}+ wrapperClassName="mb-0 w-full max-w-[42rem]"+ />+ <div className="flex items-center gap-2">+ <Button+ type="submit"+ variant="primary"+ size="small"+ disabled={!trimmed}+ className="h-[2.625rem] rounded-xl py-3"+ >+ That's it+ </Button>+ <Button+ type="button"+ variant="ghost"+ size="small"+ onClick={onSkip}+ className="h-[2.625rem] rounded-xl py-3"+ >+ Skip+ </Button>+ </div>+ </form>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/AssistantBubble/AssistantBubble.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/AssistantBubble/AssistantBubble.tsxindex 608a180892..effb424b60 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/components/AssistantBubble/AssistantBubble.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/AssistantBubble/AssistantBubble.tsx@@ -17,7 +17,7 @@ export function AssistantBubble({ text, typingDelayMs = 350 }: Props) {}, [typingDelayMs]);return (- <div className="max-w-[80%] self-start rounded-3xl rounded-bl-lg bg-background px-5 py-3.5 text-[15px] leading-relaxed text-foreground shadow-sm">+ <div className="max-w-[80%] self-start rounded-3xl rounded-bl-lg bg-background px-5 py-3.5 text-[15px] leading-relaxed text-foreground shadow-sm duration-500 animate-in fade-in slide-in-from-bottom-3 fill-mode-both motion-reduce:animate-none">{revealed ? (text) : (diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/AutoGPTBubble.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/AutoGPTBubble.test.tsxnew file mode 100644index 0000000000..2ee2f559be--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/AutoGPTBubble.test.tsx@@ -0,0 +1,12 @@+import { render, screen } from "@/tests/integrations/test-utils";+import { describe, expect, test } from "vitest";+import { AutoGPTBubble } from "./AutoGPTBubble";++describe("AutoGPTBubble", () => {+ test("shows Autopilot as the sender label", () => {+ render(<AutoGPTBubble text="Hello there." animate={false} />);++ expect(screen.getByText("Autopilot")).toBeDefined();+ expect(screen.queryByText("AutoGPT")).toBeNull();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/AutoGPTBubble.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/AutoGPTBubble.tsxnew file mode 100644index 0000000000..19cfcbf633--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/AutoGPTBubble.tsx@@ -0,0 +1,48 @@+"use client";++import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";+import { useTypewriter } from "./useTypewriter";++type Props = {+ id?: string;+ text: string;+ animate?: boolean;+ onTypingComplete?: () => void;+};++export function AutoGPTBubble({+ id,+ text,+ animate = true,+ onTypingComplete,+}: Props) {+ const { typed, isTyping } = useTypewriter(text, onTypingComplete, animate);++ return (+ <div+ id={id}+ className="flex max-w-[85%] flex-col gap-1.5 self-start duration-500 animate-in fade-in slide-in-from-bottom-3 fill-mode-both motion-reduce:animate-none"+ >+ <div className="flex items-end gap-2">+ <AutoGPTLogo+ hideText+ viewBox="47 -1 42 42"+ className="size-5 shrink-0"+ />+ <span className="text-sm font-medium text-foreground">Autopilot</span>+ </div>+ <p className="text-[15px] leading-relaxed text-foreground">+ <span aria-hidden>{typed}</span>+ {isTyping ? (+ <span+ aria-hidden+ className="ml-0.5 inline-block h-[1.05em] w-px translate-y-[0.15em] animate-pulse bg-foreground/70"+ />+ ) : null}+ {/* The visible text arrives a character at a time; the live region+ should announce the whole line once instead of stuttering. */}+ <span className="sr-only">{text}</span>+ </p>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/useTypewriter.test.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/useTypewriter.test.tsnew file mode 100644index 0000000000..665e939e0c--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/useTypewriter.test.ts@@ -0,0 +1,40 @@+import { act, renderHook } from "@testing-library/react";+import { afterEach, beforeEach, expect, test, vi } from "vitest";+import { useTypewriter } from "./useTypewriter";++beforeEach(() => {+ vi.useFakeTimers();+});++afterEach(() => {+ vi.useRealTimers();+});++test("renders full text immediately when disabled", () => {+ const onComplete = vi.fn();+ const { result } = renderHook(() =>+ useTypewriter("Hello world", onComplete, false),+ );++ expect(result.current.typed).toBe("Hello world");+ expect(result.current.isTyping).toBe(false);+ expect(onComplete).toHaveBeenCalledOnce();+});++test("types text character by character when enabled", () => {+ const { result } = renderHook(() => useTypewriter("Hi", undefined, true));++ expect(result.current.typed).toBe("");+ expect(result.current.isTyping).toBe(true);++ act(() => {+ vi.advanceTimersByTime(250);+ });+ expect(result.current.typed).toBe("H");++ act(() => {+ vi.advanceTimersByTime(18);+ });+ expect(result.current.typed).toBe("Hi");+ expect(result.current.isTyping).toBe(false);+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/useTypewriter.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/useTypewriter.tsnew file mode 100644index 0000000000..4c6de2b29c--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/AutoGPTBubble/useTypewriter.ts@@ -0,0 +1,52 @@+import { useEffect, useRef, useState } from "react";++const CHAR_DELAY_MS = 18;+const START_DELAY_MS = 250;++export function useTypewriter(+ text: string,+ onComplete?: () => void,+ enabled = true,+) {+ const [typedCount, setTypedCount] = useState(0);+ const onCompleteRef = useRef(onComplete);++ useEffect(() => {+ onCompleteRef.current = onComplete;+ }, [onComplete]);++ useEffect(() => {+ if (!enabled || prefersReducedMotion()) {+ setTypedCount(text.length);+ onCompleteRef.current?.();+ return;+ }++ setTypedCount(0);+ let index = 0;+ let timer: ReturnType<typeof setTimeout>;++ function type() {+ index += 1;+ setTypedCount(index);+ if (index < text.length) {+ timer = setTimeout(type, CHAR_DELAY_MS);+ return;+ }+ onCompleteRef.current?.();+ }++ timer = setTimeout(type, START_DELAY_MS);+ return () => clearTimeout(timer);+ }, [text, enabled]);++ return {+ typed: text.slice(0, typedCount),+ isTyping: typedCount < text.length,+ };+}++function prefersReducedMotion() {+ if (typeof window === "undefined") return true;+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/AvatarStep/AvatarStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/AvatarStep/AvatarStep.tsxnew file mode 100644index 0000000000..388470d013--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/AvatarStep/AvatarStep.tsx@@ -0,0 +1,97 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { cn } from "@/lib/utils";+import Image from "next/image";+import { bubbleClassFor } from "../ColorStep/helpers";+import { ACCEPTED_AVATAR_TYPES } from "./helpers";+import { useAvatarStep } from "./useAvatarStep";++interface Props {+ name: string;+ color: string | null;+ avatarUrl: string | null;+ isSkipped: boolean;+ onPick: (avatarUrl: string) => void;+ onSkip: () => void;+}++export function AvatarStep({+ name,+ color,+ avatarUrl,+ isSkipped,+ onPick,+ onSkip,+}: Props) {+ const { fileInputRef, isUploading, openFilePicker, handleFileChange } =+ useAvatarStep({ onPick });++ if (avatarUrl) {+ return (+ <div+ className={cn(+ "ml-auto flex w-fit items-center gap-3 rounded-full border py-2 pl-2 pr-5",+ bubbleClassFor(color) ?? "border-accent bg-accent/5",+ )}+ >+ <Image+ src={avatarUrl}+ alt={`${name || "Your expert"}'s picture`}+ width={40}+ height={40}+ className="size-10 rounded-full object-cover"+ unoptimized+ />+ <span className="text-sm font-medium text-foreground">+ {name ? `${name} has a face` : "Picture set"}+ </span>+ </div>+ );+ }++ if (isSkipped) {+ return (+ <div+ className={cn(+ "ml-auto w-fit rounded-full border px-5 py-2.5 text-sm font-medium text-foreground",+ bubbleClassFor(color) ?? "border-accent bg-accent/5",+ )}+ >+ No picture for now+ </div>+ );+ }++ return (+ <div className="flex flex-wrap justify-end gap-2.5">+ <input+ ref={fileInputRef}+ type="file"+ accept={ACCEPTED_AVATAR_TYPES}+ className="sr-only"+ tabIndex={-1}+ aria-hidden+ onChange={(event) => handleFileChange(event.target.files?.[0])}+ />+ <Button+ variant="secondary"+ size="small"+ className="rounded-full"+ onClick={openFilePicker}+ loading={isUploading}+ >+ Upload a picture+ </Button>+ <Button+ variant="ghost"+ size="small"+ className="rounded-full"+ onClick={onSkip}+ disabled={isUploading}+ >+ Skip+ </Button>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/AvatarStep/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/AvatarStep/helpers.tsnew file mode 100644index 0000000000..81ef36a9c8--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/AvatarStep/helpers.ts@@ -0,0 +1,4 @@+export const ACCEPTED_AVATAR_TYPES =+ "image/png,image/jpeg,image/webp,image/gif";+// The upload endpoint caps at 50MB, but an avatar has no business being large.+export const MAX_AVATAR_BYTES = 5 * 1024 * 1024;diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/AvatarStep/useAvatarStep.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/AvatarStep/useAvatarStep.tsnew file mode 100644index 0000000000..2f9dc3a30a--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/AvatarStep/useAvatarStep.ts@@ -0,0 +1,58 @@+import { usePostV2UploadSubmissionMedia } from "@/app/api/__generated__/endpoints/store/store";+import { toast } from "@/components/molecules/Toast/use-toast";+import { useRef, useState } from "react";+import { ACCEPTED_AVATAR_TYPES, MAX_AVATAR_BYTES } from "./helpers";++// The accept attribute only filters the OS picker, so the same list has to+// gate the upload for files that arrive by drag-and-drop or a widened filter.+const ACCEPTED_AVATAR_TYPE_LIST = ACCEPTED_AVATAR_TYPES.split(",");++interface Args {+ onPick: (avatarUrl: string) => void;+}++export function useAvatarStep({ onPick }: Args) {+ const fileInputRef = useRef<HTMLInputElement>(null);+ const [isUploading, setIsUploading] = useState(false);+ const { mutateAsync: uploadMedia } = usePostV2UploadSubmissionMedia();++ function openFilePicker() {+ fileInputRef.current?.click();+ }++ async function handleFileChange(file: File | undefined) {+ if (!file) return;+ if (!ACCEPTED_AVATAR_TYPE_LIST.includes(file.type)) {+ toast({+ title: "That file isn't an image",+ description: "Pick a PNG, JPEG, WEBP, or GIF.",+ variant: "destructive",+ });+ return;+ }+ if (file.size > MAX_AVATAR_BYTES) {+ toast({+ title: "That image is too large",+ description: "Pick something under 5MB.",+ variant: "destructive",+ });+ return;+ }++ setIsUploading(true);+ try {+ const response = await uploadMedia({ data: { file } });+ onPick(response.data as string);+ } catch {+ toast({+ title: "Couldn't save that picture",+ description: "Try another image, or skip for now.",+ variant: "destructive",+ });+ } finally {+ setIsUploading(false);+ }+ }++ return { fileInputRef, isUploading, openFilePicker, handleFileChange };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/BudgetStep/BudgetStep.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/BudgetStep/BudgetStep.test.tsxnew file mode 100644index 0000000000..6fce54bab1--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/BudgetStep/BudgetStep.test.tsx@@ -0,0 +1,69 @@+import { render, screen } from "@/tests/integrations/test-utils";+import userEvent from "@testing-library/user-event";+import { describe, expect, test, vi } from "vitest";+import { BudgetStep } from "./BudgetStep";++describe("BudgetStep", () => {+ test("shows Skipped when the budget step was skipped", () => {+ render(+ <BudgetStep+ color="rose-300"+ submittedBudget={{ credits: null }}+ onSubmit={vi.fn()}+ onSkip={vi.fn()}+ />,+ );++ expect(screen.getByText("Skipped")).toBeDefined();+ expect(screen.queryByRole("group", { name: "Weekly budget" })).toBeNull();+ });++ test("submits a preset immediately", async () => {+ const onSubmit = vi.fn();+ render(+ <BudgetStep+ color="rose-300"+ submittedBudget={null}+ onSubmit={onSubmit}+ onSkip={vi.fn()}+ />,+ );++ await userEvent.click(screen.getByRole("button", { name: /500 credits/ }));+ expect(onSubmit).toHaveBeenCalledWith(500);+ });++ test("submits a custom credit amount", async () => {+ const onSubmit = vi.fn();+ render(+ <BudgetStep+ color="rose-300"+ submittedBudget={null}+ onSubmit={onSubmit}+ onSkip={vi.fn()}+ />,+ );++ await userEvent.type(+ screen.getByRole("textbox", { name: "Custom weekly budget in credits" }),+ "750",+ );+ await userEvent.click(screen.getByRole("button", { name: "That's it" }));+ expect(onSubmit).toHaveBeenCalledWith(750);+ });++ test("skip keeps the platform default", async () => {+ const onSkip = vi.fn();+ render(+ <BudgetStep+ color="rose-300"+ submittedBudget={null}+ onSubmit={vi.fn()}+ onSkip={onSkip}+ />,+ );++ await userEvent.click(screen.getByRole("button", { name: "Skip" }));+ expect(onSkip).toHaveBeenCalled();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/BudgetStep/BudgetStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/BudgetStep/BudgetStep.tsxnew file mode 100644index 0000000000..7382f1f3b3--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/BudgetStep/BudgetStep.tsx@@ -0,0 +1,99 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Icon } from "@/components/atoms/Icon/Icon";+import { cn } from "@/lib/utils";+import { Forward02Icon } from "@hugeicons/core-free-icons";+import { creditsToUsdLabel, kitBudgetLabel } from "../../helpers";+import { KitBudget } from "../KitStep/KitBudget";+import { DEFAULT_BUDGET_CREDITS } from "../KitStep/helpers";+import { bubbleClassFor } from "../ColorStep/helpers";+import { useBudgetStep } from "./useBudgetStep";++interface Props {+ color: string | null;+ submittedBudget: { credits: number | null } | null;+ onSubmit: (credits: number) => void;+ onSkip: () => void;+}++export function BudgetStep({+ color,+ submittedBudget,+ onSubmit,+ onSkip,+}: Props) {+ const budget = useBudgetStep({ onSubmit });++ if (submittedBudget !== null) {+ return <BudgetAnswer credits={submittedBudget.credits} color={color} />;+ }++ return (+ <div className="flex w-full flex-col items-end gap-4">+ <KitBudget+ weeklyBudget={budget.weeklyBudget}+ customCredits={budget.customCredits}+ color={color}+ onSelect={budget.selectPreset}+ onCustomChange={budget.changeCustomCredits}+ />+ <p className="max-w-[42rem] text-right text-xs text-muted-foreground">+ Skip to use the default {DEFAULT_BUDGET_CREDITS} credits (+ {creditsToUsdLabel(DEFAULT_BUDGET_CREDITS)}/week). 0 disables the weekly+ limit.+ </p>+ <div className="flex items-center gap-2">+ {budget.canSubmitCustom ? (+ <Button+ type="button"+ variant="primary"+ size="small"+ onClick={budget.submitCustom}+ className="h-[2.625rem] rounded-xl py-3"+ >+ {"That's it"}+ </Button>+ ) : null}+ <Button+ type="button"+ variant="ghost"+ size="small"+ onClick={onSkip}+ className="h-[2.625rem] rounded-xl py-3"+ >+ Skip+ </Button>+ </div>+ </div>+ );+}++function BudgetAnswer({+ credits,+ color,+}: {+ credits: number | null;+ color: string | null;+}) {+ const label = kitBudgetLabel({ weeklyBudget: credits, attachments: [] });+ const skipped = !label;+ return (+ <div+ className={cn(+ "ml-auto max-w-[80%] rounded-2xl border px-4 py-3 text-[15px] leading-relaxed text-foreground",+ skipped && "flex w-fit items-center gap-2",+ bubbleClassFor(color) ?? "border-accent bg-accent/5",+ )}+ >+ {skipped ? (+ <>+ <Icon icon={Forward02Icon} size={16} aria-hidden />+ Skipped+ </>+ ) : (+ label+ )}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/BudgetStep/useBudgetStep.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/BudgetStep/useBudgetStep.tsnew file mode 100644index 0000000000..fd329e9873--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/BudgetStep/useBudgetStep.ts@@ -0,0 +1,38 @@+import { useState } from "react";+import { parseCredits } from "../KitStep/helpers";++interface Args {+ onSubmit: (credits: number) => void;+}++export function useBudgetStep({ onSubmit }: Args) {+ const [weeklyBudget, setWeeklyBudget] = useState<number | null>(null);+ const [customCredits, setCustomCredits] = useState("");+ const parsedCustom = parseCredits(customCredits);++ function selectPreset(credits: number) {+ setWeeklyBudget(credits);+ setCustomCredits("");+ onSubmit(credits);+ }++ function changeCustomCredits(value: string) {+ setCustomCredits(value);+ const parsed = parseCredits(value);+ if (parsed !== null) setWeeklyBudget(parsed);+ }++ function submitCustom() {+ if (parsedCustom === null) return;+ onSubmit(parsedCustom);+ }++ return {+ weeklyBudget,+ customCredits,+ canSubmitCustom: parsedCustom !== null,+ selectPreset,+ changeCustomCredits,+ submitCustom,+ };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/ColorStep/ColorStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/ColorStep/ColorStep.tsxnew file mode 100644index 0000000000..b76fb7c76f--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/ColorStep/ColorStep.tsx@@ -0,0 +1,38 @@+"use client";++import { cn } from "@/lib/utils";+import { COLOR_OPTIONS, findColorOption } from "./helpers";++interface Props {+ selectedColor: string | null;+ onPick: (colorId: string) => void;+}++export function ColorStep({ selectedColor, onPick }: Props) {+ const selected = findColorOption(selectedColor);+ const options = selected ? [selected] : COLOR_OPTIONS;++ return (+ <div+ role="group"+ aria-label="Expert color"+ className="flex flex-wrap justify-end gap-2.5"+ >+ {options.map((option) => (+ <button+ key={option.id}+ type="button"+ onClick={() => onPick(option.id)}+ disabled={Boolean(selected)}+ aria-label={option.label}+ aria-pressed={selected ? true : undefined}+ className={cn(+ "size-8 rounded-full transition-transform",+ option.swatchClassName,+ selected ? null : "hover:scale-110",+ )}+ />+ ))}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/ColorStep/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/ColorStep/helpers.tsnew file mode 100644index 0000000000..6e867c6172--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/ColorStep/helpers.ts@@ -0,0 +1,259 @@+export interface ColorOption {+ id: string;+ label: string;+ // Written out in full so Tailwind's scanner keeps the class.+ swatchClassName: string;+ // Gradient stop for a surface washed in the expert's color.+ washFromClassName: string;+ // Border + tint for answers rendered in the expert's color.+ bubbleClassName: string;+ // Readable text at label sizes; the -300 swatch is too light for copy.+ textClassName: string;+ // Selected-card treatment: a deeper border over the lightest tint.+ selectedCardClassName: string;+ // Hover and focus treatment, so interaction never falls back to black.+ interactiveCardClassName: string;+ // Fill and outline for a selected row inside a grouped list, whose grey+ // dividers would otherwise be the only edge it has.+ rowSelectedClassName: string;+ // Ramp fed to the dither shader: shades 400 → 300 → 100 → white.+ ditherColors: readonly [string, string, string, string];+}++export const COLOR_OPTIONS: ColorOption[] = [+ {+ id: "rose-300",+ label: "Rose",+ swatchClassName: "bg-rose-300",+ washFromClassName: "from-rose-100",+ bubbleClassName: "border-rose-300 bg-rose-50",+ textClassName: "text-rose-700",+ selectedCardClassName: "border-rose-400 bg-rose-50 ring-2 ring-rose-200",+ interactiveCardClassName:+ "hover:border-rose-300 focus-within:ring-rose-200",+ rowSelectedClassName: "bg-rose-50 ring-1 ring-inset ring-rose-300",+ ditherColors: ["#fb7185", "#fda4af", "#ffe4e6", "#ffffff"],+ },+ {+ id: "red-300",+ label: "Red",+ swatchClassName: "bg-red-300",+ washFromClassName: "from-red-100",+ bubbleClassName: "border-red-300 bg-red-50",+ textClassName: "text-red-700",+ selectedCardClassName: "border-red-400 bg-red-50 ring-2 ring-red-200",+ interactiveCardClassName: "hover:border-red-300 focus-within:ring-red-200",+ rowSelectedClassName: "bg-red-50 ring-1 ring-inset ring-red-300",+ ditherColors: ["#f87171", "#fca5a5", "#fee2e2", "#ffffff"],+ },+ {+ id: "orange-300",+ label: "Orange",+ swatchClassName: "bg-orange-300",+ washFromClassName: "from-orange-100",+ bubbleClassName: "border-orange-300 bg-orange-50",+ textClassName: "text-orange-700",+ selectedCardClassName:+ "border-orange-400 bg-orange-50 ring-2 ring-orange-200",+ interactiveCardClassName:+ "hover:border-orange-300 focus-within:ring-orange-200",+ rowSelectedClassName: "bg-orange-50 ring-1 ring-inset ring-orange-300",+ ditherColors: ["#fb923c", "#fdba74", "#ffedd5", "#ffffff"],+ },+ {+ id: "amber-300",+ label: "Amber",+ swatchClassName: "bg-amber-300",+ washFromClassName: "from-amber-100",+ bubbleClassName: "border-amber-300 bg-amber-50",+ textClassName: "text-amber-700",+ selectedCardClassName: "border-amber-400 bg-amber-50 ring-2 ring-amber-200",+ interactiveCardClassName:+ "hover:border-amber-300 focus-within:ring-amber-200",+ rowSelectedClassName: "bg-amber-50 ring-1 ring-inset ring-amber-300",+ ditherColors: ["#fbbf24", "#fcd34d", "#fef3c7", "#ffffff"],+ },+ {+ id: "yellow-300",+ label: "Yellow",+ swatchClassName: "bg-yellow-300",+ washFromClassName: "from-yellow-100",+ bubbleClassName: "border-yellow-300 bg-yellow-50",+ textClassName: "text-yellow-700",+ selectedCardClassName:+ "border-yellow-400 bg-yellow-50 ring-2 ring-yellow-200",+ interactiveCardClassName:+ "hover:border-yellow-300 focus-within:ring-yellow-200",+ rowSelectedClassName: "bg-yellow-50 ring-1 ring-inset ring-yellow-300",+ ditherColors: ["#facc15", "#fde047", "#fef9c3", "#ffffff"],+ },+ {+ id: "lime-300",+ label: "Lime",+ swatchClassName: "bg-lime-300",+ washFromClassName: "from-lime-100",+ bubbleClassName: "border-lime-300 bg-lime-50",+ textClassName: "text-lime-700",+ selectedCardClassName: "border-lime-400 bg-lime-50 ring-2 ring-lime-200",+ interactiveCardClassName:+ "hover:border-lime-300 focus-within:ring-lime-200",+ rowSelectedClassName: "bg-lime-50 ring-1 ring-inset ring-lime-300",+ ditherColors: ["#a3e635", "#bef264", "#ecfccb", "#ffffff"],+ },+ {+ id: "green-300",+ label: "Green",+ swatchClassName: "bg-green-300",+ washFromClassName: "from-green-100",+ bubbleClassName: "border-green-300 bg-green-50",+ textClassName: "text-green-700",+ selectedCardClassName: "border-green-400 bg-green-50 ring-2 ring-green-200",+ interactiveCardClassName:+ "hover:border-green-300 focus-within:ring-green-200",+ rowSelectedClassName: "bg-green-50 ring-1 ring-inset ring-green-300",+ ditherColors: ["#4ade80", "#86efac", "#dcfce7", "#ffffff"],+ },+ {+ id: "emerald-300",+ label: "Emerald",+ swatchClassName: "bg-emerald-300",+ washFromClassName: "from-emerald-100",+ bubbleClassName: "border-emerald-300 bg-emerald-50",+ textClassName: "text-emerald-700",+ selectedCardClassName:+ "border-emerald-400 bg-emerald-50 ring-2 ring-emerald-200",+ interactiveCardClassName:+ "hover:border-emerald-300 focus-within:ring-emerald-200",+ rowSelectedClassName: "bg-emerald-50 ring-1 ring-inset ring-emerald-300",+ ditherColors: ["#34d399", "#6ee7b7", "#d1fae5", "#ffffff"],+ },+ {+ id: "teal-300",+ label: "Teal",+ swatchClassName: "bg-teal-300",+ washFromClassName: "from-teal-100",+ bubbleClassName: "border-teal-300 bg-teal-50",+ textClassName: "text-teal-700",+ selectedCardClassName: "border-teal-400 bg-teal-50 ring-2 ring-teal-200",+ interactiveCardClassName:+ "hover:border-teal-300 focus-within:ring-teal-200",+ rowSelectedClassName: "bg-teal-50 ring-1 ring-inset ring-teal-300",+ ditherColors: ["#2dd4bf", "#5eead4", "#ccfbf1", "#ffffff"],+ },+ {+ id: "cyan-300",+ label: "Cyan",+ swatchClassName: "bg-cyan-300",+ washFromClassName: "from-cyan-100",+ bubbleClassName: "border-cyan-300 bg-cyan-50",+ textClassName: "text-cyan-700",+ selectedCardClassName: "border-cyan-400 bg-cyan-50 ring-2 ring-cyan-200",+ interactiveCardClassName:+ "hover:border-cyan-300 focus-within:ring-cyan-200",+ rowSelectedClassName: "bg-cyan-50 ring-1 ring-inset ring-cyan-300",+ ditherColors: ["#22d3ee", "#67e8f9", "#cffafe", "#ffffff"],+ },+ {+ id: "sky-300",+ label: "Sky",+ swatchClassName: "bg-sky-300",+ washFromClassName: "from-sky-100",+ bubbleClassName: "border-sky-300 bg-sky-50",+ textClassName: "text-sky-700",+ selectedCardClassName: "border-sky-400 bg-sky-50 ring-2 ring-sky-200",+ interactiveCardClassName: "hover:border-sky-300 focus-within:ring-sky-200",+ rowSelectedClassName: "bg-sky-50 ring-1 ring-inset ring-sky-300",+ ditherColors: ["#38bdf8", "#7dd3fc", "#e0f2fe", "#ffffff"],+ },+ {+ id: "blue-300",+ label: "Blue",+ swatchClassName: "bg-blue-300",+ washFromClassName: "from-blue-100",+ bubbleClassName: "border-blue-300 bg-blue-50",+ textClassName: "text-blue-700",+ selectedCardClassName: "border-blue-400 bg-blue-50 ring-2 ring-blue-200",+ interactiveCardClassName:+ "hover:border-blue-300 focus-within:ring-blue-200",+ rowSelectedClassName: "bg-blue-50 ring-1 ring-inset ring-blue-300",+ ditherColors: ["#60a5fa", "#93c5fd", "#dbeafe", "#ffffff"],+ },+ {+ id: "indigo-300",+ label: "Indigo",+ swatchClassName: "bg-indigo-300",+ washFromClassName: "from-indigo-100",+ bubbleClassName: "border-indigo-300 bg-indigo-50",+ textClassName: "text-indigo-700",+ selectedCardClassName:+ "border-indigo-400 bg-indigo-50 ring-2 ring-indigo-200",+ interactiveCardClassName:+ "hover:border-indigo-300 focus-within:ring-indigo-200",+ rowSelectedClassName: "bg-indigo-50 ring-1 ring-inset ring-indigo-300",+ ditherColors: ["#818cf8", "#a5b4fc", "#e0e7ff", "#ffffff"],+ },+ {+ id: "violet-300",+ label: "Violet",+ swatchClassName: "bg-violet-300",+ washFromClassName: "from-violet-100",+ bubbleClassName: "border-violet-300 bg-violet-50",+ textClassName: "text-violet-700",+ selectedCardClassName:+ "border-violet-400 bg-violet-50 ring-2 ring-violet-200",+ interactiveCardClassName:+ "hover:border-violet-300 focus-within:ring-violet-200",+ rowSelectedClassName: "bg-violet-50 ring-1 ring-inset ring-violet-300",+ ditherColors: ["#a78bfa", "#c4b5fd", "#ede9fe", "#ffffff"],+ },+ {+ id: "fuchsia-300",+ label: "Fuchsia",+ swatchClassName: "bg-fuchsia-300",+ washFromClassName: "from-fuchsia-100",+ bubbleClassName: "border-fuchsia-300 bg-fuchsia-50",+ textClassName: "text-fuchsia-700",+ selectedCardClassName:+ "border-fuchsia-400 bg-fuchsia-50 ring-2 ring-fuchsia-200",+ interactiveCardClassName:+ "hover:border-fuchsia-300 focus-within:ring-fuchsia-200",+ rowSelectedClassName: "bg-fuchsia-50 ring-1 ring-inset ring-fuchsia-300",+ ditherColors: ["#e879f9", "#f0abfc", "#fae8ff", "#ffffff"],+ },+];++export function findColorOption(id: string | null) {+ return COLOR_OPTIONS.find((option) => option.id === id) ?? null;+}++export function ditherColorsFor(id: string | null) {+ return findColorOption(id)?.ditherColors;+}++export function bubbleClassFor(id: string | null) {+ return findColorOption(id)?.bubbleClassName;+}++export function swatchClassFor(id: string | null) {+ return findColorOption(id)?.swatchClassName;+}++export function washFromClassFor(id: string | null) {+ return findColorOption(id)?.washFromClassName;+}++export function textClassFor(id: string | null) {+ return findColorOption(id)?.textClassName;+}++export function selectedCardClassFor(id: string | null) {+ return findColorOption(id)?.selectedCardClassName;+}++export function interactiveCardClassFor(id: string | null) {+ return findColorOption(id)?.interactiveCardClassName;+}++export function rowSelectedClassFor(id: string | null) {+ return findColorOption(id)?.rowSelectedClassName;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/DitheredWaves.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/DitheredWaves.tsxnew file mode 100644index 0000000000..28b1f8961e--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/DitheredWaves.tsx@@ -0,0 +1,22 @@+"use client";++import { cn } from "@/lib/utils";+import { DITHER_COLORS } from "./helpers";+import { useDitheredWaves } from "./useDitheredWaves";++type Props = {+ colors?: readonly string[];+ className?: string;+};++export function DitheredWaves({ colors = DITHER_COLORS, className }: Props) {+ const canvasRef = useDitheredWaves(colors);++ return (+ <canvas+ ref={canvasRef}+ aria-hidden+ className={cn("block h-full w-full bg-muted", className)}+ />+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/helpers.tsnew file mode 100644index 0000000000..8dd529b334--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/helpers.ts@@ -0,0 +1,77 @@+import * as Sentry from "@sentry/nextjs";+import { FRAGMENT_SHADER, VERTEX_SHADER } from "./shaders";++export const DITHER_COLORS = [+ "#a78bfa",+ "#c4b5fd",+ "#ede9fe",+ "#ffffff",+] as const;++export function hexToRgb(hex: string): [number, number, number] {+ const value = parseInt(hex.replace("#", ""), 16);+ return [+ ((value >> 16) & 255) / 255,+ ((value >> 8) & 255) / 255,+ (value & 255) / 255,+ ];+}++export function createDitherProgram(gl: WebGL2RenderingContext) {+ const vert = compileShader(gl, gl.VERTEX_SHADER, VERTEX_SHADER);+ const frag = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);+ const program = gl.createProgram();++ if (!vert || !frag || !program) {+ if (vert) gl.deleteShader(vert);+ if (frag) gl.deleteShader(frag);+ if (program) gl.deleteProgram(program);+ return null;+ }++ gl.attachShader(program, vert);+ gl.attachShader(program, frag);+ gl.linkProgram(program);++ // The program is never re-linked, so the linked binary is all we need to keep.+ gl.detachShader(program, vert);+ gl.detachShader(program, frag);+ gl.deleteShader(vert);+ gl.deleteShader(frag);++ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {+ reportShaderFailure("link", gl.getProgramInfoLog(program));+ gl.deleteProgram(program);+ return null;+ }++ return program;+}++function compileShader(+ gl: WebGL2RenderingContext,+ type: number,+ source: string,+) {+ const shader = gl.createShader(type);+ if (!shader) return null;++ gl.shaderSource(shader, source);+ gl.compileShader(shader);++ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {+ reportShaderFailure("compile", gl.getShaderInfoLog(shader));+ gl.deleteShader(shader);+ return null;+ }++ return shader;+}++function reportShaderFailure(stage: string, infoLog: string | null) {+ Sentry.captureException(+ new Error(+ `DitheredWaves shader ${stage} failed: ${infoLog || "no info log available"}`,+ ),+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/shaders.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/shaders.tsnew file mode 100644index 0000000000..127db86b8f--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/shaders.ts@@ -0,0 +1,132 @@+export const VERTEX_SHADER = `#version 300 es+const vec2 verts[3] = vec2[](+ vec2(-1.0, -1.0),+ vec2( 3.0, -1.0),+ vec2(-1.0, 3.0)+);+void main() {+ gl_Position = vec4(verts[gl_VertexID], 0.0, 1.0);+}`;++export const FRAGMENT_SHADER = `#version 300 es+precision highp float;++uniform vec2 uResolution;+uniform float u_time;+uniform vec3 uColor0;+uniform vec3 uColor1;+uniform vec3 uColor2;+uniform vec3 uColor3;+uniform vec3 uPrevColor0;+uniform vec3 uPrevColor1;+uniform vec3 uPrevColor2;+uniform vec3 uPrevColor3;+// Position of the wipe front along the bottom-left → top-right diagonal.+uniform float uWipe;++out vec4 fragColor;++vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }+vec4 permute(vec4 x) { return mod289(((x * 34.0) + 1.0) * x); }+vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }+vec2 fade(vec2 t) { return t * t * t * (t * (t * 6.0 - 15.0) + 10.0); }++float cnoise(vec2 P) {+ vec4 Pi = floor(P.xyxy) + vec4(0.0, 0.0, 1.0, 1.0);+ vec4 Pf = fract(P.xyxy) - vec4(0.0, 0.0, 1.0, 1.0);+ Pi = mod289(Pi);+ vec4 ix = Pi.xzxz;+ vec4 iy = Pi.yyww;+ vec4 fx = Pf.xzxz;+ vec4 fy = Pf.yyww;+ vec4 i = permute(permute(ix) + iy);+ vec4 gx = fract(i * (1.0 / 41.0)) * 2.0 - 1.0;+ vec4 gy = abs(gx) - 0.5;+ vec4 tx = floor(gx + 0.5);+ gx = gx - tx;+ vec2 g00 = vec2(gx.x, gy.x);+ vec2 g10 = vec2(gx.y, gy.y);+ vec2 g01 = vec2(gx.z, gy.z);+ vec2 g11 = vec2(gx.w, gy.w);+ vec4 norm = taylorInvSqrt(vec4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));+ g00 *= norm.x;+ g01 *= norm.y;+ g10 *= norm.z;+ g11 *= norm.w;+ float n00 = dot(g00, vec2(fx.x, fy.x));+ float n10 = dot(g10, vec2(fx.y, fy.y));+ float n01 = dot(g01, vec2(fx.z, fy.z));+ float n11 = dot(g11, vec2(fx.w, fy.w));+ vec2 fade_xy = fade(Pf.xy);+ vec2 n_x = mix(vec2(n00, n01), vec2(n10, n11), fade_xy.x);+ float n_xy = mix(n_x.x, n_x.y, fade_xy.y);+ return 2.3 * n_xy;+}++const int OCTAVES = 8;++float fbm(vec2 p) {+ float value = -0.2;+ float amplitude = 1.0;+ float frequency = 2.5;+ for (int i = 0; i < OCTAVES; i++) {+ value += amplitude * abs(cnoise(p));+ p *= frequency;+ amplitude *= 0.35;+ }+ return value;+}++float pattern(vec2 p) {+ vec2 p2 = p - u_time * 0.012;+ return fbm(p - fbm(p + fbm(p2)));+}++float bayer8x8(vec2 fragCoord) {+ const float m[64] = float[64](+ 0.0/64.0, 32.0/64.0, 8.0/64.0, 40.0/64.0, 2.0/64.0, 34.0/64.0, 10.0/64.0, 42.0/64.0,+ 48.0/64.0, 16.0/64.0, 56.0/64.0, 24.0/64.0, 50.0/64.0, 18.0/64.0, 58.0/64.0, 26.0/64.0,+ 12.0/64.0, 44.0/64.0, 4.0/64.0, 36.0/64.0, 14.0/64.0, 46.0/64.0, 6.0/64.0, 38.0/64.0,+ 60.0/64.0, 28.0/64.0, 52.0/64.0, 20.0/64.0, 62.0/64.0, 30.0/64.0, 54.0/64.0, 22.0/64.0,+ 3.0/64.0, 35.0/64.0, 11.0/64.0, 43.0/64.0, 1.0/64.0, 33.0/64.0, 9.0/64.0, 41.0/64.0,+ 51.0/64.0, 19.0/64.0, 59.0/64.0, 27.0/64.0, 49.0/64.0, 17.0/64.0, 57.0/64.0, 25.0/64.0,+ 15.0/64.0, 47.0/64.0, 7.0/64.0, 39.0/64.0, 13.0/64.0, 45.0/64.0, 5.0/64.0, 37.0/64.0,+ 63.0/64.0, 31.0/64.0, 55.0/64.0, 23.0/64.0, 61.0/64.0, 29.0/64.0, 53.0/64.0, 21.0/64.0+ );+ int x = int(fragCoord.x) % 8;+ int y = int(fragCoord.y) % 8;+ return m[y * 8 + x];+}++vec3 ramp(float t, vec3 c0, vec3 c1, vec3 c2, vec3 c3) {+ float s = t * 3.0;+ if (s < 1.0) return mix(c0, c1, s);+ if (s < 2.0) return mix(c1, c2, s - 1.0);+ return mix(c2, c3, s - 2.0);+}++void main() {+ vec2 uv = gl_FragCoord.xy / uResolution.xy;+ uv -= 0.5;+ uv.x *= uResolution.x / uResolution.y;++ float f = pattern(uv);+ float lum = clamp(f, 0.0, 1.0);++ float threshold = bayer8x8(gl_FragCoord.xy) - 0.75;+ float v = clamp(lum + threshold, 0.0, 1.0);+ v = floor(v * 3.0 + 0.5) / 3.0;++ // 0 at the bottom-left corner, 1 at the top-right, so the wipe front+ // sweeps the whole surface on one diagonal pass.+ vec2 st = gl_FragCoord.xy / uResolution.xy;+ float diagonal = (st.x + st.y) * 0.5;+ // Edges must stay ordered: smoothstep is undefined for edge0 >= edge1, so the+ // descending ramp is expressed as an inverted ascending one.+ float front = 1.0 - smoothstep(uWipe - 0.12, uWipe + 0.12, diagonal);++ vec3 previous = ramp(v, uPrevColor0, uPrevColor1, uPrevColor2, uPrevColor3);+ vec3 next = ramp(v, uColor0, uColor1, uColor2, uColor3);++ fragColor = vec4(mix(previous, next, front), 1.0);+}`;diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/useDitheredWaves.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/useDitheredWaves.tsnew file mode 100644index 0000000000..6a7a94b558--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/DitheredWaves/useDitheredWaves.ts@@ -0,0 +1,107 @@+import { useEffect, useRef } from "react";+import { createDitherProgram, DITHER_COLORS, hexToRgb } from "./helpers";++const WIPE_DURATION_MS = 1100;+// Matches the smoothstep width in the shader, so the front starts fully off+// one corner and ends fully off the other.+const WIPE_EDGE = 0.12;++export function useDitheredWaves(colors: readonly string[]) {+ const canvasRef = useRef<HTMLCanvasElement>(null);+ const colorsKey = colors.join(",");+ const colorsRef = useRef(colors);+ const previousColorsRef = useRef(colors);+ const wipeStartRef = useRef<number | null>(null);++ useEffect(() => {+ if (colorsKey === colorsRef.current.join(",")) return;+ previousColorsRef.current = colorsRef.current;+ colorsRef.current = colors;+ wipeStartRef.current = performance.now();+ }, [colors, colorsKey]);++ useEffect(() => {+ const canvas = canvasRef.current;+ const gl = canvas?.getContext("webgl2", { antialias: false });+ if (!canvas || !gl) return;++ const program = createDitherProgram(gl);+ if (!program) return;++ gl.useProgram(program);+ const vao = gl.createVertexArray();+ gl.bindVertexArray(vao);++ const resolutionLocation = gl.getUniformLocation(program, "uResolution");+ const timeLocation = gl.getUniformLocation(program, "u_time");+ const wipeLocation = gl.getUniformLocation(program, "uWipe");+ const colorLocations = DITHER_COLORS.map((_, index) =>+ gl.getUniformLocation(program, `uColor${index}`),+ );+ const previousColorLocations = DITHER_COLORS.map((_, index) =>+ gl.getUniformLocation(program, `uPrevColor${index}`),+ );++ let width = 0;+ let height = 0;++ function resize() {+ if (!canvas) return;+ const rect = canvas.getBoundingClientRect();+ const pixelRatio = Math.min(window.devicePixelRatio || 1, 2);+ width = Math.max(1, Math.floor(rect.width * pixelRatio));+ height = Math.max(1, Math.floor(rect.height * pixelRatio));+ canvas.width = width;+ canvas.height = height;+ }++ resize();+ const observer = new ResizeObserver(resize);+ observer.observe(canvas);++ const start = performance.now();+ let frame = 0;++ function paletteAt(+ locations: (WebGLUniformLocation | null)[],+ palette: readonly string[],+ ) {+ if (!gl) return;+ locations.forEach((location, index) => {+ const [r, g, b] = hexToRgb(palette[index] ?? DITHER_COLORS[index]);+ gl.uniform3f(location, r, g, b);+ });+ }++ function render() {+ if (!gl) return;+ const now = performance.now();+ const wipeStart = wipeStartRef.current;+ const progress = wipeStart+ ? Math.min(1, (now - wipeStart) / WIPE_DURATION_MS)+ : 1;++ gl.viewport(0, 0, width, height);+ gl.uniform2f(resolutionLocation, width, height);+ gl.uniform1f(timeLocation, (now - start) / 1000);+ // Map 0..1 onto a range that clears the smoothstep band at both ends.+ gl.uniform1f(wipeLocation, progress * (1 + 2 * WIPE_EDGE) - WIPE_EDGE);+ paletteAt(colorLocations, colorsRef.current);+ paletteAt(previousColorLocations, previousColorsRef.current);++ gl.drawArrays(gl.TRIANGLES, 0, 3);+ frame = requestAnimationFrame(render);+ }++ render();++ return () => {+ cancelAnimationFrame(frame);+ observer.disconnect();+ gl.deleteProgram(program);+ gl.deleteVertexArray(vao);+ };+ }, []);++ return canvasRef;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/FirstJobStep/FirstJobStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/FirstJobStep/FirstJobStep.tsxdeleted file mode 100644index 35caf66673..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/raise/components/FirstJobStep/FirstJobStep.tsx+++ /dev/null@@ -1,124 +0,0 @@-"use client";--import type { StoreAgent } from "@/app/api/__generated__/models/storeAgent";-import { Button } from "@/components/atoms/Button/Button";-import { Icon } from "@/components/atoms/Icon/Icon";-import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";-import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";-import { selectableCardClassName } from "@/components/organisms/VoicePicker/styles";-import { cn } from "@/lib/utils";-import { CheckmarkCircle02Icon } from "@hugeicons/core-free-icons";-import { useFirstJobStep } from "./useFirstJobStep";--type Props = {- onPick: (job: { id: string; name: string }) => void;- onSkip: () => void;-};--export function FirstJobStep({ onPick, onSkip }: Props) {- const {- suggestions,- isLoading,- suggestionsHaveError,- selectedJobHasError,- selected,- select,- isResolving,- canConfirm,- confirm,- retrySuggestions,- retrySelectedJob,- } = useFirstJobStep({ onPick });-- return (- <div className="flex flex-col gap-3">- {suggestionsHaveError ? (- <ErrorCard- context="starter jobs"- hint="We couldn't load the available jobs. You can retry or skip for now."- onRetry={retrySuggestions}- />- ) : isLoading ? (- <div className="flex flex-col gap-3">- {[0, 1, 2].map((i) => (- <Skeleton key={i} className="h-20 w-full rounded-2xl" />- ))}- </div>- ) : suggestions.length > 0 ? (- suggestions.map((agent) => (- <JobCard- key={agent.slug}- agent={agent}- isSelected={selected?.slug === agent.slug}- onSelect={() => select(agent)}- />- ))- ) : (- <p className="rounded-2xl border border-border bg-background p-5 text-sm text-muted-foreground">- No starter jobs are available right now. You can skip for now.- </p>- )}-- {selectedJobHasError && !suggestionsHaveError ? (- <ErrorCard- context="that starter job"- hint="We couldn't load that job. Pick another, retry, or skip for now."- onRetry={retrySelectedJob}- />- ) : null}-- <footer className="flex items-center justify-between gap-3">- <Button variant="ghost" onClick={onSkip}>- Skip for now- </Button>- <Button- variant="primary"- onClick={confirm}- disabled={!canConfirm}- loading={isResolving}- className="rounded-full"- >- Give me this job- </Button>- </footer>- </div>- );-}--type JobCardProps = {- agent: StoreAgent;- isSelected: boolean;- onSelect: () => void;-};--function JobCard({ agent, isSelected, onSelect }: JobCardProps) {- return (- <button- type="button"- onClick={onSelect}- aria-pressed={isSelected}- className={cn(- selectableCardClassName(isSelected, true),- "w-full p-4 text-left",- )}- >- <div className="flex items-center justify-between gap-3">- <span className="text-[15px] font-medium text-foreground">- {agent.agent_name}- </span>- {isSelected ? (- <Icon- icon={CheckmarkCircle02Icon}- size={18}- className="shrink-0 text-accent"- />- ) : null}- </div>- {agent.sub_heading ? (- <p className="mt-1 line-clamp-2 text-sm text-muted-foreground">- {agent.sub_heading}- </p>- ) : null}- </button>- );-}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/FirstJobStep/useFirstJobStep.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/FirstJobStep/useFirstJobStep.tsdeleted file mode 100644index 47406fbdff..0000000000--- a/autogpt_platform/frontend/src/app/(platform)/raise/components/FirstJobStep/useFirstJobStep.ts+++ /dev/null@@ -1,70 +0,0 @@-import {- useGetV2GetSpecificAgent,- useGetV2ListStoreAgents,-} from "@/app/api/__generated__/endpoints/store/store";-import type { StoreAgent } from "@/app/api/__generated__/models/storeAgent";-import type { StoreAgentDetails } from "@/app/api/__generated__/models/storeAgentDetails";-import type { StoreAgentsResponse } from "@/app/api/__generated__/models/storeAgentsResponse";-import { useAuth } from "@/lib/auth/hooks/useAuth";-import { useState } from "react";--interface Args {- onPick: (job: { id: string; name: string }) => void;-}--export function useFirstJobStep({ onPick }: Args) {- const { isLoggedIn } = useAuth();- const [selected, setSelected] = useState<StoreAgent | null>(null);-- const agentsQuery = useGetV2ListStoreAgents(- { sorted_by: "runs", page_size: 3 },- {- query: {- select: (response) => response.data as StoreAgentsResponse,- enabled: isLoggedIn,- },- },- );-- const detailQuery = useGetV2GetSpecificAgent(- selected?.creator ?? "",- selected?.slug ?? "",- undefined,- {- query: {- select: (response) => response.data as StoreAgentDetails,- enabled: Boolean(selected),- },- },- );-- const versionId = detailQuery.data?.store_listing_version_id ?? null;-- function confirm() {- if (selected && versionId) {- onPick({ id: versionId, name: selected.agent_name });- }- }-- function retrySuggestions() {- void agentsQuery.refetch();- }-- function retrySelectedJob() {- void detailQuery.refetch();- }-- return {- suggestions: agentsQuery.data?.agents ?? [],- isLoading: isLoggedIn && agentsQuery.isLoading,- suggestionsHaveError: agentsQuery.isError,- selectedJobHasError: detailQuery.isError,- selected,- select: setSelected,- isResolving: Boolean(selected) && detailQuery.isFetching,- canConfirm: Boolean(selected) && Boolean(versionId),- confirm,- retrySuggestions,- retrySelectedJob,- };-}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/AttachmentAnswer.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/AttachmentAnswer.tsxnew file mode 100644index 0000000000..434bb1e3a4--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/AttachmentAnswer.tsx@@ -0,0 +1,34 @@+"use client";++import { Icon } from "@/components/atoms/Icon/Icon";+import { cn } from "@/lib/utils";+import { Forward02Icon } from "@hugeicons/core-free-icons";+import type { RaiseAttachmentDraft } from "../../helpers";+import { bubbleClassFor } from "../ColorStep/helpers";++interface Props {+ attachments: RaiseAttachmentDraft[];+ color: string | null;+}++export function AttachmentAnswer({ attachments, color }: Props) {+ const skipped = attachments.length === 0;+ return (+ <div+ className={cn(+ "ml-auto max-w-[80%] rounded-2xl border px-4 py-3 text-[15px] leading-relaxed text-foreground",+ skipped && "flex w-fit items-center gap-2",+ bubbleClassFor(color) ?? "border-accent bg-accent/5",+ )}+ >+ {skipped ? (+ <>+ <Icon icon={Forward02Icon} size={16} aria-hidden />+ Skipped+ </>+ ) : (+ attachments.map((attachment) => attachment.name).join(", ")+ )}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/AttachmentStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/AttachmentStep.tsxnew file mode 100644index 0000000000..e5058b5c56--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/AttachmentStep.tsx@@ -0,0 +1,97 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import type { RaiseAttachmentDraft } from "../../helpers";+import { AttachmentAnswer } from "./AttachmentAnswer";+import { KitSearchField } from "./KitSearchField";+import { KitSearchResults } from "./KitSearchResults";+import { SelectedAttachments } from "./SelectedAttachments";+import type { KitSearchScope } from "./helpers";+import { useAttachmentPicker } from "./useAttachmentPicker";++interface Props {+ color: string | null;+ submitted: RaiseAttachmentDraft[] | null;+ isSubmitting?: boolean;+ scope: KitSearchScope;+ existingCount?: number;+ searchLabel: string;+ searchPlaceholder: string;+ emptyQueryHint: string;+ emptyResultsHint: string;+ primaryLabel: string;+ onSubmit: (attachments: RaiseAttachmentDraft[]) => void;+ onSkip: () => void;+}++export function AttachmentStep({+ color,+ submitted,+ isSubmitting = false,+ scope,+ existingCount,+ searchLabel,+ searchPlaceholder,+ emptyQueryHint,+ emptyResultsHint,+ primaryLabel,+ onSubmit,+ onSkip,+}: Props) {+ const picker = useAttachmentPicker({+ scope,+ existingCount,+ onSubmit,+ onSkip,+ });++ if (submitted !== null) {+ return <AttachmentAnswer attachments={submitted} color={color} />;+ }++ return (+ <div className="flex w-full flex-col items-end gap-4">+ <SelectedAttachments+ attachments={picker.attachments}+ color={color}+ onRemove={picker.removeAttachment}+ />+ <KitSearchField+ scope={scope}+ label={searchLabel}+ placeholder={searchPlaceholder}+ value={picker.searchQuery}+ isSearching={picker.isSearching}+ onChange={picker.setSearchQuery}+ />+ <KitSearchResults+ picker={picker}+ emptyQueryHint={emptyQueryHint}+ emptyResultsHint={emptyResultsHint}+ />+ <div className="flex items-center gap-2">+ <Button+ type="button"+ variant="primary"+ size="small"+ onClick={picker.submit}+ disabled={isSubmitting}+ loading={isSubmitting}+ className="h-[2.625rem] rounded-xl py-3"+ >+ {primaryLabel}+ </Button>+ <Button+ type="button"+ variant="ghost"+ size="small"+ onClick={picker.skip}+ disabled={isSubmitting}+ className="h-[2.625rem] rounded-xl py-3"+ >+ Skip+ </Button>+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitBudget.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitBudget.tsxnew file mode 100644index 0000000000..9dcce7a326--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitBudget.tsx@@ -0,0 +1,67 @@+"use client";++import { Input } from "@/components/atoms/Input/Input";+import { cn } from "@/lib/utils";+import { creditsToUsdLabel } from "../../helpers";+import { bubbleClassFor } from "../ColorStep/helpers";+import { BUDGET_PRESETS } from "./helpers";++interface Props {+ weeklyBudget: number | null;+ customCredits: string;+ color: string | null;+ onSelect: (credits: number) => void;+ onCustomChange: (value: string) => void;+}++export function KitBudget({+ weeklyBudget,+ customCredits,+ color,+ onSelect,+ onCustomChange,+}: Props) {+ return (+ <div className="flex w-full max-w-[42rem] flex-col items-end gap-3">+ <div+ role="group"+ aria-label="Weekly budget"+ className="flex flex-wrap justify-end gap-2.5"+ >+ {BUDGET_PRESETS.map((preset) => {+ const selected = !customCredits && weeklyBudget === preset.credits;+ return (+ <button+ key={preset.credits}+ type="button"+ onClick={() => onSelect(preset.credits)}+ aria-pressed={selected}+ className={cn(+ "rounded-full border px-5 py-2.5 text-sm font-medium text-foreground transition-colors",+ selected+ ? (bubbleClassFor(color) ?? "border-accent bg-accent/5")+ : "border-border bg-background hover:border-accent hover:bg-accent/5",+ )}+ >+ {preset.label}+ {preset.credits > 0+ ? ` · ${creditsToUsdLabel(preset.credits)}`+ : ""}+ </button>+ );+ })}+ </div>+ <Input+ id="raise-kit-custom-budget"+ label="Custom weekly budget in credits"+ hideLabel+ size="small"+ inputMode="numeric"+ value={customCredits}+ onChange={(event) => onCustomChange(event.target.value)}+ placeholder="Custom credits…"+ wrapperClassName="mb-0 w-full max-w-[16rem] [&_input]:h-[2.625rem] [&_input]:py-3"+ />+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitResultRow.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitResultRow.tsxnew file mode 100644index 0000000000..cd842819e4--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitResultRow.tsx@@ -0,0 +1,81 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Icon } from "@/components/atoms/Icon/Icon";+import { cn } from "@/lib/utils";+import { FlowIcon, SparklesIcon, Tick02Icon } from "@hugeicons/core-free-icons";+import { MAX_ATTACHMENTS, type SearchHit } from "./helpers";++interface Props {+ hit: SearchHit;+ index: number;+ selected: boolean;+ atCap: boolean;+ isPending: boolean;+ onAdd: () => void;+}++export function KitResultRow({+ hit,+ index,+ selected,+ atCap,+ isPending,+ onAdd,+}: Props) {+ return (+ <div+ role="listitem"+ // Staggered so the list resolves as a cascade instead of a hard swap+ // from the skeleton; capped at 3 rows so the last one is never late.+ style={{ animationDelay: `${index * 60}ms` }}+ className={cn(+ "flex items-center gap-3 border-b border-border px-3.5 py-3 transition-colors duration-200 last:border-b-0 hover:bg-zinc-50",+ "duration-300 animate-in fade-in slide-in-from-bottom-1 fill-mode-both motion-reduce:animate-none",+ )}+ >+ <span+ aria-hidden+ className="grid size-9 shrink-0 place-items-center rounded-xl border border-border bg-zinc-50 text-muted-foreground"+ >+ <Icon icon={hit.kind === "skill" ? SparklesIcon : FlowIcon} size={16} />+ </span>++ <div className="min-w-0 flex-1">+ <p className="truncate text-sm font-medium text-foreground">+ {hit.name}+ </p>+ <p className="truncate text-xs text-muted-foreground">{hit.subtitle}</p>+ </div>++ <Button+ type="button"+ variant={selected ? "ghost" : "secondary"}+ size="small"+ disabled={selected || atCap}+ loading={isPending}+ onClick={onAdd}+ className={cn(+ "shrink-0 rounded-xl transition-all duration-200",+ // The ghost variant greys disabled text down to zinc-200, which+ // reads as broken rather than settled — keep "Added" full strength.+ selected && "disabled:text-zinc-800",+ )}+ leftIcon={+ selected ? (+ // The tick scales in as the spinner it replaced fades out, so+ // adding reads as one motion.+ <Icon+ icon={Tick02Icon}+ size={14}+ aria-hidden+ className="duration-200 animate-in fade-in zoom-in-50 motion-reduce:animate-none"+ />+ ) : undefined+ }+ >+ {selected ? "Added" : atCap ? `${MAX_ATTACHMENTS} max` : "Add"}+ </Button>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitSearchField.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitSearchField.tsxnew file mode 100644index 0000000000..8b110a2e8b--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitSearchField.tsx@@ -0,0 +1,71 @@+"use client";++import { Icon } from "@/components/atoms/Icon/Icon";+import { Input } from "@/components/atoms/Input/Input";+import {+ Cancel01Icon,+ Loading03Icon,+ Search01Icon,+} from "@hugeicons/core-free-icons";+import type { KitSearchScope } from "./helpers";++interface Props {+ scope: KitSearchScope;+ label: string;+ placeholder: string;+ value: string;+ isSearching: boolean;+ onChange: (value: string) => void;+}++export function KitSearchField({+ scope,+ label,+ placeholder,+ value,+ isSearching,+ onChange,+}: Props) {+ return (+ // The Input atom wraps itself in two positioned divs that follow these+ // adornments in the DOM, so without z-10 the opaque field paints over them.+ <div className="relative w-full max-w-[42rem]">+ <Icon+ icon={Search01Icon}+ size={16}+ aria-hidden+ className="pointer-events-none absolute left-3.5 top-1/2 z-10 -translate-y-1/2 text-muted-foreground"+ />+ <Input+ id={`raise-${scope}-search`}+ label={label}+ hideLabel+ size="small"+ value={value}+ onChange={(event) => onChange(event.target.value)}+ placeholder={placeholder}+ className="pl-10 pr-11"+ wrapperClassName="mb-0 w-full [&_input]:h-[2.625rem] [&_input]:py-3"+ />+ {/* The spinner replaces the clear button rather than sitting beside it:+ while a query is in flight there is nothing settled to clear yet. */}+ {isSearching ? (+ <Icon+ icon={Loading03Icon}+ size={16}+ aria-hidden+ className="absolute right-3.5 top-1/2 z-10 -translate-y-1/2 animate-spin text-muted-foreground motion-reduce:animate-none"+ />+ ) : value ? (+ <button+ type="button"+ onClick={() => onChange("")}+ aria-label="Clear search"+ className="absolute right-2.5 top-1/2 z-10 grid size-7 -translate-y-1/2 place-items-center rounded-full text-muted-foreground transition-colors duration-200 hover:bg-zinc-100 hover:text-foreground"+ >+ <Icon icon={Cancel01Icon} size={14} aria-hidden />+ </button>+ ) : null}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitSearchResults.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitSearchResults.tsxnew file mode 100644index 0000000000..738352ad07--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitSearchResults.tsx@@ -0,0 +1,60 @@+"use client";++import { Icon } from "@/components/atoms/Icon/Icon";+import { Search01Icon } from "@hugeicons/core-free-icons";+import { isHitSelected } from "./helpers";+import { KitResultRow } from "./KitResultRow";+import { KitSearchSkeleton } from "./KitSearchSkeleton";+import type { useAttachmentPicker } from "./useAttachmentPicker";++interface Props {+ picker: ReturnType<typeof useAttachmentPicker>;+ emptyQueryHint: string;+ emptyResultsHint: string;+}++export function KitSearchResults({+ picker,+ emptyQueryHint,+ emptyResultsHint,+}: Props) {+ if (picker.isSearching) {+ return <KitSearchSkeleton />;+ }++ if (picker.hits.length === 0) {+ return (+ <div className="flex w-full max-w-[42rem] flex-col items-center gap-2 rounded-2xl border border-dashed border-border px-6 py-8 text-center duration-300 animate-in fade-in motion-reduce:animate-none">+ <Icon+ icon={Search01Icon}+ size={20}+ aria-hidden+ className="text-muted-foreground/70"+ />+ <p className="max-w-[24rem] text-sm text-muted-foreground">+ {picker.hasQuery ? emptyResultsHint : emptyQueryHint}+ </p>+ </div>+ );+ }++ return (+ <div+ role="list"+ aria-label="Search results"+ className="w-full max-w-[42rem] overflow-hidden rounded-2xl border border-border bg-background shadow-sm"+ >+ {picker.hits.map((hit, index) => (+ <KitResultRow+ key={hit.key}+ hit={hit}+ index={index}+ selected={isHitSelected(picker.attachments, hit)}+ atCap={picker.atCap}+ isPending={picker.pendingKey === hit.key}+ onAdd={() => picker.addHit(hit)}+ />+ ))}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitSearchSkeleton.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitSearchSkeleton.tsxnew file mode 100644index 0000000000..22b8f0220f--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/KitSearchSkeleton.tsx@@ -0,0 +1,51 @@+"use client";++import { cn } from "@/lib/utils";+import { MAX_SEARCH_RESULTS } from "./helpers";++// Mirrors KitResultRow's geometry so results drop straight into the+// skeleton's footprint — no reflow when the query resolves.+export function KitSearchSkeleton() {+ return (+ <div+ role="status"+ aria-label="Searching"+ className="w-full max-w-[42rem] overflow-hidden rounded-2xl border border-border bg-background duration-200 animate-in fade-in motion-reduce:animate-none"+ >+ {Array.from({ length: MAX_SEARCH_RESULTS }, (_, index) => (+ <div+ key={index}+ className="flex items-center gap-3 border-b border-border px-3.5 py-3 last:border-b-0"+ >+ <ShimmerBar delay={index} className="size-9 shrink-0 rounded-xl" />+ <div className="flex min-w-0 flex-1 flex-col gap-1.5">+ <ShimmerBar delay={index} className="h-3 w-1/3 rounded-full" />+ <ShimmerBar delay={index} className="h-2.5 w-1/5 rounded-full" />+ </div>+ <ShimmerBar delay={index} className="h-7 w-16 shrink-0 rounded-xl" />+ </div>+ ))}+ </div>+ );+}++interface ShimmerBarProps {+ delay: number;+ className?: string;+}++// The shared `animate-shimmer` keyframes run on a slow ambient clock; a+// skeleton needs a tighter linear sweep, and the per-row delay keeps the+// three rows out of phase so the block reads as alive rather than blinking.+function ShimmerBar({ delay, className }: ShimmerBarProps) {+ return (+ <span+ aria-hidden+ style={{ animationDelay: `${delay * 140}ms` }}+ className={cn(+ "block animate-shimmer bg-[linear-gradient(90deg,theme(colors.zinc.100)_25%,theme(colors.zinc.50)_50%,theme(colors.zinc.100)_75%)] bg-[length:200%_100%] [animation-duration:1.4s] [animation-timing-function:linear] motion-reduce:animate-none motion-reduce:bg-zinc-100",+ className,+ )}+ />+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/SelectedAttachments.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/SelectedAttachments.tsxnew file mode 100644index 0000000000..528e7ff030--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/SelectedAttachments.tsx@@ -0,0 +1,50 @@+"use client";++import { Icon } from "@/components/atoms/Icon/Icon";+import { cn } from "@/lib/utils";+import { Cancel01Icon } from "@hugeicons/core-free-icons";+import type { RaiseAttachmentDraft } from "../../helpers";+import { bubbleClassFor } from "../ColorStep/helpers";+import { attachmentKey } from "./useAttachmentPicker";++interface Props {+ attachments: RaiseAttachmentDraft[];+ color: string | null;+ onRemove: (key: string) => void;+}++export function SelectedAttachments({ attachments, color, onRemove }: Props) {+ if (attachments.length === 0) return null;+ return (+ <div+ role="list"+ aria-label="Selected tools"+ className="flex w-full max-w-[42rem] flex-wrap justify-end gap-2"+ >+ {attachments.map((attachment) => (+ <button+ key={attachmentKey(attachment)}+ type="button"+ onClick={() => onRemove(attachmentKey(attachment))}+ className={cn(+ "group inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm text-foreground",+ "transition-transform duration-200 hover:scale-[1.03] active:scale-95 motion-reduce:transition-none motion-reduce:hover:scale-100",+ // Chips pop in as they are picked, so the jump from the results+ // list up to the tray reads as one continuous move.+ "duration-300 animate-in fade-in zoom-in-95 fill-mode-both motion-reduce:animate-none",+ bubbleClassFor(color) ?? "border-accent bg-accent/5",+ )}+ >+ {attachment.name}+ <Icon+ icon={Cancel01Icon}+ size={12}+ aria-hidden+ className="opacity-50 transition-opacity duration-200 group-hover:opacity-100 motion-reduce:transition-none"+ />+ <span className="sr-only">Remove {attachment.name}</span>+ </button>+ ))}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/helpers.test.tsnew file mode 100644index 0000000000..4e7b324811--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/helpers.test.ts@@ -0,0 +1,242 @@+import { describe, expect, test } from "vitest";+import type { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";+import type { StoreAgent } from "@/app/api/__generated__/models/storeAgent";+import {+ combineSearchHits,+ failedAttachmentMessage,+ limitSearchHits,+ parseCredits,+ scoreSearchHit,+ toRaiseAttachments,+ type SearchHit,+} from "./helpers";++const storeAgent = {+ slug: "seo-writer",+ agent_name: "SEO Blog Writer",+ agent_image: "",+ creator: "Acme",+ creator_avatar: "",+ sub_heading: "Writes posts",+ description: "",+ runs: 1,+ rating: 5,+ agent_graph_id: "graph-1",+} as StoreAgent;++describe("kit helpers", () => {+ test("parses credit amounts and rejects junk", () => {+ expect(parseCredits("500")).toBe(500);+ expect(parseCredits(" 0 ")).toBe(0);+ expect(parseCredits("")).toBeNull();+ expect(parseCredits("12.5")).toBeNull();+ expect(parseCredits("-1")).toBeNull();+ });++ test("combines marketplace and library workflows in marketplace scope", () => {+ const hits = combineSearchHits({+ query: "seo",+ storeAgents: [storeAgent],+ libraryAgents: [{ id: "lib-1", name: "Local SEO" } as LibraryAgent],+ skills: [{ name: "seo-audit", description: "Audit pages" }],+ scope: "marketplace",+ });++ expect(hits.map((hit) => hit.subtitle)).toEqual([+ "Marketplace workflow",+ "Library workflow",+ ]);+ });++ test("combines marketplace-as-skill and library skills", () => {+ const hits = combineSearchHits({+ query: "seo",+ storeAgents: [storeAgent],+ libraryAgents: [{ id: "lib-1", name: "Local SEO" } as LibraryAgent],+ skills: [+ { name: "seo-audit", description: "Audit pages" },+ { name: "unrelated", description: "Something else" },+ ],+ scope: "skills",+ });++ expect(hits.map((hit) => hit.subtitle)).toEqual([+ "Marketplace skill",+ "Library skill",+ ]);+ expect(+ hits.find((hit) => hit.kind === "skill" && hit.source === "library")?.id,+ ).toBe("seo-audit");+ });++ test("limits default marketplace results to three items", () => {+ const hits = combineSearchHits({+ query: "",+ storeAgents: [+ { ...storeAgent, agent_name: "Workflow 1", slug: "wf-1" },+ { ...storeAgent, agent_name: "Workflow 2", slug: "wf-2" },+ { ...storeAgent, agent_name: "Workflow 3", slug: "wf-3" },+ { ...storeAgent, agent_name: "Workflow 4", slug: "wf-4" },+ ],+ libraryAgents: [+ { id: "lib-1", name: "Library 1" } as LibraryAgent,+ { id: "lib-2", name: "Library 2" } as LibraryAgent,+ ],+ skills: [],+ scope: "marketplace",+ });++ expect(hits).toHaveLength(3);+ expect(hits.map((hit) => hit.name)).toEqual([+ "Workflow 1",+ "Workflow 2",+ "Workflow 3",+ ]);+ });++ test("limits default skills results to three library skills", () => {+ const hits = combineSearchHits({+ query: "",+ storeAgents: [],+ libraryAgents: [],+ skills: [+ { name: "skill-a", description: "A" },+ { name: "skill-b", description: "B" },+ { name: "skill-c", description: "C" },+ { name: "skill-d", description: "D" },+ ],+ scope: "skills",+ });++ expect(hits).toHaveLength(3);+ expect(hits.map((hit) => hit.id)).toEqual([+ "skill-a",+ "skill-b",+ "skill-c",+ ]);+ });++ test("ranks search hits by relevance and keeps the top three", () => {+ const hits: SearchHit[] = [+ {+ key: "1",+ name: "Content helper",+ subtitle: "Library skill",+ kind: "skill",+ source: "library",+ id: "content-helper",+ description: "General helper",+ },+ {+ key: "2",+ name: "seo-audit",+ subtitle: "Library skill",+ kind: "skill",+ source: "library",+ id: "seo-audit",+ description: "Audit pages",+ },+ {+ key: "3",+ name: "Writer",+ subtitle: "Library skill",+ kind: "skill",+ source: "library",+ id: "writer",+ description: "seo templates",+ },+ {+ key: "4",+ name: "Unrelated",+ subtitle: "Library skill",+ kind: "skill",+ source: "library",+ id: "unrelated",+ description: "Nothing here",+ },+ ];++ expect(scoreSearchHit(hits[1], "seo")).toBeGreaterThan(+ scoreSearchHit(hits[0], "seo"),+ );+ expect(limitSearchHits(hits, "seo").map((hit) => hit.id)).toEqual([+ "seo-audit",+ "writer",+ "content-helper",+ ]);+ });++ test("maps drafts to the raise payload shape", () => {+ expect(+ toRaiseAttachments([+ {+ kind: "workflow",+ source: "marketplace",+ id: "listing-1",+ name: "SEO Blog Writer",+ marketplaceKey: "acme/seo-writer",+ },+ ]),+ ).toEqual([{ kind: "workflow", source: "marketplace", id: "listing-1" }]);+ });++ test("explains failed attachments by name", () => {+ expect(+ failedAttachmentMessage(+ [+ {+ kind: "workflow",+ source: "marketplace",+ id: "listing-1",+ reason: "unavailable",+ },+ ],+ [+ {+ kind: "workflow",+ source: "marketplace",+ id: "listing-1",+ name: "SEO Blog Writer",+ },+ ],+ ),+ ).toBe("SEO Blog Writer is no longer available");+ });++ test("separates multiple failed attachments into sentences", () => {+ expect(+ failedAttachmentMessage(+ [+ {+ kind: "workflow",+ source: "marketplace",+ id: "listing-1",+ reason: "unavailable",+ },+ {+ kind: "skill",+ source: "library",+ id: "seo-audit",+ reason: "installation_failed",+ },+ ],+ [+ {+ kind: "workflow",+ source: "marketplace",+ id: "listing-1",+ name: "SEO Blog Writer",+ },+ {+ kind: "skill",+ source: "library",+ id: "seo-audit",+ name: "SEO audit",+ },+ ],+ ),+ ).toBe(+ "SEO Blog Writer is no longer available. SEO audit couldn't be installed",+ );+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/helpers.tsnew file mode 100644index 0000000000..6f206af482--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/helpers.ts@@ -0,0 +1,197 @@+import type { CopilotSkillInfo } from "@/app/api/__generated__/models/copilotSkillInfo";+import type { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";+import type { RaiseAttachment } from "@/app/api/__generated__/models/raiseAttachment";+import type { StoreAgent } from "@/app/api/__generated__/models/storeAgent";+import type { RaiseAttachmentDraft } from "../../helpers";++export const MAX_ATTACHMENTS = 20;+export const DEFAULT_BUDGET_CREDITS = 500;+export const SEARCH_DEBOUNCE_MS = 300;+export const MAX_BUDGET_CREDITS = 1_000_000;+export const MAX_SEARCH_RESULTS = 3;++export const BUDGET_PRESETS = [+ { credits: 500, label: "500 credits" },+ { credits: 1000, label: "1,000 credits" },+ { credits: 0, label: "No weekly limit" },+] as const;++export interface SearchHit {+ key: string;+ name: string;+ subtitle: string;+ kind: "workflow" | "skill";+ source: "marketplace" | "library";+ id: string;+ creator?: string;+ slug?: string;+ description?: string;+}++export function scoreSearchHit(hit: SearchHit, query: string) {+ const needle = query.trim().toLowerCase();+ if (!needle) return 0;+ const name = hit.name.toLowerCase();+ if (name === needle) return 100;+ if (name.startsWith(needle)) return 80;+ if (name.includes(needle)) return 60;+ const description = hit.description?.toLowerCase() ?? "";+ if (description.includes(needle)) return 40;+ if (hit.subtitle.toLowerCase().includes(needle)) return 20;+ return 1;+}++export function limitSearchHits(hits: SearchHit[], query: string) {+ const ranked = query.trim()+ ? [...hits].sort(+ (left, right) =>+ scoreSearchHit(right, query) - scoreSearchHit(left, query),+ )+ : hits;+ return ranked.slice(0, MAX_SEARCH_RESULTS);+}++export function parseCredits(value: string): number | null {+ const trimmed = value.trim();+ if (!trimmed) return null;+ if (!/^\d+$/.test(trimmed)) return null;+ const credits = Number(trimmed);+ if (!Number.isInteger(credits)) return null;+ if (credits < 0 || credits > MAX_BUDGET_CREDITS) return null;+ return credits;+}++export function marketplaceKey(creator: string, slug: string) {+ return `${creator.toLowerCase()}/${slug}`;+}++export type KitSearchScope = "marketplace" | "skills";++export function combineSearchHits({+ query,+ storeAgents,+ libraryAgents,+ skills,+ scope,+}: {+ query: string;+ storeAgents: StoreAgent[];+ libraryAgents: LibraryAgent[];+ skills: CopilotSkillInfo[];+ scope: KitSearchScope;+}): SearchHit[] {+ const hits: SearchHit[] = [];+ const kind = scope === "marketplace" ? "workflow" : "skill";+ for (const agent of storeAgents) {+ hits.push(marketplaceHit(agent, kind));+ }+ if (scope === "marketplace") {+ for (const agent of libraryAgents) {+ hits.push({+ key: `library:workflow:${agent.id}`,+ name: agent.name,+ subtitle: "Library workflow",+ kind: "workflow",+ source: "library",+ id: agent.id,+ });+ }+ return limitSearchHits(hits, query);+ }+ const needle = query.trim().toLowerCase();+ for (const skill of skills) {+ if (!skillMatches(skill, needle)) continue;+ hits.push({+ key: `library:skill:${skill.name.toLowerCase()}`,+ name: skill.name,+ subtitle: "Library skill",+ kind: "skill",+ source: "library",+ id: skill.name,+ description: skill.description,+ });+ }+ return limitSearchHits(hits, query);+}++export function skillMatches(skill: CopilotSkillInfo, needle: string) {+ if (!needle) return true;+ return (+ skill.name.toLowerCase().includes(needle) ||+ skill.description.toLowerCase().includes(needle)+ );+}++export function isHitSelected(+ attachments: RaiseAttachmentDraft[],+ hit: SearchHit,+) {+ return attachments.some((attachment) => hitsMatch(attachment, hit));+}++export function hitsMatch(attachment: RaiseAttachmentDraft, hit: SearchHit) {+ if (attachment.kind !== hit.kind || attachment.source !== hit.source) {+ return false;+ }+ if (hit.source === "marketplace") {+ const listing =+ hit.creator && hit.slug ? marketplaceKey(hit.creator, hit.slug) : null;+ return (+ attachment.id === hit.id ||+ (Boolean(listing) && attachment.marketplaceKey === listing)+ );+ }+ if (hit.kind === "skill") {+ return attachment.id.toLowerCase() === hit.id.toLowerCase();+ }+ return attachment.id === hit.id;+}++export function toRaiseAttachments(+ drafts: RaiseAttachmentDraft[],+): RaiseAttachment[] {+ return drafts.map((draft) => ({+ kind: draft.kind,+ source: draft.source,+ id: draft.id,+ }));+}++export function failedAttachmentMessage(+ failures: { kind: string; source: string; id: string; reason: string }[],+ drafts: RaiseAttachmentDraft[],+) {+ return failures+ .map((failure) => {+ const name =+ drafts.find(+ (draft) =>+ draft.kind === failure.kind &&+ draft.source === failure.source &&+ draft.id === failure.id,+ )?.name ?? failure.id;+ const reason =+ failure.reason === "unavailable"+ ? "is no longer available"+ : "couldn't be installed";+ return `${name} ${reason}`;+ })+ .join(". ");+}++function marketplaceHit(+ agent: StoreAgent,+ kind: "workflow" | "skill",+): SearchHit {+ return {+ key: `marketplace:${kind}:${agent.creator.toLowerCase()}/${agent.slug}`,+ name: agent.agent_name,+ subtitle:+ kind === "workflow" ? "Marketplace workflow" : "Marketplace skill",+ kind,+ source: "marketplace",+ id: "",+ creator: agent.creator,+ slug: agent.slug,+ };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/useAttachmentPicker.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/useAttachmentPicker.tsnew file mode 100644index 0000000000..554dc34456--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/useAttachmentPicker.ts@@ -0,0 +1,106 @@+import { getV2GetSpecificAgent } from "@/app/api/__generated__/endpoints/store/store";+import { toast } from "@/components/molecules/Toast/use-toast";+import { useState } from "react";+import type { RaiseAttachmentDraft } from "../../helpers";+import {+ isHitSelected,+ marketplaceKey,+ MAX_ATTACHMENTS,+ type KitSearchScope,+ type SearchHit,+} from "./helpers";+import { useKitSearch } from "./useKitSearch";++interface Args {+ scope: KitSearchScope;+ existingCount?: number;+ onSubmit: (attachments: RaiseAttachmentDraft[]) => void;+ onSkip: () => void;+}++export function useAttachmentPicker({+ scope,+ existingCount = 0,+ onSubmit,+ onSkip,+}: Args) {+ const search = useKitSearch(scope);+ const [attachments, setAttachments] = useState<RaiseAttachmentDraft[]>([]);+ const [pendingKey, setPendingKey] = useState<string | null>(null);+ const atCap = existingCount + attachments.length >= MAX_ATTACHMENTS;++ function removeAttachment(key: string) {+ setAttachments((current) =>+ current.filter((attachment) => attachmentKey(attachment) !== key),+ );+ }++ async function addHit(hit: SearchHit) {+ if (hit.source === "marketplace") {+ await addMarketplaceHit(hit);+ return;+ }+ setAttachments((current) => {+ if (existingCount + current.length >= MAX_ATTACHMENTS) return current;+ if (isHitSelected(current, hit)) return current;+ return [...current, toDraft(hit, hit.id)];+ });+ }++ async function addMarketplaceHit(hit: SearchHit) {+ if (!hit.creator || !hit.slug || pendingKey) return;+ setPendingKey(hit.key);+ try {+ const details = await getV2GetSpecificAgent(+ hit.creator.toLowerCase(),+ hit.slug,+ );+ if (details.status !== 200) {+ throw new Error("unavailable");+ }+ const listingId = details.data.store_listing_version_id;+ setAttachments((current) => {+ if (existingCount + current.length >= MAX_ATTACHMENTS) return current;+ const draft = toDraft(hit, listingId);+ if (isHitSelected(current, hit)) return current;+ return [...current, draft];+ });+ } catch {+ toast({+ title: `Couldn't add ${hit.name}`,+ description: "Something went wrong. Please try again.",+ variant: "destructive",+ });+ } finally {+ setPendingKey(null);+ }+ }++ return {+ ...search,+ attachments,+ pendingKey,+ atCap,+ addHit,+ removeAttachment,+ submit: () => onSubmit(attachments),+ skip: onSkip,+ };+}++function toDraft(hit: SearchHit, id: string): RaiseAttachmentDraft {+ return {+ kind: hit.kind,+ source: hit.source,+ id,+ name: hit.name,+ marketplaceKey:+ hit.creator && hit.slug+ ? marketplaceKey(hit.creator, hit.slug)+ : undefined,+ };+}++export function attachmentKey(attachment: RaiseAttachmentDraft) {+ return `${attachment.source}:${attachment.kind}:${attachment.id}`;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/useKitSearch.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/useKitSearch.tsnew file mode 100644index 0000000000..90680d827d--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/KitStep/useKitSearch.ts@@ -0,0 +1,63 @@+import { useGetV2ListLibraryAgents } from "@/app/api/__generated__/endpoints/library/library";+import { useListCopilotSkills } from "@/app/api/__generated__/endpoints/skills/skills";+import { useGetV2ListStoreAgents } from "@/app/api/__generated__/endpoints/store/store";+import { okData } from "@/app/api/helpers";+import { useDebouncedValue } from "@/hooks/useDebouncedValue";+import { useState } from "react";+import {+ combineSearchHits,+ MAX_SEARCH_RESULTS,+ SEARCH_DEBOUNCE_MS,+ type KitSearchScope,+} from "./helpers";++export function useKitSearch(scope: KitSearchScope) {+ const [searchQuery, setSearchQuery] = useState("");+ const debouncedQuery = useDebouncedValue(searchQuery, SEARCH_DEBOUNCE_MS);+ const trimmed = debouncedQuery.trim();+ const hasQuery = trimmed.length > 0;+ const searchStore = scope === "marketplace" || hasQuery;+ const searchLibrary = scope === "marketplace";++ const storeQuery = useGetV2ListStoreAgents(+ { search_query: trimmed, page_size: MAX_SEARCH_RESULTS },+ {+ query: {+ enabled: searchStore,+ select: (response) => okData(response)?.agents ?? [],+ },+ },+ );+ const libraryQuery = useGetV2ListLibraryAgents(+ { search_term: trimmed, page_size: MAX_SEARCH_RESULTS, is_hidden: false },+ {+ query: {+ enabled: searchLibrary,+ select: (response) => okData(response)?.agents ?? [],+ },+ },+ );+ const skillsQuery = useListCopilotSkills({+ query: {+ enabled: scope === "skills",+ select: (response) => okData(response) ?? [],+ },+ });++ return {+ searchQuery,+ setSearchQuery,+ hasQuery,+ hits: combineSearchHits({+ query: trimmed,+ storeAgents: storeQuery.data ?? [],+ libraryAgents: libraryQuery.data ?? [],+ skills: skillsQuery.data ?? [],+ scope,+ }),+ isSearching:+ (scope === "skills" && skillsQuery.isLoading) ||+ (searchStore && storeQuery.isFetching) ||+ (searchLibrary && libraryQuery.isFetching),+ };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/MarketplaceStep/MarketplaceStep.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/MarketplaceStep/MarketplaceStep.test.tsxnew file mode 100644index 0000000000..8c35c68cd9--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/MarketplaceStep/MarketplaceStep.test.tsx@@ -0,0 +1,175 @@+import { getGetV2ListLibraryAgentsMockHandler } from "@/app/api/__generated__/endpoints/library/library.msw";+import {+ getGetV2GetSpecificAgentMockHandler,+ getGetV2ListStoreAgentsMockHandler,+} from "@/app/api/__generated__/endpoints/store/store.msw";+import type { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";+import type { StoreAgent } from "@/app/api/__generated__/models/storeAgent";+import type { StoreAgentDetails } from "@/app/api/__generated__/models/storeAgentDetails";+import { Toaster } from "@/components/molecules/Toast/toaster";+import { server } from "@/mocks/mock-server";+import { render, screen, waitFor } from "@/tests/integrations/test-utils";+import userEvent from "@testing-library/user-event";+import { describe, expect, test, vi } from "vitest";+import { MarketplaceStep } from "./MarketplaceStep";++const storeAgent = {+ slug: "seo-writer",+ agent_name: "SEO Blog Writer",+ agent_image: "",+ creator: "acme",+ creator_avatar: "",+ sub_heading: "Writes optimized blog posts",+ description: "",+ runs: 10,+ rating: 5,+ agent_graph_id: "graph-1",+} as StoreAgent;++function renderMarketplace(+ overrides: Partial<Parameters<typeof MarketplaceStep>[0]> = {},+) {+ const onSubmit = vi.fn();+ const onSkip = vi.fn();+ render(+ <>+ <MarketplaceStep+ color="rose-300"+ submitted={null}+ onSubmit={onSubmit}+ onSkip={onSkip}+ {...overrides}+ />+ <Toaster />+ </>,+ );+ return { onSubmit, onSkip };+}++describe("MarketplaceStep", () => {+ test("shows Skipped when the marketplace step was skipped", () => {+ renderMarketplace({ submitted: [] });+ expect(screen.getByText("Skipped")).toBeDefined();+ expect(+ screen.queryByRole("textbox", {+ name: "Search marketplace and library workflows",+ }),+ ).toBeNull();+ });++ test("skip and empty continue both submit no workflows", async () => {+ const { onSubmit, onSkip } = renderMarketplace();+ await userEvent.click(screen.getByRole("button", { name: "That's it" }));+ expect(onSubmit).toHaveBeenCalledWith([]);++ await userEvent.click(screen.getByRole("button", { name: "Skip" }));+ expect(onSkip).toHaveBeenCalled();+ });++ test("shows only three default marketplace workflows", async () => {+ server.use(+ getGetV2ListStoreAgentsMockHandler({+ agents: [+ { ...storeAgent, agent_name: "Workflow 1", slug: "wf-1" },+ { ...storeAgent, agent_name: "Workflow 2", slug: "wf-2" },+ { ...storeAgent, agent_name: "Workflow 3", slug: "wf-3" },+ { ...storeAgent, agent_name: "Workflow 4", slug: "wf-4" },+ ],+ pagination: {+ total_items: 4,+ total_pages: 1,+ current_page: 1,+ page_size: 3,+ },+ }),+ getGetV2ListLibraryAgentsMockHandler({+ agents: [+ { id: "lib-agent-1", name: "Library Workflow" } as LibraryAgent,+ ],+ pagination: {+ total_items: 1,+ total_pages: 1,+ current_page: 1,+ page_size: 3,+ },+ }),+ );+ renderMarketplace();++ expect(await screen.findByText("Workflow 1")).toBeDefined();+ expect(screen.getByText("Workflow 2")).toBeDefined();+ expect(screen.getByText("Workflow 3")).toBeDefined();+ expect(screen.queryByText("Workflow 4")).toBeNull();+ expect(screen.queryByText("Library Workflow")).toBeNull();+ expect(screen.getAllByRole("button", { name: "Add" })).toHaveLength(3);+ });++ test("searches marketplace and library workflows, then attaches both", async () => {+ server.use(+ getGetV2ListStoreAgentsMockHandler({+ agents: [storeAgent],+ pagination: {+ total_items: 1,+ total_pages: 1,+ current_page: 1,+ page_size: 3,+ },+ }),+ getGetV2ListLibraryAgentsMockHandler({+ agents: [{ id: "lib-agent-1", name: "Local SEO" } as LibraryAgent],+ pagination: {+ total_items: 1,+ total_pages: 1,+ current_page: 1,+ page_size: 3,+ },+ }),+ getGetV2GetSpecificAgentMockHandler({+ store_listing_version_id: "listing-version-42",+ slug: "seo-writer",+ agent_name: "SEO Blog Writer",+ creator: "acme",+ } as StoreAgentDetails),+ );+ const { onSubmit } = renderMarketplace();++ await userEvent.type(+ screen.getByRole("textbox", {+ name: "Search marketplace and library workflows",+ }),+ "seo",+ );++ expect(await screen.findByText("SEO Blog Writer")).toBeDefined();+ expect(await screen.findByText("Local SEO")).toBeDefined();+ expect(screen.queryByText("Marketplace skill")).toBeNull();+ await userEvent.click(screen.getAllByRole("button", { name: "Add" })[0]);+ await waitFor(() =>+ expect(+ screen.getByRole("button", { name: /Remove SEO Blog Writer/ }),+ ).toBeDefined(),+ );+ await userEvent.click(screen.getByRole("button", { name: "Add" }));+ await waitFor(() =>+ expect(+ screen.getByRole("button", { name: /Remove Local SEO/ }),+ ).toBeDefined(),+ );+ await userEvent.click(screen.getByRole("button", { name: "That's it" }));++ expect(onSubmit).toHaveBeenCalledWith([+ expect.objectContaining({+ kind: "workflow",+ source: "marketplace",+ id: "listing-version-42",+ name: "SEO Blog Writer",+ }),+ expect.objectContaining({+ kind: "workflow",+ source: "library",+ id: "lib-agent-1",+ name: "Local SEO",+ }),+ ]);+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/MarketplaceStep/MarketplaceStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/MarketplaceStep/MarketplaceStep.tsxnew file mode 100644index 0000000000..a939387763--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/MarketplaceStep/MarketplaceStep.tsx@@ -0,0 +1,28 @@+"use client";++import type { RaiseAttachmentDraft } from "../../helpers";+import { AttachmentStep } from "../KitStep/AttachmentStep";++interface Props {+ color: string | null;+ submitted: RaiseAttachmentDraft[] | null;+ onSubmit: (attachments: RaiseAttachmentDraft[]) => void;+ onSkip: () => void;+}++export function MarketplaceStep({ color, submitted, onSubmit, onSkip }: Props) {+ return (+ <AttachmentStep+ color={color}+ submitted={submitted}+ scope="marketplace"+ searchLabel="Search marketplace and library workflows"+ searchPlaceholder="Search marketplace and library workflows…"+ emptyQueryHint="Search to add marketplace or library workflows."+ emptyResultsHint="No matching workflows."+ primaryLabel="That's it"+ onSubmit={onSubmit}+ onSkip={onSkip}+ />+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/NameStep/NameStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/NameStep/NameStep.tsxindex dead9ea91b..07f9d9fb66 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/components/NameStep/NameStep.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/NameStep/NameStep.tsx@@ -2,56 +2,87 @@import { Button } from "@/components/atoms/Button/Button";import { Input } from "@/components/atoms/Input/Input";-import { NAME_CHIPS } from "../../helpers";+import { cn } from "@/lib/utils";+import { bubbleClassFor } from "../ColorStep/helpers";import { useNameStep } from "./useNameStep";interface Props {+ selectedName: string | null;+ suggestions: string[];+ color: string | null;onSubmit: (name: string) => void;}-export function NameStep({ onSubmit }: Props) {+export function NameStep({+ selectedName,+ suggestions,+ color,+ onSubmit,+}: Props) {const { custom, setCustom, trimmed, submitCustom } = useNameStep({onSubmit,});+ // Once a name is picked the step collapses to that one chip, held in the+ // state it had on hover.+ const chips = selectedName ? [selectedName] : suggestions;return (- <div className="flex flex-col gap-4">+ <div className="flex flex-col items-end gap-4"><divrole="group"aria-label="Suggested names"- className="flex flex-wrap gap-2.5"+ className="flex flex-wrap justify-end gap-2.5">- {NAME_CHIPS.map((chip) => (+ {chips.map((chip) => (<buttonkey={chip}type="button"onClick={() => onSubmit(chip)}- className="rounded-full border border-border bg-background px-5 py-2.5 text-sm font-medium text-foreground transition-colors hover:border-accent hover:bg-accent/5"+ disabled={Boolean(selectedName)}+ aria-pressed={selectedName ? true : undefined}+ className={cn(+ "rounded-full border px-5 py-2.5 text-sm font-medium text-foreground transition-colors",+ selectedName+ ? (bubbleClassFor(color) ?? "border-accent bg-accent/5")+ : "border-border bg-background hover:border-accent hover:bg-accent/5",+ )}>{chip}</button>))}</div>- <form onSubmit={submitCustom} className="flex items-end gap-2">- <Input- id="raise-name"- label="Or type your own"- hideLabel- value={custom}- onChange={(event) => setCustom(event.target.value)}- placeholder="Type a name…"- maxLength={100}- wrapperClassName="flex-1"- />- <Button- type="submit"- variant="primary"- disabled={!trimmed}- className="rounded-full"+ {selectedName ? null : (+ <span+ aria-hidden+ className="mr-4 text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground">- Name me- </Button>- </form>+ or+ </span>+ )}+ {selectedName ? null : (+ <form onSubmit={submitCustom} className="flex items-center gap-2">+ <Input+ id="raise-name"+ label="Or type your own"+ hideLabel+ size="small"+ value={custom}+ onChange={(event) => setCustom(event.target.value)}+ placeholder="Type a name…"+ maxLength={100}+ wrapperClassName="mb-0 w-full max-w-[16rem] [&_input]:h-[2.625rem] [&_input]:py-3"+ />+ <Button+ type="submit"+ variant="primary"+ size="small"+ disabled={!trimmed}+ className="h-[2.625rem] rounded-xl py-3"+ >+ Name me+ </Button>+ </form>+ )}</div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/RaiseFlow.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/RaiseFlow.tsxindex 56be138cad..6f6971b15c 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/RaiseFlow.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/RaiseFlow.tsx@@ -2,124 +2,190 @@import { Button } from "@/components/atoms/Button/Button";import { Icon } from "@/components/atoms/Icon/Icon";-import { VoicePicker } from "@/components/organisms/VoicePicker/VoicePicker";-import { ArrowLeft02Icon } from "@hugeicons/core-free-icons";-import { useEffect, useRef } from "react";-import { VOICE_SAMPLES } from "../../helpers";+import { cn } from "@/lib/utils";+import {+ ArrowLeft02Icon,+ ArrowRight02Icon,+ RefreshIcon,+} from "@hugeicons/core-free-icons";+import { useRef, useState } from "react";+import {+ BEAT_KEYS,+ questionId,+ type BeatKey,+ type RaiseFlowItem,+} from "../../flowItems";+import { useConversationScroll } from "../../useConversationScroll";import { useRaisePage } from "../../useRaisePage";-import { AssistantBubble } from "../AssistantBubble/AssistantBubble";-import { FirstJobStep } from "../FirstJobStep/FirstJobStep";-import { NameStep } from "../NameStep/NameStep";+import { AutoGPTBubble } from "../AutoGPTBubble/AutoGPTBubble";+import { ditherColorsFor } from "../ColorStep/helpers";+import { DitheredWaves } from "../DitheredWaves/DitheredWaves";import { SoulPreviewPanel } from "../SoulPreviewPanel/SoulPreviewPanel";+import { BeatControl } from "./components/BeatControl";+import { RestartConfirmDialog } from "./components/RestartConfirmDialog";++const STEP_ANIMATION =+ "duration-500 animate-in fade-in slide-in-from-bottom-2 fill-mode-both motion-reduce:animate-none";export function RaiseFlow() {+ const flow = useRaisePage();const {- step,- messages,+ hasStarted,+ items,name,+ role,+ color,+ avatarUrl,+ about,voiceLabel,- firstJob,- isSubmitting,- submitName,- pickVoice,- skipVoice,- pickFirstJob,- skipFirstJob,+ kit,+ canGoBack,+ startRaising,+ restart,goBack,- finish,- } = useRaisePage();- const stepPanelRef = useRef<HTMLDivElement>(null);- const previousStepRef = useRef(step);- const stepLabel =- step === "firstJob"- ? "First job"- : `${step[0].toUpperCase()}${step.slice(1)}`;+ revealStep,+ } = flow;+ const { scrollRef, canScrollUp, canScrollDown } = useConversationScroll();+ const [isRestartOpen, setIsRestartOpen] = useState(false);+ const initialMessageIds = useRef<Set<string> | null>(null);+ if (initialMessageIds.current === null) {+ initialMessageIds.current = new Set(+ items.filter((item) => item.kind === "message").map((item) => item.id),+ );+ }+ const seenMessageIds = initialMessageIds.current;- useEffect(() => {- if (previousStepRef.current !== step) {- stepPanelRef.current?.focus();- previousStepRef.current = step;+ function renderItem(item: RaiseFlowItem) {+ if (item.kind === "startButton") {+ return (+ <div key={item.id} className={`flex delay-700 ${STEP_ANIMATION}`}>+ <Button+ variant="secondary"+ size="small"+ className="-ml-3 rounded-full"+ onClick={startRaising}+ disabled={hasStarted}+ >+ {hasStarted ? "Setting up expert now" : "Start raising"}+ {hasStarted ? null : <Icon icon={ArrowRight02Icon} size={14} />}+ </Button>+ </div>+ );+ }+ if (item.kind === "step") {+ return (+ <div key={item.id} id={item.id} className={STEP_ANIMATION}>+ <BeatControl beat={item.beat} flow={flow} />+ </div>+ );}- }, [step]);+ return (+ <AutoGPTBubble+ key={item.id}+ id={item.id}+ text={item.text}+ animate={!seenMessageIds.has(item.id)}+ onTypingComplete={revealOnTyped(item.id, revealStep)}+ />+ );+ }return (- <main className="min-h-screen bg-muted/30 px-4 pb-16 pt-6 sm:px-6 lg:px-8">- <div className="mx-auto grid w-full max-w-[1000px] gap-6 lg:grid-cols-[1fr_minmax(300px,360px)]">- <div className="order-2 flex flex-col gap-4 lg:order-1">+ <main className="min-h-screen bg-background lg:h-screen lg:overflow-hidden">+ <div className="grid w-full items-stretch lg:h-full lg:grid-cols-2">+ <div className="relative order-2 lg:order-1 lg:h-screen"><div+ ref={scrollRef}role="log"aria-live="polite"aria-relevant="additions text"aria-label="Raise expert conversation"- className="flex flex-col gap-3"- >- {messages.map((message) =>- message.role === "assistant" ? (- <AssistantBubble key={message.id} text={message.text} />- ) : (- <div- key={message.id}- className="max-w-[80%] self-end rounded-3xl rounded-br-lg bg-accent px-5 py-3.5 text-[15px] leading-relaxed text-accent-foreground"- >- {message.text}- </div>- ),- )}- </div>-- <div- ref={stepPanelRef}- role="region"- aria-label={`${stepLabel} step`}- tabIndex={-1}- className="mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className="flex flex-col gap-4 px-4 pb-16 pt-6 scrollbar-none sm:px-6 lg:h-full lg:overflow-y-auto lg:px-8">- {step !== "name" ? (- <button- type="button"- onClick={goBack}- disabled={isSubmitting}- className="mb-3 flex items-center gap-1 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50"- >- <Icon icon={ArrowLeft02Icon} size={14} />- Back- </button>- ) : null}- {step === "name" ? <NameStep onSubmit={submitName} /> : null}- {step === "voice" ? (- <VoicePicker- name={name}- samples={VOICE_SAMPLES}- onPick={pickVoice}- onSkip={skipVoice}- />- ) : null}- {step === "firstJob" ? (- <FirstJobStep onPick={pickFirstJob} onSkip={skipFirstJob} />- ) : null}- {step === "review" ? (- <div className="flex justify-end">- <Button- variant="primary"- onClick={finish}- loading={isSubmitting}- className="rounded-full"- >- {`Bring ${name} to life`}- </Button>- </div>- ) : null}+ {items.map(renderItem)}</div>+ <ScrollFade edge="top" isVisible={canScrollUp} />+ <ScrollFade edge="bottom" isVisible={canScrollDown} /></div>- <div className="order-1 lg:order-2">- <SoulPreviewPanel- name={name}- voiceLabel={voiceLabel}- firstJobName={firstJob?.name ?? null}+ <div className="relative order-1 m-2 overflow-hidden rounded-[2.5rem] bg-muted/40 lg:order-2">+ <DitheredWaves+ className="absolute inset-0"+ colors={ditherColorsFor(color)}/>+ <div className="absolute left-4 top-4 z-10 flex gap-2 sm:left-6 sm:top-6">+ <Button+ variant="icon"+ size="small"+ aria-label="Back"+ className="bg-white p-2 hover:bg-zinc-100"+ onClick={goBack}+ disabled={!canGoBack}+ >+ <Icon icon={ArrowLeft02Icon} size={16} />+ </Button>+ <Button+ variant="icon"+ size="small"+ aria-label="Start over"+ className="bg-white p-2 hover:bg-zinc-100"+ onClick={() => setIsRestartOpen(true)}+ >+ <Icon icon={RefreshIcon} size={16} />+ </Button>+ </div>++ <div className="relative flex h-full items-center justify-center p-4 sm:p-6">+ <SoulPreviewPanel+ name={name}+ role={role}+ avatarUrl={avatarUrl || null}+ color={color}+ about={about}+ voiceLabel={voiceLabel}+ kit={kit}+ />+ </div></div></div>+ <RestartConfirmDialog+ open={isRestartOpen}+ onOpenChange={setIsRestartOpen}+ onConfirm={() => {+ setIsRestartOpen(false);+ restart();+ }}+ /></main>);}++// Each question hands off to the controls it introduces once it has finished+// typing, so nothing appears mid-sentence.+function revealOnTyped(id: string, reveal: (beat: BeatKey) => void) {+ const beat = BEAT_KEYS.find((key) => questionId(key) === id);+ return beat ? () => reveal(beat) : undefined;+}++// Signals there is more conversation past the edge, fading into the page+// background so it reads as depth rather than a border.+function ScrollFade({+ edge,+ isVisible,+}: {+ edge: "top" | "bottom";+ isVisible: boolean;+}) {+ return (+ <div+ aria-hidden+ className={cn(+ "pointer-events-none absolute inset-x-0 h-16 transition-opacity duration-200",+ edge === "top"+ ? "top-0 bg-gradient-to-b from-background to-transparent"+ : "bottom-0 bg-gradient-to-t from-background to-transparent",+ isVisible ? "opacity-100" : "opacity-0",+ )}+ />+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/components/BeatControl.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/components/BeatControl.tsxnew file mode 100644index 0000000000..f2c88aad34--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/components/BeatControl.tsx@@ -0,0 +1,123 @@+"use client";++import { VoicePicker } from "@/components/organisms/VoicePicker/VoicePicker";+import type { BeatKey } from "../../../flowItems";+import { VOICE_SAMPLES } from "../../../helpers";+import type { useRaisePage } from "../../../useRaisePage";+import { AboutStep } from "../../AboutStep/AboutStep";+import { AvatarStep } from "../../AvatarStep/AvatarStep";+import { BudgetStep } from "../../BudgetStep/BudgetStep";+import { ColorStep } from "../../ColorStep/ColorStep";+import {+ interactiveCardClassFor,+ selectedCardClassFor,+ textClassFor,+} from "../../ColorStep/helpers";+import { MarketplaceStep } from "../../MarketplaceStep/MarketplaceStep";+import { NameStep } from "../../NameStep/NameStep";+import { nameSuggestionsFor } from "../../RoleStep/helpers";+import { RoleStep } from "../../RoleStep/RoleStep";+import { SkillsStep } from "../../SkillsStep/SkillsStep";++interface Props {+ beat: BeatKey;+ flow: ReturnType<typeof useRaisePage>;+}++export function BeatControl({ beat, flow }: Props) {+ switch (beat) {+ case "role":+ return (+ <RoleStep+ selectedRole={flow.role}+ color={flow.color}+ onPick={flow.pickRole}+ />+ );+ case "name":+ return (+ <NameStep+ selectedName={flow.name || null}+ suggestions={nameSuggestionsFor(flow.role)}+ color={flow.color}+ onSubmit={flow.submitName}+ />+ );+ case "color":+ return <ColorStep selectedColor={flow.color} onPick={flow.pickColor} />;+ case "avatar":+ return (+ <AvatarStep+ name={flow.name}+ color={flow.color}+ avatarUrl={flow.avatarUrl || null}+ isSkipped={flow.avatarUrl === ""}+ onPick={flow.pickAvatar}+ onSkip={flow.skipAvatar}+ />+ );+ case "about":+ return (+ <AboutStep+ submittedAbout={flow.about}+ name={flow.name}+ color={flow.color}+ onSubmit={flow.submitAbout}+ onSkip={flow.skipAbout}+ />+ );+ case "voice":+ return (+ <VoicePicker+ name={flow.name}+ samples={VOICE_SAMPLES}+ hideHeader+ labelClassName={textClassFor(flow.color)}+ cardColors={{+ selected: selectedCardClassFor(flow.color),+ interactive: interactiveCardClassFor(flow.color),+ }}+ onPick={flow.pickVoice}+ onSkip={flow.skipVoice}+ />+ );+ case "budget":+ return (+ <BudgetStep+ color={flow.color}+ submittedBudget={flow.budget}+ onSubmit={flow.submitBudget}+ onSkip={flow.skipBudget}+ />+ );+ case "marketplace":+ return (+ <MarketplaceStep+ color={flow.color}+ submitted={flow.marketplace}+ onSubmit={flow.submitMarketplace}+ onSkip={flow.skipMarketplace}+ />+ );+ case "skills":+ return (+ <SkillsStep+ name={flow.name}+ color={flow.color}+ submitted={flow.skills}+ existingCount={flow.marketplace?.length ?? 0}+ isSubmitting={flow.isSubmitting}+ onSubmit={flow.submitSkills}+ onSkip={flow.skipSkills}+ />+ );+ default:+ // A new beat without a control fails to compile here rather than+ // silently rendering nothing.+ return assertUnreachable(beat);+ }+}++function assertUnreachable(beat: never): never {+ throw new Error(`No control registered for beat: ${String(beat)}`);+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/components/RestartConfirmDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/components/RestartConfirmDialog.tsxnew file mode 100644index 0000000000..8fef19254b--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/components/RestartConfirmDialog.tsx@@ -0,0 +1,43 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Text } from "@/components/atoms/Text/Text";+import { Dialog } from "@/components/molecules/Dialog/Dialog";++interface Props {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ onConfirm: () => void;+}++export function RestartConfirmDialog({ open, onOpenChange, onConfirm }: Props) {+ return (+ <Dialog+ title="Start over?"+ styling={{ maxWidth: "26rem" }}+ controlled={{ isOpen: open, set: onOpenChange }}+ >+ <Dialog.Content>+ <div className="flex flex-col gap-4">+ <Text variant="body" className="text-zinc-800">+ This clears every answer you have given so far and takes you back to+ the first question. It cannot be undone.+ </Text>++ <div className="flex justify-end gap-2 pt-2">+ <Button+ variant="secondary"+ size="small"+ onClick={() => onOpenChange(false)}+ >+ Keep going+ </Button>+ <Button variant="destructive" size="small" onClick={onConfirm}>+ Start over+ </Button>+ </div>+ </div>+ </Dialog.Content>+ </Dialog>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/RoleStep.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/RoleStep.test.tsxnew file mode 100644index 0000000000..fac7a98839--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/RoleStep.test.tsx@@ -0,0 +1,35 @@+import { render, screen } from "@/tests/integrations/test-utils";+import userEvent from "@testing-library/user-event";+import { describe, expect, test, vi } from "vitest";+import { RoleStep } from "./RoleStep";++describe("RoleStep", () => {+ test("does not show Something else as a preset pill", () => {+ render(<RoleStep selectedRole={null} color={null} onPick={vi.fn()} />);++ expect(screen.queryByRole("button", { name: "Something else" })).toBeNull();+ expect(screen.getByPlaceholderText("Type a role…")).toBeDefined();+ });++ test("submits trimmed custom role text", async () => {+ const onPick = vi.fn();+ render(<RoleStep selectedRole={null} color={null} onPick={onPick} />);++ await userEvent.type(+ screen.getByPlaceholderText("Type a role…"),+ " UX Designer ",+ );+ await userEvent.click(screen.getByRole("button", { name: "Add role" }));++ expect(onPick).toHaveBeenCalledWith("UX Designer");+ });++ test("collapses to the selected custom role", () => {+ render(+ <RoleStep selectedRole="UX Designer" color={null} onPick={vi.fn()} />,+ );++ expect(screen.getByRole("button", { name: "UX Designer" })).toBeDefined();+ expect(screen.queryByPlaceholderText("Type a role…")).toBeNull();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/RoleStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/RoleStep.tsxnew file mode 100644index 0000000000..b0608ec82d--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/RoleStep.tsx@@ -0,0 +1,81 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Input } from "@/components/atoms/Input/Input";+import { cn } from "@/lib/utils";+import { bubbleClassFor } from "../ColorStep/helpers";+import { CUSTOM_ROLE_MAX_LENGTH, roleOptionsForSelection } from "./helpers";+import { useRoleStep } from "./useRoleStep";++interface Props {+ selectedRole: string | null;+ color: string | null;+ onPick: (roleId: string) => void;+}++export function RoleStep({ selectedRole, color, onPick }: Props) {+ const { custom, setCustom, trimmed, submitCustom } = useRoleStep({+ onPick,+ });+ const options = roleOptionsForSelection(selectedRole);++ return (+ <div className="flex flex-col items-end gap-4">+ <div+ role="group"+ aria-label="What the expert does"+ className="flex flex-wrap justify-end gap-2.5"+ >+ {options.map((option) => (+ <button+ key={option.id}+ type="button"+ onClick={() => onPick(option.id)}+ disabled={Boolean(selectedRole)}+ aria-pressed={selectedRole ? true : undefined}+ className={cn(+ "rounded-full border px-5 py-2.5 text-sm font-medium text-foreground transition-colors",+ selectedRole+ ? (bubbleClassFor(color) ?? "border-accent bg-accent/5")+ : "border-border bg-background hover:border-accent hover:bg-accent/5",+ )}+ >+ {option.label}+ </button>+ ))}+ </div>+ {selectedRole ? null : (+ <span+ aria-hidden+ className="mr-4 text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground"+ >+ or+ </span>+ )}+ {selectedRole ? null : (+ <form onSubmit={submitCustom} className="flex items-center gap-2">+ <Input+ id="raise-role"+ label="Or type your own"+ hideLabel+ size="small"+ value={custom}+ onChange={(event) => setCustom(event.target.value)}+ placeholder="Type a role…"+ maxLength={CUSTOM_ROLE_MAX_LENGTH}+ wrapperClassName="mb-0 w-full max-w-[16rem] [&_input]:h-[2.625rem] [&_input]:py-3"+ />+ <Button+ type="submit"+ variant="primary"+ size="small"+ disabled={!trimmed}+ className="h-[2.625rem] rounded-xl py-3"+ >+ Add role+ </Button>+ </form>+ )}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/helpers.test.tsnew file mode 100644index 0000000000..83cc49efa8--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/helpers.test.ts@@ -0,0 +1,56 @@+import { describe, expect, test } from "vitest";+import {+ aboutPlaceholderFor,+ CUSTOM_ROLE_MAX_LENGTH,+ isValidCustomRole,+ normalizeCustomRole,+ roleLabelFor,+ roleOptionsForSelection,+} from "./helpers";++describe("RoleStep helpers", () => {+ test("roleLabelFor returns preset labels", () => {+ expect(roleLabelFor("marketer")).toBe("Marketer");+ });++ test("roleLabelFor returns custom role text", () => {+ expect(roleLabelFor("UX Designer")).toBe("UX Designer");+ });++ test("roleOptionsForSelection collapses to a custom role chip", () => {+ expect(roleOptionsForSelection("UX Designer")).toEqual([+ { id: "UX Designer", label: "UX Designer" },+ ]);+ });++ test("normalizeCustomRole trims whitespace", () => {+ expect(normalizeCustomRole(" Coach ")).toBe("Coach");+ });++ test("isValidCustomRole rejects empty and overlong values", () => {+ expect(isValidCustomRole("")).toBe(false);+ expect(isValidCustomRole(" ")).toBe(false);+ expect(isValidCustomRole("a".repeat(CUSTOM_ROLE_MAX_LENGTH))).toBe(true);+ expect(isValidCustomRole("a".repeat(CUSTOM_ROLE_MAX_LENGTH + 1))).toBe(+ false,+ );+ });++ test("aboutPlaceholderFor returns a generic placeholder without a name", () => {+ expect(aboutPlaceholderFor(null)).toBe(+ "How they should work, what you care about, anything that helps them sound like yours…",+ );+ expect(aboutPlaceholderFor(" ")).toBe(+ "How they should work, what you care about, anything that helps them sound like yours…",+ );+ });++ test("aboutPlaceholderFor personalizes the placeholder with the expert name", () => {+ expect(aboutPlaceholderFor("Nova")).toBe(+ "How Nova should work, what you care about, anything that helps them sound like yours…",+ );+ expect(aboutPlaceholderFor(" Ada ")).toBe(+ "How Ada should work, what you care about, anything that helps them sound like yours…",+ );+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/helpers.tsnew file mode 100644index 0000000000..d3bf1c6767--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/helpers.ts@@ -0,0 +1,95 @@+export interface RoleOption {+ id: string;+ label: string;+ // Seeds the name step, so suggestions fit the job the expert was hired for.+ nameSuggestions: string[];+}++const FALLBACK_NAMES = ["Otto", "Nova", "Juno"];+const ABOUT_PLACEHOLDER =+ "How they should work, what you care about, anything that helps them sound like yours…";++export const CUSTOM_ROLE_MAX_LENGTH = 100;++export const ROLE_OPTIONS: RoleOption[] = [+ {+ id: "marketer",+ label: "Marketer",+ nameSuggestions: ["Echo", "Reach", "Nova"],+ },+ {+ id: "sales",+ label: "Sales",+ nameSuggestions: ["Pitch", "Ace", "Rain"],+ },+ {+ id: "developer",+ label: "Developer",+ nameSuggestions: ["Ada", "Turing", "Bit"],+ },+ {+ id: "researcher",+ label: "Researcher",+ nameSuggestions: ["Kepler", "Curie", "Juno"],+ },+ {+ id: "writer",+ label: "Writer",+ nameSuggestions: ["Quill", "Hemingway", "Ink"],+ },+ {+ id: "analyst",+ label: "Analyst",+ nameSuggestions: ["Tally", "Vector", "Sigma"],+ },+ {+ id: "recruiter",+ label: "Recruiter",+ nameSuggestions: ["Scout", "Hire", "Vera"],+ },+ {+ id: "support",+ label: "Support",+ nameSuggestions: ["Remy", "Aide", "Piper"],+ },+ {+ id: "operations",+ label: "Operations",+ nameSuggestions: ["Cadence", "Clockwork", "Sol"],+ },+];++export function normalizeCustomRole(value: string) {+ return value.trim();+}++export function isValidCustomRole(value: string) {+ const trimmed = normalizeCustomRole(value);+ return trimmed.length > 0 && trimmed.length <= CUSTOM_ROLE_MAX_LENGTH;+}++export function findRoleOption(id: string | null) {+ return ROLE_OPTIONS.find((option) => option.id === id) ?? null;+}++export function roleLabelFor(role: string | null) {+ if (!role) return null;+ return findRoleOption(role)?.label ?? role;+}++export function roleOptionsForSelection(selectedRole: string | null) {+ if (!selectedRole) return ROLE_OPTIONS;+ const preset = findRoleOption(selectedRole);+ if (preset) return [preset];+ return [{ id: selectedRole, label: selectedRole }];+}++export function nameSuggestionsFor(roleId: string | null) {+ return findRoleOption(roleId)?.nameSuggestions ?? FALLBACK_NAMES;+}++export function aboutPlaceholderFor(name: string | null) {+ const trimmed = name?.trim();+ if (!trimmed) return ABOUT_PLACEHOLDER;+ return `How ${trimmed} should work, what you care about, anything that helps them sound like yours…`;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/useRoleStep.ts b/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/useRoleStep.tsnew file mode 100644index 0000000000..9939f39001--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/RoleStep/useRoleStep.ts@@ -0,0 +1,20 @@+import type { FormEvent } from "react";+import { useState } from "react";+import { isValidCustomRole, normalizeCustomRole } from "./helpers";++interface Args {+ onPick: (roleId: string) => void;+}++export function useRoleStep({ onPick }: Args) {+ const [custom, setCustom] = useState("");+ const trimmed = normalizeCustomRole(custom);++ function submitCustom(event: FormEvent) {+ event.preventDefault();+ if (!isValidCustomRole(custom)) return;+ onPick(trimmed);+ }++ return { custom, setCustom, trimmed, submitCustom };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/SkillsStep/SkillsStep.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/SkillsStep/SkillsStep.test.tsxnew file mode 100644index 0000000000..d83a406a24--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/SkillsStep/SkillsStep.test.tsx@@ -0,0 +1,147 @@+import { getListCopilotSkillsMockHandler } from "@/app/api/__generated__/endpoints/skills/skills.msw";+import {+ getGetV2GetSpecificAgentMockHandler,+ getGetV2ListStoreAgentsMockHandler,+} from "@/app/api/__generated__/endpoints/store/store.msw";+import type { StoreAgent } from "@/app/api/__generated__/models/storeAgent";+import type { StoreAgentDetails } from "@/app/api/__generated__/models/storeAgentDetails";+import { Toaster } from "@/components/molecules/Toast/toaster";+import { server } from "@/mocks/mock-server";+import { render, screen, waitFor } from "@/tests/integrations/test-utils";+import userEvent from "@testing-library/user-event";+import { describe, expect, test, vi } from "vitest";+import { SkillsStep } from "./SkillsStep";++const storeAgent = {+ slug: "seo-writer",+ agent_name: "SEO Blog Writer",+ agent_image: "",+ creator: "acme",+ creator_avatar: "",+ sub_heading: "Writes optimized blog posts",+ description: "",+ runs: 10,+ rating: 5,+ agent_graph_id: "graph-1",+} as StoreAgent;++function renderSkills(+ overrides: Partial<Parameters<typeof SkillsStep>[0]> = {},+) {+ const onSubmit = vi.fn();+ const onSkip = vi.fn();+ render(+ <>+ <SkillsStep+ name="Otto"+ color="rose-300"+ submitted={null}+ existingCount={0}+ isSubmitting={false}+ onSubmit={onSubmit}+ onSkip={onSkip}+ {...overrides}+ />+ <Toaster />+ </>,+ );+ return { onSubmit, onSkip };+}++describe("SkillsStep", () => {+ test("shows only three default library skills", async () => {+ server.use(+ getListCopilotSkillsMockHandler([+ { name: "skill-a", description: "A" },+ { name: "skill-b", description: "B" },+ { name: "skill-c", description: "C" },+ { name: "skill-d", description: "D" },+ ]),+ );+ renderSkills();++ expect(await screen.findByText("skill-a")).toBeDefined();+ expect(screen.getByText("skill-b")).toBeDefined();+ expect(screen.getByText("skill-c")).toBeDefined();+ expect(screen.queryByText("skill-d")).toBeNull();+ expect(screen.getAllByRole("button", { name: "Add" })).toHaveLength(3);+ });++ test("adds a library skill without searching", async () => {+ server.use(+ getListCopilotSkillsMockHandler([+ { name: "seo-audit", description: "Audit landing pages" },+ ]),+ );+ const { onSubmit } = renderSkills();++ await userEvent.click(await screen.findByRole("button", { name: "Add" }));+ await userEvent.click(+ screen.getByRole("button", { name: "Bring Otto to life" }),+ );++ expect(onSubmit).toHaveBeenCalledWith([+ {+ kind: "skill",+ source: "library",+ id: "seo-audit",+ name: "seo-audit",+ marketplaceKey: undefined,+ },+ ]);+ });++ test("searches marketplace agents as skills", async () => {+ server.use(+ getListCopilotSkillsMockHandler([]),+ getGetV2ListStoreAgentsMockHandler({+ agents: [storeAgent],+ pagination: {+ total_items: 1,+ total_pages: 1,+ current_page: 1,+ page_size: 3,+ },+ }),+ getGetV2GetSpecificAgentMockHandler({+ store_listing_version_id: "listing-version-42",+ slug: "seo-writer",+ agent_name: "SEO Blog Writer",+ creator: "acme",+ } as StoreAgentDetails),+ );+ const { onSubmit } = renderSkills();++ await userEvent.type(+ screen.getByRole("textbox", { name: "Search skills" }),+ "seo",+ );++ expect(await screen.findByText("Marketplace skill")).toBeDefined();+ await userEvent.click(screen.getByRole("button", { name: "Add" }));+ await waitFor(() =>+ expect(+ screen.getByRole("button", { name: /Remove SEO Blog Writer/ }),+ ).toBeDefined(),+ );+ await userEvent.click(+ screen.getByRole("button", { name: "Bring Otto to life" }),+ );++ expect(onSubmit).toHaveBeenCalledWith([+ expect.objectContaining({+ kind: "skill",+ source: "marketplace",+ id: "listing-version-42",+ name: "SEO Blog Writer",+ }),+ ]);+ });++ test("skip raises without extra skills", async () => {+ server.use(getListCopilotSkillsMockHandler([]));+ const { onSkip } = renderSkills();+ await userEvent.click(screen.getByRole("button", { name: "Skip" }));+ expect(onSkip).toHaveBeenCalled();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/SkillsStep/SkillsStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/SkillsStep/SkillsStep.tsxnew file mode 100644index 0000000000..bd9d9fac16--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/SkillsStep/SkillsStep.tsx@@ -0,0 +1,41 @@+"use client";++import type { RaiseAttachmentDraft } from "../../helpers";+import { AttachmentStep } from "../KitStep/AttachmentStep";++interface Props {+ name: string;+ color: string | null;+ submitted: RaiseAttachmentDraft[] | null;+ existingCount: number;+ isSubmitting: boolean;+ onSubmit: (attachments: RaiseAttachmentDraft[]) => void;+ onSkip: () => void;+}++export function SkillsStep({+ name,+ color,+ submitted,+ existingCount,+ isSubmitting,+ onSubmit,+ onSkip,+}: Props) {+ return (+ <AttachmentStep+ color={color}+ submitted={submitted}+ isSubmitting={isSubmitting}+ scope="skills"+ existingCount={existingCount}+ searchLabel="Search skills"+ searchPlaceholder="Search library and marketplace skills…"+ emptyQueryHint="Search to add a marketplace skill, or pick from your library skills."+ emptyResultsHint="No matching skills."+ primaryLabel={`Bring ${name || "it"} to life`}+ onSubmit={onSubmit}+ onSkip={onSkip}+ />+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/SoulPreviewPanel/SoulDetailCard.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/SoulPreviewPanel/SoulDetailCard.tsxnew file mode 100644index 0000000000..2cf48ef26d--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/SoulPreviewPanel/SoulDetailCard.tsx@@ -0,0 +1,30 @@+"use client";++import { cn } from "@/lib/utils";+import { textClassFor } from "../ColorStep/helpers";++type Props = {+ label: string;+ value: string;+ color: string | null;+};++// Each answer arrives as its own card sliding up under the identity card, so+// the stack grows downward and lifts the name as it does.+export function SoulDetailCard({ label, value, color }: Props) {+ return (+ <div className="w-full rounded-[1.5rem] border border-border bg-background px-6 py-4 shadow-lg duration-500 animate-in fade-in slide-in-from-bottom-6 fill-mode-both motion-reduce:animate-none">+ <p+ className={cn(+ "mb-1 text-xs font-semibold uppercase tracking-[0.12em]",+ textClassFor(color) ?? "text-muted-foreground",+ )}+ >+ {label}+ </p>+ <p className="line-clamp-3 text-[15px] leading-relaxed text-foreground">+ {value}+ </p>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/SoulPreviewPanel/SoulPreviewPanel.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/SoulPreviewPanel/SoulPreviewPanel.test.tsxnew file mode 100644index 0000000000..1ee0ee58dc--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/SoulPreviewPanel/SoulPreviewPanel.test.tsx@@ -0,0 +1,30 @@+import { render, screen } from "@/tests/integrations/test-utils";+import { describe, expect, test } from "vitest";+import { SoulPreviewPanel } from "./SoulPreviewPanel";++const baseProps = {+ role: null,+ avatarUrl: null,+ color: null,+ about: null,+ voiceLabel: null,+ kit: null,+};++describe("SoulPreviewPanel", () => {+ test("keeps a heading in the outline before a name is picked", () => {+ render(<SoulPreviewPanel {...baseProps} name="" />);++ expect(+ screen.getByRole("heading", { level: 2, name: "No name yet" }),+ ).toBeDefined();+ });++ test("keeps the same heading element once a name is picked", () => {+ render(<SoulPreviewPanel {...baseProps} name="Maria" />);++ expect(+ screen.getByRole("heading", { level: 2, name: "Maria" }),+ ).toBeDefined();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/SoulPreviewPanel/SoulPreviewPanel.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/SoulPreviewPanel/SoulPreviewPanel.tsxindex af44839546..a8258c2050 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/components/SoulPreviewPanel/SoulPreviewPanel.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/SoulPreviewPanel/SoulPreviewPanel.tsx@@ -1,79 +1,95 @@"use client";-import { Avatar, AvatarFallback } from "@/components/atoms/Avatar/Avatar";-import { raisedIdentity } from "../../helpers";-import { expertInitials } from "./helpers";+import { GlassOrb } from "@/components/molecules/GlassOrb/GlassOrb";+import { DEFAULT_GLASS_PARAMS } from "@/components/molecules/GlassOrb/GlassSurface";+import { cn } from "@/lib/utils";+import Image from "next/image";+import { kitBudgetLabel, kitToolsLabel, type RaiseKit } from "../../helpers";+import { roleLabelFor } from "../RoleStep/helpers";+import { SoulDetailCard } from "./SoulDetailCard";++const REVEAL =+ "duration-700 animate-in fade-in slide-in-from-bottom-2 fill-mode-both motion-reduce:animate-none";++type SoulDetail = {+ label: string;+ value: string;+};type Props = {name: string;+ role: string | null;+ avatarUrl: string | null;+ color: string | null;+ about: string | null;voiceLabel: string | null;- firstJobName: string | null;+ kit: RaiseKit | null;};-export function SoulPreviewPanel({ name, voiceLabel, firstJobName }: Props) {+// Starts as just the orb — an expert with nothing to say about itself yet.+// Answers stack beneath it, which pushes the identity card up as they land.+export function SoulPreviewPanel({+ name,+ role,+ avatarUrl,+ color,+ about,+ voiceLabel,+ kit,+}: Props) {+ const roleLabel = roleLabelFor(role);+ const details = [+ { label: "About", value: about },+ { label: "Voice", value: voiceLabel },+ { label: "Weekly budget", value: kitBudgetLabel(kit) },+ { label: "Tools", value: kitToolsLabel(kit) },+ ].filter((detail): detail is SoulDetail => Boolean(detail.value));+return (- <aside className="flex flex-col overflow-hidden rounded-3xl border border-border bg-background shadow-sm">- <div className="flex items-center gap-3 border-b border-border px-6 py-5">- <Avatar className="h-11 w-11">- <AvatarFallback>{expertInitials(name)}</AvatarFallback>- </Avatar>- <div>- <h2 className="text-lg font-semibold tracking-[-0.01em] text-foreground">- {name ? `${name}'s Soul` : "A new Soul"}+ <div className="flex w-full max-w-[19rem] flex-col items-center gap-3">+ <aside className="flex w-full flex-col items-center gap-8 rounded-[2rem] border border-border bg-background px-8 py-12 shadow-2xl">+ <div className="size-28 shrink-0 overflow-hidden rounded-full">+ {avatarUrl ? (+ <Image+ src={avatarUrl}+ alt={`${name || "Your expert"}'s picture`}+ width={112}+ height={112}+ className="size-28 rounded-full object-cover"+ unoptimized+ />+ ) : (+ <GlassOrb params={DEFAULT_GLASS_PARAMS} showRim={false} />+ )}+ </div>++ <div className="flex flex-col items-center gap-1.5">+ <h2+ className={cn(+ "text-center text-2xl font-semibold tracking-[-0.02em]",+ name ? `text-foreground ${REVEAL}` : "text-muted-foreground/50",+ )}+ >+ {name || "No name yet"}</h2>- <p className="text-sm text-muted-foreground">- Edit any line, anytime.- </p>+ {roleLabel ? (+ <p+ className={`text-sm uppercase tracking-[0.12em] text-muted-foreground ${REVEAL}`}+ >+ {roleLabel}+ </p>+ ) : null}</div>- </div>+ </aside>- <dl className="flex flex-col gap-5 px-6 py-6">- <SoulLine- label="Name"- value={name || null}- placeholder="Waiting for a name…"- />- <SoulLine- label="Identity"- value={name ? raisedIdentity(name) : null}- placeholder="Takes shape once you name me."- />- <SoulLine- label="Voice"- value={voiceLabel}- placeholder="However you'd like me to sound."+ {details.map((detail) => (+ <SoulDetailCard+ key={detail.label}+ label={detail.label}+ value={detail.value}+ color={color}/>- <SoulLine- label="First job"- value={firstJobName}- placeholder="Something to get started on."- />- </dl>- </aside>- );-}--type SoulLineProps = {- label: string;- value: string | null;- placeholder: string;-};--function SoulLine({ label, value, placeholder }: SoulLineProps) {- return (- <div className="flex flex-col gap-1">- <dt className="text-xs font-medium uppercase tracking-[0.12em] text-accent">- {label}- </dt>- <dd- className={- value- ? "text-[15px] text-foreground"- : "text-[15px] italic text-muted-foreground"- }- >- {value ?? placeholder}- </dd>+ ))}</div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/conversationScroll.test.ts b/autogpt_platform/frontend/src/app/(platform)/raise/conversationScroll.test.tsnew file mode 100644index 0000000000..f3bac996c2--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/conversationScroll.test.ts@@ -0,0 +1,125 @@+import { describe, expect, test } from "vitest";+import {+ MIN_BOTTOM_PADDING,+ bottomPaddingToCenter,+ centerLastChild,+ isPromptStepPair,+ scrollTopToCenterChild,+} from "./conversationScroll";++describe("conversationScroll", () => {+ test("pairs a prompt message with its matching step", () => {+ const prompt = document.createElement("div");+ prompt.id = "autogpt-voice-question";+ const step = document.createElement("div");+ step.id = "voice-step";++ expect(isPromptStepPair(prompt, step)).toBe(true);+ expect(isPromptStepPair(null, step)).toBe(false);++ step.id = "kit-step";+ expect(isPromptStepPair(prompt, step)).toBe(false);+ });++ test("pads enough that a short last item can sit in the vertical center", () => {+ expect(bottomPaddingToCenter(800, 80)).toBe(360);+ });++ test("keeps a minimum bottom padding when the last item is taller than the pane", () => {+ expect(bottomPaddingToCenter(800, 900)).toBe(MIN_BOTTOM_PADDING);+ });++ test("computes scrollTop so the child center matches the pane center", () => {+ expect(+ scrollTopToCenterChild({+ childOffsetTop: 400,+ childHeight: 80,+ viewportHeight: 800,+ maxScrollTop: 1000,+ }),+ ).toBe(40);+ });++ test("aligns a block taller than the pane to its top", () => {+ expect(+ scrollTopToCenterChild({+ childOffsetTop: 1200,+ childHeight: 900,+ viewportHeight: 800,+ maxScrollTop: 3000,+ }),+ ).toBe(1200);+ });++ test("clamps to the scrollable range when there is not enough room", () => {+ expect(+ scrollTopToCenterChild({+ childOffsetTop: 0,+ childHeight: 80,+ viewportHeight: 800,+ maxScrollTop: 20,+ }),+ ).toBe(0);+ expect(+ scrollTopToCenterChild({+ childOffsetTop: 2000,+ childHeight: 80,+ viewportHeight: 800,+ maxScrollTop: 50,+ }),+ ).toBe(50);+ });++ test("centers the last child in the scroll container", () => {+ const container = document.createElement("div");+ Object.assign(container.style, {+ height: "400px",+ overflow: "auto",+ position: "relative",+ });++ const spacer = document.createElement("div");+ spacer.style.height = "1200px";+ container.appendChild(spacer);++ const target = document.createElement("div");+ target.style.height = "80px";+ container.appendChild(target);++ document.body.appendChild(container);++ centerLastChild(container, "auto");++ const childOffsetTop = 1200;+ const expectedTop = scrollTopToCenterChild({+ childOffsetTop,+ childHeight: 80,+ viewportHeight: 400,+ maxScrollTop: container.scrollHeight - container.clientHeight,+ });++ expect(container.scrollTop).toBe(expectedTop);+ expect(+ Number.parseFloat(container.style.paddingBottom),+ ).toBeGreaterThanOrEqual(MIN_BOTTOM_PADDING);++ document.body.removeChild(container);+ });++ test("scrolls less far when centering a prompt+step block than the step alone", () => {+ const pairTop = scrollTopToCenterChild({+ childOffsetTop: 1200,+ childHeight: 600,+ viewportHeight: 400,+ maxScrollTop: 2000,+ });+ const stepOnlyTop = scrollTopToCenterChild({+ childOffsetTop: 1280,+ childHeight: 520,+ viewportHeight: 400,+ maxScrollTop: 2000,+ });++ expect(pairTop).toBeLessThan(stepOnlyTop);+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/conversationScroll.ts b/autogpt_platform/frontend/src/app/(platform)/raise/conversationScroll.tsnew file mode 100644index 0000000000..8ebc0d5711--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/conversationScroll.ts@@ -0,0 +1,106 @@+import { BEAT_KEYS, questionId, stepId, type BeatKey } from "./flowItems";++export const MIN_BOTTOM_PADDING = 64;++export function bottomPaddingToCenter(+ viewportHeight: number,+ lastChildHeight: number,+ minPadding = MIN_BOTTOM_PADDING,+) {+ return Math.max(minPadding, (viewportHeight - lastChildHeight) / 2);+}++export function scrollTopToCenterChild({+ childOffsetTop,+ childHeight,+ viewportHeight,+ maxScrollTop,+}: {+ childOffsetTop: number;+ childHeight: number;+ viewportHeight: number;+ maxScrollTop: number;+}) {+ // A block taller than the pane cannot be centered without pushing its own+ // question off the top, so it is aligned to the top instead.+ const next =+ childHeight >= viewportHeight+ ? childOffsetTop+ : childOffsetTop + childHeight / 2 - viewportHeight / 2;+ return Math.max(0, Math.min(next, Math.max(0, maxScrollTop)));+}++function beatFromPromptId(id: string): BeatKey | null {+ return BEAT_KEYS.find((beat) => questionId(beat) === id) ?? null;+}++function beatFromStepId(id: string): BeatKey | null {+ return BEAT_KEYS.find((beat) => stepId(beat) === id) ?? null;+}++export function isPromptStepPair(+ prompt: Element | null,+ step: HTMLElement,+): boolean {+ if (!(prompt instanceof HTMLElement)) return false;+ const promptBeat = beatFromPromptId(prompt.id);+ const stepBeat = beatFromStepId(step.id);+ return promptBeat !== null && promptBeat === stepBeat;+}++export function scrollTargetBounds(container: HTMLElement) {+ const last = container.lastElementChild;+ if (!(last instanceof HTMLElement)) return null;++ const prev = last.previousElementSibling;+ const containerRect = container.getBoundingClientRect();+ const scrollTop = container.scrollTop;++ if (isPromptStepPair(prev, last)) {+ const prompt = prev as HTMLElement;+ const promptRect = prompt.getBoundingClientRect();+ const stepRect = last.getBoundingClientRect();+ return {+ offsetTop: promptRect.top - containerRect.top + scrollTop,+ height: stepRect.bottom - promptRect.top,+ };+ }++ const childRect = last.getBoundingClientRect();+ return {+ offsetTop: childRect.top - containerRect.top + scrollTop,+ height: childRect.height,+ };+}++export function padContainerToCenterLastChild(container: HTMLElement) {+ const bounds = scrollTargetBounds(container);+ if (!bounds) return;++ const padding = bottomPaddingToCenter(container.clientHeight, bounds.height);+ if (container.style.paddingBottom !== `${padding}px`) {+ container.style.paddingBottom = `${padding}px`;+ }+}++export function centerLastChild(+ container: HTMLElement,+ behavior: ScrollBehavior,+) {+ padContainerToCenterLastChild(container);++ const bounds = scrollTargetBounds(container);+ if (!bounds) return;++ const maxScrollTop = container.scrollHeight - container.clientHeight;++ container.scrollTo({+ top: scrollTopToCenterChild({+ childOffsetTop: bounds.offsetTop,+ childHeight: bounds.height,+ viewportHeight: container.clientHeight,+ maxScrollTop,+ }),+ behavior,+ });+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/flowItems.ts b/autogpt_platform/frontend/src/app/(platform)/raise/flowItems.tsnew file mode 100644index 0000000000..c059d9b88f--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/flowItems.ts@@ -0,0 +1,139 @@+import { RAISE_PROMPTS, type RaiseDraft } from "./helpers";++// One beat per question: the question waits for the previous answer, and the+// controls it introduces wait for the question to finish typing.+export const BEAT_KEYS = [+ "role",+ "name",+ "color",+ "avatar",+ "about",+ "voice",+ "budget",+ "marketplace",+ "skills",+] as const;++export type BeatKey = (typeof BEAT_KEYS)[number];++export interface RaiseProgress {+ prompts: Record<BeatKey, boolean>;+ steps: Record<BeatKey, boolean>;+}++export type RaiseFlowItem =+ | { kind: "message"; id: string; role: "autogpt" | "user"; text: string }+ | { kind: "startButton"; id: string }+ | { kind: "step"; id: string; beat: BeatKey };++// Derived from the draft rather than accumulated, so refresh restores and+// back transitions always rebuild the same stream.+export function buildFlowItems(+ draft: RaiseDraft,+ progress: RaiseProgress,+): RaiseFlowItem[] {+ const items: RaiseFlowItem[] = [+ {+ kind: "message",+ id: "autogpt-greeting",+ role: "autogpt",+ text: RAISE_PROMPTS.greeting,+ },+ { kind: "startButton", id: "start-button" },+ ];++ const questions: Record<BeatKey, string> = {+ role: RAISE_PROMPTS.roleQuestion,+ name: RAISE_PROMPTS.nameQuestion,+ color: RAISE_PROMPTS.colorQuestion,+ avatar: RAISE_PROMPTS.avatarQuestion(draft.name),+ about: RAISE_PROMPTS.aboutQuestion(draft.name),+ voice: RAISE_PROMPTS.voiceQuestion(draft.name),+ budget: RAISE_PROMPTS.budgetQuestion(draft.name),+ marketplace: RAISE_PROMPTS.marketplaceQuestion(draft.name),+ skills: RAISE_PROMPTS.skillsQuestion(draft.name),+ };++ BEAT_KEYS.forEach((beat) => {+ if (progress.prompts[beat]) {+ items.push({+ kind: "message",+ id: questionId(beat),+ role: "autogpt",+ text: questions[beat],+ });+ }+ if (progress.steps[beat]) {+ items.push({ kind: "step", id: stepId(beat), beat });+ }+ });++ return items;+}++export function questionId(beat: BeatKey) {+ return `autogpt-${beat}-question`;+}++export function stepId(beat: BeatKey) {+ return `${beat}-step`;+}++// Each beat's question is asked once the beat before it has an answer.+export function beatTriggers(draft: RaiseDraft): Record<BeatKey, boolean> {+ return {+ role: draft.hasStarted,+ name: draft.role !== null,+ color: draft.name !== "",+ avatar: draft.color !== null,+ about: draft.avatarUrl !== null,+ voice: draft.about !== null,+ budget: draft.voiceLabel !== null,+ marketplace: draft.budget !== null,+ skills: draft.marketplace !== null,+ };+}++function beatAnswers(draft: RaiseDraft): Record<BeatKey, boolean> {+ return {+ role: draft.role !== null,+ name: draft.name !== "",+ color: draft.color !== null,+ avatar: draft.avatarUrl !== null,+ about: draft.about !== null,+ voice: draft.voiceLabel !== null,+ budget: draft.budget !== null,+ marketplace: draft.marketplace !== null,+ skills: draft.skills !== null,+ };+}++export function lastAnsweredBeat(draft: RaiseDraft): BeatKey | null {+ const answers = beatAnswers(draft);+ return BEAT_KEYS.filter((beat) => answers[beat]).pop() ?? null;+}++// Going back re-opens a beat by dropping its answer; every question after it+// disappears on its own because the stream is derived from the answers.+export function clearedAnswer(beat: BeatKey): Partial<RaiseDraft> {+ switch (beat) {+ case "role":+ return { role: null };+ case "name":+ return { name: "" };+ case "color":+ return { color: null };+ case "avatar":+ return { avatarUrl: null };+ case "about":+ return { about: null };+ case "voice":+ return { voicePreferences: "", voiceLabel: null };+ case "budget":+ return { budget: null };+ case "marketplace":+ return { marketplace: null };+ case "skills":+ return { skills: null };+ }+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/raise/helpers.test.tsindex 5d7c6d42dd..302c3baff1 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/helpers.test.ts+++ b/autogpt_platform/frontend/src/app/(platform)/raise/helpers.test.ts@@ -1,9 +1,17 @@import type { VoiceSample } from "@/app/api/__generated__/models/voiceSample";-import { describe, expect, test } from "vitest";+import { beforeEach, describe, expect, test } from "vitest";import {+ assembledKit,+ EMPTY_DRAFT,getExpertLimitCode,+ kitBudgetLabel,+ kitToolsLabel,+ loadDraft,raisedIdentity,+ type RaiseDraft,resolveVoicePreferences,+ saveDraft,+ VOICE_SKIPPED_LABEL,voiceSummaryLabel,} from "./helpers";@@ -48,4 +56,102 @@ describe("raise helpers", () => {expect(getExpertLimitCode({ detail: "legacy error" })).toBeNull();expect(getExpertLimitCode(null)).toBeNull();});++ test("formats weekly budget and tool labels for the soul preview", () => {+ expect(kitBudgetLabel(null)).toBeNull();+ expect(kitBudgetLabel({ weeklyBudget: null, attachments: [] })).toBeNull();+ expect(kitBudgetLabel({ weeklyBudget: 0, attachments: [] })).toBe(+ "No weekly limit",+ );+ expect(kitBudgetLabel({ weeklyBudget: 500, attachments: [] })).toBe(+ "500 credits ($5/week)",+ );+ expect(+ kitToolsLabel({+ weeklyBudget: null,+ attachments: [+ {+ kind: "skill",+ source: "library",+ id: "seo-audit",+ name: "SEO audit",+ },+ ],+ }),+ ).toBe("SEO audit");+ });++ test("assembles preview kit from answered budget and attachments", () => {+ expect(assembledKit(EMPTY_DRAFT)).toBeNull();+ expect(+ assembledKit({+ ...EMPTY_DRAFT,+ budget: { credits: 500 },+ marketplace: [+ {+ kind: "workflow",+ source: "marketplace",+ id: "listing-1",+ name: "SEO Blog Writer",+ },+ ],+ }),+ ).toEqual({+ weeklyBudget: 500,+ attachments: [+ {+ kind: "workflow",+ source: "marketplace",+ id: "listing-1",+ name: "SEO Blog Writer",+ },+ ],+ });+ });++ test("keeps a skipped budget distinct from an unanswered one", () => {+ expect(assembledKit({ ...EMPTY_DRAFT, budget: { credits: null } })).toEqual(+ { weeklyBudget: null, attachments: [] },+ );+ });+});++describe("restoring a persisted draft", () => {+ beforeEach(() => {+ window.sessionStorage.clear();+ });++ test("backfills the skipped-voice label when the draft is past the voice beat", () => {+ saveDraft({ ...EMPTY_DRAFT, step: "budget", voiceLabel: null });++ expect(loadDraft().voiceLabel).toBe(VOICE_SKIPPED_LABEL);+ });++ test("leaves the voice beat unanswered when the draft has not reached it", () => {+ saveDraft({ ...EMPTY_DRAFT, step: "about", voiceLabel: null });++ expect(loadDraft().voiceLabel).toBeNull();+ });++ test("keeps an explicitly picked voice label", () => {+ saveDraft({ ...EMPTY_DRAFT, step: "budget", voiceLabel: "Direct" });++ expect(loadDraft().voiceLabel).toBe("Direct");+ });++ test("moves a draft parked on the retired kit step onto budget", () => {+ saveStepFromEarlierBuild("kit");++ expect(loadDraft().step).toBe("budget");+ });++ test("restarts the flow when the stored step is not a known step", () => {+ saveStepFromEarlierBuild("space-invaders");++ expect(loadDraft().step).toBe(EMPTY_DRAFT.step);+ });});++function saveStepFromEarlierBuild(step: string) {+ saveDraft({ ...EMPTY_DRAFT, step } as RaiseDraft);+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/raise/helpers.tsindex 9c9a67d52f..9ecef10964 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/helpers.ts+++ b/autogpt_platform/frontend/src/app/(platform)/raise/helpers.ts@@ -4,9 +4,43 @@ import {type VoicePickResult,} from "@/components/organisms/VoicePicker/helpers";-export type RaiseStep = "name" | "voice" | "firstJob" | "review";+export type RaiseStep =+ | "role"+ | "name"+ | "color"+ | "avatar"+ | "about"+ | "voice"+ | "budget"+ | "marketplace"+ | "skills"+ | "done";++export const STEP_ORDER: RaiseStep[] = [+ "role",+ "name",+ "color",+ "avatar",+ "about",+ "voice",+ "budget",+ "marketplace",+ "skills",+ "done",+];-export const NAME_CHIPS = ["Otto", "Nova", "Juno"];+export interface RaiseAttachmentDraft {+ kind: "workflow" | "skill";+ source: "marketplace" | "library";+ id: string;+ name: string;+ marketplaceKey?: string;+}++export interface RaiseKit {+ weeklyBudget: number | null;+ attachments: RaiseAttachmentDraft[];+}export const VOICE_SAMPLES: VoiceSample[] = [{@@ -20,31 +54,60 @@ export const VOICE_SAMPLES: VoiceSample[] = [];export const RAISE_PROMPTS = {- name: "Hi. I don't have a name yet — that's where you come in.",- voice: (name: string) =>- `Nice to meet you, ${name}. How should I sound when I write?`,- firstJob:- "What should I take on first? Pick a starter job, or skip and we'll figure it out together.",- review: "That's me so far. Ready when you are — I'll open our first chat.",+ greeting: "Hello, I'm Autopilot. I'll help you raise your own expert.",+ roleQuestion: "First — what should your expert do for you?",+ nameQuestion: "Good pick. What do you want to call it?",+ colorQuestion: "Nice. Now choose a color for it.",+ avatarQuestion: (name: string) =>+ `Want to give ${name || "it"} a face? Upload a picture, let me generate one, or skip it.`,+ aboutQuestion: (name: string) =>+ `Anything else I should know about ${name || "your expert"}? How it should work, what matters to you — or skip it.`,+ voiceQuestion: (name: string) =>+ `How should ${name || "your expert"} sound when it writes? Pick the one that feels right.`,+ budgetQuestion: (name: string) =>+ `How much weekly budget should ${name || "your expert"} have? 500 credits is the default — pick an amount, or skip.`,+ marketplaceQuestion: (name: string) =>+ `Want ${name || "your expert"} to run workflows? Search the marketplace and your library, then add any you like — or skip.`,+ skillsQuestion: (name: string) =>+ `Should ${name || "your expert"} have extra skills? Add from your library, or a marketplace agent as a skill — or skip.`,};+// Beat before each question lands, so the control that triggered it settles+// into its new state first.+export const PROMPT_DELAY_MS = 500;+export const VOICE_SKIPPED_LABEL = "I'll decide the voice later";-export const FIRST_JOB_SKIPPED_LABEL = "Skip for now";export interface RaiseDraft {step: RaiseStep;+ hasStarted: boolean;+ role: string | null;name: string;+ color: string | null;+ // "" once the user skips, so the question is not asked again on restore.+ avatarUrl: string | null;+ about: string | null;voicePreferences: string;voiceLabel: string | null;- firstJob: { id: string; name: string } | null;+ // Outer null = not answered yet. credits null = skipped (platform default).+ budget: { credits: number | null } | null;+ marketplace: RaiseAttachmentDraft[] | null;+ skills: RaiseAttachmentDraft[] | null;}export const EMPTY_DRAFT: RaiseDraft = {- step: "name",+ step: "role",+ hasStarted: false,+ role: null,name: "",+ color: null,+ avatarUrl: null,+ about: null,voicePreferences: "",voiceLabel: null,- firstJob: null,+ budget: null,+ marketplace: null,+ skills: null,};const DRAFT_STORAGE_KEY = "raise-expert-draft";@@ -54,13 +117,32 @@ export function loadDraft(): RaiseDraft {try {const raw = window.sessionStorage.getItem(DRAFT_STORAGE_KEY);if (!raw) return EMPTY_DRAFT;- const parsed = JSON.parse(raw) as Partial<RaiseDraft>;- return { ...EMPTY_DRAFT, ...parsed };+ const parsed = JSON.parse(raw) as Omit<Partial<RaiseDraft>, "step"> & {+ step?: string;+ };+ const step = parsed.step === "kit" ? "budget" : parsed.step;+ return backfillSkippedVoice({+ ...EMPTY_DRAFT,+ ...parsed,+ step: isRaiseStep(step) ? step : EMPTY_DRAFT.step,+ });} catch {return EMPTY_DRAFT;}}+// A draft written by an earlier build recorded a skipped voice as a null+// label. The flow now treats null as "not answered", which would leave a+// restored session parked on the voice beat with no way forward, so a draft+// that has already moved past voice gets the sentinel back.+function backfillSkippedVoice(draft: RaiseDraft): RaiseDraft {+ if (draft.voiceLabel !== null) return draft;+ if (STEP_ORDER.indexOf(draft.step) <= STEP_ORDER.indexOf("voice")) {+ return draft;+ }+ return { ...draft, voiceLabel: VOICE_SKIPPED_LABEL };+}+export function saveDraft(draft: RaiseDraft) {try {window.sessionStorage.setItem(DRAFT_STORAGE_KEY, JSON.stringify(draft));@@ -77,68 +159,29 @@ export function clearDraft() {}}-interface RaiseMessage {- id: string;- role: "assistant" | "user";- text: string;+function isRaiseStep(step: string | undefined): step is RaiseStep {+ return STEP_ORDER.includes(step as RaiseStep);}-const STEP_ORDER: RaiseStep[] = ["name", "voice", "firstJob", "review"];+export function assembledKit(draft: RaiseDraft): RaiseKit | null {+ if (+ draft.budget === null &&+ draft.marketplace === null &&+ draft.skills === null+ ) {+ return null;+ }+ return {+ weeklyBudget: draft.budget?.credits ?? null,+ attachments: [...(draft.marketplace ?? []), ...(draft.skills ?? [])],+ };+}export function previousStep(step: RaiseStep): RaiseStep {const index = STEP_ORDER.indexOf(step);return STEP_ORDER[Math.max(index - 1, 0)];}-// The transcript is derived from the draft rather than accumulated, so-// back transitions and refresh restores always rebuild it consistently.-export function buildTranscript(draft: RaiseDraft): RaiseMessage[] {- const messages: RaiseMessage[] = [- { id: "assistant-name", role: "assistant", text: RAISE_PROMPTS.name },- ];- const stepIndex = STEP_ORDER.indexOf(draft.step);-- if (stepIndex >= 1) {- messages.push(- { id: "user-name", role: "user", text: draft.name },- {- id: "assistant-voice",- role: "assistant",- text: RAISE_PROMPTS.voice(draft.name),- },- );- }- if (stepIndex >= 2) {- messages.push(- {- id: "user-voice",- role: "user",- text: draft.voiceLabel ?? VOICE_SKIPPED_LABEL,- },- {- id: "assistant-first-job",- role: "assistant",- text: RAISE_PROMPTS.firstJob,- },- );- }- if (stepIndex >= 3) {- messages.push(- {- id: "user-first-job",- role: "user",- text: draft.firstJob?.name ?? FIRST_JOB_SKIPPED_LABEL,- },- {- id: "assistant-review",- role: "assistant",- text: RAISE_PROMPTS.review,- },- );- }- return messages;-}-export function voiceSummaryLabel(result: VoicePickResult,samples: VoiceSample[],@@ -160,6 +203,22 @@ export function raisedIdentity(name: string): string {return `I'm ${name}, raised by you. I learn how you work and grow with you.`;}+export function creditsToUsdLabel(credits: number): string {+ const dollars = credits / 100;+ return Number.isInteger(dollars) ? `$${dollars}` : `$${dollars.toFixed(2)}`;+}++export function kitBudgetLabel(kit: RaiseKit | null): string | null {+ if (!kit || kit.weeklyBudget === null) return null;+ if (kit.weeklyBudget === 0) return "No weekly limit";+ return `${kit.weeklyBudget.toLocaleString()} credits (${creditsToUsdLabel(kit.weeklyBudget)}/week)`;+}++export function kitToolsLabel(kit: RaiseKit | null): string | null {+ if (!kit || kit.attachments.length === 0) return null;+ return kit.attachments.map((attachment) => attachment.name).join(", ");+}+export function getExpertLimitCode(response: unknown): string | null {if (!response || typeof response !== "object" || !("detail" in response)) {return null;diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/page.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/page.tsxindex 873cb617d6..3a2a8ce5ca 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/raise/page.tsx@@ -29,16 +29,16 @@ export default function RaisePage() {function RaiseSkeleton() {return (<main- className="min-h-screen bg-muted/30 px-4 pb-16 pt-6 sm:px-6 lg:px-8"+ className="min-h-screen bg-background lg:h-screen lg:overflow-hidden"aria-label="Loading…">- <div className="mx-auto grid w-full max-w-[1000px] gap-6 lg:grid-cols-[1fr_minmax(300px,360px)]">- <div className="order-2 flex flex-col gap-4 lg:order-1">+ <div className="grid w-full items-stretch lg:h-full lg:grid-cols-2">+ <div className="order-2 flex flex-col gap-4 px-4 pb-16 pt-6 sm:px-6 lg:order-1 lg:h-screen lg:overflow-y-auto lg:px-8"><Skeleton className="h-16 w-3/4 rounded-3xl" /><Skeleton className="h-40 w-full rounded-2xl" /></div>- <div className="order-1 lg:order-2">- <Skeleton className="h-80 w-full rounded-3xl" />+ <div className="order-1 m-2 overflow-hidden rounded-[2.5rem] bg-muted/40 p-4 sm:p-6 lg:order-2">+ <Skeleton className="h-80 w-full rounded-[2rem]" /></div></div></main>diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/useConversationScroll.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/useConversationScroll.test.tsxnew file mode 100644index 0000000000..5d3ea0ae59--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/useConversationScroll.test.tsx@@ -0,0 +1,91 @@+import { fireEvent, render, screen, waitFor } from "@testing-library/react";+import { beforeEach, describe, expect, test, vi } from "vitest";+import { isTextEntry, useConversationScroll } from "./useConversationScroll";++function Harness() {+ const { scrollRef } = useConversationScroll();++ return (+ <div ref={scrollRef} data-testid="log">+ <div id="autogpt-about-question">Anything about your expert?</div>+ <div id="about-step">+ <textarea data-testid="about" />+ </div>+ </div>+ );+}++function renderHarness() {+ render(<Harness />);+ const log = screen.getByTestId("log");+ // happy-dom has no layout, so the column has to be told it overflows for+ // "did the reader scroll away from the end" to mean anything.+ Object.defineProperty(log, "clientHeight", {+ value: 400,+ configurable: true,+ });+ Object.defineProperty(log, "scrollHeight", {+ value: 1200,+ configurable: true,+ });+ const scrollTo = vi.fn();+ log.scrollTo = scrollTo;++ return { log, scrollTo };+}++async function appendStep(log: HTMLElement) {+ const step = document.createElement("div");+ step.id = "voice-step";+ log.appendChild(step);+}++describe("useConversationScroll", () => {+ beforeEach(() => {+ vi.restoreAllMocks();+ });++ test("keeps following when the reader types a space in an answer field", async () => {+ const { log, scrollTo } = renderHarness();++ fireEvent.keyDown(screen.getByTestId("about"), { key: " " });+ await appendStep(log);++ await waitFor(() => expect(scrollTo).toHaveBeenCalled());+ });++ test("stops following when the reader presses a scroll key on the column", async () => {+ const { log, scrollTo } = renderHarness();++ fireEvent.keyDown(log, { key: "PageUp" });+ await appendStep(log);++ await new Promise((resolve) => setTimeout(resolve, 50));+ expect(scrollTo).not.toHaveBeenCalled();+ });++ test("follows again once the reader scrolls back to the end", async () => {+ const { log, scrollTo } = renderHarness();++ fireEvent.keyDown(log, { key: "PageUp" });+ log.scrollTop = 800;+ fireEvent.scroll(log);+ await appendStep(log);++ await waitFor(() => expect(scrollTo).toHaveBeenCalled());+ });+});++describe("isTextEntry", () => {+ test("recognises the fields an answer gets typed into", () => {+ expect(isTextEntry(document.createElement("textarea"))).toBe(true);+ expect(isTextEntry(document.createElement("input"))).toBe(true);+ expect(isTextEntry(document.createElement("select"))).toBe(true);+ });++ test("does not treat the conversation column as a field", () => {+ expect(isTextEntry(document.createElement("div"))).toBe(false);+ expect(isTextEntry(document.createElement("button"))).toBe(false);+ expect(isTextEntry(null)).toBe(false);+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/useConversationScroll.ts b/autogpt_platform/frontend/src/app/(platform)/raise/useConversationScroll.tsnew file mode 100644index 0000000000..d6a0f86375--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/useConversationScroll.ts@@ -0,0 +1,171 @@+import { useEffect, useRef, useState } from "react";+import {+ centerLastChild,+ padContainerToCenterLastChild,+} from "./conversationScroll";++// A pixel of slack: sub-pixel scroll heights would otherwise leave the bottom+// fade stuck on when the column is already scrolled to the end.+const EDGE_TOLERANCE = 1;+// Smooth centering can take a few frames; ignore scroll events caused by it.+const AUTO_SCROLL_SETTLE_MS = 400;+const SCROLL_KEYS = new Set([+ "ArrowUp",+ "ArrowDown",+ "PageUp",+ "PageDown",+ "Home",+ "End",+ " ",+]);++export function useConversationScroll() {+ const scrollRef = useRef<HTMLDivElement>(null);+ const isFollowingRef = useRef(true);+ const isAutoScrollingRef = useRef(false);+ const autoScrollTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const [canScrollUp, setCanScrollUp] = useState(false);+ const [canScrollDown, setCanScrollDown] = useState(false);++ useEffect(() => {+ const element = scrollRef.current;+ if (!element) return;++ function distanceFromBottom(target: HTMLDivElement) {+ return target.scrollHeight - target.scrollTop - target.clientHeight;+ }++ function measure() {+ if (!element) return;+ const remaining = distanceFromBottom(element);+ setCanScrollUp(element.scrollTop > EDGE_TOLERANCE);+ setCanScrollDown(remaining > EDGE_TOLERANCE);+ }++ function releaseFollow() {+ isFollowingRef.current = false;+ }++ // A wheel or drag inside an answer field scrolls that field, not the+ // column, so it is not the reader taking over.+ function handlePointerScroll(event: Event) {+ if (isTextEntry(event.target)) return;+ releaseFollow();+ }++ function handleScroll() {+ if (!element) return;+ if (!isAutoScrollingRef.current) {+ // Scrolling back to the end is how the reader re-joins the conversation.+ isFollowingRef.current = distanceFromBottom(element) <= EDGE_TOLERANCE;+ }+ measure();+ }++ function handleKeyDown(event: KeyboardEvent) {+ // Typing an answer bubbles space/arrow keys up here; they move a caret,+ // not the column, so they must not count as taking over the scroll.+ if (isTextEntry(event.target)) return;+ if (SCROLL_KEYS.has(event.key)) {+ releaseFollow();+ }+ }++ function clearAutoScrollGuard() {+ isAutoScrollingRef.current = false;+ if (autoScrollTimerRef.current) {+ clearTimeout(autoScrollTimerRef.current);+ autoScrollTimerRef.current = null;+ }+ }++ function markAutoScrolling(behavior: ScrollBehavior) {+ isAutoScrollingRef.current = true;+ if (autoScrollTimerRef.current) {+ clearTimeout(autoScrollTimerRef.current);+ }+ if (behavior === "smooth") {+ autoScrollTimerRef.current = setTimeout(+ clearAutoScrollGuard,+ AUTO_SCROLL_SETTLE_MS,+ );+ }+ }++ // Steps mount and the typewriter grows text without any scroll or window+ // resize, so content height is what we actually have to watch.+ function handleContentChange() {+ if (!element) return;++ requestAnimationFrame(() => {+ requestAnimationFrame(() => {+ if (!element) return;+ if (isFollowingRef.current) {+ const behavior = prefersReducedMotion() ? "auto" : "smooth";+ markAutoScrolling(behavior);+ centerLastChild(element, behavior);+ if (behavior === "auto") {+ clearAutoScrollGuard();+ }+ } else {+ padContainerToCenterLastChild(element);+ }+ measure();+ });+ });+ }++ measure();+ element.addEventListener("scroll", handleScroll, { passive: true });+ element.addEventListener("wheel", handlePointerScroll, { passive: true });+ element.addEventListener("touchmove", handlePointerScroll, {+ passive: true,+ });+ element.addEventListener("keydown", handleKeyDown);+ element.addEventListener("scrollend", clearAutoScrollGuard, {+ passive: true,+ });++ function observeResizeTargets(root: Element) {+ observer.observe(root);+ Array.from(root.children).forEach((child) => observeResizeTargets(child));+ }++ const observer = new ResizeObserver(handleContentChange);+ observeResizeTargets(element);++ const mutations = new MutationObserver((records) => {+ records.forEach((record) => {+ record.addedNodes.forEach((node) => {+ if (node instanceof Element) observeResizeTargets(node);+ });+ });+ handleContentChange();+ });+ mutations.observe(element, { childList: true });++ return () => {+ element.removeEventListener("scroll", handleScroll);+ element.removeEventListener("wheel", handlePointerScroll);+ element.removeEventListener("touchmove", handlePointerScroll);+ element.removeEventListener("keydown", handleKeyDown);+ element.removeEventListener("scrollend", clearAutoScrollGuard);+ observer.disconnect();+ mutations.disconnect();+ clearAutoScrollGuard();+ };+ }, []);++ return { scrollRef, canScrollUp, canScrollDown };+}++export function isTextEntry(target: EventTarget | null) {+ if (!(target instanceof HTMLElement)) return false;+ if (target.isContentEditable) return true;+ return ["INPUT", "TEXTAREA", "SELECT"].includes(target.tagName);+}++function prefersReducedMotion() {+ if (typeof window === "undefined") return true;+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/useFlowProgress.ts b/autogpt_platform/frontend/src/app/(platform)/raise/useFlowProgress.tsnew file mode 100644index 0000000000..fc9c646639--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/useFlowProgress.ts@@ -0,0 +1,58 @@+import { useEffect, useState } from "react";+import { BEAT_KEYS, type BeatKey } from "./flowItems";+import { PROMPT_DELAY_MS } from "./helpers";++type Beats = Record<BeatKey, boolean>;++function beats(value: boolean | Beats): Beats {+ if (typeof value !== "boolean") return { ...value };+ return BEAT_KEYS.reduce(+ (acc, key) => ({ ...acc, [key]: value }),+ {} as Beats,+ );+}++// Paces the stream: a question waits a beat after the answer before it, and+// the controls it introduces wait for it to finish typing. Seeded from the+// restored draft so a refresh mid-flow replays nothing.+export function useFlowProgress(triggers: Beats) {+ const [prompts, setPrompts] = useState<Beats>(() => beats(triggers));+ const [steps, setSteps] = useState<Beats>(() => beats(triggers));+ const pending = BEAT_KEYS.filter((key) => triggers[key] && !prompts[key]);+ const pendingKey = pending.join(",");++ useEffect(() => {+ if (!pendingKey) return;+ const timer = setTimeout(() => {+ setPrompts((current) => {+ const next = { ...current };+ pendingKey.split(",").forEach((key) => {+ next[key as BeatKey] = true;+ });+ return next;+ });+ }, PROMPT_DELAY_MS);+ return () => clearTimeout(timer);+ }, [pendingKey]);++ function revealStep(beat: BeatKey) {+ setSteps((current) => ({ ...current, [beat]: true }));+ }++ function reset() {+ setPrompts(beats(false));+ setSteps(beats(false));+ }++ // Prompts and steps latch on, so re-opening a beat has to unlatch the ones+ // that came after it.+ function clearAfter(beat: BeatKey) {+ const later = BEAT_KEYS.slice(BEAT_KEYS.indexOf(beat) + 1);+ const clear = (current: Beats) =>+ later.reduce((acc, key) => ({ ...acc, [key]: false }), { ...current });+ setPrompts(clear);+ setSteps(clear);+ }++ return { prompts, steps, revealStep, reset, clearAfter };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.ts b/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.tsindex 53b6f80f80..a8d7f763ab 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.ts+++ b/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.ts@@ -1,34 +1,37 @@-import { useCreateRaisedExpert } from "@/app/api/__generated__/endpoints/experts/experts";-import type { RaiseResult } from "@/app/api/__generated__/models/raiseResult";-import { toast } from "@/components/molecules/Toast/use-toast";import type { VoicePickResult } from "@/components/organisms/VoicePicker/helpers";-import { ApiError } from "@/lib/autogpt-server-api/helpers";-import { useRouter } from "next/navigation";-import { useRef, useState } from "react";+import { useState } from "react";import {- buildTranscript,+ beatTriggers,+ buildFlowItems,+ clearedAnswer,+ lastAnsweredBeat,+ type BeatKey,+} from "./flowItems";+import {+ assembledKit,clearDraft,- getExpertLimitCode,+ EMPTY_DRAFT,loadDraft,- previousStep,resolveVoicePreferences,saveDraft,voiceSummaryLabel,VOICE_SAMPLES,+ VOICE_SKIPPED_LABEL,+ type RaiseAttachmentDraft,type RaiseDraft,+ type RaiseKit,} from "./helpers";+import { useFlowProgress } from "./useFlowProgress";+import { useRaiseSubmission } from "./useRaiseSubmission";export function useRaisePage() {- const router = useRouter();- const { mutateAsync: createRaisedExpert, isPending } =- useCreateRaisedExpert();const [draft, setDraft] = useState<RaiseDraft>(loadDraft);- const [isSubmissionLocked, setIsSubmissionLocked] = useState(false);- // Synchronous latch: isPending only flips after a rerender, so a rapid- // double-click could dispatch two POSTs without it. Stays latched after- // success (we are navigating away); resets only on error so the user- // can retry.- const submitLatch = useRef(false);+ const progress = useFlowProgress(beatTriggers(draft));+ const { finish: submitRaise, isSubmitting } = useRaiseSubmission();++ function finish(kit: RaiseKit) {+ void submitRaise(draft, kit);+ }function update(changes: Partial<RaiseDraft>) {const next = { ...draft, ...changes };@@ -36,10 +39,44 @@ export function useRaisePage() {setDraft(next);}+ function startRaising() {+ update({ hasStarted: true });+ }++ function restart() {+ clearDraft();+ setDraft(EMPTY_DRAFT);+ progress.reset();+ }++ function pickRole(roleId: string) {+ update({ role: roleId, step: "name" });+ }+function submitName(value: string) {const trimmed = value.trim();if (!trimmed) return;- update({ name: trimmed, step: "voice" });+ update({ name: trimmed, step: "color" });+ }++ function pickColor(colorId: string) {+ update({ color: colorId, step: "avatar" });+ }++ function pickAvatar(avatarUrl: string) {+ update({ avatarUrl, step: "about" });+ }++ function skipAvatar() {+ update({ avatarUrl: "", step: "about" });+ }++ function submitAbout(value: string) {+ update({ about: value.trim(), step: "voice" });+ }++ function skipAbout() {+ update({ about: "", step: "voice" });}function pickVoice(result: VoicePickResult) {@@ -51,105 +88,92 @@ export function useRaisePage() {update({voicePreferences: preferences,voiceLabel: voiceSummaryLabel(result, VOICE_SAMPLES),- step: "firstJob",+ step: "budget",});}function skipVoice() {update({voicePreferences: "",- voiceLabel: null,- step: "firstJob",+ voiceLabel: VOICE_SKIPPED_LABEL,+ step: "budget",});}- function pickFirstJob(job: { id: string; name: string }) {- update({ firstJob: job, step: "review" });+ function submitBudget(credits: number) {+ update({ budget: { credits }, step: "marketplace" });+ }++ function skipBudget() {+ update({ budget: { credits: null }, step: "marketplace" });+ }++ function submitMarketplace(attachments: RaiseAttachmentDraft[]) {+ update({ marketplace: attachments, step: "skills" });+ }++ function skipMarketplace() {+ update({ marketplace: [], step: "skills" });+ }++ // Skills stays unanswered in the draft until the raise succeeds, and a+ // successful raise clears the draft. Recording it up front would render the+ // step as answered and take away the retry control when the POST fails.+ function submitSkills(attachments: RaiseAttachmentDraft[]) {+ finish({+ weeklyBudget: draft.budget?.credits ?? null,+ attachments: [...(draft.marketplace ?? []), ...attachments],+ });}- function skipFirstJob() {- update({ firstJob: null, step: "review" });+ function skipSkills() {+ finish({+ weeklyBudget: draft.budget?.credits ?? null,+ attachments: draft.marketplace ?? [],+ });}function goBack() {- update({ step: previousStep(draft.step) });- }-- async function finish() {- if (submitLatch.current) return;- submitLatch.current = true;- setIsSubmissionLocked(true);- try {- const response = await createRaisedExpert({- data: {- name: draft.name,- voice_preferences: draft.voicePreferences || null,- first_job_store_listing_version_id: draft.firstJob?.id ?? null,- },- });- const result = response.data as RaiseResult;- clearDraft();- if (draft.firstJob && !result.first_job_installed) {- if (result.first_job_failure_reason === "unavailable") {- toast({- title: `${draft.firstJob.name} is no longer available`,- description: `${result.expert.name} is ready. You can choose another first job from their page.`,- variant: "default",- });- } else {- toast({- title: `Couldn't set up ${result.expert.name}'s first job`,- description: `You can install "${draft.firstJob.name}" from their page anytime.`,- variant: "default",- });- }- }- const kickoff = result.expert.workflows.length > 0 ? "&kickoff=1" : "";- router.push(`/copilot?expertId=${result.expert.id}${kickoff}`);- } catch (error) {- submitLatch.current = false;- setIsSubmissionLocked(false);- if (error instanceof ApiError && error.status === 409) {- if (- getExpertLimitCode(error.response) === "raised_expert_lifetime_limit"- ) {- toast({- title: "Expert creation limit reached",- description:- "This account has reached its lifetime raised-expert limit. Contact support if you need more capacity.",- variant: "destructive",- });- return;- }- toast({- title: "Your team is full",- description:- "You've reached the limit of active experts. Archive one from your team page to raise another.",- variant: "destructive",- });- return;- }- toast({- title: `Couldn't raise ${draft.name || "your expert"}`,- description: "Something went wrong. Please try again.",- variant: "destructive",- });- }+ const beat = lastAnsweredBeat(draft);+ if (!beat) return;+ update({ ...clearedAnswer(beat), step: beat });+ progress.clearAfter(beat);}return {step: draft.step,- messages: buildTranscript(draft),- name: draft.name,+ hasStarted: draft.hasStarted,+ role: draft.role,+ color: draft.color,+ avatarUrl: draft.avatarUrl,+ about: draft.about,voiceLabel: draft.voiceLabel,- firstJob: draft.firstJob,- isSubmitting: isPending || isSubmissionLocked,+ items: buildFlowItems(draft, progress),+ name: draft.name,+ budget: draft.budget,+ marketplace: draft.marketplace,+ skills: draft.skills,+ kit: assembledKit(draft),+ isSubmitting,+ canGoBack: lastAnsweredBeat(draft) !== null,+ startRaising,+ restart,+ revealStep: (beat: BeatKey) => progress.revealStep(beat),+ pickRole,submitName,+ pickColor,+ pickAvatar,+ skipAvatar,+ submitAbout,+ skipAbout,pickVoice,skipVoice,- pickFirstJob,- skipFirstJob,+ submitBudget,+ skipBudget,+ submitMarketplace,+ skipMarketplace,+ submitSkills,+ skipSkills,goBack,- finish,};}diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/useRaiseSubmission.ts b/autogpt_platform/frontend/src/app/(platform)/raise/useRaiseSubmission.tsnew file mode 100644index 0000000000..fa207aae31--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/raise/useRaiseSubmission.ts@@ -0,0 +1,95 @@+import { useCreateRaisedExpert } from "@/app/api/__generated__/endpoints/experts/experts";+import type { RaiseResult } from "@/app/api/__generated__/models/raiseResult";+import { toast } from "@/components/molecules/Toast/use-toast";+import { ApiError } from "@/lib/autogpt-server-api/helpers";+import { useRouter } from "next/navigation";+import { useRef, useState } from "react";+import {+ failedAttachmentMessage,+ toRaiseAttachments,+} from "./components/KitStep/helpers";+import {+ clearDraft,+ getExpertLimitCode,+ type RaiseDraft,+ type RaiseKit,+} from "./helpers";++export function useRaiseSubmission() {+ const router = useRouter();+ const { mutateAsync: createRaisedExpert, isPending } =+ useCreateRaisedExpert();+ // The latch survives re-renders so a double click cannot fire two POSTs+ // before `isPending` has flipped; it is released again on failure so the+ // user can retry.+ const submitLatch = useRef(false);+ const [isLocked, setIsLocked] = useState(false);++ async function finish(draft: RaiseDraft, kit: RaiseKit) {+ if (submitLatch.current) return;+ submitLatch.current = true;+ setIsLocked(true);+ try {+ const response = await createRaisedExpert({+ data: {+ name: draft.name,+ role: draft.role,+ color: draft.color,+ avatar_url: draft.avatarUrl || null,+ about: draft.about || null,+ voice_preferences: draft.voicePreferences || null,+ weekly_budget: kit.weeklyBudget,+ attachments: toRaiseAttachments(kit.attachments),+ },+ });+ const result = response.data as RaiseResult;+ if (result.failed_attachments?.length) {+ toast({+ title: `Raised ${draft.name || "your expert"}, but some tools didn't attach`,+ description: failedAttachmentMessage(+ result.failed_attachments,+ kit.attachments,+ ),+ });+ }+ clearDraft();+ // kickoff=1 has the expert open the thread itself: introduce who it is,+ // say what it can take on, and start or ask for its first job.+ router.push(+ `/copilot?expertId=${encodeURIComponent(result.expert.id)}&kickoff=1`,+ );+ } catch (error) {+ submitLatch.current = false;+ setIsLocked(false);+ reportFailure(error, draft.name);+ }+ }++ return { finish, isSubmitting: isPending || isLocked };+}++function reportFailure(error: unknown, name: string) {+ if (error instanceof ApiError && error.status === 409) {+ if (getExpertLimitCode(error.response) === "raised_expert_lifetime_limit") {+ toast({+ title: "Expert creation limit reached",+ description:+ "This account has reached its lifetime raised-expert limit. Contact support if you need more capacity.",+ variant: "destructive",+ });+ return;+ }+ toast({+ title: "Your team is full",+ description:+ "You've reached the limit of active experts. Archive one from your team page to raise another.",+ variant: "destructive",+ });+ return;+ }+ toast({+ title: `Couldn't raise ${name || "your expert"}`,+ description: "Something went wrong. Please try again.",+ variant: "destructive",+ });+}diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/page.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/page.tsxindex ba8db862d7..38a553772c 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/page.tsx@@ -1,6 +1,6 @@"use client";-import { getExpertAccent } from "@/app/(platform)/marketplace/components/ExpertsSection/helpers";+import { getRaisedExpertAccent } from "@/app/(platform)/marketplace/components/ExpertsSection/helpers";import {Avatar,AvatarFallback,@@ -27,7 +27,7 @@ import { ExpertWorkflowsSection } from "./components/ExpertWorkflowsSection";import { useExpertDetailPage } from "./useExpertDetailPage";const MAIN_CLASS =- "container min-h-screen space-y-8 pb-20 pt-16 sm:px-8 md:px-12";+ "container min-h-screen space-y-8 pb-20 pt-8 sm:px-8 md:px-12";function BackToTeamLink() {return (@@ -92,7 +92,7 @@ export default function ExpertDetailPage() {);}- const accent = getExpertAccent(expert.role);+ const accent = getRaisedExpertAccent(expert.role, expert.color);const isPaused = Boolean(expert.schedules_paused_at);return (diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/AutopilotCard.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/AutopilotCard.tsxindex e5581ba1dd..145ed26178 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/AutopilotCard.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/AutopilotCard.tsx@@ -6,7 +6,7 @@ import { Icon } from "@/components/atoms/Icon/Icon";export function AutopilotCard() {return (- <div className="flex flex-col gap-3 rounded-2xl border border-zinc-200 bg-white p-5">+ <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>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.tsxindex ab9999f55f..cd3f505009 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/CreateMenu/CreateMenu.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/CreateMenu/CreateMenu.tsx@@ -12,6 +12,7 @@ import { MARKETPLACE_EXPERTS_HREF } from "@/lib/constants";import {FlowIcon,PlusSignIcon,+ SparklesIcon,UserAdd01Icon,UserGroupIcon,} from "@hugeicons/core-free-icons";@@ -39,6 +40,12 @@ export function CreateMenu({ onNewPod }: Props) {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" />diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/EmptyTeamState.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/EmptyTeamState.tsxindex b4e40a0ed6..26bcefa782 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/EmptyTeamState.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/EmptyTeamState.tsx@@ -5,7 +5,7 @@ import { Icon } from "@/components/atoms/Icon/Icon";export function EmptyTeamState() {return (- <div className="flex flex-col items-center gap-3 rounded-2xl border border-dashed border-zinc-300 bg-white p-10 text-center">+ <div className="flex flex-col items-center gap-3 rounded-[1.75rem] border border-dashed border-zinc-300 bg-white p-10 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">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.tsxindex 9afd72d13d..c01af0b2ce 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@@ -8,7 +8,6 @@ import {} from "@/components/atoms/Avatar/Avatar";import { Button } from "@/components/atoms/Button/Button";import { Icon } from "@/components/atoms/Icon/Icon";-import { Progress } from "@/components/atoms/Progress/Progress";import { Text } from "@/components/atoms/Text/Text";import {DropdownMenu,@@ -17,15 +16,17 @@ import {DropdownMenuSeparator,DropdownMenuTrigger,} from "@/components/molecules/DropdownMenu/DropdownMenu";-import { cn } from "@/lib/utils";import {- PencilIcon,+ PencilEdit02Icon,PlusSignIcon,Tick02Icon,UserGroupIcon,} from "@hugeicons/core-free-icons";+import Image from "next/image";import Link from "next/link";import { MouseEvent } from "react";++import { CreditsMeter } from "./components/CreditsMeter";import {getNeedsSetupCount,getScheduleCountLabel,@@ -35,6 +36,8 @@ import { FireExpertDialog } from "../FireExpertDialog/FireExpertDialog";import { FireExpertMenu } from "../FireExpertMenu/FireExpertMenu";import { useExpertTeamCard } from "./useExpertTeamCard";+const TEAM_CARD_BANNER_SRC = "/images/team-card-banner.jpg";+interface Props {expert: Expert;schedules: GraphExecutionJobInfo[];@@ -72,152 +75,182 @@ export function ExpertTeamCard({}return (- <div className="relative flex flex-col gap-3 rounded-2xl border border-zinc-200 bg-white p-5 transition-[border-color,box-shadow] duration-200 hover:border-zinc-300 hover:shadow-[0_16px_40px_-16px_rgba(16,24,40,0.18)]">- <div className="absolute right-3 top-3 z-10">- <FireExpertMenu- expertName={expert.name}- onFire={openFire}- testId="expert-card-actions"- triggerClassName="text-zinc-500 hover:bg-zinc-100 hover:text-zinc-700"+ <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="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>- <Link- href={`/team/${expert.id}`}- aria-label={`View ${expert.name}`}- className="flex flex-col gap-3 pr-8"- >- <div className="flex items-center gap-3">- <Avatar className="h-12 w-12">- {expert.avatar_url ? (- <AvatarImage src={expert.avatar_url} alt={expert.name} />- ) : null}- <AvatarFallback>{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 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">+ {expert.avatar_url ? (+ <AvatarImage+ src={expert.avatar_url}+ alt={expert.name}+ width={72}+ height={72}+ className="bg-white"+ />+ ) : null}+ <AvatarFallback>{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>- </div>- <Text variant="body" className="line-clamp-2 min-h-12">- {expert.tagline ?? ""}- </Text>- <div className="flex flex-col gap-1">- <div className="flex items-baseline justify-between gap-2">+ <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">+ <div className="flex items-baseline justify-between gap-2">+ <Text variant="small" className="text-zinc-500">+ Credits this week+ </Text>+ <Text+ variant="small"+ unmask={false}+ className="tabular-nums text-zinc-500"+ >+ {weeklySpend+ ? `${weeklySpend.spent} / ${weeklySpend.budget}`+ : "No budget"}+ </Text>+ </div>+ <CreditsMeter+ spent={weeklySpend?.spent ?? 0}+ budget={weeklySpend?.budget ?? 1}+ muted={!weeklySpend}+ />+ </div>+ <Text variant="small" className="min-h-5 text-zinc-500">+ {scheduleLabel ?? "No schedules yet"}+ </Text>+ <div className="flex min-h-5 items-center gap-2"><Text variant="small" className="text-zinc-500">- Credits this week+ {workflowCount} {workflowCount === 1 ? "workflow" : "workflows"}</Text>- <Text variant="small" className="tabular-nums text-zinc-500">- {weeklySpend- ? `${weeklySpend.spent} / ${weeklySpend.budget}`- : "No budget"}+ {needsSetupCount > 0 ? (+ <span className="rounded-full bg-amber-50 px-2 py-0.5 text-xs text-amber-700 ring-1 ring-inset ring-amber-200">+ {needsSetupCount} {needsSetupCount === 1 ? "needs" : "need"}{" "}+ setup+ </span>+ ) : 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>- <Progress- value={weeklySpend?.spent ?? 0}- max={weeklySpend?.budget ?? 1}- className={cn("h-1.5", !weeklySpend && "opacity-50")}- />- </div>- <Text variant="small" className="min-h-5 text-zinc-500">- {scheduleLabel ?? "No schedules yet"}- </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 ? (- <span className="rounded-full bg-amber-50 px-2 py-0.5 text-xs text-amber-700 ring-1 ring-inset ring-amber-200">- {needsSetupCount} {needsSetupCount === 1 ? "needs" : "need"} setup- </span>- ) : 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>+ ) : null}+ <div className="mt-auto flex flex-wrap gap-2"><Button+ as="NextLink"+ href={`/copilot?expertId=${expert.id}`}variant="secondary"size="small"- loading={isResuming}- onClick={handleResume}>- Resume schedules+ Chat</Button>- </div>- ) : null}- <div className="mt-auto flex flex-wrap gap-2">- <Button- as="NextLink"- href={`/copilot?expertId=${expert.id}`}- variant="secondary"- size="small"- >- Chat- </Button>- <Button- variant="secondary"- size="small"- leftIcon={<Icon icon={PencilIcon} size={16} />}- onClick={handleEditSoulClick}- >- Edit Soul- </Button>- <Button- variant="ghost"- size="small"- leftIcon={<Icon icon={PlusSignIcon} size={16} />}- onClick={handleInstallClick}- >- Install workflow- </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)}+ <Button+ variant="ghost"+ size="small"+ leftIcon={<Icon icon={PlusSignIcon} size={16} />}+ onClick={handleInstallClick}+ >+ Install workflow+ </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"+ }>- <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 />+ {currentPod ? currentPod.name : "Move to pod"}+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ align="end"+ className="max-h-72 w-52 overflow-y-auto"+ >+ {pods.map((pod) => (<DropdownMenuItem- onSelect={() => onAssignPod(expert.id, null)}+ key={pod.id}+ onSelect={() => onAssignPod(expert.id, pod.id)}>- Remove from pod+ <span className="flex-1 truncate">{pod.name}</span>+ {expert.pod_id === pod.id ? (+ <Icon icon={Tick02Icon} size={16} className="ml-2" />+ ) : null}</DropdownMenuItem>- </>- ) : null}- </DropdownMenuContent>- </DropdownMenu>- ) : null}+ ))}+ {expert.pod_id ? (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onSelect={() => onAssignPod(expert.id, null)}+ >+ Remove from pod+ </DropdownMenuItem>+ </>+ ) : null}+ </DropdownMenuContent>+ </DropdownMenu>+ ) : null}+ </div></div><FireExpertDialogexpertId={expert.id}diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/CreditsMeter.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/CreditsMeter.test.tsxnew file mode 100644index 0000000000..a0d1e25175--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/CreditsMeter.test.tsx@@ -0,0 +1,30 @@+import { render, screen } from "@/tests/integrations/test-utils";+import { describe, expect, test } from "vitest";+import { CreditsMeter } from "./CreditsMeter";++describe("CreditsMeter", () => {+ test("exposes a named progress bar with the real figures", () => {+ render(<CreditsMeter spent={12} budget={50} />);++ const meter = screen.getByRole("progressbar", {+ name: "Weekly credit usage",+ });+ expect(meter.getAttribute("aria-valuenow")).toBe("12");+ expect(meter.getAttribute("aria-valuemax")).toBe("50");+ expect(meter.getAttribute("aria-valuetext")).toBe(+ "12 of 50 credits used this week",+ );+ });++ test("clamps the value and announces the over-budget state", () => {+ render(<CreditsMeter spent={80} budget={50} />);++ const meter = screen.getByRole("progressbar", {+ name: "Weekly credit usage",+ });+ expect(meter.getAttribute("aria-valuenow")).toBe("50");+ expect(meter.getAttribute("aria-valuetext")).toBe(+ "80 of 50 credits used this week (over budget)",+ );+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/CreditsMeter.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/CreditsMeter.tsxnew file mode 100644index 0000000000..d932da6236--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCard/components/CreditsMeter.tsx@@ -0,0 +1,43 @@+import { cn } from "@/lib/utils";++const SEGMENT_COUNT = 36;++interface Props {+ spent: number;+ budget: number;+ muted?: boolean;+}++export function CreditsMeter({ spent, budget, muted }: Props) {+ const ratio = budget > 0 ? Math.min(Math.max(spent / budget, 0), 1) : 0;+ const filledCount = Math.round(ratio * SEGMENT_COUNT);+ const clampedSpent = Math.min(Math.max(spent, 0), Math.max(budget, 0));+ const valueText = `${spent} of ${budget} credits used this week${+ spent > budget ? " (over budget)" : ""+ }`;++ return (+ <div+ role="progressbar"+ aria-label="Weekly credit usage"+ aria-valuenow={clampedSpent}+ aria-valuemin={0}+ aria-valuemax={budget}+ aria-valuetext={valueText}+ className={cn(+ "flex h-4 w-full items-stretch gap-[3px]",+ 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",+ )}+ />+ ))}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCardSkeleton.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCardSkeleton.tsxnew file mode 100644index 0000000000..2665a2e337--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertTeamCardSkeleton.tsx@@ -0,0 +1,43 @@+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";++// Mirrors ExpertTeamCard's structure — banner, straddling avatar, tagline,+// credits meter, footer actions — 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>+ </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>++ <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>++ <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>+ </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.tsxindex 87087607e7..fc95775bf3 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,10 +1,10 @@import { Expert } from "@/app/api/__generated__/models/expert";import { ExpertPod } from "@/app/api/__generated__/models/expertPod";-import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";import { Text } from "@/components/atoms/Text/Text";import { ReactNode } from "react";import { TEAM_GRID_CLASS } from "../../helpers";import { AutopilotCard } from "../AutopilotCard";+import { ExpertTeamCardSkeleton } from "../ExpertTeamCardSkeleton";interface Props {isLoading: boolean;@@ -29,7 +29,7 @@ export function TeamRoster({<div className={TEAM_GRID_CLASS}><AutopilotCard />{[0, 1, 2].map((index) => (- <Skeleton key={index} className="h-48 w-full rounded-2xl" />+ <ExpertTeamCardSkeleton key={index} />))}</div>);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.tsxindex 571f6bf926..c70d7da46b 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/WhatRunsZone.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/WhatRunsZone.tsx@@ -3,6 +3,8 @@ import { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecuimport { 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";@@ -49,54 +51,64 @@ export function WhatRunsZone({ experts, schedules }: Props) {return (<section aria-label="What runs" className="flex flex-col gap-4">- <div className="flex flex-col gap-1">+ <div className={cn("flex flex-col gap-1", SECTION_INSET_CLASS)}><Text variant="h3">What runs</Text><Text variant="body" className="max-w-prose text-zinc-600">Workflows installed on your experts, plus agents you can adopt.</Text></div>- <WhatRunsFilters value={filter} onChange={setFilter} />-- {groups.length > 0 ? (- <div className="flex flex-col gap-3">- {groups.map((group) => (- <ExpertWorkflowGroup key={group.expert.id} group={group} />- ))}- </div>- ) : groupEmptyMessage ? (- <Text variant="small" className="text-zinc-500">- {groupEmptyMessage}- </Text>- ) : null}+ <div className={SECTION_INSET_CLASS}>+ <WhatRunsFilters value={filter} onChange={setFilter} />+ </div>- {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 agents.- </Text>- <Button variant="secondary" size="small" onClick={retryAgents}>- Retry- </Button>+ {/* 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-4 duration-300 animate-in fade-in slide-in-from-bottom-2 motion-reduce:animate-none"+ >+ {groups.length > 0 ? (+ <div className="flex flex-col gap-3">+ {groups.map((group) => (+ <ExpertWorkflowGroup key={group.expert.id} group={group} />+ ))}</div>- ) : (- <YourAgentsList- agents={unadoptedAgents}- experts={experts}- libraryAgentCount={libraryAgentCount}- pendingLibraryAgentIDs={pendingLibraryAgentIDs}- adoptedTargetKeys={adoptedTargetKeys}- hasMoreAgents={hasMoreAgents}- isLoadingMoreAgents={isLoadingMoreAgents}- isErrorLoadingMoreAgents={isErrorLoadingMoreAgents}- onLoadMore={loadMoreAgents}- onAdopt={adopt}- />- )- ) : null}+ ) : 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 agents.+ </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/WhatRunsFilters.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/WhatRunsFilters.tsxindex c31bb0931d..15d294f074 100644--- 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@@ -1,5 +1,6 @@import { cn } from "@/lib/utils";import { WHAT_RUNS_FILTERS, WhatRunsFilter } from "../helpers";+import { useFilterIndicator } from "./useFilterIndicator";type Props = {value: WhatRunsFilter;@@ -7,20 +8,39 @@ type Props = {};export function WhatRunsFilters({ value, onChange }: Props) {+ const { listRef, indicator } = useFilterIndicator(value);+return (- <div className="flex flex-wrap gap-2" role="group" aria-label="Filter">+ <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 (<buttonkey={chip.id}type="button"+ data-active={isActive}aria-pressed={isActive}onClick={() => onChange(chip.id)}className={cn(- "rounded-full px-3 py-1.5 text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-zinc-900",+ "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- ? "bg-zinc-800 text-white"+ ? "text-white": "bg-zinc-100 text-zinc-600 hover:bg-zinc-200",)}>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.tsnew file mode 100644index 0000000000..8b71bfc2c7--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/WhatRunsZone/components/useFilterIndicator.ts@@ -0,0 +1,34 @@+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/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/team/helpers.tsindex b75fe38725..732098ccd7 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts+++ b/autogpt_platform/frontend/src/app/(platform)/team/helpers.ts@@ -4,6 +4,11 @@ import { ExpertWorkflowRef } from "@/app/api/__generated__/models/expertWorkflowimport { GraphExecutionJobInfo } from "@/app/api/__generated__/models/graphExecutionJobInfo";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";+interface PodGroup {pod: ExpertPod;experts: Expert[];diff --git a/autogpt_platform/frontend/src/app/(platform)/team/page.tsx b/autogpt_platform/frontend/src/app/(platform)/team/page.tsxindex 7e87af7a5c..8d93014c56 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/page.tsx@@ -2,24 +2,25 @@import { Expert } from "@/app/api/__generated__/models/expert";import { AITeamIcon } from "@/components/atoms/AITeamIcon/AITeamIcon";-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 { cn } from "@/lib/utils";import { Flag, useFlagStatus } from "@/services/feature-flags/use-get-flag";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 { SoulDrawer } from "./components/SoulDrawer/SoulDrawer";import { TeamRoster } from "./components/TeamRoster/TeamRoster";-import { TEAM_GRID_CLASS } from "./helpers";import { WhatRunsZone } from "./components/WhatRunsZone/WhatRunsZone";+import { SECTION_INSET_CLASS, TEAM_GRID_CLASS } from "./helpers";import { useTeamPage } from "./useTeamPage";const MAIN_CLASS =- "container min-h-screen space-y-6 pb-20 pt-16 sm:px-8 md:px-12";+ "container min-h-screen space-y-6 pb-20 pt-8 sm:px-8 md:px-12";export default function TeamPage() {const { enabled, ready } = useFlagStatus(Flag.HIRE_EXPERTS);@@ -54,7 +55,7 @@ export default function TeamPage() {<main className={MAIN_CLASS}><div className={TEAM_GRID_CLASS}>{[0, 1, 2].map((i) => (- <Skeleton key={i} className="h-48 w-full rounded-2xl" />+ <ExpertTeamCardSkeleton key={i} />))}</div></main>@@ -82,7 +83,12 @@ export default function TeamPage() {return (<main className={MAIN_CLASS}>- <div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">+ <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" />@@ -94,10 +100,6 @@ export default function TeamPage() {</div><CreateMenu onNewPod={openNewPod} /></div>- {!isLoading && !isError && hiredExperts.length > 0 ? (- <WhatRunsZone experts={hiredExperts} schedules={schedules} />- ) : null}-<TeamRosterisLoading={isLoading}podGroups={podGroups}@@ -105,6 +107,10 @@ export default function TeamPage() {renderCard={renderCard}/>+ {!isLoading && !isError && hiredExperts.length > 0 ? (+ <WhatRunsZone experts={hiredExperts} schedules={schedules} />+ ) : null}+{isError ? (<ErrorCardcontext="your team"diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourSidebarHeader.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourSidebarHeader.tsxindex c9bb415731..0a14888133 100644--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourSidebarHeader.tsx+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/components/TourSidebarHeader.tsx@@ -13,39 +13,49 @@ export function TourSidebarHeader() {const { state, toggleSidebar } = useSidebar();const isCollapsed = state === "collapsed";+ const toggleButton = (+ <button+ type="button"+ aria-label={isCollapsed ? "Expand sidebar" : "Collapse sidebar"}+ onClick={toggleSidebar}+ className={cn(+ "size-8 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-zinc-200",+ isCollapsed+ ? "absolute inset-0 hidden group-focus-within:flex group-hover:flex"+ : "flex",+ )}+ >+ <Icon icon={SidebarLeftIcon} className="size-5 text-sidebar-foreground" />+ </button>+ );+return (<SidebarHeader className="flex animate-fade-in flex-row items-center justify-between gap-2 p-2 group-data-[collapsible=icon]:flex-col">- <Link- href="/tour"- aria-label="AutoGPT"+ <divclassName={cn(- "flex items-center",- isCollapsed && "group-focus-within:hidden group-hover:hidden",+ "relative flex items-center",+ isCollapsed && "size-8 shrink-0",)}>- {isCollapsed ? (- <AutoGPTLogo hideText viewBox="47 -1 42 42" className="size-8" />- ) : (- <AutoGPTLogo className="h-9 w-auto" />- )}- </Link>+ <Link+ href="/tour"+ aria-label="AutoGPT"+ className={cn(+ "flex items-center",+ isCollapsed &&+ "size-8 items-center justify-center group-focus-within:hidden group-hover:hidden",+ )}+ >+ {isCollapsed ? (+ <AutoGPTLogo hideText viewBox="47 -1 42 42" className="size-8" />+ ) : (+ <AutoGPTLogo className="h-9 w-auto" />+ )}+ </Link>+ {isCollapsed ? toggleButton : null}+ </div>- <button- type="button"- aria-label={isCollapsed ? "Expand sidebar" : "Collapse sidebar"}- onClick={toggleSidebar}- className={cn(- "size-8 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-zinc-200",- isCollapsed- ? "hidden group-focus-within:flex group-hover:flex"- : "flex",- )}- >- <Icon- icon={SidebarLeftIcon}- className="size-5 text-sidebar-foreground"- />- </button>+ {isCollapsed ? null : toggleButton}</SidebarHeader>);}diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex d0ddd56257..88abe7bf10 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -6031,9 +6031,7 @@"401": {"$ref": "#/components/responses/HTTP401NotAuthenticatedError"},- "404": {- "description": "First job listing not found or unavailable"- },+ "404": { "description": "Attachment not found or unavailable" },"409": { "description": "Active expert limit reached" },"422": {"description": "Validation Error",@@ -17095,6 +17093,20 @@],"title": "Role"},+ "avatar_url": {+ "anyOf": [+ { "type": "string", "maxLength": 2000 },+ { "type": "null" }+ ],+ "title": "Avatar Url"+ },+ "color": {+ "anyOf": [+ { "type": "string", "maxLength": 32 },+ { "type": "null" }+ ],+ "title": "Color"+ },"voice_preferences": {"anyOf": [{ "type": "string", "maxLength": 4000 },@@ -17102,12 +17114,25 @@],"title": "Voice Preferences"},- "first_job_store_listing_version_id": {+ "about": {"anyOf": [- { "type": "string", "maxLength": 100 },+ { "type": "string", "maxLength": 10000 },{ "type": "null" }],- "title": "First Job Store Listing Version Id"+ "title": "About"+ },+ "weekly_budget": {+ "anyOf": [+ { "type": "integer", "maximum": 1000000.0, "minimum": 0.0 },+ { "type": "null" }+ ],+ "title": "Weekly Budget"+ },+ "attachments": {+ "items": { "$ref": "#/components/schemas/RaiseAttachment" },+ "type": "array",+ "maxItems": 20,+ "title": "Attachments"}},"type": "object",@@ -18367,6 +18392,7 @@"anyOf": [{ "type": "string" }, { "type": "null" }],"title": "Avatar Url"},+ "color": { "type": "string", "title": "Color", "default": "" },"role": { "type": "string", "title": "Role" },"tagline": {"anyOf": [{ "type": "string" }, { "type": "null" }],@@ -23407,32 +23433,67 @@"title": "QueuePendingMessageResponse","description": "Response returned when a message is queued because the session already\nhas a turn in flight.\n\n- ``buffer_length``: how many messages are now in the session's\n pending buffer (after this push)\n- ``max_buffer_length``: the per-session cap (server-side constant)\n- ``turn_in_flight``: ``True`` if a copilot turn was running when\n we checked — purely informational for UX feedback."},+ "RaiseAttachment": {+ "properties": {+ "kind": {+ "type": "string",+ "enum": ["workflow", "skill"],+ "title": "Kind"+ },+ "source": {+ "type": "string",+ "enum": ["marketplace", "library"],+ "title": "Source"+ },+ "id": {+ "type": "string",+ "maxLength": 100,+ "minLength": 1,+ "title": "Id"+ }+ },+ "type": "object",+ "required": ["kind", "source", "id"],+ "title": "RaiseAttachment",+ "description": "One workflow or skill to attach while raising an expert.\n\n``id`` is a store listing version UUID (marketplace), a library agent\nUUID (library workflow), or a copilot skill slug (library skill).\nMarketplace skills use a store listing version UUID; the listing's\npublic name is stored on ``Expert.skills``."+ },+ "RaiseAttachmentFailure": {+ "properties": {+ "kind": {+ "type": "string",+ "enum": ["workflow", "skill"],+ "title": "Kind"+ },+ "source": {+ "type": "string",+ "enum": ["marketplace", "library"],+ "title": "Source"+ },+ "id": { "type": "string", "title": "Id" },+ "reason": {+ "type": "string",+ "enum": ["unavailable", "installation_failed"],+ "title": "Reason"+ }+ },+ "type": "object",+ "required": ["kind", "source", "id", "reason"],+ "title": "RaiseAttachmentFailure"+ },"RaiseResult": {"properties": {"expert": { "$ref": "#/components/schemas/Expert" },- "first_job_installed": {- "type": "boolean",- "title": "First Job Installed"- },- "first_job_failure_reason": {- "anyOf": [- {- "type": "string",- "enum": ["unavailable", "installation_failed"]- },- { "type": "null" }- ],- "title": "First Job Failure Reason"+ "failed_attachments": {+ "items": { "$ref": "#/components/schemas/RaiseAttachmentFailure" },+ "type": "array",+ "title": "Failed Attachments",+ "default": []}},"type": "object",- "required": [- "expert",- "first_job_installed",- "first_job_failure_reason"- ],+ "required": ["expert"],"title": "RaiseResult",- "description": "Result of raising a blank expert. ``first_job_installed`` is only\nTrue when a first job was requested and its install succeeded, so the\nclient can surface partial success instead of a silent no-op. The stable\nfailure reason distinguishes a listing withdrawn mid-flow from an install\nfailure."+ "description": "Result of raising a blank expert.\n\nAttachments are validated before the expert row is created. A later\ninstall failure is non-fatal and listed in ``failed_attachments`` so\nthe client can surface partial success."},"RateLimitResetResponse": {"properties": {diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsxindex d1de0f493e..f1d827b7d6 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/AppSidebar.tsx@@ -28,7 +28,6 @@ import { getSidebarItemVariants, sidebarContainerVariants } from "./animations";import { AppSidebarHeader } from "./components/AppSidebarHeader/AppSidebarHeader";import { RecentChats } from "./components/RecentChats/RecentChats";import { ShortcutHint } from "./components/ShortcutHint/ShortcutHint";-import { SidebarSearch } from "./components/SidebarSearch/SidebarSearch";import { SidebarTeamMembers } from "./components/SidebarTeamMembers/SidebarTeamMembers";import { SidebarUserActions } from "./components/SidebarUserActions/SidebarUserActions";import {@@ -142,6 +141,37 @@ function NewTaskItem() {);}+interface NavItemProps {+ link: NavLink;+ children?: ReactNode;+}++function NavItem({ link, children }: NavItemProps) {+ const pathname = usePathname();+ const navItemClassName = useNavItemClassName();++ return (+ <SidebarMenuItem>+ <SidebarMenuButton+ asChild+ tooltip={link.name}+ isActive={isLinkActive(pathname, link.href)}+ className={navItemClassName}+ >+ <Link href={link.href}>+ <Icon+ icon={link.icon}+ className="size-4 text-sidebar-foreground/90 group-data-[collapsible=icon]:size-4.5"+ />+ <span className="truncate">{link.name}</span>+ <NavLinkLoader />+ </Link>+ </SidebarMenuButton>+ {children}+ </SidebarMenuItem>+ );+}+function NavMenu({links,leading,@@ -151,31 +181,13 @@ function NavMenu({leading?: ReactNode;renderAfterItem?: (link: NavLink) => ReactNode;}) {- const pathname = usePathname();- const navItemClassName = useNavItemClassName();-return (<SidebarMenu className="group-data-[collapsible=icon]:gap-1">{leading}{links.map((link) => (- <SidebarMenuItem key={link.href}>- <SidebarMenuButton- asChild- tooltip={link.name}- isActive={isLinkActive(pathname, link.href)}- className={navItemClassName}- >- <Link href={link.href}>- <Icon- icon={link.icon}- className="size-4 text-sidebar-foreground/90 group-data-[collapsible=icon]:size-4.5"- />- <span className="truncate">{link.name}</span>- <NavLinkLoader />- </Link>- </SidebarMenuButton>+ <NavItem key={link.href} link={link}>{renderAfterItem?.(link)}- </SidebarMenuItem>+ </NavItem>))}</SidebarMenu>);@@ -243,7 +255,7 @@ export function AppSidebar(props: Props) {const isHireExpertsEnabled = useGetFlag(Flag.HIRE_EXPERTS);const isBrainDumpEnabled = useGetFlag(Flag.ONBOARDING_BRAIN_DUMP);const mainLinks = isHireExpertsEnabled- ? [HOME_LINK, ...MAIN_LINKS.filter((link) => link.href !== "/library")]+ ? MAIN_LINKS.filter((link) => link.href !== "/library"): MAIN_LINKS;const workspaceLinks = isHireExpertsEnabled? [@@ -294,8 +306,8 @@ export function AppSidebar(props: Props) {links={mainLinks}leading={<>+ {isHireExpertsEnabled && <NavItem link={HOME_LINK} />}<NewTaskItem />- <SidebarSearch /></>}/>diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/AppSidebar.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/AppSidebar.test.tsxindex d2eb861726..cfc8c5fb61 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/AppSidebar.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/__tests__/AppSidebar.test.tsx@@ -32,6 +32,18 @@ function makeAgent(};}+function waitForDashboardResponse() {+ return new Promise<void>((resolve) => {+ function onResponse({ request }: { request: Request }) {+ if (new URL(request.url).pathname !== "/api/proxy/api/home") return;+ server.events.removeListener("response:mocked", onResponse);+ resolve();+ }++ server.events.on("response:mocked", onResponse);+ });+}+// The global next/link mock only exports `default`; AppSidebar also imports// `useLinkStatus`, so re-mock here with a no-op pending status.vi.mock("next/link", () => ({@@ -134,7 +146,7 @@ describe("AppSidebar", () => {expect(await screen.findByText(/no conversations yet/i)).toBeDefined();});- it("nests hired experts under Team with a Your AI row and a Hire link", async () => {+ it("nests hired experts under Team", async () => {useGetFlagMock.mockReturnValue(true);server.use(getGetHomeDashboardMockHandler200(@@ -144,84 +156,59 @@ describe("AppSidebar", () => {renderSidebar();const memberLink = await screen.findByRole("link", { name: /Maria/i });- expect(memberLink.getAttribute("href")).toBe(- "/copilot?expertId=expert-maria",- );-- const yourAi = screen.getByRole("link", { name: /your ai/i });- expect(yourAi.getAttribute("href")).toBe("/copilot");-- const hire = screen.getByRole("link", { name: /^hire$/i });- expect(hire.getAttribute("href")).toBe("/marketplace#experts");+ expect(memberLink.getAttribute("href")).toBe("/team/expert-maria");+ expect(screen.queryByRole("link", { name: /your ai/i })).toBeNull();+ expect(screen.queryByRole("link", { name: /^hire$/i })).toBeNull();});- it("maps each member status to its presence colour", async () => {- useGetFlagMock.mockReturnValue(true);- server.use(- getGetHomeDashboardMockHandler200(- dashboardWith([- makeAgent("e-working", "Working Expert", "working"),- makeAgent("e-ready", "Ready Expert", "ready"),- makeAgent("e-paused", "Paused Expert", "paused"),- makeAgent("e-setup", "Setup Expert", "needs_setup"),- makeAgent("e-failed", "Failed Expert", "failed"),- ]),- ),- );- renderSidebar();+ // One member per case: the preview caps the list below the number of statuses.+ it.each([+ ["working" as const, "Working", "bg-amber-500"],+ ["ready" as const, "Ready", "bg-emerald-500"],+ ["paused" as const, "Paused", "bg-zinc-300"],+ ["needs_setup" as const, "Needs setup", "bg-zinc-300"],+ ["failed" as const, "Needs attention", "bg-red-500"],+ ])(+ "maps the %s status to its presence colour",+ async (status, label, colour) => {+ useGetFlagMock.mockReturnValue(true);+ server.use(+ getGetHomeDashboardMockHandler200(+ dashboardWith([makeAgent(`e-${status}`, `${label} Expert`, status)]),+ ),+ );+ renderSidebar();- expect(- (await screen.findByRole("img", { name: "Working" })).className,- ).toContain("bg-amber-500");- expect(screen.getByRole("img", { name: "Ready" }).className).toContain(- "bg-emerald-500",- );- expect(screen.getByRole("img", { name: "Paused" }).className).toContain(- "bg-zinc-300",- );- expect(- screen.getByRole("img", { name: "Needs setup" }).className,- ).toContain("bg-zinc-300");- expect(- screen.getByRole("img", { name: "Needs attention" }).className,- ).toContain("bg-red-500");- });+ expect(+ (await screen.findByRole("img", { name: label })).className,+ ).toContain(colour);+ },+ );- it("keeps Your AI and Hire visible when the user has no hired experts", async () => {+ it("renders no roster rows when the user has no hired experts", async () => {useGetFlagMock.mockReturnValue(true);+ const dashboardRequestSettled = waitForDashboardResponse();renderSidebar();- const yourAi = await screen.findByRole("link", { name: /your ai/i });- expect(yourAi.getAttribute("href")).toBe("/copilot");- expect(- screen.getByRole("link", { name: /^hire$/i }).getAttribute("href"),- ).toBe("/marketplace#experts");+ await dashboardRequestSettled;++ expect(screen.queryByRole("link", { name: /your ai/i })).toBeNull();+ expect(screen.queryByRole("link", { name: /^hire$/i })).toBeNull();});- it("keeps Your AI and Hire visible when the dashboard request fails", async () => {+ it("renders no roster rows when the dashboard request fails", async () => {useGetFlagMock.mockReturnValue(true);server.use(getGetHomeDashboardMockHandler401());- const dashboardRequestSettled = new Promise<void>((resolve) => {- function onResponse({ request }: { request: Request }) {- if (new URL(request.url).pathname !== "/api/proxy/api/home") return;- server.events.removeListener("response:mocked", onResponse);- resolve();- }-- server.events.on("response:mocked", onResponse);- });+ const dashboardRequestSettled = waitForDashboardResponse();renderSidebar();await dashboardRequestSettled;- const yourAi = screen.getByRole("link", { name: /your ai/i });- expect(yourAi.getAttribute("href")).toBe("/copilot");- expect(- screen.getByRole("link", { name: /^hire$/i }).getAttribute("href"),- ).toBe("/marketplace#experts");+ expect(screen.queryByRole("link", { name: /your ai/i })).toBeNull();+ expect(screen.queryByRole("link", { name: /^hire$/i })).toBeNull();});- it("caps the member list and keeps Hire reachable via View all", async () => {+ it("caps the member list and keeps the roster reachable via View all", async () => {useGetFlagMock.mockReturnValue(true);server.use(getGetHomeDashboardMockHandler200(@@ -234,15 +221,19 @@ describe("AppSidebar", () => {);renderSidebar();- expect(await screen.findByRole("link", { name: /Expert 4/ })).toBeDefined();- expect(screen.queryByRole("link", { name: /Expert 5/ })).toBeNull();+ expect(+ await screen.findByRole("link", {+ name: new RegExp(`Expert ${SIDEBAR_TEAM_PREVIEW_COUNT - 1}`),+ }),+ ).toBeDefined();+ expect(+ screen.queryByRole("link", {+ name: new RegExp(`Expert ${SIDEBAR_TEAM_PREVIEW_COUNT}`),+ }),+ ).toBeNull();const viewAll = screen.getByRole("link", { name: /view all \(8\)/i });expect(viewAll.getAttribute("href")).toBe("/team");-- expect(- screen.getByRole("link", { name: /^hire$/i }).getAttribute("href"),- ).toBe("/marketplace#experts");});it("shows every member without View all at exactly the preview count", async () => {diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/AppSidebarHeader/AppSidebarHeader.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/AppSidebarHeader/AppSidebarHeader.tsxindex a09eb34284..687d61c78f 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/AppSidebarHeader/AppSidebarHeader.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/AppSidebarHeader/AppSidebarHeader.tsx@@ -11,51 +11,68 @@ import { cn } from "@/lib/utils";import Link from "next/link";import { SidebarLeftIcon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";+import { SidebarSearch } from "../SidebarSearch/SidebarSearch";export function AppSidebarHeader() {const { state, toggleSidebar } = useSidebar();const isCollapsed = state === "collapsed";+ const toggleButton = (+ <Tooltip>+ <TooltipTrigger asChild>+ <button+ type="button"+ aria-label={isCollapsed ? "Expand sidebar" : "Collapse sidebar"}+ onClick={toggleSidebar}+ className={cn(+ "size-8 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-zinc-200",+ isCollapsed+ ? "absolute inset-0 hidden group-focus-within:flex group-hover:flex"+ : "flex",+ )}+ >+ <Icon+ icon={SidebarLeftIcon}+ className="size-4 text-sidebar-foreground/90 group-data-[collapsible=icon]:size-4.5"+ />+ </button>+ </TooltipTrigger>+ <TooltipContent side="right">+ {isCollapsed ? "Expand sidebar" : "Collapse sidebar"}+ </TooltipContent>+ </Tooltip>+ );+return (<SidebarHeader className="mb-1 flex animate-fade-in flex-row items-center justify-between gap-2 p-2 group-data-[collapsible=icon]:flex-col">- <Link- href="/copilot"- aria-label="AutoGPT"+ <divclassName={cn(- "flex items-center",- isCollapsed && "h-8 group-focus-within:hidden group-hover:hidden",+ "relative flex items-center",+ isCollapsed && "size-8 shrink-0",)}>- {isCollapsed ? (- <AutoGPTLogo hideText viewBox="47 -1 42 42" className="size-7" />- ) : (- <AutoGPTLogo className="-mt-1 ml-2.5 h-7 w-auto" />- )}- </Link>+ <Link+ href="/copilot"+ aria-label="AutoGPT"+ className={cn(+ "flex items-center",+ isCollapsed &&+ "size-8 items-center justify-center group-focus-within:hidden group-hover:hidden",+ )}+ >+ {isCollapsed ? (+ <AutoGPTLogo hideText viewBox="47 -1 42 42" className="size-7" />+ ) : (+ <AutoGPTLogo className="-mt-1 ml-2.5 h-7 w-auto" />+ )}+ </Link>+ {isCollapsed ? toggleButton : null}+ </div>- <Tooltip>- <TooltipTrigger asChild>- <button- type="button"- aria-label={isCollapsed ? "Expand sidebar" : "Collapse sidebar"}- onClick={toggleSidebar}- className={cn(- "size-8 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-zinc-200",- isCollapsed- ? "hidden group-focus-within:flex group-hover:flex"- : "flex",- )}- >- <Icon- icon={SidebarLeftIcon}- className="size-4 text-sidebar-foreground/90 group-data-[collapsible=icon]:size-4.5"- />- </button>- </TooltipTrigger>- <TooltipContent side="right">- {isCollapsed ? "Expand sidebar" : "Collapse sidebar"}- </TooltipContent>- </Tooltip>+ <div className="flex shrink-0 items-center gap-1 group-data-[collapsible=icon]:flex-col">+ <SidebarSearch />+ {isCollapsed ? null : toggleButton}+ </div></SidebarHeader>);}diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/AppSidebarHeader/__tests__/AppSidebarHeader.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/AppSidebarHeader/__tests__/AppSidebarHeader.test.tsxindex e766c632f7..1028684c07 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/AppSidebarHeader/__tests__/AppSidebarHeader.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/AppSidebarHeader/__tests__/AppSidebarHeader.test.tsx@@ -37,4 +37,22 @@ describe("AppSidebarHeader", () => {await screen.findByRole("button", { name: "Expand sidebar" }),).toBeDefined();});++ it("keeps the collapsed logo and toggle in the same size-8 slot", async () => {+ const user = userEvent.setup();+ renderHeader();++ await user.click(screen.getByRole("button", { name: "Collapse sidebar" }));++ const homeLink = await screen.findByRole("link", { name: "AutoGPT" });+ const expandButton = await screen.findByRole("button", {+ name: "Expand sidebar",+ hidden: true,+ });++ expect(homeLink.className).toContain("size-8");+ expect(expandButton.className).toContain("size-8");+ expect(homeLink.parentElement).toBe(expandButton.parentElement);+ expect(homeLink.parentElement?.className).toContain("size-8");+ });});diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarSearch/SidebarSearch.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarSearch/SidebarSearch.tsxindex f230410538..f1e2080567 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarSearch/SidebarSearch.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarSearch/SidebarSearch.tsx@@ -1,28 +1,33 @@"use client";import { useGlobalSearchStore } from "@/app/(platform)/components/GlobalSearchModal/useGlobalSearchStore";-import { SidebarMenuButton, SidebarMenuItem } from "@/components/ui/sidebar";-import { ShortcutHint } from "../ShortcutHint/ShortcutHint";-import { Search01Icon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/components/ui/tooltip";+import { Search01Icon } from "@hugeicons/core-free-icons";export function SidebarSearch() {const openSearch = useGlobalSearchStore((state) => state.openSearch);return (- <SidebarMenuItem>- <SidebarMenuButton- tooltip="Search"- onClick={openSearch}- className="h-auto rounded-xl p-2 pl-3 font-normal group-data-[collapsible=icon]:!p-1.5 hover:!bg-zinc-100 [&>svg]:size-4 group-data-[collapsible=icon]:[&>svg]:size-4.5"- >- <Icon- icon={Search01Icon}- className="size-4 text-sidebar-foreground/90 group-data-[collapsible=icon]:size-4.5"- />- <span className="truncate">Search</span>- <ShortcutHint letter="K" />- </SidebarMenuButton>- </SidebarMenuItem>+ <Tooltip>+ <TooltipTrigger asChild>+ <button+ type="button"+ aria-label="Search"+ onClick={openSearch}+ className="flex size-8 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-zinc-200"+ >+ <Icon+ icon={Search01Icon}+ className="size-4 text-sidebar-foreground/90 group-data-[collapsible=icon]:size-4.5"+ />+ </button>+ </TooltipTrigger>+ <TooltipContent side="right">Search</TooltipContent>+ </Tooltip>);}diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarSearch/__tests__/SidebarSearch.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarSearch/__tests__/SidebarSearch.test.tsxindex 15fb8cdf64..ca66425587 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarSearch/__tests__/SidebarSearch.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarSearch/__tests__/SidebarSearch.test.tsx@@ -19,9 +19,9 @@ describe("SidebarSearch", () => {useGlobalSearchStore.setState({ isOpen: false });});- it("renders a Search menu button", () => {+ it("renders a Search button", () => {renderSearch();- expect(screen.getByText("Search")).toBeDefined();+ expect(screen.getByRole("button", { name: "Search" })).toBeDefined();});it("opens the global search palette when clicked", async () => {@@ -29,7 +29,7 @@ describe("SidebarSearch", () => {renderSearch();expect(useGlobalSearchStore.getState().isOpen).toBe(false);- await user.click(screen.getByText("Search"));+ await user.click(screen.getByRole("button", { name: "Search" }));expect(useGlobalSearchStore.getState().isOpen).toBe(true);});});diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/SidebarTeamMembers.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/SidebarTeamMembers.tsxindex 181b28e4ae..38036fa483 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/SidebarTeamMembers.tsx+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/SidebarTeamMembers.tsx@@ -10,24 +10,25 @@ import {} from "@/components/atoms/Tooltip/BaseTooltip";import { ExpertAvatar } from "@/components/molecules/ExpertAvatar/ExpertAvatar";import {+ Collapsible,+ CollapsibleContent,+ CollapsibleTrigger,+} from "@/components/ui/collapsible";+import {+ SidebarMenuAction,SidebarMenuSub,SidebarMenuSubButton,SidebarMenuSubItem,} from "@/components/ui/sidebar";-import { MARKETPLACE_EXPERTS_HREF } from "@/lib/constants";import { cn } from "@/lib/utils";-import { PlusSignIcon } from "@hugeicons/core-free-icons";+import { ArrowDown01Icon } from "@hugeicons/core-free-icons";import Link from "next/link";-import {- getExpertChatHref,- getPresenceColor,- getPresenceLabel,-} from "./helpers";+import { getExpertHref, getPresenceColor, getPresenceLabel } from "./helpers";import { useSidebarTeamMembers } from "./useSidebarTeamMembers";// Caps the nested list so the sidebar's overflow-hidden container can never-// clip the trailing "Hire" action; the full roster lives on /team.-export const SIDEBAR_TEAM_PREVIEW_COUNT = 5;+// clip the trailing "View all" row; the full roster lives on /team.+export const SIDEBAR_TEAM_PREVIEW_COUNT = 3;export function SidebarTeamMembers() {const { isEnabled, members } = useSidebarTeamMembers();@@ -38,39 +39,36 @@ export function SidebarTeamMembers() {const hasHiddenMembers = members.length > visibleMembers.length;return (- <SidebarMenuSub>- <SidebarMenuSubItem>- <SidebarMenuSubButton asChild>- <Link href="/copilot">- <ExpertAvatar name={null} avatarUrl={null} size={20} />- <span className="truncate">Your AI</span>- </Link>- </SidebarMenuSubButton>- </SidebarMenuSubItem>-- {visibleMembers.map((member) => (- <TeamMemberRow key={member.expert.id} member={member} />- ))}+ <Collapsible defaultOpen className="group/team">+ {/* Rendered as a menu action so the row's <Link> keeps navigating to+ /team while the chevron only toggles the nested roster. */}+ <CollapsibleTrigger asChild>+ <SidebarMenuAction aria-label="Toggle team members">+ <Icon+ icon={ArrowDown01Icon}+ className="ease-[cubic-bezier(0.33,1,0.68,1)] size-4 text-sidebar-foreground/90 transition-transform duration-200 group-data-[state=open]/team:rotate-180 motion-reduce:transition-none"+ />+ </SidebarMenuAction>+ </CollapsibleTrigger>- {hasHiddenMembers && (- <SidebarMenuSubItem>- <SidebarMenuSubButton asChild className="text-zinc-500">- <Link href="/team">- <span className="truncate">View all ({members.length})</span>- </Link>- </SidebarMenuSubButton>- </SidebarMenuSubItem>- )}+ <CollapsibleContent className="overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down motion-reduce:animate-none">+ <SidebarMenuSub>+ {visibleMembers.map((member) => (+ <TeamMemberRow key={member.expert.id} member={member} />+ ))}- <SidebarMenuSubItem>- <SidebarMenuSubButton asChild className="text-zinc-500">- <Link href={MARKETPLACE_EXPERTS_HREF}>- <Icon icon={PlusSignIcon} className="size-4" />- <span className="truncate">Hire</span>- </Link>- </SidebarMenuSubButton>- </SidebarMenuSubItem>- </SidebarMenuSub>+ {hasHiddenMembers && (+ <SidebarMenuSubItem>+ <SidebarMenuSubButton asChild className="text-zinc-500">+ <Link href="/team">+ <span className="truncate">View all ({members.length})</span>+ </Link>+ </SidebarMenuSubButton>+ </SidebarMenuSubItem>+ )}+ </SidebarMenuSub>+ </CollapsibleContent>+ </Collapsible>);}@@ -85,7 +83,7 @@ function TeamMemberRow({ member }: Props) {return (<SidebarMenuSubItem><SidebarMenuSubButton asChild>- <Link href={getExpertChatHref(expert.id)}>+ <Link href={getExpertHref(expert.id)}><ExpertAvatarname={expert.name}avatarUrl={expert.avatar_url}diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/helpers.test.ts b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/helpers.test.tsindex 19ed90db9f..ad748778b7 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/helpers.test.ts+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/helpers.test.ts@@ -1,10 +1,6 @@import { describe, expect, it } from "vitest";import type { HomeAgentStatusStatus } from "@/app/api/__generated__/models/homeAgentStatusStatus";-import {- getExpertChatHref,- getPresenceColor,- getPresenceLabel,-} from "./helpers";+import { getExpertHref, getPresenceColor, getPresenceLabel } from "./helpers";describe("getPresenceColor", () => {it("shows working experts in amber", () => {@@ -47,14 +43,12 @@ describe("getPresenceLabel", () => {});});-describe("getExpertChatHref", () => {- it("deep-links into copilot by expert id", () => {- expect(getExpertChatHref("expert-123")).toBe(- "/copilot?expertId=expert-123",- );+describe("getExpertHref", () => {+ it("links to the expert's detail page", () => {+ expect(getExpertHref("expert-123")).toBe("/team/expert-123");});it("url-encodes the expert id", () => {- expect(getExpertChatHref("a/b&c")).toBe("/copilot?expertId=a%2Fb%26c");+ expect(getExpertHref("a/b&c")).toBe("/team/a%2Fb%26c");});});diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/helpers.ts b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/helpers.tsindex 228dece2a3..b5d9e9c9df 100644--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/helpers.ts+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarTeamMembers/helpers.ts@@ -23,8 +23,6 @@ export function getPresenceLabel(status: HomeAgentStatusStatus): string {return (PRESENCE[status] ?? UNKNOWN_PRESENCE).label;}-// Opening an expert via `?expertId=` adopts that expert's latest thread (or-// starts a fresh one), matching how the rest of the app links into copilot.-export function getExpertChatHref(expertID: string): string {- return `/copilot?expertId=${encodeURIComponent(expertID)}`;+export function getExpertHref(expertID: string): string {+ return `/team/${encodeURIComponent(expertID)}`;}diff --git a/autogpt_platform/frontend/src/components/organisms/VoicePicker/VoicePicker.tsx b/autogpt_platform/frontend/src/components/organisms/VoicePicker/VoicePicker.tsxindex 9fb0330873..ab73d700c7 100644--- a/autogpt_platform/frontend/src/components/organisms/VoicePicker/VoicePicker.tsx+++ b/autogpt_platform/frontend/src/components/organisms/VoicePicker/VoicePicker.tsx@@ -6,6 +6,7 @@ import { useId } from "react";import { CustomVoiceOption } from "./components/CustomVoiceOption";import { SampleCard } from "./components/SampleCard";import type { VoicePickResult } from "./helpers";+import type { SelectableCardColors } from "./styles";import { useVoicePicker } from "./useVoicePicker";type Props = {@@ -14,6 +15,12 @@ type Props = {onPick: (result: VoicePickResult) => void;onSkip: () => void;isSubmitting?: boolean;+ // Set when the surrounding flow already asked the question in its own copy.+ hideHeader?: boolean;+ // Overrides the accent used on option labels (e.g. the expert's colour).+ labelClassName?: string;+ // Overrides the card's selected/hover/focus treatment to match that colour.+ cardColors?: SelectableCardColors;};export function VoicePicker({@@ -22,6 +29,9 @@ export function VoicePicker({onPick,onSkip,isSubmitting = false,+ hideHeader = false,+ labelClassName,+ cardColors,}: Props) {const choiceGroupName = useId();const customTextareaId = useId();@@ -37,15 +47,19 @@ export function VoicePicker({return (<div className="flex flex-col gap-6">- <header className="flex flex-col gap-1.5">- <h2 className="text-2xl font-semibold tracking-[-0.02em] text-foreground">- {name ? `How should ${name} write?` : "How should this expert write?"}- </h2>- <p className="text-base text-muted-foreground">- Pick the voice that feels right. You can fine-tune it anytime in the- Soul editor.- </p>- </header>+ {hideHeader ? null : (+ <header className="flex flex-col gap-1.5">+ <h2 className="text-2xl font-semibold tracking-[-0.02em] text-foreground">+ {name+ ? `How should ${name} write?`+ : "How should this expert write?"}+ </h2>+ <p className="text-base text-muted-foreground">+ Pick the voice that feels right. You can fine-tune it anytime in the+ Soul editor.+ </p>+ </header>+ )}<fieldset className="flex flex-col gap-3"><legend className="sr-only">Writing voice</legend>@@ -58,6 +72,8 @@ export function VoicePicker({choice={choice}choiceGroupName={choiceGroupName}isSelected={selected === choice}+ labelClassName={labelClassName}+ colors={cardColors}onSelect={() => selectSample(choice)}/>);@@ -68,6 +84,8 @@ export function VoicePicker({textareaId={customTextareaId}customText={customText}isSelected={selected === "custom"}+ labelClassName={labelClassName}+ colors={cardColors}onFocus={focusCustom}onChange={changeCustom}/>diff --git a/autogpt_platform/frontend/src/components/organisms/VoicePicker/__tests__/VoicePicker.test.tsx b/autogpt_platform/frontend/src/components/organisms/VoicePicker/__tests__/VoicePicker.test.tsxindex 58e51a8d09..b1b0fa11b2 100644--- a/autogpt_platform/frontend/src/components/organisms/VoicePicker/__tests__/VoicePicker.test.tsx+++ b/autogpt_platform/frontend/src/components/organisms/VoicePicker/__tests__/VoicePicker.test.tsx@@ -37,6 +37,14 @@ describe("VoicePicker", () => {expect(screen.getAllByRole("radio")).toHaveLength(3);});+ test("renders each voice option as its own card", () => {+ setup();+ const group = screen.getByRole("group", { name: "Writing voice" });+ expect(group.className).toContain("gap-3");+ expect(group.className).not.toContain("divide-y");+ expect(group.querySelectorAll(".rounded-2xl.border").length).toBe(3);+ });+test("keeps submit disabled until a choice is made", () => {setup();const submit = screen.getByRole("button", {diff --git a/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/CustomVoiceOption.tsx b/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/CustomVoiceOption.tsxindex 0a27089249..c0f372a277 100644--- a/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/CustomVoiceOption.tsx+++ b/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/CustomVoiceOption.tsx@@ -1,4 +1,5 @@-import { selectableCardClassName } from "../styles";+import { cn } from "@/lib/utils";+import { selectableCardClassName, type SelectableCardColors } from "../styles";const MAX_CUSTOM_VOICE_SAMPLE_CHARACTERS = 2_000;const CUSTOM_VOICE_TEXTAREA_ROWS = 3;@@ -8,6 +9,8 @@ type Props = {textareaId: string;customText: string;isSelected: boolean;+ labelClassName?: string;+ colors?: SelectableCardColors;onFocus: () => void;onChange: (value: string) => void;};@@ -17,16 +20,21 @@ export function CustomVoiceOption({textareaId,customText,isSelected,+ labelClassName,+ colors,onFocus,onChange,}: Props) {const characterCountId = `${textareaId}-character-count`;return (- <div className={selectableCardClassName(isSelected)}>+ <div className={selectableCardClassName(isSelected, false, colors)}><labelhtmlFor={`${textareaId}-choice`}- className="mb-2 block cursor-pointer text-xs font-medium uppercase tracking-[0.12em] text-accent"+ className={cn(+ "mb-2 block cursor-pointer text-xs font-semibold uppercase tracking-[0.12em]",+ labelClassName ?? "text-accent",+ )}><inputid={`${textareaId}-choice`}@@ -51,7 +59,10 @@ export function CustomVoiceOption({maxLength={MAX_CUSTOM_VOICE_SAMPLE_CHARACTERS}aria-describedby={characterCountId}placeholder="Paste a few sentences written the way you'd like this expert to sound."- className="w-full resize-none rounded-xl border border-input bg-background px-4 py-2.5 text-sm leading-relaxed text-foreground placeholder:text-muted-foreground focus:border-ring focus:outline-none focus:ring-1 focus:ring-ring"+ className={cn(+ "w-full resize-none rounded-xl border bg-background px-4 py-2.5 text-sm leading-relaxed text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",+ isSelected ? "border-ring" : "border-input focus:border-ring",+ )}/><pid={characterCountId}diff --git a/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/SampleCard.tsx b/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/SampleCard.tsxindex e6afd52e86..8702aa47ac 100644--- a/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/SampleCard.tsx+++ b/autogpt_platform/frontend/src/components/organisms/VoicePicker/components/SampleCard.tsx@@ -2,13 +2,15 @@ import type { VoiceSample } from "@/app/api/__generated__/models/voiceSample";import { Icon } from "@/components/atoms/Icon/Icon";import { cn } from "@/lib/utils";import { CheckmarkCircle02Icon } from "@hugeicons/core-free-icons";-import { selectableCardClassName } from "../styles";+import { selectableCardClassName, type SelectableCardColors } from "../styles";type Props = {sample: VoiceSample;choice: "a" | "b";choiceGroupName: string;isSelected: boolean;+ labelClassName?: string;+ colors?: SelectableCardColors;onSelect: () => void;};@@ -17,13 +19,15 @@ export function SampleCard({choice,choiceGroupName,isSelected,+ labelClassName,+ colors,onSelect,}: Props) {return (<labelclassName={cn("block w-full text-left",- selectableCardClassName(isSelected, true),+ selectableCardClassName(isSelected, true, colors),)}><input@@ -36,14 +40,19 @@ export function SampleCard({className="sr-only"/><div className="mb-2 flex items-center justify-between gap-3">- <span className="text-xs font-medium uppercase tracking-[0.12em] text-accent">+ <span+ className={cn(+ "text-xs font-semibold uppercase tracking-[0.12em]",+ labelClassName ?? "text-accent",+ )}+ >{sample.label}</span>{isSelected ? (<Iconicon={CheckmarkCircle02Icon}size={18}- className="shrink-0 text-accent"+ className={cn("shrink-0", labelClassName ?? "text-accent")}/>) : null}</div>diff --git a/autogpt_platform/frontend/src/components/organisms/VoicePicker/styles.ts b/autogpt_platform/frontend/src/components/organisms/VoicePicker/styles.tsindex c2a1fbebe3..b23bffb91d 100644--- a/autogpt_platform/frontend/src/components/organisms/VoicePicker/styles.ts+++ b/autogpt_platform/frontend/src/components/organisms/VoicePicker/styles.ts@@ -1,16 +1,29 @@import { cn } from "@/lib/utils";const SELECTABLE_CARD_CLASS_NAME =- "rounded-2xl border border-border bg-background p-5 transition-colors focus-within:ring-2 focus-within:ring-ring";+ "rounded-2xl border border-border bg-background p-5 transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring";++export interface SelectableCardColors {+ /** Border, fill and ring once the option is chosen. */+ selected?: string;+ /** Hover border and focus ring; defaults lean on neutral tokens. */+ interactive?: string;+}export function selectableCardClassName(isSelected: boolean,interactive = false,+ colors: SelectableCardColors = {},) {return cn(SELECTABLE_CARD_CLASS_NAME,+ colors.interactive ?? "focus-within:ring-ring",isSelected- ? "border-accent bg-accent/5 ring-2 ring-accent/20"- : interactive && "cursor-pointer hover:border-foreground/30",+ ? (colors.selected ?? "border-accent bg-accent/5 ring-2 ring-accent/20")+ : interactive &&+ cn(+ "cursor-pointer",+ colors.interactive ? null : "hover:border-foreground/30",+ ),);}diff --git a/autogpt_platform/frontend/src/mocks/mock-handlers.ts b/autogpt_platform/frontend/src/mocks/mock-handlers.tsindex 7b10c4655d..ffa4a35a65 100644--- a/autogpt_platform/frontend/src/mocks/mock-handlers.ts+++ b/autogpt_platform/frontend/src/mocks/mock-handlers.ts@@ -27,6 +27,7 @@ import { getOttoMock } from "@/app/api/__generated__/endpoints/otto/otto.msw";import { getPresetsMock } from "@/app/api/__generated__/endpoints/presets/presets.msw";import { getSchedulesMock } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";import { getSearchMock } from "@/app/api/__generated__/endpoints/search/search.msw";+import { getSkillsMock } from "@/app/api/__generated__/endpoints/skills/skills.msw";import { getStoreMock } from "@/app/api/__generated__/endpoints/store/store.msw";import { getWorkspaceMock } from "@/app/api/__generated__/endpoints/workspace/workspace.msw";@@ -71,6 +72,7 @@ export const mockHandlers = [...getPresetsMock(),...getSchedulesMock(),...getSearchMock(),+ ...getSkillsMock(),...getStoreMock(),...getWorkspaceMock(),];