AgentHarness.Providers.Codex.ExecConnection (AgentHarness v0.3.0)

Copy Markdown View Source

App-server connection that runs codex app-server through an AgentHarness.Exec implementation instead of the SDK's subprocess transport.

The codex app-server speaks newline-delimited JSON-RPC on stdio. This GenServer keeps the whole protocol on the orchestrator — the initialize handshake, request/response correlation, notification fan-out, and server-initiated requests (approvals) — while the CLI process itself runs wherever the configured exec module puts it.

The process answers the same call messages as the SDK's own connections (Codex.AppServer.Connection and Codex.AppServer.RemoteConnection, both private), so everything downstream in the SDK — Codex.Thread, Codex.AppServer.respond/3, the harness ConnectionProxy — works against this pid unchanged. It intentionally mirrors the SDK's remote connection and reuses its protocol helpers; treat codex_sdk upgrades as a review point for this file.

Options

  • :exec{module, opts} implementing AgentHarness.Exec. Defaults to {AgentHarness.Exec.Local, []}.
  • :owner — pid whose death tears the connection down. Optional.
  • :client_name, :client_version, :client_title, :experimental_api — initialize handshake identity.
  • :init_timeout_ms — handshake deadline.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

spec()

@type spec() :: AgentHarness.Exec.spec()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start(spec, opts \\ [])

@spec start(
  spec(),
  keyword()
) :: {:ok, pid()} | {:error, term()}

stop(conn)

@spec stop(pid()) :: :ok