Documentation
¶
Overview ¶
Package registry is the shared list of running routers: $XDG_STATE_HOME/codex-router/registry (else ~/.local/state/...), one <endpoint_id>.json file per control endpoint. Every shell sees the same dir whatever its TMPDIR. An entry is only a hint: clients confirm it with a hello handshake, and readers prune entries whose endpoint is gone.
Index ¶
Constants ¶
const ( KindSession = "session" KindBrain = "brain" )
Endpoint kinds: a stage 1 launcher session or a stage 2 per-home brain.
Variables ¶
This section is empty.
Functions ¶
func Alive ¶
Alive reports whether ep's socket answers or its process still exists. The pid check keeps an endpoint that has registered but not yet listens. A reused pid keeps a dead entry until that process exits too; the hello handshake catches it meanwhile.
func List ¶
List returns the entries in root ordered by start time. Files that are not regular, do not parse, or whose endpoint_id differs from the file name are returned as skipped instead of failing the whole list.
func Prune ¶
Prune removes ep's entry, read earlier by List, when its endpoint is dead (Alive). An entry rewritten since (a restart reusing the id) stays: Prune re-reads it and removes it only if its pid and start time are unchanged. A write between that read and the remove can still lose; the entry then comes back with the endpoint's next registration.
func Remove ¶
Remove deletes the entry for id. A missing entry is not an error: a reader may have pruned it first.
func Root ¶
Root returns the registry dir, $XDG_STATE_HOME/codex-router/registry, else ~/.local/state/codex-router/registry, creating it 0700. Relative values are ignored. Both the codex-router dir and the registry dir must be private to this user: whoever can write there can point clients at their own socket.