Compile-time contract for on-demand Spectre libraries.
Extensions can be mounted explicitly after use Spectre.Agent:
use Spectre.Agent
use Spectre.Kinetic
use Spectre.LensAn installed package can instead list its adapters in the
agent_extensions manifest field. use Spectre.Agent, stack: MyStack
registers those adapters automatically with the immutable installation
configuration.
Extensions contribute data and runtime ports to the single Spectre
definition.
They must not install their own @before_compile hook or manipulate private
Agent attributes. New ecosystem packages should publish a
Spectre.Stack.Installable manifest; Extension mounts remain
source-compatible and can be materialized through
Spectre.Stack.Installation.from_extension_mount/1.
Version-zero extensions keep receiving their registration options directly.
Version-one extensions may register namespaced attributes in setup/2,
compile those attributes once through compile/2, consume namespaced flow
options, and contribute runtime ports from the immutable compiled value.
Spectre.Agent remains the only owner of an @before_compile hook.
Summary
Functions
Returns the optional planner contributed by an extension.
Returns provider mounts contributed by an extension.
Returns non-action effect executors contributed by an extension.
Lets mounted extensions translate one package-local handler form into the ordinary Agent handler AST.
Fetches one compiled extension mount from an Agent definition.
Merges infrastructure defaults contributed by compiled extensions.
Registers an extension on a module already initialized with
use Spectre.Agent.
Callbacks
@callback api_version() :: pos_integer()
@callback expand_handler(Macro.t(), Macro.Env.t(), keyword()) :: {:ok, Macro.t()} | :ignore | {:error, term()}
@callback flow_constraints( keyword(), term() ) :: {[Spectre.Flow.Constraint.t()], keyword()} | {:error, term()}
@callback id() :: term()
Functions
@spec action_planner(Spectre.Extension.Mount.t()) :: {module(), keyword()} | nil
Returns the optional planner contributed by an extension.
@spec action_providers(Spectre.Extension.Mount.t()) :: [ Spectre.Action.Provider.Mount.t() ]
Returns provider mounts contributed by an extension.
@spec effect_executors(Spectre.Extension.Mount.t()) :: [ Spectre.Effect.Executor.Mount.t() ]
Returns non-action effect executors contributed by an extension.
Each executor owns exactly one effect kind. Core retains effect ownership,
policy, persistence, idempotency, replay, and terminal lifecycle mutation;
the contributed module performs only the external capability call.
@spec expand_handler(module(), Macro.t(), Macro.Env.t()) :: {:ok, Macro.t()} | :ignore
Lets mounted extensions translate one package-local handler form into the ordinary Agent handler AST.
This is the namespace-safe alternative to importing every package verb into the Agent module. Exactly zero or one extension may claim a form.
@spec fetch(module(), term()) :: {:ok, Spectre.Extension.Mount.t()} | {:error, term()}
Fetches one compiled extension mount from an Agent definition.
@spec merge_agent_config( keyword(), [Spectre.Extension.Mount.t()] ) :: keyword()
Merges infrastructure defaults contributed by compiled extensions.
An explicit Agent option wins over an extension default. Two extensions may not silently contribute the same key, even when the Agent overrides it, because that would leave the selected implementation ambiguous.
Registers an extension on a module already initialized with
use Spectre.Agent.