[PR #3408] [MERGED] feat(turn-games): add No-Limit Texas Hold'em poker as the third conversation-mode table game #5923

Closed
opened 2026-10-23 04:05:11 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3408
Author: @Romuromylus
Created: 7/9/2026
Status: ✅ Merged
Merged: 7/9/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/turn-games-poker


📝 Commits (9)

  • b1e4f02 feat(turn-games): add No-Limit Texas Hold'em poker engine
  • d351e0b feat(turn-games): dealer announcements in the bot loop + [poker] command
  • e4d380b feat(turn-games): poker table board, setup modal, and client wiring
  • 2cbc44c docs(changelog): poker entry + missed v2.1.2 turn-game framework notes
  • b538a67 fix(turn-games): don't manufacture a poker side pot from a folder's dead money
  • 8339a37 fix(turn-games): let the poker bet field accept partial typing
  • 6ceb543 docs(changelog): move the #3308 turn-game notes to their shipped release (2.1.0)
  • 6d073a7 Merge remote-tracking branch 'pasta/staging' into feat/turn-games-poker
  • 6b6e011 fix(turn-games): address CodeRabbit review — debug-log dealer prompt, narrow bet-input reset

📊 Changes

29 files changed (+3124 additions, -10 deletions)

View changed files

📝 CHANGELOG.md (+6 -0)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+5 -0)
📝 packages/client/src/components/chat/ChatSetupWizard.tsx (+1 -0)
📝 packages/client/src/components/chat/ConversationInput.tsx (+9 -2)
📝 packages/client/src/components/chat/ConversationView.tsx (+10 -2)
➕ packages/client/src/components/chat/PokerBoard.tsx (+476 -0)
➕ packages/client/src/components/chat/PokerSetup.tsx (+228 -0)
📝 packages/client/src/hooks/use-generate.ts (+7 -0)
➕ packages/client/src/hooks/use-poker.ts (+146 -0)
📝 packages/client/src/lib/slash-commands.ts (+14 -0)
➕ packages/client/src/stores/poker-game.store.ts (+36 -0)
📝 packages/server/src/routes/conversation-calls.routes.ts (+2 -0)
📝 packages/server/src/services/conversation/character-commands.ts (+16 -0)
📝 packages/server/src/services/generation/conversation-command-runtime.ts (+14 -2)
📝 packages/server/src/services/generation/turn-game-command-runtime.ts (+71 -0)
📝 packages/server/src/services/turn-games/turn-game-bot-runner.service.ts (+223 -3)
📝 packages/server/src/services/turn-games/turn-game-runner.service.ts (+11 -0)
📝 packages/shared/scripts/generate-feature-registries.mjs (+1 -1)
📝 packages/shared/src/features/turn-games/engine.types.ts (+20 -0)
➕ packages/shared/src/features/turn-games/poker/deck.ts (+128 -0)

...and 9 more files

📄 Description

Linked issue

Closes #3407

Why this change

Conversation mode had two table games (UNO, chess) but no betting game — and poker is where character personality matters most: bluffing, needling, folding under pressure, and shoving all-in are in-character acts, not just game logic. This adds No-Limit Texas Hold'em as the third turn-game on the existing conversation-mode framework, giving group chats a reason to gather at a table where each character's temperament actually changes how they play. It also introduces a selectable dealer so a chosen character (or a silent house dealer) narrates the hand in their own voice while the engine deals fairly.

What changed

Shared — deterministic poker engine (packages/shared/src/features/turn-games/poker/)

  • Pure, server-authoritative No-Limit Hold'em engine: seeded fair dealing (each hand's deck is deterministicShuffle(seed, handNumber), so message edits / regenerations rewind to identical deals), full no-limit betting with all-ins, incomplete-raise capping, the big-blind option, and layered side pots.
  • Hand-rolled 5-of-7 evaluator with natural-English showdown labels ("Full house, kings over nines").
  • Multi-hand sessions: rotating dealer button, optional blind escalation, optional hand limit, and a human-paced next_hand step between hands. hiddenInformation: true, so the framework keeps each seat's hole cards private.
  • Two new optional methods on the TurnGameEngine contract — announcerCharacterId and drainAnnouncements — for the dealer-narration feature. UNO and chess implement neither and are entirely unaffected.

