Supervisor (PID 1)
The supervisor is a 697 KB static Rust binary that serves as PID 1 — the first and only native process in VyomaOS. It manages every aspect of the system above the kernel.
Modules
Section titled “Modules”Manifest Parser
Section titled “Manifest Parser”Reads vyoma.toml files at startup and validates capability declarations against the schema. Invalid manifests are rejected with clear error messages.
[app]name = "shell"version = "0.1.0"wasm = "shell.wasm"
[capabilities]stdio = truefilesystem = trueshell = trueConcurrent Scheduler
Section titled “Concurrent Scheduler”Spawns one thread per WASM app, each running a Wasmtime process. Supports restart policies:
never: One-shot apps that exit and stay stoppedalways: Apps that restart automatically on exit (e.g., shell, gui-demo)
IPC Broker
Section titled “IPC Broker”Intercepts messages written to stdout by apps and routes them:
- Unicast:
@app-name: message— routes to a specific app - Broadcast:
@broadcast: message— delivers to all running apps - Reply:
@reply: message— routes back to the last sender - Supervisor:
@supervisor: command— built-in control commands
Display Driver
Section titled “Display Driver”Opens /dev/fb0 (DRM/virtio-gpu framebuffer) and renders:
- Parses
VYOMA_DRAW:protocol commands from app stdout - Renders text using a built-in 8x16 bitmap font
- Manages window chrome: title bars, focus borders, status strips
- Tracks per-app flush rate (FPS)
- Supports double-buffered compositing
Input Router
Section titled “Input Router”Puts the TTY in raw mode and dispatches input events:
- Keyboard: Per-keypress dispatch to the focused app via
VYOMA_INPUT:key:prefix - Mouse: Click, move, and drag events via
VYOMA_INPUT:mouse:prefix - Hotkeys: Alt+? for shortcut overlay, click-to-focus in menu bar
Process Manager
Section titled “Process Manager”Runtime process management via console commands and IPC:
| Command | Description |
|---|---|
ps | List running apps with PID, name, uptime |
log <name> | Print app’s captured log output |
logf <name> | Tail app logs in real-time |
kill <name> | Terminate an app |
restart <name> | Restart an app |
reload <name> | Reload app from disk |
Supervisor IPC Commands
Section titled “Supervisor IPC Commands”Apps (or the console) can send commands to the supervisor:
| Command | Response |
|---|---|
@supervisor: list | List of running app names |
@supervisor: apps | Running app name list |
@supervisor: ping | pong with timestamp |
@supervisor: uptime | System uptime since boot |
@supervisor: version | VyomaOS version string |
@supervisor: focus <name> | Switch keyboard focus to app |
@supervisor: loglevel <level> | Set per-app log level filter |
@supervisor: kill <name> | Terminate an app |
The supervisor compiles as a static musl binary:
cd supervisorcargo build --target x86_64-unknown-linux-musl --releaseOutput: supervisor/target/x86_64-unknown-linux-musl/release/supervisor (697 KB)
Code Organization
Section titled “Code Organization”The supervisor follows a 500-line-per-file rule. Major subsystems are split into focused modules:
main.rs— Entry point, boot sequence, app spawn loopchrome.rs— Window chrome rendering (title bars, borders)display/— Framebuffer driver, compositordraw_cmd.rs— VYOMA_DRAW protocol parseripc_handlers.rs— IPC message routingipc_commands/— Built-in supervisor commandsinput_keys.rs— Keyboard input handlingmouse_input.rs— Mouse event processingapp_threads.rs— Per-app thread managementmount.rs— Filesystem mountingnet.rs— Network setuppackages.rs— Package managerseccomp.rs— Seccomp BPF setuptoast.rs— Toast overlay rendering