#!/bin/bash set -e cd /opt/erp/metallkart-erp COOKIE_JAR=/tmp/mk-admin-cookies.txt # Login (cookies HTTPOnly) curl -s -X POST http://localhost:3001/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"gruart@cifem-rus.ru","password":"MetallKart2026!"}' \ -c "$COOKIE_JAR" -o /tmp/login-resp.json echo "Login: $(cat /tmp/login-resp.json | head -c 100)" echo "Cookies saved: $(wc -l < $COOKIE_JAR) lines" # Trigger supervisor in digest mode (use cookies) RESULT=$(curl -s -X POST http://localhost:3001/api/v1/admin/agent/supervisor/trigger-now \ -H "Content-Type: application/json" \ -b "$COOKIE_JAR" \ -d '{"mode":"digest"}') echo "Trigger result: $RESULT" # Check agent_actions echo "--- Agent Actions (last 2 min) ---" docker exec postgres-staging psql -U metallkart -d erp_staging -c " SELECT id, type, status, \"relatedEntityType\", \"relatedEntityId\", LEFT(\"errorMessage\", 60) as err FROM agent_actions WHERE \"createdAt\" >= NOW() - INTERVAL '2 min' ORDER BY id DESC "