Metadata-Version: 2.4
Name: omnibase_infra
Version: 0.15.0
Summary: ONEX Infrastructure - Service integration and database infrastructure tools
Author-email: OmniNode Team <team@omninode.ai>
License: MIT
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: aiofiles<24.0.0,>=23.2.1
Requires-Dist: aiohttp<4.0.0,>=3.9.0
Requires-Dist: aiokafka<0.12.0,>=0.11.0
Requires-Dist: asyncpg<0.30.0,>=0.29.0
Requires-Dist: circuitbreaker<3.0.0,>=2.0.0
Requires-Dist: click<9.0.0,>=8.1.0
Requires-Dist: confluent-kafka<3.0.0,>=2.12.0
Requires-Dist: cryptography<47.0.0,>=46.0.3
Requires-Dist: dependency-injector<5.0.0,>=4.48.1
Requires-Dist: fastapi<0.121.0,>=0.120.1
Requires-Dist: httpx<0.29.0,>=0.28.1
Requires-Dist: infisicalsdk<2.0.0,>=1.0.15
Requires-Dist: jinja2<4.0.0,>=3.1.6
Requires-Dist: jsonschema<5.0.0,>=4.20.0
Requires-Dist: mcp<2.0.0,>=1.25.0
Requires-Dist: neo4j<6.0.0,>=5.15.0
Requires-Dist: omnibase-core<0.24.0,>=0.23.0
Requires-Dist: omnibase-spi<0.16.0,>=0.15.0
Requires-Dist: opentelemetry-api<2.0.0,>=1.27.0
Requires-Dist: opentelemetry-exporter-otlp<2.0.0,>=1.27.0
Requires-Dist: opentelemetry-instrumentation-aiohttp-client<0.49,>=0.48b0
Requires-Dist: opentelemetry-instrumentation-asyncpg<0.49,>=0.48b0
Requires-Dist: opentelemetry-instrumentation-fastapi<0.49,>=0.48b0
Requires-Dist: opentelemetry-instrumentation-kafka-python<0.49,>=0.48b0
Requires-Dist: opentelemetry-instrumentation-redis<0.49,>=0.48b0
Requires-Dist: opentelemetry-instrumentation<0.49,>=0.48b0
Requires-Dist: opentelemetry-sdk<2.0.0,>=1.27.0
Requires-Dist: prometheus-client<0.20.0,>=0.19.0
Requires-Dist: psycopg2-binary<3.0.0,>=2.9.10
Requires-Dist: pydantic-settings<3.0.0,>=2.2.1
Requires-Dist: pydantic<3.0.0,>=2.11.7
Requires-Dist: python-consul2<0.2.0,>=0.1.5
Requires-Dist: pyyaml<7.0.0,>=6.0.2
Requires-Dist: qdrant-client<2.0.0,>=1.12.0
Requires-Dist: redis<7.0.0,>=6.0.0
Requires-Dist: rich<14.0.0,>=13.7.0
Requires-Dist: slowapi<0.2.0,>=0.1.9
Requires-Dist: sqlparse<0.6.0,>=0.4.4
Requires-Dist: structlog<24.0.0,>=23.2.0
Requires-Dist: tenacity<10.0.0,>=9.0.0
Requires-Dist: textual<8.0.0,>=0.89.0
Requires-Dist: uvicorn<0.33.0,>=0.32.0
Description-Content-Type: text/markdown

