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
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ license = "Apache-2.0"
repository = "https://github.com/block/goose"
description = "An AI agent"

[workspace.lints.clippy]
uninlined_format_args = "allow"

# Patch for Windows cross-compilation issue with crunchy
[patch.crates-io]
crunchy = { git = "https://github.com/nmathewson/crunchy", branch = "cross-compilation-fix" }
3 changes: 3 additions & 0 deletions crates/goose-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ license.workspace = true
repository.workspace = true
description.workspace = true

[lints]
workspace = true


[dependencies]
anyhow = "1.0"
Expand Down
3 changes: 3 additions & 0 deletions crates/goose-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ license.workspace = true
repository.workspace = true
description.workspace = true

[lints]
workspace = true

[[bin]]
name = "goose"
path = "src/main.rs"
Expand Down
3 changes: 3 additions & 0 deletions crates/goose-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ license.workspace = true
repository.workspace = true
description.workspace = true

[lints]
workspace = true

[lib]
name = "goose_ffi"
crate-type = ["cdylib"]
Expand Down
3 changes: 3 additions & 0 deletions crates/goose-llm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ license.workspace = true
repository.workspace = true
description.workspace = true

[lints]
workspace = true

[lib]
crate-type = ["lib", "cdylib"]
name = "goose_llm"
Expand Down
3 changes: 3 additions & 0 deletions crates/goose-mcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ license.workspace = true
repository.workspace = true
description.workspace = true

[lints]
workspace = true

[dependencies]
mcp-core = { path = "../mcp-core" }
mcp-server = { path = "../mcp-server" }
Expand Down
3 changes: 3 additions & 0 deletions crates/goose-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ license.workspace = true
repository.workspace = true
description.workspace = true

[lints]
workspace = true

[dependencies]
goose = { path = "../goose" }
mcp-core = { path = "../mcp-core" }
Expand Down
3 changes: 3 additions & 0 deletions crates/goose/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ license.workspace = true
repository.workspace = true
description.workspace = true

[lints]
workspace = true

[build-dependencies]
tokio = { version = "1.43", features = ["full"] }
reqwest = { version = "0.12.9", features = ["json", "rustls-tls-native-roots"], default-features = false }
Expand Down
20 changes: 8 additions & 12 deletions crates/goose/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
// Create base directory
fs::create_dir_all(BASE_DIR)?;
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed={}", BASE_DIR);
println!("cargo:rerun-if-changed={BASE_DIR}");

for tokenizer_name in TOKENIZERS {
download_tokenizer(tokenizer_name).await?;
Expand All @@ -21,30 +21,26 @@ async fn main() -> Result<(), Box<dyn Error>> {

async fn download_tokenizer(repo_id: &str) -> Result<(), Box<dyn Error>> {
let dir_name = repo_id.replace('/', "--");
let download_dir = format!("{}/{}", BASE_DIR, dir_name);
let file_url = format!(
"https://huggingface.co/{}/resolve/main/tokenizer.json",
repo_id
);
let file_path = format!("{}/tokenizer.json", download_dir);
let download_dir = format!("{BASE_DIR}/{dir_name}");
let file_url = format!("https://huggingface.co/{repo_id}/resolve/main/tokenizer.json");
let file_path = format!("{download_dir}/tokenizer.json");

// Create directory if it doesn't exist
fs::create_dir_all(&download_dir)?;

// Check if file already exists
if Path::new(&file_path).exists() {
println!("Tokenizer for {} already exists, skipping...", repo_id);
println!("Tokenizer for {repo_id} already exists, skipping...");
return Ok(());
}

println!("Downloading tokenizer for {}...", repo_id);
println!("Downloading tokenizer for {repo_id}...");

// Download the file
let response = reqwest::get(&file_url).await?;
if !response.status().is_success() {
return Err(format!(
"Failed to download tokenizer for {}, status: {}",
repo_id,
"Failed to download tokenizer for {repo_id}, status: {}",
response.status()
)
.into());
Expand All @@ -53,6 +49,6 @@ async fn download_tokenizer(repo_id: &str) -> Result<(), Box<dyn Error>> {
let content = response.bytes().await?;
fs::write(&file_path, content)?;

println!("Downloaded {} to {}", repo_id, file_path);
println!("Downloaded {repo_id} to {file_path}");
Ok(())
}
3 changes: 3 additions & 0 deletions crates/mcp-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "mcp-client"
version = "0.1.0"
edition = "2021"

[lints]
workspace = true

[dependencies]
mcp-core = { path = "../mcp-core" }
tokio = { version = "1", features = ["full"] }
Expand Down
5 changes: 1 addition & 4 deletions crates/mcp-client/src/transport/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,7 @@ impl StdioActor {
while let Some(message_str) = receiver.recv().await {
tracing::debug!(message = ?message_str, "Sending outgoing message");

if let Err(e) = stdin
.write_all(format!("{}\n", message_str).as_bytes())
.await
{
if let Err(e) = stdin.write_all(format!("{message_str}\n").as_bytes()).await {
tracing::error!(error = ?e, "Error writing message to child process");
break;
}
Expand Down
3 changes: 3 additions & 0 deletions crates/mcp-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "mcp-core"
version = "0.1.0"
edition = "2021"

[lints]
workspace = true

[dependencies]
async-trait = "0.1"
serde = { version = "1.0", features = ["derive"] }
Expand Down
3 changes: 3 additions & 0 deletions crates/mcp-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "mcp-macros"
version = "0.1.0"
edition = "2021"

[lints]
workspace = true

[lib]
proc-macro = true

Expand Down
3 changes: 3 additions & 0 deletions crates/mcp-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "mcp-server"
version = "0.1.0"
edition = "2021"

[lints]
workspace = true

[dependencies]
anyhow = "1.0.94"
thiserror = "1.0"
Expand Down
Loading