vibedgames 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/rebuild-object/.cache/spec-search/core_3d.json +1 -0
- package/assets/rebuild-object/.cache/spec-search/cs2.json +1 -0
- package/assets/rebuild-object/LICENSE +201 -0
- package/assets/rebuild-object/NOTICE +7 -0
- package/assets/rebuild-object/docs/materials/material-reference.json +2324 -0
- package/assets/rebuild-object/docs/specs/render-profile.v2.example.json +63 -0
- package/assets/rebuild-object/docs/specs/render-profile.v2.schema.json +56 -0
- package/assets/rebuild-object/docs/specs/vocabulary/README.md +86 -0
- package/assets/rebuild-object/docs/specs/vocabulary/core_3d.jsonl +12 -0
- package/assets/rebuild-object/docs/specs/vocabulary/core_3d_reconstruction.jsonl +37 -0
- package/assets/rebuild-object/docs/specs/vocabulary/cs2.jsonl +8 -0
- package/assets/rebuild-object/docs/specs/vocabulary/cs2_reconstruction.jsonl +62 -0
- package/assets/rebuild-object/forge/_shared/artifact_cache.py +54 -0
- package/assets/rebuild-object/forge/_shared/chirality.py +272 -0
- package/assets/rebuild-object/forge/_shared/color_metrics.py +107 -0
- package/assets/rebuild-object/forge/_shared/feature_acceptance_policy.py +113 -0
- package/assets/rebuild-object/forge/_shared/image_hash.py +113 -0
- package/assets/rebuild-object/forge/_shared/jpeg.py +448 -0
- package/assets/rebuild-object/forge/_shared/material_physics.py +253 -0
- package/assets/rebuild-object/forge/_shared/pipeline_routing.py +177 -0
- package/assets/rebuild-object/forge/_shared/scalp_field.py +302 -0
- package/assets/rebuild-object/forge/_shared/sdf_primitives.py +172 -0
- package/assets/rebuild-object/forge/_shared/spec_search.py +1792 -0
- package/assets/rebuild-object/forge/_shared/spec_search_profiles.json +58 -0
- package/assets/rebuild-object/forge/_shared/status_banner.py +35 -0
- package/assets/rebuild-object/forge/_shared/subdivision.py +232 -0
- package/assets/rebuild-object/forge/_shared/vertex_paint.py +236 -0
- package/assets/rebuild-object/forge/_shared/workflow_state.py +406 -0
- package/assets/rebuild-object/forge/materials/__init__.py +17 -0
- package/assets/rebuild-object/forge/materials/compatibility.py +106 -0
- package/assets/rebuild-object/forge/materials/reference.py +240 -0
- package/assets/rebuild-object/forge/next.py +116 -0
- package/assets/rebuild-object/forge/report.py +38 -0
- package/assets/rebuild-object/forge/requirements.txt +6 -0
- package/assets/rebuild-object/forge/stage1_intake/analyze_texture.py +255 -0
- package/assets/rebuild-object/forge/stage1_intake/bind_detail_properties.py +99 -0
- package/assets/rebuild-object/forge/stage1_intake/build_detail_inventory.py +349 -0
- package/assets/rebuild-object/forge/stage1_intake/camera_fitting_math.py +133 -0
- package/assets/rebuild-object/forge/stage1_intake/camera_fitting_solver.py +197 -0
- package/assets/rebuild-object/forge/stage1_intake/camera_fitting_types.py +291 -0
- package/assets/rebuild-object/forge/stage1_intake/camera_image_helpers.py +133 -0
- package/assets/rebuild-object/forge/stage1_intake/check_intake_correctness.py +116 -0
- package/assets/rebuild-object/forge/stage1_intake/check_reference_admission.py +203 -0
- package/assets/rebuild-object/forge/stage1_intake/cs2_foundation.py +139 -0
- package/assets/rebuild-object/forge/stage1_intake/cs2_manifest.py +230 -0
- package/assets/rebuild-object/forge/stage1_intake/cs2_review_contract.py +42 -0
- package/assets/rebuild-object/forge/stage1_intake/delight_albedo.py +352 -0
- package/assets/rebuild-object/forge/stage1_intake/detect_cs2.py +276 -0
- package/assets/rebuild-object/forge/stage1_intake/detect_reference_effects.py +275 -0
- package/assets/rebuild-object/forge/stage1_intake/extract_cs2_textures.py +126 -0
- package/assets/rebuild-object/forge/stage1_intake/extract_gradient_stops.py +149 -0
- package/assets/rebuild-object/forge/stage1_intake/extract_hair_evidence.py +385 -0
- package/assets/rebuild-object/forge/stage1_intake/extract_landmarks.py +456 -0
- package/assets/rebuild-object/forge/stage1_intake/extract_part_color_recipe.py +496 -0
- package/assets/rebuild-object/forge/stage1_intake/extract_pbr_evidence.py +843 -0
- package/assets/rebuild-object/forge/stage1_intake/fetch_cs2_metadata.py +147 -0
- package/assets/rebuild-object/forge/stage1_intake/label_glb_nodes.py +318 -0
- package/assets/rebuild-object/forge/stage1_intake/locate_cs2_vpk.py +73 -0
- package/assets/rebuild-object/forge/stage1_intake/material_region_analysis.py +227 -0
- package/assets/rebuild-object/forge/stage1_intake/probe_glb.py +357 -0
- package/assets/rebuild-object/forge/stage1_intake/probe_image.py +168 -0
- package/assets/rebuild-object/forge/stage1_intake/run_vision_adapter.py +45 -0
- package/assets/rebuild-object/forge/stage1_intake/search_specs.py +258 -0
- package/assets/rebuild-object/forge/stage1_intake/semantic_decomposition.py +119 -0
- package/assets/rebuild-object/forge/stage1_intake/solve_camera_pose.py +254 -0
- package/assets/rebuild-object/forge/stage2_spec/apply_material_analysis.py +192 -0
- package/assets/rebuild-object/forge/stage2_spec/cs2_adapters.py +62 -0
- package/assets/rebuild-object/forge/stage2_spec/derive_geometry.py +118 -0
- package/assets/rebuild-object/forge/stage2_spec/hair_profile.py +306 -0
- package/assets/rebuild-object/forge/stage2_spec/humanoid_proportions.py +214 -0
- package/assets/rebuild-object/forge/stage2_spec/new_pre_spec_assessment.py +343 -0
- package/assets/rebuild-object/forge/stage2_spec/new_sculpt_spec.py +2396 -0
- package/assets/rebuild-object/forge/stage2_spec/validate_sculpt_spec.py +2871 -0
- package/assets/rebuild-object/forge/stage3_build/bake_projected_texture.py +181 -0
- package/assets/rebuild-object/forge/stage3_build/decimate.py +272 -0
- package/assets/rebuild-object/forge/stage3_build/generate_threejs_factory.py +4099 -0
- package/assets/rebuild-object/forge/stage3_build/module_cache.py +155 -0
- package/assets/rebuild-object/forge/stage3_build/morph_targets.py +178 -0
- package/assets/rebuild-object/forge/stage3_build/orchestrate_passes.py +653 -0
- package/assets/rebuild-object/forge/stage3_build/uv_unwrap.py +622 -0
- package/assets/rebuild-object/forge/stage3_build/visual_hull.py +357 -0
- package/assets/rebuild-object/forge/stage4_review/_fit_divine_eye.py +64 -0
- package/assets/rebuild-object/forge/stage4_review/append_review.py +453 -0
- package/assets/rebuild-object/forge/stage4_review/attachment_anchor.py +349 -0
- package/assets/rebuild-object/forge/stage4_review/calibrate_eye.py +131 -0
- package/assets/rebuild-object/forge/stage4_review/check_part_coverage.py +298 -0
- package/assets/rebuild-object/forge/stage4_review/compare_region_passes.py +169 -0
- package/assets/rebuild-object/forge/stage4_review/correction_loop.py +258 -0
- package/assets/rebuild-object/forge/stage4_review/cs2_review.py +224 -0
- package/assets/rebuild-object/forge/stage4_review/diagnose_render.py +356 -0
- package/assets/rebuild-object/forge/stage4_review/diagnose_render_multi_angle.py +143 -0
- package/assets/rebuild-object/forge/stage4_review/divine_eye.py +461 -0
- package/assets/rebuild-object/forge/stage4_review/fit_params.py +381 -0
- package/assets/rebuild-object/forge/stage4_review/geometry_integrity.py +294 -0
- package/assets/rebuild-object/forge/stage4_review/hair_gate.py +216 -0
- package/assets/rebuild-object/forge/stage4_review/interior_difference.py +188 -0
- package/assets/rebuild-object/forge/stage4_review/joint_loops.py +209 -0
- package/assets/rebuild-object/forge/stage4_review/make_comparison_sheet.py +292 -0
- package/assets/rebuild-object/forge/stage4_review/material_comparator.py +181 -0
- package/assets/rebuild-object/forge/stage4_review/material_feedback.py +143 -0
- package/assets/rebuild-object/forge/stage4_review/material_gate.py +126 -0
- package/assets/rebuild-object/forge/stage4_review/material_views.py +184 -0
- package/assets/rebuild-object/forge/stage4_review/mesh_reference_compare.py +362 -0
- package/assets/rebuild-object/forge/stage4_review/multi_pass.py +102 -0
- package/assets/rebuild-object/forge/stage4_review/objectness.py +143 -0
- package/assets/rebuild-object/forge/stage4_review/pairwise_penetration.py +376 -0
- package/assets/rebuild-object/forge/stage4_review/per_feature.py +215 -0
- package/assets/rebuild-object/forge/stage4_review/render_bridge.py +556 -0
- package/assets/rebuild-object/forge/stage4_review/scalp_exposure.py +257 -0
- package/assets/rebuild-object/forge/stage4_review/self_intersection.py +592 -0
- package/assets/rebuild-object/forge/stage4_review/swept_arc_gate.py +336 -0
- package/assets/rebuild-object/forge/stage4_review/turntable_gate.py +415 -0
- package/assets/rebuild-object/forge/stage4_review/validate_render_profile.py +182 -0
- package/assets/rebuild-object/forge/stage4_review/vertex_region_gate.py +456 -0
- package/assets/rebuild-object/forge/stage4_review/vlm_gate.py +196 -0
- package/assets/rebuild-object/forge/stage5_rig/NOTES.md +149 -0
- package/assets/rebuild-object/forge/stage5_rig/__init__.py +6 -0
- package/assets/rebuild-object/forge/stage5_rig/emit_rig.py +420 -0
- package/assets/rebuild-object/forge/stage5_rig/geodesic_skinning.py +508 -0
- package/assets/rebuild-object/forge/stage5_rig/rig_spec.py +174 -0
- package/assets/rebuild-object/forge/stage5_rig/validate_rig_payload.py +195 -0
- package/assets/rebuild-object/forge/state.py +98 -0
- package/assets/rebuild-object/steps.json +381 -0
- package/dist/{chunk-FXXVXDTW.js → chunk-24TITAFS.js} +1 -1
- package/dist/{chunk-OGX4DKIS.js → chunk-2C5PG2QO.js} +1 -1
- package/dist/{chunk-HYOXGNWS.js → chunk-2DEVOKI7.js} +1 -1
- package/dist/{chunk-RRI23NK2.js → chunk-2GHPYT2P.js} +1 -1
- package/dist/{chunk-S7HYWITX.js → chunk-2HXGMXGC.js} +1 -1
- package/dist/{chunk-N2UHAQXC.js → chunk-36FORP7T.js} +0 -1
- package/dist/{chunk-VB4WLJR2.js → chunk-3IXRQTRF.js} +1 -1
- package/dist/{chunk-2KVQJKIZ.js → chunk-4ENHS32B.js} +23 -36
- package/dist/{chunk-SXYQL4GK.js → chunk-4YHA32OE.js} +1 -1
- package/dist/{chunk-4FJXCS3K.js → chunk-4ZGQKPK5.js} +1 -1
- package/dist/{chunk-SBXCK2I2.js → chunk-6CLUPFQA.js} +2 -2
- package/dist/{chunk-TXOE5UY5.js → chunk-7WTF2BA4.js} +1 -1
- package/dist/{chunk-R2WVORGD.js → chunk-AAXZNK4Z.js} +1 -1
- package/dist/{chunk-DOOQUFPG.js → chunk-ALLBT4FB.js} +1 -1
- package/dist/{chunk-HRKVAXNN.js → chunk-BAZDPPIG.js} +5 -5
- package/dist/{chunk-RPJR3S5S.js → chunk-CYDENLZ4.js} +5 -8
- package/dist/{chunk-I5LELJSK.js → chunk-DKSUD44G.js} +1 -1
- package/dist/{chunk-43P4U7CB.js → chunk-DWWSJKTE.js} +1 -1
- package/dist/{chunk-SUSX3QIA.js → chunk-E72TFJZP.js} +1 -1
- package/dist/{chunk-E3FJUPLT.js → chunk-EUAAQMUA.js} +2 -0
- package/dist/{chunk-U6DTE5IX.js → chunk-F7LYJSZE.js} +1 -1
- package/dist/{chunk-MEAO33XW.js → chunk-FMON3C74.js} +8 -8
- package/dist/{chunk-GLEW7VJQ.js → chunk-FPILHRLZ.js} +1 -1
- package/dist/{chunk-OPUCUUID.js → chunk-G63MXDX2.js} +4 -0
- package/dist/{chunk-4UU622RK.js → chunk-GGO6ZYYI.js} +1 -3
- package/dist/{chunk-2ZKS7V72.js → chunk-GZCRYYS6.js} +5 -5
- package/dist/{chunk-E7NDOZ27.js → chunk-LE4GVTYI.js} +8 -8
- package/dist/{chunk-RKS7SI5L.js → chunk-NO6KPV64.js} +1 -1
- package/dist/{chunk-KJK5CB6E.js → chunk-NXW3Z4Y4.js} +1 -1
- package/dist/{chunk-7RPLQWR2.js → chunk-OHOAZGO4.js} +1 -1
- package/dist/chunk-PYJNI5WD.js +83 -0
- package/dist/{chunk-NCX6LYNJ.js → chunk-Q4XAGTFX.js} +1 -1
- package/dist/{chunk-3UGGMFJJ.js → chunk-QMZBSVKF.js} +1 -1
- package/dist/{chunk-ABTUEIRC.js → chunk-QO66UBOS.js} +2 -2
- package/dist/{chunk-LONQWRTR.js → chunk-S4KVGQQO.js} +8 -8
- package/dist/{chunk-HX5Q63UA.js → chunk-T777EXAO.js} +1 -1
- package/dist/{chunk-UQ7VO6B3.js → chunk-TZZNRA3S.js} +1 -1
- package/dist/{chunk-CTY2WZQK.js → chunk-UC3QLWMQ.js} +1 -1
- package/dist/{chunk-MR5KIFI7.js → chunk-UDJH2RED.js} +3 -3
- package/dist/{chunk-ZHLPE6LI.js → chunk-UIKYK7KI.js} +1 -1
- package/dist/{chunk-KAGVI3CE.js → chunk-UJRSQO2B.js} +1 -1
- package/dist/{chunk-Q2QC6KAZ.js → chunk-V7LEYVXB.js} +29 -25
- package/dist/{chunk-DB7WVFS7.js → chunk-WRMQEXUC.js} +1 -1
- package/dist/{chunk-HSMG6U7J.js → chunk-WXSBNC67.js} +3 -9
- package/dist/{chunk-QLCVLCPM.js → chunk-X4QIOXNQ.js} +1 -1
- package/dist/{chunk-5YPLKGY3.js → chunk-Y6WHUK2O.js} +1 -1
- package/dist/{chunk-VZEJ2ZHE.js → chunk-Z3E7ORGQ.js} +5 -5
- package/dist/index.js +20 -20
- package/package.json +32 -22
- package/dist/{chunk-Q3XQPNF6.js → chunk-BN7TR6OR.js} +3 -3
- package/dist/{chunk-LORGE2NB.js → chunk-U2NCN5RO.js} +3 -3
- package/dist/{chunk-UPHB5HWO.js → chunk-VQTTSPA3.js} +3 -3
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Gate procedural sculpt generation through ordered build passes."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import json
|
|
8
|
+
import re
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "_shared"))
|
|
14
|
+
from feature_acceptance_policy import feature_gate_failures
|
|
15
|
+
from status_banner import emit_status
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
DEFAULT_PASS_ORDER = [
|
|
19
|
+
"blockout",
|
|
20
|
+
"structural-pass",
|
|
21
|
+
"form-refinement",
|
|
22
|
+
"material-pass",
|
|
23
|
+
"surface-pass",
|
|
24
|
+
"lighting-pass",
|
|
25
|
+
"interaction-pass",
|
|
26
|
+
"optimization-pass",
|
|
27
|
+
]
|
|
28
|
+
VISUAL_PASS_IDS = set(DEFAULT_PASS_ORDER) - {"optimization-pass"}
|
|
29
|
+
ATTACHMENT_ROLES = {
|
|
30
|
+
"appendage",
|
|
31
|
+
"branch",
|
|
32
|
+
"limb",
|
|
33
|
+
"arm",
|
|
34
|
+
"leg",
|
|
35
|
+
"handle",
|
|
36
|
+
"connector",
|
|
37
|
+
"tube",
|
|
38
|
+
"cable",
|
|
39
|
+
"horn",
|
|
40
|
+
"wing",
|
|
41
|
+
"tail",
|
|
42
|
+
"root",
|
|
43
|
+
"fork",
|
|
44
|
+
"rib",
|
|
45
|
+
"support",
|
|
46
|
+
"hinge",
|
|
47
|
+
"socket",
|
|
48
|
+
"pipe",
|
|
49
|
+
}
|
|
50
|
+
ATTACHMENT_PRIMITIVES = {"cylinder", "cone", "capsule", "tube", "curve-sweep"}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def load_spec(path: Path) -> dict[str, Any]:
|
|
54
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
55
|
+
if not isinstance(payload, dict):
|
|
56
|
+
raise ValueError("spec must be a JSON object")
|
|
57
|
+
return payload
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def write_spec(path: Path, spec: dict[str, Any]) -> None:
|
|
61
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
62
|
+
path.write_text(json.dumps(spec, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def pass_order(spec: dict[str, Any]) -> list[str]:
|
|
66
|
+
ids: list[str] = []
|
|
67
|
+
for item in spec.get("buildPasses", []):
|
|
68
|
+
if isinstance(item, dict) and isinstance(item.get("id"), str) and item["id"].strip():
|
|
69
|
+
ids.append(item["id"])
|
|
70
|
+
return ids or DEFAULT_PASS_ORDER.copy()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def pass_acceptance(spec: dict[str, Any], pass_id: str) -> list[str]:
|
|
74
|
+
for item in spec.get("buildPasses", []):
|
|
75
|
+
if isinstance(item, dict) and item.get("id") == pass_id:
|
|
76
|
+
acceptance = item.get("acceptance", [])
|
|
77
|
+
if isinstance(acceptance, list):
|
|
78
|
+
return [str(value) for value in acceptance if str(value).strip()]
|
|
79
|
+
return []
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def visual_evidence(entry: dict[str, Any]) -> dict[str, Any]:
|
|
83
|
+
visual = entry.get("visualEvidence")
|
|
84
|
+
return visual if isinstance(visual, dict) else {}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def review_completes_pass(spec: dict[str, Any], entry: dict[str, Any], pass_id: str) -> bool:
|
|
88
|
+
if entry.get("passId") != pass_id or entry.get("action") != "continue":
|
|
89
|
+
return False
|
|
90
|
+
if pass_id in VISUAL_PASS_IDS:
|
|
91
|
+
visual = visual_evidence(entry)
|
|
92
|
+
if not visual.get("renderScreenshot") or not visual.get("comparisonImage"):
|
|
93
|
+
return False
|
|
94
|
+
score = entry.get("aiVisionScore")
|
|
95
|
+
threshold = entry.get("visualAcceptanceThreshold", 0.7)
|
|
96
|
+
if not has_number(score) or not has_number(threshold) or float(score) < float(threshold):
|
|
97
|
+
return False
|
|
98
|
+
if feature_gate_failures(spec, entry, pass_id):
|
|
99
|
+
return False
|
|
100
|
+
return True
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def completed_passes(spec: dict[str, Any], ids: list[str]) -> list[str]:
|
|
104
|
+
history = spec.get("reviewHistory", [])
|
|
105
|
+
if not isinstance(history, list):
|
|
106
|
+
return []
|
|
107
|
+
completed: list[str] = []
|
|
108
|
+
for pass_id in ids:
|
|
109
|
+
if any(
|
|
110
|
+
isinstance(entry, dict) and review_completes_pass(spec, entry, pass_id)
|
|
111
|
+
for entry in history
|
|
112
|
+
):
|
|
113
|
+
completed.append(pass_id)
|
|
114
|
+
else:
|
|
115
|
+
break
|
|
116
|
+
return completed
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def current_pass(ids: list[str], completed: list[str]) -> str:
|
|
120
|
+
if len(completed) >= len(ids):
|
|
121
|
+
return "complete"
|
|
122
|
+
return ids[len(completed)]
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def spec_has_hair(spec: dict[str, Any]) -> bool:
|
|
126
|
+
"""Does this subject have hair the review path has to reason about?
|
|
127
|
+
|
|
128
|
+
Two signals, because either can occur alone: a `hairProfile` block, and any component whose role
|
|
129
|
+
is hair. A subject with neither gets no hair evidence demanded of it, which keeps the requirement
|
|
130
|
+
off every chair and knife the pipeline builds.
|
|
131
|
+
"""
|
|
132
|
+
if isinstance(spec.get("hairProfile"), dict):
|
|
133
|
+
return True
|
|
134
|
+
components = spec.get("componentTree")
|
|
135
|
+
if not isinstance(components, list):
|
|
136
|
+
return False
|
|
137
|
+
return any(
|
|
138
|
+
isinstance(component, dict) and str(component.get("role") or "").lower() == "hair"
|
|
139
|
+
for component in components
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def next_required_evidence(spec: dict[str, Any], pass_id: str) -> list[str]:
|
|
144
|
+
if pass_id == "complete":
|
|
145
|
+
return []
|
|
146
|
+
evidence = pass_acceptance(spec, pass_id)
|
|
147
|
+
evidence.extend(pass_specific_evidence(pass_id))
|
|
148
|
+
if pass_id in VISUAL_PASS_IDS:
|
|
149
|
+
evidence.append("browser render screenshot from your agent's browser/screenshot tool")
|
|
150
|
+
evidence.append("side-by-side reference/render comparison sheet for AI vision review")
|
|
151
|
+
# Silhouette IoU is computed from the ~11% of figure cells on the outline. A model with its
|
|
152
|
+
# face deleted scored 0.8803 against the finished face's 0.8803 -- so an outline score is
|
|
153
|
+
# not evidence about anything inside the outline, and a loop optimising it will spend its
|
|
154
|
+
# whole budget without moving the interior. Read this per region, not as one number.
|
|
155
|
+
evidence.append(
|
|
156
|
+
"banded interior difference vs the reference baseline "
|
|
157
|
+
"(vg asset rebuild-object interior-difference --from/--to per region)"
|
|
158
|
+
)
|
|
159
|
+
# Hair has its own failure mode that none of the signals above can see. A bald patch is
|
|
160
|
+
# interior, so silhouette IoU is blind to it; it is a luminance change, so interior
|
|
161
|
+
# difference cannot separate it from a colour shift; and it only appears in the render,
|
|
162
|
+
# which is after the loop has already spent a pass. `scalp_exposure.py` finds it
|
|
163
|
+
# geometrically, before anything is drawn. The failure is recorded: widening the hair masses
|
|
164
|
+
# took closure from 42.2% to 40.9%, worse on all six views, and the cause -- masses sliding
|
|
165
|
+
# off the skull -- was invisible to every gate that existed at the time.
|
|
166
|
+
if spec_has_hair(spec):
|
|
167
|
+
evidence.append(
|
|
168
|
+
"scalp exposure below the hard maximum, measured on geometry before rendering "
|
|
169
|
+
"(vg asset rebuild-object scalp-exposure)"
|
|
170
|
+
)
|
|
171
|
+
evidence.append(
|
|
172
|
+
"hair gate comparing banded coverage, hairline offset and highlight-band position "
|
|
173
|
+
"against the reference (vg asset rebuild-object hair-gate)"
|
|
174
|
+
)
|
|
175
|
+
evidence.append("AI vision score at or above the visual acceptance threshold")
|
|
176
|
+
evidence.append("all critical semantic feature scores from the shared image pair at or above their thresholds")
|
|
177
|
+
evidence.append("self-correction review appended with action=continue before the next pass")
|
|
178
|
+
return evidence
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def has_non_empty(value: Any) -> bool:
|
|
182
|
+
if isinstance(value, str):
|
|
183
|
+
return bool(value.strip()) and value.strip().lower() not in {"none", "unassessed", "n/a"}
|
|
184
|
+
if isinstance(value, list):
|
|
185
|
+
return any(has_non_empty(item) for item in value)
|
|
186
|
+
if isinstance(value, dict):
|
|
187
|
+
return any(has_non_empty(item) for item in value.values())
|
|
188
|
+
if isinstance(value, (int, float)) and not isinstance(value, bool):
|
|
189
|
+
return abs(float(value)) > 0
|
|
190
|
+
return False
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def number_from_layer(value: Any, keys: tuple[str, ...]) -> float:
|
|
194
|
+
if isinstance(value, (int, float)) and not isinstance(value, bool):
|
|
195
|
+
return float(value)
|
|
196
|
+
if isinstance(value, dict):
|
|
197
|
+
for key in keys:
|
|
198
|
+
item = value.get(key)
|
|
199
|
+
if isinstance(item, (int, float)) and not isinstance(item, bool):
|
|
200
|
+
return float(item)
|
|
201
|
+
return 0.0
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def is_vector3(value: Any) -> bool:
|
|
205
|
+
return (
|
|
206
|
+
isinstance(value, list)
|
|
207
|
+
and len(value) == 3
|
|
208
|
+
and all(isinstance(item, (int, float)) and not isinstance(item, bool) for item in value)
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def has_number(value: Any) -> bool:
|
|
213
|
+
return isinstance(value, (int, float)) and not isinstance(value, bool)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def component_requires_attachment(component: dict[str, Any]) -> bool:
|
|
217
|
+
if not component.get("parent"):
|
|
218
|
+
return False
|
|
219
|
+
role = str(component.get("role") or "").lower()
|
|
220
|
+
name = str(component.get("name") or component.get("id") or "").lower()
|
|
221
|
+
primitive = str(component.get("primitive") or "").lower()
|
|
222
|
+
action = component.get("actionProfile") if isinstance(component.get("actionProfile"), dict) else {}
|
|
223
|
+
animation_role = str(action.get("animationRole") or "").lower()
|
|
224
|
+
tokens = {role, animation_role} | set(re.findall(r"[a-z0-9]+", name))
|
|
225
|
+
return bool(tokens & ATTACHMENT_ROLES) or primitive in ATTACHMENT_PRIMITIVES
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def attachment_complete(component: dict[str, Any]) -> bool:
|
|
229
|
+
attachment = component.get("attachment")
|
|
230
|
+
if not isinstance(attachment, dict):
|
|
231
|
+
return False
|
|
232
|
+
has_endpoint = is_vector3(attachment.get("localStart")) and is_vector3(attachment.get("localEnd"))
|
|
233
|
+
has_socket = has_non_empty(attachment.get("parentSocket")) or has_non_empty(attachment.get("parentId"))
|
|
234
|
+
has_contact = has_non_empty(attachment.get("contactType"))
|
|
235
|
+
has_overlap = (
|
|
236
|
+
number_from_layer(attachment.get("embedDepth"), ("base", "amount", "value")) > 0
|
|
237
|
+
or number_from_layer(attachment.get("overlap"), ("base", "amount", "value")) > 0
|
|
238
|
+
)
|
|
239
|
+
has_tolerance = has_number(attachment.get("gapTolerance"))
|
|
240
|
+
return has_endpoint and has_socket and has_contact and has_overlap and has_tolerance
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def attachment_gaps(spec: dict[str, Any]) -> list[str]:
|
|
244
|
+
gaps: list[str] = []
|
|
245
|
+
for component in spec.get("componentTree", []):
|
|
246
|
+
if not isinstance(component, dict) or not component_requires_attachment(component):
|
|
247
|
+
continue
|
|
248
|
+
if attachment_complete(component):
|
|
249
|
+
continue
|
|
250
|
+
component_id = str(component.get("id") or component.get("name") or "(unnamed)")
|
|
251
|
+
gaps.append(
|
|
252
|
+
f"component {component_id!r} requires attachment.parentSocket/localStart/localEnd/"
|
|
253
|
+
"contactType/embedDepth(or overlap)/gapTolerance"
|
|
254
|
+
)
|
|
255
|
+
return gaps
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def material_has_palette(material: dict[str, Any]) -> bool:
|
|
259
|
+
color_variation = material.get("colorVariation")
|
|
260
|
+
if isinstance(color_variation, dict) and len(color_variation.get("palette", [])) >= 2:
|
|
261
|
+
return True
|
|
262
|
+
albedo = material.get("albedo")
|
|
263
|
+
if isinstance(albedo, dict) and has_non_empty(albedo.get("secondary")):
|
|
264
|
+
return True
|
|
265
|
+
return has_non_empty(material.get("baseColor") or material.get("color"))
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def material_has_response(material: dict[str, Any]) -> bool:
|
|
269
|
+
if number_from_layer(material.get("roughness"), ("variation", "base")) > 0:
|
|
270
|
+
return True
|
|
271
|
+
if number_from_layer(material.get("normal"), ("strength", "amplitude")) > 0:
|
|
272
|
+
return True
|
|
273
|
+
if number_from_layer(material.get("bump"), ("amplitude", "strength")) > 0:
|
|
274
|
+
return True
|
|
275
|
+
if number_from_layer(material.get("displacement"), ("amplitude", "strength")) > 0:
|
|
276
|
+
return True
|
|
277
|
+
return False
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def material_has_locality(material: dict[str, Any]) -> bool:
|
|
281
|
+
if has_non_empty(material.get("localOverrides")):
|
|
282
|
+
return True
|
|
283
|
+
wear = material.get("wear")
|
|
284
|
+
if isinstance(wear, dict) and (
|
|
285
|
+
number_from_layer(wear.get("edgeWear"), ("base", "amount")) > 0
|
|
286
|
+
or has_non_empty(wear.get("scratches"))
|
|
287
|
+
or has_non_empty(wear.get("chips"))
|
|
288
|
+
):
|
|
289
|
+
return True
|
|
290
|
+
dirt = material.get("dirt")
|
|
291
|
+
if isinstance(dirt, dict) and (
|
|
292
|
+
number_from_layer(dirt.get("amount"), ("base", "amount")) > 0
|
|
293
|
+
or number_from_layer(dirt.get("cavityBias"), ("base", "amount")) > 0
|
|
294
|
+
):
|
|
295
|
+
return True
|
|
296
|
+
for field in ("moss", "stains", "scratches", "chips", "wetness", "patina", "soot"):
|
|
297
|
+
if has_non_empty(material.get(field)):
|
|
298
|
+
return True
|
|
299
|
+
return False
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def quality_first_enabled(spec: dict[str, Any]) -> bool:
|
|
303
|
+
targets = spec.get("lookDevTargets")
|
|
304
|
+
return isinstance(targets, dict) and targets.get("qualityPriority") == "reference-fidelity"
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
def reference_pbr_usable(material: dict[str, Any], threshold: float) -> tuple[bool, str]:
|
|
308
|
+
material_id = str(material.get("id") or "(unnamed)")
|
|
309
|
+
reference = material.get("referencePbr")
|
|
310
|
+
if not isinstance(reference, dict):
|
|
311
|
+
return False, f"material {material_id!r} needs usable referencePbr extracted from source pixels"
|
|
312
|
+
if reference.get("usable") is not True:
|
|
313
|
+
return False, f"material {material_id!r} referencePbr.usable must be true"
|
|
314
|
+
confidence = reference.get("confidence", reference.get("estimatedFidelity"))
|
|
315
|
+
if not has_number(confidence) or float(confidence) < threshold:
|
|
316
|
+
return False, f"material {material_id!r} referencePbr confidence must be >= {threshold}"
|
|
317
|
+
maps = reference.get("maps")
|
|
318
|
+
if not isinstance(maps, dict):
|
|
319
|
+
return False, f"material {material_id!r} referencePbr needs maps"
|
|
320
|
+
for channel in ("albedo", "roughness", "height", "normal", "ao"):
|
|
321
|
+
entry = maps.get(channel)
|
|
322
|
+
if not isinstance(entry, dict) or not has_non_empty(entry.get("url") or entry.get("path")):
|
|
323
|
+
return False, f"material {material_id!r} referencePbr missing {channel} map path/url"
|
|
324
|
+
return True, ""
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def quality_first_material_gaps(spec: dict[str, Any], material: dict[str, Any]) -> list[str]:
|
|
328
|
+
material_id = str(material.get("id") or "(unnamed)")
|
|
329
|
+
gaps: list[str] = []
|
|
330
|
+
targets = spec.get("lookDevTargets")
|
|
331
|
+
material_targets = targets.get("materialPass", {}) if isinstance(targets, dict) else {}
|
|
332
|
+
minimum_resolution = material_targets.get("minimumTextureResolution", 1024)
|
|
333
|
+
if not isinstance(minimum_resolution, int) or isinstance(minimum_resolution, bool):
|
|
334
|
+
minimum_resolution = 1024
|
|
335
|
+
extraction_targets = material_targets.get("referencePbrExtraction", {})
|
|
336
|
+
if not isinstance(extraction_targets, dict):
|
|
337
|
+
extraction_targets = {}
|
|
338
|
+
pbr_required = (
|
|
339
|
+
extraction_targets.get("requiredWhenSourceImagePresent") is True
|
|
340
|
+
and has_non_empty(spec.get("sourceImage"))
|
|
341
|
+
)
|
|
342
|
+
pbr_threshold = extraction_targets.get("targetThreshold", 0.7)
|
|
343
|
+
if not has_number(pbr_threshold):
|
|
344
|
+
pbr_threshold = 0.7
|
|
345
|
+
resolution = material.get("textureResolution")
|
|
346
|
+
if not isinstance(resolution, int) or isinstance(resolution, bool) or resolution < minimum_resolution:
|
|
347
|
+
gaps.append(f"material {material_id!r} textureResolution must be >= {minimum_resolution}")
|
|
348
|
+
|
|
349
|
+
projection = material.get("textureProjection")
|
|
350
|
+
if not isinstance(projection, dict) or not has_non_empty(projection.get("mode")):
|
|
351
|
+
gaps.append(f"material {material_id!r} needs textureProjection.mode and texel-density intent")
|
|
352
|
+
|
|
353
|
+
bands = material.get("surfaceFrequencyBands")
|
|
354
|
+
band_ids = {
|
|
355
|
+
str(item.get("id")).lower()
|
|
356
|
+
for item in bands
|
|
357
|
+
if isinstance(item, dict) and has_non_empty(item.get("id"))
|
|
358
|
+
} if isinstance(bands, list) else set()
|
|
359
|
+
missing_bands = {"macro", "meso", "micro"} - band_ids
|
|
360
|
+
if missing_bands:
|
|
361
|
+
gaps.append(
|
|
362
|
+
f"material {material_id!r} missing surface frequency bands: "
|
|
363
|
+
+ ", ".join(sorted(missing_bands))
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
roughness = material.get("roughness")
|
|
367
|
+
roughness_map = roughness.get("map") if isinstance(roughness, dict) else None
|
|
368
|
+
if not has_non_empty(roughness_map) or "albedo" in str(roughness_map).lower():
|
|
369
|
+
gaps.append(f"material {material_id!r} needs an independent roughness map")
|
|
370
|
+
if not has_non_empty(material.get("normal")) and not has_non_empty(material.get("bump")):
|
|
371
|
+
gaps.append(f"material {material_id!r} needs an independent height/normal response")
|
|
372
|
+
if not has_non_empty(material.get("ambientOcclusion")):
|
|
373
|
+
gaps.append(f"material {material_id!r} needs an independent ambient-occlusion response")
|
|
374
|
+
if pbr_required:
|
|
375
|
+
ok, message = reference_pbr_usable(material, float(pbr_threshold))
|
|
376
|
+
if not ok:
|
|
377
|
+
gaps.append(message)
|
|
378
|
+
return gaps
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def material_pass_gaps(spec: dict[str, Any]) -> list[str]:
|
|
382
|
+
materials = [item for item in spec.get("materials", []) if isinstance(item, dict)]
|
|
383
|
+
if not materials:
|
|
384
|
+
return ["materials array is empty"]
|
|
385
|
+
if not any(material_has_palette(item) for item in materials):
|
|
386
|
+
return ["no material has a reference-derived albedo palette or secondary color zones"]
|
|
387
|
+
gaps: list[str] = []
|
|
388
|
+
if not any(material_has_response(item) for item in materials):
|
|
389
|
+
gaps.append("no material defines roughness variation or normal/bump/displacement response")
|
|
390
|
+
if not any(material_has_locality(item) for item in materials):
|
|
391
|
+
gaps.append("no material defines local overrides, AO, dirt, wear, stains, moss, chips, or scratches")
|
|
392
|
+
material_pipeline = spec.get("materialPipeline")
|
|
393
|
+
if material_pipeline is not None:
|
|
394
|
+
if not isinstance(material_pipeline, dict) or material_pipeline.get("status") != "proceed":
|
|
395
|
+
gaps.append("materialPipeline must be wired and have status=proceed before material-pass")
|
|
396
|
+
else:
|
|
397
|
+
regions = material_pipeline.get("regions", [])
|
|
398
|
+
if not isinstance(regions, list) or not regions:
|
|
399
|
+
gaps.append("materialPipeline.regions must contain analyzed material regions")
|
|
400
|
+
else:
|
|
401
|
+
gaps.extend(
|
|
402
|
+
f"material region {region.get('regionId')!r} is not accepted ({region.get('status')!r})"
|
|
403
|
+
for region in regions
|
|
404
|
+
if isinstance(region, dict) and region.get("status") != "proceed"
|
|
405
|
+
)
|
|
406
|
+
gate = spec.get("materialGate")
|
|
407
|
+
if gate is not None and (not isinstance(gate, dict) or gate.get("passed") is not True):
|
|
408
|
+
gaps.append("materialGate.passed must be true after crop/render comparison")
|
|
409
|
+
if quality_first_enabled(spec):
|
|
410
|
+
for material in materials:
|
|
411
|
+
if material.get("qualityTier") == "utility":
|
|
412
|
+
continue
|
|
413
|
+
gaps.extend(quality_first_material_gaps(spec, material))
|
|
414
|
+
return gaps
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def surface_pass_gaps(spec: dict[str, Any]) -> list[str]:
|
|
418
|
+
components = [item for item in spec.get("componentTree", []) if isinstance(item, dict)]
|
|
419
|
+
has_surface_detail = any(has_non_empty(item.get("surfaceDetail")) for item in components)
|
|
420
|
+
if not has_surface_detail:
|
|
421
|
+
return ["componentTree has no meaningful surfaceDetail for normal/bump/displacement/AO locality"]
|
|
422
|
+
return []
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
def lighting_pass_gaps(spec: dict[str, Any]) -> list[str]:
|
|
426
|
+
lighting = spec.get("lightingFromPhoto", [])
|
|
427
|
+
if not isinstance(lighting, list) or len([item for item in lighting if has_non_empty(item)]) < 3:
|
|
428
|
+
return ["lightingFromPhoto needs at least three concrete entries for key/fill/rim or environment lighting"]
|
|
429
|
+
text = " ".join(str(item).lower() for item in lighting)
|
|
430
|
+
required_groups = {
|
|
431
|
+
"key light": ("key", "sun", "main light"),
|
|
432
|
+
"fill light": ("fill", "ambient", "hemisphere"),
|
|
433
|
+
"rim/environment light": ("rim", "back light", "environment", "hdr", "reflection"),
|
|
434
|
+
"exposure/tone mapping": ("exposure", "tone", "aces", "filmic"),
|
|
435
|
+
"contact shadow": ("contact shadow", "ground shadow", "ambient occlusion", "ao"),
|
|
436
|
+
}
|
|
437
|
+
gaps = [
|
|
438
|
+
f"lightingFromPhoto missing {label}"
|
|
439
|
+
for label, terms in required_groups.items()
|
|
440
|
+
if not any(term in text for term in terms)
|
|
441
|
+
]
|
|
442
|
+
return gaps
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def pass_specific_evidence(pass_id: str) -> list[str]:
|
|
446
|
+
if pass_id in {"structural-pass", "form-refinement"}:
|
|
447
|
+
return [
|
|
448
|
+
"attachment contracts for child appendages/connectors",
|
|
449
|
+
"no floating child roots/joints in the browser screenshot",
|
|
450
|
+
]
|
|
451
|
+
if pass_id == "material-pass":
|
|
452
|
+
return [
|
|
453
|
+
"reference-derived albedo palette with dominant, secondary, and accent colors",
|
|
454
|
+
"independent albedo, roughness, height/normal, and AO maps",
|
|
455
|
+
"macro, meso, and micro surface-frequency response at 1024px or higher",
|
|
456
|
+
"local material masks: AO, dirt, wear, stains, moss, chips, scratches, wetness, or equivalent",
|
|
457
|
+
"neutral, grazing-light close-up, and reference-matched browser screenshots",
|
|
458
|
+
"AI vision comparison sheet score meeting the visual acceptance threshold",
|
|
459
|
+
]
|
|
460
|
+
if pass_id == "surface-pass":
|
|
461
|
+
return [
|
|
462
|
+
"component surfaceDetail for tactile normal/bump/displacement and locality",
|
|
463
|
+
]
|
|
464
|
+
if pass_id == "lighting-pass":
|
|
465
|
+
return [
|
|
466
|
+
"lightingFromPhoto with key/fill/rim or environment light",
|
|
467
|
+
"exposure, tone mapping, background, shadow softness, and contact shadow behavior",
|
|
468
|
+
]
|
|
469
|
+
return []
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
def pass_specific_gaps(spec: dict[str, Any], pass_id: str) -> list[str]:
|
|
473
|
+
if pass_id in {"structural-pass", "form-refinement"}:
|
|
474
|
+
return attachment_gaps(spec)
|
|
475
|
+
if pass_id == "material-pass":
|
|
476
|
+
return material_pass_gaps(spec)
|
|
477
|
+
if pass_id == "surface-pass":
|
|
478
|
+
return surface_pass_gaps(spec)
|
|
479
|
+
if pass_id == "lighting-pass":
|
|
480
|
+
return lighting_pass_gaps(spec)
|
|
481
|
+
return []
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
def sync_pipeline(spec: dict[str, Any]) -> dict[str, Any]:
|
|
485
|
+
ids = pass_order(spec)
|
|
486
|
+
completed = completed_passes(spec, ids)
|
|
487
|
+
current = current_pass(ids, completed)
|
|
488
|
+
pipeline = spec.setdefault("sculptPipeline", {})
|
|
489
|
+
if not isinstance(pipeline, dict):
|
|
490
|
+
pipeline = {}
|
|
491
|
+
spec["sculptPipeline"] = pipeline
|
|
492
|
+
pipeline.update(
|
|
493
|
+
{
|
|
494
|
+
"passGateMode": "locked-sequential",
|
|
495
|
+
"passOrder": ids,
|
|
496
|
+
"currentPass": current,
|
|
497
|
+
"completedPasses": completed,
|
|
498
|
+
"lastCompletedPass": completed[-1] if completed else "",
|
|
499
|
+
"blockedReason": "" if current != "complete" else "all build passes completed",
|
|
500
|
+
"nextRequiredEvidence": next_required_evidence(spec, current),
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
return pipeline
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
def ledger_disagreements(spec: dict[str, Any], completed: list[str]) -> list[str]:
|
|
507
|
+
credited = set(completed)
|
|
508
|
+
ids = pass_order(spec)
|
|
509
|
+
disagreements: list[str] = []
|
|
510
|
+
history = spec.get("reviewHistory", [])
|
|
511
|
+
if not isinstance(history, list):
|
|
512
|
+
return disagreements
|
|
513
|
+
for entry in history:
|
|
514
|
+
if not isinstance(entry, dict) or entry.get("action") != "continue":
|
|
515
|
+
continue
|
|
516
|
+
pass_id = entry.get("passId")
|
|
517
|
+
if not isinstance(pass_id, str) or pass_id in credited:
|
|
518
|
+
continue
|
|
519
|
+
if pass_id in ids:
|
|
520
|
+
index = ids.index(pass_id)
|
|
521
|
+
blocker = ids[index - 1] if index > 0 else pass_id
|
|
522
|
+
disagreements.append(f"{pass_id}: reviewed but not credited because {blocker} is incomplete or its evidence/gates failed")
|
|
523
|
+
else:
|
|
524
|
+
disagreements.append(f"{pass_id}: reviewed but is not in the declared pass order")
|
|
525
|
+
return disagreements
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
def has_passing_tier1_result(spec: dict[str, Any], pass_id: str) -> bool:
|
|
529
|
+
"""Plan 1.3 Workstream D: Tier 2 (AI-vision) must never run against a render
|
|
530
|
+
that has not passed Tier 1. Checked here rather than in append_review.py so
|
|
531
|
+
the refusal happens before any expensive review step is even attempted."""
|
|
532
|
+
results = spec.get("tier1Results", [])
|
|
533
|
+
if not isinstance(results, list):
|
|
534
|
+
return False
|
|
535
|
+
return any(
|
|
536
|
+
isinstance(entry, dict) and entry.get("passId") == pass_id and entry.get("passed") is True
|
|
537
|
+
for entry in results
|
|
538
|
+
)
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
def check_pass(spec: dict[str, Any], requested_pass: str) -> tuple[bool, str, dict[str, Any]]:
|
|
542
|
+
pipeline = sync_pipeline(spec)
|
|
543
|
+
ids = list(pipeline["passOrder"])
|
|
544
|
+
if requested_pass not in ids:
|
|
545
|
+
return False, f"unknown build pass {requested_pass!r}", pipeline
|
|
546
|
+
current = str(pipeline["currentPass"])
|
|
547
|
+
completed = list(pipeline.get("completedPasses", []))
|
|
548
|
+
if requested_pass in completed or current == "complete":
|
|
549
|
+
gaps = pass_specific_gaps(spec, requested_pass)
|
|
550
|
+
if gaps:
|
|
551
|
+
return False, f"pass {requested_pass!r} needs spec refinement: {'; '.join(gaps)}", pipeline
|
|
552
|
+
return True, f"pass {requested_pass!r} is already completed and can be regenerated", pipeline
|
|
553
|
+
if requested_pass == current:
|
|
554
|
+
gaps = pass_specific_gaps(spec, requested_pass)
|
|
555
|
+
if gaps:
|
|
556
|
+
return False, f"pass {requested_pass!r} needs spec refinement: {'; '.join(gaps)}", pipeline
|
|
557
|
+
if requested_pass in VISUAL_PASS_IDS and not has_passing_tier1_result(spec, requested_pass):
|
|
558
|
+
return (
|
|
559
|
+
False,
|
|
560
|
+
f"Tier 1 diagnostics have not passed for this render — run diagnose_render.py first",
|
|
561
|
+
pipeline,
|
|
562
|
+
)
|
|
563
|
+
return True, f"pass {requested_pass!r} is the current unlocked pass", pipeline
|
|
564
|
+
previous_index = ids.index(requested_pass) - 1
|
|
565
|
+
previous = ids[previous_index] if previous_index >= 0 else ""
|
|
566
|
+
return (
|
|
567
|
+
False,
|
|
568
|
+
f"pass {requested_pass!r} is locked; complete {previous!r} with reviewHistory.action=continue and screenshot evidence first",
|
|
569
|
+
pipeline,
|
|
570
|
+
)
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
def status_payload(spec: dict[str, Any]) -> dict[str, Any]:
|
|
574
|
+
pipeline = sync_pipeline(spec)
|
|
575
|
+
return {
|
|
576
|
+
"targetName": spec.get("targetName"),
|
|
577
|
+
"passGateMode": pipeline.get("passGateMode"),
|
|
578
|
+
"currentPass": pipeline.get("currentPass"),
|
|
579
|
+
"completedPasses": pipeline.get("completedPasses", []),
|
|
580
|
+
"nextRequiredEvidence": pipeline.get("nextRequiredEvidence", []),
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
def main(argv: list[str]) -> int:
|
|
585
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
586
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
587
|
+
|
|
588
|
+
status_parser = subparsers.add_parser("status", help="Print current sculpt pipeline state")
|
|
589
|
+
status_parser.add_argument("spec", type=Path)
|
|
590
|
+
status_parser.add_argument("--json", action="store_true")
|
|
591
|
+
|
|
592
|
+
check_parser = subparsers.add_parser("check", help="Fail unless a build pass is unlocked")
|
|
593
|
+
check_parser.add_argument("spec", type=Path)
|
|
594
|
+
check_parser.add_argument("--pass-id", required=True)
|
|
595
|
+
check_parser.add_argument("--json", action="store_true")
|
|
596
|
+
|
|
597
|
+
sync_parser = subparsers.add_parser("sync", help="Refresh sculptPipeline from reviewHistory")
|
|
598
|
+
sync_parser.add_argument("spec", type=Path)
|
|
599
|
+
sync_parser.add_argument("--in-place", action="store_true")
|
|
600
|
+
sync_parser.add_argument("--out", type=Path)
|
|
601
|
+
sync_parser.add_argument("--json", action="store_true")
|
|
602
|
+
|
|
603
|
+
args = parser.parse_args(argv)
|
|
604
|
+
spec_path = args.spec.expanduser().resolve()
|
|
605
|
+
spec = load_spec(spec_path)
|
|
606
|
+
emit_status(spec, next_command=f"vg asset rebuild-object orchestrate-passes {args.command} {spec_path}", stream=sys.stderr if getattr(args, "json", False) else sys.stdout)
|
|
607
|
+
|
|
608
|
+
if args.command == "status":
|
|
609
|
+
payload = status_payload(spec)
|
|
610
|
+
if args.json:
|
|
611
|
+
print(json.dumps(payload, indent=2, ensure_ascii=False))
|
|
612
|
+
else:
|
|
613
|
+
print(f"currentPass: {payload['currentPass']}")
|
|
614
|
+
print(f"completedPasses: {', '.join(payload['completedPasses']) or '(none)'}")
|
|
615
|
+
for item in payload["nextRequiredEvidence"]:
|
|
616
|
+
print(f"required: {item}")
|
|
617
|
+
return 0
|
|
618
|
+
|
|
619
|
+
if args.command == "check":
|
|
620
|
+
ok, message, pipeline = check_pass(spec, args.pass_id)
|
|
621
|
+
payload = {"ok": ok, "message": message, "pipeline": pipeline}
|
|
622
|
+
if args.json:
|
|
623
|
+
print(json.dumps(payload, indent=2, ensure_ascii=False))
|
|
624
|
+
else:
|
|
625
|
+
print("PASS" if ok else "FAIL")
|
|
626
|
+
print(message)
|
|
627
|
+
return 0 if ok else 1
|
|
628
|
+
|
|
629
|
+
if args.command == "sync":
|
|
630
|
+
ids = pass_order(spec)
|
|
631
|
+
completed = completed_passes(spec, ids)
|
|
632
|
+
disagreements = ledger_disagreements(spec, completed)
|
|
633
|
+
if disagreements:
|
|
634
|
+
print("ledger disagreement: review history contains uncredited passes", file=sys.stderr)
|
|
635
|
+
for item in disagreements:
|
|
636
|
+
print(f"- {item}", file=sys.stderr)
|
|
637
|
+
return 1
|
|
638
|
+
payload = status_payload(spec)
|
|
639
|
+
output = spec_path if args.in_place else (args.out.expanduser().resolve() if args.out else None)
|
|
640
|
+
if output:
|
|
641
|
+
write_spec(output, spec)
|
|
642
|
+
if args.json:
|
|
643
|
+
print(json.dumps(payload, indent=2, ensure_ascii=False))
|
|
644
|
+
else:
|
|
645
|
+
print(output or json.dumps(spec, indent=2, ensure_ascii=False))
|
|
646
|
+
return 0
|
|
647
|
+
|
|
648
|
+
parser.error("unreachable command")
|
|
649
|
+
return 2
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
if __name__ == "__main__":
|
|
653
|
+
raise SystemExit(main(sys.argv[1:]))
|