Portable, immutable envelope for declared Spectre behavior.
A canonical Definition contains a small versioned header and typed
components. It is the single input to Definition identity and deterministic
projections; compiled Agent and Skill definitions enter this representation
through lower/2.
Summary
Functions
Returns the current canonical Definition schema version.
Returns the current canonical Definition contract version.
Decodes and validates canonical Definition bytes.
Returns the stable lowercase SHA-256 identity digest.
Encodes a Definition into canonical bytes.
Encodes a Definition or raises on an invalid envelope.
Fetches one component by its unique type.
Restores and validates an envelope from portable decoded data.
Lowers a compiled Spectre.Definition or DSL module into the canonical IR.
Lowers a compiled Definition or raises with its stable failure reason.
Builds and validates a canonical Definition envelope.
Builds a canonical Definition or raises with its stable validation reason.
Returns the content-addressed Ref for a Definition.
Returns the portable envelope used for encoding and projections.
Types
@type t() :: %Spectre.Definition.Canonical{ canonicalization_version: pos_integer(), components: [Spectre.Definition.Component.t()], contract_version: pos_integer(), declared_version: term(), digest_algorithm: :sha256, id: term(), kind: :agent | :skill, origin: :compiled | :runtime }
Functions
@spec canonicalization_version() :: pos_integer()
Returns the current canonical Definition schema version.
@spec contract_version() :: pos_integer()
Returns the current canonical Definition contract version.
Decodes and validates canonical Definition bytes.
Returns the stable lowercase SHA-256 identity digest.
Encodes a Definition into canonical bytes.
Encodes a Definition or raises on an invalid envelope.
@spec fetch_component(t(), atom() | String.t()) :: {:ok, Spectre.Definition.Component.t()} | {:error, {:unknown_definition_component, term()}}
Fetches one component by its unique type.
Restores and validates an envelope from portable decoded data.
@spec lower( module() | Spectre.Definition.t(), keyword() ) :: {:ok, t()} | {:error, term()}
Lowers a compiled Spectre.Definition or DSL module into the canonical IR.
@spec lower!( module() | Spectre.Definition.t(), keyword() ) :: t()
Lowers a compiled Definition or raises with its stable failure reason.
Builds and validates a canonical Definition envelope.
Builds a canonical Definition or raises with its stable validation reason.
@spec ref(t()) :: Spectre.Definition.Ref.t()
Returns the content-addressed Ref for a Definition.
Returns the portable envelope used for encoding and projections.