protocol-governed-computing 3.0.0__tar.gz → 5.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.
@@ -0,0 +1,415 @@
1
+ Metadata-Version: 2.4
2
+ Name: protocol-governed-computing
3
+ Version: 5.0.0
4
+ Summary: Protocol-Governed Computing — installs the full toolchain and reports whether an environment is ready to compile, seal, and execute
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
9
+ Project-URL: Standard, https://doi.org/10.5281/zenodo.22150616
10
+ Keywords: protocol-governed-computing,pgc,governance,authorization,sdlc
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Topic :: Software Development :: Compilers
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: pgc-compiler==5.0.0
19
+ Requires-Dist: pgc-assembler==5.0.0
20
+ Requires-Dist: pgc-runtime==5.0.0
21
+ Requires-Dist: pgc-inspector==5.0.0
22
+ Requires-Dist: pgc-transformation==5.0.0
23
+ Requires-Dist: pgc-governance==5.0.0
24
+ Requires-Dist: pgc-workloads==5.0.0
25
+ Requires-Dist: pgc-domains==5.0.0
26
+ Provides-Extra: blockchain
27
+ Requires-Dist: pgc-domains[blockchain]==5.0.0; extra == "blockchain"
28
+
29
+ # pgc_install
30
+
31
+ **Protocol-Governed Computing — the whole toolchain in one install.**
32
+
33
+ This repository publishes the `protocol-governed-computing` distribution. PyPI prohibits the
34
+ short name `pgc`, so the composition carries the full project name; the command it installs is
35
+ still `pgc`. It is the composition as *installable
36
+ software*, the counterpart to `pgc_release`, which is the same composition as *sealed
37
+ evidence* — assembled, immutable, and cited by DOI. The parallel is in role, not in citation:
38
+ a release is a thing a paper points at; an install is a thing that changes each version.
39
+
40
+ ```bash
41
+ pip install protocol-governed-computing
42
+ ```
43
+
44
+ That brings in the eight component packages of the family, pinned to one composition, and puts
45
+ `pgc` on the path. To run the sealed composition a paper cites, rather than build one, see
46
+ [`pgc_release`](https://github.com/protocol-governed-computing/pgc_release).
47
+
48
+ ## Two steps, not one
49
+
50
+ Installing the toolchain installs the machinery, not the declarations that govern it. PGC reads those declarations from the repository named by `PGC_PLATFORM_ROOT` — fail-hard, cwd-independent, with no inference. The wheel supplies the implementation; the repository supplies the governance surface.
51
+
52
+
53
+ ```bash
54
+ git clone https://github.com/protocol-governed-computing/software_governance
55
+ export PGC_PLATFORM_ROOT=$PWD/software_governance
56
+ pgc # reports what is installed and whether the anchor resolves
57
+ ```
58
+
59
+ These two steps establish the working platform: install the toolchain, then point it at its governance surface. The compiler can now resolve and compile the platform. Assembling and executing a snapshot requires additional repositories and anchors, described below.
60
+
61
+ ## Who this is for
62
+
63
+ Two kinds of work start here, and they diverge after the toolchain is installed.
64
+
65
+ **Kicking the tires — you want to see the platform build and run.** Clone the declaration
66
+ repositories, compile them, assemble a snapshot, execute a workflow. That is the sequence below,
67
+ unmodified.
68
+
69
+ **Adding a domain — you trust the platform and want to author against it.** Same sequence, with
70
+ your own domain in place of the shipped ones. See *Adding your own domain*.
71
+
72
+ A third case is not served here: **verifying the sealed composition a paper cites**. That artifact
73
+ is published separately and needs no build — see
74
+ [`pgc_release`](https://github.com/protocol-governed-computing/pgc_release).
75
+
76
+ **One thing surprises domain authors, so it is worth saying early.** You must clone
77
+ `software_governance` even though you never modify it. The wheels give you the toolchain *and* the
78
+ platform's capability implementations; they do not give you the governance surface, because
79
+ declarations never ship in a wheel. Trusting the platform does not spare you the clone.
80
+
81
+ ## Installing a working platform
82
+
83
+ A **Profiled Normative Platform** is a composition: a governance surface, one or more
84
+ conformance workloads, and the inspection boundary, sealed together under a profile. The
85
+ wheels carry implementations; every declaration comes from a cloned repository. Reaching a
86
+ snapshot that executes therefore means cloning four repositories and setting the anchors
87
+ that tell each build where to read and where to write.
88
+
89
+ ### 1. The toolchain
90
+
91
+ ```bash
92
+ python3.12 -m venv .venv && source .venv/bin/activate
93
+ pip install protocol-governed-computing
94
+ ```
95
+
96
+ ### 2. The declaration repositories
97
+
98
+ ```bash
99
+ git clone https://github.com/protocol-governed-computing/software_governance
100
+ git clone https://github.com/protocol-governed-computing/conformance_workloads
101
+ git clone https://github.com/protocol-governed-computing/snapshot_inspector
102
+ git clone https://github.com/protocol-governed-computing/.github pgc_github
103
+ ```
104
+
105
+ `software_governance` is the governance surface. `conformance_workloads` and
106
+ `snapshot_inspector` each contribute a domain the reference profile requires.
107
+ `.github` carries the snapshot profiles, which are conformance contracts rather than
108
+ code and are not published in any wheel.
109
+
110
+ A **fifth** clone is needed only to reach the platform over HTTP (§7), and only on
111
+ whichever node serves the boundary:
112
+
113
+ ```bash
114
+ git clone https://github.com/protocol-governed-computing/protocol_transport
115
+ ```
116
+
117
+ `protocol_transport` is deliberately not published. It provisions its import roots —
118
+ `adapters` and `resolver` — from its repository root rather than from an installed
119
+ package, so the boundary is composed by whoever deploys it rather than carried into
120
+ every install. Steps 4 through 6 need none of it.
121
+
122
+ **Pin what you clone.** These commands fetch the default branch, which moves. A wheel at
123
+ one version against declarations from a later branch is an incoherence nothing reports:
124
+ the implementations are one composition's and the declarations another's. Clone
125
+ `--branch <tag>` at the release matching your toolchain — `v5` for `5.0.0` — whenever the
126
+ build has to be reproducible.
127
+
128
+ ### 3. The anchors
129
+
130
+ Five environment variables govern where the toolchain reads and writes. Where the compiler
131
+ writes is not one of them.
132
+
133
+ | Anchor | Read by | Meaning |
134
+ |---|---|---|
135
+ | `PGC_PLATFORM_ROOT` | compiler | the governance repository — the directory containing `registry/` |
136
+ | `PGC_DOMAIN_ROOTS` | compiler | the domain being compiled — the directory containing `registry/structures/` |
137
+ | `PGC_SNAPSHOT_ROOT` | runtime | the assembled snapshot to execute; prefer `--snapshot` |
138
+ | `PGC_SNAPSHOT_PROFILES` | assembler | the directory holding snapshot profiles |
139
+ | `PGC_DATA_ROOT` | runtime | side-effect state and traces — or pass `--data-root` |
140
+
141
+ `PGC_DOMAIN_ROOTS` names the directory that directly contains `registry/structures/`, not
142
+ the repository above it. For `conformance_workloads` that is the workload directory
143
+ (`workloads/collatz`); for `snapshot_inspector` it is the repository root. Pointing it one
144
+ level too high is silent — the build config is simply never found.
145
+
146
+ **Where a build writes is declared, not supplied.** Each build configuration names its root in
147
+ `output_configuration.root`, resolved inside the repository that declares it, and every layer's
148
+ output consolidates there. Every shipped configuration declares `snapshot`, so each domain writes
149
+ into its own repository's `snapshot/`. Two in-force configurations of one repository naming the
150
+ same root are refused, and a configuration naming none cannot be built. The compiler does not read
151
+ `PGC_SNAPSHOT_ROOT`.
152
+
153
+ ### 4. Compile each domain
154
+
155
+ The platform compiles first: every other domain imports its compiled surface, which is
156
+ read from `$PGC_PLATFORM_ROOT/snapshot` regardless of where output is being written.
157
+
158
+ ```bash
159
+ export PGC_PLATFORM_ROOT=$PWD/software_governance
160
+ protocol_compiler compile --structure STRUCTURE_BUILD_PLATFORM_CONFIG_V2
161
+ ```
162
+
163
+ Then each domain, into the root its build configuration declares:
164
+
165
+ ```bash
166
+ PGC_DOMAIN_ROOTS=$PWD/conformance_workloads/workloads/collatz \
167
+ protocol_compiler compile --structure STRUCTURE_BUILD_WORKLOAD_CONFIG_V0
168
+
169
+ PGC_DOMAIN_ROOTS=$PWD/snapshot_inspector \
170
+ protocol_compiler compile --structure STRUCTURE_BUILD_INSPECTION_CONFIG_V0
171
+ ```
172
+
173
+ Each domain writes into its own repository's `snapshot/`, which is where the platform
174
+ already wrote its own and which every one of these repositories gitignores.
175
+
176
+ Each run reports its stages, artifact count, and whether the result verified and attested.
177
+
178
+ ### 5. Assemble and seal
179
+
180
+ `--source` is repeatable and takes one compiled root per domain. The profile is the
181
+ conformance contract the assembled snapshot claims.
182
+
183
+ ```bash
184
+ export PGC_SNAPSHOT_PROFILES=$PWD/pgc_github/snapshot_profiles
185
+
186
+ snapshot_assembler assemble \
187
+ --source $PWD/software_governance/snapshot/compiled \
188
+ --source $PWD/conformance_workloads/workloads/collatz/snapshot/compiled \
189
+ --source $PWD/snapshot_inspector/snapshot/compiled \
190
+ --out $PWD/snapshot \
191
+ --profile GOVERNANCE_SURFACE_PROFILE_V0
192
+ ```
193
+
194
+ A conformant assembly reports the domains composed, the snapshot id, a round-trip verify,
195
+ and composition conformance over the artifacts it sealed.
196
+
197
+ ### 6. Boot and execute
198
+
199
+ ```bash
200
+ protocol_runtime boot --snapshot $PWD/snapshot
201
+
202
+ protocol_runtime run \
203
+ --wf workload::WF_COLLATZ_CONJECTURE_V0 \
204
+ --payload $PWD/conformance_workloads/workloads/collatz/test_payloads/01_happy_path.json \
205
+ --snapshot $PWD/snapshot \
206
+ --data-root $PWD/data
207
+ ```
208
+
209
+ `boot` loads and hash-verifies every domain in the manifest before anything executes. The
210
+ payloads are declarations and live in the cloned repository, not in a wheel.
211
+
212
+ `boot` also reads `PGC_SNAPSHOT_PROFILES`, exported in §5. A sealed snapshot's profile claim was
213
+ evaluated when it was sealed, so booting one should not need the profile root — today it does, and
214
+ reports an error before proceeding if the anchor is unset.
215
+
216
+ ### 7. Reach it over HTTP
217
+
218
+ Steps 1 through 6 execute through the CLI. The interaction boundary is a separate surface, and two
219
+ of the cloned repositories ship a client for it: `conformance_workloads/workloads/collatz/client`
220
+ submits work, and `snapshot_inspector/client` reads the snapshot. Each carries its own `web/`, a
221
+ `bindings/http.json` naming which operations are reachable at which route, and a `serve.sh`.
222
+
223
+ **Those `serve.sh` scripts assume a development checkout**, where `runtime`, `inspector` and
224
+ `assembler` are sibling repository roots on `PYTHONPATH`. Here they are installed packages, so the
225
+ roots point at site-packages instead. `protocol_transport` is the exception, and is genuinely a
226
+ repository root because it is unpublished.
227
+
228
+ ```bash
229
+ SP=$(python3 -c 'import site; print(site.getsitepackages()[0])')
230
+ CLIENT=$PWD/conformance_workloads/workloads/collatz/client
231
+
232
+ PGC_RUNTIME_ROOT=$SP PGC_INSPECTOR_ROOT=$SP PGC_ASSEMBLER_ROOT=$SP PGC_IMPL_ROOTS=$SP \
233
+ PGC_SNAPSHOT_ROOT=$PWD/snapshot \
234
+ PGC_DATA_ROOT=$PWD/data/collatz \
235
+ PGC_HTTP_BINDINGS=$CLIENT/bindings/http.json \
236
+ PGC_STATIC_MOUNTS="/=$CLIENT/web;/snapshot=$PWD/snapshot" \
237
+ PGC_HTTP_PORT=8000 \
238
+ $PWD/protocol_transport/run_http.sh
239
+ ```
240
+
241
+ Substitute `$PWD/snapshot_inspector/client` and another port for the read surface. Then:
242
+
243
+ ```bash
244
+ curl -s -X POST http://localhost:8000/collatz -d '{"number":27}'
245
+ curl -s -X POST http://localhost:8001/si -d '{"operation":"si.snapshot.validate"}'
246
+ ```
247
+
248
+ The read surface routes every `si.*` operation through one binding, named in the request body
249
+ rather than in the path. The boundary reads its bindings once, at startup: restart it after any
250
+ rebuild.
251
+
252
+ `run_http.sh` launches `python3`, which is the virtual environment's interpreter while §1's
253
+ environment is active. Set `PYTHON` to an absolute path if you invoke this without activating it —
254
+ not to `$(command -v python)`, which returns an alias rather than a path under some shells.
255
+
256
+ ## Adding your own domain
257
+
258
+ A domain is a directory the compiler is pointed at. It declares what it contributes, compiles against
259
+ the platform's compiled surface, and composes into a snapshot alongside it. You author it; nothing
260
+ generates it for you.
261
+
262
+ The smallest domain that admits a request, does work, and returns a result is **six files producing
263
+ seventeen artifacts**. `.github/process/domain_authoring.py` builds exactly that from scratch on every
264
+ regression run, so what follows is executed rather than described.
265
+
266
+ **The shape.**
267
+
268
+ ```
269
+ your_domain/
270
+ registry/
271
+ structures/STRUCTURE_BUILD_YOUR_DOMAIN_CONFIG_V0.md the build manifest
272
+ <subdomain>/
273
+ actors/AC_*.md intents/IN_*.md workflows/WF_*.md
274
+ capability_contracts/CC_*.md capability_transforms/CT_*.md
275
+ implementation/
276
+ capability_transforms/atoms/*.py one module per CT, each exposing execute(inputs, context)
277
+ ```
278
+
279
+ **The build manifest.** Three parts of it are easy to get wrong, and each fails in its own way:
280
+
281
+ ```yaml
282
+ fqdn: your_domain::STRUCTURE_BUILD_YOUR_DOMAIN_CONFIG_V0
283
+ artifact_kind: STRUCTURE
284
+ version: V0
285
+ governed_by: structure::CONSTITUTION_STRUCTURE_V0
286
+ authority: pgc.platform
287
+ concern: your_domain
288
+ structure_scope: your_domain # names the composed domain — see below
289
+ reuse_visibility: business
290
+ core:
291
+ summary: Build-time STRUCTURE manifest for the your_domain scope
292
+ layer_definitions:
293
+ YOUR_DOMAIN:
294
+ domain_subpath: registry
295
+ registry_module: your_domain.registry
296
+ implementation_namespace: your_domain.implementation.capability_transforms.atoms
297
+ layer_category: domain
298
+ identity_rules:
299
+ - match: your_domain.registry
300
+ namespace: your_domain
301
+ artifact_discovery:
302
+ search_layers:
303
+ - YOUR_DOMAIN
304
+ import_surface:
305
+ domain: platform # compile against the platform's compiled surface
306
+ artifact_types: [AC, IN, WF, CC, CT]
307
+ output_configuration:
308
+ root: snapshot # where this build writes, inside your_domain
309
+ artifacts:
310
+ layer: PROTOCOL_BUILD_ROOT
311
+ subpath: compiled/canonical
312
+ vocabulary_projection_path: {layer: GOVERNANCE, subpath: compiled/vocabulary}
313
+ tokenized_projection_path: {layer: GOVERNANCE, subpath: compiled/tokenized}
314
+ evidence_projection_path: {layer: GOVERNANCE, subpath: compiled/evidence}
315
+ trust_attestation_path: {layer: GOVERNANCE, subpath: compiled/trust}
316
+ visualization_projection_path: {layer: GOVERNANCE, subpath: compiled/visualization}
317
+ layer_outputs:
318
+ YOUR_DOMAIN:
319
+ layer: YOUR_DOMAIN
320
+ subpath: compiled/canonical
321
+ ```
322
+
323
+ **`root` and all five projection paths are required.** A configuration without `root` is refused
324
+ before anything is compiled. Omitting them does not fail early: the build passes
325
+ discovery, governance and construction and dies at S7 with five `E301_WRITE_FAILED` errors naming
326
+ each missing path. It reads like a compiler fault and is a missing declaration.
327
+
328
+ **`structure_scope` names the composed domain**, not `layer_category` and not the namespace. Set it
329
+ to something generic and the snapshot composes a domain literally called that — the assembly
330
+ succeeds, conformance passes, and the domain is simply wrongly named. Nothing catches it.
331
+
332
+ **Building it** is step 4 above with your directory in place of a shipped one:
333
+
334
+ ```bash
335
+ PGC_DOMAIN_ROOTS=$PWD/your_domain \
336
+ protocol_compiler compile --structure STRUCTURE_BUILD_YOUR_DOMAIN_CONFIG_V0
337
+ ```
338
+
339
+ Then add `--source $PWD/your_domain/snapshot/compiled` to the assemble in step 5. The platform must
340
+ be compiled first: `import_surface` reads its compiled vocabulary, and a domain cannot compile
341
+ against a surface that does not yet exist.
342
+
343
+ **Your domain must be importable at execution time.** The compiler reads declarations from the
344
+ filesystem, but the runtime *imports* the module a CT names. If your package is not on the path, the
345
+ workflow does not raise — it returns `VIOLATION` with the transform's outputs null, which looks like
346
+ a failed business rule rather than a missing module. Either `pip install -e your_domain` or:
347
+
348
+ ```bash
349
+ export PYTHONPATH=$PWD
350
+ ```
351
+
352
+ **What you do not need:** `conformance_workloads`. It contributes the collatz workload, which the
353
+ profile in force does not require — verified by building this path without it. You still need
354
+ `software_governance` for the declarations and `snapshot_inspector` for the inspection domain the
355
+ profile does require.
356
+
357
+ **A profile permits more than it requires.** Composing your domain alongside the platform does not
358
+ violate the claimed profile: a snapshot may carry more than a profile requires and still conform.
359
+
360
+ ## Known rough edges
361
+
362
+ - **A successful compile may end with `⚠ Machine-block health: N candidate unconsumed key(s)`.**
363
+ It is expected, and it is not a failure: the build has already verified and attested by the
364
+ time it prints. It is a heuristic run after the build. For each artifact kind that no schema
365
+ closes, it looks for machine-block keys whose names appear nowhere in the compiler's source. A
366
+ key it lists is a *candidate* for a declaration nothing reads, not proof of one. `--verbose`
367
+ shows the keys.
368
+ - **`PGC_BUILD_ROOT` is inert.** It is accepted and reported, and nothing reads it.
369
+ - **`pgc` reports readiness for the platform compile only.** It reads three anchors and
370
+ reports "Ready" once the governance surface resolves; assembly and execution need the
371
+ other three.
372
+ - **`protocol_runtime boot` requires `PGC_SNAPSHOT_PROFILES`.** A sealed snapshot carries its
373
+ profile claim, and that claim was evaluated when the snapshot was sealed, so booting it should
374
+ not need the profile root. Unset, `boot` prints an error and then proceeds and succeeds. The
375
+ sequence above exports it in §5, so §6 inherits it — which makes the ordering load-bearing
376
+ rather than incidental.
377
+ - **`--data-root` rejects a relative path.** `$PWD/data` above is absolute and passes. A bare
378
+ `data` does not, which will surface first in whatever script wraps this.
379
+ - **No serving path is published for an installed platform.** Both clients' `serve.sh` resolve
380
+ `runtime`, `inspector` and `assembler` from sibling repository roots, which exist in a
381
+ development checkout and not in an install. §7 gives the equivalent invocation; nothing in any
382
+ repository does.
383
+
384
+ ## The family
385
+
386
+ | Package | Role |
387
+ |---|---|
388
+ | `pgc-compiler` | declarations → compiled projections |
389
+ | `pgc-assembler` | projections → sealed snapshot |
390
+ | `pgc-runtime` | snapshot → governed execution |
391
+ | `pgc-inspector` | snapshot → read-only inspection |
392
+ | `pgc-transformation` | change request → protocol artifacts |
393
+ | `pgc-governance` | the governance surface and its capability implementations |
394
+ | `pgc-workloads` | the workloads that make conformance observable |
395
+ | `pgc-domains` | the business domain implementations the composed snapshot binds |
396
+
397
+ **Versioning.** Two schemes. Each repository's `VERSION` is a monotonic composition ordinal —
398
+ internal build accounting, tagged `release-<N>`, never published. `PUBLIC_VERSION` is the platform's
399
+ public identity, tagged on every component repository; the platform is at **`v5`**.
400
+
401
+ **The published version follows the public one: `v5` opens at `5.0.0`.** The family releases in
402
+ lockstep, so the composition pins exact versions rather than ranges.
403
+
404
+ A public identity may carry more than one published version. A packaging or distribution defect can
405
+ be corrected in a patch release within the same identity, because such a fix changes what a wheel
406
+ contains and not what the composition determines. A change to what the composition determines takes
407
+ the next public identity, and only that mints a new DOI.
408
+
409
+ `v5` is the second kind. The snapshot identity now covers the claimed profile's content, so
410
+ acceptance refuses a profile changed after sealing, and refuses every snapshot sealed before `v5`.
411
+ A superseded artifact no longer confers effect. Both change what the composition admits, and a patch
412
+ release would have said otherwise.
413
+
414
+ The standard these packages implement is a separate artifact on its own track, is not this number,
415
+ and is published separately: https://doi.org/10.5281/zenodo.22150616