mecha10-core 0.6.5

Mecha10 core runtime and foundational types
Documentation
use mecha10_core::*;
use std::collections::HashMap;

#[tokio::test]
async fn test_runtime_creation() {
    let runtime = Runtime::new("test-robot").await.unwrap();
    assert_eq!(runtime.list_nodes().await.len(), 0);
}

#[tokio::test]
async fn test_node_lifecycle() {
    let mut runtime = Runtime::new("test-robot").await.unwrap();

    let config = NodeConfig {
        id: "test-node".to_string(),
        name: None,
        executable: "sleep".to_string(),
        args: vec!["10".to_string()],
        env: HashMap::new(),
        mode: NodeMode::Local,
        auto_restart: false,
        health_check_interval_s: 5,
        publishes: vec![],
        subscribes: vec![],
        depends_on: vec![],
        placement: NodePlacement::Robot,
        resources: None,
        scaling: None,
    };

    runtime.start_node(config).await.unwrap();
    assert_eq!(runtime.list_nodes().await, vec!["test-node"]);
    assert_eq!(runtime.node_state("test-node").await, Some(NodeState::Running));

    runtime.stop_node("test-node").await.unwrap();
    assert_eq!(runtime.list_nodes().await.len(), 0);
}