Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,257 changes: 610 additions & 647 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resolver = "2"
[workspace.package]
edition = "2021"
version = "1.41.0"
rust-version = "1.91.1"
rust-version = "1.94.1"
authors = ["AAIF <ai-oss-tools@block.xyz>"]
license = "Apache-2.0"
repository = "https://github.com/aaif-goose/goose"
Expand Down
4 changes: 2 additions & 2 deletions crates/goose-cli/src/commands/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn handle_project_default() -> Result<()> {
}

// Sort projects by last_accessed (newest first)
projects.sort_by(|a, b| b.last_accessed.cmp(&a.last_accessed));
projects.sort_by_key(|project| std::cmp::Reverse(project.last_accessed));

// Get the most recent project
let project = &projects[0];
Expand Down Expand Up @@ -178,7 +178,7 @@ pub fn handle_projects_interactive() -> Result<()> {
}

// Sort projects by last_accessed (newest first)
projects.sort_by(|a, b| b.last_accessed.cmp(&a.last_accessed));
projects.sort_by_key(|project| std::cmp::Reverse(project.last_accessed));

// Format project paths for display
let project_choices: Vec<(String, String)> = projects
Expand Down
2 changes: 2 additions & 0 deletions crates/goose-cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![recursion_limit = "256"]

#[cfg(not(any(feature = "rustls-tls", feature = "native-tls")))]
compile_error!("At least one of `rustls-tls` or `native-tls` features must be enabled");

Expand Down
2 changes: 2 additions & 0 deletions crates/goose-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![recursion_limit = "256"]
Comment thread
jbg marked this conversation as resolved.

use anyhow::Result;
use goose_cli::cli::cli;

