mud_server.api.routes.lab

Lab endpoints for the Axis Descriptor Lab research tool.

These endpoints expose the world’s OOC→IC translation pipeline directly via a JSON API, bypassing the game engine’s character DB lookup. They are intended exclusively for use by the Axis Descriptor Lab — a single-user research tool for testing IC prompt behaviour against deterministic axis payloads.

Auth

Session-based — same mechanism as all other server endpoints. Admin or superuser role is required. The lab logs in interactively via its UI; no credentials are stored anywhere on disk.

Endpoints

GET /api/lab/worlds

List all active worlds with a flag indicating whether the translation layer is enabled. Used to populate the lab’s world-selector dropdown.

GET /api/lab/world-config/{world_id}

Return the translation layer configuration for a specific world (model, active_axes, strict_mode, etc.). Used by the lab UI to reflect what the server will actually apply to a translation request.

GET /api/lab/world-image-policy-bundle/{world_id}

Return the DB-resolved image policy bundle (composition order, runtime input requirements, and manifest-derived reference metadata).

POST /api/lab/compile-image-prompt

Compile a deterministic image prompt from DB-resolved policy assets and runtime inputs (species, gender, axes, optional context signals).

POST /api/lab/translate

Translate an OOC message to IC dialogue using the world’s canonical pipeline. Accepts raw axis values — no character DB lookup is performed. Returns the IC text, outcome status, the server-formatted profile_summary, and the fully-rendered system prompt sent to Ollama.

Attributes

logger

Functions

router(engine)

Build and return the lab API router.

Module Contents

mud_server.api.routes.lab.logger
mud_server.api.routes.lab.router(engine)[source]

Build and return the lab API router.

Parameters:

engine (mud_server.core.engine.GameEngine) – The live GameEngine instance, used to access the world registry and translation services.

Returns:

Configured APIRouter with all lab endpoints registered.

Return type:

fastapi.APIRouter