#!/usr/bin/env bash
set -euo pipefail
RUNTIME="openclaw"
DISPLAY="OpenClaw"
BRIDGE_URL="${EVOICE_BRIDGE_URL:-${BRIDGE_BASE_URL:-}}"
if [ -z "$BRIDGE_URL" ]; then
  cat <<MSG
$DISPLAY E:Voice integration health
status=not_probed
reason=EVOICE_BRIDGE_URL or BRIDGE_BASE_URL is not set
hint=Set the phone-reachable bridge URL for this runtime, then re-run bin/health.
MSG
  exit 0
fi
if command -v curl >/dev/null 2>&1; then
  curl -fsS --connect-timeout 10 --max-time 30 "$BRIDGE_URL/health" || curl -fsS --connect-timeout 10 --max-time 30 "$BRIDGE_URL/api/health"
else
  echo "status=not_probed"
  echo "reason=curl is not installed"
  exit 1
fi
