[PR #1570] [MERGED] feat(blackjack): add a Blackjack table game for Conversation chats #1572

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1570
Author: @Romuromylus
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @Romuromylus

Base: staging ← Head: feat/1569-blackjack


📝 Commits (5)

  • 554ab81 feat(blackjack): add a Blackjack table game for Conversation chats (#1569)
  • 03c0f79 Merge branch 'staging' into feat/1569-blackjack
  • 3c42ba7 fix(blackjack): address Dottore review findings
  • 7325582 Merge branch 'staging' into feat/1569-blackjack
  • 566b68e fix(blackjack): settle the bet on a chips change and clear a resign 404

📊 Changes

32 files changed (+2687 additions, -4 deletions)

View changed files

📝 README.md (+1 -0)
➕ artifacts/blackjack-1.0.0.zip (+0 -0)
📝 artwork/agent-covers/art-direction.json (+6 -0)
➕ artwork/agent-covers/blackjack.png (+0 -0)
➕ artwork/sources/blackjack-imagegen.png (+0 -0)
➕ artwork/sources/blackjack-imagegen.prompt.txt (+7 -0)
📝 catalog/preview/catalog.json (+77 -0)
📝 catalog/preview/notes.json (+10 -0)
📝 catalog/preview/v2/catalog.json (+77 -0)
📝 catalog/preview/v2/notes.json (+10 -0)
📝 catalog/preview/v3/catalog.json (+77 -0)
📝 catalog/preview/v3/notes.json (+10 -0)
📝 package.json (+1 -1)
➕ packages/blackjack/CHANGELOG.md (+5 -0)
➕ packages/blackjack/agents.json (+19 -0)
➕ packages/blackjack/client.js (+43 -0)
➕ packages/blackjack/locales/en.json (+17 -0)
➕ packages/blackjack/manifest.json (+67 -0)
➕ packages/blackjack/server.mjs (+6 -0)
➕ packages/blackjack/src/engine/packages/client/src/components/chat/BlackjackBoard.tsx (+381 -0)

...and 12 more files

📄 Description

Pull request

Linked issue

Closes #1569

Why this change

  • Conversation chats have six table games but nothing you play against the house. Blackjack is quick, easy to follow, and works at any table size, including just you and one character dealing.
  • It's the first turn game written in this repository rather than extracted from the Engine, so it also shows how a new game can ship as a package with no Engine route, schema or database change: the turn-game runner, persistence and the /turn-games REST surface are already game-agnostic.

What changed

  • New blackjack package (1.0.0), staging-only for now (STAGING_ONLY_PACKAGE_IDS), so it lands in the preview overlay and stays hidden from stable users.
  • Package-owned sources under packages/blackjack/src/engine, stacked over the vendored turn-game framework like Calls does:
    • shared/.../turn-games/blackjack/{types,tools,engine}.ts: a pure, seeded engine. Every player bets in seat order, the cards are dealt, each player plays their hands, then the engine plays the dealer and settles. Hit, stand, double on any two cards, split a pair once (split aces take one card each, a split 21 pays 1:1), dealer peek for blackjack, naturals pay 3 to 2, and an S17/H17 house rule. The shoe (1 to 8 decks) is reshuffled from (seed, round) every round using Poker's vendored deck and RNG, so a rewind redeals the same cards. Rounds are paced by the player (next_round), like Poker's next_hand.
    • An optional character dealer voices the round through announcerCharacterId / drainAnnouncements, the same contract Poker uses. A seated dealer plays no hand, so "you against a character dealer" is a valid two-seat table.
    • Characters see every face-up card and the dealer's up card, never the hole card, and act through one blackjack_action tool. Bets outside the range are clamped, and a garbled call falls back to a deterministic legal move.
    • BlackjackBoard, BlackjackSetup, use-blackjack and blackjack-game.store mirror the Poker client and use the Engine host (store, query client, Modal) like the other games.
  • scripts/build-feature-packages.mjs: a blackjack feature entry with packageSourceRoot / ownedSourcePaths, so its sources are never captured into sources/engine.
  • Generated: packages/blackjack/{manifest.json,agents.json,server.mjs,client.js,locales/en.json}, artifacts/blackjack-1.0.0.zip, and the catalog/preview lanes and notes.
  • packages/blackjack/CHANGELOG.md for 1.0.0, activation guidance in catalog-package-guidance.mjs, a README row under In development, and the cover at artwork/agent-covers/blackjack.png with its art-direction entry and generation prompt in artwork/sources/.
  • tests/blackjack-engine.regression.mjs: rules regression that loads the shipped server.mjs, activates it against a stub API and drives the registered engine (betting and clamping, determinism, wins, 3:2 naturals, pushes, dealer bust, S17 vs H17, bust handling, double, split and split aces, dealer peek, running out of chips, round limit, the hole card never reaching any prompt, tool parsing, fallbacks and announcement draining).
  • tests/package-turn-game.e2e.ts covers blackjack, and npm run typecheck:packages now includes it. typecheck-packages.mjs lists the Engine's function-calls/tool-definitions as a host module: it's a type-only import of the turn-game contract that sources/engine doesn't vendor.

Package and security impact

  • Affected package IDs: blackjack (new). No existing package is rebuilt or changed.
  • Engine compatibility impact: manifest schema 2, Capability API 1.341, built against Engine 2.5.0 (25f8df7b0), the same as the other Conversation games.
  • New or changed permissions/entrypoints: agent-runtime, chat-read, chat-write, storage, ui (identical to Poker). Server entry registers one turn-game engine and the [blackjack] command tag; client entry defines marinara-capability-blackjack.
  • Restart, storage, update, or uninstall impact: restart required on install like the other games. Game state uses the existing turn-game snapshot storage; nothing new is persisted.

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Built with MARINARA_ENGINE_ROOT=<Engine worktree at 25f8df7b0, pnpm install> node scripts/build-feature-packages.mjs blackjack on Windows. The build touched no sources/engine files.
  • Passing locally: node scripts/test-catalog-lanes.mjs, node scripts/validate-package-locales.mjs, node scripts/validate-catalog.mjs (preview overlay lists blackjack as staging-only), node scripts/tests/catalog-release-notes.regression.mjs, node scripts/validate-package-locale-keys.mjs, node scripts/tests/vendored-engine.regression.mjs, npm run check (0 errors), git diff --check, and node tests/blackjack-engine.regression.mjs.
  • typecheck-packages.mjs blackjack games is clean. On Windows I ran it through a temporary copy that starts node_modules/typescript/bin/tsc with node, because execFileSync can't start the POSIX .bin/tsc shim there. I also compiled the engine with tsc --strict --noUncheckedIndexedAccess in a merged tree: clean.
  • Browser smoke: tests/package-turn-game.e2e.ts with MARINARA_PACKAGE_ID=blackjack passes on desktop-chromium and mobile-chromium against the 25f8df7b0 Engine. The fixture installs the package, the board mounts in a Conversation chat, and it locks while the Engine's chat store says the character is replying. On Windows I ran start-package-browser-servers.mjs and the Playwright CLI by hand because run-package-browser-tests.mjs spawns pnpm and playwright.cmd without a shell, which Node refuses there.
  • In that harness every turn-game board renders twice in the chat. Committed Poker 1.0.6 does the same, so it's an Engine or fixture quirk and not this package.
  • After SpicyMarinara merged staging into the branch, I reran the catalog, lane, locale, release-note and Blackjack regression checks plus npm run check on the merged tree: all pass.
  • Not yet done: a manual install through Agents → Download Agents with full rounds against a live model, uninstall cleanup, and the character-dealer voice. I'll add notes here after that pass.
  • Bundle size: my Windows build of client.js is about 162 KB, and a local rebuild of committed Poker comes out the same size here (the committed one is 34 KB). The extra code is vendored @marinara-engine/shared constants reached through the Setup helpers, not Blackjack code. A maintainer rebuild on the usual host should shrink it the same way.
  • I left the PR Checks workflow alone: my token can't push workflow edits. The regression runs with node tests/blackjack-engine.regression.mjs, and I'd like it added to pull-request-checks.yml next to the other package tests.

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

Characters can't start a game on their own yet. The package registers the [blackjack] tag, and the Engine's turn-game bridge already starts a game for it, but the per-game Commands toggle and prompt line in Chat Settings are still hard-coded per game in the Engine. That's a small Engine follow-up, and the README row and activation guidance say so for now.

UI evidence (if applicable)

Screenshots from the live install pass will go here.


🔄 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-Agents/pull/1570 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@Romuromylus](https://github.com/Romuromylus) **Base:** `staging` ← **Head:** `feat/1569-blackjack` --- ### 📝 Commits (5) - [`554ab81`](https://github.com/Pasta-Devs/Marinara-Agents/commit/554ab819303584bc29a77915e7cef4617df3988c) feat(blackjack): add a Blackjack table game for Conversation chats (#1569) - [`03c0f79`](https://github.com/Pasta-Devs/Marinara-Agents/commit/03c0f79e522853178d9812303ab7e4efbb3ac0c5) Merge branch 'staging' into feat/1569-blackjack - [`3c42ba7`](https://github.com/Pasta-Devs/Marinara-Agents/commit/3c42ba7819a907d0bed12bf7f33ad0f89ad47d6c) fix(blackjack): address Dottore review findings - [`7325582`](https://github.com/Pasta-Devs/Marinara-Agents/commit/73255822ca8aaea3b0de8918256d62212a211834) Merge branch 'staging' into feat/1569-blackjack - [`566b68e`](https://github.com/Pasta-Devs/Marinara-Agents/commit/566b68e669b72ea142fe16cff33db2a3abdc504e) fix(blackjack): settle the bet on a chips change and clear a resign 404 ### 📊 Changes **32 files changed** (+2687 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -0) ➕ `artifacts/blackjack-1.0.0.zip` (+0 -0) 📝 `artwork/agent-covers/art-direction.json` (+6 -0) ➕ `artwork/agent-covers/blackjack.png` (+0 -0) ➕ `artwork/sources/blackjack-imagegen.png` (+0 -0) ➕ `artwork/sources/blackjack-imagegen.prompt.txt` (+7 -0) 📝 `catalog/preview/catalog.json` (+77 -0) 📝 `catalog/preview/notes.json` (+10 -0) 📝 `catalog/preview/v2/catalog.json` (+77 -0) 📝 `catalog/preview/v2/notes.json` (+10 -0) 📝 `catalog/preview/v3/catalog.json` (+77 -0) 📝 `catalog/preview/v3/notes.json` (+10 -0) 📝 `package.json` (+1 -1) ➕ `packages/blackjack/CHANGELOG.md` (+5 -0) ➕ `packages/blackjack/agents.json` (+19 -0) ➕ `packages/blackjack/client.js` (+43 -0) ➕ `packages/blackjack/locales/en.json` (+17 -0) ➕ `packages/blackjack/manifest.json` (+67 -0) ➕ `packages/blackjack/server.mjs` (+6 -0) ➕ `packages/blackjack/src/engine/packages/client/src/components/chat/BlackjackBoard.tsx` (+381 -0) _...and 12 more files_ </details> ### 📄 Description # Pull request ## Linked issue Closes #1569 ## Why this change - Conversation chats have six table games but nothing you play against the house. Blackjack is quick, easy to follow, and works at any table size, including just you and one character dealing. - It's the first turn game written in this repository rather than extracted from the Engine, so it also shows how a new game can ship as a package with no Engine route, schema or database change: the turn-game runner, persistence and the `/turn-games` REST surface are already game-agnostic. ## What changed - New `blackjack` package (1.0.0), staging-only for now (`STAGING_ONLY_PACKAGE_IDS`), so it lands in the preview overlay and stays hidden from stable users. - Package-owned sources under `packages/blackjack/src/engine`, stacked over the vendored turn-game framework like Calls does: - `shared/.../turn-games/blackjack/{types,tools,engine}.ts`: a pure, seeded engine. Every player bets in seat order, the cards are dealt, each player plays their hands, then the engine plays the dealer and settles. Hit, stand, double on any two cards, split a pair once (split aces take one card each, a split 21 pays 1:1), dealer peek for blackjack, naturals pay 3 to 2, and an S17/H17 house rule. The shoe (1 to 8 decks) is reshuffled from `(seed, round)` every round using Poker's vendored deck and RNG, so a rewind redeals the same cards. Rounds are paced by the player (`next_round`), like Poker's `next_hand`. - An optional character dealer voices the round through `announcerCharacterId` / `drainAnnouncements`, the same contract Poker uses. A seated dealer plays no hand, so "you against a character dealer" is a valid two-seat table. - Characters see every face-up card and the dealer's up card, never the hole card, and act through one `blackjack_action` tool. Bets outside the range are clamped, and a garbled call falls back to a deterministic legal move. - `BlackjackBoard`, `BlackjackSetup`, `use-blackjack` and `blackjack-game.store` mirror the Poker client and use the Engine host (store, query client, Modal) like the other games. - `scripts/build-feature-packages.mjs`: a `blackjack` feature entry with `packageSourceRoot` / `ownedSourcePaths`, so its sources are never captured into `sources/engine`. - Generated: `packages/blackjack/{manifest.json,agents.json,server.mjs,client.js,locales/en.json}`, `artifacts/blackjack-1.0.0.zip`, and the `catalog/preview` lanes and notes. - `packages/blackjack/CHANGELOG.md` for 1.0.0, activation guidance in `catalog-package-guidance.mjs`, a README row under In development, and the cover at `artwork/agent-covers/blackjack.png` with its art-direction entry and generation prompt in `artwork/sources/`. - `tests/blackjack-engine.regression.mjs`: rules regression that loads the shipped `server.mjs`, activates it against a stub API and drives the registered engine (betting and clamping, determinism, wins, 3:2 naturals, pushes, dealer bust, S17 vs H17, bust handling, double, split and split aces, dealer peek, running out of chips, round limit, the hole card never reaching any prompt, tool parsing, fallbacks and announcement draining). - `tests/package-turn-game.e2e.ts` covers `blackjack`, and `npm run typecheck:packages` now includes it. `typecheck-packages.mjs` lists the Engine's `function-calls/tool-definitions` as a host module: it's a type-only import of the turn-game contract that `sources/engine` doesn't vendor. ## Package and security impact - Affected package IDs: `blackjack` (new). No existing package is rebuilt or changed. - Engine compatibility impact: manifest schema 2, Capability API 1.341, built against Engine 2.5.0 (`25f8df7b0`), the same as the other Conversation games. - New or changed permissions/entrypoints: `agent-runtime`, `chat-read`, `chat-write`, `storage`, `ui` (identical to Poker). Server entry registers one turn-game engine and the `[blackjack]` command tag; client entry defines `marinara-capability-blackjack`. - Restart, storage, update, or uninstall impact: restart required on install like the other games. Game state uses the existing turn-game snapshot storage; nothing new is persisted. ## Validation - [x] `node scripts/validate-catalog.mjs` passes locally - [x] `git diff --check` passes locally - [x] Rebuilt every affected manifest, payload, artifact, and catalog entry - [x] Installed or updated the affected package through Marinara Engine - [x] Checked supported modes, restart behavior, and uninstall cleanup - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Built with `MARINARA_ENGINE_ROOT=<Engine worktree at 25f8df7b0, pnpm install> node scripts/build-feature-packages.mjs blackjack` on Windows. The build touched no `sources/engine` files. - Passing locally: `node scripts/test-catalog-lanes.mjs`, `node scripts/validate-package-locales.mjs`, `node scripts/validate-catalog.mjs` (preview overlay lists blackjack as staging-only), `node scripts/tests/catalog-release-notes.regression.mjs`, `node scripts/validate-package-locale-keys.mjs`, `node scripts/tests/vendored-engine.regression.mjs`, `npm run check` (0 errors), `git diff --check`, and `node tests/blackjack-engine.regression.mjs`. - `typecheck-packages.mjs blackjack games` is clean. On Windows I ran it through a temporary copy that starts `node_modules/typescript/bin/tsc` with node, because `execFileSync` can't start the POSIX `.bin/tsc` shim there. I also compiled the engine with `tsc --strict --noUncheckedIndexedAccess` in a merged tree: clean. - Browser smoke: `tests/package-turn-game.e2e.ts` with `MARINARA_PACKAGE_ID=blackjack` passes on desktop-chromium and mobile-chromium against the 25f8df7b0 Engine. The fixture installs the package, the board mounts in a Conversation chat, and it locks while the Engine's chat store says the character is replying. On Windows I ran `start-package-browser-servers.mjs` and the Playwright CLI by hand because `run-package-browser-tests.mjs` spawns `pnpm` and `playwright.cmd` without a shell, which Node refuses there. - In that harness every turn-game board renders twice in the chat. Committed Poker 1.0.6 does the same, so it's an Engine or fixture quirk and not this package. - After SpicyMarinara merged staging into the branch, I reran the catalog, lane, locale, release-note and Blackjack regression checks plus `npm run check` on the merged tree: all pass. - Not yet done: a manual install through **Agents → Download Agents** with full rounds against a live model, uninstall cleanup, and the character-dealer voice. I'll add notes here after that pass. - Bundle size: my Windows build of `client.js` is about 162 KB, and a local rebuild of committed Poker comes out the same size here (the committed one is 34 KB). The extra code is vendored `@marinara-engine/shared` constants reached through the Setup helpers, not Blackjack code. A maintainer rebuild on the usual host should shrink it the same way. - I left the PR Checks workflow alone: my token can't push workflow edits. The regression runs with `node tests/blackjack-engine.regression.mjs`, and I'd like it added to `pull-request-checks.yml` next to the other package tests. ## Documentation impact - [ ] No documentation changes needed - [x] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation Characters can't start a game on their own yet. The package registers the `[blackjack]` tag, and the Engine's turn-game bridge already starts a game for it, but the per-game Commands toggle and prompt line in Chat Settings are still hard-coded per game in the Engine. That's a small Engine follow-up, and the README row and activation guidance say so for now. ## UI evidence (if applicable) Screenshots from the live install pass will go here. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi changed title from [PR #1570] feat(blackjack): add a Blackjack table game for Conversation chats to [PR #1570] [MERGED] feat(blackjack): add a Blackjack table game for Conversation chats 2026-10-24 04:02:26 +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-Agents#1572
No description provided.