#!/bin/bash
# Run once Server A (thinking-off) is confirmed healthy.
# SERVER_A_URL = e.g. https://6ac4cbe1fbc85ba6823b360c--30000.hf.jobs

set -e
SERVER_A_URL="$1"
if [ -z "$SERVER_A_URL" ]; then
  echo "usage: deploy_cmd_final.sh <SERVER_A_URL>" >&2
  exit 1
fi

hf jobs run \
  --flavor cpu-basic --expose 8080 --timeout 12h \
  --label project=terminal-bench-harness --label component=think-router \
  --volume hf://buckets/SaylorTwift/harness-evals:/data \
  --env UPSTREAM_BASE_URL="$SERVER_A_URL" \
  --env MODEL_NAME=Qwen/Qwen3.8-27B-FP8 \
  --secrets "UPSTREAM_TOKEN=$(hf auth token)" \
  -d python:3.12-slim \
  bash -c '
    pip install -q -r /data/think-router-code/requirements.txt
    cd /data/think-router-code
    uvicorn app:app --host 0.0.0.0 --port 8080
  '
