#!/usr/bin/env bash set -euo pipefail AIR=/mnt/c/Users/alexc/IdeaProjects/eventHub/EventHubAiRouter cd "$AIR" python3 -m py_compile router/agent_hier.py router/agent_stream.py router/router.py python3 -m unittest discover -s test/unit -q scp router/agent_hier.py router/agent_stream.py router/router.py \ eventhub-ift:/opt/ai-router-stack/router/ scp config/orchestration.yaml eventhub-ift:/opt/ai-router-stack/config/ ssh -o BatchMode=yes eventhub-ift bash -s <<'REMOTE' set -euo pipefail cd /opt/ai-router-stack set -a; source .env; set +a sed -i 's/\r$//' router/agent_hier.py router/agent_stream.py router/router.py config/orchestration.yaml || true docker build -f router/Dockerfile -t "${ROUTER_IMAGE:-git.sabilin.com/eventhub/ai-router-gateway:ift}" . TS=$(date +%Y%m%d%H%M%S) ORCH="orchestration_config_${TS}" docker config create "$ORCH" ./config/orchestration.yaml OLD_ORCH=$(docker service inspect ai-router_router --format '{{range .Spec.TaskTemplate.ContainerSpec.Configs}}{{println .ConfigName}}{{end}}' | grep orchestration | tail -1 || true) RARGS=(--image "${ROUTER_IMAGE:-git.sabilin.com/eventhub/ai-router-gateway:ift}" --force) RARGS+=(--config-add "source=${ORCH},target=/app/config/orchestration.yaml") [[ -n "${OLD_ORCH:-}" ]] && RARGS+=(--config-rm "$OLD_ORCH") docker service update "${RARGS[@]}" ai-router_router >/dev/null for i in $(seq 1 40); do curl -sf --max-time 5 https://ai-router.ift.calentiq.com/health >/dev/null && break sleep 2 done docker exec "$(docker ps -q -f name=ai-router_router | head -1)" \ grep -E 'executor_synthetic_mode|executor_no_tools_escalate' /app/config/orchestration.yaml echo KICKSTART_NO_TOOLS_OK REMOTE