mud_server.api.models_auth_game =============================== .. py:module:: mud_server.api.models_auth_game .. autoapi-nested-parse:: Authentication and game-facing Pydantic models for the API layer. Classes ------- .. autoapisummary:: mud_server.api.models_auth_game.LoginRequest mud_server.api.models_auth_game.RegisterRequest mud_server.api.models_auth_game.RegisterGuestRequest mud_server.api.models_auth_game.SelectCharacterRequest mud_server.api.models_auth_game.PlayerCreateCharacterRequest mud_server.api.models_auth_game.ConditionAxisIdentityInputs mud_server.api.models_auth_game.ConditionAxisEntityInputs mud_server.api.models_auth_game.ConditionAxisGenerateInputs mud_server.api.models_auth_game.ConditionAxisGenerateRequest mud_server.api.models_auth_game.ConditionAxisProvenanceResponse mud_server.api.models_auth_game.ConditionAxisGenerateResponse mud_server.api.models_auth_game.LoginDirectRequest mud_server.api.models_auth_game.ChangePasswordRequest mud_server.api.models_auth_game.LogoutRequest mud_server.api.models_auth_game.CommandRequest mud_server.api.models_auth_game.LoginResponse mud_server.api.models_auth_game.LoginDirectResponse mud_server.api.models_auth_game.SelectCharacterResponse mud_server.api.models_auth_game.CharactersResponse mud_server.api.models_auth_game.RegisterResponse mud_server.api.models_auth_game.RegisterGuestResponse mud_server.api.models_auth_game.CommandResponse mud_server.api.models_auth_game.StatusResponse Module Contents --------------- .. py:class:: LoginRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Login request with username and password. .. attribute:: username Account username (case-sensitive for database lookup) .. attribute:: password Plain text password (will be verified against bcrypt hash) .. attribute:: world_id Optional world id used to filter characters on login Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: username :type: str .. py:attribute:: password :type: str .. py:attribute:: world_id :type: str | None :value: None .. py:class:: RegisterRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Registration request for creating a new player account. .. attribute:: username Desired username (2-20 characters, must be unique) .. attribute:: password Desired password (minimum 8 characters) .. attribute:: password_confirm Password confirmation (must match password) Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: username :type: str .. py:attribute:: password :type: str .. py:attribute:: password_confirm :type: str .. py:class:: RegisterGuestRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Registration request for creating a temporary guest account. .. attribute:: password Desired password (validated against STANDARD policy) .. attribute:: password_confirm Password confirmation (must match password) .. attribute:: character_name Initial character name for the guest account Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: password :type: str .. py:attribute:: password_confirm :type: str .. py:attribute:: character_name :type: str .. py:class:: SelectCharacterRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request to select an active character for a session. .. attribute:: session_id Active session ID for authentication .. attribute:: character_id Character id to bind to the session .. attribute:: world_id World id to bind to the session (must match character's world) Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: session_id :type: str .. py:attribute:: character_id :type: int .. py:attribute:: world_id :type: str | None :value: None .. py:class:: PlayerCreateCharacterRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Authenticated account request to self-provision a generated character. .. attribute:: session_id Active account session id. .. attribute:: world_id Target world id for character creation. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: session_id :type: str .. py:attribute:: world_id :type: str .. py:class:: ConditionAxisIdentityInputs(/, **data) Bases: :py:obj:`pydantic.BaseModel` Identity inputs required by canonical condition-axis generation. .. attribute:: gender Canonical gender token used by policy/runtime selection. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: gender :type: str .. py:class:: ConditionAxisEntityInputs(/, **data) Bases: :py:obj:`pydantic.BaseModel` Entity-level inputs accepted by condition-axis generation. .. attribute:: identity Required identity metadata block. .. attribute:: species Canonical species token. .. attribute:: axes Optional pre-resolved axis payload for future parity flows. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: identity :type: ConditionAxisIdentityInputs .. py:attribute:: species :type: str .. py:attribute:: axes :type: dict[str, Any] | None :value: None .. py:class:: ConditionAxisGenerateInputs(/, **data) Bases: :py:obj:`pydantic.BaseModel` Runtime input wrapper for condition-axis generation requests. .. attribute:: entity Runtime entity input block consumed by strict validation. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: entity :type: ConditionAxisEntityInputs .. py:class:: ConditionAxisGenerateRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Canonical request for ``POST /api/pipeline/condition-axis/generate``. .. attribute:: world_id Target canonical world identifier. .. attribute:: seed Optional deterministic seed in ``1..2147483647``. .. attribute:: bundle_id Optional policy-bundle override. .. attribute:: inputs Runtime input payload validated against strict schema. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: world_id :type: str .. py:attribute:: seed :type: int | None :value: None .. py:attribute:: bundle_id :type: str | None :value: None .. py:attribute:: inputs :type: ConditionAxisGenerateInputs .. py:class:: ConditionAxisProvenanceResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Provenance metadata for one condition-axis generation response. .. attribute:: source Canonical source/ownership identifier. .. attribute:: served_via API path that served the generated payload. .. attribute:: generator Upstream generator system name. .. attribute:: generator_version Upstream version/capability identifier. .. attribute:: generator_capabilities Ordered upstream capability tokens. .. attribute:: generated_at Generation completion timestamp (ISO-8601). Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: source :type: str .. py:attribute:: served_via :type: str .. py:attribute:: generator :type: str .. py:attribute:: generator_version :type: str .. py:attribute:: generator_capabilities :type: list[str] :value: None .. py:attribute:: generated_at :type: str .. py:class:: ConditionAxisGenerateResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Canonical response for ``POST /api/pipeline/condition-axis/generate``. .. attribute:: world_id Target world identifier. .. attribute:: bundle_id Effective policy bundle id. .. attribute:: bundle_version Effective policy bundle version. .. attribute:: policy_hash Deterministic policy hash for reproducibility. .. attribute:: seed Deterministic generation seed used upstream. .. attribute:: axes Canonical axis map of ``axis_name -> score``. .. attribute:: provenance Canonical provenance block. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str .. py:attribute:: bundle_id :type: str .. py:attribute:: bundle_version :type: str .. py:attribute:: policy_hash :type: str | None .. py:attribute:: seed :type: int .. py:attribute:: axes :type: dict[str, float] .. py:attribute:: provenance :type: ConditionAxisProvenanceResponse .. py:class:: LoginDirectRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Direct login request that binds a session to a world + character. .. attribute:: username Account username (case-sensitive for database lookup) .. attribute:: password Plain text password (will be verified against bcrypt hash) .. attribute:: world_id Target world id (must be accessible by the user) .. attribute:: character_name Existing character name (optional) .. attribute:: create_character When true, create the character if missing Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: username :type: str .. py:attribute:: password :type: str .. py:attribute:: world_id :type: str .. py:attribute:: character_name :type: str | None :value: None .. py:attribute:: create_character :type: bool :value: False .. py:class:: ChangePasswordRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request to change the current user's password. .. attribute:: session_id Active session ID for authentication .. attribute:: old_password Current password (verified before change) .. attribute:: new_password New password (minimum 8 characters, must differ from old) Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: session_id :type: str .. py:attribute:: old_password :type: str .. py:attribute:: new_password :type: str .. py:class:: LogoutRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request to logout and end the current session. .. attribute:: session_id Active session ID to be terminated Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: session_id :type: str .. py:class:: CommandRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request to execute a game command. Supports all game commands including movement, inventory management, chat, and special commands. Commands can be prefixed with "/" or not. .. attribute:: session_id Active session ID for authentication .. attribute:: command Game command to execute, examples: - Movement: "north", "n", "south", "s", "east", "e", "west", "w", "up", "u", "down", "d" - Actions: "look", "inventory", "get ", "drop " - Chat: "say ", "yell ", "whisper " - Info: "who", "help" Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: session_id :type: str .. py:attribute:: command :type: str .. py:class:: LoginResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response to login request. .. attribute:: success True if login succeeded, False otherwise .. attribute:: message Welcome message on success, error message on failure .. attribute:: session_id (Optional) UUID session identifier on successful login .. attribute:: role (Optional) User's role on successful login ("player", "worldbuilder", "admin", or "superuser") .. attribute:: characters List of available characters for selection .. attribute:: available_worlds List of available worlds for selection Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: success :type: bool .. py:attribute:: message :type: str .. py:attribute:: session_id :type: str | None :value: None .. py:attribute:: role :type: str | None :value: None .. py:attribute:: characters :type: list[dict[str, Any]] :value: None .. py:attribute:: available_worlds :type: list[dict[str, Any]] :value: None .. py:class:: LoginDirectResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response to direct login request. .. attribute:: success True if login succeeded, False otherwise .. attribute:: message Welcome message on success, error message on failure .. attribute:: session_id Session identifier on successful login .. attribute:: role User's role on successful login .. attribute:: character_name Selected character name on success .. attribute:: world_id World bound to the session Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: success :type: bool .. py:attribute:: message :type: str .. py:attribute:: session_id :type: str | None :value: None .. py:attribute:: role :type: str | None :value: None .. py:attribute:: character_name :type: str | None :value: None .. py:attribute:: world_id :type: str | None :value: None .. py:class:: SelectCharacterResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response to character selection request. .. attribute:: success True if character selected .. attribute:: message Success or error message .. attribute:: character_name Selected character name on success Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: success :type: bool .. py:attribute:: message :type: str .. py:attribute:: character_name :type: str | None :value: None .. py:class:: CharactersResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response containing the user's characters. .. attribute:: characters List of character summaries Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: characters :type: list[dict[str, Any]] .. py:class:: RegisterResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response to registration request. .. attribute:: success True if account created, False otherwise .. attribute:: message Success confirmation or error details Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: success :type: bool .. py:attribute:: message :type: str .. py:class:: RegisterGuestResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response to guest registration request. .. attribute:: success True if account created, False otherwise .. attribute:: message Success confirmation or error details .. attribute:: username Generated guest username for login .. attribute:: character_id Created character id for the guest account .. attribute:: character_name Created character name .. attribute:: world_id Character world id .. attribute:: entity_state Optional entity-state payload from the entity service .. attribute:: entity_state_error Optional entity-state integration error message Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: success :type: bool .. py:attribute:: message :type: str .. py:attribute:: username :type: str | None :value: None .. py:attribute:: character_id :type: int | None :value: None .. py:attribute:: character_name :type: str | None :value: None .. py:attribute:: world_id :type: str | None :value: None .. py:attribute:: entity_state :type: dict[str, Any] | None :value: None .. py:attribute:: entity_state_error :type: str | None :value: None .. py:class:: CommandResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response to game command execution. .. attribute:: success True if command executed successfully, False for errors .. attribute:: message Command result, room description, error message, etc. For movement: includes new room description For inventory: lists items in inventory For chat: confirmation message For errors: explanation of what went wrong Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: success :type: bool .. py:attribute:: message :type: str .. py:class:: StatusResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response containing player's current game status. Used for periodic status updates to keep the UI synchronized. .. attribute:: active_players List of usernames currently online .. attribute:: current_room Player's current room ID (e.g., "spawn", "forest_1") .. attribute:: inventory Formatted inventory string (e.g., "Your inventory:\n - Torch\n - Rope") Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: active_players :type: list[str] .. py:attribute:: current_room :type: str | None .. py:attribute:: inventory :type: str