yera.ui.session_runtime
Track the live execution and pending input state of one browser session.
A server runtime joins an app executor, its event stream, the browser fragment publisher, and the router task that connects them. It also owns the single pending input contract used to correlate and validate browser submissions before they reach the app.
Symbols
ServerRuntime
Hold the in-process execution state for one persisted session.
A runtime begins inactive and gains an executor, event stream, publisher, and router task when the server launches its app. Persisted identity and history remain in the session store; this object contains only state that is meaningful inside the current server process.
The runtime permits one pending input request at a time. Incoming responses must match its request ID and data type, pass the request's JSON Schema, and use cancellation only when the request exposes a cancellation action. A lock protects this contract because router work and HTTP input handling run on different threads.
Attributes
Stable persisted session identifier.
Stable identifier of the app associated with the session.
Active app executor, or None before launch.
Browser-fragment publisher, or None before launch.
Future running the event router, or None before launch.
Signal used to wake and stop router work during server shutdown.
Methods
ServerRuntime.__init__
__init__(
session_id: str,
app_id: str,
) → NoneInitialize inactive runtime state for one app session.
Parameters
Stable identifier used to address the UI session.
Identifier of the app executed by the session.
ServerRuntime.recorded_input
recorded_input(
event: InputEvent,
) → InputEventBuild the safe persisted copy of a submitted input event.
This method must run while the matching request is still pending, before
validation consumes that pending state. Ordinary input is returned
unchanged. For form input, fields marked writeOnly in the request
schema are replaced with redacted values. Cancelled forms persist an
empty object rather than any values sent alongside the cancellation.
The returned copy is intended only for session history. The original event is validated separately and delivered to the app unchanged.
Parameters
Input submitted for the currently pending request.
Returns
A persistence-safe copy of matching form input, or the original event when no form redaction applies.