Mobus.Stepwise.History (mobus_stepwise v0.2.0)

Copy Markdown View Source

Structured access to runtime history and trace data.

The engine maintains two audit trails in the runtime:

  • :history — state transition log (from, to, event, at)
  • :trace — fine-grained execution trace (actions, steps, breakpoints)

These helpers provide stable read access and controlled append without depending on internal list structure.

Summary

Functions

Appends a custom event to the history.

Appends a custom entry to the trace.

Returns the full history list from the runtime.

Returns history entries filtered by event name.

Returns the last history entry, or nil.

Returns the full trace list from the runtime.

Returns trace entries filtered by kind.

Returns the number of state transitions recorded.

Functions

append(runtime, entry)

@spec append(map(), map()) :: map()

Appends a custom event to the history.

append_trace(runtime, entry)

@spec append_trace(map(), map()) :: map()

Appends a custom entry to the trace.

events(runtime)

@spec events(map()) :: [map()]

Returns the full history list from the runtime.

events_by(runtime, event_name)

@spec events_by(map(), atom() | String.t()) :: [map()]

Returns history entries filtered by event name.

last_event(runtime)

@spec last_event(map()) :: map() | nil

Returns the last history entry, or nil.

trace(runtime)

@spec trace(map()) :: [map()]

Returns the full trace list from the runtime.

trace_by_kind(runtime, kind)

@spec trace_by_kind(map(), atom() | String.t()) :: [map()]

Returns trace entries filtered by kind.

transition_count(runtime)

@spec transition_count(map()) :: non_neg_integer()

Returns the number of state transitions recorded.