codex

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package codex implements the TermmuxDriverAdapter for the Codex CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

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

Driver implements TermmuxDriverAdapter for the Codex CLI.

func New

func New() *Driver

New creates a new Codex driver.

func (*Driver) BuildCommandArgs

func (d *Driver) BuildCommandArgs(prependArgs, extraArgs []string) []string

BuildCommandArgs builds the CLI arguments for launching Codex.

func (*Driver) BuildCommandEnvVars

func (d *Driver) BuildCommandEnvVars(runtimeDir string) map[string]string

BuildCommandEnvVars returns environment variables for the child process.

func (*Driver) Command

func (d *Driver) Command() string

func (*Driver) EventHandler

func (d *Driver) EventHandler() *EventHandler

EventHandler returns the underlying event handler for testing.

func (*Driver) HandleHookEvent

func (d *Driver) HandleHookEvent(eventName string, payload json.RawMessage) bool

HandleHookEvent processes hook events. Codex hooks not yet supported.

func (*Driver) HandleInterrupt

func (d *Driver) HandleInterrupt() bool

HandleInterrupt handles an interrupt signal with suppression window.

func (*Driver) Name

func (d *Driver) Name() string

func (*Driver) NativeSessionLogPath

func (d *Driver) NativeSessionLogPath(configDir, cwd, sessionID string) string

NativeSessionLogPath returns empty — Codex session log format is TBD.

func (*Driver) OtelCallbacksForMonitor

func (d *Driver) OtelCallbacksForMonitor(mon *monitor.AgentMonitor) (onLogs, onMetrics, onTraces func(json.RawMessage))

OtelCallbacksForMonitor returns OTEL callbacks for Codex event normalization.

func (*Driver) ParseSessionLog

func (d *Driver) ParseSessionLog(reader io.Reader) ([]driver.ConversationEntry, error)

ParseSessionLog is a V1 non-goal for Codex. Returns error.

func (*Driver) PrepareForLaunch

func (d *Driver) PrepareForLaunch(dryRun bool) (driver.LaunchConfig, error)

PrepareForLaunch prepares the driver for launch.

func (*Driver) SetConfigDir

func (d *Driver) SetConfigDir(dir string)

SetConfigDir sets the config directory for this driver instance.

func (*Driver) Start

func (d *Driver) Start(ctx context.Context, events chan<- monitor.AgentEvent) error

Start begins event processing.

func (*Driver) Stop

func (d *Driver) Stop()

Stop stops the driver.

func (*Driver) SupportsHooks

func (d *Driver) SupportsHooks() bool

func (*Driver) SupportsResume

func (d *Driver) SupportsResume() bool

func (*Driver) WriteSessionLog

func (d *Driver) WriteSessionLog(entries []driver.ConversationEntry, writer io.Writer) error

WriteSessionLog is a V1 non-goal for Codex. Returns error.

type EventHandler

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

EventHandler processes OTEL events from Codex and normalizes them into AgentEvents, with debouncing for out-of-order events.

func NewEventHandler

func NewEventHandler() *EventHandler

NewEventHandler creates a new Codex event handler.

func (*EventHandler) HandleInterrupt

func (eh *EventHandler) HandleInterrupt()

HandleInterrupt records an interrupt event and starts the suppression window.

func (*EventHandler) HandleOtelLogs

func (eh *EventHandler) HandleOtelLogs(payload json.RawMessage) []monitor.AgentEvent

HandleOtelLogs processes OTEL log records from Codex.

func (*EventHandler) HandleOtelMetrics

func (eh *EventHandler) HandleOtelMetrics(_ json.RawMessage) []monitor.AgentEvent

HandleOtelMetrics processes OTEL metrics from Codex.

func (*EventHandler) HandleOtelTraces

func (eh *EventHandler) HandleOtelTraces(payload json.RawMessage) []monitor.AgentEvent

HandleOtelTraces processes OTEL traces from Codex.

func (*EventHandler) SetIdleCallback

func (eh *EventHandler) SetIdleCallback(fn func())

SetIdleCallback sets the function called when the idle debounce timer fires.

func (*EventHandler) Stop

func (eh *EventHandler) Stop()

Stop cleans up the event handler.

Jump to

Keyboard shortcuts

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