"""Bounded current registry identity checks; never proof of historical installation.""" from __future__ import annotations import hashlib import json import urllib.error from fetch_sources import OUT, REPOS, get IDENTITIES = { "nlf": "ComfyUI-WanVideoWrapper", "scail": "ComfyUI-SCAIL-Pose", "onnx": "ComfyUI-WanAnimatePreprocess", "layer": "comfyui_layerstyle", "math": "comfyui_essentials", "int": "comfyui-kjnodes", } def main(): records = [] sources = json.loads((OUT / "sources.json").read_bytes()) for key, cnr in IDENTITIES.items(): repo, commit = REPOS[key] url = f"https://raw.githubusercontent.com/{repo}/{commit}/pyproject.toml" try: raw = get(url) local = key + "__pyproject.toml" (OUT / local).write_bytes(raw) entry = dict( id=key, file="pyproject.toml", local_file=local, url=url, commit=commit, sha256=hashlib.sha256(raw).hexdigest(), ) if not any( e["id"] == key and e["file"] == "pyproject.toml" for e in sources["sources"] ): sources["sources"].append(entry) except urllib.error.HTTPError as e: if e.code != 404: raise attempts = [] for candidate in dict.fromkeys([cnr, cnr.lower()]): url = "https://api.comfy.org/nodes/" + candidate try: raw = get(url) local = key + "-registry.json" (OUT / local).write_bytes(raw) data = json.loads(raw) attempts.append( dict( url=url, status=200, local_file=local, sha256=hashlib.sha256(raw).hexdigest(), id=data.get("id"), repository=data.get("repository"), ) ) break except urllib.error.HTTPError as e: if e.code != 404: raise attempts.append(dict(url=url, status=404)) records.append( dict( key=key, source_cnr_id=cnr, repository_reference=repo, exact_commit=commit, registry_attempts=attempts, historical_commit_binding=False, installed=False, ) ) (OUT / "sources.json").write_text(json.dumps(sources, ensure_ascii=False, indent=2) + "\n") (OUT / "registry-identity.json").write_text( json.dumps( dict( scope="仅这张图六提供方;当前registry元数据不证明历史发布/目标安装", records=records ), ensure_ascii=False, indent=2, ) + "\n" ) url = "https://registry.npmjs.org/@comfyorg/litegraph/0.15.15" raw = get(url) (OUT / "litegraph-npm-metadata.json").write_bytes(raw) npm = json.loads(raw) (OUT / "litegraph-package-identity.json").write_text( json.dumps( dict( url=url, sha256=hashlib.sha256(raw).hexdigest(), version=npm["version"], gitHead=npm.get("gitHead"), dist=npm["dist"], installed=False, note="npm元数据gitHead对应tag,lock完整性字段另核;未安装或执行包", ), ensure_ascii=False, indent=2, ) + "\n" ) print("PASS bounded six-provider identity metadata; no plugin imported") if __name__ == "__main__": main()