# openalice-rt

> Real-time state database for AI agent rooms — SpacetimeDB-inspired subscribe/mutate envelope engine over WebSocket, consumed by persona/live/world/social.

## At a glance
| field | value |
|---|---|
| kind | `service` |
| priority | `—` |
| default branch | `mvp` |
| last activity | 2026-06-16T02:59:52+00:00 |
| features catalogued | **8** |
| runtime deps declared | **2** |

## Manifest
`.atlas-deps.yml` — parsed cleanly: **yes**

### Runtime deps
- **`openalice-auth`** · `shared-jwt` · via `SHARED_JWT_SECRET` — Validate oa_session JWTs on WS upgrade and HTTP routes (SHARED_JWT_SECRET; RT_JWT_SECRET as standalone fallback).
- **`openalice-axum-common`** · `other` · via `cargo` — Shared health/metrics handlers, Prometheus builder, and JwtVerifier trait used to wire AuthUser extractor.

### Consumed env
- `SHARED_JWT_SECRET`
- `RT_JWT_SECRET`
- `RT_PORT`
- `RT_BIND`
- `RT_DATA_DIR`
- `RT_CORS_ORIGINS`
- `RT_RATE_LIMIT`
- `RUST_LOG`

### Owns tables
- `wal_entries`

### Exposes
- `http_endpoint` — GET /health
- `http_endpoint` — GET /state
- `http_endpoint` — POST /mutate
- `http_endpoint` — GET /search
- `http_endpoint` — GET /metrics
- `ws_endpoint` — WS /ws
- `cargo_crate` — openalice-rt

## Env drift

**Manifest declares, code unused (1):**
- `RUST_LOG`

## Live reachability
- last probe: **up** · `https://rt.blal.pro/health` · HTTP 200 · 1ms
- uptime 24h: **100.0%**

## Features (8)

### rt/clock
- **`rt.hlc.clock`** · _stable_ · since 0.1.0 — Hybrid Logical Clock (48-bit ms + 16-bit counter), lock-free via AtomicU64.  
  *src/hlc.rs:66*

### rt/ivm
- **`rt.ivm.plan`** · _stable_ · since 0.1.0 — Compiled subscription plan for incremental view maintenance, evaluates deltas without full re-scan.  
  *src/ivm.rs:15*

### rt/persistence
- **`rt.snapshot.manager`** · _stable_ · since 0.1.0 — Periodic snapshots with Blake3 content hashing for fast WAL-replay recovery.  
  *src/snapshot.rs:24*

### rt/search
- **`rt.messages.search`** · _experimental_ · since 0.1.0 — Case-insensitive substring search over message text fields, room-scoped, capped limit.  
  *src/routes.rs:194*

### rt/session
- **`rt.session.subscribe`** · _stable_ · since 0.1.0 — WebSocket gateway with subscribe/unsubscribe/mutate, JSON or MessagePack frames, JWT auth.  
  *src/ws.rs:30*

### rt/state
- **`rt.entity.mutate`** · _stable_ · since 0.1.0 — Upsert or delete an entity (Room/Persona/Message/Presence) with WAL persistence.  
  *src/routes.rs:49*
- **`rt.state.snapshot`** · _stable_ · since 0.1.0 — Return the current state snapshot with the highest committed sequence number.  
  *src/routes.rs:25*

### rt/store
- **`rt.store.mvcc`** · _stable_ · since 0.1.0 — In-memory MVCC store with atomic batch commits and bounded delta-log broadcast.  
  *src/store/mod.rs:55*

---

*Generated by [openalice-atlas](https://atlas.blal.pro) — single source of truth for the openalicelabs ecosystem.*
