codex

package
v1.0.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 21 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

Overview

Package codex reads `codex exec --json` runs.

The stream reports usage once, at turn.completed, as a running total for the thread, and one prompt is one turn. So the budget is watched in the rollout file Codex writes during the turn, which also gives per-request rows. The stream stays as the check on the file and as the record when it cannot be read.

Index

Constants

View Source
const (

	// UnknownModel stands in when neither the command nor the config names
	// a model. It prices at the catalog's fallback tier.
	UnknownModel = "unknown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct{}

Agent is the Codex CLI.

func (Agent) Name

func (Agent) Name() string

Name returns the costroid/agent tag.

func (Agent) NewSession

func (Agent) NewSession(plan adapter.Plan) adapter.Session

NewSession starts reading a run of the planned command.

func (Agent) Plan

func (Agent) Plan(argv []string, _ decimal.Decimal) (adapter.Plan, error)

Plan adds --json. Codex has no budget flag, so the wrapper watches the rollout file, and a run that writes none has nothing holding it to the budget.

type Session

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

Session reads one Codex run. Feed and Tail run on separate goroutines, so the lock covers everything below it.

func (*Session) Feed

func (s *Session) Feed(line []byte, at time.Time) error

Feed reads one stdout line.

func (*Session) Finish

func (s *Session) Finish() (adapter.Report, error)

Finish returns the run's usage and the grade it earned. Per-request rows from the rollout files stand unless the stream's total contradicts them. A run with neither source reported nothing, and whatever it spent is unknown.

func (*Session) Tail

func (s *Session) Tail(ctx context.Context, settled func([]adapter.Request))

Tail follows the thread's rollout file until ctx ends, then reads it once more for the lines the agent wrote last.

Jump to

Keyboard shortcuts

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