#!/usr/bin/env bash
set -euo pipefail

echo 'Waiting for local llama.cpp server on http://127.0.0.1:8081/v1/models ...'
while true; do
  if curl -sf http://127.0.0.1:8081/v1/models >/dev/null 2>&1; then
    break
  fi
  date '+[%Y-%m-%d %H:%M:%S] still waiting for llama.cpp server...'
  sleep 10
 done

echo
echo 'llama.cpp is up. Launching Hermes profile: gemma4-llamacpp'
echo
exec gemma4-llamacpp chat
