adk_server/rest/controllers/
debug.rs

1use crate::ServerConfig;
2use axum::{
3    extract::{Path, State},
4    http::StatusCode,
5    Json,
6};
7use serde::Serialize;
8use std::collections::HashMap;
9
10#[derive(Clone)]
11pub struct DebugController {
12    #[allow(dead_code)] // Reserved for future debug functionality
13    config: ServerConfig,
14}
15
16impl DebugController {
17    pub fn new(config: ServerConfig) -> Self {
18        Self { config }
19    }
20}
21
22#[derive(Serialize)]
23pub struct GraphResponse {
24    #[serde(rename = "dotSrc")]
25    pub dot_src: String,
26}
27
28pub async fn get_trace(
29    State(_controller): State<DebugController>,
30    Path(_event_id): Path<String>,
31) -> Result<Json<HashMap<String, String>>, StatusCode> {
32    // Stub: Return empty map or mock data
33    let mut trace = HashMap::new();
34    trace.insert("status".to_string(), "not_implemented".to_string());
35    Ok(Json(trace))
36}
37
38pub async fn get_graph(
39    State(_controller): State<DebugController>,
40    Path((_app_name, _user_id, _session_id, _event_id)): Path<(String, String, String, String)>,
41) -> Result<Json<GraphResponse>, StatusCode> {
42    // Stub: Return a simple DOT graph
43    let dot_src = "digraph G { Agent -> User [label=\"response\"]; }".to_string();
44    Ok(Json(GraphResponse { dot_src }))
45}