File size: 9,560 Bytes
d513eb2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | """Archive primary sources and pinned code for the PhaseLatch design study.
Only public text/code is fetched; no simulator or model is installed.
Existing repository pins are reused unless --refresh-pins is passed.
"""
import argparse
import concurrent.futures
import hashlib
import json
import re
import subprocess
import time
import urllib.request
from datetime import datetime, timezone
from html.parser import HTMLParser
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SOURCES = {
"embodiedswe_site": "https://embodiedswe.github.io/",
"embodiedswe_paper": "https://arxiv.org/html/2609.27308v1",
"oopsie_paper": "https://arxiv.org/html/2606.31993v1",
"oopsie_site": "https://robin-lab.cs.utexas.edu/oopsieverse/",
"reflex_paper": "https://arxiv.org/html/2608.14379v1",
"hazard_paper": "https://arxiv.org/html/2401.12975v1",
"dojo_paper": "https://arxiv.org/html/2607.04434v1",
"pro_paper": "https://arxiv.org/html/2510.03827v1",
"twin_paper": "https://arxiv.org/html/2506.18088v2",
"safelab_site": "https://yingwen.io/en/publications/safelab-an-interactive-high-fidelity-benchmark-for-embodied-safety-in-scientific-robotics/",
"safelab_proceedings": "https://proceedings.mlr.press/v306/bai26e.html",
"safelab_pdf": "https://raw.githubusercontent.com/mlresearch/v306/main/assets/bai26e/bai26e.pdf",
"safevla_paper": "https://arxiv.org/html/2606.00773v1",
"dynamicvla_paper": "https://arxiv.org/html/2601.22153v1",
"latent_safety_site": "https://kensukenk.github.io/latent-safety/",
"mujoco_equality": "https://mujoco.readthedocs.io/en/stable/XMLreference.html",
"mujoco_computation": "https://mujoco.readthedocs.io/en/stable/computation/index.html",
"mujoco_modeling": "https://mujoco.readthedocs.io/en/stable/modeling.html",
"physx_joints": "https://nvidia-omniverse.github.io/PhysX/physx/5.4.1/docs/Joints.html",
"newton_docs": "https://newton-physics.github.io/newton/",
"domino_paper": "https://arxiv.org/html/2603.15620v1",
"dlo_paper": "https://arxiv.org/html/2606.04206v1",
"plasticine_site": "https://plasticinelab.csail.mit.edu/",
"disect_site": "https://diff-cutting-sim.github.io/",
"empm_site": "https://embodied-mpm.github.io/",
"redman_paper": "https://link.springer.com/article/10.1007/s10994-025-06825-x",
"reflex_site": "https://reflexvla.github.io/",
"fluidlab_site": "https://fluidlab2023.github.io/",
}
REPOS = {
"swe": "EmbodiedSWE/EmbodiedSWE",
"dojo": "RoboDojo-Benchmark/RoboDojo",
"twin": "RoboTwin-Platform/RoboTwin",
"pro": "Zxy-MLlab/LIBERO-PRO",
"safelab": "ChangWinde/SafeLab",
"reflex": "LxRoboticsLab/ReflexBench",
"oopsie": "UT-Austin-RobIn/oopsieverse",
}
CODE_TERMS = {
"dojo": ["base_env.py", "eval_env.py", "main.py", "insert", "button", "toolbox", "hammer", "handover"],
"twin": ["_base_task.py", "click_bell.py", "move_stapler_pad.py", "handover", "open", "put_bottles", "insert", "place_cans"],
"pro": ["env_wrapper.py", "libero_suite_task_map.py", "run_libero_eval.py", "perturb"],
"swe": ["cut", "fracture", "scene", "controller", "task", "grader"],
"safelab": ["safety", "constraint", "damage"],
"reflex": ["eval", "latency", "conveyor"],
"oopsie": ["damage", "health", "mechanical"],
}
FALLBACK_PATHS = {
"swe": ["README.md", "LICENSE", "robobench/README.md", "robobench/core/env.py", "robobench/controllers/task_space.py", "robobench/suites/cutting/scenes/slice_food.py", "robobench/suites/cutting/scenes/dice_food.py", "robobench/suites/cutting/grader/slice_food.py", "robobench/suites/puzzle/scenes/coffee_service.py", "vla/eval/sim.py"],
"dojo": ["README.md", "LICENSE", "env/environment/base_env.py", "src/eval_client/eval_env.py", "src/eval_client/main.py", "task/RoboDojo/tasks/insert_tubes.py", "task/RoboDojo/tasks/insert_key.py", "task/RoboDojo/tasks/fasten_screws.py", "task/RoboDojo/tasks/press_by_number.py", "task/RoboDojo/tasks/match_and_pick_from_conveyor.py", "task/RoboDojo/tasks/store_tools_in_toolbox.py"],
"twin": ["README.md", "LICENSE", "envs/_base_task.py", "envs/move_stapler_pad.py", "envs/click_bell.py", "envs/handover_block.py", "envs/put_bottles_dustbin.py"],
"pro": ["README.md", "LICENSE", "libero/libero/envs/env_wrapper.py", "libero/libero/benchmark/libero_suite_task_map.py"],
"safelab": ["README.md", "index.html"],
"reflex": ["README.md", "LICENSE", "scripts/evaluation/eval.py", "scripts/evaluation/POLICY_SERVER.md"],
"oopsie": ["README.md"],
}
def get(url):
req = urllib.request.Request(url, headers={"User-Agent": "PhaseLatch-research/0.1"})
for attempt in range(3):
try:
with urllib.request.urlopen(req, timeout=35) as response:
return response.read(), response.url
except Exception as exc:
if getattr(exc, "code", None) in (403, 404) or attempt == 2:
raise
time.sleep(0.4)
class Plain(HTMLParser):
def __init__(self):
super().__init__()
self.skip = 0
self.parts = []
def handle_starttag(self, tag, attrs):
if tag in ("script", "style"):
self.skip += 1
if tag in ("p", "div", "li", "h1", "h2", "h3", "tr", "section"):
self.parts.append("\n")
def handle_endtag(self, tag):
if tag in ("script", "style"):
self.skip = max(0, self.skip - 1)
def handle_data(self, data):
if not self.skip:
self.parts.append(data)
def fetch(item):
key, url = item
try:
body, final = get(url)
suffix = ".pdf" if body.startswith(b"%PDF") else ".py" if url.endswith(".py") else ".txt"
path = ROOT / "research" / "snapshots" / (key + suffix)
path.write_bytes(body)
decoded = body.decode("utf-8", errors="replace") if suffix != ".pdf" else ""
if "<html" in decoded.lower() or "<!doctype html" in decoded.lower():
parser = Plain()
parser.feed(decoded)
text = re.sub(r"\n\s*\n+", "\n\n", "".join(parser.parts))
path.with_suffix(".text").write_text(text, encoding="utf-8")
return {"id": key, "url": url, "final_url": final, "status": "fetched", "bytes": len(body), "sha256": hashlib.sha256(body).hexdigest(), "local_path": path.relative_to(ROOT).as_posix()}
except Exception as exc:
return {"id": key, "url": url, "status": "unavailable", "error": str(exc)}
def main():
args = argparse.ArgumentParser()
args.add_argument("--refresh-pins", action="store_true")
opts = args.parse_args()
target = ROOT / "research"
(target / "snapshots").mkdir(parents=True, exist_ok=True)
pin_path = target / "repository_pins.json"
pins = json.loads(pin_path.read_text(encoding="utf-8")) if pin_path.exists() and not opts.refresh_pins else {}
items = list(SOURCES.items())
for key, repo in REPOS.items():
try:
if key not in pins or "commit" not in pins[key] or pins[key].get("repository") != repo:
try:
data, _ = get(f"https://api.github.com/repos/{repo}/commits?per_page=1")
commit = json.loads(data)[0]
pins[key] = {"repository": repo, "commit": commit["sha"], "commit_date": commit["commit"]["committer"]["date"]}
except Exception:
output = subprocess.check_output(["git", "ls-remote", f"https://github.com/{repo}.git", "HEAD"], text=True, timeout=35)
pins[key] = {"repository": repo, "commit": output.split()[0], "pin_method": "git ls-remote HEAD"}
sha = pins[key]["commit"]
try:
data, _ = get(f"https://api.github.com/repos/{repo}/git/trees/{sha}?recursive=1")
tree = json.loads(data)
(target / (key + "_tree.json")).write_text(json.dumps(tree, indent=2), encoding="utf-8")
pins[key].pop("tree_note", None)
paths = [x["path"] for x in tree["tree"] if x["type"] == "blob"]
required = [x for x in FALLBACK_PATHS[key] if x in paths]
extras = [x for x in paths if x not in required and x.endswith(".py") and any(term in x.lower() for term in CODE_TERMS[key])]
selected = (required + extras)[:24]
except Exception as exc:
pins[key]["tree_note"] = str(exc)
selected = FALLBACK_PATHS[key]
for path in selected:
items.append((key + "_" + path.replace("/", "_").replace(".", "_"), f"https://raw.githubusercontent.com/{repo}/{sha}/{path}"))
except Exception as exc:
pins.setdefault(key, {"repository": repo})["fetch_error"] = str(exc)
pin_path.write_text(json.dumps(pins, indent=2) + "\n", encoding="utf-8")
with concurrent.futures.ThreadPoolExecutor(max_workers=8) as pool:
records = list(pool.map(fetch, items))
manifest = {"checked_date": "2026-10-04", "timezone": "Asia/Shanghai", "retrieved_at_utc": datetime.now(timezone.utc).isoformat(), "scope": "Public source and code inspection; no simulator execution", "repository_pins": pins, "sources": records}
(target / "sources.json").write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
print(json.dumps({"fetched": sum(x["status"] == "fetched" for x in records), "unavailable": [x for x in records if x["status"] != "fetched"], "pins": pins}, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()
|