HirModel commited on
Commit
25b7932
·
verified ·
1 Parent(s): 95f5597

Upload 40 files

Browse files

# Substrate Mesh Runtime — Connector API

Private FastAPI connector for the Substrate Mesh Runtime and Primordial OS Runtime GPT Action route.

This Space exposes a bounded HTTPS API for submitting Substrate mesh commands, receiving receipt-bound responses, and retrieving command receipts. It preserves the HIR × OAM pressure spine, workspace isolation, source-return boundaries, and overlay-only write posture.

This is not a public autonomous agent, truth oracle, moderation authority, legal authority, medical authority, or final validation system.

Canonical artifacts remain read-only. Canonical lexicon entries remain read-only. User and GPT outputs are routed as workspace-local overlay proposals only. Human review remains required for downstream claims, publication, deployment, or external validation.

Files changed (40) hide show
  1. .dockerignore +12 -0
  2. .env.example +5 -0
  3. DEPLOYMENT_CHECKLIST_v3_3_1.md +15 -0
  4. Dockerfile +16 -0
  5. FINAL_LOCAL_RUN_INSTRUCTIONS_v3_3_1.md +56 -0
  6. README.md +81 -12
  7. RELEASE_MANIFEST.json +19 -0
  8. SHA256SUMS.txt +38 -0
  9. Substrate_Mesh_Runtime_Primordial_OS_Runtime_Connector_API_Wrapper_v3_3_1_OSF_READY.zip.sha256 +1 -0
  10. V3_3_1_BOUNDARY_AND_CLAIMS_LIMIT.md +19 -0
  11. V3_3_1_BUILD_RECEIPT.md +25 -0
  12. V3_3_1_KNOWN_LIMITATIONS.md +8 -0
  13. V3_3_1_TEST_REPORT.md +24 -0
  14. V3_3_1_VALIDATION_RESULT.json +14 -0
  15. app.py +235 -0
  16. cockpit_static/index.html +12 -0
  17. docs/CROSS_USER_WORKSPACE_POLICY.md +50 -0
  18. docs/GPT_ACTION_SETUP_STEPS_v3_3_1.md +28 -0
  19. docs/GPT_BUILDER_ACTION_SETUP_NOTES.md +56 -0
  20. docs/HUGGING_FACE_DOCKER_SPACE_DEPLOYMENT_STEPS.md +24 -0
  21. docs/PRIVACY_POLICY_STUB_FOR_ACTIONS.md +34 -0
  22. docs/PRIVACY_POLICY_STUB_FOR_ACTIONS_v3_3_1.md +13 -0
  23. examples/requests/robotics_humans_dna_request.json +9 -0
  24. examples/responses/robotics_humans_dna_api_response.json +202 -0
  25. openapi/openapi.yaml +156 -0
  26. openapi/primordial_os_runtime_gpt_action_openapi_v3_3_1.yaml +156 -0
  27. requirements.txt +3 -0
  28. runs/api_receipts/.gitkeep +0 -0
  29. runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/audit_log.jsonl +2 -0
  30. runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/receipt.md +31 -0
  31. runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/response.json +203 -0
  32. schemas/action_response_schema_v3_3.json +62 -0
  33. schemas/adapter_identity_schema_v3_3.json +62 -0
  34. schemas/api_key_and_access_boundary_v3_3.json +8 -0
  35. schemas/hir_x_oam_pressure_gate_contract_v3_3.json +35 -0
  36. schemas/llm_contribution_capsule_schema_v3_3.json +74 -0
  37. schemas/mesh_command_capsule_schema_v3_3.json +85 -0
  38. schemas/user_workspace_schema_v3_3.json +44 -0
  39. src/substrate_connector_core.py +244 -0
  40. validate_substrate_connector_api_v3_3_1.py +70 -0
.dockerignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.pyd
5
+ .Python
6
+ .env
7
+ .env.*
8
+ .git/
9
+ *.zip
10
+ *.sha256
11
+ runs/api_receipts/*
12
+ !runs/api_receipts/.gitkeep
.env.example ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Hugging Face Space Secret
2
+ SUBSTRATE_ACTION_KEY=replace-with-a-long-random-secret
3
+
4
+ # Optional; defaults to /data/api_receipts in Dockerfile
5
+ SUBSTRATE_RECEIPT_ROOT=/data/api_receipts
DEPLOYMENT_CHECKLIST_v3_3_1.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Deployment Checklist — v3.3.1
2
+
3
+ 1. Extract this ZIP.
4
+ 2. Create a Hugging Face Space using Docker SDK.
5
+ 3. Upload the extracted contents to the Space root.
6
+ 4. Add a Space secret named `SUBSTRATE_ACTION_KEY`.
7
+ 5. Wait for the Space to build.
8
+ 6. Test `/v1/mesh/health`.
9
+ 7. Test `/v1/mesh/command` with Bearer auth.
10
+ 8. Replace the placeholder server URL in `openapi/openapi.yaml`.
11
+ 9. Paste the edited OpenAPI schema into Primordial OS Runtime GPT Actions.
12
+ 10. Configure Action auth as Bearer with the same secret.
13
+ 11. Test in GPT Preview.
14
+
15
+ Do not publish or share the bearer secret. Do not claim production multi-user readiness from this packet alone.
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ ENV PYTHONDONTWRITEBYTECODE=1
4
+ ENV PYTHONUNBUFFERED=1
5
+ ENV SUBSTRATE_RECEIPT_ROOT=/data/api_receipts
6
+
7
+ WORKDIR /app
8
+
9
+ COPY requirements.txt /app/requirements.txt
10
+ RUN pip install --no-cache-dir -r /app/requirements.txt
11
+
12
+ COPY . /app
13
+ RUN mkdir -p /data/api_receipts
14
+
15
+ EXPOSE 7860
16
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
FINAL_LOCAL_RUN_INSTRUCTIONS_v3_3_1.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Final Local Run Instructions — v3.3.1
2
+
3
+ ## 1. Validate packet locally
4
+
5
+ ```bash
6
+ cd Substrate_Mesh_Runtime_Primordial_OS_Runtime_Connector_API_Wrapper_v3_3_1_OSF_READY
7
+ export SUBSTRATE_ACTION_KEY="test-secret-key"
8
+ python validate_substrate_connector_api_v3_3_1.py
9
+ ```
10
+
11
+ Expected:
12
+
13
+ ```text
14
+ status: PASS
15
+ pressure_spine_hir_x_oam: true
16
+ source_mutation_blocked: true
17
+ human_review_required: true
18
+ overlay_proposal_present: true
19
+ ```
20
+
21
+ ## 2. Run local API server
22
+
23
+ ```bash
24
+ export SUBSTRATE_ACTION_KEY="replace-with-a-long-random-secret"
25
+ uvicorn app:app --host 0.0.0.0 --port 7860
26
+ ```
27
+
28
+ Open:
29
+
30
+ ```text
31
+ http://localhost:7860/docs
32
+ ```
33
+
34
+ ## 3. Test command route
35
+
36
+ ```bash
37
+ curl -X POST http://localhost:7860/v1/mesh/command -H "Authorization: Bearer $SUBSTRATE_ACTION_KEY" -H "Content-Type: application/json" -d @examples/requests/robotics_humans_dna_request.json
38
+ ```
39
+
40
+ ## 4. Deploy to Hugging Face
41
+
42
+ Create a new Docker Space. Upload all files from this packet to the Space root. Add a Space secret:
43
+
44
+ ```text
45
+ SUBSTRATE_ACTION_KEY=<your long private token>
46
+ ```
47
+
48
+ Then wait for the build to finish and test:
49
+
50
+ ```text
51
+ https://YOUR-HF-SPACE.hf.space/v1/mesh/health
52
+ ```
53
+
54
+ ## 5. Connect GPT Action
55
+
56
+ Edit `openapi/openapi.yaml`, replace the server URL with the deployed Space URL, then paste the schema into the Primordial OS Runtime GPT Action panel.
README.md CHANGED
@@ -1,12 +1,81 @@
1
- ---
2
- title: Substrate Mesh Runtime Connector Api
3
- emoji: 🐨
4
- colorFrom: yellow
5
- colorTo: purple
6
- sdk: docker
7
- pinned: false
8
- license: cc-by-nc-sa-4.0
9
- short_description: Private Substrate connector API for GPT Actions
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Substrate Mesh Runtime — Primordial OS Runtime Connector API Wrapper v3.3.1
2
+
3
+ Created and developed by Collin D. Weber.
4
+ Systems Architect / Systems Integrity Steward: Collin D. Weber.
5
+
6
+ ## Purpose
7
+
8
+ This packet turns the v3.3 Primordial OS Runtime Connector contract into a deployable HTTPS API wrapper for GPT Actions.
9
+
10
+ It is intended to be deployed as a private Hugging Face Docker Space first, then connected to the existing Primordial OS Runtime GPT through the GPT Builder Action panel.
11
+
12
+ ## Boundary
13
+
14
+ - canonical source artifacts remain read-only;
15
+ - canonical Primordial Lexicon remains read-only;
16
+ - user/GPT outputs are workspace-local overlay proposals only;
17
+ - no final validation claims;
18
+ - no publication authority;
19
+ - no clinical/legal/deployment authority;
20
+ - human review remains required;
21
+ - HIR × OAM pressure receipt is preserved.
22
+
23
+ ## API routes
24
+
25
+ ```text
26
+ GET /v1/mesh/health
27
+ POST /v1/mesh/command
28
+ GET /v1/mesh/receipt/{command_id}?workspace_id=...
29
+ ```
30
+
31
+ `/v1/mesh/command` and `/v1/mesh/receipt/{command_id}` require:
32
+
33
+ ```text
34
+ Authorization: Bearer <SUBSTRATE_ACTION_KEY>
35
+ ```
36
+
37
+ ## Local test
38
+
39
+ ```bash
40
+ export SUBSTRATE_ACTION_KEY="test-secret-key"
41
+ python validate_substrate_connector_api_v3_3_1.py
42
+ ```
43
+
44
+ ## Local server
45
+
46
+ ```bash
47
+ export SUBSTRATE_ACTION_KEY="replace-with-a-long-random-secret"
48
+ uvicorn app:app --host 0.0.0.0 --port 7860
49
+ ```
50
+
51
+ Health check:
52
+
53
+ ```bash
54
+ curl http://localhost:7860/v1/mesh/health
55
+ ```
56
+
57
+ Command test:
58
+
59
+ ```bash
60
+ curl -X POST http://localhost:7860/v1/mesh/command -H "Authorization: Bearer $SUBSTRATE_ACTION_KEY" -H "Content-Type: application/json" -d @examples/requests/robotics_humans_dna_request.json
61
+ ```
62
+
63
+ ## GPT Action schema
64
+
65
+ Use:
66
+
67
+ ```text
68
+ openapi/openapi.yaml
69
+ ```
70
+
71
+ Before pasting into GPT Actions, replace:
72
+
73
+ ```text
74
+ https://YOUR-HF-SPACE.hf.space
75
+ ```
76
+
77
+ with your deployed Hugging Face Space URL.
78
+
79
+ ## Deployment posture
80
+
81
+ This packet is API-wrapper-ready. It does not deploy itself. The operator still creates the Hugging Face Docker Space, adds `SUBSTRATE_ACTION_KEY` as a Space secret, uploads these files, and then connects the schema to the Primordial OS Runtime GPT Action panel.
RELEASE_MANIFEST.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "packet_name": "Substrate_Mesh_Runtime_Primordial_OS_Runtime_Connector_API_Wrapper_v3_3_1_OSF_READY",
3
+ "version": "v3.3.1",
4
+ "created_utc": "2026-06-16T14:52:30Z",
5
+ "status": "PASS_FOR_API_WRAPPER_DEPLOYMENT_PREP",
6
+ "pressure_spine": "HIR × OAM",
7
+ "source_mutation": "NONE__OVERLAY_PROPOSAL_ONLY",
8
+ "canonical_sources": "READ_ONLY",
9
+ "canonical_lexicon": "READ_ONLY",
10
+ "human_review_required": true,
11
+ "routes": [
12
+ "GET /v1/mesh/health",
13
+ "POST /v1/mesh/command",
14
+ "GET /v1/mesh/receipt/{command_id}"
15
+ ],
16
+ "auth": "Bearer token via SUBSTRATE_ACTION_KEY",
17
+ "deployment_target": "Hugging Face Docker Space",
18
+ "validator": "PASS"
19
+ }
SHA256SUMS.txt ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ c310336476b34815955cbd0c956982757acbe004f988cac49d4427e9908008e3 .dockerignore
2
+ c1a080b7d04a9542c714f9b4992e6cf64d5d05c5f4ad721e647da0e28457c56c .env.example
3
+ d3e94da07e84f887b3c7aafe2444245bb614293ca09eddebe0ea9a2f4802709b DEPLOYMENT_CHECKLIST_v3_3_1.md
4
+ 37ee741fcd148ce6536b51170f22b31d31eaadbe4bb7363d176a5b2738b54624 Dockerfile
5
+ aab0683fc5eea5245b8fe6ab84bd461bb3f367753c2e5172279e1795c81104f0 FINAL_LOCAL_RUN_INSTRUCTIONS_v3_3_1.md
6
+ 90b8a391a3d49ae297fbea7190c528a2e49b253e91c077f338a6a4ba107efcfd README.md
7
+ 1e3383bf393665b876b24c82ba9ff0685791759b16a2c6a5a03b6539db6b579f RELEASE_MANIFEST.json
8
+ 56742ea5d8724708edf8de0e7a5fe5c56d91a56fee89a9498b8f9130f3598b42 V3_3_1_BOUNDARY_AND_CLAIMS_LIMIT.md
9
+ 11d3cd956a316817bdd8fcea95d3bc72850140f81b387363d708d3162213c99c V3_3_1_BUILD_RECEIPT.md
10
+ 18053059891f40fd60e443ac0b05dc3d13d135c8cd92fe9eda5521645b5d21a4 V3_3_1_KNOWN_LIMITATIONS.md
11
+ f4055663cffa9e7e67ca13b383ab28fa9f207b98e618e71d732735e973dee9ec V3_3_1_TEST_REPORT.md
12
+ fe2542343a2aa9810c514c2dbb53890fddfe612e55867bf8099dbb8b2cc1b60d V3_3_1_VALIDATION_RESULT.json
13
+ 7410a28a86606632b2c0f291cc983ef22fdd830f595388937cc108e5b4e50ffe app.py
14
+ a643e35bf4bcf50e066904db4d1fd252e5b163eda47319661099f5e219f6d465 cockpit_static/index.html
15
+ 3e5d54696716889cfd7759aca4639cb32d963f20f5670dbadd4fce713f071678 docs/CROSS_USER_WORKSPACE_POLICY.md
16
+ ef70885592d71a6d0861772efed17cc0f39ab4b4e30edfbfe0b8f5d0d45cde35 docs/GPT_ACTION_SETUP_STEPS_v3_3_1.md
17
+ 7db6b003ec50c6aad787abc7324ddb7c0fdb5e41ca70011c23312feb586cac57 docs/GPT_BUILDER_ACTION_SETUP_NOTES.md
18
+ b4b0074db34081de69e3e1261272c9e79ed16c54623f84caa996cc2d4a9f0623 docs/HUGGING_FACE_DOCKER_SPACE_DEPLOYMENT_STEPS.md
19
+ a447abfe3649508dee3b711ea1dacba5d3a470e9af8742efb5836542249d33a8 docs/PRIVACY_POLICY_STUB_FOR_ACTIONS.md
20
+ 1b484d01c2bece8cb2714bf208310674b9efaa04a6c4e07d64bb37d91d7b77dd docs/PRIVACY_POLICY_STUB_FOR_ACTIONS_v3_3_1.md
21
+ b6a5ca03b0dc7dea88b0235a3289d9ea86406a0045ef77e926293093447d4b22 examples/requests/robotics_humans_dna_request.json
22
+ 2246d9483db68a10f4e5d9d02750b18c877ad5f312905719a9ca0777a681de14 examples/responses/robotics_humans_dna_api_response.json
23
+ 0d7aded4454cb659206a5fe494d73235983c97959c2ad23c5f5250b0e745cfb9 openapi/openapi.yaml
24
+ 0d7aded4454cb659206a5fe494d73235983c97959c2ad23c5f5250b0e745cfb9 openapi/primordial_os_runtime_gpt_action_openapi_v3_3_1.yaml
25
+ 54a654cddb6d7d194322f5326353ebcbb21166921396e82f2e932ec7017887cc requirements.txt
26
+ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 runs/api_receipts/.gitkeep
27
+ 4d3b6a97c06e381c527e1393b287fc33b55364bf49d996f581986311db4824f7 runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/audit_log.jsonl
28
+ ae8e12f00c0f0f5316100236e0e4306267e2c18226a4a091a462f90d296ff5f5 runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/receipt.md
29
+ 22d14bba74799092361b1b722c6357c788423c42f606d2faf81070566d40ac79 runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/response.json
30
+ dd7aae79bb18a145b687845499375c2e519978ec1075cff9caec02a012c9adb8 schemas/action_response_schema_v3_3.json
31
+ 5ef8d953f7f4ea58dd476ae3fd14c4f60219dbc6ed46a4c3035ca37f67c7d30f schemas/adapter_identity_schema_v3_3.json
32
+ d7c2d6d9f5fa71f04ffec3c7dff636ee7d773d322d1187d30e060605324cf1d5 schemas/api_key_and_access_boundary_v3_3.json
33
+ 5094a4f3b3ceba83c3686d13223c45faebebd0afdfbbbaf0f4fe71a267310952 schemas/hir_x_oam_pressure_gate_contract_v3_3.json
34
+ 9325623e8d4a95008235169748bee0992b604c4083cd01c4cab2ca0e7cf30b1d schemas/llm_contribution_capsule_schema_v3_3.json
35
+ 8d71444b827821699b70399d1caff24ffe493f787143effc63e1d1ab00acb5b9 schemas/mesh_command_capsule_schema_v3_3.json
36
+ f46f0c77acce52f9ace74b8ab4b8cfa58cec95d0d39091e213fbb13bcf5de45f schemas/user_workspace_schema_v3_3.json
37
+ f6e278bb7351f49efd7a9efee621e660c2c837c3d43a1307d29e8ef81a994a25 src/substrate_connector_core.py
38
+ 68521708f21c70d05afdfffdf7936956891f452a56aceb76e70d2bb44b1ab256 validate_substrate_connector_api_v3_3_1.py
Substrate_Mesh_Runtime_Primordial_OS_Runtime_Connector_API_Wrapper_v3_3_1_OSF_READY.zip.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ e70065952438a78e8c3e9599f922da5c4e66ca42d75fdc16d7d582b6141fd11c Substrate_Mesh_Runtime_Primordial_OS_Runtime_Connector_API_Wrapper_v3_3_1_OSF_READY.zip
V3_3_1_BOUNDARY_AND_CLAIMS_LIMIT.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # v3.3.1 Boundary and Claims Limit
2
+
3
+ ## Allowed claim
4
+
5
+ v3.3.1 provides an HTTPS-ready API wrapper for routing Primordial OS Runtime GPT Action calls into a bounded Substrate connector core.
6
+
7
+ ## Not claimed
8
+
9
+ - not a public production service by itself;
10
+ - not deployed by this packet alone;
11
+ - not a live multi-user backend yet;
12
+ - not a canonical-source mutation layer;
13
+ - not a canonical Primordial Lexicon mutation layer;
14
+ - not legal, medical, clinical, or deployment authority;
15
+ - not final validation.
16
+
17
+ ## Hard boundary
18
+
19
+ Canonical artifacts and canonical lexicon remain read-only. All GPT/user outputs are workspace-local overlay proposals pending human review.
V3_3_1_BUILD_RECEIPT.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # v3.3.1 Build Receipt
2
+
3
+ Built: 2026-06-16T14:51:57Z
4
+
5
+ Packet: `Substrate_Mesh_Runtime_Primordial_OS_Runtime_Connector_API_Wrapper_v3_3_1_OSF_READY.zip`
6
+
7
+ ## Additions
8
+
9
+ - FastAPI wrapper in `app.py`
10
+ - Dockerfile for Hugging Face Docker Space
11
+ - Bearer token auth using `SUBSTRATE_ACTION_KEY`
12
+ - action-ready OpenAPI schema
13
+ - local file-backed receipt persistence
14
+ - API validator
15
+ - HF deployment instructions
16
+ - GPT Action setup instructions
17
+ - privacy policy stub
18
+
19
+ ## Boundary
20
+
21
+ - canonical source artifacts: READ_ONLY
22
+ - canonical Primordial Lexicon: READ_ONLY
23
+ - write scope: WORKSPACE_LOCAL_OVERLAY_PROPOSAL_ONLY
24
+ - pressure spine: HIR × OAM
25
+ - human review required: true
V3_3_1_KNOWN_LIMITATIONS.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # v3.3.1 Known Limitations
2
+
3
+ 1. This is an API wrapper packet, not an already-deployed service.
4
+ 2. The OpenAPI schema contains a placeholder server URL until the operator deploys the HF Docker Space.
5
+ 3. Private prototype authentication uses one Bearer token; public multi-user use will need per-user/OAuth-style isolation.
6
+ 4. Receipt storage is local file-backed; production deployment should use persistent storage with retention policy.
7
+ 5. The connector core still uses MVP topic/metadata matching rather than full semantic retrieval.
8
+ 6. Human review remains required for all overlay proposals and any downstream claim.
V3_3_1_TEST_REPORT.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # v3.3.1 Test Report
2
+
3
+ Validator command:
4
+
5
+ ```bash
6
+ python validate_substrate_connector_api_v3_3_1.py
7
+ ```
8
+
9
+ Result: `PASS`
10
+
11
+ Validated gates:
12
+
13
+ - health route returns HELD;
14
+ - unauthenticated command requests are blocked;
15
+ - authenticated mesh command succeeds;
16
+ - command returns HIR × OAM pressure spine;
17
+ - canonical source mutation remains blocked;
18
+ - human review required is true;
19
+ - workspace-local receipt is written;
20
+ - receipt fetch route works;
21
+ - overlay proposal is present;
22
+ - canonical source and lexicon boundaries are present.
23
+
24
+ See `V3_3_1_VALIDATION_RESULT.json` for machine-readable details.
V3_3_1_VALIDATION_RESULT.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "v3.3.1",
3
+ "health_ok": true,
4
+ "unauthorized_blocked": true,
5
+ "command_ok": true,
6
+ "receipt_fetch_ok": true,
7
+ "pressure_spine_hir_x_oam": true,
8
+ "source_mutation_blocked": true,
9
+ "workspace_local_receipt_written": true,
10
+ "human_review_required": true,
11
+ "overlay_proposal_present": true,
12
+ "canonical_boundary_present": true,
13
+ "status": "PASS"
14
+ }
app.py ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Substrate Mesh Runtime — Primordial OS Runtime Connector API Wrapper v3.3.1.
3
+
4
+ FastAPI HTTPS-ready wrapper for GPT Actions. Designed for Hugging Face Docker Space deployment.
5
+ Boundary: read-only canonical source/lexicon posture; workspace-local overlay proposals only.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import json
10
+ import os
11
+ import re
12
+ from datetime import datetime, timezone
13
+ from pathlib import Path
14
+ from typing import Any, Dict, List, Optional
15
+
16
+ from fastapi import Depends, FastAPI, Header, HTTPException, Request
17
+ from fastapi.middleware.cors import CORSMiddleware
18
+ from pydantic import BaseModel, Field
19
+
20
+ from src.substrate_connector_core import submit_mesh_command
21
+
22
+ APP_VERSION = "v3.3.1"
23
+ PRESSURE_SPINE = "HIR × OAM"
24
+ DEFAULT_RECEIPT_ROOT = Path(os.getenv("SUBSTRATE_RECEIPT_ROOT", "runs/api_receipts"))
25
+
26
+ app = FastAPI(
27
+ title="Substrate Mesh Runtime Connector API",
28
+ version=APP_VERSION,
29
+ description=(
30
+ "HTTPS API wrapper for Primordial OS Runtime GPT Actions. Routes bounded mesh command "
31
+ "capsules into Substrate connector responses with trace capsules, PPT element matches, "
32
+ "Primordial Periodic Alchemical Output, HIR × OAM receipts, lexicon state, audit pointers, "
33
+ "and workspace-local overlay proposals."
34
+ ),
35
+ )
36
+
37
+ # Helpful for browser/dev testing. Auth still protects command/receipt routes.
38
+ app.add_middleware(
39
+ CORSMiddleware,
40
+ allow_origins=["*"],
41
+ allow_credentials=False,
42
+ allow_methods=["GET", "POST", "OPTIONS"],
43
+ allow_headers=["Authorization", "Content-Type"],
44
+ )
45
+
46
+
47
+ def utc_now() -> str:
48
+ return datetime.now(timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z")
49
+
50
+
51
+ def safe_id(value: str, fallback: str = "workspace_local") -> str:
52
+ value = (value or fallback).strip()
53
+ cleaned = re.sub(r"[^A-Za-z0-9_\-]", "_", value)[:96]
54
+ return cleaned or fallback
55
+
56
+
57
+ def require_bearer(authorization: Optional[str] = Header(default=None)) -> str:
58
+ expected = os.getenv("SUBSTRATE_ACTION_KEY")
59
+ if not expected:
60
+ # Fail closed for deployed environments. The validator sets this env var.
61
+ raise HTTPException(status_code=500, detail="SUBSTRATE_ACTION_KEY is not configured")
62
+ if not authorization or not authorization.startswith("Bearer "):
63
+ raise HTTPException(status_code=401, detail="Missing bearer token")
64
+ token = authorization.split(" ", 1)[1].strip()
65
+ if token != expected:
66
+ raise HTTPException(status_code=403, detail="Invalid bearer token")
67
+ return "authorized"
68
+
69
+
70
+ class MeshCommand(BaseModel):
71
+ command_type: str = Field(default="DISCOVER", description="DISCOVER, BRAINSTORM, COMBINE, EXTEND_RESEARCH, OAM_READ, LEXICON_REVIEW, THREADROOM_POST")
72
+ raw_user_text: str = Field(..., min_length=1, description="Natural-language user command or threadroom post.")
73
+ workspace_id: str = Field(default="workspace_local_001", description="Workspace scope; used for isolated local receipt storage.")
74
+ session_id: str = Field(default="session_local", description="Session/user alias for contributor credit.")
75
+ target_nodes: List[str] = Field(default_factory=list)
76
+ hashtags: List[str] = Field(default_factory=list)
77
+ mention_refs: List[str] = Field(default_factory=list)
78
+ minutes_budget: float = Field(default=5.0)
79
+ claim_boundary: str = Field(default="no final validation claims; human review required")
80
+ privacy_scope: str = Field(default="PRIVATE_WORKSPACE")
81
+ source_mutation_allowed: bool = Field(default=False)
82
+
83
+
84
+ class HealthResponse(BaseModel):
85
+ status: str
86
+ version: str
87
+ pressure_spine: str
88
+ source_mutation_allowed: bool
89
+ canonical_source_posture: str
90
+ canonical_lexicon_posture: str
91
+ overlay_scope: str
92
+ human_review_required: bool
93
+ auth_configured: bool
94
+ timestamp_utc: str
95
+
96
+
97
+ def receipt_paths(workspace_id: str, command_id: str) -> Dict[str, Path]:
98
+ w = safe_id(workspace_id)
99
+ c = safe_id(command_id)
100
+ folder = DEFAULT_RECEIPT_ROOT / w / c
101
+ return {
102
+ "folder": folder,
103
+ "response": folder / "response.json",
104
+ "audit": folder / "audit_log.jsonl",
105
+ "receipt_md": folder / "receipt.md",
106
+ }
107
+
108
+
109
+ def persist_response(response: Dict[str, Any], request_meta: Dict[str, Any]) -> Dict[str, str]:
110
+ paths = receipt_paths(response.get("workspace_id", "workspace_local"), response.get("command_id", "cmd_unknown"))
111
+ paths["folder"].mkdir(parents=True, exist_ok=True)
112
+ response = dict(response)
113
+ response.setdefault("api_wrapper", {})
114
+ response["api_wrapper"].update({
115
+ "version": APP_VERSION,
116
+ "pressure_spine": PRESSURE_SPINE,
117
+ "persisted_at_utc": utc_now(),
118
+ "receipt_folder": str(paths["folder"]),
119
+ })
120
+ # Normalize visible HIR × OAM glyph even if legacy core returns HIR x OAM.
121
+ if isinstance(response.get("receipt"), dict):
122
+ response["receipt"]["pressure_spine"] = PRESSURE_SPINE
123
+ paths["response"].write_text(json.dumps(response, indent=2, ensure_ascii=False), encoding="utf-8")
124
+ audit = {
125
+ "timestamp_utc": utc_now(),
126
+ "event": "api_mesh_command_completed",
127
+ "wrapper_version": APP_VERSION,
128
+ "command_id": response.get("command_id"),
129
+ "workspace_id": response.get("workspace_id"),
130
+ "status": response.get("status"),
131
+ "pressure_spine": PRESSURE_SPINE,
132
+ "source_mutation": response.get("receipt", {}).get("source_mutation"),
133
+ "human_review_required": response.get("human_review_required"),
134
+ "request_meta": request_meta,
135
+ }
136
+ with paths["audit"].open("a", encoding="utf-8") as f:
137
+ f.write(json.dumps(audit, ensure_ascii=False) + "\n")
138
+ alch = response.get("alchemical_output", {})
139
+ receipt = response.get("receipt", {})
140
+ md = f"""# Substrate Mesh Command API Receipt
141
+
142
+ Command ID: `{response.get('command_id')}`
143
+
144
+ Workspace: `{response.get('workspace_id')}`
145
+
146
+ Status: `{response.get('status')}`
147
+
148
+ Pressure spine: `{PRESSURE_SPINE}`
149
+
150
+ Source mutation: `{receipt.get('source_mutation')}`
151
+
152
+ Human review required: `{response.get('human_review_required')}`
153
+
154
+ ## Reference Point
155
+
156
+ {alch.get('reference_point','')}
157
+
158
+ ## Continuity Read
159
+
160
+ {alch.get('continuity_read','')}
161
+
162
+ ## Strain Points
163
+
164
+ """
165
+ for item in alch.get("strain_points", []):
166
+ md += f"- {item}\n"
167
+ md += "\n## Future Routes\n\n"
168
+ for item in alch.get("future_routes", []):
169
+ md += f"- {item}\n"
170
+ paths["receipt_md"].write_text(md, encoding="utf-8")
171
+ return {"response_path": str(paths["response"]), "receipt_md_path": str(paths["receipt_md"]), "audit_log_path": str(paths["audit"])}
172
+
173
+
174
+ @app.get("/v1/mesh/health", response_model=HealthResponse, operation_id="getSubstrateHealth")
175
+ def get_substrate_health() -> HealthResponse:
176
+ return HealthResponse(
177
+ status="HELD",
178
+ version=APP_VERSION,
179
+ pressure_spine=PRESSURE_SPINE,
180
+ source_mutation_allowed=False,
181
+ canonical_source_posture="READ_ONLY",
182
+ canonical_lexicon_posture="READ_ONLY",
183
+ overlay_scope="WORKSPACE_LOCAL_OVERLAY_PROPOSAL_ONLY",
184
+ human_review_required=True,
185
+ auth_configured=bool(os.getenv("SUBSTRATE_ACTION_KEY")),
186
+ timestamp_utc=utc_now(),
187
+ )
188
+
189
+
190
+ @app.post("/v1/mesh/command", operation_id="submitMeshCommand")
191
+ def submit_command(command: MeshCommand, request: Request, _: str = Depends(require_bearer)) -> Dict[str, Any]:
192
+ if command.source_mutation_allowed:
193
+ raise HTTPException(status_code=400, detail="Canonical source mutation is not allowed by this connector")
194
+ capsule = command.model_dump()
195
+ capsule["claim_boundary"] = command.claim_boundary or "no final validation claims; human review required"
196
+ capsule["source_mutation_allowed"] = False
197
+ response = submit_mesh_command(capsule)
198
+ response.setdefault("boundary", {})
199
+ response["boundary"].update({
200
+ "canonical_sources": "READ_ONLY",
201
+ "canonical_lexicon": "READ_ONLY",
202
+ "workspace_storage": "ISOLATED_BY_WORKSPACE_ID",
203
+ "write_scope": "OVERLAY_PROPOSAL_ONLY",
204
+ "public_or_canonical_update": "NOT_ALLOWED_BY_API_WRAPPER",
205
+ "human_review_required": True,
206
+ })
207
+ request_meta = {
208
+ "client_host": getattr(request.client, "host", None),
209
+ "command_type": command.command_type,
210
+ "privacy_scope": command.privacy_scope,
211
+ "minutes_budget": command.minutes_budget,
212
+ }
213
+ paths = persist_response(response, request_meta)
214
+ response["api_receipt_paths"] = paths
215
+ return response
216
+
217
+
218
+ @app.get("/v1/mesh/receipt/{command_id}", operation_id="getMeshReceipt")
219
+ def get_receipt(command_id: str, workspace_id: str = "workspace_local_001", _: str = Depends(require_bearer)) -> Dict[str, Any]:
220
+ paths = receipt_paths(workspace_id, command_id)
221
+ if not paths["response"].exists():
222
+ raise HTTPException(status_code=404, detail="Receipt not found for command_id/workspace_id")
223
+ return json.loads(paths["response"].read_text(encoding="utf-8"))
224
+
225
+
226
+ @app.get("/", include_in_schema=False)
227
+ def root() -> Dict[str, Any]:
228
+ return {
229
+ "name": "Substrate Mesh Runtime Connector API",
230
+ "version": APP_VERSION,
231
+ "health": "/v1/mesh/health",
232
+ "docs": "/docs",
233
+ "openapi": "/openapi.json",
234
+ "boundary": "read-only canonical source/lexicon; workspace-local overlay proposals only; human review required",
235
+ }
cockpit_static/index.html ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html><head><meta charset="utf-8"><title>Substrate Connector API v3.3.1</title>
3
+ <style>body{font-family:system-ui;background:#0d1117;color:#e6edf3;margin:0;padding:32px}.card{border:1px solid #30363d;border-radius:14px;padding:18px;margin:14px 0;background:#161b22}code,pre{background:#0b1220;padding:2px 6px;border-radius:6px}.ok{color:#7ee787}</style></head>
4
+ <body>
5
+ <h1>Substrate Connector API v3.3.1</h1>
6
+ <div class="card"><b class="ok">HELD</b> — HTTPS API wrapper for Primordial OS Runtime GPT Actions.</div>
7
+ <div class="card"><h2>Routes</h2><pre>GET /v1/mesh/health
8
+ POST /v1/mesh/command
9
+ GET /v1/mesh/receipt/{command_id}</pre></div>
10
+ <div class="card"><h2>Boundary</h2><p>Canonical sources and canonical Primordial Lexicon are read-only. Outputs are workspace-local overlay proposals only. Human review required. Pressure spine: <b>HIR × OAM</b>.</p></div>
11
+ <div class="card"><h2>Next</h2><p>Deploy as Hugging Face Docker Space, set <code>SUBSTRATE_ACTION_KEY</code>, then paste <code>openapi/openapi.yaml</code> into the Primordial OS Runtime GPT Action panel.</p></div>
12
+ </body></html>
docs/CROSS_USER_WORKSPACE_POLICY.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Cross-User Workspace Policy v3.3
2
+
3
+ ## Rule
4
+
5
+ The shared Substrate mechanism is not the same thing as a shared writable source.
6
+
7
+ Each user/session/GPT route receives a workspace boundary.
8
+
9
+ ## Workspace layers
10
+
11
+ ```text
12
+ Public read layer
13
+ Private user/session workspace
14
+ Collaborative overlay proposal queue
15
+ Human-reviewed canonical update route
16
+ ```
17
+
18
+ ## Writes allowed
19
+
20
+ Allowed:
21
+
22
+ ```text
23
+ workspace output
24
+ audit logs
25
+ receipts
26
+ collaborative overlay proposals
27
+ lexicon overlay proposals
28
+ ```
29
+
30
+ Not allowed:
31
+
32
+ ```text
33
+ direct canonical artifact mutation
34
+ direct canonical Primordial Lexicon mutation
35
+ public contribution treated as accepted source
36
+ unreviewed AI output treated as closure
37
+ ```
38
+
39
+ ## Contributor credit
40
+
41
+ Every contribution capsule should preserve:
42
+
43
+ ```text
44
+ human/session contributor
45
+ AI adapter contributor
46
+ source nodes referenced
47
+ review state
48
+ write scope
49
+ receipt
50
+ ```
docs/GPT_ACTION_SETUP_STEPS_v3_3_1.md ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GPT Action Setup Steps — Primordial OS Runtime v3.3.1
2
+
3
+ 1. Open the Primordial OS Runtime GPT in the GPT Builder.
4
+ 2. Go to **Configure → Actions**.
5
+ 3. Create a new action.
6
+ 4. Authentication:
7
+ - Type: API Key
8
+ - Auth method: Bearer
9
+ - Value: the same secret stored as `SUBSTRATE_ACTION_KEY` in the HF Space.
10
+ 5. Open `openapi/openapi.yaml`.
11
+ 6. Replace `https://YOUR-HF-SPACE.hf.space` with your deployed Space URL.
12
+ 7. Paste the YAML into the action schema field.
13
+ 8. Save.
14
+ 9. Test in GPT preview:
15
+
16
+ ```text
17
+ Run a Substrate discovery command for "robotics humans DNA" in private workspace mode. Return the trace capsule, matched PPT elements, Primordial Periodic Alchemical Output, HIR × OAM receipt, overlay proposal state, and human review status.
18
+ ```
19
+
20
+ Expected:
21
+
22
+ ```text
23
+ status: HELD
24
+ pressure_spine: HIR × OAM
25
+ source_mutation: NONE__OVERLAY_PROPOSAL_ONLY
26
+ human_review_required: true
27
+ overlay proposal: present
28
+ ```
docs/GPT_BUILDER_ACTION_SETUP_NOTES.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GPT Builder Action Setup Notes v3.3
2
+
3
+ ## Intended GPT
4
+
5
+ Primordial OS Runtime GPT
6
+
7
+ ## Action purpose
8
+
9
+ Allow the GPT to submit bounded Substrate mesh commands and receive receipt-bound responses.
10
+
11
+ ## Builder fields
12
+
13
+ Use the existing Primordial OS Runtime instructions as the behavior layer. Add this action only after a real HTTPS API exists.
14
+
15
+ ## Action schema
16
+
17
+ Use:
18
+
19
+ ```text
20
+ openapi/primordial_os_runtime_gpt_action_openapi_stub.yaml
21
+ ```
22
+
23
+ ## Authentication posture
24
+
25
+ Private prototype:
26
+
27
+ ```text
28
+ API key / bearer token
29
+ ```
30
+
31
+ Public or multi-user release:
32
+
33
+ ```text
34
+ OAuth or per-user/session token
35
+ ```
36
+
37
+ Never embed a shared master key in GPT instructions, public Knowledge files, or public docs.
38
+
39
+ ## Expected operations
40
+
41
+ ```text
42
+ submitMeshCommand
43
+ getMeshReceipt
44
+ getSubstrateHealth
45
+ ```
46
+
47
+ ## GPT behavioral instruction addition
48
+
49
+ When using Substrate actions:
50
+
51
+ 1. Convert the user's request into a mesh command capsule.
52
+ 2. Preserve HIR × OAM terminology.
53
+ 3. Never claim source mutation.
54
+ 4. Never claim final validation.
55
+ 5. Return trace capsule, matched PPT elements, alchemical output, HIR × OAM receipt, overlay proposal, and human review state.
56
+ 6. If the action returns STRAINED, REPAIR_FIRST, DEFER, or MUST_STOP, preserve that state visibly.
docs/HUGGING_FACE_DOCKER_SPACE_DEPLOYMENT_STEPS.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face Docker Space Deployment Steps — v3.3.1
2
+
3
+ 1. Create a new Hugging Face Space.
4
+ 2. Choose **Docker** as the SDK.
5
+ 3. Keep it private for first testing.
6
+ 4. Upload the extracted contents of this packet to the repository root.
7
+ 5. Add Space secret:
8
+
9
+ ```text
10
+ SUBSTRATE_ACTION_KEY=<long random secret>
11
+ ```
12
+
13
+ 6. Build the Space.
14
+ 7. Open:
15
+
16
+ ```text
17
+ https://YOUR-HF-SPACE.hf.space/v1/mesh/health
18
+ ```
19
+
20
+ 8. Confirm `status` is `HELD` and `auth_configured` is `true`.
21
+ 9. Test `/v1/mesh/command` with the same Bearer token.
22
+ 10. Only after that, connect GPT Actions.
23
+
24
+ Do not place the bearer token in README, Knowledge files, OpenAPI YAML, or public code.
docs/PRIVACY_POLICY_STUB_FOR_ACTIONS.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Privacy Policy Stub for GPT Actions v3.3
2
+
3
+ This is a drafting stub for future GPT Action deployment. It is not legal advice.
4
+
5
+ ## Data handled
6
+
7
+ A Substrate connector may receive:
8
+
9
+ - user prompts submitted through Primordial OS Runtime GPT;
10
+ - selected node references and hashtags;
11
+ - workspace/session identifiers;
12
+ - command type and claim boundary;
13
+ - generated receipts and overlay proposals.
14
+
15
+ ## Data not required for MVP
16
+
17
+ - passwords;
18
+ - payment data;
19
+ - precise location;
20
+ - medical records;
21
+ - legal records;
22
+ - private third-party credentials.
23
+
24
+ ## Use
25
+
26
+ Data is used to route trace capsules, generate Substrate outputs, preserve audit receipts, and maintain workspace-local overlays.
27
+
28
+ ## Public contribution boundary
29
+
30
+ Public users do not directly mutate canonical artifacts or the canonical Primordial Lexicon.
31
+
32
+ ## Human review
33
+
34
+ Human review remains required before downstream claims, publication, canonical lexicon updates, or canonical source changes.
docs/PRIVACY_POLICY_STUB_FOR_ACTIONS_v3_3_1.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Privacy Policy Stub for Substrate Connector GPT Action — v3.3.1
2
+
3
+ This is a draft operator stub, not legal advice.
4
+
5
+ The Substrate Connector API receives user-submitted commands from the Primordial OS Runtime GPT Action. Commands may include natural-language prompts, selected node references, hashtags, workspace identifiers, and session aliases.
6
+
7
+ The API stores workspace-local receipts and overlay proposals for auditability. Canonical source artifacts and the canonical Primordial Lexicon are read-only and are not mutated by user commands.
8
+
9
+ The API does not intentionally collect passwords, payment information, medical records, legal records, or sensitive personal identifiers. Users should not submit confidential, medical, legal, or highly sensitive personal information into the prototype.
10
+
11
+ Outputs are research/discovery/route-planning artifacts only. They are not legal, medical, clinical, financial, deployment, or final-validation advice.
12
+
13
+ Human review remains required before downstream use, publication claims, public contribution, or canonical update.
examples/requests/robotics_humans_dna_request.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "command_type": "DISCOVER",
3
+ "raw_user_text": "robotics humans DNA",
4
+ "workspace_id": "workspace_local_001",
5
+ "session_id": "user_001",
6
+ "claim_boundary": "route-integrity and research planning only; no final validation claim",
7
+ "privacy_scope": "PRIVATE_WORKSPACE",
8
+ "source_mutation_allowed": false
9
+ }
examples/responses/robotics_humans_dna_api_response.json ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "status": "HELD",
3
+ "command_id": "cmd_ab4eb51792224b22",
4
+ "workspace_id": "workspace_validation_001",
5
+ "trace_capsule": {
6
+ "trace_capsule_id": "trace_68468c72ea8476b6",
7
+ "raw_user_text": "robotics humans DNA",
8
+ "topics": [
9
+ "robotics",
10
+ "humans",
11
+ "dna"
12
+ ],
13
+ "mentions": [],
14
+ "loop_state": "HELD",
15
+ "translation_route": "plain_language + PPT_elements + alchemical_output + receipt",
16
+ "source_return_required": true,
17
+ "false_closure_risk": "LOW"
18
+ },
19
+ "matched_ppt_elements": [
20
+ {
21
+ "symbol": "Rt",
22
+ "name": "Runtime Trail / Robot Day Loop",
23
+ "family": "Observation / Translation",
24
+ "node_ref": "@node:robot_day_loop",
25
+ "rank": 1,
26
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
27
+ "source_return_state": "REFERENCE_BOUND",
28
+ "pressure_spine": "HIR x OAM"
29
+ },
30
+ {
31
+ "symbol": "Rg",
32
+ "name": "Resonant Ingress / Robotics Pressure Gyro",
33
+ "family": "Runtime Engines",
34
+ "node_ref": "@node:resonant_ingress",
35
+ "rank": 2,
36
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
37
+ "source_return_state": "REFERENCE_BOUND",
38
+ "pressure_spine": "HIR x OAM"
39
+ },
40
+ {
41
+ "symbol": "Rd",
42
+ "name": "Robotic Correction Loop",
43
+ "family": "Research Substrate",
44
+ "node_ref": "@node:robotic_correction_loop",
45
+ "rank": 3,
46
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
47
+ "source_return_state": "REFERENCE_BOUND",
48
+ "pressure_spine": "HIR x OAM"
49
+ },
50
+ {
51
+ "symbol": "CTL",
52
+ "name": "Cognition Translation Layer",
53
+ "family": "Observation / Translation",
54
+ "node_ref": "@node:cognition_translation_layer",
55
+ "rank": 4,
56
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
57
+ "source_return_state": "REFERENCE_BOUND",
58
+ "pressure_spine": "HIR x OAM"
59
+ },
60
+ {
61
+ "symbol": "HIR",
62
+ "name": "Honesty / Integrity / Respect",
63
+ "family": "Core Laws",
64
+ "node_ref": "@node:hir_spine",
65
+ "rank": 5,
66
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
67
+ "source_return_state": "REFERENCE_BOUND",
68
+ "pressure_spine": "HIR x OAM"
69
+ },
70
+ {
71
+ "symbol": "RAM",
72
+ "name": "Resonant Access Memory",
73
+ "family": "Runtime / Memory",
74
+ "node_ref": "@node:resonant_access_memory",
75
+ "rank": 6,
76
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
77
+ "source_return_state": "REFERENCE_BOUND",
78
+ "pressure_spine": "HIR x OAM"
79
+ },
80
+ {
81
+ "symbol": "DL",
82
+ "name": "Digital Life Candidate Architecture",
83
+ "family": "Research Substrate",
84
+ "node_ref": "@node:digital_life_candidate_architecture",
85
+ "rank": 7,
86
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
87
+ "source_return_state": "REFERENCE_BOUND",
88
+ "pressure_spine": "HIR x OAM"
89
+ },
90
+ {
91
+ "symbol": "CTE",
92
+ "name": "Cryptobiotic Trace Encapsulation",
93
+ "family": "Safety / Governance",
94
+ "node_ref": "@node:cryptobiotic_trace_encapsulation",
95
+ "rank": 8,
96
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
97
+ "source_return_state": "REFERENCE_BOUND",
98
+ "pressure_spine": "HIR x OAM"
99
+ },
100
+ {
101
+ "symbol": "SR",
102
+ "name": "Source Return / Provenance Bundle",
103
+ "family": "Source / Provenance",
104
+ "node_ref": "@node:source_return",
105
+ "rank": 9,
106
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
107
+ "source_return_state": "REFERENCE_BOUND",
108
+ "pressure_spine": "HIR x OAM"
109
+ }
110
+ ],
111
+ "alchemical_output": {
112
+ "panel_name": "Primordial Periodic Alchemical Output",
113
+ "reference_point": "This route explores how embodied correction, human cognition/agency, and biological-substrate or encoding concepts may share bounded sensing, repair, memory, and continuity patterns.",
114
+ "selected_element_names": [
115
+ "Runtime Trail / Robot Day Loop",
116
+ "Resonant Ingress / Robotics Pressure Gyro",
117
+ "Robotic Correction Loop",
118
+ "Cognition Translation Layer",
119
+ "Honesty / Integrity / Respect",
120
+ "Resonant Access Memory",
121
+ "Digital Life Candidate Architecture",
122
+ "Cryptobiotic Trace Encapsulation",
123
+ "Source Return / Provenance Bundle"
124
+ ],
125
+ "continuity_read": "HELD as a route proposal when treated as source-return, overlay-only collaborative synthesis.",
126
+ "strain_points": [
127
+ "DNA-related language must remain a bounded computational/structural comparison unless domain evidence is introduced."
128
+ ],
129
+ "repair_notes": [
130
+ "Preserve HIR x OAM terminology.",
131
+ "Write proposals as overlays, not canonical source mutation."
132
+ ],
133
+ "future_routes": [
134
+ "Build a test capsule comparing robotic correction loops, human learning loops, and biological repair/encoding loops under the HIR x OAM pressure spine.",
135
+ "Ask the Primordial OS Runtime steward to propose next prompt options.",
136
+ "Create a lexicon review packet for any new terms introduced."
137
+ ],
138
+ "claim_boundary": "route-integrity and research planning only; no final validation claim"
139
+ },
140
+ "lexicon_state": {
141
+ "active_terms": [
142
+ "trace capsule",
143
+ "source-return",
144
+ "HIR x OAM",
145
+ "Primordial Periodic Table",
146
+ "Resonant Access Memory",
147
+ "collaborative overlay"
148
+ ],
149
+ "candidate_terms": [
150
+ "Primordial Periodic Alchemical Output"
151
+ ],
152
+ "review_required": true
153
+ },
154
+ "receipt": {
155
+ "status": "HELD",
156
+ "H": 1.0,
157
+ "I": 1.0,
158
+ "R": 1.0,
159
+ "A": 1.0,
160
+ "P": 0.0,
161
+ "S_effective": 1.0,
162
+ "pressure_spine": "HIR × OAM",
163
+ "source_mutation": "NONE__OVERLAY_PROPOSAL_ONLY",
164
+ "human_review_required": true,
165
+ "matched_element_count": 9,
166
+ "claim_limit": "trace capsule / alchemical continuity route; not final validation"
167
+ },
168
+ "audit_pointer": "workspaces/workspace_validation_001/audit/cmd_ab4eb51792224b22.json",
169
+ "overlay_proposals": [
170
+ {
171
+ "overlay_id": "overlay_c265f48844843c44",
172
+ "write_scope": "COLLABORATIVE_OVERLAY_PROPOSAL_ONLY",
173
+ "status": "PENDING_HUMAN_REVIEW",
174
+ "summary": "This route explores how embodied correction, human cognition/agency, and biological-substrate or encoding concepts may share bounded sensing, repair, memory, and continuity patterns.",
175
+ "source_mutation": "NONE",
176
+ "credited_contributors": [
177
+ {
178
+ "type": "human_or_session",
179
+ "id": "user_001"
180
+ },
181
+ {
182
+ "type": "ai_adapter",
183
+ "id": "primordial_os_runtime"
184
+ }
185
+ ]
186
+ }
187
+ ],
188
+ "human_review_required": true,
189
+ "boundary": {
190
+ "canonical_sources": "READ_ONLY",
191
+ "canonical_lexicon": "READ_ONLY",
192
+ "workspace_storage": "ISOLATED_BY_WORKSPACE_ID",
193
+ "write_scope": "OVERLAY_PROPOSAL_ONLY",
194
+ "public_or_canonical_update": "NOT_ALLOWED_BY_API_WRAPPER",
195
+ "human_review_required": true
196
+ },
197
+ "api_receipt_paths": {
198
+ "response_path": "runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/response.json",
199
+ "receipt_md_path": "runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/receipt.md",
200
+ "audit_log_path": "runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/audit_log.jsonl"
201
+ }
202
+ }
openapi/openapi.yaml ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Substrate Mesh Runtime Connector API
4
+ version: 3.3.1
5
+ description: >
6
+ GPT Action schema for Primordial OS Runtime. Routes bounded mesh commands into
7
+ Substrate trace capsules, Primordial Periodic Table references, Primordial Periodic
8
+ Alchemical Output, HIR × OAM receipts, lexicon state, workspace-local overlay
9
+ proposals, and audit receipts. Canonical sources and the canonical Primordial
10
+ Lexicon remain read-only.
11
+ servers:
12
+ - url: https://YOUR-HF-SPACE.hf.space
13
+ description: Replace with deployed Hugging Face Docker Space URL.
14
+ paths:
15
+ /v1/mesh/health:
16
+ get:
17
+ operationId: getSubstrateHealth
18
+ summary: Check Substrate connector health and boundary posture
19
+ responses:
20
+ '200':
21
+ description: Health and boundary posture
22
+ content:
23
+ application/json:
24
+ schema:
25
+ type: object
26
+ properties:
27
+ status: { type: string }
28
+ version: { type: string }
29
+ pressure_spine: { type: string }
30
+ source_mutation_allowed: { type: boolean }
31
+ canonical_source_posture: { type: string }
32
+ canonical_lexicon_posture: { type: string }
33
+ overlay_scope: { type: string }
34
+ human_review_required: { type: boolean }
35
+ auth_configured: { type: boolean }
36
+ timestamp_utc: { type: string }
37
+ /v1/mesh/command:
38
+ post:
39
+ operationId: submitMeshCommand
40
+ summary: Submit a bounded Substrate mesh command capsule
41
+ description: >
42
+ Converts a user command or threadroom post into a trace capsule, resolves PPT
43
+ elements, returns alchemical output, applies HIR × OAM receipt boundaries, and
44
+ stores a workspace-local receipt. This endpoint never mutates canonical source
45
+ artifacts or the canonical Primordial Lexicon.
46
+ security:
47
+ - BearerAuth: []
48
+ requestBody:
49
+ required: true
50
+ content:
51
+ application/json:
52
+ schema:
53
+ $ref: '#/components/schemas/MeshCommand'
54
+ responses:
55
+ '200':
56
+ description: Receipt-bound Substrate response
57
+ content:
58
+ application/json:
59
+ schema:
60
+ $ref: '#/components/schemas/MeshCommandResponse'
61
+ '400': { description: Boundary or validation error }
62
+ '401': { description: Missing bearer token }
63
+ '403': { description: Invalid bearer token }
64
+ /v1/mesh/receipt/{command_id}:
65
+ get:
66
+ operationId: getMeshReceipt
67
+ summary: Fetch a stored mesh command receipt
68
+ security:
69
+ - BearerAuth: []
70
+ parameters:
71
+ - name: command_id
72
+ in: path
73
+ required: true
74
+ schema: { type: string }
75
+ - name: workspace_id
76
+ in: query
77
+ required: false
78
+ schema:
79
+ type: string
80
+ default: workspace_local_001
81
+ responses:
82
+ '200':
83
+ description: Stored response/receipt for command_id + workspace_id
84
+ content:
85
+ application/json:
86
+ schema:
87
+ $ref: '#/components/schemas/MeshCommandResponse'
88
+ '404': { description: Receipt not found }
89
+ components:
90
+ securitySchemes:
91
+ BearerAuth:
92
+ type: http
93
+ scheme: bearer
94
+ schemas:
95
+ MeshCommand:
96
+ type: object
97
+ required: [raw_user_text]
98
+ properties:
99
+ command_type:
100
+ type: string
101
+ enum: [DISCOVER, BRAINSTORM, COMBINE, EXTEND_RESEARCH, OAM_READ, LEXICON_REVIEW, THREADROOM_POST]
102
+ default: DISCOVER
103
+ raw_user_text:
104
+ type: string
105
+ description: Natural-language user command or threadroom post.
106
+ workspace_id:
107
+ type: string
108
+ default: workspace_local_001
109
+ description: Isolated workspace/session scope for receipts and overlays.
110
+ session_id:
111
+ type: string
112
+ default: session_local
113
+ target_nodes:
114
+ type: array
115
+ items: { type: string }
116
+ hashtags:
117
+ type: array
118
+ items: { type: string }
119
+ mention_refs:
120
+ type: array
121
+ items: { type: string }
122
+ minutes_budget:
123
+ type: number
124
+ default: 5
125
+ claim_boundary:
126
+ type: string
127
+ default: no final validation claims; human review required
128
+ privacy_scope:
129
+ type: string
130
+ enum: [PRIVATE_WORKSPACE, CONTROLLED_LINK, PUBLIC_READ_ONLY, PUBLIC_CONTRIBUTION_QUEUE]
131
+ default: PRIVATE_WORKSPACE
132
+ source_mutation_allowed:
133
+ type: boolean
134
+ default: false
135
+ description: Must remain false. Canonical source mutation is blocked.
136
+ MeshCommandResponse:
137
+ type: object
138
+ required: [status, command_id, workspace_id, trace_capsule, receipt, human_review_required]
139
+ properties:
140
+ status: { type: string }
141
+ command_id: { type: string }
142
+ workspace_id: { type: string }
143
+ trace_capsule: { type: object }
144
+ matched_ppt_elements:
145
+ type: array
146
+ items: { type: object }
147
+ alchemical_output: { type: object }
148
+ lexicon_state: { type: object }
149
+ receipt: { type: object }
150
+ boundary: { type: object }
151
+ audit_pointer: { type: string }
152
+ api_receipt_paths: { type: object }
153
+ overlay_proposals:
154
+ type: array
155
+ items: { type: object }
156
+ human_review_required: { type: boolean }
openapi/primordial_os_runtime_gpt_action_openapi_v3_3_1.yaml ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Substrate Mesh Runtime Connector API
4
+ version: 3.3.1
5
+ description: >
6
+ GPT Action schema for Primordial OS Runtime. Routes bounded mesh commands into
7
+ Substrate trace capsules, Primordial Periodic Table references, Primordial Periodic
8
+ Alchemical Output, HIR × OAM receipts, lexicon state, workspace-local overlay
9
+ proposals, and audit receipts. Canonical sources and the canonical Primordial
10
+ Lexicon remain read-only.
11
+ servers:
12
+ - url: https://YOUR-HF-SPACE.hf.space
13
+ description: Replace with deployed Hugging Face Docker Space URL.
14
+ paths:
15
+ /v1/mesh/health:
16
+ get:
17
+ operationId: getSubstrateHealth
18
+ summary: Check Substrate connector health and boundary posture
19
+ responses:
20
+ '200':
21
+ description: Health and boundary posture
22
+ content:
23
+ application/json:
24
+ schema:
25
+ type: object
26
+ properties:
27
+ status: { type: string }
28
+ version: { type: string }
29
+ pressure_spine: { type: string }
30
+ source_mutation_allowed: { type: boolean }
31
+ canonical_source_posture: { type: string }
32
+ canonical_lexicon_posture: { type: string }
33
+ overlay_scope: { type: string }
34
+ human_review_required: { type: boolean }
35
+ auth_configured: { type: boolean }
36
+ timestamp_utc: { type: string }
37
+ /v1/mesh/command:
38
+ post:
39
+ operationId: submitMeshCommand
40
+ summary: Submit a bounded Substrate mesh command capsule
41
+ description: >
42
+ Converts a user command or threadroom post into a trace capsule, resolves PPT
43
+ elements, returns alchemical output, applies HIR × OAM receipt boundaries, and
44
+ stores a workspace-local receipt. This endpoint never mutates canonical source
45
+ artifacts or the canonical Primordial Lexicon.
46
+ security:
47
+ - BearerAuth: []
48
+ requestBody:
49
+ required: true
50
+ content:
51
+ application/json:
52
+ schema:
53
+ $ref: '#/components/schemas/MeshCommand'
54
+ responses:
55
+ '200':
56
+ description: Receipt-bound Substrate response
57
+ content:
58
+ application/json:
59
+ schema:
60
+ $ref: '#/components/schemas/MeshCommandResponse'
61
+ '400': { description: Boundary or validation error }
62
+ '401': { description: Missing bearer token }
63
+ '403': { description: Invalid bearer token }
64
+ /v1/mesh/receipt/{command_id}:
65
+ get:
66
+ operationId: getMeshReceipt
67
+ summary: Fetch a stored mesh command receipt
68
+ security:
69
+ - BearerAuth: []
70
+ parameters:
71
+ - name: command_id
72
+ in: path
73
+ required: true
74
+ schema: { type: string }
75
+ - name: workspace_id
76
+ in: query
77
+ required: false
78
+ schema:
79
+ type: string
80
+ default: workspace_local_001
81
+ responses:
82
+ '200':
83
+ description: Stored response/receipt for command_id + workspace_id
84
+ content:
85
+ application/json:
86
+ schema:
87
+ $ref: '#/components/schemas/MeshCommandResponse'
88
+ '404': { description: Receipt not found }
89
+ components:
90
+ securitySchemes:
91
+ BearerAuth:
92
+ type: http
93
+ scheme: bearer
94
+ schemas:
95
+ MeshCommand:
96
+ type: object
97
+ required: [raw_user_text]
98
+ properties:
99
+ command_type:
100
+ type: string
101
+ enum: [DISCOVER, BRAINSTORM, COMBINE, EXTEND_RESEARCH, OAM_READ, LEXICON_REVIEW, THREADROOM_POST]
102
+ default: DISCOVER
103
+ raw_user_text:
104
+ type: string
105
+ description: Natural-language user command or threadroom post.
106
+ workspace_id:
107
+ type: string
108
+ default: workspace_local_001
109
+ description: Isolated workspace/session scope for receipts and overlays.
110
+ session_id:
111
+ type: string
112
+ default: session_local
113
+ target_nodes:
114
+ type: array
115
+ items: { type: string }
116
+ hashtags:
117
+ type: array
118
+ items: { type: string }
119
+ mention_refs:
120
+ type: array
121
+ items: { type: string }
122
+ minutes_budget:
123
+ type: number
124
+ default: 5
125
+ claim_boundary:
126
+ type: string
127
+ default: no final validation claims; human review required
128
+ privacy_scope:
129
+ type: string
130
+ enum: [PRIVATE_WORKSPACE, CONTROLLED_LINK, PUBLIC_READ_ONLY, PUBLIC_CONTRIBUTION_QUEUE]
131
+ default: PRIVATE_WORKSPACE
132
+ source_mutation_allowed:
133
+ type: boolean
134
+ default: false
135
+ description: Must remain false. Canonical source mutation is blocked.
136
+ MeshCommandResponse:
137
+ type: object
138
+ required: [status, command_id, workspace_id, trace_capsule, receipt, human_review_required]
139
+ properties:
140
+ status: { type: string }
141
+ command_id: { type: string }
142
+ workspace_id: { type: string }
143
+ trace_capsule: { type: object }
144
+ matched_ppt_elements:
145
+ type: array
146
+ items: { type: object }
147
+ alchemical_output: { type: object }
148
+ lexicon_state: { type: object }
149
+ receipt: { type: object }
150
+ boundary: { type: object }
151
+ audit_pointer: { type: string }
152
+ api_receipt_paths: { type: object }
153
+ overlay_proposals:
154
+ type: array
155
+ items: { type: object }
156
+ human_review_required: { type: boolean }
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fastapi==0.128.2
2
+ uvicorn[standard]==0.38.0
3
+ pydantic==2.12.5
runs/api_receipts/.gitkeep ADDED
File without changes
runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/audit_log.jsonl ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ {"timestamp_utc": "2026-06-16T14:51:59Z", "event": "api_mesh_command_completed", "wrapper_version": "v3.3.1", "command_id": "cmd_ab4eb51792224b22", "workspace_id": "workspace_validation_001", "status": "HELD", "pressure_spine": "HIR × OAM", "source_mutation": "NONE__OVERLAY_PROPOSAL_ONLY", "human_review_required": true, "request_meta": {"client_host": "testclient", "command_type": "DISCOVER", "privacy_scope": "PRIVATE_WORKSPACE", "minutes_budget": 5.0}}
2
+ {"timestamp_utc": "2026-06-16T14:52:09Z", "event": "api_mesh_command_completed", "wrapper_version": "v3.3.1", "command_id": "cmd_ab4eb51792224b22", "workspace_id": "workspace_validation_001", "status": "HELD", "pressure_spine": "HIR × OAM", "source_mutation": "NONE__OVERLAY_PROPOSAL_ONLY", "human_review_required": true, "request_meta": {"client_host": "testclient", "command_type": "DISCOVER", "privacy_scope": "PRIVATE_WORKSPACE", "minutes_budget": 5.0}}
runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/receipt.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Substrate Mesh Command API Receipt
2
+
3
+ Command ID: `cmd_ab4eb51792224b22`
4
+
5
+ Workspace: `workspace_validation_001`
6
+
7
+ Status: `HELD`
8
+
9
+ Pressure spine: `HIR × OAM`
10
+
11
+ Source mutation: `NONE__OVERLAY_PROPOSAL_ONLY`
12
+
13
+ Human review required: `True`
14
+
15
+ ## Reference Point
16
+
17
+ This route explores how embodied correction, human cognition/agency, and biological-substrate or encoding concepts may share bounded sensing, repair, memory, and continuity patterns.
18
+
19
+ ## Continuity Read
20
+
21
+ HELD as a route proposal when treated as source-return, overlay-only collaborative synthesis.
22
+
23
+ ## Strain Points
24
+
25
+ - DNA-related language must remain a bounded computational/structural comparison unless domain evidence is introduced.
26
+
27
+ ## Future Routes
28
+
29
+ - Build a test capsule comparing robotic correction loops, human learning loops, and biological repair/encoding loops under the HIR x OAM pressure spine.
30
+ - Ask the Primordial OS Runtime steward to propose next prompt options.
31
+ - Create a lexicon review packet for any new terms introduced.
runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22/response.json ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "status": "HELD",
3
+ "command_id": "cmd_ab4eb51792224b22",
4
+ "workspace_id": "workspace_validation_001",
5
+ "trace_capsule": {
6
+ "trace_capsule_id": "trace_68468c72ea8476b6",
7
+ "raw_user_text": "robotics humans DNA",
8
+ "topics": [
9
+ "robotics",
10
+ "humans",
11
+ "dna"
12
+ ],
13
+ "mentions": [],
14
+ "loop_state": "HELD",
15
+ "translation_route": "plain_language + PPT_elements + alchemical_output + receipt",
16
+ "source_return_required": true,
17
+ "false_closure_risk": "LOW"
18
+ },
19
+ "matched_ppt_elements": [
20
+ {
21
+ "symbol": "Rt",
22
+ "name": "Runtime Trail / Robot Day Loop",
23
+ "family": "Observation / Translation",
24
+ "node_ref": "@node:robot_day_loop",
25
+ "rank": 1,
26
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
27
+ "source_return_state": "REFERENCE_BOUND",
28
+ "pressure_spine": "HIR x OAM"
29
+ },
30
+ {
31
+ "symbol": "Rg",
32
+ "name": "Resonant Ingress / Robotics Pressure Gyro",
33
+ "family": "Runtime Engines",
34
+ "node_ref": "@node:resonant_ingress",
35
+ "rank": 2,
36
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
37
+ "source_return_state": "REFERENCE_BOUND",
38
+ "pressure_spine": "HIR x OAM"
39
+ },
40
+ {
41
+ "symbol": "Rd",
42
+ "name": "Robotic Correction Loop",
43
+ "family": "Research Substrate",
44
+ "node_ref": "@node:robotic_correction_loop",
45
+ "rank": 3,
46
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
47
+ "source_return_state": "REFERENCE_BOUND",
48
+ "pressure_spine": "HIR x OAM"
49
+ },
50
+ {
51
+ "symbol": "CTL",
52
+ "name": "Cognition Translation Layer",
53
+ "family": "Observation / Translation",
54
+ "node_ref": "@node:cognition_translation_layer",
55
+ "rank": 4,
56
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
57
+ "source_return_state": "REFERENCE_BOUND",
58
+ "pressure_spine": "HIR x OAM"
59
+ },
60
+ {
61
+ "symbol": "HIR",
62
+ "name": "Honesty / Integrity / Respect",
63
+ "family": "Core Laws",
64
+ "node_ref": "@node:hir_spine",
65
+ "rank": 5,
66
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
67
+ "source_return_state": "REFERENCE_BOUND",
68
+ "pressure_spine": "HIR x OAM"
69
+ },
70
+ {
71
+ "symbol": "RAM",
72
+ "name": "Resonant Access Memory",
73
+ "family": "Runtime / Memory",
74
+ "node_ref": "@node:resonant_access_memory",
75
+ "rank": 6,
76
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
77
+ "source_return_state": "REFERENCE_BOUND",
78
+ "pressure_spine": "HIR x OAM"
79
+ },
80
+ {
81
+ "symbol": "DL",
82
+ "name": "Digital Life Candidate Architecture",
83
+ "family": "Research Substrate",
84
+ "node_ref": "@node:digital_life_candidate_architecture",
85
+ "rank": 7,
86
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
87
+ "source_return_state": "REFERENCE_BOUND",
88
+ "pressure_spine": "HIR x OAM"
89
+ },
90
+ {
91
+ "symbol": "CTE",
92
+ "name": "Cryptobiotic Trace Encapsulation",
93
+ "family": "Safety / Governance",
94
+ "node_ref": "@node:cryptobiotic_trace_encapsulation",
95
+ "rank": 8,
96
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
97
+ "source_return_state": "REFERENCE_BOUND",
98
+ "pressure_spine": "HIR x OAM"
99
+ },
100
+ {
101
+ "symbol": "SR",
102
+ "name": "Source Return / Provenance Bundle",
103
+ "family": "Source / Provenance",
104
+ "node_ref": "@node:source_return",
105
+ "rank": 9,
106
+ "match_reason": "Matched topic/mention route; resolved as PPT element for bounded synthesis.",
107
+ "source_return_state": "REFERENCE_BOUND",
108
+ "pressure_spine": "HIR x OAM"
109
+ }
110
+ ],
111
+ "alchemical_output": {
112
+ "panel_name": "Primordial Periodic Alchemical Output",
113
+ "reference_point": "This route explores how embodied correction, human cognition/agency, and biological-substrate or encoding concepts may share bounded sensing, repair, memory, and continuity patterns.",
114
+ "selected_element_names": [
115
+ "Runtime Trail / Robot Day Loop",
116
+ "Resonant Ingress / Robotics Pressure Gyro",
117
+ "Robotic Correction Loop",
118
+ "Cognition Translation Layer",
119
+ "Honesty / Integrity / Respect",
120
+ "Resonant Access Memory",
121
+ "Digital Life Candidate Architecture",
122
+ "Cryptobiotic Trace Encapsulation",
123
+ "Source Return / Provenance Bundle"
124
+ ],
125
+ "continuity_read": "HELD as a route proposal when treated as source-return, overlay-only collaborative synthesis.",
126
+ "strain_points": [
127
+ "DNA-related language must remain a bounded computational/structural comparison unless domain evidence is introduced."
128
+ ],
129
+ "repair_notes": [
130
+ "Preserve HIR x OAM terminology.",
131
+ "Write proposals as overlays, not canonical source mutation."
132
+ ],
133
+ "future_routes": [
134
+ "Build a test capsule comparing robotic correction loops, human learning loops, and biological repair/encoding loops under the HIR x OAM pressure spine.",
135
+ "Ask the Primordial OS Runtime steward to propose next prompt options.",
136
+ "Create a lexicon review packet for any new terms introduced."
137
+ ],
138
+ "claim_boundary": "route-integrity and research planning only; no final validation claim"
139
+ },
140
+ "lexicon_state": {
141
+ "active_terms": [
142
+ "trace capsule",
143
+ "source-return",
144
+ "HIR x OAM",
145
+ "Primordial Periodic Table",
146
+ "Resonant Access Memory",
147
+ "collaborative overlay"
148
+ ],
149
+ "candidate_terms": [
150
+ "Primordial Periodic Alchemical Output"
151
+ ],
152
+ "review_required": true
153
+ },
154
+ "receipt": {
155
+ "status": "HELD",
156
+ "H": 1.0,
157
+ "I": 1.0,
158
+ "R": 1.0,
159
+ "A": 1.0,
160
+ "P": 0.0,
161
+ "S_effective": 1.0,
162
+ "pressure_spine": "HIR × OAM",
163
+ "source_mutation": "NONE__OVERLAY_PROPOSAL_ONLY",
164
+ "human_review_required": true,
165
+ "matched_element_count": 9,
166
+ "claim_limit": "trace capsule / alchemical continuity route; not final validation"
167
+ },
168
+ "audit_pointer": "workspaces/workspace_validation_001/audit/cmd_ab4eb51792224b22.json",
169
+ "overlay_proposals": [
170
+ {
171
+ "overlay_id": "overlay_c265f48844843c44",
172
+ "write_scope": "COLLABORATIVE_OVERLAY_PROPOSAL_ONLY",
173
+ "status": "PENDING_HUMAN_REVIEW",
174
+ "summary": "This route explores how embodied correction, human cognition/agency, and biological-substrate or encoding concepts may share bounded sensing, repair, memory, and continuity patterns.",
175
+ "source_mutation": "NONE",
176
+ "credited_contributors": [
177
+ {
178
+ "type": "human_or_session",
179
+ "id": "user_001"
180
+ },
181
+ {
182
+ "type": "ai_adapter",
183
+ "id": "primordial_os_runtime"
184
+ }
185
+ ]
186
+ }
187
+ ],
188
+ "human_review_required": true,
189
+ "boundary": {
190
+ "canonical_sources": "READ_ONLY",
191
+ "canonical_lexicon": "READ_ONLY",
192
+ "workspace_storage": "ISOLATED_BY_WORKSPACE_ID",
193
+ "write_scope": "OVERLAY_PROPOSAL_ONLY",
194
+ "public_or_canonical_update": "NOT_ALLOWED_BY_API_WRAPPER",
195
+ "human_review_required": true
196
+ },
197
+ "api_wrapper": {
198
+ "version": "v3.3.1",
199
+ "pressure_spine": "HIR × OAM",
200
+ "persisted_at_utc": "2026-06-16T14:52:09Z",
201
+ "receipt_folder": "runs/api_receipts/workspace_validation_001/cmd_ab4eb51792224b22"
202
+ }
203
+ }
schemas/action_response_schema_v3_3.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://primordial.local/schemas/action_response_schema_v3_3.json",
4
+ "title": "Substrate Action Response Schema v3.3",
5
+ "type": "object",
6
+ "required": [
7
+ "status",
8
+ "command_id",
9
+ "workspace_id",
10
+ "trace_capsule",
11
+ "receipt",
12
+ "human_review_required"
13
+ ],
14
+ "properties": {
15
+ "status": {
16
+ "enum": [
17
+ "HELD",
18
+ "STRAINED",
19
+ "REPAIR_FIRST",
20
+ "DEFER",
21
+ "MUST_STOP",
22
+ "ERROR"
23
+ ]
24
+ },
25
+ "command_id": {
26
+ "type": "string"
27
+ },
28
+ "workspace_id": {
29
+ "type": "string"
30
+ },
31
+ "trace_capsule": {
32
+ "type": "object"
33
+ },
34
+ "matched_ppt_elements": {
35
+ "type": "array",
36
+ "items": {
37
+ "type": "object"
38
+ }
39
+ },
40
+ "alchemical_output": {
41
+ "type": "object"
42
+ },
43
+ "lexicon_state": {
44
+ "type": "object"
45
+ },
46
+ "receipt": {
47
+ "type": "object"
48
+ },
49
+ "audit_pointer": {
50
+ "type": "string"
51
+ },
52
+ "overlay_proposals": {
53
+ "type": "array",
54
+ "items": {
55
+ "type": "object"
56
+ }
57
+ },
58
+ "human_review_required": {
59
+ "type": "boolean"
60
+ }
61
+ }
62
+ }
schemas/adapter_identity_schema_v3_3.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://primordial.local/schemas/adapter_identity_schema_v3_3.json",
4
+ "title": "Adapter Identity Schema v3.3",
5
+ "type": "object",
6
+ "required": [
7
+ "adapter_id",
8
+ "adapter_type",
9
+ "display_name",
10
+ "roles",
11
+ "write_scope",
12
+ "authority_boundary"
13
+ ],
14
+ "properties": {
15
+ "adapter_id": {
16
+ "type": "string",
17
+ "pattern": "^[a-z0-9_\\-]+$"
18
+ },
19
+ "adapter_type": {
20
+ "enum": [
21
+ "GPT_RUNTIME_STEWARD",
22
+ "EXTERNAL_LLM",
23
+ "LOCAL_MODEL",
24
+ "HUMAN_USER",
25
+ "SYSTEM_GATE",
26
+ "MESH_ENGINE"
27
+ ]
28
+ },
29
+ "display_name": {
30
+ "type": "string"
31
+ },
32
+ "roles": {
33
+ "type": "array",
34
+ "items": {
35
+ "type": "string"
36
+ }
37
+ },
38
+ "model_or_runtime": {
39
+ "type": "string"
40
+ },
41
+ "write_scope": {
42
+ "enum": [
43
+ "READ_ONLY",
44
+ "OVERLAY_PROPOSAL_ONLY",
45
+ "WORKSPACE_ONLY",
46
+ "REVIEWED_CANONICAL_UPDATE_ONLY"
47
+ ]
48
+ },
49
+ "authority_boundary": {
50
+ "type": "array",
51
+ "items": {
52
+ "type": "string"
53
+ }
54
+ },
55
+ "human_review_required": {
56
+ "type": "boolean"
57
+ },
58
+ "source_mutation_allowed": {
59
+ "const": false
60
+ }
61
+ }
62
+ }
schemas/api_key_and_access_boundary_v3_3.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "title": "API Key / Access Boundary v3.3",
3
+ "public_gpt_rule": "Do not embed shared master keys into public GPT instructions or knowledge files.",
4
+ "prototype": "API key can be used for private server-to-server prototype only.",
5
+ "public_multi_user": "Use OAuth or per-user/session tokens before public multi-user access.",
6
+ "workspace_isolation": "Every action call must include or derive a workspace/session boundary.",
7
+ "contribution_policy": "Public users can create workspace overlays and contribution proposals, not canonical source mutations."
8
+ }
schemas/hir_x_oam_pressure_gate_contract_v3_3.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "title": "HIR x OAM Pressure Gate Contract v3.3",
3
+ "status_values": [
4
+ "HELD",
5
+ "STRAINED",
6
+ "REPAIR_FIRST",
7
+ "DEFER",
8
+ "MUST_STOP"
9
+ ],
10
+ "inputs": [
11
+ "trace_capsule",
12
+ "matched_nodes",
13
+ "contribution_capsules",
14
+ "claim_boundary",
15
+ "source_return_state"
16
+ ],
17
+ "outputs": [
18
+ "H",
19
+ "I",
20
+ "R",
21
+ "A",
22
+ "P",
23
+ "S_effective",
24
+ "status",
25
+ "repair_notes",
26
+ "claim_limit",
27
+ "human_review_required"
28
+ ],
29
+ "non_negotiable": [
30
+ "Do not collapse HIR into OAM alone.",
31
+ "Display HIR x OAM as the shared integrity/pressure spine.",
32
+ "Do not treat fluent model output as closure.",
33
+ "Do not allow source mutation from an adapter call."
34
+ ]
35
+ }
schemas/llm_contribution_capsule_schema_v3_3.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://primordial.local/schemas/llm_contribution_capsule_schema_v3_3.json",
4
+ "title": "LLM Contribution Capsule Schema v3.3",
5
+ "type": "object",
6
+ "required": [
7
+ "contribution_id",
8
+ "adapter_id",
9
+ "command_id",
10
+ "contribution_type",
11
+ "claims",
12
+ "uncertainties",
13
+ "write_permission",
14
+ "oam_precheck"
15
+ ],
16
+ "properties": {
17
+ "contribution_id": {
18
+ "type": "string"
19
+ },
20
+ "adapter_id": {
21
+ "type": "string"
22
+ },
23
+ "command_id": {
24
+ "type": "string"
25
+ },
26
+ "contribution_type": {
27
+ "enum": [
28
+ "SYNTHESIS_REVIEW",
29
+ "NODE_SUGGESTION",
30
+ "REPAIR_NOTE",
31
+ "NEXT_ROUTE_SUGGESTION",
32
+ "LEXICON_PROPOSAL",
33
+ "TRACE_CAPSULE_SUMMARY"
34
+ ]
35
+ },
36
+ "claims": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "string"
40
+ }
41
+ },
42
+ "uncertainties": {
43
+ "type": "array",
44
+ "items": {
45
+ "type": "string"
46
+ }
47
+ },
48
+ "repair_suggestions": {
49
+ "type": "array",
50
+ "items": {
51
+ "type": "string"
52
+ }
53
+ },
54
+ "source_links": {
55
+ "type": "array",
56
+ "items": {
57
+ "type": "string"
58
+ }
59
+ },
60
+ "oam_precheck": {
61
+ "type": "object"
62
+ },
63
+ "write_permission": {
64
+ "enum": [
65
+ "NONE",
66
+ "OVERLAY_PROPOSAL_ONLY",
67
+ "WORKSPACE_ONLY"
68
+ ]
69
+ },
70
+ "human_review_required": {
71
+ "type": "boolean"
72
+ }
73
+ }
74
+ }
schemas/mesh_command_capsule_schema_v3_3.json ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://primordial.local/schemas/mesh_command_capsule_schema_v3_3.json",
4
+ "title": "Mesh Command Capsule Schema v3.3",
5
+ "type": "object",
6
+ "required": [
7
+ "command_id",
8
+ "command_type",
9
+ "raw_user_text",
10
+ "requested_by",
11
+ "workspace_id",
12
+ "claim_boundary",
13
+ "required_outputs"
14
+ ],
15
+ "properties": {
16
+ "command_id": {
17
+ "type": "string"
18
+ },
19
+ "command_type": {
20
+ "enum": [
21
+ "DISCOVER",
22
+ "BRAINSTORM",
23
+ "COMBINE",
24
+ "EXTEND_RESEARCH",
25
+ "OAM_READ",
26
+ "LEXICON_REVIEW",
27
+ "THREADROOM_POST"
28
+ ]
29
+ },
30
+ "raw_user_text": {
31
+ "type": "string"
32
+ },
33
+ "requested_by": {
34
+ "$ref": "adapter_identity_schema_v3_3.json"
35
+ },
36
+ "workspace_id": {
37
+ "type": "string"
38
+ },
39
+ "session_id": {
40
+ "type": "string"
41
+ },
42
+ "target_nodes": {
43
+ "type": "array",
44
+ "items": {
45
+ "type": "string"
46
+ }
47
+ },
48
+ "hashtags": {
49
+ "type": "array",
50
+ "items": {
51
+ "type": "string"
52
+ }
53
+ },
54
+ "mention_refs": {
55
+ "type": "array",
56
+ "items": {
57
+ "type": "string"
58
+ }
59
+ },
60
+ "minutes_budget": {
61
+ "type": "number",
62
+ "minimum": 0
63
+ },
64
+ "claim_boundary": {
65
+ "type": "string"
66
+ },
67
+ "required_outputs": {
68
+ "type": "array",
69
+ "items": {
70
+ "type": "string"
71
+ }
72
+ },
73
+ "privacy_scope": {
74
+ "enum": [
75
+ "PRIVATE_WORKSPACE",
76
+ "CONTROLLED_LINK",
77
+ "PUBLIC_READ_ONLY",
78
+ "PUBLIC_CONTRIBUTION_QUEUE"
79
+ ]
80
+ },
81
+ "source_mutation_allowed": {
82
+ "const": false
83
+ }
84
+ }
85
+ }
schemas/user_workspace_schema_v3_3.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://primordial.local/schemas/user_workspace_schema_v3_3.json",
4
+ "title": "User Workspace Schema v3.3",
5
+ "type": "object",
6
+ "required": [
7
+ "workspace_id",
8
+ "owner_route",
9
+ "privacy_scope",
10
+ "allowed_write_scope",
11
+ "audit_log_path"
12
+ ],
13
+ "properties": {
14
+ "workspace_id": {
15
+ "type": "string"
16
+ },
17
+ "owner_route": {
18
+ "type": "string"
19
+ },
20
+ "privacy_scope": {
21
+ "enum": [
22
+ "PRIVATE_WORKSPACE",
23
+ "CONTROLLED_LINK",
24
+ "PUBLIC_READ_ONLY",
25
+ "PUBLIC_CONTRIBUTION_QUEUE"
26
+ ]
27
+ },
28
+ "allowed_write_scope": {
29
+ "enum": [
30
+ "WORKSPACE_ONLY",
31
+ "OVERLAY_PROPOSAL_ONLY"
32
+ ]
33
+ },
34
+ "overlay_path": {
35
+ "type": "string"
36
+ },
37
+ "audit_log_path": {
38
+ "type": "string"
39
+ },
40
+ "public_contribution_policy": {
41
+ "type": "string"
42
+ }
43
+ }
44
+ }
src/substrate_connector_core.py ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Substrate Mesh Runtime — Primordial OS Runtime Connector Core v3.3
4
+
5
+ Local simulated connector/action core. This does not call the OpenAI API and does not host a server.
6
+ It demonstrates the contract that Primordial OS Runtime GPT can call later through a GPT Action.
7
+ """
8
+ from __future__ import annotations
9
+ import argparse, json, hashlib, os, re, time
10
+ from datetime import datetime, timezone
11
+ from pathlib import Path
12
+ from typing import Dict, Any, List
13
+
14
+ FAMILY_MAP = {
15
+ "robotics": ["Rt", "Rg", "Rd"],
16
+ "humans": ["CTL", "HIR", "RAM"],
17
+ "human": ["CTL", "HIR", "RAM"],
18
+ "dna": ["DL", "CTE", "SR"],
19
+ "grch38": ["RS", "DL", "CTE"],
20
+ "lexicon": ["Lex", "CTL", "HIR"],
21
+ "oam": ["OAM", "HIR"],
22
+ "hir": ["HIR", "OAM"],
23
+ "substrate": ["Sub", "TC", "LC"],
24
+ }
25
+
26
+ PPT_ELEMENTS = {
27
+ "Rt": {"symbol": "Rt", "name": "Runtime Trail / Robot Day Loop", "family": "Observation / Translation", "node_ref": "@node:robot_day_loop"},
28
+ "Rg": {"symbol": "Rg", "name": "Resonant Ingress / Robotics Pressure Gyro", "family": "Runtime Engines", "node_ref": "@node:resonant_ingress"},
29
+ "Rd": {"symbol": "Rd", "name": "Robotic Correction Loop", "family": "Research Substrate", "node_ref": "@node:robotic_correction_loop"},
30
+ "CTL": {"symbol": "CTL", "name": "Cognition Translation Layer", "family": "Observation / Translation", "node_ref": "@node:cognition_translation_layer"},
31
+ "HIR": {"symbol": "HIR", "name": "Honesty / Integrity / Respect", "family": "Core Laws", "node_ref": "@node:hir_spine"},
32
+ "OAM": {"symbol": "OAM", "name": "OAM Pressure / Degradation Scan", "family": "Core Laws", "node_ref": "@node:oam_pressure_scan"},
33
+ "RAM": {"symbol": "RAM", "name": "Resonant Access Memory", "family": "Runtime / Memory", "node_ref": "@node:resonant_access_memory"},
34
+ "DL": {"symbol": "DL", "name": "Digital Life Candidate Architecture", "family": "Research Substrate", "node_ref": "@node:digital_life_candidate_architecture"},
35
+ "CTE": {"symbol": "CTE", "name": "Cryptobiotic Trace Encapsulation", "family": "Safety / Governance", "node_ref": "@node:cryptobiotic_trace_encapsulation"},
36
+ "SR": {"symbol": "SR", "name": "Source Return / Provenance Bundle", "family": "Source / Provenance", "node_ref": "@node:source_return"},
37
+ "RS": {"symbol": "RS", "name": "Research Substrate Reference Capsule", "family": "Research Substrate", "node_ref": "@node:research_substrate_capsule"},
38
+ "Lex": {"symbol": "Lex", "name": "Primordial Lexicon", "family": "Meaning / Lexicon", "node_ref": "@node:primordial_lexicon"},
39
+ "Sub": {"symbol": "Sub", "name": "Substrate Loop Stewardship", "family": "Collaborative Work", "node_ref": "@node:substrate_loop_stewardship"},
40
+ "TC": {"symbol": "TC", "name": "Trace Capsule", "family": "Source / Provenance", "node_ref": "@node:trace_capsule"},
41
+ "LC": {"symbol": "LC", "name": "Loop Closure State", "family": "Loop / Closure", "node_ref": "@node:loop_closure_state"},
42
+ }
43
+
44
+ def utc_now() -> str:
45
+ return datetime.now(timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z")
46
+
47
+ def stable_id(prefix: str, text: str) -> str:
48
+ return prefix + "_" + hashlib.sha256(text.encode("utf-8")).hexdigest()[:16]
49
+
50
+ def extract_topics(text: str) -> List[str]:
51
+ tokens = re.findall(r"[A-Za-z0-9_]+", text.lower())
52
+ stop = {"i","am","im","curious","about","and","the","a","an","to","with","of","for","in","on","this","that","it","is","are","how","what","can","we","do"}
53
+ topics = []
54
+ for t in tokens:
55
+ if t not in stop and len(t) > 1 and t not in topics:
56
+ topics.append(t)
57
+ return topics[:12]
58
+
59
+ def extract_mentions(text: str) -> List[str]:
60
+ return re.findall(r"[@#][A-Za-z0-9_:\-]+", text)
61
+
62
+ def match_ppt_elements(topics: List[str], mentions: List[str]) -> List[Dict[str, Any]]:
63
+ symbols = []
64
+ lower_mentions = " ".join(mentions).lower()
65
+ for t in topics:
66
+ for sym in FAMILY_MAP.get(t, []):
67
+ if sym not in symbols:
68
+ symbols.append(sym)
69
+ for sym, element in PPT_ELEMENTS.items():
70
+ if element["node_ref"].lower() in lower_mentions and sym not in symbols:
71
+ symbols.append(sym)
72
+ if not symbols:
73
+ symbols = ["Sub", "TC", "HIR", "OAM", "RAM"]
74
+ elements = []
75
+ for idx, sym in enumerate(symbols[:12], 1):
76
+ el = dict(PPT_ELEMENTS[sym])
77
+ el["rank"] = idx
78
+ el["match_reason"] = "Matched topic/mention route; resolved as PPT element for bounded synthesis."
79
+ el["source_return_state"] = "REFERENCE_BOUND"
80
+ el["pressure_spine"] = "HIR x OAM"
81
+ elements.append(el)
82
+ return elements
83
+
84
+ def build_alchemical_output(raw_text: str, topics: List[str], elements: List[Dict[str, Any]]) -> Dict[str, Any]:
85
+ names = [e["name"] for e in elements]
86
+ if {"robotics","humans","dna"} & set(topics):
87
+ reference = "This route explores how embodied correction, human cognition/agency, and biological-substrate or encoding concepts may share bounded sensing, repair, memory, and continuity patterns."
88
+ strain = "DNA-related language must remain a bounded computational/structural comparison unless domain evidence is introduced."
89
+ future = "Build a test capsule comparing robotic correction loops, human learning loops, and biological repair/encoding loops under the HIR x OAM pressure spine."
90
+ elif "grch38" in topics:
91
+ reference = "This route treats GRCh38 as a research-reference capsule that can be cross-mapped against local substrate, trace, and representation layers."
92
+ strain = "Do not infer biological causation, resonance, or clinical meaning without a defined transform, region, source data, and validation route."
93
+ future = "Build a computational test capsule for a specified GRCh38 region and transform, with biological interpretation held as unvalidated."
94
+ else:
95
+ reference = "This route converts loose inquiry into a trace capsule, resolves PPT elements, and proposes a bounded synthesis path."
96
+ strain = "The route needs more specific source anchors before stronger claims can be carried."
97
+ future = "Select 2-5 PPT elements and run a focused brainstorm or combine command."
98
+ return {
99
+ "panel_name": "Primordial Periodic Alchemical Output",
100
+ "reference_point": reference,
101
+ "selected_element_names": names,
102
+ "continuity_read": "HELD as a route proposal when treated as source-return, overlay-only collaborative synthesis.",
103
+ "strain_points": [strain],
104
+ "repair_notes": ["Preserve HIR x OAM terminology.", "Write proposals as overlays, not canonical source mutation."],
105
+ "future_routes": [future, "Ask the Primordial OS Runtime steward to propose next prompt options.", "Create a lexicon review packet for any new terms introduced."],
106
+ "claim_boundary": "route-integrity and research planning only; no final validation claim",
107
+ }
108
+
109
+ def build_receipt(elements: List[Dict[str, Any]]) -> Dict[str, Any]:
110
+ return {
111
+ "status": "HELD",
112
+ "H": 1.0,
113
+ "I": 1.0,
114
+ "R": 1.0,
115
+ "A": 1.0,
116
+ "P": 0.0,
117
+ "S_effective": 1.0,
118
+ "pressure_spine": "HIR x OAM",
119
+ "source_mutation": "NONE__OVERLAY_PROPOSAL_ONLY",
120
+ "human_review_required": True,
121
+ "matched_element_count": len(elements),
122
+ "claim_limit": "trace capsule / alchemical continuity route; not final validation"
123
+ }
124
+
125
+ def submit_mesh_command(command: Dict[str, Any]) -> Dict[str, Any]:
126
+ raw = command.get("raw_user_text","").strip()
127
+ command_type = command.get("command_type","DISCOVER")
128
+ workspace_id = command.get("workspace_id","workspace_local_001")
129
+ command_id = command.get("command_id") or stable_id("cmd", raw + command_type + workspace_id)
130
+ topics = extract_topics(raw)
131
+ mentions = extract_mentions(raw)
132
+ elements = match_ppt_elements(topics, mentions)
133
+ trace_capsule = {
134
+ "trace_capsule_id": stable_id("trace", raw + command_id),
135
+ "raw_user_text": raw,
136
+ "topics": topics,
137
+ "mentions": mentions,
138
+ "loop_state": "HELD",
139
+ "translation_route": "plain_language + PPT_elements + alchemical_output + receipt",
140
+ "source_return_required": True,
141
+ "false_closure_risk": "LOW",
142
+ }
143
+ alchemical = build_alchemical_output(raw, topics, elements)
144
+ receipt = build_receipt(elements)
145
+ overlay = {
146
+ "overlay_id": stable_id("overlay", command_id + raw),
147
+ "write_scope": "COLLABORATIVE_OVERLAY_PROPOSAL_ONLY",
148
+ "status": "PENDING_HUMAN_REVIEW",
149
+ "summary": alchemical["reference_point"],
150
+ "source_mutation": "NONE",
151
+ "credited_contributors": [
152
+ {"type": "human_or_session", "id": command.get("session_id","session_local")},
153
+ {"type": "ai_adapter", "id": "primordial_os_runtime"}
154
+ ]
155
+ }
156
+ return {
157
+ "status": "HELD",
158
+ "command_id": command_id,
159
+ "workspace_id": workspace_id,
160
+ "trace_capsule": trace_capsule,
161
+ "matched_ppt_elements": elements,
162
+ "alchemical_output": alchemical,
163
+ "lexicon_state": {
164
+ "active_terms": ["trace capsule", "source-return", "HIR x OAM", "Primordial Periodic Table", "Resonant Access Memory", "collaborative overlay"],
165
+ "candidate_terms": ["Primordial Periodic Alchemical Output"],
166
+ "review_required": True
167
+ },
168
+ "receipt": receipt,
169
+ "audit_pointer": f"workspaces/{workspace_id}/audit/{command_id}.json",
170
+ "overlay_proposals": [overlay],
171
+ "human_review_required": True
172
+ }
173
+
174
+ def write_workspace_response(response: Dict[str, Any], out_dir: Path) -> None:
175
+ out_dir.mkdir(parents=True, exist_ok=True)
176
+ (out_dir / "response.json").write_text(json.dumps(response, indent=2), encoding="utf-8")
177
+ audit = {
178
+ "timestamp_utc": utc_now(),
179
+ "event": "mesh_command_completed",
180
+ "command_id": response["command_id"],
181
+ "workspace_id": response["workspace_id"],
182
+ "status": response["status"],
183
+ "source_mutation": response["receipt"]["source_mutation"],
184
+ "human_review_required": response["human_review_required"]
185
+ }
186
+ (out_dir / "audit_log.jsonl").write_text(json.dumps(audit) + "\n", encoding="utf-8")
187
+ receipt_md = f"""# Mesh Command Receipt
188
+
189
+ Command ID: `{response['command_id']}`
190
+
191
+ Status: `{response['status']}`
192
+
193
+ Pressure spine: `{response['receipt']['pressure_spine']}`
194
+
195
+ Source mutation: `{response['receipt']['source_mutation']}`
196
+
197
+ Human review required: `{response['human_review_required']}`
198
+
199
+ ## Reference Point
200
+
201
+ {response['alchemical_output']['reference_point']}
202
+
203
+ ## Future Routes
204
+
205
+ """ + "\n".join(f"- {x}" for x in response["alchemical_output"]["future_routes"]) + "\n"
206
+ (out_dir / "receipt.md").write_text(receipt_md, encoding="utf-8")
207
+
208
+ def main() -> int:
209
+ p = argparse.ArgumentParser()
210
+ p.add_argument("raw_user_text", nargs="?", default="robotics humans DNA")
211
+ p.add_argument("--command-type", default="DISCOVER")
212
+ p.add_argument("--workspace-id", default="workspace_local_001")
213
+ p.add_argument("--session-id", default="session_local")
214
+ p.add_argument("--out-dir", default="runs/connector_demo_001")
215
+ p.add_argument("--overwrite", action="store_true")
216
+ args = p.parse_args()
217
+ out = Path(args.out_dir)
218
+ if out.exists() and not args.overwrite:
219
+ print(f"Refusing to overwrite existing out-dir: {out}", flush=True)
220
+ return 2
221
+ command = {
222
+ "command_type": args.command_type,
223
+ "raw_user_text": args.raw_user_text,
224
+ "workspace_id": args.workspace_id,
225
+ "session_id": args.session_id,
226
+ "claim_boundary": "no final validation claims; human review required",
227
+ "privacy_scope": "PRIVATE_WORKSPACE",
228
+ "source_mutation_allowed": False
229
+ }
230
+ response = submit_mesh_command(command)
231
+ write_workspace_response(response, out)
232
+ print(json.dumps({
233
+ "status": response["status"],
234
+ "command_id": response["command_id"],
235
+ "workspace_id": response["workspace_id"],
236
+ "matched_ppt_elements": len(response["matched_ppt_elements"]),
237
+ "source_mutation": response["receipt"]["source_mutation"],
238
+ "human_review_required": response["human_review_required"],
239
+ "out_dir": str(out)
240
+ }, indent=2))
241
+ return 0
242
+
243
+ if __name__ == "__main__":
244
+ raise SystemExit(main())
validate_substrate_connector_api_v3_3_1.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+ import json, os, shutil
4
+ from pathlib import Path
5
+
6
+ from fastapi.testclient import TestClient
7
+ from app import app
8
+
9
+
10
+ def main() -> int:
11
+ os.environ["SUBSTRATE_ACTION_KEY"] = "test-secret-key"
12
+ os.environ["SUBSTRATE_RECEIPT_ROOT"] = "runs/api_receipts_validation"
13
+ root = Path(os.environ["SUBSTRATE_RECEIPT_ROOT"])
14
+ if root.exists():
15
+ shutil.rmtree(root)
16
+
17
+ client = TestClient(app)
18
+ report = {
19
+ "version": "v3.3.1",
20
+ "health_ok": False,
21
+ "unauthorized_blocked": False,
22
+ "command_ok": False,
23
+ "receipt_fetch_ok": False,
24
+ "pressure_spine_hir_x_oam": False,
25
+ "source_mutation_blocked": False,
26
+ "workspace_local_receipt_written": False,
27
+ "human_review_required": False,
28
+ "overlay_proposal_present": False,
29
+ "canonical_boundary_present": False,
30
+ "status": "FAIL"
31
+ }
32
+
33
+ health = client.get("/v1/mesh/health")
34
+ report["health_ok"] = health.status_code == 200 and health.json().get("status") == "HELD"
35
+
36
+ unauth = client.post("/v1/mesh/command", json={"raw_user_text":"robotics humans DNA"})
37
+ report["unauthorized_blocked"] = unauth.status_code == 401
38
+
39
+ headers = {"Authorization": "Bearer test-secret-key"}
40
+ payload = {
41
+ "command_type":"DISCOVER",
42
+ "raw_user_text":"robotics humans DNA",
43
+ "workspace_id":"workspace_validation_001",
44
+ "session_id":"user_001",
45
+ "source_mutation_allowed": False
46
+ }
47
+ command = client.post("/v1/mesh/command", json=payload, headers=headers)
48
+ if command.status_code == 200:
49
+ data = command.json()
50
+ report["command_ok"] = (data.get("status") == "HELD" and bool(data.get("command_id")))
51
+ report["pressure_spine_hir_x_oam"] = data.get("receipt", {}).get("pressure_spine") == "HIR × OAM"
52
+ report["source_mutation_blocked"] = data.get("receipt", {}).get("source_mutation") == "NONE__OVERLAY_PROPOSAL_ONLY"
53
+ report["human_review_required"] = data.get("human_review_required") is True
54
+ report["overlay_proposal_present"] = bool(data.get("overlay_proposals"))
55
+ report["canonical_boundary_present"] = data.get("boundary", {}).get("canonical_sources") == "READ_ONLY" and data.get("boundary", {}).get("canonical_lexicon") == "READ_ONLY"
56
+ report["workspace_local_receipt_written"] = Path(data.get("api_receipt_paths", {}).get("response_path", "")).exists()
57
+ receipt = client.get(f"/v1/mesh/receipt/{data['command_id']}?workspace_id=workspace_validation_001", headers=headers)
58
+ report["receipt_fetch_ok"] = receipt.status_code == 200 and receipt.json().get("command_id") == data["command_id"]
59
+ # Save example response for packet readers.
60
+ ex = Path("examples/responses")
61
+ ex.mkdir(parents=True, exist_ok=True)
62
+ (ex / "robotics_humans_dna_api_response.json").write_text(json.dumps(data, indent=2, ensure_ascii=False), encoding="utf-8")
63
+
64
+ report["status"] = "PASS" if all(v is True for k,v in report.items() if k not in {"version","status"}) else "FAIL"
65
+ Path("V3_3_1_VALIDATION_RESULT.json").write_text(json.dumps(report, indent=2), encoding="utf-8")
66
+ print(json.dumps(report, indent=2))
67
+ return 0 if report["status"] == "PASS" else 1
68
+
69
+ if __name__ == "__main__":
70
+ raise SystemExit(main())