LemonGateway.Event (lemon_gateway v0.1.0)

View Source

Event types for LemonGateway run lifecycle.

Events are plain tagged maps (not structs) identified by an __event__ key. Constructor functions normalise the shape; defguards let callers pattern-match.

These events are emitted during run execution and can be subscribed to via the LemonCore.Bus on the "run:<run_id>" topic.

Summary

Functions

Build an :action map (embedded inside action_event).

Build an :action_event map.

Build a :completed event map.

Build a :started event map.

Types

phase()

@type phase() :: :started | :updated | :completed

Functions

action(fields)

@spec action(map()) :: map()

Build an :action map (embedded inside action_event).

Required keys: :id, :kind, :title. Optional: :detail.

action_event(fields)

@spec action_event(map()) :: map()

Build an :action_event map.

Required keys: :engine, :action, :phase. Optional: :ok, :message, :level.

completed(fields)

@spec completed(map()) :: map()

Build a :completed event map.

Required keys: :engine, :ok. Optional: :resume, :answer, :error, :usage, :meta, :run_id, :session_key.

is_action_event(ev)

(macro)

is_completed(ev)

(macro)

is_started(ev)

(macro)

started(fields)

@spec started(map()) :: map()

Build a :started event map.

Required keys: :engine, :resume. Optional: :title, :meta, :run_id, :session_key.