"""Upload only the port's explicit release files to a private HF dataset.""" import argparse import json from .adapter import ROOT def main(): from huggingface_hub import HfApi parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--repo-id", default="HuggingFaceSwarms/AgentEscapeBench-harbor") args = parser.parse_args() corpus = json.loads((ROOT / "reports/corpus.json").read_text()) assert corpus["tasks"] == corpus["successes"] == 270 assert len(corpus["templates_executed"]) == 33 isolation = json.loads((ROOT / "reports/worker-isolation.json").read_text()) assert all(row["passed"] for row in isolation) smoke = json.loads((ROOT / "reports/openenv-smoke.json").read_text()) assert len(smoke["results"]) == 2 assert all(row["ok"] and row["reward"] == 1.0 for row in smoke["results"]) api = HfApi() api.create_repo(args.repo_id, repo_type="dataset", private=True, exist_ok=True) info = api.repo_info(args.repo_id, repo_type="dataset") if not info.private: raise RuntimeError( "Refusing to upload to a public dataset; user requested private" ) result = api.upload_folder( repo_id=args.repo_id, repo_type="dataset", folder_path=ROOT, commit_message="Publish compact AgentEscapeBench sources and task catalog", parent_commit=info.sha, delete_patterns=["tasks/**"], allow_patterns=[ "README.md", ".gitignore", "LICENSE.port", "pyproject.toml", "uv.lock", "runtime-requirements.txt", "source-lock.json", "assets/**", "src/**", "data/**", "catalog.json", "tests/**", "reports/corpus.json", "reports/worker-isolation.json", "reports/openenv-smoke.json", "reports/validation-summary.json", "reports/unit-tests.log", ], ignore_patterns=["generated/**", "**/__pycache__/**", "**/*.pyc", "**/*.log", "**/.cache/**"], ) publication = { "repo_id": args.repo_id, "private": True, "revision": result.oid, "commit_url": result.commit_url, } (ROOT / "reports/publication.json").write_text( json.dumps(publication, indent=2) + "\n" ) print(json.dumps(publication)) if __name__ == "__main__": main()