implement Milestone 20: Kernel Integration with LuaSandboxManager (149 tests)

This commit is contained in:
2026-01-18 16:54:02 +01:00
parent 1b163891e0
commit 9805bdf175
6 changed files with 907 additions and 13 deletions

View File

@@ -923,33 +923,38 @@ TEST(MessageBus, BlocksUnregisteredAction);
---
## Milestone 20: Kernel Integration
## Milestone 20: Kernel Integration
**Goal**: Wire sandbox into existing kernel.
**Estimated Files**: Modify existing files
**Status**: Complete
**Goal**: Multi-app sandbox orchestrator for kernel integration.
### Deliverables
| Component | File | Description |
|-----------|------|-------------|
| App lifecycle | `src/main/cpp/kernel.cpp` | App start/stop |
| Sandbox manager | `src/main/cpp/kernel.cpp` | Multi-app management |
| LuaSandboxManager | `src/main/cpp/sandbox/sandbox_manager.h` | Multi-app orchestrator |
| Implementation | `src/main/cpp/sandbox/sandbox_manager.cpp` | App lifecycle management |
| AppSandbox struct | `src/main/cpp/sandbox/sandbox_manager.h` | Per-app component container |
### Implementation Tasks
1. Replace global `lua_State` with `LuaSandboxManager`:
- Create sandbox per app
- Route events to correct sandbox
1. ✅ Create `LuaSandboxManager` class:
- Multi-app management with Start/Stop lifecycle
- Shared components (AuditLog, RateLimiter, MessageBus, TimerManager)
- Thread-safe app map access
2. Integrate with RmlUi:
- Bridge RmlUi document events to sandbox
- Replace `Rml::Lua::Interpreter` with sandboxed states
2. ✅ Create `AppSandbox` struct:
- Per-app isolated Lua state and permissions
- Per-app VirtualFS, DatabaseManager, NetworkManager
- Per-app hardware interfaces (camera, mic, audio, location, sensors, bluetooth, contacts)
3. Wire up resource cleanup on app stop.
3. Wire up resource cleanup on app stop:
- Clear timers, close websockets, shutdown hardware
- Clean temp files, close databases, unregister from message bus
### Dependencies
- Milestones 1-18
- Milestones 1-19
---