# Hostiva V4 — STR Operating System

**Additive upgrade** — all V3 pages and APIs remain unchanged.

## Activate V4

```bash
mysql -u root -p hostiva < database/migrations_002_v4_str_os.sql
```

Log in as Super Admin → new sidebar section **STR Command**.

## What ships in V4.0

| Phase | Feature | Status |
|-------|---------|--------|
| 1 | Real-time (SSE + poll), event bus, notifications | ✅ Foundation |
| 2 | OTA connections, sync queue, webhooks, anti double-book | ✅ Foundation (simulation mode) |
| 3 | Multi-property calendar timeline | ✅ |
| 4 | Staff inbox & messaging | ✅ |
| 5 | WebRTC room signaling | ✅ API (browser P2P) |
| 6 | AI insights (rule-based engine) | ✅ |
| 7 | Workflow automations | ✅ |
| 8 | Role portals | 🔜 (uses existing RBAC + command views) |
| 9 | Advanced finance (ADR, RevPAR, owner statements) | ✅ API `finance/advanced` |
| 10 | Command Center UI | ✅ |
| 11 | Security (audit via existing + event log) | ✅ |
| 12 | XAMPP certified path | ✅ |

## Live OTA sync

Set in `config/config.php`:

```php
'v4' => ['ota_mode' => 'live', 'airbnb_client_id' => '...', ...],
```

Default `simulation` processes queue successfully on localhost for testing.

## New routes

- `realtime/poll`, `realtime/stream`
- `calendar`, `ota`, `ota/webhook`, `ota/process`
- `inbox`, `automations`, `ai`, `command`
- `finance/advanced`, `webrtc/signal`

## New pages

`pages/command.html`, `calendar.html`, `ota.html`, `inbox.html`, `ai.html`, `automations.html`
