Squidie.Workflow.ActionRegistry (squidie v0.1.2)

Copy Markdown View Source

Host-owned trust boundary for runtime-authored workflow actions.

Runtime-authored specs should reference stable action keys rather than raw module atoms. The host application owns the registry and maps those keys to approved Squidie.Step or explicit Jido.Action modules before a spec can be activated.

Summary

Functions

Resolves :action step keys in a workflow spec to approved executable modules.

Resolves action keys and validates the resulting executable spec shape.

Types

action_key()

@type action_key() :: atom() | String.t()

action_validation_error()

@type action_validation_error() ::
  :missing_action_key
  | :invalid_action_key
  | :unknown_action_key
  | :disabled_action_key
  | :incompatible_action_module

registry()

@type registry() ::
  %{optional(action_key()) => registry_entry()} | keyword(registry_entry())

registry_entry()

@type registry_entry() ::
  module()
  | keyword()
  | %{optional(:module) => module(), optional(:enabled?) => boolean()}
  | %{optional(String.t()) => term()}

validation_error()

@type validation_error() :: Squidie.Workflow.Spec.validation_error()

Functions

resolve_spec(spec, registry)

@spec resolve_spec(Squidie.Workflow.Spec.t() | map() | term(), registry()) ::
  {:ok, Squidie.Workflow.Spec.t() | map()}
  | {:error, {:invalid_workflow_spec, [validation_error()]}}

Resolves :action step keys in a workflow spec to approved executable modules.

The resolved spec preserves the stable action key in both :action and step :metadata so later planner and inspection surfaces can expose identity without trusting user-provided module values.

validate_spec(spec, registry)

@spec validate_spec(Squidie.Workflow.Spec.t() | map() | term(), registry()) ::
  :ok | {:error, {:invalid_workflow_spec, [validation_error()]}}

Resolves action keys and validates the resulting executable spec shape.