pgc-compiler 2.0.0__tar.gz

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 (185) hide show
  1. pgc_compiler-2.0.0/LICENSE +67 -0
  2. pgc_compiler-2.0.0/MANIFEST.in +15 -0
  3. pgc_compiler-2.0.0/NOTICE +11 -0
  4. pgc_compiler-2.0.0/PKG-INFO +203 -0
  5. pgc_compiler-2.0.0/README.md +175 -0
  6. pgc_compiler-2.0.0/VERSION +1 -0
  7. pgc_compiler-2.0.0/_build_hook.py +24 -0
  8. pgc_compiler-2.0.0/compiler/VERSION +1 -0
  9. pgc_compiler-2.0.0/compiler/__init__.py +1 -0
  10. pgc_compiler-2.0.0/compiler/atoms/__init__.py +54 -0
  11. pgc_compiler-2.0.0/compiler/atoms/error_codes.py +160 -0
  12. pgc_compiler-2.0.0/compiler/atoms/errors.py +125 -0
  13. pgc_compiler-2.0.0/compiler/atoms/fqdn.py +204 -0
  14. pgc_compiler-2.0.0/compiler/atoms/invariants.py +106 -0
  15. pgc_compiler-2.0.0/compiler/atoms/phase.py +99 -0
  16. pgc_compiler-2.0.0/compiler/atoms/pipeline.py +51 -0
  17. pgc_compiler-2.0.0/compiler/atoms/snapshot_gate.py +51 -0
  18. pgc_compiler-2.0.0/compiler/atoms/sorting.py +125 -0
  19. pgc_compiler-2.0.0/compiler/cli.py +637 -0
  20. pgc_compiler-2.0.0/compiler/diagnostics/__init__.py +6 -0
  21. pgc_compiler-2.0.0/compiler/diagnostics/determination.py +148 -0
  22. pgc_compiler-2.0.0/compiler/diagnostics/machine_block_health.py +199 -0
  23. pgc_compiler-2.0.0/compiler/governance/__init__.py +6 -0
  24. pgc_compiler-2.0.0/compiler/governance_engine/__init__.py +0 -0
  25. pgc_compiler-2.0.0/compiler/governance_engine/artifact_kinds.py +221 -0
  26. pgc_compiler-2.0.0/compiler/governance_engine/assertions/__init__.py +0 -0
  27. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/__init__.py +200 -0
  28. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_ac_declaration_well_formed_v0.py +70 -0
  29. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_actor_authority_separation_v0.py +17 -0
  30. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_artifact_content_hash_declared_v0.py +60 -0
  31. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_assert_not_runtime_referenced_v0.py +49 -0
  32. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_assert_parity_v0.py +169 -0
  33. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_atom_output_purity_v0.py +186 -0
  34. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_authority_constituted_v0.py +56 -0
  35. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_authority_required_for_execution_v0.py +16 -0
  36. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_authority_state_well_formed_v0.py +17 -0
  37. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_binding_integrity_v0.py +64 -0
  38. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_binding_surface_closed_v0.py +92 -0
  39. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_cc_capability_binding_valid_v0.py +85 -0
  40. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_cc_inputs_satisfied_v0.py +89 -0
  41. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_cc_no_implicit_chaining_v0.py +89 -0
  42. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_cc_no_missing_dependencies_v0.py +89 -0
  43. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_cc_no_unused_outputs_v0.py +81 -0
  44. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_cc_storage_op_conformance_v0.py +74 -0
  45. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_compiler_governance_declared_v0.py +65 -0
  46. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_compiler_no_execution_v0.py +86 -0
  47. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_concern_not_authority_v0.py +51 -0
  48. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_conformance_assertion_mode_valid_v0.py +35 -0
  49. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_cryptographic_trust_declared_v0.py +51 -0
  50. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_cs_isolated_execution_v0.py +35 -0
  51. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_cs_surface_closed_v0.py +241 -0
  52. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_cs_traceable_v0.py +35 -0
  53. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_ct_output_contract_match_v0.py +167 -0
  54. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_ct_surface_closed_v0.py +173 -0
  55. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_ct_surface_derived_closed_v0.py +108 -0
  56. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_ct_test_data_outcome_declared_v0.py +112 -0
  57. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_ev_append_only_v0.py +70 -0
  58. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_ev_schema_required_v0.py +59 -0
  59. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_execution_placement_declared_v0.py +51 -0
  60. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_execution_scheduling_declared_v0.py +51 -0
  61. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_fqdn_namespace_authorized_v0.py +38 -0
  62. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_fqdn_only_references_v0.py +89 -0
  63. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_governance_declaration_resolves_v0.py +126 -0
  64. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_handler_registry_closed_v0.py +75 -0
  65. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_identity_authority_separation_v0.py +19 -0
  66. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_identity_fqdn_consistency.py +75 -0
  67. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_implementation_admissible_v0.py +66 -0
  68. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_in_no_execution_logic_v0.py +82 -0
  69. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_in_schema_required_v0.py +74 -0
  70. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_in_workflow_binding_v0.py +101 -0
  71. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_inspection_capability_read_only_v0.py +114 -0
  72. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_no_ambient_authority_v0.py +17 -0
  73. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_no_runtime_authorization_v0.py +18 -0
  74. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_no_runtime_topology_synthesis_v0.py +18 -0
  75. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_no_smart_execution_v0.py +102 -0
  76. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_no_undeclared_behavior_surface_v0.py +52 -0
  77. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_no_workflow_authorization_logic_v0.py +18 -0
  78. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_protocol_surface_closed_v0.py +119 -0
  79. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_rb_binding_policy_conformance_v0.py +124 -0
  80. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_rb_cs_only_v0.py +68 -0
  81. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_rb_no_logic_v0.py +81 -0
  82. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_rb_parameters_declared_v0.py +117 -0
  83. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_rb_storage_subdomain_owned_v0.py +118 -0
  84. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_runtime_invariant_wired_v0.py +163 -0
  85. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_schema_conformance_v0.py +64 -0
  86. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_schema_description_well_formed_v0.py +97 -0
  87. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_security_domain_declared_v0.py +51 -0
  88. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_structure_paths_well_formed_v0.py +118 -0
  89. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_superseded_not_referenced_v0.py +134 -0
  90. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_test_data_match_ct_output_v0.py +134 -0
  91. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_acyclic_v0.py +53 -0
  92. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_authority_orthogonal_v0.py +110 -0
  93. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_capability_reference_unique_v0.py +63 -0
  94. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_contract_closed_v0.py +113 -0
  95. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_immutable_after_compilation_v0.py +17 -0
  96. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_input_reference_declared_v0.py +112 -0
  97. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_routing_complete_v0.py +82 -0
  98. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_step_declared_v0.py +77 -0
  99. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_step_id_unique_v0.py +60 -0
  100. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_surface_canonical_v0.py +180 -0
  101. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_topology_transport_orthogonal_v0.py +113 -0
  102. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_trace_authority_binding_required_v0.py +18 -0
  103. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_transport_canonical_normalization_v0.py +83 -0
  104. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_transport_no_dynamic_routing_v0.py +93 -0
  105. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_transport_no_workflow_semantics_v0.py +106 -0
  106. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_transport_operation_identity_independence_v0.py +56 -0
  107. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_transport_response_projection_external_v0.py +38 -0
  108. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_transport_result_class_protocol_independence_v0.py +48 -0
  109. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_transport_target_exists_v0.py +132 -0
  110. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_unique_artifact_id_v0.py +58 -0
  111. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_vocabulary_symbols_well_formed_v0.py +163 -0
  112. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_wf_announcement_distinct_v0.py +85 -0
  113. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_wf_cc_only_nodes_v0.py +60 -0
  114. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_wf_entry_intent_v0.py +68 -0
  115. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_wf_execution_path_valid_v0.py +89 -0
  116. pgc_compiler-2.0.0/compiler/governance_engine/assertions/handlers/assert_wf_node_key_binding_unique_v0.py +107 -0
  117. pgc_compiler-2.0.0/compiler/governance_engine/platform_root.py +102 -0
  118. pgc_compiler-2.0.0/compiler/governance_engine/structure/__init__.py +56 -0
  119. pgc_compiler-2.0.0/compiler/governance_engine/structure/discovery/__init__.py +28 -0
  120. pgc_compiler-2.0.0/compiler/governance_engine/structure/discovery/artifact_locator.py +210 -0
  121. pgc_compiler-2.0.0/compiler/governance_engine/structure/exceptions.py +113 -0
  122. pgc_compiler-2.0.0/compiler/governance_engine/structure/loading/__init__.py +88 -0
  123. pgc_compiler-2.0.0/compiler/governance_engine/structure/loading/fs_reader.py +225 -0
  124. pgc_compiler-2.0.0/compiler/governance_engine/structure/loading/markdown_parser.py +148 -0
  125. pgc_compiler-2.0.0/compiler/governance_engine/structure/loading/protocol_loader.py +587 -0
  126. pgc_compiler-2.0.0/compiler/governance_engine/structure/loading/test_case_provider.py +125 -0
  127. pgc_compiler-2.0.0/compiler/governance_engine/structure/loading/trace_reader.py +98 -0
  128. pgc_compiler-2.0.0/compiler/governance_engine/structure/loading/vocabulary_loader.py +174 -0
  129. pgc_compiler-2.0.0/compiler/governance_engine/structure/loading/yaml_parser.py +209 -0
  130. pgc_compiler-2.0.0/compiler/governance_engine/structure/resolution/__init__.py +22 -0
  131. pgc_compiler-2.0.0/compiler/governance_engine/structure/resolution/domain_resolver.py +124 -0
  132. pgc_compiler-2.0.0/compiler/governance_engine/structure/resolution/layer_resolver.py +572 -0
  133. pgc_compiler-2.0.0/compiler/governance_engine/structure/resolution/path_registry.py +1054 -0
  134. pgc_compiler-2.0.0/compiler/graph/__init__.py +38 -0
  135. pgc_compiler-2.0.0/compiler/graph/addressing.py +153 -0
  136. pgc_compiler-2.0.0/compiler/graph/edge.py +100 -0
  137. pgc_compiler-2.0.0/compiler/graph/evidence.py +637 -0
  138. pgc_compiler-2.0.0/compiler/graph/graph.py +269 -0
  139. pgc_compiler-2.0.0/compiler/graph/hashing.py +89 -0
  140. pgc_compiler-2.0.0/compiler/graph/node.py +134 -0
  141. pgc_compiler-2.0.0/compiler/graph/query.py +215 -0
  142. pgc_compiler-2.0.0/compiler/graph/state.py +237 -0
  143. pgc_compiler-2.0.0/compiler/graph/trace.py +97 -0
  144. pgc_compiler-2.0.0/compiler/graph/types.py +71 -0
  145. pgc_compiler-2.0.0/compiler/projections/__init__.py +207 -0
  146. pgc_compiler-2.0.0/compiler/projections/artifact_index.py +225 -0
  147. pgc_compiler-2.0.0/compiler/projections/canonical.py +173 -0
  148. pgc_compiler-2.0.0/compiler/projections/dispatch.py +532 -0
  149. pgc_compiler-2.0.0/compiler/projections/evidence.py +170 -0
  150. pgc_compiler-2.0.0/compiler/projections/handlers.py +224 -0
  151. pgc_compiler-2.0.0/compiler/projections/ipm.py +388 -0
  152. pgc_compiler-2.0.0/compiler/projections/reverse.py +165 -0
  153. pgc_compiler-2.0.0/compiler/projections/tokenized.py +135 -0
  154. pgc_compiler-2.0.0/compiler/projections/vocabulary.py +108 -0
  155. pgc_compiler-2.0.0/compiler/stages/__init__.py +28 -0
  156. pgc_compiler-2.0.0/compiler/stages/s1_extract.py +867 -0
  157. pgc_compiler-2.0.0/compiler/stages/s2_canonicalize.py +516 -0
  158. pgc_compiler-2.0.0/compiler/stages/s3_semantic_addressing.py +66 -0
  159. pgc_compiler-2.0.0/compiler/stages/s4_govern.py +754 -0
  160. pgc_compiler-2.0.0/compiler/stages/s5_construct.py +537 -0
  161. pgc_compiler-2.0.0/compiler/stages/s6_project.py +94 -0
  162. pgc_compiler-2.0.0/compiler/stages/s7_materialize.py +1170 -0
  163. pgc_compiler-2.0.0/compiler/stages/s8_verify.py +643 -0
  164. pgc_compiler-2.0.0/compiler/stages/s9_attest.py +184 -0
  165. pgc_compiler-2.0.0/compiler/structure_loader.py +132 -0
  166. pgc_compiler-2.0.0/compiler/visualization/__init__.py +12 -0
  167. pgc_compiler-2.0.0/compiler/visualization/consumers/__init__.py +28 -0
  168. pgc_compiler-2.0.0/compiler/visualization/consumers/evidence_projection.py +162 -0
  169. pgc_compiler-2.0.0/compiler/visualization/consumers/evidence_query.py +296 -0
  170. pgc_compiler-2.0.0/compiler/visualization/consumers/evidence_reader.py +127 -0
  171. pgc_compiler-2.0.0/compiler/visualization/views/__init__.py +70 -0
  172. pgc_compiler-2.0.0/compiler/visualization/views/_png_writer.py +45 -0
  173. pgc_compiler-2.0.0/compiler/visualization/views/artifact_lineage.py +180 -0
  174. pgc_compiler-2.0.0/compiler/visualization/views/family_view.py +164 -0
  175. pgc_compiler-2.0.0/compiler/visualization/views/materialization_view.py +150 -0
  176. pgc_compiler-2.0.0/compiler/visualization/views/structural_dag.py +158 -0
  177. pgc_compiler-2.0.0/compiler/visualization/wf_graph_generator.py +534 -0
  178. pgc_compiler-2.0.0/pgc_compiler.egg-info/PKG-INFO +203 -0
  179. pgc_compiler-2.0.0/pgc_compiler.egg-info/SOURCES.txt +183 -0
  180. pgc_compiler-2.0.0/pgc_compiler.egg-info/dependency_links.txt +1 -0
  181. pgc_compiler-2.0.0/pgc_compiler.egg-info/entry_points.txt +2 -0
  182. pgc_compiler-2.0.0/pgc_compiler.egg-info/requires.txt +3 -0
  183. pgc_compiler-2.0.0/pgc_compiler.egg-info/top_level.txt +1 -0
  184. pgc_compiler-2.0.0/pyproject.toml +59 -0
  185. pgc_compiler-2.0.0/setup.cfg +4 -0
