Metadata-Version: 2.4
Name: private-edge-os
Version: 0.8.0
Summary: Private Edge OS — Federated edge compute orchestration for enterprise AI inference
Author-email: "Honeypotz Inc." <team@private-edgeai.com>
License: Proprietary
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi>=0.111.0
Requires-Dist: uvicorn[standard]>=0.29.0
Requires-Dist: pydantic>=2.7.0
Requires-Dist: pydantic-settings>=2.3.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: psutil>=5.9.0
Requires-Dist: onnxruntime>=1.18.0
Requires-Dist: numpy>=1.26.0
Requires-Dist: cryptography>=42.0.0
Requires-Dist: PyYAML>=6.0.1
Requires-Dist: typer>=0.12.3
Requires-Dist: rich>=13.7.0
Requires-Dist: aiofiles>=23.2.0
Requires-Dist: python-jose[cryptography]>=3.3.0
Requires-Dist: passlib[bcrypt]>=1.7.4
Requires-Dist: apscheduler>=3.10.4
Requires-Dist: aiosqlite>=0.20.0
Requires-Dist: SQLAlchemy>=2.0.30
Provides-Extra: llama
Requires-Dist: llama-cpp-python>=0.2.77; extra == "llama"
Provides-Extra: gpu
Requires-Dist: onnxruntime-gpu>=1.18.0; extra == "gpu"
Provides-Extra: dev
Requires-Dist: pytest>=8.2.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: httpx>=0.27.0; extra == "dev"
Requires-Dist: black>=24.4.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: mypy>=1.10.0; extra == "dev"
Dynamic: license-file

# Private Edge OS v0.8

**Federated edge compute orchestration for enterprise AI inference.**  
Zero data egress. On-premises. OpenAI-compatible API.

