@game-hub/kernel
v1.4.0
Published
The Game Hub kernel: the tiny set of primitives every game and both hosts share — GameError, MoveRecord, Viewer, record(), makeSeating, the end-state union, runBotLoop, and the GameModule/GameClient contracts. Its major version IS the host↔game contract v
Maintainers
Readme
@game-hub/kernel
The tiny shared core of Game Hub, a self-hosted board-game platform: the primitives every game package and both hosts (backend + UI shell) build against, and nothing else.
What's in it
.—GameError,MoveRecord,Viewer,record(),makeSeating,GameEndState, theGameModule/ModuleContextcontract (with structural host interfaces, so the kernel imports no host),KERNEL_CONTRACT_VERSION, and the seeded-setup helpersshuffle(items, rng?)/mulberry32(seed)(1.2.0 — an engine and its tests need these, so they are not on./bot)../bot—runBotLoopand the bot-driver helpers, written entirely against the generic contract surface../client— theGameClient/BoardPropscontract the UI shell loads a game's board through, plus the transport DTOs a client names (GamePayload,GameIdentity,GameMessage). Type-only React usage; React is not a runtime dependency.
The shared chrome a board renders inside (turn banner, activity feed, end screen, buttons) is a
separate package, @game-hub/ui-kit — it needs React
at runtime, which this package deliberately never does.
The contract version
The package's major version is the kernel contract version. A game module declares
kernelContract (import KERNEL_CONTRACT_VERSION, never a literal); a host refuses to register a
game built against a different contract. Additive optional hooks are minor bumps; any change to a
required member's meaning is a major.
Writing a game
A game is one npm package with four subpath exports — ./engine (pure rules), ./module (backend
seam), ./client (UI seam), ./bot (optional AI) — peer-depending on this kernel. The full recipe,
seam rules, and conformance expectations live in the platform repo's docs/game-creation.md and
docs/design-patterns.md.
Game engines built on this kernel are pure: no Date, no Math.random, no mutation — randomness
is injected at setup and per action, so every game is deterministic and replayable.
