OUTPUT #737
PARÇA 2 / 4
TOPLAM: 132172 karakter | 2996 satır
BU PARÇA: 40000 karakter
l_contact_sheet.jpg"),
753- "vision_qa_brief": str(work / "vision_qa_brief.json"),
754- "video_md5": final_md5,
755- }
756- (work / "pipeline_result.json").write_text(
757- json.dumps(result, ensure_ascii=False, indent=2),
758- encoding="utf-8"
759- )
760- print(json.dumps(result, ensure_ascii=False))
/home/hermes/.hermes/skills/media/shorts-core/scripts/production_guardrails.py.bak-proof-doc-20260906-234430
553-
554- if r.get("pass") is not True:
555- errors.append("PROOF_GATE_INVALID: receipt does not contain pass=true")
556- if r.get("verifier") != "vision_analyze":
557- errors.append("PROOF_GATE_INVALID: verifier must be vision_analyze")
558- if r.get("receipt_source") != "shorts-production-guard/post_tool_call":
559- errors.append("PROOF_GATE_INVALID: receipt was not issued by the vision post-tool hook")
560-
561: sheet = r.get("contact_sheet")
562: sheet_hash = r.get("contact_sheet_sha256")
563- if not isinstance(sheet, str) or not Path(sheet).exists():
564- errors.append("PROOF_GATE_INVALID: accepted proof contact sheet is missing")
565- elif not isinstance(sheet_hash, str) or sha_file(sheet) != sheet_hash:
566- errors.append("PROOF_GATE_STALE: accepted proof contact sheet changed after Vision verification")
567-
568- if r.get("fingerprint") != proof_fingerprint(data):
569- errors.append(
570- "PROOF_GATE_STALE: creative intent, proof candidates, or proof source changed after acceptance"
--
707- })
708-
709- missing_cover = sorted(required_cover - covered)
710- if missing_cover:
711- hard.append(
712- "proof_gate candidates do not cover required targets: " + ", ".join(missing_cover)
713- )
714-
715: sheet = wd / "proof_contact_sheet.jpg"
716- if valid:
717- rows = max(1, (len(valid) + 2) // 3)
718- run([
719- FFMPEG, "-y", "-v", "error",
720- "-framerate", "1",
721- "-i", str(wd / "proof_frame_%03d.jpg"),
722- "-vf", f"tile=3x{rows}:margin=0:padding=0",
723- "-frames:v", "1",
--
758- passed = not hard and bool(valid) and sheet.exists()
759-
760- pending_path = wd / "proof_pending.json"
761- if passed:
762- pending = {
763- "fingerprint": fingerprint,
764- "proof_token": proof_token,
765- "manifest": str(mp),
766: "contact_sheet": str(sheet.resolve()),
767: "contact_sheet_sha256": sha_file(sheet),
768- "receipt": str(receipt),
769- "created_at": time.time(),
770- }
771- pending_path.write_text(
772- json.dumps(pending, ensure_ascii=False, indent=2) + "\n",
773- encoding="utf-8"
774- )
775- else:
--
782- "proof_visible_and_unmistakable, notes, proof_token. "
783- "verifier must be vision_analyze and proof_token must be copied exactly."
784- )
785-
786- return {
787- "pass": passed,
788- "version": VERSION,
789- "fingerprint": fingerprint,
790: "proof_contact_sheet": str(sheet) if sheet.exists() else None,
791- "proof_qa_brief": str(brief_path),
792- "proof_pending": str(pending_path) if passed else None,
793- "vision_question": vision_question if passed else None,
794- "valid_candidates": len(valid),
795- "hard_failures": hard,
796- "next": (
797: "Send proof_contact_sheet + proof_qa_brief to vision_analyze. "
798- "Only on PASS create the verdict JSON and run proof-accept."
799- if passed else "Repair proof candidates before any TTS/render work."
800- )
801- }
802-
803-
804-def proof_accept(*args, **kwargs):
805- raise RuntimeError(
/home/hermes/.hermes/skills/media/shorts-core/scripts/production_guardrails.py.bak-p0-tests-version-20260907-203224
775-
776- if r.get("pass") is not True:
777- errors.append("PROOF_GATE_INVALID: receipt does not contain pass=true")
778- if r.get("verifier") != "vision_analyze":
779- errors.append("PROOF_GATE_INVALID: verifier must be vision_analyze")
780- if r.get("receipt_source") != "shorts-production-guard/post_tool_call":
781- errors.append("PROOF_GATE_INVALID: receipt was not issued by the vision post-tool hook")
782-
783: sheet = r.get("contact_sheet")
784: sheet_hash = r.get("contact_sheet_sha256")
785- if not isinstance(sheet, str) or not Path(sheet).exists():
786- errors.append("PROOF_GATE_INVALID: accepted proof contact sheet is missing")
787- elif not isinstance(sheet_hash, str) or sha_file(sheet) != sheet_hash:
788- errors.append("PROOF_GATE_STALE: accepted proof contact sheet changed after Vision verification")
789-
790- if r.get("fingerprint") != proof_fingerprint(data):
791- errors.append(
792- "PROOF_GATE_STALE: creative intent, proof candidates, or proof source changed after acceptance"
--
951- })
952-
953- missing_cover = sorted(required_cover - covered)
954- if missing_cover:
955- hard.append(
956- "proof_gate candidates do not cover required targets: " + ", ".join(missing_cover)
957- )
958-
959: sheet = wd / "proof_contact_sheet.jpg"
960- if proof_frames:
961- cols = 5
962- rows = max(1, (len(proof_frames) + cols - 1) // cols)
963- run([
964- FFMPEG, "-y", "-v", "error",
965- "-framerate", "1",
966- "-i", str(wd / "proof_frame_%03d.jpg"),
967- "-vf", f"tile={cols}x{rows}:margin=0:padding=0",
--
1003- passed = not hard and bool(valid) and sheet.exists()
1004-
1005- pending_path = wd / "proof_pending.json"
1006- if passed:
1007- pending = {
1008- "fingerprint": fingerprint,
1009- "proof_token": proof_token,
1010- "manifest": str(mp),
1011: "contact_sheet": str(sheet.resolve()),
1012: "contact_sheet_sha256": sha_file(sheet),
1013- "receipt": str(receipt),
1014- "created_at": time.time(),
1015- }
1016- pending_path.write_text(
1017- json.dumps(pending, ensure_ascii=False, indent=2) + "\n",
1018- encoding="utf-8"
1019- )
1020- else:
--
1032- "notes must be a short string. "
1033- "proof_token must be copied exactly."
1034- )
1035-
1036- return {
1037- "pass": passed,
1038- "version": VERSION,
1039- "fingerprint": fingerprint,
1040: "proof_contact_sheet": str(sheet) if sheet.exists() else None,
1041- "proof_qa_brief": str(brief_path),
1042- "proof_pending": str(pending_path) if passed else None,
1043- "vision_question": vision_question if passed else None,
1044- "valid_candidates": len(valid),
1045- "hard_failures": hard,
1046- "next": (
1047: "Call vision_analyze on proof_contact_sheet using vision_question. "
1048- "A PASS receipt is issued automatically by the shorts-production-guard post_tool_call hook. "
1049- "Never create a verdict or proof receipt manually."
1050- if passed else "Repair proof candidates before any TTS/render work."
1051- )
1052- }
1053-
1054-
1055-def proof_accept(*args, **kwargs):
/home/hermes/.hermes/skills/media/shorts-core/scripts/shorts_fast_pipeline.py.bak-audio-v2-20260906-181535
454- FFMPEG, "-y", "-v", "error",
455- "-i", str(final),
456- "-vf",
457- f"select='{select}',"
458- "scale=360:640:flags=lanczos,"
459- f"tile={cols}x{rows}:margin=0:padding=0",
460- "-fps_mode", "vfr",
461- "-frames:v", "1",
462: str(work / "final_contact_sheet.jpg")
463- ])
464: (work / "semantic_contact_sheet.json").write_text(
465- json.dumps({
466- "times": times,
467- "frames": frame_nums,
468- "shot_count": len(shots),
469- "grid": [cols, rows]
470- }, ensure_ascii=False, indent=2),
471- encoding="utf-8"
472- )
--
725- qa_sig = stamp([final], "deterministic-final-qa-v4|" + json.dumps({
726- "shots": shots,
727- "creative_intent": m.get("creative_intent", {}),
728- "performance_plan": m.get("performance_plan", {}),
729- }, sort_keys=True, ensure_ascii=False))
730- qa_meta = work / ".qa.json"
731- cached_qa = False
732-
733: if qa_meta.exists() and (work / "final_contact_sheet.jpg").exists():
734- try:
735- cached_qa = json.loads(
736- qa_meta.read_text(encoding="utf-8")
737- ).get("sig") == qa_sig
738- except Exception:
739- pass
740-
741- if not cached_qa:
--
749- "pass": True,
750- "version": VERSION,
751- "cached_tts": cached_tts,
752- "cached_visual": cached_visual,
753- "cached_final": cached_final,
754- "cached_qa": cached_qa,
755- "duration": probe_duration(final),
756- "final": str(final),
757: "contact_sheet": str(work / "final_contact_sheet.jpg"),
758- "vision_qa_brief": str(work / "vision_qa_brief.json"),
759- "video_md5": final_md5,
760- }
761- (work / "pipeline_result.json").write_text(
762- json.dumps(result, ensure_ascii=False, indent=2),
763- encoding="utf-8"
764- )
765- print(json.dumps(result, ensure_ascii=False))
/home/hermes/.hermes/skills/media/shorts-core/scripts/shorts_fast_pipeline.py
362- run([
363- FFMPEG, "-y", "-v", "error",
364- "-i", str(final),
365- "-vf",
366- f"fps={fps:.6f}:start_time=0.5:round=near,"
367- "scale=360:640:flags=lanczos,"
368- "tile=3x2:margin=0:padding=0",
369- "-frames:v", "1",
370: str(work / "final_contact_sheet.jpg")
371- ])
372-
373-def main():
374- ap = argparse.ArgumentParser()
375- ap.add_argument("manifest")
376- args = ap.parse_args()
377-
378- manifest_path = Path(args.manifest).resolve()
--
521- )
522- else:
523- final_md5 = final_info["video_md5"]
524-
525- qa_sig = stamp([final], "deterministic-final-qa-v1")
526- qa_meta = work / ".qa.json"
527- cached_qa = False
528-
529: if qa_meta.exists() and (work / "final_contact_sheet.jpg").exists():
530- try:
531- cached_qa = json.loads(
532- qa_meta.read_text(encoding="utf-8")
533- ).get("sig") == qa_sig
534- except Exception:
535- pass
536-
537- if not cached_qa:
--
545- "pass": True,
546- "version": VERSION,
547- "cached_tts": cached_tts,
548- "cached_visual": cached_visual,
549- "cached_final": cached_final,
550- "cached_qa": cached_qa,
551- "duration": probe_duration(final),
552- "final": str(final),
553: "contact_sheet": str(work / "final_contact_sheet.jpg"),
554- "video_md5": final_md5,
555- }
556- (work / "pipeline_result.json").write_text(
557- json.dumps(result, ensure_ascii=False, indent=2),
558- encoding="utf-8"
559- )
560- print(json.dumps(result, ensure_ascii=False))
561-
/home/hermes/.hermes/skills/media/shorts-core/scripts/shorts_fast_pipeline.py.bak-pre-tts-markup-20260907
673- FFMPEG, "-y", "-v", "error",
674- "-i", str(final),
675- "-vf",
676- f"select='{select}',"
677- "scale=360:640:flags=lanczos,"
678- f"tile={cols}x{rows}:margin=0:padding=0",
679- "-fps_mode", "vfr",
680- "-frames:v", "1",
681: str(work / "final_contact_sheet.jpg")
682- ])
683: (work / "semantic_contact_sheet.json").write_text(
684- json.dumps({
685- "times": times,
686- "frames": frame_nums,
687- "shot_count": len(shots),
688- "samples": samples,
689- "grid": [cols, rows]
690- }, ensure_ascii=False, indent=2),
691- encoding="utf-8"
--
1079- "creative_intent": m.get("creative_intent", {}),
1080- "performance_plan": m.get("performance_plan", {}),
1081- "directing_plan": m.get("directing_plan", {}),
1082- "audio_intent": m.get("audio_intent", {}),
1083- }, sort_keys=True, ensure_ascii=False))
1084- qa_meta = work / ".qa.json"
1085- cached_qa = False
1086-
1087: if qa_meta.exists() and (work / "final_contact_sheet.jpg").exists():
1088- try:
1089- cached_qa = json.loads(
1090- qa_meta.read_text(encoding="utf-8")
1091- ).get("sig") == qa_sig
1092- except Exception:
1093- pass
1094-
1095- if not cached_qa:
--
1106- "creative_status": "PENDING_FINAL_SEMANTIC_VISION_QA",
1107- "version": VERSION,
1108- "cached_tts": cached_tts,
1109- "cached_visual": cached_visual,
1110- "cached_final": cached_final,
1111- "cached_qa": cached_qa,
1112- "duration": probe_duration(final),
1113- "final": str(final),
1114: "contact_sheet": str(work / "final_contact_sheet.jpg"),
1115- "vision_qa_brief": str(work / "vision_qa_brief.json"),
1116- "caption_plan": str(work / "caption_plan.json"),
1117- "caption_grouping_mode": caption_plan["grouping_mode"],
1118- "timing_plan": str(work / "timing_plan.json"),
1119- "video_md5": final_md5,
1120- }
1121- (work / "pipeline_result.json").write_text(
1122- json.dumps(result, ensure_ascii=False, indent=2),
/home/hermes/.hermes/skills/media/shorts-core/scripts/production_guardrails.py.pre-single-source-repair-20260909-173502
1080-
1081- if r.get("pass") is not True:
1082- errors.append("PROOF_GATE_INVALID: receipt does not contain pass=true")
1083- if r.get("verifier") != "vision_analyze":
1084- errors.append("PROOF_GATE_INVALID: verifier must be vision_analyze")
1085- if r.get("receipt_source") != "shorts-production-guard/post_tool_call":
1086- errors.append("PROOF_GATE_INVALID: receipt was not issued by the vision post-tool hook")
1087-
1088: sheet = r.get("contact_sheet")
1089: sheet_hash = r.get("contact_sheet_sha256")
1090- if not isinstance(sheet, str) or not Path(sheet).exists():
1091- errors.append("PROOF_GATE_INVALID: accepted proof contact sheet is missing")
1092- elif not isinstance(sheet_hash, str) or sha_file(sheet) != sheet_hash:
1093- errors.append("PROOF_GATE_STALE: accepted proof contact sheet changed after Vision verification")
1094-
1095- if r.get("fingerprint") != proof_fingerprint(data):
1096- errors.append(
1097- "PROOF_GATE_STALE: creative intent, proof candidates, or proof source changed after acceptance"
--
1288- # A runtime-issued receipt already binds the proof fingerprint, evidence
1289- # sheet hash, casting contract, and source identities. If all of that is
1290- # still valid, regenerating frames/question/pending state cannot add proof;
1291- # it only invites another Vision and main-agent loop.
1292- receipt_errors = validate_proof_receipt(data, mp)
1293- if not hard and not receipt_errors:
1294- receipt_path = proof_receipt_path(data, mp)
1295- receipt = json.loads(receipt_path.read_text(encoding="utf-8"))
1296: sheet = Path(receipt["contact_sheet"]).resolve()
1297- return {
1298- "pass": True,
1299- "version": VERSION,
1300- "fingerprint": proof_fingerprint(data),
1301- "proof_status": "already_accepted",
1302- "vision_required": False,
1303: "proof_contact_sheet": str(sheet),
1304- "proof_qa_brief": None,
1305- "proof_pending": None,
1306- "vision_question": None,
1307- "valid_candidates": len(gate.get("candidates") or []),
1308- "valid_casting_roles": len(casting_review_entries(data)),
1309- "hard_failures": [],
1310- "warnings": [],
1311- "next": "Proof receipt is current; proceed without another proof Vision call.",
--
1505- casting_valid.append(reviewed)
1506-
1507- missing_cover = sorted(required_cover - covered)
1508- if missing_cover:
1509- hard.append(
1510- "proof_gate candidates do not cover required targets: " + ", ".join(missing_cover)
1511- )
1512-
1513: sheet = wd / "proof_contact_sheet.jpg"
1514- if proof_frames:
1515- cols = 5
1516- rows = max(1, (len(proof_frames) + cols - 1) // cols)
1517- run([
1518- FFMPEG, "-y", "-v", "error",
1519- "-framerate", "1",
1520- "-i", str(wd / "proof_frame_%03d.jpg"),
1521- "-vf", f"tile={cols}x{rows}:margin=0:padding=0",
--
1564- passed = not hard and bool(valid) and sheet.exists()
1565-
1566- pending_path = wd / "proof_pending.json"
1567- if passed:
1568- pending = {
1569- "fingerprint": fingerprint,
1570- "proof_token": proof_token,
1571- "manifest": str(mp),
1572: "contact_sheet": str(sheet.resolve()),
1573: "contact_sheet_sha256": sha_file(sheet),
1574- "receipt": str(receipt),
1575- "created_at": time.time(),
1576- }
1577- pending_path.write_text(
1578- json.dumps(pending, ensure_ascii=False, indent=2) + "\n",
1579- encoding="utf-8"
1580- )
1581- else:
--
1599- )
1600-
1601- return {
1602- "pass": passed,
1603- "version": VERSION,
1604- "fingerprint": fingerprint,
1605- "proof_status": "vision_required" if passed else "invalid",
1606- "vision_required": bool(passed),
1607: "proof_contact_sheet": str(sheet) if sheet.exists() else None,
1608- "proof_qa_brief": str(brief_path),
1609- "proof_pending": str(pending_path) if passed else None,
1610- "vision_question": vision_question if passed else None,
1611- "valid_candidates": len(valid),
1612- "valid_casting_roles": len(casting_valid),
1613- "hard_failures": hard,
1614- "warnings": warnings,
1615- "next": (
1616: "Call vision_analyze on proof_contact_sheet using vision_question. "
1617- "A PASS receipt is issued automatically by the shorts-production-guard post_tool_call hook. "
1618- "Never create a verdict or proof receipt manually."
1619- if passed else "Repair proof candidates before any TTS/render work."
1620- )
1621- }
1622-
1623-
1624-def proof_accept(*args, **kwargs):
/home/hermes/.hermes/skills/media/shorts-core/scripts/production_guardrails.py.bak-proof-schema-20260907-011554
553-
554- if r.get("pass") is not True:
555- errors.append("PROOF_GATE_INVALID: receipt does not contain pass=true")
556- if r.get("verifier") != "vision_analyze":
557- errors.append("PROOF_GATE_INVALID: verifier must be vision_analyze")
558- if r.get("receipt_source") != "shorts-production-guard/post_tool_call":
559- errors.append("PROOF_GATE_INVALID: receipt was not issued by the vision post-tool hook")
560-
561: sheet = r.get("contact_sheet")
562: sheet_hash = r.get("contact_sheet_sha256")
563- if not isinstance(sheet, str) or not Path(sheet).exists():
564- errors.append("PROOF_GATE_INVALID: accepted proof contact sheet is missing")
565- elif not isinstance(sheet_hash, str) or sha_file(sheet) != sheet_hash:
566- errors.append("PROOF_GATE_STALE: accepted proof contact sheet changed after Vision verification")
567-
568- if r.get("fingerprint") != proof_fingerprint(data):
569- errors.append(
570- "PROOF_GATE_STALE: creative intent, proof candidates, or proof source changed after acceptance"
--
723- })
724-
725- missing_cover = sorted(required_cover - covered)
726- if missing_cover:
727- hard.append(
728- "proof_gate candidates do not cover required targets: " + ", ".join(missing_cover)
729- )
730-
731: sheet = wd / "proof_contact_sheet.jpg"
732- if proof_frames:
733- cols = 5
734- rows = max(1, (len(proof_frames) + cols - 1) // cols)
735- run([
736- FFMPEG, "-y", "-v", "error",
737- "-framerate", "1",
738- "-i", str(wd / "proof_frame_%03d.jpg"),
739- "-vf", f"tile={cols}x{rows}:margin=0:padding=0",
--
775- passed = not hard and bool(valid) and sheet.exists()
776-
777- pending_path = wd / "proof_pending.json"
778- if passed:
779- pending = {
780- "fingerprint": fingerprint,
781- "proof_token": proof_token,
782- "manifest": str(mp),
783: "contact_sheet": str(sheet.resolve()),
784: "contact_sheet_sha256": sha_file(sheet),
785- "receipt": str(receipt),
786- "created_at": time.time(),
787- }
788- pending_path.write_text(
789- json.dumps(pending, ensure_ascii=False, indent=2) + "\n",
790- encoding="utf-8"
791- )
792- else:
--
799- "proof_visible_and_unmistakable, notes, proof_token. "
800- "verifier must be vision_analyze and proof_token must be copied exactly."
801- )
802-
803- return {
804- "pass": passed,
805- "version": VERSION,
806- "fingerprint": fingerprint,
807: "proof_contact_sheet": str(sheet) if sheet.exists() else None,
808- "proof_qa_brief": str(brief_path),
809- "proof_pending": str(pending_path) if passed else None,
810- "vision_question": vision_question if passed else None,
811- "valid_candidates": len(valid),
812- "hard_failures": hard,
813- "next": (
814: "Call vision_analyze on proof_contact_sheet using vision_question. "
815- "A PASS receipt is issued automatically by the shorts-production-guard post_tool_call hook. "
816- "Never create a verdict or proof receipt manually."
817- if passed else "Repair proof candidates before any TTS/render work."
818- )
819- }
820-
821-
822-def proof_accept(*args, **kwargs):
/home/hermes/.hermes/skills/media/shorts-core/scripts/production_guardrails.py.bak-proof-temporal-20260907-000944
553-
554- if r.get("pass") is not True:
555- errors.append("PROOF_GATE_INVALID: receipt does not contain pass=true")
556- if r.get("verifier") != "vision_analyze":
557- errors.append("PROOF_GATE_INVALID: verifier must be vision_analyze")
558- if r.get("receipt_source") != "shorts-production-guard/post_tool_call":
559- errors.append("PROOF_GATE_INVALID: receipt was not issued by the vision post-tool hook")
560-
561: sheet = r.get("contact_sheet")
562: sheet_hash = r.get("contact_sheet_sha256")
563- if not isinstance(sheet, str) or not Path(sheet).exists():
564- errors.append("PROOF_GATE_INVALID: accepted proof contact sheet is missing")
565- elif not isinstance(sheet_hash, str) or sha_file(sheet) != sheet_hash:
566- errors.append("PROOF_GATE_STALE: accepted proof contact sheet changed after Vision verification")
567-
568- if r.get("fingerprint") != proof_fingerprint(data):
569- errors.append(
570- "PROOF_GATE_STALE: creative intent, proof candidates, or proof source changed after acceptance"
--
707- })
708-
709- missing_cover = sorted(required_cover - covered)
710- if missing_cover:
711- hard.append(
712- "proof_gate candidates do not cover required targets: " + ", ".join(missing_cover)
713- )
714-
715: sheet = wd / "proof_contact_sheet.jpg"
716- if valid:
717- rows = max(1, (len(valid) + 2) // 3)
718- run([
719- FFMPEG, "-y", "-v", "error",
720- "-framerate", "1",
721- "-i", str(wd / "proof_frame_%03d.jpg"),
722- "-vf", f"tile=3x{rows}:margin=0:padding=0",
723- "-frames:v", "1",
--
758- passed = not hard and bool(valid) and sheet.exists()
759-
760- pending_path = wd / "proof_pending.json"
761- if passed:
762- pending = {
763- "fingerprint": fingerprint,
764- "proof_token": proof_token,
765- "manifest": str(mp),
766: "contact_sheet": str(sheet.resolve()),
767: "contact_sheet_sha256": sha_file(sheet),
768- "receipt": str(receipt),
769- "created_at": time.time(),
770- }
771- pending_path.write_text(
772- json.dumps(pending, ensure_ascii=False, indent=2) + "\n",
773- encoding="utf-8"
774- )
775- else:
--
782- "proof_visible_and_unmistakable, notes, proof_token. "
783- "verifier must be vision_analyze and proof_token must be copied exactly."
784- )
785-
786- return {
787- "pass": passed,
788- "version": VERSION,
789- "fingerprint": fingerprint,
790: "proof_contact_sheet": str(sheet) if sheet.exists() else None,
791- "proof_qa_brief": str(brief_path),
792- "proof_pending": str(pending_path) if passed else None,
793- "vision_question": vision_question if passed else None,
794- "valid_candidates": len(valid),
795- "hard_failures": hard,
796- "next": (
797: "Call vision_analyze on proof_contact_sheet using vision_question. "
798- "A PASS receipt is issued automatically by the shorts-production-guard post_tool_call hook. "
799- "Never create a verdict or proof receipt manually."
800- if passed else "Repair proof candidates before any TTS/render work."
801- )
802- }
803-
804-
805-def proof_accept(*args, **kwargs):
/home/hermes/.hermes/skills/media/shorts-core/scripts/production_guardrails.py.pre-preproof-cli-20260909-160353
1075-
1076- if r.get("pass") is not True:
1077- errors.append("PROOF_GATE_INVALID: receipt does not contain pass=true")
1078- if r.get("verifier") != "vision_analyze":
1079- errors.append("PROOF_GATE_INVALID: verifier must be vision_analyze")
1080- if r.get("receipt_source") != "shorts-production-guard/post_tool_call":
1081- errors.append("PROOF_GATE_INVALID: receipt was not issued by the vision post-tool hook")
1082-
1083: sheet = r.get("contact_sheet")
1084: sheet_hash = r.get("contact_sheet_sha256")
1085- if not isinstance(sheet, str) or not Path(sheet).exists():
1086- errors.append("PROOF_GATE_INVALID: accepted proof contact sheet is missing")
1087- elif not isinstance(sheet_hash, str) or sha_file(sheet) != sheet_hash:
1088- errors.append("PROOF_GATE_STALE: accepted proof contact sheet changed after Vision verification")
1089-
1090- if r.get("fingerprint") != proof_fingerprint(data):
1091- errors.append(
1092- "PROOF_GATE_STALE: creative intent, proof candidates, or proof source changed after acceptance"
--
1174- # A runtime-issued receipt already binds the proof fingerprint, evidence
1175- # sheet hash, casting contract, and source identities. If all of that is
1176- # still valid, regenerating frames/question/pending state cannot add proof;
1177- # it only invites another Vision and main-agent loop.
1178- receipt_errors = validate_proof_receipt(data, mp)
1179- if not hard and not receipt_errors:
1180- receipt_path = proof_receipt_path(data, mp)
1181- receipt = json.loads(receipt_path.read_text(encoding="utf-8"))
1182: sheet = Path(receipt["contact_sheet"]).resolve()
1183- return {
1184- "pass": True,
1185- "version": VERSION,
1186- "fingerprint": proof_fingerprint(data),
1187- "proof_status": "already_accepted",
1188- "vision_required": False,
1189: "proof_contact_sheet": str(sheet),
1190- "proof_qa_brief": None,
1191- "proof_pending": None,
1192- "vision_question": None,
1193- "valid_candidates": len(gate.get("candidates") or []),
1194- "valid_casting_roles": len(casting_review_entries(data)),
1195- "hard_failures": [],
1196- "warnings": [],
1197- "next": "Proof receipt is current; proceed without another proof Vision call.",
--
1391- casting_valid.append(reviewed)
1392-
1393- missing_cover = sorted(required_cover - covered)
1394- if missing_cover:
1395- hard.append(
1396- "proof_gate candidates do not cover required targets: " + ", ".join(missing_cover)
1397- )
1398-
1399: sheet = wd / "proof_contact_sheet.jpg"
1400- if proof_frames:
1401- cols = 5
1402- rows = max(1, (len(proof_frames) + cols - 1) // cols)
1403- run([
1404- FFMPEG, "-y", "-v", "error",
1405- "-framerate", "1",
1406- "-i", str(wd / "proof_frame_%03d.jpg"),
1407- "-vf", f"tile={cols}x{rows}:margin=0:padding=0",
--
1450- passed = not hard and bool(valid) and sheet.exists()
1451-
1452- pending_path = wd / "proof_pending.json"
1453- if passed:
1454- pending = {
1455- "fingerprint": fingerprint,
1456- "proof_token": proof_token,
1457- "manifest": str(mp),
1458: "contact_sheet": str(sheet.resolve()),
1459: "contact_sheet_sha256": sha_file(sheet),
1460- "receipt": str(receipt),
1461- "created_at": time.time(),
1462- }
1463- pending_path.write_text(
1464- json.dumps(pending, ensure_ascii=False, indent=2) + "\n",
1465- encoding="utf-8"
1466- )
1467- else:
--
1485- )
1486-
1487- return {
1488- "pass": passed,
1489- "version": VERSION,
1490- "fingerprint": fingerprint,
1491- "proof_status": "vision_required" if passed else "invalid",
1492- "vision_required": bool(passed),
1493: "proof_contact_sheet": str(sheet) if sheet.exists() else None,
1494- "proof_qa_brief": str(brief_path),
1495- "proof_pending": str(pending_path) if passed else None,
1496- "vision_question": vision_question if passed else None,
1497- "valid_candidates": len(valid),
1498- "valid_casting_roles": len(casting_valid),
1499- "hard_failures": hard,
1500- "warnings": warnings,
1501- "next": (
1502: "Call vision_analyze on proof_contact_sheet using vision_question. "
1503- "A PASS receipt is issued automatically by the shorts-production-guard post_tool_call hook. "
1504- "Never create a verdict or proof receipt manually."
1505- if passed else "Repair proof candidates before any TTS/render work."
1506- )
1507- }
1508-
1509-
1510-def proof_accept(*args, **kwargs):
/home/hermes/.hermes/skills/media/shorts-core/scripts/production_guardrails.py.pre-preproof-plan-gate-20260909-152204
1042-
1043- if r.get("pass") is not True:
1044- errors.append("PROOF_GATE_INVALID: receipt does not contain pass=true")
1045- if r.get("verifier") != "vision_analyze":
1046- errors.append("PROOF_GATE_INVALID: verifier must be vision_analyze")
1047- if r.get("receipt_source") != "shorts-production-guard/post_tool_call":
1048- errors.append("PROOF_GATE_INVALID: receipt was not issued by the vision post-tool hook")
1049-
1050: sheet = r.get("contact_sheet")
1051: sheet_hash = r.get("contact_sheet_sha256")
1052- if not isinstance(sheet, str) or not Path(sheet).exists():
1053- errors.append("PROOF_GATE_INVALID: accepted proof contact sheet is missing")
1054- elif not isinstance(sheet_hash, str) or sha_file(sheet) != sheet_hash:
1055- errors.append("PROOF_GATE_STALE: accepted proof contact sheet changed after Vision verification")
1056-
1057- if r.get("fingerprint") != proof_fingerprint(data):
1058- errors.append(
1059- "PROOF_GATE_STALE: creative intent, proof candidates, or proof source changed after acceptance"
--
1097- # A runtime-issued receipt already binds the proof fingerprint, evidence
1098- # sheet hash, casting contract, and source identities. If all of that is
1099- # still valid, regenerating frames/question/pending state cannot add proof;
1100- # it only invites another Vision and main-agent loop.
1101- receipt_errors = validate_proof_receipt(data, mp)
1102- if not hard and not receipt_errors:
1103- receipt_path = proof_receipt_path(data, mp)
1104- receipt = json.loads(receipt_path.read_text(encoding="utf-8"))
1105: sheet = Path(receipt["contact_sheet"]).resolve()
1106- return {
1107- "pass": True,
1108- "version": VERSION,
1109- "fingerprint": proof_fingerprint(data),
1110- "proof_status": "already_accepted",
1111- "vision_required": False,
1112: "proof_contact_sheet": str(sheet),
1113- "proof_qa_brief": None,
1114- "proof_pending": None,
1115- "vision_question": None,
1116- "valid_candidates": len(gate.get("candidates") or []),
1117- "valid_casting_roles": len(casting_review_entries(data)),
1118- "hard_failures": [],
1119- "warnings": [],
1120- "next": "Proof receipt is current; proceed without another proof Vision call.",
--
1314- casting_valid.append(reviewed)
1315-
1316- missing_cover = sorted(required_cover - covered)
1317- if missing_cover:
1318- hard.append(
1319- "proof_gate candidates do not cover required targets: " + ", ".join(missing_cover)
1320- )
1321-
1322: sheet = wd / "proof_contact_sheet.jpg"
1323- if proof_frames:
1324- cols = 5
1325- rows = max(1, (len(proof_frames) + cols - 1) // cols)
1326- run([
1327- FFMPEG, "-y", "-v", "error",
1328- "-framerate", "1",
1329- "-i", str(wd / "proof_frame_%03d.jpg"),
1330- "-vf", f"tile={cols}x{rows}:margin=0:padding=0",
--
1373- passed = not hard and bool(valid) and sheet.exists()
1374-
1375- pending_path = wd / "proof_pending.json"
1376- if passed:
1377- pending = {
1378- "fingerprint": fingerprint,
1379- "proof_token": proof_token,
1380- "manifest": str(mp),
1381: "contact_sheet": str(sheet.resolve()),
1382: "contact_sheet_sha256": sha_file(sheet),
1383- "receipt": str(receipt),
1384- "created_at": time.time(),
1385- }
1386- pending_path.write_text(
1387- json.dumps(pending, ensure_ascii=False, indent=2) + "\n",
1388- encoding="utf-8"
1389- )
1390- else:
--
1408- )
1409-
1410- return {
1411- "pass": passed,
1412- "version": VERSION,
1413- "fingerprint": fingerprint,
1414- "proof_status": "vision_required" if passed else "invalid",
1415- "vision_required": bool(passed),
1416: "proof_contact_sheet": str(sheet) if sheet.exists() else None,
1417- "proof_qa_brief": str(brief_path),
1418- "proof_pending": str(pending_path) if passed else None,
1419- "vision_question": vision_question if passed else None,
1420- "valid_candidates": len(valid),
1421- "valid_casting_roles": len(casting_valid),
1422- "hard_failures": hard,
1423- "warnings": warnings,
1424- "next": (
1425: "Call vision_analyze on proof_contact_sheet using vision_question. "
1426- "A PASS receipt is issued automatically by the shorts-production-guard post_tool_call hook. "
1427- "Never create a verdict or proof receipt manually."
1428- if passed else "Repair proof candidates before any TTS/render work."
1429- )
1430- }
1431-
1432-
1433-def proof_accept(*args, **kwargs):
/home/hermes/.hermes/skills/media/shorts-core/scripts/shorts_fast_pipeline.py.pre-tts-timing-lock-20260909-160938
721- FFMPEG, "-y", "-v", "error",
722- "-i", str(final),
723- "-vf",
724- f"select='{select}',"
725- "scale=360:640:flags=lanczos,"
726- f"tile={cols}x{rows}:margin=0:padding=0",
727- "-fps_mode", "vfr",
728- "-frames:v", "1",
729: str(work / "final_contact_sheet.jpg")
730- ])
731: (work / "semantic_contact_sheet.json").write_text(
732- json.dumps({
733- "times": times,
734- "frames": frame_nums,
735- "shot_count": len(shots),
736- "samples": samples,
737- "grid": [cols, rows]
738- }, ensure_ascii=False, indent=2),
739- encoding="utf-8"
--
822- for chunk in iter(lambda: f.read(1024 * 1024), b""):
823- h.update(chunk)
824- return h.hexdigest()
825-
826-
827-def prepare_repair_state(manifest, work, final):
828- """Bind repair claims to the exact artifact and post-repair semantic QA."""
829- work, final = Path(work), Path(final)
830: sheet = work / "final_contact_sheet.jpg"
831- declared = manifest.get("repair_state")
832- declared = declared if isinstance(declared, dict) else {"state": "not_attempted"}
833- state = str(declared.get("state") or "not_attempted")
834- artifact_sha = sha256_file(final)
835- sheet_sha = sha256_file(sheet)
836- state_path = work / "repair_state.json"
837- existing = {}
838- if state_path.exists():
--
841- except Exception:
842- existing = {}
843-
844- # A runtime-issued verified state remains valid only for byte-identical
845- # artifact and semantic sheet. Any visual change returns to pending.
846- if (
847- existing.get("state") == "verified"
848- and existing.get("artifact_sha256") == artifact_sha
849: and existing.get("contact_sheet_sha256") == sheet_sha
850- ):
851- obj = existing
852- else:
853- if state == "verified":
854- verification = declared.get("verification") or {}
855- if (
856- verification.get("verifier") != "vision_analyze"
857- or verification.get("verdict") != "PASS"
858- or verification.get("artifact_sha256") != artifact_sha
859- ):
860- raise SystemExit("REPAIR_VERIFICATION_INVALID_OR_STALE")
861- token = (
862- existing.get("repair_token")
863- if existing.get("artifact_sha256") == artifact_sha
864: and existing.get("contact_sheet_sha256") == sheet_sha
865- else secrets.token_hex(24)
866- )
867- obj = {
868- "state": state,
869- "repair_attempted": state != "not_attempted",
870- "verification_pending": state in {"repair_attempted", "verification_pending"},
871- "claim_fixed_allowed": state == "verified",
872- "artifact": str(final.resolve()),
873- "artifact_sha256": artifact_sha,
874: "contact_sheet": str(sheet.resolve()),
875: "contact_sheet_sha256": sheet_sha,
876- "repair_token": token,
877-