exlab_wizard.api.routers.sessions#

/sessions router. Backend Spec §4.6.1, §4.6.2.

Endpoints:

  • POST /sessions – open a creation session (project or run).

  • GET /sessions/{id} – snapshot of session state.

  • POST /sessions/{id}/resume – supply extra_inputs after a PluginInputRequired prompt.

  • POST /sessions/{id}/cancel – abort the session, optionally discarding the partial directory.

  • WS /sessions/{id}/events – per-session event channel (§4.6.2 envelope types live in api/events.py).

The router consumes AppDependencies via request.app.state; in production the launcher constructs the dependencies, in tests the fixture passes a stub. Setup-state gating is applied via api.setup.setup_state_gate() on the routes that need a complete config.

Functions

build_sessions_router()

Construct the /sessions router.

Classes

SessionHandleResponse(**data)

Response shape for the create / status endpoints.

class exlab_wizard.api.routers.sessions.SessionHandleResponse(**data)[source]#

Bases: BaseModel

Response shape for the create / status endpoints.

Parameters:

data (Any)

current_phase: str | None#
error: dict[str, Any] | None#
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#

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

next_action: str#
pending_input: dict[str, Any] | None#
result: dict[str, Any] | None#
session_id: str#
state: str#
exlab_wizard.api.routers.sessions.build_sessions_router()[source]#

Construct the /sessions router.

Routes are gated by the setup-state dependency except where explicitly noted. WebSocket routes don’t accept dependencies in the standard FastAPI way, so the gate is applied inline.

Return type:

APIRouter