agience-crystal 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 (80) hide show
  1. agience_crystal-0.1.0/LICENSE +202 -0
  2. agience_crystal-0.1.0/NOTICE +5 -0
  3. agience_crystal-0.1.0/PKG-INFO +149 -0
  4. agience_crystal-0.1.0/README.md +106 -0
  5. agience_crystal-0.1.0/pyproject.toml +115 -0
  6. agience_crystal-0.1.0/setup.cfg +4 -0
  7. agience_crystal-0.1.0/src/agience_crystal.egg-info/PKG-INFO +149 -0
  8. agience_crystal-0.1.0/src/agience_crystal.egg-info/SOURCES.txt +78 -0
  9. agience_crystal-0.1.0/src/agience_crystal.egg-info/dependency_links.txt +1 -0
  10. agience_crystal-0.1.0/src/agience_crystal.egg-info/requires.txt +20 -0
  11. agience_crystal-0.1.0/src/agience_crystal.egg-info/top_level.txt +1 -0
  12. agience_crystal-0.1.0/src/crystal/__init__.py +14 -0
  13. agience_crystal-0.1.0/src/crystal/config.py +40 -0
  14. agience_crystal-0.1.0/src/crystal/context.py +229 -0
  15. agience_crystal-0.1.0/src/crystal/crystal.py +562 -0
  16. agience_crystal-0.1.0/src/crystal/crystal_model.py +29 -0
  17. agience_crystal-0.1.0/src/crystal/dispatcher.py +326 -0
  18. agience_crystal-0.1.0/src/crystal/events.py +90 -0
  19. agience_crystal-0.1.0/src/crystal/evolution.py +322 -0
  20. agience_crystal-0.1.0/src/crystal/gateway_middleware.py +306 -0
  21. agience_crystal-0.1.0/src/crystal/host.py +649 -0
  22. agience_crystal-0.1.0/src/crystal/identity.py +145 -0
  23. agience_crystal-0.1.0/src/crystal/logging_config.py +138 -0
  24. agience_crystal-0.1.0/src/crystal/main.py +242 -0
  25. agience_crystal-0.1.0/src/crystal/manifest_base.py +45 -0
  26. agience_crystal-0.1.0/src/crystal/mantle.py +102 -0
  27. agience_crystal-0.1.0/src/crystal/mantle_client.py +215 -0
  28. agience_crystal-0.1.0/src/crystal/mcp_client.py +74 -0
  29. agience_crystal-0.1.0/src/crystal/ontology/__init__.py +46 -0
  30. agience_crystal-0.1.0/src/crystal/ontology/coupling.py +40 -0
  31. agience_crystal-0.1.0/src/crystal/ontology/driver.py +1100 -0
  32. agience_crystal-0.1.0/src/crystal/ontology/freshness.py +132 -0
  33. agience_crystal-0.1.0/src/crystal/ontology/geometry.py +1212 -0
  34. agience_crystal-0.1.0/src/crystal/ontology/lookup.py +596 -0
  35. agience_crystal-0.1.0/src/crystal/ontology/seed_lattice.py +601 -0
  36. agience_crystal-0.1.0/src/crystal/ontology/transducer.py +44 -0
  37. agience_crystal-0.1.0/src/crystal/operator_schema.py +120 -0
  38. agience_crystal-0.1.0/src/crystal/persona_registration.py +84 -0
  39. agience_crystal-0.1.0/src/crystal/push.py +265 -0
  40. agience_crystal-0.1.0/src/crystal/registry.py +86 -0
  41. agience_crystal-0.1.0/src/crystal/relay_manager.py +244 -0
  42. agience_crystal-0.1.0/src/crystal/test_operator_schema.py +118 -0
  43. agience_crystal-0.1.0/src/crystal/tests/test_context_seam.py +104 -0
  44. agience_crystal-0.1.0/src/crystal/topology.py +42 -0
  45. agience_crystal-0.1.0/src/crystal/type_registration.py +125 -0
  46. agience_crystal-0.1.0/src/crystal/type_registry.py +137 -0
  47. agience_crystal-0.1.0/src/crystal/web_serve.py +267 -0
  48. agience_crystal-0.1.0/tests/test_a_modifier_is_projected_not_positioned.py +191 -0
  49. agience_crystal-0.1.0/tests/test_an_operator_body_is_addressed_not_left_inline.py +142 -0
  50. agience_crystal-0.1.0/tests/test_crystal.py +166 -0
  51. agience_crystal-0.1.0/tests/test_crystal_does_not_import_origin.py +285 -0
  52. agience_crystal-0.1.0/tests/test_crystal_model.py +97 -0
  53. agience_crystal-0.1.0/tests/test_discharge_grants.py +131 -0
  54. agience_crystal-0.1.0/tests/test_dispatcher.py +335 -0
  55. agience_crystal-0.1.0/tests/test_embodiment_injection.py +946 -0
  56. agience_crystal-0.1.0/tests/test_every_crystal_bound_call_reaches_a_live_route.py +182 -0
  57. agience_crystal-0.1.0/tests/test_every_shipped_operation_dispatches.py +132 -0
  58. agience_crystal-0.1.0/tests/test_framework.py +108 -0
  59. agience_crystal-0.1.0/tests/test_gateway_middleware.py +450 -0
  60. agience_crystal-0.1.0/tests/test_host.py +130 -0
  61. agience_crystal-0.1.0/tests/test_host_header_routing.py +316 -0
  62. agience_crystal-0.1.0/tests/test_identity.py +44 -0
  63. agience_crystal-0.1.0/tests/test_identity_service_only.py +92 -0
  64. agience_crystal-0.1.0/tests/test_licence_is_declared_once.py +122 -0
  65. agience_crystal-0.1.0/tests/test_logging_config.py +220 -0
  66. agience_crystal-0.1.0/tests/test_mcp_tool_refs_resolve.py +141 -0
  67. agience_crystal-0.1.0/tests/test_no_test_can_pass_vacuously.py +153 -0
  68. agience_crystal-0.1.0/tests/test_ontology_store_injection.py +263 -0
  69. agience_crystal-0.1.0/tests/test_operators.py +110 -0
  70. agience_crystal-0.1.0/tests/test_persona_registration_contract.py +124 -0
  71. agience_crystal-0.1.0/tests/test_prism_discharge.py +171 -0
  72. agience_crystal-0.1.0/tests/test_relation_signature.py +408 -0
  73. agience_crystal-0.1.0/tests/test_retirement_is_derived.py +149 -0
  74. agience_crystal-0.1.0/tests/test_seed_lattice_no_forcings.py +248 -0
  75. agience_crystal-0.1.0/tests/test_the_ontology_has_one_alphabet.py +144 -0
  76. agience_crystal-0.1.0/tests/test_the_push_scan_is_exhaustive.py +98 -0
  77. agience_crystal-0.1.0/tests/test_the_wheel_ships_only_crystal.py +64 -0
  78. agience_crystal-0.1.0/tests/test_type_registration.py +50 -0
  79. agience_crystal-0.1.0/tests/test_type_registry.py +79 -0
  80. agience_crystal-0.1.0/tests/test_web_serve.py +404 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Ikailo Inc.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ Agience Crystal
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,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: agience-crystal
3
+ Version: 0.1.0
4
+ Summary: Agience Crystal — condensation, routing: signal to content type. The dispatcher/gateway fronting the chorus tekton services. Import name is `crystal`.
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-crystal
9
+ Project-URL: Issues, https://github.com/Agience/agience-crystal/issues
10
+ Keywords: agience,crystal,gateway,dispatcher,routing,content-type,mcp
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 :: Internet :: WWW/HTTP :: HTTP Servers
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: NOTICE
25
+ Requires-Dist: agience-prism>=0.1.2
26
+ Provides-Extra: service
27
+ Requires-Dist: fastapi>=0.110; extra == "service"
28
+ Requires-Dist: uvicorn[standard]>=0.27; extra == "service"
29
+ Requires-Dist: starlette>=0.36; extra == "service"
30
+ Requires-Dist: httpx>=0.27; extra == "service"
31
+ Requires-Dist: pydantic>=2; extra == "service"
32
+ Requires-Dist: python-jose[cryptography]>=3.3; extra == "service"
33
+ Requires-Dist: websockets>=12; extra == "service"
34
+ Requires-Dist: requests>=2.31; extra == "service"
35
+ Provides-Extra: ontology
36
+ Requires-Dist: numpy>=1.26; extra == "ontology"
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest>=8; extra == "dev"
39
+ Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
40
+ Requires-Dist: pytest-timeout>=2.2; extra == "dev"
41
+ Requires-Dist: build>=1.0; extra == "dev"
42
+ Dynamic: license-file
43
+
44
+ # Agience Crystal
45
+
46
+ [![PyPI](https://img.shields.io/pypi/v/agience-crystal)](https://pypi.org/project/agience-crystal/)
47
+ [![Python](https://img.shields.io/pypi/pyversions/agience-crystal)](https://pypi.org/project/agience-crystal/)
48
+ [![License](https://img.shields.io/pypi/l/agience-crystal)](LICENSE)
49
+ [![CI](https://github.com/Agience/agience-crystal/actions/workflows/ci.yml/badge.svg)](https://github.com/Agience/agience-crystal/actions/workflows/ci.yml)
50
+ [![Sponsor](https://img.shields.io/badge/Sponsor-Agience-EA4AAA?logo=githubsponsors&logoColor=white)](https://github.com/sponsors/Agience)
51
+
52
+ **Condensation and routing — signal to content type.**
53
+
54
+ Crystal condenses incoming signal into typed content and routes it. As the dispatcher/gateway it
55
+ maps a request by its content type to one of the chorus tekton services (aria, astra, iris, lumen,
56
+ ophan, sage, seraph) and carries the gateway concerns: identity, topology, and the MCP client.
57
+
58
+ It reaches everything **over the wire**; nothing links it. Origin is called at `ORIGIN_URI` over
59
+ HTTP, and the store is injected by the host rather than imported — crystal imports neither.
60
+
61
+ ## Install
62
+
63
+ pip install agience-crystal # the contract and the ontology driver
64
+ pip install agience-crystal[service] # the gateway that boots — fastapi, uvicorn, httpx, …
65
+ pip install agience-crystal[ontology] # adds the coordinate, and numpy with it
66
+
67
+ **The three are a measured split, not a preference.** 23 of crystal's 34 non-test modules import on
68
+ `agience-prism` and the stdlib alone; 11 are the ones that serve, and those are what `[service]`
69
+ carries. `[ontology]` is separate again because `crystal.ontology.geometry` imports numpy at module
70
+ scope, and a gateway that never computes a coordinate should not install it.
71
+
72
+ Requires Python 3.11 or newer. The one base dependency is
73
+ [`agience-prism`](https://pypi.org/project/agience-prism/), Apache-2.0, whose own base install has
74
+ no dependencies at all.
75
+
76
+ ## Run it
77
+
78
+ Crystal is two servable surfaces on the same package, and they are different jobs.
79
+
80
+ **The gateway** — routes a request by content type to the tekton that owns it:
81
+
82
+ pip install 'agience-crystal[service]'
83
+ CRYSTAL_HOST=127.0.0.1 CRYSTAL_PORT=8085 \
84
+ MANTLE_URI=http://localhost:8082 ORIGIN_URI=http://localhost:8080 \
85
+ python -m crystal.main
86
+
87
+ **The host** — serves a set of tektons discovered at boot, assembling each with an embodiment:
88
+
89
+ MCP_HOST=127.0.0.1 MCP_PORT=8086 python -m crystal.host
90
+
91
+ Bind loopback and put a reverse proxy in front of anything public.
92
+
93
+ Configuration is the environment, and it is read in two places:
94
+
95
+ | read by | variables |
96
+ |---|---|
97
+ | `config.py` — the gateway | `CRYSTAL_HOST`, `CRYSTAL_PORT` (8085), `CRYSTAL_EVENTS_ENABLED`, `MANTLE_URI`, `MANTLE_API_KEY`, `ORIGIN_URI`, `KEYS_DIR`, `EMBEDDINGS_URI`, `EMBEDDINGS_API_KEY`, `TYPE_CONTENT_TYPE`, `LOG_LEVEL` |
98
+ | `host.py` — the tekton host | `MCP_HOST`, `MCP_PORT`, `CRYSTAL_UPSTREAMS`, `CRYSTAL_APEX_PERSONA`, `CRYSTAL_HOST_DOMAIN`, `CRYSTAL_TLS_CERT`, `CRYSTAL_TLS_KEY`, `LOG_LEVEL` |
99
+
100
+ `type_registration.py` additionally reads `CRYSTAL_URI`, `CHORUS_PUBLIC_URI` and
101
+ `AGIENCE_SERVER_HOST_URI` when a tekton pushes its types.
102
+
103
+ A gateway with no Mantle and no Origin still starts; it answers what it can reach.
104
+
105
+ ## The embodiment is injected, never imported
106
+
107
+ `import crystal` pulls no instrument and no numpy — checked in CI on a bare install, not asserted
108
+ here. The embodiment that measures arrives from the host at assembly, which is what lets the same
109
+ crystal run on a full node and on a constrained store. The two test files that *do* reach an
110
+ instrument (`tests/test_crystal.py`, `tests/test_embodiment_injection.py`) are where the host lives:
111
+ they assemble a real node, and that reach is test-only by design.
112
+
113
+ ## Layout
114
+
115
+ | Path | Purpose |
116
+ |---|---|
117
+ | `src/crystal/` | The dispatcher/gateway service — dispatch, identity, topology, MCP client, registries, host and entrypoint. |
118
+ | `src/crystal/ontology/` | The coordinate: coupling, geometry, lookup, freshness, transducer. Behind the `ontology` extra, because `geometry` imports numpy at module scope. |
119
+ | `src/types/` | Builtin content-type skeletons — `type.json` plus optional `schema.json`, `behaviors.json`, `preview.json` and `handlers/`. Repository content, read by a test; **not shipped in the wheel**, because nothing at runtime loads it from the package. |
120
+ | `tests/` | The suite, including the ratchets that hold the import boundaries above. |
121
+ | `pyproject.toml` | Build, packaging and every dependency. There is no `requirements.txt` — the `service` extra is the one list. |
122
+
123
+ A tekton owns its own types. Each one ships `ui/<top>/<sub>/type.json` and pushes it to the
124
+ gateway's `/register` endpoint at host startup, signed with a service JWT. Types and tektons are
125
+ gateway state; the store never sees them.
126
+
127
+ ## Where it sits
128
+
129
+ agience-prism the contract, dependency-free crystal depends on it
130
+ agience-crystal this repository the gateway
131
+ agience-ember the observer unit depends on crystal, never the reverse
132
+ agience-mantle the store reached over the wire, never imported
133
+
134
+ Crystal is **below** ember and mantle in the dependency graph. That direction is what the licence
135
+ section below is about.
136
+
137
+ ## Contributing
138
+
139
+ See [CONTRIBUTING.md](CONTRIBUTING.md). The suite needs two things the package does not — an
140
+ `AGIENCE_BUNDLE_ROOT` and an installed `agience-ember` — and that file says why.
141
+
142
+ ## License
143
+
144
+ Apache-2.0 (see [LICENSE](LICENSE) and [NOTICE](NOTICE)).
145
+
146
+ The permissive licence is load-bearing, and `pyproject.toml` argues it at length: `pip install
147
+ agience-crystal` must not resolve copyleft onto the install path. That is why crystal declares no
148
+ dependency on ember even though ember sits above it. A dependency that would pull a copyleft package
149
+ onto the install path is a design conversation, not a dependency bump.
@@ -0,0 +1,106 @@
1
+ # Agience Crystal
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/agience-crystal)](https://pypi.org/project/agience-crystal/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/agience-crystal)](https://pypi.org/project/agience-crystal/)
5
+ [![License](https://img.shields.io/pypi/l/agience-crystal)](LICENSE)
6
+ [![CI](https://github.com/Agience/agience-crystal/actions/workflows/ci.yml/badge.svg)](https://github.com/Agience/agience-crystal/actions/workflows/ci.yml)
7
+ [![Sponsor](https://img.shields.io/badge/Sponsor-Agience-EA4AAA?logo=githubsponsors&logoColor=white)](https://github.com/sponsors/Agience)
8
+
9
+ **Condensation and routing — signal to content type.**
10
+
11
+ Crystal condenses incoming signal into typed content and routes it. As the dispatcher/gateway it
12
+ maps a request by its content type to one of the chorus tekton services (aria, astra, iris, lumen,
13
+ ophan, sage, seraph) and carries the gateway concerns: identity, topology, and the MCP client.
14
+
15
+ It reaches everything **over the wire**; nothing links it. Origin is called at `ORIGIN_URI` over
16
+ HTTP, and the store is injected by the host rather than imported — crystal imports neither.
17
+
18
+ ## Install
19
+
20
+ pip install agience-crystal # the contract and the ontology driver
21
+ pip install agience-crystal[service] # the gateway that boots — fastapi, uvicorn, httpx, …
22
+ pip install agience-crystal[ontology] # adds the coordinate, and numpy with it
23
+
24
+ **The three are a measured split, not a preference.** 23 of crystal's 34 non-test modules import on
25
+ `agience-prism` and the stdlib alone; 11 are the ones that serve, and those are what `[service]`
26
+ carries. `[ontology]` is separate again because `crystal.ontology.geometry` imports numpy at module
27
+ scope, and a gateway that never computes a coordinate should not install it.
28
+
29
+ Requires Python 3.11 or newer. The one base dependency is
30
+ [`agience-prism`](https://pypi.org/project/agience-prism/), Apache-2.0, whose own base install has
31
+ no dependencies at all.
32
+
33
+ ## Run it
34
+
35
+ Crystal is two servable surfaces on the same package, and they are different jobs.
36
+
37
+ **The gateway** — routes a request by content type to the tekton that owns it:
38
+
39
+ pip install 'agience-crystal[service]'
40
+ CRYSTAL_HOST=127.0.0.1 CRYSTAL_PORT=8085 \
41
+ MANTLE_URI=http://localhost:8082 ORIGIN_URI=http://localhost:8080 \
42
+ python -m crystal.main
43
+
44
+ **The host** — serves a set of tektons discovered at boot, assembling each with an embodiment:
45
+
46
+ MCP_HOST=127.0.0.1 MCP_PORT=8086 python -m crystal.host
47
+
48
+ Bind loopback and put a reverse proxy in front of anything public.
49
+
50
+ Configuration is the environment, and it is read in two places:
51
+
52
+ | read by | variables |
53
+ |---|---|
54
+ | `config.py` — the gateway | `CRYSTAL_HOST`, `CRYSTAL_PORT` (8085), `CRYSTAL_EVENTS_ENABLED`, `MANTLE_URI`, `MANTLE_API_KEY`, `ORIGIN_URI`, `KEYS_DIR`, `EMBEDDINGS_URI`, `EMBEDDINGS_API_KEY`, `TYPE_CONTENT_TYPE`, `LOG_LEVEL` |
55
+ | `host.py` — the tekton host | `MCP_HOST`, `MCP_PORT`, `CRYSTAL_UPSTREAMS`, `CRYSTAL_APEX_PERSONA`, `CRYSTAL_HOST_DOMAIN`, `CRYSTAL_TLS_CERT`, `CRYSTAL_TLS_KEY`, `LOG_LEVEL` |
56
+
57
+ `type_registration.py` additionally reads `CRYSTAL_URI`, `CHORUS_PUBLIC_URI` and
58
+ `AGIENCE_SERVER_HOST_URI` when a tekton pushes its types.
59
+
60
+ A gateway with no Mantle and no Origin still starts; it answers what it can reach.
61
+
62
+ ## The embodiment is injected, never imported
63
+
64
+ `import crystal` pulls no instrument and no numpy — checked in CI on a bare install, not asserted
65
+ here. The embodiment that measures arrives from the host at assembly, which is what lets the same
66
+ crystal run on a full node and on a constrained store. The two test files that *do* reach an
67
+ instrument (`tests/test_crystal.py`, `tests/test_embodiment_injection.py`) are where the host lives:
68
+ they assemble a real node, and that reach is test-only by design.
69
+
70
+ ## Layout
71
+
72
+ | Path | Purpose |
73
+ |---|---|
74
+ | `src/crystal/` | The dispatcher/gateway service — dispatch, identity, topology, MCP client, registries, host and entrypoint. |
75
+ | `src/crystal/ontology/` | The coordinate: coupling, geometry, lookup, freshness, transducer. Behind the `ontology` extra, because `geometry` imports numpy at module scope. |
76
+ | `src/types/` | Builtin content-type skeletons — `type.json` plus optional `schema.json`, `behaviors.json`, `preview.json` and `handlers/`. Repository content, read by a test; **not shipped in the wheel**, because nothing at runtime loads it from the package. |
77
+ | `tests/` | The suite, including the ratchets that hold the import boundaries above. |
78
+ | `pyproject.toml` | Build, packaging and every dependency. There is no `requirements.txt` — the `service` extra is the one list. |
79
+
80
+ A tekton owns its own types. Each one ships `ui/<top>/<sub>/type.json` and pushes it to the
81
+ gateway's `/register` endpoint at host startup, signed with a service JWT. Types and tektons are
82
+ gateway state; the store never sees them.
83
+
84
+ ## Where it sits
85
+
86
+ agience-prism the contract, dependency-free crystal depends on it
87
+ agience-crystal this repository the gateway
88
+ agience-ember the observer unit depends on crystal, never the reverse
89
+ agience-mantle the store reached over the wire, never imported
90
+
91
+ Crystal is **below** ember and mantle in the dependency graph. That direction is what the licence
92
+ section below is about.
93
+
94
+ ## Contributing
95
+
96
+ See [CONTRIBUTING.md](CONTRIBUTING.md). The suite needs two things the package does not — an
97
+ `AGIENCE_BUNDLE_ROOT` and an installed `agience-ember` — and that file says why.
98
+
99
+ ## License
100
+
101
+ Apache-2.0 (see [LICENSE](LICENSE) and [NOTICE](NOTICE)).
102
+
103
+ The permissive licence is load-bearing, and `pyproject.toml` argues it at length: `pip install
104
+ agience-crystal` must not resolve copyleft onto the install path. That is why crystal declares no
105
+ dependency on ember even though ember sits above it. A dependency that would pull a copyleft package
106
+ onto the install path is a design conversation, not a dependency bump.
@@ -0,0 +1,115 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "agience-crystal"
7
+ version = "0.1.0"
8
+ description = "Agience Crystal — condensation, routing: signal to content type. The dispatcher/gateway fronting the chorus tekton services. Import name is `crystal`."
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", "crystal", "gateway", "dispatcher", "routing", "content-type", "mcp"]
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 :: Internet :: WWW/HTTP :: HTTP Servers",
23
+ "Topic :: Software Development :: Libraries :: Python Modules",
24
+ "Typing :: Typed",
25
+ ]
26
+
27
+ # The base install is one package, and the licence is why.
28
+ #
29
+ # Crystal is Apache-2.0 and `pip install agience-crystal` must not resolve copyleft onto the install
30
+ # path. The AGPL components of this system — origin, ember, chorus — are SINKS: nothing imports
31
+ # them, and no dependency line here names one. A dependency naming an AGPL package is that violation
32
+ # in its most literal form, because it resolves copyleft onto the install path whether or not a line
33
+ # of it is ever imported.
34
+ #
35
+ # Origin is REACHED, at `ORIGIN_URI` over HTTP (`identity.py`, `mantle_client.py`) — a service call,
36
+ # not a link, which is the whole distinction. `tests/test_crystal_does_not_import_origin.py` holds
37
+ # `crystal -> origin` at zero import sites by AST over non-test `src/`, at any scope including lazy
38
+ # in-function imports, and its control proves the scan is not vacuous.
39
+ #
40
+ # `agience-ember` and `agience-mantle` are absent for the same reason plus one more: crystal sits
41
+ # BELOW both in the DAG, so declaring either would invert it. The ontology reads a store and names
42
+ # none — the host injects one through `crystal.ontology.driver.set_default_store_provider`.
43
+ dependencies = [
44
+ # The contract. `crystal_model.py` re-exports it wholesale from `prism.crystal_model`, and
45
+ # `crystal.py` imports `prism.embodiment` at module scope for the injection contract, so a
46
+ # crystal install without prism fails at `import crystal` rather than deep in a flow.
47
+ #
48
+ # The distribution is `agience-prism`. The REPOSITORY is `agience-prism-py`, and the two names
49
+ # differ on purpose; `agience-prism-py` is not a distribution and resolves to nothing on PyPI.
50
+ "agience-prism>=0.1.2",
51
+ ]
52
+
53
+ [project.urls]
54
+ Homepage = "https://agience.ai"
55
+ Source = "https://github.com/Agience/agience-crystal"
56
+ Issues = "https://github.com/Agience/agience-crystal/issues"
57
+
58
+ [project.optional-dependencies]
59
+ # The gateway runtime — what `crystal.main`, `crystal.host` and the clients beneath them import.
60
+ #
61
+ # An extra rather than base dependencies because the base install is the CONTRACT, and it is a
62
+ # measured split rather than a preference: 23 of crystal's 34 non-test modules import on
63
+ # `agience-prism` and the stdlib alone — `crystal_model`, `config`, `context`, `crystal`,
64
+ # `registry`, `topology`, `evolution`, `manifest_base`, `operator_schema`, `type_registry`,
65
+ # `relay_manager`, `persona_registration`, `gateway_middleware`, `logging_config`, `web_serve` and
66
+ # the ontology's driver, lookup, coupling, freshness, transducer and seed_lattice. The other 11 are
67
+ # the ones that SERVE, and this is their line.
68
+ #
69
+ # `pip install agience-crystal` gives you the contract and the ontology driver.
70
+ # `pip install agience-crystal[service]` gives you a gateway that boots.
71
+ #
72
+ # Every entry is imported directly at module scope in non-test `src/` — starlette included, which
73
+ # arrives transitively with fastapi but is imported by name in `host.py`. Declaring what you import
74
+ # is one rule: an edge that only resolves through someone else's manifest is a fact about that
75
+ # manifest, not a declaration. Floors rather than pins, because this is a library and a library that
76
+ # pins exactly cannot be co-installed with anything wanting the same package.
77
+ service = [
78
+ "fastapi>=0.110", # dispatcher, host, main, mcp_client
79
+ "uvicorn[standard]>=0.27", # host.run / main.__main__ serve on it
80
+ "starlette>=0.36", # host.py, by name
81
+ "httpx>=0.27", # dispatcher, identity, mantle, mantle_client, mcp_client,
82
+ # type_registration — the gateway talks HTTP, not MCP-lib
83
+ "pydantic>=2", # main.py request/response models
84
+ "python-jose[cryptography]>=3.3", # identity.py — platform-service JWTs
85
+ "websockets>=12", # events.py — the change-feed consumer
86
+ "requests>=2.31", # push.py — Mantle REST
87
+ ]
88
+
89
+ # The coordinate — `crystal.ontology.{driver,geometry,lookup,coupling}`, where IC, the
90
+ # Jiang-Conrath coordinate, `jc_tree`, the lexical entry index and the relation coupling signs live.
91
+ #
92
+ # An extra rather than a base dependency because `import crystal` pulls no instrument and no numpy:
93
+ # the embodiment that measures is INJECTED by the host at assembly, so the same crystal runs on a
94
+ # full node and on a constrained store. `crystal.ontology.geometry` imports numpy at module scope
95
+ # (the dense JL basis is numpy arithmetic), so it goes behind a subpackage a gateway-only install
96
+ # never imports. `tests/test_embodiment_injection.py` holds the base install to numpy and the
97
+ # stdlib, so any import outside that allow-list fails there.
98
+ #
99
+ # A floor rather than a pin: this is a library extra, and a bare requirement would be satisfied by
100
+ # whatever the machine already has.
101
+ ontology = ["numpy>=1.26"]
102
+
103
+ # The test runners. `pytest-asyncio` because one test file is async, and `build` because
104
+ # `tests/test_the_wheel_ships_only_crystal.py` builds a real wheel and reads what came out.
105
+ dev = ["pytest>=8", "pytest-asyncio>=0.24", "pytest-timeout>=2.2", "build>=1.0"]
106
+
107
+ [tool.setuptools.packages.find]
108
+ where = ["src"]
109
+ # `include` is load-bearing, not tidiness. `src/` also holds `tests/` (one geometry memo test) and
110
+ # `types/` (the builtin content-type skeletons, JSON with no `.py`). Neither is a package, so
111
+ # `find` does not return them — but without this filter setuptools still wrote both into
112
+ # `top_level.txt` and shipped `src/tests/` in the wheel, so `pip install agience-crystal` installed
113
+ # a top-level `tests` module into site-packages and squatted that name for everything else in the
114
+ # environment. `tests/test_the_wheel_ships_only_crystal.py` holds it.
115
+ include = ["crystal*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+