agentmux_srv/server/
task_flow_handler.rs1use std::collections::HashSet;
9
10use axum::extract::State;
11use axum::response::{IntoResponse, Json};
12use serde_json::json;
13
14use super::AppState;
15
16pub async fn handle_task_flow(State(state): State<AppState>, caller: Option<axum::Extension<super::caller::Caller>>) -> impl IntoResponse {
17 let who = super::work_tasks::viewer(&state, caller.as_deref());
18 let boards = state.work_store.work_boards_list(true, agentmux_common::time::now_ms()).unwrap_or_default();
19 let visible: HashSet<String> = boards.into_iter().filter(|b| who.as_ref().map_or(true, |(agent, uid)| b.visible_to(agent, uid))).map(|b| b.id).collect();
20 Json(json!({ "events": crate::backend::task_flow::recent_where(|board_id| who.is_none() || visible.contains(board_id)) }))
21}