The helix-core crate is the heart of the kernel. It defines the fundamental abstractions that every other crate depends on — the orchestrator that manages subsystem lifecycles, the capability broker that controls resource access, and the panic handler that decides what happens when things go wrong.
Everything in helix-core is designed around the KernelComponent trait. If your code is part of the kernel, it implements this trait.
Errors in Helix are strongly typed. Every subsystem returns KernelResult<T>, which uses this error enum. This makes error handling consistent across the entire codebase.
The kernel event system allows components to react to state changes without tight coupling. Components register as listeners and receive events asynchronously.
The Orchestrator is the top-level kernel manager. It owns every subsystem, starts them in dependency order, monitors their health, and coordinates shutdown. Think of it as the init process, but for kernel components.
Every major kernel component implements Subsystem. It extends KernelComponent with dependency declarations so the orchestrator can resolve the startup order automatically.
core/src/subsystem.rs
14rust
pubtraitSubsystem:KernelComponent{
fndependencies(&self)->Vec<&'staticstr>;
fnprovides(&self)->Vec<&'staticstr>;
fnpriority(&self)->u32{100}// Lower = starts first
fnis_essential(&self)->bool{false}
6
}
7
8
// If an essential subsystem fails, the kernel panics.
Helix uses a capability-based security model. Instead of traditional Unix permissions, every resource access requires a capability token. The broker manages grants, revocations, and rights checking.
When something goes critically wrong, the panic handler decides what to do. It's a trait — you can replace the default handler with your own recovery strategy.
core/src/panic.rs
111rust
pubtraitPanicHandler:Send+Sync{
fnon_panic(&self,info:&PanicInfo)->PanicAction;
3
}
4
2 refs
pubenumPanicAction{
6
Halt,// Stop the CPU
7
Reboot,// Triple-fault reboot
8
RecoverComponent(String),// Try to restart the failed component
9
ContinueDegraded,// Mark as degraded and keep running
10
}
11
12
// Kernel assertion macros — use instead of std assert!
The PanicAction::RecoverComponent option is what enables self-healing. Instead of halting on every failure, the kernel can attempt to restart just the failed component while everything else keeps running.