codex

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package codex runs the official Codex CLI as a child process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Path string
}

func Find

func Find() (*CLI, error)

func (*CLI) Login

func (c *CLI) Login(home string, opts LoginOptions, stdio Stdio) error

Login uses home as CODEX_HOME, so the real Codex directory is not touched.

func (*CLI) Logout added in v0.2.0

func (c *CLI) Logout(home string, stdio Stdio) error

func (*CLI) RestartDaemon added in v0.2.1

func (c *CLI) RestartDaemon(home string, stdio Stdio) error

RestartDaemon interrupts every session. Codex starts a daemon if none is running, so the caller must check first.

func (*CLI) Usage added in v0.3.2

func (c *CLI) Usage(ctx context.Context, home string, isolatedHome bool) (Usage, error)

Usage asks a short-lived app server running on home.

type LoginOptions

type LoginOptions struct {
	DeviceAuth  bool
	APIKey      bool
	AccessToken bool
}

LoginOptions may set at most one method; the zero value is a browser login.

type Stdio

type Stdio struct {
	In  io.Reader
	Out io.Writer
	Err io.Writer
}

type Usage added in v0.3.2

type Usage struct {
	AccountID string  `json:"account_id,omitempty"`
	Primary   *Window `json:"primary,omitempty"`
	Secondary *Window `json:"secondary,omitempty"`
}

type Window added in v0.3.2

type Window struct {
	UsedPercent float64   `json:"used_percent"`
	Minutes     int       `json:"window_minutes,omitempty"`
	ResetsAt    time.Time `json:"resets_at,omitzero"`
}

Jump to

Keyboard shortcuts

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