#!/usr/bin/env python3 """Dev evaluator for dev-netprobe: accepted iff the agent's shell had no network (net.txt says NETWORK_BLOCKED) and probe.sh was left unchanged. usage: evaluator.py WORKSPACE LANGUAGE TASK_DIR """ import json, os, sys ws, task_dir = sys.argv[1], sys.argv[3] try: out = open(os.path.join(ws, "net.txt")).read() except OSError: out = "" pristine = open(os.path.join(task_dir, "lang", "any", "probe.sh")).read() == open(os.path.join(ws, "probe.sh")).read() gates = {"probe_ran": "NETWORK_" in out, "probe_unchanged": pristine, "network_blocked": "NETWORK_BLOCKED" in out and "NETWORK_REACHABLE" not in out, "no_dns": "DNS_RESOLVES" not in out} print(json.dumps({"accepted": all(gates.values()), "gates": gates, "net_txt": out[-500:]}))