Add agent badge inventory#353
Conversation
bb3261a to
a5a9923
Compare
|
Update: rebased onto latest Current status:
The remaining failing |
|
Hi @Vinaystwt — this now conflicts with main after merging #375/#371 (openapi.json overlap). Please rebase and resolve; the badge logic itself looks good. 👍 |
a5a9923 to
8b22779
Compare
|
|
Thanks — rebased onto latest The stale task-drain follow-up commit has been dropped; the branch now contains only the badge inventory/catalog commit. Verification:
Note: local |



Summary
What changed
Added
lib/gamification/badge-catalog.tsAdded central badge metadata with:
badgeIdnamedescriptionrarityxpValueAdded the five supported rarity tiers:
commonuncommonrareepiclegendaryUpdated reputation badge rarity typing to include
uncommonUpdated badge event typing to use the shared badge rarity type
Updated renderer badge particle rarity typing to include
uncommonAdded
GET /api/agents/[id]/badgesAdded
GET /api/badgesUpdated OpenAPI docs
Added focused route/catalog tests
Agent badge inventory
GET /api/agents/[id]/badgesReturns badges earned by the requested agent, sorted by
earnedAtdescending:{ "agentId": "bot-x", "badges": [ { "badgeId": "rare-taskmaster", "name": "Rare Taskmaster", "description": "Completed 50 agent tasks in a single week.", "rarity": "rare", "earnedAt": "2026-06-01T00:00:00.000Z", "xpValue": 500 } ], "total": 1 }Behavior:
404for unknown agents?rarity=common|uncommon|rare|epic|legendary400Badge catalog
GET /api/badgesReturns the badge catalog with earned counts:
[ { "badgeId": "first-quest", "name": "First Quest Completed", "description": "Completed your first quest.", "rarity": "common", "xpValue": 50, "earnedByCount": 12 } ]Behavior:
?rarity=common|uncommon|rare|epic|legendary400earnedByCountis calculated from reputation snapshots at query timeTests run
npm testnpx tsc --noEmitnpm run buildgit diff --checkVerification
git diff --checkpassed.next,.data, roottsconfig.tsbuildinfo, anddocs/superpowersartifacts are not includedCloses #334