36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
mod compat;
|
|||
|
|
mod health;
|
||
|
|
mod hermes;
|
||
|
|
mod kernel;
|
||
|
|
mod sse;
|
||
|
|
mod ws;
|
||
|
|
|
||
|
|
use crate::app::AppState;
|
||
|
|
use axum::routing::{get, post};
|
||
|
|
use axum::Router;
|
||
|
|
|
||
|
|
pub fn build_router(state: AppState) -> Router {
|
||
|
|
let hermes_base_path = state.config().hermes_base_path.clone();
|
||
|
|
let compat_next_base_path = state.config().compat_next_base_path.clone();
|
||
|
|
|
||
|
|
Router::new()
|
||
|
|
.route("/health", get(health::health))
|
||
|
|
.route("/api/kernel/projections/sidebar", get(kernel::project_sidebar))
|
||
|
|
.route("/api/kernel/subtree", get(kernel::subtree))
|
||
|
|
.route("/api/kernel/edges", get(kernel::edges))
|
||
|
|
.route("/api/kernel/graph", get(kernel::graph))
|
||
|
|
.route("/api/stream/events", get(sse::events))
|
||
|
|
.route("/api/realtime/ws", get(ws::socket))
|
||
|
|
.nest(
|
||
|
|
&hermes_base_path,
|
||
|
|
Router::new()
|
||
|
|
.route("/health", get(hermes::health))
|
||
|
|
.route("/bridge", post(hermes::bridge_runtime)),
|
||
|
|
)
|
||
|
|
.nest(
|
||
|
|
&compat_next_base_path,
|
||
|
|
Router::new().route("/ai-agent/run", post(compat::next_ai_agent_run)),
|
||
|
|
)
|
||
|
|
.with_state(state)
|
||
|
|
}
|