# ONEX Infrastructure

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
[![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
[![Type checked: mypy](https://img.shields.io/badge/type%20checked-mypy-blue.svg)](https://mypy.readthedocs.io/)
[![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Framework: Infrastructure](https://img.shields.io/badge/framework-infrastructure-green.svg)](https://github.com/OmniNode-ai/omnibase_infra)

**Production infrastructure services for the ONEX execution layer.** Handlers, adapters, and runtime services for PostgreSQL, Kafka, Consul, Vault, and Redis.

## What is This?

This repository provides the **infrastructure layer** for ONEX-based systems. While [omnibase_core](https://github.com/OmniNode-ai/omnibase_core) defines the execution protocol and node archetypes, this package provides:

- **Handlers** for external services (database, HTTP, messaging)
- **Adapters** wrapping infrastructure clients
- **Event bus** abstractions for Kafka/Redpanda
- **Runtime services** deployable via Docker

Built on `omnibase-core` ^0.8.0 and `omnibase-spi` ^0.5.0.

## Install Model

`omnibase_infra` serves two distinct purposes depending on how you use it:

### As a library / runtime (pip install)

```bash
pip install omnibase-infra
# or
uv add omnibase-infra
```

This gives you the Python library and bundled runtime CLIs (`onex-runtime`, `omni-infra`,
`onex-status`, etc.). No clone required for library use or running the runtime.

### For operational bootstrapping (clone required)

The **operational scripts** in `scripts/` are not bundled in the pip package. A local
clone is required to run them:

```bash
git clone https://github.com/OmniNode-ai/omnibase_infra.git
cd omnibase_infra
uv sync
```

**Scripts that require a clone:**
- `scripts/seed-infisical.py` — Populate Infisical from contract YAMLs
- `scripts/bootstrap-infisical.sh` — Full first-time Infisical bootstrap
- `scripts/provision-infisical.py` — Create machine identities

See [CLAUDE.md — Install Model](CLAUDE.md#install-model) for the full decision matrix.

## Quick Start

```bash
# Clone the repository
git clone https://github.com/OmniNode-ai/omnibase_infra.git
cd omnibase_infra

# Start infrastructure services with Docker
cd docker
cp .env.example .env
# Edit .env - set POSTGRES_PASSWORD (required for Docker fallback)
# Set OMNIBASE_INFRA_DB_URL (required for CLI/scripts; recommended for Docker)

docker compose -f docker-compose.infra.yml up -d

# Verify services are running
docker compose -f docker-compose.infra.yml ps
```

## Docker Services

Self-contained infrastructure via `docker-compose.infra.yml`:

| Service | Profile | Port | Description |
|---------|---------|------|-------------|
| **PostgreSQL** | default | 5436 | Persistence (always starts) |
| **Redpanda** | default | 29092 | Event bus (always starts) |
| **Valkey** | default | 16379 | Caching (always starts) |
| **Consul** | `consul` | 28500 | Service discovery (optional) |
| **Infisical** | `secrets` | 8880 | Secrets management (optional) |
| **Runtime** | `runtime` | 8085 | ONEX runtime services (optional) |

**Profiles:**
```bash
# Infrastructure only (default)
docker compose -f docker-compose.infra.yml up -d

# With service discovery
docker compose -f docker-compose.infra.yml --profile consul up -d

# With secrets management
docker compose -f docker-compose.infra.yml --profile secrets up -d

# Everything
docker compose -f docker-compose.infra.yml --profile full up -d
```

Configure via `.env` file - see [docker/README.md](docker/README.md) for details.

## Documentation

| I want to... | Go to... |
|--------------|----------|
| Get started quickly | [Quick Start Guide](docs/getting-started/quickstart.md) |
| Understand the architecture | [Architecture Overview](docs/architecture/overview.md) |
| Deploy with Docker | [Docker Guide](docker/README.md) |
| See a complete example | [Registration Walkthrough](docs/guides/registration-example.md) |
| Write a contract | [Contract Reference](docs/reference/contracts.md) |
| Find implementation patterns | [Pattern Documentation](docs/patterns/README.md) |
| Read coding standards | [CLAUDE.md](CLAUDE.md) |

**Full documentation**: [docs/index.md](docs/index.md)

## Repository Structure

```
src/omnibase_infra/
├── handlers/          # Request/message handlers
├── event_bus/         # Kafka/Redpanda abstractions
├── clients/           # Service clients
├── models/            # Pydantic models
├── nodes/             # ONEX nodes (Effect, Compute, Reducer, Orchestrator)
├── errors/            # Error hierarchy
├── mixins/            # Reusable behaviors
└── enums/             # Centralized enums
```

## Development

```bash
# Install dependencies
uv sync

# Run tests
uv run pytest

# Type checking
uv run mypy src/omnibase_infra/

# Format code
uv run ruff format .
uv run ruff check --fix .
```

### Pre-commit Hooks Setup

Run once after cloning:
```bash
uv run pre-commit install
uv run pre-commit install --hook-type pre-push
```

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for commit conventions and PR guidelines.

## License

MIT License - see [LICENSE](LICENSE) for details.
