Metadata-Version: 2.4
Name: universal-chain-ontology
Version: 0.1.0
Summary: The standalone Link/Chain homoiconic composition primitives (UCO) — pure stdlib, zero deps.
Author: Isaac Wostrel-Rubin
License: MIT
Project-URL: Homepage, https://github.com/sancovp/universal-chain-ontology
Keywords: chain,composition,agents,homoiconic,link,ontology,dataflow
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Developers
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# universal-chain-ontology (UCO)

The standalone **Link / Chain** homoiconic composition primitives — the chain substrate that a lot of
systems reimplement. Pure stdlib, **zero dependencies**.

```python
from uco import Link, Chain, LinkResult, LinkStatus

class Inc(Link):
    async def execute(self, context=None, **_):
        ctx = dict(context or {}); ctx["n"] = ctx.get("n", 0) + 1
        return LinkResult(status=LinkStatus.SUCCESS, context=ctx)

# a Chain IS a Link (homoiconic) — so Chains nest like any other Link
import asyncio
out = asyncio.run(Chain("two", [Inc(), Inc()]).execute({"n": 0}))
assert out.context["n"] == 2
```

## What's here

| primitive | what it is |
|---|---|
| `Link` | ABC: `execute(context) -> LinkResult` |
| `Chain` | sequential composition of Links; **a Chain IS a Link** |
| `EvalChain` | a Chain + an evaluator loop (gate to a condition / `max_cycles`) |
| `Compiler` | a Chain whose output is itself a Link |
| `ConfigLink` / `LinkConfig` | config-driven Links |
| `LinkResult` / `LinkStatus` | the result + status enum (`SUCCESS`/`BLOCKED`/`ERROR`/`AWAITING_INPUT`) |

## Why standalone

The same Link/Chain abstraction was living inside SDNA and getting copy-pasted into other projects. UCO is
that abstraction extracted once. Downstreams import `uco`; `sdna.chain_ontology` re-exports it, so existing
`from sdna.chain_ontology import Link, Chain, …` keeps working unchanged and the class identity is shared
(one `Link` everywhere).

MIT.
