# `Codex.Items`
[🔗](https://github.com/nshkrdotcom/codex_sdk/blob/v0.16.1/lib/codex/items.ex#L1)

Typed representations of thread items emitted by the Codex runtime.

This module provides helpers to convert JSON-style maps (with string keys)
into structs and back, keeping status fields normalised as atoms.

# `t`

```elixir
@type t() ::
  Codex.Items.AgentMessage.t()
  | Codex.Items.Plan.t()
  | Codex.Items.Reasoning.t()
  | Codex.Items.CommandExecution.t()
  | Codex.Items.FileChange.t()
  | Codex.Items.UserMessage.t()
  | Codex.Items.ImageView.t()
  | Codex.Items.ReviewMode.t()
  | Codex.Items.McpToolCall.t()
  | Codex.Items.DynamicToolCall.t()
  | Codex.Items.CollabAgentToolCall.t()
  | Codex.Items.WebSearch.t()
  | Codex.Items.ImageGeneration.t()
  | Codex.Items.TodoList.t()
  | Codex.Items.Error.t()
  | Codex.Items.ContextCompaction.t()
  | Codex.Items.GhostSnapshot.t()
  | Codex.Items.Compaction.t()
  | Codex.Items.RawResponseItem.t()
```

# `parse!`

```elixir
@spec parse!(map()) :: t()
```

Parses a JSON-decoded map into a typed thread item struct.

# `parse_raw_response_item`

```elixir
@spec parse_raw_response_item(map()) :: {:ok, t()} | {:error, term()}
```

Parses a raw response item (snake_case response output) into a typed struct.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Converts a typed item struct back into its JSON-serialisable map representation.

---

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