Adapter contract
GameAdapterV1 exposes an immutable id, a version, boards, and validateAndDerive(payload, context). A successful result contains normalized evidence and derived board values. The service validates those results again before writing them.
An adapter must:
- Reject unknown or unbounded input.
- Regenerate authoritative state from stable rules and versioned seeds when the game requires determinism.
- Validate order, resource accounting, completion, time bounds, replay identity, and expiry.
- Return integers suitable for SQLite ordering.
- Keep all work pure and free of network access — adapters run inside the request path before the DB transaction commits.
Reference the adapter by id and version in games.json:
{ "kind": "file", "source": "my-game-v1.mjs" }The framework synthesizes a generic adapter for trivial games without code:
{ "kind": "generic", "boards": [{ "id": "high_score", "direction": "higher", "period": "all_time" }] }See Authoring — File adapters and Authoring — Generic boards for the full authoring guide.