Resolved or canonical prompt content with its composition metadata.
Runtime fragments are built with new/3. Content-addressed Definition
fragments are built with canonical/1; those fragments reject EEx and use a
closed {{path.to.value}} placeholder grammar with an explicit schema.
Summary
Functions
Builds the base task fragment selected by ask.
Builds a governed, digest-addressed prompt fragment.
Builds a canonical fragment or raises with its stable validation reason.
Returns the portable data included in a canonical fragment digest.
Migrates the safe subset of compiled .text.heex assets to closed templates.
Builds a resolved prompt fragment from an operation.
Types
@type t() :: %Spectre.Prompt.Fragment{ budget_class: :small | :standard | :large, condition_ref: map() | nil, content: String.t() | nil, digest: String.t() | nil, granted_priority: :low | :normal | :high, id: term(), metadata: map(), placeholders: map(), position: Spectre.Prompt.Operation.position(), provenance: map(), requested_priority: :low | :normal | :high, schema_version: pos_integer(), scope: term(), source: Spectre.Prompt.Operation.source() | :base | map(), target: Spectre.Prompt.Operation.target(), token_cap: pos_integer() | nil, trust: :instruction | :data, visibility: :private | :agent | :operator | :public }
Functions
Builds the base task fragment selected by ask.
Builds a governed, digest-addressed prompt fragment.
Canonical content may be static text or a template containing only declared
{{path.to.value}} placeholders. Dynamic providers use content: nil and
must remain context:data fragments.
Builds a canonical fragment or raises with its stable validation reason.
Returns the portable data included in a canonical fragment digest.
Migrates the safe subset of compiled .text.heex assets to closed templates.
Only direct assign paths such as <%= @input.text %> are accepted. Any
remaining EEx tag is rejected instead of being copied into runtime data.
@spec new(Spectre.Prompt.Operation.t(), String.t(), map()) :: t()
Builds a resolved prompt fragment from an operation.