blun-king-cli 9.1.597 → 9.1.600

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.
Files changed (106) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +17 -1
  3. package/agent-spine-plugin/CHANGELOG.md +1 -1
  4. package/agent-spine-plugin/docs/host-integration.md +1 -15
  5. package/agent-spine-plugin/docs/preflight-recall.md +1 -1
  6. package/agent-spine-plugin/scripts/check-install.js +1 -6
  7. package/agent-spine-plugin/scripts/hermetic-process.js +8 -0
  8. package/agent-spine-plugin/scripts/release-check.js +2 -3
  9. package/agent-spine-plugin/scripts/run-tests-hermetic.js +8 -11
  10. package/agent-spine-plugin/src/hook.js +40 -40
  11. package/agent-spine-plugin/src/lib/briefing.js +6 -3
  12. package/agent-spine-plugin/src/lib/hook-context.js +63 -64
  13. package/agent-spine-plugin/src/lib/hook-output.js +115 -94
  14. package/agent-spine-plugin/src/lib/hook-timeline.js +20 -11
  15. package/agent-spine-plugin/src/lib/host-instruction-budget.js +8 -14
  16. package/agent-spine-plugin/src/lib/mcp-timeline-tools.js +0 -7
  17. package/agent-spine-plugin/src/lib/pre-answer-timeline-recall.js +104 -0
  18. package/agent-spine-plugin/src/lib/session-timeline-codex.js +0 -4
  19. package/agent-spine-plugin/src/lib/session-timeline-enrollment-source.js +0 -3
  20. package/agent-spine-plugin/src/lib/session-timeline-enrollment-storage.js +0 -4
  21. package/agent-spine-plugin/src/lib/session-timeline-enrollment-transport.js +0 -2
  22. package/agent-spine-plugin/src/lib/session-timeline-enrollment.js +0 -22
  23. package/agent-spine-plugin/src/lib/session-timeline-host-origin.js +0 -4
  24. package/agent-spine-plugin/src/lib/session-timeline-prior.js +42 -50
  25. package/agent-spine-plugin/src/lib/session-timeline-provider.js +0 -3
  26. package/agent-spine-plugin/src/lib/session-timeline-query.js +0 -1
  27. package/agent-spine-plugin/src/lib/session-timeline-sid-acl.js +0 -4
  28. package/agent-spine-plugin/src/lib/session-timeline-source.js +0 -3
  29. package/agent-spine-plugin/src/lib/session-timeline-transport.js +0 -8
  30. package/agent-spine-plugin/src/lib/session-timeline-windows-acl.js +0 -3
  31. package/agent-spine-plugin/src/lib/session-timeline.js +370 -408
  32. package/agent-spine-plugin/src/lib/source-roots.js +26 -16
  33. package/agent-spine-plugin/src/lib/timeline-user-feedback.js +0 -1
  34. package/bin/core-bootstrap.js +18 -10
  35. package/bin/launcher-mode.js +5 -0
  36. package/bin/launcher-runtime.js +27 -0
  37. package/bin/verify-bundled-agent-sources.cjs +28 -2
  38. package/blun.mjs +798 -143
  39. package/bundled-agent-sources.json +192 -155
  40. package/package.json +1 -1
  41. package/standard-skills/translate-native/README.md +1334 -1
  42. package/standard-skills/translate-native/SKILL.md +1 -1
  43. package/standard-skills/translate-native/VERSION +1 -1
  44. package/standard-skills/translate-native/docs/PREMORTEM.md +901 -0
  45. package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION.md +208 -41
  46. package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_API.md +1319 -77
  47. package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_EVIDENCE_HTTP.md +66 -11
  48. package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_HTTP_PROVIDER.md +19 -1
  49. package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_RECEIPT_VERIFIER_HTTP.md +24 -6
  50. package/standard-skills/translate-native/integrations/commercial_localization_profile.py +23 -0
  51. package/standard-skills/translate-native/integrations/website_localization.py +234 -10
  52. package/standard-skills/translate-native/integrations/website_localization_benchmark.py +39 -3
  53. package/standard-skills/translate-native/integrations/website_localization_cms.py +512 -10
  54. package/standard-skills/translate-native/integrations/website_localization_cms_client.py +116 -0
  55. package/standard-skills/translate-native/integrations/website_localization_cms_receiver.py +101 -11
  56. package/standard-skills/translate-native/integrations/website_localization_cms_receiver_runtime.py +12 -1
  57. package/standard-skills/translate-native/integrations/website_localization_cms_receiver_store.py +186 -24
  58. package/standard-skills/translate-native/integrations/website_localization_cms_source_client.py +64 -1
  59. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery.py +528 -5
  60. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_auth.py +918 -0
  61. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_auth_runtime.py +609 -0
  62. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_client.py +885 -0
  63. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_http.py +1244 -0
  64. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_runtime.py +220 -0
  65. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_sidecar_adapter.py +331 -0
  66. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_capabilities_http.py +444 -0
  67. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_client.py +673 -0
  68. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_dispatch.py +1317 -0
  69. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_dispatch_client.py +826 -0
  70. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_dispatch_http.py +1152 -0
  71. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_dispatch_openapi.py +896 -0
  72. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_dispatch_runtime.py +621 -0
  73. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_http.py +1180 -0
  74. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_runtime.py +1479 -0
  75. package/standard-skills/translate-native/integrations/website_localization_cms_source_http.py +133 -17
  76. package/standard-skills/translate-native/integrations/website_localization_cms_source_runtime.py +319 -4
  77. package/standard-skills/translate-native/integrations/website_localization_cms_source_service.py +72 -2
  78. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_http.py +13 -0
  79. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_receiver.py +56 -13
  80. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_receiver_openapi.py +335 -0
  81. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_receiver_runtime.py +66 -1
  82. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_processing_monitor.py +73 -7
  83. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_receiver_client.py +93 -9
  84. package/standard-skills/translate-native/integrations/website_localization_evidence_http.py +221 -11
  85. package/standard-skills/translate-native/integrations/website_localization_health.py +6 -0
  86. package/standard-skills/translate-native/integrations/website_localization_http_provider.py +1 -1
  87. package/standard-skills/translate-native/integrations/website_localization_quality_profiles.py +350 -0
  88. package/standard-skills/translate-native/integrations/website_localization_queue.py +126 -56
  89. package/standard-skills/translate-native/integrations/website_localization_receipt_verifier_http.py +166 -13
  90. package/standard-skills/translate-native/integrations/website_localization_release.py +423 -17
  91. package/standard-skills/translate-native/integrations/website_localization_release_coordinator.py +168 -13
  92. package/standard-skills/translate-native/integrations/website_localization_runner.py +10 -0
  93. package/standard-skills/translate-native/integrations/website_localization_worker.py +213 -9
  94. package/standard-skills/translate-native/provenance.json +2 -2
  95. package/standard-skills/translate-native/references/commercial-localization.md +96 -17
  96. package/standard-skills/translate-native/scripts/blun_language_guard.py +3 -1
  97. package/standard-skills/translate-native/scripts/check_commercial_review.py +69 -9
  98. package/standard-skills/translate-native/scripts/commercial_localization_profile.py +829 -31
  99. package/standard-tools/language-guard/VERSION +1 -1
  100. package/standard-tools/language-guard/blun_language_guard.py +3 -1
  101. package/standard-tools/language-guard/check_commercial_review.py +69 -9
  102. package/standard-tools/language-guard/commercial_localization_profile.py +829 -31
  103. package/standard-tools/language-guard/provenance.json +2 -2
  104. package/standard-tools/manifest.json +1 -1
  105. package/worker-host.mjs +215 -82
  106. package/agent-spine-plugin/scripts/check-install-king.js +0 -37
