Spaces:
Sleeping
Sleeping
| """Headless decision helper for the human gate (fallback to the dashboard). | |
| Run: python -m scripts.decide --run <run_id> approve | |
| python -m scripts.decide --run <run_id> reject | |
| python -m scripts.decide --run <run_id> change_budget --price 4.00 | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) | |
| from core.config import traces_dir # noqa: E402 | |
| def main() -> None: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--run", required=True) | |
| parser.add_argument("decision", choices=["approve", "reject", "change_budget"]) | |
| parser.add_argument("--price", type=float, default=None) | |
| args = parser.parse_args() | |
| payload = {"decision": args.decision} | |
| if args.decision == "change_budget": | |
| if args.price is None: | |
| parser.error("change_budget requires --price") | |
| payload["new_max_unit_price"] = args.price | |
| path = traces_dir() / f"{args.run}.decision.json" | |
| path.write_text(json.dumps(payload), encoding="utf-8") | |
| print(f"[decide] wrote {path}") | |
| if __name__ == "__main__": | |
| main() | |