Documentation
¶
Overview ¶
Package home resolves the Codex home a router serves ($CODEX_HOME, else ~/.codex) into a stable identity: a short ID hashed from the canonical path and a display name. Sessions are keyed by (home ID, thread ID), so two homes never share state even when their thread IDs collide.
Index ¶
Constants ¶
const LabelSep = " · "
LabelSep separates the parts of a label.
Variables ¶
This section is empty.
Functions ¶
func Disambiguate ¶
Disambiguate returns labels with " · <4-hex>" appended to each label that more than one entry shares. ids[i] belongs to labels[i]. The suffix is hashed from the id, so it works for any id format, including UUIDv7 thread ids whose leading hex is a timestamp. Two colliding ids can still share a suffix (1 in 65536); the labels stay display only.
func Given ¶
Given returns the home path as the user set it, $CODEX_HOME else $HOME/.codex, cleaned with its symlinks kept. Name comes from it, so a process handed this path resolves the same home under the same Name.
func Label ¶
Label is the display label "home · repo · branch", or "home · dir" when cwd is not in a readable repo. It is not an identity (M1).
func RepoBranch ¶
RepoBranch finds the git repo containing cwd by reading .git files, never by running git. A linked worktree reports its main repo's name. Detached HEAD gives the short commit sha. ok is false when cwd is in no repo or the repo's metadata cannot be read.
Types ¶
type Home ¶
type Home struct {
ID string `json:"id"`
Path string `json:"path"` // canonical: symlinks resolved when the dir exists
Name string `json:"name"`
}
Home is one Codex home. ID is the first 12 hex of sha256(Path).