# Moxon Metrics (Rust)

The Rust rebuild of Moxon Metrics, Linux first (desktop and headless). It keeps the contracts of the Python
3.x apps: the SQLite schema, the `/api/...` routes, the settings file, the helper's JSON files and relay
protocol 1.1, so 4.0 installs over 3.x without losing history, settings or relay pairing.

| Crate | What it is |
|---|---|
| `moxon-core` | paths, settings, database schema, shared helpers |
| `moxon-probes` | Linux readers: processor, memory, disks, drives, network, Wi-Fi, battery, sensors, graphics, processes, containers, network map |
| `moxon-agent` | the per-user background service: recorder and alerts (later: sharing, relay link, terminal host) |
| `moxon-alerts` | alert rules, unusual-activity detection, delivery: desktop, ntfy, Telegram, email, SMS (Twilio or any HTTP provider), WhatsApp (Meta or Twilio) |
| `moxon-desktop` | the app (`moxon-metrics`): native window (Tauri on WebKitGTK) showing `web/` in-process through the `moxon://` scheme, no browser or port; tray icon with live label, pause alerts, quit |
| `moxon-api` | the local data API behind the window (same routes and JSON as 3.x); `moxon-api-dev` serves it with the page for testing |

Build: `cargo build --release`. Tests: `cargo test`.

`web/` is the window's page for 4.0 (copied from 3.3 and developed here from now on). Try it against the Rust API: run `moxon-api-dev` from the repository folder and open the printed address.
Parity checks against the Python apps: `tools/parity-recorder.py` (recorder) and `tools/parity-api.py` (every read route).

Package: build `moxon-agent` and `moxon-metrics` on Ubuntu 22.04 (`cargo build --release -p moxon-agent -p moxon-desktop`, needs libwebkit2gtk-4.1-dev, libgtk-3-dev, libayatana-appindicator3-dev), then `./build-deb.sh target/release ../moxon-linux` → `dist/moxon-metrics_<version>_amd64.deb`. Until phases 4-6 are rebuilt the package carries the 3.3 helper, sharing, relay link and terminal host.
