Documentation
¶
Overview ¶
Package codex inspects and controls explicitly selected native Codex runtimes.
Index ¶
- Constants
- func ReadIdentity(home string) (accounts.ActiveIdentity, string, error)
- func RunCommand(ctx context.Context, name string, args ...string) ([]byte, error)
- type Client
- type ClientKind
- type CommandRunner
- type Config
- type CredentialProof
- type CredentialResolution
- type CredentialResolutionError
- type CredentialResolveRequest
- type CredentialResolver
- type Inspector
- func (i Inspector) Inspect(ctx context.Context) (Observation, error)
- func (i Inspector) InspectSelection(ctx context.Context) (Observation, error)
- func (i Inspector) Socket() string
- func (i Inspector) VerifyFreshSelection(ctx context.Context, previous ProcessRecord, expected NativeSelection) (CredentialProof, error)
- type NativeSelection
- type Observation
- type Process
- type ProcessRecord
- type RPC
- type ServerInfo
Constants ¶
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.
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 ¶
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 ¶
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 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 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) 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) 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 ProcessRecord ¶
type RPC ¶
type RPC struct {
Info ServerInfo
// contains filtered or unexported fields
}
func DialRPC ¶
DialRPC connects only to an explicitly selected, same-user private Unix socket. No TCP fallback, ambient proxy, daemon startup or account refresh occurs.