mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-17 02:57:12 -05:00
Implements complete Phase 2 scaffold across 6 core modules: ## New Modules ### 1. Backend API Enhancements - Add system router with /version, /config/public, /os/state endpoints - Register system router in main.py - Add comprehensive tests for system endpoints ### 2. Core OS Runtime (core_os/) - Implement UserSession, Window, OSState models - Add state management functions (open_window, close_window, etc.) - Create Backend API adapter for communication - Include full test suite for models and state ### 3. Operator Engine (operator_engine/) - Build job registry with example jobs - Implement simple scheduler with lifecycle management - Optional HTTP server on port 8001 - Complete tests for jobs and scheduler ### 4. Web Client Enhancements - Add CoreOSClient JavaScript class - Integrate system API endpoints - Event-driven architecture for state updates - Zero dependencies, vanilla JavaScript ### 5. Prism Console (prism-console/) - Modern dark-themed admin UI - Multi-tab navigation (Overview, Jobs, Agents, Logs, System) - Real-time metrics dashboard - Backend API integration with auto-refresh ### 6. Documentation (codex-docs/) - Complete MkDocs-based documentation - Architecture guides and component docs - Infrastructure setup guides - API reference documentation ## CI/CD - Add core-os-tests.yml workflow - Add operator-tests.yml workflow - Add docs-build.yml workflow ## Documentation - Create BLACKROAD_OS_REPO_MAP.md cross-reference - Add README for each module - Comprehensive integration documentation ## Summary - 37 new files created - ~3,500 lines of new code - 5 test suites with 15+ tests - 3 new CI workflows - 10+ documentation pages All modules are minimal working skeletons ready for integration. Designed to be extracted into separate repos if needed. Phase 2 scaffold complete and ready for review.
7.0 KiB
7.0 KiB
Components Overview
BlackRoad OS consists of 6 core modules that work together to provide a complete operating system experience.
1. Backend API
Location: backend/
Technology: FastAPI, Python
Purpose: REST API gateway and business logic
Key Features
- 30+ API routers for different services
- JWT-based authentication
- PostgreSQL and Redis integration
- WebSocket support
- Async/await throughout
API Endpoints
/health- Health check/api/system/version- System version/api/system/config/public- Public config/api/system/os/state- OS state (stub)/api/auth/*- Authentication/api/agents/*- Agent library- And 30+ more...
Running Locally
cd backend
uvicorn app.main:app --reload
2. Core OS Runtime
Location: core_os/
Technology: Python
Purpose: OS state management and window control
Key Features
- User session management
- Window lifecycle (open, close, minimize, maximize)
- Desktop, taskbar, and system tray state
- Backend API adapter
Models
UserSession- User session trackingWindow- Application windowsOSState- Complete OS state
Usage
from core_os import get_initial_state, open_window
state = get_initial_state()
state = open_window("notepad", "Untitled - Notepad")
3. Operator Engine
Location: operator_engine/
Technology: Python
Purpose: Job scheduling and workflow orchestration
Key Features
- In-memory job registry
- Simple interval-based scheduler
- Job lifecycle management
- Optional HTTP API
Example Jobs
- Health Check Monitor (every 5 minutes)
- Agent Sync (hourly)
- Blockchain Ledger Sync (daily)
Usage
from operator_engine import Job, Scheduler
job = Job(name="Daily Backup", schedule="0 0 * * *")
scheduler = Scheduler()
await scheduler.execute_job(job.id)
4. Web Client (Pocket OS)
Location: backend/static/
Technology: Vanilla JavaScript, HTML, CSS
Purpose: Browser-based desktop interface
Key Features
- Windows 95-style UI
- Drag-and-drop windows
- Multiple built-in applications
- Core OS API integration
- Zero dependencies
New in Phase 2
core-os-client.js- Core OS integration- System version display
- Public config loading
- Event-driven updates
Usage
await window.coreOS.initialize();
const version = await window.coreOS.getVersion();
5. Prism Console
Location: prism-console/
Technology: HTML, CSS, JavaScript
Purpose: Admin dashboard and monitoring
Key Features
- System metrics dashboard
- Job management interface
- Agent library browser
- Log viewer
- System configuration display
Tabs
- Overview - System status and metrics
- Jobs - Scheduled job management
- Agents - AI agent control
- Logs - Real-time logs
- System - Configuration viewer
Running Locally
cd prism-console
python -m http.server 8080
6. Documentation (Codex)
Location: codex-docs/
Technology: MkDocs
Purpose: Complete system documentation
Content
- Architecture guides
- Component documentation
- API reference
- Development guides
- Infrastructure setup
Building Docs
cd codex-docs
pip install mkdocs mkdocs-material
mkdocs serve
Component Integration
How They Work Together
┌─────────────────────────────────────────────────┐
│ User Browser │
│ ├── Pocket OS (Web Client) │
│ └── Prism Console (Admin UI) │
└──────────────┬──────────────────────────────────┘
│ HTTP/WebSocket
▼
┌─────────────────────────────────────────────────┐
│ Backend API (FastAPI) │
│ ├── /api/system/* (System endpoints) │
│ ├── /api/auth/* (Authentication) │
│ ├── /api/agents/* (Agent library) │
│ └── /api/* (30+ other routers) │
└──────────────┬──────────────────────────────────┘
│ Python imports
▼
┌─────────────────────────────────────────────────┐
│ Core Modules (Python) │
│ ├── Core OS Runtime (state management) │
│ └── Operator Engine (job scheduling) │
└──────────────┬──────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ Data Layer │
│ ├── PostgreSQL (main database) │
│ ├── Redis (caching, sessions) │
│ └── RoadChain (audit ledger) │
└─────────────────────────────────────────────────┘
Request Flow Example
User opens a window in Pocket OS:
- User clicks desktop icon in Web Client
- JavaScript calls
coreOS.openWindow(appId) - API request to
POST /api/system/windows(future endpoint) - Backend routes to Core OS Runtime
- Core OS updates state
- Response returns new window object
- Web Client renders window in UI
Data Flow
- State Management: Core OS Runtime → Backend API → Web Client
- Job Execution: Operator Engine → Backend API → Prism Console
- Authentication: Web Client → Backend API → PostgreSQL
- Caching: Backend API ↔ Redis
Development Workflow
- Make changes to any module
- Run tests for that module
- Start backend with
uvicorn - Test in browser at
http://localhost:8000 - View Prism at
http://localhost:8000/prism(if routed) - Review docs at
http://localhost:8080(if serving)
Testing
Each module has its own test suite:
# Backend API tests
cd backend
pytest tests/
# Core OS tests
pytest core_os/tests/
# Operator tests
pytest operator_engine/tests/