agience-prism 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. agience_prism-0.1.0/LICENSE +201 -0
  2. agience_prism-0.1.0/NOTICE +5 -0
  3. agience_prism-0.1.0/PKG-INFO +171 -0
  4. agience_prism-0.1.0/README.md +119 -0
  5. agience_prism-0.1.0/pyproject.toml +134 -0
  6. agience_prism-0.1.0/setup.cfg +4 -0
  7. agience_prism-0.1.0/src/agience_prism.egg-info/PKG-INFO +171 -0
  8. agience_prism-0.1.0/src/agience_prism.egg-info/SOURCES.txt +100 -0
  9. agience_prism-0.1.0/src/agience_prism.egg-info/dependency_links.txt +1 -0
  10. agience_prism-0.1.0/src/agience_prism.egg-info/entry_points.txt +2 -0
  11. agience_prism-0.1.0/src/agience_prism.egg-info/requires.txt +34 -0
  12. agience_prism-0.1.0/src/agience_prism.egg-info/top_level.txt +1 -0
  13. agience_prism-0.1.0/src/prism/__init__.py +159 -0
  14. agience_prism-0.1.0/src/prism/adaptive_cut.py +215 -0
  15. agience_prism-0.1.0/src/prism/attestation.py +246 -0
  16. agience_prism-0.1.0/src/prism/canonical.py +113 -0
  17. agience_prism-0.1.0/src/prism/capabilities.py +90 -0
  18. agience_prism-0.1.0/src/prism/carriers.py +306 -0
  19. agience_prism-0.1.0/src/prism/cli.py +439 -0
  20. agience_prism-0.1.0/src/prism/config.py +147 -0
  21. agience_prism-0.1.0/src/prism/conservation.py +256 -0
  22. agience_prism-0.1.0/src/prism/crystal_model.py +233 -0
  23. agience_prism-0.1.0/src/prism/delegate.py +65 -0
  24. agience_prism-0.1.0/src/prism/demurrage.py +351 -0
  25. agience_prism-0.1.0/src/prism/embodiment.py +89 -0
  26. agience_prism-0.1.0/src/prism/envelope.py +535 -0
  27. agience_prism-0.1.0/src/prism/environment.py +129 -0
  28. agience_prism-0.1.0/src/prism/error_threshold.py +138 -0
  29. agience_prism-0.1.0/src/prism/errors.py +100 -0
  30. agience_prism-0.1.0/src/prism/extraction.py +150 -0
  31. agience_prism-0.1.0/src/prism/frames.py +186 -0
  32. agience_prism-0.1.0/src/prism/grounding.py +59 -0
  33. agience_prism-0.1.0/src/prism/host/__init__.py +23 -0
  34. agience_prism-0.1.0/src/prism/host/auth.py +279 -0
  35. agience_prism-0.1.0/src/prism/host/host.py +251 -0
  36. agience_prism-0.1.0/src/prism/instrument.py +847 -0
  37. agience_prism-0.1.0/src/prism/law.py +119 -0
  38. agience_prism-0.1.0/src/prism/mass.py +366 -0
  39. agience_prism-0.1.0/src/prism/mcp_bridge.py +126 -0
  40. agience_prism-0.1.0/src/prism/minhash.py +207 -0
  41. agience_prism-0.1.0/src/prism/minting.py +208 -0
  42. agience_prism-0.1.0/src/prism/plane.py +268 -0
  43. agience_prism-0.1.0/src/prism/principals.py +57 -0
  44. agience_prism-0.1.0/src/prism/propagation.py +96 -0
  45. agience_prism-0.1.0/src/prism/pump.py +146 -0
  46. agience_prism-0.1.0/src/prism/py.typed +0 -0
  47. agience_prism-0.1.0/src/prism/reach.py +481 -0
  48. agience_prism-0.1.0/src/prism/resolution.py +290 -0
  49. agience_prism-0.1.0/src/prism/rounding.py +85 -0
  50. agience_prism-0.1.0/src/prism/runner.py +709 -0
  51. agience_prism-0.1.0/src/prism/schema.py +255 -0
  52. agience_prism-0.1.0/src/prism/server/__init__.py +33 -0
  53. agience_prism-0.1.0/src/prism/server/auth.py +122 -0
  54. agience_prism-0.1.0/src/prism/server/client.py +123 -0
  55. agience_prism-0.1.0/src/prism/server/server.py +45 -0
  56. agience_prism-0.1.0/src/prism/settlement.py +98 -0
  57. agience_prism-0.1.0/src/prism/source.py +58 -0
  58. agience_prism-0.1.0/src/prism/streams.py +88 -0
  59. agience_prism-0.1.0/src/prism/structural.py +210 -0
  60. agience_prism-0.1.0/src/prism/trust/__init__.py +46 -0
  61. agience_prism-0.1.0/src/prism/trust/authority_trust.py +265 -0
  62. agience_prism-0.1.0/src/prism/trust/key_manager.py +334 -0
  63. agience_prism-0.1.0/src/prism/trust/opsign.py +254 -0
  64. agience_prism-0.1.0/src/prism/trust/scopes.py +158 -0
  65. agience_prism-0.1.0/src/prism/trust/server_auth.py +596 -0
  66. agience_prism-0.1.0/src/prism/trust/service_identity.py +264 -0
  67. agience_prism-0.1.0/src/prism/vector.py +48 -0
  68. agience_prism-0.1.0/src/prism/vectors/__init__.py +88 -0
  69. agience_prism-0.1.0/src/prism/vectors/contract_vectors.json +802 -0
  70. agience_prism-0.1.0/src/prism/vectors/frame_wire_vectors.json +117 -0
  71. agience_prism-0.1.0/src/prism/vectors/ordering_vectors.json +106 -0
  72. agience_prism-0.1.0/src/prism/vectors/plane_seal_vectors.json +68 -0
  73. agience_prism-0.1.0/src/prism/vectors/screen_read_vectors.json +137 -0
  74. agience_prism-0.1.0/tests/test_a_refused_registration_is_audible.py +158 -0
  75. agience_prism-0.1.0/tests/test_canonical_json_conformance.py +51 -0
  76. agience_prism-0.1.0/tests/test_capability_reach.py +67 -0
  77. agience_prism-0.1.0/tests/test_cli.py +248 -0
  78. agience_prism-0.1.0/tests/test_contract_install_is_pure.py +648 -0
  79. agience_prism-0.1.0/tests/test_contract_vectors.py +163 -0
  80. agience_prism-0.1.0/tests/test_cross_language_ordering.py +124 -0
  81. agience_prism-0.1.0/tests/test_demurrage.py +317 -0
  82. agience_prism-0.1.0/tests/test_duplicate_basenames_cannot_shadow.py +131 -0
  83. agience_prism-0.1.0/tests/test_error_threshold.py +88 -0
  84. agience_prism-0.1.0/tests/test_extraction.py +116 -0
  85. agience_prism-0.1.0/tests/test_frame_wire.py +133 -0
  86. agience_prism-0.1.0/tests/test_instrument_read_default.py +110 -0
  87. agience_prism-0.1.0/tests/test_mass_has_no_ladder.py +88 -0
  88. agience_prism-0.1.0/tests/test_minting.py +173 -0
  89. agience_prism-0.1.0/tests/test_plane_seal.py +167 -0
  90. agience_prism-0.1.0/tests/test_process_authors_single_home.py +112 -0
  91. agience_prism-0.1.0/tests/test_propagation.py +124 -0
  92. agience_prism-0.1.0/tests/test_resolution_tie_break.py +107 -0
  93. agience_prism-0.1.0/tests/test_rounding.py +264 -0
  94. agience_prism-0.1.0/tests/test_runner_groups.py +301 -0
  95. agience_prism-0.1.0/tests/test_schema.py +163 -0
  96. agience_prism-0.1.0/tests/test_settlement.py +152 -0
  97. agience_prism-0.1.0/tests/test_store_carrier_watermark.py +157 -0
  98. agience_prism-0.1.0/tests/test_streams.py +196 -0
  99. agience_prism-0.1.0/tests/test_structural.py +190 -0
  100. agience_prism-0.1.0/tests/test_trust.py +79 -0
  101. agience_prism-0.1.0/tests/test_vectors_package.py +87 -0
  102. agience_prism-0.1.0/tests/test_wire_extra.py +464 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ Agience Prism
