ObanCodex.Query (oban_codex v0.5.1)

Copy Markdown View Source

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.

Summary

Functions

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

Functions

run(prompt, opts)

@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}.