Provider-neutral description of one action.
An action says what should happen and which provider owns the operation.
It does not execute work and it does not carry lifecycle state. Spectre turns
it into an Spectre.Effect before policy evaluation, persistence, and
execution.
:via is deliberately data rather than a module name. Libraries such as
Kinetic, Lens, or an MCP adapter can therefore select a registered provider
without teaching the core how that provider works.
Summary
Functions
Restores the provider-neutral action carried by an effect.
Returns true when a DSL protection/hook reference selects the action.
Builds an action from a name/reference and options.
Returns the canonical {provider, operation} reference.
Splits compact references such as {:lens, :navigate} and
{:mcp, :github, :create_issue}.
Converts an action into attributes accepted by Spectre.Effect.stage_action/3.
Returns whether a value is a supported compact action reference.
Types
Functions
@spec from_effect(Spectre.Effect.t()) :: t()
Restores the provider-neutral action carried by an effect.
@spec matches_ref?(term(), t() | Spectre.Effect.t()) :: boolean()
Returns true when a DSL protection/hook reference selects the action.
A bare action name remains provider-agnostic for backwards compatibility. A tuple is namespaced and must match both provider and operation.
Builds an action from a name/reference and options.
Spectre.Action.new(:list_projects)
Spectre.Action.new(:navigate, via: :lens, args: %{url: "https://example.com"})
Spectre.Action.new({:mcp, :github, :create_issue}, args: %{title: "Bug"})
@spec ref(t() | Spectre.Effect.t() | ref()) :: {provider_ref(), name()}
Returns the canonical {provider, operation} reference.
@spec split_ref(ref()) :: {:ok, {provider_ref(), name()}} | :error
Splits compact references such as {:lens, :navigate} and
{:mcp, :github, :create_issue}.
Converts an action into attributes accepted by Spectre.Effect.stage_action/3.
Returns whether a value is a supported compact action reference.