Skip to main content

Crate oomtop_cli

Crate oomtop_cli 

Source
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 with SignalActuator::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); default and 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). Implements oomtop_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-state and refreshed at most daily. Roles are sticky for ROLE_TTL_MS so 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
GlobalOpts
Flags accepted by every subcommand.
HeadroomArgs
ReclaimArgs

Enums§

Cmd
ColorArg
ConfigCmd
KeysCmd
Offload
Where a model’s weights are expected to live when estimating --model.
ProfileCmd
ThemeCmd

Constants§

MAX_DURATION
Longest --interval / --wait accepted: one year. Anything longer is a typo, and durations near u64::MAX seconds 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.