Jido.Composer.Workflow.Machine (Jido Composer v0.4.0)

Copy Markdown View Source

Pure FSM struct at the heart of a Workflow.

The Machine holds the current state, transition rules, node bindings, accumulated context, and execution history. All operations are pure functions — no side effects.

Summary

Types

t()

@type t() :: %Jido.Composer.Workflow.Machine{
  context: Jido.Composer.Context.t(),
  history: [{atom(), atom(), integer()}],
  nodes: %{required(atom()) => struct()},
  status: atom(),
  terminal_states: MapSet.t(),
  transitions: %{required({atom(), atom()}) => atom()}
}

Functions

apply_result(machine, result)

@spec apply_result(t(), map() | Jido.Composer.NodeIO.t() | term()) :: t()

current_node(machine)

@spec current_node(t()) :: struct() | nil

new(opts)

@spec new(keyword()) :: t()

terminal?(machine)

@spec terminal?(t()) :: boolean()

transition(machine, outcome)

@spec transition(t(), atom()) :: {:ok, t()} | {:error, term()}