feat(goose): support customizing extension timeout (#1428)

This commit is contained in:
Ariel
2025-03-01 04:17:53 +08:00
committed by GitHub
parent e8212c4005
commit fbc6bb7b90
10 changed files with 138 additions and 17 deletions
+10 -1
View File
@@ -23,6 +23,7 @@ enum ExtensionConfigRequest {
/// List of environment variable keys. The server will fetch their values from the keyring.
#[serde(default)]
env_keys: Vec<String>,
timeout: Option<u64>,
},
/// Standard I/O (stdio) extension.
#[serde(rename = "stdio")]
@@ -37,12 +38,14 @@ enum ExtensionConfigRequest {
/// List of environment variable keys. The server will fetch their values from the keyring.
#[serde(default)]
env_keys: Vec<String>,
timeout: Option<u64>,
},
/// Built-in extension that is part of the goose binary.
#[serde(rename = "builtin")]
Builtin {
/// The name of the built-in extension.
name: String,
timeout: Option<u64>,
},
}
@@ -84,6 +87,7 @@ async fn add_extension(
name,
uri,
env_keys,
timeout,
} => {
let mut env_map = HashMap::new();
for key in env_keys {
@@ -111,6 +115,7 @@ async fn add_extension(
name,
uri,
envs: Envs::new(env_map),
timeout,
}
}
ExtensionConfigRequest::Stdio {
@@ -118,6 +123,7 @@ async fn add_extension(
cmd,
args,
env_keys,
timeout,
} => {
let mut env_map = HashMap::new();
for key in env_keys {
@@ -146,9 +152,12 @@ async fn add_extension(
cmd,
args,
envs: Envs::new(env_map),
timeout,
}
}
ExtensionConfigRequest::Builtin { name } => ExtensionConfig::Builtin { name },
ExtensionConfigRequest::Builtin { name, timeout } => {
ExtensionConfig::Builtin { name, timeout }
}
};
// Acquire a lock on the agent and attempt to add the extension.