Server — dealer announcements + [poker] command

  • The bot-turn runner drains engine-queued dealer announcements (hand start, street deals, showdown, blinds up, game over): a configured dealer character voices them as one short in-character line; a silent house dealer just advances state. Optional-method-guarded, so UNO/chess paths are unchanged.
  • New [poker] conversation command (advertise + dispatch, seats human + non-offline characters capped at 8) mirroring [uno]/[chess].

Client — table board + setup

  • PokerBoard (community cards, seat strip with button/blind/status badges, hole cards + live hand label, fold/check/call/bet-raise/all-in action bar, showdown recap with best-five highlighting, Next hand pacing) and PokerSetup (player picker, dealer dropdown — house or any character, stakes).
  • Wiring: poker store into both turn_game_state_patch handlers, /poker, the natural-language launcher, and the conversation command toggles.

Docs

  • CHANGELOG.md: poker under [Unreleased]; also back-filled the previously-undocumented turn-game framework work (#3308 personality-driven bot moves, seat-aware in-chat game context, personality-gated hand/plan secrecy) under its shipped release [2.1.0] (verified via tag ancestry). No version bump in this PR.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

What the author ran and verified:

  • pnpm check (shared + server + client build + lint) — exited 0 (including after merging current staging in to resolve a CHANGELOG.md conflict).
  • Local gitignored engine/runner suites (via tsx --test): poker hand-evaluator (21 cases incl. a 2000-hand brute-force fuzz), poker engine (21 cases incl. a chip-conservation invariant fuzz across 30+ full sessions), poker server runner (5 cases incl. a no-hidden-information-leak assertion and voiced/silent dealer drains). UNO/chess/framework regression suites all green, re-run after the staging merge.
  • Deployed the branch to a live server (Docker build via the host panel) and drove a full real-LLM game (human + 3 characters, one character as dealer): setup modal → board render → betting through preflop/flop/turn/river → showdown with correct reveals, hand labels, and payouts → next_hand. The dealer character announced each street in character with accurate facts; bots played in character; a UI fold fired the bot loop; a page reload rehydrated the board; the game survived a container restart mid-hand.
  • Edge cases exercised: empty states (a fold-around "walk" — pot awarded with no reveals, board resets to Pot 0) and error paths (illegal moves rejected by the engine with the legal set returned; oversized/negative bet inputs clamped client- and server-side). Zero server-log and console errors across the session.

Partial coverage (why the edge-cases box is left unticked): a dedicated light/dark theme toggle sweep and mobile-viewport pass of the poker board specifically was not performed by the author — the board reuses the same theme-token (var(--…)) and flex-wrap responsive patterns as the already-shipped UNO/chess boards, but this has not been independently re-verified for poker. A maintainer should tick that box after their own light/dark + mobile check.

To manually verify in a browser: enable the Poker command toggle in a conversation chat with 1+ characters, run /poker, pick a character dealer and stakes, and play a hand — check the action bar (fold/check/call/bet/raise/all-in), the showdown recap, Next hand, and dealer narration; also glance at light + dark theme and a mobile width.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

image

Summary by CodeRabbit

  • New Features

    • Added a new Poker game in conversation mode, with setup, playable table UI, betting controls, showdown recap, and multi-hand sessions.
    • Users can now start Poker from chat using a command or phrases like “let’s play poker.”
    • Added an option to choose between a silent dealer or a character-led dealer experience.
    • Poker now appears in the chat commands toggle list and setup flow.
  • Bug Fixes

    • Improved game-state handling so Poker sessions stay in sync during chat updates and resets.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/3408 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 7/9/2026 **Status:** ✅ Merged **Merged:** 7/9/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/turn-games-poker` --- ### 📝 Commits (9) - [`b1e4f02`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b1e4f02d916a905633a7d63739342c2644a3238f) feat(turn-games): add No-Limit Texas Hold'em poker engine - [`d351e0b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d351e0bcbea88c76c4623fb1b213e243cf902536) feat(turn-games): dealer announcements in the bot loop + [poker] command - [`e4d380b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e4d380bdb14f7a6de4ddd9836b82403567b26758) feat(turn-games): poker table board, setup modal, and client wiring - [`2cbc44c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2cbc44c446cd4ec1f069393661d3d8c89b03dad5) docs(changelog): poker entry + missed v2.1.2 turn-game framework notes - [`b538a67`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b538a67a2cab5b4670ad595e6fe907b9e337447b) fix(turn-games): don't manufacture a poker side pot from a folder's dead money - [`8339a37`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8339a375021604a07938490265b633a507e3699a) fix(turn-games): let the poker bet field accept partial typing - [`6ceb543`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6ceb5436df92d994561f69f1bca71708899bc8b6) docs(changelog): move the #3308 turn-game notes to their shipped release (2.1.0) - [`6d073a7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6d073a736898ca3d91781f50e529439289bfcd2b) Merge remote-tracking branch 'pasta/staging' into feat/turn-games-poker - [`6b6e011`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6b6e0116ab09e6cd4de7ef0435ab53225b05f5e4) fix(turn-games): address CodeRabbit review — debug-log dealer prompt, narrow bet-input reset ### 📊 Changes **29 files changed** (+3124 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+6 -0) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+5 -0) 📝 `packages/client/src/components/chat/ChatSetupWizard.tsx` (+1 -0) 📝 `packages/client/src/components/chat/ConversationInput.tsx` (+9 -2) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+10 -2) ➕ `packages/client/src/components/chat/PokerBoard.tsx` (+476 -0) ➕ `packages/client/src/components/chat/PokerSetup.tsx` (+228 -0) 📝 `packages/client/src/hooks/use-generate.ts` (+7 -0) ➕ `packages/client/src/hooks/use-poker.ts` (+146 -0) 📝 `packages/client/src/lib/slash-commands.ts` (+14 -0) ➕ `packages/client/src/stores/poker-game.store.ts` (+36 -0) 📝 `packages/server/src/routes/conversation-calls.routes.ts` (+2 -0) 📝 `packages/server/src/services/conversation/character-commands.ts` (+16 -0) 📝 `packages/server/src/services/generation/conversation-command-runtime.ts` (+14 -2) 📝 `packages/server/src/services/generation/turn-game-command-runtime.ts` (+71 -0) 📝 `packages/server/src/services/turn-games/turn-game-bot-runner.service.ts` (+223 -3) 📝 `packages/server/src/services/turn-games/turn-game-runner.service.ts` (+11 -0) 📝 `packages/shared/scripts/generate-feature-registries.mjs` (+1 -1) 📝 `packages/shared/src/features/turn-games/engine.types.ts` (+20 -0) ➕ `packages/shared/src/features/turn-games/poker/deck.ts` (+128 -0) _...and 9 more files_ </details> ### 📄 Description ## Linked issue Closes #3407 ## Why this change Conversation mode had two table games (UNO, chess) but no betting game — and poker is where character personality matters most: bluffing, needling, folding under pressure, and shoving all-in are in-character acts, not just game logic. This adds No-Limit Texas Hold'em as the third turn-game on the existing conversation-mode framework, giving group chats a reason to gather at a table where each character's temperament actually changes how they play. It also introduces a **selectable dealer** so a chosen character (or a silent house dealer) narrates the hand in their own voice while the engine deals fairly. ## What changed **Shared — deterministic poker engine (`packages/shared/src/features/turn-games/poker/`)** - Pure, server-authoritative No-Limit Hold'em engine: seeded fair dealing (each hand's deck is `deterministicShuffle(seed, handNumber)`, so message edits / regenerations rewind to identical deals), full no-limit betting with all-ins, incomplete-raise capping, the big-blind option, and layered side pots. - Hand-rolled 5-of-7 evaluator with natural-English showdown labels ("Full house, kings over nines"). - Multi-hand sessions: rotating dealer button, optional blind escalation, optional hand limit, and a human-paced `next_hand` step between hands. `hiddenInformation: true`, so the framework keeps each seat's hole cards private. - Two new **optional** methods on the `TurnGameEngine` contract — `announcerCharacterId` and `drainAnnouncements` — for the dealer-narration feature. UNO and chess implement neither and are entirely unaffected. **Server — dealer announcements + `[poker]` command** - The bot-turn runner drains engine-queued dealer announcements (hand start, street deals, showdown, blinds up, game over): a configured dealer character voices them as one short in-character line; a silent house dealer just advances state. Optional-method-guarded, so UNO/chess paths are unchanged. - New `[poker]` conversation command (advertise + dispatch, seats human + non-offline characters capped at 8) mirroring `[uno]`/`[chess]`. **Client — table board + setup** - `PokerBoard` (community cards, seat strip with button/blind/status badges, hole cards + live hand label, fold/check/call/bet-raise/all-in action bar, showdown recap with best-five highlighting, `Next hand` pacing) and `PokerSetup` (player picker, dealer dropdown — house or any character, stakes). - Wiring: poker store into both `turn_game_state_patch` handlers, `/poker`, the natural-language launcher, and the conversation command toggles. **Docs** - `CHANGELOG.md`: poker under `[Unreleased]`; also back-filled the previously-undocumented turn-game framework work (#3308 personality-driven bot moves, seat-aware in-chat game context, personality-gated hand/plan secrecy) under its shipped release **`[2.1.0]`** (verified via tag ancestry). No version bump in this PR. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes What the author ran and verified: - `pnpm check` (shared + server + client build + lint) — exited 0 (including after merging current `staging` in to resolve a `CHANGELOG.md` conflict). - Local gitignored engine/runner suites (via `tsx --test`): poker hand-evaluator (21 cases incl. a 2000-hand brute-force fuzz), poker engine (21 cases incl. a chip-conservation invariant fuzz across 30+ full sessions), poker server runner (5 cases incl. a no-hidden-information-leak assertion and voiced/silent dealer drains). UNO/chess/framework regression suites all green, re-run after the staging merge. - Deployed the branch to a live server (Docker build via the host panel) and drove a full real-LLM game (human + 3 characters, one character as dealer): setup modal → board render → betting through preflop/flop/turn/river → showdown with correct reveals, hand labels, and payouts → `next_hand`. The dealer character announced each street in character with accurate facts; bots played in character; a UI fold fired the bot loop; a page reload rehydrated the board; the game survived a container restart mid-hand. - Edge cases exercised: **empty states** (a fold-around "walk" — pot awarded with no reveals, board resets to Pot 0) and **error paths** (illegal moves rejected by the engine with the legal set returned; oversized/negative bet inputs clamped client- and server-side). Zero server-log and console errors across the session. Partial coverage (why the edge-cases box is left unticked): a dedicated **light/dark theme toggle sweep and mobile-viewport pass** of the poker board specifically was not performed by the author — the board reuses the same theme-token (`var(--…)`) and `flex-wrap` responsive patterns as the already-shipped UNO/chess boards, but this has not been independently re-verified for poker. A maintainer should tick that box after their own light/dark + mobile check. To manually verify in a browser: enable the **Poker** command toggle in a conversation chat with 1+ characters, run `/poker`, pick a character dealer and stakes, and play a hand — check the action bar (fold/check/call/bet/raise/all-in), the showdown recap, `Next hand`, and dealer narration; also glance at light + dark theme and a mobile width. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) <!-- Updated CHANGELOG.md: poker under [Unreleased]; also back-filled the previously-undocumented #3308 turn-game work to its shipped release [2.1.0] (verified by tag ancestry). No version bump in this PR. --> ## UI evidence (if applicable) <img width="1031" height="625" alt="image" src="https://github.com/user-attachments/assets/730fe975-cc9c-45ea-8c12-c816c25a5b84" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a new Poker game in conversation mode, with setup, playable table UI, betting controls, showdown recap, and multi-hand sessions. * Users can now start Poker from chat using a command or phrases like “let’s play poker.” * Added an option to choose between a silent dealer or a character-led dealer experience. * Poker now appears in the chat commands toggle list and setup flow. * **Bug Fixes** * Improved game-state handling so Poker sessions stay in sync during chat updates and resets. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:05:11 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5923
No description provided.