Versioned contract implemented by packages that can be installed in a Stack.
manifest/0, compile/3 and optional tools/1 / effects/1 run while the Stack
definition is compiled and must return immutable data. tools/1 receives
compiled configuration and returns Spectre.Stack.Tools descriptors.
use Spectre.Server, tools: MyApp.Stack generates helpers from their names;
a package does not export a helper function simply by implementing this callback.
Descriptors declare operation validation, adapters and replay contracts. Cognitive operations return projected portable data; governed operations normalize to host-bound proposals before persistence and enter GAM. A tool registration is not authority to execute its consequences.
Optional effects/1 returns Spectre.Stack.Effects registrations for the
managed GAM executor. It is an additive version-1 effect catalog, distinct from
helper descriptors and Spectre.Stack.Contract.V2. Packages without it remain
compatible with manual GAM bindings. Installing an execution adapter still
requires the application to enable the operation under its declared authority.
child_specs/2, when implemented, runs only when a caller explicitly starts
Spectre.Stack.Runtime. The optional callback extends the existing version-1
installable contract; packages without tools still install but provide no
generated Server helpers. See the Stack Tools guide for a complete descriptor
example and the adapter contract.
Summary
Functions
Defines a static manifest and default data-only compiler.
Returns the supported installable contract version.
Compiles optional, data-only execution registrations without granting authority.
Verifies and returns an installable package manifest.
Verifies an installable or raises with a stable contract error.
Callbacks
@callback child_specs( Spectre.Stack.Installation.t(), keyword() ) :: [{term(), Supervisor.child_spec()}] | {:ok, [{term(), Supervisor.child_spec()}]} | {:error, term()}
@callback effects(map() | keyword()) :: Spectre.Stack.Effects.t()
@callback manifest() :: Spectre.Stack.Package.t() | map() | keyword()
@callback tools(map() | keyword()) :: Spectre.Stack.Tools.t()
Functions
Defines a static manifest and default data-only compiler.
@spec contract_version() :: pos_integer()
Returns the supported installable contract version.
@spec effects!(module(), map() | keyword()) :: Spectre.Stack.Effects.t()
Compiles optional, data-only execution registrations without granting authority.
@spec verify(module(), pos_integer()) :: {:ok, Spectre.Stack.Package.t()} | {:error, term()}
Verifies and returns an installable package manifest.
@spec verify!(module(), pos_integer()) :: Spectre.Stack.Package.t()
Verifies an installable or raises with a stable contract error.