case0 / src /case_zero /api /dto.py
HusseinEid's picture
Case Zero - initial public release (fully local: Qwen2.5-1.5B via llama.cpp + Supertonic, custom pixel-noir SPA via gradio.Server)
414dc55
"""Wire DTOs for the public game API.
These are the exact shapes the Preact client exchanges with the server. The client
speaks camelCase; pydantic aliases map that to snake_case internally. The sealed
``CaseFile``/``Solution`` never appears here - only the public ``PlayerCaseView``
projection is ever returned before the verdict.
"""
from __future__ import annotations
from pydantic import BaseModel, ConfigDict, Field
from .public_view import PublicCase
class _CamelModel(BaseModel):
"""Base: accept snake_case or camelCase on input, emit camelCase on output."""
model_config = ConfigDict(populate_by_name=True)
class NewCaseRequest(_CamelModel):
seed: int | None = None
case_id: str | None = Field(default=None, alias="caseId")
difficulty: str | None = None
class CaseResponse(_CamelModel):
case_id: str = Field(alias="caseId")
run_id: str = Field(alias="runId")
case: PublicCase