feat(tui): add usage overlay and sidebar for displaying usage statistics and tasks
feat(tui): implement status bar with connection and turn state indicators feat(tui): create workflow panel for agent status and progress visualization feat(web): introduce web frontend interface with static file serving feat(ws): add WebSocket interface for real-time communication and session management
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
//! gRPC interface — high-performance RPC with protobuf.
|
||||
//!
|
||||
//! Uses tonic + prost for gRPC code generation. To enable:
|
||||
//! 1. Add `tonic` and `prost` to Cargo.toml
|
||||
//! 2. Create proto/ directory with service definitions
|
||||
//! 3. Generate code via build.rs
|
||||
//! 4. Implement the generated service traits
|
||||
//!
|
||||
//! Example service:
|
||||
//! ```protobuf
|
||||
//! service Zesdex {
|
||||
//! rpc Chat(ChatRequest) returns (ChatResponse);
|
||||
//! rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse);
|
||||
//! rpc StreamChat(ChatRequest) returns (stream ChatResponse);
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! For now, this crate provides a minimal HTTP health-check endpoint
|
||||
//! so consumers can verify the gRPC server is reachable.
|
||||
|
||||
use axum::routing::get;
|
||||
use axum::Router;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
use tracing::info;
|
||||
|
||||
/// gRPC server state (minimal for health checks).
|
||||
pub struct GrpcState {
|
||||
pub version: String,
|
||||
}
|
||||
|
||||
/// Build the gRPC server router.
|
||||
pub fn build_router(state: Arc<GrpcState>) -> Router {
|
||||
Router::new()
|
||||
.route("/grpc/health", get(health_check))
|
||||
.with_state(state)
|
||||
}
|
||||
|
||||
/// Health check endpoint.
|
||||
async fn health_check(
|
||||
axum::extract::State(_state): axum::extract::State<Arc<GrpcState>>,
|
||||
) -> &'static str {
|
||||
"gRPC server is running"
|
||||
}
|
||||
|
||||
/// Run the gRPC server (currently HTTP health only; replace with tonic when ready).
|
||||
pub async fn run_server(port: u16) -> anyhow::Result<()> {
|
||||
let state = Arc::new(GrpcState {
|
||||
version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
});
|
||||
let app = build_router(state);
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], port));
|
||||
info!("gRPC server listening on {addr}");
|
||||
info!("Note: gRPC currently runs HTTP health endpoint. Add tonic+prost for full gRPC.");
|
||||
let listener = tokio::net::TcpListener::bind(addr).await?;
|
||||
axum::serve(listener, app).await?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user