mud_server.api.models_auth_game

Authentication and game-facing Pydantic models for the API layer.

Classes

LoginRequest

Login request with username and password.

RegisterRequest

Registration request for creating a new player account.

RegisterGuestRequest

Registration request for creating a temporary guest account.

SelectCharacterRequest

Request to select an active character for a session.

PlayerCreateCharacterRequest

Authenticated account request to self-provision a generated character.

ConditionAxisIdentityInputs

Identity inputs required by canonical condition-axis generation.

ConditionAxisEntityInputs

Entity-level inputs accepted by condition-axis generation.

ConditionAxisGenerateInputs

Runtime input wrapper for condition-axis generation requests.

ConditionAxisGenerateRequest

Canonical request for POST /api/pipeline/condition-axis/generate.

ConditionAxisProvenanceResponse

Provenance metadata for one condition-axis generation response.

ConditionAxisGenerateResponse

Canonical response for POST /api/pipeline/condition-axis/generate.

LoginDirectRequest

Direct login request that binds a session to a world + character.

ChangePasswordRequest

Request to change the current user's password.

LogoutRequest

Request to logout and end the current session.

CommandRequest

Request to execute a game command.

LoginResponse

Response to login request.

LoginDirectResponse

Response to direct login request.

SelectCharacterResponse

Response to character selection request.

CharactersResponse

Response containing the user's characters.

RegisterResponse

Response to registration request.

RegisterGuestResponse

Response to guest registration request.

CommandResponse

Response to game command execution.

StatusResponse

Response containing player's current game status.

Module Contents

class mud_server.api.models_auth_game.LoginRequest(/, **data)[source]

Bases: pydantic.BaseModel

Login request with username and password.

username

Account username (case-sensitive for database lookup)

password

Plain text password (will be verified against bcrypt hash)

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.

username: str
password: str
world_id: str | None = None
class mud_server.api.models_auth_game.RegisterRequest(/, **data)[source]

Bases: pydantic.BaseModel

Registration request for creating a new player account.

username

Desired username (2-20 characters, must be unique)

password

Desired password (minimum 8 characters)

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.

username: str
password: str
password_confirm: str
class mud_server.api.models_auth_game.RegisterGuestRequest(/, **data)[source]

Bases: pydantic.BaseModel

Registration request for creating a temporary guest account.

password

Desired password (validated against STANDARD policy)

password_confirm

Password confirmation (must match password)

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.

password: str
password_confirm: str
character_name: str
class mud_server.api.models_auth_game.SelectCharacterRequest(/, **data)[source]

Bases: pydantic.BaseModel

Request to select an active character for a session.

session_id

Active session ID for authentication

character_id

Character id to bind to the session

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.

session_id: str
character_id: int
world_id: str | None = None
class mud_server.api.models_auth_game.PlayerCreateCharacterRequest(/, **data)[source]

Bases: pydantic.BaseModel

Authenticated account request to self-provision a generated character.

session_id

Active account session id.

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.

session_id: str
world_id: str
class mud_server.api.models_auth_game.ConditionAxisIdentityInputs(/, **data)[source]

Bases: pydantic.BaseModel

Identity inputs required by canonical condition-axis generation.

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.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

gender: str
class mud_server.api.models_auth_game.ConditionAxisEntityInputs(/, **data)[source]

Bases: pydantic.BaseModel

Entity-level inputs accepted by condition-axis generation.

identity

Required identity metadata block.

species

Canonical species token.

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.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

identity: ConditionAxisIdentityInputs
species: str
axes: dict[str, Any] | None = None
class mud_server.api.models_auth_game.ConditionAxisGenerateInputs(/, **data)[source]

Bases: pydantic.BaseModel

Runtime input wrapper for condition-axis generation requests.

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.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

entity: ConditionAxisEntityInputs
class mud_server.api.models_auth_game.ConditionAxisGenerateRequest(/, **data)[source]

Bases: pydantic.BaseModel

Canonical request for POST /api/pipeline/condition-axis/generate.

world_id

Target canonical world identifier.

seed

Optional deterministic seed in 1..2147483647.

bundle_id

Optional policy-bundle override.

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.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

world_id: str
seed: int | None = None
bundle_id: str | None = None
inputs: ConditionAxisGenerateInputs
class mud_server.api.models_auth_game.ConditionAxisProvenanceResponse(/, **data)[source]

Bases: pydantic.BaseModel

Provenance metadata for one condition-axis generation response.

source

Canonical source/ownership identifier.

served_via

API path that served the generated payload.

generator

Upstream generator system name.

generator_version

Upstream version/capability identifier.

generator_capabilities

Ordered upstream capability tokens.

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.

source: str
served_via: str
generator: str
generator_version: str
generator_capabilities: list[str] = None
generated_at: str
class mud_server.api.models_auth_game.ConditionAxisGenerateResponse(/, **data)[source]

