Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions crates/goose/src/agents/extension_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ impl ExtensionManager {
context: PlatformExtensionContext {
extension_manager: None,
session_manager,
session: None,
},
provider,
tools_cache: Mutex::new(None),
Expand Down Expand Up @@ -715,6 +716,11 @@ impl ExtensionManager {
})?;
let mut context = self.context.clone();
context.extension_manager = Some(Arc::downgrade(self));
if let Some(id) = session_id {
if let Ok(session) = self.context.session_manager.get_session(id, false).await {
context.session = Some(Arc::new(session));
}
}

(def.client_factory)(context)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ mod tests {
PlatformExtensionContext {
extension_manager: None,
session_manager: Arc::new(SessionManager::new(data_dir)),
session: None,
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/goose/src/agents/platform_extensions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub mod tom;
use std::collections::HashMap;

use crate::agents::mcp_client::McpClientTrait;
use crate::session::Session;
use once_cell::sync::Lazy;

pub use ext_manager::MANAGE_EXTENSIONS_TOOL_NAME_COMPLETE;
Expand Down Expand Up @@ -139,6 +140,7 @@ pub struct PlatformExtensionContext {
pub extension_manager:
Option<std::sync::Weak<crate::agents::extension_manager::ExtensionManager>>,
pub session_manager: std::sync::Arc<crate::session::SessionManager>,
pub session: Option<std::sync::Arc<Session>>,
}

impl PlatformExtensionContext {
Expand Down
Loading
Loading