# `A2UICore.Message.AdapterRegistry`
[🔗](https://github.com/a2ui-elixir/a2ui/blob/v0.1.1/umbrella/apps/a2ui_core/lib/a2ui_core/message/adapter_registry.ex#L1)

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.

# `all_known_actions`
*since 0.1.0* 

```elixir
@spec all_known_actions() :: MapSet.t(String.t())
```

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.

# `get_adapter`
*since 0.1.0* 

```elixir
@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`.

# `resolve_from_payload`
*since 0.1.0* 

```elixir
@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):

1. non-list/map payloads are rejected (`invalid_payload_type`),
2. an empty list is rejected (`empty_payload`),
3. `{"messages": [...]}` wrappers recurse into the list,
4. lists resolve via their first item,
5. the item must be a map (`invalid_payload_type`),
6. a string `version` resolves the adapter (`type_mismatch` when
   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 with `missing_field`.

All failures carry a detail at path `messages.{index}.version`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
