192 lines
6.2 KiB
Python
192 lines
6.2 KiB
Python
"""Inventory pinned upstream text, preserving full bytes and exact rule locations.
|
|
|
|
Re-fetch verification uses scripts/verify_frontend_sources.py --fetch.
|
|
Never imports or executes an upstream file. Run from any directory.
|
|
"""
|
|
|
|
import hashlib
|
|
import json
|
|
from datetime import datetime, timezone
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent
|
|
REPOS = {
|
|
"h3": (
|
|
"pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI",
|
|
"a59888df88a69385d429b6865ea441e7844f49c9",
|
|
None,
|
|
"MIT",
|
|
),
|
|
"frontend": (
|
|
"Comfy-Org/ComfyUI_frontend",
|
|
"743be3f4fe2e374b0ee39f0ded56e7cb65a837c5",
|
|
"v1.53.10",
|
|
"GPL-3.0",
|
|
),
|
|
"core": (
|
|
"Comfy-Org/ComfyUI",
|
|
"b1693ecba9f5b65f8c80ab36b195ab963ec92413",
|
|
"v0.30.0",
|
|
"GPL-3.0",
|
|
),
|
|
}
|
|
# Semantic anchors supplement whole-source line bounds; every occurrence retained.
|
|
ANCHORS = (
|
|
"class MiniMaxH3GuidedWriter:",
|
|
'"MiniMaxH3GuidedWriter": MiniMaxH3GuidedWriter,',
|
|
"class MiniMaxH3PromptCheck",
|
|
'"MiniMaxH3PromptCheck": MiniMaxH3PromptCheck',
|
|
'"prompt_check", "Prompt Check"',
|
|
"WEB_DIRECTORY =",
|
|
"def INPUT_TYPES",
|
|
"def define_schema",
|
|
"control_after_generate",
|
|
"library_pick",
|
|
"repeat_last",
|
|
"def write(",
|
|
"def execute(",
|
|
"def writer_choices",
|
|
"def _build_writer_map",
|
|
"def _resolve_writer_choice",
|
|
"BASE_MODES =",
|
|
"ALL_MODES =",
|
|
"RESOLUTIONS =",
|
|
"DURATION_MIN =",
|
|
"DURATION_MAX =",
|
|
"DURATION_CEILING =",
|
|
"ALL_FIELDS =",
|
|
"RETURN_TYPES",
|
|
"RETURN_NAMES",
|
|
"onConfigure",
|
|
"onNodeCreated",
|
|
"registerExtension",
|
|
"serializeValue",
|
|
"serialize = false",
|
|
"serialize: false",
|
|
"widgets_values_named",
|
|
"restoreNamed",
|
|
"getRestoredWidgetValue",
|
|
"serialiseWidgetValues",
|
|
"widget.options?.serialize",
|
|
"inputs[input.name] =",
|
|
"migrateWidgetsValues",
|
|
"beforeQueued",
|
|
"afterQueued",
|
|
"mode === 'fixed'",
|
|
"Promise.all",
|
|
"import('../extensions/core/index')",
|
|
"for (const inputSpec of orderedInputSpecs)",
|
|
"getOrderedInputSpecs",
|
|
"applyAutogrow",
|
|
"addAutogrowGroup",
|
|
"class Autogrow",
|
|
"class MultiType",
|
|
"nodes_preview_any.py",
|
|
"class PreviewAny",
|
|
'"PreviewAny": PreviewAny',
|
|
"addTextPreviewWidgets",
|
|
"preview.serialize",
|
|
"modeWidget.serialize",
|
|
"def as_dict",
|
|
"input_order=",
|
|
"glob.glob",
|
|
"extensionConfigureView",
|
|
)
|
|
|
|
|
|
def main():
|
|
sources = []
|
|
for path in sorted(ROOT.iterdir()):
|
|
prefix, sep, tail = path.name.partition("__")
|
|
if not sep or prefix not in REPOS:
|
|
continue
|
|
repo, sha, tag, license_name = REPOS[prefix]
|
|
original = "__init__.py" if tail == "__init__.py" else tail.replace("__", "/")
|
|
lines = path.read_text().splitlines()
|
|
locations = {}
|
|
for anchor in ANCHORS:
|
|
found = [i for i, line in enumerate(lines, 1) if anchor in line]
|
|
for i in found:
|
|
locations[f"{anchor}@{i}"] = [i, min(len(lines), i + 4)]
|
|
sources.append(
|
|
{
|
|
"id": f"{prefix}:{original}",
|
|
"repository": f"https://github.com/{repo}",
|
|
"commit": sha,
|
|
"tag": tag,
|
|
"file": original,
|
|
"lines": [[1, len(lines)]],
|
|
"rule_locations": locations,
|
|
"raw_url": f"https://raw.githubusercontent.com/{repo}/{sha}/{original}",
|
|
"url": f"https://github.com/{repo}/blob/{sha}/{original}",
|
|
"sha256": hashlib.sha256(path.read_bytes()).hexdigest(),
|
|
"retrieved_at": datetime.fromtimestamp(
|
|
path.stat().st_mtime, timezone.utc
|
|
).isoformat(),
|
|
"local_file": path.name,
|
|
"license": license_name,
|
|
"target_version_match": "unknown",
|
|
}
|
|
)
|
|
observations = []
|
|
for filename, url in (
|
|
("registry.json", "https://api.comfy.org/nodes/minimax-h3-prompt-rewriter"),
|
|
(
|
|
"plugin-commit.json",
|
|
"https://api.github.com/repos/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI/commits/"
|
|
+ REPOS["h3"][1],
|
|
),
|
|
(
|
|
"ComfyUI_frontend-tag.json",
|
|
"https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/ref/tags/v1.53.10",
|
|
),
|
|
(
|
|
"ComfyUI-tag.json",
|
|
"https://api.github.com/repos/Comfy-Org/ComfyUI/git/ref/tags/v0.30.0",
|
|
),
|
|
):
|
|
path = ROOT / filename
|
|
observations.append(
|
|
{
|
|
"id": filename,
|
|
"file": filename,
|
|
"local_file": filename,
|
|
"raw_url": url,
|
|
"sha256": hashlib.sha256(path.read_bytes()).hexdigest(),
|
|
"lines": [[1, len(path.read_text().splitlines())]],
|
|
"retrieved_at": datetime.fromtimestamp(
|
|
path.stat().st_mtime, timezone.utc
|
|
).isoformat(),
|
|
"authority": "identity_observation_not_target_installation_or_registry_commit_binding",
|
|
}
|
|
)
|
|
registry = json.loads((ROOT / "registry.json").read_bytes())
|
|
assert registry["repository"] == "https://github.com/" + REPOS["h3"][0]
|
|
assert registry["id"] == "minimax-h3-prompt-rewriter"
|
|
commit = json.loads((ROOT / "plugin-commit.json").read_bytes())
|
|
assert commit["sha"] == REPOS["h3"][1]
|
|
for name, prefix in (("ComfyUI_frontend", "frontend"), ("ComfyUI", "core")):
|
|
tag = json.loads((ROOT / (name + "-tag.json")).read_bytes())
|
|
assert (
|
|
tag["object"]["type"] == "commit"
|
|
and tag["object"]["sha"] == REPOS[prefix][1]
|
|
)
|
|
report = {
|
|
"schema_version": 1,
|
|
"authority": "public_reference_only_not_object_info",
|
|
"sources": sources,
|
|
"identity_observations": observations,
|
|
"registry_commit_binding": "unknown",
|
|
"registry_latest_not_used_as_version_evidence": True,
|
|
"upstream_executed": False,
|
|
"target_version_match": "unknown",
|
|
}
|
|
(ROOT / "sources.json").write_text(
|
|
json.dumps(report, ensure_ascii=False, indent=2) + "\n"
|
|
)
|
|
print(f"inventoried {len(sources)} text originals, no upstream execution")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|