Improve dependency hygiene (#9360)
Signed-off-by: jh-block <jhugo@block.xyz>
This commit is contained in:
@@ -17,6 +17,7 @@ default = [
|
||||
"local-inference",
|
||||
"aws-providers",
|
||||
"telemetry",
|
||||
"nostr",
|
||||
"otel",
|
||||
"rustls-tls",
|
||||
"system-keyring",
|
||||
@@ -27,6 +28,7 @@ aws-providers = ["goose/aws-providers"]
|
||||
cuda = ["goose/cuda", "local-inference"]
|
||||
vulkan = ["goose/vulkan", "local-inference"]
|
||||
telemetry = ["goose/telemetry"]
|
||||
nostr = ["goose/nostr"]
|
||||
otel = ["goose/otel"]
|
||||
system-keyring = ["goose/system-keyring"]
|
||||
portable-default = ["rustls-tls", "aws-providers", "telemetry", "otel"]
|
||||
@@ -50,7 +52,7 @@ native-tls = [
|
||||
|
||||
[dependencies]
|
||||
goose = { path = "../goose", default-features = false }
|
||||
goose-mcp = { path = "../goose-mcp" }
|
||||
goose-mcp = { path = "../goose-mcp", default-features = false }
|
||||
rmcp = { workspace = true }
|
||||
axum = { workspace = true, features = ["ws", "macros"] }
|
||||
tokio = { workspace = true }
|
||||
@@ -66,31 +68,31 @@ anyhow = { workspace = true }
|
||||
bytes = { workspace = true }
|
||||
http = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
config = { version = "0.15.23", features = ["toml"] }
|
||||
config = { version = "0.15", default-features = false, features = ["toml"] }
|
||||
thiserror = { workspace = true }
|
||||
clap = { workspace = true }
|
||||
serde_yaml = { workspace = true }
|
||||
utoipa = { workspace = true, features = ["axum_extras", "chrono"] }
|
||||
reqwest = { workspace = true, features = ["json", "blocking", "multipart", "system-proxy"], default-features = false }
|
||||
reqwest = { workspace = true, features = ["json", "blocking", "multipart", "system-proxy"] }
|
||||
tokio-util = { workspace = true }
|
||||
serde_path_to_error = "0.1.20"
|
||||
tokio-tungstenite = { version = "0.29.0" }
|
||||
serde_path_to_error = { version = "0.1.8", default-features = false }
|
||||
tokio-tungstenite = { version = "0.29", default-features = false, features = ["connect"] }
|
||||
url = { workspace = true }
|
||||
rand = { workspace = true }
|
||||
hex = "0.4.3"
|
||||
subtle = "2.6"
|
||||
socket2 = "0.6.1"
|
||||
hex = { version = "0.4.3", default-features = false, features = ["std"] }
|
||||
subtle = { version = "2.5", default-features = false, features = ["std"] }
|
||||
socket2 = { version = "0.6", default-features = false }
|
||||
fs2 = { workspace = true }
|
||||
rustls = { version = "0.23", features = ["aws_lc_rs"], optional = true }
|
||||
rustls = { workspace = true, optional = true }
|
||||
uuid = { workspace = true }
|
||||
rcgen = "0.14"
|
||||
axum-server = { version = "0.8.0" }
|
||||
aws-lc-rs = { version = "1.17.0", optional = true }
|
||||
openssl = { version = "0.10", optional = true }
|
||||
pem = "3.0.6"
|
||||
rcgen = { version = "0.14", default-features = false, features = ["aws_lc_rs", "crypto", "pem"] }
|
||||
axum-server = { version = "0.8", default-features = false }
|
||||
aws-lc-rs = { version = "1.17", default-features = false, optional = true }
|
||||
openssl = { version = "0.10.66", default-features = false, optional = true }
|
||||
pem = { version = "3.0.2", default-features = false, features = ["std"] }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg = { version = "0.56.0" }
|
||||
winreg = { version = "0.56", default-features = false }
|
||||
|
||||
[[bin]]
|
||||
name = "goosed"
|
||||
@@ -101,7 +103,7 @@ name = "generate_schema"
|
||||
path = "src/bin/generate_schema.rs"
|
||||
|
||||
[dev-dependencies]
|
||||
tower = "0.5.2"
|
||||
tower = { version = "0.5.2", default-features = false }
|
||||
|
||||
[package.metadata.cargo-machete]
|
||||
ignored = [
|
||||
|
||||
@@ -708,7 +708,9 @@ async fn agent_add_extension(
|
||||
State(state): State<Arc<AppState>>,
|
||||
Json(request): Json<AddExtensionRequest>,
|
||||
) -> Result<StatusCode, ErrorResponse> {
|
||||
#[cfg(feature = "telemetry")]
|
||||
let extension_name = request.config.name();
|
||||
|
||||
let agent = state.get_agent(request.session_id.clone()).await?;
|
||||
|
||||
agent
|
||||
|
||||
@@ -11,6 +11,7 @@ use axum::{
|
||||
};
|
||||
use goose::agents::ExtensionConfig;
|
||||
use goose::recipe::Recipe;
|
||||
#[cfg(feature = "nostr")]
|
||||
use goose::session::nostr_share;
|
||||
use goose::session::session_manager::{SessionInsights, SessionType};
|
||||
use goose::session::{EnabledExtensionsState, Session};
|
||||
@@ -51,6 +52,7 @@ pub struct ImportSessionRequest {
|
||||
json: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "nostr"), allow(dead_code))]
|
||||
#[derive(Deserialize, ToSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ShareSessionNostrRequest {
|
||||
@@ -67,6 +69,7 @@ pub struct ShareSessionNostrResponse {
|
||||
relays: Vec<String>,
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "nostr"), allow(dead_code))]
|
||||
#[derive(Deserialize, ToSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ImportSessionNostrRequest {
|
||||
@@ -387,6 +390,7 @@ async fn import_session(
|
||||
Ok(Json(session))
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "nostr"), allow(unused_variables))]
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/sessions/{session_id}/share/nostr",
|
||||
@@ -410,25 +414,32 @@ async fn share_session_nostr(
|
||||
Path(session_id): Path<String>,
|
||||
Json(request): Json<ShareSessionNostrRequest>,
|
||||
) -> Result<Json<ShareSessionNostrResponse>, StatusCode> {
|
||||
let exported = state
|
||||
.session_manager()
|
||||
.export_session(&session_id)
|
||||
.await
|
||||
.map_err(|_| StatusCode::NOT_FOUND)?;
|
||||
#[cfg(feature = "nostr")]
|
||||
{
|
||||
let exported = state
|
||||
.session_manager()
|
||||
.export_session(&session_id)
|
||||
.await
|
||||
.map_err(|_| StatusCode::NOT_FOUND)?;
|
||||
|
||||
let relays = nostr_share::resolve_relays(request.relays, goose::config::Config::global());
|
||||
let share = nostr_share::publish_session_json(&exported, relays)
|
||||
.await
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
||||
let relays = nostr_share::resolve_relays(request.relays, goose::config::Config::global());
|
||||
let share = nostr_share::publish_session_json(&exported, relays)
|
||||
.await
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
||||
|
||||
Ok(Json(ShareSessionNostrResponse {
|
||||
deeplink: share.deeplink,
|
||||
nevent: share.nevent,
|
||||
event_id: share.event_id,
|
||||
relays: share.relays,
|
||||
}))
|
||||
Ok(Json(ShareSessionNostrResponse {
|
||||
deeplink: share.deeplink,
|
||||
nevent: share.nevent,
|
||||
event_id: share.event_id,
|
||||
relays: share.relays,
|
||||
}))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "nostr"))]
|
||||
Err(StatusCode::NOT_FOUND)
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "nostr"), allow(unused_variables))]
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/sessions/import/nostr",
|
||||
@@ -448,16 +459,22 @@ async fn import_session_nostr(
|
||||
State(state): State<Arc<AppState>>,
|
||||
Json(request): Json<ImportSessionNostrRequest>,
|
||||
) -> Result<Json<Session>, StatusCode> {
|
||||
let json = nostr_share::import_session_json_from_deeplink(&request.deeplink)
|
||||
.await
|
||||
.map_err(|_| StatusCode::BAD_REQUEST)?;
|
||||
let session = state
|
||||
.session_manager()
|
||||
.import_session(&json, Some(SessionType::User))
|
||||
.await
|
||||
.map_err(|_| StatusCode::BAD_REQUEST)?;
|
||||
#[cfg(feature = "nostr")]
|
||||
{
|
||||
let json = nostr_share::import_session_json_from_deeplink(&request.deeplink)
|
||||
.await
|
||||
.map_err(|_| StatusCode::BAD_REQUEST)?;
|
||||
let session = state
|
||||
.session_manager()
|
||||
.import_session(&json, Some(SessionType::User))
|
||||
.await
|
||||
.map_err(|_| StatusCode::BAD_REQUEST)?;
|
||||
|
||||
Ok(Json(session))
|
||||
Ok(Json(session))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "nostr"))]
|
||||
Err(StatusCode::NOT_FOUND)
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
|
||||
@@ -8,6 +8,7 @@ use utoipa::ToSchema;
|
||||
|
||||
use crate::state::AppState;
|
||||
|
||||
#[cfg_attr(not(feature = "telemetry"), allow(dead_code))]
|
||||
#[derive(Debug, Deserialize, ToSchema)]
|
||||
pub struct TelemetryEventRequest {
|
||||
pub event_name: String,
|
||||
@@ -15,6 +16,7 @@ pub struct TelemetryEventRequest {
|
||||
pub properties: HashMap<String, serde_json::Value>,
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "telemetry"), allow(unused_variables))]
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/telemetry/event",
|
||||
@@ -27,15 +29,17 @@ async fn send_telemetry_event(
|
||||
State(_state): State<Arc<AppState>>,
|
||||
Json(request): Json<TelemetryEventRequest>,
|
||||
) -> StatusCode {
|
||||
let event_name = request.event_name;
|
||||
let properties = request.properties;
|
||||
|
||||
#[cfg(feature = "telemetry")]
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = emit_event(&event_name, properties).await {
|
||||
tracing::debug!("Failed to send telemetry event: {}", e);
|
||||
}
|
||||
});
|
||||
{
|
||||
let event_name = request.event_name;
|
||||
let properties = request.properties;
|
||||
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = emit_event(&event_name, properties).await {
|
||||
tracing::debug!("Failed to send telemetry event: {}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
StatusCode::ACCEPTED
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ use goose::scheduler_trait::SchedulerTrait;
|
||||
use goose::session::SessionManager;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::path::PathBuf;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use std::sync::Arc;
|
||||
#[cfg(feature = "local-inference")]
|
||||
use std::sync::OnceLock;
|
||||
use tokio::sync::Mutex;
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user