Help us shape the future of Go! Take the 2026 Go Developer Survey

codex

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Overview

Package codex is the Codex harness adapter. It drives one long-running `codex app-server` process over JSON-RPC on stdio (CONTRACT.md):

  • CODEX_HOME is <runner>/codex on the seat volume, so threads (rollouts and state databases) survive Pod replacement and resume natively;
  • config.toml points a custom provider at the seat's model forwarder (wire_api "responses", the only API Codex speaks) with a placeholder key, and adds steadmesh-tools as a required stdio MCP server whose tools are approved without prompting;
  • threads run with approval policy "never" and danger-full-access: the seat Pod is the boundary;
  • a turn is turn/start ... turn/completed; interruption is turn/interrupt.

Checkpoint = thread id + Codex version (application_checkpoint). A thread that cannot be resumed is replaced by a new one seeded with the portable handoff, and the turn reports it.

Index

Constants

View Source
const (
	// AdapterName is the harness profile adapter value.
	AdapterName = "codex"
	// PinnedVersion is the verified Codex release (CONTRACT.md).
	PinnedVersion = "0.160.1"
	// SessionFormatPrefix prefixes Checkpoint.FormatVersion.
	SessionFormatPrefix = "codex-thread/"
	// MCPServerName is the tool bridge's server name; Codex presents its
	// tools in the Responses namespace mcp__steadmesh.
	MCPServerName = "steadmesh"
	// ProviderID is the custom model provider; built-in IDs are reserved.
	ProviderID = "steadmesh"

	// SettingReasoningEffort is passed as turn/start effort.
	SettingReasoningEffort = "reasoning_effort"
)
View Source
const (
	ConfigBinary         = "codex_bin"       // default "codex"
	ConfigVersion        = "version"         // when set, Prepare requires exactly this version
	ConfigInterruptGrace = "interrupt_grace" // Go duration, default 15s
)

Harness profile config keys.

Variables

This section is empty.

Functions

func ConfigTOML

func ConfigTOML(env harnesses.Environment) string

ConfigTOML renders $CODEX_HOME/config.toml (CONTRACT.md §2, §3, §5).

Types

type Adapter

type Adapter struct {

	// Tap, when set before StartOrResume, receives every raw protocol line.
	Tap func(line []byte)
	// contains filtered or unexported fields
}

Adapter runs Codex.

func New

func New() *Adapter

New returns a Codex adapter.

func (*Adapter) Checkpoint

func (a *Adapter) Checkpoint(ctx context.Context) (runtimeapi.Checkpoint, error)

func (*Adapter) Deliver

func (*Adapter) DescribeCapabilities

func (a *Adapter) DescribeCapabilities() harnesses.Capabilities

func (*Adapter) Events

func (a *Adapter) Events() <-chan harnesses.Event

func (*Adapter) Prepare

func (a *Adapter) Prepare(ctx context.Context, env harnesses.Environment) error

func (*Adapter) Quiesce

func (a *Adapter) Quiesce(ctx context.Context) (harnesses.QuiesceResult, error)

func (*Adapter) StartOrResume

func (*Adapter) Stop

func (a *Adapter) Stop(ctx context.Context) error

type SessionState

type SessionState struct {
	ThreadID       string    `json:"thread_id"`
	CodexVersion   string    `json:"codex_version"`
	ConfigRevision string    `json:"config_revision,omitempty"`
	Turns          int       `json:"turns"`
	UpdatedAt      time.Time `json:"updated_at"`
}

SessionState is <runner>/codex-state.json.

Jump to

Keyboard shortcuts

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