#!/usr/bin/env bash
# zeq_compute.sh — minimal curl smoke test against /api/zeq/compute (v1.1.3)
#
#   export ZEQ_TOKEN=zeq_ak_...
#   ./zeq_compute.sh                       # NM21 Earth-Moon gravity
#   ./zeq_compute.sh NM19 '{"m":10,"a":9.8}'
#
# Requires: curl, and optionally jq for pretty output.
#
# [Zeq OS Daemon] HulyaPulse 1.287 Hz — τ_zeqond = 0.777 s — α_K = 0.00129
set -euo pipefail

: "${ZEQ_TOKEN:?Set ZEQ_TOKEN=zeq_ak_... first}"

OPERATOR="${1:-NM21}"
INPUTS="${2:-{\"m1\":5.972e24,\"m2\":7.342e22,\"r\":3.844e8}}"

curl -sS \
  --fail-with-body \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${ZEQ_TOKEN}" \
  -d "{\"operator_id\":\"${OPERATOR}\",\"inputs\":${INPUTS}}" \
  https://www.zeq.dev/api/zeq/compute \
  | (command -v jq >/dev/null && jq . || cat)
