mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #3308] [MERGED] feat(turn-games): personality-driven bot moves + seat-aware game context in chat #5872
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#5872
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/3308
Author: @Romuromylus
Created: 7/6/2026
Status: ✅ Merged
Merged: 7/6/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/turn-game-personality-context📝 Commits (5)
aee6b88feat(turn-games): personality-driven bot moves + seat-aware game context in chat59bd453Merge branch 'staging' into fix/turn-game-personality-contextb36fe4cfeat(turn-games): personality-gated hand secrecy + one game load per generation turnc28f540Merge remote-tracking branch 'pasta/fix/turn-game-personality-context' into fix/turn-game-personality-context0b16186feat(turn-games): personality-gate plan secrecy in open-information games📊 Changes
6 files changed (+168 additions, -34 deletions)
View changed files
📝
packages/server/src/routes/generate.routes.ts(+37 -13)📝
packages/server/src/services/turn-games/turn-game-bot-runner.service.ts(+7 -1)📝
packages/server/src/services/turn-games/turn-game-runner.service.ts(+58 -20)📝
packages/shared/src/features/turn-games/chess/engine.ts(+26 -0)📝
packages/shared/src/features/turn-games/engine.types.ts(+15 -0)📝
packages/shared/src/features/turn-games/uno/engine.ts(+25 -0)📄 Description
Linked issue
Closes #3306
Why this change
The turn-game framework (UNO, chess) plays mechanically today: a bot seat's persona is included in the move prompt but nothing instructs the model to let it shape the move, so personality is narration-only flavor. And when the user talks to a character mid-game, every responder gets the same hand-free spectator snapshot — a character can't answer "how's your hand looking?" or "what was your last move?", and the in-progress chess context carries no move history at all. Both gaps break the illusion that the characters are actually playing.
What changed
Move selection is personality-directed. The bot runner's move-selection system prompt now tells the model to pick the move this character would make — bold characters take risks, cautious ones play safe, cunning ones save strong plays, and grudges from table talk matter — rather than the objectively strongest legal move. UNO's per-turn board summary also gains a "What just happened" recent-plays block so a bot can react to the moves that led to its turn (chess already carried history in its move prompt).
New engine-contract method
participantSummary(state, seatId)(engine.types.ts, implemented for UNO and chess): a seat-aware variant ofspectatorSummarythat appends the seat's OWN information — their UNO hand, their chess color/opponent, whether it's their move, and their own most recent action — while keeping all other seats' hidden information redacted. Falls back to the spectator text for unseated viewers.getTurnGameContextText(db, chatId, seatId?)selects the participant view for seated viewers and pairs it with seated-specific guidance (own your moves, hint or bluff about your hand in character, never recite stats or list hidden cards, never reveal other players' hidden information).Per-responder injection in
generate.routes.ts. The conversation-path game-context injection moved from one shared pre-loop block intogenerateForCharacter, so each responding character gets the board from their own seat. Privacy guards: a merged group generation that may voice several characters stays on the hand-free spectator view (newspeaksOnlyTargetCharacterparameter — true for the individual loop, single explicit @mention, regen target, and non-group chats), and impersonation receives the human seat's view.The chess in-progress spectator summary now includes recent move history (
Recent moves: 1. c4 e5 …) instead of only the single last move.Hand secrecy is personality-gated per game type. New engine-contract flag
hiddenInformation(UNOtrue, chessfalse). In hidden-information games the seated guidance frames the hand as private — keeping it hidden is part of playing, and whether the character deflects, teases, bluffs, or lets something slip when asked is up to their personality (hand counts stay public). In open-information games like chess the position is public and freely discussable, but the character's plans stay a personality-gated secret — whether they share, deflect, or misdirect about their intentions is their call.One game load per generation turn.
getTurnGameContextBuilder(db, chatId)loads the game (visible-anchor scan + state parse) once per request and returns a per-seat text builder;generateForCharactercalls the builder per responding character, so a sequential group turn no longer re-scans the chat once per character.getTurnGameContextTextremains as a one-shot wrapper.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Tested on a build deployed to my private instance, in a merged-mode group conversation with five characters:
Remaining for reviewers to double-check: individual-response group mode mid-game, and continue/regenerate flows on a game-active chat.
Docs and release impact
UI evidence (if applicable)
Not applicable — no UI changes; the visible effect is in generated chat content and bot move choice.
Summary by CodeRabbit
New Features
Bug Fixes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.