# `ExMCP.ACP.Adapters.Codex.Protocol`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.4.0/lib/ex_mcp/acp/adapters/codex/protocol.ex#L1)

Pure native app-server protocol helpers for the Codex ACP adapter.

Owns envelope construction, method names, inbound response classification,
and pending-request correlation shapes. The root adapter retains process
ownership, Port I/O, and lifecycle state.

# `inbound`

```elixir
@type inbound() ::
  {:response, request_id(), {:ok, term()}}
  | {:response, request_id(), {:error, term()}}
  | {:request, request_id(), String.t(), map()}
  | {:notification, String.t(), map()}
  | :unknown
```

# `request_entry`

```elixir
@type request_entry() :: %{type: request_type(), acp_id: term(), meta: map()}
```

# `request_id`

```elixir
@type request_id() :: integer() | String.t()
```

# `request_type`

```elixir
@type request_type() :: atom()
```

# `classify_inbound`

```elixir
@spec classify_inbound(map()) :: inbound()
```

# `decode_line`

```elixir
@spec decode_line(String.t()) :: inbound()
```

# `encode_error`

```elixir
@spec encode_error(request_id(), integer(), String.t()) :: iodata()
```

# `encode_notification`

```elixir
@spec encode_notification(String.t(), map() | nil) :: iodata()
```

# `encode_request`

```elixir
@spec encode_request(request_id(), String.t(), map() | nil) :: iodata()
```

# `encode_response`

```elixir
@spec encode_response(request_id(), term()) :: iodata()
```

# `error`

```elixir
@spec error(request_id(), integer(), String.t()) :: map()
```

# `line`

```elixir
@spec line(map()) :: iodata()
```

# `method`

```elixir
@spec method(atom()) :: String.t()
```

# `methods`

```elixir
@spec methods() :: %{required(atom()) =&gt; String.t()}
```

# `next_id`

```elixir
@spec next_id(integer()) :: {integer(), integer()}
```

# `notification`

```elixir
@spec notification(String.t(), map() | nil) :: map()
```

# `request`

```elixir
@spec request(request_id(), String.t(), map() | nil) :: map()
```

# `request_entry`

```elixir
@spec request_entry(request_type(), term(), map()) :: request_entry()
```

# `response`

```elixir
@spec response(request_id(), term()) :: map()
```

---

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