codex-mobile-bridge 0.3.7

Remote bridge and service manager for codex-mobile.
Documentation
use std::sync::Arc;

use axum::extract::ws::{Message, WebSocket, WebSocketUpgrade};
use axum::extract::{Query, State};
use axum::http::{HeaderMap, StatusCode};
use axum::response::{IntoResponse, Response};
use axum::routing::get;
use axum::{Json, Router};
use futures_util::{SinkExt, StreamExt};
use serde::Deserialize;
use serde_json::{Value, json};
use tracing::{info, warn};

use crate::bridge_protocol::{
    ApiError, ClientEnvelope, RuntimeStatusSnapshot, RuntimeSummary, ServerEnvelope,
    error_response, event_envelope, ok_response,
};
use crate::state::BridgeState;

mod health;
#[cfg(test)]
mod tests;
mod websocket;

#[derive(Debug, Deserialize, Default)]
struct WsQuery {
    token: Option<String>,
}

pub fn build_router(state: Arc<BridgeState>) -> Router {
    Router::new()
        .route("/health", get(health::health_handler))
        .route("/ws", get(websocket::ws_handler))
        .with_state(state)
}