codex

package
v0.2.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package codex adapts the Codex app-server protocol to the runner harness.

Credentials

The Codex login session is supplied by the caller with every launch (harness.Launch.Credential) and materialized as the worker home's auth.json for the duration of that one launch. Nothing on the host stays signed in, so authentication is an outcome of an attempt rather than a property of the runner: Probe never reports on it.

Index

Constants

View Source
const (
	// HarnessName is what the runner advertises in its capabilities response.
	// It happens to equal the selector a person writes, unlike Claude Code's;
	// see pkg/runner/harness/names.go for why both names exist.
	HarnessName = "codex"
)

Variables

This section is empty.

Functions

func New

func New(cfg Config) harness.Adapter

New constructs a Codex harness adapter. The returned adapter starts no process until Probe or Run is called.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter is the Codex implementation of harness.Adapter.

func (*Adapter) Probe

func (a *Adapter) Probe(ctx context.Context) (harness.Info, error)

Probe checks the binary version and that the app-server answers the handshake. It deliberately reports nothing about authentication: the harness credential arrives with each launch, so a host with no Codex login is still a ready runner and a signed-out state is a per-attempt outcome.

func (*Adapter) Run

func (a *Adapter) Run(ctx context.Context, launch harness.Launch, emit harness.Emit) (result harness.Result, err error)

Run materializes the launch credential as the home's auth.json, starts one dedicated app-server process, creates or resumes exactly one thread, starts one turn, forwards events, then stops the process and removes the credential before it returns. A resumed session is never silently replaced with a new thread, and a launch without a usable Codex credential starts no process.

type Config

type Config struct {
	Binary string
	// Home is a runner-owned CODEX_HOME. It must be separate from an
	// interactive user's Codex home and independently signed in by the worker.
	Home string
	// WorktreeRoot permits trust-only configuration for managed task checkouts.
	WorktreeRoot    string
	Model           string
	ExpectedVersion string
}

Config selects the Codex executable and its isolated worker home.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL