codex

package
v0.1.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT 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 inspects and controls explicitly selected native Codex runtimes.

Index

Constants

View Source
const (
	CredentialUnknown      = "unknown"
	CredentialLocalFile    = "local-file-mode"
	CredentialFileSelected = "file-selected"
	CredentialFreshProcess = "fresh-process"
)

Variables

This section is empty.

Functions

func ReadIdentity

func ReadIdentity(home string) (accounts.ActiveIdentity, string, error)

ReadIdentity parses local native metadata, not a daemon identity attestation.

func RunCommand

func RunCommand(ctx context.Context, name string, args ...string) ([]byte, error)

Types

type Client

type Client struct {
	PID   int        `json:"pid"`
	Kind  ClientKind `json:"kind"`
	Basis string     `json:"basis"`
}

type ClientKind

type ClientKind string
const (
	ClientAttached   ClientKind = "attached"
	ClientStandalone ClientKind = "standalone"
	ClientUnknown    ClientKind = "unknown"
)

type CommandRunner

type CommandRunner func(context.Context, string, ...string) ([]byte, error)

CommandRunner does not return command output in errors, which may contain secrets.

type Config

type Config struct {
	CredentialStore string `toml:"cli_auth_credentials_store" json:"cli_auth_credentials_store"`
	ModelProvider   string `toml:"model_provider" json:"model_provider"`
	SQLiteHome      string `toml:"sqlite_home" json:"sqlite_home"`
}

func ReadConfig

func ReadConfig(home string) (Config, error)

type CredentialProof

type CredentialProof struct {
	Status        string                  `json:"status"`
	Basis         string                  `json:"basis,omitempty"`
	Reason        string                  `json:"reason,omitempty"`
	Warning       string                  `json:"warning,omitempty"`
	EffectiveMode string                  `json:"effectiveMode,omitempty"`
	StartupCWD    string                  `json:"startupCwd,omitempty"`
	FileIdentity  accounts.ActiveIdentity `json:"fileIdentity"`
}

type CredentialResolution

type CredentialResolution struct {
	Status        string
	EffectiveMode string
	Basis         string
	Snapshot      string
	Warning       string
}

type CredentialResolutionError

type CredentialResolutionError struct{ Reason string }

CredentialResolutionError carries a sanitized capability boundary suitable for status output. Other resolver errors remain deliberately opaque.

func (*CredentialResolutionError) Error

func (e *CredentialResolutionError) Error() string

type CredentialResolveRequest

type CredentialResolveRequest struct {
	Home                string
	CWD                 string
	Env                 []string
	EnvironmentComplete bool
	Selection           accounts.ActiveIdentity
	LaunchArgs          []string
}

type CredentialResolver

type CredentialResolver interface {
	ResolveCredentialConfig(context.Context, CredentialResolveRequest) (CredentialResolution, error)
}

CredentialResolver is the deliberately narrow extension point for proving a stopped runtime's future credential mode. The native user config alone is not enough: callers must resolve every supported config source for the startup cwd.

func NewLocalCredentialResolver

func NewLocalCredentialResolver(run CommandRunner) CredentialResolver

NewLocalCredentialResolver proves the small stopped-runtime configuration subset that can be established without starting Codex or contacting a server. The result is local-file-mode, not effective-runtime proof: for a logged-in selection, an enterprise cloud bundle remains unresolved until Codex reopens.

type Inspector

type Inspector struct {
	Home    string
	Binary  string
	Version string
	Run     CommandRunner
	// Env and LaunchArgs describe the replacement process, not an inferred
	// environment for an already-running server. Fresh verification requires
	// LaunchEnvKnown so an omitted variable cannot be mistaken for absence.
	Env            []string
	CWD            string
	Resolver       CredentialResolver
	LaunchArgs     []string
	LaunchEnvKnown bool
}

func (Inspector) Inspect

func (i Inspector) Inspect(ctx context.Context) (Observation, error)

func (Inspector) InspectSelection

func (i Inspector) InspectSelection(ctx context.Context) (Observation, error)

InspectSelection establishes native selection/config evidence without asking whether conversations can be stopped. Account import does not stop them.

func (Inspector) Socket

func (i Inspector) Socket() string

func (Inspector) VerifyFreshSelection

func (i Inspector) VerifyFreshSelection(ctx context.Context, previous ProcessRecord, expected NativeSelection) (CredentialProof, error)

VerifyFreshSelection is for the post-start phase of a switch. It attests only that a fresh managed process started from the reread target file under the resolved file-backed config; it does not claim the server exposed native IDs.

type NativeSelection

type NativeSelection struct {
	Identity accounts.ActiveIdentity
	Snapshot string
}

NativeSelection is an exact, credential-free fingerprint of one auth.json selection. Capture it after activation and before starting a replacement.

func ReadNativeSelection

func ReadNativeSelection(home string) (NativeSelection, error)

type Observation

type Observation struct {
	Daemon        switcher.Daemon         `json:"daemon"`
	Home          string                  `json:"codexHome"`
	Version       string                  `json:"version,omitempty"`
	Config        Config                  `json:"config"`
	SelectedFile  accounts.ActiveIdentity `json:"selectedFileIdentity"`
	SelectedEmail string                  `json:"selectedFileEmail,omitempty"`
	Email         string                  `json:"-"` // compatibility alias for SelectedEmail
	Credential    CredentialProof         `json:"credentialProof"`
	Busy          []string                `json:"busy,omitempty"`
	ActivityKnown bool                    `json:"activityKnown"`
	ActivityError string                  `json:"activityError,omitempty"`
	Clients       []Client                `json:"clients"`
	Warnings      []string                `json:"warnings,omitempty"`
	Record        *ProcessRecord          `json:"-"`
	// contains filtered or unexported fields
}

type Process

type Process struct {
	PID     int
	Command string
}

type ProcessRecord

type ProcessRecord struct {
	PID       int    `json:"pid"`
	StartTime string `json:"processStartTime"`
}

type RPC

type RPC struct {
	Info ServerInfo
	// contains filtered or unexported fields
}

func DialRPC

func DialRPC(ctx context.Context, socket, version string) (*RPC, error)

DialRPC connects only to an explicitly selected, same-user private Unix socket. No TCP fallback, ambient proxy, daemon startup or account refresh occurs.

func (*RPC) Call

func (r *RPC) Call(ctx context.Context, method string, params any, result any) error

Call ignores unrelated notifications and never includes server payloads in errors. The client is deliberately serial: background streaming is not a Verso feature.

func (*RPC) Close

func (r *RPC) Close() error

type ServerInfo

type ServerInfo struct {
	UserAgent  string `json:"userAgent"`
	CodexHome  string `json:"codexHome"`
	PlatformOS string `json:"platformOs"`
}

Jump to

Keyboard shortcuts

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