LemonCore.Events.GoalChanged (lemon_core v0.1.0)

View Source

A durable goal's lifecycle changed. Published on goals and session:<session_key> by LemonAgent.Workspace.GoalStore; the specific transition is the LemonCore.Event type (:goal_set, :goal_paused, :goal_resumed, :goal_completed, :goal_cleared, :goal_continuation_submitted, :goal_loop_verdict, :goal_loop_status).

Summary

Functions

The LemonCore.Event type atom this payload is published under.

Payload version. Bumped only for a breaking field change (see the semver table in docs/platform/bus-events.md §4.3).

The struct's field names, in declaration order.

Build the payload from a map that may be a legacy free-form payload.

Build the payload, raising on unknown or missing keys.

Types

t()

@type t() :: %LemonCore.Events.GoalChanged{
  agent_id: String.t() | nil,
  continuation_count: non_neg_integer() | nil,
  goal_id: String.t(),
  last_run_id: String.t() | nil,
  loop_auto_enabled: boolean() | nil,
  loop_status: term() | nil,
  loop_verdict: term() | nil,
  objective_bytes: non_neg_integer() | nil,
  session_key: String.t() | nil,
  status: atom() | String.t() | nil
}

Functions

event_type()

@spec event_type() :: atom()

The LemonCore.Event type atom this payload is published under.

event_version()

@spec event_version() :: pos_integer()

Payload version. Bumped only for a breaking field change (see the semver table in docs/platform/bus-events.md §4.3).

fields()

@spec fields() :: [atom()]

The struct's field names, in declaration order.

from_map(payload)

@spec from_map(map() | struct() | keyword()) :: struct()

Build the payload from a map that may be a legacy free-form payload.

Unknown keys are dropped and string keys are accepted, so a consumer can coerce whatever arrives on the topic. Enforced keys are still required — a map missing them is not a valid payload under any version.

new(payload)

@spec new(map() | keyword()) :: struct()

Build the payload, raising on unknown or missing keys.

This is the publisher-side constructor: a typo should fail at the point of publish, not silently produce a payload with a nil field that a consumer reads as absent.