mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6635] [MERGED] feat(capability): let packages register, read, and unlock achievements #7262
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7262
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6635
Author: @Gunterlie
Created: 9/24/2026
Status: ✅ Merged
Merged: 9/25/2026
Merged by: @Gunterlie
Base:
staging← Head:feat/6634-package-achievements📝 Commits (10+)
245983ffeat(capability): let packages register, read, and unlock achievements7c1272bfix(capability): require capability API 1.35 for the achievements permission0e94e06Merge branch 'staging' into feat/6634-package-achievements787bb5cMerge branch 'staging' into feat/6634-package-achievementscc16537fix(capability): move package achievements to capability API 1.36218ecc6Merge remote-tracking branch 'origin/staging' into feat/6634-package-achievementsed96b77Merge remote-tracking branch 'origin/feat/6634-package-achievements' into feat/6634-package-achievements11c0c2efix(capability): address review on package achievements05858d4docs(capability): note that achievement progress deadlines bound async waits only6c90059Merge remote-tracking branch 'origin/staging' into feat/6634-package-achievements📊 Changes
15 files changed (+785 additions, -48 deletions)
View changed files
📝
docs/development/optional-agent-packages.md(+47 -0)📝
docs/home/achievements.md(+10 -0)📝
packages/client/src/components/chat/HomeAchievements.tsx(+57 -10)📝
packages/client/src/hooks/use-achievements.ts(+26 -2)📝
packages/client/src/lib/achievement-toast.tsx(+25 -3)📝
packages/client/src/localization/locales/en.json(+1 -0)📝
packages/server/src/services/achievements/achievements.service.ts(+78 -27)➕
packages/server/src/services/capability-packages/capability-achievement-host.service.ts(+48 -0)➕
packages/server/src/services/capability-packages/capability-achievement-registry.service.ts(+208 -0)📝
packages/server/src/services/capability-packages/capability-module-runtime.service.ts(+32 -0)📝
packages/shared/src/schemas/capability-package.schema.ts(+15 -1)📝
packages/shared/src/types/achievement.ts(+37 -1)📝
packages/shared/src/types/capability-runtime.ts(+4 -0)➕
scripts/regressions/capability-achievements.regression.ts(+193 -0)📝
scripts/regressions/capability-package-lifecycle.regression.ts(+4 -4)📄 Description
Closes #6634
Why
Achievements were Engine-only: a hard-coded catalog, fixed metrics, and a fixed icon set. An agent package could not add a badge for its own feature, check if the badge was earned, or unlock it. The user also had no way to see which badges came from which agent.
What
achievementspermission.supportedCapabilityApigoes to 1.36.api.registerAchievements([...])on the activation context. It follows theregisterToolpattern: permission gate, refused after teardown, released on deactivate. Ids become<packageId>.<id>. Built-in ids have no dot, so they cannot collide. A batch with one bad entry registers nothing. Limit: 32 per package.api.runtime.achievements.list() / isUnlocked(id) / unlock(id). Each call accepts only ids that the calling package registered.unlockresolves true only for the call that unlocked the badge.target+readProgress(). The package owns the counter and keeps it in its persistence host. The Engine unlocks the badge on the same pass as its own ranked badges. A callback that throws or hangs (2 s) reports 0, so one broken package cannot break the panel.iconPathresolves to the existing package assets route. Unlocked cards only (locked cards keep the padlock). If the image fails, the card falls back to theiconenum (newtrophydefault).source. Engine badges come first, then one section per package, headed "From ". The heading uses the existing group-label style (text-[0.625rem] font-semibold uppercase tracking-wide). With no package badges, the panel renders exactly as before.achievement_unlocksalready keys by a plain string id, so there is no new table and noSTORAGE_VERSIONbump.Out of scope, on purpose: an HTTP endpoint that lets clients unlock badges (it would let anyone unlock anything), an achievement editor, and reset.
Docs
docs/home/achievements.md: new "Achievements from agents" section.docs/development/optional-agent-packages.md: Capability API 1.36 section.Validation
pnpm checkpasses.scripts/regressions/capability-achievements.regression.tspasses. It covers namespacing, the asset URL, the progress fallback, collision and invalid-id refusal, the all-or-nothing batch, ownership and permission guards, and release.Dev Engine test (dev-marinara, before the 1.36 move)
A throwaway test agent registered five badges. Verified live: its own section, package art, broken-art fallback to the trophy, locked padlock, target auto-unlock,
isUnlocked, refusal to unlock a built-in badge, and one unlock pop-up with the page open (desktop and 390 px). Not observed live:unlock()returningtrue(the regression covers it).Manual verification
iconPathart renders on an unlocked card, and that a broken path falls back to the trophy icon.unlock()returns true once and false on a second call, and that the toast appears once.readProgressbadge shows the progress bar and auto-unlocks attarget.achievementspermission fails activation atregisterAchievements.staging, on wide and narrow widths.Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.