yera.dev.services.event_converter
Event conversion utilities for converting between backend and frontend formats.
Symbols
json_to_output_event
json_to_output_event(
d: dict,
) → OutputEventReconstruct an OutputEvent from a parsed SSE JSON dict.
Reverse of output_event_to_json: converts the wire JSON format back
into a domain OutputEvent with the correct BlockData subtype.
Parameters
Parsed JSON dict with keys event_class, block_type,
block_id, data, timestamp, chunk_id, app,
and parent_block_id.
Returns
Fully populated OutputEvent ready for console rendering.
output_event_to_json
output_event_to_json(
event: OutputEvent,
) → dictConvert an OutputEvent to frontend JSON format.
Parameters
OutputEvent from the app execution
Returns
Dictionary matching the frontend AppMessage interface: { "event_class": "content" | "prompt" | "progress" | "structure" | "control" | "context" | "lifecycle", "block_type": str, "block_id": str, "data": dict, "timestamp": str (ISO format), "chunk_id": int, "app": { "name": str, "instance_id": int }, "parent_block_id": str | None }
user_interaction_to_input_event
user_interaction_to_input_event(
interaction: dict,
) → InputEventConvert a UserInteraction dict to InputEvent format.
Parameters
UserInteraction dictionary with: - blockId: str - value: Any - blockType: str
Returns
InputEvent for pushing to EventStream