LemonCore.Events.Action (lemon_core v0.1.0)

View Source

A single unit of engine activity — a tool call, command, file change, search, subagent or reasoning step. Carried inside LemonCore.Events.EngineAction.

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 from a legacy map, normalising kind to an atom.

The accepted action kinds.

Build the payload, raising on unknown or missing keys.

Whether a term is an accepted kind, in either atom or legacy string form.

Types

kind()

@type kind() ::
  :tool | :command | :file_change | :web_search | :subagent | :reasoning | :note

t()

@type t() :: %LemonCore.Events.Action{
  detail: map(),
  id: String.t(),
  kind: kind(),
  title: String.t()
}

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()
@spec from_map(map() | struct() | keyword()) :: t()

Build from a legacy map, normalising kind to an atom.

Kinds were accepted as either atoms or strings before typing, so both appear in persisted event logs and in payloads arriving from the control-plane injectors.

kinds()

@spec kinds() :: [kind()]

The accepted action kinds.

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.

valid_kind?(kind)

@spec valid_kind?(term()) :: boolean()

Whether a term is an accepted kind, in either atom or legacy string form.