interplane.Get Omega
Read in your language

readings-window

aien-dev/readings-window

Brought by drakestapleton

branch main Branches Tags History

readings-window / AGENTS.md

74 lines · 6522 bytes Raw Blame History Source

readings-window (read-only HTTPS window onto the Spark's GPU and CPU readings)

A small Rust service that runs on the project's Raspberry Pi house server. readings-window collect fetches one JSON line of readings from the DGX Spark over ssh and keeps 30 days of history; readings-window serve hands the readings, cached status and results files, the exposure-watch result and the agent chat feeds to anyone holding the bearer token, over HTTPS on port 9443. scripts/ holds the exposure watch, a shell script and systemd timer that scans the house's own public IP. There is no CI in this repository.

Shared rules: read https://www.aienos.com/agents/RULES.md first. This file adds what is specific to this repository; where the two differ, this file wins here.

Scope

Installation

git clone https://github.com/aien-dev/readings-window.git
cd readings-window
cargo build --release

Needs a stable Rust toolchain only. Dependencies are rustls (ring provider, TLS 1.2 and 1.3) and serde_json; rcgen is a dev-dependency for the TLS tests. No Python. The binary is target/release/readings-window.

Configuration

Spark SSH targets come from /etc/readings-window/spark.conf; spark.conf.example documents the format. Each nonempty target=USER@HOST value is tried in file order. Keep real targets local-only, with the same order when migrating an existing deployment. There are no environment-variable or flag overrides. Optional identity=PATH selects an SSH identity on the hub for all targets; the first nonempty value wins. Omission delegates identity selection to the service user's OpenSSH configuration/defaults. Values are trimmed, with no shell expansion or quote removal. Preserve an existing deployment's identity explicitly before deploying this change; keep its real path local-only.

Usage

# Unit tests (20 tests: request parsing, routes, auth, TLS handshake with a generated cert)
cargo test

# Lint (clean at the time of writing)
cargo clippy --all-targets

# Syntax check of the exposure watch
bash -n scripts/exposure-watch.sh

Running the binary with no argument prints usage: readings-window collect|serve and exits 1. Do not run collect or serve on a development machine: collect needs root, the Pi's ssh key and the Spark on the network; serve needs the token, key and certificate under /etc/readings-window/ and binds port 9443. Do not run scripts/exposure-watch.sh either: it scans the public IP with nmap, queries UPnP and writes under /etc and /var/lib. All three only make sense on the Pi.

Endpoints are listed in README.md: /health needs no token; every /v1/* route needs Authorization: Bearer <token>. Wrong or missing token gives 401, unknown path 404, non-GET 405.

Conventions

Safety and approvals

Further reading