# `CodexWrapper.JsonLineEvent`
[🔗](https://github.com/genagent/codex_wrapper_ex/blob/v0.5.3/lib/codex_wrapper/json_line_event.ex#L1)

A single event from codex's `--json` NDJSON output.

When using `--json`, the codex CLI emits one JSON object per line.
Each event has an event type and associated data.

## Event types

Common event types include:
- `"thread.started"` -- thread initialization
- `"turn.started"` -- turn began
- `"item.completed"` -- item completed
- `"turn.completed"` -- turn finished

# `t`

```elixir
@type t() :: %CodexWrapper.JsonLineEvent{
  data: map(),
  event_type: String.t() | nil,
  raw: String.t()
}
```

# `data`

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

Return the full data map.

# `event_type`

```elixir
@spec event_type(t()) :: String.t() | nil
```

Return the event type string.

# `get`

```elixir
@spec get(t(), String.t(), term()) :: term()
```

Get a value from the data map by key.

# `parse`

```elixir
@spec parse(String.t()) :: {:ok, t()} | {:error, term()}
```

Parse a single NDJSON line into a `%JsonLineEvent{}`.

# `parse_lines`

```elixir
@spec parse_lines(String.t()) :: [t()]
```

Parse multiple NDJSON lines from stdout into a list of events.

Filters for lines that look like JSON objects and silently drops
lines that fail to parse.

# `parse_stream`

```elixir
@spec parse_stream(Enumerable.t()) :: Enumerable.t()
```

Parse a lazy stream of NDJSON lines into a lazy stream of events.

The streaming counterpart of `parse_lines/1`: same silent drop of
lines that do not parse, no buffering of the whole run. Used by
`Exec.stream/2`, `ExecResume.stream/2`, and `Review.stream/2` over the
lines their `CodexWrapper.Runner` produces.

# `type?`

```elixir
@spec type?(t(), String.t()) :: boolean()
```

Whether this event matches the given type.

---

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