yera.ui.fastapi_routes.streaming
Stream rendered session events and accept correlated user input.
Symbols
register_streaming_routes
register_streaming_routes(
app: FastAPI,
resolve_session: ResolveSession,
launch_runtime: LaunchRuntime,
sse_stream: SSEStream,
validate_request: ValidateRequest,
session_store: BaseSessionStore,
) → NoneRegister the SSE stream and HTMX input-submission routes.
GET /sessions/{session_id}/stream resolves the runtime, launches it when
appropriate, and returns an unbuffered event stream. The server callback
decides whether the stream reads live fragments or replays persisted
output.
POST /sessions/{session_id}/input canonicalizes the submitted JSON,
constructs typed input data, and delegates correlation and schema
validation to the server. Accepted input is persisted before it is pushed
to the app. Secret form fields are redacted by the session runtime for the
stored copy while the original event reaches the app.
Invalid serialization and typed payloads return a composer error with 422.
Stale or mismatched requests are returned by validate_request without
replacing the active composer. Successful submissions replace the composer
with its idle state and reconnect the session listener.
Parameters
FastAPI application receiving the routes.
Callback that resolves persisted identity to its in-process runtime.
Callback that starts an eligible runtime and reports whether this request launched it.
Callback that produces framed live or replay output.
Callback that checks request correlation, input type, cancellation, and payload schema.
Store that records accepted input and lifecycle state.