# @mecha10/core
[](https://www.rust-lang.org)
[](https://github.com/rust-lang/rustfmt)
[](https://github.com/regexident/cargo-modules)
[](https://github.com/geiger-rs/cargo-geiger)
[](https://github.com/EmbarkStudios/cargo-deny)
Runtime orchestration and node lifecycle management for the Mecha10 framework.
## Features
- ✅ **Node Lifecycle** - Start, stop, restart node processes
- ✅ **Health Monitoring** - Automatic health checks with configurable intervals
- ✅ **Auto-Restart** - Restart crashed nodes (up to 3 attempts)
- ✅ **Graceful Shutdown** - SIGTERM handling with timeout fallback
- ✅ **State Tracking** - Track node states (Stopped, Starting, Running, Crashed, etc.)
- ✅ **Background Tasks** - Async health check loop with tokio
## Status
✅ **Fully Implemented** - 467 lines, production-ready
## Installation
```toml
[dependencies]
mecha10-core = { path = "../core" }
tokio = { version = "1.35", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }
```
## Quick Start
```rust
use mecha10_core::{Runtime, NodeConfig, NodeMode};
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut runtime = Runtime::new("my-robot").await?;
// Start a camera node
runtime.start_node(NodeConfig {
id: "camera".to_string(),
executable: "./nodes/camera_node".to_string(),
args: vec!["--resolution=1080p".to_string()],
env: HashMap::new(),
mode: Some(NodeMode::Local),
auto_restart: true,
health_check_interval_s: 5,
}).await?;
println!("Started {} nodes", runtime.list_nodes().await.len());
// Run until Ctrl+C
runtime.run().await?;
Ok(())
}
```
## API Reference
See full documentation in [packages/core/README.md](README.md)
## Examples
See [QUICKSTART.md](../../QUICKSTART.md) for complete examples.
## License
MIT