#!/usr/bin/env bash
# Label-free quickstart step 7 — read a user's state: the embedding and the
# score of the DERIVED label, with the same freshness and fingerprint trail.
set -euo pipefail

: "${TESSERA_API_BASE:?e.g. https://api.staging.tessera.zone/v1}"
: "${TESSERA_API_KEY:?your tsk_test_… key}"

STATE="$(curl -sS "$TESSERA_API_BASE/slots/quickstart/entities/user/u_00001/state" \
  -H "Authorization: Bearer $TESSERA_API_KEY")"
echo "$STATE" | python3 -m json.tool

printf '%s' "$STATE" | python3 -c '
import json, sys
state = json.load(sys.stdin)
print("embedding_dimension:", len(state["embedding"]))
print("score churn_30d present:", "churn_30d" in state["scores"])
print("model_fingerprint:", state["freshness"]["model_fingerprint"])
'
