LemonCliRunners.Types.EventFactory (lemon_cli_runners v0.1.0)

View Source

Factory for creating CLI runner events with consistent engine identification.

The factory caches the resume token after the first started/2 call, allowing subsequent completion events to reference it automatically.

Example

factory = EventFactory.new("codex")

# Create started event - caches the resume token
started = EventFactory.started(factory, token, title: "Codex Session")

# Create action events
action = EventFactory.action_started(factory, "cmd_1", :command, "ls -la")

# Create completed event - uses cached token
completed = EventFactory.completed_ok(factory, "Done!")

Summary

Functions

Create an action event

Create a failed completion event

Create a successful completion event

Create a new event factory for an engine

Create a note event with auto-incrementing ID

Create a started event and cache the resume token

Types

t()

@type t() :: %LemonCliRunners.Types.EventFactory{
  engine: String.t(),
  note_seq: non_neg_integer(),
  resume: LemonCore.ResumeToken.t() | nil
}

Functions

action(factory, opts)

Create an action event

action_completed(factory, action_id, kind, title, ok, opts \\ [])

Create an action completed event

action_started(factory, action_id, kind, title, opts \\ [])

Create an action started event

action_updated(factory, action_id, kind, title, opts \\ [])

Create an action updated event

completed_error(factory, error, opts \\ [])

Create a failed completion event

completed_ok(factory, answer, opts \\ [])

Create a successful completion event

new(engine)

Create a new event factory for an engine

note(factory, message, opts \\ [])

Create a note event with auto-incrementing ID

started(factory, token, opts \\ [])

Create a started event and cache the resume token