animas 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- animas-1.0.0/LICENSE +21 -0
- animas-1.0.0/NOTICE +120 -0
- animas-1.0.0/PKG-INFO +195 -0
- animas-1.0.0/README.md +183 -0
- animas-1.0.0/pyproject.toml +44 -0
- animas-1.0.0/pyproject.toml.orig +41 -0
- animas-1.0.0/src/animas/__init__.py +182 -0
- animas-1.0.0/src/animas/core.py +2257 -0
- animas-1.0.0/src/animas/events.py +481 -0
- animas-1.0.0/src/animas/fs.py +390 -0
- animas-1.0.0/src/animas/hmr.py +1015 -0
- animas-1.0.0/src/animas/include.py +1400 -0
- animas-1.0.0/src/animas/jsexpr.py +799 -0
- animas-1.0.0/src/animas/loader.py +604 -0
- animas-1.0.0/src/animas/logger.py +475 -0
- animas-1.0.0/src/animas/py.typed +0 -0
- animas-1.0.0/src/animas/reflect.py +584 -0
- animas-1.0.0/src/animas/registry.py +288 -0
- animas-1.0.0/src/animas/schema.py +1048 -0
- animas-1.0.0/src/animas/timer.py +343 -0
- animas-1.0.0/src/animas/tree.py +1025 -0
- animas-1.0.0/src/animas/utils.py +374 -0
animas-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Magitech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
animas-1.0.0/NOTICE
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Animas — Python kernel for Magitech
|
|
2
|
+
==================================
|
|
3
|
+
|
|
4
|
+
Animas is a Python reimplementation of the kernel paradigm formalized in
|
|
5
|
+
"A Programming Paradigm for Spatiotemporal Composability" (arXiv:2608.25512,
|
|
6
|
+
https://arxiv.org/abs/2608.25512) and realized in the Cordis framework
|
|
7
|
+
(https://github.com/cordiverse/cordis). The port target since 2026-11-23 is
|
|
8
|
+
canonical Cordis v4.0.0-rc.13 (commit bc9fae7); the earlier conformance
|
|
9
|
+
reference was DeepSeek Harness (https://github.com/deepseek-ai/deepseek-harness)
|
|
10
|
+
at pin fcc0ad46 (release dsh-v0.2.2-rc.1), retained here as historical
|
|
11
|
+
provenance. Animas's schema and utility surfaces also derive from the MIT-licensed
|
|
12
|
+
schemastery and cosmokit libraries, whose notices are reproduced below.
|
|
13
|
+
|
|
14
|
+
Animas is licensed under the MIT License by Magitech (see LICENSE). The
|
|
15
|
+
upstream projects are also MIT-licensed; their copyright and permission
|
|
16
|
+
notices are reproduced below as required by those licenses.
|
|
17
|
+
|
|
18
|
+
--------------------------------------------------------------------------
|
|
19
|
+
Cordis — https://github.com/cordiverse/cordis
|
|
20
|
+
--------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
MIT License
|
|
23
|
+
|
|
24
|
+
Copyright (c) 2021-present Shigma
|
|
25
|
+
|
|
26
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
28
|
+
in the Software without restriction, including without limitation the rights
|
|
29
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
30
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
31
|
+
furnished to do so, subject to the following conditions:
|
|
32
|
+
|
|
33
|
+
The above copyright notice and this permission notice shall be included in all
|
|
34
|
+
copies or substantial portions of the Software.
|
|
35
|
+
|
|
36
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
37
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
38
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
39
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
40
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
41
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
42
|
+
SOFTWARE.
|
|
43
|
+
|
|
44
|
+
--------------------------------------------------------------------------
|
|
45
|
+
DeepSeek Harness — https://github.com/deepseek-ai/deepseek-harness
|
|
46
|
+
--------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
MIT License
|
|
49
|
+
|
|
50
|
+
Copyright (c) 2026 DeepSeek
|
|
51
|
+
|
|
52
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
53
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
54
|
+
in the Software without restriction, including without limitation the rights
|
|
55
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
56
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
57
|
+
furnished to do so, subject to the following conditions:
|
|
58
|
+
|
|
59
|
+
The above copyright notice and this permission notice shall be included in all
|
|
60
|
+
copies or substantial portions of the Software.
|
|
61
|
+
|
|
62
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
63
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
64
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
65
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
66
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
67
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
68
|
+
SOFTWARE.
|
|
69
|
+
|
|
70
|
+
--------------------------------------------------------------------------
|
|
71
|
+
schemastery — https://github.com/cordiverse/schemastery
|
|
72
|
+
--------------------------------------------------------------------------
|
|
73
|
+
|
|
74
|
+
MIT License
|
|
75
|
+
|
|
76
|
+
Copyright (c) 2021-present Shigma
|
|
77
|
+
|
|
78
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
79
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
80
|
+
in the Software without restriction, including without limitation the rights
|
|
81
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
82
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
83
|
+
furnished to do so, subject to the following conditions:
|
|
84
|
+
|
|
85
|
+
The above copyright notice and this permission notice shall be included in all
|
|
86
|
+
copies or substantial portions of the Software.
|
|
87
|
+
|
|
88
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
89
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
90
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
91
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
92
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
93
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
94
|
+
SOFTWARE.
|
|
95
|
+
|
|
96
|
+
--------------------------------------------------------------------------
|
|
97
|
+
cosmokit — https://github.com/cordiverse/cosmokit
|
|
98
|
+
--------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
MIT License
|
|
101
|
+
|
|
102
|
+
Copyright (c) 2021-present Shigma
|
|
103
|
+
|
|
104
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
105
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
106
|
+
in the Software without restriction, including without limitation the rights
|
|
107
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
108
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
109
|
+
furnished to do so, subject to the following conditions:
|
|
110
|
+
|
|
111
|
+
The above copyright notice and this permission notice shall be included in all
|
|
112
|
+
copies or substantial portions of the Software.
|
|
113
|
+
|
|
114
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
115
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
116
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
117
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
118
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
119
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
120
|
+
SOFTWARE.
|
animas-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: animas
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Animas: The Composable Micro-Kernel by Magitech
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
Requires-Dist: pydantic>=2.14.3
|
|
9
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# Animas
|
|
14
|
+
|
|
15
|
+
The standalone, lightweight composable micro-kernel powering **Magitech**.
|
|
16
|
+
|
|
17
|
+
Built around the core philosophy: **"Everything is a Component"**.
|
|
18
|
+
|
|
19
|
+
Documentation: [AGENTS.md](AGENTS.md) · [CONTEXT.md](CONTEXT.md) · [docs/adr/](docs/adr/)
|
|
20
|
+
|
|
21
|
+
[](.github/workflows/ci.yml)
|
|
22
|
+
[](pyproject.toml)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Status
|
|
27
|
+
|
|
28
|
+
Animas is at `1.0.0`. **The public API is now covered by a compatibility policy:** additions and fixes may arrive in `1.x`, but breaking changes require `2.0.0` and a deprecation period where feasible. See [COMPATIBILITY.md](docs/COMPATIBILITY.md). Animas is an independent project; the research paper remains its design invariant and the Cordis conformance work is a completed historical milestone recorded in [PARITY.md](PARITY.md) and [ADR 0017](docs/adr/0017-independence-and-stability.md).
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Lineage
|
|
33
|
+
|
|
34
|
+
Animas is the Python implementation of the kernel paradigm formalized in
|
|
35
|
+
Cordis — *"A Programming Paradigm for Spatiotemporal Composability"*
|
|
36
|
+
([arXiv:2608.25512](https://arxiv.org/abs/2608.25512)) — as realized by
|
|
37
|
+
[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), the
|
|
38
|
+
Cordis-powered harness whose plugin kernel is built on reversible effects,
|
|
39
|
+
reactive coeffects and a shared context.
|
|
40
|
+
|
|
41
|
+
The 0.3.0 kernel was originally built and conformance-checked against DeepSeek
|
|
42
|
+
Harness at pin `fcc0ad46` (`dsh v0.2.2-rc.1`); that pin and its DONE/PARTIAL
|
|
43
|
+
verdicts are historical and are recorded in the
|
|
44
|
+
[magitech-harness parity map](https://github.com/magitech-ai/magitech-harness/blob/main/PARITY.md).
|
|
45
|
+
The conformance milestone was completed against canonical Cordis `v4.0.0-rc.13`
|
|
46
|
+
(commit `bc9fae7`), then the parity verdicts in [PARITY.md](PARITY.md) and
|
|
47
|
+
[ADRs 0013–0016](docs/adr/). Animas is now independent: future changes are
|
|
48
|
+
judged against the paper's invariants and Animas's own compatibility policy, not
|
|
49
|
+
against upstream Cordis releases. The asyncio runtime, component surface and
|
|
50
|
+
product built on top are ours; the theory and reference kernel are credited in
|
|
51
|
+
[NOTICE](NOTICE). Provenance is recorded, not erased.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
Animas is not published to PyPI at this time (1.0.0 is the release candidate for a publisher to be added by the maintainer). Install from a repository checkout:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
git clone https://github.com/magitech-ai/animas.git
|
|
61
|
+
cd animas
|
|
62
|
+
uv sync
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Requires Python 3.12+ and [`uv`](https://docs.astral.sh/uv/).
|
|
66
|
+
|
|
67
|
+
## Profiles
|
|
68
|
+
|
|
69
|
+
Load a declarative profile from Python with `load_profile(ctx, path)`. Animas is a library kernel: it does not ship a CLI, HTTP server, or scaffolding command. Host applications build those surfaces on top.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Quickstart
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
import asyncio
|
|
77
|
+
|
|
78
|
+
from animas import Context, Service
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class GreeterService(Service):
|
|
82
|
+
def __init__(self, ctx: Context):
|
|
83
|
+
super().__init__(ctx, "greeter")
|
|
84
|
+
|
|
85
|
+
def greet(self, name: str) -> str:
|
|
86
|
+
return f"Greetings, {name}!"
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
async def main():
|
|
90
|
+
ctx = Context()
|
|
91
|
+
|
|
92
|
+
ctx.use(GreeterService)
|
|
93
|
+
|
|
94
|
+
await ctx.flush()
|
|
95
|
+
|
|
96
|
+
print(ctx.greeter.greet("Magitech"))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
asyncio.run(main())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Configuration
|
|
103
|
+
|
|
104
|
+
Profiles compose components from YAML. Each entry is a `module:component` target, or a mapping with a `config` block:
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
components:
|
|
108
|
+
- my_app:greeter
|
|
109
|
+
- name: my_app:worker
|
|
110
|
+
config:
|
|
111
|
+
mode: turbo
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Load a profile with `load_profile(ctx, "animas.yaml")`. Environment variables interpolate as `${VAR}`, `${env.VAR}`, or `${VAR:default}`; a full-match interpolation coerces `"true"` / `"false"` (any case) / numbers to `bool` / `int` / `float`. See `src/animas/loader.py`.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Primitives
|
|
119
|
+
|
|
120
|
+
* **`Context`**: Central dependency container and service registry. Sub-contexts (`ctx.extend()`, `ctx.isolate()`) provide isolated realms for subagents and sandboxed components.
|
|
121
|
+
|
|
122
|
+
* **`Service`**: Base class for named capabilities mounted onto `ctx`.
|
|
123
|
+
|
|
124
|
+
* **`Fiber`**: Runtime state machine (`PENDING` ➔ `LOADING` ➔ `ACTIVE` ➔ `UNLOADING` ➔ `DISPOSED`; `FAILED` on error). Handles deferred loading via `inject = [...]`.
|
|
125
|
+
|
|
126
|
+
`flush()` drains scheduled tasks and returns, so a component whose injected service never appears simply stays `PENDING`. Call `ctx.check_pending_cycles()` after a boot drain to raise instead, with the services each stuck component waits for and, when the components declare what they serve (`provide` / `provides` / `services`), the closed loop by name: `circular dependency between components: a -> b -> a`.
|
|
127
|
+
|
|
128
|
+
* **Reversible Effects (`ctx.effect`)**: Any registration, tool addition, or watcher returns a disposer. When a component unloads, all effects unwind cleanly in reverse order (LIFO).
|
|
129
|
+
|
|
130
|
+
* **The 5 Event Modes**:
|
|
131
|
+
* `emit`: Synchronous broadcast (fire-and-forget).
|
|
132
|
+
* `parallel`: Asynchronous concurrent broadcast. Every listener settles before anything is reported: one failure re-raises the original exception unchanged, two or more raise an `ExceptionGroup` naming each failing listener in registration order.
|
|
133
|
+
* `serial`: Sequential async execution; bails on first non-None, non-False result.
|
|
134
|
+
* `bail`: Synchronous version of serial.
|
|
135
|
+
* `waterfall`: Around-middleware pipeline passing `(*args, next)`. Enables non-invasive request rewrites, security guards, and vetoes.
|
|
136
|
+
|
|
137
|
+
* **Service Isolation Realms (`ctx.isolate`)**: Child scopes that prevent service leakage or pollution to/from parent contexts.
|
|
138
|
+
|
|
139
|
+
* **Declarative YAML Profiles (`load_profile`)**: Composes ordered bundles and component entries dynamically from YAML configuration.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Subsystems
|
|
144
|
+
|
|
145
|
+
Every capability is a service mounted on a `Context`. The kernel ships these modules under `src/animas/`:
|
|
146
|
+
|
|
147
|
+
| Area | Modules | What they do |
|
|
148
|
+
| --- | --- | --- |
|
|
149
|
+
| Core | `core`, `events`, `tree`, `registry`, `reflect` | Context and service registry, the 5 event modes, loader entry tree and composite component groups, component runtime registry, service introspection |
|
|
150
|
+
| Loading & config | `loader`, `include`, `schema`, `utils` | YAML profile loading, module resolution, multi-file includes with journaling and patches, declarative schema validation, shared utility helpers (plain-object checks, time, binary) |
|
|
151
|
+
| Runtime services | `timer`, `logger`, `hmr`, `fs` | Reversible timers (timeouts, intervals, debounce, throttle), structured namespaced logging, hot module replacement, and the filesystem service with mountable providers and routed watches |
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Development
|
|
156
|
+
|
|
157
|
+
`animas` enforces **100% statement and 100% branch test coverage** (`--cov-fail-under=100` in `pyproject.toml`):
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
uv run pytest
|
|
161
|
+
uv run ruff check src tests
|
|
162
|
+
uv run ruff format --check src tests
|
|
163
|
+
uv run mypy src
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
* `tests/unit/animas/`: Mirrors `src/` 1:1 — core, events, loader, timer, fs, and every other module.
|
|
167
|
+
* `tests/integration/`: End-to-end multi-component pipeline, cascade disposal, and subagent isolation.
|
|
168
|
+
|
|
169
|
+
See [AGENTS.md](AGENTS.md) for the full engineering standards.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Documentation
|
|
174
|
+
|
|
175
|
+
* [AGENTS.md](AGENTS.md) — agent guidelines and engineering standards.
|
|
176
|
+
* [CONTEXT.md](CONTEXT.md) — canonical vocabulary: context, service, component entrypoint, waterfall, disposer.
|
|
177
|
+
* [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md) — 1.0 public API and versioning policy.
|
|
178
|
+
* [docs/adr/](docs/adr/) — architecture decision records (waterfall pipeline, disposer callables, hierarchical contexts, independence).
|
|
179
|
+
* [docs/agents/](docs/agents/) — domain docs, issue tracker, and triage labels.
|
|
180
|
+
* [NOTICE](NOTICE) — upstream MIT attributions and lineage.
|
|
181
|
+
* [PARITY.md](PARITY.md) — completed rc.13 conformance milestone and verdicts (historical record).
|
|
182
|
+
|
|
183
|
+
## Contributing
|
|
184
|
+
|
|
185
|
+
Follow [AGENTS.md](AGENTS.md): strict TDD, 100% coverage floor, `ruff`, strict `mypy`, `uv` exclusively.
|
|
186
|
+
|
|
187
|
+
## Community
|
|
188
|
+
|
|
189
|
+
Report bugs and request features via [GitHub Issues](https://github.com/magitech-ai/animas/issues).
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT License — Copyright (c) 2026 Magitech. See [LICENSE](LICENSE).
|
animas-1.0.0/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Animas
|
|
2
|
+
|
|
3
|
+
The standalone, lightweight composable micro-kernel powering **Magitech**.
|
|
4
|
+
|
|
5
|
+
Built around the core philosophy: **"Everything is a Component"**.
|
|
6
|
+
|
|
7
|
+
Documentation: [AGENTS.md](AGENTS.md) · [CONTEXT.md](CONTEXT.md) · [docs/adr/](docs/adr/)
|
|
8
|
+
|
|
9
|
+
[](.github/workflows/ci.yml)
|
|
10
|
+
[](pyproject.toml)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Status
|
|
15
|
+
|
|
16
|
+
Animas is at `1.0.0`. **The public API is now covered by a compatibility policy:** additions and fixes may arrive in `1.x`, but breaking changes require `2.0.0` and a deprecation period where feasible. See [COMPATIBILITY.md](docs/COMPATIBILITY.md). Animas is an independent project; the research paper remains its design invariant and the Cordis conformance work is a completed historical milestone recorded in [PARITY.md](PARITY.md) and [ADR 0017](docs/adr/0017-independence-and-stability.md).
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Lineage
|
|
21
|
+
|
|
22
|
+
Animas is the Python implementation of the kernel paradigm formalized in
|
|
23
|
+
Cordis — *"A Programming Paradigm for Spatiotemporal Composability"*
|
|
24
|
+
([arXiv:2608.25512](https://arxiv.org/abs/2608.25512)) — as realized by
|
|
25
|
+
[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), the
|
|
26
|
+
Cordis-powered harness whose plugin kernel is built on reversible effects,
|
|
27
|
+
reactive coeffects and a shared context.
|
|
28
|
+
|
|
29
|
+
The 0.3.0 kernel was originally built and conformance-checked against DeepSeek
|
|
30
|
+
Harness at pin `fcc0ad46` (`dsh v0.2.2-rc.1`); that pin and its DONE/PARTIAL
|
|
31
|
+
verdicts are historical and are recorded in the
|
|
32
|
+
[magitech-harness parity map](https://github.com/magitech-ai/magitech-harness/blob/main/PARITY.md).
|
|
33
|
+
The conformance milestone was completed against canonical Cordis `v4.0.0-rc.13`
|
|
34
|
+
(commit `bc9fae7`), then the parity verdicts in [PARITY.md](PARITY.md) and
|
|
35
|
+
[ADRs 0013–0016](docs/adr/). Animas is now independent: future changes are
|
|
36
|
+
judged against the paper's invariants and Animas's own compatibility policy, not
|
|
37
|
+
against upstream Cordis releases. The asyncio runtime, component surface and
|
|
38
|
+
product built on top are ours; the theory and reference kernel are credited in
|
|
39
|
+
[NOTICE](NOTICE). Provenance is recorded, not erased.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
Animas is not published to PyPI at this time (1.0.0 is the release candidate for a publisher to be added by the maintainer). Install from a repository checkout:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
git clone https://github.com/magitech-ai/animas.git
|
|
49
|
+
cd animas
|
|
50
|
+
uv sync
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Requires Python 3.12+ and [`uv`](https://docs.astral.sh/uv/).
|
|
54
|
+
|
|
55
|
+
## Profiles
|
|
56
|
+
|
|
57
|
+
Load a declarative profile from Python with `load_profile(ctx, path)`. Animas is a library kernel: it does not ship a CLI, HTTP server, or scaffolding command. Host applications build those surfaces on top.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Quickstart
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import asyncio
|
|
65
|
+
|
|
66
|
+
from animas import Context, Service
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class GreeterService(Service):
|
|
70
|
+
def __init__(self, ctx: Context):
|
|
71
|
+
super().__init__(ctx, "greeter")
|
|
72
|
+
|
|
73
|
+
def greet(self, name: str) -> str:
|
|
74
|
+
return f"Greetings, {name}!"
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
async def main():
|
|
78
|
+
ctx = Context()
|
|
79
|
+
|
|
80
|
+
ctx.use(GreeterService)
|
|
81
|
+
|
|
82
|
+
await ctx.flush()
|
|
83
|
+
|
|
84
|
+
print(ctx.greeter.greet("Magitech"))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
asyncio.run(main())
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Configuration
|
|
91
|
+
|
|
92
|
+
Profiles compose components from YAML. Each entry is a `module:component` target, or a mapping with a `config` block:
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
components:
|
|
96
|
+
- my_app:greeter
|
|
97
|
+
- name: my_app:worker
|
|
98
|
+
config:
|
|
99
|
+
mode: turbo
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Load a profile with `load_profile(ctx, "animas.yaml")`. Environment variables interpolate as `${VAR}`, `${env.VAR}`, or `${VAR:default}`; a full-match interpolation coerces `"true"` / `"false"` (any case) / numbers to `bool` / `int` / `float`. See `src/animas/loader.py`.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Primitives
|
|
107
|
+
|
|
108
|
+
* **`Context`**: Central dependency container and service registry. Sub-contexts (`ctx.extend()`, `ctx.isolate()`) provide isolated realms for subagents and sandboxed components.
|
|
109
|
+
|
|
110
|
+
* **`Service`**: Base class for named capabilities mounted onto `ctx`.
|
|
111
|
+
|
|
112
|
+
* **`Fiber`**: Runtime state machine (`PENDING` ➔ `LOADING` ➔ `ACTIVE` ➔ `UNLOADING` ➔ `DISPOSED`; `FAILED` on error). Handles deferred loading via `inject = [...]`.
|
|
113
|
+
|
|
114
|
+
`flush()` drains scheduled tasks and returns, so a component whose injected service never appears simply stays `PENDING`. Call `ctx.check_pending_cycles()` after a boot drain to raise instead, with the services each stuck component waits for and, when the components declare what they serve (`provide` / `provides` / `services`), the closed loop by name: `circular dependency between components: a -> b -> a`.
|
|
115
|
+
|
|
116
|
+
* **Reversible Effects (`ctx.effect`)**: Any registration, tool addition, or watcher returns a disposer. When a component unloads, all effects unwind cleanly in reverse order (LIFO).
|
|
117
|
+
|
|
118
|
+
* **The 5 Event Modes**:
|
|
119
|
+
* `emit`: Synchronous broadcast (fire-and-forget).
|
|
120
|
+
* `parallel`: Asynchronous concurrent broadcast. Every listener settles before anything is reported: one failure re-raises the original exception unchanged, two or more raise an `ExceptionGroup` naming each failing listener in registration order.
|
|
121
|
+
* `serial`: Sequential async execution; bails on first non-None, non-False result.
|
|
122
|
+
* `bail`: Synchronous version of serial.
|
|
123
|
+
* `waterfall`: Around-middleware pipeline passing `(*args, next)`. Enables non-invasive request rewrites, security guards, and vetoes.
|
|
124
|
+
|
|
125
|
+
* **Service Isolation Realms (`ctx.isolate`)**: Child scopes that prevent service leakage or pollution to/from parent contexts.
|
|
126
|
+
|
|
127
|
+
* **Declarative YAML Profiles (`load_profile`)**: Composes ordered bundles and component entries dynamically from YAML configuration.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Subsystems
|
|
132
|
+
|
|
133
|
+
Every capability is a service mounted on a `Context`. The kernel ships these modules under `src/animas/`:
|
|
134
|
+
|
|
135
|
+
| Area | Modules | What they do |
|
|
136
|
+
| --- | --- | --- |
|
|
137
|
+
| Core | `core`, `events`, `tree`, `registry`, `reflect` | Context and service registry, the 5 event modes, loader entry tree and composite component groups, component runtime registry, service introspection |
|
|
138
|
+
| Loading & config | `loader`, `include`, `schema`, `utils` | YAML profile loading, module resolution, multi-file includes with journaling and patches, declarative schema validation, shared utility helpers (plain-object checks, time, binary) |
|
|
139
|
+
| Runtime services | `timer`, `logger`, `hmr`, `fs` | Reversible timers (timeouts, intervals, debounce, throttle), structured namespaced logging, hot module replacement, and the filesystem service with mountable providers and routed watches |
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Development
|
|
144
|
+
|
|
145
|
+
`animas` enforces **100% statement and 100% branch test coverage** (`--cov-fail-under=100` in `pyproject.toml`):
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
uv run pytest
|
|
149
|
+
uv run ruff check src tests
|
|
150
|
+
uv run ruff format --check src tests
|
|
151
|
+
uv run mypy src
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
* `tests/unit/animas/`: Mirrors `src/` 1:1 — core, events, loader, timer, fs, and every other module.
|
|
155
|
+
* `tests/integration/`: End-to-end multi-component pipeline, cascade disposal, and subagent isolation.
|
|
156
|
+
|
|
157
|
+
See [AGENTS.md](AGENTS.md) for the full engineering standards.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Documentation
|
|
162
|
+
|
|
163
|
+
* [AGENTS.md](AGENTS.md) — agent guidelines and engineering standards.
|
|
164
|
+
* [CONTEXT.md](CONTEXT.md) — canonical vocabulary: context, service, component entrypoint, waterfall, disposer.
|
|
165
|
+
* [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md) — 1.0 public API and versioning policy.
|
|
166
|
+
* [docs/adr/](docs/adr/) — architecture decision records (waterfall pipeline, disposer callables, hierarchical contexts, independence).
|
|
167
|
+
* [docs/agents/](docs/agents/) — domain docs, issue tracker, and triage labels.
|
|
168
|
+
* [NOTICE](NOTICE) — upstream MIT attributions and lineage.
|
|
169
|
+
* [PARITY.md](PARITY.md) — completed rc.13 conformance milestone and verdicts (historical record).
|
|
170
|
+
|
|
171
|
+
## Contributing
|
|
172
|
+
|
|
173
|
+
Follow [AGENTS.md](AGENTS.md): strict TDD, 100% coverage floor, `ruff`, strict `mypy`, `uv` exclusively.
|
|
174
|
+
|
|
175
|
+
## Community
|
|
176
|
+
|
|
177
|
+
Report bugs and request features via [GitHub Issues](https://github.com/magitech-ai/animas/issues).
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
MIT License — Copyright (c) 2026 Magitech. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "animas"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "Animas: The Composable Micro-Kernel by Magitech"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = [
|
|
8
|
+
"LICENSE",
|
|
9
|
+
"NOTICE",
|
|
10
|
+
]
|
|
11
|
+
requires-python = ">=3.12"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"pydantic>=2.14.3",
|
|
14
|
+
"pyyaml>=6.0.3",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[build-system]
|
|
18
|
+
requires = ["uv_build>=0.13.7,<0.14.0"]
|
|
19
|
+
build-backend = "uv_build"
|
|
20
|
+
|
|
21
|
+
[dependency-groups]
|
|
22
|
+
dev = [
|
|
23
|
+
"mypy>=1.15.0",
|
|
24
|
+
"pytest>=9.2.0",
|
|
25
|
+
"pytest-asyncio>=1.4.1.post1",
|
|
26
|
+
"pytest-cov>=7.1.0",
|
|
27
|
+
"ruff>=0.17.4",
|
|
28
|
+
"types-PyYAML>=6.0.12",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[tool.pytest.ini_options]
|
|
32
|
+
asyncio_mode = "auto"
|
|
33
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
34
|
+
addopts = "--cov=animas --cov-branch --cov-report=term-missing --cov-fail-under=100"
|
|
35
|
+
filterwarnings = [
|
|
36
|
+
"error",
|
|
37
|
+
"ignore::ResourceWarning",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[tool.mypy]
|
|
41
|
+
python_version = "3.12"
|
|
42
|
+
warn_return_any = true
|
|
43
|
+
warn_unused_configs = true
|
|
44
|
+
disallow_untyped_defs = true
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "animas"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "Animas: The Composable Micro-Kernel by Magitech"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
8
|
+
requires-python = ">=3.12"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"pydantic>=2.14.3",
|
|
11
|
+
"pyyaml>=6.0.3",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[build-system]
|
|
15
|
+
requires = ["uv_build>=0.13.7,<0.14.0"]
|
|
16
|
+
build-backend = "uv_build"
|
|
17
|
+
|
|
18
|
+
[dependency-groups]
|
|
19
|
+
dev = [
|
|
20
|
+
"mypy>=1.15.0",
|
|
21
|
+
"pytest>=9.2.0",
|
|
22
|
+
"pytest-asyncio>=1.4.1.post1",
|
|
23
|
+
"pytest-cov>=7.1.0",
|
|
24
|
+
"ruff>=0.17.4",
|
|
25
|
+
"types-PyYAML>=6.0.12",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[tool.pytest.ini_options]
|
|
29
|
+
asyncio_mode = "auto"
|
|
30
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
31
|
+
addopts = "--cov=animas --cov-branch --cov-report=term-missing --cov-fail-under=100"
|
|
32
|
+
# Magitech coding standard: unexpected warnings are defects. ResourceWarning is
|
|
33
|
+
# ignored because asyncio transports legitimately emit it during interpreter
|
|
34
|
+
# shutdown; every other warning fails the suite (including unawaited coroutines).
|
|
35
|
+
filterwarnings = ["error", "ignore::ResourceWarning"]
|
|
36
|
+
|
|
37
|
+
[tool.mypy]
|
|
38
|
+
python_version = "3.12"
|
|
39
|
+
warn_return_any = true
|
|
40
|
+
warn_unused_configs = true
|
|
41
|
+
disallow_untyped_defs = true
|