Spectre.ActionConfig (Spectre v0.3.0)

Copy Markdown View Source

Resolves provider-neutral action configuration from an Agent definition.

actions MyApp.Actions remains the compatibility shorthand for one local provider. Optional libraries contribute providers or a planner through Spectre.Extension, keeping their implementation out of the core.

Summary

Functions

Returns the legacy local action module configuration.

Returns the one configured action planner, if present.

Builds the options passed to the planner port.

Resolves a provider by its stable identifier.

Returns all provider mounts visible to an Agent.

Types

action_config()

@type action_config() :: {module(), keyword()} | nil

planner_config()

@type planner_config() :: {module(), keyword()} | nil

Functions

actions(agent)

@spec actions(module()) :: action_config()

Returns the legacy local action module configuration.

planner(agent)

@spec planner(module()) :: planner_config()

Returns the one configured action planner, if present.

An explicit action_planner/2 declaration and extension-contributed planner are mutually exclusive. Multiple planners are rejected instead of relying on compile or mount order.

planner_opts(map, opts)

@spec planner_opts(
  Spectre.Context.t() | map(),
  keyword()
) :: keyword()

Builds the options passed to the planner port.

Per-handler/runtime options override extension defaults.

provider(agent, id)

@spec provider(module(), Spectre.Action.provider_ref()) ::
  {:ok, Spectre.Action.Provider.Mount.t()} | {:error, term()}

Resolves a provider by its stable identifier.

providers(agent)

@spec providers(module()) :: [Spectre.Action.Provider.Mount.t()]

Returns all provider mounts visible to an Agent.