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

cd /app

python -m compileall -q lib telegram diagnostics teleo-pipeline.py

python -m pytest -q \
  tests/test_agent_routing.py \
  tests/test_decision_engine_replay.py \
  tests/test_phase1b_end_to_end.py \
  tests/test_research_eval_schema_sql.py \
  tests/test_teleo_agent_systemd.py

python - <<'PY'
import json
from lib.agent_routing import classify_pr_route

route = classify_pr_route(
    "diff --git a/domains/internet-finance/x402-wallets.md b/domains/internet-finance/x402-wallets.md\n"
    "+AI systems route agents around x402 payments and agent wallets.\n"
)

print(json.dumps({
    "smoke": "teleo-gcp-staging-ok",
    "primary_agent": route.primary_agent,
    "required_agents": list(route.required_agents),
    "route_kind": route.route_kind,
}, sort_keys=True))
PY
