Files
orinsid 545ed66e74 page-usage-board: a usage dashboard page (#844)
Adds @magpie-community/page-usage-board: a usage dashboard page with its
own zero-dependency local service (quota cards with expiry tiers, TTFT,
7x24 heatmap, optional remote attribution).

Reviewed at 8ca2562: the author's 80137b0 plus a maintainer merge of main
(registry entry re-appended after upstream's newer packages).
Since the 6b2625d review: [::1] in MAGPIE_ADDR stays IPv6 loopback (only
0.0.0.0/[::] map to 127.0.0.1), the config-dir test compares real paths
so it passes on macOS, and the registry-block test tolerates CRLF.

Run on mote at 8ca2562: packages/page-usage-board `bun test` 36 pass,
`node --test test/*.test.mjs` 36 pass; `bun scripts/check.mjs` all ok.
Not tried this round: the page in a live magpie window.
2026-11-10 10:36:04 +08:00

62 lines
3.0 KiB
Bash

# Copy to .env and edit as needed; run the board with `npm start` (or `node server.mjs`).
# Every variable is optional — commented-out lines show the built-in defaults.
# Listen port. Default 3455; 0 = let the OS pick. When the port is held the service
# retries for ~8s, then reuses a live instance of the same build, or fails with a clear
# error when a different build / a foreign process holds it. It never scans upward.
#PORT=3455
# Bind address. Keep the loopback default: the board page answers loopback binds and
# loopback Host names only — a non-loopback bind never serves the page (403).
#HOST=127.0.0.1
# Token for scripts that call the API (send it as the "x-dash-key" request header).
# Optional: when unset, every start generates a random token — not persisted, not logged,
# not in any URL. Set it EMPTY explicitly (PAGE_KEY=) to serve the API without a token.
# Never commit a real key: .env is git-ignored.
#PAGE_KEY=
# Extra Host names the API may be reached by behind a reverse proxy (comma-separated).
# The board page stays loopback-only regardless.
#ALLOWED_HOSTS=
# magpie's local gateway API and its bearer key (live quotas / KPIs).
# Resolution order: manifest options.gateway → GATEWAY → MAGPIE_GATEWAY →
# MAGPIE_ADDR (set by magpie's plugin host) → the 3425 default.
#GATEWAY=http://127.0.0.1:3425
#MAGPIE_KEY=
# magpie's config directory — explicit override only (magpie itself has no such
# env; the service follows the host's cwd, then XDG_CONFIG_HOME/magpie, then
# ~/.config/magpie, so portable installs need nothing here).
# usage.jsonl, plugin-providers.json and providers.json live there.
#MAGPIE_CONFIG_DIR=
# magpie's usage log — the only data source (no prompts or message bodies are read).
#USAGE_JSONL=
# Brand logos: the only source is magpie's own plugin-providers.json (data-URI icons,
# no downloads, no directory scanning). Default: the file next to usage.jsonl.
#MAGPIE_PROVIDERS_FILE=
# ---- Remote attribution: OPT-IN, OFF by default -------------------------------
# ATTRIBUTION=local (default) keeps all attribution on this machine's usage.jsonl.
# ATTRIBUTION=remote makes the service read this machine's magpie providers.json (or
# REMOTE_BASE/REMOTE_KEY below) and send that provider's key to the remote magpie's
# /v1/magpie/usage/requests — the key leaves this machine only toward that remote
# magpie. The equivalent manifest option is options.attribution: "remote".
#ATTRIBUTION=local
# Remote provider credentials (read only when ATTRIBUTION=remote). Default source: the
# preset remote-magpie / magpie-direct / magpie-cf provider in MAGPIE_PROVIDERS.
#MAGPIE_PROVIDERS=~/.config/magpie/providers.json
#REMOTE_BASE=
#REMOTE_KEY=
# Caller names kept for the remote charts. No default: empty means no filtering.
#REMOTE_CALLERS=
# Provider aliases counted as "remote" in the 24-hour split. Default: magpie's own three
# route names; override via manifest options.remoteProviders.
#REMOTE_PROVIDERS=magpie-direct,magpie-cf,remote-magpie