Spectre.Skill.Applicability (Spectre v0.3.0)

Copy Markdown View Source

Structured, portable applicability contract for one Skill.

Scope and tags decide eligibility. Positive and negative examples are an executable anti-hijack corpus; they never grant authority or become an unstructured model instruction.

Summary

Functions

Returns true when this declaration conflicts with a mount or Skill id.

Restores applicability from its portable representation.

Returns true when a structured host context is eligible.

Builds and validates structured applicability.

Builds applicability or raises with its stable validation reason.

Returns the current applicability schema version.

Returns a deterministic specificity used to detect ambiguous Skills.

Returns the portable representation included in Definition identity.

Types

t()

@type t() :: %Spectre.Skill.Applicability{
  conflicts: [term()],
  forbidden_tags: [term()],
  negative: [String.t()],
  positive: [String.t()],
  required_tags: [term()],
  schema_version: pos_integer(),
  scopes: [term()]
}

Functions

conflicts?(applicability, id)

@spec conflicts?(t(), term()) :: boolean()

Returns true when this declaration conflicts with a mount or Skill id.

from_data(data)

@spec from_data(map()) :: {:ok, t()} | {:error, term()}

Restores applicability from its portable representation.

matches?(applicability, context)

@spec matches?(t(), map()) :: boolean()

Returns true when a structured host context is eligible.

new(applicability)

@spec new(t() | map() | keyword()) :: {:ok, t()} | {:error, term()}

Builds and validates structured applicability.

new!(attrs)

@spec new!(t() | map() | keyword()) :: t()

Builds applicability or raises with its stable validation reason.

schema_version()

@spec schema_version() :: pos_integer()

Returns the current applicability schema version.

specificity(applicability)

@spec specificity(t()) :: non_neg_integer()

Returns a deterministic specificity used to detect ambiguous Skills.

to_data(applicability)

@spec to_data(t()) :: map()

Returns the portable representation included in Definition identity.