@@ -0,0 +1,67 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 Bhash Ganti aka Bachi
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+
20
+ ------------------------
21
+ FULL LICENSE TEXT BELOW
22
+ ------------------------
23
+
24
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
25
+
26
+ 1. Definitions.
27
+ "License" shall mean the terms and conditions for use, reproduction,
28
+ and distribution as defined by Sections 1 through 9 of this document.
29
+ "Licensor" shall mean the copyright owner.
30
+ "Legal Entity" shall mean the union of the acting entity and all other
31
+ entities that control, are controlled by, or are under common control.
32
+ "You" shall mean an individual or Legal Entity exercising permissions.
33
+ "Source" form shall mean the preferred form for making modifications.
34
+ "Object" form shall mean any form resulting from mechanical transformation.
35
+ "Work" shall mean the work of authorship.
36
+ "Derivative Works" shall mean any work based on the Work.
37
+ "Contribution" shall mean any work intentionally submitted.
38
+ "Contributor" shall mean Licensor and any individual submitting Contributions.
39
+
40
+ 2. Grant of Copyright License.
41
+ Each Contributor grants You a perpetual, worldwide, non-exclusive,
42
+ no-charge, royalty-free copyright license.
43
+
44
+ 3. Grant of Patent License.
45
+ Each Contributor grants a patent license to make, use, sell, etc.
46
+
47
+ 4. Redistribution.
48
+ You may reproduce and distribute copies provided that:
49
+ - You include a copy of this License
50
+ - You retain notices
51
+ - You state modifications
52
+ - You include NOTICE file if present
53
+
54
+ 5. Submission of Contributions.
55
+ Contributions are under this License unless stated otherwise.
56
+
57
+ 6. Trademarks.
58
+ This License does not grant trademark rights.
59
+
60
+ 7. Disclaimer of Warranty.
61
+ Provided "AS IS", without warranties.
62
+
63
+ 8. Limitation of Liability.
64
+ No liability for damages.
65
+
66
+ 9. Accepting Warranty or Additional Liability.
67
+ You may offer support/warranty on your own behalf only.
@@ -0,0 +1,15 @@
1
+ # The in-tree build backend and the file it stages.
2
+ #
3
+ # `pyproject.toml` sets build-backend = "_build_hook" with backend-path = ["."],
4
+ # so the hook must travel in the sdist: `python -m build` builds the wheel FROM
5
+ # the sdist, in an isolated directory where anything not shipped does not exist.
6
+ # Without these two lines the sdist builds and the wheel step then fails with
7
+ # `Backend '_build_hook' is not available`.
8
+ #
9
+ # VERSION is the repo-root composition ordinal the hook copies into the package.
10
+ # Omitting it does not fail the build — `_stage_ordinal` skips a missing file —
11
+ # it produces a wheel whose ordinal is silently absent.
12
+ include _build_hook.py
13
+ include VERSION
14
+
15
+ global-exclude __pycache__ *.pyc .DS_Store
@@ -0,0 +1,11 @@
1
+ PGS — Protocol-Governed Systems
2
+ Copyright 2026 Bhash Ganti aka Bachi
3
+
4
+ This project introduces a protocol-first execution model in which:
5
+
6
+ - Behavior is declared in protocol artifacts
7
+ - Execution is performed by a deterministic runtime
8
+ - Capability implementations are bound at compile time
9
+ - Governance is enforced through invariants and assertions
10
+
11
+ Extensibility is achieved by declaration, not refactor.
@@ -0,0 +1,203 @@
1
+ Metadata-Version: 2.4
2
+ Name: pgc-compiler
3
+ Version: 2.0.0
4
+ Summary: PGC protocol compiler — compiles governed declarations into sealed, verified projections (import package: compiler)
5
+ Author-email: Bhash Ganti <bachipeachy@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://omnibachi.org/
8
+ Project-URL: Repository, https://github.com/protocol-governed-computing/protocol_compiler
9
+ Project-URL: Standard, https://doi.org/10.5281/zenodo.22150616
10
+ Keywords: protocol-governed-computing,pgc,governance-compilation,topology-compiler,semantic-addressing,authorization
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Topic :: Software Development :: Compilers
19
+ Classifier: Topic :: System :: Distributed Computing
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ License-File: NOTICE
24
+ Requires-Dist: click
25
+ Requires-Dist: pyyaml
26
+ Requires-Dist: jsonschema
27
+ Dynamic: license-file
28
+
29
+ # protocol_compiler
30
+
31
+ **Topology-native governance compiler for Protocol-Governed Computing.**
32
+
33
+ The compiler translates protocol declarations into sealed, verified projections. It does not execute
34
+ behavior, contain runtime logic, or interpret intent. Everything a governed system will do is decided
35
+ here, before anything runs.
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ pip install pgc-compiler
41
+ ```
42
+
43
+ Once installed:
44
+
45
+ ```bash
46
+ protocol_compiler --help
47
+ ```
48
+
49
+ ## Where it fits
50
+
51
+ ```
52
+ software_governance the normative surface every composition rests on
53
+ conformance_workloads workloads that prove conformance
54
+ business_domains domains built on the surface
55
+
56
+ protocol_compiler source → compiled projections (this repo)
57
+ snapshot_assembler projections → assembled snapshot
58
+ protocol_runtime snapshot → execution
59
+ snapshot_inspector snapshot → inspection
60
+ ```
61
+
62
+ `transformation` sits upstream of all of it, turning a problem statement into the artifacts this
63
+ compiler consumes. `protocol_transport` governs the boundary at either end of execution.
64
+
65
+ The compiler is where **admissibility** is decided. A protocol artifact that violates a constitutional
66
+ boundary fails compilation, so the runtime is never in a position to execute ungoverned behavior — it
67
+ receives sealed, self-consistent instructions or the build does not complete.
68
+
69
+ ## What it is, and is not
70
+
71
+ **It is** a nine-stage compilation pipeline, a governance enforcement gate, a projection producer, and
72
+ a conformance runner for capability-transform implementations.
73
+
74
+ **It is not** a runtime engine, a workflow interpreter, or a code generator for application logic.
75
+ Schema *correctness* is a governance concern declared in `software_governance`; the compiler enforces
76
+ what governance declares rather than deciding it.
77
+
78
+ ## Inputs and outputs
79
+
80
+ Protocol source is Markdown with YAML frontmatter, discriminated by artifact kind:
81
+
82
+ ```
83
+ AC_ actors CC_ capability contracts CS_ capability side effects
84
+ CT_ capability transforms EV_ events
85
+ IN_ intents RB_ runtime bindings WF_ workflows
86
+ TI_ transport ingress TE_ transport egress
87
+ ```
88
+
89
+ Compilation writes per-domain projections, each shaped for one consumer: `canonical` (the complete
90
+ governed artifact graph, human-readable), `tokenized` (the integer-addressed execution substrate),
91
+ `vocabulary` (FQDN ↔ address index), `evidence` (the semantic causality graph), `dispatch` (per-workflow
92
+ routing and pipeline steps), `handlers` (CT-IR, side-effect handler refs, binding policy), plus the
93
+ artifact index. `snapshot_assembler` composes these into the snapshot the runtime consumes.
94
+
95
+ ## Building
96
+
97
+ The platform surface compiles first — a domain resolves its governance and capability references
98
+ against the platform's compiled vocabulary:
99
+
100
+ ```bash
101
+ ./compile.sh STRUCTURE_BUILD_PLATFORM_CONFIG_V1 # the platform surface — named, no default
102
+ ./compile_domain.sh <domain_root> # one domain, against the compiled platform
103
+ ```
104
+
105
+ Both wrap the same CLI, which is also installed as a console script:
106
+
107
+ ```bash
108
+ protocol_compiler compile --structure STRUCTURE_BUILD_PLATFORM_CONFIG_V1
109
+ protocol_compiler compile --all-structures
110
+ protocol_compiler inspect --structure <CODE> --artifact <fqdn> # identity + causality chain
111
+ protocol_compiler inspect --structure <CODE> --upstream <fqdn> # walk causality upstream
112
+ ```
113
+
114
+ A domain is **self-describing**: its build manifest declares its own layer and namespace rule, so
115
+ adding one requires no compiler edit. `PGC_PLATFORM_ROOT` and `PGC_SNAPSHOT_ROOT` override the
116
+ default sibling paths.
117
+
118
+ ## How compilation works
119
+
120
+ Nine stages, run in order. Each transforms an immutable `State` — no stage mutates a prior stage's
121
+ output, and `S7` performs the only side effect in the pipeline.
122
+
123
+ | Stage | Name | What it does |
124
+ |-------|------|--------------|
125
+ | S1 | Extract | Parses frontmatter from source artifacts; builds raw graph nodes |
126
+ | S2 | Canonicalize | Resolves local keys to FQDNs; builds reference and topology edges |
127
+ | S3 | Semantic Addressing | Assigns deterministic integer addresses to every node and edge |
128
+ | S4 | Govern | Enforces constitutional invariants; validates governance boundaries |
129
+ | S5 | Construct | Assembles the full graph — CT-IR, CS-IR, contract projection, workflow enrichment |
130
+ | S6 | Project | Derives the deterministic execution projections |
131
+ | S7 | Materialize | Writes projections to disk — the pipeline's only side effect |
132
+ | S8 | Verify | Roundtrip validation, determinism check, hash and conformance verification |
133
+ | S9 | Attest | Computes the trust attestation binding the verified projections |
134
+
135
+ ## What makes it different
136
+
137
+ **Governance is a compilation stage, not a linting pass.** `S4` is a gate: an artifact that violates a
138
+ constitutional boundary fails the build.
139
+
140
+ **Addressing is topology-native.** Every artifact receives a deterministic integer address derived
141
+ from graph position and content, so the runtime operates on integers and resolves no strings at
142
+ execution time.
143
+
144
+ **Closure is proven before anything is written.** Routing, bindings, input paths and output mappings
145
+ are all resolved and validated ahead of materialization.
146
+
147
+ **Conformance runs at compile time.** Capability-transform implementations are tested against their
148
+ declared `TEST_DATA` during every build; one that fails blocks snapshot validation.
149
+
150
+ ## Purity rules
151
+
152
+ The semantic graph is the sole authority and every projection is a derived materialization of it.
153
+ Graph dataclasses are frozen; stages return new graphs rather than mutating in place. Assertion
154
+ handlers are statically enumerated in a closed registry and resolved by static lookup — no dynamic
155
+ import, no filesystem discovery, and a missing handler fails the compile rather than falling back.
156
+
157
+ ## License
158
+
159
+ Apache-2.0. See `LICENSE` and `NOTICE`.
160
+
161
+ ---
162
+
163
+ ## The package family
164
+
165
+ | Package | Repository | Role |
166
+ |---|---|---|
167
+ | `pgc-compiler` | `protocol_compiler` | declarations → compiled projections |
168
+ | `pgc-assembler` | `snapshot_assembler` | projections → sealed snapshot |
169
+ | `pgc-runtime` | `protocol_runtime` | snapshot → governed execution |
170
+ | `pgc-inspector` | `snapshot_inspector` | snapshot → read-only inspection |
171
+ | `pgc-transformation` | `transformation` | change request → protocol artifacts |
172
+ | `pgc-governance` | `software_governance` | the governance surface and its capability implementations |
173
+ | `pgc-workloads` | `conformance_workloads` | the workloads that make conformance observable |
174
+ | `pgc-domains` | `business_domains` | the business domain implementations the composed snapshot binds |
175
+
176
+ `pip install pgc` brings in the whole family.
177
+
178
+ **Installing the toolchain is one of two steps.** The compiler resolves the governance surface from
179
+ `PGC_PLATFORM_ROOT` — fail-hard, cwd-independent, zero inference — so the *declarations* come from a
180
+ repository you point at, never from a wheel. A registry inside a package would be a second governance
181
+ surface competing with the repository's, and a build could then be governed by a stale copy.
182
+
183
+ ```bash
184
+ git clone https://github.com/protocol-governed-computing/software_governance
185
+ export PGC_PLATFORM_ROOT=$PWD/software_governance
186
+ pgc # reports what is installed and whether the anchor resolves
187
+ ```
188
+
189
+ `PGC_BUILD_ROOT` (compiled output, keeping the governance repo read-only) and `PGC_DOMAIN_ROOTS`
190
+ (additional domains contributing their own `registry/structures`) are optional.
191
+
192
+ **Versioning.** Two schemes, and the published version follows the second.
193
+
194
+ - **Internal** — each repository's `VERSION` file, a monotonic composition ordinal. PGC versions the
195
+ composition rather than each repo: they release together and the governance closure forces lockstep,
196
+ so the ordinal names which composition a repo belongs to. Development happens on `dev/<N>` and each
197
+ cycle is tagged `release-<N>`. This is not published.
198
+ - **Public** — `PUBLIC_VERSION`, tagged on every component repository. The platform is at **`v2`**.
199
+
200
+ **The published version is the public one: `v2` is `2.0.0`.** The standard the packages implement is a
201
+ separate artifact on its own track and is not this number.
202
+
203
+ The standard these packages implement is published separately: https://doi.org/10.5281/zenodo.22150616
@@ -0,0 +1,175 @@
1
+ # protocol_compiler
2
+
3
+ **Topology-native governance compiler for Protocol-Governed Computing.**
4
+
5
+ The compiler translates protocol declarations into sealed, verified projections. It does not execute
6
+ behavior, contain runtime logic, or interpret intent. Everything a governed system will do is decided
7
+ here, before anything runs.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install pgc-compiler
13
+ ```
14
+
15
+ Once installed:
16
+
17
+ ```bash
18
+ protocol_compiler --help
19
+ ```
20
+
21
+ ## Where it fits
22
+
23
+ ```
24
+ software_governance the normative surface every composition rests on
25
+ conformance_workloads workloads that prove conformance
26
+ business_domains domains built on the surface
27
+
28
+ protocol_compiler source → compiled projections (this repo)
29
+ snapshot_assembler projections → assembled snapshot
30
+ protocol_runtime snapshot → execution
31
+ snapshot_inspector snapshot → inspection
32
+ ```
33
+
34
+ `transformation` sits upstream of all of it, turning a problem statement into the artifacts this
35
+ compiler consumes. `protocol_transport` governs the boundary at either end of execution.
36
+
37
+ The compiler is where **admissibility** is decided. A protocol artifact that violates a constitutional
38
+ boundary fails compilation, so the runtime is never in a position to execute ungoverned behavior — it
39
+ receives sealed, self-consistent instructions or the build does not complete.
40
+
41
+ ## What it is, and is not
42
+
43
+ **It is** a nine-stage compilation pipeline, a governance enforcement gate, a projection producer, and
44
+ a conformance runner for capability-transform implementations.
45
+
46
+ **It is not** a runtime engine, a workflow interpreter, or a code generator for application logic.
47
+ Schema *correctness* is a governance concern declared in `software_governance`; the compiler enforces
48
+ what governance declares rather than deciding it.
49
+
50
+ ## Inputs and outputs
51
+
52
+ Protocol source is Markdown with YAML frontmatter, discriminated by artifact kind:
53
+
54
+ ```
55
+ AC_ actors CC_ capability contracts CS_ capability side effects
56
+ CT_ capability transforms EV_ events
57
+ IN_ intents RB_ runtime bindings WF_ workflows
58
+ TI_ transport ingress TE_ transport egress
59
+ ```
60
+
61
+ Compilation writes per-domain projections, each shaped for one consumer: `canonical` (the complete
62
+ governed artifact graph, human-readable), `tokenized` (the integer-addressed execution substrate),
63
+ `vocabulary` (FQDN ↔ address index), `evidence` (the semantic causality graph), `dispatch` (per-workflow
64
+ routing and pipeline steps), `handlers` (CT-IR, side-effect handler refs, binding policy), plus the
65
+ artifact index. `snapshot_assembler` composes these into the snapshot the runtime consumes.
66
+
67
+ ## Building
68
+
69
+ The platform surface compiles first — a domain resolves its governance and capability references
70
+ against the platform's compiled vocabulary:
71
+
72
+ ```bash
73
+ ./compile.sh STRUCTURE_BUILD_PLATFORM_CONFIG_V1 # the platform surface — named, no default
74
+ ./compile_domain.sh <domain_root> # one domain, against the compiled platform
75
+ ```
76
+
77
+ Both wrap the same CLI, which is also installed as a console script:
78
+
79
+ ```bash
80
+ protocol_compiler compile --structure STRUCTURE_BUILD_PLATFORM_CONFIG_V1
81
+ protocol_compiler compile --all-structures
82
+ protocol_compiler inspect --structure <CODE> --artifact <fqdn> # identity + causality chain
83
+ protocol_compiler inspect --structure <CODE> --upstream <fqdn> # walk causality upstream
84
+ ```
85
+
86
+ A domain is **self-describing**: its build manifest declares its own layer and namespace rule, so
87
+ adding one requires no compiler edit. `PGC_PLATFORM_ROOT` and `PGC_SNAPSHOT_ROOT` override the
88
+ default sibling paths.
89
+
90
+ ## How compilation works
91
+
92
+ Nine stages, run in order. Each transforms an immutable `State` — no stage mutates a prior stage's
93
+ output, and `S7` performs the only side effect in the pipeline.
94
+
95
+ | Stage | Name | What it does |
96
+ |-------|------|--------------|
97
+ | S1 | Extract | Parses frontmatter from source artifacts; builds raw graph nodes |
98
+ | S2 | Canonicalize | Resolves local keys to FQDNs; builds reference and topology edges |
99
+ | S3 | Semantic Addressing | Assigns deterministic integer addresses to every node and edge |
100
+ | S4 | Govern | Enforces constitutional invariants; validates governance boundaries |
101
+ | S5 | Construct | Assembles the full graph — CT-IR, CS-IR, contract projection, workflow enrichment |
102
+ | S6 | Project | Derives the deterministic execution projections |
103
+ | S7 | Materialize | Writes projections to disk — the pipeline's only side effect |
104
+ | S8 | Verify | Roundtrip validation, determinism check, hash and conformance verification |
105
+ | S9 | Attest | Computes the trust attestation binding the verified projections |
106
+
107
+ ## What makes it different
108
+
109
+ **Governance is a compilation stage, not a linting pass.** `S4` is a gate: an artifact that violates a
110
+ constitutional boundary fails the build.
111
+
112
+ **Addressing is topology-native.** Every artifact receives a deterministic integer address derived
113
+ from graph position and content, so the runtime operates on integers and resolves no strings at
114
+ execution time.
115
+
116
+ **Closure is proven before anything is written.** Routing, bindings, input paths and output mappings
117
+ are all resolved and validated ahead of materialization.
118
+
119
+ **Conformance runs at compile time.** Capability-transform implementations are tested against their
120
+ declared `TEST_DATA` during every build; one that fails blocks snapshot validation.
121
+
122
+ ## Purity rules
123
+
124
+ The semantic graph is the sole authority and every projection is a derived materialization of it.
125
+ Graph dataclasses are frozen; stages return new graphs rather than mutating in place. Assertion
126
+ handlers are statically enumerated in a closed registry and resolved by static lookup — no dynamic
127
+ import, no filesystem discovery, and a missing handler fails the compile rather than falling back.
128
+
129
+ ## License
130
+
131
+ Apache-2.0. See `LICENSE` and `NOTICE`.
132
+
133
+ ---
134
+
135
+ ## The package family
136
+
137
+ | Package | Repository | Role |
138
+ |---|---|---|
139
+ | `pgc-compiler` | `protocol_compiler` | declarations → compiled projections |
140
+ | `pgc-assembler` | `snapshot_assembler` | projections → sealed snapshot |
141
+ | `pgc-runtime` | `protocol_runtime` | snapshot → governed execution |
142
+ | `pgc-inspector` | `snapshot_inspector` | snapshot → read-only inspection |
143
+ | `pgc-transformation` | `transformation` | change request → protocol artifacts |
144
+ | `pgc-governance` | `software_governance` | the governance surface and its capability implementations |
145
+ | `pgc-workloads` | `conformance_workloads` | the workloads that make conformance observable |
146
+ | `pgc-domains` | `business_domains` | the business domain implementations the composed snapshot binds |
147
+
148
+ `pip install pgc` brings in the whole family.
149
+
150
+ **Installing the toolchain is one of two steps.** The compiler resolves the governance surface from
151
+ `PGC_PLATFORM_ROOT` — fail-hard, cwd-independent, zero inference — so the *declarations* come from a
152
+ repository you point at, never from a wheel. A registry inside a package would be a second governance
153
+ surface competing with the repository's, and a build could then be governed by a stale copy.
154
+
155
+ ```bash
156
+ git clone https://github.com/protocol-governed-computing/software_governance
157
+ export PGC_PLATFORM_ROOT=$PWD/software_governance
158
+ pgc # reports what is installed and whether the anchor resolves
159
+ ```
160
+
161
+ `PGC_BUILD_ROOT` (compiled output, keeping the governance repo read-only) and `PGC_DOMAIN_ROOTS`
162
+ (additional domains contributing their own `registry/structures`) are optional.
163
+
164
+ **Versioning.** Two schemes, and the published version follows the second.
165
+
166
+ - **Internal** — each repository's `VERSION` file, a monotonic composition ordinal. PGC versions the
167
+ composition rather than each repo: they release together and the governance closure forces lockstep,
168
+ so the ordinal names which composition a repo belongs to. Development happens on `dev/<N>` and each
169
+ cycle is tagged `release-<N>`. This is not published.
170
+ - **Public** — `PUBLIC_VERSION`, tagged on every component repository. The platform is at **`v2`**.
171
+
172
+ **The published version is the public one: `v2` is `2.0.0`.** The standard the packages implement is a
173
+ separate artifact on its own track and is not this number.
174
+
175
+ The standard these packages implement is published separately: https://doi.org/10.5281/zenodo.22150616
@@ -0,0 +1 @@
1
+ 14
@@ -0,0 +1,24 @@
1
+ """Build-time hook: stage the composition ordinal inside the package.
2
+
3
+ The repo-root VERSION is the single authored declaration and `release.sh`
4
+ enforces it across every repo. A wheel has no repo root, so the value is copied
5
+ into the package during the build. The copy is a build artifact — gitignored,
6
+ regenerated every build, and never edited.
7
+ """
8
+ from setuptools import build_meta as _orig
9
+ from setuptools.build_meta import * # noqa: F401,F403
10
+ import pathlib
11
+
12
+ def _stage_ordinal():
13
+ root = pathlib.Path(__file__).parent
14
+ src = root / "VERSION"
15
+ if src.is_file():
16
+ (root / "compiler" / "VERSION").write_text(src.read_text(encoding="utf-8"), encoding="utf-8")
17
+
18
+ def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
19
+ _stage_ordinal()
20
+ return _orig.build_wheel(wheel_directory, config_settings, metadata_directory)
21
+
22
+ def build_sdist(sdist_directory, config_settings=None):
23
+ _stage_ordinal()
24
+ return _orig.build_sdist(sdist_directory, config_settings)
@@ -0,0 +1 @@
1
+ 14
@@ -0,0 +1 @@
1
+ """compiler — Protocol Intermediate Representation compiler for PGS."""
@@ -0,0 +1,54 @@
1
+ """
2
+ Atoms: Pure functions with no side effects.
3
+
4
+ Design:
5
+ - Single responsibility
6
+ - Explicit inputs/outputs
7
+ - No I/O, no state
8
+ - Independently testable
9
+ - Reusable across phases
10
+ """
11
+
12
+ from compiler.atoms.error_codes import ErrorCode, ERROR_SUGGESTIONS
13
+ from compiler.atoms.errors import CompilerError, Severity
14
+ from compiler.atoms.fqdn import FQDN, parse_fqdn, build_fqdn, to_fqdn
15
+ from compiler.atoms.invariants import require, require_not_none, require_exists
16
+ from compiler.atoms.phase import PhaseResult, PhaseStatus, PhaseMetrics
17
+ from compiler.atoms.pipeline import strip_transient_pipeline_fields
18
+ from compiler.atoms.sorting import (
19
+ ensure_deterministic_output,
20
+ sort_artifacts_by_fqdn,
21
+ sort_by_fqdn,
22
+ sort_dict_keys,
23
+ )
24
+ from compiler.atoms.snapshot_gate import assert_snapshot_valid
25
+
26
+ __all__ = [
27
+ # Error model
28
+ "CompilerError",
29
+ "ErrorCode",
30
+ "ERROR_SUGGESTIONS",
31
+ "Severity",
32
+ # FQDN identity
33
+ "FQDN",
34
+ "parse_fqdn",
35
+ "build_fqdn",
36
+ "to_fqdn",
37
+ # Phase results
38
+ "PhaseResult",
39
+ "PhaseStatus",
40
+ "PhaseMetrics",
41
+ # Invariant enforcement
42
+ "require",
43
+ "require_not_none",
44
+ "require_exists",
45
+ # Pipeline metadata
46
+ "strip_transient_pipeline_fields",
47
+ # Deterministic ordering
48
+ "ensure_deterministic_output",
49
+ "sort_artifacts_by_fqdn",
50
+ "sort_by_fqdn",
51
+ "sort_dict_keys",
52
+ # Snapshot admission control
53
+ "assert_snapshot_valid",
54
+ ]