Skip to content

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

feat(platform): publish knowledge skills to the marketplace and review them (#14432)

Reinier van der Leer5ad53a38c68d
diff --git a/autogpt_platform/backend/backend/api/features/admin/store_admin_routes.py b/autogpt_platform/backend/backend/api/features/admin/store_admin_routes.py
index 0e11372b01..fedf722c13 100644
--- a/autogpt_platform/backend/backend/api/features/admin/store_admin_routes.py
+++ b/autogpt_platform/backend/backend/api/features/admin/store_admin_routes.py
@@ -12,6 +12,9 @@ import backend.api.features.library.model as library_model
import backend.api.features.store.cache as store_cache
import backend.api.features.store.db as store_db
import backend.api.features.store.model as store_model
+import backend.api.features.store.skill_model as skill_model
+import backend.api.features.store.skill_routes as skill_routes
+import backend.api.features.store.skill_submission_db as skill_submission_db
import backend.util.json
logger = logging.getLogger(__name__)
@@ -171,3 +174,43 @@ async def admin_add_agent_to_library(
store_listing_version_id=store_listing_version_id,
user_id=user_id,
)
+
+
+ "/skills/submissions",
+ summary="Admin List Pending Skill Submissions",
+ tags=["store", "admin"],
+ dependencies=[fastapi.Depends(skill_routes.require_skills_hub_flag)],
+)
+async def list_pending_skill_submissions() -> list[skill_model.SkillSubmission]:
+ """Skill submissions awaiting review, oldest first."""
+ return await skill_submission_db.list_pending_skill_submissions()
+
+
+ "/skills/submissions/{skill_listing_version_id}/review",
+ summary="Review Skill Submission",
+ tags=["store", "admin"],
+ responses={404: {"description": "Submission not found"}},
+ dependencies=[fastapi.Depends(skill_routes.require_skills_hub_flag)],
+)
+async def review_skill_submission(
+ skill_listing_version_id: str,
+ request: skill_model.SkillReviewRequest,
+ user_id: str = fastapi.Security(autogpt_libs.auth.get_user_id),
+) -> skill_model.SkillSubmission:
+ """Approve or reject a skill submission.
+
+ Approval promotes the version to the one the marketplace serves, so the
+ browse cache is dropped; a rejection changes nothing shoppers can see.
+ """
+ submission = await skill_submission_db.review_skill_submission(
+ skill_listing_version_id,
+ is_approved=request.is_approved,
+ reviewer_id=user_id,
+ comments=request.comments,
+ internal_comments=request.internal_comments or "",
+ )
+ if request.is_approved:
+ store_cache.clear_all_caches()
+ return submission
diff --git a/autogpt_platform/backend/backend/api/features/admin/store_admin_routes_test.py b/autogpt_platform/backend/backend/api/features/admin/store_admin_routes_test.py
index 972a072db1..8bdabc828b 100644
--- a/autogpt_platform/backend/backend/api/features/admin/store_admin_routes_test.py
+++ b/autogpt_platform/backend/backend/api/features/admin/store_admin_routes_test.py
@@ -350,3 +350,24 @@ async def test_library_member_can_view_pending_agent_in_builder() -> None:
]["in"]
)
assert SubmissionStatus.PENDING in statuses
+
+
+ "call",
+ [
+ lambda: client.get("/admin/skills/submissions"),
+ lambda: client.post(f"/admin/skills/submissions/{SLV_ID}/review"),
+ ],
+ ids=["list-pending", "review"],
+)
+def test_skill_review_is_404_when_the_skills_hub_flag_is_off(
+ monkeypatch: pytest.MonkeyPatch, call
+) -> None:
+ """Admin review sits behind the same gate as the creator-facing routes;
+ without it an admin could approve listings nobody can see."""
+ monkeypatch.setenv("FORCE_FLAG_SKILLS_HUB", "false")
+
+ response = call()
+
+ assert response.status_code == 404
+ assert response.json()["detail"] == "Feature not available"
diff --git a/autogpt_platform/backend/backend/api/features/store/skill_db.py b/autogpt_platform/backend/backend/api/features/store/skill_db.py
index d71081f9f1..4e396add2b 100644
--- a/autogpt_platform/backend/backend/api/features/store/skill_db.py
+++ b/autogpt_platform/backend/backend/api/features/store/skill_db.py
@@ -73,8 +73,8 @@ async def install_marketplace_skill(
# A re-install overwrites the user's existing copy, so counting it again
# would report installs rather than installers.
is_new = all(s.name != listing.slug for s in await list_user_skills(user_id))
- # The one call site the expert-owned install passes `expert_id` through
- # once #14414 lands; `store_user_skill` already takes it as a keyword.
+ # #14414 makes this the expert-owned install's call site, adding both the
+ # `expert_id` argument here and the keyword on `store_user_skill`.
await store_user_skill(
user_id,
name=listing.slug,
diff --git a/autogpt_platform/backend/backend/api/features/store/skill_model.py b/autogpt_platform/backend/backend/api/features/store/skill_model.py
index dedfbef4b3..c929aa9ef7 100644
--- a/autogpt_platform/backend/backend/api/features/store/skill_model.py
+++ b/autogpt_platform/backend/backend/api/features/store/skill_model.py
@@ -8,11 +8,14 @@ the two can never drift; ``name`` is the human title shown on the card.
import datetime
+import prisma.enums
import prisma.models
import pydantic
from backend.util.models import Pagination
+from .categories import validate_canonical_categories
+
class MarketplaceSkill(pydantic.BaseModel):
slug: str
@@ -82,3 +85,64 @@ def active_version(
if listing.ActiveVersion is None:
raise ValueError(f"Skill listing '{listing.slug}' has no active version")
return listing.ActiveVersion
+
+
+class SkillReviewRequest(pydantic.BaseModel):
+ """An admin's verdict on one submission; the version comes from the path."""
+
+ is_approved: bool
+ comments: str
+ internal_comments: str | None = None
+
+
+class SkillSubmissionRequest(pydantic.BaseModel):
+ """Publish one of the caller's own library skills as a marketplace listing."""
+
+ skill_name: str = pydantic.Field(
+ description="Slug of the caller's library skill to publish."
+ )
+ categories: list[str]
+ required_providers: list[str] = pydantic.Field(
+ default_factory=list,
+ description="Integrations the skill's instructions assume are connected.",
+ )
+ changes_summary: str | None = None
+
+ @pydantic.field_validator("categories")
+ @classmethod
+ def _canonical_categories(cls, value: list[str]) -> list[str]:
+ return validate_canonical_categories(value)
+
+
+class SkillSubmission(pydantic.BaseModel):
+ skill_listing_version_id: str
+ slug: str
+ name: str
+ description: str
+ categories: list[str]
+ required_providers: list[str]
+ version: int
+ status: prisma.enums.SubmissionStatus
+ review_comments: str | None = None
+ is_live: bool = pydantic.Field(
+ description="Whether this version is the one the marketplace serves."
+ )
+
+ @classmethod
+ def from_db(
+ cls,
+ version: prisma.models.SkillListingVersion,
+ listing: prisma.models.SkillListing,
+ ) -> "SkillSubmission":
+ return cls(
+ skill_listing_version_id=version.id,
+ slug=listing.slug,
+ name=version.name,
+ description=version.description,
+ categories=list(version.categories),
+ required_providers=list(version.requiredProviders),
+ version=version.version,
+ status=version.submissionStatus,
+ review_comments=version.reviewComments,
+ is_live=listing.activeVersionId == version.id,
+ )
diff --git a/autogpt_platform/backend/backend/api/features/store/skill_routes.py b/autogpt_platform/backend/backend/api/features/store/skill_routes.py
index 005d56d7ca..a9c9762787 100644
--- a/autogpt_platform/backend/backend/api/features/store/skill_routes.py
+++ b/autogpt_platform/backend/backend/api/features/store/skill_routes.py
@@ -7,7 +7,7 @@ from fastapi import Depends, Path, Query, Security
from backend.copilot.tools.skills import SkillLimitError
from backend.util.feature_flag import Flag, is_feature_enabled
-from . import skill_db, skill_model
+from . import skill_db, skill_model, skill_submission_db
# Browse is anonymous, and LaunchDarkly needs a context key: a non-UUID key is
# evaluated as an anonymous context, which with the flag off answers False.
@@ -50,6 +50,59 @@ async def list_marketplace_skills(
)
+ "/submissions",
+ summary="Publish skill to marketplace",
+ tags=["store", "private"],
+ status_code=201,
+ responses={
+ 404: {"description": "Skill not in the caller's library"},
+ 428: {"description": "Marketplace profile required, or slug taken"},
+ },
+ dependencies=[Security(autogpt_libs.auth.requires_user)],
+)
+async def submit_skill(
+ request: skill_model.SkillSubmissionRequest,
+ user_id: str = Security(autogpt_libs.auth.get_user_id),
+) -> skill_model.SkillSubmission:
+ """Submit one of the caller's own library skills for marketplace review."""
+ return await skill_submission_db.submit_skill(user_id, request)
+
+
+ "/submissions",
+ summary="List my skill submissions",
+ tags=["store", "private"],
+ dependencies=[Security(autogpt_libs.auth.requires_user)],
+)
+async def list_my_skill_submissions(
+ user_id: str = Security(autogpt_libs.auth.get_user_id),
+) -> list[skill_model.SkillSubmission]:
+ """Every version the caller has submitted, newest first per listing."""
+ return await skill_submission_db.list_my_skill_submissions(user_id)
+
+
+ "/submissions/{skill_listing_version_id}",
+ summary="Edit skill submission",
+ tags=["store", "private"],
+ responses={
+ 404: {"description": "Submission not found"},
+ 428: {"description": "Only a pending submission can be edited"},
+ },
+ dependencies=[Security(autogpt_libs.auth.requires_user)],
+)
+async def edit_skill_submission(
+ request: skill_model.SkillSubmissionRequest,
+ skill_listing_version_id: str = Path(...),
+ user_id: str = Security(autogpt_libs.auth.get_user_id),
+) -> skill_model.SkillSubmission:
+ """Update a pending submission and re-snapshot the library skill."""
+ return await skill_submission_db.edit_skill_submission(
+ user_id, skill_listing_version_id, request
+ )
+
+
@router.get(
"/{slug}",
summary="Get marketplace skill",
diff --git a/autogpt_platform/backend/backend/api/features/store/skill_routes_test.py b/autogpt_platform/backend/backend/api/features/store/skill_routes_test.py
index bb7f2abe1f..926ce4f442 100644
--- a/autogpt_platform/backend/backend/api/features/store/skill_routes_test.py
+++ b/autogpt_platform/backend/backend/api/features/store/skill_routes_test.py
@@ -4,7 +4,7 @@ import fastapi
import fastapi.testclient
import pytest
-from . import skill_routes
+from . import skill_routes, skill_submission_db
app = fastapi.FastAPI()
app.include_router(skill_routes.router, prefix="/api/store/skills")
@@ -16,14 +16,26 @@ client = fastapi.testclient.TestClient(app)
FLAG_ENV_VAR = "FORCE_FLAG_SKILLS_HUB"
+def authenticated(mock_jwt_user):
+ from autogpt_libs.auth.jwt_utils import get_jwt_payload
+
+ app.dependency_overrides[get_jwt_payload] = mock_jwt_user["get_jwt_payload"]
+ yield
+ app.dependency_overrides.clear()
+
+
@pytest.mark.parametrize(
"call",
[
lambda: client.get("/api/store/skills"),
lambda: client.get("/api/store/skills/any-slug"),
lambda: client.post("/api/store/skills/any-slug/install"),
+ lambda: client.post("/api/store/skills/submissions"),
+ lambda: client.get("/api/store/skills/submissions"),
+ lambda: client.put("/api/store/skills/submissions/any-version"),
],
- ids=["browse", "detail", "install"],
+ ids=["browse", "detail", "install", "submit", "my-submissions", "edit"],
)
def test_every_endpoint_is_404_when_the_flag_is_off(
monkeypatch: pytest.MonkeyPatch, call
@@ -56,3 +68,21 @@ async def test_the_gate_opens_when_the_flag_is_on(monkeypatch: pytest.MonkeyPatc
monkeypatch.setenv(FLAG_ENV_VAR, "true")
assert await skill_routes.require_skills_hub_flag(user_id=None) is None
+
+
+def test_submissions_is_a_route_of_its_own_not_a_skill_slug(
+ monkeypatch: pytest.MonkeyPatch, mocker, authenticated
+):
+ """`/{slug}` is declared after `/submissions`, so the placeholder cannot
+ swallow it — FastAPI matches in declaration order."""
+ monkeypatch.setenv(FLAG_ENV_VAR, "true")
+ listed = mocker.patch.object(
+ skill_submission_db, "list_my_skill_submissions", return_value=[]
+ )
+ detail = mocker.patch.object(skill_routes.skill_db, "get_marketplace_skill")
+
+ response = client.get("/api/store/skills/submissions")
+
+ assert response.status_code == 200
+ listed.assert_awaited_once()
+ detail.assert_not_called()
diff --git a/autogpt_platform/backend/backend/api/features/store/skill_submission_db.py b/autogpt_platform/backend/backend/api/features/store/skill_submission_db.py
new file mode 100644
index 0000000000..ba7e1d52e7
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/store/skill_submission_db.py
@@ -0,0 +1,225 @@
+"""Publishing a library skill as a marketplace listing, and reviewing it.
+
+A submission snapshots the creator's own ``SKILL.md`` at submit time, so
+editing the library copy afterwards never changes what installers get — only
+a new submission does. The live version stays served throughout: approval is
+what promotes a pending version, and a rejection leaves the shelf untouched.
+"""
+
+import datetime
+
+import prisma.enums
+import prisma.models
+
+from backend.copilot.tools.skills import read_user_skill_with_body
+from backend.data.db import transaction
+from backend.util.exceptions import NotFoundError, PreconditionFailed
+
+from . import skill_model
+
+
+async def submit_skill(
+ user_id: str, request: skill_model.SkillSubmissionRequest
+) -> skill_model.SkillSubmission:
+ """Create a pending version for the caller's library skill.
+
+ Re-publishing an already-listed skill adds a version rather than editing
+ the live one, so what the marketplace serves only changes on approval.
+ """
+ slug = request.skill_name.strip().lower()
+ skill = await read_user_skill_with_body(user_id, slug)
+ if skill is None:
+ raise NotFoundError(f"Skill '{slug}' is not in your library")
+ await _require_profile(user_id)
+
+ async with transaction() as tx:
+ listing = await prisma.models.SkillListing.prisma(tx).find_unique(
+ where={"slug": slug}
+ )
+ if listing is None:
+ listing = await prisma.models.SkillListing.prisma(tx).create(
+ data={"slug": slug, "owningUserId": user_id}
+ )
+ elif listing.owningUserId != user_id:
+ raise PreconditionFailed(
+ f"The marketplace slug '{slug}' is taken. Rename your skill "
+ "and publish it again."
+ )
+ version = await prisma.models.SkillListingVersion.prisma(tx).create(
+ data={
+ "skillListingId": listing.id,
+ "version": await _next_version(tx, listing.id),
+ "name": skill.name,
+ "description": skill.description,
+ "body": skill.body,
+ "triggers": list(skill.triggers),
+ "categories": request.categories,
+ "requiredProviders": request.required_providers,
+ "sourceSkillSlug": slug,
+ "changesSummary": request.changes_summary or "Initial submission",
+ "submissionStatus": prisma.enums.SubmissionStatus.PENDING,
+ "submittedAt": datetime.datetime.now(datetime.timezone.utc),
+ }
+ )
+ return skill_model.SkillSubmission.from_db(version, listing)
+
+
+async def list_my_skill_submissions(
+ user_id: str,
+) -> list[skill_model.SkillSubmission]:
+ listings = await prisma.models.SkillListing.prisma().find_many(
+ where={"owningUserId": user_id, "isDeleted": False},
+ include={"Versions": True},
+ order={"createdAt": "desc"},
+ )
+ return [
+ skill_model.SkillSubmission.from_db(version, listing)
+ for listing in listings
+ for version in sorted(
+ listing.Versions or [], key=lambda v: v.version, reverse=True
+ )
+ if not version.isDeleted
+ ]
+
+
+async def edit_skill_submission(
+ user_id: str,
+ skill_listing_version_id: str,
+ request: skill_model.SkillSubmissionRequest,
+) -> skill_model.SkillSubmission:
+ """Update a pending submission and re-snapshot the library skill.
+
+ Only a pending version is editable — an approved one is what the
+ marketplace serves, and a rejected one is a closed record.
+ """
+ version, listing = await _owned_version(user_id, skill_listing_version_id)
+ if version.submissionStatus != prisma.enums.SubmissionStatus.PENDING:
+ raise PreconditionFailed("Only a pending submission can be edited")
+ # The slug and sourceSkillSlug were fixed at submit time, so re-pointing the
+ # edit at another skill would serve b's content under a's slug.
+ slug = request.skill_name.strip().lower()
+ if slug != listing.slug:
+ raise PreconditionFailed(
+ f"This submission publishes '{listing.slug}'. Publish '{slug}' as "
+ "its own listing instead."
+ )
+ skill = await read_user_skill_with_body(user_id, slug)
+ if skill is None:
+ raise NotFoundError(f"Skill '{slug}' is not in your library")
+
+ updated = await prisma.models.SkillListingVersion.prisma().update(
+ where={"id": version.id},
+ data={
+ "name": skill.name,
+ "description": skill.description,
+ "body": skill.body,
+ "triggers": list(skill.triggers),
+ "categories": request.categories,
+ "requiredProviders": request.required_providers,
+ "changesSummary": request.changes_summary or version.changesSummary,
+ },
+ )
+ if updated is None:
+ raise NotFoundError(f"Submission #{skill_listing_version_id} not found")
+ return skill_model.SkillSubmission.from_db(updated, listing)
+
+
+async def review_skill_submission(
+ skill_listing_version_id: str,
+ *,
+ is_approved: bool,
+ reviewer_id: str,
+ comments: str,
+ internal_comments: str = "",
+) -> skill_model.SkillSubmission:
+ """Approve or reject a pending submission.
+
+ Approval promotes this version to the one the marketplace serves; a
+ rejection records the verdict and leaves the live version alone.
+ """
+ status = (
+ prisma.enums.SubmissionStatus.APPROVED
+ if is_approved
+ else prisma.enums.SubmissionStatus.REJECTED
+ )
+ async with transaction() as tx:
+ # PENDING sits in the WHERE so a second verdict cannot overwrite the
+ # first; without it, re-approving a rejected version re-promotes it.
+ reviewed = await prisma.models.SkillListingVersion.prisma(tx).update_many(
+ where={
+ "id": skill_listing_version_id,
+ "submissionStatus": prisma.enums.SubmissionStatus.PENDING,
+ },
+ data={
+ "submissionStatus": status,
+ "reviewerId": reviewer_id,
+ "reviewComments": comments,
+ "internalComments": internal_comments,
+ },
+ )
+ updated = await prisma.models.SkillListingVersion.prisma(tx).find_unique(
+ where={"id": skill_listing_version_id}, include={"SkillListing": True}
+ )
+ if updated is None or updated.SkillListing is None:
+ raise NotFoundError(f"Submission #{skill_listing_version_id} not found")
+ if reviewed == 0:
+ raise PreconditionFailed("Only a pending submission can be reviewed")
+ listing = updated.SkillListing
+ if is_approved:
+ listing = (
+ await prisma.models.SkillListing.prisma(tx).update(
+ where={"id": listing.id},
+ data={"activeVersionId": updated.id, "hasApprovedVersion": True},
+ )
+ or listing
+ )
+ return skill_model.SkillSubmission.from_db(updated, listing)
+
+
+async def list_pending_skill_submissions() -> list[skill_model.SkillSubmission]:
+ versions = await prisma.models.SkillListingVersion.prisma().find_many(
+ where={
+ "submissionStatus": prisma.enums.SubmissionStatus.PENDING,
+ "isDeleted": False,
+ "SkillListing": {"is": {"isDeleted": False}},
+ },
+ include={"SkillListing": True},
+ order={"createdAt": "asc"},
+ )
+ return [
+ skill_model.SkillSubmission.from_db(v, v.SkillListing)
+ for v in versions
+ if v.SkillListing is not None
+ ]
+
+
+async def _owned_version(
+ user_id: str, skill_listing_version_id: str
+) -> tuple[prisma.models.SkillListingVersion, prisma.models.SkillListing]:
+ version = await prisma.models.SkillListingVersion.prisma().find_unique(
+ where={"id": skill_listing_version_id}, include={"SkillListing": True}
+ )
+ if (
+ version is None
+ or version.SkillListing is None
+ or version.SkillListing.owningUserId != user_id
+ ):
+ raise NotFoundError(f"Submission #{skill_listing_version_id} not found")
+ return version, version.SkillListing
+
+
+async def _next_version(tx, skill_listing_id: str) -> int:
+ latest = await prisma.models.SkillListingVersion.prisma(tx).find_first(
+ where={"skillListingId": skill_listing_id}, order={"version": "desc"}
+ )
+ return (latest.version + 1) if latest else 1
+
+
+async def _require_profile(user_id: str) -> None:
+ profile = await prisma.models.Profile.prisma().find_unique(
+ where={"userId": user_id}
+ )
+ if profile is None:
+ raise PreconditionFailed(
+ "User must create a Marketplace Profile before publishing a skill"
+ )
diff --git a/autogpt_platform/backend/backend/api/features/store/skill_submission_db_test.py b/autogpt_platform/backend/backend/api/features/store/skill_submission_db_test.py
new file mode 100644
index 0000000000..6d03d9a02c
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/store/skill_submission_db_test.py
@@ -0,0 +1,290 @@
+import prisma.enums
+import prisma.models
+import pytest
+
+from backend.copilot.tools.skills import ParsedSkill
+from backend.util.exceptions import NotFoundError, PreconditionFailed
+from backend.util.test import SpinTestServer
+
+from . import skill_db, skill_model, skill_submission_db
+
+LIBRARY_SKILL = ParsedSkill(
+ name="brand-voice-guide",
+ description="Write in a consistent brand voice.",
+ body="# Brand voice\nLead with positioning.\n",
+ triggers=("brand voice",),
+)
+
+
+def _request(**overrides) -> skill_model.SkillSubmissionRequest:
+ data = {
+ "skill_name": "brand-voice-guide",
+ "categories": ["content"],
+ "required_providers": ["google"],
+ }
+ data.update(overrides)
+ return skill_model.SkillSubmissionRequest(**data)
+
+
[email protected](autouse=True)
+async def library_skill(mocker, server: SpinTestServer):
+ mocker.patch.object(
+ skill_submission_db, "read_user_skill_with_body", return_value=LIBRARY_SKILL
+ )
+ await prisma.models.SkillListingVersion.prisma().delete_many()
+ await prisma.models.SkillListing.prisma().delete_many()
+ yield
+ await prisma.models.SkillListingVersion.prisma().delete_many()
+ await prisma.models.SkillListing.prisma().delete_many()
+
+
+async def reviewer(setup_admin_user) -> str:
+ """A real admin row: SkillListingVersion.reviewerId is a User foreign key."""
+ return setup_admin_user
+
+
+async def creator(setup_test_user) -> str:
+ await prisma.models.Profile.prisma().upsert(
+ where={"userId": setup_test_user},
+ data={
+ "create": {
+ "userId": setup_test_user,
+ "username": "creator",
+ "name": "Creator",
+ "description": "",
+ "links": [],
+ },
+ "update": {},
+ },
+ )
+ return setup_test_user
+
+
+async def test_publishing_does_not_put_the_skill_on_the_shelf(creator):
+ submission = await skill_submission_db.submit_skill(creator, _request())
+
+ assert submission.status == prisma.enums.SubmissionStatus.PENDING
+ assert submission.is_live is False
+ browse = await skill_db.get_marketplace_skills()
+ assert browse.skills == []
+
+
+async def test_publishing_without_a_marketplace_profile_is_refused(setup_test_user):
+ await prisma.models.Profile.prisma().delete_many(where={"userId": setup_test_user})
+
+ with pytest.raises(PreconditionFailed, match="Marketplace Profile"):
+ await skill_submission_db.submit_skill(setup_test_user, _request())
+
+ assert await prisma.models.SkillListing.prisma().count() == 0
+
+
+async def test_publishing_a_skill_that_is_not_in_the_library_is_refused(
+ creator, mocker
+):
+ mocker.patch.object(
+ skill_submission_db, "read_user_skill_with_body", return_value=None
+ )
+
+ with pytest.raises(NotFoundError):
+ await skill_submission_db.submit_skill(creator, _request())
+
+
+async def test_a_slug_another_creator_holds_is_refused(creator):
+ await prisma.models.SkillListing.prisma().create(
+ data={"slug": "brand-voice-guide", "owningUserId": None}
+ )
+
+ with pytest.raises(PreconditionFailed, match="taken"):
+ await skill_submission_db.submit_skill(creator, _request())
+
+
+async def test_approval_promotes_the_version_and_puts_it_on_the_shelf(
+ creator, reviewer
+):
+ submission = await skill_submission_db.submit_skill(creator, _request())
+
+ reviewed = await skill_submission_db.review_skill_submission(
+ submission.skill_listing_version_id,
+ is_approved=True,
+ reviewer_id=reviewer,
+ comments="Looks good",
+ )
+
+ assert reviewed.status == prisma.enums.SubmissionStatus.APPROVED
+ assert reviewed.is_live is True
+ browse = await skill_db.get_marketplace_skills()
+ assert [s.slug for s in browse.skills] == ["brand-voice-guide"]
+
+
+async def test_rejection_keeps_the_skill_off_the_shelf(creator, reviewer):
+ submission = await skill_submission_db.submit_skill(creator, _request())
+
+ reviewed = await skill_submission_db.review_skill_submission(
+ submission.skill_listing_version_id,
+ is_approved=False,
+ reviewer_id=reviewer,
+ comments="Needs work",
+ )
+
+ assert reviewed.status == prisma.enums.SubmissionStatus.REJECTED
+ assert reviewed.is_live is False
+ browse = await skill_db.get_marketplace_skills()
+ assert browse.skills == []
+
+
+async def test_republishing_leaves_the_live_version_serving_until_approved(
+ creator, reviewer, mocker
+):
+ first = await skill_submission_db.submit_skill(creator, _request())
+ await skill_submission_db.review_skill_submission(
+ first.skill_listing_version_id,
+ is_approved=True,
+ reviewer_id=reviewer,
+ comments="ok",
+ )
+ mocker.patch.object(
+ skill_submission_db,
+ "read_user_skill_with_body",
+ return_value=ParsedSkill(
+ name="brand-voice-guide",
+ description="Rewritten.",
+ body="# Rewritten\n",
+ triggers=(),
+ ),
+ )
+
+ second = await skill_submission_db.submit_skill(creator, _request())
+
+ assert second.version == 2
+ assert second.is_live is False
+ live = await skill_db.get_marketplace_skill("brand-voice-guide")
+ assert live.body == "# Brand voice\nLead with positioning.\n"
+
+
+async def test_editing_re_snapshots_the_library_skill(creator, mocker):
+ submission = await skill_submission_db.submit_skill(creator, _request())
+ mocker.patch.object(
+ skill_submission_db,
+ "read_user_skill_with_body",
+ return_value=ParsedSkill(
+ name="brand-voice-guide",
+ description="Tightened.",
+ body="# Tightened\n",
+ triggers=(),
+ ),
+ )
+
+ edited = await skill_submission_db.edit_skill_submission(
+ creator,
+ submission.skill_listing_version_id,
+ _request(categories=["marketing"]),
+ )
+
+ assert edited.description == "Tightened."
+ assert edited.categories == ["marketing"]
+
+
+async def test_an_approved_submission_cannot_be_edited(creator, reviewer):
+ submission = await skill_submission_db.submit_skill(creator, _request())
+ await skill_submission_db.review_skill_submission(
+ submission.skill_listing_version_id,
+ is_approved=True,
+ reviewer_id=reviewer,
+ comments="ok",
+ )
+
+ with pytest.raises(PreconditionFailed, match="pending"):
+ await skill_submission_db.edit_skill_submission(
+ creator, submission.skill_listing_version_id, _request()
+ )
+
+
+async def test_another_creators_submission_is_not_editable(creator):
+ submission = await skill_submission_db.submit_skill(creator, _request())
+
+ with pytest.raises(NotFoundError):
+ await skill_submission_db.edit_skill_submission(
+ "someone-else", submission.skill_listing_version_id, _request()
+ )
+
+
+async def test_the_review_queue_holds_only_pending_submissions(creator, reviewer):
+ pending = await skill_submission_db.submit_skill(creator, _request())
+ assert [
+ s.skill_listing_version_id
+ for s in await skill_submission_db.list_pending_skill_submissions()
+ ] == [pending.skill_listing_version_id]
+
+ await skill_submission_db.review_skill_submission(
+ pending.skill_listing_version_id,
+ is_approved=True,
+ reviewer_id=reviewer,
+ comments="ok",
+ )
+
+ assert await skill_submission_db.list_pending_skill_submissions() == []
+
+
+async def test_editing_cannot_repoint_the_submission_at_another_skill(creator, mocker):
+ submission = await skill_submission_db.submit_skill(creator, _request())
+ mocker.patch.object(
+ skill_submission_db,
+ "read_user_skill_with_body",
+ return_value=ParsedSkill(
+ name="other-skill",
+ description="Someone else's content.",
+ body="# Other\n",
+ triggers=(),
+ ),
+ )
+
+ with pytest.raises(PreconditionFailed, match="brand-voice-guide"):
+ await skill_submission_db.edit_skill_submission(
+ creator,
+ submission.skill_listing_version_id,
+ _request(skill_name="other-skill"),
+ )
+
+ unchanged = await skill_submission_db.list_my_skill_submissions(creator)
+ assert unchanged[0].description == LIBRARY_SKILL.description
+
+
+async def test_a_rejected_submission_cannot_be_re_approved(creator, reviewer):
+ submission = await skill_submission_db.submit_skill(creator, _request())
+ await skill_submission_db.review_skill_submission(
+ submission.skill_listing_version_id,
+ is_approved=False,
+ reviewer_id=reviewer,
+ comments="Needs work",
+ )
+
+ with pytest.raises(PreconditionFailed, match="pending"):
+ await skill_submission_db.review_skill_submission(
+ submission.skill_listing_version_id,
+ is_approved=True,
+ reviewer_id=reviewer,
+ comments="Changed my mind",
+ )
+
+ browse = await skill_db.get_marketplace_skills()
+ assert browse.skills == []
+
+
+async def test_a_deleted_listing_is_not_in_the_review_queue(creator):
+ submission = await skill_submission_db.submit_skill(creator, _request())
+ await prisma.models.SkillListing.prisma().update(
+ where={"slug": "brand-voice-guide"}, data={"isDeleted": True}
+ )
+
+ assert await skill_submission_db.list_pending_skill_submissions() == []
+
+ await prisma.models.SkillListing.prisma().update(
+ where={"slug": "brand-voice-guide"}, data={"isDeleted": False}
+ )
+ await prisma.models.SkillListingVersion.prisma().update(
+ where={"id": submission.skill_listing_version_id}, data={"isDeleted": True}
+ )
+
+ assert await skill_submission_db.list_pending_skill_submissions() == []
diff --git a/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/__tests__/skill-submissions.test.tsx b/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/__tests__/skill-submissions.test.tsx
new file mode 100644
index 0000000000..0961084d66
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/__tests__/skill-submissions.test.tsx
@@ -0,0 +1,113 @@
+import { getGetV2AdminListPendingSkillSubmissionsMockHandler200 } from "@/app/api/__generated__/endpoints/admin/admin.msw";
+import type { SkillSubmission } from "@/app/api/__generated__/models/skillSubmission";
+import { server } from "@/mocks/mock-server";
+import { render, screen, waitFor } from "@/tests/integrations/test-utils";
+import userEvent from "@testing-library/user-event";
+import { http, HttpResponse } from "msw";
+import { describe, expect, test, vi } from "vitest";
+import { AdminSkillSubmissions } from "../components/AdminSkillSubmissions";
+
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({ push: vi.fn(), replace: vi.fn(), prefetch: vi.fn() }),
+ usePathname: () => "/admin/marketplace",
+ useSearchParams: () => new URLSearchParams(),
+ useParams: () => ({}),
+}));
+
+const pending: SkillSubmission = {
+ skill_listing_version_id: "version-1",
+ slug: "brand-voice-guide",
+ name: "brand-voice-guide",
+ description: "Write in a consistent brand voice.",
+ categories: ["content"],
+ required_providers: ["google"],
+ version: 1,
+ status: "PENDING",
+ review_comments: null,
+ is_live: false,
+};
+
+describe("admin skill submissions", () => {
+ test("shows what a reviewer needs to judge the submission", async () => {
+ server.use(
+ getGetV2AdminListPendingSkillSubmissionsMockHandler200([pending]),
+ );
+
+ render(<AdminSkillSubmissions />);
+
+ expect(await screen.findByTestId("admin-skill-submissions")).toBeDefined();
+ expect(
+ await screen.findByText("Write in a consistent brand voice."),
+ ).toBeDefined();
+ expect(
+ screen.getByText(/brand-voice-guide · content · works with google/),
+ ).toBeDefined();
+ });
+
+ test("approving posts the verdict for that submission", async () => {
+ let reviewed: { url: string; body: unknown } | null = null;
+ server.use(
+ getGetV2AdminListPendingSkillSubmissionsMockHandler200([pending]),
+ http.post(
+ "*/api/store/admin/skills/submissions/:id/review",
+ async ({ request, params }) => {
+ reviewed = { url: String(params.id), body: await request.json() };
+ return HttpResponse.json({ ...pending, status: "APPROVED" });
+ },
+ ),
+ );
+ render(<AdminSkillSubmissions />);
+
+ await userEvent.click(await screen.findByTestId("approve-version-1"));
+
+ await waitFor(() => expect(reviewed).not.toBeNull());
+ expect(reviewed!.url).toBe("version-1");
+ expect((reviewed!.body as { is_approved: boolean }).is_approved).toBe(true);
+ });
+
+ test("rejecting posts the opposite verdict", async () => {
+ let approved: boolean | null = null;
+ server.use(
+ getGetV2AdminListPendingSkillSubmissionsMockHandler200([pending]),
+ http.post(
+ "*/api/store/admin/skills/submissions/:id/review",
+ async ({ request }) => {
+ const body = (await request.json()) as { is_approved: boolean };
+ approved = body.is_approved;
+ return HttpResponse.json({ ...pending, status: "REJECTED" });
+ },
+ ),
+ );
+ render(<AdminSkillSubmissions />);
+
+ await userEvent.click(await screen.findByTestId("reject-version-1"));
+
+ await waitFor(() => expect(approved).toBe(false));
+ });
+
+ test("a 404 reads as unavailable, not as an empty queue", async () => {
+ server.use(
+ http.get("*/api/store/admin/skills/submissions", () =>
+ HttpResponse.json({ detail: "Feature not available" }, { status: 404 }),
+ ),
+ );
+
+ render(<AdminSkillSubmissions />);
+
+ expect(
+ await screen.findByText(/Skill submissions are unavailable/),
+ ).toBeDefined();
+ expect(screen.queryByText(/No skill submissions are waiting/)).toBeNull();
+ });
+
+ test("says the queue is empty rather than rendering an empty list", async () => {
+ server.use(getGetV2AdminListPendingSkillSubmissionsMockHandler200([]));
+
+ render(<AdminSkillSubmissions />);
+
+ expect(
+ await screen.findByText(/No skill submissions are waiting/),
+ ).toBeDefined();
+ expect(screen.queryByTestId("admin-skill-submissions")).toBeNull();
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/components/AdminSkillSubmissions.tsx b/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/components/AdminSkillSubmissions.tsx
new file mode 100644
index 0000000000..5de9200bb6
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/components/AdminSkillSubmissions.tsx
@@ -0,0 +1,83 @@
+"use client";
+
+import { Button } from "@/components/atoms/Button/Button";
+import { Text } from "@/components/atoms/Text/Text";
+import { useAdminSkillSubmissions } from "./useAdminSkillSubmissions";
+
+export function AdminSkillSubmissions() {
+ const {
+ submissions,
+ isLoading,
+ isUnavailable,
+ isReviewing,
+ approve,
+ reject,
+ } = useAdminSkillSubmissions();
+
+ if (isLoading) {
+ return <div className="py-6 text-center">Loading skill submissions…</div>;
+ }
+
+ if (isUnavailable) {
+ return (
+ <Text variant="body" className="!text-zinc-500">
+ Skill submissions are unavailable right now.
+ </Text>
+ );
+ }
+
+ if (submissions.length === 0) {
+ return (
+ <Text variant="body" className="!text-zinc-500">
+ No skill submissions are waiting for review.
+ </Text>
+ );
+ }
+
+ return (
+ <ul className="flex flex-col gap-3" data-testid="admin-skill-submissions">
+ {submissions.map((submission) => (
+ <li
+ key={submission.skill_listing_version_id}
+ className="flex flex-wrap items-start justify-between gap-3 rounded-xl border border-zinc-200 bg-white p-4"
+ >
+ <div className="min-w-0">
+ <Text variant="body-medium">
+ {submission.name}{" "}
+ <span className="text-zinc-400">v{submission.version}</span>
+ </Text>
+ <Text variant="small" className="!text-zinc-500">
+ {submission.description}
+ </Text>
+ <Text variant="small" className="!mt-1 !text-zinc-400">
+ /{submission.slug} · {submission.categories.join(", ")}
+ {submission.required_providers.length > 0
+ ? ` · works with ${submission.required_providers.join(", ")}`
+ : ""}
+ </Text>
+ </div>
+ <div className="flex flex-shrink-0 gap-2">
+ <Button
+ variant="secondary"
+ size="small"
+ disabled={isReviewing}
+ onClick={() => reject(submission.skill_listing_version_id)}
+ data-testid={`reject-${submission.skill_listing_version_id}`}
+ >
+ Reject
+ </Button>
+ <Button
+ variant="primary"
+ size="small"
+ disabled={isReviewing}
+ onClick={() => approve(submission.skill_listing_version_id)}
+ data-testid={`approve-${submission.skill_listing_version_id}`}
+ >
+ Approve
+ </Button>
+ </div>
+ </li>
+ ))}
+ </ul>
+ );
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/components/useAdminSkillSubmissions.ts b/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/components/useAdminSkillSubmissions.ts
new file mode 100644
index 0000000000..a954dd697d
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/components/useAdminSkillSubmissions.ts
@@ -0,0 +1,53 @@
+import {
+ getGetV2AdminListPendingSkillSubmissionsQueryKey,
+ useGetV2AdminListPendingSkillSubmissions,
+ usePostV2ReviewSkillSubmission,
+} from "@/app/api/__generated__/endpoints/admin/admin";
+import { useToast } from "@/components/molecules/Toast/use-toast";
+import { useQueryClient } from "@tanstack/react-query";
+
+export function useAdminSkillSubmissions() {
+ const queryClient = useQueryClient();
+ const { toast } = useToast();
+
+ const query = useGetV2AdminListPendingSkillSubmissions();
+
+ const { mutate: review, isPending } = usePostV2ReviewSkillSubmission({
+ mutation: {
+ onSuccess: () =>
+ queryClient.invalidateQueries({
+ queryKey: getGetV2AdminListPendingSkillSubmissionsQueryKey(),
+ }),
+ onError: (error) =>
+ toast({
+ title: "Couldn't record that review",
+ description:
+ error instanceof Error ? error.message : "Please try again.",
+ variant: "destructive",
+ }),
+ },
+ });
+
+ function submitReview(versionId: string, isApproved: boolean) {
+ review({
+ skillListingVersionId: versionId,
+ data: {
+ is_approved: isApproved,
+ comments: isApproved ? "Approved" : "Rejected",
+ },
+ });
+ }
+
+ // A 404 here is the skills-hub flag being off, not an empty queue — reporting
+ // "nothing to review" would tell an admin the opposite of the truth.
+ const loaded = query.data?.status === 200 ? query.data.data : null;
+
+ return {
+ submissions: loaded ?? [],
+ isLoading: query.isLoading,
+ isUnavailable: !query.isLoading && loaded === null,
+ isReviewing: isPending,
+ approve: (versionId: string) => submitReview(versionId, true),
+ reject: (versionId: string) => submitReview(versionId, false),
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/page.tsx b/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/page.tsx
index fb9b1ff52b..c7fa579b96 100644
--- a/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/admin/marketplace/page.tsx
@@ -2,6 +2,7 @@ import { withRoleAccess } from "@/lib/withRoleAccess";
import { Suspense } from "react";
import type { SubmissionStatus } from "@/app/api/__generated__/models/submissionStatus";
import { AdminAgentsDataTable } from "./components/AdminAgentsDataTable";
+import { AdminSkillSubmissions } from "./components/AdminSkillSubmissions";
type MarketplaceAdminPageSearchParams = {
page?: string;
@@ -41,6 +42,11 @@ async function AdminMarketplaceDashboard({
initialSearch={search}
/>
</Suspense>
+
+ <div className="mt-6 flex flex-col gap-3">
+ <h2 className="text-xl font-semibold">Skill submissions</h2>
+ <AdminSkillSubmissions />
+ </div>
</div>
</div>
);
diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.json
index 9e123bffb8..662d80f8fa 100644
--- a/autogpt_platform/frontend/src/app/api/openapi.json
+++ b/autogpt_platform/frontend/src/app/api/openapi.json
@@ -13766,6 +13766,79 @@
}
}
},
+ "/api/store/admin/skills/submissions": {
+ "get": {
+ "tags": ["v2", "admin", "store", "admin", "store", "admin"],
+ "summary": "Admin List Pending Skill Submissions",
+ "description": "Skill submissions awaiting review, oldest first.",
+ "operationId": "getV2Admin list pending skill submissions",
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "items": { "$ref": "#/components/schemas/SkillSubmission" },
+ "type": "array",
+ "title": "Response Getv2Admin List Pending Skill Submissions"
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ }
+ },
+ "security": [{ "HTTPBearerJWT": [] }, { "HTTPBearer": [] }]
+ }
+ },
+ "/api/store/admin/skills/submissions/{skill_listing_version_id}/review": {
+ "post": {
+ "tags": ["v2", "admin", "store", "admin", "store", "admin"],
+ "summary": "Review Skill Submission",
+ "description": "Approve or reject a skill submission.\n\nApproval promotes the version to the one the marketplace serves, so the\nbrowse cache is dropped; a rejection changes nothing shoppers can see.",
+ "operationId": "postV2Review skill submission",
+ "security": [{ "HTTPBearerJWT": [] }, { "HTTPBearer": [] }],
+ "parameters": [
+ {
+ "name": "skill_listing_version_id",
+ "in": "path",
+ "required": true,
+ "schema": { "type": "string", "title": "Skill Listing Version Id" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/SkillReviewRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/SkillSubmission" }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ },
+ "404": { "description": "Submission not found" },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
+ }
+ }
+ }
+ }
+ }
+ },
"/api/store/admin/submissions/download/{store_listing_version_id}": {
"get": {
"tags": ["v2", "admin", "store", "admin", "store", "admin"],
@@ -14683,6 +14756,124 @@
}
}
},
+ "/api/store/skills/submissions": {
+ "get": {
+ "tags": ["v2", "store", "private"],
+ "summary": "List my skill submissions",
+ "description": "Every version the caller has submitted, newest first per listing.",
+ "operationId": "getV2List my skill submissions",
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "items": { "$ref": "#/components/schemas/SkillSubmission" },
+ "type": "array",
+ "title": "Response Getv2List My Skill Submissions"
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ }
+ },
+ "security": [{ "HTTPBearer": [] }, { "HTTPBearerJWT": [] }]
+ },
+ "post": {
+ "tags": ["v2", "store", "private"],
+ "summary": "Publish skill to marketplace",
+ "description": "Submit one of the caller's own library skills for marketplace review.",
+ "operationId": "postV2Publish skill to marketplace",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SkillSubmissionRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "201": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/SkillSubmission" }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ },
+ "404": { "description": "Skill not in the caller's library" },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
+ }
+ }
+ },
+ "428": {
+ "description": "Marketplace profile required, or slug taken"
+ }
+ },
+ "security": [{ "HTTPBearer": [] }, { "HTTPBearerJWT": [] }]
+ }
+ },
+ "/api/store/skills/submissions/{skill_listing_version_id}": {
+ "put": {
+ "tags": ["v2", "store", "private"],
+ "summary": "Edit skill submission",
+ "description": "Update a pending submission and re-snapshot the library skill.",
+ "operationId": "putV2Edit skill submission",
+ "security": [{ "HTTPBearer": [] }, { "HTTPBearerJWT": [] }],
+ "parameters": [
+ {
+ "name": "skill_listing_version_id",
+ "in": "path",
+ "required": true,
+ "schema": { "type": "string", "title": "Skill Listing Version Id" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SkillSubmissionRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/SkillSubmission" }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ },
+ "404": { "description": "Submission not found" },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
+ }
+ }
+ },
+ "428": { "description": "Only a pending submission can be edited" }
+ }
+ }
+ },
"/api/store/skills/{slug}": {
"get": {
"tags": ["v2", "store", "public"],
@@ -27269,6 +27460,93 @@
"title": "SharedExecutionResponse",
"description": "Public-safe response for shared executions"
},
+ "SkillReviewRequest": {
+ "properties": {
+ "is_approved": { "type": "boolean", "title": "Is Approved" },
+ "comments": { "type": "string", "title": "Comments" },
+ "internal_comments": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Internal Comments"
+ }
+ },
+ "type": "object",
+ "required": ["is_approved", "comments"],
+ "title": "SkillReviewRequest",
+ "description": "An admin's verdict on one submission; the version comes from the path."
+ },
+ "SkillSubmission": {
+ "properties": {
+ "skill_listing_version_id": {
+ "type": "string",
+ "title": "Skill Listing Version Id"
+ },
+ "slug": { "type": "string", "title": "Slug" },
+ "name": { "type": "string", "title": "Name" },
+ "description": { "type": "string", "title": "Description" },
+ "categories": {
+ "items": { "type": "string" },
+ "type": "array",
+ "title": "Categories"
+ },
+ "required_providers": {
+ "items": { "type": "string" },
+ "type": "array",
+ "title": "Required Providers"
+ },
+ "version": { "type": "integer", "title": "Version" },
+ "status": { "$ref": "#/components/schemas/SubmissionStatus" },
+ "review_comments": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Review Comments"
+ },
+ "is_live": {
+ "type": "boolean",
+ "title": "Is Live",
+ "description": "Whether this version is the one the marketplace serves."
+ }
+ },
+ "type": "object",
+ "required": [
+ "skill_listing_version_id",
+ "slug",
+ "name",
+ "description",
+ "categories",
+ "required_providers",
+ "version",
+ "status",
+ "is_live"
+ ],
+ "title": "SkillSubmission"
+ },
+ "SkillSubmissionRequest": {
+ "properties": {
+ "skill_name": {
+ "type": "string",
+ "title": "Skill Name",
+ "description": "Slug of the caller's library skill to publish."
+ },
+ "categories": {
+ "items": { "type": "string" },
+ "type": "array",
+ "title": "Categories"
+ },
+ "required_providers": {
+ "items": { "type": "string" },
+ "type": "array",
+ "title": "Required Providers",
+ "description": "Integrations the skill's instructions assume are connected."
+ },
+ "changes_summary": {
+ "anyOf": [{ "type": "string" }, { "type": "null" }],
+ "title": "Changes Summary"
+ }
+ },
+ "type": "object",
+ "required": ["skill_name", "categories"],
+ "title": "SkillSubmissionRequest",
+ "description": "Publish one of the caller's own library skills as a marketplace listing."
+ },
"SkippedWebhookPreset": {
"properties": {
"id": { "type": "string", "title": "Id" },
diff --git a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/PublishSkillButton.tsx b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/PublishSkillButton.tsx
new file mode 100644
index 0000000000..969a0b8aed
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/PublishSkillButton.tsx
@@ -0,0 +1,112 @@
+"use client";
+
+import { Button } from "@/components/atoms/Button/Button";
+import { Icon } from "@/components/atoms/Icon/Icon";
+import { Select } from "@/components/atoms/Select/Select";
+import { Text } from "@/components/atoms/Text/Text";
+import { Dialog } from "@/components/molecules/Dialog/Dialog";
+import { MultiToggle } from "@/components/molecules/MultiToggle/MultiToggle";
+import { CheckmarkCircle02Icon, Store01Icon } from "@hugeicons/core-free-icons";
+import { usePublishSkillButton } from "./usePublishSkillButton";
+
+interface Props {
+ skillName: string;
+}
+
+export function PublishSkillButton({ skillName }: Props) {
+ const {
+ isOpen,
+ setIsOpen,
+ open,
+ submitted,
+ isPublishing,
+ canSubmit,
+ category,
+ setCategory,
+ categoryOptions,
+ providers,
+ setProviders,
+ providerItems,
+ submit,
+ } = usePublishSkillButton({ skillName });
+
+ return (
+ <>
+ <Button
+ variant="icon"
+ size="icon"
+ onClick={open}
+ data-testid="skill-publish-button"
+ aria-label="Publish skill to marketplace"
+ >
+ <Icon icon={Store01Icon} className="h-4 w-4" />
+ </Button>
+
+ <Dialog
+ controlled={{ isOpen, set: setIsOpen }}
+ styling={{ maxWidth: "32rem" }}
+ title="Publish to marketplace"
+ >
+ <Dialog.Content>
+ {submitted ? (
+ <div
+ className="flex items-start gap-2"
+ data-testid="skill-publish-submitted"
+ >
+ <Icon
+ icon={CheckmarkCircle02Icon}
+ size={18}
+ className="mt-0.5 text-emerald-600"
+ />
+ <Text variant="body">
+ Submitted for review. Your skill appears in the marketplace once
+ it is approved; what you published is a copy, so editing it here
+ changes nothing until you publish again.
+ </Text>
+ </div>
+ ) : (
+ <div className="flex flex-col gap-4">
+ <Text variant="body" className="!text-zinc-500">
+ Publishing sends a copy of <strong>{skillName}</strong> for
+ review. Say where it belongs and what it expects to be
+ connected.
+ </Text>
+ <Select
+ id="skill-category"
+ label="Category"
+ placeholder="Pick a category"
+ value={category}
+ onValueChange={setCategory}
+ options={categoryOptions}
+ />
+ <div className="flex flex-col gap-2">
+ <Text variant="large-medium">Works with</Text>
+ <Text variant="small" className="!text-zinc-500">
+ Integrations your instructions assume. Installers see these
+ and connect them when they first need one.
+ </Text>
+ <MultiToggle
+ items={providerItems}
+ selectedValues={providers}
+ onChange={setProviders}
+ aria-label="Integrations this skill works with"
+ />
+ </div>
+ <div className="flex justify-end">
+ <Button
+ variant="primary"
+ onClick={submit}
+ disabled={!canSubmit}
+ loading={isPublishing}
+ data-testid="skill-publish-submit"
+ >
+ Submit for review
+ </Button>
+ </div>
+ </div>
+ )}
+ </Dialog.Content>
+ </Dialog>
+ </>
+ );
+}
diff --git a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/__tests__/PublishSkillButton.test.tsx b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/__tests__/PublishSkillButton.test.tsx
new file mode 100644
index 0000000000..add10a7cec
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/__tests__/PublishSkillButton.test.tsx
@@ -0,0 +1,103 @@
+import {
+ getGetV2ListStoreCategoriesMockHandler200,
+ getPostV2PublishSkillToMarketplaceMockHandler201,
+} from "@/app/api/__generated__/endpoints/store/store.msw";
+import { getGetV1ListProvidersMockHandler200 } from "@/app/api/__generated__/endpoints/integrations/integrations.msw";
+import { server } from "@/mocks/mock-server";
+import { render, screen, waitFor } from "@/tests/integrations/test-utils";
+import userEvent from "@testing-library/user-event";
+
+// Radix marks the page inert while a dialog is open, which userEvent refuses
+// to click through by default.
+const user = () => userEvent.setup({ pointerEventsCheck: 0 });
+import { http, HttpResponse } from "msw";
+import { beforeEach, describe, expect, test, vi } from "vitest";
+import { PublishSkillButton } from "../PublishSkillButton";
+
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({ push: vi.fn(), replace: vi.fn(), prefetch: vi.fn() }),
+ usePathname: () => "/library/skills",
+ useSearchParams: () => new URLSearchParams(),
+ useParams: () => ({}),
+}));
+
+const categories = [
+ { value: "content", label: "Content", description: "Writing and media" },
+ { value: "sales", label: "Sales", description: "Outreach and CRM" },
+];
+
+describe("PublishSkillButton", () => {
+ beforeEach(() => {
+ server.use(
+ getGetV2ListStoreCategoriesMockHandler200(categories),
+ getGetV1ListProvidersMockHandler200([
+ { name: "google", description: "Google" },
+ ]),
+ getPostV2PublishSkillToMarketplaceMockHandler201(),
+ );
+ });
+
+ test("will not submit until a category is chosen", async () => {
+ const u = user();
+ render(<PublishSkillButton skillName="brand-voice-guide" />);
+
+ await u.click(screen.getByTestId("skill-publish-button"));
+
+ const submit = await screen.findByTestId("skill-publish-submit");
+ expect(submit.hasAttribute("disabled")).toBe(true);
+ });
+
+ test("submits the skill with its category and integrations", async () => {
+ const u = user();
+ let body: unknown = null;
+ server.use(
+ http.post("*/api/store/skills/submissions", async ({ request }) => {
+ body = await request.json();
+ return HttpResponse.json(
+ {
+ skill_listing_version_id: "v1",
+ slug: "brand-voice-guide",
+ name: "brand-voice-guide",
+ description: "d",
+ categories: ["content"],
+ required_providers: ["google"],
+ version: 1,
+ status: "PENDING",
+ review_comments: null,
+ is_live: false,
+ },
+ { status: 201 },
+ );
+ }),
+ );
+ render(<PublishSkillButton skillName="brand-voice-guide" />);
+ await u.click(screen.getByTestId("skill-publish-button"));
+
+ await u.click(await screen.findByText("Pick a category"));
+ await u.click(await screen.findByText("Content"));
+ await u.click(await screen.findByText("Google"));
+ await u.click(screen.getByTestId("skill-publish-submit"));
+
+ expect(await screen.findByTestId("skill-publish-submitted")).toBeDefined();
+ await waitFor(() =>
+ expect(body).toEqual({
+ skill_name: "brand-voice-guide",
+ categories: ["content"],
+ required_providers: ["google"],
+ }),
+ );
+ });
+
+ test("says the published copy is a snapshot, not a live link", async () => {
+ const u = user();
+ render(<PublishSkillButton skillName="brand-voice-guide" />);
+ await u.click(screen.getByTestId("skill-publish-button"));
+ await u.click(await screen.findByText("Pick a category"));
+ await u.click(await screen.findByText("Content"));
+ await u.click(screen.getByTestId("skill-publish-submit"));
+
+ const done = await screen.findByTestId("skill-publish-submitted");
+ expect(done.textContent).toMatch(/copy/i);
+ expect(done.textContent).toMatch(/until you publish again/i);
+ });
+});
diff --git a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/usePublishSkillButton.ts b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/usePublishSkillButton.ts
new file mode 100644
index 0000000000..a714f51419
--- /dev/null
+++ b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/usePublishSkillButton.ts
@@ -0,0 +1,79 @@
+import { usePostV2PublishSkillToMarketplace } from "@/app/api/__generated__/endpoints/store/store";
+import { useGetV1ListProviders } from "@/app/api/__generated__/endpoints/integrations/integrations";
+import { formatProviderName } from "@/components/contextual/IntegrationsPanel/helpers";
+import { useToast } from "@/components/molecules/Toast/use-toast";
+import { useStoreCategories } from "@/hooks/useStoreCategories";
+import { useState } from "react";
+
+interface Args {
+ skillName: string;
+}
+
+export function usePublishSkillButton({ skillName }: Args) {
+ const { toast } = useToast();
+ const { categories } = useStoreCategories();
+ const [isOpen, setIsOpen] = useState(false);
+ const [category, setCategory] = useState("");
+ const [providers, setProviders] = useState<string[]>([]);
+ const [submitted, setSubmitted] = useState(false);
+
+ const providersQuery = useGetV1ListProviders({
+ query: {
+ enabled: isOpen,
+ select: (response) => (response.status === 200 ? response.data : []),
+ },
+ });
+
+ const { mutate: publish, isPending } = usePostV2PublishSkillToMarketplace({
+ mutation: {
+ onSuccess: (response) => {
+ if (response.status !== 201) return;
+ setSubmitted(true);
+ },
+ onError: (error) =>
+ toast({
+ title: "Couldn't publish this skill",
+ description:
+ error instanceof Error ? error.message : "Please try again.",
+ variant: "destructive",
+ }),
+ },
+ });
+
+ function open() {
+ setSubmitted(false);
+ setIsOpen(true);
+ }
+
+ function submit() {
+ publish({
+ data: {
+ skill_name: skillName,
+ categories: [category],
+ required_providers: providers,
+ },
+ });
+ }
+
+ return {
+ isOpen,
+ setIsOpen,
+ open,
+ submitted,
+ isPublishing: isPending,
+ canSubmit: category !== "" && !isPending,
+ category,
+ setCategory,
+ categoryOptions: categories.map((c) => ({
+ value: c.value,
+ label: c.label,
+ })),
+ providers,
+ setProviders,
+ providerItems: (providersQuery.data ?? []).map((provider) => ({
+ value: provider.name,
+ label: formatProviderName(provider.name),
+ })),
+ submit,
+ };
+}
diff --git a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/SkillListItem/SkillListItem.tsx b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/SkillListItem/SkillListItem.tsx
index 7e9e97bc6e..612ad86791 100644
--- a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/SkillListItem/SkillListItem.tsx
+++ b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/SkillListItem/SkillListItem.tsx
@@ -3,6 +3,8 @@
import type { CopilotSkillInfo } from "@/app/api/__generated__/models/copilotSkillInfo";
import { Badge } from "@/components/atoms/Badge/Badge";
import { Button } from "@/components/atoms/Button/Button";
+import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
+import { PublishSkillButton } from "../PublishSkillButton/PublishSkillButton";
import { Text } from "@/components/atoms/Text/Text";
import { Dialog } from "@/components/molecules/Dialog/Dialog";
import { LoadingSpinner } from "@/components/atoms/LoadingSpinner/LoadingSpinner";
@@ -39,6 +41,7 @@ export function SkillListItem({ skill, isNew = false }: Props) {
detail,
detailErrorMessage,
} = useSkillListItem({ skill });
+ const isSkillsHubEnabled = useGetFlag(Flag.SKILLS_HUB);
return (
<div
@@ -104,6 +107,9 @@ export function SkillListItem({ skill, isNew = false }: Props) {
>
<Icon icon={Download04Icon} className="h-4 w-4" />
</Button>
+ {isSkillsHubEnabled ? (
+ <PublishSkillButton skillName={skill.name} />
+ ) : null}
<Button
variant="icon"
size="icon"