@@ -31,9 +31,9 @@ PUBLICATION_SCHEMA = "blun.cms-localization-publication.v3"
31
31
  ACK_SCHEMA = "blun.cms-localization-publication-ack.v1"
32
32
  TOMBSTONE_DELIVERY_SCHEMA = "blun.cms-localization-tombstone.v1"
33
33
  TOMBSTONE_ACK_SCHEMA = "blun.cms-localization-tombstone-ack.v1"
34
- CAPABILITIES_SCHEMA = "blun.website-localization-capabilities.v3"
34
+ CAPABILITIES_SCHEMA = "blun.website-localization-capabilities.v9"
35
35
  PUBLICATION_HTTP_CONTRACT_SCHEMA = (
36
- "blun.cms-localization-publication-http-capabilities.v2"
36
+ "blun.cms-localization-publication-http-capabilities.v5"
37
37
  )
38
38
  PUBLICATION_HTTP_REQUEST_SCHEMA = "blun.cms-localization-publication-http.v1"
39
39
  PUBLICATION_HTTP_RESPONSE_SCHEMA = "blun.cms-localization-publication-http-ack.v1"
@@ -382,9 +382,15 @@ def _valid_release_evidence(
382
382
  locale: Any,
383
383
  target_sha256: Any,
384
384
  approval_id: Any,
385
+ require_current_locale_quality: bool = True,
385
386
  ) -> bool:
386
387
  try:
387
- evidence = _RELEASE.validate_publication_evidence(value)
388
+ evidence = _RELEASE.validate_publication_evidence(
389
+ value,
390
+ require_current_locale_quality=(
391
+ require_current_locale_quality
392
+ ),
393
+ )
388
394
  except _RELEASE.LocalizationReleaseBlocked:
