Help us shape the future of Go! Take the 2026 Go Developer Survey

codexlive

package
v0.8.12 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventAgentMessageDelta     = "item/agentMessage/delta"
	EventReasoningSummaryDelta = "item/reasoning/summaryTextDelta"
	EventItemCompleted         = "item/completed"
	EventTurnCompleted         = "turn/completed"
	EventThreadTokenUsage      = "thread/tokenUsage/updated"
	EventPermissionRequest     = "server/request/permission"
)
View Source
const AdapterRef = "openai/codex-live"

Variables

View Source
var DefaultEnvAllowlist = []string{"OPENAI_API_KEY", "CODEX_HOME"}

DefaultEnvAllowlist mirrors the strict Codex adapter's auth/config inputs. CODEX_HOME preserves local Codex login/cache context; OPENAI_API_KEY covers API-key based Codex installs.

Functions

func AppServerSchemaDigest

func AppServerSchemaDigest() string

Types

type Adapter

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

func New

func New(opts ...Option) (*Adapter, error)

func (*Adapter) Capabilities

func (*Adapter) Capabilities() agent.Caps

func (*Adapter) Launch

func (*Adapter) PreflightResume

func (a *Adapter) PreflightResume(ctx context.Context, req agent.LiveResumePreflightRequest) error

func (*Adapter) Ref

func (*Adapter) Ref() string

func (*Adapter) RequiredEnv

func (*Adapter) RequiredEnv() []string

RequiredEnv implements agent.CredentialNamer. Returns the CREDENTIAL env var name codex-live authenticates with. OPENAI_API_KEY is defined in DefaultEnvAllowlist; CODEX_HOME is a config directory (not a credential) and is intentionally excluded.

func (*Adapter) ValidateConfig

func (a *Adapter) ValidateConfig(with ir.RawConfig) error

func (*Adapter) Version

func (a *Adapter) Version(ctx context.Context, _ container.Handle) (string, error)

type Client

type Option

type Option func(*Adapter)

func WithBackoff

func WithBackoff(durations []time.Duration) Option

func WithClient

func WithClient(client Client) Option

func WithClock

func WithClock(c clock.Clock) Option

func WithEnv

func WithEnv(env map[string]string) Option

func WithLiveRoot

func WithLiveRoot(root live.Root) Option

func WithPricing

func WithPricing(t pricing.Table) Option

WithPricing injects the pricing.Table used to derive a USD cost from token usage. Tests pass a self-contained fixture table; production leaves it unset so New defaults it to pricing.Default() (embedded rates ⊕ $AWF_PRICING_FILE).

type PermissionRequest

type PermissionRequest struct {
	ID      string
	TurnID  string
	Kind    string
	ToolID  string
	Path    string
	Command string
}

type PermissionResponse

type PermissionResponse struct {
	RequestID string
	ThreadID  string
	TurnID    string
	Allow     bool
	Reason    string
}

type ProviderEvent

type ProviderEvent struct {
	Type   string
	Text   string
	Output map[string]any
	Usage  Usage
	Status string
	Error  string
	// ItemType is the completed item's type on an EventItemCompleted event
	// (e.g. "agentMessage", "command_execution"); empty on other events.
	ItemType string
	// Command / ExitCode carry a completed command_execution item's command line
	// and exit status (ExitCode nil = unknown); Text carries its aggregated output.
	Command    string
	ExitCode   *int
	Permission *PermissionRequest
}

type ProviderInfo

type ProviderInfo struct {
	Version string
	Binary  string
}

type RPCError

type RPCError struct {
	Code    int
	Message string
}

func (*RPCError) Error

func (e *RPCError) Error() string

type ThreadInfo

type ThreadInfo struct {
	ID             string
	TmuxSession    string
	TranscriptPath string
	// Model is the RESOLVED model the app-server picked, surfaced from the
	// thread/start (or thread/resume) response. Preferred over the requested
	// cfg.model when stamping MetricSet.Model and pricing.
	Model string
}

type ThreadResumeRequest

type ThreadResumeRequest struct {
	ThreadID        string
	CWD             string
	Model           string
	ReasoningEffort string
}

type ThreadStartRequest

type ThreadStartRequest struct {
	CWD             string
	Model           string
	ReasoningEffort string
}

type TurnHandle

type TurnHandle struct {
	TurnID string
	Events <-chan ProviderEvent
}

type TurnStartRequest

type TurnStartRequest struct {
	ThreadID        string
	Prompt          string
	OutputSchema    *ir.JSONSchema
	Model           string
	ReasoningEffort string
}

type Usage

type Usage struct {
	InputTokens       int
	OutputTokens      int
	CachedInputTokens int
	// TotalTokens is the cache-inclusion oracle (see normalizeForPricing): when
	// total == input+output, cached is a subset of input (safe to subtract for
	// pricing); otherwise cached is disjoint and must not be subtracted.
	TotalTokens int
}

Jump to

Keyboard shortcuts

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