readings-window
aien-dev/readings-window
Brought by drakestapleton
GitHub aien-dev/readings-window#6 (code only)
Apply it
git checkout -b patch-03ba3b922079b703 bb39d99a9c7cbe6f6d618d45ba21d0b8c9301c2b curl -fsSL https://interplane.io/drakestapleton/readings-window/patches/03ba3b922079b703.patch | git am
Provenance
github-import 1
aien-dev/readings-window
6
f2dde2943a25d269a091d79f4993370413009c6a
{"kind":"github-import","owner":"aien-dev","repo":"readings-window","number":6,"url":"https://github.com/aien-dev/readings-window/pull/6","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:40:29Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/README.md b/README.md index f9486b1..f73e5e0 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ # readings-window A read-only, token-protected HTTPS window onto the Spark's GPU and CPU readings, served from the Pi "hub". -A small Rust service: it collects one JSON line of readings from the Spark every 15 seconds over ssh, keeps 30 days of history, and serves it to anyone holding the bearer token. +A small Rust service. `collect` fetches one JSON line of readings from the Spark over ssh (the hub's timer runs it every 15 seconds, see `NOTES.md`; the timer is not in this repository) and keeps 30 days of history. `serve` hands it out to anyone holding the bearer token. ## Endpoints -- `GET /health`: liveness plus an `exposure` field (`ok|changed|unknown`). +- `GET /health`: no token needed. Returns `status`, `last_reading_age_s` and an `exposure` field (`ok|changed|unknown`). - `GET /v1/readings/current`, `GET /v1/readings/history?hours=N` (default 24, max 720). - `GET /v1/status`, `GET /v1/results`, `GET /v1/exposure`. - `GET /v1/chat` returns `{"agents":["claude","codex","opencode","gemini","muse"]}` so a client can discover the feeds. -- `GET /v1/chat/<agent>` (plain text) and `GET /v1/chat/<agent>.jsonl` (common JSON records, `application/x-ndjson`) for exactly those five agents; any other name is 404. `?lines=N` gives the last N lines (default 500, max 50000) of the rolling window of the agent archive. `?all=1` gives the whole rolling window (plain) or the complete record history, all dates in order (jsonl). Proxied live from the Spark on every request (no hub disk writes). 502 `{"error":"spark unreachable"}` if the Spark cannot be reached. +- `GET /v1/chat/<agent>` (plain text) and `GET /v1/chat/<agent>.jsonl` (common JSON records, `application/x-ndjson`) for exactly those five agents; any other name is 404. `?lines=N` gives the last N lines (default 500, max 50000) of the rolling window of the agent archive. `?all=1` gives the whole rolling window (plain) or the complete record history, all dates in order (jsonl). Proxied live from the Spark on every request (no hub disk writes). 502 `{"error":"spark unreachable"}` if the Spark cannot be reached or the remote command fails (for example the archive file is missing). - All `/v1/*` routes need `Authorization: Bearer <token>`. The token and the TLS key live on the hub only (`/etc/readings-window/`), never in this repository. ## Commands -- `readings-window collect`: fetch one reading from the Spark and append it to the history file. +- `readings-window collect`: fetch one reading from the Spark, append it to the history file and drop entries older than 30 days. It also refreshes the cached copies of the Spark's status and results files that `/v1/status` and `/v1/results` serve. - `readings-window serve`: HTTPS server on port 9443. -`scripts/` holds the exposure watch: a 15-minute timer that scans our own public IP from inside the LAN (the router hairpin view, which is not the same as the internet view) and flags any change against an accepted baseline in `/etc/exposure-watch/baseline.json`. +`scripts/` holds the exposure watch: a 15-minute timer that scans our own public IP from inside the LAN (the router hairpin view, which is not the same as the internet view) and flags any change against an accepted baseline in `/etc/exposure-watch/baseline.json`. It also flags UPnP being on and the `hs` and `readings` DNS records not matching the public IP. Operational notes, unit names and the deployment layout are in `NOTES.md`. Build: `cargo build --release`. No Python. License: AGPL-3.0-or-later (see LICENSE).