#!/usr/bin/env python3
import os, subprocess, sys
REPO='/home/agent/projects/CryptoTradingBot/Crypto_Agent'
os.chdir(REPO)
cmd=['.venv/bin/python','-m','src.tools.v76_paper_supervisor','--ensure-running','--strategies','strict,research_probe','--iterations','1440','--interval-seconds','60','--json']
res=subprocess.run(cmd, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=180)
# Emit only if supervisor blocks/fails/starts something; quiet if already healthy.
out=res.stdout.strip()
if res.returncode != 0:
    print(out); sys.exit(res.returncode)
if '"started": []' not in out:
    print(out)
sys.exit(0)
