# `ObanCodex.Query`
[🔗](https://github.com/genagent/oban_codex/blob/v0.7.1/lib/oban_codex/query.ex#L1)

Translate validated ObanCodex options into fresh or resumed Codex commands.

Most callers use `ObanCodex.run/2`. This module is public for applications
that want the same JSONL command adapter without outcome classification.

# `run`

```elixir
@spec run(String.t(), keyword()) ::
  {:ok, CodexWrapper.Result.t()} | {:error, ObanCodex.Error.t()}
```

Run a fresh turn, resume when `:session_id` is present, or fork when
`:session_id` is present with `fork_session: true`.

A fork runs `codex exec fork` through `CodexWrapper.ExecFork.fork/2`. The
returned `%CodexWrapper.Result{}` carries the NEW thread id in its
`thread.started` event, so `ObanCodex.session_id/1` reads the fork, never the
source. A non-zero exit is returned as a `%Result{success: false}`, as for
fresh and resumed turns. A CLI without `exec fork` returns an
`%ObanCodex.Error{kind: :unsupported}`.

---

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