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 ¶
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) NewSession ¶
NewSession starts reading a run of the planned command.
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 ¶
Feed reads one stdout line. Its type is read first, then the fields that type carries, so a field this reader never uses, such as message, can take any shape. A line whose shape this reader does not know is skipped and counted. A turn.completed line that cannot be read stops the run's reading at Finish, because it holds the run's figures.
func (*Session) Finish ¶
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.