chore: upgrade rust to 1.99.0 (#12714)
This commit is contained in:
@@ -1632,12 +1632,8 @@ mod tests {
|
||||
});
|
||||
|
||||
let lines = vec![
|
||||
format!(
|
||||
r#"data: {{"type":"response.created","sequence_number":1,"response":{{"id":"resp_1","object":"response","created_at":1737368310,"status":"in_progress","model":"gpt-5","output":[]}}}}"#
|
||||
),
|
||||
format!(
|
||||
r#"data: {{"type":"response.output_text.delta","sequence_number":2,"item_id":"msg_1","output_index":1,"content_index":0,"delta":"Paris."}}"#
|
||||
),
|
||||
r#"data: {"type":"response.created","sequence_number":1,"response":{"id":"resp_1","object":"response","created_at":1737368310,"status":"in_progress","model":"gpt-5","output":[]}}"#.to_string(),
|
||||
r#"data: {"type":"response.output_text.delta","sequence_number":2,"item_id":"msg_1","output_index":1,"content_index":0,"delta":"Paris."}"#.to_string(),
|
||||
format!(
|
||||
r#"data: {{"type":"response.output_item.done","sequence_number":3,"output_index":0,"item":{}}}"#,
|
||||
serde_json::to_string(&reasoning_item)?
|
||||
|
||||
@@ -21,11 +21,11 @@ pub use crate::agents::platform_extensions::{
|
||||
pub struct ProcessExit {
|
||||
stderr: String,
|
||||
#[source]
|
||||
source: ClientInitializeError,
|
||||
source: Box<ClientInitializeError>,
|
||||
}
|
||||
|
||||
impl ProcessExit {
|
||||
pub fn new<T>(stderr: T, source: ClientInitializeError) -> Self
|
||||
pub fn new<T>(stderr: T, source: Box<ClientInitializeError>) -> Self
|
||||
where
|
||||
T: Into<String>,
|
||||
{
|
||||
@@ -49,7 +49,7 @@ pub enum ExtensionError {
|
||||
#[error("IO error: {0}")]
|
||||
IoError(#[from] std::io::Error),
|
||||
#[error("failed to initialize MCP client: {0}")]
|
||||
InitializeError(#[source] Box<ClientInitializeError>),
|
||||
InitializeError(#[from] Box<ClientInitializeError>),
|
||||
#[error("{0}")]
|
||||
ProcessExit(#[source] Box<ProcessExit>),
|
||||
}
|
||||
|
||||
@@ -70,8 +70,10 @@ fn is_oauth_auth_failure(err: &ClientInitializeError) -> bool {
|
||||
|| message.contains("Authorization required")
|
||||
}
|
||||
|
||||
fn should_attempt_oauth_fallback(res: &Result<McpClient, ClientInitializeError>) -> bool {
|
||||
res.as_ref().err().is_some_and(is_oauth_auth_failure)
|
||||
fn should_attempt_oauth_fallback(res: &Result<McpClient, Box<ClientInitializeError>>) -> bool {
|
||||
res.as_ref()
|
||||
.err()
|
||||
.is_some_and(|error| is_oauth_auth_failure(error))
|
||||
}
|
||||
|
||||
/// Extract the `WWW-Authenticate` challenge from a failed initialization, so
|
||||
@@ -101,8 +103,12 @@ fn auth_challenge_from_error(err: &ClientInitializeError) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
fn auth_challenge_from_result(res: &Result<McpClient, ClientInitializeError>) -> Option<String> {
|
||||
res.as_ref().err().and_then(auth_challenge_from_error)
|
||||
fn auth_challenge_from_result(
|
||||
res: &Result<McpClient, Box<ClientInitializeError>>,
|
||||
) -> Option<String> {
|
||||
res.as_ref()
|
||||
.err()
|
||||
.and_then(|error| auth_challenge_from_error(error))
|
||||
}
|
||||
|
||||
/// Extract the `WWW-Authenticate` challenge from a post-initialization request
|
||||
@@ -228,14 +234,14 @@ fn http_client(
|
||||
}
|
||||
|
||||
fn should_retry_legacy_after_empty_discover(
|
||||
result: &Result<McpClient, ClientInitializeError>,
|
||||
result: &Result<McpClient, Box<ClientInitializeError>>,
|
||||
capabilities: &super::super::mcp_client::GooseMcpClientCapabilities,
|
||||
) -> bool {
|
||||
capabilities.protocol_version.is_none()
|
||||
&& result.as_ref().is_err_and(|error| {
|
||||
error.to_string().contains("empty sse stream")
|
||||
|| matches!(
|
||||
error,
|
||||
error.as_ref(),
|
||||
ClientInitializeError::ConnectionClosed(context)
|
||||
if context == "discover response"
|
||||
)
|
||||
@@ -247,7 +253,7 @@ fn should_retry_legacy_after_empty_discover(
|
||||
async fn connect_with_legacy_retry<T, E, A>(
|
||||
make_transport: impl Fn() -> T,
|
||||
ctx: ConnectContext,
|
||||
) -> Result<McpClient, ClientInitializeError>
|
||||
) -> Result<McpClient, Box<ClientInitializeError>>
|
||||
where
|
||||
T: IntoTransport<RoleClient, E, A>,
|
||||
E: std::error::Error + From<std::io::Error> + Send + Sync + 'static,
|
||||
@@ -741,7 +747,7 @@ mod tests {
|
||||
),
|
||||
),
|
||||
);
|
||||
assert!(should_attempt_oauth_fallback(&Err(err)));
|
||||
assert!(should_attempt_oauth_fallback(&Err(Box::new(err))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -751,7 +757,7 @@ mod tests {
|
||||
std::borrow::Cow::Borrowed("HTTP 401 Unauthorized"),
|
||||
),
|
||||
);
|
||||
assert!(should_attempt_oauth_fallback(&Err(err)));
|
||||
assert!(should_attempt_oauth_fallback(&Err(Box::new(err))));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -507,7 +507,7 @@ impl McpClient {
|
||||
pub(crate) async fn connect<T, E, A>(
|
||||
transport: T,
|
||||
ctx: ConnectContext,
|
||||
) -> Result<Self, ClientInitializeError>
|
||||
) -> Result<Self, Box<ClientInitializeError>>
|
||||
where
|
||||
T: IntoTransport<RoleClient, E, A>,
|
||||
E: std::error::Error + From<std::io::Error> + Send + Sync + 'static,
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "1.96.1"
|
||||
channel = "1.99.0"
|
||||
profile = "default"
|
||||
|
||||
Reference in New Issue
Block a user