From 4c634fd813323cc7fce2d3055f53246c1550a375 Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Mon, 23 Jun 2025 19:07:29 +1000 Subject: [PATCH 1/2] chore: remove unused dependencies - Removed unused dependencies: - lazy_static (replaced with once_cell) - paste (not used) - ctor (not used) - dotenv (not used) - wiremock from main dependencies (kept in dev-dependencies) - futures-util (functionality already in futures) Also updated code to use once_cell instead of lazy_static and futures::stream::StreamExt instead of futures_util::stream::StreamExt. --- Cargo.lock | 5 ----- crates/goose/Cargo.toml | 6 ------ crates/goose/src/agents/agent.rs | 4 +--- crates/goose/src/providers/githubcopilot.rs | 2 +- crates/goose/src/providers/oauth.rs | 6 ++---- 5 files changed, 4 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c03cea02bbca..455f85bbb779 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3426,25 +3426,20 @@ dependencies = [ "blake3", "chrono", "criterion", - "ctor", - "dotenv", "etcetera", "fs2", "futures", - "futures-util", "include_dir", "indoc 2.0.6", "jsonwebtoken", "keyring", "lancedb", - "lazy_static", "mcp-client", "mcp-core", "minijinja", "mockall", "nanoid", "once_cell", - "paste", "rand 0.8.5", "regex", "reqwest 0.12.12", diff --git a/crates/goose/Cargo.toml b/crates/goose/Cargo.toml index bf2a23d96387..3ad2563f412a 100644 --- a/crates/goose/Cargo.toml +++ b/crates/goose/Cargo.toml @@ -48,14 +48,9 @@ base64 = "0.21" url = "2.5" axum = "0.8.1" webbrowser = "0.8" -dotenv = "0.15" -lazy_static = "1.5" tracing = "0.1" tracing-subscriber = "0.3" -wiremock = "0.6.0" keyring = { version = "3.6.1", features = ["apple-native", "windows-native", "sync-secret-service", "vendored"] } -ctor = "0.2.7" -paste = "1.0" serde_yaml = "0.9.34" once_cell = "1.20.2" etcetera = "0.8.0" @@ -76,7 +71,6 @@ jsonwebtoken = "9.3.1" blake3 = "1.5" fs2 = "0.4.3" -futures-util = "0.3.31" tokio-stream = "0.1.17" # Vector database for tool selection diff --git a/crates/goose/src/agents/agent.rs b/crates/goose/src/agents/agent.rs index 0aa4497aeccd..28efc2debfb9 100644 --- a/crates/goose/src/agents/agent.rs +++ b/crates/goose/src/agents/agent.rs @@ -5,9 +5,7 @@ use std::sync::Arc; use anyhow::{anyhow, Result}; use futures::stream::BoxStream; -use futures::{FutureExt, Stream, TryStreamExt}; -use futures_util::stream; -use futures_util::stream::StreamExt; +use futures::{FutureExt, Stream, TryStreamExt, stream, StreamExt}; use mcp_core::protocol::JsonRpcMessage; use crate::config::{Config, ExtensionConfigManager, PermissionManager}; diff --git a/crates/goose/src/providers/githubcopilot.rs b/crates/goose/src/providers/githubcopilot.rs index e940ba120125..97bd3ad589e0 100644 --- a/crates/goose/src/providers/githubcopilot.rs +++ b/crates/goose/src/providers/githubcopilot.rs @@ -139,7 +139,7 @@ impl GithubCopilotProvider { async fn post(&self, mut payload: Value) -> Result { use crate::providers::utils_universal_openai_stream::{OAIStreamChunk, OAIStreamCollector}; - use futures_util::StreamExt; + use futures::StreamExt; // Detect gpt-4.1 and stream let model_name = payload.get("model").and_then(|v| v.as_str()).unwrap_or(""); let stream_only_model = GITHUB_COPILOT_STREAM_MODELS diff --git a/crates/goose/src/providers/oauth.rs b/crates/goose/src/providers/oauth.rs index a1533eacc729..3c35d6764655 100644 --- a/crates/goose/src/providers/oauth.rs +++ b/crates/goose/src/providers/oauth.rs @@ -3,17 +3,15 @@ use axum::{extract::Query, response::Html, routing::get, Router}; use base64::Engine; use chrono::{DateTime, Utc}; use etcetera::{choose_app_strategy, AppStrategy}; -use lazy_static::lazy_static; use serde::{Deserialize, Serialize}; use serde_json::Value; use sha2::Digest; use std::{collections::HashMap, fs, net::SocketAddr, path::PathBuf, sync::Arc}; use tokio::sync::{oneshot, Mutex as TokioMutex}; use url::Url; +use once_cell::sync::Lazy; -lazy_static! { - static ref OAUTH_MUTEX: TokioMutex<()> = TokioMutex::new(()); -} +static OAUTH_MUTEX: Lazy> = Lazy::new(|| TokioMutex::new(())); #[derive(Debug, Clone)] struct OidcEndpoints { From f40196b6db6dbf76fb8a539c49d806bca37cb63a Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Tue, 24 Jun 2025 17:26:11 +1000 Subject: [PATCH 2/2] fix things needed at build time --- Cargo.lock | 3 +++ crates/goose/Cargo.toml | 3 +++ crates/goose/src/agents/agent.rs | 2 +- crates/goose/src/providers/oauth.rs | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 455f85bbb779..14736f3007db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3426,6 +3426,8 @@ dependencies = [ "blake3", "chrono", "criterion", + "ctor", + "dotenv", "etcetera", "fs2", "futures", @@ -3434,6 +3436,7 @@ dependencies = [ "jsonwebtoken", "keyring", "lancedb", + "lazy_static", "mcp-client", "mcp-core", "minijinja", diff --git a/crates/goose/Cargo.toml b/crates/goose/Cargo.toml index 3ad2563f412a..c9e3e36f9e66 100644 --- a/crates/goose/Cargo.toml +++ b/crates/goose/Cargo.toml @@ -88,6 +88,9 @@ mockall = "0.13.1" wiremock = "0.6.0" tokio = { version = "1.43", features = ["full"] } temp-env = "0.3.6" +dotenv = "0.15.0" +lazy_static = "1.5.0" +ctor = "0.2.9" [[example]] name = "agent" diff --git a/crates/goose/src/agents/agent.rs b/crates/goose/src/agents/agent.rs index 73498f99cb59..db5e6a97639c 100644 --- a/crates/goose/src/agents/agent.rs +++ b/crates/goose/src/agents/agent.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use anyhow::{anyhow, Result}; use futures::stream::BoxStream; -use futures::{FutureExt, Stream, TryStreamExt, stream, StreamExt}; +use futures::{stream, FutureExt, Stream, StreamExt, TryStreamExt}; use mcp_core::protocol::JsonRpcMessage; use crate::config::{Config, ExtensionConfigManager, PermissionManager}; diff --git a/crates/goose/src/providers/oauth.rs b/crates/goose/src/providers/oauth.rs index 3c35d6764655..50c6ee0908b7 100644 --- a/crates/goose/src/providers/oauth.rs +++ b/crates/goose/src/providers/oauth.rs @@ -3,13 +3,13 @@ use axum::{extract::Query, response::Html, routing::get, Router}; use base64::Engine; use chrono::{DateTime, Utc}; use etcetera::{choose_app_strategy, AppStrategy}; +use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; use serde_json::Value; use sha2::Digest; use std::{collections::HashMap, fs, net::SocketAddr, path::PathBuf, sync::Arc}; use tokio::sync::{oneshot, Mutex as TokioMutex}; use url::Url; -use once_cell::sync::Lazy; static OAUTH_MUTEX: Lazy> = Lazy::new(|| TokioMutex::new(()));