Spectre.Stack.Tools (Spectre v0.4.0)

Copy Markdown View Source

Immutable tool descriptors returned by Spectre.Stack.Installable.tools/1.

A descriptor declares a helper name and a closed set of operations. It does not execute an adapter or grant authority. Cognitive operations declare their retry policy; governed operations name a host binding instead of an executor.

Adapter module availability is checked by the consumer at runtime, allowing packages to compile their integration modules independently of the Stack.

Summary

Functions

Builds a unique helper table from validated Stack installations.

Validates descriptors without loading or invoking their adapters.

Types

descriptor()

@type descriptor() :: %{
  contract: 1,
  adapter: module(),
  default: atom() | nil,
  operations: %{required(atom()) => operation()}
}

operation()

@type operation() ::
  %{path: :cognitive, retry: :safe | :never, max_bytes: pos_integer()}
  | %{
      path: :governed,
      operation: atom() | binary() | tuple(),
      max_bytes: pos_integer()
    }

t()

@type t() :: %{optional(atom()) => descriptor()}

Functions

table!(installations)

@spec table!([Spectre.Stack.Installation.t()]) :: map()

Builds a unique helper table from validated Stack installations.

validate!(tools)

@spec validate!(term()) :: t()

Validates descriptors without loading or invoking their adapters.