Datasets:
Download artifacts/runtime-source/update_task_source_manifest.py from suunny/terminal-agent-rl: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/datasets/suunny/terminal-agent-rl/resolve/main/artifacts/runtime-source/update_task_source_manifest.py
- Command line
-
hf download hf://datasets/suunny/terminal-agent-rl/artifacts/runtime-source/update_task_source_manifest.py
-
curl -L -o update_task_source_manifest.py https://huggingface.co/datasets/suunny/terminal-agent-rl/resolve/main/artifacts/runtime-source/update_task_source_manifest.py
1.1 kB
| """Record committed git task/build/registry bytes; never untracked bytecode.""" | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| import subprocess | |
| ROOT=Path(__file__).resolve().parent | |
| def update(): | |
| path=ROOT/'task-source.json';source=json.loads(path.read_text());repo=ROOT/'.state/task-registry-repo' | |
| revision=source['commit'] | |
| files=subprocess.check_output(['git','-C',str(repo),'ls-tree','-r','--name-only',revision,'tasks','build','registry.json'],text=True).splitlines() | |
| manifest={};build={} | |
| for file in files: | |
| data=subprocess.check_output(['git','-C',str(repo),'show',f'{revision}:{file}']) | |
| sha=hashlib.sha256(data).hexdigest() | |
| if file.startswith('tasks/'): | |
| _,task,relative=file.split('/',2) | |
| manifest.setdefault(task,{})[relative]=sha | |
| elif file.startswith('build/'): | |
| build[file]=sha | |
| else: | |
| source['registry_sha256']=sha | |
| source['task_manifest']=manifest;source['build_manifest']=build | |
| path.write_text(json.dumps(source,indent=2)+'\n') | |
| if __name__=='__main__': | |
| update() | |