Expand Down
4 changes: 2 additions & 2 deletions crates/goose-cli/src/session/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ impl GooseCompleter {
// Create completion candidates that match the prefix
let candidates: Vec<Pair> = cache
.prompts
.iter()
.flat_map(|(_, names)| names)
.values()
.flatten()
.filter(|name| name.starts_with(prefix.trim()))
.map(|name| Pair {
display: name.clone(),
Expand Down
6 changes: 2 additions & 4 deletions crates/goose-cli/src/session/streaming_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,8 @@ impl MarkdownBuffer {
}
}
"]" => {}
")" => {
if state.in_link_url {
state.in_link_url = false;
}
")" if state.in_link_url => {
state.in_link_url = false;
}
_ => {}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/goose-local-inference/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ pub fn recommend_local_model(runtime: &InferenceRuntime) -> String {
.iter()
.filter(|m| is_featured_model(&m.id) && m.size_bytes > 0)
.collect();
models.sort_by(|a, b| b.size_bytes.cmp(&a.size_bytes));
models.sort_by_key(|model| std::cmp::Reverse(model.size_bytes));

// Return largest that fits in available memory
for model in &models {
Expand Down
10 changes: 5 additions & 5 deletions crates/goose-mcp/src/computercontroller/pdf_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ pub async fn pdf_tool(
last_was_text = false;
}
}
Object::Real(offset) => {
if *offset < -100.0 {
text.push(' ');
last_was_text = false;
}
Object::Real(offset)
if *offset < -100.0 =>
{
text.push(' ');
last_was_text = false;
}
_ => {}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/goose-mcp/src/memory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl MemoryServer {
let category_memories = self.retrieve(&category, is_global, working_dir)?;
memories.insert(
category,
category_memories.into_iter().flat_map(|(_, v)| v).collect(),
category_memories.into_values().flatten().collect(),
);
}
}
Expand Down
6 changes: 2 additions & 4 deletions crates/goose-provider-types/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ fn repair_truncated_json(s: &str) -> String {
'"' => in_string = true,
'{' => closers.push('}'),
'[' => closers.push(']'),
'}' | ']' => {
if closers.last() == Some(&c) {
closers.pop();
}
'}' | ']' if closers.last() == Some(&c) => {
closers.pop();
}
_ => {}
}
Expand Down
3 changes: 2 additions & 1 deletion crates/goose/src/agents/mcp_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ impl ClientHandler for GooseClient {
})
}

#[allow(deprecated)]
fn get_info(&self) -> ClientInfo {
let extensions = self.resolved_extensions();

Expand Down Expand Up @@ -608,7 +609,7 @@ impl McpClient {
);
let client: rmcp::service::RunningService<rmcp::RoleClient, GooseClient> =
client.serve(transport).await?;
let server_info = client.peer_info().cloned();
let server_info = client.peer_info().map(|info| (*info).clone());

Ok(Self {
client: Mutex::new(client),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn format_structure(
}
if !lang_loc.is_empty() && total_loc > 0 {
let mut langs: Vec<_> = lang_loc.into_iter().collect();
langs.sort_by(|a, b| b.1.cmp(&a.1));
langs.sort_by_key(|(_, loc)| std::cmp::Reverse(*loc));
let parts: Vec<String> = langs
.iter()
.map(|(lang, loc)| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl OrchestratorClient {
};

// Most recent first
sessions.sort_by(|a, b| b.updated_at.cmp(&a.updated_at));
sessions.sort_by_key(|session| std::cmp::Reverse(session.updated_at));
let total = sessions.len();
sessions.truncate(limit);

Expand Down
2 changes: 2 additions & 0 deletions crates/goose/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![recursion_limit = "256"]

#[cfg(all(feature = "rustls-tls", feature = "native-tls"))]
compile_error!("Features `rustls-tls` and `native-tls` are mutually exclusive");

Expand Down
22 changes: 10 additions & 12 deletions crates/goose/src/providers/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,16 @@ fn unescape_json_values_in_place(value: &mut Value) {
unescape_json_values_in_place(v);
}
}
Value::String(s) => {
if s.contains('\\') {
*s = s
.replace("\\\\n", "\n")
.replace("\\\\t", "\t")
.replace("\\\\r", "\r")
.replace("\\\\\"", "\"")
.replace("\\n", "\n")
.replace("\\t", "\t")
.replace("\\r", "\r")
.replace("\\\"", "\"");
}
Value::String(s) if s.contains('\\') => {
*s = s
.replace("\\\\n", "\n")
.replace("\\\\t", "\t")
.replace("\\\\r", "\r")
.replace("\\\\\"", "\"")
.replace("\\n", "\n")
.replace("\\t", "\t")
.replace("\\r", "\r")
.replace("\\\"", "\"");
}
_ => {}
}
Expand Down
9 changes: 5 additions & 4 deletions crates/goose/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,10 @@ impl Scheduler {
}
};

let reset_stale_running_state = list
.iter_mut()
.fold(false, |changed, job| clear_running_state(job) || changed);
let mut reset_stale_running_state = false;
for job in &mut list {
reset_stale_running_state |= clear_running_state(job);
}
if reset_stale_running_state {
match serde_json::to_string_pretty(&list) {
Ok(data) => {
Expand Down Expand Up @@ -635,7 +636,7 @@ impl Scheduler {
.map(|s| (s.id.clone(), s))
.collect();

schedule_sessions.sort_by(|a, b| b.1.created_at.cmp(&a.1.created_at));
schedule_sessions.sort_by_key(|(_, session)| std::cmp::Reverse(session.created_at));
schedule_sessions.truncate(limit);

Ok(schedule_sessions)
Expand Down
2 changes: 1 addition & 1 deletion crates/goose/src/session/chat_history_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ impl<'a> ChatHistorySearch<'a> {
)
.collect();

results.sort_by(|a, b| b.last_activity.cmp(&a.last_activity));
results.sort_by_key(|result| std::cmp::Reverse(result.last_activity));

let total_matches = results.iter().map(|r| r.messages.len()).sum();
ChatRecallResults {
Expand Down
2 changes: 1 addition & 1 deletion crates/goose/tests/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl ProviderFixture {
for &var in config.clear_env {
env_vars.push((var, None));
}
let guard = env_lock::lock_env(env_vars.into_iter());
let guard = env_lock::lock_env(env_vars);

let expected_session_id = (config.expected_session_id)();
let mcp = McpFixture::new(expected_session_id.clone()).await;
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.92"
channel = "1.96.1"
profile = "default"
Loading