spiderpilot89's picture
protocol company
Release v0.15.3 free evaluation sample
fd8b1ae
Raw History Blame Contribute Delete
1.58 kB
"""Point this HUD export at a keyed door, in your own copy, before you adapt or import it.
python3 set_door.py --url https://YOUR-DOOR/mcp --key-file FILE FILE holds the key we give you at kickoff
In every task it writes environment/.env (read by the proxy's service) and [verifier.env] in task.toml (read by the
grader). The agent's sandbox sees neither: its root is the task image, which holds neither file. The pack ships no key.
Do not commit or share the folder once this has run. Run it again with a new key to replace the old one.
"""
import argparse
import glob
import os
import re
ap = argparse.ArgumentParser()
ap.add_argument("--url", required=True)
ap.add_argument("--key-file", required=True)
a = ap.parse_args()
key = open(a.key_file).read().strip()
if not re.fullmatch(r"[A-Za-z0-9_.-]+", key) or not re.fullmatch(r"https?://[^\s\"']+", a.url):
raise SystemExit("the key or the URL holds characters a key or a URL does not")
tomls = glob.glob(os.path.join(os.path.dirname(os.path.abspath(__file__)), "tasks", "*", "task.toml"))
for toml in tomls:
with open(os.path.join(os.path.dirname(toml), "environment", ".env"), "w") as f:
f.write("ZTP_VERIFIER_URL=%s\nZTP_API_KEY=%s\n" % (a.url, key))
text = re.sub(r"\n\[verifier\.env\]\n(?:[^\n]*\n)*?(?=\n\[|\Z)", "\n", open(toml).read())
text = text.replace("\n[environment]\n", '\n[verifier.env]\nZTP_VERIFIER_URL = "%s"\nZTP_API_KEY = "%s"\n\n[environment]\n' % (a.url, key), 1)
with open(toml, "w") as f:
f.write(text)
print("%d tasks point at %s" % (len(tomls), a.url))