2
+ Copyright 2026 Ikailo Inc.
3
+
4
+ This product includes software developed by Ikailo Inc.
5
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.4
2
+ Name: agience-prism
3
+ Version: 0.1.0
4
+ Summary: The Agience developer SDK for Python — an environment adapter. Build on Agience over the wire.
5
+ Author-email: "Ikailo Inc." <connect@agience.ai>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://agience.ai
8
+ Project-URL: Source, https://github.com/Agience/agience-prism-py
9
+ Project-URL: Issues, https://github.com/Agience/agience-prism-py/issues
10
+ Keywords: agience,prism,sdk,mcp,agent,capability,canonical-json,jcs
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: NOTICE
25
+ Provides-Extra: trust
26
+ Requires-Dist: python-jose[cryptography]>=3.3; extra == "trust"
27
+ Requires-Dist: cryptography>=42; extra == "trust"
28
+ Provides-Extra: host
29
+ Requires-Dist: fastapi>=0.110; extra == "host"
30
+ Requires-Dist: uvicorn[standard]>=0.27; extra == "host"
31
+ Requires-Dist: httpx>=0.27; extra == "host"
32
+ Requires-Dist: pyjwt[crypto]>=2.8; extra == "host"
33
+ Provides-Extra: server
34
+ Requires-Dist: mcp[cli]>=1.6.0; extra == "server"
35
+ Requires-Dist: httpx>=0.27; extra == "server"
36
+ Provides-Extra: cli
37
+ Requires-Dist: cryptography>=42; extra == "cli"
38
+ Requires-Dist: httpx>=0.27; extra == "cli"
39
+ Provides-Extra: vector
40
+ Requires-Dist: numpy>=1.24; extra == "vector"
41
+ Provides-Extra: wire
42
+ Requires-Dist: numpy>=1.24; extra == "wire"
43
+ Requires-Dist: cryptography>=42; extra == "wire"
44
+ Provides-Extra: all
45
+ Requires-Dist: agience-prism[cli,host,server,trust,vector,wire]; extra == "all"
46
+ Provides-Extra: dev
47
+ Requires-Dist: agience-prism[all]; extra == "dev"
48
+ Requires-Dist: pytest>=8.0; extra == "dev"
49
+ Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
50
+ Requires-Dist: ruff>=0.4; extra == "dev"
51
+ Dynamic: license-file
52
+
53
+ # agience-prism
54
+
55
+ **An environment adapter** — prism adapts an environment (world ↔ frame) to Agience.
56
+ This is the Python adapter: the **Agience developer SDK** (Apache-2.0).
57
+
58
+ ```python
59
+ from prism import Host, create_server
60
+ ```
61
+
62
+ ## Install
63
+
64
+ ```bash
65
+ pip install agience-prism
66
+ ```
67
+
68
+ The base install has **no dependencies**. It carries the contract — canonical JSON, the crystal
69
+ model, the capability vocabulary, the config shape, the error set, and the structural address — so a
70
+ component can hold the same answers as every other component without taking on an install cost.
71
+
72
+ Runtime surfaces are extras:
73
+
74
+ | Extra | Installs | For |
75
+ | --- | --- | --- |
76
+ | `trust` | python-jose, cryptography | the trust floor: keys, signing, scopes |
77
+ | `host` | fastapi, uvicorn, httpx, pyjwt | `prism.Host` |
78
+ | `server` | mcp, httpx | `prism.create_server` |
79
+ | `cli` | cryptography, httpx | the `prism` command line |
80
+ | `vector` | numpy | vector types |
81
+ | `wire` | numpy, cryptography | the plane: reach, frames, carriers, settlement |
82
+ | `all` | all of the above | |
83
+ | `dev` | `all` + pytest, pytest-asyncio, ruff | working on prism itself |
84
+
85
+ ```bash
86
+ pip install "agience-prism[host]"
87
+ pip install "agience-prism[all]"
88
+ ```
89
+
90
+ The runtime surfaces resolve through PEP 562 `__getattr__`, so reaching one without its extra raises
91
+ an `ImportError` naming the extra to install, while `from prism.canonical import canonical_string`
92
+ costs nothing.
93
+
94
+ Nine of the sixteen wire modules — carriers, pump, minhash, minting, settlement, extraction, schema,
95
+ error_threshold, mcp_bridge — import on the bare base install. `tests/test_wire_extra.py` imports
96
+ each in a subprocess with numpy and cryptography blocked, so that claim can fail rather than only be
97
+ asserted.
98
+
99
+ The aperture is reached by **injection** (`prism.instrument`), never by import. A published SDK
100
+ depends only on packages its consumers can install.
101
+
102
+ ## Two toolkits
103
+
104
+ A **host** is compute that serves capabilities over HTTP. The platform reaches it over the wire; it
105
+ imports nothing of the platform.
106
+
107
+ ```python
108
+ from prism import Host
109
+
110
+ host = Host("my-host")
111
+
112
+ @host.operator("echo", path="/echo")
113
+ def echo(req: EchoIn) -> dict:
114
+ return {"echo": req.text}
115
+
116
+ host.serve(port=8083)
117
+ ```
118
+
119
+ A **server** exposes MCP tools authorized as the calling user: it captures the inbound delegation
120
+ token and forwards it on outbound calls, so it only ever acts within that user's authorization.
121
+
122
+ ```python
123
+ from prism import create_server
124
+
125
+ mcp, server = create_server("my-server")
126
+
127
+ @mcp.tool(description="Echo a message back, with the calling user's id.")
128
+ async def echo(message: str) -> str:
129
+ return json.dumps({"echo": message, "user": server.get_user_id()})
130
+
131
+ app = server.create_app(mcp)
132
+ ```
133
+
134
+ ## The shared contract
135
+
136
+ `prism/vectors/contract_vectors.json` is the one artifact all three prism SDKs are checked against —
137
+ canonical JSON, the crystal sha, the structural address, capability reach.
138
+ `tests/test_contract_vectors.py` asserts it here; prism-js and prism-c assert the same bytes. That
139
+ file is what makes "one wire format, three languages" a measurement rather than a claim.
140
+
141
+ The vectors ship inside the wheel, so `pip install agience-prism` is enough to run a conformance
142
+ gate — no source tree and no sibling checkout:
143
+
144
+ ```python
145
+ from prism.vectors import load_vectors
146
+ vectors = load_vectors("contract_vectors")
147
+ ```
148
+
149
+ ## Self-contained
150
+
151
+ Prism resolves no path outside its own installation and imports nothing from the components that
152
+ depend on it. Where a deployment supplies data — operator bundles for `prism.runner` — it names the
153
+ directory with `$AGIENCE_BUNDLE_ROOT` or binds a payload with `register_group()`. Prism never
154
+ searches for a sibling checkout, because a path derived from where a file happens to sit is a
155
+ fallback that can drift from the bytes the mesh carries while the integrity gate keeps passing.
156
+
157
+ ## Development
158
+
159
+ ```bash
160
+ pip install -e ".[dev]"
161
+ python -m pytest -q
162
+ python -m ruff check .
163
+ ```
164
+
165
+ ## License
166
+
167
+ Apache-2.0 — see [`LICENSE`](https://github.com/Agience/agience-prism-py/blob/main/LICENSE) and [`NOTICE`](https://github.com/Agience/agience-prism-py/blob/main/NOTICE). Contributing:
168
+ [`CONTRIBUTING.md`](https://github.com/Agience/agience-prism-py/blob/main/CONTRIBUTING.md). Security: [`SECURITY.md`](https://github.com/Agience/agience-prism-py/blob/main/SECURITY.md).
169
+
170
+ Prism is permissive **deliberately**: build on Agience over the wire with no copyleft reaching your
171
+ code. The base install has no dependencies, so depending on it costs nothing.
@@ -0,0 +1,119 @@
1
+ # agience-prism
2
+
3
+ **An environment adapter** — prism adapts an environment (world ↔ frame) to Agience.
4
+ This is the Python adapter: the **Agience developer SDK** (Apache-2.0).
5
+
6
+ ```python
7
+ from prism import Host, create_server
8
+ ```
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pip install agience-prism
14
+ ```
15
+
16
+ The base install has **no dependencies**. It carries the contract — canonical JSON, the crystal
17
+ model, the capability vocabulary, the config shape, the error set, and the structural address — so a
18
+ component can hold the same answers as every other component without taking on an install cost.
19
+
20
+ Runtime surfaces are extras:
21
+
22
+ | Extra | Installs | For |
23
+ | --- | --- | --- |
24
+ | `trust` | python-jose, cryptography | the trust floor: keys, signing, scopes |
25
+ | `host` | fastapi, uvicorn, httpx, pyjwt | `prism.Host` |
26
+ | `server` | mcp, httpx | `prism.create_server` |
27
+ | `cli` | cryptography, httpx | the `prism` command line |
28
+ | `vector` | numpy | vector types |
29
+ | `wire` | numpy, cryptography | the plane: reach, frames, carriers, settlement |
30
+ | `all` | all of the above | |
31
+ | `dev` | `all` + pytest, pytest-asyncio, ruff | working on prism itself |
32
+
33
+ ```bash
34
+ pip install "agience-prism[host]"
35
+ pip install "agience-prism[all]"
36
+ ```
37
+
38
+ The runtime surfaces resolve through PEP 562 `__getattr__`, so reaching one without its extra raises
39
+ an `ImportError` naming the extra to install, while `from prism.canonical import canonical_string`
40
+ costs nothing.
41
+
42
+ Nine of the sixteen wire modules — carriers, pump, minhash, minting, settlement, extraction, schema,
43
+ error_threshold, mcp_bridge — import on the bare base install. `tests/test_wire_extra.py` imports
44
+ each in a subprocess with numpy and cryptography blocked, so that claim can fail rather than only be
45
+ asserted.
46
+
47
+ The aperture is reached by **injection** (`prism.instrument`), never by import. A published SDK
48
+ depends only on packages its consumers can install.
49
+
50
+ ## Two toolkits
51
+
52
+ A **host** is compute that serves capabilities over HTTP. The platform reaches it over the wire; it
53
+ imports nothing of the platform.
54
+
55
+ ```python
56
+ from prism import Host
57
+
58
+ host = Host("my-host")
59
+
60
+ @host.operator("echo", path="/echo")
61
+ def echo(req: EchoIn) -> dict:
62
+ return {"echo": req.text}
63
+
64
+ host.serve(port=8083)
65
+ ```
66
+
67
+ A **server** exposes MCP tools authorized as the calling user: it captures the inbound delegation
68
+ token and forwards it on outbound calls, so it only ever acts within that user's authorization.
69
+
70
+ ```python
71
+ from prism import create_server
72
+
73
+ mcp, server = create_server("my-server")
74
+
75
+ @mcp.tool(description="Echo a message back, with the calling user's id.")
76
+ async def echo(message: str) -> str:
77
+ return json.dumps({"echo": message, "user": server.get_user_id()})
78
+
79
+ app = server.create_app(mcp)
80
+ ```
81
+
82
+ ## The shared contract
83
+
84
+ `prism/vectors/contract_vectors.json` is the one artifact all three prism SDKs are checked against —
85
+ canonical JSON, the crystal sha, the structural address, capability reach.
86
+ `tests/test_contract_vectors.py` asserts it here; prism-js and prism-c assert the same bytes. That
87
+ file is what makes "one wire format, three languages" a measurement rather than a claim.
88
+
89
+ The vectors ship inside the wheel, so `pip install agience-prism` is enough to run a conformance
90
+ gate — no source tree and no sibling checkout:
91
+
92
+ ```python
93
+ from prism.vectors import load_vectors
94
+ vectors = load_vectors("contract_vectors")
95
+ ```
96
+
97
+ ## Self-contained
98
+
99
+ Prism resolves no path outside its own installation and imports nothing from the components that
100
+ depend on it. Where a deployment supplies data — operator bundles for `prism.runner` — it names the
101
+ directory with `$AGIENCE_BUNDLE_ROOT` or binds a payload with `register_group()`. Prism never
102
+ searches for a sibling checkout, because a path derived from where a file happens to sit is a
103
+ fallback that can drift from the bytes the mesh carries while the integrity gate keeps passing.
104
+
105
+ ## Development
106
+
107
+ ```bash
108
+ pip install -e ".[dev]"
109
+ python -m pytest -q
110
+ python -m ruff check .
111
+ ```
112
+
113
+ ## License
114
+
115
+ Apache-2.0 — see [`LICENSE`](https://github.com/Agience/agience-prism-py/blob/main/LICENSE) and [`NOTICE`](https://github.com/Agience/agience-prism-py/blob/main/NOTICE). Contributing:
116
+ [`CONTRIBUTING.md`](https://github.com/Agience/agience-prism-py/blob/main/CONTRIBUTING.md). Security: [`SECURITY.md`](https://github.com/Agience/agience-prism-py/blob/main/SECURITY.md).
117
+
118
+ Prism is permissive **deliberately**: build on Agience over the wire with no copyleft reaching your
119
+ code. The base install has no dependencies, so depending on it costs nothing.
@@ -0,0 +1,134 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "agience-prism"
7
+ dynamic = ["version"]
8
+ description = "The Agience developer SDK for Python — an environment adapter. Build on Agience over the wire."
9
+ readme = { file = "README.md", content-type = "text/markdown" }
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ authors = [{ name = "Ikailo Inc.", email = "connect@agience.ai" }]
13
+ keywords = ["agience", "prism", "sdk", "mcp", "agent", "capability", "canonical-json", "jcs"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Operating System :: OS Independent",
22
+ "Topic :: Software Development :: Libraries :: Python Modules",
23
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
24
+ "Typing :: Typed",
25
+ ]
26
+
27
+ # The base install is the contract, and it has no dependencies.
28
+ #
29
+ # The contract — canonical JSON, crystal_model, capabilities, config, errors, structural,
30
+ # environment, resolution, adaptive_cut — is pure stdlib. Shipping it dependency-free is what lets a
31
+ # component that must stay self-contained import it rather than vendor a copy: three byte-identical
32
+ # copies of `canonical.py` once existed in this workspace, kept in step by a gate, because reading
33
+ # one constant from this package cost a web framework.
34
+ #
35
+ # `resolution` and `adaptive_cut` are the two derivations in the base — everything else here
36
+ # declares, these two compute. Measured with numpy and scipy blocked at the meta-path: both import
37
+ # on bare stdlib. They sit in the base rather than behind an extra so that every component holds the
38
+ # same answer, including one whose sha-verified source bundle cannot require numpy.
39
+ #
40
+ # Enforced by `tests/test_contract_install_is_pure.py`, and by
41
+ # `test_the_derivations_import_with_numpy_blocked_too`, which blocks numpy and exercises both
42
+ # surfaces — so "stdlib-only" is a measurement that can fail rather than a sentence in a header.
43
+ dependencies = []
44
+
45
+ [project.urls]
46
+ Homepage = "https://agience.ai"
47
+ Source = "https://github.com/Agience/agience-prism-py"
48
+ Issues = "https://github.com/Agience/agience-prism-py/issues"
49
+
50
+ [project.scripts]
51
+ # The `prism` CLI (prism/cli.py): init / list / install / publish. `install` and `publish` verify
52
+ # through `prism.crystal_model` — the crystal contract's common ground, in this package's
53
+ # dependency-free base, so the CLI has no cross-repo import to arrange.
54
+ prism = "prism.cli:main"
55
+
56
+ [project.optional-dependencies]
57
+ # The runtime surfaces. Each names only what its own modules import: asking for one must not drag in
58
+ # the others, or the split is cosmetic.
59
+ trust = ["python-jose[cryptography]>=3.3", "cryptography>=42"] # prism.trust — sign/verify, keys
60
+ host = ["fastapi>=0.110", "uvicorn[standard]>=0.27", "httpx>=0.27", "pyjwt[crypto]>=2.8"]
61
+ server = ["mcp[cli]>=1.6.0", "httpx>=0.27"] # prism.server — MCP scaffold
62
+ cli = ["cryptography>=42", "httpx>=0.27"] # the `prism` command
63
+ vector = ["numpy>=1.24"] # prism.vector — unit/cosine primitives
64
+
65
+ # The wire — sixteen modules: reach · plane · streams · carriers · frames · propagation ·
66
+ # mcp_bridge · schema · demurrage · minting · settlement · pump · minhash · error_threshold ·
67
+ # extraction · conservation. It is an extra rather than a dependency because it is not all stdlib,
68
+ # and the floors are narrower than "the wire needs numpy and cryptography":
69
+ #
70
+ # numpy frames · conservation directly (a frame is a float array)
71
+ # propagation · demurrage transitively, through `prism.law`
72
+ # cryptography plane directly (AES-256-GCM sealing on the mesh plane)
73
+ # streams · reach transitively, through `prism.plane`
74
+ # neither carriers · pump · minhash · minting · settlement · extraction · schema ·
75
+ # error_threshold · mcp_bridge — 9 of the 16 import on the bare base install
76
+ #
77
+ # Those 9 are asserted, not asserted about: `tests/test_wire_extra.py` imports each of them in a
78
+ # subprocess with numpy and cryptography blocked, with a control proving the blocker bites. An
79
+ # accidental `import numpy` at the top of `carriers.py` is caught the day it lands rather than the
80
+ # day an edge node cannot install.
81
+ #
82
+ # One extra rather than two (`wire-frames` / `wire-transport`): no consumer has been measured
83
+ # wanting one half without the other. The floors above are recorded so that split is a measurement
84
+ # away rather than an archaeology.
85
+ wire = ["numpy>=1.24", "cryptography>=42"]
86
+
87
+ all = ["agience-prism[trust,host,server,cli,vector,wire]"]
88
+ dev = ["agience-prism[all]", "pytest>=8.0", "pytest-asyncio>=0.24", "ruff>=0.4"]
89
+
90
+ [tool.setuptools.packages.find]
91
+ where = ["src"]
92
+
93
+ [tool.setuptools.dynamic]
94
+ # One version, read from the package. `prism.__version__` is what a consumer reads at runtime, so
95
+ # it is the version of record; a second literal here would be the one the release tag check agrees
96
+ # with while the installed package reports something else. `prism/host` and `prism/server` re-export
97
+ # the same name rather than declaring their own.
98
+ version = { attr = "prism.__version__" }
99
+
100
+ # The shared conformance vectors ship inside the wheel.
101
+ #
102
+ # `prism/vectors/*.json` pins the bytes that prism-py, prism-js, prism-c and mantle's beacon are
103
+ # each checked against. Declared as package data so `pip install agience-prism` is sufficient to run
104
+ # a conformance gate: no source tree, no sibling repo, no walk up parent directories.
105
+ # `tests/test_vectors_package.py` asserts the set is present through `importlib.resources`, which is
106
+ # the path a wheel install resolves. They are data — pure stdlib to read — so the dependency-free
107
+ # base install is untouched.
108
+ #
109
+ # `py.typed` (PEP 561) is what makes the annotations throughout this package visible to a consumer's
110
+ # type checker; without the marker they are ignored in an installed wheel.
111
+ [tool.setuptools.package-data]
112
+ "prism.vectors" = ["*.json"]
113
+ "prism" = ["py.typed"]
114
+
115
+ [tool.pytest.ini_options]
116
+ testpaths = ["tests"]
117
+ # Async tests declare their own loop scope; pinning the default here is what silences the
118
+ # pytest-asyncio deprecation warning that otherwise heads every run.
119
+ asyncio_default_fixture_loop_scope = "function"
120
+
121
+ [tool.ruff]
122
+ line-length = 100
123
+ src = ["src", "tests"]
124
+
125
+ [tool.ruff.lint]
126
+ # Ruff's default rule set (E4 imports, E7 statements, E9 syntax, F pyflakes). E501 is left out
127
+ # because the house style is a soft 100 columns that docstrings and measurement tables exceed on
128
+ # purpose; a limit the tree does not hold is a gate that is always red.
129
+
130
+ [tool.ruff.lint.per-file-ignores]
131
+ "src/prism/__init__.py" = ["E402"] # the BLAS thread pin must precede every other import
132
+ "src/prism/embodiment.py" = ["F401"]
133
+ "src/prism/grounding.py" = ["F401"]
134
+ "**/__init__.py" = ["F401"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+