mirror of
https://github.com/morluto/rea.git
synced 2026-11-06 06:46:10 +00:00
* perf(eval): measure MCP catalog usage through real Codex sessions * fix(eval): control the active Codex code mode host * fix(eval): reject unavailable host controls without hiding client errors * test(eval): cover the supported default and actionable client errors * docs(eval): record pinned Codex catalog and real package measurements * fix(eval): pin matrix identity and retain failed trial observations --------- Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
26 lines
884 B
Python
26 lines
884 B
Python
"""One byte-identity owner shared by matrix admission and guarded trials."""
|
|
|
|
import hashlib
|
|
import json
|
|
|
|
|
|
def file_digest(path):
|
|
digest = hashlib.sha256()
|
|
with path.open('rb') as data:
|
|
for chunk in iter(lambda: data.read(1024 * 1024), b''):
|
|
digest.update(chunk)
|
|
return digest.hexdigest()
|
|
|
|
|
|
def runtime_fingerprint(root):
|
|
files = []
|
|
for name in ['dist', 'bridge']:
|
|
for path in sorted((root / name).rglob('*')):
|
|
if path.is_symlink():
|
|
raise ValueError('Runtime fingerprint does not follow symlinks')
|
|
if path.is_file():
|
|
files.append({'path': path.relative_to(root).as_posix(), 'sha256': file_digest(path)})
|
|
files.sort(key=lambda row: row['path'])
|
|
text = json.dumps(files, separators=(',', ':'), ensure_ascii=False)
|
|
return files, hashlib.sha256(text.encode()).hexdigest()
|