# `Spectre.Stack.Installable`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/stack/installable.ex#L1)

Versioned contract implemented by packages that can be installed in a Stack.

`c:manifest/0`, `c:compile/3` and optional `c:tools/1` / `c:effects/1` run while the Stack
definition is compiled and must return immutable data. `c: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 `c: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.

`c: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.

# `child_specs`
*optional* 

```elixir
@callback child_specs(
  Spectre.Stack.Installation.t(),
  keyword()
) ::
  [{term(), Supervisor.child_spec()}]
  | {:ok, [{term(), Supervisor.child_spec()}]}
  | {:error, term()}
```

# `compile`
*optional* 

```elixir
@callback compile(keyword(), Macro.t() | nil, Macro.Env.t()) ::
  {:ok, map() | keyword()} | {:error, term()}
```

# `effects`
*optional* 

```elixir
@callback effects(map() | keyword()) :: Spectre.Stack.Effects.t()
```

# `manifest`

```elixir
@callback manifest() :: Spectre.Stack.Package.t() | map() | keyword()
```

# `tools`
*optional* 

```elixir
@callback tools(map() | keyword()) :: Spectre.Stack.Tools.t()
```

# `__using__`
*macro* 

Defines a static manifest and default data-only compiler.

# `contract_version`

```elixir
@spec contract_version() :: pos_integer()
```

Returns the supported installable contract version.

# `effects!`

```elixir
@spec effects!(module(), map() | keyword()) :: Spectre.Stack.Effects.t()
```

Compiles optional, data-only execution registrations without granting authority.

# `verify`

```elixir
@spec verify(module(), pos_integer()) ::
  {:ok, Spectre.Stack.Package.t()} | {:error, term()}
```

Verifies and returns an installable package manifest.

# `verify!`

```elixir
@spec verify!(module(), pos_integer()) :: Spectre.Stack.Package.t()
```

Verifies an installable or raises with a stable contract error.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
