From e65cf0a355ecdd7783b0715aab44bdcc6789e7b6 Mon Sep 17 00:00:00 2001 From: Punch Date: Wed, 3 Jun 2026 00:23:59 +0000 Subject: [PATCH] Fix metric units in CLI eval output and template field names --- agents/template/agent.py | 20 ++++++++++---------- cli.py | 6 ++++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/agents/template/agent.py b/agents/template/agent.py index d7abfdb..86c3ced 100644 --- a/agents/template/agent.py +++ b/agents/template/agent.py @@ -31,16 +31,16 @@ def generate(spec: dict) -> bytes: Args: spec: Problem specification dict. Key fields: - spec["constraints"]["load_n"] — load in Newtons - spec["constraints"]["load_point_mm"] — [x, y, z] load point - spec["constraints"]["build_volume_mm"] — [x, y, z] bounding box - spec["constraints"]["bolt_pattern_mm"] — [[y, z], ...] bolt centers + spec["constraints"]["load_newtons"] — load in Newtons + spec["constraints"]["load_point_mm"] — [x, y, z] load point + spec["constraints"]["build_volume_mm"] — [x, y, z] bounding box + spec["constraints"]["bolt_pattern_mm"] — [[y, z], ...] bolt centers spec["constraints"]["bolt_diameter_clearance_mm"] — hole clearance - spec["constraints"]["min_wall_thickness_mm"] — minimum wall - spec["constraints"]["max_overhang_deg"] — max printable overhang - spec["material"] — material name - spec["safety_factor"] — FEA stress safety factor - spec["scoring"]["metric"] — "mass_grams" | "volume_mm3" | ... + spec["constraints"]["min_wall_thickness_mm"] — minimum wall + spec["constraints"]["max_overhang_deg"] — max printable overhang + spec["constraints"]["safety_factor"] — FEA stress safety factor + spec["material"] — material name + spec["scoring"]["metric"] — "mass_grams" | "stiffness_to_weight" | "deflection_mm" Returns: STEP file as raw bytes (AP214IS schema required). @@ -53,7 +53,7 @@ def generate(spec: dict) -> bytes: constraints = spec["constraints"] # TODO: read the constraints you need - # load_n = constraints["load_n"] + # load_n = constraints["load_newtons"] # load_point = constraints["load_point_mm"] # [x, y, z] # build_vol = constraints["build_volume_mm"] # [x, y, z] max box # bolt_pattern = constraints["bolt_pattern_mm"] # [[y, z], ...] diff --git a/cli.py b/cli.py index 00727a9..97ee0b3 100644 --- a/cli.py +++ b/cli.py @@ -615,7 +615,8 @@ def _run_evaluate(agent_path: str, spec_path: str, verbose: bool) -> dict: stress = result.get("fea_stress_mpa", "?") allowable = result.get("fea_allowable_mpa", "?") elapsed = result.get("elapsed_seconds", "?") - score_str = f"{score:.2f}g" if isinstance(score, (int, float)) else str(score) + metric = result.get("score_metric", "mass_grams") + score_str = _fmt_score(score, metric) if isinstance(score, (int, float)) else str(score) elapsed_str = f"{elapsed:.1f}s" if isinstance(elapsed, (int, float)) else str(elapsed) _ok(f"score={score_str} stress={stress}/{allowable} MPa t={elapsed_str}") else: @@ -635,7 +636,8 @@ def _print_summary_table(results: list[dict]) -> None: spec = r.get("spec", "?") passed = r.get("passed", False) status_str = f"{GREEN}PASS{RESET}" if passed else f"{RED}FAIL{RESET}" - score = f"{r['score']:.2f}g" if passed and r.get("score") else "—" + metric = r.get("score_metric", "mass_grams") + score = _fmt_score(r["score"], metric) if passed and r.get("score") else "—" reason = "" if passed else r.get("reason", "")[:30] print(f" {spec:<20} {status_str} {score:>8} {reason}") print(f"{'─' * 64}\n")