389
395
  return False
390
396
  return (
@@ -507,32 +513,229 @@ class WebsiteLocalizationCMSBridge:
507
513
  raise CMSBridgeBlocked("cms.capabilities.registry_invalid")
508
514
 
509
515
  commercial = _COMMERCIAL.public_profile(_PLANNER.COMMERCIAL_PROFILE)
516
+ rendering_registry = _PLANNER.commercial_rendering_registry()
517
+ review_evidence_contract = (
518
+ _COMMERCIAL.public_review_evidence_contract(
519
+ _PLANNER.COMMERCIAL_PROFILE,
520
+ )
521
+ )
510
522
  review_summary_contract = _COMMERCIAL.public_review_summary_contract(
511
523
  _PLANNER.COMMERCIAL_PROFILE,
512
524
  )
525
+ review_routing_contract = (
526
+ _COMMERCIAL.public_review_routing_contract(
527
+ _PLANNER.COMMERCIAL_PROFILE,
528
+ )
529
+ )
530
+ review_resolution_contract = (
531
+ _COMMERCIAL.public_review_resolution_contract(
532
+ _PLANNER.COMMERCIAL_PROFILE,
533
+ )
534
+ )
513
535
  if (
514
536
  not isinstance(commercial, dict)
515
537
  or set(commercial) != {
516
538
  "schema", "profile", "applies_to", "dimensions",
517
539
  "preservation", "rendering", "verification",
518
- "protected_terms", "review_summary_schema",
519
- "review_summary_contract", "sha256",
540
+ "locale_quality_profile", "protected_terms",
541
+ "review_evidence_schema", "review_evidence_contract",
542
+ "review_summary_schema",
543
+ "review_summary_contract", "review_routing_schema",
544
+ "review_routing_contract", "review_resolution_schema",
545
+ "review_resolution_contract", "sha256",
520
546
  }
521
547
  or commercial["schema"] != _COMMERCIAL.PUBLIC_PROFILE_SCHEMA
522
548
  or commercial["profile"] != _PLANNER.COMMERCIAL_PROFILE
549
+ or commercial["review_evidence_schema"]
550
+ != _PLANNER.COMMERCIAL_PROFILE
551
+ or commercial["review_evidence_contract"]
552
+ != review_evidence_contract
523
553
  or commercial["review_summary_schema"]
524
554
  != _COMMERCIAL.REVIEW_SUMMARY_SCHEMA
525
555
  or commercial["review_summary_contract"] != review_summary_contract
556
+ or commercial["review_routing_schema"]
557
+ != _COMMERCIAL.REVIEW_ROUTING_SCHEMA
558
+ or commercial["review_routing_contract"]
559
+ != review_routing_contract
560
+ or commercial["review_resolution_schema"]
561
+ != _COMMERCIAL.REVIEW_RESOLUTION_SCHEMA
562
+ or commercial["review_resolution_contract"]
563
+ != review_resolution_contract
526
564
  or commercial["applies_to"] != {
527
565
  "content_type": "commercial",
528
566
  "locales": "all-supported-target-locales",
529
567
  }
530
568
  or commercial["protected_terms"] != "project-configuration-only"
569
+ or commercial["locale_quality_profile"] != {
570
+ "schema": _COMMERCIAL.COMMERCIAL_LOCALE_PROFILE_SCHEMA,
571
+ "required": True,
572
+ "binding_fields": [
573
+ "locale", "version", "commercial_profile",
574
+ "quality_profile_version", "quality_profile_sha256",
575
+ "rendering_reference",
576
+ "sha256",
577
+ ],
578
+ "rendering_reference": {
579
+ "schema": (
580
+ _COMMERCIAL.COMMERCIAL_RENDERING_REFERENCE_SCHEMA
581
+ ),
582
+ "authority": "Unicode CLDR",
583
+ "version": "48",
584
+ "purpose": "target-locale-rendering-guidance",
585
+ "semantic_proof": False,
586
+ "unresolved_route": (
587
+ "independent-model-or-qualified-native-domain-review"
588
+ ),
589
+ },
590
+ "required_commercial_checks": list(
591
+ _EXPECTED_COMMERCIAL_DIMENSIONS
592
+ ),
593
+ "provider_phases": [
594
+ "transcreation", "target_native", "source_fidelity",
595
+ ],
596
+ "tamper_policy": "block-before-provider",
597
+ }
531
598
  or [item.get("name") for item in commercial["dimensions"]]
532
599
  != list(_EXPECTED_COMMERCIAL_DIMENSIONS)
533
600
  or tuple(_COMMERCIAL.DIMENSIONS) != _EXPECTED_COMMERCIAL_DIMENSIONS
534
601
  ):
535
602
  raise CMSBridgeBlocked("cms.capabilities.registry_invalid")
603
+ unsigned_review_evidence_contract = dict(
604
+ review_evidence_contract
605
+ )
606
+ review_evidence_digest = unsigned_review_evidence_contract.pop(
607
+ "sha256", None,
608
+ )
609
+ if (
610
+ set(review_evidence_contract) != {
611
+ "schema", "result_schema", "profile", "required_fields",
612
+ "coverage", "offer_registry", "checks", "trust_boundary",
613
+ "content_policy", "sha256",
614
+ }
615
+ or review_evidence_contract["schema"]
616
+ != _COMMERCIAL.REVIEW_EVIDENCE_CAPABILITIES_SCHEMA
617
+ or review_evidence_contract["result_schema"]
618
+ != _PLANNER.COMMERCIAL_PROFILE
619
+ or review_evidence_contract["profile"]
620
+ != _PLANNER.COMMERCIAL_PROFILE
621
+ or review_evidence_contract["required_fields"] != [
622
+ "schema", "coverage", "offers", "checks",
623
+ ]
624
+ or review_evidence_contract["coverage"] != {
625
+ "allowed": ["complete", "uncertain"],
626
+ "complete": (
627
+ "every-proposition-and-offer-association-reviewed"
628
+ ),
629
+ "uncertain": "independent-review-required",
630
+ }
631
+ or review_evidence_contract["offer_registry"] != {
632
+ "field": "offers",
633
+ "max_items": 1000,
634
+ "item_required_fields": [
635
+ "id", "source_spans", "target_spans",
636
+ ],
637
+ "identifier": {
638
+ "pattern": r"^[A-Za-z0-9_.:-]{1,256}$",
639
+ "unique": True,
640
+ },
641
+ "regions": {
642
+ "fields": ["source_spans", "target_spans"],
643
+ "span_format": (
644
+ "zero-based-unicode-code-points-exclusive-end"
645
+ ),
646
+ "non_empty_text": True,
647
+ "ordered": True,
648
+ "overlap": "forbidden-within-and-across-offers",
649
+ "discontiguous": True,
650
+ "at_least_one_side_non_empty": True,
651
+ },
652
+ }
653
+ or review_evidence_contract["checks"] != {
654
+ "required_dimensions": list(
655
+ _EXPECTED_COMMERCIAL_DIMENSIONS
656
+ ),
657
+ "exact_dimension_set": True,
658
+ "max_items_per_dimension": 1000,
659
+ "statuses": [
660
+ "equivalent", "not_present", "changed", "uncertain",
661
+ ],
662
+ "status_items": {
663
+ "equivalent": "one-or-more-matched",
664
+ "not_present": "empty",
665
+ "changed": "one-or-more-specific",
666
+ "uncertain": "one-or-more-specific",
667
+ },
668
+ "offer_statuses": {
669
+ "field": "offer_statuses",
670
+ "item_required_fields": ["offer", "status"],
671
+ "coverage": "exactly-one-per-registered-offer",
672
+ "order": "offer-registry-order",
673
+ "statuses": [
674
+ "equivalent", "not_present", "changed",
675
+ "uncertain",
676
+ ],
677
+ "global_status": (
678
+ "changed-then-uncertain-then-equivalent-then-"
679
+ "not_present"
680
+ ),
681
+ "items_must_match_offer_status": True,
682
+ },
683
+ "item": {
684
+ "required_fields": [
685
+ "offer", "relation", "source_span", "target_span",
686
+ "explanation",
687
+ ],
688
+ "offer": "registered-offer-id",
689
+ "relations": [
690
+ "matched", "source_only", "target_only",
691
+ ],
692
+ "matched_requires": "source-and-target-spans",
693
+ "source_only_requires": (
694
+ "source-span-and-null-target-span"
695
+ ),
696
+ "target_only_requires": (
697
+ "null-source-span-and-target-span"
698
+ ),
699
+ "span_containment": "inside-named-offer-region",
700
+ "duplicates": "forbidden-per-dimension",
701
+ "explanation": (
702
+ "non-empty-maximum-2000-code-points"
703
+ ),
704
+ },
705
+ "offer_assignment": {
706
+ "equivalent": (
707
+ "exactly-one-matched-item-per-registered-offer"
708
+ ),
709
+ "other_equivalent_checks_require_equivalent_assignment": (
710
+ True
711
+ ),
712
+ },
713
+ }
714
+ or review_evidence_contract["trust_boundary"] != {
715
+ "validates": "structure-offsets-and-verdict-consistency",
716
+ "semantic_truth": False,
717
+ "numeric_regex_semantic_proof": False,
718
+ "unresolved_route": (
719
+ "independent-model-or-qualified-native-domain-review"
720
+ ),
721
+ "publication_authority": False,
722
+ }
723
+ or review_evidence_contract["content_policy"] != {
724
+ "source_text": False,
725
+ "target_text": False,
726
+ "source_spans": False,
727
+ "target_spans": False,
728
+ "reviewer_prose": False,
729
+ "project_prices": False,
730
+ "project_brands": False,
731
+ }
732
+ or not isinstance(review_evidence_digest, str)
733
+ or SHA256.fullmatch(review_evidence_digest) is None
734
+ or review_evidence_digest != _hash(
735
+ _canonical_json(unsigned_review_evidence_contract)
736
+ )
737
+ ):
738
+ raise CMSBridgeBlocked("cms.capabilities.registry_invalid")
536
739
  unsigned_review_summary_contract = dict(review_summary_contract)
537
740
  review_summary_digest = unsigned_review_summary_contract.pop(
538
741
  "sha256", None,
@@ -540,8 +743,10 @@ class WebsiteLocalizationCMSBridge:
540
743
  if (
541
744
  set(review_summary_contract) != {
542
745
  "schema", "result_schema", "profile", "required_fields",
543
- "statuses", "review_required_dimensions", "evidence_sha256",
544
- "content_policy", "sha256",
746
+ "statuses", "review_required_dimensions",
747
+ "offer_count", "review_required_offers", "evidence_sha256",
748
+ "review_evidence_contract_sha256", "content_policy",
749
+ "sha256",
545
750
  }
546
751
  or review_summary_contract["schema"]
547
752
  != _COMMERCIAL.REVIEW_SUMMARY_CAPABILITIES_SCHEMA
@@ -551,12 +756,17 @@ class WebsiteLocalizationCMSBridge:
551
756
  != _PLANNER.COMMERCIAL_PROFILE
552
757
  or review_summary_contract["required_fields"] != [
553
758
  "schema", "profile", "status", "review_required_dimensions",
554
- "evidence_sha256",
759
+ "offer_count", "review_required_offers",
760
+ "review_evidence_contract_sha256", "evidence_sha256",
555
761
  ]
556
762
  or review_summary_contract["statuses"] != {
557
- "verified": {"review_required_dimensions": "empty"},
763
+ "verified": {
764
+ "review_required_dimensions": "empty",
765
+ "review_required_offers": "empty",
766
+ },
558
767
  "review_required": {
559
768
  "review_required_dimensions": "one-or-more",
769
+ "review_required_offers": "zero-or-more",
560
770
  "requires_independent_review": True,
561
771
  },
562
772
  }
@@ -565,12 +775,63 @@ class WebsiteLocalizationCMSBridge:
565
775
  "order": list(_EXPECTED_COMMERCIAL_DIMENSIONS),
566
776
  "unique": True,
567
777
  }
778
+ or review_summary_contract["review_required_offers"] != {
779
+ "item_required_fields": [
780
+ "dimension", "offer_indexes",
781
+ ],
782
+ "dimension_order": list(
783
+ _EXPECTED_COMMERCIAL_DIMENSIONS
784
+ ),
785
+ "dimension_must_be_review_required": True,
786
+ "offer_indexes": {
787
+ "meaning": (
788
+ "zero-based-opaque-offer-registry-position"
789
+ ),
790
+ "minimum": 0,
791
+ "maximum_exclusive": 1000,
792
+ "order": "ascending",
793
+ "unique": True,
794
+ },
795
+ "configured_offer_identifiers_published": False,
796
+ }
797
+ or review_summary_contract["offer_count"] != {
798
+ "meaning": "opaque-offer-registry-size",
799
+ "minimum": 0,
800
+ "maximum": 1000,
801
+ }
568
802
  or review_summary_contract["evidence_sha256"] != {
569
803
  "algorithm": "sha-256",
570
804
  "canonicalization": (
571
805
  "utf-8-json-sort-keys-no-insignificant-whitespace"
572
806
  ),
573
- "covers": "complete-commercial-review-evidence",
807
+ "binding_schema": _COMMERCIAL.EVIDENCE_BINDING_SCHEMA,
808
+ "binding_fields": [
809
+ "schema", "profile",
810
+ "review_evidence_contract_sha256", "target_locale",
811
+ "commercial_quality_profile_version",
812
+ "commercial_quality_profile_sha256", "source_sha256",
813
+ "target_sha256", "evidence",
814
+ ],
815
+ "text_hashing": "exact-utf-8",
816
+ "covers": [
817
+ "commercial-profile",
818
+ "exact-review-evidence-contract",
819
+ "exact-target-locale",
820
+ "commercial-quality-profile-generation",
821
+ "exact-source-sha256",
822
+ "exact-target-sha256",
823
+ "offer-registry-and-proposition-assignment",
824
+ "complete-commercial-review-evidence",
825
+ ],
826
+ }
827
+ or review_summary_contract[
828
+ "review_evidence_contract_sha256"
829
+ ] != {
830
+ "algorithm": "sha-256",
831
+ "equals": review_evidence_contract["sha256"],
832
+ "purpose": (
833
+ "reject-stale-or-reinterpreted-private-evidence"
834
+ ),
574
835
  }
575
836
  or review_summary_contract["content_policy"] != {
576
837
  "source_text": False,
@@ -587,6 +848,183 @@ class WebsiteLocalizationCMSBridge:
587
848
  != _hash(_canonical_json(unsigned_review_summary_contract))
588
849
  ):
589
850
  raise CMSBridgeBlocked("cms.capabilities.registry_invalid")
851
+ unsigned_review_routing_contract = dict(
852
+ review_routing_contract
853
+ )
854
+ review_routing_digest = unsigned_review_routing_contract.pop(
855
+ "sha256", None,
856
+ )
857
+ if (
858
+ set(review_routing_contract) != {
859
+ "schema", "result_schema", "profile", "applies_when",
860
+ "required_fields", "text_lengths", "offers",
861
+ "trust_boundary", "content_policy", "sha256",
862
+ }
863
+ or review_routing_contract["schema"]
864
+ != _COMMERCIAL.REVIEW_ROUTING_CAPABILITIES_SCHEMA
865
+ or review_routing_contract["result_schema"]
866
+ != _COMMERCIAL.REVIEW_ROUTING_SCHEMA
867
+ or review_routing_contract["profile"]
868
+ != _PLANNER.COMMERCIAL_PROFILE
869
+ or review_routing_contract["applies_when"] != {
870
+ "review_summary_status": "review_required",
871
+ "offer_count": "exact-review-summary-offer-count",
872
+ }
873
+ or review_routing_contract["required_fields"] != [
874
+ "schema", "profile", "contract_sha256", "offer_count",
875
+ "source_length", "target_length", "offers",
876
+ ]
877
+ or review_routing_contract["text_lengths"] != {
878
+ "fields": ["source_length", "target_length"],
879
+ "unit": "unicode-code-points",
880
+ "must_equal_complete_texts": True,
881
+ }
882
+ or review_routing_contract["offers"] != {
883
+ "coverage": "exactly-one-per-registered-offer",
884
+ "order": "offer-registry-order",
885
+ "item_required_fields": [
886
+ "offer_index", "source_spans", "target_spans",
887
+ ],
888
+ "offer_index": {
889
+ "meaning": (
890
+ "zero-based-opaque-offer-registry-position"
891
+ ),
892
+ "minimum": 0,
893
+ "maximum_exclusive": 1000,
894
+ "order": "ascending",
895
+ "unique": True,
896
+ },
897
+ "regions": {
898
+ "fields": ["source_spans", "target_spans"],
899
+ "span_format": (
900
+ "zero-based-unicode-code-points-exclusive-end"
901
+ ),
902
+ "non_empty_text": True,
903
+ "ordered": True,
904
+ "overlap": "forbidden-within-and-across-offers",
905
+ "discontiguous": True,
906
+ "at_least_one_side_non_empty": True,
907
+ },
908
+ }
909
+ or review_routing_contract["trust_boundary"] != {
910
+ "validates": (
911
+ "shape-offsets-order-count-and-text-lengths"
912
+ ),
913
+ "semantic_truth": False,
914
+ "route_values": (
915
+ "private-evidence-and-receipt-boundary-only"
916
+ ),
917
+ "public_release_evidence": False,
918
+ "publication_authority": False,
919
+ }
920
+ or review_routing_contract["content_policy"] != {
921
+ "configured_offer_identifiers": False,
922
+ "source_text": False,
923
+ "target_text": False,
924
+ "reviewer_prose": False,
925
+ "project_prices": False,
926
+ "project_brands": False,
927
+ }
928
+ or not isinstance(review_routing_digest, str)
929
+ or SHA256.fullmatch(review_routing_digest) is None
930
+ or review_routing_digest != _hash(
931
+ _canonical_json(unsigned_review_routing_contract)
932
+ )
933
+ ):
934
+ raise CMSBridgeBlocked("cms.capabilities.registry_invalid")
935
+ unsigned_review_resolution_contract = dict(
936
+ review_resolution_contract
937
+ )
938
+ review_resolution_digest = (
939
+ unsigned_review_resolution_contract.pop("sha256", None)
940
+ )
941
+ if (
942
+ set(review_resolution_contract) != {
943
+ "schema", "result_schema", "profile", "applies_when",
944
+ "required_fields", "status", "methods",
945
+ "provider_identity", "reviewed_dimensions",
946
+ "reviewed_offer_count", "reviewed_offers",
947
+ "receipt_sha256",
948
+ "content_policy", "sha256",
949
+ }
950
+ or review_resolution_contract["schema"]
951
+ != _COMMERCIAL.REVIEW_RESOLUTION_CAPABILITIES_SCHEMA
952
+ or review_resolution_contract["result_schema"]
953
+ != _COMMERCIAL.REVIEW_RESOLUTION_SCHEMA
954
+ or review_resolution_contract["profile"]
955
+ != _PLANNER.COMMERCIAL_PROFILE
956
+ or review_resolution_contract["applies_when"] != {
957
+ "review_summary_status": "review_required",
958
+ "reviewed_dimensions": (
959
+ "exact-ordered-review-summary-dimensions"
960
+ ),
961
+ "reviewed_offer_count": (
962
+ "exact-review-summary-offer-count"
963
+ ),
964
+ "reviewed_offers": (
965
+ "exact-ordered-review-summary-offer-scope"
966
+ ),
967
+ }
968
+ or review_resolution_contract["required_fields"] != [
969
+ "schema", "profile", "contract_sha256", "status",
970
+ "reviewed_dimensions", "reviewed_offer_count",
971
+ "reviewed_offers", "method",
972
+ "receipt_sha256",
973
+ "primary_provider", "provider",
974
+ ]
975
+ or review_resolution_contract["status"] != "resolved"
976
+ or review_resolution_contract["methods"] != {
977
+ "qualified_human": {
978
+ "primary_provider": "required",
979
+ "provider": "null",
980
+ "receipt": "verified-qualified-human-review",
981
+ },
982
+ "independent_model": {
983
+ "primary_provider": "required",
984
+ "provider": "required",
985
+ "provider_id_must_differ_from_primary_provider": True,
986
+ "receipt": "verified-independent-model-review",
987
+ },
988
+ }
989
+ or review_resolution_contract["provider_identity"] != {
990
+ "fields": ["id", "model_id", "model_version"],
991
+ "primary_provider": "required",
992
+ "credentials_published": False,
993
+ }
994
+ or review_resolution_contract["reviewed_dimensions"] != {
995
+ "allowed": list(_EXPECTED_COMMERCIAL_DIMENSIONS),
996
+ "order": list(_EXPECTED_COMMERCIAL_DIMENSIONS),
997
+ "unique": True,
998
+ "must_equal_review_summary": True,
999
+ }
1000
+ or review_resolution_contract["reviewed_offers"] != {
1001
+ "must_equal_review_summary": True,
1002
+ "configured_offer_identifiers_published": False,
1003
+ }
1004
+ or review_resolution_contract["reviewed_offer_count"] != {
1005
+ "must_equal_review_summary": True,
1006
+ }
1007
+ or review_resolution_contract["receipt_sha256"] != {
1008
+ "algorithm": "sha-256",
1009
+ "covers": "exact-verified-review-receipt",
1010
+ "raw_receipt_published": False,
1011
+ }
1012
+ or review_resolution_contract["content_policy"] != {
1013
+ "source_text": False,
1014
+ "target_text": False,
1015
+ "raw_receipt": False,
1016
+ "reviewer_prose": False,
1017
+ "qualified_human_identity": False,
1018
+ "project_prices": False,
1019
+ "project_brands": False,
1020
+ }
1021
+ or not isinstance(review_resolution_digest, str)
1022
+ or SHA256.fullmatch(review_resolution_digest) is None
1023
+ or review_resolution_digest != _hash(
1024
+ _canonical_json(unsigned_review_resolution_contract)
1025
+ )
1026
+ ):
1027
+ raise CMSBridgeBlocked("cms.capabilities.registry_invalid")
590
1028
  unsigned_commercial = dict(commercial)
591
1029
  commercial_digest = unsigned_commercial.pop("sha256", None)
592
1030
  if (
@@ -597,6 +1035,7 @@ class WebsiteLocalizationCMSBridge:
597
1035
  raise CMSBridgeBlocked("cms.capabilities.registry_invalid")
598
1036
 
599
1037
  locales = []
1038
+ expected_rendering_locales = []
600
1039
  seen_locales: set[str] = set()
601
1040
  seen_languages: set[str] = set()
602
1041
  seen_eu_codes: set[str] = set()
@@ -638,11 +1077,28 @@ class WebsiteLocalizationCMSBridge:
638
1077
  ):
639
1078
  raise CMSBridgeBlocked("cms.capabilities.registry_invalid")
640
1079
  quality = _PLANNER.quality_profile_for(locale)
1080
+ commercial_quality = _PLANNER.commercial_quality_profile_for(
1081
+ locale,
1082
+ )
641
1083
  if (
642
1084
  not isinstance(quality, dict)
643
1085
  or quality.get("locale") != locale
644
1086
  or quality.get("version") != version
645
1087
  or quality.get("sha256") != digest
1088
+ or not isinstance(commercial_quality, dict)
1089
+ or commercial_quality.get("locale") != locale
1090
+ or commercial_quality.get("commercial_profile")
1091
+ != _PLANNER.COMMERCIAL_PROFILE
1092
+ or commercial_quality.get("quality_profile_version")
1093
+ != version
1094
+ or commercial_quality.get("quality_profile_sha256")
1095
+ != digest
1096
+ or commercial_quality.get("schema")
1097
+ != _COMMERCIAL.COMMERCIAL_LOCALE_PROFILE_SCHEMA
1098
+ or not isinstance(commercial_quality.get("version"), str)
1099
+ or TOKEN.fullmatch(commercial_quality["version"]) is None
1100
+ or not isinstance(commercial_quality.get("sha256"), str)
1101
+ or SHA256.fullmatch(commercial_quality["sha256"]) is None
646
1102
  ):
647
1103
  raise CMSBridgeBlocked("cms.capabilities.registry_invalid")
648
1104
  seen_locales.add(locale)
@@ -657,8 +1113,47 @@ class WebsiteLocalizationCMSBridge:
657
1113
  "direction": direction,
658
1114
  "quality_profile_version": version,
659
1115
  "quality_profile_sha256": digest,
1116
+ "commercial_quality_profile_version": (
1117
+ commercial_quality["version"]
1118
+ ),
1119
+ "commercial_quality_profile_sha256": (
1120
+ commercial_quality["sha256"]
1121
+ ),
1122
+ })
1123
+ expected_rendering_locales.append({
1124
+ "locale": locale,
1125
+ "commercial_quality_profile": {
1126
+ "version": commercial_quality["version"],
1127
+ "sha256": commercial_quality["sha256"],
1128
+ },
1129
+ "rendering_reference": commercial_quality[
1130
+ "rendering_reference"
1131
+ ],
660
1132
  })
