"""Print the agent's calls on 2 tasks, run 1, with JavaScript on and with --no-javascript-evaluation, and the characters each call returned."""
import json

RUNS = json.load(open("agent-runs.json"))

print(f"{'':<17}{'tokens':>8}   tool calls, with the characters each returned")
for task in ("gh-playwright-release", "wiki-follow-link"):
    print(task)
    for setup, label in (("devtools-mcp", "JavaScript on"), ("devtools-mcp-nojs", "no JavaScript")):
        d = next(r for r in RUNS if (r["setup"], r["run"], r["task"]) == (setup, "r1", task))
        calls = ", ".join(f"{c['name']} {c['chars']:,}" for c in d["tool_calls"] if c["name"] not in ("list_pages",))
        print(f"  {label:<15}{d['totals']['input_all']:>8,}   {calls}")
