Documentation
¶
Overview ¶
Package opencode reads `opencode run --format json` runs.
OpenCode prints a step_finish line as each model request ends, with that request's tokens and OpenCode's own price for it. Each step is one set of rows, and the wrapper prices the run after every step, so a run is stopped at the cap between steps. OpenCode's price stays the agent's own figure; the rows are priced from the catalog.
Index ¶
Constants ¶
const (
// Name is the costroid/agent tag.
Name = "opencode"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct{}
Agent is OpenCode.
func (Agent) NewSession ¶
NewSession starts reading a run of the planned command. It reads the version from the command's own opencode, and the basis from the key the provider runs on.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session reads one OpenCode run. Feed and Tail run on separate goroutines, so the lock covers everything below it.
func (*Session) Feed ¶
Feed reads one stdout line. A line whose shape this reader does not know is skipped and counted. A step_finish line that cannot be read stops the run's reading at Finish, because it holds the run's figures.