"""Independent bounded prefix-format and host identity validation for candidates. Only native ARM macOS prefix runtime identity is implemented here. Other hosts are refused explicitly. The native importer additionally checks packed layout and every finite BF16 value against its actual loaded model before publication. """ import hashlib from pathlib import Path import platform import struct import subprocess HEADER_BYTES = 268 PAYLOAD_BYTES = 18452480 ARTIFACT_BYTES = HEADER_BYTES + 68*24 + PAYLOAD_BYTES + 32 def require(condition, message): if not condition: raise ValueError(message) def sha(path): h=hashlib.sha256() with Path(path).open('rb') as f: for block in iter(lambda:f.read(1024*1024),b''):h.update(block) return h.hexdigest() def runtime_identity(binary): """Reproduce stream_common.rs bytes using independent host queries. Candidate CLI is fixed to A8, four workers, user-initiated QoS and a private pool driver. The binary hash binds compiled features; Mach-O verifies ARCH. """ require(platform.system()=='Darwin' and platform.machine()=='arm64', 'independent prefix runtime identity currently requires native ARM macOS') with Path(binary['path']).open('rb') as f: magic,cpu=struct.unpack('