Add option to run extensions in a container (#6590)
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use super::output;
|
||||
use super::CliSession;
|
||||
use console::style;
|
||||
use goose::agents::Agent;
|
||||
use goose::agents::{Agent, Container};
|
||||
use goose::config::get_enabled_extensions;
|
||||
use goose::config::resolve_extensions_for_new_session;
|
||||
use goose::config::{
|
||||
@@ -114,6 +114,8 @@ pub struct SessionBuilderConfig {
|
||||
pub quiet: bool,
|
||||
/// Output format (text, json)
|
||||
pub output_format: String,
|
||||
/// Docker container to run stdio extensions inside
|
||||
pub container: Option<Container>,
|
||||
}
|
||||
|
||||
/// Manual implementation of Default to ensure proper initialization of output_format
|
||||
@@ -139,6 +141,7 @@ impl Default for SessionBuilderConfig {
|
||||
interactive: false,
|
||||
quiet: false,
|
||||
output_format: "text".to_string(),
|
||||
container: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -371,6 +374,11 @@ pub async fn build_session(session_config: SessionBuilderConfig) -> CliSession {
|
||||
|
||||
let config = Config::global();
|
||||
let agent: Agent = Agent::new();
|
||||
|
||||
if session_config.container.is_some() {
|
||||
agent.set_container(session_config.container.clone()).await;
|
||||
}
|
||||
|
||||
let session_manager = agent.config.session_manager.clone();
|
||||
|
||||
let (saved_provider, saved_model_config) = if session_config.resume {
|
||||
@@ -678,6 +686,7 @@ mod tests {
|
||||
interactive: true,
|
||||
quiet: false,
|
||||
output_format: "text".to_string(),
|
||||
container: None,
|
||||
};
|
||||
|
||||
assert_eq!(config.extensions.len(), 1);
|
||||
|
||||
Reference in New Issue
Block a user