daemon

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package daemon inspects the shared Codex app-server daemon that Codex v0.157.0 and later starts by default. The daemon loads auth.json once and caches the credentials, so it does not notice when codexctl replaces the file; only a restart makes it reload.

Detection is passive: it reads the daemon's pid file and checks that its control socket accepts a connection. It never speaks the app-server protocol, never starts or stops a daemon, and never reads credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SocketPath

func SocketPath(codexHome string) string

SocketPath is the daemon's control socket. On Unix it is a symlink to a socket with a short path, since socket paths are limited in length.

Types

type State

type State int

State is whether a daemon is running for a Codex home.

const (
	// NotRunning means no daemon pid file exists or its process has exited.
	NotRunning State = iota
	// Running means the recorded process is alive and the control socket
	// accepts connections.
	Running
	// Unknown means the evidence is inconsistent, for example a live pid with
	// no answering socket. A daemon must not be restarted in this state.
	Unknown
)

type Status

type Status struct {
	State State
	PID   int
	// StartedAt is when the daemon process started, or zero if that could
	// not be determined. It is only set when the daemon is running.
	StartedAt time.Time
	// Reason explains an Unknown state.
	Reason string
}

Status describes the daemon of one Codex home.

func Detect

func Detect(codexHome string) Status

Detect reports whether a daemon is running for codexHome.

Jump to

Keyboard shortcuts

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