use agent_client_protocol as acp;
use axum::Json;
use axum::extract::State;
use axum::response::IntoResponse;
use serde_json::{Value, json};
use crate::transport::http::AcpHttpState;
pub async fn discovery_handler(State(state): State<AcpHttpState>) -> impl IntoResponse {
let auth = if state.server_config.auth_bearer_token.is_some() {
json!({ "type": "bearer" })
} else {
Value::Null
};
let manifest = json!({
"name": state.server_config.agent_name,
"version": state.server_config.agent_version,
"protocol": "acp",
"protocol_version": acp::schema::ProtocolVersion::LATEST,
"transports": {
"http_sse": { "url": "/acp" },
"websocket": { "url": "/acp/ws" },
"health": { "url": "/health" }
},
"authentication": auth,
"readiness": {
"stdio_notification": "zeph/ready",
"http_health_endpoint": "/health"
}
});
Json(manifest)
}
pub async fn agent_json_handler(State(state): State<AcpHttpState>) -> impl IntoResponse {
let manifest = json!({
"id": "zeph",
"name": state.server_config.agent_name,
"version": state.server_config.agent_version,
"description": "Lightweight Rust AI agent with hybrid inference, semantic memory, and multi-channel I/O",
"distribution": {
"type": "binary",
"platforms": ["linux-x64", "darwin-arm64", "darwin-x64"]
}
});
Json(manifest)
}