mecha10-core 0.1.1

Mecha10 core runtime and foundational types
Documentation

@mecha10/core

Rust Code Style: rustfmt cargo-modules cargo-geiger 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

[dependencies]
mecha10-core = { path = "../core" }
tokio = { version = "1.35", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }

Quick Start

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

Examples

See QUICKSTART.md for complete examples.

License

MIT