huskies: merge 771
This commit is contained in:
@@ -143,6 +143,7 @@ pub async fn gateway_mcp_post_handler(
|
||||
Ok(resp) => to_json_response(resp),
|
||||
Err(e) => to_json_response(JsonRpcResponse::error(rpc.id, -32603, e)),
|
||||
},
|
||||
"pipeline.get" => to_json_response(handle_pipeline_get(&state, rpc.id).await),
|
||||
"tools/call" => {
|
||||
let tool_name = rpc
|
||||
.params
|
||||
@@ -424,3 +425,21 @@ async fn handle_aggregate_pipeline_status_tool(
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
/// Handle the `pipeline.get` read-RPC — returns the same shape as the old
|
||||
/// `GET /api/gateway/pipeline` endpoint: `{ "active": "...", "projects": {...} }`.
|
||||
async fn handle_pipeline_get(state: &GatewayState, id: Option<Value>) -> JsonRpcResponse {
|
||||
let project_urls: BTreeMap<String, String> = state
|
||||
.projects
|
||||
.read()
|
||||
.await
|
||||
.iter()
|
||||
.map(|(n, e)| (n.clone(), e.url.clone()))
|
||||
.collect();
|
||||
|
||||
let results =
|
||||
gateway::io::fetch_all_project_pipeline_statuses(&project_urls, &state.client).await;
|
||||
let active = state.active_project.read().await.clone();
|
||||
|
||||
JsonRpcResponse::success(id, json!({ "active": active, "projects": results }))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user