HEL-892: add pinned H3 loader decoder and video reference contracts
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -21,6 +21,7 @@ except ModuleNotFoundError:
|
||||
|
||||
from calliope.comfyui.companions import load_companions
|
||||
from calliope.comfyui.delivery_scope import exclusion_for
|
||||
from calliope.comfyui.h3_chain_reference import CHAIN_PROFILE
|
||||
from calliope.comfyui.h3_core_reference import CORE_PROFILE
|
||||
from calliope.comfyui.serialization_reference import (
|
||||
ASR_PROFILE,
|
||||
@@ -309,6 +310,7 @@ REFERENCE_PROFILES = (
|
||||
GRID_PROFILE,
|
||||
H3_PROFILE,
|
||||
CORE_PROFILE,
|
||||
CHAIN_PROFILE,
|
||||
)
|
||||
|
||||
|
||||
@@ -603,10 +605,21 @@ def h3_field_evidence(source, prompt):
|
||||
return fields
|
||||
|
||||
|
||||
def core_field_evidence(source):
|
||||
def core_field_evidence(source, profile=CORE_PROFILE):
|
||||
"""Node diagnostics only, including rejected layouts; never a partial prompt."""
|
||||
from calliope.comfyui.h3_core_reference import LAYOUTS, saved_values, serialize_node
|
||||
|
||||
layouts = LAYOUTS
|
||||
if profile == CHAIN_PROFILE:
|
||||
from calliope.comfyui.h3_chain_reference import (
|
||||
LAYOUTS as CHAIN_LAYOUTS,
|
||||
)
|
||||
from calliope.comfyui.h3_chain_reference import (
|
||||
saved_values,
|
||||
serialize_node,
|
||||
)
|
||||
|
||||
layouts = {**layouts, **CHAIN_LAYOUTS}
|
||||
evidence = []
|
||||
links = {
|
||||
e[0]: (i, e)
|
||||
@@ -615,7 +628,7 @@ def core_field_evidence(source):
|
||||
}
|
||||
for i, node in enumerate(source.get("nodes", [])):
|
||||
ct = node.get("type")
|
||||
if ct not in LAYOUTS:
|
||||
if ct not in layouts:
|
||||
continue
|
||||
fields, reasons = [], []
|
||||
try:
|
||||
@@ -624,7 +637,7 @@ def core_field_evidence(source):
|
||||
saved = {}
|
||||
reasons.append(str(exc))
|
||||
for name, value in saved.items():
|
||||
wi = LAYOUTS[ct].index(name)
|
||||
wi = layouts[ct].index(name)
|
||||
fields.append(
|
||||
{
|
||||
"field": name,
|
||||
@@ -657,7 +670,7 @@ def core_field_evidence(source):
|
||||
"declared_type": edge[5],
|
||||
"source_endpoint_only": True,
|
||||
"upstream_type_in_public_profile": any(
|
||||
n.get("id") == edge[1] and n.get("type") in LAYOUTS
|
||||
n.get("id") == edge[1] and n.get("type") in layouts
|
||||
for n in source.get("nodes", [])
|
||||
),
|
||||
}
|
||||
@@ -679,10 +692,44 @@ def core_field_evidence(source):
|
||||
}
|
||||
if ct == "RandomNoise" and saved
|
||||
else None,
|
||||
"contract_manifest": "h3-core-reference/sources.json",
|
||||
"contract_manifest": "h3-chain-reference/sources.json"
|
||||
if profile == CHAIN_PROFILE
|
||||
else "h3-core-reference/sources.json",
|
||||
"not_a_submittable_node_or_partial_prompt": True,
|
||||
}
|
||||
)
|
||||
if profile == CHAIN_PROFILE:
|
||||
# Rejected arrays remain opaque evidence; never drop or name an
|
||||
# unproved third CreateVideo value to make the instance pass.
|
||||
evidence[-1]["raw_saved_values"] = [
|
||||
{
|
||||
"pointer": f"/nodes/{i}/widgets_values/{wi}",
|
||||
"value": value,
|
||||
"json_type": type(value).__name__,
|
||||
}
|
||||
for wi, value in enumerate(node.get("widgets_values", []))
|
||||
]
|
||||
evidence[-1]["effective_field_evidence"] = [
|
||||
{
|
||||
"field": field["field"],
|
||||
"value": field["value"],
|
||||
"json_type": field["json_type"],
|
||||
"pointer": field["source_value_pointer"],
|
||||
"origin": "saved_value",
|
||||
}
|
||||
for field in fields
|
||||
if field["field"] not in {p["input"] for p in physical}
|
||||
] + [
|
||||
{
|
||||
"field": edge["input"],
|
||||
"value": edge["endpoint"],
|
||||
"json_type": "list",
|
||||
"pointer": edge["link_pointer"],
|
||||
"origin": "physical_edge_overrides_saved_value",
|
||||
"endpoint_not_execution_eligibility": True,
|
||||
}
|
||||
for edge in physical
|
||||
]
|
||||
return evidence
|
||||
|
||||
|
||||
@@ -694,6 +741,7 @@ def profile_attempt(source, profile):
|
||||
GRID_PROFILE: "1.41.20",
|
||||
H3_PROFILE: "1.53.10",
|
||||
CORE_PROFILE: "1.53.10",
|
||||
CHAIN_PROFILE: "1.53.10",
|
||||
**VHS_PROFILES,
|
||||
**SETGET_PROFILES,
|
||||
**VIDEOINFO_PROFILES,
|
||||
@@ -874,7 +922,7 @@ def profile_attempt(source, profile):
|
||||
if profile in VHS_PROFILES
|
||||
else "crop-split-reference/verified-facts.json"
|
||||
)
|
||||
if profile == CORE_PROFILE:
|
||||
if profile in (CORE_PROFILE, CHAIN_PROFILE):
|
||||
assumptions.update(
|
||||
{
|
||||
"reference_sources": [
|
||||
@@ -891,6 +939,14 @@ def profile_attempt(source, profile):
|
||||
"random_seed_bound": "core_uint64_intersect_JS_safe_integer",
|
||||
}
|
||||
)
|
||||
if profile == CHAIN_PROFILE:
|
||||
assumptions["reference_sources"].insert(0, "h3-chain-reference/sources.json")
|
||||
assumptions["dynamic_model_membership"] = (
|
||||
"unknown; preserve source string without path normalization"
|
||||
)
|
||||
assumptions["save_video_branch"] = (
|
||||
"codec=auto only; no context-dependent filename replacement"
|
||||
)
|
||||
if profile == H3_PROFILE:
|
||||
assumptions["h3_contract"] = "h3-reference/sources.json"
|
||||
assumptions["reference_sources"] = ["h3-reference/sources.json"]
|
||||
@@ -924,7 +980,7 @@ def profile_attempt(source, profile):
|
||||
and expected == "1.48.6"
|
||||
):
|
||||
assumptions["missing_frontend_policy"] = "requires_explicit_1.48.6"
|
||||
if profile == CORE_PROFILE:
|
||||
if profile in (CORE_PROFILE, CHAIN_PROFILE):
|
||||
assumptions["missing_frontend_policy"] = "explicit_1.53.10_reference_assumption"
|
||||
assumptions["missing_node_declarations"] = [
|
||||
n["pointer"]
|
||||
@@ -950,6 +1006,7 @@ def profile_attempt(source, profile):
|
||||
AUX_PROFILE,
|
||||
PRIMITIVE_PROFILE,
|
||||
CORE_PROFILE,
|
||||
CHAIN_PROFILE,
|
||||
*MEDIA_PROFILES,
|
||||
SEPARATION_PROFILE,
|
||||
*CROP_SPLIT_PROFILES,
|
||||
@@ -981,8 +1038,8 @@ def profile_attempt(source, profile):
|
||||
"issues": result.issues,
|
||||
"unresolved_boundaries": result.unresolved_boundaries,
|
||||
**(
|
||||
{"supported_node_evidence": core_field_evidence(source)}
|
||||
if profile == CORE_PROFILE
|
||||
{"supported_node_evidence": core_field_evidence(source, profile)}
|
||||
if profile in (CORE_PROFILE, CHAIN_PROFILE)
|
||||
else {}
|
||||
),
|
||||
**(
|
||||
@@ -1002,8 +1059,8 @@ def profile_attempt(source, profile):
|
||||
"candidate_sha256": canonical_sha(result.prompt),
|
||||
"candidate_prompt": result.prompt,
|
||||
**(
|
||||
{"supported_node_evidence": core_field_evidence(source)}
|
||||
if profile == CORE_PROFILE
|
||||
{"supported_node_evidence": core_field_evidence(source, profile)}
|
||||
if profile in (CORE_PROFILE, CHAIN_PROFILE)
|
||||
else {}
|
||||
),
|
||||
**(
|
||||
@@ -1132,7 +1189,9 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES, *, baseline_profiles=
|
||||
}
|
||||
if baseline_profiles is None:
|
||||
excluded_profiles = (
|
||||
(CORE_PROFILE,)
|
||||
(CHAIN_PROFILE,)
|
||||
if CHAIN_PROFILE in profiles
|
||||
else (CORE_PROFILE,)
|
||||
if CORE_PROFILE in profiles
|
||||
else (H3_PROFILE,)
|
||||
if H3_PROFILE in profiles
|
||||
|
||||
Reference in New Issue
Block a user