The facade decodes and verifies protocol artifacts through the Elixir reference implementation.
Use it when an application needs artifact codecs and combined verification calls.
This module does not authorize operations.
Example
bytes = File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-blueprint.json"))
match?({:ok, %AgentBlueprintProtocol.Blueprint{}}, AgentBlueprintProtocol.decode_blueprint(bytes))
Summary
Functions
Returns canonical JSON bytes for the supplied artifact.
Decodes and validates Blueprint bytes under the supplied parse limits.
Decodes and validates Deployment bytes under the supplied parse limits.
Decodes and validates Federation envelope bytes under the supplied parse limits.
Returns the field mapping data for the supported federation carriers.
Intersects the Blueprint, Deployment, and host bound sources.
Checks an artifact against a consumer support posture.
Runs the composed verification pass for a Blueprint and Deployment pair.
Compares manifest identities with identities reported by a host.
Types
@type failure() :: {:error, AgentBlueprintProtocol.Error.t()}
A typed error result returned by a fallible facade operation.
Functions
@spec canonical_bytes( AgentBlueprintProtocol.Blueprint.t() | AgentBlueprintProtocol.Deployment.t() | AgentBlueprintProtocol.Federation.t() ) :: {:ok, binary()} | failure()
Returns canonical JSON bytes for the supplied artifact.
Example
iex> with {:ok, blueprint} <- AgentBlueprintProtocol.Blueprint.decode(File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-blueprint.json"))), do: match?({:ok, bytes} when is_binary(bytes), AgentBlueprintProtocol.canonical_bytes(blueprint))
true
@spec decode_blueprint(binary(), AgentBlueprintProtocol.Bounds.t() | map()) :: {:ok, AgentBlueprintProtocol.Blueprint.t()} | failure()
Decodes and validates Blueprint bytes under the supplied parse limits.
Example
iex> bytes = File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-blueprint.json"))
iex> match?({:ok, %AgentBlueprintProtocol.Blueprint{}}, AgentBlueprintProtocol.decode_blueprint(bytes))
true
iex> match?({:ok, %AgentBlueprintProtocol.Blueprint{}}, AgentBlueprintProtocol.decode_blueprint(bytes, %{bytes: 5000}))
true
@spec decode_deployment(binary(), AgentBlueprintProtocol.Bounds.t() | map()) :: {:ok, AgentBlueprintProtocol.Deployment.t()} | failure()
Decodes and validates Deployment bytes under the supplied parse limits.
Example
iex> bytes = File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-deployment.json"))
iex> match?({:ok, %AgentBlueprintProtocol.Deployment{}}, AgentBlueprintProtocol.decode_deployment(bytes))
true
iex> match?({:ok, %AgentBlueprintProtocol.Deployment{}}, AgentBlueprintProtocol.decode_deployment(bytes, %{bytes: 5000}))
true
@spec decode_federation_envelope(binary(), AgentBlueprintProtocol.Bounds.t() | map()) :: {:ok, AgentBlueprintProtocol.Federation.t()} | failure()
Decodes and validates Federation envelope bytes under the supplied parse limits.
Example
iex> bytes = File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/federation-envelope.json"))
iex> match?({:ok, %AgentBlueprintProtocol.Federation{}}, AgentBlueprintProtocol.decode_federation_envelope(bytes))
true
iex> match?({:ok, %AgentBlueprintProtocol.Federation{}}, AgentBlueprintProtocol.decode_federation_envelope(bytes, %{bytes: 5000}))
true
@spec federation_mapping() :: [AgentBlueprintProtocol.Federation.Mapping.Row.t()]
Returns the field mapping data for the supported federation carriers.
Example
iex> is_list(AgentBlueprintProtocol.federation_mapping())
true
@spec intersect(AgentBlueprintProtocol.BoundsAlgebra.Sources.t()) :: {:ok, AgentBlueprintProtocol.BoundsAlgebra.Result.t()} | failure()
Intersects the Blueprint, Deployment, and host bound sources.
Example
iex> with {:ok, blueprint} <- AgentBlueprintProtocol.Blueprint.decode(File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-blueprint.json"))), {:ok, deployment} <- AgentBlueprintProtocol.Deployment.decode(File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-deployment.json"))), {:ok, blueprint_bounds} <- AgentBlueprintProtocol.BoundsAlgebra.from_blueprint(blueprint), {:ok, deployment_bounds} <- AgentBlueprintProtocol.BoundsAlgebra.from_deployment(deployment), sources = %AgentBlueprintProtocol.BoundsAlgebra.Sources{blueprint: blueprint_bounds, deployment: deployment_bounds, host: deployment_bounds, protected_clamp: :acknowledge}, do: match?({:ok, %AgentBlueprintProtocol.BoundsAlgebra.Result{}}, AgentBlueprintProtocol.intersect(sources))
true
@spec negotiate( AgentBlueprintProtocol.Blueprint.t() | AgentBlueprintProtocol.Deployment.t() | AgentBlueprintProtocol.Json.value(), AgentBlueprintProtocol.Negotiation.Support.t() ) :: {:ok, AgentBlueprintProtocol.Negotiation.Outcome.t()} | failure()
Checks an artifact against a consumer support posture.
Example
iex> with {:ok, blueprint} <- AgentBlueprintProtocol.Blueprint.decode(File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-blueprint.json"))), support = %AgentBlueprintProtocol.Negotiation.Support{revisions: MapSet.new([1]), core_fields: MapSet.new([])}, do: match?({:ok, %AgentBlueprintProtocol.Negotiation.Outcome{}}, AgentBlueprintProtocol.negotiate(blueprint, support))
true
@spec reconcile( AgentBlueprintProtocol.Blueprint.t(), AgentBlueprintProtocol.Deployment.t(), AgentBlueprintProtocol.Reconcile.Inputs.t() ) :: {:ok, AgentBlueprintProtocol.Evidence.t()} | failure()
Runs the composed verification pass for a Blueprint and Deployment pair.
Example
iex> with {:ok, blueprint} <- AgentBlueprintProtocol.Blueprint.decode(File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-blueprint.json"))), {:ok, deployment} <- AgentBlueprintProtocol.Deployment.decode(File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-deployment.json"))), {:ok, host_bounds} <- AgentBlueprintProtocol.BoundsAlgebra.from_deployment(deployment), inputs = %AgentBlueprintProtocol.Reconcile.Inputs{host_bounds: host_bounds, support: %AgentBlueprintProtocol.Negotiation.Support{revisions: MapSet.new([1]), core_fields: MapSet.new([])}, keys: [], protected_clamp: :acknowledge, observations: %AgentBlueprintProtocol.Deployment.Observations{}}, do: match?({:ok, %AgentBlueprintProtocol.Evidence{}}, AgentBlueprintProtocol.reconcile(blueprint, deployment, inputs))
true
@spec verify_compatibility( AgentBlueprintProtocol.Deployment.t(), AgentBlueprintProtocol.Compatibility.Observed.t() ) :: {:ok, AgentBlueprintProtocol.Evidence.t()} | failure()
Compares manifest identities with identities reported by a host.
Example
iex> match?({:error, %AgentBlueprintProtocol.Error{code: :invalid_type}}, AgentBlueprintProtocol.verify_compatibility(:invalid, :invalid))
true