661
1133
 
1134
+ expected_rendering_registry = {
1135
+ "schema": _PLANNER.COMMERCIAL_RENDERING_REGISTRY_SCHEMA,
1136
+ "commercial_profile": _PLANNER.COMMERCIAL_PROFILE,
1137
+ "source": {
1138
+ "authority": "Unicode CLDR",
1139
+ "version": "48",
1140
+ },
1141
+ "content_policy": {
1142
+ "source_text": False,
1143
+ "target_text": False,
1144
+ "project_prices": False,
1145
+ "project_brands": False,
1146
+ "credentials": False,
1147
+ },
1148
+ "locales": expected_rendering_locales,
1149
+ }
1150
+ expected_rendering_registry = {
1151
+ **expected_rendering_registry,
1152
+ "sha256": _hash(_canonical_json(expected_rendering_registry)),
1153
+ }
1154
+ if rendering_registry != expected_rendering_registry:
1155
+ raise CMSBridgeBlocked("cms.capabilities.registry_invalid")
1156
+
662
1157
  body = {
663
1158
  "schema": CAPABILITIES_SCHEMA,
664
1159
  "change_schema": CHANGE_SCHEMA,
@@ -677,6 +1172,7 @@ class WebsiteLocalizationCMSBridge:
677
1172
  "content_types": sorted(content_types),
678
1173
  "quality_passes": list(quality_passes),
679
1174
  "commercial_profile": commercial,
1175
+ "commercial_rendering_registry": rendering_registry,
680
1176
  "publication_http": self._publication_http_capabilities(),
681
1177
  "locales": locales,
682
1178
  }
@@ -691,6 +1187,11 @@ class WebsiteLocalizationCMSBridge:
691
1187
  def _publication_http_capabilities() -> dict[str, Any]:
692
1188
  """Describe the built-in outbound adapter without deployment secrets."""
693
1189
  try:
1190
+ release_evidence_contract = (
1191
+ _RELEASE.validate_publication_evidence_contract(
1192
+ _RELEASE.publication_evidence_contract()
1193
+ )
1194
+ )
694
1195
  operations = [
695
1196
  {
696
1197
  "name": "publication",
@@ -783,6 +1284,7 @@ class WebsiteLocalizationCMSBridge:
783
1284
  _RELEASE.PUBLICATION_EVIDENCE_SCHEMA,
784
1285
  "cms.capabilities.registry_invalid",
785
1286
  ),
1287
+ "release_evidence_contract": release_evidence_contract,
786
1288
  "binding_headers": headers,
787
1289
  "health_binding_headers": [
788
1290
  {