codex

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractResultFromLog

func ExtractResultFromLog(logPath string) string

ExtractResultFromLog scans a Codex JSON log file and returns the text of the last agent_message item, or "" if none found.

func NewAdapter

func NewAdapter(binaryPath string, extraEnv map[string]string) (ai.EngineAdapter, error)

Types

type Collector added in v0.0.32

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

Collector reads the openbee-UUID → codex-thread-ID mapping written by SessionStore, then locates the session JSONL under codexBase/sessions/.

func NewCollector added in v0.0.32

func NewCollector() *Collector

NewCollector builds a Collector using the default mapping directory and CODEX_HOME (or ~/.codex if unset).

func NewCollectorAt added in v0.0.32

func NewCollectorAt(mappingDir, codexBase string) *Collector

NewCollectorAt is a test seam allowing arbitrary mapping/codex roots.

func (*Collector) Collect added in v0.0.32

func (c *Collector) Collect(_ context.Context, sessionID string) ([]ai.TokenUsage, error)

type Invoker

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

Invoker spawns Codex CLI processes and is safe for concurrent use.

func NewInvoker

func NewInvoker(binary string, store *SessionStore, extraEnv map[string]string) *Invoker

NewInvoker creates an Invoker. extraEnv entries are merged into the base environment at lowest priority. OPENBEE_URL is inherited from the server process environment.

func (*Invoker) Run

func (inv *Invoker) Run(ctx context.Context, workDir, prompt string, opts ai.RunOptions, logPath string) (ai.Process, <-chan ai.Output, error)

Run starts a Codex CLI process, redirecting output to logPath. For new sessions, prompt is passed via stdin; for resumes, the thread_id is resolved from the store.

type SessionStore

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

SessionStore maps openbee session UUIDs to codex thread IDs on disk. Per-session files avoid concurrent write conflicts between sessions.

func NewSessionStore

func NewSessionStore() (*SessionStore, error)

NewSessionStore creates a SessionStore rooted at the default location.

func (*SessionStore) Get

func (s *SessionStore) Get(openbeeUUID string) (string, bool)

func (*SessionStore) Set

func (s *SessionStore) Set(openbeeUUID, threadID string) error

Set writes the codex thread_id for the given openbee UUID. Writes are atomic via temp-file rename.

Jump to

Keyboard shortcuts

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