© 2026 Honeypotz Inc. — [private-edgeai.com](https://private-edgeai.com) | team@private-edgeai.com

---

## What It Does

Private Edge OS turns idle enterprise compute (workstations, lab servers, VM clusters) into a private, federated AI inference fabric.  Inference stays **100% on-premises** — no data leaves your network.

### v0.8 Milestone Features

| Layer | Feature | Status |
|-------|---------|--------|
| L1 Agent | Daemon, hardware fingerprint, idle detection, heartbeat, uninstall | ✅ |
| L2 Runtime | ONNX/PyTorch, llama.cpp LLM, INT4/INT8, request batching, streaming | ✅ |
| L3 Orchestration | Scheduler, load balancer, failover controller | ✅ |
| L5 Security | Zero-egress enforcement, RBAC v1, JWT auth, AES-256 at rest | ✅ |
| L7 Interface | OpenAI-compatible REST API, CLI (`pedge`) | ✅ |

---

## Quick Start

### 1. Install

```bash
# Requires Python 3.10+
pip install ".[llama]"          # with LLM support
# or
pip install .                   # ONNX only
```

For production (root required):
```bash
sudo bash scripts/install.sh
```

### 2. Start the API server

```bash
pedge start --port 8080
# or
python -m private_edge.api.server
```

### 3. Load a model

```bash
# Download a GGUF model (e.g. from Hugging Face — run offline in production)
pedge models load /path/to/llama-3-8b-instruct.Q4_K_M.gguf

# Or via API
curl -X POST http://localhost:8080/api/v1/models/load \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model_id":"llama3-8b","path":"/path/to/model.gguf","format":"gguf"}'
```

### 4. Run inference (OpenAI-compatible)

```bash
# CLI
pedge infer "Summarise our Q2 earnings report" --model llama3-8b

# Python — drop-in OpenAI SDK replacement
python - <<'EOF'
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8080/v1",
    api_key="your-pedge-token",
)

response = client.chat.completions.create(
    model="llama3-8b",
    messages=[{"role": "user", "content": "Hello, Private Edge!"}],
)
print(response.choices[0].message.content)
EOF
```

### 5. Multi-node cluster

On each worker node:
```bash
PEDGE_ORCHESTRATOR_URL=http://orchestrator:8080 \
PEDGE_ORG_ID=acme \
pedge agent
```

---

## Configuration

All settings are environment variables prefixed `PEDGE_`.  Copy `/etc/private-edge/pedge.env` and edit.

| Variable | Default | Description |
|----------|---------|-------------|
| `PEDGE_API_PORT` | `8080` | API server port |
| `PEDGE_API_SECRET_KEY` | `change-me…` | JWT signing key — **change in production** |
| `PEDGE_ORCHESTRATOR_URL` | `http://localhost:8080` | Control plane URL (agent → orchestrator) |
| `PEDGE_MODEL_DIR` | `/var/lib/private-edge/models` | Where model files live |
| `PEDGE_ZERO_EGRESS_ENABLED` | `true` | Block non-private outbound connections |
| `PEDGE_ALLOWED_EGRESS_CIDRS` | RFC-1918 | Allowed CIDRs for egress policy |
| `PEDGE_LLAMA_N_GPU_LAYERS` | `0` | GPU layers for llama.cpp (0 = CPU-only) |
| `PEDGE_RBAC_ENABLED` | `true` | Enable JWT + RBAC |
| `PEDGE_ENCRYPTION_AT_REST` | `true` | AES-256-GCM encryption for stored data |

---

## API Reference

The API is **100% OpenAI-compatible**.  Any OpenAI SDK client works by changing `base_url`.

| Method | Path | Description |
|--------|------|-------------|
| POST | `/v1/chat/completions` | Chat inference (streaming ✓) |
| POST | `/v1/embeddings` | Text embeddings |
| GET | `/api/v1/models` | List available models |
| POST | `/api/v1/models/load` | Load a model |
| POST | `/api/v1/models/unload` | Unload current model |
| GET | `/api/v1/nodes` | List cluster nodes |
| POST | `/api/v1/nodes/register` | Register a node (agent) |
| POST | `/api/v1/nodes/{id}/heartbeat` | Node heartbeat |
| POST | `/api/v1/auth/token` | Get JWT token |
| GET | `/health` | Health check |

Enable interactive docs (debug mode only): `PEDGE_API_LOG_LEVEL=debug pedge start`  → `http://localhost:8080/docs`

---

## Architecture

```
┌─────────────────────────────────────────────────────────┐
│  Enterprise Network (zero egress enforced)               │
│                                                          │
│  ┌─────────────┐    mTLS     ┌──────────────────────┐   │
│  │  Orchestrator│◄──────────►│  Node Agent (L1)     │   │
│  │  API Server  │            │  • Fingerprint        │   │
│  │  Scheduler   │            │  • Idle detect        │   │
│  │  Load Balancer│           │  • Heartbeat          │   │
│  └──────┬───────┘            └──────────┬────────────┘   │
│         │                               │                 │
│  ┌──────▼────────────────────────────── ▼────────────┐   │
│  │           Inference Runtime (L2)                   │   │
│  │   llama.cpp (GGUF/INT4/INT8) │ ONNX Runtime        │   │
│  │   Request Batcher            │ GPU Routing          │   │
│  └────────────────────────────────────────────────────┘   │
│                                                          │
│  ┌──────────────────────────────────────────────────┐    │
│  │  Security Layer (L5)                              │    │
│  │  Zero-Egress │ RBAC/JWT │ AES-256 at rest         │    │
│  └──────────────────────────────────────────────────┘    │
└─────────────────────────────────────────────────────────┘
```

---

## Running Tests

```bash
pip install ".[dev]"
pytest tests/ -v
```

---

## Roadmap

- **v0.9** — mTLS, Prometheus metrics, model registry, GPU routing
- **v1.0** — HIPAA BAA, AD/LDAP, distributed tracing, SOC 2 prep
- **v1.5** — Federated learning API, differential privacy, multi-tenant isolation

---

*Built in Greenwich, CT by the Honeypotz Inc. team.*
