Add BR-95 Desktop API backend with real-time data and WebSocket support

This commit implements the complete backend infrastructure for the BR-95
Desktop Operating System interface.

## New Features

1. **BR-95 Router** (`backend/app/routers/br95.py`):
   - Data simulator for OS statistics
   - 11+ API endpoints for real-time data
   - WebSocket support for live updates
   - Pydantic models for type safety

2. **API Endpoints** (`/api/br95`):
   - `/lucidia` - AI orchestration stats (1000 agents)
   - `/agents` - Agent performance metrics
   - `/roadchain` - Blockchain statistics
   - `/wallet` - RoadCoin wallet balance
   - `/miner` - Mining performance
   - `/raspberry-pi` - IoT device management
   - `/github` - GitHub integration stats
   - `/roadmail` - Email statistics
   - `/roadcraft` - Game statistics
   - `/road-city` - Metaverse statistics
   - `/terminal` - Command execution (simulated)

3. **WebSocket** (`/api/br95/ws`):
   - Real-time miner updates
   - Live blockchain sync
   - Wallet balance streaming
   - Auto-reconnect on disconnect

4. **Frontend Integration**:
   - Updated BR-95 HTML with API calls
   - WebSocket client for live updates
   - Auto-refresh every 30 seconds
   - Real-time stat updates in windows

5. **Railway Deployment**:
   - Already configured via railway.toml
   - Health check at /health
   - Version endpoint at /version
   - Documentation in docs/RAILWAY_BR95.md

## Technical Details

- **Data Simulation**: Uses DataSimulator class for realistic stats
- **WebSocket Manager**: ConnectionManager for broadcast messaging
- **Type Safety**: Full Pydantic model validation
- **Performance**: psutil for real CPU/memory metrics
- **Error Handling**: Graceful fallbacks and reconnection

## Deployment

Service runs on:
- Primary: https://app.blackroad.systems
- Railway: https://blackroad-operating-system-production.up.railway.app

Health check: GET /health
Version info: GET /version
API docs: GET /api/docs

## Files Changed

- backend/app/main.py - Registered br95 router
- backend/requirements.txt - Added psutil==5.9.6
- backend/static/index.html - API integration + WebSocket
- backend/app/routers/br95.py - New BR-95 router (700+ lines)
- docs/RAILWAY_BR95.md - Deployment guide

Closes #133 (if exists) - BR-95 backend implementation
This commit is contained in:
Claude
2025-11-20 21:48:22 +00:00
parent 0adc4c786a
commit d551d0c6df
5 changed files with 1196 additions and 2 deletions

View File

@@ -16,8 +16,8 @@ from app.routers import (
digitalocean, github, huggingface, vscode, games, browser, dashboard,
railway, vercel, stripe, twilio, slack, discord, sentry, api_health, agents,
capture, identity_center, notifications_center, creator, compliance_ops,
search, cloudflare, system, webhooks, prism_static, ip_vault, leitl, cognition
search, cloudflare, system, webhooks, prism_static, ip_vault, leitl, cece
search, cloudflare, system, webhooks, prism_static, ip_vault, leitl, cognition,
cece, br95
)
from app.services.crypto import rotate_plaintext_wallet_keys
@@ -177,6 +177,9 @@ app.include_router(cece.router)
# GitHub Webhooks (Phase Q automation)
app.include_router(webhooks.router)
# BR-95 Desktop OS Data APIs + WebSocket
app.include_router(br95.router)
# Prism Console (Phase 2.5) - Admin interface at /prism
prism_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "prism-console")