Definitively.Run.Coordinator (definitively v0.3.1)

Copy Markdown

Application facade for starting and controlling ephemeral workflow runs.

Summary

Functions

Approves an approval gate (label must exist on the current state's on map).

Cancels a run when the program defines a :failed final state.

Continues an in-flight run until final, approval, or error.

Starts a run from a YAML program path; drives active nodes until a final state.

Loads a program and starts an engine process registered by run_id.

Returns a snapshot of the run's current FSM state.

Executes the active node, classifies the result, and transitions the engine.

Functions

approve(run_id, label)

@spec approve(String.t(), atom()) :: :ok | {:error, term()}

Approves an approval gate (label must exist on the current state's on map).

cancel(run_id)

@spec cancel(String.t()) :: :ok | {:error, term()}

Cancels a run when the program defines a :failed final state.

resume(run_id, opts \\ [])

@spec resume(
  String.t(),
  keyword()
) :: :ok | {:error, term()}

Continues an in-flight run until final, approval, or error.

run_until_final(program_path, opts \\ [])

@spec run_until_final(
  Path.t(),
  keyword()
) :: :ok | {:error, term()}

Starts a run from a YAML program path; drives active nodes until a final state.

start(program_path, opts \\ [])

@spec start(
  Path.t(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

Loads a program and starts an engine process registered by run_id.

status(run_id)

@spec status(String.t()) :: {:ok, Definitively.Run.Snapshot.t()} | {:error, term()}

Returns a snapshot of the run's current FSM state.

step(run_id, opts \\ [])

@spec step(
  String.t(),
  keyword()
) :: :ok | {:error, term()} | :retry

Executes the active node, classifies the result, and transitions the engine.