mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5115] [CLOSED] feat(tracker): Inventory Tracker agent with a grid tracker panel #6638
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#6638
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/5115
Author: @augusteo
Created: 8/16/2026
Status: ❌ Closed
Base:
staging← Head:feat/inventory-tracker-agent📝 Commits (2)
d87d626feat(tracker): add Inventory Tracker agent with a grid tracker panel3602a13fix(tracker): enforce inventory exclusivity, migrate panel order, cap quantities📊 Changes
35 files changed (+1513 additions, -18 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
README.md(+1 -1)📝
docs/agents/built-in-agents.md(+11 -1)📝
docs/development/frontend.md(+2 -1)📝
docs/roleplay/hud-and-trackers.md(+6 -2)📝
e2e/core-flows.e2e.ts(+1 -1)➕
e2e/inventory-tracker.e2e.ts(+144 -0)📝
packages/client/src/components/agents/AgentCatalogView.tsx(+1 -0)📝
packages/client/src/components/agents/AgentEditor.tsx(+7 -0)📝
packages/client/src/components/chat/RoleplayHUD.tsx(+137 -1)📝
packages/client/src/components/chat/RoleplayHUDPanels.tsx(+219 -0)📝
packages/client/src/components/panels/SettingsPanel.tsx(+4 -0)📝
packages/client/src/features/tracker-panel/components/TrackerSectionList.tsx(+39 -2)➕
packages/client/src/features/tracker-panel/components/sections/InventoryTrackerPanel.tsx(+174 -0)➕
packages/client/src/features/tracker-panel/components/sections/InventoryTrackerRow.tsx(+100 -0)📝
packages/client/src/features/tracker-panel/hooks/use-tracker-mutations.ts(+67 -0)📝
packages/client/src/features/tracker-panel/lib/tracker-panel.constants.ts(+2 -0)📝
packages/client/src/lib/agent-suite-tracker-slices.ts(+32 -1)📝
packages/client/src/localization/locales/en.json(+15 -0)📝
packages/client/src/stores/ui.store.ts(+7 -2)...and 15 more files
📄 Description
Closes #5105.
Why
In Roleplay Mode the only way to track an inventory is the Custom Tracker agent, and its contract is string-only —
CustomTrackerFieldis{ name: string; value: string }, and its prompt says "Values are always strings." An entire inventory therefore collapses into one prose value in one cell, which the panel then truncates atline-clamp-2:Expanding the tracker panel does not help — there is no structure to lay out, so a wider column just shows a bigger truncated string. #5051 improved the spacing, which helped, but could not reach the cause. Two more problems fall out of the same shape: the same item appears under both "Inventory" and "Equipment" because nothing makes equipping move it, and currencies, carried items, and worn items are indistinguishable to the UI, so none of them can be laid out well.
Game/GM mode already has a real item grid. This gives Roleplay one.
What
A new
inventory-trackeragent result type backed by three newPlayerStatsarrays — currencies, equipped, and carried — all sharing one{ name, qty }row shape. One row shape means one merge path, one lock-key family, and one row control serve all three groups.The agent's contract:
qtyis omitted when 1, so the stored payload stays compact. The prompt is prescriptive by design — the point is to stop the model writing prose: an equipped item appears only inequippedand never ininventory(equipping moves the row across),currenciesis money only, names are short noun phrases, duplicates merge by name, and an omitted array means "leave unchanged" rather than "delete", which is the failure mode that made empty tracker output destructive in #2370 and #2724.The Tracker Panel gains an Inventory section that renders the three groups as grids, sitting between Quest Board and Custom Stats alongside the other sections. The Roleplay HUD gains a matching cycling widget and popover, on both the desktop widget strip and the mobile combined player panel.
Scope note: the new arrays are the agent's own.
playerStats.inventorystill belongs to the Persona Stats agent and is untouched, so existing chats see no change and either agent can run on its own.Follow-up
Agent definitions do not live in this repository —
packages/server/data/is gitignored and packages are fetched fromPasta-Devs/Marinara-Agentsat runtime. The downloadableinventory-trackerpackage is a separate PR there. This PR lands first: it is testable on its own (below), and the package is inert without it.A
[docs-i18n]follow-up will be opened for the translated doc packs, perCLAUDE.md.Changes
InventoryTrackerItemand the threePlayerStatsarrays; theinventory_tracker_updateresult type mapped to theedit_trackerscapability;inventorySectionTracker*lock keys, namespaced underplayer.inventoryTrackerso they can never collide with the persona-statsplayer.inventorykeys; a newinventory-tracker-fields.tswith group constants, normalization, result parsing, and compact prompt formatting.buildLockedInventoryTrackerPatchapplying all three groups through one lock pass and emitting a singlegame_state_patch; apply blocks in bothgenerate.routes.tsandretry-agents-route.ts(this pair has drifted before — see #2729); anInventory Trackerblock in committed tracker context; the marker-expander auto-injection skip-list; the Professor Mari catalog entry.inventorytracker-panel section and its store registration;InventoryTrackerPanel/InventoryTrackerRowreusing the persona inventory shelf's grid idiom; HUD widget and popover; per-group mutations reusingreconcileListUpdate; the agent-suite JSON slice; Agent Editor result-type entry; catalog mode entry; Settings panel section card.docs/roleplay/hud-and-trackers.md,docs/agents/built-in-agents.md,CHANGELOG.md.Screenshots
All captured from the running app via Playwright against a seeded chat. Panel at the Expanded width unless noted.
The problem, and the fix
The same inventory, same panel width — as Custom Tracker prose, then as the Inventory Tracker.
Three prose blobs where equipment and inventory repeat each other, versus one row per item with its own quantity. At the narrower panel widths in the report those values also truncate at two lines; here they merely wrap, which is why the row-per-item structure — not extra width — is the fix.
In the tracker side panel, alongside the others
Inventory sits between Quest Board and Custom Stats, in the shared section order and reorderable with the rest.
Editing modes
The section honors the panel's existing add / delete / lock modes. In the lock shot,
Family heirloom longsword(name) andScavenged axe(quantity) are locked, so a tracker re-run leaves them alone.Empty state and compact width
Groups stay visible when empty so the structure is discoverable before the agent has written anything. At the Compact width the grid collapses to a single column.
Roleplay HUD widget
For users who keep the docked panel closed, the compact widget cycles tracked entries and opens the same three groups in a popover.
Review fixes
An adversarial review pass over the first commit found three real bugs, all fixed in the second commit:
mergeNamedRowsWithLocksdeliberately re-appends a locked row the agent dropped — precisely what happens when a locked carried item gets equipped. Exclusivity is now enforced after merging insideapplyTrackerFieldLocksToGameStatePatch, the one choke point both server apply routes and the client's SSE merge pass through.93, so Zustand'smigrate— which re-normalizestrackerPanelSectionOrder— never ran, leaving every saved five-section order without"inventory". Bumped to94.Infinity, whichJSON.stringifywrites asnull, silently corrupting the stored row. Both the parsed value and the running total are now clamped to a safe integer.Registering the agent in the official catalog,
docs/development/frontend.md, andREADME.mdwas likewise not optional — the repo's own prompt regression pins all three.Validation
Run locally on this branch:
pnpm check— passedpnpm regression:agent-runtime— passed, including new Inventory Tracker assertionspnpm regression:roleplay— passedpnpm regression:localization— passedpnpm regression:docs— passedpnpm regression:prompt— passes the agent-catalog coverage check this PR extends. One unrelated assertion,ElevenLabs TTS input does not prepend sprite tone tags, fails — verified to fail identically on a cleanorigin/stagingworktree, so it is pre-existing and out of scope here.e2e/inventory-tracker.e2e.ts(new) — both specs pass underdesktop-chromium.New automated coverage added by this PR:
scripts/regressions/agent-runtime.regression.ts— parsing (absent-vs-empty groups, qty defaulting), normalization (dedup by name, clamping), the equipped/carried exclusivity invariant including the locked-row case, and the patch shape (only touched groups streamed; unrelatedplayerStatsfields and the persona-stats inventory left intact).e2e/inventory-tracker.e2e.ts— the panel renders all three groups and every row as its own control with correct quantities, and the section stays hidden when the agent is not enabled.Test plan
Automated coverage above does not replace a look at the real thing. Reviewer checks:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.