swarm / companies/lantern/seed/src/main.rs

raw file 1107 bytes
//! harnessd — the Lantern Systems daemon skeleton (seed v1).
//!
//! Compiles and serves /healthz; the route table below is the API contract
//! the whole company commits against. Macros/TODO markers are intentional:
//! that's the backlog.

mod agent;
mod browser;
mod events;
mod mock;

use axum::routing::{get, post};
use axum::{Json, Router};

#[tokio::main]
async fn main() {
    let app = Router::new()
        .route("/healthz", get(healthz))
        .route("/sessions", post(create_session))
        .nest("/", Router::new());
    let listener = tokio::net::TcpListener::bind("0.0.0.0:7777")
        .await
        .expect("bind 0.0.0.0:7777 (LAN/Tailscale reachable)");
    println!("harnessd seed: listening on 0.0.0.0:7777");
    axum::serve(listener, app).await.unwrap();
}

async fn healthz() -> &'static str {
    "ok"
}

/// POST /sessions — create a browsing session (seed: accepts anything, TODO).
async fn create_session() -> Json<serde_json::Value> {
    Json(serde_json::json!({
        "session": "seed-stub",
        "note": "not implemented yet — see backlog T1..T8"
    }))
}