mirror of
https://github.com/openai/codex.git
synced 2026-11-21 22:50:37 +00:00
Fix fork cache build callsites
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
//! `codex-core`.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::future::Future;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
@@ -315,6 +316,34 @@ impl McpConnectionManager {
|
||||
failures
|
||||
}
|
||||
|
||||
pub fn required_startup_failures_future(
|
||||
&self,
|
||||
required_servers: Vec<String>,
|
||||
) -> impl Future<Output = Vec<McpStartupFailure>> + Send + 'static {
|
||||
let clients = self.clients.clone();
|
||||
async move {
|
||||
let mut failures = Vec::new();
|
||||
for server_name in required_servers {
|
||||
let Some(async_managed_client) = clients.get(&server_name).cloned() else {
|
||||
failures.push(McpStartupFailure {
|
||||
server: server_name.clone(),
|
||||
error: format!("required MCP server `{server_name}` was not initialized"),
|
||||
});
|
||||
continue;
|
||||
};
|
||||
|
||||
match async_managed_client.client().await {
|
||||
Ok(_) => {}
|
||||
Err(error) => failures.push(McpStartupFailure {
|
||||
server: server_name.clone(),
|
||||
error: startup_outcome_error_message(error),
|
||||
}),
|
||||
}
|
||||
}
|
||||
failures
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a single map that contains all tools. Each key is the
|
||||
/// fully-qualified name for the tool.
|
||||
#[instrument(level = "trace", skip_all)]
|
||||
@@ -329,6 +358,22 @@ impl McpConnectionManager {
|
||||
qualify_tools(tools)
|
||||
}
|
||||
|
||||
pub fn list_all_tools_future(
|
||||
&self,
|
||||
) -> impl Future<Output = HashMap<String, ToolInfo>> + Send + 'static {
|
||||
let clients = self.clients.values().cloned().collect::<Vec<_>>();
|
||||
async move {
|
||||
let mut tools = Vec::new();
|
||||
for managed_client in clients {
|
||||
let Some(server_tools) = managed_client.listed_tools().await else {
|
||||
continue;
|
||||
};
|
||||
tools.extend(server_tools);
|
||||
}
|
||||
qualify_tools(tools)
|
||||
}
|
||||
}
|
||||
|
||||
/// Force-refresh codex apps tools by bypassing the in-process cache.
|
||||
///
|
||||
/// On success, the refreshed tools replace the cache contents and the
|
||||
|
||||
Reference in New Issue
Block a user