Resolves version adapters from version strings and raw payloads — a
faithful port of the reference VersionAdapterFactory, including
its error detail paths (messages.0.version, …).
v0.8 is not supported by this implementation: a version of v0.8 (or
a payload using the legacy v0.8 action keys) resolves to an
UNSUPPORTED_VERSION error rather than an adapter.
Summary
Functions
All action keys known across the protocol family — including the legacy v0.8 keys, which this implementation lists (so the "action not supported in this version" error stays faithful to the reference) but does not implement.
Resolves the adapter module for a version designator.
Resolves the adapter directly from a raw payload (a message map, a
list of messages, or a {"messages": [...]} wrapper).
Functions
All action keys known across the protocol family — including the legacy v0.8 keys, which this implementation lists (so the "action not supported in this version" error stays faithful to the reference) but does not implement.
@spec get_adapter(String.t()) :: {:ok, module()} | {:error, A2UICore.Error.t()}
Resolves the adapter module for a version designator.
Accepts v0.9, 0.9, v0.9.1, v1.0, 1.0, v1_0 … via
canonicalization. Returns {:ok, module} or {:error, error}
(category :validation) for unsupported versions such as v0.8 or
v99.0.
@spec resolve_from_payload(term()) :: {:ok, module()} | {:error, A2UICore.Error.t()}
Resolves the adapter directly from a raw payload (a message map, a
list of messages, or a {"messages": [...]} wrapper).
Sniffing order (faithful to the reference):
- non-list/map payloads are rejected (
invalid_payload_type), - an empty list is rejected (
empty_payload), {"messages": [...]}wrappers recurse into the list,- lists resolve via their first item,
- the item must be a map (
invalid_payload_type), - a string
versionresolves the adapter (type_mismatchwhen present but not a string); a missing version falls back to the legacy v0.8 action keys — which this implementation reports as unsupported — and otherwise fails withmissing_field.
All failures carry a detail at path messages.{index}.version.