pgs-runtime 0.2.1__tar.gz → 0.3.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.
@@ -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,9 @@
1
+ exclude *.log
2
+ exclude *.jsonl
3
+ exclude *.sh
4
+
5
+ prune scripts
6
+ prune testbed
7
+ prune pgs_*
8
+
9
+ global-exclude __pycache__ *.pyc
@@ -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,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: pgs_runtime
3
+ Version: 0.3.0
4
+ Summary: PGS runtime for Protocol-Governed Systems
5
+ Author: Bachi
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/bachipeachy/pgs_runtime
8
+ Project-URL: Repository, https://github.com/bachipeachy/pgs_runtime
9
+ Keywords: pgs,protocol,runtime,workflow,execution
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Operating System :: OS Independent
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ License-File: NOTICE
21
+ Dynamic: license-file
22
+
23
+ # pgs_runtime
24
+
25
+ **Deterministic execution engine for Protocol-Governed Systems.**
26
+
27
+ The runtime traverses a precompiled execution graph and produces traceable, governed outcomes.
28
+ It does not discover behavior. It does not interpret intent. It does not contain business logic.
29
+
30
+ Behavior is declared in protocol, executed by runtime, implemented in capabilities, and observed via traces and state.
31
+
32
+ > **New to PGS?** This is one of eight repositories in the Protocol-Governed Systems ecosystem.
33
+ > For orientation, architecture overview, and end-to-end execution, start at [pgs_workspace](https://github.com/bachipeachy/pgs_workspace).
34
+
35
+ ---
36
+
37
+ ## What this component is (and is not)
38
+
39
+ **This is:**
40
+ - A generic execution substrate
41
+ - A graph traversal engine
42
+ - A trace generator
43
+ - A host for capability implementations (CT/CS bindings)
44
+
45
+ **This is not:**
46
+ - A workflow authoring system
47
+ - A rules engine
48
+ - A business logic container
49
+ - A framework with pluggable behavior
50
+
51
+ All behavior is declared and compiled before execution. The runtime only consumes a sealed snapshot.
52
+
53
+ ---
54
+
55
+ ## Inputs → Outputs
56
+
57
+ **Inputs:**
58
+ ```
59
+ protocol_snapshot/ ← compiled artifacts (from pgs_compiler)
60
+ payload ← external input (JSON)
61
+ data_root ← state storage boundary
62
+ workspace ← execution context
63
+ ```
64
+
65
+ **Outputs:**
66
+ ```
67
+ traces/<TRACE_ID>/
68
+ ├── <TRACE_ID>.jsonl ← append-only execution log
69
+ ├── <TRACE_ID>.md ← human-readable summary
70
+ └── <TRACE_ID>.png ← visual execution path
71
+
72
+ data/
73
+ ├── registry/ ← idempotent state
74
+ ├── events/ ← append-only history
75
+ └── ... ← additional declared side-effects
76
+ ```
77
+
78
+ ---
79
+
80
+ ## CLI surface
81
+
82
+ ```bash
83
+ pgs_runtime run \
84
+ --wf blockchain::WF_REGISTER_ACTOR_UNVERIFIED_V0 \
85
+ --payload payload.json \
86
+ --data-root /abs/path/to/pgs_workspace/data \
87
+ --workspace /abs/path/to/pgs_workspace
88
+
89
+ pgs_runtime examine ./traces/<TRACE_ID>/<TRACE_ID>.jsonl
90
+ ```
91
+
92
+ That is the entire public interface. Everything else is governed by the protocol snapshot.
93
+
94
+ ---
95
+
96
+ ## How execution works
97
+
98
+ You run a workflow. The runtime:
99
+
100
+ 1. Loads the compiled DAG from `protocol_snapshot/`
101
+ 2. Resolves inputs via JSONPath expressions
102
+ 3. Executes CT/CS nodes (transforms and side-effects)
103
+ 4. Routes based on declared outcomes
104
+ 5. Emits trace + state
105
+
106
+ No logic exists in the runtime for any specific workflow.
107
+
108
+ **Example:** `pgs_runtime run --wf blockchain::WF_REGISTER_ACTOR_UNVERIFIED_V0 ...`
109
+
110
+ The runtime has no knowledge of blockchain. It only traverses the precomputed graph compiled from that workflow's protocol declaration.
111
+
112
+ ---
113
+
114
+ ## What makes this runtime different
115
+
116
+ **1. Compile-time closure**
117
+
118
+ All routing, bindings, and side-effect semantics are resolved before execution begins:
119
+ - no reflection
120
+ - no dynamic imports
121
+ - no fallback logic
122
+
123
+ Execution is a pure traversal of a sealed graph.
124
+ No runtime decision can alter the graph.
125
+
126
+ **2. Outcome-driven control flow**
127
+
128
+ Every node produces an explicit outcome:
129
+ ```
130
+ SUCCESS
131
+ ALREADY_EXISTS
132
+ VIOLATION
133
+ ...
134
+ ```
135
+
136
+ These outcomes map to named edges in the graph. There is no implicit branching, no hidden control flow, no exception-driven logic.
137
+
138
+ **3. Side-effects are governed, not coded**
139
+
140
+ Side-effects (CS) declare their own semantics:
141
+
142
+ | Behavior | Example |
143
+ |----------|---------|
144
+ | Idempotent | registry insert → `ALREADY_EXISTS` on repeat |
145
+ | Append-only | event stream → always records |
146
+ | Mutable | state overwrite (explicitly declared) |
147
+
148
+ The runtime executes these semantics as declared. It does not interpret them.
149
+
150
+ **4. Execution ≠ effect**
151
+
152
+ A workflow can succeed even when a side-effect returns `ALREADY_EXISTS`. Execution is structural. Effects are governed independently. This separation is visible in traces and state.
153
+
154
+ **5. Trace is first-class output**
155
+
156
+ Every run produces a complete causal execution record keyed by `trace_id`. This enables:
157
+ - deterministic replay
158
+ - auditability
159
+ - debugging without code instrumentation
160
+
161
+ ---
162
+
163
+ ## Where this fits in the system
164
+
165
+ PGS is intentionally split into layers:
166
+
167
+ | Layer | Repo | Responsibility |
168
+ |-------|------|----------------|
169
+ | Governance | `pgs_governance` | Invariants, constitutional rules, structural definitions |
170
+ | Compilation | `pgs_compiler` | Produce `protocol_snapshot/` |
171
+ | Transport | `pgs_transport` | Ingress/egress adapters for HTTP and CLI |
172
+ | **Execution** | **`pgs_runtime` ← here** | **Traverse compiled graph deterministically** |
173
+ | Capabilities | `pgs_capabilities` | Provide CT/CS implementations |
174
+ | Domains | `pgs_blockchain`, `pgs_ai_governance` | Real-world workflows |
175
+ | Entry point | `pgs_workspace` | Run and observe |
176
+
177
+ ---
178
+
179
+ ## What you should explore next
180
+
181
+ | Go here | To... |
182
+ |---------|-------|
183
+ | `pgs_workspace` | Run end-to-end and observe traces |
184
+ | `protocol_snapshot/` | Inspect what the runtime actually reads |
185
+ | `pgs_governance` + `pgs_compiler` | Author and compile new workflows |
186
+ | `pgs_capabilities` | Add new capability implementations |
187
+
188
+ ---
189
+
190
+ ## Research context
191
+
192
+ This implementation demonstrates:
193
+
194
+ > *"Extensibility by declaration, not refactor."*
195
+
196
+ And more broadly: governance-driven execution, compile-time closure of behavior, separation of execution from semantics.
197
+
198
+ ---
199
+
200
+ ## Final note
201
+
202
+ The runtime does not decide what to do.
203
+ It only executes what has already been decided.
204
+
205
+ If you find yourself wanting to add logic to this runtime — stop.
206
+ That logic belongs in the protocol (declaration) or in capability implementations (CT/CS).
207
+ The runtime should remain boringly deterministic.
208
+
209
+ ---
210
+
211
+ ## License
212
+
213
+ Apache-2.0. See LICENSE and NOTICE for details.
@@ -0,0 +1,191 @@
1
+ # pgs_runtime
2
+
3
+ **Deterministic execution engine for Protocol-Governed Systems.**
4
+
5
+ The runtime traverses a precompiled execution graph and produces traceable, governed outcomes.
6
+ It does not discover behavior. It does not interpret intent. It does not contain business logic.
7
+
8
+ Behavior is declared in protocol, executed by runtime, implemented in capabilities, and observed via traces and state.
9
+
10
+ > **New to PGS?** This is one of eight repositories in the Protocol-Governed Systems ecosystem.
11
+ > For orientation, architecture overview, and end-to-end execution, start at [pgs_workspace](https://github.com/bachipeachy/pgs_workspace).
12
+
13
+ ---
14
+
15
+ ## What this component is (and is not)
16
+
17
+ **This is:**
18
+ - A generic execution substrate
19
+ - A graph traversal engine
20
+ - A trace generator
21
+ - A host for capability implementations (CT/CS bindings)
22
+
23
+ **This is not:**
24
+ - A workflow authoring system
25
+ - A rules engine
26
+ - A business logic container
27
+ - A framework with pluggable behavior
28
+
29
+ All behavior is declared and compiled before execution. The runtime only consumes a sealed snapshot.
30
+
31
+ ---
32
+
33
+ ## Inputs → Outputs
34
+
35
+ **Inputs:**
36
+ ```
37
+ protocol_snapshot/ ← compiled artifacts (from pgs_compiler)
38
+ payload ← external input (JSON)
39
+ data_root ← state storage boundary
40
+ workspace ← execution context
41
+ ```
42
+
43
+ **Outputs:**
44
+ ```
45
+ traces/<TRACE_ID>/
46
+ ├── <TRACE_ID>.jsonl ← append-only execution log
47
+ ├── <TRACE_ID>.md ← human-readable summary
48
+ └── <TRACE_ID>.png ← visual execution path
49
+
50
+ data/
51
+ ├── registry/ ← idempotent state
52
+ ├── events/ ← append-only history
53
+ └── ... ← additional declared side-effects
54
+ ```
55
+
56
+ ---
57
+
58
+ ## CLI surface
59
+
60
+ ```bash
61
+ pgs_runtime run \
62
+ --wf blockchain::WF_REGISTER_ACTOR_UNVERIFIED_V0 \
63
+ --payload payload.json \
64
+ --data-root /abs/path/to/pgs_workspace/data \
65
+ --workspace /abs/path/to/pgs_workspace
66
+
67
+ pgs_runtime examine ./traces/<TRACE_ID>/<TRACE_ID>.jsonl
68
+ ```
69
+
70
+ That is the entire public interface. Everything else is governed by the protocol snapshot.
71
+
72
+ ---
73
+
74
+ ## How execution works
75
+
76
+ You run a workflow. The runtime:
77
+
78
+ 1. Loads the compiled DAG from `protocol_snapshot/`
79
+ 2. Resolves inputs via JSONPath expressions
80
+ 3. Executes CT/CS nodes (transforms and side-effects)
81
+ 4. Routes based on declared outcomes
82
+ 5. Emits trace + state
83
+
84
+ No logic exists in the runtime for any specific workflow.
85
+
86
+ **Example:** `pgs_runtime run --wf blockchain::WF_REGISTER_ACTOR_UNVERIFIED_V0 ...`
87
+
88
+ The runtime has no knowledge of blockchain. It only traverses the precomputed graph compiled from that workflow's protocol declaration.
89
+
90
+ ---
91
+
92
+ ## What makes this runtime different
93
+
94
+ **1. Compile-time closure**
95
+
96
+ All routing, bindings, and side-effect semantics are resolved before execution begins:
97
+ - no reflection
98
+ - no dynamic imports
99
+ - no fallback logic
100
+
101
+ Execution is a pure traversal of a sealed graph.
102
+ No runtime decision can alter the graph.
103
+
104
+ **2. Outcome-driven control flow**
105
+
106
+ Every node produces an explicit outcome:
107
+ ```
108
+ SUCCESS
109
+ ALREADY_EXISTS
110
+ VIOLATION
111
+ ...
112
+ ```
113
+
114
+ These outcomes map to named edges in the graph. There is no implicit branching, no hidden control flow, no exception-driven logic.
115
+
116
+ **3. Side-effects are governed, not coded**
117
+
118
+ Side-effects (CS) declare their own semantics:
119
+
120
+ | Behavior | Example |
121
+ |----------|---------|
122
+ | Idempotent | registry insert → `ALREADY_EXISTS` on repeat |
123
+ | Append-only | event stream → always records |
124
+ | Mutable | state overwrite (explicitly declared) |
125
+
126
+ The runtime executes these semantics as declared. It does not interpret them.
127
+
128
+ **4. Execution ≠ effect**
129
+
130
+ A workflow can succeed even when a side-effect returns `ALREADY_EXISTS`. Execution is structural. Effects are governed independently. This separation is visible in traces and state.
131
+
132
+ **5. Trace is first-class output**
133
+
134
+ Every run produces a complete causal execution record keyed by `trace_id`. This enables:
135
+ - deterministic replay
136
+ - auditability
137
+ - debugging without code instrumentation
138
+
139
+ ---
140
+
141
+ ## Where this fits in the system
142
+
143
+ PGS is intentionally split into layers:
144
+
145
+ | Layer | Repo | Responsibility |
146
+ |-------|------|----------------|
147
+ | Governance | `pgs_governance` | Invariants, constitutional rules, structural definitions |
148
+ | Compilation | `pgs_compiler` | Produce `protocol_snapshot/` |
149
+ | Transport | `pgs_transport` | Ingress/egress adapters for HTTP and CLI |
150
+ | **Execution** | **`pgs_runtime` ← here** | **Traverse compiled graph deterministically** |
151
+ | Capabilities | `pgs_capabilities` | Provide CT/CS implementations |
152
+ | Domains | `pgs_blockchain`, `pgs_ai_governance` | Real-world workflows |
153
+ | Entry point | `pgs_workspace` | Run and observe |
154
+
155
+ ---
156
+
157
+ ## What you should explore next
158
+
159
+ | Go here | To... |
160
+ |---------|-------|
161
+ | `pgs_workspace` | Run end-to-end and observe traces |
162
+ | `protocol_snapshot/` | Inspect what the runtime actually reads |
163
+ | `pgs_governance` + `pgs_compiler` | Author and compile new workflows |
164
+ | `pgs_capabilities` | Add new capability implementations |
165
+
166
+ ---
167
+
168
+ ## Research context
169
+
170
+ This implementation demonstrates:
171
+
172
+ > *"Extensibility by declaration, not refactor."*
173
+
174
+ And more broadly: governance-driven execution, compile-time closure of behavior, separation of execution from semantics.
175
+
176
+ ---
177
+
178
+ ## Final note
179
+
180
+ The runtime does not decide what to do.
181
+ It only executes what has already been decided.
182
+
183
+ If you find yourself wanting to add logic to this runtime — stop.
184
+ That logic belongs in the protocol (declaration) or in capability implementations (CT/CS).
185
+ The runtime should remain boringly deterministic.
186
+
187
+ ---
188
+
189
+ ## License
190
+
191
+ Apache-2.0. See LICENSE and NOTICE for details.
@@ -0,0 +1,5 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ NOTICE
4
+ README.md
5
+ pyproject.toml
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pgs_runtime"
7
+ version = "0.3.0"
8
+ description = "PGS runtime for Protocol-Governed Systems"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+
12
+ license = "Apache-2.0"
13
+
14
+ authors = [
15
+ { name = "Bachi" }
16
+ ]
17
+
18
+ dependencies = []
19
+
20
+ keywords = ["pgs", "protocol", "runtime", "workflow", "execution"]
21
+
22
+ classifiers = [
23
+ "Development Status :: 4 - Beta",
24
+ "Intended Audience :: Developers",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Operating System :: OS Independent"
30
+ ]
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/bachipeachy/pgs_runtime"
34
+ Repository = "https://github.com/bachipeachy/pgs_runtime"
35
+
36
+ [project.scripts]
37
+ pgs_runtime = "pgs_runtime.cli:main"
38
+
39
+ [tool.setuptools]
40
+ include-package-data = false
41
+
42
+ [tool.setuptools.packages.find]
43
+ where = ["."]
44
+ include = ["pgs_runtime*"]
45
+ exclude = ["testbed*", "scripts*", "*.tests"]
@@ -1,27 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pgs-runtime
3
- Version: 0.2.1
4
- Summary: Successor package lineage for OmniBachi runtime
5
- Author: Bhash Ganti aka Bachi
6
- License: Apache-2.0
7
- Project-URL: Homepage, https://github.com/bachipeachy/pgs_runtime
8
- Requires-Python: >=3.11
9
- Description-Content-Type: text/markdown
10
-
11
- # pgs-runtime
12
-
13
- `pgs-runtime` is the successor package lineage to `omnibachi`.
14
-
15
- `omnibachi==0.2.1` is the final OmniBachi symbolic runtime release.
16
-
17
- Active development begins with:
18
-
19
- ```bash
20
- pip install pgs-runtime>=0.3.0
21
-
22
- ```
23
-
24
- PGS Runtime v0.3.x introduces the token-native deterministic runtime architecture and Compiler/Runtime Inversion model.
25
-
26
- Historical package:
27
- https://pypi.org/project/omnibachi/
@@ -1,17 +0,0 @@
1
- # pgs-runtime
2
-
3
- `pgs-runtime` is the successor package lineage to `omnibachi`.
4
-
5
- `omnibachi==0.2.1` is the final OmniBachi symbolic runtime release.
6
-
7
- Active development begins with:
8
-
9
- ```bash
10
- pip install pgs-runtime>=0.3.0
11
-
12
- ```
13
-
14
- PGS Runtime v0.3.x introduces the token-native deterministic runtime architecture and Compiler/Runtime Inversion model.
15
-
16
- Historical package:
17
- https://pypi.org/project/omnibachi/
@@ -1 +0,0 @@
1
- __version__ = "0.2.1"
@@ -1,27 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pgs-runtime
3
- Version: 0.2.1
4
- Summary: Successor package lineage for OmniBachi runtime
5
- Author: Bhash Ganti aka Bachi
6
- License: Apache-2.0
7
- Project-URL: Homepage, https://github.com/bachipeachy/pgs_runtime
8
- Requires-Python: >=3.11
9
- Description-Content-Type: text/markdown
10
-
11
- # pgs-runtime
12
-
13
- `pgs-runtime` is the successor package lineage to `omnibachi`.
14
-
15
- `omnibachi==0.2.1` is the final OmniBachi symbolic runtime release.
16
-
17
- Active development begins with:
18
-
19
- ```bash
20
- pip install pgs-runtime>=0.3.0
21
-
22
- ```
23
-
24
- PGS Runtime v0.3.x introduces the token-native deterministic runtime architecture and Compiler/Runtime Inversion model.
25
-
26
- Historical package:
27
- https://pypi.org/project/omnibachi/
@@ -1,7 +0,0 @@
1
- README.md
2
- pyproject.toml
3
- pgs_runtime/__init__.py
4
- pgs_runtime.egg-info/PKG-INFO
5
- pgs_runtime.egg-info/SOURCES.txt
6
- pgs_runtime.egg-info/dependency_links.txt
7
- pgs_runtime.egg-info/top_level.txt
@@ -1 +0,0 @@
1
- pgs_runtime
@@ -1,20 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=61.0"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "pgs-runtime"
7
- version = "0.2.1"
8
- description = "Successor package lineage for OmniBachi runtime"
9
- readme = "README.md"
10
- requires-python = ">=3.11"
11
- license = {text = "Apache-2.0"}
12
-
13
- authors = [
14
- {name = "Bhash Ganti aka Bachi"}
15
- ]
16
-
17
- urls = {Homepage = "https://github.com/bachipeachy/pgs_runtime"}
18
-
19
- [tool.setuptools.packages.find]
20
- include = ["pgs_runtime"]
File without changes