exlab_wizard.api.events#
WebSocket frame envelope types. Backend Spec §4.6.2.
These msgspec.Struct types are the typed shape of every frame
emitted on the two WebSocket channels:
WS /api/v1/sessions/{id}/events– per-session pipeline events (PhaseEvent,ProgressEvent,InputRequiredEvent,WarningEvent,DoneEvent,FailedEvent).WS /api/v1/problems/events– audit pub-sub channel (SnapshotEvent,DeltaEvent).
Each Struct uses a string tag that drops onto the wire as the kind
discriminator (§4.6.2 example payloads). Encode via
msgspec.json.encode to keep the same hot-path serializer the cache
files use (§4.4.5 rationale).
The structs are intentionally permissive: fields/added/etc.
carry list[dict] rather than typed sub-structs because the field
specs and finding shapes are defined elsewhere (PluginInputRequired
fields are spec’d by the plugin; findings by §11.8). We round-trip the
dict shape so the outbound frame is the literal example payload.
Functions
|
Encode a typed WebSocket frame to JSON bytes via |
|
Convert a plain dict (e.g. from the controller's event queue) into the matching typed Struct. |
Classes
|
Delta frame for the Problems pub-sub channel. |
|
Terminal success frame. |
|
Terminal failure frame. |
|
Plugin escalation frame. |
|
Per-state phase frame. |
|
Progress frame for the long-running plugin pass. |
|
Full audit snapshot frame for the Problems pub-sub channel. |
|
Non-fatal warning frame. |
- class exlab_wizard.api.events.DeltaEvent(*, added: list[dict[str, Any]], removed: list[dict[str, Any]], changed: list[dict[str, Any]], audit_at: str)[source]#
Bases:
StructDelta frame for the Problems pub-sub channel. Backend Spec §4.6.2.
Sent on every audit pass after the first. The three lists carry the
rule + offending_pathpairs that were added, removed, or changed compared to the previous snapshot.
- class exlab_wizard.api.events.DoneEvent(*, result: dict[str, Any])[source]#
Bases:
StructTerminal success frame. Backend Spec §4.6.2.
resultcarries the final state envelope:path(the new directory),sync_status,blocked, and any other fields the pipeline chooses to surface.
- class exlab_wizard.api.events.FailedEvent(*, phase: str, error: dict[str, Any])[source]#
Bases:
StructTerminal failure frame. Backend Spec §4.6.2.
errorfollows the §4.6.3 error envelope shape (code,messageminimum) so client code can reuse the same dispatch table it uses for HTTP-level errors.
- class exlab_wizard.api.events.InputRequiredEvent(*, fields: list[dict[str, Any]], reason: str, plugin: str)[source]#
Bases:
StructPlugin escalation frame. Backend Spec §4.6.2 / §6.4.
fieldsis the plugin-supplied list of field-spec dicts (id/label/type/required/default/options/hint) that the wizard’s escalation dialog renders.reasonis the plugin’s prompt string.pluginis the plugin name so the UI can attribute the prompt.
- class exlab_wizard.api.events.PhaseEvent(*, phase: str, at: str)[source]#
Bases:
StructPer-state phase frame. Backend Spec §4.6.2.
Emitted on every state transition that has a corresponding phase enum value (see §4.7.1 mapping table).
atis a UTC ISO-8601 timestamp stamped at transition time.
- class exlab_wizard.api.events.ProgressEvent(*, phase: str, current: int, total: int)[source]#
Bases:
StructProgress frame for the long-running plugin pass. Backend Spec §4.6.2.
- class exlab_wizard.api.events.SnapshotEvent(*, findings: list[dict[str, Any]], audit_at: str)[source]#
Bases:
StructFull audit snapshot frame for the Problems pub-sub channel.
Sent immediately after the WebSocket connects so the client can paint the initial Problems-tab state without a separate REST call. Backend Spec §4.6.2 example.
- class exlab_wizard.api.events.WarningEvent(*, phase: str, message: str)[source]#
Bases:
StructNon-fatal warning frame. Backend Spec §4.6.2.
Emitted by the controller when a phase produces a warning that should be surfaced in the UI without aborting the session (e.g. post-validate hard-tier finding gating sync).