Badges system award visual badges for agent milestones #416
Open
clintjeff2 wants to merge 2 commits into
Open
Conversation
…lestones Add agent milestone badge system
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Motivation
Description
lib/gamification/badges.tsthat defines all five milestone badges (first_task,speed_runner,top_earner,quest_master,early_adopter), stores earned badges at/.data/agent-badges.json, records task completions for rolling-window checks, and exposescheckAndAwardBadges()(idempotent) andrecordTaskCompletion()APIs.upsertReputationMetrics().recordTaskCompletion()andcheckAndAwardBadges()fromlib/agent-runtime/agent.tsandapp/api/agents/[id]/tasks/drain/route.ts.GET /api/agents/[id]/badges(app/api/agents/[id]/badges/route.ts) to merge persisted awards with reputation badges and return display metadata includingearnedAt,iconName,rarity, andxpValue.app/agents/[id]/page.tsx) to fetch/api/agents/[id]/badgesand render a badge icon grid with hover tooltips showing name and description.__tests__/gamification/badges.test.tscovering badge definitions, idempotent awarding, persistence, and the speed-runner 10-in-1-hour condition.Testing
__tests__/gamification/badges.test.ts,__tests__/api/agents/badges.test.ts, and__tests__/api/badges/catalog.test.ts, and all tests passed (Test Files: 3 passed, Tests: 21 passed).npx eslintagainst the changed files (lib/gamification/badges.ts,app/api/agents/[id]/badges/route.ts,lib/agent-runtime/agent.ts,app/agents/[id]/page.tsx,app/api/agents/[id]/tasks/drain/route.ts, and the new test), which completed for those targets without new errors.npm run lintsurfaces pre-existing unrelated lint/TS issues in other files andnpx tsc --noEmitfails in this environment due to missing dev dependencies/types (e.g.,lru-cache,@wagmi/connectors), but these are unrelated to the badge changes and did not block the badge tests.Closes #201