Bases: pydantic.BaseModel

Canonical response for POST /api/pipeline/condition-axis/generate.

world_id

Target world identifier.

bundle_id

Effective policy bundle id.

bundle_version

Effective policy bundle version.

policy_hash

Deterministic policy hash for reproducibility.

seed

Deterministic generation seed used upstream.

axes

Canonical axis map of axis_name -> score.

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.

world_id: str
bundle_id: str
bundle_version: str
policy_hash: str | None
seed: int
axes: dict[str, float]
provenance: ConditionAxisProvenanceResponse
class mud_server.api.models_auth_game.LoginDirectRequest(/, **data)[source]

Bases: pydantic.BaseModel

Direct login request that binds a session to a world + character.

username

Account username (case-sensitive for database lookup)

password

Plain text password (will be verified against bcrypt hash)

world_id

Target world id (must be accessible by the user)

character_name

Existing character name (optional)

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.

username: str
password: str
world_id: str
character_name: str | None = None
create_character: bool = False
class mud_server.api.models_auth_game.ChangePasswordRequest(/, **data)[source]

Bases: pydantic.BaseModel

Request to change the current user’s password.

session_id

Active session ID for authentication

old_password

Current password (verified before change)

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.

session_id: str
old_password: str
new_password: str
class mud_server.api.models_auth_game.LogoutRequest(/, **data)[source]

Bases: pydantic.BaseModel

Request to logout and end the current session.

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.

session_id: str
class mud_server.api.models_auth_game.CommandRequest(/, **data)[source]

Bases: 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.

session_id

Active session ID for authentication

command

Game command to execute, examples: - Movement: “north”, “n”, “south”, “s”, “east”, “e”, “west”, “w”, “up”, “u”, “down”, “d” - Actions: “look”, “inventory”, “get <item>”, “drop <item>” - Chat: “say <message>”, “yell <message>”, “whisper <player> <message>” - 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.

session_id: str
command: str
class mud_server.api.models_auth_game.LoginResponse(/, **data)[source]

Bases: pydantic.BaseModel

Response to login request.

success

True if login succeeded, False otherwise

message

Welcome message on success, error message on failure

session_id

(Optional) UUID session identifier on successful login

role

(Optional) User’s role on successful login (“player”, “worldbuilder”, “admin”, or “superuser”)

characters

List of available characters for selection

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.

success: bool
message: str
session_id: str | None = None
role: str | None = None
characters: list[dict[str, Any]] = None
available_worlds: list[dict[str, Any]] = None
class mud_server.api.models_auth_game.LoginDirectResponse(/, **data)[source]

Bases: pydantic.BaseModel

Response to direct login request.

success

True if login succeeded, False otherwise

message

Welcome message on success, error message on failure

session_id

Session identifier on successful login

role

User’s role on successful login

character_name

Selected character name on success

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.

success: bool
message: str
session_id: str | None = None
role: str | None = None
character_name: str | None = None
world_id: str | None = None
class mud_server.api.models_auth_game.SelectCharacterResponse(/, **data)[source]

Bases: pydantic.BaseModel

Response to character selection request.

success

True if character selected

message

Success or error message

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.

success: bool
message: str
character_name: str | None = None
class mud_server.api.models_auth_game.CharactersResponse(/, **data)[source]

Bases: pydantic.BaseModel

Response containing the user’s characters.

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.

characters: list[dict[str, Any]]
class mud_server.api.models_auth_game.RegisterResponse(/, **data)[source]

Bases: pydantic.BaseModel

Response to registration request.

success

True if account created, False otherwise

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.

success: bool
message: str
class mud_server.api.models_auth_game.RegisterGuestResponse(/, **data)[source]

Bases: pydantic.BaseModel

Response to guest registration request.

success

True if account created, False otherwise

message

Success confirmation or error details

username

Generated guest username for login

character_id

Created character id for the guest account

character_name

Created character name

world_id

Character world id

entity_state

Optional entity-state payload from the entity service

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.

success: bool
message: str
username: str | None = None
character_id: int | None = None
character_name: str | None = None
world_id: str | None = None
entity_state: dict[str, Any] | None = None
entity_state_error: str | None = None
class mud_server.api.models_auth_game.CommandResponse(/, **data)[source]

Bases: pydantic.BaseModel

Response to game command execution.

success

True if command executed successfully, False for errors

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.

success: bool
message: str
class mud_server.api.models_auth_game.StatusResponse(/, **data)[source]

Bases: pydantic.BaseModel

Response containing player’s current game status.

Used for periodic status updates to keep the UI synchronized.

active_players

List of usernames currently online

current_room

Player’s current room ID (e.g., “spawn”, “forest_1”)

inventory

Formatted inventory string (e.g., “Your inventory:n - Torchn - 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.

active_players: list[str]
current_room: str | None
inventory: str