- hub: FastAPI backend (MCP server, ADB LAN controller, bridge, storage) - hub/web: Vue 3 admin console (device manager, screen mirror, chat workbench) - android: Kotlin shell app with WebView stage, OTA, telemetry, keep-alive - protocol: architecture, MCP schema, and WebSocket protocol specs
4.0 KiB
4.0 KiB
PulseWall System Architecture (v1.0)
PulseWall is an AI-driven live information wall, real-time device status monitor, and bidirectional interactive terminal consisting of:
- Upstream AI Clients: Any standard MCP client (e.g.,
dsh, Claude, Cursor, custom agents) plus optional event-stream adapter plugins for real-time reverse callbacks. - Python Hub (
hub/): Central bridge exposing:- Standard MCP Server (Streamable HTTP
/mcp+ REST/SSE event bridge) - WebSocket Device Gateway (
/ws/device/{device_id}) for multi-device Android connectivity (LAN first, WAN/WSS ready) - Config Center pushing OpenAI-compatible repair model settings (
base_url,api_key,model, limits) and global themes to connected devices - LAN-Only Developer Debug / ADB Controller (
/api/lan-debug/..., strictly restricted to RFC1918/loopback clients, disabled by default per device) - Audit Log, Page Snapshots & Web Admin Panel (
/admin) backed by SQLite
- Standard MCP Server (Streamable HTTP
- Android 11 Native App (
android/): Kotlin native client (minSdk = 30) featuring:- Layered Capability Providers:
basic(always),root(auto-detected),accessibility(reserved),adb_lan(Hub-side) - Native Unbreakable Layer: Fullscreen red emergency alarm, wake-screen, sound/TTS/vibration, Preset-First quick-action dialogs
- Dual-Stage WebView Renderer: Pre-render static validator + offscreen sandbox trial -> smooth switch to main WebView + automatic healthy snapshot rollback
- End-Side OpenAI Repair Sentinel: Fixes syntax/CSS/responsive/WebView-compatibility issues locally using Hub-pushed OpenAI config, and escalates data/semantic questions back to the upstream AI via Hub
- Layered Capability Providers:
Render & Self-Healing State Machine
Upstream AI calls render_page(device_id, html, ...)
│
▼
Hub forwards WS `render.apply` (task_id) ──► Android Validator & Offscreen Sandbox
│ │
│ ┌────────┴────────┐
│ [PASS] [ERROR]
│ │ │
│ ▼ ▼
│ Mount to Main WebView End-Side Repair AI (OpenAI API)
│ Save Healthy Snapshot (up to max_retries, default 3)
│ │ │
│ │ ┌────────┴────────┐
│ │ [fix_locally] [ask_upstream]
│ │ │ │
│ │ Re-validate Return/Emit Clarification
│ │ & Hot-Swap Question to Upstream AI
│ ▼
│ Runtime Console Watchdog
│ (window.onerror / unhandledrejection / console.error / Vue)
│ │
│ [Runtime Error]
│ ▼
│ Debounce & Deduplicate ──► End-Side Repair AI
│ (Fallback: Auto-rollback to last Healthy Snapshot)
Security Boundaries
- MCP & Device Gateway: Protected by bearer/header API token (configurable in Hub; optional relaxed mode for local trusted LAN).
- LAN Developer Debug / ADB API:
- Hard network guard rejecting any non-private IP (
127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,::1) and rejecting requests with publicX-Forwarded-Forheaders. - Requires both global
lan_debug_enabled=trueand per-device authorization. - Every command is recorded in SQLite audit logs; destructive commands require confirmation or are blocked.
- Hard network guard rejecting any non-private IP (