Expand description
§oomtop-cli
The oomtop binary (SPEC §12.2, UX §12.9, §6): every subcommand wired to the other crates through the
APIs in docs/CONTRACTS.md. The pipeline lives in engine::Engine; signals only ever go through
actuator::SignalActuator after an explicit confirmation.
Exit codes: 0 ok / yes · 1 error · 2 usage · 3 yes after reclaim · 4 no.
Modules§
- actuator
- Executes confirmed plans (SPEC §13): refuses unconfirmed plans; SIGKILL only with the second
confirmation; every signal goes through
oomtop_collect::signal::send, which re-verifies(pid, start_time)immediately before signalling and refuses pid ≤ 1 and oomtop itself. Graceful targets run the model server’s own unload action (SPEC §10) registered withSignalActuator::register_gentle; no signal is sent for them. - ansi
- Minimal SGR rendering of theme styles for
oomtop theme preview(the TUI uses ratatui instead). Colors degrade truecolor → 256 → 16 → none exactly like the TUI (UX §12.1.5);defaultand missing colors emit nothing, so the terminal’s own foreground/background show through. - commands
- Subcommand implementations. Every command gets a
Ctx: the layered config (UX §12.1.3) built from the global flags, the config paths it resolved to, and helpers to build the engine and format numbers. - engine
- The sampling pipeline behind every frontend (SPEC §6, §6.2):
Sampler → attribution (detect) → idle/orphan → adapters → history → OOM forecast → likely victim, plus the lineage journal (oomtop-state). Implementsoomtop_core::provider::SnapshotProvider. - profile
- Machine profile (UX §6): hardware facts, detected roles and the adaptations they imply. Built from a
snapshot (pure) plus a bounded scan of the configured model folders (headers are never read), stored in
oomtop-stateand refreshed at most daily. Roles are sticky forROLE_TTL_MSso a model server that isn’t running right now doesn’t erase the “local LLM” role. - termprobe
- Live terminal capability queries (UX §12.10), done once, only when stdin and stdout are both a TTY:
Structs§
- Cli
- Global
Opts - Flags accepted by every subcommand.
- Headroom
Args - Reclaim
Args
Enums§
- Cmd
- Color
Arg - Config
Cmd - KeysCmd
- Offload
- Where a model’s weights are expected to live when estimating
--model. - Profile
Cmd - Theme
Cmd
Constants§
- MAX_
DURATION - Longest
--interval/--waitaccepted: one year. Anything longer is a typo, and durations nearu64::MAXseconds cannot be represented (or added to a clock) at all.
Functions§
- parse_
interval 2s,500ms,1m→ duration (clap value parser). Zero, negative, non-finite and absurdly long values are usage errors (exit 2), never a panic.- parse_
size 13G,500M,1.5GiB→ bytes (clap value parser; a bad value is a usage error, exit 2).- run
- Parses args and runs; returns the process exit code.