"""Run the AgentRx tau converter on a synthetic local fixture; no model calls."""
from pathlib import Path
import sys
sys.dont_write_bytecode = True
from trajectory_ir import load_trajectories, tau_bench_ir

sample = Path(__file__).with_name("sample.json")
raw = load_trajectories(str(sample))
converted = tau_bench_ir(raw)
assert len(converted) == 1
steps = converted[0]["steps"]
assert len(steps) == 3
roles = [step["substeps"][0]["role"] for step in steps]
assert roles == ["user", "assistant", "tool"]
assert "permission denied" in steps[2]["substeps"][0]["content"]
print("Input: 3 synthetic messages")
print("Converted: 3 ordered steps")
print("Roles: " + " -> ".join(roles))
print("Tool error retained: permission denied")
print("PASS: local structural checks")
