# `Raxol.AgentClientProtocol.Schema.Ext.ExtResponse`
[🔗](https://github.com/DROOdotFOO/raxol-agent/blob/raxol_agent_client_protocol-v0.1.0/packages/raxol_agent_client_protocol/lib/raxol/agent_client_protocol/schema/ext.ex#L116)

The reply to an `ExtRequest`.

Unlike most ACP types, `ExtResponse`'s wire representation is
*transparent*: the JSON-RPC result body IS the wrapped `data` term
verbatim (see `to_json/1`), not an envelope like `%{"data" => ...}`. This
mirrors the upstream `f1729/agent_client_protocol` behavior, since an
extension's response shape is defined entirely by the extension itself —
ACP core has no opinion on it.

## Fixed defect

The upstream library's `__using__`-injected default implementation of
`ext_method/1` (in its `ACP.Client`/`ACP.Agent` behaviours) constructed
`%ACP.ExtResponse{value: nil}` — but the struct's only field is `:data`,
so that default raised `KeyError` on every un-overridden `_ext/*` request.
This module fixes its half of that mismatch: the struct field is `:data`
everywhere (construction, `to_json/1`, `from_json/1`), and `empty/0` is
the canonical, crash-proof "no extension implemented" response — callers
wiring an ACP behaviour's default `ext_method/1` should return
`{:ok, ExtResponse.empty()}`, never hand-roll the struct.

Ported from the MIT `f1729/agent_client_protocol` (c) 2025 f1729; see NOTICE.md.

# `t`

```elixir
@type t() :: %Raxol.AgentClientProtocol.Schema.Ext.ExtResponse{data: term()}
```

# `empty`

```elixir
@spec empty() :: t()
```

The canonical "no extension implemented" response — safe to return from
an un-overridden `ext_method/1` callback. Never raises, unlike the
upstream library's `%ExtResponse{value: nil}` default.

# `from_json`

```elixir
@spec from_json(term()) :: {:ok, t()}
```

Wrap an already-decoded wire value as an ExtResponse. Total and infallible
by construction — any term is a valid `data` payload.

# `new`

```elixir
@spec new(term()) :: t()
```

Wrap an arbitrary term as an ExtResponse.

# `to_json`

```elixir
@spec to_json(t()) :: term()
```

The raw wire value for this response: just the wrapped `data`, unwrapped.

---

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