Expand description
oxibrain daemon lifecycle control — bring a brain·down daemon back.
The TUI’s health chip only observes (brain.rs probes); this module
acts. When the daemon is installed but stopped, /brain revives it:
- launchd (macOS, plist present):
launchctl bootstrapa service that is not loaded,launchctl kickstartone that is. launchd keeps supervising it afterwards (KeepAlive), which is the correct home for a daemon —oxibrain serve --daemondeliberately does not fork. - Detached spawn (no plist / non-macOS): start
oxibrain serve --daemon --socket <canonical>in its own process group with null stdio. The orphan survives oxicode’s exit.
When the binary is missing entirely, revival is impossible — the caller surfaces install guidance instead of pretending.
Structs§
- Brain
Control Report - Environment facts the plan is derived from (injectable for tests).
Enums§
- Revive
Action - What the revive step decided to do.
Constants§
- BRAIN_
SERVICE_ LABEL - launchd service label used by the oxibrain plist.
Functions§
- brain_
plist_ path - Canonical plist location (
~/Library/LaunchAgents/com.oxi.oxibrain.plist). - find_
oxibrain_ binary - Locate the
oxibrainbinary:~/.cargo/binfirst (cargo-installed), thenPATH. - probe_
control - Probe the environment for a control report.
- revive
- Run the plan and wait for the daemon to answer a ping. Returns human-readable outcome lines on success.
- revive_
plan - Decide how to revive from a control report. Pure.
- service_
loaded - Whether the launchd service is loaded (macOS). Non-macOS: false.
- should_
auto_ revive - Whether the background prober should attempt an automatic revive. One attempt per session (success or failure — a broken daemon must not spawn a retry loop), only for users who enabled memory, and never when the binary is missing (that is an install decision, not a restart). Pure.